aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/platform/aclinux.h10
-rw-r--r--include/asm-generic/atomic.h12
-rw-r--r--include/asm-generic/dma-mapping-broken.h3
-rw-r--r--include/asm-generic/fcntl.h12
-rw-r--r--include/asm-generic/gpio.h15
-rw-r--r--include/asm-generic/io.h4
-rw-r--r--include/asm-generic/ioctls.h8
-rw-r--r--include/asm-generic/local64.h96
-rw-r--r--include/asm-generic/statfs.h9
-rw-r--r--include/asm-generic/termbits.h1
-rw-r--r--include/asm-generic/topology.h20
-rw-r--r--include/asm-generic/unistd.h35
-rw-r--r--include/asm-generic/vmlinux.lds.h5
-rw-r--r--include/drm/drm.h2
-rw-r--r--include/drm/drmP.h82
-rw-r--r--include/drm/drm_core.h2
-rw-r--r--include/drm/drm_crtc.h40
-rw-r--r--include/drm/drm_crtc_helper.h5
-rw-r--r--include/drm/drm_edid.h6
-rw-r--r--include/drm/drm_fb_helper.h5
-rw-r--r--include/drm/drm_global.h53
-rw-r--r--include/drm/drm_mm.h27
-rw-r--r--include/drm/drm_mode.h1
-rw-r--r--include/drm/drm_pciids.h7
-rw-r--r--include/drm/i2c/sil164.h63
-rw-r--r--include/drm/i915_drm.h9
-rw-r--r--include/drm/radeon_drm.h2
-rw-r--r--include/drm/ttm/ttm_bo_driver.h7
-rw-r--r--include/drm/ttm/ttm_module.h20
-rw-r--r--include/keys/dns_resolver-type.h23
-rw-r--r--include/linux/Kbuild3
-rw-r--r--include/linux/ahci_platform.h4
-rw-r--r--include/linux/amba/bus.h11
-rw-r--r--include/linux/amba/mmci.h10
-rw-r--r--include/linux/amba/serial.h3
-rw-r--r--include/linux/atmdev.h17
-rw-r--r--include/linux/audit.h2
-rw-r--r--include/linux/auto_fs.h1
-rw-r--r--include/linux/backing-dev.h24
-rw-r--r--include/linux/bio.h158
-rw-r--r--include/linux/blk_types.h196
-rw-r--r--include/linux/blkdev.h149
-rw-r--r--include/linux/blktrace_api.h18
-rw-r--r--include/linux/brcmphy.h7
-rw-r--r--include/linux/buffer_head.h27
-rw-r--r--include/linux/caif/caif_socket.h34
-rw-r--r--include/linux/can/platform/flexcan.h20
-rw-r--r--include/linux/capability.h3
-rw-r--r--include/linux/cgroup.h7
-rw-r--r--include/linux/clocksource.h17
-rw-r--r--include/linux/coda_psdev.h8
-rw-r--r--include/linux/compat.h6
-rw-r--r--include/linux/compiler-gcc.h3
-rw-r--r--include/linux/compiler.h2
-rw-r--r--include/linux/console.h18
-rw-r--r--include/linux/console_struct.h4
-rw-r--r--include/linux/cpu.h27
-rw-r--r--include/linux/cpufreq.h5
-rw-r--r--include/linux/cpuidle.h4
-rw-r--r--include/linux/cpuset.h6
-rw-r--r--include/linux/dcache.h2
-rw-r--r--include/linux/delay.h1
-rw-r--r--include/linux/device-mapper.h16
-rw-r--r--include/linux/device.h127
-rw-r--r--include/linux/dm-ioctl.h5
-rw-r--r--include/linux/dma-mapping.h10
-rw-r--r--include/linux/dmaengine.h71
-rw-r--r--include/linux/dmi.h9
-rw-r--r--include/linux/dnotify.h1
-rw-r--r--include/linux/dns_resolver.h34
-rw-r--r--include/linux/dqblk_xfs.h24
-rw-r--r--include/linux/drbd.h2
-rw-r--r--include/linux/drbd_nl.h9
-rw-r--r--include/linux/dvb/frontend.h1
-rw-r--r--include/linux/dvb/version.h2
-rw-r--r--include/linux/eeprom_93cx6.h1
-rw-r--r--include/linux/etherdevice.h14
-rw-r--r--include/linux/ethtool.h57
-rw-r--r--include/linux/ext3_fs.h3
-rw-r--r--include/linux/fanotify.h105
-rw-r--r--include/linux/fb.h17
-rw-r--r--include/linux/fdtable.h1
-rw-r--r--include/linux/filter.h48
-rw-r--r--include/linux/firewire-cdev.h501
-rw-r--r--include/linux/firewire.h62
-rw-r--r--include/linux/flex_array.h5
-rw-r--r--include/linux/fs.h145
-rw-r--r--include/linux/fs_struct.h27
-rw-r--r--include/linux/fscache-cache.h47
-rw-r--r--include/linux/fscache.h3
-rw-r--r--include/linux/fsl-diu-fb.h223
-rw-r--r--include/linux/fsnotify.h166
-rw-r--r--include/linux/fsnotify_backend.h199
-rw-r--r--include/linux/ftrace.h5
-rw-r--r--include/linux/ftrace_event.h18
-rw-r--r--include/linux/fuse.h34
-rw-r--r--include/linux/gpio_keys.h2
-rw-r--r--include/linux/hid.h1
-rw-r--r--include/linux/highmem.h14
-rw-r--r--include/linux/hugetlb.h14
-rw-r--r--include/linux/hugetlb_inline.h22
-rw-r--r--include/linux/i2c-mux.h46
-rw-r--r--include/linux/i2c.h35
-rw-r--r--include/linux/i2c/adp5588.h37
-rw-r--r--include/linux/i2c/mcs.h34
-rw-r--r--include/linux/i2c/mcs5000_ts.h24
-rw-r--r--include/linux/i2c/pca954x.h47
-rw-r--r--include/linux/i2c/qt602240_ts.h38
-rw-r--r--include/linux/i2c/sx150x.h78
-rw-r--r--include/linux/ide.h2
-rw-r--r--include/linux/if.h2
-rw-r--r--include/linux/if_bonding.h1
-rw-r--r--include/linux/if_bridge.h2
-rw-r--r--include/linux/if_ether.h2
-rw-r--r--include/linux/if_fddi.h8
-rw-r--r--include/linux/if_frad.h2
-rw-r--r--include/linux/if_hippi.h8
-rw-r--r--include/linux/if_link.h5
-rw-r--r--include/linux/if_macvlan.h23
-rw-r--r--include/linux/if_packet.h1
-rw-r--r--include/linux/if_pppox.h8
-rw-r--r--include/linux/in.h1
-rw-r--r--include/linux/inotify.h185
-rw-r--r--include/linux/input.h107
-rw-r--r--include/linux/input/adxl34x.h349
-rw-r--r--include/linux/input/cy8ctmg110_pdata.h10
-rw-r--r--include/linux/input/matrix_keypad.h6
-rw-r--r--include/linux/intel_mid_dma.h86
-rw-r--r--include/linux/intel_pmic_gpio.h15
-rw-r--r--include/linux/interrupt.h7
-rw-r--r--include/linux/io-mapping.h19
-rw-r--r--include/linux/io.h4
-rw-r--r--include/linux/iommu-helper.h12
-rw-r--r--include/linux/iommu.h1
-rw-r--r--include/linux/ip_vs.h2
-rw-r--r--include/linux/ipv6.h6
-rw-r--r--include/linux/iscsi_boot_sysfs.h123
-rw-r--r--include/linux/iscsi_ibft.h12
-rw-r--r--include/linux/isdnif.h2
-rw-r--r--include/linux/istallion.h2
-rw-r--r--include/linux/jbd2.h16
-rw-r--r--include/linux/jffs2.h5
-rw-r--r--include/linux/jz4740-adc.h32
-rw-r--r--include/linux/kdb.h4
-rw-r--r--include/linux/kernel.h44
-rw-r--r--include/linux/kfifo.h1193
-rw-r--r--include/linux/kgdb.h15
-rw-r--r--include/linux/kmemtrace.h25
-rw-r--r--include/linux/ks8842.h4
-rw-r--r--include/linux/ksm.h2
-rw-r--r--include/linux/kthread.h65
-rw-r--r--include/linux/kvm.h13
-rw-r--r--include/linux/kvm_host.h35
-rw-r--r--include/linux/kvm_types.h4
-rw-r--r--include/linux/libata.h1
-rw-r--r--include/linux/list.h13
-rw-r--r--include/linux/lru_cache.h2
-rw-r--r--include/linux/lsm_audit.h32
-rw-r--r--include/linux/mISDNif.h2
-rw-r--r--include/linux/marvell_phy.h21
-rw-r--r--include/linux/mbcache.h20
-rw-r--r--include/linux/memcontrol.h18
-rw-r--r--include/linux/mempolicy.h13
-rw-r--r--include/linux/mfd/ab8500.h6
-rw-r--r--include/linux/mfd/max8998-private.h112
-rw-r--r--include/linux/mfd/max8998.h78
-rw-r--r--include/linux/mfd/mc13783-private.h220
-rw-r--r--include/linux/mfd/mc13783.h2
-rw-r--r--include/linux/mfd/stmpe.h201
-rw-r--r--include/linux/mfd/tps6586x.h47
-rw-r--r--include/linux/mfd/wm8994/gpio.h4
-rw-r--r--include/linux/miscdevice.h1
-rw-r--r--include/linux/mm.h9
-rw-r--r--include/linux/mmc/card.h24
-rw-r--r--include/linux/mmc/core.h19
-rw-r--r--include/linux/mmc/host.h4
-rw-r--r--include/linux/mmc/mmc.h25
-rw-r--r--include/linux/mmc/sd.h5
-rw-r--r--include/linux/mmdebug.h2
-rw-r--r--include/linux/mmzone.h17
-rw-r--r--include/linux/moduleparam.h288
-rw-r--r--include/linux/mount.h7
-rw-r--r--include/linux/msi.h2
-rw-r--r--include/linux/mtd/bbm.h24
-rw-r--r--include/linux/mtd/blktrans.h16
-rw-r--r--include/linux/mtd/cfi.h20
-rw-r--r--include/linux/mtd/cfi_endian.h19
-rw-r--r--include/linux/mtd/compatmac.h10
-rw-r--r--include/linux/mtd/concat.h17
-rw-r--r--include/linux/mtd/doc2000.h23
-rw-r--r--include/linux/mtd/flashchip.h21
-rw-r--r--include/linux/mtd/gen_probe.h19
-rw-r--r--include/linux/mtd/map.h19
-rw-r--r--include/linux/mtd/mtd.h19
-rw-r--r--include/linux/mtd/nand.h8
-rw-r--r--include/linux/mtd/nand_ecc.h4
-rw-r--r--include/linux/mtd/nftl.h17
-rw-r--r--include/linux/mtd/onenand.h2
-rw-r--r--include/linux/mtd/physmap.h1
-rw-r--r--include/linux/nbd.h2
-rw-r--r--include/linux/ncp.h10
-rw-r--r--include/linux/ncp_fs_sb.h14
-rw-r--r--include/linux/netdevice.h169
-rw-r--r--include/linux/netfilter/Kbuild6
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h4
-rw-r--r--include/linux/netfilter/nfnetlink_log.h1
-rw-r--r--include/linux/netfilter/xt_CHECKSUM.h20
-rw-r--r--include/linux/netfilter/xt_IDLETIMER.h45
-rw-r--r--include/linux/netfilter/xt_cpu.h11
-rw-r--r--include/linux/netfilter/xt_ipvs.h27
-rw-r--r--include/linux/netfilter/xt_quota.h2
-rw-r--r--include/linux/netfilter_ipv4/ipt_LOG.h3
-rw-r--r--include/linux/netfilter_ipv6/ip6t_LOG.h3
-rw-r--r--include/linux/netpoll.h26
-rw-r--r--include/linux/nfs4.h1
-rw-r--r--include/linux/nfs_fs.h13
-rw-r--r--include/linux/nfs_fs_sb.h7
-rw-r--r--include/linux/nfs_mount.h1
-rw-r--r--include/linux/nfs_page.h1
-rw-r--r--include/linux/nfs_xdr.h12
-rw-r--r--include/linux/nilfs2_fs.h65
-rw-r--r--include/linux/nl80211.h24
-rw-r--r--include/linux/nmi.h13
-rw-r--r--include/linux/notifier.h1
-rw-r--r--include/linux/of.h10
-rw-r--r--include/linux/of_address.h44
-rw-r--r--include/linux/of_device.h49
-rw-r--r--include/linux/of_gpio.h35
-rw-r--r--include/linux/of_i2c.h13
-rw-r--r--include/linux/of_irq.h70
-rw-r--r--include/linux/of_platform.h65
-rw-r--r--include/linux/of_spi.h11
-rw-r--r--include/linux/omapfb.h7
-rw-r--r--include/linux/oom.h33
-rw-r--r--include/linux/padata.h121
-rw-r--r--include/linux/page-flags.h2
-rw-r--r--include/linux/pagemap.h13
-rw-r--r--include/linux/path.h5
-rw-r--r--include/linux/pch_dma.h37
-rw-r--r--include/linux/pci.h2
-rw-r--r--include/linux/pci_ids.h15
-rw-r--r--include/linux/percpu.h20
-rw-r--r--include/linux/percpu_counter.h11
-rw-r--r--include/linux/perf_event.h97
-rw-r--r--include/linux/phonet.h4
-rw-r--r--include/linux/phy.h24
-rw-r--r--include/linux/platform_device.h62
-rw-r--r--include/linux/plist.h29
-rw-r--r--include/linux/pm.h16
-rw-r--r--include/linux/pm_qos_params.h13
-rw-r--r--include/linux/pm_wakeup.h10
-rw-r--r--include/linux/pnp.h1
-rw-r--r--include/linux/poison.h9
-rw-r--r--include/linux/posix-timers.h2
-rw-r--r--include/linux/power/jz4740-battery.h24
-rw-r--r--include/linux/ppp_channel.h2
-rw-r--r--include/linux/ptp_classify.h126
-rw-r--r--include/linux/quotaops.h26
-rw-r--r--include/linux/radix-tree.h6
-rw-r--r--include/linux/raid/pq.h2
-rw-r--r--include/linux/rar_register.h44
-rw-r--r--include/linux/rcupdate.h82
-rw-r--r--include/linux/rds.h12
-rw-r--r--include/linux/regulator/ab8500.h25
-rw-r--r--include/linux/reiserfs_fs.h4
-rw-r--r--include/linux/reiserfs_fs_i.h4
-rw-r--r--include/linux/resource.h9
-rw-r--r--include/linux/rmap.h41
-rw-r--r--include/linux/rtnetlink.h1
-rw-r--r--include/linux/s3c_adc_battery.h36
-rw-r--r--include/linux/sched.h86
-rw-r--r--include/linux/sctp.h80
-rw-r--r--include/linux/security.h21
-rw-r--r--include/linux/serial.h9
-rw-r--r--include/linux/serial_8250.h5
-rw-r--r--include/linux/serial_core.h14
-rw-r--r--include/linux/serial_mfd.h47
-rw-r--r--include/linux/serial_reg.h16
-rw-r--r--include/linux/sh_clk.h23
-rw-r--r--include/linux/shmem_fs.h3
-rw-r--r--include/linux/skbuff.h75
-rw-r--r--include/linux/slab.h6
-rw-r--r--include/linux/slab_def.h7
-rw-r--r--include/linux/slob_def.h4
-rw-r--r--include/linux/slow-work.h163
-rw-r--r--include/linux/slub_def.h11
-rw-r--r--include/linux/snmp.h1
-rw-r--r--include/linux/socket.h5
-rw-r--r--include/linux/spi/ads7846.h3
-rw-r--r--include/linux/spi/max7301.h8
-rw-r--r--include/linux/ssb/ssb.h159
-rw-r--r--include/linux/statfs.h25
-rw-r--r--include/linux/sunrpc/auth.h21
-rw-r--r--include/linux/sunrpc/cache.h1
-rw-r--r--include/linux/sunrpc/clnt.h5
-rw-r--r--include/linux/sunrpc/sched.h7
-rw-r--r--include/linux/sunrpc/xprt.h1
-rw-r--r--include/linux/suspend.h17
-rw-r--r--include/linux/swap.h11
-rw-r--r--include/linux/swiotlb.h27
-rw-r--r--include/linux/syscalls.h30
-rw-r--r--include/linux/sysfs.h12
-rw-r--r--include/linux/sysv_fs.h11
-rw-r--r--include/linux/time.h25
-rw-r--r--include/linux/timer.h15
-rw-r--r--include/linux/topology.h5
-rw-r--r--include/linux/tty.h55
-rw-r--r--include/linux/types.h17
-rw-r--r--include/linux/u64_stats_sync.h140
-rw-r--r--include/linux/usb.h5
-rw-r--r--include/linux/usb/audio-v2.h17
-rw-r--r--include/linux/usb/audio.h12
-rw-r--r--include/linux/usb/composite.h6
-rw-r--r--include/linux/usb/ehci_def.h23
-rw-r--r--include/linux/usb/functionfs.h6
-rw-r--r--include/linux/usb/hcd.h31
-rw-r--r--include/linux/usb/otg.h11
-rw-r--r--include/linux/usb/quirks.h4
-rw-r--r--include/linux/usb/ulpi.h40
-rw-r--r--include/linux/usb/video.h404
-rw-r--r--include/linux/user_namespace.h14
-rw-r--r--include/linux/vgaarb.h1
-rw-r--r--include/linux/videodev2.h1
-rw-r--r--include/linux/virtio_9p.h2
-rw-r--r--include/linux/vmalloc.h4
-rw-r--r--include/linux/vt_kern.h64
-rw-r--r--include/linux/wlp.h22
-rw-r--r--include/linux/wm97xx_batt.h16
-rw-r--r--include/linux/workqueue.h158
-rw-r--r--include/linux/writeback.h5
-rw-r--r--include/linux/xattr.h14
-rw-r--r--include/media/cx2341x.h97
-rw-r--r--include/media/cx25840.h87
-rw-r--r--include/media/ir-core.h49
-rw-r--r--include/media/ir-kbd-i2c.h2
-rw-r--r--include/media/lirc.h168
-rw-r--r--include/media/lirc_dev.h225
-rw-r--r--include/media/rc-map.h11
-rw-r--r--include/media/sh_mobile_ceu.h3
-rw-r--r--include/media/sh_mobile_csi2.h46
-rw-r--r--include/media/soc_camera.h3
-rw-r--r--include/media/v4l2-ctrls.h460
-rw-r--r--include/media/v4l2-dev.h4
-rw-r--r--include/media/v4l2-device.h4
-rw-r--r--include/media/v4l2-mediabus.h13
-rw-r--r--include/media/v4l2-subdev.h54
-rw-r--r--include/media/videobuf-core.h6
-rw-r--r--include/media/videobuf-dma-sg.h39
-rw-r--r--include/media/videobuf-vmalloc.h2
-rw-r--r--include/mtd/mtd-abi.h18
-rw-r--r--include/mtd/mtd-user.h17
-rw-r--r--include/mtd/nftl-user.h16
-rw-r--r--include/mtd/ubi-user.h2
-rw-r--r--include/net/9p/9p.h113
-rw-r--r--include/net/9p/client.h33
-rw-r--r--include/net/act_api.h2
-rw-r--r--include/net/af_unix.h4
-rw-r--r--include/net/bluetooth/bluetooth.h3
-rw-r--r--include/net/bluetooth/hci.h187
-rw-r--r--include/net/bluetooth/hci_core.h30
-rw-r--r--include/net/bluetooth/l2cap.h38
-rw-r--r--include/net/bluetooth/rfcomm.h14
-rw-r--r--include/net/caif/caif_dev.h8
-rw-r--r--include/net/caif/caif_layer.h6
-rw-r--r--include/net/caif/caif_spi.h153
-rw-r--r--include/net/caif/cfcnfg.h16
-rw-r--r--include/net/caif/cfsrvl.h15
-rw-r--r--include/net/cfg80211.h221
-rw-r--r--include/net/dn_dev.h8
-rw-r--r--include/net/dn_nsp.h16
-rw-r--r--include/net/dn_route.h4
-rw-r--r--include/net/genetlink.h15
-rw-r--r--include/net/inet_common.h59
-rw-r--r--include/net/inet_frag.h1
-rw-r--r--include/net/inet_sock.h3
-rw-r--r--include/net/inetpeer.h30
-rw-r--r--include/net/ip.h29
-rw-r--r--include/net/ip6_fib.h10
-rw-r--r--include/net/ip6_tunnel.h2
-rw-r--r--include/net/ip_vs.h14
-rw-r--r--include/net/ipip.h2
-rw-r--r--include/net/ipv6.h16
-rw-r--r--include/net/ipx.h8
-rw-r--r--include/net/irda/irda.h4
-rw-r--r--include/net/irda/irlap_frame.h18
-rw-r--r--include/net/lib80211.h3
-rw-r--r--include/net/mac80211.h145
-rw-r--r--include/net/mip6.h2
-rw-r--r--include/net/ndisc.h2
-rw-r--r--include/net/neighbour.h2
-rw-r--r--include/net/netfilter/nf_conntrack.h17
-rw-r--r--include/net/netfilter/nf_conntrack_acct.h12
-rw-r--r--include/net/netfilter/nf_conntrack_core.h2
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h9
-rw-r--r--include/net/netfilter/nf_nat_protocol.h8
-rw-r--r--include/net/netfilter/nf_nat_rule.h2
-rw-r--r--include/net/netfilter/nfnetlink_log.h2
-rw-r--r--include/net/netfilter/xt_rateest.h11
-rw-r--r--include/net/netlink.h2
-rw-r--r--include/net/phonet/pn_dev.h1
-rw-r--r--include/net/pkt_sched.h2
-rw-r--r--include/net/regulatory.h1
-rw-r--r--include/net/route.h6
-rw-r--r--include/net/sch_generic.h38
-rw-r--r--include/net/scm.h30
-rw-r--r--include/net/sctp/structs.h4
-rw-r--r--include/net/snmp.h75
-rw-r--r--include/net/sock.h18
-rw-r--r--include/net/tcp.h260
-rw-r--r--include/net/udp.h38
-rw-r--r--include/pcmcia/cistpl.h2
-rw-r--r--include/pcmcia/cs.h157
-rw-r--r--include/pcmcia/cs_types.h40
-rw-r--r--include/pcmcia/ds.h251
-rw-r--r--include/pcmcia/ss.h25
-rw-r--r--include/rdma/ib_verbs.h2
-rw-r--r--include/rxrpc/packet.h8
-rw-r--r--include/scsi/fc/fc_els.h11
-rw-r--r--include/scsi/fc/fc_fcoe.h15
-rw-r--r--include/scsi/fc/fc_fip.h46
-rw-r--r--include/scsi/fc/fc_ns.h7
-rw-r--r--include/scsi/fc_encode.h7
-rw-r--r--include/scsi/fc_frame.h52
-rw-r--r--include/scsi/iscsi_if.h2
-rw-r--r--include/scsi/libfc.h75
-rw-r--r--include/scsi/libfcoe.h72
-rw-r--r--include/scsi/libsas.h11
-rw-r--r--include/scsi/scsi.h8
-rw-r--r--include/scsi/scsi_device.h8
-rw-r--r--include/scsi/scsi_netlink.h4
-rw-r--r--include/scsi/scsi_transport_iscsi.h2
-rw-r--r--include/sound/asound.h6
-rw-r--r--include/sound/pcm.h8
-rw-r--r--include/sound/sh_fsi.h49
-rw-r--r--include/sound/soc-dapm.h2
-rw-r--r--include/sound/soc.h21
-rw-r--r--include/sound/tlv320dac33-plat.h2
-rw-r--r--include/sound/uda134x.h12
-rw-r--r--include/trace/boot.h60
-rw-r--r--include/trace/events/block.h15
-rw-r--r--include/trace/events/ext4.h20
-rw-r--r--include/trace/events/gfpflags.h37
-rw-r--r--include/trace/events/kmem.h38
-rw-r--r--include/trace/events/power.h27
-rw-r--r--include/trace/events/sched.h32
-rw-r--r--include/trace/events/timer.h80
-rw-r--r--include/trace/events/vmscan.h275
-rw-r--r--include/trace/events/workqueue.h92
-rw-r--r--include/trace/events/writeback.h159
-rw-r--r--include/trace/ftrace.h23
-rw-r--r--include/trace/syscall.h1
-rw-r--r--include/video/mipi_display.h130
-rw-r--r--include/video/sh_mipi_dsi.h35
-rw-r--r--include/video/sh_mobile_hdmi.h22
-rw-r--r--include/video/sh_mobile_lcdc.h41
-rw-r--r--include/xen/events.h7
-rw-r--r--include/xen/grant_table.h4
-rw-r--r--include/xen/hvm.h30
-rw-r--r--include/xen/interface/features.h6
-rw-r--r--include/xen/interface/grant_table.h1
-rw-r--r--include/xen/interface/hvm/hvm_op.h46
-rw-r--r--include/xen/interface/hvm/params.h95
-rw-r--r--include/xen/interface/memory.h50
-rw-r--r--include/xen/platform_pci.h49
-rw-r--r--include/xen/swiotlb-xen.h65
-rw-r--r--include/xen/xen-ops.h9
466 files changed, 12310 insertions, 4599 deletions
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index e5039a2856f8..103f08aca764 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -148,13 +148,17 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
148#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a) 148#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a)
149#define ACPI_FREE(a) kfree(a) 149#define ACPI_FREE(a) kfree(a)
150 150
151/* Used within ACPICA to show where it is safe to preempt execution */ 151#ifndef CONFIG_PREEMPT
152#include <linux/hardirq.h> 152/*
153 * Used within ACPICA to show where it is safe to preempt execution
154 * when CONFIG_PREEMPT=n
155 */
153#define ACPI_PREEMPTION_POINT() \ 156#define ACPI_PREEMPTION_POINT() \
154 do { \ 157 do { \
155 if (!in_atomic_preempt_off() && !irqs_disabled()) \ 158 if (!irqs_disabled()) \
156 cond_resched(); \ 159 cond_resched(); \
157 } while (0) 160 } while (0)
161#endif
158 162
159#endif /* __KERNEL__ */ 163#endif /* __KERNEL__ */
160 164
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 058129e9b04c..e53347fbf1da 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -57,11 +57,11 @@ static inline int atomic_add_return(int i, atomic_t *v)
57 unsigned long flags; 57 unsigned long flags;
58 int temp; 58 int temp;
59 59
60 local_irq_save(flags); 60 raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */
61 temp = v->counter; 61 temp = v->counter;
62 temp += i; 62 temp += i;
63 v->counter = temp; 63 v->counter = temp;
64 local_irq_restore(flags); 64 raw_local_irq_restore(flags);
65 65
66 return temp; 66 return temp;
67} 67}
@@ -78,11 +78,11 @@ static inline int atomic_sub_return(int i, atomic_t *v)
78 unsigned long flags; 78 unsigned long flags;
79 int temp; 79 int temp;
80 80
81 local_irq_save(flags); 81 raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */
82 temp = v->counter; 82 temp = v->counter;
83 temp -= i; 83 temp -= i;
84 v->counter = temp; 84 v->counter = temp;
85 local_irq_restore(flags); 85 raw_local_irq_restore(flags);
86 86
87 return temp; 87 return temp;
88} 88}
@@ -135,9 +135,9 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
135 unsigned long flags; 135 unsigned long flags;
136 136
137 mask = ~mask; 137 mask = ~mask;
138 local_irq_save(flags); 138 raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */
139 *addr &= mask; 139 *addr &= mask;
140 local_irq_restore(flags); 140 raw_local_irq_restore(flags);
141} 141}
142 142
143#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v))) 143#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v)))
diff --git a/include/asm-generic/dma-mapping-broken.h b/include/asm-generic/dma-mapping-broken.h
index 82cd0cb1c3fe..ccf7b4f34a3c 100644
--- a/include/asm-generic/dma-mapping-broken.h
+++ b/include/asm-generic/dma-mapping-broken.h
@@ -72,9 +72,6 @@ dma_set_mask(struct device *dev, u64 mask);
72extern int 72extern int
73dma_get_cache_alignment(void); 73dma_get_cache_alignment(void);
74 74
75extern int
76dma_is_consistent(struct device *dev, dma_addr_t dma_handle);
77
78extern void 75extern void
79dma_cache_sync(struct device *dev, void *vaddr, size_t size, 76dma_cache_sync(struct device *dev, void *vaddr, size_t size,
80 enum dma_data_direction direction); 77 enum dma_data_direction direction);
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h
index fcd268ce0674..a70b2d2bfc14 100644
--- a/include/asm-generic/fcntl.h
+++ b/include/asm-generic/fcntl.h
@@ -3,6 +3,18 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6/*
7 * FMODE_EXEC is 0x20
8 * FMODE_NONOTIFY is 0x1000000
9 * These cannot be used by userspace O_* until internal and external open
10 * flags are split.
11 * -Eric Paris
12 */
13
14/*
15 * When introducing new O_* bits, please check its uniqueness in fcntl_init().
16 */
17
6#define O_ACCMODE 00000003 18#define O_ACCMODE 00000003
7#define O_RDONLY 00000000 19#define O_RDONLY 00000000
8#define O_WRONLY 00000001 20#define O_WRONLY 00000001
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 4f3d75e1ad39..c7376bf80b06 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -31,6 +31,7 @@ static inline int gpio_is_valid(int number)
31struct device; 31struct device;
32struct seq_file; 32struct seq_file;
33struct module; 33struct module;
34struct device_node;
34 35
35/** 36/**
36 * struct gpio_chip - abstract a GPIO controller 37 * struct gpio_chip - abstract a GPIO controller
@@ -106,6 +107,17 @@ struct gpio_chip {
106 const char *const *names; 107 const char *const *names;
107 unsigned can_sleep:1; 108 unsigned can_sleep:1;
108 unsigned exported:1; 109 unsigned exported:1;
110
111#if defined(CONFIG_OF_GPIO)
112 /*
113 * If CONFIG_OF is enabled, then all GPIO controllers described in the
114 * device tree automatically may have an OF translation
115 */
116 struct device_node *of_node;
117 int of_gpio_n_cells;
118 int (*of_xlate)(struct gpio_chip *gc, struct device_node *np,
119 const void *gpio_spec, u32 *flags);
120#endif
109}; 121};
110 122
111extern const char *gpiochip_is_requested(struct gpio_chip *chip, 123extern const char *gpiochip_is_requested(struct gpio_chip *chip,
@@ -115,6 +127,9 @@ extern int __must_check gpiochip_reserve(int start, int ngpio);
115/* add/remove chips */ 127/* add/remove chips */
116extern int gpiochip_add(struct gpio_chip *chip); 128extern int gpiochip_add(struct gpio_chip *chip);
117extern int __must_check gpiochip_remove(struct gpio_chip *chip); 129extern int __must_check gpiochip_remove(struct gpio_chip *chip);
130extern struct gpio_chip *gpiochip_find(void *data,
131 int (*match)(struct gpio_chip *chip,
132 void *data));
118 133
119 134
120/* Always use the library code for GPIO management calls, 135/* Always use the library code for GPIO management calls,
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index bcee6365dca0..118601fce92d 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -188,11 +188,15 @@ static inline void outsl(unsigned long addr, const void *buffer, int count)
188#ifndef CONFIG_GENERIC_IOMAP 188#ifndef CONFIG_GENERIC_IOMAP
189#define ioread8(addr) readb(addr) 189#define ioread8(addr) readb(addr)
190#define ioread16(addr) readw(addr) 190#define ioread16(addr) readw(addr)
191#define ioread16be(addr) be16_to_cpu(ioread16(addr))
191#define ioread32(addr) readl(addr) 192#define ioread32(addr) readl(addr)
193#define ioread32be(addr) be32_to_cpu(ioread32(addr))
192 194
193#define iowrite8(v, addr) writeb((v), (addr)) 195#define iowrite8(v, addr) writeb((v), (addr))
194#define iowrite16(v, addr) writew((v), (addr)) 196#define iowrite16(v, addr) writew((v), (addr))
197#define iowrite16be(v, addr) iowrite16(be16_to_cpu(v), (addr))
195#define iowrite32(v, addr) writel((v), (addr)) 198#define iowrite32(v, addr) writel((v), (addr))
199#define iowrite32be(v, addr) iowrite32(be32_to_cpu(v), (addr))
196 200
197#define ioread8_rep(p, dst, count) \ 201#define ioread8_rep(p, dst, count) \
198 insb((unsigned long) (p), (dst), (count)) 202 insb((unsigned long) (p), (dst), (count))
diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h
index a799e20a769e..8554cb6a81b9 100644
--- a/include/asm-generic/ioctls.h
+++ b/include/asm-generic/ioctls.h
@@ -69,6 +69,7 @@
69#define TCSETX 0x5433 69#define TCSETX 0x5433
70#define TCSETXF 0x5434 70#define TCSETXF 0x5434
71#define TCSETXW 0x5435 71#define TCSETXW 0x5435
72#define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */
72 73
73#define FIONCLEX 0x5450 74#define FIONCLEX 0x5450
74#define FIOCLEX 0x5451 75#define FIOCLEX 0x5451
@@ -87,12 +88,10 @@
87#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ 88#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
88 89
89/* 90/*
90 * some architectures define FIOQSIZE as 0x545E, which is used for 91 * Some arches already define FIOQSIZE due to a historical
91 * TIOCGHAYESESP on others 92 * conflict with a Hayes modem-specific ioctl value.
92 */ 93 */
93#ifndef FIOQSIZE 94#ifndef FIOQSIZE
94# define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */
95# define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */
96# define FIOQSIZE 0x5460 95# define FIOQSIZE 0x5460
97#endif 96#endif
98 97
@@ -104,6 +103,7 @@
104#define TIOCPKT_START 8 103#define TIOCPKT_START 8
105#define TIOCPKT_NOSTOP 16 104#define TIOCPKT_NOSTOP 16
106#define TIOCPKT_DOSTOP 32 105#define TIOCPKT_DOSTOP 32
106#define TIOCPKT_IOCTL 64
107 107
108#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ 108#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
109 109
diff --git a/include/asm-generic/local64.h b/include/asm-generic/local64.h
new file mode 100644
index 000000000000..02ac760c1a8b
--- /dev/null
+++ b/include/asm-generic/local64.h
@@ -0,0 +1,96 @@
1#ifndef _ASM_GENERIC_LOCAL64_H
2#define _ASM_GENERIC_LOCAL64_H
3
4#include <linux/percpu.h>
5#include <asm/types.h>
6
7/*
8 * A signed long type for operations which are atomic for a single CPU.
9 * Usually used in combination with per-cpu variables.
10 *
11 * This is the default implementation, which uses atomic64_t. Which is
12 * rather pointless. The whole point behind local64_t is that some processors
13 * can perform atomic adds and subtracts in a manner which is atomic wrt IRQs
14 * running on this CPU. local64_t allows exploitation of such capabilities.
15 */
16
17/* Implement in terms of atomics. */
18
19#if BITS_PER_LONG == 64
20
21#include <asm/local.h>
22
23typedef struct {
24 local_t a;
25} local64_t;
26
27#define LOCAL64_INIT(i) { LOCAL_INIT(i) }
28
29#define local64_read(l) local_read(&(l)->a)
30#define local64_set(l,i) local_set((&(l)->a),(i))
31#define local64_inc(l) local_inc(&(l)->a)
32#define local64_dec(l) local_dec(&(l)->a)
33#define local64_add(i,l) local_add((i),(&(l)->a))
34#define local64_sub(i,l) local_sub((i),(&(l)->a))
35
36#define local64_sub_and_test(i, l) local_sub_and_test((i), (&(l)->a))
37#define local64_dec_and_test(l) local_dec_and_test(&(l)->a)
38#define local64_inc_and_test(l) local_inc_and_test(&(l)->a)
39#define local64_add_negative(i, l) local_add_negative((i), (&(l)->a))
40#define local64_add_return(i, l) local_add_return((i), (&(l)->a))
41#define local64_sub_return(i, l) local_sub_return((i), (&(l)->a))
42#define local64_inc_return(l) local_inc_return(&(l)->a)
43
44#define local64_cmpxchg(l, o, n) local_cmpxchg((&(l)->a), (o), (n))
45#define local64_xchg(l, n) local_xchg((&(l)->a), (n))
46#define local64_add_unless(l, _a, u) local_add_unless((&(l)->a), (_a), (u))
47#define local64_inc_not_zero(l) local_inc_not_zero(&(l)->a)
48
49/* Non-atomic variants, ie. preemption disabled and won't be touched
50 * in interrupt, etc. Some archs can optimize this case well. */
51#define __local64_inc(l) local64_set((l), local64_read(l) + 1)
52#define __local64_dec(l) local64_set((l), local64_read(l) - 1)
53#define __local64_add(i,l) local64_set((l), local64_read(l) + (i))
54#define __local64_sub(i,l) local64_set((l), local64_read(l) - (i))
55
56#else /* BITS_PER_LONG != 64 */
57
58#include <asm/atomic.h>
59
60/* Don't use typedef: don't want them to be mixed with atomic_t's. */
61typedef struct {
62 atomic64_t a;
63} local64_t;
64
65#define LOCAL64_INIT(i) { ATOMIC_LONG_INIT(i) }
66
67#define local64_read(l) atomic64_read(&(l)->a)
68#define local64_set(l,i) atomic64_set((&(l)->a),(i))
69#define local64_inc(l) atomic64_inc(&(l)->a)
70#define local64_dec(l) atomic64_dec(&(l)->a)
71#define local64_add(i,l) atomic64_add((i),(&(l)->a))
72#define local64_sub(i,l) atomic64_sub((i),(&(l)->a))
73
74#define local64_sub_and_test(i, l) atomic64_sub_and_test((i), (&(l)->a))
75#define local64_dec_and_test(l) atomic64_dec_and_test(&(l)->a)
76#define local64_inc_and_test(l) atomic64_inc_and_test(&(l)->a)
77#define local64_add_negative(i, l) atomic64_add_negative((i), (&(l)->a))
78#define local64_add_return(i, l) atomic64_add_return((i), (&(l)->a))
79#define local64_sub_return(i, l) atomic64_sub_return((i), (&(l)->a))
80#define local64_inc_return(l) atomic64_inc_return(&(l)->a)
81
82#define local64_cmpxchg(l, o, n) atomic64_cmpxchg((&(l)->a), (o), (n))
83#define local64_xchg(l, n) atomic64_xchg((&(l)->a), (n))
84#define local64_add_unless(l, _a, u) atomic64_add_unless((&(l)->a), (_a), (u))
85#define local64_inc_not_zero(l) atomic64_inc_not_zero(&(l)->a)
86
87/* Non-atomic variants, ie. preemption disabled and won't be touched
88 * in interrupt, etc. Some archs can optimize this case well. */
89#define __local64_inc(l) local64_set((l), local64_read(l) + 1)
90#define __local64_dec(l) local64_set((l), local64_read(l) - 1)
91#define __local64_add(i,l) local64_set((l), local64_read(l) + (i))
92#define __local64_sub(i,l) local64_set((l), local64_read(l) - (i))
93
94#endif /* BITS_PER_LONG != 64 */
95
96#endif /* _ASM_GENERIC_LOCAL64_H */
diff --git a/include/asm-generic/statfs.h b/include/asm-generic/statfs.h
index 3b4fb3e52f0d..0fd28e028de1 100644
--- a/include/asm-generic/statfs.h
+++ b/include/asm-generic/statfs.h
@@ -33,7 +33,8 @@ struct statfs {
33 __kernel_fsid_t f_fsid; 33 __kernel_fsid_t f_fsid;
34 __statfs_word f_namelen; 34 __statfs_word f_namelen;
35 __statfs_word f_frsize; 35 __statfs_word f_frsize;
36 __statfs_word f_spare[5]; 36 __statfs_word f_flags;
37 __statfs_word f_spare[4];
37}; 38};
38 39
39/* 40/*
@@ -55,7 +56,8 @@ struct statfs64 {
55 __kernel_fsid_t f_fsid; 56 __kernel_fsid_t f_fsid;
56 __statfs_word f_namelen; 57 __statfs_word f_namelen;
57 __statfs_word f_frsize; 58 __statfs_word f_frsize;
58 __statfs_word f_spare[5]; 59 __statfs_word f_flags;
60 __statfs_word f_spare[4];
59} ARCH_PACK_STATFS64; 61} ARCH_PACK_STATFS64;
60 62
61/* 63/*
@@ -77,7 +79,8 @@ struct compat_statfs64 {
77 __kernel_fsid_t f_fsid; 79 __kernel_fsid_t f_fsid;
78 __u32 f_namelen; 80 __u32 f_namelen;
79 __u32 f_frsize; 81 __u32 f_frsize;
80 __u32 f_spare[5]; 82 __u32 f_flags;
83 __u32 f_spare[4];
81} ARCH_PACK_COMPAT_STATFS64; 84} ARCH_PACK_COMPAT_STATFS64;
82 85
83#endif 86#endif
diff --git a/include/asm-generic/termbits.h b/include/asm-generic/termbits.h
index 1c9773d48cb0..232b4781aef3 100644
--- a/include/asm-generic/termbits.h
+++ b/include/asm-generic/termbits.h
@@ -178,6 +178,7 @@ struct ktermios {
178#define FLUSHO 0010000 178#define FLUSHO 0010000
179#define PENDIN 0040000 179#define PENDIN 0040000
180#define IEXTEN 0100000 180#define IEXTEN 0100000
181#define EXTPROC 0200000
181 182
182/* tcflow() and TCXONC use these */ 183/* tcflow() and TCXONC use these */
183#define TCOOFF 0 184#define TCOOFF 0
diff --git a/include/asm-generic/topology.h b/include/asm-generic/topology.h
index fd60700503c8..fc824e2828f3 100644
--- a/include/asm-generic/topology.h
+++ b/include/asm-generic/topology.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2002, IBM Corp. 6 * Copyright (C) 2002, IBM Corp.
7 * 7 *
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 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 11 * it under the terms of the GNU General Public License as published by
@@ -34,9 +34,16 @@
34#ifndef cpu_to_node 34#ifndef cpu_to_node
35#define cpu_to_node(cpu) ((void)(cpu),0) 35#define cpu_to_node(cpu) ((void)(cpu),0)
36#endif 36#endif
37#ifndef set_numa_node
38#define set_numa_node(node)
39#endif
40#ifndef set_cpu_numa_node
41#define set_cpu_numa_node(cpu, node)
42#endif
37#ifndef cpu_to_mem 43#ifndef cpu_to_mem
38#define cpu_to_mem(cpu) ((void)(cpu),0) 44#define cpu_to_mem(cpu) ((void)(cpu),0)
39#endif 45#endif
46
40#ifndef parent_node 47#ifndef parent_node
41#define parent_node(node) ((void)(node),0) 48#define parent_node(node) ((void)(node),0)
42#endif 49#endif
@@ -55,4 +62,15 @@
55 62
56#endif /* CONFIG_NUMA */ 63#endif /* CONFIG_NUMA */
57 64
65#if !defined(CONFIG_NUMA) || !defined(CONFIG_HAVE_MEMORYLESS_NODES)
66
67#ifndef set_numa_mem
68#define set_numa_mem(node)
69#endif
70#ifndef set_cpu_numa_mem
71#define set_cpu_numa_mem(cpu, node)
72#endif
73
74#endif /* !CONFIG_NUMA || !CONFIG_HAVE_MEMORYLESS_NODES */
75
58#endif /* _ASM_GENERIC_TOPOLOGY_H */ 76#endif /* _ASM_GENERIC_TOPOLOGY_H */
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index 6a0b30f78a62..e1898090f22c 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -18,7 +18,7 @@
18#define __SYSCALL(x, y) 18#define __SYSCALL(x, y)
19#endif 19#endif
20 20
21#if __BITS_PER_LONG == 32 21#if __BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)
22#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32) 22#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32)
23#else 23#else
24#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64) 24#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64)
@@ -241,8 +241,13 @@ __SYSCALL(__NR_sync, sys_sync)
241__SYSCALL(__NR_fsync, sys_fsync) 241__SYSCALL(__NR_fsync, sys_fsync)
242#define __NR_fdatasync 83 242#define __NR_fdatasync 83
243__SYSCALL(__NR_fdatasync, sys_fdatasync) 243__SYSCALL(__NR_fdatasync, sys_fdatasync)
244#ifdef __ARCH_WANT_SYNC_FILE_RANGE2
245#define __NR_sync_file_range2 84
246__SYSCALL(__NR_sync_file_range2, sys_sync_file_range2)
247#else
244#define __NR_sync_file_range 84 248#define __NR_sync_file_range 84
245__SYSCALL(__NR_sync_file_range, sys_sync_file_range) /* .long sys_sync_file_range2, */ 249__SYSCALL(__NR_sync_file_range, sys_sync_file_range)
250#endif
246 251
247/* fs/timerfd.c */ 252/* fs/timerfd.c */
248#define __NR_timerfd_create 85 253#define __NR_timerfd_create 85
@@ -580,7 +585,7 @@ __SYSCALL(__NR_execve, sys_execve) /* .long sys_execve_wrapper */
580__SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap) 585__SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap)
581/* mm/fadvise.c */ 586/* mm/fadvise.c */
582#define __NR3264_fadvise64 223 587#define __NR3264_fadvise64 223
583__SC_3264(__NR3264_fadvise64, sys_fadvise64_64, sys_fadvise64) 588__SYSCALL(__NR3264_fadvise64, sys_fadvise64_64)
584 589
585/* mm/, CONFIG_MMU only */ 590/* mm/, CONFIG_MMU only */
586#ifndef __ARCH_NOMMU 591#ifndef __ARCH_NOMMU
@@ -627,8 +632,19 @@ __SYSCALL(__NR_accept4, sys_accept4)
627#define __NR_recvmmsg 243 632#define __NR_recvmmsg 243
628__SYSCALL(__NR_recvmmsg, sys_recvmmsg) 633__SYSCALL(__NR_recvmmsg, sys_recvmmsg)
629 634
635/*
636 * Architectures may provide up to 16 syscalls of their own
637 * starting with this value.
638 */
639#define __NR_arch_specific_syscall 244
640
641#define __NR_wait4 260
642__SYSCALL(__NR_wait4, sys_wait4)
643#define __NR_prlimit64 261
644__SYSCALL(__NR_prlimit64, sys_prlimit64)
645
630#undef __NR_syscalls 646#undef __NR_syscalls
631#define __NR_syscalls 244 647#define __NR_syscalls 262
632 648
633/* 649/*
634 * All syscalls below here should go away really, 650 * All syscalls below here should go away really,
@@ -694,7 +710,8 @@ __SYSCALL(__NR_signalfd, sys_signalfd)
694#define __NR_syscalls (__NR_signalfd+1) 710#define __NR_syscalls (__NR_signalfd+1)
695#endif /* __ARCH_WANT_SYSCALL_NO_FLAGS */ 711#endif /* __ARCH_WANT_SYSCALL_NO_FLAGS */
696 712
697#if __BITS_PER_LONG == 32 && defined(__ARCH_WANT_SYSCALL_OFF_T) 713#if (__BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)) && \
714 defined(__ARCH_WANT_SYSCALL_OFF_T)
698#define __NR_sendfile 1046 715#define __NR_sendfile 1046
699__SYSCALL(__NR_sendfile, sys_sendfile) 716__SYSCALL(__NR_sendfile, sys_sendfile)
700#define __NR_ftruncate 1047 717#define __NR_ftruncate 1047
@@ -740,6 +757,7 @@ __SYSCALL(__NR_getpgrp, sys_getpgrp)
740__SYSCALL(__NR_pause, sys_pause) 757__SYSCALL(__NR_pause, sys_pause)
741#define __NR_time 1062 758#define __NR_time 1062
742#define __ARCH_WANT_SYS_TIME 759#define __ARCH_WANT_SYS_TIME
760#define __ARCH_WANT_COMPAT_SYS_TIME
743__SYSCALL(__NR_time, sys_time) 761__SYSCALL(__NR_time, sys_time)
744#define __NR_utime 1063 762#define __NR_utime 1063
745#define __ARCH_WANT_SYS_UTIME 763#define __ARCH_WANT_SYS_UTIME
@@ -763,8 +781,8 @@ __SYSCALL(__NR_epoll_wait, sys_epoll_wait)
763__SYSCALL(__NR_ustat, sys_ustat) 781__SYSCALL(__NR_ustat, sys_ustat)
764#define __NR_vfork 1071 782#define __NR_vfork 1071
765__SYSCALL(__NR_vfork, sys_vfork) 783__SYSCALL(__NR_vfork, sys_vfork)
766#define __NR_wait4 1072 784#define __NR_oldwait4 1072
767__SYSCALL(__NR_wait4, sys_wait4) 785__SYSCALL(__NR_oldwait4, sys_wait4)
768#define __NR_recv 1073 786#define __NR_recv 1073
769__SYSCALL(__NR_recv, sys_recv) 787__SYSCALL(__NR_recv, sys_recv)
770#define __NR_send 1074 788#define __NR_send 1074
@@ -801,7 +819,7 @@ __SYSCALL(__NR_fork, sys_ni_syscall)
801 * Here we map the numbers so that both versions 819 * Here we map the numbers so that both versions
802 * use the same syscall table layout. 820 * use the same syscall table layout.
803 */ 821 */
804#if __BITS_PER_LONG == 64 822#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
805#define __NR_fcntl __NR3264_fcntl 823#define __NR_fcntl __NR3264_fcntl
806#define __NR_statfs __NR3264_statfs 824#define __NR_statfs __NR3264_statfs
807#define __NR_fstatfs __NR3264_fstatfs 825#define __NR_fstatfs __NR3264_fstatfs
@@ -848,6 +866,7 @@ __SYSCALL(__NR_fork, sys_ni_syscall)
848#endif 866#endif
849#define __ARCH_WANT_SYS_RT_SIGACTION 867#define __ARCH_WANT_SYS_RT_SIGACTION
850#define __ARCH_WANT_SYS_RT_SIGSUSPEND 868#define __ARCH_WANT_SYS_RT_SIGSUSPEND
869#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
851 870
852/* 871/*
853 * "Conditional" syscalls 872 * "Conditional" syscalls
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 030a954ed292..8a92a170fb7d 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -156,10 +156,6 @@
156 CPU_KEEP(exit.data) \ 156 CPU_KEEP(exit.data) \
157 MEM_KEEP(init.data) \ 157 MEM_KEEP(init.data) \
158 MEM_KEEP(exit.data) \ 158 MEM_KEEP(exit.data) \
159 . = ALIGN(8); \
160 VMLINUX_SYMBOL(__start___markers) = .; \
161 *(__markers) \
162 VMLINUX_SYMBOL(__stop___markers) = .; \
163 . = ALIGN(32); \ 159 . = ALIGN(32); \
164 VMLINUX_SYMBOL(__start___tracepoints) = .; \ 160 VMLINUX_SYMBOL(__start___tracepoints) = .; \
165 *(__tracepoints) \ 161 *(__tracepoints) \
@@ -653,6 +649,7 @@
653 EXIT_DATA \ 649 EXIT_DATA \
654 EXIT_CALL \ 650 EXIT_CALL \
655 *(.discard) \ 651 *(.discard) \
652 *(.discard.*) \
656 } 653 }
657 654
658/** 655/**
diff --git a/include/drm/drm.h b/include/drm/drm.h
index e3f46e0cb7dc..e5f70617dec5 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -663,6 +663,8 @@ struct drm_gem_open {
663#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) 663#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock)
664#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) 664#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock)
665 665
666#define DRM_IOCTL_GEM_PRIME_OPEN DRM_IOWR(0x2e, struct drm_gem_open)
667
666#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) 668#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30)
667#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) 669#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31)
668#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode) 670#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode)
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index c1b987158dfa..2a512bc0d4ab 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -9,6 +9,7 @@
9/* 9/*
10 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 10 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
11 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 11 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
12 * Copyright (c) 2009-2010, Code Aurora Forum.
12 * All rights reserved. 13 * All rights reserved.
13 * 14 *
14 * Permission is hereby granted, free of charge, to any person obtaining a 15 * Permission is hereby granted, free of charge, to any person obtaining a
@@ -48,9 +49,9 @@
48#include <linux/proc_fs.h> 49#include <linux/proc_fs.h>
49#include <linux/init.h> 50#include <linux/init.h>
50#include <linux/file.h> 51#include <linux/file.h>
52#include <linux/platform_device.h>
51#include <linux/pci.h> 53#include <linux/pci.h>
52#include <linux/jiffies.h> 54#include <linux/jiffies.h>
53#include <linux/smp_lock.h> /* For (un)lock_kernel */
54#include <linux/dma-mapping.h> 55#include <linux/dma-mapping.h>
55#include <linux/mm.h> 56#include <linux/mm.h>
56#include <linux/cdev.h> 57#include <linux/cdev.h>
@@ -144,6 +145,7 @@ extern void drm_ut_debug_printk(unsigned int request_level,
144#define DRIVER_IRQ_VBL2 0x800 145#define DRIVER_IRQ_VBL2 0x800
145#define DRIVER_GEM 0x1000 146#define DRIVER_GEM 0x1000
146#define DRIVER_MODESET 0x2000 147#define DRIVER_MODESET 0x2000
148#define DRIVER_USE_PLATFORM_DEVICE 0x4000
147 149
148/***********************************************************************/ 150/***********************************************************************/
149/** \name Begin the DRM... */ 151/** \name Begin the DRM... */
@@ -403,6 +405,8 @@ struct drm_pending_event {
403 struct drm_event *event; 405 struct drm_event *event;
404 struct list_head link; 406 struct list_head link;
405 struct drm_file *file_priv; 407 struct drm_file *file_priv;
408 pid_t pid; /* pid of requester, no guarantee it's valid by the time
409 we deliver the event, for tracing only */
406 void (*destroy)(struct drm_pending_event *event); 410 void (*destroy)(struct drm_pending_event *event);
407}; 411};
408 412
@@ -823,6 +827,7 @@ struct drm_driver {
823 int num_ioctls; 827 int num_ioctls;
824 struct file_operations fops; 828 struct file_operations fops;
825 struct pci_driver pci_driver; 829 struct pci_driver pci_driver;
830 struct platform_device *platform_device;
826 /* List of devices hanging off this driver */ 831 /* List of devices hanging off this driver */
827 struct list_head device_list; 832 struct list_head device_list;
828}; 833};
@@ -1015,12 +1020,16 @@ struct drm_device {
1015 1020
1016 struct drm_agp_head *agp; /**< AGP data */ 1021 struct drm_agp_head *agp; /**< AGP data */
1017 1022
1023 struct device *dev; /**< Device structure */
1018 struct pci_dev *pdev; /**< PCI device structure */ 1024 struct pci_dev *pdev; /**< PCI device structure */
1019 int pci_vendor; /**< PCI vendor id */ 1025 int pci_vendor; /**< PCI vendor id */
1020 int pci_device; /**< PCI device id */ 1026 int pci_device; /**< PCI device id */
1021#ifdef __alpha__ 1027#ifdef __alpha__
1022 struct pci_controller *hose; 1028 struct pci_controller *hose;
1023#endif 1029#endif
1030
1031 struct platform_device *platformdev; /**< Platform device struture */
1032
1024 struct drm_sg_mem *sg; /**< Scatter gather memory */ 1033 struct drm_sg_mem *sg; /**< Scatter gather memory */
1025 int num_crtcs; /**< Number of CRTCs on this device */ 1034 int num_crtcs; /**< Number of CRTCs on this device */
1026 void *dev_private; /**< device private data */ 1035 void *dev_private; /**< device private data */
@@ -1060,22 +1069,36 @@ struct drm_device {
1060 1069
1061}; 1070};
1062 1071
1063static inline int drm_dev_to_irq(struct drm_device *dev)
1064{
1065 return dev->pdev->irq;
1066}
1067
1068static __inline__ int drm_core_check_feature(struct drm_device *dev, 1072static __inline__ int drm_core_check_feature(struct drm_device *dev,
1069 int feature) 1073 int feature)
1070{ 1074{
1071 return ((dev->driver->driver_features & feature) ? 1 : 0); 1075 return ((dev->driver->driver_features & feature) ? 1 : 0);
1072} 1076}
1073 1077
1074#ifdef __alpha__ 1078static inline int drm_dev_to_irq(struct drm_device *dev)
1075#define drm_get_pci_domain(dev) dev->hose->index 1079{
1076#else 1080 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1077#define drm_get_pci_domain(dev) 0 1081 return platform_get_irq(dev->platformdev, 0);
1078#endif 1082 else
1083 return dev->pdev->irq;
1084}
1085
1086static inline int drm_get_pci_domain(struct drm_device *dev)
1087{
1088 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1089 return 0;
1090
1091#ifndef __alpha__
1092 /* For historical reasons, drm_get_pci_domain() is busticated
1093 * on most archs and has to remain so for userspace interface
1094 * < 1.4, except on alpha which was right from the beginning
1095 */
1096 if (dev->if_version < 0x10004)
1097 return 0;
1098#endif /* __alpha__ */
1099
1100 return pci_domain_nr(dev->pdev->bus);
1101}
1079 1102
1080#if __OS_HAS_AGP 1103#if __OS_HAS_AGP
1081static inline int drm_core_has_AGP(struct drm_device *dev) 1104static inline int drm_core_has_AGP(struct drm_device *dev)
@@ -1138,6 +1161,7 @@ extern long drm_compat_ioctl(struct file *filp,
1138extern int drm_lastclose(struct drm_device *dev); 1161extern int drm_lastclose(struct drm_device *dev);
1139 1162
1140 /* Device support (drm_fops.h) */ 1163 /* Device support (drm_fops.h) */
1164extern struct mutex drm_global_mutex;
1141extern int drm_open(struct inode *inode, struct file *filp); 1165extern int drm_open(struct inode *inode, struct file *filp);
1142extern int drm_stub_open(struct inode *inode, struct file *filp); 1166extern int drm_stub_open(struct inode *inode, struct file *filp);
1143extern int drm_fasync(int fd, struct file *filp, int on); 1167extern int drm_fasync(int fd, struct file *filp, int on);
@@ -1273,10 +1297,6 @@ extern int drm_freebufs(struct drm_device *dev, void *data,
1273extern int drm_mapbufs(struct drm_device *dev, void *data, 1297extern int drm_mapbufs(struct drm_device *dev, void *data,
1274 struct drm_file *file_priv); 1298 struct drm_file *file_priv);
1275extern int drm_order(unsigned long size); 1299extern int drm_order(unsigned long size);
1276extern resource_size_t drm_get_resource_start(struct drm_device *dev,
1277 unsigned int resource);
1278extern resource_size_t drm_get_resource_len(struct drm_device *dev,
1279 unsigned int resource);
1280 1300
1281 /* DMA support (drm_dma.h) */ 1301 /* DMA support (drm_dma.h) */
1282extern int drm_dma_setup(struct drm_device *dev); 1302extern int drm_dma_setup(struct drm_device *dev);
@@ -1351,8 +1371,11 @@ extern int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
1351struct drm_master *drm_master_create(struct drm_minor *minor); 1371struct drm_master *drm_master_create(struct drm_minor *minor);
1352extern struct drm_master *drm_master_get(struct drm_master *master); 1372extern struct drm_master *drm_master_get(struct drm_master *master);
1353extern void drm_master_put(struct drm_master **master); 1373extern void drm_master_put(struct drm_master **master);
1354extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, 1374extern int drm_get_pci_dev(struct pci_dev *pdev,
1355 struct drm_driver *driver); 1375 const struct pci_device_id *ent,
1376 struct drm_driver *driver);
1377extern int drm_get_platform_dev(struct platform_device *pdev,
1378 struct drm_driver *driver);
1356extern void drm_put_dev(struct drm_device *dev); 1379extern void drm_put_dev(struct drm_device *dev);
1357extern int drm_put_minor(struct drm_minor **minor); 1380extern int drm_put_minor(struct drm_minor **minor);
1358extern unsigned int drm_debug; 1381extern unsigned int drm_debug;
@@ -1440,6 +1463,8 @@ void drm_gem_vm_open(struct vm_area_struct *vma);
1440void drm_gem_vm_close(struct vm_area_struct *vma); 1463void drm_gem_vm_close(struct vm_area_struct *vma);
1441int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); 1464int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
1442 1465
1466#include "drm_global.h"
1467
1443static inline void 1468static inline void
1444drm_gem_object_reference(struct drm_gem_object *obj) 1469drm_gem_object_reference(struct drm_gem_object *obj)
1445{ 1470{
@@ -1529,6 +1554,9 @@ static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev,
1529 1554
1530static __inline__ int drm_device_is_agp(struct drm_device *dev) 1555static __inline__ int drm_device_is_agp(struct drm_device *dev)
1531{ 1556{
1557 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1558 return 0;
1559
1532 if (dev->driver->device_is_agp != NULL) { 1560 if (dev->driver->device_is_agp != NULL) {
1533 int err = (*dev->driver->device_is_agp) (dev); 1561 int err = (*dev->driver->device_is_agp) (dev);
1534 1562
@@ -1542,7 +1570,10 @@ static __inline__ int drm_device_is_agp(struct drm_device *dev)
1542 1570
1543static __inline__ int drm_device_is_pcie(struct drm_device *dev) 1571static __inline__ int drm_device_is_pcie(struct drm_device *dev)
1544{ 1572{
1545 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); 1573 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1574 return 0;
1575 else
1576 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
1546} 1577}
1547 1578
1548static __inline__ void drm_core_dropmap(struct drm_local_map *map) 1579static __inline__ void drm_core_dropmap(struct drm_local_map *map)
@@ -1550,6 +1581,21 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1550} 1581}
1551 1582
1552#include "drm_mem_util.h" 1583#include "drm_mem_util.h"
1584
1585static inline void *drm_get_device(struct drm_device *dev)
1586{
1587 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1588 return dev->platformdev;
1589 else
1590 return dev->pdev;
1591}
1592
1593extern int drm_platform_init(struct drm_driver *driver);
1594extern int drm_pci_init(struct drm_driver *driver);
1595extern int drm_fill_in_dev(struct drm_device *dev,
1596 const struct pci_device_id *ent,
1597 struct drm_driver *driver);
1598int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type);
1553/*@}*/ 1599/*@}*/
1554 1600
1555#endif /* __KERNEL__ */ 1601#endif /* __KERNEL__ */
diff --git a/include/drm/drm_core.h b/include/drm/drm_core.h
index 316739036079..4e7523863a4b 100644
--- a/include/drm/drm_core.h
+++ b/include/drm/drm_core.h
@@ -27,7 +27,7 @@
27#define CORE_DATE "20060810" 27#define CORE_DATE "20060810"
28 28
29#define DRM_IF_MAJOR 1 29#define DRM_IF_MAJOR 1
30#define DRM_IF_MINOR 3 30#define DRM_IF_MINOR 4
31 31
32#define CORE_MAJOR 1 32#define CORE_MAJOR 1
33#define CORE_MINOR 1 33#define CORE_MINOR 1
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 93a1a31b9c2d..c9f3cc5949a8 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -31,7 +31,6 @@
31#include <linux/idr.h> 31#include <linux/idr.h>
32 32
33#include <linux/fb.h> 33#include <linux/fb.h>
34#include <linux/slow-work.h>
35 34
36struct drm_device; 35struct drm_device;
37struct drm_mode_set; 36struct drm_mode_set;
@@ -190,49 +189,16 @@ enum subpixel_order {
190 */ 189 */
191struct drm_display_info { 190struct drm_display_info {
192 char name[DRM_DISPLAY_INFO_LEN]; 191 char name[DRM_DISPLAY_INFO_LEN];
193 /* Input info */ 192
194 bool serration_vsync;
195 bool sync_on_green;
196 bool composite_sync;
197 bool separate_syncs;
198 bool blank_to_black;
199 unsigned char video_level;
200 bool digital;
201 /* Physical size */ 193 /* Physical size */
202 unsigned int width_mm; 194 unsigned int width_mm;
203 unsigned int height_mm; 195 unsigned int height_mm;
204 196
205 /* Display parameters */
206 unsigned char gamma; /* FIXME: storage format */
207 bool gtf_supported;
208 bool standard_color;
209 enum {
210 monochrome = 0,
211 rgb,
212 other,
213 unknown,
214 } display_type;
215 bool active_off_supported;
216 bool suspend_supported;
217 bool standby_supported;
218
219 /* Color info FIXME: storage format */
220 unsigned short redx, redy;
221 unsigned short greenx, greeny;
222 unsigned short bluex, bluey;
223 unsigned short whitex, whitey;
224
225 /* Clock limits FIXME: storage format */ 197 /* Clock limits FIXME: storage format */
226 unsigned int min_vfreq, max_vfreq; 198 unsigned int min_vfreq, max_vfreq;
227 unsigned int min_hfreq, max_hfreq; 199 unsigned int min_hfreq, max_hfreq;
228 unsigned int pixel_clock; 200 unsigned int pixel_clock;
229 201
230 /* White point indices FIXME: storage format */
231 unsigned int wpx1, wpy1;
232 unsigned int wpgamma1;
233 unsigned int wpx2, wpy2;
234 unsigned int wpgamma2;
235
236 enum subpixel_order subpixel_order; 202 enum subpixel_order subpixel_order;
237 203
238 char *raw_edid; /* if any */ 204 char *raw_edid; /* if any */
@@ -343,7 +309,7 @@ struct drm_crtc_funcs {
343 309
344 /* Set gamma on the CRTC */ 310 /* Set gamma on the CRTC */
345 void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, 311 void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
346 uint32_t size); 312 uint32_t start, uint32_t size);
347 /* Object destroy routine */ 313 /* Object destroy routine */
348 void (*destroy)(struct drm_crtc *crtc); 314 void (*destroy)(struct drm_crtc *crtc);
349 315
@@ -595,7 +561,7 @@ struct drm_mode_config {
595 561
596 /* output poll support */ 562 /* output poll support */
597 bool poll_enabled; 563 bool poll_enabled;
598 struct delayed_slow_work output_poll_slow_work; 564 struct delayed_work output_poll_work;
599 565
600 /* pointers to standard properties */ 566 /* pointers to standard properties */
601 struct list_head property_blob_list; 567 struct list_head property_blob_list;
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index 1121f7799c6f..59b7073b13fe 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -60,9 +60,14 @@ struct drm_crtc_helper_funcs {
60 /* Move the crtc on the current fb to the given position *optional* */ 60 /* Move the crtc on the current fb to the given position *optional* */
61 int (*mode_set_base)(struct drm_crtc *crtc, int x, int y, 61 int (*mode_set_base)(struct drm_crtc *crtc, int x, int y,
62 struct drm_framebuffer *old_fb); 62 struct drm_framebuffer *old_fb);
63 int (*mode_set_base_atomic)(struct drm_crtc *crtc,
64 struct drm_framebuffer *fb, int x, int y);
63 65
64 /* reload the current crtc LUT */ 66 /* reload the current crtc LUT */
65 void (*load_lut)(struct drm_crtc *crtc); 67 void (*load_lut)(struct drm_crtc *crtc);
68
69 /* disable crtc when not in use - more explicit than dpms off */
70 void (*disable)(struct drm_crtc *crtc);
66}; 71};
67 72
68struct drm_encoder_helper_funcs { 73struct drm_encoder_helper_funcs {
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 39e2cc5c7e66..5881fad91faa 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -28,6 +28,12 @@
28#define EDID_LENGTH 128 28#define EDID_LENGTH 128
29#define DDC_ADDR 0x50 29#define DDC_ADDR 0x50
30 30
31#define CEA_EXT 0x02
32#define VTB_EXT 0x10
33#define DI_EXT 0x40
34#define LS_EXT 0x50
35#define MI_EXT 0x60
36
31struct est_timings { 37struct est_timings {
32 u8 t1; 38 u8 t1;
33 u8 t2; 39 u8 t2;
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index f0a6afc47e76..f22e7fe4b6db 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -32,6 +32,8 @@
32 32
33struct drm_fb_helper; 33struct drm_fb_helper;
34 34
35#include <linux/kgdb.h>
36
35struct drm_fb_helper_crtc { 37struct drm_fb_helper_crtc {
36 uint32_t crtc_id; 38 uint32_t crtc_id;
37 struct drm_mode_set mode_set; 39 struct drm_mode_set mode_set;
@@ -78,6 +80,7 @@ struct drm_fb_helper_connector {
78 80
79struct drm_fb_helper { 81struct drm_fb_helper {
80 struct drm_framebuffer *fb; 82 struct drm_framebuffer *fb;
83 struct drm_framebuffer *saved_fb;
81 struct drm_device *dev; 84 struct drm_device *dev;
82 struct drm_display_mode *mode; 85 struct drm_display_mode *mode;
83 int crtc_count; 86 int crtc_count;
@@ -126,5 +129,7 @@ int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info);
126bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper); 129bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);
127bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel); 130bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel);
128int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper); 131int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper);
132int drm_fb_helper_debug_enter(struct fb_info *info);
133int drm_fb_helper_debug_leave(struct fb_info *info);
129 134
130#endif 135#endif
diff --git a/include/drm/drm_global.h b/include/drm/drm_global.h
new file mode 100644
index 000000000000..a06805eaf649
--- /dev/null
+++ b/include/drm/drm_global.h
@@ -0,0 +1,53 @@
1/**************************************************************************
2 *
3 * Copyright 2008-2009 VMware, Inc., Palo Alto, CA., USA
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27/*
28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29 */
30
31#ifndef _DRM_GLOBAL_H_
32#define _DRM_GLOBAL_H_
33enum drm_global_types {
34 DRM_GLOBAL_TTM_MEM = 0,
35 DRM_GLOBAL_TTM_BO,
36 DRM_GLOBAL_TTM_OBJECT,
37 DRM_GLOBAL_NUM
38};
39
40struct drm_global_reference {
41 enum drm_global_types global_type;
42 size_t size;
43 void *object;
44 int (*init) (struct drm_global_reference *);
45 void (*release) (struct drm_global_reference *);
46};
47
48extern void drm_global_init(void);
49extern void drm_global_release(void);
50extern int drm_global_item_ref(struct drm_global_reference *ref);
51extern void drm_global_item_unref(struct drm_global_reference *ref);
52
53#endif
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index 4c10be39a43b..bf01531193d5 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -42,21 +42,31 @@
42#endif 42#endif
43 43
44struct drm_mm_node { 44struct drm_mm_node {
45 struct list_head fl_entry; 45 struct list_head free_stack;
46 struct list_head ml_entry; 46 struct list_head node_list;
47 int free; 47 unsigned free : 1;
48 unsigned scanned_block : 1;
49 unsigned scanned_prev_free : 1;
50 unsigned scanned_next_free : 1;
48 unsigned long start; 51 unsigned long start;
49 unsigned long size; 52 unsigned long size;
50 struct drm_mm *mm; 53 struct drm_mm *mm;
51 void *private;
52}; 54};
53 55
54struct drm_mm { 56struct drm_mm {
55 struct list_head fl_entry; 57 /* List of free memory blocks, most recently freed ordered. */
56 struct list_head ml_entry; 58 struct list_head free_stack;
59 /* List of all memory nodes, ordered according to the (increasing) start
60 * address of the memory node. */
61 struct list_head node_list;
57 struct list_head unused_nodes; 62 struct list_head unused_nodes;
58 int num_unused; 63 int num_unused;
59 spinlock_t unused_lock; 64 spinlock_t unused_lock;
65 unsigned scan_alignment;
66 unsigned long scan_size;
67 unsigned long scan_hit_start;
68 unsigned scan_hit_size;
69 unsigned scanned_blocks;
60}; 70};
61 71
62/* 72/*
@@ -133,6 +143,11 @@ static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block)
133 return block->mm; 143 return block->mm;
134} 144}
135 145
146void drm_mm_init_scan(struct drm_mm *mm, unsigned long size,
147 unsigned alignment);
148int drm_mm_scan_add_block(struct drm_mm_node *node);
149int drm_mm_scan_remove_block(struct drm_mm_node *node);
150
136extern void drm_mm_debug_table(struct drm_mm *mm, const char *prefix); 151extern void drm_mm_debug_table(struct drm_mm *mm, const char *prefix);
137#ifdef CONFIG_DEBUG_FS 152#ifdef CONFIG_DEBUG_FS
138int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm); 153int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm);
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index c5ba1636613c..0fc7397c8f1f 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -74,6 +74,7 @@
74/* Dithering mode options */ 74/* Dithering mode options */
75#define DRM_MODE_DITHERING_OFF 0 75#define DRM_MODE_DITHERING_OFF 0
76#define DRM_MODE_DITHERING_ON 1 76#define DRM_MODE_DITHERING_ON 1
77#define DRM_MODE_DITHERING_AUTO 2
77 78
78/* Dirty info options */ 79/* Dirty info options */
79#define DRM_MODE_DIRTY_OFF 0 80#define DRM_MODE_DIRTY_OFF 0
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 2d428b088cc8..3a9940ef728b 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -146,6 +146,8 @@
146 {0x1002, 0x6888, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 146 {0x1002, 0x6888, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
147 {0x1002, 0x6889, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 147 {0x1002, 0x6889, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
148 {0x1002, 0x688A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 148 {0x1002, 0x688A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
149 {0x1002, 0x688C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
150 {0x1002, 0x688D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
149 {0x1002, 0x6898, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 151 {0x1002, 0x6898, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
150 {0x1002, 0x6899, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 152 {0x1002, 0x6899, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
151 {0x1002, 0x689c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HEMLOCK|RADEON_NEW_MEMMAP}, \ 153 {0x1002, 0x689c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HEMLOCK|RADEON_NEW_MEMMAP}, \
@@ -161,6 +163,7 @@
161 {0x1002, 0x68be, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \ 163 {0x1002, 0x68be, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
162 {0x1002, 0x68c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 164 {0x1002, 0x68c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
163 {0x1002, 0x68c1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 165 {0x1002, 0x68c1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
166 {0x1002, 0x68c7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
164 {0x1002, 0x68c8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \ 167 {0x1002, 0x68c8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \
165 {0x1002, 0x68c9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \ 168 {0x1002, 0x68c9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \
166 {0x1002, 0x68d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \ 169 {0x1002, 0x68d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \
@@ -174,6 +177,7 @@
174 {0x1002, 0x68e8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ 177 {0x1002, 0x68e8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
175 {0x1002, 0x68e9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ 178 {0x1002, 0x68e9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
176 {0x1002, 0x68f1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ 179 {0x1002, 0x68f1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
180 {0x1002, 0x68f2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
177 {0x1002, 0x68f8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ 181 {0x1002, 0x68f8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
178 {0x1002, 0x68f9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ 182 {0x1002, 0x68f9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
179 {0x1002, 0x68fe, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ 183 {0x1002, 0x68fe, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
@@ -314,6 +318,7 @@
314 {0x1002, 0x9456, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ 318 {0x1002, 0x9456, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
315 {0x1002, 0x945A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 319 {0x1002, 0x945A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
316 {0x1002, 0x945B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 320 {0x1002, 0x945B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
321 {0x1002, 0x945E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
317 {0x1002, 0x9460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ 322 {0x1002, 0x9460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
318 {0x1002, 0x9462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ 323 {0x1002, 0x9462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
319 {0x1002, 0x946A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 324 {0x1002, 0x946A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -324,6 +329,7 @@
324 {0x1002, 0x9487, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \ 329 {0x1002, 0x9487, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
325 {0x1002, 0x9488, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 330 {0x1002, 0x9488, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
326 {0x1002, 0x9489, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 331 {0x1002, 0x9489, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
332 {0x1002, 0x948A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
327 {0x1002, 0x948F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \ 333 {0x1002, 0x948F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
328 {0x1002, 0x9490, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \ 334 {0x1002, 0x9490, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
329 {0x1002, 0x9491, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 335 {0x1002, 0x9491, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -366,6 +372,7 @@
366 {0x1002, 0x9553, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 372 {0x1002, 0x9553, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
367 {0x1002, 0x9555, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 373 {0x1002, 0x9555, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
368 {0x1002, 0x9557, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 374 {0x1002, 0x9557, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
375 {0x1002, 0x955f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
369 {0x1002, 0x9580, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \ 376 {0x1002, 0x9580, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
370 {0x1002, 0x9581, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 377 {0x1002, 0x9581, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
371 {0x1002, 0x9583, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 378 {0x1002, 0x9583, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
diff --git a/include/drm/i2c/sil164.h b/include/drm/i2c/sil164.h
new file mode 100644
index 000000000000..205e27384c83
--- /dev/null
+++ b/include/drm/i2c/sil164.h
@@ -0,0 +1,63 @@
1/*
2 * Copyright (C) 2010 Francisco Jerez.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 */
26
27#ifndef __DRM_I2C_SIL164_H__
28#define __DRM_I2C_SIL164_H__
29
30/**
31 * struct sil164_encoder_params
32 *
33 * Describes how the sil164 is connected to the GPU. It should be used
34 * as the @params parameter of its @set_config method.
35 *
36 * See "http://www.siliconimage.com/docs/SiI-DS-0021-E-164.pdf".
37 */
38struct sil164_encoder_params {
39 enum {
40 SIL164_INPUT_EDGE_FALLING = 0,
41 SIL164_INPUT_EDGE_RISING
42 } input_edge;
43
44 enum {
45 SIL164_INPUT_WIDTH_12BIT = 0,
46 SIL164_INPUT_WIDTH_24BIT
47 } input_width;
48
49 enum {
50 SIL164_INPUT_SINGLE_EDGE = 0,
51 SIL164_INPUT_DUAL_EDGE
52 } input_dual;
53
54 enum {
55 SIL164_PLL_FILTER_ON = 0,
56 SIL164_PLL_FILTER_OFF,
57 } pll_filter;
58
59 int input_skew; /** < Allowed range [-4, 3], use 0 for no de-skew. */
60 int duallink_skew; /** < Allowed range [-4, 3]. */
61};
62
63#endif
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 7f0028e1010b..8f8b072c4c7b 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -33,6 +33,15 @@
33 * subject to backwards-compatibility constraints. 33 * subject to backwards-compatibility constraints.
34 */ 34 */
35 35
36#ifdef __KERNEL__
37/* For use by IPS driver */
38extern unsigned long i915_read_mch_val(void);
39extern bool i915_gpu_raise(void);
40extern bool i915_gpu_lower(void);
41extern bool i915_gpu_busy(void);
42extern bool i915_gpu_turbo_disable(void);
43#endif
44
36/* Each region is a minimum of 16k, and there are at most 255 of them. 45/* Each region is a minimum of 16k, and there are at most 255 of them.
37 */ 46 */
38#define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use 47#define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 5347063e9d5a..0acaf8f91437 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -904,6 +904,8 @@ struct drm_radeon_cs {
904#define RADEON_INFO_ACCEL_WORKING 0x03 904#define RADEON_INFO_ACCEL_WORKING 0x03
905#define RADEON_INFO_CRTC_FROM_ID 0x04 905#define RADEON_INFO_CRTC_FROM_ID 0x04
906#define RADEON_INFO_ACCEL_WORKING2 0x05 906#define RADEON_INFO_ACCEL_WORKING2 0x05
907#define RADEON_INFO_TILING_CONFIG 0x06
908#define RADEON_INFO_WANT_HYPERZ 0x07
907 909
908struct drm_radeon_info { 910struct drm_radeon_info {
909 uint32_t request; 911 uint32_t request;
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 0ea602da43e7..b87504235f18 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -34,6 +34,7 @@
34#include "ttm/ttm_memory.h" 34#include "ttm/ttm_memory.h"
35#include "ttm/ttm_module.h" 35#include "ttm/ttm_module.h"
36#include "drm_mm.h" 36#include "drm_mm.h"
37#include "drm_global.h"
37#include "linux/workqueue.h" 38#include "linux/workqueue.h"
38#include "linux/fs.h" 39#include "linux/fs.h"
39#include "linux/spinlock.h" 40#include "linux/spinlock.h"
@@ -362,7 +363,7 @@ struct ttm_bo_driver {
362 */ 363 */
363 364
364struct ttm_bo_global_ref { 365struct ttm_bo_global_ref {
365 struct ttm_global_reference ref; 366 struct drm_global_reference ref;
366 struct ttm_mem_global *mem_glob; 367 struct ttm_mem_global *mem_glob;
367}; 368};
368 369
@@ -687,8 +688,8 @@ extern int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
687extern void ttm_mem_io_free(struct ttm_bo_device *bdev, 688extern void ttm_mem_io_free(struct ttm_bo_device *bdev,
688 struct ttm_mem_reg *mem); 689 struct ttm_mem_reg *mem);
689 690
690extern void ttm_bo_global_release(struct ttm_global_reference *ref); 691extern void ttm_bo_global_release(struct drm_global_reference *ref);
691extern int ttm_bo_global_init(struct ttm_global_reference *ref); 692extern int ttm_bo_global_init(struct drm_global_reference *ref);
692 693
693extern int ttm_bo_device_release(struct ttm_bo_device *bdev); 694extern int ttm_bo_device_release(struct ttm_bo_device *bdev);
694 695
diff --git a/include/drm/ttm/ttm_module.h b/include/drm/ttm/ttm_module.h
index cf416aee19af..45fa318c1585 100644
--- a/include/drm/ttm/ttm_module.h
+++ b/include/drm/ttm/ttm_module.h
@@ -35,26 +35,6 @@
35struct kobject; 35struct kobject;
36 36
37#define TTM_PFX "[TTM] " 37#define TTM_PFX "[TTM] "
38
39enum ttm_global_types {
40 TTM_GLOBAL_TTM_MEM = 0,
41 TTM_GLOBAL_TTM_BO,
42 TTM_GLOBAL_TTM_OBJECT,
43 TTM_GLOBAL_NUM
44};
45
46struct ttm_global_reference {
47 enum ttm_global_types global_type;
48 size_t size;
49 void *object;
50 int (*init) (struct ttm_global_reference *);
51 void (*release) (struct ttm_global_reference *);
52};
53
54extern void ttm_global_init(void);
55extern void ttm_global_release(void);
56extern int ttm_global_item_ref(struct ttm_global_reference *ref);
57extern void ttm_global_item_unref(struct ttm_global_reference *ref);
58extern struct kobject *ttm_get_kobj(void); 38extern struct kobject *ttm_get_kobj(void);
59 39
60#endif /* _TTM_MODULE_H_ */ 40#endif /* _TTM_MODULE_H_ */
diff --git a/include/keys/dns_resolver-type.h b/include/keys/dns_resolver-type.h
new file mode 100644
index 000000000000..9284a19393aa
--- /dev/null
+++ b/include/keys/dns_resolver-type.h
@@ -0,0 +1,23 @@
1/* DNS resolver key type
2 *
3 * Copyright (C) 2010 Wang Lei. All Rights Reserved.
4 * Written by Wang Lei (wang840925@gmail.com)
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 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _KEYS_DNS_RESOLVER_TYPE_H
13#define _KEYS_DNS_RESOLVER_TYPE_H
14
15#include <linux/key-type.h>
16
17extern struct key_type key_type_dns_resolver;
18
19extern int request_dns_resolver_key(const char *description,
20 const char *callout_info,
21 char **data);
22
23#endif /* _KEYS_DNS_RESOLVER_TYPE_H */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 2fc8e14cc24a..9d65d4d0bd9c 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -39,6 +39,7 @@ header-y += ax25.h
39header-y += b1lli.h 39header-y += b1lli.h
40header-y += baycom.h 40header-y += baycom.h
41header-y += bfs_fs.h 41header-y += bfs_fs.h
42header-y += blk_types.h
42header-y += blkpg.h 43header-y += blkpg.h
43header-y += bpqether.h 44header-y += bpqether.h
44header-y += bsg.h 45header-y += bsg.h
@@ -210,6 +211,7 @@ unifdef-y += ethtool.h
210unifdef-y += eventpoll.h 211unifdef-y += eventpoll.h
211unifdef-y += signalfd.h 212unifdef-y += signalfd.h
212unifdef-y += ext2_fs.h 213unifdef-y += ext2_fs.h
214unifdef-y += fanotify.h
213unifdef-y += fb.h 215unifdef-y += fb.h
214unifdef-y += fcntl.h 216unifdef-y += fcntl.h
215unifdef-y += filter.h 217unifdef-y += filter.h
@@ -276,6 +278,7 @@ ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \
276 $(srctree)/include/asm-$(SRCARCH)/kvm_para.h),) 278 $(srctree)/include/asm-$(SRCARCH)/kvm_para.h),)
277unifdef-y += kvm_para.h 279unifdef-y += kvm_para.h
278endif 280endif
281unifdef-y += l2tp.h
279unifdef-y += llc.h 282unifdef-y += llc.h
280unifdef-y += loop.h 283unifdef-y += loop.h
281unifdef-y += lp.h 284unifdef-y += lp.h
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
index f7dd576dd5a4..be3d9a77d6ed 100644
--- a/include/linux/ahci_platform.h
+++ b/include/linux/ahci_platform.h
@@ -15,11 +15,13 @@
15#ifndef _AHCI_PLATFORM_H 15#ifndef _AHCI_PLATFORM_H
16#define _AHCI_PLATFORM_H 16#define _AHCI_PLATFORM_H
17 17
18#include <linux/compiler.h>
19
18struct device; 20struct device;
19struct ata_port_info; 21struct ata_port_info;
20 22
21struct ahci_platform_data { 23struct ahci_platform_data {
22 int (*init)(struct device *dev); 24 int (*init)(struct device *dev, void __iomem *addr);
23 void (*exit)(struct device *dev); 25 void (*exit)(struct device *dev);
24 const struct ata_port_info *ata_port_info; 26 const struct ata_port_info *ata_port_info;
25 unsigned int force_port_map; 27 unsigned int force_port_map;
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 8b1038607831..b0c174012436 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -14,14 +14,19 @@
14#ifndef ASMARM_AMBA_H 14#ifndef ASMARM_AMBA_H
15#define ASMARM_AMBA_H 15#define ASMARM_AMBA_H
16 16
17#include <linux/clk.h>
17#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/err.h>
18#include <linux/resource.h> 20#include <linux/resource.h>
19 21
20#define AMBA_NR_IRQS 2 22#define AMBA_NR_IRQS 2
21 23
24struct clk;
25
22struct amba_device { 26struct amba_device {
23 struct device dev; 27 struct device dev;
24 struct resource res; 28 struct resource res;
29 struct clk *pclk;
25 u64 dma_mask; 30 u64 dma_mask;
26 unsigned int periphid; 31 unsigned int periphid;
27 unsigned int irq[AMBA_NR_IRQS]; 32 unsigned int irq[AMBA_NR_IRQS];
@@ -59,6 +64,12 @@ struct amba_device *amba_find_device(const char *, struct device *, unsigned int
59int amba_request_regions(struct amba_device *, const char *); 64int amba_request_regions(struct amba_device *, const char *);
60void amba_release_regions(struct amba_device *); 65void amba_release_regions(struct amba_device *);
61 66
67#define amba_pclk_enable(d) \
68 (IS_ERR((d)->pclk) ? 0 : clk_enable((d)->pclk))
69
70#define amba_pclk_disable(d) \
71 do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0)
72
62#define amba_config(d) (((d)->periphid >> 24) & 0xff) 73#define amba_config(d) (((d)->periphid >> 24) & 0xff)
63#define amba_rev(d) (((d)->periphid >> 20) & 0x0f) 74#define amba_rev(d) (((d)->periphid >> 20) & 0x0f)
64#define amba_manf(d) (((d)->periphid >> 12) & 0xff) 75#define amba_manf(d) (((d)->periphid >> 12) & 0xff)
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
index 7e466fe72025..ca84ce70d5d5 100644
--- a/include/linux/amba/mmci.h
+++ b/include/linux/amba/mmci.h
@@ -15,9 +15,10 @@
15 * @ocr_mask: available voltages on the 4 pins from the block, this 15 * @ocr_mask: available voltages on the 4 pins from the block, this
16 * is ignored if a regulator is used, see the MMC_VDD_* masks in 16 * is ignored if a regulator is used, see the MMC_VDD_* masks in
17 * mmc/host.h 17 * mmc/host.h
18 * @translate_vdd: a callback function to translate a MMC_VDD_* 18 * @vdd_handler: a callback function to translate a MMC_VDD_*
19 * mask into a value to be binary or:ed and written into the 19 * mask into a value to be binary (or set some other custom bits
20 * MMCIPWR register of the block 20 * in MMCIPWR) or:ed and written into the MMCIPWR register of the
21 * block. May also control external power based on the power_mode.
21 * @status: if no GPIO read function was given to the block in 22 * @status: if no GPIO read function was given to the block in
22 * gpio_wp (below) this function will be called to determine 23 * gpio_wp (below) this function will be called to determine
23 * whether a card is present in the MMC slot or not 24 * whether a card is present in the MMC slot or not
@@ -29,7 +30,8 @@
29struct mmci_platform_data { 30struct mmci_platform_data {
30 unsigned int f_max; 31 unsigned int f_max;
31 unsigned int ocr_mask; 32 unsigned int ocr_mask;
32 u32 (*translate_vdd)(struct device *, unsigned int); 33 u32 (*vdd_handler)(struct device *, unsigned int vdd,
34 unsigned char power_mode);
33 unsigned int (*status)(struct device *); 35 unsigned int (*status)(struct device *);
34 int gpio_wp; 36 int gpio_wp;
35 int gpio_cd; 37 int gpio_cd;
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
index 5a5a7fd62490..e1b634b635f2 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -38,10 +38,12 @@
38#define UART01x_FR 0x18 /* Flag register (Read only). */ 38#define UART01x_FR 0x18 /* Flag register (Read only). */
39#define UART010_IIR 0x1C /* Interrupt indentification register (Read). */ 39#define UART010_IIR 0x1C /* Interrupt indentification register (Read). */
40#define UART010_ICR 0x1C /* Interrupt clear register (Write). */ 40#define UART010_ICR 0x1C /* Interrupt clear register (Write). */
41#define ST_UART011_LCRH_RX 0x1C /* Rx line control register. */
41#define UART01x_ILPR 0x20 /* IrDA low power counter register. */ 42#define UART01x_ILPR 0x20 /* IrDA low power counter register. */
42#define UART011_IBRD 0x24 /* Integer baud rate divisor register. */ 43#define UART011_IBRD 0x24 /* Integer baud rate divisor register. */
43#define UART011_FBRD 0x28 /* Fractional baud rate divisor register. */ 44#define UART011_FBRD 0x28 /* Fractional baud rate divisor register. */
44#define UART011_LCRH 0x2c /* Line control register. */ 45#define UART011_LCRH 0x2c /* Line control register. */
46#define ST_UART011_LCRH_TX 0x2c /* Tx Line control register. */
45#define UART011_CR 0x30 /* Control register. */ 47#define UART011_CR 0x30 /* Control register. */
46#define UART011_IFLS 0x34 /* Interrupt fifo level select. */ 48#define UART011_IFLS 0x34 /* Interrupt fifo level select. */
47#define UART011_IMSC 0x38 /* Interrupt mask. */ 49#define UART011_IMSC 0x38 /* Interrupt mask. */
@@ -84,6 +86,7 @@
84#define UART010_CR_TIE 0x0020 86#define UART010_CR_TIE 0x0020
85#define UART010_CR_RIE 0x0010 87#define UART010_CR_RIE 0x0010
86#define UART010_CR_MSIE 0x0008 88#define UART010_CR_MSIE 0x0008
89#define ST_UART011_CR_OVSFACT 0x0008 /* Oversampling factor */
87#define UART01x_CR_IIRLP 0x0004 /* SIR low power mode */ 90#define UART01x_CR_IIRLP 0x0004 /* SIR low power mode */
88#define UART01x_CR_SIREN 0x0002 /* SIR enable */ 91#define UART01x_CR_SIREN 0x0002 /* SIR enable */
89#define UART01x_CR_UARTEN 0x0001 /* UART enable */ 92#define UART01x_CR_UARTEN 0x0001 /* UART enable */
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 817b23705c91..f6481daf6e52 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -431,6 +431,14 @@ struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops,
431 int number,unsigned long *flags); /* number == -1: pick first available */ 431 int number,unsigned long *flags); /* number == -1: pick first available */
432struct atm_dev *atm_dev_lookup(int number); 432struct atm_dev *atm_dev_lookup(int number);
433void atm_dev_deregister(struct atm_dev *dev); 433void atm_dev_deregister(struct atm_dev *dev);
434
435/* atm_dev_signal_change
436 *
437 * Propagate lower layer signal change in atm_dev->signal to netdevice.
438 * The event will be sent via a notifier call chain.
439 */
440void atm_dev_signal_change(struct atm_dev *dev, char signal);
441
434void vcc_insert_socket(struct sock *sk); 442void vcc_insert_socket(struct sock *sk);
435 443
436 444
@@ -510,6 +518,15 @@ void register_atm_ioctl(struct atm_ioctl *);
510 */ 518 */
511void deregister_atm_ioctl(struct atm_ioctl *); 519void deregister_atm_ioctl(struct atm_ioctl *);
512 520
521
522/* register_atmdevice_notifier - register atm_dev notify events
523 *
524 * Clients like br2684 will register notify events
525 * Currently we notify of signal found/lost
526 */
527int register_atmdevice_notifier(struct notifier_block *nb);
528void unregister_atmdevice_notifier(struct notifier_block *nb);
529
513#endif /* __KERNEL__ */ 530#endif /* __KERNEL__ */
514 531
515#endif 532#endif
diff --git a/include/linux/audit.h b/include/linux/audit.h
index f391d45c8aea..e24afabc548f 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -544,7 +544,7 @@ extern int audit_signals;
544#define audit_putname(n) do { ; } while (0) 544#define audit_putname(n) do { ; } while (0)
545#define __audit_inode(n,d) do { ; } while (0) 545#define __audit_inode(n,d) do { ; } while (0)
546#define __audit_inode_child(i,p) do { ; } while (0) 546#define __audit_inode_child(i,p) do { ; } while (0)
547#define audit_inode(n,d) do { ; } while (0) 547#define audit_inode(n,d) do { (void)(d); } while (0)
548#define audit_inode_child(i,p) do { ; } while (0) 548#define audit_inode_child(i,p) do { ; } while (0)
549#define audit_core_dumps(i) do { ; } while (0) 549#define audit_core_dumps(i) do { ; } while (0)
550#define auditsc_get_stamp(c,t,s) (0) 550#define auditsc_get_stamp(c,t,s) (0)
diff --git a/include/linux/auto_fs.h b/include/linux/auto_fs.h
index 7b09c8348fd3..da64e15004b6 100644
--- a/include/linux/auto_fs.h
+++ b/include/linux/auto_fs.h
@@ -79,6 +79,7 @@ struct autofs_packet_expire {
79#define AUTOFS_IOC_FAIL _IO(0x93,0x61) 79#define AUTOFS_IOC_FAIL _IO(0x93,0x61)
80#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62) 80#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62)
81#define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int) 81#define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int)
82#define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,compat_ulong_t)
82#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long) 83#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long)
83#define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire) 84#define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire)
84 85
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index e9aec0d099df..35b00746c712 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -31,6 +31,7 @@ enum bdi_state {
31 BDI_async_congested, /* The async (write) queue is getting full */ 31 BDI_async_congested, /* The async (write) queue is getting full */
32 BDI_sync_congested, /* The sync queue is getting full */ 32 BDI_sync_congested, /* The sync queue is getting full */
33 BDI_registered, /* bdi_register() was done */ 33 BDI_registered, /* bdi_register() was done */
34 BDI_writeback_running, /* Writeback is in progress */
34 BDI_unused, /* Available bits start here */ 35 BDI_unused, /* Available bits start here */
35}; 36};
36 37
@@ -45,22 +46,21 @@ enum bdi_stat_item {
45#define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids))) 46#define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids)))
46 47
47struct bdi_writeback { 48struct bdi_writeback {
48 struct list_head list; /* hangs off the bdi */ 49 struct backing_dev_info *bdi; /* our parent bdi */
49
50 struct backing_dev_info *bdi; /* our parent bdi */
51 unsigned int nr; 50 unsigned int nr;
52 51
53 unsigned long last_old_flush; /* last old data flush */ 52 unsigned long last_old_flush; /* last old data flush */
53 unsigned long last_active; /* last time bdi thread was active */
54 54
55 struct task_struct *task; /* writeback task */ 55 struct task_struct *task; /* writeback thread */
56 struct list_head b_dirty; /* dirty inodes */ 56 struct timer_list wakeup_timer; /* used for delayed bdi thread wakeup */
57 struct list_head b_io; /* parked for writeback */ 57 struct list_head b_dirty; /* dirty inodes */
58 struct list_head b_more_io; /* parked for more writeback */ 58 struct list_head b_io; /* parked for writeback */
59 struct list_head b_more_io; /* parked for more writeback */
59}; 60};
60 61
61struct backing_dev_info { 62struct backing_dev_info {
62 struct list_head bdi_list; 63 struct list_head bdi_list;
63 struct rcu_head rcu_head;
64 unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */ 64 unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */
65 unsigned long state; /* Always use atomic bitops on this */ 65 unsigned long state; /* Always use atomic bitops on this */
66 unsigned int capabilities; /* Device capabilities */ 66 unsigned int capabilities; /* Device capabilities */
@@ -80,8 +80,7 @@ struct backing_dev_info {
80 unsigned int max_ratio, max_prop_frac; 80 unsigned int max_ratio, max_prop_frac;
81 81
82 struct bdi_writeback wb; /* default writeback info for this bdi */ 82 struct bdi_writeback wb; /* default writeback info for this bdi */
83 spinlock_t wb_lock; /* protects update side of wb_list */ 83 spinlock_t wb_lock; /* protects work_list */
84 struct list_head wb_list; /* the flusher threads hanging off this bdi */
85 84
86 struct list_head work_list; 85 struct list_head work_list;
87 86
@@ -105,9 +104,10 @@ void bdi_unregister(struct backing_dev_info *bdi);
105int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); 104int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int);
106void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages); 105void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages);
107void bdi_start_background_writeback(struct backing_dev_info *bdi); 106void bdi_start_background_writeback(struct backing_dev_info *bdi);
108int bdi_writeback_task(struct bdi_writeback *wb); 107int bdi_writeback_thread(void *data);
109int bdi_has_dirty_io(struct backing_dev_info *bdi); 108int bdi_has_dirty_io(struct backing_dev_info *bdi);
110void bdi_arm_supers_timer(void); 109void bdi_arm_supers_timer(void);
110void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi);
111 111
112extern spinlock_t bdi_lock; 112extern spinlock_t bdi_lock;
113extern struct list_head bdi_list; 113extern struct list_head bdi_list;
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 7fc5606e6ea5..5274103434ad 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -9,7 +9,7 @@
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 * 15 *
@@ -28,6 +28,9 @@
28 28
29#include <asm/io.h> 29#include <asm/io.h>
30 30
31/* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */
32#include <linux/blk_types.h>
33
31#define BIO_DEBUG 34#define BIO_DEBUG
32 35
33#ifdef BIO_DEBUG 36#ifdef BIO_DEBUG
@@ -41,154 +44,6 @@
41#define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9) 44#define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9)
42 45
43/* 46/*
44 * was unsigned short, but we might as well be ready for > 64kB I/O pages
45 */
46struct bio_vec {
47 struct page *bv_page;
48 unsigned int bv_len;
49 unsigned int bv_offset;
50};
51
52struct bio_set;
53struct bio;
54struct bio_integrity_payload;
55typedef void (bio_end_io_t) (struct bio *, int);
56typedef void (bio_destructor_t) (struct bio *);
57
58/*
59 * main unit of I/O for the block layer and lower layers (ie drivers and
60 * stacking drivers)
61 */
62struct bio {
63 sector_t bi_sector; /* device address in 512 byte
64 sectors */
65 struct bio *bi_next; /* request queue link */
66 struct block_device *bi_bdev;
67 unsigned long bi_flags; /* status, command, etc */
68 unsigned long bi_rw; /* bottom bits READ/WRITE,
69 * top bits priority
70 */
71
72 unsigned short bi_vcnt; /* how many bio_vec's */
73 unsigned short bi_idx; /* current index into bvl_vec */
74
75 /* Number of segments in this BIO after
76 * physical address coalescing is performed.
77 */
78 unsigned int bi_phys_segments;
79
80 unsigned int bi_size; /* residual I/O count */
81
82 /*
83 * To keep track of the max segment size, we account for the
84 * sizes of the first and last mergeable segments in this bio.
85 */
86 unsigned int bi_seg_front_size;
87 unsigned int bi_seg_back_size;
88
89 unsigned int bi_max_vecs; /* max bvl_vecs we can hold */
90
91 unsigned int bi_comp_cpu; /* completion CPU */
92
93 atomic_t bi_cnt; /* pin count */
94
95 struct bio_vec *bi_io_vec; /* the actual vec list */
96
97 bio_end_io_t *bi_end_io;
98
99 void *bi_private;
100#if defined(CONFIG_BLK_DEV_INTEGRITY)
101 struct bio_integrity_payload *bi_integrity; /* data integrity */
102#endif
103
104 bio_destructor_t *bi_destructor; /* destructor */
105
106 /*
107 * We can inline a number of vecs at the end of the bio, to avoid
108 * double allocations for a small number of bio_vecs. This member
109 * MUST obviously be kept at the very end of the bio.
110 */
111 struct bio_vec bi_inline_vecs[0];
112};
113
114/*
115 * bio flags
116 */
117#define BIO_UPTODATE 0 /* ok after I/O completion */
118#define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */
119#define BIO_EOF 2 /* out-out-bounds error */
120#define BIO_SEG_VALID 3 /* bi_phys_segments valid */
121#define BIO_CLONED 4 /* doesn't own data */
122#define BIO_BOUNCED 5 /* bio is a bounce bio */
123#define BIO_USER_MAPPED 6 /* contains user pages */
124#define BIO_EOPNOTSUPP 7 /* not supported */
125#define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */
126#define BIO_NULL_MAPPED 9 /* contains invalid user pages */
127#define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */
128#define BIO_QUIET 11 /* Make BIO Quiet */
129#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
130
131/*
132 * top 4 bits of bio flags indicate the pool this bio came from
133 */
134#define BIO_POOL_BITS (4)
135#define BIO_POOL_NONE ((1UL << BIO_POOL_BITS) - 1)
136#define BIO_POOL_OFFSET (BITS_PER_LONG - BIO_POOL_BITS)
137#define BIO_POOL_MASK (1UL << BIO_POOL_OFFSET)
138#define BIO_POOL_IDX(bio) ((bio)->bi_flags >> BIO_POOL_OFFSET)
139
140/*
141 * bio bi_rw flags
142 *
143 * bit 0 -- data direction
144 * If not set, bio is a read from device. If set, it's a write to device.
145 * bit 1 -- fail fast device errors
146 * bit 2 -- fail fast transport errors
147 * bit 3 -- fail fast driver errors
148 * bit 4 -- rw-ahead when set
149 * bit 5 -- barrier
150 * Insert a serialization point in the IO queue, forcing previously
151 * submitted IO to be completed before this one is issued.
152 * bit 6 -- synchronous I/O hint.
153 * bit 7 -- Unplug the device immediately after submitting this bio.
154 * bit 8 -- metadata request
155 * Used for tracing to differentiate metadata and data IO. May also
156 * get some preferential treatment in the IO scheduler
157 * bit 9 -- discard sectors
158 * Informs the lower level device that this range of sectors is no longer
159 * used by the file system and may thus be freed by the device. Used
160 * for flash based storage.
161 * Don't want driver retries for any fast fail whatever the reason.
162 * bit 10 -- Tell the IO scheduler not to wait for more requests after this
163 one has been submitted, even if it is a SYNC request.
164 */
165enum bio_rw_flags {
166 BIO_RW,
167 BIO_RW_FAILFAST_DEV,
168 BIO_RW_FAILFAST_TRANSPORT,
169 BIO_RW_FAILFAST_DRIVER,
170 /* above flags must match REQ_* */
171 BIO_RW_AHEAD,
172 BIO_RW_BARRIER,
173 BIO_RW_SYNCIO,
174 BIO_RW_UNPLUG,
175 BIO_RW_META,
176 BIO_RW_DISCARD,
177 BIO_RW_NOIDLE,
178};
179
180/*
181 * First four bits must match between bio->bi_rw and rq->cmd_flags, make
182 * that explicit here.
183 */
184#define BIO_RW_RQ_MASK 0xf
185
186static inline bool bio_rw_flagged(struct bio *bio, enum bio_rw_flags flag)
187{
188 return (bio->bi_rw & (1 << flag)) != 0;
189}
190
191/*
192 * upper 16 bits of bi_rw define the io priority of this bio 47 * upper 16 bits of bi_rw define the io priority of this bio
193 */ 48 */
194#define BIO_PRIO_SHIFT (8 * sizeof(unsigned long) - IOPRIO_BITS) 49#define BIO_PRIO_SHIFT (8 * sizeof(unsigned long) - IOPRIO_BITS)
@@ -211,7 +66,10 @@ static inline bool bio_rw_flagged(struct bio *bio, enum bio_rw_flags flag)
211#define bio_offset(bio) bio_iovec((bio))->bv_offset 66#define bio_offset(bio) bio_iovec((bio))->bv_offset
212#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) 67#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
213#define bio_sectors(bio) ((bio)->bi_size >> 9) 68#define bio_sectors(bio) ((bio)->bi_size >> 9)
214#define bio_empty_barrier(bio) (bio_rw_flagged(bio, BIO_RW_BARRIER) && !bio_has_data(bio) && !bio_rw_flagged(bio, BIO_RW_DISCARD)) 69#define bio_empty_barrier(bio) \
70 ((bio->bi_rw & REQ_HARDBARRIER) && \
71 !bio_has_data(bio) && \
72 !(bio->bi_rw & REQ_DISCARD))
215 73
216static inline unsigned int bio_cur_bytes(struct bio *bio) 74static inline unsigned int bio_cur_bytes(struct bio *bio)
217{ 75{
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
new file mode 100644
index 000000000000..ca83a97c9715
--- /dev/null
+++ b/include/linux/blk_types.h
@@ -0,0 +1,196 @@
1/*
2 * Block data types and constants. Directly include this file only to
3 * break include dependency loop.
4 */
5#ifndef __LINUX_BLK_TYPES_H
6#define __LINUX_BLK_TYPES_H
7
8#ifdef CONFIG_BLOCK
9
10#include <linux/types.h>
11
12struct bio_set;
13struct bio;
14struct bio_integrity_payload;
15struct page;
16struct block_device;
17typedef void (bio_end_io_t) (struct bio *, int);
18typedef void (bio_destructor_t) (struct bio *);
19
20/*
21 * was unsigned short, but we might as well be ready for > 64kB I/O pages
22 */
23struct bio_vec {
24 struct page *bv_page;
25 unsigned int bv_len;
26 unsigned int bv_offset;
27};
28
29/*
30 * main unit of I/O for the block layer and lower layers (ie drivers and
31 * stacking drivers)
32 */
33struct bio {
34 sector_t bi_sector; /* device address in 512 byte
35 sectors */
36 struct bio *bi_next; /* request queue link */
37 struct block_device *bi_bdev;
38 unsigned long bi_flags; /* status, command, etc */
39 unsigned long bi_rw; /* bottom bits READ/WRITE,
40 * top bits priority
41 */
42
43 unsigned short bi_vcnt; /* how many bio_vec's */
44 unsigned short bi_idx; /* current index into bvl_vec */
45
46 /* Number of segments in this BIO after
47 * physical address coalescing is performed.
48 */
49 unsigned int bi_phys_segments;
50
51 unsigned int bi_size; /* residual I/O count */
52
53 /*
54 * To keep track of the max segment size, we account for the
55 * sizes of the first and last mergeable segments in this bio.
56 */
57 unsigned int bi_seg_front_size;
58 unsigned int bi_seg_back_size;
59
60 unsigned int bi_max_vecs; /* max bvl_vecs we can hold */
61
62 unsigned int bi_comp_cpu; /* completion CPU */
63
64 atomic_t bi_cnt; /* pin count */
65
66 struct bio_vec *bi_io_vec; /* the actual vec list */
67
68 bio_end_io_t *bi_end_io;
69
70 void *bi_private;
71#if defined(CONFIG_BLK_DEV_INTEGRITY)
72 struct bio_integrity_payload *bi_integrity; /* data integrity */
73#endif
74
75 bio_destructor_t *bi_destructor; /* destructor */
76
77 /*
78 * We can inline a number of vecs at the end of the bio, to avoid
79 * double allocations for a small number of bio_vecs. This member
80 * MUST obviously be kept at the very end of the bio.
81 */
82 struct bio_vec bi_inline_vecs[0];
83};
84
85/*
86 * bio flags
87 */
88#define BIO_UPTODATE 0 /* ok after I/O completion */
89#define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */
90#define BIO_EOF 2 /* out-out-bounds error */
91#define BIO_SEG_VALID 3 /* bi_phys_segments valid */
92#define BIO_CLONED 4 /* doesn't own data */
93#define BIO_BOUNCED 5 /* bio is a bounce bio */
94#define BIO_USER_MAPPED 6 /* contains user pages */
95#define BIO_EOPNOTSUPP 7 /* not supported */
96#define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */
97#define BIO_NULL_MAPPED 9 /* contains invalid user pages */
98#define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */
99#define BIO_QUIET 11 /* Make BIO Quiet */
100#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
101
102/*
103 * top 4 bits of bio flags indicate the pool this bio came from
104 */
105#define BIO_POOL_BITS (4)
106#define BIO_POOL_NONE ((1UL << BIO_POOL_BITS) - 1)
107#define BIO_POOL_OFFSET (BITS_PER_LONG - BIO_POOL_BITS)
108#define BIO_POOL_MASK (1UL << BIO_POOL_OFFSET)
109#define BIO_POOL_IDX(bio) ((bio)->bi_flags >> BIO_POOL_OFFSET)
110
111#endif /* CONFIG_BLOCK */
112
113/*
114 * Request flags. For use in the cmd_flags field of struct request, and in
115 * bi_rw of struct bio. Note that some flags are only valid in either one.
116 */
117enum rq_flag_bits {
118 /* common flags */
119 __REQ_WRITE, /* not set, read. set, write */
120 __REQ_FAILFAST_DEV, /* no driver retries of device errors */
121 __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */
122 __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */
123
124 __REQ_HARDBARRIER, /* may not be passed by drive either */
125 __REQ_SYNC, /* request is sync (sync write or read) */
126 __REQ_META, /* metadata io request */
127 __REQ_DISCARD, /* request to discard sectors */
128 __REQ_NOIDLE, /* don't anticipate more IO after this one */
129
130 /* bio only flags */
131 __REQ_UNPLUG, /* unplug the immediately after submission */
132 __REQ_RAHEAD, /* read ahead, can fail anytime */
133
134 /* request only flags */
135 __REQ_SORTED, /* elevator knows about this request */
136 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
137 __REQ_FUA, /* forced unit access */
138 __REQ_NOMERGE, /* don't touch this for merging */
139 __REQ_STARTED, /* drive already may have started this one */
140 __REQ_DONTPREP, /* don't call prep for this one */
141 __REQ_QUEUED, /* uses queueing */
142 __REQ_ELVPRIV, /* elevator private data attached */
143 __REQ_FAILED, /* set if the request failed */
144 __REQ_QUIET, /* don't worry about errors */
145 __REQ_PREEMPT, /* set for "ide_preempt" requests */
146 __REQ_ORDERED_COLOR, /* is before or after barrier */
147 __REQ_ALLOCED, /* request came from our alloc pool */
148 __REQ_COPY_USER, /* contains copies of user pages */
149 __REQ_INTEGRITY, /* integrity metadata has been remapped */
150 __REQ_FLUSH, /* request for cache flush */
151 __REQ_IO_STAT, /* account I/O stat */
152 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
153 __REQ_SECURE, /* secure discard (used with __REQ_DISCARD) */
154 __REQ_NR_BITS, /* stops here */
155};
156
157#define REQ_WRITE (1 << __REQ_WRITE)
158#define REQ_FAILFAST_DEV (1 << __REQ_FAILFAST_DEV)
159#define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT)
160#define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER)
161#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
162#define REQ_SYNC (1 << __REQ_SYNC)
163#define REQ_META (1 << __REQ_META)
164#define REQ_DISCARD (1 << __REQ_DISCARD)
165#define REQ_NOIDLE (1 << __REQ_NOIDLE)
166
167#define REQ_FAILFAST_MASK \
168 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
169#define REQ_COMMON_MASK \
170 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_HARDBARRIER | REQ_SYNC | \
171 REQ_META| REQ_DISCARD | REQ_NOIDLE)
172
173#define REQ_UNPLUG (1 << __REQ_UNPLUG)
174#define REQ_RAHEAD (1 << __REQ_RAHEAD)
175
176#define REQ_SORTED (1 << __REQ_SORTED)
177#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
178#define REQ_FUA (1 << __REQ_FUA)
179#define REQ_NOMERGE (1 << __REQ_NOMERGE)
180#define REQ_STARTED (1 << __REQ_STARTED)
181#define REQ_DONTPREP (1 << __REQ_DONTPREP)
182#define REQ_QUEUED (1 << __REQ_QUEUED)
183#define REQ_ELVPRIV (1 << __REQ_ELVPRIV)
184#define REQ_FAILED (1 << __REQ_FAILED)
185#define REQ_QUIET (1 << __REQ_QUIET)
186#define REQ_PREEMPT (1 << __REQ_PREEMPT)
187#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
188#define REQ_ALLOCED (1 << __REQ_ALLOCED)
189#define REQ_COPY_USER (1 << __REQ_COPY_USER)
190#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
191#define REQ_FLUSH (1 << __REQ_FLUSH)
192#define REQ_IO_STAT (1 << __REQ_IO_STAT)
193#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)
194#define REQ_SECURE (1 << __REQ_SECURE)
195
196#endif /* __LINUX_BLK_TYPES_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 09a840264d6f..2c54906f678f 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -60,7 +60,6 @@ enum rq_cmd_type_bits {
60 REQ_TYPE_PM_RESUME, /* resume request */ 60 REQ_TYPE_PM_RESUME, /* resume request */
61 REQ_TYPE_PM_SHUTDOWN, /* shutdown request */ 61 REQ_TYPE_PM_SHUTDOWN, /* shutdown request */
62 REQ_TYPE_SPECIAL, /* driver defined type */ 62 REQ_TYPE_SPECIAL, /* driver defined type */
63 REQ_TYPE_LINUX_BLOCK, /* generic block layer message */
64 /* 63 /*
65 * for ATA/ATAPI devices. this really doesn't belong here, ide should 64 * for ATA/ATAPI devices. this really doesn't belong here, ide should
66 * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver 65 * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver
@@ -70,84 +69,6 @@ enum rq_cmd_type_bits {
70 REQ_TYPE_ATA_PC, 69 REQ_TYPE_ATA_PC,
71}; 70};
72 71
73/*
74 * For request of type REQ_TYPE_LINUX_BLOCK, rq->cmd[0] is the opcode being
75 * sent down (similar to how REQ_TYPE_BLOCK_PC means that ->cmd[] holds a
76 * SCSI cdb.
77 *
78 * 0x00 -> 0x3f are driver private, to be used for whatever purpose they need,
79 * typically to differentiate REQ_TYPE_SPECIAL requests.
80 *
81 */
82enum {
83 REQ_LB_OP_EJECT = 0x40, /* eject request */
84 REQ_LB_OP_FLUSH = 0x41, /* flush request */
85};
86
87/*
88 * request type modified bits. first four bits match BIO_RW* bits, important
89 */
90enum rq_flag_bits {
91 __REQ_RW, /* not set, read. set, write */
92 __REQ_FAILFAST_DEV, /* no driver retries of device errors */
93 __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */
94 __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */
95 /* above flags must match BIO_RW_* */
96 __REQ_DISCARD, /* request to discard sectors */
97 __REQ_SORTED, /* elevator knows about this request */
98 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
99 __REQ_HARDBARRIER, /* may not be passed by drive either */
100 __REQ_FUA, /* forced unit access */
101 __REQ_NOMERGE, /* don't touch this for merging */
102 __REQ_STARTED, /* drive already may have started this one */
103 __REQ_DONTPREP, /* don't call prep for this one */
104 __REQ_QUEUED, /* uses queueing */
105 __REQ_ELVPRIV, /* elevator private data attached */
106 __REQ_FAILED, /* set if the request failed */
107 __REQ_QUIET, /* don't worry about errors */
108 __REQ_PREEMPT, /* set for "ide_preempt" requests */
109 __REQ_ORDERED_COLOR, /* is before or after barrier */
110 __REQ_RW_SYNC, /* request is sync (sync write or read) */
111 __REQ_ALLOCED, /* request came from our alloc pool */
112 __REQ_RW_META, /* metadata io request */
113 __REQ_COPY_USER, /* contains copies of user pages */
114 __REQ_INTEGRITY, /* integrity metadata has been remapped */
115 __REQ_NOIDLE, /* Don't anticipate more IO after this one */
116 __REQ_IO_STAT, /* account I/O stat */
117 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
118 __REQ_NR_BITS, /* stops here */
119};
120
121#define REQ_RW (1 << __REQ_RW)
122#define REQ_FAILFAST_DEV (1 << __REQ_FAILFAST_DEV)
123#define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT)
124#define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER)
125#define REQ_DISCARD (1 << __REQ_DISCARD)
126#define REQ_SORTED (1 << __REQ_SORTED)
127#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
128#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
129#define REQ_FUA (1 << __REQ_FUA)
130#define REQ_NOMERGE (1 << __REQ_NOMERGE)
131#define REQ_STARTED (1 << __REQ_STARTED)
132#define REQ_DONTPREP (1 << __REQ_DONTPREP)
133#define REQ_QUEUED (1 << __REQ_QUEUED)
134#define REQ_ELVPRIV (1 << __REQ_ELVPRIV)
135#define REQ_FAILED (1 << __REQ_FAILED)
136#define REQ_QUIET (1 << __REQ_QUIET)
137#define REQ_PREEMPT (1 << __REQ_PREEMPT)
138#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
139#define REQ_RW_SYNC (1 << __REQ_RW_SYNC)
140#define REQ_ALLOCED (1 << __REQ_ALLOCED)
141#define REQ_RW_META (1 << __REQ_RW_META)
142#define REQ_COPY_USER (1 << __REQ_COPY_USER)
143#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
144#define REQ_NOIDLE (1 << __REQ_NOIDLE)
145#define REQ_IO_STAT (1 << __REQ_IO_STAT)
146#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)
147
148#define REQ_FAILFAST_MASK (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | \
149 REQ_FAILFAST_DRIVER)
150
151#define BLK_MAX_CDB 16 72#define BLK_MAX_CDB 16
152 73
153/* 74/*
@@ -264,6 +185,7 @@ struct request_pm_state
264typedef void (request_fn_proc) (struct request_queue *q); 185typedef void (request_fn_proc) (struct request_queue *q);
265typedef int (make_request_fn) (struct request_queue *q, struct bio *bio); 186typedef int (make_request_fn) (struct request_queue *q, struct bio *bio);
266typedef int (prep_rq_fn) (struct request_queue *, struct request *); 187typedef int (prep_rq_fn) (struct request_queue *, struct request *);
188typedef void (unprep_rq_fn) (struct request_queue *, struct request *);
267typedef void (unplug_fn) (struct request_queue *); 189typedef void (unplug_fn) (struct request_queue *);
268 190
269struct bio_vec; 191struct bio_vec;
@@ -275,7 +197,6 @@ struct bvec_merge_data {
275}; 197};
276typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *, 198typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *,
277 struct bio_vec *); 199 struct bio_vec *);
278typedef void (prepare_flush_fn) (struct request_queue *, struct request *);
279typedef void (softirq_done_fn)(struct request *); 200typedef void (softirq_done_fn)(struct request *);
280typedef int (dma_drain_needed_fn)(struct request *); 201typedef int (dma_drain_needed_fn)(struct request *);
281typedef int (lld_busy_fn) (struct request_queue *q); 202typedef int (lld_busy_fn) (struct request_queue *q);
@@ -346,9 +267,9 @@ struct request_queue
346 request_fn_proc *request_fn; 267 request_fn_proc *request_fn;
347 make_request_fn *make_request_fn; 268 make_request_fn *make_request_fn;
348 prep_rq_fn *prep_rq_fn; 269 prep_rq_fn *prep_rq_fn;
270 unprep_rq_fn *unprep_rq_fn;
349 unplug_fn *unplug_fn; 271 unplug_fn *unplug_fn;
350 merge_bvec_fn *merge_bvec_fn; 272 merge_bvec_fn *merge_bvec_fn;
351 prepare_flush_fn *prepare_flush_fn;
352 softirq_done_fn *softirq_done_fn; 273 softirq_done_fn *softirq_done_fn;
353 rq_timed_out_fn *rq_timed_out_fn; 274 rq_timed_out_fn *rq_timed_out_fn;
354 dma_drain_needed_fn *dma_drain_needed; 275 dma_drain_needed_fn *dma_drain_needed;
@@ -467,11 +388,14 @@ struct request_queue
467#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ 388#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */
468#define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */ 389#define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */
469#define QUEUE_FLAG_NOXMERGES 17 /* No extended merges */ 390#define QUEUE_FLAG_NOXMERGES 17 /* No extended merges */
391#define QUEUE_FLAG_ADD_RANDOM 18 /* Contributes to random pool */
392#define QUEUE_FLAG_SECDISCARD 19 /* supports SECDISCARD */
470 393
471#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 394#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
472 (1 << QUEUE_FLAG_CLUSTER) | \ 395 (1 << QUEUE_FLAG_CLUSTER) | \
473 (1 << QUEUE_FLAG_STACKABLE) | \ 396 (1 << QUEUE_FLAG_STACKABLE) | \
474 (1 << QUEUE_FLAG_SAME_COMP)) 397 (1 << QUEUE_FLAG_SAME_COMP) | \
398 (1 << QUEUE_FLAG_ADD_RANDOM))
475 399
476static inline int queue_is_locked(struct request_queue *q) 400static inline int queue_is_locked(struct request_queue *q)
477{ 401{
@@ -596,38 +520,28 @@ enum {
596 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags) 520 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags)
597#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) 521#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags)
598#define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags) 522#define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
523#define blk_queue_add_random(q) test_bit(QUEUE_FLAG_ADD_RANDOM, &(q)->queue_flags)
599#define blk_queue_flushing(q) ((q)->ordseq) 524#define blk_queue_flushing(q) ((q)->ordseq)
600#define blk_queue_stackable(q) \ 525#define blk_queue_stackable(q) \
601 test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags) 526 test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags)
602#define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags) 527#define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags)
528#define blk_queue_secdiscard(q) (blk_queue_discard(q) && \
529 test_bit(QUEUE_FLAG_SECDISCARD, &(q)->queue_flags))
530
531#define blk_noretry_request(rq) \
532 ((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \
533 REQ_FAILFAST_DRIVER))
534
535#define blk_account_rq(rq) \
536 (((rq)->cmd_flags & REQ_STARTED) && \
537 ((rq)->cmd_type == REQ_TYPE_FS || \
538 ((rq)->cmd_flags & REQ_DISCARD)))
603 539
604#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS)
605#define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC)
606#define blk_special_request(rq) ((rq)->cmd_type == REQ_TYPE_SPECIAL)
607#define blk_sense_request(rq) ((rq)->cmd_type == REQ_TYPE_SENSE)
608
609#define blk_failfast_dev(rq) ((rq)->cmd_flags & REQ_FAILFAST_DEV)
610#define blk_failfast_transport(rq) ((rq)->cmd_flags & REQ_FAILFAST_TRANSPORT)
611#define blk_failfast_driver(rq) ((rq)->cmd_flags & REQ_FAILFAST_DRIVER)
612#define blk_noretry_request(rq) (blk_failfast_dev(rq) || \
613 blk_failfast_transport(rq) || \
614 blk_failfast_driver(rq))
615#define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED)
616#define blk_rq_io_stat(rq) ((rq)->cmd_flags & REQ_IO_STAT)
617#define blk_rq_quiet(rq) ((rq)->cmd_flags & REQ_QUIET)
618
619#define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq)))
620
621#define blk_pm_suspend_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND)
622#define blk_pm_resume_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_RESUME)
623#define blk_pm_request(rq) \ 540#define blk_pm_request(rq) \
624 (blk_pm_suspend_request(rq) || blk_pm_resume_request(rq)) 541 ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND || \
542 (rq)->cmd_type == REQ_TYPE_PM_RESUME)
625 543
626#define blk_rq_cpu_valid(rq) ((rq)->cpu != -1) 544#define blk_rq_cpu_valid(rq) ((rq)->cpu != -1)
627#define blk_sorted_rq(rq) ((rq)->cmd_flags & REQ_SORTED)
628#define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER)
629#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA)
630#define blk_discard_rq(rq) ((rq)->cmd_flags & REQ_DISCARD)
631#define blk_bidi_rq(rq) ((rq)->next_rq != NULL) 545#define blk_bidi_rq(rq) ((rq)->next_rq != NULL)
632/* rq->queuelist of dequeued request must be list_empty() */ 546/* rq->queuelist of dequeued request must be list_empty() */
633#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist)) 547#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist))
@@ -641,7 +555,7 @@ enum {
641 */ 555 */
642static inline bool rw_is_sync(unsigned int rw_flags) 556static inline bool rw_is_sync(unsigned int rw_flags)
643{ 557{
644 return !(rw_flags & REQ_RW) || (rw_flags & REQ_RW_SYNC); 558 return !(rw_flags & REQ_WRITE) || (rw_flags & REQ_SYNC);
645} 559}
646 560
647static inline bool rq_is_sync(struct request *rq) 561static inline bool rq_is_sync(struct request *rq)
@@ -649,9 +563,6 @@ static inline bool rq_is_sync(struct request *rq)
649 return rw_is_sync(rq->cmd_flags); 563 return rw_is_sync(rq->cmd_flags);
650} 564}
651 565
652#define rq_is_meta(rq) ((rq)->cmd_flags & REQ_RW_META)
653#define rq_noidle(rq) ((rq)->cmd_flags & REQ_NOIDLE)
654
655static inline int blk_queue_full(struct request_queue *q, int sync) 566static inline int blk_queue_full(struct request_queue *q, int sync)
656{ 567{
657 if (sync) 568 if (sync)
@@ -684,7 +595,8 @@ static inline void blk_clear_queue_full(struct request_queue *q, int sync)
684 (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER) 595 (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER)
685#define rq_mergeable(rq) \ 596#define rq_mergeable(rq) \
686 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \ 597 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \
687 (blk_discard_rq(rq) || blk_fs_request((rq)))) 598 (((rq)->cmd_flags & REQ_DISCARD) || \
599 (rq)->cmd_type == REQ_TYPE_FS))
688 600
689/* 601/*
690 * q->prep_rq_fn return values 602 * q->prep_rq_fn return values
@@ -709,7 +621,7 @@ extern unsigned long blk_max_low_pfn, blk_max_pfn;
709#define BLK_BOUNCE_HIGH -1ULL 621#define BLK_BOUNCE_HIGH -1ULL
710#endif 622#endif
711#define BLK_BOUNCE_ANY (-1ULL) 623#define BLK_BOUNCE_ANY (-1ULL)
712#define BLK_BOUNCE_ISA (ISA_DMA_THRESHOLD) 624#define BLK_BOUNCE_ISA (DMA_BIT_MASK(24))
713 625
714/* 626/*
715 * default timeout for SG_IO if none specified 627 * default timeout for SG_IO if none specified
@@ -781,6 +693,8 @@ extern struct request *blk_make_request(struct request_queue *, struct bio *,
781 gfp_t); 693 gfp_t);
782extern void blk_insert_request(struct request_queue *, struct request *, int, void *); 694extern void blk_insert_request(struct request_queue *, struct request *, int, void *);
783extern void blk_requeue_request(struct request_queue *, struct request *); 695extern void blk_requeue_request(struct request_queue *, struct request *);
696extern void blk_add_request_payload(struct request *rq, struct page *page,
697 unsigned int len);
784extern int blk_rq_check_limits(struct request_queue *q, struct request *rq); 698extern int blk_rq_check_limits(struct request_queue *q, struct request *rq);
785extern int blk_lld_busy(struct request_queue *q); 699extern int blk_lld_busy(struct request_queue *q);
786extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src, 700extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
@@ -915,6 +829,7 @@ extern void blk_complete_request(struct request *);
915extern void __blk_complete_request(struct request *); 829extern void __blk_complete_request(struct request *);
916extern void blk_abort_request(struct request *); 830extern void blk_abort_request(struct request *);
917extern void blk_abort_queue(struct request_queue *); 831extern void blk_abort_queue(struct request_queue *);
832extern void blk_unprep_request(struct request *);
918 833
919/* 834/*
920 * Access functions for manipulating queue properties 835 * Access functions for manipulating queue properties
@@ -959,6 +874,7 @@ extern int blk_queue_dma_drain(struct request_queue *q,
959extern void blk_queue_lld_busy(struct request_queue *q, lld_busy_fn *fn); 874extern void blk_queue_lld_busy(struct request_queue *q, lld_busy_fn *fn);
960extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); 875extern void blk_queue_segment_boundary(struct request_queue *, unsigned long);
961extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); 876extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn);
877extern void blk_queue_unprep_rq(struct request_queue *, unprep_rq_fn *ufn);
962extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); 878extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *);
963extern void blk_queue_dma_alignment(struct request_queue *, int); 879extern void blk_queue_dma_alignment(struct request_queue *, int);
964extern void blk_queue_update_dma_alignment(struct request_queue *, int); 880extern void blk_queue_update_dma_alignment(struct request_queue *, int);
@@ -966,7 +882,7 @@ extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *);
966extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *); 882extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *);
967extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); 883extern void blk_queue_rq_timeout(struct request_queue *, unsigned int);
968extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 884extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
969extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); 885extern int blk_queue_ordered(struct request_queue *, unsigned);
970extern bool blk_do_ordered(struct request_queue *, struct request **); 886extern bool blk_do_ordered(struct request_queue *, struct request **);
971extern unsigned blk_ordered_cur_seq(struct request_queue *); 887extern unsigned blk_ordered_cur_seq(struct request_queue *);
972extern unsigned blk_ordered_req_seq(struct request *); 888extern unsigned blk_ordered_req_seq(struct request *);
@@ -1005,10 +921,12 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
1005} 921}
1006enum{ 922enum{
1007 BLKDEV_WAIT, /* wait for completion */ 923 BLKDEV_WAIT, /* wait for completion */
1008 BLKDEV_BARRIER, /*issue request with barrier */ 924 BLKDEV_BARRIER, /* issue request with barrier */
925 BLKDEV_SECURE, /* secure discard */
1009}; 926};
1010#define BLKDEV_IFL_WAIT (1 << BLKDEV_WAIT) 927#define BLKDEV_IFL_WAIT (1 << BLKDEV_WAIT)
1011#define BLKDEV_IFL_BARRIER (1 << BLKDEV_BARRIER) 928#define BLKDEV_IFL_BARRIER (1 << BLKDEV_BARRIER)
929#define BLKDEV_IFL_SECURE (1 << BLKDEV_SECURE)
1012extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *, 930extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *,
1013 unsigned long); 931 unsigned long);
1014extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector, 932extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
@@ -1020,7 +938,7 @@ static inline int sb_issue_discard(struct super_block *sb,
1020{ 938{
1021 block <<= (sb->s_blocksize_bits - 9); 939 block <<= (sb->s_blocksize_bits - 9);
1022 nr_blocks <<= (sb->s_blocksize_bits - 9); 940 nr_blocks <<= (sb->s_blocksize_bits - 9);
1023 return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL, 941 return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_NOFS,
1024 BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER); 942 BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
1025} 943}
1026 944
@@ -1333,7 +1251,6 @@ static inline int blk_integrity_rq(struct request *rq)
1333struct block_device_operations { 1251struct block_device_operations {
1334 int (*open) (struct block_device *, fmode_t); 1252 int (*open) (struct block_device *, fmode_t);
1335 int (*release) (struct gendisk *, fmode_t); 1253 int (*release) (struct gendisk *, fmode_t);
1336 int (*locked_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1337 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1254 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1338 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1255 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1339 int (*direct_access) (struct block_device *, sector_t, 1256 int (*direct_access) (struct block_device *, sector_t,
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 416bf62d6d46..3395cf7130f5 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -5,6 +5,7 @@
5#ifdef __KERNEL__ 5#ifdef __KERNEL__
6#include <linux/blkdev.h> 6#include <linux/blkdev.h>
7#include <linux/relay.h> 7#include <linux/relay.h>
8#include <linux/compat.h>
8#endif 9#endif
9 10
10/* 11/*
@@ -220,11 +221,26 @@ static inline int blk_trace_init_sysfs(struct device *dev)
220 221
221#endif /* CONFIG_BLK_DEV_IO_TRACE */ 222#endif /* CONFIG_BLK_DEV_IO_TRACE */
222 223
224#ifdef CONFIG_COMPAT
225
226struct compat_blk_user_trace_setup {
227 char name[32];
228 u16 act_mask;
229 u32 buf_size;
230 u32 buf_nr;
231 compat_u64 start_lba;
232 compat_u64 end_lba;
233 u32 pid;
234};
235#define BLKTRACESETUP32 _IOWR(0x12, 115, struct compat_blk_user_trace_setup)
236
237#endif
238
223#if defined(CONFIG_EVENT_TRACING) && defined(CONFIG_BLOCK) 239#if defined(CONFIG_EVENT_TRACING) && defined(CONFIG_BLOCK)
224 240
225static inline int blk_cmd_buf_len(struct request *rq) 241static inline int blk_cmd_buf_len(struct request *rq)
226{ 242{
227 return blk_pc_request(rq) ? rq->cmd_len * 3 : 1; 243 return (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? rq->cmd_len * 3 : 1;
228} 244}
229 245
230extern void blk_dump_cmd(char *buf, struct request *rq); 246extern void blk_dump_cmd(char *buf, struct request *rq);
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 7f437ca1ed44..b840a4960282 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -1,6 +1,13 @@
1#define PHY_ID_BCM50610 0x0143bd60 1#define PHY_ID_BCM50610 0x0143bd60
2#define PHY_ID_BCM50610M 0x0143bd70 2#define PHY_ID_BCM50610M 0x0143bd70
3#define PHY_ID_BCM5241 0x0143bc30
3#define PHY_ID_BCMAC131 0x0143bc70 4#define PHY_ID_BCMAC131 0x0143bc70
5#define PHY_ID_BCM5481 0x0143bca0
6#define PHY_ID_BCM5482 0x0143bcb0
7#define PHY_ID_BCM5411 0x00206070
8#define PHY_ID_BCM5421 0x002060e0
9#define PHY_ID_BCM5464 0x002060b0
10#define PHY_ID_BCM5461 0x002060c0
4#define PHY_ID_BCM57780 0x03625d90 11#define PHY_ID_BCM57780 0x03625d90
5 12
6#define PHY_BCM_OUI_MASK 0xfffffc00 13#define PHY_BCM_OUI_MASK 0xfffffc00
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 1b9ba193b789..43e649a72529 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -203,12 +203,10 @@ int block_write_full_page_endio(struct page *page, get_block_t *get_block,
203int block_read_full_page(struct page*, get_block_t*); 203int block_read_full_page(struct page*, get_block_t*);
204int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc, 204int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc,
205 unsigned long from); 205 unsigned long from);
206int block_write_begin_newtrunc(struct file *, struct address_space *, 206int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len,
207 loff_t, unsigned, unsigned, 207 unsigned flags, struct page **pagep, get_block_t *get_block);
208 struct page **, void **, get_block_t*); 208int __block_write_begin(struct page *page, loff_t pos, unsigned len,
209int block_write_begin(struct file *, struct address_space *, 209 get_block_t *get_block);
210 loff_t, unsigned, unsigned,
211 struct page **, void **, get_block_t*);
212int block_write_end(struct file *, struct address_space *, 210int block_write_end(struct file *, struct address_space *,
213 loff_t, unsigned, unsigned, 211 loff_t, unsigned, unsigned,
214 struct page *, void *); 212 struct page *, void *);
@@ -217,9 +215,6 @@ int generic_write_end(struct file *, struct address_space *,
217 struct page *, void *); 215 struct page *, void *);
218void page_zero_new_buffers(struct page *page, unsigned from, unsigned to); 216void page_zero_new_buffers(struct page *page, unsigned from, unsigned to);
219int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*); 217int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
220int cont_write_begin_newtrunc(struct file *, struct address_space *, loff_t,
221 unsigned, unsigned, struct page **, void **,
222 get_block_t *, loff_t *);
223int cont_write_begin(struct file *, struct address_space *, loff_t, 218int cont_write_begin(struct file *, struct address_space *, loff_t,
224 unsigned, unsigned, struct page **, void **, 219 unsigned, unsigned, struct page **, void **,
225 get_block_t *, loff_t *); 220 get_block_t *, loff_t *);
@@ -230,12 +225,7 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
230void block_sync_page(struct page *); 225void block_sync_page(struct page *);
231sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 226sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
232int block_truncate_page(struct address_space *, loff_t, get_block_t *); 227int block_truncate_page(struct address_space *, loff_t, get_block_t *);
233int file_fsync(struct file *, int); 228int nobh_write_begin(struct address_space *, loff_t, unsigned, unsigned,
234int nobh_write_begin_newtrunc(struct file *, struct address_space *,
235 loff_t, unsigned, unsigned,
236 struct page **, void **, get_block_t*);
237int nobh_write_begin(struct file *, struct address_space *,
238 loff_t, unsigned, unsigned,
239 struct page **, void **, get_block_t*); 229 struct page **, void **, get_block_t*);
240int nobh_write_end(struct file *, struct address_space *, 230int nobh_write_end(struct file *, struct address_space *,
241 loff_t, unsigned, unsigned, 231 loff_t, unsigned, unsigned,
@@ -314,15 +304,10 @@ map_bh(struct buffer_head *bh, struct super_block *sb, sector_t block)
314 bh->b_size = sb->s_blocksize; 304 bh->b_size = sb->s_blocksize;
315} 305}
316 306
317/*
318 * Calling wait_on_buffer() for a zero-ref buffer is illegal, so we call into
319 * __wait_on_buffer() just to trip a debug check. Because debug code in inline
320 * functions is bloaty.
321 */
322static inline void wait_on_buffer(struct buffer_head *bh) 307static inline void wait_on_buffer(struct buffer_head *bh)
323{ 308{
324 might_sleep(); 309 might_sleep();
325 if (buffer_locked(bh) || atomic_read(&bh->b_count) == 0) 310 if (buffer_locked(bh))
326 __wait_on_buffer(bh); 311 __wait_on_buffer(bh);
327} 312}
328 313
diff --git a/include/linux/caif/caif_socket.h b/include/linux/caif/caif_socket.h
index 2a61eb1beb85..d9cb19b7cff7 100644
--- a/include/linux/caif/caif_socket.h
+++ b/include/linux/caif/caif_socket.h
@@ -62,6 +62,7 @@ enum caif_channel_priority {
62 * @CAIFPROTO_DATAGRAM_LOOP: Datagram loopback channel, used for testing. 62 * @CAIFPROTO_DATAGRAM_LOOP: Datagram loopback channel, used for testing.
63 * @CAIFPROTO_UTIL: Utility (Psock) channel. 63 * @CAIFPROTO_UTIL: Utility (Psock) channel.
64 * @CAIFPROTO_RFM: Remote File Manager 64 * @CAIFPROTO_RFM: Remote File Manager
65 * @CAIFPROTO_DEBUG: Debug link
65 * 66 *
66 * This enum defines the CAIF Channel type to be used. This defines 67 * This enum defines the CAIF Channel type to be used. This defines
67 * the service to connect to on the modem. 68 * the service to connect to on the modem.
@@ -72,6 +73,7 @@ enum caif_protocol_type {
72 CAIFPROTO_DATAGRAM_LOOP, 73 CAIFPROTO_DATAGRAM_LOOP,
73 CAIFPROTO_UTIL, 74 CAIFPROTO_UTIL,
74 CAIFPROTO_RFM, 75 CAIFPROTO_RFM,
76 CAIFPROTO_DEBUG,
75 _CAIFPROTO_MAX 77 _CAIFPROTO_MAX
76}; 78};
77#define CAIFPROTO_MAX _CAIFPROTO_MAX 79#define CAIFPROTO_MAX _CAIFPROTO_MAX
@@ -83,6 +85,28 @@ enum caif_protocol_type {
83enum caif_at_type { 85enum caif_at_type {
84 CAIF_ATTYPE_PLAIN = 2 86 CAIF_ATTYPE_PLAIN = 2
85}; 87};
88 /**
89 * enum caif_debug_type - Content selection for debug connection
90 * @CAIF_DEBUG_TRACE_INTERACTIVE: Connection will contain
91 * both trace and interactive debug.
92 * @CAIF_DEBUG_TRACE: Connection contains trace only.
93 * @CAIF_DEBUG_INTERACTIVE: Connection to interactive debug.
94 */
95enum caif_debug_type {
96 CAIF_DEBUG_TRACE_INTERACTIVE = 0,
97 CAIF_DEBUG_TRACE,
98 CAIF_DEBUG_INTERACTIVE,
99};
100
101/**
102 * enum caif_debug_service - Debug Service Endpoint
103 * @CAIF_RADIO_DEBUG_SERVICE: Debug service on the Radio sub-system
104 * @CAIF_APP_DEBUG_SERVICE: Debug for the applications sub-system
105 */
106enum caif_debug_service {
107 CAIF_RADIO_DEBUG_SERVICE = 1,
108 CAIF_APP_DEBUG_SERVICE
109};
86 110
87/** 111/**
88 * struct sockaddr_caif - the sockaddr structure for CAIF sockets. 112 * struct sockaddr_caif - the sockaddr structure for CAIF sockets.
@@ -109,6 +133,12 @@ enum caif_at_type {
109 * 133 *
110 * @u.rfm.volume: Volume to mount. 134 * @u.rfm.volume: Volume to mount.
111 * 135 *
136 * @u.dbg: Applies when family = CAIFPROTO_DEBUG.
137 *
138 * @u.dbg.type: Type of debug connection to set up
139 * (caif_debug_type).
140 *
141 * @u.dbg.service: Service sub-system to connect (caif_debug_service
112 * Description: 142 * Description:
113 * This structure holds the connect parameters used for setting up a 143 * This structure holds the connect parameters used for setting up a
114 * CAIF Channel. It defines the service to connect to on the modem. 144 * CAIF Channel. It defines the service to connect to on the modem.
@@ -130,6 +160,10 @@ struct sockaddr_caif {
130 __u32 connection_id; 160 __u32 connection_id;
131 char volume[16]; 161 char volume[16];
132 } rfm; /* CAIFPROTO_RFM */ 162 } rfm; /* CAIFPROTO_RFM */
163 struct {
164 __u8 type; /* type:enum caif_debug_type */
165 __u8 service; /* service:caif_debug_service */
166 } dbg; /* CAIFPROTO_DEBUG */
133 } u; 167 } u;
134}; 168};
135 169
diff --git a/include/linux/can/platform/flexcan.h b/include/linux/can/platform/flexcan.h
new file mode 100644
index 000000000000..72b713ab57e9
--- /dev/null
+++ b/include/linux/can/platform/flexcan.h
@@ -0,0 +1,20 @@
1/*
2 * Copyright (C) 2010 Marc Kleine-Budde <kernel@pengutronix.de>
3 *
4 * This file is released under the GPLv2
5 *
6 */
7
8#ifndef __CAN_PLATFORM_FLEXCAN_H
9#define __CAN_PLATFORM_FLEXCAN_H
10
11/**
12 * struct flexcan_platform_data - flex CAN controller platform data
13 * @transceiver_enable: - called to power on/off the transceiver
14 *
15 */
16struct flexcan_platform_data {
17 void (*transceiver_switch)(int enable);
18};
19
20#endif /* __CAN_PLATFORM_FLEXCAN_H */
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 39e5ff512fbe..90012b9ddbf3 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -49,9 +49,6 @@ typedef struct __user_cap_data_struct {
49} __user *cap_user_data_t; 49} __user *cap_user_data_t;
50 50
51 51
52#define XATTR_CAPS_SUFFIX "capability"
53#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
54
55#define VFS_CAP_REVISION_MASK 0xFF000000 52#define VFS_CAP_REVISION_MASK 0xFF000000
56#define VFS_CAP_REVISION_SHIFT 24 53#define VFS_CAP_REVISION_SHIFT 24
57#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK 54#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index e3d00fdb858d..ed3e92e41c6e 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -578,6 +578,7 @@ struct task_struct *cgroup_iter_next(struct cgroup *cgrp,
578void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it); 578void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it);
579int cgroup_scan_tasks(struct cgroup_scanner *scan); 579int cgroup_scan_tasks(struct cgroup_scanner *scan);
580int cgroup_attach_task(struct cgroup *, struct task_struct *); 580int cgroup_attach_task(struct cgroup *, struct task_struct *);
581int cgroup_attach_task_current_cg(struct task_struct *);
581 582
582/* 583/*
583 * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works 584 * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works
@@ -634,6 +635,12 @@ static inline int cgroupstats_build(struct cgroupstats *stats,
634 return -EINVAL; 635 return -EINVAL;
635} 636}
636 637
638/* No cgroups - nothing to do */
639static inline int cgroup_attach_task_current_cg(struct task_struct *t)
640{
641 return 0;
642}
643
637#endif /* !CONFIG_CGROUPS */ 644#endif /* !CONFIG_CGROUPS */
638 645
639#endif /* _LINUX_CGROUP_H */ 646#endif /* _LINUX_CGROUP_H */
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 5ea3c60c160c..c37b21ad5a3b 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -292,6 +292,8 @@ clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec);
292 */ 292 */
293extern int 293extern int
294__clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq); 294__clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq);
295extern void
296__clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq);
295 297
296static inline int clocksource_register_hz(struct clocksource *cs, u32 hz) 298static inline int clocksource_register_hz(struct clocksource *cs, u32 hz)
297{ 299{
@@ -303,6 +305,15 @@ static inline int clocksource_register_khz(struct clocksource *cs, u32 khz)
303 return __clocksource_register_scale(cs, 1000, khz); 305 return __clocksource_register_scale(cs, 1000, khz);
304} 306}
305 307
308static inline void __clocksource_updatefreq_hz(struct clocksource *cs, u32 hz)
309{
310 __clocksource_updatefreq_scale(cs, 1, hz);
311}
312
313static inline void __clocksource_updatefreq_khz(struct clocksource *cs, u32 khz)
314{
315 __clocksource_updatefreq_scale(cs, 1000, khz);
316}
306 317
307static inline void 318static inline void
308clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec) 319clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec)
@@ -313,11 +324,13 @@ clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec)
313 324
314#ifdef CONFIG_GENERIC_TIME_VSYSCALL 325#ifdef CONFIG_GENERIC_TIME_VSYSCALL
315extern void 326extern void
316update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult); 327update_vsyscall(struct timespec *ts, struct timespec *wtm,
328 struct clocksource *c, u32 mult);
317extern void update_vsyscall_tz(void); 329extern void update_vsyscall_tz(void);
318#else 330#else
319static inline void 331static inline void
320update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult) 332update_vsyscall(struct timespec *ts, struct timespec *wtm,
333 struct clocksource *c, u32 mult)
321{ 334{
322} 335}
323 336
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index 8859e2ede9fe..284b520934a0 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -86,9 +86,9 @@ struct upc_req {
86 wait_queue_head_t uc_sleep; /* process' wait queue */ 86 wait_queue_head_t uc_sleep; /* process' wait queue */
87}; 87};
88 88
89#define REQ_ASYNC 0x1 89#define CODA_REQ_ASYNC 0x1
90#define REQ_READ 0x2 90#define CODA_REQ_READ 0x2
91#define REQ_WRITE 0x4 91#define CODA_REQ_WRITE 0x4
92#define REQ_ABORT 0x8 92#define CODA_REQ_ABORT 0x8
93 93
94#endif 94#endif
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 168f7daa7bde..9ddc8780e8db 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -331,7 +331,7 @@ asmlinkage long compat_sys_epoll_pwait(int epfd,
331 const compat_sigset_t __user *sigmask, 331 const compat_sigset_t __user *sigmask,
332 compat_size_t sigsetsize); 332 compat_size_t sigsetsize);
333 333
334asmlinkage long compat_sys_utimensat(unsigned int dfd, char __user *filename, 334asmlinkage long compat_sys_utimensat(unsigned int dfd, const char __user *filename,
335 struct compat_timespec __user *t, int flags); 335 struct compat_timespec __user *t, int flags);
336 336
337asmlinkage long compat_sys_signalfd(int ufd, 337asmlinkage long compat_sys_signalfd(int ufd,
@@ -348,9 +348,9 @@ asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page,
348 const int __user *nodes, 348 const int __user *nodes,
349 int __user *status, 349 int __user *status,
350 int flags); 350 int flags);
351asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename, 351asmlinkage long compat_sys_futimesat(unsigned int dfd, const char __user *filename,
352 struct compat_timeval __user *t); 352 struct compat_timeval __user *t);
353asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename, 353asmlinkage long compat_sys_newfstatat(unsigned int dfd, const char __user * filename,
354 struct compat_stat __user *statbuf, 354 struct compat_stat __user *statbuf,
355 int flag); 355 int flag);
356asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, 356asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 0da5b187f124..16508bcddacc 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -35,8 +35,7 @@
35 (typeof(ptr)) (__ptr + (off)); }) 35 (typeof(ptr)) (__ptr + (off)); })
36 36
37/* &a[0] degrades to a pointer: a different type from an array */ 37/* &a[0] degrades to a pointer: a different type from an array */
38#define __must_be_array(a) \ 38#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
39 BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
40 39
41/* 40/*
42 * Force always-inline if the user requests it so via the .config, 41 * Force always-inline if the user requests it so via the .config,
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index a5a472b10746..c1a62c56a660 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -16,6 +16,7 @@
16# define __release(x) __context__(x,-1) 16# define __release(x) __context__(x,-1)
17# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) 17# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
18# define __percpu __attribute__((noderef, address_space(3))) 18# define __percpu __attribute__((noderef, address_space(3)))
19# define __rcu
19extern void __chk_user_ptr(const volatile void __user *); 20extern void __chk_user_ptr(const volatile void __user *);
20extern void __chk_io_ptr(const volatile void __iomem *); 21extern void __chk_io_ptr(const volatile void __iomem *);
21#else 22#else
@@ -34,6 +35,7 @@ extern void __chk_io_ptr(const volatile void __iomem *);
34# define __release(x) (void)0 35# define __release(x) (void)0
35# define __cond_lock(x,c) (c) 36# define __cond_lock(x,c) (c)
36# define __percpu 37# define __percpu
38# define __rcu
37#endif 39#endif
38 40
39#ifdef __KERNEL__ 41#ifdef __KERNEL__
diff --git a/include/linux/console.h b/include/linux/console.h
index dcca5339ceb3..95cf6f08a59d 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -55,6 +55,16 @@ struct consw {
55 void (*con_invert_region)(struct vc_data *, u16 *, int); 55 void (*con_invert_region)(struct vc_data *, u16 *, int);
56 u16 *(*con_screen_pos)(struct vc_data *, int); 56 u16 *(*con_screen_pos)(struct vc_data *, int);
57 unsigned long (*con_getxy)(struct vc_data *, unsigned long, int *, int *); 57 unsigned long (*con_getxy)(struct vc_data *, unsigned long, int *, int *);
58 /*
59 * Prepare the console for the debugger. This includes, but is not
60 * limited to, unblanking the console, loading an appropriate
61 * palette, and allowing debugger generated output.
62 */
63 int (*con_debug_enter)(struct vc_data *);
64 /*
65 * Restore the console to its pre-debug state as closely as possible.
66 */
67 int (*con_debug_leave)(struct vc_data *);
58}; 68};
59 69
60extern const struct consw *conswitchp; 70extern const struct consw *conswitchp;
@@ -69,6 +79,14 @@ int register_con_driver(const struct consw *csw, int first, int last);
69int unregister_con_driver(const struct consw *csw); 79int unregister_con_driver(const struct consw *csw);
70int take_over_console(const struct consw *sw, int first, int last, int deflt); 80int take_over_console(const struct consw *sw, int first, int last, int deflt);
71void give_up_console(const struct consw *sw); 81void give_up_console(const struct consw *sw);
82#ifdef CONFIG_HW_CONSOLE
83int con_debug_enter(struct vc_data *vc);
84int con_debug_leave(void);
85#else
86#define con_debug_enter(vc) (0)
87#define con_debug_leave() (0)
88#endif
89
72/* scroll */ 90/* scroll */
73#define SM_UP (1) 91#define SM_UP (1)
74#define SM_DOWN (2) 92#define SM_DOWN (2)
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index 38fe59dc89ae..7f0c32908568 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -21,6 +21,8 @@ struct vt_struct;
21#define NPAR 16 21#define NPAR 16
22 22
23struct vc_data { 23struct vc_data {
24 struct tty_port port; /* Upper level data */
25
24 unsigned short vc_num; /* Console number */ 26 unsigned short vc_num; /* Console number */
25 unsigned int vc_cols; /* [#] Console size */ 27 unsigned int vc_cols; /* [#] Console size */
26 unsigned int vc_rows; 28 unsigned int vc_rows;
@@ -56,7 +58,6 @@ struct vc_data {
56 /* VT terminal data */ 58 /* VT terminal data */
57 unsigned int vc_state; /* Escape sequence parser state */ 59 unsigned int vc_state; /* Escape sequence parser state */
58 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ 60 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */
59 struct tty_struct *vc_tty; /* TTY we are attached to */
60 /* data for manual vt switching */ 61 /* data for manual vt switching */
61 struct vt_mode vt_mode; 62 struct vt_mode vt_mode;
62 struct pid *vt_pid; 63 struct pid *vt_pid;
@@ -105,6 +106,7 @@ struct vc_data {
105 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */ 106 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */
106 unsigned long vc_uni_pagedir; 107 unsigned long vc_uni_pagedir;
107 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */ 108 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
109 bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */
108 /* additional information is in vt_kern.h */ 110 /* additional information is in vt_kern.h */
109}; 111};
110 112
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index e287863ac053..4823af64e9db 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -48,6 +48,33 @@ extern ssize_t arch_cpu_release(const char *, size_t);
48#endif 48#endif
49struct notifier_block; 49struct notifier_block;
50 50
51/*
52 * CPU notifier priorities.
53 */
54enum {
55 /*
56 * SCHED_ACTIVE marks a cpu which is coming up active during
57 * CPU_ONLINE and CPU_DOWN_FAILED and must be the first
58 * notifier. CPUSET_ACTIVE adjusts cpuset according to
59 * cpu_active mask right after SCHED_ACTIVE. During
60 * CPU_DOWN_PREPARE, SCHED_INACTIVE and CPUSET_INACTIVE are
61 * ordered in the similar way.
62 *
63 * This ordering guarantees consistent cpu_active mask and
64 * migration behavior to all cpu notifiers.
65 */
66 CPU_PRI_SCHED_ACTIVE = INT_MAX,
67 CPU_PRI_CPUSET_ACTIVE = INT_MAX - 1,
68 CPU_PRI_SCHED_INACTIVE = INT_MIN + 1,
69 CPU_PRI_CPUSET_INACTIVE = INT_MIN,
70
71 /* migration should happen before other stuff but after perf */
72 CPU_PRI_PERF = 20,
73 CPU_PRI_MIGRATION = 10,
74 /* prepare workqueues for other notifiers */
75 CPU_PRI_WORKQUEUE = 5,
76};
77
51#ifdef CONFIG_SMP 78#ifdef CONFIG_SMP
52/* Need to know about CPUs going up/down? */ 79/* Need to know about CPUs going up/down? */
53#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) 80#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE)
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 9f15150ce8d6..c3e9de8321c6 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -196,11 +196,6 @@ extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy,
196int cpufreq_register_governor(struct cpufreq_governor *governor); 196int cpufreq_register_governor(struct cpufreq_governor *governor);
197void cpufreq_unregister_governor(struct cpufreq_governor *governor); 197void cpufreq_unregister_governor(struct cpufreq_governor *governor);
198 198
199int lock_policy_rwsem_read(int cpu);
200int lock_policy_rwsem_write(int cpu);
201void unlock_policy_rwsem_read(int cpu);
202void unlock_policy_rwsem_write(int cpu);
203
204 199
205/********************************************************************* 200/*********************************************************************
206 * CPUFREQ DRIVER INTERFACE * 201 * CPUFREQ DRIVER INTERFACE *
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 55215cce5005..36ca9721a0c2 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -52,6 +52,7 @@ struct cpuidle_state {
52#define CPUIDLE_FLAG_SHALLOW (0x20) /* low latency, minimal savings */ 52#define CPUIDLE_FLAG_SHALLOW (0x20) /* low latency, minimal savings */
53#define CPUIDLE_FLAG_BALANCED (0x40) /* medium latency, moderate savings */ 53#define CPUIDLE_FLAG_BALANCED (0x40) /* medium latency, moderate savings */
54#define CPUIDLE_FLAG_DEEP (0x80) /* high latency, large savings */ 54#define CPUIDLE_FLAG_DEEP (0x80) /* high latency, large savings */
55#define CPUIDLE_FLAG_IGNORE (0x100) /* ignore during this idle period */
55 56
56#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) 57#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
57 58
@@ -84,6 +85,7 @@ struct cpuidle_state_kobj {
84struct cpuidle_device { 85struct cpuidle_device {
85 unsigned int registered:1; 86 unsigned int registered:1;
86 unsigned int enabled:1; 87 unsigned int enabled:1;
88 unsigned int power_specified:1;
87 unsigned int cpu; 89 unsigned int cpu;
88 90
89 int last_residency; 91 int last_residency;
@@ -97,6 +99,8 @@ struct cpuidle_device {
97 struct completion kobj_unregister; 99 struct completion kobj_unregister;
98 void *governor_data; 100 void *governor_data;
99 struct cpuidle_state *safe_state; 101 struct cpuidle_state *safe_state;
102
103 int (*prepare) (struct cpuidle_device *dev);
100}; 104};
101 105
102DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); 106DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 457ed765a116..f20eb8f16025 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -20,6 +20,7 @@ extern int number_of_cpusets; /* How many cpusets are defined in system? */
20 20
21extern int cpuset_init(void); 21extern int cpuset_init(void);
22extern void cpuset_init_smp(void); 22extern void cpuset_init_smp(void);
23extern void cpuset_update_active_cpus(void);
23extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); 24extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
24extern int cpuset_cpus_allowed_fallback(struct task_struct *p); 25extern int cpuset_cpus_allowed_fallback(struct task_struct *p);
25extern nodemask_t cpuset_mems_allowed(struct task_struct *p); 26extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
@@ -132,6 +133,11 @@ static inline void set_mems_allowed(nodemask_t nodemask)
132static inline int cpuset_init(void) { return 0; } 133static inline int cpuset_init(void) { return 0; }
133static inline void cpuset_init_smp(void) {} 134static inline void cpuset_init_smp(void) {}
134 135
136static inline void cpuset_update_active_cpus(void)
137{
138 partition_sched_domains(1, NULL, NULL);
139}
140
135static inline void cpuset_cpus_allowed(struct task_struct *p, 141static inline void cpuset_cpus_allowed(struct task_struct *p,
136 struct cpumask *mask) 142 struct cpumask *mask)
137{ 143{
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index eebb617c17d8..6a4aea30aa09 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -315,6 +315,8 @@ extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
315 315
316extern char *__d_path(const struct path *path, struct path *root, char *, int); 316extern char *__d_path(const struct path *path, struct path *root, char *, int);
317extern char *d_path(const struct path *, char *, int); 317extern char *d_path(const struct path *, char *, int);
318extern char *d_path_with_unreachable(const struct path *, char *, int);
319extern char *__dentry_path(struct dentry *, char *, int);
318extern char *dentry_path(struct dentry *, char *, int); 320extern char *dentry_path(struct dentry *, char *, int);
319 321
320/* Allocation counts.. */ 322/* Allocation counts.. */
diff --git a/include/linux/delay.h b/include/linux/delay.h
index fd832c6d419e..a6ecb34cf547 100644
--- a/include/linux/delay.h
+++ b/include/linux/delay.h
@@ -45,6 +45,7 @@ extern unsigned long lpj_fine;
45void calibrate_delay(void); 45void calibrate_delay(void);
46void msleep(unsigned int msecs); 46void msleep(unsigned int msecs);
47unsigned long msleep_interruptible(unsigned int msecs); 47unsigned long msleep_interruptible(unsigned int msecs);
48void usleep_range(unsigned long min, unsigned long max);
48 49
49static inline void ssleep(unsigned int seconds) 50static inline void ssleep(unsigned int seconds)
50{ 51{
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 1381cd97b4ed..2970022faa63 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -22,7 +22,7 @@ typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t;
22union map_info { 22union map_info {
23 void *ptr; 23 void *ptr;
24 unsigned long long ll; 24 unsigned long long ll;
25 unsigned flush_request; 25 unsigned target_request_nr;
26}; 26};
27 27
28/* 28/*
@@ -174,12 +174,18 @@ struct dm_target {
174 * A number of zero-length barrier requests that will be submitted 174 * A number of zero-length barrier requests that will be submitted
175 * to the target for the purpose of flushing cache. 175 * to the target for the purpose of flushing cache.
176 * 176 *
177 * The request number will be placed in union map_info->flush_request. 177 * The request number will be placed in union map_info->target_request_nr.
178 * It is a responsibility of the target driver to remap these requests 178 * It is a responsibility of the target driver to remap these requests
179 * to the real underlying devices. 179 * to the real underlying devices.
180 */ 180 */
181 unsigned num_flush_requests; 181 unsigned num_flush_requests;
182 182
183 /*
184 * The number of discard requests that will be submitted to the
185 * target. map_info->request_nr is used just like num_flush_requests.
186 */
187 unsigned num_discard_requests;
188
183 /* target specific data */ 189 /* target specific data */
184 void *private; 190 void *private;
185 191
@@ -392,6 +398,12 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size);
392#define dm_array_too_big(fixed, obj, num) \ 398#define dm_array_too_big(fixed, obj, num) \
393 ((num) > (UINT_MAX - (fixed)) / (obj)) 399 ((num) > (UINT_MAX - (fixed)) / (obj))
394 400
401/*
402 * Sector offset taken relative to the start of the target instead of
403 * relative to the start of the device.
404 */
405#define dm_target_offset(ti, sector) ((sector) - (ti)->begin)
406
395static inline sector_t to_sector(unsigned long n) 407static inline sector_t to_sector(unsigned long n)
396{ 408{
397 return (n >> SECTOR_SHIFT); 409 return (n >> SECTOR_SHIFT);
diff --git a/include/linux/device.h b/include/linux/device.h
index 0713e10571dd..516fecacf27b 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -84,9 +84,8 @@ struct device *bus_find_device_by_name(struct bus_type *bus,
84 struct device *start, 84 struct device *start,
85 const char *name); 85 const char *name);
86 86
87int __must_check bus_for_each_drv(struct bus_type *bus, 87int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
88 struct device_driver *start, void *data, 88 void *data, int (*fn)(struct device_driver *, void *));
89 int (*fn)(struct device_driver *, void *));
90 89
91void bus_sort_breadthfirst(struct bus_type *bus, 90void bus_sort_breadthfirst(struct bus_type *bus,
92 int (*compare)(const struct device *a, 91 int (*compare)(const struct device *a,
@@ -110,10 +109,12 @@ extern int bus_unregister_notifier(struct bus_type *bus,
110 */ 109 */
111#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ 110#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */
112#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */ 111#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */
113#define BUS_NOTIFY_BOUND_DRIVER 0x00000003 /* driver bound to device */ 112#define BUS_NOTIFY_BIND_DRIVER 0x00000003 /* driver about to be
114#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be 113 bound */
114#define BUS_NOTIFY_BOUND_DRIVER 0x00000004 /* driver bound to device */
115#define BUS_NOTIFY_UNBIND_DRIVER 0x00000005 /* driver about to be
115 unbound */ 116 unbound */
116#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000005 /* driver is unbound 117#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000006 /* driver is unbound
117 from the device */ 118 from the device */
118 119
119extern struct kset *bus_get_kset(struct bus_type *bus); 120extern struct kset *bus_get_kset(struct bus_type *bus);
@@ -551,7 +552,7 @@ extern int device_for_each_child(struct device *dev, void *data,
551 int (*fn)(struct device *dev, void *data)); 552 int (*fn)(struct device *dev, void *data));
552extern struct device *device_find_child(struct device *dev, void *data, 553extern struct device *device_find_child(struct device *dev, void *data,
553 int (*match)(struct device *dev, void *data)); 554 int (*match)(struct device *dev, void *data));
554extern int device_rename(struct device *dev, char *new_name); 555extern int device_rename(struct device *dev, const char *new_name);
555extern int device_move(struct device *dev, struct device *new_parent, 556extern int device_move(struct device *dev, struct device *new_parent,
556 enum dpm_order dpm_order); 557 enum dpm_order dpm_order);
557extern const char *device_get_devnode(struct device *dev, 558extern const char *device_get_devnode(struct device *dev,
@@ -638,43 +639,103 @@ extern void sysdev_shutdown(void);
638 639
639/* debugging and troubleshooting/diagnostic helpers. */ 640/* debugging and troubleshooting/diagnostic helpers. */
640extern const char *dev_driver_string(const struct device *dev); 641extern const char *dev_driver_string(const struct device *dev);
641#define dev_printk(level, dev, format, arg...) \ 642
642 printk(level "%s %s: " format , dev_driver_string(dev) , \ 643
643 dev_name(dev) , ## arg) 644#ifdef CONFIG_PRINTK
644 645
645#define dev_emerg(dev, format, arg...) \ 646extern int dev_printk(const char *level, const struct device *dev,
646 dev_printk(KERN_EMERG , dev , format , ## arg) 647 const char *fmt, ...)
647#define dev_alert(dev, format, arg...) \ 648 __attribute__ ((format (printf, 3, 4)));
648 dev_printk(KERN_ALERT , dev , format , ## arg) 649extern int dev_emerg(const struct device *dev, const char *fmt, ...)
649#define dev_crit(dev, format, arg...) \ 650 __attribute__ ((format (printf, 2, 3)));
650 dev_printk(KERN_CRIT , dev , format , ## arg) 651extern int dev_alert(const struct device *dev, const char *fmt, ...)
651#define dev_err(dev, format, arg...) \ 652 __attribute__ ((format (printf, 2, 3)));
652 dev_printk(KERN_ERR , dev , format , ## arg) 653extern int dev_crit(const struct device *dev, const char *fmt, ...)
653#define dev_warn(dev, format, arg...) \ 654 __attribute__ ((format (printf, 2, 3)));
654 dev_printk(KERN_WARNING , dev , format , ## arg) 655extern int dev_err(const struct device *dev, const char *fmt, ...)
655#define dev_notice(dev, format, arg...) \ 656 __attribute__ ((format (printf, 2, 3)));
656 dev_printk(KERN_NOTICE , dev , format , ## arg) 657extern int dev_warn(const struct device *dev, const char *fmt, ...)
657#define dev_info(dev, format, arg...) \ 658 __attribute__ ((format (printf, 2, 3)));
658 dev_printk(KERN_INFO , dev , format , ## arg) 659extern int dev_notice(const struct device *dev, const char *fmt, ...)
660 __attribute__ ((format (printf, 2, 3)));
661extern int _dev_info(const struct device *dev, const char *fmt, ...)
662 __attribute__ ((format (printf, 2, 3)));
663
664#else
665
666static inline int dev_printk(const char *level, const struct device *dev,
667 const char *fmt, ...)
668 __attribute__ ((format (printf, 3, 4)));
669static inline int dev_printk(const char *level, const struct device *dev,
670 const char *fmt, ...)
671 { return 0; }
672
673static inline int dev_emerg(const struct device *dev, const char *fmt, ...)
674 __attribute__ ((format (printf, 2, 3)));
675static inline int dev_emerg(const struct device *dev, const char *fmt, ...)
676 { return 0; }
677static inline int dev_crit(const struct device *dev, const char *fmt, ...)
678 __attribute__ ((format (printf, 2, 3)));
679static inline int dev_crit(const struct device *dev, const char *fmt, ...)
680 { return 0; }
681static inline int dev_alert(const struct device *dev, const char *fmt, ...)
682 __attribute__ ((format (printf, 2, 3)));
683static inline int dev_alert(const struct device *dev, const char *fmt, ...)
684 { return 0; }
685static inline int dev_err(const struct device *dev, const char *fmt, ...)
686 __attribute__ ((format (printf, 2, 3)));
687static inline int dev_err(const struct device *dev, const char *fmt, ...)
688 { return 0; }
689static inline int dev_warn(const struct device *dev, const char *fmt, ...)
690 __attribute__ ((format (printf, 2, 3)));
691static inline int dev_warn(const struct device *dev, const char *fmt, ...)
692 { return 0; }
693static inline int dev_notice(const struct device *dev, const char *fmt, ...)
694 __attribute__ ((format (printf, 2, 3)));
695static inline int dev_notice(const struct device *dev, const char *fmt, ...)
696 { return 0; }
697static inline int _dev_info(const struct device *dev, const char *fmt, ...)
698 __attribute__ ((format (printf, 2, 3)));
699static inline int _dev_info(const struct device *dev, const char *fmt, ...)
700 { return 0; }
701
702#endif
703
704/*
705 * Stupid hackaround for existing uses of non-printk uses dev_info
706 *
707 * Note that the definition of dev_info below is actually _dev_info
708 * and a macro is used to avoid redefining dev_info
709 */
710
711#define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
659 712
660#if defined(DEBUG) 713#if defined(DEBUG)
661#define dev_dbg(dev, format, arg...) \ 714#define dev_dbg(dev, format, arg...) \
662 dev_printk(KERN_DEBUG , dev , format , ## arg) 715 dev_printk(KERN_DEBUG, dev, format, ##arg)
663#elif defined(CONFIG_DYNAMIC_DEBUG) 716#elif defined(CONFIG_DYNAMIC_DEBUG)
664#define dev_dbg(dev, format, ...) do { \ 717#define dev_dbg(dev, format, ...) \
718do { \
665 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ 719 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
666 } while (0) 720} while (0)
667#else 721#else
668#define dev_dbg(dev, format, arg...) \ 722#define dev_dbg(dev, format, arg...) \
669 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; }) 723({ \
724 if (0) \
725 dev_printk(KERN_DEBUG, dev, format, ##arg); \
726 0; \
727})
670#endif 728#endif
671 729
672#ifdef VERBOSE_DEBUG 730#ifdef VERBOSE_DEBUG
673#define dev_vdbg dev_dbg 731#define dev_vdbg dev_dbg
674#else 732#else
675 733#define dev_vdbg(dev, format, arg...) \
676#define dev_vdbg(dev, format, arg...) \ 734({ \
677 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; }) 735 if (0) \
736 dev_printk(KERN_DEBUG, dev, format, ##arg); \
737 0; \
738})
678#endif 739#endif
679 740
680/* 741/*
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index 2c445e113790..49eab360d5d4 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -11,6 +11,7 @@
11#include <linux/types.h> 11#include <linux/types.h>
12 12
13#define DM_DIR "mapper" /* Slashes not supported */ 13#define DM_DIR "mapper" /* Slashes not supported */
14#define DM_CONTROL_NODE "control"
14#define DM_MAX_TYPE_NAME 16 15#define DM_MAX_TYPE_NAME 16
15#define DM_NAME_LEN 128 16#define DM_NAME_LEN 128
16#define DM_UUID_LEN 129 17#define DM_UUID_LEN 129
@@ -266,9 +267,9 @@ enum {
266#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) 267#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
267 268
268#define DM_VERSION_MAJOR 4 269#define DM_VERSION_MAJOR 4
269#define DM_VERSION_MINOR 17 270#define DM_VERSION_MINOR 18
270#define DM_VERSION_PATCHLEVEL 0 271#define DM_VERSION_PATCHLEVEL 0
271#define DM_VERSION_EXTRA "-ioctl (2010-03-05)" 272#define DM_VERSION_EXTRA "-ioctl (2010-06-29)"
272 273
273/* Status bits */ 274/* Status bits */
274#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 275#define DM_READONLY_FLAG (1 << 0) /* In/Out */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 89b7e1a605b8..ce29b8151198 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -142,6 +142,16 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask)
142 return -EIO; 142 return -EIO;
143} 143}
144 144
145#ifdef CONFIG_HAS_DMA
146static inline int dma_get_cache_alignment(void)
147{
148#ifdef ARCH_DMA_MINALIGN
149 return ARCH_DMA_MINALIGN;
150#endif
151 return 1;
152}
153#endif
154
145/* flags for the coherent memory api */ 155/* flags for the coherent memory api */
146#define DMA_MEMORY_MAP 0x01 156#define DMA_MEMORY_MAP 0x01
147#define DMA_MEMORY_IO 0x02 157#define DMA_MEMORY_IO 0x02
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 5204f018931b..c61d4ca27bcc 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -114,11 +114,17 @@ enum dma_ctrl_flags {
114 * @DMA_TERMINATE_ALL: terminate all ongoing transfers 114 * @DMA_TERMINATE_ALL: terminate all ongoing transfers
115 * @DMA_PAUSE: pause ongoing transfers 115 * @DMA_PAUSE: pause ongoing transfers
116 * @DMA_RESUME: resume paused transfer 116 * @DMA_RESUME: resume paused transfer
117 * @DMA_SLAVE_CONFIG: this command is only implemented by DMA controllers
118 * that need to runtime reconfigure the slave channels (as opposed to passing
119 * configuration data in statically from the platform). An additional
120 * argument of struct dma_slave_config must be passed in with this
121 * command.
117 */ 122 */
118enum dma_ctrl_cmd { 123enum dma_ctrl_cmd {
119 DMA_TERMINATE_ALL, 124 DMA_TERMINATE_ALL,
120 DMA_PAUSE, 125 DMA_PAUSE,
121 DMA_RESUME, 126 DMA_RESUME,
127 DMA_SLAVE_CONFIG,
122}; 128};
123 129
124/** 130/**
@@ -199,6 +205,71 @@ struct dma_chan_dev {
199 atomic_t *idr_ref; 205 atomic_t *idr_ref;
200}; 206};
201 207
208/**
209 * enum dma_slave_buswidth - defines bus with of the DMA slave
210 * device, source or target buses
211 */
212enum dma_slave_buswidth {
213 DMA_SLAVE_BUSWIDTH_UNDEFINED = 0,
214 DMA_SLAVE_BUSWIDTH_1_BYTE = 1,
215 DMA_SLAVE_BUSWIDTH_2_BYTES = 2,
216 DMA_SLAVE_BUSWIDTH_4_BYTES = 4,
217 DMA_SLAVE_BUSWIDTH_8_BYTES = 8,
218};
219
220/**
221 * struct dma_slave_config - dma slave channel runtime config
222 * @direction: whether the data shall go in or out on this slave
223 * channel, right now. DMA_TO_DEVICE and DMA_FROM_DEVICE are
224 * legal values, DMA_BIDIRECTIONAL is not acceptable since we
225 * need to differentiate source and target addresses.
226 * @src_addr: this is the physical address where DMA slave data
227 * should be read (RX), if the source is memory this argument is
228 * ignored.
229 * @dst_addr: this is the physical address where DMA slave data
230 * should be written (TX), if the source is memory this argument
231 * is ignored.
232 * @src_addr_width: this is the width in bytes of the source (RX)
233 * register where DMA data shall be read. If the source
234 * is memory this may be ignored depending on architecture.
235 * Legal values: 1, 2, 4, 8.
236 * @dst_addr_width: same as src_addr_width but for destination
237 * target (TX) mutatis mutandis.
238 * @src_maxburst: the maximum number of words (note: words, as in
239 * units of the src_addr_width member, not bytes) that can be sent
240 * in one burst to the device. Typically something like half the
241 * FIFO depth on I/O peripherals so you don't overflow it. This
242 * may or may not be applicable on memory sources.
243 * @dst_maxburst: same as src_maxburst but for destination target
244 * mutatis mutandis.
245 *
246 * This struct is passed in as configuration data to a DMA engine
247 * in order to set up a certain channel for DMA transport at runtime.
248 * The DMA device/engine has to provide support for an additional
249 * command in the channel config interface, DMA_SLAVE_CONFIG
250 * and this struct will then be passed in as an argument to the
251 * DMA engine device_control() function.
252 *
253 * The rationale for adding configuration information to this struct
254 * is as follows: if it is likely that most DMA slave controllers in
255 * the world will support the configuration option, then make it
256 * generic. If not: if it is fixed so that it be sent in static from
257 * the platform data, then prefer to do that. Else, if it is neither
258 * fixed at runtime, nor generic enough (such as bus mastership on
259 * some CPU family and whatnot) then create a custom slave config
260 * struct and pass that, then make this config a member of that
261 * struct, if applicable.
262 */
263struct dma_slave_config {
264 enum dma_data_direction direction;
265 dma_addr_t src_addr;
266 dma_addr_t dst_addr;
267 enum dma_slave_buswidth src_addr_width;
268 enum dma_slave_buswidth dst_addr_width;
269 u32 src_maxburst;
270 u32 dst_maxburst;
271};
272
202static inline const char *dma_chan_name(struct dma_chan *chan) 273static inline const char *dma_chan_name(struct dma_chan *chan)
203{ 274{
204 return dev_name(&chan->dev->device); 275 return dev_name(&chan->dev->device);
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index a8a3e1ac281d..90e087f8d951 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -20,6 +20,7 @@ enum dmi_device_type {
20 DMI_DEV_TYPE_SAS, 20 DMI_DEV_TYPE_SAS,
21 DMI_DEV_TYPE_IPMI = -1, 21 DMI_DEV_TYPE_IPMI = -1,
22 DMI_DEV_TYPE_OEM_STRING = -2, 22 DMI_DEV_TYPE_OEM_STRING = -2,
23 DMI_DEV_TYPE_DEV_ONBOARD = -3,
23}; 24};
24 25
25struct dmi_header { 26struct dmi_header {
@@ -37,6 +38,14 @@ struct dmi_device {
37 38
38#ifdef CONFIG_DMI 39#ifdef CONFIG_DMI
39 40
41struct dmi_dev_onboard {
42 struct dmi_device dev;
43 int instance;
44 int segment;
45 int bus;
46 int devfn;
47};
48
40extern int dmi_check_system(const struct dmi_system_id *list); 49extern int dmi_check_system(const struct dmi_system_id *list);
41const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list); 50const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list);
42extern const char * dmi_get_system_info(int field); 51extern const char * dmi_get_system_info(int field);
diff --git a/include/linux/dnotify.h b/include/linux/dnotify.h
index ecc06286226d..3290555a52ee 100644
--- a/include/linux/dnotify.h
+++ b/include/linux/dnotify.h
@@ -28,6 +28,7 @@ struct dnotify_struct {
28 FS_CREATE | FS_DN_RENAME |\ 28 FS_CREATE | FS_DN_RENAME |\
29 FS_MOVED_FROM | FS_MOVED_TO) 29 FS_MOVED_FROM | FS_MOVED_TO)
30 30
31extern int dir_notify_enable;
31extern void dnotify_flush(struct file *, fl_owner_t); 32extern void dnotify_flush(struct file *, fl_owner_t);
32extern int fcntl_dirnotify(int, struct file *, unsigned long); 33extern int fcntl_dirnotify(int, struct file *, unsigned long);
33 34
diff --git a/include/linux/dns_resolver.h b/include/linux/dns_resolver.h
new file mode 100644
index 000000000000..cc92268af89a
--- /dev/null
+++ b/include/linux/dns_resolver.h
@@ -0,0 +1,34 @@
1/*
2 * DNS Resolver upcall management for CIFS DFS and AFS
3 * Handles host name to IP address resolution and DNS query for AFSDB RR.
4 *
5 * Copyright (c) International Business Machines Corp., 2008
6 * Author(s): Steve French (sfrench@us.ibm.com)
7 * Wang Lei (wang840925@gmail.com)
8 *
9 * This library is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as published
11 * by the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
17 * the GNU Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#ifndef _LINUX_DNS_RESOLVER_H
25#define _LINUX_DNS_RESOLVER_H
26
27#ifdef __KERNEL__
28
29extern int dns_query(const char *type, const char *name, size_t namelen,
30 const char *options, char **_result, time_t *_expiry);
31
32#endif /* KERNEL */
33
34#endif /* _LINUX_DNS_RESOLVER_H */
diff --git a/include/linux/dqblk_xfs.h b/include/linux/dqblk_xfs.h
index 4389ae72024e..86552807aed9 100644
--- a/include/linux/dqblk_xfs.h
+++ b/include/linux/dqblk_xfs.h
@@ -49,7 +49,7 @@
49#define FS_DQUOT_VERSION 1 /* fs_disk_quota.d_version */ 49#define FS_DQUOT_VERSION 1 /* fs_disk_quota.d_version */
50typedef struct fs_disk_quota { 50typedef struct fs_disk_quota {
51 __s8 d_version; /* version of this structure */ 51 __s8 d_version; /* version of this structure */
52 __s8 d_flags; /* XFS_{USER,PROJ,GROUP}_QUOTA */ 52 __s8 d_flags; /* FS_{USER,PROJ,GROUP}_QUOTA */
53 __u16 d_fieldmask; /* field specifier */ 53 __u16 d_fieldmask; /* field specifier */
54 __u32 d_id; /* user, project, or group ID */ 54 __u32 d_id; /* user, project, or group ID */
55 __u64 d_blk_hardlimit;/* absolute limit on disk blks */ 55 __u64 d_blk_hardlimit;/* absolute limit on disk blks */
@@ -119,18 +119,18 @@ typedef struct fs_disk_quota {
119#define FS_DQ_ACCT_MASK (FS_DQ_BCOUNT | FS_DQ_ICOUNT | FS_DQ_RTBCOUNT) 119#define FS_DQ_ACCT_MASK (FS_DQ_BCOUNT | FS_DQ_ICOUNT | FS_DQ_RTBCOUNT)
120 120
121/* 121/*
122 * Various flags related to quotactl(2). Only relevant to XFS filesystems. 122 * Various flags related to quotactl(2).
123 */ 123 */
124#define XFS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */ 124#define FS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */
125#define XFS_QUOTA_UDQ_ENFD (1<<1) /* user quota limits enforcement */ 125#define FS_QUOTA_UDQ_ENFD (1<<1) /* user quota limits enforcement */
126#define XFS_QUOTA_GDQ_ACCT (1<<2) /* group quota accounting */ 126#define FS_QUOTA_GDQ_ACCT (1<<2) /* group quota accounting */
127#define XFS_QUOTA_GDQ_ENFD (1<<3) /* group quota limits enforcement */ 127#define FS_QUOTA_GDQ_ENFD (1<<3) /* group quota limits enforcement */
128#define XFS_QUOTA_PDQ_ACCT (1<<4) /* project quota accounting */ 128#define FS_QUOTA_PDQ_ACCT (1<<4) /* project quota accounting */
129#define XFS_QUOTA_PDQ_ENFD (1<<5) /* project quota limits enforcement */ 129#define FS_QUOTA_PDQ_ENFD (1<<5) /* project quota limits enforcement */
130 130
131#define XFS_USER_QUOTA (1<<0) /* user quota type */ 131#define FS_USER_QUOTA (1<<0) /* user quota type */
132#define XFS_PROJ_QUOTA (1<<1) /* project quota type */ 132#define FS_PROJ_QUOTA (1<<1) /* project quota type */
133#define XFS_GROUP_QUOTA (1<<2) /* group quota type */ 133#define FS_GROUP_QUOTA (1<<2) /* group quota type */
134 134
135/* 135/*
136 * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system. 136 * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system.
@@ -151,7 +151,7 @@ typedef struct fs_qfilestat {
151 151
152typedef struct fs_quota_stat { 152typedef struct fs_quota_stat {
153 __s8 qs_version; /* version number for future changes */ 153 __s8 qs_version; /* version number for future changes */
154 __u16 qs_flags; /* XFS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */ 154 __u16 qs_flags; /* FS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */
155 __s8 qs_pad; /* unused */ 155 __s8 qs_pad; /* unused */
156 fs_qfilestat_t qs_uquota; /* user quota storage information */ 156 fs_qfilestat_t qs_uquota; /* user quota storage information */
157 fs_qfilestat_t qs_gquota; /* group quota storage information */ 157 fs_qfilestat_t qs_gquota; /* group quota storage information */
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index b8d2516668aa..479ee3a1d901 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -53,7 +53,7 @@
53 53
54 54
55extern const char *drbd_buildtag(void); 55extern const char *drbd_buildtag(void);
56#define REL_VERSION "8.3.8" 56#define REL_VERSION "8.3.8.1"
57#define API_VERSION 88 57#define API_VERSION 88
58#define PRO_VERSION_MIN 86 58#define PRO_VERSION_MIN 86
59#define PRO_VERSION_MAX 94 59#define PRO_VERSION_MAX 94
diff --git a/include/linux/drbd_nl.h b/include/linux/drbd_nl.h
index ce77a746fc9d..5f042810a56c 100644
--- a/include/linux/drbd_nl.h
+++ b/include/linux/drbd_nl.h
@@ -78,10 +78,11 @@ NL_PACKET(syncer_conf, 8,
78 NL_INTEGER( 30, T_MAY_IGNORE, rate) 78 NL_INTEGER( 30, T_MAY_IGNORE, rate)
79 NL_INTEGER( 31, T_MAY_IGNORE, after) 79 NL_INTEGER( 31, T_MAY_IGNORE, after)
80 NL_INTEGER( 32, T_MAY_IGNORE, al_extents) 80 NL_INTEGER( 32, T_MAY_IGNORE, al_extents)
81 NL_INTEGER( 71, T_MAY_IGNORE, dp_volume) 81/* NL_INTEGER( 71, T_MAY_IGNORE, dp_volume)
82 NL_INTEGER( 72, T_MAY_IGNORE, dp_interval) 82 * NL_INTEGER( 72, T_MAY_IGNORE, dp_interval)
83 NL_INTEGER( 73, T_MAY_IGNORE, throttle_th) 83 * NL_INTEGER( 73, T_MAY_IGNORE, throttle_th)
84 NL_INTEGER( 74, T_MAY_IGNORE, hold_off_th) 84 * NL_INTEGER( 74, T_MAY_IGNORE, hold_off_th)
85 * feature will be reimplemented differently with 8.3.9 */
85 NL_STRING( 52, T_MAY_IGNORE, verify_alg, SHARED_SECRET_MAX) 86 NL_STRING( 52, T_MAY_IGNORE, verify_alg, SHARED_SECRET_MAX)
86 NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32) 87 NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32)
87 NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX) 88 NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX)
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index b6cb5425cde3..493a2bf85f62 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -62,6 +62,7 @@ typedef enum fe_caps {
62 FE_CAN_8VSB = 0x200000, 62 FE_CAN_8VSB = 0x200000,
63 FE_CAN_16VSB = 0x400000, 63 FE_CAN_16VSB = 0x400000,
64 FE_HAS_EXTENDED_CAPS = 0x800000, /* We need more bitspace for newer APIs, indicate this. */ 64 FE_HAS_EXTENDED_CAPS = 0x800000, /* We need more bitspace for newer APIs, indicate this. */
65 FE_CAN_TURBO_FEC = 0x8000000, /* frontend supports "turbo fec modulation" */
65 FE_CAN_2G_MODULATION = 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */ 66 FE_CAN_2G_MODULATION = 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */
66 FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */ 67 FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */
67 FE_CAN_RECOVER = 0x40000000, /* frontend can recover from a cable unplug automatically */ 68 FE_CAN_RECOVER = 0x40000000, /* frontend can recover from a cable unplug automatically */
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h
index 540b0583d9fb..5a7546c12688 100644
--- a/include/linux/dvb/version.h
+++ b/include/linux/dvb/version.h
@@ -24,6 +24,6 @@
24#define _DVBVERSION_H_ 24#define _DVBVERSION_H_
25 25
26#define DVB_API_VERSION 5 26#define DVB_API_VERSION 5
27#define DVB_API_VERSION_MINOR 1 27#define DVB_API_VERSION_MINOR 2
28 28
29#endif /*_DVBVERSION_H_*/ 29#endif /*_DVBVERSION_H_*/
diff --git a/include/linux/eeprom_93cx6.h b/include/linux/eeprom_93cx6.h
index a55c873e8b66..c4627cbdb8e0 100644
--- a/include/linux/eeprom_93cx6.h
+++ b/include/linux/eeprom_93cx6.h
@@ -30,6 +30,7 @@
30#define PCI_EEPROM_WIDTH_93C46 6 30#define PCI_EEPROM_WIDTH_93C46 6
31#define PCI_EEPROM_WIDTH_93C56 8 31#define PCI_EEPROM_WIDTH_93C56 8
32#define PCI_EEPROM_WIDTH_93C66 8 32#define PCI_EEPROM_WIDTH_93C66 8
33#define PCI_EEPROM_WIDTH_93C86 8
33#define PCI_EEPROM_WIDTH_OPCODE 3 34#define PCI_EEPROM_WIDTH_OPCODE 3
34#define PCI_EEPROM_WRITE_OPCODE 0x05 35#define PCI_EEPROM_WRITE_OPCODE 0x05
35#define PCI_EEPROM_READ_OPCODE 0x06 36#define PCI_EEPROM_READ_OPCODE 0x06
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 3d7a6687d247..2308fbb4523a 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -127,6 +127,20 @@ static inline void random_ether_addr(u8 *addr)
127} 127}
128 128
129/** 129/**
130 * dev_hw_addr_random - Create random MAC and set device flag
131 * @dev: pointer to net_device structure
132 * @hwaddr: Pointer to a six-byte array containing the Ethernet address
133 *
134 * Generate random MAC to be used by a device and set addr_assign_type
135 * so the state can be read by sysfs and be used by udev.
136 */
137static inline void dev_hw_addr_random(struct net_device *dev, u8 *hwaddr)
138{
139 dev->addr_assign_type |= NET_ADDR_RANDOM;
140 random_ether_addr(hwaddr);
141}
142
143/**
130 * compare_ether_addr - Compare two Ethernet addresses 144 * compare_ether_addr - Compare two Ethernet addresses
131 * @addr1: Pointer to a six-byte array containing the Ethernet address 145 * @addr1: Pointer to a six-byte array containing the Ethernet address
132 * @addr2: Pointer other six-byte array containing the Ethernet address 146 * @addr2: Pointer other six-byte array containing the Ethernet address
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index b4207ca3ad52..991269e5b152 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -386,6 +386,15 @@ struct ethtool_rxnfc {
386 __u32 rule_locs[0]; 386 __u32 rule_locs[0];
387}; 387};
388 388
389struct ethtool_rxfh_indir {
390 __u32 cmd;
391 /* On entry, this is the array size of the user buffer. On
392 * return from ETHTOOL_GRXFHINDIR, this is the array size of
393 * the hardware indirection table. */
394 __u32 size;
395 __u32 ring_index[0]; /* ring/queue index for each hash value */
396};
397
389struct ethtool_rx_ntuple_flow_spec { 398struct ethtool_rx_ntuple_flow_spec {
390 __u32 flow_type; 399 __u32 flow_type;
391 union { 400 union {
@@ -459,7 +468,7 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data);
459u32 ethtool_op_get_ufo(struct net_device *dev); 468u32 ethtool_op_get_ufo(struct net_device *dev);
460int ethtool_op_set_ufo(struct net_device *dev, u32 data); 469int ethtool_op_set_ufo(struct net_device *dev, u32 data);
461u32 ethtool_op_get_flags(struct net_device *dev); 470u32 ethtool_op_get_flags(struct net_device *dev);
462int ethtool_op_set_flags(struct net_device *dev, u32 data); 471int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported);
463void ethtool_ntuple_flush(struct net_device *dev); 472void ethtool_ntuple_flush(struct net_device *dev);
464 473
465/** 474/**
@@ -578,6 +587,10 @@ struct ethtool_ops {
578 int (*set_rx_ntuple)(struct net_device *, 587 int (*set_rx_ntuple)(struct net_device *,
579 struct ethtool_rx_ntuple *); 588 struct ethtool_rx_ntuple *);
580 int (*get_rx_ntuple)(struct net_device *, u32 stringset, void *); 589 int (*get_rx_ntuple)(struct net_device *, u32 stringset, void *);
590 int (*get_rxfh_indir)(struct net_device *,
591 struct ethtool_rxfh_indir *);
592 int (*set_rxfh_indir)(struct net_device *,
593 const struct ethtool_rxfh_indir *);
581}; 594};
582#endif /* __KERNEL__ */ 595#endif /* __KERNEL__ */
583 596
@@ -588,29 +601,29 @@ struct ethtool_ops {
588#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */ 601#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */
589#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */ 602#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */
590#define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */ 603#define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */
591#define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */ 604#define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */
592#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */ 605#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */
593#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */ 606#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */
594#define ETHTOOL_GLINK 0x0000000a /* Get link status (ethtool_value) */ 607#define ETHTOOL_GLINK 0x0000000a /* Get link status (ethtool_value) */
595#define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */ 608#define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */
596#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */ 609#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */
597#define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */ 610#define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */
598#define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */ 611#define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */
599#define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */ 612#define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */
600#define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */ 613#define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */
601#define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */ 614#define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */
602#define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */ 615#define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */
603#define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */ 616#define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */
604#define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */ 617#define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */
605#define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */ 618#define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */
606#define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */ 619#define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */
607#define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable 620#define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable
608 * (ethtool_value) */ 621 * (ethtool_value) */
609#define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable 622#define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable
610 * (ethtool_value). */ 623 * (ethtool_value). */
611#define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */ 624#define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */
612#define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */ 625#define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */
613#define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */ 626#define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */
614#define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */ 627#define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */
615#define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */ 628#define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */
616#define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */ 629#define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */
@@ -621,8 +634,8 @@ struct ethtool_ops {
621#define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */ 634#define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */
622#define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */ 635#define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */
623#define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */ 636#define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */
624#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */ 637#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */
625#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */ 638#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */
626 639
627#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ 640#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */
628#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ 641#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
@@ -639,6 +652,8 @@ struct ethtool_ops {
639#define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */ 652#define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */
640#define ETHTOOL_GRXNTUPLE 0x00000036 /* Get n-tuple filters from device */ 653#define ETHTOOL_GRXNTUPLE 0x00000036 /* Get n-tuple filters from device */
641#define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */ 654#define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */
655#define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */
656#define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */
642 657
643/* compatibility with older code */ 658/* compatibility with older code */
644#define SPARC_ETH_GSET ETHTOOL_GSET 659#define SPARC_ETH_GSET ETHTOOL_GSET
@@ -647,18 +662,18 @@ struct ethtool_ops {
647/* Indicates what features are supported by the interface. */ 662/* Indicates what features are supported by the interface. */
648#define SUPPORTED_10baseT_Half (1 << 0) 663#define SUPPORTED_10baseT_Half (1 << 0)
649#define SUPPORTED_10baseT_Full (1 << 1) 664#define SUPPORTED_10baseT_Full (1 << 1)
650#define SUPPORTED_100baseT_Half (1 << 2) 665#define SUPPORTED_100baseT_Half (1 << 2)
651#define SUPPORTED_100baseT_Full (1 << 3) 666#define SUPPORTED_100baseT_Full (1 << 3)
652#define SUPPORTED_1000baseT_Half (1 << 4) 667#define SUPPORTED_1000baseT_Half (1 << 4)
653#define SUPPORTED_1000baseT_Full (1 << 5) 668#define SUPPORTED_1000baseT_Full (1 << 5)
654#define SUPPORTED_Autoneg (1 << 6) 669#define SUPPORTED_Autoneg (1 << 6)
655#define SUPPORTED_TP (1 << 7) 670#define SUPPORTED_TP (1 << 7)
656#define SUPPORTED_AUI (1 << 8) 671#define SUPPORTED_AUI (1 << 8)
657#define SUPPORTED_MII (1 << 9) 672#define SUPPORTED_MII (1 << 9)
658#define SUPPORTED_FIBRE (1 << 10) 673#define SUPPORTED_FIBRE (1 << 10)
659#define SUPPORTED_BNC (1 << 11) 674#define SUPPORTED_BNC (1 << 11)
660#define SUPPORTED_10000baseT_Full (1 << 12) 675#define SUPPORTED_10000baseT_Full (1 << 12)
661#define SUPPORTED_Pause (1 << 13) 676#define SUPPORTED_Pause (1 << 13)
662#define SUPPORTED_Asym_Pause (1 << 14) 677#define SUPPORTED_Asym_Pause (1 << 14)
663#define SUPPORTED_2500baseX_Full (1 << 15) 678#define SUPPORTED_2500baseX_Full (1 << 15)
664#define SUPPORTED_Backplane (1 << 16) 679#define SUPPORTED_Backplane (1 << 16)
@@ -668,8 +683,8 @@ struct ethtool_ops {
668#define SUPPORTED_10000baseR_FEC (1 << 20) 683#define SUPPORTED_10000baseR_FEC (1 << 20)
669 684
670/* Indicates what features are advertised by the interface. */ 685/* Indicates what features are advertised by the interface. */
671#define ADVERTISED_10baseT_Half (1 << 0) 686#define ADVERTISED_10baseT_Half (1 << 0)
672#define ADVERTISED_10baseT_Full (1 << 1) 687#define ADVERTISED_10baseT_Full (1 << 1)
673#define ADVERTISED_100baseT_Half (1 << 2) 688#define ADVERTISED_100baseT_Half (1 << 2)
674#define ADVERTISED_100baseT_Full (1 << 3) 689#define ADVERTISED_100baseT_Full (1 << 3)
675#define ADVERTISED_1000baseT_Half (1 << 4) 690#define ADVERTISED_1000baseT_Half (1 << 4)
@@ -708,12 +723,12 @@ struct ethtool_ops {
708#define DUPLEX_FULL 0x01 723#define DUPLEX_FULL 0x01
709 724
710/* Which connector port. */ 725/* Which connector port. */
711#define PORT_TP 0x00 726#define PORT_TP 0x00
712#define PORT_AUI 0x01 727#define PORT_AUI 0x01
713#define PORT_MII 0x02 728#define PORT_MII 0x02
714#define PORT_FIBRE 0x03 729#define PORT_FIBRE 0x03
715#define PORT_BNC 0x04 730#define PORT_BNC 0x04
716#define PORT_DA 0x05 731#define PORT_DA 0x05
717#define PORT_NONE 0xef 732#define PORT_NONE 0xef
718#define PORT_OTHER 0xff 733#define PORT_OTHER 0xff
719 734
@@ -727,7 +742,7 @@ struct ethtool_ops {
727/* Enable or disable autonegotiation. If this is set to enable, 742/* Enable or disable autonegotiation. If this is set to enable,
728 * the forced link modes above are completely ignored. 743 * the forced link modes above are completely ignored.
729 */ 744 */
730#define AUTONEG_DISABLE 0x00 745#define AUTONEG_DISABLE 0x00
731#define AUTONEG_ENABLE 0x01 746#define AUTONEG_ENABLE 0x01
732 747
733/* Mode MDI or MDI-X */ 748/* Mode MDI or MDI-X */
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 7fc62d4550b2..6ce1bca01724 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -400,7 +400,6 @@ struct ext3_inode {
400#define EXT3_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */ 400#define EXT3_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */
401#define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */ 401#define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */
402#define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */ 402#define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */
403#define EXT3_MOUNT_NOBH 0x40000 /* No bufferheads */
404#define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */ 403#define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */
405#define EXT3_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ 404#define EXT3_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
406#define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ 405#define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
@@ -896,7 +895,7 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
896extern struct inode *ext3_iget(struct super_block *, unsigned long); 895extern struct inode *ext3_iget(struct super_block *, unsigned long);
897extern int ext3_write_inode (struct inode *, struct writeback_control *); 896extern int ext3_write_inode (struct inode *, struct writeback_control *);
898extern int ext3_setattr (struct dentry *, struct iattr *); 897extern int ext3_setattr (struct dentry *, struct iattr *);
899extern void ext3_delete_inode (struct inode *); 898extern void ext3_evict_inode (struct inode *);
900extern int ext3_sync_inode (handle_t *, struct inode *); 899extern int ext3_sync_inode (handle_t *, struct inode *);
901extern void ext3_discard_reservation (struct inode *); 900extern void ext3_discard_reservation (struct inode *);
902extern void ext3_dirty_inode(struct inode *); 901extern void ext3_dirty_inode(struct inode *);
diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h
new file mode 100644
index 000000000000..f0949a57ca9d
--- /dev/null
+++ b/include/linux/fanotify.h
@@ -0,0 +1,105 @@
1#ifndef _LINUX_FANOTIFY_H
2#define _LINUX_FANOTIFY_H
3
4#include <linux/types.h>
5
6/* the following events that user-space can register for */
7#define FAN_ACCESS 0x00000001 /* File was accessed */
8#define FAN_MODIFY 0x00000002 /* File was modified */
9#define FAN_CLOSE_WRITE 0x00000008 /* Unwrittable file closed */
10#define FAN_CLOSE_NOWRITE 0x00000010 /* Writtable file closed */
11#define FAN_OPEN 0x00000020 /* File was opened */
12
13#define FAN_EVENT_ON_CHILD 0x08000000 /* interested in child events */
14
15/* FIXME currently Q's have no limit.... */
16#define FAN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
17
18#define FAN_OPEN_PERM 0x00010000 /* File open in perm check */
19#define FAN_ACCESS_PERM 0x00020000 /* File accessed in perm check */
20
21/* helper events */
22#define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE) /* close */
23
24/* flags used for fanotify_init() */
25#define FAN_CLOEXEC 0x00000001
26#define FAN_NONBLOCK 0x00000002
27
28#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK)
29
30/* flags used for fanotify_modify_mark() */
31#define FAN_MARK_ADD 0x00000001
32#define FAN_MARK_REMOVE 0x00000002
33#define FAN_MARK_DONT_FOLLOW 0x00000004
34#define FAN_MARK_ONLYDIR 0x00000008
35#define FAN_MARK_MOUNT 0x00000010
36#define FAN_MARK_IGNORED_MASK 0x00000020
37#define FAN_MARK_IGNORED_SURV_MODIFY 0x00000040
38#define FAN_MARK_FLUSH 0x00000080
39
40#define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD |\
41 FAN_MARK_REMOVE |\
42 FAN_MARK_DONT_FOLLOW |\
43 FAN_MARK_ONLYDIR |\
44 FAN_MARK_MOUNT |\
45 FAN_MARK_IGNORED_MASK |\
46 FAN_MARK_IGNORED_SURV_MODIFY)
47
48/*
49 * All of the events - we build the list by hand so that we can add flags in
50 * the future and not break backward compatibility. Apps will get only the
51 * events that they originally wanted. Be sure to add new events here!
52 */
53#define FAN_ALL_EVENTS (FAN_ACCESS |\
54 FAN_MODIFY |\
55 FAN_CLOSE |\
56 FAN_OPEN)
57
58/*
59 * All events which require a permission response from userspace
60 */
61#define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM |\
62 FAN_ACCESS_PERM)
63
64#define FAN_ALL_OUTGOING_EVENTS (FAN_ALL_EVENTS |\
65 FAN_ALL_PERM_EVENTS |\
66 FAN_Q_OVERFLOW)
67
68#define FANOTIFY_METADATA_VERSION 1
69
70struct fanotify_event_metadata {
71 __u32 event_len;
72 __u32 vers;
73 __s32 fd;
74 __u64 mask;
75 __s64 pid;
76} __attribute__ ((packed));
77
78struct fanotify_response {
79 __s32 fd;
80 __u32 response;
81} __attribute__ ((packed));
82
83/* Legit userspace responses to a _PERM event */
84#define FAN_ALLOW 0x01
85#define FAN_DENY 0x02
86
87/* Helper functions to deal with fanotify_event_metadata buffers */
88#define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata))
89
90#define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, \
91 (struct fanotify_event_metadata*)(((char *)(meta)) + \
92 (meta)->event_len))
93
94#define FAN_EVENT_OK(meta, len) ((long)(len) >= (long)FAN_EVENT_METADATA_LEN && \
95 (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && \
96 (long)(meta)->event_len <= (long)(len))
97
98#ifdef __KERNEL__
99
100struct fanotify_wait {
101 struct fsnotify_event *event;
102 __s32 fd;
103};
104#endif /* __KERNEL__ */
105#endif /* _LINUX_FANOTIFY_H */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index e7445df44d6c..f0268deca658 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -3,6 +3,9 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/i2c.h> 5#include <linux/i2c.h>
6#ifdef __KERNEL__
7#include <linux/kgdb.h>
8#endif /* __KERNEL__ */
6 9
7/* Definitions of frame buffers */ 10/* Definitions of frame buffers */
8 11
@@ -607,6 +610,12 @@ struct fb_deferred_io {
607 * LOCKING NOTE: those functions must _ALL_ be called with the console 610 * LOCKING NOTE: those functions must _ALL_ be called with the console
608 * semaphore held, this is the only suitable locking mechanism we have 611 * semaphore held, this is the only suitable locking mechanism we have
609 * in 2.6. Some may be called at interrupt time at this point though. 612 * in 2.6. Some may be called at interrupt time at this point though.
613 *
614 * The exception to this is the debug related hooks. Putting the fb
615 * into a debug state (e.g. flipping to the kernel console) and restoring
616 * it must be done in a lock-free manner, so low level drivers should
617 * keep track of the initial console (if applicable) and may need to
618 * perform direct, unlocked hardware writes in these hooks.
610 */ 619 */
611 620
612struct fb_ops { 621struct fb_ops {
@@ -676,6 +685,10 @@ struct fb_ops {
676 685
677 /* teardown any resources to do with this framebuffer */ 686 /* teardown any resources to do with this framebuffer */
678 void (*fb_destroy)(struct fb_info *info); 687 void (*fb_destroy)(struct fb_info *info);
688
689 /* called at KDB enter and leave time to prepare the console */
690 int (*fb_debug_enter)(struct fb_info *info);
691 int (*fb_debug_leave)(struct fb_info *info);
679}; 692};
680 693
681#ifdef CONFIG_FB_TILEBLITTING 694#ifdef CONFIG_FB_TILEBLITTING
@@ -812,6 +825,10 @@ struct fb_tile_ops {
812 */ 825 */
813#define FBINFO_BE_MATH 0x100000 826#define FBINFO_BE_MATH 0x100000
814 827
828/* report to the VT layer that this fb driver can accept forced console
829 output like oopses */
830#define FBINFO_CAN_FORCE_OUTPUT 0x200000
831
815struct fb_info { 832struct fb_info {
816 int node; 833 int node;
817 int flags; 834 int flags;
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index d147461bc271..f59ed297b661 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -11,6 +11,7 @@
11#include <linux/rcupdate.h> 11#include <linux/rcupdate.h>
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/fs.h>
14 15
15#include <asm/atomic.h> 16#include <asm/atomic.h>
16 17
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 151f5d703b7e..69b43dbea6c6 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -91,6 +91,54 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
91#define BPF_TAX 0x00 91#define BPF_TAX 0x00
92#define BPF_TXA 0x80 92#define BPF_TXA 0x80
93 93
94enum {
95 BPF_S_RET_K = 0,
96 BPF_S_RET_A,
97 BPF_S_ALU_ADD_K,
98 BPF_S_ALU_ADD_X,
99 BPF_S_ALU_SUB_K,
100 BPF_S_ALU_SUB_X,
101 BPF_S_ALU_MUL_K,
102 BPF_S_ALU_MUL_X,
103 BPF_S_ALU_DIV_X,
104 BPF_S_ALU_AND_K,
105 BPF_S_ALU_AND_X,
106 BPF_S_ALU_OR_K,
107 BPF_S_ALU_OR_X,
108 BPF_S_ALU_LSH_K,
109 BPF_S_ALU_LSH_X,
110 BPF_S_ALU_RSH_K,
111 BPF_S_ALU_RSH_X,
112 BPF_S_ALU_NEG,
113 BPF_S_LD_W_ABS,
114 BPF_S_LD_H_ABS,
115 BPF_S_LD_B_ABS,
116 BPF_S_LD_W_LEN,
117 BPF_S_LD_W_IND,
118 BPF_S_LD_H_IND,
119 BPF_S_LD_B_IND,
120 BPF_S_LD_IMM,
121 BPF_S_LDX_W_LEN,
122 BPF_S_LDX_B_MSH,
123 BPF_S_LDX_IMM,
124 BPF_S_MISC_TAX,
125 BPF_S_MISC_TXA,
126 BPF_S_ALU_DIV_K,
127 BPF_S_LD_MEM,
128 BPF_S_LDX_MEM,
129 BPF_S_ST,
130 BPF_S_STX,
131 BPF_S_JMP_JA,
132 BPF_S_JMP_JEQ_K,
133 BPF_S_JMP_JEQ_X,
134 BPF_S_JMP_JGE_K,
135 BPF_S_JMP_JGE_X,
136 BPF_S_JMP_JGT_K,
137 BPF_S_JMP_JGT_X,
138 BPF_S_JMP_JSET_K,
139 BPF_S_JMP_JSET_X,
140};
141
94#ifndef BPF_MAXINSNS 142#ifndef BPF_MAXINSNS
95#define BPF_MAXINSNS 4096 143#define BPF_MAXINSNS 4096
96#endif 144#endif
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h
index 68f883b30a53..68c642d8843d 100644
--- a/include/linux/firewire-cdev.h
+++ b/include/linux/firewire-cdev.h
@@ -30,12 +30,18 @@
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/firewire-constants.h> 31#include <linux/firewire-constants.h>
32 32
33#define FW_CDEV_EVENT_BUS_RESET 0x00 33#define FW_CDEV_EVENT_BUS_RESET 0x00
34#define FW_CDEV_EVENT_RESPONSE 0x01 34#define FW_CDEV_EVENT_RESPONSE 0x01
35#define FW_CDEV_EVENT_REQUEST 0x02 35#define FW_CDEV_EVENT_REQUEST 0x02
36#define FW_CDEV_EVENT_ISO_INTERRUPT 0x03 36#define FW_CDEV_EVENT_ISO_INTERRUPT 0x03
37#define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED 0x04 37#define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED 0x04
38#define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 0x05 38#define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 0x05
39
40/* available since kernel version 2.6.36 */
41#define FW_CDEV_EVENT_REQUEST2 0x06
42#define FW_CDEV_EVENT_PHY_PACKET_SENT 0x07
43#define FW_CDEV_EVENT_PHY_PACKET_RECEIVED 0x08
44#define FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL 0x09
39 45
40/** 46/**
41 * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types 47 * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types
@@ -68,6 +74,10 @@ struct fw_cdev_event_common {
68 * This event is sent when the bus the device belongs to goes through a bus 74 * This event is sent when the bus the device belongs to goes through a bus
69 * reset. It provides information about the new bus configuration, such as 75 * reset. It provides information about the new bus configuration, such as
70 * new node ID for this device, new root ID, and others. 76 * new node ID for this device, new root ID, and others.
77 *
78 * If @bm_node_id is 0xffff right after bus reset it can be reread by an
79 * %FW_CDEV_IOC_GET_INFO ioctl after bus manager selection was finished.
80 * Kernels with ABI version < 4 do not set @bm_node_id.
71 */ 81 */
72struct fw_cdev_event_bus_reset { 82struct fw_cdev_event_bus_reset {
73 __u64 closure; 83 __u64 closure;
@@ -82,8 +92,9 @@ struct fw_cdev_event_bus_reset {
82 92
83/** 93/**
84 * struct fw_cdev_event_response - Sent when a response packet was received 94 * struct fw_cdev_event_response - Sent when a response packet was received
85 * @closure: See &fw_cdev_event_common; 95 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_REQUEST
86 * set by %FW_CDEV_IOC_SEND_REQUEST ioctl 96 * or %FW_CDEV_IOC_SEND_BROADCAST_REQUEST
97 * or %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl
87 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_RESPONSE 98 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_RESPONSE
88 * @rcode: Response code returned by the remote node 99 * @rcode: Response code returned by the remote node
89 * @length: Data length, i.e. the response's payload size in bytes 100 * @length: Data length, i.e. the response's payload size in bytes
@@ -93,6 +104,11 @@ struct fw_cdev_event_bus_reset {
93 * sent by %FW_CDEV_IOC_SEND_REQUEST ioctl. The payload data for responses 104 * sent by %FW_CDEV_IOC_SEND_REQUEST ioctl. The payload data for responses
94 * carrying data (read and lock responses) follows immediately and can be 105 * carrying data (read and lock responses) follows immediately and can be
95 * accessed through the @data field. 106 * accessed through the @data field.
107 *
108 * The event is also generated after conclusions of transactions that do not
109 * involve response packets. This includes unified write transactions,
110 * broadcast write transactions, and transmission of asynchronous stream
111 * packets. @rcode indicates success or failure of such transmissions.
96 */ 112 */
97struct fw_cdev_event_response { 113struct fw_cdev_event_response {
98 __u64 closure; 114 __u64 closure;
@@ -103,11 +119,46 @@ struct fw_cdev_event_response {
103}; 119};
104 120
105/** 121/**
106 * struct fw_cdev_event_request - Sent on incoming request to an address region 122 * struct fw_cdev_event_request - Old version of &fw_cdev_event_request2
107 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl 123 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl
108 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST 124 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST
125 * @tcode: See &fw_cdev_event_request2
126 * @offset: See &fw_cdev_event_request2
127 * @handle: See &fw_cdev_event_request2
128 * @length: See &fw_cdev_event_request2
129 * @data: See &fw_cdev_event_request2
130 *
131 * This event is sent instead of &fw_cdev_event_request2 if the kernel or
132 * the client implements ABI version <= 3.
133 *
134 * Unlike &fw_cdev_event_request2, the sender identity cannot be established,
135 * broadcast write requests cannot be distinguished from unicast writes, and
136 * @tcode of lock requests is %TCODE_LOCK_REQUEST.
137 *
138 * Requests to the FCP_REQUEST or FCP_RESPONSE register are responded to as
139 * with &fw_cdev_event_request2, except in kernel 2.6.32 and older which send
140 * the response packet of the client's %FW_CDEV_IOC_SEND_RESPONSE ioctl.
141 */
142struct fw_cdev_event_request {
143 __u64 closure;
144 __u32 type;
145 __u32 tcode;
146 __u64 offset;
147 __u32 handle;
148 __u32 length;
149 __u32 data[0];
150};
151
152/**
153 * struct fw_cdev_event_request2 - Sent on incoming request to an address region
154 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl
155 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST2
109 * @tcode: Transaction code of the incoming request 156 * @tcode: Transaction code of the incoming request
110 * @offset: The offset into the 48-bit per-node address space 157 * @offset: The offset into the 48-bit per-node address space
158 * @source_node_id: Sender node ID
159 * @destination_node_id: Destination node ID
160 * @card: The index of the card from which the request came
161 * @generation: Bus generation in which the request is valid
111 * @handle: Reference to the kernel-side pending request 162 * @handle: Reference to the kernel-side pending request
112 * @length: Data length, i.e. the request's payload size in bytes 163 * @length: Data length, i.e. the request's payload size in bytes
113 * @data: Incoming data, if any 164 * @data: Incoming data, if any
@@ -120,12 +171,42 @@ struct fw_cdev_event_response {
120 * 171 *
121 * The payload data for requests carrying data (write and lock requests) 172 * The payload data for requests carrying data (write and lock requests)
122 * follows immediately and can be accessed through the @data field. 173 * follows immediately and can be accessed through the @data field.
174 *
175 * Unlike &fw_cdev_event_request, @tcode of lock requests is one of the
176 * firewire-core specific %TCODE_LOCK_MASK_SWAP...%TCODE_LOCK_VENDOR_DEPENDENT,
177 * i.e. encodes the extended transaction code.
178 *
179 * @card may differ from &fw_cdev_get_info.card because requests are received
180 * from all cards of the Linux host. @source_node_id, @destination_node_id, and
181 * @generation pertain to that card. Destination node ID and bus generation may
182 * therefore differ from the corresponding fields of the last
183 * &fw_cdev_event_bus_reset.
184 *
185 * @destination_node_id may also differ from the current node ID because of a
186 * non-local bus ID part or in case of a broadcast write request. Note, a
187 * client must call an %FW_CDEV_IOC_SEND_RESPONSE ioctl even in case of a
188 * broadcast write request; the kernel will then release the kernel-side pending
189 * request but will not actually send a response packet.
190 *
191 * In case of a write request to FCP_REQUEST or FCP_RESPONSE, the kernel already
192 * sent a write response immediately after the request was received; in this
193 * case the client must still call an %FW_CDEV_IOC_SEND_RESPONSE ioctl to
194 * release the kernel-side pending request, though another response won't be
195 * sent.
196 *
197 * If the client subsequently needs to initiate requests to the sender node of
198 * an &fw_cdev_event_request2, it needs to use a device file with matching
199 * card index, node ID, and generation for outbound requests.
123 */ 200 */
124struct fw_cdev_event_request { 201struct fw_cdev_event_request2 {
125 __u64 closure; 202 __u64 closure;
126 __u32 type; 203 __u32 type;
127 __u32 tcode; 204 __u32 tcode;
128 __u64 offset; 205 __u64 offset;
206 __u32 source_node_id;
207 __u32 destination_node_id;
208 __u32 card;
209 __u32 generation;
129 __u32 handle; 210 __u32 handle;
130 __u32 length; 211 __u32 length;
131 __u32 data[0]; 212 __u32 data[0];
@@ -141,26 +222,43 @@ struct fw_cdev_event_request {
141 * @header: Stripped headers, if any 222 * @header: Stripped headers, if any
142 * 223 *
143 * This event is sent when the controller has completed an &fw_cdev_iso_packet 224 * This event is sent when the controller has completed an &fw_cdev_iso_packet
144 * with the %FW_CDEV_ISO_INTERRUPT bit set. In the receive case, the headers 225 * with the %FW_CDEV_ISO_INTERRUPT bit set.
145 * stripped of all packets up until and including the interrupt packet are
146 * returned in the @header field. The amount of header data per packet is as
147 * specified at iso context creation by &fw_cdev_create_iso_context.header_size.
148 * 226 *
149 * In version 1 of this ABI, header data consisted of the 1394 isochronous 227 * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT):
150 * packet header, followed by quadlets from the packet payload if
151 * &fw_cdev_create_iso_context.header_size > 4.
152 * 228 *
153 * In version 2 of this ABI, header data consist of the 1394 isochronous 229 * In version 3 and some implementations of version 2 of the ABI, &header_length
154 * packet header, followed by a timestamp quadlet if 230 * is a multiple of 4 and &header contains timestamps of all packets up until
155 * &fw_cdev_create_iso_context.header_size > 4, followed by quadlets from the 231 * the interrupt packet. The format of the timestamps is as described below for
156 * packet payload if &fw_cdev_create_iso_context.header_size > 8. 232 * isochronous reception. In version 1 of the ABI, &header_length was 0.
157 * 233 *
158 * Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2. 234 * Isochronous receive events (context type %FW_CDEV_ISO_CONTEXT_RECEIVE):
235 *
236 * The headers stripped of all packets up until and including the interrupt
237 * packet are returned in the @header field. The amount of header data per
238 * packet is as specified at iso context creation by
239 * &fw_cdev_create_iso_context.header_size.
240 *
241 * Hence, _interrupt.header_length / _context.header_size is the number of
242 * packets received in this interrupt event. The client can now iterate
243 * through the mmap()'ed DMA buffer according to this number of packets and
244 * to the buffer sizes as the client specified in &fw_cdev_queue_iso.
245 *
246 * Since version 2 of this ABI, the portion for each packet in _interrupt.header
247 * consists of the 1394 isochronous packet header, followed by a timestamp
248 * quadlet if &fw_cdev_create_iso_context.header_size > 4, followed by quadlets
249 * from the packet payload if &fw_cdev_create_iso_context.header_size > 8.
159 * 250 *
160 * Format of 1394 iso packet header: 16 bits len, 2 bits tag, 6 bits channel, 251 * Format of 1394 iso packet header: 16 bits data_length, 2 bits tag, 6 bits
161 * 4 bits tcode, 4 bits sy, in big endian byte order. Format of timestamp: 252 * channel, 4 bits tcode, 4 bits sy, in big endian byte order.
162 * 16 bits invalid, 3 bits cycleSeconds, 13 bits cycleCount, in big endian byte 253 * data_length is the actual received size of the packet without the four
163 * order. 254 * 1394 iso packet header bytes.
255 *
256 * Format of timestamp: 16 bits invalid, 3 bits cycleSeconds, 13 bits
257 * cycleCount, in big endian byte order.
258 *
259 * In version 1 of the ABI, no timestamp quadlet was inserted; instead, payload
260 * data followed directly after the 1394 is header if header_size > 4.
261 * Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2.
164 */ 262 */
165struct fw_cdev_event_iso_interrupt { 263struct fw_cdev_event_iso_interrupt {
166 __u64 closure; 264 __u64 closure;
@@ -171,6 +269,43 @@ struct fw_cdev_event_iso_interrupt {
171}; 269};
172 270
173/** 271/**
272 * struct fw_cdev_event_iso_interrupt_mc - An iso buffer chunk was completed
273 * @closure: See &fw_cdev_event_common;
274 * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl
275 * @type: %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL
276 * @completed: Offset into the receive buffer; data before this offest is valid
277 *
278 * This event is sent in multichannel contexts (context type
279 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer
280 * chunks that have the %FW_CDEV_ISO_INTERRUPT bit set. Whether this happens
281 * when a packet is completed and/or when a buffer chunk is completed depends
282 * on the hardware implementation.
283 *
284 * The buffer is continuously filled with the following data, per packet:
285 * - the 1394 iso packet header as described at &fw_cdev_event_iso_interrupt,
286 * but in little endian byte order,
287 * - packet payload (as many bytes as specified in the data_length field of
288 * the 1394 iso packet header) in big endian byte order,
289 * - 0...3 padding bytes as needed to align the following trailer quadlet,
290 * - trailer quadlet, containing the reception timestamp as described at
291 * &fw_cdev_event_iso_interrupt, but in little endian byte order.
292 *
293 * Hence the per-packet size is data_length (rounded up to a multiple of 4) + 8.
294 * When processing the data, stop before a packet that would cross the
295 * @completed offset.
296 *
297 * A packet near the end of a buffer chunk will typically spill over into the
298 * next queued buffer chunk. It is the responsibility of the client to check
299 * for this condition, assemble a broken-up packet from its parts, and not to
300 * re-queue any buffer chunks in which as yet unread packet parts reside.
301 */
302struct fw_cdev_event_iso_interrupt_mc {
303 __u64 closure;
304 __u32 type;
305 __u32 completed;
306};
307
308/**
174 * struct fw_cdev_event_iso_resource - Iso resources were allocated or freed 309 * struct fw_cdev_event_iso_resource - Iso resources were allocated or freed
175 * @closure: See &fw_cdev_event_common; 310 * @closure: See &fw_cdev_event_common;
176 * set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl 311 * set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl
@@ -200,15 +335,45 @@ struct fw_cdev_event_iso_resource {
200}; 335};
201 336
202/** 337/**
338 * struct fw_cdev_event_phy_packet - A PHY packet was transmitted or received
339 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_PHY_PACKET
340 * or %FW_CDEV_IOC_RECEIVE_PHY_PACKETS ioctl
341 * @type: %FW_CDEV_EVENT_PHY_PACKET_SENT or %..._RECEIVED
342 * @rcode: %RCODE_..., indicates success or failure of transmission
343 * @length: Data length in bytes
344 * @data: Incoming data
345 *
346 * If @type is %FW_CDEV_EVENT_PHY_PACKET_SENT, @length is 0 and @data empty,
347 * except in case of a ping packet: Then, @length is 4, and @data[0] is the
348 * ping time in 49.152MHz clocks if @rcode is %RCODE_COMPLETE.
349 *
350 * If @type is %FW_CDEV_EVENT_PHY_PACKET_RECEIVED, @length is 8 and @data
351 * consists of the two PHY packet quadlets, in host byte order.
352 */
353struct fw_cdev_event_phy_packet {
354 __u64 closure;
355 __u32 type;
356 __u32 rcode;
357 __u32 length;
358 __u32 data[0];
359};
360
361/**
203 * union fw_cdev_event - Convenience union of fw_cdev_event_ types 362 * union fw_cdev_event - Convenience union of fw_cdev_event_ types
204 * @common: Valid for all types 363 * @common: Valid for all types
205 * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET 364 * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET
206 * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE 365 * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE
207 * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST 366 * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST
208 * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT 367 * @request2: Valid if @common.type == %FW_CDEV_EVENT_REQUEST2
209 * @iso_resource: Valid if @common.type == 368 * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT
369 * @iso_interrupt_mc: Valid if @common.type ==
370 * %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL
371 * @iso_resource: Valid if @common.type ==
210 * %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or 372 * %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
211 * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 373 * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
374 * @phy_packet: Valid if @common.type ==
375 * %FW_CDEV_EVENT_PHY_PACKET_SENT or
376 * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED
212 * 377 *
213 * Convenience union for userspace use. Events could be read(2) into an 378 * Convenience union for userspace use. Events could be read(2) into an
214 * appropriately aligned char buffer and then cast to this union for further 379 * appropriately aligned char buffer and then cast to this union for further
@@ -223,8 +388,11 @@ union fw_cdev_event {
223 struct fw_cdev_event_bus_reset bus_reset; 388 struct fw_cdev_event_bus_reset bus_reset;
224 struct fw_cdev_event_response response; 389 struct fw_cdev_event_response response;
225 struct fw_cdev_event_request request; 390 struct fw_cdev_event_request request;
391 struct fw_cdev_event_request2 request2; /* added in 2.6.36 */
226 struct fw_cdev_event_iso_interrupt iso_interrupt; 392 struct fw_cdev_event_iso_interrupt iso_interrupt;
227 struct fw_cdev_event_iso_resource iso_resource; 393 struct fw_cdev_event_iso_interrupt_mc iso_interrupt_mc; /* added in 2.6.36 */
394 struct fw_cdev_event_iso_resource iso_resource; /* added in 2.6.30 */
395 struct fw_cdev_event_phy_packet phy_packet; /* added in 2.6.36 */
228}; 396};
229 397
230/* available since kernel version 2.6.22 */ 398/* available since kernel version 2.6.22 */
@@ -256,23 +424,46 @@ union fw_cdev_event {
256/* available since kernel version 2.6.34 */ 424/* available since kernel version 2.6.34 */
257#define FW_CDEV_IOC_GET_CYCLE_TIMER2 _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2) 425#define FW_CDEV_IOC_GET_CYCLE_TIMER2 _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2)
258 426
427/* available since kernel version 2.6.36 */
428#define FW_CDEV_IOC_SEND_PHY_PACKET _IOWR('#', 0x15, struct fw_cdev_send_phy_packet)
429#define FW_CDEV_IOC_RECEIVE_PHY_PACKETS _IOW('#', 0x16, struct fw_cdev_receive_phy_packets)
430#define FW_CDEV_IOC_SET_ISO_CHANNELS _IOW('#', 0x17, struct fw_cdev_set_iso_channels)
431
259/* 432/*
260 * FW_CDEV_VERSION History 433 * ABI version history
261 * 1 (2.6.22) - initial version 434 * 1 (2.6.22) - initial version
435 * (2.6.24) - added %FW_CDEV_IOC_GET_CYCLE_TIMER
262 * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if 436 * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if
263 * &fw_cdev_create_iso_context.header_size is 8 or more 437 * &fw_cdev_create_iso_context.header_size is 8 or more
438 * - added %FW_CDEV_IOC_*_ISO_RESOURCE*,
439 * %FW_CDEV_IOC_GET_SPEED, %FW_CDEV_IOC_SEND_BROADCAST_REQUEST,
440 * %FW_CDEV_IOC_SEND_STREAM_PACKET
264 * (2.6.32) - added time stamp to xmit &fw_cdev_event_iso_interrupt 441 * (2.6.32) - added time stamp to xmit &fw_cdev_event_iso_interrupt
265 * (2.6.33) - IR has always packet-per-buffer semantics now, not one of 442 * (2.6.33) - IR has always packet-per-buffer semantics now, not one of
266 * dual-buffer or packet-per-buffer depending on hardware 443 * dual-buffer or packet-per-buffer depending on hardware
444 * - shared use and auto-response for FCP registers
267 * 3 (2.6.34) - made &fw_cdev_get_cycle_timer reliable 445 * 3 (2.6.34) - made &fw_cdev_get_cycle_timer reliable
446 * - added %FW_CDEV_IOC_GET_CYCLE_TIMER2
447 * 4 (2.6.36) - added %FW_CDEV_EVENT_REQUEST2, %FW_CDEV_EVENT_PHY_PACKET_*,
448 * and &fw_cdev_allocate.region_end
449 * - implemented &fw_cdev_event_bus_reset.bm_node_id
450 * - added %FW_CDEV_IOC_SEND_PHY_PACKET, _RECEIVE_PHY_PACKETS
451 * - added %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL,
452 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and
453 * %FW_CDEV_IOC_SET_ISO_CHANNELS
268 */ 454 */
269#define FW_CDEV_VERSION 3 455#define FW_CDEV_VERSION 3 /* Meaningless; don't use this macro. */
270 456
271/** 457/**
272 * struct fw_cdev_get_info - General purpose information ioctl 458 * struct fw_cdev_get_info - General purpose information ioctl
273 * @version: The version field is just a running serial number. 459 * @version: The version field is just a running serial number. Both an
274 * We never break backwards compatibility, but may add more 460 * input parameter (ABI version implemented by the client) and
275 * structs and ioctls in later revisions. 461 * output parameter (ABI version implemented by the kernel).
462 * A client must not fill in an %FW_CDEV_VERSION defined from an
463 * included kernel header file but the actual version for which
464 * the client was implemented. This is necessary for forward
465 * compatibility. We never break backwards compatibility, but
466 * may add more structs, events, and ioctls in later revisions.
276 * @rom_length: If @rom is non-zero, at most rom_length bytes of configuration 467 * @rom_length: If @rom is non-zero, at most rom_length bytes of configuration
277 * ROM will be copied into that user space address. In either 468 * ROM will be copied into that user space address. In either
278 * case, @rom_length is updated with the actual length of the 469 * case, @rom_length is updated with the actual length of the
@@ -339,28 +530,48 @@ struct fw_cdev_send_response {
339}; 530};
340 531
341/** 532/**
342 * struct fw_cdev_allocate - Allocate a CSR address range 533 * struct fw_cdev_allocate - Allocate a CSR in an address range
343 * @offset: Start offset of the address range 534 * @offset: Start offset of the address range
344 * @closure: To be passed back to userspace in request events 535 * @closure: To be passed back to userspace in request events
345 * @length: Length of the address range, in bytes 536 * @length: Length of the CSR, in bytes
346 * @handle: Handle to the allocation, written by the kernel 537 * @handle: Handle to the allocation, written by the kernel
538 * @region_end: First address above the address range (added in ABI v4, 2.6.36)
347 * 539 *
348 * Allocate an address range in the 48-bit address space on the local node 540 * Allocate an address range in the 48-bit address space on the local node
349 * (the controller). This allows userspace to listen for requests with an 541 * (the controller). This allows userspace to listen for requests with an
350 * offset within that address range. When the kernel receives a request 542 * offset within that address range. Every time when the kernel receives a
351 * within the range, an &fw_cdev_event_request event will be written back. 543 * request within the range, an &fw_cdev_event_request2 event will be emitted.
352 * The @closure field is passed back to userspace in the response event. 544 * (If the kernel or the client implements ABI version <= 3, an
545 * &fw_cdev_event_request will be generated instead.)
546 *
547 * The @closure field is passed back to userspace in these request events.
353 * The @handle field is an out parameter, returning a handle to the allocated 548 * The @handle field is an out parameter, returning a handle to the allocated
354 * range to be used for later deallocation of the range. 549 * range to be used for later deallocation of the range.
355 * 550 *
356 * The address range is allocated on all local nodes. The address allocation 551 * The address range is allocated on all local nodes. The address allocation
357 * is exclusive except for the FCP command and response registers. 552 * is exclusive except for the FCP command and response registers. If an
553 * exclusive address region is already in use, the ioctl fails with errno set
554 * to %EBUSY.
555 *
556 * If kernel and client implement ABI version >= 4, the kernel looks up a free
557 * spot of size @length inside [@offset..@region_end) and, if found, writes
558 * the start address of the new CSR back in @offset. I.e. @offset is an
559 * in and out parameter. If this automatic placement of a CSR in a bigger
560 * address range is not desired, the client simply needs to set @region_end
561 * = @offset + @length.
562 *
563 * If the kernel or the client implements ABI version <= 3, @region_end is
564 * ignored and effectively assumed to be @offset + @length.
565 *
566 * @region_end is only present in a kernel header >= 2.6.36. If necessary,
567 * this can for example be tested by #ifdef FW_CDEV_EVENT_REQUEST2.
358 */ 568 */
359struct fw_cdev_allocate { 569struct fw_cdev_allocate {
360 __u64 offset; 570 __u64 offset;
361 __u64 closure; 571 __u64 closure;
362 __u32 length; 572 __u32 length;
363 __u32 handle; 573 __u32 handle;
574 __u64 region_end; /* available since kernel version 2.6.36 */
364}; 575};
365 576
366/** 577/**
@@ -382,9 +593,14 @@ struct fw_cdev_deallocate {
382 * Initiate a bus reset for the bus this device is on. The bus reset can be 593 * Initiate a bus reset for the bus this device is on. The bus reset can be
383 * either the original (long) bus reset or the arbitrated (short) bus reset 594 * either the original (long) bus reset or the arbitrated (short) bus reset
384 * introduced in 1394a-2000. 595 * introduced in 1394a-2000.
596 *
597 * The ioctl returns immediately. A subsequent &fw_cdev_event_bus_reset
598 * indicates when the reset actually happened. Since ABI v4, this may be
599 * considerably later than the ioctl because the kernel ensures a grace period
600 * between subsequent bus resets as per IEEE 1394 bus management specification.
385 */ 601 */
386struct fw_cdev_initiate_bus_reset { 602struct fw_cdev_initiate_bus_reset {
387 __u32 type; /* FW_CDEV_SHORT_RESET or FW_CDEV_LONG_RESET */ 603 __u32 type;
388}; 604};
389 605
390/** 606/**
@@ -408,9 +624,10 @@ struct fw_cdev_initiate_bus_reset {
408 * 624 *
409 * @immediate, @key, and @data array elements are CPU-endian quadlets. 625 * @immediate, @key, and @data array elements are CPU-endian quadlets.
410 * 626 *
411 * If successful, the kernel adds the descriptor and writes back a handle to the 627 * If successful, the kernel adds the descriptor and writes back a @handle to
412 * kernel-side object to be used for later removal of the descriptor block and 628 * the kernel-side object to be used for later removal of the descriptor block
413 * immediate key. 629 * and immediate key. The kernel will also generate a bus reset to signal the
630 * change of the configuration ROM to other nodes.
414 * 631 *
415 * This ioctl affects the configuration ROMs of all local nodes. 632 * This ioctl affects the configuration ROMs of all local nodes.
416 * The ioctl only succeeds on device files which represent a local node. 633 * The ioctl only succeeds on device files which represent a local node.
@@ -429,38 +646,50 @@ struct fw_cdev_add_descriptor {
429 * descriptor was added 646 * descriptor was added
430 * 647 *
431 * Remove a descriptor block and accompanying immediate key from the local 648 * Remove a descriptor block and accompanying immediate key from the local
432 * nodes' configuration ROMs. 649 * nodes' configuration ROMs. The kernel will also generate a bus reset to
650 * signal the change of the configuration ROM to other nodes.
433 */ 651 */
434struct fw_cdev_remove_descriptor { 652struct fw_cdev_remove_descriptor {
435 __u32 handle; 653 __u32 handle;
436}; 654};
437 655
438#define FW_CDEV_ISO_CONTEXT_TRANSMIT 0 656#define FW_CDEV_ISO_CONTEXT_TRANSMIT 0
439#define FW_CDEV_ISO_CONTEXT_RECEIVE 1 657#define FW_CDEV_ISO_CONTEXT_RECEIVE 1
658#define FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL 2 /* added in 2.6.36 */
440 659
441/** 660/**
442 * struct fw_cdev_create_iso_context - Create a context for isochronous IO 661 * struct fw_cdev_create_iso_context - Create a context for isochronous I/O
443 * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE 662 * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE or
444 * @header_size: Header size to strip for receive contexts 663 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL
445 * @channel: Channel to bind to 664 * @header_size: Header size to strip in single-channel reception
446 * @speed: Speed for transmit contexts 665 * @channel: Channel to bind to in single-channel reception or transmission
447 * @closure: To be returned in &fw_cdev_event_iso_interrupt 666 * @speed: Transmission speed
667 * @closure: To be returned in &fw_cdev_event_iso_interrupt or
668 * &fw_cdev_event_iso_interrupt_multichannel
448 * @handle: Handle to context, written back by kernel 669 * @handle: Handle to context, written back by kernel
449 * 670 *
450 * Prior to sending or receiving isochronous I/O, a context must be created. 671 * Prior to sending or receiving isochronous I/O, a context must be created.
451 * The context records information about the transmit or receive configuration 672 * The context records information about the transmit or receive configuration
452 * and typically maps to an underlying hardware resource. A context is set up 673 * and typically maps to an underlying hardware resource. A context is set up
453 * for either sending or receiving. It is bound to a specific isochronous 674 * for either sending or receiving. It is bound to a specific isochronous
454 * channel. 675 * @channel.
676 *
677 * In case of multichannel reception, @header_size and @channel are ignored
678 * and the channels are selected by %FW_CDEV_IOC_SET_ISO_CHANNELS.
679 *
680 * For %FW_CDEV_ISO_CONTEXT_RECEIVE contexts, @header_size must be at least 4
681 * and must be a multiple of 4. It is ignored in other context types.
682 *
683 * @speed is ignored in receive context types.
455 * 684 *
456 * If a context was successfully created, the kernel writes back a handle to the 685 * If a context was successfully created, the kernel writes back a handle to the
457 * context, which must be passed in for subsequent operations on that context. 686 * context, which must be passed in for subsequent operations on that context.
458 * 687 *
459 * For receive contexts, @header_size must be at least 4 and must be a multiple 688 * Limitations:
460 * of 4. 689 * No more than one iso context can be created per fd.
461 * 690 * The total number of contexts that all userspace and kernelspace drivers can
462 * Note that the effect of a @header_size > 4 depends on 691 * create on a card at a time is a hardware limit, typically 4 or 8 contexts per
463 * &fw_cdev_get_info.version, as documented at &fw_cdev_event_iso_interrupt. 692 * direction, and of them at most one multichannel receive context.
464 */ 693 */
465struct fw_cdev_create_iso_context { 694struct fw_cdev_create_iso_context {
466 __u32 type; 695 __u32 type;
@@ -471,6 +700,22 @@ struct fw_cdev_create_iso_context {
471 __u32 handle; 700 __u32 handle;
472}; 701};
473 702
703/**
704 * struct fw_cdev_set_iso_channels - Select channels in multichannel reception
705 * @channels: Bitmask of channels to listen to
706 * @handle: Handle of the mutichannel receive context
707 *
708 * @channels is the bitwise or of 1ULL << n for each channel n to listen to.
709 *
710 * The ioctl fails with errno %EBUSY if there is already another receive context
711 * on a channel in @channels. In that case, the bitmask of all unoccupied
712 * channels is returned in @channels.
713 */
714struct fw_cdev_set_iso_channels {
715 __u64 channels;
716 __u32 handle;
717};
718
474#define FW_CDEV_ISO_PAYLOAD_LENGTH(v) (v) 719#define FW_CDEV_ISO_PAYLOAD_LENGTH(v) (v)
475#define FW_CDEV_ISO_INTERRUPT (1 << 16) 720#define FW_CDEV_ISO_INTERRUPT (1 << 16)
476#define FW_CDEV_ISO_SKIP (1 << 17) 721#define FW_CDEV_ISO_SKIP (1 << 17)
@@ -481,42 +726,72 @@ struct fw_cdev_create_iso_context {
481 726
482/** 727/**
483 * struct fw_cdev_iso_packet - Isochronous packet 728 * struct fw_cdev_iso_packet - Isochronous packet
484 * @control: Contains the header length (8 uppermost bits), the sy field 729 * @control: Contains the header length (8 uppermost bits),
485 * (4 bits), the tag field (2 bits), a sync flag (1 bit), 730 * the sy field (4 bits), the tag field (2 bits), a sync flag
486 * a skip flag (1 bit), an interrupt flag (1 bit), and the 731 * or a skip flag (1 bit), an interrupt flag (1 bit), and the
487 * payload length (16 lowermost bits) 732 * payload length (16 lowermost bits)
488 * @header: Header and payload 733 * @header: Header and payload in case of a transmit context.
489 * 734 *
490 * &struct fw_cdev_iso_packet is used to describe isochronous packet queues. 735 * &struct fw_cdev_iso_packet is used to describe isochronous packet queues.
491 *
492 * Use the FW_CDEV_ISO_ macros to fill in @control. 736 * Use the FW_CDEV_ISO_ macros to fill in @control.
737 * The @header array is empty in case of receive contexts.
738 *
739 * Context type %FW_CDEV_ISO_CONTEXT_TRANSMIT:
740 *
741 * @control.HEADER_LENGTH must be a multiple of 4. It specifies the numbers of
742 * bytes in @header that will be prepended to the packet's payload. These bytes
743 * are copied into the kernel and will not be accessed after the ioctl has
744 * returned.
745 *
746 * The @control.SY and TAG fields are copied to the iso packet header. These
747 * fields are specified by IEEE 1394a and IEC 61883-1.
748 *
749 * The @control.SKIP flag specifies that no packet is to be sent in a frame.
750 * When using this, all other fields except @control.INTERRUPT must be zero.
751 *
752 * When a packet with the @control.INTERRUPT flag set has been completed, an
753 * &fw_cdev_event_iso_interrupt event will be sent.
754 *
755 * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE:
756 *
757 * @control.HEADER_LENGTH must be a multiple of the context's header_size.
758 * If the HEADER_LENGTH is larger than the context's header_size, multiple
759 * packets are queued for this entry.
760 *
761 * The @control.SY and TAG fields are ignored.
762 *
763 * If the @control.SYNC flag is set, the context drops all packets until a
764 * packet with a sy field is received which matches &fw_cdev_start_iso.sync.
765 *
766 * @control.PAYLOAD_LENGTH defines how many payload bytes can be received for
767 * one packet (in addition to payload quadlets that have been defined as headers
768 * and are stripped and returned in the &fw_cdev_event_iso_interrupt structure).
769 * If more bytes are received, the additional bytes are dropped. If less bytes
770 * are received, the remaining bytes in this part of the payload buffer will not
771 * be written to, not even by the next packet. I.e., packets received in
772 * consecutive frames will not necessarily be consecutive in memory. If an
773 * entry has queued multiple packets, the PAYLOAD_LENGTH is divided equally
774 * among them.
493 * 775 *
494 * For transmit packets, the header length must be a multiple of 4 and specifies 776 * When a packet with the @control.INTERRUPT flag set has been completed, an
495 * the numbers of bytes in @header that will be prepended to the packet's
496 * payload; these bytes are copied into the kernel and will not be accessed
497 * after the ioctl has returned. The sy and tag fields are copied to the iso
498 * packet header (these fields are specified by IEEE 1394a and IEC 61883-1).
499 * The skip flag specifies that no packet is to be sent in a frame; when using
500 * this, all other fields except the interrupt flag must be zero.
501 *
502 * For receive packets, the header length must be a multiple of the context's
503 * header size; if the header length is larger than the context's header size,
504 * multiple packets are queued for this entry. The sy and tag fields are
505 * ignored. If the sync flag is set, the context drops all packets until
506 * a packet with a matching sy field is received (the sync value to wait for is
507 * specified in the &fw_cdev_start_iso structure). The payload length defines
508 * how many payload bytes can be received for one packet (in addition to payload
509 * quadlets that have been defined as headers and are stripped and returned in
510 * the &fw_cdev_event_iso_interrupt structure). If more bytes are received, the
511 * additional bytes are dropped. If less bytes are received, the remaining
512 * bytes in this part of the payload buffer will not be written to, not even by
513 * the next packet, i.e., packets received in consecutive frames will not
514 * necessarily be consecutive in memory. If an entry has queued multiple
515 * packets, the payload length is divided equally among them.
516 *
517 * When a packet with the interrupt flag set has been completed, the
518 * &fw_cdev_event_iso_interrupt event will be sent. An entry that has queued 777 * &fw_cdev_event_iso_interrupt event will be sent. An entry that has queued
519 * multiple receive packets is completed when its last packet is completed. 778 * multiple receive packets is completed when its last packet is completed.
779 *
780 * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL:
781 *
782 * Here, &fw_cdev_iso_packet would be more aptly named _iso_buffer_chunk since
783 * it specifies a chunk of the mmap()'ed buffer, while the number and alignment
784 * of packets to be placed into the buffer chunk is not known beforehand.
785 *
786 * @control.PAYLOAD_LENGTH is the size of the buffer chunk and specifies room
787 * for header, payload, padding, and trailer bytes of one or more packets.
788 * It must be a multiple of 4.
789 *
790 * @control.HEADER_LENGTH, TAG and SY are ignored. SYNC is treated as described
791 * for single-channel reception.
792 *
793 * When a buffer chunk with the @control.INTERRUPT flag set has been filled
794 * entirely, an &fw_cdev_event_iso_interrupt_mc event will be sent.
520 */ 795 */
521struct fw_cdev_iso_packet { 796struct fw_cdev_iso_packet {
522 __u32 control; 797 __u32 control;
@@ -525,9 +800,9 @@ struct fw_cdev_iso_packet {
525 800
526/** 801/**
527 * struct fw_cdev_queue_iso - Queue isochronous packets for I/O 802 * struct fw_cdev_queue_iso - Queue isochronous packets for I/O
528 * @packets: Userspace pointer to packet data 803 * @packets: Userspace pointer to an array of &fw_cdev_iso_packet
529 * @data: Pointer into mmap()'ed payload buffer 804 * @data: Pointer into mmap()'ed payload buffer
530 * @size: Size of packet data in bytes 805 * @size: Size of the @packets array, in bytes
531 * @handle: Isochronous context handle 806 * @handle: Isochronous context handle
532 * 807 *
533 * Queue a number of isochronous packets for reception or transmission. 808 * Queue a number of isochronous packets for reception or transmission.
@@ -540,6 +815,9 @@ struct fw_cdev_iso_packet {
540 * The kernel may or may not queue all packets, but will write back updated 815 * The kernel may or may not queue all packets, but will write back updated
541 * values of the @packets, @data and @size fields, so the ioctl can be 816 * values of the @packets, @data and @size fields, so the ioctl can be
542 * resubmitted easily. 817 * resubmitted easily.
818 *
819 * In case of a multichannel receive context, @data must be quadlet-aligned
820 * relative to the buffer start.
543 */ 821 */
544struct fw_cdev_queue_iso { 822struct fw_cdev_queue_iso {
545 __u64 packets; 823 __u64 packets;
@@ -698,4 +976,39 @@ struct fw_cdev_send_stream_packet {
698 __u32 speed; 976 __u32 speed;
699}; 977};
700 978
979/**
980 * struct fw_cdev_send_phy_packet - send a PHY packet
981 * @closure: Passed back to userspace in the PHY-packet-sent event
982 * @data: First and second quadlet of the PHY packet
983 * @generation: The bus generation where packet is valid
984 *
985 * The %FW_CDEV_IOC_SEND_PHY_PACKET ioctl sends a PHY packet to all nodes
986 * on the same card as this device. After transmission, an
987 * %FW_CDEV_EVENT_PHY_PACKET_SENT event is generated.
988 *
989 * The payload @data[] shall be specified in host byte order. Usually,
990 * @data[1] needs to be the bitwise inverse of @data[0]. VersaPHY packets
991 * are an exception to this rule.
992 *
993 * The ioctl is only permitted on device files which represent a local node.
994 */
995struct fw_cdev_send_phy_packet {
996 __u64 closure;
997 __u32 data[2];
998 __u32 generation;
999};
1000
1001/**
1002 * struct fw_cdev_receive_phy_packets - start reception of PHY packets
1003 * @closure: Passed back to userspace in phy packet events
1004 *
1005 * This ioctl activates issuing of %FW_CDEV_EVENT_PHY_PACKET_RECEIVED due to
1006 * incoming PHY packets from any node on the same bus as the device.
1007 *
1008 * The ioctl is only permitted on device files which represent a local node.
1009 */
1010struct fw_cdev_receive_phy_packets {
1011 __u64 closure;
1012};
1013
701#endif /* _LINUX_FIREWIRE_CDEV_H */ 1014#endif /* _LINUX_FIREWIRE_CDEV_H */
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 72e2b8ac2a5a..1cd637ef62d2 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -32,11 +32,13 @@
32#define CSR_CYCLE_TIME 0x200 32#define CSR_CYCLE_TIME 0x200
33#define CSR_BUS_TIME 0x204 33#define CSR_BUS_TIME 0x204
34#define CSR_BUSY_TIMEOUT 0x210 34#define CSR_BUSY_TIMEOUT 0x210
35#define CSR_PRIORITY_BUDGET 0x218
35#define CSR_BUS_MANAGER_ID 0x21c 36#define CSR_BUS_MANAGER_ID 0x21c
36#define CSR_BANDWIDTH_AVAILABLE 0x220 37#define CSR_BANDWIDTH_AVAILABLE 0x220
37#define CSR_CHANNELS_AVAILABLE 0x224 38#define CSR_CHANNELS_AVAILABLE 0x224
38#define CSR_CHANNELS_AVAILABLE_HI 0x224 39#define CSR_CHANNELS_AVAILABLE_HI 0x224
39#define CSR_CHANNELS_AVAILABLE_LO 0x228 40#define CSR_CHANNELS_AVAILABLE_LO 0x228
41#define CSR_MAINT_UTILITY 0x230
40#define CSR_BROADCAST_CHANNEL 0x234 42#define CSR_BROADCAST_CHANNEL 0x234
41#define CSR_CONFIG_ROM 0x400 43#define CSR_CONFIG_ROM 0x400
42#define CSR_CONFIG_ROM_END 0x800 44#define CSR_CONFIG_ROM_END 0x800
@@ -89,6 +91,11 @@ struct fw_card {
89 struct list_head transaction_list; 91 struct list_head transaction_list;
90 unsigned long reset_jiffies; 92 unsigned long reset_jiffies;
91 93
94 u32 split_timeout_hi;
95 u32 split_timeout_lo;
96 unsigned int split_timeout_cycles;
97 unsigned int split_timeout_jiffies;
98
92 unsigned long long guid; 99 unsigned long long guid;
93 unsigned max_receive; 100 unsigned max_receive;
94 int link_speed; 101 int link_speed;
@@ -104,18 +111,28 @@ struct fw_card {
104 bool beta_repeaters_present; 111 bool beta_repeaters_present;
105 112
106 int index; 113 int index;
107
108 struct list_head link; 114 struct list_head link;
109 115
110 /* Work struct for BM duties. */ 116 struct list_head phy_receiver_list;
111 struct delayed_work work; 117
118 struct delayed_work br_work; /* bus reset job */
119 bool br_short;
120
121 struct delayed_work bm_work; /* bus manager job */
112 int bm_retries; 122 int bm_retries;
113 int bm_generation; 123 int bm_generation;
114 __be32 bm_transaction_data[2]; 124 __be32 bm_transaction_data[2];
125 int bm_node_id;
126 bool bm_abdicate;
127
128 bool priority_budget_implemented; /* controller feature */
129 bool broadcast_channel_auto_allocated; /* controller feature */
115 130
116 bool broadcast_channel_allocated; 131 bool broadcast_channel_allocated;
117 u32 broadcast_channel; 132 u32 broadcast_channel;
118 __be32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4]; 133 __be32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];
134
135 __be32 maint_utility_register;
119}; 136};
120 137
121struct fw_attribute_group { 138struct fw_attribute_group {
@@ -252,7 +269,7 @@ typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode,
252typedef void (*fw_address_callback_t)(struct fw_card *card, 269typedef void (*fw_address_callback_t)(struct fw_card *card,
253 struct fw_request *request, 270 struct fw_request *request,
254 int tcode, int destination, int source, 271 int tcode, int destination, int source,
255 int generation, int speed, 272 int generation,
256 unsigned long long offset, 273 unsigned long long offset,
257 void *data, size_t length, 274 void *data, size_t length,
258 void *callback_data); 275 void *callback_data);
@@ -269,10 +286,10 @@ struct fw_packet {
269 u32 timestamp; 286 u32 timestamp;
270 287
271 /* 288 /*
272 * This callback is called when the packet transmission has 289 * This callback is called when the packet transmission has completed.
273 * completed; for successful transmission, the status code is 290 * For successful transmission, the status code is the ack received
274 * the ack received from the destination, otherwise it's a 291 * from the destination. Otherwise it is one of the juju-specific
275 * negative errno: ENOMEM, ESTALE, ETIMEDOUT, ENODEV, EIO. 292 * rcodes: RCODE_SEND_ERROR, _CANCELLED, _BUSY, _GENERATION, _NO_ACK.
276 * The callback can be called from tasklet context and thus 293 * The callback can be called from tasklet context and thus
277 * must never block. 294 * must never block.
278 */ 295 */
@@ -355,17 +372,19 @@ void fw_core_remove_descriptor(struct fw_descriptor *desc);
355 * scatter-gather streaming (e.g. assembling video frame automatically). 372 * scatter-gather streaming (e.g. assembling video frame automatically).
356 */ 373 */
357struct fw_iso_packet { 374struct fw_iso_packet {
358 u16 payload_length; /* Length of indirect payload. */ 375 u16 payload_length; /* Length of indirect payload */
359 u32 interrupt:1; /* Generate interrupt on this packet */ 376 u32 interrupt:1; /* Generate interrupt on this packet */
360 u32 skip:1; /* Set to not send packet at all. */ 377 u32 skip:1; /* tx: Set to not send packet at all */
361 u32 tag:2; 378 /* rx: Sync bit, wait for matching sy */
362 u32 sy:4; 379 u32 tag:2; /* tx: Tag in packet header */
363 u32 header_length:8; /* Length of immediate header. */ 380 u32 sy:4; /* tx: Sy in packet header */
364 u32 header[0]; 381 u32 header_length:8; /* Length of immediate header */
382 u32 header[0]; /* tx: Top of 1394 isoch. data_block */
365}; 383};
366 384
367#define FW_ISO_CONTEXT_TRANSMIT 0 385#define FW_ISO_CONTEXT_TRANSMIT 0
368#define FW_ISO_CONTEXT_RECEIVE 1 386#define FW_ISO_CONTEXT_RECEIVE 1
387#define FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL 2
369 388
370#define FW_ISO_CONTEXT_MATCH_TAG0 1 389#define FW_ISO_CONTEXT_MATCH_TAG0 1
371#define FW_ISO_CONTEXT_MATCH_TAG1 2 390#define FW_ISO_CONTEXT_MATCH_TAG1 2
@@ -389,24 +408,31 @@ struct fw_iso_buffer {
389int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card, 408int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card,
390 int page_count, enum dma_data_direction direction); 409 int page_count, enum dma_data_direction direction);
391void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card); 410void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card);
411size_t fw_iso_buffer_lookup(struct fw_iso_buffer *buffer, dma_addr_t completed);
392 412
393struct fw_iso_context; 413struct fw_iso_context;
394typedef void (*fw_iso_callback_t)(struct fw_iso_context *context, 414typedef void (*fw_iso_callback_t)(struct fw_iso_context *context,
395 u32 cycle, size_t header_length, 415 u32 cycle, size_t header_length,
396 void *header, void *data); 416 void *header, void *data);
417typedef void (*fw_iso_mc_callback_t)(struct fw_iso_context *context,
418 dma_addr_t completed, void *data);
397struct fw_iso_context { 419struct fw_iso_context {
398 struct fw_card *card; 420 struct fw_card *card;
399 int type; 421 int type;
400 int channel; 422 int channel;
401 int speed; 423 int speed;
402 size_t header_size; 424 size_t header_size;
403 fw_iso_callback_t callback; 425 union {
426 fw_iso_callback_t sc;
427 fw_iso_mc_callback_t mc;
428 } callback;
404 void *callback_data; 429 void *callback_data;
405}; 430};
406 431
407struct fw_iso_context *fw_iso_context_create(struct fw_card *card, 432struct fw_iso_context *fw_iso_context_create(struct fw_card *card,
408 int type, int channel, int speed, size_t header_size, 433 int type, int channel, int speed, size_t header_size,
409 fw_iso_callback_t callback, void *callback_data); 434 fw_iso_callback_t callback, void *callback_data);
435int fw_iso_context_set_channels(struct fw_iso_context *ctx, u64 *channels);
410int fw_iso_context_queue(struct fw_iso_context *ctx, 436int fw_iso_context_queue(struct fw_iso_context *ctx,
411 struct fw_iso_packet *packet, 437 struct fw_iso_packet *packet,
412 struct fw_iso_buffer *buffer, 438 struct fw_iso_buffer *buffer,
diff --git a/include/linux/flex_array.h b/include/linux/flex_array.h
index 1d747f72298b..631b77f2ac70 100644
--- a/include/linux/flex_array.h
+++ b/include/linux/flex_array.h
@@ -70,4 +70,9 @@ int flex_array_clear(struct flex_array *fa, unsigned int element_nr);
70void *flex_array_get(struct flex_array *fa, unsigned int element_nr); 70void *flex_array_get(struct flex_array *fa, unsigned int element_nr);
71int flex_array_shrink(struct flex_array *fa); 71int flex_array_shrink(struct flex_array *fa);
72 72
73#define flex_array_put_ptr(fa, nr, src, gfp) \
74 flex_array_put(fa, nr, &(void *)(src), gfp)
75
76void *flex_array_get_ptr(struct flex_array *fa, unsigned int element_nr);
77
73#endif /* _FLEX_ARRAY_H */ 78#endif /* _FLEX_ARRAY_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 68ca1b0491af..9a96b4d83fc1 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -8,6 +8,7 @@
8 8
9#include <linux/limits.h> 9#include <linux/limits.h>
10#include <linux/ioctl.h> 10#include <linux/ioctl.h>
11#include <linux/blk_types.h>
11 12
12/* 13/*
13 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change 14 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
@@ -53,6 +54,7 @@ struct inodes_stat_t {
53#define MAY_APPEND 8 54#define MAY_APPEND 8
54#define MAY_ACCESS 16 55#define MAY_ACCESS 16
55#define MAY_OPEN 32 56#define MAY_OPEN 32
57#define MAY_CHDIR 64
56 58
57/* 59/*
58 * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond 60 * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond
@@ -90,6 +92,9 @@ struct inodes_stat_t {
90/* Expect random access pattern */ 92/* Expect random access pattern */
91#define FMODE_RANDOM ((__force fmode_t)0x1000) 93#define FMODE_RANDOM ((__force fmode_t)0x1000)
92 94
95/* File was opened by fanotify and shouldn't generate fanotify events */
96#define FMODE_NONOTIFY ((__force fmode_t)0x1000000)
97
93/* 98/*
94 * The below are the various read and write types that we support. Some of 99 * The below are the various read and write types that we support. Some of
95 * them include behavioral modifiers that send information down to the 100 * them include behavioral modifiers that send information down to the
@@ -117,7 +122,7 @@ struct inodes_stat_t {
117 * immediately wait on this read without caring about 122 * immediately wait on this read without caring about
118 * unplugging. 123 * unplugging.
119 * READA Used for read-ahead operations. Lower priority, and the 124 * READA Used for read-ahead operations. Lower priority, and the
120 * block layer could (in theory) choose to ignore this 125 * block layer could (in theory) choose to ignore this
121 * request if it runs into resource problems. 126 * request if it runs into resource problems.
122 * WRITE A normal async write. Device will be plugged. 127 * WRITE A normal async write. Device will be plugged.
123 * SWRITE Like WRITE, but a special case for ll_rw_block() that 128 * SWRITE Like WRITE, but a special case for ll_rw_block() that
@@ -136,7 +141,7 @@ struct inodes_stat_t {
136 * SWRITE_SYNC 141 * SWRITE_SYNC
137 * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer. 142 * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer.
138 * See SWRITE. 143 * See SWRITE.
139 * WRITE_BARRIER Like WRITE, but tells the block layer that all 144 * WRITE_BARRIER Like WRITE_SYNC, but tells the block layer that all
140 * previously submitted writes must be safely on storage 145 * previously submitted writes must be safely on storage
141 * before this one is started. Also guarantees that when 146 * before this one is started. Also guarantees that when
142 * this write is complete, it itself is also safely on 147 * this write is complete, it itself is also safely on
@@ -144,29 +149,32 @@ struct inodes_stat_t {
144 * of this IO. 149 * of this IO.
145 * 150 *
146 */ 151 */
147#define RW_MASK 1 152#define RW_MASK REQ_WRITE
148#define RWA_MASK 2 153#define RWA_MASK REQ_RAHEAD
149#define READ 0 154
150#define WRITE 1 155#define READ 0
151#define READA 2 /* read-ahead - don't block if no resources */ 156#define WRITE RW_MASK
152#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ 157#define READA RWA_MASK
153#define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 158#define SWRITE (WRITE | READA)
154#define READ_META (READ | (1 << BIO_RW_META)) 159
155#define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) 160#define READ_SYNC (READ | REQ_SYNC | REQ_UNPLUG)
156#define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) 161#define READ_META (READ | REQ_META)
157#define WRITE_ODIRECT_PLUG (WRITE | (1 << BIO_RW_SYNCIO)) 162#define WRITE_SYNC_PLUG (WRITE | REQ_SYNC | REQ_NOIDLE)
158#define WRITE_META (WRITE | (1 << BIO_RW_META)) 163#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG)
159#define SWRITE_SYNC_PLUG \ 164#define WRITE_ODIRECT_PLUG (WRITE | REQ_SYNC)
160 (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) 165#define WRITE_META (WRITE | REQ_META)
161#define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) 166#define WRITE_BARRIER (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \
162#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) 167 REQ_HARDBARRIER)
168#define SWRITE_SYNC_PLUG (SWRITE | REQ_SYNC | REQ_NOIDLE)
169#define SWRITE_SYNC (SWRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG)
163 170
164/* 171/*
165 * These aren't really reads or writes, they pass down information about 172 * These aren't really reads or writes, they pass down information about
166 * parts of device that are now unused by the file system. 173 * parts of device that are now unused by the file system.
167 */ 174 */
168#define DISCARD_NOBARRIER (WRITE | (1 << BIO_RW_DISCARD)) 175#define DISCARD_NOBARRIER (WRITE | REQ_DISCARD)
169#define DISCARD_BARRIER (DISCARD_NOBARRIER | (1 << BIO_RW_BARRIER)) 176#define DISCARD_BARRIER (WRITE | REQ_DISCARD | REQ_HARDBARRIER)
177#define DISCARD_SECURE (DISCARD_NOBARRIER | REQ_SECURE)
170 178
171#define SEL_IN 1 179#define SEL_IN 1
172#define SEL_OUT 2 180#define SEL_OUT 2
@@ -209,6 +217,7 @@ struct inodes_stat_t {
209#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ 217#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
210#define MS_I_VERSION (1<<23) /* Update inode I_version field */ 218#define MS_I_VERSION (1<<23) /* Update inode I_version field */
211#define MS_STRICTATIME (1<<24) /* Always perform atime updates */ 219#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
220#define MS_BORN (1<<29)
212#define MS_ACTIVE (1<<30) 221#define MS_ACTIVE (1<<30)
213#define MS_NOUSER (1<<31) 222#define MS_NOUSER (1<<31)
214 223
@@ -309,6 +318,7 @@ struct inodes_stat_t {
309#define BLKALIGNOFF _IO(0x12,122) 318#define BLKALIGNOFF _IO(0x12,122)
310#define BLKPBSZGET _IO(0x12,123) 319#define BLKPBSZGET _IO(0x12,123)
311#define BLKDISCARDZEROES _IO(0x12,124) 320#define BLKDISCARDZEROES _IO(0x12,124)
321#define BLKSECDISCARD _IO(0x12,125)
312 322
313#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ 323#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
314#define FIBMAP _IO(0x00,1) /* bmap access */ 324#define FIBMAP _IO(0x00,1) /* bmap access */
@@ -407,15 +417,13 @@ extern int get_max_files(void);
407extern int sysctl_nr_open; 417extern int sysctl_nr_open;
408extern struct inodes_stat_t inodes_stat; 418extern struct inodes_stat_t inodes_stat;
409extern int leases_enable, lease_break_time; 419extern int leases_enable, lease_break_time;
410#ifdef CONFIG_DNOTIFY
411extern int dir_notify_enable;
412#endif
413 420
414struct buffer_head; 421struct buffer_head;
415typedef int (get_block_t)(struct inode *inode, sector_t iblock, 422typedef int (get_block_t)(struct inode *inode, sector_t iblock,
416 struct buffer_head *bh_result, int create); 423 struct buffer_head *bh_result, int create);
417typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, 424typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
418 ssize_t bytes, void *private); 425 ssize_t bytes, void *private, int ret,
426 bool is_async);
419 427
420/* 428/*
421 * Attribute flags. These should be or-ed together to figure out what 429 * Attribute flags. These should be or-ed together to figure out what
@@ -685,6 +693,7 @@ struct block_device {
685 */ 693 */
686#define PAGECACHE_TAG_DIRTY 0 694#define PAGECACHE_TAG_DIRTY 0
687#define PAGECACHE_TAG_WRITEBACK 1 695#define PAGECACHE_TAG_WRITEBACK 1
696#define PAGECACHE_TAG_TOWRITE 2
688 697
689int mapping_tagged(struct address_space *mapping, int tag); 698int mapping_tagged(struct address_space *mapping, int tag);
690 699
@@ -768,12 +777,7 @@ struct inode {
768 777
769#ifdef CONFIG_FSNOTIFY 778#ifdef CONFIG_FSNOTIFY
770 __u32 i_fsnotify_mask; /* all events this inode cares about */ 779 __u32 i_fsnotify_mask; /* all events this inode cares about */
771 struct hlist_head i_fsnotify_mark_entries; /* fsnotify mark entries */ 780 struct hlist_head i_fsnotify_marks;
772#endif
773
774#ifdef CONFIG_INOTIFY
775 struct list_head inotify_watches; /* watches on this inode */
776 struct mutex inotify_mutex; /* protects the watches list */
777#endif 781#endif
778 782
779 unsigned long i_state; 783 unsigned long i_state;
@@ -1479,8 +1483,8 @@ struct block_device_operations;
1479 1483
1480/* 1484/*
1481 * NOTE: 1485 * NOTE:
1482 * read, write, poll, fsync, readv, writev, unlocked_ioctl and compat_ioctl 1486 * all file operations except setlease can be called without
1483 * can be called without the big kernel lock held in all filesystems. 1487 * the big kernel lock held in all filesystems.
1484 */ 1488 */
1485struct file_operations { 1489struct file_operations {
1486 struct module *owner; 1490 struct module *owner;
@@ -1491,7 +1495,6 @@ struct file_operations {
1491 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 1495 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1492 int (*readdir) (struct file *, void *, filldir_t); 1496 int (*readdir) (struct file *, void *, filldir_t);
1493 unsigned int (*poll) (struct file *, struct poll_table_struct *); 1497 unsigned int (*poll) (struct file *, struct poll_table_struct *);
1494 int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
1495 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 1498 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
1496 long (*compat_ioctl) (struct file *, unsigned int, unsigned long); 1499 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
1497 int (*mmap) (struct file *, struct vm_area_struct *); 1500 int (*mmap) (struct file *, struct vm_area_struct *);
@@ -1561,8 +1564,8 @@ struct super_operations {
1561 1564
1562 void (*dirty_inode) (struct inode *); 1565 void (*dirty_inode) (struct inode *);
1563 int (*write_inode) (struct inode *, struct writeback_control *wbc); 1566 int (*write_inode) (struct inode *, struct writeback_control *wbc);
1564 void (*drop_inode) (struct inode *); 1567 int (*drop_inode) (struct inode *);
1565 void (*delete_inode) (struct inode *); 1568 void (*evict_inode) (struct inode *);
1566 void (*put_super) (struct super_block *); 1569 void (*put_super) (struct super_block *);
1567 void (*write_super) (struct super_block *); 1570 void (*write_super) (struct super_block *);
1568 int (*sync_fs)(struct super_block *sb, int wait); 1571 int (*sync_fs)(struct super_block *sb, int wait);
@@ -1570,7 +1573,6 @@ struct super_operations {
1570 int (*unfreeze_fs) (struct super_block *); 1573 int (*unfreeze_fs) (struct super_block *);
1571 int (*statfs) (struct dentry *, struct kstatfs *); 1574 int (*statfs) (struct dentry *, struct kstatfs *);
1572 int (*remount_fs) (struct super_block *, int *, char *); 1575 int (*remount_fs) (struct super_block *, int *, char *);
1573 void (*clear_inode) (struct inode *);
1574 void (*umount_begin) (struct super_block *); 1576 void (*umount_begin) (struct super_block *);
1575 1577
1576 int (*show_options)(struct seq_file *, struct vfsmount *); 1578 int (*show_options)(struct seq_file *, struct vfsmount *);
@@ -1615,8 +1617,8 @@ struct super_operations {
1615 * I_FREEING Set when inode is about to be freed but still has dirty 1617 * I_FREEING Set when inode is about to be freed but still has dirty
1616 * pages or buffers attached or the inode itself is still 1618 * pages or buffers attached or the inode itself is still
1617 * dirty. 1619 * dirty.
1618 * I_CLEAR Set by clear_inode(). In this state the inode is clean 1620 * I_CLEAR Added by end_writeback(). In this state the inode is clean
1619 * and can be destroyed. 1621 * and can be destroyed. Inode keeps I_FREEING.
1620 * 1622 *
1621 * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are 1623 * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are
1622 * prohibited for many purposes. iget() must wait for 1624 * prohibited for many purposes. iget() must wait for
@@ -1813,7 +1815,8 @@ extern struct vfsmount *collect_mounts(struct path *);
1813extern void drop_collected_mounts(struct vfsmount *); 1815extern void drop_collected_mounts(struct vfsmount *);
1814extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, 1816extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
1815 struct vfsmount *); 1817 struct vfsmount *);
1816extern int vfs_statfs(struct dentry *, struct kstatfs *); 1818extern int vfs_statfs(struct path *, struct kstatfs *);
1819extern int statfs_by_dentry(struct dentry *, struct kstatfs *);
1817extern int freeze_super(struct super_block *super); 1820extern int freeze_super(struct super_block *super);
1818extern int thaw_super(struct super_block *super); 1821extern int thaw_super(struct super_block *super);
1819 1822
@@ -2163,9 +2166,8 @@ extern void iput(struct inode *);
2163extern struct inode * igrab(struct inode *); 2166extern struct inode * igrab(struct inode *);
2164extern ino_t iunique(struct super_block *, ino_t); 2167extern ino_t iunique(struct super_block *, ino_t);
2165extern int inode_needs_sync(struct inode *inode); 2168extern int inode_needs_sync(struct inode *inode);
2166extern void generic_delete_inode(struct inode *inode); 2169extern int generic_delete_inode(struct inode *inode);
2167extern void generic_drop_inode(struct inode *inode); 2170extern int generic_drop_inode(struct inode *inode);
2168extern int generic_detach_inode(struct inode *inode);
2169 2171
2170extern struct inode *ilookup5_nowait(struct super_block *sb, 2172extern struct inode *ilookup5_nowait(struct super_block *sb,
2171 unsigned long hashval, int (*test)(struct inode *, void *), 2173 unsigned long hashval, int (*test)(struct inode *, void *),
@@ -2182,7 +2184,7 @@ extern void unlock_new_inode(struct inode *);
2182 2184
2183extern void __iget(struct inode * inode); 2185extern void __iget(struct inode * inode);
2184extern void iget_failed(struct inode *); 2186extern void iget_failed(struct inode *);
2185extern void clear_inode(struct inode *); 2187extern void end_writeback(struct inode *);
2186extern void destroy_inode(struct inode *); 2188extern void destroy_inode(struct inode *);
2187extern void __destroy_inode(struct inode *); 2189extern void __destroy_inode(struct inode *);
2188extern struct inode *new_inode(struct super_block *); 2190extern struct inode *new_inode(struct super_block *);
@@ -2198,7 +2200,6 @@ static inline void insert_inode_hash(struct inode *inode) {
2198extern void file_move(struct file *f, struct list_head *list); 2200extern void file_move(struct file *f, struct list_head *list);
2199extern void file_kill(struct file *f); 2201extern void file_kill(struct file *f);
2200#ifdef CONFIG_BLOCK 2202#ifdef CONFIG_BLOCK
2201struct bio;
2202extern void submit_bio(int, struct bio *); 2203extern void submit_bio(int, struct bio *);
2203extern int bdev_read_only(struct block_device *); 2204extern int bdev_read_only(struct block_device *);
2204#endif 2205#endif
@@ -2265,19 +2266,8 @@ static inline int xip_truncate_page(struct address_space *mapping, loff_t from)
2265#endif 2266#endif
2266 2267
2267#ifdef CONFIG_BLOCK 2268#ifdef CONFIG_BLOCK
2268struct bio;
2269typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode, 2269typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode,
2270 loff_t file_offset); 2270 loff_t file_offset);
2271void dio_end_io(struct bio *bio, int error);
2272
2273ssize_t __blockdev_direct_IO_newtrunc(int rw, struct kiocb *iocb, struct inode *inode,
2274 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2275 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2276 dio_submit_t submit_io, int lock_type);
2277ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2278 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2279 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2280 dio_submit_t submit_io, int lock_type);
2281 2271
2282enum { 2272enum {
2283 /* need locking between buffered and direct access */ 2273 /* need locking between buffered and direct access */
@@ -2287,24 +2277,13 @@ enum {
2287 DIO_SKIP_HOLES = 0x02, 2277 DIO_SKIP_HOLES = 0x02,
2288}; 2278};
2289 2279
2290static inline ssize_t blockdev_direct_IO_newtrunc(int rw, struct kiocb *iocb, 2280void dio_end_io(struct bio *bio, int error);
2291 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 2281
2292 loff_t offset, unsigned long nr_segs, get_block_t get_block, 2282ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2293 dio_iodone_t end_io) 2283 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2294{ 2284 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2295 return __blockdev_direct_IO_newtrunc(rw, iocb, inode, bdev, iov, offset, 2285 dio_submit_t submit_io, int flags);
2296 nr_segs, get_block, end_io, NULL,
2297 DIO_LOCKING | DIO_SKIP_HOLES);
2298}
2299 2286
2300static inline ssize_t blockdev_direct_IO_no_locking_newtrunc(int rw, struct kiocb *iocb,
2301 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2302 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2303 dio_iodone_t end_io)
2304{
2305 return __blockdev_direct_IO_newtrunc(rw, iocb, inode, bdev, iov, offset,
2306 nr_segs, get_block, end_io, NULL, 0);
2307}
2308static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 2287static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2309 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 2288 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2310 loff_t offset, unsigned long nr_segs, get_block_t get_block, 2289 loff_t offset, unsigned long nr_segs, get_block_t get_block,
@@ -2314,15 +2293,6 @@ static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2314 nr_segs, get_block, end_io, NULL, 2293 nr_segs, get_block, end_io, NULL,
2315 DIO_LOCKING | DIO_SKIP_HOLES); 2294 DIO_LOCKING | DIO_SKIP_HOLES);
2316} 2295}
2317
2318static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
2319 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2320 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2321 dio_iodone_t end_io)
2322{
2323 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2324 nr_segs, get_block, end_io, NULL, 0);
2325}
2326#endif 2296#endif
2327 2297
2328extern const struct file_operations generic_ro_fops; 2298extern const struct file_operations generic_ro_fops;
@@ -2349,10 +2319,10 @@ void inode_set_bytes(struct inode *inode, loff_t bytes);
2349 2319
2350extern int vfs_readdir(struct file *, filldir_t, void *); 2320extern int vfs_readdir(struct file *, filldir_t, void *);
2351 2321
2352extern int vfs_stat(char __user *, struct kstat *); 2322extern int vfs_stat(const char __user *, struct kstat *);
2353extern int vfs_lstat(char __user *, struct kstat *); 2323extern int vfs_lstat(const char __user *, struct kstat *);
2354extern int vfs_fstat(unsigned int, struct kstat *); 2324extern int vfs_fstat(unsigned int, struct kstat *);
2355extern int vfs_fstatat(int , char __user *, struct kstat *, int); 2325extern int vfs_fstatat(int , const char __user *, struct kstat *, int);
2356 2326
2357extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, 2327extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
2358 unsigned long arg); 2328 unsigned long arg);
@@ -2384,7 +2354,6 @@ extern int simple_link(struct dentry *, struct inode *, struct dentry *);
2384extern int simple_unlink(struct inode *, struct dentry *); 2354extern int simple_unlink(struct inode *, struct dentry *);
2385extern int simple_rmdir(struct inode *, struct dentry *); 2355extern int simple_rmdir(struct inode *, struct dentry *);
2386extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); 2356extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
2387extern int simple_setsize(struct inode *, loff_t);
2388extern int noop_fsync(struct file *, int); 2357extern int noop_fsync(struct file *, int);
2389extern int simple_empty(struct dentry *); 2358extern int simple_empty(struct dentry *);
2390extern int simple_readpage(struct file *file, struct page *page); 2359extern int simple_readpage(struct file *file, struct page *page);
@@ -2421,8 +2390,7 @@ extern int buffer_migrate_page(struct address_space *,
2421 2390
2422extern int inode_change_ok(const struct inode *, struct iattr *); 2391extern int inode_change_ok(const struct inode *, struct iattr *);
2423extern int inode_newsize_ok(const struct inode *, loff_t offset); 2392extern int inode_newsize_ok(const struct inode *, loff_t offset);
2424extern int __must_check inode_setattr(struct inode *, const struct iattr *); 2393extern void setattr_copy(struct inode *inode, const struct iattr *attr);
2425extern void generic_setattr(struct inode *inode, const struct iattr *attr);
2426 2394
2427extern void file_update_time(struct file *file); 2395extern void file_update_time(struct file *file);
2428 2396
@@ -2513,7 +2481,8 @@ int proc_nr_files(struct ctl_table *table, int write,
2513int __init get_filesystem_list(char *buf); 2481int __init get_filesystem_list(char *buf);
2514 2482
2515#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) 2483#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE])
2516#define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE)) 2484#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \
2485 (flag & FMODE_NONOTIFY)))
2517 2486
2518#endif /* __KERNEL__ */ 2487#endif /* __KERNEL__ */
2519#endif /* _LINUX_FS_H */ 2488#endif /* _LINUX_FS_H */
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index 78a05bfcd8eb..eca3d5202138 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -21,4 +21,31 @@ extern void free_fs_struct(struct fs_struct *);
21extern void daemonize_fs_struct(void); 21extern void daemonize_fs_struct(void);
22extern int unshare_fs_struct(void); 22extern int unshare_fs_struct(void);
23 23
24static inline void get_fs_root(struct fs_struct *fs, struct path *root)
25{
26 read_lock(&fs->lock);
27 *root = fs->root;
28 path_get(root);
29 read_unlock(&fs->lock);
30}
31
32static inline void get_fs_pwd(struct fs_struct *fs, struct path *pwd)
33{
34 read_lock(&fs->lock);
35 *pwd = fs->pwd;
36 path_get(pwd);
37 read_unlock(&fs->lock);
38}
39
40static inline void get_fs_root_and_pwd(struct fs_struct *fs, struct path *root,
41 struct path *pwd)
42{
43 read_lock(&fs->lock);
44 *root = fs->root;
45 path_get(root);
46 *pwd = fs->pwd;
47 path_get(pwd);
48 read_unlock(&fs->lock);
49}
50
24#endif /* _LINUX_FS_STRUCT_H */ 51#endif /* _LINUX_FS_STRUCT_H */
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index c57db27ac861..b8581c09d19f 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -20,7 +20,7 @@
20 20
21#include <linux/fscache.h> 21#include <linux/fscache.h>
22#include <linux/sched.h> 22#include <linux/sched.h>
23#include <linux/slow-work.h> 23#include <linux/workqueue.h>
24 24
25#define NR_MAXCACHES BITS_PER_LONG 25#define NR_MAXCACHES BITS_PER_LONG
26 26
@@ -76,18 +76,14 @@ typedef void (*fscache_operation_release_t)(struct fscache_operation *op);
76typedef void (*fscache_operation_processor_t)(struct fscache_operation *op); 76typedef void (*fscache_operation_processor_t)(struct fscache_operation *op);
77 77
78struct fscache_operation { 78struct fscache_operation {
79 union { 79 struct work_struct work; /* record for async ops */
80 struct work_struct fast_work; /* record for fast ops */
81 struct slow_work slow_work; /* record for (very) slow ops */
82 };
83 struct list_head pend_link; /* link in object->pending_ops */ 80 struct list_head pend_link; /* link in object->pending_ops */
84 struct fscache_object *object; /* object to be operated upon */ 81 struct fscache_object *object; /* object to be operated upon */
85 82
86 unsigned long flags; 83 unsigned long flags;
87#define FSCACHE_OP_TYPE 0x000f /* operation type */ 84#define FSCACHE_OP_TYPE 0x000f /* operation type */
88#define FSCACHE_OP_FAST 0x0001 /* - fast op, processor may not sleep for disk */ 85#define FSCACHE_OP_ASYNC 0x0001 /* - async op, processor may sleep for disk */
89#define FSCACHE_OP_SLOW 0x0002 /* - (very) slow op, processor may sleep for disk */ 86#define FSCACHE_OP_MYTHREAD 0x0002 /* - processing is done be issuing thread, not pool */
90#define FSCACHE_OP_MYTHREAD 0x0003 /* - processing is done be issuing thread, not pool */
91#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */ 87#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */
92#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */ 88#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */
93#define FSCACHE_OP_DEAD 6 /* op is now dead */ 89#define FSCACHE_OP_DEAD 6 /* op is now dead */
@@ -105,7 +101,8 @@ struct fscache_operation {
105 /* operation releaser */ 101 /* operation releaser */
106 fscache_operation_release_t release; 102 fscache_operation_release_t release;
107 103
108#ifdef CONFIG_SLOW_WORK_DEBUG 104#ifdef CONFIG_WORKQUEUE_DEBUGFS
105 struct work_struct put_work; /* work to delay operation put */
109 const char *name; /* operation name */ 106 const char *name; /* operation name */
110 const char *state; /* operation state */ 107 const char *state; /* operation state */
111#define fscache_set_op_name(OP, N) do { (OP)->name = (N); } while(0) 108#define fscache_set_op_name(OP, N) do { (OP)->name = (N); } while(0)
@@ -117,7 +114,7 @@ struct fscache_operation {
117}; 114};
118 115
119extern atomic_t fscache_op_debug_id; 116extern atomic_t fscache_op_debug_id;
120extern const struct slow_work_ops fscache_op_slow_work_ops; 117extern void fscache_op_work_func(struct work_struct *work);
121 118
122extern void fscache_enqueue_operation(struct fscache_operation *); 119extern void fscache_enqueue_operation(struct fscache_operation *);
123extern void fscache_put_operation(struct fscache_operation *); 120extern void fscache_put_operation(struct fscache_operation *);
@@ -128,33 +125,21 @@ extern void fscache_put_operation(struct fscache_operation *);
128 * @release: The release function to assign 125 * @release: The release function to assign
129 * 126 *
130 * Do basic initialisation of an operation. The caller must still set flags, 127 * Do basic initialisation of an operation. The caller must still set flags,
131 * object, either fast_work or slow_work if necessary, and processor if needed. 128 * object and processor if needed.
132 */ 129 */
133static inline void fscache_operation_init(struct fscache_operation *op, 130static inline void fscache_operation_init(struct fscache_operation *op,
134 fscache_operation_release_t release) 131 fscache_operation_processor_t processor,
132 fscache_operation_release_t release)
135{ 133{
134 INIT_WORK(&op->work, fscache_op_work_func);
136 atomic_set(&op->usage, 1); 135 atomic_set(&op->usage, 1);
137 op->debug_id = atomic_inc_return(&fscache_op_debug_id); 136 op->debug_id = atomic_inc_return(&fscache_op_debug_id);
137 op->processor = processor;
138 op->release = release; 138 op->release = release;
139 INIT_LIST_HEAD(&op->pend_link); 139 INIT_LIST_HEAD(&op->pend_link);
140 fscache_set_op_state(op, "Init"); 140 fscache_set_op_state(op, "Init");
141} 141}
142 142
143/**
144 * fscache_operation_init_slow - Do additional initialisation of a slow op
145 * @op: The operation to initialise
146 * @processor: The processor function to assign
147 *
148 * Do additional initialisation of an operation as required for slow work.
149 */
150static inline
151void fscache_operation_init_slow(struct fscache_operation *op,
152 fscache_operation_processor_t processor)
153{
154 op->processor = processor;
155 slow_work_init(&op->slow_work, &fscache_op_slow_work_ops);
156}
157
158/* 143/*
159 * data read operation 144 * data read operation
160 */ 145 */
@@ -389,7 +374,7 @@ struct fscache_object {
389 struct fscache_cache *cache; /* cache that supplied this object */ 374 struct fscache_cache *cache; /* cache that supplied this object */
390 struct fscache_cookie *cookie; /* netfs's file/index object */ 375 struct fscache_cookie *cookie; /* netfs's file/index object */
391 struct fscache_object *parent; /* parent object */ 376 struct fscache_object *parent; /* parent object */
392 struct slow_work work; /* attention scheduling record */ 377 struct work_struct work; /* attention scheduling record */
393 struct list_head dependents; /* FIFO of dependent objects */ 378 struct list_head dependents; /* FIFO of dependent objects */
394 struct list_head dep_link; /* link in parent's dependents list */ 379 struct list_head dep_link; /* link in parent's dependents list */
395 struct list_head pending_ops; /* unstarted operations on this object */ 380 struct list_head pending_ops; /* unstarted operations on this object */
@@ -411,7 +396,7 @@ extern const char *fscache_object_states[];
411 (test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \ 396 (test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \
412 (obj)->state >= FSCACHE_OBJECT_DYING) 397 (obj)->state >= FSCACHE_OBJECT_DYING)
413 398
414extern const struct slow_work_ops fscache_object_slow_work_ops; 399extern void fscache_object_work_func(struct work_struct *work);
415 400
416/** 401/**
417 * fscache_object_init - Initialise a cache object description 402 * fscache_object_init - Initialise a cache object description
@@ -433,7 +418,7 @@ void fscache_object_init(struct fscache_object *object,
433 spin_lock_init(&object->lock); 418 spin_lock_init(&object->lock);
434 INIT_LIST_HEAD(&object->cache_link); 419 INIT_LIST_HEAD(&object->cache_link);
435 INIT_HLIST_NODE(&object->cookie_link); 420 INIT_HLIST_NODE(&object->cookie_link);
436 vslow_work_init(&object->work, &fscache_object_slow_work_ops); 421 INIT_WORK(&object->work, fscache_object_work_func);
437 INIT_LIST_HEAD(&object->dependents); 422 INIT_LIST_HEAD(&object->dependents);
438 INIT_LIST_HEAD(&object->dep_link); 423 INIT_LIST_HEAD(&object->dep_link);
439 INIT_LIST_HEAD(&object->pending_ops); 424 INIT_LIST_HEAD(&object->pending_ops);
@@ -534,6 +519,8 @@ extern void fscache_io_error(struct fscache_cache *cache);
534extern void fscache_mark_pages_cached(struct fscache_retrieval *op, 519extern void fscache_mark_pages_cached(struct fscache_retrieval *op,
535 struct pagevec *pagevec); 520 struct pagevec *pagevec);
536 521
522extern bool fscache_object_sleep_till_congested(signed long *timeoutp);
523
537extern enum fscache_checkaux fscache_check_aux(struct fscache_object *object, 524extern enum fscache_checkaux fscache_check_aux(struct fscache_object *object,
538 const void *data, 525 const void *data,
539 uint16_t datalen); 526 uint16_t datalen);
diff --git a/include/linux/fscache.h b/include/linux/fscache.h
index 595ce49288b7..ec0dad5ab90f 100644
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -85,7 +85,7 @@ struct fscache_cookie_def {
85 85
86 /* get an index key 86 /* get an index key
87 * - should store the key data in the buffer 87 * - should store the key data in the buffer
88 * - should return the amount of amount stored 88 * - should return the amount of data stored
89 * - not permitted to return an error 89 * - not permitted to return an error
90 * - the netfs data from the cookie being used as the source is 90 * - the netfs data from the cookie being used as the source is
91 * presented 91 * presented
@@ -454,6 +454,7 @@ int fscache_read_or_alloc_page(struct fscache_cookie *cookie,
454 * @cookie: The cookie representing the cache object 454 * @cookie: The cookie representing the cache object
455 * @mapping: The netfs inode mapping to which the pages will be attached 455 * @mapping: The netfs inode mapping to which the pages will be attached
456 * @pages: A list of potential netfs pages to be filled 456 * @pages: A list of potential netfs pages to be filled
457 * @nr_pages: Number of pages to be read and/or allocated
457 * @end_io_func: The callback to invoke when and if each page is filled 458 * @end_io_func: The callback to invoke when and if each page is filled
458 * @context: An arbitrary piece of data to pass on to end_io_func() 459 * @context: An arbitrary piece of data to pass on to end_io_func()
459 * @gfp: The conditions under which memory allocation should be made 460 * @gfp: The conditions under which memory allocation should be made
diff --git a/include/linux/fsl-diu-fb.h b/include/linux/fsl-diu-fb.h
new file mode 100644
index 000000000000..fc295d7ea463
--- /dev/null
+++ b/include/linux/fsl-diu-fb.h
@@ -0,0 +1,223 @@
1/*
2 * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * Freescale DIU Frame Buffer device driver
5 *
6 * Authors: Hongjun Chen <hong-jun.chen@freescale.com>
7 * Paul Widmer <paul.widmer@freescale.com>
8 * Srikanth Srinivasan <srikanth.srinivasan@freescale.com>
9 * York Sun <yorksun@freescale.com>
10 *
11 * Based on imxfb.c Copyright (C) 2004 S.Hauer, Pengutronix
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 *
18 */
19
20#ifndef __FSL_DIU_FB_H__
21#define __FSL_DIU_FB_H__
22
23/* Arbitrary threshold to determine the allocation method
24 * See mpc8610fb_set_par(), map_video_memory(), and unmap_video_memory()
25 */
26#define MEM_ALLOC_THRESHOLD (1024*768*4+32)
27/* Minimum value that the pixel clock can be set to in pico seconds
28 * This is determined by platform clock/3 where the minimum platform
29 * clock is 533MHz. This gives 5629 pico seconds.
30 */
31#define MIN_PIX_CLK 5629
32#define MAX_PIX_CLK 96096
33
34#include <linux/types.h>
35
36struct mfb_alpha {
37 int enable;
38 int alpha;
39};
40
41struct mfb_chroma_key {
42 int enable;
43 __u8 red_max;
44 __u8 green_max;
45 __u8 blue_max;
46 __u8 red_min;
47 __u8 green_min;
48 __u8 blue_min;
49};
50
51struct aoi_display_offset {
52 int x_aoi_d;
53 int y_aoi_d;
54};
55
56#define MFB_SET_CHROMA_KEY _IOW('M', 1, struct mfb_chroma_key)
57#define MFB_WAIT_FOR_VSYNC _IOW('F', 0x20, u_int32_t)
58#define MFB_SET_BRIGHTNESS _IOW('M', 3, __u8)
59
60#define MFB_SET_ALPHA 0x80014d00
61#define MFB_GET_ALPHA 0x40014d00
62#define MFB_SET_AOID 0x80084d04
63#define MFB_GET_AOID 0x40084d04
64#define MFB_SET_PIXFMT 0x80014d08
65#define MFB_GET_PIXFMT 0x40014d08
66
67#define FBIOGET_GWINFO 0x46E0
68#define FBIOPUT_GWINFO 0x46E1
69
70#ifdef __KERNEL__
71#include <linux/spinlock.h>
72
73/*
74 * These are the fields of area descriptor(in DDR memory) for every plane
75 */
76struct diu_ad {
77 /* Word 0(32-bit) in DDR memory */
78/* __u16 comp; */
79/* __u16 pixel_s:2; */
80/* __u16 pallete:1; */
81/* __u16 red_c:2; */
82/* __u16 green_c:2; */
83/* __u16 blue_c:2; */
84/* __u16 alpha_c:3; */
85/* __u16 byte_f:1; */
86/* __u16 res0:3; */
87
88 __be32 pix_fmt; /* hard coding pixel format */
89
90 /* Word 1(32-bit) in DDR memory */
91 __le32 addr;
92
93 /* Word 2(32-bit) in DDR memory */
94/* __u32 delta_xs:11; */
95/* __u32 res1:1; */
96/* __u32 delta_ys:11; */
97/* __u32 res2:1; */
98/* __u32 g_alpha:8; */
99 __le32 src_size_g_alpha;
100
101 /* Word 3(32-bit) in DDR memory */
102/* __u32 delta_xi:11; */
103/* __u32 res3:5; */
104/* __u32 delta_yi:11; */
105/* __u32 res4:3; */
106/* __u32 flip:2; */
107 __le32 aoi_size;
108
109 /* Word 4(32-bit) in DDR memory */
110 /*__u32 offset_xi:11;
111 __u32 res5:5;
112 __u32 offset_yi:11;
113 __u32 res6:5;
114 */
115 __le32 offset_xyi;
116
117 /* Word 5(32-bit) in DDR memory */
118 /*__u32 offset_xd:11;
119 __u32 res7:5;
120 __u32 offset_yd:11;
121 __u32 res8:5; */
122 __le32 offset_xyd;
123
124
125 /* Word 6(32-bit) in DDR memory */
126 __u8 ckmax_r;
127 __u8 ckmax_g;
128 __u8 ckmax_b;
129 __u8 res9;
130
131 /* Word 7(32-bit) in DDR memory */
132 __u8 ckmin_r;
133 __u8 ckmin_g;
134 __u8 ckmin_b;
135 __u8 res10;
136/* __u32 res10:8; */
137
138 /* Word 8(32-bit) in DDR memory */
139 __le32 next_ad;
140
141 /* Word 9(32-bit) in DDR memory, just for 64-bit aligned */
142 __u32 paddr;
143} __attribute__ ((packed));
144
145/* DIU register map */
146struct diu {
147 __be32 desc[3];
148 __be32 gamma;
149 __be32 pallete;
150 __be32 cursor;
151 __be32 curs_pos;
152 __be32 diu_mode;
153 __be32 bgnd;
154 __be32 bgnd_wb;
155 __be32 disp_size;
156 __be32 wb_size;
157 __be32 wb_mem_addr;
158 __be32 hsyn_para;
159 __be32 vsyn_para;
160 __be32 syn_pol;
161 __be32 thresholds;
162 __be32 int_status;
163 __be32 int_mask;
164 __be32 colorbar[8];
165 __be32 filling;
166 __be32 plut;
167} __attribute__ ((packed));
168
169struct diu_hw {
170 struct diu *diu_reg;
171 spinlock_t reg_lock;
172
173 __u32 mode; /* DIU operation mode */
174};
175
176struct diu_addr {
177 __u8 __iomem *vaddr; /* Virtual address */
178 dma_addr_t paddr; /* Physical address */
179 __u32 offset;
180};
181
182struct diu_pool {
183 struct diu_addr ad;
184 struct diu_addr gamma;
185 struct diu_addr pallete;
186 struct diu_addr cursor;
187};
188
189#define FSL_DIU_BASE_OFFSET 0x2C000 /* Offset of DIU */
190#define INT_LCDC 64 /* DIU interrupt number */
191
192#define FSL_AOI_NUM 6 /* 5 AOIs and one dummy AOI */
193 /* 1 for plane 0, 2 for plane 1&2 each */
194
195/* Minimum X and Y resolutions */
196#define MIN_XRES 64
197#define MIN_YRES 64
198
199/* HW cursor parameters */
200#define MAX_CURS 32
201
202/* Modes of operation of DIU */
203#define MFB_MODE0 0 /* DIU off */
204#define MFB_MODE1 1 /* All three planes output to display */
205#define MFB_MODE2 2 /* Plane 1 to display, planes 2+3 written back*/
206#define MFB_MODE3 3 /* All three planes written back to memory */
207#define MFB_MODE4 4 /* Color bar generation */
208
209/* INT_STATUS/INT_MASK field descriptions */
210#define INT_VSYNC 0x01 /* Vsync interrupt */
211#define INT_VSYNC_WB 0x02 /* Vsync interrupt for write back operation */
212#define INT_UNDRUN 0x04 /* Under run exception interrupt */
213#define INT_PARERR 0x08 /* Display parameters error interrupt */
214#define INT_LS_BF_VS 0x10 /* Lines before vsync. interrupt */
215
216/* Panels'operation modes */
217#define MFB_TYPE_OUTPUT 0 /* Panel output to display */
218#define MFB_TYPE_OFF 1 /* Panel off */
219#define MFB_TYPE_WB 2 /* Panel written back to memory */
220#define MFB_TYPE_TEST 3 /* Panel generate color bar */
221
222#endif /* __KERNEL__ */
223#endif /* __FSL_DIU_FB_H__ */
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 01755909ce81..59d0df43ff9d 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -11,8 +11,6 @@
11 * (C) Copyright 2005 Robert Love 11 * (C) Copyright 2005 Robert Love
12 */ 12 */
13 13
14#include <linux/dnotify.h>
15#include <linux/inotify.h>
16#include <linux/fsnotify_backend.h> 14#include <linux/fsnotify_backend.h>
17#include <linux/audit.h> 15#include <linux/audit.h>
18#include <linux/slab.h> 16#include <linux/slab.h>
@@ -21,35 +19,53 @@
21 * fsnotify_d_instantiate - instantiate a dentry for inode 19 * fsnotify_d_instantiate - instantiate a dentry for inode
22 * Called with dcache_lock held. 20 * Called with dcache_lock held.
23 */ 21 */
24static inline void fsnotify_d_instantiate(struct dentry *entry, 22static inline void fsnotify_d_instantiate(struct dentry *dentry,
25 struct inode *inode) 23 struct inode *inode)
26{ 24{
27 __fsnotify_d_instantiate(entry, inode); 25 __fsnotify_d_instantiate(dentry, inode);
28
29 inotify_d_instantiate(entry, inode);
30} 26}
31 27
32/* Notify this dentry's parent about a child's events. */ 28/* Notify this dentry's parent about a child's events. */
33static inline void fsnotify_parent(struct dentry *dentry, __u32 mask) 29static inline void fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask)
34{ 30{
35 __fsnotify_parent(dentry, mask); 31 if (!dentry)
32 dentry = path->dentry;
33
34 __fsnotify_parent(path, dentry, mask);
35}
36 36
37 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); 37/* simple call site for access decisions */
38static inline int fsnotify_perm(struct file *file, int mask)
39{
40 struct path *path = &file->f_path;
41 struct inode *inode = path->dentry->d_inode;
42 __u32 fsnotify_mask = 0;
43
44 if (file->f_mode & FMODE_NONOTIFY)
45 return 0;
46 if (!(mask & (MAY_READ | MAY_OPEN)))
47 return 0;
48 if (mask & MAY_OPEN)
49 fsnotify_mask = FS_OPEN_PERM;
50 else if (mask & MAY_READ)
51 fsnotify_mask = FS_ACCESS_PERM;
52 else
53 BUG();
54
55 return fsnotify(inode, fsnotify_mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
38} 56}
39 57
40/* 58/*
41 * fsnotify_d_move - entry has been moved 59 * fsnotify_d_move - dentry has been moved
42 * Called with dcache_lock and entry->d_lock held. 60 * Called with dcache_lock and dentry->d_lock held.
43 */ 61 */
44static inline void fsnotify_d_move(struct dentry *entry) 62static inline void fsnotify_d_move(struct dentry *dentry)
45{ 63{
46 /* 64 /*
47 * On move we need to update entry->d_flags to indicate if the new parent 65 * On move we need to update dentry->d_flags to indicate if the new parent
48 * cares about events from this entry. 66 * cares about events from this dentry.
49 */ 67 */
50 __fsnotify_update_dcache_flags(entry); 68 __fsnotify_update_dcache_flags(dentry);
51
52 inotify_d_move(entry);
53} 69}
54 70
55/* 71/*
@@ -57,8 +73,6 @@ static inline void fsnotify_d_move(struct dentry *entry)
57 */ 73 */
58static inline void fsnotify_link_count(struct inode *inode) 74static inline void fsnotify_link_count(struct inode *inode)
59{ 75{
60 inotify_inode_queue_event(inode, IN_ATTRIB, 0, NULL, NULL);
61
62 fsnotify(inode, FS_ATTRIB, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 76 fsnotify(inode, FS_ATTRIB, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
63} 77}
64 78
@@ -66,45 +80,31 @@ static inline void fsnotify_link_count(struct inode *inode)
66 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir 80 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir
67 */ 81 */
68static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, 82static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
69 const char *old_name, 83 const unsigned char *old_name,
70 int isdir, struct inode *target, struct dentry *moved) 84 int isdir, struct inode *target, struct dentry *moved)
71{ 85{
72 struct inode *source = moved->d_inode; 86 struct inode *source = moved->d_inode;
73 u32 in_cookie = inotify_get_cookie();
74 u32 fs_cookie = fsnotify_get_cookie(); 87 u32 fs_cookie = fsnotify_get_cookie();
75 __u32 old_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_FROM); 88 __u32 old_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_FROM);
76 __u32 new_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_TO); 89 __u32 new_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_TO);
77 const char *new_name = moved->d_name.name; 90 const unsigned char *new_name = moved->d_name.name;
78 91
79 if (old_dir == new_dir) 92 if (old_dir == new_dir)
80 old_dir_mask |= FS_DN_RENAME; 93 old_dir_mask |= FS_DN_RENAME;
81 94
82 if (isdir) { 95 if (isdir) {
83 isdir = IN_ISDIR;
84 old_dir_mask |= FS_IN_ISDIR; 96 old_dir_mask |= FS_IN_ISDIR;
85 new_dir_mask |= FS_IN_ISDIR; 97 new_dir_mask |= FS_IN_ISDIR;
86 } 98 }
87 99
88 inotify_inode_queue_event(old_dir, IN_MOVED_FROM|isdir, in_cookie, old_name,
89 source);
90 inotify_inode_queue_event(new_dir, IN_MOVED_TO|isdir, in_cookie, new_name,
91 source);
92
93 fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie); 100 fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie);
94 fsnotify(new_dir, new_dir_mask, new_dir, FSNOTIFY_EVENT_INODE, new_name, fs_cookie); 101 fsnotify(new_dir, new_dir_mask, new_dir, FSNOTIFY_EVENT_INODE, new_name, fs_cookie);
95 102
96 if (target) { 103 if (target)
97 inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL, NULL);
98 inotify_inode_is_dead(target);
99
100 /* this is really a link_count change not a removal */
101 fsnotify_link_count(target); 104 fsnotify_link_count(target);
102 }
103 105
104 if (source) { 106 if (source)
105 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL);
106 fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0); 107 fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0);
107 }
108 audit_inode_child(moved, new_dir); 108 audit_inode_child(moved, new_dir);
109} 109}
110 110
@@ -117,6 +117,14 @@ static inline void fsnotify_inode_delete(struct inode *inode)
117} 117}
118 118
119/* 119/*
120 * fsnotify_vfsmount_delete - a vfsmount is being destroyed, clean up is needed
121 */
122static inline void fsnotify_vfsmount_delete(struct vfsmount *mnt)
123{
124 __fsnotify_vfsmount_delete(mnt);
125}
126
127/*
120 * fsnotify_nameremove - a filename was removed from a directory 128 * fsnotify_nameremove - a filename was removed from a directory
121 */ 129 */
122static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) 130static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
@@ -126,7 +134,7 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
126 if (isdir) 134 if (isdir)
127 mask |= FS_IN_ISDIR; 135 mask |= FS_IN_ISDIR;
128 136
129 fsnotify_parent(dentry, mask); 137 fsnotify_parent(NULL, dentry, mask);
130} 138}
131 139
132/* 140/*
@@ -134,9 +142,6 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
134 */ 142 */
135static inline void fsnotify_inoderemove(struct inode *inode) 143static inline void fsnotify_inoderemove(struct inode *inode)
136{ 144{
137 inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL, NULL);
138 inotify_inode_is_dead(inode);
139
140 fsnotify(inode, FS_DELETE_SELF, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 145 fsnotify(inode, FS_DELETE_SELF, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
141 __fsnotify_inode_delete(inode); 146 __fsnotify_inode_delete(inode);
142} 147}
@@ -146,8 +151,6 @@ static inline void fsnotify_inoderemove(struct inode *inode)
146 */ 151 */
147static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) 152static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
148{ 153{
149 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name,
150 dentry->d_inode);
151 audit_inode_child(dentry, inode); 154 audit_inode_child(dentry, inode);
152 155
153 fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); 156 fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0);
@@ -160,8 +163,6 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
160 */ 163 */
161static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry) 164static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry)
162{ 165{
163 inotify_inode_queue_event(dir, IN_CREATE, 0, new_dentry->d_name.name,
164 inode);
165 fsnotify_link_count(inode); 166 fsnotify_link_count(inode);
166 audit_inode_child(new_dentry, dir); 167 audit_inode_child(new_dentry, dir);
167 168
@@ -176,7 +177,6 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
176 __u32 mask = (FS_CREATE | FS_IN_ISDIR); 177 __u32 mask = (FS_CREATE | FS_IN_ISDIR);
177 struct inode *d_inode = dentry->d_inode; 178 struct inode *d_inode = dentry->d_inode;
178 179
179 inotify_inode_queue_event(inode, mask, 0, dentry->d_name.name, d_inode);
180 audit_inode_child(dentry, inode); 180 audit_inode_child(dentry, inode);
181 181
182 fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); 182 fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0);
@@ -185,52 +185,55 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
185/* 185/*
186 * fsnotify_access - file was read 186 * fsnotify_access - file was read
187 */ 187 */
188static inline void fsnotify_access(struct dentry *dentry) 188static inline void fsnotify_access(struct file *file)
189{ 189{
190 struct inode *inode = dentry->d_inode; 190 struct path *path = &file->f_path;
191 struct inode *inode = path->dentry->d_inode;
191 __u32 mask = FS_ACCESS; 192 __u32 mask = FS_ACCESS;
192 193
193 if (S_ISDIR(inode->i_mode)) 194 if (S_ISDIR(inode->i_mode))
194 mask |= FS_IN_ISDIR; 195 mask |= FS_IN_ISDIR;
195 196
196 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 197 if (!(file->f_mode & FMODE_NONOTIFY)) {
197 198 fsnotify_parent(path, NULL, mask);
198 fsnotify_parent(dentry, mask); 199 fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
199 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 200 }
200} 201}
201 202
202/* 203/*
203 * fsnotify_modify - file was modified 204 * fsnotify_modify - file was modified
204 */ 205 */
205static inline void fsnotify_modify(struct dentry *dentry) 206static inline void fsnotify_modify(struct file *file)
206{ 207{
207 struct inode *inode = dentry->d_inode; 208 struct path *path = &file->f_path;
209 struct inode *inode = path->dentry->d_inode;
208 __u32 mask = FS_MODIFY; 210 __u32 mask = FS_MODIFY;
209 211
210 if (S_ISDIR(inode->i_mode)) 212 if (S_ISDIR(inode->i_mode))
211 mask |= FS_IN_ISDIR; 213 mask |= FS_IN_ISDIR;
212 214
213 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 215 if (!(file->f_mode & FMODE_NONOTIFY)) {
214 216 fsnotify_parent(path, NULL, mask);
215 fsnotify_parent(dentry, mask); 217 fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
216 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 218 }
217} 219}
218 220
219/* 221/*
220 * fsnotify_open - file was opened 222 * fsnotify_open - file was opened
221 */ 223 */
222static inline void fsnotify_open(struct dentry *dentry) 224static inline void fsnotify_open(struct file *file)
223{ 225{
224 struct inode *inode = dentry->d_inode; 226 struct path *path = &file->f_path;
227 struct inode *inode = path->dentry->d_inode;
225 __u32 mask = FS_OPEN; 228 __u32 mask = FS_OPEN;
226 229
227 if (S_ISDIR(inode->i_mode)) 230 if (S_ISDIR(inode->i_mode))
228 mask |= FS_IN_ISDIR; 231 mask |= FS_IN_ISDIR;
229 232
230 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 233 if (!(file->f_mode & FMODE_NONOTIFY)) {
231 234 fsnotify_parent(path, NULL, mask);
232 fsnotify_parent(dentry, mask); 235 fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
233 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 236 }
234} 237}
235 238
236/* 239/*
@@ -238,18 +241,18 @@ static inline void fsnotify_open(struct dentry *dentry)
238 */ 241 */
239static inline void fsnotify_close(struct file *file) 242static inline void fsnotify_close(struct file *file)
240{ 243{
241 struct dentry *dentry = file->f_path.dentry; 244 struct path *path = &file->f_path;
242 struct inode *inode = dentry->d_inode; 245 struct inode *inode = file->f_path.dentry->d_inode;
243 fmode_t mode = file->f_mode; 246 fmode_t mode = file->f_mode;
244 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE; 247 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE;
245 248
246 if (S_ISDIR(inode->i_mode)) 249 if (S_ISDIR(inode->i_mode))
247 mask |= FS_IN_ISDIR; 250 mask |= FS_IN_ISDIR;
248 251
249 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 252 if (!(file->f_mode & FMODE_NONOTIFY)) {
250 253 fsnotify_parent(path, NULL, mask);
251 fsnotify_parent(dentry, mask); 254 fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
252 fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); 255 }
253} 256}
254 257
255/* 258/*
@@ -263,9 +266,7 @@ static inline void fsnotify_xattr(struct dentry *dentry)
263 if (S_ISDIR(inode->i_mode)) 266 if (S_ISDIR(inode->i_mode))
264 mask |= FS_IN_ISDIR; 267 mask |= FS_IN_ISDIR;
265 268
266 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 269 fsnotify_parent(NULL, dentry, mask);
267
268 fsnotify_parent(dentry, mask);
269 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 270 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
270} 271}
271 272
@@ -299,19 +300,18 @@ static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid)
299 if (mask) { 300 if (mask) {
300 if (S_ISDIR(inode->i_mode)) 301 if (S_ISDIR(inode->i_mode))
301 mask |= FS_IN_ISDIR; 302 mask |= FS_IN_ISDIR;
302 inotify_inode_queue_event(inode, mask, 0, NULL, NULL);
303 303
304 fsnotify_parent(dentry, mask); 304 fsnotify_parent(NULL, dentry, mask);
305 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 305 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
306 } 306 }
307} 307}
308 308
309#if defined(CONFIG_INOTIFY) || defined(CONFIG_FSNOTIFY) /* notify helpers */ 309#if defined(CONFIG_FSNOTIFY) /* notify helpers */
310 310
311/* 311/*
312 * fsnotify_oldname_init - save off the old filename before we change it 312 * fsnotify_oldname_init - save off the old filename before we change it
313 */ 313 */
314static inline const char *fsnotify_oldname_init(const char *name) 314static inline const unsigned char *fsnotify_oldname_init(const unsigned char *name)
315{ 315{
316 return kstrdup(name, GFP_KERNEL); 316 return kstrdup(name, GFP_KERNEL);
317} 317}
@@ -319,22 +319,22 @@ static inline const char *fsnotify_oldname_init(const char *name)
319/* 319/*
320 * fsnotify_oldname_free - free the name we got from fsnotify_oldname_init 320 * fsnotify_oldname_free - free the name we got from fsnotify_oldname_init
321 */ 321 */
322static inline void fsnotify_oldname_free(const char *old_name) 322static inline void fsnotify_oldname_free(const unsigned char *old_name)
323{ 323{
324 kfree(old_name); 324 kfree(old_name);
325} 325}
326 326
327#else /* CONFIG_INOTIFY || CONFIG_FSNOTIFY */ 327#else /* CONFIG_FSNOTIFY */
328 328
329static inline const char *fsnotify_oldname_init(const char *name) 329static inline const char *fsnotify_oldname_init(const unsigned char *name)
330{ 330{
331 return NULL; 331 return NULL;
332} 332}
333 333
334static inline void fsnotify_oldname_free(const char *old_name) 334static inline void fsnotify_oldname_free(const unsigned char *old_name)
335{ 335{
336} 336}
337 337
338#endif /* ! CONFIG_INOTIFY */ 338#endif /* CONFIG_FSNOTIFY */
339 339
340#endif /* _LINUX_FS_NOTIFY_H */ 340#endif /* _LINUX_FS_NOTIFY_H */
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index 4d6f47b51189..ed36fb57c426 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -41,6 +41,10 @@
41#define FS_Q_OVERFLOW 0x00004000 /* Event queued overflowed */ 41#define FS_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
42#define FS_IN_IGNORED 0x00008000 /* last inotify event here */ 42#define FS_IN_IGNORED 0x00008000 /* last inotify event here */
43 43
44#define FS_OPEN_PERM 0x00010000 /* open event in an permission hook */
45#define FS_ACCESS_PERM 0x00020000 /* access event in a permissions hook */
46
47#define FS_EXCL_UNLINK 0x04000000 /* do not send events if object is unlinked */
44#define FS_IN_ISDIR 0x40000000 /* event occurred against dir */ 48#define FS_IN_ISDIR 0x40000000 /* event occurred against dir */
45#define FS_IN_ONESHOT 0x80000000 /* only send event once */ 49#define FS_IN_ONESHOT 0x80000000 /* only send event once */
46 50
@@ -58,13 +62,20 @@
58 FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE |\ 62 FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE |\
59 FS_DELETE) 63 FS_DELETE)
60 64
61/* listeners that hard code group numbers near the top */ 65#define FS_MOVE (FS_MOVED_FROM | FS_MOVED_TO)
62#define DNOTIFY_GROUP_NUM UINT_MAX 66
63#define INOTIFY_GROUP_NUM (DNOTIFY_GROUP_NUM-1) 67#define ALL_FSNOTIFY_EVENTS (FS_ACCESS | FS_MODIFY | FS_ATTRIB | \
68 FS_CLOSE_WRITE | FS_CLOSE_NOWRITE | FS_OPEN | \
69 FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE | \
70 FS_DELETE | FS_DELETE_SELF | FS_MOVE_SELF | \
71 FS_UNMOUNT | FS_Q_OVERFLOW | FS_IN_IGNORED | \
72 FS_OPEN_PERM | FS_ACCESS_PERM | FS_EXCL_UNLINK | \
73 FS_IN_ISDIR | FS_IN_ONESHOT | FS_DN_RENAME | \
74 FS_DN_MULTISHOT | FS_EVENT_ON_CHILD)
64 75
65struct fsnotify_group; 76struct fsnotify_group;
66struct fsnotify_event; 77struct fsnotify_event;
67struct fsnotify_mark_entry; 78struct fsnotify_mark;
68struct fsnotify_event_private_data; 79struct fsnotify_event_private_data;
69 80
70/* 81/*
@@ -80,10 +91,16 @@ struct fsnotify_event_private_data;
80 * valid group and inode to use to clean up. 91 * valid group and inode to use to clean up.
81 */ 92 */
82struct fsnotify_ops { 93struct fsnotify_ops {
83 bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode, __u32 mask); 94 bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode,
84 int (*handle_event)(struct fsnotify_group *group, struct fsnotify_event *event); 95 struct fsnotify_mark *inode_mark,
96 struct fsnotify_mark *vfsmount_mark,
97 __u32 mask, void *data, int data_type);
98 int (*handle_event)(struct fsnotify_group *group,
99 struct fsnotify_mark *inode_mark,
100 struct fsnotify_mark *vfsmount_mark,
101 struct fsnotify_event *event);
85 void (*free_group_priv)(struct fsnotify_group *group); 102 void (*free_group_priv)(struct fsnotify_group *group);
86 void (*freeing_mark)(struct fsnotify_mark_entry *entry, struct fsnotify_group *group); 103 void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group);
87 void (*free_event_priv)(struct fsnotify_event_private_data *priv); 104 void (*free_event_priv)(struct fsnotify_event_private_data *priv);
88}; 105};
89 106
@@ -95,22 +112,6 @@ struct fsnotify_ops {
95 */ 112 */
96struct fsnotify_group { 113struct fsnotify_group {
97 /* 114 /*
98 * global list of all groups receiving events from fsnotify.
99 * anchored by fsnotify_groups and protected by either fsnotify_grp_mutex
100 * or fsnotify_grp_srcu depending on write vs read.
101 */
102 struct list_head group_list;
103
104 /*
105 * Defines all of the event types in which this group is interested.
106 * This mask is a bitwise OR of the FS_* events from above. Each time
107 * this mask changes for a group (if it changes) the correct functions
108 * must be called to update the global structures which indicate global
109 * interest in event types.
110 */
111 __u32 mask;
112
113 /*
114 * How the refcnt is used is up to each group. When the refcnt hits 0 115 * How the refcnt is used is up to each group. When the refcnt hits 0
115 * fsnotify will clean up all of the resources associated with this group. 116 * fsnotify will clean up all of the resources associated with this group.
116 * As an example, the dnotify group will always have a refcnt=1 and that 117 * As an example, the dnotify group will always have a refcnt=1 and that
@@ -119,7 +120,6 @@ struct fsnotify_group {
119 * closed. 120 * closed.
120 */ 121 */
121 atomic_t refcnt; /* things with interest in this group */ 122 atomic_t refcnt; /* things with interest in this group */
122 unsigned int group_num; /* simply prevents accidental group collision */
123 123
124 const struct fsnotify_ops *ops; /* how this group handles things */ 124 const struct fsnotify_ops *ops; /* how this group handles things */
125 125
@@ -130,15 +130,12 @@ struct fsnotify_group {
130 unsigned int q_len; /* events on the queue */ 130 unsigned int q_len; /* events on the queue */
131 unsigned int max_events; /* maximum events allowed on the list */ 131 unsigned int max_events; /* maximum events allowed on the list */
132 132
133 /* stores all fastapth entries assoc with this group so they can be cleaned on unregister */ 133 /* stores all fastpath marks assoc with this group so they can be cleaned on unregister */
134 spinlock_t mark_lock; /* protect mark_entries list */ 134 spinlock_t mark_lock; /* protect marks_list */
135 atomic_t num_marks; /* 1 for each mark entry and 1 for not being 135 atomic_t num_marks; /* 1 for each mark and 1 for not being
136 * past the point of no return when freeing 136 * past the point of no return when freeing
137 * a group */ 137 * a group */
138 struct list_head mark_entries; /* all inode mark entries for this group */ 138 struct list_head marks_list; /* all inode marks for this group */
139
140 /* prevents double list_del of group_list. protected by global fsnotify_grp_mutex */
141 bool on_group_list;
142 139
143 /* groups can define private fields here or use the void *private */ 140 /* groups can define private fields here or use the void *private */
144 union { 141 union {
@@ -152,6 +149,17 @@ struct fsnotify_group {
152 struct user_struct *user; 149 struct user_struct *user;
153 } inotify_data; 150 } inotify_data;
154#endif 151#endif
152#ifdef CONFIG_FANOTIFY
153 struct fanotify_group_private_data {
154#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
155 /* allows a group to block waiting for a userspace response */
156 struct mutex access_mutex;
157 struct list_head access_list;
158 wait_queue_head_t access_waitq;
159#endif /* CONFIG_FANOTIFY_ACCESS_PERMISSIONS */
160 int f_flags;
161 } fanotify_data;
162#endif /* CONFIG_FANOTIFY */
155 }; 163 };
156}; 164};
157 165
@@ -210,20 +218,42 @@ struct fsnotify_event {
210#define FSNOTIFY_EVENT_NONE 0 218#define FSNOTIFY_EVENT_NONE 0
211#define FSNOTIFY_EVENT_PATH 1 219#define FSNOTIFY_EVENT_PATH 1
212#define FSNOTIFY_EVENT_INODE 2 220#define FSNOTIFY_EVENT_INODE 2
213#define FSNOTIFY_EVENT_FILE 3
214 int data_type; /* which of the above union we have */ 221 int data_type; /* which of the above union we have */
215 atomic_t refcnt; /* how many groups still are using/need to send this event */ 222 atomic_t refcnt; /* how many groups still are using/need to send this event */
216 __u32 mask; /* the type of access, bitwise OR for FS_* event types */ 223 __u32 mask; /* the type of access, bitwise OR for FS_* event types */
217 224
218 u32 sync_cookie; /* used to corrolate events, namely inotify mv events */ 225 u32 sync_cookie; /* used to corrolate events, namely inotify mv events */
219 char *file_name; 226 const unsigned char *file_name;
220 size_t name_len; 227 size_t name_len;
228 struct pid *tgid;
229
230#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
231 __u32 response; /* userspace answer to question */
232#endif /* CONFIG_FANOTIFY_ACCESS_PERMISSIONS */
221 233
222 struct list_head private_data_list; /* groups can store private data here */ 234 struct list_head private_data_list; /* groups can store private data here */
223}; 235};
224 236
225/* 237/*
226 * a mark is simply an entry attached to an in core inode which allows an 238 * Inode specific fields in an fsnotify_mark
239 */
240struct fsnotify_inode_mark {
241 struct inode *inode; /* inode this mark is associated with */
242 struct hlist_node i_list; /* list of marks by inode->i_fsnotify_marks */
243 struct list_head free_i_list; /* tmp list used when freeing this mark */
244};
245
246/*
247 * Mount point specific fields in an fsnotify_mark
248 */
249struct fsnotify_vfsmount_mark {
250 struct vfsmount *mnt; /* vfsmount this mark is associated with */
251 struct hlist_node m_list; /* list of marks by inode->i_fsnotify_marks */
252 struct list_head free_m_list; /* tmp list used when freeing this mark */
253};
254
255/*
256 * a mark is simply an object attached to an in core inode which allows an
227 * fsnotify listener to indicate they are either no longer interested in events 257 * fsnotify listener to indicate they are either no longer interested in events
228 * of a type matching mask or only interested in those events. 258 * of a type matching mask or only interested in those events.
229 * 259 *
@@ -232,19 +262,28 @@ struct fsnotify_event {
232 * (such as dnotify) will flush these when the open fd is closed and not at 262 * (such as dnotify) will flush these when the open fd is closed and not at
233 * inode eviction or modification. 263 * inode eviction or modification.
234 */ 264 */
235struct fsnotify_mark_entry { 265struct fsnotify_mark {
236 __u32 mask; /* mask this mark entry is for */ 266 __u32 mask; /* mask this mark is for */
237 /* we hold ref for each i_list and g_list. also one ref for each 'thing' 267 /* we hold ref for each i_list and g_list. also one ref for each 'thing'
238 * in kernel that found and may be using this mark. */ 268 * in kernel that found and may be using this mark. */
239 atomic_t refcnt; /* active things looking at this mark */ 269 atomic_t refcnt; /* active things looking at this mark */
240 struct inode *inode; /* inode this entry is associated with */ 270 struct fsnotify_group *group; /* group this mark is for */
241 struct fsnotify_group *group; /* group this mark entry is for */ 271 struct list_head g_list; /* list of marks by group->i_fsnotify_marks */
242 struct hlist_node i_list; /* list of mark_entries by inode->i_fsnotify_mark_entries */ 272 spinlock_t lock; /* protect group and inode */
243 struct list_head g_list; /* list of mark_entries by group->i_fsnotify_mark_entries */ 273 union {
244 spinlock_t lock; /* protect group, inode, and killme */ 274 struct fsnotify_inode_mark i;
245 struct list_head free_i_list; /* tmp list used when freeing this mark */ 275 struct fsnotify_vfsmount_mark m;
276 };
277 __u32 ignored_mask; /* events types to ignore */
246 struct list_head free_g_list; /* tmp list used when freeing this mark */ 278 struct list_head free_g_list; /* tmp list used when freeing this mark */
247 void (*free_mark)(struct fsnotify_mark_entry *entry); /* called on final put+free */ 279#define FSNOTIFY_MARK_FLAG_INODE 0x01
280#define FSNOTIFY_MARK_FLAG_VFSMOUNT 0x02
281#define FSNOTIFY_MARK_FLAG_OBJECT_PINNED 0x04
282#define FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY 0x08
283#define FSNOTIFY_MARK_FLAG_ALIVE 0x10
284 unsigned int flags; /* vfsmount or inode mark? */
285 struct list_head destroy_list;
286 void (*free_mark)(struct fsnotify_mark *mark); /* called on final put+free */
248}; 287};
249 288
250#ifdef CONFIG_FSNOTIFY 289#ifdef CONFIG_FSNOTIFY
@@ -252,10 +291,11 @@ struct fsnotify_mark_entry {
252/* called from the vfs helpers */ 291/* called from the vfs helpers */
253 292
254/* main fsnotify call to send events */ 293/* main fsnotify call to send events */
255extern void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, 294extern int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
256 const char *name, u32 cookie); 295 const unsigned char *name, u32 cookie);
257extern void __fsnotify_parent(struct dentry *dentry, __u32 mask); 296extern void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask);
258extern void __fsnotify_inode_delete(struct inode *inode); 297extern void __fsnotify_inode_delete(struct inode *inode);
298extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt);
259extern u32 fsnotify_get_cookie(void); 299extern u32 fsnotify_get_cookie(void);
260 300
261static inline int fsnotify_inode_watches_children(struct inode *inode) 301static inline int fsnotify_inode_watches_children(struct inode *inode)
@@ -304,15 +344,9 @@ static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode
304 344
305/* called from fsnotify listeners, such as fanotify or dnotify */ 345/* called from fsnotify listeners, such as fanotify or dnotify */
306 346
307/* must call when a group changes its ->mask */
308extern void fsnotify_recalc_global_mask(void);
309/* get a reference to an existing or create a new group */ 347/* get a reference to an existing or create a new group */
310extern struct fsnotify_group *fsnotify_obtain_group(unsigned int group_num, 348extern struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops);
311 __u32 mask, 349/* drop reference on a group from fsnotify_alloc_group */
312 const struct fsnotify_ops *ops);
313/* run all marks associated with this group and update group->mask */
314extern void fsnotify_recalc_group_mask(struct fsnotify_group *group);
315/* drop reference on a group from fsnotify_obtain_group */
316extern void fsnotify_put_group(struct fsnotify_group *group); 350extern void fsnotify_put_group(struct fsnotify_group *group);
317 351
318/* take a reference to an event */ 352/* take a reference to an event */
@@ -323,8 +357,11 @@ extern struct fsnotify_event_private_data *fsnotify_remove_priv_from_event(struc
323 struct fsnotify_event *event); 357 struct fsnotify_event *event);
324 358
325/* attach the event to the group notification queue */ 359/* attach the event to the group notification queue */
326extern int fsnotify_add_notify_event(struct fsnotify_group *group, struct fsnotify_event *event, 360extern struct fsnotify_event *fsnotify_add_notify_event(struct fsnotify_group *group,
327 struct fsnotify_event_private_data *priv); 361 struct fsnotify_event *event,
362 struct fsnotify_event_private_data *priv,
363 struct fsnotify_event *(*merge)(struct list_head *,
364 struct fsnotify_event *));
328/* true if the group notification queue is empty */ 365/* true if the group notification queue is empty */
329extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group); 366extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group);
330/* return, but do not dequeue the first event on the notification queue */ 367/* return, but do not dequeue the first event on the notification queue */
@@ -334,38 +371,66 @@ extern struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group
334 371
335/* functions used to manipulate the marks attached to inodes */ 372/* functions used to manipulate the marks attached to inodes */
336 373
374/* run all marks associated with a vfsmount and update mnt->mnt_fsnotify_mask */
375extern void fsnotify_recalc_vfsmount_mask(struct vfsmount *mnt);
337/* run all marks associated with an inode and update inode->i_fsnotify_mask */ 376/* run all marks associated with an inode and update inode->i_fsnotify_mask */
338extern void fsnotify_recalc_inode_mask(struct inode *inode); 377extern void fsnotify_recalc_inode_mask(struct inode *inode);
339extern void fsnotify_init_mark(struct fsnotify_mark_entry *entry, void (*free_mark)(struct fsnotify_mark_entry *entry)); 378extern void fsnotify_init_mark(struct fsnotify_mark *mark, void (*free_mark)(struct fsnotify_mark *mark));
340/* find (and take a reference) to a mark associated with group and inode */ 379/* find (and take a reference) to a mark associated with group and inode */
341extern struct fsnotify_mark_entry *fsnotify_find_mark_entry(struct fsnotify_group *group, struct inode *inode); 380extern struct fsnotify_mark *fsnotify_find_inode_mark(struct fsnotify_group *group, struct inode *inode);
381/* find (and take a reference) to a mark associated with group and vfsmount */
382extern struct fsnotify_mark *fsnotify_find_vfsmount_mark(struct fsnotify_group *group, struct vfsmount *mnt);
383/* copy the values from old into new */
384extern void fsnotify_duplicate_mark(struct fsnotify_mark *new, struct fsnotify_mark *old);
385/* set the ignored_mask of a mark */
386extern void fsnotify_set_mark_ignored_mask_locked(struct fsnotify_mark *mark, __u32 mask);
387/* set the mask of a mark (might pin the object into memory */
388extern void fsnotify_set_mark_mask_locked(struct fsnotify_mark *mark, __u32 mask);
342/* attach the mark to both the group and the inode */ 389/* attach the mark to both the group and the inode */
343extern int fsnotify_add_mark(struct fsnotify_mark_entry *entry, struct fsnotify_group *group, struct inode *inode); 390extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group,
391 struct inode *inode, struct vfsmount *mnt, int allow_dups);
344/* given a mark, flag it to be freed when all references are dropped */ 392/* given a mark, flag it to be freed when all references are dropped */
345extern void fsnotify_destroy_mark_by_entry(struct fsnotify_mark_entry *entry); 393extern void fsnotify_destroy_mark(struct fsnotify_mark *mark);
394/* run all the marks in a group, and clear all of the vfsmount marks */
395extern void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group);
396/* run all the marks in a group, and clear all of the inode marks */
397extern void fsnotify_clear_inode_marks_by_group(struct fsnotify_group *group);
398/* run all the marks in a group, and clear all of the marks where mark->flags & flags is true*/
399extern void fsnotify_clear_marks_by_group_flags(struct fsnotify_group *group, unsigned int flags);
346/* run all the marks in a group, and flag them to be freed */ 400/* run all the marks in a group, and flag them to be freed */
347extern void fsnotify_clear_marks_by_group(struct fsnotify_group *group); 401extern void fsnotify_clear_marks_by_group(struct fsnotify_group *group);
348extern void fsnotify_get_mark(struct fsnotify_mark_entry *entry); 402extern void fsnotify_get_mark(struct fsnotify_mark *mark);
349extern void fsnotify_put_mark(struct fsnotify_mark_entry *entry); 403extern void fsnotify_put_mark(struct fsnotify_mark *mark);
350extern void fsnotify_unmount_inodes(struct list_head *list); 404extern void fsnotify_unmount_inodes(struct list_head *list);
351 405
352/* put here because inotify does some weird stuff when destroying watches */ 406/* put here because inotify does some weird stuff when destroying watches */
353extern struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask, 407extern struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask,
354 void *data, int data_is, const char *name, 408 void *data, int data_is,
409 const unsigned char *name,
355 u32 cookie, gfp_t gfp); 410 u32 cookie, gfp_t gfp);
356 411
412/* fanotify likes to change events after they are on lists... */
413extern struct fsnotify_event *fsnotify_clone_event(struct fsnotify_event *old_event);
414extern int fsnotify_replace_event(struct fsnotify_event_holder *old_holder,
415 struct fsnotify_event *new_event);
416
357#else 417#else
358 418
359static inline void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, 419static inline int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
360 const char *name, u32 cookie) 420 const unsigned char *name, u32 cookie)
361{} 421{
422 return 0;
423}
362 424
363static inline void __fsnotify_parent(struct dentry *dentry, __u32 mask) 425static inline void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask)
364{} 426{}
365 427
366static inline void __fsnotify_inode_delete(struct inode *inode) 428static inline void __fsnotify_inode_delete(struct inode *inode)
367{} 429{}
368 430
431static inline void __fsnotify_vfsmount_delete(struct vfsmount *mnt)
432{}
433
369static inline void __fsnotify_update_dcache_flags(struct dentry *dentry) 434static inline void __fsnotify_update_dcache_flags(struct dentry *dentry)
370{} 435{}
371 436
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 41e46330d9be..dcd6a7c3a435 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -1,3 +1,8 @@
1/*
2 * Ftrace header. For implementation details beyond the random comments
3 * scattered below, see: Documentation/trace/ftrace-design.txt
4 */
5
1#ifndef _LINUX_FTRACE_H 6#ifndef _LINUX_FTRACE_H
2#define _LINUX_FTRACE_H 7#define _LINUX_FTRACE_H
3 8
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 3167f2df4126..02b8b24f8f51 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -11,8 +11,6 @@ struct trace_array;
11struct tracer; 11struct tracer;
12struct dentry; 12struct dentry;
13 13
14DECLARE_PER_CPU(struct trace_seq, ftrace_event_seq);
15
16struct trace_print_flags { 14struct trace_print_flags {
17 unsigned long mask; 15 unsigned long mask;
18 const char *name; 16 const char *name;
@@ -58,6 +56,9 @@ struct trace_iterator {
58 struct ring_buffer_iter *buffer_iter[NR_CPUS]; 56 struct ring_buffer_iter *buffer_iter[NR_CPUS];
59 unsigned long iter_flags; 57 unsigned long iter_flags;
60 58
59 /* trace_seq for __print_flags() and __print_symbolic() etc. */
60 struct trace_seq tmp_seq;
61
61 /* The below is zeroed out in pipe_read */ 62 /* The below is zeroed out in pipe_read */
62 struct trace_seq seq; 63 struct trace_seq seq;
63 struct trace_entry *ent; 64 struct trace_entry *ent;
@@ -146,14 +147,19 @@ struct ftrace_event_class {
146 int (*raw_init)(struct ftrace_event_call *); 147 int (*raw_init)(struct ftrace_event_call *);
147}; 148};
148 149
150extern int ftrace_event_reg(struct ftrace_event_call *event,
151 enum trace_reg type);
152
149enum { 153enum {
150 TRACE_EVENT_FL_ENABLED_BIT, 154 TRACE_EVENT_FL_ENABLED_BIT,
151 TRACE_EVENT_FL_FILTERED_BIT, 155 TRACE_EVENT_FL_FILTERED_BIT,
156 TRACE_EVENT_FL_RECORDED_CMD_BIT,
152}; 157};
153 158
154enum { 159enum {
155 TRACE_EVENT_FL_ENABLED = (1 << TRACE_EVENT_FL_ENABLED_BIT), 160 TRACE_EVENT_FL_ENABLED = (1 << TRACE_EVENT_FL_ENABLED_BIT),
156 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), 161 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
162 TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT),
157}; 163};
158 164
159struct ftrace_event_call { 165struct ftrace_event_call {
@@ -171,6 +177,7 @@ struct ftrace_event_call {
171 * 32 bit flags: 177 * 32 bit flags:
172 * bit 1: enabled 178 * bit 1: enabled
173 * bit 2: filter_active 179 * bit 2: filter_active
180 * bit 3: enabled cmd record
174 * 181 *
175 * Changes to flags must hold the event_mutex. 182 * Changes to flags must hold the event_mutex.
176 * 183 *
@@ -257,8 +264,7 @@ static inline void
257perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr, 264perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr,
258 u64 count, struct pt_regs *regs, void *head) 265 u64 count, struct pt_regs *regs, void *head)
259{ 266{
260 perf_tp_event(addr, count, raw_data, size, regs, head); 267 perf_tp_event(addr, count, raw_data, size, regs, head, rctx);
261 perf_swevent_put_recursion_context(rctx);
262} 268}
263#endif 269#endif
264 270
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 88e0eb596919..c3c578e09833 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -37,6 +37,10 @@
37 * 37 *
38 * 7.14 38 * 7.14
39 * - add splice support to fuse device 39 * - add splice support to fuse device
40 *
41 * 7.15
42 * - add store notify
43 * - add retrieve notify
40 */ 44 */
41 45
42#ifndef _LINUX_FUSE_H 46#ifndef _LINUX_FUSE_H
@@ -68,7 +72,7 @@
68#define FUSE_KERNEL_VERSION 7 72#define FUSE_KERNEL_VERSION 7
69 73
70/** Minor version number of this interface */ 74/** Minor version number of this interface */
71#define FUSE_KERNEL_MINOR_VERSION 14 75#define FUSE_KERNEL_MINOR_VERSION 15
72 76
73/** The node ID of the root inode */ 77/** The node ID of the root inode */
74#define FUSE_ROOT_ID 1 78#define FUSE_ROOT_ID 1
@@ -251,6 +255,7 @@ enum fuse_opcode {
251 FUSE_DESTROY = 38, 255 FUSE_DESTROY = 38,
252 FUSE_IOCTL = 39, 256 FUSE_IOCTL = 39,
253 FUSE_POLL = 40, 257 FUSE_POLL = 40,
258 FUSE_NOTIFY_REPLY = 41,
254 259
255 /* CUSE specific operations */ 260 /* CUSE specific operations */
256 CUSE_INIT = 4096, 261 CUSE_INIT = 4096,
@@ -260,6 +265,8 @@ enum fuse_notify_code {
260 FUSE_NOTIFY_POLL = 1, 265 FUSE_NOTIFY_POLL = 1,
261 FUSE_NOTIFY_INVAL_INODE = 2, 266 FUSE_NOTIFY_INVAL_INODE = 2,
262 FUSE_NOTIFY_INVAL_ENTRY = 3, 267 FUSE_NOTIFY_INVAL_ENTRY = 3,
268 FUSE_NOTIFY_STORE = 4,
269 FUSE_NOTIFY_RETRIEVE = 5,
263 FUSE_NOTIFY_CODE_MAX, 270 FUSE_NOTIFY_CODE_MAX,
264}; 271};
265 272
@@ -568,4 +575,29 @@ struct fuse_notify_inval_entry_out {
568 __u32 padding; 575 __u32 padding;
569}; 576};
570 577
578struct fuse_notify_store_out {
579 __u64 nodeid;
580 __u64 offset;
581 __u32 size;
582 __u32 padding;
583};
584
585struct fuse_notify_retrieve_out {
586 __u64 notify_unique;
587 __u64 nodeid;
588 __u64 offset;
589 __u32 size;
590 __u32 padding;
591};
592
593/* Matches the size of fuse_write_in */
594struct fuse_notify_retrieve_in {
595 __u64 dummy1;
596 __u64 offset;
597 __u32 size;
598 __u32 dummy2;
599 __u64 dummy3;
600 __u64 dummy4;
601};
602
571#endif /* _LINUX_FUSE_H */ 603#endif /* _LINUX_FUSE_H */
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index cd0b3f30f48e..ce73a30113b4 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -17,6 +17,8 @@ struct gpio_keys_platform_data {
17 struct gpio_keys_button *buttons; 17 struct gpio_keys_button *buttons;
18 int nbuttons; 18 int nbuttons;
19 unsigned int rep:1; /* enable input subsystem auto repeat */ 19 unsigned int rep:1; /* enable input subsystem auto repeat */
20 int (*enable)(struct device *dev);
21 void (*disable)(struct device *dev);
20}; 22};
21 23
22#endif 24#endif
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 895001f7f4b2..42a0f1d11365 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -311,6 +311,7 @@ struct hid_item {
311#define HID_QUIRK_HIDDEV_FORCE 0x00000010 311#define HID_QUIRK_HIDDEV_FORCE 0x00000010
312#define HID_QUIRK_BADPAD 0x00000020 312#define HID_QUIRK_BADPAD 0x00000020
313#define HID_QUIRK_MULTI_INPUT 0x00000040 313#define HID_QUIRK_MULTI_INPUT 0x00000040
314#define HID_QUIRK_HIDINPUT_FORCE 0x00000080
314#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 315#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
315#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 316#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
316#define HID_QUIRK_NO_INIT_REPORTS 0x20000000 317#define HID_QUIRK_NO_INIT_REPORTS 0x20000000
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index caafd0561aa1..e3060ef85b6d 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -2,6 +2,7 @@
2#define _LINUX_HIGHMEM_H 2#define _LINUX_HIGHMEM_H
3 3
4#include <linux/fs.h> 4#include <linux/fs.h>
5#include <linux/kernel.h>
5#include <linux/mm.h> 6#include <linux/mm.h>
6#include <linux/uaccess.h> 7#include <linux/uaccess.h>
7 8
@@ -72,7 +73,11 @@ static inline void *kmap_atomic(struct page *page, enum km_type idx)
72} 73}
73#define kmap_atomic_prot(page, idx, prot) kmap_atomic(page, idx) 74#define kmap_atomic_prot(page, idx, prot) kmap_atomic(page, idx)
74 75
75#define kunmap_atomic(addr, idx) do { pagefault_enable(); } while (0) 76static inline void kunmap_atomic_notypecheck(void *addr, enum km_type idx)
77{
78 pagefault_enable();
79}
80
76#define kmap_atomic_pfn(pfn, idx) kmap_atomic(pfn_to_page(pfn), (idx)) 81#define kmap_atomic_pfn(pfn, idx) kmap_atomic(pfn_to_page(pfn), (idx))
77#define kmap_atomic_to_page(ptr) virt_to_page(ptr) 82#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
78 83
@@ -81,6 +86,13 @@ static inline void *kmap_atomic(struct page *page, enum km_type idx)
81 86
82#endif /* CONFIG_HIGHMEM */ 87#endif /* CONFIG_HIGHMEM */
83 88
89/* Prevent people trying to call kunmap_atomic() as if it were kunmap() */
90/* kunmap_atomic() should get the return value of kmap_atomic, not the page. */
91#define kunmap_atomic(addr, idx) do { \
92 BUILD_BUG_ON(__same_type((addr), struct page *)); \
93 kunmap_atomic_notypecheck((addr), (idx)); \
94 } while (0)
95
84/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ 96/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */
85#ifndef clear_user_highpage 97#ifndef clear_user_highpage
86static inline void clear_user_highpage(struct page *page, unsigned long vaddr) 98static inline void clear_user_highpage(struct page *page, unsigned long vaddr)
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 78b4bc64c006..f479700df61b 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -2,6 +2,7 @@
2#define _LINUX_HUGETLB_H 2#define _LINUX_HUGETLB_H
3 3
4#include <linux/fs.h> 4#include <linux/fs.h>
5#include <linux/hugetlb_inline.h>
5 6
6struct ctl_table; 7struct ctl_table;
7struct user_struct; 8struct user_struct;
@@ -14,11 +15,6 @@ struct user_struct;
14 15
15int PageHuge(struct page *page); 16int PageHuge(struct page *page);
16 17
17static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
18{
19 return vma->vm_flags & VM_HUGETLB;
20}
21
22void reset_vma_resv_huge_pages(struct vm_area_struct *vma); 18void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
23int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); 19int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
24int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); 20int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
@@ -47,6 +43,7 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to,
47 struct vm_area_struct *vma, 43 struct vm_area_struct *vma,
48 int acctflags); 44 int acctflags);
49void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed); 45void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
46void __isolate_hwpoisoned_huge_page(struct page *page);
50 47
51extern unsigned long hugepages_treat_as_movable; 48extern unsigned long hugepages_treat_as_movable;
52extern const unsigned long hugetlb_zero, hugetlb_infinity; 49extern const unsigned long hugetlb_zero, hugetlb_infinity;
@@ -77,11 +74,6 @@ static inline int PageHuge(struct page *page)
77 return 0; 74 return 0;
78} 75}
79 76
80static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
81{
82 return 0;
83}
84
85static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma) 77static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma)
86{ 78{
87} 79}
@@ -108,6 +100,8 @@ static inline void hugetlb_report_meminfo(struct seq_file *m)
108#define is_hugepage_only_range(mm, addr, len) 0 100#define is_hugepage_only_range(mm, addr, len) 0
109#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) 101#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })
110#define hugetlb_fault(mm, vma, addr, flags) ({ BUG(); 0; }) 102#define hugetlb_fault(mm, vma, addr, flags) ({ BUG(); 0; })
103#define huge_pte_offset(mm, address) 0
104#define __isolate_hwpoisoned_huge_page(page) 0
111 105
112#define hugetlb_change_protection(vma, address, end, newprot) 106#define hugetlb_change_protection(vma, address, end, newprot)
113 107
diff --git a/include/linux/hugetlb_inline.h b/include/linux/hugetlb_inline.h
new file mode 100644
index 000000000000..6931489a5c14
--- /dev/null
+++ b/include/linux/hugetlb_inline.h
@@ -0,0 +1,22 @@
1#ifndef _LINUX_HUGETLB_INLINE_H
2#define _LINUX_HUGETLB_INLINE_H
3
4#ifdef CONFIG_HUGETLB_PAGE
5
6#include <linux/mm.h>
7
8static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
9{
10 return vma->vm_flags & VM_HUGETLB;
11}
12
13#else
14
15static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
16{
17 return 0;
18}
19
20#endif
21
22#endif
diff --git a/include/linux/i2c-mux.h b/include/linux/i2c-mux.h
new file mode 100644
index 000000000000..34536effd652
--- /dev/null
+++ b/include/linux/i2c-mux.h
@@ -0,0 +1,46 @@
1/*
2 *
3 * i2c-mux.h - functions for the i2c-bus mux support
4 *
5 * Copyright (c) 2008-2009 Rodolfo Giometti <giometti@linux.it>
6 * Copyright (c) 2008-2009 Eurotech S.p.A. <info@eurotech.it>
7 * Michael Lawnick <michael.lawnick.ext@nsn.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#ifndef _LINUX_I2C_MUX_H
25#define _LINUX_I2C_MUX_H
26
27#ifdef __KERNEL__
28
29/*
30 * Called to create a i2c bus on a multiplexed bus segment.
31 * The mux_dev and chan_id parameters are passed to the select
32 * and deselect callback functions to perform hardware-specific
33 * mux control.
34 */
35struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
36 void *mux_dev, u32 force_nr, u32 chan_id,
37 int (*select) (struct i2c_adapter *,
38 void *mux_dev, u32 chan_id),
39 int (*deselect) (struct i2c_adapter *,
40 void *mux_dev, u32 chan_id));
41
42int i2c_del_mux_adapter(struct i2c_adapter *adap);
43
44#endif /* __KERNEL__ */
45
46#endif /* _LINUX_I2C_MUX_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 21067b418536..4bae0b72ed3c 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -37,6 +37,7 @@
37#include <linux/of.h> /* for struct device_node */ 37#include <linux/of.h> /* for struct device_node */
38 38
39extern struct bus_type i2c_bus_type; 39extern struct bus_type i2c_bus_type;
40extern struct device_type i2c_adapter_type;
40 41
41/* --- General options ------------------------------------------------ */ 42/* --- General options ------------------------------------------------ */
42 43
@@ -108,6 +109,7 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
108 * @shutdown: Callback for device shutdown 109 * @shutdown: Callback for device shutdown
109 * @suspend: Callback for device suspend 110 * @suspend: Callback for device suspend
110 * @resume: Callback for device resume 111 * @resume: Callback for device resume
112 * @alert: Alert callback, for example for the SMBus alert protocol
111 * @command: Callback for bus-wide signaling (optional) 113 * @command: Callback for bus-wide signaling (optional)
112 * @driver: Device driver model driver 114 * @driver: Device driver model driver
113 * @id_table: List of I2C devices supported by this driver 115 * @id_table: List of I2C devices supported by this driver
@@ -233,6 +235,7 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data)
233 * @addr: stored in i2c_client.addr 235 * @addr: stored in i2c_client.addr
234 * @platform_data: stored in i2c_client.dev.platform_data 236 * @platform_data: stored in i2c_client.dev.platform_data
235 * @archdata: copied into i2c_client.dev.archdata 237 * @archdata: copied into i2c_client.dev.archdata
238 * @of_node: pointer to OpenFirmware device node
236 * @irq: stored in i2c_client.irq 239 * @irq: stored in i2c_client.irq
237 * 240 *
238 * I2C doesn't actually support hardware probing, although controllers and 241 * I2C doesn't actually support hardware probing, although controllers and
@@ -282,12 +285,18 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info);
282 285
283/* If you don't know the exact address of an I2C device, use this variant 286/* If you don't know the exact address of an I2C device, use this variant
284 * instead, which can probe for device presence in a list of possible 287 * instead, which can probe for device presence in a list of possible
285 * addresses. 288 * addresses. The "probe" callback function is optional. If it is provided,
289 * it must return 1 on successful probe, 0 otherwise. If it is not provided,
290 * a default probing method is used.
286 */ 291 */
287extern struct i2c_client * 292extern struct i2c_client *
288i2c_new_probed_device(struct i2c_adapter *adap, 293i2c_new_probed_device(struct i2c_adapter *adap,
289 struct i2c_board_info *info, 294 struct i2c_board_info *info,
290 unsigned short const *addr_list); 295 unsigned short const *addr_list,
296 int (*probe)(struct i2c_adapter *, unsigned short addr));
297
298/* Common custom probe functions */
299extern int i2c_probe_func_quick_read(struct i2c_adapter *, unsigned short addr);
291 300
292/* For devices that use several addresses, use i2c_new_dummy() to make 301/* For devices that use several addresses, use i2c_new_dummy() to make
293 * client handles for the extra addresses. 302 * client handles for the extra addresses.
@@ -360,6 +369,7 @@ struct i2c_adapter {
360 char name[48]; 369 char name[48];
361 struct completion dev_released; 370 struct completion dev_released;
362 371
372 struct mutex userspace_clients_lock;
363 struct list_head userspace_clients; 373 struct list_head userspace_clients;
364}; 374};
365#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) 375#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
@@ -374,23 +384,16 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
374 dev_set_drvdata(&dev->dev, data); 384 dev_set_drvdata(&dev->dev, data);
375} 385}
376 386
377/** 387static inline int i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter)
378 * i2c_lock_adapter - Prevent access to an I2C bus segment
379 * @adapter: Target I2C bus segment
380 */
381static inline void i2c_lock_adapter(struct i2c_adapter *adapter)
382{ 388{
383 rt_mutex_lock(&adapter->bus_lock); 389 return adapter->dev.parent != NULL
390 && adapter->dev.parent->bus == &i2c_bus_type
391 && adapter->dev.parent->type == &i2c_adapter_type;
384} 392}
385 393
386/** 394/* Adapter locking functions, exported for shared pin cases */
387 * i2c_unlock_adapter - Reauthorize access to an I2C bus segment 395void i2c_lock_adapter(struct i2c_adapter *);
388 * @adapter: Target I2C bus segment 396void i2c_unlock_adapter(struct i2c_adapter *);
389 */
390static inline void i2c_unlock_adapter(struct i2c_adapter *adapter)
391{
392 rt_mutex_unlock(&adapter->bus_lock);
393}
394 397
395/*flags for the client struct: */ 398/*flags for the client struct: */
396#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ 399#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */
diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h
index 02c9af374741..269181b8f623 100644
--- a/include/linux/i2c/adp5588.h
+++ b/include/linux/i2c/adp5588.h
@@ -78,6 +78,40 @@
78 78
79#define ADP5588_KEYMAPSIZE 80 79#define ADP5588_KEYMAPSIZE 80
80 80
81#define GPI_PIN_ROW0 97
82#define GPI_PIN_ROW1 98
83#define GPI_PIN_ROW2 99
84#define GPI_PIN_ROW3 100
85#define GPI_PIN_ROW4 101
86#define GPI_PIN_ROW5 102
87#define GPI_PIN_ROW6 103
88#define GPI_PIN_ROW7 104
89#define GPI_PIN_COL0 105
90#define GPI_PIN_COL1 106
91#define GPI_PIN_COL2 107
92#define GPI_PIN_COL3 108
93#define GPI_PIN_COL4 109
94#define GPI_PIN_COL5 110
95#define GPI_PIN_COL6 111
96#define GPI_PIN_COL7 112
97#define GPI_PIN_COL8 113
98#define GPI_PIN_COL9 114
99
100#define GPI_PIN_ROW_BASE GPI_PIN_ROW0
101#define GPI_PIN_ROW_END GPI_PIN_ROW7
102#define GPI_PIN_COL_BASE GPI_PIN_COL0
103#define GPI_PIN_COL_END GPI_PIN_COL9
104
105#define GPI_PIN_BASE GPI_PIN_ROW_BASE
106#define GPI_PIN_END GPI_PIN_COL_END
107
108#define ADP5588_GPIMAPSIZE_MAX (GPI_PIN_END - GPI_PIN_BASE + 1)
109
110struct adp5588_gpi_map {
111 unsigned short pin;
112 unsigned short sw_evt;
113};
114
81struct adp5588_kpad_platform_data { 115struct adp5588_kpad_platform_data {
82 int rows; /* Number of rows */ 116 int rows; /* Number of rows */
83 int cols; /* Number of columns */ 117 int cols; /* Number of columns */
@@ -87,6 +121,9 @@ struct adp5588_kpad_platform_data {
87 unsigned en_keylock:1; /* Enable Key Lock feature */ 121 unsigned en_keylock:1; /* Enable Key Lock feature */
88 unsigned short unlock_key1; /* Unlock Key 1 */ 122 unsigned short unlock_key1; /* Unlock Key 1 */
89 unsigned short unlock_key2; /* Unlock Key 2 */ 123 unsigned short unlock_key2; /* Unlock Key 2 */
124 const struct adp5588_gpi_map *gpimap;
125 unsigned short gpimapsize;
126 const struct adp5588_gpio_platform_data *gpio_data;
90}; 127};
91 128
92struct adp5588_gpio_platform_data { 129struct adp5588_gpio_platform_data {
diff --git a/include/linux/i2c/mcs.h b/include/linux/i2c/mcs.h
new file mode 100644
index 000000000000..725ae7c313ff
--- /dev/null
+++ b/include/linux/i2c/mcs.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2009 - 2010 Samsung Electronics Co.Ltd
3 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
4 * Author: HeungJun Kim <riverful.kim@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#ifndef __LINUX_MCS_H
14#define __LINUX_MCS_H
15
16#define MCS_KEY_MAP(v, c) ((((v) & 0xff) << 16) | ((c) & 0xffff))
17#define MCS_KEY_VAL(v) (((v) >> 16) & 0xff)
18#define MCS_KEY_CODE(v) ((v) & 0xffff)
19
20struct mcs_platform_data {
21 void (*cfg_pin)(void);
22
23 /* touchscreen */
24 unsigned int x_size;
25 unsigned int y_size;
26
27 /* touchkey */
28 const u32 *keymap;
29 unsigned int keymap_size;
30 unsigned int key_maxval;
31 bool no_autorepeat;
32};
33
34#endif /* __LINUX_MCS_H */
diff --git a/include/linux/i2c/mcs5000_ts.h b/include/linux/i2c/mcs5000_ts.h
deleted file mode 100644
index 5a117b5ca15e..000000000000
--- a/include/linux/i2c/mcs5000_ts.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * mcs5000_ts.h
3 *
4 * Copyright (C) 2009 Samsung Electronics Co.Ltd
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#ifndef __LINUX_MCS5000_TS_H
15#define __LINUX_MCS5000_TS_H
16
17/* platform data for the MELFAS MCS-5000 touchscreen driver */
18struct mcs5000_ts_platform_data {
19 void (*cfg_pin)(void);
20 int x_size;
21 int y_size;
22};
23
24#endif /* __LINUX_MCS5000_TS_H */
diff --git a/include/linux/i2c/pca954x.h b/include/linux/i2c/pca954x.h
new file mode 100644
index 000000000000..28f1f8d5ab1f
--- /dev/null
+++ b/include/linux/i2c/pca954x.h
@@ -0,0 +1,47 @@
1/*
2 *
3 * pca954x.h - I2C multiplexer/switch support
4 *
5 * Copyright (c) 2008-2009 Rodolfo Giometti <giometti@linux.it>
6 * Copyright (c) 2008-2009 Eurotech S.p.A. <info@eurotech.it>
7 * Michael Lawnick <michael.lawnick.ext@nsn.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24
25#ifndef _LINUX_I2C_PCA954X_H
26#define _LINUX_I2C_PCA954X_H
27
28/* Platform data for the PCA954x I2C multiplexers */
29
30/* Per channel initialisation data:
31 * @adap_id: bus number for the adapter. 0 = don't care
32 * @deselect_on_exit: set this entry to 1, if your H/W needs deselection
33 * of this channel after transaction.
34 *
35 */
36struct pca954x_platform_mode {
37 int adap_id;
38 unsigned int deselect_on_exit:1;
39};
40
41/* Per mux/switch data, used with i2c_register_board_info */
42struct pca954x_platform_data {
43 struct pca954x_platform_mode *modes;
44 int num_modes;
45};
46
47#endif /* _LINUX_I2C_PCA954X_H */
diff --git a/include/linux/i2c/qt602240_ts.h b/include/linux/i2c/qt602240_ts.h
new file mode 100644
index 000000000000..c5033e101094
--- /dev/null
+++ b/include/linux/i2c/qt602240_ts.h
@@ -0,0 +1,38 @@
1/*
2 * AT42QT602240/ATMXT224 Touchscreen driver
3 *
4 * Copyright (C) 2010 Samsung Electronics Co.Ltd
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#ifndef __LINUX_QT602240_TS_H
14#define __LINUX_QT602240_TS_H
15
16/* Orient */
17#define QT602240_NORMAL 0x0
18#define QT602240_DIAGONAL 0x1
19#define QT602240_HORIZONTAL_FLIP 0x2
20#define QT602240_ROTATED_90_COUNTER 0x3
21#define QT602240_VERTICAL_FLIP 0x4
22#define QT602240_ROTATED_90 0x5
23#define QT602240_ROTATED_180 0x6
24#define QT602240_DIAGONAL_COUNTER 0x7
25
26/* The platform data for the AT42QT602240/ATMXT224 touchscreen driver */
27struct qt602240_platform_data {
28 unsigned int x_line;
29 unsigned int y_line;
30 unsigned int x_size;
31 unsigned int y_size;
32 unsigned int blen;
33 unsigned int threshold;
34 unsigned int voltage;
35 unsigned char orient;
36};
37
38#endif /* __LINUX_QT602240_TS_H */
diff --git a/include/linux/i2c/sx150x.h b/include/linux/i2c/sx150x.h
new file mode 100644
index 000000000000..ee3049cb9ba5
--- /dev/null
+++ b/include/linux/i2c/sx150x.h
@@ -0,0 +1,78 @@
1/*
2 * Driver for the Semtech SX150x I2C GPIO Expanders
3 *
4 * Copyright (c) 2010, Code Aurora Forum. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and
8 * only version 2 as 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., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA.
19 */
20#ifndef __LINUX_I2C_SX150X_H
21#define __LINUX_I2C_SX150X_H
22
23/**
24 * struct sx150x_platform_data - config data for SX150x driver
25 * @gpio_base: The index number of the first GPIO assigned to this
26 * GPIO expander. The expander will create a block of
27 * consecutively numbered gpios beginning at the given base,
28 * with the size of the block depending on the model of the
29 * expander chip.
30 * @oscio_is_gpo: If set to true, the driver will configure OSCIO as a GPO
31 * instead of as an oscillator, increasing the size of the
32 * GP(I)O pool created by this expander by one. The
33 * output-only GPO pin will be added at the end of the block.
34 * @io_pullup_ena: A bit-mask which enables or disables the pull-up resistor
35 * for each IO line in the expander. Setting the bit at
36 * position n will enable the pull-up for the IO at
37 * the corresponding offset. For chips with fewer than
38 * 16 IO pins, high-end bits are ignored.
39 * @io_pulldn_ena: A bit-mask which enables-or disables the pull-down
40 * resistor for each IO line in the expander. Setting the
41 * bit at position n will enable the pull-down for the IO at
42 * the corresponding offset. For chips with fewer than
43 * 16 IO pins, high-end bits are ignored.
44 * @io_open_drain_ena: A bit-mask which enables-or disables open-drain
45 * operation for each IO line in the expander. Setting the
46 * bit at position n enables open-drain operation for
47 * the IO at the corresponding offset. Clearing the bit
48 * enables regular push-pull operation for that IO.
49 * For chips with fewer than 16 IO pins, high-end bits
50 * are ignored.
51 * @io_polarity: A bit-mask which enables polarity inversion for each IO line
52 * in the expander. Setting the bit at position n inverts
53 * the polarity of that IO line, while clearing it results
54 * in normal polarity. For chips with fewer than 16 IO pins,
55 * high-end bits are ignored.
56 * @irq_summary: The 'summary IRQ' line to which the GPIO expander's INT line
57 * is connected, via which it reports interrupt events
58 * across all GPIO lines. This must be a real,
59 * pre-existing IRQ line.
60 * Setting this value < 0 disables the irq_chip functionality
61 * of the driver.
62 * @irq_base: The first 'virtual IRQ' line at which our block of GPIO-based
63 * IRQ lines will appear. Similarly to gpio_base, the expander
64 * will create a block of irqs beginning at this number.
65 * This value is ignored if irq_summary is < 0.
66 */
67struct sx150x_platform_data {
68 unsigned gpio_base;
69 bool oscio_is_gpo;
70 u16 io_pullup_ena;
71 u16 io_pulldn_ena;
72 u16 io_open_drain_ena;
73 u16 io_polarity;
74 int irq_summary;
75 unsigned irq_base;
76};
77
78#endif /* __LINUX_I2C_SX150X_H */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 7b02aa5ce9b4..072fe8c93e6f 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -458,7 +458,7 @@ enum {
458 IDE_DFLAG_DOORLOCKING = (1 << 15), 458 IDE_DFLAG_DOORLOCKING = (1 << 15),
459 /* disallow DMA */ 459 /* disallow DMA */
460 IDE_DFLAG_NODMA = (1 << 16), 460 IDE_DFLAG_NODMA = (1 << 16),
461 /* powermanagment told us not to do anything, so sleep nicely */ 461 /* powermanagement told us not to do anything, so sleep nicely */
462 IDE_DFLAG_BLOCKED = (1 << 17), 462 IDE_DFLAG_BLOCKED = (1 << 17),
463 /* sleeping & sleep field valid */ 463 /* sleeping & sleep field valid */
464 IDE_DFLAG_SLEEPING = (1 << 18), 464 IDE_DFLAG_SLEEPING = (1 << 18),
diff --git a/include/linux/if.h b/include/linux/if.h
index be350e62a905..53558ec59e1b 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -73,6 +73,8 @@
73#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */ 73#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */
74#define IFF_IN_NETPOLL 0x1000 /* whether we are processing netpoll */ 74#define IFF_IN_NETPOLL 0x1000 /* whether we are processing netpoll */
75#define IFF_DISABLE_NETPOLL 0x2000 /* disable netpoll at run-time */ 75#define IFF_DISABLE_NETPOLL 0x2000 /* disable netpoll at run-time */
76#define IFF_MACVLAN_PORT 0x4000 /* device used as macvlan port */
77#define IFF_BRIDGE_PORT 0x8000 /* device used as bridge port */
76 78
77#define IF_GET_IFACE 0x0001 /* for querying only */ 79#define IF_GET_IFACE 0x0001 /* for querying only */
78#define IF_GET_PROTO 0x0002 80#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_bonding.h b/include/linux/if_bonding.h
index cd525fae3c98..2c7994372bde 100644
--- a/include/linux/if_bonding.h
+++ b/include/linux/if_bonding.h
@@ -83,6 +83,7 @@
83 83
84#define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */ 84#define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */
85 85
86#define BOND_DEFAULT_TX_QUEUES 16 /* Default number of tx queues per device */
86/* hashing types */ 87/* hashing types */
87#define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */ 88#define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */
88#define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */ 89#define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index 938b7e81df95..0d241a5c4909 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -102,8 +102,6 @@ struct __fdb_entry {
102#include <linux/netdevice.h> 102#include <linux/netdevice.h>
103 103
104extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); 104extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
105extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p,
106 struct sk_buff *skb);
107extern int (*br_should_route_hook)(struct sk_buff *skb); 105extern int (*br_should_route_hook)(struct sk_buff *skb);
108 106
109#endif 107#endif
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index bed7a4682b90..c831467774d0 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -119,7 +119,7 @@ struct ethhdr {
119 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ 119 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
120 unsigned char h_source[ETH_ALEN]; /* source ether addr */ 120 unsigned char h_source[ETH_ALEN]; /* source ether addr */
121 __be16 h_proto; /* packet type ID field */ 121 __be16 h_proto; /* packet type ID field */
122} __attribute__((packed)); 122} __packed;
123 123
124#ifdef __KERNEL__ 124#ifdef __KERNEL__
125#include <linux/skbuff.h> 125#include <linux/skbuff.h>
diff --git a/include/linux/if_fddi.h b/include/linux/if_fddi.h
index 5459c5c09930..9947c39e62f6 100644
--- a/include/linux/if_fddi.h
+++ b/include/linux/if_fddi.h
@@ -67,7 +67,7 @@ struct fddi_8022_1_hdr {
67 __u8 dsap; /* destination service access point */ 67 __u8 dsap; /* destination service access point */
68 __u8 ssap; /* source service access point */ 68 __u8 ssap; /* source service access point */
69 __u8 ctrl; /* control byte #1 */ 69 __u8 ctrl; /* control byte #1 */
70} __attribute__ ((packed)); 70} __packed;
71 71
72/* Define 802.2 Type 2 header */ 72/* Define 802.2 Type 2 header */
73struct fddi_8022_2_hdr { 73struct fddi_8022_2_hdr {
@@ -75,7 +75,7 @@ struct fddi_8022_2_hdr {
75 __u8 ssap; /* source service access point */ 75 __u8 ssap; /* source service access point */
76 __u8 ctrl_1; /* control byte #1 */ 76 __u8 ctrl_1; /* control byte #1 */
77 __u8 ctrl_2; /* control byte #2 */ 77 __u8 ctrl_2; /* control byte #2 */
78} __attribute__ ((packed)); 78} __packed;
79 79
80/* Define 802.2 SNAP header */ 80/* Define 802.2 SNAP header */
81#define FDDI_K_OUI_LEN 3 81#define FDDI_K_OUI_LEN 3
@@ -85,7 +85,7 @@ struct fddi_snap_hdr {
85 __u8 ctrl; /* always 0x03 */ 85 __u8 ctrl; /* always 0x03 */
86 __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */ 86 __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */
87 __be16 ethertype; /* packet type ID field */ 87 __be16 ethertype; /* packet type ID field */
88} __attribute__ ((packed)); 88} __packed;
89 89
90/* Define FDDI LLC frame header */ 90/* Define FDDI LLC frame header */
91struct fddihdr { 91struct fddihdr {
@@ -98,7 +98,7 @@ struct fddihdr {
98 struct fddi_8022_2_hdr llc_8022_2; 98 struct fddi_8022_2_hdr llc_8022_2;
99 struct fddi_snap_hdr llc_snap; 99 struct fddi_snap_hdr llc_snap;
100 } hdr; 100 } hdr;
101} __attribute__ ((packed)); 101} __packed;
102 102
103#ifdef __KERNEL__ 103#ifdef __KERNEL__
104#include <linux/netdevice.h> 104#include <linux/netdevice.h>
diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h
index 80b3a1056a5f..191ee0869bc1 100644
--- a/include/linux/if_frad.h
+++ b/include/linux/if_frad.h
@@ -135,7 +135,7 @@ struct frhdr
135 __be16 PID; 135 __be16 PID;
136 136
137#define IP_NLPID pad 137#define IP_NLPID pad
138} __attribute__((packed)); 138} __packed;
139 139
140/* see RFC 1490 for the definition of the following */ 140/* see RFC 1490 for the definition of the following */
141#define FRAD_I_UI 0x03 141#define FRAD_I_UI 0x03
diff --git a/include/linux/if_hippi.h b/include/linux/if_hippi.h
index 8d038eb8db5c..5fe5f307c6f5 100644
--- a/include/linux/if_hippi.h
+++ b/include/linux/if_hippi.h
@@ -104,7 +104,7 @@ struct hippi_fp_hdr {
104 __be32 fixed; 104 __be32 fixed;
105#endif 105#endif
106 __be32 d2_size; 106 __be32 d2_size;
107} __attribute__ ((packed)); 107} __packed;
108 108
109struct hippi_le_hdr { 109struct hippi_le_hdr {
110#if defined (__BIG_ENDIAN_BITFIELD) 110#if defined (__BIG_ENDIAN_BITFIELD)
@@ -129,7 +129,7 @@ struct hippi_le_hdr {
129 __u8 daddr[HIPPI_ALEN]; 129 __u8 daddr[HIPPI_ALEN];
130 __u16 locally_administered; 130 __u16 locally_administered;
131 __u8 saddr[HIPPI_ALEN]; 131 __u8 saddr[HIPPI_ALEN];
132} __attribute__ ((packed)); 132} __packed;
133 133
134#define HIPPI_OUI_LEN 3 134#define HIPPI_OUI_LEN 3
135/* 135/*
@@ -142,12 +142,12 @@ struct hippi_snap_hdr {
142 __u8 ctrl; /* always 0x03 */ 142 __u8 ctrl; /* always 0x03 */
143 __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/ 143 __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/
144 __be16 ethertype; /* packet type ID field */ 144 __be16 ethertype; /* packet type ID field */
145} __attribute__ ((packed)); 145} __packed;
146 146
147struct hippi_hdr { 147struct hippi_hdr {
148 struct hippi_fp_hdr fp; 148 struct hippi_fp_hdr fp;
149 struct hippi_le_hdr le; 149 struct hippi_le_hdr le;
150 struct hippi_snap_hdr snap; 150 struct hippi_snap_hdr snap;
151} __attribute__ ((packed)); 151} __packed;
152 152
153#endif /* _LINUX_IF_HIPPI_H */ 153#endif /* _LINUX_IF_HIPPI_H */
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 85c812db5a3f..2fc66dd783ee 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -4,7 +4,7 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/netlink.h> 5#include <linux/netlink.h>
6 6
7/* The struct should be in sync with struct net_device_stats */ 7/* This struct should be in sync with struct rtnl_link_stats64 */
8struct rtnl_link_stats { 8struct rtnl_link_stats {
9 __u32 rx_packets; /* total packets received */ 9 __u32 rx_packets; /* total packets received */
10 __u32 tx_packets; /* total packets transmitted */ 10 __u32 tx_packets; /* total packets transmitted */
@@ -37,6 +37,7 @@ struct rtnl_link_stats {
37 __u32 tx_compressed; 37 __u32 tx_compressed;
38}; 38};
39 39
40/* The main device statistics structure */
40struct rtnl_link_stats64 { 41struct rtnl_link_stats64 {
41 __u64 rx_packets; /* total packets received */ 42 __u64 rx_packets; /* total packets received */
42 __u64 tx_packets; /* total packets transmitted */ 43 __u64 tx_packets; /* total packets transmitted */
@@ -233,7 +234,7 @@ enum macvlan_mode {
233 MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */ 234 MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */
234}; 235};
235 236
236/* SR-IOV virtual function managment section */ 237/* SR-IOV virtual function management section */
237 238
238enum { 239enum {
239 IFLA_VF_INFO_UNSPEC, 240 IFLA_VF_INFO_UNSPEC,
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index 1ffaeffeff74..35280b302290 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -6,6 +6,7 @@
6#include <linux/netdevice.h> 6#include <linux/netdevice.h>
7#include <linux/netlink.h> 7#include <linux/netlink.h>
8#include <net/netlink.h> 8#include <net/netlink.h>
9#include <linux/u64_stats_sync.h>
9 10
10#if defined(CONFIG_MACVTAP) || defined(CONFIG_MACVTAP_MODULE) 11#if defined(CONFIG_MACVTAP) || defined(CONFIG_MACVTAP_MODULE)
11struct socket *macvtap_get_socket(struct file *); 12struct socket *macvtap_get_socket(struct file *);
@@ -27,14 +28,16 @@ struct macvtap_queue;
27 * struct macvlan_rx_stats - MACVLAN percpu rx stats 28 * struct macvlan_rx_stats - MACVLAN percpu rx stats
28 * @rx_packets: number of received packets 29 * @rx_packets: number of received packets
29 * @rx_bytes: number of received bytes 30 * @rx_bytes: number of received bytes
30 * @multicast: number of received multicast packets 31 * @rx_multicast: number of received multicast packets
32 * @syncp: synchronization point for 64bit counters
31 * @rx_errors: number of errors 33 * @rx_errors: number of errors
32 */ 34 */
33struct macvlan_rx_stats { 35struct macvlan_rx_stats {
34 unsigned long rx_packets; 36 u64 rx_packets;
35 unsigned long rx_bytes; 37 u64 rx_bytes;
36 unsigned long multicast; 38 u64 rx_multicast;
37 unsigned long rx_errors; 39 struct u64_stats_sync syncp;
40 unsigned long rx_errors;
38}; 41};
39 42
40struct macvlan_dev { 43struct macvlan_dev {
@@ -56,12 +59,14 @@ static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
56{ 59{
57 struct macvlan_rx_stats *rx_stats; 60 struct macvlan_rx_stats *rx_stats;
58 61
59 rx_stats = per_cpu_ptr(vlan->rx_stats, smp_processor_id()); 62 rx_stats = this_cpu_ptr(vlan->rx_stats);
60 if (likely(success)) { 63 if (likely(success)) {
64 u64_stats_update_begin(&rx_stats->syncp);
61 rx_stats->rx_packets++;; 65 rx_stats->rx_packets++;;
62 rx_stats->rx_bytes += len; 66 rx_stats->rx_bytes += len;
63 if (multicast) 67 if (multicast)
64 rx_stats->multicast++; 68 rx_stats->rx_multicast++;
69 u64_stats_update_end(&rx_stats->syncp);
65 } else { 70 } else {
66 rx_stats->rx_errors++; 71 rx_stats->rx_errors++;
67 } 72 }
@@ -86,8 +91,4 @@ extern int macvlan_link_register(struct rtnl_link_ops *ops);
86extern netdev_tx_t macvlan_start_xmit(struct sk_buff *skb, 91extern netdev_tx_t macvlan_start_xmit(struct sk_buff *skb,
87 struct net_device *dev); 92 struct net_device *dev);
88 93
89
90extern struct sk_buff *(*macvlan_handle_frame_hook)(struct macvlan_port *,
91 struct sk_buff *);
92
93#endif /* _LINUX_IF_MACVLAN_H */ 94#endif /* _LINUX_IF_MACVLAN_H */
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index 6ac23ef1801a..72bfa5a034dd 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -48,6 +48,7 @@ struct sockaddr_ll {
48#define PACKET_LOSS 14 48#define PACKET_LOSS 14
49#define PACKET_VNET_HDR 15 49#define PACKET_VNET_HDR 15
50#define PACKET_TX_TIMESTAMP 16 50#define PACKET_TX_TIMESTAMP 16
51#define PACKET_TIMESTAMP 17
51 52
52struct tpacket_stats { 53struct tpacket_stats {
53 unsigned int tp_packets; 54 unsigned int tp_packets;
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index a6577af0c4e6..1925e0c3f162 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -59,7 +59,7 @@ struct sockaddr_pppox {
59 union{ 59 union{
60 struct pppoe_addr pppoe; 60 struct pppoe_addr pppoe;
61 }sa_addr; 61 }sa_addr;
62}__attribute__ ((packed)); 62} __packed;
63 63
64/* The use of the above union isn't viable because the size of this 64/* The use of the above union isn't viable because the size of this
65 * struct must stay fixed over time -- applications use sizeof(struct 65 * struct must stay fixed over time -- applications use sizeof(struct
@@ -70,7 +70,7 @@ struct sockaddr_pppol2tp {
70 sa_family_t sa_family; /* address family, AF_PPPOX */ 70 sa_family_t sa_family; /* address family, AF_PPPOX */
71 unsigned int sa_protocol; /* protocol identifier */ 71 unsigned int sa_protocol; /* protocol identifier */
72 struct pppol2tp_addr pppol2tp; 72 struct pppol2tp_addr pppol2tp;
73}__attribute__ ((packed)); 73} __packed;
74 74
75/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32 75/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
76 * bits. So we need a different sockaddr structure. 76 * bits. So we need a different sockaddr structure.
@@ -79,7 +79,7 @@ struct sockaddr_pppol2tpv3 {
79 sa_family_t sa_family; /* address family, AF_PPPOX */ 79 sa_family_t sa_family; /* address family, AF_PPPOX */
80 unsigned int sa_protocol; /* protocol identifier */ 80 unsigned int sa_protocol; /* protocol identifier */
81 struct pppol2tpv3_addr pppol2tp; 81 struct pppol2tpv3_addr pppol2tp;
82} __attribute__ ((packed)); 82} __packed;
83 83
84/********************************************************************* 84/*********************************************************************
85 * 85 *
@@ -129,7 +129,7 @@ struct pppoe_hdr {
129 __be16 sid; 129 __be16 sid;
130 __be16 length; 130 __be16 length;
131 struct pppoe_tag tag[0]; 131 struct pppoe_tag tag[0];
132} __attribute__ ((packed)); 132} __packed;
133 133
134/* Length of entire PPPoE + PPP header */ 134/* Length of entire PPPoE + PPP header */
135#define PPPOE_SES_HLEN 8 135#define PPPOE_SES_HLEN 8
diff --git a/include/linux/in.h b/include/linux/in.h
index 583c76f9c30f..41d88a4689af 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -85,6 +85,7 @@ struct in_addr {
85#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR 85#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
86 86
87#define IP_MINTTL 21 87#define IP_MINTTL 21
88#define IP_NODEFRAG 22
88 89
89/* IP_MTU_DISCOVER values */ 90/* IP_MTU_DISCOVER values */
90#define IP_PMTUDISC_DONT 0 /* Never send DF frames */ 91#define IP_PMTUDISC_DONT 0 /* Never send DF frames */
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index 37ea2894b3c0..d33041e2a42a 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -51,6 +51,7 @@ struct inotify_event {
51/* special flags */ 51/* special flags */
52#define IN_ONLYDIR 0x01000000 /* only watch the path if it is a directory */ 52#define IN_ONLYDIR 0x01000000 /* only watch the path if it is a directory */
53#define IN_DONT_FOLLOW 0x02000000 /* don't follow a sym link */ 53#define IN_DONT_FOLLOW 0x02000000 /* don't follow a sym link */
54#define IN_EXCL_UNLINK 0x04000000 /* exclude events on unlinked objects */
54#define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */ 55#define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */
55#define IN_ISDIR 0x40000000 /* event occurred against dir */ 56#define IN_ISDIR 0x40000000 /* event occurred against dir */
56#define IN_ONESHOT 0x80000000 /* only send event once */ 57#define IN_ONESHOT 0x80000000 /* only send event once */
@@ -70,177 +71,17 @@ struct inotify_event {
70#define IN_NONBLOCK O_NONBLOCK 71#define IN_NONBLOCK O_NONBLOCK
71 72
72#ifdef __KERNEL__ 73#ifdef __KERNEL__
73 74#include <linux/sysctl.h>
74#include <linux/dcache.h> 75extern struct ctl_table inotify_table[]; /* for sysctl */
75#include <linux/fs.h> 76
76 77#define ALL_INOTIFY_BITS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
77/* 78 IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \
78 * struct inotify_watch - represents a watch request on a specific inode 79 IN_MOVED_TO | IN_CREATE | IN_DELETE | \
79 * 80 IN_DELETE_SELF | IN_MOVE_SELF | IN_UNMOUNT | \
80 * h_list is protected by ih->mutex of the associated inotify_handle. 81 IN_Q_OVERFLOW | IN_IGNORED | IN_ONLYDIR | \
81 * i_list, mask are protected by inode->inotify_mutex of the associated inode. 82 IN_DONT_FOLLOW | IN_EXCL_UNLINK | IN_MASK_ADD | \
82 * ih, inode, and wd are never written to once the watch is created. 83 IN_ISDIR | IN_ONESHOT)
83 * 84
84 * Callers must use the established inotify interfaces to access inotify_watch 85#endif
85 * contents. The content of this structure is private to the inotify
86 * implementation.
87 */
88struct inotify_watch {
89 struct list_head h_list; /* entry in inotify_handle's list */
90 struct list_head i_list; /* entry in inode's list */
91 atomic_t count; /* reference count */
92 struct inotify_handle *ih; /* associated inotify handle */
93 struct inode *inode; /* associated inode */
94 __s32 wd; /* watch descriptor */
95 __u32 mask; /* event mask for this watch */
96};
97
98struct inotify_operations {
99 void (*handle_event)(struct inotify_watch *, u32, u32, u32,
100 const char *, struct inode *);
101 void (*destroy_watch)(struct inotify_watch *);
102};
103
104#ifdef CONFIG_INOTIFY
105
106/* Kernel API for producing events */
107
108extern void inotify_d_instantiate(struct dentry *, struct inode *);
109extern void inotify_d_move(struct dentry *);
110extern void inotify_inode_queue_event(struct inode *, __u32, __u32,
111 const char *, struct inode *);
112extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32,
113 const char *);
114extern void inotify_unmount_inodes(struct list_head *);
115extern void inotify_inode_is_dead(struct inode *);
116extern u32 inotify_get_cookie(void);
117
118/* Kernel Consumer API */
119
120extern struct inotify_handle *inotify_init(const struct inotify_operations *);
121extern void inotify_init_watch(struct inotify_watch *);
122extern void inotify_destroy(struct inotify_handle *);
123extern __s32 inotify_find_watch(struct inotify_handle *, struct inode *,
124 struct inotify_watch **);
125extern __s32 inotify_find_update_watch(struct inotify_handle *, struct inode *,
126 u32);
127extern __s32 inotify_add_watch(struct inotify_handle *, struct inotify_watch *,
128 struct inode *, __u32);
129extern __s32 inotify_clone_watch(struct inotify_watch *, struct inotify_watch *);
130extern void inotify_evict_watch(struct inotify_watch *);
131extern int inotify_rm_watch(struct inotify_handle *, struct inotify_watch *);
132extern int inotify_rm_wd(struct inotify_handle *, __u32);
133extern void inotify_remove_watch_locked(struct inotify_handle *,
134 struct inotify_watch *);
135extern void get_inotify_watch(struct inotify_watch *);
136extern void put_inotify_watch(struct inotify_watch *);
137extern int pin_inotify_watch(struct inotify_watch *);
138extern void unpin_inotify_watch(struct inotify_watch *);
139
140#else
141
142static inline void inotify_d_instantiate(struct dentry *dentry,
143 struct inode *inode)
144{
145}
146
147static inline void inotify_d_move(struct dentry *dentry)
148{
149}
150
151static inline void inotify_inode_queue_event(struct inode *inode,
152 __u32 mask, __u32 cookie,
153 const char *filename,
154 struct inode *n_inode)
155{
156}
157
158static inline void inotify_dentry_parent_queue_event(struct dentry *dentry,
159 __u32 mask, __u32 cookie,
160 const char *filename)
161{
162}
163
164static inline void inotify_unmount_inodes(struct list_head *list)
165{
166}
167
168static inline void inotify_inode_is_dead(struct inode *inode)
169{
170}
171
172static inline u32 inotify_get_cookie(void)
173{
174 return 0;
175}
176
177static inline struct inotify_handle *inotify_init(const struct inotify_operations *ops)
178{
179 return ERR_PTR(-EOPNOTSUPP);
180}
181
182static inline void inotify_init_watch(struct inotify_watch *watch)
183{
184}
185
186static inline void inotify_destroy(struct inotify_handle *ih)
187{
188}
189
190static inline __s32 inotify_find_watch(struct inotify_handle *ih, struct inode *inode,
191 struct inotify_watch **watchp)
192{
193 return -EOPNOTSUPP;
194}
195
196static inline __s32 inotify_find_update_watch(struct inotify_handle *ih,
197 struct inode *inode, u32 mask)
198{
199 return -EOPNOTSUPP;
200}
201
202static inline __s32 inotify_add_watch(struct inotify_handle *ih,
203 struct inotify_watch *watch,
204 struct inode *inode, __u32 mask)
205{
206 return -EOPNOTSUPP;
207}
208
209static inline int inotify_rm_watch(struct inotify_handle *ih,
210 struct inotify_watch *watch)
211{
212 return -EOPNOTSUPP;
213}
214
215static inline int inotify_rm_wd(struct inotify_handle *ih, __u32 wd)
216{
217 return -EOPNOTSUPP;
218}
219
220static inline void inotify_remove_watch_locked(struct inotify_handle *ih,
221 struct inotify_watch *watch)
222{
223}
224
225static inline void get_inotify_watch(struct inotify_watch *watch)
226{
227}
228
229static inline void put_inotify_watch(struct inotify_watch *watch)
230{
231}
232
233extern inline int pin_inotify_watch(struct inotify_watch *watch)
234{
235 return 0;
236}
237
238extern inline void unpin_inotify_watch(struct inotify_watch *watch)
239{
240}
241
242#endif /* CONFIG_INOTIFY */
243
244#endif /* __KERNEL __ */
245 86
246#endif /* _LINUX_INOTIFY_H */ 87#endif /* _LINUX_INOTIFY_H */
diff --git a/include/linux/input.h b/include/linux/input.h
index 6fcc9101beeb..896a92227bc4 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -691,9 +691,12 @@ struct input_absinfo {
691#define ABS_TILT_X 0x1a 691#define ABS_TILT_X 0x1a
692#define ABS_TILT_Y 0x1b 692#define ABS_TILT_Y 0x1b
693#define ABS_TOOL_WIDTH 0x1c 693#define ABS_TOOL_WIDTH 0x1c
694
694#define ABS_VOLUME 0x20 695#define ABS_VOLUME 0x20
696
695#define ABS_MISC 0x28 697#define ABS_MISC 0x28
696 698
699#define ABS_MT_SLOT 0x2f /* MT slot being modified */
697#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ 700#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */
698#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ 701#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */
699#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ 702#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */
@@ -706,6 +709,12 @@ struct input_absinfo {
706#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ 709#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */
707#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ 710#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */
708 711
712#ifdef __KERNEL__
713/* Implementation details, userspace should not care about these */
714#define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR
715#define ABS_MT_LAST ABS_MT_PRESSURE
716#endif
717
709#define ABS_MAX 0x3f 718#define ABS_MAX 0x3f
710#define ABS_CNT (ABS_MAX+1) 719#define ABS_CNT (ABS_MAX+1)
711 720
@@ -767,6 +776,7 @@ struct input_absinfo {
767#define REP_DELAY 0x00 776#define REP_DELAY 0x00
768#define REP_PERIOD 0x01 777#define REP_PERIOD 0x01
769#define REP_MAX 0x01 778#define REP_MAX 0x01
779#define REP_CNT (REP_MAX+1)
770 780
771/* 781/*
772 * Sounds 782 * Sounds
@@ -1048,6 +1058,14 @@ struct ff_effect {
1048#include <linux/mod_devicetable.h> 1058#include <linux/mod_devicetable.h>
1049 1059
1050/** 1060/**
1061 * struct input_mt_slot - represents the state of an input MT slot
1062 * @abs: holds current values of ABS_MT axes for this slot
1063 */
1064struct input_mt_slot {
1065 int abs[ABS_MT_LAST - ABS_MT_FIRST + 1];
1066};
1067
1068/**
1051 * struct input_dev - represents an input device 1069 * struct input_dev - represents an input device
1052 * @name: name of the device 1070 * @name: name of the device
1053 * @phys: physical path to the device in the system hierarchy 1071 * @phys: physical path to the device in the system hierarchy
@@ -1063,6 +1081,10 @@ struct ff_effect {
1063 * @sndbit: bitmap of sound effects supported by the device 1081 * @sndbit: bitmap of sound effects supported by the device
1064 * @ffbit: bitmap of force feedback effects supported by the device 1082 * @ffbit: bitmap of force feedback effects supported by the device
1065 * @swbit: bitmap of switches present on the device 1083 * @swbit: bitmap of switches present on the device
1084 * @hint_events_per_packet: average number of events generated by the
1085 * device in a packet (between EV_SYN/SYN_REPORT events). Used by
1086 * event handlers to estimate size of the buffer needed to hold
1087 * events.
1066 * @keycodemax: size of keycode table 1088 * @keycodemax: size of keycode table
1067 * @keycodesize: size of elements in keycode table 1089 * @keycodesize: size of elements in keycode table
1068 * @keycode: map of scancodes to keycodes for this device 1090 * @keycode: map of scancodes to keycodes for this device
@@ -1078,18 +1100,18 @@ struct ff_effect {
1078 * @repeat_key: stores key code of the last key pressed; used to implement 1100 * @repeat_key: stores key code of the last key pressed; used to implement
1079 * software autorepeat 1101 * software autorepeat
1080 * @timer: timer for software autorepeat 1102 * @timer: timer for software autorepeat
1081 * @sync: set to 1 when there were no new events since last EV_SYNC
1082 * @abs: current values for reports from absolute axes
1083 * @rep: current values for autorepeat parameters (delay, rate) 1103 * @rep: current values for autorepeat parameters (delay, rate)
1104 * @mt: pointer to array of struct input_mt_slot holding current values
1105 * of tracked contacts
1106 * @mtsize: number of MT slots the device uses
1107 * @slot: MT slot currently being transmitted
1108 * @absinfo: array of &struct absinfo elements holding information
1109 * about absolute axes (current value, min, max, flat, fuzz,
1110 * resolution)
1084 * @key: reflects current state of device's keys/buttons 1111 * @key: reflects current state of device's keys/buttons
1085 * @led: reflects current state of device's LEDs 1112 * @led: reflects current state of device's LEDs
1086 * @snd: reflects current state of sound effects 1113 * @snd: reflects current state of sound effects
1087 * @sw: reflects current state of device's switches 1114 * @sw: reflects current state of device's switches
1088 * @absmax: maximum values for events coming from absolute axes
1089 * @absmin: minimum values for events coming from absolute axes
1090 * @absfuzz: describes noisiness for axes
1091 * @absflat: size of the center flat position (used by joydev)
1092 * @absres: resolution used for events coming form absolute axes
1093 * @open: this method is called when the very first user calls 1115 * @open: this method is called when the very first user calls
1094 * input_open_device(). The driver must prepare the device 1116 * input_open_device(). The driver must prepare the device
1095 * to start generating events (start polling thread, 1117 * to start generating events (start polling thread,
@@ -1119,6 +1141,7 @@ struct ff_effect {
1119 * last user closes the device 1141 * last user closes the device
1120 * @going_away: marks devices that are in a middle of unregistering and 1142 * @going_away: marks devices that are in a middle of unregistering and
1121 * causes input_open_device*() fail with -ENODEV. 1143 * causes input_open_device*() fail with -ENODEV.
1144 * @sync: set to %true when there were no new events since last EV_SYN
1122 * @dev: driver model's view of this device 1145 * @dev: driver model's view of this device
1123 * @h_list: list of input handles associated with the device. When 1146 * @h_list: list of input handles associated with the device. When
1124 * accessing the list dev->mutex must be held 1147 * accessing the list dev->mutex must be held
@@ -1140,6 +1163,8 @@ struct input_dev {
1140 unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; 1163 unsigned long ffbit[BITS_TO_LONGS(FF_CNT)];
1141 unsigned long swbit[BITS_TO_LONGS(SW_CNT)]; 1164 unsigned long swbit[BITS_TO_LONGS(SW_CNT)];
1142 1165
1166 unsigned int hint_events_per_packet;
1167
1143 unsigned int keycodemax; 1168 unsigned int keycodemax;
1144 unsigned int keycodesize; 1169 unsigned int keycodesize;
1145 void *keycode; 1170 void *keycode;
@@ -1153,22 +1178,19 @@ struct input_dev {
1153 unsigned int repeat_key; 1178 unsigned int repeat_key;
1154 struct timer_list timer; 1179 struct timer_list timer;
1155 1180
1156 int sync; 1181 int rep[REP_CNT];
1182
1183 struct input_mt_slot *mt;
1184 int mtsize;
1185 int slot;
1157 1186
1158 int abs[ABS_CNT]; 1187 struct input_absinfo *absinfo;
1159 int rep[REP_MAX + 1];
1160 1188
1161 unsigned long key[BITS_TO_LONGS(KEY_CNT)]; 1189 unsigned long key[BITS_TO_LONGS(KEY_CNT)];
1162 unsigned long led[BITS_TO_LONGS(LED_CNT)]; 1190 unsigned long led[BITS_TO_LONGS(LED_CNT)];
1163 unsigned long snd[BITS_TO_LONGS(SND_CNT)]; 1191 unsigned long snd[BITS_TO_LONGS(SND_CNT)];
1164 unsigned long sw[BITS_TO_LONGS(SW_CNT)]; 1192 unsigned long sw[BITS_TO_LONGS(SW_CNT)];
1165 1193
1166 int absmax[ABS_CNT];
1167 int absmin[ABS_CNT];
1168 int absfuzz[ABS_CNT];
1169 int absflat[ABS_CNT];
1170 int absres[ABS_CNT];
1171
1172 int (*open)(struct input_dev *dev); 1194 int (*open)(struct input_dev *dev);
1173 void (*close)(struct input_dev *dev); 1195 void (*close)(struct input_dev *dev);
1174 int (*flush)(struct input_dev *dev, struct file *file); 1196 int (*flush)(struct input_dev *dev, struct file *file);
@@ -1182,6 +1204,8 @@ struct input_dev {
1182 unsigned int users; 1204 unsigned int users;
1183 bool going_away; 1205 bool going_away;
1184 1206
1207 bool sync;
1208
1185 struct device dev; 1209 struct device dev;
1186 1210
1187 struct list_head h_list; 1211 struct list_head h_list;
@@ -1406,18 +1430,54 @@ static inline void input_mt_sync(struct input_dev *dev)
1406 input_event(dev, EV_SYN, SYN_MT_REPORT, 0); 1430 input_event(dev, EV_SYN, SYN_MT_REPORT, 0);
1407} 1431}
1408 1432
1433static inline void input_mt_slot(struct input_dev *dev, int slot)
1434{
1435 input_event(dev, EV_ABS, ABS_MT_SLOT, slot);
1436}
1437
1409void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); 1438void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code);
1410 1439
1411static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) 1440/**
1441 * input_set_events_per_packet - tell handlers about the driver event rate
1442 * @dev: the input device used by the driver
1443 * @n_events: the average number of events between calls to input_sync()
1444 *
1445 * If the event rate sent from a device is unusually large, use this
1446 * function to set the expected event rate. This will allow handlers
1447 * to set up an appropriate buffer size for the event stream, in order
1448 * to minimize information loss.
1449 */
1450static inline void input_set_events_per_packet(struct input_dev *dev, int n_events)
1412{ 1451{
1413 dev->absmin[axis] = min; 1452 dev->hint_events_per_packet = n_events;
1414 dev->absmax[axis] = max; 1453}
1415 dev->absfuzz[axis] = fuzz;
1416 dev->absflat[axis] = flat;
1417 1454
1418 dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); 1455void input_alloc_absinfo(struct input_dev *dev);
1456void input_set_abs_params(struct input_dev *dev, unsigned int axis,
1457 int min, int max, int fuzz, int flat);
1458
1459#define INPUT_GENERATE_ABS_ACCESSORS(_suffix, _item) \
1460static inline int input_abs_get_##_suffix(struct input_dev *dev, \
1461 unsigned int axis) \
1462{ \
1463 return dev->absinfo ? dev->absinfo[axis]._item : 0; \
1464} \
1465 \
1466static inline void input_abs_set_##_suffix(struct input_dev *dev, \
1467 unsigned int axis, int val) \
1468{ \
1469 input_alloc_absinfo(dev); \
1470 if (dev->absinfo) \
1471 dev->absinfo[axis]._item = val; \
1419} 1472}
1420 1473
1474INPUT_GENERATE_ABS_ACCESSORS(val, value)
1475INPUT_GENERATE_ABS_ACCESSORS(min, minimum)
1476INPUT_GENERATE_ABS_ACCESSORS(max, maximum)
1477INPUT_GENERATE_ABS_ACCESSORS(fuzz, fuzz)
1478INPUT_GENERATE_ABS_ACCESSORS(flat, flat)
1479INPUT_GENERATE_ABS_ACCESSORS(res, resolution)
1480
1421int input_get_keycode(struct input_dev *dev, 1481int input_get_keycode(struct input_dev *dev,
1422 unsigned int scancode, unsigned int *keycode); 1482 unsigned int scancode, unsigned int *keycode);
1423int input_set_keycode(struct input_dev *dev, 1483int input_set_keycode(struct input_dev *dev,
@@ -1485,5 +1545,8 @@ int input_ff_erase(struct input_dev *dev, int effect_id, struct file *file);
1485int input_ff_create_memless(struct input_dev *dev, void *data, 1545int input_ff_create_memless(struct input_dev *dev, void *data,
1486 int (*play_effect)(struct input_dev *, void *, struct ff_effect *)); 1546 int (*play_effect)(struct input_dev *, void *, struct ff_effect *));
1487 1547
1548int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots);
1549void input_mt_destroy_slots(struct input_dev *dev);
1550
1488#endif 1551#endif
1489#endif 1552#endif
diff --git a/include/linux/input/adxl34x.h b/include/linux/input/adxl34x.h
new file mode 100644
index 000000000000..df00d998a44a
--- /dev/null
+++ b/include/linux/input/adxl34x.h
@@ -0,0 +1,349 @@
1/*
2 * include/linux/input/adxl34x.h
3 *
4 * Digital Accelerometer characteristics are highly application specific
5 * and may vary between boards and models. The platform_data for the
6 * device's "struct device" holds this information.
7 *
8 * Copyright 2009 Analog Devices Inc.
9 *
10 * Licensed under the GPL-2 or later.
11 */
12
13#ifndef __LINUX_INPUT_ADXL34X_H__
14#define __LINUX_INPUT_ADXL34X_H__
15
16struct adxl34x_platform_data {
17
18 /*
19 * X,Y,Z Axis Offset:
20 * offer user offset adjustments in twoscompliment
21 * form with a scale factor of 15.6 mg/LSB (i.e. 0x7F = +2 g)
22 */
23
24 s8 x_axis_offset;
25 s8 y_axis_offset;
26 s8 z_axis_offset;
27
28 /*
29 * TAP_X/Y/Z Enable: Setting TAP_X, Y, or Z Enable enables X,
30 * Y, or Z participation in Tap detection. A '0' excludes the
31 * selected axis from participation in Tap detection.
32 * Setting the SUPPRESS bit suppresses Double Tap detection if
33 * acceleration greater than tap_threshold is present between
34 * taps.
35 */
36
37#define ADXL_SUPPRESS (1 << 3)
38#define ADXL_TAP_X_EN (1 << 2)
39#define ADXL_TAP_Y_EN (1 << 1)
40#define ADXL_TAP_Z_EN (1 << 0)
41
42 u8 tap_axis_control;
43
44 /*
45 * tap_threshold:
46 * holds the threshold value for tap detection/interrupts.
47 * The data format is unsigned. The scale factor is 62.5 mg/LSB
48 * (i.e. 0xFF = +16 g). A zero value may result in undesirable
49 * behavior if Tap/Double Tap is enabled.
50 */
51
52 u8 tap_threshold;
53
54 /*
55 * tap_duration:
56 * is an unsigned time value representing the maximum
57 * time that an event must be above the tap_threshold threshold
58 * to qualify as a tap event. The scale factor is 625 us/LSB. A zero
59 * value will prevent Tap/Double Tap functions from working.
60 */
61
62 u8 tap_duration;
63
64 /*
65 * tap_latency:
66 * is an unsigned time value representing the wait time
67 * from the detection of a tap event to the opening of the time
68 * window tap_window for a possible second tap event. The scale
69 * factor is 1.25 ms/LSB. A zero value will disable the Double Tap
70 * function.
71 */
72
73 u8 tap_latency;
74
75 /*
76 * tap_window:
77 * is an unsigned time value representing the amount
78 * of time after the expiration of tap_latency during which a second
79 * tap can begin. The scale factor is 1.25 ms/LSB. A zero value will
80 * disable the Double Tap function.
81 */
82
83 u8 tap_window;
84
85 /*
86 * act_axis_control:
87 * X/Y/Z Enable: A '1' enables X, Y, or Z participation in activity
88 * or inactivity detection. A '0' excludes the selected axis from
89 * participation. If all of the axes are excluded, the function is
90 * disabled.
91 * AC/DC: A '0' = DC coupled operation and a '1' = AC coupled
92 * operation. In DC coupled operation, the current acceleration is
93 * compared with activity_threshold and inactivity_threshold directly
94 * to determine whether activity or inactivity is detected. In AC
95 * coupled operation for activity detection, the acceleration value
96 * at the start of activity detection is taken as a reference value.
97 * New samples of acceleration are then compared to this
98 * reference value and if the magnitude of the difference exceeds
99 * activity_threshold the device will trigger an activity interrupt. In
100 * AC coupled operation for inactivity detection, a reference value
101 * is used again for comparison and is updated whenever the
102 * device exceeds the inactivity threshold. Once the reference
103 * value is selected, the device compares the magnitude of the
104 * difference between the reference value and the current
105 * acceleration with inactivity_threshold. If the difference is below
106 * inactivity_threshold for a total of inactivity_time, the device is
107 * considered inactive and the inactivity interrupt is triggered.
108 */
109
110#define ADXL_ACT_ACDC (1 << 7)
111#define ADXL_ACT_X_EN (1 << 6)
112#define ADXL_ACT_Y_EN (1 << 5)
113#define ADXL_ACT_Z_EN (1 << 4)
114#define ADXL_INACT_ACDC (1 << 3)
115#define ADXL_INACT_X_EN (1 << 2)
116#define ADXL_INACT_Y_EN (1 << 1)
117#define ADXL_INACT_Z_EN (1 << 0)
118
119 u8 act_axis_control;
120
121 /*
122 * activity_threshold:
123 * holds the threshold value for activity detection.
124 * The data format is unsigned. The scale factor is
125 * 62.5 mg/LSB. A zero value may result in undesirable behavior if
126 * Activity interrupt is enabled.
127 */
128
129 u8 activity_threshold;
130
131 /*
132 * inactivity_threshold:
133 * holds the threshold value for inactivity
134 * detection. The data format is unsigned. The scale
135 * factor is 62.5 mg/LSB. A zero value may result in undesirable
136 * behavior if Inactivity interrupt is enabled.
137 */
138
139 u8 inactivity_threshold;
140
141 /*
142 * inactivity_time:
143 * is an unsigned time value representing the
144 * amount of time that acceleration must be below the value in
145 * inactivity_threshold for inactivity to be declared. The scale factor
146 * is 1 second/LSB. Unlike the other interrupt functions, which
147 * operate on unfiltered data, the inactivity function operates on the
148 * filtered output data. At least one output sample must be
149 * generated for the inactivity interrupt to be triggered. This will
150 * result in the function appearing un-responsive if the
151 * inactivity_time register is set with a value less than the time
152 * constant of the Output Data Rate. A zero value will result in an
153 * interrupt when the output data is below inactivity_threshold.
154 */
155
156 u8 inactivity_time;
157
158 /*
159 * free_fall_threshold:
160 * holds the threshold value for Free-Fall detection.
161 * The data format is unsigned. The root-sum-square(RSS) value
162 * of all axes is calculated and compared to the value in
163 * free_fall_threshold to determine if a free fall event may be
164 * occurring. The scale factor is 62.5 mg/LSB. A zero value may
165 * result in undesirable behavior if Free-Fall interrupt is
166 * enabled. Values between 300 and 600 mg (0x05 to 0x09) are
167 * recommended.
168 */
169
170 u8 free_fall_threshold;
171
172 /*
173 * free_fall_time:
174 * is an unsigned time value representing the minimum
175 * time that the RSS value of all axes must be less than
176 * free_fall_threshold to generate a Free-Fall interrupt. The
177 * scale factor is 5 ms/LSB. A zero value may result in
178 * undesirable behavior if Free-Fall interrupt is enabled.
179 * Values between 100 to 350 ms (0x14 to 0x46) are recommended.
180 */
181
182 u8 free_fall_time;
183
184 /*
185 * data_rate:
186 * Selects device bandwidth and output data rate.
187 * RATE = 3200 Hz / (2^(15 - x)). Default value is 0x0A, or 100 Hz
188 * Output Data Rate. An Output Data Rate should be selected that
189 * is appropriate for the communication protocol and frequency
190 * selected. Selecting too high of an Output Data Rate with a low
191 * communication speed will result in samples being discarded.
192 */
193
194 u8 data_rate;
195
196 /*
197 * data_range:
198 * FULL_RES: When this bit is set with the device is
199 * in Full-Resolution Mode, where the output resolution increases
200 * with RANGE to maintain a 4 mg/LSB scale factor. When this
201 * bit is cleared the device is in 10-bit Mode and RANGE determine the
202 * maximum g-Range and scale factor.
203 */
204
205#define ADXL_FULL_RES (1 << 3)
206#define ADXL_RANGE_PM_2g 0
207#define ADXL_RANGE_PM_4g 1
208#define ADXL_RANGE_PM_8g 2
209#define ADXL_RANGE_PM_16g 3
210
211 u8 data_range;
212
213 /*
214 * low_power_mode:
215 * A '0' = Normal operation and a '1' = Reduced
216 * power operation with somewhat higher noise.
217 */
218
219 u8 low_power_mode;
220
221 /*
222 * power_mode:
223 * LINK: A '1' with both the activity and inactivity functions
224 * enabled will delay the start of the activity function until
225 * inactivity is detected. Once activity is detected, inactivity
226 * detection will begin and prevent the detection of activity. This
227 * bit serially links the activity and inactivity functions. When '0'
228 * the inactivity and activity functions are concurrent. Additional
229 * information can be found in the Application section under Link
230 * Mode.
231 * AUTO_SLEEP: A '1' sets the ADXL34x to switch to Sleep Mode
232 * when inactivity (acceleration has been below inactivity_threshold
233 * for at least inactivity_time) is detected and the LINK bit is set.
234 * A '0' disables automatic switching to Sleep Mode. See SLEEP
235 * for further description.
236 */
237
238#define ADXL_LINK (1 << 5)
239#define ADXL_AUTO_SLEEP (1 << 4)
240
241 u8 power_mode;
242
243 /*
244 * fifo_mode:
245 * BYPASS The FIFO is bypassed
246 * FIFO FIFO collects up to 32 values then stops collecting data
247 * STREAM FIFO holds the last 32 data values. Once full, the FIFO's
248 * oldest data is lost as it is replaced with newer data
249 *
250 * DEFAULT should be ADXL_FIFO_STREAM
251 */
252
253#define ADXL_FIFO_BYPASS 0
254#define ADXL_FIFO_FIFO 1
255#define ADXL_FIFO_STREAM 2
256
257 u8 fifo_mode;
258
259 /*
260 * watermark:
261 * The Watermark feature can be used to reduce the interrupt load
262 * of the system. The FIFO fills up to the value stored in watermark
263 * [1..32] and then generates an interrupt.
264 * A '0' disables the watermark feature.
265 */
266
267 u8 watermark;
268
269 u32 ev_type; /* EV_ABS or EV_REL */
270
271 u32 ev_code_x; /* ABS_X,Y,Z or REL_X,Y,Z */
272 u32 ev_code_y; /* ABS_X,Y,Z or REL_X,Y,Z */
273 u32 ev_code_z; /* ABS_X,Y,Z or REL_X,Y,Z */
274
275 /*
276 * A valid BTN or KEY Code; use tap_axis_control to disable
277 * event reporting
278 */
279
280 u32 ev_code_tap[3]; /* EV_KEY {X-Axis, Y-Axis, Z-Axis} */
281
282 /*
283 * A valid BTN or KEY Code for Free-Fall or Activity enables
284 * input event reporting. A '0' disables the Free-Fall or
285 * Activity reporting.
286 */
287
288 u32 ev_code_ff; /* EV_KEY */
289 u32 ev_code_act_inactivity; /* EV_KEY */
290
291 /*
292 * Use ADXL34x INT2 instead of INT1
293 */
294 u8 use_int2;
295
296 /*
297 * ADXL346 only ORIENTATION SENSING feature
298 * The orientation function of the ADXL346 reports both 2-D and
299 * 3-D orientation concurrently.
300 */
301
302#define ADXL_EN_ORIENTATION_2D 1
303#define ADXL_EN_ORIENTATION_3D 2
304#define ADXL_EN_ORIENTATION_2D_3D 3
305
306 u8 orientation_enable;
307
308 /*
309 * The width of the deadzone region between two or more
310 * orientation positions is determined by setting the Deadzone
311 * value. The deadzone region size can be specified with a
312 * resolution of 3.6deg. The deadzone angle represents the total
313 * angle where the orientation is considered invalid.
314 */
315
316#define ADXL_DEADZONE_ANGLE_0p0 0 /* !!!0.0 [deg] */
317#define ADXL_DEADZONE_ANGLE_3p6 1 /* 3.6 [deg] */
318#define ADXL_DEADZONE_ANGLE_7p2 2 /* 7.2 [deg] */
319#define ADXL_DEADZONE_ANGLE_10p8 3 /* 10.8 [deg] */
320#define ADXL_DEADZONE_ANGLE_14p4 4 /* 14.4 [deg] */
321#define ADXL_DEADZONE_ANGLE_18p0 5 /* 18.0 [deg] */
322#define ADXL_DEADZONE_ANGLE_21p6 6 /* 21.6 [deg] */
323#define ADXL_DEADZONE_ANGLE_25p2 7 /* 25.2 [deg] */
324
325 u8 deadzone_angle;
326
327 /*
328 * To eliminate most human motion such as walking or shaking,
329 * a Divisor value should be selected to effectively limit the
330 * orientation bandwidth. Set the depth of the filter used to
331 * low-pass filter the measured acceleration for stable
332 * orientation sensing
333 */
334
335#define ADXL_LP_FILTER_DIVISOR_2 0
336#define ADXL_LP_FILTER_DIVISOR_4 1
337#define ADXL_LP_FILTER_DIVISOR_8 2
338#define ADXL_LP_FILTER_DIVISOR_16 3
339#define ADXL_LP_FILTER_DIVISOR_32 4
340#define ADXL_LP_FILTER_DIVISOR_64 5
341#define ADXL_LP_FILTER_DIVISOR_128 6
342#define ADXL_LP_FILTER_DIVISOR_256 7
343
344 u8 divisor_length;
345
346 u32 ev_codes_orient_2d[4]; /* EV_KEY {+X, -X, +Y, -Y} */
347 u32 ev_codes_orient_3d[6]; /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
348};
349#endif
diff --git a/include/linux/input/cy8ctmg110_pdata.h b/include/linux/input/cy8ctmg110_pdata.h
new file mode 100644
index 000000000000..09522cb59910
--- /dev/null
+++ b/include/linux/input/cy8ctmg110_pdata.h
@@ -0,0 +1,10 @@
1#ifndef _LINUX_CY8CTMG110_PDATA_H
2#define _LINUX_CY8CTMG110_PDATA_H
3
4struct cy8ctmg110_pdata
5{
6 int reset_pin; /* Reset pin is wired to this GPIO (optional) */
7 int irq_pin; /* IRQ pin is wired to this GPIO */
8};
9
10#endif
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
index c964cd7f436a..80352ad6581a 100644
--- a/include/linux/input/matrix_keypad.h
+++ b/include/linux/input/matrix_keypad.h
@@ -41,6 +41,9 @@ struct matrix_keymap_data {
41 * @col_scan_delay_us: delay, measured in microseconds, that is 41 * @col_scan_delay_us: delay, measured in microseconds, that is
42 * needed before we can keypad after activating column gpio 42 * needed before we can keypad after activating column gpio
43 * @debounce_ms: debounce interval in milliseconds 43 * @debounce_ms: debounce interval in milliseconds
44 * @clustered_irq: may be specified if interrupts of all row/column GPIOs
45 * are bundled to one single irq
46 * @clustered_irq_flags: flags that are needed for the clustered irq
44 * @active_low: gpio polarity 47 * @active_low: gpio polarity
45 * @wakeup: controls whether the device should be set up as wakeup 48 * @wakeup: controls whether the device should be set up as wakeup
46 * source 49 * source
@@ -63,6 +66,9 @@ struct matrix_keypad_platform_data {
63 /* key debounce interval in milli-second */ 66 /* key debounce interval in milli-second */
64 unsigned int debounce_ms; 67 unsigned int debounce_ms;
65 68
69 unsigned int clustered_irq;
70 unsigned int clustered_irq_flags;
71
66 bool active_low; 72 bool active_low;
67 bool wakeup; 73 bool wakeup;
68 bool no_autorepeat; 74 bool no_autorepeat;
diff --git a/include/linux/intel_mid_dma.h b/include/linux/intel_mid_dma.h
new file mode 100644
index 000000000000..d9d08b6269b6
--- /dev/null
+++ b/include/linux/intel_mid_dma.h
@@ -0,0 +1,86 @@
1/*
2 * intel_mid_dma.h - Intel MID DMA Drivers
3 *
4 * Copyright (C) 2008-10 Intel Corp
5 * Author: Vinod Koul <vinod.koul@intel.com>
6 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
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 along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20 *
21 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 *
23 *
24 */
25#ifndef __INTEL_MID_DMA_H__
26#define __INTEL_MID_DMA_H__
27
28#include <linux/dmaengine.h>
29
30/*DMA transaction width, src and dstn width would be same
31The DMA length must be width aligned,
32for 32 bit width the length must be 32 bit (4bytes) aligned only*/
33enum intel_mid_dma_width {
34 LNW_DMA_WIDTH_8BIT = 0x0,
35 LNW_DMA_WIDTH_16BIT = 0x1,
36 LNW_DMA_WIDTH_32BIT = 0x2,
37};
38
39/*DMA mode configurations*/
40enum intel_mid_dma_mode {
41 LNW_DMA_PER_TO_MEM = 0, /*periphral to memory configuration*/
42 LNW_DMA_MEM_TO_PER, /*memory to periphral configuration*/
43 LNW_DMA_MEM_TO_MEM, /*mem to mem confg (testing only)*/
44};
45
46/*DMA handshaking*/
47enum intel_mid_dma_hs_mode {
48 LNW_DMA_HW_HS = 0, /*HW Handshaking only*/
49 LNW_DMA_SW_HS = 1, /*SW Handshaking not recommended*/
50};
51
52/*Burst size configuration*/
53enum intel_mid_dma_msize {
54 LNW_DMA_MSIZE_1 = 0x0,
55 LNW_DMA_MSIZE_4 = 0x1,
56 LNW_DMA_MSIZE_8 = 0x2,
57 LNW_DMA_MSIZE_16 = 0x3,
58 LNW_DMA_MSIZE_32 = 0x4,
59 LNW_DMA_MSIZE_64 = 0x5,
60};
61
62/**
63 * struct intel_mid_dma_slave - DMA slave structure
64 *
65 * @dirn: DMA trf direction
66 * @src_width: tx register width
67 * @dst_width: rx register width
68 * @hs_mode: HW/SW handshaking mode
69 * @cfg_mode: DMA data transfer mode (per-per/mem-per/mem-mem)
70 * @src_msize: Source DMA burst size
71 * @dst_msize: Dst DMA burst size
72 * @device_instance: DMA peripheral device instance, we can have multiple
73 * peripheral device connected to single DMAC
74 */
75struct intel_mid_dma_slave {
76 enum dma_data_direction dirn;
77 enum intel_mid_dma_width src_width; /*width of DMA src txn*/
78 enum intel_mid_dma_width dst_width; /*width of DMA dst txn*/
79 enum intel_mid_dma_hs_mode hs_mode; /*handshaking*/
80 enum intel_mid_dma_mode cfg_mode; /*mode configuration*/
81 enum intel_mid_dma_msize src_msize; /*size if src burst*/
82 enum intel_mid_dma_msize dst_msize; /*size of dst burst*/
83 unsigned int device_instance; /*0, 1 for periphral instance*/
84};
85
86#endif /*__INTEL_MID_DMA_H__*/
diff --git a/include/linux/intel_pmic_gpio.h b/include/linux/intel_pmic_gpio.h
new file mode 100644
index 000000000000..920109a29191
--- /dev/null
+++ b/include/linux/intel_pmic_gpio.h
@@ -0,0 +1,15 @@
1#ifndef LINUX_INTEL_PMIC_H
2#define LINUX_INTEL_PMIC_H
3
4struct intel_pmic_gpio_platform_data {
5 /* the first IRQ of the chip */
6 unsigned irq_base;
7 /* number assigned to the first GPIO */
8 unsigned gpio_base;
9 /* sram address for gpiointr register, the langwell chip will map
10 * the PMIC spi GPIO expander's GPIOINTR register in sram.
11 */
12 unsigned gpiointr;
13};
14
15#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index c2331138ca1b..a0384a4d1e6f 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -53,16 +53,21 @@
53 * IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished. 53 * IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished.
54 * Used by threaded interrupts which need to keep the 54 * Used by threaded interrupts which need to keep the
55 * irq line disabled until the threaded handler has been run. 55 * irq line disabled until the threaded handler has been run.
56 * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend
57 *
56 */ 58 */
57#define IRQF_DISABLED 0x00000020 59#define IRQF_DISABLED 0x00000020
58#define IRQF_SAMPLE_RANDOM 0x00000040 60#define IRQF_SAMPLE_RANDOM 0x00000040
59#define IRQF_SHARED 0x00000080 61#define IRQF_SHARED 0x00000080
60#define IRQF_PROBE_SHARED 0x00000100 62#define IRQF_PROBE_SHARED 0x00000100
61#define IRQF_TIMER 0x00000200 63#define __IRQF_TIMER 0x00000200
62#define IRQF_PERCPU 0x00000400 64#define IRQF_PERCPU 0x00000400
63#define IRQF_NOBALANCING 0x00000800 65#define IRQF_NOBALANCING 0x00000800
64#define IRQF_IRQPOLL 0x00001000 66#define IRQF_IRQPOLL 0x00001000
65#define IRQF_ONESHOT 0x00002000 67#define IRQF_ONESHOT 0x00002000
68#define IRQF_NO_SUSPEND 0x00004000
69
70#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND)
66 71
67/* 72/*
68 * Bits used by threaded handlers: 73 * Bits used by threaded handlers:
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index 25085ddd955f..0a6b3d5c490c 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -22,7 +22,6 @@
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/page.h> 24#include <asm/page.h>
25#include <asm/iomap.h>
26 25
27/* 26/*
28 * The io_mapping mechanism provides an abstraction for mapping 27 * The io_mapping mechanism provides an abstraction for mapping
@@ -33,6 +32,8 @@
33 32
34#ifdef CONFIG_HAVE_ATOMIC_IOMAP 33#ifdef CONFIG_HAVE_ATOMIC_IOMAP
35 34
35#include <asm/iomap.h>
36
36struct io_mapping { 37struct io_mapping {
37 resource_size_t base; 38 resource_size_t base;
38 unsigned long size; 39 unsigned long size;
@@ -79,7 +80,9 @@ io_mapping_free(struct io_mapping *mapping)
79 80
80/* Atomic map/unmap */ 81/* Atomic map/unmap */
81static inline void * 82static inline void *
82io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset) 83io_mapping_map_atomic_wc(struct io_mapping *mapping,
84 unsigned long offset,
85 int slot)
83{ 86{
84 resource_size_t phys_addr; 87 resource_size_t phys_addr;
85 unsigned long pfn; 88 unsigned long pfn;
@@ -87,13 +90,13 @@ io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset)
87 BUG_ON(offset >= mapping->size); 90 BUG_ON(offset >= mapping->size);
88 phys_addr = mapping->base + offset; 91 phys_addr = mapping->base + offset;
89 pfn = (unsigned long) (phys_addr >> PAGE_SHIFT); 92 pfn = (unsigned long) (phys_addr >> PAGE_SHIFT);
90 return iomap_atomic_prot_pfn(pfn, KM_USER0, mapping->prot); 93 return iomap_atomic_prot_pfn(pfn, slot, mapping->prot);
91} 94}
92 95
93static inline void 96static inline void
94io_mapping_unmap_atomic(void *vaddr) 97io_mapping_unmap_atomic(void *vaddr, int slot)
95{ 98{
96 iounmap_atomic(vaddr, KM_USER0); 99 iounmap_atomic(vaddr, slot);
97} 100}
98 101
99static inline void * 102static inline void *
@@ -133,13 +136,15 @@ io_mapping_free(struct io_mapping *mapping)
133 136
134/* Atomic map/unmap */ 137/* Atomic map/unmap */
135static inline void * 138static inline void *
136io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset) 139io_mapping_map_atomic_wc(struct io_mapping *mapping,
140 unsigned long offset,
141 int slot)
137{ 142{
138 return ((char *) mapping) + offset; 143 return ((char *) mapping) + offset;
139} 144}
140 145
141static inline void 146static inline void
142io_mapping_unmap_atomic(void *vaddr) 147io_mapping_unmap_atomic(void *vaddr, int slot)
143{ 148{
144} 149}
145 150
diff --git a/include/linux/io.h b/include/linux/io.h
index 6c7f0ba0d5fa..7fd2d2138bf3 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -29,10 +29,10 @@ void __iowrite64_copy(void __iomem *to, const void *from, size_t count);
29 29
30#ifdef CONFIG_MMU 30#ifdef CONFIG_MMU
31int ioremap_page_range(unsigned long addr, unsigned long end, 31int ioremap_page_range(unsigned long addr, unsigned long end,
32 unsigned long phys_addr, pgprot_t prot); 32 phys_addr_t phys_addr, pgprot_t prot);
33#else 33#else
34static inline int ioremap_page_range(unsigned long addr, unsigned long end, 34static inline int ioremap_page_range(unsigned long addr, unsigned long end,
35 unsigned long phys_addr, pgprot_t prot) 35 phys_addr_t phys_addr, pgprot_t prot)
36{ 36{
37 return 0; 37 return 0;
38} 38}
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h
index 64d1b638745d..86bdeffe43ad 100644
--- a/include/linux/iommu-helper.h
+++ b/include/linux/iommu-helper.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_IOMMU_HELPER_H 1#ifndef _LINUX_IOMMU_HELPER_H
2#define _LINUX_IOMMU_HELPER_H 2#define _LINUX_IOMMU_HELPER_H
3 3
4#include <linux/kernel.h>
5
4static inline unsigned long iommu_device_max_index(unsigned long size, 6static inline unsigned long iommu_device_max_index(unsigned long size,
5 unsigned long offset, 7 unsigned long offset,
6 u64 dma_mask) 8 u64 dma_mask)
@@ -20,7 +22,13 @@ extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
20 unsigned long boundary_size, 22 unsigned long boundary_size,
21 unsigned long align_mask); 23 unsigned long align_mask);
22 24
23extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len, 25static inline unsigned long iommu_num_pages(unsigned long addr,
24 unsigned long io_page_size); 26 unsigned long len,
27 unsigned long io_page_size)
28{
29 unsigned long size = (addr & (io_page_size - 1)) + len;
30
31 return DIV_ROUND_UP(size, io_page_size);
32}
25 33
26#endif 34#endif
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index be22ad83689c..0a2ba4098996 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -30,6 +30,7 @@ struct iommu_domain {
30}; 30};
31 31
32#define IOMMU_CAP_CACHE_COHERENCY 0x1 32#define IOMMU_CAP_CACHE_COHERENCY 0x1
33#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */
33 34
34struct iommu_ops { 35struct iommu_ops {
35 int (*domain_init)(struct iommu_domain *domain); 36 int (*domain_init)(struct iommu_domain *domain);
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
index dfc170362842..9708de265bb1 100644
--- a/include/linux/ip_vs.h
+++ b/include/linux/ip_vs.h
@@ -19,6 +19,7 @@
19 */ 19 */
20#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */ 20#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
21#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */ 21#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
22#define IP_VS_SVC_F_ONEPACKET 0x0004 /* one-packet scheduling */
22 23
23/* 24/*
24 * Destination Server Flags 25 * Destination Server Flags
@@ -85,6 +86,7 @@
85#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */ 86#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
86#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */ 87#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
87#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */ 88#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
89#define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */
88 90
89#define IP_VS_SCHEDNAME_MAXLEN 16 91#define IP_VS_SCHEDNAME_MAXLEN 16
90#define IP_VS_IFNAME_MAXLEN 16 92#define IP_VS_IFNAME_MAXLEN 16
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 99e1ab7e3eec..ab9e9e89e407 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -58,7 +58,7 @@ struct ipv6_opt_hdr {
58 /* 58 /*
59 * TLV encoded option data follows. 59 * TLV encoded option data follows.
60 */ 60 */
61} __attribute__ ((packed)); /* required for some archs */ 61} __packed; /* required for some archs */
62 62
63#define ipv6_destopt_hdr ipv6_opt_hdr 63#define ipv6_destopt_hdr ipv6_opt_hdr
64#define ipv6_hopopt_hdr ipv6_opt_hdr 64#define ipv6_hopopt_hdr ipv6_opt_hdr
@@ -99,7 +99,7 @@ struct ipv6_destopt_hao {
99 __u8 type; 99 __u8 type;
100 __u8 length; 100 __u8 length;
101 struct in6_addr addr; 101 struct in6_addr addr;
102} __attribute__ ((__packed__)); 102} __packed;
103 103
104/* 104/*
105 * IPv6 fixed header 105 * IPv6 fixed header
@@ -246,7 +246,7 @@ struct inet6_skb_parm {
246 __u16 srcrt; 246 __u16 srcrt;
247 __u16 dst1; 247 __u16 dst1;
248 __u16 lastopt; 248 __u16 lastopt;
249 __u32 nhoff; 249 __u16 nhoff;
250 __u16 flags; 250 __u16 flags;
251#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) 251#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
252 __u16 dsthao; 252 __u16 dsthao;
diff --git a/include/linux/iscsi_boot_sysfs.h b/include/linux/iscsi_boot_sysfs.h
new file mode 100644
index 000000000000..f1e6c184f14f
--- /dev/null
+++ b/include/linux/iscsi_boot_sysfs.h
@@ -0,0 +1,123 @@
1/*
2 * Export the iSCSI boot info to userland via sysfs.
3 *
4 * Copyright (C) 2010 Red Hat, Inc. All rights reserved.
5 * Copyright (C) 2010 Mike Christie
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 v2.0 as published by
9 * the Free Software Foundation
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16#ifndef _ISCSI_BOOT_SYSFS_
17#define _ISCSI_BOOT_SYSFS_
18
19/*
20 * The text attributes names for each of the kobjects.
21*/
22enum iscsi_boot_eth_properties_enum {
23 ISCSI_BOOT_ETH_INDEX,
24 ISCSI_BOOT_ETH_FLAGS,
25 ISCSI_BOOT_ETH_IP_ADDR,
26 ISCSI_BOOT_ETH_SUBNET_MASK,
27 ISCSI_BOOT_ETH_ORIGIN,
28 ISCSI_BOOT_ETH_GATEWAY,
29 ISCSI_BOOT_ETH_PRIMARY_DNS,
30 ISCSI_BOOT_ETH_SECONDARY_DNS,
31 ISCSI_BOOT_ETH_DHCP,
32 ISCSI_BOOT_ETH_VLAN,
33 ISCSI_BOOT_ETH_MAC,
34 /* eth_pci_bdf - this is replaced by link to the device itself. */
35 ISCSI_BOOT_ETH_HOSTNAME,
36 ISCSI_BOOT_ETH_END_MARKER,
37};
38
39enum iscsi_boot_tgt_properties_enum {
40 ISCSI_BOOT_TGT_INDEX,
41 ISCSI_BOOT_TGT_FLAGS,
42 ISCSI_BOOT_TGT_IP_ADDR,
43 ISCSI_BOOT_TGT_PORT,
44 ISCSI_BOOT_TGT_LUN,
45 ISCSI_BOOT_TGT_CHAP_TYPE,
46 ISCSI_BOOT_TGT_NIC_ASSOC,
47 ISCSI_BOOT_TGT_NAME,
48 ISCSI_BOOT_TGT_CHAP_NAME,
49 ISCSI_BOOT_TGT_CHAP_SECRET,
50 ISCSI_BOOT_TGT_REV_CHAP_NAME,
51 ISCSI_BOOT_TGT_REV_CHAP_SECRET,
52 ISCSI_BOOT_TGT_END_MARKER,
53};
54
55enum iscsi_boot_initiator_properties_enum {
56 ISCSI_BOOT_INI_INDEX,
57 ISCSI_BOOT_INI_FLAGS,
58 ISCSI_BOOT_INI_ISNS_SERVER,
59 ISCSI_BOOT_INI_SLP_SERVER,
60 ISCSI_BOOT_INI_PRI_RADIUS_SERVER,
61 ISCSI_BOOT_INI_SEC_RADIUS_SERVER,
62 ISCSI_BOOT_INI_INITIATOR_NAME,
63 ISCSI_BOOT_INI_END_MARKER,
64};
65
66struct attribute_group;
67
68struct iscsi_boot_kobj {
69 struct kobject kobj;
70 struct attribute_group *attr_group;
71 struct list_head list;
72
73 /*
74 * Pointer to store driver specific info. If set this will
75 * be freed for the LLD when the kobj release function is called.
76 */
77 void *data;
78 /*
79 * Driver specific show function.
80 *
81 * The enum of the type. This can be any value of the above
82 * properties.
83 */
84 ssize_t (*show) (void *data, int type, char *buf);
85
86 /*
87 * Drivers specific visibility function.
88 * The function should return if they the attr should be readable
89 * writable or should not be shown.
90 *
91 * The enum of the type. This can be any value of the above
92 * properties.
93 */
94 mode_t (*is_visible) (void *data, int type);
95};
96
97struct iscsi_boot_kset {
98 struct list_head kobj_list;
99 struct kset *kset;
100};
101
102struct iscsi_boot_kobj *
103iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index,
104 void *data,
105 ssize_t (*show) (void *data, int type, char *buf),
106 mode_t (*is_visible) (void *data, int type));
107
108struct iscsi_boot_kobj *
109iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index,
110 void *data,
111 ssize_t (*show) (void *data, int type, char *buf),
112 mode_t (*is_visible) (void *data, int type));
113struct iscsi_boot_kobj *
114iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index,
115 void *data,
116 ssize_t (*show) (void *data, int type, char *buf),
117 mode_t (*is_visible) (void *data, int type));
118
119struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name);
120struct iscsi_boot_kset *iscsi_boot_create_host_kset(unsigned int hostno);
121void iscsi_boot_destroy_kset(struct iscsi_boot_kset *boot_kset);
122
123#endif
diff --git a/include/linux/iscsi_ibft.h b/include/linux/iscsi_ibft.h
index d2e4042f8f5e..8ba7e5b9d62c 100644
--- a/include/linux/iscsi_ibft.h
+++ b/include/linux/iscsi_ibft.h
@@ -21,21 +21,13 @@
21#ifndef ISCSI_IBFT_H 21#ifndef ISCSI_IBFT_H
22#define ISCSI_IBFT_H 22#define ISCSI_IBFT_H
23 23
24struct ibft_table_header { 24#include <acpi/acpi.h>
25 char signature[4];
26 u32 length;
27 u8 revision;
28 u8 checksum;
29 char oem_id[6];
30 char oem_table_id[8];
31 char reserved[24];
32} __attribute__((__packed__));
33 25
34/* 26/*
35 * Logical location of iSCSI Boot Format Table. 27 * Logical location of iSCSI Boot Format Table.
36 * If the value is NULL there is no iBFT on the machine. 28 * If the value is NULL there is no iBFT on the machine.
37 */ 29 */
38extern struct ibft_table_header *ibft_addr; 30extern struct acpi_table_ibft *ibft_addr;
39 31
40/* 32/*
41 * Routine used to find and reserve the iSCSI Boot Format Table. The 33 * Routine used to find and reserve the iSCSI Boot Format Table. The
diff --git a/include/linux/isdnif.h b/include/linux/isdnif.h
index b9b5a684ed69..b8c23f88dd54 100644
--- a/include/linux/isdnif.h
+++ b/include/linux/isdnif.h
@@ -317,7 +317,7 @@ typedef struct T30_s {
317 __u8 r_scantime; 317 __u8 r_scantime;
318 __u8 r_id[FAXIDLEN]; 318 __u8 r_id[FAXIDLEN];
319 __u8 r_code; 319 __u8 r_code;
320} __attribute__((packed)) T30_s; 320} __packed T30_s;
321 321
322#define ISDN_TTY_FAX_CONN_IN 0 322#define ISDN_TTY_FAX_CONN_IN 0
323#define ISDN_TTY_FAX_CONN_OUT 1 323#define ISDN_TTY_FAX_CONN_OUT 1
diff --git a/include/linux/istallion.h b/include/linux/istallion.h
index 7faca98c7d14..ad700a60c158 100644
--- a/include/linux/istallion.h
+++ b/include/linux/istallion.h
@@ -86,7 +86,7 @@ struct stlibrd {
86 unsigned long magic; 86 unsigned long magic;
87 unsigned int brdnr; 87 unsigned int brdnr;
88 unsigned int brdtype; 88 unsigned int brdtype;
89 unsigned int state; 89 unsigned long state;
90 unsigned int nrpanels; 90 unsigned int nrpanels;
91 unsigned int nrports; 91 unsigned int nrports;
92 unsigned int nrdevs; 92 unsigned int nrdevs;
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index adf832dec3f3..0b52924a0cb6 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -601,13 +601,13 @@ struct transaction_s
601 * Number of outstanding updates running on this transaction 601 * Number of outstanding updates running on this transaction
602 * [t_handle_lock] 602 * [t_handle_lock]
603 */ 603 */
604 int t_updates; 604 atomic_t t_updates;
605 605
606 /* 606 /*
607 * Number of buffers reserved for use by all handles in this transaction 607 * Number of buffers reserved for use by all handles in this transaction
608 * handle but not yet modified. [t_handle_lock] 608 * handle but not yet modified. [t_handle_lock]
609 */ 609 */
610 int t_outstanding_credits; 610 atomic_t t_outstanding_credits;
611 611
612 /* 612 /*
613 * Forward and backward links for the circular list of all transactions 613 * Forward and backward links for the circular list of all transactions
@@ -629,7 +629,7 @@ struct transaction_s
629 /* 629 /*
630 * How many handles used this transaction? [t_handle_lock] 630 * How many handles used this transaction? [t_handle_lock]
631 */ 631 */
632 int t_handle_count; 632 atomic_t t_handle_count;
633 633
634 /* 634 /*
635 * This transaction is being forced and some process is 635 * This transaction is being forced and some process is
@@ -764,7 +764,7 @@ struct journal_s
764 /* 764 /*
765 * Protect the various scalars in the journal 765 * Protect the various scalars in the journal
766 */ 766 */
767 spinlock_t j_state_lock; 767 rwlock_t j_state_lock;
768 768
769 /* 769 /*
770 * Number of processes waiting to create a barrier lock [j_state_lock] 770 * Number of processes waiting to create a barrier lock [j_state_lock]
@@ -1082,7 +1082,9 @@ static inline handle_t *journal_current_handle(void)
1082 */ 1082 */
1083 1083
1084extern handle_t *jbd2_journal_start(journal_t *, int nblocks); 1084extern handle_t *jbd2_journal_start(journal_t *, int nblocks);
1085extern int jbd2_journal_restart (handle_t *, int nblocks); 1085extern handle_t *jbd2__journal_start(journal_t *, int nblocks, int gfp_mask);
1086extern int jbd2_journal_restart(handle_t *, int nblocks);
1087extern int jbd2__journal_restart(handle_t *, int nblocks, int gfp_mask);
1086extern int jbd2_journal_extend (handle_t *, int nblocks); 1088extern int jbd2_journal_extend (handle_t *, int nblocks);
1087extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); 1089extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *);
1088extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); 1090extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *);
@@ -1257,8 +1259,8 @@ static inline int jbd_space_needed(journal_t *journal)
1257{ 1259{
1258 int nblocks = journal->j_max_transaction_buffers; 1260 int nblocks = journal->j_max_transaction_buffers;
1259 if (journal->j_committing_transaction) 1261 if (journal->j_committing_transaction)
1260 nblocks += journal->j_committing_transaction-> 1262 nblocks += atomic_read(&journal->j_committing_transaction->
1261 t_outstanding_credits; 1263 t_outstanding_credits);
1262 return nblocks; 1264 return nblocks;
1263} 1265}
1264 1266
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h
index 0874ab59ffef..a18b719f49d4 100644
--- a/include/linux/jffs2.h
+++ b/include/linux/jffs2.h
@@ -1,7 +1,8 @@
1/* 1/*
2 * JFFS2 -- Journalling Flash File System, Version 2. 2 * JFFS2 -- Journalling Flash File System, Version 2.
3 * 3 *
4 * Copyright (C) 2001-2003 Red Hat, Inc. 4 * Copyright © 2001-2007 Red Hat, Inc.
5 * Copyright © 2004-2010 David Woodhouse <dwmw2@infradead.org>
5 * 6 *
6 * Created by David Woodhouse <dwmw2@infradead.org> 7 * Created by David Woodhouse <dwmw2@infradead.org>
7 * 8 *
@@ -185,7 +186,7 @@ struct jffs2_raw_xref
185 jint32_t hdr_crc; 186 jint32_t hdr_crc;
186 jint32_t ino; /* inode number */ 187 jint32_t ino; /* inode number */
187 jint32_t xid; /* XATTR identifier number */ 188 jint32_t xid; /* XATTR identifier number */
188 jint32_t xseqno; /* xref sequencial number */ 189 jint32_t xseqno; /* xref sequential number */
189 jint32_t node_crc; 190 jint32_t node_crc;
190} __attribute__((packed)); 191} __attribute__((packed));
191 192
diff --git a/include/linux/jz4740-adc.h b/include/linux/jz4740-adc.h
new file mode 100644
index 000000000000..9053f95e9687
--- /dev/null
+++ b/include/linux/jz4740-adc.h
@@ -0,0 +1,32 @@
1
2#ifndef __LINUX_JZ4740_ADC
3#define __LINUX_JZ4740_ADC
4
5#include <linux/device.h>
6
7/*
8 * jz4740_adc_set_config - Configure a JZ4740 adc device
9 * @dev: Pointer to a jz4740-adc device
10 * @mask: Mask for the config value to be set
11 * @val: Value to be set
12 *
13 * This function can be used by the JZ4740 ADC mfd cells to configure their
14 * options in the shared config register.
15*/
16int jz4740_adc_set_config(struct device *dev, uint32_t mask, uint32_t val);
17
18#define JZ_ADC_CONFIG_SPZZ BIT(31)
19#define JZ_ADC_CONFIG_EX_IN BIT(30)
20#define JZ_ADC_CONFIG_DNUM_MASK (0x7 << 16)
21#define JZ_ADC_CONFIG_DMA_ENABLE BIT(15)
22#define JZ_ADC_CONFIG_XYZ_MASK (0x2 << 13)
23#define JZ_ADC_CONFIG_SAMPLE_NUM_MASK (0x7 << 10)
24#define JZ_ADC_CONFIG_CLKDIV_MASK (0xf << 5)
25#define JZ_ADC_CONFIG_BAT_MB BIT(4)
26
27#define JZ_ADC_CONFIG_DNUM(dnum) ((dnum) << 16)
28#define JZ_ADC_CONFIG_XYZ_OFFSET(dnum) ((xyz) << 13)
29#define JZ_ADC_CONFIG_SAMPLE_NUM(x) ((x) << 10)
30#define JZ_ADC_CONFIG_CLKDIV(div) ((div) << 5)
31
32#endif
diff --git a/include/linux/kdb.h b/include/linux/kdb.h
index ccb2b3ec0fe8..ea6e5244ed3f 100644
--- a/include/linux/kdb.h
+++ b/include/linux/kdb.h
@@ -114,4 +114,8 @@ enum {
114 KDB_INIT_EARLY, 114 KDB_INIT_EARLY,
115 KDB_INIT_FULL, 115 KDB_INIT_FULL,
116}; 116};
117
118extern int kdbgetintenv(const char *, int *);
119extern int kdb_set(int, const char **);
120
117#endif /* !_KDB_H */ 121#endif /* !_KDB_H */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 8317ec4b9f3b..2b0a35e6bc69 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -171,12 +171,18 @@ static inline void might_fault(void)
171} 171}
172#endif 172#endif
173 173
174struct va_format {
175 const char *fmt;
176 va_list *va;
177};
178
174extern struct atomic_notifier_head panic_notifier_list; 179extern struct atomic_notifier_head panic_notifier_list;
175extern long (*panic_blink)(long time); 180extern long (*panic_blink)(int state);
176NORET_TYPE void panic(const char * fmt, ...) 181NORET_TYPE void panic(const char * fmt, ...)
177 __attribute__ ((NORET_AND format (printf, 1, 2))) __cold; 182 __attribute__ ((NORET_AND format (printf, 1, 2))) __cold;
178extern void oops_enter(void); 183extern void oops_enter(void);
179extern void oops_exit(void); 184extern void oops_exit(void);
185void print_oops_end_marker(void);
180extern int oops_may_print(void); 186extern int oops_may_print(void);
181NORET_TYPE void do_exit(long error_code) 187NORET_TYPE void do_exit(long error_code)
182 ATTRIB_NORET; 188 ATTRIB_NORET;
@@ -247,6 +253,13 @@ extern struct pid *session_of_pgrp(struct pid *pgrp);
247#define FW_WARN "[Firmware Warn]: " 253#define FW_WARN "[Firmware Warn]: "
248#define FW_INFO "[Firmware Info]: " 254#define FW_INFO "[Firmware Info]: "
249 255
256/*
257 * HW_ERR
258 * Add this to a message for hardware errors, so that user can report
259 * it to hardware vendor instead of LKML or software vendor.
260 */
261#define HW_ERR "[Hardware Error]: "
262
250#ifdef CONFIG_PRINTK 263#ifdef CONFIG_PRINTK
251asmlinkage int vprintk(const char *fmt, va_list args) 264asmlinkage int vprintk(const char *fmt, va_list args)
252 __attribute__ ((format (printf, 1, 0))); 265 __attribute__ ((format (printf, 1, 0)));
@@ -293,6 +306,13 @@ static inline void log_buf_kexec_setup(void)
293} 306}
294#endif 307#endif
295 308
309/*
310 * Dummy printk for disabled debugging statements to use whilst maintaining
311 * gcc's format and side-effect checking.
312 */
313static inline __attribute__ ((format (printf, 1, 2)))
314int no_printk(const char *s, ...) { return 0; }
315
296extern int printk_needs_cpu(int cpu); 316extern int printk_needs_cpu(int cpu);
297extern void printk_tick(void); 317extern void printk_tick(void);
298 318
@@ -508,9 +528,6 @@ extern void tracing_start(void);
508extern void tracing_stop(void); 528extern void tracing_stop(void);
509extern void ftrace_off_permanent(void); 529extern void ftrace_off_permanent(void);
510 530
511extern void
512ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
513
514static inline void __attribute__ ((format (printf, 1, 2))) 531static inline void __attribute__ ((format (printf, 1, 2)))
515____trace_printk_check_format(const char *fmt, ...) 532____trace_printk_check_format(const char *fmt, ...)
516{ 533{
@@ -586,8 +603,6 @@ __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
586 603
587extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode); 604extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode);
588#else 605#else
589static inline void
590ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
591static inline int 606static inline int
592trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); 607trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
593 608
@@ -609,17 +624,6 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
609#endif /* CONFIG_TRACING */ 624#endif /* CONFIG_TRACING */
610 625
611/* 626/*
612 * Display an IP address in readable format.
613 */
614
615#define NIPQUAD(addr) \
616 ((unsigned char *)&addr)[0], \
617 ((unsigned char *)&addr)[1], \
618 ((unsigned char *)&addr)[2], \
619 ((unsigned char *)&addr)[3]
620#define NIPQUAD_FMT "%u.%u.%u.%u"
621
622/*
623 * min()/max()/clamp() macros that also do 627 * min()/max()/clamp() macros that also do
624 * strict type-checking.. See the 628 * strict type-checking.. See the
625 * "unnecessary" pointer comparison. 629 * "unnecessary" pointer comparison.
@@ -728,12 +732,6 @@ extern int do_sysinfo(struct sysinfo *info);
728 732
729#endif /* __KERNEL__ */ 733#endif /* __KERNEL__ */
730 734
731#ifndef __EXPORTED_HEADERS__
732#ifndef __KERNEL__
733#warning Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders
734#endif /* __KERNEL__ */
735#endif /* __EXPORTED_HEADERS__ */
736
737#define SI_LOAD_SHIFT 16 735#define SI_LOAD_SHIFT 16
738struct sysinfo { 736struct sysinfo {
739 long uptime; /* Seconds since boot */ 737 long uptime; /* Seconds since boot */
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 9fad0527344f..311f8753d713 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -1,8 +1,7 @@
1/* 1/*
2 * A generic kernel FIFO implementation. 2 * A generic kernel FIFO implementation
3 * 3 *
4 * Copyright (C) 2009 Stefani Seibold <stefani@seibold.net> 4 * Copyright (C) 2009/2010 Stefani Seibold <stefani@seibold.net>
5 * Copyright (C) 2004 Stelian Pop <stelian@popies.net>
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * 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 7 * it under the terms of the GNU General Public License as published by
@@ -20,8 +19,11 @@
20 * 19 *
21 */ 20 */
22 21
22#ifndef _LINUX_KFIFO_H
23#define _LINUX_KFIFO_H
24
23/* 25/*
24 * Howto porting drivers to the new generic fifo API: 26 * How to porting drivers to the new generic FIFO API:
25 * 27 *
26 * - Modify the declaration of the "struct kfifo *" object into a 28 * - Modify the declaration of the "struct kfifo *" object into a
27 * in-place "struct kfifo" object 29 * in-place "struct kfifo" object
@@ -30,586 +32,813 @@
30 * passed as the first argument to this functions 32 * passed as the first argument to this functions
31 * - Replace the use of __kfifo_put into kfifo_in and __kfifo_get 33 * - Replace the use of __kfifo_put into kfifo_in and __kfifo_get
32 * into kfifo_out 34 * into kfifo_out
33 * - Replace the use of kfifo_put into kfifo_in_locked and kfifo_get 35 * - Replace the use of kfifo_put into kfifo_in_spinlocked and kfifo_get
34 * into kfifo_out_locked 36 * into kfifo_out_spinlocked
35 * Note: the spinlock pointer formerly passed to kfifo_init/kfifo_alloc 37 * Note: the spinlock pointer formerly passed to kfifo_init/kfifo_alloc
36 * must be passed now to the kfifo_in_locked and kfifo_out_locked 38 * must be passed now to the kfifo_in_spinlocked and kfifo_out_spinlocked
37 * as the last parameter. 39 * as the last parameter
38 * - All formerly name __kfifo_* functions has been renamed into kfifo_* 40 * - The formerly __kfifo_* functions are renamed into kfifo_*
39 */ 41 */
40 42
41#ifndef _LINUX_KFIFO_H 43/*
42#define _LINUX_KFIFO_H 44 * Note about locking : There is no locking required until only * one reader
45 * and one writer is using the fifo and no kfifo_reset() will be * called
46 * kfifo_reset_out() can be safely used, until it will be only called
47 * in the reader thread.
48 * For multiple writer and one reader there is only a need to lock the writer.
49 * And vice versa for only one writer and multiple reader there is only a need
50 * to lock the reader.
51 */
43 52
44#include <linux/kernel.h> 53#include <linux/kernel.h>
45#include <linux/spinlock.h> 54#include <linux/spinlock.h>
46 55#include <linux/stddef.h>
47struct kfifo { 56#include <linux/scatterlist.h>
48 unsigned char *buffer; /* the buffer holding the data */ 57
49 unsigned int size; /* the size of the allocated buffer */ 58struct __kfifo {
50 unsigned int in; /* data is added at offset (in % size) */ 59 unsigned int in;
51 unsigned int out; /* data is extracted from off. (out % size) */ 60 unsigned int out;
61 unsigned int mask;
62 unsigned int esize;
63 void *data;
52}; 64};
53 65
54/* 66#define __STRUCT_KFIFO_COMMON(datatype, recsize, ptrtype) \
55 * Macros for declaration and initialization of the kfifo datatype 67 union { \
56 */ 68 struct __kfifo kfifo; \
57 69 datatype *type; \
58/* helper macro */ 70 char (*rectype)[recsize]; \
59#define __kfifo_initializer(s, b) \ 71 ptrtype *ptr; \
60 (struct kfifo) { \ 72 const ptrtype *ptr_const; \
61 .size = s, \
62 .in = 0, \
63 .out = 0, \
64 .buffer = b \
65 } 73 }
66 74
67/** 75#define __STRUCT_KFIFO(type, size, recsize, ptrtype) \
68 * DECLARE_KFIFO - macro to declare a kfifo and the associated buffer 76{ \
69 * @name: name of the declared kfifo datatype 77 __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \
70 * @size: size of the fifo buffer. Must be a power of two. 78 type buf[((size < 2) || (size & (size - 1))) ? -1 : size]; \
71 *
72 * Note1: the macro can be used inside struct or union declaration
73 * Note2: the macro creates two objects:
74 * A kfifo object with the given name and a buffer for the kfifo
75 * object named name##kfifo_buffer
76 */
77#define DECLARE_KFIFO(name, size) \
78union { \
79 struct kfifo name; \
80 unsigned char name##kfifo_buffer[size + sizeof(struct kfifo)]; \
81} 79}
82 80
83/** 81#define STRUCT_KFIFO(type, size) \
84 * INIT_KFIFO - Initialize a kfifo declared by DECLARE_KFIFO 82 struct __STRUCT_KFIFO(type, size, 0, type)
85 * @name: name of the declared kfifo datatype 83
84#define __STRUCT_KFIFO_PTR(type, recsize, ptrtype) \
85{ \
86 __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \
87 type buf[0]; \
88}
89
90#define STRUCT_KFIFO_PTR(type) \
91 struct __STRUCT_KFIFO_PTR(type, 0, type)
92
93/*
94 * define compatibility "struct kfifo" for dynamic allocated fifos
86 */ 95 */
87#define INIT_KFIFO(name) \ 96struct kfifo __STRUCT_KFIFO_PTR(unsigned char, 0, void);
88 name = __kfifo_initializer(sizeof(name##kfifo_buffer) - \
89 sizeof(struct kfifo), \
90 name##kfifo_buffer + sizeof(struct kfifo))
91 97
92/** 98#define STRUCT_KFIFO_REC_1(size) \
93 * DEFINE_KFIFO - macro to define and initialize a kfifo 99 struct __STRUCT_KFIFO(unsigned char, size, 1, void)
94 * @name: name of the declared kfifo datatype 100
95 * @size: size of the fifo buffer. Must be a power of two. 101#define STRUCT_KFIFO_REC_2(size) \
96 * 102 struct __STRUCT_KFIFO(unsigned char, size, 2, void)
97 * Note1: the macro can be used for global and local kfifo data type variables 103
98 * Note2: the macro creates two objects: 104/*
99 * A kfifo object with the given name and a buffer for the kfifo 105 * define kfifo_rec types
100 * object named name##kfifo_buffer
101 */ 106 */
102#define DEFINE_KFIFO(name, size) \ 107struct kfifo_rec_ptr_1 __STRUCT_KFIFO_PTR(unsigned char, 1, void);
103 unsigned char name##kfifo_buffer[size]; \ 108struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PTR(unsigned char, 2, void);
104 struct kfifo name = __kfifo_initializer(size, name##kfifo_buffer)
105 109
106extern void kfifo_init(struct kfifo *fifo, void *buffer, 110/*
107 unsigned int size); 111 * helper macro to distinguish between real in place fifo where the fifo
108extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size, 112 * array is a part of the structure and the fifo type where the array is
109 gfp_t gfp_mask); 113 * outside of the fifo structure.
110extern void kfifo_free(struct kfifo *fifo); 114 */
111extern unsigned int kfifo_in(struct kfifo *fifo, 115#define __is_kfifo_ptr(fifo) (sizeof(*fifo) == sizeof(struct __kfifo))
112 const void *from, unsigned int len);
113extern __must_check unsigned int kfifo_out(struct kfifo *fifo,
114 void *to, unsigned int len);
115extern __must_check unsigned int kfifo_out_peek(struct kfifo *fifo,
116 void *to, unsigned int len, unsigned offset);
117 116
118/** 117/**
119 * kfifo_initialized - Check if kfifo is initialized. 118 * DECLARE_KFIFO_PTR - macro to declare a fifo pointer object
120 * @fifo: fifo to check 119 * @fifo: name of the declared fifo
121 * Return %true if FIFO is initialized, otherwise %false. 120 * @type: type of the fifo elements
122 * Assumes the fifo was 0 before.
123 */ 121 */
124static inline bool kfifo_initialized(struct kfifo *fifo) 122#define DECLARE_KFIFO_PTR(fifo, type) STRUCT_KFIFO_PTR(type) fifo
125{
126 return fifo->buffer != NULL;
127}
128 123
129/** 124/**
130 * kfifo_reset - removes the entire FIFO contents 125 * DECLARE_KFIFO - macro to declare a fifo object
131 * @fifo: the fifo to be emptied. 126 * @fifo: name of the declared fifo
127 * @type: type of the fifo elements
128 * @size: the number of elements in the fifo, this must be a power of 2
132 */ 129 */
133static inline void kfifo_reset(struct kfifo *fifo) 130#define DECLARE_KFIFO(fifo, type, size) STRUCT_KFIFO(type, size) fifo
134{
135 fifo->in = fifo->out = 0;
136}
137 131
138/** 132/**
139 * kfifo_reset_out - skip FIFO contents 133 * INIT_KFIFO - Initialize a fifo declared by DECLARE_KFIFO
140 * @fifo: the fifo to be emptied. 134 * @fifo: name of the declared fifo datatype
141 */ 135 */
142static inline void kfifo_reset_out(struct kfifo *fifo) 136#define INIT_KFIFO(fifo) \
143{ 137(void)({ \
144 smp_mb(); 138 typeof(&(fifo)) __tmp = &(fifo); \
145 fifo->out = fifo->in; 139 struct __kfifo *__kfifo = &__tmp->kfifo; \
146} 140 __kfifo->in = 0; \
141 __kfifo->out = 0; \
142 __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : ARRAY_SIZE(__tmp->buf) - 1;\
143 __kfifo->esize = sizeof(*__tmp->buf); \
144 __kfifo->data = __is_kfifo_ptr(__tmp) ? NULL : __tmp->buf; \
145})
147 146
148/** 147/**
149 * kfifo_size - returns the size of the fifo in bytes 148 * DEFINE_KFIFO - macro to define and initialize a fifo
150 * @fifo: the fifo to be used. 149 * @fifo: name of the declared fifo datatype
151 */ 150 * @type: type of the fifo elements
152static inline __must_check unsigned int kfifo_size(struct kfifo *fifo) 151 * @size: the number of elements in the fifo, this must be a power of 2
152 *
153 * Note: the macro can be used for global and local fifo data type variables.
154 */
155#define DEFINE_KFIFO(fifo, type, size) \
156 DECLARE_KFIFO(fifo, type, size) = \
157 (typeof(fifo)) { \
158 { \
159 { \
160 .in = 0, \
161 .out = 0, \
162 .mask = __is_kfifo_ptr(&(fifo)) ? \
163 0 : \
164 ARRAY_SIZE((fifo).buf) - 1, \
165 .esize = sizeof(*(fifo).buf), \
166 .data = __is_kfifo_ptr(&(fifo)) ? \
167 NULL : \
168 (fifo).buf, \
169 } \
170 } \
171 }
172
173
174static inline unsigned int __must_check
175__kfifo_must_check_helper(unsigned int val)
153{ 176{
154 return fifo->size; 177 return val;
155} 178}
156 179
157/** 180/**
158 * kfifo_len - returns the number of used bytes in the FIFO 181 * kfifo_initialized - Check if the fifo is initialized
159 * @fifo: the fifo to be used. 182 * @fifo: address of the fifo to check
183 *
184 * Return %true if fifo is initialized, otherwise %false.
185 * Assumes the fifo was 0 before.
160 */ 186 */
161static inline unsigned int kfifo_len(struct kfifo *fifo) 187#define kfifo_initialized(fifo) ((fifo)->kfifo.mask)
162{
163 register unsigned int out;
164
165 out = fifo->out;
166 smp_rmb();
167 return fifo->in - out;
168}
169 188
170/** 189/**
171 * kfifo_is_empty - returns true if the fifo is empty 190 * kfifo_esize - returns the size of the element managed by the fifo
172 * @fifo: the fifo to be used. 191 * @fifo: address of the fifo to be used
173 */ 192 */
174static inline __must_check int kfifo_is_empty(struct kfifo *fifo) 193#define kfifo_esize(fifo) ((fifo)->kfifo.esize)
175{
176 return fifo->in == fifo->out;
177}
178 194
179/** 195/**
180 * kfifo_is_full - returns true if the fifo is full 196 * kfifo_recsize - returns the size of the record length field
181 * @fifo: the fifo to be used. 197 * @fifo: address of the fifo to be used
182 */ 198 */
183static inline __must_check int kfifo_is_full(struct kfifo *fifo) 199#define kfifo_recsize(fifo) (sizeof(*(fifo)->rectype))
184{
185 return kfifo_len(fifo) == kfifo_size(fifo);
186}
187 200
188/** 201/**
189 * kfifo_avail - returns the number of bytes available in the FIFO 202 * kfifo_size - returns the size of the fifo in elements
190 * @fifo: the fifo to be used. 203 * @fifo: address of the fifo to be used
191 */ 204 */
192static inline __must_check unsigned int kfifo_avail(struct kfifo *fifo) 205#define kfifo_size(fifo) ((fifo)->kfifo.mask + 1)
193{
194 return kfifo_size(fifo) - kfifo_len(fifo);
195}
196 206
197/** 207/**
198 * kfifo_in_locked - puts some data into the FIFO using a spinlock for locking 208 * kfifo_reset - removes the entire fifo content
199 * @fifo: the fifo to be used. 209 * @fifo: address of the fifo to be used
200 * @from: the data to be added.
201 * @n: the length of the data to be added.
202 * @lock: pointer to the spinlock to use for locking.
203 * 210 *
204 * This function copies at most @n bytes from the @from buffer into 211 * Note: usage of kfifo_reset() is dangerous. It should be only called when the
205 * the FIFO depending on the free space, and returns the number of 212 * fifo is exclusived locked or when it is secured that no other thread is
206 * bytes copied. 213 * accessing the fifo.
207 */ 214 */
208static inline unsigned int kfifo_in_locked(struct kfifo *fifo, 215#define kfifo_reset(fifo) \
209 const void *from, unsigned int n, spinlock_t *lock) 216(void)({ \
210{ 217 typeof(fifo + 1) __tmp = (fifo); \
211 unsigned long flags; 218 __tmp->kfifo.in = __tmp->kfifo.out = 0; \
212 unsigned int ret; 219})
213
214 spin_lock_irqsave(lock, flags);
215
216 ret = kfifo_in(fifo, from, n);
217
218 spin_unlock_irqrestore(lock, flags);
219
220 return ret;
221}
222 220
223/** 221/**
224 * kfifo_out_locked - gets some data from the FIFO using a spinlock for locking 222 * kfifo_reset_out - skip fifo content
225 * @fifo: the fifo to be used. 223 * @fifo: address of the fifo to be used
226 * @to: where the data must be copied.
227 * @n: the size of the destination buffer.
228 * @lock: pointer to the spinlock to use for locking.
229 * 224 *
230 * This function copies at most @n bytes from the FIFO into the 225 * Note: The usage of kfifo_reset_out() is safe until it will be only called
231 * @to buffer and returns the number of copied bytes. 226 * from the reader thread and there is only one concurrent reader. Otherwise
232 */ 227 * it is dangerous and must be handled in the same way as kfifo_reset().
233static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo,
234 void *to, unsigned int n, spinlock_t *lock)
235{
236 unsigned long flags;
237 unsigned int ret;
238
239 spin_lock_irqsave(lock, flags);
240
241 ret = kfifo_out(fifo, to, n);
242
243 spin_unlock_irqrestore(lock, flags);
244
245 return ret;
246}
247
248extern void kfifo_skip(struct kfifo *fifo, unsigned int len);
249
250extern __must_check int kfifo_from_user(struct kfifo *fifo,
251 const void __user *from, unsigned int n, unsigned *lenout);
252
253extern __must_check int kfifo_to_user(struct kfifo *fifo,
254 void __user *to, unsigned int n, unsigned *lenout);
255
256/*
257 * __kfifo_add_out internal helper function for updating the out offset
258 */ 228 */
259static inline void __kfifo_add_out(struct kfifo *fifo, 229#define kfifo_reset_out(fifo) \
260 unsigned int off) 230(void)({ \
261{ 231 typeof(fifo + 1) __tmp = (fifo); \
262 smp_mb(); 232 __tmp->kfifo.out = __tmp->kfifo.in; \
263 fifo->out += off; 233})
264}
265 234
266/* 235/**
267 * __kfifo_add_in internal helper function for updating the in offset 236 * kfifo_len - returns the number of used elements in the fifo
237 * @fifo: address of the fifo to be used
268 */ 238 */
269static inline void __kfifo_add_in(struct kfifo *fifo, 239#define kfifo_len(fifo) \
270 unsigned int off) 240({ \
271{ 241 typeof(fifo + 1) __tmpl = (fifo); \
272 smp_wmb(); 242 __tmpl->kfifo.in - __tmpl->kfifo.out; \
273 fifo->in += off; 243})
274}
275 244
276/* 245/**
277 * __kfifo_off internal helper function for calculating the index of a 246 * kfifo_is_empty - returns true if the fifo is empty
278 * given offeset 247 * @fifo: address of the fifo to be used
279 */ 248 */
280static inline unsigned int __kfifo_off(struct kfifo *fifo, unsigned int off) 249#define kfifo_is_empty(fifo) \
281{ 250({ \
282 return off & (fifo->size - 1); 251 typeof(fifo + 1) __tmpq = (fifo); \
283} 252 __tmpq->kfifo.in == __tmpq->kfifo.out; \
253})
284 254
285/* 255/**
286 * __kfifo_peek_n internal helper function for determinate the length of 256 * kfifo_is_full - returns true if the fifo is full
287 * the next record in the fifo 257 * @fifo: address of the fifo to be used
288 */ 258 */
289static inline unsigned int __kfifo_peek_n(struct kfifo *fifo, 259#define kfifo_is_full(fifo) \
290 unsigned int recsize) 260({ \
291{ 261 typeof(fifo + 1) __tmpq = (fifo); \
292#define __KFIFO_GET(fifo, off, shift) \ 262 kfifo_len(__tmpq) > __tmpq->kfifo.mask; \
293 ((fifo)->buffer[__kfifo_off((fifo), (fifo)->out+(off))] << (shift)) 263})
294 264
295 unsigned int l; 265/**
266 * kfifo_avail - returns the number of unused elements in the fifo
267 * @fifo: address of the fifo to be used
268 */
269#define kfifo_avail(fifo) \
270__kfifo_must_check_helper( \
271({ \
272 typeof(fifo + 1) __tmpq = (fifo); \
273 const size_t __recsize = sizeof(*__tmpq->rectype); \
274 unsigned int __avail = kfifo_size(__tmpq) - kfifo_len(__tmpq); \
275 (__recsize) ? ((__avail <= __recsize) ? 0 : \
276 __kfifo_max_r(__avail - __recsize, __recsize)) : \
277 __avail; \
278}) \
279)
296 280
297 l = __KFIFO_GET(fifo, 0, 0); 281/**
282 * kfifo_skip - skip output data
283 * @fifo: address of the fifo to be used
284 */
285#define kfifo_skip(fifo) \
286(void)({ \
287 typeof(fifo + 1) __tmp = (fifo); \
288 const size_t __recsize = sizeof(*__tmp->rectype); \
289 struct __kfifo *__kfifo = &__tmp->kfifo; \
290 if (__recsize) \
291 __kfifo_skip_r(__kfifo, __recsize); \
292 else \
293 __kfifo->out++; \
294})
298 295
299 if (--recsize) 296/**
300 l |= __KFIFO_GET(fifo, 1, 8); 297 * kfifo_peek_len - gets the size of the next fifo record
298 * @fifo: address of the fifo to be used
299 *
300 * This function returns the size of the next fifo record in number of bytes.
301 */
302#define kfifo_peek_len(fifo) \
303__kfifo_must_check_helper( \
304({ \
305 typeof(fifo + 1) __tmp = (fifo); \
306 const size_t __recsize = sizeof(*__tmp->rectype); \
307 struct __kfifo *__kfifo = &__tmp->kfifo; \
308 (!__recsize) ? kfifo_len(__tmp) * sizeof(*__tmp->type) : \
309 __kfifo_len_r(__kfifo, __recsize); \
310}) \
311)
301 312
302 return l; 313/**
303#undef __KFIFO_GET 314 * kfifo_alloc - dynamically allocates a new fifo buffer
304} 315 * @fifo: pointer to the fifo
316 * @size: the number of elements in the fifo, this must be a power of 2
317 * @gfp_mask: get_free_pages mask, passed to kmalloc()
318 *
319 * This macro dynamically allocates a new fifo buffer.
320 *
321 * The numer of elements will be rounded-up to a power of 2.
322 * The fifo will be release with kfifo_free().
323 * Return 0 if no error, otherwise an error code.
324 */
325#define kfifo_alloc(fifo, size, gfp_mask) \
326__kfifo_must_check_helper( \
327({ \
328 typeof(fifo + 1) __tmp = (fifo); \
329 struct __kfifo *__kfifo = &__tmp->kfifo; \
330 __is_kfifo_ptr(__tmp) ? \
331 __kfifo_alloc(__kfifo, size, sizeof(*__tmp->type), gfp_mask) : \
332 -EINVAL; \
333}) \
334)
305 335
306/* 336/**
307 * __kfifo_poke_n internal helper function for storing the length of 337 * kfifo_free - frees the fifo
308 * the next record into the fifo 338 * @fifo: the fifo to be freed
309 */ 339 */
310static inline void __kfifo_poke_n(struct kfifo *fifo, 340#define kfifo_free(fifo) \
311 unsigned int recsize, unsigned int n) 341({ \
312{ 342 typeof(fifo + 1) __tmp = (fifo); \
313#define __KFIFO_PUT(fifo, off, val, shift) \ 343 struct __kfifo *__kfifo = &__tmp->kfifo; \
314 ( \ 344 if (__is_kfifo_ptr(__tmp)) \
315 (fifo)->buffer[__kfifo_off((fifo), (fifo)->in+(off))] = \ 345 __kfifo_free(__kfifo); \
316 (unsigned char)((val) >> (shift)) \ 346})
317 )
318 347
319 __KFIFO_PUT(fifo, 0, n, 0); 348/**
349 * kfifo_init - initialize a fifo using a preallocated buffer
350 * @fifo: the fifo to assign the buffer
351 * @buffer: the preallocated buffer to be used
352 * @size: the size of the internal buffer, this have to be a power of 2
353 *
354 * This macro initialize a fifo using a preallocated buffer.
355 *
356 * The numer of elements will be rounded-up to a power of 2.
357 * Return 0 if no error, otherwise an error code.
358 */
359#define kfifo_init(fifo, buffer, size) \
360({ \
361 typeof(fifo + 1) __tmp = (fifo); \
362 struct __kfifo *__kfifo = &__tmp->kfifo; \
363 __is_kfifo_ptr(__tmp) ? \
364 __kfifo_init(__kfifo, buffer, size, sizeof(*__tmp->type)) : \
365 -EINVAL; \
366})
320 367
321 if (--recsize) 368/**
322 __KFIFO_PUT(fifo, 1, n, 8); 369 * kfifo_put - put data into the fifo
323#undef __KFIFO_PUT 370 * @fifo: address of the fifo to be used
324} 371 * @val: the data to be added
372 *
373 * This macro copies the given value into the fifo.
374 * It returns 0 if the fifo was full. Otherwise it returns the number
375 * processed elements.
376 *
377 * Note that with only one concurrent reader and one concurrent
378 * writer, you don't need extra locking to use these macro.
379 */
380#define kfifo_put(fifo, val) \
381({ \
382 typeof(fifo + 1) __tmp = (fifo); \
383 typeof(val + 1) __val = (val); \
384 unsigned int __ret; \
385 const size_t __recsize = sizeof(*__tmp->rectype); \
386 struct __kfifo *__kfifo = &__tmp->kfifo; \
387 if (0) { \
388 typeof(__tmp->ptr_const) __dummy __attribute__ ((unused)); \
389 __dummy = (typeof(__val))NULL; \
390 } \
391 if (__recsize) \
392 __ret = __kfifo_in_r(__kfifo, __val, sizeof(*__val), \
393 __recsize); \
394 else { \
395 __ret = !kfifo_is_full(__tmp); \
396 if (__ret) { \
397 (__is_kfifo_ptr(__tmp) ? \
398 ((typeof(__tmp->type))__kfifo->data) : \
399 (__tmp->buf) \
400 )[__kfifo->in & __tmp->kfifo.mask] = \
401 *(typeof(__tmp->type))__val; \
402 smp_wmb(); \
403 __kfifo->in++; \
404 } \
405 } \
406 __ret; \
407})
325 408
326/* 409/**
327 * __kfifo_in_... internal functions for put date into the fifo 410 * kfifo_get - get data from the fifo
328 * do not call it directly, use kfifo_in_rec() instead 411 * @fifo: address of the fifo to be used
329 */ 412 * @val: the var where to store the data to be added
330extern unsigned int __kfifo_in_n(struct kfifo *fifo, 413 *
331 const void *from, unsigned int n, unsigned int recsize); 414 * This macro reads the data from the fifo.
415 * It returns 0 if the fifo was empty. Otherwise it returns the number
416 * processed elements.
417 *
418 * Note that with only one concurrent reader and one concurrent
419 * writer, you don't need extra locking to use these macro.
420 */
421#define kfifo_get(fifo, val) \
422__kfifo_must_check_helper( \
423({ \
424 typeof(fifo + 1) __tmp = (fifo); \
425 typeof(val + 1) __val = (val); \
426 unsigned int __ret; \
427 const size_t __recsize = sizeof(*__tmp->rectype); \
428 struct __kfifo *__kfifo = &__tmp->kfifo; \
429 if (0) \
430 __val = (typeof(__tmp->ptr))0; \
431 if (__recsize) \
432 __ret = __kfifo_out_r(__kfifo, __val, sizeof(*__val), \
433 __recsize); \
434 else { \
435 __ret = !kfifo_is_empty(__tmp); \
436 if (__ret) { \
437 *(typeof(__tmp->type))__val = \
438 (__is_kfifo_ptr(__tmp) ? \
439 ((typeof(__tmp->type))__kfifo->data) : \
440 (__tmp->buf) \
441 )[__kfifo->out & __tmp->kfifo.mask]; \
442 smp_wmb(); \
443 __kfifo->out++; \
444 } \
445 } \
446 __ret; \
447}) \
448)
332 449
333extern unsigned int __kfifo_in_generic(struct kfifo *fifo, 450/**
334 const void *from, unsigned int n, unsigned int recsize); 451 * kfifo_peek - get data from the fifo without removing
452 * @fifo: address of the fifo to be used
453 * @val: the var where to store the data to be added
454 *
455 * This reads the data from the fifo without removing it from the fifo.
456 * It returns 0 if the fifo was empty. Otherwise it returns the number
457 * processed elements.
458 *
459 * Note that with only one concurrent reader and one concurrent
460 * writer, you don't need extra locking to use these macro.
461 */
462#define kfifo_peek(fifo, val) \
463__kfifo_must_check_helper( \
464({ \
465 typeof(fifo + 1) __tmp = (fifo); \
466 typeof(val + 1) __val = (val); \
467 unsigned int __ret; \
468 const size_t __recsize = sizeof(*__tmp->rectype); \
469 struct __kfifo *__kfifo = &__tmp->kfifo; \
470 if (0) \
471 __val = (typeof(__tmp->ptr))NULL; \
472 if (__recsize) \
473 __ret = __kfifo_out_peek_r(__kfifo, __val, sizeof(*__val), \
474 __recsize); \
475 else { \
476 __ret = !kfifo_is_empty(__tmp); \
477 if (__ret) { \
478 *(typeof(__tmp->type))__val = \
479 (__is_kfifo_ptr(__tmp) ? \
480 ((typeof(__tmp->type))__kfifo->data) : \
481 (__tmp->buf) \
482 )[__kfifo->out & __tmp->kfifo.mask]; \
483 smp_wmb(); \
484 } \
485 } \
486 __ret; \
487}) \
488)
335 489
336static inline unsigned int __kfifo_in_rec(struct kfifo *fifo, 490/**
337 const void *from, unsigned int n, unsigned int recsize) 491 * kfifo_in - put data into the fifo
338{ 492 * @fifo: address of the fifo to be used
339 unsigned int ret; 493 * @buf: the data to be added
494 * @n: number of elements to be added
495 *
496 * This macro copies the given buffer into the fifo and returns the
497 * number of copied elements.
498 *
499 * Note that with only one concurrent reader and one concurrent
500 * writer, you don't need extra locking to use these macro.
501 */
502#define kfifo_in(fifo, buf, n) \
503({ \
504 typeof(fifo + 1) __tmp = (fifo); \
505 typeof(buf + 1) __buf = (buf); \
506 unsigned long __n = (n); \
507 const size_t __recsize = sizeof(*__tmp->rectype); \
508 struct __kfifo *__kfifo = &__tmp->kfifo; \
509 if (0) { \
510 typeof(__tmp->ptr_const) __dummy __attribute__ ((unused)); \
511 __dummy = (typeof(__buf))NULL; \
512 } \
513 (__recsize) ?\
514 __kfifo_in_r(__kfifo, __buf, __n, __recsize) : \
515 __kfifo_in(__kfifo, __buf, __n); \
516})
340 517
341 ret = __kfifo_in_n(fifo, from, n, recsize); 518/**
519 * kfifo_in_spinlocked - put data into the fifo using a spinlock for locking
520 * @fifo: address of the fifo to be used
521 * @buf: the data to be added
522 * @n: number of elements to be added
523 * @lock: pointer to the spinlock to use for locking
524 *
525 * This macro copies the given values buffer into the fifo and returns the
526 * number of copied elements.
527 */
528#define kfifo_in_spinlocked(fifo, buf, n, lock) \
529({ \
530 unsigned long __flags; \
531 unsigned int __ret; \
532 spin_lock_irqsave(lock, __flags); \
533 __ret = kfifo_in(fifo, buf, n); \
534 spin_unlock_irqrestore(lock, __flags); \
535 __ret; \
536})
537
538/* alias for kfifo_in_spinlocked, will be removed in a future release */
539#define kfifo_in_locked(fifo, buf, n, lock) \
540 kfifo_in_spinlocked(fifo, buf, n, lock)
342 541
343 if (likely(ret == 0)) { 542/**
344 if (recsize) 543 * kfifo_out - get data from the fifo
345 __kfifo_poke_n(fifo, recsize, n); 544 * @fifo: address of the fifo to be used
346 __kfifo_add_in(fifo, n + recsize); 545 * @buf: pointer to the storage buffer
347 } 546 * @n: max. number of elements to get
348 return ret; 547 *
349} 548 * This macro get some data from the fifo and return the numbers of elements
549 * copied.
550 *
551 * Note that with only one concurrent reader and one concurrent
552 * writer, you don't need extra locking to use these macro.
553 */
554#define kfifo_out(fifo, buf, n) \
555__kfifo_must_check_helper( \
556({ \
557 typeof(fifo + 1) __tmp = (fifo); \
558 typeof(buf + 1) __buf = (buf); \
559 unsigned long __n = (n); \
560 const size_t __recsize = sizeof(*__tmp->rectype); \
561 struct __kfifo *__kfifo = &__tmp->kfifo; \
562 if (0) { \
563 typeof(__tmp->ptr) __dummy = NULL; \
564 __buf = __dummy; \
565 } \
566 (__recsize) ?\
567 __kfifo_out_r(__kfifo, __buf, __n, __recsize) : \
568 __kfifo_out(__kfifo, __buf, __n); \
569}) \
570)
571
572/**
573 * kfifo_out_spinlocked - get data from the fifo using a spinlock for locking
574 * @fifo: address of the fifo to be used
575 * @buf: pointer to the storage buffer
576 * @n: max. number of elements to get
577 * @lock: pointer to the spinlock to use for locking
578 *
579 * This macro get the data from the fifo and return the numbers of elements
580 * copied.
581 */
582#define kfifo_out_spinlocked(fifo, buf, n, lock) \
583__kfifo_must_check_helper( \
584({ \
585 unsigned long __flags; \
586 unsigned int __ret; \
587 spin_lock_irqsave(lock, __flags); \
588 __ret = kfifo_out(fifo, buf, n); \
589 spin_unlock_irqrestore(lock, __flags); \
590 __ret; \
591}) \
592)
593
594/* alias for kfifo_out_spinlocked, will be removed in a future release */
595#define kfifo_out_locked(fifo, buf, n, lock) \
596 kfifo_out_spinlocked(fifo, buf, n, lock)
350 597
351/** 598/**
352 * kfifo_in_rec - puts some record data into the FIFO 599 * kfifo_from_user - puts some data from user space into the fifo
353 * @fifo: the fifo to be used. 600 * @fifo: address of the fifo to be used
354 * @from: the data to be added. 601 * @from: pointer to the data to be added
355 * @n: the length of the data to be added. 602 * @len: the length of the data to be added
356 * @recsize: size of record field 603 * @copied: pointer to output variable to store the number of copied bytes
357 * 604 *
358 * This function copies @n bytes from the @from into the FIFO and returns 605 * This macro copies at most @len bytes from the @from into the
359 * the number of bytes which cannot be copied. 606 * fifo, depending of the available space and returns -EFAULT/0.
360 * A returned value greater than the @n value means that the record doesn't
361 * fit into the buffer.
362 * 607 *
363 * Note that with only one concurrent reader and one concurrent 608 * Note that with only one concurrent reader and one concurrent
364 * writer, you don't need extra locking to use these functions. 609 * writer, you don't need extra locking to use these macro.
365 */ 610 */
366static inline __must_check unsigned int kfifo_in_rec(struct kfifo *fifo, 611#define kfifo_from_user(fifo, from, len, copied) \
367 void *from, unsigned int n, unsigned int recsize) 612__kfifo_must_check_helper( \
368{ 613({ \
369 if (!__builtin_constant_p(recsize)) 614 typeof(fifo + 1) __tmp = (fifo); \
370 return __kfifo_in_generic(fifo, from, n, recsize); 615 const void __user *__from = (from); \
371 return __kfifo_in_rec(fifo, from, n, recsize); 616 unsigned int __len = (len); \
372} 617 unsigned int *__copied = (copied); \
618 const size_t __recsize = sizeof(*__tmp->rectype); \
619 struct __kfifo *__kfifo = &__tmp->kfifo; \
620 (__recsize) ? \
621 __kfifo_from_user_r(__kfifo, __from, __len, __copied, __recsize) : \
622 __kfifo_from_user(__kfifo, __from, __len, __copied); \
623}) \
624)
373 625
374/* 626/**
375 * __kfifo_out_... internal functions for get date from the fifo 627 * kfifo_to_user - copies data from the fifo into user space
376 * do not call it directly, use kfifo_out_rec() instead 628 * @fifo: address of the fifo to be used
377 */ 629 * @to: where the data must be copied
378extern unsigned int __kfifo_out_n(struct kfifo *fifo, 630 * @len: the size of the destination buffer
379 void *to, unsigned int reclen, unsigned int recsize); 631 * @copied: pointer to output variable to store the number of copied bytes
632 *
633 * This macro copies at most @len bytes from the fifo into the
634 * @to buffer and returns -EFAULT/0.
635 *
636 * Note that with only one concurrent reader and one concurrent
637 * writer, you don't need extra locking to use these macro.
638 */
639#define kfifo_to_user(fifo, to, len, copied) \
640__kfifo_must_check_helper( \
641({ \
642 typeof(fifo + 1) __tmp = (fifo); \
643 void __user *__to = (to); \
644 unsigned int __len = (len); \
645 unsigned int *__copied = (copied); \
646 const size_t __recsize = sizeof(*__tmp->rectype); \
647 struct __kfifo *__kfifo = &__tmp->kfifo; \
648 (__recsize) ? \
649 __kfifo_to_user_r(__kfifo, __to, __len, __copied, __recsize) : \
650 __kfifo_to_user(__kfifo, __to, __len, __copied); \
651}) \
652)
653
654/**
655 * kfifo_dma_in_prepare - setup a scatterlist for DMA input
656 * @fifo: address of the fifo to be used
657 * @sgl: pointer to the scatterlist array
658 * @nents: number of entries in the scatterlist array
659 * @len: number of elements to transfer
660 *
661 * This macro fills a scatterlist for DMA input.
662 * It returns the number entries in the scatterlist array.
663 *
664 * Note that with only one concurrent reader and one concurrent
665 * writer, you don't need extra locking to use these macros.
666 */
667#define kfifo_dma_in_prepare(fifo, sgl, nents, len) \
668({ \
669 typeof(fifo + 1) __tmp = (fifo); \
670 struct scatterlist *__sgl = (sgl); \
671 int __nents = (nents); \
672 unsigned int __len = (len); \
673 const size_t __recsize = sizeof(*__tmp->rectype); \
674 struct __kfifo *__kfifo = &__tmp->kfifo; \
675 (__recsize) ? \
676 __kfifo_dma_in_prepare_r(__kfifo, __sgl, __nents, __len, __recsize) : \
677 __kfifo_dma_in_prepare(__kfifo, __sgl, __nents, __len); \
678})
380 679
381extern unsigned int __kfifo_out_generic(struct kfifo *fifo, 680/**
382 void *to, unsigned int n, 681 * kfifo_dma_in_finish - finish a DMA IN operation
383 unsigned int recsize, unsigned int *total); 682 * @fifo: address of the fifo to be used
683 * @len: number of bytes to received
684 *
685 * This macro finish a DMA IN operation. The in counter will be updated by
686 * the len parameter. No error checking will be done.
687 *
688 * Note that with only one concurrent reader and one concurrent
689 * writer, you don't need extra locking to use these macros.
690 */
691#define kfifo_dma_in_finish(fifo, len) \
692(void)({ \
693 typeof(fifo + 1) __tmp = (fifo); \
694 unsigned int __len = (len); \
695 const size_t __recsize = sizeof(*__tmp->rectype); \
696 struct __kfifo *__kfifo = &__tmp->kfifo; \
697 if (__recsize) \
698 __kfifo_dma_in_finish_r(__kfifo, __len, __recsize); \
699 else \
700 __kfifo->in += __len / sizeof(*__tmp->type); \
701})
384 702
385static inline unsigned int __kfifo_out_rec(struct kfifo *fifo, 703/**
386 void *to, unsigned int n, unsigned int recsize, 704 * kfifo_dma_out_prepare - setup a scatterlist for DMA output
387 unsigned int *total) 705 * @fifo: address of the fifo to be used
388{ 706 * @sgl: pointer to the scatterlist array
389 unsigned int l; 707 * @nents: number of entries in the scatterlist array
390 708 * @len: number of elements to transfer
391 if (!recsize) { 709 *
392 l = n; 710 * This macro fills a scatterlist for DMA output which at most @len bytes
393 if (total) 711 * to transfer.
394 *total = l; 712 * It returns the number entries in the scatterlist array.
395 } else { 713 * A zero means there is no space available and the scatterlist is not filled.
396 l = __kfifo_peek_n(fifo, recsize); 714 *
397 if (total) 715 * Note that with only one concurrent reader and one concurrent
398 *total = l; 716 * writer, you don't need extra locking to use these macros.
399 if (n < l) 717 */
400 return l; 718#define kfifo_dma_out_prepare(fifo, sgl, nents, len) \
401 } 719({ \
720 typeof(fifo + 1) __tmp = (fifo); \
721 struct scatterlist *__sgl = (sgl); \
722 int __nents = (nents); \
723 unsigned int __len = (len); \
724 const size_t __recsize = sizeof(*__tmp->rectype); \
725 struct __kfifo *__kfifo = &__tmp->kfifo; \
726 (__recsize) ? \
727 __kfifo_dma_out_prepare_r(__kfifo, __sgl, __nents, __len, __recsize) : \
728 __kfifo_dma_out_prepare(__kfifo, __sgl, __nents, __len); \
729})
402 730
403 return __kfifo_out_n(fifo, to, l, recsize); 731/**
404} 732 * kfifo_dma_out_finish - finish a DMA OUT operation
733 * @fifo: address of the fifo to be used
734 * @len: number of bytes transferd
735 *
736 * This macro finish a DMA OUT operation. The out counter will be updated by
737 * the len parameter. No error checking will be done.
738 *
739 * Note that with only one concurrent reader and one concurrent
740 * writer, you don't need extra locking to use these macros.
741 */
742#define kfifo_dma_out_finish(fifo, len) \
743(void)({ \
744 typeof(fifo + 1) __tmp = (fifo); \
745 unsigned int __len = (len); \
746 const size_t __recsize = sizeof(*__tmp->rectype); \
747 struct __kfifo *__kfifo = &__tmp->kfifo; \
748 if (__recsize) \
749 __kfifo_dma_out_finish_r(__kfifo, __recsize); \
750 else \
751 __kfifo->out += __len / sizeof(*__tmp->type); \
752})
405 753
406/** 754/**
407 * kfifo_out_rec - gets some record data from the FIFO 755 * kfifo_out_peek - gets some data from the fifo
408 * @fifo: the fifo to be used. 756 * @fifo: address of the fifo to be used
409 * @to: where the data must be copied. 757 * @buf: pointer to the storage buffer
410 * @n: the size of the destination buffer. 758 * @n: max. number of elements to get
411 * @recsize: size of record field
412 * @total: pointer where the total number of to copied bytes should stored
413 * 759 *
414 * This function copies at most @n bytes from the FIFO to @to and returns the 760 * This macro get the data from the fifo and return the numbers of elements
415 * number of bytes which cannot be copied. 761 * copied. The data is not removed from the fifo.
416 * A returned value greater than the @n value means that the record doesn't
417 * fit into the @to buffer.
418 * 762 *
419 * Note that with only one concurrent reader and one concurrent 763 * Note that with only one concurrent reader and one concurrent
420 * writer, you don't need extra locking to use these functions. 764 * writer, you don't need extra locking to use these macro.
421 */ 765 */
422static inline __must_check unsigned int kfifo_out_rec(struct kfifo *fifo, 766#define kfifo_out_peek(fifo, buf, n) \
423 void *to, unsigned int n, unsigned int recsize, 767__kfifo_must_check_helper( \
424 unsigned int *total) 768({ \
769 typeof(fifo + 1) __tmp = (fifo); \
770 typeof(buf + 1) __buf = (buf); \
771 unsigned long __n = (n); \
772 const size_t __recsize = sizeof(*__tmp->rectype); \
773 struct __kfifo *__kfifo = &__tmp->kfifo; \
774 if (0) { \
775 typeof(__tmp->ptr) __dummy __attribute__ ((unused)) = NULL; \
776 __buf = __dummy; \
777 } \
778 (__recsize) ? \
779 __kfifo_out_peek_r(__kfifo, __buf, __n, __recsize) : \
780 __kfifo_out_peek(__kfifo, __buf, __n); \
781}) \
782)
425 783
426{ 784extern int __kfifo_alloc(struct __kfifo *fifo, unsigned int size,
427 if (!__builtin_constant_p(recsize)) 785 size_t esize, gfp_t gfp_mask);
428 return __kfifo_out_generic(fifo, to, n, recsize, total);
429 return __kfifo_out_rec(fifo, to, n, recsize, total);
430}
431 786
432/* 787extern void __kfifo_free(struct __kfifo *fifo);
433 * __kfifo_from_user_... internal functions for transfer from user space into
434 * the fifo. do not call it directly, use kfifo_from_user_rec() instead
435 */
436extern unsigned int __kfifo_from_user_n(struct kfifo *fifo,
437 const void __user *from, unsigned int n, unsigned int recsize);
438 788
439extern unsigned int __kfifo_from_user_generic(struct kfifo *fifo, 789extern int __kfifo_init(struct __kfifo *fifo, void *buffer,
440 const void __user *from, unsigned int n, unsigned int recsize); 790 unsigned int size, size_t esize);
441 791
442static inline unsigned int __kfifo_from_user_rec(struct kfifo *fifo, 792extern unsigned int __kfifo_in(struct __kfifo *fifo,
443 const void __user *from, unsigned int n, unsigned int recsize) 793 const void *buf, unsigned int len);
444{
445 unsigned int ret;
446 794
447 ret = __kfifo_from_user_n(fifo, from, n, recsize); 795extern unsigned int __kfifo_out(struct __kfifo *fifo,
796 void *buf, unsigned int len);
448 797
449 if (likely(ret == 0)) { 798extern int __kfifo_from_user(struct __kfifo *fifo,
450 if (recsize) 799 const void __user *from, unsigned long len, unsigned int *copied);
451 __kfifo_poke_n(fifo, recsize, n);
452 __kfifo_add_in(fifo, n + recsize);
453 }
454 return ret;
455}
456 800
457/** 801extern int __kfifo_to_user(struct __kfifo *fifo,
458 * kfifo_from_user_rec - puts some data from user space into the FIFO 802 void __user *to, unsigned long len, unsigned int *copied);
459 * @fifo: the fifo to be used.
460 * @from: pointer to the data to be added.
461 * @n: the length of the data to be added.
462 * @recsize: size of record field
463 *
464 * This function copies @n bytes from the @from into the
465 * FIFO and returns the number of bytes which cannot be copied.
466 *
467 * If the returned value is equal or less the @n value, the copy_from_user()
468 * functions has failed. Otherwise the record doesn't fit into the buffer.
469 *
470 * Note that with only one concurrent reader and one concurrent
471 * writer, you don't need extra locking to use these functions.
472 */
473static inline __must_check unsigned int kfifo_from_user_rec(struct kfifo *fifo,
474 const void __user *from, unsigned int n, unsigned int recsize)
475{
476 if (!__builtin_constant_p(recsize))
477 return __kfifo_from_user_generic(fifo, from, n, recsize);
478 return __kfifo_from_user_rec(fifo, from, n, recsize);
479}
480 803
481/* 804extern unsigned int __kfifo_dma_in_prepare(struct __kfifo *fifo,
482 * __kfifo_to_user_... internal functions for transfer fifo data into user space 805 struct scatterlist *sgl, int nents, unsigned int len);
483 * do not call it directly, use kfifo_to_user_rec() instead
484 */
485extern unsigned int __kfifo_to_user_n(struct kfifo *fifo,
486 void __user *to, unsigned int n, unsigned int reclen,
487 unsigned int recsize);
488 806
489extern unsigned int __kfifo_to_user_generic(struct kfifo *fifo, 807extern unsigned int __kfifo_dma_out_prepare(struct __kfifo *fifo,
490 void __user *to, unsigned int n, unsigned int recsize, 808 struct scatterlist *sgl, int nents, unsigned int len);
491 unsigned int *total);
492 809
493static inline unsigned int __kfifo_to_user_rec(struct kfifo *fifo, 810extern unsigned int __kfifo_out_peek(struct __kfifo *fifo,
494 void __user *to, unsigned int n, 811 void *buf, unsigned int len);
495 unsigned int recsize, unsigned int *total)
496{
497 unsigned int l;
498
499 if (!recsize) {
500 l = n;
501 if (total)
502 *total = l;
503 } else {
504 l = __kfifo_peek_n(fifo, recsize);
505 if (total)
506 *total = l;
507 if (n < l)
508 return l;
509 }
510 812
511 return __kfifo_to_user_n(fifo, to, n, l, recsize); 813extern unsigned int __kfifo_in_r(struct __kfifo *fifo,
512} 814 const void *buf, unsigned int len, size_t recsize);
513 815
514/** 816extern unsigned int __kfifo_out_r(struct __kfifo *fifo,
515 * kfifo_to_user_rec - gets data from the FIFO and write it to user space 817 void *buf, unsigned int len, size_t recsize);
516 * @fifo: the fifo to be used.
517 * @to: where the data must be copied.
518 * @n: the size of the destination buffer.
519 * @recsize: size of record field
520 * @total: pointer where the total number of to copied bytes should stored
521 *
522 * This function copies at most @n bytes from the FIFO to the @to.
523 * In case of an error, the function returns the number of bytes which cannot
524 * be copied.
525 * If the returned value is equal or less the @n value, the copy_to_user()
526 * functions has failed. Otherwise the record doesn't fit into the @to buffer.
527 *
528 * Note that with only one concurrent reader and one concurrent
529 * writer, you don't need extra locking to use these functions.
530 */
531static inline __must_check unsigned int kfifo_to_user_rec(struct kfifo *fifo,
532 void __user *to, unsigned int n, unsigned int recsize,
533 unsigned int *total)
534{
535 if (!__builtin_constant_p(recsize))
536 return __kfifo_to_user_generic(fifo, to, n, recsize, total);
537 return __kfifo_to_user_rec(fifo, to, n, recsize, total);
538}
539 818
540/* 819extern int __kfifo_from_user_r(struct __kfifo *fifo,
541 * __kfifo_peek_... internal functions for peek into the next fifo record 820 const void __user *from, unsigned long len, unsigned int *copied,
542 * do not call it directly, use kfifo_peek_rec() instead 821 size_t recsize);
543 */
544extern unsigned int __kfifo_peek_generic(struct kfifo *fifo,
545 unsigned int recsize);
546 822
547/** 823extern int __kfifo_to_user_r(struct __kfifo *fifo, void __user *to,
548 * kfifo_peek_rec - gets the size of the next FIFO record data 824 unsigned long len, unsigned int *copied, size_t recsize);
549 * @fifo: the fifo to be used.
550 * @recsize: size of record field
551 *
552 * This function returns the size of the next FIFO record in number of bytes
553 */
554static inline __must_check unsigned int kfifo_peek_rec(struct kfifo *fifo,
555 unsigned int recsize)
556{
557 if (!__builtin_constant_p(recsize))
558 return __kfifo_peek_generic(fifo, recsize);
559 if (!recsize)
560 return kfifo_len(fifo);
561 return __kfifo_peek_n(fifo, recsize);
562}
563 825
564/* 826extern unsigned int __kfifo_dma_in_prepare_r(struct __kfifo *fifo,
565 * __kfifo_skip_... internal functions for skip the next fifo record 827 struct scatterlist *sgl, int nents, unsigned int len, size_t recsize);
566 * do not call it directly, use kfifo_skip_rec() instead
567 */
568extern void __kfifo_skip_generic(struct kfifo *fifo, unsigned int recsize);
569 828
570static inline void __kfifo_skip_rec(struct kfifo *fifo, 829extern void __kfifo_dma_in_finish_r(struct __kfifo *fifo,
571 unsigned int recsize) 830 unsigned int len, size_t recsize);
572{
573 unsigned int l;
574 831
575 if (recsize) { 832extern unsigned int __kfifo_dma_out_prepare_r(struct __kfifo *fifo,
576 l = __kfifo_peek_n(fifo, recsize); 833 struct scatterlist *sgl, int nents, unsigned int len, size_t recsize);
577 834
578 if (l + recsize <= kfifo_len(fifo)) { 835extern void __kfifo_dma_out_finish_r(struct __kfifo *fifo, size_t recsize);
579 __kfifo_add_out(fifo, l + recsize);
580 return;
581 }
582 }
583 kfifo_reset_out(fifo);
584}
585 836
586/** 837extern unsigned int __kfifo_len_r(struct __kfifo *fifo, size_t recsize);
587 * kfifo_skip_rec - skip the next fifo out record
588 * @fifo: the fifo to be used.
589 * @recsize: size of record field
590 *
591 * This function skips the next FIFO record
592 */
593static inline void kfifo_skip_rec(struct kfifo *fifo,
594 unsigned int recsize)
595{
596 if (!__builtin_constant_p(recsize))
597 __kfifo_skip_generic(fifo, recsize);
598 else
599 __kfifo_skip_rec(fifo, recsize);
600}
601 838
602/** 839extern unsigned int __kfifo_out_peek_r(struct __kfifo *fifo,
603 * kfifo_avail_rec - returns the number of bytes available in a record FIFO 840 void *buf, unsigned int len, size_t recsize);
604 * @fifo: the fifo to be used.
605 * @recsize: size of record field
606 */
607static inline __must_check unsigned int kfifo_avail_rec(struct kfifo *fifo,
608 unsigned int recsize)
609{
610 unsigned int l = kfifo_size(fifo) - kfifo_len(fifo);
611 841
612 return (l > recsize) ? l - recsize : 0; 842extern unsigned int __kfifo_max_r(unsigned int len, size_t recsize);
613}
614 843
615#endif 844#endif
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 9340f34d1bb5..cc96f0f23e04 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -90,6 +90,19 @@ struct kgdb_bkpt {
90 enum kgdb_bpstate state; 90 enum kgdb_bpstate state;
91}; 91};
92 92
93struct dbg_reg_def_t {
94 char *name;
95 int size;
96 int offset;
97};
98
99#ifndef DBG_MAX_REG_NUM
100#define DBG_MAX_REG_NUM 0
101#else
102extern struct dbg_reg_def_t dbg_reg_def[];
103extern char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs);
104extern int dbg_set_reg(int regno, void *mem, struct pt_regs *regs);
105#endif
93#ifndef KGDB_MAX_BREAKPOINTS 106#ifndef KGDB_MAX_BREAKPOINTS
94# define KGDB_MAX_BREAKPOINTS 1000 107# define KGDB_MAX_BREAKPOINTS 1000
95#endif 108#endif
@@ -281,7 +294,7 @@ extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops);
281extern struct kgdb_io *dbg_io_ops; 294extern struct kgdb_io *dbg_io_ops;
282 295
283extern int kgdb_hex2long(char **ptr, unsigned long *long_val); 296extern int kgdb_hex2long(char **ptr, unsigned long *long_val);
284extern int kgdb_mem2hex(char *mem, char *buf, int count); 297extern char *kgdb_mem2hex(char *mem, char *buf, int count);
285extern int kgdb_hex2mem(char *buf, char *mem, int count); 298extern int kgdb_hex2mem(char *buf, char *mem, int count);
286 299
287extern int kgdb_isremovedbreak(unsigned long addr); 300extern int kgdb_isremovedbreak(unsigned long addr);
diff --git a/include/linux/kmemtrace.h b/include/linux/kmemtrace.h
deleted file mode 100644
index b616d3930c3b..000000000000
--- a/include/linux/kmemtrace.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * Copyright (C) 2008 Eduard - Gabriel Munteanu
3 *
4 * This file is released under GPL version 2.
5 */
6
7#ifndef _LINUX_KMEMTRACE_H
8#define _LINUX_KMEMTRACE_H
9
10#ifdef __KERNEL__
11
12#include <trace/events/kmem.h>
13
14#ifdef CONFIG_KMEMTRACE
15extern void kmemtrace_init(void);
16#else
17static inline void kmemtrace_init(void)
18{
19}
20#endif
21
22#endif /* __KERNEL__ */
23
24#endif /* _LINUX_KMEMTRACE_H */
25
diff --git a/include/linux/ks8842.h b/include/linux/ks8842.h
index da0341b8ca0a..14ba4452296e 100644
--- a/include/linux/ks8842.h
+++ b/include/linux/ks8842.h
@@ -25,10 +25,14 @@
25 * struct ks8842_platform_data - Platform data of the KS8842 network driver 25 * struct ks8842_platform_data - Platform data of the KS8842 network driver
26 * @macaddr: The MAC address of the device, set to all 0:s to use the on in 26 * @macaddr: The MAC address of the device, set to all 0:s to use the on in
27 * the chip. 27 * the chip.
28 * @rx_dma_channel: The DMA channel to use for RX, -1 for none.
29 * @tx_dma_channel: The DMA channel to use for TX, -1 for none.
28 * 30 *
29 */ 31 */
30struct ks8842_platform_data { 32struct ks8842_platform_data {
31 u8 macaddr[ETH_ALEN]; 33 u8 macaddr[ETH_ALEN];
34 int rx_dma_channel;
35 int tx_dma_channel;
32}; 36};
33 37
34#endif 38#endif
diff --git a/include/linux/ksm.h b/include/linux/ksm.h
index 43bdab769fc3..74d691ee9121 100644
--- a/include/linux/ksm.h
+++ b/include/linux/ksm.h
@@ -78,7 +78,7 @@ static inline struct page *ksm_might_need_to_copy(struct page *page,
78 struct anon_vma *anon_vma = page_anon_vma(page); 78 struct anon_vma *anon_vma = page_anon_vma(page);
79 79
80 if (!anon_vma || 80 if (!anon_vma ||
81 (anon_vma == vma->anon_vma && 81 (anon_vma->root == vma->anon_vma->root &&
82 page->index == linear_page_index(vma, address))) 82 page->index == linear_page_index(vma, address)))
83 return page; 83 return page;
84 84
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index aabc8a13ba71..685ea65eb803 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -30,8 +30,73 @@ struct task_struct *kthread_create(int (*threadfn)(void *data),
30void kthread_bind(struct task_struct *k, unsigned int cpu); 30void kthread_bind(struct task_struct *k, unsigned int cpu);
31int kthread_stop(struct task_struct *k); 31int kthread_stop(struct task_struct *k);
32int kthread_should_stop(void); 32int kthread_should_stop(void);
33void *kthread_data(struct task_struct *k);
33 34
34int kthreadd(void *unused); 35int kthreadd(void *unused);
35extern struct task_struct *kthreadd_task; 36extern struct task_struct *kthreadd_task;
36 37
38/*
39 * Simple work processor based on kthread.
40 *
41 * This provides easier way to make use of kthreads. A kthread_work
42 * can be queued and flushed using queue/flush_kthread_work()
43 * respectively. Queued kthread_works are processed by a kthread
44 * running kthread_worker_fn().
45 *
46 * A kthread_work can't be freed while it is executing.
47 */
48struct kthread_work;
49typedef void (*kthread_work_func_t)(struct kthread_work *work);
50
51struct kthread_worker {
52 spinlock_t lock;
53 struct list_head work_list;
54 struct task_struct *task;
55};
56
57struct kthread_work {
58 struct list_head node;
59 kthread_work_func_t func;
60 wait_queue_head_t done;
61 atomic_t flushing;
62 int queue_seq;
63 int done_seq;
64};
65
66#define KTHREAD_WORKER_INIT(worker) { \
67 .lock = SPIN_LOCK_UNLOCKED, \
68 .work_list = LIST_HEAD_INIT((worker).work_list), \
69 }
70
71#define KTHREAD_WORK_INIT(work, fn) { \
72 .node = LIST_HEAD_INIT((work).node), \
73 .func = (fn), \
74 .done = __WAIT_QUEUE_HEAD_INITIALIZER((work).done), \
75 .flushing = ATOMIC_INIT(0), \
76 }
77
78#define DEFINE_KTHREAD_WORKER(worker) \
79 struct kthread_worker worker = KTHREAD_WORKER_INIT(worker)
80
81#define DEFINE_KTHREAD_WORK(work, fn) \
82 struct kthread_work work = KTHREAD_WORK_INIT(work, fn)
83
84static inline void init_kthread_worker(struct kthread_worker *worker)
85{
86 *worker = (struct kthread_worker)KTHREAD_WORKER_INIT(*worker);
87}
88
89static inline void init_kthread_work(struct kthread_work *work,
90 kthread_work_func_t fn)
91{
92 *work = (struct kthread_work)KTHREAD_WORK_INIT(*work, fn);
93}
94
95int kthread_worker_fn(void *worker_ptr);
96
97bool queue_kthread_work(struct kthread_worker *worker,
98 struct kthread_work *work);
99void flush_kthread_work(struct kthread_work *work);
100void flush_kthread_worker(struct kthread_worker *worker);
101
37#endif /* _LINUX_KTHREAD_H */ 102#endif /* _LINUX_KTHREAD_H */
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 23ea02253900..636fc381c897 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -524,6 +524,12 @@ struct kvm_enable_cap {
524#define KVM_CAP_PPC_OSI 52 524#define KVM_CAP_PPC_OSI 52
525#define KVM_CAP_PPC_UNSET_IRQ 53 525#define KVM_CAP_PPC_UNSET_IRQ 53
526#define KVM_CAP_ENABLE_CAP 54 526#define KVM_CAP_ENABLE_CAP 54
527#ifdef __KVM_HAVE_XSAVE
528#define KVM_CAP_XSAVE 55
529#endif
530#ifdef __KVM_HAVE_XCRS
531#define KVM_CAP_XCRS 56
532#endif
527 533
528#ifdef KVM_CAP_IRQ_ROUTING 534#ifdef KVM_CAP_IRQ_ROUTING
529 535
@@ -613,6 +619,7 @@ struct kvm_clock_data {
613 */ 619 */
614#define KVM_CREATE_VCPU _IO(KVMIO, 0x41) 620#define KVM_CREATE_VCPU _IO(KVMIO, 0x41)
615#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log) 621#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log)
622/* KVM_SET_MEMORY_ALIAS is obsolete: */
616#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias) 623#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias)
617#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44) 624#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44)
618#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) 625#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45)
@@ -714,6 +721,12 @@ struct kvm_clock_data {
714#define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs) 721#define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs)
715#define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs) 722#define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs)
716#define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap) 723#define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap)
724/* Available with KVM_CAP_XSAVE */
725#define KVM_GET_XSAVE _IOR(KVMIO, 0xa4, struct kvm_xsave)
726#define KVM_SET_XSAVE _IOW(KVMIO, 0xa5, struct kvm_xsave)
727/* Available with KVM_CAP_XCRS */
728#define KVM_GET_XCRS _IOR(KVMIO, 0xa6, struct kvm_xcrs)
729#define KVM_SET_XCRS _IOW(KVMIO, 0xa7, struct kvm_xcrs)
717 730
718#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) 731#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
719 732
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 7cb116afa1cd..c13cc48697aa 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -81,13 +81,14 @@ struct kvm_vcpu {
81 int vcpu_id; 81 int vcpu_id;
82 struct mutex mutex; 82 struct mutex mutex;
83 int cpu; 83 int cpu;
84 atomic_t guest_mode;
84 struct kvm_run *run; 85 struct kvm_run *run;
85 unsigned long requests; 86 unsigned long requests;
86 unsigned long guest_debug; 87 unsigned long guest_debug;
87 int srcu_idx; 88 int srcu_idx;
88 89
89 int fpu_active; 90 int fpu_active;
90 int guest_fpu_loaded; 91 int guest_fpu_loaded, guest_xcr0_loaded;
91 wait_queue_head_t wq; 92 wait_queue_head_t wq;
92 int sigset_active; 93 int sigset_active;
93 sigset_t sigset; 94 sigset_t sigset;
@@ -123,6 +124,7 @@ struct kvm_memory_slot {
123 } *lpage_info[KVM_NR_PAGE_SIZES - 1]; 124 } *lpage_info[KVM_NR_PAGE_SIZES - 1];
124 unsigned long userspace_addr; 125 unsigned long userspace_addr;
125 int user_alloc; 126 int user_alloc;
127 int id;
126}; 128};
127 129
128static inline unsigned long kvm_dirty_bitmap_bytes(struct kvm_memory_slot *memslot) 130static inline unsigned long kvm_dirty_bitmap_bytes(struct kvm_memory_slot *memslot)
@@ -266,6 +268,8 @@ extern pfn_t bad_pfn;
266 268
267int is_error_page(struct page *page); 269int is_error_page(struct page *page);
268int is_error_pfn(pfn_t pfn); 270int is_error_pfn(pfn_t pfn);
271int is_hwpoison_pfn(pfn_t pfn);
272int is_fault_pfn(pfn_t pfn);
269int kvm_is_error_hva(unsigned long addr); 273int kvm_is_error_hva(unsigned long addr);
270int kvm_set_memory_region(struct kvm *kvm, 274int kvm_set_memory_region(struct kvm *kvm,
271 struct kvm_userspace_memory_region *mem, 275 struct kvm_userspace_memory_region *mem,
@@ -284,8 +288,6 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
284 int user_alloc); 288 int user_alloc);
285void kvm_disable_largepages(void); 289void kvm_disable_largepages(void);
286void kvm_arch_flush_shadow(struct kvm *kvm); 290void kvm_arch_flush_shadow(struct kvm *kvm);
287gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn);
288gfn_t unalias_gfn_instantiation(struct kvm *kvm, gfn_t gfn);
289 291
290struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); 292struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
291unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); 293unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
@@ -445,7 +447,8 @@ void kvm_register_irq_mask_notifier(struct kvm *kvm, int irq,
445 struct kvm_irq_mask_notifier *kimn); 447 struct kvm_irq_mask_notifier *kimn);
446void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq, 448void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq,
447 struct kvm_irq_mask_notifier *kimn); 449 struct kvm_irq_mask_notifier *kimn);
448void kvm_fire_mask_notifiers(struct kvm *kvm, int irq, bool mask); 450void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin,
451 bool mask);
449 452
450#ifdef __KVM_HAVE_IOAPIC 453#ifdef __KVM_HAVE_IOAPIC
451void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic, 454void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic,
@@ -562,10 +565,6 @@ static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_se
562} 565}
563#endif 566#endif
564 567
565#ifndef KVM_ARCH_HAS_UNALIAS_INSTANTIATION
566#define unalias_gfn_instantiation unalias_gfn
567#endif
568
569#ifdef CONFIG_HAVE_KVM_IRQCHIP 568#ifdef CONFIG_HAVE_KVM_IRQCHIP
570 569
571#define KVM_MAX_IRQ_ROUTES 1024 570#define KVM_MAX_IRQ_ROUTES 1024
@@ -628,5 +627,25 @@ static inline long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl,
628 627
629#endif 628#endif
630 629
630static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu)
631{
632 set_bit(req, &vcpu->requests);
633}
634
635static inline bool kvm_make_check_request(int req, struct kvm_vcpu *vcpu)
636{
637 return test_and_set_bit(req, &vcpu->requests);
638}
639
640static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu)
641{
642 if (test_bit(req, &vcpu->requests)) {
643 clear_bit(req, &vcpu->requests);
644 return true;
645 } else {
646 return false;
647 }
648}
649
631#endif 650#endif
632 651
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
index fb46efbeabec..7ac0d4eee430 100644
--- a/include/linux/kvm_types.h
+++ b/include/linux/kvm_types.h
@@ -32,11 +32,11 @@
32 32
33typedef unsigned long gva_t; 33typedef unsigned long gva_t;
34typedef u64 gpa_t; 34typedef u64 gpa_t;
35typedef unsigned long gfn_t; 35typedef u64 gfn_t;
36 36
37typedef unsigned long hva_t; 37typedef unsigned long hva_t;
38typedef u64 hpa_t; 38typedef u64 hpa_t;
39typedef unsigned long hfn_t; 39typedef u64 hfn_t;
40 40
41typedef hfn_t pfn_t; 41typedef hfn_t pfn_t;
42 42
diff --git a/include/linux/libata.h b/include/linux/libata.h
index b85f3ff34d7d..f010f18a0f86 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -751,6 +751,7 @@ struct ata_port {
751 struct ata_host *host; 751 struct ata_host *host;
752 struct device *dev; 752 struct device *dev;
753 753
754 struct mutex scsi_scan_mutex;
754 struct delayed_work hotplug_task; 755 struct delayed_work hotplug_task;
755 struct work_struct scsi_rescan_task; 756 struct work_struct scsi_rescan_task;
756 757
diff --git a/include/linux/list.h b/include/linux/list.h
index 5d57a3a1fa1b..d167b5d7c0ac 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_LIST_H 1#ifndef _LINUX_LIST_H
2#define _LINUX_LIST_H 2#define _LINUX_LIST_H
3 3
4#include <linux/types.h>
4#include <linux/stddef.h> 5#include <linux/stddef.h>
5#include <linux/poison.h> 6#include <linux/poison.h>
6#include <linux/prefetch.h> 7#include <linux/prefetch.h>
@@ -16,10 +17,6 @@
16 * using the generic single-entry routines. 17 * using the generic single-entry routines.
17 */ 18 */
18 19
19struct list_head {
20 struct list_head *next, *prev;
21};
22
23#define LIST_HEAD_INIT(name) { &(name), &(name) } 20#define LIST_HEAD_INIT(name) { &(name), &(name) }
24 21
25#define LIST_HEAD(name) \ 22#define LIST_HEAD(name) \
@@ -566,14 +563,6 @@ static inline void list_splice_tail_init(struct list_head *list,
566 * You lose the ability to access the tail in O(1). 563 * You lose the ability to access the tail in O(1).
567 */ 564 */
568 565
569struct hlist_head {
570 struct hlist_node *first;
571};
572
573struct hlist_node {
574 struct hlist_node *next, **pprev;
575};
576
577#define HLIST_HEAD_INIT { .first = NULL } 566#define HLIST_HEAD_INIT { .first = NULL }
578#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL } 567#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL }
579#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) 568#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
diff --git a/include/linux/lru_cache.h b/include/linux/lru_cache.h
index de48d167568b..78fbf24f357a 100644
--- a/include/linux/lru_cache.h
+++ b/include/linux/lru_cache.h
@@ -262,7 +262,7 @@ extern void lc_seq_dump_details(struct seq_file *seq, struct lru_cache *lc, char
262 * @lc: the lru cache to operate on 262 * @lc: the lru cache to operate on
263 * 263 *
264 * Note that the reference counts and order on the active and lru lists may 264 * Note that the reference counts and order on the active and lru lists may
265 * still change. Returns true if we aquired the lock. 265 * still change. Returns true if we acquired the lock.
266 */ 266 */
267static inline int lc_try_lock(struct lru_cache *lc) 267static inline int lc_try_lock(struct lru_cache *lc)
268{ 268{
diff --git a/include/linux/lsm_audit.h b/include/linux/lsm_audit.h
index 6907251d5200..112a55033352 100644
--- a/include/linux/lsm_audit.h
+++ b/include/linux/lsm_audit.h
@@ -90,10 +90,42 @@ struct common_audit_data {
90 u32 requested; 90 u32 requested;
91 u32 audited; 91 u32 audited;
92 u32 denied; 92 u32 denied;
93 /*
94 * auditdeny is a bit tricky and unintuitive. See the
95 * comments in avc.c for it's meaning and usage.
96 */
97 u32 auditdeny;
93 struct av_decision *avd; 98 struct av_decision *avd;
94 int result; 99 int result;
95 } selinux_audit_data; 100 } selinux_audit_data;
96#endif 101#endif
102#ifdef CONFIG_SECURITY_APPARMOR
103 struct {
104 int error;
105 int op;
106 int type;
107 void *profile;
108 const char *name;
109 const char *info;
110 union {
111 void *target;
112 struct {
113 long pos;
114 void *target;
115 } iface;
116 struct {
117 int rlim;
118 unsigned long max;
119 } rlim;
120 struct {
121 const char *target;
122 u32 request;
123 u32 denied;
124 uid_t ouid;
125 } fs;
126 };
127 } apparmor_audit_data;
128#endif
97 }; 129 };
98 /* these callback will be implemented by a specific LSM */ 130 /* these callback will be implemented by a specific LSM */
99 void (*lsm_pre_audit)(struct audit_buffer *, void *); 131 void (*lsm_pre_audit)(struct audit_buffer *, void *);
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h
index 78c3bed1c3f5..b5e7f2202484 100644
--- a/include/linux/mISDNif.h
+++ b/include/linux/mISDNif.h
@@ -251,7 +251,7 @@
251struct mISDNhead { 251struct mISDNhead {
252 unsigned int prim; 252 unsigned int prim;
253 unsigned int id; 253 unsigned int id;
254} __attribute__((packed)); 254} __packed;
255 255
256#define MISDN_HEADER_LEN sizeof(struct mISDNhead) 256#define MISDN_HEADER_LEN sizeof(struct mISDNhead)
257#define MAX_DATA_SIZE 2048 257#define MAX_DATA_SIZE 2048
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
new file mode 100644
index 000000000000..d0f08018335d
--- /dev/null
+++ b/include/linux/marvell_phy.h
@@ -0,0 +1,21 @@
1#ifndef _MARVELL_PHY_H
2#define _MARVELL_PHY_H
3
4/* Mask used for ID comparisons */
5#define MARVELL_PHY_ID_MASK 0xfffffff0
6
7/* Known PHY IDs */
8#define MARVELL_PHY_ID_88E1101 0x01410c60
9#define MARVELL_PHY_ID_88E1112 0x01410c90
10#define MARVELL_PHY_ID_88E1111 0x01410cc0
11#define MARVELL_PHY_ID_88E1118 0x01410e10
12#define MARVELL_PHY_ID_88E1121R 0x01410cb0
13#define MARVELL_PHY_ID_88E1145 0x01410cd0
14#define MARVELL_PHY_ID_88E1240 0x01410e30
15#define MARVELL_PHY_ID_88EC048 0x01410e90
16
17/* struct phy_device dev_flags definitions */
18#define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001
19#define MARVELL_PHY_M1118_DNS323_LEDS 0x00000002
20
21#endif /* _MARVELL_PHY_H */
diff --git a/include/linux/mbcache.h b/include/linux/mbcache.h
index a09b84e4fdb4..54cbbac1e71d 100644
--- a/include/linux/mbcache.h
+++ b/include/linux/mbcache.h
@@ -4,9 +4,6 @@
4 (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org> 4 (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org>
5*/ 5*/
6 6
7/* Hardwire the number of additional indexes */
8#define MB_CACHE_INDEXES_COUNT 1
9
10struct mb_cache_entry { 7struct mb_cache_entry {
11 struct list_head e_lru_list; 8 struct list_head e_lru_list;
12 struct mb_cache *e_cache; 9 struct mb_cache *e_cache;
@@ -18,17 +15,12 @@ struct mb_cache_entry {
18 struct { 15 struct {
19 struct list_head o_list; 16 struct list_head o_list;
20 unsigned int o_key; 17 unsigned int o_key;
21 } e_indexes[0]; 18 } e_index;
22};
23
24struct mb_cache_op {
25 int (*free)(struct mb_cache_entry *, gfp_t);
26}; 19};
27 20
28/* Functions on caches */ 21/* Functions on caches */
29 22
30struct mb_cache * mb_cache_create(const char *, struct mb_cache_op *, size_t, 23struct mb_cache *mb_cache_create(const char *, int);
31 int, int);
32void mb_cache_shrink(struct block_device *); 24void mb_cache_shrink(struct block_device *);
33void mb_cache_destroy(struct mb_cache *); 25void mb_cache_destroy(struct mb_cache *);
34 26
@@ -36,17 +28,15 @@ void mb_cache_destroy(struct mb_cache *);
36 28
37struct mb_cache_entry *mb_cache_entry_alloc(struct mb_cache *, gfp_t); 29struct mb_cache_entry *mb_cache_entry_alloc(struct mb_cache *, gfp_t);
38int mb_cache_entry_insert(struct mb_cache_entry *, struct block_device *, 30int mb_cache_entry_insert(struct mb_cache_entry *, struct block_device *,
39 sector_t, unsigned int[]); 31 sector_t, unsigned int);
40void mb_cache_entry_release(struct mb_cache_entry *); 32void mb_cache_entry_release(struct mb_cache_entry *);
41void mb_cache_entry_free(struct mb_cache_entry *); 33void mb_cache_entry_free(struct mb_cache_entry *);
42struct mb_cache_entry *mb_cache_entry_get(struct mb_cache *, 34struct mb_cache_entry *mb_cache_entry_get(struct mb_cache *,
43 struct block_device *, 35 struct block_device *,
44 sector_t); 36 sector_t);
45#if !defined(MB_CACHE_INDEXES_COUNT) || (MB_CACHE_INDEXES_COUNT > 0) 37struct mb_cache_entry *mb_cache_entry_find_first(struct mb_cache *cache,
46struct mb_cache_entry *mb_cache_entry_find_first(struct mb_cache *cache, int,
47 struct block_device *, 38 struct block_device *,
48 unsigned int); 39 unsigned int);
49struct mb_cache_entry *mb_cache_entry_find_next(struct mb_cache_entry *, int, 40struct mb_cache_entry *mb_cache_entry_find_next(struct mb_cache_entry *,
50 struct block_device *, 41 struct block_device *,
51 unsigned int); 42 unsigned int);
52#endif
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 9411d32840b0..159a0762aeaf 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -98,11 +98,6 @@ extern void mem_cgroup_end_migration(struct mem_cgroup *mem,
98/* 98/*
99 * For memory reclaim. 99 * For memory reclaim.
100 */ 100 */
101extern int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem);
102extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
103 int priority);
104extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
105 int priority);
106int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg); 101int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg);
107int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg); 102int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg);
108unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, 103unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg,
@@ -128,8 +123,9 @@ static inline bool mem_cgroup_disabled(void)
128 123
129void mem_cgroup_update_file_mapped(struct page *page, int val); 124void mem_cgroup_update_file_mapped(struct page *page, int val);
130unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, 125unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
131 gfp_t gfp_mask, int nid, 126 gfp_t gfp_mask);
132 int zid); 127u64 mem_cgroup_get_limit(struct mem_cgroup *mem);
128
133#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 129#else /* CONFIG_CGROUP_MEM_RES_CTLR */
134struct mem_cgroup; 130struct mem_cgroup;
135 131
@@ -304,7 +300,13 @@ static inline void mem_cgroup_update_file_mapped(struct page *page,
304 300
305static inline 301static inline
306unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, 302unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
307 gfp_t gfp_mask, int nid, int zid) 303 gfp_t gfp_mask)
304{
305 return 0;
306}
307
308static inline
309u64 mem_cgroup_get_limit(struct mem_cgroup *mem)
308{ 310{
309 return 0; 311 return 0;
310} 312}
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 7b9ef6bf45aa..31ac26ca4acf 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -210,6 +210,8 @@ extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
210 unsigned long addr, gfp_t gfp_flags, 210 unsigned long addr, gfp_t gfp_flags,
211 struct mempolicy **mpol, nodemask_t **nodemask); 211 struct mempolicy **mpol, nodemask_t **nodemask);
212extern bool init_nodemask_of_mempolicy(nodemask_t *mask); 212extern bool init_nodemask_of_mempolicy(nodemask_t *mask);
213extern bool mempolicy_nodemask_intersects(struct task_struct *tsk,
214 const nodemask_t *mask);
213extern unsigned slab_node(struct mempolicy *policy); 215extern unsigned slab_node(struct mempolicy *policy);
214 216
215extern enum zone_type policy_zone; 217extern enum zone_type policy_zone;
@@ -338,7 +340,16 @@ static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
338 return node_zonelist(0, gfp_flags); 340 return node_zonelist(0, gfp_flags);
339} 341}
340 342
341static inline bool init_nodemask_of_mempolicy(nodemask_t *m) { return false; } 343static inline bool init_nodemask_of_mempolicy(nodemask_t *m)
344{
345 return false;
346}
347
348static inline bool mempolicy_nodemask_intersects(struct task_struct *tsk,
349 const nodemask_t *mask)
350{
351 return false;
352}
342 353
343static inline int do_migrate_pages(struct mm_struct *mm, 354static inline int do_migrate_pages(struct mm_struct *mm,
344 const nodemask_t *from_nodes, 355 const nodemask_t *from_nodes,
diff --git a/include/linux/mfd/ab8500.h b/include/linux/mfd/ab8500.h
index b63ff3ba3351..f5cec4500f38 100644
--- a/include/linux/mfd/ab8500.h
+++ b/include/linux/mfd/ab8500.h
@@ -76,6 +76,8 @@
76#define AB8500_NR_IRQS 104 76#define AB8500_NR_IRQS 104
77#define AB8500_NUM_IRQ_REGS 13 77#define AB8500_NUM_IRQ_REGS 13
78 78
79#define AB8500_NUM_REGULATORS 15
80
79/** 81/**
80 * struct ab8500 - ab8500 internal structure 82 * struct ab8500 - ab8500 internal structure
81 * @dev: parent device 83 * @dev: parent device
@@ -108,14 +110,18 @@ struct ab8500 {
108 u8 oldmask[AB8500_NUM_IRQ_REGS]; 110 u8 oldmask[AB8500_NUM_IRQ_REGS];
109}; 111};
110 112
113struct regulator_init_data;
114
111/** 115/**
112 * struct ab8500_platform_data - AB8500 platform data 116 * struct ab8500_platform_data - AB8500 platform data
113 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used 117 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used
114 * @init: board-specific initialization after detection of ab8500 118 * @init: board-specific initialization after detection of ab8500
119 * @regulator: machine-specific constraints for regulators
115 */ 120 */
116struct ab8500_platform_data { 121struct ab8500_platform_data {
117 int irq_base; 122 int irq_base;
118 void (*init) (struct ab8500 *); 123 void (*init) (struct ab8500 *);
124 struct regulator_init_data *regulator[AB8500_NUM_REGULATORS];
119}; 125};
120 126
121extern int ab8500_write(struct ab8500 *a8500, u16 addr, u8 data); 127extern int ab8500_write(struct ab8500 *a8500, u16 addr, u8 data);
diff --git a/include/linux/mfd/max8998-private.h b/include/linux/mfd/max8998-private.h
new file mode 100644
index 000000000000..6dc75b3e2d33
--- /dev/null
+++ b/include/linux/mfd/max8998-private.h
@@ -0,0 +1,112 @@
1/*
2 * max8698.h - Voltage regulator driver for the Maxim 8998
3 *
4 * Copyright (C) 2009-2010 Samsung Electrnoics
5 * Kyungmin Park <kyungmin.park@samsung.com>
6 * Marek Szyprowski <m.szyprowski@samsung.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef __LINUX_MFD_MAX8998_PRIV_H
24#define __LINUX_MFD_MAX8998_PRIV_H
25
26/* MAX 8998 registers */
27enum {
28 MAX8998_REG_IRQ1,
29 MAX8998_REG_IRQ2,
30 MAX8998_REG_IRQ3,
31 MAX8998_REG_IRQ4,
32 MAX8998_REG_IRQM1,
33 MAX8998_REG_IRQM2,
34 MAX8998_REG_IRQM3,
35 MAX8998_REG_IRQM4,
36 MAX8998_REG_STATUS1,
37 MAX8998_REG_STATUS2,
38 MAX8998_REG_STATUSM1,
39 MAX8998_REG_STATUSM2,
40 MAX8998_REG_CHGR1,
41 MAX8998_REG_CHGR2,
42 MAX8998_REG_LDO_ACTIVE_DISCHARGE1,
43 MAX8998_REG_LDO_ACTIVE_DISCHARGE2,
44 MAX8998_REG_BUCK_ACTIVE_DISCHARGE3,
45 MAX8998_REG_ONOFF1,
46 MAX8998_REG_ONOFF2,
47 MAX8998_REG_ONOFF3,
48 MAX8998_REG_ONOFF4,
49 MAX8998_REG_BUCK1_DVSARM1,
50 MAX8998_REG_BUCK1_DVSARM2,
51 MAX8998_REG_BUCK1_DVSARM3,
52 MAX8998_REG_BUCK1_DVSARM4,
53 MAX8998_REG_BUCK2_DVSINT1,
54 MAX8998_REG_BUCK2_DVSINT2,
55 MAX8998_REG_BUCK3,
56 MAX8998_REG_BUCK4,
57 MAX8998_REG_LDO2_LDO3,
58 MAX8998_REG_LDO4,
59 MAX8998_REG_LDO5,
60 MAX8998_REG_LDO6,
61 MAX8998_REG_LDO7,
62 MAX8998_REG_LDO8_LDO9,
63 MAX8998_REG_LDO10_LDO11,
64 MAX8998_REG_LDO12,
65 MAX8998_REG_LDO13,
66 MAX8998_REG_LDO14,
67 MAX8998_REG_LDO15,
68 MAX8998_REG_LDO16,
69 MAX8998_REG_LDO17,
70 MAX8998_REG_BKCHR,
71 MAX8998_REG_LBCNFG1,
72 MAX8998_REG_LBCNFG2,
73};
74
75/**
76 * struct max8998_dev - max8998 master device for sub-drivers
77 * @dev: master device of the chip (can be used to access platform data)
78 * @i2c_client: i2c client private data
79 * @dev_read(): chip register read function
80 * @dev_write(): chip register write function
81 * @dev_update(): chip register update function
82 * @iolock: mutex for serializing io access
83 */
84
85struct max8998_dev {
86 struct device *dev;
87 struct i2c_client *i2c_client;
88 int (*dev_read)(struct max8998_dev *max8998, u8 reg, u8 *dest);
89 int (*dev_write)(struct max8998_dev *max8998, u8 reg, u8 val);
90 int (*dev_update)(struct max8998_dev *max8998, u8 reg, u8 val, u8 mask);
91 struct mutex iolock;
92};
93
94static inline int max8998_read_reg(struct max8998_dev *max8998, u8 reg,
95 u8 *value)
96{
97 return max8998->dev_read(max8998, reg, value);
98}
99
100static inline int max8998_write_reg(struct max8998_dev *max8998, u8 reg,
101 u8 value)
102{
103 return max8998->dev_write(max8998, reg, value);
104}
105
106static inline int max8998_update_reg(struct max8998_dev *max8998, u8 reg,
107 u8 value, u8 mask)
108{
109 return max8998->dev_update(max8998, reg, value, mask);
110}
111
112#endif /* __LINUX_MFD_MAX8998_PRIV_H */
diff --git a/include/linux/mfd/max8998.h b/include/linux/mfd/max8998.h
new file mode 100644
index 000000000000..1d3601a2d853
--- /dev/null
+++ b/include/linux/mfd/max8998.h
@@ -0,0 +1,78 @@
1/*
2 * max8698.h - Voltage regulator driver for the Maxim 8998
3 *
4 * Copyright (C) 2009-2010 Samsung Electrnoics
5 * Kyungmin Park <kyungmin.park@samsung.com>
6 * Marek Szyprowski <m.szyprowski@samsung.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef __LINUX_MFD_MAX8998_H
24#define __LINUX_MFD_MAX8998_H
25
26#include <linux/regulator/machine.h>
27
28/* MAX 8998 regulator ids */
29enum {
30 MAX8998_LDO2 = 2,
31 MAX8998_LDO3,
32 MAX8998_LDO4,
33 MAX8998_LDO5,
34 MAX8998_LDO6,
35 MAX8998_LDO7,
36 MAX8998_LDO8,
37 MAX8998_LDO9,
38 MAX8998_LDO10,
39 MAX8998_LDO11,
40 MAX8998_LDO12,
41 MAX8998_LDO13,
42 MAX8998_LDO14,
43 MAX8998_LDO15,
44 MAX8998_LDO16,
45 MAX8998_LDO17,
46 MAX8998_BUCK1,
47 MAX8998_BUCK2,
48 MAX8998_BUCK3,
49 MAX8998_BUCK4,
50 MAX8998_EN32KHZ_AP,
51 MAX8998_EN32KHZ_CP,
52 MAX8998_ENVICHG,
53 MAX8998_ESAFEOUT1,
54 MAX8998_ESAFEOUT2,
55};
56
57/**
58 * max8998_regulator_data - regulator data
59 * @id: regulator id
60 * @initdata: regulator init data (contraints, supplies, ...)
61 */
62struct max8998_regulator_data {
63 int id;
64 struct regulator_init_data *initdata;
65};
66
67/**
68 * struct max8998_board - packages regulator init data
69 * @num_regulators: number of regultors used
70 * @regulators: array of defined regulators
71 */
72
73struct max8998_platform_data {
74 int num_regulators;
75 struct max8998_regulator_data *regulators;
76};
77
78#endif /* __LINUX_MFD_MAX8998_H */
diff --git a/include/linux/mfd/mc13783-private.h b/include/linux/mfd/mc13783-private.h
deleted file mode 100644
index 95cf9360553f..000000000000
--- a/include/linux/mfd/mc13783-private.h
+++ /dev/null
@@ -1,220 +0,0 @@
1/*
2 * Copyright 2009 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
3 *
4 * Initial development of this code was funded by
5 * Phytec Messtechnik GmbH, http://www.phytec.de
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#ifndef __LINUX_MFD_MC13783_PRIV_H
23#define __LINUX_MFD_MC13783_PRIV_H
24
25#include <linux/platform_device.h>
26#include <linux/mfd/mc13783.h>
27#include <linux/mutex.h>
28#include <linux/interrupt.h>
29
30struct mc13783 {
31 struct spi_device *spidev;
32 struct mutex lock;
33 int irq;
34 int flags;
35
36 irq_handler_t irqhandler[MC13783_NUM_IRQ];
37 void *irqdata[MC13783_NUM_IRQ];
38
39 /* XXX these should go as platformdata to the regulator subdevice */
40 struct mc13783_regulator_init_data *regulators;
41 int num_regulators;
42};
43
44#define MC13783_REG_INTERRUPT_STATUS_0 0
45#define MC13783_REG_INTERRUPT_MASK_0 1
46#define MC13783_REG_INTERRUPT_SENSE_0 2
47#define MC13783_REG_INTERRUPT_STATUS_1 3
48#define MC13783_REG_INTERRUPT_MASK_1 4
49#define MC13783_REG_INTERRUPT_SENSE_1 5
50#define MC13783_REG_POWER_UP_MODE_SENSE 6
51#define MC13783_REG_REVISION 7
52#define MC13783_REG_SEMAPHORE 8
53#define MC13783_REG_ARBITRATION_PERIPHERAL_AUDIO 9
54#define MC13783_REG_ARBITRATION_SWITCHERS 10
55#define MC13783_REG_ARBITRATION_REGULATORS_0 11
56#define MC13783_REG_ARBITRATION_REGULATORS_1 12
57#define MC13783_REG_POWER_CONTROL_0 13
58#define MC13783_REG_POWER_CONTROL_1 14
59#define MC13783_REG_POWER_CONTROL_2 15
60#define MC13783_REG_REGEN_ASSIGNMENT 16
61#define MC13783_REG_CONTROL_SPARE 17
62#define MC13783_REG_MEMORY_A 18
63#define MC13783_REG_MEMORY_B 19
64#define MC13783_REG_RTC_TIME 20
65#define MC13783_REG_RTC_ALARM 21
66#define MC13783_REG_RTC_DAY 22
67#define MC13783_REG_RTC_DAY_ALARM 23
68#define MC13783_REG_SWITCHERS_0 24
69#define MC13783_REG_SWITCHERS_1 25
70#define MC13783_REG_SWITCHERS_2 26
71#define MC13783_REG_SWITCHERS_3 27
72#define MC13783_REG_SWITCHERS_4 28
73#define MC13783_REG_SWITCHERS_5 29
74#define MC13783_REG_REGULATOR_SETTING_0 30
75#define MC13783_REG_REGULATOR_SETTING_1 31
76#define MC13783_REG_REGULATOR_MODE_0 32
77#define MC13783_REG_REGULATOR_MODE_1 33
78#define MC13783_REG_POWER_MISCELLANEOUS 34
79#define MC13783_REG_POWER_SPARE 35
80#define MC13783_REG_AUDIO_RX_0 36
81#define MC13783_REG_AUDIO_RX_1 37
82#define MC13783_REG_AUDIO_TX 38
83#define MC13783_REG_AUDIO_SSI_NETWORK 39
84#define MC13783_REG_AUDIO_CODEC 40
85#define MC13783_REG_AUDIO_STEREO_DAC 41
86#define MC13783_REG_AUDIO_SPARE 42
87#define MC13783_REG_ADC_0 43
88#define MC13783_REG_ADC_1 44
89#define MC13783_REG_ADC_2 45
90#define MC13783_REG_ADC_3 46
91#define MC13783_REG_ADC_4 47
92#define MC13783_REG_CHARGER 48
93#define MC13783_REG_USB 49
94#define MC13783_REG_CHARGE_USB_SPARE 50
95#define MC13783_REG_LED_CONTROL_0 51
96#define MC13783_REG_LED_CONTROL_1 52
97#define MC13783_REG_LED_CONTROL_2 53
98#define MC13783_REG_LED_CONTROL_3 54
99#define MC13783_REG_LED_CONTROL_4 55
100#define MC13783_REG_LED_CONTROL_5 56
101#define MC13783_REG_SPARE 57
102#define MC13783_REG_TRIM_0 58
103#define MC13783_REG_TRIM_1 59
104#define MC13783_REG_TEST_0 60
105#define MC13783_REG_TEST_1 61
106#define MC13783_REG_TEST_2 62
107#define MC13783_REG_TEST_3 63
108#define MC13783_REG_NB 64
109
110/*
111 * Reg Regulator Mode 0
112 */
113#define MC13783_REGCTRL_VAUDIO_EN (1 << 0)
114#define MC13783_REGCTRL_VAUDIO_STBY (1 << 1)
115#define MC13783_REGCTRL_VAUDIO_MODE (1 << 2)
116#define MC13783_REGCTRL_VIOHI_EN (1 << 3)
117#define MC13783_REGCTRL_VIOHI_STBY (1 << 4)
118#define MC13783_REGCTRL_VIOHI_MODE (1 << 5)
119#define MC13783_REGCTRL_VIOLO_EN (1 << 6)
120#define MC13783_REGCTRL_VIOLO_STBY (1 << 7)
121#define MC13783_REGCTRL_VIOLO_MODE (1 << 8)
122#define MC13783_REGCTRL_VDIG_EN (1 << 9)
123#define MC13783_REGCTRL_VDIG_STBY (1 << 10)
124#define MC13783_REGCTRL_VDIG_MODE (1 << 11)
125#define MC13783_REGCTRL_VGEN_EN (1 << 12)
126#define MC13783_REGCTRL_VGEN_STBY (1 << 13)
127#define MC13783_REGCTRL_VGEN_MODE (1 << 14)
128#define MC13783_REGCTRL_VRFDIG_EN (1 << 15)
129#define MC13783_REGCTRL_VRFDIG_STBY (1 << 16)
130#define MC13783_REGCTRL_VRFDIG_MODE (1 << 17)
131#define MC13783_REGCTRL_VRFREF_EN (1 << 18)
132#define MC13783_REGCTRL_VRFREF_STBY (1 << 19)
133#define MC13783_REGCTRL_VRFREF_MODE (1 << 20)
134#define MC13783_REGCTRL_VRFCP_EN (1 << 21)
135#define MC13783_REGCTRL_VRFCP_STBY (1 << 22)
136#define MC13783_REGCTRL_VRFCP_MODE (1 << 23)
137
138/*
139 * Reg Regulator Mode 1
140 */
141#define MC13783_REGCTRL_VSIM_EN (1 << 0)
142#define MC13783_REGCTRL_VSIM_STBY (1 << 1)
143#define MC13783_REGCTRL_VSIM_MODE (1 << 2)
144#define MC13783_REGCTRL_VESIM_EN (1 << 3)
145#define MC13783_REGCTRL_VESIM_STBY (1 << 4)
146#define MC13783_REGCTRL_VESIM_MODE (1 << 5)
147#define MC13783_REGCTRL_VCAM_EN (1 << 6)
148#define MC13783_REGCTRL_VCAM_STBY (1 << 7)
149#define MC13783_REGCTRL_VCAM_MODE (1 << 8)
150#define MC13783_REGCTRL_VRFBG_EN (1 << 9)
151#define MC13783_REGCTRL_VRFBG_STBY (1 << 10)
152#define MC13783_REGCTRL_VVIB_EN (1 << 11)
153#define MC13783_REGCTRL_VRF1_EN (1 << 12)
154#define MC13783_REGCTRL_VRF1_STBY (1 << 13)
155#define MC13783_REGCTRL_VRF1_MODE (1 << 14)
156#define MC13783_REGCTRL_VRF2_EN (1 << 15)
157#define MC13783_REGCTRL_VRF2_STBY (1 << 16)
158#define MC13783_REGCTRL_VRF2_MODE (1 << 17)
159#define MC13783_REGCTRL_VMMC1_EN (1 << 18)
160#define MC13783_REGCTRL_VMMC1_STBY (1 << 19)
161#define MC13783_REGCTRL_VMMC1_MODE (1 << 20)
162#define MC13783_REGCTRL_VMMC2_EN (1 << 21)
163#define MC13783_REGCTRL_VMMC2_STBY (1 << 22)
164#define MC13783_REGCTRL_VMMC2_MODE (1 << 23)
165
166/*
167 * Reg Regulator Misc.
168 */
169#define MC13783_REGCTRL_GPO1_EN (1 << 6)
170#define MC13783_REGCTRL_GPO2_EN (1 << 8)
171#define MC13783_REGCTRL_GPO3_EN (1 << 10)
172#define MC13783_REGCTRL_GPO4_EN (1 << 12)
173#define MC13783_REGCTRL_VIBPINCTRL (1 << 14)
174
175/*
176 * Reg Switcher 4
177 */
178#define MC13783_SWCTRL_SW1A_MODE (1 << 0)
179#define MC13783_SWCTRL_SW1A_STBY_MODE (1 << 2)
180#define MC13783_SWCTRL_SW1A_DVS_SPEED (1 << 6)
181#define MC13783_SWCTRL_SW1A_PANIC_MODE (1 << 8)
182#define MC13783_SWCTRL_SW1A_SOFTSTART (1 << 9)
183#define MC13783_SWCTRL_SW1B_MODE (1 << 10)
184#define MC13783_SWCTRL_SW1B_STBY_MODE (1 << 12)
185#define MC13783_SWCTRL_SW1B_DVS_SPEED (1 << 14)
186#define MC13783_SWCTRL_SW1B_PANIC_MODE (1 << 16)
187#define MC13783_SWCTRL_SW1B_SOFTSTART (1 << 17)
188#define MC13783_SWCTRL_PLL_EN (1 << 18)
189#define MC13783_SWCTRL_PLL_FACTOR (1 << 19)
190
191/*
192 * Reg Switcher 5
193 */
194#define MC13783_SWCTRL_SW2A_MODE (1 << 0)
195#define MC13783_SWCTRL_SW2A_STBY_MODE (1 << 2)
196#define MC13783_SWCTRL_SW2A_DVS_SPEED (1 << 6)
197#define MC13783_SWCTRL_SW2A_PANIC_MODE (1 << 8)
198#define MC13783_SWCTRL_SW2A_SOFTSTART (1 << 9)
199#define MC13783_SWCTRL_SW2B_MODE (1 << 10)
200#define MC13783_SWCTRL_SW2B_STBY_MODE (1 << 12)
201#define MC13783_SWCTRL_SW2B_DVS_SPEED (1 << 14)
202#define MC13783_SWCTRL_SW2B_PANIC_MODE (1 << 16)
203#define MC13783_SWCTRL_SW2B_SOFTSTART (1 << 17)
204#define MC13783_SWSET_SW3 (1 << 18)
205#define MC13783_SWCTRL_SW3_EN (1 << 20)
206#define MC13783_SWCTRL_SW3_STBY (1 << 21)
207#define MC13783_SWCTRL_SW3_MODE (1 << 22)
208
209static inline int mc13783_set_bits(struct mc13783 *mc13783, unsigned int offset,
210 u32 mask, u32 val)
211{
212 int ret;
213 mc13783_lock(mc13783);
214 ret = mc13783_reg_rmw(mc13783, offset, mask, val);
215 mc13783_unlock(mc13783);
216
217 return ret;
218}
219
220#endif /* __LINUX_MFD_MC13783_PRIV_H */
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h
index 4a894f688549..0fa44fb8dd26 100644
--- a/include/linux/mfd/mc13783.h
+++ b/include/linux/mfd/mc13783.h
@@ -21,6 +21,8 @@ int mc13783_reg_write(struct mc13783 *mc13783, unsigned int offset, u32 val);
21int mc13783_reg_rmw(struct mc13783 *mc13783, unsigned int offset, 21int mc13783_reg_rmw(struct mc13783 *mc13783, unsigned int offset,
22 u32 mask, u32 val); 22 u32 mask, u32 val);
23 23
24int mc13783_get_flags(struct mc13783 *mc13783);
25
24int mc13783_irq_request(struct mc13783 *mc13783, int irq, 26int mc13783_irq_request(struct mc13783 *mc13783, int irq,
25 irq_handler_t handler, const char *name, void *dev); 27 irq_handler_t handler, const char *name, void *dev);
26int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq, 28int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq,
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
new file mode 100644
index 000000000000..39ca7588659b
--- /dev/null
+++ b/include/linux/mfd/stmpe.h
@@ -0,0 +1,201 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License Terms: GNU General Public License, version 2
5 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
6 */
7
8#ifndef __LINUX_MFD_STMPE_H
9#define __LINUX_MFD_STMPE_H
10
11#include <linux/device.h>
12
13enum stmpe_block {
14 STMPE_BLOCK_GPIO = 1 << 0,
15 STMPE_BLOCK_KEYPAD = 1 << 1,
16 STMPE_BLOCK_TOUCHSCREEN = 1 << 2,
17 STMPE_BLOCK_ADC = 1 << 3,
18 STMPE_BLOCK_PWM = 1 << 4,
19 STMPE_BLOCK_ROTATOR = 1 << 5,
20};
21
22enum stmpe_partnum {
23 STMPE811,
24 STMPE1601,
25 STMPE2401,
26 STMPE2403,
27};
28
29/*
30 * For registers whose locations differ on variants, the correct address is
31 * obtained by indexing stmpe->regs with one of the following.
32 */
33enum {
34 STMPE_IDX_CHIP_ID,
35 STMPE_IDX_ICR_LSB,
36 STMPE_IDX_IER_LSB,
37 STMPE_IDX_ISR_MSB,
38 STMPE_IDX_GPMR_LSB,
39 STMPE_IDX_GPSR_LSB,
40 STMPE_IDX_GPCR_LSB,
41 STMPE_IDX_GPDR_LSB,
42 STMPE_IDX_GPEDR_MSB,
43 STMPE_IDX_GPRER_LSB,
44 STMPE_IDX_GPFER_LSB,
45 STMPE_IDX_GPAFR_U_MSB,
46 STMPE_IDX_IEGPIOR_LSB,
47 STMPE_IDX_ISGPIOR_MSB,
48 STMPE_IDX_MAX,
49};
50
51
52struct stmpe_variant_info;
53
54/**
55 * struct stmpe - STMPE MFD structure
56 * @lock: lock protecting I/O operations
57 * @irq_lock: IRQ bus lock
58 * @dev: device, mostly for dev_dbg()
59 * @i2c: i2c client
60 * @variant: the detected STMPE model number
61 * @regs: list of addresses of registers which are at different addresses on
62 * different variants. Indexed by one of STMPE_IDX_*.
63 * @irq_base: starting IRQ number for internal IRQs
64 * @num_gpios: number of gpios, differs for variants
65 * @ier: cache of IER registers for bus_lock
66 * @oldier: cache of IER registers for bus_lock
67 * @pdata: platform data
68 */
69struct stmpe {
70 struct mutex lock;
71 struct mutex irq_lock;
72 struct device *dev;
73 struct i2c_client *i2c;
74 enum stmpe_partnum partnum;
75 struct stmpe_variant_info *variant;
76 const u8 *regs;
77
78 int irq_base;
79 int num_gpios;
80 u8 ier[2];
81 u8 oldier[2];
82 struct stmpe_platform_data *pdata;
83};
84
85extern int stmpe_reg_write(struct stmpe *stmpe, u8 reg, u8 data);
86extern int stmpe_reg_read(struct stmpe *stmpe, u8 reg);
87extern int stmpe_block_read(struct stmpe *stmpe, u8 reg, u8 length,
88 u8 *values);
89extern int stmpe_block_write(struct stmpe *stmpe, u8 reg, u8 length,
90 const u8 *values);
91extern int stmpe_set_bits(struct stmpe *stmpe, u8 reg, u8 mask, u8 val);
92extern int stmpe_set_altfunc(struct stmpe *stmpe, u32 pins,
93 enum stmpe_block block);
94extern int stmpe_enable(struct stmpe *stmpe, unsigned int blocks);
95extern int stmpe_disable(struct stmpe *stmpe, unsigned int blocks);
96
97struct matrix_keymap_data;
98
99/**
100 * struct stmpe_keypad_platform_data - STMPE keypad platform data
101 * @keymap_data: key map table and size
102 * @debounce_ms: debounce interval, in ms. Maximum is
103 * %STMPE_KEYPAD_MAX_DEBOUNCE.
104 * @scan_count: number of key scanning cycles to confirm key data.
105 * Maximum is %STMPE_KEYPAD_MAX_SCAN_COUNT.
106 * @no_autorepeat: disable key autorepeat
107 */
108struct stmpe_keypad_platform_data {
109 struct matrix_keymap_data *keymap_data;
110 unsigned int debounce_ms;
111 unsigned int scan_count;
112 bool no_autorepeat;
113};
114
115/**
116 * struct stmpe_gpio_platform_data - STMPE GPIO platform data
117 * @gpio_base: first gpio number assigned. A maximum of
118 * %STMPE_NR_GPIOS GPIOs will be allocated.
119 */
120struct stmpe_gpio_platform_data {
121 int gpio_base;
122 void (*setup)(struct stmpe *stmpe, unsigned gpio_base);
123 void (*remove)(struct stmpe *stmpe, unsigned gpio_base);
124};
125
126/**
127 * struct stmpe_ts_platform_data - stmpe811 touch screen controller platform
128 * data
129 * @sample_time: ADC converstion time in number of clock.
130 * (0 -> 36 clocks, 1 -> 44 clocks, 2 -> 56 clocks, 3 -> 64 clocks,
131 * 4 -> 80 clocks, 5 -> 96 clocks, 6 -> 144 clocks),
132 * recommended is 4.
133 * @mod_12b: ADC Bit mode (0 -> 10bit ADC, 1 -> 12bit ADC)
134 * @ref_sel: ADC reference source
135 * (0 -> internal reference, 1 -> external reference)
136 * @adc_freq: ADC Clock speed
137 * (0 -> 1.625 MHz, 1 -> 3.25 MHz, 2 || 3 -> 6.5 MHz)
138 * @ave_ctrl: Sample average control
139 * (0 -> 1 sample, 1 -> 2 samples, 2 -> 4 samples, 3 -> 8 samples)
140 * @touch_det_delay: Touch detect interrupt delay
141 * (0 -> 10 us, 1 -> 50 us, 2 -> 100 us, 3 -> 500 us,
142 * 4-> 1 ms, 5 -> 5 ms, 6 -> 10 ms, 7 -> 50 ms)
143 * recommended is 3
144 * @settling: Panel driver settling time
145 * (0 -> 10 us, 1 -> 100 us, 2 -> 500 us, 3 -> 1 ms,
146 * 4 -> 5 ms, 5 -> 10 ms, 6 for 50 ms, 7 -> 100 ms)
147 * recommended is 2
148 * @fraction_z: Length of the fractional part in z
149 * (fraction_z ([0..7]) = Count of the fractional part)
150 * recommended is 7
151 * @i_drive: current limit value of the touchscreen drivers
152 * (0 -> 20 mA typical 35 mA max, 1 -> 50 mA typical 80 mA max)
153 *
154 * */
155struct stmpe_ts_platform_data {
156 u8 sample_time;
157 u8 mod_12b;
158 u8 ref_sel;
159 u8 adc_freq;
160 u8 ave_ctrl;
161 u8 touch_det_delay;
162 u8 settling;
163 u8 fraction_z;
164 u8 i_drive;
165};
166
167/**
168 * struct stmpe_platform_data - STMPE platform data
169 * @id: device id to distinguish between multiple STMPEs on the same board
170 * @blocks: bitmask of blocks to enable (use STMPE_BLOCK_*)
171 * @irq_trigger: IRQ trigger to use for the interrupt to the host
172 * @irq_invert_polarity: IRQ line is connected with reversed polarity
173 * @autosleep: bool to enable/disable stmpe autosleep
174 * @autosleep_timeout: inactivity timeout in milliseconds for autosleep
175 * @irq_base: base IRQ number. %STMPE_NR_IRQS irqs will be used, or
176 * %STMPE_NR_INTERNAL_IRQS if the GPIO driver is not used.
177 * @gpio: GPIO-specific platform data
178 * @keypad: keypad-specific platform data
179 * @ts: touchscreen-specific platform data
180 */
181struct stmpe_platform_data {
182 int id;
183 unsigned int blocks;
184 int irq_base;
185 unsigned int irq_trigger;
186 bool irq_invert_polarity;
187 bool autosleep;
188 int autosleep_timeout;
189
190 struct stmpe_gpio_platform_data *gpio;
191 struct stmpe_keypad_platform_data *keypad;
192 struct stmpe_ts_platform_data *ts;
193};
194
195#define STMPE_NR_INTERNAL_IRQS 9
196#define STMPE_INT_GPIO(x) (STMPE_NR_INTERNAL_IRQS + (x))
197
198#define STMPE_NR_GPIOS 24
199#define STMPE_NR_IRQS STMPE_INT_GPIO(STMPE_NR_GPIOS)
200
201#endif
diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h
new file mode 100644
index 000000000000..772b3ae640af
--- /dev/null
+++ b/include/linux/mfd/tps6586x.h
@@ -0,0 +1,47 @@
1#ifndef __LINUX_MFD_TPS6586X_H
2#define __LINUX_MFD_TPS6586X_H
3
4enum {
5 TPS6586X_ID_SM_0,
6 TPS6586X_ID_SM_1,
7 TPS6586X_ID_SM_2,
8 TPS6586X_ID_LDO_0,
9 TPS6586X_ID_LDO_1,
10 TPS6586X_ID_LDO_2,
11 TPS6586X_ID_LDO_3,
12 TPS6586X_ID_LDO_4,
13 TPS6586X_ID_LDO_5,
14 TPS6586X_ID_LDO_6,
15 TPS6586X_ID_LDO_7,
16 TPS6586X_ID_LDO_8,
17 TPS6586X_ID_LDO_9,
18 TPS6586X_ID_LDO_RTC,
19};
20
21struct tps6586x_subdev_info {
22 int id;
23 const char *name;
24 void *platform_data;
25};
26
27struct tps6586x_platform_data {
28 int num_subdevs;
29 struct tps6586x_subdev_info *subdevs;
30
31 int gpio_base;
32};
33
34/*
35 * NOTE: the functions below are not intended for use outside
36 * of the TPS6586X sub-device drivers
37 */
38extern int tps6586x_write(struct device *dev, int reg, uint8_t val);
39extern int tps6586x_writes(struct device *dev, int reg, int len, uint8_t *val);
40extern int tps6586x_read(struct device *dev, int reg, uint8_t *val);
41extern int tps6586x_reads(struct device *dev, int reg, int len, uint8_t *val);
42extern int tps6586x_set_bits(struct device *dev, int reg, uint8_t bit_mask);
43extern int tps6586x_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
44extern int tps6586x_update(struct device *dev, int reg, uint8_t val,
45 uint8_t mask);
46
47#endif /*__LINUX_MFD_TPS6586X_H */
diff --git a/include/linux/mfd/wm8994/gpio.h b/include/linux/mfd/wm8994/gpio.h
index b4d4c22991e8..0c79b5ff4b5a 100644
--- a/include/linux/mfd/wm8994/gpio.h
+++ b/include/linux/mfd/wm8994/gpio.h
@@ -36,6 +36,10 @@
36#define WM8994_GP_FN_WSEQ_STATUS 16 36#define WM8994_GP_FN_WSEQ_STATUS 16
37#define WM8994_GP_FN_FIFO_ERROR 17 37#define WM8994_GP_FN_FIFO_ERROR 17
38#define WM8994_GP_FN_OPCLK 18 38#define WM8994_GP_FN_OPCLK 18
39#define WM8994_GP_FN_THW 19
40#define WM8994_GP_FN_DCS_DONE 20
41#define WM8994_GP_FN_FLL1_OUT 21
42#define WM8994_GP_FN_FLL2_OUT 22
39 43
40#define WM8994_GPN_DIR 0x8000 /* GPN_DIR */ 44#define WM8994_GPN_DIR 0x8000 /* GPN_DIR */
41#define WM8994_GPN_DIR_MASK 0x8000 /* GPN_DIR */ 45#define WM8994_GPN_DIR_MASK 0x8000 /* GPN_DIR */
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index f6c9b7dcb9fd..bafffc737903 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -38,6 +38,7 @@
38#define KVM_MINOR 232 38#define KVM_MINOR 232
39#define BTRFS_MINOR 234 39#define BTRFS_MINOR 234
40#define AUTOFS_MINOR 235 40#define AUTOFS_MINOR 235
41#define MAPPER_CTRL_MINOR 236
41#define MISC_DYNAMIC_MINOR 255 42#define MISC_DYNAMIC_MINOR 255
42 43
43struct device; 44struct device;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index a2b48041b910..709f6728fc90 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -815,6 +815,7 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
815} 815}
816 816
817extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new); 817extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new);
818extern void truncate_setsize(struct inode *inode, loff_t newsize);
818extern int vmtruncate(struct inode *inode, loff_t offset); 819extern int vmtruncate(struct inode *inode, loff_t offset);
819extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end); 820extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end);
820 821
@@ -1465,6 +1466,14 @@ extern int sysctl_memory_failure_recovery;
1465extern void shake_page(struct page *p, int access); 1466extern void shake_page(struct page *p, int access);
1466extern atomic_long_t mce_bad_pages; 1467extern atomic_long_t mce_bad_pages;
1467extern int soft_offline_page(struct page *page, int flags); 1468extern int soft_offline_page(struct page *page, int flags);
1469#ifdef CONFIG_MEMORY_FAILURE
1470int is_hwpoison_address(unsigned long addr);
1471#else
1472static inline int is_hwpoison_address(unsigned long addr)
1473{
1474 return 0;
1475}
1476#endif
1468 1477
1469extern void dump_page(struct page *page); 1478extern void dump_page(struct page *page);
1470 1479
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index d02d2c6e0cfe..6b7525099e56 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -24,12 +24,14 @@ struct mmc_cid {
24}; 24};
25 25
26struct mmc_csd { 26struct mmc_csd {
27 unsigned char structure;
27 unsigned char mmca_vsn; 28 unsigned char mmca_vsn;
28 unsigned short cmdclass; 29 unsigned short cmdclass;
29 unsigned short tacc_clks; 30 unsigned short tacc_clks;
30 unsigned int tacc_ns; 31 unsigned int tacc_ns;
31 unsigned int r2w_factor; 32 unsigned int r2w_factor;
32 unsigned int max_dtr; 33 unsigned int max_dtr;
34 unsigned int erase_size; /* In sectors */
33 unsigned int read_blkbits; 35 unsigned int read_blkbits;
34 unsigned int write_blkbits; 36 unsigned int write_blkbits;
35 unsigned int capacity; 37 unsigned int capacity;
@@ -41,9 +43,16 @@ struct mmc_csd {
41 43
42struct mmc_ext_csd { 44struct mmc_ext_csd {
43 u8 rev; 45 u8 rev;
46 u8 erase_group_def;
47 u8 sec_feature_support;
44 unsigned int sa_timeout; /* Units: 100ns */ 48 unsigned int sa_timeout; /* Units: 100ns */
45 unsigned int hs_max_dtr; 49 unsigned int hs_max_dtr;
46 unsigned int sectors; 50 unsigned int sectors;
51 unsigned int hc_erase_size; /* In sectors */
52 unsigned int hc_erase_timeout; /* In milliseconds */
53 unsigned int sec_trim_mult; /* Secure trim multiplier */
54 unsigned int sec_erase_mult; /* Secure erase multiplier */
55 unsigned int trim_timeout; /* In milliseconds */
47}; 56};
48 57
49struct sd_scr { 58struct sd_scr {
@@ -53,6 +62,12 @@ struct sd_scr {
53#define SD_SCR_BUS_WIDTH_4 (1<<2) 62#define SD_SCR_BUS_WIDTH_4 (1<<2)
54}; 63};
55 64
65struct sd_ssr {
66 unsigned int au; /* In sectors */
67 unsigned int erase_timeout; /* In milliseconds */
68 unsigned int erase_offset; /* In milliseconds */
69};
70
56struct sd_switch_caps { 71struct sd_switch_caps {
57 unsigned int hs_max_dtr; 72 unsigned int hs_max_dtr;
58}; 73};
@@ -92,6 +107,7 @@ struct mmc_card {
92#define MMC_TYPE_MMC 0 /* MMC card */ 107#define MMC_TYPE_MMC 0 /* MMC card */
93#define MMC_TYPE_SD 1 /* SD card */ 108#define MMC_TYPE_SD 1 /* SD card */
94#define MMC_TYPE_SDIO 2 /* SDIO card */ 109#define MMC_TYPE_SDIO 2 /* SDIO card */
110#define MMC_TYPE_SD_COMBO 3 /* SD combo (IO+mem) card */
95 unsigned int state; /* (our) card state */ 111 unsigned int state; /* (our) card state */
96#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */ 112#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */
97#define MMC_STATE_READONLY (1<<1) /* card is read-only */ 113#define MMC_STATE_READONLY (1<<1) /* card is read-only */
@@ -101,6 +117,13 @@ struct mmc_card {
101#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ 117#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
102#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ 118#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */
103 /* for byte mode */ 119 /* for byte mode */
120#define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */
121 /* (missing CIA registers) */
122
123 unsigned int erase_size; /* erase size in sectors */
124 unsigned int erase_shift; /* if erase unit is power 2 */
125 unsigned int pref_erase; /* in sectors */
126 u8 erased_byte; /* value of erased bytes */
104 127
105 u32 raw_cid[4]; /* raw card CID */ 128 u32 raw_cid[4]; /* raw card CID */
106 u32 raw_csd[4]; /* raw card CSD */ 129 u32 raw_csd[4]; /* raw card CSD */
@@ -109,6 +132,7 @@ struct mmc_card {
109 struct mmc_csd csd; /* card specific */ 132 struct mmc_csd csd; /* card specific */
110 struct mmc_ext_csd ext_csd; /* mmc v4 extended card specific */ 133 struct mmc_ext_csd ext_csd; /* mmc v4 extended card specific */
111 struct sd_scr scr; /* extra SD information */ 134 struct sd_scr scr; /* extra SD information */
135 struct sd_ssr ssr; /* yet more SD information */
112 struct sd_switch_caps sw_caps; /* switch (CMD6) caps */ 136 struct sd_switch_caps sw_caps; /* switch (CMD6) caps */
113 137
114 unsigned int sdio_funcs; /* number of SDIO functions */ 138 unsigned int sdio_funcs; /* number of SDIO functions */
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index e4898e9eeb59..7429033acb66 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -92,6 +92,8 @@ struct mmc_command {
92 * actively failing requests 92 * actively failing requests
93 */ 93 */
94 94
95 unsigned int erase_timeout; /* in milliseconds */
96
95 struct mmc_data *data; /* data segment associated with cmd */ 97 struct mmc_data *data; /* data segment associated with cmd */
96 struct mmc_request *mrq; /* associated request */ 98 struct mmc_request *mrq; /* associated request */
97}; 99};
@@ -134,6 +136,23 @@ extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
134extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *, 136extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
135 struct mmc_command *, int); 137 struct mmc_command *, int);
136 138
139#define MMC_ERASE_ARG 0x00000000
140#define MMC_SECURE_ERASE_ARG 0x80000000
141#define MMC_TRIM_ARG 0x00000001
142#define MMC_SECURE_TRIM1_ARG 0x80000001
143#define MMC_SECURE_TRIM2_ARG 0x80008000
144
145#define MMC_SECURE_ARGS 0x80000000
146#define MMC_TRIM_ARGS 0x00008001
147
148extern int mmc_erase(struct mmc_card *card, unsigned int from, unsigned int nr,
149 unsigned int arg);
150extern int mmc_can_erase(struct mmc_card *card);
151extern int mmc_can_trim(struct mmc_card *card);
152extern int mmc_can_secure_erase_trim(struct mmc_card *card);
153extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from,
154 unsigned int nr);
155
137extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *); 156extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *);
138extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int); 157extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int);
139 158
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index f65913c9f5a4..1575b52c3bfa 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -124,6 +124,7 @@ struct mmc_host {
124 unsigned int f_min; 124 unsigned int f_min;
125 unsigned int f_max; 125 unsigned int f_max;
126 u32 ocr_avail; 126 u32 ocr_avail;
127 struct notifier_block pm_notify;
127 128
128#define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */ 129#define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */
129#define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */ 130#define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */
@@ -155,6 +156,7 @@ struct mmc_host {
155#define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */ 156#define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */
156#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ 157#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */
157#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ 158#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
159#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */
158 160
159 mmc_pm_flag_t pm_caps; /* supported pm features */ 161 mmc_pm_flag_t pm_caps; /* supported pm features */
160 162
@@ -183,6 +185,7 @@ struct mmc_host {
183 185
184 /* Only used with MMC_CAP_DISABLE */ 186 /* Only used with MMC_CAP_DISABLE */
185 int enabled; /* host is enabled */ 187 int enabled; /* host is enabled */
188 int rescan_disable; /* disable card detection */
186 int nesting_cnt; /* "enable" nesting count */ 189 int nesting_cnt; /* "enable" nesting count */
187 int en_dis_recurs; /* detect recursion */ 190 int en_dis_recurs; /* detect recursion */
188 unsigned int disable_delay; /* disable delay in msecs */ 191 unsigned int disable_delay; /* disable delay in msecs */
@@ -257,6 +260,7 @@ int mmc_card_can_sleep(struct mmc_host *host);
257int mmc_host_enable(struct mmc_host *host); 260int mmc_host_enable(struct mmc_host *host);
258int mmc_host_disable(struct mmc_host *host); 261int mmc_host_disable(struct mmc_host *host);
259int mmc_host_lazy_disable(struct mmc_host *host); 262int mmc_host_lazy_disable(struct mmc_host *host);
263int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *);
260 264
261static inline void mmc_set_disable_delay(struct mmc_host *host, 265static inline void mmc_set_disable_delay(struct mmc_host *host,
262 unsigned int disable_delay) 266 unsigned int disable_delay)
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 8a49cbf0376d..dd11ae51fb68 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -251,12 +251,21 @@ struct _mmc_csd {
251 * EXT_CSD fields 251 * EXT_CSD fields
252 */ 252 */
253 253
254#define EXT_CSD_BUS_WIDTH 183 /* R/W */ 254#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
255#define EXT_CSD_HS_TIMING 185 /* R/W */ 255#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */
256#define EXT_CSD_CARD_TYPE 196 /* RO */ 256#define EXT_CSD_BUS_WIDTH 183 /* R/W */
257#define EXT_CSD_REV 192 /* RO */ 257#define EXT_CSD_HS_TIMING 185 /* R/W */
258#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ 258#define EXT_CSD_REV 192 /* RO */
259#define EXT_CSD_S_A_TIMEOUT 217 259#define EXT_CSD_STRUCTURE 194 /* RO */
260#define EXT_CSD_CARD_TYPE 196 /* RO */
261#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
262#define EXT_CSD_S_A_TIMEOUT 217 /* RO */
263#define EXT_CSD_ERASE_TIMEOUT_MULT 223 /* RO */
264#define EXT_CSD_HC_ERASE_GRP_SIZE 224 /* RO */
265#define EXT_CSD_SEC_TRIM_MULT 229 /* RO */
266#define EXT_CSD_SEC_ERASE_MULT 230 /* RO */
267#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */
268#define EXT_CSD_TRIM_MULT 232 /* RO */
260 269
261/* 270/*
262 * EXT_CSD field definitions 271 * EXT_CSD field definitions
@@ -274,6 +283,10 @@ struct _mmc_csd {
274#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ 283#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */
275#define EXT_CSD_BUS_WIDTH_8 2 /* Card is in 8 bit mode */ 284#define EXT_CSD_BUS_WIDTH_8 2 /* Card is in 8 bit mode */
276 285
286#define EXT_CSD_SEC_ER_EN BIT(0)
287#define EXT_CSD_SEC_BD_BLK_EN BIT(2)
288#define EXT_CSD_SEC_GB_CL_EN BIT(4)
289
277/* 290/*
278 * MMC_SWITCH access modes 291 * MMC_SWITCH access modes
279 */ 292 */
diff --git a/include/linux/mmc/sd.h b/include/linux/mmc/sd.h
index f310062cffb4..3fd85e088cc3 100644
--- a/include/linux/mmc/sd.h
+++ b/include/linux/mmc/sd.h
@@ -21,8 +21,13 @@
21 /* class 10 */ 21 /* class 10 */
22#define SD_SWITCH 6 /* adtc [31:0] See below R1 */ 22#define SD_SWITCH 6 /* adtc [31:0] See below R1 */
23 23
24 /* class 5 */
25#define SD_ERASE_WR_BLK_START 32 /* ac [31:0] data addr R1 */
26#define SD_ERASE_WR_BLK_END 33 /* ac [31:0] data addr R1 */
27
24 /* Application commands */ 28 /* Application commands */
25#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */ 29#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */
30#define SD_APP_SD_STATUS 13 /* adtc R1 */
26#define SD_APP_SEND_NUM_WR_BLKS 22 /* adtc R1 */ 31#define SD_APP_SEND_NUM_WR_BLKS 22 /* adtc R1 */
27#define SD_APP_OP_COND 41 /* bcr [31:0] OCR R3 */ 32#define SD_APP_OP_COND 41 /* bcr [31:0] OCR R3 */
28#define SD_APP_SEND_SCR 51 /* adtc R1 */ 33#define SD_APP_SEND_SCR 51 /* adtc R1 */
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index ee24ef8ab616..c04ecfe03f7f 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -4,7 +4,7 @@
4#ifdef CONFIG_DEBUG_VM 4#ifdef CONFIG_DEBUG_VM
5#define VM_BUG_ON(cond) BUG_ON(cond) 5#define VM_BUG_ON(cond) BUG_ON(cond)
6#else 6#else
7#define VM_BUG_ON(cond) do { } while (0) 7#define VM_BUG_ON(cond) do { (void)(cond); } while (0)
8#endif 8#endif
9 9
10#ifdef CONFIG_DEBUG_VIRTUAL 10#ifdef CONFIG_DEBUG_VIRTUAL
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index b4d109e389b8..6e6e62648a4d 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -348,21 +348,6 @@ struct zone {
348 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS]; 348 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
349 349
350 /* 350 /*
351 * prev_priority holds the scanning priority for this zone. It is
352 * defined as the scanning priority at which we achieved our reclaim
353 * target at the previous try_to_free_pages() or balance_pgdat()
354 * invocation.
355 *
356 * We use prev_priority as a measure of how much stress page reclaim is
357 * under - it drives the swappiness decision: whether to unmap mapped
358 * pages.
359 *
360 * Access to both this field is quite racy even on uniprocessor. But
361 * it is expected to average out OK.
362 */
363 int prev_priority;
364
365 /*
366 * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on 351 * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on
367 * this zone's LRU. Maintained by the pageout code. 352 * this zone's LRU. Maintained by the pageout code.
368 */ 353 */
@@ -651,8 +636,6 @@ typedef struct pglist_data {
651#include <linux/memory_hotplug.h> 636#include <linux/memory_hotplug.h>
652 637
653extern struct mutex zonelists_mutex; 638extern struct mutex zonelists_mutex;
654void get_zone_counts(unsigned long *active, unsigned long *inactive,
655 unsigned long *free);
656void build_all_zonelists(void *data); 639void build_all_zonelists(void *data);
657void wakeup_kswapd(struct zone *zone, int order); 640void wakeup_kswapd(struct zone *zone, int order);
658int zone_watermark_ok(struct zone *z, int order, unsigned long mark, 641int zone_watermark_ok(struct zone *z, int order, unsigned long mark,
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 82a9124f7d75..9d2f1837b3d8 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -31,20 +31,23 @@ static const char __module_cat(name,__LINE__)[] \
31 31
32struct kernel_param; 32struct kernel_param;
33 33
34/* Returns 0, or -errno. arg is in kp->arg. */ 34struct kernel_param_ops {
35typedef int (*param_set_fn)(const char *val, struct kernel_param *kp); 35 /* Returns 0, or -errno. arg is in kp->arg. */
36/* Returns length written or -errno. Buffer is 4k (ie. be short!) */ 36 int (*set)(const char *val, const struct kernel_param *kp);
37typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp); 37 /* Returns length written or -errno. Buffer is 4k (ie. be short!) */
38 int (*get)(char *buffer, const struct kernel_param *kp);
39 /* Optional function to free kp->arg when module unloaded. */
40 void (*free)(void *arg);
41};
38 42
39/* Flag bits for kernel_param.flags */ 43/* Flag bits for kernel_param.flags */
40#define KPARAM_ISBOOL 2 44#define KPARAM_ISBOOL 2
41 45
42struct kernel_param { 46struct kernel_param {
43 const char *name; 47 const char *name;
48 const struct kernel_param_ops *ops;
44 u16 perm; 49 u16 perm;
45 u16 flags; 50 u16 flags;
46 param_set_fn set;
47 param_get_fn get;
48 union { 51 union {
49 void *arg; 52 void *arg;
50 const struct kparam_string *str; 53 const struct kparam_string *str;
@@ -63,12 +66,67 @@ struct kparam_array
63{ 66{
64 unsigned int max; 67 unsigned int max;
65 unsigned int *num; 68 unsigned int *num;
66 param_set_fn set; 69 const struct kernel_param_ops *ops;
67 param_get_fn get;
68 unsigned int elemsize; 70 unsigned int elemsize;
69 void *elem; 71 void *elem;
70}; 72};
71 73
74/**
75 * module_param - typesafe helper for a module/cmdline parameter
76 * @value: the variable to alter, and exposed parameter name.
77 * @type: the type of the parameter
78 * @perm: visibility in sysfs.
79 *
80 * @value becomes the module parameter, or (prefixed by KBUILD_MODNAME and a
81 * ".") the kernel commandline parameter. Note that - is changed to _, so
82 * the user can use "foo-bar=1" even for variable "foo_bar".
83 *
84 * @perm is 0 if the the variable is not to appear in sysfs, or 0444
85 * for world-readable, 0644 for root-writable, etc. Note that if it
86 * is writable, you may need to use kparam_block_sysfs_write() around
87 * accesses (esp. charp, which can be kfreed when it changes).
88 *
89 * The @type is simply pasted to refer to a param_ops_##type and a
90 * param_check_##type: for convenience many standard types are provided but
91 * you can create your own by defining those variables.
92 *
93 * Standard types are:
94 * byte, short, ushort, int, uint, long, ulong
95 * charp: a character pointer
96 * bool: a bool, values 0/1, y/n, Y/N.
97 * invbool: the above, only sense-reversed (N = true).
98 */
99#define module_param(name, type, perm) \
100 module_param_named(name, name, type, perm)
101
102/**
103 * module_param_named - typesafe helper for a renamed module/cmdline parameter
104 * @name: a valid C identifier which is the parameter name.
105 * @value: the actual lvalue to alter.
106 * @type: the type of the parameter
107 * @perm: visibility in sysfs.
108 *
109 * Usually it's a good idea to have variable names and user-exposed names the
110 * same, but that's harder if the variable must be non-static or is inside a
111 * structure. This allows exposure under a different name.
112 */
113#define module_param_named(name, value, type, perm) \
114 param_check_##type(name, &(value)); \
115 module_param_cb(name, &param_ops_##type, &value, perm); \
116 __MODULE_PARM_TYPE(name, #type)
117
118/**
119 * module_param_cb - general callback for a module/cmdline parameter
120 * @name: a valid C identifier which is the parameter name.
121 * @ops: the set & get operations for this parameter.
122 * @perm: visibility in sysfs.
123 *
124 * The ops can have NULL set or get functions.
125 */
126#define module_param_cb(name, ops, arg, perm) \
127 __module_param_call(MODULE_PARAM_PREFIX, \
128 name, ops, arg, __same_type((arg), bool *), perm)
129
72/* On alpha, ia64 and ppc64 relocations to global data cannot go into 130/* On alpha, ia64 and ppc64 relocations to global data cannot go into
73 read-only sections (which is part of respective UNIX ABI on these 131 read-only sections (which is part of respective UNIX ABI on these
74 platforms). So 'const' makes no sense and even causes compile failures 132 platforms). So 'const' makes no sense and even causes compile failures
@@ -80,10 +138,8 @@ struct kparam_array
80#endif 138#endif
81 139
82/* This is the fundamental function for registering boot/module 140/* This is the fundamental function for registering boot/module
83 parameters. perm sets the visibility in sysfs: 000 means it's 141 parameters. */
84 not there, read bits mean it's readable, write bits mean it's 142#define __module_param_call(prefix, name, ops, arg, isbool, perm) \
85 writable. */
86#define __module_param_call(prefix, name, set, get, arg, isbool, perm) \
87 /* Default value instead of permissions? */ \ 143 /* Default value instead of permissions? */ \
88 static int __param_perm_check_##name __attribute__((unused)) = \ 144 static int __param_perm_check_##name __attribute__((unused)) = \
89 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ 145 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \
@@ -92,31 +148,87 @@ struct kparam_array
92 static struct kernel_param __moduleparam_const __param_##name \ 148 static struct kernel_param __moduleparam_const __param_##name \
93 __used \ 149 __used \
94 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ 150 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
95 = { __param_str_##name, perm, isbool ? KPARAM_ISBOOL : 0, \ 151 = { __param_str_##name, ops, perm, isbool ? KPARAM_ISBOOL : 0, \
96 set, get, { arg } } 152 { arg } }
153
154/* Obsolete - use module_param_cb() */
155#define module_param_call(name, set, get, arg, perm) \
156 static struct kernel_param_ops __param_ops_##name = \
157 { (void *)set, (void *)get }; \
158 __module_param_call(MODULE_PARAM_PREFIX, \
159 name, &__param_ops_##name, arg, \
160 __same_type(arg, bool *), \
161 (perm) + sizeof(__check_old_set_param(set))*0)
162
163/* We don't get oldget: it's often a new-style param_get_uint, etc. */
164static inline int
165__check_old_set_param(int (*oldset)(const char *, struct kernel_param *))
166{
167 return 0;
168}
97 169
98#define module_param_call(name, set, get, arg, perm) \ 170/**
99 __module_param_call(MODULE_PARAM_PREFIX, \ 171 * kparam_block_sysfs_write - make sure a parameter isn't written via sysfs.
100 name, set, get, arg, \ 172 * @name: the name of the parameter
101 __same_type(*(arg), bool), perm) 173 *
174 * There's no point blocking write on a paramter that isn't writable via sysfs!
175 */
176#define kparam_block_sysfs_write(name) \
177 do { \
178 BUG_ON(!(__param_##name.perm & 0222)); \
179 __kernel_param_lock(); \
180 } while (0)
102 181
103/* Helper functions: type is byte, short, ushort, int, uint, long, 182/**
104 ulong, charp, bool or invbool, or XXX if you define param_get_XXX, 183 * kparam_unblock_sysfs_write - allows sysfs to write to a parameter again.
105 param_set_XXX and param_check_XXX. */ 184 * @name: the name of the parameter
106#define module_param_named(name, value, type, perm) \ 185 */
107 param_check_##type(name, &(value)); \ 186#define kparam_unblock_sysfs_write(name) \
108 module_param_call(name, param_set_##type, param_get_##type, &value, perm); \ 187 do { \
109 __MODULE_PARM_TYPE(name, #type) 188 BUG_ON(!(__param_##name.perm & 0222)); \
189 __kernel_param_unlock(); \
190 } while (0)
110 191
111#define module_param(name, type, perm) \ 192/**
112 module_param_named(name, name, type, perm) 193 * kparam_block_sysfs_read - make sure a parameter isn't read via sysfs.
194 * @name: the name of the parameter
195 *
196 * This also blocks sysfs writes.
197 */
198#define kparam_block_sysfs_read(name) \
199 do { \
200 BUG_ON(!(__param_##name.perm & 0444)); \
201 __kernel_param_lock(); \
202 } while (0)
203
204/**
205 * kparam_unblock_sysfs_read - allows sysfs to read a parameter again.
206 * @name: the name of the parameter
207 */
208#define kparam_unblock_sysfs_read(name) \
209 do { \
210 BUG_ON(!(__param_##name.perm & 0444)); \
211 __kernel_param_unlock(); \
212 } while (0)
213
214#ifdef CONFIG_SYSFS
215extern void __kernel_param_lock(void);
216extern void __kernel_param_unlock(void);
217#else
218static inline void __kernel_param_lock(void)
219{
220}
221static inline void __kernel_param_unlock(void)
222{
223}
224#endif
113 225
114#ifndef MODULE 226#ifndef MODULE
115/** 227/**
116 * core_param - define a historical core kernel parameter. 228 * core_param - define a historical core kernel parameter.
117 * @name: the name of the cmdline and sysfs parameter (often the same as var) 229 * @name: the name of the cmdline and sysfs parameter (often the same as var)
118 * @var: the variable 230 * @var: the variable
119 * @type: the type (for param_set_##type and param_get_##type) 231 * @type: the type of the parameter
120 * @perm: visibility in sysfs 232 * @perm: visibility in sysfs
121 * 233 *
122 * core_param is just like module_param(), but cannot be modular and 234 * core_param is just like module_param(), but cannot be modular and
@@ -126,23 +238,32 @@ struct kparam_array
126 */ 238 */
127#define core_param(name, var, type, perm) \ 239#define core_param(name, var, type, perm) \
128 param_check_##type(name, &(var)); \ 240 param_check_##type(name, &(var)); \
129 __module_param_call("", name, param_set_##type, param_get_##type, \ 241 __module_param_call("", name, &param_ops_##type, \
130 &var, __same_type(var, bool), perm) 242 &var, __same_type(var, bool), perm)
131#endif /* !MODULE */ 243#endif /* !MODULE */
132 244
133/* Actually copy string: maxlen param is usually sizeof(string). */ 245/**
246 * module_param_string - a char array parameter
247 * @name: the name of the parameter
248 * @string: the string variable
249 * @len: the maximum length of the string, incl. terminator
250 * @perm: visibility in sysfs.
251 *
252 * This actually copies the string when it's set (unlike type charp).
253 * @len is usually just sizeof(string).
254 */
134#define module_param_string(name, string, len, perm) \ 255#define module_param_string(name, string, len, perm) \
135 static const struct kparam_string __param_string_##name \ 256 static const struct kparam_string __param_string_##name \
136 = { len, string }; \ 257 = { len, string }; \
137 __module_param_call(MODULE_PARAM_PREFIX, name, \ 258 __module_param_call(MODULE_PARAM_PREFIX, name, \
138 param_set_copystring, param_get_string, \ 259 &param_ops_string, \
139 .str = &__param_string_##name, 0, perm); \ 260 .str = &__param_string_##name, 0, perm); \
140 __MODULE_PARM_TYPE(name, "string") 261 __MODULE_PARM_TYPE(name, "string")
141 262
142/* Called on module insert or kernel boot */ 263/* Called on module insert or kernel boot */
143extern int parse_args(const char *name, 264extern int parse_args(const char *name,
144 char *args, 265 char *args,
145 struct kernel_param *params, 266 const struct kernel_param *params,
146 unsigned num, 267 unsigned num,
147 int (*unknown)(char *param, char *val)); 268 int (*unknown)(char *param, char *val));
148 269
@@ -162,72 +283,105 @@ static inline void destroy_params(const struct kernel_param *params,
162#define __param_check(name, p, type) \ 283#define __param_check(name, p, type) \
163 static inline type *__check_##name(void) { return(p); } 284 static inline type *__check_##name(void) { return(p); }
164 285
165extern int param_set_byte(const char *val, struct kernel_param *kp); 286extern struct kernel_param_ops param_ops_byte;
166extern int param_get_byte(char *buffer, struct kernel_param *kp); 287extern int param_set_byte(const char *val, const struct kernel_param *kp);
288extern int param_get_byte(char *buffer, const struct kernel_param *kp);
167#define param_check_byte(name, p) __param_check(name, p, unsigned char) 289#define param_check_byte(name, p) __param_check(name, p, unsigned char)
168 290
169extern int param_set_short(const char *val, struct kernel_param *kp); 291extern struct kernel_param_ops param_ops_short;
170extern int param_get_short(char *buffer, struct kernel_param *kp); 292extern int param_set_short(const char *val, const struct kernel_param *kp);
293extern int param_get_short(char *buffer, const struct kernel_param *kp);
171#define param_check_short(name, p) __param_check(name, p, short) 294#define param_check_short(name, p) __param_check(name, p, short)
172 295
173extern int param_set_ushort(const char *val, struct kernel_param *kp); 296extern struct kernel_param_ops param_ops_ushort;
174extern int param_get_ushort(char *buffer, struct kernel_param *kp); 297extern int param_set_ushort(const char *val, const struct kernel_param *kp);
298extern int param_get_ushort(char *buffer, const struct kernel_param *kp);
175#define param_check_ushort(name, p) __param_check(name, p, unsigned short) 299#define param_check_ushort(name, p) __param_check(name, p, unsigned short)
176 300
177extern int param_set_int(const char *val, struct kernel_param *kp); 301extern struct kernel_param_ops param_ops_int;
178extern int param_get_int(char *buffer, struct kernel_param *kp); 302extern int param_set_int(const char *val, const struct kernel_param *kp);
303extern int param_get_int(char *buffer, const struct kernel_param *kp);
179#define param_check_int(name, p) __param_check(name, p, int) 304#define param_check_int(name, p) __param_check(name, p, int)
180 305
181extern int param_set_uint(const char *val, struct kernel_param *kp); 306extern struct kernel_param_ops param_ops_uint;
182extern int param_get_uint(char *buffer, struct kernel_param *kp); 307extern int param_set_uint(const char *val, const struct kernel_param *kp);
308extern int param_get_uint(char *buffer, const struct kernel_param *kp);
183#define param_check_uint(name, p) __param_check(name, p, unsigned int) 309#define param_check_uint(name, p) __param_check(name, p, unsigned int)
184 310
185extern int param_set_long(const char *val, struct kernel_param *kp); 311extern struct kernel_param_ops param_ops_long;
186extern int param_get_long(char *buffer, struct kernel_param *kp); 312extern int param_set_long(const char *val, const struct kernel_param *kp);
313extern int param_get_long(char *buffer, const struct kernel_param *kp);
187#define param_check_long(name, p) __param_check(name, p, long) 314#define param_check_long(name, p) __param_check(name, p, long)
188 315
189extern int param_set_ulong(const char *val, struct kernel_param *kp); 316extern struct kernel_param_ops param_ops_ulong;
190extern int param_get_ulong(char *buffer, struct kernel_param *kp); 317extern int param_set_ulong(const char *val, const struct kernel_param *kp);
318extern int param_get_ulong(char *buffer, const struct kernel_param *kp);
191#define param_check_ulong(name, p) __param_check(name, p, unsigned long) 319#define param_check_ulong(name, p) __param_check(name, p, unsigned long)
192 320
193extern int param_set_charp(const char *val, struct kernel_param *kp); 321extern struct kernel_param_ops param_ops_charp;
194extern int param_get_charp(char *buffer, struct kernel_param *kp); 322extern int param_set_charp(const char *val, const struct kernel_param *kp);
323extern int param_get_charp(char *buffer, const struct kernel_param *kp);
195#define param_check_charp(name, p) __param_check(name, p, char *) 324#define param_check_charp(name, p) __param_check(name, p, char *)
196 325
197/* For historical reasons "bool" parameters can be (unsigned) "int". */ 326/* For historical reasons "bool" parameters can be (unsigned) "int". */
198extern int param_set_bool(const char *val, struct kernel_param *kp); 327extern struct kernel_param_ops param_ops_bool;
199extern int param_get_bool(char *buffer, struct kernel_param *kp); 328extern int param_set_bool(const char *val, const struct kernel_param *kp);
329extern int param_get_bool(char *buffer, const struct kernel_param *kp);
200#define param_check_bool(name, p) \ 330#define param_check_bool(name, p) \
201 static inline void __check_##name(void) \ 331 static inline void __check_##name(void) \
202 { \ 332 { \
203 BUILD_BUG_ON(!__same_type(*(p), bool) && \ 333 BUILD_BUG_ON(!__same_type((p), bool *) && \
204 !__same_type(*(p), unsigned int) && \ 334 !__same_type((p), unsigned int *) && \
205 !__same_type(*(p), int)); \ 335 !__same_type((p), int *)); \
206 } 336 }
207 337
208extern int param_set_invbool(const char *val, struct kernel_param *kp); 338extern struct kernel_param_ops param_ops_invbool;
209extern int param_get_invbool(char *buffer, struct kernel_param *kp); 339extern int param_set_invbool(const char *val, const struct kernel_param *kp);
340extern int param_get_invbool(char *buffer, const struct kernel_param *kp);
210#define param_check_invbool(name, p) __param_check(name, p, bool) 341#define param_check_invbool(name, p) __param_check(name, p, bool)
211 342
212/* Comma-separated array: *nump is set to number they actually specified. */ 343/**
344 * module_param_array - a parameter which is an array of some type
345 * @name: the name of the array variable
346 * @type: the type, as per module_param()
347 * @nump: optional pointer filled in with the number written
348 * @perm: visibility in sysfs
349 *
350 * Input and output are as comma-separated values. Commas inside values
351 * don't work properly (eg. an array of charp).
352 *
353 * ARRAY_SIZE(@name) is used to determine the number of elements in the
354 * array, so the definition must be visible.
355 */
356#define module_param_array(name, type, nump, perm) \
357 module_param_array_named(name, name, type, nump, perm)
358
359/**
360 * module_param_array_named - renamed parameter which is an array of some type
361 * @name: a valid C identifier which is the parameter name
362 * @array: the name of the array variable
363 * @type: the type, as per module_param()
364 * @nump: optional pointer filled in with the number written
365 * @perm: visibility in sysfs
366 *
367 * This exposes a different name than the actual variable name. See
368 * module_param_named() for why this might be necessary.
369 */
213#define module_param_array_named(name, array, type, nump, perm) \ 370#define module_param_array_named(name, array, type, nump, perm) \
214 static const struct kparam_array __param_arr_##name \ 371 static const struct kparam_array __param_arr_##name \
215 = { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type,\ 372 = { ARRAY_SIZE(array), nump, &param_ops_##type, \
216 sizeof(array[0]), array }; \ 373 sizeof(array[0]), array }; \
217 __module_param_call(MODULE_PARAM_PREFIX, name, \ 374 __module_param_call(MODULE_PARAM_PREFIX, name, \
218 param_array_set, param_array_get, \ 375 &param_array_ops, \
219 .arr = &__param_arr_##name, \ 376 .arr = &__param_arr_##name, \
220 __same_type(array[0], bool), perm); \ 377 __same_type(array[0], bool), perm); \
221 __MODULE_PARM_TYPE(name, "array of " #type) 378 __MODULE_PARM_TYPE(name, "array of " #type)
222 379
223#define module_param_array(name, type, nump, perm) \ 380extern struct kernel_param_ops param_array_ops;
224 module_param_array_named(name, name, type, nump, perm)
225
226extern int param_array_set(const char *val, struct kernel_param *kp);
227extern int param_array_get(char *buffer, struct kernel_param *kp);
228 381
229extern int param_set_copystring(const char *val, struct kernel_param *kp); 382extern struct kernel_param_ops param_ops_string;
230extern int param_get_string(char *buffer, struct kernel_param *kp); 383extern int param_set_copystring(const char *val, const struct kernel_param *);
384extern int param_get_string(char *buffer, const struct kernel_param *kp);
231 385
232/* for exporting parameters in /sys/parameters */ 386/* for exporting parameters in /sys/parameters */
233 387
@@ -235,13 +389,13 @@ struct module;
235 389
236#if defined(CONFIG_SYSFS) && defined(CONFIG_MODULES) 390#if defined(CONFIG_SYSFS) && defined(CONFIG_MODULES)
237extern int module_param_sysfs_setup(struct module *mod, 391extern int module_param_sysfs_setup(struct module *mod,
238 struct kernel_param *kparam, 392 const struct kernel_param *kparam,
239 unsigned int num_params); 393 unsigned int num_params);
240 394
241extern void module_param_sysfs_remove(struct module *mod); 395extern void module_param_sysfs_remove(struct module *mod);
242#else 396#else
243static inline int module_param_sysfs_setup(struct module *mod, 397static inline int module_param_sysfs_setup(struct module *mod,
244 struct kernel_param *kparam, 398 const struct kernel_param *kparam,
245 unsigned int num_params) 399 unsigned int num_params)
246{ 400{
247 return 0; 401 return 0;
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 4bd05474d11d..5e7a59408dd4 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -27,7 +27,6 @@ struct mnt_namespace;
27#define MNT_NODIRATIME 0x10 27#define MNT_NODIRATIME 0x10
28#define MNT_RELATIME 0x20 28#define MNT_RELATIME 0x20
29#define MNT_READONLY 0x40 /* does the user want this to be r/o? */ 29#define MNT_READONLY 0x40 /* does the user want this to be r/o? */
30#define MNT_STRICTATIME 0x80
31 30
32#define MNT_SHRINKABLE 0x100 31#define MNT_SHRINKABLE 0x100
33#define MNT_WRITE_HOLD 0x200 32#define MNT_WRITE_HOLD 0x200
@@ -56,7 +55,11 @@ struct vfsmount {
56 struct list_head mnt_mounts; /* list of children, anchored here */ 55 struct list_head mnt_mounts; /* list of children, anchored here */
57 struct list_head mnt_child; /* and going through their mnt_child */ 56 struct list_head mnt_child; /* and going through their mnt_child */
58 int mnt_flags; 57 int mnt_flags;
59 /* 4 bytes hole on 64bits arches */ 58 /* 4 bytes hole on 64bits arches without fsnotify */
59#ifdef CONFIG_FSNOTIFY
60 __u32 mnt_fsnotify_mask;
61 struct hlist_head mnt_fsnotify_marks;
62#endif
60 const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ 63 const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
61 struct list_head mnt_list; 64 struct list_head mnt_list;
62 struct list_head mnt_expire; /* link in fs-specific expiry list */ 65 struct list_head mnt_expire; /* link in fs-specific expiry list */
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 6991ab5b24d1..91b05c171854 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -14,8 +14,10 @@ struct irq_desc;
14extern void mask_msi_irq(unsigned int irq); 14extern void mask_msi_irq(unsigned int irq);
15extern void unmask_msi_irq(unsigned int irq); 15extern void unmask_msi_irq(unsigned int irq);
16extern void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg); 16extern void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg);
17extern void get_cached_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg);
17extern void write_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg); 18extern void write_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg);
18extern void read_msi_msg(unsigned int irq, struct msi_msg *msg); 19extern void read_msi_msg(unsigned int irq, struct msi_msg *msg);
20extern void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg);
19extern void write_msi_msg(unsigned int irq, struct msi_msg *msg); 21extern void write_msi_msg(unsigned int irq, struct msi_msg *msg);
20 22
21struct msi_desc { 23struct msi_desc {
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 9c3757c5759d..7fa20beb2ab9 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -4,12 +4,26 @@
4 * NAND family Bad Block Management (BBM) header file 4 * NAND family Bad Block Management (BBM) header file
5 * - Bad Block Table (BBT) implementation 5 * - Bad Block Table (BBT) implementation
6 * 6 *
7 * Copyright (c) 2005 Samsung Electronics 7 * Copyright © 2005 Samsung Electronics
8 * Kyungmin Park <kyungmin.park@samsung.com> 8 * Kyungmin Park <kyungmin.park@samsung.com>
9 * 9 *
10 * Copyright (c) 2000-2005 10 * Copyright © 2000-2005
11 * Thomas Gleixner <tglx@linuxtronix.de> 11 * Thomas Gleixner <tglx@linuxtronix.de>
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 *
13 */ 27 */
14#ifndef __LINUX_MTD_BBM_H 28#ifndef __LINUX_MTD_BBM_H
15#define __LINUX_MTD_BBM_H 29#define __LINUX_MTD_BBM_H
@@ -82,6 +96,12 @@ struct nand_bbt_descr {
82#define NAND_BBT_SAVECONTENT 0x00002000 96#define NAND_BBT_SAVECONTENT 0x00002000
83/* Search good / bad pattern on the first and the second page */ 97/* Search good / bad pattern on the first and the second page */
84#define NAND_BBT_SCAN2NDPAGE 0x00004000 98#define NAND_BBT_SCAN2NDPAGE 0x00004000
99/* Search good / bad pattern on the last page of the eraseblock */
100#define NAND_BBT_SCANLASTPAGE 0x00008000
101/* Chip stores bad block marker on BOTH 1st and 6th bytes of OOB */
102#define NAND_BBT_SCANBYTE1AND6 0x00100000
103/* The nand_bbt_descr was created dynamicaly and must be freed */
104#define NAND_BBT_DYNAMICSTRUCT 0x00200000
85 105
86/* The maximum number of blocks to scan for a bbt */ 106/* The maximum number of blocks to scan for a bbt */
87#define NAND_BBT_SCAN_MAXBLOCKS 4 107#define NAND_BBT_SCAN_MAXBLOCKS 4
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index b481ccd7ff3c..26529ebd59cc 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -1,7 +1,19 @@
1/* 1/*
2 * (C) 2003 David Woodhouse <dwmw2@infradead.org> 2 * Copyright © 2003-2010 David Woodhouse <dwmw2@infradead.org>
3 * 3 *
4 * Interface to Linux block layer for MTD 'translation layers'. 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
5 * 17 *
6 */ 18 */
7 19
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index 574d9ee066f1..d2118b0eac9a 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -1,6 +1,20 @@
1 1/*
2/* Common Flash Interface structures 2 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org> et al.
3 * See http://support.intel.com/design/flash/technote/index.htm 3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
4 */ 18 */
5 19
6#ifndef __MTD_CFI_H__ 20#ifndef __MTD_CFI_H__
diff --git a/include/linux/mtd/cfi_endian.h b/include/linux/mtd/cfi_endian.h
index d802f7736be3..51cc3f5917a8 100644
--- a/include/linux/mtd/cfi_endian.h
+++ b/include/linux/mtd/cfi_endian.h
@@ -1,3 +1,22 @@
1/*
2 * Copyright © 2001-2010 David Woodhouse <dwmw2@infradead.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 */
19
1#include <asm/byteorder.h> 20#include <asm/byteorder.h>
2 21
3#ifndef CONFIG_MTD_CFI_ADV_OPTIONS 22#ifndef CONFIG_MTD_CFI_ADV_OPTIONS
diff --git a/include/linux/mtd/compatmac.h b/include/linux/mtd/compatmac.h
deleted file mode 100644
index 7d1300d9bd51..000000000000
--- a/include/linux/mtd/compatmac.h
+++ /dev/null
@@ -1,10 +0,0 @@
1
2#ifndef __LINUX_MTD_COMPATMAC_H__
3#define __LINUX_MTD_COMPATMAC_H__
4
5/* Nothing to see here. We write 2.5-compatible code and this
6 file makes it all OK in older kernels, but it's empty in _current_
7 kernels. Include guard just to make GCC ignore it in future inclusions
8 anyway... */
9
10#endif /* __LINUX_MTD_COMPATMAC_H__ */
diff --git a/include/linux/mtd/concat.h b/include/linux/mtd/concat.h
index e80c674daeb3..ccdbe93a909c 100644
--- a/include/linux/mtd/concat.h
+++ b/include/linux/mtd/concat.h
@@ -1,9 +1,22 @@
1/* 1/*
2 * MTD device concatenation layer definitions 2 * MTD device concatenation layer definitions
3 * 3 *
4 * (C) 2002 Robert Kaiser <rkaiser@sysgo.de> 4 * Copyright © 2002 Robert Kaiser <rkaiser@sysgo.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
5 * 19 *
6 * This code is GPL
7 */ 20 */
8 21
9#ifndef MTD_CONCAT_H 22#ifndef MTD_CONCAT_H
diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h
index 0a6d516ab71d..0f6fea73a1f6 100644
--- a/include/linux/mtd/doc2000.h
+++ b/include/linux/mtd/doc2000.h
@@ -1,12 +1,25 @@
1/* 1/*
2 * Linux driver for Disk-On-Chip devices 2 * Linux driver for Disk-On-Chip devices
3 * 3 *
4 * Copyright (C) 1999 Machine Vision Holdings, Inc. 4 * Copyright © 1999 Machine Vision Holdings, Inc.
5 * Copyright (C) 2001-2003 David Woodhouse <dwmw2@infradead.org> 5 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
6 * Copyright (C) 2002-2003 Greg Ungerer <gerg@snapgear.com> 6 * Copyright © 2002-2003 Greg Ungerer <gerg@snapgear.com>
7 * Copyright (C) 2002-2003 SnapGear Inc 7 * Copyright © 2002-2003 SnapGear Inc
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
8 * 22 *
9 * Released under GPL
10 */ 23 */
11 24
12#ifndef __MTD_DOC2000_H__ 25#ifndef __MTD_DOC2000_H__
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h
index f43e9b49b751..b63fa457febd 100644
--- a/include/linux/mtd/flashchip.h
+++ b/include/linux/mtd/flashchip.h
@@ -1,10 +1,21 @@
1
2/* 1/*
3 * struct flchip definition 2 * Copyright © 2000 Red Hat UK Limited
3 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
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.
4 * 14 *
5 * Contains information about the location and state of a given flash device 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
6 * 18 *
7 * (C) 2000 Red Hat. GPLd.
8 */ 19 */
9 20
10#ifndef __MTD_FLASHCHIP_H__ 21#ifndef __MTD_FLASHCHIP_H__
@@ -92,7 +103,7 @@ struct flchip {
92/* This is used to handle contention on write/erase operations 103/* This is used to handle contention on write/erase operations
93 between partitions of the same physical chip. */ 104 between partitions of the same physical chip. */
94struct flchip_shared { 105struct flchip_shared {
95 spinlock_t lock; 106 struct mutex lock;
96 struct flchip *writing; 107 struct flchip *writing;
97 struct flchip *erasing; 108 struct flchip *erasing;
98}; 109};
diff --git a/include/linux/mtd/gen_probe.h b/include/linux/mtd/gen_probe.h
index df362ddf2949..2c456054fded 100644
--- a/include/linux/mtd/gen_probe.h
+++ b/include/linux/mtd/gen_probe.h
@@ -1,6 +1,21 @@
1/* 1/*
2 * (C) 2001, 2001 Red Hat, Inc. 2 * Copyright © 2001 Red Hat UK Limited
3 * GPL'd 3 * Copyright © 2001-2010 David Woodhouse <dwmw2@infradead.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 *
4 */ 19 */
5 20
6#ifndef __LINUX_MTD_GEN_PROBE_H__ 21#ifndef __LINUX_MTD_GEN_PROBE_H__
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index de89eca864ce..a9e6ba46865e 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -1,3 +1,21 @@
1/*
2 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org> et al.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 */
1 19
2/* Overhauled routines for dealing with different mmap regions of flash */ 20/* Overhauled routines for dealing with different mmap regions of flash */
3 21
@@ -9,7 +27,6 @@
9#include <linux/string.h> 27#include <linux/string.h>
10#include <linux/bug.h> 28#include <linux/bug.h>
11 29
12#include <linux/mtd/compatmac.h>
13 30
14#include <asm/unaligned.h> 31#include <asm/unaligned.h>
15#include <asm/system.h> 32#include <asm/system.h>
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 5326435a7571..8485e42a9b09 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -1,7 +1,20 @@
1/* 1/*
2 * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> et al.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3 * 17 *
4 * Released under GPL
5 */ 18 */
6 19
7#ifndef __MTD_MTD_H__ 20#ifndef __MTD_MTD_H__
@@ -13,7 +26,6 @@
13#include <linux/notifier.h> 26#include <linux/notifier.h>
14#include <linux/device.h> 27#include <linux/device.h>
15 28
16#include <linux/mtd/compatmac.h>
17#include <mtd/mtd-abi.h> 29#include <mtd/mtd-abi.h>
18 30
19#include <asm/div64.h> 31#include <asm/div64.h>
@@ -216,6 +228,7 @@ struct mtd_info {
216 /* Chip-supported device locking */ 228 /* Chip-supported device locking */
217 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 229 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
218 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 230 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
231 int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
219 232
220 /* Power Management functions */ 233 /* Power Management functions */
221 int (*suspend) (struct mtd_info *mtd); 234 int (*suspend) (struct mtd_info *mtd);
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index a81b185e23a7..102e12c58cb3 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -1,9 +1,9 @@
1/* 1/*
2 * linux/include/linux/mtd/nand.h 2 * linux/include/linux/mtd/nand.h
3 * 3 *
4 * Copyright (c) 2000 David Woodhouse <dwmw2@infradead.org> 4 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org>
5 * Steven J. Hill <sjhill@realitydiluted.com> 5 * Steven J. Hill <sjhill@realitydiluted.com>
6 * Thomas Gleixner <tglx@linutronix.de> 6 * Thomas Gleixner <tglx@linutronix.de>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -181,8 +181,6 @@ typedef enum {
181#define NAND_NO_READRDY 0x00000100 181#define NAND_NO_READRDY 0x00000100
182/* Chip does not allow subpage writes */ 182/* Chip does not allow subpage writes */
183#define NAND_NO_SUBPAGE_WRITE 0x00000200 183#define NAND_NO_SUBPAGE_WRITE 0x00000200
184/* Chip stores bad block marker on the last page of the eraseblock */
185#define NAND_BB_LAST_PAGE 0x00000400
186 184
187/* Device is one of 'new' xD cards that expose fake nand command set */ 185/* Device is one of 'new' xD cards that expose fake nand command set */
188#define NAND_BROKEN_XD 0x00000400 186#define NAND_BROKEN_XD 0x00000400
diff --git a/include/linux/mtd/nand_ecc.h b/include/linux/mtd/nand_ecc.h
index 41bc013571d0..4d8406c81652 100644
--- a/include/linux/mtd/nand_ecc.h
+++ b/include/linux/mtd/nand_ecc.h
@@ -1,7 +1,9 @@
1/* 1/*
2 * drivers/mtd/nand_ecc.h 2 * drivers/mtd/nand_ecc.h
3 * 3 *
4 * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) 4 * Copyright (C) 2000-2010 Steven J. Hill <sjhill@realitydiluted.com>
5 * David Woodhouse <dwmw2@infradead.org>
6 * Thomas Gleixner <tglx@linutronix.de>
5 * 7 *
6 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
diff --git a/include/linux/mtd/nftl.h b/include/linux/mtd/nftl.h
index dcaf611ed748..b059629e22bc 100644
--- a/include/linux/mtd/nftl.h
+++ b/include/linux/mtd/nftl.h
@@ -1,5 +1,20 @@
1/* 1/*
2 * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
3 */ 18 */
4 19
5#ifndef __MTD_NFTL_H__ 20#ifndef __MTD_NFTL_H__
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index c26ff86ad08a..0c8815bfae1c 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -68,6 +68,7 @@ struct onenand_bufferram {
68 * @write_word: [REPLACEABLE] hardware specific function for write 68 * @write_word: [REPLACEABLE] hardware specific function for write
69 * register of OneNAND 69 * register of OneNAND
70 * @mmcontrol: sync burst read function 70 * @mmcontrol: sync burst read function
71 * @chip_probe: [REPLACEABLE] hardware specific function for chip probe
71 * @block_markbad: function to mark a block as bad 72 * @block_markbad: function to mark a block as bad
72 * @scan_bbt: [REPLACEALBE] hardware specific function for scanning 73 * @scan_bbt: [REPLACEALBE] hardware specific function for scanning
73 * Bad block Table 74 * Bad block Table
@@ -114,6 +115,7 @@ struct onenand_chip {
114 unsigned short (*read_word)(void __iomem *addr); 115 unsigned short (*read_word)(void __iomem *addr);
115 void (*write_word)(unsigned short value, void __iomem *addr); 116 void (*write_word)(unsigned short value, void __iomem *addr);
116 void (*mmcontrol)(struct mtd_info *mtd, int sync_read); 117 void (*mmcontrol)(struct mtd_info *mtd, int sync_read);
118 int (*chip_probe)(struct mtd_info *mtd);
117 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); 119 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
118 int (*scan_bbt)(struct mtd_info *mtd); 120 int (*scan_bbt)(struct mtd_info *mtd);
119 121
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index 76f7cabf07d3..bcfd9f777454 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -25,6 +25,7 @@ struct physmap_flash_data {
25 void (*set_vpp)(struct map_info *, int); 25 void (*set_vpp)(struct map_info *, int);
26 unsigned int nr_parts; 26 unsigned int nr_parts;
27 unsigned int pfow_base; 27 unsigned int pfow_base;
28 char *probe_type;
28 struct mtd_partition *parts; 29 struct mtd_partition *parts;
29}; 30};
30 31
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index 155719dab813..bb58854a8061 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -88,7 +88,7 @@ struct nbd_request {
88 char handle[8]; 88 char handle[8];
89 __be64 from; 89 __be64 from;
90 __be32 len; 90 __be32 len;
91} __attribute__ ((packed)); 91} __packed;
92 92
93/* 93/*
94 * This is the reply packet that nbd-server sends back to the client after 94 * This is the reply packet that nbd-server sends back to the client after
diff --git a/include/linux/ncp.h b/include/linux/ncp.h
index 99f0adeeb3f3..3ace8370e61e 100644
--- a/include/linux/ncp.h
+++ b/include/linux/ncp.h
@@ -27,7 +27,7 @@ struct ncp_request_header {
27 __u8 conn_high; 27 __u8 conn_high;
28 __u8 function; 28 __u8 function;
29 __u8 data[0]; 29 __u8 data[0];
30} __attribute__((packed)); 30} __packed;
31 31
32#define NCP_REPLY (0x3333) 32#define NCP_REPLY (0x3333)
33#define NCP_WATCHDOG (0x3E3E) 33#define NCP_WATCHDOG (0x3E3E)
@@ -42,7 +42,7 @@ struct ncp_reply_header {
42 __u8 completion_code; 42 __u8 completion_code;
43 __u8 connection_state; 43 __u8 connection_state;
44 __u8 data[0]; 44 __u8 data[0];
45} __attribute__((packed)); 45} __packed;
46 46
47#define NCP_VOLNAME_LEN (16) 47#define NCP_VOLNAME_LEN (16)
48#define NCP_NUMBER_OF_VOLUMES (256) 48#define NCP_NUMBER_OF_VOLUMES (256)
@@ -158,7 +158,7 @@ struct nw_info_struct {
158#ifdef __KERNEL__ 158#ifdef __KERNEL__
159 struct nw_nfs_info nfs; 159 struct nw_nfs_info nfs;
160#endif 160#endif
161} __attribute__((packed)); 161} __packed;
162 162
163/* modify mask - use with MODIFY_DOS_INFO structure */ 163/* modify mask - use with MODIFY_DOS_INFO structure */
164#define DM_ATTRIBUTES (cpu_to_le32(0x02)) 164#define DM_ATTRIBUTES (cpu_to_le32(0x02))
@@ -190,12 +190,12 @@ struct nw_modify_dos_info {
190 __u16 inheritanceGrantMask; 190 __u16 inheritanceGrantMask;
191 __u16 inheritanceRevokeMask; 191 __u16 inheritanceRevokeMask;
192 __u32 maximumSpace; 192 __u32 maximumSpace;
193} __attribute__((packed)); 193} __packed;
194 194
195struct nw_search_sequence { 195struct nw_search_sequence {
196 __u8 volNumber; 196 __u8 volNumber;
197 __u32 dirBase; 197 __u32 dirBase;
198 __u32 sequence; 198 __u32 sequence;
199} __attribute__((packed)); 199} __packed;
200 200
201#endif /* _LINUX_NCP_H */ 201#endif /* _LINUX_NCP_H */
diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h
index 5ec9ca671687..8da05bc098ca 100644
--- a/include/linux/ncp_fs_sb.h
+++ b/include/linux/ncp_fs_sb.h
@@ -104,13 +104,13 @@ struct ncp_server {
104 104
105 unsigned int state; /* STREAM only: receiver state */ 105 unsigned int state; /* STREAM only: receiver state */
106 struct { 106 struct {
107 __u32 magic __attribute__((packed)); 107 __u32 magic __packed;
108 __u32 len __attribute__((packed)); 108 __u32 len __packed;
109 __u16 type __attribute__((packed)); 109 __u16 type __packed;
110 __u16 p1 __attribute__((packed)); 110 __u16 p1 __packed;
111 __u16 p2 __attribute__((packed)); 111 __u16 p2 __packed;
112 __u16 p3 __attribute__((packed)); 112 __u16 p3 __packed;
113 __u16 type2 __attribute__((packed)); 113 __u16 type2 __packed;
114 } buf; /* STREAM only: temporary buffer */ 114 } buf; /* STREAM only: temporary buffer */
115 unsigned char* ptr; /* STREAM only: pointer to data */ 115 unsigned char* ptr; /* STREAM only: pointer to data */
116 size_t len; /* STREAM only: length of data to receive */ 116 size_t len; /* STREAM only: length of data to receive */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index b21e4054c12c..46c36ffe20ee 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -54,6 +54,7 @@
54 54
55struct vlan_group; 55struct vlan_group;
56struct netpoll_info; 56struct netpoll_info;
57struct phy_device;
57/* 802.11 specific */ 58/* 802.11 specific */
58struct wireless_dev; 59struct wireless_dev;
59 /* source back-compat hooks */ 60 /* source back-compat hooks */
@@ -65,6 +66,11 @@ struct wireless_dev;
65#define HAVE_FREE_NETDEV /* free_netdev() */ 66#define HAVE_FREE_NETDEV /* free_netdev() */
66#define HAVE_NETDEV_PRIV /* netdev_priv() */ 67#define HAVE_NETDEV_PRIV /* netdev_priv() */
67 68
69/* hardware address assignment types */
70#define NET_ADDR_PERM 0 /* address is permanent (default) */
71#define NET_ADDR_RANDOM 1 /* address is generated randomly */
72#define NET_ADDR_STOLEN 2 /* address is stolen from other device */
73
68/* Backlog congestion levels */ 74/* Backlog congestion levels */
69#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ 75#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
70#define NET_RX_DROP 1 /* packet dropped */ 76#define NET_RX_DROP 1 /* packet dropped */
@@ -159,45 +165,39 @@ static inline bool dev_xmit_complete(int rc)
159#define MAX_HEADER (LL_MAX_HEADER + 48) 165#define MAX_HEADER (LL_MAX_HEADER + 48)
160#endif 166#endif
161 167
162#endif /* __KERNEL__ */
163
164/* 168/*
165 * Network device statistics. Akin to the 2.0 ether stats but 169 * Old network device statistics. Fields are native words
166 * with byte counters. 170 * (unsigned long) so they can be read and written atomically.
167 */ 171 */
168 172
169struct net_device_stats { 173struct net_device_stats {
170 unsigned long rx_packets; /* total packets received */ 174 unsigned long rx_packets;
171 unsigned long tx_packets; /* total packets transmitted */ 175 unsigned long tx_packets;
172 unsigned long rx_bytes; /* total bytes received */ 176 unsigned long rx_bytes;
173 unsigned long tx_bytes; /* total bytes transmitted */ 177 unsigned long tx_bytes;
174 unsigned long rx_errors; /* bad packets received */ 178 unsigned long rx_errors;
175 unsigned long tx_errors; /* packet transmit problems */ 179 unsigned long tx_errors;
176 unsigned long rx_dropped; /* no space in linux buffers */ 180 unsigned long rx_dropped;
177 unsigned long tx_dropped; /* no space available in linux */ 181 unsigned long tx_dropped;
178 unsigned long multicast; /* multicast packets received */ 182 unsigned long multicast;
179 unsigned long collisions; 183 unsigned long collisions;
180
181 /* detailed rx_errors: */
182 unsigned long rx_length_errors; 184 unsigned long rx_length_errors;
183 unsigned long rx_over_errors; /* receiver ring buff overflow */ 185 unsigned long rx_over_errors;
184 unsigned long rx_crc_errors; /* recved pkt with crc error */ 186 unsigned long rx_crc_errors;
185 unsigned long rx_frame_errors; /* recv'd frame alignment error */ 187 unsigned long rx_frame_errors;
186 unsigned long rx_fifo_errors; /* recv'r fifo overrun */ 188 unsigned long rx_fifo_errors;
187 unsigned long rx_missed_errors; /* receiver missed packet */ 189 unsigned long rx_missed_errors;
188
189 /* detailed tx_errors */
190 unsigned long tx_aborted_errors; 190 unsigned long tx_aborted_errors;
191 unsigned long tx_carrier_errors; 191 unsigned long tx_carrier_errors;
192 unsigned long tx_fifo_errors; 192 unsigned long tx_fifo_errors;
193 unsigned long tx_heartbeat_errors; 193 unsigned long tx_heartbeat_errors;
194 unsigned long tx_window_errors; 194 unsigned long tx_window_errors;
195
196 /* for cslip etc */
197 unsigned long rx_compressed; 195 unsigned long rx_compressed;
198 unsigned long tx_compressed; 196 unsigned long tx_compressed;
199}; 197};
200 198
199#endif /* __KERNEL__ */
200
201 201
202/* Media selection options. */ 202/* Media selection options. */
203enum { 203enum {
@@ -381,6 +381,8 @@ enum gro_result {
381}; 381};
382typedef enum gro_result gro_result_t; 382typedef enum gro_result gro_result_t;
383 383
384typedef struct sk_buff *rx_handler_func_t(struct sk_buff *skb);
385
384extern void __napi_schedule(struct napi_struct *n); 386extern void __napi_schedule(struct napi_struct *n);
385 387
386static inline int napi_disable_pending(struct napi_struct *n) 388static inline int napi_disable_pending(struct napi_struct *n)
@@ -504,9 +506,9 @@ struct netdev_queue {
504 * please use this field instead of dev->trans_start 506 * please use this field instead of dev->trans_start
505 */ 507 */
506 unsigned long trans_start; 508 unsigned long trans_start;
507 unsigned long tx_bytes; 509 u64 tx_bytes;
508 unsigned long tx_packets; 510 u64 tx_packets;
509 unsigned long tx_dropped; 511 u64 tx_dropped;
510} ____cacheline_aligned_in_smp; 512} ____cacheline_aligned_in_smp;
511 513
512#ifdef CONFIG_RPS 514#ifdef CONFIG_RPS
@@ -660,10 +662,19 @@ struct netdev_rx_queue {
660 * Callback uses when the transmitter has not made any progress 662 * Callback uses when the transmitter has not made any progress
661 * for dev->watchdog ticks. 663 * for dev->watchdog ticks.
662 * 664 *
665 * struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev,
666 * struct rtnl_link_stats64 *storage);
663 * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 667 * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
664 * Called when a user wants to get the network device usage 668 * Called when a user wants to get the network device usage
665 * statistics. If not defined, the counters in dev->stats will 669 * statistics. Drivers must do one of the following:
666 * be used. 670 * 1. Define @ndo_get_stats64 to fill in a zero-initialised
671 * rtnl_link_stats64 structure passed by the caller.
672 * 2. Define @ndo_get_stats to update a net_device_stats structure
673 * (which should normally be dev->stats) and return a pointer to
674 * it. The structure may be changed asynchronously only if each
675 * field is written atomically.
676 * 3. Update dev->stats asynchronously and atomically, and define
677 * neither operation.
667 * 678 *
668 * void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp); 679 * void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp);
669 * If device support VLAN receive accleration 680 * If device support VLAN receive accleration
@@ -718,6 +729,8 @@ struct net_device_ops {
718 struct neigh_parms *); 729 struct neigh_parms *);
719 void (*ndo_tx_timeout) (struct net_device *dev); 730 void (*ndo_tx_timeout) (struct net_device *dev);
720 731
732 struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev,
733 struct rtnl_link_stats64 *storage);
721 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 734 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
722 735
723 void (*ndo_vlan_rx_register)(struct net_device *dev, 736 void (*ndo_vlan_rx_register)(struct net_device *dev,
@@ -728,6 +741,8 @@ struct net_device_ops {
728 unsigned short vid); 741 unsigned short vid);
729#ifdef CONFIG_NET_POLL_CONTROLLER 742#ifdef CONFIG_NET_POLL_CONTROLLER
730 void (*ndo_poll_controller)(struct net_device *dev); 743 void (*ndo_poll_controller)(struct net_device *dev);
744 int (*ndo_netpoll_setup)(struct net_device *dev,
745 struct netpoll_info *info);
731 void (*ndo_netpoll_cleanup)(struct net_device *dev); 746 void (*ndo_netpoll_cleanup)(struct net_device *dev);
732#endif 747#endif
733 int (*ndo_set_vf_mac)(struct net_device *dev, 748 int (*ndo_set_vf_mac)(struct net_device *dev,
@@ -775,11 +790,11 @@ struct net_device {
775 /* 790 /*
776 * This is the first field of the "visible" part of this structure 791 * This is the first field of the "visible" part of this structure
777 * (i.e. as seen by users in the "Space.c" file). It is the name 792 * (i.e. as seen by users in the "Space.c" file). It is the name
778 * the interface. 793 * of the interface.
779 */ 794 */
780 char name[IFNAMSIZ]; 795 char name[IFNAMSIZ];
781 796
782 struct pm_qos_request_list *pm_qos_req; 797 struct pm_qos_request_list pm_qos_req;
783 798
784 /* device name hash chain */ 799 /* device name hash chain */
785 struct hlist_node name_hlist; 800 struct hlist_node name_hlist;
@@ -847,7 +862,8 @@ struct net_device {
847#define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT) 862#define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT)
848 863
849 /* List of features with software fallbacks. */ 864 /* List of features with software fallbacks. */
850#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6) 865#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \
866 NETIF_F_TSO6 | NETIF_F_UFO)
851 867
852 868
853#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM) 869#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
@@ -908,6 +924,7 @@ struct net_device {
908 924
909 /* Interface address info. */ 925 /* Interface address info. */
910 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ 926 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */
927 unsigned char addr_assign_type; /* hw address assignment type */
911 unsigned char addr_len; /* hardware address length */ 928 unsigned char addr_len; /* hardware address length */
912 unsigned short dev_id; /* for shared network cards */ 929 unsigned short dev_id; /* for shared network cards */
913 930
@@ -957,6 +974,8 @@ struct net_device {
957#endif 974#endif
958 975
959 struct netdev_queue rx_queue; 976 struct netdev_queue rx_queue;
977 rx_handler_func_t *rx_handler;
978 void *rx_handler_data;
960 979
961 struct netdev_queue *_tx ____cacheline_aligned_in_smp; 980 struct netdev_queue *_tx ____cacheline_aligned_in_smp;
962 981
@@ -1024,10 +1043,6 @@ struct net_device {
1024 /* mid-layer private */ 1043 /* mid-layer private */
1025 void *ml_priv; 1044 void *ml_priv;
1026 1045
1027 /* bridge stuff */
1028 struct net_bridge_port *br_port;
1029 /* macvlan */
1030 struct macvlan_port *macvlan_port;
1031 /* GARP */ 1046 /* GARP */
1032 struct garp_port *garp_port; 1047 struct garp_port *garp_port;
1033 1048
@@ -1057,6 +1072,9 @@ struct net_device {
1057#endif 1072#endif
1058 /* n-tuple filter list attached to this device */ 1073 /* n-tuple filter list attached to this device */
1059 struct ethtool_rx_ntuple_list ethtool_ntuple_list; 1074 struct ethtool_rx_ntuple_list ethtool_ntuple_list;
1075
1076 /* phy device may attach itself for hardware timestamping */
1077 struct phy_device *phydev;
1060}; 1078};
1061#define to_net_dev(d) container_of(d, struct net_device, dev) 1079#define to_net_dev(d) container_of(d, struct net_device, dev)
1062 1080
@@ -1087,11 +1105,7 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev,
1087static inline 1105static inline
1088struct net *dev_net(const struct net_device *dev) 1106struct net *dev_net(const struct net_device *dev)
1089{ 1107{
1090#ifdef CONFIG_NET_NS 1108 return read_pnet(&dev->nd_net);
1091 return dev->nd_net;
1092#else
1093 return &init_net;
1094#endif
1095} 1109}
1096 1110
1097static inline 1111static inline
@@ -1272,8 +1286,8 @@ extern void dev_add_pack(struct packet_type *pt);
1272extern void dev_remove_pack(struct packet_type *pt); 1286extern void dev_remove_pack(struct packet_type *pt);
1273extern void __dev_remove_pack(struct packet_type *pt); 1287extern void __dev_remove_pack(struct packet_type *pt);
1274 1288
1275extern struct net_device *dev_get_by_flags(struct net *net, unsigned short flags, 1289extern struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags,
1276 unsigned short mask); 1290 unsigned short mask);
1277extern struct net_device *dev_get_by_name(struct net *net, const char *name); 1291extern struct net_device *dev_get_by_name(struct net *net, const char *name);
1278extern struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); 1292extern struct net_device *dev_get_by_name_rcu(struct net *net, const char *name);
1279extern struct net_device *__dev_get_by_name(struct net *net, const char *name); 1293extern struct net_device *__dev_get_by_name(struct net *net, const char *name);
@@ -1696,6 +1710,11 @@ static inline void napi_free_frags(struct napi_struct *napi)
1696 napi->skb = NULL; 1710 napi->skb = NULL;
1697} 1711}
1698 1712
1713extern int netdev_rx_handler_register(struct net_device *dev,
1714 rx_handler_func_t *rx_handler,
1715 void *rx_handler_data);
1716extern void netdev_rx_handler_unregister(struct net_device *dev);
1717
1699extern void netif_nit_deliver(struct sk_buff *skb); 1718extern void netif_nit_deliver(struct sk_buff *skb);
1700extern int dev_valid_name(const char *name); 1719extern int dev_valid_name(const char *name);
1701extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 1720extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
@@ -1775,6 +1794,8 @@ extern void netif_carrier_on(struct net_device *dev);
1775 1794
1776extern void netif_carrier_off(struct net_device *dev); 1795extern void netif_carrier_off(struct net_device *dev);
1777 1796
1797extern void netif_notify_peers(struct net_device *dev);
1798
1778/** 1799/**
1779 * netif_dormant_on - mark device as dormant. 1800 * netif_dormant_on - mark device as dormant.
1780 * @dev: network device 1801 * @dev: network device
@@ -2119,8 +2140,10 @@ extern void netdev_features_change(struct net_device *dev);
2119/* Load a device via the kmod */ 2140/* Load a device via the kmod */
2120extern void dev_load(struct net *net, const char *name); 2141extern void dev_load(struct net *net, const char *name);
2121extern void dev_mcast_init(void); 2142extern void dev_mcast_init(void);
2122extern const struct net_device_stats *dev_get_stats(struct net_device *dev); 2143extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
2123extern void dev_txq_stats_fold(const struct net_device *dev, struct net_device_stats *stats); 2144 struct rtnl_link_stats64 *storage);
2145extern void dev_txq_stats_fold(const struct net_device *dev,
2146 struct rtnl_link_stats64 *stats);
2124 2147
2125extern int netdev_max_backlog; 2148extern int netdev_max_backlog;
2126extern int netdev_tstamp_prequeue; 2149extern int netdev_tstamp_prequeue;
@@ -2230,25 +2253,23 @@ static inline const char *netdev_name(const struct net_device *dev)
2230 return dev->name; 2253 return dev->name;
2231} 2254}
2232 2255
2233#define netdev_printk(level, netdev, format, args...) \ 2256extern int netdev_printk(const char *level, const struct net_device *dev,
2234 dev_printk(level, (netdev)->dev.parent, \ 2257 const char *format, ...)
2235 "%s: " format, \ 2258 __attribute__ ((format (printf, 3, 4)));
2236 netdev_name(netdev), ##args) 2259extern int netdev_emerg(const struct net_device *dev, const char *format, ...)
2237 2260 __attribute__ ((format (printf, 2, 3)));
2238#define netdev_emerg(dev, format, args...) \ 2261extern int netdev_alert(const struct net_device *dev, const char *format, ...)
2239 netdev_printk(KERN_EMERG, dev, format, ##args) 2262 __attribute__ ((format (printf, 2, 3)));
2240#define netdev_alert(dev, format, args...) \ 2263extern int netdev_crit(const struct net_device *dev, const char *format, ...)
2241 netdev_printk(KERN_ALERT, dev, format, ##args) 2264 __attribute__ ((format (printf, 2, 3)));
2242#define netdev_crit(dev, format, args...) \ 2265extern int netdev_err(const struct net_device *dev, const char *format, ...)
2243 netdev_printk(KERN_CRIT, dev, format, ##args) 2266 __attribute__ ((format (printf, 2, 3)));
2244#define netdev_err(dev, format, args...) \ 2267extern int netdev_warn(const struct net_device *dev, const char *format, ...)
2245 netdev_printk(KERN_ERR, dev, format, ##args) 2268 __attribute__ ((format (printf, 2, 3)));
2246#define netdev_warn(dev, format, args...) \ 2269extern int netdev_notice(const struct net_device *dev, const char *format, ...)
2247 netdev_printk(KERN_WARNING, dev, format, ##args) 2270 __attribute__ ((format (printf, 2, 3)));
2248#define netdev_notice(dev, format, args...) \ 2271extern int netdev_info(const struct net_device *dev, const char *format, ...)
2249 netdev_printk(KERN_NOTICE, dev, format, ##args) 2272 __attribute__ ((format (printf, 2, 3)));
2250#define netdev_info(dev, format, args...) \
2251 netdev_printk(KERN_INFO, dev, format, ##args)
2252 2273
2253#if defined(DEBUG) 2274#if defined(DEBUG)
2254#define netdev_dbg(__dev, format, args...) \ 2275#define netdev_dbg(__dev, format, args...) \
@@ -2296,20 +2317,26 @@ do { \
2296 netdev_printk(level, (dev), fmt, ##args); \ 2317 netdev_printk(level, (dev), fmt, ##args); \
2297} while (0) 2318} while (0)
2298 2319
2320#define netif_level(level, priv, type, dev, fmt, args...) \
2321do { \
2322 if (netif_msg_##type(priv)) \
2323 netdev_##level(dev, fmt, ##args); \
2324} while (0)
2325
2299#define netif_emerg(priv, type, dev, fmt, args...) \ 2326#define netif_emerg(priv, type, dev, fmt, args...) \
2300 netif_printk(priv, type, KERN_EMERG, dev, fmt, ##args) 2327 netif_level(emerg, priv, type, dev, fmt, ##args)
2301#define netif_alert(priv, type, dev, fmt, args...) \ 2328#define netif_alert(priv, type, dev, fmt, args...) \
2302 netif_printk(priv, type, KERN_ALERT, dev, fmt, ##args) 2329 netif_level(alert, priv, type, dev, fmt, ##args)
2303#define netif_crit(priv, type, dev, fmt, args...) \ 2330#define netif_crit(priv, type, dev, fmt, args...) \
2304 netif_printk(priv, type, KERN_CRIT, dev, fmt, ##args) 2331 netif_level(crit, priv, type, dev, fmt, ##args)
2305#define netif_err(priv, type, dev, fmt, args...) \ 2332#define netif_err(priv, type, dev, fmt, args...) \
2306 netif_printk(priv, type, KERN_ERR, dev, fmt, ##args) 2333 netif_level(err, priv, type, dev, fmt, ##args)
2307#define netif_warn(priv, type, dev, fmt, args...) \ 2334#define netif_warn(priv, type, dev, fmt, args...) \
2308 netif_printk(priv, type, KERN_WARNING, dev, fmt, ##args) 2335 netif_level(warn, priv, type, dev, fmt, ##args)
2309#define netif_notice(priv, type, dev, fmt, args...) \ 2336#define netif_notice(priv, type, dev, fmt, args...) \
2310 netif_printk(priv, type, KERN_NOTICE, dev, fmt, ##args) 2337 netif_level(notice, priv, type, dev, fmt, ##args)
2311#define netif_info(priv, type, dev, fmt, args...) \ 2338#define netif_info(priv, type, dev, fmt, args...) \
2312 netif_printk(priv, type, KERN_INFO, (dev), fmt, ##args) 2339 netif_level(info, priv, type, dev, fmt, ##args)
2313 2340
2314#if defined(DEBUG) 2341#if defined(DEBUG)
2315#define netif_dbg(priv, type, dev, format, args...) \ 2342#define netif_dbg(priv, type, dev, format, args...) \
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index 48767cd16453..edeeabdc1500 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -3,11 +3,13 @@ header-y += nf_conntrack_tuple_common.h
3header-y += nfnetlink_conntrack.h 3header-y += nfnetlink_conntrack.h
4header-y += nfnetlink_log.h 4header-y += nfnetlink_log.h
5header-y += nfnetlink_queue.h 5header-y += nfnetlink_queue.h
6header-y += xt_CHECKSUM.h
6header-y += xt_CLASSIFY.h 7header-y += xt_CLASSIFY.h
7header-y += xt_CONNMARK.h 8header-y += xt_CONNMARK.h
8header-y += xt_CONNSECMARK.h 9header-y += xt_CONNSECMARK.h
9header-y += xt_CT.h 10header-y += xt_CT.h
10header-y += xt_DSCP.h 11header-y += xt_DSCP.h
12header-y += xt_IDLETIMER.h
11header-y += xt_LED.h 13header-y += xt_LED.h
12header-y += xt_MARK.h 14header-y += xt_MARK.h
13header-y += xt_NFLOG.h 15header-y += xt_NFLOG.h
@@ -18,17 +20,19 @@ header-y += xt_TCPMSS.h
18header-y += xt_TCPOPTSTRIP.h 20header-y += xt_TCPOPTSTRIP.h
19header-y += xt_TEE.h 21header-y += xt_TEE.h
20header-y += xt_TPROXY.h 22header-y += xt_TPROXY.h
23header-y += xt_cluster.h
21header-y += xt_comment.h 24header-y += xt_comment.h
22header-y += xt_connbytes.h 25header-y += xt_connbytes.h
23header-y += xt_connlimit.h 26header-y += xt_connlimit.h
24header-y += xt_connmark.h 27header-y += xt_connmark.h
25header-y += xt_conntrack.h 28header-y += xt_conntrack.h
26header-y += xt_cluster.h 29header-y += xt_cpu.h
27header-y += xt_dccp.h 30header-y += xt_dccp.h
28header-y += xt_dscp.h 31header-y += xt_dscp.h
29header-y += xt_esp.h 32header-y += xt_esp.h
30header-y += xt_hashlimit.h 33header-y += xt_hashlimit.h
31header-y += xt_iprange.h 34header-y += xt_iprange.h
35header-y += xt_ipvs.h
32header-y += xt_helper.h 36header-y += xt_helper.h
33header-y += xt_length.h 37header-y += xt_length.h
34header-y += xt_limit.h 38header-y += xt_limit.h
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index 14e6d32002c4..1afd18c855ec 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -76,6 +76,10 @@ enum ip_conntrack_status {
76 /* Conntrack is a template */ 76 /* Conntrack is a template */
77 IPS_TEMPLATE_BIT = 11, 77 IPS_TEMPLATE_BIT = 11,
78 IPS_TEMPLATE = (1 << IPS_TEMPLATE_BIT), 78 IPS_TEMPLATE = (1 << IPS_TEMPLATE_BIT),
79
80 /* Conntrack is a fake untracked entry */
81 IPS_UNTRACKED_BIT = 12,
82 IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT),
79}; 83};
80 84
81/* Connection tracking event types */ 85/* Connection tracking event types */
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h
index d3bab7a2c9b7..ea9b8d380527 100644
--- a/include/linux/netfilter/nfnetlink_log.h
+++ b/include/linux/netfilter/nfnetlink_log.h
@@ -89,6 +89,7 @@ enum nfulnl_attr_config {
89#define NFULNL_COPY_NONE 0x00 89#define NFULNL_COPY_NONE 0x00
90#define NFULNL_COPY_META 0x01 90#define NFULNL_COPY_META 0x01
91#define NFULNL_COPY_PACKET 0x02 91#define NFULNL_COPY_PACKET 0x02
92/* 0xff is reserved, don't use it for new copy modes. */
92 93
93#define NFULNL_CFG_F_SEQ 0x0001 94#define NFULNL_CFG_F_SEQ 0x0001
94#define NFULNL_CFG_F_SEQ_GLOBAL 0x0002 95#define NFULNL_CFG_F_SEQ_GLOBAL 0x0002
diff --git a/include/linux/netfilter/xt_CHECKSUM.h b/include/linux/netfilter/xt_CHECKSUM.h
new file mode 100644
index 000000000000..9a2e4661654e
--- /dev/null
+++ b/include/linux/netfilter/xt_CHECKSUM.h
@@ -0,0 +1,20 @@
1/* Header file for iptables ipt_CHECKSUM target
2 *
3 * (C) 2002 by Harald Welte <laforge@gnumonks.org>
4 * (C) 2010 Red Hat Inc
5 * Author: Michael S. Tsirkin <mst@redhat.com>
6 *
7 * This software is distributed under GNU GPL v2, 1991
8*/
9#ifndef _XT_CHECKSUM_TARGET_H
10#define _XT_CHECKSUM_TARGET_H
11
12#include <linux/types.h>
13
14#define XT_CHECKSUM_OP_FILL 0x01 /* fill in checksum in IP header */
15
16struct xt_CHECKSUM_info {
17 __u8 operation; /* bitset of operations */
18};
19
20#endif /* _XT_CHECKSUM_TARGET_H */
diff --git a/include/linux/netfilter/xt_IDLETIMER.h b/include/linux/netfilter/xt_IDLETIMER.h
new file mode 100644
index 000000000000..3e1aa1be942e
--- /dev/null
+++ b/include/linux/netfilter/xt_IDLETIMER.h
@@ -0,0 +1,45 @@
1/*
2 * linux/include/linux/netfilter/xt_IDLETIMER.h
3 *
4 * Header file for Xtables timer target module.
5 *
6 * Copyright (C) 2004, 2010 Nokia Corporation
7 * Written by Timo Teras <ext-timo.teras@nokia.com>
8 *
9 * Converted to x_tables and forward-ported to 2.6.34
10 * by Luciano Coelho <luciano.coelho@nokia.com>
11 *
12 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * version 2 as published by the Free Software Foundation.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26 * 02110-1301 USA
27 */
28
29#ifndef _XT_IDLETIMER_H
30#define _XT_IDLETIMER_H
31
32#include <linux/types.h>
33
34#define MAX_IDLETIMER_LABEL_SIZE 28
35
36struct idletimer_tg_info {
37 __u32 timeout;
38
39 char label[MAX_IDLETIMER_LABEL_SIZE];
40
41 /* for kernel module internal use only */
42 struct idletimer_tg *timer __attribute((aligned(8)));
43};
44
45#endif
diff --git a/include/linux/netfilter/xt_cpu.h b/include/linux/netfilter/xt_cpu.h
new file mode 100644
index 000000000000..93c7f11d8f42
--- /dev/null
+++ b/include/linux/netfilter/xt_cpu.h
@@ -0,0 +1,11 @@
1#ifndef _XT_CPU_H
2#define _XT_CPU_H
3
4#include <linux/types.h>
5
6struct xt_cpu_info {
7 __u32 cpu;
8 __u32 invert;
9};
10
11#endif /*_XT_CPU_H*/
diff --git a/include/linux/netfilter/xt_ipvs.h b/include/linux/netfilter/xt_ipvs.h
new file mode 100644
index 000000000000..1167aeb7a347
--- /dev/null
+++ b/include/linux/netfilter/xt_ipvs.h
@@ -0,0 +1,27 @@
1#ifndef _XT_IPVS_H
2#define _XT_IPVS_H
3
4enum {
5 XT_IPVS_IPVS_PROPERTY = 1 << 0, /* all other options imply this one */
6 XT_IPVS_PROTO = 1 << 1,
7 XT_IPVS_VADDR = 1 << 2,
8 XT_IPVS_VPORT = 1 << 3,
9 XT_IPVS_DIR = 1 << 4,
10 XT_IPVS_METHOD = 1 << 5,
11 XT_IPVS_VPORTCTL = 1 << 6,
12 XT_IPVS_MASK = (1 << 7) - 1,
13 XT_IPVS_ONCE_MASK = XT_IPVS_MASK & ~XT_IPVS_IPVS_PROPERTY
14};
15
16struct xt_ipvs_mtinfo {
17 union nf_inet_addr vaddr, vmask;
18 __be16 vport;
19 __u8 l4proto;
20 __u8 fwd_method;
21 __be16 vportctl;
22
23 __u8 invert;
24 __u8 bitmask;
25};
26
27#endif /* _XT_IPVS_H */
diff --git a/include/linux/netfilter/xt_quota.h b/include/linux/netfilter/xt_quota.h
index 8dc89dfc1361..b0d28c659ab7 100644
--- a/include/linux/netfilter/xt_quota.h
+++ b/include/linux/netfilter/xt_quota.h
@@ -11,9 +11,9 @@ struct xt_quota_priv;
11struct xt_quota_info { 11struct xt_quota_info {
12 u_int32_t flags; 12 u_int32_t flags;
13 u_int32_t pad; 13 u_int32_t pad;
14 aligned_u64 quota;
14 15
15 /* Used internally by the kernel */ 16 /* Used internally by the kernel */
16 aligned_u64 quota;
17 struct xt_quota_priv *master; 17 struct xt_quota_priv *master;
18}; 18};
19 19
diff --git a/include/linux/netfilter_ipv4/ipt_LOG.h b/include/linux/netfilter_ipv4/ipt_LOG.h
index 90fa6525ef9c..dcdbadf9fd4a 100644
--- a/include/linux/netfilter_ipv4/ipt_LOG.h
+++ b/include/linux/netfilter_ipv4/ipt_LOG.h
@@ -7,7 +7,8 @@
7#define IPT_LOG_IPOPT 0x04 /* Log IP options */ 7#define IPT_LOG_IPOPT 0x04 /* Log IP options */
8#define IPT_LOG_UID 0x08 /* Log UID owning local socket */ 8#define IPT_LOG_UID 0x08 /* Log UID owning local socket */
9#define IPT_LOG_NFLOG 0x10 /* Unsupported, don't reuse */ 9#define IPT_LOG_NFLOG 0x10 /* Unsupported, don't reuse */
10#define IPT_LOG_MASK 0x1f 10#define IPT_LOG_MACDECODE 0x20 /* Decode MAC header */
11#define IPT_LOG_MASK 0x2f
11 12
12struct ipt_log_info { 13struct ipt_log_info {
13 unsigned char level; 14 unsigned char level;
diff --git a/include/linux/netfilter_ipv6/ip6t_LOG.h b/include/linux/netfilter_ipv6/ip6t_LOG.h
index 0d0119b0458c..9dd5579e02ec 100644
--- a/include/linux/netfilter_ipv6/ip6t_LOG.h
+++ b/include/linux/netfilter_ipv6/ip6t_LOG.h
@@ -7,7 +7,8 @@
7#define IP6T_LOG_IPOPT 0x04 /* Log IP options */ 7#define IP6T_LOG_IPOPT 0x04 /* Log IP options */
8#define IP6T_LOG_UID 0x08 /* Log UID owning local socket */ 8#define IP6T_LOG_UID 0x08 /* Log UID owning local socket */
9#define IP6T_LOG_NFLOG 0x10 /* Unsupported, don't use */ 9#define IP6T_LOG_NFLOG 0x10 /* Unsupported, don't use */
10#define IP6T_LOG_MASK 0x1f 10#define IP6T_LOG_MACDECODE 0x20 /* Decode MAC header */
11#define IP6T_LOG_MASK 0x2f
11 12
12struct ip6t_log_info { 13struct ip6t_log_info {
13 unsigned char level; 14 unsigned char level;
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index e9e231215865..791d5109f34c 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -46,9 +46,11 @@ void netpoll_poll(struct netpoll *np);
46void netpoll_send_udp(struct netpoll *np, const char *msg, int len); 46void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
47void netpoll_print_options(struct netpoll *np); 47void netpoll_print_options(struct netpoll *np);
48int netpoll_parse_options(struct netpoll *np, char *opt); 48int netpoll_parse_options(struct netpoll *np, char *opt);
49int __netpoll_setup(struct netpoll *np);
49int netpoll_setup(struct netpoll *np); 50int netpoll_setup(struct netpoll *np);
50int netpoll_trap(void); 51int netpoll_trap(void);
51void netpoll_set_trap(int trap); 52void netpoll_set_trap(int trap);
53void __netpoll_cleanup(struct netpoll *np);
52void netpoll_cleanup(struct netpoll *np); 54void netpoll_cleanup(struct netpoll *np);
53int __netpoll_rx(struct sk_buff *skb); 55int __netpoll_rx(struct sk_buff *skb);
54void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb); 56void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb);
@@ -57,12 +59,15 @@ void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb);
57#ifdef CONFIG_NETPOLL 59#ifdef CONFIG_NETPOLL
58static inline bool netpoll_rx(struct sk_buff *skb) 60static inline bool netpoll_rx(struct sk_buff *skb)
59{ 61{
60 struct netpoll_info *npinfo = skb->dev->npinfo; 62 struct netpoll_info *npinfo;
61 unsigned long flags; 63 unsigned long flags;
62 bool ret = false; 64 bool ret = false;
63 65
66 rcu_read_lock_bh();
67 npinfo = rcu_dereference_bh(skb->dev->npinfo);
68
64 if (!npinfo || (list_empty(&npinfo->rx_np) && !npinfo->rx_flags)) 69 if (!npinfo || (list_empty(&npinfo->rx_np) && !npinfo->rx_flags))
65 return false; 70 goto out;
66 71
67 spin_lock_irqsave(&npinfo->rx_lock, flags); 72 spin_lock_irqsave(&npinfo->rx_lock, flags);
68 /* check rx_flags again with the lock held */ 73 /* check rx_flags again with the lock held */
@@ -70,12 +75,14 @@ static inline bool netpoll_rx(struct sk_buff *skb)
70 ret = true; 75 ret = true;
71 spin_unlock_irqrestore(&npinfo->rx_lock, flags); 76 spin_unlock_irqrestore(&npinfo->rx_lock, flags);
72 77
78out:
79 rcu_read_unlock_bh();
73 return ret; 80 return ret;
74} 81}
75 82
76static inline int netpoll_rx_on(struct sk_buff *skb) 83static inline int netpoll_rx_on(struct sk_buff *skb)
77{ 84{
78 struct netpoll_info *npinfo = skb->dev->npinfo; 85 struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo);
79 86
80 return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags); 87 return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags);
81} 88}
@@ -91,7 +98,6 @@ static inline void *netpoll_poll_lock(struct napi_struct *napi)
91{ 98{
92 struct net_device *dev = napi->dev; 99 struct net_device *dev = napi->dev;
93 100
94 rcu_read_lock(); /* deal with race on ->npinfo */
95 if (dev && dev->npinfo) { 101 if (dev && dev->npinfo) {
96 spin_lock(&napi->poll_lock); 102 spin_lock(&napi->poll_lock);
97 napi->poll_owner = smp_processor_id(); 103 napi->poll_owner = smp_processor_id();
@@ -108,11 +114,15 @@ static inline void netpoll_poll_unlock(void *have)
108 napi->poll_owner = -1; 114 napi->poll_owner = -1;
109 spin_unlock(&napi->poll_lock); 115 spin_unlock(&napi->poll_lock);
110 } 116 }
111 rcu_read_unlock(); 117}
118
119static inline int netpoll_tx_running(struct net_device *dev)
120{
121 return irqs_disabled();
112} 122}
113 123
114#else 124#else
115static inline int netpoll_rx(struct sk_buff *skb) 125static inline bool netpoll_rx(struct sk_buff *skb)
116{ 126{
117 return 0; 127 return 0;
118} 128}
@@ -134,6 +144,10 @@ static inline void netpoll_poll_unlock(void *have)
134static inline void netpoll_netdev_init(struct net_device *dev) 144static inline void netpoll_netdev_init(struct net_device *dev)
135{ 145{
136} 146}
147static inline int netpoll_tx_running(struct net_device *dev)
148{
149 return 0;
150}
137#endif 151#endif
138 152
139#endif 153#endif
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 9b8299af3741..07e40c625972 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -523,6 +523,7 @@ enum {
523 NFSPROC4_CLNT_GETACL, 523 NFSPROC4_CLNT_GETACL,
524 NFSPROC4_CLNT_SETACL, 524 NFSPROC4_CLNT_SETACL,
525 NFSPROC4_CLNT_FS_LOCATIONS, 525 NFSPROC4_CLNT_FS_LOCATIONS,
526 NFSPROC4_CLNT_RELEASE_LOCKOWNER,
526 527
527 /* nfs41 */ 528 /* nfs41 */
528 NFSPROC4_CLNT_EXCHANGE_ID, 529 NFSPROC4_CLNT_EXCHANGE_ID,
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index bad4d121b16e..508f8cf6da37 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -72,13 +72,20 @@ struct nfs_access_entry {
72 int mask; 72 int mask;
73}; 73};
74 74
75struct nfs_lock_context {
76 atomic_t count;
77 struct list_head list;
78 struct nfs_open_context *open_context;
79 fl_owner_t lockowner;
80 pid_t pid;
81};
82
75struct nfs4_state; 83struct nfs4_state;
76struct nfs_open_context { 84struct nfs_open_context {
77 atomic_t count; 85 struct nfs_lock_context lock_context;
78 struct path path; 86 struct path path;
79 struct rpc_cred *cred; 87 struct rpc_cred *cred;
80 struct nfs4_state *state; 88 struct nfs4_state *state;
81 fl_owner_t lockowner;
82 fmode_t mode; 89 fmode_t mode;
83 90
84 unsigned long flags; 91 unsigned long flags;
@@ -353,6 +360,8 @@ extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
353extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 360extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
354extern void put_nfs_open_context(struct nfs_open_context *ctx); 361extern void put_nfs_open_context(struct nfs_open_context *ctx);
355extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode); 362extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode);
363extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx);
364extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx);
356extern u64 nfs_compat_user_ino64(u64 fileid); 365extern u64 nfs_compat_user_ino64(u64 fileid);
357extern void nfs_fattr_init(struct nfs_fattr *fattr); 366extern void nfs_fattr_init(struct nfs_fattr *fattr);
358 367
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index d6e10a4c06e5..c82ee7cd6288 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -15,6 +15,7 @@ struct nlm_host;
15struct nfs4_sequence_args; 15struct nfs4_sequence_args;
16struct nfs4_sequence_res; 16struct nfs4_sequence_res;
17struct nfs_server; 17struct nfs_server;
18struct nfs4_minor_version_ops;
18 19
19/* 20/*
20 * The nfs_client identifies our client state to the server. 21 * The nfs_client identifies our client state to the server.
@@ -70,11 +71,7 @@ struct nfs_client {
70 */ 71 */
71 char cl_ipaddr[48]; 72 char cl_ipaddr[48];
72 unsigned char cl_id_uniquifier; 73 unsigned char cl_id_uniquifier;
73 int (* cl_call_sync)(struct nfs_server *server, 74 const struct nfs4_minor_version_ops *cl_mvops;
74 struct rpc_message *msg,
75 struct nfs4_sequence_args *args,
76 struct nfs4_sequence_res *res,
77 int cache_reply);
78#endif /* CONFIG_NFS_V4 */ 75#endif /* CONFIG_NFS_V4 */
79 76
80#ifdef CONFIG_NFS_V4_1 77#ifdef CONFIG_NFS_V4_1
diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h
index 4499016e6d0d..5d59ae861aa6 100644
--- a/include/linux/nfs_mount.h
+++ b/include/linux/nfs_mount.h
@@ -69,5 +69,6 @@ struct nfs_mount_data {
69#define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000 69#define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000
70#define NFS_MOUNT_LOOKUP_CACHE_NONE 0x20000 70#define NFS_MOUNT_LOOKUP_CACHE_NONE 0x20000
71#define NFS_MOUNT_NORESVPORT 0x40000 71#define NFS_MOUNT_NORESVPORT 0x40000
72#define NFS_MOUNT_LEGACY_INTERFACE 0x80000
72 73
73#endif 74#endif
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 3c60685d972b..f8b60e7f4c44 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -39,6 +39,7 @@ struct nfs_page {
39 struct list_head wb_list; /* Defines state of page: */ 39 struct list_head wb_list; /* Defines state of page: */
40 struct page *wb_page; /* page to read in/write out */ 40 struct page *wb_page; /* page to read in/write out */
41 struct nfs_open_context *wb_context; /* File state context info */ 41 struct nfs_open_context *wb_context; /* File state context info */
42 struct nfs_lock_context *wb_lock_context; /* lock context info */
42 atomic_t wb_complete; /* i/os we're waiting for */ 43 atomic_t wb_complete; /* i/os we're waiting for */
43 pgoff_t wb_index; /* Offset >> PAGE_CACHE_SHIFT */ 44 pgoff_t wb_index; /* Offset >> PAGE_CACHE_SHIFT */
44 unsigned int wb_offset, /* Offset & ~PAGE_CACHE_MASK */ 45 unsigned int wb_offset, /* Offset & ~PAGE_CACHE_MASK */
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 51914d7d6cc4..fc461926c412 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -196,8 +196,10 @@ struct nfs_openargs {
196 __u64 clientid; 196 __u64 clientid;
197 __u64 id; 197 __u64 id;
198 union { 198 union {
199 struct iattr * attrs; /* UNCHECKED, GUARDED */ 199 struct {
200 nfs4_verifier verifier; /* EXCLUSIVE */ 200 struct iattr * attrs; /* UNCHECKED, GUARDED */
201 nfs4_verifier verifier; /* EXCLUSIVE */
202 };
201 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */ 203 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
202 fmode_t delegation_type; /* CLAIM_PREVIOUS */ 204 fmode_t delegation_type; /* CLAIM_PREVIOUS */
203 } u; 205 } u;
@@ -313,6 +315,10 @@ struct nfs_lockt_res {
313 struct nfs4_sequence_res seq_res; 315 struct nfs4_sequence_res seq_res;
314}; 316};
315 317
318struct nfs_release_lockowner_args {
319 struct nfs_lowner lock_owner;
320};
321
316struct nfs4_delegreturnargs { 322struct nfs4_delegreturnargs {
317 const struct nfs_fh *fhandle; 323 const struct nfs_fh *fhandle;
318 const nfs4_stateid *stateid; 324 const nfs4_stateid *stateid;
@@ -332,6 +338,7 @@ struct nfs4_delegreturnres {
332struct nfs_readargs { 338struct nfs_readargs {
333 struct nfs_fh * fh; 339 struct nfs_fh * fh;
334 struct nfs_open_context *context; 340 struct nfs_open_context *context;
341 struct nfs_lock_context *lock_context;
335 __u64 offset; 342 __u64 offset;
336 __u32 count; 343 __u32 count;
337 unsigned int pgbase; 344 unsigned int pgbase;
@@ -352,6 +359,7 @@ struct nfs_readres {
352struct nfs_writeargs { 359struct nfs_writeargs {
353 struct nfs_fh * fh; 360 struct nfs_fh * fh;
354 struct nfs_open_context *context; 361 struct nfs_open_context *context;
362 struct nfs_lock_context *lock_context;
355 __u64 offset; 363 __u64 offset;
356 __u32 count; 364 __u32 count;
357 enum nfs3_stable_how stable; 365 enum nfs3_stable_how stable;
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index 8c2c6116e788..f5487b6f91ed 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -160,7 +160,7 @@ struct nilfs_super_root {
160 * struct nilfs_super_block - structure of super block on disk 160 * struct nilfs_super_block - structure of super block on disk
161 */ 161 */
162struct nilfs_super_block { 162struct nilfs_super_block {
163 __le32 s_rev_level; /* Revision level */ 163/*00*/ __le32 s_rev_level; /* Revision level */
164 __le16 s_minor_rev_level; /* minor revision level */ 164 __le16 s_minor_rev_level; /* minor revision level */
165 __le16 s_magic; /* Magic signature */ 165 __le16 s_magic; /* Magic signature */
166 166
@@ -169,50 +169,53 @@ struct nilfs_super_block {
169 is excluded. */ 169 is excluded. */
170 __le16 s_flags; /* flags */ 170 __le16 s_flags; /* flags */
171 __le32 s_crc_seed; /* Seed value of CRC calculation */ 171 __le32 s_crc_seed; /* Seed value of CRC calculation */
172 __le32 s_sum; /* Check sum of super block */ 172/*10*/ __le32 s_sum; /* Check sum of super block */
173 173
174 __le32 s_log_block_size; /* Block size represented as follows 174 __le32 s_log_block_size; /* Block size represented as follows
175 blocksize = 175 blocksize =
176 1 << (s_log_block_size + 10) */ 176 1 << (s_log_block_size + 10) */
177 __le64 s_nsegments; /* Number of segments in filesystem */ 177 __le64 s_nsegments; /* Number of segments in filesystem */
178 __le64 s_dev_size; /* block device size in bytes */ 178/*20*/ __le64 s_dev_size; /* block device size in bytes */
179 __le64 s_first_data_block; /* 1st seg disk block number */ 179 __le64 s_first_data_block; /* 1st seg disk block number */
180 __le32 s_blocks_per_segment; /* number of blocks per full segment */ 180/*30*/ __le32 s_blocks_per_segment; /* number of blocks per full segment */
181 __le32 s_r_segments_percentage; /* Reserved segments percentage */ 181 __le32 s_r_segments_percentage; /* Reserved segments percentage */
182 182
183 __le64 s_last_cno; /* Last checkpoint number */ 183 __le64 s_last_cno; /* Last checkpoint number */
184 __le64 s_last_pseg; /* disk block addr pseg written last */ 184/*40*/ __le64 s_last_pseg; /* disk block addr pseg written last */
185 __le64 s_last_seq; /* seq. number of seg written last */ 185 __le64 s_last_seq; /* seq. number of seg written last */
186 __le64 s_free_blocks_count; /* Free blocks count */ 186/*50*/ __le64 s_free_blocks_count; /* Free blocks count */
187 187
188 __le64 s_ctime; /* Creation time (execution time of 188 __le64 s_ctime; /* Creation time (execution time of
189 newfs) */ 189 newfs) */
190 __le64 s_mtime; /* Mount time */ 190/*60*/ __le64 s_mtime; /* Mount time */
191 __le64 s_wtime; /* Write time */ 191 __le64 s_wtime; /* Write time */
192 __le16 s_mnt_count; /* Mount count */ 192/*70*/ __le16 s_mnt_count; /* Mount count */
193 __le16 s_max_mnt_count; /* Maximal mount count */ 193 __le16 s_max_mnt_count; /* Maximal mount count */
194 __le16 s_state; /* File system state */ 194 __le16 s_state; /* File system state */
195 __le16 s_errors; /* Behaviour when detecting errors */ 195 __le16 s_errors; /* Behaviour when detecting errors */
196 __le64 s_lastcheck; /* time of last check */ 196 __le64 s_lastcheck; /* time of last check */
197 197
198 __le32 s_checkinterval; /* max. time between checks */ 198/*80*/ __le32 s_checkinterval; /* max. time between checks */
199 __le32 s_creator_os; /* OS */ 199 __le32 s_creator_os; /* OS */
200 __le16 s_def_resuid; /* Default uid for reserved blocks */ 200 __le16 s_def_resuid; /* Default uid for reserved blocks */
201 __le16 s_def_resgid; /* Default gid for reserved blocks */ 201 __le16 s_def_resgid; /* Default gid for reserved blocks */
202 __le32 s_first_ino; /* First non-reserved inode */ 202 __le32 s_first_ino; /* First non-reserved inode */
203 203
204 __le16 s_inode_size; /* Size of an inode */ 204/*90*/ __le16 s_inode_size; /* Size of an inode */
205 __le16 s_dat_entry_size; /* Size of a dat entry */ 205 __le16 s_dat_entry_size; /* Size of a dat entry */
206 __le16 s_checkpoint_size; /* Size of a checkpoint */ 206 __le16 s_checkpoint_size; /* Size of a checkpoint */
207 __le16 s_segment_usage_size; /* Size of a segment usage */ 207 __le16 s_segment_usage_size; /* Size of a segment usage */
208 208
209 __u8 s_uuid[16]; /* 128-bit uuid for volume */ 209/*98*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */
210 char s_volume_name[80]; /* volume name */ 210/*A8*/ char s_volume_name[80]; /* volume name */
211 211
212 __le32 s_c_interval; /* Commit interval of segment */ 212/*F8*/ __le32 s_c_interval; /* Commit interval of segment */
213 __le32 s_c_block_max; /* Threshold of data amount for 213 __le32 s_c_block_max; /* Threshold of data amount for
214 the segment construction */ 214 the segment construction */
215 __u32 s_reserved[192]; /* padding to the end of the block */ 215/*100*/ __le64 s_feature_compat; /* Compatible feature set */
216 __le64 s_feature_compat_ro; /* Read-only compatible feature set */
217 __le64 s_feature_incompat; /* Incompatible feature set */
218 __u32 s_reserved[186]; /* padding to the end of the block */
216}; 219};
217 220
218/* 221/*
@@ -228,6 +231,16 @@ struct nilfs_super_block {
228#define NILFS_MINOR_REV 0 /* minor revision */ 231#define NILFS_MINOR_REV 0 /* minor revision */
229 232
230/* 233/*
234 * Feature set definitions
235 *
236 * If there is a bit set in the incompatible feature set that the kernel
237 * doesn't know about, it should refuse to mount the filesystem.
238 */
239#define NILFS_FEATURE_COMPAT_SUPP 0ULL
240#define NILFS_FEATURE_COMPAT_RO_SUPP 0ULL
241#define NILFS_FEATURE_INCOMPAT_SUPP 0ULL
242
243/*
231 * Bytes count of super_block for CRC-calculation 244 * Bytes count of super_block for CRC-calculation
232 */ 245 */
233#define NILFS_SB_BYTES \ 246#define NILFS_SB_BYTES \
@@ -274,6 +287,12 @@ struct nilfs_super_block {
274#define NILFS_NAME_LEN 255 287#define NILFS_NAME_LEN 255
275 288
276/* 289/*
290 * Block size limitations
291 */
292#define NILFS_MIN_BLOCK_SIZE 1024
293#define NILFS_MAX_BLOCK_SIZE 65536
294
295/*
277 * The new version of the directory entry. Since V0 structures are 296 * The new version of the directory entry. Since V0 structures are
278 * stored in intel byte order, and the name_len field could never be 297 * stored in intel byte order, and the name_len field could never be
279 * bigger than 255 chars, it's safe to reclaim the extra byte for the 298 * bigger than 255 chars, it's safe to reclaim the extra byte for the
@@ -313,7 +332,25 @@ enum {
313#define NILFS_DIR_ROUND (NILFS_DIR_PAD - 1) 332#define NILFS_DIR_ROUND (NILFS_DIR_PAD - 1)
314#define NILFS_DIR_REC_LEN(name_len) (((name_len) + 12 + NILFS_DIR_ROUND) & \ 333#define NILFS_DIR_REC_LEN(name_len) (((name_len) + 12 + NILFS_DIR_ROUND) & \
315 ~NILFS_DIR_ROUND) 334 ~NILFS_DIR_ROUND)
335#define NILFS_MAX_REC_LEN ((1<<16)-1)
316 336
337static inline unsigned nilfs_rec_len_from_disk(__le16 dlen)
338{
339 unsigned len = le16_to_cpu(dlen);
340
341 if (len == NILFS_MAX_REC_LEN)
342 return 1 << 16;
343 return len;
344}
345
346static inline __le16 nilfs_rec_len_to_disk(unsigned len)
347{
348 if (len == (1 << 16))
349 return cpu_to_le16(NILFS_MAX_REC_LEN);
350 else if (len > (1 << 16))
351 BUG();
352 return cpu_to_le16(len);
353}
317 354
318/** 355/**
319 * struct nilfs_finfo - file information 356 * struct nilfs_finfo - file information
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index b7c77f9712f4..2c8701687336 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -132,7 +132,7 @@
132 * %NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN and 132 * %NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN and
133 * %NL80211_ATTR_REG_RULE_POWER_MAX_EIRP. 133 * %NL80211_ATTR_REG_RULE_POWER_MAX_EIRP.
134 * @NL80211_CMD_REQ_SET_REG: ask the wireless core to set the regulatory domain 134 * @NL80211_CMD_REQ_SET_REG: ask the wireless core to set the regulatory domain
135 * to the the specified ISO/IEC 3166-1 alpha2 country code. The core will 135 * to the specified ISO/IEC 3166-1 alpha2 country code. The core will
136 * store this as a valid request and then query userspace for it. 136 * store this as a valid request and then query userspace for it.
137 * 137 *
138 * @NL80211_CMD_GET_MESH_PARAMS: Get mesh networking properties for the 138 * @NL80211_CMD_GET_MESH_PARAMS: Get mesh networking properties for the
@@ -725,6 +725,12 @@ enum nl80211_commands {
725 * @NL80211_ATTR_AP_ISOLATE: (AP mode) Do not forward traffic between stations 725 * @NL80211_ATTR_AP_ISOLATE: (AP mode) Do not forward traffic between stations
726 * connected to this BSS. 726 * connected to this BSS.
727 * 727 *
728 * @NL80211_ATTR_WIPHY_TX_POWER_SETTING: Transmit power setting type. See
729 * &enum nl80211_tx_power_setting for possible values.
730 * @NL80211_ATTR_WIPHY_TX_POWER_LEVEL: Transmit power level in signed mBm units.
731 * This is used in association with @NL80211_ATTR_WIPHY_TX_POWER_SETTING
732 * for non-automatic settings.
733 *
728 * @NL80211_ATTR_MAX: highest attribute number currently defined 734 * @NL80211_ATTR_MAX: highest attribute number currently defined
729 * @__NL80211_ATTR_AFTER_LAST: internal use 735 * @__NL80211_ATTR_AFTER_LAST: internal use
730 */ 736 */
@@ -882,6 +888,9 @@ enum nl80211_attrs {
882 888
883 NL80211_ATTR_AP_ISOLATE, 889 NL80211_ATTR_AP_ISOLATE,
884 890
891 NL80211_ATTR_WIPHY_TX_POWER_SETTING,
892 NL80211_ATTR_WIPHY_TX_POWER_LEVEL,
893
885 /* add attributes here, update the policy in nl80211.c */ 894 /* add attributes here, update the policy in nl80211.c */
886 895
887 __NL80211_ATTR_AFTER_LAST, 896 __NL80211_ATTR_AFTER_LAST,
@@ -1659,4 +1668,17 @@ enum nl80211_cqm_rssi_threshold_event {
1659 NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH, 1668 NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
1660}; 1669};
1661 1670
1671
1672/**
1673 * enum nl80211_tx_power_setting - TX power adjustment
1674 * @NL80211_TX_POWER_AUTOMATIC: automatically determine transmit power
1675 * @NL80211_TX_POWER_LIMITED: limit TX power by the mBm parameter
1676 * @NL80211_TX_POWER_FIXED: fix TX power to the mBm parameter
1677 */
1678enum nl80211_tx_power_setting {
1679 NL80211_TX_POWER_AUTOMATIC,
1680 NL80211_TX_POWER_LIMITED,
1681 NL80211_TX_POWER_FIXED,
1682};
1683
1662#endif /* __LINUX_NL80211_H */ 1684#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index b752e807adde..06aab5eee134 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -20,10 +20,14 @@ extern void touch_nmi_watchdog(void);
20extern void acpi_nmi_disable(void); 20extern void acpi_nmi_disable(void);
21extern void acpi_nmi_enable(void); 21extern void acpi_nmi_enable(void);
22#else 22#else
23#ifndef CONFIG_HARDLOCKUP_DETECTOR
23static inline void touch_nmi_watchdog(void) 24static inline void touch_nmi_watchdog(void)
24{ 25{
25 touch_softlockup_watchdog(); 26 touch_softlockup_watchdog();
26} 27}
28#else
29extern void touch_nmi_watchdog(void);
30#endif
27static inline void acpi_nmi_disable(void) { } 31static inline void acpi_nmi_disable(void) { }
28static inline void acpi_nmi_enable(void) { } 32static inline void acpi_nmi_enable(void) { }
29#endif 33#endif
@@ -47,4 +51,13 @@ static inline bool trigger_all_cpu_backtrace(void)
47} 51}
48#endif 52#endif
49 53
54#ifdef CONFIG_LOCKUP_DETECTOR
55int hw_nmi_is_cpu_stuck(struct pt_regs *);
56u64 hw_nmi_get_sample_period(void);
57extern int watchdog_enabled;
58struct ctl_table;
59extern int proc_dowatchdog_enabled(struct ctl_table *, int ,
60 void __user *, size_t *, loff_t *);
61#endif
62
50#endif 63#endif
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 540703b555cb..b2f1a4d83550 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -210,6 +210,7 @@ static inline int notifier_to_errno(int ret)
210#define NETDEV_POST_INIT 0x0010 210#define NETDEV_POST_INIT 0x0010
211#define NETDEV_UNREGISTER_BATCH 0x0011 211#define NETDEV_UNREGISTER_BATCH 0x0011
212#define NETDEV_BONDING_DESLAVE 0x0012 212#define NETDEV_BONDING_DESLAVE 0x0012
213#define NETDEV_NOTIFY_PEERS 0x0013
213 214
214#define SYS_DOWN 0x0001 /* Notify of system down */ 215#define SYS_DOWN 0x0001 /* Notify of system down */
215#define SYS_RESTART SYS_DOWN 216#define SYS_RESTART SYS_DOWN
diff --git a/include/linux/of.h b/include/linux/of.h
index a367e19bb3af..cad7cf0ab278 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -70,6 +70,11 @@ extern struct device_node *allnodes;
70extern struct device_node *of_chosen; 70extern struct device_node *of_chosen;
71extern rwlock_t devtree_lock; 71extern rwlock_t devtree_lock;
72 72
73static inline bool of_node_is_root(const struct device_node *node)
74{
75 return node && (node->parent == NULL);
76}
77
73static inline int of_node_check_flag(struct device_node *n, unsigned long flag) 78static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
74{ 79{
75 return test_bit(flag, &n->_flags); 80 return test_bit(flag, &n->_flags);
@@ -141,6 +146,11 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
141 146
142#define OF_BAD_ADDR ((u64)-1) 147#define OF_BAD_ADDR ((u64)-1)
143 148
149#ifndef of_node_to_nid
150static inline int of_node_to_nid(struct device_node *np) { return -1; }
151#define of_node_to_nid of_node_to_nid
152#endif
153
144extern struct device_node *of_find_node_by_name(struct device_node *from, 154extern struct device_node *of_find_node_by_name(struct device_node *from,
145 const char *name); 155 const char *name);
146#define for_each_node_by_name(dn, name) \ 156#define for_each_node_by_name(dn, name) \
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
new file mode 100644
index 000000000000..8aea06f0564c
--- /dev/null
+++ b/include/linux/of_address.h
@@ -0,0 +1,44 @@
1#ifndef __OF_ADDRESS_H
2#define __OF_ADDRESS_H
3#include <linux/ioport.h>
4#include <linux/of.h>
5
6extern u64 of_translate_address(struct device_node *np, const u32 *addr);
7extern int of_address_to_resource(struct device_node *dev, int index,
8 struct resource *r);
9extern void __iomem *of_iomap(struct device_node *device, int index);
10
11/* Extract an address from a device, returns the region size and
12 * the address space flags too. The PCI version uses a BAR number
13 * instead of an absolute index
14 */
15extern const u32 *of_get_address(struct device_node *dev, int index,
16 u64 *size, unsigned int *flags);
17
18#ifndef pci_address_to_pio
19static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
20#define pci_address_to_pio pci_address_to_pio
21#endif
22
23#ifdef CONFIG_PCI
24extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
25 u64 *size, unsigned int *flags);
26extern int of_pci_address_to_resource(struct device_node *dev, int bar,
27 struct resource *r);
28#else /* CONFIG_PCI */
29static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
30 struct resource *r)
31{
32 return -ENOSYS;
33}
34
35static inline const u32 *of_get_pci_address(struct device_node *dev,
36 int bar_no, u64 *size, unsigned int *flags)
37{
38 return NULL;
39}
40#endif /* CONFIG_PCI */
41
42
43#endif /* __OF_ADDRESS_H */
44
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 11651facc5f1..835f85ecd2de 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -1,32 +1,61 @@
1#ifndef _LINUX_OF_DEVICE_H 1#ifndef _LINUX_OF_DEVICE_H
2#define _LINUX_OF_DEVICE_H 2#define _LINUX_OF_DEVICE_H
3 3
4#include <linux/platform_device.h>
5#include <linux/of_platform.h> /* temporary until merge */
6
4#ifdef CONFIG_OF_DEVICE 7#ifdef CONFIG_OF_DEVICE
5#include <linux/device.h> 8#include <linux/device.h>
6#include <linux/of.h> 9#include <linux/of.h>
7#include <linux/mod_devicetable.h> 10#include <linux/mod_devicetable.h>
8 11
9#include <asm/of_device.h>
10
11#define to_of_device(d) container_of(d, struct of_device, dev)
12
13extern const struct of_device_id *of_match_device( 12extern const struct of_device_id *of_match_device(
14 const struct of_device_id *matches, const struct device *dev); 13 const struct of_device_id *matches, const struct device *dev);
14extern void of_device_make_bus_id(struct device *dev);
15
16/**
17 * of_driver_match_device - Tell if a driver's of_match_table matches a device.
18 * @drv: the device_driver structure to test
19 * @dev: the device structure to match against
20 */
21static inline int of_driver_match_device(const struct device *dev,
22 const struct device_driver *drv)
23{
24 return of_match_device(drv->of_match_table, dev) != NULL;
25}
15 26
16extern struct of_device *of_dev_get(struct of_device *dev); 27extern struct platform_device *of_dev_get(struct platform_device *dev);
17extern void of_dev_put(struct of_device *dev); 28extern void of_dev_put(struct platform_device *dev);
18 29
19extern int of_device_register(struct of_device *ofdev); 30extern int of_device_register(struct platform_device *ofdev);
20extern void of_device_unregister(struct of_device *ofdev); 31extern void of_device_unregister(struct platform_device *ofdev);
21extern void of_release_dev(struct device *dev); 32extern void of_release_dev(struct device *dev);
22 33
23static inline void of_device_free(struct of_device *dev) 34static inline void of_device_free(struct platform_device *dev)
24{ 35{
25 of_release_dev(&dev->dev); 36 of_release_dev(&dev->dev);
26} 37}
27 38
28extern ssize_t of_device_get_modalias(struct of_device *ofdev, 39extern ssize_t of_device_get_modalias(struct device *dev,
29 char *str, ssize_t len); 40 char *str, ssize_t len);
41
42extern int of_device_uevent(struct device *dev, struct kobj_uevent_env *env);
43
44
45#else /* CONFIG_OF_DEVICE */
46
47static inline int of_driver_match_device(struct device *dev,
48 struct device_driver *drv)
49{
50 return 0;
51}
52
53static inline int of_device_uevent(struct device *dev,
54 struct kobj_uevent_env *env)
55{
56 return -ENODEV;
57}
58
30#endif /* CONFIG_OF_DEVICE */ 59#endif /* CONFIG_OF_DEVICE */
31 60
32#endif /* _LINUX_OF_DEVICE_H */ 61#endif /* _LINUX_OF_DEVICE_H */
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index fc2472c3c254..6598c04dab01 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -33,34 +33,17 @@ enum of_gpio_flags {
33#ifdef CONFIG_OF_GPIO 33#ifdef CONFIG_OF_GPIO
34 34
35/* 35/*
36 * Generic OF GPIO chip
37 */
38struct of_gpio_chip {
39 struct gpio_chip gc;
40 int gpio_cells;
41 int (*xlate)(struct of_gpio_chip *of_gc, struct device_node *np,
42 const void *gpio_spec, enum of_gpio_flags *flags);
43};
44
45static inline struct of_gpio_chip *to_of_gpio_chip(struct gpio_chip *gc)
46{
47 return container_of(gc, struct of_gpio_chip, gc);
48}
49
50/*
51 * OF GPIO chip for memory mapped banks 36 * OF GPIO chip for memory mapped banks
52 */ 37 */
53struct of_mm_gpio_chip { 38struct of_mm_gpio_chip {
54 struct of_gpio_chip of_gc; 39 struct gpio_chip gc;
55 void (*save_regs)(struct of_mm_gpio_chip *mm_gc); 40 void (*save_regs)(struct of_mm_gpio_chip *mm_gc);
56 void __iomem *regs; 41 void __iomem *regs;
57}; 42};
58 43
59static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc) 44static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc)
60{ 45{
61 struct of_gpio_chip *of_gc = to_of_gpio_chip(gc); 46 return container_of(gc, struct of_mm_gpio_chip, gc);
62
63 return container_of(of_gc, struct of_mm_gpio_chip, of_gc);
64} 47}
65 48
66extern int of_get_gpio_flags(struct device_node *np, int index, 49extern int of_get_gpio_flags(struct device_node *np, int index,
@@ -69,11 +52,12 @@ extern unsigned int of_gpio_count(struct device_node *np);
69 52
70extern int of_mm_gpiochip_add(struct device_node *np, 53extern int of_mm_gpiochip_add(struct device_node *np,
71 struct of_mm_gpio_chip *mm_gc); 54 struct of_mm_gpio_chip *mm_gc);
72extern int of_gpio_simple_xlate(struct of_gpio_chip *of_gc, 55
73 struct device_node *np, 56extern void of_gpiochip_add(struct gpio_chip *gc);
74 const void *gpio_spec, 57extern void of_gpiochip_remove(struct gpio_chip *gc);
75 enum of_gpio_flags *flags); 58extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np);
76#else 59
60#else /* CONFIG_OF_GPIO */
77 61
78/* Drivers may not strictly depend on the GPIO support, so let them link. */ 62/* Drivers may not strictly depend on the GPIO support, so let them link. */
79static inline int of_get_gpio_flags(struct device_node *np, int index, 63static inline int of_get_gpio_flags(struct device_node *np, int index,
@@ -87,6 +71,9 @@ static inline unsigned int of_gpio_count(struct device_node *np)
87 return 0; 71 return 0;
88} 72}
89 73
74static inline void of_gpiochip_add(struct gpio_chip *gc) { }
75static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
76
90#endif /* CONFIG_OF_GPIO */ 77#endif /* CONFIG_OF_GPIO */
91 78
92/** 79/**
diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h
index 34974b5a76f7..0efe8d465f55 100644
--- a/include/linux/of_i2c.h
+++ b/include/linux/of_i2c.h
@@ -12,12 +12,19 @@
12#ifndef __LINUX_OF_I2C_H 12#ifndef __LINUX_OF_I2C_H
13#define __LINUX_OF_I2C_H 13#define __LINUX_OF_I2C_H
14 14
15#if defined(CONFIG_OF_I2C) || defined(CONFIG_OF_I2C_MODULE)
15#include <linux/i2c.h> 16#include <linux/i2c.h>
16 17
17void of_register_i2c_devices(struct i2c_adapter *adap, 18extern void of_i2c_register_devices(struct i2c_adapter *adap);
18 struct device_node *adap_node);
19 19
20/* must call put_device() when done with returned i2c_client device */ 20/* must call put_device() when done with returned i2c_client device */
21struct i2c_client *of_find_i2c_device_by_node(struct device_node *node); 21extern struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
22
23#else
24static inline void of_i2c_register_devices(struct i2c_adapter *adap)
25{
26 return;
27}
28#endif /* CONFIG_OF_I2C */
22 29
23#endif /* __LINUX_OF_I2C_H */ 30#endif /* __LINUX_OF_I2C_H */
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
new file mode 100644
index 000000000000..5929781c104d
--- /dev/null
+++ b/include/linux/of_irq.h
@@ -0,0 +1,70 @@
1#ifndef __OF_IRQ_H
2#define __OF_IRQ_H
3
4#if defined(CONFIG_OF)
5struct of_irq;
6#include <linux/types.h>
7#include <linux/errno.h>
8#include <linux/ioport.h>
9#include <linux/of.h>
10
11/*
12 * irq_of_parse_and_map() is used ba all OF enabled platforms; but SPARC
13 * implements it differently. However, the prototype is the same for all,
14 * so declare it here regardless of the CONFIG_OF_IRQ setting.
15 */
16extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
17
18#if defined(CONFIG_OF_IRQ)
19/**
20 * of_irq - container for device_node/irq_specifier pair for an irq controller
21 * @controller: pointer to interrupt controller device tree node
22 * @size: size of interrupt specifier
23 * @specifier: array of cells @size long specifing the specific interrupt
24 *
25 * This structure is returned when an interrupt is mapped. The controller
26 * field needs to be put() after use
27 */
28#define OF_MAX_IRQ_SPEC 4 /* We handle specifiers of at most 4 cells */
29struct of_irq {
30 struct device_node *controller; /* Interrupt controller node */
31 u32 size; /* Specifier size */
32 u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
33};
34
35/*
36 * Workarounds only applied to 32bit powermac machines
37 */
38#define OF_IMAP_OLDWORLD_MAC 0x00000001
39#define OF_IMAP_NO_PHANDLE 0x00000002
40
41#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC)
42extern unsigned int of_irq_workarounds;
43extern struct device_node *of_irq_dflt_pic;
44extern int of_irq_map_oldworld(struct device_node *device, int index,
45 struct of_irq *out_irq);
46#else /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
47#define of_irq_workarounds (0)
48#define of_irq_dflt_pic (NULL)
49static inline int of_irq_map_oldworld(struct device_node *device, int index,
50 struct of_irq *out_irq)
51{
52 return -EINVAL;
53}
54#endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
55
56
57extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
58 u32 ointsize, const u32 *addr,
59 struct of_irq *out_irq);
60extern int of_irq_map_one(struct device_node *device, int index,
61 struct of_irq *out_irq);
62extern unsigned int irq_create_of_mapping(struct device_node *controller,
63 const u32 *intspec,
64 unsigned int intsize);
65extern int of_irq_to_resource(struct device_node *dev, int index,
66 struct resource *r);
67
68#endif /* CONFIG_OF_IRQ */
69#endif /* CONFIG_OF */
70#endif /* __OF_IRQ_H */
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 1643d3761eb4..a68716ad38ce 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -17,29 +17,32 @@
17#include <linux/mod_devicetable.h> 17#include <linux/mod_devicetable.h>
18#include <linux/pm.h> 18#include <linux/pm.h>
19#include <linux/of_device.h> 19#include <linux/of_device.h>
20#include <linux/platform_device.h>
20 21
21/* 22/**
22 * The of_platform_bus_type is a bus type used by drivers that do not 23 * of_platform_driver - Legacy of-aware driver for platform devices.
23 * attach to a macio or similar bus but still use OF probing 24 *
24 * mechanism 25 * An of_platform_driver driver is attached to a basic platform_device on
25 */ 26 * ether the "platform bus" (platform_bus_type), or the ibm ebus
26extern struct bus_type of_platform_bus_type; 27 * (ibmebus_bus_type).
27 28 *
28/* 29 * of_platform_driver is being phased out when used with the platform_bus_type,
29 * An of_platform_driver driver is attached to a basic of_device on 30 * and regular platform_drivers should be used instead. When the transition
30 * the "platform bus" (of_platform_bus_type). 31 * is complete, only ibmebus will be using this structure, and the
32 * platform_driver member of this structure will be removed.
31 */ 33 */
32struct of_platform_driver 34struct of_platform_driver
33{ 35{
34 int (*probe)(struct of_device* dev, 36 int (*probe)(struct platform_device* dev,
35 const struct of_device_id *match); 37 const struct of_device_id *match);
36 int (*remove)(struct of_device* dev); 38 int (*remove)(struct platform_device* dev);
37 39
38 int (*suspend)(struct of_device* dev, pm_message_t state); 40 int (*suspend)(struct platform_device* dev, pm_message_t state);
39 int (*resume)(struct of_device* dev); 41 int (*resume)(struct platform_device* dev);
40 int (*shutdown)(struct of_device* dev); 42 int (*shutdown)(struct platform_device* dev);
41 43
42 struct device_driver driver; 44 struct device_driver driver;
45 struct platform_driver platform_driver;
43}; 46};
44#define to_of_platform_driver(drv) \ 47#define to_of_platform_driver(drv) \
45 container_of(drv,struct of_platform_driver, driver) 48 container_of(drv,struct of_platform_driver, driver)
@@ -49,20 +52,30 @@ extern int of_register_driver(struct of_platform_driver *drv,
49extern void of_unregister_driver(struct of_platform_driver *drv); 52extern void of_unregister_driver(struct of_platform_driver *drv);
50 53
51/* Platform drivers register/unregister */ 54/* Platform drivers register/unregister */
52static inline int of_register_platform_driver(struct of_platform_driver *drv) 55extern int of_register_platform_driver(struct of_platform_driver *drv);
53{ 56extern void of_unregister_platform_driver(struct of_platform_driver *drv);
54 return of_register_driver(drv, &of_platform_bus_type);
55}
56static inline void of_unregister_platform_driver(struct of_platform_driver *drv)
57{
58 of_unregister_driver(drv);
59}
60
61#include <asm/of_platform.h>
62 57
63extern struct of_device *of_find_device_by_node(struct device_node *np); 58extern struct platform_device *of_device_alloc(struct device_node *np,
59 const char *bus_id,
60 struct device *parent);
61extern struct platform_device *of_find_device_by_node(struct device_node *np);
64 62
65extern int of_bus_type_init(struct bus_type *bus, const char *name); 63extern int of_bus_type_init(struct bus_type *bus, const char *name);
64
65#if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */
66/* Platform devices and busses creation */
67extern struct platform_device *of_platform_device_create(struct device_node *np,
68 const char *bus_id,
69 struct device *parent);
70
71/* pseudo "matches" value to not do deep probe */
72#define OF_NO_DEEP_PROBE ((struct of_device_id *)-1)
73
74extern int of_platform_bus_probe(struct device_node *root,
75 const struct of_device_id *matches,
76 struct device *parent);
77#endif /* !CONFIG_SPARC */
78
66#endif /* CONFIG_OF_DEVICE */ 79#endif /* CONFIG_OF_DEVICE */
67 80
68#endif /* _LINUX_OF_PLATFORM_H */ 81#endif /* _LINUX_OF_PLATFORM_H */
diff --git a/include/linux/of_spi.h b/include/linux/of_spi.h
index 5f71ee8c0868..9e3e70f78ae6 100644
--- a/include/linux/of_spi.h
+++ b/include/linux/of_spi.h
@@ -9,10 +9,15 @@
9#ifndef __LINUX_OF_SPI_H 9#ifndef __LINUX_OF_SPI_H
10#define __LINUX_OF_SPI_H 10#define __LINUX_OF_SPI_H
11 11
12#include <linux/of.h>
13#include <linux/spi/spi.h> 12#include <linux/spi/spi.h>
14 13
15extern void of_register_spi_devices(struct spi_master *master, 14#if defined(CONFIG_OF_SPI) || defined(CONFIG_OF_SPI_MODULE)
16 struct device_node *np); 15extern void of_register_spi_devices(struct spi_master *master);
16#else
17static inline void of_register_spi_devices(struct spi_master *master)
18{
19 return;
20}
21#endif /* CONFIG_OF_SPI */
17 22
18#endif /* __LINUX_OF_SPI */ 23#endif /* __LINUX_OF_SPI */
diff --git a/include/linux/omapfb.h b/include/linux/omapfb.h
index 9bdd91486b49..c0b018790f07 100644
--- a/include/linux/omapfb.h
+++ b/include/linux/omapfb.h
@@ -85,6 +85,9 @@
85#define OMAPFB_MEMTYPE_SRAM 1 85#define OMAPFB_MEMTYPE_SRAM 1
86#define OMAPFB_MEMTYPE_MAX 1 86#define OMAPFB_MEMTYPE_MAX 1
87 87
88#define OMAPFB_MEM_IDX_ENABLED 0x80
89#define OMAPFB_MEM_IDX_MASK 0x7f
90
88enum omapfb_color_format { 91enum omapfb_color_format {
89 OMAPFB_COLOR_RGB565 = 0, 92 OMAPFB_COLOR_RGB565 = 0,
90 OMAPFB_COLOR_YUV422, 93 OMAPFB_COLOR_YUV422,
@@ -136,7 +139,7 @@ struct omapfb_plane_info {
136 __u8 enabled; 139 __u8 enabled;
137 __u8 channel_out; 140 __u8 channel_out;
138 __u8 mirror; 141 __u8 mirror;
139 __u8 reserved1; 142 __u8 mem_idx;
140 __u32 out_width; 143 __u32 out_width;
141 __u32 out_height; 144 __u32 out_height;
142 __u32 reserved2[12]; 145 __u32 reserved2[12];
@@ -253,7 +256,7 @@ struct omapfb_platform_data {
253/* in arch/arm/plat-omap/fb.c */ 256/* in arch/arm/plat-omap/fb.c */
254extern void omapfb_set_platform_data(struct omapfb_platform_data *data); 257extern void omapfb_set_platform_data(struct omapfb_platform_data *data);
255extern void omapfb_set_ctrl_platform_data(void *pdata); 258extern void omapfb_set_ctrl_platform_data(void *pdata);
256extern void omapfb_reserve_sdram(void); 259extern void omapfb_reserve_sdram_memblock(void);
257 260
258#endif 261#endif
259 262
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 537662315627..5e3aa8311c5e 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -1,19 +1,34 @@
1#ifndef __INCLUDE_LINUX_OOM_H 1#ifndef __INCLUDE_LINUX_OOM_H
2#define __INCLUDE_LINUX_OOM_H 2#define __INCLUDE_LINUX_OOM_H
3 3
4/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */ 4/*
5 * /proc/<pid>/oom_adj is deprecated, see
6 * Documentation/feature-removal-schedule.txt.
7 *
8 * /proc/<pid>/oom_adj set to -17 protects from the oom-killer
9 */
5#define OOM_DISABLE (-17) 10#define OOM_DISABLE (-17)
6/* inclusive */ 11/* inclusive */
7#define OOM_ADJUST_MIN (-16) 12#define OOM_ADJUST_MIN (-16)
8#define OOM_ADJUST_MAX 15 13#define OOM_ADJUST_MAX 15
9 14
15/*
16 * /proc/<pid>/oom_score_adj set to OOM_SCORE_ADJ_MIN disables oom killing for
17 * pid.
18 */
19#define OOM_SCORE_ADJ_MIN (-1000)
20#define OOM_SCORE_ADJ_MAX 1000
21
10#ifdef __KERNEL__ 22#ifdef __KERNEL__
11 23
24#include <linux/sched.h>
12#include <linux/types.h> 25#include <linux/types.h>
13#include <linux/nodemask.h> 26#include <linux/nodemask.h>
14 27
15struct zonelist; 28struct zonelist;
16struct notifier_block; 29struct notifier_block;
30struct mem_cgroup;
31struct task_struct;
17 32
18/* 33/*
19 * Types of limitations to the nodes from which allocations may occur 34 * Types of limitations to the nodes from which allocations may occur
@@ -22,9 +37,12 @@ enum oom_constraint {
22 CONSTRAINT_NONE, 37 CONSTRAINT_NONE,
23 CONSTRAINT_CPUSET, 38 CONSTRAINT_CPUSET,
24 CONSTRAINT_MEMORY_POLICY, 39 CONSTRAINT_MEMORY_POLICY,
40 CONSTRAINT_MEMCG,
25}; 41};
26 42
27extern int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_flags); 43extern unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem,
44 const nodemask_t *nodemask, unsigned long totalpages);
45extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
28extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 46extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
29 47
30extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, 48extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
@@ -43,5 +61,16 @@ static inline void oom_killer_enable(void)
43{ 61{
44 oom_killer_disabled = false; 62 oom_killer_disabled = false;
45} 63}
64
65/* The badness from the OOM killer */
66extern unsigned long badness(struct task_struct *p, struct mem_cgroup *mem,
67 const nodemask_t *nodemask, unsigned long uptime);
68
69extern struct task_struct *find_lock_task_mm(struct task_struct *p);
70
71/* sysctls */
72extern int sysctl_oom_dump_tasks;
73extern int sysctl_oom_kill_allocating_task;
74extern int sysctl_panic_on_oom;
46#endif /* __KERNEL__*/ 75#endif /* __KERNEL__*/
47#endif /* _INCLUDE_LINUX_OOM_H */ 76#endif /* _INCLUDE_LINUX_OOM_H */
diff --git a/include/linux/padata.h b/include/linux/padata.h
index 8d8406246eef..bdcd1e9eacea 100644
--- a/include/linux/padata.h
+++ b/include/linux/padata.h
@@ -25,6 +25,11 @@
25#include <linux/spinlock.h> 25#include <linux/spinlock.h>
26#include <linux/list.h> 26#include <linux/list.h>
27#include <linux/timer.h> 27#include <linux/timer.h>
28#include <linux/notifier.h>
29#include <linux/kobject.h>
30
31#define PADATA_CPU_SERIAL 0x01
32#define PADATA_CPU_PARALLEL 0x02
28 33
29/** 34/**
30 * struct padata_priv - Embedded to the users data structure. 35 * struct padata_priv - Embedded to the users data structure.
@@ -59,7 +64,20 @@ struct padata_list {
59}; 64};
60 65
61/** 66/**
62 * struct padata_queue - The percpu padata queues. 67* struct padata_serial_queue - The percpu padata serial queue
68*
69* @serial: List to wait for serialization after reordering.
70* @work: work struct for serialization.
71* @pd: Backpointer to the internal control structure.
72*/
73struct padata_serial_queue {
74 struct padata_list serial;
75 struct work_struct work;
76 struct parallel_data *pd;
77};
78
79/**
80 * struct padata_parallel_queue - The percpu padata parallel queue
63 * 81 *
64 * @parallel: List to wait for parallelization. 82 * @parallel: List to wait for parallelization.
65 * @reorder: List to wait for reordering after parallel processing. 83 * @reorder: List to wait for reordering after parallel processing.
@@ -67,18 +85,28 @@ struct padata_list {
67 * @pwork: work struct for parallelization. 85 * @pwork: work struct for parallelization.
68 * @swork: work struct for serialization. 86 * @swork: work struct for serialization.
69 * @pd: Backpointer to the internal control structure. 87 * @pd: Backpointer to the internal control structure.
88 * @work: work struct for parallelization.
70 * @num_obj: Number of objects that are processed by this cpu. 89 * @num_obj: Number of objects that are processed by this cpu.
71 * @cpu_index: Index of the cpu. 90 * @cpu_index: Index of the cpu.
72 */ 91 */
73struct padata_queue { 92struct padata_parallel_queue {
74 struct padata_list parallel; 93 struct padata_list parallel;
75 struct padata_list reorder; 94 struct padata_list reorder;
76 struct padata_list serial; 95 struct parallel_data *pd;
77 struct work_struct pwork; 96 struct work_struct work;
78 struct work_struct swork; 97 atomic_t num_obj;
79 struct parallel_data *pd; 98 int cpu_index;
80 atomic_t num_obj; 99};
81 int cpu_index; 100
101/**
102 * struct padata_cpumask - The cpumasks for the parallel/serial workers
103 *
104 * @pcpu: cpumask for the parallel workers.
105 * @cbcpu: cpumask for the serial (callback) workers.
106 */
107struct padata_cpumask {
108 cpumask_var_t pcpu;
109 cpumask_var_t cbcpu;
82}; 110};
83 111
84/** 112/**
@@ -86,25 +114,29 @@ struct padata_queue {
86 * that depends on the cpumask in use. 114 * that depends on the cpumask in use.
87 * 115 *
88 * @pinst: padata instance. 116 * @pinst: padata instance.
89 * @queue: percpu padata queues. 117 * @pqueue: percpu padata queues used for parallelization.
118 * @squeue: percpu padata queues used for serialuzation.
90 * @seq_nr: The sequence number that will be attached to the next object. 119 * @seq_nr: The sequence number that will be attached to the next object.
91 * @reorder_objects: Number of objects waiting in the reorder queues. 120 * @reorder_objects: Number of objects waiting in the reorder queues.
92 * @refcnt: Number of objects holding a reference on this parallel_data. 121 * @refcnt: Number of objects holding a reference on this parallel_data.
93 * @max_seq_nr: Maximal used sequence number. 122 * @max_seq_nr: Maximal used sequence number.
94 * @cpumask: cpumask in use. 123 * @cpumask: The cpumasks in use for parallel and serial workers.
95 * @lock: Reorder lock. 124 * @lock: Reorder lock.
125 * @processed: Number of already processed objects.
96 * @timer: Reorder timer. 126 * @timer: Reorder timer.
97 */ 127 */
98struct parallel_data { 128struct parallel_data {
99 struct padata_instance *pinst; 129 struct padata_instance *pinst;
100 struct padata_queue *queue; 130 struct padata_parallel_queue *pqueue;
101 atomic_t seq_nr; 131 struct padata_serial_queue *squeue;
102 atomic_t reorder_objects; 132 atomic_t seq_nr;
103 atomic_t refcnt; 133 atomic_t reorder_objects;
104 unsigned int max_seq_nr; 134 atomic_t refcnt;
105 cpumask_var_t cpumask; 135 unsigned int max_seq_nr;
106 spinlock_t lock; 136 struct padata_cpumask cpumask;
107 struct timer_list timer; 137 spinlock_t lock ____cacheline_aligned;
138 unsigned int processed;
139 struct timer_list timer;
108}; 140};
109 141
110/** 142/**
@@ -113,31 +145,48 @@ struct parallel_data {
113 * @cpu_notifier: cpu hotplug notifier. 145 * @cpu_notifier: cpu hotplug notifier.
114 * @wq: The workqueue in use. 146 * @wq: The workqueue in use.
115 * @pd: The internal control structure. 147 * @pd: The internal control structure.
116 * @cpumask: User supplied cpumask. 148 * @cpumask: User supplied cpumasks for parallel and serial works.
149 * @cpumask_change_notifier: Notifiers chain for user-defined notify
150 * callbacks that will be called when either @pcpu or @cbcpu
151 * or both cpumasks change.
152 * @kobj: padata instance kernel object.
117 * @lock: padata instance lock. 153 * @lock: padata instance lock.
118 * @flags: padata flags. 154 * @flags: padata flags.
119 */ 155 */
120struct padata_instance { 156struct padata_instance {
121 struct notifier_block cpu_notifier; 157 struct notifier_block cpu_notifier;
122 struct workqueue_struct *wq; 158 struct workqueue_struct *wq;
123 struct parallel_data *pd; 159 struct parallel_data *pd;
124 cpumask_var_t cpumask; 160 struct padata_cpumask cpumask;
125 struct mutex lock; 161 struct blocking_notifier_head cpumask_change_notifier;
126 u8 flags; 162 struct kobject kobj;
127#define PADATA_INIT 1 163 struct mutex lock;
128#define PADATA_RESET 2 164 u8 flags;
165#define PADATA_INIT 1
166#define PADATA_RESET 2
167#define PADATA_INVALID 4
129}; 168};
130 169
131extern struct padata_instance *padata_alloc(const struct cpumask *cpumask, 170extern struct padata_instance *padata_alloc_possible(
132 struct workqueue_struct *wq); 171 struct workqueue_struct *wq);
172extern struct padata_instance *padata_alloc(struct workqueue_struct *wq,
173 const struct cpumask *pcpumask,
174 const struct cpumask *cbcpumask);
133extern void padata_free(struct padata_instance *pinst); 175extern void padata_free(struct padata_instance *pinst);
134extern int padata_do_parallel(struct padata_instance *pinst, 176extern int padata_do_parallel(struct padata_instance *pinst,
135 struct padata_priv *padata, int cb_cpu); 177 struct padata_priv *padata, int cb_cpu);
136extern void padata_do_serial(struct padata_priv *padata); 178extern void padata_do_serial(struct padata_priv *padata);
137extern int padata_set_cpumask(struct padata_instance *pinst, 179extern int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type,
138 cpumask_var_t cpumask); 180 cpumask_var_t cpumask);
139extern int padata_add_cpu(struct padata_instance *pinst, int cpu); 181extern int padata_set_cpumasks(struct padata_instance *pinst,
140extern int padata_remove_cpu(struct padata_instance *pinst, int cpu); 182 cpumask_var_t pcpumask,
141extern void padata_start(struct padata_instance *pinst); 183 cpumask_var_t cbcpumask);
184extern int padata_add_cpu(struct padata_instance *pinst, int cpu, int mask);
185extern int padata_remove_cpu(struct padata_instance *pinst, int cpu, int mask);
186extern int padata_start(struct padata_instance *pinst);
142extern void padata_stop(struct padata_instance *pinst); 187extern void padata_stop(struct padata_instance *pinst);
188extern int padata_register_cpumask_notifier(struct padata_instance *pinst,
189 struct notifier_block *nblock);
190extern int padata_unregister_cpumask_notifier(struct padata_instance *pinst,
191 struct notifier_block *nblock);
143#endif 192#endif
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 5b59f35dcb8f..6fa317801e1c 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -128,7 +128,6 @@ enum pageflags {
128 128
129 /* SLUB */ 129 /* SLUB */
130 PG_slub_frozen = PG_active, 130 PG_slub_frozen = PG_active,
131 PG_slub_debug = PG_error,
132}; 131};
133 132
134#ifndef __GENERATING_BOUNDS_H 133#ifndef __GENERATING_BOUNDS_H
@@ -215,7 +214,6 @@ PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked)
215__PAGEFLAG(SlobFree, slob_free) 214__PAGEFLAG(SlobFree, slob_free)
216 215
217__PAGEFLAG(SlubFrozen, slub_frozen) 216__PAGEFLAG(SlubFrozen, slub_frozen)
218__PAGEFLAG(SlubDebug, slub_debug)
219 217
220/* 218/*
221 * Private page markings that may be used by the filesystem that owns the page 219 * Private page markings that may be used by the filesystem that owns the page
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 3c62ed408492..e12cdc6d79ee 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -13,6 +13,7 @@
13#include <linux/gfp.h> 13#include <linux/gfp.h>
14#include <linux/bitops.h> 14#include <linux/bitops.h>
15#include <linux/hardirq.h> /* for in_interrupt() */ 15#include <linux/hardirq.h> /* for in_interrupt() */
16#include <linux/hugetlb_inline.h>
16 17
17/* 18/*
18 * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page 19 * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page
@@ -281,10 +282,16 @@ static inline loff_t page_offset(struct page *page)
281 return ((loff_t)page->index) << PAGE_CACHE_SHIFT; 282 return ((loff_t)page->index) << PAGE_CACHE_SHIFT;
282} 283}
283 284
285extern pgoff_t linear_hugepage_index(struct vm_area_struct *vma,
286 unsigned long address);
287
284static inline pgoff_t linear_page_index(struct vm_area_struct *vma, 288static inline pgoff_t linear_page_index(struct vm_area_struct *vma,
285 unsigned long address) 289 unsigned long address)
286{ 290{
287 pgoff_t pgoff = (address - vma->vm_start) >> PAGE_SHIFT; 291 pgoff_t pgoff;
292 if (unlikely(is_vm_hugetlb_page(vma)))
293 return linear_hugepage_index(vma, address);
294 pgoff = (address - vma->vm_start) >> PAGE_SHIFT;
288 pgoff += vma->vm_pgoff; 295 pgoff += vma->vm_pgoff;
289 return pgoff >> (PAGE_CACHE_SHIFT - PAGE_SHIFT); 296 return pgoff >> (PAGE_CACHE_SHIFT - PAGE_SHIFT);
290} 297}
@@ -423,8 +430,10 @@ static inline int fault_in_pages_readable(const char __user *uaddr, int size)
423 const char __user *end = uaddr + size - 1; 430 const char __user *end = uaddr + size - 1;
424 431
425 if (((unsigned long)uaddr & PAGE_MASK) != 432 if (((unsigned long)uaddr & PAGE_MASK) !=
426 ((unsigned long)end & PAGE_MASK)) 433 ((unsigned long)end & PAGE_MASK)) {
427 ret = __get_user(c, end); 434 ret = __get_user(c, end);
435 (void)c;
436 }
428 } 437 }
429 return ret; 438 return ret;
430} 439}
diff --git a/include/linux/path.h b/include/linux/path.h
index 915e0c382a51..edc98dec6266 100644
--- a/include/linux/path.h
+++ b/include/linux/path.h
@@ -12,4 +12,9 @@ struct path {
12extern void path_get(struct path *); 12extern void path_get(struct path *);
13extern void path_put(struct path *); 13extern void path_put(struct path *);
14 14
15static inline int path_equal(const struct path *path1, const struct path *path2)
16{
17 return path1->mnt == path2->mnt && path1->dentry == path2->dentry;
18}
19
15#endif /* _LINUX_PATH_H */ 20#endif /* _LINUX_PATH_H */
diff --git a/include/linux/pch_dma.h b/include/linux/pch_dma.h
new file mode 100644
index 000000000000..fdafe529ef8a
--- /dev/null
+++ b/include/linux/pch_dma.h
@@ -0,0 +1,37 @@
1/*
2 * Copyright (c) 2010 Intel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
16 */
17
18#ifndef PCH_DMA_H
19#define PCH_DMA_H
20
21#include <linux/dmaengine.h>
22
23enum pch_dma_width {
24 PCH_DMA_WIDTH_1_BYTE,
25 PCH_DMA_WIDTH_2_BYTES,
26 PCH_DMA_WIDTH_4_BYTES,
27};
28
29struct pch_dma_slave {
30 struct device *dma_dev;
31 unsigned int chan_id;
32 dma_addr_t tx_reg;
33 dma_addr_t rx_reg;
34 enum pch_dma_width width;
35};
36
37#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index f26fda76b87f..b1d17956a153 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -270,6 +270,8 @@ struct pci_dev {
270 unsigned int d1_support:1; /* Low power state D1 is supported */ 270 unsigned int d1_support:1; /* Low power state D1 is supported */
271 unsigned int d2_support:1; /* Low power state D2 is supported */ 271 unsigned int d2_support:1; /* Low power state D2 is supported */
272 unsigned int no_d1d2:1; /* Only allow D0 and D3 */ 272 unsigned int no_d1d2:1; /* Only allow D0 and D3 */
273 unsigned int mmio_always_on:1; /* disallow turning off io/mem
274 decoding during bar sizing */
273 unsigned int wakeup_prepared:1; 275 unsigned int wakeup_prepared:1;
274 unsigned int d3_delay; /* D3->D0 transition time in ms */ 276 unsigned int d3_delay; /* D3->D0 transition time in ms */
275 277
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 3bedcc149c84..f6a3b2d36cad 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1494,6 +1494,9 @@
1494#define PCI_DEVICE_ID_SBE_WANXL100 0x0301 1494#define PCI_DEVICE_ID_SBE_WANXL100 0x0301
1495#define PCI_DEVICE_ID_SBE_WANXL200 0x0302 1495#define PCI_DEVICE_ID_SBE_WANXL200 0x0302
1496#define PCI_DEVICE_ID_SBE_WANXL400 0x0104 1496#define PCI_DEVICE_ID_SBE_WANXL400 0x0104
1497#define PCI_SUBDEVICE_ID_SBE_T3E3 0x0009
1498#define PCI_SUBDEVICE_ID_SBE_2T3E3_P0 0x0901
1499#define PCI_SUBDEVICE_ID_SBE_2T3E3_P1 0x0902
1497 1500
1498#define PCI_VENDOR_ID_TOSHIBA 0x1179 1501#define PCI_VENDOR_ID_TOSHIBA 0x1179
1499#define PCI_DEVICE_ID_TOSHIBA_PICCOLO_1 0x0101 1502#define PCI_DEVICE_ID_TOSHIBA_PICCOLO_1 0x0101
@@ -2054,7 +2057,6 @@
2054#define PCI_DEVICE_ID_NX2_57711E 0x1650 2057#define PCI_DEVICE_ID_NX2_57711E 0x1650
2055#define PCI_DEVICE_ID_TIGON3_5705 0x1653 2058#define PCI_DEVICE_ID_TIGON3_5705 0x1653
2056#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 2059#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654
2057#define PCI_DEVICE_ID_TIGON3_5720 0x1658
2058#define PCI_DEVICE_ID_TIGON3_5721 0x1659 2060#define PCI_DEVICE_ID_TIGON3_5721 0x1659
2059#define PCI_DEVICE_ID_TIGON3_5722 0x165a 2061#define PCI_DEVICE_ID_TIGON3_5722 0x165a
2060#define PCI_DEVICE_ID_TIGON3_5723 0x165b 2062#define PCI_DEVICE_ID_TIGON3_5723 0x165b
@@ -2068,13 +2070,11 @@
2068#define PCI_DEVICE_ID_TIGON3_5754M 0x1672 2070#define PCI_DEVICE_ID_TIGON3_5754M 0x1672
2069#define PCI_DEVICE_ID_TIGON3_5755M 0x1673 2071#define PCI_DEVICE_ID_TIGON3_5755M 0x1673
2070#define PCI_DEVICE_ID_TIGON3_5756 0x1674 2072#define PCI_DEVICE_ID_TIGON3_5756 0x1674
2071#define PCI_DEVICE_ID_TIGON3_5750 0x1676
2072#define PCI_DEVICE_ID_TIGON3_5751 0x1677 2073#define PCI_DEVICE_ID_TIGON3_5751 0x1677
2073#define PCI_DEVICE_ID_TIGON3_5715 0x1678 2074#define PCI_DEVICE_ID_TIGON3_5715 0x1678
2074#define PCI_DEVICE_ID_TIGON3_5715S 0x1679 2075#define PCI_DEVICE_ID_TIGON3_5715S 0x1679
2075#define PCI_DEVICE_ID_TIGON3_5754 0x167a 2076#define PCI_DEVICE_ID_TIGON3_5754 0x167a
2076#define PCI_DEVICE_ID_TIGON3_5755 0x167b 2077#define PCI_DEVICE_ID_TIGON3_5755 0x167b
2077#define PCI_DEVICE_ID_TIGON3_5750M 0x167c
2078#define PCI_DEVICE_ID_TIGON3_5751M 0x167d 2078#define PCI_DEVICE_ID_TIGON3_5751M 0x167d
2079#define PCI_DEVICE_ID_TIGON3_5751F 0x167e 2079#define PCI_DEVICE_ID_TIGON3_5751F 0x167e
2080#define PCI_DEVICE_ID_TIGON3_5787F 0x167f 2080#define PCI_DEVICE_ID_TIGON3_5787F 0x167f
@@ -2264,6 +2264,7 @@
2264#define PCI_DEVICE_ID_TDI_EHCI 0x0101 2264#define PCI_DEVICE_ID_TDI_EHCI 0x0101
2265 2265
2266#define PCI_VENDOR_ID_FREESCALE 0x1957 2266#define PCI_VENDOR_ID_FREESCALE 0x1957
2267#define PCI_DEVICE_ID_MPC8308 0xc006
2267#define PCI_DEVICE_ID_MPC8315E 0x00b4 2268#define PCI_DEVICE_ID_MPC8315E 0x00b4
2268#define PCI_DEVICE_ID_MPC8315 0x00b5 2269#define PCI_DEVICE_ID_MPC8315 0x00b5
2269#define PCI_DEVICE_ID_MPC8314E 0x00b6 2270#define PCI_DEVICE_ID_MPC8314E 0x00b6
@@ -2324,9 +2325,11 @@
2324#define PCI_DEVICE_ID_JMICRON_JMB361 0x2361 2325#define PCI_DEVICE_ID_JMICRON_JMB361 0x2361
2325#define PCI_DEVICE_ID_JMICRON_JMB362 0x2362 2326#define PCI_DEVICE_ID_JMICRON_JMB362 0x2362
2326#define PCI_DEVICE_ID_JMICRON_JMB363 0x2363 2327#define PCI_DEVICE_ID_JMICRON_JMB363 0x2363
2328#define PCI_DEVICE_ID_JMICRON_JMB364 0x2364
2327#define PCI_DEVICE_ID_JMICRON_JMB365 0x2365 2329#define PCI_DEVICE_ID_JMICRON_JMB365 0x2365
2328#define PCI_DEVICE_ID_JMICRON_JMB366 0x2366 2330#define PCI_DEVICE_ID_JMICRON_JMB366 0x2366
2329#define PCI_DEVICE_ID_JMICRON_JMB368 0x2368 2331#define PCI_DEVICE_ID_JMICRON_JMB368 0x2368
2332#define PCI_DEVICE_ID_JMICRON_JMB369 0x2369
2330#define PCI_DEVICE_ID_JMICRON_JMB38X_SD 0x2381 2333#define PCI_DEVICE_ID_JMICRON_JMB38X_SD 0x2381
2331#define PCI_DEVICE_ID_JMICRON_JMB38X_MMC 0x2382 2334#define PCI_DEVICE_ID_JMICRON_JMB38X_MMC 0x2382
2332#define PCI_DEVICE_ID_JMICRON_JMB38X_MS 0x2383 2335#define PCI_DEVICE_ID_JMICRON_JMB38X_MS 0x2383
@@ -2369,6 +2372,9 @@
2369#define PCI_VENDOR_ID_AKS 0x416c 2372#define PCI_VENDOR_ID_AKS 0x416c
2370#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100 2373#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100
2371 2374
2375#define PCI_VENDOR_ID_ACCESSIO 0x494f
2376#define PCI_DEVICE_ID_ACCESSIO_WDG_CSM 0x22c0
2377
2372#define PCI_VENDOR_ID_S3 0x5333 2378#define PCI_VENDOR_ID_S3 0x5333
2373#define PCI_DEVICE_ID_S3_TRIO 0x8811 2379#define PCI_DEVICE_ID_S3_TRIO 0x8811
2374#define PCI_DEVICE_ID_S3_868 0x8880 2380#define PCI_DEVICE_ID_S3_868 0x8880
@@ -2772,3 +2778,6 @@
2772#define PCI_DEVICE_ID_RME_DIGI32 0x9896 2778#define PCI_DEVICE_ID_RME_DIGI32 0x9896
2773#define PCI_DEVICE_ID_RME_DIGI32_PRO 0x9897 2779#define PCI_DEVICE_ID_RME_DIGI32_PRO 0x9897
2774#define PCI_DEVICE_ID_RME_DIGI32_8 0x9898 2780#define PCI_DEVICE_ID_RME_DIGI32_8 0x9898
2781
2782#define PCI_VENDOR_ID_XEN 0x5853
2783#define PCI_DEVICE_ID_XEN_PLATFORM 0x0001
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index d3a38d687104..b8b9084527b1 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -45,6 +45,16 @@
45#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10) 45#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10)
46 46
47/* 47/*
48 * Percpu allocator can serve percpu allocations before slab is
49 * initialized which allows slab to depend on the percpu allocator.
50 * The following two parameters decide how much resource to
51 * preallocate for this. Keep PERCPU_DYNAMIC_RESERVE equal to or
52 * larger than PERCPU_DYNAMIC_EARLY_SIZE.
53 */
54#define PERCPU_DYNAMIC_EARLY_SLOTS 128
55#define PERCPU_DYNAMIC_EARLY_SIZE (12 << 10)
56
57/*
48 * PERCPU_DYNAMIC_RESERVE indicates the amount of free area to piggy 58 * PERCPU_DYNAMIC_RESERVE indicates the amount of free area to piggy
49 * back on the first chunk for dynamic percpu allocation if arch is 59 * back on the first chunk for dynamic percpu allocation if arch is
50 * manually allocating and mapping it for faster access (as a part of 60 * manually allocating and mapping it for faster access (as a part of
@@ -104,16 +114,11 @@ extern struct pcpu_alloc_info * __init pcpu_alloc_alloc_info(int nr_groups,
104 int nr_units); 114 int nr_units);
105extern void __init pcpu_free_alloc_info(struct pcpu_alloc_info *ai); 115extern void __init pcpu_free_alloc_info(struct pcpu_alloc_info *ai);
106 116
107extern struct pcpu_alloc_info * __init pcpu_build_alloc_info(
108 size_t reserved_size, ssize_t dyn_size,
109 size_t atom_size,
110 pcpu_fc_cpu_distance_fn_t cpu_distance_fn);
111
112extern int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, 117extern int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
113 void *base_addr); 118 void *base_addr);
114 119
115#ifdef CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK 120#ifdef CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK
116extern int __init pcpu_embed_first_chunk(size_t reserved_size, ssize_t dyn_size, 121extern int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size,
117 size_t atom_size, 122 size_t atom_size,
118 pcpu_fc_cpu_distance_fn_t cpu_distance_fn, 123 pcpu_fc_cpu_distance_fn_t cpu_distance_fn,
119 pcpu_fc_alloc_fn_t alloc_fn, 124 pcpu_fc_alloc_fn_t alloc_fn,
@@ -140,6 +145,7 @@ extern bool is_kernel_percpu_address(unsigned long addr);
140#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA 145#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA
141extern void __init setup_per_cpu_areas(void); 146extern void __init setup_per_cpu_areas(void);
142#endif 147#endif
148extern void __init percpu_init_late(void);
143 149
144#else /* CONFIG_SMP */ 150#else /* CONFIG_SMP */
145 151
@@ -153,6 +159,8 @@ static inline bool is_kernel_percpu_address(unsigned long addr)
153 159
154static inline void __init setup_per_cpu_areas(void) { } 160static inline void __init setup_per_cpu_areas(void) { }
155 161
162static inline void __init percpu_init_late(void) { }
163
156static inline void *pcpu_lpage_remapped(void *kaddr) 164static inline void *pcpu_lpage_remapped(void *kaddr)
157{ 165{
158 return NULL; 166 return NULL;
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index c88d67b59394..8a7d510ffa9c 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -40,6 +40,7 @@ void percpu_counter_destroy(struct percpu_counter *fbc);
40void percpu_counter_set(struct percpu_counter *fbc, s64 amount); 40void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
41void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); 41void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
42s64 __percpu_counter_sum(struct percpu_counter *fbc); 42s64 __percpu_counter_sum(struct percpu_counter *fbc);
43int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs);
43 44
44static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) 45static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
45{ 46{
@@ -98,6 +99,16 @@ static inline void percpu_counter_set(struct percpu_counter *fbc, s64 amount)
98 fbc->count = amount; 99 fbc->count = amount;
99} 100}
100 101
102static inline int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs)
103{
104 if (fbc->count > rhs)
105 return 1;
106 else if (fbc->count < rhs)
107 return -1;
108 else
109 return 0;
110}
111
101static inline void 112static inline void
102percpu_counter_add(struct percpu_counter *fbc, s64 amount) 113percpu_counter_add(struct percpu_counter *fbc, s64 amount)
103{ 114{
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 5d0266d94985..716f99b682c1 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -214,8 +214,9 @@ struct perf_event_attr {
214 * See also PERF_RECORD_MISC_EXACT_IP 214 * See also PERF_RECORD_MISC_EXACT_IP
215 */ 215 */
216 precise_ip : 2, /* skid constraint */ 216 precise_ip : 2, /* skid constraint */
217 mmap_data : 1, /* non-exec mmap data */
217 218
218 __reserved_1 : 47; 219 __reserved_1 : 46;
219 220
220 union { 221 union {
221 __u32 wakeup_events; /* wakeup every n events */ 222 __u32 wakeup_events; /* wakeup every n events */
@@ -461,6 +462,7 @@ enum perf_callchain_context {
461 462
462#ifdef CONFIG_PERF_EVENTS 463#ifdef CONFIG_PERF_EVENTS
463# include <asm/perf_event.h> 464# include <asm/perf_event.h>
465# include <asm/local64.h>
464#endif 466#endif
465 467
466struct perf_guest_info_callbacks { 468struct perf_guest_info_callbacks {
@@ -531,14 +533,16 @@ struct hw_perf_event {
531 struct hrtimer hrtimer; 533 struct hrtimer hrtimer;
532 }; 534 };
533#ifdef CONFIG_HAVE_HW_BREAKPOINT 535#ifdef CONFIG_HAVE_HW_BREAKPOINT
534 /* breakpoint */ 536 struct { /* breakpoint */
535 struct arch_hw_breakpoint info; 537 struct arch_hw_breakpoint info;
538 struct list_head bp_list;
539 };
536#endif 540#endif
537 }; 541 };
538 atomic64_t prev_count; 542 local64_t prev_count;
539 u64 sample_period; 543 u64 sample_period;
540 u64 last_period; 544 u64 last_period;
541 atomic64_t period_left; 545 local64_t period_left;
542 u64 interrupts; 546 u64 interrupts;
543 547
544 u64 freq_time_stamp; 548 u64 freq_time_stamp;
@@ -548,7 +552,10 @@ struct hw_perf_event {
548 552
549struct perf_event; 553struct perf_event;
550 554
551#define PERF_EVENT_TXN_STARTED 1 555/*
556 * Common implementation detail of pmu::{start,commit,cancel}_txn
557 */
558#define PERF_EVENT_TXN 0x1
552 559
553/** 560/**
554 * struct pmu - generic performance monitoring unit 561 * struct pmu - generic performance monitoring unit
@@ -562,14 +569,28 @@ struct pmu {
562 void (*unthrottle) (struct perf_event *event); 569 void (*unthrottle) (struct perf_event *event);
563 570
564 /* 571 /*
565 * group events scheduling is treated as a transaction, 572 * Group events scheduling is treated as a transaction, add group
566 * add group events as a whole and perform one schedulability test. 573 * events as a whole and perform one schedulability test. If the test
567 * If test fails, roll back the whole group 574 * fails, roll back the whole group
568 */ 575 */
569 576
577 /*
578 * Start the transaction, after this ->enable() doesn't need
579 * to do schedulability tests.
580 */
570 void (*start_txn) (const struct pmu *pmu); 581 void (*start_txn) (const struct pmu *pmu);
571 void (*cancel_txn) (const struct pmu *pmu); 582 /*
583 * If ->start_txn() disabled the ->enable() schedulability test
584 * then ->commit_txn() is required to perform one. On success
585 * the transaction is closed. On error the transaction is kept
586 * open until ->cancel_txn() is called.
587 */
572 int (*commit_txn) (const struct pmu *pmu); 588 int (*commit_txn) (const struct pmu *pmu);
589 /*
590 * Will cancel the transaction, assumes ->disable() is called for
591 * each successfull ->enable() during the transaction.
592 */
593 void (*cancel_txn) (const struct pmu *pmu);
573}; 594};
574 595
575/** 596/**
@@ -584,7 +605,9 @@ enum perf_event_active_state {
584 605
585struct file; 606struct file;
586 607
587struct perf_mmap_data { 608#define PERF_BUFFER_WRITABLE 0x01
609
610struct perf_buffer {
588 atomic_t refcount; 611 atomic_t refcount;
589 struct rcu_head rcu_head; 612 struct rcu_head rcu_head;
590#ifdef CONFIG_PERF_USE_VMALLOC 613#ifdef CONFIG_PERF_USE_VMALLOC
@@ -650,7 +673,8 @@ struct perf_event {
650 673
651 enum perf_event_active_state state; 674 enum perf_event_active_state state;
652 unsigned int attach_state; 675 unsigned int attach_state;
653 atomic64_t count; 676 local64_t count;
677 atomic64_t child_count;
654 678
655 /* 679 /*
656 * These are the total time in nanoseconds that the event 680 * These are the total time in nanoseconds that the event
@@ -709,7 +733,7 @@ struct perf_event {
709 atomic_t mmap_count; 733 atomic_t mmap_count;
710 int mmap_locked; 734 int mmap_locked;
711 struct user_struct *mmap_user; 735 struct user_struct *mmap_user;
712 struct perf_mmap_data *data; 736 struct perf_buffer *buffer;
713 737
714 /* poll related */ 738 /* poll related */
715 wait_queue_head_t waitq; 739 wait_queue_head_t waitq;
@@ -807,7 +831,7 @@ struct perf_cpu_context {
807 831
808struct perf_output_handle { 832struct perf_output_handle {
809 struct perf_event *event; 833 struct perf_event *event;
810 struct perf_mmap_data *data; 834 struct perf_buffer *buffer;
811 unsigned long wakeup; 835 unsigned long wakeup;
812 unsigned long size; 836 unsigned long size;
813 void *addr; 837 void *addr;
@@ -910,8 +934,10 @@ extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX];
910 934
911extern void __perf_sw_event(u32, u64, int, struct pt_regs *, u64); 935extern void __perf_sw_event(u32, u64, int, struct pt_regs *, u64);
912 936
913extern void 937#ifndef perf_arch_fetch_caller_regs
914perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip, int skip); 938static inline void
939perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip) { }
940#endif
915 941
916/* 942/*
917 * Take a snapshot of the regs. Skip ip and frame pointer to 943 * Take a snapshot of the regs. Skip ip and frame pointer to
@@ -921,31 +947,11 @@ perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip, int skip);
921 * - bp for callchains 947 * - bp for callchains
922 * - eflags, for future purposes, just in case 948 * - eflags, for future purposes, just in case
923 */ 949 */
924static inline void perf_fetch_caller_regs(struct pt_regs *regs, int skip) 950static inline void perf_fetch_caller_regs(struct pt_regs *regs)
925{ 951{
926 unsigned long ip;
927
928 memset(regs, 0, sizeof(*regs)); 952 memset(regs, 0, sizeof(*regs));
929 953
930 switch (skip) { 954 perf_arch_fetch_caller_regs(regs, CALLER_ADDR0);
931 case 1 :
932 ip = CALLER_ADDR0;
933 break;
934 case 2 :
935 ip = CALLER_ADDR1;
936 break;
937 case 3 :
938 ip = CALLER_ADDR2;
939 break;
940 case 4:
941 ip = CALLER_ADDR3;
942 break;
943 /* No need to support further for now */
944 default:
945 ip = 0;
946 }
947
948 return perf_arch_fetch_caller_regs(regs, ip, skip);
949} 955}
950 956
951static inline void 957static inline void
@@ -955,21 +961,14 @@ perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
955 struct pt_regs hot_regs; 961 struct pt_regs hot_regs;
956 962
957 if (!regs) { 963 if (!regs) {
958 perf_fetch_caller_regs(&hot_regs, 1); 964 perf_fetch_caller_regs(&hot_regs);
959 regs = &hot_regs; 965 regs = &hot_regs;
960 } 966 }
961 __perf_sw_event(event_id, nr, nmi, regs, addr); 967 __perf_sw_event(event_id, nr, nmi, regs, addr);
962 } 968 }
963} 969}
964 970
965extern void __perf_event_mmap(struct vm_area_struct *vma); 971extern void perf_event_mmap(struct vm_area_struct *vma);
966
967static inline void perf_event_mmap(struct vm_area_struct *vma)
968{
969 if (vma->vm_flags & VM_EXEC)
970 __perf_event_mmap(vma);
971}
972
973extern struct perf_guest_info_callbacks *perf_guest_cbs; 972extern struct perf_guest_info_callbacks *perf_guest_cbs;
974extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks); 973extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
975extern int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks); 974extern int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
@@ -1001,7 +1000,7 @@ static inline bool perf_paranoid_kernel(void)
1001extern void perf_event_init(void); 1000extern void perf_event_init(void);
1002extern void perf_tp_event(u64 addr, u64 count, void *record, 1001extern void perf_tp_event(u64 addr, u64 count, void *record,
1003 int entry_size, struct pt_regs *regs, 1002 int entry_size, struct pt_regs *regs,
1004 struct hlist_head *head); 1003 struct hlist_head *head, int rctx);
1005extern void perf_bp_event(struct perf_event *event, void *data); 1004extern void perf_bp_event(struct perf_event *event, void *data);
1006 1005
1007#ifndef perf_misc_flags 1006#ifndef perf_misc_flags
@@ -1068,7 +1067,7 @@ static inline void perf_event_disable(struct perf_event *event) { }
1068#define perf_cpu_notifier(fn) \ 1067#define perf_cpu_notifier(fn) \
1069do { \ 1068do { \
1070 static struct notifier_block fn##_nb __cpuinitdata = \ 1069 static struct notifier_block fn##_nb __cpuinitdata = \
1071 { .notifier_call = fn, .priority = 20 }; \ 1070 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \
1072 fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE, \ 1071 fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE, \
1073 (void *)(unsigned long)smp_processor_id()); \ 1072 (void *)(unsigned long)smp_processor_id()); \
1074 fn(&fn##_nb, (unsigned long)CPU_STARTING, \ 1073 fn(&fn##_nb, (unsigned long)CPU_STARTING, \
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
index e5126cff9b2a..24426c3d6b5a 100644
--- a/include/linux/phonet.h
+++ b/include/linux/phonet.h
@@ -56,7 +56,7 @@ struct phonethdr {
56 __be16 pn_length; 56 __be16 pn_length;
57 __u8 pn_robj; 57 __u8 pn_robj;
58 __u8 pn_sobj; 58 __u8 pn_sobj;
59} __attribute__((packed)); 59} __packed;
60 60
61/* Common Phonet payload header */ 61/* Common Phonet payload header */
62struct phonetmsg { 62struct phonetmsg {
@@ -98,7 +98,7 @@ struct sockaddr_pn {
98 __u8 spn_dev; 98 __u8 spn_dev;
99 __u8 spn_resource; 99 __u8 spn_resource;
100 __u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3]; 100 __u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3];
101} __attribute__ ((packed)); 101} __packed;
102 102
103/* Well known address */ 103/* Well known address */
104#define PN_DEV_PC 0x10 104#define PN_DEV_PC 0x10
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 987e111f7b11..6b0a782c6224 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -234,6 +234,8 @@ enum phy_state {
234 PHY_RESUMING 234 PHY_RESUMING
235}; 235};
236 236
237struct sk_buff;
238
237/* phy_device: An instance of a PHY 239/* phy_device: An instance of a PHY
238 * 240 *
239 * drv: Pointer to the driver for this PHY instance 241 * drv: Pointer to the driver for this PHY instance
@@ -402,6 +404,26 @@ struct phy_driver {
402 /* Clears up any memory if needed */ 404 /* Clears up any memory if needed */
403 void (*remove)(struct phy_device *phydev); 405 void (*remove)(struct phy_device *phydev);
404 406
407 /* Handles SIOCSHWTSTAMP ioctl for hardware time stamping. */
408 int (*hwtstamp)(struct phy_device *phydev, struct ifreq *ifr);
409
410 /*
411 * Requests a Rx timestamp for 'skb'. If the skb is accepted,
412 * the phy driver promises to deliver it using netif_rx() as
413 * soon as a timestamp becomes available. One of the
414 * PTP_CLASS_ values is passed in 'type'. The function must
415 * return true if the skb is accepted for delivery.
416 */
417 bool (*rxtstamp)(struct phy_device *dev, struct sk_buff *skb, int type);
418
419 /*
420 * Requests a Tx timestamp for 'skb'. The phy driver promises
421 * to deliver it to the socket's error queue as soon as a
422 * timestamp becomes available. One of the PTP_CLASS_ values
423 * is passed in 'type'.
424 */
425 void (*txtstamp)(struct phy_device *dev, struct sk_buff *skb, int type);
426
405 struct device_driver driver; 427 struct device_driver driver;
406}; 428};
407#define to_phy_driver(d) container_of(d, struct phy_driver, driver) 429#define to_phy_driver(d) container_of(d, struct phy_driver, driver)
@@ -498,7 +520,7 @@ void phy_stop_machine(struct phy_device *phydev);
498int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); 520int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
499int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd); 521int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd);
500int phy_mii_ioctl(struct phy_device *phydev, 522int phy_mii_ioctl(struct phy_device *phydev,
501 struct mii_ioctl_data *mii_data, int cmd); 523 struct ifreq *ifr, int cmd);
502int phy_start_interrupts(struct phy_device *phydev); 524int phy_start_interrupts(struct phy_device *phydev);
503void phy_print_status(struct phy_device *phydev); 525void phy_print_status(struct phy_device *phydev);
504struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id); 526struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id);
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 5417944d3687..d7ecad0093bb 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -43,10 +43,64 @@ extern struct resource *platform_get_resource_byname(struct platform_device *, u
43extern int platform_get_irq_byname(struct platform_device *, const char *); 43extern int platform_get_irq_byname(struct platform_device *, const char *);
44extern int platform_add_devices(struct platform_device **, int); 44extern int platform_add_devices(struct platform_device **, int);
45 45
46extern struct platform_device *platform_device_register_simple(const char *, int id, 46extern struct platform_device *platform_device_register_resndata(
47 const struct resource *, unsigned int); 47 struct device *parent, const char *name, int id,
48extern struct platform_device *platform_device_register_data(struct device *, 48 const struct resource *res, unsigned int num,
49 const char *, int, const void *, size_t); 49 const void *data, size_t size);
50
51/**
52 * platform_device_register_simple - add a platform-level device and its resources
53 * @name: base name of the device we're adding
54 * @id: instance id
55 * @res: set of resources that needs to be allocated for the device
56 * @num: number of resources
57 *
58 * This function creates a simple platform device that requires minimal
59 * resource and memory management. Canned release function freeing memory
60 * allocated for the device allows drivers using such devices to be
61 * unloaded without waiting for the last reference to the device to be
62 * dropped.
63 *
64 * This interface is primarily intended for use with legacy drivers which
65 * probe hardware directly. Because such drivers create sysfs device nodes
66 * themselves, rather than letting system infrastructure handle such device
67 * enumeration tasks, they don't fully conform to the Linux driver model.
68 * In particular, when such drivers are built as modules, they can't be
69 * "hotplugged".
70 *
71 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
72 */
73static inline struct platform_device *platform_device_register_simple(
74 const char *name, int id,
75 const struct resource *res, unsigned int num)
76{
77 return platform_device_register_resndata(NULL, name, id,
78 res, num, NULL, 0);
79}
80
81/**
82 * platform_device_register_data - add a platform-level device with platform-specific data
83 * @parent: parent device for the device we're adding
84 * @name: base name of the device we're adding
85 * @id: instance id
86 * @data: platform specific data for this platform device
87 * @size: size of platform specific data
88 *
89 * This function creates a simple platform device that requires minimal
90 * resource and memory management. Canned release function freeing memory
91 * allocated for the device allows drivers using such devices to be
92 * unloaded without waiting for the last reference to the device to be
93 * dropped.
94 *
95 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
96 */
97static inline struct platform_device *platform_device_register_data(
98 struct device *parent, const char *name, int id,
99 const void *data, size_t size)
100{
101 return platform_device_register_resndata(parent, name, id,
102 NULL, 0, data, size);
103}
50 104
51extern struct platform_device *platform_device_alloc(const char *name, int id); 105extern struct platform_device *platform_device_alloc(const char *name, int id);
52extern int platform_device_add_resources(struct platform_device *pdev, 106extern int platform_device_add_resources(struct platform_device *pdev,
diff --git a/include/linux/plist.h b/include/linux/plist.h
index 6898985e7b38..7254eda078e5 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -260,6 +260,23 @@ static inline int plist_node_empty(const struct plist_node *node)
260#endif 260#endif
261 261
262/** 262/**
263 * plist_last_entry - get the struct for the last entry
264 * @head: the &struct plist_head pointer
265 * @type: the type of the struct this is embedded in
266 * @member: the name of the list_struct within the struct
267 */
268#ifdef CONFIG_DEBUG_PI_LIST
269# define plist_last_entry(head, type, member) \
270({ \
271 WARN_ON(plist_head_empty(head)); \
272 container_of(plist_last(head), type, member); \
273})
274#else
275# define plist_last_entry(head, type, member) \
276 container_of(plist_last(head), type, member)
277#endif
278
279/**
263 * plist_first - return the first node (and thus, highest priority) 280 * plist_first - return the first node (and thus, highest priority)
264 * @head: the &struct plist_head pointer 281 * @head: the &struct plist_head pointer
265 * 282 *
@@ -271,4 +288,16 @@ static inline struct plist_node *plist_first(const struct plist_head *head)
271 struct plist_node, plist.node_list); 288 struct plist_node, plist.node_list);
272} 289}
273 290
291/**
292 * plist_last - return the last node (and thus, lowest priority)
293 * @head: the &struct plist_head pointer
294 *
295 * Assumes the plist is _not_ empty.
296 */
297static inline struct plist_node *plist_last(const struct plist_head *head)
298{
299 return list_entry(head->node_list.prev,
300 struct plist_node, plist.node_list);
301}
302
274#endif 303#endif
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 8e258c727971..52e8c55ff314 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -457,6 +457,7 @@ struct dev_pm_info {
457#ifdef CONFIG_PM_SLEEP 457#ifdef CONFIG_PM_SLEEP
458 struct list_head entry; 458 struct list_head entry;
459 struct completion completion; 459 struct completion completion;
460 unsigned long wakeup_count;
460#endif 461#endif
461#ifdef CONFIG_PM_RUNTIME 462#ifdef CONFIG_PM_RUNTIME
462 struct timer_list suspend_timer; 463 struct timer_list suspend_timer;
@@ -476,9 +477,15 @@ struct dev_pm_info {
476 enum rpm_request request; 477 enum rpm_request request;
477 enum rpm_status runtime_status; 478 enum rpm_status runtime_status;
478 int runtime_error; 479 int runtime_error;
480 unsigned long active_jiffies;
481 unsigned long suspended_jiffies;
482 unsigned long accounting_timestamp;
479#endif 483#endif
480}; 484};
481 485
486extern void update_pm_runtime_accounting(struct device *dev);
487
488
482/* 489/*
483 * The PM_EVENT_ messages are also used by drivers implementing the legacy 490 * The PM_EVENT_ messages are also used by drivers implementing the legacy
484 * suspend framework, based on the ->suspend() and ->resume() callbacks common 491 * suspend framework, based on the ->suspend() and ->resume() callbacks common
@@ -552,6 +559,11 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
552 } while (0) 559 } while (0)
553 560
554extern void device_pm_wait_for_dev(struct device *sub, struct device *dev); 561extern void device_pm_wait_for_dev(struct device *sub, struct device *dev);
562
563/* drivers/base/power/wakeup.c */
564extern void pm_wakeup_event(struct device *dev, unsigned int msec);
565extern void pm_stay_awake(struct device *dev);
566extern void pm_relax(void);
555#else /* !CONFIG_PM_SLEEP */ 567#else /* !CONFIG_PM_SLEEP */
556 568
557#define device_pm_lock() do {} while (0) 569#define device_pm_lock() do {} while (0)
@@ -565,6 +577,10 @@ static inline int dpm_suspend_start(pm_message_t state)
565#define suspend_report_result(fn, ret) do {} while (0) 577#define suspend_report_result(fn, ret) do {} while (0)
566 578
567static inline void device_pm_wait_for_dev(struct device *a, struct device *b) {} 579static inline void device_pm_wait_for_dev(struct device *a, struct device *b) {}
580
581static inline void pm_wakeup_event(struct device *dev, unsigned int msec) {}
582static inline void pm_stay_awake(struct device *dev) {}
583static inline void pm_relax(void) {}
568#endif /* !CONFIG_PM_SLEEP */ 584#endif /* !CONFIG_PM_SLEEP */
569 585
570/* How to reorder dpm_list after device_move() */ 586/* How to reorder dpm_list after device_move() */
diff --git a/include/linux/pm_qos_params.h b/include/linux/pm_qos_params.h
index 8ba440e5eb7f..77cbddb3784c 100644
--- a/include/linux/pm_qos_params.h
+++ b/include/linux/pm_qos_params.h
@@ -1,8 +1,10 @@
1#ifndef _LINUX_PM_QOS_PARAMS_H
2#define _LINUX_PM_QOS_PARAMS_H
1/* interface for the pm_qos_power infrastructure of the linux kernel. 3/* interface for the pm_qos_power infrastructure of the linux kernel.
2 * 4 *
3 * Mark Gross <mgross@linux.intel.com> 5 * Mark Gross <mgross@linux.intel.com>
4 */ 6 */
5#include <linux/list.h> 7#include <linux/plist.h>
6#include <linux/notifier.h> 8#include <linux/notifier.h>
7#include <linux/miscdevice.h> 9#include <linux/miscdevice.h>
8 10
@@ -14,9 +16,12 @@
14#define PM_QOS_NUM_CLASSES 4 16#define PM_QOS_NUM_CLASSES 4
15#define PM_QOS_DEFAULT_VALUE -1 17#define PM_QOS_DEFAULT_VALUE -1
16 18
17struct pm_qos_request_list; 19struct pm_qos_request_list {
20 struct plist_node list;
21 int pm_qos_class;
22};
18 23
19struct pm_qos_request_list *pm_qos_add_request(int pm_qos_class, s32 value); 24void pm_qos_add_request(struct pm_qos_request_list *l, int pm_qos_class, s32 value);
20void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req, 25void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req,
21 s32 new_value); 26 s32 new_value);
22void pm_qos_remove_request(struct pm_qos_request_list *pm_qos_req); 27void pm_qos_remove_request(struct pm_qos_request_list *pm_qos_req);
@@ -24,4 +29,6 @@ void pm_qos_remove_request(struct pm_qos_request_list *pm_qos_req);
24int pm_qos_request(int pm_qos_class); 29int pm_qos_request(int pm_qos_class);
25int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier); 30int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier);
26int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier); 31int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier);
32int pm_qos_request_active(struct pm_qos_request_list *req);
27 33
34#endif
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index 22d64c18056c..76aca48722ae 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -29,8 +29,11 @@
29 29
30#ifdef CONFIG_PM 30#ifdef CONFIG_PM
31 31
32/* changes to device_may_wakeup take effect on the next pm state change. 32/* Changes to device_may_wakeup take effect on the next pm state change.
33 * by default, devices should wakeup if they can. 33 *
34 * By default, most devices should leave wakeup disabled. The exceptions
35 * are devices that everyone expects to be wakeup sources: keyboards,
36 * power buttons, possibly network interfaces, etc.
34 */ 37 */
35static inline void device_init_wakeup(struct device *dev, bool val) 38static inline void device_init_wakeup(struct device *dev, bool val)
36{ 39{
@@ -59,7 +62,7 @@ static inline bool device_may_wakeup(struct device *dev)
59 62
60#else /* !CONFIG_PM */ 63#else /* !CONFIG_PM */
61 64
62/* For some reason the next two routines work even without CONFIG_PM */ 65/* For some reason the following routines work even without CONFIG_PM */
63static inline void device_init_wakeup(struct device *dev, bool val) 66static inline void device_init_wakeup(struct device *dev, bool val)
64{ 67{
65 dev->power.can_wakeup = val; 68 dev->power.can_wakeup = val;
@@ -67,6 +70,7 @@ static inline void device_init_wakeup(struct device *dev, bool val)
67 70
68static inline void device_set_wakeup_capable(struct device *dev, bool capable) 71static inline void device_set_wakeup_capable(struct device *dev, bool capable)
69{ 72{
73 dev->power.can_wakeup = capable;
70} 74}
71 75
72static inline bool device_can_wakeup(struct device *dev) 76static inline bool device_can_wakeup(struct device *dev)
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 7c4193eb0072..1bc1338b817b 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -414,6 +414,7 @@ struct pnp_protocol {
414 int (*disable) (struct pnp_dev *dev); 414 int (*disable) (struct pnp_dev *dev);
415 415
416 /* protocol specific suspend/resume */ 416 /* protocol specific suspend/resume */
417 bool (*can_wakeup) (struct pnp_dev *dev);
417 int (*suspend) (struct pnp_dev * dev, pm_message_t state); 418 int (*suspend) (struct pnp_dev * dev, pm_message_t state);
418 int (*resume) (struct pnp_dev * dev); 419 int (*resume) (struct pnp_dev * dev);
419 420
diff --git a/include/linux/poison.h b/include/linux/poison.h
index 34066ffd893d..2110a81c5e2a 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -48,15 +48,6 @@
48#define POISON_FREE 0x6b /* for use-after-free poisoning */ 48#define POISON_FREE 0x6b /* for use-after-free poisoning */
49#define POISON_END 0xa5 /* end-byte of poisoning */ 49#define POISON_END 0xa5 /* end-byte of poisoning */
50 50
51/********** mm/hugetlb.c **********/
52/*
53 * Private mappings of hugetlb pages use this poisoned value for
54 * page->mapping. The core VM should not be doing anything with this mapping
55 * but futex requires the existence of some page->mapping value even though it
56 * is unused if PAGE_MAPPING_ANON is set.
57 */
58#define HUGETLB_POISON ((void *)(0x00300300 + POISON_POINTER_DELTA + PAGE_MAPPING_ANON))
59
60/********** arch/$ARCH/mm/init.c **********/ 51/********** arch/$ARCH/mm/init.c **********/
61#define POISON_FREE_INITMEM 0xcc 52#define POISON_FREE_INITMEM 0xcc
62 53
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 4f71bf4e628c..3e23844a6990 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -117,6 +117,6 @@ void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx,
117 117
118long clock_nanosleep_restart(struct restart_block *restart_block); 118long clock_nanosleep_restart(struct restart_block *restart_block);
119 119
120void update_rlimit_cpu(unsigned long rlim_new); 120void update_rlimit_cpu(struct task_struct *task, unsigned long rlim_new);
121 121
122#endif 122#endif
diff --git a/include/linux/power/jz4740-battery.h b/include/linux/power/jz4740-battery.h
new file mode 100644
index 000000000000..19c9610c720a
--- /dev/null
+++ b/include/linux/power/jz4740-battery.h
@@ -0,0 +1,24 @@
1/*
2 * Copyright (C) 2009, Jiejing Zhang <kzjeef@gmail.com>
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 * You should have received a copy of the GNU General Public License along
10 * with this program; if not, write to the Free Software Foundation, Inc.,
11 * 675 Mass Ave, Cambridge, MA 02139, USA.
12 *
13 */
14
15#ifndef __JZ4740_BATTERY_H
16#define __JZ4740_BATTERY_H
17
18struct jz_battery_platform_data {
19 struct power_supply_info info;
20 int gpio_charge; /* GPIO port of Charger state */
21 int gpio_charge_active_low;
22};
23
24#endif
diff --git a/include/linux/ppp_channel.h b/include/linux/ppp_channel.h
index bff98ec1bfed..5d87f810a3b7 100644
--- a/include/linux/ppp_channel.h
+++ b/include/linux/ppp_channel.h
@@ -36,7 +36,7 @@ struct ppp_channel_ops {
36 36
37struct ppp_channel { 37struct ppp_channel {
38 void *private; /* channel private data */ 38 void *private; /* channel private data */
39 struct ppp_channel_ops *ops; /* operations for this channel */ 39 const struct ppp_channel_ops *ops; /* operations for this channel */
40 int mtu; /* max transmit packet size */ 40 int mtu; /* max transmit packet size */
41 int hdrlen; /* amount of headroom channel needs */ 41 int hdrlen; /* amount of headroom channel needs */
42 void *ppp; /* opaque to channel */ 42 void *ppp; /* opaque to channel */
diff --git a/include/linux/ptp_classify.h b/include/linux/ptp_classify.h
new file mode 100644
index 000000000000..943a85ab0020
--- /dev/null
+++ b/include/linux/ptp_classify.h
@@ -0,0 +1,126 @@
1/*
2 * PTP 1588 support
3 *
4 * This file implements a BPF that recognizes PTP event messages.
5 *
6 * Copyright (C) 2010 OMICRON electronics GmbH
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#ifndef _PTP_CLASSIFY_H_
24#define _PTP_CLASSIFY_H_
25
26#include <linux/if_ether.h>
27#include <linux/if_vlan.h>
28#include <linux/filter.h>
29#ifdef __KERNEL__
30#include <linux/in.h>
31#else
32#include <netinet/in.h>
33#endif
34
35#define PTP_CLASS_NONE 0x00 /* not a PTP event message */
36#define PTP_CLASS_V1 0x01 /* protocol version 1 */
37#define PTP_CLASS_V2 0x02 /* protocol version 2 */
38#define PTP_CLASS_VMASK 0x0f /* max protocol version is 15 */
39#define PTP_CLASS_IPV4 0x10 /* event in an IPV4 UDP packet */
40#define PTP_CLASS_IPV6 0x20 /* event in an IPV6 UDP packet */
41#define PTP_CLASS_L2 0x30 /* event in a L2 packet */
42#define PTP_CLASS_VLAN 0x40 /* event in a VLAN tagged L2 packet */
43#define PTP_CLASS_PMASK 0xf0 /* mask for the packet type field */
44
45#define PTP_CLASS_V1_IPV4 (PTP_CLASS_V1 | PTP_CLASS_IPV4)
46#define PTP_CLASS_V1_IPV6 (PTP_CLASS_V1 | PTP_CLASS_IPV6) /*probably DNE*/
47#define PTP_CLASS_V2_IPV4 (PTP_CLASS_V2 | PTP_CLASS_IPV4)
48#define PTP_CLASS_V2_IPV6 (PTP_CLASS_V2 | PTP_CLASS_IPV6)
49#define PTP_CLASS_V2_L2 (PTP_CLASS_V2 | PTP_CLASS_L2)
50#define PTP_CLASS_V2_VLAN (PTP_CLASS_V2 | PTP_CLASS_VLAN)
51
52#define PTP_EV_PORT 319
53
54#define OFF_ETYPE 12
55#define OFF_IHL 14
56#define OFF_FRAG 20
57#define OFF_PROTO4 23
58#define OFF_NEXT 6
59#define OFF_UDP_DST 2
60
61#define IP6_HLEN 40
62#define UDP_HLEN 8
63
64#define RELOFF_DST4 (ETH_HLEN + OFF_UDP_DST)
65#define OFF_DST6 (ETH_HLEN + IP6_HLEN + OFF_UDP_DST)
66#define OFF_PTP6 (ETH_HLEN + IP6_HLEN + UDP_HLEN)
67
68#define OP_AND (BPF_ALU | BPF_AND | BPF_K)
69#define OP_JEQ (BPF_JMP | BPF_JEQ | BPF_K)
70#define OP_JSET (BPF_JMP | BPF_JSET | BPF_K)
71#define OP_LDB (BPF_LD | BPF_B | BPF_ABS)
72#define OP_LDH (BPF_LD | BPF_H | BPF_ABS)
73#define OP_LDHI (BPF_LD | BPF_H | BPF_IND)
74#define OP_LDX (BPF_LDX | BPF_B | BPF_MSH)
75#define OP_OR (BPF_ALU | BPF_OR | BPF_K)
76#define OP_RETA (BPF_RET | BPF_A)
77#define OP_RETK (BPF_RET | BPF_K)
78
79static inline int ptp_filter_init(struct sock_filter *f, int len)
80{
81 if (OP_LDH == f[0].code)
82 return sk_chk_filter(f, len);
83 else
84 return 0;
85}
86
87#define PTP_FILTER \
88 {OP_LDH, 0, 0, OFF_ETYPE }, /* */ \
89 {OP_JEQ, 0, 12, ETH_P_IP }, /* f goto L20 */ \
90 {OP_LDB, 0, 0, OFF_PROTO4 }, /* */ \
91 {OP_JEQ, 0, 9, IPPROTO_UDP }, /* f goto L10 */ \
92 {OP_LDH, 0, 0, OFF_FRAG }, /* */ \
93 {OP_JSET, 7, 0, 0x1fff }, /* t goto L11 */ \
94 {OP_LDX, 0, 0, OFF_IHL }, /* */ \
95 {OP_LDHI, 0, 0, RELOFF_DST4 }, /* */ \
96 {OP_JEQ, 0, 4, PTP_EV_PORT }, /* f goto L12 */ \
97 {OP_LDHI, 0, 0, ETH_HLEN + UDP_HLEN }, /* */ \
98 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
99 {OP_OR, 0, 0, PTP_CLASS_IPV4 }, /* */ \
100 {OP_RETA, 0, 0, 0 }, /* */ \
101/*L1x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE }, /* */ \
102/*L20*/ {OP_JEQ, 0, 9, ETH_P_IPV6 }, /* f goto L40 */ \
103 {OP_LDB, 0, 0, ETH_HLEN + OFF_NEXT }, /* */ \
104 {OP_JEQ, 0, 6, IPPROTO_UDP }, /* f goto L30 */ \
105 {OP_LDH, 0, 0, OFF_DST6 }, /* */ \
106 {OP_JEQ, 0, 4, PTP_EV_PORT }, /* f goto L31 */ \
107 {OP_LDH, 0, 0, OFF_PTP6 }, /* */ \
108 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
109 {OP_OR, 0, 0, PTP_CLASS_IPV6 }, /* */ \
110 {OP_RETA, 0, 0, 0 }, /* */ \
111/*L3x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE }, /* */ \
112/*L40*/ {OP_JEQ, 0, 6, ETH_P_8021Q }, /* f goto L50 */ \
113 {OP_LDH, 0, 0, OFF_ETYPE + 4 }, /* */ \
114 {OP_JEQ, 0, 9, ETH_P_1588 }, /* f goto L60 */ \
115 {OP_LDH, 0, 0, ETH_HLEN + VLAN_HLEN }, /* */ \
116 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
117 {OP_OR, 0, 0, PTP_CLASS_VLAN }, /* */ \
118 {OP_RETA, 0, 0, 0 }, /* */ \
119/*L50*/ {OP_JEQ, 0, 4, ETH_P_1588 }, /* f goto L61 */ \
120 {OP_LDH, 0, 0, ETH_HLEN }, /* */ \
121 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
122 {OP_OR, 0, 0, PTP_CLASS_L2 }, /* */ \
123 {OP_RETA, 0, 0, 0 }, /* */ \
124/*L6x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE },
125
126#endif
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index aa36793b48bd..d50ba858cfe0 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -28,6 +28,12 @@ static inline bool is_quota_modification(struct inode *inode, struct iattr *ia)
28 28
29#if defined(CONFIG_QUOTA) 29#if defined(CONFIG_QUOTA)
30 30
31#define quota_error(sb, fmt, args...) \
32 __quota_error((sb), __func__, fmt , ## args)
33
34extern void __quota_error(struct super_block *sb, const char *func,
35 const char *fmt, ...);
36
31/* 37/*
32 * declaration of quota_function calls in kernel. 38 * declaration of quota_function calls in kernel.
33 */ 39 */
@@ -145,11 +151,6 @@ static inline bool sb_has_quota_active(struct super_block *sb, int type)
145 !sb_has_quota_suspended(sb, type); 151 !sb_has_quota_suspended(sb, type);
146} 152}
147 153
148static inline unsigned sb_any_quota_active(struct super_block *sb)
149{
150 return sb_any_quota_loaded(sb) & ~sb_any_quota_suspended(sb);
151}
152
153/* 154/*
154 * Operations supported for diskquotas. 155 * Operations supported for diskquotas.
155 */ 156 */
@@ -194,11 +195,6 @@ static inline int sb_has_quota_active(struct super_block *sb, int type)
194 return 0; 195 return 0;
195} 196}
196 197
197static inline int sb_any_quota_active(struct super_block *sb)
198{
199 return 0;
200}
201
202static inline void dquot_initialize(struct inode *inode) 198static inline void dquot_initialize(struct inode *inode)
203{ 199{
204} 200}
@@ -270,7 +266,7 @@ static inline int dquot_alloc_space_nodirty(struct inode *inode, qsize_t nr)
270static inline void dquot_alloc_space_nofail(struct inode *inode, qsize_t nr) 266static inline void dquot_alloc_space_nofail(struct inode *inode, qsize_t nr)
271{ 267{
272 __dquot_alloc_space(inode, nr, DQUOT_SPACE_WARN|DQUOT_SPACE_NOFAIL); 268 __dquot_alloc_space(inode, nr, DQUOT_SPACE_WARN|DQUOT_SPACE_NOFAIL);
273 mark_inode_dirty(inode); 269 mark_inode_dirty_sync(inode);
274} 270}
275 271
276static inline int dquot_alloc_space(struct inode *inode, qsize_t nr) 272static inline int dquot_alloc_space(struct inode *inode, qsize_t nr)
@@ -279,7 +275,7 @@ static inline int dquot_alloc_space(struct inode *inode, qsize_t nr)
279 275
280 ret = dquot_alloc_space_nodirty(inode, nr); 276 ret = dquot_alloc_space_nodirty(inode, nr);
281 if (!ret) 277 if (!ret)
282 mark_inode_dirty(inode); 278 mark_inode_dirty_sync(inode);
283 return ret; 279 return ret;
284} 280}
285 281
@@ -309,7 +305,7 @@ static inline int dquot_prealloc_block(struct inode *inode, qsize_t nr)
309 305
310 ret = dquot_prealloc_block_nodirty(inode, nr); 306 ret = dquot_prealloc_block_nodirty(inode, nr);
311 if (!ret) 307 if (!ret)
312 mark_inode_dirty(inode); 308 mark_inode_dirty_sync(inode);
313 return ret; 309 return ret;
314} 310}
315 311
@@ -325,7 +321,7 @@ static inline int dquot_claim_block(struct inode *inode, qsize_t nr)
325 321
326 ret = dquot_claim_space_nodirty(inode, nr << inode->i_blkbits); 322 ret = dquot_claim_space_nodirty(inode, nr << inode->i_blkbits);
327 if (!ret) 323 if (!ret)
328 mark_inode_dirty(inode); 324 mark_inode_dirty_sync(inode);
329 return ret; 325 return ret;
330} 326}
331 327
@@ -337,7 +333,7 @@ static inline void dquot_free_space_nodirty(struct inode *inode, qsize_t nr)
337static inline void dquot_free_space(struct inode *inode, qsize_t nr) 333static inline void dquot_free_space(struct inode *inode, qsize_t nr)
338{ 334{
339 dquot_free_space_nodirty(inode, nr); 335 dquot_free_space_nodirty(inode, nr);
340 mark_inode_dirty(inode); 336 mark_inode_dirty_sync(inode);
341} 337}
342 338
343static inline void dquot_free_block_nodirty(struct inode *inode, qsize_t nr) 339static inline void dquot_free_block_nodirty(struct inode *inode, qsize_t nr)
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 55ca73cf25e5..634b8e674ac5 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -55,7 +55,7 @@ static inline int radix_tree_is_indirect_ptr(void *ptr)
55 55
56/*** radix-tree API starts here ***/ 56/*** radix-tree API starts here ***/
57 57
58#define RADIX_TREE_MAX_TAGS 2 58#define RADIX_TREE_MAX_TAGS 3
59 59
60/* root tags are stored in gfp_mask, shifted by __GFP_BITS_SHIFT */ 60/* root tags are stored in gfp_mask, shifted by __GFP_BITS_SHIFT */
61struct radix_tree_root { 61struct radix_tree_root {
@@ -192,6 +192,10 @@ unsigned int
192radix_tree_gang_lookup_tag_slot(struct radix_tree_root *root, void ***results, 192radix_tree_gang_lookup_tag_slot(struct radix_tree_root *root, void ***results,
193 unsigned long first_index, unsigned int max_items, 193 unsigned long first_index, unsigned int max_items,
194 unsigned int tag); 194 unsigned int tag);
195unsigned long radix_tree_range_tag_if_tagged(struct radix_tree_root *root,
196 unsigned long *first_indexp, unsigned long last_index,
197 unsigned long nr_to_tag,
198 unsigned int fromtag, unsigned int totag);
195int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag); 199int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag);
196 200
197static inline void radix_tree_preload_end(void) 201static inline void radix_tree_preload_end(void)
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
index 1cbbd2c11aa9..2b59cc824395 100644
--- a/include/linux/raid/pq.h
+++ b/include/linux/raid/pq.h
@@ -62,7 +62,9 @@ extern const char raid6_empty_zero_page[PAGE_SIZE];
62#define disable_kernel_altivec() 62#define disable_kernel_altivec()
63 63
64#define EXPORT_SYMBOL(sym) 64#define EXPORT_SYMBOL(sym)
65#define EXPORT_SYMBOL_GPL(sym)
65#define MODULE_LICENSE(licence) 66#define MODULE_LICENSE(licence)
67#define MODULE_DESCRIPTION(desc)
66#define subsys_initcall(x) 68#define subsys_initcall(x)
67#define module_exit(x) 69#define module_exit(x)
68#endif /* __KERNEL__ */ 70#endif /* __KERNEL__ */
diff --git a/include/linux/rar_register.h b/include/linux/rar_register.h
new file mode 100644
index 000000000000..ffa805780f85
--- /dev/null
+++ b/include/linux/rar_register.h
@@ -0,0 +1,44 @@
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
37int register_rar(int num,
38 int (*callback)(unsigned long data), unsigned long data);
39void unregister_rar(int num);
40int rar_get_address(int rar_index, dma_addr_t *start, dma_addr_t *end);
41int rar_lock(int rar_index);
42
43#endif /* __KERNEL__ */
44#endif /* _RAR_REGISTER_H */
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index b653b4aaa8a6..9fbc54a2585d 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -40,6 +40,7 @@
40#include <linux/seqlock.h> 40#include <linux/seqlock.h>
41#include <linux/lockdep.h> 41#include <linux/lockdep.h>
42#include <linux/completion.h> 42#include <linux/completion.h>
43#include <linux/debugobjects.h>
43 44
44#ifdef CONFIG_RCU_TORTURE_TEST 45#ifdef CONFIG_RCU_TORTURE_TEST
45extern int rcutorture_runnable; /* for sysctl */ 46extern int rcutorture_runnable; /* for sysctl */
@@ -79,6 +80,16 @@ extern void rcu_init(void);
79 (ptr)->next = NULL; (ptr)->func = NULL; \ 80 (ptr)->next = NULL; (ptr)->func = NULL; \
80} while (0) 81} while (0)
81 82
83/*
84 * init_rcu_head_on_stack()/destroy_rcu_head_on_stack() are needed for dynamic
85 * initialization and destruction of rcu_head on the stack. rcu_head structures
86 * allocated dynamically in the heap or defined statically don't need any
87 * initialization.
88 */
89#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
90extern void init_rcu_head_on_stack(struct rcu_head *head);
91extern void destroy_rcu_head_on_stack(struct rcu_head *head);
92#else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
82static inline void init_rcu_head_on_stack(struct rcu_head *head) 93static inline void init_rcu_head_on_stack(struct rcu_head *head)
83{ 94{
84} 95}
@@ -86,6 +97,7 @@ static inline void init_rcu_head_on_stack(struct rcu_head *head)
86static inline void destroy_rcu_head_on_stack(struct rcu_head *head) 97static inline void destroy_rcu_head_on_stack(struct rcu_head *head)
87{ 98{
88} 99}
100#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
89 101
90#ifdef CONFIG_DEBUG_LOCK_ALLOC 102#ifdef CONFIG_DEBUG_LOCK_ALLOC
91 103
@@ -517,4 +529,74 @@ extern void call_rcu(struct rcu_head *head,
517extern void call_rcu_bh(struct rcu_head *head, 529extern void call_rcu_bh(struct rcu_head *head,
518 void (*func)(struct rcu_head *head)); 530 void (*func)(struct rcu_head *head));
519 531
532/*
533 * debug_rcu_head_queue()/debug_rcu_head_unqueue() are used internally
534 * by call_rcu() and rcu callback execution, and are therefore not part of the
535 * RCU API. Leaving in rcupdate.h because they are used by all RCU flavors.
536 */
537
538#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
539# define STATE_RCU_HEAD_READY 0
540# define STATE_RCU_HEAD_QUEUED 1
541
542extern struct debug_obj_descr rcuhead_debug_descr;
543
544static inline void debug_rcu_head_queue(struct rcu_head *head)
545{
546 debug_object_activate(head, &rcuhead_debug_descr);
547 debug_object_active_state(head, &rcuhead_debug_descr,
548 STATE_RCU_HEAD_READY,
549 STATE_RCU_HEAD_QUEUED);
550}
551
552static inline void debug_rcu_head_unqueue(struct rcu_head *head)
553{
554 debug_object_active_state(head, &rcuhead_debug_descr,
555 STATE_RCU_HEAD_QUEUED,
556 STATE_RCU_HEAD_READY);
557 debug_object_deactivate(head, &rcuhead_debug_descr);
558}
559#else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
560static inline void debug_rcu_head_queue(struct rcu_head *head)
561{
562}
563
564static inline void debug_rcu_head_unqueue(struct rcu_head *head)
565{
566}
567#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
568
569#ifndef CONFIG_PROVE_RCU
570#define __do_rcu_dereference_check(c) do { } while (0)
571#endif /* #ifdef CONFIG_PROVE_RCU */
572
573#define __rcu_dereference_index_check(p, c) \
574 ({ \
575 typeof(p) _________p1 = ACCESS_ONCE(p); \
576 __do_rcu_dereference_check(c); \
577 smp_read_barrier_depends(); \
578 (_________p1); \
579 })
580
581/**
582 * rcu_dereference_index_check() - rcu_dereference for indices with debug checking
583 * @p: The pointer to read, prior to dereferencing
584 * @c: The conditions under which the dereference will take place
585 *
586 * Similar to rcu_dereference_check(), but omits the sparse checking.
587 * This allows rcu_dereference_index_check() to be used on integers,
588 * which can then be used as array indices. Attempting to use
589 * rcu_dereference_check() on an integer will give compiler warnings
590 * because the sparse address-space mechanism relies on dereferencing
591 * the RCU-protected pointer. Dereferencing integers is not something
592 * that even gcc will put up with.
593 *
594 * Note that this function does not implicitly check for RCU read-side
595 * critical sections. If this function gains lots of uses, it might
596 * make sense to provide versions for each flavor of RCU, but it does
597 * not make sense as of early 2010.
598 */
599#define rcu_dereference_index_check(p, c) \
600 __rcu_dereference_index_check((p), (c))
601
520#endif /* __LINUX_RCUPDATE_H */ 602#endif /* __LINUX_RCUPDATE_H */
diff --git a/include/linux/rds.h b/include/linux/rds.h
index cab4994c2f63..24bce3ded9ea 100644
--- a/include/linux/rds.h
+++ b/include/linux/rds.h
@@ -100,7 +100,7 @@
100struct rds_info_counter { 100struct rds_info_counter {
101 u_int8_t name[32]; 101 u_int8_t name[32];
102 u_int64_t value; 102 u_int64_t value;
103} __attribute__((packed)); 103} __packed;
104 104
105#define RDS_INFO_CONNECTION_FLAG_SENDING 0x01 105#define RDS_INFO_CONNECTION_FLAG_SENDING 0x01
106#define RDS_INFO_CONNECTION_FLAG_CONNECTING 0x02 106#define RDS_INFO_CONNECTION_FLAG_CONNECTING 0x02
@@ -115,7 +115,7 @@ struct rds_info_connection {
115 __be32 faddr; 115 __be32 faddr;
116 u_int8_t transport[TRANSNAMSIZ]; /* null term ascii */ 116 u_int8_t transport[TRANSNAMSIZ]; /* null term ascii */
117 u_int8_t flags; 117 u_int8_t flags;
118} __attribute__((packed)); 118} __packed;
119 119
120struct rds_info_flow { 120struct rds_info_flow {
121 __be32 laddr; 121 __be32 laddr;
@@ -123,7 +123,7 @@ struct rds_info_flow {
123 u_int32_t bytes; 123 u_int32_t bytes;
124 __be16 lport; 124 __be16 lport;
125 __be16 fport; 125 __be16 fport;
126} __attribute__((packed)); 126} __packed;
127 127
128#define RDS_INFO_MESSAGE_FLAG_ACK 0x01 128#define RDS_INFO_MESSAGE_FLAG_ACK 0x01
129#define RDS_INFO_MESSAGE_FLAG_FAST_ACK 0x02 129#define RDS_INFO_MESSAGE_FLAG_FAST_ACK 0x02
@@ -136,7 +136,7 @@ struct rds_info_message {
136 __be16 lport; 136 __be16 lport;
137 __be16 fport; 137 __be16 fport;
138 u_int8_t flags; 138 u_int8_t flags;
139} __attribute__((packed)); 139} __packed;
140 140
141struct rds_info_socket { 141struct rds_info_socket {
142 u_int32_t sndbuf; 142 u_int32_t sndbuf;
@@ -146,7 +146,7 @@ struct rds_info_socket {
146 __be16 connected_port; 146 __be16 connected_port;
147 u_int32_t rcvbuf; 147 u_int32_t rcvbuf;
148 u_int64_t inum; 148 u_int64_t inum;
149} __attribute__((packed)); 149} __packed;
150 150
151struct rds_info_tcp_socket { 151struct rds_info_tcp_socket {
152 __be32 local_addr; 152 __be32 local_addr;
@@ -158,7 +158,7 @@ struct rds_info_tcp_socket {
158 u_int32_t last_sent_nxt; 158 u_int32_t last_sent_nxt;
159 u_int32_t last_expected_una; 159 u_int32_t last_expected_una;
160 u_int32_t last_seen_una; 160 u_int32_t last_seen_una;
161} __attribute__((packed)); 161} __packed;
162 162
163#define RDS_IB_GID_LEN 16 163#define RDS_IB_GID_LEN 16
164struct rds_info_rdma_connection { 164struct rds_info_rdma_connection {
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
new file mode 100644
index 000000000000..f509877c2ed4
--- /dev/null
+++ b/include/linux/regulator/ab8500.h
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License Terms: GNU General Public License v2
5 *
6 * Author: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson
7 *
8 */
9
10#ifndef __LINUX_MFD_AB8500_REGULATOR_H
11#define __LINUX_MFD_AB8500_REGULATOR_H
12
13/* AB8500 regulators */
14#define AB8500_LDO_AUX1 0
15#define AB8500_LDO_AUX2 1
16#define AB8500_LDO_AUX3 2
17#define AB8500_LDO_INTCORE 3
18#define AB8500_LDO_TVOUT 4
19#define AB8500_LDO_AUDIO 5
20#define AB8500_LDO_ANAMIC1 6
21#define AB8500_LDO_ANAMIC2 7
22#define AB8500_LDO_DMIC 8
23#define AB8500_LDO_ANA 9
24
25#endif
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 3b603f474186..91a4177e60ce 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -360,7 +360,7 @@ int is_reiserfs_jr(struct reiserfs_super_block *rs);
360/* the spot for the super in versions 3.5 - 3.5.10 (inclusive) */ 360/* the spot for the super in versions 3.5 - 3.5.10 (inclusive) */
361#define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024) 361#define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024)
362 362
363// reiserfs internal error code (used by search_by_key adn fix_nodes)) 363/* reiserfs internal error code (used by search_by_key and fix_nodes)) */
364#define CARRY_ON 0 364#define CARRY_ON 0
365#define REPEAT_SEARCH -1 365#define REPEAT_SEARCH -1
366#define IO_ERROR -2 366#define IO_ERROR -2
@@ -2033,7 +2033,7 @@ void reiserfs_read_locked_inode(struct inode *inode,
2033 struct reiserfs_iget_args *args); 2033 struct reiserfs_iget_args *args);
2034int reiserfs_find_actor(struct inode *inode, void *p); 2034int reiserfs_find_actor(struct inode *inode, void *p);
2035int reiserfs_init_locked_inode(struct inode *inode, void *p); 2035int reiserfs_init_locked_inode(struct inode *inode, void *p);
2036void reiserfs_delete_inode(struct inode *inode); 2036void reiserfs_evict_inode(struct inode *inode);
2037int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc); 2037int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc);
2038int reiserfs_get_block(struct inode *inode, sector_t block, 2038int reiserfs_get_block(struct inode *inode, sector_t block,
2039 struct buffer_head *bh_result, int create); 2039 struct buffer_head *bh_result, int create);
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h
index 89f4d3abbf5a..97959bdfe214 100644
--- a/include/linux/reiserfs_fs_i.h
+++ b/include/linux/reiserfs_fs_i.h
@@ -25,7 +25,6 @@ typedef enum {
25 i_link_saved_truncate_mask = 0x0020, 25 i_link_saved_truncate_mask = 0x0020,
26 i_has_xattr_dir = 0x0040, 26 i_has_xattr_dir = 0x0040,
27 i_data_log = 0x0080, 27 i_data_log = 0x0080,
28 i_ever_mapped = 0x0100
29} reiserfs_inode_flags; 28} reiserfs_inode_flags;
30 29
31struct reiserfs_inode_info { 30struct reiserfs_inode_info {
@@ -53,7 +52,8 @@ struct reiserfs_inode_info {
53 ** flushed */ 52 ** flushed */
54 unsigned int i_trans_id; 53 unsigned int i_trans_id;
55 struct reiserfs_journal_list *i_jl; 54 struct reiserfs_journal_list *i_jl;
56 struct mutex i_mmap; 55 atomic_t openers;
56 struct mutex tailpack;
57#ifdef CONFIG_REISERFS_FS_XATTR 57#ifdef CONFIG_REISERFS_FS_XATTR
58 struct rw_semaphore i_xattr_sem; 58 struct rw_semaphore i_xattr_sem;
59#endif 59#endif
diff --git a/include/linux/resource.h b/include/linux/resource.h
index f1e914eefeab..88d36f9145ba 100644
--- a/include/linux/resource.h
+++ b/include/linux/resource.h
@@ -43,6 +43,13 @@ struct rlimit {
43 unsigned long rlim_max; 43 unsigned long rlim_max;
44}; 44};
45 45
46#define RLIM64_INFINITY (~0ULL)
47
48struct rlimit64 {
49 __u64 rlim_cur;
50 __u64 rlim_max;
51};
52
46#define PRIO_MIN (-20) 53#define PRIO_MIN (-20)
47#define PRIO_MAX 20 54#define PRIO_MAX 20
48 55
@@ -73,6 +80,8 @@ struct rlimit {
73struct task_struct; 80struct task_struct;
74 81
75int getrusage(struct task_struct *p, int who, struct rusage __user *ru); 82int getrusage(struct task_struct *p, int who, struct rusage __user *ru);
83int do_prlimit(struct task_struct *tsk, unsigned int resource,
84 struct rlimit *new_rlim, struct rlimit *old_rlim);
76 85
77#endif /* __KERNEL__ */ 86#endif /* __KERNEL__ */
78 87
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 77216742c178..31b2fd75dcba 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -26,6 +26,7 @@
26 */ 26 */
27struct anon_vma { 27struct anon_vma {
28 spinlock_t lock; /* Serialize access to vma list */ 28 spinlock_t lock; /* Serialize access to vma list */
29 struct anon_vma *root; /* Root of this anon_vma tree */
29#if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION) 30#if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION)
30 31
31 /* 32 /*
@@ -80,6 +81,13 @@ static inline int anonvma_external_refcount(struct anon_vma *anon_vma)
80{ 81{
81 return atomic_read(&anon_vma->external_refcount); 82 return atomic_read(&anon_vma->external_refcount);
82} 83}
84
85static inline void get_anon_vma(struct anon_vma *anon_vma)
86{
87 atomic_inc(&anon_vma->external_refcount);
88}
89
90void drop_anon_vma(struct anon_vma *);
83#else 91#else
84static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma) 92static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma)
85{ 93{
@@ -89,6 +97,14 @@ static inline int anonvma_external_refcount(struct anon_vma *anon_vma)
89{ 97{
90 return 0; 98 return 0;
91} 99}
100
101static inline void get_anon_vma(struct anon_vma *anon_vma)
102{
103}
104
105static inline void drop_anon_vma(struct anon_vma *anon_vma)
106{
107}
92#endif /* CONFIG_KSM */ 108#endif /* CONFIG_KSM */
93 109
94static inline struct anon_vma *page_anon_vma(struct page *page) 110static inline struct anon_vma *page_anon_vma(struct page *page)
@@ -99,18 +115,28 @@ static inline struct anon_vma *page_anon_vma(struct page *page)
99 return page_rmapping(page); 115 return page_rmapping(page);
100} 116}
101 117
102static inline void anon_vma_lock(struct vm_area_struct *vma) 118static inline void vma_lock_anon_vma(struct vm_area_struct *vma)
103{ 119{
104 struct anon_vma *anon_vma = vma->anon_vma; 120 struct anon_vma *anon_vma = vma->anon_vma;
105 if (anon_vma) 121 if (anon_vma)
106 spin_lock(&anon_vma->lock); 122 spin_lock(&anon_vma->root->lock);
107} 123}
108 124
109static inline void anon_vma_unlock(struct vm_area_struct *vma) 125static inline void vma_unlock_anon_vma(struct vm_area_struct *vma)
110{ 126{
111 struct anon_vma *anon_vma = vma->anon_vma; 127 struct anon_vma *anon_vma = vma->anon_vma;
112 if (anon_vma) 128 if (anon_vma)
113 spin_unlock(&anon_vma->lock); 129 spin_unlock(&anon_vma->root->lock);
130}
131
132static inline void anon_vma_lock(struct anon_vma *anon_vma)
133{
134 spin_lock(&anon_vma->root->lock);
135}
136
137static inline void anon_vma_unlock(struct anon_vma *anon_vma)
138{
139 spin_unlock(&anon_vma->root->lock);
114} 140}
115 141
116/* 142/*
@@ -136,10 +162,17 @@ static inline void anon_vma_merge(struct vm_area_struct *vma,
136 */ 162 */
137void page_move_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 163void page_move_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
138void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 164void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
165void do_page_add_anon_rmap(struct page *, struct vm_area_struct *,
166 unsigned long, int);
139void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 167void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
140void page_add_file_rmap(struct page *); 168void page_add_file_rmap(struct page *);
141void page_remove_rmap(struct page *); 169void page_remove_rmap(struct page *);
142 170
171void hugepage_add_anon_rmap(struct page *, struct vm_area_struct *,
172 unsigned long);
173void hugepage_add_new_anon_rmap(struct page *, struct vm_area_struct *,
174 unsigned long);
175
143static inline void page_dup_rmap(struct page *page) 176static inline void page_dup_rmap(struct page *page)
144{ 177{
145 atomic_inc(&page->_mapcount); 178 atomic_inc(&page->_mapcount);
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index fbc8cb0d48c3..58d44491880f 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -282,6 +282,7 @@ enum rtattr_type_t {
282 RTA_SESSION, /* no longer used */ 282 RTA_SESSION, /* no longer used */
283 RTA_MP_ALGO, /* no longer used */ 283 RTA_MP_ALGO, /* no longer used */
284 RTA_TABLE, 284 RTA_TABLE,
285 RTA_MARK,
285 __RTA_MAX 286 __RTA_MAX
286}; 287};
287 288
diff --git a/include/linux/s3c_adc_battery.h b/include/linux/s3c_adc_battery.h
new file mode 100644
index 000000000000..dbce22faa660
--- /dev/null
+++ b/include/linux/s3c_adc_battery.h
@@ -0,0 +1,36 @@
1#ifndef _S3C_ADC_BATTERY_H
2#define _S3C_ADC_BATTERY_H
3
4struct s3c_adc_bat_thresh {
5 int volt; /* mV */
6 int cur; /* mA */
7 int level; /* percent */
8};
9
10struct s3c_adc_bat_pdata {
11 int (*init)(void);
12 void (*exit)(void);
13 void (*enable_charger)(void);
14 void (*disable_charger)(void);
15
16 int gpio_charge_finished;
17
18 const struct s3c_adc_bat_thresh *lut_noac;
19 unsigned int lut_noac_cnt;
20 const struct s3c_adc_bat_thresh *lut_acin;
21 unsigned int lut_acin_cnt;
22
23 const unsigned int volt_channel;
24 const unsigned int current_channel;
25 const unsigned int backup_volt_channel;
26
27 const unsigned int volt_mult;
28 const unsigned int current_mult;
29 const unsigned int backup_volt_mult;
30 const unsigned int internal_impedance;
31
32 const unsigned int backup_volt_max;
33 const unsigned int backup_volt_min;
34};
35
36#endif
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 0478888c6899..ce160d68f5e7 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -272,19 +272,10 @@ extern int runqueue_is_locked(int cpu);
272 272
273extern cpumask_var_t nohz_cpu_mask; 273extern cpumask_var_t nohz_cpu_mask;
274#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) 274#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
275extern int select_nohz_load_balancer(int cpu); 275extern void select_nohz_load_balancer(int stop_tick);
276extern int get_nohz_load_balancer(void); 276extern int get_nohz_timer_target(void);
277extern int nohz_ratelimit(int cpu);
278#else 277#else
279static inline int select_nohz_load_balancer(int cpu) 278static inline void select_nohz_load_balancer(int stop_tick) { }
280{
281 return 0;
282}
283
284static inline int nohz_ratelimit(int cpu)
285{
286 return 0;
287}
288#endif 279#endif
289 280
290/* 281/*
@@ -316,20 +307,16 @@ extern void scheduler_tick(void);
316 307
317extern void sched_show_task(struct task_struct *p); 308extern void sched_show_task(struct task_struct *p);
318 309
319#ifdef CONFIG_DETECT_SOFTLOCKUP 310#ifdef CONFIG_LOCKUP_DETECTOR
320extern void softlockup_tick(void);
321extern void touch_softlockup_watchdog(void); 311extern void touch_softlockup_watchdog(void);
322extern void touch_softlockup_watchdog_sync(void); 312extern void touch_softlockup_watchdog_sync(void);
323extern void touch_all_softlockup_watchdogs(void); 313extern void touch_all_softlockup_watchdogs(void);
324extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write, 314extern int proc_dowatchdog_thresh(struct ctl_table *table, int write,
325 void __user *buffer, 315 void __user *buffer,
326 size_t *lenp, loff_t *ppos); 316 size_t *lenp, loff_t *ppos);
327extern unsigned int softlockup_panic; 317extern unsigned int softlockup_panic;
328extern int softlockup_thresh; 318extern int softlockup_thresh;
329#else 319#else
330static inline void softlockup_tick(void)
331{
332}
333static inline void touch_softlockup_watchdog(void) 320static inline void touch_softlockup_watchdog(void)
334{ 321{
335} 322}
@@ -634,7 +621,8 @@ struct signal_struct {
634 struct tty_audit_buf *tty_audit_buf; 621 struct tty_audit_buf *tty_audit_buf;
635#endif 622#endif
636 623
637 int oom_adj; /* OOM kill score adjustment (bit shift) */ 624 int oom_adj; /* OOM kill score adjustment (bit shift) */
625 int oom_score_adj; /* OOM kill score adjustment */
638}; 626};
639 627
640/* Context switch must be unlocked if interrupts are to be enabled */ 628/* Context switch must be unlocked if interrupts are to be enabled */
@@ -805,7 +793,7 @@ enum cpu_idle_type {
805#define SD_POWERSAVINGS_BALANCE 0x0100 /* Balance for power savings */ 793#define SD_POWERSAVINGS_BALANCE 0x0100 /* Balance for power savings */
806#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */ 794#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */
807#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */ 795#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */
808 796#define SD_ASYM_PACKING 0x0800 /* Place busy groups earlier in the domain */
809#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */ 797#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */
810 798
811enum powersavings_balance_level { 799enum powersavings_balance_level {
@@ -840,6 +828,8 @@ static inline int sd_balance_for_package_power(void)
840 return SD_PREFER_SIBLING; 828 return SD_PREFER_SIBLING;
841} 829}
842 830
831extern int __weak arch_sd_sibiling_asym_packing(void);
832
843/* 833/*
844 * Optimise SD flags for power savings: 834 * Optimise SD flags for power savings:
845 * SD_BALANCE_NEWIDLE helps agressive task consolidation and power savings. 835 * SD_BALANCE_NEWIDLE helps agressive task consolidation and power savings.
@@ -861,7 +851,7 @@ struct sched_group {
861 * CPU power of this group, SCHED_LOAD_SCALE being max power for a 851 * CPU power of this group, SCHED_LOAD_SCALE being max power for a
862 * single CPU. 852 * single CPU.
863 */ 853 */
864 unsigned int cpu_power; 854 unsigned int cpu_power, cpu_power_orig;
865 855
866 /* 856 /*
867 * The CPUs this group covers. 857 * The CPUs this group covers.
@@ -1697,6 +1687,7 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1697#define PF_EXITING 0x00000004 /* getting shut down */ 1687#define PF_EXITING 0x00000004 /* getting shut down */
1698#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ 1688#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */
1699#define PF_VCPU 0x00000010 /* I'm a virtual CPU */ 1689#define PF_VCPU 0x00000010 /* I'm a virtual CPU */
1690#define PF_WQ_WORKER 0x00000020 /* I'm a workqueue worker */
1700#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */ 1691#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */
1701#define PF_MCE_PROCESS 0x00000080 /* process policy on mce errors */ 1692#define PF_MCE_PROCESS 0x00000080 /* process policy on mce errors */
1702#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */ 1693#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */
@@ -1791,20 +1782,23 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1791#endif 1782#endif
1792 1783
1793/* 1784/*
1794 * Architectures can set this to 1 if they have specified 1785 * Do not use outside of architecture code which knows its limitations.
1795 * CONFIG_HAVE_UNSTABLE_SCHED_CLOCK in their arch Kconfig, 1786 *
1796 * but then during bootup it turns out that sched_clock() 1787 * sched_clock() has no promise of monotonicity or bounded drift between
1797 * is reliable after all: 1788 * CPUs, use (which you should not) requires disabling IRQs.
1789 *
1790 * Please use one of the three interfaces below.
1798 */ 1791 */
1799#ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
1800extern int sched_clock_stable;
1801#endif
1802
1803/* ftrace calls sched_clock() directly */
1804extern unsigned long long notrace sched_clock(void); 1792extern unsigned long long notrace sched_clock(void);
1793/*
1794 * See the comment in kernel/sched_clock.c
1795 */
1796extern u64 cpu_clock(int cpu);
1797extern u64 local_clock(void);
1798extern u64 sched_clock_cpu(int cpu);
1799
1805 1800
1806extern void sched_clock_init(void); 1801extern void sched_clock_init(void);
1807extern u64 sched_clock_cpu(int cpu);
1808 1802
1809#ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK 1803#ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
1810static inline void sched_clock_tick(void) 1804static inline void sched_clock_tick(void)
@@ -1819,17 +1813,19 @@ static inline void sched_clock_idle_wakeup_event(u64 delta_ns)
1819{ 1813{
1820} 1814}
1821#else 1815#else
1816/*
1817 * Architectures can set this to 1 if they have specified
1818 * CONFIG_HAVE_UNSTABLE_SCHED_CLOCK in their arch Kconfig,
1819 * but then during bootup it turns out that sched_clock()
1820 * is reliable after all:
1821 */
1822extern int sched_clock_stable;
1823
1822extern void sched_clock_tick(void); 1824extern void sched_clock_tick(void);
1823extern void sched_clock_idle_sleep_event(void); 1825extern void sched_clock_idle_sleep_event(void);
1824extern void sched_clock_idle_wakeup_event(u64 delta_ns); 1826extern void sched_clock_idle_wakeup_event(u64 delta_ns);
1825#endif 1827#endif
1826 1828
1827/*
1828 * For kernel-internal use: high-speed (but slightly incorrect) per-cpu
1829 * clock constructed from sched_clock():
1830 */
1831extern unsigned long long cpu_clock(int cpu);
1832
1833extern unsigned long long 1829extern unsigned long long
1834task_sched_runtime(struct task_struct *task); 1830task_sched_runtime(struct task_struct *task);
1835extern unsigned long long thread_group_sched_runtime(struct task_struct *task); 1831extern unsigned long long thread_group_sched_runtime(struct task_struct *task);
@@ -2435,18 +2431,6 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
2435 2431
2436#endif /* CONFIG_SMP */ 2432#endif /* CONFIG_SMP */
2437 2433
2438#ifdef CONFIG_TRACING
2439extern void
2440__trace_special(void *__tr, void *__data,
2441 unsigned long arg1, unsigned long arg2, unsigned long arg3);
2442#else
2443static inline void
2444__trace_special(void *__tr, void *__data,
2445 unsigned long arg1, unsigned long arg2, unsigned long arg3)
2446{
2447}
2448#endif
2449
2450extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask); 2434extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask);
2451extern long sched_getaffinity(pid_t pid, struct cpumask *mask); 2435extern long sched_getaffinity(pid_t pid, struct cpumask *mask);
2452 2436
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index c20d3ce673c0..c11a28706fa4 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -61,7 +61,7 @@ typedef struct sctphdr {
61 __be16 dest; 61 __be16 dest;
62 __be32 vtag; 62 __be32 vtag;
63 __le32 checksum; 63 __le32 checksum;
64} __attribute__((packed)) sctp_sctphdr_t; 64} __packed sctp_sctphdr_t;
65 65
66#ifdef __KERNEL__ 66#ifdef __KERNEL__
67#include <linux/skbuff.h> 67#include <linux/skbuff.h>
@@ -77,7 +77,7 @@ typedef struct sctp_chunkhdr {
77 __u8 type; 77 __u8 type;
78 __u8 flags; 78 __u8 flags;
79 __be16 length; 79 __be16 length;
80} __attribute__((packed)) sctp_chunkhdr_t; 80} __packed sctp_chunkhdr_t;
81 81
82 82
83/* Section 3.2. Chunk Type Values. 83/* Section 3.2. Chunk Type Values.
@@ -167,7 +167,7 @@ enum { SCTP_CHUNK_FLAG_T = 0x01 };
167typedef struct sctp_paramhdr { 167typedef struct sctp_paramhdr {
168 __be16 type; 168 __be16 type;
169 __be16 length; 169 __be16 length;
170} __attribute__((packed)) sctp_paramhdr_t; 170} __packed sctp_paramhdr_t;
171 171
172typedef enum { 172typedef enum {
173 173
@@ -228,12 +228,12 @@ typedef struct sctp_datahdr {
228 __be16 ssn; 228 __be16 ssn;
229 __be32 ppid; 229 __be32 ppid;
230 __u8 payload[0]; 230 __u8 payload[0];
231} __attribute__((packed)) sctp_datahdr_t; 231} __packed sctp_datahdr_t;
232 232
233typedef struct sctp_data_chunk { 233typedef struct sctp_data_chunk {
234 sctp_chunkhdr_t chunk_hdr; 234 sctp_chunkhdr_t chunk_hdr;
235 sctp_datahdr_t data_hdr; 235 sctp_datahdr_t data_hdr;
236} __attribute__((packed)) sctp_data_chunk_t; 236} __packed sctp_data_chunk_t;
237 237
238/* DATA Chuck Specific Flags */ 238/* DATA Chuck Specific Flags */
239enum { 239enum {
@@ -259,78 +259,78 @@ typedef struct sctp_inithdr {
259 __be16 num_inbound_streams; 259 __be16 num_inbound_streams;
260 __be32 initial_tsn; 260 __be32 initial_tsn;
261 __u8 params[0]; 261 __u8 params[0];
262} __attribute__((packed)) sctp_inithdr_t; 262} __packed sctp_inithdr_t;
263 263
264typedef struct sctp_init_chunk { 264typedef struct sctp_init_chunk {
265 sctp_chunkhdr_t chunk_hdr; 265 sctp_chunkhdr_t chunk_hdr;
266 sctp_inithdr_t init_hdr; 266 sctp_inithdr_t init_hdr;
267} __attribute__((packed)) sctp_init_chunk_t; 267} __packed sctp_init_chunk_t;
268 268
269 269
270/* Section 3.3.2.1. IPv4 Address Parameter (5) */ 270/* Section 3.3.2.1. IPv4 Address Parameter (5) */
271typedef struct sctp_ipv4addr_param { 271typedef struct sctp_ipv4addr_param {
272 sctp_paramhdr_t param_hdr; 272 sctp_paramhdr_t param_hdr;
273 struct in_addr addr; 273 struct in_addr addr;
274} __attribute__((packed)) sctp_ipv4addr_param_t; 274} __packed sctp_ipv4addr_param_t;
275 275
276/* Section 3.3.2.1. IPv6 Address Parameter (6) */ 276/* Section 3.3.2.1. IPv6 Address Parameter (6) */
277typedef struct sctp_ipv6addr_param { 277typedef struct sctp_ipv6addr_param {
278 sctp_paramhdr_t param_hdr; 278 sctp_paramhdr_t param_hdr;
279 struct in6_addr addr; 279 struct in6_addr addr;
280} __attribute__((packed)) sctp_ipv6addr_param_t; 280} __packed sctp_ipv6addr_param_t;
281 281
282/* Section 3.3.2.1 Cookie Preservative (9) */ 282/* Section 3.3.2.1 Cookie Preservative (9) */
283typedef struct sctp_cookie_preserve_param { 283typedef struct sctp_cookie_preserve_param {
284 sctp_paramhdr_t param_hdr; 284 sctp_paramhdr_t param_hdr;
285 __be32 lifespan_increment; 285 __be32 lifespan_increment;
286} __attribute__((packed)) sctp_cookie_preserve_param_t; 286} __packed sctp_cookie_preserve_param_t;
287 287
288/* Section 3.3.2.1 Host Name Address (11) */ 288/* Section 3.3.2.1 Host Name Address (11) */
289typedef struct sctp_hostname_param { 289typedef struct sctp_hostname_param {
290 sctp_paramhdr_t param_hdr; 290 sctp_paramhdr_t param_hdr;
291 uint8_t hostname[0]; 291 uint8_t hostname[0];
292} __attribute__((packed)) sctp_hostname_param_t; 292} __packed sctp_hostname_param_t;
293 293
294/* Section 3.3.2.1 Supported Address Types (12) */ 294/* Section 3.3.2.1 Supported Address Types (12) */
295typedef struct sctp_supported_addrs_param { 295typedef struct sctp_supported_addrs_param {
296 sctp_paramhdr_t param_hdr; 296 sctp_paramhdr_t param_hdr;
297 __be16 types[0]; 297 __be16 types[0];
298} __attribute__((packed)) sctp_supported_addrs_param_t; 298} __packed sctp_supported_addrs_param_t;
299 299
300/* Appendix A. ECN Capable (32768) */ 300/* Appendix A. ECN Capable (32768) */
301typedef struct sctp_ecn_capable_param { 301typedef struct sctp_ecn_capable_param {
302 sctp_paramhdr_t param_hdr; 302 sctp_paramhdr_t param_hdr;
303} __attribute__((packed)) sctp_ecn_capable_param_t; 303} __packed sctp_ecn_capable_param_t;
304 304
305/* ADDIP Section 3.2.6 Adaptation Layer Indication */ 305/* ADDIP Section 3.2.6 Adaptation Layer Indication */
306typedef struct sctp_adaptation_ind_param { 306typedef struct sctp_adaptation_ind_param {
307 struct sctp_paramhdr param_hdr; 307 struct sctp_paramhdr param_hdr;
308 __be32 adaptation_ind; 308 __be32 adaptation_ind;
309} __attribute__((packed)) sctp_adaptation_ind_param_t; 309} __packed sctp_adaptation_ind_param_t;
310 310
311/* ADDIP Section 4.2.7 Supported Extensions Parameter */ 311/* ADDIP Section 4.2.7 Supported Extensions Parameter */
312typedef struct sctp_supported_ext_param { 312typedef struct sctp_supported_ext_param {
313 struct sctp_paramhdr param_hdr; 313 struct sctp_paramhdr param_hdr;
314 __u8 chunks[0]; 314 __u8 chunks[0];
315} __attribute__((packed)) sctp_supported_ext_param_t; 315} __packed sctp_supported_ext_param_t;
316 316
317/* AUTH Section 3.1 Random */ 317/* AUTH Section 3.1 Random */
318typedef struct sctp_random_param { 318typedef struct sctp_random_param {
319 sctp_paramhdr_t param_hdr; 319 sctp_paramhdr_t param_hdr;
320 __u8 random_val[0]; 320 __u8 random_val[0];
321} __attribute__((packed)) sctp_random_param_t; 321} __packed sctp_random_param_t;
322 322
323/* AUTH Section 3.2 Chunk List */ 323/* AUTH Section 3.2 Chunk List */
324typedef struct sctp_chunks_param { 324typedef struct sctp_chunks_param {
325 sctp_paramhdr_t param_hdr; 325 sctp_paramhdr_t param_hdr;
326 __u8 chunks[0]; 326 __u8 chunks[0];
327} __attribute__((packed)) sctp_chunks_param_t; 327} __packed sctp_chunks_param_t;
328 328
329/* AUTH Section 3.3 HMAC Algorithm */ 329/* AUTH Section 3.3 HMAC Algorithm */
330typedef struct sctp_hmac_algo_param { 330typedef struct sctp_hmac_algo_param {
331 sctp_paramhdr_t param_hdr; 331 sctp_paramhdr_t param_hdr;
332 __be16 hmac_ids[0]; 332 __be16 hmac_ids[0];
333} __attribute__((packed)) sctp_hmac_algo_param_t; 333} __packed sctp_hmac_algo_param_t;
334 334
335/* RFC 2960. Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2): 335/* RFC 2960. Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2):
336 * The INIT ACK chunk is used to acknowledge the initiation of an SCTP 336 * The INIT ACK chunk is used to acknowledge the initiation of an SCTP
@@ -342,13 +342,13 @@ typedef sctp_init_chunk_t sctp_initack_chunk_t;
342typedef struct sctp_cookie_param { 342typedef struct sctp_cookie_param {
343 sctp_paramhdr_t p; 343 sctp_paramhdr_t p;
344 __u8 body[0]; 344 __u8 body[0];
345} __attribute__((packed)) sctp_cookie_param_t; 345} __packed sctp_cookie_param_t;
346 346
347/* Section 3.3.3.1 Unrecognized Parameters (8) */ 347/* Section 3.3.3.1 Unrecognized Parameters (8) */
348typedef struct sctp_unrecognized_param { 348typedef struct sctp_unrecognized_param {
349 sctp_paramhdr_t param_hdr; 349 sctp_paramhdr_t param_hdr;
350 sctp_paramhdr_t unrecognized; 350 sctp_paramhdr_t unrecognized;
351} __attribute__((packed)) sctp_unrecognized_param_t; 351} __packed sctp_unrecognized_param_t;
352 352
353 353
354 354
@@ -363,7 +363,7 @@ typedef struct sctp_unrecognized_param {
363typedef struct sctp_gap_ack_block { 363typedef struct sctp_gap_ack_block {
364 __be16 start; 364 __be16 start;
365 __be16 end; 365 __be16 end;
366} __attribute__((packed)) sctp_gap_ack_block_t; 366} __packed sctp_gap_ack_block_t;
367 367
368typedef __be32 sctp_dup_tsn_t; 368typedef __be32 sctp_dup_tsn_t;
369 369
@@ -378,12 +378,12 @@ typedef struct sctp_sackhdr {
378 __be16 num_gap_ack_blocks; 378 __be16 num_gap_ack_blocks;
379 __be16 num_dup_tsns; 379 __be16 num_dup_tsns;
380 sctp_sack_variable_t variable[0]; 380 sctp_sack_variable_t variable[0];
381} __attribute__((packed)) sctp_sackhdr_t; 381} __packed sctp_sackhdr_t;
382 382
383typedef struct sctp_sack_chunk { 383typedef struct sctp_sack_chunk {
384 sctp_chunkhdr_t chunk_hdr; 384 sctp_chunkhdr_t chunk_hdr;
385 sctp_sackhdr_t sack_hdr; 385 sctp_sackhdr_t sack_hdr;
386} __attribute__((packed)) sctp_sack_chunk_t; 386} __packed sctp_sack_chunk_t;
387 387
388 388
389/* RFC 2960. Section 3.3.5 Heartbeat Request (HEARTBEAT) (4): 389/* RFC 2960. Section 3.3.5 Heartbeat Request (HEARTBEAT) (4):
@@ -395,12 +395,12 @@ typedef struct sctp_sack_chunk {
395 395
396typedef struct sctp_heartbeathdr { 396typedef struct sctp_heartbeathdr {
397 sctp_paramhdr_t info; 397 sctp_paramhdr_t info;
398} __attribute__((packed)) sctp_heartbeathdr_t; 398} __packed sctp_heartbeathdr_t;
399 399
400typedef struct sctp_heartbeat_chunk { 400typedef struct sctp_heartbeat_chunk {
401 sctp_chunkhdr_t chunk_hdr; 401 sctp_chunkhdr_t chunk_hdr;
402 sctp_heartbeathdr_t hb_hdr; 402 sctp_heartbeathdr_t hb_hdr;
403} __attribute__((packed)) sctp_heartbeat_chunk_t; 403} __packed sctp_heartbeat_chunk_t;
404 404
405 405
406/* For the abort and shutdown ACK we must carry the init tag in the 406/* For the abort and shutdown ACK we must carry the init tag in the
@@ -409,7 +409,7 @@ typedef struct sctp_heartbeat_chunk {
409 */ 409 */
410typedef struct sctp_abort_chunk { 410typedef struct sctp_abort_chunk {
411 sctp_chunkhdr_t uh; 411 sctp_chunkhdr_t uh;
412} __attribute__((packed)) sctp_abort_chunk_t; 412} __packed sctp_abort_chunk_t;
413 413
414 414
415/* For the graceful shutdown we must carry the tag (in common header) 415/* For the graceful shutdown we must carry the tag (in common header)
@@ -417,12 +417,12 @@ typedef struct sctp_abort_chunk {
417 */ 417 */
418typedef struct sctp_shutdownhdr { 418typedef struct sctp_shutdownhdr {
419 __be32 cum_tsn_ack; 419 __be32 cum_tsn_ack;
420} __attribute__((packed)) sctp_shutdownhdr_t; 420} __packed sctp_shutdownhdr_t;
421 421
422struct sctp_shutdown_chunk_t { 422struct sctp_shutdown_chunk_t {
423 sctp_chunkhdr_t chunk_hdr; 423 sctp_chunkhdr_t chunk_hdr;
424 sctp_shutdownhdr_t shutdown_hdr; 424 sctp_shutdownhdr_t shutdown_hdr;
425} __attribute__ ((packed)); 425} __packed;
426 426
427/* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */ 427/* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */
428 428
@@ -430,12 +430,12 @@ typedef struct sctp_errhdr {
430 __be16 cause; 430 __be16 cause;
431 __be16 length; 431 __be16 length;
432 __u8 variable[0]; 432 __u8 variable[0];
433} __attribute__((packed)) sctp_errhdr_t; 433} __packed sctp_errhdr_t;
434 434
435typedef struct sctp_operr_chunk { 435typedef struct sctp_operr_chunk {
436 sctp_chunkhdr_t chunk_hdr; 436 sctp_chunkhdr_t chunk_hdr;
437 sctp_errhdr_t err_hdr; 437 sctp_errhdr_t err_hdr;
438} __attribute__((packed)) sctp_operr_chunk_t; 438} __packed sctp_operr_chunk_t;
439 439
440/* RFC 2960 3.3.10 - Operation Error 440/* RFC 2960 3.3.10 - Operation Error
441 * 441 *
@@ -525,7 +525,7 @@ typedef struct sctp_ecnehdr {
525typedef struct sctp_ecne_chunk { 525typedef struct sctp_ecne_chunk {
526 sctp_chunkhdr_t chunk_hdr; 526 sctp_chunkhdr_t chunk_hdr;
527 sctp_ecnehdr_t ence_hdr; 527 sctp_ecnehdr_t ence_hdr;
528} __attribute__((packed)) sctp_ecne_chunk_t; 528} __packed sctp_ecne_chunk_t;
529 529
530/* RFC 2960. Appendix A. Explicit Congestion Notification. 530/* RFC 2960. Appendix A. Explicit Congestion Notification.
531 * Congestion Window Reduced (CWR) (13) 531 * Congestion Window Reduced (CWR) (13)
@@ -537,7 +537,7 @@ typedef struct sctp_cwrhdr {
537typedef struct sctp_cwr_chunk { 537typedef struct sctp_cwr_chunk {
538 sctp_chunkhdr_t chunk_hdr; 538 sctp_chunkhdr_t chunk_hdr;
539 sctp_cwrhdr_t cwr_hdr; 539 sctp_cwrhdr_t cwr_hdr;
540} __attribute__((packed)) sctp_cwr_chunk_t; 540} __packed sctp_cwr_chunk_t;
541 541
542/* PR-SCTP 542/* PR-SCTP
543 * 3.2 Forward Cumulative TSN Chunk Definition (FORWARD TSN) 543 * 3.2 Forward Cumulative TSN Chunk Definition (FORWARD TSN)
@@ -588,17 +588,17 @@ typedef struct sctp_cwr_chunk {
588struct sctp_fwdtsn_skip { 588struct sctp_fwdtsn_skip {
589 __be16 stream; 589 __be16 stream;
590 __be16 ssn; 590 __be16 ssn;
591} __attribute__((packed)); 591} __packed;
592 592
593struct sctp_fwdtsn_hdr { 593struct sctp_fwdtsn_hdr {
594 __be32 new_cum_tsn; 594 __be32 new_cum_tsn;
595 struct sctp_fwdtsn_skip skip[0]; 595 struct sctp_fwdtsn_skip skip[0];
596} __attribute((packed)); 596} __packed;
597 597
598struct sctp_fwdtsn_chunk { 598struct sctp_fwdtsn_chunk {
599 struct sctp_chunkhdr chunk_hdr; 599 struct sctp_chunkhdr chunk_hdr;
600 struct sctp_fwdtsn_hdr fwdtsn_hdr; 600 struct sctp_fwdtsn_hdr fwdtsn_hdr;
601} __attribute((packed)); 601} __packed;
602 602
603 603
604/* ADDIP 604/* ADDIP
@@ -636,17 +636,17 @@ struct sctp_fwdtsn_chunk {
636typedef struct sctp_addip_param { 636typedef struct sctp_addip_param {
637 sctp_paramhdr_t param_hdr; 637 sctp_paramhdr_t param_hdr;
638 __be32 crr_id; 638 __be32 crr_id;
639} __attribute__((packed)) sctp_addip_param_t; 639} __packed sctp_addip_param_t;
640 640
641typedef struct sctp_addiphdr { 641typedef struct sctp_addiphdr {
642 __be32 serial; 642 __be32 serial;
643 __u8 params[0]; 643 __u8 params[0];
644} __attribute__((packed)) sctp_addiphdr_t; 644} __packed sctp_addiphdr_t;
645 645
646typedef struct sctp_addip_chunk { 646typedef struct sctp_addip_chunk {
647 sctp_chunkhdr_t chunk_hdr; 647 sctp_chunkhdr_t chunk_hdr;
648 sctp_addiphdr_t addip_hdr; 648 sctp_addiphdr_t addip_hdr;
649} __attribute__((packed)) sctp_addip_chunk_t; 649} __packed sctp_addip_chunk_t;
650 650
651/* AUTH 651/* AUTH
652 * Section 4.1 Authentication Chunk (AUTH) 652 * Section 4.1 Authentication Chunk (AUTH)
@@ -701,11 +701,11 @@ typedef struct sctp_authhdr {
701 __be16 shkey_id; 701 __be16 shkey_id;
702 __be16 hmac_id; 702 __be16 hmac_id;
703 __u8 hmac[0]; 703 __u8 hmac[0];
704} __attribute__((packed)) sctp_authhdr_t; 704} __packed sctp_authhdr_t;
705 705
706typedef struct sctp_auth_chunk { 706typedef struct sctp_auth_chunk {
707 sctp_chunkhdr_t chunk_hdr; 707 sctp_chunkhdr_t chunk_hdr;
708 sctp_authhdr_t auth_hdr; 708 sctp_authhdr_t auth_hdr;
709} __attribute__((packed)) sctp_auth_chunk_t; 709} __packed sctp_auth_chunk_t;
710 710
711#endif /* __LINUX_SCTP_H__ */ 711#endif /* __LINUX_SCTP_H__ */
diff --git a/include/linux/security.h b/include/linux/security.h
index 0c8819170463..a22219afff09 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -23,6 +23,7 @@
23#define __LINUX_SECURITY_H 23#define __LINUX_SECURITY_H
24 24
25#include <linux/fs.h> 25#include <linux/fs.h>
26#include <linux/fsnotify.h>
26#include <linux/binfmts.h> 27#include <linux/binfmts.h>
27#include <linux/signal.h> 28#include <linux/signal.h>
28#include <linux/resource.h> 29#include <linux/resource.h>
@@ -470,8 +471,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
470 * @path_truncate: 471 * @path_truncate:
471 * Check permission before truncating a file. 472 * Check permission before truncating a file.
472 * @path contains the path structure for the file. 473 * @path contains the path structure for the file.
473 * @length is the new length of the file.
474 * @time_attrs is the flags passed to do_truncate().
475 * Return 0 if permission is granted. 474 * Return 0 if permission is granted.
476 * @inode_getattr: 475 * @inode_getattr:
477 * Check permission before obtaining file attributes. 476 * Check permission before obtaining file attributes.
@@ -1412,8 +1411,7 @@ struct security_operations {
1412 int (*path_rmdir) (struct path *dir, struct dentry *dentry); 1411 int (*path_rmdir) (struct path *dir, struct dentry *dentry);
1413 int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode, 1412 int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode,
1414 unsigned int dev); 1413 unsigned int dev);
1415 int (*path_truncate) (struct path *path, loff_t length, 1414 int (*path_truncate) (struct path *path);
1416 unsigned int time_attrs);
1417 int (*path_symlink) (struct path *dir, struct dentry *dentry, 1415 int (*path_symlink) (struct path *dir, struct dentry *dentry,
1418 const char *old_name); 1416 const char *old_name);
1419 int (*path_link) (struct dentry *old_dentry, struct path *new_dir, 1417 int (*path_link) (struct dentry *old_dentry, struct path *new_dir,
@@ -1501,7 +1499,8 @@ struct security_operations {
1501 int (*task_setnice) (struct task_struct *p, int nice); 1499 int (*task_setnice) (struct task_struct *p, int nice);
1502 int (*task_setioprio) (struct task_struct *p, int ioprio); 1500 int (*task_setioprio) (struct task_struct *p, int ioprio);
1503 int (*task_getioprio) (struct task_struct *p); 1501 int (*task_getioprio) (struct task_struct *p);
1504 int (*task_setrlimit) (unsigned int resource, struct rlimit *new_rlim); 1502 int (*task_setrlimit) (struct task_struct *p, unsigned int resource,
1503 struct rlimit *new_rlim);
1505 int (*task_setscheduler) (struct task_struct *p, int policy, 1504 int (*task_setscheduler) (struct task_struct *p, int policy,
1506 struct sched_param *lp); 1505 struct sched_param *lp);
1507 int (*task_getscheduler) (struct task_struct *p); 1506 int (*task_getscheduler) (struct task_struct *p);
@@ -1751,7 +1750,8 @@ void security_task_getsecid(struct task_struct *p, u32 *secid);
1751int security_task_setnice(struct task_struct *p, int nice); 1750int security_task_setnice(struct task_struct *p, int nice);
1752int security_task_setioprio(struct task_struct *p, int ioprio); 1751int security_task_setioprio(struct task_struct *p, int ioprio);
1753int security_task_getioprio(struct task_struct *p); 1752int security_task_getioprio(struct task_struct *p);
1754int security_task_setrlimit(unsigned int resource, struct rlimit *new_rlim); 1753int security_task_setrlimit(struct task_struct *p, unsigned int resource,
1754 struct rlimit *new_rlim);
1755int security_task_setscheduler(struct task_struct *p, 1755int security_task_setscheduler(struct task_struct *p,
1756 int policy, struct sched_param *lp); 1756 int policy, struct sched_param *lp);
1757int security_task_getscheduler(struct task_struct *p); 1757int security_task_getscheduler(struct task_struct *p);
@@ -2313,7 +2313,8 @@ static inline int security_task_getioprio(struct task_struct *p)
2313 return 0; 2313 return 0;
2314} 2314}
2315 2315
2316static inline int security_task_setrlimit(unsigned int resource, 2316static inline int security_task_setrlimit(struct task_struct *p,
2317 unsigned int resource,
2317 struct rlimit *new_rlim) 2318 struct rlimit *new_rlim)
2318{ 2319{
2319 return 0; 2320 return 0;
@@ -2806,8 +2807,7 @@ int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode);
2806int security_path_rmdir(struct path *dir, struct dentry *dentry); 2807int security_path_rmdir(struct path *dir, struct dentry *dentry);
2807int security_path_mknod(struct path *dir, struct dentry *dentry, int mode, 2808int security_path_mknod(struct path *dir, struct dentry *dentry, int mode,
2808 unsigned int dev); 2809 unsigned int dev);
2809int security_path_truncate(struct path *path, loff_t length, 2810int security_path_truncate(struct path *path);
2810 unsigned int time_attrs);
2811int security_path_symlink(struct path *dir, struct dentry *dentry, 2811int security_path_symlink(struct path *dir, struct dentry *dentry,
2812 const char *old_name); 2812 const char *old_name);
2813int security_path_link(struct dentry *old_dentry, struct path *new_dir, 2813int security_path_link(struct dentry *old_dentry, struct path *new_dir,
@@ -2841,8 +2841,7 @@ static inline int security_path_mknod(struct path *dir, struct dentry *dentry,
2841 return 0; 2841 return 0;
2842} 2842}
2843 2843
2844static inline int security_path_truncate(struct path *path, loff_t length, 2844static inline int security_path_truncate(struct path *path)
2845 unsigned int time_attrs)
2846{ 2845{
2847 return 0; 2846 return 0;
2848} 2847}
diff --git a/include/linux/serial.h b/include/linux/serial.h
index c8613c3ff9d3..1ebc694a6d52 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -77,7 +77,8 @@ struct serial_struct {
77#define PORT_16654 11 77#define PORT_16654 11
78#define PORT_16850 12 78#define PORT_16850 12
79#define PORT_RSA 13 /* RSA-DV II/S card */ 79#define PORT_RSA 13 /* RSA-DV II/S card */
80#define PORT_MAX 13 80#define PORT_U6_16550A 14
81#define PORT_MAX 14
81 82
82#define SERIAL_IO_PORT 0 83#define SERIAL_IO_PORT 0
83#define SERIAL_IO_HUB6 1 84#define SERIAL_IO_HUB6 1
@@ -151,7 +152,7 @@ struct serial_uart_config {
151#define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART) 152#define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART)
152#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE) 153#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE)
153 154
154#define ASYNC_FLAGS ((1U << ASYNCB_LAST_USER) - 1) 155#define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1)
155#define ASYNC_USR_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI| \ 156#define ASYNC_USR_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI| \
156 ASYNC_CALLOUT_NOHUP|ASYNC_SPD_SHI|ASYNC_LOW_LATENCY) 157 ASYNC_CALLOUT_NOHUP|ASYNC_SPD_SHI|ASYNC_LOW_LATENCY)
157#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI) 158#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI)
@@ -210,8 +211,10 @@ struct serial_rs485 {
210#define SER_RS485_ENABLED (1 << 0) 211#define SER_RS485_ENABLED (1 << 0)
211#define SER_RS485_RTS_ON_SEND (1 << 1) 212#define SER_RS485_RTS_ON_SEND (1 << 1)
212#define SER_RS485_RTS_AFTER_SEND (1 << 2) 213#define SER_RS485_RTS_AFTER_SEND (1 << 2)
214#define SER_RS485_RTS_BEFORE_SEND (1 << 3)
213 __u32 delay_rts_before_send; /* Milliseconds */ 215 __u32 delay_rts_before_send; /* Milliseconds */
214 __u32 padding[6]; /* Memory is cheap, new structs 216 __u32 delay_rts_after_send; /* Milliseconds */
217 __u32 padding[5]; /* Memory is cheap, new structs
215 are a royal PITA .. */ 218 are a royal PITA .. */
216}; 219};
217 220
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index fb46aba11fb5..7638deaaba65 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -32,6 +32,9 @@ struct plat_serial8250_port {
32 unsigned int type; /* If UPF_FIXED_TYPE */ 32 unsigned int type; /* If UPF_FIXED_TYPE */
33 unsigned int (*serial_in)(struct uart_port *, int); 33 unsigned int (*serial_in)(struct uart_port *, int);
34 void (*serial_out)(struct uart_port *, int, int); 34 void (*serial_out)(struct uart_port *, int, int);
35 void (*set_termios)(struct uart_port *,
36 struct ktermios *new,
37 struct ktermios *old);
35}; 38};
36 39
37/* 40/*
@@ -71,5 +74,7 @@ extern int early_serial_setup(struct uart_port *port);
71extern int serial8250_find_port(struct uart_port *p); 74extern int serial8250_find_port(struct uart_port *p);
72extern int serial8250_find_port_for_earlycon(void); 75extern int serial8250_find_port_for_earlycon(void);
73extern int setup_early_serial8250_console(char *cmdline); 76extern int setup_early_serial8250_console(char *cmdline);
77extern void serial8250_do_set_termios(struct uart_port *port,
78 struct ktermios *termios, struct ktermios *old);
74 79
75#endif 80#endif
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index f10db6e5f3b5..3c2ad99fed34 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -186,6 +186,15 @@
186#define PORT_ALTERA_JTAGUART 91 186#define PORT_ALTERA_JTAGUART 91
187#define PORT_ALTERA_UART 92 187#define PORT_ALTERA_UART 92
188 188
189/* SH-SCI */
190#define PORT_SCIFB 93
191
192/* MAX3107 */
193#define PORT_MAX3107 94
194
195/* High Speed UART for Medfield */
196#define PORT_MFD 95
197
189#ifdef __KERNEL__ 198#ifdef __KERNEL__
190 199
191#include <linux/compiler.h> 200#include <linux/compiler.h>
@@ -220,7 +229,7 @@ struct uart_ops {
220 void (*flush_buffer)(struct uart_port *); 229 void (*flush_buffer)(struct uart_port *);
221 void (*set_termios)(struct uart_port *, struct ktermios *new, 230 void (*set_termios)(struct uart_port *, struct ktermios *new,
222 struct ktermios *old); 231 struct ktermios *old);
223 void (*set_ldisc)(struct uart_port *); 232 void (*set_ldisc)(struct uart_port *, int new);
224 void (*pm)(struct uart_port *, unsigned int state, 233 void (*pm)(struct uart_port *, unsigned int state,
225 unsigned int oldstate); 234 unsigned int oldstate);
226 int (*set_wake)(struct uart_port *, unsigned int state); 235 int (*set_wake)(struct uart_port *, unsigned int state);
@@ -276,6 +285,9 @@ struct uart_port {
276 unsigned char __iomem *membase; /* read/write[bwl] */ 285 unsigned char __iomem *membase; /* read/write[bwl] */
277 unsigned int (*serial_in)(struct uart_port *, int); 286 unsigned int (*serial_in)(struct uart_port *, int);
278 void (*serial_out)(struct uart_port *, int, int); 287 void (*serial_out)(struct uart_port *, int, int);
288 void (*set_termios)(struct uart_port *,
289 struct ktermios *new,
290 struct ktermios *old);
279 unsigned int irq; /* irq number */ 291 unsigned int irq; /* irq number */
280 unsigned long irqflags; /* irq flags */ 292 unsigned long irqflags; /* irq flags */
281 unsigned int uartclk; /* base uart clock */ 293 unsigned int uartclk; /* base uart clock */
diff --git a/include/linux/serial_mfd.h b/include/linux/serial_mfd.h
new file mode 100644
index 000000000000..2b071e0b034d
--- /dev/null
+++ b/include/linux/serial_mfd.h
@@ -0,0 +1,47 @@
1#ifndef _SERIAL_MFD_H_
2#define _SERIAL_MFD_H_
3
4/* HW register offset definition */
5#define UART_FOR 0x08
6#define UART_PS 0x0C
7#define UART_MUL 0x0D
8#define UART_DIV 0x0E
9
10#define HSU_GBL_IEN 0x0
11#define HSU_GBL_IST 0x4
12
13#define HSU_GBL_INT_BIT_PORT0 0x0
14#define HSU_GBL_INT_BIT_PORT1 0x1
15#define HSU_GBL_INT_BIT_PORT2 0x2
16#define HSU_GBL_INT_BIT_IRI 0x3
17#define HSU_GBL_INT_BIT_HDLC 0x4
18#define HSU_GBL_INT_BIT_DMA 0x5
19
20#define HSU_GBL_ISR 0x8
21#define HSU_GBL_DMASR 0x400
22#define HSU_GBL_DMAISR 0x404
23
24#define HSU_PORT_REG_OFFSET 0x80
25#define HSU_PORT0_REG_OFFSET 0x80
26#define HSU_PORT1_REG_OFFSET 0x100
27#define HSU_PORT2_REG_OFFSET 0x180
28#define HSU_PORT_REG_LENGTH 0x80
29
30#define HSU_DMA_CHANS_REG_OFFSET 0x500
31#define HSU_DMA_CHANS_REG_LENGTH 0x40
32
33#define HSU_CH_SR 0x0 /* channel status reg */
34#define HSU_CH_CR 0x4 /* control reg */
35#define HSU_CH_DCR 0x8 /* descriptor control reg */
36#define HSU_CH_BSR 0x10 /* max fifo buffer size reg */
37#define HSU_CH_MOTSR 0x14 /* minimum ocp transfer size */
38#define HSU_CH_D0SAR 0x20 /* desc 0 start addr */
39#define HSU_CH_D0TSR 0x24 /* desc 0 transfer size */
40#define HSU_CH_D1SAR 0x28
41#define HSU_CH_D1TSR 0x2C
42#define HSU_CH_D2SAR 0x30
43#define HSU_CH_D2TSR 0x34
44#define HSU_CH_D3SAR 0x38
45#define HSU_CH_D3TSR 0x3C
46
47#endif
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h
index cf9327c051ad..c7a0ce11cd47 100644
--- a/include/linux/serial_reg.h
+++ b/include/linux/serial_reg.h
@@ -221,8 +221,24 @@
221#define UART_FCR_PXAR16 0x80 /* receive FIFO threshold = 16 */ 221#define UART_FCR_PXAR16 0x80 /* receive FIFO threshold = 16 */
222#define UART_FCR_PXAR32 0xc0 /* receive FIFO threshold = 32 */ 222#define UART_FCR_PXAR32 0xc0 /* receive FIFO threshold = 32 */
223 223
224/*
225 * Intel MID on-chip HSU (High Speed UART) defined bits
226 */
227#define UART_FCR_HSU_64_1B 0x00 /* receive FIFO treshold = 1 */
228#define UART_FCR_HSU_64_16B 0x40 /* receive FIFO treshold = 16 */
229#define UART_FCR_HSU_64_32B 0x80 /* receive FIFO treshold = 32 */
230#define UART_FCR_HSU_64_56B 0xc0 /* receive FIFO treshold = 56 */
231
232#define UART_FCR_HSU_16_1B 0x00 /* receive FIFO treshold = 1 */
233#define UART_FCR_HSU_16_4B 0x40 /* receive FIFO treshold = 4 */
234#define UART_FCR_HSU_16_8B 0x80 /* receive FIFO treshold = 8 */
235#define UART_FCR_HSU_16_14B 0xc0 /* receive FIFO treshold = 14 */
224 236
237#define UART_FCR_HSU_64B_FIFO 0x20 /* chose 64 bytes FIFO */
238#define UART_FCR_HSU_16B_FIFO 0x00 /* chose 16 bytes FIFO */
225 239
240#define UART_FCR_HALF_EMPT_TXI 0x00 /* trigger TX_EMPT IRQ for half empty */
241#define UART_FCR_FULL_EMPT_TXI 0x08 /* trigger TX_EMPT IRQ for full empty */
226 242
227/* 243/*
228 * These register definitions are for the 16C950 244 * These register definitions are for the 16C950
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 1636d1e2a5f1..875ce50719a9 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -25,6 +25,10 @@ struct clk {
25 int id; 25 int id;
26 26
27 struct clk *parent; 27 struct clk *parent;
28 struct clk **parent_table; /* list of parents to */
29 unsigned short parent_num; /* choose between */
30 unsigned char src_shift; /* source clock field in the */
31 unsigned char src_width; /* configuration register */
28 struct clk_ops *ops; 32 struct clk_ops *ops;
29 33
30 struct list_head children; 34 struct list_head children;
@@ -138,13 +142,22 @@ int sh_clk_div4_enable_register(struct clk *clks, int nr,
138int sh_clk_div4_reparent_register(struct clk *clks, int nr, 142int sh_clk_div4_reparent_register(struct clk *clks, int nr,
139 struct clk_div4_table *table); 143 struct clk_div4_table *table);
140 144
141#define SH_CLK_DIV6(_parent, _reg, _flags) \ 145#define SH_CLK_DIV6_EXT(_parent, _reg, _flags, _parents, \
142{ \ 146 _num_parents, _src_shift, _src_width) \
143 .parent = _parent, \ 147{ \
144 .enable_reg = (void __iomem *)_reg, \ 148 .parent = _parent, \
145 .flags = _flags, \ 149 .enable_reg = (void __iomem *)_reg, \
150 .flags = _flags, \
151 .parent_table = _parents, \
152 .parent_num = _num_parents, \
153 .src_shift = _src_shift, \
154 .src_width = _src_width, \
146} 155}
147 156
157#define SH_CLK_DIV6(_parent, _reg, _flags) \
158 SH_CLK_DIV6_EXT(_parent, _reg, _flags, NULL, 0, 0, 0)
159
148int sh_clk_div6_register(struct clk *clks, int nr); 160int sh_clk_div6_register(struct clk *clks, int nr);
161int sh_clk_div6_reparent_register(struct clk *clks, int nr);
149 162
150#endif /* __SH_CLOCK_H */ 163#endif /* __SH_CLOCK_H */
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index e164291fb3e7..399be5ad2f99 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/swap.h> 4#include <linux/swap.h>
5#include <linux/mempolicy.h> 5#include <linux/mempolicy.h>
6#include <linux/percpu_counter.h>
6 7
7/* inode in-kernel data */ 8/* inode in-kernel data */
8 9
@@ -23,7 +24,7 @@ struct shmem_inode_info {
23 24
24struct shmem_sb_info { 25struct shmem_sb_info {
25 unsigned long max_blocks; /* How many blocks are allowed */ 26 unsigned long max_blocks; /* How many blocks are allowed */
26 unsigned long free_blocks; /* How many are left for allocation */ 27 struct percpu_counter used_blocks; /* How many are allocated */
27 unsigned long max_inodes; /* How many inodes are allowed */ 28 unsigned long max_inodes; /* How many inodes are allowed */
28 unsigned long free_inodes; /* How many are left for allocation */ 29 unsigned long free_inodes; /* How many are left for allocation */
29 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */ 30 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index f89e7fd59a4c..77eb60d2b496 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -169,6 +169,7 @@ struct skb_shared_hwtstamps {
169 * @software: generate software time stamp 169 * @software: generate software time stamp
170 * @in_progress: device driver is going to provide 170 * @in_progress: device driver is going to provide
171 * hardware time stamp 171 * hardware time stamp
172 * @prevent_sk_orphan: make sk reference available on driver level
172 * @flags: all shared_tx flags 173 * @flags: all shared_tx flags
173 * 174 *
174 * These flags are attached to packets as part of the 175 * These flags are attached to packets as part of the
@@ -178,7 +179,8 @@ union skb_shared_tx {
178 struct { 179 struct {
179 __u8 hardware:1, 180 __u8 hardware:1,
180 software:1, 181 software:1,
181 in_progress:1; 182 in_progress:1,
183 prevent_sk_orphan:1;
182 }; 184 };
183 __u8 flags; 185 __u8 flags;
184}; 186};
@@ -202,10 +204,11 @@ struct skb_shared_info {
202 */ 204 */
203 atomic_t dataref; 205 atomic_t dataref;
204 206
205 skb_frag_t frags[MAX_SKB_FRAGS];
206 /* Intermediate layers must ensure that destructor_arg 207 /* Intermediate layers must ensure that destructor_arg
207 * remains valid until skb destructor */ 208 * remains valid until skb destructor */
208 void * destructor_arg; 209 void * destructor_arg;
210 /* must be last field, see pskb_expand_head() */
211 skb_frag_t frags[MAX_SKB_FRAGS];
209}; 212};
210 213
211/* We divide dataref into two halves. The higher 16 bits hold references 214/* We divide dataref into two halves. The higher 16 bits hold references
@@ -1376,6 +1379,11 @@ static inline int skb_network_offset(const struct sk_buff *skb)
1376 return skb_network_header(skb) - skb->data; 1379 return skb_network_header(skb) - skb->data;
1377} 1380}
1378 1381
1382static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len)
1383{
1384 return pskb_may_pull(skb, skb_network_offset(skb) + len);
1385}
1386
1379/* 1387/*
1380 * CPUs often take a performance hit when accessing unaligned memory 1388 * CPUs often take a performance hit when accessing unaligned memory
1381 * locations. The actual performance hit varies, it can be small if the 1389 * locations. The actual performance hit varies, it can be small if the
@@ -1414,12 +1422,14 @@ static inline int skb_network_offset(const struct sk_buff *skb)
1414 * 1422 *
1415 * Various parts of the networking layer expect at least 32 bytes of 1423 * Various parts of the networking layer expect at least 32 bytes of
1416 * headroom, you should not reduce this. 1424 * headroom, you should not reduce this.
1417 * With RPS, we raised NET_SKB_PAD to 64 so that get_rps_cpus() fetches span 1425 *
1418 * a 64 bytes aligned block to fit modern (>= 64 bytes) cache line sizes 1426 * Using max(32, L1_CACHE_BYTES) makes sense (especially with RPS)
1427 * to reduce average number of cache lines per packet.
1428 * get_rps_cpus() for example only access one 64 bytes aligned block :
1419 * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) 1429 * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8)
1420 */ 1430 */
1421#ifndef NET_SKB_PAD 1431#ifndef NET_SKB_PAD
1422#define NET_SKB_PAD 64 1432#define NET_SKB_PAD max(32, L1_CACHE_BYTES)
1423#endif 1433#endif
1424 1434
1425extern int ___pskb_trim(struct sk_buff *skb, unsigned int len); 1435extern int ___pskb_trim(struct sk_buff *skb, unsigned int len);
@@ -1931,6 +1941,36 @@ static inline ktime_t net_invalid_timestamp(void)
1931 return ktime_set(0, 0); 1941 return ktime_set(0, 0);
1932} 1942}
1933 1943
1944extern void skb_timestamping_init(void);
1945
1946#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING
1947
1948extern void skb_clone_tx_timestamp(struct sk_buff *skb);
1949extern bool skb_defer_rx_timestamp(struct sk_buff *skb);
1950
1951#else /* CONFIG_NETWORK_PHY_TIMESTAMPING */
1952
1953static inline void skb_clone_tx_timestamp(struct sk_buff *skb)
1954{
1955}
1956
1957static inline bool skb_defer_rx_timestamp(struct sk_buff *skb)
1958{
1959 return false;
1960}
1961
1962#endif /* !CONFIG_NETWORK_PHY_TIMESTAMPING */
1963
1964/**
1965 * skb_complete_tx_timestamp() - deliver cloned skb with tx timestamps
1966 *
1967 * @skb: clone of the the original outgoing packet
1968 * @hwtstamps: hardware time stamps
1969 *
1970 */
1971void skb_complete_tx_timestamp(struct sk_buff *skb,
1972 struct skb_shared_hwtstamps *hwtstamps);
1973
1934/** 1974/**
1935 * skb_tstamp_tx - queue clone of skb with send time stamps 1975 * skb_tstamp_tx - queue clone of skb with send time stamps
1936 * @orig_skb: the original outgoing packet 1976 * @orig_skb: the original outgoing packet
@@ -1945,6 +1985,28 @@ static inline ktime_t net_invalid_timestamp(void)
1945extern void skb_tstamp_tx(struct sk_buff *orig_skb, 1985extern void skb_tstamp_tx(struct sk_buff *orig_skb,
1946 struct skb_shared_hwtstamps *hwtstamps); 1986 struct skb_shared_hwtstamps *hwtstamps);
1947 1987
1988static inline void sw_tx_timestamp(struct sk_buff *skb)
1989{
1990 union skb_shared_tx *shtx = skb_tx(skb);
1991 if (shtx->software && !shtx->in_progress)
1992 skb_tstamp_tx(skb, NULL);
1993}
1994
1995/**
1996 * skb_tx_timestamp() - Driver hook for transmit timestamping
1997 *
1998 * Ethernet MAC Drivers should call this function in their hard_xmit()
1999 * function as soon as possible after giving the sk_buff to the MAC
2000 * hardware, but before freeing the sk_buff.
2001 *
2002 * @skb: A socket buffer.
2003 */
2004static inline void skb_tx_timestamp(struct sk_buff *skb)
2005{
2006 skb_clone_tx_timestamp(skb);
2007 sw_tx_timestamp(skb);
2008}
2009
1948extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); 2010extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
1949extern __sum16 __skb_checksum_complete(struct sk_buff *skb); 2011extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
1950 2012
@@ -2132,7 +2194,8 @@ static inline bool skb_warn_if_lro(const struct sk_buff *skb)
2132 /* LRO sets gso_size but not gso_type, whereas if GSO is really 2194 /* LRO sets gso_size but not gso_type, whereas if GSO is really
2133 * wanted then gso_type will be set. */ 2195 * wanted then gso_type will be set. */
2134 struct skb_shared_info *shinfo = skb_shinfo(skb); 2196 struct skb_shared_info *shinfo = skb_shinfo(skb);
2135 if (shinfo->gso_size != 0 && unlikely(shinfo->gso_type == 0)) { 2197 if (skb_is_nonlinear(skb) && shinfo->gso_size != 0 &&
2198 unlikely(shinfo->gso_type == 0)) {
2136 __skb_warn_lro_forwarding(skb); 2199 __skb_warn_lro_forwarding(skb);
2137 return true; 2200 return true;
2138 } 2201 }
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 49d1247cd6d9..59260e21bdf5 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -268,7 +268,8 @@ static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep,
268 * allocator where we care about the real place the memory allocation 268 * allocator where we care about the real place the memory allocation
269 * request comes from. 269 * request comes from.
270 */ 270 */
271#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) 271#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \
272 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING))
272extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long); 273extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long);
273#define kmalloc_track_caller(size, flags) \ 274#define kmalloc_track_caller(size, flags) \
274 __kmalloc_track_caller(size, flags, _RET_IP_) 275 __kmalloc_track_caller(size, flags, _RET_IP_)
@@ -286,7 +287,8 @@ extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long);
286 * standard allocator where we care about the real place the memory 287 * standard allocator where we care about the real place the memory
287 * allocation request comes from. 288 * allocation request comes from.
288 */ 289 */
289#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) 290#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \
291 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING))
290extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long); 292extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long);
291#define kmalloc_node_track_caller(size, flags, node) \ 293#define kmalloc_node_track_caller(size, flags, node) \
292 __kmalloc_node_track_caller(size, flags, node, \ 294 __kmalloc_node_track_caller(size, flags, node, \
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 1812dac8c496..791a502f6906 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -14,9 +14,9 @@
14#include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */ 14#include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */
15#include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */ 15#include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <linux/kmemtrace.h>
18 17
19#ifndef ARCH_KMALLOC_MINALIGN 18#include <trace/events/kmem.h>
19
20/* 20/*
21 * Enforce a minimum alignment for the kmalloc caches. 21 * Enforce a minimum alignment for the kmalloc caches.
22 * Usually, the kmalloc caches are cache_line_size() aligned, except when 22 * Usually, the kmalloc caches are cache_line_size() aligned, except when
@@ -26,6 +26,9 @@
26 * ARCH_KMALLOC_MINALIGN allows that. 26 * ARCH_KMALLOC_MINALIGN allows that.
27 * Note that increasing this value may disable some debug features. 27 * Note that increasing this value may disable some debug features.
28 */ 28 */
29#ifdef ARCH_DMA_MINALIGN
30#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
31#else
29#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) 32#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
30#endif 33#endif
31 34
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
index 62667f72c2ef..4382db09df4f 100644
--- a/include/linux/slob_def.h
+++ b/include/linux/slob_def.h
@@ -1,7 +1,9 @@
1#ifndef __LINUX_SLOB_DEF_H 1#ifndef __LINUX_SLOB_DEF_H
2#define __LINUX_SLOB_DEF_H 2#define __LINUX_SLOB_DEF_H
3 3
4#ifndef ARCH_KMALLOC_MINALIGN 4#ifdef ARCH_DMA_MINALIGN
5#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
6#else
5#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long) 7#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long)
6#endif 8#endif
7 9
diff --git a/include/linux/slow-work.h b/include/linux/slow-work.h
deleted file mode 100644
index 13337bf6c3f5..000000000000
--- a/include/linux/slow-work.h
+++ /dev/null
@@ -1,163 +0,0 @@
1/* Worker thread pool for slow items, such as filesystem lookups or mkdirs
2 *
3 * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 *
11 * See Documentation/slow-work.txt
12 */
13
14#ifndef _LINUX_SLOW_WORK_H
15#define _LINUX_SLOW_WORK_H
16
17#ifdef CONFIG_SLOW_WORK
18
19#include <linux/sysctl.h>
20#include <linux/timer.h>
21
22struct slow_work;
23#ifdef CONFIG_SLOW_WORK_DEBUG
24struct seq_file;
25#endif
26
27/*
28 * The operations used to support slow work items
29 */
30struct slow_work_ops {
31 /* owner */
32 struct module *owner;
33
34 /* get a ref on a work item
35 * - return 0 if successful, -ve if not
36 */
37 int (*get_ref)(struct slow_work *work);
38
39 /* discard a ref to a work item */
40 void (*put_ref)(struct slow_work *work);
41
42 /* execute a work item */
43 void (*execute)(struct slow_work *work);
44
45#ifdef CONFIG_SLOW_WORK_DEBUG
46 /* describe a work item for debugfs */
47 void (*desc)(struct slow_work *work, struct seq_file *m);
48#endif
49};
50
51/*
52 * A slow work item
53 * - A reference is held on the parent object by the thread pool when it is
54 * queued
55 */
56struct slow_work {
57 struct module *owner; /* the owning module */
58 unsigned long flags;
59#define SLOW_WORK_PENDING 0 /* item pending (further) execution */
60#define SLOW_WORK_EXECUTING 1 /* item currently executing */
61#define SLOW_WORK_ENQ_DEFERRED 2 /* item enqueue deferred */
62#define SLOW_WORK_VERY_SLOW 3 /* item is very slow */
63#define SLOW_WORK_CANCELLING 4 /* item is being cancelled, don't enqueue */
64#define SLOW_WORK_DELAYED 5 /* item is struct delayed_slow_work with active timer */
65 const struct slow_work_ops *ops; /* operations table for this item */
66 struct list_head link; /* link in queue */
67#ifdef CONFIG_SLOW_WORK_DEBUG
68 struct timespec mark; /* jiffies at which queued or exec begun */
69#endif
70};
71
72struct delayed_slow_work {
73 struct slow_work work;
74 struct timer_list timer;
75};
76
77/**
78 * slow_work_init - Initialise a slow work item
79 * @work: The work item to initialise
80 * @ops: The operations to use to handle the slow work item
81 *
82 * Initialise a slow work item.
83 */
84static inline void slow_work_init(struct slow_work *work,
85 const struct slow_work_ops *ops)
86{
87 work->flags = 0;
88 work->ops = ops;
89 INIT_LIST_HEAD(&work->link);
90}
91
92/**
93 * slow_work_init - Initialise a delayed slow work item
94 * @work: The work item to initialise
95 * @ops: The operations to use to handle the slow work item
96 *
97 * Initialise a delayed slow work item.
98 */
99static inline void delayed_slow_work_init(struct delayed_slow_work *dwork,
100 const struct slow_work_ops *ops)
101{
102 init_timer(&dwork->timer);
103 slow_work_init(&dwork->work, ops);
104}
105
106/**
107 * vslow_work_init - Initialise a very slow work item
108 * @work: The work item to initialise
109 * @ops: The operations to use to handle the slow work item
110 *
111 * Initialise a very slow work item. This item will be restricted such that
112 * only a certain number of the pool threads will be able to execute items of
113 * this type.
114 */
115static inline void vslow_work_init(struct slow_work *work,
116 const struct slow_work_ops *ops)
117{
118 work->flags = 1 << SLOW_WORK_VERY_SLOW;
119 work->ops = ops;
120 INIT_LIST_HEAD(&work->link);
121}
122
123/**
124 * slow_work_is_queued - Determine if a slow work item is on the work queue
125 * work: The work item to test
126 *
127 * Determine if the specified slow-work item is on the work queue. This
128 * returns true if it is actually on the queue.
129 *
130 * If the item is executing and has been marked for requeue when execution
131 * finishes, then false will be returned.
132 *
133 * Anyone wishing to wait for completion of execution can wait on the
134 * SLOW_WORK_EXECUTING bit.
135 */
136static inline bool slow_work_is_queued(struct slow_work *work)
137{
138 unsigned long flags = work->flags;
139 return flags & SLOW_WORK_PENDING && !(flags & SLOW_WORK_EXECUTING);
140}
141
142extern int slow_work_enqueue(struct slow_work *work);
143extern void slow_work_cancel(struct slow_work *work);
144extern int slow_work_register_user(struct module *owner);
145extern void slow_work_unregister_user(struct module *owner);
146
147extern int delayed_slow_work_enqueue(struct delayed_slow_work *dwork,
148 unsigned long delay);
149
150static inline void delayed_slow_work_cancel(struct delayed_slow_work *dwork)
151{
152 slow_work_cancel(&dwork->work);
153}
154
155extern bool slow_work_sleep_till_thread_needed(struct slow_work *work,
156 signed long *_timeout);
157
158#ifdef CONFIG_SYSCTL
159extern ctl_table slow_work_sysctls[];
160#endif
161
162#endif /* CONFIG_SLOW_WORK */
163#endif /* _LINUX_SLOW_WORK_H */
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 4ba59cfc1f75..6d14409c4d9a 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -10,9 +10,10 @@
10#include <linux/gfp.h> 10#include <linux/gfp.h>
11#include <linux/workqueue.h> 11#include <linux/workqueue.h>
12#include <linux/kobject.h> 12#include <linux/kobject.h>
13#include <linux/kmemtrace.h>
14#include <linux/kmemleak.h> 13#include <linux/kmemleak.h>
15 14
15#include <trace/events/kmem.h>
16
16enum stat_item { 17enum stat_item {
17 ALLOC_FASTPATH, /* Allocation from cpu slab */ 18 ALLOC_FASTPATH, /* Allocation from cpu slab */
18 ALLOC_SLOWPATH, /* Allocation by getting a new cpu slab */ 19 ALLOC_SLOWPATH, /* Allocation by getting a new cpu slab */
@@ -105,15 +106,17 @@ struct kmem_cache {
105/* 106/*
106 * Kmalloc subsystem. 107 * Kmalloc subsystem.
107 */ 108 */
108#if defined(ARCH_KMALLOC_MINALIGN) && ARCH_KMALLOC_MINALIGN > 8 109#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
109#define KMALLOC_MIN_SIZE ARCH_KMALLOC_MINALIGN 110#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
110#else 111#else
111#define KMALLOC_MIN_SIZE 8 112#define KMALLOC_MIN_SIZE 8
112#endif 113#endif
113 114
114#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE) 115#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE)
115 116
116#ifndef ARCH_KMALLOC_MINALIGN 117#ifdef ARCH_DMA_MINALIGN
118#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
119#else
117#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) 120#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
118#endif 121#endif
119 122
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 52797714ade7..ebb0c80ffd6e 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -229,6 +229,7 @@ enum
229 LINUX_MIB_TCPBACKLOGDROP, 229 LINUX_MIB_TCPBACKLOGDROP,
230 LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */ 230 LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */
231 LINUX_MIB_TCPDEFERACCEPTDROP, 231 LINUX_MIB_TCPDEFERACCEPTDROP,
232 LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */
232 __LINUX_MIB_MAX 233 __LINUX_MIB_MAX
233}; 234};
234 235
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 032a19eb61b1..a2fada9becb6 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -24,6 +24,9 @@ struct __kernel_sockaddr_storage {
24#include <linux/types.h> /* pid_t */ 24#include <linux/types.h> /* pid_t */
25#include <linux/compiler.h> /* __user */ 25#include <linux/compiler.h> /* __user */
26 26
27struct pid;
28struct cred;
29
27#define __sockaddr_check_size(size) \ 30#define __sockaddr_check_size(size) \
28 BUILD_BUG_ON(((size) > sizeof(struct __kernel_sockaddr_storage))) 31 BUILD_BUG_ON(((size) > sizeof(struct __kernel_sockaddr_storage)))
29 32
@@ -309,6 +312,8 @@ struct ucred {
309#define IPX_TYPE 1 312#define IPX_TYPE 1
310 313
311#ifdef __KERNEL__ 314#ifdef __KERNEL__
315extern void cred_to_ucred(struct pid *pid, const struct cred *cred, struct ucred *ucred);
316
312extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); 317extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
313extern int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, 318extern int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov,
314 int offset, int len); 319 int offset, int len);
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index b4ae570d3c98..92bd0839d5b4 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -48,11 +48,12 @@ struct ads7846_platform_data {
48 * state if get_pendown_state == NULL 48 * state if get_pendown_state == NULL
49 */ 49 */
50 int (*get_pendown_state)(void); 50 int (*get_pendown_state)(void);
51 int (*filter_init) (struct ads7846_platform_data *pdata, 51 int (*filter_init) (const struct ads7846_platform_data *pdata,
52 void **filter_data); 52 void **filter_data);
53 int (*filter) (void *filter_data, int data_idx, int *val); 53 int (*filter) (void *filter_data, int data_idx, int *val);
54 void (*filter_cleanup)(void *filter_data); 54 void (*filter_cleanup)(void *filter_data);
55 void (*wait_for_sync)(void); 55 void (*wait_for_sync)(void);
56 bool wakeup; 56 bool wakeup;
57 unsigned long irq_flags;
57}; 58};
58 59
diff --git a/include/linux/spi/max7301.h b/include/linux/spi/max7301.h
index 34af0a3477bf..bcaa2f762cc1 100644
--- a/include/linux/spi/max7301.h
+++ b/include/linux/spi/max7301.h
@@ -11,6 +11,7 @@ struct max7301 {
11 struct mutex lock; 11 struct mutex lock;
12 u8 port_config[8]; /* field 0 is unused */ 12 u8 port_config[8]; /* field 0 is unused */
13 u32 out_level; /* cached output levels */ 13 u32 out_level; /* cached output levels */
14 u32 input_pullup_active;
14 struct gpio_chip chip; 15 struct gpio_chip chip;
15 struct device *dev; 16 struct device *dev;
16 int (*write)(struct device *dev, unsigned int reg, unsigned int val); 17 int (*write)(struct device *dev, unsigned int reg, unsigned int val);
@@ -20,6 +21,13 @@ struct max7301 {
20struct max7301_platform_data { 21struct max7301_platform_data {
21 /* number assigned to the first GPIO */ 22 /* number assigned to the first GPIO */
22 unsigned base; 23 unsigned base;
24 /*
25 * bitmask controlling the pullup configuration,
26 *
27 * _note_ the 4 lowest bits are unused, because the first 4
28 * ports of the controller are not used, too.
29 */
30 u32 input_pullup_active;
23}; 31};
24 32
25extern int __max730x_remove(struct device *dev); 33extern int __max730x_remove(struct device *dev);
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index a2608bff9c78..623b704fdc42 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -167,7 +167,7 @@ struct ssb_device {
167 * is an optimization. */ 167 * is an optimization. */
168 const struct ssb_bus_ops *ops; 168 const struct ssb_bus_ops *ops;
169 169
170 struct device *dev; 170 struct device *dev, *dma_dev;
171 171
172 struct ssb_bus *bus; 172 struct ssb_bus *bus;
173 struct ssb_device_id id; 173 struct ssb_device_id id;
@@ -470,14 +470,6 @@ extern u32 ssb_dma_translation(struct ssb_device *dev);
470#define SSB_DMA_TRANSLATION_MASK 0xC0000000 470#define SSB_DMA_TRANSLATION_MASK 0xC0000000
471#define SSB_DMA_TRANSLATION_SHIFT 30 471#define SSB_DMA_TRANSLATION_SHIFT 30
472 472
473extern int ssb_dma_set_mask(struct ssb_device *dev, u64 mask);
474
475extern void * ssb_dma_alloc_consistent(struct ssb_device *dev, size_t size,
476 dma_addr_t *dma_handle, gfp_t gfp_flags);
477extern void ssb_dma_free_consistent(struct ssb_device *dev, size_t size,
478 void *vaddr, dma_addr_t dma_handle,
479 gfp_t gfp_flags);
480
481static inline void __cold __ssb_dma_not_implemented(struct ssb_device *dev) 473static inline void __cold __ssb_dma_not_implemented(struct ssb_device *dev)
482{ 474{
483#ifdef CONFIG_SSB_DEBUG 475#ifdef CONFIG_SSB_DEBUG
@@ -486,155 +478,6 @@ static inline void __cold __ssb_dma_not_implemented(struct ssb_device *dev)
486#endif /* DEBUG */ 478#endif /* DEBUG */
487} 479}
488 480
489static inline int ssb_dma_mapping_error(struct ssb_device *dev, dma_addr_t addr)
490{
491 switch (dev->bus->bustype) {
492 case SSB_BUSTYPE_PCI:
493#ifdef CONFIG_SSB_PCIHOST
494 return pci_dma_mapping_error(dev->bus->host_pci, addr);
495#endif
496 break;
497 case SSB_BUSTYPE_SSB:
498 return dma_mapping_error(dev->dev, addr);
499 default:
500 break;
501 }
502 __ssb_dma_not_implemented(dev);
503 return -ENOSYS;
504}
505
506static inline dma_addr_t ssb_dma_map_single(struct ssb_device *dev, void *p,
507 size_t size, enum dma_data_direction dir)
508{
509 switch (dev->bus->bustype) {
510 case SSB_BUSTYPE_PCI:
511#ifdef CONFIG_SSB_PCIHOST
512 return pci_map_single(dev->bus->host_pci, p, size, dir);
513#endif
514 break;
515 case SSB_BUSTYPE_SSB:
516 return dma_map_single(dev->dev, p, size, dir);
517 default:
518 break;
519 }
520 __ssb_dma_not_implemented(dev);
521 return 0;
522}
523
524static inline void ssb_dma_unmap_single(struct ssb_device *dev, dma_addr_t dma_addr,
525 size_t size, enum dma_data_direction dir)
526{
527 switch (dev->bus->bustype) {
528 case SSB_BUSTYPE_PCI:
529#ifdef CONFIG_SSB_PCIHOST
530 pci_unmap_single(dev->bus->host_pci, dma_addr, size, dir);
531 return;
532#endif
533 break;
534 case SSB_BUSTYPE_SSB:
535 dma_unmap_single(dev->dev, dma_addr, size, dir);
536 return;
537 default:
538 break;
539 }
540 __ssb_dma_not_implemented(dev);
541}
542
543static inline void ssb_dma_sync_single_for_cpu(struct ssb_device *dev,
544 dma_addr_t dma_addr,
545 size_t size,
546 enum dma_data_direction dir)
547{
548 switch (dev->bus->bustype) {
549 case SSB_BUSTYPE_PCI:
550#ifdef CONFIG_SSB_PCIHOST
551 pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr,
552 size, dir);
553 return;
554#endif
555 break;
556 case SSB_BUSTYPE_SSB:
557 dma_sync_single_for_cpu(dev->dev, dma_addr, size, dir);
558 return;
559 default:
560 break;
561 }
562 __ssb_dma_not_implemented(dev);
563}
564
565static inline void ssb_dma_sync_single_for_device(struct ssb_device *dev,
566 dma_addr_t dma_addr,
567 size_t size,
568 enum dma_data_direction dir)
569{
570 switch (dev->bus->bustype) {
571 case SSB_BUSTYPE_PCI:
572#ifdef CONFIG_SSB_PCIHOST
573 pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr,
574 size, dir);
575 return;
576#endif
577 break;
578 case SSB_BUSTYPE_SSB:
579 dma_sync_single_for_device(dev->dev, dma_addr, size, dir);
580 return;
581 default:
582 break;
583 }
584 __ssb_dma_not_implemented(dev);
585}
586
587static inline void ssb_dma_sync_single_range_for_cpu(struct ssb_device *dev,
588 dma_addr_t dma_addr,
589 unsigned long offset,
590 size_t size,
591 enum dma_data_direction dir)
592{
593 switch (dev->bus->bustype) {
594 case SSB_BUSTYPE_PCI:
595#ifdef CONFIG_SSB_PCIHOST
596 /* Just sync everything. That's all the PCI API can do. */
597 pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr,
598 offset + size, dir);
599 return;
600#endif
601 break;
602 case SSB_BUSTYPE_SSB:
603 dma_sync_single_range_for_cpu(dev->dev, dma_addr, offset,
604 size, dir);
605 return;
606 default:
607 break;
608 }
609 __ssb_dma_not_implemented(dev);
610}
611
612static inline void ssb_dma_sync_single_range_for_device(struct ssb_device *dev,
613 dma_addr_t dma_addr,
614 unsigned long offset,
615 size_t size,
616 enum dma_data_direction dir)
617{
618 switch (dev->bus->bustype) {
619 case SSB_BUSTYPE_PCI:
620#ifdef CONFIG_SSB_PCIHOST
621 /* Just sync everything. That's all the PCI API can do. */
622 pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr,
623 offset + size, dir);
624 return;
625#endif
626 break;
627 case SSB_BUSTYPE_SSB:
628 dma_sync_single_range_for_device(dev->dev, dma_addr, offset,
629 size, dir);
630 return;
631 default:
632 break;
633 }
634 __ssb_dma_not_implemented(dev);
635}
636
637
638#ifdef CONFIG_SSB_PCIHOST 481#ifdef CONFIG_SSB_PCIHOST
639/* PCI-host wrapper driver */ 482/* PCI-host wrapper driver */
640extern int ssb_pcihost_register(struct pci_driver *driver); 483extern int ssb_pcihost_register(struct pci_driver *driver);
diff --git a/include/linux/statfs.h b/include/linux/statfs.h
index b34cc829f98d..0166d320a75d 100644
--- a/include/linux/statfs.h
+++ b/include/linux/statfs.h
@@ -2,7 +2,6 @@
2#define _LINUX_STATFS_H 2#define _LINUX_STATFS_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5
6#include <asm/statfs.h> 5#include <asm/statfs.h>
7 6
8struct kstatfs { 7struct kstatfs {
@@ -16,7 +15,29 @@ struct kstatfs {
16 __kernel_fsid_t f_fsid; 15 __kernel_fsid_t f_fsid;
17 long f_namelen; 16 long f_namelen;
18 long f_frsize; 17 long f_frsize;
19 long f_spare[5]; 18 long f_flags;
19 long f_spare[4];
20}; 20};
21 21
22/*
23 * Definitions for the flag in f_flag.
24 *
25 * Generally these flags are equivalent to the MS_ flags used in the mount
26 * ABI. The exception is ST_VALID which has the same value as MS_REMOUNT
27 * which doesn't make any sense for statfs.
28 */
29#define ST_RDONLY 0x0001 /* mount read-only */
30#define ST_NOSUID 0x0002 /* ignore suid and sgid bits */
31#define ST_NODEV 0x0004 /* disallow access to device special files */
32#define ST_NOEXEC 0x0008 /* disallow program execution */
33#define ST_SYNCHRONOUS 0x0010 /* writes are synced at once */
34#define ST_VALID 0x0020 /* f_flags support is implemented */
35#define ST_MANDLOCK 0x0040 /* allow mandatory locks on an FS */
36/* 0x0080 used for ST_WRITE in glibc */
37/* 0x0100 used for ST_APPEND in glibc */
38/* 0x0200 used for ST_IMMUTABLE in glibc */
39#define ST_NOATIME 0x0400 /* do not update access times */
40#define ST_NODIRATIME 0x0800 /* do not update directory access times */
41#define ST_RELATIME 0x1000 /* update atime relative to mtime/ctime */
42
22#endif 43#endif
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 87d7ec0bf779..5bbc447175dc 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -61,13 +61,7 @@ struct rpc_cred {
61/* 61/*
62 * Client authentication handle 62 * Client authentication handle
63 */ 63 */
64#define RPC_CREDCACHE_HASHBITS 4 64struct rpc_cred_cache;
65#define RPC_CREDCACHE_NR (1 << RPC_CREDCACHE_HASHBITS)
66struct rpc_cred_cache {
67 struct hlist_head hashtable[RPC_CREDCACHE_NR];
68 spinlock_t lock;
69};
70
71struct rpc_authops; 65struct rpc_authops;
72struct rpc_auth { 66struct rpc_auth {
73 unsigned int au_cslack; /* call cred size estimate */ 67 unsigned int au_cslack; /* call cred size estimate */
@@ -112,7 +106,7 @@ struct rpc_credops {
112 void (*crdestroy)(struct rpc_cred *); 106 void (*crdestroy)(struct rpc_cred *);
113 107
114 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int); 108 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int);
115 void (*crbind)(struct rpc_task *, struct rpc_cred *, int); 109 struct rpc_cred * (*crbind)(struct rpc_task *, struct rpc_cred *, int);
116 __be32 * (*crmarshal)(struct rpc_task *, __be32 *); 110 __be32 * (*crmarshal)(struct rpc_task *, __be32 *);
117 int (*crrefresh)(struct rpc_task *); 111 int (*crrefresh)(struct rpc_task *);
118 __be32 * (*crvalidate)(struct rpc_task *, __be32 *); 112 __be32 * (*crvalidate)(struct rpc_task *, __be32 *);
@@ -125,11 +119,12 @@ struct rpc_credops {
125extern const struct rpc_authops authunix_ops; 119extern const struct rpc_authops authunix_ops;
126extern const struct rpc_authops authnull_ops; 120extern const struct rpc_authops authnull_ops;
127 121
128void __init rpc_init_authunix(void); 122int __init rpc_init_authunix(void);
129void __init rpc_init_generic_auth(void); 123int __init rpc_init_generic_auth(void);
130void __init rpcauth_init_module(void); 124int __init rpcauth_init_module(void);
131void __exit rpcauth_remove_module(void); 125void __exit rpcauth_remove_module(void);
132void __exit rpc_destroy_generic_auth(void); 126void __exit rpc_destroy_generic_auth(void);
127void rpc_destroy_authunix(void);
133 128
134struct rpc_cred * rpc_lookup_cred(void); 129struct rpc_cred * rpc_lookup_cred(void);
135struct rpc_cred * rpc_lookup_machine_cred(void); 130struct rpc_cred * rpc_lookup_machine_cred(void);
@@ -140,10 +135,8 @@ void rpcauth_release(struct rpc_auth *);
140struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int); 135struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int);
141void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *); 136void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *);
142struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int); 137struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int);
143void rpcauth_bindcred(struct rpc_task *, struct rpc_cred *, int); 138struct rpc_cred * rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *, int);
144void rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *, int);
145void put_rpccred(struct rpc_cred *); 139void put_rpccred(struct rpc_cred *);
146void rpcauth_unbindcred(struct rpc_task *);
147__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *); 140__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *);
148__be32 * rpcauth_checkverf(struct rpc_task *, __be32 *); 141__be32 * rpcauth_checkverf(struct rpc_task *, __be32 *);
149int rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, __be32 *data, void *obj); 142int rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, __be32 *data, void *obj);
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 6f52b4d7c447..7bf3e84b92f4 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -192,6 +192,7 @@ extern int cache_check(struct cache_detail *detail,
192extern void cache_flush(void); 192extern void cache_flush(void);
193extern void cache_purge(struct cache_detail *detail); 193extern void cache_purge(struct cache_detail *detail);
194#define NEVER (0x7FFFFFFF) 194#define NEVER (0x7FFFFFFF)
195extern void __init cache_initialize(void);
195extern int cache_register(struct cache_detail *cd); 196extern int cache_register(struct cache_detail *cd);
196extern void cache_unregister(struct cache_detail *cd); 197extern void cache_unregister(struct cache_detail *cd);
197 198
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 8ed9642a5a76..569dc722a600 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -131,6 +131,7 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
131struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); 131struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
132void rpc_shutdown_client(struct rpc_clnt *); 132void rpc_shutdown_client(struct rpc_clnt *);
133void rpc_release_client(struct rpc_clnt *); 133void rpc_release_client(struct rpc_clnt *);
134void rpc_task_release_client(struct rpc_task *);
134 135
135int rpcb_register(u32, u32, int, unsigned short); 136int rpcb_register(u32, u32, int, unsigned short);
136int rpcb_v4_register(const u32 program, const u32 version, 137int rpcb_v4_register(const u32 program, const u32 version,
@@ -148,8 +149,8 @@ int rpc_call_sync(struct rpc_clnt *clnt,
148 const struct rpc_message *msg, int flags); 149 const struct rpc_message *msg, int flags);
149struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, 150struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred,
150 int flags); 151 int flags);
151void rpc_restart_call_prepare(struct rpc_task *); 152int rpc_restart_call_prepare(struct rpc_task *);
152void rpc_restart_call(struct rpc_task *); 153int rpc_restart_call(struct rpc_task *);
153void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); 154void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
154size_t rpc_max_payload(struct rpc_clnt *); 155size_t rpc_max_payload(struct rpc_clnt *);
155void rpc_force_rebind(struct rpc_clnt *); 156void rpc_force_rebind(struct rpc_clnt *);
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 7be4f3a6d246..88513fd8e208 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -213,6 +213,7 @@ struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req,
213 const struct rpc_call_ops *ops); 213 const struct rpc_call_ops *ops);
214void rpc_put_task(struct rpc_task *); 214void rpc_put_task(struct rpc_task *);
215void rpc_exit_task(struct rpc_task *); 215void rpc_exit_task(struct rpc_task *);
216void rpc_exit(struct rpc_task *, int);
216void rpc_release_calldata(const struct rpc_call_ops *, void *); 217void rpc_release_calldata(const struct rpc_call_ops *, void *);
217void rpc_killall_tasks(struct rpc_clnt *); 218void rpc_killall_tasks(struct rpc_clnt *);
218void rpc_execute(struct rpc_task *); 219void rpc_execute(struct rpc_task *);
@@ -241,12 +242,6 @@ void rpc_destroy_mempool(void);
241extern struct workqueue_struct *rpciod_workqueue; 242extern struct workqueue_struct *rpciod_workqueue;
242void rpc_prepare_task(struct rpc_task *task); 243void rpc_prepare_task(struct rpc_task *task);
243 244
244static inline void rpc_exit(struct rpc_task *task, int status)
245{
246 task->tk_status = status;
247 task->tk_action = rpc_exit_task;
248}
249
250static inline int rpc_wait_for_completion_task(struct rpc_task *task) 245static inline int rpc_wait_for_completion_task(struct rpc_task *task)
251{ 246{
252 return __rpc_wait_for_completion_task(task, NULL); 247 return __rpc_wait_for_completion_task(task, NULL);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index b51470302399..ff5a77b28c50 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -64,6 +64,7 @@ struct rpc_rqst {
64 * This is the private part 64 * This is the private part
65 */ 65 */
66 struct rpc_task * rq_task; /* RPC task data */ 66 struct rpc_task * rq_task; /* RPC task data */
67 struct rpc_cred * rq_cred; /* Bound cred */
67 __be32 rq_xid; /* request XID */ 68 __be32 rq_xid; /* request XID */
68 int rq_cong; /* has incremented xprt->cong */ 69 int rq_cong; /* has incremented xprt->cong */
69 u32 rq_seqno; /* gss seq no. used on req. */ 70 u32 rq_seqno; /* gss seq no. used on req. */
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index bc7d6bb4cd8e..4af270ec2204 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -61,14 +61,15 @@ typedef int __bitwise suspend_state_t;
61 * before device drivers' late suspend callbacks are executed. It returns 61 * before device drivers' late suspend callbacks are executed. It returns
62 * 0 on success or a negative error code otherwise, in which case the 62 * 0 on success or a negative error code otherwise, in which case the
63 * system cannot enter the desired sleep state (@prepare_late(), @enter(), 63 * system cannot enter the desired sleep state (@prepare_late(), @enter(),
64 * @wake(), and @finish() will not be called in that case). 64 * and @wake() will not be called in that case).
65 * 65 *
66 * @prepare_late: Finish preparing the platform for entering the system sleep 66 * @prepare_late: Finish preparing the platform for entering the system sleep
67 * state indicated by @begin(). 67 * state indicated by @begin().
68 * @prepare_late is called before disabling nonboot CPUs and after 68 * @prepare_late is called before disabling nonboot CPUs and after
69 * device drivers' late suspend callbacks have been executed. It returns 69 * device drivers' late suspend callbacks have been executed. It returns
70 * 0 on success or a negative error code otherwise, in which case the 70 * 0 on success or a negative error code otherwise, in which case the
71 * system cannot enter the desired sleep state (@enter() and @wake()). 71 * system cannot enter the desired sleep state (@enter() will not be
72 * executed).
72 * 73 *
73 * @enter: Enter the system sleep state indicated by @begin() or represented by 74 * @enter: Enter the system sleep state indicated by @begin() or represented by
74 * the argument if @begin() is not implemented. 75 * the argument if @begin() is not implemented.
@@ -81,14 +82,15 @@ typedef int __bitwise suspend_state_t;
81 * resume callbacks are executed. 82 * resume callbacks are executed.
82 * This callback is optional, but should be implemented by the platforms 83 * This callback is optional, but should be implemented by the platforms
83 * that implement @prepare_late(). If implemented, it is always called 84 * that implement @prepare_late(). If implemented, it is always called
84 * after @enter(), even if @enter() fails. 85 * after @prepare_late and @enter(), even if one of them fails.
85 * 86 *
86 * @finish: Finish wake-up of the platform. 87 * @finish: Finish wake-up of the platform.
87 * @finish is called right prior to calling device drivers' regular suspend 88 * @finish is called right prior to calling device drivers' regular suspend
88 * callbacks. 89 * callbacks.
89 * This callback is optional, but should be implemented by the platforms 90 * This callback is optional, but should be implemented by the platforms
90 * that implement @prepare(). If implemented, it is always called after 91 * that implement @prepare(). If implemented, it is always called after
91 * @enter() and @wake(), if implemented, even if any of them fails. 92 * @enter() and @wake(), even if any of them fails. It is executed after
93 * a failing @prepare.
92 * 94 *
93 * @end: Called by the PM core right after resuming devices, to indicate to 95 * @end: Called by the PM core right after resuming devices, to indicate to
94 * the platform that the system has returned to the working state or 96 * the platform that the system has returned to the working state or
@@ -286,6 +288,13 @@ extern int unregister_pm_notifier(struct notifier_block *nb);
286 { .notifier_call = fn, .priority = pri }; \ 288 { .notifier_call = fn, .priority = pri }; \
287 register_pm_notifier(&fn##_nb); \ 289 register_pm_notifier(&fn##_nb); \
288} 290}
291
292/* drivers/base/power/wakeup.c */
293extern bool events_check_enabled;
294
295extern bool pm_check_wakeup_events(void);
296extern bool pm_get_wakeup_count(unsigned long *count);
297extern bool pm_save_wakeup_count(unsigned long count);
289#else /* !CONFIG_PM_SLEEP */ 298#else /* !CONFIG_PM_SLEEP */
290 299
291static inline int register_pm_notifier(struct notifier_block *nb) 300static inline int register_pm_notifier(struct notifier_block *nb)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index ff4acea9bbdb..2fee51a11b73 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -244,8 +244,7 @@ extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
244extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, 244extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
245 gfp_t gfp_mask, bool noswap, 245 gfp_t gfp_mask, bool noswap,
246 unsigned int swappiness, 246 unsigned int swappiness,
247 struct zone *zone, 247 struct zone *zone);
248 int nid);
249extern int __isolate_lru_page(struct page *page, int mode, int file); 248extern int __isolate_lru_page(struct page *page, int mode, int file);
250extern unsigned long shrink_all_memory(unsigned long nr_pages); 249extern unsigned long shrink_all_memory(unsigned long nr_pages);
251extern int vm_swappiness; 250extern int vm_swappiness;
@@ -316,7 +315,6 @@ extern long nr_swap_pages;
316extern long total_swap_pages; 315extern long total_swap_pages;
317extern void si_swapinfo(struct sysinfo *); 316extern void si_swapinfo(struct sysinfo *);
318extern swp_entry_t get_swap_page(void); 317extern swp_entry_t get_swap_page(void);
319extern swp_entry_t get_swap_page_of_type(int);
320extern int valid_swaphandles(swp_entry_t, unsigned long *); 318extern int valid_swaphandles(swp_entry_t, unsigned long *);
321extern int add_swap_count_continuation(swp_entry_t, gfp_t); 319extern int add_swap_count_continuation(swp_entry_t, gfp_t);
322extern void swap_shmem_alloc(swp_entry_t); 320extern void swap_shmem_alloc(swp_entry_t);
@@ -333,6 +331,13 @@ extern int reuse_swap_page(struct page *);
333extern int try_to_free_swap(struct page *); 331extern int try_to_free_swap(struct page *);
334struct backing_dev_info; 332struct backing_dev_info;
335 333
334#ifdef CONFIG_HIBERNATION
335void hibernation_freeze_swap(void);
336void hibernation_thaw_swap(void);
337swp_entry_t get_swap_for_hibernation(int type);
338void swap_free_for_hibernation(swp_entry_t val);
339#endif
340
336/* linux/mm/thrash.c */ 341/* linux/mm/thrash.c */
337extern struct mm_struct *swap_token_mm; 342extern struct mm_struct *swap_token_mm;
338extern void grab_swap_token(struct mm_struct *); 343extern void grab_swap_token(struct mm_struct *);
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index 81a4e213c6cf..8c0e349f4a6c 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -23,6 +23,29 @@ extern int swiotlb_force;
23#define IO_TLB_SHIFT 11 23#define IO_TLB_SHIFT 11
24 24
25extern void swiotlb_init(int verbose); 25extern void swiotlb_init(int verbose);
26extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose);
27
28/*
29 * Enumeration for sync targets
30 */
31enum dma_sync_target {
32 SYNC_FOR_CPU = 0,
33 SYNC_FOR_DEVICE = 1,
34};
35extern void *swiotlb_tbl_map_single(struct device *hwdev, dma_addr_t tbl_dma_addr,
36 phys_addr_t phys, size_t size,
37 enum dma_data_direction dir);
38
39extern void swiotlb_tbl_unmap_single(struct device *hwdev, char *dma_addr,
40 size_t size, enum dma_data_direction dir);
41
42extern void swiotlb_tbl_sync_single(struct device *hwdev, char *dma_addr,
43 size_t size, enum dma_data_direction dir,
44 enum dma_sync_target target);
45
46/* Accessory functions. */
47extern void swiotlb_bounce(phys_addr_t phys, char *dma_addr, size_t size,
48 enum dma_data_direction dir);
26 49
27extern void 50extern void
28*swiotlb_alloc_coherent(struct device *hwdev, size_t size, 51*swiotlb_alloc_coherent(struct device *hwdev, size_t size,
@@ -42,11 +65,11 @@ extern void swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
42 65
43extern int 66extern int
44swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, 67swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
45 int direction); 68 enum dma_data_direction dir);
46 69
47extern void 70extern void
48swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents, 71swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
49 int direction); 72 enum dma_data_direction dir);
50 73
51extern int 74extern int
52swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems, 75swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems,
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 13ebb5413a79..6e5d19788634 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -35,6 +35,7 @@ struct oldold_utsname;
35struct old_utsname; 35struct old_utsname;
36struct pollfd; 36struct pollfd;
37struct rlimit; 37struct rlimit;
38struct rlimit64;
38struct rusage; 39struct rusage;
39struct sched_param; 40struct sched_param;
40struct sel_arg_struct; 41struct sel_arg_struct;
@@ -167,7 +168,6 @@ extern struct trace_event_functions exit_syscall_print_funcs;
167 .enter_event = &event_enter_##sname, \ 168 .enter_event = &event_enter_##sname, \
168 .exit_event = &event_exit_##sname, \ 169 .exit_event = &event_exit_##sname, \
169 .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \ 170 .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \
170 .exit_fields = LIST_HEAD_INIT(__syscall_meta_##sname.exit_fields), \
171 }; 171 };
172 172
173#define SYSCALL_DEFINE0(sname) \ 173#define SYSCALL_DEFINE0(sname) \
@@ -182,7 +182,6 @@ extern struct trace_event_functions exit_syscall_print_funcs;
182 .enter_event = &event_enter__##sname, \ 182 .enter_event = &event_enter__##sname, \
183 .exit_event = &event_exit__##sname, \ 183 .exit_event = &event_exit__##sname, \
184 .enter_fields = LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \ 184 .enter_fields = LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \
185 .exit_fields = LIST_HEAD_INIT(__syscall_meta__##sname.exit_fields), \
186 }; \ 185 }; \
187 asmlinkage long sys_##sname(void) 186 asmlinkage long sys_##sname(void)
188#else 187#else
@@ -395,7 +394,7 @@ asmlinkage long sys_umount(char __user *name, int flags);
395asmlinkage long sys_oldumount(char __user *name); 394asmlinkage long sys_oldumount(char __user *name);
396asmlinkage long sys_truncate(const char __user *path, long length); 395asmlinkage long sys_truncate(const char __user *path, long length);
397asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length); 396asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length);
398asmlinkage long sys_stat(char __user *filename, 397asmlinkage long sys_stat(const char __user *filename,
399 struct __old_kernel_stat __user *statbuf); 398 struct __old_kernel_stat __user *statbuf);
400asmlinkage long sys_statfs(const char __user * path, 399asmlinkage long sys_statfs(const char __user * path,
401 struct statfs __user *buf); 400 struct statfs __user *buf);
@@ -404,21 +403,21 @@ asmlinkage long sys_statfs64(const char __user *path, size_t sz,
404asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user *buf); 403asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user *buf);
405asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz, 404asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz,
406 struct statfs64 __user *buf); 405 struct statfs64 __user *buf);
407asmlinkage long sys_lstat(char __user *filename, 406asmlinkage long sys_lstat(const char __user *filename,
408 struct __old_kernel_stat __user *statbuf); 407 struct __old_kernel_stat __user *statbuf);
409asmlinkage long sys_fstat(unsigned int fd, 408asmlinkage long sys_fstat(unsigned int fd,
410 struct __old_kernel_stat __user *statbuf); 409 struct __old_kernel_stat __user *statbuf);
411asmlinkage long sys_newstat(char __user *filename, 410asmlinkage long sys_newstat(const char __user *filename,
412 struct stat __user *statbuf); 411 struct stat __user *statbuf);
413asmlinkage long sys_newlstat(char __user *filename, 412asmlinkage long sys_newlstat(const char __user *filename,
414 struct stat __user *statbuf); 413 struct stat __user *statbuf);
415asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf); 414asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf);
416asmlinkage long sys_ustat(unsigned dev, struct ustat __user *ubuf); 415asmlinkage long sys_ustat(unsigned dev, struct ustat __user *ubuf);
417#if BITS_PER_LONG == 32 416#if BITS_PER_LONG == 32
418asmlinkage long sys_stat64(char __user *filename, 417asmlinkage long sys_stat64(const char __user *filename,
419 struct stat64 __user *statbuf); 418 struct stat64 __user *statbuf);
420asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user *statbuf); 419asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user *statbuf);
421asmlinkage long sys_lstat64(char __user *filename, 420asmlinkage long sys_lstat64(const char __user *filename,
422 struct stat64 __user *statbuf); 421 struct stat64 __user *statbuf);
423asmlinkage long sys_truncate64(const char __user *path, loff_t length); 422asmlinkage long sys_truncate64(const char __user *path, loff_t length);
424asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length); 423asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length);
@@ -646,6 +645,9 @@ asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *r
646#endif 645#endif
647asmlinkage long sys_setrlimit(unsigned int resource, 646asmlinkage long sys_setrlimit(unsigned int resource,
648 struct rlimit __user *rlim); 647 struct rlimit __user *rlim);
648asmlinkage long sys_prlimit64(pid_t pid, unsigned int resource,
649 const struct rlimit64 __user *new_rlim,
650 struct rlimit64 __user *old_rlim);
649asmlinkage long sys_getrusage(int who, struct rusage __user *ru); 651asmlinkage long sys_getrusage(int who, struct rusage __user *ru);
650asmlinkage long sys_umask(int mask); 652asmlinkage long sys_umask(int mask);
651 653
@@ -758,7 +760,7 @@ asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
758 int newdfd, const char __user *newname, int flags); 760 int newdfd, const char __user *newname, int flags);
759asmlinkage long sys_renameat(int olddfd, const char __user * oldname, 761asmlinkage long sys_renameat(int olddfd, const char __user * oldname,
760 int newdfd, const char __user * newname); 762 int newdfd, const char __user * newname);
761asmlinkage long sys_futimesat(int dfd, char __user *filename, 763asmlinkage long sys_futimesat(int dfd, const char __user *filename,
762 struct timeval __user *utimes); 764 struct timeval __user *utimes);
763asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode); 765asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode);
764asmlinkage long sys_fchmodat(int dfd, const char __user * filename, 766asmlinkage long sys_fchmodat(int dfd, const char __user * filename,
@@ -767,13 +769,13 @@ asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user,
767 gid_t group, int flag); 769 gid_t group, int flag);
768asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, 770asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
769 int mode); 771 int mode);
770asmlinkage long sys_newfstatat(int dfd, char __user *filename, 772asmlinkage long sys_newfstatat(int dfd, const char __user *filename,
771 struct stat __user *statbuf, int flag); 773 struct stat __user *statbuf, int flag);
772asmlinkage long sys_fstatat64(int dfd, char __user *filename, 774asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
773 struct stat64 __user *statbuf, int flag); 775 struct stat64 __user *statbuf, int flag);
774asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *buf, 776asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *buf,
775 int bufsiz); 777 int bufsiz);
776asmlinkage long sys_utimensat(int dfd, char __user *filename, 778asmlinkage long sys_utimensat(int dfd, const char __user *filename,
777 struct timespec __user *utimes, int flags); 779 struct timespec __user *utimes, int flags);
778asmlinkage long sys_unshare(unsigned long unshare_flags); 780asmlinkage long sys_unshare(unsigned long unshare_flags);
779 781
@@ -813,6 +815,10 @@ asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,
813asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int, 815asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int,
814 struct timespec __user *, const sigset_t __user *, 816 struct timespec __user *, const sigset_t __user *,
815 size_t); 817 size_t);
818asmlinkage long sys_fanotify_init(unsigned int flags, unsigned int event_f_flags);
819asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags,
820 u64 mask, int fd,
821 const char __user *pathname);
816 822
817int kernel_execve(const char *filename, char *const argv[], char *const envp[]); 823int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
818 824
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index f2694eb4dd3d..3c92121ba9af 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -22,14 +22,8 @@ struct kobject;
22struct module; 22struct module;
23enum kobj_ns_type; 23enum kobj_ns_type;
24 24
25/* FIXME
26 * The *owner field is no longer used.
27 * x86 tree has been cleaned up. The owner
28 * attribute is still left for other arches.
29 */
30struct attribute { 25struct attribute {
31 const char *name; 26 const char *name;
32 struct module *owner;
33 mode_t mode; 27 mode_t mode;
34#ifdef CONFIG_DEBUG_LOCK_ALLOC 28#ifdef CONFIG_DEBUG_LOCK_ALLOC
35 struct lock_class_key *key; 29 struct lock_class_key *key;
@@ -136,8 +130,8 @@ int __must_check sysfs_create_file(struct kobject *kobj,
136 const struct attribute *attr); 130 const struct attribute *attr);
137int __must_check sysfs_create_files(struct kobject *kobj, 131int __must_check sysfs_create_files(struct kobject *kobj,
138 const struct attribute **attr); 132 const struct attribute **attr);
139int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, 133int __must_check sysfs_chmod_file(struct kobject *kobj,
140 mode_t mode); 134 const struct attribute *attr, mode_t mode);
141void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); 135void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr);
142void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); 136void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);
143 137
@@ -225,7 +219,7 @@ static inline int sysfs_create_files(struct kobject *kobj,
225} 219}
226 220
227static inline int sysfs_chmod_file(struct kobject *kobj, 221static inline int sysfs_chmod_file(struct kobject *kobj,
228 struct attribute *attr, mode_t mode) 222 const struct attribute *attr, mode_t mode)
229{ 223{
230 return 0; 224 return 0;
231} 225}
diff --git a/include/linux/sysv_fs.h b/include/linux/sysv_fs.h
index 96411306eec6..e47d6d90023d 100644
--- a/include/linux/sysv_fs.h
+++ b/include/linux/sysv_fs.h
@@ -148,6 +148,17 @@ struct v7_super_block {
148 char s_fname[6]; /* file system name */ 148 char s_fname[6]; /* file system name */
149 char s_fpack[6]; /* file system pack name */ 149 char s_fpack[6]; /* file system pack name */
150}; 150};
151/* Constants to aid sanity checking */
152/* This is not a hard limit, nor enforced by v7 kernel. It's actually just
153 * the limit used by Seventh Edition's ls, though is high enough to assume
154 * that no reasonable file system would have that much entries in root
155 * directory. Thus, if we see anything higher, we just probably got the
156 * endiannes wrong. */
157#define V7_NFILES 1024
158/* The disk addresses are three-byte (despite direct block addresses being
159 * aligned word-wise in inode). If the most significant byte is non-zero,
160 * something is most likely wrong (not a filesystem, bad bytesex). */
161#define V7_MAXSIZE 0x00ffffff
151 162
152/* Coherent super-block data on disk */ 163/* Coherent super-block data on disk */
153#define COH_NICINOD 100 /* number of inode cache entries */ 164#define COH_NICINOD 100 /* number of inode cache entries */
diff --git a/include/linux/time.h b/include/linux/time.h
index ea3559f0b3f2..9f15ac7ab92a 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -38,7 +38,7 @@ extern struct timezone sys_tz;
38#define NSEC_PER_MSEC 1000000L 38#define NSEC_PER_MSEC 1000000L
39#define USEC_PER_SEC 1000000L 39#define USEC_PER_SEC 1000000L
40#define NSEC_PER_SEC 1000000000L 40#define NSEC_PER_SEC 1000000000L
41#define FSEC_PER_SEC 1000000000000000L 41#define FSEC_PER_SEC 1000000000000000LL
42 42
43#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) 43#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
44 44
@@ -76,9 +76,25 @@ extern unsigned long mktime(const unsigned int year, const unsigned int mon,
76 const unsigned int min, const unsigned int sec); 76 const unsigned int min, const unsigned int sec);
77 77
78extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec); 78extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec);
79
80/*
81 * timespec_add_safe assumes both values are positive and checks
82 * for overflow. It will return TIME_T_MAX if the reutrn would be
83 * smaller then either of the arguments.
84 */
79extern struct timespec timespec_add_safe(const struct timespec lhs, 85extern struct timespec timespec_add_safe(const struct timespec lhs,
80 const struct timespec rhs); 86 const struct timespec rhs);
81 87
88
89static inline struct timespec timespec_add(struct timespec lhs,
90 struct timespec rhs)
91{
92 struct timespec ts_delta;
93 set_normalized_timespec(&ts_delta, lhs.tv_sec + rhs.tv_sec,
94 lhs.tv_nsec + rhs.tv_nsec);
95 return ts_delta;
96}
97
82/* 98/*
83 * sub = lhs - rhs, in normalized form 99 * sub = lhs - rhs, in normalized form
84 */ 100 */
@@ -97,8 +113,6 @@ static inline struct timespec timespec_sub(struct timespec lhs,
97#define timespec_valid(ts) \ 113#define timespec_valid(ts) \
98 (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC)) 114 (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC))
99 115
100extern struct timespec xtime;
101extern struct timespec wall_to_monotonic;
102extern seqlock_t xtime_lock; 116extern seqlock_t xtime_lock;
103 117
104extern void read_persistent_clock(struct timespec *ts); 118extern void read_persistent_clock(struct timespec *ts);
@@ -110,7 +124,8 @@ extern int timekeeping_suspended;
110 124
111unsigned long get_seconds(void); 125unsigned long get_seconds(void);
112struct timespec current_kernel_time(void); 126struct timespec current_kernel_time(void);
113struct timespec __current_kernel_time(void); /* does not hold xtime_lock */ 127struct timespec __current_kernel_time(void); /* does not take xtime_lock */
128struct timespec __get_wall_to_monotonic(void); /* does not take xtime_lock */
114struct timespec get_monotonic_coarse(void); 129struct timespec get_monotonic_coarse(void);
115 130
116#define CURRENT_TIME (current_kernel_time()) 131#define CURRENT_TIME (current_kernel_time())
@@ -135,7 +150,7 @@ extern void do_gettimeofday(struct timeval *tv);
135extern int do_settimeofday(struct timespec *tv); 150extern int do_settimeofday(struct timespec *tv);
136extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz); 151extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz);
137#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) 152#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts)
138extern long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags); 153extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags);
139struct itimerval; 154struct itimerval;
140extern int do_setitimer(int which, struct itimerval *value, 155extern int do_setitimer(int which, struct itimerval *value,
141 struct itimerval *ovalue); 156 struct itimerval *ovalue);
diff --git a/include/linux/timer.h b/include/linux/timer.h
index ea965b857a50..38cf093ef62c 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -100,6 +100,13 @@ void init_timer_deferrable_key(struct timer_list *timer,
100 setup_timer_on_stack_key((timer), #timer, &__key, \ 100 setup_timer_on_stack_key((timer), #timer, &__key, \
101 (fn), (data)); \ 101 (fn), (data)); \
102 } while (0) 102 } while (0)
103#define setup_deferrable_timer_on_stack(timer, fn, data) \
104 do { \
105 static struct lock_class_key __key; \
106 setup_deferrable_timer_on_stack_key((timer), #timer, \
107 &__key, (fn), \
108 (data)); \
109 } while (0)
103#else 110#else
104#define init_timer(timer)\ 111#define init_timer(timer)\
105 init_timer_key((timer), NULL, NULL) 112 init_timer_key((timer), NULL, NULL)
@@ -111,6 +118,8 @@ void init_timer_deferrable_key(struct timer_list *timer,
111 setup_timer_key((timer), NULL, NULL, (fn), (data)) 118 setup_timer_key((timer), NULL, NULL, (fn), (data))
112#define setup_timer_on_stack(timer, fn, data)\ 119#define setup_timer_on_stack(timer, fn, data)\
113 setup_timer_on_stack_key((timer), NULL, NULL, (fn), (data)) 120 setup_timer_on_stack_key((timer), NULL, NULL, (fn), (data))
121#define setup_deferrable_timer_on_stack(timer, fn, data)\
122 setup_deferrable_timer_on_stack_key((timer), NULL, NULL, (fn), (data))
114#endif 123#endif
115 124
116#ifdef CONFIG_DEBUG_OBJECTS_TIMERS 125#ifdef CONFIG_DEBUG_OBJECTS_TIMERS
@@ -150,6 +159,12 @@ static inline void setup_timer_on_stack_key(struct timer_list *timer,
150 init_timer_on_stack_key(timer, name, key); 159 init_timer_on_stack_key(timer, name, key);
151} 160}
152 161
162extern void setup_deferrable_timer_on_stack_key(struct timer_list *timer,
163 const char *name,
164 struct lock_class_key *key,
165 void (*function)(unsigned long),
166 unsigned long data);
167
153/** 168/**
154 * timer_pending - is a timer pending? 169 * timer_pending - is a timer pending?
155 * @timer: the timer in question 170 * @timer: the timer in question
diff --git a/include/linux/topology.h b/include/linux/topology.h
index c44df50a05ab..64e084ff5e5c 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -103,6 +103,7 @@ int arch_update_cpu_topology(void);
103 | 1*SD_SHARE_PKG_RESOURCES \ 103 | 1*SD_SHARE_PKG_RESOURCES \
104 | 0*SD_SERIALIZE \ 104 | 0*SD_SERIALIZE \
105 | 0*SD_PREFER_SIBLING \ 105 | 0*SD_PREFER_SIBLING \
106 | arch_sd_sibling_asym_packing() \
106 , \ 107 , \
107 .last_balance = jiffies, \ 108 .last_balance = jiffies, \
108 .balance_interval = 1, \ 109 .balance_interval = 1, \
@@ -291,10 +292,6 @@ static inline void set_cpu_numa_mem(int cpu, int node)
291 292
292#else /* !CONFIG_HAVE_MEMORYLESS_NODES */ 293#else /* !CONFIG_HAVE_MEMORYLESS_NODES */
293 294
294static inline void set_numa_mem(int node) {}
295
296static inline void set_cpu_numa_mem(int cpu, int node) {}
297
298#ifndef numa_mem_id 295#ifndef numa_mem_id
299/* Returns the number of the nearest Node with memory */ 296/* Returns the number of the nearest Node with memory */
300static inline int numa_mem_id(void) 297static inline int numa_mem_id(void)
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 931078b73226..1437da3ddc62 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -13,6 +13,7 @@
13#include <linux/tty_driver.h> 13#include <linux/tty_driver.h>
14#include <linux/tty_ldisc.h> 14#include <linux/tty_ldisc.h>
15#include <linux/mutex.h> 15#include <linux/mutex.h>
16#include <linux/smp_lock.h>
16 17
17#include <asm/system.h> 18#include <asm/system.h>
18 19
@@ -179,6 +180,7 @@ struct tty_bufhead {
179#define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO) 180#define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO)
180#define L_PENDIN(tty) _L_FLAG((tty), PENDIN) 181#define L_PENDIN(tty) _L_FLAG((tty), PENDIN)
181#define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN) 182#define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN)
183#define L_EXTPROC(tty) _L_FLAG((tty), EXTPROC)
182 184
183struct device; 185struct device;
184struct signal_struct; 186struct signal_struct;
@@ -415,6 +417,7 @@ extern int is_ignored(int sig);
415extern int tty_signal(int sig, struct tty_struct *tty); 417extern int tty_signal(int sig, struct tty_struct *tty);
416extern void tty_hangup(struct tty_struct *tty); 418extern void tty_hangup(struct tty_struct *tty);
417extern void tty_vhangup(struct tty_struct *tty); 419extern void tty_vhangup(struct tty_struct *tty);
420extern void tty_vhangup_locked(struct tty_struct *tty);
418extern void tty_vhangup_self(void); 421extern void tty_vhangup_self(void);
419extern void tty_unhangup(struct file *filp); 422extern void tty_unhangup(struct file *filp);
420extern int tty_hung_up_p(struct file *filp); 423extern int tty_hung_up_p(struct file *filp);
@@ -552,6 +555,9 @@ static inline void tty_audit_push_task(struct task_struct *tsk,
552} 555}
553#endif 556#endif
554 557
558/* tty_io.c */
559extern int __init tty_init(void);
560
555/* tty_ioctl.c */ 561/* tty_ioctl.c */
556extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file, 562extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
557 unsigned int cmd, unsigned long arg); 563 unsigned int cmd, unsigned long arg);
@@ -572,5 +578,54 @@ extern int vt_ioctl(struct tty_struct *tty, struct file *file,
572extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file, 578extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file,
573 unsigned int cmd, unsigned long arg); 579 unsigned int cmd, unsigned long arg);
574 580
581/* tty_mutex.c */
582/* functions for preparation of BKL removal */
583extern void __lockfunc tty_lock(void) __acquires(tty_lock);
584extern void __lockfunc tty_unlock(void) __releases(tty_lock);
585extern struct task_struct *__big_tty_mutex_owner;
586#define tty_locked() (current == __big_tty_mutex_owner)
587
588/*
589 * wait_event_interruptible_tty -- wait for a condition with the tty lock held
590 *
591 * The condition we are waiting for might take a long time to
592 * become true, or might depend on another thread taking the
593 * BTM. In either case, we need to drop the BTM to guarantee
594 * forward progress. This is a leftover from the conversion
595 * from the BKL and should eventually get removed as the BTM
596 * falls out of use.
597 *
598 * Do not use in new code.
599 */
600#define wait_event_interruptible_tty(wq, condition) \
601({ \
602 int __ret = 0; \
603 if (!(condition)) { \
604 __wait_event_interruptible_tty(wq, condition, __ret); \
605 } \
606 __ret; \
607})
608
609#define __wait_event_interruptible_tty(wq, condition, ret) \
610do { \
611 DEFINE_WAIT(__wait); \
612 \
613 for (;;) { \
614 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
615 if (condition) \
616 break; \
617 if (!signal_pending(current)) { \
618 tty_unlock(); \
619 schedule(); \
620 tty_lock(); \
621 continue; \
622 } \
623 ret = -ERESTARTSYS; \
624 break; \
625 } \
626 finish_wait(&wq, &__wait); \
627} while (0)
628
629
575#endif /* __KERNEL__ */ 630#endif /* __KERNEL__ */
576#endif 631#endif
diff --git a/include/linux/types.h b/include/linux/types.h
index 23d237a075e2..01a082f56ef4 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -8,7 +8,10 @@
8 8
9#define DECLARE_BITMAP(name,bits) \ 9#define DECLARE_BITMAP(name,bits) \
10 unsigned long name[BITS_TO_LONGS(bits)] 10 unsigned long name[BITS_TO_LONGS(bits)]
11 11#else
12#ifndef __EXPORTED_HEADERS__
13#warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"
14#endif /* __EXPORTED_HEADERS__ */
12#endif 15#endif
13 16
14#include <linux/posix_types.h> 17#include <linux/posix_types.h>
@@ -197,6 +200,18 @@ typedef struct {
197} atomic64_t; 200} atomic64_t;
198#endif 201#endif
199 202
203struct list_head {
204 struct list_head *next, *prev;
205};
206
207struct hlist_head {
208 struct hlist_node *first;
209};
210
211struct hlist_node {
212 struct hlist_node *next, **pprev;
213};
214
200struct ustat { 215struct ustat {
201 __kernel_daddr_t f_tfree; 216 __kernel_daddr_t f_tfree;
202 __kernel_ino_t f_tinode; 217 __kernel_ino_t f_tinode;
diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h
new file mode 100644
index 000000000000..fa261a0da280
--- /dev/null
+++ b/include/linux/u64_stats_sync.h
@@ -0,0 +1,140 @@
1#ifndef _LINUX_U64_STATS_SYNC_H
2#define _LINUX_U64_STATS_SYNC_H
3
4/*
5 * To properly implement 64bits network statistics on 32bit and 64bit hosts,
6 * we provide a synchronization point, that is a noop on 64bit or UP kernels.
7 *
8 * Key points :
9 * 1) Use a seqcount on SMP 32bits, with low overhead.
10 * 2) Whole thing is a noop on 64bit arches or UP kernels.
11 * 3) Write side must ensure mutual exclusion or one seqcount update could
12 * be lost, thus blocking readers forever.
13 * If this synchronization point is not a mutex, but a spinlock or
14 * spinlock_bh() or disable_bh() :
15 * 3.1) Write side should not sleep.
16 * 3.2) Write side should not allow preemption.
17 * 3.3) If applicable, interrupts should be disabled.
18 *
19 * 4) If reader fetches several counters, there is no guarantee the whole values
20 * are consistent (remember point 1) : this is a noop on 64bit arches anyway)
21 *
22 * 5) readers are allowed to sleep or be preempted/interrupted : They perform
23 * pure reads. But if they have to fetch many values, it's better to not allow
24 * preemptions/interruptions to avoid many retries.
25 *
26 * 6) If counter might be written by an interrupt, readers should block interrupts.
27 * (On UP, there is no seqcount_t protection, a reader allowing interrupts could
28 * read partial values)
29 *
30 * 7) For softirq uses, readers can use u64_stats_fetch_begin_bh() and
31 * u64_stats_fetch_retry_bh() helpers
32 *
33 * Usage :
34 *
35 * Stats producer (writer) should use following template granted it already got
36 * an exclusive access to counters (a lock is already taken, or per cpu
37 * data is used [in a non preemptable context])
38 *
39 * spin_lock_bh(...) or other synchronization to get exclusive access
40 * ...
41 * u64_stats_update_begin(&stats->syncp);
42 * stats->bytes64 += len; // non atomic operation
43 * stats->packets64++; // non atomic operation
44 * u64_stats_update_end(&stats->syncp);
45 *
46 * While a consumer (reader) should use following template to get consistent
47 * snapshot for each variable (but no guarantee on several ones)
48 *
49 * u64 tbytes, tpackets;
50 * unsigned int start;
51 *
52 * do {
53 * start = u64_stats_fetch_begin(&stats->syncp);
54 * tbytes = stats->bytes64; // non atomic operation
55 * tpackets = stats->packets64; // non atomic operation
56 * } while (u64_stats_fetch_retry(&stats->syncp, start));
57 *
58 *
59 * Example of use in drivers/net/loopback.c, using per_cpu containers,
60 * in BH disabled context.
61 */
62#include <linux/seqlock.h>
63
64struct u64_stats_sync {
65#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
66 seqcount_t seq;
67#endif
68};
69
70static void inline u64_stats_update_begin(struct u64_stats_sync *syncp)
71{
72#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
73 write_seqcount_begin(&syncp->seq);
74#endif
75}
76
77static void inline u64_stats_update_end(struct u64_stats_sync *syncp)
78{
79#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
80 write_seqcount_end(&syncp->seq);
81#endif
82}
83
84static unsigned int inline u64_stats_fetch_begin(const struct u64_stats_sync *syncp)
85{
86#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
87 return read_seqcount_begin(&syncp->seq);
88#else
89#if BITS_PER_LONG==32
90 preempt_disable();
91#endif
92 return 0;
93#endif
94}
95
96static bool inline u64_stats_fetch_retry(const struct u64_stats_sync *syncp,
97 unsigned int start)
98{
99#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
100 return read_seqcount_retry(&syncp->seq, start);
101#else
102#if BITS_PER_LONG==32
103 preempt_enable();
104#endif
105 return false;
106#endif
107}
108
109/*
110 * In case softirq handlers can update u64 counters, readers can use following helpers
111 * - SMP 32bit arches use seqcount protection, irq safe.
112 * - UP 32bit must disable BH.
113 * - 64bit have no problem atomically reading u64 values, irq safe.
114 */
115static unsigned int inline u64_stats_fetch_begin_bh(const struct u64_stats_sync *syncp)
116{
117#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
118 return read_seqcount_begin(&syncp->seq);
119#else
120#if BITS_PER_LONG==32
121 local_bh_disable();
122#endif
123 return 0;
124#endif
125}
126
127static bool inline u64_stats_fetch_retry_bh(const struct u64_stats_sync *syncp,
128 unsigned int start)
129{
130#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
131 return read_seqcount_retry(&syncp->seq, start);
132#else
133#if BITS_PER_LONG==32
134 local_bh_enable();
135#endif
136 return false;
137#endif
138}
139
140#endif /* _LINUX_U64_STATS_SYNC_H */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d5922a877994..35fe6ab222bb 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -127,6 +127,8 @@ enum usb_interface_condition {
127 * queued reset so that usb_cancel_queued_reset() doesn't try to 127 * queued reset so that usb_cancel_queued_reset() doesn't try to
128 * remove from the workqueue when running inside the worker 128 * remove from the workqueue when running inside the worker
129 * thread. See __usb_queue_reset_device(). 129 * thread. See __usb_queue_reset_device().
130 * @resetting_device: USB core reset the device, so use alt setting 0 as
131 * current; needs bandwidth alloc after reset.
130 * 132 *
131 * USB device drivers attach to interfaces on a physical device. Each 133 * USB device drivers attach to interfaces on a physical device. Each
132 * interface encapsulates a single high level function, such as feeding 134 * interface encapsulates a single high level function, such as feeding
@@ -843,7 +845,7 @@ struct usb_driver {
843 845
844 void (*disconnect) (struct usb_interface *intf); 846 void (*disconnect) (struct usb_interface *intf);
845 847
846 int (*ioctl) (struct usb_interface *intf, unsigned int code, 848 int (*unlocked_ioctl) (struct usb_interface *intf, unsigned int code,
847 void *buf); 849 void *buf);
848 850
849 int (*suspend) (struct usb_interface *intf, pm_message_t message); 851 int (*suspend) (struct usb_interface *intf, pm_message_t message);
@@ -1015,6 +1017,7 @@ typedef void (*usb_complete_t)(struct urb *);
1015 * is a different endpoint (and pipe) from "out" endpoint two. 1017 * is a different endpoint (and pipe) from "out" endpoint two.
1016 * The current configuration controls the existence, type, and 1018 * The current configuration controls the existence, type, and
1017 * maximum packet size of any given endpoint. 1019 * maximum packet size of any given endpoint.
1020 * @stream_id: the endpoint's stream ID for bulk streams
1018 * @dev: Identifies the USB device to perform the request. 1021 * @dev: Identifies the USB device to perform the request.
1019 * @status: This is read in non-iso completion functions to get the 1022 * @status: This is read in non-iso completion functions to get the
1020 * status of the particular request. ISO requests only use it 1023 * status of the particular request. ISO requests only use it
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h
index 383b94ba8c20..964cb603f7c7 100644
--- a/include/linux/usb/audio-v2.h
+++ b/include/linux/usb/audio-v2.h
@@ -18,6 +18,21 @@
18/* v1.0 and v2.0 of this standard have many things in common. For the rest 18/* v1.0 and v2.0 of this standard have many things in common. For the rest
19 * of the definitions, please refer to audio.h */ 19 * of the definitions, please refer to audio.h */
20 20
21/*
22 * bmControl field decoders
23 *
24 * From the USB Audio spec v2.0:
25 *
26 * bmaControls() is a (ch+1)-element array of 4-byte bitmaps,
27 * each containing a set of bit pairs. If a Control is present,
28 * it must be Host readable. If a certain Control is not
29 * present then the bit pair must be set to 0b00.
30 * If a Control is present but read-only, the bit pair must be
31 * set to 0b01. If a Control is also Host programmable, the bit
32 * pair must be set to 0b11. The value 0b10 is not allowed.
33 *
34 */
35
21static inline bool uac2_control_is_readable(u32 bmControls, u8 control) 36static inline bool uac2_control_is_readable(u32 bmControls, u8 control)
22{ 37{
23 return (bmControls >> (control * 2)) & 0x1; 38 return (bmControls >> (control * 2)) & 0x1;
@@ -121,7 +136,7 @@ struct uac2_feature_unit_descriptor {
121 136
122/* 4.9.2 Class-Specific AS Interface Descriptor */ 137/* 4.9.2 Class-Specific AS Interface Descriptor */
123 138
124struct uac_as_header_descriptor_v2 { 139struct uac2_as_header_descriptor {
125 __u8 bLength; 140 __u8 bLength;
126 __u8 bDescriptorType; 141 __u8 bDescriptorType;
127 __u8 bDescriptorSubtype; 142 __u8 bDescriptorSubtype;
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index c51200c715e5..a54b8255d75f 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -39,8 +39,8 @@
39#define UAC_MIXER_UNIT 0x04 39#define UAC_MIXER_UNIT 0x04
40#define UAC_SELECTOR_UNIT 0x05 40#define UAC_SELECTOR_UNIT 0x05
41#define UAC_FEATURE_UNIT 0x06 41#define UAC_FEATURE_UNIT 0x06
42#define UAC_PROCESSING_UNIT_V1 0x07 42#define UAC1_PROCESSING_UNIT 0x07
43#define UAC_EXTENSION_UNIT_V1 0x08 43#define UAC1_EXTENSION_UNIT 0x08
44 44
45/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */ 45/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
46#define UAC_AS_GENERAL 0x01 46#define UAC_AS_GENERAL 0x01
@@ -151,7 +151,7 @@
151 151
152/* Terminal Control Selectors */ 152/* Terminal Control Selectors */
153/* 4.3.2 Class-Specific AC Interface Descriptor */ 153/* 4.3.2 Class-Specific AC Interface Descriptor */
154struct uac_ac_header_descriptor_v1 { 154struct uac1_ac_header_descriptor {
155 __u8 bLength; /* 8 + n */ 155 __u8 bLength; /* 8 + n */
156 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 156 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
157 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */ 157 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */
@@ -165,7 +165,7 @@ struct uac_ac_header_descriptor_v1 {
165 165
166/* As above, but more useful for defining your own descriptors: */ 166/* As above, but more useful for defining your own descriptors: */
167#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \ 167#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \
168struct uac_ac_header_descriptor_v1_##n { \ 168struct uac1_ac_header_descriptor_##n { \
169 __u8 bLength; \ 169 __u8 bLength; \
170 __u8 bDescriptorType; \ 170 __u8 bDescriptorType; \
171 __u8 bDescriptorSubtype; \ 171 __u8 bDescriptorSubtype; \
@@ -205,7 +205,7 @@ struct uac_input_terminal_descriptor {
205#define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01 205#define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01
206 206
207/* 4.3.2.2 Output Terminal Descriptor */ 207/* 4.3.2.2 Output Terminal Descriptor */
208struct uac_output_terminal_descriptor_v1 { 208struct uac1_output_terminal_descriptor {
209 __u8 bLength; /* in bytes: 9 */ 209 __u8 bLength; /* in bytes: 9 */
210 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ 210 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
211 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */ 211 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */
@@ -395,7 +395,7 @@ static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_desc
395} 395}
396 396
397/* 4.5.2 Class-Specific AS Interface Descriptor */ 397/* 4.5.2 Class-Specific AS Interface Descriptor */
398struct uac_as_header_descriptor_v1 { 398struct uac1_as_header_descriptor {
399 __u8 bLength; /* in bytes: 7 */ 399 __u8 bLength; /* in bytes: 7 */
400 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 400 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
401 __u8 bDescriptorSubtype; /* AS_GENERAL */ 401 __u8 bDescriptorSubtype; /* AS_GENERAL */
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 139353efad34..890bc1472190 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -276,6 +276,8 @@ struct usb_composite_driver {
276 int (*bind)(struct usb_composite_dev *); 276 int (*bind)(struct usb_composite_dev *);
277 int (*unbind)(struct usb_composite_dev *); 277 int (*unbind)(struct usb_composite_dev *);
278 278
279 void (*disconnect)(struct usb_composite_dev *);
280
279 /* global suspend hooks */ 281 /* global suspend hooks */
280 void (*suspend)(struct usb_composite_dev *); 282 void (*suspend)(struct usb_composite_dev *);
281 void (*resume)(struct usb_composite_dev *); 283 void (*resume)(struct usb_composite_dev *);
@@ -342,6 +344,10 @@ struct usb_composite_dev {
342}; 344};
343 345
344extern int usb_string_id(struct usb_composite_dev *c); 346extern int usb_string_id(struct usb_composite_dev *c);
347extern int usb_string_ids_tab(struct usb_composite_dev *c,
348 struct usb_string *str);
349extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n);
350
345 351
346/* messaging utils */ 352/* messaging utils */
347#define DBG(d, fmt, args...) \ 353#define DBG(d, fmt, args...) \
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
index 80287af2a738..2e262cb15425 100644
--- a/include/linux/usb/ehci_def.h
+++ b/include/linux/usb/ehci_def.h
@@ -39,6 +39,12 @@ struct ehci_caps {
39#define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */ 39#define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */
40 40
41 u32 hcc_params; /* HCCPARAMS - offset 0x8 */ 41 u32 hcc_params; /* HCCPARAMS - offset 0x8 */
42/* EHCI 1.1 addendum */
43#define HCC_32FRAME_PERIODIC_LIST(p) ((p)&(1 << 19))
44#define HCC_PER_PORT_CHANGE_EVENT(p) ((p)&(1 << 18))
45#define HCC_LPM(p) ((p)&(1 << 17))
46#define HCC_HW_PREFETCH(p) ((p)&(1 << 16))
47
42#define HCC_EXT_CAPS(p) (((p)>>8)&0xff) /* for pci extended caps */ 48#define HCC_EXT_CAPS(p) (((p)>>8)&0xff) /* for pci extended caps */
43#define HCC_ISOC_CACHE(p) ((p)&(1 << 7)) /* true: can cache isoc frame */ 49#define HCC_ISOC_CACHE(p) ((p)&(1 << 7)) /* true: can cache isoc frame */
44#define HCC_ISOC_THRES(p) (((p)>>4)&0x7) /* bits 6:4, uframes cached */ 50#define HCC_ISOC_THRES(p) (((p)>>4)&0x7) /* bits 6:4, uframes cached */
@@ -54,6 +60,13 @@ struct ehci_regs {
54 60
55 /* USBCMD: offset 0x00 */ 61 /* USBCMD: offset 0x00 */
56 u32 command; 62 u32 command;
63
64/* EHCI 1.1 addendum */
65#define CMD_HIRD (0xf<<24) /* host initiated resume duration */
66#define CMD_PPCEE (1<<15) /* per port change event enable */
67#define CMD_FSP (1<<14) /* fully synchronized prefetch */
68#define CMD_ASPE (1<<13) /* async schedule prefetch enable */
69#define CMD_PSPE (1<<12) /* periodic schedule prefetch enable */
57/* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */ 70/* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */
58#define CMD_PARK (1<<11) /* enable "park" on async qh */ 71#define CMD_PARK (1<<11) /* enable "park" on async qh */
59#define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */ 72#define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */
@@ -67,6 +80,7 @@ struct ehci_regs {
67 80
68 /* USBSTS: offset 0x04 */ 81 /* USBSTS: offset 0x04 */
69 u32 status; 82 u32 status;
83#define STS_PPCE_MASK (0xff<<16) /* Per-Port change event 1-16 */
70#define STS_ASS (1<<15) /* Async Schedule Status */ 84#define STS_ASS (1<<15) /* Async Schedule Status */
71#define STS_PSS (1<<14) /* Periodic Schedule Status */ 85#define STS_PSS (1<<14) /* Periodic Schedule Status */
72#define STS_RECL (1<<13) /* Reclamation */ 86#define STS_RECL (1<<13) /* Reclamation */
@@ -100,6 +114,14 @@ struct ehci_regs {
100 114
101 /* PORTSC: offset 0x44 */ 115 /* PORTSC: offset 0x44 */
102 u32 port_status[0]; /* up to N_PORTS */ 116 u32 port_status[0]; /* up to N_PORTS */
117/* EHCI 1.1 addendum */
118#define PORTSC_SUSPEND_STS_ACK 0
119#define PORTSC_SUSPEND_STS_NYET 1
120#define PORTSC_SUSPEND_STS_STALL 2
121#define PORTSC_SUSPEND_STS_ERR 3
122
123#define PORT_DEV_ADDR (0x7f<<25) /* device address */
124#define PORT_SSTS (0x3<<23) /* suspend status */
103/* 31:23 reserved */ 125/* 31:23 reserved */
104#define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */ 126#define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */
105#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ 127#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */
@@ -115,6 +137,7 @@ struct ehci_regs {
115#define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */ 137#define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */
116/* 11:10 for detecting lowspeed devices (reset vs release ownership) */ 138/* 11:10 for detecting lowspeed devices (reset vs release ownership) */
117/* 9 reserved */ 139/* 9 reserved */
140#define PORT_LPM (1<<9) /* LPM transaction */
118#define PORT_RESET (1<<8) /* reset port */ 141#define PORT_RESET (1<<8) /* reset port */
119#define PORT_SUSPEND (1<<7) /* suspend port */ 142#define PORT_SUSPEND (1<<7) /* suspend port */
120#define PORT_RESUME (1<<6) /* resume it */ 143#define PORT_RESUME (1<<6) /* resume it */
diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h
index a34a2a043b21..6f649c13193b 100644
--- a/include/linux/usb/functionfs.h
+++ b/include/linux/usb/functionfs.h
@@ -180,9 +180,9 @@ static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev)
180static void functionfs_unbind(struct ffs_data *ffs) 180static void functionfs_unbind(struct ffs_data *ffs)
181 __attribute__((nonnull)); 181 __attribute__((nonnull));
182 182
183static int functionfs_add(struct usb_composite_dev *cdev, 183static int functionfs_bind_config(struct usb_composite_dev *cdev,
184 struct usb_configuration *c, 184 struct usb_configuration *c,
185 struct ffs_data *ffs) 185 struct ffs_data *ffs)
186 __attribute__((warn_unused_result, nonnull)); 186 __attribute__((warn_unused_result, nonnull));
187 187
188 188
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 2e3a4ea1a3da..3b571f1ffbb3 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -89,18 +89,33 @@ struct usb_hcd {
89 */ 89 */
90 const struct hc_driver *driver; /* hw-specific hooks */ 90 const struct hc_driver *driver; /* hw-specific hooks */
91 91
92 /* Flags that need to be manipulated atomically */ 92 /* Flags that need to be manipulated atomically because they can
93 * change while the host controller is running. Always use
94 * set_bit() or clear_bit() to change their values.
95 */
93 unsigned long flags; 96 unsigned long flags;
94#define HCD_FLAG_HW_ACCESSIBLE 0x00000001 97#define HCD_FLAG_HW_ACCESSIBLE 0 /* at full power */
95#define HCD_FLAG_SAW_IRQ 0x00000002 98#define HCD_FLAG_SAW_IRQ 1
99#define HCD_FLAG_POLL_RH 2 /* poll for rh status? */
100#define HCD_FLAG_POLL_PENDING 3 /* status has changed? */
101#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */
102
103 /* The flags can be tested using these macros; they are likely to
104 * be slightly faster than test_bit().
105 */
106#define HCD_HW_ACCESSIBLE(hcd) ((hcd)->flags & (1U << HCD_FLAG_HW_ACCESSIBLE))
107#define HCD_SAW_IRQ(hcd) ((hcd)->flags & (1U << HCD_FLAG_SAW_IRQ))
108#define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH))
109#define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING))
110#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING))
96 111
112 /* Flags that get set only during HCD registration or removal. */
97 unsigned rh_registered:1;/* is root hub registered? */ 113 unsigned rh_registered:1;/* is root hub registered? */
114 unsigned rh_pollable:1; /* may we poll the root hub? */
98 115
99 /* The next flag is a stopgap, to be removed when all the HCDs 116 /* The next flag is a stopgap, to be removed when all the HCDs
100 * support the new root-hub polling mechanism. */ 117 * support the new root-hub polling mechanism. */
101 unsigned uses_new_polling:1; 118 unsigned uses_new_polling:1;
102 unsigned poll_rh:1; /* poll for rh status? */
103 unsigned poll_pending:1; /* status has changed? */
104 unsigned wireless:1; /* Wireless USB HCD */ 119 unsigned wireless:1; /* Wireless USB HCD */
105 unsigned authorized_default:1; 120 unsigned authorized_default:1;
106 unsigned has_tt:1; /* Integrated TT in root hub */ 121 unsigned has_tt:1; /* Integrated TT in root hub */
@@ -198,7 +213,7 @@ struct hc_driver {
198 * a whole, not just the root hub; they're for PCI bus glue. 213 * a whole, not just the root hub; they're for PCI bus glue.
199 */ 214 */
200 /* called after suspending the hub, before entering D3 etc */ 215 /* called after suspending the hub, before entering D3 etc */
201 int (*pci_suspend)(struct usb_hcd *hcd); 216 int (*pci_suspend)(struct usb_hcd *hcd, bool do_wakeup);
202 217
203 /* called after entering D0 (etc), before resuming the hub */ 218 /* called after entering D0 (etc), before resuming the hub */
204 int (*pci_resume)(struct usb_hcd *hcd, bool hibernated); 219 int (*pci_resume)(struct usb_hcd *hcd, bool hibernated);
@@ -299,6 +314,10 @@ struct hc_driver {
299 int (*update_hub_device)(struct usb_hcd *, struct usb_device *hdev, 314 int (*update_hub_device)(struct usb_hcd *, struct usb_device *hdev,
300 struct usb_tt *tt, gfp_t mem_flags); 315 struct usb_tt *tt, gfp_t mem_flags);
301 int (*reset_device)(struct usb_hcd *, struct usb_device *); 316 int (*reset_device)(struct usb_hcd *, struct usb_device *);
317 /* Notifies the HCD after a device is connected and its
318 * address is set
319 */
320 int (*update_device)(struct usb_hcd *, struct usb_device *);
302}; 321};
303 322
304extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); 323extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index f8302d036a76..545cba73ccaf 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -43,13 +43,6 @@ enum usb_xceiv_events {
43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */ 43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */
44}; 44};
45 45
46#define USB_OTG_PULLUP_ID (1 << 0)
47#define USB_OTG_PULLDOWN_DP (1 << 1)
48#define USB_OTG_PULLDOWN_DM (1 << 2)
49#define USB_OTG_EXT_VBUS_INDICATOR (1 << 3)
50#define USB_OTG_DRV_VBUS (1 << 4)
51#define USB_OTG_DRV_VBUS_EXT (1 << 5)
52
53struct otg_transceiver; 46struct otg_transceiver;
54 47
55/* for transceivers connected thru an ULPI interface, the user must 48/* for transceivers connected thru an ULPI interface, the user must
@@ -146,10 +139,10 @@ static inline int otg_io_read(struct otg_transceiver *otg, u32 reg)
146 return -EINVAL; 139 return -EINVAL;
147} 140}
148 141
149static inline int otg_io_write(struct otg_transceiver *otg, u32 reg, u32 val) 142static inline int otg_io_write(struct otg_transceiver *otg, u32 val, u32 reg)
150{ 143{
151 if (otg->io_ops && otg->io_ops->write) 144 if (otg->io_ops && otg->io_ops->write)
152 return otg->io_ops->write(otg, reg, val); 145 return otg->io_ops->write(otg, val, reg);
153 146
154 return -EINVAL; 147 return -EINVAL;
155} 148}
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 16b7f3347545..3e93de7ecbc3 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -26,4 +26,8 @@
26 and can't handle talking to these interfaces */ 26 and can't handle talking to these interfaces */
27#define USB_QUIRK_HONOR_BNUMINTERFACES 0x00000020 27#define USB_QUIRK_HONOR_BNUMINTERFACES 0x00000020
28 28
29/* device needs a pause during initialization, after we read the device
30 descriptor */
31#define USB_QUIRK_DELAY_INIT 0x00000040
32
29#endif /* __LINUX_USB_QUIRKS_H */ 33#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h
index 2369d07c3c87..82b1507f4735 100644
--- a/include/linux/usb/ulpi.h
+++ b/include/linux/usb/ulpi.h
@@ -11,6 +11,42 @@
11#ifndef __LINUX_USB_ULPI_H 11#ifndef __LINUX_USB_ULPI_H
12#define __LINUX_USB_ULPI_H 12#define __LINUX_USB_ULPI_H
13 13
14#include <linux/usb/otg.h>
15/*-------------------------------------------------------------------------*/
16
17/*
18 * ULPI Flags
19 */
20#define ULPI_OTG_ID_PULLUP (1 << 0)
21#define ULPI_OTG_DP_PULLDOWN_DIS (1 << 1)
22#define ULPI_OTG_DM_PULLDOWN_DIS (1 << 2)
23#define ULPI_OTG_DISCHRGVBUS (1 << 3)
24#define ULPI_OTG_CHRGVBUS (1 << 4)
25#define ULPI_OTG_DRVVBUS (1 << 5)
26#define ULPI_OTG_DRVVBUS_EXT (1 << 6)
27#define ULPI_OTG_EXTVBUSIND (1 << 7)
28
29#define ULPI_IC_6PIN_SERIAL (1 << 8)
30#define ULPI_IC_3PIN_SERIAL (1 << 9)
31#define ULPI_IC_CARKIT (1 << 10)
32#define ULPI_IC_CLKSUSPM (1 << 11)
33#define ULPI_IC_AUTORESUME (1 << 12)
34#define ULPI_IC_EXTVBUS_INDINV (1 << 13)
35#define ULPI_IC_IND_PASSTHRU (1 << 14)
36#define ULPI_IC_PROTECT_DIS (1 << 15)
37
38#define ULPI_FC_HS (1 << 16)
39#define ULPI_FC_FS (1 << 17)
40#define ULPI_FC_LS (1 << 18)
41#define ULPI_FC_FS4LS (1 << 19)
42#define ULPI_FC_TERMSEL (1 << 20)
43#define ULPI_FC_OP_NORM (1 << 21)
44#define ULPI_FC_OP_NODRV (1 << 22)
45#define ULPI_FC_OP_DIS_NRZI (1 << 23)
46#define ULPI_FC_OP_NSYNC_NEOP (1 << 24)
47#define ULPI_FC_RST (1 << 25)
48#define ULPI_FC_SUSPM (1 << 26)
49
14/*-------------------------------------------------------------------------*/ 50/*-------------------------------------------------------------------------*/
15 51
16/* 52/*
@@ -58,6 +94,10 @@
58 94
59/*-------------------------------------------------------------------------*/ 95/*-------------------------------------------------------------------------*/
60 96
97/*
98 * Register Bits
99 */
100
61/* Function Control */ 101/* Function Control */
62#define ULPI_FUNC_CTRL_XCVRSEL (1 << 0) 102#define ULPI_FUNC_CTRL_XCVRSEL (1 << 0)
63#define ULPI_FUNC_CTRL_XCVRSEL_MASK (3 << 0) 103#define ULPI_FUNC_CTRL_XCVRSEL_MASK (3 << 0)
diff --git a/include/linux/usb/video.h b/include/linux/usb/video.h
index be436d9ee479..3b3b95e01f71 100644
--- a/include/linux/usb/video.h
+++ b/include/linux/usb/video.h
@@ -160,5 +160,409 @@
160#define UVC_STATUS_TYPE_CONTROL 1 160#define UVC_STATUS_TYPE_CONTROL 1
161#define UVC_STATUS_TYPE_STREAMING 2 161#define UVC_STATUS_TYPE_STREAMING 2
162 162
163/* 2.4.3.3. Payload Header Information */
164#define UVC_STREAM_EOH (1 << 7)
165#define UVC_STREAM_ERR (1 << 6)
166#define UVC_STREAM_STI (1 << 5)
167#define UVC_STREAM_RES (1 << 4)
168#define UVC_STREAM_SCR (1 << 3)
169#define UVC_STREAM_PTS (1 << 2)
170#define UVC_STREAM_EOF (1 << 1)
171#define UVC_STREAM_FID (1 << 0)
172
173/* 4.1.2. Control Capabilities */
174#define UVC_CONTROL_CAP_GET (1 << 0)
175#define UVC_CONTROL_CAP_SET (1 << 1)
176#define UVC_CONTROL_CAP_DISABLED (1 << 2)
177#define UVC_CONTROL_CAP_AUTOUPDATE (1 << 3)
178#define UVC_CONTROL_CAP_ASYNCHRONOUS (1 << 4)
179
180/* ------------------------------------------------------------------------
181 * UVC structures
182 */
183
184/* All UVC descriptors have these 3 fields at the beginning */
185struct uvc_descriptor_header {
186 __u8 bLength;
187 __u8 bDescriptorType;
188 __u8 bDescriptorSubType;
189} __attribute__((packed));
190
191/* 3.7.2. Video Control Interface Header Descriptor */
192struct uvc_header_descriptor {
193 __u8 bLength;
194 __u8 bDescriptorType;
195 __u8 bDescriptorSubType;
196 __u16 bcdUVC;
197 __u16 wTotalLength;
198 __u32 dwClockFrequency;
199 __u8 bInCollection;
200 __u8 baInterfaceNr[];
201} __attribute__((__packed__));
202
203#define UVC_DT_HEADER_SIZE(n) (12+(n))
204
205#define UVC_HEADER_DESCRIPTOR(n) \
206 uvc_header_descriptor_##n
207
208#define DECLARE_UVC_HEADER_DESCRIPTOR(n) \
209struct UVC_HEADER_DESCRIPTOR(n) { \
210 __u8 bLength; \
211 __u8 bDescriptorType; \
212 __u8 bDescriptorSubType; \
213 __u16 bcdUVC; \
214 __u16 wTotalLength; \
215 __u32 dwClockFrequency; \
216 __u8 bInCollection; \
217 __u8 baInterfaceNr[n]; \
218} __attribute__ ((packed))
219
220/* 3.7.2.1. Input Terminal Descriptor */
221struct uvc_input_terminal_descriptor {
222 __u8 bLength;
223 __u8 bDescriptorType;
224 __u8 bDescriptorSubType;
225 __u8 bTerminalID;
226 __u16 wTerminalType;
227 __u8 bAssocTerminal;
228 __u8 iTerminal;
229} __attribute__((__packed__));
230
231#define UVC_DT_INPUT_TERMINAL_SIZE 8
232
233/* 3.7.2.2. Output Terminal Descriptor */
234struct uvc_output_terminal_descriptor {
235 __u8 bLength;
236 __u8 bDescriptorType;
237 __u8 bDescriptorSubType;
238 __u8 bTerminalID;
239 __u16 wTerminalType;
240 __u8 bAssocTerminal;
241 __u8 bSourceID;
242 __u8 iTerminal;
243} __attribute__((__packed__));
244
245#define UVC_DT_OUTPUT_TERMINAL_SIZE 9
246
247/* 3.7.2.3. Camera Terminal Descriptor */
248struct uvc_camera_terminal_descriptor {
249 __u8 bLength;
250 __u8 bDescriptorType;
251 __u8 bDescriptorSubType;
252 __u8 bTerminalID;
253 __u16 wTerminalType;
254 __u8 bAssocTerminal;
255 __u8 iTerminal;
256 __u16 wObjectiveFocalLengthMin;
257 __u16 wObjectiveFocalLengthMax;
258 __u16 wOcularFocalLength;
259 __u8 bControlSize;
260 __u8 bmControls[3];
261} __attribute__((__packed__));
262
263#define UVC_DT_CAMERA_TERMINAL_SIZE(n) (15+(n))
264
265/* 3.7.2.4. Selector Unit Descriptor */
266struct uvc_selector_unit_descriptor {
267 __u8 bLength;
268 __u8 bDescriptorType;
269 __u8 bDescriptorSubType;
270 __u8 bUnitID;
271 __u8 bNrInPins;
272 __u8 baSourceID[0];
273 __u8 iSelector;
274} __attribute__((__packed__));
275
276#define UVC_DT_SELECTOR_UNIT_SIZE(n) (6+(n))
277
278#define UVC_SELECTOR_UNIT_DESCRIPTOR(n) \
279 uvc_selector_unit_descriptor_##n
280
281#define DECLARE_UVC_SELECTOR_UNIT_DESCRIPTOR(n) \
282struct UVC_SELECTOR_UNIT_DESCRIPTOR(n) { \
283 __u8 bLength; \
284 __u8 bDescriptorType; \
285 __u8 bDescriptorSubType; \
286 __u8 bUnitID; \
287 __u8 bNrInPins; \
288 __u8 baSourceID[n]; \
289 __u8 iSelector; \
290} __attribute__ ((packed))
291
292/* 3.7.2.5. Processing Unit Descriptor */
293struct uvc_processing_unit_descriptor {
294 __u8 bLength;
295 __u8 bDescriptorType;
296 __u8 bDescriptorSubType;
297 __u8 bUnitID;
298 __u8 bSourceID;
299 __u16 wMaxMultiplier;
300 __u8 bControlSize;
301 __u8 bmControls[2];
302 __u8 iProcessing;
303} __attribute__((__packed__));
304
305#define UVC_DT_PROCESSING_UNIT_SIZE(n) (9+(n))
306
307/* 3.7.2.6. Extension Unit Descriptor */
308struct uvc_extension_unit_descriptor {
309 __u8 bLength;
310 __u8 bDescriptorType;
311 __u8 bDescriptorSubType;
312 __u8 bUnitID;
313 __u8 guidExtensionCode[16];
314 __u8 bNumControls;
315 __u8 bNrInPins;
316 __u8 baSourceID[0];
317 __u8 bControlSize;
318 __u8 bmControls[0];
319 __u8 iExtension;
320} __attribute__((__packed__));
321
322#define UVC_DT_EXTENSION_UNIT_SIZE(p, n) (24+(p)+(n))
323
324#define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \
325 uvc_extension_unit_descriptor_##p_##n
326
327#define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \
328struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \
329 __u8 bLength; \
330 __u8 bDescriptorType; \
331 __u8 bDescriptorSubType; \
332 __u8 bUnitID; \
333 __u8 guidExtensionCode[16]; \
334 __u8 bNumControls; \
335 __u8 bNrInPins; \
336 __u8 baSourceID[p]; \
337 __u8 bControlSize; \
338 __u8 bmControls[n]; \
339 __u8 iExtension; \
340} __attribute__ ((packed))
341
342/* 3.8.2.2. Video Control Interrupt Endpoint Descriptor */
343struct uvc_control_endpoint_descriptor {
344 __u8 bLength;
345 __u8 bDescriptorType;
346 __u8 bDescriptorSubType;
347 __u16 wMaxTransferSize;
348} __attribute__((__packed__));
349
350#define UVC_DT_CONTROL_ENDPOINT_SIZE 5
351
352/* 3.9.2.1. Input Header Descriptor */
353struct uvc_input_header_descriptor {
354 __u8 bLength;
355 __u8 bDescriptorType;
356 __u8 bDescriptorSubType;
357 __u8 bNumFormats;
358 __u16 wTotalLength;
359 __u8 bEndpointAddress;
360 __u8 bmInfo;
361 __u8 bTerminalLink;
362 __u8 bStillCaptureMethod;
363 __u8 bTriggerSupport;
364 __u8 bTriggerUsage;
365 __u8 bControlSize;
366 __u8 bmaControls[];
367} __attribute__((__packed__));
368
369#define UVC_DT_INPUT_HEADER_SIZE(n, p) (13+(n*p))
370
371#define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \
372 uvc_input_header_descriptor_##n_##p
373
374#define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \
375struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \
376 __u8 bLength; \
377 __u8 bDescriptorType; \
378 __u8 bDescriptorSubType; \
379 __u8 bNumFormats; \
380 __u16 wTotalLength; \
381 __u8 bEndpointAddress; \
382 __u8 bmInfo; \
383 __u8 bTerminalLink; \
384 __u8 bStillCaptureMethod; \
385 __u8 bTriggerSupport; \
386 __u8 bTriggerUsage; \
387 __u8 bControlSize; \
388 __u8 bmaControls[p][n]; \
389} __attribute__ ((packed))
390
391/* 3.9.2.2. Output Header Descriptor */
392struct uvc_output_header_descriptor {
393 __u8 bLength;
394 __u8 bDescriptorType;
395 __u8 bDescriptorSubType;
396 __u8 bNumFormats;
397 __u16 wTotalLength;
398 __u8 bEndpointAddress;
399 __u8 bTerminalLink;
400 __u8 bControlSize;
401 __u8 bmaControls[];
402} __attribute__((__packed__));
403
404#define UVC_DT_OUTPUT_HEADER_SIZE(n, p) (9+(n*p))
405
406#define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \
407 uvc_output_header_descriptor_##n_##p
408
409#define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \
410struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \
411 __u8 bLength; \
412 __u8 bDescriptorType; \
413 __u8 bDescriptorSubType; \
414 __u8 bNumFormats; \
415 __u16 wTotalLength; \
416 __u8 bEndpointAddress; \
417 __u8 bTerminalLink; \
418 __u8 bControlSize; \
419 __u8 bmaControls[p][n]; \
420} __attribute__ ((packed))
421
422/* 3.9.2.6. Color matching descriptor */
423struct uvc_color_matching_descriptor {
424 __u8 bLength;
425 __u8 bDescriptorType;
426 __u8 bDescriptorSubType;
427 __u8 bColorPrimaries;
428 __u8 bTransferCharacteristics;
429 __u8 bMatrixCoefficients;
430} __attribute__((__packed__));
431
432#define UVC_DT_COLOR_MATCHING_SIZE 6
433
434/* 4.3.1.1. Video Probe and Commit Controls */
435struct uvc_streaming_control {
436 __u16 bmHint;
437 __u8 bFormatIndex;
438 __u8 bFrameIndex;
439 __u32 dwFrameInterval;
440 __u16 wKeyFrameRate;
441 __u16 wPFrameRate;
442 __u16 wCompQuality;
443 __u16 wCompWindowSize;
444 __u16 wDelay;
445 __u32 dwMaxVideoFrameSize;
446 __u32 dwMaxPayloadTransferSize;
447 __u32 dwClockFrequency;
448 __u8 bmFramingInfo;
449 __u8 bPreferedVersion;
450 __u8 bMinVersion;
451 __u8 bMaxVersion;
452} __attribute__((__packed__));
453
454/* Uncompressed Payload - 3.1.1. Uncompressed Video Format Descriptor */
455struct uvc_format_uncompressed {
456 __u8 bLength;
457 __u8 bDescriptorType;
458 __u8 bDescriptorSubType;
459 __u8 bFormatIndex;
460 __u8 bNumFrameDescriptors;
461 __u8 guidFormat[16];
462 __u8 bBitsPerPixel;
463 __u8 bDefaultFrameIndex;
464 __u8 bAspectRatioX;
465 __u8 bAspectRatioY;
466 __u8 bmInterfaceFlags;
467 __u8 bCopyProtect;
468} __attribute__((__packed__));
469
470#define UVC_DT_FORMAT_UNCOMPRESSED_SIZE 27
471
472/* Uncompressed Payload - 3.1.2. Uncompressed Video Frame Descriptor */
473struct uvc_frame_uncompressed {
474 __u8 bLength;
475 __u8 bDescriptorType;
476 __u8 bDescriptorSubType;
477 __u8 bFrameIndex;
478 __u8 bmCapabilities;
479 __u16 wWidth;
480 __u16 wHeight;
481 __u32 dwMinBitRate;
482 __u32 dwMaxBitRate;
483 __u32 dwMaxVideoFrameBufferSize;
484 __u32 dwDefaultFrameInterval;
485 __u8 bFrameIntervalType;
486 __u32 dwFrameInterval[];
487} __attribute__((__packed__));
488
489#define UVC_DT_FRAME_UNCOMPRESSED_SIZE(n) (26+4*(n))
490
491#define UVC_FRAME_UNCOMPRESSED(n) \
492 uvc_frame_uncompressed_##n
493
494#define DECLARE_UVC_FRAME_UNCOMPRESSED(n) \
495struct UVC_FRAME_UNCOMPRESSED(n) { \
496 __u8 bLength; \
497 __u8 bDescriptorType; \
498 __u8 bDescriptorSubType; \
499 __u8 bFrameIndex; \
500 __u8 bmCapabilities; \
501 __u16 wWidth; \
502 __u16 wHeight; \
503 __u32 dwMinBitRate; \
504 __u32 dwMaxBitRate; \
505 __u32 dwMaxVideoFrameBufferSize; \
506 __u32 dwDefaultFrameInterval; \
507 __u8 bFrameIntervalType; \
508 __u32 dwFrameInterval[n]; \
509} __attribute__ ((packed))
510
511/* MJPEG Payload - 3.1.1. MJPEG Video Format Descriptor */
512struct uvc_format_mjpeg {
513 __u8 bLength;
514 __u8 bDescriptorType;
515 __u8 bDescriptorSubType;
516 __u8 bFormatIndex;
517 __u8 bNumFrameDescriptors;
518 __u8 bmFlags;
519 __u8 bDefaultFrameIndex;
520 __u8 bAspectRatioX;
521 __u8 bAspectRatioY;
522 __u8 bmInterfaceFlags;
523 __u8 bCopyProtect;
524} __attribute__((__packed__));
525
526#define UVC_DT_FORMAT_MJPEG_SIZE 11
527
528/* MJPEG Payload - 3.1.2. MJPEG Video Frame Descriptor */
529struct uvc_frame_mjpeg {
530 __u8 bLength;
531 __u8 bDescriptorType;
532 __u8 bDescriptorSubType;
533 __u8 bFrameIndex;
534 __u8 bmCapabilities;
535 __u16 wWidth;
536 __u16 wHeight;
537 __u32 dwMinBitRate;
538 __u32 dwMaxBitRate;
539 __u32 dwMaxVideoFrameBufferSize;
540 __u32 dwDefaultFrameInterval;
541 __u8 bFrameIntervalType;
542 __u32 dwFrameInterval[];
543} __attribute__((__packed__));
544
545#define UVC_DT_FRAME_MJPEG_SIZE(n) (26+4*(n))
546
547#define UVC_FRAME_MJPEG(n) \
548 uvc_frame_mjpeg_##n
549
550#define DECLARE_UVC_FRAME_MJPEG(n) \
551struct UVC_FRAME_MJPEG(n) { \
552 __u8 bLength; \
553 __u8 bDescriptorType; \
554 __u8 bDescriptorSubType; \
555 __u8 bFrameIndex; \
556 __u8 bmCapabilities; \
557 __u16 wWidth; \
558 __u16 wHeight; \
559 __u32 dwMinBitRate; \
560 __u32 dwMaxBitRate; \
561 __u32 dwMaxVideoFrameBufferSize; \
562 __u32 dwDefaultFrameInterval; \
563 __u8 bFrameIntervalType; \
564 __u32 dwFrameInterval[n]; \
565} __attribute__ ((packed))
566
163#endif /* __LINUX_USB_VIDEO_H */ 567#endif /* __LINUX_USB_VIDEO_H */
164 568
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index cc4f45361dbb..8178156711f9 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -36,6 +36,9 @@ static inline void put_user_ns(struct user_namespace *ns)
36 kref_put(&ns->kref, free_user_ns); 36 kref_put(&ns->kref, free_user_ns);
37} 37}
38 38
39uid_t user_ns_map_uid(struct user_namespace *to, const struct cred *cred, uid_t uid);
40gid_t user_ns_map_gid(struct user_namespace *to, const struct cred *cred, gid_t gid);
41
39#else 42#else
40 43
41static inline struct user_namespace *get_user_ns(struct user_namespace *ns) 44static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
@@ -52,6 +55,17 @@ static inline void put_user_ns(struct user_namespace *ns)
52{ 55{
53} 56}
54 57
58static inline uid_t user_ns_map_uid(struct user_namespace *to,
59 const struct cred *cred, uid_t uid)
60{
61 return uid;
62}
63static inline gid_t user_ns_map_gid(struct user_namespace *to,
64 const struct cred *cred, gid_t gid)
65{
66 return gid;
67}
68
55#endif 69#endif
56 70
57#endif /* _LINUX_USER_H */ 71#endif /* _LINUX_USER_H */
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index 814f294d4cd0..6228b5b77d35 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -31,7 +31,6 @@
31#ifndef LINUX_VGA_H 31#ifndef LINUX_VGA_H
32#define LINUX_VGA_H 32#define LINUX_VGA_H
33 33
34#include <asm/vga.h>
35 34
36/* Legacy VGA regions */ 35/* Legacy VGA regions */
37#define VGA_RSRC_NONE 0x00 36#define VGA_RSRC_NONE 0x00
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 047f7e6edb86..61490c6dcdbd 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -277,6 +277,7 @@ struct v4l2_pix_format {
277#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */ 277#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */
278#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */ 278#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */
279#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */ 279#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */
280#define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H') /* 18 BGR-6-6-6 */
280#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */ 281#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */
281#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */ 282#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */
282#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */ 283#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */
diff --git a/include/linux/virtio_9p.h b/include/linux/virtio_9p.h
index 5cf11765146b..1faa80d92f05 100644
--- a/include/linux/virtio_9p.h
+++ b/include/linux/virtio_9p.h
@@ -2,8 +2,10 @@
2#define _LINUX_VIRTIO_9P_H 2#define _LINUX_VIRTIO_9P_H
3/* This header is BSD licensed so anyone can use the definitions to implement 3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/types.h>
5#include <linux/virtio_ids.h> 6#include <linux/virtio_ids.h>
6#include <linux/virtio_config.h> 7#include <linux/virtio_config.h>
8#include <linux/types.h>
7 9
8/* The feature bitmap for virtio 9P */ 10/* The feature bitmap for virtio 9P */
9 11
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 227c2a585e4f..01c2145118dc 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -7,6 +7,8 @@
7 7
8struct vm_area_struct; /* vma defining user mapping in mm_types.h */ 8struct vm_area_struct; /* vma defining user mapping in mm_types.h */
9 9
10extern bool vmap_lazy_unmap;
11
10/* bits in flags of vmalloc's vm_struct below */ 12/* bits in flags of vmalloc's vm_struct below */
11#define VM_IOREMAP 0x00000001 /* ioremap() and friends */ 13#define VM_IOREMAP 0x00000001 /* ioremap() and friends */
12#define VM_ALLOC 0x00000002 /* vmalloc() */ 14#define VM_ALLOC 0x00000002 /* vmalloc() */
@@ -30,7 +32,7 @@ struct vm_struct {
30 unsigned long flags; 32 unsigned long flags;
31 struct page **pages; 33 struct page **pages;
32 unsigned int nr_pages; 34 unsigned int nr_pages;
33 unsigned long phys_addr; 35 phys_addr_t phys_addr;
34 void *caller; 36 void *caller;
35}; 37};
36 38
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 7f56db4a79f0..6625cc1ab758 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -76,17 +76,52 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
76#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \ 76#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \
77 ((vc)->vc_toggle_meta ? 0x80 : 0)]) 77 ((vc)->vc_toggle_meta ? 0x80 : 0)])
78#else 78#else
79#define con_set_trans_old(arg) (0) 79static inline int con_set_trans_old(unsigned char __user *table)
80#define con_get_trans_old(arg) (-EINVAL) 80{
81#define con_set_trans_new(arg) (0) 81 return 0;
82#define con_get_trans_new(arg) (-EINVAL) 82}
83#define con_clear_unimap(vc, ui) (0) 83static inline int con_get_trans_old(unsigned char __user *table)
84#define con_set_unimap(vc, ct, list) (0) 84{
85#define con_set_default_unimap(vc) (0) 85 return -EINVAL;
86#define con_copy_unimap(d, s) (0) 86}
87#define con_get_unimap(vc, ct, uct, list) (-EINVAL) 87static inline int con_set_trans_new(unsigned short __user *table)
88#define con_free_unimap(vc) do { ; } while (0) 88{
89#define con_protect_unimap(vc, rdonly) do { ; } while (0) 89 return 0;
90}
91static inline int con_get_trans_new(unsigned short __user *table)
92{
93 return -EINVAL;
94}
95static inline int con_clear_unimap(struct vc_data *vc, struct unimapinit *ui)
96{
97 return 0;
98}
99static inline
100int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
101{
102 return 0;
103}
104static inline
105int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct,
106 struct unipair __user *list)
107{
108 return -EINVAL;
109}
110static inline int con_set_default_unimap(struct vc_data *vc)
111{
112 return 0;
113}
114static inline void con_free_unimap(struct vc_data *vc)
115{
116}
117static inline void con_protect_unimap(struct vc_data *vc, int rdonly)
118{
119}
120static inline
121int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc)
122{
123 return 0;
124}
90 125
91#define vc_translate(vc, c) (c) 126#define vc_translate(vc, c) (c)
92#endif 127#endif
@@ -100,6 +135,13 @@ extern int unbind_con_driver(const struct consw *csw, int first, int last,
100 int deflt); 135 int deflt);
101int vty_init(const struct file_operations *console_fops); 136int vty_init(const struct file_operations *console_fops);
102 137
138static inline bool vt_force_oops_output(struct vc_data *vc)
139{
140 if (oops_in_progress && vc->vc_panic_force_write)
141 return true;
142 return false;
143}
144
103/* 145/*
104 * vc_screen.c shares this temporary buffer with the console write code so that 146 * vc_screen.c shares this temporary buffer with the console write code so that
105 * we can easily avoid touching user space while holding the console spinlock. 147 * we can easily avoid touching user space while holding the console spinlock.
diff --git a/include/linux/wlp.h b/include/linux/wlp.h
index ac95ce6606ac..c76fe2392506 100644
--- a/include/linux/wlp.h
+++ b/include/linux/wlp.h
@@ -300,7 +300,7 @@ struct wlp_ie {
300 __le16 cycle_param; 300 __le16 cycle_param;
301 __le16 acw_anchor_addr; 301 __le16 acw_anchor_addr;
302 u8 wssid_hash_list[]; 302 u8 wssid_hash_list[];
303} __attribute__((packed)); 303} __packed;
304 304
305static inline int wlp_ie_hash_length(struct wlp_ie *ie) 305static inline int wlp_ie_hash_length(struct wlp_ie *ie)
306{ 306{
@@ -324,7 +324,7 @@ static inline void wlp_ie_set_hash_length(struct wlp_ie *ie, int hash_length)
324 */ 324 */
325struct wlp_nonce { 325struct wlp_nonce {
326 u8 data[16]; 326 u8 data[16];
327} __attribute__((packed)); 327} __packed;
328 328
329/** 329/**
330 * WLP UUID 330 * WLP UUID
@@ -336,7 +336,7 @@ struct wlp_nonce {
336 */ 336 */
337struct wlp_uuid { 337struct wlp_uuid {
338 u8 data[16]; 338 u8 data[16];
339} __attribute__((packed)); 339} __packed;
340 340
341 341
342/** 342/**
@@ -348,7 +348,7 @@ struct wlp_dev_type {
348 u8 OUI[3]; 348 u8 OUI[3];
349 u8 OUIsubdiv; 349 u8 OUIsubdiv;
350 __le16 subID; 350 __le16 subID;
351} __attribute__((packed)); 351} __packed;
352 352
353/** 353/**
354 * WLP frame header 354 * WLP frame header
@@ -357,7 +357,7 @@ struct wlp_dev_type {
357struct wlp_frame_hdr { 357struct wlp_frame_hdr {
358 __le16 mux_hdr; /* WLP_PROTOCOL_ID */ 358 __le16 mux_hdr; /* WLP_PROTOCOL_ID */
359 enum wlp_frame_type type:8; 359 enum wlp_frame_type type:8;
360} __attribute__((packed)); 360} __packed;
361 361
362/** 362/**
363 * WLP attribute field header 363 * WLP attribute field header
@@ -368,7 +368,7 @@ struct wlp_frame_hdr {
368struct wlp_attr_hdr { 368struct wlp_attr_hdr {
369 __le16 type; 369 __le16 type;
370 __le16 length; 370 __le16 length;
371} __attribute__((packed)); 371} __packed;
372 372
373/** 373/**
374 * Device information commonly used together 374 * Device information commonly used together
@@ -401,13 +401,13 @@ struct wlp_device_info {
401struct wlp_attr_##name { \ 401struct wlp_attr_##name { \
402 struct wlp_attr_hdr hdr; \ 402 struct wlp_attr_hdr hdr; \
403 type name; \ 403 type name; \
404} __attribute__((packed)); 404} __packed;
405 405
406#define wlp_attr_array(type, name) \ 406#define wlp_attr_array(type, name) \
407struct wlp_attr_##name { \ 407struct wlp_attr_##name { \
408 struct wlp_attr_hdr hdr; \ 408 struct wlp_attr_hdr hdr; \
409 type name[]; \ 409 type name[]; \
410} __attribute__((packed)); 410} __packed;
411 411
412/** 412/**
413 * WLP association attribute fields 413 * WLP association attribute fields
@@ -483,7 +483,7 @@ struct wlp_wss_info {
483 struct wlp_attr_accept_enrl accept; 483 struct wlp_attr_accept_enrl accept;
484 struct wlp_attr_wss_sec_status sec_stat; 484 struct wlp_attr_wss_sec_status sec_stat;
485 struct wlp_attr_wss_bcast bcast; 485 struct wlp_attr_wss_bcast bcast;
486} __attribute__((packed)); 486} __packed;
487 487
488/* WLP WSS Information */ 488/* WLP WSS Information */
489wlp_attr_array(struct wlp_wss_info, wss_info) 489wlp_attr_array(struct wlp_wss_info, wss_info)
@@ -520,7 +520,7 @@ wlp_attr(u8, wlp_assc_err)
520struct wlp_frame_std_abbrv_hdr { 520struct wlp_frame_std_abbrv_hdr {
521 struct wlp_frame_hdr hdr; 521 struct wlp_frame_hdr hdr;
522 u8 tag; 522 u8 tag;
523} __attribute__((packed)); 523} __packed;
524 524
525/** 525/**
526 * WLP association frames 526 * WLP association frames
@@ -533,7 +533,7 @@ struct wlp_frame_assoc {
533 struct wlp_attr_version version; 533 struct wlp_attr_version version;
534 struct wlp_attr_msg_type msg_type; 534 struct wlp_attr_msg_type msg_type;
535 u8 attr[]; 535 u8 attr[];
536} __attribute__((packed)); 536} __packed;
537 537
538/* Ethernet to dev address mapping */ 538/* Ethernet to dev address mapping */
539struct wlp_eda { 539struct wlp_eda {
diff --git a/include/linux/wm97xx_batt.h b/include/linux/wm97xx_batt.h
deleted file mode 100644
index a1d6419c2ff8..000000000000
--- a/include/linux/wm97xx_batt.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef _LINUX_WM97XX_BAT_H
2#define _LINUX_WM97XX_BAT_H
3
4#include <linux/wm97xx.h>
5
6#warning This file will be removed soon, use wm97xx.h instead!
7
8#define wm97xx_batt_info wm97xx_batt_pdata
9
10#ifdef CONFIG_BATTERY_WM97XX
11void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data);
12#else
13static inline void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data) {}
14#endif
15
16#endif
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 9466e860d8c2..4f9d277bcd9a 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -9,6 +9,7 @@
9#include <linux/linkage.h> 9#include <linux/linkage.h>
10#include <linux/bitops.h> 10#include <linux/bitops.h>
11#include <linux/lockdep.h> 11#include <linux/lockdep.h>
12#include <linux/threads.h>
12#include <asm/atomic.h> 13#include <asm/atomic.h>
13 14
14struct workqueue_struct; 15struct workqueue_struct;
@@ -22,12 +23,59 @@ typedef void (*work_func_t)(struct work_struct *work);
22 */ 23 */
23#define work_data_bits(work) ((unsigned long *)(&(work)->data)) 24#define work_data_bits(work) ((unsigned long *)(&(work)->data))
24 25
26enum {
27 WORK_STRUCT_PENDING_BIT = 0, /* work item is pending execution */
28 WORK_STRUCT_CWQ_BIT = 1, /* data points to cwq */
29 WORK_STRUCT_LINKED_BIT = 2, /* next work is linked to this one */
30#ifdef CONFIG_DEBUG_OBJECTS_WORK
31 WORK_STRUCT_STATIC_BIT = 3, /* static initializer (debugobjects) */
32 WORK_STRUCT_COLOR_SHIFT = 4, /* color for workqueue flushing */
33#else
34 WORK_STRUCT_COLOR_SHIFT = 3, /* color for workqueue flushing */
35#endif
36
37 WORK_STRUCT_COLOR_BITS = 4,
38
39 WORK_STRUCT_PENDING = 1 << WORK_STRUCT_PENDING_BIT,
40 WORK_STRUCT_CWQ = 1 << WORK_STRUCT_CWQ_BIT,
41 WORK_STRUCT_LINKED = 1 << WORK_STRUCT_LINKED_BIT,
42#ifdef CONFIG_DEBUG_OBJECTS_WORK
43 WORK_STRUCT_STATIC = 1 << WORK_STRUCT_STATIC_BIT,
44#else
45 WORK_STRUCT_STATIC = 0,
46#endif
47
48 /*
49 * The last color is no color used for works which don't
50 * participate in workqueue flushing.
51 */
52 WORK_NR_COLORS = (1 << WORK_STRUCT_COLOR_BITS) - 1,
53 WORK_NO_COLOR = WORK_NR_COLORS,
54
55 /* special cpu IDs */
56 WORK_CPU_UNBOUND = NR_CPUS,
57 WORK_CPU_NONE = NR_CPUS + 1,
58 WORK_CPU_LAST = WORK_CPU_NONE,
59
60 /*
61 * Reserve 7 bits off of cwq pointer w/ debugobjects turned
62 * off. This makes cwqs aligned to 128 bytes which isn't too
63 * excessive while allowing 15 workqueue flush colors.
64 */
65 WORK_STRUCT_FLAG_BITS = WORK_STRUCT_COLOR_SHIFT +
66 WORK_STRUCT_COLOR_BITS,
67
68 WORK_STRUCT_FLAG_MASK = (1UL << WORK_STRUCT_FLAG_BITS) - 1,
69 WORK_STRUCT_WQ_DATA_MASK = ~WORK_STRUCT_FLAG_MASK,
70 WORK_STRUCT_NO_CPU = WORK_CPU_NONE << WORK_STRUCT_FLAG_BITS,
71
72 /* bit mask for work_busy() return values */
73 WORK_BUSY_PENDING = 1 << 0,
74 WORK_BUSY_RUNNING = 1 << 1,
75};
76
25struct work_struct { 77struct work_struct {
26 atomic_long_t data; 78 atomic_long_t data;
27#define WORK_STRUCT_PENDING 0 /* T if work item pending execution */
28#define WORK_STRUCT_STATIC 1 /* static initializer (debugobjects) */
29#define WORK_STRUCT_FLAG_MASK (3UL)
30#define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK)
31 struct list_head entry; 79 struct list_head entry;
32 work_func_t func; 80 work_func_t func;
33#ifdef CONFIG_LOCKDEP 81#ifdef CONFIG_LOCKDEP
@@ -35,8 +83,9 @@ struct work_struct {
35#endif 83#endif
36}; 84};
37 85
38#define WORK_DATA_INIT() ATOMIC_LONG_INIT(0) 86#define WORK_DATA_INIT() ATOMIC_LONG_INIT(WORK_STRUCT_NO_CPU)
39#define WORK_DATA_STATIC_INIT() ATOMIC_LONG_INIT(2) 87#define WORK_DATA_STATIC_INIT() \
88 ATOMIC_LONG_INIT(WORK_STRUCT_NO_CPU | WORK_STRUCT_STATIC)
40 89
41struct delayed_work { 90struct delayed_work {
42 struct work_struct work; 91 struct work_struct work;
@@ -96,9 +145,14 @@ struct execute_work {
96#ifdef CONFIG_DEBUG_OBJECTS_WORK 145#ifdef CONFIG_DEBUG_OBJECTS_WORK
97extern void __init_work(struct work_struct *work, int onstack); 146extern void __init_work(struct work_struct *work, int onstack);
98extern void destroy_work_on_stack(struct work_struct *work); 147extern void destroy_work_on_stack(struct work_struct *work);
148static inline unsigned int work_static(struct work_struct *work)
149{
150 return *work_data_bits(work) & WORK_STRUCT_STATIC;
151}
99#else 152#else
100static inline void __init_work(struct work_struct *work, int onstack) { } 153static inline void __init_work(struct work_struct *work, int onstack) { }
101static inline void destroy_work_on_stack(struct work_struct *work) { } 154static inline void destroy_work_on_stack(struct work_struct *work) { }
155static inline unsigned int work_static(struct work_struct *work) { return 0; }
102#endif 156#endif
103 157
104/* 158/*
@@ -162,7 +216,7 @@ static inline void destroy_work_on_stack(struct work_struct *work) { }
162 * @work: The work item in question 216 * @work: The work item in question
163 */ 217 */
164#define work_pending(work) \ 218#define work_pending(work) \
165 test_bit(WORK_STRUCT_PENDING, work_data_bits(work)) 219 test_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))
166 220
167/** 221/**
168 * delayed_work_pending - Find out whether a delayable work item is currently 222 * delayed_work_pending - Find out whether a delayable work item is currently
@@ -177,16 +231,56 @@ static inline void destroy_work_on_stack(struct work_struct *work) { }
177 * @work: The work item in question 231 * @work: The work item in question
178 */ 232 */
179#define work_clear_pending(work) \ 233#define work_clear_pending(work) \
180 clear_bit(WORK_STRUCT_PENDING, work_data_bits(work)) 234 clear_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))
235
236enum {
237 WQ_NON_REENTRANT = 1 << 0, /* guarantee non-reentrance */
238 WQ_UNBOUND = 1 << 1, /* not bound to any cpu */
239 WQ_FREEZEABLE = 1 << 2, /* freeze during suspend */
240 WQ_RESCUER = 1 << 3, /* has an rescue worker */
241 WQ_HIGHPRI = 1 << 4, /* high priority */
242 WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */
243
244 WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */
245 WQ_MAX_UNBOUND_PER_CPU = 4, /* 4 * #cpus for unbound wq */
246 WQ_DFL_ACTIVE = WQ_MAX_ACTIVE / 2,
247};
181 248
249/* unbound wq's aren't per-cpu, scale max_active according to #cpus */
250#define WQ_UNBOUND_MAX_ACTIVE \
251 max_t(int, WQ_MAX_ACTIVE, num_possible_cpus() * WQ_MAX_UNBOUND_PER_CPU)
252
253/*
254 * System-wide workqueues which are always present.
255 *
256 * system_wq is the one used by schedule[_delayed]_work[_on]().
257 * Multi-CPU multi-threaded. There are users which expect relatively
258 * short queue flush time. Don't queue works which can run for too
259 * long.
260 *
261 * system_long_wq is similar to system_wq but may host long running
262 * works. Queue flushing might take relatively long.
263 *
264 * system_nrt_wq is non-reentrant and guarantees that any given work
265 * item is never executed in parallel by multiple CPUs. Queue
266 * flushing might take relatively long.
267 *
268 * system_unbound_wq is unbound workqueue. Workers are not bound to
269 * any specific CPU, not concurrency managed, and all queued works are
270 * executed immediately as long as max_active limit is not reached and
271 * resources are available.
272 */
273extern struct workqueue_struct *system_wq;
274extern struct workqueue_struct *system_long_wq;
275extern struct workqueue_struct *system_nrt_wq;
276extern struct workqueue_struct *system_unbound_wq;
182 277
183extern struct workqueue_struct * 278extern struct workqueue_struct *
184__create_workqueue_key(const char *name, int singlethread, 279__alloc_workqueue_key(const char *name, unsigned int flags, int max_active,
185 int freezeable, int rt, struct lock_class_key *key, 280 struct lock_class_key *key, const char *lock_name);
186 const char *lock_name);
187 281
188#ifdef CONFIG_LOCKDEP 282#ifdef CONFIG_LOCKDEP
189#define __create_workqueue(name, singlethread, freezeable, rt) \ 283#define alloc_workqueue(name, flags, max_active) \
190({ \ 284({ \
191 static struct lock_class_key __key; \ 285 static struct lock_class_key __key; \
192 const char *__lock_name; \ 286 const char *__lock_name; \
@@ -196,20 +290,20 @@ __create_workqueue_key(const char *name, int singlethread,
196 else \ 290 else \
197 __lock_name = #name; \ 291 __lock_name = #name; \
198 \ 292 \
199 __create_workqueue_key((name), (singlethread), \ 293 __alloc_workqueue_key((name), (flags), (max_active), \
200 (freezeable), (rt), &__key, \ 294 &__key, __lock_name); \
201 __lock_name); \
202}) 295})
203#else 296#else
204#define __create_workqueue(name, singlethread, freezeable, rt) \ 297#define alloc_workqueue(name, flags, max_active) \
205 __create_workqueue_key((name), (singlethread), (freezeable), (rt), \ 298 __alloc_workqueue_key((name), (flags), (max_active), NULL, NULL)
206 NULL, NULL)
207#endif 299#endif
208 300
209#define create_workqueue(name) __create_workqueue((name), 0, 0, 0) 301#define create_workqueue(name) \
210#define create_rt_workqueue(name) __create_workqueue((name), 0, 0, 1) 302 alloc_workqueue((name), WQ_RESCUER, 1)
211#define create_freezeable_workqueue(name) __create_workqueue((name), 1, 1, 0) 303#define create_freezeable_workqueue(name) \
212#define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0, 0) 304 alloc_workqueue((name), WQ_FREEZEABLE | WQ_UNBOUND | WQ_RESCUER, 1)
305#define create_singlethread_workqueue(name) \
306 alloc_workqueue((name), WQ_UNBOUND | WQ_RESCUER, 1)
213 307
214extern void destroy_workqueue(struct workqueue_struct *wq); 308extern void destroy_workqueue(struct workqueue_struct *wq);
215 309
@@ -231,16 +325,19 @@ extern int schedule_delayed_work(struct delayed_work *work, unsigned long delay)
231extern int schedule_delayed_work_on(int cpu, struct delayed_work *work, 325extern int schedule_delayed_work_on(int cpu, struct delayed_work *work,
232 unsigned long delay); 326 unsigned long delay);
233extern int schedule_on_each_cpu(work_func_t func); 327extern int schedule_on_each_cpu(work_func_t func);
234extern int current_is_keventd(void);
235extern int keventd_up(void); 328extern int keventd_up(void);
236 329
237extern void init_workqueues(void);
238int execute_in_process_context(work_func_t fn, struct execute_work *); 330int execute_in_process_context(work_func_t fn, struct execute_work *);
239 331
240extern int flush_work(struct work_struct *work); 332extern int flush_work(struct work_struct *work);
241
242extern int cancel_work_sync(struct work_struct *work); 333extern int cancel_work_sync(struct work_struct *work);
243 334
335extern void workqueue_set_max_active(struct workqueue_struct *wq,
336 int max_active);
337extern bool workqueue_congested(unsigned int cpu, struct workqueue_struct *wq);
338extern unsigned int work_cpu(struct work_struct *work);
339extern unsigned int work_busy(struct work_struct *work);
340
244/* 341/*
245 * Kill off a pending schedule_delayed_work(). Note that the work callback 342 * Kill off a pending schedule_delayed_work(). Note that the work callback
246 * function may still be running on return from cancel_delayed_work(), unless 343 * function may still be running on return from cancel_delayed_work(), unless
@@ -297,4 +394,15 @@ static inline long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg)
297#else 394#else
298long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg); 395long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg);
299#endif /* CONFIG_SMP */ 396#endif /* CONFIG_SMP */
397
398#ifdef CONFIG_FREEZER
399extern void freeze_workqueues_begin(void);
400extern bool freeze_workqueues_busy(void);
401extern void thaw_workqueues(void);
402#endif /* CONFIG_FREEZER */
403
404#ifdef CONFIG_LOCKDEP
405int in_workqueue_context(struct workqueue_struct *wq);
406#endif
407
300#endif 408#endif
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index c24eca71e80c..72a5d647a5f2 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -124,8 +124,9 @@ struct ctl_table;
124int dirty_writeback_centisecs_handler(struct ctl_table *, int, 124int dirty_writeback_centisecs_handler(struct ctl_table *, int,
125 void __user *, size_t *, loff_t *); 125 void __user *, size_t *, loff_t *);
126 126
127void get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty, 127void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty);
128 unsigned long *pbdi_dirty, struct backing_dev_info *bdi); 128unsigned long bdi_dirty_limit(struct backing_dev_info *bdi,
129 unsigned long dirty);
129 130
130void page_writeback_init(void); 131void page_writeback_init(void);
131void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, 132void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index 0cfa1e9c4cc1..f1e5bde4b35a 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -33,6 +33,20 @@
33#define XATTR_USER_PREFIX "user." 33#define XATTR_USER_PREFIX "user."
34#define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1) 34#define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1)
35 35
36/* Security namespace */
37#define XATTR_SELINUX_SUFFIX "selinux"
38#define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX
39
40#define XATTR_SMACK_SUFFIX "SMACK64"
41#define XATTR_SMACK_IPIN "SMACK64IPIN"
42#define XATTR_SMACK_IPOUT "SMACK64IPOUT"
43#define XATTR_NAME_SMACK XATTR_SECURITY_PREFIX XATTR_SMACK_SUFFIX
44#define XATTR_NAME_SMACKIPIN XATTR_SECURITY_PREFIX XATTR_SMACK_IPIN
45#define XATTR_NAME_SMACKIPOUT XATTR_SECURITY_PREFIX XATTR_SMACK_IPOUT
46
47#define XATTR_CAPS_SUFFIX "capability"
48#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
49
36struct inode; 50struct inode;
37struct dentry; 51struct dentry;
38 52
diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h
index 9ebe8558b9b6..8d08ebfe20b7 100644
--- a/include/media/cx2341x.h
+++ b/include/media/cx2341x.h
@@ -19,6 +19,8 @@
19#ifndef CX2341X_H 19#ifndef CX2341X_H
20#define CX2341X_H 20#define CX2341X_H
21 21
22#include <media/v4l2-ctrls.h>
23
22enum cx2341x_port { 24enum cx2341x_port {
23 CX2341X_PORT_MEMORY = 0, 25 CX2341X_PORT_MEMORY = 0,
24 CX2341X_PORT_STREAMING = 1, 26 CX2341X_PORT_STREAMING = 1,
@@ -99,6 +101,101 @@ int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy,
99void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p); 101void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p);
100void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix); 102void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix);
101 103
104struct cx2341x_handler;
105
106struct cx2341x_handler_ops {
107 /* needed for the video clock freq */
108 int (*s_audio_sampling_freq)(struct cx2341x_handler *hdl, u32 val);
109 /* needed for dualwatch */
110 int (*s_audio_mode)(struct cx2341x_handler *hdl, u32 val);
111 /* needed for setting up the video resolution */
112 int (*s_video_encoding)(struct cx2341x_handler *hdl, u32 val);
113 /* needed for setting up the sliced vbi insertion data structures */
114 int (*s_stream_vbi_fmt)(struct cx2341x_handler *hdl, u32 val);
115};
116
117struct cx2341x_handler {
118 u32 capabilities;
119 enum cx2341x_port port;
120 u16 width;
121 u16 height;
122 u16 is_50hz;
123 u32 audio_properties;
124
125 struct v4l2_ctrl_handler hdl;
126 void *priv;
127 cx2341x_mbox_func func;
128 const struct cx2341x_handler_ops *ops;
129
130 struct v4l2_ctrl *stream_vbi_fmt;
131
132 struct {
133 /* audio cluster */
134 struct v4l2_ctrl *audio_sampling_freq;
135 struct v4l2_ctrl *audio_encoding;
136 struct v4l2_ctrl *audio_l2_bitrate;
137 struct v4l2_ctrl *audio_mode;
138 struct v4l2_ctrl *audio_mode_extension;
139 struct v4l2_ctrl *audio_emphasis;
140 struct v4l2_ctrl *audio_crc;
141 struct v4l2_ctrl *audio_ac3_bitrate;
142 };
143
144 struct {
145 /* video gop cluster */
146 struct v4l2_ctrl *video_b_frames;
147 struct v4l2_ctrl *video_gop_size;
148 };
149
150 struct {
151 /* stream type cluster */
152 struct v4l2_ctrl *stream_type;
153 struct v4l2_ctrl *video_encoding;
154 struct v4l2_ctrl *video_bitrate_mode;
155 struct v4l2_ctrl *video_bitrate;
156 struct v4l2_ctrl *video_bitrate_peak;
157 };
158
159 struct {
160 /* video mute cluster */
161 struct v4l2_ctrl *video_mute;
162 struct v4l2_ctrl *video_mute_yuv;
163 };
164
165 struct {
166 /* video filter mode cluster */
167 struct v4l2_ctrl *video_spatial_filter_mode;
168 struct v4l2_ctrl *video_temporal_filter_mode;
169 struct v4l2_ctrl *video_median_filter_type;
170 };
171
172 struct {
173 /* video filter type cluster */
174 struct v4l2_ctrl *video_luma_spatial_filter_type;
175 struct v4l2_ctrl *video_chroma_spatial_filter_type;
176 };
177
178 struct {
179 /* video filter cluster */
180 struct v4l2_ctrl *video_spatial_filter;
181 struct v4l2_ctrl *video_temporal_filter;
182 };
183
184 struct {
185 /* video median cluster */
186 struct v4l2_ctrl *video_luma_median_filter_top;
187 struct v4l2_ctrl *video_luma_median_filter_bottom;
188 struct v4l2_ctrl *video_chroma_median_filter_top;
189 struct v4l2_ctrl *video_chroma_median_filter_bottom;
190 };
191};
192
193int cx2341x_handler_init(struct cx2341x_handler *cxhdl,
194 unsigned nr_of_controls_hint);
195void cx2341x_handler_set_50hz(struct cx2341x_handler *cxhdl, int is_50hz);
196int cx2341x_handler_setup(struct cx2341x_handler *cxhdl);
197void cx2341x_handler_set_busy(struct cx2341x_handler *cxhdl, int busy);
198
102/* Firmware names */ 199/* Firmware names */
103#define CX2341X_FIRM_ENC_FILENAME "v4l-cx2341x-enc.fw" 200#define CX2341X_FIRM_ENC_FILENAME "v4l-cx2341x-enc.fw"
104/* Decoder firmware for the cx23415 only */ 201/* Decoder firmware for the cx23415 only */
diff --git a/include/media/cx25840.h b/include/media/cx25840.h
index 0b0cb1776796..46d1a141208e 100644
--- a/include/media/cx25840.h
+++ b/include/media/cx25840.h
@@ -97,4 +97,91 @@ enum cx25840_audio_input {
97 CX25840_AUDIO8, 97 CX25840_AUDIO8,
98}; 98};
99 99
100enum cx25840_io_pin {
101 CX25840_PIN_DVALID_PRGM0 = 0,
102 CX25840_PIN_FIELD_PRGM1,
103 CX25840_PIN_HRESET_PRGM2,
104 CX25840_PIN_VRESET_HCTL_PRGM3,
105 CX25840_PIN_IRQ_N_PRGM4,
106 CX25840_PIN_IR_TX_PRGM6,
107 CX25840_PIN_IR_RX_PRGM5,
108 CX25840_PIN_GPIO0_PRGM8,
109 CX25840_PIN_GPIO1_PRGM9,
110 CX25840_PIN_SA_SDIN, /* Alternate GP Input only */
111 CX25840_PIN_SA_SDOUT, /* Alternate GP Input only */
112 CX25840_PIN_PLL_CLK_PRGM7,
113 CX25840_PIN_CHIP_SEL_VIPCLK, /* Output only */
114};
115
116enum cx25840_io_pad {
117 /* Output pads */
118 CX25840_PAD_DEFAULT = 0,
119 CX25840_PAD_ACTIVE,
120 CX25840_PAD_VACTIVE,
121 CX25840_PAD_CBFLAG,
122 CX25840_PAD_VID_DATA_EXT0,
123 CX25840_PAD_VID_DATA_EXT1,
124 CX25840_PAD_GPO0,
125 CX25840_PAD_GPO1,
126 CX25840_PAD_GPO2,
127 CX25840_PAD_GPO3,
128 CX25840_PAD_IRQ_N,
129 CX25840_PAD_AC_SYNC,
130 CX25840_PAD_AC_SDOUT,
131 CX25840_PAD_PLL_CLK,
132 CX25840_PAD_VRESET,
133 CX25840_PAD_RESERVED,
134 /* Pads for PLL_CLK output only */
135 CX25840_PAD_XTI_X5_DLL,
136 CX25840_PAD_AUX_PLL,
137 CX25840_PAD_VID_PLL,
138 CX25840_PAD_XTI,
139 /* Input Pads */
140 CX25840_PAD_GPI0,
141 CX25840_PAD_GPI1,
142 CX25840_PAD_GPI2,
143 CX25840_PAD_GPI3,
144};
145
146enum cx25840_io_pin_strength {
147 CX25840_PIN_DRIVE_MEDIUM = 0,
148 CX25840_PIN_DRIVE_SLOW,
149 CX25840_PIN_DRIVE_FAST,
150};
151
152enum cx23885_io_pin {
153 CX23885_PIN_IR_RX_GPIO19,
154 CX23885_PIN_IR_TX_GPIO20,
155 CX23885_PIN_I2S_SDAT_GPIO21,
156 CX23885_PIN_I2S_WCLK_GPIO22,
157 CX23885_PIN_I2S_BCLK_GPIO23,
158 CX23885_PIN_IRQ_N_GPIO16,
159};
160
161enum cx23885_io_pad {
162 CX23885_PAD_IR_RX,
163 CX23885_PAD_GPIO19,
164 CX23885_PAD_IR_TX,
165 CX23885_PAD_GPIO20,
166 CX23885_PAD_I2S_SDAT,
167 CX23885_PAD_GPIO21,
168 CX23885_PAD_I2S_WCLK,
169 CX23885_PAD_GPIO22,
170 CX23885_PAD_I2S_BCLK,
171 CX23885_PAD_GPIO23,
172 CX23885_PAD_IRQ_N,
173 CX23885_PAD_GPIO16,
174};
175
176/* pvr150_workaround activates a workaround for a hardware bug that is
177 present in Hauppauge PVR-150 (and possibly PVR-500) cards that have
178 certain NTSC tuners (tveeprom tuner model numbers 85, 99 and 112). The
179 audio autodetect fails on some channels for these models and the workaround
180 is to select the audio standard explicitly. Many thanks to Hauppauge for
181 providing this information.
182 This platform data only needs to be supplied by the ivtv driver. */
183struct cx25840_platform_data {
184 int pvr150_workaround;
185};
186
100#endif 187#endif
diff --git a/include/media/ir-core.h b/include/media/ir-core.h
index ad1303f20e00..eb7fddf8f607 100644
--- a/include/media/ir-core.h
+++ b/include/media/ir-core.h
@@ -41,21 +41,49 @@ enum rc_driver_type {
41 * anything with it. Yet, as the same keycode table can be used with other 41 * anything with it. Yet, as the same keycode table can be used with other
42 * devices, a mask is provided to allow its usage. Drivers should generally 42 * devices, a mask is provided to allow its usage. Drivers should generally
43 * leave this field in blank 43 * leave this field in blank
44 * @timeout: optional time after which device stops sending data
45 * @min_timeout: minimum timeout supported by device
46 * @max_timeout: maximum timeout supported by device
47 * @rx_resolution : resolution (in ns) of input sampler
48 * @tx_resolution: resolution (in ns) of output sampler
44 * @priv: driver-specific data, to be used on the callbacks 49 * @priv: driver-specific data, to be used on the callbacks
45 * @change_protocol: allow changing the protocol used on hardware decoders 50 * @change_protocol: allow changing the protocol used on hardware decoders
46 * @open: callback to allow drivers to enable polling/irq when IR input device 51 * @open: callback to allow drivers to enable polling/irq when IR input device
47 * is opened. 52 * is opened.
48 * @close: callback to allow drivers to disable polling/irq when IR input device 53 * @close: callback to allow drivers to disable polling/irq when IR input device
49 * is opened. 54 * is opened.
55 * @s_tx_mask: set transmitter mask (for devices with multiple tx outputs)
56 * @s_tx_carrier: set transmit carrier frequency
57 * @s_tx_duty_cycle: set transmit duty cycle (0% - 100%)
58 * @s_rx_carrier: inform driver about carrier it is expected to handle
59 * @tx_ir: transmit IR
60 * @s_idle: optional: enable/disable hardware idle mode, upon which,
61 device doesn't interrupt host until it sees IR pulses
62 * @s_learning_mode: enable wide band receiver used for learning
50 */ 63 */
51struct ir_dev_props { 64struct ir_dev_props {
52 enum rc_driver_type driver_type; 65 enum rc_driver_type driver_type;
53 unsigned long allowed_protos; 66 unsigned long allowed_protos;
54 u32 scanmask; 67 u32 scanmask;
55 void *priv; 68
69 u32 timeout;
70 u32 min_timeout;
71 u32 max_timeout;
72
73 u32 rx_resolution;
74 u32 tx_resolution;
75
76 void *priv;
56 int (*change_protocol)(void *priv, u64 ir_type); 77 int (*change_protocol)(void *priv, u64 ir_type);
57 int (*open)(void *priv); 78 int (*open)(void *priv);
58 void (*close)(void *priv); 79 void (*close)(void *priv);
80 int (*s_tx_mask)(void *priv, u32 mask);
81 int (*s_tx_carrier)(void *priv, u32 carrier);
82 int (*s_tx_duty_cycle)(void *priv, u32 duty_cycle);
83 int (*s_rx_carrier_range)(void *priv, u32 min, u32 max);
84 int (*tx_ir)(void *priv, int *txbuf, u32 n);
85 void (*s_idle)(void *priv, int enable);
86 int (*s_learning_mode)(void *priv, int enable);
59}; 87};
60 88
61struct ir_input_dev { 89struct ir_input_dev {
@@ -63,9 +91,10 @@ struct ir_input_dev {
63 char *driver_name; /* Name of the driver module */ 91 char *driver_name; /* Name of the driver module */
64 struct ir_scancode_table rc_tab; /* scan/key table */ 92 struct ir_scancode_table rc_tab; /* scan/key table */
65 unsigned long devno; /* device number */ 93 unsigned long devno; /* device number */
66 const struct ir_dev_props *props; /* Device properties */ 94 struct ir_dev_props *props; /* Device properties */
67 struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */ 95 struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */
68 struct input_dev *input_dev; /* the input device associated with this device */ 96 struct input_dev *input_dev; /* the input device associated with this device */
97 bool idle;
69 98
70 /* key info - needed by IR keycode handlers */ 99 /* key info - needed by IR keycode handlers */
71 spinlock_t keylock; /* protects the below members */ 100 spinlock_t keylock; /* protects the below members */
@@ -89,12 +118,12 @@ enum raw_event_type {
89/* From ir-keytable.c */ 118/* From ir-keytable.c */
90int __ir_input_register(struct input_dev *dev, 119int __ir_input_register(struct input_dev *dev,
91 const struct ir_scancode_table *ir_codes, 120 const struct ir_scancode_table *ir_codes,
92 const struct ir_dev_props *props, 121 struct ir_dev_props *props,
93 const char *driver_name); 122 const char *driver_name);
94 123
95static inline int ir_input_register(struct input_dev *dev, 124static inline int ir_input_register(struct input_dev *dev,
96 const char *map_name, 125 const char *map_name,
97 const struct ir_dev_props *props, 126 struct ir_dev_props *props,
98 const char *driver_name) { 127 const char *driver_name) {
99 struct ir_scancode_table *ir_codes; 128 struct ir_scancode_table *ir_codes;
100 struct ir_input_dev *ir_dev; 129 struct ir_input_dev *ir_dev;
@@ -104,8 +133,12 @@ static inline int ir_input_register(struct input_dev *dev,
104 return -EINVAL; 133 return -EINVAL;
105 134
106 ir_codes = get_rc_map(map_name); 135 ir_codes = get_rc_map(map_name);
107 if (!ir_codes) 136 if (!ir_codes) {
108 return -EINVAL; 137 ir_codes = get_rc_map(RC_MAP_EMPTY);
138
139 if (!ir_codes)
140 return -EINVAL;
141 }
109 142
110 rc = __ir_input_register(dev, ir_codes, props, driver_name); 143 rc = __ir_input_register(dev, ir_codes, props, driver_name);
111 if (rc < 0) 144 if (rc < 0)
@@ -138,6 +171,10 @@ struct ir_raw_event {
138void ir_raw_event_handle(struct input_dev *input_dev); 171void ir_raw_event_handle(struct input_dev *input_dev);
139int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev); 172int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev);
140int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type); 173int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type);
174int ir_raw_event_store_with_filter(struct input_dev *input_dev,
175 struct ir_raw_event *ev);
176void ir_raw_event_set_idle(struct input_dev *input_dev, int idle);
177
141static inline void ir_raw_event_reset(struct input_dev *input_dev) 178static inline void ir_raw_event_reset(struct input_dev *input_dev)
142{ 179{
143 struct ir_raw_event ev = { .pulse = false, .duration = 0 }; 180 struct ir_raw_event ev = { .pulse = false, .duration = 0 };
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index 0506e45c9a4f..5e96d7a430be 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -11,7 +11,7 @@ struct IR_i2c {
11 struct i2c_client *c; 11 struct i2c_client *c;
12 struct input_dev *input; 12 struct input_dev *input;
13 struct ir_input_state ir; 13 struct ir_input_state ir;
14 14 u64 ir_type;
15 /* Used to avoid fast repeating */ 15 /* Used to avoid fast repeating */
16 unsigned char old; 16 unsigned char old;
17 17
diff --git a/include/media/lirc.h b/include/media/lirc.h
new file mode 100644
index 000000000000..6678a169fd9e
--- /dev/null
+++ b/include/media/lirc.h
@@ -0,0 +1,168 @@
1/*
2 * lirc.h - linux infrared remote control header file
3 * last modified 2010/07/13 by Jarod Wilson
4 */
5
6#ifndef _LINUX_LIRC_H
7#define _LINUX_LIRC_H
8
9#include <linux/types.h>
10#include <linux/ioctl.h>
11
12#define PULSE_BIT 0x01000000
13#define PULSE_MASK 0x00FFFFFF
14
15#define LIRC_MODE2_SPACE 0x00000000
16#define LIRC_MODE2_PULSE 0x01000000
17#define LIRC_MODE2_FREQUENCY 0x02000000
18#define LIRC_MODE2_TIMEOUT 0x03000000
19
20#define LIRC_VALUE_MASK 0x00FFFFFF
21#define LIRC_MODE2_MASK 0xFF000000
22
23#define LIRC_SPACE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_SPACE)
24#define LIRC_PULSE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_PULSE)
25#define LIRC_FREQUENCY(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_FREQUENCY)
26#define LIRC_TIMEOUT(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_TIMEOUT)
27
28#define LIRC_VALUE(val) ((val)&LIRC_VALUE_MASK)
29#define LIRC_MODE2(val) ((val)&LIRC_MODE2_MASK)
30
31#define LIRC_IS_SPACE(val) (LIRC_MODE2(val) == LIRC_MODE2_SPACE)
32#define LIRC_IS_PULSE(val) (LIRC_MODE2(val) == LIRC_MODE2_PULSE)
33#define LIRC_IS_FREQUENCY(val) (LIRC_MODE2(val) == LIRC_MODE2_FREQUENCY)
34#define LIRC_IS_TIMEOUT(val) (LIRC_MODE2(val) == LIRC_MODE2_TIMEOUT)
35
36/* used heavily by lirc userspace */
37#define lirc_t int
38
39/*** lirc compatible hardware features ***/
40
41#define LIRC_MODE2SEND(x) (x)
42#define LIRC_SEND2MODE(x) (x)
43#define LIRC_MODE2REC(x) ((x) << 16)
44#define LIRC_REC2MODE(x) ((x) >> 16)
45
46#define LIRC_MODE_RAW 0x00000001
47#define LIRC_MODE_PULSE 0x00000002
48#define LIRC_MODE_MODE2 0x00000004
49#define LIRC_MODE_LIRCCODE 0x00000010
50
51
52#define LIRC_CAN_SEND_RAW LIRC_MODE2SEND(LIRC_MODE_RAW)
53#define LIRC_CAN_SEND_PULSE LIRC_MODE2SEND(LIRC_MODE_PULSE)
54#define LIRC_CAN_SEND_MODE2 LIRC_MODE2SEND(LIRC_MODE_MODE2)
55#define LIRC_CAN_SEND_LIRCCODE LIRC_MODE2SEND(LIRC_MODE_LIRCCODE)
56
57#define LIRC_CAN_SEND_MASK 0x0000003f
58
59#define LIRC_CAN_SET_SEND_CARRIER 0x00000100
60#define LIRC_CAN_SET_SEND_DUTY_CYCLE 0x00000200
61#define LIRC_CAN_SET_TRANSMITTER_MASK 0x00000400
62
63#define LIRC_CAN_REC_RAW LIRC_MODE2REC(LIRC_MODE_RAW)
64#define LIRC_CAN_REC_PULSE LIRC_MODE2REC(LIRC_MODE_PULSE)
65#define LIRC_CAN_REC_MODE2 LIRC_MODE2REC(LIRC_MODE_MODE2)
66#define LIRC_CAN_REC_LIRCCODE LIRC_MODE2REC(LIRC_MODE_LIRCCODE)
67
68#define LIRC_CAN_REC_MASK LIRC_MODE2REC(LIRC_CAN_SEND_MASK)
69
70#define LIRC_CAN_SET_REC_CARRIER (LIRC_CAN_SET_SEND_CARRIER << 16)
71#define LIRC_CAN_SET_REC_DUTY_CYCLE (LIRC_CAN_SET_SEND_DUTY_CYCLE << 16)
72
73#define LIRC_CAN_SET_REC_DUTY_CYCLE_RANGE 0x40000000
74#define LIRC_CAN_SET_REC_CARRIER_RANGE 0x80000000
75#define LIRC_CAN_GET_REC_RESOLUTION 0x20000000
76#define LIRC_CAN_SET_REC_TIMEOUT 0x10000000
77#define LIRC_CAN_SET_REC_FILTER 0x08000000
78
79#define LIRC_CAN_MEASURE_CARRIER 0x02000000
80#define LIRC_CAN_USE_WIDEBAND_RECEIVER 0x04000000
81
82#define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK)
83#define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK)
84
85#define LIRC_CAN_NOTIFY_DECODE 0x01000000
86
87/*** IOCTL commands for lirc driver ***/
88
89#define LIRC_GET_FEATURES _IOR('i', 0x00000000, __u32)
90
91#define LIRC_GET_SEND_MODE _IOR('i', 0x00000001, __u32)
92#define LIRC_GET_REC_MODE _IOR('i', 0x00000002, __u32)
93#define LIRC_GET_SEND_CARRIER _IOR('i', 0x00000003, __u32)
94#define LIRC_GET_REC_CARRIER _IOR('i', 0x00000004, __u32)
95#define LIRC_GET_SEND_DUTY_CYCLE _IOR('i', 0x00000005, __u32)
96#define LIRC_GET_REC_DUTY_CYCLE _IOR('i', 0x00000006, __u32)
97#define LIRC_GET_REC_RESOLUTION _IOR('i', 0x00000007, __u32)
98
99#define LIRC_GET_MIN_TIMEOUT _IOR('i', 0x00000008, __u32)
100#define LIRC_GET_MAX_TIMEOUT _IOR('i', 0x00000009, __u32)
101
102#define LIRC_GET_MIN_FILTER_PULSE _IOR('i', 0x0000000a, __u32)
103#define LIRC_GET_MAX_FILTER_PULSE _IOR('i', 0x0000000b, __u32)
104#define LIRC_GET_MIN_FILTER_SPACE _IOR('i', 0x0000000c, __u32)
105#define LIRC_GET_MAX_FILTER_SPACE _IOR('i', 0x0000000d, __u32)
106
107/* code length in bits, currently only for LIRC_MODE_LIRCCODE */
108#define LIRC_GET_LENGTH _IOR('i', 0x0000000f, __u32)
109
110#define LIRC_SET_SEND_MODE _IOW('i', 0x00000011, __u32)
111#define LIRC_SET_REC_MODE _IOW('i', 0x00000012, __u32)
112/* Note: these can reset the according pulse_width */
113#define LIRC_SET_SEND_CARRIER _IOW('i', 0x00000013, __u32)
114#define LIRC_SET_REC_CARRIER _IOW('i', 0x00000014, __u32)
115#define LIRC_SET_SEND_DUTY_CYCLE _IOW('i', 0x00000015, __u32)
116#define LIRC_SET_REC_DUTY_CYCLE _IOW('i', 0x00000016, __u32)
117#define LIRC_SET_TRANSMITTER_MASK _IOW('i', 0x00000017, __u32)
118
119/*
120 * when a timeout != 0 is set the driver will send a
121 * LIRC_MODE2_TIMEOUT data packet, otherwise LIRC_MODE2_TIMEOUT is
122 * never sent, timeout is disabled by default
123 */
124#define LIRC_SET_REC_TIMEOUT _IOW('i', 0x00000018, __u32)
125
126/* 1 enables, 0 disables timeout reports in MODE2 */
127#define LIRC_SET_REC_TIMEOUT_REPORTS _IOW('i', 0x00000019, __u32)
128
129/*
130 * pulses shorter than this are filtered out by hardware (software
131 * emulation in lirc_dev?)
132 */
133#define LIRC_SET_REC_FILTER_PULSE _IOW('i', 0x0000001a, __u32)
134/*
135 * spaces shorter than this are filtered out by hardware (software
136 * emulation in lirc_dev?)
137 */
138#define LIRC_SET_REC_FILTER_SPACE _IOW('i', 0x0000001b, __u32)
139/*
140 * if filter cannot be set independantly for pulse/space, this should
141 * be used
142 */
143#define LIRC_SET_REC_FILTER _IOW('i', 0x0000001c, __u32)
144
145/*
146 * if enabled from the next key press on the driver will send
147 * LIRC_MODE2_FREQUENCY packets
148 */
149#define LIRC_SET_MEASURE_CARRIER_MODE _IOW('i', 0x0000001d, __u32)
150
151/*
152 * to set a range use
153 * LIRC_SET_REC_DUTY_CYCLE_RANGE/LIRC_SET_REC_CARRIER_RANGE with the
154 * lower bound first and later
155 * LIRC_SET_REC_DUTY_CYCLE/LIRC_SET_REC_CARRIER with the upper bound
156 */
157
158#define LIRC_SET_REC_DUTY_CYCLE_RANGE _IOW('i', 0x0000001e, __u32)
159#define LIRC_SET_REC_CARRIER_RANGE _IOW('i', 0x0000001f, __u32)
160
161#define LIRC_NOTIFY_DECODE _IO('i', 0x00000020)
162
163#define LIRC_SETUP_START _IO('i', 0x00000021)
164#define LIRC_SETUP_END _IO('i', 0x00000022)
165
166#define LIRC_SET_WIDEBAND_RECEIVER _IOW('i', 0x00000023, __u32)
167
168#endif
diff --git a/include/media/lirc_dev.h b/include/media/lirc_dev.h
new file mode 100644
index 000000000000..b1f60663cb39
--- /dev/null
+++ b/include/media/lirc_dev.h
@@ -0,0 +1,225 @@
1/*
2 * LIRC base driver
3 *
4 * by Artur Lipowski <alipowski@interia.pl>
5 * This code is licensed under GNU GPL
6 *
7 */
8
9#ifndef _LINUX_LIRC_DEV_H
10#define _LINUX_LIRC_DEV_H
11
12#define MAX_IRCTL_DEVICES 4
13#define BUFLEN 16
14
15#define mod(n, div) ((n) % (div))
16
17#include <linux/slab.h>
18#include <linux/fs.h>
19#include <linux/ioctl.h>
20#include <linux/poll.h>
21#include <linux/kfifo.h>
22#include <media/lirc.h>
23
24struct lirc_buffer {
25 wait_queue_head_t wait_poll;
26 spinlock_t fifo_lock;
27 unsigned int chunk_size;
28 unsigned int size; /* in chunks */
29 /* Using chunks instead of bytes pretends to simplify boundary checking
30 * And should allow for some performance fine tunning later */
31 struct kfifo fifo;
32 u8 fifo_initialized;
33};
34
35static inline void lirc_buffer_clear(struct lirc_buffer *buf)
36{
37 unsigned long flags;
38
39 if (buf->fifo_initialized) {
40 spin_lock_irqsave(&buf->fifo_lock, flags);
41 kfifo_reset(&buf->fifo);
42 spin_unlock_irqrestore(&buf->fifo_lock, flags);
43 } else
44 WARN(1, "calling %s on an uninitialized lirc_buffer\n",
45 __func__);
46}
47
48static inline int lirc_buffer_init(struct lirc_buffer *buf,
49 unsigned int chunk_size,
50 unsigned int size)
51{
52 int ret;
53
54 init_waitqueue_head(&buf->wait_poll);
55 spin_lock_init(&buf->fifo_lock);
56 buf->chunk_size = chunk_size;
57 buf->size = size;
58 ret = kfifo_alloc(&buf->fifo, size * chunk_size, GFP_KERNEL);
59 if (ret == 0)
60 buf->fifo_initialized = 1;
61
62 return ret;
63}
64
65static inline void lirc_buffer_free(struct lirc_buffer *buf)
66{
67 if (buf->fifo_initialized) {
68 kfifo_free(&buf->fifo);
69 buf->fifo_initialized = 0;
70 } else
71 WARN(1, "calling %s on an uninitialized lirc_buffer\n",
72 __func__);
73}
74
75static inline int lirc_buffer_len(struct lirc_buffer *buf)
76{
77 int len;
78 unsigned long flags;
79
80 spin_lock_irqsave(&buf->fifo_lock, flags);
81 len = kfifo_len(&buf->fifo);
82 spin_unlock_irqrestore(&buf->fifo_lock, flags);
83
84 return len;
85}
86
87static inline int lirc_buffer_full(struct lirc_buffer *buf)
88{
89 return lirc_buffer_len(buf) == buf->size * buf->chunk_size;
90}
91
92static inline int lirc_buffer_empty(struct lirc_buffer *buf)
93{
94 return !lirc_buffer_len(buf);
95}
96
97static inline int lirc_buffer_available(struct lirc_buffer *buf)
98{
99 return buf->size - (lirc_buffer_len(buf) / buf->chunk_size);
100}
101
102static inline unsigned int lirc_buffer_read(struct lirc_buffer *buf,
103 unsigned char *dest)
104{
105 unsigned int ret = 0;
106
107 if (lirc_buffer_len(buf) >= buf->chunk_size)
108 ret = kfifo_out_locked(&buf->fifo, dest, buf->chunk_size,
109 &buf->fifo_lock);
110 return ret;
111
112}
113
114static inline unsigned int lirc_buffer_write(struct lirc_buffer *buf,
115 unsigned char *orig)
116{
117 unsigned int ret;
118
119 ret = kfifo_in_locked(&buf->fifo, orig, buf->chunk_size,
120 &buf->fifo_lock);
121
122 return ret;
123}
124
125struct lirc_driver {
126 char name[40];
127 int minor;
128 unsigned long code_length;
129 unsigned int buffer_size; /* in chunks holding one code each */
130 int sample_rate;
131 unsigned long features;
132
133 unsigned int chunk_size;
134
135 void *data;
136 int min_timeout;
137 int max_timeout;
138 int (*add_to_buf) (void *data, struct lirc_buffer *buf);
139 struct lirc_buffer *rbuf;
140 int (*set_use_inc) (void *data);
141 void (*set_use_dec) (void *data);
142 struct file_operations *fops;
143 struct device *dev;
144 struct module *owner;
145};
146
147/* name:
148 * this string will be used for logs
149 *
150 * minor:
151 * indicates minor device (/dev/lirc) number for registered driver
152 * if caller fills it with negative value, then the first free minor
153 * number will be used (if available)
154 *
155 * code_length:
156 * length of the remote control key code expressed in bits
157 *
158 * sample_rate:
159 *
160 * data:
161 * it may point to any driver data and this pointer will be passed to
162 * all callback functions
163 *
164 * add_to_buf:
165 * add_to_buf will be called after specified period of the time or
166 * triggered by the external event, this behavior depends on value of
167 * the sample_rate this function will be called in user context. This
168 * routine should return 0 if data was added to the buffer and
169 * -ENODATA if none was available. This should add some number of bits
170 * evenly divisible by code_length to the buffer
171 *
172 * rbuf:
173 * if not NULL, it will be used as a read buffer, you will have to
174 * write to the buffer by other means, like irq's (see also
175 * lirc_serial.c).
176 *
177 * set_use_inc:
178 * set_use_inc will be called after device is opened
179 *
180 * set_use_dec:
181 * set_use_dec will be called after device is closed
182 *
183 * fops:
184 * file_operations for drivers which don't fit the current driver model.
185 *
186 * Some ioctl's can be directly handled by lirc_dev if the driver's
187 * ioctl function is NULL or if it returns -ENOIOCTLCMD (see also
188 * lirc_serial.c).
189 *
190 * owner:
191 * the module owning this struct
192 *
193 */
194
195
196/* following functions can be called ONLY from user context
197 *
198 * returns negative value on error or minor number
199 * of the registered device if success
200 * contents of the structure pointed by p is copied
201 */
202extern int lirc_register_driver(struct lirc_driver *d);
203
204/* returns negative value on error or 0 if success
205*/
206extern int lirc_unregister_driver(int minor);
207
208/* Returns the private data stored in the lirc_driver
209 * associated with the given device file pointer.
210 */
211void *lirc_get_pdata(struct file *file);
212
213/* default file operations
214 * used by drivers if they override only some operations
215 */
216int lirc_dev_fop_open(struct inode *inode, struct file *file);
217int lirc_dev_fop_close(struct inode *inode, struct file *file);
218unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait);
219long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
220ssize_t lirc_dev_fop_read(struct file *file, char *buffer, size_t length,
221 loff_t *ppos);
222ssize_t lirc_dev_fop_write(struct file *file, const char *buffer, size_t length,
223 loff_t *ppos);
224
225#endif
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index c78e99a435b6..a9c041d49662 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -17,8 +17,13 @@
17#define IR_TYPE_RC6 (1 << 2) /* Philips RC6 protocol */ 17#define IR_TYPE_RC6 (1 << 2) /* Philips RC6 protocol */
18#define IR_TYPE_JVC (1 << 3) /* JVC protocol */ 18#define IR_TYPE_JVC (1 << 3) /* JVC protocol */
19#define IR_TYPE_SONY (1 << 4) /* Sony12/15/20 protocol */ 19#define IR_TYPE_SONY (1 << 4) /* Sony12/15/20 protocol */
20#define IR_TYPE_LIRC (1 << 30) /* Pass raw IR to lirc userspace */
20#define IR_TYPE_OTHER (1u << 31) 21#define IR_TYPE_OTHER (1u << 31)
21 22
23#define IR_TYPE_ALL (IR_TYPE_RC5 | IR_TYPE_NEC | IR_TYPE_RC6 | \
24 IR_TYPE_JVC | IR_TYPE_SONY | IR_TYPE_LIRC | \
25 IR_TYPE_OTHER)
26
22struct ir_scancode { 27struct ir_scancode {
23 u32 scancode; 28 u32 scancode;
24 u32 keycode; 29 u32 keycode;
@@ -64,6 +69,8 @@ void rc_map_init(void);
64#define RC_MAP_BUDGET_CI_OLD "rc-budget-ci-old" 69#define RC_MAP_BUDGET_CI_OLD "rc-budget-ci-old"
65#define RC_MAP_CINERGY_1400 "rc-cinergy-1400" 70#define RC_MAP_CINERGY_1400 "rc-cinergy-1400"
66#define RC_MAP_CINERGY "rc-cinergy" 71#define RC_MAP_CINERGY "rc-cinergy"
72#define RC_MAP_DIB0700_NEC_TABLE "rc-dib0700-nec"
73#define RC_MAP_DIB0700_RC5_TABLE "rc-dib0700-rc5"
67#define RC_MAP_DM1105_NEC "rc-dm1105-nec" 74#define RC_MAP_DM1105_NEC "rc-dm1105-nec"
68#define RC_MAP_DNTV_LIVE_DVBT_PRO "rc-dntv-live-dvbt-pro" 75#define RC_MAP_DNTV_LIVE_DVBT_PRO "rc-dntv-live-dvbt-pro"
69#define RC_MAP_DNTV_LIVE_DVB_T "rc-dntv-live-dvb-t" 76#define RC_MAP_DNTV_LIVE_DVB_T "rc-dntv-live-dvb-t"
@@ -87,6 +94,7 @@ void rc_map_init(void);
87#define RC_MAP_KAIOMY "rc-kaiomy" 94#define RC_MAP_KAIOMY "rc-kaiomy"
88#define RC_MAP_KWORLD_315U "rc-kworld-315u" 95#define RC_MAP_KWORLD_315U "rc-kworld-315u"
89#define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog" 96#define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog"
97#define RC_MAP_LIRC "rc-lirc"
90#define RC_MAP_MANLI "rc-manli" 98#define RC_MAP_MANLI "rc-manli"
91#define RC_MAP_MSI_TVANYWHERE_PLUS "rc-msi-tvanywhere-plus" 99#define RC_MAP_MSI_TVANYWHERE_PLUS "rc-msi-tvanywhere-plus"
92#define RC_MAP_MSI_TVANYWHERE "rc-msi-tvanywhere" 100#define RC_MAP_MSI_TVANYWHERE "rc-msi-tvanywhere"
@@ -106,7 +114,9 @@ void rc_map_init(void);
106#define RC_MAP_PURPLETV "rc-purpletv" 114#define RC_MAP_PURPLETV "rc-purpletv"
107#define RC_MAP_PV951 "rc-pv951" 115#define RC_MAP_PV951 "rc-pv951"
108#define RC_MAP_RC5_HAUPPAUGE_NEW "rc-rc5-hauppauge-new" 116#define RC_MAP_RC5_HAUPPAUGE_NEW "rc-rc5-hauppauge-new"
117#define RC_MAP_RC5_STREAMZAP "rc-rc5-streamzap"
109#define RC_MAP_RC5_TV "rc-rc5-tv" 118#define RC_MAP_RC5_TV "rc-rc5-tv"
119#define RC_MAP_RC6_MCE "rc-rc6-mce"
110#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys" 120#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys"
111#define RC_MAP_TBS_NEC "rc-tbs-nec" 121#define RC_MAP_TBS_NEC "rc-tbs-nec"
112#define RC_MAP_TERRATEC_CINERGY_XS "rc-terratec-cinergy-xs" 122#define RC_MAP_TERRATEC_CINERGY_XS "rc-terratec-cinergy-xs"
@@ -116,6 +126,7 @@ void rc_map_init(void);
116#define RC_MAP_VIDEOMATE_TV_PVR "rc-videomate-tv-pvr" 126#define RC_MAP_VIDEOMATE_TV_PVR "rc-videomate-tv-pvr"
117#define RC_MAP_WINFAST "rc-winfast" 127#define RC_MAP_WINFAST "rc-winfast"
118#define RC_MAP_WINFAST_USBII_DELUXE "rc-winfast-usbii-deluxe" 128#define RC_MAP_WINFAST_USBII_DELUXE "rc-winfast-usbii-deluxe"
129
119/* 130/*
120 * Please, do not just append newer Remote Controller names at the end. 131 * Please, do not just append newer Remote Controller names at the end.
121 * The names should be ordered in alphabetical order 132 * The names should be ordered in alphabetical order
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index b67747836878..80346a6d28a9 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -6,8 +6,11 @@
6#define SH_CEU_FLAG_HSYNC_LOW (1 << 2) /* default High if possible */ 6#define SH_CEU_FLAG_HSYNC_LOW (1 << 2) /* default High if possible */
7#define SH_CEU_FLAG_VSYNC_LOW (1 << 3) /* default High if possible */ 7#define SH_CEU_FLAG_VSYNC_LOW (1 << 3) /* default High if possible */
8 8
9struct device;
10
9struct sh_mobile_ceu_info { 11struct sh_mobile_ceu_info {
10 unsigned long flags; 12 unsigned long flags;
13 struct device *csi2_dev;
11}; 14};
12 15
13#endif /* __ASM_SH_MOBILE_CEU_H__ */ 16#endif /* __ASM_SH_MOBILE_CEU_H__ */
diff --git a/include/media/sh_mobile_csi2.h b/include/media/sh_mobile_csi2.h
new file mode 100644
index 000000000000..4d2615174461
--- /dev/null
+++ b/include/media/sh_mobile_csi2.h
@@ -0,0 +1,46 @@
1/*
2 * Driver header for the SH-Mobile MIPI CSI-2 unit
3 *
4 * Copyright (C) 2010, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef SH_MIPI_CSI
12#define SH_MIPI_CSI
13
14enum sh_csi2_phy {
15 SH_CSI2_PHY_MAIN,
16 SH_CSI2_PHY_SUB,
17};
18
19enum sh_csi2_type {
20 SH_CSI2C,
21 SH_CSI2I,
22};
23
24#define SH_CSI2_CRC (1 << 0)
25#define SH_CSI2_ECC (1 << 1)
26
27struct platform_device;
28
29struct sh_csi2_client_config {
30 enum sh_csi2_phy phy;
31 unsigned char lanes; /* bitmask[3:0] */
32 unsigned char channel; /* 0..3 */
33 struct platform_device *pdev; /* client platform device */
34};
35
36struct sh_csi2_pdata {
37 enum sh_csi2_type type;
38 unsigned int flags;
39 struct sh_csi2_client_config *clients;
40 int num_clients;
41};
42
43struct device;
44struct v4l2_device;
45
46#endif
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index b8289c2f609b..2ce957301f77 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -12,12 +12,15 @@
12#ifndef SOC_CAMERA_H 12#ifndef SOC_CAMERA_H
13#define SOC_CAMERA_H 13#define SOC_CAMERA_H
14 14
15#include <linux/device.h>
15#include <linux/mutex.h> 16#include <linux/mutex.h>
16#include <linux/pm.h> 17#include <linux/pm.h>
17#include <linux/videodev2.h> 18#include <linux/videodev2.h>
18#include <media/videobuf-core.h> 19#include <media/videobuf-core.h>
19#include <media/v4l2-device.h> 20#include <media/v4l2-device.h>
20 21
22extern struct bus_type soc_camera_bus_type;
23
21struct soc_camera_device { 24struct soc_camera_device {
22 struct list_head list; 25 struct list_head list;
23 struct device dev; 26 struct device dev;
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
new file mode 100644
index 000000000000..9b7bea928a88
--- /dev/null
+++ b/include/media/v4l2-ctrls.h
@@ -0,0 +1,460 @@
1/*
2 V4L2 controls support header.
3
4 Copyright (C) 2010 Hans Verkuil <hverkuil@xs4all.nl>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef _V4L2_CTRLS_H
22#define _V4L2_CTRLS_H
23
24#include <linux/list.h>
25#include <linux/device.h>
26
27/* forward references */
28struct v4l2_ctrl_handler;
29struct v4l2_ctrl;
30struct video_device;
31struct v4l2_subdev;
32
33/** struct v4l2_ctrl_ops - The control operations that the driver has to provide.
34 * @g_volatile_ctrl: Get a new value for this control. Generally only relevant
35 * for volatile (and usually read-only) controls such as a control
36 * that returns the current signal strength which changes
37 * continuously.
38 * If not set, then the currently cached value will be returned.
39 * @try_ctrl: Test whether the control's value is valid. Only relevant when
40 * the usual min/max/step checks are not sufficient.
41 * @s_ctrl: Actually set the new control value. s_ctrl is compulsory. The
42 * ctrl->handler->lock is held when these ops are called, so no
43 * one else can access controls owned by that handler.
44 */
45struct v4l2_ctrl_ops {
46 int (*g_volatile_ctrl)(struct v4l2_ctrl *ctrl);
47 int (*try_ctrl)(struct v4l2_ctrl *ctrl);
48 int (*s_ctrl)(struct v4l2_ctrl *ctrl);
49};
50
51/** struct v4l2_ctrl - The control structure.
52 * @node: The list node.
53 * @handler: The handler that owns the control.
54 * @cluster: Point to start of cluster array.
55 * @ncontrols: Number of controls in cluster array.
56 * @has_new: Internal flag: set when there is a valid new value.
57 * @done: Internal flag: set for each processed control.
58 * @is_private: If set, then this control is private to its handler and it
59 * will not be added to any other handlers. Drivers can set
60 * this flag.
61 * @is_volatile: If set, then this control is volatile. This means that the
62 * control's current value cannot be cached and needs to be
63 * retrieved through the g_volatile_ctrl op. Drivers can set
64 * this flag.
65 * @ops: The control ops.
66 * @id: The control ID.
67 * @name: The control name.
68 * @type: The control type.
69 * @minimum: The control's minimum value.
70 * @maximum: The control's maximum value.
71 * @default_value: The control's default value.
72 * @step: The control's step value for non-menu controls.
73 * @menu_skip_mask: The control's skip mask for menu controls. This makes it
74 * easy to skip menu items that are not valid. If bit X is set,
75 * then menu item X is skipped. Of course, this only works for
76 * menus with <= 32 menu items. There are no menus that come
77 * close to that number, so this is OK. Should we ever need more,
78 * then this will have to be extended to a u64 or a bit array.
79 * @qmenu: A const char * array for all menu items. Array entries that are
80 * empty strings ("") correspond to non-existing menu items (this
81 * is in addition to the menu_skip_mask above). The last entry
82 * must be NULL.
83 * @flags: The control's flags.
84 * @cur: The control's current value.
85 * @val: The control's new s32 value.
86 * @val64: The control's new s64 value.
87 * @string: The control's new string value.
88 * @priv: The control's private pointer. For use by the driver. It is
89 * untouched by the control framework. Note that this pointer is
90 * not freed when the control is deleted. Should this be needed
91 * then a new internal bitfield can be added to tell the framework
92 * to free this pointer.
93 */
94struct v4l2_ctrl {
95 /* Administrative fields */
96 struct list_head node;
97 struct v4l2_ctrl_handler *handler;
98 struct v4l2_ctrl **cluster;
99 unsigned ncontrols;
100 unsigned int has_new:1;
101 unsigned int done:1;
102
103 unsigned int is_private:1;
104 unsigned int is_volatile:1;
105
106 const struct v4l2_ctrl_ops *ops;
107 u32 id;
108 const char *name;
109 enum v4l2_ctrl_type type;
110 s32 minimum, maximum, default_value;
111 union {
112 u32 step;
113 u32 menu_skip_mask;
114 };
115 const char **qmenu;
116 unsigned long flags;
117 union {
118 s32 val;
119 s64 val64;
120 char *string;
121 } cur;
122 union {
123 s32 val;
124 s64 val64;
125 char *string;
126 };
127 void *priv;
128};
129
130/** struct v4l2_ctrl_ref - The control reference.
131 * @node: List node for the sorted list.
132 * @next: Single-link list node for the hash.
133 * @ctrl: The actual control information.
134 *
135 * Each control handler has a list of these refs. The list_head is used to
136 * keep a sorted-by-control-ID list of all controls, while the next pointer
137 * is used to link the control in the hash's bucket.
138 */
139struct v4l2_ctrl_ref {
140 struct list_head node;
141 struct v4l2_ctrl_ref *next;
142 struct v4l2_ctrl *ctrl;
143};
144
145/** struct v4l2_ctrl_handler - The control handler keeps track of all the
146 * controls: both the controls owned by the handler and those inherited
147 * from other handlers.
148 * @lock: Lock to control access to this handler and its controls.
149 * @ctrls: The list of controls owned by this handler.
150 * @ctrl_refs: The list of control references.
151 * @cached: The last found control reference. It is common that the same
152 * control is needed multiple times, so this is a simple
153 * optimization.
154 * @buckets: Buckets for the hashing. Allows for quick control lookup.
155 * @nr_of_buckets: Total number of buckets in the array.
156 * @error: The error code of the first failed control addition.
157 */
158struct v4l2_ctrl_handler {
159 struct mutex lock;
160 struct list_head ctrls;
161 struct list_head ctrl_refs;
162 struct v4l2_ctrl_ref *cached;
163 struct v4l2_ctrl_ref **buckets;
164 u16 nr_of_buckets;
165 int error;
166};
167
168/** struct v4l2_ctrl_config - Control configuration structure.
169 * @ops: The control ops.
170 * @id: The control ID.
171 * @name: The control name.
172 * @type: The control type.
173 * @min: The control's minimum value.
174 * @max: The control's maximum value.
175 * @step: The control's step value for non-menu controls.
176 * @def: The control's default value.
177 * @flags: The control's flags.
178 * @menu_skip_mask: The control's skip mask for menu controls. This makes it
179 * easy to skip menu items that are not valid. If bit X is set,
180 * then menu item X is skipped. Of course, this only works for
181 * menus with <= 32 menu items. There are no menus that come
182 * close to that number, so this is OK. Should we ever need more,
183 * then this will have to be extended to a u64 or a bit array.
184 * @qmenu: A const char * array for all menu items. Array entries that are
185 * empty strings ("") correspond to non-existing menu items (this
186 * is in addition to the menu_skip_mask above). The last entry
187 * must be NULL.
188 * @is_private: If set, then this control is private to its handler and it
189 * will not be added to any other handlers.
190 * @is_volatile: If set, then this control is volatile. This means that the
191 * control's current value cannot be cached and needs to be
192 * retrieved through the g_volatile_ctrl op.
193 */
194struct v4l2_ctrl_config {
195 const struct v4l2_ctrl_ops *ops;
196 u32 id;
197 const char *name;
198 enum v4l2_ctrl_type type;
199 s32 min;
200 s32 max;
201 u32 step;
202 s32 def;
203 u32 flags;
204 u32 menu_skip_mask;
205 const char **qmenu;
206 unsigned int is_private:1;
207 unsigned int is_volatile:1;
208};
209
210/** v4l2_ctrl_fill() - Fill in the control fields based on the control ID.
211 *
212 * This works for all standard V4L2 controls.
213 * For non-standard controls it will only fill in the given arguments
214 * and @name will be NULL.
215 *
216 * This function will overwrite the contents of @name, @type and @flags.
217 * The contents of @min, @max, @step and @def may be modified depending on
218 * the type.
219 *
220 * Do not use in drivers! It is used internally for backwards compatibility
221 * control handling only. Once all drivers are converted to use the new
222 * control framework this function will no longer be exported.
223 */
224void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
225 s32 *min, s32 *max, s32 *step, s32 *def, u32 *flags);
226
227
228/** v4l2_ctrl_handler_init() - Initialize the control handler.
229 * @hdl: The control handler.
230 * @nr_of_controls_hint: A hint of how many controls this handler is
231 * expected to refer to. This is the total number, so including
232 * any inherited controls. It doesn't have to be precise, but if
233 * it is way off, then you either waste memory (too many buckets
234 * are allocated) or the control lookup becomes slower (not enough
235 * buckets are allocated, so there are more slow list lookups).
236 * It will always work, though.
237 *
238 * Returns an error if the buckets could not be allocated. This error will
239 * also be stored in @hdl->error.
240 */
241int v4l2_ctrl_handler_init(struct v4l2_ctrl_handler *hdl,
242 unsigned nr_of_controls_hint);
243
244/** v4l2_ctrl_handler_free() - Free all controls owned by the handler and free
245 * the control list.
246 * @hdl: The control handler.
247 *
248 * Does nothing if @hdl == NULL.
249 */
250void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl);
251
252/** v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging
253 * to the handler to initialize the hardware to the current control values.
254 * @hdl: The control handler.
255 *
256 * Button controls will be skipped, as are read-only controls.
257 *
258 * If @hdl == NULL, then this just returns 0.
259 */
260int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl);
261
262/** v4l2_ctrl_handler_log_status() - Log all controls owned by the handler.
263 * @hdl: The control handler.
264 * @prefix: The prefix to use when logging the control values. If the
265 * prefix does not end with a space, then ": " will be added
266 * after the prefix. If @prefix == NULL, then no prefix will be
267 * used.
268 *
269 * For use with VIDIOC_LOG_STATUS.
270 *
271 * Does nothing if @hdl == NULL.
272 */
273void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl,
274 const char *prefix);
275
276/** v4l2_ctrl_new_custom() - Allocate and initialize a new custom V4L2
277 * control.
278 * @hdl: The control handler.
279 * @cfg: The control's configuration data.
280 * @priv: The control's driver-specific private data.
281 *
282 * If the &v4l2_ctrl struct could not be allocated then NULL is returned
283 * and @hdl->error is set to the error code (if it wasn't set already).
284 */
285struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl,
286 const struct v4l2_ctrl_config *cfg, void *priv);
287
288/** v4l2_ctrl_new_std() - Allocate and initialize a new standard V4L2 non-menu control.
289 * @hdl: The control handler.
290 * @ops: The control ops.
291 * @id: The control ID.
292 * @min: The control's minimum value.
293 * @max: The control's maximum value.
294 * @step: The control's step value
295 * @def: The control's default value.
296 *
297 * If the &v4l2_ctrl struct could not be allocated, or the control
298 * ID is not known, then NULL is returned and @hdl->error is set to the
299 * appropriate error code (if it wasn't set already).
300 *
301 * If @id refers to a menu control, then this function will return NULL.
302 *
303 * Use v4l2_ctrl_new_std_menu() when adding menu controls.
304 */
305struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
306 const struct v4l2_ctrl_ops *ops,
307 u32 id, s32 min, s32 max, u32 step, s32 def);
308
309/** v4l2_ctrl_new_std_menu() - Allocate and initialize a new standard V4L2 menu control.
310 * @hdl: The control handler.
311 * @ops: The control ops.
312 * @id: The control ID.
313 * @max: The control's maximum value.
314 * @mask: The control's skip mask for menu controls. This makes it
315 * easy to skip menu items that are not valid. If bit X is set,
316 * then menu item X is skipped. Of course, this only works for
317 * menus with <= 32 menu items. There are no menus that come
318 * close to that number, so this is OK. Should we ever need more,
319 * then this will have to be extended to a u64 or a bit array.
320 * @def: The control's default value.
321 *
322 * Same as v4l2_ctrl_new_std(), but @min is set to 0 and the @mask value
323 * determines which menu items are to be skipped.
324 *
325 * If @id refers to a non-menu control, then this function will return NULL.
326 */
327struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
328 const struct v4l2_ctrl_ops *ops,
329 u32 id, s32 max, s32 mask, s32 def);
330
331/** v4l2_ctrl_add_ctrl() - Add a control from another handler to this handler.
332 * @hdl: The control handler.
333 * @ctrl: The control to add.
334 *
335 * It will return NULL if it was unable to add the control reference.
336 * If the control already belonged to the handler, then it will do
337 * nothing and just return @ctrl.
338 */
339struct v4l2_ctrl *v4l2_ctrl_add_ctrl(struct v4l2_ctrl_handler *hdl,
340 struct v4l2_ctrl *ctrl);
341
342/** v4l2_ctrl_add_handler() - Add all controls from handler @add to
343 * handler @hdl.
344 * @hdl: The control handler.
345 * @add: The control handler whose controls you want to add to
346 * the @hdl control handler.
347 *
348 * Does nothing if either of the two is a NULL pointer.
349 * In case of an error @hdl->error will be set to the error code (if it
350 * wasn't set already).
351 */
352int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl,
353 struct v4l2_ctrl_handler *add);
354
355
356/** v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging to that cluster.
357 * @ncontrols: The number of controls in this cluster.
358 * @controls: The cluster control array of size @ncontrols.
359 */
360void v4l2_ctrl_cluster(unsigned ncontrols, struct v4l2_ctrl **controls);
361
362
363/** v4l2_ctrl_find() - Find a control with the given ID.
364 * @hdl: The control handler.
365 * @id: The control ID to find.
366 *
367 * If @hdl == NULL this will return NULL as well. Will lock the handler so
368 * do not use from inside &v4l2_ctrl_ops.
369 */
370struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id);
371
372/** v4l2_ctrl_activate() - Make the control active or inactive.
373 * @ctrl: The control to (de)activate.
374 * @active: True if the control should become active.
375 *
376 * This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically.
377 * Does nothing if @ctrl == NULL.
378 * This will usually be called from within the s_ctrl op.
379 *
380 * This function can be called regardless of whether the control handler
381 * is locked or not.
382 */
383void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active);
384
385/** v4l2_ctrl_grab() - Mark the control as grabbed or not grabbed.
386 * @ctrl: The control to (de)activate.
387 * @grabbed: True if the control should become grabbed.
388 *
389 * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically.
390 * Does nothing if @ctrl == NULL.
391 * This will usually be called when starting or stopping streaming in the
392 * driver.
393 *
394 * This function can be called regardless of whether the control handler
395 * is locked or not.
396 */
397void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
398
399/** v4l2_ctrl_lock() - Helper function to lock the handler
400 * associated with the control.
401 * @ctrl: The control to lock.
402 */
403static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl)
404{
405 mutex_lock(&ctrl->handler->lock);
406}
407
408/** v4l2_ctrl_lock() - Helper function to unlock the handler
409 * associated with the control.
410 * @ctrl: The control to unlock.
411 */
412static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl)
413{
414 mutex_unlock(&ctrl->handler->lock);
415}
416
417/** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from within a driver.
418 * @ctrl: The control.
419 *
420 * This returns the control's value safely by going through the control
421 * framework. This function will lock the control's handler, so it cannot be
422 * used from within the &v4l2_ctrl_ops functions.
423 *
424 * This function is for integer type controls only.
425 */
426s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);
427
428/** v4l2_ctrl_s_ctrl() - Helper function to set the control's value from within a driver.
429 * @ctrl: The control.
430 * @val: The new value.
431 *
432 * This set the control's new value safely by going through the control
433 * framework. This function will lock the control's handler, so it cannot be
434 * used from within the &v4l2_ctrl_ops functions.
435 *
436 * This function is for integer type controls only.
437 */
438int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val);
439
440
441/* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */
442int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc);
443int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm);
444int v4l2_g_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl);
445int v4l2_s_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl);
446int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c);
447int v4l2_try_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c);
448int v4l2_s_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c);
449
450/* Helpers for subdevices. If the associated ctrl_handler == NULL then they
451 will all return -EINVAL. */
452int v4l2_subdev_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc);
453int v4l2_subdev_querymenu(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
454int v4l2_subdev_g_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs);
455int v4l2_subdev_try_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs);
456int v4l2_subdev_s_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs);
457int v4l2_subdev_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
458int v4l2_subdev_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
459
460#endif
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index bebe44b03e0f..1efcacbed01a 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -27,6 +27,7 @@
27struct v4l2_ioctl_callbacks; 27struct v4l2_ioctl_callbacks;
28struct video_device; 28struct video_device;
29struct v4l2_device; 29struct v4l2_device;
30struct v4l2_ctrl_handler;
30 31
31/* Flag to mark the video_device struct as registered. 32/* Flag to mark the video_device struct as registered.
32 Drivers can clear this flag if they want to block all future 33 Drivers can clear this flag if they want to block all future
@@ -67,6 +68,9 @@ struct video_device
67 struct device *parent; /* device parent */ 68 struct device *parent; /* device parent */
68 struct v4l2_device *v4l2_dev; /* v4l2_device parent */ 69 struct v4l2_device *v4l2_dev; /* v4l2_device parent */
69 70
71 /* Control handler associated with this device node. May be NULL. */
72 struct v4l2_ctrl_handler *ctrl_handler;
73
70 /* device info */ 74 /* device info */
71 char name[32]; 75 char name[32];
72 int vfl_type; 76 int vfl_type;
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index 5d5d550e63ad..8bcbd7a0271c 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -32,6 +32,8 @@
32 32
33#define V4L2_DEVICE_NAME_SIZE (20 + 16) 33#define V4L2_DEVICE_NAME_SIZE (20 + 16)
34 34
35struct v4l2_ctrl_handler;
36
35struct v4l2_device { 37struct v4l2_device {
36 /* dev->driver_data points to this struct. 38 /* dev->driver_data points to this struct.
37 Note: dev might be NULL if there is no parent device 39 Note: dev might be NULL if there is no parent device
@@ -47,6 +49,8 @@ struct v4l2_device {
47 /* notify callback called by some sub-devices. */ 49 /* notify callback called by some sub-devices. */
48 void (*notify)(struct v4l2_subdev *sd, 50 void (*notify)(struct v4l2_subdev *sd,
49 unsigned int notification, void *arg); 51 unsigned int notification, void *arg);
52 /* The control handler. May be NULL. */
53 struct v4l2_ctrl_handler *ctrl_handler;
50}; 54};
51 55
52/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev. 56/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev.
diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
index 865cda7cd611..f0cf2e7def06 100644
--- a/include/media/v4l2-mediabus.h
+++ b/include/media/v4l2-mediabus.h
@@ -24,10 +24,10 @@
24 */ 24 */
25enum v4l2_mbus_pixelcode { 25enum v4l2_mbus_pixelcode {
26 V4L2_MBUS_FMT_FIXED = 1, 26 V4L2_MBUS_FMT_FIXED = 1,
27 V4L2_MBUS_FMT_YUYV8_2X8_LE, 27 V4L2_MBUS_FMT_YUYV8_2X8,
28 V4L2_MBUS_FMT_YVYU8_2X8_LE, 28 V4L2_MBUS_FMT_YVYU8_2X8,
29 V4L2_MBUS_FMT_YUYV8_2X8_BE, 29 V4L2_MBUS_FMT_UYVY8_2X8,
30 V4L2_MBUS_FMT_YVYU8_2X8_BE, 30 V4L2_MBUS_FMT_VYUY8_2X8,
31 V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE, 31 V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE,
32 V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE, 32 V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE,
33 V4L2_MBUS_FMT_RGB565_2X8_LE, 33 V4L2_MBUS_FMT_RGB565_2X8_LE,
@@ -41,6 +41,11 @@ enum v4l2_mbus_pixelcode {
41 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE, 41 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE,
42 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE, 42 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE,
43 V4L2_MBUS_FMT_SGRBG8_1X8, 43 V4L2_MBUS_FMT_SGRBG8_1X8,
44 V4L2_MBUS_FMT_SBGGR12_1X12,
45 V4L2_MBUS_FMT_YUYV8_1_5X8,
46 V4L2_MBUS_FMT_YVYU8_1_5X8,
47 V4L2_MBUS_FMT_UYVY8_1_5X8,
48 V4L2_MBUS_FMT_VYUY8_1_5X8,
44}; 49};
45 50
46/** 51/**
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 02c6f4d11ed3..4a97d7341a94 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -35,6 +35,7 @@
35#define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001 35#define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001
36 36
37struct v4l2_device; 37struct v4l2_device;
38struct v4l2_ctrl_handler;
38struct v4l2_subdev; 39struct v4l2_subdev;
39struct tuner_setup; 40struct tuner_setup;
40 41
@@ -90,10 +91,31 @@ struct v4l2_decode_vbi_line {
90 not yet implemented) since ops provide proper type-checking. 91 not yet implemented) since ops provide proper type-checking.
91 */ 92 */
92 93
94/* Subdevice external IO pin configuration */
95#define V4L2_SUBDEV_IO_PIN_DISABLE (1 << 0) /* ENABLE assumed */
96#define V4L2_SUBDEV_IO_PIN_OUTPUT (1 << 1)
97#define V4L2_SUBDEV_IO_PIN_INPUT (1 << 2)
98#define V4L2_SUBDEV_IO_PIN_SET_VALUE (1 << 3) /* Set output value */
99#define V4L2_SUBDEV_IO_PIN_ACTIVE_LOW (1 << 4) /* ACTIVE HIGH assumed */
100
101struct v4l2_subdev_io_pin_config {
102 u32 flags; /* V4L2_SUBDEV_IO_PIN_* flags for this pin's config */
103 u8 pin; /* Chip external IO pin to configure */
104 u8 function; /* Internal signal pad/function to route to IO pin */
105 u8 value; /* Initial value for pin - e.g. GPIO output value */
106 u8 strength; /* Pin drive strength */
107};
108
93/* s_config: if set, then it is always called by the v4l2_i2c_new_subdev* 109/* s_config: if set, then it is always called by the v4l2_i2c_new_subdev*
94 functions after the v4l2_subdev was registered. It is used to pass 110 functions after the v4l2_subdev was registered. It is used to pass
95 platform data to the subdev which can be used during initialization. 111 platform data to the subdev which can be used during initialization.
96 112
113 s_io_pin_config: configure one or more chip I/O pins for chips that
114 multiplex different internal signal pads out to IO pins. This function
115 takes a pointer to an array of 'n' pin configuration entries, one for
116 each pin being configured. This function could be called at times
117 other than just subdevice initialization.
118
97 init: initialize the sensor registors to some sort of reasonable default 119 init: initialize the sensor registors to some sort of reasonable default
98 values. Do not use for new drivers and should be removed in existing 120 values. Do not use for new drivers and should be removed in existing
99 drivers. 121 drivers.
@@ -110,11 +132,18 @@ struct v4l2_decode_vbi_line {
110 132
111 s_power: puts subdevice in power saving mode (on == 0) or normal operation 133 s_power: puts subdevice in power saving mode (on == 0) or normal operation
112 mode (on == 1). 134 mode (on == 1).
135
136 interrupt_service_routine: Called by the bridge chip's interrupt service
137 handler, when an interrupt status has be raised due to this subdev,
138 so that this subdev can handle the details. It may schedule work to be
139 performed later. It must not sleep. *Called from an IRQ context*.
113 */ 140 */
114struct v4l2_subdev_core_ops { 141struct v4l2_subdev_core_ops {
115 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); 142 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);
116 int (*log_status)(struct v4l2_subdev *sd); 143 int (*log_status)(struct v4l2_subdev *sd);
117 int (*s_config)(struct v4l2_subdev *sd, int irq, void *platform_data); 144 int (*s_config)(struct v4l2_subdev *sd, int irq, void *platform_data);
145 int (*s_io_pin_config)(struct v4l2_subdev *sd, size_t n,
146 struct v4l2_subdev_io_pin_config *pincfg);
118 int (*init)(struct v4l2_subdev *sd, u32 val); 147 int (*init)(struct v4l2_subdev *sd, u32 val);
119 int (*load_fw)(struct v4l2_subdev *sd); 148 int (*load_fw)(struct v4l2_subdev *sd);
120 int (*reset)(struct v4l2_subdev *sd, u32 val); 149 int (*reset)(struct v4l2_subdev *sd, u32 val);
@@ -133,6 +162,8 @@ struct v4l2_subdev_core_ops {
133 int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); 162 int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
134#endif 163#endif
135 int (*s_power)(struct v4l2_subdev *sd, int on); 164 int (*s_power)(struct v4l2_subdev *sd, int on);
165 int (*interrupt_service_routine)(struct v4l2_subdev *sd,
166 u32 status, bool *handled);
136}; 167};
137 168
138/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. 169/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio.
@@ -307,11 +338,6 @@ struct v4l2_subdev_sensor_ops {
307}; 338};
308 339
309/* 340/*
310 interrupt_service_routine: Called by the bridge chip's interrupt service
311 handler, when an IR interrupt status has be raised due to this subdev,
312 so that this subdev can handle the details. It may schedule work to be
313 performed later. It must not sleep. *Called from an IRQ context*.
314
315 [rt]x_g_parameters: Get the current operating parameters and state of the 341 [rt]x_g_parameters: Get the current operating parameters and state of the
316 the IR receiver or transmitter. 342 the IR receiver or transmitter.
317 343
@@ -335,14 +361,9 @@ struct v4l2_subdev_sensor_ops {
335 */ 361 */
336 362
337enum v4l2_subdev_ir_mode { 363enum v4l2_subdev_ir_mode {
338 V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* space & mark widths in nanosecs */ 364 V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* uses struct ir_raw_event records */
339}; 365};
340 366
341/* Data format of data read or written for V4L2_SUBDEV_IR_MODE_PULSE_WIDTH */
342#define V4L2_SUBDEV_IR_PULSE_MAX_WIDTH_NS 0x7fffffff
343#define V4L2_SUBDEV_IR_PULSE_LEVEL_MASK 0x80000000
344#define V4L2_SUBDEV_IR_PULSE_RX_SEQ_END 0xffffffff
345
346struct v4l2_subdev_ir_parameters { 367struct v4l2_subdev_ir_parameters {
347 /* Either Rx or Tx */ 368 /* Either Rx or Tx */
348 unsigned int bytes_per_data_element; /* of data in read or write call */ 369 unsigned int bytes_per_data_element; /* of data in read or write call */
@@ -356,7 +377,10 @@ struct v4l2_subdev_ir_parameters {
356 u32 max_pulse_width; /* ns, valid only for baseband signal */ 377 u32 max_pulse_width; /* ns, valid only for baseband signal */
357 unsigned int carrier_freq; /* Hz, valid only for modulated signal*/ 378 unsigned int carrier_freq; /* Hz, valid only for modulated signal*/
358 unsigned int duty_cycle; /* percent, valid only for modulated signal*/ 379 unsigned int duty_cycle; /* percent, valid only for modulated signal*/
359 bool invert; /* logically invert sense of mark/space */ 380 bool invert_level; /* invert signal level */
381
382 /* Tx only */
383 bool invert_carrier_sense; /* Send 0/space as a carrier burst */
360 384
361 /* Rx only */ 385 /* Rx only */
362 u32 noise_filter_min_width; /* ns, min time of a valid pulse */ 386 u32 noise_filter_min_width; /* ns, min time of a valid pulse */
@@ -366,10 +390,6 @@ struct v4l2_subdev_ir_parameters {
366}; 390};
367 391
368struct v4l2_subdev_ir_ops { 392struct v4l2_subdev_ir_ops {
369 /* Common to receiver and transmitter */
370 int (*interrupt_service_routine)(struct v4l2_subdev *sd,
371 u32 status, bool *handled);
372
373 /* Receiver */ 393 /* Receiver */
374 int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count, 394 int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count,
375 ssize_t *num); 395 ssize_t *num);
@@ -415,6 +435,8 @@ struct v4l2_subdev {
415 u32 flags; 435 u32 flags;
416 struct v4l2_device *v4l2_dev; 436 struct v4l2_device *v4l2_dev;
417 const struct v4l2_subdev_ops *ops; 437 const struct v4l2_subdev_ops *ops;
438 /* The control handler of this subdev. May be NULL. */
439 struct v4l2_ctrl_handler *ctrl_handler;
418 /* name must be unique */ 440 /* name must be unique */
419 char name[V4L2_SUBDEV_NAME_SIZE]; 441 char name[V4L2_SUBDEV_NAME_SIZE];
420 /* can be used to group similar subdevs, value is driver-specific */ 442 /* can be used to group similar subdevs, value is driver-specific */
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h
index f91a736c133d..f2c41cebf453 100644
--- a/include/media/videobuf-core.h
+++ b/include/media/videobuf-core.h
@@ -54,8 +54,6 @@ struct videobuf_queue;
54 54
55struct videobuf_mapping { 55struct videobuf_mapping {
56 unsigned int count; 56 unsigned int count;
57 unsigned long start;
58 unsigned long end;
59 struct videobuf_queue *q; 57 struct videobuf_queue *q;
60}; 58};
61 59
@@ -127,7 +125,7 @@ struct videobuf_queue_ops {
127struct videobuf_qtype_ops { 125struct videobuf_qtype_ops {
128 u32 magic; 126 u32 magic;
129 127
130 struct videobuf_buffer *(*alloc)(size_t size); 128 struct videobuf_buffer *(*alloc_vb)(size_t size);
131 void *(*vaddr) (struct videobuf_buffer *buf); 129 void *(*vaddr) (struct videobuf_buffer *buf);
132 int (*iolock) (struct videobuf_queue *q, 130 int (*iolock) (struct videobuf_queue *q,
133 struct videobuf_buffer *vb, 131 struct videobuf_buffer *vb,
@@ -173,7 +171,7 @@ int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr);
173int videobuf_iolock(struct videobuf_queue *q, struct videobuf_buffer *vb, 171int videobuf_iolock(struct videobuf_queue *q, struct videobuf_buffer *vb,
174 struct v4l2_framebuffer *fbuf); 172 struct v4l2_framebuffer *fbuf);
175 173
176struct videobuf_buffer *videobuf_alloc(struct videobuf_queue *q); 174struct videobuf_buffer *videobuf_alloc_vb(struct videobuf_queue *q);
177 175
178/* Used on videobuf-dvb */ 176/* Used on videobuf-dvb */
179void *videobuf_queue_to_vaddr(struct videobuf_queue *q, 177void *videobuf_queue_to_vaddr(struct videobuf_queue *q,
diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h
index a195f3b9c00a..97e07f46a0fa 100644
--- a/include/media/videobuf-dma-sg.h
+++ b/include/media/videobuf-dma-sg.h
@@ -25,23 +25,6 @@
25/* --------------------------------------------------------------------- */ 25/* --------------------------------------------------------------------- */
26 26
27/* 27/*
28 * Return a scatterlist for some page-aligned vmalloc()'ed memory
29 * block (NULL on errors). Memory for the scatterlist is allocated
30 * using kmalloc. The caller must free the memory.
31 */
32struct scatterlist *videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages);
33
34/*
35 * Return a scatterlist for a an array of userpages (NULL on errors).
36 * Memory for the scatterlist is allocated using kmalloc. The caller
37 * must free the memory.
38 */
39struct scatterlist *videobuf_pages_to_sg(struct page **pages, int nr_pages,
40 int offset);
41
42/* --------------------------------------------------------------------- */
43
44/*
45 * A small set of helper functions to manage buffers (both userland 28 * A small set of helper functions to manage buffers (both userland
46 * and kernel) for DMA. 29 * and kernel) for DMA.
47 * 30 *
@@ -68,7 +51,7 @@ struct videobuf_dmabuf {
68 struct page **pages; 51 struct page **pages;
69 52
70 /* for kernel buffers */ 53 /* for kernel buffers */
71 void *vmalloc; 54 void *vaddr;
72 55
73 /* for overlay buffers (pci-pci dma) */ 56 /* for overlay buffers (pci-pci dma) */
74 dma_addr_t bus_addr; 57 dma_addr_t bus_addr;
@@ -87,6 +70,16 @@ struct videobuf_dma_sg_memory {
87 struct videobuf_dmabuf dma; 70 struct videobuf_dmabuf dma;
88}; 71};
89 72
73/*
74 * Scatter-gather DMA buffer API.
75 *
76 * These functions provide a simple way to create a page list and a
77 * scatter-gather list from a kernel, userspace of physical address and map the
78 * memory for DMA operation.
79 *
80 * Despite the name, this is totally unrelated to videobuf, except that
81 * videobuf-dma-sg uses the same API internally.
82 */
90void videobuf_dma_init(struct videobuf_dmabuf *dma); 83void videobuf_dma_init(struct videobuf_dmabuf *dma);
91int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction, 84int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction,
92 unsigned long data, unsigned long size); 85 unsigned long data, unsigned long size);
@@ -96,8 +89,8 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction,
96 dma_addr_t addr, int nr_pages); 89 dma_addr_t addr, int nr_pages);
97int videobuf_dma_free(struct videobuf_dmabuf *dma); 90int videobuf_dma_free(struct videobuf_dmabuf *dma);
98 91
99int videobuf_dma_map(struct videobuf_queue *q, struct videobuf_dmabuf *dma); 92int videobuf_dma_map(struct device *dev, struct videobuf_dmabuf *dma);
100int videobuf_dma_unmap(struct videobuf_queue *q, struct videobuf_dmabuf *dma); 93int videobuf_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma);
101struct videobuf_dmabuf *videobuf_to_dma(struct videobuf_buffer *buf); 94struct videobuf_dmabuf *videobuf_to_dma(struct videobuf_buffer *buf);
102 95
103void *videobuf_sg_alloc(size_t size); 96void *videobuf_sg_alloc(size_t size);
@@ -111,11 +104,5 @@ void videobuf_queue_sg_init(struct videobuf_queue *q,
111 unsigned int msize, 104 unsigned int msize,
112 void *priv); 105 void *priv);
113 106
114/*FIXME: these variants are used only on *-alsa code, where videobuf is
115 * used without queue
116 */
117int videobuf_sg_dma_map(struct device *dev, struct videobuf_dmabuf *dma);
118int videobuf_sg_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma);
119
120#endif /* _VIDEOBUF_DMA_SG_H */ 107#endif /* _VIDEOBUF_DMA_SG_H */
121 108
diff --git a/include/media/videobuf-vmalloc.h b/include/media/videobuf-vmalloc.h
index 851eb1a2ff2a..e19403c18dae 100644
--- a/include/media/videobuf-vmalloc.h
+++ b/include/media/videobuf-vmalloc.h
@@ -22,7 +22,7 @@
22struct videobuf_vmalloc_memory { 22struct videobuf_vmalloc_memory {
23 u32 magic; 23 u32 magic;
24 24
25 void *vmalloc; 25 void *vaddr;
26 26
27 /* remap_vmalloc_range seems to need to run 27 /* remap_vmalloc_range seems to need to run
28 * after mmap() on some cases */ 28 * after mmap() on some cases */
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index be51ae2bd0ff..4debb4514634 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -1,5 +1,20 @@
1/* 1/*
2 * Portions of MTD ABI definition which are shared by kernel and user space 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> et al.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
3 */ 18 */
4 19
5#ifndef __MTD_ABI_H__ 20#ifndef __MTD_ABI_H__
@@ -110,6 +125,7 @@ struct otp_info {
110#define MEMERASE64 _IOW('M', 20, struct erase_info_user64) 125#define MEMERASE64 _IOW('M', 20, struct erase_info_user64)
111#define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64) 126#define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64)
112#define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64) 127#define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64)
128#define MEMISLOCKED _IOR('M', 23, struct erase_info_user)
113 129
114/* 130/*
115 * Obsolete legacy interface. Keep it in order not to break userspace 131 * Obsolete legacy interface. Keep it in order not to break userspace
diff --git a/include/mtd/mtd-user.h b/include/mtd/mtd-user.h
index 170ceca3b2d0..aa3c2f86a913 100644
--- a/include/mtd/mtd-user.h
+++ b/include/mtd/mtd-user.h
@@ -1,5 +1,20 @@
1/* 1/*
2 * MTD ABI header for use by user space only. 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
3 */ 18 */
4 19
5#ifndef __MTD_USER_H__ 20#ifndef __MTD_USER_H__
diff --git a/include/mtd/nftl-user.h b/include/mtd/nftl-user.h
index 98e9e57f22de..bdeabd86ad99 100644
--- a/include/mtd/nftl-user.h
+++ b/include/mtd/nftl-user.h
@@ -1,5 +1,19 @@
1/* 1/*
2 * Parts of NFTL headers shared with userspace 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3 * 17 *
4 */ 18 */
5 19
diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h
index 466a8320f1e6..c0d47ad4b103 100644
--- a/include/mtd/ubi-user.h
+++ b/include/mtd/ubi-user.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) International Business Machines Corp., 2006 2 * Copyright © International Business Machines Corp., 2006
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 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 5 * it under the terms of the GNU General Public License as published by
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index 156c26bb8bd7..a8de812ccbc8 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -88,8 +88,16 @@ do { \
88 * enum p9_msg_t - 9P message types 88 * enum p9_msg_t - 9P message types
89 * @P9_TSTATFS: file system status request 89 * @P9_TSTATFS: file system status request
90 * @P9_RSTATFS: file system status response 90 * @P9_RSTATFS: file system status response
91 * @P9_TSYMLINK: make symlink request
92 * @P9_RSYMLINK: make symlink response
93 * @P9_TMKNOD: create a special file object request
94 * @P9_RMKNOD: create a special file object response
95 * @P9_TLCREATE: prepare a handle for I/O on an new file for 9P2000.L
96 * @P9_RLCREATE: response with file access information for 9P2000.L
91 * @P9_TRENAME: rename request 97 * @P9_TRENAME: rename request
92 * @P9_RRENAME: rename response 98 * @P9_RRENAME: rename response
99 * @P9_TMKDIR: create a directory request
100 * @P9_RMKDIR: create a directory response
93 * @P9_TVERSION: version handshake request 101 * @P9_TVERSION: version handshake request
94 * @P9_RVERSION: version handshake response 102 * @P9_RVERSION: version handshake response
95 * @P9_TAUTH: request to establish authentication channel 103 * @P9_TAUTH: request to establish authentication channel
@@ -131,8 +139,30 @@ do { \
131enum p9_msg_t { 139enum p9_msg_t {
132 P9_TSTATFS = 8, 140 P9_TSTATFS = 8,
133 P9_RSTATFS, 141 P9_RSTATFS,
142 P9_TLOPEN = 12,
143 P9_RLOPEN,
144 P9_TLCREATE = 14,
145 P9_RLCREATE,
146 P9_TSYMLINK = 16,
147 P9_RSYMLINK,
148 P9_TMKNOD = 18,
149 P9_RMKNOD,
134 P9_TRENAME = 20, 150 P9_TRENAME = 20,
135 P9_RRENAME, 151 P9_RRENAME,
152 P9_TGETATTR = 24,
153 P9_RGETATTR,
154 P9_TSETATTR = 26,
155 P9_RSETATTR,
156 P9_TXATTRWALK = 30,
157 P9_RXATTRWALK,
158 P9_TXATTRCREATE = 32,
159 P9_RXATTRCREATE,
160 P9_TREADDIR = 40,
161 P9_RREADDIR,
162 P9_TLINK = 70,
163 P9_RLINK,
164 P9_TMKDIR = 72,
165 P9_RMKDIR,
136 P9_TVERSION = 100, 166 P9_TVERSION = 100,
137 P9_RVERSION, 167 P9_RVERSION,
138 P9_TAUTH = 102, 168 P9_TAUTH = 102,
@@ -275,6 +305,9 @@ enum p9_qid_t {
275/* ample room for Twrite/Rread header */ 305/* ample room for Twrite/Rread header */
276#define P9_IOHDRSZ 24 306#define P9_IOHDRSZ 24
277 307
308/* Room for readdir header */
309#define P9_READDIRHDRSZ 24
310
278/** 311/**
279 * struct p9_str - length prefixed string type 312 * struct p9_str - length prefixed string type
280 * @len: length of the string 313 * @len: length of the string
@@ -357,6 +390,74 @@ struct p9_wstat {
357 u32 n_muid; /* 9p2000.u extensions */ 390 u32 n_muid; /* 9p2000.u extensions */
358}; 391};
359 392
393struct p9_stat_dotl {
394 u64 st_result_mask;
395 struct p9_qid qid;
396 u32 st_mode;
397 u32 st_uid;
398 u32 st_gid;
399 u64 st_nlink;
400 u64 st_rdev;
401 u64 st_size;
402 u64 st_blksize;
403 u64 st_blocks;
404 u64 st_atime_sec;
405 u64 st_atime_nsec;
406 u64 st_mtime_sec;
407 u64 st_mtime_nsec;
408 u64 st_ctime_sec;
409 u64 st_ctime_nsec;
410 u64 st_btime_sec;
411 u64 st_btime_nsec;
412 u64 st_gen;
413 u64 st_data_version;
414};
415
416#define P9_STATS_MODE 0x00000001ULL
417#define P9_STATS_NLINK 0x00000002ULL
418#define P9_STATS_UID 0x00000004ULL
419#define P9_STATS_GID 0x00000008ULL
420#define P9_STATS_RDEV 0x00000010ULL
421#define P9_STATS_ATIME 0x00000020ULL
422#define P9_STATS_MTIME 0x00000040ULL
423#define P9_STATS_CTIME 0x00000080ULL
424#define P9_STATS_INO 0x00000100ULL
425#define P9_STATS_SIZE 0x00000200ULL
426#define P9_STATS_BLOCKS 0x00000400ULL
427
428#define P9_STATS_BTIME 0x00000800ULL
429#define P9_STATS_GEN 0x00001000ULL
430#define P9_STATS_DATA_VERSION 0x00002000ULL
431
432#define P9_STATS_BASIC 0x000007ffULL /* Mask for fields up to BLOCKS */
433#define P9_STATS_ALL 0x00003fffULL /* Mask for All fields above */
434
435/**
436 * struct p9_iattr_dotl - P9 inode attribute for setattr
437 * @valid: bitfield specifying which fields are valid
438 * same as in struct iattr
439 * @mode: File permission bits
440 * @uid: user id of owner
441 * @gid: group id
442 * @size: File size
443 * @atime_sec: Last access time, seconds
444 * @atime_nsec: Last access time, nanoseconds
445 * @mtime_sec: Last modification time, seconds
446 * @mtime_nsec: Last modification time, nanoseconds
447 */
448
449struct p9_iattr_dotl {
450 u32 valid;
451 u32 mode;
452 u32 uid;
453 u32 gid;
454 u64 size;
455 u64 atime_sec;
456 u64 atime_nsec;
457 u64 mtime_sec;
458 u64 mtime_nsec;
459};
460
360/* Structures for Protocol Operations */ 461/* Structures for Protocol Operations */
361struct p9_tstatfs { 462struct p9_tstatfs {
362 u32 fid; 463 u32 fid;
@@ -485,6 +586,18 @@ struct p9_rwrite {
485 u32 count; 586 u32 count;
486}; 587};
487 588
589struct p9_treaddir {
590 u32 fid;
591 u64 offset;
592 u32 count;
593};
594
595struct p9_rreaddir {
596 u32 count;
597 u8 *data;
598};
599
600
488struct p9_tclunk { 601struct p9_tclunk {
489 u32 fid; 602 u32 fid;
490}; 603};
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index 7dd3ed85c782..d1aa2cfb30f0 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -195,6 +195,21 @@ struct p9_fid {
195 struct list_head dlist; /* list of all fids attached to a dentry */ 195 struct list_head dlist; /* list of all fids attached to a dentry */
196}; 196};
197 197
198/**
199 * struct p9_dirent - directory entry structure
200 * @qid: The p9 server qid for this dirent
201 * @d_off: offset to the next dirent
202 * @d_type: type of file
203 * @d_name: file name
204 */
205
206struct p9_dirent {
207 struct p9_qid qid;
208 u64 d_off;
209 unsigned char d_type;
210 char d_name[256];
211};
212
198int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb); 213int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb);
199int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name); 214int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name);
200int p9_client_version(struct p9_client *); 215int p9_client_version(struct p9_client *);
@@ -211,15 +226,31 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames,
211int p9_client_open(struct p9_fid *fid, int mode); 226int p9_client_open(struct p9_fid *fid, int mode);
212int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode, 227int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode,
213 char *extension); 228 char *extension);
229int p9_client_link(struct p9_fid *fid, struct p9_fid *oldfid, char *newname);
230int p9_client_symlink(struct p9_fid *fid, char *name, char *symname, gid_t gid,
231 struct p9_qid *qid);
232int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode,
233 gid_t gid, struct p9_qid *qid);
214int p9_client_clunk(struct p9_fid *fid); 234int p9_client_clunk(struct p9_fid *fid);
215int p9_client_remove(struct p9_fid *fid); 235int p9_client_remove(struct p9_fid *fid);
216int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, 236int p9_client_read(struct p9_fid *fid, char *data, char __user *udata,
217 u64 offset, u32 count); 237 u64 offset, u32 count);
218int p9_client_write(struct p9_fid *fid, char *data, const char __user *udata, 238int p9_client_write(struct p9_fid *fid, char *data, const char __user *udata,
219 u64 offset, u32 count); 239 u64 offset, u32 count);
240int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset);
241int p9dirent_read(char *buf, int len, struct p9_dirent *dirent,
242 int proto_version);
220struct p9_wstat *p9_client_stat(struct p9_fid *fid); 243struct p9_wstat *p9_client_stat(struct p9_fid *fid);
221int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst); 244int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst);
245int p9_client_setattr(struct p9_fid *fid, struct p9_iattr_dotl *attr);
246
247struct p9_stat_dotl *p9_client_getattr_dotl(struct p9_fid *fid,
248 u64 request_mask);
222 249
250int p9_client_mknod_dotl(struct p9_fid *oldfid, char *name, int mode,
251 dev_t rdev, gid_t gid, struct p9_qid *);
252int p9_client_mkdir_dotl(struct p9_fid *fid, char *name, int mode,
253 gid_t gid, struct p9_qid *);
223struct p9_req_t *p9_tag_lookup(struct p9_client *, u16); 254struct p9_req_t *p9_tag_lookup(struct p9_client *, u16);
224void p9_client_cb(struct p9_client *c, struct p9_req_t *req); 255void p9_client_cb(struct p9_client *c, struct p9_req_t *req);
225 256
@@ -229,5 +260,7 @@ void p9stat_free(struct p9_wstat *);
229 260
230int p9_is_proto_dotu(struct p9_client *clnt); 261int p9_is_proto_dotu(struct p9_client *clnt);
231int p9_is_proto_dotl(struct p9_client *clnt); 262int p9_is_proto_dotl(struct p9_client *clnt);
263struct p9_fid *p9_client_xattrwalk(struct p9_fid *, const char *, u64 *);
264int p9_client_xattrcreate(struct p9_fid *, const char *, u64, int);
232 265
233#endif /* NET_9P_CLIENT_H */ 266#endif /* NET_9P_CLIENT_H */
diff --git a/include/net/act_api.h b/include/net/act_api.h
index c05fd717c588..bab385f13ac3 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -20,6 +20,7 @@ struct tcf_common {
20 struct gnet_stats_queue tcfc_qstats; 20 struct gnet_stats_queue tcfc_qstats;
21 struct gnet_stats_rate_est tcfc_rate_est; 21 struct gnet_stats_rate_est tcfc_rate_est;
22 spinlock_t tcfc_lock; 22 spinlock_t tcfc_lock;
23 struct rcu_head tcfc_rcu;
23}; 24};
24#define tcf_next common.tcfc_next 25#define tcf_next common.tcfc_next
25#define tcf_index common.tcfc_index 26#define tcf_index common.tcfc_index
@@ -32,6 +33,7 @@ struct tcf_common {
32#define tcf_qstats common.tcfc_qstats 33#define tcf_qstats common.tcfc_qstats
33#define tcf_rate_est common.tcfc_rate_est 34#define tcf_rate_est common.tcfc_rate_est
34#define tcf_lock common.tcfc_lock 35#define tcf_lock common.tcfc_lock
36#define tcf_rcu common.tcfc_rcu
35 37
36struct tcf_police { 38struct tcf_police {
37 struct tcf_common common; 39 struct tcf_common common;
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 20725e213aee..90c9e2872f27 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -23,7 +23,8 @@ struct unix_address {
23}; 23};
24 24
25struct unix_skb_parms { 25struct unix_skb_parms {
26 struct ucred creds; /* Skb credentials */ 26 struct pid *pid; /* Skb credentials */
27 const struct cred *cred;
27 struct scm_fp_list *fp; /* Passed files */ 28 struct scm_fp_list *fp; /* Passed files */
28#ifdef CONFIG_SECURITY_NETWORK 29#ifdef CONFIG_SECURITY_NETWORK
29 u32 secid; /* Security ID */ 30 u32 secid; /* Security ID */
@@ -31,7 +32,6 @@ struct unix_skb_parms {
31}; 32};
32 33
33#define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb)) 34#define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb))
34#define UNIXCREDS(skb) (&UNIXCB((skb)).creds)
35#define UNIXSID(skb) (&UNIXCB((skb)).secid) 35#define UNIXSID(skb) (&UNIXCB((skb)).secid)
36 36
37#define unix_state_lock(s) spin_lock(&unix_sk(s)->lock) 37#define unix_state_lock(s) spin_lock(&unix_sk(s)->lock)
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index ff77e8f882f1..27a902d9b3a9 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -84,7 +84,7 @@ enum {
84/* BD Address */ 84/* BD Address */
85typedef struct { 85typedef struct {
86 __u8 b[6]; 86 __u8 b[6];
87} __attribute__((packed)) bdaddr_t; 87} __packed bdaddr_t;
88 88
89#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) 89#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}})
90#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) 90#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}})
@@ -138,6 +138,7 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
138struct bt_skb_cb { 138struct bt_skb_cb {
139 __u8 pkt_type; 139 __u8 pkt_type;
140 __u8 incoming; 140 __u8 incoming;
141 __u16 expect;
141 __u8 tx_seq; 142 __u8 tx_seq;
142 __u8 retries; 143 __u8 retries;
143 __u8 sar; 144 __u8 sar;
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index fc0c502d9fd1..bcbdd6d4e6dd 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -100,6 +100,9 @@ enum {
100#define HCISETACLMTU _IOW('H', 227, int) 100#define HCISETACLMTU _IOW('H', 227, int)
101#define HCISETSCOMTU _IOW('H', 228, int) 101#define HCISETSCOMTU _IOW('H', 228, int)
102 102
103#define HCIBLOCKADDR _IOW('H', 230, int)
104#define HCIUNBLOCKADDR _IOW('H', 231, int)
105
103#define HCIINQUIRY _IOR('H', 240, int) 106#define HCIINQUIRY _IOR('H', 240, int)
104 107
105/* HCI timeouts */ 108/* HCI timeouts */
@@ -227,7 +230,7 @@ struct hci_cp_inquiry {
227 __u8 lap[3]; 230 __u8 lap[3];
228 __u8 length; 231 __u8 length;
229 __u8 num_rsp; 232 __u8 num_rsp;
230} __attribute__ ((packed)); 233} __packed;
231 234
232#define HCI_OP_INQUIRY_CANCEL 0x0402 235#define HCI_OP_INQUIRY_CANCEL 0x0402
233 236
@@ -241,81 +244,81 @@ struct hci_cp_create_conn {
241 __u8 pscan_mode; 244 __u8 pscan_mode;
242 __le16 clock_offset; 245 __le16 clock_offset;
243 __u8 role_switch; 246 __u8 role_switch;
244} __attribute__ ((packed)); 247} __packed;
245 248
246#define HCI_OP_DISCONNECT 0x0406 249#define HCI_OP_DISCONNECT 0x0406
247struct hci_cp_disconnect { 250struct hci_cp_disconnect {
248 __le16 handle; 251 __le16 handle;
249 __u8 reason; 252 __u8 reason;
250} __attribute__ ((packed)); 253} __packed;
251 254
252#define HCI_OP_ADD_SCO 0x0407 255#define HCI_OP_ADD_SCO 0x0407
253struct hci_cp_add_sco { 256struct hci_cp_add_sco {
254 __le16 handle; 257 __le16 handle;
255 __le16 pkt_type; 258 __le16 pkt_type;
256} __attribute__ ((packed)); 259} __packed;
257 260
258#define HCI_OP_CREATE_CONN_CANCEL 0x0408 261#define HCI_OP_CREATE_CONN_CANCEL 0x0408
259struct hci_cp_create_conn_cancel { 262struct hci_cp_create_conn_cancel {
260 bdaddr_t bdaddr; 263 bdaddr_t bdaddr;
261} __attribute__ ((packed)); 264} __packed;
262 265
263#define HCI_OP_ACCEPT_CONN_REQ 0x0409 266#define HCI_OP_ACCEPT_CONN_REQ 0x0409
264struct hci_cp_accept_conn_req { 267struct hci_cp_accept_conn_req {
265 bdaddr_t bdaddr; 268 bdaddr_t bdaddr;
266 __u8 role; 269 __u8 role;
267} __attribute__ ((packed)); 270} __packed;
268 271
269#define HCI_OP_REJECT_CONN_REQ 0x040a 272#define HCI_OP_REJECT_CONN_REQ 0x040a
270struct hci_cp_reject_conn_req { 273struct hci_cp_reject_conn_req {
271 bdaddr_t bdaddr; 274 bdaddr_t bdaddr;
272 __u8 reason; 275 __u8 reason;
273} __attribute__ ((packed)); 276} __packed;
274 277
275#define HCI_OP_LINK_KEY_REPLY 0x040b 278#define HCI_OP_LINK_KEY_REPLY 0x040b
276struct hci_cp_link_key_reply { 279struct hci_cp_link_key_reply {
277 bdaddr_t bdaddr; 280 bdaddr_t bdaddr;
278 __u8 link_key[16]; 281 __u8 link_key[16];
279} __attribute__ ((packed)); 282} __packed;
280 283
281#define HCI_OP_LINK_KEY_NEG_REPLY 0x040c 284#define HCI_OP_LINK_KEY_NEG_REPLY 0x040c
282struct hci_cp_link_key_neg_reply { 285struct hci_cp_link_key_neg_reply {
283 bdaddr_t bdaddr; 286 bdaddr_t bdaddr;
284} __attribute__ ((packed)); 287} __packed;
285 288
286#define HCI_OP_PIN_CODE_REPLY 0x040d 289#define HCI_OP_PIN_CODE_REPLY 0x040d
287struct hci_cp_pin_code_reply { 290struct hci_cp_pin_code_reply {
288 bdaddr_t bdaddr; 291 bdaddr_t bdaddr;
289 __u8 pin_len; 292 __u8 pin_len;
290 __u8 pin_code[16]; 293 __u8 pin_code[16];
291} __attribute__ ((packed)); 294} __packed;
292 295
293#define HCI_OP_PIN_CODE_NEG_REPLY 0x040e 296#define HCI_OP_PIN_CODE_NEG_REPLY 0x040e
294struct hci_cp_pin_code_neg_reply { 297struct hci_cp_pin_code_neg_reply {
295 bdaddr_t bdaddr; 298 bdaddr_t bdaddr;
296} __attribute__ ((packed)); 299} __packed;
297 300
298#define HCI_OP_CHANGE_CONN_PTYPE 0x040f 301#define HCI_OP_CHANGE_CONN_PTYPE 0x040f
299struct hci_cp_change_conn_ptype { 302struct hci_cp_change_conn_ptype {
300 __le16 handle; 303 __le16 handle;
301 __le16 pkt_type; 304 __le16 pkt_type;
302} __attribute__ ((packed)); 305} __packed;
303 306
304#define HCI_OP_AUTH_REQUESTED 0x0411 307#define HCI_OP_AUTH_REQUESTED 0x0411
305struct hci_cp_auth_requested { 308struct hci_cp_auth_requested {
306 __le16 handle; 309 __le16 handle;
307} __attribute__ ((packed)); 310} __packed;
308 311
309#define HCI_OP_SET_CONN_ENCRYPT 0x0413 312#define HCI_OP_SET_CONN_ENCRYPT 0x0413
310struct hci_cp_set_conn_encrypt { 313struct hci_cp_set_conn_encrypt {
311 __le16 handle; 314 __le16 handle;
312 __u8 encrypt; 315 __u8 encrypt;
313} __attribute__ ((packed)); 316} __packed;
314 317
315#define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415 318#define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415
316struct hci_cp_change_conn_link_key { 319struct hci_cp_change_conn_link_key {
317 __le16 handle; 320 __le16 handle;
318} __attribute__ ((packed)); 321} __packed;
319 322
320#define HCI_OP_REMOTE_NAME_REQ 0x0419 323#define HCI_OP_REMOTE_NAME_REQ 0x0419
321struct hci_cp_remote_name_req { 324struct hci_cp_remote_name_req {
@@ -323,28 +326,28 @@ struct hci_cp_remote_name_req {
323 __u8 pscan_rep_mode; 326 __u8 pscan_rep_mode;
324 __u8 pscan_mode; 327 __u8 pscan_mode;
325 __le16 clock_offset; 328 __le16 clock_offset;
326} __attribute__ ((packed)); 329} __packed;
327 330
328#define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a 331#define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a
329struct hci_cp_remote_name_req_cancel { 332struct hci_cp_remote_name_req_cancel {
330 bdaddr_t bdaddr; 333 bdaddr_t bdaddr;
331} __attribute__ ((packed)); 334} __packed;
332 335
333#define HCI_OP_READ_REMOTE_FEATURES 0x041b 336#define HCI_OP_READ_REMOTE_FEATURES 0x041b
334struct hci_cp_read_remote_features { 337struct hci_cp_read_remote_features {
335 __le16 handle; 338 __le16 handle;
336} __attribute__ ((packed)); 339} __packed;
337 340
338#define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c 341#define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c
339struct hci_cp_read_remote_ext_features { 342struct hci_cp_read_remote_ext_features {
340 __le16 handle; 343 __le16 handle;
341 __u8 page; 344 __u8 page;
342} __attribute__ ((packed)); 345} __packed;
343 346
344#define HCI_OP_READ_REMOTE_VERSION 0x041d 347#define HCI_OP_READ_REMOTE_VERSION 0x041d
345struct hci_cp_read_remote_version { 348struct hci_cp_read_remote_version {
346 __le16 handle; 349 __le16 handle;
347} __attribute__ ((packed)); 350} __packed;
348 351
349#define HCI_OP_SETUP_SYNC_CONN 0x0428 352#define HCI_OP_SETUP_SYNC_CONN 0x0428
350struct hci_cp_setup_sync_conn { 353struct hci_cp_setup_sync_conn {
@@ -355,7 +358,7 @@ struct hci_cp_setup_sync_conn {
355 __le16 voice_setting; 358 __le16 voice_setting;
356 __u8 retrans_effort; 359 __u8 retrans_effort;
357 __le16 pkt_type; 360 __le16 pkt_type;
358} __attribute__ ((packed)); 361} __packed;
359 362
360#define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429 363#define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429
361struct hci_cp_accept_sync_conn_req { 364struct hci_cp_accept_sync_conn_req {
@@ -366,13 +369,13 @@ struct hci_cp_accept_sync_conn_req {
366 __le16 content_format; 369 __le16 content_format;
367 __u8 retrans_effort; 370 __u8 retrans_effort;
368 __le16 pkt_type; 371 __le16 pkt_type;
369} __attribute__ ((packed)); 372} __packed;
370 373
371#define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a 374#define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a
372struct hci_cp_reject_sync_conn_req { 375struct hci_cp_reject_sync_conn_req {
373 bdaddr_t bdaddr; 376 bdaddr_t bdaddr;
374 __u8 reason; 377 __u8 reason;
375} __attribute__ ((packed)); 378} __packed;
376 379
377#define HCI_OP_SNIFF_MODE 0x0803 380#define HCI_OP_SNIFF_MODE 0x0803
378struct hci_cp_sniff_mode { 381struct hci_cp_sniff_mode {
@@ -381,59 +384,59 @@ struct hci_cp_sniff_mode {
381 __le16 min_interval; 384 __le16 min_interval;
382 __le16 attempt; 385 __le16 attempt;
383 __le16 timeout; 386 __le16 timeout;
384} __attribute__ ((packed)); 387} __packed;
385 388
386#define HCI_OP_EXIT_SNIFF_MODE 0x0804 389#define HCI_OP_EXIT_SNIFF_MODE 0x0804
387struct hci_cp_exit_sniff_mode { 390struct hci_cp_exit_sniff_mode {
388 __le16 handle; 391 __le16 handle;
389} __attribute__ ((packed)); 392} __packed;
390 393
391#define HCI_OP_ROLE_DISCOVERY 0x0809 394#define HCI_OP_ROLE_DISCOVERY 0x0809
392struct hci_cp_role_discovery { 395struct hci_cp_role_discovery {
393 __le16 handle; 396 __le16 handle;
394} __attribute__ ((packed)); 397} __packed;
395struct hci_rp_role_discovery { 398struct hci_rp_role_discovery {
396 __u8 status; 399 __u8 status;
397 __le16 handle; 400 __le16 handle;
398 __u8 role; 401 __u8 role;
399} __attribute__ ((packed)); 402} __packed;
400 403
401#define HCI_OP_SWITCH_ROLE 0x080b 404#define HCI_OP_SWITCH_ROLE 0x080b
402struct hci_cp_switch_role { 405struct hci_cp_switch_role {
403 bdaddr_t bdaddr; 406 bdaddr_t bdaddr;
404 __u8 role; 407 __u8 role;
405} __attribute__ ((packed)); 408} __packed;
406 409
407#define HCI_OP_READ_LINK_POLICY 0x080c 410#define HCI_OP_READ_LINK_POLICY 0x080c
408struct hci_cp_read_link_policy { 411struct hci_cp_read_link_policy {
409 __le16 handle; 412 __le16 handle;
410} __attribute__ ((packed)); 413} __packed;
411struct hci_rp_read_link_policy { 414struct hci_rp_read_link_policy {
412 __u8 status; 415 __u8 status;
413 __le16 handle; 416 __le16 handle;
414 __le16 policy; 417 __le16 policy;
415} __attribute__ ((packed)); 418} __packed;
416 419
417#define HCI_OP_WRITE_LINK_POLICY 0x080d 420#define HCI_OP_WRITE_LINK_POLICY 0x080d
418struct hci_cp_write_link_policy { 421struct hci_cp_write_link_policy {
419 __le16 handle; 422 __le16 handle;
420 __le16 policy; 423 __le16 policy;
421} __attribute__ ((packed)); 424} __packed;
422struct hci_rp_write_link_policy { 425struct hci_rp_write_link_policy {
423 __u8 status; 426 __u8 status;
424 __le16 handle; 427 __le16 handle;
425} __attribute__ ((packed)); 428} __packed;
426 429
427#define HCI_OP_READ_DEF_LINK_POLICY 0x080e 430#define HCI_OP_READ_DEF_LINK_POLICY 0x080e
428struct hci_rp_read_def_link_policy { 431struct hci_rp_read_def_link_policy {
429 __u8 status; 432 __u8 status;
430 __le16 policy; 433 __le16 policy;
431} __attribute__ ((packed)); 434} __packed;
432 435
433#define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f 436#define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f
434struct hci_cp_write_def_link_policy { 437struct hci_cp_write_def_link_policy {
435 __le16 policy; 438 __le16 policy;
436} __attribute__ ((packed)); 439} __packed;
437 440
438#define HCI_OP_SNIFF_SUBRATE 0x0811 441#define HCI_OP_SNIFF_SUBRATE 0x0811
439struct hci_cp_sniff_subrate { 442struct hci_cp_sniff_subrate {
@@ -441,12 +444,12 @@ struct hci_cp_sniff_subrate {
441 __le16 max_latency; 444 __le16 max_latency;
442 __le16 min_remote_timeout; 445 __le16 min_remote_timeout;
443 __le16 min_local_timeout; 446 __le16 min_local_timeout;
444} __attribute__ ((packed)); 447} __packed;
445 448
446#define HCI_OP_SET_EVENT_MASK 0x0c01 449#define HCI_OP_SET_EVENT_MASK 0x0c01
447struct hci_cp_set_event_mask { 450struct hci_cp_set_event_mask {
448 __u8 mask[8]; 451 __u8 mask[8];
449} __attribute__ ((packed)); 452} __packed;
450 453
451#define HCI_OP_RESET 0x0c03 454#define HCI_OP_RESET 0x0c03
452 455
@@ -455,7 +458,7 @@ struct hci_cp_set_event_flt {
455 __u8 flt_type; 458 __u8 flt_type;
456 __u8 cond_type; 459 __u8 cond_type;
457 __u8 condition[0]; 460 __u8 condition[0];
458} __attribute__ ((packed)); 461} __packed;
459 462
460/* Filter types */ 463/* Filter types */
461#define HCI_FLT_CLEAR_ALL 0x00 464#define HCI_FLT_CLEAR_ALL 0x00
@@ -474,13 +477,13 @@ struct hci_cp_set_event_flt {
474#define HCI_OP_WRITE_LOCAL_NAME 0x0c13 477#define HCI_OP_WRITE_LOCAL_NAME 0x0c13
475struct hci_cp_write_local_name { 478struct hci_cp_write_local_name {
476 __u8 name[248]; 479 __u8 name[248];
477} __attribute__ ((packed)); 480} __packed;
478 481
479#define HCI_OP_READ_LOCAL_NAME 0x0c14 482#define HCI_OP_READ_LOCAL_NAME 0x0c14
480struct hci_rp_read_local_name { 483struct hci_rp_read_local_name {
481 __u8 status; 484 __u8 status;
482 __u8 name[248]; 485 __u8 name[248];
483} __attribute__ ((packed)); 486} __packed;
484 487
485#define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 488#define HCI_OP_WRITE_CA_TIMEOUT 0x0c16
486 489
@@ -508,23 +511,23 @@ struct hci_rp_read_local_name {
508struct hci_rp_read_class_of_dev { 511struct hci_rp_read_class_of_dev {
509 __u8 status; 512 __u8 status;
510 __u8 dev_class[3]; 513 __u8 dev_class[3];
511} __attribute__ ((packed)); 514} __packed;
512 515
513#define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24 516#define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24
514struct hci_cp_write_class_of_dev { 517struct hci_cp_write_class_of_dev {
515 __u8 dev_class[3]; 518 __u8 dev_class[3];
516} __attribute__ ((packed)); 519} __packed;
517 520
518#define HCI_OP_READ_VOICE_SETTING 0x0c25 521#define HCI_OP_READ_VOICE_SETTING 0x0c25
519struct hci_rp_read_voice_setting { 522struct hci_rp_read_voice_setting {
520 __u8 status; 523 __u8 status;
521 __le16 voice_setting; 524 __le16 voice_setting;
522} __attribute__ ((packed)); 525} __packed;
523 526
524#define HCI_OP_WRITE_VOICE_SETTING 0x0c26 527#define HCI_OP_WRITE_VOICE_SETTING 0x0c26
525struct hci_cp_write_voice_setting { 528struct hci_cp_write_voice_setting {
526 __le16 voice_setting; 529 __le16 voice_setting;
527} __attribute__ ((packed)); 530} __packed;
528 531
529#define HCI_OP_HOST_BUFFER_SIZE 0x0c33 532#define HCI_OP_HOST_BUFFER_SIZE 0x0c33
530struct hci_cp_host_buffer_size { 533struct hci_cp_host_buffer_size {
@@ -532,18 +535,18 @@ struct hci_cp_host_buffer_size {
532 __u8 sco_mtu; 535 __u8 sco_mtu;
533 __le16 acl_max_pkt; 536 __le16 acl_max_pkt;
534 __le16 sco_max_pkt; 537 __le16 sco_max_pkt;
535} __attribute__ ((packed)); 538} __packed;
536 539
537#define HCI_OP_READ_SSP_MODE 0x0c55 540#define HCI_OP_READ_SSP_MODE 0x0c55
538struct hci_rp_read_ssp_mode { 541struct hci_rp_read_ssp_mode {
539 __u8 status; 542 __u8 status;
540 __u8 mode; 543 __u8 mode;
541} __attribute__ ((packed)); 544} __packed;
542 545
543#define HCI_OP_WRITE_SSP_MODE 0x0c56 546#define HCI_OP_WRITE_SSP_MODE 0x0c56
544struct hci_cp_write_ssp_mode { 547struct hci_cp_write_ssp_mode {
545 __u8 mode; 548 __u8 mode;
546} __attribute__ ((packed)); 549} __packed;
547 550
548#define HCI_OP_READ_LOCAL_VERSION 0x1001 551#define HCI_OP_READ_LOCAL_VERSION 0x1001
549struct hci_rp_read_local_version { 552struct hci_rp_read_local_version {
@@ -553,19 +556,19 @@ struct hci_rp_read_local_version {
553 __u8 lmp_ver; 556 __u8 lmp_ver;
554 __le16 manufacturer; 557 __le16 manufacturer;
555 __le16 lmp_subver; 558 __le16 lmp_subver;
556} __attribute__ ((packed)); 559} __packed;
557 560
558#define HCI_OP_READ_LOCAL_COMMANDS 0x1002 561#define HCI_OP_READ_LOCAL_COMMANDS 0x1002
559struct hci_rp_read_local_commands { 562struct hci_rp_read_local_commands {
560 __u8 status; 563 __u8 status;
561 __u8 commands[64]; 564 __u8 commands[64];
562} __attribute__ ((packed)); 565} __packed;
563 566
564#define HCI_OP_READ_LOCAL_FEATURES 0x1003 567#define HCI_OP_READ_LOCAL_FEATURES 0x1003
565struct hci_rp_read_local_features { 568struct hci_rp_read_local_features {
566 __u8 status; 569 __u8 status;
567 __u8 features[8]; 570 __u8 features[8];
568} __attribute__ ((packed)); 571} __packed;
569 572
570#define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 573#define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004
571struct hci_rp_read_local_ext_features { 574struct hci_rp_read_local_ext_features {
@@ -573,7 +576,7 @@ struct hci_rp_read_local_ext_features {
573 __u8 page; 576 __u8 page;
574 __u8 max_page; 577 __u8 max_page;
575 __u8 features[8]; 578 __u8 features[8];
576} __attribute__ ((packed)); 579} __packed;
577 580
578#define HCI_OP_READ_BUFFER_SIZE 0x1005 581#define HCI_OP_READ_BUFFER_SIZE 0x1005
579struct hci_rp_read_buffer_size { 582struct hci_rp_read_buffer_size {
@@ -582,13 +585,13 @@ struct hci_rp_read_buffer_size {
582 __u8 sco_mtu; 585 __u8 sco_mtu;
583 __le16 acl_max_pkt; 586 __le16 acl_max_pkt;
584 __le16 sco_max_pkt; 587 __le16 sco_max_pkt;
585} __attribute__ ((packed)); 588} __packed;
586 589
587#define HCI_OP_READ_BD_ADDR 0x1009 590#define HCI_OP_READ_BD_ADDR 0x1009
588struct hci_rp_read_bd_addr { 591struct hci_rp_read_bd_addr {
589 __u8 status; 592 __u8 status;
590 bdaddr_t bdaddr; 593 bdaddr_t bdaddr;
591} __attribute__ ((packed)); 594} __packed;
592 595
593/* ---- HCI Events ---- */ 596/* ---- HCI Events ---- */
594#define HCI_EV_INQUIRY_COMPLETE 0x01 597#define HCI_EV_INQUIRY_COMPLETE 0x01
@@ -601,7 +604,7 @@ struct inquiry_info {
601 __u8 pscan_mode; 604 __u8 pscan_mode;
602 __u8 dev_class[3]; 605 __u8 dev_class[3];
603 __le16 clock_offset; 606 __le16 clock_offset;
604} __attribute__ ((packed)); 607} __packed;
605 608
606#define HCI_EV_CONN_COMPLETE 0x03 609#define HCI_EV_CONN_COMPLETE 0x03
607struct hci_ev_conn_complete { 610struct hci_ev_conn_complete {
@@ -610,54 +613,54 @@ struct hci_ev_conn_complete {
610 bdaddr_t bdaddr; 613 bdaddr_t bdaddr;
611 __u8 link_type; 614 __u8 link_type;
612 __u8 encr_mode; 615 __u8 encr_mode;
613} __attribute__ ((packed)); 616} __packed;
614 617
615#define HCI_EV_CONN_REQUEST 0x04 618#define HCI_EV_CONN_REQUEST 0x04
616struct hci_ev_conn_request { 619struct hci_ev_conn_request {
617 bdaddr_t bdaddr; 620 bdaddr_t bdaddr;
618 __u8 dev_class[3]; 621 __u8 dev_class[3];
619 __u8 link_type; 622 __u8 link_type;
620} __attribute__ ((packed)); 623} __packed;
621 624
622#define HCI_EV_DISCONN_COMPLETE 0x05 625#define HCI_EV_DISCONN_COMPLETE 0x05
623struct hci_ev_disconn_complete { 626struct hci_ev_disconn_complete {
624 __u8 status; 627 __u8 status;
625 __le16 handle; 628 __le16 handle;
626 __u8 reason; 629 __u8 reason;
627} __attribute__ ((packed)); 630} __packed;
628 631
629#define HCI_EV_AUTH_COMPLETE 0x06 632#define HCI_EV_AUTH_COMPLETE 0x06
630struct hci_ev_auth_complete { 633struct hci_ev_auth_complete {
631 __u8 status; 634 __u8 status;
632 __le16 handle; 635 __le16 handle;
633} __attribute__ ((packed)); 636} __packed;
634 637
635#define HCI_EV_REMOTE_NAME 0x07 638#define HCI_EV_REMOTE_NAME 0x07
636struct hci_ev_remote_name { 639struct hci_ev_remote_name {
637 __u8 status; 640 __u8 status;
638 bdaddr_t bdaddr; 641 bdaddr_t bdaddr;
639 __u8 name[248]; 642 __u8 name[248];
640} __attribute__ ((packed)); 643} __packed;
641 644
642#define HCI_EV_ENCRYPT_CHANGE 0x08 645#define HCI_EV_ENCRYPT_CHANGE 0x08
643struct hci_ev_encrypt_change { 646struct hci_ev_encrypt_change {
644 __u8 status; 647 __u8 status;
645 __le16 handle; 648 __le16 handle;
646 __u8 encrypt; 649 __u8 encrypt;
647} __attribute__ ((packed)); 650} __packed;
648 651
649#define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09 652#define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09
650struct hci_ev_change_link_key_complete { 653struct hci_ev_change_link_key_complete {
651 __u8 status; 654 __u8 status;
652 __le16 handle; 655 __le16 handle;
653} __attribute__ ((packed)); 656} __packed;
654 657
655#define HCI_EV_REMOTE_FEATURES 0x0b 658#define HCI_EV_REMOTE_FEATURES 0x0b
656struct hci_ev_remote_features { 659struct hci_ev_remote_features {
657 __u8 status; 660 __u8 status;
658 __le16 handle; 661 __le16 handle;
659 __u8 features[8]; 662 __u8 features[8];
660} __attribute__ ((packed)); 663} __packed;
661 664
662#define HCI_EV_REMOTE_VERSION 0x0c 665#define HCI_EV_REMOTE_VERSION 0x0c
663struct hci_ev_remote_version { 666struct hci_ev_remote_version {
@@ -666,7 +669,7 @@ struct hci_ev_remote_version {
666 __u8 lmp_ver; 669 __u8 lmp_ver;
667 __le16 manufacturer; 670 __le16 manufacturer;
668 __le16 lmp_subver; 671 __le16 lmp_subver;
669} __attribute__ ((packed)); 672} __packed;
670 673
671#define HCI_EV_QOS_SETUP_COMPLETE 0x0d 674#define HCI_EV_QOS_SETUP_COMPLETE 0x0d
672struct hci_qos { 675struct hci_qos {
@@ -675,38 +678,38 @@ struct hci_qos {
675 __u32 peak_bandwidth; 678 __u32 peak_bandwidth;
676 __u32 latency; 679 __u32 latency;
677 __u32 delay_variation; 680 __u32 delay_variation;
678} __attribute__ ((packed)); 681} __packed;
679struct hci_ev_qos_setup_complete { 682struct hci_ev_qos_setup_complete {
680 __u8 status; 683 __u8 status;
681 __le16 handle; 684 __le16 handle;
682 struct hci_qos qos; 685 struct hci_qos qos;
683} __attribute__ ((packed)); 686} __packed;
684 687
685#define HCI_EV_CMD_COMPLETE 0x0e 688#define HCI_EV_CMD_COMPLETE 0x0e
686struct hci_ev_cmd_complete { 689struct hci_ev_cmd_complete {
687 __u8 ncmd; 690 __u8 ncmd;
688 __le16 opcode; 691 __le16 opcode;
689} __attribute__ ((packed)); 692} __packed;
690 693
691#define HCI_EV_CMD_STATUS 0x0f 694#define HCI_EV_CMD_STATUS 0x0f
692struct hci_ev_cmd_status { 695struct hci_ev_cmd_status {
693 __u8 status; 696 __u8 status;
694 __u8 ncmd; 697 __u8 ncmd;
695 __le16 opcode; 698 __le16 opcode;
696} __attribute__ ((packed)); 699} __packed;
697 700
698#define HCI_EV_ROLE_CHANGE 0x12 701#define HCI_EV_ROLE_CHANGE 0x12
699struct hci_ev_role_change { 702struct hci_ev_role_change {
700 __u8 status; 703 __u8 status;
701 bdaddr_t bdaddr; 704 bdaddr_t bdaddr;
702 __u8 role; 705 __u8 role;
703} __attribute__ ((packed)); 706} __packed;
704 707
705#define HCI_EV_NUM_COMP_PKTS 0x13 708#define HCI_EV_NUM_COMP_PKTS 0x13
706struct hci_ev_num_comp_pkts { 709struct hci_ev_num_comp_pkts {
707 __u8 num_hndl; 710 __u8 num_hndl;
708 /* variable length part */ 711 /* variable length part */
709} __attribute__ ((packed)); 712} __packed;
710 713
711#define HCI_EV_MODE_CHANGE 0x14 714#define HCI_EV_MODE_CHANGE 0x14
712struct hci_ev_mode_change { 715struct hci_ev_mode_change {
@@ -714,44 +717,44 @@ struct hci_ev_mode_change {
714 __le16 handle; 717 __le16 handle;
715 __u8 mode; 718 __u8 mode;
716 __le16 interval; 719 __le16 interval;
717} __attribute__ ((packed)); 720} __packed;
718 721
719#define HCI_EV_PIN_CODE_REQ 0x16 722#define HCI_EV_PIN_CODE_REQ 0x16
720struct hci_ev_pin_code_req { 723struct hci_ev_pin_code_req {
721 bdaddr_t bdaddr; 724 bdaddr_t bdaddr;
722} __attribute__ ((packed)); 725} __packed;
723 726
724#define HCI_EV_LINK_KEY_REQ 0x17 727#define HCI_EV_LINK_KEY_REQ 0x17
725struct hci_ev_link_key_req { 728struct hci_ev_link_key_req {
726 bdaddr_t bdaddr; 729 bdaddr_t bdaddr;
727} __attribute__ ((packed)); 730} __packed;
728 731
729#define HCI_EV_LINK_KEY_NOTIFY 0x18 732#define HCI_EV_LINK_KEY_NOTIFY 0x18
730struct hci_ev_link_key_notify { 733struct hci_ev_link_key_notify {
731 bdaddr_t bdaddr; 734 bdaddr_t bdaddr;
732 __u8 link_key[16]; 735 __u8 link_key[16];
733 __u8 key_type; 736 __u8 key_type;
734} __attribute__ ((packed)); 737} __packed;
735 738
736#define HCI_EV_CLOCK_OFFSET 0x1c 739#define HCI_EV_CLOCK_OFFSET 0x1c
737struct hci_ev_clock_offset { 740struct hci_ev_clock_offset {
738 __u8 status; 741 __u8 status;
739 __le16 handle; 742 __le16 handle;
740 __le16 clock_offset; 743 __le16 clock_offset;
741} __attribute__ ((packed)); 744} __packed;
742 745
743#define HCI_EV_PKT_TYPE_CHANGE 0x1d 746#define HCI_EV_PKT_TYPE_CHANGE 0x1d
744struct hci_ev_pkt_type_change { 747struct hci_ev_pkt_type_change {
745 __u8 status; 748 __u8 status;
746 __le16 handle; 749 __le16 handle;
747 __le16 pkt_type; 750 __le16 pkt_type;
748} __attribute__ ((packed)); 751} __packed;
749 752
750#define HCI_EV_PSCAN_REP_MODE 0x20 753#define HCI_EV_PSCAN_REP_MODE 0x20
751struct hci_ev_pscan_rep_mode { 754struct hci_ev_pscan_rep_mode {
752 bdaddr_t bdaddr; 755 bdaddr_t bdaddr;
753 __u8 pscan_rep_mode; 756 __u8 pscan_rep_mode;
754} __attribute__ ((packed)); 757} __packed;
755 758
756#define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 759#define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22
757struct inquiry_info_with_rssi { 760struct inquiry_info_with_rssi {
@@ -761,7 +764,7 @@ struct inquiry_info_with_rssi {
761 __u8 dev_class[3]; 764 __u8 dev_class[3];
762 __le16 clock_offset; 765 __le16 clock_offset;
763 __s8 rssi; 766 __s8 rssi;
764} __attribute__ ((packed)); 767} __packed;
765struct inquiry_info_with_rssi_and_pscan_mode { 768struct inquiry_info_with_rssi_and_pscan_mode {
766 bdaddr_t bdaddr; 769 bdaddr_t bdaddr;
767 __u8 pscan_rep_mode; 770 __u8 pscan_rep_mode;
@@ -770,7 +773,7 @@ struct inquiry_info_with_rssi_and_pscan_mode {
770 __u8 dev_class[3]; 773 __u8 dev_class[3];
771 __le16 clock_offset; 774 __le16 clock_offset;
772 __s8 rssi; 775 __s8 rssi;
773} __attribute__ ((packed)); 776} __packed;
774 777
775#define HCI_EV_REMOTE_EXT_FEATURES 0x23 778#define HCI_EV_REMOTE_EXT_FEATURES 0x23
776struct hci_ev_remote_ext_features { 779struct hci_ev_remote_ext_features {
@@ -779,7 +782,7 @@ struct hci_ev_remote_ext_features {
779 __u8 page; 782 __u8 page;
780 __u8 max_page; 783 __u8 max_page;
781 __u8 features[8]; 784 __u8 features[8];
782} __attribute__ ((packed)); 785} __packed;
783 786
784#define HCI_EV_SYNC_CONN_COMPLETE 0x2c 787#define HCI_EV_SYNC_CONN_COMPLETE 0x2c
785struct hci_ev_sync_conn_complete { 788struct hci_ev_sync_conn_complete {
@@ -792,7 +795,7 @@ struct hci_ev_sync_conn_complete {
792 __le16 rx_pkt_len; 795 __le16 rx_pkt_len;
793 __le16 tx_pkt_len; 796 __le16 tx_pkt_len;
794 __u8 air_mode; 797 __u8 air_mode;
795} __attribute__ ((packed)); 798} __packed;
796 799
797#define HCI_EV_SYNC_CONN_CHANGED 0x2d 800#define HCI_EV_SYNC_CONN_CHANGED 0x2d
798struct hci_ev_sync_conn_changed { 801struct hci_ev_sync_conn_changed {
@@ -802,7 +805,7 @@ struct hci_ev_sync_conn_changed {
802 __u8 retrans_window; 805 __u8 retrans_window;
803 __le16 rx_pkt_len; 806 __le16 rx_pkt_len;
804 __le16 tx_pkt_len; 807 __le16 tx_pkt_len;
805} __attribute__ ((packed)); 808} __packed;
806 809
807#define HCI_EV_SNIFF_SUBRATE 0x2e 810#define HCI_EV_SNIFF_SUBRATE 0x2e
808struct hci_ev_sniff_subrate { 811struct hci_ev_sniff_subrate {
@@ -812,7 +815,7 @@ struct hci_ev_sniff_subrate {
812 __le16 max_rx_latency; 815 __le16 max_rx_latency;
813 __le16 max_remote_timeout; 816 __le16 max_remote_timeout;
814 __le16 max_local_timeout; 817 __le16 max_local_timeout;
815} __attribute__ ((packed)); 818} __packed;
816 819
817#define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f 820#define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f
818struct extended_inquiry_info { 821struct extended_inquiry_info {
@@ -823,37 +826,37 @@ struct extended_inquiry_info {
823 __le16 clock_offset; 826 __le16 clock_offset;
824 __s8 rssi; 827 __s8 rssi;
825 __u8 data[240]; 828 __u8 data[240];
826} __attribute__ ((packed)); 829} __packed;
827 830
828#define HCI_EV_IO_CAPA_REQUEST 0x31 831#define HCI_EV_IO_CAPA_REQUEST 0x31
829struct hci_ev_io_capa_request { 832struct hci_ev_io_capa_request {
830 bdaddr_t bdaddr; 833 bdaddr_t bdaddr;
831} __attribute__ ((packed)); 834} __packed;
832 835
833#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 836#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36
834struct hci_ev_simple_pair_complete { 837struct hci_ev_simple_pair_complete {
835 __u8 status; 838 __u8 status;
836 bdaddr_t bdaddr; 839 bdaddr_t bdaddr;
837} __attribute__ ((packed)); 840} __packed;
838 841
839#define HCI_EV_REMOTE_HOST_FEATURES 0x3d 842#define HCI_EV_REMOTE_HOST_FEATURES 0x3d
840struct hci_ev_remote_host_features { 843struct hci_ev_remote_host_features {
841 bdaddr_t bdaddr; 844 bdaddr_t bdaddr;
842 __u8 features[8]; 845 __u8 features[8];
843} __attribute__ ((packed)); 846} __packed;
844 847
845/* Internal events generated by Bluetooth stack */ 848/* Internal events generated by Bluetooth stack */
846#define HCI_EV_STACK_INTERNAL 0xfd 849#define HCI_EV_STACK_INTERNAL 0xfd
847struct hci_ev_stack_internal { 850struct hci_ev_stack_internal {
848 __u16 type; 851 __u16 type;
849 __u8 data[0]; 852 __u8 data[0];
850} __attribute__ ((packed)); 853} __packed;
851 854
852#define HCI_EV_SI_DEVICE 0x01 855#define HCI_EV_SI_DEVICE 0x01
853struct hci_ev_si_device { 856struct hci_ev_si_device {
854 __u16 event; 857 __u16 event;
855 __u16 dev_id; 858 __u16 dev_id;
856} __attribute__ ((packed)); 859} __packed;
857 860
858#define HCI_EV_SI_SECURITY 0x02 861#define HCI_EV_SI_SECURITY 0x02
859struct hci_ev_si_security { 862struct hci_ev_si_security {
@@ -861,7 +864,7 @@ struct hci_ev_si_security {
861 __u16 proto; 864 __u16 proto;
862 __u16 subproto; 865 __u16 subproto;
863 __u8 incoming; 866 __u8 incoming;
864} __attribute__ ((packed)); 867} __packed;
865 868
866/* ---- HCI Packet structures ---- */ 869/* ---- HCI Packet structures ---- */
867#define HCI_COMMAND_HDR_SIZE 3 870#define HCI_COMMAND_HDR_SIZE 3
@@ -872,22 +875,22 @@ struct hci_ev_si_security {
872struct hci_command_hdr { 875struct hci_command_hdr {
873 __le16 opcode; /* OCF & OGF */ 876 __le16 opcode; /* OCF & OGF */
874 __u8 plen; 877 __u8 plen;
875} __attribute__ ((packed)); 878} __packed;
876 879
877struct hci_event_hdr { 880struct hci_event_hdr {
878 __u8 evt; 881 __u8 evt;
879 __u8 plen; 882 __u8 plen;
880} __attribute__ ((packed)); 883} __packed;
881 884
882struct hci_acl_hdr { 885struct hci_acl_hdr {
883 __le16 handle; /* Handle & Flags(PB, BC) */ 886 __le16 handle; /* Handle & Flags(PB, BC) */
884 __le16 dlen; 887 __le16 dlen;
885} __attribute__ ((packed)); 888} __packed;
886 889
887struct hci_sco_hdr { 890struct hci_sco_hdr {
888 __le16 handle; 891 __le16 handle;
889 __u8 dlen; 892 __u8 dlen;
890} __attribute__ ((packed)); 893} __packed;
891 894
892#ifdef __KERNEL__ 895#ifdef __KERNEL__
893#include <linux/skbuff.h> 896#include <linux/skbuff.h>
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index e42f6ed5421c..4568b938ca35 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1,6 +1,6 @@
1/* 1/*
2 BlueZ - Bluetooth protocol stack for Linux 2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated 3 Copyright (c) 2000-2001, 2010, Code Aurora Forum. All rights reserved.
4 4
5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> 5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
6 6
@@ -12,13 +12,13 @@
12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 19
20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
22 SOFTWARE IS DISCLAIMED. 22 SOFTWARE IS DISCLAIMED.
23*/ 23*/
24 24
@@ -62,6 +62,11 @@ struct hci_conn_hash {
62 unsigned int sco_num; 62 unsigned int sco_num;
63}; 63};
64 64
65struct bdaddr_list {
66 struct list_head list;
67 bdaddr_t bdaddr;
68};
69#define NUM_REASSEMBLY 4
65struct hci_dev { 70struct hci_dev {
66 struct list_head list; 71 struct list_head list;
67 spinlock_t lock; 72 spinlock_t lock;
@@ -118,7 +123,7 @@ struct hci_dev {
118 struct sk_buff_head cmd_q; 123 struct sk_buff_head cmd_q;
119 124
120 struct sk_buff *sent_cmd; 125 struct sk_buff *sent_cmd;
121 struct sk_buff *reassembly[3]; 126 struct sk_buff *reassembly[NUM_REASSEMBLY];
122 127
123 struct mutex req_lock; 128 struct mutex req_lock;
124 wait_queue_head_t req_wait_q; 129 wait_queue_head_t req_wait_q;
@@ -127,6 +132,7 @@ struct hci_dev {
127 132
128 struct inquiry_cache inq_cache; 133 struct inquiry_cache inq_cache;
129 struct hci_conn_hash conn_hash; 134 struct hci_conn_hash conn_hash;
135 struct list_head blacklist;
130 136
131 struct hci_dev_stats stat; 137 struct hci_dev_stats stat;
132 138
@@ -250,6 +256,7 @@ enum {
250 HCI_CONN_ENCRYPT_PEND, 256 HCI_CONN_ENCRYPT_PEND,
251 HCI_CONN_RSWITCH_PEND, 257 HCI_CONN_RSWITCH_PEND,
252 HCI_CONN_MODE_CHANGE_PEND, 258 HCI_CONN_MODE_CHANGE_PEND,
259 HCI_CONN_SCO_SETUP_PEND,
253}; 260};
254 261
255static inline void hci_conn_hash_init(struct hci_dev *hdev) 262static inline void hci_conn_hash_init(struct hci_dev *hdev)
@@ -330,6 +337,7 @@ void hci_acl_connect(struct hci_conn *conn);
330void hci_acl_disconn(struct hci_conn *conn, __u8 reason); 337void hci_acl_disconn(struct hci_conn *conn, __u8 reason);
331void hci_add_sco(struct hci_conn *conn, __u16 handle); 338void hci_add_sco(struct hci_conn *conn, __u16 handle);
332void hci_setup_sync(struct hci_conn *conn, __u16 handle); 339void hci_setup_sync(struct hci_conn *conn, __u16 handle);
340void hci_sco_setup(struct hci_conn *conn, __u8 status);
333 341
334struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst); 342struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst);
335int hci_conn_del(struct hci_conn *conn); 343int hci_conn_del(struct hci_conn *conn);
@@ -380,7 +388,7 @@ static inline void __hci_dev_put(struct hci_dev *d)
380} 388}
381 389
382static inline void hci_dev_put(struct hci_dev *d) 390static inline void hci_dev_put(struct hci_dev *d)
383{ 391{
384 __hci_dev_put(d); 392 __hci_dev_put(d);
385 module_put(d->owner); 393 module_put(d->owner);
386} 394}
@@ -424,10 +432,14 @@ int hci_get_conn_info(struct hci_dev *hdev, void __user *arg);
424int hci_get_auth_info(struct hci_dev *hdev, void __user *arg); 432int hci_get_auth_info(struct hci_dev *hdev, void __user *arg);
425int hci_inquiry(void __user *arg); 433int hci_inquiry(void __user *arg);
426 434
435struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr);
436int hci_blacklist_clear(struct hci_dev *hdev);
437
427void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 438void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
428 439
429int hci_recv_frame(struct sk_buff *skb); 440int hci_recv_frame(struct sk_buff *skb);
430int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count); 441int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count);
442int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count);
431 443
432int hci_register_sysfs(struct hci_dev *hdev); 444int hci_register_sysfs(struct hci_dev *hdev);
433void hci_unregister_sysfs(struct hci_dev *hdev); 445void hci_unregister_sysfs(struct hci_dev *hdev);
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 7c695bfd853c..6c241444f902 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -1,6 +1,8 @@
1/* 1/*
2 BlueZ - Bluetooth protocol stack for Linux 2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated 3 Copyright (C) 2000-2001 Qualcomm Incorporated
4 Copyright (C) 2009-2010 Gustavo F. Padovan <gustavo@padovan.org>
5 Copyright (C) 2010 Google Inc.
4 6
5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> 7 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
6 8
@@ -31,9 +33,9 @@
31#define L2CAP_DEFAULT_FLUSH_TO 0xffff 33#define L2CAP_DEFAULT_FLUSH_TO 0xffff
32#define L2CAP_DEFAULT_TX_WINDOW 63 34#define L2CAP_DEFAULT_TX_WINDOW 63
33#define L2CAP_DEFAULT_MAX_TX 3 35#define L2CAP_DEFAULT_MAX_TX 3
34#define L2CAP_DEFAULT_RETRANS_TO 1000 /* 1 second */ 36#define L2CAP_DEFAULT_RETRANS_TO 2000 /* 2 seconds */
35#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ 37#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */
36#define L2CAP_DEFAULT_MAX_PDU_SIZE 672 38#define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */
37#define L2CAP_DEFAULT_ACK_TO 200 39#define L2CAP_DEFAULT_ACK_TO 200
38#define L2CAP_LOCAL_BUSY_TRIES 12 40#define L2CAP_LOCAL_BUSY_TRIES 12
39 41
@@ -129,31 +131,31 @@ struct l2cap_conninfo {
129struct l2cap_hdr { 131struct l2cap_hdr {
130 __le16 len; 132 __le16 len;
131 __le16 cid; 133 __le16 cid;
132} __attribute__ ((packed)); 134} __packed;
133#define L2CAP_HDR_SIZE 4 135#define L2CAP_HDR_SIZE 4
134 136
135struct l2cap_cmd_hdr { 137struct l2cap_cmd_hdr {
136 __u8 code; 138 __u8 code;
137 __u8 ident; 139 __u8 ident;
138 __le16 len; 140 __le16 len;
139} __attribute__ ((packed)); 141} __packed;
140#define L2CAP_CMD_HDR_SIZE 4 142#define L2CAP_CMD_HDR_SIZE 4
141 143
142struct l2cap_cmd_rej { 144struct l2cap_cmd_rej {
143 __le16 reason; 145 __le16 reason;
144} __attribute__ ((packed)); 146} __packed;
145 147
146struct l2cap_conn_req { 148struct l2cap_conn_req {
147 __le16 psm; 149 __le16 psm;
148 __le16 scid; 150 __le16 scid;
149} __attribute__ ((packed)); 151} __packed;
150 152
151struct l2cap_conn_rsp { 153struct l2cap_conn_rsp {
152 __le16 dcid; 154 __le16 dcid;
153 __le16 scid; 155 __le16 scid;
154 __le16 result; 156 __le16 result;
155 __le16 status; 157 __le16 status;
156} __attribute__ ((packed)); 158} __packed;
157 159
158/* channel indentifier */ 160/* channel indentifier */
159#define L2CAP_CID_SIGNALING 0x0001 161#define L2CAP_CID_SIGNALING 0x0001
@@ -177,14 +179,14 @@ struct l2cap_conf_req {
177 __le16 dcid; 179 __le16 dcid;
178 __le16 flags; 180 __le16 flags;
179 __u8 data[0]; 181 __u8 data[0];
180} __attribute__ ((packed)); 182} __packed;
181 183
182struct l2cap_conf_rsp { 184struct l2cap_conf_rsp {
183 __le16 scid; 185 __le16 scid;
184 __le16 flags; 186 __le16 flags;
185 __le16 result; 187 __le16 result;
186 __u8 data[0]; 188 __u8 data[0];
187} __attribute__ ((packed)); 189} __packed;
188 190
189#define L2CAP_CONF_SUCCESS 0x0000 191#define L2CAP_CONF_SUCCESS 0x0000
190#define L2CAP_CONF_UNACCEPT 0x0001 192#define L2CAP_CONF_UNACCEPT 0x0001
@@ -195,7 +197,7 @@ struct l2cap_conf_opt {
195 __u8 type; 197 __u8 type;
196 __u8 len; 198 __u8 len;
197 __u8 val[0]; 199 __u8 val[0];
198} __attribute__ ((packed)); 200} __packed;
199#define L2CAP_CONF_OPT_SIZE 2 201#define L2CAP_CONF_OPT_SIZE 2
200 202
201#define L2CAP_CONF_HINT 0x80 203#define L2CAP_CONF_HINT 0x80
@@ -216,7 +218,7 @@ struct l2cap_conf_rfc {
216 __le16 retrans_timeout; 218 __le16 retrans_timeout;
217 __le16 monitor_timeout; 219 __le16 monitor_timeout;
218 __le16 max_pdu_size; 220 __le16 max_pdu_size;
219} __attribute__ ((packed)); 221} __packed;
220 222
221#define L2CAP_MODE_BASIC 0x00 223#define L2CAP_MODE_BASIC 0x00
222#define L2CAP_MODE_RETRANS 0x01 224#define L2CAP_MODE_RETRANS 0x01
@@ -227,22 +229,22 @@ struct l2cap_conf_rfc {
227struct l2cap_disconn_req { 229struct l2cap_disconn_req {
228 __le16 dcid; 230 __le16 dcid;
229 __le16 scid; 231 __le16 scid;
230} __attribute__ ((packed)); 232} __packed;
231 233
232struct l2cap_disconn_rsp { 234struct l2cap_disconn_rsp {
233 __le16 dcid; 235 __le16 dcid;
234 __le16 scid; 236 __le16 scid;
235} __attribute__ ((packed)); 237} __packed;
236 238
237struct l2cap_info_req { 239struct l2cap_info_req {
238 __le16 type; 240 __le16 type;
239} __attribute__ ((packed)); 241} __packed;
240 242
241struct l2cap_info_rsp { 243struct l2cap_info_rsp {
242 __le16 type; 244 __le16 type;
243 __le16 result; 245 __le16 result;
244 __u8 data[0]; 246 __u8 data[0];
245} __attribute__ ((packed)); 247} __packed;
246 248
247/* info type */ 249/* info type */
248#define L2CAP_IT_CL_MTU 0x0001 250#define L2CAP_IT_CL_MTU 0x0001
@@ -287,6 +289,11 @@ struct l2cap_conn {
287 struct l2cap_chan_list chan_list; 289 struct l2cap_chan_list chan_list;
288}; 290};
289 291
292struct sock_del_list {
293 struct sock *sk;
294 struct list_head list;
295};
296
290#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 297#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01
291#define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04 298#define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04
292#define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08 299#define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08
@@ -353,7 +360,6 @@ struct l2cap_pinfo {
353 360
354 __le16 sport; 361 __le16 sport;
355 362
356 spinlock_t send_lock;
357 struct timer_list retrans_timer; 363 struct timer_list retrans_timer;
358 struct timer_list monitor_timer; 364 struct timer_list monitor_timer;
359 struct timer_list ack_timer; 365 struct timer_list ack_timer;
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index 921d7b3c7f8d..a140847d622c 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -106,19 +106,19 @@ struct rfcomm_hdr {
106 u8 addr; 106 u8 addr;
107 u8 ctrl; 107 u8 ctrl;
108 u8 len; // Actual size can be 2 bytes 108 u8 len; // Actual size can be 2 bytes
109} __attribute__ ((packed)); 109} __packed;
110 110
111struct rfcomm_cmd { 111struct rfcomm_cmd {
112 u8 addr; 112 u8 addr;
113 u8 ctrl; 113 u8 ctrl;
114 u8 len; 114 u8 len;
115 u8 fcs; 115 u8 fcs;
116} __attribute__ ((packed)); 116} __packed;
117 117
118struct rfcomm_mcc { 118struct rfcomm_mcc {
119 u8 type; 119 u8 type;
120 u8 len; 120 u8 len;
121} __attribute__ ((packed)); 121} __packed;
122 122
123struct rfcomm_pn { 123struct rfcomm_pn {
124 u8 dlci; 124 u8 dlci;
@@ -128,7 +128,7 @@ struct rfcomm_pn {
128 __le16 mtu; 128 __le16 mtu;
129 u8 max_retrans; 129 u8 max_retrans;
130 u8 credits; 130 u8 credits;
131} __attribute__ ((packed)); 131} __packed;
132 132
133struct rfcomm_rpn { 133struct rfcomm_rpn {
134 u8 dlci; 134 u8 dlci;
@@ -138,17 +138,17 @@ struct rfcomm_rpn {
138 u8 xon_char; 138 u8 xon_char;
139 u8 xoff_char; 139 u8 xoff_char;
140 __le16 param_mask; 140 __le16 param_mask;
141} __attribute__ ((packed)); 141} __packed;
142 142
143struct rfcomm_rls { 143struct rfcomm_rls {
144 u8 dlci; 144 u8 dlci;
145 u8 status; 145 u8 status;
146} __attribute__ ((packed)); 146} __packed;
147 147
148struct rfcomm_msc { 148struct rfcomm_msc {
149 u8 dlci; 149 u8 dlci;
150 u8 v24_sig; 150 u8 v24_sig;
151} __attribute__ ((packed)); 151} __packed;
152 152
153/* ---- Core structures, flags etc ---- */ 153/* ---- Core structures, flags etc ---- */
154 154
diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h
index 318ab9478a44..6da573c75d54 100644
--- a/include/net/caif/caif_dev.h
+++ b/include/net/caif/caif_dev.h
@@ -50,6 +50,9 @@ struct caif_connect_request {
50 * @client_layer: User implementation of client layer. This layer 50 * @client_layer: User implementation of client layer. This layer
51 * MUST have receive and control callback functions 51 * MUST have receive and control callback functions
52 * implemented. 52 * implemented.
53 * @ifindex: Link layer interface index used for this connection.
54 * @headroom: Head room needed by CAIF protocol.
55 * @tailroom: Tail room needed by CAIF protocol.
53 * 56 *
54 * This function connects a CAIF channel. The Client must implement 57 * This function connects a CAIF channel. The Client must implement
55 * the struct cflayer. This layer represents the Client layer and holds 58 * the struct cflayer. This layer represents the Client layer and holds
@@ -59,8 +62,9 @@ struct caif_connect_request {
59 * E.g. CAIF Socket will call this function for each socket it connects 62 * E.g. CAIF Socket will call this function for each socket it connects
60 * and have one client_layer instance for each socket. 63 * and have one client_layer instance for each socket.
61 */ 64 */
62int caif_connect_client(struct caif_connect_request *config, 65int caif_connect_client(struct caif_connect_request *conn_req,
63 struct cflayer *client_layer); 66 struct cflayer *client_layer, int *ifindex,
67 int *headroom, int *tailroom);
64 68
65/** 69/**
66 * caif_disconnect_client - Disconnects a client from the CAIF stack. 70 * caif_disconnect_client - Disconnects a client from the CAIF stack.
diff --git a/include/net/caif/caif_layer.h b/include/net/caif/caif_layer.h
index 25c472f0e5b8..c8b07a904e78 100644
--- a/include/net/caif/caif_layer.h
+++ b/include/net/caif/caif_layer.h
@@ -15,14 +15,8 @@ struct cfpktq;
15struct caif_payload_info; 15struct caif_payload_info;
16struct caif_packet_funcs; 16struct caif_packet_funcs;
17 17
18#define CAIF_MAX_FRAMESIZE 4096
19#define CAIF_MAX_PAYLOAD_SIZE (4096 - 64)
20#define CAIF_NEEDED_HEADROOM (10)
21#define CAIF_NEEDED_TAILROOM (2)
22 18
23#define CAIF_LAYER_NAME_SZ 16 19#define CAIF_LAYER_NAME_SZ 16
24#define CAIF_SUCCESS 1
25#define CAIF_FAILURE 0
26 20
27/** 21/**
28 * caif_assert() - Assert function for CAIF. 22 * caif_assert() - Assert function for CAIF.
diff --git a/include/net/caif/caif_spi.h b/include/net/caif/caif_spi.h
new file mode 100644
index 000000000000..ce4570dff020
--- /dev/null
+++ b/include/net/caif/caif_spi.h
@@ -0,0 +1,153 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Daniel Martensson / Daniel.Martensson@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CAIF_SPI_H_
8#define CAIF_SPI_H_
9
10#include <net/caif/caif_device.h>
11
12#define SPI_CMD_WR 0x00
13#define SPI_CMD_RD 0x01
14#define SPI_CMD_EOT 0x02
15#define SPI_CMD_IND 0x04
16
17#define SPI_DMA_BUF_LEN 8192
18
19#define WL_SZ 2 /* 16 bits. */
20#define SPI_CMD_SZ 4 /* 32 bits. */
21#define SPI_IND_SZ 4 /* 32 bits. */
22
23#define SPI_XFER 0
24#define SPI_SS_ON 1
25#define SPI_SS_OFF 2
26#define SPI_TERMINATE 3
27
28/* Minimum time between different levels is 50 microseconds. */
29#define MIN_TRANSITION_TIME_USEC 50
30
31/* Defines for calculating duration of SPI transfers for a particular
32 * number of bytes.
33 */
34#define SPI_MASTER_CLK_MHZ 13
35#define SPI_XFER_TIME_USEC(bytes, clk) (((bytes) * 8) / clk)
36
37/* Normally this should be aligned on the modem in order to benefit from full
38 * duplex transfers. However a size of 8188 provokes errors when running with
39 * the modem. These errors occur when packet sizes approaches 4 kB of data.
40 */
41#define CAIF_MAX_SPI_FRAME 4092
42
43/* Maximum number of uplink CAIF frames that can reside in the same SPI frame.
44 * This number should correspond with the modem setting. The application side
45 * CAIF accepts any number of embedded downlink CAIF frames.
46 */
47#define CAIF_MAX_SPI_PKTS 9
48
49/* Decides if SPI buffers should be prefilled with 0xFF pattern for easier
50 * debugging. Both TX and RX buffers will be filled before the transfer.
51 */
52#define CFSPI_DBG_PREFILL 0
53
54/* Structure describing a SPI transfer. */
55struct cfspi_xfer {
56 u16 tx_dma_len;
57 u16 rx_dma_len;
58 void *va_tx;
59 dma_addr_t pa_tx;
60 void *va_rx;
61 dma_addr_t pa_rx;
62};
63
64/* Structure implemented by the SPI interface. */
65struct cfspi_ifc {
66 void (*ss_cb) (bool assert, struct cfspi_ifc *ifc);
67 void (*xfer_done_cb) (struct cfspi_ifc *ifc);
68 void *priv;
69};
70
71/* Structure implemented by SPI clients. */
72struct cfspi_dev {
73 int (*init_xfer) (struct cfspi_xfer *xfer, struct cfspi_dev *dev);
74 void (*sig_xfer) (bool xfer, struct cfspi_dev *dev);
75 struct cfspi_ifc *ifc;
76 char *name;
77 u32 clk_mhz;
78 void *priv;
79};
80
81/* Enumeration describing the CAIF SPI state. */
82enum cfspi_state {
83 CFSPI_STATE_WAITING = 0,
84 CFSPI_STATE_AWAKE,
85 CFSPI_STATE_FETCH_PKT,
86 CFSPI_STATE_GET_NEXT,
87 CFSPI_STATE_INIT_XFER,
88 CFSPI_STATE_WAIT_ACTIVE,
89 CFSPI_STATE_SIG_ACTIVE,
90 CFSPI_STATE_WAIT_XFER_DONE,
91 CFSPI_STATE_XFER_DONE,
92 CFSPI_STATE_WAIT_INACTIVE,
93 CFSPI_STATE_SIG_INACTIVE,
94 CFSPI_STATE_DELIVER_PKT,
95 CFSPI_STATE_MAX,
96};
97
98/* Structure implemented by SPI physical interfaces. */
99struct cfspi {
100 struct caif_dev_common cfdev;
101 struct net_device *ndev;
102 struct platform_device *pdev;
103 struct sk_buff_head qhead;
104 struct sk_buff_head chead;
105 u16 cmd;
106 u16 tx_cpck_len;
107 u16 tx_npck_len;
108 u16 rx_cpck_len;
109 u16 rx_npck_len;
110 struct cfspi_ifc ifc;
111 struct cfspi_xfer xfer;
112 struct cfspi_dev *dev;
113 unsigned long state;
114 struct work_struct work;
115 struct workqueue_struct *wq;
116 struct list_head list;
117 int flow_off_sent;
118 u32 qd_low_mark;
119 u32 qd_high_mark;
120 struct completion comp;
121 wait_queue_head_t wait;
122 spinlock_t lock;
123 bool flow_stop;
124#ifdef CONFIG_DEBUG_FS
125 enum cfspi_state dbg_state;
126 u16 pcmd;
127 u16 tx_ppck_len;
128 u16 rx_ppck_len;
129 struct dentry *dbgfs_dir;
130 struct dentry *dbgfs_state;
131 struct dentry *dbgfs_frame;
132#endif /* CONFIG_DEBUG_FS */
133};
134
135extern int spi_frm_align;
136extern int spi_up_head_align;
137extern int spi_up_tail_align;
138extern int spi_down_head_align;
139extern int spi_down_tail_align;
140extern struct platform_driver cfspi_spi_driver;
141
142void cfspi_dbg_state(struct cfspi *cfspi, int state);
143int cfspi_xmitfrm(struct cfspi *cfspi, u8 *buf, size_t len);
144int cfspi_xmitlen(struct cfspi *cfspi);
145int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len);
146int cfspi_spi_remove(struct platform_device *pdev);
147int cfspi_spi_probe(struct platform_device *pdev);
148int cfspi_xmitfrm(struct cfspi *cfspi, u8 *buf, size_t len);
149int cfspi_xmitlen(struct cfspi *cfspi);
150int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len);
151void cfspi_xfer(struct work_struct *work);
152
153#endif /* CAIF_SPI_H_ */
diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h
index 9fc2fc20b884..bd646faffa47 100644
--- a/include/net/caif/cfcnfg.h
+++ b/include/net/caif/cfcnfg.h
@@ -7,6 +7,7 @@
7#ifndef CFCNFG_H_ 7#ifndef CFCNFG_H_
8#define CFCNFG_H_ 8#define CFCNFG_H_
9#include <linux/spinlock.h> 9#include <linux/spinlock.h>
10#include <linux/netdevice.h>
10#include <net/caif/caif_layer.h> 11#include <net/caif/caif_layer.h>
11#include <net/caif/cfctrl.h> 12#include <net/caif/cfctrl.h>
12 13
@@ -73,8 +74,8 @@ void cfcnfg_remove(struct cfcnfg *cfg);
73 74
74void 75void
75cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, 76cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
76 void *dev, struct cflayer *phy_layer, u16 *phyid, 77 struct net_device *dev, struct cflayer *phy_layer,
77 enum cfcnfg_phy_preference pref, 78 u16 *phyid, enum cfcnfg_phy_preference pref,
78 bool fcs, bool stx); 79 bool fcs, bool stx);
79 80
80/** 81/**
@@ -114,11 +115,18 @@ void cfcnfg_release_adap_layer(struct cflayer *adap_layer);
114 * @param: Link setup parameters. 115 * @param: Link setup parameters.
115 * @adap_layer: Specify the adaptation layer; the receive and 116 * @adap_layer: Specify the adaptation layer; the receive and
116 * flow-control functions MUST be set in the structure. 117 * flow-control functions MUST be set in the structure.
117 * 118 * @ifindex: Link layer interface index used for this connection.
119 * @proto_head: Protocol head-space needed by CAIF protocol,
120 * excluding link layer.
121 * @proto_tail: Protocol tail-space needed by CAIF protocol,
122 * excluding link layer.
118 */ 123 */
119int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg, 124int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg,
120 struct cfctrl_link_param *param, 125 struct cfctrl_link_param *param,
121 struct cflayer *adap_layer); 126 struct cflayer *adap_layer,
127 int *ifindex,
128 int *proto_head,
129 int *proto_tail);
122 130
123/** 131/**
124 * cfcnfg_get_phyid() - Get physical ID, given type. 132 * cfcnfg_get_phyid() - Get physical ID, given type.
diff --git a/include/net/caif/cfsrvl.h b/include/net/caif/cfsrvl.h
index 2dc9eb193ecf..b1fa87ee0992 100644
--- a/include/net/caif/cfsrvl.h
+++ b/include/net/caif/cfsrvl.h
@@ -16,6 +16,8 @@ struct cfsrvl {
16 bool open; 16 bool open;
17 bool phy_flow_on; 17 bool phy_flow_on;
18 bool modem_flow_on; 18 bool modem_flow_on;
19 bool supports_flowctrl;
20 void (*release)(struct kref *);
19 struct dev_info dev_info; 21 struct dev_info dev_info;
20 struct kref ref; 22 struct kref ref;
21}; 23};
@@ -25,13 +27,15 @@ struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info);
25struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info); 27struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info);
26struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info); 28struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info);
27struct cflayer *cfvidl_create(u8 linkid, struct dev_info *dev_info); 29struct cflayer *cfvidl_create(u8 linkid, struct dev_info *dev_info);
28struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info); 30struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info,
31 int mtu_size);
29struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info); 32struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info);
30bool cfsrvl_phyid_match(struct cflayer *layer, int phyid); 33bool cfsrvl_phyid_match(struct cflayer *layer, int phyid);
31void cfservl_destroy(struct cflayer *layer); 34void cfservl_destroy(struct cflayer *layer);
32void cfsrvl_init(struct cfsrvl *service, 35void cfsrvl_init(struct cfsrvl *service,
33 u8 channel_id, 36 u8 channel_id,
34 struct dev_info *dev_info); 37 struct dev_info *dev_info,
38 bool supports_flowctrl);
35bool cfsrvl_ready(struct cfsrvl *service, int *err); 39bool cfsrvl_ready(struct cfsrvl *service, int *err);
36u8 cfsrvl_getphyid(struct cflayer *layer); 40u8 cfsrvl_getphyid(struct cflayer *layer);
37 41
@@ -50,7 +54,10 @@ static inline void cfsrvl_put(struct cflayer *layr)
50 if (layr == NULL) 54 if (layr == NULL)
51 return; 55 return;
52 s = container_of(layr, struct cfsrvl, layer); 56 s = container_of(layr, struct cfsrvl, layer);
53 kref_put(&s->ref, cfsrvl_release); 57
58 WARN_ON(!s->release);
59 if (s->release)
60 kref_put(&s->ref, s->release);
54} 61}
55 62
56#endif /* CFSRVL_H_ */ 63#endif /* CFSRVL_H_ */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index b44a2e5321a3..2fd06c60ffbb 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -37,6 +37,7 @@
37 * 37 *
38 * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band 38 * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
39 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) 39 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
40 * @IEEE80211_NUM_BANDS: number of defined bands
40 */ 41 */
41enum ieee80211_band { 42enum ieee80211_band {
42 IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ, 43 IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
@@ -89,7 +90,7 @@ enum ieee80211_channel_flags {
89 * @max_power: maximum transmission power (in dBm) 90 * @max_power: maximum transmission power (in dBm)
90 * @beacon_found: helper to regulatory code to indicate when a beacon 91 * @beacon_found: helper to regulatory code to indicate when a beacon
91 * has been found on this channel. Use regulatory_hint_found_beacon() 92 * has been found on this channel. Use regulatory_hint_found_beacon()
92 * to enable this, this is is useful only on 5 GHz band. 93 * to enable this, this is useful only on 5 GHz band.
93 * @orig_mag: internal use 94 * @orig_mag: internal use
94 * @orig_mpwr: internal use 95 * @orig_mpwr: internal use
95 */ 96 */
@@ -188,6 +189,7 @@ struct ieee80211_sta_ht_cap {
188 * in this band. Must be sorted to give a valid "supported 189 * in this band. Must be sorted to give a valid "supported
189 * rates" IE, i.e. CCK rates first, then OFDM. 190 * rates" IE, i.e. CCK rates first, then OFDM.
190 * @n_bitrates: Number of bitrates in @bitrates 191 * @n_bitrates: Number of bitrates in @bitrates
192 * @ht_cap: HT capabilities in this band
191 */ 193 */
192struct ieee80211_supported_band { 194struct ieee80211_supported_band {
193 struct ieee80211_channel *channels; 195 struct ieee80211_channel *channels;
@@ -225,6 +227,7 @@ struct vif_params {
225 * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 227 * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
226 * with the get_key() callback, must be in little endian, 228 * with the get_key() callback, must be in little endian,
227 * length given by @seq_len. 229 * length given by @seq_len.
230 * @seq_len: length of @seq.
228 */ 231 */
229struct key_params { 232struct key_params {
230 u8 *key; 233 u8 *key;
@@ -237,6 +240,8 @@ struct key_params {
237/** 240/**
238 * enum survey_info_flags - survey information flags 241 * enum survey_info_flags - survey information flags
239 * 242 *
243 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
244 *
240 * Used by the driver to indicate which info in &struct survey_info 245 * Used by the driver to indicate which info in &struct survey_info
241 * it has filled in during the get_survey(). 246 * it has filled in during the get_survey().
242 */ 247 */
@@ -247,13 +252,13 @@ enum survey_info_flags {
247/** 252/**
248 * struct survey_info - channel survey response 253 * struct survey_info - channel survey response
249 * 254 *
250 * Used by dump_survey() to report back per-channel survey information.
251 *
252 * @channel: the channel this survey record reports, mandatory 255 * @channel: the channel this survey record reports, mandatory
253 * @filled: bitflag of flags from &enum survey_info_flags 256 * @filled: bitflag of flags from &enum survey_info_flags
254 * @noise: channel noise in dBm. This and all following fields are 257 * @noise: channel noise in dBm. This and all following fields are
255 * optional 258 * optional
256 * 259 *
260 * Used by dump_survey() to report back per-channel survey information.
261 *
257 * This structure can later be expanded with things like 262 * This structure can later be expanded with things like
258 * channel duty cycle etc. 263 * channel duty cycle etc.
259 */ 264 */
@@ -288,7 +293,7 @@ struct beacon_parameters {
288 * 293 *
289 * @PLINK_ACTION_INVALID: action 0 is reserved 294 * @PLINK_ACTION_INVALID: action 0 is reserved
290 * @PLINK_ACTION_OPEN: start mesh peer link establishment 295 * @PLINK_ACTION_OPEN: start mesh peer link establishment
291 * @PLINK_ACTION_BLOCL: block traffic from this mesh peer 296 * @PLINK_ACTION_BLOCK: block traffic from this mesh peer
292 */ 297 */
293enum plink_actions { 298enum plink_actions {
294 PLINK_ACTION_INVALID, 299 PLINK_ACTION_INVALID,
@@ -311,6 +316,8 @@ enum plink_actions {
311 * (bitmask of BIT(NL80211_STA_FLAG_...)) 316 * (bitmask of BIT(NL80211_STA_FLAG_...))
312 * @listen_interval: listen interval or -1 for no change 317 * @listen_interval: listen interval or -1 for no change
313 * @aid: AID or zero for no change 318 * @aid: AID or zero for no change
319 * @plink_action: plink action to take
320 * @ht_capa: HT capabilities of station
314 */ 321 */
315struct station_parameters { 322struct station_parameters {
316 u8 *supported_rates; 323 u8 *supported_rates;
@@ -448,13 +455,13 @@ enum monitor_flags {
448 * Used by the driver to indicate which info in &struct mpath_info it has filled 455 * Used by the driver to indicate which info in &struct mpath_info it has filled
449 * in during get_station() or dump_station(). 456 * in during get_station() or dump_station().
450 * 457 *
451 * MPATH_INFO_FRAME_QLEN: @frame_qlen filled 458 * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
452 * MPATH_INFO_SN: @sn filled 459 * @MPATH_INFO_SN: @sn filled
453 * MPATH_INFO_METRIC: @metric filled 460 * @MPATH_INFO_METRIC: @metric filled
454 * MPATH_INFO_EXPTIME: @exptime filled 461 * @MPATH_INFO_EXPTIME: @exptime filled
455 * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 462 * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
456 * MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 463 * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
457 * MPATH_INFO_FLAGS: @flags filled 464 * @MPATH_INFO_FLAGS: @flags filled
458 */ 465 */
459enum mpath_info_flags { 466enum mpath_info_flags {
460 MPATH_INFO_FRAME_QLEN = BIT(0), 467 MPATH_INFO_FRAME_QLEN = BIT(0),
@@ -587,6 +594,7 @@ struct cfg80211_ssid {
587 * @ie_len: length of ie in octets 594 * @ie_len: length of ie in octets
588 * @wiphy: the wiphy this was for 595 * @wiphy: the wiphy this was for
589 * @dev: the interface 596 * @dev: the interface
597 * @aborted: (internal) scan request was notified as aborted
590 */ 598 */
591struct cfg80211_scan_request { 599struct cfg80211_scan_request {
592 struct cfg80211_ssid *ssids; 600 struct cfg80211_ssid *ssids;
@@ -623,6 +631,7 @@ enum cfg80211_signal_type {
623 * This structure describes a BSS (which may also be a mesh network) 631 * This structure describes a BSS (which may also be a mesh network)
624 * for use in scan results and similar. 632 * for use in scan results and similar.
625 * 633 *
634 * @channel: channel this BSS is on
626 * @bssid: BSSID of the BSS 635 * @bssid: BSSID of the BSS
627 * @tsf: timestamp of last received update 636 * @tsf: timestamp of last received update
628 * @beacon_interval: the beacon interval as from the frame 637 * @beacon_interval: the beacon interval as from the frame
@@ -801,6 +810,7 @@ struct cfg80211_disassoc_request {
801 * @beacon_interval: beacon interval to use 810 * @beacon_interval: beacon interval to use
802 * @privacy: this is a protected network, keys will be configured 811 * @privacy: this is a protected network, keys will be configured
803 * after joining 812 * after joining
813 * @basic_rates: bitmap of basic rates to use when creating the IBSS
804 */ 814 */
805struct cfg80211_ibss_params { 815struct cfg80211_ibss_params {
806 u8 *ssid; 816 u8 *ssid;
@@ -809,6 +819,7 @@ struct cfg80211_ibss_params {
809 u8 *ie; 819 u8 *ie;
810 u8 ssid_len, ie_len; 820 u8 ssid_len, ie_len;
811 u16 beacon_interval; 821 u16 beacon_interval;
822 u32 basic_rates;
812 bool channel_fixed; 823 bool channel_fixed;
813 bool privacy; 824 bool privacy;
814}; 825};
@@ -826,8 +837,8 @@ struct cfg80211_ibss_params {
826 * @ssid: SSID 837 * @ssid: SSID
827 * @ssid_len: Length of ssid in octets 838 * @ssid_len: Length of ssid in octets
828 * @auth_type: Authentication type (algorithm) 839 * @auth_type: Authentication type (algorithm)
829 * @assoc_ie: IEs for association request 840 * @ie: IEs for association request
830 * @assoc_ie_len: Length of assoc_ie in octets 841 * @ie_len: Length of assoc_ie in octets
831 * @privacy: indicates whether privacy-enabled APs should be used 842 * @privacy: indicates whether privacy-enabled APs should be used
832 * @crypto: crypto settings 843 * @crypto: crypto settings
833 * @key_len: length of WEP key for shared key authentication 844 * @key_len: length of WEP key for shared key authentication
@@ -850,10 +861,11 @@ struct cfg80211_connect_params {
850 861
851/** 862/**
852 * enum wiphy_params_flags - set_wiphy_params bitfield values 863 * enum wiphy_params_flags - set_wiphy_params bitfield values
853 * WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 864 * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
854 * WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 865 * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
855 * WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 866 * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
856 * WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 867 * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
868 * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
857 */ 869 */
858enum wiphy_params_flags { 870enum wiphy_params_flags {
859 WIPHY_PARAM_RETRY_SHORT = 1 << 0, 871 WIPHY_PARAM_RETRY_SHORT = 1 << 0,
@@ -863,19 +875,6 @@ enum wiphy_params_flags {
863 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 875 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
864}; 876};
865 877
866/**
867 * enum tx_power_setting - TX power adjustment
868 *
869 * @TX_POWER_AUTOMATIC: the dbm parameter is ignored
870 * @TX_POWER_LIMITED: limit TX power by the dbm parameter
871 * @TX_POWER_FIXED: fix TX power to the dbm parameter
872 */
873enum tx_power_setting {
874 TX_POWER_AUTOMATIC,
875 TX_POWER_LIMITED,
876 TX_POWER_FIXED,
877};
878
879/* 878/*
880 * cfg80211_bitrate_mask - masks for bitrate control 879 * cfg80211_bitrate_mask - masks for bitrate control
881 */ 880 */
@@ -949,10 +948,16 @@ struct cfg80211_pmksa {
949 * @del_beacon: Remove beacon configuration and stop sending the beacon. 948 * @del_beacon: Remove beacon configuration and stop sending the beacon.
950 * 949 *
951 * @add_station: Add a new station. 950 * @add_station: Add a new station.
952 *
953 * @del_station: Remove a station; @mac may be NULL to remove all stations. 951 * @del_station: Remove a station; @mac may be NULL to remove all stations.
954 *
955 * @change_station: Modify a given station. 952 * @change_station: Modify a given station.
953 * @get_station: get station information for the station identified by @mac
954 * @dump_station: dump station callback -- resume dump at index @idx
955 *
956 * @add_mpath: add a fixed mesh path
957 * @del_mpath: delete a given mesh path
958 * @change_mpath: change a given mesh path
959 * @get_mpath: get a mesh path for the given parameters
960 * @dump_mpath: dump mesh path callback -- resume dump at index @idx
956 * 961 *
957 * @get_mesh_params: Put the current mesh parameters into *params 962 * @get_mesh_params: Put the current mesh parameters into *params
958 * 963 *
@@ -960,8 +965,6 @@ struct cfg80211_pmksa {
960 * The mask is a bitfield which tells us which parameters to 965 * The mask is a bitfield which tells us which parameters to
961 * set, and which to leave alone. 966 * set, and which to leave alone.
962 * 967 *
963 * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
964 *
965 * @change_bss: Modify parameters for a given BSS. 968 * @change_bss: Modify parameters for a given BSS.
966 * 969 *
967 * @set_txq_params: Set TX queue parameters 970 * @set_txq_params: Set TX queue parameters
@@ -1002,6 +1005,8 @@ struct cfg80211_pmksa {
1002 * @get_tx_power: store the current TX power into the dbm variable; 1005 * @get_tx_power: store the current TX power into the dbm variable;
1003 * return 0 if successful 1006 * return 0 if successful
1004 * 1007 *
1008 * @set_wds_peer: set the WDS peer for a WDS interface
1009 *
1005 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 1010 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
1006 * functions to adjust rfkill hw state 1011 * functions to adjust rfkill hw state
1007 * 1012 *
@@ -1019,6 +1024,8 @@ struct cfg80211_pmksa {
1019 * 1024 *
1020 * @testmode_cmd: run a test mode command 1025 * @testmode_cmd: run a test mode command
1021 * 1026 *
1027 * @set_bitrate_mask: set the bitrate mask configuration
1028 *
1022 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 1029 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
1023 * devices running firmwares capable of generating the (re) association 1030 * devices running firmwares capable of generating the (re) association
1024 * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 1031 * RSN IE. It allows for faster roaming between WPA2 BSSIDs.
@@ -1129,7 +1136,7 @@ struct cfg80211_ops {
1129 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 1136 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
1130 1137
1131 int (*set_tx_power)(struct wiphy *wiphy, 1138 int (*set_tx_power)(struct wiphy *wiphy,
1132 enum tx_power_setting type, int dbm); 1139 enum nl80211_tx_power_setting type, int mbm);
1133 int (*get_tx_power)(struct wiphy *wiphy, int *dbm); 1140 int (*get_tx_power)(struct wiphy *wiphy, int *dbm);
1134 1141
1135 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 1142 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
@@ -1168,6 +1175,7 @@ struct cfg80211_ops {
1168 int (*action)(struct wiphy *wiphy, struct net_device *dev, 1175 int (*action)(struct wiphy *wiphy, struct net_device *dev,
1169 struct ieee80211_channel *chan, 1176 struct ieee80211_channel *chan,
1170 enum nl80211_channel_type channel_type, 1177 enum nl80211_channel_type channel_type,
1178 bool channel_type_valid,
1171 const u8 *buf, size_t len, u64 *cookie); 1179 const u8 *buf, size_t len, u64 *cookie);
1172 1180
1173 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1181 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
@@ -1230,8 +1238,6 @@ struct mac_address {
1230 1238
1231/** 1239/**
1232 * struct wiphy - wireless hardware description 1240 * struct wiphy - wireless hardware description
1233 * @idx: the wiphy index assigned to this item
1234 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
1235 * @reg_notifier: the driver's regulatory notification callback 1241 * @reg_notifier: the driver's regulatory notification callback
1236 * @regd: the driver's regulatory domain, if one was requested via 1242 * @regd: the driver's regulatory domain, if one was requested via
1237 * the regulatory_hint() API. This can be used by the driver 1243 * the regulatory_hint() API. This can be used by the driver
@@ -1245,7 +1251,7 @@ struct mac_address {
1245 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 1251 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
1246 * -1 = fragmentation disabled, only odd values >= 256 used 1252 * -1 = fragmentation disabled, only odd values >= 256 used
1247 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 1253 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
1248 * @net: the network namespace this wiphy currently lives in 1254 * @_net: the network namespace this wiphy currently lives in
1249 * @perm_addr: permanent MAC address of this device 1255 * @perm_addr: permanent MAC address of this device
1250 * @addr_mask: If the device supports multiple MAC addresses by masking, 1256 * @addr_mask: If the device supports multiple MAC addresses by masking,
1251 * set this to a mask with variable bits set to 1, e.g. if the last 1257 * set this to a mask with variable bits set to 1, e.g. if the last
@@ -1258,6 +1264,28 @@ struct mac_address {
1258 * by default for perm_addr. In this case, the mask should be set to 1264 * by default for perm_addr. In this case, the mask should be set to
1259 * all-zeroes. In this case it is assumed that the device can handle 1265 * all-zeroes. In this case it is assumed that the device can handle
1260 * the same number of arbitrary MAC addresses. 1266 * the same number of arbitrary MAC addresses.
1267 * @debugfsdir: debugfs directory used for this wiphy, will be renamed
1268 * automatically on wiphy renames
1269 * @dev: (virtual) struct device for this wiphy
1270 * @wext: wireless extension handlers
1271 * @priv: driver private data (sized according to wiphy_new() parameter)
1272 * @interface_modes: bitmask of interfaces types valid for this wiphy,
1273 * must be set by driver
1274 * @flags: wiphy flags, see &enum wiphy_flags
1275 * @bss_priv_size: each BSS struct has private data allocated with it,
1276 * this variable determines its size
1277 * @max_scan_ssids: maximum number of SSIDs the device can scan for in
1278 * any given scan
1279 * @max_scan_ie_len: maximum length of user-controlled IEs device can
1280 * add to probe request frames transmitted during a scan, must not
1281 * include fixed IEs like supported rates
1282 * @coverage_class: current coverage class
1283 * @fw_version: firmware version for ethtool reporting
1284 * @hw_version: hardware version for ethtool reporting
1285 * @max_num_pmkids: maximum number of PMKIDs supported by device
1286 * @privid: a pointer that drivers can use to identify if an arbitrary
1287 * wiphy is theirs, e.g. in global notifiers
1288 * @bands: information about bands/channels supported by this device
1261 */ 1289 */
1262struct wiphy { 1290struct wiphy {
1263 /* assign these fields before you register the wiphy */ 1291 /* assign these fields before you register the wiphy */
@@ -1330,27 +1358,16 @@ struct wiphy {
1330 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 1358 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
1331}; 1359};
1332 1360
1333#ifdef CONFIG_NET_NS
1334static inline struct net *wiphy_net(struct wiphy *wiphy) 1361static inline struct net *wiphy_net(struct wiphy *wiphy)
1335{ 1362{
1336 return wiphy->_net; 1363 return read_pnet(&wiphy->_net);
1337} 1364}
1338 1365
1339static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 1366static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
1340{ 1367{
1341 wiphy->_net = net; 1368 write_pnet(&wiphy->_net, net);
1342}
1343#else
1344static inline struct net *wiphy_net(struct wiphy *wiphy)
1345{
1346 return &init_net;
1347} 1369}
1348 1370
1349static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
1350{
1351}
1352#endif
1353
1354/** 1371/**
1355 * wiphy_priv - return priv from wiphy 1372 * wiphy_priv - return priv from wiphy
1356 * 1373 *
@@ -1399,7 +1416,7 @@ static inline struct device *wiphy_dev(struct wiphy *wiphy)
1399 * 1416 *
1400 * @wiphy: The wiphy whose name to return 1417 * @wiphy: The wiphy whose name to return
1401 */ 1418 */
1402static inline const char *wiphy_name(struct wiphy *wiphy) 1419static inline const char *wiphy_name(const struct wiphy *wiphy)
1403{ 1420{
1404 return dev_name(&wiphy->dev); 1421 return dev_name(&wiphy->dev);
1405} 1422}
@@ -1471,13 +1488,14 @@ struct cfg80211_cached_keys;
1471 * @ssid: (private) Used by the internal configuration code 1488 * @ssid: (private) Used by the internal configuration code
1472 * @ssid_len: (private) Used by the internal configuration code 1489 * @ssid_len: (private) Used by the internal configuration code
1473 * @wext: (private) Used by the internal wireless extensions compat code 1490 * @wext: (private) Used by the internal wireless extensions compat code
1474 * @wext_bssid: (private) Used by the internal wireless extensions compat code
1475 * @use_4addr: indicates 4addr mode is used on this interface, must be 1491 * @use_4addr: indicates 4addr mode is used on this interface, must be
1476 * set by driver (if supported) on add_interface BEFORE registering the 1492 * set by driver (if supported) on add_interface BEFORE registering the
1477 * netdev and may otherwise be used by driver read-only, will be update 1493 * netdev and may otherwise be used by driver read-only, will be update
1478 * by cfg80211 on change_interface 1494 * by cfg80211 on change_interface
1479 * @action_registrations: list of registrations for action frames 1495 * @action_registrations: list of registrations for action frames
1480 * @action_registrations_lock: lock for the list 1496 * @action_registrations_lock: lock for the list
1497 * @mtx: mutex used to lock data in this struct
1498 * @cleanup_work: work struct used for cleanup that can't be done directly
1481 */ 1499 */
1482struct wireless_dev { 1500struct wireless_dev {
1483 struct wiphy *wiphy; 1501 struct wiphy *wiphy;
@@ -1551,11 +1569,13 @@ static inline void *wdev_priv(struct wireless_dev *wdev)
1551 1569
1552/** 1570/**
1553 * ieee80211_channel_to_frequency - convert channel number to frequency 1571 * ieee80211_channel_to_frequency - convert channel number to frequency
1572 * @chan: channel number
1554 */ 1573 */
1555extern int ieee80211_channel_to_frequency(int chan); 1574extern int ieee80211_channel_to_frequency(int chan);
1556 1575
1557/** 1576/**
1558 * ieee80211_frequency_to_channel - convert frequency to channel number 1577 * ieee80211_frequency_to_channel - convert frequency to channel number
1578 * @freq: center frequency
1559 */ 1579 */
1560extern int ieee80211_frequency_to_channel(int freq); 1580extern int ieee80211_frequency_to_channel(int freq);
1561 1581
@@ -1570,6 +1590,8 @@ extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
1570 int freq); 1590 int freq);
1571/** 1591/**
1572 * ieee80211_get_channel - get channel struct from wiphy for specified frequency 1592 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
1593 * @wiphy: the struct wiphy to get the channel for
1594 * @freq: the center frequency of the channel
1573 */ 1595 */
1574static inline struct ieee80211_channel * 1596static inline struct ieee80211_channel *
1575ieee80211_get_channel(struct wiphy *wiphy, int freq) 1597ieee80211_get_channel(struct wiphy *wiphy, int freq)
@@ -1630,9 +1652,6 @@ struct ieee80211_radiotap_vendor_namespaces {
1630 * @is_radiotap_ns: indicates whether the current namespace is the default 1652 * @is_radiotap_ns: indicates whether the current namespace is the default
1631 * radiotap namespace or not 1653 * radiotap namespace or not
1632 * 1654 *
1633 * @overrides: override standard radiotap fields
1634 * @n_overrides: number of overrides
1635 *
1636 * @_rtheader: pointer to the radiotap header we are walking through 1655 * @_rtheader: pointer to the radiotap header we are walking through
1637 * @_max_length: length of radiotap header in cpu byte ordering 1656 * @_max_length: length of radiotap header in cpu byte ordering
1638 * @_arg_index: next argument index 1657 * @_arg_index: next argument index
@@ -1933,6 +1952,10 @@ int cfg80211_wext_giwap(struct net_device *dev,
1933 struct iw_request_info *info, 1952 struct iw_request_info *info,
1934 struct sockaddr *ap_addr, char *extra); 1953 struct sockaddr *ap_addr, char *extra);
1935 1954
1955int cfg80211_wext_siwpmksa(struct net_device *dev,
1956 struct iw_request_info *info,
1957 struct iw_point *data, char *extra);
1958
1936/* 1959/*
1937 * callbacks for asynchronous cfg80211 methods, notification 1960 * callbacks for asynchronous cfg80211 methods, notification
1938 * functions and BSS handling helpers 1961 * functions and BSS handling helpers
@@ -1948,10 +1971,12 @@ int cfg80211_wext_giwap(struct net_device *dev,
1948void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); 1971void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
1949 1972
1950/** 1973/**
1951 * cfg80211_inform_bss - inform cfg80211 of a new BSS 1974 * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame
1952 * 1975 *
1953 * @wiphy: the wiphy reporting the BSS 1976 * @wiphy: the wiphy reporting the BSS
1954 * @bss: the found BSS 1977 * @channel: The channel the frame was received on
1978 * @mgmt: the management frame (probe response or beacon)
1979 * @len: length of the management frame
1955 * @signal: the signal strength, type depends on the wiphy's signal_type 1980 * @signal: the signal strength, type depends on the wiphy's signal_type
1956 * @gfp: context flags 1981 * @gfp: context flags
1957 * 1982 *
@@ -1964,6 +1989,23 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
1964 struct ieee80211_mgmt *mgmt, size_t len, 1989 struct ieee80211_mgmt *mgmt, size_t len,
1965 s32 signal, gfp_t gfp); 1990 s32 signal, gfp_t gfp);
1966 1991
1992/**
1993 * cfg80211_inform_bss - inform cfg80211 of a new BSS
1994 *
1995 * @wiphy: the wiphy reporting the BSS
1996 * @channel: The channel the frame was received on
1997 * @bssid: the BSSID of the BSS
1998 * @timestamp: the TSF timestamp sent by the peer
1999 * @capability: the capability field sent by the peer
2000 * @beacon_interval: the beacon interval announced by the peer
2001 * @ie: additional IEs sent by the peer
2002 * @ielen: length of the additional IEs
2003 * @signal: the signal strength, type depends on the wiphy's signal_type
2004 * @gfp: context flags
2005 *
2006 * This informs cfg80211 that BSS information was found and
2007 * the BSS should be updated/added.
2008 */
1967struct cfg80211_bss* 2009struct cfg80211_bss*
1968cfg80211_inform_bss(struct wiphy *wiphy, 2010cfg80211_inform_bss(struct wiphy *wiphy,
1969 struct ieee80211_channel *channel, 2011 struct ieee80211_channel *channel,
@@ -2378,4 +2420,67 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
2378 enum nl80211_cqm_rssi_threshold_event rssi_event, 2420 enum nl80211_cqm_rssi_threshold_event rssi_event,
2379 gfp_t gfp); 2421 gfp_t gfp);
2380 2422
2423#ifdef __KERNEL__
2424
2425/* Logging, debugging and troubleshooting/diagnostic helpers. */
2426
2427/* wiphy_printk helpers, similar to dev_printk */
2428
2429#define wiphy_printk(level, wiphy, format, args...) \
2430 printk(level "%s: " format, wiphy_name(wiphy), ##args)
2431#define wiphy_emerg(wiphy, format, args...) \
2432 wiphy_printk(KERN_EMERG, wiphy, format, ##args)
2433#define wiphy_alert(wiphy, format, args...) \
2434 wiphy_printk(KERN_ALERT, wiphy, format, ##args)
2435#define wiphy_crit(wiphy, format, args...) \
2436 wiphy_printk(KERN_CRIT, wiphy, format, ##args)
2437#define wiphy_err(wiphy, format, args...) \
2438 wiphy_printk(KERN_ERR, wiphy, format, ##args)
2439#define wiphy_warn(wiphy, format, args...) \
2440 wiphy_printk(KERN_WARNING, wiphy, format, ##args)
2441#define wiphy_notice(wiphy, format, args...) \
2442 wiphy_printk(KERN_NOTICE, wiphy, format, ##args)
2443#define wiphy_info(wiphy, format, args...) \
2444 wiphy_printk(KERN_INFO, wiphy, format, ##args)
2445
2446int wiphy_debug(const struct wiphy *wiphy, const char *format, ...)
2447 __attribute__ ((format (printf, 2, 3)));
2448
2449#if defined(DEBUG)
2450#define wiphy_dbg(wiphy, format, args...) \
2451 wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
2452#elif defined(CONFIG_DYNAMIC_DEBUG)
2453#define wiphy_dbg(wiphy, format, args...) \
2454 dynamic_pr_debug("%s: " format, wiphy_name(wiphy), ##args)
2455#else
2456#define wiphy_dbg(wiphy, format, args...) \
2457({ \
2458 if (0) \
2459 wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \
2460 0; \
2461})
2462#endif
2463
2464#if defined(VERBOSE_DEBUG)
2465#define wiphy_vdbg wiphy_dbg
2466#else
2467
2468#define wiphy_vdbg(wiphy, format, args...) \
2469({ \
2470 if (0) \
2471 wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \
2472 0; \
2473})
2474#endif
2475
2476/*
2477 * wiphy_WARN() acts like wiphy_printk(), but with the key difference
2478 * of using a WARN/WARN_ON to get the message out, including the
2479 * file/line information and a backtrace.
2480 */
2481#define wiphy_WARN(wiphy, format, args...) \
2482 WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
2483
2484#endif
2485
2381#endif /* __NET_CFG80211_H */ 2486#endif /* __NET_CFG80211_H */
diff --git a/include/net/dn_dev.h b/include/net/dn_dev.h
index 511a459ec10f..0916bbf3bdff 100644
--- a/include/net/dn_dev.h
+++ b/include/net/dn_dev.h
@@ -101,7 +101,7 @@ struct dn_short_packet {
101 __le16 dstnode; 101 __le16 dstnode;
102 __le16 srcnode; 102 __le16 srcnode;
103 __u8 forward; 103 __u8 forward;
104} __attribute__((packed)); 104} __packed;
105 105
106struct dn_long_packet { 106struct dn_long_packet {
107 __u8 msgflg; 107 __u8 msgflg;
@@ -115,7 +115,7 @@ struct dn_long_packet {
115 __u8 visit_ct; 115 __u8 visit_ct;
116 __u8 s_class; 116 __u8 s_class;
117 __u8 pt; 117 __u8 pt;
118} __attribute__((packed)); 118} __packed;
119 119
120/*------------------------- DRP - Routing messages ---------------------*/ 120/*------------------------- DRP - Routing messages ---------------------*/
121 121
@@ -132,7 +132,7 @@ struct endnode_hello_message {
132 __u8 mpd; 132 __u8 mpd;
133 __u8 datalen; 133 __u8 datalen;
134 __u8 data[2]; 134 __u8 data[2];
135} __attribute__((packed)); 135} __packed;
136 136
137struct rtnode_hello_message { 137struct rtnode_hello_message {
138 __u8 msgflg; 138 __u8 msgflg;
@@ -144,7 +144,7 @@ struct rtnode_hello_message {
144 __u8 area; 144 __u8 area;
145 __le16 timer; 145 __le16 timer;
146 __u8 mpd; 146 __u8 mpd;
147} __attribute__((packed)); 147} __packed;
148 148
149 149
150extern void dn_dev_init(void); 150extern void dn_dev_init(void);
diff --git a/include/net/dn_nsp.h b/include/net/dn_nsp.h
index 17d43d2db5ec..e43a2893f132 100644
--- a/include/net/dn_nsp.h
+++ b/include/net/dn_nsp.h
@@ -74,18 +74,18 @@ struct nsp_data_seg_msg {
74 __u8 msgflg; 74 __u8 msgflg;
75 __le16 dstaddr; 75 __le16 dstaddr;
76 __le16 srcaddr; 76 __le16 srcaddr;
77} __attribute__((packed)); 77} __packed;
78 78
79struct nsp_data_opt_msg { 79struct nsp_data_opt_msg {
80 __le16 acknum; 80 __le16 acknum;
81 __le16 segnum; 81 __le16 segnum;
82 __le16 lsflgs; 82 __le16 lsflgs;
83} __attribute__((packed)); 83} __packed;
84 84
85struct nsp_data_opt_msg1 { 85struct nsp_data_opt_msg1 {
86 __le16 acknum; 86 __le16 acknum;
87 __le16 segnum; 87 __le16 segnum;
88} __attribute__((packed)); 88} __packed;
89 89
90 90
91/* Acknowledgment Message (data/other data) */ 91/* Acknowledgment Message (data/other data) */
@@ -94,13 +94,13 @@ struct nsp_data_ack_msg {
94 __le16 dstaddr; 94 __le16 dstaddr;
95 __le16 srcaddr; 95 __le16 srcaddr;
96 __le16 acknum; 96 __le16 acknum;
97} __attribute__((packed)); 97} __packed;
98 98
99/* Connect Acknowledgment Message */ 99/* Connect Acknowledgment Message */
100struct nsp_conn_ack_msg { 100struct nsp_conn_ack_msg {
101 __u8 msgflg; 101 __u8 msgflg;
102 __le16 dstaddr; 102 __le16 dstaddr;
103} __attribute__((packed)); 103} __packed;
104 104
105 105
106/* Connect Initiate/Retransmit Initiate/Connect Confirm */ 106/* Connect Initiate/Retransmit Initiate/Connect Confirm */
@@ -117,7 +117,7 @@ struct nsp_conn_init_msg {
117#define NSP_FC_MASK 0x0c /* FC type mask */ 117#define NSP_FC_MASK 0x0c /* FC type mask */
118 __u8 info; 118 __u8 info;
119 __le16 segsize; 119 __le16 segsize;
120} __attribute__((packed)); 120} __packed;
121 121
122/* Disconnect Initiate/Disconnect Confirm */ 122/* Disconnect Initiate/Disconnect Confirm */
123struct nsp_disconn_init_msg { 123struct nsp_disconn_init_msg {
@@ -125,7 +125,7 @@ struct nsp_disconn_init_msg {
125 __le16 dstaddr; 125 __le16 dstaddr;
126 __le16 srcaddr; 126 __le16 srcaddr;
127 __le16 reason; 127 __le16 reason;
128} __attribute__((packed)); 128} __packed;
129 129
130 130
131 131
@@ -135,7 +135,7 @@ struct srcobj_fmt {
135 __le16 grpcode; 135 __le16 grpcode;
136 __le16 usrcode; 136 __le16 usrcode;
137 __u8 dlen; 137 __u8 dlen;
138} __attribute__((packed)); 138} __packed;
139 139
140/* 140/*
141 * A collection of functions for manipulating the sequence 141 * A collection of functions for manipulating the sequence
diff --git a/include/net/dn_route.h b/include/net/dn_route.h
index 60c9f22d8694..ccadab3aa3f6 100644
--- a/include/net/dn_route.h
+++ b/include/net/dn_route.h
@@ -65,9 +65,7 @@ extern void dn_rt_cache_flush(int delay);
65 * packets to the originating host. 65 * packets to the originating host.
66 */ 66 */
67struct dn_route { 67struct dn_route {
68 union { 68 struct dst_entry dst;
69 struct dst_entry dst;
70 } u;
71 69
72 struct flowi fl; 70 struct flowi fl;
73 71
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index eb551baafc04..f7dcd2c70412 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -68,26 +68,15 @@ struct genl_info {
68#endif 68#endif
69}; 69};
70 70
71#ifdef CONFIG_NET_NS
72static inline struct net *genl_info_net(struct genl_info *info) 71static inline struct net *genl_info_net(struct genl_info *info)
73{ 72{
74 return info->_net; 73 return read_pnet(&info->_net);
75} 74}
76 75
77static inline void genl_info_net_set(struct genl_info *info, struct net *net) 76static inline void genl_info_net_set(struct genl_info *info, struct net *net)
78{ 77{
79 info->_net = net; 78 write_pnet(&info->_net, net);
80} 79}
81#else
82static inline struct net *genl_info_net(struct genl_info *info)
83{
84 return &init_net;
85}
86
87static inline void genl_info_net_set(struct genl_info *info, struct net *net)
88{
89}
90#endif
91 80
92/** 81/**
93 * struct genl_ops - generic netlink operations 82 * struct genl_ops - generic netlink operations
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index 18c773286b91..22fac9892b16 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -1,8 +1,8 @@
1#ifndef _INET_COMMON_H 1#ifndef _INET_COMMON_H
2#define _INET_COMMON_H 2#define _INET_COMMON_H
3 3
4extern const struct proto_ops inet_stream_ops; 4extern const struct proto_ops inet_stream_ops;
5extern const struct proto_ops inet_dgram_ops; 5extern const struct proto_ops inet_dgram_ops;
6 6
7/* 7/*
8 * INET4 prototypes used by INET6 8 * INET4 prototypes used by INET6
@@ -13,37 +13,28 @@ struct sock;
13struct sockaddr; 13struct sockaddr;
14struct socket; 14struct socket;
15 15
16extern int inet_release(struct socket *sock); 16extern int inet_release(struct socket *sock);
17extern int inet_stream_connect(struct socket *sock, 17extern int inet_stream_connect(struct socket *sock, struct sockaddr * uaddr,
18 struct sockaddr * uaddr, 18 int addr_len, int flags);
19 int addr_len, int flags); 19extern int inet_dgram_connect(struct socket *sock, struct sockaddr * uaddr,
20extern int inet_dgram_connect(struct socket *sock, 20 int addr_len, int flags);
21 struct sockaddr * uaddr, 21extern int inet_accept(struct socket *sock, struct socket *newsock, int flags);
22 int addr_len, int flags); 22extern int inet_sendmsg(struct kiocb *iocb, struct socket *sock,
23extern int inet_accept(struct socket *sock, 23 struct msghdr *msg, size_t size);
24 struct socket *newsock, int flags); 24extern ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset,
25extern int inet_sendmsg(struct kiocb *iocb, 25 size_t size, int flags);
26 struct socket *sock, 26extern int inet_recvmsg(struct kiocb *iocb, struct socket *sock,
27 struct msghdr *msg, 27 struct msghdr *msg, size_t size, int flags);
28 size_t size); 28extern int inet_shutdown(struct socket *sock, int how);
29extern int inet_shutdown(struct socket *sock, int how); 29extern int inet_listen(struct socket *sock, int backlog);
30extern int inet_listen(struct socket *sock, int backlog); 30extern void inet_sock_destruct(struct sock *sk);
31 31extern int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len);
32extern void inet_sock_destruct(struct sock *sk); 32extern int inet_getname(struct socket *sock, struct sockaddr *uaddr,
33 33 int *uaddr_len, int peer);
34extern int inet_bind(struct socket *sock, 34extern int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
35 struct sockaddr *uaddr, int addr_len); 35extern int inet_ctl_sock_create(struct sock **sk, unsigned short family,
36extern int inet_getname(struct socket *sock, 36 unsigned short type, unsigned char protocol,
37 struct sockaddr *uaddr, 37 struct net *net);
38 int *uaddr_len, int peer);
39extern int inet_ioctl(struct socket *sock,
40 unsigned int cmd, unsigned long arg);
41
42extern int inet_ctl_sock_create(struct sock **sk,
43 unsigned short family,
44 unsigned short type,
45 unsigned char protocol,
46 struct net *net);
47 38
48static inline void inet_ctl_sock_destroy(struct sock *sk) 39static inline void inet_ctl_sock_destroy(struct sock *sk)
49{ 40{
@@ -51,5 +42,3 @@ static inline void inet_ctl_sock_destroy(struct sock *sk)
51} 42}
52 43
53#endif 44#endif
54
55
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 39f2dc943908..16ff29a7bb30 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -20,6 +20,7 @@ struct inet_frag_queue {
20 atomic_t refcnt; 20 atomic_t refcnt;
21 struct timer_list timer; /* when will this queue expire? */ 21 struct timer_list timer; /* when will this queue expire? */
22 struct sk_buff *fragments; /* list of received fragments */ 22 struct sk_buff *fragments; /* list of received fragments */
23 struct sk_buff *fragments_tail;
23 ktime_t stamp; 24 ktime_t stamp;
24 int len; /* total length of orig datagram */ 25 int len; /* total length of orig datagram */
25 int meat; 26 int meat;
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 1653de515cee..1989cfd7405f 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -137,7 +137,8 @@ struct inet_sock {
137 hdrincl:1, 137 hdrincl:1,
138 mc_loop:1, 138 mc_loop:1,
139 transparent:1, 139 transparent:1,
140 mc_all:1; 140 mc_all:1,
141 nodefrag:1;
141 int mc_index; 142 int mc_index;
142 __be32 mc_addr; 143 __be32 mc_addr;
143 struct ip_mc_socklist *mc_list; 144 struct ip_mc_socklist *mc_list;
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 87b1df0d4d8c..417d0c894f29 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -22,10 +22,21 @@ struct inet_peer {
22 __u32 dtime; /* the time of last use of not 22 __u32 dtime; /* the time of last use of not
23 * referenced entries */ 23 * referenced entries */
24 atomic_t refcnt; 24 atomic_t refcnt;
25 atomic_t rid; /* Frag reception counter */ 25 /*
26 atomic_t ip_id_count; /* IP ID for the next packet */ 26 * Once inet_peer is queued for deletion (refcnt == -1), following fields
27 __u32 tcp_ts; 27 * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp
28 __u32 tcp_ts_stamp; 28 * We can share memory with rcu_head to keep inet_peer small
29 * (less then 64 bytes)
30 */
31 union {
32 struct {
33 atomic_t rid; /* Frag reception counter */
34 atomic_t ip_id_count; /* IP ID for the next packet */
35 __u32 tcp_ts;
36 __u32 tcp_ts_stamp;
37 };
38 struct rcu_head rcu;
39 };
29}; 40};
30 41
31void inet_initpeers(void) __init; 42void inet_initpeers(void) __init;
@@ -36,10 +47,21 @@ struct inet_peer *inet_getpeer(__be32 daddr, int create);
36/* can be called from BH context or outside */ 47/* can be called from BH context or outside */
37extern void inet_putpeer(struct inet_peer *p); 48extern void inet_putpeer(struct inet_peer *p);
38 49
50/*
51 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts,
52 * tcp_ts_stamp if no refcount is taken on inet_peer
53 */
54static inline void inet_peer_refcheck(const struct inet_peer *p)
55{
56 WARN_ON_ONCE(atomic_read(&p->refcnt) <= 0);
57}
58
59
39/* can be called with or without local BH being disabled */ 60/* can be called with or without local BH being disabled */
40static inline __u16 inet_getid(struct inet_peer *p, int more) 61static inline __u16 inet_getid(struct inet_peer *p, int more)
41{ 62{
42 more++; 63 more++;
64 inet_peer_refcheck(p);
43 return atomic_add_return(more, &p->ip_id_count) - more; 65 return atomic_add_return(more, &p->ip_id_count) - more;
44} 66}
45 67
diff --git a/include/net/ip.h b/include/net/ip.h
index 452f229c380a..890f9725d681 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -61,11 +61,14 @@ struct ipcm_cookie {
61struct ip_ra_chain { 61struct ip_ra_chain {
62 struct ip_ra_chain *next; 62 struct ip_ra_chain *next;
63 struct sock *sk; 63 struct sock *sk;
64 void (*destructor)(struct sock *); 64 union {
65 void (*destructor)(struct sock *);
66 struct sock *saved_sk;
67 };
68 struct rcu_head rcu;
65}; 69};
66 70
67extern struct ip_ra_chain *ip_ra_chain; 71extern struct ip_ra_chain *ip_ra_chain;
68extern rwlock_t ip_ra_lock;
69 72
70/* IP flags. */ 73/* IP flags. */
71#define IP_CE 0x8000 /* Flag: "Congestion" */ 74#define IP_CE 0x8000 /* Flag: "Congestion" */
@@ -162,12 +165,12 @@ struct ipv4_config {
162}; 165};
163 166
164extern struct ipv4_config ipv4_config; 167extern struct ipv4_config ipv4_config;
165#define IP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.ip_statistics, field) 168#define IP_INC_STATS(net, field) SNMP_INC_STATS64((net)->mib.ip_statistics, field)
166#define IP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.ip_statistics, field) 169#define IP_INC_STATS_BH(net, field) SNMP_INC_STATS64_BH((net)->mib.ip_statistics, field)
167#define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.ip_statistics, field, val) 170#define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS64((net)->mib.ip_statistics, field, val)
168#define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS_BH((net)->mib.ip_statistics, field, val) 171#define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS64_BH((net)->mib.ip_statistics, field, val)
169#define IP_UPD_PO_STATS(net, field, val) SNMP_UPD_PO_STATS((net)->mib.ip_statistics, field, val) 172#define IP_UPD_PO_STATS(net, field, val) SNMP_UPD_PO_STATS64((net)->mib.ip_statistics, field, val)
170#define IP_UPD_PO_STATS_BH(net, field, val) SNMP_UPD_PO_STATS_BH((net)->mib.ip_statistics, field, val) 173#define IP_UPD_PO_STATS_BH(net, field, val) SNMP_UPD_PO_STATS64_BH((net)->mib.ip_statistics, field, val)
171#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field) 174#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field)
172#define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field) 175#define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field)
173#define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field) 176#define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field)
@@ -175,7 +178,15 @@ extern struct ipv4_config ipv4_config;
175#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) 178#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd)
176 179
177extern unsigned long snmp_fold_field(void __percpu *mib[], int offt); 180extern unsigned long snmp_fold_field(void __percpu *mib[], int offt);
178extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize); 181#if BITS_PER_LONG==32
182extern u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t sync_off);
183#else
184static inline u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t syncp_off)
185{
186 return snmp_fold_field(mib, offt);
187}
188#endif
189extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align);
179extern void snmp_mib_free(void __percpu *ptr[2]); 190extern void snmp_mib_free(void __percpu *ptr[2]);
180 191
181extern struct local_ports { 192extern struct local_ports {
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 4b1dc1161c37..062a823d311c 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -84,13 +84,11 @@ struct rt6key {
84struct fib6_table; 84struct fib6_table;
85 85
86struct rt6_info { 86struct rt6_info {
87 union { 87 struct dst_entry dst;
88 struct dst_entry dst;
89 } u;
90 88
91#define rt6i_dev u.dst.dev 89#define rt6i_dev dst.dev
92#define rt6i_nexthop u.dst.neighbour 90#define rt6i_nexthop dst.neighbour
93#define rt6i_expires u.dst.expires 91#define rt6i_expires dst.expires
94 92
95 /* 93 /*
96 * Tail elements of dst_entry (__refcnt etc.) 94 * Tail elements of dst_entry (__refcnt etc.)
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index fbf9d1cda27b..fc94ec568a50 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -27,6 +27,6 @@ struct ipv6_tlv_tnl_enc_lim {
27 __u8 type; /* type-code for option */ 27 __u8 type; /* type-code for option */
28 __u8 length; /* option length */ 28 __u8 length; /* option length */
29 __u8 encap_limit; /* tunnel encapsulation limit */ 29 __u8 encap_limit; /* tunnel encapsulation limit */
30} __attribute__ ((packed)); 30} __packed;
31 31
32#endif 32#endif
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index fe82b1e10a29..a4747a0f7303 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -632,10 +632,22 @@ extern struct ip_vs_conn *ip_vs_ct_in_get
632(int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port, 632(int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port,
633 const union nf_inet_addr *d_addr, __be16 d_port); 633 const union nf_inet_addr *d_addr, __be16 d_port);
634 634
635struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb,
636 struct ip_vs_protocol *pp,
637 const struct ip_vs_iphdr *iph,
638 unsigned int proto_off,
639 int inverse);
640
635extern struct ip_vs_conn *ip_vs_conn_out_get 641extern struct ip_vs_conn *ip_vs_conn_out_get
636(int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port, 642(int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port,
637 const union nf_inet_addr *d_addr, __be16 d_port); 643 const union nf_inet_addr *d_addr, __be16 d_port);
638 644
645struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb,
646 struct ip_vs_protocol *pp,
647 const struct ip_vs_iphdr *iph,
648 unsigned int proto_off,
649 int inverse);
650
639/* put back the conn without restarting its timer */ 651/* put back the conn without restarting its timer */
640static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) 652static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
641{ 653{
@@ -736,8 +748,6 @@ extern void ip_vs_app_inc_put(struct ip_vs_app *inc);
736 748
737extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); 749extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb);
738extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb); 750extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb);
739extern int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri,
740 char *o_buf, int o_len, char *n_buf, int n_len);
741extern int ip_vs_app_init(void); 751extern int ip_vs_app_init(void);
742extern void ip_vs_app_cleanup(void); 752extern void ip_vs_app_cleanup(void);
743 753
diff --git a/include/net/ipip.h b/include/net/ipip.h
index 11e8513d2d07..65caea8b414f 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -50,7 +50,7 @@ struct ip_tunnel_prl_entry {
50 int pkt_len = skb->len - skb_transport_offset(skb); \ 50 int pkt_len = skb->len - skb_transport_offset(skb); \
51 \ 51 \
52 skb->ip_summed = CHECKSUM_NONE; \ 52 skb->ip_summed = CHECKSUM_NONE; \
53 ip_select_ident(iph, &rt->u.dst, NULL); \ 53 ip_select_ident(iph, &rt->dst, NULL); \
54 \ 54 \
55 err = ip_local_out(skb); \ 55 err = ip_local_out(skb); \
56 if (likely(net_xmit_eval(err) == 0)) { \ 56 if (likely(net_xmit_eval(err) == 0)) { \
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 2600b69757b8..1f8412410998 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -136,17 +136,17 @@ extern struct ctl_path net_ipv6_ctl_path[];
136/* MIBs */ 136/* MIBs */
137 137
138#define IP6_INC_STATS(net, idev,field) \ 138#define IP6_INC_STATS(net, idev,field) \
139 _DEVINC(net, ipv6, , idev, field) 139 _DEVINC(net, ipv6, 64, idev, field)
140#define IP6_INC_STATS_BH(net, idev,field) \ 140#define IP6_INC_STATS_BH(net, idev,field) \
141 _DEVINC(net, ipv6, _BH, idev, field) 141 _DEVINC(net, ipv6, 64_BH, idev, field)
142#define IP6_ADD_STATS(net, idev,field,val) \ 142#define IP6_ADD_STATS(net, idev,field,val) \
143 _DEVADD(net, ipv6, , idev, field, val) 143 _DEVADD(net, ipv6, 64, idev, field, val)
144#define IP6_ADD_STATS_BH(net, idev,field,val) \ 144#define IP6_ADD_STATS_BH(net, idev,field,val) \
145 _DEVADD(net, ipv6, _BH, idev, field, val) 145 _DEVADD(net, ipv6, 64_BH, idev, field, val)
146#define IP6_UPD_PO_STATS(net, idev,field,val) \ 146#define IP6_UPD_PO_STATS(net, idev,field,val) \
147 _DEVUPD(net, ipv6, , idev, field, val) 147 _DEVUPD(net, ipv6, 64, idev, field, val)
148#define IP6_UPD_PO_STATS_BH(net, idev,field,val) \ 148#define IP6_UPD_PO_STATS_BH(net, idev,field,val) \
149 _DEVUPD(net, ipv6, _BH, idev, field, val) 149 _DEVUPD(net, ipv6, 64_BH, idev, field, val)
150#define ICMP6_INC_STATS(net, idev, field) \ 150#define ICMP6_INC_STATS(net, idev, field) \
151 _DEVINC(net, icmpv6, , idev, field) 151 _DEVINC(net, icmpv6, , idev, field)
152#define ICMP6_INC_STATS_BH(net, idev, field) \ 152#define ICMP6_INC_STATS_BH(net, idev, field) \
@@ -551,6 +551,10 @@ extern int ipv6_ext_hdr(u8 nexthdr);
551 551
552extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); 552extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
553 553
554extern struct in6_addr *fl6_update_dst(struct flowi *fl,
555 const struct ipv6_txoptions *opt,
556 struct in6_addr *orig);
557
554/* 558/*
555 * socket options (ipv6_sockglue.c) 559 * socket options (ipv6_sockglue.c)
556 */ 560 */
diff --git a/include/net/ipx.h b/include/net/ipx.h
index ef51a668ba19..05d7e4a88b49 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -27,9 +27,9 @@ struct ipx_address {
27#define IPX_MAX_PPROP_HOPS 8 27#define IPX_MAX_PPROP_HOPS 8
28 28
29struct ipxhdr { 29struct ipxhdr {
30 __be16 ipx_checksum __attribute__ ((packed)); 30 __be16 ipx_checksum __packed;
31#define IPX_NO_CHECKSUM cpu_to_be16(0xFFFF) 31#define IPX_NO_CHECKSUM cpu_to_be16(0xFFFF)
32 __be16 ipx_pktsize __attribute__ ((packed)); 32 __be16 ipx_pktsize __packed;
33 __u8 ipx_tctrl; 33 __u8 ipx_tctrl;
34 __u8 ipx_type; 34 __u8 ipx_type;
35#define IPX_TYPE_UNKNOWN 0x00 35#define IPX_TYPE_UNKNOWN 0x00
@@ -38,8 +38,8 @@ struct ipxhdr {
38#define IPX_TYPE_SPX 0x05 /* SPX protocol */ 38#define IPX_TYPE_SPX 0x05 /* SPX protocol */
39#define IPX_TYPE_NCP 0x11 /* $lots for docs on this (SPIT) */ 39#define IPX_TYPE_NCP 0x11 /* $lots for docs on this (SPIT) */
40#define IPX_TYPE_PPROP 0x14 /* complicated flood fill brdcast */ 40#define IPX_TYPE_PPROP 0x14 /* complicated flood fill brdcast */
41 struct ipx_address ipx_dest __attribute__ ((packed)); 41 struct ipx_address ipx_dest __packed;
42 struct ipx_address ipx_source __attribute__ ((packed)); 42 struct ipx_address ipx_source __packed;
43}; 43};
44 44
45static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb) 45static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h
index 7e582061b230..3bed61d379a8 100644
--- a/include/net/irda/irda.h
+++ b/include/net/irda/irda.h
@@ -53,10 +53,6 @@ typedef __u32 magic_t;
53#ifndef IRDA_ALIGN 53#ifndef IRDA_ALIGN
54# define IRDA_ALIGN __attribute__((aligned)) 54# define IRDA_ALIGN __attribute__((aligned))
55#endif 55#endif
56#ifndef IRDA_PACK
57# define IRDA_PACK __attribute__((packed))
58#endif
59
60 56
61#ifdef CONFIG_IRDA_DEBUG 57#ifdef CONFIG_IRDA_DEBUG
62 58
diff --git a/include/net/irda/irlap_frame.h b/include/net/irda/irlap_frame.h
index 641f88e848bd..6b1dc4f8eca5 100644
--- a/include/net/irda/irlap_frame.h
+++ b/include/net/irda/irlap_frame.h
@@ -85,7 +85,7 @@ struct discovery_t;
85struct disc_frame { 85struct disc_frame {
86 __u8 caddr; /* Connection address */ 86 __u8 caddr; /* Connection address */
87 __u8 control; 87 __u8 control;
88} IRDA_PACK; 88} __packed;
89 89
90struct xid_frame { 90struct xid_frame {
91 __u8 caddr; /* Connection address */ 91 __u8 caddr; /* Connection address */
@@ -96,41 +96,41 @@ struct xid_frame {
96 __u8 flags; /* Discovery flags */ 96 __u8 flags; /* Discovery flags */
97 __u8 slotnr; 97 __u8 slotnr;
98 __u8 version; 98 __u8 version;
99} IRDA_PACK; 99} __packed;
100 100
101struct test_frame { 101struct test_frame {
102 __u8 caddr; /* Connection address */ 102 __u8 caddr; /* Connection address */
103 __u8 control; 103 __u8 control;
104 __le32 saddr; /* Source device address */ 104 __le32 saddr; /* Source device address */
105 __le32 daddr; /* Destination device address */ 105 __le32 daddr; /* Destination device address */
106} IRDA_PACK; 106} __packed;
107 107
108struct ua_frame { 108struct ua_frame {
109 __u8 caddr; 109 __u8 caddr;
110 __u8 control; 110 __u8 control;
111 __le32 saddr; /* Source device address */ 111 __le32 saddr; /* Source device address */
112 __le32 daddr; /* Dest device address */ 112 __le32 daddr; /* Dest device address */
113} IRDA_PACK; 113} __packed;
114 114
115struct dm_frame { 115struct dm_frame {
116 __u8 caddr; /* Connection address */ 116 __u8 caddr; /* Connection address */
117 __u8 control; 117 __u8 control;
118} IRDA_PACK; 118} __packed;
119 119
120struct rd_frame { 120struct rd_frame {
121 __u8 caddr; /* Connection address */ 121 __u8 caddr; /* Connection address */
122 __u8 control; 122 __u8 control;
123} IRDA_PACK; 123} __packed;
124 124
125struct rr_frame { 125struct rr_frame {
126 __u8 caddr; /* Connection address */ 126 __u8 caddr; /* Connection address */
127 __u8 control; 127 __u8 control;
128} IRDA_PACK; 128} __packed;
129 129
130struct i_frame { 130struct i_frame {
131 __u8 caddr; 131 __u8 caddr;
132 __u8 control; 132 __u8 control;
133} IRDA_PACK; 133} __packed;
134 134
135struct snrm_frame { 135struct snrm_frame {
136 __u8 caddr; 136 __u8 caddr;
@@ -138,7 +138,7 @@ struct snrm_frame {
138 __le32 saddr; 138 __le32 saddr;
139 __le32 daddr; 139 __le32 daddr;
140 __u8 ncaddr; 140 __u8 ncaddr;
141} IRDA_PACK; 141} __packed;
142 142
143void irlap_queue_xmit(struct irlap_cb *self, struct sk_buff *skb); 143void irlap_queue_xmit(struct irlap_cb *self, struct sk_buff *skb);
144void irlap_send_discovery_xid_frame(struct irlap_cb *, int S, __u8 s, 144void irlap_send_discovery_xid_frame(struct irlap_cb *, int S, __u8 s,
diff --git a/include/net/lib80211.h b/include/net/lib80211.h
index fb4e2784857d..848cce1bb7a5 100644
--- a/include/net/lib80211.h
+++ b/include/net/lib80211.h
@@ -54,9 +54,6 @@ struct lib80211_crypto_ops {
54 /* deinitialize crypto context and free allocated private data */ 54 /* deinitialize crypto context and free allocated private data */
55 void (*deinit) (void *priv); 55 void (*deinit) (void *priv);
56 56
57 int (*build_iv) (struct sk_buff * skb, int hdr_len,
58 u8 *key, int keylen, void *priv);
59
60 /* encrypt/decrypt return < 0 on error or >= 0 on success. The return 57 /* encrypt/decrypt return < 0 on error or >= 0 on success. The return
61 * value from decrypt_mpdu is passed as the keyidx value for 58 * value from decrypt_mpdu is passed as the keyidx value for
62 * decrypt_msdu. skb must have enough head and tail room for the 59 * decrypt_msdu. skb must have enough head and tail room for the
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index de22cbfef232..b0787a1dea90 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -146,6 +146,9 @@ struct ieee80211_low_level_stats {
146 * enabled/disabled (beaconing modes) 146 * enabled/disabled (beaconing modes)
147 * @BSS_CHANGED_CQM: Connection quality monitor config changed 147 * @BSS_CHANGED_CQM: Connection quality monitor config changed
148 * @BSS_CHANGED_IBSS: IBSS join status changed 148 * @BSS_CHANGED_IBSS: IBSS join status changed
149 * @BSS_CHANGED_ARP_FILTER: Hardware ARP filter address list or state changed.
150 * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note
151 * that it is only ever disabled for station mode.
149 */ 152 */
150enum ieee80211_bss_change { 153enum ieee80211_bss_change {
151 BSS_CHANGED_ASSOC = 1<<0, 154 BSS_CHANGED_ASSOC = 1<<0,
@@ -160,10 +163,19 @@ enum ieee80211_bss_change {
160 BSS_CHANGED_BEACON_ENABLED = 1<<9, 163 BSS_CHANGED_BEACON_ENABLED = 1<<9,
161 BSS_CHANGED_CQM = 1<<10, 164 BSS_CHANGED_CQM = 1<<10,
162 BSS_CHANGED_IBSS = 1<<11, 165 BSS_CHANGED_IBSS = 1<<11,
166 BSS_CHANGED_ARP_FILTER = 1<<12,
167 BSS_CHANGED_QOS = 1<<13,
163 168
164 /* when adding here, make sure to change ieee80211_reconfig */ 169 /* when adding here, make sure to change ieee80211_reconfig */
165}; 170};
166 171
172/*
173 * The maximum number of IPv4 addresses listed for ARP filtering. If the number
174 * of addresses for an interface increase beyond this value, hardware ARP
175 * filtering will be disabled.
176 */
177#define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4
178
167/** 179/**
168 * struct ieee80211_bss_conf - holds the BSS's changing parameters 180 * struct ieee80211_bss_conf - holds the BSS's changing parameters
169 * 181 *
@@ -182,7 +194,9 @@ enum ieee80211_bss_change {
182 * if the hardware cannot handle this it must set the 194 * if the hardware cannot handle this it must set the
183 * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag 195 * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag
184 * @dtim_period: num of beacons before the next DTIM, for beaconing, 196 * @dtim_period: num of beacons before the next DTIM, for beaconing,
185 * not valid in station mode (cf. hw conf ps_dtim_period) 197 * valid in station mode only while @assoc is true and if also
198 * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf
199 * @ps_dtim_period)
186 * @timestamp: beacon timestamp 200 * @timestamp: beacon timestamp
187 * @beacon_int: beacon interval 201 * @beacon_int: beacon interval
188 * @assoc_capability: capabilities taken from assoc resp 202 * @assoc_capability: capabilities taken from assoc resp
@@ -199,6 +213,16 @@ enum ieee80211_bss_change {
199 * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value 213 * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value
200 * implies disabled 214 * implies disabled
201 * @cqm_rssi_hyst: Connection quality monitor RSSI hysteresis 215 * @cqm_rssi_hyst: Connection quality monitor RSSI hysteresis
216 * @arp_addr_list: List of IPv4 addresses for hardware ARP filtering. The
217 * may filter ARP queries targeted for other addresses than listed here.
218 * The driver must allow ARP queries targeted for all address listed here
219 * to pass through. An empty list implies no ARP queries need to pass.
220 * @arp_addr_cnt: Number of addresses currently on the list.
221 * @arp_filter_enabled: Enable ARP filtering - if enabled, the hardware may
222 * filter ARP queries based on the @arp_addr_list, if disabled, the
223 * hardware must not perform any ARP filtering. Note, that the filter will
224 * be enabled also in promiscuous mode.
225 * @qos: This is a QoS-enabled BSS.
202 */ 226 */
203struct ieee80211_bss_conf { 227struct ieee80211_bss_conf {
204 const u8 *bssid; 228 const u8 *bssid;
@@ -219,6 +243,10 @@ struct ieee80211_bss_conf {
219 s32 cqm_rssi_thold; 243 s32 cqm_rssi_thold;
220 u32 cqm_rssi_hyst; 244 u32 cqm_rssi_hyst;
221 enum nl80211_channel_type channel_type; 245 enum nl80211_channel_type channel_type;
246 __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN];
247 u8 arp_addr_cnt;
248 bool arp_filter_enabled;
249 bool qos;
222}; 250};
223 251
224/** 252/**
@@ -312,9 +340,10 @@ enum mac80211_tx_control_flags {
312 IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21), 340 IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21),
313 IEEE80211_TX_CTL_LDPC = BIT(22), 341 IEEE80211_TX_CTL_LDPC = BIT(22),
314 IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24), 342 IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24),
315#define IEEE80211_TX_CTL_STBC_SHIFT 23
316}; 343};
317 344
345#define IEEE80211_TX_CTL_STBC_SHIFT 23
346
318/** 347/**
319 * enum mac80211_rate_control_flags - per-rate flags set by the 348 * enum mac80211_rate_control_flags - per-rate flags set by the
320 * Rate Control algorithm. 349 * Rate Control algorithm.
@@ -390,7 +419,7 @@ struct ieee80211_tx_rate {
390 s8 idx; 419 s8 idx;
391 u8 count; 420 u8 count;
392 u8 flags; 421 u8 flags;
393} __attribute__((packed)); 422} __packed;
394 423
395/** 424/**
396 * struct ieee80211_tx_info - skb transmit information 425 * struct ieee80211_tx_info - skb transmit information
@@ -412,8 +441,6 @@ struct ieee80211_tx_rate {
412 * @driver_data: array of driver_data pointers 441 * @driver_data: array of driver_data pointers
413 * @ampdu_ack_len: number of acked aggregated frames. 442 * @ampdu_ack_len: number of acked aggregated frames.
414 * relevant only if IEEE80211_TX_STAT_AMPDU was set. 443 * relevant only if IEEE80211_TX_STAT_AMPDU was set.
415 * @ampdu_ack_map: block ack bit map for the aggregation.
416 * relevant only if IEEE80211_TX_STAT_AMPDU was set.
417 * @ampdu_len: number of aggregated frames. 444 * @ampdu_len: number of aggregated frames.
418 * relevant only if IEEE80211_TX_STAT_AMPDU was set. 445 * relevant only if IEEE80211_TX_STAT_AMPDU was set.
419 * @ack_signal: signal strength of the ACK frame 446 * @ack_signal: signal strength of the ACK frame
@@ -448,10 +475,9 @@ struct ieee80211_tx_info {
448 struct { 475 struct {
449 struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES]; 476 struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
450 u8 ampdu_ack_len; 477 u8 ampdu_ack_len;
451 u64 ampdu_ack_map;
452 int ack_signal; 478 int ack_signal;
453 u8 ampdu_len; 479 u8 ampdu_len;
454 /* 7 bytes free */ 480 /* 15 bytes free */
455 } status; 481 } status;
456 struct { 482 struct {
457 struct ieee80211_tx_rate driver_rates[ 483 struct ieee80211_tx_rate driver_rates[
@@ -601,15 +627,14 @@ struct ieee80211_rx_status {
601 * may turn the device off as much as possible. Typically, this flag will 627 * may turn the device off as much as possible. Typically, this flag will
602 * be set when an interface is set UP but not associated or scanning, but 628 * be set when an interface is set UP but not associated or scanning, but
603 * it can also be unset in that case when monitor interfaces are active. 629 * it can also be unset in that case when monitor interfaces are active.
604 * @IEEE80211_CONF_QOS: Enable 802.11e QoS also know as WMM (Wireless 630 * @IEEE80211_CONF_OFFCHANNEL: The device is currently not on its main
605 * Multimedia). On some drivers (iwlwifi is one of know) we have 631 * operating channel.
606 * to enable/disable QoS explicitly.
607 */ 632 */
608enum ieee80211_conf_flags { 633enum ieee80211_conf_flags {
609 IEEE80211_CONF_MONITOR = (1<<0), 634 IEEE80211_CONF_MONITOR = (1<<0),
610 IEEE80211_CONF_PS = (1<<1), 635 IEEE80211_CONF_PS = (1<<1),
611 IEEE80211_CONF_IDLE = (1<<2), 636 IEEE80211_CONF_IDLE = (1<<2),
612 IEEE80211_CONF_QOS = (1<<3), 637 IEEE80211_CONF_OFFCHANNEL = (1<<3),
613}; 638};
614 639
615 640
@@ -624,7 +649,6 @@ enum ieee80211_conf_flags {
624 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed 649 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
625 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed 650 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
626 * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed 651 * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed
627 * @IEEE80211_CONF_CHANGE_QOS: Quality of service was enabled or disabled
628 */ 652 */
629enum ieee80211_conf_changed { 653enum ieee80211_conf_changed {
630 IEEE80211_CONF_CHANGE_SMPS = BIT(1), 654 IEEE80211_CONF_CHANGE_SMPS = BIT(1),
@@ -635,7 +659,6 @@ enum ieee80211_conf_changed {
635 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), 659 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6),
636 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7), 660 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7),
637 IEEE80211_CONF_CHANGE_IDLE = BIT(8), 661 IEEE80211_CONF_CHANGE_IDLE = BIT(8),
638 IEEE80211_CONF_CHANGE_QOS = BIT(9),
639}; 662};
640 663
641/** 664/**
@@ -676,9 +699,6 @@ enum ieee80211_smps_mode {
676 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the 699 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
677 * powersave documentation below. This variable is valid only when 700 * powersave documentation below. This variable is valid only when
678 * the CONF_PS flag is set. 701 * the CONF_PS flag is set.
679 * @dynamic_ps_forced_timeout: The dynamic powersave timeout (in ms) configured
680 * by cfg80211 (essentially, wext) If set, this value overrules the value
681 * chosen by mac80211 based on ps qos network latency.
682 * 702 *
683 * @power_level: requested transmit power (in dBm) 703 * @power_level: requested transmit power (in dBm)
684 * 704 *
@@ -698,7 +718,7 @@ enum ieee80211_smps_mode {
698 */ 718 */
699struct ieee80211_conf { 719struct ieee80211_conf {
700 u32 flags; 720 u32 flags;
701 int power_level, dynamic_ps_timeout, dynamic_ps_forced_timeout; 721 int power_level, dynamic_ps_timeout;
702 int max_sleep_period; 722 int max_sleep_period;
703 723
704 u16 listen_interval; 724 u16 listen_interval;
@@ -815,7 +835,6 @@ enum ieee80211_key_flags {
815 * encrypted in hardware. 835 * encrypted in hardware.
816 * @alg: The key algorithm. 836 * @alg: The key algorithm.
817 * @flags: key flags, see &enum ieee80211_key_flags. 837 * @flags: key flags, see &enum ieee80211_key_flags.
818 * @ap_addr: AP's MAC address
819 * @keyidx: the key index (0-3) 838 * @keyidx: the key index (0-3)
820 * @keylen: key material length 839 * @keylen: key material length
821 * @key: key material. For ALG_TKIP the key is encoded as a 256-bit (32 byte) 840 * @key: key material. For ALG_TKIP the key is encoded as a 256-bit (32 byte)
@@ -881,16 +900,12 @@ struct ieee80211_sta {
881 * enum sta_notify_cmd - sta notify command 900 * enum sta_notify_cmd - sta notify command
882 * 901 *
883 * Used with the sta_notify() callback in &struct ieee80211_ops, this 902 * Used with the sta_notify() callback in &struct ieee80211_ops, this
884 * indicates addition and removal of a station to station table, 903 * indicates if an associated station made a power state transition.
885 * or if a associated station made a power state transition.
886 * 904 *
887 * @STA_NOTIFY_ADD: (DEPRECATED) a station was added to the station table
888 * @STA_NOTIFY_REMOVE: (DEPRECATED) a station being removed from the station table
889 * @STA_NOTIFY_SLEEP: a station is now sleeping 905 * @STA_NOTIFY_SLEEP: a station is now sleeping
890 * @STA_NOTIFY_AWAKE: a sleeping station woke up 906 * @STA_NOTIFY_AWAKE: a sleeping station woke up
891 */ 907 */
892enum sta_notify_cmd { 908enum sta_notify_cmd {
893 STA_NOTIFY_ADD, STA_NOTIFY_REMOVE,
894 STA_NOTIFY_SLEEP, STA_NOTIFY_AWAKE, 909 STA_NOTIFY_SLEEP, STA_NOTIFY_AWAKE,
895}; 910};
896 911
@@ -1014,6 +1029,9 @@ enum ieee80211_tkip_key_type {
1014 * connection quality related parameters, such as the RSSI level and 1029 * connection quality related parameters, such as the RSSI level and
1015 * provide notifications if configured trigger levels are reached. 1030 * provide notifications if configured trigger levels are reached.
1016 * 1031 *
1032 * @IEEE80211_HW_NEED_DTIM_PERIOD:
1033 * This device needs to know the DTIM period for the BSS before
1034 * associating.
1017 */ 1035 */
1018enum ieee80211_hw_flags { 1036enum ieee80211_hw_flags {
1019 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1037 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1023,7 +1041,7 @@ enum ieee80211_hw_flags {
1023 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4, 1041 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4,
1024 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5, 1042 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5,
1025 IEEE80211_HW_SIGNAL_DBM = 1<<6, 1043 IEEE80211_HW_SIGNAL_DBM = 1<<6,
1026 /* use this hole */ 1044 IEEE80211_HW_NEED_DTIM_PERIOD = 1<<7,
1027 IEEE80211_HW_SPECTRUM_MGMT = 1<<8, 1045 IEEE80211_HW_SPECTRUM_MGMT = 1<<8,
1028 IEEE80211_HW_AMPDU_AGGREGATION = 1<<9, 1046 IEEE80211_HW_AMPDU_AGGREGATION = 1<<9,
1029 IEEE80211_HW_SUPPORTS_PS = 1<<10, 1047 IEEE80211_HW_SUPPORTS_PS = 1<<10,
@@ -1260,6 +1278,15 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1260 * dynamic PS feature in stack and will just keep %IEEE80211_CONF_PS 1278 * dynamic PS feature in stack and will just keep %IEEE80211_CONF_PS
1261 * enabled whenever user has enabled powersave. 1279 * enabled whenever user has enabled powersave.
1262 * 1280 *
1281 * Some hardware need to toggle a single shared antenna between WLAN and
1282 * Bluetooth to facilitate co-existence. These types of hardware set
1283 * limitations on the use of host controlled dynamic powersave whenever there
1284 * is simultaneous WLAN and Bluetooth traffic. For these types of hardware, the
1285 * driver may request temporarily going into full power save, in order to
1286 * enable toggling the antenna between BT and WLAN. If the driver requests
1287 * disabling dynamic powersave, the @dynamic_ps_timeout value will be
1288 * temporarily set to zero until the driver re-enables dynamic powersave.
1289 *
1263 * Driver informs U-APSD client support by enabling 1290 * Driver informs U-APSD client support by enabling
1264 * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the 1291 * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the
1265 * uapsd paramater in conf_tx() operation. Hardware needs to send the QoS 1292 * uapsd paramater in conf_tx() operation. Hardware needs to send the QoS
@@ -1451,7 +1478,7 @@ enum ieee80211_filter_flags {
1451 * 1478 *
1452 * Note that drivers MUST be able to deal with a TX aggregation 1479 * Note that drivers MUST be able to deal with a TX aggregation
1453 * session being stopped even before they OK'ed starting it by 1480 * session being stopped even before they OK'ed starting it by
1454 * calling ieee80211_start_tx_ba_cb(_irqsafe), because the peer 1481 * calling ieee80211_start_tx_ba_cb_irqsafe, because the peer
1455 * might receive the addBA frame and send a delBA right away! 1482 * might receive the addBA frame and send a delBA right away!
1456 * 1483 *
1457 * @IEEE80211_AMPDU_RX_START: start Rx aggregation 1484 * @IEEE80211_AMPDU_RX_START: start Rx aggregation
@@ -1636,7 +1663,7 @@ enum ieee80211_ampdu_mlme_action {
1636 * is the first frame we expect to perform the action on. Notice 1663 * is the first frame we expect to perform the action on. Notice
1637 * that TX/RX_STOP can pass NULL for this parameter. 1664 * that TX/RX_STOP can pass NULL for this parameter.
1638 * Returns a negative error code on failure. 1665 * Returns a negative error code on failure.
1639 * The callback must be atomic. 1666 * The callback can sleep.
1640 * 1667 *
1641 * @get_survey: Return per-channel survey information 1668 * @get_survey: Return per-channel survey information
1642 * 1669 *
@@ -2307,25 +2334,14 @@ void ieee80211_queue_delayed_work(struct ieee80211_hw *hw,
2307int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid); 2334int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid);
2308 2335
2309/** 2336/**
2310 * ieee80211_start_tx_ba_cb - low level driver ready to aggregate.
2311 * @vif: &struct ieee80211_vif pointer from the add_interface callback
2312 * @ra: receiver address of the BA session recipient.
2313 * @tid: the TID to BA on.
2314 *
2315 * This function must be called by low level driver once it has
2316 * finished with preparations for the BA session.
2317 */
2318void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid);
2319
2320/**
2321 * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate. 2337 * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate.
2322 * @vif: &struct ieee80211_vif pointer from the add_interface callback 2338 * @vif: &struct ieee80211_vif pointer from the add_interface callback
2323 * @ra: receiver address of the BA session recipient. 2339 * @ra: receiver address of the BA session recipient.
2324 * @tid: the TID to BA on. 2340 * @tid: the TID to BA on.
2325 * 2341 *
2326 * This function must be called by low level driver once it has 2342 * This function must be called by low level driver once it has
2327 * finished with preparations for the BA session. 2343 * finished with preparations for the BA session. It can be called
2328 * This version of the function is IRQ-safe. 2344 * from any context.
2329 */ 2345 */
2330void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra, 2346void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
2331 u16 tid); 2347 u16 tid);
@@ -2334,27 +2350,14 @@ void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
2334 * ieee80211_stop_tx_ba_session - Stop a Block Ack session. 2350 * ieee80211_stop_tx_ba_session - Stop a Block Ack session.
2335 * @sta: the station whose BA session to stop 2351 * @sta: the station whose BA session to stop
2336 * @tid: the TID to stop BA. 2352 * @tid: the TID to stop BA.
2337 * @initiator: if indicates initiator DELBA frame will be sent.
2338 * 2353 *
2339 * Return: error if no sta with matching da found, success otherwise 2354 * Return: negative error if the TID is invalid, or no aggregation active
2340 * 2355 *
2341 * Although mac80211/low level driver/user space application can estimate 2356 * Although mac80211/low level driver/user space application can estimate
2342 * the need to stop aggregation on a certain RA/TID, the session level 2357 * the need to stop aggregation on a certain RA/TID, the session level
2343 * will be managed by the mac80211. 2358 * will be managed by the mac80211.
2344 */ 2359 */
2345int ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, u16 tid, 2360int ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, u16 tid);
2346 enum ieee80211_back_parties initiator);
2347
2348/**
2349 * ieee80211_stop_tx_ba_cb - low level driver ready to stop aggregate.
2350 * @vif: &struct ieee80211_vif pointer from the add_interface callback
2351 * @ra: receiver address of the BA session recipient.
2352 * @tid: the desired TID to BA on.
2353 *
2354 * This function must be called by low level driver once it has
2355 * finished with preparations for the BA session tear down.
2356 */
2357void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid);
2358 2361
2359/** 2362/**
2360 * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate. 2363 * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate.
@@ -2363,8 +2366,8 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid);
2363 * @tid: the desired TID to BA on. 2366 * @tid: the desired TID to BA on.
2364 * 2367 *
2365 * This function must be called by low level driver once it has 2368 * This function must be called by low level driver once it has
2366 * finished with preparations for the BA session tear down. 2369 * finished with preparations for the BA session tear down. It
2367 * This version of the function is IRQ-safe. 2370 * can be called from any context.
2368 */ 2371 */
2369void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra, 2372void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
2370 u16 tid); 2373 u16 tid);
@@ -2460,6 +2463,36 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif);
2460void ieee80211_connection_loss(struct ieee80211_vif *vif); 2463void ieee80211_connection_loss(struct ieee80211_vif *vif);
2461 2464
2462/** 2465/**
2466 * ieee80211_disable_dyn_ps - force mac80211 to temporarily disable dynamic psm
2467 *
2468 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2469 *
2470 * Some hardware require full power save to manage simultaneous BT traffic
2471 * on the WLAN frequency. Full PSM is required periodically, whenever there are
2472 * burst of BT traffic. The hardware gets information of BT traffic via
2473 * hardware co-existence lines, and consequentially requests mac80211 to
2474 * (temporarily) enter full psm.
2475 * This function will only temporarily disable dynamic PS, not enable PSM if
2476 * it was not already enabled.
2477 * The driver must make sure to re-enable dynamic PS using
2478 * ieee80211_enable_dyn_ps() if the driver has disabled it.
2479 *
2480 */
2481void ieee80211_disable_dyn_ps(struct ieee80211_vif *vif);
2482
2483/**
2484 * ieee80211_enable_dyn_ps - restore dynamic psm after being disabled
2485 *
2486 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2487 *
2488 * This function restores dynamic PS after being temporarily disabled via
2489 * ieee80211_disable_dyn_ps(). Each ieee80211_disable_dyn_ps() call must
2490 * be coupled with an eventual call to this function.
2491 *
2492 */
2493void ieee80211_enable_dyn_ps(struct ieee80211_vif *vif);
2494
2495/**
2463 * ieee80211_cqm_rssi_notify - inform a configured connection quality monitoring 2496 * ieee80211_cqm_rssi_notify - inform a configured connection quality monitoring
2464 * rssi threshold triggered 2497 * rssi threshold triggered
2465 * 2498 *
diff --git a/include/net/mip6.h b/include/net/mip6.h
index a83ad1982a90..26ba99b5a4b1 100644
--- a/include/net/mip6.h
+++ b/include/net/mip6.h
@@ -39,7 +39,7 @@ struct ip6_mh {
39 __u16 ip6mh_cksum; 39 __u16 ip6mh_cksum;
40 /* Followed by type specific messages */ 40 /* Followed by type specific messages */
41 __u8 data[0]; 41 __u8 data[0];
42} __attribute__ ((__packed__)); 42} __packed;
43 43
44#define IP6_MH_TYPE_BRR 0 /* Binding Refresh Request */ 44#define IP6_MH_TYPE_BRR 0 /* Binding Refresh Request */
45#define IP6_MH_TYPE_HOTI 1 /* HOTI Message */ 45#define IP6_MH_TYPE_HOTI 1 /* HOTI Message */
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index f76f22d05721..895997bc2ead 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -82,7 +82,7 @@ struct ra_msg {
82struct nd_opt_hdr { 82struct nd_opt_hdr {
83 __u8 nd_opt_type; 83 __u8 nd_opt_type;
84 __u8 nd_opt_len; 84 __u8 nd_opt_len;
85} __attribute__((__packed__)); 85} __packed;
86 86
87 87
88extern int ndisc_init(void); 88extern int ndisc_init(void);
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index eb21340a573b..242879b6c4df 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -151,7 +151,7 @@ struct neigh_table {
151 void (*proxy_redo)(struct sk_buff *skb); 151 void (*proxy_redo)(struct sk_buff *skb);
152 char *id; 152 char *id;
153 struct neigh_parms parms; 153 struct neigh_parms parms;
154 /* HACK. gc_* shoul follow parms without a gap! */ 154 /* HACK. gc_* should follow parms without a gap! */
155 int gc_interval; 155 int gc_interval;
156 int gc_thresh1; 156 int gc_thresh1;
157 int gc_thresh2; 157 int gc_thresh2;
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index bde095f7e845..e624dae54fa4 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -152,11 +152,7 @@ extern struct net init_net;
152 152
153static inline struct net *nf_ct_net(const struct nf_conn *ct) 153static inline struct net *nf_ct_net(const struct nf_conn *ct)
154{ 154{
155#ifdef CONFIG_NET_NS 155 return read_pnet(&ct->ct_net);
156 return ct->ct_net;
157#else
158 return &init_net;
159#endif
160} 156}
161 157
162/* Alter reply tuple (maybe alter helper). */ 158/* Alter reply tuple (maybe alter helper). */
@@ -261,7 +257,12 @@ extern s16 (*nf_ct_nat_offset)(const struct nf_conn *ct,
261 u32 seq); 257 u32 seq);
262 258
263/* Fake conntrack entry for untracked connections */ 259/* Fake conntrack entry for untracked connections */
264extern struct nf_conn nf_conntrack_untracked; 260DECLARE_PER_CPU(struct nf_conn, nf_conntrack_untracked);
261static inline struct nf_conn *nf_ct_untracked_get(void)
262{
263 return &__raw_get_cpu_var(nf_conntrack_untracked);
264}
265extern void nf_ct_untracked_status_or(unsigned long bits);
265 266
266/* Iterate over all conntracks: if iter returns true, it's deleted. */ 267/* Iterate over all conntracks: if iter returns true, it's deleted. */
267extern void 268extern void
@@ -289,9 +290,9 @@ static inline int nf_ct_is_dying(struct nf_conn *ct)
289 return test_bit(IPS_DYING_BIT, &ct->status); 290 return test_bit(IPS_DYING_BIT, &ct->status);
290} 291}
291 292
292static inline int nf_ct_is_untracked(const struct sk_buff *skb) 293static inline int nf_ct_is_untracked(const struct nf_conn *ct)
293{ 294{
294 return (skb->nfct == &nf_conntrack_untracked.ct_general); 295 return test_bit(IPS_UNTRACKED_BIT, &ct->status);
295} 296}
296 297
297extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); 298extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp);
diff --git a/include/net/netfilter/nf_conntrack_acct.h b/include/net/netfilter/nf_conntrack_acct.h
index 03e218f0be43..4e9c63a20db2 100644
--- a/include/net/netfilter/nf_conntrack_acct.h
+++ b/include/net/netfilter/nf_conntrack_acct.h
@@ -45,6 +45,18 @@ struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp)
45extern unsigned int 45extern unsigned int
46seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir); 46seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir);
47 47
48/* Check if connection tracking accounting is enabled */
49static inline bool nf_ct_acct_enabled(struct net *net)
50{
51 return net->ct.sysctl_acct != 0;
52}
53
54/* Enable/disable connection tracking accounting */
55static inline void nf_ct_set_acct(struct net *net, bool enable)
56{
57 net->ct.sysctl_acct = enable;
58}
59
48extern int nf_conntrack_acct_init(struct net *net); 60extern int nf_conntrack_acct_init(struct net *net);
49extern void nf_conntrack_acct_fini(struct net *net); 61extern void nf_conntrack_acct_fini(struct net *net);
50 62
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 3d7524fba194..aced085132e7 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -60,7 +60,7 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb)
60 struct nf_conn *ct = (struct nf_conn *)skb->nfct; 60 struct nf_conn *ct = (struct nf_conn *)skb->nfct;
61 int ret = NF_ACCEPT; 61 int ret = NF_ACCEPT;
62 62
63 if (ct && ct != &nf_conntrack_untracked) { 63 if (ct && !nf_ct_is_untracked(ct)) {
64 if (!nf_ct_is_confirmed(ct)) 64 if (!nf_ct_is_confirmed(ct))
65 ret = __nf_conntrack_confirm(skb); 65 ret = __nf_conntrack_confirm(skb);
66 if (likely(ret == NF_ACCEPT)) 66 if (likely(ret == NF_ACCEPT))
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 32d15bd6efa3..0772d296dfdb 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -28,9 +28,14 @@ struct nf_ct_ext {
28 char data[0]; 28 char data[0];
29}; 29};
30 30
31static inline int nf_ct_ext_exist(const struct nf_conn *ct, u8 id) 31static inline bool __nf_ct_ext_exist(const struct nf_ct_ext *ext, u8 id)
32{ 32{
33 return (ct->ext && ct->ext->offset[id]); 33 return !!ext->offset[id];
34}
35
36static inline bool nf_ct_ext_exist(const struct nf_conn *ct, u8 id)
37{
38 return (ct->ext && __nf_ct_ext_exist(ct->ext, id));
34} 39}
35 40
36static inline void *__nf_ct_ext_find(const struct nf_conn *ct, u8 id) 41static inline void *__nf_ct_ext_find(const struct nf_conn *ct, u8 id)
diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h
index c398017ccfa3..df17bac46bf5 100644
--- a/include/net/netfilter/nf_nat_protocol.h
+++ b/include/net/netfilter/nf_nat_protocol.h
@@ -27,9 +27,9 @@ struct nf_nat_protocol {
27 27
28 /* Alter the per-proto part of the tuple (depending on 28 /* Alter the per-proto part of the tuple (depending on
29 maniptype), to give a unique tuple in the given range if 29 maniptype), to give a unique tuple in the given range if
30 possible; return false if not. Per-protocol part of tuple 30 possible. Per-protocol part of tuple is initialized to the
31 is initialized to the incoming packet. */ 31 incoming packet. */
32 bool (*unique_tuple)(struct nf_conntrack_tuple *tuple, 32 void (*unique_tuple)(struct nf_conntrack_tuple *tuple,
33 const struct nf_nat_range *range, 33 const struct nf_nat_range *range,
34 enum nf_nat_manip_type maniptype, 34 enum nf_nat_manip_type maniptype,
35 const struct nf_conn *ct); 35 const struct nf_conn *ct);
@@ -63,7 +63,7 @@ extern bool nf_nat_proto_in_range(const struct nf_conntrack_tuple *tuple,
63 const union nf_conntrack_man_proto *min, 63 const union nf_conntrack_man_proto *min,
64 const union nf_conntrack_man_proto *max); 64 const union nf_conntrack_man_proto *max);
65 65
66extern bool nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple, 66extern void nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple,
67 const struct nf_nat_range *range, 67 const struct nf_nat_range *range,
68 enum nf_nat_manip_type maniptype, 68 enum nf_nat_manip_type maniptype,
69 const struct nf_conn *ct, 69 const struct nf_conn *ct,
diff --git a/include/net/netfilter/nf_nat_rule.h b/include/net/netfilter/nf_nat_rule.h
index e4a18ae361c6..2890bdc4cd92 100644
--- a/include/net/netfilter/nf_nat_rule.h
+++ b/include/net/netfilter/nf_nat_rule.h
@@ -12,6 +12,4 @@ extern int nf_nat_rule_find(struct sk_buff *skb,
12 const struct net_device *out, 12 const struct net_device *out,
13 struct nf_conn *ct); 13 struct nf_conn *ct);
14 14
15extern unsigned int
16alloc_null_binding(struct nf_conn *ct, unsigned int hooknum);
17#endif /* _NF_NAT_RULE_H */ 15#endif /* _NF_NAT_RULE_H */
diff --git a/include/net/netfilter/nfnetlink_log.h b/include/net/netfilter/nfnetlink_log.h
index b0569ff0775e..e2dec42c2db2 100644
--- a/include/net/netfilter/nfnetlink_log.h
+++ b/include/net/netfilter/nfnetlink_log.h
@@ -10,5 +10,7 @@ nfulnl_log_packet(u_int8_t pf,
10 const struct nf_loginfo *li_user, 10 const struct nf_loginfo *li_user,
11 const char *prefix); 11 const char *prefix);
12 12
13#define NFULNL_COPY_DISABLED 0xff
14
13#endif /* _KER_NFNETLINK_LOG_H */ 15#endif /* _KER_NFNETLINK_LOG_H */
14 16
diff --git a/include/net/netfilter/xt_rateest.h b/include/net/netfilter/xt_rateest.h
index ddbf37e19616..5a2978d1cb22 100644
--- a/include/net/netfilter/xt_rateest.h
+++ b/include/net/netfilter/xt_rateest.h
@@ -2,13 +2,18 @@
2#define _XT_RATEEST_H 2#define _XT_RATEEST_H
3 3
4struct xt_rateest { 4struct xt_rateest {
5 /* keep lock and bstats on same cache line to speedup xt_rateest_tg() */
6 struct gnet_stats_basic_packed bstats;
7 spinlock_t lock;
8 /* keep rstats and lock on same cache line to speedup xt_rateest_mt() */
9 struct gnet_stats_rate_est rstats;
10
11 /* following fields not accessed in hot path */
5 struct hlist_node list; 12 struct hlist_node list;
6 char name[IFNAMSIZ]; 13 char name[IFNAMSIZ];
7 unsigned int refcnt; 14 unsigned int refcnt;
8 spinlock_t lock;
9 struct gnet_estimator params; 15 struct gnet_estimator params;
10 struct gnet_stats_rate_est rstats; 16 struct rcu_head rcu;
11 struct gnet_stats_basic_packed bstats;
12}; 17};
13 18
14extern struct xt_rateest *xt_rateest_lookup(const char *name); 19extern struct xt_rateest *xt_rateest_lookup(const char *name);
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 4fc05b58503e..f3b201d335b3 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -35,7 +35,7 @@
35 * nlmsg_new() create a new netlink message 35 * nlmsg_new() create a new netlink message
36 * nlmsg_put() add a netlink message to an skb 36 * nlmsg_put() add a netlink message to an skb
37 * nlmsg_put_answer() callback based nlmsg_put() 37 * nlmsg_put_answer() callback based nlmsg_put()
38 * nlmsg_end() finanlize netlink message 38 * nlmsg_end() finalize netlink message
39 * nlmsg_get_pos() return current position in message 39 * nlmsg_get_pos() return current position in message
40 * nlmsg_trim() trim part of message 40 * nlmsg_trim() trim part of message
41 * nlmsg_cancel() cancel message construction 41 * nlmsg_cancel() cancel message construction
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h
index d7b989ca3d63..2d16783d5e20 100644
--- a/include/net/phonet/pn_dev.h
+++ b/include/net/phonet/pn_dev.h
@@ -34,6 +34,7 @@ struct phonet_device {
34 struct list_head list; 34 struct list_head list;
35 struct net_device *netdev; 35 struct net_device *netdev;
36 DECLARE_BITMAP(addrs, 64); 36 DECLARE_BITMAP(addrs, 64);
37 struct rcu_head rcu;
37}; 38};
38 39
39int phonet_device_init(void); 40int phonet_device_init(void);
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 9d4d87cc970e..d9549af6929a 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -95,7 +95,7 @@ extern void __qdisc_run(struct Qdisc *q);
95 95
96static inline void qdisc_run(struct Qdisc *q) 96static inline void qdisc_run(struct Qdisc *q)
97{ 97{
98 if (!test_and_set_bit(__QDISC_STATE_RUNNING, &q->state)) 98 if (qdisc_run_begin(q))
99 __qdisc_run(q); 99 __qdisc_run(q);
100} 100}
101 101
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index f873ee37f7e4..9e103a4e91ee 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -54,7 +54,6 @@ struct regulatory_request {
54 enum nl80211_reg_initiator initiator; 54 enum nl80211_reg_initiator initiator;
55 char alpha2[2]; 55 char alpha2[2];
56 bool intersect; 56 bool intersect;
57 u32 country_ie_checksum;
58 enum environment_cap country_ie_env; 57 enum environment_cap country_ie_env;
59 struct list_head list; 58 struct list_head list;
60}; 59};
diff --git a/include/net/route.h b/include/net/route.h
index af6cf4b4c9dc..bd732d62e1c3 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -50,9 +50,7 @@
50struct fib_nh; 50struct fib_nh;
51struct inet_peer; 51struct inet_peer;
52struct rtable { 52struct rtable {
53 union { 53 struct dst_entry dst;
54 struct dst_entry dst;
55 } u;
56 54
57 /* Cache lookup keys */ 55 /* Cache lookup keys */
58 struct flowi fl; 56 struct flowi fl;
@@ -144,7 +142,7 @@ extern void fib_add_ifaddr(struct in_ifaddr *);
144static inline void ip_rt_put(struct rtable * rt) 142static inline void ip_rt_put(struct rtable * rt)
145{ 143{
146 if (rt) 144 if (rt)
147 dst_release(&rt->u.dst); 145 dst_release(&rt->dst);
148} 146}
149 147
150#define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3) 148#define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 433604bb3fe8..3c8728aaab4e 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -23,11 +23,17 @@ struct qdisc_rate_table {
23}; 23};
24 24
25enum qdisc_state_t { 25enum qdisc_state_t {
26 __QDISC_STATE_RUNNING,
27 __QDISC_STATE_SCHED, 26 __QDISC_STATE_SCHED,
28 __QDISC_STATE_DEACTIVATED, 27 __QDISC_STATE_DEACTIVATED,
29}; 28};
30 29
30/*
31 * following bits are only changed while qdisc lock is held
32 */
33enum qdisc___state_t {
34 __QDISC___STATE_RUNNING,
35};
36
31struct qdisc_size_table { 37struct qdisc_size_table {
32 struct list_head list; 38 struct list_head list;
33 struct tc_sizespec szopts; 39 struct tc_sizespec szopts;
@@ -72,10 +78,27 @@ struct Qdisc {
72 unsigned long state; 78 unsigned long state;
73 struct sk_buff_head q; 79 struct sk_buff_head q;
74 struct gnet_stats_basic_packed bstats; 80 struct gnet_stats_basic_packed bstats;
81 unsigned long __state;
75 struct gnet_stats_queue qstats; 82 struct gnet_stats_queue qstats;
76 struct rcu_head rcu_head; 83 struct rcu_head rcu_head;
84 spinlock_t busylock;
77}; 85};
78 86
87static inline bool qdisc_is_running(struct Qdisc *qdisc)
88{
89 return test_bit(__QDISC___STATE_RUNNING, &qdisc->__state);
90}
91
92static inline bool qdisc_run_begin(struct Qdisc *qdisc)
93{
94 return !__test_and_set_bit(__QDISC___STATE_RUNNING, &qdisc->__state);
95}
96
97static inline void qdisc_run_end(struct Qdisc *qdisc)
98{
99 __clear_bit(__QDISC___STATE_RUNNING, &qdisc->__state);
100}
101
79struct Qdisc_class_ops { 102struct Qdisc_class_ops {
80 /* Child qdisc manipulation */ 103 /* Child qdisc manipulation */
81 struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *); 104 struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *);
@@ -583,9 +606,16 @@ static inline u32 qdisc_l2t(struct qdisc_rate_table* rtab, unsigned int pktlen)
583} 606}
584 607
585#ifdef CONFIG_NET_CLS_ACT 608#ifdef CONFIG_NET_CLS_ACT
586static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask) 609static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask,
610 int action)
587{ 611{
588 struct sk_buff *n = skb_clone(skb, gfp_mask); 612 struct sk_buff *n;
613
614 if ((action == TC_ACT_STOLEN || action == TC_ACT_QUEUED) &&
615 !skb_shared(skb))
616 n = skb_get(skb);
617 else
618 n = skb_clone(skb, gfp_mask);
589 619
590 if (n) { 620 if (n) {
591 n->tc_verd = SET_TC_VERD(n->tc_verd, 0); 621 n->tc_verd = SET_TC_VERD(n->tc_verd, 0);
diff --git a/include/net/scm.h b/include/net/scm.h
index 8360e47aa7e3..31656506d967 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -19,8 +19,10 @@ struct scm_fp_list {
19}; 19};
20 20
21struct scm_cookie { 21struct scm_cookie {
22 struct ucred creds; /* Skb credentials */ 22 struct pid *pid; /* Skb credentials */
23 const struct cred *cred;
23 struct scm_fp_list *fp; /* Passed files */ 24 struct scm_fp_list *fp; /* Passed files */
25 struct ucred creds; /* Skb credentials */
24#ifdef CONFIG_SECURITY_NETWORK 26#ifdef CONFIG_SECURITY_NETWORK
25 u32 secid; /* Passed security ID */ 27 u32 secid; /* Passed security ID */
26#endif 28#endif
@@ -42,8 +44,27 @@ static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_co
42{ } 44{ }
43#endif /* CONFIG_SECURITY_NETWORK */ 45#endif /* CONFIG_SECURITY_NETWORK */
44 46
47static __inline__ void scm_set_cred(struct scm_cookie *scm,
48 struct pid *pid, const struct cred *cred)
49{
50 scm->pid = get_pid(pid);
51 scm->cred = get_cred(cred);
52 cred_to_ucred(pid, cred, &scm->creds);
53}
54
55static __inline__ void scm_destroy_cred(struct scm_cookie *scm)
56{
57 put_pid(scm->pid);
58 scm->pid = NULL;
59
60 if (scm->cred)
61 put_cred(scm->cred);
62 scm->cred = NULL;
63}
64
45static __inline__ void scm_destroy(struct scm_cookie *scm) 65static __inline__ void scm_destroy(struct scm_cookie *scm)
46{ 66{
67 scm_destroy_cred(scm);
47 if (scm && scm->fp) 68 if (scm && scm->fp)
48 __scm_destroy(scm); 69 __scm_destroy(scm);
49} 70}
@@ -51,10 +72,7 @@ static __inline__ void scm_destroy(struct scm_cookie *scm)
51static __inline__ int scm_send(struct socket *sock, struct msghdr *msg, 72static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
52 struct scm_cookie *scm) 73 struct scm_cookie *scm)
53{ 74{
54 struct task_struct *p = current; 75 scm_set_cred(scm, task_tgid(current), current_cred());
55 scm->creds.uid = current_uid();
56 scm->creds.gid = current_gid();
57 scm->creds.pid = task_tgid_vnr(p);
58 scm->fp = NULL; 76 scm->fp = NULL;
59 unix_get_peersec_dgram(sock, scm); 77 unix_get_peersec_dgram(sock, scm);
60 if (msg->msg_controllen <= 0) 78 if (msg->msg_controllen <= 0)
@@ -96,6 +114,8 @@ static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg,
96 if (test_bit(SOCK_PASSCRED, &sock->flags)) 114 if (test_bit(SOCK_PASSCRED, &sock->flags))
97 put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds); 115 put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds);
98 116
117 scm_destroy_cred(scm);
118
99 scm_passec(sock, msg, scm); 119 scm_passec(sock, msg, scm);
100 120
101 if (!scm->fp) 121 if (!scm->fp)
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 4b860116e096..f9e7473613bd 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -443,7 +443,7 @@ struct sctp_signed_cookie {
443 __u8 signature[SCTP_SECRET_SIZE]; 443 __u8 signature[SCTP_SECRET_SIZE];
444 __u32 __pad; /* force sctp_cookie alignment to 64 bits */ 444 __u32 __pad; /* force sctp_cookie alignment to 64 bits */
445 struct sctp_cookie c; 445 struct sctp_cookie c;
446} __attribute__((packed)); 446} __packed;
447 447
448/* This is another convenience type to allocate memory for address 448/* This is another convenience type to allocate memory for address
449 * params for the maximum size and pass such structures around 449 * params for the maximum size and pass such structures around
@@ -488,7 +488,7 @@ typedef struct sctp_sender_hb_info {
488 union sctp_addr daddr; 488 union sctp_addr daddr;
489 unsigned long sent_at; 489 unsigned long sent_at;
490 __u64 hb_nonce; 490 __u64 hb_nonce;
491} __attribute__((packed)) sctp_sender_hb_info_t; 491} __packed sctp_sender_hb_info_t;
492 492
493/* 493/*
494 * RFC 2960 1.3.2 Sequenced Delivery within Streams 494 * RFC 2960 1.3.2 Sequenced Delivery within Streams
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 899003d18db9..a0e61806d480 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -47,15 +47,16 @@ struct snmp_mib {
47} 47}
48 48
49/* 49/*
50 * We use all unsigned longs. Linux will soon be so reliable that even 50 * We use unsigned longs for most mibs but u64 for ipstats.
51 * these will rapidly get too small 8-). Seriously consider the IpInReceives
52 * count on the 20Gb/s + networks people expect in a few years time!
53 */ 51 */
52#include <linux/u64_stats_sync.h>
54 53
55/* IPstats */ 54/* IPstats */
56#define IPSTATS_MIB_MAX __IPSTATS_MIB_MAX 55#define IPSTATS_MIB_MAX __IPSTATS_MIB_MAX
57struct ipstats_mib { 56struct ipstats_mib {
58 unsigned long mibs[IPSTATS_MIB_MAX]; 57 /* mibs[] must be first field of struct ipstats_mib */
58 u64 mibs[IPSTATS_MIB_MAX];
59 struct u64_stats_sync syncp;
59}; 60};
60 61
61/* ICMP */ 62/* ICMP */
@@ -155,4 +156,70 @@ struct linux_xfrm_mib {
155 ptr->mibs[basefield##PKTS]++; \ 156 ptr->mibs[basefield##PKTS]++; \
156 ptr->mibs[basefield##OCTETS] += addend;\ 157 ptr->mibs[basefield##OCTETS] += addend;\
157 } while (0) 158 } while (0)
159
160
161#if BITS_PER_LONG==32
162
163#define SNMP_ADD_STATS64_BH(mib, field, addend) \
164 do { \
165 __typeof__(*mib[0]) *ptr = __this_cpu_ptr((mib)[0]); \
166 u64_stats_update_begin(&ptr->syncp); \
167 ptr->mibs[field] += addend; \
168 u64_stats_update_end(&ptr->syncp); \
169 } while (0)
170#define SNMP_ADD_STATS64_USER(mib, field, addend) \
171 do { \
172 __typeof__(*mib[0]) *ptr; \
173 preempt_disable(); \
174 ptr = __this_cpu_ptr((mib)[1]); \
175 u64_stats_update_begin(&ptr->syncp); \
176 ptr->mibs[field] += addend; \
177 u64_stats_update_end(&ptr->syncp); \
178 preempt_enable(); \
179 } while (0)
180#define SNMP_ADD_STATS64(mib, field, addend) \
181 do { \
182 __typeof__(*mib[0]) *ptr; \
183 preempt_disable(); \
184 ptr = __this_cpu_ptr((mib)[!in_softirq()]); \
185 u64_stats_update_begin(&ptr->syncp); \
186 ptr->mibs[field] += addend; \
187 u64_stats_update_end(&ptr->syncp); \
188 preempt_enable(); \
189 } while (0)
190#define SNMP_INC_STATS64_BH(mib, field) SNMP_ADD_STATS64_BH(mib, field, 1)
191#define SNMP_INC_STATS64_USER(mib, field) SNMP_ADD_STATS64_USER(mib, field, 1)
192#define SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1)
193#define SNMP_UPD_PO_STATS64(mib, basefield, addend) \
194 do { \
195 __typeof__(*mib[0]) *ptr; \
196 preempt_disable(); \
197 ptr = __this_cpu_ptr((mib)[!in_softirq()]); \
198 u64_stats_update_begin(&ptr->syncp); \
199 ptr->mibs[basefield##PKTS]++; \
200 ptr->mibs[basefield##OCTETS] += addend; \
201 u64_stats_update_end(&ptr->syncp); \
202 preempt_enable(); \
203 } while (0)
204#define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \
205 do { \
206 __typeof__(*mib[0]) *ptr; \
207 ptr = __this_cpu_ptr((mib)[!in_softirq()]); \
208 u64_stats_update_begin(&ptr->syncp); \
209 ptr->mibs[basefield##PKTS]++; \
210 ptr->mibs[basefield##OCTETS] += addend; \
211 u64_stats_update_end(&ptr->syncp); \
212 } while (0)
213#else
214#define SNMP_INC_STATS64_BH(mib, field) SNMP_INC_STATS_BH(mib, field)
215#define SNMP_INC_STATS64_USER(mib, field) SNMP_INC_STATS_USER(mib, field)
216#define SNMP_INC_STATS64(mib, field) SNMP_INC_STATS(mib, field)
217#define SNMP_DEC_STATS64(mib, field) SNMP_DEC_STATS(mib, field)
218#define SNMP_ADD_STATS64_BH(mib, field, addend) SNMP_ADD_STATS_BH(mib, field, addend)
219#define SNMP_ADD_STATS64_USER(mib, field, addend) SNMP_ADD_STATS_USER(mib, field, addend)
220#define SNMP_ADD_STATS64(mib, field, addend) SNMP_ADD_STATS(mib, field, addend)
221#define SNMP_UPD_PO_STATS64(mib, basefield, addend) SNMP_UPD_PO_STATS(mib, basefield, addend)
222#define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) SNMP_UPD_PO_STATS_BH(mib, basefield, addend)
223#endif
224
158#endif 225#endif
diff --git a/include/net/sock.h b/include/net/sock.h
index 0a691ea7654a..ac53bfbdfe16 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -195,7 +195,8 @@ struct sock_common {
195 * @sk_priority: %SO_PRIORITY setting 195 * @sk_priority: %SO_PRIORITY setting
196 * @sk_type: socket type (%SOCK_STREAM, etc) 196 * @sk_type: socket type (%SOCK_STREAM, etc)
197 * @sk_protocol: which protocol this socket belongs in this network family 197 * @sk_protocol: which protocol this socket belongs in this network family
198 * @sk_peercred: %SO_PEERCRED setting 198 * @sk_peer_pid: &struct pid for this socket's peer
199 * @sk_peer_cred: %SO_PEERCRED setting
199 * @sk_rcvlowat: %SO_RCVLOWAT setting 200 * @sk_rcvlowat: %SO_RCVLOWAT setting
200 * @sk_rcvtimeo: %SO_RCVTIMEO setting 201 * @sk_rcvtimeo: %SO_RCVTIMEO setting
201 * @sk_sndtimeo: %SO_SNDTIMEO setting 202 * @sk_sndtimeo: %SO_SNDTIMEO setting
@@ -211,6 +212,7 @@ struct sock_common {
211 * @sk_send_head: front of stuff to transmit 212 * @sk_send_head: front of stuff to transmit
212 * @sk_security: used by security modules 213 * @sk_security: used by security modules
213 * @sk_mark: generic packet mark 214 * @sk_mark: generic packet mark
215 * @sk_classid: this socket's cgroup classid
214 * @sk_write_pending: a write to stream socket waits to start 216 * @sk_write_pending: a write to stream socket waits to start
215 * @sk_state_change: callback to indicate change in the state of the sock 217 * @sk_state_change: callback to indicate change in the state of the sock
216 * @sk_data_ready: callback to indicate there is data to be processed 218 * @sk_data_ready: callback to indicate there is data to be processed
@@ -295,7 +297,8 @@ struct sock {
295 unsigned short sk_ack_backlog; 297 unsigned short sk_ack_backlog;
296 unsigned short sk_max_ack_backlog; 298 unsigned short sk_max_ack_backlog;
297 __u32 sk_priority; 299 __u32 sk_priority;
298 struct ucred sk_peercred; 300 struct pid *sk_peer_pid;
301 const struct cred *sk_peer_cred;
299 long sk_rcvtimeo; 302 long sk_rcvtimeo;
300 long sk_sndtimeo; 303 long sk_sndtimeo;
301 struct sk_filter *sk_filter; 304 struct sk_filter *sk_filter;
@@ -771,6 +774,7 @@ struct proto {
771 int *sysctl_wmem; 774 int *sysctl_wmem;
772 int *sysctl_rmem; 775 int *sysctl_rmem;
773 int max_header; 776 int max_header;
777 bool no_autobind;
774 778
775 struct kmem_cache *slab; 779 struct kmem_cache *slab;
776 unsigned int obj_size; 780 unsigned int obj_size;
@@ -1706,19 +1710,13 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e
1706static inline 1710static inline
1707struct net *sock_net(const struct sock *sk) 1711struct net *sock_net(const struct sock *sk)
1708{ 1712{
1709#ifdef CONFIG_NET_NS 1713 return read_pnet(&sk->sk_net);
1710 return sk->sk_net;
1711#else
1712 return &init_net;
1713#endif
1714} 1714}
1715 1715
1716static inline 1716static inline
1717void sock_net_set(struct sock *sk, struct net *net) 1717void sock_net_set(struct sock *sk, struct net *net)
1718{ 1718{
1719#ifdef CONFIG_NET_NS 1719 write_pnet(&sk->sk_net, net);
1720 sk->sk_net = net;
1721#endif
1722} 1720}
1723 1721
1724/* 1722/*
diff --git a/include/net/tcp.h b/include/net/tcp.h
index a1449144848a..df6a2eb20193 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -296,45 +296,30 @@ extern struct proto tcp_prot;
296#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val) 296#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val)
297#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val) 297#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val)
298 298
299extern void tcp_v4_err(struct sk_buff *skb, u32); 299extern void tcp_v4_err(struct sk_buff *skb, u32);
300 300
301extern void tcp_shutdown (struct sock *sk, int how); 301extern void tcp_shutdown (struct sock *sk, int how);
302 302
303extern int tcp_v4_rcv(struct sk_buff *skb); 303extern int tcp_v4_rcv(struct sk_buff *skb);
304 304
305extern int tcp_v4_remember_stamp(struct sock *sk); 305extern int tcp_v4_remember_stamp(struct sock *sk);
306 306extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
307extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); 307extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
308 308 size_t size);
309extern int tcp_sendmsg(struct kiocb *iocb, struct socket *sock, 309extern int tcp_sendpage(struct sock *sk, struct page *page, int offset,
310 struct msghdr *msg, size_t size); 310 size_t size, int flags);
311extern ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags); 311extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg);
312 312extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
313extern int tcp_ioctl(struct sock *sk, 313 struct tcphdr *th, unsigned len);
314 int cmd, 314extern int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
315 unsigned long arg); 315 struct tcphdr *th, unsigned len);
316 316extern void tcp_rcv_space_adjust(struct sock *sk);
317extern int tcp_rcv_state_process(struct sock *sk, 317extern void tcp_cleanup_rbuf(struct sock *sk, int copied);
318 struct sk_buff *skb, 318extern int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp);
319 struct tcphdr *th, 319extern void tcp_twsk_destructor(struct sock *sk);
320 unsigned len); 320extern ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,
321 321 struct pipe_inode_info *pipe, size_t len,
322extern int tcp_rcv_established(struct sock *sk, 322 unsigned int flags);
323 struct sk_buff *skb,
324 struct tcphdr *th,
325 unsigned len);
326
327extern void tcp_rcv_space_adjust(struct sock *sk);
328
329extern void tcp_cleanup_rbuf(struct sock *sk, int copied);
330
331extern int tcp_twsk_unique(struct sock *sk,
332 struct sock *sktw, void *twp);
333
334extern void tcp_twsk_destructor(struct sock *sk);
335
336extern ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,
337 struct pipe_inode_info *pipe, size_t len, unsigned int flags);
338 323
339static inline void tcp_dec_quickack_mode(struct sock *sk, 324static inline void tcp_dec_quickack_mode(struct sock *sk,
340 const unsigned int pkts) 325 const unsigned int pkts)
@@ -372,88 +357,59 @@ enum tcp_tw_status {
372}; 357};
373 358
374 359
375extern enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw, 360extern enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw,
376 struct sk_buff *skb, 361 struct sk_buff *skb,
377 const struct tcphdr *th); 362 const struct tcphdr *th);
378 363extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
379extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, 364 struct request_sock *req,
380 struct request_sock *req, 365 struct request_sock **prev);
381 struct request_sock **prev); 366extern int tcp_child_process(struct sock *parent, struct sock *child,
382extern int tcp_child_process(struct sock *parent, 367 struct sk_buff *skb);
383 struct sock *child, 368extern int tcp_use_frto(struct sock *sk);
384 struct sk_buff *skb); 369extern void tcp_enter_frto(struct sock *sk);
385extern int tcp_use_frto(struct sock *sk); 370extern void tcp_enter_loss(struct sock *sk, int how);
386extern void tcp_enter_frto(struct sock *sk); 371extern void tcp_clear_retrans(struct tcp_sock *tp);
387extern void tcp_enter_loss(struct sock *sk, int how); 372extern void tcp_update_metrics(struct sock *sk);
388extern void tcp_clear_retrans(struct tcp_sock *tp); 373extern void tcp_close(struct sock *sk, long timeout);
389extern void tcp_update_metrics(struct sock *sk); 374extern unsigned int tcp_poll(struct file * file, struct socket *sock,
390 375 struct poll_table_struct *wait);
391extern void tcp_close(struct sock *sk, 376extern int tcp_getsockopt(struct sock *sk, int level, int optname,
392 long timeout); 377 char __user *optval, int __user *optlen);
393extern unsigned int tcp_poll(struct file * file, struct socket *sock, struct poll_table_struct *wait); 378extern int tcp_setsockopt(struct sock *sk, int level, int optname,
394 379 char __user *optval, unsigned int optlen);
395extern int tcp_getsockopt(struct sock *sk, int level, 380extern int compat_tcp_getsockopt(struct sock *sk, int level, int optname,
396 int optname, 381 char __user *optval, int __user *optlen);
397 char __user *optval, 382extern int compat_tcp_setsockopt(struct sock *sk, int level, int optname,
398 int __user *optlen); 383 char __user *optval, unsigned int optlen);
399extern int tcp_setsockopt(struct sock *sk, int level, 384extern void tcp_set_keepalive(struct sock *sk, int val);
400 int optname, char __user *optval, 385extern void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req);
401 unsigned int optlen); 386extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
402extern int compat_tcp_getsockopt(struct sock *sk, 387 size_t len, int nonblock, int flags, int *addr_len);
403 int level, int optname, 388extern void tcp_parse_options(struct sk_buff *skb,
404 char __user *optval, int __user *optlen); 389 struct tcp_options_received *opt_rx, u8 **hvpp,
405extern int compat_tcp_setsockopt(struct sock *sk, 390 int estab);
406 int level, int optname, 391extern u8 *tcp_parse_md5sig_option(struct tcphdr *th);
407 char __user *optval, unsigned int optlen);
408extern void tcp_set_keepalive(struct sock *sk, int val);
409extern void tcp_syn_ack_timeout(struct sock *sk,
410 struct request_sock *req);
411extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk,
412 struct msghdr *msg,
413 size_t len, int nonblock,
414 int flags, int *addr_len);
415
416extern void tcp_parse_options(struct sk_buff *skb,
417 struct tcp_options_received *opt_rx,
418 u8 **hvpp,
419 int estab);
420
421extern u8 *tcp_parse_md5sig_option(struct tcphdr *th);
422 392
423/* 393/*
424 * TCP v4 functions exported for the inet6 API 394 * TCP v4 functions exported for the inet6 API
425 */ 395 */
426 396
427extern void tcp_v4_send_check(struct sock *sk, 397extern void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb);
428 struct sk_buff *skb); 398extern int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb);
429 399extern struct sock * tcp_create_openreq_child(struct sock *sk,
430extern int tcp_v4_conn_request(struct sock *sk, 400 struct request_sock *req,
431 struct sk_buff *skb);
432
433extern struct sock * tcp_create_openreq_child(struct sock *sk,
434 struct request_sock *req,
435 struct sk_buff *skb);
436
437extern struct sock * tcp_v4_syn_recv_sock(struct sock *sk,
438 struct sk_buff *skb,
439 struct request_sock *req,
440 struct dst_entry *dst);
441
442extern int tcp_v4_do_rcv(struct sock *sk,
443 struct sk_buff *skb); 401 struct sk_buff *skb);
444 402extern struct sock * tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
445extern int tcp_v4_connect(struct sock *sk, 403 struct request_sock *req,
446 struct sockaddr *uaddr, 404 struct dst_entry *dst);
447 int addr_len); 405extern int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb);
448 406extern int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr,
449extern int tcp_connect(struct sock *sk); 407 int addr_len);
450 408extern int tcp_connect(struct sock *sk);
451extern struct sk_buff * tcp_make_synack(struct sock *sk, 409extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst,
452 struct dst_entry *dst, 410 struct request_sock *req,
453 struct request_sock *req, 411 struct request_values *rvp);
454 struct request_values *rvp); 412extern int tcp_disconnect(struct sock *sk, int flags);
455
456extern int tcp_disconnect(struct sock *sk, int flags);
457 413
458 414
459/* From syncookies.c */ 415/* From syncookies.c */
@@ -464,7 +420,7 @@ extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb,
464 __u16 *mss); 420 __u16 *mss);
465 421
466extern __u32 cookie_init_timestamp(struct request_sock *req); 422extern __u32 cookie_init_timestamp(struct request_sock *req);
467extern void cookie_check_timestamp(struct tcp_options_received *tcp_opt); 423extern bool cookie_check_timestamp(struct tcp_options_received *opt, bool *);
468 424
469/* From net/ipv6/syncookies.c */ 425/* From net/ipv6/syncookies.c */
470extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); 426extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb);
@@ -485,10 +441,10 @@ extern int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int);
485 441
486extern void tcp_send_probe0(struct sock *); 442extern void tcp_send_probe0(struct sock *);
487extern void tcp_send_partial(struct sock *); 443extern void tcp_send_partial(struct sock *);
488extern int tcp_write_wakeup(struct sock *); 444extern int tcp_write_wakeup(struct sock *);
489extern void tcp_send_fin(struct sock *sk); 445extern void tcp_send_fin(struct sock *sk);
490extern void tcp_send_active_reset(struct sock *sk, gfp_t priority); 446extern void tcp_send_active_reset(struct sock *sk, gfp_t priority);
491extern int tcp_send_synack(struct sock *); 447extern int tcp_send_synack(struct sock *);
492extern void tcp_push_one(struct sock *, unsigned int mss_now); 448extern void tcp_push_one(struct sock *, unsigned int mss_now);
493extern void tcp_send_ack(struct sock *sk); 449extern void tcp_send_ack(struct sock *sk);
494extern void tcp_send_delayed_ack(struct sock *sk); 450extern void tcp_send_delayed_ack(struct sock *sk);
@@ -592,7 +548,7 @@ static inline u32 tcp_receive_window(const struct tcp_sock *tp)
592 * scaling applied to the result. The caller does these things 548 * scaling applied to the result. The caller does these things
593 * if necessary. This is a "raw" window selection. 549 * if necessary. This is a "raw" window selection.
594 */ 550 */
595extern u32 __tcp_select_window(struct sock *sk); 551extern u32 __tcp_select_window(struct sock *sk);
596 552
597/* TCP timestamps are only 32-bits, this causes a slight 553/* TCP timestamps are only 32-bits, this causes a slight
598 * complication on 64-bit systems since we store a snapshot 554 * complication on 64-bit systems since we store a snapshot
@@ -602,12 +558,22 @@ extern u32 __tcp_select_window(struct sock *sk);
602 */ 558 */
603#define tcp_time_stamp ((__u32)(jiffies)) 559#define tcp_time_stamp ((__u32)(jiffies))
604 560
561#define tcp_flag_byte(th) (((u_int8_t *)th)[13])
562
563#define TCPHDR_FIN 0x01
564#define TCPHDR_SYN 0x02
565#define TCPHDR_RST 0x04
566#define TCPHDR_PSH 0x08
567#define TCPHDR_ACK 0x10
568#define TCPHDR_URG 0x20
569#define TCPHDR_ECE 0x40
570#define TCPHDR_CWR 0x80
571
605/* This is what the send packet queuing engine uses to pass 572/* This is what the send packet queuing engine uses to pass
606 * TCP per-packet control information to the transmission 573 * TCP per-packet control information to the transmission code.
607 * code. We also store the host-order sequence numbers in 574 * We also store the host-order sequence numbers in here too.
608 * here too. This is 36 bytes on 32-bit architectures, 575 * This is 44 bytes if IPV6 is enabled.
609 * 40 bytes on 64-bit machines, if this grows please adjust 576 * If this grows please adjust skbuff.h:skbuff->cb[xxx] size appropriately.
610 * skbuff.h:skbuff->cb[xxx] size appropriately.
611 */ 577 */
612struct tcp_skb_cb { 578struct tcp_skb_cb {
613 union { 579 union {
@@ -620,19 +586,6 @@ struct tcp_skb_cb {
620 __u32 end_seq; /* SEQ + FIN + SYN + datalen */ 586 __u32 end_seq; /* SEQ + FIN + SYN + datalen */
621 __u32 when; /* used to compute rtt's */ 587 __u32 when; /* used to compute rtt's */
622 __u8 flags; /* TCP header flags. */ 588 __u8 flags; /* TCP header flags. */
623
624 /* NOTE: These must match up to the flags byte in a
625 * real TCP header.
626 */
627#define TCPCB_FLAG_FIN 0x01
628#define TCPCB_FLAG_SYN 0x02
629#define TCPCB_FLAG_RST 0x04
630#define TCPCB_FLAG_PSH 0x08
631#define TCPCB_FLAG_ACK 0x10
632#define TCPCB_FLAG_URG 0x20
633#define TCPCB_FLAG_ECE 0x40
634#define TCPCB_FLAG_CWR 0x80
635
636 __u8 sacked; /* State flags for SACK/FACK. */ 589 __u8 sacked; /* State flags for SACK/FACK. */
637#define TCPCB_SACKED_ACKED 0x01 /* SKB ACK'd by a SACK block */ 590#define TCPCB_SACKED_ACKED 0x01 /* SKB ACK'd by a SACK block */
638#define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */ 591#define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */
@@ -1176,22 +1129,14 @@ struct tcp_md5sig_pool {
1176#define TCP_MD5SIG_MAXKEYS (~(u32)0) /* really?! */ 1129#define TCP_MD5SIG_MAXKEYS (~(u32)0) /* really?! */
1177 1130
1178/* - functions */ 1131/* - functions */
1179extern int tcp_v4_md5_hash_skb(char *md5_hash, 1132extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
1180 struct tcp_md5sig_key *key, 1133 struct sock *sk, struct request_sock *req,
1181 struct sock *sk, 1134 struct sk_buff *skb);
1182 struct request_sock *req, 1135extern struct tcp_md5sig_key * tcp_v4_md5_lookup(struct sock *sk,
1183 struct sk_buff *skb); 1136 struct sock *addr_sk);
1184 1137extern int tcp_v4_md5_do_add(struct sock *sk, __be32 addr, u8 *newkey,
1185extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, 1138 u8 newkeylen);
1186 struct sock *addr_sk); 1139extern int tcp_v4_md5_do_del(struct sock *sk, __be32 addr);
1187
1188extern int tcp_v4_md5_do_add(struct sock *sk,
1189 __be32 addr,
1190 u8 *newkey,
1191 u8 newkeylen);
1192
1193extern int tcp_v4_md5_do_del(struct sock *sk,
1194 __be32 addr);
1195 1140
1196#ifdef CONFIG_TCP_MD5SIG 1141#ifdef CONFIG_TCP_MD5SIG
1197#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_keylen ? \ 1142#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_keylen ? \
@@ -1204,10 +1149,10 @@ extern int tcp_v4_md5_do_del(struct sock *sk,
1204#endif 1149#endif
1205 1150
1206extern struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *); 1151extern struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *);
1207extern void tcp_free_md5sig_pool(void); 1152extern void tcp_free_md5sig_pool(void);
1208 1153
1209extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void); 1154extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void);
1210extern void tcp_put_md5sig_pool(void); 1155extern void tcp_put_md5sig_pool(void);
1211 1156
1212extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *); 1157extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *);
1213extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *, 1158extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *,
@@ -1413,7 +1358,8 @@ struct tcp_iter_state {
1413 sa_family_t family; 1358 sa_family_t family;
1414 enum tcp_seq_states state; 1359 enum tcp_seq_states state;
1415 struct sock *syn_wait_sk; 1360 struct sock *syn_wait_sk;
1416 int bucket, sbucket, num, uid; 1361 int bucket, offset, sbucket, num, uid;
1362 loff_t last_pos;
1417}; 1363};
1418 1364
1419extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo); 1365extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo);
@@ -1434,7 +1380,7 @@ extern int tcp_gro_complete(struct sk_buff *skb);
1434extern int tcp4_gro_complete(struct sk_buff *skb); 1380extern int tcp4_gro_complete(struct sk_buff *skb);
1435 1381
1436#ifdef CONFIG_PROC_FS 1382#ifdef CONFIG_PROC_FS
1437extern int tcp4_proc_init(void); 1383extern int tcp4_proc_init(void);
1438extern void tcp4_proc_exit(void); 1384extern void tcp4_proc_exit(void);
1439#endif 1385#endif
1440 1386
diff --git a/include/net/udp.h b/include/net/udp.h
index 5348d80b25bb..7abdf305da50 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -157,30 +157,28 @@ static inline void udp_lib_close(struct sock *sk, long timeout)
157 sk_common_release(sk); 157 sk_common_release(sk);
158} 158}
159 159
160extern int udp_lib_get_port(struct sock *sk, unsigned short snum, 160extern int udp_lib_get_port(struct sock *sk, unsigned short snum,
161 int (*)(const struct sock *,const struct sock *), 161 int (*)(const struct sock *,const struct sock *),
162 unsigned int hash2_nulladdr); 162 unsigned int hash2_nulladdr);
163 163
164/* net/ipv4/udp.c */ 164/* net/ipv4/udp.c */
165extern int udp_get_port(struct sock *sk, unsigned short snum, 165extern int udp_get_port(struct sock *sk, unsigned short snum,
166 int (*saddr_cmp)(const struct sock *, const struct sock *)); 166 int (*saddr_cmp)(const struct sock *,
167extern void udp_err(struct sk_buff *, u32); 167 const struct sock *));
168 168extern void udp_err(struct sk_buff *, u32);
169extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, 169extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk,
170 struct msghdr *msg, size_t len); 170 struct msghdr *msg, size_t len);
171extern void udp_flush_pending_frames(struct sock *sk); 171extern void udp_flush_pending_frames(struct sock *sk);
172 172extern int udp_rcv(struct sk_buff *skb);
173extern int udp_rcv(struct sk_buff *skb); 173extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg);
174extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg); 174extern int udp_disconnect(struct sock *sk, int flags);
175extern int udp_disconnect(struct sock *sk, int flags);
176extern unsigned int udp_poll(struct file *file, struct socket *sock, 175extern unsigned int udp_poll(struct file *file, struct socket *sock,
177 poll_table *wait); 176 poll_table *wait);
178extern int udp_lib_getsockopt(struct sock *sk, int level, int optname, 177extern int udp_lib_getsockopt(struct sock *sk, int level, int optname,
179 char __user *optval, int __user *optlen); 178 char __user *optval, int __user *optlen);
180extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, 179extern int udp_lib_setsockopt(struct sock *sk, int level, int optname,
181 char __user *optval, unsigned int optlen, 180 char __user *optval, unsigned int optlen,
182 int (*push_pending_frames)(struct sock *)); 181 int (*push_pending_frames)(struct sock *));
183
184extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, 182extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
185 __be32 daddr, __be16 dport, 183 __be32 daddr, __be16 dport,
186 int dif); 184 int dif);
@@ -236,7 +234,7 @@ struct udp_iter_state {
236extern int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo); 234extern int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo);
237extern void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo); 235extern void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo);
238 236
239extern int udp4_proc_init(void); 237extern int udp4_proc_init(void);
240extern void udp4_proc_exit(void); 238extern void udp4_proc_exit(void);
241#endif 239#endif
242 240
diff --git a/include/pcmcia/cistpl.h b/include/pcmcia/cistpl.h
index cfdd5af77dcc..1c5088c9f7bf 100644
--- a/include/pcmcia/cistpl.h
+++ b/include/pcmcia/cistpl.h
@@ -15,6 +15,8 @@
15#ifndef _LINUX_CISTPL_H 15#ifndef _LINUX_CISTPL_H
16#define _LINUX_CISTPL_H 16#define _LINUX_CISTPL_H
17 17
18typedef unsigned char cisdata_t;
19
18#define CISTPL_NULL 0x00 20#define CISTPL_NULL 0x00
19#define CISTPL_DEVICE 0x01 21#define CISTPL_DEVICE 0x01
20#define CISTPL_LONGLINK_CB 0x02 22#define CISTPL_LONGLINK_CB 0x02
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h
index 57d8d0393567..68d8bde7e8d6 100644
--- a/include/pcmcia/cs.h
+++ b/include/pcmcia/cs.h
@@ -19,44 +19,6 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#endif 20#endif
21 21
22/* For AccessConfigurationRegister */
23typedef struct conf_reg_t {
24 u_char Function;
25 u_int Action;
26 off_t Offset;
27 u_int Value;
28} conf_reg_t;
29
30/* Actions */
31#define CS_READ 1
32#define CS_WRITE 2
33
34/* for AdjustResourceInfo */
35/* Action field */
36#define REMOVE_MANAGED_RESOURCE 1
37#define ADD_MANAGED_RESOURCE 2
38
39
40typedef struct event_callback_args_t {
41 struct pcmcia_device *client_handle;
42 void *client_data;
43} event_callback_args_t;
44
45/* For CardValues field */
46#define CV_OPTION_VALUE 0x01
47#define CV_STATUS_VALUE 0x02
48#define CV_PIN_REPLACEMENT 0x04
49#define CV_COPY_VALUE 0x08
50#define CV_EXT_STATUS 0x10
51
52/* For GetFirst/NextClient */
53typedef struct client_req_t {
54 socket_t Socket;
55 u_int Attributes;
56} client_req_t;
57
58#define CLIENT_THIS_SOCKET 0x01
59
60/* ModifyConfiguration */ 22/* ModifyConfiguration */
61typedef struct modconf_t { 23typedef struct modconf_t {
62 u_int Attributes; 24 u_int Attributes;
@@ -94,43 +56,6 @@ typedef struct config_req_t {
94#define INT_CARDBUS 0x04 56#define INT_CARDBUS 0x04
95#define INT_ZOOMED_VIDEO 0x08 57#define INT_ZOOMED_VIDEO 0x08
96 58
97/* For RequestIO and ReleaseIO */
98typedef struct io_req_t {
99 u_int BasePort1;
100 u_int NumPorts1;
101 u_int Attributes1;
102 u_int BasePort2;
103 u_int NumPorts2;
104 u_int Attributes2;
105 u_int IOAddrLines;
106} io_req_t;
107
108/* Attributes for RequestIO and ReleaseIO */
109#define IO_SHARED 0x01
110#define IO_FIRST_SHARED 0x02
111#define IO_FORCE_ALIAS_ACCESS 0x04
112#define IO_DATA_PATH_WIDTH 0x18
113#define IO_DATA_PATH_WIDTH_8 0x00
114#define IO_DATA_PATH_WIDTH_16 0x08
115#define IO_DATA_PATH_WIDTH_AUTO 0x10
116
117/* Bits in IRQInfo1 field */
118#define IRQ_NMI_ID 0x01
119#define IRQ_IOCK_ID 0x02
120#define IRQ_BERR_ID 0x04
121#define IRQ_VEND_ID 0x08
122#define IRQ_INFO2_VALID 0x10
123#define IRQ_LEVEL_ID 0x20
124#define IRQ_PULSE_ID 0x40
125#define IRQ_SHARE_ID 0x80
126
127typedef struct eventmask_t {
128 u_int Attributes;
129 u_int EventMask;
130} eventmask_t;
131
132#define CONF_EVENT_MASK_VALID 0x01
133
134/* Configuration registers present */ 59/* Configuration registers present */
135#define PRESENT_OPTION 0x001 60#define PRESENT_OPTION 0x001
136#define PRESENT_STATUS 0x002 61#define PRESENT_STATUS 0x002
@@ -143,18 +68,6 @@ typedef struct eventmask_t {
143#define PRESENT_IOBASE_3 0x100 68#define PRESENT_IOBASE_3 0x100
144#define PRESENT_IOSIZE 0x200 69#define PRESENT_IOSIZE 0x200
145 70
146/* For GetMemPage, MapMemPage */
147typedef struct memreq_t {
148 u_int CardOffset;
149 page_t Page;
150} memreq_t;
151
152/* For ModifyWindow */
153typedef struct modwin_t {
154 u_int Attributes;
155 u_int AccessSpeed;
156} modwin_t;
157
158/* For RequestWindow */ 71/* For RequestWindow */
159typedef struct win_req_t { 72typedef struct win_req_t {
160 u_int Attributes; 73 u_int Attributes;
@@ -164,61 +77,19 @@ typedef struct win_req_t {
164} win_req_t; 77} win_req_t;
165 78
166/* Attributes for RequestWindow */ 79/* Attributes for RequestWindow */
167#define WIN_ADDR_SPACE 0x0001 80#define WIN_MEMORY_TYPE_CM 0x00 /* default */
168#define WIN_ADDR_SPACE_MEM 0x0000 81#define WIN_MEMORY_TYPE_AM 0x20 /* MAP_ATTRIB */
169#define WIN_ADDR_SPACE_IO 0x0001 82#define WIN_DATA_WIDTH_8 0x00 /* default */
170#define WIN_MEMORY_TYPE 0x0002 83#define WIN_DATA_WIDTH_16 0x02 /* MAP_16BIT */
171#define WIN_MEMORY_TYPE_CM 0x0000 84#define WIN_ENABLE 0x01 /* MAP_ACTIVE */
172#define WIN_MEMORY_TYPE_AM 0x0002 85#define WIN_USE_WAIT 0x40 /* MAP_USE_WAIT */
173#define WIN_ENABLE 0x0004 86
174#define WIN_DATA_WIDTH 0x0018 87#define WIN_FLAGS_MAP 0x63 /* MAP_ATTRIB | MAP_16BIT | MAP_ACTIVE |
175#define WIN_DATA_WIDTH_8 0x0000 88 MAP_USE_WAIT */
176#define WIN_DATA_WIDTH_16 0x0008 89#define WIN_FLAGS_REQ 0x1c /* mapping to socket->win[i]:
177#define WIN_DATA_WIDTH_32 0x0010 90 0x04 -> 0
178#define WIN_PAGED 0x0020 91 0x08 -> 1
179#define WIN_SHARED 0x0040 92 0x0c -> 2
180#define WIN_FIRST_SHARED 0x0080 93 0x10 -> 3 */
181#define WIN_USE_WAIT 0x0100
182#define WIN_STRICT_ALIGN 0x0200
183#define WIN_MAP_BELOW_1MB 0x0400
184#define WIN_PREFETCH 0x0800
185#define WIN_CACHEABLE 0x1000
186#define WIN_BAR_MASK 0xe000
187#define WIN_BAR_SHIFT 13
188
189typedef struct error_info_t {
190 int func;
191 int retcode;
192} error_info_t;
193
194/* Flag to bind to all functions */
195#define BIND_FN_ALL 0xff
196
197/* Events */
198#define CS_EVENT_PRI_LOW 0
199#define CS_EVENT_PRI_HIGH 1
200
201#define CS_EVENT_WRITE_PROTECT 0x000001
202#define CS_EVENT_CARD_LOCK 0x000002
203#define CS_EVENT_CARD_INSERTION 0x000004
204#define CS_EVENT_CARD_REMOVAL 0x000008
205#define CS_EVENT_BATTERY_DEAD 0x000010
206#define CS_EVENT_BATTERY_LOW 0x000020
207#define CS_EVENT_READY_CHANGE 0x000040
208#define CS_EVENT_CARD_DETECT 0x000080
209#define CS_EVENT_RESET_REQUEST 0x000100
210#define CS_EVENT_RESET_PHYSICAL 0x000200
211#define CS_EVENT_CARD_RESET 0x000400
212#define CS_EVENT_REGISTRATION_COMPLETE 0x000800
213#define CS_EVENT_PM_SUSPEND 0x002000
214#define CS_EVENT_PM_RESUME 0x004000
215#define CS_EVENT_INSERTION_REQUEST 0x008000
216#define CS_EVENT_EJECTION_REQUEST 0x010000
217#define CS_EVENT_MTD_REQUEST 0x020000
218#define CS_EVENT_ERASE_COMPLETE 0x040000
219#define CS_EVENT_REQUEST_ATTENTION 0x080000
220#define CS_EVENT_CB_DETECT 0x100000
221#define CS_EVENT_3VCARD 0x200000
222#define CS_EVENT_XVCARD 0x400000
223 94
224#endif /* _LINUX_CS_H */ 95#endif /* _LINUX_CS_H */
diff --git a/include/pcmcia/cs_types.h b/include/pcmcia/cs_types.h
deleted file mode 100644
index f5e3b8386c8f..000000000000
--- a/include/pcmcia/cs_types.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * cs_types.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * The initial developer of the original code is David A. Hinds
9 * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
11 *
12 * (C) 1999 David A. Hinds
13 */
14
15#ifndef _LINUX_CS_TYPES_H
16#define _LINUX_CS_TYPES_H
17
18#ifdef __KERNEL__
19#include <linux/types.h>
20#else
21#include <sys/types.h>
22#endif
23
24typedef u_short socket_t;
25typedef u_int event_t;
26typedef u_char cisdata_t;
27typedef u_short page_t;
28
29typedef unsigned long window_handle_t;
30
31struct region_t;
32typedef struct region_t *memory_handle_t;
33
34#ifndef DEV_NAME_LEN
35#define DEV_NAME_LEN 32
36#endif
37
38typedef char dev_info_t[DEV_NAME_LEN];
39
40#endif /* _LINUX_CS_TYPES_H */
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index c180165fbd3e..70c58ed2278c 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -20,7 +20,6 @@
20#include <linux/mod_devicetable.h> 20#include <linux/mod_devicetable.h>
21#endif 21#endif
22 22
23#include <pcmcia/cs_types.h>
24#include <pcmcia/device_id.h> 23#include <pcmcia/device_id.h>
25 24
26#ifdef __KERNEL__ 25#ifdef __KERNEL__
@@ -37,6 +36,8 @@ struct pcmcia_device;
37struct config_t; 36struct config_t;
38struct net_device; 37struct net_device;
39 38
39typedef struct resource *window_handle_t;
40
40/* dynamic device IDs for PCMCIA device drivers. See 41/* dynamic device IDs for PCMCIA device drivers. See
41 * Documentation/pcmcia/driver.txt for details. 42 * Documentation/pcmcia/driver.txt for details.
42*/ 43*/
@@ -62,6 +63,17 @@ struct pcmcia_driver {
62int pcmcia_register_driver(struct pcmcia_driver *driver); 63int pcmcia_register_driver(struct pcmcia_driver *driver);
63void pcmcia_unregister_driver(struct pcmcia_driver *driver); 64void pcmcia_unregister_driver(struct pcmcia_driver *driver);
64 65
66/* for struct resource * array embedded in struct pcmcia_device */
67enum {
68 PCMCIA_IOPORT_0,
69 PCMCIA_IOPORT_1,
70 PCMCIA_IOMEM_0,
71 PCMCIA_IOMEM_1,
72 PCMCIA_IOMEM_2,
73 PCMCIA_IOMEM_3,
74 PCMCIA_NUM_RESOURCES,
75};
76
65struct pcmcia_device { 77struct pcmcia_device {
66 /* the socket and the device_no [for multifunction devices] 78 /* the socket and the device_no [for multifunction devices]
67 uniquely define a pcmcia_device */ 79 uniquely define a pcmcia_device */
@@ -79,13 +91,14 @@ struct pcmcia_device {
79 struct list_head socket_device_list; 91 struct list_head socket_device_list;
80 92
81 /* deprecated, will be cleaned up soon */ 93 /* deprecated, will be cleaned up soon */
82 u_int open;
83 io_req_t io;
84 config_req_t conf; 94 config_req_t conf;
85 window_handle_t win; 95 window_handle_t win;
86 96
87 /* device setup */ 97 /* device setup */
88 unsigned int irq; 98 unsigned int irq;
99 struct resource *resource[PCMCIA_NUM_RESOURCES];
100
101 unsigned int io_lines; /* number of I/O lines */
89 102
90 /* Is the device suspended? */ 103 /* Is the device suspended? */
91 u16 suspended:1; 104 u16 suspended:1;
@@ -117,13 +130,9 @@ struct pcmcia_device {
117 u64 dma_mask; 130 u64 dma_mask;
118 struct device dev; 131 struct device dev;
119 132
120#ifdef CONFIG_PCMCIA_IOCTL
121 /* device driver wanted by cardmgr */
122 struct pcmcia_driver *cardmgr;
123#endif
124
125 /* data private to drivers */ 133 /* data private to drivers */
126 void *priv; 134 void *priv;
135 unsigned int open;
127}; 136};
128 137
129#define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev) 138#define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev)
@@ -178,11 +187,11 @@ struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *p_dev);
178int pcmcia_reset_card(struct pcmcia_socket *skt); 187int pcmcia_reset_card(struct pcmcia_socket *skt);
179 188
180/* CIS config */ 189/* CIS config */
181int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, 190int pcmcia_read_config_byte(struct pcmcia_device *p_dev, off_t where, u8 *val);
182 conf_reg_t *reg); 191int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val);
183 192
184/* device configuration */ 193/* device configuration */
185int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req); 194int pcmcia_request_io(struct pcmcia_device *p_dev);
186 195
187int __must_check 196int __must_check
188__pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev, 197__pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev,
@@ -204,215 +213,27 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req,
204 window_handle_t *wh); 213 window_handle_t *wh);
205int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t win); 214int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t win);
206int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t win, 215int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t win,
207 memreq_t *req); 216 unsigned int offset);
208 217
209int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); 218int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod);
210void pcmcia_disable_device(struct pcmcia_device *p_dev); 219void pcmcia_disable_device(struct pcmcia_device *p_dev);
211 220
212#endif /* __KERNEL__ */ 221/* IO ports */
213 222#define IO_DATA_PATH_WIDTH 0x18
214 223#define IO_DATA_PATH_WIDTH_8 0x00
224#define IO_DATA_PATH_WIDTH_16 0x08
225#define IO_DATA_PATH_WIDTH_AUTO 0x10
215 226
216/* Below, there are only definitions which are used by 227/* convert flag found in cfgtable to data path width parameter */
217 * - the PCMCIA ioctl 228static inline int pcmcia_io_cfg_data_width(unsigned int flags)
218 * - deprecated PCMCIA userspace tools only 229{
219 * 230 if (!(flags & CISTPL_IO_8BIT))
220 * here be dragons ... here be dragons ... here be dragons ... here be drag 231 return IO_DATA_PATH_WIDTH_16;
221 */ 232 if (!(flags & CISTPL_IO_16BIT))
222 233 return IO_DATA_PATH_WIDTH_8;
223#if defined(CONFIG_PCMCIA_IOCTL) || !defined(__KERNEL__) 234 return IO_DATA_PATH_WIDTH_AUTO;
224 235}
225#if defined(__arm__) || defined(__mips__) || defined(__avr32__) || \
226 defined(__bfin__)
227/* This (ioaddr_t) is exposed to userspace & hence cannot be changed. */
228typedef u_int ioaddr_t;
229#else
230typedef u_short ioaddr_t;
231#endif
232 236
233/* for AdjustResourceInfo */ 237#endif /* __KERNEL__ */
234typedef struct adjust_t {
235 u_int Action;
236 u_int Resource;
237 u_int Attributes;
238 union {
239 struct memory {
240 u_long Base;
241 u_long Size;
242 } memory;
243 struct io {
244 ioaddr_t BasePort;
245 ioaddr_t NumPorts;
246 u_int IOAddrLines;
247 } io;
248 struct irq {
249 u_int IRQ;
250 } irq;
251 } resource;
252} adjust_t;
253
254/* Action field */
255#define REMOVE_MANAGED_RESOURCE 1
256#define ADD_MANAGED_RESOURCE 2
257#define GET_FIRST_MANAGED_RESOURCE 3
258#define GET_NEXT_MANAGED_RESOURCE 4
259/* Resource field */
260#define RES_MEMORY_RANGE 1
261#define RES_IO_RANGE 2
262#define RES_IRQ 3
263/* Attribute field */
264#define RES_IRQ_TYPE 0x03
265#define RES_IRQ_TYPE_EXCLUSIVE 0
266#define RES_IRQ_TYPE_TIME 1
267#define RES_IRQ_TYPE_DYNAMIC 2
268#define RES_IRQ_CSC 0x04
269#define RES_SHARED 0x08
270#define RES_RESERVED 0x10
271#define RES_ALLOCATED 0x20
272#define RES_REMOVED 0x40
273
274
275typedef struct tuple_parse_t {
276 tuple_t tuple;
277 cisdata_t data[255];
278 cisparse_t parse;
279} tuple_parse_t;
280
281typedef struct win_info_t {
282 window_handle_t handle;
283 win_req_t window;
284 memreq_t map;
285} win_info_t;
286
287typedef struct bind_info_t {
288 dev_info_t dev_info;
289 u_char function;
290 struct pcmcia_device *instance;
291 char name[DEV_NAME_LEN];
292 u_short major, minor;
293 void *next;
294} bind_info_t;
295
296typedef struct mtd_info_t {
297 dev_info_t dev_info;
298 u_int Attributes;
299 u_int CardOffset;
300} mtd_info_t;
301
302typedef struct region_info_t {
303 u_int Attributes;
304 u_int CardOffset;
305 u_int RegionSize;
306 u_int AccessSpeed;
307 u_int BlockSize;
308 u_int PartMultiple;
309 u_char JedecMfr, JedecInfo;
310 memory_handle_t next;
311} region_info_t;
312
313#define REGION_TYPE 0x0001
314#define REGION_TYPE_CM 0x0000
315#define REGION_TYPE_AM 0x0001
316#define REGION_PREFETCH 0x0008
317#define REGION_CACHEABLE 0x0010
318#define REGION_BAR_MASK 0xe000
319#define REGION_BAR_SHIFT 13
320
321/* For ReplaceCIS */
322typedef struct cisdump_t {
323 u_int Length;
324 cisdata_t Data[CISTPL_MAX_CIS_SIZE];
325} cisdump_t;
326
327/* for GetConfigurationInfo */
328typedef struct config_info_t {
329 u_char Function;
330 u_int Attributes;
331 u_int Vcc, Vpp1, Vpp2;
332 u_int IntType;
333 u_int ConfigBase;
334 u_char Status, Pin, Copy, Option, ExtStatus;
335 u_int Present;
336 u_int CardValues;
337 u_int AssignedIRQ;
338 u_int IRQAttributes;
339 ioaddr_t BasePort1;
340 ioaddr_t NumPorts1;
341 u_int Attributes1;
342 ioaddr_t BasePort2;
343 ioaddr_t NumPorts2;
344 u_int Attributes2;
345 u_int IOAddrLines;
346} config_info_t;
347
348/* For ValidateCIS */
349typedef struct cisinfo_t {
350 u_int Chains;
351} cisinfo_t;
352
353typedef struct cs_status_t {
354 u_char Function;
355 event_t CardState;
356 event_t SocketState;
357} cs_status_t;
358
359typedef union ds_ioctl_arg_t {
360 adjust_t adjust;
361 config_info_t config;
362 tuple_t tuple;
363 tuple_parse_t tuple_parse;
364 client_req_t client_req;
365 cs_status_t status;
366 conf_reg_t conf_reg;
367 cisinfo_t cisinfo;
368 region_info_t region;
369 bind_info_t bind_info;
370 mtd_info_t mtd_info;
371 win_info_t win_info;
372 cisdump_t cisdump;
373} ds_ioctl_arg_t;
374
375#define DS_ADJUST_RESOURCE_INFO _IOWR('d', 2, adjust_t)
376#define DS_GET_CONFIGURATION_INFO _IOWR('d', 3, config_info_t)
377#define DS_GET_FIRST_TUPLE _IOWR('d', 4, tuple_t)
378#define DS_GET_NEXT_TUPLE _IOWR('d', 5, tuple_t)
379#define DS_GET_TUPLE_DATA _IOWR('d', 6, tuple_parse_t)
380#define DS_PARSE_TUPLE _IOWR('d', 7, tuple_parse_t)
381#define DS_RESET_CARD _IO ('d', 8)
382#define DS_GET_STATUS _IOWR('d', 9, cs_status_t)
383#define DS_ACCESS_CONFIGURATION_REGISTER _IOWR('d', 10, conf_reg_t)
384#define DS_VALIDATE_CIS _IOR ('d', 11, cisinfo_t)
385#define DS_SUSPEND_CARD _IO ('d', 12)
386#define DS_RESUME_CARD _IO ('d', 13)
387#define DS_EJECT_CARD _IO ('d', 14)
388#define DS_INSERT_CARD _IO ('d', 15)
389#define DS_GET_FIRST_REGION _IOWR('d', 16, region_info_t)
390#define DS_GET_NEXT_REGION _IOWR('d', 17, region_info_t)
391#define DS_REPLACE_CIS _IOWR('d', 18, cisdump_t)
392#define DS_GET_FIRST_WINDOW _IOR ('d', 19, win_info_t)
393#define DS_GET_NEXT_WINDOW _IOWR('d', 20, win_info_t)
394#define DS_GET_MEM_PAGE _IOWR('d', 21, win_info_t)
395
396#define DS_BIND_REQUEST _IOWR('d', 60, bind_info_t)
397#define DS_GET_DEVICE_INFO _IOWR('d', 61, bind_info_t)
398#define DS_GET_NEXT_DEVICE _IOWR('d', 62, bind_info_t)
399#define DS_UNBIND_REQUEST _IOW ('d', 63, bind_info_t)
400#define DS_BIND_MTD _IOWR('d', 64, mtd_info_t)
401
402
403/* used in userspace only */
404#define CS_IN_USE 0x1e
405
406#define INFO_MASTER_CLIENT 0x01
407#define INFO_IO_CLIENT 0x02
408#define INFO_MTD_CLIENT 0x04
409#define INFO_MEM_CLIENT 0x08
410#define MAX_NUM_CLIENTS 3
411
412#define INFO_CARD_SHARE 0x10
413#define INFO_CARD_EXCL 0x20
414
415
416#endif /* !defined(__KERNEL__) || defined(CONFIG_PCMCIA_IOCTL) */
417 238
418#endif /* _LINUX_DS_H */ 239#endif /* _LINUX_DS_H */
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index 764281b29218..626b63c33d9e 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -19,7 +19,6 @@
19#include <linux/sched.h> /* task_struct, completion */ 19#include <linux/sched.h> /* task_struct, completion */
20#include <linux/mutex.h> 20#include <linux/mutex.h>
21 21
22#include <pcmcia/cs_types.h>
23#include <pcmcia/cs.h> 22#include <pcmcia/cs.h>
24#ifdef CONFIG_CARDBUS 23#ifdef CONFIG_CARDBUS
25#include <linux/pci.h> 24#include <linux/pci.h>
@@ -162,17 +161,10 @@ struct pcmcia_socket {
162 u_int pci_irq; 161 u_int pci_irq;
163 struct pci_dev *cb_dev; 162 struct pci_dev *cb_dev;
164 163
165
166 /* socket setup is done so resources should be able to be allocated. 164 /* socket setup is done so resources should be able to be allocated.
167 * Only if set to 1, calls to find_{io,mem}_region are handled, and 165 * Only if set to 1, calls to find_{io,mem}_region are handled, and
168 * insertio events are actually managed by the PCMCIA layer.*/ 166 * insertio events are actually managed by the PCMCIA layer.*/
169 u8 resource_setup_done:1; 167 u8 resource_setup_done;
170
171 /* It's old if resource setup is done using adjust_resource_info() */
172 u8 resource_setup_old:1;
173 u8 resource_setup_new:1;
174
175 u8 reserved:5;
176 168
177 /* socket operations */ 169 /* socket operations */
178 struct pccard_operations *ops; 170 struct pccard_operations *ops;
@@ -218,15 +210,8 @@ struct pcmcia_socket {
218 * incorrectness and change */ 210 * incorrectness and change */
219 u8 device_count; 211 u8 device_count;
220 212
221 /* 16-bit state: */ 213 /* does the PCMCIA card consist of two pseudo devices? */
222 struct { 214 u8 pcmcia_pfc;
223 /* "master" ioctl is used */
224 u8 busy:1;
225 /* the PCMCIA card consists of two pseudo devices */
226 u8 has_pfc:1;
227
228 u8 reserved:6;
229 } pcmcia_state;
230 215
231 /* non-zero if PCMCIA card is present */ 216 /* non-zero if PCMCIA card is present */
232 atomic_t present; 217 atomic_t present;
@@ -234,10 +219,6 @@ struct pcmcia_socket {
234 /* IRQ to be used by PCMCIA devices. May not be IRQ 0. */ 219 /* IRQ to be used by PCMCIA devices. May not be IRQ 0. */
235 unsigned int pcmcia_irq; 220 unsigned int pcmcia_irq;
236 221
237#ifdef CONFIG_PCMCIA_IOCTL
238 struct user_info_t *user;
239 wait_queue_head_t queue;
240#endif /* CONFIG_PCMCIA_IOCTL */
241#endif /* CONFIG_PCMCIA */ 222#endif /* CONFIG_PCMCIA */
242 223
243 /* socket device */ 224 /* socket device */
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index f3e8f3c07725..857b3b9cf120 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -555,7 +555,7 @@ enum ib_qp_type {
555 IB_QPT_UC, 555 IB_QPT_UC,
556 IB_QPT_UD, 556 IB_QPT_UD,
557 IB_QPT_RAW_IPV6, 557 IB_QPT_RAW_IPV6,
558 IB_QPT_RAW_ETY 558 IB_QPT_RAW_ETHERTYPE
559}; 559};
560 560
561enum ib_qp_create_flags { 561enum ib_qp_create_flags {
diff --git a/include/rxrpc/packet.h b/include/rxrpc/packet.h
index b69e6e173ea1..9b2c30897e50 100644
--- a/include/rxrpc/packet.h
+++ b/include/rxrpc/packet.h
@@ -65,7 +65,7 @@ struct rxrpc_header {
65 }; 65 };
66 __be16 serviceId; /* service ID */ 66 __be16 serviceId; /* service ID */
67 67
68} __attribute__((packed)); 68} __packed;
69 69
70#define __rxrpc_header_off(X) offsetof(struct rxrpc_header,X) 70#define __rxrpc_header_off(X) offsetof(struct rxrpc_header,X)
71 71
@@ -120,7 +120,7 @@ struct rxrpc_ackpacket {
120#define RXRPC_ACK_TYPE_NACK 0 120#define RXRPC_ACK_TYPE_NACK 0
121#define RXRPC_ACK_TYPE_ACK 1 121#define RXRPC_ACK_TYPE_ACK 1
122 122
123} __attribute__((packed)); 123} __packed;
124 124
125/* 125/*
126 * ACK packets can have a further piece of information tagged on the end 126 * ACK packets can have a further piece of information tagged on the end
@@ -141,7 +141,7 @@ struct rxkad_challenge {
141 __be32 nonce; /* encrypted random number */ 141 __be32 nonce; /* encrypted random number */
142 __be32 min_level; /* minimum security level */ 142 __be32 min_level; /* minimum security level */
143 __be32 __padding; /* padding to 8-byte boundary */ 143 __be32 __padding; /* padding to 8-byte boundary */
144} __attribute__((packed)); 144} __packed;
145 145
146/*****************************************************************************/ 146/*****************************************************************************/
147/* 147/*
@@ -164,7 +164,7 @@ struct rxkad_response {
164 164
165 __be32 kvno; /* Kerberos key version number */ 165 __be32 kvno; /* Kerberos key version number */
166 __be32 ticket_len; /* Kerberos ticket length */ 166 __be32 ticket_len; /* Kerberos ticket length */
167} __attribute__((packed)); 167} __packed;
168 168
169/*****************************************************************************/ 169/*****************************************************************************/
170/* 170/*
diff --git a/include/scsi/fc/fc_els.h b/include/scsi/fc/fc_els.h
index f94328132a26..481abbd48e39 100644
--- a/include/scsi/fc/fc_els.h
+++ b/include/scsi/fc/fc_els.h
@@ -191,6 +191,7 @@ enum fc_els_rjt_reason {
191 ELS_RJT_UNAB = 0x09, /* unable to perform command request */ 191 ELS_RJT_UNAB = 0x09, /* unable to perform command request */
192 ELS_RJT_UNSUP = 0x0b, /* command not supported */ 192 ELS_RJT_UNSUP = 0x0b, /* command not supported */
193 ELS_RJT_INPROG = 0x0e, /* command already in progress */ 193 ELS_RJT_INPROG = 0x0e, /* command already in progress */
194 ELS_RJT_FIP = 0x20, /* FIP error */
194 ELS_RJT_VENDOR = 0xff, /* vendor specific error */ 195 ELS_RJT_VENDOR = 0xff, /* vendor specific error */
195}; 196};
196 197
@@ -212,6 +213,7 @@ enum fc_els_rjt_explan {
212 ELS_EXPL_UNAB_DATA = 0x2a, /* unable to supply requested data */ 213 ELS_EXPL_UNAB_DATA = 0x2a, /* unable to supply requested data */
213 ELS_EXPL_UNSUPR = 0x2c, /* Request not supported */ 214 ELS_EXPL_UNSUPR = 0x2c, /* Request not supported */
214 ELS_EXPL_INV_LEN = 0x2d, /* Invalid payload length */ 215 ELS_EXPL_INV_LEN = 0x2d, /* Invalid payload length */
216 ELS_EXPL_NOT_NEIGHBOR = 0x62, /* VN2VN_Port not in neighbor set */
215 /* TBD - above definitions incomplete */ 217 /* TBD - above definitions incomplete */
216}; 218};
217 219
@@ -405,6 +407,15 @@ struct fc_els_prli {
405}; 407};
406 408
407/* 409/*
410 * ELS_PRLO - Process logout request and response.
411 */
412struct fc_els_prlo {
413 __u8 prlo_cmd; /* command */
414 __u8 prlo_obs; /* obsolete, but shall be set to 10h */
415 __be16 prlo_len; /* payload length */
416};
417
418/*
408 * ELS_ADISC payload 419 * ELS_ADISC payload
409 */ 420 */
410struct fc_els_adisc { 421struct fc_els_adisc {
diff --git a/include/scsi/fc/fc_fcoe.h b/include/scsi/fc/fc_fcoe.h
index e6ad3d2ae475..d5dcd6062815 100644
--- a/include/scsi/fc/fc_fcoe.h
+++ b/include/scsi/fc/fc_fcoe.h
@@ -22,23 +22,18 @@
22 22
23/* 23/*
24 * FCoE - Fibre Channel over Ethernet. 24 * FCoE - Fibre Channel over Ethernet.
25 * See T11 FC-BB-5 Rev 2.00 (09-056v5.pdf)
25 */ 26 */
26 27
27/* 28/*
28 * FC_FCOE_OUI hasn't been standardized yet. XXX TBD. 29 * Default FC_FCOE_OUI / FC-MAP value.
29 */ 30 */
30#ifndef FC_FCOE_OUI 31#define FC_FCOE_OUI 0x0efc00 /* upper 24 bits of FCOE MAC */
31#define FC_FCOE_OUI 0x0efc00 /* upper 24 bits of FCOE dest MAC TBD */
32#endif
33 32
34/* 33/*
35 * The destination MAC address for the fabric login may get a different OUI. 34 * Fabric Login (FLOGI) MAC for non-FIP use. Non-FIP use is deprecated.
36 * This isn't standardized yet.
37 */ 35 */
38#ifndef FC_FCOE_FLOGI_MAC
39/* gateway MAC - TBD */
40#define FC_FCOE_FLOGI_MAC { 0x0e, 0xfc, 0x00, 0xff, 0xff, 0xfe } 36#define FC_FCOE_FLOGI_MAC { 0x0e, 0xfc, 0x00, 0xff, 0xff, 0xfe }
41#endif
42 37
43#define FC_FCOE_VER 0 /* version */ 38#define FC_FCOE_VER 0 /* version */
44 39
@@ -51,8 +46,6 @@
51 46
52/* 47/*
53 * FCoE frame header - 14 bytes 48 * FCoE frame header - 14 bytes
54 *
55 * This is the August 2007 version of the FCoE header as defined by T11.
56 * This follows the VLAN header, which includes the ethertype. 49 * This follows the VLAN header, which includes the ethertype.
57 */ 50 */
58struct fcoe_hdr { 51struct fcoe_hdr {
diff --git a/include/scsi/fc/fc_fip.h b/include/scsi/fc/fc_fip.h
index 17baa19380f0..ae25d4ab2548 100644
--- a/include/scsi/fc/fc_fip.h
+++ b/include/scsi/fc/fc_fip.h
@@ -17,9 +17,12 @@
17#ifndef _FC_FIP_H_ 17#ifndef _FC_FIP_H_
18#define _FC_FIP_H_ 18#define _FC_FIP_H_
19 19
20#include <scsi/fc/fc_ns.h>
21
20/* 22/*
21 * This version is based on: 23 * This version is based on:
22 * http://www.t11.org/ftp/t11/pub/fc/bb-5/08-543v1.pdf 24 * http://www.t11.org/ftp/t11/pub/fc/bb-5/08-543v1.pdf
25 * and T11 FC-BB-6 10-019v4.pdf (June 2010 VN2VN proposal)
23 */ 26 */
24 27
25#define FIP_DEF_PRI 128 /* default selection priority */ 28#define FIP_DEF_PRI 128 /* default selection priority */
@@ -29,11 +32,24 @@
29#define FIP_FCF_FUZZ 100 /* random time added by FCF (mS) */ 32#define FIP_FCF_FUZZ 100 /* random time added by FCF (mS) */
30 33
31/* 34/*
35 * VN2VN proposed-standard values.
36 */
37#define FIP_VN_FC_MAP 0x0efd00 /* MAC OUI for VN2VN use */
38#define FIP_VN_PROBE_WAIT 100 /* interval between VN2VN probes (ms) */
39#define FIP_VN_ANN_WAIT 400 /* interval between VN2VN announcements (ms) */
40#define FIP_VN_RLIM_INT 10000 /* interval between probes when rate limited */
41#define FIP_VN_RLIM_COUNT 10 /* number of probes before rate limiting */
42#define FIP_VN_BEACON_INT 8000 /* interval between VN2VN beacons */
43#define FIP_VN_BEACON_FUZZ 100 /* random time to add to beacon period (ms) */
44
45/*
32 * Multicast MAC addresses. T11-adopted. 46 * Multicast MAC addresses. T11-adopted.
33 */ 47 */
34#define FIP_ALL_FCOE_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 0 }) 48#define FIP_ALL_FCOE_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 0 })
35#define FIP_ALL_ENODE_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 1 }) 49#define FIP_ALL_ENODE_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 1 })
36#define FIP_ALL_FCF_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 2 }) 50#define FIP_ALL_FCF_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 2 })
51#define FIP_ALL_VN2VN_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 4 })
52#define FIP_ALL_P2P_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 5 })
37 53
38#define FIP_VER 1 /* version for fip_header */ 54#define FIP_VER 1 /* version for fip_header */
39 55
@@ -60,6 +76,7 @@ enum fip_opcode {
60 FIP_OP_LS = 2, /* Link Service request or reply */ 76 FIP_OP_LS = 2, /* Link Service request or reply */
61 FIP_OP_CTRL = 3, /* Keep Alive / Link Reset */ 77 FIP_OP_CTRL = 3, /* Keep Alive / Link Reset */
62 FIP_OP_VLAN = 4, /* VLAN discovery */ 78 FIP_OP_VLAN = 4, /* VLAN discovery */
79 FIP_OP_VN2VN = 5, /* VN2VN operation */
63 FIP_OP_VENDOR_MIN = 0xfff8, /* min vendor-specific opcode */ 80 FIP_OP_VENDOR_MIN = 0xfff8, /* min vendor-specific opcode */
64 FIP_OP_VENDOR_MAX = 0xfffe, /* max vendor-specific opcode */ 81 FIP_OP_VENDOR_MAX = 0xfffe, /* max vendor-specific opcode */
65}; 82};
@@ -97,11 +114,23 @@ enum fip_vlan_subcode {
97}; 114};
98 115
99/* 116/*
117 * Subcodes for FIP_OP_VN2VN.
118 */
119enum fip_vn2vn_subcode {
120 FIP_SC_VN_PROBE_REQ = 1, /* probe request */
121 FIP_SC_VN_PROBE_REP = 2, /* probe reply */
122 FIP_SC_VN_CLAIM_NOTIFY = 3, /* claim notification */
123 FIP_SC_VN_CLAIM_REP = 4, /* claim response */
124 FIP_SC_VN_BEACON = 5, /* beacon */
125};
126
127/*
100 * flags in header fip_flags. 128 * flags in header fip_flags.
101 */ 129 */
102enum fip_flag { 130enum fip_flag {
103 FIP_FL_FPMA = 0x8000, /* supports FPMA fabric-provided MACs */ 131 FIP_FL_FPMA = 0x8000, /* supports FPMA fabric-provided MACs */
104 FIP_FL_SPMA = 0x4000, /* supports SPMA server-provided MACs */ 132 FIP_FL_SPMA = 0x4000, /* supports SPMA server-provided MACs */
133 FIP_FL_REC_OR_P2P = 0x0008, /* configured addr or point-to-point */
105 FIP_FL_AVAIL = 0x0004, /* available for FLOGI/ELP */ 134 FIP_FL_AVAIL = 0x0004, /* available for FLOGI/ELP */
106 FIP_FL_SOL = 0x0002, /* this is a solicited message */ 135 FIP_FL_SOL = 0x0002, /* this is a solicited message */
107 FIP_FL_FPORT = 0x0001, /* sent from an F port */ 136 FIP_FL_FPORT = 0x0001, /* sent from an F port */
@@ -130,6 +159,7 @@ enum fip_desc_type {
130 FIP_DT_FKA = 12, /* advertisement keep-alive period */ 159 FIP_DT_FKA = 12, /* advertisement keep-alive period */
131 FIP_DT_VENDOR = 13, /* vendor ID */ 160 FIP_DT_VENDOR = 13, /* vendor ID */
132 FIP_DT_VLAN = 14, /* vlan number */ 161 FIP_DT_VLAN = 14, /* vlan number */
162 FIP_DT_FC4F = 15, /* FC-4 features */
133 FIP_DT_LIMIT, /* max defined desc_type + 1 */ 163 FIP_DT_LIMIT, /* max defined desc_type + 1 */
134 FIP_DT_VENDOR_BASE = 128, /* first vendor-specific desc_type */ 164 FIP_DT_VENDOR_BASE = 128, /* first vendor-specific desc_type */
135}; 165};
@@ -229,6 +259,16 @@ enum fip_fka_flags {
229/* FIP_DT_FKA flags */ 259/* FIP_DT_FKA flags */
230 260
231/* 261/*
262 * FIP_DT_FC4F - FC-4 features.
263 */
264struct fip_fc4_feat {
265 struct fip_desc fd_desc;
266 __u8 fd_resvd[2];
267 struct fc_ns_fts fd_fts;
268 struct fc_ns_ff fd_ff;
269} __attribute__((packed));
270
271/*
232 * FIP_DT_VENDOR descriptor. 272 * FIP_DT_VENDOR descriptor.
233 */ 273 */
234struct fip_vendor_desc { 274struct fip_vendor_desc {
diff --git a/include/scsi/fc/fc_ns.h b/include/scsi/fc/fc_ns.h
index e7d3ac497d7d..185015dd1166 100644
--- a/include/scsi/fc/fc_ns.h
+++ b/include/scsi/fc/fc_ns.h
@@ -100,6 +100,13 @@ struct fc_ns_fts {
100}; 100};
101 101
102/* 102/*
103 * FC4-features object.
104 */
105struct fc_ns_ff {
106 __be32 fd_feat[FC_NS_TYPES * 4 / FC_NS_BPW]; /* 4-bits per FC-type */
107};
108
109/*
103 * GID_PT request. 110 * GID_PT request.
104 */ 111 */
105struct fc_ns_gid_pt { 112struct fc_ns_gid_pt {
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index 9b4867c9c2d2..6d293c846a46 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -21,6 +21,13 @@
21#define _FC_ENCODE_H_ 21#define _FC_ENCODE_H_
22#include <asm/unaligned.h> 22#include <asm/unaligned.h>
23 23
24/*
25 * F_CTL values for simple requests and responses.
26 */
27#define FC_FCTL_REQ (FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT)
28#define FC_FCTL_RESP (FC_FC_EX_CTX | FC_FC_LAST_SEQ | \
29 FC_FC_END_SEQ | FC_FC_SEQ_INIT)
30
24struct fc_ns_rft { 31struct fc_ns_rft {
25 struct fc_ns_fid fid; /* port ID object */ 32 struct fc_ns_fid fid; /* port ID object */
26 struct fc_ns_fts fts; /* FC4-types object */ 33 struct fc_ns_fts fts; /* FC4-types object */
diff --git a/include/scsi/fc_frame.h b/include/scsi/fc_frame.h
index 4d3e9c7b7c57..4ad02041b667 100644
--- a/include/scsi/fc_frame.h
+++ b/include/scsi/fc_frame.h
@@ -30,6 +30,23 @@
30 30
31#include <linux/if_ether.h> 31#include <linux/if_ether.h>
32 32
33/* some helpful macros */
34
35#define ntohll(x) be64_to_cpu(x)
36#define htonll(x) cpu_to_be64(x)
37
38static inline u32 ntoh24(const u8 *p)
39{
40 return (p[0] << 16) | (p[1] << 8) | p[2];
41}
42
43static inline void hton24(u8 *p, u32 v)
44{
45 p[0] = (v >> 16) & 0xff;
46 p[1] = (v >> 8) & 0xff;
47 p[2] = v & 0xff;
48}
49
33/* 50/*
34 * The fc_frame interface is used to pass frame data between functions. 51 * The fc_frame interface is used to pass frame data between functions.
35 * The frame includes the data buffer, length, and SOF / EOF delimiter types. 52 * The frame includes the data buffer, length, and SOF / EOF delimiter types.
@@ -51,6 +68,7 @@
51#define fr_sof(fp) (fr_cb(fp)->fr_sof) 68#define fr_sof(fp) (fr_cb(fp)->fr_sof)
52#define fr_eof(fp) (fr_cb(fp)->fr_eof) 69#define fr_eof(fp) (fr_cb(fp)->fr_eof)
53#define fr_flags(fp) (fr_cb(fp)->fr_flags) 70#define fr_flags(fp) (fr_cb(fp)->fr_flags)
71#define fr_encaps(fp) (fr_cb(fp)->fr_encaps)
54#define fr_max_payload(fp) (fr_cb(fp)->fr_max_payload) 72#define fr_max_payload(fp) (fr_cb(fp)->fr_max_payload)
55#define fr_fsp(fp) (fr_cb(fp)->fr_fsp) 73#define fr_fsp(fp) (fr_cb(fp)->fr_fsp)
56#define fr_crc(fp) (fr_cb(fp)->fr_crc) 74#define fr_crc(fp) (fr_cb(fp)->fr_crc)
@@ -66,9 +84,10 @@ struct fcoe_rcv_info {
66 struct fc_fcp_pkt *fr_fsp; /* for the corresponding fcp I/O */ 84 struct fc_fcp_pkt *fr_fsp; /* for the corresponding fcp I/O */
67 u32 fr_crc; 85 u32 fr_crc;
68 u16 fr_max_payload; /* max FC payload */ 86 u16 fr_max_payload; /* max FC payload */
69 enum fc_sof fr_sof; /* start of frame delimiter */ 87 u8 fr_sof; /* start of frame delimiter */
70 enum fc_eof fr_eof; /* end of frame delimiter */ 88 u8 fr_eof; /* end of frame delimiter */
71 u8 fr_flags; /* flags - see below */ 89 u8 fr_flags; /* flags - see below */
90 u8 fr_encaps; /* LLD encapsulation info (e.g. FIP) */
72 u8 granted_mac[ETH_ALEN]; /* FCoE MAC address */ 91 u8 granted_mac[ETH_ALEN]; /* FCoE MAC address */
73}; 92};
74 93
@@ -97,6 +116,7 @@ static inline void fc_frame_init(struct fc_frame *fp)
97 fr_dev(fp) = NULL; 116 fr_dev(fp) = NULL;
98 fr_seq(fp) = NULL; 117 fr_seq(fp) = NULL;
99 fr_flags(fp) = 0; 118 fr_flags(fp) = 0;
119 fr_encaps(fp) = 0;
100} 120}
101 121
102struct fc_frame *fc_frame_alloc_fill(struct fc_lport *, size_t payload_len); 122struct fc_frame *fc_frame_alloc_fill(struct fc_lport *, size_t payload_len);
@@ -136,13 +156,39 @@ static inline int fc_frame_is_linear(struct fc_frame *fp)
136 156
137/* 157/*
138 * Get frame header from message in fc_frame structure. 158 * Get frame header from message in fc_frame structure.
159 * This version doesn't do a length check.
160 */
161static inline
162struct fc_frame_header *__fc_frame_header_get(const struct fc_frame *fp)
163{
164 return (struct fc_frame_header *)fr_hdr(fp);
165}
166
167/*
168 * Get frame header from message in fc_frame structure.
139 * This hides a cast and provides a place to add some checking. 169 * This hides a cast and provides a place to add some checking.
140 */ 170 */
141static inline 171static inline
142struct fc_frame_header *fc_frame_header_get(const struct fc_frame *fp) 172struct fc_frame_header *fc_frame_header_get(const struct fc_frame *fp)
143{ 173{
144 WARN_ON(fr_len(fp) < sizeof(struct fc_frame_header)); 174 WARN_ON(fr_len(fp) < sizeof(struct fc_frame_header));
145 return (struct fc_frame_header *) fr_hdr(fp); 175 return __fc_frame_header_get(fp);
176}
177
178/*
179 * Get source FC_ID (S_ID) from frame header in message.
180 */
181static inline u32 fc_frame_sid(const struct fc_frame *fp)
182{
183 return ntoh24(__fc_frame_header_get(fp)->fh_s_id);
184}
185
186/*
187 * Get destination FC_ID (D_ID) from frame header in message.
188 */
189static inline u32 fc_frame_did(const struct fc_frame *fp)
190{
191 return ntoh24(__fc_frame_header_get(fp)->fh_d_id);
146} 192}
147 193
148/* 194/*
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 66d377b9c72b..a8631acd37c3 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -313,6 +313,7 @@ enum iscsi_param {
313 ISCSI_PARAM_INITIATOR_NAME, 313 ISCSI_PARAM_INITIATOR_NAME,
314 314
315 ISCSI_PARAM_TGT_RESET_TMO, 315 ISCSI_PARAM_TGT_RESET_TMO,
316 ISCSI_PARAM_TARGET_ALIAS,
316 /* must always be last */ 317 /* must always be last */
317 ISCSI_PARAM_MAX, 318 ISCSI_PARAM_MAX,
318}; 319};
@@ -353,6 +354,7 @@ enum iscsi_param {
353#define ISCSI_ISID (1ULL << ISCSI_PARAM_ISID) 354#define ISCSI_ISID (1ULL << ISCSI_PARAM_ISID)
354#define ISCSI_INITIATOR_NAME (1ULL << ISCSI_PARAM_INITIATOR_NAME) 355#define ISCSI_INITIATOR_NAME (1ULL << ISCSI_PARAM_INITIATOR_NAME)
355#define ISCSI_TGT_RESET_TMO (1ULL << ISCSI_PARAM_TGT_RESET_TMO) 356#define ISCSI_TGT_RESET_TMO (1ULL << ISCSI_PARAM_TGT_RESET_TMO)
357#define ISCSI_TARGET_ALIAS (1ULL << ISCSI_PARAM_TARGET_ALIAS)
356 358
357/* iSCSI HBA params */ 359/* iSCSI HBA params */
358enum iscsi_host_param { 360enum iscsi_host_param {
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 7495c0ba67ee..14be49b44e84 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -42,24 +42,6 @@
42#define FC_EX_TIMEOUT 1 /* Exchange timeout */ 42#define FC_EX_TIMEOUT 1 /* Exchange timeout */
43#define FC_EX_CLOSED 2 /* Exchange closed */ 43#define FC_EX_CLOSED 2 /* Exchange closed */
44 44
45/* some helpful macros */
46
47#define ntohll(x) be64_to_cpu(x)
48#define htonll(x) cpu_to_be64(x)
49
50
51static inline u32 ntoh24(const u8 *p)
52{
53 return (p[0] << 16) | (p[1] << 8) | p[2];
54}
55
56static inline void hton24(u8 *p, u32 v)
57{
58 p[0] = (v >> 16) & 0xff;
59 p[1] = (v >> 8) & 0xff;
60 p[2] = v & 0xff;
61}
62
63/** 45/**
64 * enum fc_lport_state - Local port states 46 * enum fc_lport_state - Local port states
65 * @LPORT_ST_DISABLED: Disabled 47 * @LPORT_ST_DISABLED: Disabled
@@ -97,25 +79,25 @@ enum fc_disc_event {
97/** 79/**
98 * enum fc_rport_state - Remote port states 80 * enum fc_rport_state - Remote port states
99 * @RPORT_ST_INIT: Initialized 81 * @RPORT_ST_INIT: Initialized
82 * @RPORT_ST_FLOGI: Waiting for FLOGI completion for point-to-multipoint
83 * @RPORT_ST_PLOGI_WAIT: Waiting for peer to login for point-to-multipoint
100 * @RPORT_ST_PLOGI: Waiting for PLOGI completion 84 * @RPORT_ST_PLOGI: Waiting for PLOGI completion
101 * @RPORT_ST_PRLI: Waiting for PRLI completion 85 * @RPORT_ST_PRLI: Waiting for PRLI completion
102 * @RPORT_ST_RTV: Waiting for RTV completion 86 * @RPORT_ST_RTV: Waiting for RTV completion
103 * @RPORT_ST_READY: Ready for use 87 * @RPORT_ST_READY: Ready for use
104 * @RPORT_ST_LOGO: Remote port logout (LOGO) sent
105 * @RPORT_ST_ADISC: Discover Address sent 88 * @RPORT_ST_ADISC: Discover Address sent
106 * @RPORT_ST_DELETE: Remote port being deleted 89 * @RPORT_ST_DELETE: Remote port being deleted
107 * @RPORT_ST_RESTART: Remote port being deleted and will restart
108*/ 90*/
109enum fc_rport_state { 91enum fc_rport_state {
110 RPORT_ST_INIT, 92 RPORT_ST_INIT,
93 RPORT_ST_FLOGI,
94 RPORT_ST_PLOGI_WAIT,
111 RPORT_ST_PLOGI, 95 RPORT_ST_PLOGI,
112 RPORT_ST_PRLI, 96 RPORT_ST_PRLI,
113 RPORT_ST_RTV, 97 RPORT_ST_RTV,
114 RPORT_ST_READY, 98 RPORT_ST_READY,
115 RPORT_ST_LOGO,
116 RPORT_ST_ADISC, 99 RPORT_ST_ADISC,
117 RPORT_ST_DELETE, 100 RPORT_ST_DELETE,
118 RPORT_ST_RESTART,
119}; 101};
120 102
121/** 103/**
@@ -173,6 +155,7 @@ struct fc_rport_libfc_priv {
173 u16 flags; 155 u16 flags;
174 #define FC_RP_FLAGS_REC_SUPPORTED (1 << 0) 156 #define FC_RP_FLAGS_REC_SUPPORTED (1 << 0)
175 #define FC_RP_FLAGS_RETRY (1 << 1) 157 #define FC_RP_FLAGS_RETRY (1 << 1)
158 #define FC_RP_STARTED (1 << 2)
176 unsigned int e_d_tov; 159 unsigned int e_d_tov;
177 unsigned int r_a_tov; 160 unsigned int r_a_tov;
178}; 161};
@@ -185,16 +168,18 @@ struct fc_rport_libfc_priv {
185 * @rp_state: Enumeration that tracks progress of PLOGI, PRLI, 168 * @rp_state: Enumeration that tracks progress of PLOGI, PRLI,
186 * and RTV exchanges 169 * and RTV exchanges
187 * @ids: The remote port identifiers and roles 170 * @ids: The remote port identifiers and roles
188 * @flags: REC and RETRY supported flags 171 * @flags: STARTED, REC and RETRY_SUPPORTED flags
189 * @max_seq: Maximum number of concurrent sequences 172 * @max_seq: Maximum number of concurrent sequences
190 * @disc_id: The discovery identifier 173 * @disc_id: The discovery identifier
191 * @maxframe_size: The maximum frame size 174 * @maxframe_size: The maximum frame size
192 * @retries: The retry count for the current state 175 * @retries: The retry count for the current state
176 * @major_retries: The retry count for the entire PLOGI/PRLI state machine
193 * @e_d_tov: Error detect timeout value (in msec) 177 * @e_d_tov: Error detect timeout value (in msec)
194 * @r_a_tov: Resource allocation timeout value (in msec) 178 * @r_a_tov: Resource allocation timeout value (in msec)
195 * @rp_mutex: The mutex that protects the remote port 179 * @rp_mutex: The mutex that protects the remote port
196 * @retry_work: Handle for retries 180 * @retry_work: Handle for retries
197 * @event_callback: Callback when READY, FAILED or LOGO states complete 181 * @event_callback: Callback when READY, FAILED or LOGO states complete
182 * @rcu: Structure used for freeing in an RCU-safe manner
198 */ 183 */
199struct fc_rport_priv { 184struct fc_rport_priv {
200 struct fc_lport *local_port; 185 struct fc_lport *local_port;
@@ -207,6 +192,7 @@ struct fc_rport_priv {
207 u16 disc_id; 192 u16 disc_id;
208 u16 maxframe_size; 193 u16 maxframe_size;
209 unsigned int retries; 194 unsigned int retries;
195 unsigned int major_retries;
210 unsigned int e_d_tov; 196 unsigned int e_d_tov;
211 unsigned int r_a_tov; 197 unsigned int r_a_tov;
212 struct mutex rp_mutex; 198 struct mutex rp_mutex;
@@ -216,6 +202,7 @@ struct fc_rport_priv {
216 struct list_head peers; 202 struct list_head peers;
217 struct work_struct event_work; 203 struct work_struct event_work;
218 u32 supported_classes; 204 u32 supported_classes;
205 struct rcu_head rcu;
219}; 206};
220 207
221/** 208/**
@@ -262,14 +249,12 @@ struct fcoe_dev_stats {
262 249
263/** 250/**
264 * struct fc_seq_els_data - ELS data used for passing ELS specific responses 251 * struct fc_seq_els_data - ELS data used for passing ELS specific responses
265 * @fp: The ELS frame
266 * @reason: The reason for rejection 252 * @reason: The reason for rejection
267 * @explan: The explaination of the rejection 253 * @explan: The explaination of the rejection
268 * 254 *
269 * Mainly used by the exchange manager layer. 255 * Mainly used by the exchange manager layer.
270 */ 256 */
271struct fc_seq_els_data { 257struct fc_seq_els_data {
272 struct fc_frame *fp;
273 enum fc_els_rjt_reason reason; 258 enum fc_els_rjt_reason reason;
274 enum fc_els_rjt_explan explan; 259 enum fc_els_rjt_explan explan;
275}; 260};
@@ -405,6 +390,7 @@ struct fc_seq {
405 * @esb_stat: ESB exchange status 390 * @esb_stat: ESB exchange status
406 * @r_a_tov: Resouce allocation time out value (in msecs) 391 * @r_a_tov: Resouce allocation time out value (in msecs)
407 * @seq_id: The next sequence ID to use 392 * @seq_id: The next sequence ID to use
393 * @encaps: encapsulation information for lower-level driver
408 * @f_ctl: F_CTL flags for the sequence 394 * @f_ctl: F_CTL flags for the sequence
409 * @fh_type: The frame type 395 * @fh_type: The frame type
410 * @class: The class of service 396 * @class: The class of service
@@ -436,6 +422,7 @@ struct fc_exch {
436 u32 esb_stat; 422 u32 esb_stat;
437 u32 r_a_tov; 423 u32 r_a_tov;
438 u8 seq_id; 424 u8 seq_id;
425 u8 encaps;
439 u32 f_ctl; 426 u32 f_ctl;
440 u8 fh_type; 427 u8 fh_type;
441 enum fc_class class; 428 enum fc_class class;
@@ -530,12 +517,11 @@ struct libfc_function_template {
530 struct fc_frame *); 517 struct fc_frame *);
531 518
532 /* 519 /*
533 * Send an ELS response using infomation from a previous 520 * Send an ELS response using infomation from the received frame.
534 * exchange and sequence.
535 * 521 *
536 * STATUS: OPTIONAL 522 * STATUS: OPTIONAL
537 */ 523 */
538 void (*seq_els_rsp_send)(struct fc_seq *, enum fc_els_cmd, 524 void (*seq_els_rsp_send)(struct fc_frame *, enum fc_els_cmd,
539 struct fc_seq_els_data *); 525 struct fc_seq_els_data *);
540 526
541 /* 527 /*
@@ -567,6 +553,13 @@ struct libfc_function_template {
567 struct fc_seq *(*seq_start_next)(struct fc_seq *); 553 struct fc_seq *(*seq_start_next)(struct fc_seq *);
568 554
569 /* 555 /*
556 * Assign a sequence for an incoming request frame.
557 *
558 * STATUS: OPTIONAL
559 */
560 struct fc_seq *(*seq_assign)(struct fc_lport *, struct fc_frame *);
561
562 /*
570 * Reset an exchange manager, completing all sequences and exchanges. 563 * Reset an exchange manager, completing all sequences and exchanges.
571 * If s_id is non-zero, reset only exchanges originating from that FID. 564 * If s_id is non-zero, reset only exchanges originating from that FID.
572 * If d_id is non-zero, reset only exchanges sending to that FID. 565 * If d_id is non-zero, reset only exchanges sending to that FID.
@@ -587,8 +580,7 @@ struct libfc_function_template {
587 * 580 *
588 * STATUS: OPTIONAL 581 * STATUS: OPTIONAL
589 */ 582 */
590 void (*lport_recv)(struct fc_lport *, struct fc_seq *, 583 void (*lport_recv)(struct fc_lport *, struct fc_frame *);
591 struct fc_frame *);
592 584
593 /* 585 /*
594 * Reset the local port. 586 * Reset the local port.
@@ -650,8 +642,7 @@ struct libfc_function_template {
650 * 642 *
651 * STATUS: OPTIONAL 643 * STATUS: OPTIONAL
652 */ 644 */
653 void (*rport_recv_req)(struct fc_seq *, struct fc_frame *, 645 void (*rport_recv_req)(struct fc_lport *, struct fc_frame *);
654 struct fc_lport *);
655 646
656 /* 647 /*
657 * lookup an rport by it's port ID. 648 * lookup an rport by it's port ID.
@@ -697,8 +688,7 @@ struct libfc_function_template {
697 * 688 *
698 * STATUS: OPTIONAL 689 * STATUS: OPTIONAL
699 */ 690 */
700 void (*disc_recv_req)(struct fc_seq *, struct fc_frame *, 691 void (*disc_recv_req)(struct fc_lport *, struct fc_frame *);
701 struct fc_lport *);
702 692
703 /* 693 /*
704 * Start discovery for a local port. 694 * Start discovery for a local port.
@@ -736,7 +726,7 @@ struct libfc_function_template {
736 * @buf_len: Length of the discovery buffer 726 * @buf_len: Length of the discovery buffer
737 * @disc_id: Discovery ID 727 * @disc_id: Discovery ID
738 * @rports: List of discovered remote ports 728 * @rports: List of discovered remote ports
739 * @lport: The local port that discovery is for 729 * @priv: Private pointer for use by discovery code
740 * @disc_mutex: Mutex that protects the discovery context 730 * @disc_mutex: Mutex that protects the discovery context
741 * @partial_buf: Partial name buffer (if names are returned 731 * @partial_buf: Partial name buffer (if names are returned
742 * in multiple frames) 732 * in multiple frames)
@@ -752,7 +742,7 @@ struct fc_disc {
752 u16 disc_id; 742 u16 disc_id;
753 743
754 struct list_head rports; 744 struct list_head rports;
755 struct fc_lport *lport; 745 void *priv;
756 struct mutex disc_mutex; 746 struct mutex disc_mutex;
757 struct fc_gpn_ft_resp partial_buf; 747 struct fc_gpn_ft_resp partial_buf;
758 struct delayed_work disc_work; 748 struct delayed_work disc_work;
@@ -796,6 +786,7 @@ struct fc_disc {
796 * @mfs: The maximum Fibre Channel payload size 786 * @mfs: The maximum Fibre Channel payload size
797 * @max_retry_count: The maximum retry attempts 787 * @max_retry_count: The maximum retry attempts
798 * @max_rport_retry_count: The maximum remote port retry attempts 788 * @max_rport_retry_count: The maximum remote port retry attempts
789 * @rport_priv_size: Size needed by driver after struct fc_rport_priv
799 * @lro_xid: The maximum XID for LRO 790 * @lro_xid: The maximum XID for LRO
800 * @lso_max: The maximum large offload send size 791 * @lso_max: The maximum large offload send size
801 * @fcts: FC-4 type mask 792 * @fcts: FC-4 type mask
@@ -842,9 +833,11 @@ struct fc_lport {
842 u32 lro_enabled:1; 833 u32 lro_enabled:1;
843 u32 does_npiv:1; 834 u32 does_npiv:1;
844 u32 npiv_enabled:1; 835 u32 npiv_enabled:1;
836 u32 point_to_multipoint:1;
845 u32 mfs; 837 u32 mfs;
846 u8 max_retry_count; 838 u8 max_retry_count;
847 u8 max_rport_retry_count; 839 u8 max_rport_retry_count;
840 u16 rport_priv_size;
848 u16 link_speed; 841 u16 link_speed;
849 u16 link_supported_speeds; 842 u16 link_supported_speeds;
850 u16 lro_xid; 843 u16 lro_xid;
@@ -986,6 +979,7 @@ int fc_set_mfs(struct fc_lport *, u32 mfs);
986struct fc_lport *libfc_vport_create(struct fc_vport *, int privsize); 979struct fc_lport *libfc_vport_create(struct fc_vport *, int privsize);
987struct fc_lport *fc_vport_id_lookup(struct fc_lport *, u32 port_id); 980struct fc_lport *fc_vport_id_lookup(struct fc_lport *, u32 port_id);
988int fc_lport_bsg_request(struct fc_bsg_job *); 981int fc_lport_bsg_request(struct fc_bsg_job *);
982void fc_lport_set_local_id(struct fc_lport *, u32 port_id);
989 983
990/* 984/*
991 * REMOTE PORT LAYER 985 * REMOTE PORT LAYER
@@ -998,6 +992,11 @@ void fc_rport_terminate_io(struct fc_rport *);
998 *****************************/ 992 *****************************/
999int fc_disc_init(struct fc_lport *); 993int fc_disc_init(struct fc_lport *);
1000 994
995static inline struct fc_lport *fc_disc_lport(struct fc_disc *disc)
996{
997 return container_of(disc, struct fc_lport, disc);
998}
999
1001/* 1000/*
1002 * FCP LAYER 1001 * FCP LAYER
1003 *****************************/ 1002 *****************************/
@@ -1029,6 +1028,10 @@ struct fc_seq *fc_elsct_send(struct fc_lport *, u32 did,
1029 void *arg, u32 timer_msec); 1028 void *arg, u32 timer_msec);
1030void fc_lport_flogi_resp(struct fc_seq *, struct fc_frame *, void *); 1029void fc_lport_flogi_resp(struct fc_seq *, struct fc_frame *, void *);
1031void fc_lport_logo_resp(struct fc_seq *, struct fc_frame *, void *); 1030void fc_lport_logo_resp(struct fc_seq *, struct fc_frame *, void *);
1031void fc_fill_reply_hdr(struct fc_frame *, const struct fc_frame *,
1032 enum fc_rctl, u32 parm_offset);
1033void fc_fill_hdr(struct fc_frame *, const struct fc_frame *,
1034 enum fc_rctl, u32 f_ctl, u16 seq_cnt, u32 parm_offset);
1032 1035
1033 1036
1034/* 1037/*
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index ec13f51531f8..06f1b5a8ed19 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -26,6 +26,7 @@
26#include <linux/netdevice.h> 26#include <linux/netdevice.h>
27#include <linux/skbuff.h> 27#include <linux/skbuff.h>
28#include <linux/workqueue.h> 28#include <linux/workqueue.h>
29#include <linux/random.h>
29#include <scsi/fc/fc_fcoe.h> 30#include <scsi/fc/fc_fcoe.h>
30#include <scsi/libfc.h> 31#include <scsi/libfc.h>
31 32
@@ -37,6 +38,7 @@
37#define FCOE_CTLR_START_DELAY 2000 /* mS after first adv. to choose FCF */ 38#define FCOE_CTLR_START_DELAY 2000 /* mS after first adv. to choose FCF */
38#define FCOE_CTRL_SOL_TOV 2000 /* min. solicitation interval (mS) */ 39#define FCOE_CTRL_SOL_TOV 2000 /* min. solicitation interval (mS) */
39#define FCOE_CTLR_FCF_LIMIT 20 /* max. number of FCF entries */ 40#define FCOE_CTLR_FCF_LIMIT 20 /* max. number of FCF entries */
41#define FCOE_CTLR_VN2VN_LOGIN_LIMIT 3 /* max. VN2VN rport login retries */
40 42
41/** 43/**
42 * enum fip_state - internal state of FCoE controller. 44 * enum fip_state - internal state of FCoE controller.
@@ -45,6 +47,11 @@
45 * @FIP_ST_AUTO: determining whether to use FIP or non-FIP mode. 47 * @FIP_ST_AUTO: determining whether to use FIP or non-FIP mode.
46 * @FIP_ST_NON_FIP: non-FIP mode selected. 48 * @FIP_ST_NON_FIP: non-FIP mode selected.
47 * @FIP_ST_ENABLED: FIP mode selected. 49 * @FIP_ST_ENABLED: FIP mode selected.
50 * @FIP_ST_VNMP_START: VN2VN multipath mode start, wait
51 * @FIP_ST_VNMP_PROBE1: VN2VN sent first probe, listening
52 * @FIP_ST_VNMP_PROBE2: VN2VN sent second probe, listening
53 * @FIP_ST_VNMP_CLAIM: VN2VN sent claim, waiting for responses
54 * @FIP_ST_VNMP_UP: VN2VN multipath mode operation
48 */ 55 */
49enum fip_state { 56enum fip_state {
50 FIP_ST_DISABLED, 57 FIP_ST_DISABLED,
@@ -52,8 +59,23 @@ enum fip_state {
52 FIP_ST_AUTO, 59 FIP_ST_AUTO,
53 FIP_ST_NON_FIP, 60 FIP_ST_NON_FIP,
54 FIP_ST_ENABLED, 61 FIP_ST_ENABLED,
62 FIP_ST_VNMP_START,
63 FIP_ST_VNMP_PROBE1,
64 FIP_ST_VNMP_PROBE2,
65 FIP_ST_VNMP_CLAIM,
66 FIP_ST_VNMP_UP,
55}; 67};
56 68
69/*
70 * Modes:
71 * The mode is the state that is to be entered after link up.
72 * It must not change after fcoe_ctlr_init() sets it.
73 */
74#define FIP_MODE_AUTO FIP_ST_AUTO
75#define FIP_MODE_NON_FIP FIP_ST_NON_FIP
76#define FIP_MODE_FABRIC FIP_ST_ENABLED
77#define FIP_MODE_VN2VN FIP_ST_VNMP_START
78
57/** 79/**
58 * struct fcoe_ctlr - FCoE Controller and FIP state 80 * struct fcoe_ctlr - FCoE Controller and FIP state
59 * @state: internal FIP state for network link and FIP or non-FIP mode. 81 * @state: internal FIP state for network link and FIP or non-FIP mode.
@@ -70,19 +92,20 @@ enum fip_state {
70 * @timer_work: &work_struct for doing keep-alives and resets. 92 * @timer_work: &work_struct for doing keep-alives and resets.
71 * @recv_work: &work_struct for receiving FIP frames. 93 * @recv_work: &work_struct for receiving FIP frames.
72 * @fip_recv_list: list of received FIP frames. 94 * @fip_recv_list: list of received FIP frames.
95 * @rnd_state: state for pseudo-random number generator.
96 * @port_id: proposed or selected local-port ID.
73 * @user_mfs: configured maximum FC frame size, including FC header. 97 * @user_mfs: configured maximum FC frame size, including FC header.
74 * @flogi_oxid: exchange ID of most recent fabric login. 98 * @flogi_oxid: exchange ID of most recent fabric login.
75 * @flogi_count: number of FLOGI attempts in AUTO mode. 99 * @flogi_count: number of FLOGI attempts in AUTO mode.
76 * @map_dest: use the FC_MAP mode for destination MAC addresses. 100 * @map_dest: use the FC_MAP mode for destination MAC addresses.
77 * @spma: supports SPMA server-provided MACs mode 101 * @spma: supports SPMA server-provided MACs mode
78 * @send_ctlr_ka: need to send controller keep alive 102 * @probe_tries: number of FC_IDs probed
79 * @send_port_ka: need to send port keep alives
80 * @dest_addr: MAC address of the selected FC forwarder. 103 * @dest_addr: MAC address of the selected FC forwarder.
81 * @ctl_src_addr: the native MAC address of our local port. 104 * @ctl_src_addr: the native MAC address of our local port.
82 * @send: LLD-supplied function to handle sending FIP Ethernet frames 105 * @send: LLD-supplied function to handle sending FIP Ethernet frames
83 * @update_mac: LLD-supplied function to handle changes to MAC addresses. 106 * @update_mac: LLD-supplied function to handle changes to MAC addresses.
84 * @get_src_addr: LLD-supplied function to supply a source MAC address. 107 * @get_src_addr: LLD-supplied function to supply a source MAC address.
85 * @lock: lock protecting this structure. 108 * @ctlr_mutex: lock protecting this structure.
86 * 109 *
87 * This structure is used by all FCoE drivers. It contains information 110 * This structure is used by all FCoE drivers. It contains information
88 * needed by all FCoE low-level drivers (LLDs) as well as internal state 111 * needed by all FCoE low-level drivers (LLDs) as well as internal state
@@ -103,21 +126,23 @@ struct fcoe_ctlr {
103 struct work_struct timer_work; 126 struct work_struct timer_work;
104 struct work_struct recv_work; 127 struct work_struct recv_work;
105 struct sk_buff_head fip_recv_list; 128 struct sk_buff_head fip_recv_list;
129
130 struct rnd_state rnd_state;
131 u32 port_id;
132
106 u16 user_mfs; 133 u16 user_mfs;
107 u16 flogi_oxid; 134 u16 flogi_oxid;
108 u8 flogi_count; 135 u8 flogi_count;
109 u8 reset_req;
110 u8 map_dest; 136 u8 map_dest;
111 u8 spma; 137 u8 spma;
112 u8 send_ctlr_ka; 138 u8 probe_tries;
113 u8 send_port_ka;
114 u8 dest_addr[ETH_ALEN]; 139 u8 dest_addr[ETH_ALEN];
115 u8 ctl_src_addr[ETH_ALEN]; 140 u8 ctl_src_addr[ETH_ALEN];
116 141
117 void (*send)(struct fcoe_ctlr *, struct sk_buff *); 142 void (*send)(struct fcoe_ctlr *, struct sk_buff *);
118 void (*update_mac)(struct fc_lport *, u8 *addr); 143 void (*update_mac)(struct fc_lport *, u8 *addr);
119 u8 * (*get_src_addr)(struct fc_lport *); 144 u8 * (*get_src_addr)(struct fc_lport *);
120 spinlock_t lock; 145 struct mutex ctlr_mutex;
121}; 146};
122 147
123/** 148/**
@@ -156,8 +181,26 @@ struct fcoe_fcf {
156 u8 fd_flags:1; 181 u8 fd_flags:1;
157}; 182};
158 183
184/**
185 * struct fcoe_rport - VN2VN remote port
186 * @time: time of create or last beacon packet received from node
187 * @fcoe_len: max FCoE frame size, not including VLAN or Ethernet headers
188 * @flags: flags from probe or claim
189 * @login_count: number of unsuccessful rport logins to this port
190 * @enode_mac: E_Node control MAC address
191 * @vn_mac: VN_Node assigned MAC address for data
192 */
193struct fcoe_rport {
194 unsigned long time;
195 u16 fcoe_len;
196 u16 flags;
197 u8 login_count;
198 u8 enode_mac[ETH_ALEN];
199 u8 vn_mac[ETH_ALEN];
200};
201
159/* FIP API functions */ 202/* FIP API functions */
160void fcoe_ctlr_init(struct fcoe_ctlr *); 203void fcoe_ctlr_init(struct fcoe_ctlr *, enum fip_state);
161void fcoe_ctlr_destroy(struct fcoe_ctlr *); 204void fcoe_ctlr_destroy(struct fcoe_ctlr *);
162void fcoe_ctlr_link_up(struct fcoe_ctlr *); 205void fcoe_ctlr_link_up(struct fcoe_ctlr *);
163int fcoe_ctlr_link_down(struct fcoe_ctlr *); 206int fcoe_ctlr_link_down(struct fcoe_ctlr *);
@@ -168,6 +211,17 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *,
168 211
169/* libfcoe funcs */ 212/* libfcoe funcs */
170u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); 213u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int);
171int fcoe_libfc_config(struct fc_lport *, struct libfc_function_template *); 214int fcoe_libfc_config(struct fc_lport *, struct fcoe_ctlr *,
215 const struct libfc_function_template *, int init_fcp);
216
217/**
218 * is_fip_mode() - returns true if FIP mode selected.
219 * @fip: FCoE controller.
220 */
221static inline bool is_fip_mode(struct fcoe_ctlr *fip)
222{
223 return fip->state == FIP_ST_ENABLED;
224}
225
172 226
173#endif /* _LIBFCOE_H */ 227#endif /* _LIBFCOE_H */
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 3b586859669c..d06e13be717b 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -422,16 +422,7 @@ enum service_response {
422}; 422};
423 423
424enum exec_status { 424enum exec_status {
425 SAM_GOOD = 0, 425 /* The SAM_STAT_.. codes fit in the lower 6 bits */
426 SAM_CHECK_COND = 2,
427 SAM_COND_MET = 4,
428 SAM_BUSY = 8,
429 SAM_INTERMEDIATE = 0x10,
430 SAM_IM_COND_MET = 0x12,
431 SAM_RESV_CONFLICT= 0x14,
432 SAM_TASK_SET_FULL= 0x28,
433 SAM_ACA_ACTIVE = 0x30,
434 SAM_TASK_ABORTED = 0x40,
435 426
436 SAS_DEV_NO_RESPONSE = 0x80, 427 SAS_DEV_NO_RESPONSE = 0x80,
437 SAS_DATA_UNDERRUN, 428 SAS_DATA_UNDERRUN,
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 9ae5c613131b..8fcb6e0e9e72 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -151,10 +151,10 @@ struct scsi_cmnd;
151 151
152/* defined in T10 SCSI Primary Commands-2 (SPC2) */ 152/* defined in T10 SCSI Primary Commands-2 (SPC2) */
153struct scsi_varlen_cdb_hdr { 153struct scsi_varlen_cdb_hdr {
154 u8 opcode; /* opcode always == VARIABLE_LENGTH_CMD */ 154 __u8 opcode; /* opcode always == VARIABLE_LENGTH_CMD */
155 u8 control; 155 __u8 control;
156 u8 misc[5]; 156 __u8 misc[5];
157 u8 additional_cdb_length; /* total cdb length - 8 */ 157 __u8 additional_cdb_length; /* total cdb length - 8 */
158 __be16 service_action; 158 __be16 service_action;
159 /* service specific data follows */ 159 /* service specific data follows */
160}; 160};
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index d80b6dbed1ca..50cb34ffef11 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -381,6 +381,14 @@ extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd,
381 struct scsi_sense_hdr *, int timeout, int retries, 381 struct scsi_sense_hdr *, int timeout, int retries,
382 int *resid); 382 int *resid);
383 383
384#ifdef CONFIG_PM_RUNTIME
385extern int scsi_autopm_get_device(struct scsi_device *);
386extern void scsi_autopm_put_device(struct scsi_device *);
387#else
388static inline int scsi_autopm_get_device(struct scsi_device *d) { return 0; }
389static inline void scsi_autopm_put_device(struct scsi_device *d) {}
390#endif /* CONFIG_PM_RUNTIME */
391
384static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev) 392static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev)
385{ 393{
386 return device_reprobe(&sdev->sdev_gendev); 394 return device_reprobe(&sdev->sdev_gendev);
diff --git a/include/scsi/scsi_netlink.h b/include/scsi/scsi_netlink.h
index 536752c40d41..58ce8fe44783 100644
--- a/include/scsi/scsi_netlink.h
+++ b/include/scsi/scsi_netlink.h
@@ -105,8 +105,8 @@ struct scsi_nl_host_vendor_msg {
105 * PCI : ID data is the 16 bit PCI Registered Vendor ID 105 * PCI : ID data is the 16 bit PCI Registered Vendor ID
106 */ 106 */
107#define SCSI_NL_VID_TYPE_SHIFT 56 107#define SCSI_NL_VID_TYPE_SHIFT 56
108#define SCSI_NL_VID_TYPE_MASK ((u64)0xFF << SCSI_NL_VID_TYPE_SHIFT) 108#define SCSI_NL_VID_TYPE_MASK ((__u64)0xFF << SCSI_NL_VID_TYPE_SHIFT)
109#define SCSI_NL_VID_TYPE_PCI ((u64)0x01 << SCSI_NL_VID_TYPE_SHIFT) 109#define SCSI_NL_VID_TYPE_PCI ((__u64)0x01 << SCSI_NL_VID_TYPE_SHIFT)
110#define SCSI_NL_VID_ID_MASK (~ SCSI_NL_VID_TYPE_MASK) 110#define SCSI_NL_VID_ID_MASK (~ SCSI_NL_VID_TYPE_MASK)
111 111
112 112
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 349c7f30720d..7fff94b3b2a8 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -32,6 +32,7 @@ struct scsi_transport_template;
32struct iscsi_transport; 32struct iscsi_transport;
33struct iscsi_endpoint; 33struct iscsi_endpoint;
34struct Scsi_Host; 34struct Scsi_Host;
35struct scsi_cmnd;
35struct iscsi_cls_conn; 36struct iscsi_cls_conn;
36struct iscsi_conn; 37struct iscsi_conn;
37struct iscsi_task; 38struct iscsi_task;
@@ -255,5 +256,6 @@ extern int iscsi_scan_finished(struct Scsi_Host *shost, unsigned long time);
255extern struct iscsi_endpoint *iscsi_create_endpoint(int dd_size); 256extern struct iscsi_endpoint *iscsi_create_endpoint(int dd_size);
256extern void iscsi_destroy_endpoint(struct iscsi_endpoint *ep); 257extern void iscsi_destroy_endpoint(struct iscsi_endpoint *ep);
257extern struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle); 258extern struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle);
259extern int iscsi_block_scsi_eh(struct scsi_cmnd *cmd);
258 260
259#endif 261#endif
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 9f1eecf99e6b..a1803ecea34d 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -212,7 +212,11 @@ typedef int __bitwise snd_pcm_format_t;
212#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */ 212#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */
213#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */ 213#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */
214#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */ 214#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */
215#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_U18_3BE 215#define SNDRV_PCM_FORMAT_G723_24 ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
216#define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */
217#define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
218#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
219#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_G723_40_1B
216 220
217#ifdef SNDRV_LITTLE_ENDIAN 221#ifdef SNDRV_LITTLE_ENDIAN
218#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE 222#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index dd76cdede64d..85f1c6bf8566 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -174,6 +174,10 @@ struct snd_pcm_ops {
174#define SNDRV_PCM_FMTBIT_U18_3LE (1ULL << SNDRV_PCM_FORMAT_U18_3LE) 174#define SNDRV_PCM_FMTBIT_U18_3LE (1ULL << SNDRV_PCM_FORMAT_U18_3LE)
175#define SNDRV_PCM_FMTBIT_S18_3BE (1ULL << SNDRV_PCM_FORMAT_S18_3BE) 175#define SNDRV_PCM_FMTBIT_S18_3BE (1ULL << SNDRV_PCM_FORMAT_S18_3BE)
176#define SNDRV_PCM_FMTBIT_U18_3BE (1ULL << SNDRV_PCM_FORMAT_U18_3BE) 176#define SNDRV_PCM_FMTBIT_U18_3BE (1ULL << SNDRV_PCM_FORMAT_U18_3BE)
177#define SNDRV_PCM_FMTBIT_G723_24 (1ULL << SNDRV_PCM_FORMAT_G723_24)
178#define SNDRV_PCM_FMTBIT_G723_24_1B (1ULL << SNDRV_PCM_FORMAT_G723_24_1B)
179#define SNDRV_PCM_FMTBIT_G723_40 (1ULL << SNDRV_PCM_FORMAT_G723_40)
180#define SNDRV_PCM_FMTBIT_G723_40_1B (1ULL << SNDRV_PCM_FORMAT_G723_40_1B)
177 181
178#ifdef SNDRV_LITTLE_ENDIAN 182#ifdef SNDRV_LITTLE_ENDIAN
179#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE 183#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE
@@ -313,7 +317,7 @@ struct snd_pcm_runtime {
313 struct snd_pcm_mmap_control *control; 317 struct snd_pcm_mmap_control *control;
314 318
315 /* -- locking / scheduling -- */ 319 /* -- locking / scheduling -- */
316 unsigned int twake: 1; /* do transfer (!poll) wakeup */ 320 snd_pcm_uframes_t twake; /* do transfer (!poll) wakeup if non-zero */
317 wait_queue_head_t sleep; /* poll sleep */ 321 wait_queue_head_t sleep; /* poll sleep */
318 wait_queue_head_t tsleep; /* transfer sleep */ 322 wait_queue_head_t tsleep; /* transfer sleep */
319 struct fasync_struct *fasync; 323 struct fasync_struct *fasync;
@@ -366,7 +370,7 @@ struct snd_pcm_substream {
366 int number; 370 int number;
367 char name[32]; /* substream name */ 371 char name[32]; /* substream name */
368 int stream; /* stream (direction) */ 372 int stream; /* stream (direction) */
369 struct pm_qos_request_list *latency_pm_qos_req; /* pm_qos request */ 373 struct pm_qos_request_list latency_pm_qos_req; /* pm_qos request */
370 size_t buffer_bytes_max; /* limit ring buffer size */ 374 size_t buffer_bytes_max; /* limit ring buffer size */
371 struct snd_dma_buffer dma_buffer; 375 struct snd_dma_buffer dma_buffer;
372 unsigned int dma_buf_id; 376 unsigned int dma_buf_id;
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h
index c0227361a876..9d51d6f35893 100644
--- a/include/sound/sh_fsi.h
+++ b/include/sound/sh_fsi.h
@@ -12,6 +12,9 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15#define FSI_PORT_A 0
16#define FSI_PORT_B 1
17
15/* flags format 18/* flags format
16 19
17 * 0xABCDEEFF 20 * 0xABCDEEFF
@@ -55,12 +58,14 @@
55#define SH_FSI_GET_IFMT(x) ((x >> 8) & SH_FSI_FMT_MASK) 58#define SH_FSI_GET_IFMT(x) ((x >> 8) & SH_FSI_FMT_MASK)
56#define SH_FSI_GET_OFMT(x) ((x >> 0) & SH_FSI_FMT_MASK) 59#define SH_FSI_GET_OFMT(x) ((x >> 0) & SH_FSI_FMT_MASK)
57 60
58#define SH_FSI_FMT_MONO (1 << 0) 61#define SH_FSI_FMT_MONO 0
59#define SH_FSI_FMT_MONO_DELAY (1 << 1) 62#define SH_FSI_FMT_MONO_DELAY 1
60#define SH_FSI_FMT_PCM (1 << 2) 63#define SH_FSI_FMT_PCM 2
61#define SH_FSI_FMT_I2S (1 << 3) 64#define SH_FSI_FMT_I2S 3
62#define SH_FSI_FMT_TDM (1 << 4) 65#define SH_FSI_FMT_TDM 4
63#define SH_FSI_FMT_TDM_DELAY (1 << 5) 66#define SH_FSI_FMT_TDM_DELAY 5
67#define SH_FSI_FMT_SPDIF 6
68
64 69
65#define SH_FSI_IFMT_TDM_CH(x) \ 70#define SH_FSI_IFMT_TDM_CH(x) \
66 (SH_FSI_IFMT(TDM) | SH_FSI_SET_CH_I(x)) 71 (SH_FSI_IFMT(TDM) | SH_FSI_SET_CH_I(x))
@@ -72,9 +77,41 @@
72#define SH_FSI_OFMT_TDM_DELAY_CH(x) \ 77#define SH_FSI_OFMT_TDM_DELAY_CH(x) \
73 (SH_FSI_OFMT(TDM_DELAY) | SH_FSI_SET_CH_O(x)) 78 (SH_FSI_OFMT(TDM_DELAY) | SH_FSI_SET_CH_O(x))
74 79
80
81/*
82 * set_rate return value
83 *
84 * see ACKMD/BPFMD on
85 * ACK_MD (FSI2)
86 * CKG1 (FSI)
87 *
88 * err: return value < 0
89 *
90 * 0x-00000AB
91 *
92 * A: ACKMD value
93 * B: BPFMD value
94 */
95
96#define SH_FSI_ACKMD_MASK (0xF << 0)
97#define SH_FSI_ACKMD_512 (1 << 0)
98#define SH_FSI_ACKMD_256 (2 << 0)
99#define SH_FSI_ACKMD_128 (3 << 0)
100#define SH_FSI_ACKMD_64 (4 << 0)
101#define SH_FSI_ACKMD_32 (5 << 0)
102
103#define SH_FSI_BPFMD_MASK (0xF << 4)
104#define SH_FSI_BPFMD_512 (1 << 4)
105#define SH_FSI_BPFMD_256 (2 << 4)
106#define SH_FSI_BPFMD_128 (3 << 4)
107#define SH_FSI_BPFMD_64 (4 << 4)
108#define SH_FSI_BPFMD_32 (5 << 4)
109#define SH_FSI_BPFMD_16 (6 << 4)
110
75struct sh_fsi_platform_info { 111struct sh_fsi_platform_info {
76 unsigned long porta_flags; 112 unsigned long porta_flags;
77 unsigned long portb_flags; 113 unsigned long portb_flags;
114 int (*set_rate)(int is_porta, int rate); /* for master mode */
78}; 115};
79 116
80extern struct snd_soc_dai fsi_soc_dai[2]; 117extern struct snd_soc_dai fsi_soc_dai[2];
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 66ff4c124dbd..c5d9987bc897 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -273,6 +273,8 @@
273#define SND_SOC_DAPM_POST_PMD 0x8 /* after widget power down */ 273#define SND_SOC_DAPM_POST_PMD 0x8 /* after widget power down */
274#define SND_SOC_DAPM_PRE_REG 0x10 /* before audio path setup */ 274#define SND_SOC_DAPM_PRE_REG 0x10 /* before audio path setup */
275#define SND_SOC_DAPM_POST_REG 0x20 /* after audio path setup */ 275#define SND_SOC_DAPM_POST_REG 0x20 /* after audio path setup */
276#define SND_SOC_DAPM_PRE_POST_PMD \
277 (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD)
276 278
277/* convenience event type detection */ 279/* convenience event type detection */
278#define SND_SOC_DAPM_EVENT_ON(e) \ 280#define SND_SOC_DAPM_EVENT_ON(e) \
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 697e7ffe39d7..65e9d03ed4f5 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -170,6 +170,21 @@
170 .get = xhandler_get, .put = xhandler_put, \ 170 .get = xhandler_get, .put = xhandler_put, \
171 .private_value = (unsigned long)&xenum } 171 .private_value = (unsigned long)&xenum }
172 172
173#define SOC_DOUBLE_R_SX_TLV(xname, xreg_left, xreg_right, xshift,\
174 xmin, xmax, tlv_array) \
175{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
176 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
177 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
178 .tlv.p = (tlv_array), \
179 .info = snd_soc_info_volsw_2r_sx, \
180 .get = snd_soc_get_volsw_2r_sx, \
181 .put = snd_soc_put_volsw_2r_sx, \
182 .private_value = (unsigned long)&(struct soc_mixer_control) \
183 {.reg = xreg_left, \
184 .rreg = xreg_right, .shift = xshift, \
185 .min = xmin, .max = xmax} }
186
187
173/* 188/*
174 * Simplified versions of above macros, declaring a struct and calculating 189 * Simplified versions of above macros, declaring a struct and calculating
175 * ARRAY_SIZE internally 190 * ARRAY_SIZE internally
@@ -329,6 +344,12 @@ int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
329 struct snd_ctl_elem_value *ucontrol); 344 struct snd_ctl_elem_value *ucontrol);
330int snd_soc_limit_volume(struct snd_soc_codec *codec, 345int snd_soc_limit_volume(struct snd_soc_codec *codec,
331 const char *name, int max); 346 const char *name, int max);
347int snd_soc_info_volsw_2r_sx(struct snd_kcontrol *kcontrol,
348 struct snd_ctl_elem_info *uinfo);
349int snd_soc_get_volsw_2r_sx(struct snd_kcontrol *kcontrol,
350 struct snd_ctl_elem_value *ucontrol);
351int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol,
352 struct snd_ctl_elem_value *ucontrol);
332 353
333/** 354/**
334 * struct snd_soc_jack_pin - Describes a pin to update based on jack detection 355 * struct snd_soc_jack_pin - Describes a pin to update based on jack detection
diff --git a/include/sound/tlv320dac33-plat.h b/include/sound/tlv320dac33-plat.h
index 3f428d53195b..6c6649656798 100644
--- a/include/sound/tlv320dac33-plat.h
+++ b/include/sound/tlv320dac33-plat.h
@@ -15,6 +15,8 @@
15 15
16struct tlv320dac33_platform_data { 16struct tlv320dac33_platform_data {
17 int power_gpio; 17 int power_gpio;
18 int mode1_latency; /* latency caused by the i2c writes in us */
19 int auto_fifo_config; /* FIFO config based on the period size */
18 int keep_bclk; /* Keep the BCLK running in FIFO modes */ 20 int keep_bclk; /* Keep the BCLK running in FIFO modes */
19 u8 burst_bclkdiv; 21 u8 burst_bclkdiv;
20}; 22};
diff --git a/include/sound/uda134x.h b/include/sound/uda134x.h
index 509efb050176..e475659bd3be 100644
--- a/include/sound/uda134x.h
+++ b/include/sound/uda134x.h
@@ -18,6 +18,18 @@ struct uda134x_platform_data {
18 struct l3_pins l3; 18 struct l3_pins l3;
19 void (*power) (int); 19 void (*power) (int);
20 int model; 20 int model;
21 /*
22 ALSA SOC usually puts the device in standby mode when it's not used
23 for sometime. If you unset is_powered_on_standby the driver will
24 turn off the ADC/DAC when this callback is invoked and turn it back
25 on when needed. Unfortunately this will result in a very light bump
26 (it can be audible only with good earphones). If this bothers you
27 set is_powered_on_standby, you will have slightly higher power
28 consumption. Please note that sending the L3 command for ADC is
29 enough to make the bump, so it doesn't make difference if you
30 completely take off power from the codec.
31 */
32 int is_powered_on_standby;
21#define UDA134X_UDA1340 1 33#define UDA134X_UDA1340 1
22#define UDA134X_UDA1341 2 34#define UDA134X_UDA1341 2
23#define UDA134X_UDA1344 3 35#define UDA134X_UDA1344 3
diff --git a/include/trace/boot.h b/include/trace/boot.h
deleted file mode 100644
index 088ea089e31d..000000000000
--- a/include/trace/boot.h
+++ /dev/null
@@ -1,60 +0,0 @@
1#ifndef _LINUX_TRACE_BOOT_H
2#define _LINUX_TRACE_BOOT_H
3
4#include <linux/module.h>
5#include <linux/kallsyms.h>
6#include <linux/init.h>
7
8/*
9 * Structure which defines the trace of an initcall
10 * while it is called.
11 * You don't have to fill the func field since it is
12 * only used internally by the tracer.
13 */
14struct boot_trace_call {
15 pid_t caller;
16 char func[KSYM_SYMBOL_LEN];
17};
18
19/*
20 * Structure which defines the trace of an initcall
21 * while it returns.
22 */
23struct boot_trace_ret {
24 char func[KSYM_SYMBOL_LEN];
25 int result;
26 unsigned long long duration; /* nsecs */
27};
28
29#ifdef CONFIG_BOOT_TRACER
30/* Append the traces on the ring-buffer */
31extern void trace_boot_call(struct boot_trace_call *bt, initcall_t fn);
32extern void trace_boot_ret(struct boot_trace_ret *bt, initcall_t fn);
33
34/* Tells the tracer that smp_pre_initcall is finished.
35 * So we can start the tracing
36 */
37extern void start_boot_trace(void);
38
39/* Resume the tracing of other necessary events
40 * such as sched switches
41 */
42extern void enable_boot_trace(void);
43
44/* Suspend this tracing. Actually, only sched_switches tracing have
45 * to be suspended. Initcalls doesn't need it.)
46 */
47extern void disable_boot_trace(void);
48#else
49static inline
50void trace_boot_call(struct boot_trace_call *bt, initcall_t fn) { }
51
52static inline
53void trace_boot_ret(struct boot_trace_ret *bt, initcall_t fn) { }
54
55static inline void start_boot_trace(void) { }
56static inline void enable_boot_trace(void) { }
57static inline void disable_boot_trace(void) { }
58#endif /* CONFIG_BOOT_TRACER */
59
60#endif /* __LINUX_TRACE_BOOT_H */
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index d870a918559c..d8ce278515c3 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -25,8 +25,10 @@ DECLARE_EVENT_CLASS(block_rq_with_error,
25 25
26 TP_fast_assign( 26 TP_fast_assign(
27 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; 27 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
28 __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq); 28 __entry->sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
29 __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq); 29 0 : blk_rq_pos(rq);
30 __entry->nr_sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
31 0 : blk_rq_sectors(rq);
30 __entry->errors = rq->errors; 32 __entry->errors = rq->errors;
31 33
32 blk_fill_rwbs_rq(__entry->rwbs, rq); 34 blk_fill_rwbs_rq(__entry->rwbs, rq);
@@ -109,9 +111,12 @@ DECLARE_EVENT_CLASS(block_rq,
109 111
110 TP_fast_assign( 112 TP_fast_assign(
111 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; 113 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
112 __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq); 114 __entry->sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
113 __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq); 115 0 : blk_rq_pos(rq);
114 __entry->bytes = blk_pc_request(rq) ? blk_rq_bytes(rq) : 0; 116 __entry->nr_sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
117 0 : blk_rq_sectors(rq);
118 __entry->bytes = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
119 blk_rq_bytes(rq) : 0;
115 120
116 blk_fill_rwbs_rq(__entry->rwbs, rq); 121 blk_fill_rwbs_rq(__entry->rwbs, rq);
117 blk_dump_cmd(__get_str(cmd), rq); 122 blk_dump_cmd(__get_str(cmd), rq);
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index f3865c7b4166..01e9e0076a92 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -395,11 +395,12 @@ DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_group_pa,
395); 395);
396 396
397TRACE_EVENT(ext4_mb_release_inode_pa, 397TRACE_EVENT(ext4_mb_release_inode_pa,
398 TP_PROTO(struct ext4_allocation_context *ac, 398 TP_PROTO(struct super_block *sb,
399 struct ext4_allocation_context *ac,
399 struct ext4_prealloc_space *pa, 400 struct ext4_prealloc_space *pa,
400 unsigned long long block, unsigned int count), 401 unsigned long long block, unsigned int count),
401 402
402 TP_ARGS(ac, pa, block, count), 403 TP_ARGS(sb, ac, pa, block, count),
403 404
404 TP_STRUCT__entry( 405 TP_STRUCT__entry(
405 __field( dev_t, dev ) 406 __field( dev_t, dev )
@@ -410,8 +411,9 @@ TRACE_EVENT(ext4_mb_release_inode_pa,
410 ), 411 ),
411 412
412 TP_fast_assign( 413 TP_fast_assign(
413 __entry->dev = ac->ac_sb->s_dev; 414 __entry->dev = sb->s_dev;
414 __entry->ino = ac->ac_inode->i_ino; 415 __entry->ino = (ac && ac->ac_inode) ?
416 ac->ac_inode->i_ino : 0;
415 __entry->block = block; 417 __entry->block = block;
416 __entry->count = count; 418 __entry->count = count;
417 ), 419 ),
@@ -422,10 +424,11 @@ TRACE_EVENT(ext4_mb_release_inode_pa,
422); 424);
423 425
424TRACE_EVENT(ext4_mb_release_group_pa, 426TRACE_EVENT(ext4_mb_release_group_pa,
425 TP_PROTO(struct ext4_allocation_context *ac, 427 TP_PROTO(struct super_block *sb,
428 struct ext4_allocation_context *ac,
426 struct ext4_prealloc_space *pa), 429 struct ext4_prealloc_space *pa),
427 430
428 TP_ARGS(ac, pa), 431 TP_ARGS(sb, ac, pa),
429 432
430 TP_STRUCT__entry( 433 TP_STRUCT__entry(
431 __field( dev_t, dev ) 434 __field( dev_t, dev )
@@ -436,8 +439,9 @@ TRACE_EVENT(ext4_mb_release_group_pa,
436 ), 439 ),
437 440
438 TP_fast_assign( 441 TP_fast_assign(
439 __entry->dev = ac->ac_sb->s_dev; 442 __entry->dev = sb->s_dev;
440 __entry->ino = ac->ac_inode->i_ino; 443 __entry->ino = (ac && ac->ac_inode) ?
444 ac->ac_inode->i_ino : 0;
441 __entry->pa_pstart = pa->pa_pstart; 445 __entry->pa_pstart = pa->pa_pstart;
442 __entry->pa_len = pa->pa_len; 446 __entry->pa_len = pa->pa_len;
443 ), 447 ),
diff --git a/include/trace/events/gfpflags.h b/include/trace/events/gfpflags.h
new file mode 100644
index 000000000000..e3615c093741
--- /dev/null
+++ b/include/trace/events/gfpflags.h
@@ -0,0 +1,37 @@
1/*
2 * The order of these masks is important. Matching masks will be seen
3 * first and the left over flags will end up showing by themselves.
4 *
5 * For example, if we have GFP_KERNEL before GFP_USER we wil get:
6 *
7 * GFP_KERNEL|GFP_HARDWALL
8 *
9 * Thus most bits set go first.
10 */
11#define show_gfp_flags(flags) \
12 (flags) ? __print_flags(flags, "|", \
13 {(unsigned long)GFP_HIGHUSER_MOVABLE, "GFP_HIGHUSER_MOVABLE"}, \
14 {(unsigned long)GFP_HIGHUSER, "GFP_HIGHUSER"}, \
15 {(unsigned long)GFP_USER, "GFP_USER"}, \
16 {(unsigned long)GFP_TEMPORARY, "GFP_TEMPORARY"}, \
17 {(unsigned long)GFP_KERNEL, "GFP_KERNEL"}, \
18 {(unsigned long)GFP_NOFS, "GFP_NOFS"}, \
19 {(unsigned long)GFP_ATOMIC, "GFP_ATOMIC"}, \
20 {(unsigned long)GFP_NOIO, "GFP_NOIO"}, \
21 {(unsigned long)__GFP_HIGH, "GFP_HIGH"}, \
22 {(unsigned long)__GFP_WAIT, "GFP_WAIT"}, \
23 {(unsigned long)__GFP_IO, "GFP_IO"}, \
24 {(unsigned long)__GFP_COLD, "GFP_COLD"}, \
25 {(unsigned long)__GFP_NOWARN, "GFP_NOWARN"}, \
26 {(unsigned long)__GFP_REPEAT, "GFP_REPEAT"}, \
27 {(unsigned long)__GFP_NOFAIL, "GFP_NOFAIL"}, \
28 {(unsigned long)__GFP_NORETRY, "GFP_NORETRY"}, \
29 {(unsigned long)__GFP_COMP, "GFP_COMP"}, \
30 {(unsigned long)__GFP_ZERO, "GFP_ZERO"}, \
31 {(unsigned long)__GFP_NOMEMALLOC, "GFP_NOMEMALLOC"}, \
32 {(unsigned long)__GFP_HARDWALL, "GFP_HARDWALL"}, \
33 {(unsigned long)__GFP_THISNODE, "GFP_THISNODE"}, \
34 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \
35 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"} \
36 ) : "GFP_NOWAIT"
37
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index 3adca0ca9dbe..a9c87ad8331c 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -6,43 +6,7 @@
6 6
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
9 9#include "gfpflags.h"
10/*
11 * The order of these masks is important. Matching masks will be seen
12 * first and the left over flags will end up showing by themselves.
13 *
14 * For example, if we have GFP_KERNEL before GFP_USER we wil get:
15 *
16 * GFP_KERNEL|GFP_HARDWALL
17 *
18 * Thus most bits set go first.
19 */
20#define show_gfp_flags(flags) \
21 (flags) ? __print_flags(flags, "|", \
22 {(unsigned long)GFP_HIGHUSER_MOVABLE, "GFP_HIGHUSER_MOVABLE"}, \
23 {(unsigned long)GFP_HIGHUSER, "GFP_HIGHUSER"}, \
24 {(unsigned long)GFP_USER, "GFP_USER"}, \
25 {(unsigned long)GFP_TEMPORARY, "GFP_TEMPORARY"}, \
26 {(unsigned long)GFP_KERNEL, "GFP_KERNEL"}, \
27 {(unsigned long)GFP_NOFS, "GFP_NOFS"}, \
28 {(unsigned long)GFP_ATOMIC, "GFP_ATOMIC"}, \
29 {(unsigned long)GFP_NOIO, "GFP_NOIO"}, \
30 {(unsigned long)__GFP_HIGH, "GFP_HIGH"}, \
31 {(unsigned long)__GFP_WAIT, "GFP_WAIT"}, \
32 {(unsigned long)__GFP_IO, "GFP_IO"}, \
33 {(unsigned long)__GFP_COLD, "GFP_COLD"}, \
34 {(unsigned long)__GFP_NOWARN, "GFP_NOWARN"}, \
35 {(unsigned long)__GFP_REPEAT, "GFP_REPEAT"}, \
36 {(unsigned long)__GFP_NOFAIL, "GFP_NOFAIL"}, \
37 {(unsigned long)__GFP_NORETRY, "GFP_NORETRY"}, \
38 {(unsigned long)__GFP_COMP, "GFP_COMP"}, \
39 {(unsigned long)__GFP_ZERO, "GFP_ZERO"}, \
40 {(unsigned long)__GFP_NOMEMALLOC, "GFP_NOMEMALLOC"}, \
41 {(unsigned long)__GFP_HARDWALL, "GFP_HARDWALL"}, \
42 {(unsigned long)__GFP_THISNODE, "GFP_THISNODE"}, \
43 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \
44 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"} \
45 ) : "GFP_NOWAIT"
46 10
47DECLARE_EVENT_CLASS(kmem_alloc, 11DECLARE_EVENT_CLASS(kmem_alloc,
48 12
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index c4efe9b8280d..35a2a6e7bf1e 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -18,52 +18,55 @@ enum {
18 18
19DECLARE_EVENT_CLASS(power, 19DECLARE_EVENT_CLASS(power,
20 20
21 TP_PROTO(unsigned int type, unsigned int state), 21 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
22 22
23 TP_ARGS(type, state), 23 TP_ARGS(type, state, cpu_id),
24 24
25 TP_STRUCT__entry( 25 TP_STRUCT__entry(
26 __field( u64, type ) 26 __field( u64, type )
27 __field( u64, state ) 27 __field( u64, state )
28 __field( u64, cpu_id )
28 ), 29 ),
29 30
30 TP_fast_assign( 31 TP_fast_assign(
31 __entry->type = type; 32 __entry->type = type;
32 __entry->state = state; 33 __entry->state = state;
34 __entry->cpu_id = cpu_id;
33 ), 35 ),
34 36
35 TP_printk("type=%lu state=%lu", (unsigned long)__entry->type, (unsigned long)__entry->state) 37 TP_printk("type=%lu state=%lu cpu_id=%lu", (unsigned long)__entry->type,
38 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
36); 39);
37 40
38DEFINE_EVENT(power, power_start, 41DEFINE_EVENT(power, power_start,
39 42
40 TP_PROTO(unsigned int type, unsigned int state), 43 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
41 44
42 TP_ARGS(type, state) 45 TP_ARGS(type, state, cpu_id)
43); 46);
44 47
45DEFINE_EVENT(power, power_frequency, 48DEFINE_EVENT(power, power_frequency,
46 49
47 TP_PROTO(unsigned int type, unsigned int state), 50 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
48 51
49 TP_ARGS(type, state) 52 TP_ARGS(type, state, cpu_id)
50); 53);
51 54
52TRACE_EVENT(power_end, 55TRACE_EVENT(power_end,
53 56
54 TP_PROTO(int dummy), 57 TP_PROTO(unsigned int cpu_id),
55 58
56 TP_ARGS(dummy), 59 TP_ARGS(cpu_id),
57 60
58 TP_STRUCT__entry( 61 TP_STRUCT__entry(
59 __field( u64, dummy ) 62 __field( u64, cpu_id )
60 ), 63 ),
61 64
62 TP_fast_assign( 65 TP_fast_assign(
63 __entry->dummy = 0xffff; 66 __entry->cpu_id = cpu_id;
64 ), 67 ),
65 68
66 TP_printk("dummy=%lu", (unsigned long)__entry->dummy) 69 TP_printk("cpu_id=%lu", (unsigned long)__entry->cpu_id)
67 70
68); 71);
69 72
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index b9e1dd6c6208..9208c92aeab5 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -50,31 +50,6 @@ TRACE_EVENT(sched_kthread_stop_ret,
50); 50);
51 51
52/* 52/*
53 * Tracepoint for waiting on task to unschedule:
54 */
55TRACE_EVENT(sched_wait_task,
56
57 TP_PROTO(struct task_struct *p),
58
59 TP_ARGS(p),
60
61 TP_STRUCT__entry(
62 __array( char, comm, TASK_COMM_LEN )
63 __field( pid_t, pid )
64 __field( int, prio )
65 ),
66
67 TP_fast_assign(
68 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
69 __entry->pid = p->pid;
70 __entry->prio = p->prio;
71 ),
72
73 TP_printk("comm=%s pid=%d prio=%d",
74 __entry->comm, __entry->pid, __entry->prio)
75);
76
77/*
78 * Tracepoint for waking up a task: 53 * Tracepoint for waking up a task:
79 */ 54 */
80DECLARE_EVENT_CLASS(sched_wakeup_template, 55DECLARE_EVENT_CLASS(sched_wakeup_template,
@@ -240,6 +215,13 @@ DEFINE_EVENT(sched_process_template, sched_process_exit,
240 TP_ARGS(p)); 215 TP_ARGS(p));
241 216
242/* 217/*
218 * Tracepoint for waiting on task to unschedule:
219 */
220DEFINE_EVENT(sched_process_template, sched_wait_task,
221 TP_PROTO(struct task_struct *p),
222 TP_ARGS(p));
223
224/*
243 * Tracepoint for a waiting task: 225 * Tracepoint for a waiting task:
244 */ 226 */
245TRACE_EVENT(sched_process_wait, 227TRACE_EVENT(sched_process_wait,
diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h
index 9496b965d62a..c624126a9c8a 100644
--- a/include/trace/events/timer.h
+++ b/include/trace/events/timer.h
@@ -8,11 +8,7 @@
8#include <linux/hrtimer.h> 8#include <linux/hrtimer.h>
9#include <linux/timer.h> 9#include <linux/timer.h>
10 10
11/** 11DECLARE_EVENT_CLASS(timer_class,
12 * timer_init - called when the timer is initialized
13 * @timer: pointer to struct timer_list
14 */
15TRACE_EVENT(timer_init,
16 12
17 TP_PROTO(struct timer_list *timer), 13 TP_PROTO(struct timer_list *timer),
18 14
@@ -30,6 +26,17 @@ TRACE_EVENT(timer_init,
30); 26);
31 27
32/** 28/**
29 * timer_init - called when the timer is initialized
30 * @timer: pointer to struct timer_list
31 */
32DEFINE_EVENT(timer_class, timer_init,
33
34 TP_PROTO(struct timer_list *timer),
35
36 TP_ARGS(timer)
37);
38
39/**
33 * timer_start - called when the timer is started 40 * timer_start - called when the timer is started
34 * @timer: pointer to struct timer_list 41 * @timer: pointer to struct timer_list
35 * @expires: the timers expiry time 42 * @expires: the timers expiry time
@@ -94,42 +101,22 @@ TRACE_EVENT(timer_expire_entry,
94 * NOTE: Do NOT derefernce timer in TP_fast_assign. The pointer might 101 * NOTE: Do NOT derefernce timer in TP_fast_assign. The pointer might
95 * be invalid. We solely track the pointer. 102 * be invalid. We solely track the pointer.
96 */ 103 */
97TRACE_EVENT(timer_expire_exit, 104DEFINE_EVENT(timer_class, timer_expire_exit,
98 105
99 TP_PROTO(struct timer_list *timer), 106 TP_PROTO(struct timer_list *timer),
100 107
101 TP_ARGS(timer), 108 TP_ARGS(timer)
102
103 TP_STRUCT__entry(
104 __field(void *, timer )
105 ),
106
107 TP_fast_assign(
108 __entry->timer = timer;
109 ),
110
111 TP_printk("timer=%p", __entry->timer)
112); 109);
113 110
114/** 111/**
115 * timer_cancel - called when the timer is canceled 112 * timer_cancel - called when the timer is canceled
116 * @timer: pointer to struct timer_list 113 * @timer: pointer to struct timer_list
117 */ 114 */
118TRACE_EVENT(timer_cancel, 115DEFINE_EVENT(timer_class, timer_cancel,
119 116
120 TP_PROTO(struct timer_list *timer), 117 TP_PROTO(struct timer_list *timer),
121 118
122 TP_ARGS(timer), 119 TP_ARGS(timer)
123
124 TP_STRUCT__entry(
125 __field( void *, timer )
126 ),
127
128 TP_fast_assign(
129 __entry->timer = timer;
130 ),
131
132 TP_printk("timer=%p", __entry->timer)
133); 120);
134 121
135/** 122/**
@@ -224,14 +211,7 @@ TRACE_EVENT(hrtimer_expire_entry,
224 (unsigned long long)ktime_to_ns((ktime_t) { .tv64 = __entry->now })) 211 (unsigned long long)ktime_to_ns((ktime_t) { .tv64 = __entry->now }))
225 ); 212 );
226 213
227/** 214DECLARE_EVENT_CLASS(hrtimer_class,
228 * hrtimer_expire_exit - called immediately after the hrtimer callback returns
229 * @timer: pointer to struct hrtimer
230 *
231 * When used in combination with the hrtimer_expire_entry tracepoint we can
232 * determine the runtime of the callback function.
233 */
234TRACE_EVENT(hrtimer_expire_exit,
235 215
236 TP_PROTO(struct hrtimer *hrtimer), 216 TP_PROTO(struct hrtimer *hrtimer),
237 217
@@ -249,24 +229,28 @@ TRACE_EVENT(hrtimer_expire_exit,
249); 229);
250 230
251/** 231/**
252 * hrtimer_cancel - called when the hrtimer is canceled 232 * hrtimer_expire_exit - called immediately after the hrtimer callback returns
253 * @hrtimer: pointer to struct hrtimer 233 * @timer: pointer to struct hrtimer
234 *
235 * When used in combination with the hrtimer_expire_entry tracepoint we can
236 * determine the runtime of the callback function.
254 */ 237 */
255TRACE_EVENT(hrtimer_cancel, 238DEFINE_EVENT(hrtimer_class, hrtimer_expire_exit,
256 239
257 TP_PROTO(struct hrtimer *hrtimer), 240 TP_PROTO(struct hrtimer *hrtimer),
258 241
259 TP_ARGS(hrtimer), 242 TP_ARGS(hrtimer)
243);
260 244
261 TP_STRUCT__entry( 245/**
262 __field( void *, hrtimer ) 246 * hrtimer_cancel - called when the hrtimer is canceled
263 ), 247 * @hrtimer: pointer to struct hrtimer
248 */
249DEFINE_EVENT(hrtimer_class, hrtimer_cancel,
264 250
265 TP_fast_assign( 251 TP_PROTO(struct hrtimer *hrtimer),
266 __entry->hrtimer = hrtimer;
267 ),
268 252
269 TP_printk("hrtimer=%p", __entry->hrtimer) 253 TP_ARGS(hrtimer)
270); 254);
271 255
272/** 256/**
diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h
new file mode 100644
index 000000000000..370aa5a87322
--- /dev/null
+++ b/include/trace/events/vmscan.h
@@ -0,0 +1,275 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM vmscan
3
4#if !defined(_TRACE_VMSCAN_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_VMSCAN_H
6
7#include <linux/types.h>
8#include <linux/tracepoint.h>
9#include "gfpflags.h"
10
11#define RECLAIM_WB_ANON 0x0001u
12#define RECLAIM_WB_FILE 0x0002u
13#define RECLAIM_WB_SYNC 0x0004u
14#define RECLAIM_WB_ASYNC 0x0008u
15
16#define show_reclaim_flags(flags) \
17 (flags) ? __print_flags(flags, "|", \
18 {RECLAIM_WB_ANON, "RECLAIM_WB_ANON"}, \
19 {RECLAIM_WB_FILE, "RECLAIM_WB_FILE"}, \
20 {RECLAIM_WB_SYNC, "RECLAIM_WB_SYNC"}, \
21 {RECLAIM_WB_ASYNC, "RECLAIM_WB_ASYNC"} \
22 ) : "RECLAIM_WB_NONE"
23
24#define trace_reclaim_flags(page, sync) ( \
25 (page_is_file_cache(page) ? RECLAIM_WB_FILE : RECLAIM_WB_ANON) | \
26 (sync == PAGEOUT_IO_SYNC ? RECLAIM_WB_SYNC : RECLAIM_WB_ASYNC) \
27 )
28
29TRACE_EVENT(mm_vmscan_kswapd_sleep,
30
31 TP_PROTO(int nid),
32
33 TP_ARGS(nid),
34
35 TP_STRUCT__entry(
36 __field( int, nid )
37 ),
38
39 TP_fast_assign(
40 __entry->nid = nid;
41 ),
42
43 TP_printk("nid=%d", __entry->nid)
44);
45
46TRACE_EVENT(mm_vmscan_kswapd_wake,
47
48 TP_PROTO(int nid, int order),
49
50 TP_ARGS(nid, order),
51
52 TP_STRUCT__entry(
53 __field( int, nid )
54 __field( int, order )
55 ),
56
57 TP_fast_assign(
58 __entry->nid = nid;
59 __entry->order = order;
60 ),
61
62 TP_printk("nid=%d order=%d", __entry->nid, __entry->order)
63);
64
65TRACE_EVENT(mm_vmscan_wakeup_kswapd,
66
67 TP_PROTO(int nid, int zid, int order),
68
69 TP_ARGS(nid, zid, order),
70
71 TP_STRUCT__entry(
72 __field( int, nid )
73 __field( int, zid )
74 __field( int, order )
75 ),
76
77 TP_fast_assign(
78 __entry->nid = nid;
79 __entry->zid = zid;
80 __entry->order = order;
81 ),
82
83 TP_printk("nid=%d zid=%d order=%d",
84 __entry->nid,
85 __entry->zid,
86 __entry->order)
87);
88
89DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template,
90
91 TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
92
93 TP_ARGS(order, may_writepage, gfp_flags),
94
95 TP_STRUCT__entry(
96 __field( int, order )
97 __field( int, may_writepage )
98 __field( gfp_t, gfp_flags )
99 ),
100
101 TP_fast_assign(
102 __entry->order = order;
103 __entry->may_writepage = may_writepage;
104 __entry->gfp_flags = gfp_flags;
105 ),
106
107 TP_printk("order=%d may_writepage=%d gfp_flags=%s",
108 __entry->order,
109 __entry->may_writepage,
110 show_gfp_flags(__entry->gfp_flags))
111);
112
113DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_reclaim_begin,
114
115 TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
116
117 TP_ARGS(order, may_writepage, gfp_flags)
118);
119
120DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_reclaim_begin,
121
122 TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
123
124 TP_ARGS(order, may_writepage, gfp_flags)
125);
126
127DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_softlimit_reclaim_begin,
128
129 TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
130
131 TP_ARGS(order, may_writepage, gfp_flags)
132);
133
134DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template,
135
136 TP_PROTO(unsigned long nr_reclaimed),
137
138 TP_ARGS(nr_reclaimed),
139
140 TP_STRUCT__entry(
141 __field( unsigned long, nr_reclaimed )
142 ),
143
144 TP_fast_assign(
145 __entry->nr_reclaimed = nr_reclaimed;
146 ),
147
148 TP_printk("nr_reclaimed=%lu", __entry->nr_reclaimed)
149);
150
151DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_direct_reclaim_end,
152
153 TP_PROTO(unsigned long nr_reclaimed),
154
155 TP_ARGS(nr_reclaimed)
156);
157
158DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_reclaim_end,
159
160 TP_PROTO(unsigned long nr_reclaimed),
161
162 TP_ARGS(nr_reclaimed)
163);
164
165DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_softlimit_reclaim_end,
166
167 TP_PROTO(unsigned long nr_reclaimed),
168
169 TP_ARGS(nr_reclaimed)
170);
171
172
173DECLARE_EVENT_CLASS(mm_vmscan_lru_isolate_template,
174
175 TP_PROTO(int order,
176 unsigned long nr_requested,
177 unsigned long nr_scanned,
178 unsigned long nr_taken,
179 unsigned long nr_lumpy_taken,
180 unsigned long nr_lumpy_dirty,
181 unsigned long nr_lumpy_failed,
182 int isolate_mode),
183
184 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode),
185
186 TP_STRUCT__entry(
187 __field(int, order)
188 __field(unsigned long, nr_requested)
189 __field(unsigned long, nr_scanned)
190 __field(unsigned long, nr_taken)
191 __field(unsigned long, nr_lumpy_taken)
192 __field(unsigned long, nr_lumpy_dirty)
193 __field(unsigned long, nr_lumpy_failed)
194 __field(int, isolate_mode)
195 ),
196
197 TP_fast_assign(
198 __entry->order = order;
199 __entry->nr_requested = nr_requested;
200 __entry->nr_scanned = nr_scanned;
201 __entry->nr_taken = nr_taken;
202 __entry->nr_lumpy_taken = nr_lumpy_taken;
203 __entry->nr_lumpy_dirty = nr_lumpy_dirty;
204 __entry->nr_lumpy_failed = nr_lumpy_failed;
205 __entry->isolate_mode = isolate_mode;
206 ),
207
208 TP_printk("isolate_mode=%d order=%d nr_requested=%lu nr_scanned=%lu nr_taken=%lu contig_taken=%lu contig_dirty=%lu contig_failed=%lu",
209 __entry->isolate_mode,
210 __entry->order,
211 __entry->nr_requested,
212 __entry->nr_scanned,
213 __entry->nr_taken,
214 __entry->nr_lumpy_taken,
215 __entry->nr_lumpy_dirty,
216 __entry->nr_lumpy_failed)
217);
218
219DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_lru_isolate,
220
221 TP_PROTO(int order,
222 unsigned long nr_requested,
223 unsigned long nr_scanned,
224 unsigned long nr_taken,
225 unsigned long nr_lumpy_taken,
226 unsigned long nr_lumpy_dirty,
227 unsigned long nr_lumpy_failed,
228 int isolate_mode),
229
230 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode)
231
232);
233
234DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_memcg_isolate,
235
236 TP_PROTO(int order,
237 unsigned long nr_requested,
238 unsigned long nr_scanned,
239 unsigned long nr_taken,
240 unsigned long nr_lumpy_taken,
241 unsigned long nr_lumpy_dirty,
242 unsigned long nr_lumpy_failed,
243 int isolate_mode),
244
245 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode)
246
247);
248
249TRACE_EVENT(mm_vmscan_writepage,
250
251 TP_PROTO(struct page *page,
252 int reclaim_flags),
253
254 TP_ARGS(page, reclaim_flags),
255
256 TP_STRUCT__entry(
257 __field(struct page *, page)
258 __field(int, reclaim_flags)
259 ),
260
261 TP_fast_assign(
262 __entry->page = page;
263 __entry->reclaim_flags = reclaim_flags;
264 ),
265
266 TP_printk("page=%p pfn=%lu flags=%s",
267 __entry->page,
268 page_to_pfn(__entry->page),
269 show_reclaim_flags(__entry->reclaim_flags))
270);
271
272#endif /* _TRACE_VMSCAN_H */
273
274/* This part must be outside protection */
275#include <trace/define_trace.h>
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h
deleted file mode 100644
index d6c974474e70..000000000000
--- a/include/trace/events/workqueue.h
+++ /dev/null
@@ -1,92 +0,0 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM workqueue
3
4#if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_WORKQUEUE_H
6
7#include <linux/workqueue.h>
8#include <linux/sched.h>
9#include <linux/tracepoint.h>
10
11DECLARE_EVENT_CLASS(workqueue,
12
13 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
14
15 TP_ARGS(wq_thread, work),
16
17 TP_STRUCT__entry(
18 __array(char, thread_comm, TASK_COMM_LEN)
19 __field(pid_t, thread_pid)
20 __field(work_func_t, func)
21 ),
22
23 TP_fast_assign(
24 memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN);
25 __entry->thread_pid = wq_thread->pid;
26 __entry->func = work->func;
27 ),
28
29 TP_printk("thread=%s:%d func=%pf", __entry->thread_comm,
30 __entry->thread_pid, __entry->func)
31);
32
33DEFINE_EVENT(workqueue, workqueue_insertion,
34
35 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
36
37 TP_ARGS(wq_thread, work)
38);
39
40DEFINE_EVENT(workqueue, workqueue_execution,
41
42 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
43
44 TP_ARGS(wq_thread, work)
45);
46
47/* Trace the creation of one workqueue thread on a cpu */
48TRACE_EVENT(workqueue_creation,
49
50 TP_PROTO(struct task_struct *wq_thread, int cpu),
51
52 TP_ARGS(wq_thread, cpu),
53
54 TP_STRUCT__entry(
55 __array(char, thread_comm, TASK_COMM_LEN)
56 __field(pid_t, thread_pid)
57 __field(int, cpu)
58 ),
59
60 TP_fast_assign(
61 memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN);
62 __entry->thread_pid = wq_thread->pid;
63 __entry->cpu = cpu;
64 ),
65
66 TP_printk("thread=%s:%d cpu=%d", __entry->thread_comm,
67 __entry->thread_pid, __entry->cpu)
68);
69
70TRACE_EVENT(workqueue_destruction,
71
72 TP_PROTO(struct task_struct *wq_thread),
73
74 TP_ARGS(wq_thread),
75
76 TP_STRUCT__entry(
77 __array(char, thread_comm, TASK_COMM_LEN)
78 __field(pid_t, thread_pid)
79 ),
80
81 TP_fast_assign(
82 memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN);
83 __entry->thread_pid = wq_thread->pid;
84 ),
85
86 TP_printk("thread=%s:%d", __entry->thread_comm, __entry->thread_pid)
87);
88
89#endif /* _TRACE_WORKQUEUE_H */
90
91/* This part must be outside protection */
92#include <trace/define_trace.h>
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
new file mode 100644
index 000000000000..f345f66ae9d1
--- /dev/null
+++ b/include/trace/events/writeback.h
@@ -0,0 +1,159 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM writeback
3
4#if !defined(_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_WRITEBACK_H
6
7#include <linux/backing-dev.h>
8#include <linux/device.h>
9#include <linux/writeback.h>
10
11struct wb_writeback_work;
12
13DECLARE_EVENT_CLASS(writeback_work_class,
14 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
15 TP_ARGS(bdi, work),
16 TP_STRUCT__entry(
17 __array(char, name, 32)
18 __field(long, nr_pages)
19 __field(dev_t, sb_dev)
20 __field(int, sync_mode)
21 __field(int, for_kupdate)
22 __field(int, range_cyclic)
23 __field(int, for_background)
24 ),
25 TP_fast_assign(
26 strncpy(__entry->name, dev_name(bdi->dev), 32);
27 __entry->nr_pages = work->nr_pages;
28 __entry->sb_dev = work->sb ? work->sb->s_dev : 0;
29 __entry->sync_mode = work->sync_mode;
30 __entry->for_kupdate = work->for_kupdate;
31 __entry->range_cyclic = work->range_cyclic;
32 __entry->for_background = work->for_background;
33 ),
34 TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d "
35 "kupdate=%d range_cyclic=%d background=%d",
36 __entry->name,
37 MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev),
38 __entry->nr_pages,
39 __entry->sync_mode,
40 __entry->for_kupdate,
41 __entry->range_cyclic,
42 __entry->for_background
43 )
44);
45#define DEFINE_WRITEBACK_WORK_EVENT(name) \
46DEFINE_EVENT(writeback_work_class, name, \
47 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \
48 TP_ARGS(bdi, work))
49DEFINE_WRITEBACK_WORK_EVENT(writeback_nothread);
50DEFINE_WRITEBACK_WORK_EVENT(writeback_queue);
51DEFINE_WRITEBACK_WORK_EVENT(writeback_exec);
52
53TRACE_EVENT(writeback_pages_written,
54 TP_PROTO(long pages_written),
55 TP_ARGS(pages_written),
56 TP_STRUCT__entry(
57 __field(long, pages)
58 ),
59 TP_fast_assign(
60 __entry->pages = pages_written;
61 ),
62 TP_printk("%ld", __entry->pages)
63);
64
65DECLARE_EVENT_CLASS(writeback_class,
66 TP_PROTO(struct backing_dev_info *bdi),
67 TP_ARGS(bdi),
68 TP_STRUCT__entry(
69 __array(char, name, 32)
70 ),
71 TP_fast_assign(
72 strncpy(__entry->name, dev_name(bdi->dev), 32);
73 ),
74 TP_printk("bdi %s",
75 __entry->name
76 )
77);
78#define DEFINE_WRITEBACK_EVENT(name) \
79DEFINE_EVENT(writeback_class, name, \
80 TP_PROTO(struct backing_dev_info *bdi), \
81 TP_ARGS(bdi))
82
83DEFINE_WRITEBACK_EVENT(writeback_nowork);
84DEFINE_WRITEBACK_EVENT(writeback_wake_thread);
85DEFINE_WRITEBACK_EVENT(writeback_wake_forker_thread);
86DEFINE_WRITEBACK_EVENT(writeback_bdi_register);
87DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister);
88DEFINE_WRITEBACK_EVENT(writeback_thread_start);
89DEFINE_WRITEBACK_EVENT(writeback_thread_stop);
90
91DECLARE_EVENT_CLASS(wbc_class,
92 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi),
93 TP_ARGS(wbc, bdi),
94 TP_STRUCT__entry(
95 __array(char, name, 32)
96 __field(long, nr_to_write)
97 __field(long, pages_skipped)
98 __field(int, sync_mode)
99 __field(int, nonblocking)
100 __field(int, encountered_congestion)
101 __field(int, for_kupdate)
102 __field(int, for_background)
103 __field(int, for_reclaim)
104 __field(int, range_cyclic)
105 __field(int, more_io)
106 __field(unsigned long, older_than_this)
107 __field(long, range_start)
108 __field(long, range_end)
109 ),
110
111 TP_fast_assign(
112 strncpy(__entry->name, dev_name(bdi->dev), 32);
113 __entry->nr_to_write = wbc->nr_to_write;
114 __entry->pages_skipped = wbc->pages_skipped;
115 __entry->sync_mode = wbc->sync_mode;
116 __entry->for_kupdate = wbc->for_kupdate;
117 __entry->for_background = wbc->for_background;
118 __entry->for_reclaim = wbc->for_reclaim;
119 __entry->range_cyclic = wbc->range_cyclic;
120 __entry->more_io = wbc->more_io;
121 __entry->older_than_this = wbc->older_than_this ?
122 *wbc->older_than_this : 0;
123 __entry->range_start = (long)wbc->range_start;
124 __entry->range_end = (long)wbc->range_end;
125 ),
126
127 TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d "
128 "bgrd=%d reclm=%d cyclic=%d more=%d older=0x%lx "
129 "start=0x%lx end=0x%lx",
130 __entry->name,
131 __entry->nr_to_write,
132 __entry->pages_skipped,
133 __entry->sync_mode,
134 __entry->for_kupdate,
135 __entry->for_background,
136 __entry->for_reclaim,
137 __entry->range_cyclic,
138 __entry->more_io,
139 __entry->older_than_this,
140 __entry->range_start,
141 __entry->range_end)
142)
143
144#define DEFINE_WBC_EVENT(name) \
145DEFINE_EVENT(wbc_class, name, \
146 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \
147 TP_ARGS(wbc, bdi))
148DEFINE_WBC_EVENT(wbc_writeback_start);
149DEFINE_WBC_EVENT(wbc_writeback_written);
150DEFINE_WBC_EVENT(wbc_writeback_wait);
151DEFINE_WBC_EVENT(wbc_balance_dirty_start);
152DEFINE_WBC_EVENT(wbc_balance_dirty_written);
153DEFINE_WBC_EVENT(wbc_balance_dirty_wait);
154DEFINE_WBC_EVENT(wbc_writepage);
155
156#endif /* _TRACE_WRITEBACK_H */
157
158/* This part must be outside protection */
159#include <trace/define_trace.h>
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 5a64905d7278..a9377c0083ad 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -75,15 +75,12 @@
75#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ 75#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
76 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) 76 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
77 77
78#undef __cpparg
79#define __cpparg(arg...) arg
80
81/* Callbacks are meaningless to ftrace. */ 78/* Callbacks are meaningless to ftrace. */
82#undef TRACE_EVENT_FN 79#undef TRACE_EVENT_FN
83#define TRACE_EVENT_FN(name, proto, args, tstruct, \ 80#define TRACE_EVENT_FN(name, proto, args, tstruct, \
84 assign, print, reg, unreg) \ 81 assign, print, reg, unreg) \
85 TRACE_EVENT(name, __cpparg(proto), __cpparg(args), \ 82 TRACE_EVENT(name, PARAMS(proto), PARAMS(args), \
86 __cpparg(tstruct), __cpparg(assign), __cpparg(print)) \ 83 PARAMS(tstruct), PARAMS(assign), PARAMS(print)) \
87 84
88#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 85#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
89 86
@@ -145,7 +142,7 @@
145 * struct trace_seq *s = &iter->seq; 142 * struct trace_seq *s = &iter->seq;
146 * struct ftrace_raw_<call> *field; <-- defined in stage 1 143 * struct ftrace_raw_<call> *field; <-- defined in stage 1
147 * struct trace_entry *entry; 144 * struct trace_entry *entry;
148 * struct trace_seq *p; 145 * struct trace_seq *p = &iter->tmp_seq;
149 * int ret; 146 * int ret;
150 * 147 *
151 * entry = iter->ent; 148 * entry = iter->ent;
@@ -157,12 +154,10 @@
157 * 154 *
158 * field = (typeof(field))entry; 155 * field = (typeof(field))entry;
159 * 156 *
160 * p = &get_cpu_var(ftrace_event_seq);
161 * trace_seq_init(p); 157 * trace_seq_init(p);
162 * ret = trace_seq_printf(s, "%s: ", <call>); 158 * ret = trace_seq_printf(s, "%s: ", <call>);
163 * if (ret) 159 * if (ret)
164 * ret = trace_seq_printf(s, <TP_printk> "\n"); 160 * ret = trace_seq_printf(s, <TP_printk> "\n");
165 * put_cpu();
166 * if (!ret) 161 * if (!ret)
167 * return TRACE_TYPE_PARTIAL_LINE; 162 * return TRACE_TYPE_PARTIAL_LINE;
168 * 163 *
@@ -216,7 +211,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \
216 struct trace_seq *s = &iter->seq; \ 211 struct trace_seq *s = &iter->seq; \
217 struct ftrace_raw_##call *field; \ 212 struct ftrace_raw_##call *field; \
218 struct trace_entry *entry; \ 213 struct trace_entry *entry; \
219 struct trace_seq *p; \ 214 struct trace_seq *p = &iter->tmp_seq; \
220 int ret; \ 215 int ret; \
221 \ 216 \
222 event = container_of(trace_event, struct ftrace_event_call, \ 217 event = container_of(trace_event, struct ftrace_event_call, \
@@ -231,12 +226,10 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \
231 \ 226 \
232 field = (typeof(field))entry; \ 227 field = (typeof(field))entry; \
233 \ 228 \
234 p = &get_cpu_var(ftrace_event_seq); \
235 trace_seq_init(p); \ 229 trace_seq_init(p); \
236 ret = trace_seq_printf(s, "%s: ", event->name); \ 230 ret = trace_seq_printf(s, "%s: ", event->name); \
237 if (ret) \ 231 if (ret) \
238 ret = trace_seq_printf(s, print); \ 232 ret = trace_seq_printf(s, print); \
239 put_cpu(); \
240 if (!ret) \ 233 if (!ret) \
241 return TRACE_TYPE_PARTIAL_LINE; \ 234 return TRACE_TYPE_PARTIAL_LINE; \
242 \ 235 \
@@ -255,7 +248,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \
255 struct trace_seq *s = &iter->seq; \ 248 struct trace_seq *s = &iter->seq; \
256 struct ftrace_raw_##template *field; \ 249 struct ftrace_raw_##template *field; \
257 struct trace_entry *entry; \ 250 struct trace_entry *entry; \
258 struct trace_seq *p; \ 251 struct trace_seq *p = &iter->tmp_seq; \
259 int ret; \ 252 int ret; \
260 \ 253 \
261 entry = iter->ent; \ 254 entry = iter->ent; \
@@ -267,12 +260,10 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \
267 \ 260 \
268 field = (typeof(field))entry; \ 261 field = (typeof(field))entry; \
269 \ 262 \
270 p = &get_cpu_var(ftrace_event_seq); \
271 trace_seq_init(p); \ 263 trace_seq_init(p); \
272 ret = trace_seq_printf(s, "%s: ", #call); \ 264 ret = trace_seq_printf(s, "%s: ", #call); \
273 if (ret) \ 265 if (ret) \
274 ret = trace_seq_printf(s, print); \ 266 ret = trace_seq_printf(s, print); \
275 put_cpu(); \
276 if (!ret) \ 267 if (!ret) \
277 return TRACE_TYPE_PARTIAL_LINE; \ 268 return TRACE_TYPE_PARTIAL_LINE; \
278 \ 269 \
@@ -439,6 +430,7 @@ static inline notrace int ftrace_get_offsets_##call( \
439 * .fields = LIST_HEAD_INIT(event_class_##call.fields), 430 * .fields = LIST_HEAD_INIT(event_class_##call.fields),
440 * .raw_init = trace_event_raw_init, 431 * .raw_init = trace_event_raw_init,
441 * .probe = ftrace_raw_event_##call, 432 * .probe = ftrace_raw_event_##call,
433 * .reg = ftrace_event_reg,
442 * }; 434 * };
443 * 435 *
444 * static struct ftrace_event_call __used 436 * static struct ftrace_event_call __used
@@ -567,6 +559,7 @@ static struct ftrace_event_class __used event_class_##call = { \
567 .fields = LIST_HEAD_INIT(event_class_##call.fields),\ 559 .fields = LIST_HEAD_INIT(event_class_##call.fields),\
568 .raw_init = trace_event_raw_init, \ 560 .raw_init = trace_event_raw_init, \
569 .probe = ftrace_raw_event_##call, \ 561 .probe = ftrace_raw_event_##call, \
562 .reg = ftrace_event_reg, \
570 _TRACE_PERF_INIT(call) \ 563 _TRACE_PERF_INIT(call) \
571}; 564};
572 565
@@ -705,7 +698,7 @@ perf_trace_##call(void *__data, proto) \
705 int __data_size; \ 698 int __data_size; \
706 int rctx; \ 699 int rctx; \
707 \ 700 \
708 perf_fetch_caller_regs(&__regs, 1); \ 701 perf_fetch_caller_regs(&__regs); \
709 \ 702 \
710 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ 703 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
711 __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\ 704 __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\
diff --git a/include/trace/syscall.h b/include/trace/syscall.h
index 257e08960d7b..31966a4fb8cc 100644
--- a/include/trace/syscall.h
+++ b/include/trace/syscall.h
@@ -26,7 +26,6 @@ struct syscall_metadata {
26 const char **types; 26 const char **types;
27 const char **args; 27 const char **args;
28 struct list_head enter_fields; 28 struct list_head enter_fields;
29 struct list_head exit_fields;
30 29
31 struct ftrace_event_call *enter_event; 30 struct ftrace_event_call *enter_event;
32 struct ftrace_event_call *exit_event; 31 struct ftrace_event_call *exit_event;
diff --git a/include/video/mipi_display.h b/include/video/mipi_display.h
new file mode 100644
index 000000000000..ddcc8ca7316b
--- /dev/null
+++ b/include/video/mipi_display.h
@@ -0,0 +1,130 @@
1/*
2 * Defines for Mobile Industry Processor Interface (MIPI(R))
3 * Display Working Group standards: DSI, DCS, DBI, DPI
4 *
5 * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
6 * Copyright (C) 2006 Nokia Corporation
7 * Author: Imre Deak <imre.deak@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13#ifndef MIPI_DISPLAY_H
14#define MIPI_DISPLAY_H
15
16/* MIPI DSI Processor-to-Peripheral transaction types */
17enum {
18 MIPI_DSI_V_SYNC_START = 0x01,
19 MIPI_DSI_V_SYNC_END = 0x11,
20 MIPI_DSI_H_SYNC_START = 0x21,
21 MIPI_DSI_H_SYNC_END = 0x31,
22
23 MIPI_DSI_COLOR_MODE_OFF = 0x02,
24 MIPI_DSI_COLOR_MODE_ON = 0x12,
25 MIPI_DSI_SHUTDOWN_PERIPHERAL = 0x22,
26 MIPI_DSI_TURN_ON_PERIPHERAL = 0x32,
27
28 MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM = 0x03,
29 MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM = 0x13,
30 MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM = 0x23,
31
32 MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM = 0x04,
33 MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM = 0x14,
34 MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM = 0x24,
35
36 MIPI_DSI_DCS_SHORT_WRITE = 0x05,
37 MIPI_DSI_DCS_SHORT_WRITE_PARAM = 0x15,
38
39 MIPI_DSI_DCS_READ = 0x06,
40
41 MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE = 0x37,
42
43 MIPI_DSI_END_OF_TRANSMISSION = 0x08,
44
45 MIPI_DSI_NULL_PACKET = 0x09,
46 MIPI_DSI_BLANKING_PACKET = 0x19,
47 MIPI_DSI_GENERIC_LONG_WRITE = 0x29,
48 MIPI_DSI_DCS_LONG_WRITE = 0x39,
49
50 MIPI_DSI_LOOSELY_PACKED_PIXEL_STREAM_YCBCR20 = 0x0c,
51 MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR24 = 0x1c,
52 MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16 = 0x2c,
53
54 MIPI_DSI_PACKED_PIXEL_STREAM_30 = 0x0d,
55 MIPI_DSI_PACKED_PIXEL_STREAM_36 = 0x1d,
56 MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12 = 0x3d,
57
58 MIPI_DSI_PACKED_PIXEL_STREAM_16 = 0x0e,
59 MIPI_DSI_PACKED_PIXEL_STREAM_18 = 0x1e,
60 MIPI_DSI_PIXEL_STREAM_3BYTE_18 = 0x2e,
61 MIPI_DSI_PACKED_PIXEL_STREAM_24 = 0x3e,
62};
63
64/* MIPI DSI Peripheral-to-Processor transaction types */
65enum {
66 MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT = 0x02,
67 MIPI_DSI_RX_END_OF_TRANSMISSION = 0x08,
68 MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE = 0x11,
69 MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_2BYTE = 0x12,
70 MIPI_DSI_RX_GENERIC_LONG_READ_RESPONSE = 0x1a,
71 MIPI_DSI_RX_DCS_LONG_READ_RESPONSE = 0x1c,
72 MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE = 0x21,
73 MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_2BYTE = 0x22,
74};
75
76/* MIPI DCS commands */
77enum {
78 MIPI_DCS_NOP = 0x00,
79 MIPI_DCS_SOFT_RESET = 0x01,
80 MIPI_DCS_GET_DISPLAY_ID = 0x04,
81 MIPI_DCS_GET_RED_CHANNEL = 0x06,
82 MIPI_DCS_GET_GREEN_CHANNEL = 0x07,
83 MIPI_DCS_GET_BLUE_CHANNEL = 0x08,
84 MIPI_DCS_GET_DISPLAY_STATUS = 0x09,
85 MIPI_DCS_GET_POWER_MODE = 0x0A,
86 MIPI_DCS_GET_ADDRESS_MODE = 0x0B,
87 MIPI_DCS_GET_PIXEL_FORMAT = 0x0C,
88 MIPI_DCS_GET_DISPLAY_MODE = 0x0D,
89 MIPI_DCS_GET_SIGNAL_MODE = 0x0E,
90 MIPI_DCS_GET_DIAGNOSTIC_RESULT = 0x0F,
91 MIPI_DCS_ENTER_SLEEP_MODE = 0x10,
92 MIPI_DCS_EXIT_SLEEP_MODE = 0x11,
93 MIPI_DCS_ENTER_PARTIAL_MODE = 0x12,
94 MIPI_DCS_ENTER_NORMAL_MODE = 0x13,
95 MIPI_DCS_EXIT_INVERT_MODE = 0x20,
96 MIPI_DCS_ENTER_INVERT_MODE = 0x21,
97 MIPI_DCS_SET_GAMMA_CURVE = 0x26,
98 MIPI_DCS_SET_DISPLAY_OFF = 0x28,
99 MIPI_DCS_SET_DISPLAY_ON = 0x29,
100 MIPI_DCS_SET_COLUMN_ADDRESS = 0x2A,
101 MIPI_DCS_SET_PAGE_ADDRESS = 0x2B,
102 MIPI_DCS_WRITE_MEMORY_START = 0x2C,
103 MIPI_DCS_WRITE_LUT = 0x2D,
104 MIPI_DCS_READ_MEMORY_START = 0x2E,
105 MIPI_DCS_SET_PARTIAL_AREA = 0x30,
106 MIPI_DCS_SET_SCROLL_AREA = 0x33,
107 MIPI_DCS_SET_TEAR_OFF = 0x34,
108 MIPI_DCS_SET_TEAR_ON = 0x35,
109 MIPI_DCS_SET_ADDRESS_MODE = 0x36,
110 MIPI_DCS_SET_SCROLL_START = 0x37,
111 MIPI_DCS_EXIT_IDLE_MODE = 0x38,
112 MIPI_DCS_ENTER_IDLE_MODE = 0x39,
113 MIPI_DCS_SET_PIXEL_FORMAT = 0x3A,
114 MIPI_DCS_WRITE_MEMORY_CONTINUE = 0x3C,
115 MIPI_DCS_READ_MEMORY_CONTINUE = 0x3E,
116 MIPI_DCS_SET_TEAR_SCANLINE = 0x44,
117 MIPI_DCS_GET_SCANLINE = 0x45,
118 MIPI_DCS_READ_DDB_START = 0xA1,
119 MIPI_DCS_READ_DDB_CONTINUE = 0xA8,
120};
121
122/* MIPI DCS pixel formats */
123#define MIPI_DCS_PIXEL_FMT_24BIT 7
124#define MIPI_DCS_PIXEL_FMT_18BIT 6
125#define MIPI_DCS_PIXEL_FMT_16BIT 5
126#define MIPI_DCS_PIXEL_FMT_12BIT 3
127#define MIPI_DCS_PIXEL_FMT_8BIT 2
128#define MIPI_DCS_PIXEL_FMT_3BIT 1
129
130#endif
diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
new file mode 100644
index 000000000000..18bca08f9f59
--- /dev/null
+++ b/include/video/sh_mipi_dsi.h
@@ -0,0 +1,35 @@
1/*
2 * Public SH-mobile MIPI DSI header
3 *
4 * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef VIDEO_SH_MIPI_DSI_H
11#define VIDEO_SH_MIPI_DSI_H
12
13enum sh_mipi_dsi_data_fmt {
14 MIPI_RGB888,
15 MIPI_RGB565,
16 MIPI_RGB666_LP,
17 MIPI_RGB666,
18 MIPI_BGR888,
19 MIPI_BGR565,
20 MIPI_BGR666_LP,
21 MIPI_BGR666,
22 MIPI_YUYV,
23 MIPI_UYVY,
24 MIPI_YUV420_L,
25 MIPI_YUV420,
26};
27
28struct sh_mobile_lcdc_chan_cfg;
29
30struct sh_mipi_dsi_info {
31 enum sh_mipi_dsi_data_fmt data_format;
32 struct sh_mobile_lcdc_chan_cfg *lcd_chan;
33};
34
35#endif
diff --git a/include/video/sh_mobile_hdmi.h b/include/video/sh_mobile_hdmi.h
new file mode 100644
index 000000000000..577cf18cce89
--- /dev/null
+++ b/include/video/sh_mobile_hdmi.h
@@ -0,0 +1,22 @@
1/*
2 * SH-Mobile High-Definition Multimedia Interface (HDMI)
3 *
4 * Copyright (C) 2010, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef SH_MOBILE_HDMI_H
12#define SH_MOBILE_HDMI_H
13
14struct sh_mobile_lcdc_chan_cfg;
15struct device;
16
17struct sh_mobile_hdmi_info {
18 struct sh_mobile_lcdc_chan_cfg *lcd_chan;
19 struct device *lcd_dev;
20};
21
22#endif
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
index 288205457713..55d700e8566e 100644
--- a/include/video/sh_mobile_lcdc.h
+++ b/include/video/sh_mobile_lcdc.h
@@ -3,24 +3,27 @@
3 3
4#include <linux/fb.h> 4#include <linux/fb.h>
5 5
6enum { RGB8, /* 24bpp, 8:8:8 */ 6enum {
7 RGB9, /* 18bpp, 9:9 */ 7 RGB8, /* 24bpp, 8:8:8 */
8 RGB12A, /* 24bpp, 12:12 */ 8 RGB9, /* 18bpp, 9:9 */
9 RGB12B, /* 12bpp */ 9 RGB12A, /* 24bpp, 12:12 */
10 RGB16, /* 16bpp */ 10 RGB12B, /* 12bpp */
11 RGB18, /* 18bpp */ 11 RGB16, /* 16bpp */
12 RGB24, /* 24bpp */ 12 RGB18, /* 18bpp */
13 SYS8A, /* 24bpp, 8:8:8 */ 13 RGB24, /* 24bpp */
14 SYS8B, /* 18bpp, 8:8:2 */ 14 YUV422, /* 16bpp */
15 SYS8C, /* 18bpp, 2:8:8 */ 15 SYS8A, /* 24bpp, 8:8:8 */
16 SYS8D, /* 16bpp, 8:8 */ 16 SYS8B, /* 18bpp, 8:8:2 */
17 SYS9, /* 18bpp, 9:9 */ 17 SYS8C, /* 18bpp, 2:8:8 */
18 SYS12, /* 24bpp, 12:12 */ 18 SYS8D, /* 16bpp, 8:8 */
19 SYS16A, /* 16bpp */ 19 SYS9, /* 18bpp, 9:9 */
20 SYS16B, /* 18bpp, 16:2 */ 20 SYS12, /* 24bpp, 12:12 */
21 SYS16C, /* 18bpp, 2:16 */ 21 SYS16A, /* 16bpp */
22 SYS18, /* 18bpp */ 22 SYS16B, /* 18bpp, 16:2 */
23 SYS24 };/* 24bpp */ 23 SYS16C, /* 18bpp, 2:16 */
24 SYS18, /* 18bpp */
25 SYS24, /* 24bpp */
26};
24 27
25enum { LCDC_CHAN_DISABLED = 0, 28enum { LCDC_CHAN_DISABLED = 0,
26 LCDC_CHAN_MAINLCD, 29 LCDC_CHAN_MAINLCD,
@@ -52,7 +55,7 @@ struct sh_mobile_lcdc_board_cfg {
52 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 55 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
53 void (*start_transfer)(void *board_data, void *sys_ops_handle, 56 void (*start_transfer)(void *board_data, void *sys_ops_handle,
54 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 57 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
55 void (*display_on)(void *board_data); 58 void (*display_on)(void *board_data, struct fb_info *info);
56 void (*display_off)(void *board_data); 59 void (*display_off)(void *board_data);
57}; 60};
58 61
diff --git a/include/xen/events.h b/include/xen/events.h
index e68d59a90ca8..a15d93262e30 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -56,4 +56,11 @@ void xen_poll_irq(int irq);
56/* Determine the IRQ which is bound to an event channel */ 56/* Determine the IRQ which is bound to an event channel */
57unsigned irq_from_evtchn(unsigned int evtchn); 57unsigned irq_from_evtchn(unsigned int evtchn);
58 58
59/* Xen HVM evtchn vector callback */
60extern void xen_hvm_callback_vector(void);
61extern int xen_have_vector_callback;
62int xen_set_callback_via(uint64_t via);
63void xen_evtchn_do_upcall(struct pt_regs *regs);
64void xen_hvm_evtchn_do_upcall(void);
65
59#endif /* _XEN_EVENTS_H */ 66#endif /* _XEN_EVENTS_H */
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
index a40f1cd91be1..9a731706a016 100644
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@ -51,6 +51,7 @@ struct gnttab_free_callback {
51 u16 count; 51 u16 count;
52}; 52};
53 53
54int gnttab_init(void);
54int gnttab_suspend(void); 55int gnttab_suspend(void);
55int gnttab_resume(void); 56int gnttab_resume(void);
56 57
@@ -112,6 +113,9 @@ int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
112void arch_gnttab_unmap_shared(struct grant_entry *shared, 113void arch_gnttab_unmap_shared(struct grant_entry *shared,
113 unsigned long nr_gframes); 114 unsigned long nr_gframes);
114 115
116extern unsigned long xen_hvm_resume_frames;
117unsigned int gnttab_max_grant_frames(void);
118
115#define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr)) 119#define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr))
116 120
117#endif /* __ASM_GNTTAB_H__ */ 121#endif /* __ASM_GNTTAB_H__ */
diff --git a/include/xen/hvm.h b/include/xen/hvm.h
new file mode 100644
index 000000000000..b193fa2f9fdd
--- /dev/null
+++ b/include/xen/hvm.h
@@ -0,0 +1,30 @@
1/* Simple wrappers around HVM functions */
2#ifndef XEN_HVM_H__
3#define XEN_HVM_H__
4
5#include <xen/interface/hvm/params.h>
6#include <asm/xen/hypercall.h>
7
8static inline int hvm_get_parameter(int idx, uint64_t *value)
9{
10 struct xen_hvm_param xhv;
11 int r;
12
13 xhv.domid = DOMID_SELF;
14 xhv.index = idx;
15 r = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv);
16 if (r < 0) {
17 printk(KERN_ERR "Cannot get hvm parameter %d: %d!\n",
18 idx, r);
19 return r;
20 }
21 *value = xhv.value;
22 return r;
23}
24
25#define HVM_CALLBACK_VIA_TYPE_VECTOR 0x2
26#define HVM_CALLBACK_VIA_TYPE_SHIFT 56
27#define HVM_CALLBACK_VECTOR(x) (((uint64_t)HVM_CALLBACK_VIA_TYPE_VECTOR)<<\
28 HVM_CALLBACK_VIA_TYPE_SHIFT | (x))
29
30#endif /* XEN_HVM_H__ */
diff --git a/include/xen/interface/features.h b/include/xen/interface/features.h
index f51b6413b054..70d2563ab166 100644
--- a/include/xen/interface/features.h
+++ b/include/xen/interface/features.h
@@ -41,6 +41,12 @@
41/* x86: Does this Xen host support the MMU_PT_UPDATE_PRESERVE_AD hypercall? */ 41/* x86: Does this Xen host support the MMU_PT_UPDATE_PRESERVE_AD hypercall? */
42#define XENFEAT_mmu_pt_update_preserve_ad 5 42#define XENFEAT_mmu_pt_update_preserve_ad 5
43 43
44/* x86: Does this Xen host support the HVM callback vector type? */
45#define XENFEAT_hvm_callback_vector 8
46
47/* x86: pvclock algorithm is safe to use on HVM */
48#define XENFEAT_hvm_safe_pvclock 9
49
44#define XENFEAT_NR_SUBMAPS 1 50#define XENFEAT_NR_SUBMAPS 1
45 51
46#endif /* __XEN_PUBLIC_FEATURES_H__ */ 52#endif /* __XEN_PUBLIC_FEATURES_H__ */
diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h
index 39da93c21de0..39e571796e32 100644
--- a/include/xen/interface/grant_table.h
+++ b/include/xen/interface/grant_table.h
@@ -28,6 +28,7 @@
28#ifndef __XEN_PUBLIC_GRANT_TABLE_H__ 28#ifndef __XEN_PUBLIC_GRANT_TABLE_H__
29#define __XEN_PUBLIC_GRANT_TABLE_H__ 29#define __XEN_PUBLIC_GRANT_TABLE_H__
30 30
31#include <xen/interface/xen.h>
31 32
32/*********************************** 33/***********************************
33 * GRANT TABLE REPRESENTATION 34 * GRANT TABLE REPRESENTATION
diff --git a/include/xen/interface/hvm/hvm_op.h b/include/xen/interface/hvm/hvm_op.h
new file mode 100644
index 000000000000..a4827f46ee97
--- /dev/null
+++ b/include/xen/interface/hvm/hvm_op.h
@@ -0,0 +1,46 @@
1/*
2 * Permission is hereby granted, free of charge, to any person obtaining a copy
3 * of this software and associated documentation files (the "Software"), to
4 * deal in the Software without restriction, including without limitation the
5 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
6 * sell copies of the Software, and to permit persons to whom the Software is
7 * furnished to do so, subject to the following conditions:
8 *
9 * The above copyright notice and this permission notice shall be included in
10 * all copies or substantial portions of the Software.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18 * DEALINGS IN THE SOFTWARE.
19 */
20
21#ifndef __XEN_PUBLIC_HVM_HVM_OP_H__
22#define __XEN_PUBLIC_HVM_HVM_OP_H__
23
24/* Get/set subcommands: the second argument of the hypercall is a
25 * pointer to a xen_hvm_param struct. */
26#define HVMOP_set_param 0
27#define HVMOP_get_param 1
28struct xen_hvm_param {
29 domid_t domid; /* IN */
30 uint32_t index; /* IN */
31 uint64_t value; /* IN/OUT */
32};
33DEFINE_GUEST_HANDLE_STRUCT(xen_hvm_param);
34
35/* Hint from PV drivers for pagetable destruction. */
36#define HVMOP_pagetable_dying 9
37struct xen_hvm_pagetable_dying {
38 /* Domain with a pagetable about to be destroyed. */
39 domid_t domid;
40 /* guest physical address of the toplevel pagetable dying */
41 aligned_u64 gpa;
42};
43typedef struct xen_hvm_pagetable_dying xen_hvm_pagetable_dying_t;
44DEFINE_GUEST_HANDLE_STRUCT(xen_hvm_pagetable_dying_t);
45
46#endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */
diff --git a/include/xen/interface/hvm/params.h b/include/xen/interface/hvm/params.h
new file mode 100644
index 000000000000..1888d8c157e6
--- /dev/null
+++ b/include/xen/interface/hvm/params.h
@@ -0,0 +1,95 @@
1/*
2 * Permission is hereby granted, free of charge, to any person obtaining a copy
3 * of this software and associated documentation files (the "Software"), to
4 * deal in the Software without restriction, including without limitation the
5 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
6 * sell copies of the Software, and to permit persons to whom the Software is
7 * furnished to do so, subject to the following conditions:
8 *
9 * The above copyright notice and this permission notice shall be included in
10 * all copies or substantial portions of the Software.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18 * DEALINGS IN THE SOFTWARE.
19 */
20
21#ifndef __XEN_PUBLIC_HVM_PARAMS_H__
22#define __XEN_PUBLIC_HVM_PARAMS_H__
23
24#include "hvm_op.h"
25
26/*
27 * Parameter space for HVMOP_{set,get}_param.
28 */
29
30/*
31 * How should CPU0 event-channel notifications be delivered?
32 * val[63:56] == 0: val[55:0] is a delivery GSI (Global System Interrupt).
33 * val[63:56] == 1: val[55:0] is a delivery PCI INTx line, as follows:
34 * Domain = val[47:32], Bus = val[31:16],
35 * DevFn = val[15: 8], IntX = val[ 1: 0]
36 * val[63:56] == 2: val[7:0] is a vector number.
37 * If val == 0 then CPU0 event-channel notifications are not delivered.
38 */
39#define HVM_PARAM_CALLBACK_IRQ 0
40
41#define HVM_PARAM_STORE_PFN 1
42#define HVM_PARAM_STORE_EVTCHN 2
43
44#define HVM_PARAM_PAE_ENABLED 4
45
46#define HVM_PARAM_IOREQ_PFN 5
47
48#define HVM_PARAM_BUFIOREQ_PFN 6
49
50/*
51 * Set mode for virtual timers (currently x86 only):
52 * delay_for_missed_ticks (default):
53 * Do not advance a vcpu's time beyond the correct delivery time for
54 * interrupts that have been missed due to preemption. Deliver missed
55 * interrupts when the vcpu is rescheduled and advance the vcpu's virtual
56 * time stepwise for each one.
57 * no_delay_for_missed_ticks:
58 * As above, missed interrupts are delivered, but guest time always tracks
59 * wallclock (i.e., real) time while doing so.
60 * no_missed_ticks_pending:
61 * No missed interrupts are held pending. Instead, to ensure ticks are
62 * delivered at some non-zero rate, if we detect missed ticks then the
63 * internal tick alarm is not disabled if the VCPU is preempted during the
64 * next tick period.
65 * one_missed_tick_pending:
66 * Missed interrupts are collapsed together and delivered as one 'late tick'.
67 * Guest time always tracks wallclock (i.e., real) time.
68 */
69#define HVM_PARAM_TIMER_MODE 10
70#define HVMPTM_delay_for_missed_ticks 0
71#define HVMPTM_no_delay_for_missed_ticks 1
72#define HVMPTM_no_missed_ticks_pending 2
73#define HVMPTM_one_missed_tick_pending 3
74
75/* Boolean: Enable virtual HPET (high-precision event timer)? (x86-only) */
76#define HVM_PARAM_HPET_ENABLED 11
77
78/* Identity-map page directory used by Intel EPT when CR0.PG=0. */
79#define HVM_PARAM_IDENT_PT 12
80
81/* Device Model domain, defaults to 0. */
82#define HVM_PARAM_DM_DOMAIN 13
83
84/* ACPI S state: currently support S0 and S3 on x86. */
85#define HVM_PARAM_ACPI_S_STATE 14
86
87/* TSS used on Intel when CR0.PE=0. */
88#define HVM_PARAM_VM86_TSS 15
89
90/* Boolean: Enable aligning all periodic vpts to reduce interrupts */
91#define HVM_PARAM_VPT_ALIGN 16
92
93#define HVM_NR_PARAMS 17
94
95#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h
index af36ead16817..d3938d3e71f8 100644
--- a/include/xen/interface/memory.h
+++ b/include/xen/interface/memory.h
@@ -9,6 +9,8 @@
9#ifndef __XEN_PUBLIC_MEMORY_H__ 9#ifndef __XEN_PUBLIC_MEMORY_H__
10#define __XEN_PUBLIC_MEMORY_H__ 10#define __XEN_PUBLIC_MEMORY_H__
11 11
12#include <linux/spinlock.h>
13
12/* 14/*
13 * Increase or decrease the specified domain's memory reservation. Returns a 15 * Increase or decrease the specified domain's memory reservation. Returns a
14 * -ve errcode on failure, or the # extents successfully allocated or freed. 16 * -ve errcode on failure, or the # extents successfully allocated or freed.
@@ -53,6 +55,48 @@ struct xen_memory_reservation {
53DEFINE_GUEST_HANDLE_STRUCT(xen_memory_reservation); 55DEFINE_GUEST_HANDLE_STRUCT(xen_memory_reservation);
54 56
55/* 57/*
58 * An atomic exchange of memory pages. If return code is zero then
59 * @out.extent_list provides GMFNs of the newly-allocated memory.
60 * Returns zero on complete success, otherwise a negative error code.
61 * On complete success then always @nr_exchanged == @in.nr_extents.
62 * On partial success @nr_exchanged indicates how much work was done.
63 */
64#define XENMEM_exchange 11
65struct xen_memory_exchange {
66 /*
67 * [IN] Details of memory extents to be exchanged (GMFN bases).
68 * Note that @in.address_bits is ignored and unused.
69 */
70 struct xen_memory_reservation in;
71
72 /*
73 * [IN/OUT] Details of new memory extents.
74 * We require that:
75 * 1. @in.domid == @out.domid
76 * 2. @in.nr_extents << @in.extent_order ==
77 * @out.nr_extents << @out.extent_order
78 * 3. @in.extent_start and @out.extent_start lists must not overlap
79 * 4. @out.extent_start lists GPFN bases to be populated
80 * 5. @out.extent_start is overwritten with allocated GMFN bases
81 */
82 struct xen_memory_reservation out;
83
84 /*
85 * [OUT] Number of input extents that were successfully exchanged:
86 * 1. The first @nr_exchanged input extents were successfully
87 * deallocated.
88 * 2. The corresponding first entries in the output extent list correctly
89 * indicate the GMFNs that were successfully exchanged.
90 * 3. All other input and output extents are untouched.
91 * 4. If not all input exents are exchanged then the return code of this
92 * command will be non-zero.
93 * 5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER!
94 */
95 unsigned long nr_exchanged;
96};
97
98DEFINE_GUEST_HANDLE_STRUCT(xen_memory_exchange);
99/*
56 * Returns the maximum machine frame number of mapped RAM in this system. 100 * Returns the maximum machine frame number of mapped RAM in this system.
57 * This command always succeeds (it never returns an error code). 101 * This command always succeeds (it never returns an error code).
58 * arg == NULL. 102 * arg == NULL.
@@ -142,4 +186,10 @@ struct xen_translate_gpfn_list {
142}; 186};
143DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list); 187DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list);
144 188
189
190/*
191 * Prevent the balloon driver from changing the memory reservation
192 * during a driver critical region.
193 */
194extern spinlock_t xen_reservation_lock;
145#endif /* __XEN_PUBLIC_MEMORY_H__ */ 195#endif /* __XEN_PUBLIC_MEMORY_H__ */
diff --git a/include/xen/platform_pci.h b/include/xen/platform_pci.h
new file mode 100644
index 000000000000..ce9d671c636c
--- /dev/null
+++ b/include/xen/platform_pci.h
@@ -0,0 +1,49 @@
1#ifndef _XEN_PLATFORM_PCI_H
2#define _XEN_PLATFORM_PCI_H
3
4#define XEN_IOPORT_MAGIC_VAL 0x49d2
5#define XEN_IOPORT_LINUX_PRODNUM 0x0003
6#define XEN_IOPORT_LINUX_DRVVER 0x0001
7
8#define XEN_IOPORT_BASE 0x10
9
10#define XEN_IOPORT_PLATFLAGS (XEN_IOPORT_BASE + 0) /* 1 byte access (R/W) */
11#define XEN_IOPORT_MAGIC (XEN_IOPORT_BASE + 0) /* 2 byte access (R) */
12#define XEN_IOPORT_UNPLUG (XEN_IOPORT_BASE + 0) /* 2 byte access (W) */
13#define XEN_IOPORT_DRVVER (XEN_IOPORT_BASE + 0) /* 4 byte access (W) */
14
15#define XEN_IOPORT_SYSLOG (XEN_IOPORT_BASE + 2) /* 1 byte access (W) */
16#define XEN_IOPORT_PROTOVER (XEN_IOPORT_BASE + 2) /* 1 byte access (R) */
17#define XEN_IOPORT_PRODNUM (XEN_IOPORT_BASE + 2) /* 2 byte access (W) */
18
19#define XEN_UNPLUG_ALL_IDE_DISKS 1
20#define XEN_UNPLUG_ALL_NICS 2
21#define XEN_UNPLUG_AUX_IDE_DISKS 4
22#define XEN_UNPLUG_ALL 7
23#define XEN_UNPLUG_IGNORE 8
24
25static inline int xen_must_unplug_nics(void) {
26#if (defined(CONFIG_XEN_NETDEV_FRONTEND) || \
27 defined(CONFIG_XEN_NETDEV_FRONTEND_MODULE)) && \
28 (defined(CONFIG_XEN_PLATFORM_PCI) || \
29 defined(CONFIG_XEN_PLATFORM_PCI_MODULE))
30 return 1;
31#else
32 return 0;
33#endif
34}
35
36static inline int xen_must_unplug_disks(void) {
37#if (defined(CONFIG_XEN_BLKDEV_FRONTEND) || \
38 defined(CONFIG_XEN_BLKDEV_FRONTEND_MODULE)) && \
39 (defined(CONFIG_XEN_PLATFORM_PCI) || \
40 defined(CONFIG_XEN_PLATFORM_PCI_MODULE))
41 return 1;
42#else
43 return 0;
44#endif
45}
46
47extern int xen_platform_pci_unplug;
48
49#endif /* _XEN_PLATFORM_PCI_H */
diff --git a/include/xen/swiotlb-xen.h b/include/xen/swiotlb-xen.h
new file mode 100644
index 000000000000..2ea2fdc79c16
--- /dev/null
+++ b/include/xen/swiotlb-xen.h
@@ -0,0 +1,65 @@
1#ifndef __LINUX_SWIOTLB_XEN_H
2#define __LINUX_SWIOTLB_XEN_H
3
4#include <linux/swiotlb.h>
5
6extern void xen_swiotlb_init(int verbose);
7
8extern void
9*xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size,
10 dma_addr_t *dma_handle, gfp_t flags);
11
12extern void
13xen_swiotlb_free_coherent(struct device *hwdev, size_t size,
14 void *vaddr, dma_addr_t dma_handle);
15
16extern dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
17 unsigned long offset, size_t size,
18 enum dma_data_direction dir,
19 struct dma_attrs *attrs);
20
21extern void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
22 size_t size, enum dma_data_direction dir,
23 struct dma_attrs *attrs);
24/*
25extern int
26xen_swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
27 enum dma_data_direction dir);
28
29extern void
30xen_swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
31 enum dma_data_direction dir);
32*/
33extern int
34xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
35 int nelems, enum dma_data_direction dir,
36 struct dma_attrs *attrs);
37
38extern void
39xen_swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
40 int nelems, enum dma_data_direction dir,
41 struct dma_attrs *attrs);
42
43extern void
44xen_swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
45 size_t size, enum dma_data_direction dir);
46
47extern void
48xen_swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
49 int nelems, enum dma_data_direction dir);
50
51extern void
52xen_swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr,
53 size_t size, enum dma_data_direction dir);
54
55extern void
56xen_swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
57 int nelems, enum dma_data_direction dir);
58
59extern int
60xen_swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
61
62extern int
63xen_swiotlb_dma_supported(struct device *hwdev, u64 mask);
64
65#endif /* __LINUX_SWIOTLB_XEN_H */
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index 883a21bba24b..351f4051f6d8 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -7,6 +7,7 @@ DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
7 7
8void xen_pre_suspend(void); 8void xen_pre_suspend(void);
9void xen_post_suspend(int suspend_cancelled); 9void xen_post_suspend(int suspend_cancelled);
10void xen_hvm_post_suspend(int suspend_cancelled);
10 11
11void xen_mm_pin_all(void); 12void xen_mm_pin_all(void);
12void xen_mm_unpin_all(void); 13void xen_mm_unpin_all(void);
@@ -14,4 +15,12 @@ void xen_mm_unpin_all(void);
14void xen_timer_resume(void); 15void xen_timer_resume(void);
15void xen_arch_resume(void); 16void xen_arch_resume(void);
16 17
18int xen_setup_shutdown_event(void);
19
20extern unsigned long *xen_contiguous_bitmap;
21int xen_create_contiguous_region(unsigned long vstart, unsigned int order,
22 unsigned int address_bits);
23
24void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order);
25
17#endif /* INCLUDE_XEN_OPS_H */ 26#endif /* INCLUDE_XEN_OPS_H */