aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAnton Vorontsov <cbouatmailru@gmail.com>2008-07-29 18:05:23 -0400
committerAnton Vorontsov <cbouatmailru@gmail.com>2008-07-29 18:05:23 -0400
commit9fec6060d9e48ed7db0dac0e16d0f0f0e615b7f6 (patch)
tree74b41f31a08f6500ff3dfcf64ba21e2d9a8e87e5 /include/linux
parentfece418418f51e92dd7e67e17c5e3fe5a28d3279 (diff)
parent6e86841d05f371b5b9b86ce76c02aaee83352298 (diff)
Merge branch 'master' of /home/cbou/linux-2.6
Conflicts: drivers/power/Kconfig drivers/power/Makefile
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild10
-rw-r--r--include/linux/a.out.h8
-rw-r--r--include/linux/acct.h3
-rw-r--r--include/linux/acpi.h10
-rw-r--r--include/linux/adb.h1
-rw-r--r--include/linux/agp_backend.h16
-rw-r--r--include/linux/agpgart.h4
-rw-r--r--include/linux/aio.h1
-rw-r--r--include/linux/anon_inodes.h2
-rw-r--r--include/linux/async_tx.h11
-rw-r--r--include/linux/atm.h7
-rw-r--r--include/linux/atm_tcp.h12
-rw-r--r--include/linux/atmel-pwm-bl.h43
-rw-r--r--include/linux/audit.h3
-rw-r--r--include/linux/auto_fs4.h2
-rw-r--r--include/linux/auxvec.h8
-rw-r--r--include/linux/bcd.h9
-rw-r--r--include/linux/binfmts.h3
-rw-r--r--include/linux/bio.h130
-rw-r--r--include/linux/bitmap.h1
-rw-r--r--include/linux/bitrev.h1
-rw-r--r--include/linux/blkdev.h167
-rw-r--r--include/linux/blktrace_api.h27
-rw-r--r--include/linux/bootmem.h102
-rw-r--r--include/linux/brcmphy.h6
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/byteorder/big_endian.h12
-rw-r--r--include/linux/byteorder/little_endian.h12
-rw-r--r--include/linux/capability.h31
-rw-r--r--include/linux/cfag12864b.h2
-rw-r--r--include/linux/cgroup.h51
-rw-r--r--include/linux/coda.h43
-rw-r--r--include/linux/coda_linux.h2
-rw-r--r--include/linux/compiler.h12
-rw-r--r--include/linux/configfs.h3
-rw-r--r--include/linux/console.h2
-rw-r--r--include/linux/consolemap.h14
-rw-r--r--include/linux/cpu.h15
-rw-r--r--include/linux/cpufreq.h3
-rw-r--r--include/linux/cpuidle.h1
-rw-r--r--include/linux/cpumask.h190
-rw-r--r--include/linux/cpuset.h7
-rw-r--r--include/linux/crash_dump.h14
-rw-r--r--include/linux/crc-t10dif.h8
-rw-r--r--include/linux/crypto.h48
-rw-r--r--include/linux/cyclades.h13
-rw-r--r--include/linux/dca.h7
-rw-r--r--include/linux/dcache.h3
-rw-r--r--include/linux/dccp.h6
-rw-r--r--include/linux/debug_locks.h10
-rw-r--r--include/linux/debugfs.h6
-rw-r--r--include/linux/delay.h1
-rw-r--r--include/linux/delayacct.h19
-rw-r--r--include/linux/device-mapper.h6
-rw-r--r--include/linux/device.h73
-rw-r--r--include/linux/dirent.h20
-rw-r--r--include/linux/dm-ioctl.h4
-rw-r--r--include/linux/dm9000.h1
-rw-r--r--include/linux/dma-attrs.h1
-rw-r--r--include/linux/dmaengine.h69
-rw-r--r--include/linux/dw_dmac.h62
-rw-r--r--include/linux/efi.h4
-rw-r--r--include/linux/eisa.h2
-rw-r--r--include/linux/elf.h1
-rw-r--r--include/linux/ethtool.h33
-rw-r--r--include/linux/eventfd.h7
-rw-r--r--include/linux/eventpoll.h4
-rw-r--r--include/linux/exportfs.h21
-rw-r--r--include/linux/ext2_fs.h4
-rw-r--r--include/linux/ext3_fs.h1
-rw-r--r--include/linux/fb.h5
-rw-r--r--include/linux/fd1772.h80
-rw-r--r--include/linux/fdtable.h1
-rw-r--r--include/linux/firmware-map.h74
-rw-r--r--include/linux/firmware.h25
-rw-r--r--include/linux/freezer.h10
-rw-r--r--include/linux/fs.h141
-rw-r--r--include/linux/fs_enet_pd.h8
-rw-r--r--include/linux/fs_struct.h3
-rw-r--r--include/linux/fsl_devices.h7
-rw-r--r--include/linux/ftrace.h144
-rw-r--r--include/linux/fuse.h4
-rw-r--r--include/linux/gameport.h1
-rw-r--r--include/linux/generic_serial.h8
-rw-r--r--include/linux/genhd.h53
-rw-r--r--include/linux/gfp.h24
-rw-r--r--include/linux/gpio.h16
-rw-r--r--include/linux/gpio_keys.h1
-rw-r--r--include/linux/hardirq.h18
-rw-r--r--include/linux/hayesesp.h9
-rw-r--r--include/linux/hdlc.h7
-rw-r--r--include/linux/hid.h5
-rw-r--r--include/linux/hiddev.h2
-rw-r--r--include/linux/hugetlb.h146
-rw-r--r--include/linux/i2c-algo-pcf.h8
-rw-r--r--include/linux/i2c-id.h11
-rw-r--r--include/linux/i2c.h57
-rw-r--r--include/linux/i2c/at24.h28
-rw-r--r--include/linux/i2c/max732x.h19
-rw-r--r--include/linux/i2c/pcf857x.h3
-rw-r--r--include/linux/i2o.h2
-rw-r--r--include/linux/ide.h360
-rw-r--r--include/linux/idr.h24
-rw-r--r--include/linux/ieee80211.h499
-rw-r--r--include/linux/if_bridge.h2
-rw-r--r--include/linux/if_packet.h24
-rw-r--r--include/linux/if_ppp.h2
-rw-r--r--include/linux/if_tun.h34
-rw-r--r--include/linux/if_tunnel.h2
-rw-r--r--include/linux/if_vlan.h238
-rw-r--r--include/linux/igmp.h1
-rw-r--r--include/linux/ihex.h74
-rw-r--r--include/linux/in_route.h12
-rw-r--r--include/linux/inet.h7
-rw-r--r--include/linux/inet_lro.h6
-rw-r--r--include/linux/inetdevice.h1
-rw-r--r--include/linux/init.h15
-rw-r--r--include/linux/init_task.h29
-rw-r--r--include/linux/inotify.h6
-rw-r--r--include/linux/input.h15
-rw-r--r--include/linux/interrupt.h8
-rw-r--r--include/linux/io.h1
-rw-r--r--include/linux/iocontext.h18
-rw-r--r--include/linux/iommu-helper.h1
-rw-r--r--include/linux/ioport.h11
-rw-r--r--include/linux/ioprio.h14
-rw-r--r--include/linux/ip6_tunnel.h4
-rw-r--r--include/linux/ipc_namespace.h3
-rw-r--r--include/linux/ipv6.h10
-rw-r--r--include/linux/irq.h9
-rw-r--r--include/linux/irqflags.h67
-rw-r--r--include/linux/istallion.h6
-rw-r--r--include/linux/jbd2.h76
-rw-r--r--include/linux/jffs2.h3
-rw-r--r--include/linux/joystick.h2
-rw-r--r--include/linux/kallsyms.h41
-rw-r--r--include/linux/kernel.h52
-rw-r--r--include/linux/kernel_stat.h2
-rw-r--r--include/linux/kexec.h17
-rw-r--r--include/linux/kgdb.h4
-rw-r--r--include/linux/kmod.h16
-rw-r--r--include/linux/kobject.h5
-rw-r--r--include/linux/kprobes.h11
-rw-r--r--include/linux/ks0108.h2
-rw-r--r--include/linux/kthread.h3
-rw-r--r--include/linux/kvm.h33
-rw-r--r--include/linux/kvm_host.h14
-rw-r--r--include/linux/lcd.h2
-rw-r--r--include/linux/leds-pca9532.h45
-rw-r--r--include/linux/leds.h16
-rw-r--r--include/linux/libata.h93
-rw-r--r--include/linux/libps2.h1
-rw-r--r--include/linux/linkage.h6
-rw-r--r--include/linux/list.h371
-rw-r--r--include/linux/lm_interface.h6
-rw-r--r--include/linux/lockd/lockd.h8
-rw-r--r--include/linux/lockdep.h11
-rw-r--r--include/linux/mISDNdsp.h37
-rw-r--r--include/linux/mISDNhw.h193
-rw-r--r--include/linux/mISDNif.h487
-rw-r--r--include/linux/major.h2
-rw-r--r--include/linux/maple.h2
-rw-r--r--include/linux/marker.h40
-rw-r--r--include/linux/math64.h21
-rw-r--r--include/linux/memcontrol.h24
-rw-r--r--include/linux/memory_hotplug.h36
-rw-r--r--include/linux/mempolicy.h19
-rw-r--r--include/linux/memstick.h6
-rw-r--r--include/linux/mfd/asic3.h185
-rw-r--r--include/linux/mfd/core.h55
-rw-r--r--include/linux/mfd/tc6393xb.h49
-rw-r--r--include/linux/mfd/tmio.h17
-rw-r--r--include/linux/migrate.h21
-rw-r--r--include/linux/mlx4/device.h13
-rw-r--r--include/linux/mlx4/qp.h22
-rw-r--r--include/linux/mm.h92
-rw-r--r--include/linux/mm_types.h32
-rw-r--r--include/linux/mman.h33
-rw-r--r--include/linux/mmc/card.h2
-rw-r--r--include/linux/mmc/core.h1
-rw-r--r--include/linux/mmc/host.h34
-rw-r--r--include/linux/mmc/mmc.h1
-rw-r--r--include/linux/mmc/sdio_func.h21
-rw-r--r--include/linux/mmiotrace.h85
-rw-r--r--include/linux/mmu_notifier.h279
-rw-r--r--include/linux/mmzone.h2
-rw-r--r--include/linux/mod_devicetable.h12
-rw-r--r--include/linux/module.h52
-rw-r--r--include/linux/mount.h2
-rw-r--r--include/linux/mpage.h10
-rw-r--r--include/linux/mroute.h28
-rw-r--r--include/linux/mroute6.h35
-rw-r--r--include/linux/msdos_fs.h68
-rw-r--r--include/linux/msg.h4
-rw-r--r--include/linux/mtd/blktrans.h2
-rw-r--r--include/linux/mtd/cfi.h1
-rw-r--r--include/linux/mtd/cfi_endian.h5
-rw-r--r--include/linux/mtd/concat.h2
-rw-r--r--include/linux/mtd/doc2000.h2
-rw-r--r--include/linux/mtd/flashchip.h3
-rw-r--r--include/linux/mtd/ftl.h2
-rw-r--r--include/linux/mtd/gen_probe.h1
-rw-r--r--include/linux/mtd/inftl.h4
-rw-r--r--include/linux/mtd/map.h3
-rw-r--r--include/linux/mtd/mtd.h4
-rw-r--r--include/linux/mtd/nand.h9
-rw-r--r--include/linux/mtd/nand_ecc.h2
-rw-r--r--include/linux/mtd/nftl.h2
-rw-r--r--include/linux/mtd/partitions.h2
-rw-r--r--include/linux/mtd/physmap.h2
-rw-r--r--include/linux/mtd/plat-ram.h2
-rw-r--r--include/linux/mtd/pmc551.h4
-rw-r--r--include/linux/mtd/ubi.h5
-rw-r--r--include/linux/mtd/xip.h2
-rw-r--r--include/linux/mv643xx_eth.h79
-rw-r--r--include/linux/namei.h19
-rw-r--r--include/linux/net.h22
-rw-r--r--include/linux/netdevice.h384
-rw-r--r--include/linux/netfilter.h2
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h8
-rw-r--r--include/linux/netfilter/nf_conntrack_sip.h1
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h18
-rw-r--r--include/linux/netfilter/nfnetlink_log.h3
-rw-r--r--include/linux/netfilter/xt_string.h15
-rw-r--r--include/linux/netfilter_arp/arp_tables.h2
-rw-r--r--include/linux/netfilter_bridge/ebt_ip6.h40
-rw-r--r--include/linux/netfilter_bridge/ebt_log.h3
-rw-r--r--include/linux/netfilter_ipv4.h1
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h2
-rw-r--r--include/linux/netfilter_ipv6.h5
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h2
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/nfs4.h3
-rw-r--r--include/linux/nfs_fs.h13
-rw-r--r--include/linux/nfs_iostat.h119
-rw-r--r--include/linux/nfs_page.h9
-rw-r--r--include/linux/nfs_xdr.h3
-rw-r--r--include/linux/nfsd/nfsd.h28
-rw-r--r--include/linux/nfsd/state.h2
-rw-r--r--include/linux/nl80211.h13
-rw-r--r--include/linux/notifier.h3
-rw-r--r--include/linux/nsproxy.h7
-rw-r--r--include/linux/of.h1
-rw-r--r--include/linux/of_device.h3
-rw-r--r--include/linux/of_gpio.h2
-rw-r--r--include/linux/of_i2c.h4
-rw-r--r--include/linux/of_spi.h18
-rw-r--r--include/linux/page-flags.h52
-rw-r--r--include/linux/pageblock-flags.h8
-rw-r--r--include/linux/pagemap.h114
-rw-r--r--include/linux/parport.h3
-rw-r--r--include/linux/parser.h4
-rw-r--r--include/linux/pci-aspm.h5
-rw-r--r--include/linux/pci.h67
-rw-r--r--include/linux/pci_hotplug.h14
-rw-r--r--include/linux/pci_ids.h57
-rw-r--r--include/linux/pci_regs.h2
-rw-r--r--include/linux/percpu.h37
-rw-r--r--include/linux/percpu_counter.h12
-rw-r--r--include/linux/phy.h5
-rw-r--r--include/linux/pid.h8
-rw-r--r--include/linux/pid_namespace.h8
-rw-r--r--include/linux/pkt_cls.h1
-rw-r--r--include/linux/pkt_sched.h29
-rw-r--r--include/linux/platform_device.h1
-rw-r--r--include/linux/pm.h417
-rw-r--r--include/linux/pm_legacy.h35
-rw-r--r--include/linux/pm_wakeup.h28
-rw-r--r--include/linux/pnp.h146
-rw-r--r--include/linux/ppp-comp.h2
-rw-r--r--include/linux/ppp_defs.h2
-rw-r--r--include/linux/preempt.h34
-rw-r--r--include/linux/proc_fs.h13
-rw-r--r--include/linux/profile.h58
-rw-r--r--include/linux/ptrace.h80
-rw-r--r--include/linux/pwm.h31
-rw-r--r--include/linux/pwm_backlight.h17
-rw-r--r--include/linux/quota.h33
-rw-r--r--include/linux/quotaops.h281
-rw-r--r--include/linux/radix-tree.h12
-rw-r--r--include/linux/raid/bitmap.h2
-rw-r--r--include/linux/raid/linear.h2
-rw-r--r--include/linux/raid/md.h4
-rw-r--r--include/linux/raid/md_k.h24
-rw-r--r--include/linux/raid/md_p.h3
-rw-r--r--include/linux/raid/raid5.h64
-rw-r--r--include/linux/ratelimit.h27
-rw-r--r--include/linux/rcuclassic.h3
-rw-r--r--include/linux/rculist.h401
-rw-r--r--include/linux/rcupdate.h38
-rw-r--r--include/linux/rcupreempt.h47
-rw-r--r--include/linux/reiserfs_fs.h4
-rw-r--r--include/linux/reiserfs_fs_sb.h6
-rw-r--r--include/linux/reiserfs_xattr.h2
-rw-r--r--include/linux/relay.h5
-rw-r--r--include/linux/res_counter.h33
-rw-r--r--include/linux/resume-trace.h2
-rw-r--r--include/linux/rfkill.h46
-rw-r--r--include/linux/rmap.h8
-rw-r--r--include/linux/rtc.h19
-rw-r--r--include/linux/rtnetlink.h13
-rw-r--r--include/linux/scatterlist.h38
-rw-r--r--include/linux/sched.h224
-rw-r--r--include/linux/securebits.h15
-rw-r--r--include/linux/security.h58
-rw-r--r--include/linux/sem.h30
-rw-r--r--include/linux/semaphore.h6
-rw-r--r--include/linux/seq_file_net.h3
-rw-r--r--include/linux/serial_core.h31
-rw-r--r--include/linux/serio.h7
-rw-r--r--include/linux/shmem_fs.h2
-rw-r--r--include/linux/signalfd.h6
-rw-r--r--include/linux/skbuff.h27
-rw-r--r--include/linux/slab.h18
-rw-r--r--include/linux/slub_def.h6
-rw-r--r--include/linux/sm501.h43
-rw-r--r--include/linux/smb_fs.h19
-rw-r--r--include/linux/smc911x.h12
-rw-r--r--include/linux/smc91x.h12
-rw-r--r--include/linux/smp.h41
-rw-r--r--include/linux/smp_lock.h13
-rw-r--r--include/linux/socket.h10
-rw-r--r--include/linux/sonet.h2
-rw-r--r--include/linux/spi/ds1305.h35
-rw-r--r--include/linux/spi/max7301.h9
-rw-r--r--include/linux/spi/mcp23s08.h25
-rw-r--r--include/linux/spi/mmc_spi.h11
-rw-r--r--include/linux/spi/spi.h16
-rw-r--r--include/linux/spinlock.h72
-rw-r--r--include/linux/ssb/ssb.h144
-rw-r--r--include/linux/ssb/ssb_driver_gige.h2
-rw-r--r--include/linux/stallion.h6
-rw-r--r--include/linux/stop_machine.h50
-rw-r--r--include/linux/string.h3
-rw-r--r--include/linux/sunrpc/auth_gss.h2
-rw-r--r--include/linux/sunrpc/clnt.h7
-rw-r--r--include/linux/sunrpc/gss_api.h2
-rw-r--r--include/linux/sunrpc/gss_krb5.h3
-rw-r--r--include/linux/sunrpc/sched.h1
-rw-r--r--include/linux/sunrpc/svc.h7
-rw-r--r--include/linux/sunrpc/svc_rdma.h44
-rw-r--r--include/linux/sunrpc/svcauth_gss.h3
-rw-r--r--include/linux/suspend.h16
-rw-r--r--include/linux/swap.h3
-rw-r--r--include/linux/synclink.h1
-rw-r--r--include/linux/syscalls.h9
-rw-r--r--include/linux/sysctl.h25
-rw-r--r--include/linux/sysdev.h39
-rw-r--r--include/linux/sysfs.h16
-rw-r--r--include/linux/task_io_accounting.h18
-rw-r--r--include/linux/task_io_accounting_ops.h46
-rw-r--r--include/linux/taskstats.h6
-rw-r--r--include/linux/tcp.h65
-rw-r--r--include/linux/textsearch.h13
-rw-r--r--include/linux/thermal.h6
-rw-r--r--include/linux/tick.h5
-rw-r--r--include/linux/time.h16
-rw-r--r--include/linux/timerfd.h6
-rw-r--r--include/linux/tipc_config.h10
-rw-r--r--include/linux/topology.h17
-rw-r--r--include/linux/tracehook.h576
-rw-r--r--include/linux/tty.h215
-rw-r--r--include/linux/tty_driver.h19
-rw-r--r--include/linux/tty_ldisc.h7
-rw-r--r--include/linux/typecheck.h24
-rw-r--r--include/linux/types.h4
-rw-r--r--include/linux/udp.h6
-rw-r--r--include/linux/uio_driver.h8
-rw-r--r--include/linux/usb.h12
-rw-r--r--include/linux/usb/association.h150
-rw-r--r--include/linux/usb/cdc.h9
-rw-r--r--include/linux/usb/composite.h338
-rw-r--r--include/linux/usb/gadget.h27
-rw-r--r--include/linux/usb/irda.h151
-rw-r--r--include/linux/usb/rndis_host.h3
-rw-r--r--include/linux/usb/serial.h56
-rw-r--r--include/linux/usbdevice_fs.h2
-rw-r--r--include/linux/vermagic.h8
-rw-r--r--include/linux/videodev.h15
-rw-r--r--include/linux/videodev2.h396
-rw-r--r--include/linux/videotext.h16
-rw-r--r--include/linux/virtio_9p.h2
-rw-r--r--include/linux/virtio_balloon.h2
-rw-r--r--include/linux/virtio_blk.h14
-rw-r--r--include/linux/virtio_config.h22
-rw-r--r--include/linux/virtio_console.h2
-rw-r--r--include/linux/virtio_net.h4
-rw-r--r--include/linux/virtio_pci.h5
-rw-r--r--include/linux/virtio_ring.h2
-rw-r--r--include/linux/virtio_rng.h10
-rw-r--r--include/linux/vmstat.h6
-rw-r--r--include/linux/vt_kern.h19
-rw-r--r--include/linux/wanrouter.h2
-rw-r--r--include/linux/wireless.h30
-rw-r--r--include/linux/wm97xx.h1
-rw-r--r--include/linux/workqueue.h5
-rw-r--r--include/linux/writeback.h3
-rw-r--r--include/linux/xfrm.h1
398 files changed, 10145 insertions, 3395 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index b7d81b2a904..4c4142c5aa6 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -92,7 +92,6 @@ header-y += if_slip.h
92header-y += if_strip.h 92header-y += if_strip.h
93header-y += if_tun.h 93header-y += if_tun.h
94header-y += if_tunnel.h 94header-y += if_tunnel.h
95header-y += in6.h
96header-y += in_route.h 95header-y += in_route.h
97header-y += ioctl.h 96header-y += ioctl.h
98header-y += ip6_tunnel.h 97header-y += ip6_tunnel.h
@@ -105,7 +104,6 @@ header-y += ixjuser.h
105header-y += jffs2.h 104header-y += jffs2.h
106header-y += keyctl.h 105header-y += keyctl.h
107header-y += limits.h 106header-y += limits.h
108header-y += dlm_plock.h
109header-y += magic.h 107header-y += magic.h
110header-y += major.h 108header-y += major.h
111header-y += matroxfb.h 109header-y += matroxfb.h
@@ -168,6 +166,9 @@ unifdef-y += acct.h
168unifdef-y += adb.h 166unifdef-y += adb.h
169unifdef-y += adfs_fs.h 167unifdef-y += adfs_fs.h
170unifdef-y += agpgart.h 168unifdef-y += agpgart.h
169ifneq ($(wildcard $(srctree)/include/asm-$(SRCARCH)/a.out.h),)
170unifdef-y += a.out.h
171endif
171unifdef-y += apm_bios.h 172unifdef-y += apm_bios.h
172unifdef-y += atalk.h 173unifdef-y += atalk.h
173unifdef-y += atmdev.h 174unifdef-y += atmdev.h
@@ -188,8 +189,8 @@ unifdef-y += connector.h
188unifdef-y += cuda.h 189unifdef-y += cuda.h
189unifdef-y += cyclades.h 190unifdef-y += cyclades.h
190unifdef-y += dccp.h 191unifdef-y += dccp.h
191unifdef-y += dirent.h
192unifdef-y += dlm.h 192unifdef-y += dlm.h
193unifdef-y += dlm_plock.h
193unifdef-y += edd.h 194unifdef-y += edd.h
194unifdef-y += elf.h 195unifdef-y += elf.h
195unifdef-y += elfcore.h 196unifdef-y += elfcore.h
@@ -236,6 +237,7 @@ unifdef-y += if_vlan.h
236unifdef-y += igmp.h 237unifdef-y += igmp.h
237unifdef-y += inet_diag.h 238unifdef-y += inet_diag.h
238unifdef-y += in.h 239unifdef-y += in.h
240unifdef-y += in6.h
239unifdef-y += inotify.h 241unifdef-y += inotify.h
240unifdef-y += input.h 242unifdef-y += input.h
241unifdef-y += ip.h 243unifdef-y += ip.h
@@ -253,7 +255,9 @@ unifdef-y += kd.h
253unifdef-y += kernelcapi.h 255unifdef-y += kernelcapi.h
254unifdef-y += kernel.h 256unifdef-y += kernel.h
255unifdef-y += keyboard.h 257unifdef-y += keyboard.h
258ifneq ($(wildcard $(srctree)/include/asm-$(SRCARCH)/kvm.h),)
256unifdef-y += kvm.h 259unifdef-y += kvm.h
260endif
257unifdef-y += llc.h 261unifdef-y += llc.h
258unifdef-y += loop.h 262unifdef-y += loop.h
259unifdef-y += lp.h 263unifdef-y += lp.h
diff --git a/include/linux/a.out.h b/include/linux/a.out.h
index 208f4e8ed30..e86dfca4458 100644
--- a/include/linux/a.out.h
+++ b/include/linux/a.out.h
@@ -1,8 +1,6 @@
1#ifndef __A_OUT_GNU_H__ 1#ifndef __A_OUT_GNU_H__
2#define __A_OUT_GNU_H__ 2#define __A_OUT_GNU_H__
3 3
4#ifdef CONFIG_ARCH_SUPPORTS_AOUT
5
6#define __GNU_EXEC_MACROS__ 4#define __GNU_EXEC_MACROS__
7 5
8#ifndef __STRUCT_EXEC_OVERRIDE__ 6#ifndef __STRUCT_EXEC_OVERRIDE__
@@ -277,10 +275,4 @@ struct relocation_info
277#endif /* no N_RELOCATION_INFO_DECLARED. */ 275#endif /* no N_RELOCATION_INFO_DECLARED. */
278 276
279#endif /*__ASSEMBLY__ */ 277#endif /*__ASSEMBLY__ */
280#else /* CONFIG_ARCH_SUPPORTS_AOUT */
281#ifndef __ASSEMBLY__
282struct exec {
283};
284#endif
285#endif /* CONFIG_ARCH_SUPPORTS_AOUT */
286#endif /* __A_OUT_GNU_H__ */ 278#endif /* __A_OUT_GNU_H__ */
diff --git a/include/linux/acct.h b/include/linux/acct.h
index e8cae54e8d8..882dc724876 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -120,17 +120,20 @@ struct acct_v3
120struct vfsmount; 120struct vfsmount;
121struct super_block; 121struct super_block;
122struct pacct_struct; 122struct pacct_struct;
123struct pid_namespace;
123extern void acct_auto_close_mnt(struct vfsmount *m); 124extern void acct_auto_close_mnt(struct vfsmount *m);
124extern void acct_auto_close(struct super_block *sb); 125extern void acct_auto_close(struct super_block *sb);
125extern void acct_init_pacct(struct pacct_struct *pacct); 126extern void acct_init_pacct(struct pacct_struct *pacct);
126extern void acct_collect(long exitcode, int group_dead); 127extern void acct_collect(long exitcode, int group_dead);
127extern void acct_process(void); 128extern void acct_process(void);
129extern void acct_exit_ns(struct pid_namespace *);
128#else 130#else
129#define acct_auto_close_mnt(x) do { } while (0) 131#define acct_auto_close_mnt(x) do { } while (0)
130#define acct_auto_close(x) do { } while (0) 132#define acct_auto_close(x) do { } while (0)
131#define acct_init_pacct(x) do { } while (0) 133#define acct_init_pacct(x) do { } while (0)
132#define acct_collect(x,y) do { } while (0) 134#define acct_collect(x,y) do { } while (0)
133#define acct_process() do { } while (0) 135#define acct_process() do { } while (0)
136#define acct_exit_ns(ns) do { } while (0)
134#endif 137#endif
135 138
136/* 139/*
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 41f7ce7edd7..702f79dad16 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -82,6 +82,7 @@ char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
82int early_acpi_boot_init(void); 82int early_acpi_boot_init(void);
83int acpi_boot_init (void); 83int acpi_boot_init (void);
84int acpi_boot_table_init (void); 84int acpi_boot_table_init (void);
85int acpi_mps_check (void);
85int acpi_numa_init (void); 86int acpi_numa_init (void);
86 87
87int acpi_table_init (void); 88int acpi_table_init (void);
@@ -234,6 +235,10 @@ int acpi_check_region(resource_size_t start, resource_size_t n,
234int acpi_check_mem_region(resource_size_t start, resource_size_t n, 235int acpi_check_mem_region(resource_size_t start, resource_size_t n,
235 const char *name); 236 const char *name);
236 237
238#ifdef CONFIG_PM_SLEEP
239void __init acpi_no_s4_hw_signature(void);
240void __init acpi_old_suspend_ordering(void);
241#endif /* CONFIG_PM_SLEEP */
237#else /* CONFIG_ACPI */ 242#else /* CONFIG_ACPI */
238 243
239static inline int early_acpi_boot_init(void) 244static inline int early_acpi_boot_init(void)
@@ -250,6 +255,11 @@ static inline int acpi_boot_table_init(void)
250 return 0; 255 return 0;
251} 256}
252 257
258static inline int acpi_mps_check(void)
259{
260 return 0;
261}
262
253static inline int acpi_check_resource_conflict(struct resource *res) 263static inline int acpi_check_resource_conflict(struct resource *res)
254{ 264{
255 return 0; 265 return 0;
diff --git a/include/linux/adb.h b/include/linux/adb.h
index 64d8878e144..63bca502fa5 100644
--- a/include/linux/adb.h
+++ b/include/linux/adb.h
@@ -84,7 +84,6 @@ enum adb_message {
84 ADB_MSG_PRE_RESET, /* Called before resetting the bus */ 84 ADB_MSG_PRE_RESET, /* Called before resetting the bus */
85 ADB_MSG_POST_RESET /* Called after resetting the bus (re-do init & register) */ 85 ADB_MSG_POST_RESET /* Called after resetting the bus (re-do init & register) */
86}; 86};
87extern struct adb_driver *adb_controller;
88extern struct blocking_notifier_head adb_client_list; 87extern struct blocking_notifier_head adb_client_list;
89 88
90int adb_request(struct adb_request *req, void (*done)(struct adb_request *), 89int adb_request(struct adb_request *req, void (*done)(struct adb_request *),
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h
index 661d90d6cf7..972b12bcfb3 100644
--- a/include/linux/agp_backend.h
+++ b/include/linux/agp_backend.h
@@ -30,14 +30,6 @@
30#ifndef _AGP_BACKEND_H 30#ifndef _AGP_BACKEND_H
31#define _AGP_BACKEND_H 1 31#define _AGP_BACKEND_H 1
32 32
33#ifndef TRUE
34#define TRUE 1
35#endif
36
37#ifndef FALSE
38#define FALSE 0
39#endif
40
41enum chipset_type { 33enum chipset_type {
42 NOT_SUPPORTED, 34 NOT_SUPPORTED,
43 SUPPORTED, 35 SUPPORTED,
@@ -57,7 +49,7 @@ struct agp_kern_info {
57 size_t aper_size; 49 size_t aper_size;
58 int max_memory; /* In pages */ 50 int max_memory; /* In pages */
59 int current_memory; 51 int current_memory;
60 int cant_use_aperture; 52 bool cant_use_aperture;
61 unsigned long page_mask; 53 unsigned long page_mask;
62 struct vm_operations_struct *vm_ops; 54 struct vm_operations_struct *vm_ops;
63}; 55};
@@ -83,9 +75,9 @@ struct agp_memory {
83 off_t pg_start; 75 off_t pg_start;
84 u32 type; 76 u32 type;
85 u32 physical; 77 u32 physical;
86 u8 is_bound; 78 bool is_bound;
87 u8 is_flushed; 79 bool is_flushed;
88 u8 vmalloc_flag; 80 bool vmalloc_flag;
89}; 81};
90 82
91#define AGP_NORMAL_MEMORY 0 83#define AGP_NORMAL_MEMORY 0
diff --git a/include/linux/agpgart.h b/include/linux/agpgart.h
index 62aef589eb9..c8fdb6e658e 100644
--- a/include/linux/agpgart.h
+++ b/include/linux/agpgart.h
@@ -206,8 +206,8 @@ struct agp_front_data {
206 struct agp_controller *current_controller; 206 struct agp_controller *current_controller;
207 struct agp_controller *controllers; 207 struct agp_controller *controllers;
208 struct agp_file_private *file_priv_list; 208 struct agp_file_private *file_priv_list;
209 u8 used_by_controller; 209 bool used_by_controller;
210 u8 backend_acquired; 210 bool backend_acquired;
211}; 211};
212 212
213#endif /* __KERNEL__ */ 213#endif /* __KERNEL__ */
diff --git a/include/linux/aio.h b/include/linux/aio.h
index b51ddd28444..09b276c3522 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -7,7 +7,6 @@
7#include <linux/uio.h> 7#include <linux/uio.h>
8 8
9#include <asm/atomic.h> 9#include <asm/atomic.h>
10#include <linux/uio.h>
11 10
12#define AIO_MAXSEGS 4 11#define AIO_MAXSEGS 4
13#define AIO_KIOGRP_NR_ATOMIC 8 12#define AIO_KIOGRP_NR_ATOMIC 8
diff --git a/include/linux/anon_inodes.h b/include/linux/anon_inodes.h
index 6129e58ca7c..e0a0cdc2da4 100644
--- a/include/linux/anon_inodes.h
+++ b/include/linux/anon_inodes.h
@@ -9,7 +9,7 @@
9#define _LINUX_ANON_INODES_H 9#define _LINUX_ANON_INODES_H
10 10
11int anon_inode_getfd(const char *name, const struct file_operations *fops, 11int anon_inode_getfd(const char *name, const struct file_operations *fops,
12 void *priv); 12 void *priv, int flags);
13 13
14#endif /* _LINUX_ANON_INODES_H */ 14#endif /* _LINUX_ANON_INODES_H */
15 15
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index eb640f0acfa..0f50d4cc436 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -101,21 +101,14 @@ async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx,
101 101
102/** 102/**
103 * async_tx_sync_epilog - actions to take if an operation is run synchronously 103 * async_tx_sync_epilog - actions to take if an operation is run synchronously
104 * @flags: async_tx flags
105 * @depend_tx: transaction depends on depend_tx
106 * @cb_fn: function to call when the transaction completes 104 * @cb_fn: function to call when the transaction completes
107 * @cb_fn_param: parameter to pass to the callback routine 105 * @cb_fn_param: parameter to pass to the callback routine
108 */ 106 */
109static inline void 107static inline void
110async_tx_sync_epilog(unsigned long flags, 108async_tx_sync_epilog(dma_async_tx_callback cb_fn, void *cb_fn_param)
111 struct dma_async_tx_descriptor *depend_tx,
112 dma_async_tx_callback cb_fn, void *cb_fn_param)
113{ 109{
114 if (cb_fn) 110 if (cb_fn)
115 cb_fn(cb_fn_param); 111 cb_fn(cb_fn_param);
116
117 if (depend_tx && (flags & ASYNC_TX_DEP_ACK))
118 async_tx_ack(depend_tx);
119} 112}
120 113
121void 114void
@@ -152,4 +145,6 @@ struct dma_async_tx_descriptor *
152async_trigger_callback(enum async_tx_flags flags, 145async_trigger_callback(enum async_tx_flags flags,
153 struct dma_async_tx_descriptor *depend_tx, 146 struct dma_async_tx_descriptor *depend_tx,
154 dma_async_tx_callback cb_fn, void *cb_fn_param); 147 dma_async_tx_callback cb_fn, void *cb_fn_param);
148
149void async_tx_quiesce(struct dma_async_tx_descriptor **tx);
155#endif /* _ASYNC_TX_H_ */ 150#endif /* _ASYNC_TX_H_ */
diff --git a/include/linux/atm.h b/include/linux/atm.h
index 60136684e0a..c791ddd9693 100644
--- a/include/linux/atm.h
+++ b/include/linux/atm.h
@@ -16,14 +16,11 @@
16 * documentation. Do not change them. 16 * documentation. Do not change them.
17 */ 17 */
18 18
19#ifdef __KERNEL__
20#include <linux/socket.h>
21#include <linux/types.h>
22#endif
23#include <linux/compiler.h> 19#include <linux/compiler.h>
24#include <linux/atmapi.h> 20#include <linux/atmapi.h>
25#include <linux/atmsap.h> 21#include <linux/atmsap.h>
26#include <linux/atmioc.h> 22#include <linux/atmioc.h>
23#include <linux/types.h>
27 24
28 25
29/* general ATM constants */ 26/* general ATM constants */
@@ -212,7 +209,7 @@ struct sockaddr_atmsvc {
212 char pub[ATM_E164_LEN+1]; /* public address (E.164) */ 209 char pub[ATM_E164_LEN+1]; /* public address (E.164) */
213 /* unused addresses must be bzero'ed */ 210 /* unused addresses must be bzero'ed */
214 char lij_type; /* role in LIJ call; one of ATM_LIJ* */ 211 char lij_type; /* role in LIJ call; one of ATM_LIJ* */
215 uint32_t lij_id; /* LIJ call identifier */ 212 __u32 lij_id; /* LIJ call identifier */
216 } sas_addr __ATM_API_ALIGN; /* SVC address */ 213 } sas_addr __ATM_API_ALIGN; /* SVC address */
217}; 214};
218 215
diff --git a/include/linux/atm_tcp.h b/include/linux/atm_tcp.h
index 18787f9b2f1..375638f8554 100644
--- a/include/linux/atm_tcp.h
+++ b/include/linux/atm_tcp.h
@@ -8,11 +8,9 @@
8#define LINUX_ATM_TCP_H 8#define LINUX_ATM_TCP_H
9 9
10#include <linux/atmapi.h> 10#include <linux/atmapi.h>
11 11#include <linux/atm.h>
12#ifdef __KERNEL__
13#include <linux/types.h>
14#endif
15#include <linux/atmioc.h> 12#include <linux/atmioc.h>
13#include <linux/types.h>
16 14
17 15
18/* 16/*
@@ -20,9 +18,9 @@
20 */ 18 */
21 19
22struct atmtcp_hdr { 20struct atmtcp_hdr {
23 uint16_t vpi; 21 __u16 vpi;
24 uint16_t vci; 22 __u16 vci;
25 uint32_t length; /* ... of data part */ 23 __u32 length; /* ... of data part */
26}; 24};
27 25
28/* 26/*
diff --git a/include/linux/atmel-pwm-bl.h b/include/linux/atmel-pwm-bl.h
new file mode 100644
index 00000000000..0153a47806c
--- /dev/null
+++ b/include/linux/atmel-pwm-bl.h
@@ -0,0 +1,43 @@
1/*
2 * Copyright (C) 2007 Atmel Corporation
3 *
4 * Driver for the AT32AP700X PS/2 controller (PSIF).
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 version 2 as published
8 * by the Free Software Foundation.
9 */
10
11#ifndef __INCLUDE_ATMEL_PWM_BL_H
12#define __INCLUDE_ATMEL_PWM_BL_H
13
14/**
15 * struct atmel_pwm_bl_platform_data
16 * @pwm_channel: which PWM channel in the PWM module to use.
17 * @pwm_frequency: PWM frequency to generate, the driver will try to be as
18 * close as the prescaler allows.
19 * @pwm_compare_max: value to use in the PWM channel compare register.
20 * @pwm_duty_max: maximum duty cycle value, must be less than or equal to
21 * pwm_compare_max.
22 * @pwm_duty_min: minimum duty cycle value, must be less than pwm_duty_max.
23 * @pwm_active_low: set to one if the low part of the PWM signal increases the
24 * brightness of the backlight.
25 * @gpio_on: GPIO line to control the backlight on/off, set to -1 if not used.
26 * @on_active_low: set to one if the on/off signal is on when GPIO is low.
27 *
28 * This struct must be added to the platform device in the board code. It is
29 * used by the atmel-pwm-bl driver to setup the GPIO to control on/off and the
30 * PWM device.
31 */
32struct atmel_pwm_bl_platform_data {
33 unsigned int pwm_channel;
34 unsigned int pwm_frequency;
35 unsigned int pwm_compare_max;
36 unsigned int pwm_duty_max;
37 unsigned int pwm_duty_min;
38 unsigned int pwm_active_low;
39 int gpio_on;
40 unsigned int on_active_low;
41};
42
43#endif /* __INCLUDE_ATMEL_PWM_BL_H */
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 63c3bb98558..6272a395d43 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -286,7 +286,6 @@
286#define AUDIT_ARCH_SHEL64 (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 286#define AUDIT_ARCH_SHEL64 (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
287#define AUDIT_ARCH_SPARC (EM_SPARC) 287#define AUDIT_ARCH_SPARC (EM_SPARC)
288#define AUDIT_ARCH_SPARC64 (EM_SPARCV9|__AUDIT_ARCH_64BIT) 288#define AUDIT_ARCH_SPARC64 (EM_SPARCV9|__AUDIT_ARCH_64BIT)
289#define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE)
290#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 289#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
291 290
292#define AUDIT_PERM_EXEC 1 291#define AUDIT_PERM_EXEC 1
@@ -571,7 +570,7 @@ extern void audit_log_lost(const char *message);
571extern int audit_update_lsm_rules(void); 570extern int audit_update_lsm_rules(void);
572 571
573 /* Private API (for audit.c only) */ 572 /* Private API (for audit.c only) */
574extern int audit_filter_user(struct netlink_skb_parms *cb, int type); 573extern int audit_filter_user(struct netlink_skb_parms *cb);
575extern int audit_filter_type(int type); 574extern int audit_filter_type(int type);
576extern int audit_receive_filter(int type, int pid, int uid, int seq, 575extern int audit_receive_filter(int type, int pid, int uid, int seq,
577 void *data, size_t datasz, uid_t loginuid, 576 void *data, size_t datasz, uid_t loginuid,
diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h
index 31a29541b50..b785c6f8644 100644
--- a/include/linux/auto_fs4.h
+++ b/include/linux/auto_fs4.h
@@ -98,8 +98,6 @@ union autofs_v5_packet_union {
98#define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI 98#define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI
99#define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI 99#define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI
100#define AUTOFS_IOC_PROTOSUBVER _IOR(0x93,0x67,int) 100#define AUTOFS_IOC_PROTOSUBVER _IOR(0x93,0x67,int)
101#define AUTOFS_IOC_ASKREGHOST _IOR(0x93,0x68,int)
102#define AUTOFS_IOC_TOGGLEREGHOST _IOR(0x93,0x69,int)
103#define AUTOFS_IOC_ASKUMOUNT _IOR(0x93,0x70,int) 101#define AUTOFS_IOC_ASKUMOUNT _IOR(0x93,0x70,int)
104 102
105 103
diff --git a/include/linux/auxvec.h b/include/linux/auxvec.h
index ad895455ab7..d7afa9dd663 100644
--- a/include/linux/auxvec.h
+++ b/include/linux/auxvec.h
@@ -26,8 +26,14 @@
26 26
27#define AT_SECURE 23 /* secure mode boolean */ 27#define AT_SECURE 23 /* secure mode boolean */
28 28
29#define AT_BASE_PLATFORM 24 /* string identifying real platform, may
30 * differ from AT_PLATFORM. */
31
32#define AT_EXECFN 31 /* filename of program */
33
29#ifdef __KERNEL__ 34#ifdef __KERNEL__
30#define AT_VECTOR_SIZE_BASE (14 + 2) /* NEW_AUX_ENT entries in auxiliary table */ 35#define AT_VECTOR_SIZE_BASE 18 /* NEW_AUX_ENT entries in auxiliary table */
36 /* number of "#define AT_.*" above, minus {AT_NULL, AT_IGNORE, AT_NOTELF} */
31#endif 37#endif
32 38
33#endif /* _LINUX_AUXVEC_H */ 39#endif /* _LINUX_AUXVEC_H */
diff --git a/include/linux/bcd.h b/include/linux/bcd.h
index c545308125b..7ac518e3c15 100644
--- a/include/linux/bcd.h
+++ b/include/linux/bcd.h
@@ -10,8 +10,13 @@
10#ifndef _BCD_H 10#ifndef _BCD_H
11#define _BCD_H 11#define _BCD_H
12 12
13#define BCD2BIN(val) (((val) & 0x0f) + ((val)>>4)*10) 13#include <linux/compiler.h>
14#define BIN2BCD(val) ((((val)/10)<<4) + (val)%10) 14
15unsigned bcd2bin(unsigned char val) __attribute_const__;
16unsigned char bin2bcd(unsigned val) __attribute_const__;
17
18#define BCD2BIN(val) bcd2bin(val)
19#define BIN2BCD(val) bin2bcd(val)
15 20
16/* backwards compat */ 21/* backwards compat */
17#define BCD_TO_BIN(val) ((val)=BCD2BIN(val)) 22#define BCD_TO_BIN(val) ((val)=BCD2BIN(val))
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index b512e48f6d8..826f6235080 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -38,7 +38,7 @@ struct linux_binprm{
38 misc_bang:1; 38 misc_bang:1;
39 struct file * file; 39 struct file * file;
40 int e_uid, e_gid; 40 int e_uid, e_gid;
41 kernel_cap_t cap_inheritable, cap_permitted; 41 kernel_cap_t cap_post_exec_permitted;
42 bool cap_effective; 42 bool cap_effective;
43 void *security; 43 void *security;
44 int argc, envc; 44 int argc, envc;
@@ -99,6 +99,7 @@ extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
99extern void compute_creds(struct linux_binprm *binprm); 99extern void compute_creds(struct linux_binprm *binprm);
100extern int do_coredump(long signr, int exit_code, struct pt_regs * regs); 100extern int do_coredump(long signr, int exit_code, struct pt_regs * regs);
101extern int set_binfmt(struct linux_binfmt *new); 101extern int set_binfmt(struct linux_binfmt *new);
102extern void free_bprm(struct linux_binprm *);
102 103
103#endif /* __KERNEL__ */ 104#endif /* __KERNEL__ */
104#endif /* _LINUX_BINFMTS_H */ 105#endif /* _LINUX_BINFMTS_H */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 61c15eaf3fb..0933a14e641 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -64,6 +64,7 @@ struct bio_vec {
64 64
65struct bio_set; 65struct bio_set;
66struct bio; 66struct bio;
67struct bio_integrity_payload;
67typedef void (bio_end_io_t) (struct bio *, int); 68typedef void (bio_end_io_t) (struct bio *, int);
68typedef void (bio_destructor_t) (struct bio *); 69typedef void (bio_destructor_t) (struct bio *);
69 70
@@ -112,6 +113,9 @@ struct bio {
112 atomic_t bi_cnt; /* pin count */ 113 atomic_t bi_cnt; /* pin count */
113 114
114 void *bi_private; 115 void *bi_private;
116#if defined(CONFIG_BLK_DEV_INTEGRITY)
117 struct bio_integrity_payload *bi_integrity; /* data integrity */
118#endif
115 119
116 bio_destructor_t *bi_destructor; /* destructor */ 120 bio_destructor_t *bi_destructor; /* destructor */
117}; 121};
@@ -271,6 +275,29 @@ static inline void *bio_data(struct bio *bio)
271 */ 275 */
272#define bio_get(bio) atomic_inc(&(bio)->bi_cnt) 276#define bio_get(bio) atomic_inc(&(bio)->bi_cnt)
273 277
278#if defined(CONFIG_BLK_DEV_INTEGRITY)
279/*
280 * bio integrity payload
281 */
282struct bio_integrity_payload {
283 struct bio *bip_bio; /* parent bio */
284 struct bio_vec *bip_vec; /* integrity data vector */
285
286 sector_t bip_sector; /* virtual start sector */
287
288 void *bip_buf; /* generated integrity data */
289 bio_end_io_t *bip_end_io; /* saved I/O completion fn */
290
291 int bip_error; /* saved I/O error */
292 unsigned int bip_size;
293
294 unsigned short bip_pool; /* pool the ivec came from */
295 unsigned short bip_vcnt; /* # of integrity bio_vecs */
296 unsigned short bip_idx; /* current bip_vec index */
297
298 struct work_struct bip_work; /* I/O completion */
299};
300#endif /* CONFIG_BLK_DEV_INTEGRITY */
274 301
275/* 302/*
276 * A bio_pair is used when we need to split a bio. 303 * A bio_pair is used when we need to split a bio.
@@ -283,10 +310,14 @@ static inline void *bio_data(struct bio *bio)
283 * in bio2.bi_private 310 * in bio2.bi_private
284 */ 311 */
285struct bio_pair { 312struct bio_pair {
286 struct bio bio1, bio2; 313 struct bio bio1, bio2;
287 struct bio_vec bv1, bv2; 314 struct bio_vec bv1, bv2;
288 atomic_t cnt; 315#if defined(CONFIG_BLK_DEV_INTEGRITY)
289 int error; 316 struct bio_integrity_payload bip1, bip2;
317 struct bio_vec iv1, iv2;
318#endif
319 atomic_t cnt;
320 int error;
290}; 321};
291extern struct bio_pair *bio_split(struct bio *bi, mempool_t *pool, 322extern struct bio_pair *bio_split(struct bio *bi, mempool_t *pool,
292 int first_sectors); 323 int first_sectors);
@@ -333,6 +364,39 @@ extern struct bio *bio_copy_user_iov(struct request_queue *, struct sg_iovec *,
333 int, int); 364 int, int);
334extern int bio_uncopy_user(struct bio *); 365extern int bio_uncopy_user(struct bio *);
335void zero_fill_bio(struct bio *bio); 366void zero_fill_bio(struct bio *bio);
367extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *);
368extern unsigned int bvec_nr_vecs(unsigned short idx);
369
370/*
371 * bio_set is used to allow other portions of the IO system to
372 * allocate their own private memory pools for bio and iovec structures.
373 * These memory pools in turn all allocate from the bio_slab
374 * and the bvec_slabs[].
375 */
376#define BIO_POOL_SIZE 2
377#define BIOVEC_NR_POOLS 6
378
379struct bio_set {
380 mempool_t *bio_pool;
381#if defined(CONFIG_BLK_DEV_INTEGRITY)
382 mempool_t *bio_integrity_pool;
383#endif
384 mempool_t *bvec_pools[BIOVEC_NR_POOLS];
385};
386
387struct biovec_slab {
388 int nr_vecs;
389 char *name;
390 struct kmem_cache *slab;
391};
392
393extern struct bio_set *fs_bio_set;
394
395/*
396 * a small number of entries is fine, not going to be performance critical.
397 * basically we just need to survive
398 */
399#define BIO_SPLIT_ENTRIES 2
336 400
337#ifdef CONFIG_HIGHMEM 401#ifdef CONFIG_HIGHMEM
338/* 402/*
@@ -381,5 +445,63 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
381 __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) 445 __bio_kmap_irq((bio), (bio)->bi_idx, (flags))
382#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) 446#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags)
383 447
448#if defined(CONFIG_BLK_DEV_INTEGRITY)
449
450#define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)]))
451#define bip_vec(bip) bip_vec_idx(bip, 0)
452
453#define __bip_for_each_vec(bvl, bip, i, start_idx) \
454 for (bvl = bip_vec_idx((bip), (start_idx)), i = (start_idx); \
455 i < (bip)->bip_vcnt; \
456 bvl++, i++)
457
458#define bip_for_each_vec(bvl, bip, i) \
459 __bip_for_each_vec(bvl, bip, i, (bip)->bip_idx)
460
461static inline int bio_integrity(struct bio *bio)
462{
463#if defined(CONFIG_BLK_DEV_INTEGRITY)
464 return bio->bi_integrity != NULL;
465#else
466 return 0;
467#endif
468}
469
470extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *);
471extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int);
472extern void bio_integrity_free(struct bio *, struct bio_set *);
473extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int);
474extern int bio_integrity_enabled(struct bio *bio);
475extern int bio_integrity_set_tag(struct bio *, void *, unsigned int);
476extern int bio_integrity_get_tag(struct bio *, void *, unsigned int);
477extern int bio_integrity_prep(struct bio *);
478extern void bio_integrity_endio(struct bio *, int);
479extern void bio_integrity_advance(struct bio *, unsigned int);
480extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int);
481extern void bio_integrity_split(struct bio *, struct bio_pair *, int);
482extern int bio_integrity_clone(struct bio *, struct bio *, struct bio_set *);
483extern int bioset_integrity_create(struct bio_set *, int);
484extern void bioset_integrity_free(struct bio_set *);
485extern void bio_integrity_init_slab(void);
486
487#else /* CONFIG_BLK_DEV_INTEGRITY */
488
489#define bio_integrity(a) (0)
490#define bioset_integrity_create(a, b) (0)
491#define bio_integrity_prep(a) (0)
492#define bio_integrity_enabled(a) (0)
493#define bio_integrity_clone(a, b, c) (0)
494#define bioset_integrity_free(a) do { } while (0)
495#define bio_integrity_free(a, b) do { } while (0)
496#define bio_integrity_endio(a, b) do { } while (0)
497#define bio_integrity_advance(a, b) do { } while (0)
498#define bio_integrity_trim(a, b, c) do { } while (0)
499#define bio_integrity_split(a, b, c) do { } while (0)
500#define bio_integrity_set_tag(a, b, c) do { } while (0)
501#define bio_integrity_get_tag(a, b, c) do { } while (0)
502#define bio_integrity_init_slab(a) do { } while (0)
503
504#endif /* CONFIG_BLK_DEV_INTEGRITY */
505
384#endif /* CONFIG_BLOCK */ 506#endif /* CONFIG_BLOCK */
385#endif /* __LINUX_BIO_H */ 507#endif /* __LINUX_BIO_H */
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 43b406def35..1abfe664c44 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -110,7 +110,6 @@ extern int __bitmap_weight(const unsigned long *bitmap, int bits);
110 110
111extern int bitmap_scnprintf(char *buf, unsigned int len, 111extern int bitmap_scnprintf(char *buf, unsigned int len,
112 const unsigned long *src, int nbits); 112 const unsigned long *src, int nbits);
113extern int bitmap_scnprintf_len(unsigned int len);
114extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user, 113extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user,
115 unsigned long *dst, int nbits); 114 unsigned long *dst, int nbits);
116extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen, 115extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen,
diff --git a/include/linux/bitrev.h b/include/linux/bitrev.h
index 05e540d6963..7ffe03f4693 100644
--- a/include/linux/bitrev.h
+++ b/include/linux/bitrev.h
@@ -10,6 +10,7 @@ static inline u8 bitrev8(u8 byte)
10 return byte_rev_table[byte]; 10 return byte_rev_table[byte];
11} 11}
12 12
13extern u16 bitrev16(u16 in);
13extern u32 bitrev32(u32 in); 14extern u32 bitrev32(u32 in);
14 15
15#endif /* _LINUX_BITREV_H */ 16#endif /* _LINUX_BITREV_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d2a1b71e93c..88d68081a0f 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -23,7 +23,6 @@
23struct scsi_ioctl_command; 23struct scsi_ioctl_command;
24 24
25struct request_queue; 25struct request_queue;
26typedef struct request_queue request_queue_t __deprecated;
27struct elevator_queue; 26struct elevator_queue;
28typedef struct elevator_queue elevator_t; 27typedef struct elevator_queue elevator_t;
29struct request_pm_state; 28struct request_pm_state;
@@ -34,12 +33,6 @@ struct sg_io_hdr;
34#define BLKDEV_MIN_RQ 4 33#define BLKDEV_MIN_RQ 4
35#define BLKDEV_MAX_RQ 128 /* Default maximum */ 34#define BLKDEV_MAX_RQ 128 /* Default maximum */
36 35
37int put_io_context(struct io_context *ioc);
38void exit_io_context(void);
39struct io_context *get_io_context(gfp_t gfp_flags, int node);
40struct io_context *alloc_io_context(gfp_t gfp_flags, int node);
41void copy_io_context(struct io_context **pdst, struct io_context **psrc);
42
43struct request; 36struct request;
44typedef void (rq_end_io_fn)(struct request *, int); 37typedef void (rq_end_io_fn)(struct request *, int);
45 38
@@ -113,6 +106,7 @@ enum rq_flag_bits {
113 __REQ_ALLOCED, /* request came from our alloc pool */ 106 __REQ_ALLOCED, /* request came from our alloc pool */
114 __REQ_RW_META, /* metadata io request */ 107 __REQ_RW_META, /* metadata io request */
115 __REQ_COPY_USER, /* contains copies of user pages */ 108 __REQ_COPY_USER, /* contains copies of user pages */
109 __REQ_INTEGRITY, /* integrity metadata has been remapped */
116 __REQ_NR_BITS, /* stops here */ 110 __REQ_NR_BITS, /* stops here */
117}; 111};
118 112
@@ -135,6 +129,7 @@ enum rq_flag_bits {
135#define REQ_ALLOCED (1 << __REQ_ALLOCED) 129#define REQ_ALLOCED (1 << __REQ_ALLOCED)
136#define REQ_RW_META (1 << __REQ_RW_META) 130#define REQ_RW_META (1 << __REQ_RW_META)
137#define REQ_COPY_USER (1 << __REQ_COPY_USER) 131#define REQ_COPY_USER (1 << __REQ_COPY_USER)
132#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
138 133
139#define BLK_MAX_CDB 16 134#define BLK_MAX_CDB 16
140 135
@@ -259,7 +254,14 @@ typedef int (prep_rq_fn) (struct request_queue *, struct request *);
259typedef void (unplug_fn) (struct request_queue *); 254typedef void (unplug_fn) (struct request_queue *);
260 255
261struct bio_vec; 256struct bio_vec;
262typedef int (merge_bvec_fn) (struct request_queue *, struct bio *, struct bio_vec *); 257struct bvec_merge_data {
258 struct block_device *bi_bdev;
259 sector_t bi_sector;
260 unsigned bi_size;
261 unsigned long bi_rw;
262};
263typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *,
264 struct bio_vec *);
263typedef void (prepare_flush_fn) (struct request_queue *, struct request *); 265typedef void (prepare_flush_fn) (struct request_queue *, struct request *);
264typedef void (softirq_done_fn)(struct request *); 266typedef void (softirq_done_fn)(struct request *);
265typedef int (dma_drain_needed_fn)(struct request *); 267typedef int (dma_drain_needed_fn)(struct request *);
@@ -426,6 +428,32 @@ static inline void queue_flag_set_unlocked(unsigned int flag,
426 __set_bit(flag, &q->queue_flags); 428 __set_bit(flag, &q->queue_flags);
427} 429}
428 430
431static inline int queue_flag_test_and_clear(unsigned int flag,
432 struct request_queue *q)
433{
434 WARN_ON_ONCE(!queue_is_locked(q));
435
436 if (test_bit(flag, &q->queue_flags)) {
437 __clear_bit(flag, &q->queue_flags);
438 return 1;
439 }
440
441 return 0;
442}
443
444static inline int queue_flag_test_and_set(unsigned int flag,
445 struct request_queue *q)
446{
447 WARN_ON_ONCE(!queue_is_locked(q));
448
449 if (!test_bit(flag, &q->queue_flags)) {
450 __set_bit(flag, &q->queue_flags);
451 return 0;
452 }
453
454 return 1;
455}
456
429static inline void queue_flag_set(unsigned int flag, struct request_queue *q) 457static inline void queue_flag_set(unsigned int flag, struct request_queue *q)
430{ 458{
431 WARN_ON_ONCE(!queue_is_locked(q)); 459 WARN_ON_ONCE(!queue_is_locked(q));
@@ -623,7 +651,6 @@ extern void generic_make_request(struct bio *bio);
623extern void blk_rq_init(struct request_queue *q, struct request *rq); 651extern void blk_rq_init(struct request_queue *q, struct request *rq);
624extern void blk_put_request(struct request *); 652extern void blk_put_request(struct request *);
625extern void __blk_put_request(struct request_queue *, struct request *); 653extern void __blk_put_request(struct request_queue *, struct request *);
626extern void blk_end_sync_rq(struct request *rq, int error);
627extern struct request *blk_get_request(struct request_queue *, int, gfp_t); 654extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
628extern void blk_insert_request(struct request_queue *, struct request *, int, void *); 655extern void blk_insert_request(struct request_queue *, struct request *, int, void *);
629extern void blk_requeue_request(struct request_queue *, struct request *); 656extern void blk_requeue_request(struct request_queue *, struct request *);
@@ -676,7 +703,6 @@ extern int blk_execute_rq(struct request_queue *, struct gendisk *,
676 struct request *, int); 703 struct request *, int);
677extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, 704extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
678 struct request *, int, rq_end_io_fn *); 705 struct request *, int, rq_end_io_fn *);
679extern int blk_verify_command(unsigned char *, int);
680extern void blk_unplug(struct request_queue *q); 706extern void blk_unplug(struct request_queue *q);
681 707
682static inline struct request_queue *bdev_get_queue(struct block_device *bdev) 708static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
@@ -749,6 +775,7 @@ extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
749extern void blk_queue_hardsect_size(struct request_queue *, unsigned short); 775extern void blk_queue_hardsect_size(struct request_queue *, unsigned short);
750extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); 776extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);
751extern void blk_queue_dma_pad(struct request_queue *, unsigned int); 777extern void blk_queue_dma_pad(struct request_queue *, unsigned int);
778extern void blk_queue_update_dma_pad(struct request_queue *, unsigned int);
752extern int blk_queue_dma_drain(struct request_queue *q, 779extern int blk_queue_dma_drain(struct request_queue *q,
753 dma_drain_needed_fn *dma_drain_needed, 780 dma_drain_needed_fn *dma_drain_needed,
754 void *buf, unsigned int size); 781 void *buf, unsigned int size);
@@ -802,6 +829,15 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
802 829
803extern int blkdev_issue_flush(struct block_device *, sector_t *); 830extern int blkdev_issue_flush(struct block_device *, sector_t *);
804 831
832/*
833* command filter functions
834*/
835extern int blk_verify_command(struct file *file, unsigned char *cmd);
836extern int blk_cmd_filter_verify_command(struct blk_scsi_cmd_filter *filter,
837 unsigned char *cmd, mode_t *f_mode);
838extern int blk_register_filter(struct gendisk *disk);
839extern void blk_unregister_filter(struct gendisk *disk);
840
805#define MAX_PHYS_SEGMENTS 128 841#define MAX_PHYS_SEGMENTS 128
806#define MAX_HW_SEGMENTS 128 842#define MAX_HW_SEGMENTS 128
807#define SAFE_MAX_SECTORS 255 843#define SAFE_MAX_SECTORS 255
@@ -865,28 +901,119 @@ void kblockd_flush_work(struct work_struct *work);
865#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \ 901#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \
866 MODULE_ALIAS("block-major-" __stringify(major) "-*") 902 MODULE_ALIAS("block-major-" __stringify(major) "-*")
867 903
904#if defined(CONFIG_BLK_DEV_INTEGRITY)
868 905
869#else /* CONFIG_BLOCK */ 906#define INTEGRITY_FLAG_READ 2 /* verify data integrity on read */
870/* 907#define INTEGRITY_FLAG_WRITE 4 /* generate data integrity on write */
871 * stubs for when the block layer is configured out
872 */
873#define buffer_heads_over_limit 0
874 908
875static inline long nr_blockdev_pages(void) 909struct blk_integrity_exchg {
910 void *prot_buf;
911 void *data_buf;
912 sector_t sector;
913 unsigned int data_size;
914 unsigned short sector_size;
915 const char *disk_name;
916};
917
918typedef void (integrity_gen_fn) (struct blk_integrity_exchg *);
919typedef int (integrity_vrfy_fn) (struct blk_integrity_exchg *);
920typedef void (integrity_set_tag_fn) (void *, void *, unsigned int);
921typedef void (integrity_get_tag_fn) (void *, void *, unsigned int);
922
923struct blk_integrity {
924 integrity_gen_fn *generate_fn;
925 integrity_vrfy_fn *verify_fn;
926 integrity_set_tag_fn *set_tag_fn;
927 integrity_get_tag_fn *get_tag_fn;
928
929 unsigned short flags;
930 unsigned short tuple_size;
931 unsigned short sector_size;
932 unsigned short tag_size;
933
934 const char *name;
935
936 struct kobject kobj;
937};
938
939extern int blk_integrity_register(struct gendisk *, struct blk_integrity *);
940extern void blk_integrity_unregister(struct gendisk *);
941extern int blk_integrity_compare(struct block_device *, struct block_device *);
942extern int blk_rq_map_integrity_sg(struct request *, struct scatterlist *);
943extern int blk_rq_count_integrity_sg(struct request *);
944
945static inline unsigned short blk_integrity_tuple_size(struct blk_integrity *bi)
876{ 946{
947 if (bi)
948 return bi->tuple_size;
949
877 return 0; 950 return 0;
878} 951}
879 952
880static inline void exit_io_context(void) 953static inline struct blk_integrity *bdev_get_integrity(struct block_device *bdev)
881{ 954{
955 return bdev->bd_disk->integrity;
882} 956}
883 957
884struct io_context; 958static inline unsigned int bdev_get_tag_size(struct block_device *bdev)
885static inline int put_io_context(struct io_context *ioc)
886{ 959{
887 return 1; 960 struct blk_integrity *bi = bdev_get_integrity(bdev);
961
962 if (bi)
963 return bi->tag_size;
964
965 return 0;
966}
967
968static inline int bdev_integrity_enabled(struct block_device *bdev, int rw)
969{
970 struct blk_integrity *bi = bdev_get_integrity(bdev);
971
972 if (bi == NULL)
973 return 0;
974
975 if (rw == READ && bi->verify_fn != NULL &&
976 (bi->flags & INTEGRITY_FLAG_READ))
977 return 1;
978
979 if (rw == WRITE && bi->generate_fn != NULL &&
980 (bi->flags & INTEGRITY_FLAG_WRITE))
981 return 1;
982
983 return 0;
888} 984}
889 985
986static inline int blk_integrity_rq(struct request *rq)
987{
988 if (rq->bio == NULL)
989 return 0;
990
991 return bio_integrity(rq->bio);
992}
993
994#else /* CONFIG_BLK_DEV_INTEGRITY */
995
996#define blk_integrity_rq(rq) (0)
997#define blk_rq_count_integrity_sg(a) (0)
998#define blk_rq_map_integrity_sg(a, b) (0)
999#define bdev_get_integrity(a) (0)
1000#define bdev_get_tag_size(a) (0)
1001#define blk_integrity_compare(a, b) (0)
1002#define blk_integrity_register(a, b) (0)
1003#define blk_integrity_unregister(a) do { } while (0);
1004
1005#endif /* CONFIG_BLK_DEV_INTEGRITY */
1006
1007#else /* CONFIG_BLOCK */
1008/*
1009 * stubs for when the block layer is configured out
1010 */
1011#define buffer_heads_over_limit 0
1012
1013static inline long nr_blockdev_pages(void)
1014{
1015 return 0;
1016}
890 1017
891#endif /* CONFIG_BLOCK */ 1018#endif /* CONFIG_BLOCK */
892 1019
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index cfc3147e5cf..d084b8d227a 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -55,6 +55,7 @@ enum blktrace_act {
55enum blktrace_notify { 55enum blktrace_notify {
56 __BLK_TN_PROCESS = 0, /* establish pid/name mapping */ 56 __BLK_TN_PROCESS = 0, /* establish pid/name mapping */
57 __BLK_TN_TIMESTAMP, /* include system clock */ 57 __BLK_TN_TIMESTAMP, /* include system clock */
58 __BLK_TN_MESSAGE, /* Character string message */
58}; 59};
59 60
60 61
@@ -79,6 +80,7 @@ enum blktrace_notify {
79 80
80#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY)) 81#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY))
81#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY)) 82#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY))
83#define BLK_TN_MESSAGE (__BLK_TN_MESSAGE | BLK_TC_ACT(BLK_TC_NOTIFY))
82 84
83#define BLK_IO_TRACE_MAGIC 0x65617400 85#define BLK_IO_TRACE_MAGIC 0x65617400
84#define BLK_IO_TRACE_VERSION 0x07 86#define BLK_IO_TRACE_VERSION 0x07
@@ -119,6 +121,7 @@ struct blk_trace {
119 int trace_state; 121 int trace_state;
120 struct rchan *rchan; 122 struct rchan *rchan;
121 unsigned long *sequence; 123 unsigned long *sequence;
124 unsigned char *msg_data;
122 u16 act_mask; 125 u16 act_mask;
123 u64 start_lba; 126 u64 start_lba;
124 u64 end_lba; 127 u64 end_lba;
@@ -126,6 +129,7 @@ struct blk_trace {
126 u32 dev; 129 u32 dev;
127 struct dentry *dir; 130 struct dentry *dir;
128 struct dentry *dropped_file; 131 struct dentry *dropped_file;
132 struct dentry *msg_file;
129 atomic_t dropped; 133 atomic_t dropped;
130}; 134};
131 135
@@ -149,7 +153,28 @@ extern void blk_trace_shutdown(struct request_queue *);
149extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *); 153extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *);
150extern int do_blk_trace_setup(struct request_queue *q, 154extern int do_blk_trace_setup(struct request_queue *q,
151 char *name, dev_t dev, struct blk_user_trace_setup *buts); 155 char *name, dev_t dev, struct blk_user_trace_setup *buts);
156extern void __trace_note_message(struct blk_trace *, const char *fmt, ...);
152 157
158/**
159 * blk_add_trace_msg - Add a (simple) message to the blktrace stream
160 * @q: queue the io is for
161 * @fmt: format to print message in
162 * args... Variable argument list for format
163 *
164 * Description:
165 * Records a (simple) message onto the blktrace stream.
166 *
167 * NOTE: BLK_TN_MAX_MSG characters are output at most.
168 * NOTE: Can not use 'static inline' due to presence of var args...
169 *
170 **/
171#define blk_add_trace_msg(q, fmt, ...) \
172 do { \
173 struct blk_trace *bt = (q)->blk_trace; \
174 if (unlikely(bt)) \
175 __trace_note_message(bt, fmt, ##__VA_ARGS__); \
176 } while (0)
177#define BLK_TN_MAX_MSG 128
153 178
154/** 179/**
155 * blk_add_trace_rq - Add a trace for a request oriented action 180 * blk_add_trace_rq - Add a trace for a request oriented action
@@ -299,6 +324,8 @@ extern int blk_trace_remove(struct request_queue *q);
299#define blk_trace_setup(q, name, dev, arg) (-ENOTTY) 324#define blk_trace_setup(q, name, dev, arg) (-ENOTTY)
300#define blk_trace_startstop(q, start) (-ENOTTY) 325#define blk_trace_startstop(q, start) (-ENOTTY)
301#define blk_trace_remove(q) (-ENOTTY) 326#define blk_trace_remove(q) (-ENOTTY)
327#define blk_add_trace_msg(q, fmt, ...) do { } while (0)
328
302#endif /* CONFIG_BLK_DEV_IO_TRACE */ 329#endif /* CONFIG_BLK_DEV_IO_TRACE */
303#endif /* __KERNEL__ */ 330#endif /* __KERNEL__ */
304#endif 331#endif
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 6a5dbdc8a7d..652470b687c 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -28,52 +28,73 @@ extern unsigned long saved_max_pfn;
28 * memory pages (including holes) on the node. 28 * memory pages (including holes) on the node.
29 */ 29 */
30typedef struct bootmem_data { 30typedef struct bootmem_data {
31 unsigned long node_boot_start; 31 unsigned long node_min_pfn;
32 unsigned long node_low_pfn; 32 unsigned long node_low_pfn;
33 void *node_bootmem_map; 33 void *node_bootmem_map;
34 unsigned long last_offset; 34 unsigned long last_end_off;
35 unsigned long last_pos; 35 unsigned long hint_idx;
36 unsigned long last_success; /* Previous allocation point. To speed
37 * up searching */
38 struct list_head list; 36 struct list_head list;
39} bootmem_data_t; 37} bootmem_data_t;
40 38
39extern bootmem_data_t bootmem_node_data[];
40
41extern unsigned long bootmem_bootmap_pages(unsigned long); 41extern unsigned long bootmem_bootmap_pages(unsigned long);
42
43extern unsigned long init_bootmem_node(pg_data_t *pgdat,
44 unsigned long freepfn,
45 unsigned long startpfn,
46 unsigned long endpfn);
42extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); 47extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
48
49extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
50extern unsigned long free_all_bootmem(void);
51
52extern void free_bootmem_node(pg_data_t *pgdat,
53 unsigned long addr,
54 unsigned long size);
43extern void free_bootmem(unsigned long addr, unsigned long size); 55extern void free_bootmem(unsigned long addr, unsigned long size);
44extern void *__alloc_bootmem(unsigned long size, 56
57/*
58 * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE,
59 * the architecture-specific code should honor this).
60 *
61 * If flags is 0, then the return value is always 0 (success). If
62 * flags contains BOOTMEM_EXCLUSIVE, then -EBUSY is returned if the
63 * memory already was reserved.
64 */
65#define BOOTMEM_DEFAULT 0
66#define BOOTMEM_EXCLUSIVE (1<<0)
67
68extern int reserve_bootmem_node(pg_data_t *pgdat,
69 unsigned long physaddr,
70 unsigned long size,
71 int flags);
72#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
73extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags);
74#endif
75
76extern void *__alloc_bootmem_nopanic(unsigned long size,
45 unsigned long align, 77 unsigned long align,
46 unsigned long goal); 78 unsigned long goal);
47extern void *__alloc_bootmem_nopanic(unsigned long size, 79extern void *__alloc_bootmem(unsigned long size,
48 unsigned long align, 80 unsigned long align,
49 unsigned long goal); 81 unsigned long goal);
50extern void *__alloc_bootmem_low(unsigned long size, 82extern void *__alloc_bootmem_low(unsigned long size,
51 unsigned long align, 83 unsigned long align,
52 unsigned long goal); 84 unsigned long goal);
85extern void *__alloc_bootmem_node(pg_data_t *pgdat,
86 unsigned long size,
87 unsigned long align,
88 unsigned long goal);
89extern void *__alloc_bootmem_node_nopanic(pg_data_t *pgdat,
90 unsigned long size,
91 unsigned long align,
92 unsigned long goal);
53extern void *__alloc_bootmem_low_node(pg_data_t *pgdat, 93extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,
54 unsigned long size, 94 unsigned long size,
55 unsigned long align, 95 unsigned long align,
56 unsigned long goal); 96 unsigned long goal);
57extern void *__alloc_bootmem_core(struct bootmem_data *bdata,
58 unsigned long size,
59 unsigned long align,
60 unsigned long goal,
61 unsigned long limit);
62
63/*
64 * flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE,
65 * the architecture-specific code should honor this)
66 */
67#define BOOTMEM_DEFAULT 0
68#define BOOTMEM_EXCLUSIVE (1<<0)
69
70#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 97#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
71/*
72 * If flags is 0, then the return value is always 0 (success). If
73 * flags contains BOOTMEM_EXCLUSIVE, then -EBUSY is returned if the
74 * memory already was reserved.
75 */
76extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags);
77#define alloc_bootmem(x) \ 98#define alloc_bootmem(x) \
78 __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 99 __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
79#define alloc_bootmem_low(x) \ 100#define alloc_bootmem_low(x) \
@@ -82,29 +103,6 @@ extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags);
82 __alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 103 __alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
83#define alloc_bootmem_low_pages(x) \ 104#define alloc_bootmem_low_pages(x) \
84 __alloc_bootmem_low(x, PAGE_SIZE, 0) 105 __alloc_bootmem_low(x, PAGE_SIZE, 0)
85#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
86
87extern unsigned long free_all_bootmem(void);
88extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
89extern void *__alloc_bootmem_node(pg_data_t *pgdat,
90 unsigned long size,
91 unsigned long align,
92 unsigned long goal);
93extern unsigned long init_bootmem_node(pg_data_t *pgdat,
94 unsigned long freepfn,
95 unsigned long startpfn,
96 unsigned long endpfn);
97extern void reserve_bootmem_node(pg_data_t *pgdat,
98 unsigned long physaddr,
99 unsigned long size,
100 int flags);
101extern void free_bootmem_node(pg_data_t *pgdat,
102 unsigned long addr,
103 unsigned long size);
104extern void *alloc_bootmem_section(unsigned long size,
105 unsigned long section_nr);
106
107#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
108#define alloc_bootmem_node(pgdat, x) \ 106#define alloc_bootmem_node(pgdat, x) \
109 __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 107 __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
110#define alloc_bootmem_pages_node(pgdat, x) \ 108#define alloc_bootmem_pages_node(pgdat, x) \
@@ -113,6 +111,12 @@ extern void *alloc_bootmem_section(unsigned long size,
113 __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0) 111 __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0)
114#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ 112#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
115 113
114extern int reserve_bootmem_generic(unsigned long addr, unsigned long size,
115 int flags);
116
117extern void *alloc_bootmem_section(unsigned long size,
118 unsigned long section_nr);
119
116#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP 120#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP
117extern void *alloc_remap(int nid, unsigned long size); 121extern void *alloc_remap(int nid, unsigned long size);
118#else 122#else
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
new file mode 100644
index 00000000000..9b64b6d6787
--- /dev/null
+++ b/include/linux/brcmphy.h
@@ -0,0 +1,6 @@
1#define PHY_BRCM_WIRESPEED_ENABLE 0x00000001
2#define PHY_BRCM_AUTO_PWRDWN_ENABLE 0x00000002
3#define PHY_BRCM_APD_CLK125_ENABLE 0x00000004
4#define PHY_BRCM_STD_IBND_DISABLE 0x00000008
5#define PHY_BRCM_EXT_IBND_RX_ENABLE 0x00000010
6#define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00000020
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 82aa36c53ea..50cfe8ceb47 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -205,6 +205,8 @@ void block_invalidatepage(struct page *page, unsigned long offset);
205int block_write_full_page(struct page *page, get_block_t *get_block, 205int block_write_full_page(struct page *page, get_block_t *get_block,
206 struct writeback_control *wbc); 206 struct writeback_control *wbc);
207int block_read_full_page(struct page*, get_block_t*); 207int block_read_full_page(struct page*, get_block_t*);
208int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc,
209 unsigned long from);
208int block_write_begin(struct file *, struct address_space *, 210int block_write_begin(struct file *, struct address_space *,
209 loff_t, unsigned, unsigned, 211 loff_t, unsigned, unsigned,
210 struct page **, void **, get_block_t*); 212 struct page **, void **, get_block_t*);
diff --git a/include/linux/byteorder/big_endian.h b/include/linux/byteorder/big_endian.h
index 961ed4b48d8..44f95b92393 100644
--- a/include/linux/byteorder/big_endian.h
+++ b/include/linux/byteorder/big_endian.h
@@ -94,12 +94,12 @@ static inline __u16 __be16_to_cpup(const __be16 *p)
94#define __le32_to_cpus(x) __swab32s((x)) 94#define __le32_to_cpus(x) __swab32s((x))
95#define __cpu_to_le16s(x) __swab16s((x)) 95#define __cpu_to_le16s(x) __swab16s((x))
96#define __le16_to_cpus(x) __swab16s((x)) 96#define __le16_to_cpus(x) __swab16s((x))
97#define __cpu_to_be64s(x) do {} while (0) 97#define __cpu_to_be64s(x) do { (void)(x); } while (0)
98#define __be64_to_cpus(x) do {} while (0) 98#define __be64_to_cpus(x) do { (void)(x); } while (0)
99#define __cpu_to_be32s(x) do {} while (0) 99#define __cpu_to_be32s(x) do { (void)(x); } while (0)
100#define __be32_to_cpus(x) do {} while (0) 100#define __be32_to_cpus(x) do { (void)(x); } while (0)
101#define __cpu_to_be16s(x) do {} while (0) 101#define __cpu_to_be16s(x) do { (void)(x); } while (0)
102#define __be16_to_cpus(x) do {} while (0) 102#define __be16_to_cpus(x) do { (void)(x); } while (0)
103 103
104#ifdef __KERNEL__ 104#ifdef __KERNEL__
105#include <linux/byteorder/generic.h> 105#include <linux/byteorder/generic.h>
diff --git a/include/linux/byteorder/little_endian.h b/include/linux/byteorder/little_endian.h
index 05dc7c35b3b..4cc170a3176 100644
--- a/include/linux/byteorder/little_endian.h
+++ b/include/linux/byteorder/little_endian.h
@@ -88,12 +88,12 @@ static inline __u16 __be16_to_cpup(const __be16 *p)
88{ 88{
89 return __swab16p((__u16 *)p); 89 return __swab16p((__u16 *)p);
90} 90}
91#define __cpu_to_le64s(x) do {} while (0) 91#define __cpu_to_le64s(x) do { (void)(x); } while (0)
92#define __le64_to_cpus(x) do {} while (0) 92#define __le64_to_cpus(x) do { (void)(x); } while (0)
93#define __cpu_to_le32s(x) do {} while (0) 93#define __cpu_to_le32s(x) do { (void)(x); } while (0)
94#define __le32_to_cpus(x) do {} while (0) 94#define __le32_to_cpus(x) do { (void)(x); } while (0)
95#define __cpu_to_le16s(x) do {} while (0) 95#define __cpu_to_le16s(x) do { (void)(x); } while (0)
96#define __le16_to_cpus(x) do {} while (0) 96#define __le16_to_cpus(x) do { (void)(x); } while (0)
97#define __cpu_to_be64s(x) __swab64s((x)) 97#define __cpu_to_be64s(x) __swab64s((x))
98#define __be64_to_cpus(x) __swab64s((x)) 98#define __be64_to_cpus(x) __swab64s((x))
99#define __cpu_to_be32s(x) __swab32s((x)) 99#define __cpu_to_be32s(x) __swab32s((x))
diff --git a/include/linux/capability.h b/include/linux/capability.h
index f4ea0dd9a61..02673846d20 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -31,11 +31,11 @@ struct task_struct;
31#define _LINUX_CAPABILITY_VERSION_1 0x19980330 31#define _LINUX_CAPABILITY_VERSION_1 0x19980330
32#define _LINUX_CAPABILITY_U32S_1 1 32#define _LINUX_CAPABILITY_U32S_1 1
33 33
34#define _LINUX_CAPABILITY_VERSION_2 0x20071026 34#define _LINUX_CAPABILITY_VERSION_2 0x20071026 /* deprecated - use v3 */
35#define _LINUX_CAPABILITY_U32S_2 2 35#define _LINUX_CAPABILITY_U32S_2 2
36 36
37#define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_2 37#define _LINUX_CAPABILITY_VERSION_3 0x20080522
38#define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_2 38#define _LINUX_CAPABILITY_U32S_3 2
39 39
40typedef struct __user_cap_header_struct { 40typedef struct __user_cap_header_struct {
41 __u32 version; 41 __u32 version;
@@ -77,10 +77,23 @@ struct vfs_cap_data {
77 } data[VFS_CAP_U32]; 77 } data[VFS_CAP_U32];
78}; 78};
79 79
80#ifdef __KERNEL__ 80#ifndef __KERNEL__
81
82/*
83 * Backwardly compatible definition for source code - trapped in a
84 * 32-bit world. If you find you need this, please consider using
85 * libcap to untrap yourself...
86 */
87#define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_1
88#define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_1
89
90#else
91
92#define _KERNEL_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_3
93#define _KERNEL_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_3
81 94
82typedef struct kernel_cap_struct { 95typedef struct kernel_cap_struct {
83 __u32 cap[_LINUX_CAPABILITY_U32S]; 96 __u32 cap[_KERNEL_CAPABILITY_U32S];
84} kernel_cap_t; 97} kernel_cap_t;
85 98
86#define _USER_CAP_HEADER_SIZE (sizeof(struct __user_cap_header_struct)) 99#define _USER_CAP_HEADER_SIZE (sizeof(struct __user_cap_header_struct))
@@ -351,7 +364,7 @@ typedef struct kernel_cap_struct {
351 */ 364 */
352 365
353#define CAP_FOR_EACH_U32(__capi) \ 366#define CAP_FOR_EACH_U32(__capi) \
354 for (__capi = 0; __capi < _LINUX_CAPABILITY_U32S; ++__capi) 367 for (__capi = 0; __capi < _KERNEL_CAPABILITY_U32S; ++__capi)
355 368
356# define CAP_FS_MASK_B0 (CAP_TO_MASK(CAP_CHOWN) \ 369# define CAP_FS_MASK_B0 (CAP_TO_MASK(CAP_CHOWN) \
357 | CAP_TO_MASK(CAP_DAC_OVERRIDE) \ 370 | CAP_TO_MASK(CAP_DAC_OVERRIDE) \
@@ -361,7 +374,7 @@ typedef struct kernel_cap_struct {
361 374
362# define CAP_FS_MASK_B1 (CAP_TO_MASK(CAP_MAC_OVERRIDE)) 375# define CAP_FS_MASK_B1 (CAP_TO_MASK(CAP_MAC_OVERRIDE))
363 376
364#if _LINUX_CAPABILITY_U32S != 2 377#if _KERNEL_CAPABILITY_U32S != 2
365# error Fix up hand-coded capability macro initializers 378# error Fix up hand-coded capability macro initializers
366#else /* HAND-CODED capability initializers */ 379#else /* HAND-CODED capability initializers */
367 380
@@ -372,7 +385,7 @@ typedef struct kernel_cap_struct {
372# define CAP_NFSD_SET ((kernel_cap_t){{ CAP_FS_MASK_B0|CAP_TO_MASK(CAP_SYS_RESOURCE), \ 385# define CAP_NFSD_SET ((kernel_cap_t){{ CAP_FS_MASK_B0|CAP_TO_MASK(CAP_SYS_RESOURCE), \
373 CAP_FS_MASK_B1 } }) 386 CAP_FS_MASK_B1 } })
374 387
375#endif /* _LINUX_CAPABILITY_U32S != 2 */ 388#endif /* _KERNEL_CAPABILITY_U32S != 2 */
376 389
377#define CAP_INIT_INH_SET CAP_EMPTY_SET 390#define CAP_INIT_INH_SET CAP_EMPTY_SET
378 391
@@ -488,6 +501,8 @@ extern const kernel_cap_t __cap_empty_set;
488extern const kernel_cap_t __cap_full_set; 501extern const kernel_cap_t __cap_full_set;
489extern const kernel_cap_t __cap_init_eff_set; 502extern const kernel_cap_t __cap_init_eff_set;
490 503
504kernel_cap_t cap_set_effective(const kernel_cap_t pE_new);
505
491int capable(int cap); 506int capable(int cap);
492int __capable(struct task_struct *t, int cap); 507int __capable(struct task_struct *t, int cap);
493 508
diff --git a/include/linux/cfag12864b.h b/include/linux/cfag12864b.h
index 1605dd8aa64..6f9f19d6659 100644
--- a/include/linux/cfag12864b.h
+++ b/include/linux/cfag12864b.h
@@ -4,7 +4,7 @@
4 * Description: cfag12864b LCD driver header 4 * Description: cfag12864b LCD driver header
5 * License: GPLv2 5 * License: GPLv2
6 * 6 *
7 * Author: Copyright (C) Miguel Ojeda Sandonis <maxextreme@gmail.com> 7 * Author: Copyright (C) Miguel Ojeda Sandonis
8 * Date: 2006-10-12 8 * Date: 2006-10-12
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
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index e155aa78d85..c98dd7cb707 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -21,11 +21,13 @@
21struct cgroupfs_root; 21struct cgroupfs_root;
22struct cgroup_subsys; 22struct cgroup_subsys;
23struct inode; 23struct inode;
24struct cgroup;
24 25
25extern int cgroup_init_early(void); 26extern int cgroup_init_early(void);
26extern int cgroup_init(void); 27extern int cgroup_init(void);
27extern void cgroup_init_smp(void); 28extern void cgroup_init_smp(void);
28extern void cgroup_lock(void); 29extern void cgroup_lock(void);
30extern bool cgroup_lock_live_group(struct cgroup *cgrp);
29extern void cgroup_unlock(void); 31extern void cgroup_unlock(void);
30extern void cgroup_fork(struct task_struct *p); 32extern void cgroup_fork(struct task_struct *p);
31extern void cgroup_fork_callbacks(struct task_struct *p); 33extern void cgroup_fork_callbacks(struct task_struct *p);
@@ -205,50 +207,64 @@ struct cftype {
205 * subsystem, followed by a period */ 207 * subsystem, followed by a period */
206 char name[MAX_CFTYPE_NAME]; 208 char name[MAX_CFTYPE_NAME];
207 int private; 209 int private;
208 int (*open) (struct inode *inode, struct file *file); 210
209 ssize_t (*read) (struct cgroup *cgrp, struct cftype *cft, 211 /*
210 struct file *file, 212 * If non-zero, defines the maximum length of string that can
211 char __user *buf, size_t nbytes, loff_t *ppos); 213 * be passed to write_string; defaults to 64
214 */
215 size_t max_write_len;
216
217 int (*open)(struct inode *inode, struct file *file);
218 ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft,
219 struct file *file,
220 char __user *buf, size_t nbytes, loff_t *ppos);
212 /* 221 /*
213 * read_u64() is a shortcut for the common case of returning a 222 * read_u64() is a shortcut for the common case of returning a
214 * single integer. Use it in place of read() 223 * single integer. Use it in place of read()
215 */ 224 */
216 u64 (*read_u64) (struct cgroup *cgrp, struct cftype *cft); 225 u64 (*read_u64)(struct cgroup *cgrp, struct cftype *cft);
217 /* 226 /*
218 * read_s64() is a signed version of read_u64() 227 * read_s64() is a signed version of read_u64()
219 */ 228 */
220 s64 (*read_s64) (struct cgroup *cgrp, struct cftype *cft); 229 s64 (*read_s64)(struct cgroup *cgrp, struct cftype *cft);
221 /* 230 /*
222 * read_map() is used for defining a map of key/value 231 * read_map() is used for defining a map of key/value
223 * pairs. It should call cb->fill(cb, key, value) for each 232 * pairs. It should call cb->fill(cb, key, value) for each
224 * entry. The key/value pairs (and their ordering) should not 233 * entry. The key/value pairs (and their ordering) should not
225 * change between reboots. 234 * change between reboots.
226 */ 235 */
227 int (*read_map) (struct cgroup *cont, struct cftype *cft, 236 int (*read_map)(struct cgroup *cont, struct cftype *cft,
228 struct cgroup_map_cb *cb); 237 struct cgroup_map_cb *cb);
229 /* 238 /*
230 * read_seq_string() is used for outputting a simple sequence 239 * read_seq_string() is used for outputting a simple sequence
231 * using seqfile. 240 * using seqfile.
232 */ 241 */
233 int (*read_seq_string) (struct cgroup *cont, struct cftype *cft, 242 int (*read_seq_string)(struct cgroup *cont, struct cftype *cft,
234 struct seq_file *m); 243 struct seq_file *m);
235 244
236 ssize_t (*write) (struct cgroup *cgrp, struct cftype *cft, 245 ssize_t (*write)(struct cgroup *cgrp, struct cftype *cft,
237 struct file *file, 246 struct file *file,
238 const char __user *buf, size_t nbytes, loff_t *ppos); 247 const char __user *buf, size_t nbytes, loff_t *ppos);
239 248
240 /* 249 /*
241 * write_u64() is a shortcut for the common case of accepting 250 * write_u64() is a shortcut for the common case of accepting
242 * a single integer (as parsed by simple_strtoull) from 251 * a single integer (as parsed by simple_strtoull) from
243 * userspace. Use in place of write(); return 0 or error. 252 * userspace. Use in place of write(); return 0 or error.
244 */ 253 */
245 int (*write_u64) (struct cgroup *cgrp, struct cftype *cft, u64 val); 254 int (*write_u64)(struct cgroup *cgrp, struct cftype *cft, u64 val);
246 /* 255 /*
247 * write_s64() is a signed version of write_u64() 256 * write_s64() is a signed version of write_u64()
248 */ 257 */
249 int (*write_s64) (struct cgroup *cgrp, struct cftype *cft, s64 val); 258 int (*write_s64)(struct cgroup *cgrp, struct cftype *cft, s64 val);
250 259
251 /* 260 /*
261 * write_string() is passed a nul-terminated kernelspace
262 * buffer of maximum length determined by max_write_len.
263 * Returns 0 or -ve error code.
264 */
265 int (*write_string)(struct cgroup *cgrp, struct cftype *cft,
266 const char *buffer);
267 /*
252 * trigger() callback can be used to get some kick from the 268 * trigger() callback can be used to get some kick from the
253 * userspace, when the actual string written is not important 269 * userspace, when the actual string written is not important
254 * at all. The private field can be used to determine the 270 * at all. The private field can be used to determine the
@@ -256,7 +272,7 @@ struct cftype {
256 */ 272 */
257 int (*trigger)(struct cgroup *cgrp, unsigned int event); 273 int (*trigger)(struct cgroup *cgrp, unsigned int event);
258 274
259 int (*release) (struct inode *inode, struct file *file); 275 int (*release)(struct inode *inode, struct file *file);
260}; 276};
261 277
262struct cgroup_scanner { 278struct cgroup_scanner {
@@ -348,7 +364,8 @@ static inline struct cgroup* task_cgroup(struct task_struct *task,
348 return task_subsys_state(task, subsys_id)->cgroup; 364 return task_subsys_state(task, subsys_id)->cgroup;
349} 365}
350 366
351int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *ss); 367int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *ss,
368 char *nodename);
352 369
353/* A cgroup_iter should be treated as an opaque object */ 370/* A cgroup_iter should be treated as an opaque object */
354struct cgroup_iter { 371struct cgroup_iter {
diff --git a/include/linux/coda.h b/include/linux/coda.h
index b5cf0780c51..96c87693800 100644
--- a/include/linux/coda.h
+++ b/include/linux/coda.h
@@ -199,28 +199,6 @@ typedef u_int32_t vuid_t;
199typedef u_int32_t vgid_t; 199typedef u_int32_t vgid_t;
200#endif /*_VUID_T_ */ 200#endif /*_VUID_T_ */
201 201
202#ifdef CONFIG_CODA_FS_OLD_API
203struct CodaFid {
204 u_int32_t opaque[3];
205};
206
207static __inline__ ino_t coda_f2i(struct CodaFid *fid)
208{
209 if ( ! fid )
210 return 0;
211 if (fid->opaque[1] == 0xfffffffe || fid->opaque[1] == 0xffffffff)
212 return ((fid->opaque[0] << 20) | (fid->opaque[2] & 0xfffff));
213 else
214 return (fid->opaque[2] + (fid->opaque[1]<<10) + (fid->opaque[0]<<20));
215}
216
217struct coda_cred {
218 vuid_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, efftve, set, fs uid*/
219 vgid_t cr_groupid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */
220};
221
222#else /* not defined(CONFIG_CODA_FS_OLD_API) */
223
224struct CodaFid { 202struct CodaFid {
225 u_int32_t opaque[4]; 203 u_int32_t opaque[4];
226}; 204};
@@ -228,8 +206,6 @@ struct CodaFid {
228#define coda_f2i(fid)\ 206#define coda_f2i(fid)\
229 (fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0) 207 (fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0)
230 208
231#endif
232
233#ifndef _VENUS_VATTR_T_ 209#ifndef _VENUS_VATTR_T_
234#define _VENUS_VATTR_T_ 210#define _VENUS_VATTR_T_
235/* 211/*
@@ -313,15 +289,7 @@ struct coda_statfs {
313 289
314#define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t) 290#define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t)
315 291
316#if 0
317#define CODA_KERNEL_VERSION 0 /* don't care about kernel version number */
318#define CODA_KERNEL_VERSION 1 /* The old venus 4.6 compatible interface */
319#endif
320#ifdef CONFIG_CODA_FS_OLD_API
321#define CODA_KERNEL_VERSION 2 /* venus_lookup got an extra parameter */
322#else
323#define CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */ 292#define CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */
324#endif
325 293
326/* 294/*
327 * Venus <-> Coda RPC arguments 295 * Venus <-> Coda RPC arguments
@@ -329,16 +297,9 @@ struct coda_statfs {
329struct coda_in_hdr { 297struct coda_in_hdr {
330 u_int32_t opcode; 298 u_int32_t opcode;
331 u_int32_t unique; /* Keep multiple outstanding msgs distinct */ 299 u_int32_t unique; /* Keep multiple outstanding msgs distinct */
332#ifdef CONFIG_CODA_FS_OLD_API
333 u_int16_t pid; /* Common to all */
334 u_int16_t pgid; /* Common to all */
335 u_int16_t sid; /* Common to all */
336 struct coda_cred cred; /* Common to all */
337#else
338 pid_t pid; 300 pid_t pid;
339 pid_t pgid; 301 pid_t pgid;
340 vuid_t uid; 302 vuid_t uid;
341#endif
342}; 303};
343 304
344/* Really important that opcode and unique are 1st two fields! */ 305/* Really important that opcode and unique are 1st two fields! */
@@ -613,11 +574,7 @@ struct coda_vget_out {
613/* CODA_PURGEUSER is a venus->kernel call */ 574/* CODA_PURGEUSER is a venus->kernel call */
614struct coda_purgeuser_out { 575struct coda_purgeuser_out {
615 struct coda_out_hdr oh; 576 struct coda_out_hdr oh;
616#ifdef CONFIG_CODA_FS_OLD_API
617 struct coda_cred cred;
618#else
619 vuid_t uid; 577 vuid_t uid;
620#endif
621}; 578};
622 579
623/* coda_zapfile: */ 580/* coda_zapfile: */
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
index 31b75311e2c..dcc228aa335 100644
--- a/include/linux/coda_linux.h
+++ b/include/linux/coda_linux.h
@@ -37,7 +37,7 @@ extern const struct file_operations coda_ioctl_operations;
37/* operations shared over more than one file */ 37/* operations shared over more than one file */
38int coda_open(struct inode *i, struct file *f); 38int coda_open(struct inode *i, struct file *f);
39int coda_release(struct inode *i, struct file *f); 39int coda_release(struct inode *i, struct file *f);
40int coda_permission(struct inode *inode, int mask, struct nameidata *nd); 40int coda_permission(struct inode *inode, int mask);
41int coda_revalidate_inode(struct dentry *); 41int coda_revalidate_inode(struct dentry *);
42int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *); 42int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *);
43int coda_setattr(struct dentry *, struct iattr *); 43int coda_setattr(struct dentry *, struct iattr *);
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index dcae0c8d97e..c8bd2daf95e 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -182,4 +182,16 @@ extern void __chk_io_ptr(const volatile void __iomem *);
182# define __section(S) __attribute__ ((__section__(#S))) 182# define __section(S) __attribute__ ((__section__(#S)))
183#endif 183#endif
184 184
185/*
186 * Prevent the compiler from merging or refetching accesses. The compiler
187 * is also forbidden from reordering successive instances of ACCESS_ONCE(),
188 * but only when the compiler is aware of some particular ordering. One way
189 * to make the compiler aware of ordering is to put the two invocations of
190 * ACCESS_ONCE() in different C statements.
191 *
192 * This macro does absolutely -nothing- to prevent the CPU from reordering,
193 * merging, or refetching absolutely anything at any time.
194 */
195#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
196
185#endif /* __LINUX_COMPILER_H */ 197#endif /* __LINUX_COMPILER_H */
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 3ae65b1bf90..d62c19ff041 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -148,7 +148,8 @@ struct configfs_attribute {
148 * items. If the item is a group, it may support mkdir(2). 148 * items. If the item is a group, it may support mkdir(2).
149 * Groups supply one of make_group() and make_item(). If the 149 * Groups supply one of make_group() and make_item(). If the
150 * group supports make_group(), one can create group children. If it 150 * group supports make_group(), one can create group children. If it
151 * supports make_item(), one can create config_item children. If it has 151 * supports make_item(), one can create config_item children. make_group()
152 * and make_item() return ERR_PTR() on errors. If it has
152 * default_groups on group->default_groups, it has automatically created 153 * default_groups on group->default_groups, it has automatically created
153 * group children. default_groups may coexist alongsize make_group() or 154 * group children. default_groups may coexist alongsize make_group() or
154 * make_item(), but if the group wishes to have only default_groups 155 * make_item(), but if the group wishes to have only default_groups
diff --git a/include/linux/console.h b/include/linux/console.h
index a4f27fbdf54..248e6e3b9b7 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -108,6 +108,8 @@ struct console {
108 struct console *next; 108 struct console *next;
109}; 109};
110 110
111extern int console_set_on_cmdline;
112
111extern int add_preferred_console(char *name, int idx, char *options); 113extern int add_preferred_console(char *name, int idx, char *options);
112extern int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options); 114extern int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options);
113extern void register_console(struct console *); 115extern void register_console(struct console *);
diff --git a/include/linux/consolemap.h b/include/linux/consolemap.h
index e2bf7e5db39..c4811da1338 100644
--- a/include/linux/consolemap.h
+++ b/include/linux/consolemap.h
@@ -3,6 +3,9 @@
3 * 3 *
4 * Interface between console.c, selection.c and consolemap.c 4 * Interface between console.c, selection.c and consolemap.c
5 */ 5 */
6#ifndef __LINUX_CONSOLEMAP_H__
7#define __LINUX_CONSOLEMAP_H__
8
6#define LAT1_MAP 0 9#define LAT1_MAP 0
7#define GRAF_MAP 1 10#define GRAF_MAP 1
8#define IBMPC_MAP 2 11#define IBMPC_MAP 2
@@ -10,6 +13,7 @@
10 13
11#include <linux/types.h> 14#include <linux/types.h>
12 15
16#ifdef CONFIG_CONSOLE_TRANSLATIONS
13struct vc_data; 17struct vc_data;
14 18
15extern u16 inverse_translate(struct vc_data *conp, int glyph, int use_unicode); 19extern u16 inverse_translate(struct vc_data *conp, int glyph, int use_unicode);
@@ -18,3 +22,13 @@ extern int conv_uni_to_pc(struct vc_data *conp, long ucs);
18extern u32 conv_8bit_to_uni(unsigned char c); 22extern u32 conv_8bit_to_uni(unsigned char c);
19extern int conv_uni_to_8bit(u32 uni); 23extern int conv_uni_to_8bit(u32 uni);
20void console_map_init(void); 24void console_map_init(void);
25#else
26#define inverse_translate(conp, glyph, uni) ((uint16_t)glyph)
27#define set_translate(m, vc) ((unsigned short *)NULL)
28#define conv_uni_to_pc(conp, ucs) ((int) (ucs > 0xff ? -1: ucs))
29#define conv_8bit_to_uni(c) ((uint32_t)(c))
30#define conv_uni_to_8bit(c) ((int) ((c) & 0xff))
31#define console_map_init(c) do { ; } while (0)
32#endif /* CONFIG_CONSOLE_TRANSLATIONS */
33
34#endif /* __LINUX_CONSOLEMAP_H__ */
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 7464ba3b433..d7faf880849 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -69,10 +69,11 @@ static inline void unregister_cpu_notifier(struct notifier_block *nb)
69#endif 69#endif
70 70
71int cpu_up(unsigned int cpu); 71int cpu_up(unsigned int cpu);
72
73extern void cpu_hotplug_init(void); 72extern void cpu_hotplug_init(void);
73extern void cpu_maps_update_begin(void);
74extern void cpu_maps_update_done(void);
74 75
75#else 76#else /* CONFIG_SMP */
76 77
77static inline int register_cpu_notifier(struct notifier_block *nb) 78static inline int register_cpu_notifier(struct notifier_block *nb)
78{ 79{
@@ -87,10 +88,16 @@ static inline void cpu_hotplug_init(void)
87{ 88{
88} 89}
89 90
91static inline void cpu_maps_update_begin(void)
92{
93}
94
95static inline void cpu_maps_update_done(void)
96{
97}
98
90#endif /* CONFIG_SMP */ 99#endif /* CONFIG_SMP */
91extern struct sysdev_class cpu_sysdev_class; 100extern struct sysdev_class cpu_sysdev_class;
92extern void cpu_maps_update_begin(void);
93extern void cpu_maps_update_done(void);
94 101
95#ifdef CONFIG_HOTPLUG_CPU 102#ifdef CONFIG_HOTPLUG_CPU
96/* Stop CPUs going up and down. */ 103/* Stop CPUs going up and down. */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index e7e91dbfde0..2270ca5ec63 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -4,9 +4,6 @@
4 * Copyright (C) 2001 Russell King 4 * Copyright (C) 2001 Russell King
5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> 5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
6 * 6 *
7 *
8 * $Id: cpufreq.h,v 1.36 2003/01/20 17:31:48 db Exp $
9 *
10 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 51e6b1e520e..dcf77fa826b 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -82,6 +82,7 @@ struct cpuidle_state_kobj {
82}; 82};
83 83
84struct cpuidle_device { 84struct cpuidle_device {
85 unsigned int registered:1;
85 unsigned int enabled:1; 86 unsigned int enabled:1;
86 unsigned int cpu; 87 unsigned int cpu;
87 88
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 9650806fe2e..96d0509fb8d 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -17,6 +17,20 @@
17 * For details of cpus_onto(), see bitmap_onto in lib/bitmap.c. 17 * For details of cpus_onto(), see bitmap_onto in lib/bitmap.c.
18 * For details of cpus_fold(), see bitmap_fold in lib/bitmap.c. 18 * For details of cpus_fold(), see bitmap_fold in lib/bitmap.c.
19 * 19 *
20 * . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21 * Note: The alternate operations with the suffix "_nr" are used
22 * to limit the range of the loop to nr_cpu_ids instead of
23 * NR_CPUS when NR_CPUS > 64 for performance reasons.
24 * If NR_CPUS is <= 64 then most assembler bitmask
25 * operators execute faster with a constant range, so
26 * the operator will continue to use NR_CPUS.
27 *
28 * Another consideration is that nr_cpu_ids is initialized
29 * to NR_CPUS and isn't lowered until the possible cpus are
30 * discovered (including any disabled cpus). So early uses
31 * will span the entire range of NR_CPUS.
32 * . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33 *
20 * The available cpumask operations are: 34 * The available cpumask operations are:
21 * 35 *
22 * void cpu_set(cpu, mask) turn on bit 'cpu' in mask 36 * void cpu_set(cpu, mask) turn on bit 'cpu' in mask
@@ -38,18 +52,52 @@
38 * int cpus_empty(mask) Is mask empty (no bits sets)? 52 * int cpus_empty(mask) Is mask empty (no bits sets)?
39 * int cpus_full(mask) Is mask full (all bits sets)? 53 * int cpus_full(mask) Is mask full (all bits sets)?
40 * int cpus_weight(mask) Hamming weigh - number of set bits 54 * int cpus_weight(mask) Hamming weigh - number of set bits
55 * int cpus_weight_nr(mask) Same using nr_cpu_ids instead of NR_CPUS
41 * 56 *
42 * void cpus_shift_right(dst, src, n) Shift right 57 * void cpus_shift_right(dst, src, n) Shift right
43 * void cpus_shift_left(dst, src, n) Shift left 58 * void cpus_shift_left(dst, src, n) Shift left
44 * 59 *
45 * int first_cpu(mask) Number lowest set bit, or NR_CPUS 60 * int first_cpu(mask) Number lowest set bit, or NR_CPUS
46 * int next_cpu(cpu, mask) Next cpu past 'cpu', or NR_CPUS 61 * int next_cpu(cpu, mask) Next cpu past 'cpu', or NR_CPUS
62 * int next_cpu_nr(cpu, mask) Next cpu past 'cpu', or nr_cpu_ids
47 * 63 *
48 * cpumask_t cpumask_of_cpu(cpu) Return cpumask with bit 'cpu' set 64 * cpumask_t cpumask_of_cpu(cpu) Return cpumask with bit 'cpu' set
65 * (can be used as an lvalue)
49 * CPU_MASK_ALL Initializer - all bits set 66 * CPU_MASK_ALL Initializer - all bits set
50 * CPU_MASK_NONE Initializer - no bits set 67 * CPU_MASK_NONE Initializer - no bits set
51 * unsigned long *cpus_addr(mask) Array of unsigned long's in mask 68 * unsigned long *cpus_addr(mask) Array of unsigned long's in mask
52 * 69 *
70 * CPUMASK_ALLOC kmalloc's a structure that is a composite of many cpumask_t
71 * variables, and CPUMASK_PTR provides pointers to each field.
72 *
73 * The structure should be defined something like this:
74 * struct my_cpumasks {
75 * cpumask_t mask1;
76 * cpumask_t mask2;
77 * };
78 *
79 * Usage is then:
80 * CPUMASK_ALLOC(my_cpumasks);
81 * CPUMASK_PTR(mask1, my_cpumasks);
82 * CPUMASK_PTR(mask2, my_cpumasks);
83 *
84 * --- DO NOT reference cpumask_t pointers until this check ---
85 * if (my_cpumasks == NULL)
86 * "kmalloc failed"...
87 *
88 * References are now pointers to the cpumask_t variables (*mask1, ...)
89 *
90 *if NR_CPUS > BITS_PER_LONG
91 * CPUMASK_ALLOC(m) Declares and allocates struct m *m =
92 * kmalloc(sizeof(*m), GFP_KERNEL)
93 * CPUMASK_FREE(m) Macro for kfree(m)
94 *else
95 * CPUMASK_ALLOC(m) Declares struct m _m, *m = &_m
96 * CPUMASK_FREE(m) Nop
97 *endif
98 * CPUMASK_PTR(v, m) Declares cpumask_t *v = &(m->v)
99 * ------------------------------------------------------------------------
100 *
53 * int cpumask_scnprintf(buf, len, mask) Format cpumask for printing 101 * int cpumask_scnprintf(buf, len, mask) Format cpumask for printing
54 * int cpumask_parse_user(ubuf, ulen, mask) Parse ascii string as cpumask 102 * int cpumask_parse_user(ubuf, ulen, mask) Parse ascii string as cpumask
55 * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing 103 * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing
@@ -59,7 +107,8 @@
59 * void cpus_onto(dst, orig, relmap) *dst = orig relative to relmap 107 * void cpus_onto(dst, orig, relmap) *dst = orig relative to relmap
60 * void cpus_fold(dst, orig, sz) dst bits = orig bits mod sz 108 * void cpus_fold(dst, orig, sz) dst bits = orig bits mod sz
61 * 109 *
62 * for_each_cpu_mask(cpu, mask) for-loop cpu over mask 110 * for_each_cpu_mask(cpu, mask) for-loop cpu over mask using NR_CPUS
111 * for_each_cpu_mask_nr(cpu, mask) for-loop cpu over mask using nr_cpu_ids
63 * 112 *
64 * int num_online_cpus() Number of online CPUs 113 * int num_online_cpus() Number of online CPUs
65 * int num_possible_cpus() Number of all possible CPUs 114 * int num_possible_cpus() Number of all possible CPUs
@@ -216,33 +265,30 @@ static inline void __cpus_shift_left(cpumask_t *dstp,
216 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); 265 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
217} 266}
218 267
219#ifdef CONFIG_SMP 268/*
220int __first_cpu(const cpumask_t *srcp); 269 * Special-case data structure for "single bit set only" constant CPU masks.
221#define first_cpu(src) __first_cpu(&(src)) 270 *
222int __next_cpu(int n, const cpumask_t *srcp); 271 * We pre-generate all the 64 (or 32) possible bit positions, with enough
223#define next_cpu(n, src) __next_cpu((n), &(src)) 272 * padding to the left and the right, and return the constant pointer
224#else 273 * appropriately offset.
225#define first_cpu(src) ({ (void)(src); 0; }) 274 */
226#define next_cpu(n, src) ({ (void)(src); 1; }) 275extern const unsigned long
227#endif 276 cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)];
228 277
229#ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP 278static inline const cpumask_t *get_cpu_mask(unsigned int cpu)
230extern cpumask_t *cpumask_of_cpu_map; 279{
231#define cpumask_of_cpu(cpu) (cpumask_of_cpu_map[cpu]) 280 const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG];
281 p -= cpu / BITS_PER_LONG;
282 return (const cpumask_t *)p;
283}
284
285/*
286 * In cases where we take the address of the cpumask immediately,
287 * gcc optimizes it out (it's a constant) and there's no huge stack
288 * variable created:
289 */
290#define cpumask_of_cpu(cpu) ({ *get_cpu_mask(cpu); })
232 291
233#else
234#define cpumask_of_cpu(cpu) \
235(*({ \
236 typeof(_unused_cpumask_arg_) m; \
237 if (sizeof(m) == sizeof(unsigned long)) { \
238 m.bits[0] = 1UL<<(cpu); \
239 } else { \
240 cpus_clear(m); \
241 cpu_set((cpu), m); \
242 } \
243 &m; \
244}))
245#endif
246 292
247#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS) 293#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
248 294
@@ -281,6 +327,15 @@ extern cpumask_t cpu_mask_all;
281 327
282#define cpus_addr(src) ((src).bits) 328#define cpus_addr(src) ((src).bits)
283 329
330#if NR_CPUS > BITS_PER_LONG
331#define CPUMASK_ALLOC(m) struct m *m = kmalloc(sizeof(*m), GFP_KERNEL)
332#define CPUMASK_FREE(m) kfree(m)
333#else
334#define CPUMASK_ALLOC(m) struct m _m, *m = &_m
335#define CPUMASK_FREE(m)
336#endif
337#define CPUMASK_PTR(v, m) cpumask_t *v = &(m->v)
338
284#define cpumask_scnprintf(buf, len, src) \ 339#define cpumask_scnprintf(buf, len, src) \
285 __cpumask_scnprintf((buf), (len), &(src), NR_CPUS) 340 __cpumask_scnprintf((buf), (len), &(src), NR_CPUS)
286static inline int __cpumask_scnprintf(char *buf, int len, 341static inline int __cpumask_scnprintf(char *buf, int len,
@@ -289,13 +344,6 @@ static inline int __cpumask_scnprintf(char *buf, int len,
289 return bitmap_scnprintf(buf, len, srcp->bits, nbits); 344 return bitmap_scnprintf(buf, len, srcp->bits, nbits);
290} 345}
291 346
292#define cpumask_scnprintf_len(len) \
293 __cpumask_scnprintf_len((len))
294static inline int __cpumask_scnprintf_len(int len)
295{
296 return bitmap_scnprintf_len(len);
297}
298
299#define cpumask_parse_user(ubuf, ulen, dst) \ 347#define cpumask_parse_user(ubuf, ulen, dst) \
300 __cpumask_parse_user((ubuf), (ulen), &(dst), NR_CPUS) 348 __cpumask_parse_user((ubuf), (ulen), &(dst), NR_CPUS)
301static inline int __cpumask_parse_user(const char __user *buf, int len, 349static inline int __cpumask_parse_user(const char __user *buf, int len,
@@ -350,25 +398,59 @@ static inline void __cpus_fold(cpumask_t *dstp, const cpumask_t *origp,
350 bitmap_fold(dstp->bits, origp->bits, sz, nbits); 398 bitmap_fold(dstp->bits, origp->bits, sz, nbits);
351} 399}
352 400
353#if NR_CPUS > 1 401#if NR_CPUS == 1
354#define for_each_cpu_mask(cpu, mask) \ 402
355 for ((cpu) = first_cpu(mask); \ 403#define nr_cpu_ids 1
356 (cpu) < NR_CPUS; \ 404#define first_cpu(src) ({ (void)(src); 0; })
357 (cpu) = next_cpu((cpu), (mask))) 405#define next_cpu(n, src) ({ (void)(src); 1; })
358#else /* NR_CPUS == 1 */ 406#define any_online_cpu(mask) 0
359#define for_each_cpu_mask(cpu, mask) \ 407#define for_each_cpu_mask(cpu, mask) \
360 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) 408 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
361#endif /* NR_CPUS */ 409
410#else /* NR_CPUS > 1 */
411
412extern int nr_cpu_ids;
413int __first_cpu(const cpumask_t *srcp);
414int __next_cpu(int n, const cpumask_t *srcp);
415int __any_online_cpu(const cpumask_t *mask);
416
417#define first_cpu(src) __first_cpu(&(src))
418#define next_cpu(n, src) __next_cpu((n), &(src))
419#define any_online_cpu(mask) __any_online_cpu(&(mask))
420#define for_each_cpu_mask(cpu, mask) \
421 for ((cpu) = -1; \
422 (cpu) = next_cpu((cpu), (mask)), \
423 (cpu) < NR_CPUS; )
424#endif
425
426#if NR_CPUS <= 64
427
428#define next_cpu_nr(n, src) next_cpu(n, src)
429#define cpus_weight_nr(cpumask) cpus_weight(cpumask)
430#define for_each_cpu_mask_nr(cpu, mask) for_each_cpu_mask(cpu, mask)
431
432#else /* NR_CPUS > 64 */
433
434int __next_cpu_nr(int n, const cpumask_t *srcp);
435#define next_cpu_nr(n, src) __next_cpu_nr((n), &(src))
436#define cpus_weight_nr(cpumask) __cpus_weight(&(cpumask), nr_cpu_ids)
437#define for_each_cpu_mask_nr(cpu, mask) \
438 for ((cpu) = -1; \
439 (cpu) = next_cpu_nr((cpu), (mask)), \
440 (cpu) < nr_cpu_ids; )
441
442#endif /* NR_CPUS > 64 */
362 443
363/* 444/*
364 * The following particular system cpumasks and operations manage 445 * The following particular system cpumasks and operations manage
365 * possible, present and online cpus. Each of them is a fixed size 446 * possible, present, active and online cpus. Each of them is a fixed size
366 * bitmap of size NR_CPUS. 447 * bitmap of size NR_CPUS.
367 * 448 *
368 * #ifdef CONFIG_HOTPLUG_CPU 449 * #ifdef CONFIG_HOTPLUG_CPU
369 * cpu_possible_map - has bit 'cpu' set iff cpu is populatable 450 * cpu_possible_map - has bit 'cpu' set iff cpu is populatable
370 * cpu_present_map - has bit 'cpu' set iff cpu is populated 451 * cpu_present_map - has bit 'cpu' set iff cpu is populated
371 * cpu_online_map - has bit 'cpu' set iff cpu available to scheduler 452 * cpu_online_map - has bit 'cpu' set iff cpu available to scheduler
453 * cpu_active_map - has bit 'cpu' set iff cpu available to migration
372 * #else 454 * #else
373 * cpu_possible_map - has bit 'cpu' set iff cpu is populated 455 * cpu_possible_map - has bit 'cpu' set iff cpu is populated
374 * cpu_present_map - copy of cpu_possible_map 456 * cpu_present_map - copy of cpu_possible_map
@@ -419,14 +501,16 @@ static inline void __cpus_fold(cpumask_t *dstp, const cpumask_t *origp,
419extern cpumask_t cpu_possible_map; 501extern cpumask_t cpu_possible_map;
420extern cpumask_t cpu_online_map; 502extern cpumask_t cpu_online_map;
421extern cpumask_t cpu_present_map; 503extern cpumask_t cpu_present_map;
504extern cpumask_t cpu_active_map;
422 505
423#if NR_CPUS > 1 506#if NR_CPUS > 1
424#define num_online_cpus() cpus_weight(cpu_online_map) 507#define num_online_cpus() cpus_weight_nr(cpu_online_map)
425#define num_possible_cpus() cpus_weight(cpu_possible_map) 508#define num_possible_cpus() cpus_weight_nr(cpu_possible_map)
426#define num_present_cpus() cpus_weight(cpu_present_map) 509#define num_present_cpus() cpus_weight_nr(cpu_present_map)
427#define cpu_online(cpu) cpu_isset((cpu), cpu_online_map) 510#define cpu_online(cpu) cpu_isset((cpu), cpu_online_map)
428#define cpu_possible(cpu) cpu_isset((cpu), cpu_possible_map) 511#define cpu_possible(cpu) cpu_isset((cpu), cpu_possible_map)
429#define cpu_present(cpu) cpu_isset((cpu), cpu_present_map) 512#define cpu_present(cpu) cpu_isset((cpu), cpu_present_map)
513#define cpu_active(cpu) cpu_isset((cpu), cpu_active_map)
430#else 514#else
431#define num_online_cpus() 1 515#define num_online_cpus() 1
432#define num_possible_cpus() 1 516#define num_possible_cpus() 1
@@ -434,21 +518,13 @@ extern cpumask_t cpu_present_map;
434#define cpu_online(cpu) ((cpu) == 0) 518#define cpu_online(cpu) ((cpu) == 0)
435#define cpu_possible(cpu) ((cpu) == 0) 519#define cpu_possible(cpu) ((cpu) == 0)
436#define cpu_present(cpu) ((cpu) == 0) 520#define cpu_present(cpu) ((cpu) == 0)
521#define cpu_active(cpu) ((cpu) == 0)
437#endif 522#endif
438 523
439#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) 524#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
440 525
441#ifdef CONFIG_SMP 526#define for_each_possible_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_possible_map)
442extern int nr_cpu_ids; 527#define for_each_online_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_online_map)
443#define any_online_cpu(mask) __any_online_cpu(&(mask)) 528#define for_each_present_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_present_map)
444int __any_online_cpu(const cpumask_t *mask);
445#else
446#define nr_cpu_ids 1
447#define any_online_cpu(mask) 0
448#endif
449
450#define for_each_possible_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
451#define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map)
452#define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map)
453 529
454#endif /* __LINUX_CPUMASK_H */ 530#endif /* __LINUX_CPUMASK_H */
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 038578362b4..e8f450c499b 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -78,6 +78,8 @@ extern void cpuset_track_online_nodes(void);
78 78
79extern int current_cpuset_is_being_rebound(void); 79extern int current_cpuset_is_being_rebound(void);
80 80
81extern void rebuild_sched_domains(void);
82
81#else /* !CONFIG_CPUSETS */ 83#else /* !CONFIG_CPUSETS */
82 84
83static inline int cpuset_init_early(void) { return 0; } 85static inline int cpuset_init_early(void) { return 0; }
@@ -156,6 +158,11 @@ static inline int current_cpuset_is_being_rebound(void)
156 return 0; 158 return 0;
157} 159}
158 160
161static inline void rebuild_sched_domains(void)
162{
163 partition_sched_domains(0, NULL, NULL);
164}
165
159#endif /* !CONFIG_CPUSETS */ 166#endif /* !CONFIG_CPUSETS */
160 167
161#endif /* _LINUX_CPUSET_H */ 168#endif /* _LINUX_CPUSET_H */
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 22c7ac5cd80..025e4f57510 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -8,7 +8,13 @@
8#include <linux/proc_fs.h> 8#include <linux/proc_fs.h>
9 9
10#define ELFCORE_ADDR_MAX (-1ULL) 10#define ELFCORE_ADDR_MAX (-1ULL)
11
12#ifdef CONFIG_PROC_VMCORE
11extern unsigned long long elfcorehdr_addr; 13extern unsigned long long elfcorehdr_addr;
14#else
15static const unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
16#endif
17
12extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, 18extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
13 unsigned long, int); 19 unsigned long, int);
14extern const struct file_operations proc_vmcore_operations; 20extern const struct file_operations proc_vmcore_operations;
@@ -22,5 +28,13 @@ extern struct proc_dir_entry *proc_vmcore;
22 28
23#define vmcore_elf_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x)) 29#define vmcore_elf_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x))
24 30
31static inline int is_kdump_kernel(void)
32{
33 return (elfcorehdr_addr != ELFCORE_ADDR_MAX) ? 1 : 0;
34}
35#else /* !CONFIG_CRASH_DUMP */
36static inline int is_kdump_kernel(void) { return 0; }
25#endif /* CONFIG_CRASH_DUMP */ 37#endif /* CONFIG_CRASH_DUMP */
38
39extern unsigned long saved_max_pfn;
26#endif /* LINUX_CRASHDUMP_H */ 40#endif /* LINUX_CRASHDUMP_H */
diff --git a/include/linux/crc-t10dif.h b/include/linux/crc-t10dif.h
new file mode 100644
index 00000000000..a9c96d865ee
--- /dev/null
+++ b/include/linux/crc-t10dif.h
@@ -0,0 +1,8 @@
1#ifndef _LINUX_CRC_T10DIF_H
2#define _LINUX_CRC_T10DIF_H
3
4#include <linux/types.h>
5
6__u16 crc_t10dif(unsigned char const *, size_t);
7
8#endif
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 425824bd49f..c43dc47fdf7 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -30,15 +30,17 @@
30 */ 30 */
31#define CRYPTO_ALG_TYPE_MASK 0x0000000f 31#define CRYPTO_ALG_TYPE_MASK 0x0000000f
32#define CRYPTO_ALG_TYPE_CIPHER 0x00000001 32#define CRYPTO_ALG_TYPE_CIPHER 0x00000001
33#define CRYPTO_ALG_TYPE_DIGEST 0x00000002 33#define CRYPTO_ALG_TYPE_COMPRESS 0x00000002
34#define CRYPTO_ALG_TYPE_HASH 0x00000003 34#define CRYPTO_ALG_TYPE_AEAD 0x00000003
35#define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004 35#define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004
36#define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005 36#define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005
37#define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006 37#define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006
38#define CRYPTO_ALG_TYPE_COMPRESS 0x00000008 38#define CRYPTO_ALG_TYPE_DIGEST 0x00000008
39#define CRYPTO_ALG_TYPE_AEAD 0x00000009 39#define CRYPTO_ALG_TYPE_HASH 0x00000009
40#define CRYPTO_ALG_TYPE_AHASH 0x0000000a
40 41
41#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e 42#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e
43#define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000c
42#define CRYPTO_ALG_TYPE_BLKCIPHER_MASK 0x0000000c 44#define CRYPTO_ALG_TYPE_BLKCIPHER_MASK 0x0000000c
43 45
44#define CRYPTO_ALG_LARVAL 0x00000010 46#define CRYPTO_ALG_LARVAL 0x00000010
@@ -102,6 +104,7 @@ struct crypto_async_request;
102struct crypto_aead; 104struct crypto_aead;
103struct crypto_blkcipher; 105struct crypto_blkcipher;
104struct crypto_hash; 106struct crypto_hash;
107struct crypto_ahash;
105struct crypto_tfm; 108struct crypto_tfm;
106struct crypto_type; 109struct crypto_type;
107struct aead_givcrypt_request; 110struct aead_givcrypt_request;
@@ -131,6 +134,16 @@ struct ablkcipher_request {
131 void *__ctx[] CRYPTO_MINALIGN_ATTR; 134 void *__ctx[] CRYPTO_MINALIGN_ATTR;
132}; 135};
133 136
137struct ahash_request {
138 struct crypto_async_request base;
139
140 unsigned int nbytes;
141 struct scatterlist *src;
142 u8 *result;
143
144 void *__ctx[] CRYPTO_MINALIGN_ATTR;
145};
146
134/** 147/**
135 * struct aead_request - AEAD request 148 * struct aead_request - AEAD request
136 * @base: Common attributes for async crypto requests 149 * @base: Common attributes for async crypto requests
@@ -195,6 +208,17 @@ struct ablkcipher_alg {
195 unsigned int ivsize; 208 unsigned int ivsize;
196}; 209};
197 210
211struct ahash_alg {
212 int (*init)(struct ahash_request *req);
213 int (*update)(struct ahash_request *req);
214 int (*final)(struct ahash_request *req);
215 int (*digest)(struct ahash_request *req);
216 int (*setkey)(struct crypto_ahash *tfm, const u8 *key,
217 unsigned int keylen);
218
219 unsigned int digestsize;
220};
221
198struct aead_alg { 222struct aead_alg {
199 int (*setkey)(struct crypto_aead *tfm, const u8 *key, 223 int (*setkey)(struct crypto_aead *tfm, const u8 *key,
200 unsigned int keylen); 224 unsigned int keylen);
@@ -272,6 +296,7 @@ struct compress_alg {
272#define cra_cipher cra_u.cipher 296#define cra_cipher cra_u.cipher
273#define cra_digest cra_u.digest 297#define cra_digest cra_u.digest
274#define cra_hash cra_u.hash 298#define cra_hash cra_u.hash
299#define cra_ahash cra_u.ahash
275#define cra_compress cra_u.compress 300#define cra_compress cra_u.compress
276 301
277struct crypto_alg { 302struct crypto_alg {
@@ -298,6 +323,7 @@ struct crypto_alg {
298 struct cipher_alg cipher; 323 struct cipher_alg cipher;
299 struct digest_alg digest; 324 struct digest_alg digest;
300 struct hash_alg hash; 325 struct hash_alg hash;
326 struct ahash_alg ahash;
301 struct compress_alg compress; 327 struct compress_alg compress;
302 } cra_u; 328 } cra_u;
303 329
@@ -383,6 +409,18 @@ struct hash_tfm {
383 unsigned int digestsize; 409 unsigned int digestsize;
384}; 410};
385 411
412struct ahash_tfm {
413 int (*init)(struct ahash_request *req);
414 int (*update)(struct ahash_request *req);
415 int (*final)(struct ahash_request *req);
416 int (*digest)(struct ahash_request *req);
417 int (*setkey)(struct crypto_ahash *tfm, const u8 *key,
418 unsigned int keylen);
419
420 unsigned int digestsize;
421 unsigned int reqsize;
422};
423
386struct compress_tfm { 424struct compress_tfm {
387 int (*cot_compress)(struct crypto_tfm *tfm, 425 int (*cot_compress)(struct crypto_tfm *tfm,
388 const u8 *src, unsigned int slen, 426 const u8 *src, unsigned int slen,
@@ -397,6 +435,7 @@ struct compress_tfm {
397#define crt_blkcipher crt_u.blkcipher 435#define crt_blkcipher crt_u.blkcipher
398#define crt_cipher crt_u.cipher 436#define crt_cipher crt_u.cipher
399#define crt_hash crt_u.hash 437#define crt_hash crt_u.hash
438#define crt_ahash crt_u.ahash
400#define crt_compress crt_u.compress 439#define crt_compress crt_u.compress
401 440
402struct crypto_tfm { 441struct crypto_tfm {
@@ -409,6 +448,7 @@ struct crypto_tfm {
409 struct blkcipher_tfm blkcipher; 448 struct blkcipher_tfm blkcipher;
410 struct cipher_tfm cipher; 449 struct cipher_tfm cipher;
411 struct hash_tfm hash; 450 struct hash_tfm hash;
451 struct ahash_tfm ahash;
412 struct compress_tfm compress; 452 struct compress_tfm compress;
413 } crt_u; 453 } crt_u;
414 454
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index 504cb2c3fa9..2d3d1e04ba9 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -550,11 +550,11 @@ struct cyclades_icount {
550 550
551struct cyclades_port { 551struct cyclades_port {
552 int magic; 552 int magic;
553 struct tty_port port;
553 struct cyclades_card *card; 554 struct cyclades_card *card;
554 int line; 555 int line;
555 int flags; /* defined in tty.h */ 556 int flags; /* defined in tty.h */
556 int type; /* UART type */ 557 int type; /* UART type */
557 struct tty_struct *tty;
558 int read_status_mask; 558 int read_status_mask;
559 int ignore_status_mask; 559 int ignore_status_mask;
560 int timeout; 560 int timeout;
@@ -567,13 +567,8 @@ struct cyclades_port {
567 int chip_rev; 567 int chip_rev;
568 int custom_divisor; 568 int custom_divisor;
569 u8 x_char; /* to be pushed out ASAP */ 569 u8 x_char; /* to be pushed out ASAP */
570 int close_delay;
571 unsigned short closing_wait;
572 int count; /* # of fd on device */
573 int breakon; 570 int breakon;
574 int breakoff; 571 int breakoff;
575 int blocked_open; /* # of blocked opens */
576 unsigned char *xmit_buf;
577 int xmit_head; 572 int xmit_head;
578 int xmit_tail; 573 int xmit_tail;
579 int xmit_cnt; 574 int xmit_cnt;
@@ -583,16 +578,14 @@ struct cyclades_port {
583 struct cyclades_monitor mon; 578 struct cyclades_monitor mon;
584 struct cyclades_idle_stats idle_stats; 579 struct cyclades_idle_stats idle_stats;
585 struct cyclades_icount icount; 580 struct cyclades_icount icount;
586 wait_queue_head_t open_wait;
587 wait_queue_head_t close_wait;
588 struct completion shutdown_wait; 581 struct completion shutdown_wait;
589 wait_queue_head_t delta_msr_wait; 582 wait_queue_head_t delta_msr_wait;
590 int throttle; 583 int throttle;
591}; 584};
592 585
593#define CLOSING_WAIT_DELAY 30*HZ 586#define CLOSING_WAIT_DELAY 30*HZ
594#define CY_CLOSING_WAIT_NONE 65535 587#define CY_CLOSING_WAIT_NONE ASYNC_CLOSING_WAIT_NONE
595#define CY_CLOSING_WAIT_INF 0 588#define CY_CLOSING_WAIT_INF ASYNC_CLOSING_WAIT_INF
596 589
597 590
598#define CyMAX_CHIPS_PER_CARD 8 591#define CyMAX_CHIPS_PER_CARD 8
diff --git a/include/linux/dca.h b/include/linux/dca.h
index af61cd1f37e..b00a753eda5 100644
--- a/include/linux/dca.h
+++ b/include/linux/dca.h
@@ -10,6 +10,7 @@ void dca_unregister_notify(struct notifier_block *nb);
10#define DCA_PROVIDER_REMOVE 0x0002 10#define DCA_PROVIDER_REMOVE 0x0002
11 11
12struct dca_provider { 12struct dca_provider {
13 struct list_head node;
13 struct dca_ops *ops; 14 struct dca_ops *ops;
14 struct device *cd; 15 struct device *cd;
15 int id; 16 int id;
@@ -18,7 +19,9 @@ struct dca_provider {
18struct dca_ops { 19struct dca_ops {
19 int (*add_requester) (struct dca_provider *, struct device *); 20 int (*add_requester) (struct dca_provider *, struct device *);
20 int (*remove_requester) (struct dca_provider *, struct device *); 21 int (*remove_requester) (struct dca_provider *, struct device *);
21 u8 (*get_tag) (struct dca_provider *, int cpu); 22 u8 (*get_tag) (struct dca_provider *, struct device *,
23 int cpu);
24 int (*dev_managed) (struct dca_provider *, struct device *);
22}; 25};
23 26
24struct dca_provider *alloc_dca_provider(struct dca_ops *ops, int priv_size); 27struct dca_provider *alloc_dca_provider(struct dca_ops *ops, int priv_size);
@@ -32,9 +35,11 @@ static inline void *dca_priv(struct dca_provider *dca)
32} 35}
33 36
34/* Requester API */ 37/* Requester API */
38#define DCA_GET_TAG_TWO_ARGS
35int dca_add_requester(struct device *dev); 39int dca_add_requester(struct device *dev);
36int dca_remove_requester(struct device *dev); 40int dca_remove_requester(struct device *dev);
37u8 dca_get_tag(int cpu); 41u8 dca_get_tag(int cpu);
42u8 dca3_get_tag(struct device *dev, int cpu);
38 43
39/* internal stuff */ 44/* internal stuff */
40int __init dca_sysfs_init(void); 45int __init dca_sysfs_init(void);
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 2a6639407c8..98202c672fd 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -3,6 +3,7 @@
3 3
4#include <asm/atomic.h> 4#include <asm/atomic.h>
5#include <linux/list.h> 5#include <linux/list.h>
6#include <linux/rculist.h>
6#include <linux/spinlock.h> 7#include <linux/spinlock.h>
7#include <linux/cache.h> 8#include <linux/cache.h>
8#include <linux/rcupdate.h> 9#include <linux/rcupdate.h>
@@ -300,7 +301,7 @@ extern int d_validate(struct dentry *, struct dentry *);
300extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); 301extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
301 302
302extern char *__d_path(const struct path *path, struct path *root, char *, int); 303extern char *__d_path(const struct path *path, struct path *root, char *, int);
303extern char *d_path(struct path *, char *, int); 304extern char *d_path(const struct path *, char *, int);
304extern char *dentry_path(struct dentry *, char *, int); 305extern char *dentry_path(struct dentry *, char *, int);
305 306
306/* Allocation counts.. */ 307/* Allocation counts.. */
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index aa0737019e3..6080449fbec 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -364,8 +364,6 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
364/* FIXME: for now we're default to 1 but it should really be 0 */ 364/* FIXME: for now we're default to 1 but it should really be 0 */
365#define DCCPF_INITIAL_SEND_NDP_COUNT 1 365#define DCCPF_INITIAL_SEND_NDP_COUNT 1
366 366
367#define DCCP_NDP_LIMIT 0xFFFFFF
368
369/** 367/**
370 * struct dccp_minisock - Minimal DCCP connection representation 368 * struct dccp_minisock - Minimal DCCP connection representation
371 * 369 *
@@ -437,7 +435,7 @@ extern int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq,
437 struct sk_buff *skb); 435 struct sk_buff *skb);
438 436
439struct dccp_options_received { 437struct dccp_options_received {
440 u32 dccpor_ndp; /* only 24 bits */ 438 u64 dccpor_ndp:48;
441 u32 dccpor_timestamp; 439 u32 dccpor_timestamp;
442 u32 dccpor_timestamp_echo; 440 u32 dccpor_timestamp_echo;
443 u32 dccpor_elapsed_time; 441 u32 dccpor_elapsed_time;
@@ -533,7 +531,7 @@ struct dccp_sock {
533 __u16 dccps_r_ack_ratio; 531 __u16 dccps_r_ack_ratio;
534 __u16 dccps_pcslen; 532 __u16 dccps_pcslen;
535 __u16 dccps_pcrlen; 533 __u16 dccps_pcrlen;
536 unsigned long dccps_ndp_count; 534 __u64 dccps_ndp_count:48;
537 unsigned long dccps_rate_last; 535 unsigned long dccps_rate_last;
538 struct dccp_minisock dccps_minisock; 536 struct dccp_minisock dccps_minisock;
539 struct dccp_ackvec *dccps_hc_rx_ackvec; 537 struct dccp_ackvec *dccps_hc_rx_ackvec;
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
index f4a5871767f..4aaa4afb1cb 100644
--- a/include/linux/debug_locks.h
+++ b/include/linux/debug_locks.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_DEBUG_LOCKING_H 1#ifndef __LINUX_DEBUG_LOCKING_H
2#define __LINUX_DEBUG_LOCKING_H 2#define __LINUX_DEBUG_LOCKING_H
3 3
4#include <linux/kernel.h>
5
4struct task_struct; 6struct task_struct;
5 7
6extern int debug_locks; 8extern int debug_locks;
@@ -11,14 +13,6 @@ extern int debug_locks_silent;
11 */ 13 */
12extern int debug_locks_off(void); 14extern int debug_locks_off(void);
13 15
14/*
15 * In the debug case we carry the caller's instruction pointer into
16 * other functions, but we dont want the function argument overhead
17 * in the nondebug case - hence these macros:
18 */
19#define _RET_IP_ (unsigned long)__builtin_return_address(0)
20#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
21
22#define DEBUG_LOCKS_WARN_ON(c) \ 16#define DEBUG_LOCKS_WARN_ON(c) \
23({ \ 17({ \
24 int __ret = 0; \ 18 int __ret = 0; \
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 7266124361b..e1a6c046cea 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -26,6 +26,8 @@ struct debugfs_blob_wrapper {
26 unsigned long size; 26 unsigned long size;
27}; 27};
28 28
29extern struct dentry *arch_debugfs_dir;
30
29#if defined(CONFIG_DEBUG_FS) 31#if defined(CONFIG_DEBUG_FS)
30 32
31/* declared over in file.c */ 33/* declared over in file.c */
@@ -42,6 +44,7 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
42 const char *dest); 44 const char *dest);
43 45
44void debugfs_remove(struct dentry *dentry); 46void debugfs_remove(struct dentry *dentry);
47void debugfs_remove_recursive(struct dentry *dentry);
45 48
46struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, 49struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
47 struct dentry *new_dir, const char *new_name); 50 struct dentry *new_dir, const char *new_name);
@@ -99,6 +102,9 @@ static inline struct dentry *debugfs_create_symlink(const char *name,
99static inline void debugfs_remove(struct dentry *dentry) 102static inline void debugfs_remove(struct dentry *dentry)
100{ } 103{ }
101 104
105static inline void debugfs_remove_recursive(struct dentry *dentry)
106{ }
107
102static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, 108static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
103 struct dentry *new_dir, char *new_name) 109 struct dentry *new_dir, char *new_name)
104{ 110{
diff --git a/include/linux/delay.h b/include/linux/delay.h
index 54552d21296..fd832c6d419 100644
--- a/include/linux/delay.h
+++ b/include/linux/delay.h
@@ -41,6 +41,7 @@ static inline void ndelay(unsigned long x)
41#define ndelay(x) ndelay(x) 41#define ndelay(x) ndelay(x)
42#endif 42#endif
43 43
44extern unsigned long lpj_fine;
44void calibrate_delay(void); 45void calibrate_delay(void);
45void msleep(unsigned int msecs); 46void msleep(unsigned int msecs);
46unsigned long msleep_interruptible(unsigned int msecs); 47unsigned long msleep_interruptible(unsigned int msecs);
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h
index ab94bc08355..f352f06fa06 100644
--- a/include/linux/delayacct.h
+++ b/include/linux/delayacct.h
@@ -39,6 +39,8 @@ extern void __delayacct_blkio_start(void);
39extern void __delayacct_blkio_end(void); 39extern void __delayacct_blkio_end(void);
40extern int __delayacct_add_tsk(struct taskstats *, struct task_struct *); 40extern int __delayacct_add_tsk(struct taskstats *, struct task_struct *);
41extern __u64 __delayacct_blkio_ticks(struct task_struct *); 41extern __u64 __delayacct_blkio_ticks(struct task_struct *);
42extern void __delayacct_freepages_start(void);
43extern void __delayacct_freepages_end(void);
42 44
43static inline int delayacct_is_task_waiting_on_io(struct task_struct *p) 45static inline int delayacct_is_task_waiting_on_io(struct task_struct *p)
44{ 46{
@@ -107,6 +109,18 @@ static inline __u64 delayacct_blkio_ticks(struct task_struct *tsk)
107 return 0; 109 return 0;
108} 110}
109 111
112static inline void delayacct_freepages_start(void)
113{
114 if (current->delays)
115 __delayacct_freepages_start();
116}
117
118static inline void delayacct_freepages_end(void)
119{
120 if (current->delays)
121 __delayacct_freepages_end();
122}
123
110#else 124#else
111static inline void delayacct_set_flag(int flag) 125static inline void delayacct_set_flag(int flag)
112{} 126{}
@@ -129,6 +143,11 @@ static inline __u64 delayacct_blkio_ticks(struct task_struct *tsk)
129{ return 0; } 143{ return 0; }
130static inline int delayacct_is_task_waiting_on_io(struct task_struct *p) 144static inline int delayacct_is_task_waiting_on_io(struct task_struct *p)
131{ return 0; } 145{ return 0; }
146static inline void delayacct_freepages_start(void)
147{}
148static inline void delayacct_freepages_end(void)
149{}
150
132#endif /* CONFIG_TASK_DELAY_ACCT */ 151#endif /* CONFIG_TASK_DELAY_ACCT */
133 152
134#endif 153#endif
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 0d8d419d191..a90222e3297 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -9,11 +9,13 @@
9#define _LINUX_DEVICE_MAPPER_H 9#define _LINUX_DEVICE_MAPPER_H
10 10
11#include <linux/bio.h> 11#include <linux/bio.h>
12#include <linux/blkdev.h>
12 13
13struct dm_target; 14struct dm_target;
14struct dm_table; 15struct dm_table;
15struct dm_dev; 16struct dm_dev;
16struct mapped_device; 17struct mapped_device;
18struct bio_vec;
17 19
18typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t; 20typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t;
19 21
@@ -72,6 +74,9 @@ typedef int (*dm_ioctl_fn) (struct dm_target *ti, struct inode *inode,
72 struct file *filp, unsigned int cmd, 74 struct file *filp, unsigned int cmd,
73 unsigned long arg); 75 unsigned long arg);
74 76
77typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm,
78 struct bio_vec *biovec, int max_size);
79
75void dm_error(const char *message); 80void dm_error(const char *message);
76 81
77/* 82/*
@@ -107,6 +112,7 @@ struct target_type {
107 dm_status_fn status; 112 dm_status_fn status;
108 dm_message_fn message; 113 dm_message_fn message;
109 dm_ioctl_fn ioctl; 114 dm_ioctl_fn ioctl;
115 dm_merge_fn merge;
110}; 116};
111 117
112struct io_restrictions { 118struct io_restrictions {
diff --git a/include/linux/device.h b/include/linux/device.h
index 8c23e3dfe3a..d24a47f80f9 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -16,6 +16,7 @@
16#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/klist.h> 17#include <linux/klist.h>
18#include <linux/list.h> 18#include <linux/list.h>
19#include <linux/lockdep.h>
19#include <linux/compiler.h> 20#include <linux/compiler.h>
20#include <linux/types.h> 21#include <linux/types.h>
21#include <linux/module.h> 22#include <linux/module.h>
@@ -24,17 +25,13 @@
24#include <asm/atomic.h> 25#include <asm/atomic.h>
25#include <asm/device.h> 26#include <asm/device.h>
26 27
27#define DEVICE_NAME_SIZE 50 28#define BUS_ID_SIZE 20
28/* DEVICE_NAME_HALF is really less than half to accommodate slop */
29#define DEVICE_NAME_HALF __stringify(20)
30#define DEVICE_ID_SIZE 32
31#define BUS_ID_SIZE KOBJ_NAME_LEN
32
33 29
34struct device; 30struct device;
35struct device_driver; 31struct device_driver;
36struct driver_private; 32struct driver_private;
37struct class; 33struct class;
34struct class_private;
38struct bus_type; 35struct bus_type;
39struct bus_type_private; 36struct bus_type_private;
40 37
@@ -68,6 +65,8 @@ struct bus_type {
68 int (*resume_early)(struct device *dev); 65 int (*resume_early)(struct device *dev);
69 int (*resume)(struct device *dev); 66 int (*resume)(struct device *dev);
70 67
68 struct pm_ext_ops *pm;
69
71 struct bus_type_private *p; 70 struct bus_type_private *p;
72}; 71};
73 72
@@ -131,6 +130,8 @@ struct device_driver {
131 int (*resume) (struct device *dev); 130 int (*resume) (struct device *dev);
132 struct attribute_group **groups; 131 struct attribute_group **groups;
133 132
133 struct pm_ops *pm;
134
134 struct driver_private *p; 135 struct driver_private *p;
135}; 136};
136 137
@@ -182,14 +183,9 @@ struct class {
182 const char *name; 183 const char *name;
183 struct module *owner; 184 struct module *owner;
184 185
185 struct kset subsys;
186 struct list_head children;
187 struct list_head devices;
188 struct list_head interfaces;
189 struct kset class_dirs;
190 struct semaphore sem; /* locks children, devices, interfaces */
191 struct class_attribute *class_attrs; 186 struct class_attribute *class_attrs;
192 struct device_attribute *dev_attrs; 187 struct device_attribute *dev_attrs;
188 struct kobject *dev_kobj;
193 189
194 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 190 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
195 191
@@ -198,13 +194,30 @@ struct class {
198 194
199 int (*suspend)(struct device *dev, pm_message_t state); 195 int (*suspend)(struct device *dev, pm_message_t state);
200 int (*resume)(struct device *dev); 196 int (*resume)(struct device *dev);
197
198 struct pm_ops *pm;
199 struct class_private *p;
201}; 200};
202 201
203extern int __must_check class_register(struct class *class); 202extern struct kobject *sysfs_dev_block_kobj;
203extern struct kobject *sysfs_dev_char_kobj;
204extern int __must_check __class_register(struct class *class,
205 struct lock_class_key *key);
204extern void class_unregister(struct class *class); 206extern void class_unregister(struct class *class);
205extern int class_for_each_device(struct class *class, void *data, 207
208/* This is a #define to keep the compiler from merging different
209 * instances of the __key variable */
210#define class_register(class) \
211({ \
212 static struct lock_class_key __key; \
213 __class_register(class, &__key); \
214})
215
216extern int class_for_each_device(struct class *class, struct device *start,
217 void *data,
206 int (*fn)(struct device *dev, void *data)); 218 int (*fn)(struct device *dev, void *data));
207extern struct device *class_find_device(struct class *class, void *data, 219extern struct device *class_find_device(struct class *class,
220 struct device *start, void *data,
208 int (*match)(struct device *, void *)); 221 int (*match)(struct device *, void *));
209 222
210struct class_attribute { 223struct class_attribute {
@@ -232,9 +245,19 @@ struct class_interface {
232extern int __must_check class_interface_register(struct class_interface *); 245extern int __must_check class_interface_register(struct class_interface *);
233extern void class_interface_unregister(struct class_interface *); 246extern void class_interface_unregister(struct class_interface *);
234 247
235extern struct class *class_create(struct module *owner, const char *name); 248extern struct class * __must_check __class_create(struct module *owner,
249 const char *name,
250 struct lock_class_key *key);
236extern void class_destroy(struct class *cls); 251extern void class_destroy(struct class *cls);
237 252
253/* This is a #define to keep the compiler from merging different
254 * instances of the __key variable */
255#define class_create(owner, name) \
256({ \
257 static struct lock_class_key __key; \
258 __class_create(owner, name, &__key); \
259})
260
238/* 261/*
239 * The type of device, "struct device" is embedded in. A class 262 * The type of device, "struct device" is embedded in. A class
240 * or bus can contain devices of different types 263 * or bus can contain devices of different types
@@ -249,8 +272,11 @@ struct device_type {
249 struct attribute_group **groups; 272 struct attribute_group **groups;
250 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 273 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
251 void (*release)(struct device *dev); 274 void (*release)(struct device *dev);
275
252 int (*suspend)(struct device *dev, pm_message_t state); 276 int (*suspend)(struct device *dev, pm_message_t state);
253 int (*resume)(struct device *dev); 277 int (*resume)(struct device *dev);
278
279 struct pm_ops *pm;
254}; 280};
255 281
256/* interface for exporting device attributes */ 282/* interface for exporting device attributes */
@@ -386,6 +412,9 @@ static inline const char *dev_name(struct device *dev)
386 return dev->bus_id; 412 return dev->bus_id;
387} 413}
388 414
415extern int dev_set_name(struct device *dev, const char *name, ...)
416 __attribute__((format(printf, 2, 3)));
417
389#ifdef CONFIG_NUMA 418#ifdef CONFIG_NUMA
390static inline int dev_to_node(struct device *dev) 419static inline int dev_to_node(struct device *dev)
391{ 420{
@@ -450,9 +479,17 @@ extern int __must_check device_reprobe(struct device *dev);
450/* 479/*
451 * Easy functions for dynamically creating devices on the fly 480 * Easy functions for dynamically creating devices on the fly
452 */ 481 */
482extern struct device *device_create_vargs(struct class *cls,
483 struct device *parent,
484 dev_t devt,
485 void *drvdata,
486 const char *fmt,
487 va_list vargs);
453extern struct device *device_create(struct class *cls, struct device *parent, 488extern struct device *device_create(struct class *cls, struct device *parent,
454 dev_t devt, const char *fmt, ...) 489 dev_t devt, void *drvdata,
455 __attribute__((format(printf, 4, 5))); 490 const char *fmt, ...)
491 __attribute__((format(printf, 5, 6)));
492#define device_create_drvdata device_create
456extern void device_destroy(struct class *cls, dev_t devt); 493extern void device_destroy(struct class *cls, dev_t devt);
457 494
458/* 495/*
diff --git a/include/linux/dirent.h b/include/linux/dirent.h
index 5d6023b8780..f072fb8d10a 100644
--- a/include/linux/dirent.h
+++ b/include/linux/dirent.h
@@ -1,23 +1,6 @@
1#ifndef _LINUX_DIRENT_H 1#ifndef _LINUX_DIRENT_H
2#define _LINUX_DIRENT_H 2#define _LINUX_DIRENT_H
3 3
4struct dirent {
5 long d_ino;
6 __kernel_off_t d_off;
7 unsigned short d_reclen;
8 char d_name[256]; /* We must not include limits.h! */
9};
10
11struct dirent64 {
12 __u64 d_ino;
13 __s64 d_off;
14 unsigned short d_reclen;
15 unsigned char d_type;
16 char d_name[256];
17};
18
19#ifdef __KERNEL__
20
21struct linux_dirent64 { 4struct linux_dirent64 {
22 u64 d_ino; 5 u64 d_ino;
23 s64 d_off; 6 s64 d_off;
@@ -26,7 +9,4 @@ struct linux_dirent64 {
26 char d_name[0]; 9 char d_name[0];
27}; 10};
28 11
29#endif /* __KERNEL__ */
30
31
32#endif 12#endif
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index b03c41bbfa1..28c2940eb30 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -256,9 +256,9 @@ enum {
256#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) 256#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
257 257
258#define DM_VERSION_MAJOR 4 258#define DM_VERSION_MAJOR 4
259#define DM_VERSION_MINOR 13 259#define DM_VERSION_MINOR 14
260#define DM_VERSION_PATCHLEVEL 0 260#define DM_VERSION_PATCHLEVEL 0
261#define DM_VERSION_EXTRA "-ioctl (2007-10-18)" 261#define DM_VERSION_EXTRA "-ioctl (2008-04-23)"
262 262
263/* Status bits */ 263/* Status bits */
264#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 264#define DM_READONLY_FLAG (1 << 0) /* In/Out */
diff --git a/include/linux/dm9000.h b/include/linux/dm9000.h
index a3750462f9e..fc82446b642 100644
--- a/include/linux/dm9000.h
+++ b/include/linux/dm9000.h
@@ -21,6 +21,7 @@
21#define DM9000_PLATF_32BITONLY (0x0004) 21#define DM9000_PLATF_32BITONLY (0x0004)
22#define DM9000_PLATF_EXT_PHY (0x0008) 22#define DM9000_PLATF_EXT_PHY (0x0008)
23#define DM9000_PLATF_NO_EEPROM (0x0010) 23#define DM9000_PLATF_NO_EEPROM (0x0010)
24#define DM9000_PLATF_SIMPLE_PHY (0x0020) /* Use NSR to find LinkStatus */
24 25
25/* platfrom data for platfrom device structure's platfrom_data field */ 26/* platfrom data for platfrom device structure's platfrom_data field */
26 27
diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h
index 1677e2bfa00..71ad34eca6e 100644
--- a/include/linux/dma-attrs.h
+++ b/include/linux/dma-attrs.h
@@ -12,6 +12,7 @@
12 */ 12 */
13enum dma_attr { 13enum dma_attr {
14 DMA_ATTR_WRITE_BARRIER, 14 DMA_ATTR_WRITE_BARRIER,
15 DMA_ATTR_WEAK_ORDERING,
15 DMA_ATTR_MAX, 16 DMA_ATTR_MAX,
16}; 17};
17 18
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index d08a5c5eb92..adb0b084eb5 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -89,10 +89,23 @@ enum dma_transaction_type {
89 DMA_MEMSET, 89 DMA_MEMSET,
90 DMA_MEMCPY_CRC32C, 90 DMA_MEMCPY_CRC32C,
91 DMA_INTERRUPT, 91 DMA_INTERRUPT,
92 DMA_SLAVE,
92}; 93};
93 94
94/* last transaction type for creation of the capabilities mask */ 95/* last transaction type for creation of the capabilities mask */
95#define DMA_TX_TYPE_END (DMA_INTERRUPT + 1) 96#define DMA_TX_TYPE_END (DMA_SLAVE + 1)
97
98/**
99 * enum dma_slave_width - DMA slave register access width.
100 * @DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses
101 * @DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses
102 * @DMA_SLAVE_WIDTH_32BIT: Do 32-bit slave register accesses
103 */
104enum dma_slave_width {
105 DMA_SLAVE_WIDTH_8BIT,
106 DMA_SLAVE_WIDTH_16BIT,
107 DMA_SLAVE_WIDTH_32BIT,
108};
96 109
97/** 110/**
98 * enum dma_ctrl_flags - DMA flags to augment operation preparation, 111 * enum dma_ctrl_flags - DMA flags to augment operation preparation,
@@ -102,10 +115,14 @@ enum dma_transaction_type {
102 * @DMA_CTRL_ACK - the descriptor cannot be reused until the client 115 * @DMA_CTRL_ACK - the descriptor cannot be reused until the client
103 * acknowledges receipt, i.e. has has a chance to establish any 116 * acknowledges receipt, i.e. has has a chance to establish any
104 * dependency chains 117 * dependency chains
118 * @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s)
119 * @DMA_COMPL_SKIP_DEST_UNMAP - set to disable dma-unmapping the destination(s)
105 */ 120 */
106enum dma_ctrl_flags { 121enum dma_ctrl_flags {
107 DMA_PREP_INTERRUPT = (1 << 0), 122 DMA_PREP_INTERRUPT = (1 << 0),
108 DMA_CTRL_ACK = (1 << 1), 123 DMA_CTRL_ACK = (1 << 1),
124 DMA_COMPL_SKIP_SRC_UNMAP = (1 << 2),
125 DMA_COMPL_SKIP_DEST_UNMAP = (1 << 3),
109}; 126};
110 127
111/** 128/**
@@ -115,6 +132,32 @@ enum dma_ctrl_flags {
115typedef struct { DECLARE_BITMAP(bits, DMA_TX_TYPE_END); } dma_cap_mask_t; 132typedef struct { DECLARE_BITMAP(bits, DMA_TX_TYPE_END); } dma_cap_mask_t;
116 133
117/** 134/**
135 * struct dma_slave - Information about a DMA slave
136 * @dev: device acting as DMA slave
137 * @dma_dev: required DMA master device. If non-NULL, the client can not be
138 * bound to other masters than this.
139 * @tx_reg: physical address of data register used for
140 * memory-to-peripheral transfers
141 * @rx_reg: physical address of data register used for
142 * peripheral-to-memory transfers
143 * @reg_width: peripheral register width
144 *
145 * If dma_dev is non-NULL, the client can not be bound to other DMA
146 * masters than the one corresponding to this device. The DMA master
147 * driver may use this to determine if there is controller-specific
148 * data wrapped around this struct. Drivers of platform code that sets
149 * the dma_dev field must therefore make sure to use an appropriate
150 * controller-specific dma slave structure wrapping this struct.
151 */
152struct dma_slave {
153 struct device *dev;
154 struct device *dma_dev;
155 dma_addr_t tx_reg;
156 dma_addr_t rx_reg;
157 enum dma_slave_width reg_width;
158};
159
160/**
118 * struct dma_chan_percpu - the per-CPU part of struct dma_chan 161 * struct dma_chan_percpu - the per-CPU part of struct dma_chan
119 * @refcount: local_t used for open-coded "bigref" counting 162 * @refcount: local_t used for open-coded "bigref" counting
120 * @memcpy_count: transaction counter 163 * @memcpy_count: transaction counter
@@ -139,6 +182,7 @@ struct dma_chan_percpu {
139 * @rcu: the DMA channel's RCU head 182 * @rcu: the DMA channel's RCU head
140 * @device_node: used to add this to the device chan list 183 * @device_node: used to add this to the device chan list
141 * @local: per-cpu pointer to a struct dma_chan_percpu 184 * @local: per-cpu pointer to a struct dma_chan_percpu
185 * @client-count: how many clients are using this channel
142 */ 186 */
143struct dma_chan { 187struct dma_chan {
144 struct dma_device *device; 188 struct dma_device *device;
@@ -154,6 +198,7 @@ struct dma_chan {
154 198
155 struct list_head device_node; 199 struct list_head device_node;
156 struct dma_chan_percpu *local; 200 struct dma_chan_percpu *local;
201 int client_count;
157}; 202};
158 203
159#define to_dma_chan(p) container_of(p, struct dma_chan, dev) 204#define to_dma_chan(p) container_of(p, struct dma_chan, dev)
@@ -202,11 +247,14 @@ typedef enum dma_state_client (*dma_event_callback) (struct dma_client *client,
202 * @event_callback: func ptr to call when something happens 247 * @event_callback: func ptr to call when something happens
203 * @cap_mask: only return channels that satisfy the requested capabilities 248 * @cap_mask: only return channels that satisfy the requested capabilities
204 * a value of zero corresponds to any capability 249 * a value of zero corresponds to any capability
250 * @slave: data for preparing slave transfer. Must be non-NULL iff the
251 * DMA_SLAVE capability is requested.
205 * @global_node: list_head for global dma_client_list 252 * @global_node: list_head for global dma_client_list
206 */ 253 */
207struct dma_client { 254struct dma_client {
208 dma_event_callback event_callback; 255 dma_event_callback event_callback;
209 dma_cap_mask_t cap_mask; 256 dma_cap_mask_t cap_mask;
257 struct dma_slave *slave;
210 struct list_head global_node; 258 struct list_head global_node;
211}; 259};
212 260
@@ -263,6 +311,8 @@ struct dma_async_tx_descriptor {
263 * @device_prep_dma_zero_sum: prepares a zero_sum operation 311 * @device_prep_dma_zero_sum: prepares a zero_sum operation
264 * @device_prep_dma_memset: prepares a memset operation 312 * @device_prep_dma_memset: prepares a memset operation
265 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation 313 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation
314 * @device_prep_slave_sg: prepares a slave dma operation
315 * @device_terminate_all: terminate all pending operations
266 * @device_issue_pending: push pending transactions to hardware 316 * @device_issue_pending: push pending transactions to hardware
267 */ 317 */
268struct dma_device { 318struct dma_device {
@@ -279,7 +329,8 @@ struct dma_device {
279 int dev_id; 329 int dev_id;
280 struct device *dev; 330 struct device *dev;
281 331
282 int (*device_alloc_chan_resources)(struct dma_chan *chan); 332 int (*device_alloc_chan_resources)(struct dma_chan *chan,
333 struct dma_client *client);
283 void (*device_free_chan_resources)(struct dma_chan *chan); 334 void (*device_free_chan_resources)(struct dma_chan *chan);
284 335
285 struct dma_async_tx_descriptor *(*device_prep_dma_memcpy)( 336 struct dma_async_tx_descriptor *(*device_prep_dma_memcpy)(
@@ -297,6 +348,12 @@ struct dma_device {
297 struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)( 348 struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)(
298 struct dma_chan *chan, unsigned long flags); 349 struct dma_chan *chan, unsigned long flags);
299 350
351 struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
352 struct dma_chan *chan, struct scatterlist *sgl,
353 unsigned int sg_len, enum dma_data_direction direction,
354 unsigned long flags);
355 void (*device_terminate_all)(struct dma_chan *chan);
356
300 enum dma_status (*device_is_tx_complete)(struct dma_chan *chan, 357 enum dma_status (*device_is_tx_complete)(struct dma_chan *chan,
301 dma_cookie_t cookie, dma_cookie_t *last, 358 dma_cookie_t cookie, dma_cookie_t *last,
302 dma_cookie_t *used); 359 dma_cookie_t *used);
@@ -318,16 +375,14 @@ dma_cookie_t dma_async_memcpy_pg_to_pg(struct dma_chan *chan,
318void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx, 375void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx,
319 struct dma_chan *chan); 376 struct dma_chan *chan);
320 377
321static inline void 378static inline void async_tx_ack(struct dma_async_tx_descriptor *tx)
322async_tx_ack(struct dma_async_tx_descriptor *tx)
323{ 379{
324 tx->flags |= DMA_CTRL_ACK; 380 tx->flags |= DMA_CTRL_ACK;
325} 381}
326 382
327static inline int 383static inline bool async_tx_test_ack(struct dma_async_tx_descriptor *tx)
328async_tx_test_ack(struct dma_async_tx_descriptor *tx)
329{ 384{
330 return tx->flags & DMA_CTRL_ACK; 385 return (tx->flags & DMA_CTRL_ACK) == DMA_CTRL_ACK;
331} 386}
332 387
333#define first_dma_cap(mask) __first_dma_cap(&(mask)) 388#define first_dma_cap(mask) __first_dma_cap(&(mask))
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
new file mode 100644
index 00000000000..04d217b442b
--- /dev/null
+++ b/include/linux/dw_dmac.h
@@ -0,0 +1,62 @@
1/*
2 * Driver for the Synopsys DesignWare DMA Controller (aka DMACA on
3 * AVR32 systems.)
4 *
5 * Copyright (C) 2007 Atmel Corporation
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef DW_DMAC_H
12#define DW_DMAC_H
13
14#include <linux/dmaengine.h>
15
16/**
17 * struct dw_dma_platform_data - Controller configuration parameters
18 * @nr_channels: Number of channels supported by hardware (max 8)
19 */
20struct dw_dma_platform_data {
21 unsigned int nr_channels;
22};
23
24/**
25 * struct dw_dma_slave - Controller-specific information about a slave
26 * @slave: Generic information about the slave
27 * @ctl_lo: Platform-specific initializer for the CTL_LO register
28 * @cfg_hi: Platform-specific initializer for the CFG_HI register
29 * @cfg_lo: Platform-specific initializer for the CFG_LO register
30 */
31struct dw_dma_slave {
32 struct dma_slave slave;
33 u32 cfg_hi;
34 u32 cfg_lo;
35};
36
37/* Platform-configurable bits in CFG_HI */
38#define DWC_CFGH_FCMODE (1 << 0)
39#define DWC_CFGH_FIFO_MODE (1 << 1)
40#define DWC_CFGH_PROTCTL(x) ((x) << 2)
41#define DWC_CFGH_SRC_PER(x) ((x) << 7)
42#define DWC_CFGH_DST_PER(x) ((x) << 11)
43
44/* Platform-configurable bits in CFG_LO */
45#define DWC_CFGL_PRIO(x) ((x) << 5) /* priority */
46#define DWC_CFGL_LOCK_CH_XFER (0 << 12) /* scope of LOCK_CH */
47#define DWC_CFGL_LOCK_CH_BLOCK (1 << 12)
48#define DWC_CFGL_LOCK_CH_XACT (2 << 12)
49#define DWC_CFGL_LOCK_BUS_XFER (0 << 14) /* scope of LOCK_BUS */
50#define DWC_CFGL_LOCK_BUS_BLOCK (1 << 14)
51#define DWC_CFGL_LOCK_BUS_XACT (2 << 14)
52#define DWC_CFGL_LOCK_CH (1 << 15) /* channel lockout */
53#define DWC_CFGL_LOCK_BUS (1 << 16) /* busmaster lockout */
54#define DWC_CFGL_HS_DST_POL (1 << 18) /* dst handshake active low */
55#define DWC_CFGL_HS_SRC_POL (1 << 19) /* src handshake active low */
56
57static inline struct dw_dma_slave *to_dw_dma_slave(struct dma_slave *slave)
58{
59 return container_of(slave, struct dw_dma_slave, slave);
60}
61
62#endif /* DW_DMAC_H */
diff --git a/include/linux/efi.h b/include/linux/efi.h
index a5f359a7ad0..807373d467f 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -287,7 +287,6 @@ efi_guid_unparse(efi_guid_t *guid, char *out)
287extern void efi_init (void); 287extern void efi_init (void);
288extern void *efi_get_pal_addr (void); 288extern void *efi_get_pal_addr (void);
289extern void efi_map_pal_code (void); 289extern void efi_map_pal_code (void);
290extern void efi_map_memmap(void);
291extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg); 290extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg);
292extern void efi_gettimeofday (struct timespec *ts); 291extern void efi_gettimeofday (struct timespec *ts);
293extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */ 292extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */
@@ -295,14 +294,11 @@ extern u64 efi_get_iobase (void);
295extern u32 efi_mem_type (unsigned long phys_addr); 294extern u32 efi_mem_type (unsigned long phys_addr);
296extern u64 efi_mem_attributes (unsigned long phys_addr); 295extern u64 efi_mem_attributes (unsigned long phys_addr);
297extern u64 efi_mem_attribute (unsigned long phys_addr, unsigned long size); 296extern u64 efi_mem_attribute (unsigned long phys_addr, unsigned long size);
298extern int efi_mem_attribute_range (unsigned long phys_addr, unsigned long size,
299 u64 attr);
300extern int __init efi_uart_console_only (void); 297extern int __init efi_uart_console_only (void);
301extern void efi_initialize_iomem_resources(struct resource *code_resource, 298extern void efi_initialize_iomem_resources(struct resource *code_resource,
302 struct resource *data_resource, struct resource *bss_resource); 299 struct resource *data_resource, struct resource *bss_resource);
303extern unsigned long efi_get_time(void); 300extern unsigned long efi_get_time(void);
304extern int efi_set_rtc_mmss(unsigned long nowtime); 301extern int efi_set_rtc_mmss(unsigned long nowtime);
305extern int is_available_memory(efi_memory_desc_t * md);
306extern struct efi_memory_map memmap; 302extern struct efi_memory_map memmap;
307 303
308/** 304/**
diff --git a/include/linux/eisa.h b/include/linux/eisa.h
index fe806b6f030..e61c0be2a45 100644
--- a/include/linux/eisa.h
+++ b/include/linux/eisa.h
@@ -40,7 +40,7 @@ struct eisa_device {
40 u64 dma_mask; 40 u64 dma_mask;
41 struct device dev; /* generic device */ 41 struct device dev; /* generic device */
42#ifdef CONFIG_EISA_NAMES 42#ifdef CONFIG_EISA_NAMES
43 char pretty_name[DEVICE_NAME_SIZE]; 43 char pretty_name[50];
44#endif 44#endif
45}; 45};
46 46
diff --git a/include/linux/elf.h b/include/linux/elf.h
index ff9fbed9012..edc3dac3f02 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -358,6 +358,7 @@ typedef struct elf64_shdr {
358#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ 358#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
359#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ 359#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
360#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ 360#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
361#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
361#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ 362#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
362 363
363 364
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index c8d21635786..8bb5e87df36 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -272,6 +272,12 @@ enum ethtool_flags {
272 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ 272 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
273}; 273};
274 274
275struct ethtool_rxnfc {
276 __u32 cmd;
277 __u32 flow_type;
278 __u64 data;
279};
280
275#ifdef __KERNEL__ 281#ifdef __KERNEL__
276 282
277struct net_device; 283struct net_device;
@@ -396,6 +402,8 @@ struct ethtool_ops {
396 /* the following hooks are obsolete */ 402 /* the following hooks are obsolete */
397 int (*self_test_count)(struct net_device *);/* use get_sset_count */ 403 int (*self_test_count)(struct net_device *);/* use get_sset_count */
398 int (*get_stats_count)(struct net_device *);/* use get_sset_count */ 404 int (*get_stats_count)(struct net_device *);/* use get_sset_count */
405 int (*get_rxhash)(struct net_device *, struct ethtool_rxnfc *);
406 int (*set_rxhash)(struct net_device *, struct ethtool_rxnfc *);
399}; 407};
400#endif /* __KERNEL__ */ 408#endif /* __KERNEL__ */
401 409
@@ -442,6 +450,9 @@ struct ethtool_ops {
442#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */ 450#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */
443#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */ 451#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */
444 452
453#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */
454#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
455
445/* compatibility with older code */ 456/* compatibility with older code */
446#define SPARC_ETH_GSET ETHTOOL_GSET 457#define SPARC_ETH_GSET ETHTOOL_GSET
447#define SPARC_ETH_SSET ETHTOOL_SSET 458#define SPARC_ETH_SSET ETHTOOL_SSET
@@ -528,4 +539,26 @@ struct ethtool_ops {
528#define WAKE_MAGIC (1 << 5) 539#define WAKE_MAGIC (1 << 5)
529#define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */ 540#define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */
530 541
542/* L3-L4 network traffic flow types */
543#define TCP_V4_FLOW 0x01
544#define UDP_V4_FLOW 0x02
545#define SCTP_V4_FLOW 0x03
546#define AH_ESP_V4_FLOW 0x04
547#define TCP_V6_FLOW 0x05
548#define UDP_V6_FLOW 0x06
549#define SCTP_V6_FLOW 0x07
550#define AH_ESP_V6_FLOW 0x08
551
552/* L3-L4 network traffic flow hash options */
553#define RXH_DEV_PORT (1 << 0)
554#define RXH_L2DA (1 << 1)
555#define RXH_VLAN (1 << 2)
556#define RXH_L3_PROTO (1 << 3)
557#define RXH_IP_SRC (1 << 4)
558#define RXH_IP_DST (1 << 5)
559#define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */
560#define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */
561#define RXH_DISCARD (1 << 31)
562
563
531#endif /* _LINUX_ETHTOOL_H */ 564#endif /* _LINUX_ETHTOOL_H */
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index a701399b7fe..a667637b54e 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -10,6 +10,13 @@
10 10
11#ifdef CONFIG_EVENTFD 11#ifdef CONFIG_EVENTFD
12 12
13/* For O_CLOEXEC and O_NONBLOCK */
14#include <linux/fcntl.h>
15
16/* Flags for eventfd2. */
17#define EFD_CLOEXEC O_CLOEXEC
18#define EFD_NONBLOCK O_NONBLOCK
19
13struct file *eventfd_fget(int fd); 20struct file *eventfd_fget(int fd);
14int eventfd_signal(struct file *file, int n); 21int eventfd_signal(struct file *file, int n);
15 22
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index cf79853967f..f1e1d3c4712 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -14,8 +14,12 @@
14#ifndef _LINUX_EVENTPOLL_H 14#ifndef _LINUX_EVENTPOLL_H
15#define _LINUX_EVENTPOLL_H 15#define _LINUX_EVENTPOLL_H
16 16
17/* For O_CLOEXEC */
18#include <linux/fcntl.h>
17#include <linux/types.h> 19#include <linux/types.h>
18 20
21/* Flags for epoll_create1. */
22#define EPOLL_CLOEXEC O_CLOEXEC
19 23
20/* Valid opcodes to issue to sys_epoll_ctl() */ 24/* Valid opcodes to issue to sys_epoll_ctl() */
21#define EPOLL_CTL_ADD 1 25#define EPOLL_CTL_ADD 1
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
index de8387b7ceb..f5abd130663 100644
--- a/include/linux/exportfs.h
+++ b/include/linux/exportfs.h
@@ -33,6 +33,19 @@ enum fid_type {
33 * 32 bit parent directory inode number. 33 * 32 bit parent directory inode number.
34 */ 34 */
35 FILEID_INO32_GEN_PARENT = 2, 35 FILEID_INO32_GEN_PARENT = 2,
36
37 /*
38 * 32 bit block number, 16 bit partition reference,
39 * 16 bit unused, 32 bit generation number.
40 */
41 FILEID_UDF_WITHOUT_PARENT = 0x51,
42
43 /*
44 * 32 bit block number, 16 bit partition reference,
45 * 16 bit unused, 32 bit generation number,
46 * 32 bit parent block number, 32 bit parent generation number
47 */
48 FILEID_UDF_WITH_PARENT = 0x52,
36}; 49};
37 50
38struct fid { 51struct fid {
@@ -43,6 +56,14 @@ struct fid {
43 u32 parent_ino; 56 u32 parent_ino;
44 u32 parent_gen; 57 u32 parent_gen;
45 } i32; 58 } i32;
59 struct {
60 u32 block;
61 u16 partref;
62 u16 parent_partref;
63 u32 generation;
64 u32 parent_block;
65 u32 parent_generation;
66 } udf;
46 __u32 raw[0]; 67 __u32 raw[0];
47 }; 68 };
48}; 69};
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index 84cec2aa9f1..2efe7b863cf 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -284,8 +284,8 @@ struct ext2_inode {
284 284
285#ifdef __hurd__ 285#ifdef __hurd__
286#define i_translator osd1.hurd1.h_i_translator 286#define i_translator osd1.hurd1.h_i_translator
287#define i_frag osd2.hurd2.h_i_frag; 287#define i_frag osd2.hurd2.h_i_frag
288#define i_fsize osd2.hurd2.h_i_fsize; 288#define i_fsize osd2.hurd2.h_i_fsize
289#define i_uid_high osd2.hurd2.h_i_uid_high 289#define i_uid_high osd2.hurd2.h_i_uid_high
290#define i_gid_high osd2.hurd2.h_i_gid_high 290#define i_gid_high osd2.hurd2.h_i_gid_high
291#define i_author osd2.hurd2.h_i_author 291#define i_author osd2.hurd2.h_i_author
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 36c54039637..80171ee89a2 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -832,6 +832,7 @@ extern void ext3_discard_reservation (struct inode *);
832extern void ext3_dirty_inode(struct inode *); 832extern void ext3_dirty_inode(struct inode *);
833extern int ext3_change_inode_journal_flag(struct inode *, int); 833extern int ext3_change_inode_journal_flag(struct inode *, int);
834extern int ext3_get_inode_loc(struct inode *, struct ext3_iloc *); 834extern int ext3_get_inode_loc(struct inode *, struct ext3_iloc *);
835extern int ext3_can_truncate(struct inode *inode);
835extern void ext3_truncate (struct inode *); 836extern void ext3_truncate (struct inode *);
836extern void ext3_set_inode_flags(struct inode *); 837extern void ext3_set_inode_flags(struct inode *);
837extern void ext3_get_inode_flags(struct ext3_inode_info *); 838extern void ext3_get_inode_flags(struct ext3_inode_info *);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 72295b09922..3b8870e32af 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -8,7 +8,6 @@ struct dentry;
8 8
9/* Definitions of frame buffers */ 9/* Definitions of frame buffers */
10 10
11#define FB_MAJOR 29
12#define FB_MAX 32 /* sufficient for now */ 11#define FB_MAX 32 /* sufficient for now */
13 12
14/* ioctls 13/* ioctls
@@ -120,6 +119,10 @@ struct dentry;
120#define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari V3XT, V5, V8 */ 119#define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari V3XT, V5, V8 */
121#define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */ 120#define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */
122#define FB_ACCEL_OMAP1610 49 /* TI OMAP16xx */ 121#define FB_ACCEL_OMAP1610 49 /* TI OMAP16xx */
122#define FB_ACCEL_TRIDENT_TGUI 50 /* Trident TGUI */
123#define FB_ACCEL_TRIDENT_3DIMAGE 51 /* Trident 3DImage */
124#define FB_ACCEL_TRIDENT_BLADE3D 52 /* Trident Blade3D */
125#define FB_ACCEL_TRIDENT_BLADEXP 53 /* Trident BladeXP */
123#define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */ 126#define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */
124#define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */ 127#define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */
125#define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */ 128#define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */
diff --git a/include/linux/fd1772.h b/include/linux/fd1772.h
deleted file mode 100644
index 871d6e4c677..00000000000
--- a/include/linux/fd1772.h
+++ /dev/null
@@ -1,80 +0,0 @@
1#ifndef _LINUX_FD1772REG_H
2#define _LINUX_FD1772REG_H
3
4/*
5** WD1772 stuff - originally from the M68K Linux
6 * Modified for Archimedes by Dave Gilbert (gilbertd@cs.man.ac.uk)
7 */
8
9/* register codes */
10
11#define FDC1772SELREG_STP (0x80) /* command/status register */
12#define FDC1772SELREG_TRA (0x82) /* track register */
13#define FDC1772SELREG_SEC (0x84) /* sector register */
14#define FDC1772SELREG_DTA (0x86) /* data register */
15
16/* register names for FDC1772_READ/WRITE macros */
17
18#define FDC1772REG_CMD 0
19#define FDC1772REG_STATUS 0
20#define FDC1772REG_TRACK 2
21#define FDC1772REG_SECTOR 4
22#define FDC1772REG_DATA 6
23
24/* command opcodes */
25
26#define FDC1772CMD_RESTORE (0x00) /* - */
27#define FDC1772CMD_SEEK (0x10) /* | */
28#define FDC1772CMD_STEP (0x20) /* | TYP 1 Commands */
29#define FDC1772CMD_STIN (0x40) /* | */
30#define FDC1772CMD_STOT (0x60) /* - */
31#define FDC1772CMD_RDSEC (0x80) /* - TYP 2 Commands */
32#define FDC1772CMD_WRSEC (0xa0) /* - " */
33#define FDC1772CMD_RDADR (0xc0) /* - */
34#define FDC1772CMD_RDTRA (0xe0) /* | TYP 3 Commands */
35#define FDC1772CMD_WRTRA (0xf0) /* - */
36#define FDC1772CMD_FORCI (0xd0) /* - TYP 4 Command */
37
38/* command modifier bits */
39
40#define FDC1772CMDADD_SR6 (0x00) /* step rate settings */
41#define FDC1772CMDADD_SR12 (0x01)
42#define FDC1772CMDADD_SR2 (0x02)
43#define FDC1772CMDADD_SR3 (0x03)
44#define FDC1772CMDADD_V (0x04) /* verify */
45#define FDC1772CMDADD_H (0x08) /* wait for spin-up */
46#define FDC1772CMDADD_U (0x10) /* update track register */
47#define FDC1772CMDADD_M (0x10) /* multiple sector access */
48#define FDC1772CMDADD_E (0x04) /* head settling flag */
49#define FDC1772CMDADD_P (0x02) /* precompensation */
50#define FDC1772CMDADD_A0 (0x01) /* DAM flag */
51
52/* status register bits */
53
54#define FDC1772STAT_MOTORON (0x80) /* motor on */
55#define FDC1772STAT_WPROT (0x40) /* write protected (FDC1772CMD_WR*) */
56#define FDC1772STAT_SPINUP (0x20) /* motor speed stable (Type I) */
57#define FDC1772STAT_DELDAM (0x20) /* sector has deleted DAM (Type II+III) */
58#define FDC1772STAT_RECNF (0x10) /* record not found */
59#define FDC1772STAT_CRC (0x08) /* CRC error */
60#define FDC1772STAT_TR00 (0x04) /* Track 00 flag (Type I) */
61#define FDC1772STAT_LOST (0x04) /* Lost Data (Type II+III) */
62#define FDC1772STAT_IDX (0x02) /* Index status (Type I) */
63#define FDC1772STAT_DRQ (0x02) /* DRQ status (Type II+III) */
64#define FDC1772STAT_BUSY (0x01) /* FDC1772 is busy */
65
66
67/* PSG Port A Bit Nr 0 .. Side Sel .. 0 -> Side 1 1 -> Side 2 */
68#define DSKSIDE (0x01)
69
70#define DSKDRVNONE (0x06)
71#define DSKDRV0 (0x02)
72#define DSKDRV1 (0x04)
73
74/* step rates */
75#define FDC1772STEP_6 0x00
76#define FDC1772STEP_12 0x01
77#define FDC1772STEP_2 0x02
78#define FDC1772STEP_3 0x03
79
80#endif
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index a118f3c0b24..4aab6f12cfa 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -93,6 +93,7 @@ struct files_struct *get_files_struct(struct task_struct *);
93void put_files_struct(struct files_struct *fs); 93void put_files_struct(struct files_struct *fs);
94void reset_files_struct(struct files_struct *); 94void reset_files_struct(struct files_struct *);
95int unshare_files(struct files_struct **); 95int unshare_files(struct files_struct **);
96struct files_struct *dup_fd(struct files_struct *, int *);
96 97
97extern struct kmem_cache *files_cachep; 98extern struct kmem_cache *files_cachep;
98 99
diff --git a/include/linux/firmware-map.h b/include/linux/firmware-map.h
new file mode 100644
index 00000000000..acbdbcc1605
--- /dev/null
+++ b/include/linux/firmware-map.h
@@ -0,0 +1,74 @@
1/*
2 * include/linux/firmware-map.h:
3 * Copyright (C) 2008 SUSE LINUX Products GmbH
4 * by Bernhard Walle <bwalle@suse.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 v2.0 as published by
8 * 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 */
16#ifndef _LINUX_FIRMWARE_MAP_H
17#define _LINUX_FIRMWARE_MAP_H
18
19#include <linux/list.h>
20#include <linux/kobject.h>
21
22/*
23 * provide a dummy interface if CONFIG_FIRMWARE_MEMMAP is disabled
24 */
25#ifdef CONFIG_FIRMWARE_MEMMAP
26
27/**
28 * Adds a firmware mapping entry. This function uses kmalloc() for memory
29 * allocation. Use firmware_map_add_early() if you want to use the bootmem
30 * allocator.
31 *
32 * That function must be called before late_initcall.
33 *
34 * @start: Start of the memory range.
35 * @end: End of the memory range (inclusive).
36 * @type: Type of the memory range.
37 *
38 * Returns 0 on success, or -ENOMEM if no memory could be allocated.
39 */
40int firmware_map_add(resource_size_t start, resource_size_t end,
41 const char *type);
42
43/**
44 * Adds a firmware mapping entry. This function uses the bootmem allocator
45 * for memory allocation. Use firmware_map_add() if you want to use kmalloc().
46 *
47 * That function must be called before late_initcall.
48 *
49 * @start: Start of the memory range.
50 * @end: End of the memory range (inclusive).
51 * @type: Type of the memory range.
52 *
53 * Returns 0 on success, or -ENOMEM if no memory could be allocated.
54 */
55int firmware_map_add_early(resource_size_t start, resource_size_t end,
56 const char *type);
57
58#else /* CONFIG_FIRMWARE_MEMMAP */
59
60static inline int firmware_map_add(resource_size_t start, resource_size_t end,
61 const char *type)
62{
63 return 0;
64}
65
66static inline int firmware_map_add_early(resource_size_t start,
67 resource_size_t end, const char *type)
68{
69 return 0;
70}
71
72#endif /* CONFIG_FIRMWARE_MEMMAP */
73
74#endif /* _LINUX_FIRMWARE_MAP_H */
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 4d10c7328d2..c8ecf5b2a20 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -1,19 +1,40 @@
1#ifndef _LINUX_FIRMWARE_H 1#ifndef _LINUX_FIRMWARE_H
2#define _LINUX_FIRMWARE_H 2#define _LINUX_FIRMWARE_H
3
3#include <linux/module.h> 4#include <linux/module.h>
4#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/compiler.h>
7
5#define FIRMWARE_NAME_MAX 30 8#define FIRMWARE_NAME_MAX 30
6#define FW_ACTION_NOHOTPLUG 0 9#define FW_ACTION_NOHOTPLUG 0
7#define FW_ACTION_HOTPLUG 1 10#define FW_ACTION_HOTPLUG 1
8 11
9struct firmware { 12struct firmware {
10 size_t size; 13 size_t size;
11 u8 *data; 14 const u8 *data;
12}; 15};
13 16
14struct device; 17struct device;
15 18
16#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) 19struct builtin_fw {
20 char *name;
21 void *data;
22 unsigned long size;
23};
24
25/* We have to play tricks here much like stringify() to get the
26 __COUNTER__ macro to be expanded as we want it */
27#define __fw_concat1(x, y) x##y
28#define __fw_concat(x, y) __fw_concat1(x, y)
29
30#define DECLARE_BUILTIN_FIRMWARE(name, blob) \
31 DECLARE_BUILTIN_FIRMWARE_SIZE(name, &(blob), sizeof(blob))
32
33#define DECLARE_BUILTIN_FIRMWARE_SIZE(name, blob, size) \
34 static const struct builtin_fw __fw_concat(__builtin_fw,__COUNTER__) \
35 __used __section(.builtin_fw) = { name, blob, size }
36
37#if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE))
17int request_firmware(const struct firmware **fw, const char *name, 38int request_firmware(const struct firmware **fw, const char *name,
18 struct device *device); 39 struct device *device);
19int request_firmware_nowait( 40int request_firmware_nowait(
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 08934995c7a..deddeedf325 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -128,6 +128,15 @@ static inline void set_freezable(void)
128} 128}
129 129
130/* 130/*
131 * Tell the freezer that the current task should be frozen by it and that it
132 * should send a fake signal to the task to freeze it.
133 */
134static inline void set_freezable_with_signal(void)
135{
136 current->flags &= ~(PF_NOFREEZE | PF_FREEZER_NOSIG);
137}
138
139/*
131 * Freezer-friendly wrappers around wait_event_interruptible() and 140 * Freezer-friendly wrappers around wait_event_interruptible() and
132 * wait_event_interruptible_timeout(), originally defined in <linux/wait.h> 141 * wait_event_interruptible_timeout(), originally defined in <linux/wait.h>
133 */ 142 */
@@ -174,6 +183,7 @@ static inline void freezer_do_not_count(void) {}
174static inline void freezer_count(void) {} 183static inline void freezer_count(void) {}
175static inline int freezer_should_skip(struct task_struct *p) { return 0; } 184static inline int freezer_should_skip(struct task_struct *p) { return 0; }
176static inline void set_freezable(void) {} 185static inline void set_freezable(void) {}
186static inline void set_freezable_with_signal(void) {}
177 187
178#define wait_event_freezable(wq, condition) \ 188#define wait_event_freezable(wq, condition) \
179 wait_event_interruptible(wq, condition) 189 wait_event_interruptible(wq, condition)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index a1ba005d08e..580b513668f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -60,6 +60,8 @@ extern int dir_notify_enable;
60#define MAY_WRITE 2 60#define MAY_WRITE 2
61#define MAY_READ 4 61#define MAY_READ 4
62#define MAY_APPEND 8 62#define MAY_APPEND 8
63#define MAY_ACCESS 16
64#define MAY_OPEN 32
63 65
64#define FMODE_READ 1 66#define FMODE_READ 1
65#define FMODE_WRITE 2 67#define FMODE_WRITE 2
@@ -83,6 +85,7 @@ extern int dir_notify_enable;
83#define READ_SYNC (READ | (1 << BIO_RW_SYNC)) 85#define READ_SYNC (READ | (1 << BIO_RW_SYNC))
84#define READ_META (READ | (1 << BIO_RW_META)) 86#define READ_META (READ | (1 << BIO_RW_META))
85#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) 87#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC))
88#define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC))
86#define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER)) 89#define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER))
87 90
88#define SEL_IN 1 91#define SEL_IN 1
@@ -276,7 +279,7 @@ extern int dir_notify_enable;
276#include <linux/types.h> 279#include <linux/types.h>
277#include <linux/kdev_t.h> 280#include <linux/kdev_t.h>
278#include <linux/dcache.h> 281#include <linux/dcache.h>
279#include <linux/namei.h> 282#include <linux/path.h>
280#include <linux/stat.h> 283#include <linux/stat.h>
281#include <linux/cache.h> 284#include <linux/cache.h>
282#include <linux/kobject.h> 285#include <linux/kobject.h>
@@ -317,22 +320,23 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
317 * Attribute flags. These should be or-ed together to figure out what 320 * Attribute flags. These should be or-ed together to figure out what
318 * has been changed! 321 * has been changed!
319 */ 322 */
320#define ATTR_MODE 1 323#define ATTR_MODE (1 << 0)
321#define ATTR_UID 2 324#define ATTR_UID (1 << 1)
322#define ATTR_GID 4 325#define ATTR_GID (1 << 2)
323#define ATTR_SIZE 8 326#define ATTR_SIZE (1 << 3)
324#define ATTR_ATIME 16 327#define ATTR_ATIME (1 << 4)
325#define ATTR_MTIME 32 328#define ATTR_MTIME (1 << 5)
326#define ATTR_CTIME 64 329#define ATTR_CTIME (1 << 6)
327#define ATTR_ATIME_SET 128 330#define ATTR_ATIME_SET (1 << 7)
328#define ATTR_MTIME_SET 256 331#define ATTR_MTIME_SET (1 << 8)
329#define ATTR_FORCE 512 /* Not a change, but a change it */ 332#define ATTR_FORCE (1 << 9) /* Not a change, but a change it */
330#define ATTR_ATTR_FLAG 1024 333#define ATTR_ATTR_FLAG (1 << 10)
331#define ATTR_KILL_SUID 2048 334#define ATTR_KILL_SUID (1 << 11)
332#define ATTR_KILL_SGID 4096 335#define ATTR_KILL_SGID (1 << 12)
333#define ATTR_FILE 8192 336#define ATTR_FILE (1 << 13)
334#define ATTR_KILL_PRIV 16384 337#define ATTR_KILL_PRIV (1 << 14)
335#define ATTR_OPEN 32768 /* Truncating from open(O_TRUNC) */ 338#define ATTR_OPEN (1 << 15) /* Truncating from open(O_TRUNC) */
339#define ATTR_TIMES_SET (1 << 16)
336 340
337/* 341/*
338 * This is the Inode Attributes structure, used for notify_change(). It 342 * This is the Inode Attributes structure, used for notify_change(). It
@@ -439,6 +443,27 @@ static inline size_t iov_iter_count(struct iov_iter *i)
439 return i->count; 443 return i->count;
440} 444}
441 445
446/*
447 * "descriptor" for what we're up to with a read.
448 * This allows us to use the same read code yet
449 * have multiple different users of the data that
450 * we read from a file.
451 *
452 * The simplest case just copies the data to user
453 * mode.
454 */
455typedef struct {
456 size_t written;
457 size_t count;
458 union {
459 char __user *buf;
460 void *data;
461 } arg;
462 int error;
463} read_descriptor_t;
464
465typedef int (*read_actor_t)(read_descriptor_t *, struct page *,
466 unsigned long, unsigned long);
442 467
443struct address_space_operations { 468struct address_space_operations {
444 int (*writepage)(struct page *page, struct writeback_control *wbc); 469 int (*writepage)(struct page *page, struct writeback_control *wbc);
@@ -480,6 +505,8 @@ struct address_space_operations {
480 int (*migratepage) (struct address_space *, 505 int (*migratepage) (struct address_space *,
481 struct page *, struct page *); 506 struct page *, struct page *);
482 int (*launder_page) (struct page *); 507 int (*launder_page) (struct page *);
508 int (*is_partially_uptodate) (struct page *, read_descriptor_t *,
509 unsigned long);
483}; 510};
484 511
485/* 512/*
@@ -498,7 +525,7 @@ struct backing_dev_info;
498struct address_space { 525struct address_space {
499 struct inode *host; /* owner: inode, block_device */ 526 struct inode *host; /* owner: inode, block_device */
500 struct radix_tree_root page_tree; /* radix tree of all pages */ 527 struct radix_tree_root page_tree; /* radix tree of all pages */
501 rwlock_t tree_lock; /* and rwlock protecting it */ 528 spinlock_t tree_lock; /* and lock protecting it */
502 unsigned int i_mmap_writable;/* count VM_SHARED mappings */ 529 unsigned int i_mmap_writable;/* count VM_SHARED mappings */
503 struct prio_tree_root i_mmap; /* tree of private and shared mappings */ 530 struct prio_tree_root i_mmap; /* tree of private and shared mappings */
504 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ 531 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
@@ -791,7 +818,7 @@ struct file {
791#define f_dentry f_path.dentry 818#define f_dentry f_path.dentry
792#define f_vfsmnt f_path.mnt 819#define f_vfsmnt f_path.mnt
793 const struct file_operations *f_op; 820 const struct file_operations *f_op;
794 atomic_t f_count; 821 atomic_long_t f_count;
795 unsigned int f_flags; 822 unsigned int f_flags;
796 mode_t f_mode; 823 mode_t f_mode;
797 loff_t f_pos; 824 loff_t f_pos;
@@ -820,8 +847,8 @@ extern spinlock_t files_lock;
820#define file_list_lock() spin_lock(&files_lock); 847#define file_list_lock() spin_lock(&files_lock);
821#define file_list_unlock() spin_unlock(&files_lock); 848#define file_list_unlock() spin_unlock(&files_lock);
822 849
823#define get_file(x) atomic_inc(&(x)->f_count) 850#define get_file(x) atomic_long_inc(&(x)->f_count)
824#define file_count(x) atomic_read(&(x)->f_count) 851#define file_count(x) atomic_long_read(&(x)->f_count)
825 852
826#ifdef CONFIG_DEBUG_WRITECOUNT 853#ifdef CONFIG_DEBUG_WRITECOUNT
827static inline void file_take_write(struct file *f) 854static inline void file_take_write(struct file *f)
@@ -885,6 +912,12 @@ static inline int file_check_writeable(struct file *filp)
885#define FL_SLEEP 128 /* A blocking lock */ 912#define FL_SLEEP 128 /* A blocking lock */
886 913
887/* 914/*
915 * Special return value from posix_lock_file() and vfs_lock_file() for
916 * asynchronous locking.
917 */
918#define FILE_LOCK_DEFERRED 1
919
920/*
888 * The POSIX file lock owner is determined by 921 * The POSIX file lock owner is determined by
889 * the "struct files_struct" in the thread group 922 * the "struct files_struct" in the thread group
890 * (or NULL for no owner - BSD locks). 923 * (or NULL for no owner - BSD locks).
@@ -894,8 +927,6 @@ static inline int file_check_writeable(struct file *filp)
894typedef struct files_struct *fl_owner_t; 927typedef struct files_struct *fl_owner_t;
895 928
896struct file_lock_operations { 929struct file_lock_operations {
897 void (*fl_insert)(struct file_lock *); /* lock insertion callback */
898 void (*fl_remove)(struct file_lock *); /* lock removal callback */
899 void (*fl_copy_lock)(struct file_lock *, struct file_lock *); 930 void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
900 void (*fl_release_private)(struct file_lock *); 931 void (*fl_release_private)(struct file_lock *);
901}; 932};
@@ -919,12 +950,12 @@ struct file_lock {
919 struct list_head fl_link; /* doubly linked list of all locks */ 950 struct list_head fl_link; /* doubly linked list of all locks */
920 struct list_head fl_block; /* circular list of blocked processes */ 951 struct list_head fl_block; /* circular list of blocked processes */
921 fl_owner_t fl_owner; 952 fl_owner_t fl_owner;
953 unsigned char fl_flags;
954 unsigned char fl_type;
922 unsigned int fl_pid; 955 unsigned int fl_pid;
923 struct pid *fl_nspid; 956 struct pid *fl_nspid;
924 wait_queue_head_t fl_wait; 957 wait_queue_head_t fl_wait;
925 struct file *fl_file; 958 struct file *fl_file;
926 unsigned char fl_flags;
927 unsigned char fl_type;
928 loff_t fl_start; 959 loff_t fl_start;
929 loff_t fl_end; 960 loff_t fl_end;
930 961
@@ -1026,6 +1057,7 @@ extern int send_sigurg(struct fown_struct *fown);
1026extern struct list_head super_blocks; 1057extern struct list_head super_blocks;
1027extern spinlock_t sb_lock; 1058extern spinlock_t sb_lock;
1028 1059
1060#define sb_entry(list) list_entry((list), struct super_block, s_list)
1029#define S_BIAS (1<<30) 1061#define S_BIAS (1<<30)
1030struct super_block { 1062struct super_block {
1031 struct list_head s_list; /* Keep this first */ 1063 struct list_head s_list; /* Keep this first */
@@ -1059,6 +1091,9 @@ struct super_block {
1059 struct list_head s_more_io; /* parked for more writeback */ 1091 struct list_head s_more_io; /* parked for more writeback */
1060 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ 1092 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */
1061 struct list_head s_files; 1093 struct list_head s_files;
1094 /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */
1095 struct list_head s_dentry_lru; /* unused dentry lru */
1096 int s_nr_dentry_unused; /* # of dentry on lru */
1062 1097
1063 struct block_device *s_bdev; 1098 struct block_device *s_bdev;
1064 struct mtd_info *s_mtd; 1099 struct mtd_info *s_mtd;
@@ -1127,7 +1162,7 @@ extern int vfs_permission(struct nameidata *, int);
1127extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); 1162extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);
1128extern int vfs_mkdir(struct inode *, struct dentry *, int); 1163extern int vfs_mkdir(struct inode *, struct dentry *, int);
1129extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); 1164extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);
1130extern int vfs_symlink(struct inode *, struct dentry *, const char *, int); 1165extern int vfs_symlink(struct inode *, struct dentry *, const char *);
1131extern int vfs_link(struct dentry *, struct inode *, struct dentry *); 1166extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
1132extern int vfs_rmdir(struct inode *, struct dentry *); 1167extern int vfs_rmdir(struct inode *, struct dentry *);
1133extern int vfs_unlink(struct inode *, struct dentry *); 1168extern int vfs_unlink(struct inode *, struct dentry *);
@@ -1186,27 +1221,6 @@ struct block_device_operations {
1186 struct module *owner; 1221 struct module *owner;
1187}; 1222};
1188 1223
1189/*
1190 * "descriptor" for what we're up to with a read.
1191 * This allows us to use the same read code yet
1192 * have multiple different users of the data that
1193 * we read from a file.
1194 *
1195 * The simplest case just copies the data to user
1196 * mode.
1197 */
1198typedef struct {
1199 size_t written;
1200 size_t count;
1201 union {
1202 char __user * buf;
1203 void *data;
1204 } arg;
1205 int error;
1206} read_descriptor_t;
1207
1208typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, unsigned long);
1209
1210/* These macros are for out of kernel modules to test that 1224/* These macros are for out of kernel modules to test that
1211 * the kernel supports the unlocked_ioctl and compat_ioctl 1225 * the kernel supports the unlocked_ioctl and compat_ioctl
1212 * fields in struct file_operations. */ 1226 * fields in struct file_operations. */
@@ -1263,7 +1277,7 @@ struct inode_operations {
1263 void * (*follow_link) (struct dentry *, struct nameidata *); 1277 void * (*follow_link) (struct dentry *, struct nameidata *);
1264 void (*put_link) (struct dentry *, struct nameidata *, void *); 1278 void (*put_link) (struct dentry *, struct nameidata *, void *);
1265 void (*truncate) (struct inode *); 1279 void (*truncate) (struct inode *);
1266 int (*permission) (struct inode *, int, struct nameidata *); 1280 int (*permission) (struct inode *, int);
1267 int (*setattr) (struct dentry *, struct iattr *); 1281 int (*setattr) (struct dentry *, struct iattr *);
1268 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); 1282 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
1269 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); 1283 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
@@ -1289,17 +1303,12 @@ extern ssize_t vfs_readv(struct file *, const struct iovec __user *,
1289extern ssize_t vfs_writev(struct file *, const struct iovec __user *, 1303extern ssize_t vfs_writev(struct file *, const struct iovec __user *,
1290 unsigned long, loff_t *); 1304 unsigned long, loff_t *);
1291 1305
1292/*
1293 * NOTE: write_inode, delete_inode, clear_inode, put_inode can be called
1294 * without the big kernel lock held in all filesystems.
1295 */
1296struct super_operations { 1306struct super_operations {
1297 struct inode *(*alloc_inode)(struct super_block *sb); 1307 struct inode *(*alloc_inode)(struct super_block *sb);
1298 void (*destroy_inode)(struct inode *); 1308 void (*destroy_inode)(struct inode *);
1299 1309
1300 void (*dirty_inode) (struct inode *); 1310 void (*dirty_inode) (struct inode *);
1301 int (*write_inode) (struct inode *, int); 1311 int (*write_inode) (struct inode *, int);
1302 void (*put_inode) (struct inode *);
1303 void (*drop_inode) (struct inode *); 1312 void (*drop_inode) (struct inode *);
1304 void (*delete_inode) (struct inode *); 1313 void (*delete_inode) (struct inode *);
1305 void (*put_super) (struct super_block *); 1314 void (*put_super) (struct super_block *);
@@ -1692,9 +1701,9 @@ extern void init_special_inode(struct inode *, umode_t, dev_t);
1692extern void make_bad_inode(struct inode *); 1701extern void make_bad_inode(struct inode *);
1693extern int is_bad_inode(struct inode *); 1702extern int is_bad_inode(struct inode *);
1694 1703
1695extern const struct file_operations read_fifo_fops; 1704extern const struct file_operations read_pipefifo_fops;
1696extern const struct file_operations write_fifo_fops; 1705extern const struct file_operations write_pipefifo_fops;
1697extern const struct file_operations rdwr_fifo_fops; 1706extern const struct file_operations rdwr_pipefifo_fops;
1698 1707
1699extern int fs_may_remount_ro(struct super_block *); 1708extern int fs_may_remount_ro(struct super_block *);
1700 1709
@@ -1735,6 +1744,8 @@ static inline void invalidate_remote_inode(struct inode *inode)
1735extern int invalidate_inode_pages2(struct address_space *mapping); 1744extern int invalidate_inode_pages2(struct address_space *mapping);
1736extern int invalidate_inode_pages2_range(struct address_space *mapping, 1745extern int invalidate_inode_pages2_range(struct address_space *mapping,
1737 pgoff_t start, pgoff_t end); 1746 pgoff_t start, pgoff_t end);
1747extern void generic_sync_sb_inodes(struct super_block *sb,
1748 struct writeback_control *wbc);
1738extern int write_inode_now(struct inode *, int); 1749extern int write_inode_now(struct inode *, int);
1739extern int filemap_fdatawrite(struct address_space *); 1750extern int filemap_fdatawrite(struct address_space *);
1740extern int filemap_flush(struct address_space *); 1751extern int filemap_flush(struct address_space *);
@@ -1746,6 +1757,8 @@ extern int wait_on_page_writeback_range(struct address_space *mapping,
1746 pgoff_t start, pgoff_t end); 1757 pgoff_t start, pgoff_t end);
1747extern int __filemap_fdatawrite_range(struct address_space *mapping, 1758extern int __filemap_fdatawrite_range(struct address_space *mapping,
1748 loff_t start, loff_t end, int sync_mode); 1759 loff_t start, loff_t end, int sync_mode);
1760extern int filemap_fdatawrite_range(struct address_space *mapping,
1761 loff_t start, loff_t end);
1749 1762
1750extern long do_fsync(struct file *file, int datasync); 1763extern long do_fsync(struct file *file, int datasync);
1751extern void sync_supers(void); 1764extern void sync_supers(void);
@@ -1759,7 +1772,7 @@ extern int do_remount_sb(struct super_block *sb, int flags,
1759extern sector_t bmap(struct inode *, sector_t); 1772extern sector_t bmap(struct inode *, sector_t);
1760#endif 1773#endif
1761extern int notify_change(struct dentry *, struct iattr *); 1774extern int notify_change(struct dentry *, struct iattr *);
1762extern int permission(struct inode *, int, struct nameidata *); 1775extern int inode_permission(struct inode *, int);
1763extern int generic_permission(struct inode *, int, 1776extern int generic_permission(struct inode *, int,
1764 int (*check_acl)(struct inode *, int)); 1777 int (*check_acl)(struct inode *, int));
1765 1778
@@ -1775,8 +1788,9 @@ static inline void allow_write_access(struct file *file)
1775 atomic_inc(&file->f_path.dentry->d_inode->i_writecount); 1788 atomic_inc(&file->f_path.dentry->d_inode->i_writecount);
1776} 1789}
1777extern int do_pipe(int *); 1790extern int do_pipe(int *);
1778extern struct file *create_read_pipe(struct file *f); 1791extern int do_pipe_flags(int *, int);
1779extern struct file *create_write_pipe(void); 1792extern struct file *create_read_pipe(struct file *f, int flags);
1793extern struct file *create_write_pipe(int flags);
1780extern void free_write_pipe(struct file *); 1794extern void free_write_pipe(struct file *);
1781 1795
1782extern struct file *do_filp_open(int dfd, const char *pathname, 1796extern struct file *do_filp_open(int dfd, const char *pathname,
@@ -1821,9 +1835,8 @@ extern void iget_failed(struct inode *);
1821extern void clear_inode(struct inode *); 1835extern void clear_inode(struct inode *);
1822extern void destroy_inode(struct inode *); 1836extern void destroy_inode(struct inode *);
1823extern struct inode *new_inode(struct super_block *); 1837extern struct inode *new_inode(struct super_block *);
1824extern int __remove_suid(struct dentry *, int);
1825extern int should_remove_suid(struct dentry *); 1838extern int should_remove_suid(struct dentry *);
1826extern int remove_suid(struct dentry *); 1839extern int file_remove_suid(struct file *);
1827 1840
1828extern void __insert_inode_hash(struct inode *, unsigned long hashval); 1841extern void __insert_inode_hash(struct inode *, unsigned long hashval);
1829extern void remove_inode_hash(struct inode *); 1842extern void remove_inode_hash(struct inode *);
@@ -1877,7 +1890,8 @@ extern void
1877file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 1890file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
1878extern loff_t no_llseek(struct file *file, loff_t offset, int origin); 1891extern loff_t no_llseek(struct file *file, loff_t offset, int origin);
1879extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); 1892extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin);
1880extern loff_t remote_llseek(struct file *file, loff_t offset, int origin); 1893extern loff_t generic_file_llseek_unlocked(struct file *file, loff_t offset,
1894 int origin);
1881extern int generic_file_open(struct inode * inode, struct file * filp); 1895extern int generic_file_open(struct inode * inode, struct file * filp);
1882extern int nonseekable_open(struct inode * inode, struct file * filp); 1896extern int nonseekable_open(struct inode * inode, struct file * filp);
1883 1897
@@ -2006,7 +2020,8 @@ extern int simple_fill_super(struct super_block *, int, struct tree_descr *);
2006extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count); 2020extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
2007extern void simple_release_fs(struct vfsmount **mount, int *count); 2021extern void simple_release_fs(struct vfsmount **mount, int *count);
2008 2022
2009extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const void *, size_t); 2023extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
2024 loff_t *ppos, const void *from, size_t available);
2010 2025
2011#ifdef CONFIG_MIGRATION 2026#ifdef CONFIG_MIGRATION
2012extern int buffer_migrate_page(struct address_space *, 2027extern int buffer_migrate_page(struct address_space *,
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index 9bc045b8c47..8300cab30f9 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -103,10 +103,6 @@ struct fs_mii_bb_platform_info {
103 struct fs_mii_bit mdio_dir; 103 struct fs_mii_bit mdio_dir;
104 struct fs_mii_bit mdio_dat; 104 struct fs_mii_bit mdio_dat;
105 struct fs_mii_bit mdc_dat; 105 struct fs_mii_bit mdc_dat;
106 int mdio_port; /* port & bit for MDIO */
107 int mdio_bit;
108 int mdc_port; /* port & bit for MDC */
109 int mdc_bit;
110 int delay; /* delay in us */ 106 int delay; /* delay in us */
111 int irq[32]; /* irqs per phy's */ 107 int irq[32]; /* irqs per phy's */
112}; 108};
@@ -135,11 +131,7 @@ struct fs_platform_info {
135 u32 device_flags; 131 u32 device_flags;
136 132
137 int phy_addr; /* the phy address (-1 no phy) */ 133 int phy_addr; /* the phy address (-1 no phy) */
138#ifdef CONFIG_PPC_CPM_NEW_BINDING
139 char bus_id[16]; 134 char bus_id[16];
140#else
141 const char* bus_id;
142#endif
143 int phy_irq; /* the phy irq (if it exists) */ 135 int phy_irq; /* the phy irq (if it exists) */
144 136
145 const struct fs_mii_bus_info *bus_info; 137 const struct fs_mii_bus_info *bus_info;
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index 282f5421912..9e5a06e78d0 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -7,7 +7,7 @@ struct fs_struct {
7 atomic_t count; 7 atomic_t count;
8 rwlock_t lock; 8 rwlock_t lock;
9 int umask; 9 int umask;
10 struct path root, pwd, altroot; 10 struct path root, pwd;
11}; 11};
12 12
13#define INIT_FS { \ 13#define INIT_FS { \
@@ -19,7 +19,6 @@ struct fs_struct {
19extern struct kmem_cache *fs_cachep; 19extern struct kmem_cache *fs_cachep;
20 20
21extern void exit_fs(struct task_struct *); 21extern void exit_fs(struct task_struct *);
22extern void set_fs_altroot(void);
23extern void set_fs_root(struct fs_struct *, struct path *); 22extern void set_fs_root(struct fs_struct *, struct path *);
24extern void set_fs_pwd(struct fs_struct *, struct path *); 23extern void set_fs_pwd(struct fs_struct *, struct path *);
25extern struct fs_struct *copy_fs_struct(struct fs_struct *); 24extern struct fs_struct *copy_fs_struct(struct fs_struct *);
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index c415a496de3..4e625e0094c 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -69,6 +69,7 @@ struct gianfar_mdio_data {
69#define FSL_GIANFAR_DEV_HAS_VLAN 0x00000020 69#define FSL_GIANFAR_DEV_HAS_VLAN 0x00000020
70#define FSL_GIANFAR_DEV_HAS_EXTENDED_HASH 0x00000040 70#define FSL_GIANFAR_DEV_HAS_EXTENDED_HASH 0x00000040
71#define FSL_GIANFAR_DEV_HAS_PADDING 0x00000080 71#define FSL_GIANFAR_DEV_HAS_PADDING 0x00000080
72#define FSL_GIANFAR_DEV_HAS_MAGIC_PACKET 0x00000100
72 73
73/* Flags in gianfar_platform_data */ 74/* Flags in gianfar_platform_data */
74#define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* set or use a timer */ 75#define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* set or use a timer */
@@ -125,4 +126,10 @@ struct mpc8xx_pcmcia_ops {
125 int(*voltage_set)(int slot, int vcc, int vpp); 126 int(*voltage_set)(int slot, int vcc, int vpp);
126}; 127};
127 128
129/* Returns non-zero if the current suspend operation would
130 * lead to a deep sleep (i.e. power removed from the core,
131 * instead of just the clock).
132 */
133int fsl_deep_sleep(void);
134
128#endif /* _FSL_DEVICE_H_ */ 135#endif /* _FSL_DEVICE_H_ */
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
new file mode 100644
index 00000000000..f368d041e02
--- /dev/null
+++ b/include/linux/ftrace.h
@@ -0,0 +1,144 @@
1#ifndef _LINUX_FTRACE_H
2#define _LINUX_FTRACE_H
3
4#ifdef CONFIG_FTRACE
5
6#include <linux/linkage.h>
7#include <linux/fs.h>
8
9extern int ftrace_enabled;
10extern int
11ftrace_enable_sysctl(struct ctl_table *table, int write,
12 struct file *filp, void __user *buffer, size_t *lenp,
13 loff_t *ppos);
14
15typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip);
16
17struct ftrace_ops {
18 ftrace_func_t func;
19 struct ftrace_ops *next;
20};
21
22/*
23 * The ftrace_ops must be a static and should also
24 * be read_mostly. These functions do modify read_mostly variables
25 * so use them sparely. Never free an ftrace_op or modify the
26 * next pointer after it has been registered. Even after unregistering
27 * it, the next pointer may still be used internally.
28 */
29int register_ftrace_function(struct ftrace_ops *ops);
30int unregister_ftrace_function(struct ftrace_ops *ops);
31void clear_ftrace_function(void);
32
33extern void ftrace_stub(unsigned long a0, unsigned long a1);
34
35#else /* !CONFIG_FTRACE */
36# define register_ftrace_function(ops) do { } while (0)
37# define unregister_ftrace_function(ops) do { } while (0)
38# define clear_ftrace_function(ops) do { } while (0)
39#endif /* CONFIG_FTRACE */
40
41#ifdef CONFIG_DYNAMIC_FTRACE
42# define FTRACE_HASHBITS 10
43# define FTRACE_HASHSIZE (1<<FTRACE_HASHBITS)
44
45enum {
46 FTRACE_FL_FREE = (1 << 0),
47 FTRACE_FL_FAILED = (1 << 1),
48 FTRACE_FL_FILTER = (1 << 2),
49 FTRACE_FL_ENABLED = (1 << 3),
50 FTRACE_FL_NOTRACE = (1 << 4),
51 FTRACE_FL_CONVERTED = (1 << 5),
52 FTRACE_FL_FROZEN = (1 << 6),
53};
54
55struct dyn_ftrace {
56 struct hlist_node node;
57 unsigned long ip; /* address of mcount call-site */
58 unsigned long flags;
59};
60
61int ftrace_force_update(void);
62void ftrace_set_filter(unsigned char *buf, int len, int reset);
63
64/* defined in arch */
65extern int ftrace_ip_converted(unsigned long ip);
66extern unsigned char *ftrace_nop_replace(void);
67extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr);
68extern int ftrace_dyn_arch_init(void *data);
69extern int ftrace_mcount_set(unsigned long *data);
70extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code,
71 unsigned char *new_code);
72extern int ftrace_update_ftrace_func(ftrace_func_t func);
73extern void ftrace_caller(void);
74extern void ftrace_call(void);
75extern void mcount_call(void);
76
77extern int skip_trace(unsigned long ip);
78
79void ftrace_disable_daemon(void);
80void ftrace_enable_daemon(void);
81
82#else
83# define skip_trace(ip) ({ 0; })
84# define ftrace_force_update() ({ 0; })
85# define ftrace_set_filter(buf, len, reset) do { } while (0)
86# define ftrace_disable_daemon() do { } while (0)
87# define ftrace_enable_daemon() do { } while (0)
88#endif /* CONFIG_DYNAMIC_FTRACE */
89
90/* totally disable ftrace - can not re-enable after this */
91void ftrace_kill(void);
92void ftrace_kill_atomic(void);
93
94static inline void tracer_disable(void)
95{
96#ifdef CONFIG_FTRACE
97 ftrace_enabled = 0;
98#endif
99}
100
101#ifdef CONFIG_FRAME_POINTER
102/* TODO: need to fix this for ARM */
103# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
104# define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1))
105# define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2))
106# define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3))
107# define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4))
108# define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5))
109# define CALLER_ADDR6 ((unsigned long)__builtin_return_address(6))
110#else
111# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
112# define CALLER_ADDR1 0UL
113# define CALLER_ADDR2 0UL
114# define CALLER_ADDR3 0UL
115# define CALLER_ADDR4 0UL
116# define CALLER_ADDR5 0UL
117# define CALLER_ADDR6 0UL
118#endif
119
120#ifdef CONFIG_IRQSOFF_TRACER
121 extern void time_hardirqs_on(unsigned long a0, unsigned long a1);
122 extern void time_hardirqs_off(unsigned long a0, unsigned long a1);
123#else
124# define time_hardirqs_on(a0, a1) do { } while (0)
125# define time_hardirqs_off(a0, a1) do { } while (0)
126#endif
127
128#ifdef CONFIG_PREEMPT_TRACER
129 extern void trace_preempt_on(unsigned long a0, unsigned long a1);
130 extern void trace_preempt_off(unsigned long a0, unsigned long a1);
131#else
132# define trace_preempt_on(a0, a1) do { } while (0)
133# define trace_preempt_off(a0, a1) do { } while (0)
134#endif
135
136#ifdef CONFIG_TRACING
137extern void
138ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
139#else
140static inline void
141ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
142#endif
143
144#endif /* _LINUX_FTRACE_H */
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 5c86f1196c3..265635dc990 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -104,11 +104,15 @@ struct fuse_file_lock {
104 104
105/** 105/**
106 * INIT request/reply flags 106 * INIT request/reply flags
107 *
108 * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
107 */ 109 */
108#define FUSE_ASYNC_READ (1 << 0) 110#define FUSE_ASYNC_READ (1 << 0)
109#define FUSE_POSIX_LOCKS (1 << 1) 111#define FUSE_POSIX_LOCKS (1 << 1)
110#define FUSE_FILE_OPS (1 << 2) 112#define FUSE_FILE_OPS (1 << 2)
111#define FUSE_ATOMIC_O_TRUNC (1 << 3) 113#define FUSE_ATOMIC_O_TRUNC (1 << 3)
114#define FUSE_EXPORT_SUPPORT (1 << 4)
115#define FUSE_BIG_WRITES (1 << 5)
112 116
113/** 117/**
114 * Release flags 118 * Release flags
diff --git a/include/linux/gameport.h b/include/linux/gameport.h
index afad9527284..f64e29c0ef3 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -68,7 +68,6 @@ struct gameport_driver {
68 68
69int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode); 69int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode);
70void gameport_close(struct gameport *gameport); 70void gameport_close(struct gameport *gameport);
71void gameport_rescan(struct gameport *gameport);
72 71
73#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 72#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
74 73
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h
index 110833666e3..4cc91393981 100644
--- a/include/linux/generic_serial.h
+++ b/include/linux/generic_serial.h
@@ -14,6 +14,7 @@
14 14
15#ifdef __KERNEL__ 15#ifdef __KERNEL__
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/tty.h>
17 18
18struct real_driver { 19struct real_driver {
19 void (*disable_tx_interrupts) (void *); 20 void (*disable_tx_interrupts) (void *);
@@ -33,17 +34,12 @@ struct real_driver {
33 34
34struct gs_port { 35struct gs_port {
35 int magic; 36 int magic;
37 struct tty_port port;
36 unsigned char *xmit_buf; 38 unsigned char *xmit_buf;
37 int xmit_head; 39 int xmit_head;
38 int xmit_tail; 40 int xmit_tail;
39 int xmit_cnt; 41 int xmit_cnt;
40 struct mutex port_write_mutex; 42 struct mutex port_write_mutex;
41 int flags;
42 wait_queue_head_t open_wait;
43 wait_queue_head_t close_wait;
44 int count;
45 int blocked_open;
46 struct tty_struct *tty;
47 unsigned long event; 43 unsigned long event;
48 unsigned short closing_wait; 44 unsigned short closing_wait;
49 int close_delay; 45 int close_delay;
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index ecd2bf63fc8..118216f1bd3 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -110,6 +110,14 @@ struct hd_struct {
110#define GENHD_FL_SUPPRESS_PARTITION_INFO 32 110#define GENHD_FL_SUPPRESS_PARTITION_INFO 32
111#define GENHD_FL_FAIL 64 111#define GENHD_FL_FAIL 64
112 112
113#define BLK_SCSI_MAX_CMDS (256)
114#define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8))
115
116struct blk_scsi_cmd_filter {
117 unsigned long read_ok[BLK_SCSI_CMD_PER_LONG];
118 unsigned long write_ok[BLK_SCSI_CMD_PER_LONG];
119 struct kobject kobj;
120};
113 121
114struct gendisk { 122struct gendisk {
115 int major; /* major number of driver */ 123 int major; /* major number of driver */
@@ -120,6 +128,7 @@ struct gendisk {
120 struct hd_struct **part; /* [indexed by minor] */ 128 struct hd_struct **part; /* [indexed by minor] */
121 struct block_device_operations *fops; 129 struct block_device_operations *fops;
122 struct request_queue *queue; 130 struct request_queue *queue;
131 struct blk_scsi_cmd_filter cmd_filter;
123 void *private_data; 132 void *private_data;
124 sector_t capacity; 133 sector_t capacity;
125 134
@@ -141,6 +150,9 @@ struct gendisk {
141 struct disk_stats dkstats; 150 struct disk_stats dkstats;
142#endif 151#endif
143 struct work_struct async_notify; 152 struct work_struct async_notify;
153#ifdef CONFIG_BLK_DEV_INTEGRITY
154 struct blk_integrity *integrity;
155#endif
144}; 156};
145 157
146/* 158/*
@@ -178,17 +190,17 @@ static inline struct hd_struct *get_part(struct gendisk *gendiskp,
178 190
179static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) { 191static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) {
180 int i; 192 int i;
193
181 for_each_possible_cpu(i) 194 for_each_possible_cpu(i)
182 memset(per_cpu_ptr(gendiskp->dkstats, i), value, 195 memset(per_cpu_ptr(gendiskp->dkstats, i), value,
183 sizeof (struct disk_stats)); 196 sizeof(struct disk_stats));
184} 197}
185 198
186#define __part_stat_add(part, field, addnd) \ 199#define __part_stat_add(part, field, addnd) \
187 (per_cpu_ptr(part->dkstats, smp_processor_id())->field += addnd) 200 (per_cpu_ptr(part->dkstats, smp_processor_id())->field += addnd)
188 201
189#define __all_stat_add(gendiskp, field, addnd, sector) \ 202#define __all_stat_add(gendiskp, part, field, addnd, sector) \
190({ \ 203({ \
191 struct hd_struct *part = get_part(gendiskp, sector); \
192 if (part) \ 204 if (part) \
193 __part_stat_add(part, field, addnd); \ 205 __part_stat_add(part, field, addnd); \
194 __disk_stat_add(gendiskp, field, addnd); \ 206 __disk_stat_add(gendiskp, field, addnd); \
@@ -203,11 +215,13 @@ static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) {
203 res; \ 215 res; \
204}) 216})
205 217
206static inline void part_stat_set_all(struct hd_struct *part, int value) { 218static inline void part_stat_set_all(struct hd_struct *part, int value)
219{
207 int i; 220 int i;
221
208 for_each_possible_cpu(i) 222 for_each_possible_cpu(i)
209 memset(per_cpu_ptr(part->dkstats, i), value, 223 memset(per_cpu_ptr(part->dkstats, i), value,
210 sizeof(struct disk_stats)); 224 sizeof(struct disk_stats));
211} 225}
212 226
213#else /* !CONFIG_SMP */ 227#else /* !CONFIG_SMP */
@@ -223,9 +237,8 @@ static inline void disk_stat_set_all(struct gendisk *gendiskp, int value)
223#define __part_stat_add(part, field, addnd) \ 237#define __part_stat_add(part, field, addnd) \
224 (part->dkstats.field += addnd) 238 (part->dkstats.field += addnd)
225 239
226#define __all_stat_add(gendiskp, field, addnd, sector) \ 240#define __all_stat_add(gendiskp, part, field, addnd, sector) \
227({ \ 241({ \
228 struct hd_struct *part = get_part(gendiskp, sector); \
229 if (part) \ 242 if (part) \
230 part->dkstats.field += addnd; \ 243 part->dkstats.field += addnd; \
231 __disk_stat_add(gendiskp, field, addnd); \ 244 __disk_stat_add(gendiskp, field, addnd); \
@@ -276,10 +289,10 @@ static inline void part_stat_set_all(struct hd_struct *part, int value)
276#define part_stat_sub(gendiskp, field, subnd) \ 289#define part_stat_sub(gendiskp, field, subnd) \
277 part_stat_add(gendiskp, field, -subnd) 290 part_stat_add(gendiskp, field, -subnd)
278 291
279#define all_stat_add(gendiskp, field, addnd, sector) \ 292#define all_stat_add(gendiskp, part, field, addnd, sector) \
280 do { \ 293 do { \
281 preempt_disable(); \ 294 preempt_disable(); \
282 __all_stat_add(gendiskp, field, addnd, sector); \ 295 __all_stat_add(gendiskp, part, field, addnd, sector); \
283 preempt_enable(); \ 296 preempt_enable(); \
284 } while (0) 297 } while (0)
285 298
@@ -288,15 +301,15 @@ static inline void part_stat_set_all(struct hd_struct *part, int value)
288#define all_stat_dec(gendiskp, field, sector) \ 301#define all_stat_dec(gendiskp, field, sector) \
289 all_stat_add(gendiskp, field, -1, sector) 302 all_stat_add(gendiskp, field, -1, sector)
290 303
291#define __all_stat_inc(gendiskp, field, sector) \ 304#define __all_stat_inc(gendiskp, part, field, sector) \
292 __all_stat_add(gendiskp, field, 1, sector) 305 __all_stat_add(gendiskp, part, field, 1, sector)
293#define all_stat_inc(gendiskp, field, sector) \ 306#define all_stat_inc(gendiskp, part, field, sector) \
294 all_stat_add(gendiskp, field, 1, sector) 307 all_stat_add(gendiskp, part, field, 1, sector)
295 308
296#define __all_stat_sub(gendiskp, field, subnd, sector) \ 309#define __all_stat_sub(gendiskp, part, field, subnd, sector) \
297 __all_stat_add(gendiskp, field, -subnd, sector) 310 __all_stat_add(gendiskp, part, field, -subnd, sector)
298#define all_stat_sub(gendiskp, field, subnd, sector) \ 311#define all_stat_sub(gendiskp, part, field, subnd, sector) \
299 all_stat_add(gendiskp, field, -subnd, sector) 312 all_stat_add(gendiskp, part, field, -subnd, sector)
300 313
301/* Inlines to alloc and free disk stats in struct gendisk */ 314/* Inlines to alloc and free disk stats in struct gendisk */
302#ifdef CONFIG_SMP 315#ifdef CONFIG_SMP
@@ -524,11 +537,11 @@ struct unixware_disklabel {
524#define ADDPART_FLAG_RAID 1 537#define ADDPART_FLAG_RAID 1
525#define ADDPART_FLAG_WHOLEDISK 2 538#define ADDPART_FLAG_WHOLEDISK 2
526 539
527extern dev_t blk_lookup_devt(const char *name); 540extern dev_t blk_lookup_devt(const char *name, int part);
528extern char *disk_name (struct gendisk *hd, int part, char *buf); 541extern char *disk_name (struct gendisk *hd, int part, char *buf);
529 542
530extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); 543extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
531extern void add_partition(struct gendisk *, int, sector_t, sector_t, int); 544extern int __must_check add_partition(struct gendisk *, int, sector_t, sector_t, int);
532extern void delete_partition(struct gendisk *, int); 545extern void delete_partition(struct gendisk *, int);
533extern void printk_all_partitions(void); 546extern void printk_all_partitions(void);
534 547
@@ -552,7 +565,7 @@ static inline struct block_device *bdget_disk(struct gendisk *disk, int index)
552 565
553static inline void printk_all_partitions(void) { } 566static inline void printk_all_partitions(void) { }
554 567
555static inline dev_t blk_lookup_devt(const char *name) 568static inline dev_t blk_lookup_devt(const char *name, int part)
556{ 569{
557 dev_t devt = MKDEV(0, 0); 570 dev_t devt = MKDEV(0, 0);
558 return devt; 571 return devt;
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index b414be38718..e8003afeffb 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -173,11 +173,24 @@ static inline void arch_free_page(struct page *page, int order) { }
173static inline void arch_alloc_page(struct page *page, int order) { } 173static inline void arch_alloc_page(struct page *page, int order) { }
174#endif 174#endif
175 175
176extern struct page *__alloc_pages(gfp_t, unsigned int, struct zonelist *); 176struct page *
177__alloc_pages_internal(gfp_t gfp_mask, unsigned int order,
178 struct zonelist *zonelist, nodemask_t *nodemask);
179
180static inline struct page *
181__alloc_pages(gfp_t gfp_mask, unsigned int order,
182 struct zonelist *zonelist)
183{
184 return __alloc_pages_internal(gfp_mask, order, zonelist, NULL);
185}
186
187static inline struct page *
188__alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
189 struct zonelist *zonelist, nodemask_t *nodemask)
190{
191 return __alloc_pages_internal(gfp_mask, order, zonelist, nodemask);
192}
177 193
178extern struct page *
179__alloc_pages_nodemask(gfp_t, unsigned int,
180 struct zonelist *, nodemask_t *nodemask);
181 194
182static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, 195static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
183 unsigned int order) 196 unsigned int order)
@@ -215,6 +228,9 @@ extern struct page *alloc_page_vma(gfp_t gfp_mask,
215extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order); 228extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order);
216extern unsigned long get_zeroed_page(gfp_t gfp_mask); 229extern unsigned long get_zeroed_page(gfp_t gfp_mask);
217 230
231void *alloc_pages_exact(size_t size, gfp_t gfp_mask);
232void free_pages_exact(void *virt, size_t size);
233
218#define __get_free_page(gfp_mask) \ 234#define __get_free_page(gfp_mask) \
219 __get_free_pages((gfp_mask),0) 235 __get_free_pages((gfp_mask),0)
220 236
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 4987a84078e..730a20b8357 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -8,6 +8,9 @@
8 8
9#else 9#else
10 10
11#include <linux/types.h>
12#include <linux/errno.h>
13
11/* 14/*
12 * Some platforms don't support the GPIO programming interface. 15 * Some platforms don't support the GPIO programming interface.
13 * 16 *
@@ -76,6 +79,19 @@ static inline void gpio_set_value_cansleep(unsigned gpio, int value)
76 WARN_ON(1); 79 WARN_ON(1);
77} 80}
78 81
82static inline int gpio_export(unsigned gpio, bool direction_may_change)
83{
84 /* GPIO can never have been requested or set as {in,out}put */
85 WARN_ON(1);
86 return -EINVAL;
87}
88
89static inline void gpio_unexport(unsigned gpio)
90{
91 /* GPIO can never have been exported */
92 WARN_ON(1);
93}
94
79static inline int gpio_to_irq(unsigned gpio) 95static inline int gpio_to_irq(unsigned gpio)
80{ 96{
81 /* GPIO can never have been requested or set as input */ 97 /* GPIO can never have been requested or set as input */
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index c6d3a9de563..ec6ecd74781 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -9,6 +9,7 @@ struct gpio_keys_button {
9 char *desc; 9 char *desc;
10 int type; /* input event type (EV_KEY, EV_SW) */ 10 int type; /* input event type (EV_KEY, EV_SW) */
11 int wakeup; /* configure the button as a wake-up source */ 11 int wakeup; /* configure the button as a wake-up source */
12 int debounce_interval; /* debounce ticks interval in msecs */
12}; 13};
13 14
14struct gpio_keys_platform_data { 15struct gpio_keys_platform_data {
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 897f723bd22..181006cc94a 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -72,6 +72,14 @@
72#define in_softirq() (softirq_count()) 72#define in_softirq() (softirq_count())
73#define in_interrupt() (irq_count()) 73#define in_interrupt() (irq_count())
74 74
75#if defined(CONFIG_PREEMPT)
76# define PREEMPT_INATOMIC_BASE kernel_locked()
77# define PREEMPT_CHECK_OFFSET 1
78#else
79# define PREEMPT_INATOMIC_BASE 0
80# define PREEMPT_CHECK_OFFSET 0
81#endif
82
75/* 83/*
76 * Are we running in atomic context? WARNING: this macro cannot 84 * Are we running in atomic context? WARNING: this macro cannot
77 * always detect atomic context; in particular, it cannot know about 85 * always detect atomic context; in particular, it cannot know about
@@ -79,17 +87,11 @@
79 * used in the general case to determine whether sleeping is possible. 87 * used in the general case to determine whether sleeping is possible.
80 * Do not use in_atomic() in driver code. 88 * Do not use in_atomic() in driver code.
81 */ 89 */
82#define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0) 90#define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_INATOMIC_BASE)
83
84#ifdef CONFIG_PREEMPT
85# define PREEMPT_CHECK_OFFSET 1
86#else
87# define PREEMPT_CHECK_OFFSET 0
88#endif
89 91
90/* 92/*
91 * Check whether we were atomic before we did preempt_disable(): 93 * Check whether we were atomic before we did preempt_disable():
92 * (used by the scheduler) 94 * (used by the scheduler, *after* releasing the kernel lock)
93 */ 95 */
94#define in_atomic_preempt_off() \ 96#define in_atomic_preempt_off() \
95 ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET) 97 ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET)
diff --git a/include/linux/hayesesp.h b/include/linux/hayesesp.h
index 2177ee5b2fe..940aeb51d53 100644
--- a/include/linux/hayesesp.h
+++ b/include/linux/hayesesp.h
@@ -76,11 +76,10 @@ struct hayes_esp_config {
76 76
77struct esp_struct { 77struct esp_struct {
78 int magic; 78 int magic;
79 struct tty_port port;
79 spinlock_t lock; 80 spinlock_t lock;
80 int port; 81 int io_port;
81 int irq; 82 int irq;
82 int flags; /* defined in tty.h */
83 struct tty_struct *tty;
84 int read_status_mask; 83 int read_status_mask;
85 int ignore_status_mask; 84 int ignore_status_mask;
86 int timeout; 85 int timeout;
@@ -93,14 +92,10 @@ struct esp_struct {
93 int MCR; /* Modem control register */ 92 int MCR; /* Modem control register */
94 unsigned long last_active; 93 unsigned long last_active;
95 int line; 94 int line;
96 int count; /* # of fd on device */
97 int blocked_open; /* # of blocked opens */
98 unsigned char *xmit_buf; 95 unsigned char *xmit_buf;
99 int xmit_head; 96 int xmit_head;
100 int xmit_tail; 97 int xmit_tail;
101 int xmit_cnt; 98 int xmit_cnt;
102 wait_queue_head_t open_wait;
103 wait_queue_head_t close_wait;
104 wait_queue_head_t delta_msr_wait; 99 wait_queue_head_t delta_msr_wait;
105 wait_queue_head_t break_wait; 100 wait_queue_head_t break_wait;
106 struct async_icount icount; /* kernel counters for the 4 input interrupts */ 101 struct async_icount icount; /* kernel counters for the 4 input interrupts */
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index 6115545a5b9..c59769693be 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -45,7 +45,6 @@ struct hdlc_proto {
45 45
46/* Pointed to by dev->priv */ 46/* Pointed to by dev->priv */
47typedef struct hdlc_device { 47typedef struct hdlc_device {
48 struct net_device_stats stats;
49 /* used by HDLC layer to take control over HDLC device from hw driver*/ 48 /* used by HDLC layer to take control over HDLC device from hw driver*/
50 int (*attach)(struct net_device *dev, 49 int (*attach)(struct net_device *dev,
51 unsigned short encoding, unsigned short parity); 50 unsigned short encoding, unsigned short parity);
@@ -109,12 +108,6 @@ int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
109/* May be used by hardware driver to gain control over HDLC device */ 108/* May be used by hardware driver to gain control over HDLC device */
110void detach_hdlc_protocol(struct net_device *dev); 109void detach_hdlc_protocol(struct net_device *dev);
111 110
112static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev)
113{
114 return &dev_to_hdlc(dev)->stats;
115}
116
117
118static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb, 111static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb,
119 struct net_device *dev) 112 struct net_device *dev)
120{ 113{
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 4ce3b7a979b..ac4e678a04e 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -2,8 +2,6 @@
2#define __HID_H 2#define __HID_H
3 3
4/* 4/*
5 * $Id: hid.h,v 1.24 2001/12/27 10:37:41 vojtech Exp $
6 *
7 * Copyright (c) 1999 Andreas Gal 5 * Copyright (c) 1999 Andreas Gal
8 * Copyright (c) 2000-2001 Vojtech Pavlik 6 * Copyright (c) 2000-2001 Vojtech Pavlik
9 * Copyright (c) 2006-2007 Jiri Kosina 7 * Copyright (c) 2006-2007 Jiri Kosina
@@ -285,6 +283,7 @@ struct hid_item {
285#define HID_QUIRK_HWHEEL_WHEEL_INVERT 0x04000000 283#define HID_QUIRK_HWHEEL_WHEEL_INVERT 0x04000000
286#define HID_QUIRK_MICROSOFT_KEYS 0x08000000 284#define HID_QUIRK_MICROSOFT_KEYS 0x08000000
287#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 285#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
286#define HID_QUIRK_APPLE_NUMLOCK_EMULATION 0x20000000
288 287
289/* 288/*
290 * Separate quirks for runtime report descriptor fixup 289 * Separate quirks for runtime report descriptor fixup
@@ -513,7 +512,7 @@ struct hid_descriptor {
513 512
514/* Applications from HID Usage Tables 4/8/99 Version 1.1 */ 513/* Applications from HID Usage Tables 4/8/99 Version 1.1 */
515/* We ignore a few input applications that are not widely used */ 514/* We ignore a few input applications that are not widely used */
516#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001)) 515#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002))
517 516
518/* HID core API */ 517/* HID core API */
519 518
diff --git a/include/linux/hiddev.h b/include/linux/hiddev.h
index acbdae6d7ae..a416b904ba9 100644
--- a/include/linux/hiddev.h
+++ b/include/linux/hiddev.h
@@ -2,8 +2,6 @@
2#define _HIDDEV_H 2#define _HIDDEV_H
3 3
4/* 4/*
5 * $Id: hiddev.h,v 1.2 2001/04/26 11:26:09 vojtech Exp $
6 *
7 * Copyright (c) 1999-2000 Vojtech Pavlik 5 * Copyright (c) 1999-2000 Vojtech Pavlik
8 * 6 *
9 * Sponsored by SuSE 7 * Sponsored by SuSE
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index a79e80b689d..32e0ef0f6e1 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -8,7 +8,6 @@
8#include <linux/mempolicy.h> 8#include <linux/mempolicy.h>
9#include <linux/shm.h> 9#include <linux/shm.h>
10#include <asm/tlbflush.h> 10#include <asm/tlbflush.h>
11#include <asm/hugetlb.h>
12 11
13struct ctl_table; 12struct ctl_table;
14 13
@@ -17,38 +16,45 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
17 return vma->vm_flags & VM_HUGETLB; 16 return vma->vm_flags & VM_HUGETLB;
18} 17}
19 18
19void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
20int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 20int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *);
21int hugetlb_overcommit_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 21int hugetlb_overcommit_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *);
22int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 22int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *);
23int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); 23int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
24int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int, int); 24int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int, int);
25void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); 25void unmap_hugepage_range(struct vm_area_struct *,
26void __unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); 26 unsigned long, unsigned long, struct page *);
27void __unmap_hugepage_range(struct vm_area_struct *,
28 unsigned long, unsigned long, struct page *);
27int hugetlb_prefault(struct address_space *, struct vm_area_struct *); 29int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
28int hugetlb_report_meminfo(char *); 30int hugetlb_report_meminfo(char *);
29int hugetlb_report_node_meminfo(int, char *); 31int hugetlb_report_node_meminfo(int, char *);
30unsigned long hugetlb_total_pages(void); 32unsigned long hugetlb_total_pages(void);
31int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, 33int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
32 unsigned long address, int write_access); 34 unsigned long address, int write_access);
33int hugetlb_reserve_pages(struct inode *inode, long from, long to); 35int hugetlb_reserve_pages(struct inode *inode, long from, long to,
36 struct vm_area_struct *vma);
34void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed); 37void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
35 38
36extern unsigned long max_huge_pages;
37extern unsigned long sysctl_overcommit_huge_pages;
38extern unsigned long hugepages_treat_as_movable; 39extern unsigned long hugepages_treat_as_movable;
39extern const unsigned long hugetlb_zero, hugetlb_infinity; 40extern const unsigned long hugetlb_zero, hugetlb_infinity;
40extern int sysctl_hugetlb_shm_group; 41extern int sysctl_hugetlb_shm_group;
42extern struct list_head huge_boot_pages;
41 43
42/* arch callbacks */ 44/* arch callbacks */
43 45
44pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr); 46pte_t *huge_pte_alloc(struct mm_struct *mm,
47 unsigned long addr, unsigned long sz);
45pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr); 48pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr);
46int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep); 49int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep);
47struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address, 50struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
48 int write); 51 int write);
49struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, 52struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
50 pmd_t *pmd, int write); 53 pmd_t *pmd, int write);
54struct page *follow_huge_pud(struct mm_struct *mm, unsigned long address,
55 pud_t *pud, int write);
51int pmd_huge(pmd_t pmd); 56int pmd_huge(pmd_t pmd);
57int pud_huge(pud_t pmd);
52void hugetlb_change_protection(struct vm_area_struct *vma, 58void hugetlb_change_protection(struct vm_area_struct *vma,
53 unsigned long address, unsigned long end, pgprot_t newprot); 59 unsigned long address, unsigned long end, pgprot_t newprot);
54 60
@@ -58,6 +64,11 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
58{ 64{
59 return 0; 65 return 0;
60} 66}
67
68static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma)
69{
70}
71
61static inline unsigned long hugetlb_total_pages(void) 72static inline unsigned long hugetlb_total_pages(void)
62{ 73{
63 return 0; 74 return 0;
@@ -67,12 +78,14 @@ static inline unsigned long hugetlb_total_pages(void)
67#define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL) 78#define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL)
68#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) 79#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; })
69#define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) 80#define hugetlb_prefault(mapping, vma) ({ BUG(); 0; })
70#define unmap_hugepage_range(vma, start, end) BUG() 81#define unmap_hugepage_range(vma, start, end, page) BUG()
71#define hugetlb_report_meminfo(buf) 0 82#define hugetlb_report_meminfo(buf) 0
72#define hugetlb_report_node_meminfo(n, buf) 0 83#define hugetlb_report_node_meminfo(n, buf) 0
73#define follow_huge_pmd(mm, addr, pmd, write) NULL 84#define follow_huge_pmd(mm, addr, pmd, write) NULL
74#define prepare_hugepage_range(addr,len) (-EINVAL) 85#define follow_huge_pud(mm, addr, pud, write) NULL
86#define prepare_hugepage_range(file, addr, len) (-EINVAL)
75#define pmd_huge(x) 0 87#define pmd_huge(x) 0
88#define pud_huge(x) 0
76#define is_hugepage_only_range(mm, addr, len) 0 89#define is_hugepage_only_range(mm, addr, len) 0
77#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) 90#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })
78#define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; }) 91#define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; })
@@ -93,6 +106,7 @@ struct hugetlbfs_config {
93 umode_t mode; 106 umode_t mode;
94 long nr_blocks; 107 long nr_blocks;
95 long nr_inodes; 108 long nr_inodes;
109 struct hstate *hstate;
96}; 110};
97 111
98struct hugetlbfs_sb_info { 112struct hugetlbfs_sb_info {
@@ -101,6 +115,7 @@ struct hugetlbfs_sb_info {
101 long max_inodes; /* inodes allowed */ 115 long max_inodes; /* inodes allowed */
102 long free_inodes; /* inodes free */ 116 long free_inodes; /* inodes free */
103 spinlock_t stat_lock; 117 spinlock_t stat_lock;
118 struct hstate *hstate;
104}; 119};
105 120
106 121
@@ -125,8 +140,6 @@ struct file *hugetlb_file_setup(const char *name, size_t);
125int hugetlb_get_quota(struct address_space *mapping, long delta); 140int hugetlb_get_quota(struct address_space *mapping, long delta);
126void hugetlb_put_quota(struct address_space *mapping, long delta); 141void hugetlb_put_quota(struct address_space *mapping, long delta);
127 142
128#define BLOCKS_PER_HUGEPAGE (HPAGE_SIZE / 512)
129
130static inline int is_file_hugepages(struct file *file) 143static inline int is_file_hugepages(struct file *file)
131{ 144{
132 if (file->f_op == &hugetlbfs_file_operations) 145 if (file->f_op == &hugetlbfs_file_operations)
@@ -155,4 +168,115 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
155 unsigned long flags); 168 unsigned long flags);
156#endif /* HAVE_ARCH_HUGETLB_UNMAPPED_AREA */ 169#endif /* HAVE_ARCH_HUGETLB_UNMAPPED_AREA */
157 170
171#ifdef CONFIG_HUGETLB_PAGE
172
173#define HSTATE_NAME_LEN 32
174/* Defines one hugetlb page size */
175struct hstate {
176 int hugetlb_next_nid;
177 unsigned int order;
178 unsigned long mask;
179 unsigned long max_huge_pages;
180 unsigned long nr_huge_pages;
181 unsigned long free_huge_pages;
182 unsigned long resv_huge_pages;
183 unsigned long surplus_huge_pages;
184 unsigned long nr_overcommit_huge_pages;
185 struct list_head hugepage_freelists[MAX_NUMNODES];
186 unsigned int nr_huge_pages_node[MAX_NUMNODES];
187 unsigned int free_huge_pages_node[MAX_NUMNODES];
188 unsigned int surplus_huge_pages_node[MAX_NUMNODES];
189 char name[HSTATE_NAME_LEN];
190};
191
192struct huge_bootmem_page {
193 struct list_head list;
194 struct hstate *hstate;
195};
196
197/* arch callback */
198int __init alloc_bootmem_huge_page(struct hstate *h);
199
200void __init hugetlb_add_hstate(unsigned order);
201struct hstate *size_to_hstate(unsigned long size);
202
203#ifndef HUGE_MAX_HSTATE
204#define HUGE_MAX_HSTATE 1
205#endif
206
207extern struct hstate hstates[HUGE_MAX_HSTATE];
208extern unsigned int default_hstate_idx;
209
210#define default_hstate (hstates[default_hstate_idx])
211
212static inline struct hstate *hstate_inode(struct inode *i)
213{
214 struct hugetlbfs_sb_info *hsb;
215 hsb = HUGETLBFS_SB(i->i_sb);
216 return hsb->hstate;
217}
218
219static inline struct hstate *hstate_file(struct file *f)
220{
221 return hstate_inode(f->f_dentry->d_inode);
222}
223
224static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
225{
226 return hstate_file(vma->vm_file);
227}
228
229static inline unsigned long huge_page_size(struct hstate *h)
230{
231 return (unsigned long)PAGE_SIZE << h->order;
232}
233
234static inline unsigned long huge_page_mask(struct hstate *h)
235{
236 return h->mask;
237}
238
239static inline unsigned int huge_page_order(struct hstate *h)
240{
241 return h->order;
242}
243
244static inline unsigned huge_page_shift(struct hstate *h)
245{
246 return h->order + PAGE_SHIFT;
247}
248
249static inline unsigned int pages_per_huge_page(struct hstate *h)
250{
251 return 1 << h->order;
252}
253
254static inline unsigned int blocks_per_huge_page(struct hstate *h)
255{
256 return huge_page_size(h) / 512;
257}
258
259#include <asm/hugetlb.h>
260
261static inline struct hstate *page_hstate(struct page *page)
262{
263 return size_to_hstate(PAGE_SIZE << compound_order(page));
264}
265
266#else
267struct hstate {};
268#define alloc_bootmem_huge_page(h) NULL
269#define hstate_file(f) NULL
270#define hstate_vma(v) NULL
271#define hstate_inode(i) NULL
272#define huge_page_size(h) PAGE_SIZE
273#define huge_page_mask(h) PAGE_MASK
274#define huge_page_order(h) 0
275#define huge_page_shift(h) PAGE_SHIFT
276static inline unsigned int pages_per_huge_page(struct hstate *h)
277{
278 return 1;
279}
280#endif
281
158#endif /* _LINUX_HUGETLB_H */ 282#endif /* _LINUX_HUGETLB_H */
diff --git a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h
index 77afbb60fd1..0177d280f73 100644
--- a/include/linux/i2c-algo-pcf.h
+++ b/include/linux/i2c-algo-pcf.h
@@ -33,9 +33,11 @@ struct i2c_algo_pcf_data {
33 int (*getclock) (void *data); 33 int (*getclock) (void *data);
34 void (*waitforpin) (void); 34 void (*waitforpin) (void);
35 35
36 /* local settings */ 36 /* Multi-master lost arbitration back-off delay (msecs)
37 int udelay; 37 * This should be set by the bus adapter or knowledgable client
38 int timeout; 38 * if bus is multi-mastered, else zero
39 */
40 unsigned long lab_mdelay;
39}; 41};
40 42
41int i2c_pcf_add_bus(struct i2c_adapter *); 43int i2c_pcf_add_bus(struct i2c_adapter *);
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 580acc93903..4862398e05b 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -33,15 +33,11 @@
33 33
34#define I2C_DRIVERID_MSP3400 1 34#define I2C_DRIVERID_MSP3400 1
35#define I2C_DRIVERID_TUNER 2 35#define I2C_DRIVERID_TUNER 2
36#define I2C_DRIVERID_TDA8425 4 /* stereo sound processor */
37#define I2C_DRIVERID_TEA6420 5 /* audio matrix switch */ 36#define I2C_DRIVERID_TEA6420 5 /* audio matrix switch */
38#define I2C_DRIVERID_TEA6415C 6 /* video matrix switch */ 37#define I2C_DRIVERID_TEA6415C 6 /* video matrix switch */
39#define I2C_DRIVERID_TDA9840 7 /* stereo sound processor */ 38#define I2C_DRIVERID_TDA9840 7 /* stereo sound processor */
40#define I2C_DRIVERID_SAA7111A 8 /* video input processor */ 39#define I2C_DRIVERID_SAA7111A 8 /* video input processor */
41#define I2C_DRIVERID_SAA7185B 13 /* video encoder */ 40#define I2C_DRIVERID_SAA7185B 13 /* video encoder */
42#define I2C_DRIVERID_TEA6300 18 /* audio mixer */
43#define I2C_DRIVERID_TDA9850 20 /* audio mixer */
44#define I2C_DRIVERID_TDA9855 21 /* audio mixer */
45#define I2C_DRIVERID_SAA7110 22 /* video decoder */ 41#define I2C_DRIVERID_SAA7110 22 /* video decoder */
46#define I2C_DRIVERID_MGATVO 23 /* Matrox TVOut */ 42#define I2C_DRIVERID_MGATVO 23 /* Matrox TVOut */
47#define I2C_DRIVERID_SAA5249 24 /* SAA5249 and compatibles */ 43#define I2C_DRIVERID_SAA5249 24 /* SAA5249 and compatibles */
@@ -50,9 +46,7 @@
50#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */ 46#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */
51#define I2C_DRIVERID_TVMIXER 28 /* Mixer driver for tv cards */ 47#define I2C_DRIVERID_TVMIXER 28 /* Mixer driver for tv cards */
52#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */ 48#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */
53#define I2C_DRIVERID_TDA9873 31 /* TV sound decoder chip */
54#define I2C_DRIVERID_TDA9875 32 /* TV sound decoder chip */ 49#define I2C_DRIVERID_TDA9875 32 /* TV sound decoder chip */
55#define I2C_DRIVERID_PIC16C54_PV9 33 /* Audio mux/ir receiver */
56#define I2C_DRIVERID_BT819 40 /* video decoder */ 50#define I2C_DRIVERID_BT819 40 /* video decoder */
57#define I2C_DRIVERID_BT856 41 /* video encoder */ 51#define I2C_DRIVERID_BT856 41 /* video encoder */
58#define I2C_DRIVERID_VPX3220 42 /* video decoder+vbi/vtxt */ 52#define I2C_DRIVERID_VPX3220 42 /* video decoder+vbi/vtxt */
@@ -63,7 +57,6 @@
63#define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */ 57#define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */
64#define I2C_DRIVERID_OVCAMCHIP 61 /* OmniVision CMOS image sens. */ 58#define I2C_DRIVERID_OVCAMCHIP 61 /* OmniVision CMOS image sens. */
65#define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */ 59#define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */
66#define I2C_DRIVERID_TDA9874 66 /* TV sound decoder */
67#define I2C_DRIVERID_SAA6752HS 67 /* MPEG2 encoder */ 60#define I2C_DRIVERID_SAA6752HS 67 /* MPEG2 encoder */
68#define I2C_DRIVERID_TVEEPROM 68 /* TV EEPROM */ 61#define I2C_DRIVERID_TVEEPROM 68 /* TV EEPROM */
69#define I2C_DRIVERID_WM8775 69 /* wm8775 audio processor */ 62#define I2C_DRIVERID_WM8775 69 /* wm8775 audio processor */
@@ -91,8 +84,6 @@
91#define I2C_DRIVERID_M52790 95 /* Mitsubishi M52790SP/FP AV switch */ 84#define I2C_DRIVERID_M52790 95 /* Mitsubishi M52790SP/FP AV switch */
92#define I2C_DRIVERID_CS5345 96 /* cs5345 audio processor */ 85#define I2C_DRIVERID_CS5345 96 /* cs5345 audio processor */
93 86
94#define I2C_DRIVERID_I2CDEV 900
95
96#define I2C_DRIVERID_OV7670 1048 /* Omnivision 7670 camera */ 87#define I2C_DRIVERID_OV7670 1048 /* Omnivision 7670 camera */
97 88
98/* 89/*
@@ -111,7 +102,6 @@
111#define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */ 102#define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */
112#define I2C_HW_B_IOC 0x010011 /* IOC bit-wiggling */ 103#define I2C_HW_B_IOC 0x010011 /* IOC bit-wiggling */
113#define I2C_HW_B_IXP2000 0x010016 /* GPIO on IXP2000 systems */ 104#define I2C_HW_B_IXP2000 0x010016 /* GPIO on IXP2000 systems */
114#define I2C_HW_B_S3VIA 0x010018 /* S3Via ProSavage adapter */
115#define I2C_HW_B_ZR36067 0x010019 /* Zoran-36057/36067 based boards */ 105#define I2C_HW_B_ZR36067 0x010019 /* Zoran-36057/36067 based boards */
116#define I2C_HW_B_PCILYNX 0x01001a /* TI PCILynx I2C adapter */ 106#define I2C_HW_B_PCILYNX 0x01001a /* TI PCILynx I2C adapter */
117#define I2C_HW_B_CX2388x 0x01001b /* connexant 2388x based tv cards */ 107#define I2C_HW_B_CX2388x 0x01001b /* connexant 2388x based tv cards */
@@ -161,7 +151,6 @@
161#define I2C_HW_SMBUS_W9968CF 0x04000d 151#define I2C_HW_SMBUS_W9968CF 0x04000d
162#define I2C_HW_SMBUS_OV511 0x04000e /* OV511(+) USB 1.1 webcam ICs */ 152#define I2C_HW_SMBUS_OV511 0x04000e /* OV511(+) USB 1.1 webcam ICs */
163#define I2C_HW_SMBUS_OV518 0x04000f /* OV518(+) USB 1.1 webcam ICs */ 153#define I2C_HW_SMBUS_OV518 0x04000f /* OV518(+) USB 1.1 webcam ICs */
164#define I2C_HW_SMBUS_OVFX2 0x040011 /* Cypress/OmniVision FX2 webcam */
165#define I2C_HW_SMBUS_CAFE 0x040012 /* Marvell 88ALP01 "CAFE" cam */ 154#define I2C_HW_SMBUS_CAFE 0x040012 /* Marvell 88ALP01 "CAFE" cam */
166#define I2C_HW_SMBUS_ALI1563 0x040013 155#define I2C_HW_SMBUS_ALI1563 0x040013
167 156
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index cb63da5c213..08be0d21864 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -35,6 +35,8 @@
35#include <linux/sched.h> /* for completion */ 35#include <linux/sched.h> /* for completion */
36#include <linux/mutex.h> 36#include <linux/mutex.h>
37 37
38extern struct bus_type i2c_bus_type;
39
38/* --- General options ------------------------------------------------ */ 40/* --- General options ------------------------------------------------ */
39 41
40struct i2c_msg; 42struct i2c_msg;
@@ -43,6 +45,7 @@ struct i2c_adapter;
43struct i2c_client; 45struct i2c_client;
44struct i2c_driver; 46struct i2c_driver;
45union i2c_smbus_data; 47union i2c_smbus_data;
48struct i2c_board_info;
46 49
47/* 50/*
48 * The master routines are the ones normally used to transmit data to devices 51 * The master routines are the ones normally used to transmit data to devices
@@ -69,9 +72,8 @@ extern s32 i2c_smbus_xfer (struct i2c_adapter * adapter, u16 addr,
69 union i2c_smbus_data * data); 72 union i2c_smbus_data * data);
70 73
71/* Now follow the 'nice' access routines. These also document the calling 74/* Now follow the 'nice' access routines. These also document the calling
72 conventions of smbus_access. */ 75 conventions of i2c_smbus_xfer. */
73 76
74extern s32 i2c_smbus_write_quick(struct i2c_client * client, u8 value);
75extern s32 i2c_smbus_read_byte(struct i2c_client * client); 77extern s32 i2c_smbus_read_byte(struct i2c_client * client);
76extern s32 i2c_smbus_write_byte(struct i2c_client * client, u8 value); 78extern s32 i2c_smbus_write_byte(struct i2c_client * client, u8 value);
77extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command); 79extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command);
@@ -93,15 +95,33 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client,
93 u8 command, u8 length, 95 u8 command, u8 length,
94 const u8 *values); 96 const u8 *values);
95 97
96/* 98/**
97 * A driver is capable of handling one or more physical devices present on 99 * struct i2c_driver - represent an I2C device driver
98 * I2C adapters. This information is used to inform the driver of adapter 100 * @class: What kind of i2c device we instantiate (for detect)
99 * events. 101 * @detect: Callback for device detection
102 * @address_data: The I2C addresses to probe, ignore or force (for detect)
103 * @clients: List of detected clients we created (for i2c-core use only)
100 * 104 *
101 * The driver.owner field should be set to the module owner of this driver. 105 * The driver.owner field should be set to the module owner of this driver.
102 * The driver.name field should be set to the name of this driver. 106 * The driver.name field should be set to the name of this driver.
107 *
108 * For automatic device detection, both @detect and @address_data must
109 * be defined. @class should also be set, otherwise only devices forced
110 * with module parameters will be created. The detect function must
111 * fill at least the name field of the i2c_board_info structure it is
112 * handed upon successful detection, and possibly also the flags field.
113 *
114 * If @detect is missing, the driver will still work fine for enumerated
115 * devices. Detected devices simply won't be supported. This is expected
116 * for the many I2C/SMBus devices which can't be detected reliably, and
117 * the ones which can always be enumerated in practice.
118 *
119 * The i2c_client structure which is handed to the @detect callback is
120 * not a real i2c_client. It is initialized just enough so that you can
121 * call i2c_smbus_read_byte_data and friends on it. Don't do anything
122 * else with it. In particular, calling dev_dbg and friends on it is
123 * not allowed.
103 */ 124 */
104
105struct i2c_driver { 125struct i2c_driver {
106 int id; 126 int id;
107 unsigned int class; 127 unsigned int class;
@@ -141,6 +161,11 @@ struct i2c_driver {
141 161
142 struct device_driver driver; 162 struct device_driver driver;
143 const struct i2c_device_id *id_table; 163 const struct i2c_device_id *id_table;
164
165 /* Device detection callback for automatic device creation */
166 int (*detect)(struct i2c_client *, int kind, struct i2c_board_info *);
167 const struct i2c_client_address_data *address_data;
168 struct list_head clients;
144}; 169};
145#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) 170#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
146 171
@@ -155,9 +180,8 @@ struct i2c_driver {
155 * @driver: device's driver, hence pointer to access routines 180 * @driver: device's driver, hence pointer to access routines
156 * @dev: Driver model device node for the slave. 181 * @dev: Driver model device node for the slave.
157 * @irq: indicates the IRQ generated by this device (if any) 182 * @irq: indicates the IRQ generated by this device (if any)
158 * @driver_name: Identifies new-style driver used with this device; also
159 * used as the module name for hotplug/coldplug modprobe support.
160 * @list: list of active/busy clients (DEPRECATED) 183 * @list: list of active/busy clients (DEPRECATED)
184 * @detected: member of an i2c_driver.clients list
161 * @released: used to synchronize client releases & detaches and references 185 * @released: used to synchronize client releases & detaches and references
162 * 186 *
163 * An i2c_client identifies a single device (i.e. chip) connected to an 187 * An i2c_client identifies a single device (i.e. chip) connected to an
@@ -173,9 +197,9 @@ struct i2c_client {
173 struct i2c_adapter *adapter; /* the adapter we sit on */ 197 struct i2c_adapter *adapter; /* the adapter we sit on */
174 struct i2c_driver *driver; /* and our access routines */ 198 struct i2c_driver *driver; /* and our access routines */
175 struct device dev; /* the device structure */ 199 struct device dev; /* the device structure */
176 int irq; /* irq issued by device (or -1) */ 200 int irq; /* irq issued by device */
177 char driver_name[KOBJ_NAME_LEN];
178 struct list_head list; /* DEPRECATED */ 201 struct list_head list; /* DEPRECATED */
202 struct list_head detected;
179 struct completion released; 203 struct completion released;
180}; 204};
181#define to_i2c_client(d) container_of(d, struct i2c_client, dev) 205#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
@@ -200,8 +224,7 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data)
200 224
201/** 225/**
202 * struct i2c_board_info - template for device creation 226 * struct i2c_board_info - template for device creation
203 * @driver_name: identifies the driver to be bound to the device 227 * @type: chip type, to initialize i2c_client.name
204 * @type: optional chip type information, to initialize i2c_client.name
205 * @flags: to initialize i2c_client.flags 228 * @flags: to initialize i2c_client.flags
206 * @addr: stored in i2c_client.addr 229 * @addr: stored in i2c_client.addr
207 * @platform_data: stored in i2c_client.dev.platform_data 230 * @platform_data: stored in i2c_client.dev.platform_data
@@ -220,7 +243,6 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data)
220 * with the adapter already known. 243 * with the adapter already known.
221 */ 244 */
222struct i2c_board_info { 245struct i2c_board_info {
223 char driver_name[KOBJ_NAME_LEN];
224 char type[I2C_NAME_SIZE]; 246 char type[I2C_NAME_SIZE];
225 unsigned short flags; 247 unsigned short flags;
226 unsigned short addr; 248 unsigned short addr;
@@ -262,7 +284,7 @@ i2c_new_probed_device(struct i2c_adapter *adap,
262 * client handles for the extra addresses. 284 * client handles for the extra addresses.
263 */ 285 */
264extern struct i2c_client * 286extern struct i2c_client *
265i2c_new_dummy(struct i2c_adapter *adap, u16 address, const char *type); 287i2c_new_dummy(struct i2c_adapter *adap, u16 address);
266 288
267extern void i2c_unregister_device(struct i2c_client *); 289extern void i2c_unregister_device(struct i2c_client *);
268 290
@@ -355,10 +377,11 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
355#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ 377#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */
356#define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */ 378#define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */
357#define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */ 379#define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */
358#define I2C_CLASS_DDC (1<<3) /* i2c-matroxfb ? */ 380#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */
359#define I2C_CLASS_CAM_ANALOG (1<<4) /* camera with analog CCD */ 381#define I2C_CLASS_CAM_ANALOG (1<<4) /* camera with analog CCD */
360#define I2C_CLASS_CAM_DIGITAL (1<<5) /* most webcams */ 382#define I2C_CLASS_CAM_DIGITAL (1<<5) /* most webcams */
361#define I2C_CLASS_SOUND (1<<6) /* sound devices */ 383#define I2C_CLASS_SOUND (1<<6) /* sound devices */
384#define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */
362#define I2C_CLASS_ALL (UINT_MAX) /* all of the above */ 385#define I2C_CLASS_ALL (UINT_MAX) /* all of the above */
363 386
364/* i2c_client_address_data is the struct for holding default client 387/* i2c_client_address_data is the struct for holding default client
@@ -542,7 +565,7 @@ union i2c_smbus_data {
542 /* and one more for user-space compatibility */ 565 /* and one more for user-space compatibility */
543}; 566};
544 567
545/* smbus_access read or write markers */ 568/* i2c_smbus_xfer read or write markers */
546#define I2C_SMBUS_READ 1 569#define I2C_SMBUS_READ 1
547#define I2C_SMBUS_WRITE 0 570#define I2C_SMBUS_WRITE 0
548 571
diff --git a/include/linux/i2c/at24.h b/include/linux/i2c/at24.h
new file mode 100644
index 00000000000..f6edd522a92
--- /dev/null
+++ b/include/linux/i2c/at24.h
@@ -0,0 +1,28 @@
1#ifndef _LINUX_AT24_H
2#define _LINUX_AT24_H
3
4#include <linux/types.h>
5
6/*
7 * As seen through Linux I2C, differences between the most common types of I2C
8 * memory include:
9 * - How much memory is available (usually specified in bit)?
10 * - What write page size does it support?
11 * - Special flags (16 bit addresses, read_only, world readable...)?
12 *
13 * If you set up a custom eeprom type, please double-check the parameters.
14 * Especially page_size needs extra care, as you risk data loss if your value
15 * is bigger than what the chip actually supports!
16 */
17
18struct at24_platform_data {
19 u32 byte_len; /* size (sum of all addr) */
20 u16 page_size; /* for writes */
21 u8 flags;
22#define AT24_FLAG_ADDR16 0x80 /* address pointer is 16 bit */
23#define AT24_FLAG_READONLY 0x40 /* sysfs-entry will be read-only */
24#define AT24_FLAG_IRUGO 0x20 /* sysfs-entry will be world-readable */
25#define AT24_FLAG_TAKE8ADDR 0x10 /* take always 8 addresses (24c00) */
26};
27
28#endif /* _LINUX_AT24_H */
diff --git a/include/linux/i2c/max732x.h b/include/linux/i2c/max732x.h
new file mode 100644
index 00000000000..e10336631c6
--- /dev/null
+++ b/include/linux/i2c/max732x.h
@@ -0,0 +1,19 @@
1#ifndef __LINUX_I2C_MAX732X_H
2#define __LINUX_I2C_MAX732X_H
3
4/* platform data for the MAX732x 8/16-bit I/O expander driver */
5
6struct max732x_platform_data {
7 /* number of the first GPIO */
8 unsigned gpio_base;
9
10 void *context; /* param to setup/teardown */
11
12 int (*setup)(struct i2c_client *client,
13 unsigned gpio, unsigned ngpio,
14 void *context);
15 int (*teardown)(struct i2c_client *client,
16 unsigned gpio, unsigned ngpio,
17 void *context);
18};
19#endif /* __LINUX_I2C_MAX732X_H */
diff --git a/include/linux/i2c/pcf857x.h b/include/linux/i2c/pcf857x.h
index ba8ea6e1647..0767a2a6b2f 100644
--- a/include/linux/i2c/pcf857x.h
+++ b/include/linux/i2c/pcf857x.h
@@ -12,8 +12,7 @@
12 * @context: optional parameter passed to setup() and teardown() 12 * @context: optional parameter passed to setup() and teardown()
13 * 13 *
14 * In addition to the I2C_BOARD_INFO() state appropriate to each chip, 14 * In addition to the I2C_BOARD_INFO() state appropriate to each chip,
15 * the i2c_board_info used with the pcf875x driver must provide the 15 * the i2c_board_info used with the pcf875x driver must provide its
16 * chip "type" ("pcf8574", "pcf8574a", "pcf8575", "pcf8575c") and its
17 * platform_data (pointer to one of these structures) with at least 16 * platform_data (pointer to one of these structures) with at least
18 * the gpio_base value initialized. 17 * the gpio_base value initialized.
19 * 18 *
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index 7d51cbca49a..75ae6d8aba4 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -758,7 +758,7 @@ static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
758 } 758 }
759 759
760 dma_addr = dma_map_single(&c->pdev->dev, ptr, size, direction); 760 dma_addr = dma_map_single(&c->pdev->dev, ptr, size, direction);
761 if (!dma_mapping_error(dma_addr)) { 761 if (!dma_mapping_error(&c->pdev->dev, dma_addr)) {
762#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 762#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
763 if ((sizeof(dma_addr_t) > 4) && c->pae_support) { 763 if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
764 *mptr++ = cpu_to_le32(0x7C020002); 764 *mptr++ = cpu_to_le32(0x7C020002);
diff --git a/include/linux/ide.h b/include/linux/ide.h
index b0135b0c3a0..b846bc44a27 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -139,6 +139,12 @@ struct ide_io_ports {
139#define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */ 139#define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */
140 140
141/* 141/*
142 * Op codes for special requests to be handled by ide_special_rq().
143 * Values should be in the range of 0x20 to 0x3f.
144 */
145#define REQ_DRIVE_RESET 0x20
146
147/*
142 * Check for an interrupt and acknowledge the interrupt status 148 * Check for an interrupt and acknowledge the interrupt status
143 */ 149 */
144struct hwif_s; 150struct hwif_s;
@@ -153,7 +159,7 @@ enum { ide_unknown, ide_generic, ide_pci,
153 ide_qd65xx, ide_umc8672, ide_ht6560b, 159 ide_qd65xx, ide_umc8672, ide_ht6560b,
154 ide_rz1000, ide_trm290, 160 ide_rz1000, ide_trm290,
155 ide_cmd646, ide_cy82c693, ide_4drives, 161 ide_cmd646, ide_cy82c693, ide_4drives,
156 ide_pmac, ide_etrax100, ide_acorn, 162 ide_pmac, ide_acorn,
157 ide_au1xxx, ide_palm3710 163 ide_au1xxx, ide_palm3710
158}; 164};
159 165
@@ -171,7 +177,8 @@ typedef struct hw_regs_s {
171 int irq; /* our irq number */ 177 int irq; /* our irq number */
172 ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ 178 ide_ack_intr_t *ack_intr; /* acknowledge interrupt */
173 hwif_chipset_t chipset; 179 hwif_chipset_t chipset;
174 struct device *dev; 180 struct device *dev, *parent;
181 unsigned long config;
175} hw_regs_t; 182} hw_regs_t;
176 183
177void ide_init_port_data(struct hwif_s *, unsigned int); 184void ide_init_port_data(struct hwif_s *, unsigned int);
@@ -189,7 +196,36 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
189 hw->io_ports.ctl_addr = ctl_addr; 196 hw->io_ports.ctl_addr = ctl_addr;
190} 197}
191 198
199/* for IDE PCI controllers in legacy mode, temporary */
200static inline int __ide_default_irq(unsigned long base)
201{
202 switch (base) {
203#ifdef CONFIG_IA64
204 case 0x1f0: return isa_irq_to_vector(14);
205 case 0x170: return isa_irq_to_vector(15);
206#else
207 case 0x1f0: return 14;
208 case 0x170: return 15;
209#endif
210 }
211 return 0;
212}
213
214#if defined(CONFIG_ARM) || defined(CONFIG_FRV) || defined(CONFIG_M68K) || \
215 defined(CONFIG_MIPS) || defined(CONFIG_MN10300) || defined(CONFIG_PARISC) \
216 || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || defined(CONFIG_SPARC64)
192#include <asm/ide.h> 217#include <asm/ide.h>
218#else
219#include <asm-generic/ide_iops.h>
220#endif
221
222#ifndef MAX_HWIFS
223#if defined(CONFIG_BLACKFIN) || defined(CONFIG_H8300) || defined(CONFIG_XTENSA)
224# define MAX_HWIFS 1
225#else
226# define MAX_HWIFS 10
227#endif
228#endif
193 229
194#if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED) 230#if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED)
195#undef MAX_HWIFS 231#undef MAX_HWIFS
@@ -286,7 +322,65 @@ struct ide_acpi_drive_link;
286struct ide_acpi_hwif_link; 322struct ide_acpi_hwif_link;
287#endif 323#endif
288 324
289typedef struct ide_drive_s { 325/* ATAPI device flags */
326enum {
327 IDE_AFLAG_DRQ_INTERRUPT = (1 << 0),
328 IDE_AFLAG_MEDIA_CHANGED = (1 << 1),
329
330 /* ide-cd */
331 /* Drive cannot lock the door. */
332 IDE_AFLAG_NO_DOORLOCK = (1 << 2),
333 /* Drive cannot eject the disc. */
334 IDE_AFLAG_NO_EJECT = (1 << 3),
335 /* Drive is a pre ATAPI 1.2 drive. */
336 IDE_AFLAG_PRE_ATAPI12 = (1 << 4),
337 /* TOC addresses are in BCD. */
338 IDE_AFLAG_TOCADDR_AS_BCD = (1 << 5),
339 /* TOC track numbers are in BCD. */
340 IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 6),
341 /*
342 * Drive does not provide data in multiples of SECTOR_SIZE
343 * when more than one interrupt is needed.
344 */
345 IDE_AFLAG_LIMIT_NFRAMES = (1 << 7),
346 /* Seeking in progress. */
347 IDE_AFLAG_SEEKING = (1 << 8),
348 /* Saved TOC information is current. */
349 IDE_AFLAG_TOC_VALID = (1 << 9),
350 /* We think that the drive door is locked. */
351 IDE_AFLAG_DOOR_LOCKED = (1 << 10),
352 /* SET_CD_SPEED command is unsupported. */
353 IDE_AFLAG_NO_SPEED_SELECT = (1 << 11),
354 IDE_AFLAG_VERTOS_300_SSD = (1 << 12),
355 IDE_AFLAG_VERTOS_600_ESD = (1 << 13),
356 IDE_AFLAG_SANYO_3CD = (1 << 14),
357 IDE_AFLAG_FULL_CAPS_PAGE = (1 << 15),
358 IDE_AFLAG_PLAY_AUDIO_OK = (1 << 16),
359 IDE_AFLAG_LE_SPEED_FIELDS = (1 << 17),
360
361 /* ide-floppy */
362 /* Format in progress */
363 IDE_AFLAG_FORMAT_IN_PROGRESS = (1 << 18),
364 /* Avoid commands not supported in Clik drive */
365 IDE_AFLAG_CLIK_DRIVE = (1 << 19),
366 /* Requires BH algorithm for packets */
367 IDE_AFLAG_ZIP_DRIVE = (1 << 20),
368
369 /* ide-tape */
370 IDE_AFLAG_IGNORE_DSC = (1 << 21),
371 /* 0 When the tape position is unknown */
372 IDE_AFLAG_ADDRESS_VALID = (1 << 22),
373 /* Device already opened */
374 IDE_AFLAG_BUSY = (1 << 23),
375 /* Attempt to auto-detect the current user block size */
376 IDE_AFLAG_DETECT_BS = (1 << 24),
377 /* Currently on a filemark */
378 IDE_AFLAG_FILEMARK = (1 << 25),
379 /* 0 = no tape is loaded, so we don't rewind after ejecting */
380 IDE_AFLAG_MEDIUM_PRESENT = (1 << 26)
381};
382
383struct ide_drive_s {
290 char name[4]; /* drive name, such as "hda" */ 384 char name[4]; /* drive name, such as "hda" */
291 char driver_req[10]; /* requests specific driver */ 385 char driver_req[10]; /* requests specific driver */
292 386
@@ -334,7 +428,6 @@ typedef struct ide_drive_s {
334 unsigned nodma : 1; /* disallow DMA */ 428 unsigned nodma : 1; /* disallow DMA */
335 unsigned remap_0_to_1 : 1; /* 0=noremap, 1=remap 0->1 (for EZDrive) */ 429 unsigned remap_0_to_1 : 1; /* 0=noremap, 1=remap 0->1 (for EZDrive) */
336 unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */ 430 unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */
337 unsigned vdma : 1; /* 1=doing PIO over DMA 0=doing normal DMA */
338 unsigned scsi : 1; /* 0=default, 1=ide-scsi emulation */ 431 unsigned scsi : 1; /* 0=default, 1=ide-scsi emulation */
339 unsigned sleeping : 1; /* 1=sleeping & sleep field valid */ 432 unsigned sleeping : 1; /* 1=sleeping & sleep field valid */
340 unsigned post_reset : 1; 433 unsigned post_reset : 1;
@@ -349,7 +442,6 @@ typedef struct ide_drive_s {
349 u8 wcache; /* status of write cache */ 442 u8 wcache; /* status of write cache */
350 u8 acoustic; /* acoustic management */ 443 u8 acoustic; /* acoustic management */
351 u8 media; /* disk, cdrom, tape, floppy, ... */ 444 u8 media; /* disk, cdrom, tape, floppy, ... */
352 u8 ctl; /* "normal" value for Control register */
353 u8 ready_stat; /* min status value for drive ready */ 445 u8 ready_stat; /* min status value for drive ready */
354 u8 mult_count; /* current multiple sector setting */ 446 u8 mult_count; /* current multiple sector setting */
355 u8 mult_req; /* requested multiple sector setting */ 447 u8 mult_req; /* requested multiple sector setting */
@@ -380,7 +472,14 @@ typedef struct ide_drive_s {
380 struct list_head list; 472 struct list_head list;
381 struct device gendev; 473 struct device gendev;
382 struct completion gendev_rel_comp; /* to deal with device release() */ 474 struct completion gendev_rel_comp; /* to deal with device release() */
383} ide_drive_t; 475
476 /* callback for packet commands */
477 void (*pc_callback)(struct ide_drive_s *);
478
479 unsigned long atapi_flags;
480};
481
482typedef struct ide_drive_s ide_drive_t;
384 483
385#define to_ide_device(dev)container_of(dev, ide_drive_t, gendev) 484#define to_ide_device(dev)container_of(dev, ide_drive_t, gendev)
386 485
@@ -388,11 +487,31 @@ typedef struct ide_drive_s {
388 ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx)) 487 ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx))
389#define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1) 488#define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1)
390 489
490struct ide_task_s;
391struct ide_port_info; 491struct ide_port_info;
392 492
493struct ide_tp_ops {
494 void (*exec_command)(struct hwif_s *, u8);
495 u8 (*read_status)(struct hwif_s *);
496 u8 (*read_altstatus)(struct hwif_s *);
497 u8 (*read_sff_dma_status)(struct hwif_s *);
498
499 void (*set_irq)(struct hwif_s *, int);
500
501 void (*tf_load)(ide_drive_t *, struct ide_task_s *);
502 void (*tf_read)(ide_drive_t *, struct ide_task_s *);
503
504 void (*input_data)(ide_drive_t *, struct request *, void *,
505 unsigned int);
506 void (*output_data)(ide_drive_t *, struct request *, void *,
507 unsigned int);
508};
509
510extern const struct ide_tp_ops default_tp_ops;
511
393struct ide_port_ops { 512struct ide_port_ops {
394 /* host specific initialization of devices on a port */ 513 /* host specific initialization of a device */
395 void (*port_init_devs)(struct hwif_s *); 514 void (*init_dev)(ide_drive_t *);
396 /* routine to program host for PIO mode */ 515 /* routine to program host for PIO mode */
397 void (*set_pio_mode)(ide_drive_t *, const u8); 516 void (*set_pio_mode)(ide_drive_t *, const u8);
398 /* routine to program host for DMA mode */ 517 /* routine to program host for DMA mode */
@@ -427,7 +546,7 @@ struct ide_dma_ops {
427 void (*dma_timeout)(struct ide_drive_s *); 546 void (*dma_timeout)(struct ide_drive_s *);
428}; 547};
429 548
430struct ide_task_s; 549struct ide_host;
431 550
432typedef struct hwif_s { 551typedef struct hwif_s {
433 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ 552 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */
@@ -435,6 +554,8 @@ typedef struct hwif_s {
435 struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */ 554 struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */
436 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ 555 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */
437 556
557 struct ide_host *host;
558
438 char name[6]; /* name of interface, eg. "ide0" */ 559 char name[6]; /* name of interface, eg. "ide0" */
439 560
440 struct ide_io_ports io_ports; 561 struct ide_io_ports io_ports;
@@ -466,22 +587,12 @@ typedef struct hwif_s {
466 587
467 void (*rw_disk)(ide_drive_t *, struct request *); 588 void (*rw_disk)(ide_drive_t *, struct request *);
468 589
590 const struct ide_tp_ops *tp_ops;
469 const struct ide_port_ops *port_ops; 591 const struct ide_port_ops *port_ops;
470 const struct ide_dma_ops *dma_ops; 592 const struct ide_dma_ops *dma_ops;
471 593
472 void (*tf_load)(ide_drive_t *, struct ide_task_s *);
473 void (*tf_read)(ide_drive_t *, struct ide_task_s *);
474
475 void (*input_data)(ide_drive_t *, struct request *, void *, unsigned);
476 void (*output_data)(ide_drive_t *, struct request *, void *, unsigned);
477
478 void (*ide_dma_clear_irq)(ide_drive_t *drive); 594 void (*ide_dma_clear_irq)(ide_drive_t *drive);
479 595
480 void (*OUTB)(u8 addr, unsigned long port);
481 void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port);
482
483 u8 (*INB)(unsigned long port);
484
485 /* dma physical region descriptor table (cpu view) */ 596 /* dma physical region descriptor table (cpu view) */
486 unsigned int *dmatable_cpu; 597 unsigned int *dmatable_cpu;
487 /* dma physical region descriptor table (dma view) */ 598 /* dma physical region descriptor table (dma view) */
@@ -504,8 +615,6 @@ typedef struct hwif_s {
504 int irq; /* our irq number */ 615 int irq; /* our irq number */
505 616
506 unsigned long dma_base; /* base addr for dma ports */ 617 unsigned long dma_base; /* base addr for dma ports */
507 unsigned long dma_command; /* dma command register */
508 unsigned long dma_status; /* dma status register */
509 618
510 unsigned long config_data; /* for use by chipset-specific code */ 619 unsigned long config_data; /* for use by chipset-specific code */
511 unsigned long select_data; /* for use by chipset-specific code */ 620 unsigned long select_data; /* for use by chipset-specific code */
@@ -517,7 +626,6 @@ typedef struct hwif_s {
517 unsigned serialized : 1; /* serialized all channel operation */ 626 unsigned serialized : 1; /* serialized all channel operation */
518 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ 627 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */
519 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 628 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
520 unsigned mmio : 1; /* host uses MMIO */
521 629
522 struct device gendev; 630 struct device gendev;
523 struct device *portdev; 631 struct device *portdev;
@@ -533,6 +641,14 @@ typedef struct hwif_s {
533#endif 641#endif
534} ____cacheline_internodealigned_in_smp ide_hwif_t; 642} ____cacheline_internodealigned_in_smp ide_hwif_t;
535 643
644struct ide_host {
645 ide_hwif_t *ports[MAX_HWIFS];
646 unsigned int n_ports;
647 struct device *dev[2];
648 unsigned long host_flags;
649 void *host_priv;
650};
651
536/* 652/*
537 * internal ide interrupt handler type 653 * internal ide interrupt handler type
538 */ 654 */
@@ -552,8 +668,6 @@ typedef struct hwgroup_s {
552 unsigned int sleeping : 1; 668 unsigned int sleeping : 1;
553 /* BOOL: polling active & poll_timeout field valid */ 669 /* BOOL: polling active & poll_timeout field valid */
554 unsigned int polling : 1; 670 unsigned int polling : 1;
555 /* BOOL: in a polling reset situation. Must not trigger another reset yet */
556 unsigned int resetting : 1;
557 671
558 /* current drive */ 672 /* current drive */
559 ide_drive_t *drive; 673 ide_drive_t *drive;
@@ -589,12 +703,11 @@ enum {
589 PC_FLAG_SUPPRESS_ERROR = (1 << 1), 703 PC_FLAG_SUPPRESS_ERROR = (1 << 1),
590 PC_FLAG_WAIT_FOR_DSC = (1 << 2), 704 PC_FLAG_WAIT_FOR_DSC = (1 << 2),
591 PC_FLAG_DMA_OK = (1 << 3), 705 PC_FLAG_DMA_OK = (1 << 3),
592 PC_FLAG_DMA_RECOMMENDED = (1 << 4), 706 PC_FLAG_DMA_IN_PROGRESS = (1 << 4),
593 PC_FLAG_DMA_IN_PROGRESS = (1 << 5), 707 PC_FLAG_DMA_ERROR = (1 << 5),
594 PC_FLAG_DMA_ERROR = (1 << 6), 708 PC_FLAG_WRITING = (1 << 6),
595 PC_FLAG_WRITING = (1 << 7),
596 /* command timed out */ 709 /* command timed out */
597 PC_FLAG_TIMEDOUT = (1 << 8), 710 PC_FLAG_TIMEDOUT = (1 << 7),
598}; 711};
599 712
600struct ide_atapi_pc { 713struct ide_atapi_pc {
@@ -627,8 +740,6 @@ struct ide_atapi_pc {
627 * to change/removal later. 740 * to change/removal later.
628 */ 741 */
629 u8 pc_buf[256]; 742 u8 pc_buf[256];
630 void (*idefloppy_callback) (ide_drive_t *);
631 ide_startstop_t (*idetape_callback) (ide_drive_t *);
632 743
633 /* idetape only */ 744 /* idetape only */
634 struct idetape_bh *bh; 745 struct idetape_bh *bh;
@@ -772,7 +883,6 @@ struct ide_driver_s {
772 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); 883 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t);
773 int (*end_request)(ide_drive_t *, int, int); 884 int (*end_request)(ide_drive_t *, int, int);
774 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); 885 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8);
775 ide_startstop_t (*abort)(ide_drive_t *, struct request *rq);
776 struct device_driver gen_driver; 886 struct device_driver gen_driver;
777 int (*probe)(ide_drive_t *); 887 int (*probe)(ide_drive_t *);
778 void (*remove)(ide_drive_t *); 888 void (*remove)(ide_drive_t *);
@@ -785,34 +895,14 @@ struct ide_driver_s {
785 895
786#define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver) 896#define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver)
787 897
788int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); 898int ide_device_get(ide_drive_t *);
899void ide_device_put(ide_drive_t *);
789 900
790/* 901int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long);
791 * ide_hwifs[] is the master data structure used to keep track
792 * of just about everything in ide.c. Whenever possible, routines
793 * should be using pointers to a drive (ide_drive_t *) or
794 * pointers to a hwif (ide_hwif_t *), rather than indexing this
795 * structure directly (the allocation/layout may change!).
796 *
797 */
798#ifndef _IDE_C
799extern ide_hwif_t ide_hwifs[]; /* master data repository */
800#endif
801extern int ide_noacpi;
802extern int ide_acpigtf;
803extern int ide_acpionboot;
804extern int noautodma;
805 902
806extern int ide_vlb_clk; 903extern int ide_vlb_clk;
807extern int ide_pci_clk; 904extern int ide_pci_clk;
808 905
809ide_hwif_t *ide_find_port_slot(const struct ide_port_info *);
810
811static inline ide_hwif_t *ide_find_port(void)
812{
813 return ide_find_port_slot(NULL);
814}
815
816extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); 906extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs);
817int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, 907int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
818 int uptodate, int nr_sectors); 908 int uptodate, int nr_sectors);
@@ -830,10 +920,6 @@ ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);
830 920
831ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); 921ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);
832 922
833ide_startstop_t __ide_abort(ide_drive_t *, struct request *);
834
835extern ide_startstop_t ide_abort(ide_drive_t *, const char *);
836
837extern void ide_fix_driveid(struct hd_driveid *); 923extern void ide_fix_driveid(struct hd_driveid *);
838 924
839extern void ide_fixstring(u8 *, const int, const int); 925extern void ide_fixstring(u8 *, const int, const int);
@@ -842,25 +928,12 @@ int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
842 928
843extern ide_startstop_t ide_do_reset (ide_drive_t *); 929extern ide_startstop_t ide_do_reset (ide_drive_t *);
844 930
845extern void ide_init_drive_cmd (struct request *rq); 931extern void ide_do_drive_cmd(ide_drive_t *, struct request *);
846
847/*
848 * "action" parameter type for ide_do_drive_cmd() below.
849 */
850typedef enum {
851 ide_wait, /* insert rq at end of list, and wait for it */
852 ide_preempt, /* insert rq in front of current request */
853 ide_head_wait, /* insert rq in front of current request and wait for it */
854 ide_end /* insert rq at end of list, but don't wait for it */
855} ide_action_t;
856
857extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t);
858 932
859extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); 933extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
860 934
861enum { 935enum {
862 IDE_TFLAG_LBA48 = (1 << 0), 936 IDE_TFLAG_LBA48 = (1 << 0),
863 IDE_TFLAG_NO_SELECT_MASK = (1 << 1),
864 IDE_TFLAG_FLAGGED = (1 << 2), 937 IDE_TFLAG_FLAGGED = (1 << 2),
865 IDE_TFLAG_OUT_DATA = (1 << 3), 938 IDE_TFLAG_OUT_DATA = (1 << 3),
866 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4), 939 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4),
@@ -900,6 +973,7 @@ enum {
900 IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE | 973 IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE |
901 IDE_TFLAG_IN_HOB_NSECT | 974 IDE_TFLAG_IN_HOB_NSECT |
902 IDE_TFLAG_IN_HOB_LBA, 975 IDE_TFLAG_IN_HOB_LBA,
976 IDE_TFLAG_IN_FEATURE = (1 << 1),
903 IDE_TFLAG_IN_NSECT = (1 << 25), 977 IDE_TFLAG_IN_NSECT = (1 << 25),
904 IDE_TFLAG_IN_LBAL = (1 << 26), 978 IDE_TFLAG_IN_LBAL = (1 << 26),
905 IDE_TFLAG_IN_LBAM = (1 << 27), 979 IDE_TFLAG_IN_LBAM = (1 << 27),
@@ -964,13 +1038,40 @@ typedef struct ide_task_s {
964 1038
965void ide_tf_dump(const char *, struct ide_taskfile *); 1039void ide_tf_dump(const char *, struct ide_taskfile *);
966 1040
1041void ide_exec_command(ide_hwif_t *, u8);
1042u8 ide_read_status(ide_hwif_t *);
1043u8 ide_read_altstatus(ide_hwif_t *);
1044u8 ide_read_sff_dma_status(ide_hwif_t *);
1045
1046void ide_set_irq(ide_hwif_t *, int);
1047
1048void ide_tf_load(ide_drive_t *, ide_task_t *);
1049void ide_tf_read(ide_drive_t *, ide_task_t *);
1050
1051void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int);
1052void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int);
1053
967extern void SELECT_DRIVE(ide_drive_t *); 1054extern void SELECT_DRIVE(ide_drive_t *);
968extern void SELECT_MASK(ide_drive_t *, int); 1055void SELECT_MASK(ide_drive_t *, int);
1056
1057u8 ide_read_error(ide_drive_t *);
1058void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *);
969 1059
970extern int drive_is_ready(ide_drive_t *); 1060extern int drive_is_ready(ide_drive_t *);
971 1061
972void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); 1062void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8);
973 1063
1064ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
1065 ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry,
1066 void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *),
1067 void (*retry_pc)(ide_drive_t *), void (*dsc_handle)(ide_drive_t *),
1068 void (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned int,
1069 int));
1070ide_startstop_t ide_transfer_pc(ide_drive_t *, struct ide_atapi_pc *,
1071 ide_handler_t *, unsigned int, ide_expiry_t *);
1072ide_startstop_t ide_issue_pc(ide_drive_t *, struct ide_atapi_pc *,
1073 ide_handler_t *, unsigned int, ide_expiry_t *);
1074
974ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); 1075ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
975 1076
976void task_end_request(ide_drive_t *, struct request *, u8); 1077void task_end_request(ide_drive_t *, struct request *, u8);
@@ -982,8 +1083,6 @@ int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long);
982int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long); 1083int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long);
983int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long); 1084int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long);
984 1085
985extern int system_bus_clock(void);
986
987extern int ide_driveid_update(ide_drive_t *); 1086extern int ide_driveid_update(ide_drive_t *);
988extern int ide_config_drive_speed(ide_drive_t *, u8); 1087extern int ide_config_drive_speed(ide_drive_t *, u8);
989extern u8 eighty_ninty_three (ide_drive_t *); 1088extern u8 eighty_ninty_three (ide_drive_t *);
@@ -1007,12 +1106,15 @@ extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *o
1007#define ide_pci_register_driver(d) pci_register_driver(d) 1106#define ide_pci_register_driver(d) pci_register_driver(d)
1008#endif 1107#endif
1009 1108
1010void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *); 1109void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int,
1110 hw_regs_t *, hw_regs_t **);
1011void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); 1111void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *);
1012 1112
1013#ifdef CONFIG_BLK_DEV_IDEDMA_PCI 1113#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
1014int ide_pci_set_master(struct pci_dev *, const char *); 1114int ide_pci_set_master(struct pci_dev *, const char *);
1015unsigned long ide_pci_dma_base(ide_hwif_t *, const struct ide_port_info *); 1115unsigned long ide_pci_dma_base(ide_hwif_t *, const struct ide_port_info *);
1116extern const struct ide_dma_ops sff_dma_ops;
1117int ide_pci_check_simplex(ide_hwif_t *, const struct ide_port_info *);
1016int ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *); 1118int ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *);
1017#else 1119#else
1018static inline int ide_hwif_setup_dma(ide_hwif_t *hwif, 1120static inline int ide_hwif_setup_dma(ide_hwif_t *hwif,
@@ -1022,10 +1124,6 @@ static inline int ide_hwif_setup_dma(ide_hwif_t *hwif,
1022} 1124}
1023#endif 1125#endif
1024 1126
1025extern void default_hwif_iops(ide_hwif_t *);
1026extern void default_hwif_mmiops(ide_hwif_t *);
1027extern void default_hwif_transport(ide_hwif_t *);
1028
1029typedef struct ide_pci_enablebit_s { 1127typedef struct ide_pci_enablebit_s {
1030 u8 reg; /* byte pci reg holding the enable-bit */ 1128 u8 reg; /* byte pci reg holding the enable-bit */
1031 u8 mask; /* mask to isolate the enable-bit */ 1129 u8 mask; /* mask to isolate the enable-bit */
@@ -1058,8 +1156,8 @@ enum {
1058 IDE_HFLAG_NO_SET_MODE = (1 << 9), 1156 IDE_HFLAG_NO_SET_MODE = (1 << 9),
1059 /* trust BIOS for programming chipset/device for DMA */ 1157 /* trust BIOS for programming chipset/device for DMA */
1060 IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10), 1158 IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10),
1061 /* host uses VDMA (tied with IDE_HFLAG_CS5520 for now) */ 1159 /* host is CS5510/CS5520 */
1062 IDE_HFLAG_VDMA = (1 << 11), 1160 IDE_HFLAG_CS5520 = (1 << 11),
1063 /* ATAPI DMA is unsupported */ 1161 /* ATAPI DMA is unsupported */
1064 IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), 1162 IDE_HFLAG_NO_ATAPI_DMA = (1 << 12),
1065 /* set if host is a "non-bootable" controller */ 1163 /* set if host is a "non-bootable" controller */
@@ -1070,8 +1168,6 @@ enum {
1070 IDE_HFLAG_NO_AUTODMA = (1 << 15), 1168 IDE_HFLAG_NO_AUTODMA = (1 << 15),
1071 /* host uses MMIO */ 1169 /* host uses MMIO */
1072 IDE_HFLAG_MMIO = (1 << 16), 1170 IDE_HFLAG_MMIO = (1 << 16),
1073 /* host is CS5510/CS5520 */
1074 IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA,
1075 /* no LBA48 */ 1171 /* no LBA48 */
1076 IDE_HFLAG_NO_LBA48 = (1 << 17), 1172 IDE_HFLAG_NO_LBA48 = (1 << 17),
1077 /* no LBA48 DMA */ 1173 /* no LBA48 DMA */
@@ -1090,7 +1186,6 @@ enum {
1090 IDE_HFLAG_IO_32BIT = (1 << 24), 1186 IDE_HFLAG_IO_32BIT = (1 << 24),
1091 /* unmask IRQs */ 1187 /* unmask IRQs */
1092 IDE_HFLAG_UNMASK_IRQS = (1 << 25), 1188 IDE_HFLAG_UNMASK_IRQS = (1 << 25),
1093 IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26),
1094 /* serialize ports if DMA is possible (for sl82c105) */ 1189 /* serialize ports if DMA is possible (for sl82c105) */
1095 IDE_HFLAG_SERIALIZE_DMA = (1 << 27), 1190 IDE_HFLAG_SERIALIZE_DMA = (1 << 27),
1096 /* force host out of "simplex" mode */ 1191 /* force host out of "simplex" mode */
@@ -1111,12 +1206,13 @@ enum {
1111 1206
1112struct ide_port_info { 1207struct ide_port_info {
1113 char *name; 1208 char *name;
1114 unsigned int (*init_chipset)(struct pci_dev *, const char *); 1209 unsigned int (*init_chipset)(struct pci_dev *);
1115 void (*init_iops)(ide_hwif_t *); 1210 void (*init_iops)(ide_hwif_t *);
1116 void (*init_hwif)(ide_hwif_t *); 1211 void (*init_hwif)(ide_hwif_t *);
1117 int (*init_dma)(ide_hwif_t *, 1212 int (*init_dma)(ide_hwif_t *,
1118 const struct ide_port_info *); 1213 const struct ide_port_info *);
1119 1214
1215 const struct ide_tp_ops *tp_ops;
1120 const struct ide_port_ops *port_ops; 1216 const struct ide_port_ops *port_ops;
1121 const struct ide_dma_ops *dma_ops; 1217 const struct ide_dma_ops *dma_ops;
1122 1218
@@ -1129,8 +1225,10 @@ struct ide_port_info {
1129 u8 udma_mask; 1225 u8 udma_mask;
1130}; 1226};
1131 1227
1132int ide_setup_pci_device(struct pci_dev *, const struct ide_port_info *); 1228int ide_pci_init_one(struct pci_dev *, const struct ide_port_info *, void *);
1133int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, const struct ide_port_info *); 1229int ide_pci_init_two(struct pci_dev *, struct pci_dev *,
1230 const struct ide_port_info *, void *);
1231void ide_pci_remove(struct pci_dev *);
1134 1232
1135void ide_map_sg(ide_drive_t *, struct request *); 1233void ide_map_sg(ide_drive_t *, struct request *);
1136void ide_init_sg_cmd(ide_drive_t *, struct request *); 1234void ide_init_sg_cmd(ide_drive_t *, struct request *);
@@ -1170,7 +1268,6 @@ void ide_destroy_dmatable(ide_drive_t *);
1170extern int ide_build_dmatable(ide_drive_t *, struct request *); 1268extern int ide_build_dmatable(ide_drive_t *, struct request *);
1171int ide_allocate_dma_engine(ide_hwif_t *); 1269int ide_allocate_dma_engine(ide_hwif_t *);
1172void ide_release_dma_engine(ide_hwif_t *); 1270void ide_release_dma_engine(ide_hwif_t *);
1173void ide_setup_dma(ide_hwif_t *, unsigned long);
1174 1271
1175void ide_dma_host_set(ide_drive_t *, int); 1272void ide_dma_host_set(ide_drive_t *, int);
1176extern int ide_dma_setup(ide_drive_t *); 1273extern int ide_dma_setup(ide_drive_t *);
@@ -1224,8 +1321,14 @@ void ide_undecoded_slave(ide_drive_t *);
1224 1321
1225void ide_port_apply_params(ide_hwif_t *); 1322void ide_port_apply_params(ide_hwif_t *);
1226 1323
1227int ide_device_add_all(u8 *idx, const struct ide_port_info *); 1324struct ide_host *ide_host_alloc_all(const struct ide_port_info *, hw_regs_t **);
1228int ide_device_add(u8 idx[4], const struct ide_port_info *); 1325struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **);
1326void ide_host_free(struct ide_host *);
1327int ide_host_register(struct ide_host *, const struct ide_port_info *,
1328 hw_regs_t **);
1329int ide_host_add(const struct ide_port_info *, hw_regs_t **,
1330 struct ide_host **);
1331void ide_host_remove(struct ide_host *);
1229int ide_legacy_device_add(const struct ide_port_info *, unsigned long); 1332int ide_legacy_device_add(const struct ide_port_info *, unsigned long);
1230void ide_port_unregister_devices(ide_hwif_t *); 1333void ide_port_unregister_devices(ide_hwif_t *);
1231void ide_port_scan(ide_hwif_t *); 1334void ide_port_scan(ide_hwif_t *);
@@ -1265,16 +1368,43 @@ static inline int ide_dev_is_sata(struct hd_driveid *id)
1265u64 ide_get_lba_addr(struct ide_taskfile *, int); 1368u64 ide_get_lba_addr(struct ide_taskfile *, int);
1266u8 ide_dump_status(ide_drive_t *, const char *, u8); 1369u8 ide_dump_status(ide_drive_t *, const char *, u8);
1267 1370
1268typedef struct ide_pio_timings_s { 1371struct ide_timing {
1269 int setup_time; /* Address setup (ns) minimum */ 1372 u8 mode;
1270 int active_time; /* Active pulse (ns) minimum */ 1373 u8 setup; /* t1 */
1271 int cycle_time; /* Cycle time (ns) minimum = */ 1374 u16 act8b; /* t2 for 8-bit io */
1272 /* active + recovery (+ setup for some chips) */ 1375 u16 rec8b; /* t2i for 8-bit io */
1273} ide_pio_timings_t; 1376 u16 cyc8b; /* t0 for 8-bit io */
1377 u16 active; /* t2 or tD */
1378 u16 recover; /* t2i or tK */
1379 u16 cycle; /* t0 */
1380 u16 udma; /* t2CYCTYP/2 */
1381};
1382
1383enum {
1384 IDE_TIMING_SETUP = (1 << 0),
1385 IDE_TIMING_ACT8B = (1 << 1),
1386 IDE_TIMING_REC8B = (1 << 2),
1387 IDE_TIMING_CYC8B = (1 << 3),
1388 IDE_TIMING_8BIT = IDE_TIMING_ACT8B | IDE_TIMING_REC8B |
1389 IDE_TIMING_CYC8B,
1390 IDE_TIMING_ACTIVE = (1 << 4),
1391 IDE_TIMING_RECOVER = (1 << 5),
1392 IDE_TIMING_CYCLE = (1 << 6),
1393 IDE_TIMING_UDMA = (1 << 7),
1394 IDE_TIMING_ALL = IDE_TIMING_SETUP | IDE_TIMING_8BIT |
1395 IDE_TIMING_ACTIVE | IDE_TIMING_RECOVER |
1396 IDE_TIMING_CYCLE | IDE_TIMING_UDMA,
1397};
1398
1399struct ide_timing *ide_timing_find_mode(u8);
1400u16 ide_pio_cycle_time(ide_drive_t *, u8);
1401void ide_timing_merge(struct ide_timing *, struct ide_timing *,
1402 struct ide_timing *, unsigned int);
1403int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int);
1404
1405int ide_scan_pio_blacklist(char *);
1274 1406
1275unsigned int ide_pio_cycle_time(ide_drive_t *, u8);
1276u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); 1407u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8);
1277extern const ide_pio_timings_t ide_pio_timings[6];
1278 1408
1279int ide_set_pio_mode(ide_drive_t *, u8); 1409int ide_set_pio_mode(ide_drive_t *, u8);
1280int ide_set_dma_mode(ide_drive_t *, u8); 1410int ide_set_dma_mode(ide_drive_t *, u8);
@@ -1330,32 +1460,4 @@ static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)
1330 1460
1331 return &hwif->drives[(drive->dn ^ 1) & 1]; 1461 return &hwif->drives[(drive->dn ^ 1) & 1];
1332} 1462}
1333
1334static inline void ide_set_irq(ide_drive_t *drive, int on)
1335{
1336 ide_hwif_t *hwif = drive->hwif;
1337
1338 hwif->OUTB(drive->ctl | (on ? 0 : 2), hwif->io_ports.ctl_addr);
1339}
1340
1341static inline u8 ide_read_status(ide_drive_t *drive)
1342{
1343 ide_hwif_t *hwif = drive->hwif;
1344
1345 return hwif->INB(hwif->io_ports.status_addr);
1346}
1347
1348static inline u8 ide_read_altstatus(ide_drive_t *drive)
1349{
1350 ide_hwif_t *hwif = drive->hwif;
1351
1352 return hwif->INB(hwif->io_ports.ctl_addr);
1353}
1354
1355static inline u8 ide_read_error(ide_drive_t *drive)
1356{
1357 ide_hwif_t *hwif = drive->hwif;
1358
1359 return hwif->INB(hwif->io_ports.error_addr);
1360}
1361#endif /* _IDE_H */ 1463#endif /* _IDE_H */
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 9a2d762124d..fa035f96f2a 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -15,6 +15,7 @@
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/bitops.h> 16#include <linux/bitops.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/rcupdate.h>
18 19
19#if BITS_PER_LONG == 32 20#if BITS_PER_LONG == 32
20# define IDR_BITS 5 21# define IDR_BITS 5
@@ -51,6 +52,7 @@ struct idr_layer {
51 unsigned long bitmap; /* A zero bit means "space here" */ 52 unsigned long bitmap; /* A zero bit means "space here" */
52 struct idr_layer *ary[1<<IDR_BITS]; 53 struct idr_layer *ary[1<<IDR_BITS];
53 int count; /* When zero, we can release it */ 54 int count; /* When zero, we can release it */
55 struct rcu_head rcu_head;
54}; 56};
55 57
56struct idr { 58struct idr {
@@ -71,6 +73,28 @@ struct idr {
71} 73}
72#define DEFINE_IDR(name) struct idr name = IDR_INIT(name) 74#define DEFINE_IDR(name) struct idr name = IDR_INIT(name)
73 75
76/* Actions to be taken after a call to _idr_sub_alloc */
77#define IDR_NEED_TO_GROW -2
78#define IDR_NOMORE_SPACE -3
79
80#define _idr_rc_to_errno(rc) ((rc) == -1 ? -EAGAIN : -ENOSPC)
81
82/**
83 * idr synchronization (stolen from radix-tree.h)
84 *
85 * idr_find() is able to be called locklessly, using RCU. The caller must
86 * ensure calls to this function are made within rcu_read_lock() regions.
87 * Other readers (lock-free or otherwise) and modifications may be running
88 * concurrently.
89 *
90 * It is still required that the caller manage the synchronization and
91 * lifetimes of the items. So if RCU lock-free lookups are used, typically
92 * this would mean that the items have their own locks, or are amenable to
93 * lock-free access; and that the items are freed by RCU (or only freed after
94 * having been deleted from the idr tree *and* a synchronize_rcu() grace
95 * period).
96 */
97
74/* 98/*
75 * This is what we export. 99 * This is what we export.
76 */ 100 */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 0b5e03eae6d..a1630ba0b87 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -98,6 +98,9 @@
98 98
99#define IEEE80211_MAX_SSID_LEN 32 99#define IEEE80211_MAX_SSID_LEN 32
100#define IEEE80211_MAX_MESH_ID_LEN 32 100#define IEEE80211_MAX_MESH_ID_LEN 32
101#define IEEE80211_QOS_CTL_LEN 2
102#define IEEE80211_QOS_CTL_TID_MASK 0x000F
103#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007
101 104
102struct ieee80211_hdr { 105struct ieee80211_hdr {
103 __le16 frame_control; 106 __le16 frame_control;
@@ -109,6 +112,355 @@ struct ieee80211_hdr {
109 u8 addr4[6]; 112 u8 addr4[6];
110} __attribute__ ((packed)); 113} __attribute__ ((packed));
111 114
115/**
116 * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set
117 * @fc: frame control bytes in little-endian byteorder
118 */
119static inline int ieee80211_has_tods(__le16 fc)
120{
121 return (fc & cpu_to_le16(IEEE80211_FCTL_TODS)) != 0;
122}
123
124/**
125 * ieee80211_has_fromds - check if IEEE80211_FCTL_FROMDS is set
126 * @fc: frame control bytes in little-endian byteorder
127 */
128static inline int ieee80211_has_fromds(__le16 fc)
129{
130 return (fc & cpu_to_le16(IEEE80211_FCTL_FROMDS)) != 0;
131}
132
133/**
134 * ieee80211_has_a4 - check if IEEE80211_FCTL_TODS and IEEE80211_FCTL_FROMDS are set
135 * @fc: frame control bytes in little-endian byteorder
136 */
137static inline int ieee80211_has_a4(__le16 fc)
138{
139 __le16 tmp = cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS);
140 return (fc & tmp) == tmp;
141}
142
143/**
144 * ieee80211_has_morefrags - check if IEEE80211_FCTL_MOREFRAGS is set
145 * @fc: frame control bytes in little-endian byteorder
146 */
147static inline int ieee80211_has_morefrags(__le16 fc)
148{
149 return (fc & cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) != 0;
150}
151
152/**
153 * ieee80211_has_retry - check if IEEE80211_FCTL_RETRY is set
154 * @fc: frame control bytes in little-endian byteorder
155 */
156static inline int ieee80211_has_retry(__le16 fc)
157{
158 return (fc & cpu_to_le16(IEEE80211_FCTL_RETRY)) != 0;
159}
160
161/**
162 * ieee80211_has_pm - check if IEEE80211_FCTL_PM is set
163 * @fc: frame control bytes in little-endian byteorder
164 */
165static inline int ieee80211_has_pm(__le16 fc)
166{
167 return (fc & cpu_to_le16(IEEE80211_FCTL_PM)) != 0;
168}
169
170/**
171 * ieee80211_has_moredata - check if IEEE80211_FCTL_MOREDATA is set
172 * @fc: frame control bytes in little-endian byteorder
173 */
174static inline int ieee80211_has_moredata(__le16 fc)
175{
176 return (fc & cpu_to_le16(IEEE80211_FCTL_MOREDATA)) != 0;
177}
178
179/**
180 * ieee80211_has_protected - check if IEEE80211_FCTL_PROTECTED is set
181 * @fc: frame control bytes in little-endian byteorder
182 */
183static inline int ieee80211_has_protected(__le16 fc)
184{
185 return (fc & cpu_to_le16(IEEE80211_FCTL_PROTECTED)) != 0;
186}
187
188/**
189 * ieee80211_has_order - check if IEEE80211_FCTL_ORDER is set
190 * @fc: frame control bytes in little-endian byteorder
191 */
192static inline int ieee80211_has_order(__le16 fc)
193{
194 return (fc & cpu_to_le16(IEEE80211_FCTL_ORDER)) != 0;
195}
196
197/**
198 * ieee80211_is_mgmt - check if type is IEEE80211_FTYPE_MGMT
199 * @fc: frame control bytes in little-endian byteorder
200 */
201static inline int ieee80211_is_mgmt(__le16 fc)
202{
203 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
204 cpu_to_le16(IEEE80211_FTYPE_MGMT);
205}
206
207/**
208 * ieee80211_is_ctl - check if type is IEEE80211_FTYPE_CTL
209 * @fc: frame control bytes in little-endian byteorder
210 */
211static inline int ieee80211_is_ctl(__le16 fc)
212{
213 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
214 cpu_to_le16(IEEE80211_FTYPE_CTL);
215}
216
217/**
218 * ieee80211_is_data - check if type is IEEE80211_FTYPE_DATA
219 * @fc: frame control bytes in little-endian byteorder
220 */
221static inline int ieee80211_is_data(__le16 fc)
222{
223 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
224 cpu_to_le16(IEEE80211_FTYPE_DATA);
225}
226
227/**
228 * ieee80211_is_data_qos - check if type is IEEE80211_FTYPE_DATA and IEEE80211_STYPE_QOS_DATA is set
229 * @fc: frame control bytes in little-endian byteorder
230 */
231static inline int ieee80211_is_data_qos(__le16 fc)
232{
233 /*
234 * mask with QOS_DATA rather than IEEE80211_FCTL_STYPE as we just need
235 * to check the one bit
236 */
237 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_STYPE_QOS_DATA)) ==
238 cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA);
239}
240
241/**
242 * ieee80211_is_data_present - check if type is IEEE80211_FTYPE_DATA and has data
243 * @fc: frame control bytes in little-endian byteorder
244 */
245static inline int ieee80211_is_data_present(__le16 fc)
246{
247 /*
248 * mask with 0x40 and test that that bit is clear to only return true
249 * for the data-containing substypes.
250 */
251 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | 0x40)) ==
252 cpu_to_le16(IEEE80211_FTYPE_DATA);
253}
254
255/**
256 * ieee80211_is_assoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_REQ
257 * @fc: frame control bytes in little-endian byteorder
258 */
259static inline int ieee80211_is_assoc_req(__le16 fc)
260{
261 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
262 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_REQ);
263}
264
265/**
266 * ieee80211_is_assoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_RESP
267 * @fc: frame control bytes in little-endian byteorder
268 */
269static inline int ieee80211_is_assoc_resp(__le16 fc)
270{
271 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
272 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_RESP);
273}
274
275/**
276 * ieee80211_is_reassoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_REQ
277 * @fc: frame control bytes in little-endian byteorder
278 */
279static inline int ieee80211_is_reassoc_req(__le16 fc)
280{
281 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
282 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_REQ);
283}
284
285/**
286 * ieee80211_is_reassoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_RESP
287 * @fc: frame control bytes in little-endian byteorder
288 */
289static inline int ieee80211_is_reassoc_resp(__le16 fc)
290{
291 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
292 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_RESP);
293}
294
295/**
296 * ieee80211_is_probe_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_REQ
297 * @fc: frame control bytes in little-endian byteorder
298 */
299static inline int ieee80211_is_probe_req(__le16 fc)
300{
301 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
302 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ);
303}
304
305/**
306 * ieee80211_is_probe_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_RESP
307 * @fc: frame control bytes in little-endian byteorder
308 */
309static inline int ieee80211_is_probe_resp(__le16 fc)
310{
311 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
312 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP);
313}
314
315/**
316 * ieee80211_is_beacon - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_BEACON
317 * @fc: frame control bytes in little-endian byteorder
318 */
319static inline int ieee80211_is_beacon(__le16 fc)
320{
321 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
322 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON);
323}
324
325/**
326 * ieee80211_is_atim - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ATIM
327 * @fc: frame control bytes in little-endian byteorder
328 */
329static inline int ieee80211_is_atim(__le16 fc)
330{
331 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
332 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ATIM);
333}
334
335/**
336 * ieee80211_is_disassoc - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DISASSOC
337 * @fc: frame control bytes in little-endian byteorder
338 */
339static inline int ieee80211_is_disassoc(__le16 fc)
340{
341 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
342 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DISASSOC);
343}
344
345/**
346 * ieee80211_is_auth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_AUTH
347 * @fc: frame control bytes in little-endian byteorder
348 */
349static inline int ieee80211_is_auth(__le16 fc)
350{
351 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
352 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH);
353}
354
355/**
356 * ieee80211_is_deauth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DEAUTH
357 * @fc: frame control bytes in little-endian byteorder
358 */
359static inline int ieee80211_is_deauth(__le16 fc)
360{
361 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
362 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH);
363}
364
365/**
366 * ieee80211_is_action - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ACTION
367 * @fc: frame control bytes in little-endian byteorder
368 */
369static inline int ieee80211_is_action(__le16 fc)
370{
371 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
372 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION);
373}
374
375/**
376 * ieee80211_is_back_req - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK_REQ
377 * @fc: frame control bytes in little-endian byteorder
378 */
379static inline int ieee80211_is_back_req(__le16 fc)
380{
381 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
382 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK_REQ);
383}
384
385/**
386 * ieee80211_is_back - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK
387 * @fc: frame control bytes in little-endian byteorder
388 */
389static inline int ieee80211_is_back(__le16 fc)
390{
391 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
392 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK);
393}
394
395/**
396 * ieee80211_is_pspoll - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_PSPOLL
397 * @fc: frame control bytes in little-endian byteorder
398 */
399static inline int ieee80211_is_pspoll(__le16 fc)
400{
401 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
402 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
403}
404
405/**
406 * ieee80211_is_rts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_RTS
407 * @fc: frame control bytes in little-endian byteorder
408 */
409static inline int ieee80211_is_rts(__le16 fc)
410{
411 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
412 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS);
413}
414
415/**
416 * ieee80211_is_cts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CTS
417 * @fc: frame control bytes in little-endian byteorder
418 */
419static inline int ieee80211_is_cts(__le16 fc)
420{
421 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
422 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);
423}
424
425/**
426 * ieee80211_is_ack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_ACK
427 * @fc: frame control bytes in little-endian byteorder
428 */
429static inline int ieee80211_is_ack(__le16 fc)
430{
431 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
432 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK);
433}
434
435/**
436 * ieee80211_is_cfend - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFEND
437 * @fc: frame control bytes in little-endian byteorder
438 */
439static inline int ieee80211_is_cfend(__le16 fc)
440{
441 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
442 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFEND);
443}
444
445/**
446 * ieee80211_is_cfendack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFENDACK
447 * @fc: frame control bytes in little-endian byteorder
448 */
449static inline int ieee80211_is_cfendack(__le16 fc)
450{
451 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
452 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFENDACK);
453}
454
455/**
456 * ieee80211_is_nullfunc - check if FTYPE=IEEE80211_FTYPE_DATA and STYPE=IEEE80211_STYPE_NULLFUNC
457 * @fc: frame control bytes in little-endian byteorder
458 */
459static inline int ieee80211_is_nullfunc(__le16 fc)
460{
461 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
462 cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC);
463}
112 464
113struct ieee80211s_hdr { 465struct ieee80211s_hdr {
114 u8 flags; 466 u8 flags;
@@ -119,6 +471,40 @@ struct ieee80211s_hdr {
119 u8 eaddr3[6]; 471 u8 eaddr3[6];
120} __attribute__ ((packed)); 472} __attribute__ ((packed));
121 473
474/**
475 * struct ieee80211_quiet_ie
476 *
477 * This structure refers to "Quiet information element"
478 */
479struct ieee80211_quiet_ie {
480 u8 count;
481 u8 period;
482 __le16 duration;
483 __le16 offset;
484} __attribute__ ((packed));
485
486/**
487 * struct ieee80211_msrment_ie
488 *
489 * This structure refers to "Measurement Request/Report information element"
490 */
491struct ieee80211_msrment_ie {
492 u8 token;
493 u8 mode;
494 u8 type;
495 u8 request[0];
496} __attribute__ ((packed));
497
498/**
499 * struct ieee80211_channel_sw_ie
500 *
501 * This structure refers to "Channel Switch Announcement information element"
502 */
503struct ieee80211_channel_sw_ie {
504 u8 mode;
505 u8 new_ch_num;
506 u8 count;
507} __attribute__ ((packed));
122 508
123struct ieee80211_mgmt { 509struct ieee80211_mgmt {
124 __le16 frame_control; 510 __le16 frame_control;
@@ -194,13 +580,18 @@ struct ieee80211_mgmt {
194 u8 action_code; 580 u8 action_code;
195 u8 element_id; 581 u8 element_id;
196 u8 length; 582 u8 length;
197 u8 switch_mode; 583 struct ieee80211_channel_sw_ie sw_elem;
198 u8 new_chan;
199 u8 switch_count;
200 } __attribute__((packed)) chan_switch; 584 } __attribute__((packed)) chan_switch;
201 struct{ 585 struct{
202 u8 action_code; 586 u8 action_code;
203 u8 dialog_token; 587 u8 dialog_token;
588 u8 element_id;
589 u8 length;
590 struct ieee80211_msrment_ie msr_elem;
591 } __attribute__((packed)) measurement;
592 struct{
593 u8 action_code;
594 u8 dialog_token;
204 __le16 capab; 595 __le16 capab;
205 __le16 timeout; 596 __le16 timeout;
206 __le16 start_seq_num; 597 __le16 start_seq_num;
@@ -269,6 +660,10 @@ struct ieee80211_bar {
269 __le16 start_seq_num; 660 __le16 start_seq_num;
270} __attribute__((packed)); 661} __attribute__((packed));
271 662
663/* 802.11 BAR control masks */
664#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
665#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
666
272/** 667/**
273 * struct ieee80211_ht_cap - HT capabilities 668 * struct ieee80211_ht_cap - HT capabilities
274 * 669 *
@@ -306,20 +701,33 @@ struct ieee80211_ht_addt_info {
306#define IEEE80211_HT_CAP_SGI_40 0x0040 701#define IEEE80211_HT_CAP_SGI_40 0x0040
307#define IEEE80211_HT_CAP_DELAY_BA 0x0400 702#define IEEE80211_HT_CAP_DELAY_BA 0x0400
308#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 703#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
704/* 802.11n HT capability AMPDU settings */
309#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 705#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03
310#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C 706#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C
707/* 802.11n HT capability MSC set */
708#define IEEE80211_SUPP_MCS_SET_UEQM 4
709#define IEEE80211_HT_CAP_MAX_STREAMS 4
710#define IEEE80211_SUPP_MCS_SET_LEN 10
711/* maximum streams the spec allows */
712#define IEEE80211_HT_CAP_MCS_TX_DEFINED 0x01
713#define IEEE80211_HT_CAP_MCS_TX_RX_DIFF 0x02
714#define IEEE80211_HT_CAP_MCS_TX_STREAMS 0x0C
715#define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10
311/* 802.11n HT IE masks */ 716/* 802.11n HT IE masks */
312#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03 717#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03
718#define IEEE80211_HT_IE_CHA_SEC_NONE 0x00
719#define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01
720#define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03
313#define IEEE80211_HT_IE_CHA_WIDTH 0x04 721#define IEEE80211_HT_IE_CHA_WIDTH 0x04
314#define IEEE80211_HT_IE_HT_PROTECTION 0x0003 722#define IEEE80211_HT_IE_HT_PROTECTION 0x0003
315#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 723#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
316#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 724#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
317 725
318/* MIMO Power Save Modes */ 726/* MIMO Power Save Modes */
319#define WLAN_HT_CAP_MIMO_PS_STATIC 0 727#define WLAN_HT_CAP_MIMO_PS_STATIC 0
320#define WLAN_HT_CAP_MIMO_PS_DYNAMIC 1 728#define WLAN_HT_CAP_MIMO_PS_DYNAMIC 1
321#define WLAN_HT_CAP_MIMO_PS_INVALID 2 729#define WLAN_HT_CAP_MIMO_PS_INVALID 2
322#define WLAN_HT_CAP_MIMO_PS_DISABLED 3 730#define WLAN_HT_CAP_MIMO_PS_DISABLED 3
323 731
324/* Authentication algorithms */ 732/* Authentication algorithms */
325#define WLAN_AUTH_OPEN 0 733#define WLAN_AUTH_OPEN 0
@@ -337,11 +745,21 @@ struct ieee80211_ht_addt_info {
337#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) 745#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
338#define WLAN_CAPABILITY_PBCC (1<<6) 746#define WLAN_CAPABILITY_PBCC (1<<6)
339#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) 747#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
748
340/* 802.11h */ 749/* 802.11h */
341#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8) 750#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
342#define WLAN_CAPABILITY_QOS (1<<9) 751#define WLAN_CAPABILITY_QOS (1<<9)
343#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) 752#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
344#define WLAN_CAPABILITY_DSSS_OFDM (1<<13) 753#define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
754/* measurement */
755#define IEEE80211_SPCT_MSR_RPRT_MODE_LATE (1<<0)
756#define IEEE80211_SPCT_MSR_RPRT_MODE_INCAPABLE (1<<1)
757#define IEEE80211_SPCT_MSR_RPRT_MODE_REFUSED (1<<2)
758
759#define IEEE80211_SPCT_MSR_RPRT_TYPE_BASIC 0
760#define IEEE80211_SPCT_MSR_RPRT_TYPE_CCA 1
761#define IEEE80211_SPCT_MSR_RPRT_TYPE_RPI 2
762
345 763
346/* 802.11g ERP information element */ 764/* 802.11g ERP information element */
347#define WLAN_ERP_NON_ERP_PRESENT (1<<0) 765#define WLAN_ERP_NON_ERP_PRESENT (1<<0)
@@ -512,6 +930,15 @@ enum ieee80211_category {
512 WLAN_CATEGORY_WMM = 17, 930 WLAN_CATEGORY_WMM = 17,
513}; 931};
514 932
933/* SPECTRUM_MGMT action code */
934enum ieee80211_spectrum_mgmt_actioncode {
935 WLAN_ACTION_SPCT_MSR_REQ = 0,
936 WLAN_ACTION_SPCT_MSR_RPRT = 1,
937 WLAN_ACTION_SPCT_TPC_REQ = 2,
938 WLAN_ACTION_SPCT_TPC_RPRT = 3,
939 WLAN_ACTION_SPCT_CHL_SWITCH = 4,
940};
941
515/* BACK action code */ 942/* BACK action code */
516enum ieee80211_back_actioncode { 943enum ieee80211_back_actioncode {
517 WLAN_ACTION_ADDBA_REQ = 0, 944 WLAN_ACTION_ADDBA_REQ = 0,
@@ -540,63 +967,57 @@ enum ieee80211_back_parties {
540#define WLAN_MAX_KEY_LEN 32 967#define WLAN_MAX_KEY_LEN 32
541 968
542/** 969/**
970 * ieee80211_get_qos_ctl - get pointer to qos control bytes
971 * @hdr: the frame
972 *
973 * The qos ctrl bytes come after the frame_control, duration, seq_num
974 * and 3 or 4 addresses of length ETH_ALEN.
975 * 3 addr: 2 + 2 + 2 + 3*6 = 24
976 * 4 addr: 2 + 2 + 2 + 4*6 = 30
977 */
978static inline u8 *ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr)
979{
980 if (ieee80211_has_a4(hdr->frame_control))
981 return (u8 *)hdr + 30;
982 else
983 return (u8 *)hdr + 24;
984}
985
986/**
543 * ieee80211_get_SA - get pointer to SA 987 * ieee80211_get_SA - get pointer to SA
988 * @hdr: the frame
544 * 989 *
545 * Given an 802.11 frame, this function returns the offset 990 * Given an 802.11 frame, this function returns the offset
546 * to the source address (SA). It does not verify that the 991 * to the source address (SA). It does not verify that the
547 * header is long enough to contain the address, and the 992 * header is long enough to contain the address, and the
548 * header must be long enough to contain the frame control 993 * header must be long enough to contain the frame control
549 * field. 994 * field.
550 *
551 * @hdr: the frame
552 */ 995 */
553static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr) 996static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
554{ 997{
555 u8 *raw = (u8 *) hdr; 998 if (ieee80211_has_a4(hdr->frame_control))
556 u8 tofrom = (*(raw+1)) & 3; /* get the TODS and FROMDS bits */ 999 return hdr->addr4;
557 1000 if (ieee80211_has_fromds(hdr->frame_control))
558 switch (tofrom) { 1001 return hdr->addr3;
559 case 2:
560 return hdr->addr3;
561 case 3:
562 return hdr->addr4;
563 }
564 return hdr->addr2; 1002 return hdr->addr2;
565} 1003}
566 1004
567/** 1005/**
568 * ieee80211_get_DA - get pointer to DA 1006 * ieee80211_get_DA - get pointer to DA
1007 * @hdr: the frame
569 * 1008 *
570 * Given an 802.11 frame, this function returns the offset 1009 * Given an 802.11 frame, this function returns the offset
571 * to the destination address (DA). It does not verify that 1010 * to the destination address (DA). It does not verify that
572 * the header is long enough to contain the address, and the 1011 * the header is long enough to contain the address, and the
573 * header must be long enough to contain the frame control 1012 * header must be long enough to contain the frame control
574 * field. 1013 * field.
575 *
576 * @hdr: the frame
577 */ 1014 */
578static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr) 1015static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
579{ 1016{
580 u8 *raw = (u8 *) hdr; 1017 if (ieee80211_has_tods(hdr->frame_control))
581 u8 to_ds = (*(raw+1)) & 1; /* get the TODS bit */
582
583 if (to_ds)
584 return hdr->addr3; 1018 return hdr->addr3;
585 return hdr->addr1; 1019 else
586} 1020 return hdr->addr1;
587
588/**
589 * ieee80211_get_morefrag - determine whether the MOREFRAGS bit is set
590 *
591 * This function determines whether the "more fragments" bit is set
592 * in the frame.
593 *
594 * @hdr: the frame
595 */
596static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr)
597{
598 return (le16_to_cpu(hdr->frame_control) &
599 IEEE80211_FCTL_MOREFRAGS) != 0;
600} 1021}
601 1022
602#endif /* IEEE80211_H */ 1023#endif /* IEEE80211_H */
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index 950e13d09e0..6badb3e2c4e 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -4,8 +4,6 @@
4 * Authors: 4 * Authors:
5 * Lennert Buytenhek <buytenh@gnu.org> 5 * Lennert Buytenhek <buytenh@gnu.org>
6 * 6 *
7 * $Id: if_bridge.h,v 1.1 2000/02/18 16:47:01 davem Exp $
8 *
9 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License 8 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 9 * as published by the Free Software Foundation; either version
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index ad09609227f..18db0668065 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -43,6 +43,9 @@ struct sockaddr_ll
43#define PACKET_COPY_THRESH 7 43#define PACKET_COPY_THRESH 7
44#define PACKET_AUXDATA 8 44#define PACKET_AUXDATA 8
45#define PACKET_ORIGDEV 9 45#define PACKET_ORIGDEV 9
46#define PACKET_VERSION 10
47#define PACKET_HDRLEN 11
48#define PACKET_RESERVE 12
46 49
47struct tpacket_stats 50struct tpacket_stats
48{ 51{
@@ -57,6 +60,7 @@ struct tpacket_auxdata
57 __u32 tp_snaplen; 60 __u32 tp_snaplen;
58 __u16 tp_mac; 61 __u16 tp_mac;
59 __u16 tp_net; 62 __u16 tp_net;
63 __u16 tp_vlan_tci;
60}; 64};
61 65
62struct tpacket_hdr 66struct tpacket_hdr
@@ -79,6 +83,26 @@ struct tpacket_hdr
79#define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1)) 83#define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1))
80#define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll)) 84#define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll))
81 85
86struct tpacket2_hdr
87{
88 __u32 tp_status;
89 __u32 tp_len;
90 __u32 tp_snaplen;
91 __u16 tp_mac;
92 __u16 tp_net;
93 __u32 tp_sec;
94 __u32 tp_nsec;
95 __u16 tp_vlan_tci;
96};
97
98#define TPACKET2_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll))
99
100enum tpacket_versions
101{
102 TPACKET_V1,
103 TPACKET_V2,
104};
105
82/* 106/*
83 Frame structure: 107 Frame structure:
84 108
diff --git a/include/linux/if_ppp.h b/include/linux/if_ppp.h
index 0f2f70d4e48..c3b1f856270 100644
--- a/include/linux/if_ppp.h
+++ b/include/linux/if_ppp.h
@@ -1,5 +1,3 @@
1/* $Id: if_ppp.h,v 1.21 2000/03/27 06:03:36 paulus Exp $ */
2
3/* 1/*
4 * if_ppp.h - Point-to-Point Protocol definitions. 2 * if_ppp.h - Point-to-Point Protocol definitions.
5 * 3 *
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 8c71fe2fb1f..4c6307ad9fd 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -11,14 +11,13 @@
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 *
15 * $Id: if_tun.h,v 1.2 2001/06/01 18:39:47 davem Exp $
16 */ 14 */
17 15
18#ifndef __IF_TUN_H 16#ifndef __IF_TUN_H
19#define __IF_TUN_H 17#define __IF_TUN_H
20 18
21#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/if_ether.h>
22 21
23/* Read queue size */ 22/* Read queue size */
24#define TUN_READQ_SIZE 500 23#define TUN_READQ_SIZE 500
@@ -33,6 +32,7 @@
33#define TUN_NO_PI 0x0040 32#define TUN_NO_PI 0x0040
34#define TUN_ONE_QUEUE 0x0080 33#define TUN_ONE_QUEUE 0x0080
35#define TUN_PERSIST 0x0100 34#define TUN_PERSIST 0x0100
35#define TUN_VNET_HDR 0x0200
36 36
37/* Ioctl defines */ 37/* Ioctl defines */
38#define TUNSETNOCSUM _IOW('T', 200, int) 38#define TUNSETNOCSUM _IOW('T', 200, int)
@@ -42,17 +42,43 @@
42#define TUNSETOWNER _IOW('T', 204, int) 42#define TUNSETOWNER _IOW('T', 204, int)
43#define TUNSETLINK _IOW('T', 205, int) 43#define TUNSETLINK _IOW('T', 205, int)
44#define TUNSETGROUP _IOW('T', 206, int) 44#define TUNSETGROUP _IOW('T', 206, int)
45#define TUNGETFEATURES _IOR('T', 207, unsigned int)
46#define TUNSETOFFLOAD _IOW('T', 208, unsigned int)
47#define TUNSETTXFILTER _IOW('T', 209, unsigned int)
45 48
46/* TUNSETIFF ifr flags */ 49/* TUNSETIFF ifr flags */
47#define IFF_TUN 0x0001 50#define IFF_TUN 0x0001
48#define IFF_TAP 0x0002 51#define IFF_TAP 0x0002
49#define IFF_NO_PI 0x1000 52#define IFF_NO_PI 0x1000
50#define IFF_ONE_QUEUE 0x2000 53#define IFF_ONE_QUEUE 0x2000
54#define IFF_VNET_HDR 0x4000
55
56/* Features for GSO (TUNSETOFFLOAD). */
57#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */
58#define TUN_F_TSO4 0x02 /* I can handle TSO for IPv4 packets */
59#define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */
60#define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */
51 61
62/* Protocol info prepended to the packets (when IFF_NO_PI is not set) */
63#define TUN_PKT_STRIP 0x0001
52struct tun_pi { 64struct tun_pi {
53 unsigned short flags; 65 __u16 flags;
54 __be16 proto; 66 __be16 proto;
55}; 67};
56#define TUN_PKT_STRIP 0x0001 68
69/*
70 * Filter spec (used for SETXXFILTER ioctls)
71 * This stuff is applicable only to the TAP (Ethernet) devices.
72 * If the count is zero the filter is disabled and the driver accepts
73 * all packets (promisc mode).
74 * If the filter is enabled in order to accept broadcast packets
75 * broadcast addr must be explicitly included in the addr list.
76 */
77#define TUN_FLT_ALLMULTI 0x0001 /* Accept all multicast packets */
78struct tun_filter {
79 __u16 flags; /* TUN_FLT_ flags see above */
80 __u16 count; /* Number of addresses */
81 __u8 addr[0][ETH_ALEN];
82};
57 83
58#endif /* __IF_TUN_H */ 84#endif /* __IF_TUN_H */
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index f1fbe9c930d..d4efe401470 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -41,7 +41,7 @@ struct ip_tunnel_prl {
41 __u16 __reserved; 41 __u16 __reserved;
42 __u32 datalen; 42 __u32 datalen;
43 __u32 __reserved2; 43 __u32 __reserved2;
44 void __user *data; 44 /* data follows */
45}; 45};
46 46
47/* PRL flags */ 47/* PRL flags */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 15ace02b7b2..9e7b49b8062 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -14,10 +14,6 @@
14#define _LINUX_IF_VLAN_H_ 14#define _LINUX_IF_VLAN_H_
15 15
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17
18/* externally defined structs */
19struct hlist_node;
20
21#include <linux/netdevice.h> 17#include <linux/netdevice.h>
22#include <linux/etherdevice.h> 18#include <linux/etherdevice.h>
23 19
@@ -91,7 +87,7 @@ struct vlan_group {
91}; 87};
92 88
93static inline struct net_device *vlan_group_get_device(struct vlan_group *vg, 89static inline struct net_device *vlan_group_get_device(struct vlan_group *vg,
94 unsigned int vlan_id) 90 u16 vlan_id)
95{ 91{
96 struct net_device **array; 92 struct net_device **array;
97 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; 93 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN];
@@ -99,7 +95,7 @@ static inline struct net_device *vlan_group_get_device(struct vlan_group *vg,
99} 95}
100 96
101static inline void vlan_group_set_device(struct vlan_group *vg, 97static inline void vlan_group_set_device(struct vlan_group *vg,
102 unsigned int vlan_id, 98 u16 vlan_id,
103 struct net_device *dev) 99 struct net_device *dev)
104{ 100{
105 struct net_device **array; 101 struct net_device **array;
@@ -109,164 +105,81 @@ static inline void vlan_group_set_device(struct vlan_group *vg,
109 array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev; 105 array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev;
110} 106}
111 107
112struct vlan_priority_tci_mapping { 108#define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci)
113 u32 priority; 109#define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci)
114 unsigned short vlan_qos; /* This should be shifted when first set, so we only do it
115 * at provisioning time.
116 * ((skb->priority << 13) & 0xE000)
117 */
118 struct vlan_priority_tci_mapping *next;
119};
120 110
121/* Holds information that makes sense if this device is a VLAN device. */ 111#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
122struct vlan_dev_info { 112extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
123 /** This will be the mapping that correlates skb->priority to 113extern u16 vlan_dev_vlan_id(const struct net_device *dev);
124 * 3 bits of VLAN QOS tags...
125 */
126 unsigned int nr_ingress_mappings;
127 u32 ingress_priority_map[8];
128
129 unsigned int nr_egress_mappings;
130 struct vlan_priority_tci_mapping *egress_priority_map[16]; /* hash table */
131
132 unsigned short vlan_id; /* The VLAN Identifier for this interface. */
133 unsigned short flags; /* (1 << 0) re_order_header This option will cause the
134 * VLAN code to move around the ethernet header on
135 * ingress to make the skb look **exactly** like it
136 * came in from an ethernet port. This destroys some of
137 * the VLAN information in the skb, but it fixes programs
138 * like DHCP that use packet-filtering and don't understand
139 * 802.1Q
140 */
141 struct net_device *real_dev; /* the underlying device/interface */
142 unsigned char real_dev_addr[ETH_ALEN];
143 struct proc_dir_entry *dent; /* Holds the proc data */
144 unsigned long cnt_inc_headroom_on_tx; /* How many times did we have to grow the skb on TX. */
145 unsigned long cnt_encap_on_xmit; /* How many times did we have to encapsulate the skb on TX. */
146};
147 114
148static inline struct vlan_dev_info *vlan_dev_info(const struct net_device *dev) 115extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
116 u16 vlan_tci, int polling);
117#else
118static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev)
149{ 119{
150 return netdev_priv(dev); 120 BUG();
121 return NULL;
151} 122}
152 123
153/* inline functions */ 124static inline u16 vlan_dev_vlan_id(const struct net_device *dev)
154static inline __u32 vlan_get_ingress_priority(struct net_device *dev,
155 unsigned short vlan_tag)
156{ 125{
157 struct vlan_dev_info *vip = vlan_dev_info(dev); 126 BUG();
158 127 return 0;
159 return vip->ingress_priority_map[(vlan_tag >> 13) & 0x7];
160} 128}
161 129
162/* VLAN tx hw acceleration helpers. */ 130static inline int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
163struct vlan_skb_tx_cookie { 131 u16 vlan_tci, int polling)
164 u32 magic;
165 u32 vlan_tag;
166};
167
168#define VLAN_TX_COOKIE_MAGIC 0x564c414e /* "VLAN" in ascii. */
169#define VLAN_TX_SKB_CB(__skb) ((struct vlan_skb_tx_cookie *)&((__skb)->cb[0]))
170#define vlan_tx_tag_present(__skb) \
171 (VLAN_TX_SKB_CB(__skb)->magic == VLAN_TX_COOKIE_MAGIC)
172#define vlan_tx_tag_get(__skb) (VLAN_TX_SKB_CB(__skb)->vlan_tag)
173
174/* VLAN rx hw acceleration helper. This acts like netif_{rx,receive_skb}(). */
175static inline int __vlan_hwaccel_rx(struct sk_buff *skb,
176 struct vlan_group *grp,
177 unsigned short vlan_tag, int polling)
178{ 132{
179 struct net_device_stats *stats; 133 BUG();
180 134 return NET_XMIT_SUCCESS;
181 if (skb_bond_should_drop(skb)) {
182 dev_kfree_skb_any(skb);
183 return NET_RX_DROP;
184 }
185
186 skb->dev = vlan_group_get_device(grp, vlan_tag & VLAN_VID_MASK);
187 if (skb->dev == NULL) {
188 dev_kfree_skb_any(skb);
189
190 /* Not NET_RX_DROP, this is not being dropped
191 * due to congestion.
192 */
193 return 0;
194 }
195
196 skb->dev->last_rx = jiffies;
197
198 stats = &skb->dev->stats;
199 stats->rx_packets++;
200 stats->rx_bytes += skb->len;
201
202 skb->priority = vlan_get_ingress_priority(skb->dev, vlan_tag);
203 switch (skb->pkt_type) {
204 case PACKET_BROADCAST:
205 break;
206
207 case PACKET_MULTICAST:
208 stats->multicast++;
209 break;
210
211 case PACKET_OTHERHOST:
212 /* Our lower layer thinks this is not local, let's make sure.
213 * This allows the VLAN to have a different MAC than the underlying
214 * device, and still route correctly.
215 */
216 if (!compare_ether_addr(eth_hdr(skb)->h_dest,
217 skb->dev->dev_addr))
218 skb->pkt_type = PACKET_HOST;
219 break;
220 };
221
222 return (polling ? netif_receive_skb(skb) : netif_rx(skb));
223} 135}
136#endif
224 137
138/**
139 * vlan_hwaccel_rx - netif_rx wrapper for VLAN RX acceleration
140 * @skb: buffer
141 * @grp: vlan group
142 * @vlan_tci: VLAN TCI as received from the card
143 */
225static inline int vlan_hwaccel_rx(struct sk_buff *skb, 144static inline int vlan_hwaccel_rx(struct sk_buff *skb,
226 struct vlan_group *grp, 145 struct vlan_group *grp,
227 unsigned short vlan_tag) 146 u16 vlan_tci)
228{ 147{
229 return __vlan_hwaccel_rx(skb, grp, vlan_tag, 0); 148 return __vlan_hwaccel_rx(skb, grp, vlan_tci, 0);
230} 149}
231 150
151/**
152 * vlan_hwaccel_receive_skb - netif_receive_skb wrapper for VLAN RX acceleration
153 * @skb: buffer
154 * @grp: vlan group
155 * @vlan_tci: VLAN TCI as received from the card
156 */
232static inline int vlan_hwaccel_receive_skb(struct sk_buff *skb, 157static inline int vlan_hwaccel_receive_skb(struct sk_buff *skb,
233 struct vlan_group *grp, 158 struct vlan_group *grp,
234 unsigned short vlan_tag) 159 u16 vlan_tci)
235{ 160{
236 return __vlan_hwaccel_rx(skb, grp, vlan_tag, 1); 161 return __vlan_hwaccel_rx(skb, grp, vlan_tci, 1);
237} 162}
238 163
239/** 164/**
240 * __vlan_put_tag - regular VLAN tag inserting 165 * __vlan_put_tag - regular VLAN tag inserting
241 * @skb: skbuff to tag 166 * @skb: skbuff to tag
242 * @tag: VLAN tag to insert 167 * @vlan_tci: VLAN TCI to insert
243 * 168 *
244 * Inserts the VLAN tag into @skb as part of the payload 169 * Inserts the VLAN tag into @skb as part of the payload
245 * Returns a VLAN tagged skb. If a new skb is created, @skb is freed. 170 * Returns a VLAN tagged skb. If a new skb is created, @skb is freed.
246 * 171 *
247 * Following the skb_unshare() example, in case of error, the calling function 172 * Following the skb_unshare() example, in case of error, the calling function
248 * doesn't have to worry about freeing the original skb. 173 * doesn't have to worry about freeing the original skb.
249 */ 174 */
250static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short tag) 175static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
251{ 176{
252 struct vlan_ethhdr *veth; 177 struct vlan_ethhdr *veth;
253 178
254 if (skb_headroom(skb) < VLAN_HLEN) { 179 if (skb_cow_head(skb, VLAN_HLEN) < 0) {
255 struct sk_buff *sk_tmp = skb; 180 kfree_skb(skb);
256 skb = skb_realloc_headroom(sk_tmp, VLAN_HLEN); 181 return NULL;
257 kfree_skb(sk_tmp);
258 if (!skb) {
259 printk(KERN_ERR "vlan: failed to realloc headroom\n");
260 return NULL;
261 }
262 } else {
263 skb = skb_unshare(skb, GFP_ATOMIC);
264 if (!skb) {
265 printk(KERN_ERR "vlan: failed to unshare skbuff\n");
266 return NULL;
267 }
268 } 182 }
269
270 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); 183 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
271 184
272 /* Move the mac addresses to the beginning of the new header. */ 185 /* Move the mac addresses to the beginning of the new header. */
@@ -275,12 +188,10 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short
275 /* first, the ethernet type */ 188 /* first, the ethernet type */
276 veth->h_vlan_proto = htons(ETH_P_8021Q); 189 veth->h_vlan_proto = htons(ETH_P_8021Q);
277 190
278 /* now, the tag */ 191 /* now, the TCI */
279 veth->h_vlan_TCI = htons(tag); 192 veth->h_vlan_TCI = htons(vlan_tci);
280 193
281 skb->protocol = htons(ETH_P_8021Q); 194 skb->protocol = htons(ETH_P_8021Q);
282 skb->mac_header -= VLAN_HLEN;
283 skb->network_header -= VLAN_HLEN;
284 195
285 return skb; 196 return skb;
286} 197}
@@ -288,18 +199,14 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short
288/** 199/**
289 * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting 200 * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting
290 * @skb: skbuff to tag 201 * @skb: skbuff to tag
291 * @tag: VLAN tag to insert 202 * @vlan_tci: VLAN TCI to insert
292 * 203 *
293 * Puts the VLAN tag in @skb->cb[] and lets the device do the rest 204 * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest
294 */ 205 */
295static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, unsigned short tag) 206static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb,
207 u16 vlan_tci)
296{ 208{
297 struct vlan_skb_tx_cookie *cookie; 209 skb->vlan_tci = vlan_tci;
298
299 cookie = VLAN_TX_SKB_CB(skb);
300 cookie->magic = VLAN_TX_COOKIE_MAGIC;
301 cookie->vlan_tag = tag;
302
303 return skb; 210 return skb;
304} 211}
305 212
@@ -308,28 +215,28 @@ static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, unsign
308/** 215/**
309 * vlan_put_tag - inserts VLAN tag according to device features 216 * vlan_put_tag - inserts VLAN tag according to device features
310 * @skb: skbuff to tag 217 * @skb: skbuff to tag
311 * @tag: VLAN tag to insert 218 * @vlan_tci: VLAN TCI to insert
312 * 219 *
313 * Assumes skb->dev is the target that will xmit this frame. 220 * Assumes skb->dev is the target that will xmit this frame.
314 * Returns a VLAN tagged skb. 221 * Returns a VLAN tagged skb.
315 */ 222 */
316static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, unsigned short tag) 223static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
317{ 224{
318 if (skb->dev->features & NETIF_F_HW_VLAN_TX) { 225 if (skb->dev->features & NETIF_F_HW_VLAN_TX) {
319 return __vlan_hwaccel_put_tag(skb, tag); 226 return __vlan_hwaccel_put_tag(skb, vlan_tci);
320 } else { 227 } else {
321 return __vlan_put_tag(skb, tag); 228 return __vlan_put_tag(skb, vlan_tci);
322 } 229 }
323} 230}
324 231
325/** 232/**
326 * __vlan_get_tag - get the VLAN ID that is part of the payload 233 * __vlan_get_tag - get the VLAN ID that is part of the payload
327 * @skb: skbuff to query 234 * @skb: skbuff to query
328 * @tag: buffer to store vlaue 235 * @vlan_tci: buffer to store vlaue
329 * 236 *
330 * Returns error if the skb is not of VLAN type 237 * Returns error if the skb is not of VLAN type
331 */ 238 */
332static inline int __vlan_get_tag(const struct sk_buff *skb, unsigned short *tag) 239static inline int __vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
333{ 240{
334 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data; 241 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data;
335 242
@@ -337,29 +244,25 @@ static inline int __vlan_get_tag(const struct sk_buff *skb, unsigned short *tag)
337 return -EINVAL; 244 return -EINVAL;
338 } 245 }
339 246
340 *tag = ntohs(veth->h_vlan_TCI); 247 *vlan_tci = ntohs(veth->h_vlan_TCI);
341
342 return 0; 248 return 0;
343} 249}
344 250
345/** 251/**
346 * __vlan_hwaccel_get_tag - get the VLAN ID that is in @skb->cb[] 252 * __vlan_hwaccel_get_tag - get the VLAN ID that is in @skb->cb[]
347 * @skb: skbuff to query 253 * @skb: skbuff to query
348 * @tag: buffer to store vlaue 254 * @vlan_tci: buffer to store vlaue
349 * 255 *
350 * Returns error if @skb->cb[] is not set correctly 256 * Returns error if @skb->vlan_tci is not set correctly
351 */ 257 */
352static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb, 258static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb,
353 unsigned short *tag) 259 u16 *vlan_tci)
354{ 260{
355 struct vlan_skb_tx_cookie *cookie; 261 if (vlan_tx_tag_present(skb)) {
356 262 *vlan_tci = skb->vlan_tci;
357 cookie = VLAN_TX_SKB_CB(skb);
358 if (cookie->magic == VLAN_TX_COOKIE_MAGIC) {
359 *tag = cookie->vlan_tag;
360 return 0; 263 return 0;
361 } else { 264 } else {
362 *tag = 0; 265 *vlan_tci = 0;
363 return -EINVAL; 266 return -EINVAL;
364 } 267 }
365} 268}
@@ -369,16 +272,16 @@ static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb,
369/** 272/**
370 * vlan_get_tag - get the VLAN ID from the skb 273 * vlan_get_tag - get the VLAN ID from the skb
371 * @skb: skbuff to query 274 * @skb: skbuff to query
372 * @tag: buffer to store vlaue 275 * @vlan_tci: buffer to store vlaue
373 * 276 *
374 * Returns error if the skb is not VLAN tagged 277 * Returns error if the skb is not VLAN tagged
375 */ 278 */
376static inline int vlan_get_tag(const struct sk_buff *skb, unsigned short *tag) 279static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
377{ 280{
378 if (skb->dev->features & NETIF_F_HW_VLAN_TX) { 281 if (skb->dev->features & NETIF_F_HW_VLAN_TX) {
379 return __vlan_hwaccel_get_tag(skb, tag); 282 return __vlan_hwaccel_get_tag(skb, vlan_tci);
380 } else { 283 } else {
381 return __vlan_get_tag(skb, tag); 284 return __vlan_get_tag(skb, vlan_tci);
382 } 285 }
383} 286}
384 287
@@ -402,6 +305,7 @@ enum vlan_ioctl_cmds {
402 305
403enum vlan_flags { 306enum vlan_flags {
404 VLAN_FLAG_REORDER_HDR = 0x1, 307 VLAN_FLAG_REORDER_HDR = 0x1,
308 VLAN_FLAG_GVRP = 0x2,
405}; 309};
406 310
407enum vlan_name_types { 311enum vlan_name_types {
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index f5a1a0db2e8..7bb3c095c15 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -228,7 +228,6 @@ extern int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf,
228extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, 228extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf,
229 struct group_filter __user *optval, int __user *optlen); 229 struct group_filter __user *optval, int __user *optlen);
230extern int ip_mc_sf_allow(struct sock *sk, __be32 local, __be32 rmt, int dif); 230extern int ip_mc_sf_allow(struct sock *sk, __be32 local, __be32 rmt, int dif);
231extern void ip_mr_init(void);
232extern void ip_mc_init_dev(struct in_device *); 231extern void ip_mc_init_dev(struct in_device *);
233extern void ip_mc_destroy_dev(struct in_device *); 232extern void ip_mc_destroy_dev(struct in_device *);
234extern void ip_mc_up(struct in_device *); 233extern void ip_mc_up(struct in_device *);
diff --git a/include/linux/ihex.h b/include/linux/ihex.h
new file mode 100644
index 00000000000..2baace2788a
--- /dev/null
+++ b/include/linux/ihex.h
@@ -0,0 +1,74 @@
1/*
2 * Compact binary representation of ihex records. Some devices need their
3 * firmware loaded in strange orders rather than a single big blob, but
4 * actually parsing ihex-as-text within the kernel seems silly. Thus,...
5 */
6
7#ifndef __LINUX_IHEX_H__
8#define __LINUX_IHEX_H__
9
10#include <linux/types.h>
11#include <linux/firmware.h>
12#include <linux/device.h>
13
14/* Intel HEX files actually limit the length to 256 bytes, but we have
15 drivers which would benefit from using separate records which are
16 longer than that, so we extend to 16 bits of length */
17struct ihex_binrec {
18 __be32 addr;
19 __be16 len;
20 uint8_t data[0];
21} __attribute__((aligned(4)));
22
23/* Find the next record, taking into account the 4-byte alignment */
24static inline const struct ihex_binrec *
25ihex_next_binrec(const struct ihex_binrec *rec)
26{
27 int next = ((be16_to_cpu(rec->len) + 5) & ~3) - 2;
28 rec = (void *)&rec->data[next];
29
30 return be16_to_cpu(rec->len) ? rec : NULL;
31}
32
33/* Check that ihex_next_binrec() won't take us off the end of the image... */
34static inline int ihex_validate_fw(const struct firmware *fw)
35{
36 const struct ihex_binrec *rec;
37 size_t ofs = 0;
38
39 while (ofs <= fw->size - sizeof(*rec)) {
40 rec = (void *)&fw->data[ofs];
41
42 /* Zero length marks end of records */
43 if (!be16_to_cpu(rec->len))
44 return 0;
45
46 /* Point to next record... */
47 ofs += (sizeof(*rec) + be16_to_cpu(rec->len) + 3) & ~3;
48 }
49 return -EINVAL;
50}
51
52/* Request firmware and validate it so that we can trust we won't
53 * run off the end while reading records... */
54static inline int request_ihex_firmware(const struct firmware **fw,
55 const char *fw_name,
56 struct device *dev)
57{
58 const struct firmware *lfw;
59 int ret;
60
61 ret = request_firmware(&lfw, fw_name, dev);
62 if (ret)
63 return ret;
64 ret = ihex_validate_fw(lfw);
65 if (ret) {
66 dev_err(dev, "Firmware \"%s\" not valid IHEX records\n",
67 fw_name);
68 release_firmware(lfw);
69 return ret;
70 }
71 *fw = lfw;
72 return 0;
73}
74#endif /* __LINUX_IHEX_H__ */
diff --git a/include/linux/in_route.h b/include/linux/in_route.h
index 61f25c30a2a..b261b8c915f 100644
--- a/include/linux/in_route.h
+++ b/include/linux/in_route.h
@@ -10,19 +10,19 @@
10#define RTCF_NOPMTUDISC RTM_F_NOPMTUDISC 10#define RTCF_NOPMTUDISC RTM_F_NOPMTUDISC
11 11
12#define RTCF_NOTIFY 0x00010000 12#define RTCF_NOTIFY 0x00010000
13#define RTCF_DIRECTDST 0x00020000 13#define RTCF_DIRECTDST 0x00020000 /* unused */
14#define RTCF_REDIRECTED 0x00040000 14#define RTCF_REDIRECTED 0x00040000
15#define RTCF_TPROXY 0x00080000 15#define RTCF_TPROXY 0x00080000 /* unused */
16 16
17#define RTCF_FAST 0x00200000 17#define RTCF_FAST 0x00200000 /* unused */
18#define RTCF_MASQ 0x00400000 18#define RTCF_MASQ 0x00400000 /* unused */
19#define RTCF_SNAT 0x00800000 19#define RTCF_SNAT 0x00800000 /* unused */
20#define RTCF_DOREDIRECT 0x01000000 20#define RTCF_DOREDIRECT 0x01000000
21#define RTCF_DIRECTSRC 0x04000000 21#define RTCF_DIRECTSRC 0x04000000
22#define RTCF_DNAT 0x08000000 22#define RTCF_DNAT 0x08000000
23#define RTCF_BROADCAST 0x10000000 23#define RTCF_BROADCAST 0x10000000
24#define RTCF_MULTICAST 0x20000000 24#define RTCF_MULTICAST 0x20000000
25#define RTCF_REJECT 0x40000000 25#define RTCF_REJECT 0x40000000 /* unused */
26#define RTCF_LOCAL 0x80000000 26#define RTCF_LOCAL 0x80000000
27 27
28#define RTCF_NAT (RTCF_DNAT|RTCF_SNAT) 28#define RTCF_NAT (RTCF_DNAT|RTCF_SNAT)
diff --git a/include/linux/inet.h b/include/linux/inet.h
index 1354080cf8c..4cca05c9678 100644
--- a/include/linux/inet.h
+++ b/include/linux/inet.h
@@ -44,6 +44,13 @@
44 44
45#include <linux/types.h> 45#include <linux/types.h>
46 46
47/*
48 * These mimic similar macros defined in user-space for inet_ntop(3).
49 * See /usr/include/netinet/in.h .
50 */
51#define INET_ADDRSTRLEN (16)
52#define INET6_ADDRSTRLEN (48)
53
47extern __be32 in_aton(const char *str); 54extern __be32 in_aton(const char *str);
48extern int in4_pton(const char *src, int srclen, u8 *dst, int delim, const char **end); 55extern int in4_pton(const char *src, int srclen, u8 *dst, int delim, const char **end);
49extern int in6_pton(const char *src, int srclen, u8 *dst, int delim, const char **end); 56extern int in6_pton(const char *src, int srclen, u8 *dst, int delim, const char **end);
diff --git a/include/linux/inet_lro.h b/include/linux/inet_lro.h
index 80335b7d77c..c4335faebb6 100644
--- a/include/linux/inet_lro.h
+++ b/include/linux/inet_lro.h
@@ -84,7 +84,11 @@ struct net_lro_mgr {
84 from received packets and eth protocol 84 from received packets and eth protocol
85 is still ETH_P_8021Q */ 85 is still ETH_P_8021Q */
86 86
87 u32 ip_summed; /* Set in non generated SKBs in page mode */ 87 /*
88 * Set for generated SKBs that are not added to
89 * the frag list in fragmented mode
90 */
91 u32 ip_summed;
88 u32 ip_summed_aggr; /* Set in aggregated SKBs: CHECKSUM_UNNECESSARY 92 u32 ip_summed_aggr; /* Set in aggregated SKBs: CHECKSUM_UNNECESSARY
89 * or CHECKSUM_NONE */ 93 * or CHECKSUM_NONE */
90 94
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 7009b0cdd06..c6f51ad52d5 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -117,7 +117,6 @@ struct in_ifaddr
117 __be32 ifa_address; 117 __be32 ifa_address;
118 __be32 ifa_mask; 118 __be32 ifa_mask;
119 __be32 ifa_broadcast; 119 __be32 ifa_broadcast;
120 __be32 ifa_anycast;
121 unsigned char ifa_scope; 120 unsigned char ifa_scope;
122 unsigned char ifa_flags; 121 unsigned char ifa_flags;
123 unsigned char ifa_prefixlen; 122 unsigned char ifa_prefixlen;
diff --git a/include/linux/init.h b/include/linux/init.h
index 21d658cdfa2..11b84e10605 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -170,6 +170,13 @@ extern void (*late_time_init)(void);
170 __attribute__((__section__(".initcall" level ".init"))) = fn 170 __attribute__((__section__(".initcall" level ".init"))) = fn
171 171
172/* 172/*
173 * Early initcalls run before initializing SMP.
174 *
175 * Only for built-in code, not modules.
176 */
177#define early_initcall(fn) __define_initcall("early",fn,early)
178
179/*
173 * A "pure" initcall has no dependencies on anything else, and purely 180 * A "pure" initcall has no dependencies on anything else, and purely
174 * initializes variables that couldn't be statically initialized. 181 * initializes variables that couldn't be statically initialized.
175 * 182 *
@@ -275,13 +282,7 @@ void __init parse_early_param(void);
275 282
276#define security_initcall(fn) module_init(fn) 283#define security_initcall(fn) module_init(fn)
277 284
278/* These macros create a dummy inline: gcc 2.9x does not count alias 285/* Each module must use one module_init(). */
279 as usage, hence the `unused function' warning when __init functions
280 are declared static. We use the dummy __*_module_inline functions
281 both to kill the warning and check the type of the init/cleanup
282 function. */
283
284/* Each module must use one module_init(), or one no_module_init */
285#define module_init(initfn) \ 286#define module_init(initfn) \
286 static inline initcall_t __inittest(void) \ 287 static inline initcall_t __inittest(void) \
287 { return initfn; } \ 288 { return initfn; } \
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index b24c2875aa0..021d8e720c7 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -1,7 +1,6 @@
1#ifndef _LINUX__INIT_TASK_H 1#ifndef _LINUX__INIT_TASK_H
2#define _LINUX__INIT_TASK_H 2#define _LINUX__INIT_TASK_H
3 3
4#include <linux/fdtable.h>
5#include <linux/rcupdate.h> 4#include <linux/rcupdate.h>
6#include <linux/irqflags.h> 5#include <linux/irqflags.h>
7#include <linux/utsname.h> 6#include <linux/utsname.h>
@@ -12,27 +11,7 @@
12#include <linux/securebits.h> 11#include <linux/securebits.h>
13#include <net/net_namespace.h> 12#include <net/net_namespace.h>
14 13
15#define INIT_FDTABLE \ 14extern struct files_struct init_files;
16{ \
17 .max_fds = NR_OPEN_DEFAULT, \
18 .fd = &init_files.fd_array[0], \
19 .close_on_exec = (fd_set *)&init_files.close_on_exec_init, \
20 .open_fds = (fd_set *)&init_files.open_fds_init, \
21 .rcu = RCU_HEAD_INIT, \
22 .next = NULL, \
23}
24
25#define INIT_FILES \
26{ \
27 .count = ATOMIC_INIT(1), \
28 .fdt = &init_files.fdtab, \
29 .fdtab = INIT_FDTABLE, \
30 .file_lock = __SPIN_LOCK_UNLOCKED(init_task.file_lock), \
31 .next_fd = 0, \
32 .close_on_exec_init = { { 0, } }, \
33 .open_fds_init = { { 0, } }, \
34 .fd_array = { NULL, } \
35}
36 15
37#define INIT_KIOCTX(name, which_mm) \ 16#define INIT_KIOCTX(name, which_mm) \
38{ \ 17{ \
@@ -143,7 +122,7 @@ extern struct group_info init_groups;
143 .state = 0, \ 122 .state = 0, \
144 .stack = &init_thread_info, \ 123 .stack = &init_thread_info, \
145 .usage = ATOMIC_INIT(2), \ 124 .usage = ATOMIC_INIT(2), \
146 .flags = 0, \ 125 .flags = PF_KTHREAD, \
147 .lock_depth = -1, \ 126 .lock_depth = -1, \
148 .prio = MAX_PRIO-20, \ 127 .prio = MAX_PRIO-20, \
149 .static_prio = MAX_PRIO-20, \ 128 .static_prio = MAX_PRIO-20, \
@@ -161,8 +140,8 @@ extern struct group_info init_groups;
161 .nr_cpus_allowed = NR_CPUS, \ 140 .nr_cpus_allowed = NR_CPUS, \
162 }, \ 141 }, \
163 .tasks = LIST_HEAD_INIT(tsk.tasks), \ 142 .tasks = LIST_HEAD_INIT(tsk.tasks), \
164 .ptrace_children= LIST_HEAD_INIT(tsk.ptrace_children), \ 143 .ptraced = LIST_HEAD_INIT(tsk.ptraced), \
165 .ptrace_list = LIST_HEAD_INIT(tsk.ptrace_list), \ 144 .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \
166 .real_parent = &tsk, \ 145 .real_parent = &tsk, \
167 .parent = &tsk, \ 146 .parent = &tsk, \
168 .children = LIST_HEAD_INIT(tsk.children), \ 147 .children = LIST_HEAD_INIT(tsk.children), \
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index 742b917e7d1..bd578578a8b 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -7,6 +7,8 @@
7#ifndef _LINUX_INOTIFY_H 7#ifndef _LINUX_INOTIFY_H
8#define _LINUX_INOTIFY_H 8#define _LINUX_INOTIFY_H
9 9
10/* For O_CLOEXEC and O_NONBLOCK */
11#include <linux/fcntl.h>
10#include <linux/types.h> 12#include <linux/types.h>
11 13
12/* 14/*
@@ -63,6 +65,10 @@ struct inotify_event {
63 IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \ 65 IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \
64 IN_MOVE_SELF) 66 IN_MOVE_SELF)
65 67
68/* Flags for sys_inotify_init1. */
69#define IN_CLOEXEC O_CLOEXEC
70#define IN_NONBLOCK O_NONBLOCK
71
66#ifdef __KERNEL__ 72#ifdef __KERNEL__
67 73
68#include <linux/dcache.h> 74#include <linux/dcache.h>
diff --git a/include/linux/input.h b/include/linux/input.h
index 28a094fcfe2..a5802c9c81a 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -373,6 +373,8 @@ struct input_absinfo {
373 373
374#define KEY_WIMAX 246 374#define KEY_WIMAX 246
375 375
376/* Range 248 - 255 is reserved for special needs of AT keyboard driver */
377
376#define BTN_MISC 0x100 378#define BTN_MISC 0x100
377#define BTN_0 0x100 379#define BTN_0 0x100
378#define BTN_1 0x101 380#define BTN_1 0x101
@@ -534,8 +536,8 @@ struct input_absinfo {
534 536
535#define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */ 537#define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */
536#define KEY_FRAMEFORWARD 0x1b5 538#define KEY_FRAMEFORWARD 0x1b5
537
538#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ 539#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */
540#define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */
539 541
540#define KEY_DEL_EOL 0x1c0 542#define KEY_DEL_EOL 0x1c0
541#define KEY_DEL_EOS 0x1c1 543#define KEY_DEL_EOS 0x1c1
@@ -637,7 +639,11 @@ struct input_absinfo {
637#define SW_LID 0x00 /* set = lid shut */ 639#define SW_LID 0x00 /* set = lid shut */
638#define SW_TABLET_MODE 0x01 /* set = tablet mode */ 640#define SW_TABLET_MODE 0x01 /* set = tablet mode */
639#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */ 641#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */
640#define SW_RADIO 0x03 /* set = radio enabled */ 642#define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any"
643 set = radio enabled */
644#define SW_RADIO SW_RFKILL_ALL /* deprecated */
645#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */
646#define SW_DOCK 0x05 /* set = plugged into dock */
641#define SW_MAX 0x0f 647#define SW_MAX 0x0f
642#define SW_CNT (SW_MAX+1) 648#define SW_CNT (SW_MAX+1)
643 649
@@ -1213,11 +1219,6 @@ struct input_handle {
1213 struct list_head h_node; 1219 struct list_head h_node;
1214}; 1220};
1215 1221
1216#define to_dev(n) container_of(n, struct input_dev, node)
1217#define to_handler(n) container_of(n, struct input_handler, node)
1218#define to_handle(n) container_of(n, struct input_handle, d_node)
1219#define to_handle_h(n) container_of(n, struct input_handle, h_node)
1220
1221struct input_dev *input_allocate_device(void); 1222struct input_dev *input_allocate_device(void);
1222void input_free_device(struct input_dev *dev); 1223void input_free_device(struct input_dev *dev);
1223 1224
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index f1fc7470d26..62aa4f895ab 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -104,8 +104,11 @@ extern void enable_irq(unsigned int irq);
104 104
105#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS) 105#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
106 106
107extern cpumask_t irq_default_affinity;
108
107extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask); 109extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask);
108extern int irq_can_set_affinity(unsigned int irq); 110extern int irq_can_set_affinity(unsigned int irq);
111extern int irq_select_affinity(unsigned int irq);
109 112
110#else /* CONFIG_SMP */ 113#else /* CONFIG_SMP */
111 114
@@ -119,6 +122,8 @@ static inline int irq_can_set_affinity(unsigned int irq)
119 return 0; 122 return 0;
120} 123}
121 124
125static inline int irq_select_affinity(unsigned int irq) { return 0; }
126
122#endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */ 127#endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */
123 128
124#ifdef CONFIG_GENERIC_HARDIRQS 129#ifdef CONFIG_GENERIC_HARDIRQS
@@ -285,12 +290,11 @@ enum
285struct softirq_action 290struct softirq_action
286{ 291{
287 void (*action)(struct softirq_action *); 292 void (*action)(struct softirq_action *);
288 void *data;
289}; 293};
290 294
291asmlinkage void do_softirq(void); 295asmlinkage void do_softirq(void);
292asmlinkage void __do_softirq(void); 296asmlinkage void __do_softirq(void);
293extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data); 297extern void open_softirq(int nr, void (*action)(struct softirq_action *));
294extern void softirq_init(void); 298extern void softirq_init(void);
295#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0) 299#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0)
296extern void raise_softirq_irqoff(unsigned int nr); 300extern void raise_softirq_irqoff(unsigned int nr);
diff --git a/include/linux/io.h b/include/linux/io.h
index 3a03a3604cc..6c7f0ba0d5f 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -65,5 +65,6 @@ void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
65void devm_iounmap(struct device *dev, void __iomem *addr); 65void devm_iounmap(struct device *dev, void __iomem *addr);
66int check_signature(const volatile void __iomem *io_addr, 66int check_signature(const volatile void __iomem *io_addr,
67 const unsigned char *signature, int length); 67 const unsigned char *signature, int length);
68void devm_ioremap_release(struct device *dev, void *res);
68 69
69#endif /* _LINUX_IO_H */ 70#endif /* _LINUX_IO_H */
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index 2b7a1187cb2..08b987bccf8 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -99,4 +99,22 @@ static inline struct io_context *ioc_task_link(struct io_context *ioc)
99 return NULL; 99 return NULL;
100} 100}
101 101
102#ifdef CONFIG_BLOCK
103int put_io_context(struct io_context *ioc);
104void exit_io_context(void);
105struct io_context *get_io_context(gfp_t gfp_flags, int node);
106struct io_context *alloc_io_context(gfp_t gfp_flags, int node);
107void copy_io_context(struct io_context **pdst, struct io_context **psrc);
108#else
109static inline void exit_io_context(void)
110{
111}
112
113struct io_context;
114static inline int put_io_context(struct io_context *ioc)
115{
116 return 1;
117}
118#endif
119
102#endif 120#endif
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h
index c975caf7538..f8598f58394 100644
--- a/include/linux/iommu-helper.h
+++ b/include/linux/iommu-helper.h
@@ -8,3 +8,4 @@ extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
8 unsigned long align_mask); 8 unsigned long align_mask);
9extern void iommu_area_free(unsigned long *map, unsigned long start, 9extern void iommu_area_free(unsigned long *map, unsigned long start,
10 unsigned int nr); 10 unsigned int nr);
11extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len);
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index d5d40a9f792..2cd07cc2968 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -53,14 +53,15 @@ struct resource_list {
53#define IORESOURCE_AUTO 0x40000000 53#define IORESOURCE_AUTO 0x40000000
54#define IORESOURCE_BUSY 0x80000000 /* Driver has marked this resource busy */ 54#define IORESOURCE_BUSY 0x80000000 /* Driver has marked this resource busy */
55 55
56/* ISA PnP IRQ specific bits (IORESOURCE_BITS) */ 56/* PnP IRQ specific bits (IORESOURCE_BITS) */
57#define IORESOURCE_IRQ_HIGHEDGE (1<<0) 57#define IORESOURCE_IRQ_HIGHEDGE (1<<0)
58#define IORESOURCE_IRQ_LOWEDGE (1<<1) 58#define IORESOURCE_IRQ_LOWEDGE (1<<1)
59#define IORESOURCE_IRQ_HIGHLEVEL (1<<2) 59#define IORESOURCE_IRQ_HIGHLEVEL (1<<2)
60#define IORESOURCE_IRQ_LOWLEVEL (1<<3) 60#define IORESOURCE_IRQ_LOWLEVEL (1<<3)
61#define IORESOURCE_IRQ_SHAREABLE (1<<4) 61#define IORESOURCE_IRQ_SHAREABLE (1<<4)
62#define IORESOURCE_IRQ_OPTIONAL (1<<5)
62 63
63/* ISA PnP DMA specific bits (IORESOURCE_BITS) */ 64/* PnP DMA specific bits (IORESOURCE_BITS) */
64#define IORESOURCE_DMA_TYPE_MASK (3<<0) 65#define IORESOURCE_DMA_TYPE_MASK (3<<0)
65#define IORESOURCE_DMA_8BIT (0<<0) 66#define IORESOURCE_DMA_8BIT (0<<0)
66#define IORESOURCE_DMA_8AND16BIT (1<<0) 67#define IORESOURCE_DMA_8AND16BIT (1<<0)
@@ -76,7 +77,7 @@ struct resource_list {
76#define IORESOURCE_DMA_TYPEB (2<<6) 77#define IORESOURCE_DMA_TYPEB (2<<6)
77#define IORESOURCE_DMA_TYPEF (3<<6) 78#define IORESOURCE_DMA_TYPEF (3<<6)
78 79
79/* ISA PnP memory I/O specific bits (IORESOURCE_BITS) */ 80/* PnP memory I/O specific bits (IORESOURCE_BITS) */
80#define IORESOURCE_MEM_WRITEABLE (1<<0) /* dup: IORESOURCE_READONLY */ 81#define IORESOURCE_MEM_WRITEABLE (1<<0) /* dup: IORESOURCE_READONLY */
81#define IORESOURCE_MEM_CACHEABLE (1<<1) /* dup: IORESOURCE_CACHEABLE */ 82#define IORESOURCE_MEM_CACHEABLE (1<<1) /* dup: IORESOURCE_CACHEABLE */
82#define IORESOURCE_MEM_RANGELENGTH (1<<2) /* dup: IORESOURCE_RANGELENGTH */ 83#define IORESOURCE_MEM_RANGELENGTH (1<<2) /* dup: IORESOURCE_RANGELENGTH */
@@ -88,6 +89,10 @@ struct resource_list {
88#define IORESOURCE_MEM_SHADOWABLE (1<<5) /* dup: IORESOURCE_SHADOWABLE */ 89#define IORESOURCE_MEM_SHADOWABLE (1<<5) /* dup: IORESOURCE_SHADOWABLE */
89#define IORESOURCE_MEM_EXPANSIONROM (1<<6) 90#define IORESOURCE_MEM_EXPANSIONROM (1<<6)
90 91
92/* PnP I/O specific bits (IORESOURCE_BITS) */
93#define IORESOURCE_IO_16BIT_ADDR (1<<0)
94#define IORESOURCE_IO_FIXED (1<<1)
95
91/* PCI ROM control bits (IORESOURCE_BITS) */ 96/* PCI ROM control bits (IORESOURCE_BITS) */
92#define IORESOURCE_ROM_ENABLE (1<<0) /* ROM is enabled, same as PCI_ROM_ADDRESS_ENABLE */ 97#define IORESOURCE_ROM_ENABLE (1<<0) /* ROM is enabled, same as PCI_ROM_ADDRESS_ENABLE */
93#define IORESOURCE_ROM_SHADOW (1<<1) /* ROM is copy at C000:0 */ 98#define IORESOURCE_ROM_SHADOW (1<<1) /* ROM is copy at C000:0 */
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
index 2a3bb1bb743..f98a656b17e 100644
--- a/include/linux/ioprio.h
+++ b/include/linux/ioprio.h
@@ -68,6 +68,20 @@ static inline int task_nice_ioprio(struct task_struct *task)
68} 68}
69 69
70/* 70/*
71 * This is for the case where the task hasn't asked for a specific IO class.
72 * Check for idle and rt task process, and return appropriate IO class.
73 */
74static inline int task_nice_ioclass(struct task_struct *task)
75{
76 if (task->policy == SCHED_IDLE)
77 return IOPRIO_CLASS_IDLE;
78 else if (task->policy == SCHED_FIFO || task->policy == SCHED_RR)
79 return IOPRIO_CLASS_RT;
80 else
81 return IOPRIO_CLASS_BE;
82}
83
84/*
71 * For inheritance, return the highest of the two given priorities 85 * For inheritance, return the highest of the two given priorities
72 */ 86 */
73extern int ioprio_best(unsigned short aprio, unsigned short bprio); 87extern int ioprio_best(unsigned short aprio, unsigned short bprio);
diff --git a/include/linux/ip6_tunnel.h b/include/linux/ip6_tunnel.h
index af3f4a70f3d..1e7cc4af40d 100644
--- a/include/linux/ip6_tunnel.h
+++ b/include/linux/ip6_tunnel.h
@@ -1,7 +1,3 @@
1/*
2 * $Id$
3 */
4
5#ifndef _IP6_TUNNEL_H 1#ifndef _IP6_TUNNEL_H
6#define _IP6_TUNNEL_H 2#define _IP6_TUNNEL_H
7 3
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index ea6c18a8b0d..ea330f9e710 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -36,6 +36,7 @@ struct ipc_namespace {
36 int msg_ctlmni; 36 int msg_ctlmni;
37 atomic_t msg_bytes; 37 atomic_t msg_bytes;
38 atomic_t msg_hdrs; 38 atomic_t msg_hdrs;
39 int auto_msgmni;
39 40
40 size_t shm_ctlmax; 41 size_t shm_ctlmax;
41 size_t shm_ctlall; 42 size_t shm_ctlall;
@@ -53,7 +54,7 @@ extern atomic_t nr_ipc_ns;
53 54
54extern int register_ipcns_notifier(struct ipc_namespace *); 55extern int register_ipcns_notifier(struct ipc_namespace *);
55extern int cond_register_ipcns_notifier(struct ipc_namespace *); 56extern int cond_register_ipcns_notifier(struct ipc_namespace *);
56extern int unregister_ipcns_notifier(struct ipc_namespace *); 57extern void unregister_ipcns_notifier(struct ipc_namespace *);
57extern int ipcns_notify(unsigned long); 58extern int ipcns_notify(unsigned long);
58 59
59#else /* CONFIG_SYSVIPC */ 60#else /* CONFIG_SYSVIPC */
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 10b666b61ad..641e026eee8 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -123,6 +123,7 @@ struct ipv6hdr {
123 struct in6_addr daddr; 123 struct in6_addr daddr;
124}; 124};
125 125
126#ifdef __KERNEL__
126/* 127/*
127 * This structure contains configuration options per IPv6 link. 128 * This structure contains configuration options per IPv6 link.
128 */ 129 */
@@ -163,8 +164,11 @@ struct ipv6_devconf {
163#ifdef CONFIG_IPV6_MROUTE 164#ifdef CONFIG_IPV6_MROUTE
164 __s32 mc_forwarding; 165 __s32 mc_forwarding;
165#endif 166#endif
167 __s32 disable_ipv6;
168 __s32 accept_dad;
166 void *sysctl; 169 void *sysctl;
167}; 170};
171#endif
168 172
169/* index values for the variables in ipv6_devconf */ 173/* index values for the variables in ipv6_devconf */
170enum { 174enum {
@@ -194,6 +198,8 @@ enum {
194 DEVCONF_OPTIMISTIC_DAD, 198 DEVCONF_OPTIMISTIC_DAD,
195 DEVCONF_ACCEPT_SOURCE_ROUTE, 199 DEVCONF_ACCEPT_SOURCE_ROUTE,
196 DEVCONF_MC_FORWARDING, 200 DEVCONF_MC_FORWARDING,
201 DEVCONF_DISABLE_IPV6,
202 DEVCONF_ACCEPT_DAD,
197 DEVCONF_MAX 203 DEVCONF_MAX
198}; 204};
199 205
@@ -396,8 +402,10 @@ static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *op
396{ 402{
397 struct request_sock *req = reqsk_alloc(ops); 403 struct request_sock *req = reqsk_alloc(ops);
398 404
399 if (req != NULL) 405 if (req != NULL) {
400 inet_rsk(req)->inet6_rsk_offset = inet6_rsk_offset(req); 406 inet_rsk(req)->inet6_rsk_offset = inet6_rsk_offset(req);
407 inet6_rsk(req)->pktopts = NULL;
408 }
401 409
402 return req; 410 return req;
403} 411}
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 552e0ec269c..8ccb462ea42 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -244,15 +244,6 @@ static inline void set_balance_irq_affinity(unsigned int irq, cpumask_t mask)
244} 244}
245#endif 245#endif
246 246
247#ifdef CONFIG_AUTO_IRQ_AFFINITY
248extern int select_smp_affinity(unsigned int irq);
249#else
250static inline int select_smp_affinity(unsigned int irq)
251{
252 return 1;
253}
254#endif
255
256extern int no_irq_affinity; 247extern int no_irq_affinity;
257 248
258static inline int irq_balancing_disabled(unsigned int irq) 249static inline int irq_balancing_disabled(unsigned int irq)
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
index e600c4e9b8c..74bde13224c 100644
--- a/include/linux/irqflags.h
+++ b/include/linux/irqflags.h
@@ -11,11 +11,13 @@
11#ifndef _LINUX_TRACE_IRQFLAGS_H 11#ifndef _LINUX_TRACE_IRQFLAGS_H
12#define _LINUX_TRACE_IRQFLAGS_H 12#define _LINUX_TRACE_IRQFLAGS_H
13 13
14#include <linux/typecheck.h>
15
14#ifdef CONFIG_TRACE_IRQFLAGS 16#ifdef CONFIG_TRACE_IRQFLAGS
15 extern void trace_hardirqs_on(void);
16 extern void trace_hardirqs_off(void);
17 extern void trace_softirqs_on(unsigned long ip); 17 extern void trace_softirqs_on(unsigned long ip);
18 extern void trace_softirqs_off(unsigned long ip); 18 extern void trace_softirqs_off(unsigned long ip);
19 extern void trace_hardirqs_on(void);
20 extern void trace_hardirqs_off(void);
19# define trace_hardirq_context(p) ((p)->hardirq_context) 21# define trace_hardirq_context(p) ((p)->hardirq_context)
20# define trace_softirq_context(p) ((p)->softirq_context) 22# define trace_softirq_context(p) ((p)->softirq_context)
21# define trace_hardirqs_enabled(p) ((p)->hardirqs_enabled) 23# define trace_hardirqs_enabled(p) ((p)->hardirqs_enabled)
@@ -41,6 +43,15 @@
41# define INIT_TRACE_IRQFLAGS 43# define INIT_TRACE_IRQFLAGS
42#endif 44#endif
43 45
46#if defined(CONFIG_IRQSOFF_TRACER) || \
47 defined(CONFIG_PREEMPT_TRACER)
48 extern void stop_critical_timings(void);
49 extern void start_critical_timings(void);
50#else
51# define stop_critical_timings() do { } while (0)
52# define start_critical_timings() do { } while (0)
53#endif
54
44#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT 55#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
45 56
46#include <asm/irqflags.h> 57#include <asm/irqflags.h>
@@ -49,18 +60,24 @@
49 do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0) 60 do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0)
50#define local_irq_disable() \ 61#define local_irq_disable() \
51 do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0) 62 do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0)
52#define local_irq_save(flags) \ 63#define local_irq_save(flags) \
53 do { raw_local_irq_save(flags); trace_hardirqs_off(); } while (0) 64 do { \
65 typecheck(unsigned long, flags); \
66 raw_local_irq_save(flags); \
67 trace_hardirqs_off(); \
68 } while (0)
54 69
55#define local_irq_restore(flags) \ 70
56 do { \ 71#define local_irq_restore(flags) \
57 if (raw_irqs_disabled_flags(flags)) { \ 72 do { \
58 raw_local_irq_restore(flags); \ 73 typecheck(unsigned long, flags); \
59 trace_hardirqs_off(); \ 74 if (raw_irqs_disabled_flags(flags)) { \
60 } else { \ 75 raw_local_irq_restore(flags); \
61 trace_hardirqs_on(); \ 76 trace_hardirqs_off(); \
62 raw_local_irq_restore(flags); \ 77 } else { \
63 } \ 78 trace_hardirqs_on(); \
79 raw_local_irq_restore(flags); \
80 } \
64 } while (0) 81 } while (0)
65#else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */ 82#else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */
66/* 83/*
@@ -69,8 +86,16 @@
69 */ 86 */
70# define raw_local_irq_disable() local_irq_disable() 87# define raw_local_irq_disable() local_irq_disable()
71# define raw_local_irq_enable() local_irq_enable() 88# define raw_local_irq_enable() local_irq_enable()
72# define raw_local_irq_save(flags) local_irq_save(flags) 89# define raw_local_irq_save(flags) \
73# define raw_local_irq_restore(flags) local_irq_restore(flags) 90 do { \
91 typecheck(unsigned long, flags); \
92 local_irq_save(flags); \
93 } while (0)
94# define raw_local_irq_restore(flags) \
95 do { \
96 typecheck(unsigned long, flags); \
97 local_irq_restore(flags); \
98 } while (0)
74#endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */ 99#endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */
75 100
76#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT 101#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
@@ -80,7 +105,11 @@
80 raw_safe_halt(); \ 105 raw_safe_halt(); \
81 } while (0) 106 } while (0)
82 107
83#define local_save_flags(flags) raw_local_save_flags(flags) 108#define local_save_flags(flags) \
109 do { \
110 typecheck(unsigned long, flags); \
111 raw_local_save_flags(flags); \
112 } while (0)
84 113
85#define irqs_disabled() \ 114#define irqs_disabled() \
86({ \ 115({ \
@@ -90,7 +119,11 @@
90 raw_irqs_disabled_flags(_flags); \ 119 raw_irqs_disabled_flags(_flags); \
91}) 120})
92 121
93#define irqs_disabled_flags(flags) raw_irqs_disabled_flags(flags) 122#define irqs_disabled_flags(flags) \
123({ \
124 typecheck(unsigned long, flags); \
125 raw_irqs_disabled_flags(flags); \
126})
94#endif /* CONFIG_X86 */ 127#endif /* CONFIG_X86 */
95 128
96#endif 129#endif
diff --git a/include/linux/istallion.h b/include/linux/istallion.h
index 5a84fe944b7..0d184072324 100644
--- a/include/linux/istallion.h
+++ b/include/linux/istallion.h
@@ -51,25 +51,21 @@
51 */ 51 */
52struct stliport { 52struct stliport {
53 unsigned long magic; 53 unsigned long magic;
54 struct tty_port port;
54 unsigned int portnr; 55 unsigned int portnr;
55 unsigned int panelnr; 56 unsigned int panelnr;
56 unsigned int brdnr; 57 unsigned int brdnr;
57 unsigned long state; 58 unsigned long state;
58 unsigned int devnr; 59 unsigned int devnr;
59 int flags;
60 int baud_base; 60 int baud_base;
61 int custom_divisor; 61 int custom_divisor;
62 int close_delay; 62 int close_delay;
63 int closing_wait; 63 int closing_wait;
64 int refcount;
65 int openwaitcnt; 64 int openwaitcnt;
66 int rc; 65 int rc;
67 int argsize; 66 int argsize;
68 void *argp; 67 void *argp;
69 unsigned int rxmarkmsk; 68 unsigned int rxmarkmsk;
70 struct tty_struct *tty;
71 wait_queue_head_t open_wait;
72 wait_queue_head_t close_wait;
73 wait_queue_head_t raw_wait; 69 wait_queue_head_t raw_wait;
74 struct asysigs asig; 70 struct asysigs asig;
75 unsigned long addr; 71 unsigned long addr;
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 05e2b307161..3dd20900709 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -168,6 +168,8 @@ struct commit_header {
168 unsigned char h_chksum_size; 168 unsigned char h_chksum_size;
169 unsigned char h_padding[2]; 169 unsigned char h_padding[2];
170 __be32 h_chksum[JBD2_CHECKSUM_BYTES]; 170 __be32 h_chksum[JBD2_CHECKSUM_BYTES];
171 __be64 h_commit_sec;
172 __be32 h_commit_nsec;
171}; 173};
172 174
173/* 175/*
@@ -379,6 +381,38 @@ static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
379 bit_spin_unlock(BH_JournalHead, &bh->b_state); 381 bit_spin_unlock(BH_JournalHead, &bh->b_state);
380} 382}
381 383
384/* Flags in jbd_inode->i_flags */
385#define __JI_COMMIT_RUNNING 0
386/* Commit of the inode data in progress. We use this flag to protect us from
387 * concurrent deletion of inode. We cannot use reference to inode for this
388 * since we cannot afford doing last iput() on behalf of kjournald
389 */
390#define JI_COMMIT_RUNNING (1 << __JI_COMMIT_RUNNING)
391
392/**
393 * struct jbd_inode is the structure linking inodes in ordered mode
394 * present in a transaction so that we can sync them during commit.
395 */
396struct jbd2_inode {
397 /* Which transaction does this inode belong to? Either the running
398 * transaction or the committing one. [j_list_lock] */
399 transaction_t *i_transaction;
400
401 /* Pointer to the running transaction modifying inode's data in case
402 * there is already a committing transaction touching it. [j_list_lock] */
403 transaction_t *i_next_transaction;
404
405 /* List of inodes in the i_transaction [j_list_lock] */
406 struct list_head i_list;
407
408 /* VFS inode this inode belongs to [constant during the lifetime
409 * of the structure] */
410 struct inode *i_vfs_inode;
411
412 /* Flags of inode [j_list_lock] */
413 unsigned int i_flags;
414};
415
382struct jbd2_revoke_table_s; 416struct jbd2_revoke_table_s;
383 417
384/** 418/**
@@ -509,24 +543,12 @@ struct transaction_s
509 struct journal_head *t_reserved_list; 543 struct journal_head *t_reserved_list;
510 544
511 /* 545 /*
512 * Doubly-linked circular list of all buffers under writeout during
513 * commit [j_list_lock]
514 */
515 struct journal_head *t_locked_list;
516
517 /*
518 * Doubly-linked circular list of all metadata buffers owned by this 546 * Doubly-linked circular list of all metadata buffers owned by this
519 * transaction [j_list_lock] 547 * transaction [j_list_lock]
520 */ 548 */
521 struct journal_head *t_buffers; 549 struct journal_head *t_buffers;
522 550
523 /* 551 /*
524 * Doubly-linked circular list of all data buffers still to be
525 * flushed before this transaction can be committed [j_list_lock]
526 */
527 struct journal_head *t_sync_datalist;
528
529 /*
530 * Doubly-linked circular list of all forget buffers (superseded 552 * Doubly-linked circular list of all forget buffers (superseded
531 * buffers which we can un-checkpoint once this transaction commits) 553 * buffers which we can un-checkpoint once this transaction commits)
532 * [j_list_lock] 554 * [j_list_lock]
@@ -565,6 +587,12 @@ struct transaction_s
565 struct journal_head *t_log_list; 587 struct journal_head *t_log_list;
566 588
567 /* 589 /*
590 * List of inodes whose data we've modified in data=ordered mode.
591 * [j_list_lock]
592 */
593 struct list_head t_inode_list;
594
595 /*
568 * Protects info related to handles 596 * Protects info related to handles
569 */ 597 */
570 spinlock_t t_handle_lock; 598 spinlock_t t_handle_lock;
@@ -919,6 +947,9 @@ struct journal_s
919 struct proc_dir_entry *j_proc_entry; 947 struct proc_dir_entry *j_proc_entry;
920 struct transaction_stats_s j_stats; 948 struct transaction_stats_s j_stats;
921 949
950 /* Failed journal commit ID */
951 unsigned int j_failed_commit;
952
922 /* 953 /*
923 * An opaque pointer to fs-private information. ext3 puts its 954 * An opaque pointer to fs-private information. ext3 puts its
924 * superblock pointer here 955 * superblock pointer here
@@ -1001,7 +1032,6 @@ extern int jbd2_journal_extend (handle_t *, int nblocks);
1001extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); 1032extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *);
1002extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); 1033extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *);
1003extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *); 1034extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *);
1004extern int jbd2_journal_dirty_data (handle_t *, struct buffer_head *);
1005extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); 1035extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
1006extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *); 1036extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *);
1007extern int jbd2_journal_forget (handle_t *, struct buffer_head *); 1037extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
@@ -1041,6 +1071,10 @@ extern void jbd2_journal_ack_err (journal_t *);
1041extern int jbd2_journal_clear_err (journal_t *); 1071extern int jbd2_journal_clear_err (journal_t *);
1042extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *); 1072extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *);
1043extern int jbd2_journal_force_commit(journal_t *); 1073extern int jbd2_journal_force_commit(journal_t *);
1074extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode);
1075extern int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode, loff_t new_size);
1076extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode);
1077extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode);
1044 1078
1045/* 1079/*
1046 * journal_head management 1080 * journal_head management
@@ -1176,15 +1210,13 @@ static inline int jbd_space_needed(journal_t *journal)
1176 1210
1177/* journaling buffer types */ 1211/* journaling buffer types */
1178#define BJ_None 0 /* Not journaled */ 1212#define BJ_None 0 /* Not journaled */
1179#define BJ_SyncData 1 /* Normal data: flush before commit */ 1213#define BJ_Metadata 1 /* Normal journaled metadata */
1180#define BJ_Metadata 2 /* Normal journaled metadata */ 1214#define BJ_Forget 2 /* Buffer superseded by this transaction */
1181#define BJ_Forget 3 /* Buffer superseded by this transaction */ 1215#define BJ_IO 3 /* Buffer is for temporary IO use */
1182#define BJ_IO 4 /* Buffer is for temporary IO use */ 1216#define BJ_Shadow 4 /* Buffer contents being shadowed to the log */
1183#define BJ_Shadow 5 /* Buffer contents being shadowed to the log */ 1217#define BJ_LogCtl 5 /* Buffer contains log descriptors */
1184#define BJ_LogCtl 6 /* Buffer contains log descriptors */ 1218#define BJ_Reserved 6 /* Buffer is reserved for access by journal */
1185#define BJ_Reserved 7 /* Buffer is reserved for access by journal */ 1219#define BJ_Types 7
1186#define BJ_Locked 8 /* Locked for I/O during commit */
1187#define BJ_Types 9
1188 1220
1189extern int jbd_blocks_per_page(struct inode *inode); 1221extern int jbd_blocks_per_page(struct inode *inode);
1190 1222
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h
index 6b563cae23d..da720bc3eb1 100644
--- a/include/linux/jffs2.h
+++ b/include/linux/jffs2.h
@@ -7,9 +7,6 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in the 8 * For licensing information, see the file 'LICENCE' in the
9 * jffs2 directory. 9 * jffs2 directory.
10 *
11 * $Id: jffs2.h,v 1.38 2005/09/26 11:37:23 havasi Exp $
12 *
13 */ 10 */
14 11
15#ifndef __LINUX_JFFS2_H__ 12#ifndef __LINUX_JFFS2_H__
diff --git a/include/linux/joystick.h b/include/linux/joystick.h
index e2d3a18af45..b5e051295a6 100644
--- a/include/linux/joystick.h
+++ b/include/linux/joystick.h
@@ -2,8 +2,6 @@
2#define _LINUX_JOYSTICK_H 2#define _LINUX_JOYSTICK_H
3 3
4/* 4/*
5 * $Id: joystick.h,v 1.3 2000/11/30 11:07:05 vojtech Exp $
6 *
7 * Copyright (C) 1996-2000 Vojtech Pavlik 5 * Copyright (C) 1996-2000 Vojtech Pavlik
8 * 6 *
9 * Sponsored by SuSE 7 * Sponsored by SuSE
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 82de2fb62cb..57aefa160a9 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -6,6 +6,7 @@
6#define _LINUX_KALLSYMS_H 6#define _LINUX_KALLSYMS_H
7 7
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <linux/kernel.h>
9#include <linux/stddef.h> 10#include <linux/stddef.h>
10 11
11#define KSYM_NAME_LEN 128 12#define KSYM_NAME_LEN 128
@@ -83,16 +84,6 @@ __attribute__((format(printf,1,2)));
83static inline void __check_printsym_format(const char *fmt, ...) 84static inline void __check_printsym_format(const char *fmt, ...)
84{ 85{
85} 86}
86/* ia64 and ppc64 use function descriptors, which contain the real address */
87#if defined(CONFIG_IA64) || defined(CONFIG_PPC64)
88#define print_fn_descriptor_symbol(fmt, addr) \
89do { \
90 unsigned long *__faddr = (unsigned long*) addr; \
91 print_symbol(fmt, __faddr[0]); \
92} while (0)
93#else
94#define print_fn_descriptor_symbol(fmt, addr) print_symbol(fmt, addr)
95#endif
96 87
97static inline void print_symbol(const char *fmt, unsigned long addr) 88static inline void print_symbol(const char *fmt, unsigned long addr)
98{ 89{
@@ -101,18 +92,24 @@ static inline void print_symbol(const char *fmt, unsigned long addr)
101 __builtin_extract_return_addr((void *)addr)); 92 __builtin_extract_return_addr((void *)addr));
102} 93}
103 94
104#ifndef CONFIG_64BIT 95/*
105#define print_ip_sym(ip) \ 96 * Pretty-print a function pointer.
106do { \ 97 *
107 printk("[<%08lx>]", ip); \ 98 * ia64 and ppc64 function pointers are really function descriptors,
108 print_symbol(" %s\n", ip); \ 99 * which contain a pointer the real address.
109} while(0) 100 */
110#else 101static inline void print_fn_descriptor_symbol(const char *fmt, void *addr)
111#define print_ip_sym(ip) \ 102{
112do { \ 103#if defined(CONFIG_IA64) || defined(CONFIG_PPC64)
113 printk("[<%016lx>]", ip); \ 104 addr = *(void **)addr;
114 print_symbol(" %s\n", ip); \
115} while(0)
116#endif 105#endif
106 print_symbol(fmt, (unsigned long)addr);
107}
108
109static inline void print_ip_sym(unsigned long ip)
110{
111 printk("[<%p>]", (void *) ip);
112 print_symbol(" %s\n", ip);
113}
117 114
118#endif /*_LINUX_KALLSYMS_H*/ 115#endif /*_LINUX_KALLSYMS_H*/
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 4d46e299afb..fdbbf72ca2e 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -14,6 +14,8 @@
14#include <linux/compiler.h> 14#include <linux/compiler.h>
15#include <linux/bitops.h> 15#include <linux/bitops.h>
16#include <linux/log2.h> 16#include <linux/log2.h>
17#include <linux/typecheck.h>
18#include <linux/ratelimit.h>
17#include <asm/byteorder.h> 19#include <asm/byteorder.h>
18#include <asm/bug.h> 20#include <asm/bug.h>
19 21
@@ -46,6 +48,9 @@ extern const char linux_proc_banner[];
46#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 48#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
47#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) 49#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
48 50
51#define _RET_IP_ (unsigned long)__builtin_return_address(0)
52#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
53
49#ifdef CONFIG_LBD 54#ifdef CONFIG_LBD
50# include <asm/div64.h> 55# include <asm/div64.h>
51# define sector_div(a, b) do_div(a, b) 56# define sector_div(a, b) do_div(a, b)
@@ -184,15 +189,9 @@ asmlinkage int vprintk(const char *fmt, va_list args)
184 __attribute__ ((format (printf, 1, 0))); 189 __attribute__ ((format (printf, 1, 0)));
185asmlinkage int printk(const char * fmt, ...) 190asmlinkage int printk(const char * fmt, ...)
186 __attribute__ ((format (printf, 1, 2))) __cold; 191 __attribute__ ((format (printf, 1, 2))) __cold;
187extern int log_buf_get_len(void);
188extern int log_buf_read(int idx);
189extern int log_buf_copy(char *dest, int idx, int len);
190 192
191extern int printk_ratelimit_jiffies; 193extern struct ratelimit_state printk_ratelimit_state;
192extern int printk_ratelimit_burst;
193extern int printk_ratelimit(void); 194extern int printk_ratelimit(void);
194extern int __ratelimit(int ratelimit_jiffies, int ratelimit_burst);
195extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst);
196extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, 195extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
197 unsigned int interval_msec); 196 unsigned int interval_msec);
198#else 197#else
@@ -202,18 +201,13 @@ static inline int vprintk(const char *s, va_list args) { return 0; }
202static inline int printk(const char *s, ...) 201static inline int printk(const char *s, ...)
203 __attribute__ ((format (printf, 1, 2))); 202 __attribute__ ((format (printf, 1, 2)));
204static inline int __cold printk(const char *s, ...) { return 0; } 203static inline int __cold printk(const char *s, ...) { return 0; }
205static inline int log_buf_get_len(void) { return 0; }
206static inline int log_buf_read(int idx) { return 0; }
207static inline int log_buf_copy(char *dest, int idx, int len) { return 0; }
208static inline int printk_ratelimit(void) { return 0; } 204static inline int printk_ratelimit(void) { return 0; }
209static inline int __printk_ratelimit(int ratelimit_jiffies, \
210 int ratelimit_burst) { return 0; }
211static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ 205static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \
212 unsigned int interval_msec) \ 206 unsigned int interval_msec) \
213 { return false; } 207 { return false; }
214#endif 208#endif
215 209
216extern void __attribute__((format(printf, 1, 2))) 210extern void asmlinkage __attribute__((format(printf, 1, 2)))
217 early_printk(const char *fmt, ...); 211 early_printk(const char *fmt, ...);
218 212
219unsigned long int_sqrt(unsigned long); 213unsigned long int_sqrt(unsigned long);
@@ -276,7 +270,17 @@ extern void print_hex_dump(const char *level, const char *prefix_str,
276 const void *buf, size_t len, bool ascii); 270 const void *buf, size_t len, bool ascii);
277extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, 271extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
278 const void *buf, size_t len); 272 const void *buf, size_t len);
279#define hex_asc(x) "0123456789abcdef"[x] 273
274extern const char hex_asc[];
275#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
276#define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4]
277
278static inline char *pack_hex_byte(char *buf, u8 byte)
279{
280 *buf++ = hex_asc_hi(byte);
281 *buf++ = hex_asc_lo(byte);
282 return buf;
283}
280 284
281#define pr_emerg(fmt, arg...) \ 285#define pr_emerg(fmt, arg...) \
282 printk(KERN_EMERG fmt, ##arg) 286 printk(KERN_EMERG fmt, ##arg)
@@ -434,26 +438,6 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
434 const typeof( ((type *)0)->member ) *__mptr = (ptr); \ 438 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
435 (type *)( (char *)__mptr - offsetof(type,member) );}) 439 (type *)( (char *)__mptr - offsetof(type,member) );})
436 440
437/*
438 * Check at compile time that something is of a particular type.
439 * Always evaluates to 1 so you may use it easily in comparisons.
440 */
441#define typecheck(type,x) \
442({ type __dummy; \
443 typeof(x) __dummy2; \
444 (void)(&__dummy == &__dummy2); \
445 1; \
446})
447
448/*
449 * Check at compile time that 'function' is a certain type, or is a pointer
450 * to that type (needs to use typedef for the function type.)
451 */
452#define typecheck_fn(type,function) \
453({ typeof(type) __tmp = function; \
454 (void)__tmp; \
455})
456
457struct sysinfo; 441struct sysinfo;
458extern int do_sysinfo(struct sysinfo *info); 442extern int do_sysinfo(struct sysinfo *info);
459 443
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index e8ffce898bf..cf9f40a91c9 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -1,11 +1,11 @@
1#ifndef _LINUX_KERNEL_STAT_H 1#ifndef _LINUX_KERNEL_STAT_H
2#define _LINUX_KERNEL_STAT_H 2#define _LINUX_KERNEL_STAT_H
3 3
4#include <asm/irq.h>
5#include <linux/smp.h> 4#include <linux/smp.h>
6#include <linux/threads.h> 5#include <linux/threads.h>
7#include <linux/percpu.h> 6#include <linux/percpu.h>
8#include <linux/cpumask.h> 7#include <linux/cpumask.h>
8#include <asm/irq.h>
9#include <asm/cputime.h> 9#include <asm/cputime.h>
10 10
11/* 11/*
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 3265968cd2c..82f88a8a827 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -83,6 +83,7 @@ struct kimage {
83 83
84 unsigned long start; 84 unsigned long start;
85 struct page *control_code_page; 85 struct page *control_code_page;
86 struct page *swap_page;
86 87
87 unsigned long nr_segments; 88 unsigned long nr_segments;
88 struct kexec_segment segment[KEXEC_SEGMENT_MAX]; 89 struct kexec_segment segment[KEXEC_SEGMENT_MAX];
@@ -98,18 +99,20 @@ struct kimage {
98 unsigned int type : 1; 99 unsigned int type : 1;
99#define KEXEC_TYPE_DEFAULT 0 100#define KEXEC_TYPE_DEFAULT 0
100#define KEXEC_TYPE_CRASH 1 101#define KEXEC_TYPE_CRASH 1
102 unsigned int preserve_context : 1;
101}; 103};
102 104
103 105
104 106
105/* kexec interface functions */ 107/* kexec interface functions */
106extern NORET_TYPE void machine_kexec(struct kimage *image) ATTRIB_NORET; 108extern void machine_kexec(struct kimage *image);
107extern int machine_kexec_prepare(struct kimage *image); 109extern int machine_kexec_prepare(struct kimage *image);
108extern void machine_kexec_cleanup(struct kimage *image); 110extern void machine_kexec_cleanup(struct kimage *image);
109extern asmlinkage long sys_kexec_load(unsigned long entry, 111extern asmlinkage long sys_kexec_load(unsigned long entry,
110 unsigned long nr_segments, 112 unsigned long nr_segments,
111 struct kexec_segment __user *segments, 113 struct kexec_segment __user *segments,
112 unsigned long flags); 114 unsigned long flags);
115extern int kernel_kexec(void);
113#ifdef CONFIG_COMPAT 116#ifdef CONFIG_COMPAT
114extern asmlinkage long compat_sys_kexec_load(unsigned long entry, 117extern asmlinkage long compat_sys_kexec_load(unsigned long entry,
115 unsigned long nr_segments, 118 unsigned long nr_segments,
@@ -156,8 +159,9 @@ extern struct kimage *kexec_crash_image;
156#define kexec_flush_icache_page(page) 159#define kexec_flush_icache_page(page)
157#endif 160#endif
158 161
159#define KEXEC_ON_CRASH 0x00000001 162#define KEXEC_ON_CRASH 0x00000001
160#define KEXEC_ARCH_MASK 0xffff0000 163#define KEXEC_PRESERVE_CONTEXT 0x00000002
164#define KEXEC_ARCH_MASK 0xffff0000
161 165
162/* These values match the ELF architecture values. 166/* These values match the ELF architecture values.
163 * Unless there is a good reason that should continue to be the case. 167 * Unless there is a good reason that should continue to be the case.
@@ -174,7 +178,12 @@ extern struct kimage *kexec_crash_image;
174#define KEXEC_ARCH_MIPS_LE (10 << 16) 178#define KEXEC_ARCH_MIPS_LE (10 << 16)
175#define KEXEC_ARCH_MIPS ( 8 << 16) 179#define KEXEC_ARCH_MIPS ( 8 << 16)
176 180
177#define KEXEC_FLAGS (KEXEC_ON_CRASH) /* List of defined/legal kexec flags */ 181/* List of defined/legal kexec flags */
182#ifndef CONFIG_KEXEC_JUMP
183#define KEXEC_FLAGS KEXEC_ON_CRASH
184#else
185#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)
186#endif
178 187
179#define VMCOREINFO_BYTES (4096) 188#define VMCOREINFO_BYTES (4096)
180#define VMCOREINFO_NOTE_NAME "VMCOREINFO" 189#define VMCOREINFO_NOTE_NAME "VMCOREINFO"
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 9757b1a6d9d..6adcc297e35 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -261,10 +261,12 @@ struct kgdb_io {
261 261
262extern struct kgdb_arch arch_kgdb_ops; 262extern struct kgdb_arch arch_kgdb_ops;
263 263
264extern unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs);
265
264extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops); 266extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops);
265extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops); 267extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops);
266 268
267extern int kgdb_hex2long(char **ptr, long *long_val); 269extern int kgdb_hex2long(char **ptr, unsigned long *long_val);
268extern int kgdb_mem2hex(char *mem, char *buf, int count); 270extern int kgdb_mem2hex(char *mem, char *buf, int count);
269extern int kgdb_hex2mem(char *buf, char *mem, int count); 271extern int kgdb_hex2mem(char *buf, char *mem, int count);
270 272
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 5dc13848891..a1a91577813 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -19,29 +19,31 @@
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 20 */
21 21
22#include <linux/gfp.h>
22#include <linux/stddef.h> 23#include <linux/stddef.h>
23#include <linux/errno.h> 24#include <linux/errno.h>
24#include <linux/compiler.h> 25#include <linux/compiler.h>
25 26
26#define KMOD_PATH_LEN 256 27#define KMOD_PATH_LEN 256
27 28
28#ifdef CONFIG_KMOD 29#ifdef CONFIG_MODULES
29/* modprobe exit status on success, -ve on error. Return value 30/* modprobe exit status on success, -ve on error. Return value
30 * usually useless though. */ 31 * usually useless though. */
31extern int request_module(const char * name, ...) __attribute__ ((format (printf, 1, 2))); 32extern int request_module(const char * name, ...) __attribute__ ((format (printf, 1, 2)));
33#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x)))
32#else 34#else
33static inline int request_module(const char * name, ...) { return -ENOSYS; } 35static inline int request_module(const char * name, ...) { return -ENOSYS; }
36#define try_then_request_module(x, mod...) (x)
34#endif 37#endif
35 38
36#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x)))
37 39
38struct key; 40struct key;
39struct file; 41struct file;
40struct subprocess_info; 42struct subprocess_info;
41 43
42/* Allocate a subprocess_info structure */ 44/* Allocate a subprocess_info structure */
43struct subprocess_info *call_usermodehelper_setup(char *path, 45struct subprocess_info *call_usermodehelper_setup(char *path, char **argv,
44 char **argv, char **envp); 46 char **envp, gfp_t gfp_mask);
45 47
46/* Set various pieces of state into the subprocess_info structure */ 48/* Set various pieces of state into the subprocess_info structure */
47void call_usermodehelper_setkeys(struct subprocess_info *info, 49void call_usermodehelper_setkeys(struct subprocess_info *info,
@@ -68,8 +70,9 @@ static inline int
68call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait) 70call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait)
69{ 71{
70 struct subprocess_info *info; 72 struct subprocess_info *info;
73 gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL;
71 74
72 info = call_usermodehelper_setup(path, argv, envp); 75 info = call_usermodehelper_setup(path, argv, envp, gfp_mask);
73 if (info == NULL) 76 if (info == NULL)
74 return -ENOMEM; 77 return -ENOMEM;
75 return call_usermodehelper_exec(info, wait); 78 return call_usermodehelper_exec(info, wait);
@@ -80,8 +83,9 @@ call_usermodehelper_keys(char *path, char **argv, char **envp,
80 struct key *session_keyring, enum umh_wait wait) 83 struct key *session_keyring, enum umh_wait wait)
81{ 84{
82 struct subprocess_info *info; 85 struct subprocess_info *info;
86 gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL;
83 87
84 info = call_usermodehelper_setup(path, argv, envp); 88 info = call_usermodehelper_setup(path, argv, envp, gfp_mask);
85 if (info == NULL) 89 if (info == NULL)
86 return -ENOMEM; 90 return -ENOMEM;
87 91
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 39e709f88aa..5437ac0276e 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -26,7 +26,6 @@
26#include <linux/wait.h> 26#include <linux/wait.h>
27#include <asm/atomic.h> 27#include <asm/atomic.h>
28 28
29#define KOBJ_NAME_LEN 20
30#define UEVENT_HELPER_PATH_LEN 256 29#define UEVENT_HELPER_PATH_LEN 256
31#define UEVENT_NUM_ENVP 32 /* number of env pointers */ 30#define UEVENT_NUM_ENVP 32 /* number of env pointers */
32#define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */ 31#define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */
@@ -59,12 +58,12 @@ enum kobject_action {
59 58
60struct kobject { 59struct kobject {
61 const char *name; 60 const char *name;
62 struct kref kref;
63 struct list_head entry; 61 struct list_head entry;
64 struct kobject *parent; 62 struct kobject *parent;
65 struct kset *kset; 63 struct kset *kset;
66 struct kobj_type *ktype; 64 struct kobj_type *ktype;
67 struct sysfs_dirent *sd; 65 struct sysfs_dirent *sd;
66 struct kref kref;
68 unsigned int state_initialized:1; 67 unsigned int state_initialized:1;
69 unsigned int state_in_sysfs:1; 68 unsigned int state_in_sysfs:1;
70 unsigned int state_add_uevent_sent:1; 69 unsigned int state_add_uevent_sent:1;
@@ -187,6 +186,8 @@ extern struct kobject *kset_find_obj(struct kset *, const char *);
187 186
188/* The global /sys/kernel/ kobject for people to chain off of */ 187/* The global /sys/kernel/ kobject for people to chain off of */
189extern struct kobject *kernel_kobj; 188extern struct kobject *kernel_kobj;
189/* The global /sys/kernel/mm/ kobject for people to chain off of */
190extern struct kobject *mm_kobj;
190/* The global /sys/hypervisor/ kobject for people to chain off of */ 191/* The global /sys/hypervisor/ kobject for people to chain off of */
191extern struct kobject *hypervisor_kobj; 192extern struct kobject *hypervisor_kobj;
192/* The global /sys/power/ kobject for people to chain off of */ 193/* The global /sys/power/ kobject for people to chain off of */
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 1036631ff4f..0be7795655f 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -157,11 +157,10 @@ struct kretprobe {
157 int nmissed; 157 int nmissed;
158 size_t data_size; 158 size_t data_size;
159 struct hlist_head free_instances; 159 struct hlist_head free_instances;
160 struct hlist_head used_instances; 160 spinlock_t lock;
161}; 161};
162 162
163struct kretprobe_instance { 163struct kretprobe_instance {
164 struct hlist_node uflist; /* either on free list or used list */
165 struct hlist_node hlist; 164 struct hlist_node hlist;
166 struct kretprobe *rp; 165 struct kretprobe *rp;
167 kprobe_opcode_t *ret_addr; 166 kprobe_opcode_t *ret_addr;
@@ -201,7 +200,6 @@ static inline int init_test_probes(void)
201} 200}
202#endif /* CONFIG_KPROBES_SANITY_TEST */ 201#endif /* CONFIG_KPROBES_SANITY_TEST */
203 202
204extern spinlock_t kretprobe_lock;
205extern struct mutex kprobe_mutex; 203extern struct mutex kprobe_mutex;
206extern int arch_prepare_kprobe(struct kprobe *p); 204extern int arch_prepare_kprobe(struct kprobe *p);
207extern void arch_arm_kprobe(struct kprobe *p); 205extern void arch_arm_kprobe(struct kprobe *p);
@@ -214,6 +212,9 @@ extern void kprobes_inc_nmissed_count(struct kprobe *p);
214 212
215/* Get the kprobe at this addr (if any) - called with preemption disabled */ 213/* Get the kprobe at this addr (if any) - called with preemption disabled */
216struct kprobe *get_kprobe(void *addr); 214struct kprobe *get_kprobe(void *addr);
215void kretprobe_hash_lock(struct task_struct *tsk,
216 struct hlist_head **head, unsigned long *flags);
217void kretprobe_hash_unlock(struct task_struct *tsk, unsigned long *flags);
217struct hlist_head * kretprobe_inst_table_head(struct task_struct *tsk); 218struct hlist_head * kretprobe_inst_table_head(struct task_struct *tsk);
218 219
219/* kprobe_running() will just return the current_kprobe on this CPU */ 220/* kprobe_running() will just return the current_kprobe on this CPU */
@@ -259,6 +260,10 @@ void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head);
259struct jprobe; 260struct jprobe;
260struct kretprobe; 261struct kretprobe;
261 262
263static inline struct kprobe *get_kprobe(void *addr)
264{
265 return NULL;
266}
262static inline struct kprobe *kprobe_running(void) 267static inline struct kprobe *kprobe_running(void)
263{ 268{
264 return NULL; 269 return NULL;
diff --git a/include/linux/ks0108.h b/include/linux/ks0108.h
index a2c54acceb4..cb311798e0b 100644
--- a/include/linux/ks0108.h
+++ b/include/linux/ks0108.h
@@ -4,7 +4,7 @@
4 * Description: ks0108 LCD Controller driver header 4 * Description: ks0108 LCD Controller driver header
5 * License: GPLv2 5 * License: GPLv2
6 * 6 *
7 * Author: Copyright (C) Miguel Ojeda Sandonis <maxextreme@gmail.com> 7 * Author: Copyright (C) Miguel Ojeda Sandonis
8 * Date: 2006-10-31 8 * Date: 2006-10-31
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
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 00dd957e245..aabc8a13ba7 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -6,7 +6,8 @@
6 6
7struct task_struct *kthread_create(int (*threadfn)(void *data), 7struct task_struct *kthread_create(int (*threadfn)(void *data),
8 void *data, 8 void *data,
9 const char namefmt[], ...); 9 const char namefmt[], ...)
10 __attribute__((format(printf, 3, 4)));
10 11
11/** 12/**
12 * kthread_run - create and wake a thread. 13 * kthread_run - create and wake a thread.
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index a281afeddfb..0ea064cbfbc 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -173,6 +173,30 @@ struct kvm_run {
173 }; 173 };
174}; 174};
175 175
176/* for KVM_REGISTER_COALESCED_MMIO / KVM_UNREGISTER_COALESCED_MMIO */
177
178struct kvm_coalesced_mmio_zone {
179 __u64 addr;
180 __u32 size;
181 __u32 pad;
182};
183
184struct kvm_coalesced_mmio {
185 __u64 phys_addr;
186 __u32 len;
187 __u32 pad;
188 __u8 data[8];
189};
190
191struct kvm_coalesced_mmio_ring {
192 __u32 first, last;
193 struct kvm_coalesced_mmio coalesced_mmio[0];
194};
195
196#define KVM_COALESCED_MMIO_MAX \
197 ((PAGE_SIZE - sizeof(struct kvm_coalesced_mmio_ring)) / \
198 sizeof(struct kvm_coalesced_mmio))
199
176/* for KVM_TRANSLATE */ 200/* for KVM_TRANSLATE */
177struct kvm_translation { 201struct kvm_translation {
178 /* in */ 202 /* in */
@@ -294,14 +318,14 @@ struct kvm_trace_rec {
294 __u32 vcpu_id; 318 __u32 vcpu_id;
295 union { 319 union {
296 struct { 320 struct {
297 __u32 cycle_lo, cycle_hi; 321 __u64 cycle_u64;
298 __u32 extra_u32[KVM_TRC_EXTRA_MAX]; 322 __u32 extra_u32[KVM_TRC_EXTRA_MAX];
299 } cycle; 323 } cycle;
300 struct { 324 struct {
301 __u32 extra_u32[KVM_TRC_EXTRA_MAX]; 325 __u32 extra_u32[KVM_TRC_EXTRA_MAX];
302 } nocycle; 326 } nocycle;
303 } u; 327 } u;
304}; 328} __attribute__((packed));
305 329
306#define KVMIO 0xAE 330#define KVMIO 0xAE
307 331
@@ -346,6 +370,7 @@ struct kvm_trace_rec {
346#define KVM_CAP_NOP_IO_DELAY 12 370#define KVM_CAP_NOP_IO_DELAY 12
347#define KVM_CAP_PV_MMU 13 371#define KVM_CAP_PV_MMU 13
348#define KVM_CAP_MP_STATE 14 372#define KVM_CAP_MP_STATE 14
373#define KVM_CAP_COALESCED_MMIO 15
349 374
350/* 375/*
351 * ioctls for VM fds 376 * ioctls for VM fds
@@ -371,6 +396,10 @@ struct kvm_trace_rec {
371#define KVM_CREATE_PIT _IO(KVMIO, 0x64) 396#define KVM_CREATE_PIT _IO(KVMIO, 0x64)
372#define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state) 397#define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state)
373#define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state) 398#define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state)
399#define KVM_REGISTER_COALESCED_MMIO \
400 _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone)
401#define KVM_UNREGISTER_COALESCED_MMIO \
402 _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone)
374 403
375/* 404/*
376 * ioctls for vcpu fds 405 * ioctls for vcpu fds
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 398978972b7..07d68a8ae8e 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -33,6 +33,7 @@
33#define KVM_REQ_REPORT_TPR_ACCESS 2 33#define KVM_REQ_REPORT_TPR_ACCESS 2
34#define KVM_REQ_MMU_RELOAD 3 34#define KVM_REQ_MMU_RELOAD 3
35#define KVM_REQ_TRIPLE_FAULT 4 35#define KVM_REQ_TRIPLE_FAULT 4
36#define KVM_REQ_PENDING_TIMER 5
36 37
37struct kvm_vcpu; 38struct kvm_vcpu;
38extern struct kmem_cache *kvm_vcpu_cache; 39extern struct kmem_cache *kvm_vcpu_cache;
@@ -51,7 +52,8 @@ struct kvm_io_bus {
51 52
52void kvm_io_bus_init(struct kvm_io_bus *bus); 53void kvm_io_bus_init(struct kvm_io_bus *bus);
53void kvm_io_bus_destroy(struct kvm_io_bus *bus); 54void kvm_io_bus_destroy(struct kvm_io_bus *bus);
54struct kvm_io_device *kvm_io_bus_find_dev(struct kvm_io_bus *bus, gpa_t addr); 55struct kvm_io_device *kvm_io_bus_find_dev(struct kvm_io_bus *bus,
56 gpa_t addr, int len, int is_write);
55void kvm_io_bus_register_dev(struct kvm_io_bus *bus, 57void kvm_io_bus_register_dev(struct kvm_io_bus *bus,
56 struct kvm_io_device *dev); 58 struct kvm_io_device *dev);
57 59
@@ -115,6 +117,10 @@ struct kvm {
115 struct kvm_vm_stat stat; 117 struct kvm_vm_stat stat;
116 struct kvm_arch arch; 118 struct kvm_arch arch;
117 atomic_t users_count; 119 atomic_t users_count;
120#ifdef KVM_COALESCED_MMIO_PAGE_OFFSET
121 struct kvm_coalesced_mmio_dev *coalesced_mmio_dev;
122 struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
123#endif
118}; 124};
119 125
120/* The guest did something we don't support. */ 126/* The guest did something we don't support. */
@@ -134,9 +140,6 @@ void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
134void vcpu_load(struct kvm_vcpu *vcpu); 140void vcpu_load(struct kvm_vcpu *vcpu);
135void vcpu_put(struct kvm_vcpu *vcpu); 141void vcpu_put(struct kvm_vcpu *vcpu);
136 142
137void decache_vcpus_on_cpu(int cpu);
138
139
140int kvm_init(void *opaque, unsigned int vcpu_size, 143int kvm_init(void *opaque, unsigned int vcpu_size,
141 struct module *module); 144 struct module *module);
142void kvm_exit(void); 145void kvm_exit(void);
@@ -165,6 +168,7 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
165 struct kvm_userspace_memory_region *mem, 168 struct kvm_userspace_memory_region *mem,
166 struct kvm_memory_slot old, 169 struct kvm_memory_slot old,
167 int user_alloc); 170 int user_alloc);
171void kvm_arch_flush_shadow(struct kvm *kvm);
168gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn); 172gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn);
169struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); 173struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
170unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); 174unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
@@ -297,7 +301,7 @@ static inline gpa_t gfn_to_gpa(gfn_t gfn)
297 return (gpa_t)gfn << PAGE_SHIFT; 301 return (gpa_t)gfn << PAGE_SHIFT;
298} 302}
299 303
300static inline void kvm_migrate_apic_timer(struct kvm_vcpu *vcpu) 304static inline void kvm_migrate_timers(struct kvm_vcpu *vcpu)
301{ 305{
302 set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests); 306 set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests);
303} 307}
diff --git a/include/linux/lcd.h b/include/linux/lcd.h
index 1d379787f2e..173febac665 100644
--- a/include/linux/lcd.h
+++ b/include/linux/lcd.h
@@ -47,7 +47,7 @@ struct lcd_ops {
47 int (*set_contrast)(struct lcd_device *, int contrast); 47 int (*set_contrast)(struct lcd_device *, int contrast);
48 /* Check if given framebuffer device is the one LCD is bound to; 48 /* Check if given framebuffer device is the one LCD is bound to;
49 return 0 if not, !=0 if it is. If NULL, lcd always matches the fb. */ 49 return 0 if not, !=0 if it is. If NULL, lcd always matches the fb. */
50 int (*check_fb)(struct fb_info *); 50 int (*check_fb)(struct lcd_device *, struct fb_info *);
51}; 51};
52 52
53struct lcd_device { 53struct lcd_device {
diff --git a/include/linux/leds-pca9532.h b/include/linux/leds-pca9532.h
new file mode 100644
index 00000000000..81b4207deb9
--- /dev/null
+++ b/include/linux/leds-pca9532.h
@@ -0,0 +1,45 @@
1/*
2 * pca9532.h - platform data structure for pca9532 led controller
3 *
4 * Copyright (C) 2008 Riku Voipio <riku.voipio@movial.fi>
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; version 2 of the License.
9 *
10 * Datasheet: http://www.nxp.com/acrobat/datasheets/PCA9532_3.pdf
11 *
12 */
13
14#ifndef __LINUX_PCA9532_H
15#define __LINUX_PCA9532_H
16
17#include <linux/leds.h>
18
19enum pca9532_state {
20 PCA9532_OFF = 0x0,
21 PCA9532_ON = 0x1,
22 PCA9532_PWM0 = 0x2,
23 PCA9532_PWM1 = 0x3
24};
25
26enum pca9532_type { PCA9532_TYPE_NONE, PCA9532_TYPE_LED,
27 PCA9532_TYPE_N2100_BEEP };
28
29struct pca9532_led {
30 u8 id;
31 struct i2c_client *client;
32 char *name;
33 struct led_classdev ldev;
34 enum pca9532_type type;
35 enum pca9532_state state;
36};
37
38struct pca9532_platform_data {
39 struct pca9532_led leds[16];
40 u8 pwm[2];
41 u8 psc[2];
42};
43
44#endif /* __LINUX_PCA9532_H */
45
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 519df72e939..d41ccb56146 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -48,7 +48,7 @@ struct led_classdev {
48 48
49 struct device *dev; 49 struct device *dev;
50 struct list_head node; /* LED Device list */ 50 struct list_head node; /* LED Device list */
51 char *default_trigger; /* Trigger to use */ 51 const char *default_trigger; /* Trigger to use */
52 52
53#ifdef CONFIG_LEDS_TRIGGERS 53#ifdef CONFIG_LEDS_TRIGGERS
54 /* Protects the trigger data below */ 54 /* Protects the trigger data below */
@@ -118,6 +118,20 @@ extern void ledtrig_ide_activity(void);
118#define ledtrig_ide_activity() do {} while(0) 118#define ledtrig_ide_activity() do {} while(0)
119#endif 119#endif
120 120
121/*
122 * Generic LED platform data for describing LED names and default triggers.
123 */
124struct led_info {
125 const char *name;
126 char *default_trigger;
127 int flags;
128};
129
130struct led_platform_data {
131 int num_leds;
132 struct led_info *leds;
133};
134
121/* For the leds-gpio driver */ 135/* For the leds-gpio driver */
122struct gpio_led { 136struct gpio_led {
123 const char *name; 137 const char *name;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index d1dfe872ee3..5b247b8a6b3 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -27,6 +27,7 @@
27#define __LINUX_LIBATA_H__ 27#define __LINUX_LIBATA_H__
28 28
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/jiffies.h>
30#include <linux/interrupt.h> 31#include <linux/interrupt.h>
31#include <linux/dma-mapping.h> 32#include <linux/dma-mapping.h>
32#include <linux/scatterlist.h> 33#include <linux/scatterlist.h>
@@ -111,14 +112,11 @@ enum {
111 /* various global constants */ 112 /* various global constants */
112 LIBATA_MAX_PRD = ATA_MAX_PRD / 2, 113 LIBATA_MAX_PRD = ATA_MAX_PRD / 2,
113 LIBATA_DUMB_MAX_PRD = ATA_MAX_PRD / 4, /* Worst case */ 114 LIBATA_DUMB_MAX_PRD = ATA_MAX_PRD / 4, /* Worst case */
114 ATA_MAX_PORTS = 8,
115 ATA_DEF_QUEUE = 1, 115 ATA_DEF_QUEUE = 1,
116 /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ 116 /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */
117 ATA_MAX_QUEUE = 32, 117 ATA_MAX_QUEUE = 32,
118 ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, 118 ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1,
119 ATA_MAX_BUS = 2, 119 ATA_SHORT_PAUSE = 16,
120 ATA_DEF_BUSY_WAIT = 10000,
121 ATA_SHORT_PAUSE = (HZ >> 6) + 1,
122 120
123 ATAPI_MAX_DRAIN = 16 << 10, 121 ATAPI_MAX_DRAIN = 16 << 10,
124 122
@@ -171,6 +169,7 @@ enum {
171 ATA_LFLAG_ASSUME_CLASS = ATA_LFLAG_ASSUME_ATA | ATA_LFLAG_ASSUME_SEMB, 169 ATA_LFLAG_ASSUME_CLASS = ATA_LFLAG_ASSUME_ATA | ATA_LFLAG_ASSUME_SEMB,
172 ATA_LFLAG_NO_RETRY = (1 << 5), /* don't retry this link */ 170 ATA_LFLAG_NO_RETRY = (1 << 5), /* don't retry this link */
173 ATA_LFLAG_DISABLED = (1 << 6), /* link is disabled */ 171 ATA_LFLAG_DISABLED = (1 << 6), /* link is disabled */
172 ATA_LFLAG_SW_ACTIVITY = (1 << 7), /* keep activity stats */
174 173
175 /* struct ata_port flags */ 174 /* struct ata_port flags */
176 ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ 175 ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */
@@ -193,6 +192,10 @@ enum {
193 ATA_FLAG_AN = (1 << 18), /* controller supports AN */ 192 ATA_FLAG_AN = (1 << 18), /* controller supports AN */
194 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ 193 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */
195 ATA_FLAG_IPM = (1 << 20), /* driver can handle IPM */ 194 ATA_FLAG_IPM = (1 << 20), /* driver can handle IPM */
195 ATA_FLAG_EM = (1 << 21), /* driver supports enclosure
196 * management */
197 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity
198 * led */
196 199
197 /* The following flag belongs to ap->pflags but is kept in 200 /* The following flag belongs to ap->pflags but is kept in
198 * ap->flags because it's referenced in many LLDs and will be 201 * ap->flags because it's referenced in many LLDs and will be
@@ -237,17 +240,16 @@ enum {
237 /* bits 24:31 of host->flags are reserved for LLD specific flags */ 240 /* bits 24:31 of host->flags are reserved for LLD specific flags */
238 241
239 /* various lengths of time */ 242 /* various lengths of time */
240 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ 243 ATA_TMOUT_BOOT = 30000, /* heuristic */
241 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ 244 ATA_TMOUT_BOOT_QUICK = 7000, /* heuristic */
242 ATA_TMOUT_INTERNAL = 30 * HZ, 245 ATA_TMOUT_INTERNAL_QUICK = 5000,
243 ATA_TMOUT_INTERNAL_QUICK = 5 * HZ,
244 246
245 /* FIXME: GoVault needs 2s but we can't afford that without 247 /* FIXME: GoVault needs 2s but we can't afford that without
246 * parallel probing. 800ms is enough for iVDR disk 248 * parallel probing. 800ms is enough for iVDR disk
247 * HHD424020F7SV00. Increase to 2secs when parallel probing 249 * HHD424020F7SV00. Increase to 2secs when parallel probing
248 * is in place. 250 * is in place.
249 */ 251 */
250 ATA_TMOUT_FF_WAIT = 4 * HZ / 5, 252 ATA_TMOUT_FF_WAIT = 800,
251 253
252 /* Spec mandates to wait for ">= 2ms" before checking status 254 /* Spec mandates to wait for ">= 2ms" before checking status
253 * after reset. We wait 150ms, because that was the magic 255 * after reset. We wait 150ms, because that was the magic
@@ -259,14 +261,14 @@ enum {
259 * 261 *
260 * Old drivers/ide uses the 2mS rule and then waits for ready. 262 * Old drivers/ide uses the 2mS rule and then waits for ready.
261 */ 263 */
262 ATA_WAIT_AFTER_RESET_MSECS = 150, 264 ATA_WAIT_AFTER_RESET = 150,
263 265
264 /* If PMP is supported, we have to do follow-up SRST. As some 266 /* If PMP is supported, we have to do follow-up SRST. As some
265 * PMPs don't send D2H Reg FIS after hardreset, LLDs are 267 * PMPs don't send D2H Reg FIS after hardreset, LLDs are
266 * advised to wait only for the following duration before 268 * advised to wait only for the following duration before
267 * doing SRST. 269 * doing SRST.
268 */ 270 */
269 ATA_TMOUT_PMP_SRST_WAIT = 1 * HZ, 271 ATA_TMOUT_PMP_SRST_WAIT = 1000,
270 272
271 /* ATA bus states */ 273 /* ATA bus states */
272 BUS_UNKNOWN = 0, 274 BUS_UNKNOWN = 0,
@@ -341,7 +343,12 @@ enum {
341 ATA_EH_PMP_TRIES = 5, 343 ATA_EH_PMP_TRIES = 5,
342 ATA_EH_PMP_LINK_TRIES = 3, 344 ATA_EH_PMP_LINK_TRIES = 3,
343 345
344 SATA_PMP_SCR_TIMEOUT = 250, 346 SATA_PMP_RW_TIMEOUT = 3000, /* PMP read/write timeout */
347
348 /* This should match the actual table size of
349 * ata_eh_cmd_timeout_table in libata-eh.c.
350 */
351 ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 5,
345 352
346 /* Horkage types. May be set by libata or controller on drives 353 /* Horkage types. May be set by libata or controller on drives
347 (some horkage may be drive/controller pair dependant */ 354 (some horkage may be drive/controller pair dependant */
@@ -351,7 +358,7 @@ enum {
351 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */ 358 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */
352 ATA_HORKAGE_MAX_SEC_128 = (1 << 3), /* Limit max sects to 128 */ 359 ATA_HORKAGE_MAX_SEC_128 = (1 << 3), /* Limit max sects to 128 */
353 ATA_HORKAGE_BROKEN_HPA = (1 << 4), /* Broken HPA */ 360 ATA_HORKAGE_BROKEN_HPA = (1 << 4), /* Broken HPA */
354 ATA_HORKAGE_SKIP_PM = (1 << 5), /* Skip PM operations */ 361 ATA_HORKAGE_DISABLE = (1 << 5), /* Disable it */
355 ATA_HORKAGE_HPA_SIZE = (1 << 6), /* native size off by one */ 362 ATA_HORKAGE_HPA_SIZE = (1 << 6), /* native size off by one */
356 ATA_HORKAGE_IPM = (1 << 7), /* Link PM problems */ 363 ATA_HORKAGE_IPM = (1 << 7), /* Link PM problems */
357 ATA_HORKAGE_IVB = (1 << 8), /* cbl det validity bit bugs */ 364 ATA_HORKAGE_IVB = (1 << 8), /* cbl det validity bit bugs */
@@ -444,6 +451,15 @@ enum link_pm {
444 MEDIUM_POWER, 451 MEDIUM_POWER,
445}; 452};
446extern struct device_attribute dev_attr_link_power_management_policy; 453extern struct device_attribute dev_attr_link_power_management_policy;
454extern struct device_attribute dev_attr_em_message_type;
455extern struct device_attribute dev_attr_em_message;
456extern struct device_attribute dev_attr_sw_activity;
457
458enum sw_activity {
459 OFF,
460 BLINK_ON,
461 BLINK_OFF,
462};
447 463
448#ifdef CONFIG_ATA_SFF 464#ifdef CONFIG_ATA_SFF
449struct ata_ioports { 465struct ata_ioports {
@@ -600,10 +616,14 @@ struct ata_eh_info {
600struct ata_eh_context { 616struct ata_eh_context {
601 struct ata_eh_info i; 617 struct ata_eh_info i;
602 int tries[ATA_MAX_DEVICES]; 618 int tries[ATA_MAX_DEVICES];
619 int cmd_timeout_idx[ATA_MAX_DEVICES]
620 [ATA_EH_CMD_TIMEOUT_TABLE_SIZE];
603 unsigned int classes[ATA_MAX_DEVICES]; 621 unsigned int classes[ATA_MAX_DEVICES];
604 unsigned int did_probe_mask; 622 unsigned int did_probe_mask;
605 unsigned int saved_ncq_enabled; 623 unsigned int saved_ncq_enabled;
606 u8 saved_xfer_mode[ATA_MAX_DEVICES]; 624 u8 saved_xfer_mode[ATA_MAX_DEVICES];
625 /* timestamp for the last reset attempt or success */
626 unsigned long last_reset;
607}; 627};
608 628
609struct ata_acpi_drive 629struct ata_acpi_drive
@@ -695,6 +715,7 @@ struct ata_port {
695 struct timer_list fastdrain_timer; 715 struct timer_list fastdrain_timer;
696 unsigned long fastdrain_cnt; 716 unsigned long fastdrain_cnt;
697 717
718 int em_message_type;
698 void *private_data; 719 void *private_data;
699 720
700#ifdef CONFIG_ATA_ACPI 721#ifdef CONFIG_ATA_ACPI
@@ -786,6 +807,12 @@ struct ata_port_operations {
786 u8 (*bmdma_status)(struct ata_port *ap); 807 u8 (*bmdma_status)(struct ata_port *ap);
787#endif /* CONFIG_ATA_SFF */ 808#endif /* CONFIG_ATA_SFF */
788 809
810 ssize_t (*em_show)(struct ata_port *ap, char *buf);
811 ssize_t (*em_store)(struct ata_port *ap, const char *message,
812 size_t size);
813 ssize_t (*sw_activity_show)(struct ata_device *dev, char *buf);
814 ssize_t (*sw_activity_store)(struct ata_device *dev,
815 enum sw_activity val);
789 /* 816 /*
790 * Obsolete 817 * Obsolete
791 */ 818 */
@@ -821,8 +848,6 @@ struct ata_timing {
821 unsigned short udma; /* t2CYCTYP/2 */ 848 unsigned short udma; /* t2CYCTYP/2 */
822}; 849};
823 850
824#define FIT(v, vmin, vmax) max_t(short, min_t(short, v, vmax), vmin)
825
826/* 851/*
827 * Core layer - drivers/ata/libata-core.c 852 * Core layer - drivers/ata/libata-core.c
828 */ 853 */
@@ -900,8 +925,7 @@ extern void ata_host_resume(struct ata_host *host);
900#endif 925#endif
901extern int ata_ratelimit(void); 926extern int ata_ratelimit(void);
902extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, 927extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
903 unsigned long interval_msec, 928 unsigned long interval, unsigned long timeout);
904 unsigned long timeout_msec);
905extern int atapi_cmd_type(u8 opcode); 929extern int atapi_cmd_type(u8 opcode);
906extern void ata_tf_to_fis(const struct ata_taskfile *tf, 930extern void ata_tf_to_fis(const struct ata_taskfile *tf,
907 u8 pmp, int is_cmd, u8 *fis); 931 u8 pmp, int is_cmd, u8 *fis);
@@ -1039,6 +1063,7 @@ extern void ata_eh_thaw_port(struct ata_port *ap);
1039 1063
1040extern void ata_eh_qc_complete(struct ata_queued_cmd *qc); 1064extern void ata_eh_qc_complete(struct ata_queued_cmd *qc);
1041extern void ata_eh_qc_retry(struct ata_queued_cmd *qc); 1065extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);
1066extern void ata_eh_analyze_ncq_error(struct ata_link *link);
1042 1067
1043extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, 1068extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
1044 ata_reset_fn_t softreset, ata_reset_fn_t hardreset, 1069 ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
@@ -1381,6 +1406,24 @@ static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host)
1381 return *(struct ata_port **)&host->hostdata[0]; 1406 return *(struct ata_port **)&host->hostdata[0];
1382} 1407}
1383 1408
1409static inline int ata_check_ready(u8 status)
1410{
1411 if (!(status & ATA_BUSY))
1412 return 1;
1413
1414 /* 0xff indicates either no device or device not ready */
1415 if (status == 0xff)
1416 return -ENODEV;
1417
1418 return 0;
1419}
1420
1421static inline unsigned long ata_deadline(unsigned long from_jiffies,
1422 unsigned long timeout_msecs)
1423{
1424 return from_jiffies + msecs_to_jiffies(timeout_msecs);
1425}
1426
1384 1427
1385/************************************************************************** 1428/**************************************************************************
1386 * PMP - drivers/ata/libata-pmp.c 1429 * PMP - drivers/ata/libata-pmp.c
@@ -1424,7 +1467,8 @@ extern void ata_sff_qc_prep(struct ata_queued_cmd *qc);
1424extern void ata_sff_dumb_qc_prep(struct ata_queued_cmd *qc); 1467extern void ata_sff_dumb_qc_prep(struct ata_queued_cmd *qc);
1425extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device); 1468extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device);
1426extern u8 ata_sff_check_status(struct ata_port *ap); 1469extern u8 ata_sff_check_status(struct ata_port *ap);
1427extern u8 ata_sff_altstatus(struct ata_port *ap); 1470extern void ata_sff_pause(struct ata_port *ap);
1471extern void ata_sff_dma_pause(struct ata_port *ap);
1428extern int ata_sff_busy_sleep(struct ata_port *ap, 1472extern int ata_sff_busy_sleep(struct ata_port *ap,
1429 unsigned long timeout_pat, unsigned long timeout); 1473 unsigned long timeout_pat, unsigned long timeout);
1430extern int ata_sff_wait_ready(struct ata_link *link, unsigned long deadline); 1474extern int ata_sff_wait_ready(struct ata_link *link, unsigned long deadline);
@@ -1485,19 +1529,6 @@ extern int ata_pci_sff_init_one(struct pci_dev *pdev,
1485#endif /* CONFIG_PCI */ 1529#endif /* CONFIG_PCI */
1486 1530
1487/** 1531/**
1488 * ata_sff_pause - Flush writes and pause 400 nanoseconds.
1489 * @ap: Port to wait for.
1490 *
1491 * LOCKING:
1492 * Inherited from caller.
1493 */
1494static inline void ata_sff_pause(struct ata_port *ap)
1495{
1496 ata_sff_altstatus(ap);
1497 ndelay(400);
1498}
1499
1500/**
1501 * ata_sff_busy_wait - Wait for a port status register 1532 * ata_sff_busy_wait - Wait for a port status register
1502 * @ap: Port to wait for. 1533 * @ap: Port to wait for.
1503 * @bits: bits that must be clear 1534 * @bits: bits that must be clear
diff --git a/include/linux/libps2.h b/include/linux/libps2.h
index f6f301e2b0f..afc41336910 100644
--- a/include/linux/libps2.h
+++ b/include/linux/libps2.h
@@ -43,7 +43,6 @@ void ps2_init(struct ps2dev *ps2dev, struct serio *serio);
43int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout); 43int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout);
44void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout); 44void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout);
45int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command); 45int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command);
46int ps2_schedule_command(struct ps2dev *ps2dev, unsigned char *param, int command);
47int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data); 46int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data);
48int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data); 47int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data);
49void ps2_cmd_aborted(struct ps2dev *ps2dev); 48void ps2_cmd_aborted(struct ps2dev *ps2dev);
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 2119610b24f..56ba3739465 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -1,8 +1,11 @@
1#ifndef _LINUX_LINKAGE_H 1#ifndef _LINUX_LINKAGE_H
2#define _LINUX_LINKAGE_H 2#define _LINUX_LINKAGE_H
3 3
4#include <linux/compiler.h>
4#include <asm/linkage.h> 5#include <asm/linkage.h>
5 6
7#define notrace __attribute__((no_instrument_function))
8
6#ifdef __cplusplus 9#ifdef __cplusplus
7#define CPP_ASMLINKAGE extern "C" 10#define CPP_ASMLINKAGE extern "C"
8#else 11#else
@@ -17,6 +20,9 @@
17# define asmregparm 20# define asmregparm
18#endif 21#endif
19 22
23#define __page_aligned_data __section(.data.page_aligned) __aligned(PAGE_SIZE)
24#define __page_aligned_bss __section(.bss.page_aligned) __aligned(PAGE_SIZE)
25
20/* 26/*
21 * This is used by architectures to keep arguments on the stack 27 * This is used by architectures to keep arguments on the stack
22 * untouched by the compiler by keeping them live until the end. 28 * untouched by the compiler by keeping them live until the end.
diff --git a/include/linux/list.h b/include/linux/list.h
index 08cf4f65188..453916bc041 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -61,14 +61,10 @@ extern void __list_add(struct list_head *new,
61 * Insert a new entry after the specified head. 61 * Insert a new entry after the specified head.
62 * This is good for implementing stacks. 62 * This is good for implementing stacks.
63 */ 63 */
64#ifndef CONFIG_DEBUG_LIST
65static inline void list_add(struct list_head *new, struct list_head *head) 64static inline void list_add(struct list_head *new, struct list_head *head)
66{ 65{
67 __list_add(new, head, head->next); 66 __list_add(new, head, head->next);
68} 67}
69#else
70extern void list_add(struct list_head *new, struct list_head *head);
71#endif
72 68
73 69
74/** 70/**
@@ -85,65 +81,6 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head)
85} 81}
86 82
87/* 83/*
88 * Insert a new entry between two known consecutive entries.
89 *
90 * This is only for internal list manipulation where we know
91 * the prev/next entries already!
92 */
93static inline void __list_add_rcu(struct list_head * new,
94 struct list_head * prev, struct list_head * next)
95{
96 new->next = next;
97 new->prev = prev;
98 smp_wmb();
99 next->prev = new;
100 prev->next = new;
101}
102
103/**
104 * list_add_rcu - add a new entry to rcu-protected list
105 * @new: new entry to be added
106 * @head: list head to add it after
107 *
108 * Insert a new entry after the specified head.
109 * This is good for implementing stacks.
110 *
111 * The caller must take whatever precautions are necessary
112 * (such as holding appropriate locks) to avoid racing
113 * with another list-mutation primitive, such as list_add_rcu()
114 * or list_del_rcu(), running on this same list.
115 * However, it is perfectly legal to run concurrently with
116 * the _rcu list-traversal primitives, such as
117 * list_for_each_entry_rcu().
118 */
119static inline void list_add_rcu(struct list_head *new, struct list_head *head)
120{
121 __list_add_rcu(new, head, head->next);
122}
123
124/**
125 * list_add_tail_rcu - add a new entry to rcu-protected list
126 * @new: new entry to be added
127 * @head: list head to add it before
128 *
129 * Insert a new entry before the specified head.
130 * This is useful for implementing queues.
131 *
132 * The caller must take whatever precautions are necessary
133 * (such as holding appropriate locks) to avoid racing
134 * with another list-mutation primitive, such as list_add_tail_rcu()
135 * or list_del_rcu(), running on this same list.
136 * However, it is perfectly legal to run concurrently with
137 * the _rcu list-traversal primitives, such as
138 * list_for_each_entry_rcu().
139 */
140static inline void list_add_tail_rcu(struct list_head *new,
141 struct list_head *head)
142{
143 __list_add_rcu(new, head->prev, head);
144}
145
146/*
147 * Delete a list entry by making the prev/next entries 84 * Delete a list entry by making the prev/next entries
148 * point to each other. 85 * point to each other.
149 * 86 *
@@ -174,36 +111,6 @@ extern void list_del(struct list_head *entry);
174#endif 111#endif
175 112
176/** 113/**
177 * list_del_rcu - deletes entry from list without re-initialization
178 * @entry: the element to delete from the list.
179 *
180 * Note: list_empty() on entry does not return true after this,
181 * the entry is in an undefined state. It is useful for RCU based
182 * lockfree traversal.
183 *
184 * In particular, it means that we can not poison the forward
185 * pointers that may still be used for walking the list.
186 *
187 * The caller must take whatever precautions are necessary
188 * (such as holding appropriate locks) to avoid racing
189 * with another list-mutation primitive, such as list_del_rcu()
190 * or list_add_rcu(), running on this same list.
191 * However, it is perfectly legal to run concurrently with
192 * the _rcu list-traversal primitives, such as
193 * list_for_each_entry_rcu().
194 *
195 * Note that the caller is not permitted to immediately free
196 * the newly deleted entry. Instead, either synchronize_rcu()
197 * or call_rcu() must be used to defer freeing until an RCU
198 * grace period has elapsed.
199 */
200static inline void list_del_rcu(struct list_head *entry)
201{
202 __list_del(entry->prev, entry->next);
203 entry->prev = LIST_POISON2;
204}
205
206/**
207 * list_replace - replace old entry by new one 114 * list_replace - replace old entry by new one
208 * @old : the element to be replaced 115 * @old : the element to be replaced
209 * @new : the new element to insert 116 * @new : the new element to insert
@@ -227,25 +134,6 @@ static inline void list_replace_init(struct list_head *old,
227} 134}
228 135
229/** 136/**
230 * list_replace_rcu - replace old entry by new one
231 * @old : the element to be replaced
232 * @new : the new element to insert
233 *
234 * The @old entry will be replaced with the @new entry atomically.
235 * Note: @old should not be empty.
236 */
237static inline void list_replace_rcu(struct list_head *old,
238 struct list_head *new)
239{
240 new->next = old->next;
241 new->prev = old->prev;
242 smp_wmb();
243 new->next->prev = new;
244 new->prev->next = new;
245 old->prev = LIST_POISON2;
246}
247
248/**
249 * list_del_init - deletes entry from list and reinitialize it. 137 * list_del_init - deletes entry from list and reinitialize it.
250 * @entry: the element to delete from the list. 138 * @entry: the element to delete from the list.
251 */ 139 */
@@ -369,62 +257,6 @@ static inline void list_splice_init(struct list_head *list,
369} 257}
370 258
371/** 259/**
372 * list_splice_init_rcu - splice an RCU-protected list into an existing list.
373 * @list: the RCU-protected list to splice
374 * @head: the place in the list to splice the first list into
375 * @sync: function to sync: synchronize_rcu(), synchronize_sched(), ...
376 *
377 * @head can be RCU-read traversed concurrently with this function.
378 *
379 * Note that this function blocks.
380 *
381 * Important note: the caller must take whatever action is necessary to
382 * prevent any other updates to @head. In principle, it is possible
383 * to modify the list as soon as sync() begins execution.
384 * If this sort of thing becomes necessary, an alternative version
385 * based on call_rcu() could be created. But only if -really-
386 * needed -- there is no shortage of RCU API members.
387 */
388static inline void list_splice_init_rcu(struct list_head *list,
389 struct list_head *head,
390 void (*sync)(void))
391{
392 struct list_head *first = list->next;
393 struct list_head *last = list->prev;
394 struct list_head *at = head->next;
395
396 if (list_empty(head))
397 return;
398
399 /* "first" and "last" tracking list, so initialize it. */
400
401 INIT_LIST_HEAD(list);
402
403 /*
404 * At this point, the list body still points to the source list.
405 * Wait for any readers to finish using the list before splicing
406 * the list body into the new list. Any new readers will see
407 * an empty list.
408 */
409
410 sync();
411
412 /*
413 * Readers are finished with the source list, so perform splice.
414 * The order is important if the new list is global and accessible
415 * to concurrent RCU readers. Note that RCU readers are not
416 * permitted to traverse the prev pointers without excluding
417 * this function.
418 */
419
420 last->next = at;
421 smp_wmb();
422 head->next = first;
423 first->prev = head;
424 at->prev = last;
425}
426
427/**
428 * list_entry - get the struct for this entry 260 * list_entry - get the struct for this entry
429 * @ptr: the &struct list_head pointer. 261 * @ptr: the &struct list_head pointer.
430 * @type: the type of the struct this is embedded in. 262 * @type: the type of the struct this is embedded in.
@@ -629,57 +461,6 @@ static inline void list_splice_init_rcu(struct list_head *list,
629 &pos->member != (head); \ 461 &pos->member != (head); \
630 pos = n, n = list_entry(n->member.prev, typeof(*n), member)) 462 pos = n, n = list_entry(n->member.prev, typeof(*n), member))
631 463
632/**
633 * list_for_each_rcu - iterate over an rcu-protected list
634 * @pos: the &struct list_head to use as a loop cursor.
635 * @head: the head for your list.
636 *
637 * This list-traversal primitive may safely run concurrently with
638 * the _rcu list-mutation primitives such as list_add_rcu()
639 * as long as the traversal is guarded by rcu_read_lock().
640 */
641#define list_for_each_rcu(pos, head) \
642 for (pos = rcu_dereference((head)->next); \
643 prefetch(pos->next), pos != (head); \
644 pos = rcu_dereference(pos->next))
645
646#define __list_for_each_rcu(pos, head) \
647 for (pos = rcu_dereference((head)->next); \
648 pos != (head); \
649 pos = rcu_dereference(pos->next))
650
651/**
652 * list_for_each_entry_rcu - iterate over rcu list of given type
653 * @pos: the type * to use as a loop cursor.
654 * @head: the head for your list.
655 * @member: the name of the list_struct within the struct.
656 *
657 * This list-traversal primitive may safely run concurrently with
658 * the _rcu list-mutation primitives such as list_add_rcu()
659 * as long as the traversal is guarded by rcu_read_lock().
660 */
661#define list_for_each_entry_rcu(pos, head, member) \
662 for (pos = list_entry(rcu_dereference((head)->next), typeof(*pos), member); \
663 prefetch(pos->member.next), &pos->member != (head); \
664 pos = list_entry(rcu_dereference(pos->member.next), typeof(*pos), member))
665
666
667/**
668 * list_for_each_continue_rcu
669 * @pos: the &struct list_head to use as a loop cursor.
670 * @head: the head for your list.
671 *
672 * Iterate over an rcu-protected list, continuing after current point.
673 *
674 * This list-traversal primitive may safely run concurrently with
675 * the _rcu list-mutation primitives such as list_add_rcu()
676 * as long as the traversal is guarded by rcu_read_lock().
677 */
678#define list_for_each_continue_rcu(pos, head) \
679 for ((pos) = rcu_dereference((pos)->next); \
680 prefetch((pos)->next), (pos) != (head); \
681 (pos) = rcu_dereference((pos)->next))
682
683/* 464/*
684 * Double linked lists with a single pointer list head. 465 * Double linked lists with a single pointer list head.
685 * Mostly useful for hash tables where the two pointer list head is 466 * Mostly useful for hash tables where the two pointer list head is
@@ -730,31 +511,6 @@ static inline void hlist_del(struct hlist_node *n)
730 n->pprev = LIST_POISON2; 511 n->pprev = LIST_POISON2;
731} 512}
732 513
733/**
734 * hlist_del_rcu - deletes entry from hash list without re-initialization
735 * @n: the element to delete from the hash list.
736 *
737 * Note: list_unhashed() on entry does not return true after this,
738 * the entry is in an undefined state. It is useful for RCU based
739 * lockfree traversal.
740 *
741 * In particular, it means that we can not poison the forward
742 * pointers that may still be used for walking the hash list.
743 *
744 * The caller must take whatever precautions are necessary
745 * (such as holding appropriate locks) to avoid racing
746 * with another list-mutation primitive, such as hlist_add_head_rcu()
747 * or hlist_del_rcu(), running on this same list.
748 * However, it is perfectly legal to run concurrently with
749 * the _rcu list-traversal primitives, such as
750 * hlist_for_each_entry().
751 */
752static inline void hlist_del_rcu(struct hlist_node *n)
753{
754 __hlist_del(n);
755 n->pprev = LIST_POISON2;
756}
757
758static inline void hlist_del_init(struct hlist_node *n) 514static inline void hlist_del_init(struct hlist_node *n)
759{ 515{
760 if (!hlist_unhashed(n)) { 516 if (!hlist_unhashed(n)) {
@@ -763,27 +519,6 @@ static inline void hlist_del_init(struct hlist_node *n)
763 } 519 }
764} 520}
765 521
766/**
767 * hlist_replace_rcu - replace old entry by new one
768 * @old : the element to be replaced
769 * @new : the new element to insert
770 *
771 * The @old entry will be replaced with the @new entry atomically.
772 */
773static inline void hlist_replace_rcu(struct hlist_node *old,
774 struct hlist_node *new)
775{
776 struct hlist_node *next = old->next;
777
778 new->next = next;
779 new->pprev = old->pprev;
780 smp_wmb();
781 if (next)
782 new->next->pprev = &new->next;
783 *new->pprev = new;
784 old->pprev = LIST_POISON2;
785}
786
787static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) 522static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
788{ 523{
789 struct hlist_node *first = h->first; 524 struct hlist_node *first = h->first;
@@ -794,38 +529,6 @@ static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
794 n->pprev = &h->first; 529 n->pprev = &h->first;
795} 530}
796 531
797
798/**
799 * hlist_add_head_rcu
800 * @n: the element to add to the hash list.
801 * @h: the list to add to.
802 *
803 * Description:
804 * Adds the specified element to the specified hlist,
805 * while permitting racing traversals.
806 *
807 * The caller must take whatever precautions are necessary
808 * (such as holding appropriate locks) to avoid racing
809 * with another list-mutation primitive, such as hlist_add_head_rcu()
810 * or hlist_del_rcu(), running on this same list.
811 * However, it is perfectly legal to run concurrently with
812 * the _rcu list-traversal primitives, such as
813 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
814 * problems on Alpha CPUs. Regardless of the type of CPU, the
815 * list-traversal primitive must be guarded by rcu_read_lock().
816 */
817static inline void hlist_add_head_rcu(struct hlist_node *n,
818 struct hlist_head *h)
819{
820 struct hlist_node *first = h->first;
821 n->next = first;
822 n->pprev = &h->first;
823 smp_wmb();
824 if (first)
825 first->pprev = &n->next;
826 h->first = n;
827}
828
829/* next must be != NULL */ 532/* next must be != NULL */
830static inline void hlist_add_before(struct hlist_node *n, 533static inline void hlist_add_before(struct hlist_node *n,
831 struct hlist_node *next) 534 struct hlist_node *next)
@@ -847,63 +550,6 @@ static inline void hlist_add_after(struct hlist_node *n,
847 next->next->pprev = &next->next; 550 next->next->pprev = &next->next;
848} 551}
849 552
850/**
851 * hlist_add_before_rcu
852 * @n: the new element to add to the hash list.
853 * @next: the existing element to add the new element before.
854 *
855 * Description:
856 * Adds the specified element to the specified hlist
857 * before the specified node while permitting racing traversals.
858 *
859 * The caller must take whatever precautions are necessary
860 * (such as holding appropriate locks) to avoid racing
861 * with another list-mutation primitive, such as hlist_add_head_rcu()
862 * or hlist_del_rcu(), running on this same list.
863 * However, it is perfectly legal to run concurrently with
864 * the _rcu list-traversal primitives, such as
865 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
866 * problems on Alpha CPUs.
867 */
868static inline void hlist_add_before_rcu(struct hlist_node *n,
869 struct hlist_node *next)
870{
871 n->pprev = next->pprev;
872 n->next = next;
873 smp_wmb();
874 next->pprev = &n->next;
875 *(n->pprev) = n;
876}
877
878/**
879 * hlist_add_after_rcu
880 * @prev: the existing element to add the new element after.
881 * @n: the new element to add to the hash list.
882 *
883 * Description:
884 * Adds the specified element to the specified hlist
885 * after the specified node while permitting racing traversals.
886 *
887 * The caller must take whatever precautions are necessary
888 * (such as holding appropriate locks) to avoid racing
889 * with another list-mutation primitive, such as hlist_add_head_rcu()
890 * or hlist_del_rcu(), running on this same list.
891 * However, it is perfectly legal to run concurrently with
892 * the _rcu list-traversal primitives, such as
893 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
894 * problems on Alpha CPUs.
895 */
896static inline void hlist_add_after_rcu(struct hlist_node *prev,
897 struct hlist_node *n)
898{
899 n->next = prev->next;
900 n->pprev = &prev->next;
901 smp_wmb();
902 prev->next = n;
903 if (n->next)
904 n->next->pprev = &n->next;
905}
906
907#define hlist_entry(ptr, type, member) container_of(ptr,type,member) 553#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
908 554
909#define hlist_for_each(pos, head) \ 555#define hlist_for_each(pos, head) \
@@ -964,21 +610,4 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
964 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 610 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
965 pos = n) 611 pos = n)
966 612
967/**
968 * hlist_for_each_entry_rcu - iterate over rcu list of given type
969 * @tpos: the type * to use as a loop cursor.
970 * @pos: the &struct hlist_node to use as a loop cursor.
971 * @head: the head for your list.
972 * @member: the name of the hlist_node within the struct.
973 *
974 * This list-traversal primitive may safely run concurrently with
975 * the _rcu list-mutation primitives such as hlist_add_head_rcu()
976 * as long as the traversal is guarded by rcu_read_lock().
977 */
978#define hlist_for_each_entry_rcu(tpos, pos, head, member) \
979 for (pos = rcu_dereference((head)->first); \
980 pos && ({ prefetch(pos->next); 1;}) && \
981 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
982 pos = rcu_dereference(pos->next))
983
984#endif 613#endif
diff --git a/include/linux/lm_interface.h b/include/linux/lm_interface.h
index f274997bc28..2ed8fa1b762 100644
--- a/include/linux/lm_interface.h
+++ b/include/linux/lm_interface.h
@@ -122,11 +122,9 @@ typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data);
122 */ 122 */
123 123
124#define LM_OUT_ST_MASK 0x00000003 124#define LM_OUT_ST_MASK 0x00000003
125#define LM_OUT_CACHEABLE 0x00000004
126#define LM_OUT_CANCELED 0x00000008 125#define LM_OUT_CANCELED 0x00000008
127#define LM_OUT_ASYNC 0x00000080 126#define LM_OUT_ASYNC 0x00000080
128#define LM_OUT_ERROR 0x00000100 127#define LM_OUT_ERROR 0x00000100
129#define LM_OUT_CONV_DEADLK 0x00000200
130 128
131/* 129/*
132 * lm_callback_t types 130 * lm_callback_t types
@@ -138,9 +136,6 @@ typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data);
138 * LM_CB_NEED_RECOVERY 136 * LM_CB_NEED_RECOVERY
139 * The given journal needs to be recovered. 137 * The given journal needs to be recovered.
140 * 138 *
141 * LM_CB_DROPLOCKS
142 * Reduce the number of cached locks.
143 *
144 * LM_CB_ASYNC 139 * LM_CB_ASYNC
145 * The given lock has been granted. 140 * The given lock has been granted.
146 */ 141 */
@@ -149,7 +144,6 @@ typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data);
149#define LM_CB_NEED_D 258 144#define LM_CB_NEED_D 258
150#define LM_CB_NEED_S 259 145#define LM_CB_NEED_S 259
151#define LM_CB_NEED_RECOVERY 260 146#define LM_CB_NEED_RECOVERY 260
152#define LM_CB_DROPLOCKS 261
153#define LM_CB_ASYNC 262 147#define LM_CB_ASYNC 262
154 148
155/* 149/*
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 102d928f720..dbb87ab282e 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -200,10 +200,12 @@ typedef int (*nlm_host_match_fn_t)(void *cur, struct nlm_host *ref);
200 * Server-side lock handling 200 * Server-side lock handling
201 */ 201 */
202__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, 202__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
203 struct nlm_lock *, int, struct nlm_cookie *); 203 struct nlm_host *, struct nlm_lock *, int,
204 struct nlm_cookie *);
204__be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); 205__be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
205__be32 nlmsvc_testlock(struct svc_rqst *, struct nlm_file *, 206__be32 nlmsvc_testlock(struct svc_rqst *, struct nlm_file *,
206 struct nlm_lock *, struct nlm_lock *, struct nlm_cookie *); 207 struct nlm_host *, struct nlm_lock *,
208 struct nlm_lock *, struct nlm_cookie *);
207__be32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *); 209__be32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *);
208unsigned long nlmsvc_retry_blocked(void); 210unsigned long nlmsvc_retry_blocked(void);
209void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, 211void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *,
@@ -224,7 +226,7 @@ void nlmsvc_invalidate_all(void);
224 * Cluster failover support 226 * Cluster failover support
225 */ 227 */
226int nlmsvc_unlock_all_by_sb(struct super_block *sb); 228int nlmsvc_unlock_all_by_sb(struct super_block *sb);
227int nlmsvc_unlock_all_by_ip(__be32 server_addr); 229int nlmsvc_unlock_all_by_ip(struct sockaddr *server_addr);
228 230
229static inline struct inode *nlmsvc_file_inode(struct nlm_file *file) 231static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)
230{ 232{
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 4c4d236ded1..2486eb4edbf 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -182,6 +182,9 @@ struct lock_list {
182 * We record lock dependency chains, so that we can cache them: 182 * We record lock dependency chains, so that we can cache them:
183 */ 183 */
184struct lock_chain { 184struct lock_chain {
185 u8 irq_context;
186 u8 depth;
187 u16 base;
185 struct list_head entry; 188 struct list_head entry;
186 u64 chain_key; 189 u64 chain_key;
187}; 190};
@@ -276,14 +279,6 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name,
276 (lock)->dep_map.key, sub) 279 (lock)->dep_map.key, sub)
277 280
278/* 281/*
279 * To initialize a lockdep_map statically use this macro.
280 * Note that _name must not be NULL.
281 */
282#define STATIC_LOCKDEP_MAP_INIT(_name, _key) \
283 { .name = (_name), .key = (void *)(_key), }
284
285
286/*
287 * Acquire a lock. 282 * Acquire a lock.
288 * 283 *
289 * Values for "read": 284 * Values for "read":
diff --git a/include/linux/mISDNdsp.h b/include/linux/mISDNdsp.h
new file mode 100644
index 00000000000..6b71d2dce50
--- /dev/null
+++ b/include/linux/mISDNdsp.h
@@ -0,0 +1,37 @@
1#ifndef __mISDNdsp_H__
2#define __mISDNdsp_H__
3
4struct mISDN_dsp_element_arg {
5 char *name;
6 char *def;
7 char *desc;
8};
9
10struct mISDN_dsp_element {
11 char *name;
12 void *(*new)(const char *arg);
13 void (*free)(void *p);
14 void (*process_tx)(void *p, unsigned char *data, int len);
15 void (*process_rx)(void *p, unsigned char *data, int len);
16 int num_args;
17 struct mISDN_dsp_element_arg
18 *args;
19};
20
21extern int mISDN_dsp_element_register(struct mISDN_dsp_element *elem);
22extern void mISDN_dsp_element_unregister(struct mISDN_dsp_element *elem);
23
24struct dsp_features {
25 int hfc_id; /* unique id to identify the chip (or -1) */
26 int hfc_dtmf; /* set if HFCmulti card supports dtmf */
27 int hfc_loops; /* set if card supports tone loops */
28 int hfc_echocanhw; /* set if card supports echocancelation*/
29 int pcm_id; /* unique id to identify the pcm bus (or -1) */
30 int pcm_slots; /* number of slots on the pcm bus */
31 int pcm_banks; /* number of IO banks of pcm bus */
32 int unclocked; /* data is not clocked (has jitter/loss) */
33 int unordered; /* data is unordered (packets have index) */
34};
35
36#endif
37
diff --git a/include/linux/mISDNhw.h b/include/linux/mISDNhw.h
new file mode 100644
index 00000000000..e794dfb8750
--- /dev/null
+++ b/include/linux/mISDNhw.h
@@ -0,0 +1,193 @@
1/*
2 *
3 * Author Karsten Keil <kkeil@novell.com>
4 *
5 * Basic declarations for the mISDN HW channels
6 *
7 * Copyright 2008 by Karsten Keil <kkeil@novell.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 * 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 */
19
20#ifndef MISDNHW_H
21#define MISDNHW_H
22#include <linux/mISDNif.h>
23#include <linux/timer.h>
24
25/*
26 * HW DEBUG 0xHHHHGGGG
27 * H - hardware driver specific bits
28 * G - for all drivers
29 */
30
31#define DEBUG_HW 0x00000001
32#define DEBUG_HW_OPEN 0x00000002
33#define DEBUG_HW_DCHANNEL 0x00000100
34#define DEBUG_HW_DFIFO 0x00000200
35#define DEBUG_HW_BCHANNEL 0x00001000
36#define DEBUG_HW_BFIFO 0x00002000
37
38#define MAX_DFRAME_LEN_L1 300
39#define MAX_MON_FRAME 32
40#define MAX_LOG_SPACE 2048
41#define MISDN_COPY_SIZE 32
42
43/* channel->Flags bit field */
44#define FLG_TX_BUSY 0 /* tx_buf in use */
45#define FLG_TX_NEXT 1 /* next_skb in use */
46#define FLG_L1_BUSY 2 /* L1 is permanent busy */
47#define FLG_L2_ACTIVATED 3 /* activated from L2 */
48#define FLG_OPEN 5 /* channel is in use */
49#define FLG_ACTIVE 6 /* channel is activated */
50#define FLG_BUSY_TIMER 7
51/* channel type */
52#define FLG_DCHANNEL 8 /* channel is D-channel */
53#define FLG_BCHANNEL 9 /* channel is B-channel */
54#define FLG_ECHANNEL 10 /* channel is E-channel */
55#define FLG_TRANSPARENT 12 /* channel use transparent data */
56#define FLG_HDLC 13 /* channel use hdlc data */
57#define FLG_L2DATA 14 /* channel use L2 DATA primitivs */
58#define FLG_ORIGIN 15 /* channel is on origin site */
59/* channel specific stuff */
60/* arcofi specific */
61#define FLG_ARCOFI_TIMER 16
62#define FLG_ARCOFI_ERROR 17
63/* isar specific */
64#define FLG_INITIALIZED 16
65#define FLG_DLEETX 17
66#define FLG_LASTDLE 18
67#define FLG_FIRST 19
68#define FLG_LASTDATA 20
69#define FLG_NMD_DATA 21
70#define FLG_FTI_RUN 22
71#define FLG_LL_OK 23
72#define FLG_LL_CONN 24
73#define FLG_DTMFSEND 25
74
75/* workq events */
76#define FLG_RECVQUEUE 30
77#define FLG_PHCHANGE 31
78
79#define schedule_event(s, ev) do { \
80 test_and_set_bit(ev, &((s)->Flags)); \
81 schedule_work(&((s)->workq)); \
82 } while (0)
83
84struct dchannel {
85 struct mISDNdevice dev;
86 u_long Flags;
87 struct work_struct workq;
88 void (*phfunc) (struct dchannel *);
89 u_int state;
90 void *l1;
91 /* HW access */
92 u_char (*read_reg) (void *, u_char);
93 void (*write_reg) (void *, u_char, u_char);
94 void (*read_fifo) (void *, u_char *, int);
95 void (*write_fifo) (void *, u_char *, int);
96 void *hw;
97 int slot; /* multiport card channel slot */
98 struct timer_list timer;
99 /* receive data */
100 struct sk_buff *rx_skb;
101 int maxlen;
102 /* send data */
103 struct sk_buff_head squeue;
104 struct sk_buff_head rqueue;
105 struct sk_buff *tx_skb;
106 int tx_idx;
107 int debug;
108 /* statistics */
109 int err_crc;
110 int err_tx;
111 int err_rx;
112};
113
114typedef int (dchannel_l1callback)(struct dchannel *, u_int);
115extern int create_l1(struct dchannel *, dchannel_l1callback *);
116
117/* private L1 commands */
118#define INFO0 0x8002
119#define INFO1 0x8102
120#define INFO2 0x8202
121#define INFO3_P8 0x8302
122#define INFO3_P10 0x8402
123#define INFO4_P8 0x8502
124#define INFO4_P10 0x8602
125#define LOSTFRAMING 0x8702
126#define ANYSIGNAL 0x8802
127#define HW_POWERDOWN 0x8902
128#define HW_RESET_REQ 0x8a02
129#define HW_POWERUP_REQ 0x8b02
130#define HW_DEACT_REQ 0x8c02
131#define HW_ACTIVATE_REQ 0x8e02
132#define HW_D_NOBLOCKED 0x8f02
133#define HW_RESET_IND 0x9002
134#define HW_POWERUP_IND 0x9102
135#define HW_DEACT_IND 0x9202
136#define HW_ACTIVATE_IND 0x9302
137#define HW_DEACT_CNF 0x9402
138#define HW_TESTLOOP 0x9502
139#define HW_TESTRX_RAW 0x9602
140#define HW_TESTRX_HDLC 0x9702
141#define HW_TESTRX_OFF 0x9802
142
143struct layer1;
144extern int l1_event(struct layer1 *, u_int);
145
146
147struct bchannel {
148 struct mISDNchannel ch;
149 int nr;
150 u_long Flags;
151 struct work_struct workq;
152 u_int state;
153 /* HW access */
154 u_char (*read_reg) (void *, u_char);
155 void (*write_reg) (void *, u_char, u_char);
156 void (*read_fifo) (void *, u_char *, int);
157 void (*write_fifo) (void *, u_char *, int);
158 void *hw;
159 int slot; /* multiport card channel slot */
160 struct timer_list timer;
161 /* receive data */
162 struct sk_buff *rx_skb;
163 int maxlen;
164 /* send data */
165 struct sk_buff *next_skb;
166 struct sk_buff *tx_skb;
167 struct sk_buff_head rqueue;
168 int rcount;
169 int tx_idx;
170 int debug;
171 /* statistics */
172 int err_crc;
173 int err_tx;
174 int err_rx;
175};
176
177extern int mISDN_initdchannel(struct dchannel *, int, void *);
178extern int mISDN_initbchannel(struct bchannel *, int);
179extern int mISDN_freedchannel(struct dchannel *);
180extern int mISDN_freebchannel(struct bchannel *);
181extern void queue_ch_frame(struct mISDNchannel *, u_int,
182 int, struct sk_buff *);
183extern int dchannel_senddata(struct dchannel *, struct sk_buff *);
184extern int bchannel_senddata(struct bchannel *, struct sk_buff *);
185extern void recv_Dchannel(struct dchannel *);
186extern void recv_Bchannel(struct bchannel *);
187extern void recv_Dchannel_skb(struct dchannel *, struct sk_buff *);
188extern void recv_Bchannel_skb(struct bchannel *, struct sk_buff *);
189extern void confirm_Bsend(struct bchannel *bch);
190extern int get_next_bframe(struct bchannel *);
191extern int get_next_dframe(struct dchannel *);
192
193#endif
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h
new file mode 100644
index 00000000000..5c948f33781
--- /dev/null
+++ b/include/linux/mISDNif.h
@@ -0,0 +1,487 @@
1/*
2 *
3 * Author Karsten Keil <kkeil@novell.com>
4 *
5 * Copyright 2008 by Karsten Keil <kkeil@novell.com>
6 *
7 * This code is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
9 * version 2.1 as published by the Free Software Foundation.
10 *
11 * This code 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 LESSER GENERAL PUBLIC LICENSE for more details.
15 *
16 */
17
18#ifndef mISDNIF_H
19#define mISDNIF_H
20
21#include <stdarg.h>
22#include <linux/types.h>
23#include <linux/errno.h>
24#include <linux/socket.h>
25
26/*
27 * ABI Version 32 bit
28 *
29 * <8 bit> Major version
30 * - changed if any interface become backwards incompatible
31 *
32 * <8 bit> Minor version
33 * - changed if any interface is extended but backwards compatible
34 *
35 * <16 bit> Release number
36 * - should be incremented on every checkin
37 */
38#define MISDN_MAJOR_VERSION 1
39#define MISDN_MINOR_VERSION 0
40#define MISDN_RELEASE 18
41
42/* primitives for information exchange
43 * generell format
44 * <16 bit 0 >
45 * <8 bit command>
46 * BIT 8 = 1 LAYER private
47 * BIT 7 = 1 answer
48 * BIT 6 = 1 DATA
49 * <8 bit target layer mask>
50 *
51 * Layer = 00 is reserved for general commands
52 Layer = 01 L2 -> HW
53 Layer = 02 HW -> L2
54 Layer = 04 L3 -> L2
55 Layer = 08 L2 -> L3
56 * Layer = FF is reserved for broadcast commands
57 */
58
59#define MISDN_CMDMASK 0xff00
60#define MISDN_LAYERMASK 0x00ff
61
62/* generell commands */
63#define OPEN_CHANNEL 0x0100
64#define CLOSE_CHANNEL 0x0200
65#define CONTROL_CHANNEL 0x0300
66#define CHECK_DATA 0x0400
67
68/* layer 2 -> layer 1 */
69#define PH_ACTIVATE_REQ 0x0101
70#define PH_DEACTIVATE_REQ 0x0201
71#define PH_DATA_REQ 0x2001
72#define MPH_ACTIVATE_REQ 0x0501
73#define MPH_DEACTIVATE_REQ 0x0601
74#define MPH_INFORMATION_REQ 0x0701
75#define PH_CONTROL_REQ 0x0801
76
77/* layer 1 -> layer 2 */
78#define PH_ACTIVATE_IND 0x0102
79#define PH_ACTIVATE_CNF 0x4102
80#define PH_DEACTIVATE_IND 0x0202
81#define PH_DEACTIVATE_CNF 0x4202
82#define PH_DATA_IND 0x2002
83#define MPH_ACTIVATE_IND 0x0502
84#define MPH_DEACTIVATE_IND 0x0602
85#define MPH_INFORMATION_IND 0x0702
86#define PH_DATA_CNF 0x6002
87#define PH_CONTROL_IND 0x0802
88#define PH_CONTROL_CNF 0x4802
89
90/* layer 3 -> layer 2 */
91#define DL_ESTABLISH_REQ 0x1004
92#define DL_RELEASE_REQ 0x1104
93#define DL_DATA_REQ 0x3004
94#define DL_UNITDATA_REQ 0x3104
95#define DL_INFORMATION_REQ 0x0004
96
97/* layer 2 -> layer 3 */
98#define DL_ESTABLISH_IND 0x1008
99#define DL_ESTABLISH_CNF 0x5008
100#define DL_RELEASE_IND 0x1108
101#define DL_RELEASE_CNF 0x5108
102#define DL_DATA_IND 0x3008
103#define DL_UNITDATA_IND 0x3108
104#define DL_INFORMATION_IND 0x0008
105
106/* intern layer 2 managment */
107#define MDL_ASSIGN_REQ 0x1804
108#define MDL_ASSIGN_IND 0x1904
109#define MDL_REMOVE_REQ 0x1A04
110#define MDL_REMOVE_IND 0x1B04
111#define MDL_STATUS_UP_IND 0x1C04
112#define MDL_STATUS_DOWN_IND 0x1D04
113#define MDL_STATUS_UI_IND 0x1E04
114#define MDL_ERROR_IND 0x1F04
115#define MDL_ERROR_RSP 0x5F04
116
117/* DL_INFORMATION_IND types */
118#define DL_INFO_L2_CONNECT 0x0001
119#define DL_INFO_L2_REMOVED 0x0002
120
121/* PH_CONTROL types */
122/* TOUCH TONE IS 0x20XX XX "0"..."9", "A","B","C","D","*","#" */
123#define DTMF_TONE_VAL 0x2000
124#define DTMF_TONE_MASK 0x007F
125#define DTMF_TONE_START 0x2100
126#define DTMF_TONE_STOP 0x2200
127#define DTMF_HFC_COEF 0x4000
128#define DSP_CONF_JOIN 0x2403
129#define DSP_CONF_SPLIT 0x2404
130#define DSP_RECEIVE_OFF 0x2405
131#define DSP_RECEIVE_ON 0x2406
132#define DSP_ECHO_ON 0x2407
133#define DSP_ECHO_OFF 0x2408
134#define DSP_MIX_ON 0x2409
135#define DSP_MIX_OFF 0x240a
136#define DSP_DELAY 0x240b
137#define DSP_JITTER 0x240c
138#define DSP_TXDATA_ON 0x240d
139#define DSP_TXDATA_OFF 0x240e
140#define DSP_TX_DEJITTER 0x240f
141#define DSP_TX_DEJ_OFF 0x2410
142#define DSP_TONE_PATT_ON 0x2411
143#define DSP_TONE_PATT_OFF 0x2412
144#define DSP_VOL_CHANGE_TX 0x2413
145#define DSP_VOL_CHANGE_RX 0x2414
146#define DSP_BF_ENABLE_KEY 0x2415
147#define DSP_BF_DISABLE 0x2416
148#define DSP_BF_ACCEPT 0x2416
149#define DSP_BF_REJECT 0x2417
150#define DSP_PIPELINE_CFG 0x2418
151#define HFC_VOL_CHANGE_TX 0x2601
152#define HFC_VOL_CHANGE_RX 0x2602
153#define HFC_SPL_LOOP_ON 0x2603
154#define HFC_SPL_LOOP_OFF 0x2604
155
156/* DSP_TONE_PATT_ON parameter */
157#define TONE_OFF 0x0000
158#define TONE_GERMAN_DIALTONE 0x0001
159#define TONE_GERMAN_OLDDIALTONE 0x0002
160#define TONE_AMERICAN_DIALTONE 0x0003
161#define TONE_GERMAN_DIALPBX 0x0004
162#define TONE_GERMAN_OLDDIALPBX 0x0005
163#define TONE_AMERICAN_DIALPBX 0x0006
164#define TONE_GERMAN_RINGING 0x0007
165#define TONE_GERMAN_OLDRINGING 0x0008
166#define TONE_AMERICAN_RINGPBX 0x000b
167#define TONE_GERMAN_RINGPBX 0x000c
168#define TONE_GERMAN_OLDRINGPBX 0x000d
169#define TONE_AMERICAN_RINGING 0x000e
170#define TONE_GERMAN_BUSY 0x000f
171#define TONE_GERMAN_OLDBUSY 0x0010
172#define TONE_AMERICAN_BUSY 0x0011
173#define TONE_GERMAN_HANGUP 0x0012
174#define TONE_GERMAN_OLDHANGUP 0x0013
175#define TONE_AMERICAN_HANGUP 0x0014
176#define TONE_SPECIAL_INFO 0x0015
177#define TONE_GERMAN_GASSENBESETZT 0x0016
178#define TONE_GERMAN_AUFSCHALTTON 0x0016
179
180/* MPH_INFORMATION_IND */
181#define L1_SIGNAL_LOS_OFF 0x0010
182#define L1_SIGNAL_LOS_ON 0x0011
183#define L1_SIGNAL_AIS_OFF 0x0012
184#define L1_SIGNAL_AIS_ON 0x0013
185#define L1_SIGNAL_RDI_OFF 0x0014
186#define L1_SIGNAL_RDI_ON 0x0015
187#define L1_SIGNAL_SLIP_RX 0x0020
188#define L1_SIGNAL_SLIP_TX 0x0021
189
190/*
191 * protocol ids
192 * D channel 1-31
193 * B channel 33 - 63
194 */
195
196#define ISDN_P_NONE 0
197#define ISDN_P_BASE 0
198#define ISDN_P_TE_S0 0x01
199#define ISDN_P_NT_S0 0x02
200#define ISDN_P_TE_E1 0x03
201#define ISDN_P_NT_E1 0x04
202#define ISDN_P_LAPD_TE 0x10
203#define ISDN_P_LAPD_NT 0x11
204
205#define ISDN_P_B_MASK 0x1f
206#define ISDN_P_B_START 0x20
207
208#define ISDN_P_B_RAW 0x21
209#define ISDN_P_B_HDLC 0x22
210#define ISDN_P_B_X75SLP 0x23
211#define ISDN_P_B_L2DTMF 0x24
212#define ISDN_P_B_L2DSP 0x25
213#define ISDN_P_B_L2DSPHDLC 0x26
214
215#define OPTION_L2_PMX 1
216#define OPTION_L2_PTP 2
217#define OPTION_L2_FIXEDTEI 3
218#define OPTION_L2_CLEANUP 4
219
220/* should be in sync with linux/kobject.h:KOBJ_NAME_LEN */
221#define MISDN_MAX_IDLEN 20
222
223struct mISDNhead {
224 unsigned int prim;
225 unsigned int id;
226} __attribute__((packed));
227
228#define MISDN_HEADER_LEN sizeof(struct mISDNhead)
229#define MAX_DATA_SIZE 2048
230#define MAX_DATA_MEM (MAX_DATA_SIZE + MISDN_HEADER_LEN)
231#define MAX_DFRAME_LEN 260
232
233#define MISDN_ID_ADDR_MASK 0xFFFF
234#define MISDN_ID_TEI_MASK 0xFF00
235#define MISDN_ID_SAPI_MASK 0x00FF
236#define MISDN_ID_TEI_ANY 0x7F00
237
238#define MISDN_ID_ANY 0xFFFF
239#define MISDN_ID_NONE 0xFFFE
240
241#define GROUP_TEI 127
242#define TEI_SAPI 63
243#define CTRL_SAPI 0
244
245#define MISDN_CHMAP_SIZE 4
246
247#define SOL_MISDN 0
248
249struct sockaddr_mISDN {
250 sa_family_t family;
251 unsigned char dev;
252 unsigned char channel;
253 unsigned char sapi;
254 unsigned char tei;
255};
256
257/* timer device ioctl */
258#define IMADDTIMER _IOR('I', 64, int)
259#define IMDELTIMER _IOR('I', 65, int)
260/* socket ioctls */
261#define IMGETVERSION _IOR('I', 66, int)
262#define IMGETCOUNT _IOR('I', 67, int)
263#define IMGETDEVINFO _IOR('I', 68, int)
264#define IMCTRLREQ _IOR('I', 69, int)
265#define IMCLEAR_L2 _IOR('I', 70, int)
266
267struct mISDNversion {
268 unsigned char major;
269 unsigned char minor;
270 unsigned short release;
271};
272
273struct mISDN_devinfo {
274 u_int id;
275 u_int Dprotocols;
276 u_int Bprotocols;
277 u_int protocol;
278 u_long channelmap[MISDN_CHMAP_SIZE];
279 u_int nrbchan;
280 char name[MISDN_MAX_IDLEN];
281};
282
283/* CONTROL_CHANNEL parameters */
284#define MISDN_CTRL_GETOP 0x0000
285#define MISDN_CTRL_LOOP 0x0001
286#define MISDN_CTRL_CONNECT 0x0002
287#define MISDN_CTRL_DISCONNECT 0x0004
288#define MISDN_CTRL_PCMCONNECT 0x0010
289#define MISDN_CTRL_PCMDISCONNECT 0x0020
290#define MISDN_CTRL_SETPEER 0x0040
291#define MISDN_CTRL_UNSETPEER 0x0080
292#define MISDN_CTRL_RX_OFF 0x0100
293#define MISDN_CTRL_HW_FEATURES_OP 0x2000
294#define MISDN_CTRL_HW_FEATURES 0x2001
295#define MISDN_CTRL_HFC_OP 0x4000
296#define MISDN_CTRL_HFC_PCM_CONN 0x4001
297#define MISDN_CTRL_HFC_PCM_DISC 0x4002
298#define MISDN_CTRL_HFC_CONF_JOIN 0x4003
299#define MISDN_CTRL_HFC_CONF_SPLIT 0x4004
300#define MISDN_CTRL_HFC_RECEIVE_OFF 0x4005
301#define MISDN_CTRL_HFC_RECEIVE_ON 0x4006
302#define MISDN_CTRL_HFC_ECHOCAN_ON 0x4007
303#define MISDN_CTRL_HFC_ECHOCAN_OFF 0x4008
304
305
306/* socket options */
307#define MISDN_TIME_STAMP 0x0001
308
309struct mISDN_ctrl_req {
310 int op;
311 int channel;
312 int p1;
313 int p2;
314};
315
316/* muxer options */
317#define MISDN_OPT_ALL 1
318#define MISDN_OPT_TEIMGR 2
319
320#ifdef __KERNEL__
321#include <linux/list.h>
322#include <linux/skbuff.h>
323#include <linux/net.h>
324#include <net/sock.h>
325#include <linux/completion.h>
326
327#define DEBUG_CORE 0x000000ff
328#define DEBUG_CORE_FUNC 0x00000002
329#define DEBUG_SOCKET 0x00000004
330#define DEBUG_MANAGER 0x00000008
331#define DEBUG_SEND_ERR 0x00000010
332#define DEBUG_MSG_THREAD 0x00000020
333#define DEBUG_QUEUE_FUNC 0x00000040
334#define DEBUG_L1 0x0000ff00
335#define DEBUG_L1_FSM 0x00000200
336#define DEBUG_L2 0x00ff0000
337#define DEBUG_L2_FSM 0x00020000
338#define DEBUG_L2_CTRL 0x00040000
339#define DEBUG_L2_RECV 0x00080000
340#define DEBUG_L2_TEI 0x00100000
341#define DEBUG_L2_TEIFSM 0x00200000
342#define DEBUG_TIMER 0x01000000
343
344#define mISDN_HEAD_P(s) ((struct mISDNhead *)&s->cb[0])
345#define mISDN_HEAD_PRIM(s) (((struct mISDNhead *)&s->cb[0])->prim)
346#define mISDN_HEAD_ID(s) (((struct mISDNhead *)&s->cb[0])->id)
347
348/* socket states */
349#define MISDN_OPEN 1
350#define MISDN_BOUND 2
351#define MISDN_CLOSED 3
352
353struct mISDNchannel;
354struct mISDNdevice;
355struct mISDNstack;
356
357struct channel_req {
358 u_int protocol;
359 struct sockaddr_mISDN adr;
360 struct mISDNchannel *ch;
361};
362
363typedef int (ctrl_func_t)(struct mISDNchannel *, u_int, void *);
364typedef int (send_func_t)(struct mISDNchannel *, struct sk_buff *);
365typedef int (create_func_t)(struct channel_req *);
366
367struct Bprotocol {
368 struct list_head list;
369 char *name;
370 u_int Bprotocols;
371 create_func_t *create;
372};
373
374struct mISDNchannel {
375 struct list_head list;
376 u_int protocol;
377 u_int nr;
378 u_long opt;
379 u_int addr;
380 struct mISDNstack *st;
381 struct mISDNchannel *peer;
382 send_func_t *send;
383 send_func_t *recv;
384 ctrl_func_t *ctrl;
385};
386
387struct mISDN_sock_list {
388 struct hlist_head head;
389 rwlock_t lock;
390};
391
392struct mISDN_sock {
393 struct sock sk;
394 struct mISDNchannel ch;
395 u_int cmask;
396 struct mISDNdevice *dev;
397};
398
399
400
401struct mISDNdevice {
402 struct mISDNchannel D;
403 u_int id;
404 char name[MISDN_MAX_IDLEN];
405 u_int Dprotocols;
406 u_int Bprotocols;
407 u_int nrbchan;
408 u_long channelmap[MISDN_CHMAP_SIZE];
409 struct list_head bchannels;
410 struct mISDNchannel *teimgr;
411 struct device dev;
412};
413
414struct mISDNstack {
415 u_long status;
416 struct mISDNdevice *dev;
417 struct task_struct *thread;
418 struct completion *notify;
419 wait_queue_head_t workq;
420 struct sk_buff_head msgq;
421 struct list_head layer2;
422 struct mISDNchannel *layer1;
423 struct mISDNchannel own;
424 struct mutex lmutex; /* protect lists */
425 struct mISDN_sock_list l1sock;
426#ifdef MISDN_MSG_STATS
427 u_int msg_cnt;
428 u_int sleep_cnt;
429 u_int stopped_cnt;
430#endif
431};
432
433/* global alloc/queue dunctions */
434
435static inline struct sk_buff *
436mI_alloc_skb(unsigned int len, gfp_t gfp_mask)
437{
438 struct sk_buff *skb;
439
440 skb = alloc_skb(len + MISDN_HEADER_LEN, gfp_mask);
441 if (likely(skb))
442 skb_reserve(skb, MISDN_HEADER_LEN);
443 return skb;
444}
445
446static inline struct sk_buff *
447_alloc_mISDN_skb(u_int prim, u_int id, u_int len, void *dp, gfp_t gfp_mask)
448{
449 struct sk_buff *skb = mI_alloc_skb(len, gfp_mask);
450 struct mISDNhead *hh;
451
452 if (!skb)
453 return NULL;
454 if (len)
455 memcpy(skb_put(skb, len), dp, len);
456 hh = mISDN_HEAD_P(skb);
457 hh->prim = prim;
458 hh->id = id;
459 return skb;
460}
461
462static inline void
463_queue_data(struct mISDNchannel *ch, u_int prim,
464 u_int id, u_int len, void *dp, gfp_t gfp_mask)
465{
466 struct sk_buff *skb;
467
468 if (!ch->peer)
469 return;
470 skb = _alloc_mISDN_skb(prim, id, len, dp, gfp_mask);
471 if (!skb)
472 return;
473 if (ch->recv(ch->peer, skb))
474 dev_kfree_skb(skb);
475}
476
477/* global register/unregister functions */
478
479extern int mISDN_register_device(struct mISDNdevice *, char *name);
480extern void mISDN_unregister_device(struct mISDNdevice *);
481extern int mISDN_register_Bprotocol(struct Bprotocol *);
482extern void mISDN_unregister_Bprotocol(struct Bprotocol *);
483
484extern void set_channel_address(struct mISDNchannel *, u_int, u_int);
485
486#endif /* __KERNEL__ */
487#endif /* mISDNIF_H */
diff --git a/include/linux/major.h b/include/linux/major.h
index 0cb98053537..53d5fafd85c 100644
--- a/include/linux/major.h
+++ b/include/linux/major.h
@@ -53,7 +53,7 @@
53#define STL_SIOMEMMAJOR 28 53#define STL_SIOMEMMAJOR 28
54#define ACSI_MAJOR 28 54#define ACSI_MAJOR 28
55#define AZTECH_CDROM_MAJOR 29 55#define AZTECH_CDROM_MAJOR 29
56#define GRAPHDEV_MAJOR 29 /* SparcLinux & Linux/68k /dev/fb */ 56#define FB_MAJOR 29 /* /dev/fb* framebuffers */
57#define CM206_CDROM_MAJOR 32 57#define CM206_CDROM_MAJOR 32
58#define IDE2_MAJOR 33 58#define IDE2_MAJOR 33
59#define IDE3_MAJOR 34 59#define IDE3_MAJOR 34
diff --git a/include/linux/maple.h b/include/linux/maple.h
index d31e36ebb43..523a286bb47 100644
--- a/include/linux/maple.h
+++ b/include/linux/maple.h
@@ -61,8 +61,6 @@ struct maple_device {
61 61
62struct maple_driver { 62struct maple_driver {
63 unsigned long function; 63 unsigned long function;
64 int (*connect) (struct maple_device * dev);
65 void (*disconnect) (struct maple_device * dev);
66 struct device_driver drv; 64 struct device_driver drv;
67}; 65};
68 66
diff --git a/include/linux/marker.h b/include/linux/marker.h
index 430f6adf976..1290653f924 100644
--- a/include/linux/marker.h
+++ b/include/linux/marker.h
@@ -44,8 +44,8 @@ struct marker {
44 */ 44 */
45 char state; /* Marker state. */ 45 char state; /* Marker state. */
46 char ptype; /* probe type : 0 : single, 1 : multi */ 46 char ptype; /* probe type : 0 : single, 1 : multi */
47 void (*call)(const struct marker *mdata, /* Probe wrapper */ 47 /* Probe wrapper */
48 void *call_private, const char *fmt, ...); 48 void (*call)(const struct marker *mdata, void *call_private, ...);
49 struct marker_probe_closure single; 49 struct marker_probe_closure single;
50 struct marker_probe_closure *multi; 50 struct marker_probe_closure *multi;
51} __attribute__((aligned(8))); 51} __attribute__((aligned(8)));
@@ -58,8 +58,12 @@ struct marker {
58 * Make sure the alignment of the structure in the __markers section will 58 * Make sure the alignment of the structure in the __markers section will
59 * not add unwanted padding between the beginning of the section and the 59 * not add unwanted padding between the beginning of the section and the
60 * structure. Force alignment to the same alignment as the section start. 60 * structure. Force alignment to the same alignment as the section start.
61 *
62 * The "generic" argument controls which marker enabling mechanism must be used.
63 * If generic is true, a variable read is used.
64 * If generic is false, immediate values are used.
61 */ 65 */
62#define __trace_mark(name, call_private, format, args...) \ 66#define __trace_mark(generic, name, call_private, format, args...) \
63 do { \ 67 do { \
64 static const char __mstrtab_##name[] \ 68 static const char __mstrtab_##name[] \
65 __attribute__((section("__markers_strings"))) \ 69 __attribute__((section("__markers_strings"))) \
@@ -72,15 +76,14 @@ struct marker {
72 __mark_check_format(format, ## args); \ 76 __mark_check_format(format, ## args); \
73 if (unlikely(__mark_##name.state)) { \ 77 if (unlikely(__mark_##name.state)) { \
74 (*__mark_##name.call) \ 78 (*__mark_##name.call) \
75 (&__mark_##name, call_private, \ 79 (&__mark_##name, call_private, ## args);\
76 format, ## args); \
77 } \ 80 } \
78 } while (0) 81 } while (0)
79 82
80extern void marker_update_probe_range(struct marker *begin, 83extern void marker_update_probe_range(struct marker *begin,
81 struct marker *end); 84 struct marker *end);
82#else /* !CONFIG_MARKERS */ 85#else /* !CONFIG_MARKERS */
83#define __trace_mark(name, call_private, format, args...) \ 86#define __trace_mark(generic, name, call_private, format, args...) \
84 __mark_check_format(format, ## args) 87 __mark_check_format(format, ## args)
85static inline void marker_update_probe_range(struct marker *begin, 88static inline void marker_update_probe_range(struct marker *begin,
86 struct marker *end) 89 struct marker *end)
@@ -88,15 +91,30 @@ static inline void marker_update_probe_range(struct marker *begin,
88#endif /* CONFIG_MARKERS */ 91#endif /* CONFIG_MARKERS */
89 92
90/** 93/**
91 * trace_mark - Marker 94 * trace_mark - Marker using code patching
92 * @name: marker name, not quoted. 95 * @name: marker name, not quoted.
93 * @format: format string 96 * @format: format string
94 * @args...: variable argument list 97 * @args...: variable argument list
95 * 98 *
96 * Places a marker. 99 * Places a marker using optimized code patching technique (imv_read())
100 * to be enabled when immediate values are present.
97 */ 101 */
98#define trace_mark(name, format, args...) \ 102#define trace_mark(name, format, args...) \
99 __trace_mark(name, NULL, format, ## args) 103 __trace_mark(0, name, NULL, format, ## args)
104
105/**
106 * _trace_mark - Marker using variable read
107 * @name: marker name, not quoted.
108 * @format: format string
109 * @args...: variable argument list
110 *
111 * Places a marker using a standard memory read (_imv_read()) to be
112 * enabled. Should be used for markers in code paths where instruction
113 * modification based enabling is not welcome. (__init and __exit functions,
114 * lockdep, some traps, printk).
115 */
116#define _trace_mark(name, format, args...) \
117 __trace_mark(1, name, NULL, format, ## args)
100 118
101/** 119/**
102 * MARK_NOARGS - Format string for a marker with no argument. 120 * MARK_NOARGS - Format string for a marker with no argument.
@@ -117,9 +135,9 @@ static inline void __printf(1, 2) ___mark_check_format(const char *fmt, ...)
117extern marker_probe_func __mark_empty_function; 135extern marker_probe_func __mark_empty_function;
118 136
119extern void marker_probe_cb(const struct marker *mdata, 137extern void marker_probe_cb(const struct marker *mdata,
120 void *call_private, const char *fmt, ...); 138 void *call_private, ...);
121extern void marker_probe_cb_noarg(const struct marker *mdata, 139extern void marker_probe_cb_noarg(const struct marker *mdata,
122 void *call_private, const char *fmt, ...); 140 void *call_private, ...);
123 141
124/* 142/*
125 * Connect a probe to a marker. 143 * Connect a probe to a marker.
diff --git a/include/linux/math64.h b/include/linux/math64.h
index c1a5f81501f..c87f1528703 100644
--- a/include/linux/math64.h
+++ b/include/linux/math64.h
@@ -81,4 +81,25 @@ static inline s64 div_s64(s64 dividend, s32 divisor)
81} 81}
82#endif 82#endif
83 83
84u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder);
85
86static __always_inline u32
87__iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder)
88{
89 u32 ret = 0;
90
91 while (dividend >= divisor) {
92 /* The following asm() prevents the compiler from
93 optimising this loop into a modulo operation. */
94 asm("" : "+rm"(dividend));
95
96 dividend -= divisor;
97 ret++;
98 }
99
100 *remainder = dividend;
101
102 return ret;
103}
104
84#endif /* _LINUX_MATH64_H */ 105#endif /* _LINUX_MATH64_H */
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index e6608776bc9..fdf3967e139 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -35,7 +35,10 @@ extern int mem_cgroup_charge(struct page *page, struct mm_struct *mm,
35extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, 35extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
36 gfp_t gfp_mask); 36 gfp_t gfp_mask);
37extern void mem_cgroup_uncharge_page(struct page *page); 37extern void mem_cgroup_uncharge_page(struct page *page);
38extern void mem_cgroup_uncharge_cache_page(struct page *page);
38extern void mem_cgroup_move_lists(struct page *page, bool active); 39extern void mem_cgroup_move_lists(struct page *page, bool active);
40extern int mem_cgroup_shrink_usage(struct mm_struct *mm, gfp_t gfp_mask);
41
39extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, 42extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
40 struct list_head *dst, 43 struct list_head *dst,
41 unsigned long *scanned, int order, 44 unsigned long *scanned, int order,
@@ -50,9 +53,9 @@ extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
50#define mm_match_cgroup(mm, cgroup) \ 53#define mm_match_cgroup(mm, cgroup) \
51 ((cgroup) == mem_cgroup_from_task((mm)->owner)) 54 ((cgroup) == mem_cgroup_from_task((mm)->owner))
52 55
53extern int mem_cgroup_prepare_migration(struct page *page); 56extern int
57mem_cgroup_prepare_migration(struct page *page, struct page *newpage);
54extern void mem_cgroup_end_migration(struct page *page); 58extern void mem_cgroup_end_migration(struct page *page);
55extern void mem_cgroup_page_migration(struct page *page, struct page *newpage);
56 59
57/* 60/*
58 * For memory reclaim. 61 * For memory reclaim.
@@ -97,6 +100,15 @@ static inline void mem_cgroup_uncharge_page(struct page *page)
97{ 100{
98} 101}
99 102
103static inline void mem_cgroup_uncharge_cache_page(struct page *page)
104{
105}
106
107static inline int mem_cgroup_shrink_usage(struct mm_struct *mm, gfp_t gfp_mask)
108{
109 return 0;
110}
111
100static inline void mem_cgroup_move_lists(struct page *page, bool active) 112static inline void mem_cgroup_move_lists(struct page *page, bool active)
101{ 113{
102} 114}
@@ -112,7 +124,8 @@ static inline int task_in_mem_cgroup(struct task_struct *task,
112 return 1; 124 return 1;
113} 125}
114 126
115static inline int mem_cgroup_prepare_migration(struct page *page) 127static inline int
128mem_cgroup_prepare_migration(struct page *page, struct page *newpage)
116{ 129{
117 return 0; 130 return 0;
118} 131}
@@ -121,11 +134,6 @@ static inline void mem_cgroup_end_migration(struct page *page)
121{ 134{
122} 135}
123 136
124static inline void
125mem_cgroup_page_migration(struct page *page, struct page *newpage)
126{
127}
128
129static inline int mem_cgroup_calc_mapped_ratio(struct mem_cgroup *mem) 137static inline int mem_cgroup_calc_mapped_ratio(struct mem_cgroup *mem)
130{ 138{
131 return 0; 139 return 0;
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 73e358612ea..763ba81fc0f 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -13,12 +13,12 @@ struct mem_section;
13#ifdef CONFIG_MEMORY_HOTPLUG 13#ifdef CONFIG_MEMORY_HOTPLUG
14 14
15/* 15/*
16 * Magic number for free bootmem. 16 * Types for free bootmem.
17 * The normal smallest mapcount is -1. Here is smaller value than it. 17 * The normal smallest mapcount is -1. Here is smaller value than it.
18 */ 18 */
19#define SECTION_INFO 0xfffffffe 19#define SECTION_INFO (-1 - 1)
20#define MIX_INFO 0xfffffffd 20#define MIX_SECTION_INFO (-1 - 2)
21#define NODE_INFO 0xfffffffc 21#define NODE_INFO (-1 - 3)
22 22
23/* 23/*
24 * pgdat resizing functions 24 * pgdat resizing functions
@@ -77,14 +77,6 @@ extern int __add_pages(struct zone *zone, unsigned long start_pfn,
77extern int __remove_pages(struct zone *zone, unsigned long start_pfn, 77extern int __remove_pages(struct zone *zone, unsigned long start_pfn,
78 unsigned long nr_pages); 78 unsigned long nr_pages);
79 79
80/*
81 * Walk through all memory which is registered as resource.
82 * arg is (start_pfn, nr_pages, private_arg_pointer)
83 */
84extern int walk_memory_resource(unsigned long start_pfn,
85 unsigned long nr_pages, void *arg,
86 int (*func)(unsigned long, unsigned long, void *));
87
88#ifdef CONFIG_NUMA 80#ifdef CONFIG_NUMA
89extern int memory_add_physaddr_to_nid(u64 start); 81extern int memory_add_physaddr_to_nid(u64 start);
90#else 82#else
@@ -199,6 +191,26 @@ static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
199 191
200#endif /* ! CONFIG_MEMORY_HOTPLUG */ 192#endif /* ! CONFIG_MEMORY_HOTPLUG */
201 193
194/*
195 * Walk through all memory which is registered as resource.
196 * arg is (start_pfn, nr_pages, private_arg_pointer)
197 */
198extern int walk_memory_resource(unsigned long start_pfn,
199 unsigned long nr_pages, void *arg,
200 int (*func)(unsigned long, unsigned long, void *));
201
202#ifdef CONFIG_MEMORY_HOTREMOVE
203
204extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
205
206#else
207static inline int is_mem_section_removable(unsigned long pfn,
208 unsigned long nr_pages)
209{
210 return 0;
211}
212#endif /* CONFIG_MEMORY_HOTREMOVE */
213
202extern int add_memory(int nid, u64 start, u64 size); 214extern int add_memory(int nid, u64 start, u64 size);
203extern int arch_add_memory(int nid, u64 start, u64 size); 215extern int arch_add_memory(int nid, u64 start, u64 size);
204extern int remove_memory(u64 start, u64 size); 216extern int remove_memory(u64 start, u64 size);
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 3a39570b81b..085c903fe0f 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -59,6 +59,7 @@ enum {
59#include <linux/rbtree.h> 59#include <linux/rbtree.h>
60#include <linux/spinlock.h> 60#include <linux/spinlock.h>
61#include <linux/nodemask.h> 61#include <linux/nodemask.h>
62#include <linux/pagemap.h>
62 63
63struct mm_struct; 64struct mm_struct;
64 65
@@ -220,6 +221,24 @@ extern int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context);
220extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, 221extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol,
221 int no_context); 222 int no_context);
222#endif 223#endif
224
225/* Check if a vma is migratable */
226static inline int vma_migratable(struct vm_area_struct *vma)
227{
228 if (vma->vm_flags & (VM_IO|VM_HUGETLB|VM_PFNMAP|VM_RESERVED))
229 return 0;
230 /*
231 * Migration allocates pages in the highest zone. If we cannot
232 * do so then migration (at least from node to node) is not
233 * possible.
234 */
235 if (vma->vm_file &&
236 gfp_zone(mapping_gfp_mask(vma->vm_file->f_mapping))
237 < policy_zone)
238 return 0;
239 return 1;
240}
241
223#else 242#else
224 243
225struct mempolicy {}; 244struct mempolicy {};
diff --git a/include/linux/memstick.h b/include/linux/memstick.h
index 37a5cdb0391..a9f998a3f48 100644
--- a/include/linux/memstick.h
+++ b/include/linux/memstick.h
@@ -263,6 +263,10 @@ struct memstick_dev {
263 /* Get next request from the media driver. */ 263 /* Get next request from the media driver. */
264 int (*next_request)(struct memstick_dev *card, 264 int (*next_request)(struct memstick_dev *card,
265 struct memstick_request **mrq); 265 struct memstick_request **mrq);
266 /* Tell the media driver to stop doing things */
267 void (*stop)(struct memstick_dev *card);
268 /* Allow the media driver to continue */
269 void (*start)(struct memstick_dev *card);
266 270
267 struct device dev; 271 struct device dev;
268}; 272};
@@ -284,7 +288,7 @@ struct memstick_host {
284 /* Notify the host that some requests are pending. */ 288 /* Notify the host that some requests are pending. */
285 void (*request)(struct memstick_host *host); 289 void (*request)(struct memstick_host *host);
286 /* Set host IO parameters (power, clock, etc). */ 290 /* Set host IO parameters (power, clock, etc). */
287 void (*set_param)(struct memstick_host *host, 291 int (*set_param)(struct memstick_host *host,
288 enum memstick_param param, 292 enum memstick_param param,
289 int value); 293 int value);
290 unsigned long private[0] ____cacheline_aligned; 294 unsigned long private[0] ____cacheline_aligned;
diff --git a/include/linux/mfd/asic3.h b/include/linux/mfd/asic3.h
index 4ab2162db13..322cd6deb9f 100644
--- a/include/linux/mfd/asic3.h
+++ b/include/linux/mfd/asic3.h
@@ -8,7 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 * 9 *
10 * Copyright 2001 Compaq Computer Corporation. 10 * Copyright 2001 Compaq Computer Corporation.
11 * Copyright 2007 OpendHand. 11 * Copyright 2007-2008 OpenedHand Ltd.
12 */ 12 */
13 13
14#ifndef __ASIC3_H__ 14#ifndef __ASIC3_H__
@@ -16,43 +16,22 @@
16 16
17#include <linux/types.h> 17#include <linux/types.h>
18 18
19struct asic3 {
20 void __iomem *mapping;
21 unsigned int bus_shift;
22 unsigned int irq_nr;
23 unsigned int irq_base;
24 spinlock_t lock;
25 u16 irq_bothedge[4];
26 struct device *dev;
27};
28
29struct asic3_platform_data { 19struct asic3_platform_data {
30 struct { 20 u16 *gpio_config;
31 u32 dir; 21 unsigned int gpio_config_num;
32 u32 init;
33 u32 sleep_mask;
34 u32 sleep_out;
35 u32 batt_fault_out;
36 u32 sleep_conf;
37 u32 alt_function;
38 } gpio_a, gpio_b, gpio_c, gpio_d;
39
40 unsigned int bus_shift;
41 22
42 unsigned int irq_base; 23 unsigned int irq_base;
43 24
44 struct platform_device **children; 25 unsigned int gpio_base;
45 unsigned int n_children;
46}; 26};
47 27
48int asic3_gpio_get_value(struct asic3 *asic, unsigned gpio);
49void asic3_gpio_set_value(struct asic3 *asic, unsigned gpio, int val);
50
51#define ASIC3_NUM_GPIO_BANKS 4 28#define ASIC3_NUM_GPIO_BANKS 4
52#define ASIC3_GPIOS_PER_BANK 16 29#define ASIC3_GPIOS_PER_BANK 16
53#define ASIC3_NUM_GPIOS 64 30#define ASIC3_NUM_GPIOS 64
54#define ASIC3_NR_IRQS ASIC3_NUM_GPIOS + 6 31#define ASIC3_NR_IRQS ASIC3_NUM_GPIOS + 6
55 32
33#define ASIC3_TO_GPIO(gpio) (NR_BUILTIN_GPIO + (gpio))
34
56#define ASIC3_GPIO_BANK_A 0 35#define ASIC3_GPIO_BANK_A 0
57#define ASIC3_GPIO_BANK_B 1 36#define ASIC3_GPIO_BANK_B 1
58#define ASIC3_GPIO_BANK_C 2 37#define ASIC3_GPIO_BANK_C 2
@@ -64,32 +43,89 @@ void asic3_gpio_set_value(struct asic3 *asic, unsigned gpio, int val);
64/* All offsets below are specified with this address bus shift */ 43/* All offsets below are specified with this address bus shift */
65#define ASIC3_DEFAULT_ADDR_SHIFT 2 44#define ASIC3_DEFAULT_ADDR_SHIFT 2
66 45
67#define ASIC3_OFFSET(base, reg) (ASIC3_##base##_Base + ASIC3_##base##_##reg) 46#define ASIC3_OFFSET(base, reg) (ASIC3_##base##_BASE + ASIC3_##base##_##reg)
68#define ASIC3_GPIO_OFFSET(base, reg) \ 47#define ASIC3_GPIO_OFFSET(base, reg) \
69 (ASIC3_GPIO_##base##_Base + ASIC3_GPIO_##reg) 48 (ASIC3_GPIO_##base##_BASE + ASIC3_GPIO_##reg)
70 49
71#define ASIC3_GPIO_A_Base 0x0000 50#define ASIC3_GPIO_A_BASE 0x0000
72#define ASIC3_GPIO_B_Base 0x0100 51#define ASIC3_GPIO_B_BASE 0x0100
73#define ASIC3_GPIO_C_Base 0x0200 52#define ASIC3_GPIO_C_BASE 0x0200
74#define ASIC3_GPIO_D_Base 0x0300 53#define ASIC3_GPIO_D_BASE 0x0300
75 54
76#define ASIC3_GPIO_Mask 0x00 /* R/W 0:don't mask */ 55#define ASIC3_GPIO_TO_BANK(gpio) ((gpio) >> 4)
77#define ASIC3_GPIO_Direction 0x04 /* R/W 0:input */ 56#define ASIC3_GPIO_TO_BIT(gpio) ((gpio) - \
78#define ASIC3_GPIO_Out 0x08 /* R/W 0:output low */ 57 (ASIC3_GPIOS_PER_BANK * ((gpio) >> 4)))
79#define ASIC3_GPIO_TriggerType 0x0c /* R/W 0:level */ 58#define ASIC3_GPIO_TO_MASK(gpio) (1 << ASIC3_GPIO_TO_BIT(gpio))
80#define ASIC3_GPIO_EdgeTrigger 0x10 /* R/W 0:falling */ 59#define ASIC3_GPIO_TO_BASE(gpio) (ASIC3_GPIO_A_BASE + (((gpio) >> 4) * 0x0100))
81#define ASIC3_GPIO_LevelTrigger 0x14 /* R/W 0:low level detect */ 60#define ASIC3_BANK_TO_BASE(bank) (ASIC3_GPIO_A_BASE + ((bank) * 0x100))
82#define ASIC3_GPIO_SleepMask 0x18 /* R/W 0:don't mask in sleep mode */ 61
83#define ASIC3_GPIO_SleepOut 0x1c /* R/W level 0:low in sleep mode */ 62#define ASIC3_GPIO_MASK 0x00 /* R/W 0:don't mask */
84#define ASIC3_GPIO_BattFaultOut 0x20 /* R/W level 0:low in batt_fault */ 63#define ASIC3_GPIO_DIRECTION 0x04 /* R/W 0:input */
85#define ASIC3_GPIO_IntStatus 0x24 /* R/W 0:none, 1:detect */ 64#define ASIC3_GPIO_OUT 0x08 /* R/W 0:output low */
86#define ASIC3_GPIO_AltFunction 0x28 /* R/W 1:LED register control */ 65#define ASIC3_GPIO_TRIGGER_TYPE 0x0c /* R/W 0:level */
87#define ASIC3_GPIO_SleepConf 0x2c /* 66#define ASIC3_GPIO_EDGE_TRIGGER 0x10 /* R/W 0:falling */
67#define ASIC3_GPIO_LEVEL_TRIGGER 0x14 /* R/W 0:low level detect */
68#define ASIC3_GPIO_SLEEP_MASK 0x18 /* R/W 0:don't mask in sleep mode */
69#define ASIC3_GPIO_SLEEP_OUT 0x1c /* R/W level 0:low in sleep mode */
70#define ASIC3_GPIO_BAT_FAULT_OUT 0x20 /* R/W level 0:low in batt_fault */
71#define ASIC3_GPIO_INT_STATUS 0x24 /* R/W 0:none, 1:detect */
72#define ASIC3_GPIO_ALT_FUNCTION 0x28 /* R/W 1:LED register control */
73#define ASIC3_GPIO_SLEEP_CONF 0x2c /*
88 * R/W bit 1: autosleep 74 * R/W bit 1: autosleep
89 * 0: disable gposlpout in normal mode, 75 * 0: disable gposlpout in normal mode,
90 * enable gposlpout in sleep mode. 76 * enable gposlpout in sleep mode.
91 */ 77 */
92#define ASIC3_GPIO_Status 0x30 /* R Pin status */ 78#define ASIC3_GPIO_STATUS 0x30 /* R Pin status */
79
80/*
81 * ASIC3 GPIO config
82 *
83 * Bits 0..6 gpio number
84 * Bits 7..13 Alternate function
85 * Bit 14 Direction
86 * Bit 15 Initial value
87 *
88 */
89#define ASIC3_CONFIG_GPIO_PIN(config) ((config) & 0x7f)
90#define ASIC3_CONFIG_GPIO_ALT(config) (((config) & (0x7f << 7)) >> 7)
91#define ASIC3_CONFIG_GPIO_DIR(config) ((config & (1 << 14)) >> 14)
92#define ASIC3_CONFIG_GPIO_INIT(config) ((config & (1 << 15)) >> 15)
93#define ASIC3_CONFIG_GPIO(gpio, alt, dir, init) (((gpio) & 0x7f) \
94 | (((alt) & 0x7f) << 7) | (((dir) & 0x1) << 14) \
95 | (((init) & 0x1) << 15))
96#define ASIC3_CONFIG_GPIO_DEFAULT(gpio, dir, init) \
97 ASIC3_CONFIG_GPIO((gpio), 0, (dir), (init))
98#define ASIC3_CONFIG_GPIO_DEFAULT_OUT(gpio, init) \
99 ASIC3_CONFIG_GPIO((gpio), 0, 1, (init))
100
101/*
102 * Alternate functions
103 */
104#define ASIC3_GPIOA11_PWM0 ASIC3_CONFIG_GPIO(11, 1, 1, 0)
105#define ASIC3_GPIOA12_PWM1 ASIC3_CONFIG_GPIO(12, 1, 1, 0)
106#define ASIC3_GPIOA15_CONTROL_CX ASIC3_CONFIG_GPIO(15, 1, 1, 0)
107#define ASIC3_GPIOC0_LED0 ASIC3_CONFIG_GPIO(32, 1, 1, 0)
108#define ASIC3_GPIOC1_LED1 ASIC3_CONFIG_GPIO(33, 1, 1, 0)
109#define ASIC3_GPIOC2_LED2 ASIC3_CONFIG_GPIO(34, 1, 1, 0)
110#define ASIC3_GPIOC3_SPI_RXD ASIC3_CONFIG_GPIO(35, 1, 0, 0)
111#define ASIC3_GPIOC4_CF_nCD ASIC3_CONFIG_GPIO(36, 1, 0, 0)
112#define ASIC3_GPIOC4_SPI_TXD ASIC3_CONFIG_GPIO(36, 1, 1, 0)
113#define ASIC3_GPIOC5_SPI_CLK ASIC3_CONFIG_GPIO(37, 1, 1, 0)
114#define ASIC3_GPIOC5_nCIOW ASIC3_CONFIG_GPIO(37, 1, 1, 0)
115#define ASIC3_GPIOC6_nCIOR ASIC3_CONFIG_GPIO(38, 1, 1, 0)
116#define ASIC3_GPIOC7_nPCE_1 ASIC3_CONFIG_GPIO(39, 1, 0, 0)
117#define ASIC3_GPIOC8_nPCE_2 ASIC3_CONFIG_GPIO(40, 1, 0, 0)
118#define ASIC3_GPIOC9_nPOE ASIC3_CONFIG_GPIO(41, 1, 0, 0)
119#define ASIC3_GPIOC10_nPWE ASIC3_CONFIG_GPIO(42, 1, 0, 0)
120#define ASIC3_GPIOC11_PSKTSEL ASIC3_CONFIG_GPIO(43, 1, 0, 0)
121#define ASIC3_GPIOC12_nPREG ASIC3_CONFIG_GPIO(44, 1, 0, 0)
122#define ASIC3_GPIOC13_nPWAIT ASIC3_CONFIG_GPIO(45, 1, 1, 0)
123#define ASIC3_GPIOC14_nPIOIS16 ASIC3_CONFIG_GPIO(46, 1, 1, 0)
124#define ASIC3_GPIOC15_nPIOR ASIC3_CONFIG_GPIO(47, 1, 0, 0)
125#define ASIC3_GPIOD11_nCIOIS16 ASIC3_CONFIG_GPIO(59, 1, 0, 0)
126#define ASIC3_GPIOD12_nCWAIT ASIC3_CONFIG_GPIO(60, 1, 0, 0)
127#define ASIC3_GPIOD15_nPIOW ASIC3_CONFIG_GPIO(63, 1, 0, 0)
128
93 129
94#define ASIC3_SPI_Base 0x0400 130#define ASIC3_SPI_Base 0x0400
95#define ASIC3_SPI_Control 0x0000 131#define ASIC3_SPI_Control 0x0000
@@ -128,7 +164,7 @@ void asic3_gpio_set_value(struct asic3 *asic, unsigned gpio, int val);
128#define LED_AUTOSTOP (1 << 5) /* LED ON/OFF auto stop 0:disable, 1:enable */ 164#define LED_AUTOSTOP (1 << 5) /* LED ON/OFF auto stop 0:disable, 1:enable */
129#define LED_ALWAYS (1 << 6) /* LED Interrupt Mask 0:No mask, 1:mask */ 165#define LED_ALWAYS (1 << 6) /* LED Interrupt Mask 0:No mask, 1:mask */
130 166
131#define ASIC3_CLOCK_Base 0x0A00 167#define ASIC3_CLOCK_BASE 0x0A00
132#define ASIC3_CLOCK_CDEX 0x00 168#define ASIC3_CLOCK_CDEX 0x00
133#define ASIC3_CLOCK_SEL 0x04 169#define ASIC3_CLOCK_SEL 0x04
134 170
@@ -159,12 +195,12 @@ void asic3_gpio_set_value(struct asic3 *asic, unsigned gpio, int val);
159#define CLOCK_SEL_CX (1 << 2) 195#define CLOCK_SEL_CX (1 << 2)
160 196
161 197
162#define ASIC3_INTR_Base 0x0B00 198#define ASIC3_INTR_BASE 0x0B00
163 199
164#define ASIC3_INTR_IntMask 0x00 /* Interrupt mask control */ 200#define ASIC3_INTR_INT_MASK 0x00 /* Interrupt mask control */
165#define ASIC3_INTR_PIntStat 0x04 /* Peripheral interrupt status */ 201#define ASIC3_INTR_P_INT_STAT 0x04 /* Peripheral interrupt status */
166#define ASIC3_INTR_IntCPS 0x08 /* Interrupt timer clock pre-scale */ 202#define ASIC3_INTR_INT_CPS 0x08 /* Interrupt timer clock pre-scale */
167#define ASIC3_INTR_IntTBS 0x0c /* Interrupt timer set */ 203#define ASIC3_INTR_INT_TBS 0x0c /* Interrupt timer set */
168 204
169#define ASIC3_INTMASK_GINTMASK (1 << 0) /* Global INTs mask 1:enable */ 205#define ASIC3_INTMASK_GINTMASK (1 << 0) /* Global INTs mask 1:enable */
170#define ASIC3_INTMASK_GINTEL (1 << 1) /* 1: rising edge, 0: hi level */ 206#define ASIC3_INTMASK_GINTEL (1 << 1) /* 1: rising edge, 0: hi level */
@@ -227,44 +263,12 @@ void asic3_gpio_set_value(struct asic3 *asic, unsigned gpio, int val);
227#define ASIC3_EXTCF_CF_SLEEP (1 << 15) /* CF sleep mode control */ 263#define ASIC3_EXTCF_CF_SLEEP (1 << 15) /* CF sleep mode control */
228 264
229/********************************************* 265/*********************************************
230 * The Onewire interface registers 266 * The Onewire interface (DS1WM) is handled
231 * 267 * by the ds1wm driver.
232 * OWM_CMD
233 * OWM_DAT
234 * OWM_INTR
235 * OWM_INTEN
236 * OWM_CLKDIV
237 * 268 *
238 *********************************************/ 269 *********************************************/
239 270
240#define ASIC3_OWM_Base 0xC00 271#define ASIC3_OWM_BASE 0xC00
241
242#define ASIC3_OWM_CMD 0x00
243#define ASIC3_OWM_DAT 0x04
244#define ASIC3_OWM_INTR 0x08
245#define ASIC3_OWM_INTEN 0x0C
246#define ASIC3_OWM_CLKDIV 0x10
247
248#define ASIC3_OWM_CMD_ONEWR (1 << 0)
249#define ASIC3_OWM_CMD_SRA (1 << 1)
250#define ASIC3_OWM_CMD_DQO (1 << 2)
251#define ASIC3_OWM_CMD_DQI (1 << 3)
252
253#define ASIC3_OWM_INTR_PD (1 << 0)
254#define ASIC3_OWM_INTR_PDR (1 << 1)
255#define ASIC3_OWM_INTR_TBE (1 << 2)
256#define ASIC3_OWM_INTR_TEMP (1 << 3)
257#define ASIC3_OWM_INTR_RBF (1 << 4)
258
259#define ASIC3_OWM_INTEN_EPD (1 << 0)
260#define ASIC3_OWM_INTEN_IAS (1 << 1)
261#define ASIC3_OWM_INTEN_ETBE (1 << 2)
262#define ASIC3_OWM_INTEN_ETMT (1 << 3)
263#define ASIC3_OWM_INTEN_ERBF (1 << 4)
264
265#define ASIC3_OWM_CLKDIV_PRE (3 << 0) /* two bits wide at bit 0 */
266#define ASIC3_OWM_CLKDIV_DIV (7 << 2) /* 3 bits wide at bit 2 */
267
268 272
269/***************************************************************************** 273/*****************************************************************************
270 * The SD configuration registers are at a completely different location 274 * The SD configuration registers are at a completely different location
@@ -492,6 +496,7 @@ void asic3_gpio_set_value(struct asic3 *asic, unsigned gpio, int val);
492#define ASIC3_SDIO_CTRL_LEDCtrl 0x7C 496#define ASIC3_SDIO_CTRL_LEDCtrl 0x7C
493#define ASIC3_SDIO_CTRL_SoftwareReset 0x1C0 497#define ASIC3_SDIO_CTRL_SoftwareReset 0x1C0
494 498
495#define ASIC3_MAP_SIZE 0x2000 499#define ASIC3_MAP_SIZE_32BIT 0x2000
500#define ASIC3_MAP_SIZE_16BIT 0x1000
496 501
497#endif /* __ASIC3_H__ */ 502#endif /* __ASIC3_H__ */
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
new file mode 100644
index 00000000000..49ef857cdb2
--- /dev/null
+++ b/include/linux/mfd/core.h
@@ -0,0 +1,55 @@
1/*
2 * drivers/mfd/mfd-core.h
3 *
4 * core MFD support
5 * Copyright (c) 2006 Ian Molton
6 * Copyright (c) 2007 Dmitry Baryshkov
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14#ifndef MFD_CORE_H
15#define MFD_CORE_H
16
17#include <linux/platform_device.h>
18
19/*
20 * This struct describes the MFD part ("cell").
21 * After registration the copy of this structure will become the platform data
22 * of the resulting platform_device
23 */
24struct mfd_cell {
25 const char *name;
26
27 int (*enable)(struct platform_device *dev);
28 int (*disable)(struct platform_device *dev);
29 int (*suspend)(struct platform_device *dev);
30 int (*resume)(struct platform_device *dev);
31
32 /* driver-specific data for MFD-aware "cell" drivers */
33 void *driver_data;
34
35 /* platform_data can be used to either pass data to "generic"
36 driver or as a hook to mfd_cell for the "cell" drivers */
37 void *platform_data;
38 size_t data_size;
39
40 /*
41 * This resources can be specified relatievly to the parent device.
42 * For accessing device you should use resources from device
43 */
44 int num_resources;
45 const struct resource *resources;
46};
47
48extern int mfd_add_devices(struct device *parent, int id,
49 const struct mfd_cell *cells, int n_devs,
50 struct resource *mem_base,
51 int irq_base);
52
53extern void mfd_remove_devices(struct device *parent);
54
55#endif
diff --git a/include/linux/mfd/tc6393xb.h b/include/linux/mfd/tc6393xb.h
new file mode 100644
index 00000000000..7cc824a58f7
--- /dev/null
+++ b/include/linux/mfd/tc6393xb.h
@@ -0,0 +1,49 @@
1/*
2 * Toshiba TC6393XB SoC support
3 *
4 * Copyright(c) 2005-2006 Chris Humbert
5 * Copyright(c) 2005 Dirk Opfer
6 * Copyright(c) 2005 Ian Molton <spyro@f2s.com>
7 * Copyright(c) 2007 Dmitry Baryshkov
8 *
9 * Based on code written by Sharp/Lineo for 2.4 kernels
10 * Based on locomo.c
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16
17#ifndef TC6393XB_H
18#define TC6393XB_H
19
20/* Also one should provide the CK3P6MI clock */
21struct tc6393xb_platform_data {
22 u16 scr_pll2cr; /* PLL2 Control */
23 u16 scr_gper; /* GP Enable */
24 u32 scr_gpo_doecr; /* GPO Data OE Control */
25 u32 scr_gpo_dsr; /* GPO Data Set */
26
27 int (*enable)(struct platform_device *dev);
28 int (*disable)(struct platform_device *dev);
29 int (*suspend)(struct platform_device *dev);
30 int (*resume)(struct platform_device *dev);
31
32 int irq_base; /* a base for cascaded irq */
33 int gpio_base;
34
35 struct tmio_nand_data *nand_data;
36};
37
38/*
39 * Relative to irq_base
40 */
41#define IRQ_TC6393_NAND 0
42#define IRQ_TC6393_MMC 1
43#define IRQ_TC6393_OHCI 2
44#define IRQ_TC6393_SERIAL 3
45#define IRQ_TC6393_FB 4
46
47#define TC6393XB_NR_IRQS 8
48
49#endif
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
new file mode 100644
index 00000000000..9438d8c9ac1
--- /dev/null
+++ b/include/linux/mfd/tmio.h
@@ -0,0 +1,17 @@
1#ifndef MFD_TMIO_H
2#define MFD_TMIO_H
3
4/*
5 * data for the NAND controller
6 */
7struct tmio_nand_data {
8 struct nand_bbt_descr *badblock_pattern;
9 struct mtd_partition *partition;
10 unsigned int num_partitions;
11};
12
13#define TMIO_NAND_CONFIG "tmio-nand-config"
14#define TMIO_NAND_CONTROL "tmio-nand-control"
15#define TMIO_NAND_IRQ "tmio-nand"
16
17#endif
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index e10a90a93b5..03aea612d28 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -3,28 +3,10 @@
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <linux/mempolicy.h> 5#include <linux/mempolicy.h>
6#include <linux/pagemap.h>
7 6
8typedef struct page *new_page_t(struct page *, unsigned long private, int **); 7typedef struct page *new_page_t(struct page *, unsigned long private, int **);
9 8
10#ifdef CONFIG_MIGRATION 9#ifdef CONFIG_MIGRATION
11/* Check if a vma is migratable */
12static inline int vma_migratable(struct vm_area_struct *vma)
13{
14 if (vma->vm_flags & (VM_IO|VM_HUGETLB|VM_PFNMAP|VM_RESERVED))
15 return 0;
16 /*
17 * Migration allocates pages in the highest zone. If we cannot
18 * do so then migration (at least from node to node) is not
19 * possible.
20 */
21 if (vma->vm_file &&
22 gfp_zone(mapping_gfp_mask(vma->vm_file->f_mapping))
23 < policy_zone)
24 return 0;
25 return 1;
26}
27
28extern int isolate_lru_page(struct page *p, struct list_head *pagelist); 10extern int isolate_lru_page(struct page *p, struct list_head *pagelist);
29extern int putback_lru_pages(struct list_head *l); 11extern int putback_lru_pages(struct list_head *l);
30extern int migrate_page(struct address_space *, 12extern int migrate_page(struct address_space *,
@@ -39,9 +21,6 @@ extern int migrate_vmas(struct mm_struct *mm,
39 const nodemask_t *from, const nodemask_t *to, 21 const nodemask_t *from, const nodemask_t *to,
40 unsigned long flags); 22 unsigned long flags);
41#else 23#else
42static inline int vma_migratable(struct vm_area_struct *vma)
43 { return 0; }
44
45static inline int isolate_lru_page(struct page *p, struct list_head *list) 24static inline int isolate_lru_page(struct page *p, struct list_head *list)
46 { return -ENOSYS; } 25 { return -ENOSYS; }
47static inline int putback_lru_pages(struct list_head *l) { return 0; } 26static inline int putback_lru_pages(struct list_head *l) { return 0; }
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index a744383d16e..655ea0d1ee1 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -68,6 +68,14 @@ enum {
68 MLX4_DEV_CAP_FLAG_UD_MCAST = 1 << 21 68 MLX4_DEV_CAP_FLAG_UD_MCAST = 1 << 21
69}; 69};
70 70
71enum {
72 MLX4_BMME_FLAG_LOCAL_INV = 1 << 6,
73 MLX4_BMME_FLAG_REMOTE_INV = 1 << 7,
74 MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9,
75 MLX4_BMME_FLAG_RESERVED_LKEY = 1 << 10,
76 MLX4_BMME_FLAG_FAST_REG_WR = 1 << 11,
77};
78
71enum mlx4_event { 79enum mlx4_event {
72 MLX4_EVENT_TYPE_COMP = 0x00, 80 MLX4_EVENT_TYPE_COMP = 0x00,
73 MLX4_EVENT_TYPE_PATH_MIG = 0x01, 81 MLX4_EVENT_TYPE_PATH_MIG = 0x01,
@@ -184,6 +192,8 @@ struct mlx4_caps {
184 u32 max_msg_sz; 192 u32 max_msg_sz;
185 u32 page_size_cap; 193 u32 page_size_cap;
186 u32 flags; 194 u32 flags;
195 u32 bmme_flags;
196 u32 reserved_lkey;
187 u16 stat_rate_support; 197 u16 stat_rate_support;
188 u8 port_width_cap[MLX4_MAX_PORTS + 1]; 198 u8 port_width_cap[MLX4_MAX_PORTS + 1];
189 int max_gso_sz; 199 int max_gso_sz;
@@ -398,7 +408,8 @@ int mlx4_srq_query(struct mlx4_dev *dev, struct mlx4_srq *srq, int *limit_waterm
398int mlx4_INIT_PORT(struct mlx4_dev *dev, int port); 408int mlx4_INIT_PORT(struct mlx4_dev *dev, int port);
399int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port); 409int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port);
400 410
401int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]); 411int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
412 int block_mcast_loopback);
402int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]); 413int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]);
403 414
404int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list, 415int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list,
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 7f128b266fa..bf8f11982da 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -164,11 +164,13 @@ enum {
164 MLX4_WQE_CTRL_SOLICITED = 1 << 1, 164 MLX4_WQE_CTRL_SOLICITED = 1 << 1,
165 MLX4_WQE_CTRL_IP_CSUM = 1 << 4, 165 MLX4_WQE_CTRL_IP_CSUM = 1 << 4,
166 MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5, 166 MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5,
167 MLX4_WQE_CTRL_INS_VLAN = 1 << 6,
167}; 168};
168 169
169struct mlx4_wqe_ctrl_seg { 170struct mlx4_wqe_ctrl_seg {
170 __be32 owner_opcode; 171 __be32 owner_opcode;
171 u8 reserved2[3]; 172 __be16 vlan_tag;
173 u8 ins_vlan;
172 u8 fence_size; 174 u8 fence_size;
173 /* 175 /*
174 * High 24 bits are SRC remote buffer; low 8 bits are flags: 176 * High 24 bits are SRC remote buffer; low 8 bits are flags:
@@ -219,7 +221,7 @@ struct mlx4_wqe_datagram_seg {
219 __be32 reservd[2]; 221 __be32 reservd[2];
220}; 222};
221 223
222struct mlx4_lso_seg { 224struct mlx4_wqe_lso_seg {
223 __be32 mss_hdr_size; 225 __be32 mss_hdr_size;
224 __be32 header[0]; 226 __be32 header[0];
225}; 227};
@@ -233,6 +235,14 @@ struct mlx4_wqe_bind_seg {
233 __be64 length; 235 __be64 length;
234}; 236};
235 237
238enum {
239 MLX4_WQE_FMR_PERM_LOCAL_READ = 1 << 27,
240 MLX4_WQE_FMR_PERM_LOCAL_WRITE = 1 << 28,
241 MLX4_WQE_FMR_PERM_REMOTE_READ = 1 << 29,
242 MLX4_WQE_FMR_PERM_REMOTE_WRITE = 1 << 30,
243 MLX4_WQE_FMR_PERM_ATOMIC = 1 << 31
244};
245
236struct mlx4_wqe_fmr_seg { 246struct mlx4_wqe_fmr_seg {
237 __be32 flags; 247 __be32 flags;
238 __be32 mem_key; 248 __be32 mem_key;
@@ -255,11 +265,11 @@ struct mlx4_wqe_fmr_ext_seg {
255}; 265};
256 266
257struct mlx4_wqe_local_inval_seg { 267struct mlx4_wqe_local_inval_seg {
258 u8 flags; 268 __be32 flags;
259 u8 reserved1[3]; 269 u32 reserved1;
260 __be32 mem_key; 270 __be32 mem_key;
261 u8 reserved2[3]; 271 u32 reserved2[2];
262 u8 guest_id; 272 __be32 guest_id;
263 __be64 pa; 273 __be64 pa;
264}; 274};
265 275
diff --git a/include/linux/mm.h b/include/linux/mm.h
index c31a9cd2a30..866a3dbe5c7 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -41,6 +41,9 @@ extern unsigned long mmap_min_addr;
41 41
42#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) 42#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
43 43
44/* to align the pointer to the (next) page boundary */
45#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
46
44/* 47/*
45 * Linux kernel virtual memory manager primitives. 48 * Linux kernel virtual memory manager primitives.
46 * The idea being to have a "virtual" mm in the same way 49 * The idea being to have a "virtual" mm in the same way
@@ -100,6 +103,7 @@ extern unsigned int kobjsize(const void *objp);
100#define VM_DONTEXPAND 0x00040000 /* Cannot expand with mremap() */ 103#define VM_DONTEXPAND 0x00040000 /* Cannot expand with mremap() */
101#define VM_RESERVED 0x00080000 /* Count as reserved_vm like IO */ 104#define VM_RESERVED 0x00080000 /* Count as reserved_vm like IO */
102#define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */ 105#define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */
106#define VM_NORESERVE 0x00200000 /* should the VM suppress accounting */
103#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ 107#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */
104#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ 108#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */
105#define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */ 109#define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */
@@ -108,6 +112,7 @@ extern unsigned int kobjsize(const void *objp);
108 112
109#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ 113#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */
110#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ 114#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
115#define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */
111 116
112#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ 117#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
113#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS 118#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
@@ -165,12 +170,16 @@ struct vm_operations_struct {
165 void (*open)(struct vm_area_struct * area); 170 void (*open)(struct vm_area_struct * area);
166 void (*close)(struct vm_area_struct * area); 171 void (*close)(struct vm_area_struct * area);
167 int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf); 172 int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf);
168 unsigned long (*nopfn)(struct vm_area_struct *area,
169 unsigned long address);
170 173
171 /* notification that a previously read-only page is about to become 174 /* notification that a previously read-only page is about to become
172 * writable, if an error is returned it will cause a SIGBUS */ 175 * writable, if an error is returned it will cause a SIGBUS */
173 int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page); 176 int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page);
177
178 /* called by access_process_vm when get_user_pages() fails, typically
179 * for use by special VMAs that can switch between memory and hardware
180 */
181 int (*access)(struct vm_area_struct *vma, unsigned long addr,
182 void *buf, int len, int write);
174#ifdef CONFIG_NUMA 183#ifdef CONFIG_NUMA
175 /* 184 /*
176 * set_policy() op must add a reference to any non-NULL @new mempolicy 185 * set_policy() op must add a reference to any non-NULL @new mempolicy
@@ -674,13 +683,6 @@ static inline int page_mapped(struct page *page)
674} 683}
675 684
676/* 685/*
677 * Error return values for the *_nopfn functions
678 */
679#define NOPFN_SIGBUS ((unsigned long) -1)
680#define NOPFN_OOM ((unsigned long) -2)
681#define NOPFN_REFAULT ((unsigned long) -3)
682
683/*
684 * Different kinds of faults, as returned by handle_mm_fault(). 686 * Different kinds of faults, as returned by handle_mm_fault().
685 * Used to decide whether a process gets delivered SIGBUS or 687 * Used to decide whether a process gets delivered SIGBUS or
686 * just gets major/minor fault counters bumped up. 688 * just gets major/minor fault counters bumped up.
@@ -760,24 +762,25 @@ unsigned long unmap_vmas(struct mmu_gather **tlb,
760 * (see walk_page_range for more details) 762 * (see walk_page_range for more details)
761 */ 763 */
762struct mm_walk { 764struct mm_walk {
763 int (*pgd_entry)(pgd_t *, unsigned long, unsigned long, void *); 765 int (*pgd_entry)(pgd_t *, unsigned long, unsigned long, struct mm_walk *);
764 int (*pud_entry)(pud_t *, unsigned long, unsigned long, void *); 766 int (*pud_entry)(pud_t *, unsigned long, unsigned long, struct mm_walk *);
765 int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, void *); 767 int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, struct mm_walk *);
766 int (*pte_entry)(pte_t *, unsigned long, unsigned long, void *); 768 int (*pte_entry)(pte_t *, unsigned long, unsigned long, struct mm_walk *);
767 int (*pte_hole)(unsigned long, unsigned long, void *); 769 int (*pte_hole)(unsigned long, unsigned long, struct mm_walk *);
770 struct mm_struct *mm;
771 void *private;
768}; 772};
769 773
770int walk_page_range(const struct mm_struct *, unsigned long addr, 774int walk_page_range(unsigned long addr, unsigned long end,
771 unsigned long end, const struct mm_walk *walk, 775 struct mm_walk *walk);
772 void *private); 776void free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
773void free_pgd_range(struct mmu_gather **tlb, unsigned long addr,
774 unsigned long end, unsigned long floor, unsigned long ceiling); 777 unsigned long end, unsigned long floor, unsigned long ceiling);
775void free_pgtables(struct mmu_gather **tlb, struct vm_area_struct *start_vma,
776 unsigned long floor, unsigned long ceiling);
777int copy_page_range(struct mm_struct *dst, struct mm_struct *src, 778int copy_page_range(struct mm_struct *dst, struct mm_struct *src,
778 struct vm_area_struct *vma); 779 struct vm_area_struct *vma);
779void unmap_mapping_range(struct address_space *mapping, 780void unmap_mapping_range(struct address_space *mapping,
780 loff_t const holebegin, loff_t const holelen, int even_cows); 781 loff_t const holebegin, loff_t const holelen, int even_cows);
782int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
783 void *buf, int len, int write);
781 784
782static inline void unmap_shared_mapping_range(struct address_space *mapping, 785static inline void unmap_shared_mapping_range(struct address_space *mapping,
783 loff_t const holebegin, loff_t const holelen) 786 loff_t const holebegin, loff_t const holelen)
@@ -807,7 +810,6 @@ extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *
807 810
808int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, 811int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start,
809 int len, int write, int force, struct page **pages, struct vm_area_struct **vmas); 812 int len, int write, int force, struct page **pages, struct vm_area_struct **vmas);
810void print_bad_pte(struct vm_area_struct *, pte_t, unsigned long);
811 813
812extern int try_to_release_page(struct page * page, gfp_t gfp_mask); 814extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
813extern void do_invalidatepage(struct page *page, unsigned long offset); 815extern void do_invalidatepage(struct page *page, unsigned long offset);
@@ -830,6 +832,39 @@ extern int mprotect_fixup(struct vm_area_struct *vma,
830 struct vm_area_struct **pprev, unsigned long start, 832 struct vm_area_struct **pprev, unsigned long start,
831 unsigned long end, unsigned long newflags); 833 unsigned long end, unsigned long newflags);
832 834
835#ifdef CONFIG_HAVE_GET_USER_PAGES_FAST
836/*
837 * get_user_pages_fast provides equivalent functionality to get_user_pages,
838 * operating on current and current->mm (force=0 and doesn't return any vmas).
839 *
840 * get_user_pages_fast may take mmap_sem and page tables, so no assumptions
841 * can be made about locking. get_user_pages_fast is to be implemented in a
842 * way that is advantageous (vs get_user_pages()) when the user memory area is
843 * already faulted in and present in ptes. However if the pages have to be
844 * faulted in, it may turn out to be slightly slower).
845 */
846int get_user_pages_fast(unsigned long start, int nr_pages, int write,
847 struct page **pages);
848
849#else
850/*
851 * Should probably be moved to asm-generic, and architectures can include it if
852 * they don't implement their own get_user_pages_fast.
853 */
854#define get_user_pages_fast(start, nr_pages, write, pages) \
855({ \
856 struct mm_struct *mm = current->mm; \
857 int ret; \
858 \
859 down_read(&mm->mmap_sem); \
860 ret = get_user_pages(current, mm, start, nr_pages, \
861 write, 0, pages, NULL); \
862 up_read(&mm->mmap_sem); \
863 \
864 ret; \
865})
866#endif
867
833/* 868/*
834 * A callback you can register to apply pressure to ageable caches. 869 * A callback you can register to apply pressure to ageable caches.
835 * 870 *
@@ -963,9 +998,8 @@ static inline void pgtable_page_dtor(struct page *page)
963 NULL: pte_offset_kernel(pmd, address)) 998 NULL: pte_offset_kernel(pmd, address))
964 999
965extern void free_area_init(unsigned long * zones_size); 1000extern void free_area_init(unsigned long * zones_size);
966extern void free_area_init_node(int nid, pg_data_t *pgdat, 1001extern void free_area_init_node(int nid, unsigned long * zones_size,
967 unsigned long * zones_size, unsigned long zone_start_pfn, 1002 unsigned long zone_start_pfn, unsigned long *zholes_size);
968 unsigned long *zholes_size);
969#ifdef CONFIG_ARCH_POPULATES_NODE_MAP 1003#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
970/* 1004/*
971 * With CONFIG_ARCH_POPULATES_NODE_MAP set, an architecture may initialise its 1005 * With CONFIG_ARCH_POPULATES_NODE_MAP set, an architecture may initialise its
@@ -997,8 +1031,8 @@ extern void free_area_init_node(int nid, pg_data_t *pgdat,
997extern void free_area_init_nodes(unsigned long *max_zone_pfn); 1031extern void free_area_init_nodes(unsigned long *max_zone_pfn);
998extern void add_active_range(unsigned int nid, unsigned long start_pfn, 1032extern void add_active_range(unsigned int nid, unsigned long start_pfn,
999 unsigned long end_pfn); 1033 unsigned long end_pfn);
1000extern void shrink_active_range(unsigned int nid, unsigned long old_end_pfn, 1034extern void remove_active_range(unsigned int nid, unsigned long start_pfn,
1001 unsigned long new_end_pfn); 1035 unsigned long end_pfn);
1002extern void push_node_boundaries(unsigned int nid, unsigned long start_pfn, 1036extern void push_node_boundaries(unsigned int nid, unsigned long start_pfn,
1003 unsigned long end_pfn); 1037 unsigned long end_pfn);
1004extern void remove_all_active_ranges(void); 1038extern void remove_all_active_ranges(void);
@@ -1010,6 +1044,8 @@ extern unsigned long find_min_pfn_with_active_regions(void);
1010extern unsigned long find_max_pfn_with_active_regions(void); 1044extern unsigned long find_max_pfn_with_active_regions(void);
1011extern void free_bootmem_with_active_regions(int nid, 1045extern void free_bootmem_with_active_regions(int nid,
1012 unsigned long max_low_pfn); 1046 unsigned long max_low_pfn);
1047typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
1048extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data);
1013extern void sparse_memory_present_with_active_regions(int nid); 1049extern void sparse_memory_present_with_active_regions(int nid);
1014#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID 1050#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
1015extern int early_pfn_to_nid(unsigned long pfn); 1051extern int early_pfn_to_nid(unsigned long pfn);
@@ -1023,6 +1059,7 @@ extern void mem_init(void);
1023extern void show_mem(void); 1059extern void show_mem(void);
1024extern void si_meminfo(struct sysinfo * val); 1060extern void si_meminfo(struct sysinfo * val);
1025extern void si_meminfo_node(struct sysinfo *val, int nid); 1061extern void si_meminfo_node(struct sysinfo *val, int nid);
1062extern int after_bootmem;
1026 1063
1027#ifdef CONFIG_NUMA 1064#ifdef CONFIG_NUMA
1028extern void setup_per_cpu_pageset(void); 1065extern void setup_per_cpu_pageset(void);
@@ -1067,6 +1104,9 @@ extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
1067 unsigned long addr, unsigned long len, pgoff_t pgoff); 1104 unsigned long addr, unsigned long len, pgoff_t pgoff);
1068extern void exit_mmap(struct mm_struct *); 1105extern void exit_mmap(struct mm_struct *);
1069 1106
1107extern int mm_take_all_locks(struct mm_struct *mm);
1108extern void mm_drop_all_locks(struct mm_struct *mm);
1109
1070#ifdef CONFIG_PROC_FS 1110#ifdef CONFIG_PROC_FS
1071/* From fs/proc/base.c. callers must _not_ hold the mm's exe_file_lock */ 1111/* From fs/proc/base.c. callers must _not_ hold the mm's exe_file_lock */
1072extern void added_exe_file_vma(struct mm_struct *mm); 1112extern void added_exe_file_vma(struct mm_struct *mm);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index eb7c16cc955..386edbe2cb4 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -10,6 +10,7 @@
10#include <linux/rbtree.h> 10#include <linux/rbtree.h>
11#include <linux/rwsem.h> 11#include <linux/rwsem.h>
12#include <linux/completion.h> 12#include <linux/completion.h>
13#include <linux/cpumask.h>
13#include <asm/page.h> 14#include <asm/page.h>
14#include <asm/mmu.h> 15#include <asm/mmu.h>
15 16
@@ -159,6 +160,17 @@ struct vm_area_struct {
159#endif 160#endif
160}; 161};
161 162
163struct core_thread {
164 struct task_struct *task;
165 struct core_thread *next;
166};
167
168struct core_state {
169 atomic_t nr_threads;
170 struct core_thread dumper;
171 struct completion startup;
172};
173
162struct mm_struct { 174struct mm_struct {
163 struct vm_area_struct * mmap; /* list of VMAs */ 175 struct vm_area_struct * mmap; /* list of VMAs */
164 struct rb_root mm_rb; 176 struct rb_root mm_rb;
@@ -175,7 +187,6 @@ struct mm_struct {
175 atomic_t mm_users; /* How many users with user space? */ 187 atomic_t mm_users; /* How many users with user space? */
176 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ 188 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */
177 int map_count; /* number of VMAs */ 189 int map_count; /* number of VMAs */
178 int core_waiters;
179 struct rw_semaphore mmap_sem; 190 struct rw_semaphore mmap_sem;
180 spinlock_t page_table_lock; /* Protects page tables and some counters */ 191 spinlock_t page_table_lock; /* Protects page tables and some counters */
181 192
@@ -219,15 +230,23 @@ struct mm_struct {
219 230
220 unsigned long flags; /* Must use atomic bitops to access the bits */ 231 unsigned long flags; /* Must use atomic bitops to access the bits */
221 232
222 /* coredumping support */ 233 struct core_state *core_state; /* coredumping support */
223 struct completion *core_startup_done, core_done;
224 234
225 /* aio bits */ 235 /* aio bits */
226 rwlock_t ioctx_list_lock; /* aio lock */ 236 rwlock_t ioctx_list_lock; /* aio lock */
227 struct kioctx *ioctx_list; 237 struct kioctx *ioctx_list;
228#ifdef CONFIG_MM_OWNER 238#ifdef CONFIG_MM_OWNER
229 struct task_struct *owner; /* The thread group leader that */ 239 /*
230 /* owns the mm_struct. */ 240 * "owner" points to a task that is regarded as the canonical
241 * user/owner of this mm. All of the following must be true in
242 * order for it to be changed:
243 *
244 * current == mm->owner
245 * current->mm != mm
246 * new_owner->mm == mm
247 * new_owner->alloc_lock is held
248 */
249 struct task_struct *owner;
231#endif 250#endif
232 251
233#ifdef CONFIG_PROC_FS 252#ifdef CONFIG_PROC_FS
@@ -235,6 +254,9 @@ struct mm_struct {
235 struct file *exe_file; 254 struct file *exe_file;
236 unsigned long num_exe_file_vmas; 255 unsigned long num_exe_file_vmas;
237#endif 256#endif
257#ifdef CONFIG_MMU_NOTIFIER
258 struct mmu_notifier_mm *mmu_notifier_mm;
259#endif
238}; 260};
239 261
240#endif /* _LINUX_MM_TYPES_H */ 262#endif /* _LINUX_MM_TYPES_H */
diff --git a/include/linux/mman.h b/include/linux/mman.h
index 87920a0852a..30d1073bac3 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -17,14 +17,14 @@
17 17
18extern int sysctl_overcommit_memory; 18extern int sysctl_overcommit_memory;
19extern int sysctl_overcommit_ratio; 19extern int sysctl_overcommit_ratio;
20extern atomic_t vm_committed_space; 20extern atomic_long_t vm_committed_space;
21 21
22#ifdef CONFIG_SMP 22#ifdef CONFIG_SMP
23extern void vm_acct_memory(long pages); 23extern void vm_acct_memory(long pages);
24#else 24#else
25static inline void vm_acct_memory(long pages) 25static inline void vm_acct_memory(long pages)
26{ 26{
27 atomic_add(pages, &vm_committed_space); 27 atomic_long_add(pages, &vm_committed_space);
28} 28}
29#endif 29#endif
30 30
@@ -34,6 +34,32 @@ static inline void vm_unacct_memory(long pages)
34} 34}
35 35
36/* 36/*
37 * Allow architectures to handle additional protection bits
38 */
39
40#ifndef arch_calc_vm_prot_bits
41#define arch_calc_vm_prot_bits(prot) 0
42#endif
43
44#ifndef arch_vm_get_page_prot
45#define arch_vm_get_page_prot(vm_flags) __pgprot(0)
46#endif
47
48#ifndef arch_validate_prot
49/*
50 * This is called from mprotect(). PROT_GROWSDOWN and PROT_GROWSUP have
51 * already been masked out.
52 *
53 * Returns true if the prot flags are valid
54 */
55static inline int arch_validate_prot(unsigned long prot)
56{
57 return (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM)) == 0;
58}
59#define arch_validate_prot arch_validate_prot
60#endif
61
62/*
37 * Optimisation macro. It is equivalent to: 63 * Optimisation macro. It is equivalent to:
38 * (x & bit1) ? bit2 : 0 64 * (x & bit1) ? bit2 : 0
39 * but this version is faster. 65 * but this version is faster.
@@ -51,7 +77,8 @@ calc_vm_prot_bits(unsigned long prot)
51{ 77{
52 return _calc_vm_trans(prot, PROT_READ, VM_READ ) | 78 return _calc_vm_trans(prot, PROT_READ, VM_READ ) |
53 _calc_vm_trans(prot, PROT_WRITE, VM_WRITE) | 79 _calc_vm_trans(prot, PROT_WRITE, VM_WRITE) |
54 _calc_vm_trans(prot, PROT_EXEC, VM_EXEC ); 80 _calc_vm_trans(prot, PROT_EXEC, VM_EXEC) |
81 arch_calc_vm_prot_bits(prot);
55} 82}
56 83
57/* 84/*
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 0d508ac17d6..ee6e822d599 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -111,6 +111,8 @@ struct mmc_card {
111 unsigned num_info; /* number of info strings */ 111 unsigned num_info; /* number of info strings */
112 const char **info; /* info strings */ 112 const char **info; /* info strings */
113 struct sdio_func_tuple *tuples; /* unknown common tuples */ 113 struct sdio_func_tuple *tuples; /* unknown common tuples */
114
115 struct dentry *debugfs_root;
114}; 116};
115 117
116#define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC) 118#define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC)
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index d0c3abed74c..143cebf0586 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -135,6 +135,7 @@ extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
135 struct mmc_command *, int); 135 struct mmc_command *, int);
136 136
137extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *); 137extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *);
138extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int);
138 139
139extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort); 140extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort);
140extern void mmc_release_host(struct mmc_host *host); 141extern void mmc_release_host(struct mmc_host *host);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 7ab962fa1d7..9c288c90987 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -51,8 +51,30 @@ struct mmc_ios {
51 51
52struct mmc_host_ops { 52struct mmc_host_ops {
53 void (*request)(struct mmc_host *host, struct mmc_request *req); 53 void (*request)(struct mmc_host *host, struct mmc_request *req);
54 /*
55 * Avoid calling these three functions too often or in a "fast path",
56 * since underlaying controller might implement them in an expensive
57 * and/or slow way.
58 *
59 * Also note that these functions might sleep, so don't call them
60 * in the atomic contexts!
61 *
62 * Return values for the get_ro callback should be:
63 * 0 for a read/write card
64 * 1 for a read-only card
65 * -ENOSYS when not supported (equal to NULL callback)
66 * or a negative errno value when something bad happened
67 *
68 * Return values for the get_ro callback should be:
69 * 0 for a absent card
70 * 1 for a present card
71 * -ENOSYS when not supported (equal to NULL callback)
72 * or a negative errno value when something bad happened
73 */
54 void (*set_ios)(struct mmc_host *host, struct mmc_ios *ios); 74 void (*set_ios)(struct mmc_host *host, struct mmc_ios *ios);
55 int (*get_ro)(struct mmc_host *host); 75 int (*get_ro)(struct mmc_host *host);
76 int (*get_cd)(struct mmc_host *host);
77
56 void (*enable_sdio_irq)(struct mmc_host *host, int enable); 78 void (*enable_sdio_irq)(struct mmc_host *host, int enable);
57}; 79};
58 80
@@ -89,11 +111,11 @@ struct mmc_host {
89 unsigned long caps; /* Host capabilities */ 111 unsigned long caps; /* Host capabilities */
90 112
91#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */ 113#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */
92#define MMC_CAP_MULTIWRITE (1 << 1) /* Can accurately report bytes sent to card on error */ 114#define MMC_CAP_MMC_HIGHSPEED (1 << 1) /* Can do MMC high-speed timing */
93#define MMC_CAP_MMC_HIGHSPEED (1 << 2) /* Can do MMC high-speed timing */ 115#define MMC_CAP_SD_HIGHSPEED (1 << 2) /* Can do SD high-speed timing */
94#define MMC_CAP_SD_HIGHSPEED (1 << 3) /* Can do SD high-speed timing */ 116#define MMC_CAP_SDIO_IRQ (1 << 3) /* Can signal pending SDIO IRQs */
95#define MMC_CAP_SDIO_IRQ (1 << 4) /* Can signal pending SDIO IRQs */ 117#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */
96#define MMC_CAP_SPI (1 << 5) /* Talks only SPI protocols */ 118#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */
97 119
98 /* host specific block data */ 120 /* host specific block data */
99 unsigned int max_seg_size; /* see blk_queue_max_segment_size */ 121 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
@@ -135,6 +157,8 @@ struct mmc_host {
135 struct led_trigger *led; /* activity led */ 157 struct led_trigger *led; /* activity led */
136#endif 158#endif
137 159
160 struct dentry *debugfs_root;
161
138 unsigned long private[0] ____cacheline_aligned; 162 unsigned long private[0] ____cacheline_aligned;
139}; 163};
140 164
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 4236fbf0b6f..14b81f3e523 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -16,7 +16,6 @@
16 * Based strongly on code by: 16 * Based strongly on code by:
17 * 17 *
18 * Author: Yong-iL Joh <tolkien@mizi.com> 18 * Author: Yong-iL Joh <tolkien@mizi.com>
19 * Date : $Date: 2002/06/18 12:37:30 $
20 * 19 *
21 * Author: Andrew Christian 20 * Author: Andrew Christian
22 * 15 May 2002 21 * 15 May 2002
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
index b050f4d7b41..07bee4a0d45 100644
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * include/linux/mmc/sdio_func.h 2 * include/linux/mmc/sdio_func.h
3 * 3 *
4 * Copyright 2007 Pierre Ossman 4 * Copyright 2007-2008 Pierre Ossman
5 * 5 *
6 * 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
7 * 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
@@ -46,6 +46,8 @@ struct sdio_func {
46 unsigned max_blksize; /* maximum block size */ 46 unsigned max_blksize; /* maximum block size */
47 unsigned cur_blksize; /* current block size */ 47 unsigned cur_blksize; /* current block size */
48 48
49 unsigned enable_timeout; /* max enable timeout in msec */
50
49 unsigned int state; /* function state */ 51 unsigned int state; /* function state */
50#define SDIO_STATE_PRESENT (1<<0) /* present in sysfs */ 52#define SDIO_STATE_PRESENT (1<<0) /* present in sysfs */
51 53
@@ -120,23 +122,22 @@ extern int sdio_set_block_size(struct sdio_func *func, unsigned blksz);
120extern int sdio_claim_irq(struct sdio_func *func, sdio_irq_handler_t *handler); 122extern int sdio_claim_irq(struct sdio_func *func, sdio_irq_handler_t *handler);
121extern int sdio_release_irq(struct sdio_func *func); 123extern int sdio_release_irq(struct sdio_func *func);
122 124
123extern unsigned char sdio_readb(struct sdio_func *func, 125extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz);
124 unsigned int addr, int *err_ret); 126
125extern unsigned short sdio_readw(struct sdio_func *func, 127extern u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret);
126 unsigned int addr, int *err_ret); 128extern u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret);
127extern unsigned long sdio_readl(struct sdio_func *func, 129extern u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret);
128 unsigned int addr, int *err_ret);
129 130
130extern int sdio_memcpy_fromio(struct sdio_func *func, void *dst, 131extern int sdio_memcpy_fromio(struct sdio_func *func, void *dst,
131 unsigned int addr, int count); 132 unsigned int addr, int count);
132extern int sdio_readsb(struct sdio_func *func, void *dst, 133extern int sdio_readsb(struct sdio_func *func, void *dst,
133 unsigned int addr, int count); 134 unsigned int addr, int count);
134 135
135extern void sdio_writeb(struct sdio_func *func, unsigned char b, 136extern void sdio_writeb(struct sdio_func *func, u8 b,
136 unsigned int addr, int *err_ret); 137 unsigned int addr, int *err_ret);
137extern void sdio_writew(struct sdio_func *func, unsigned short b, 138extern void sdio_writew(struct sdio_func *func, u16 b,
138 unsigned int addr, int *err_ret); 139 unsigned int addr, int *err_ret);
139extern void sdio_writel(struct sdio_func *func, unsigned long b, 140extern void sdio_writel(struct sdio_func *func, u32 b,
140 unsigned int addr, int *err_ret); 141 unsigned int addr, int *err_ret);
141 142
142extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr, 143extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr,
diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h
new file mode 100644
index 00000000000..61d19e1b7a0
--- /dev/null
+++ b/include/linux/mmiotrace.h
@@ -0,0 +1,85 @@
1#ifndef MMIOTRACE_H
2#define MMIOTRACE_H
3
4#include <linux/types.h>
5#include <linux/list.h>
6
7struct kmmio_probe;
8struct pt_regs;
9
10typedef void (*kmmio_pre_handler_t)(struct kmmio_probe *,
11 struct pt_regs *, unsigned long addr);
12typedef void (*kmmio_post_handler_t)(struct kmmio_probe *,
13 unsigned long condition, struct pt_regs *);
14
15struct kmmio_probe {
16 struct list_head list; /* kmmio internal list */
17 unsigned long addr; /* start location of the probe point */
18 unsigned long len; /* length of the probe region */
19 kmmio_pre_handler_t pre_handler; /* Called before addr is executed. */
20 kmmio_post_handler_t post_handler; /* Called after addr is executed */
21 void *private;
22};
23
24/* kmmio is active by some kmmio_probes? */
25static inline int is_kmmio_active(void)
26{
27 extern unsigned int kmmio_count;
28 return kmmio_count;
29}
30
31extern int register_kmmio_probe(struct kmmio_probe *p);
32extern void unregister_kmmio_probe(struct kmmio_probe *p);
33
34/* Called from page fault handler. */
35extern int kmmio_handler(struct pt_regs *regs, unsigned long addr);
36
37/* Called from ioremap.c */
38#ifdef CONFIG_MMIOTRACE
39extern void mmiotrace_ioremap(resource_size_t offset, unsigned long size,
40 void __iomem *addr);
41extern void mmiotrace_iounmap(volatile void __iomem *addr);
42#else
43static inline void mmiotrace_ioremap(resource_size_t offset,
44 unsigned long size, void __iomem *addr)
45{
46}
47
48static inline void mmiotrace_iounmap(volatile void __iomem *addr)
49{
50}
51#endif /* CONFIG_MMIOTRACE_HOOKS */
52
53enum mm_io_opcode {
54 MMIO_READ = 0x1, /* struct mmiotrace_rw */
55 MMIO_WRITE = 0x2, /* struct mmiotrace_rw */
56 MMIO_PROBE = 0x3, /* struct mmiotrace_map */
57 MMIO_UNPROBE = 0x4, /* struct mmiotrace_map */
58 MMIO_MARKER = 0x5, /* raw char data */
59 MMIO_UNKNOWN_OP = 0x6, /* struct mmiotrace_rw */
60};
61
62struct mmiotrace_rw {
63 resource_size_t phys; /* PCI address of register */
64 unsigned long value;
65 unsigned long pc; /* optional program counter */
66 int map_id;
67 unsigned char opcode; /* one of MMIO_{READ,WRITE,UNKNOWN_OP} */
68 unsigned char width; /* size of register access in bytes */
69};
70
71struct mmiotrace_map {
72 resource_size_t phys; /* base address in PCI space */
73 unsigned long virt; /* base virtual address */
74 unsigned long len; /* mapping size */
75 int map_id;
76 unsigned char opcode; /* MMIO_PROBE or MMIO_UNPROBE */
77};
78
79/* in kernel/trace/trace_mmiotrace.c */
80extern void enable_mmiotrace(void);
81extern void disable_mmiotrace(void);
82extern void mmio_trace_rw(struct mmiotrace_rw *rw);
83extern void mmio_trace_mapping(struct mmiotrace_map *map);
84
85#endif /* MMIOTRACE_H */
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
new file mode 100644
index 00000000000..b77486d152c
--- /dev/null
+++ b/include/linux/mmu_notifier.h
@@ -0,0 +1,279 @@
1#ifndef _LINUX_MMU_NOTIFIER_H
2#define _LINUX_MMU_NOTIFIER_H
3
4#include <linux/list.h>
5#include <linux/spinlock.h>
6#include <linux/mm_types.h>
7
8struct mmu_notifier;
9struct mmu_notifier_ops;
10
11#ifdef CONFIG_MMU_NOTIFIER
12
13/*
14 * The mmu notifier_mm structure is allocated and installed in
15 * mm->mmu_notifier_mm inside the mm_take_all_locks() protected
16 * critical section and it's released only when mm_count reaches zero
17 * in mmdrop().
18 */
19struct mmu_notifier_mm {
20 /* all mmu notifiers registerd in this mm are queued in this list */
21 struct hlist_head list;
22 /* to serialize the list modifications and hlist_unhashed */
23 spinlock_t lock;
24};
25
26struct mmu_notifier_ops {
27 /*
28 * Called either by mmu_notifier_unregister or when the mm is
29 * being destroyed by exit_mmap, always before all pages are
30 * freed. This can run concurrently with other mmu notifier
31 * methods (the ones invoked outside the mm context) and it
32 * should tear down all secondary mmu mappings and freeze the
33 * secondary mmu. If this method isn't implemented you've to
34 * be sure that nothing could possibly write to the pages
35 * through the secondary mmu by the time the last thread with
36 * tsk->mm == mm exits.
37 *
38 * As side note: the pages freed after ->release returns could
39 * be immediately reallocated by the gart at an alias physical
40 * address with a different cache model, so if ->release isn't
41 * implemented because all _software_ driven memory accesses
42 * through the secondary mmu are terminated by the time the
43 * last thread of this mm quits, you've also to be sure that
44 * speculative _hardware_ operations can't allocate dirty
45 * cachelines in the cpu that could not be snooped and made
46 * coherent with the other read and write operations happening
47 * through the gart alias address, so leading to memory
48 * corruption.
49 */
50 void (*release)(struct mmu_notifier *mn,
51 struct mm_struct *mm);
52
53 /*
54 * clear_flush_young is called after the VM is
55 * test-and-clearing the young/accessed bitflag in the
56 * pte. This way the VM will provide proper aging to the
57 * accesses to the page through the secondary MMUs and not
58 * only to the ones through the Linux pte.
59 */
60 int (*clear_flush_young)(struct mmu_notifier *mn,
61 struct mm_struct *mm,
62 unsigned long address);
63
64 /*
65 * Before this is invoked any secondary MMU is still ok to
66 * read/write to the page previously pointed to by the Linux
67 * pte because the page hasn't been freed yet and it won't be
68 * freed until this returns. If required set_page_dirty has to
69 * be called internally to this method.
70 */
71 void (*invalidate_page)(struct mmu_notifier *mn,
72 struct mm_struct *mm,
73 unsigned long address);
74
75 /*
76 * invalidate_range_start() and invalidate_range_end() must be
77 * paired and are called only when the mmap_sem and/or the
78 * locks protecting the reverse maps are held. The subsystem
79 * must guarantee that no additional references are taken to
80 * the pages in the range established between the call to
81 * invalidate_range_start() and the matching call to
82 * invalidate_range_end().
83 *
84 * Invalidation of multiple concurrent ranges may be
85 * optionally permitted by the driver. Either way the
86 * establishment of sptes is forbidden in the range passed to
87 * invalidate_range_begin/end for the whole duration of the
88 * invalidate_range_begin/end critical section.
89 *
90 * invalidate_range_start() is called when all pages in the
91 * range are still mapped and have at least a refcount of one.
92 *
93 * invalidate_range_end() is called when all pages in the
94 * range have been unmapped and the pages have been freed by
95 * the VM.
96 *
97 * The VM will remove the page table entries and potentially
98 * the page between invalidate_range_start() and
99 * invalidate_range_end(). If the page must not be freed
100 * because of pending I/O or other circumstances then the
101 * invalidate_range_start() callback (or the initial mapping
102 * by the driver) must make sure that the refcount is kept
103 * elevated.
104 *
105 * If the driver increases the refcount when the pages are
106 * initially mapped into an address space then either
107 * invalidate_range_start() or invalidate_range_end() may
108 * decrease the refcount. If the refcount is decreased on
109 * invalidate_range_start() then the VM can free pages as page
110 * table entries are removed. If the refcount is only
111 * droppped on invalidate_range_end() then the driver itself
112 * will drop the last refcount but it must take care to flush
113 * any secondary tlb before doing the final free on the
114 * page. Pages will no longer be referenced by the linux
115 * address space but may still be referenced by sptes until
116 * the last refcount is dropped.
117 */
118 void (*invalidate_range_start)(struct mmu_notifier *mn,
119 struct mm_struct *mm,
120 unsigned long start, unsigned long end);
121 void (*invalidate_range_end)(struct mmu_notifier *mn,
122 struct mm_struct *mm,
123 unsigned long start, unsigned long end);
124};
125
126/*
127 * The notifier chains are protected by mmap_sem and/or the reverse map
128 * semaphores. Notifier chains are only changed when all reverse maps and
129 * the mmap_sem locks are taken.
130 *
131 * Therefore notifier chains can only be traversed when either
132 *
133 * 1. mmap_sem is held.
134 * 2. One of the reverse map locks is held (i_mmap_lock or anon_vma->lock).
135 * 3. No other concurrent thread can access the list (release)
136 */
137struct mmu_notifier {
138 struct hlist_node hlist;
139 const struct mmu_notifier_ops *ops;
140};
141
142static inline int mm_has_notifiers(struct mm_struct *mm)
143{
144 return unlikely(mm->mmu_notifier_mm);
145}
146
147extern int mmu_notifier_register(struct mmu_notifier *mn,
148 struct mm_struct *mm);
149extern int __mmu_notifier_register(struct mmu_notifier *mn,
150 struct mm_struct *mm);
151extern void mmu_notifier_unregister(struct mmu_notifier *mn,
152 struct mm_struct *mm);
153extern void __mmu_notifier_mm_destroy(struct mm_struct *mm);
154extern void __mmu_notifier_release(struct mm_struct *mm);
155extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm,
156 unsigned long address);
157extern void __mmu_notifier_invalidate_page(struct mm_struct *mm,
158 unsigned long address);
159extern void __mmu_notifier_invalidate_range_start(struct mm_struct *mm,
160 unsigned long start, unsigned long end);
161extern void __mmu_notifier_invalidate_range_end(struct mm_struct *mm,
162 unsigned long start, unsigned long end);
163
164static inline void mmu_notifier_release(struct mm_struct *mm)
165{
166 if (mm_has_notifiers(mm))
167 __mmu_notifier_release(mm);
168}
169
170static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
171 unsigned long address)
172{
173 if (mm_has_notifiers(mm))
174 return __mmu_notifier_clear_flush_young(mm, address);
175 return 0;
176}
177
178static inline void mmu_notifier_invalidate_page(struct mm_struct *mm,
179 unsigned long address)
180{
181 if (mm_has_notifiers(mm))
182 __mmu_notifier_invalidate_page(mm, address);
183}
184
185static inline void mmu_notifier_invalidate_range_start(struct mm_struct *mm,
186 unsigned long start, unsigned long end)
187{
188 if (mm_has_notifiers(mm))
189 __mmu_notifier_invalidate_range_start(mm, start, end);
190}
191
192static inline void mmu_notifier_invalidate_range_end(struct mm_struct *mm,
193 unsigned long start, unsigned long end)
194{
195 if (mm_has_notifiers(mm))
196 __mmu_notifier_invalidate_range_end(mm, start, end);
197}
198
199static inline void mmu_notifier_mm_init(struct mm_struct *mm)
200{
201 mm->mmu_notifier_mm = NULL;
202}
203
204static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
205{
206 if (mm_has_notifiers(mm))
207 __mmu_notifier_mm_destroy(mm);
208}
209
210/*
211 * These two macros will sometime replace ptep_clear_flush.
212 * ptep_clear_flush is impleemnted as macro itself, so this also is
213 * implemented as a macro until ptep_clear_flush will converted to an
214 * inline function, to diminish the risk of compilation failure. The
215 * invalidate_page method over time can be moved outside the PT lock
216 * and these two macros can be later removed.
217 */
218#define ptep_clear_flush_notify(__vma, __address, __ptep) \
219({ \
220 pte_t __pte; \
221 struct vm_area_struct *___vma = __vma; \
222 unsigned long ___address = __address; \
223 __pte = ptep_clear_flush(___vma, ___address, __ptep); \
224 mmu_notifier_invalidate_page(___vma->vm_mm, ___address); \
225 __pte; \
226})
227
228#define ptep_clear_flush_young_notify(__vma, __address, __ptep) \
229({ \
230 int __young; \
231 struct vm_area_struct *___vma = __vma; \
232 unsigned long ___address = __address; \
233 __young = ptep_clear_flush_young(___vma, ___address, __ptep); \
234 __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \
235 ___address); \
236 __young; \
237})
238
239#else /* CONFIG_MMU_NOTIFIER */
240
241static inline void mmu_notifier_release(struct mm_struct *mm)
242{
243}
244
245static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
246 unsigned long address)
247{
248 return 0;
249}
250
251static inline void mmu_notifier_invalidate_page(struct mm_struct *mm,
252 unsigned long address)
253{
254}
255
256static inline void mmu_notifier_invalidate_range_start(struct mm_struct *mm,
257 unsigned long start, unsigned long end)
258{
259}
260
261static inline void mmu_notifier_invalidate_range_end(struct mm_struct *mm,
262 unsigned long start, unsigned long end)
263{
264}
265
266static inline void mmu_notifier_mm_init(struct mm_struct *mm)
267{
268}
269
270static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
271{
272}
273
274#define ptep_clear_flush_young_notify ptep_clear_flush_young
275#define ptep_clear_flush_notify ptep_clear_flush
276
277#endif /* CONFIG_MMU_NOTIFIER */
278
279#endif /* _LINUX_MMU_NOTIFIER_H */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index c463cd8a15a..443bc7cd8c6 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -703,7 +703,7 @@ extern struct pglist_data *next_online_pgdat(struct pglist_data *pgdat);
703extern struct zone *next_zone(struct zone *zone); 703extern struct zone *next_zone(struct zone *zone);
704 704
705/** 705/**
706 * for_each_pgdat - helper macro to iterate over all nodes 706 * for_each_online_pgdat - helper macro to iterate over all online nodes
707 * @pgdat - pointer to a pg_data_t variable 707 * @pgdat - pointer to a pg_data_t variable
708 */ 708 */
709#define for_each_online_pgdat(pgdat) \ 709#define for_each_online_pgdat(pgdat) \
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index d73eceaa7af..c4db5827963 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -159,6 +159,15 @@ struct ap_device_id {
159 159
160#define AP_DEVICE_ID_MATCH_DEVICE_TYPE 0x01 160#define AP_DEVICE_ID_MATCH_DEVICE_TYPE 0x01
161 161
162/* s390 css bus devices (subchannels) */
163struct css_device_id {
164 __u8 match_flags;
165 __u8 type; /* subchannel type */
166 __u16 pad2;
167 __u32 pad3;
168 kernel_ulong_t driver_data;
169};
170
162#define ACPI_ID_LEN 16 /* only 9 bytes needed here, 16 bytes are used */ 171#define ACPI_ID_LEN 16 /* only 9 bytes needed here, 16 bytes are used */
163 /* to workaround crosscompile issues */ 172 /* to workaround crosscompile issues */
164 173
@@ -375,7 +384,8 @@ struct virtio_device_id {
375 384
376struct i2c_device_id { 385struct i2c_device_id {
377 char name[I2C_NAME_SIZE]; 386 char name[I2C_NAME_SIZE];
378 kernel_ulong_t driver_data; /* Data private to the driver */ 387 kernel_ulong_t driver_data /* Data private to the driver */
388 __attribute__((aligned(sizeof(kernel_ulong_t))));
379}; 389};
380 390
381 391
diff --git a/include/linux/module.h b/include/linux/module.h
index 3e03b1acbc9..68e09557c95 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -23,7 +23,7 @@
23/* Not Yet Implemented */ 23/* Not Yet Implemented */
24#define MODULE_SUPPORTED_DEVICE(name) 24#define MODULE_SUPPORTED_DEVICE(name)
25 25
26/* v850 toolchain uses a `_' prefix for all user symbols */ 26/* some toolchains uses a `_' prefix for all user symbols */
27#ifndef MODULE_SYMBOL_PREFIX 27#ifndef MODULE_SYMBOL_PREFIX
28#define MODULE_SYMBOL_PREFIX "" 28#define MODULE_SYMBOL_PREFIX ""
29#endif 29#endif
@@ -249,27 +249,30 @@ struct module
249 249
250 /* Exported symbols */ 250 /* Exported symbols */
251 const struct kernel_symbol *syms; 251 const struct kernel_symbol *syms;
252 unsigned int num_syms;
253 const unsigned long *crcs; 252 const unsigned long *crcs;
253 unsigned int num_syms;
254 254
255 /* GPL-only exported symbols. */ 255 /* GPL-only exported symbols. */
256 const struct kernel_symbol *gpl_syms;
257 unsigned int num_gpl_syms; 256 unsigned int num_gpl_syms;
257 const struct kernel_symbol *gpl_syms;
258 const unsigned long *gpl_crcs; 258 const unsigned long *gpl_crcs;
259 259
260#ifdef CONFIG_UNUSED_SYMBOLS
260 /* unused exported symbols. */ 261 /* unused exported symbols. */
261 const struct kernel_symbol *unused_syms; 262 const struct kernel_symbol *unused_syms;
262 unsigned int num_unused_syms;
263 const unsigned long *unused_crcs; 263 const unsigned long *unused_crcs;
264 unsigned int num_unused_syms;
265
264 /* GPL-only, unused exported symbols. */ 266 /* GPL-only, unused exported symbols. */
265 const struct kernel_symbol *unused_gpl_syms;
266 unsigned int num_unused_gpl_syms; 267 unsigned int num_unused_gpl_syms;
268 const struct kernel_symbol *unused_gpl_syms;
267 const unsigned long *unused_gpl_crcs; 269 const unsigned long *unused_gpl_crcs;
270#endif
268 271
269 /* symbols that will be GPL-only in the near future. */ 272 /* symbols that will be GPL-only in the near future. */
270 const struct kernel_symbol *gpl_future_syms; 273 const struct kernel_symbol *gpl_future_syms;
271 unsigned int num_gpl_future_syms;
272 const unsigned long *gpl_future_crcs; 274 const unsigned long *gpl_future_crcs;
275 unsigned int num_gpl_future_syms;
273 276
274 /* Exception table */ 277 /* Exception table */
275 unsigned int num_exentries; 278 unsigned int num_exentries;
@@ -285,10 +288,10 @@ struct module
285 void *module_core; 288 void *module_core;
286 289
287 /* Here are the sizes of the init and core sections */ 290 /* Here are the sizes of the init and core sections */
288 unsigned long init_size, core_size; 291 unsigned int init_size, core_size;
289 292
290 /* The size of the executable code in each section. */ 293 /* The size of the executable code in each section. */
291 unsigned long init_text_size, core_text_size; 294 unsigned int init_text_size, core_text_size;
292 295
293 /* The handle returned from unwind_add_table. */ 296 /* The handle returned from unwind_add_table. */
294 void *unwind_info; 297 void *unwind_info;
@@ -300,29 +303,15 @@ struct module
300 303
301#ifdef CONFIG_GENERIC_BUG 304#ifdef CONFIG_GENERIC_BUG
302 /* Support for BUG */ 305 /* Support for BUG */
306 unsigned num_bugs;
303 struct list_head bug_list; 307 struct list_head bug_list;
304 struct bug_entry *bug_table; 308 struct bug_entry *bug_table;
305 unsigned num_bugs;
306#endif
307
308#ifdef CONFIG_MODULE_UNLOAD
309 /* Reference counts */
310 struct module_ref ref[NR_CPUS];
311
312 /* What modules depend on me? */
313 struct list_head modules_which_use_me;
314
315 /* Who is waiting for us to be unloaded */
316 struct task_struct *waiter;
317
318 /* Destruction function. */
319 void (*exit)(void);
320#endif 309#endif
321 310
322#ifdef CONFIG_KALLSYMS 311#ifdef CONFIG_KALLSYMS
323 /* We keep the symbol and string tables for kallsyms. */ 312 /* We keep the symbol and string tables for kallsyms. */
324 Elf_Sym *symtab; 313 Elf_Sym *symtab;
325 unsigned long num_symtab; 314 unsigned int num_symtab;
326 char *strtab; 315 char *strtab;
327 316
328 /* Section attributes */ 317 /* Section attributes */
@@ -342,6 +331,21 @@ struct module
342 struct marker *markers; 331 struct marker *markers;
343 unsigned int num_markers; 332 unsigned int num_markers;
344#endif 333#endif
334
335#ifdef CONFIG_MODULE_UNLOAD
336 /* What modules depend on me? */
337 struct list_head modules_which_use_me;
338
339 /* Who is waiting for us to be unloaded */
340 struct task_struct *waiter;
341
342 /* Destruction function. */
343 void (*exit)(void);
344
345 /* Reference counts */
346 struct module_ref ref[NR_CPUS];
347#endif
348
345}; 349};
346#ifndef MODULE_ARCH_INIT 350#ifndef MODULE_ARCH_INIT
347#define MODULE_ARCH_INIT {} 351#define MODULE_ARCH_INIT {}
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 4374d1adeb4..b5efaa2132a 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -47,7 +47,7 @@ struct vfsmount {
47 struct list_head mnt_child; /* and going through their mnt_child */ 47 struct list_head mnt_child; /* and going through their mnt_child */
48 int mnt_flags; 48 int mnt_flags;
49 /* 4 bytes hole on 64bits arches */ 49 /* 4 bytes hole on 64bits arches */
50 char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ 50 const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
51 struct list_head mnt_list; 51 struct list_head mnt_list;
52 struct list_head mnt_expire; /* link in fs-specific expiry list */ 52 struct list_head mnt_expire; /* link in fs-specific expiry list */
53 struct list_head mnt_share; /* circular list of shared mounts */ 53 struct list_head mnt_share; /* circular list of shared mounts */
diff --git a/include/linux/mpage.h b/include/linux/mpage.h
index 068a0c9946a..5c42821da2d 100644
--- a/include/linux/mpage.h
+++ b/include/linux/mpage.h
@@ -11,11 +11,21 @@
11 */ 11 */
12#ifdef CONFIG_BLOCK 12#ifdef CONFIG_BLOCK
13 13
14struct mpage_data {
15 struct bio *bio;
16 sector_t last_block_in_bio;
17 get_block_t *get_block;
18 unsigned use_writepage;
19};
20
14struct writeback_control; 21struct writeback_control;
15 22
23struct bio *mpage_bio_submit(int rw, struct bio *bio);
16int mpage_readpages(struct address_space *mapping, struct list_head *pages, 24int mpage_readpages(struct address_space *mapping, struct list_head *pages,
17 unsigned nr_pages, get_block_t get_block); 25 unsigned nr_pages, get_block_t get_block);
18int mpage_readpage(struct page *page, get_block_t get_block); 26int mpage_readpage(struct page *page, get_block_t get_block);
27int __mpage_writepage(struct page *page, struct writeback_control *wbc,
28 void *data);
19int mpage_writepages(struct address_space *mapping, 29int mpage_writepages(struct address_space *mapping,
20 struct writeback_control *wbc, get_block_t get_block); 30 struct writeback_control *wbc, get_block_t get_block);
21int mpage_writepage(struct page *page, get_block_t *get_block, 31int mpage_writepage(struct page *page, get_block_t *get_block,
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index de4decfa1bf..07112ee9293 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -144,11 +144,37 @@ static inline int ip_mroute_opt(int opt)
144} 144}
145#endif 145#endif
146 146
147#ifdef CONFIG_IP_MROUTE
147extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int); 148extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int);
148extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); 149extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
149extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); 150extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
150extern void ip_mr_init(void); 151extern int ip_mr_init(void);
152#else
153static inline
154int ip_mroute_setsockopt(struct sock *sock,
155 int optname, char __user *optval, int optlen)
156{
157 return -ENOPROTOOPT;
158}
159
160static inline
161int ip_mroute_getsockopt(struct sock *sock,
162 int optname, char __user *optval, int __user *optlen)
163{
164 return -ENOPROTOOPT;
165}
151 166
167static inline
168int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
169{
170 return -ENOIOCTLCMD;
171}
172
173static inline int ip_mr_init(void)
174{
175 return 0;
176}
177#endif
152 178
153struct vif_device 179struct vif_device
154{ 180{
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index e7989593142..5cf50473a10 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -131,11 +131,44 @@ static inline int ip6_mroute_opt(int opt)
131 131
132struct sock; 132struct sock;
133 133
134#ifdef CONFIG_IPV6_MROUTE
134extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, int); 135extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, int);
135extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *); 136extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
136extern int ip6_mr_input(struct sk_buff *skb); 137extern int ip6_mr_input(struct sk_buff *skb);
137extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg); 138extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);
138extern void ip6_mr_init(void); 139extern int ip6_mr_init(void);
140extern void ip6_mr_cleanup(void);
141#else
142static inline
143int ip6_mroute_setsockopt(struct sock *sock,
144 int optname, char __user *optval, int optlen)
145{
146 return -ENOPROTOOPT;
147}
148
149static inline
150int ip6_mroute_getsockopt(struct sock *sock,
151 int optname, char __user *optval, int __user *optlen)
152{
153 return -ENOPROTOOPT;
154}
155
156static inline
157int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg)
158{
159 return -ENOIOCTLCMD;
160}
161
162static inline int ip6_mr_init(void)
163{
164 return 0;
165}
166
167static inline void ip6_mr_cleanup(void)
168{
169 return;
170}
171#endif
139 172
140struct mif_device 173struct mif_device
141{ 174{
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index b03b2745741..ba63858056c 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -2,11 +2,11 @@
2#define _LINUX_MSDOS_FS_H 2#define _LINUX_MSDOS_FS_H
3 3
4#include <linux/magic.h> 4#include <linux/magic.h>
5#include <asm/byteorder.h>
5 6
6/* 7/*
7 * The MS-DOS filesystem constants/structures 8 * The MS-DOS filesystem constants/structures
8 */ 9 */
9#include <asm/byteorder.h>
10 10
11#define SECTOR_SIZE 512 /* sector size (bytes) */ 11#define SECTOR_SIZE 512 /* sector size (bytes) */
12#define SECTOR_BITS 9 /* log2(SECTOR_SIZE) */ 12#define SECTOR_BITS 9 /* log2(SECTOR_SIZE) */
@@ -57,12 +57,6 @@
57#define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */ 57#define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */
58#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */ 58#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */
59 59
60/* media of boot sector */
61static inline int fat_valid_media(u8 media)
62{
63 return 0xf8 <= media || media == 0xf0;
64}
65
66#define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \ 60#define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \
67 MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x)) 61 MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x))
68 62
@@ -95,24 +89,22 @@ static inline int fat_valid_media(u8 media)
95#define IS_FSINFO(x) (le32_to_cpu((x)->signature1) == FAT_FSINFO_SIG1 \ 89#define IS_FSINFO(x) (le32_to_cpu((x)->signature1) == FAT_FSINFO_SIG1 \
96 && le32_to_cpu((x)->signature2) == FAT_FSINFO_SIG2) 90 && le32_to_cpu((x)->signature2) == FAT_FSINFO_SIG2)
97 91
92struct __fat_dirent {
93 long d_ino;
94 __kernel_off_t d_off;
95 unsigned short d_reclen;
96 char d_name[256]; /* We must not include limits.h! */
97};
98
98/* 99/*
99 * ioctl commands 100 * ioctl commands
100 */ 101 */
101#define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct dirent [2]) 102#define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct __fat_dirent[2])
102#define VFAT_IOCTL_READDIR_SHORT _IOR('r', 2, struct dirent [2]) 103#define VFAT_IOCTL_READDIR_SHORT _IOR('r', 2, struct __fat_dirent[2])
103/* <linux/videotext.h> has used 0x72 ('r') in collision, so skip a few */ 104/* <linux/videotext.h> has used 0x72 ('r') in collision, so skip a few */
104#define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32) 105#define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32)
105#define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32) 106#define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32)
106 107
107/*
108 * vfat shortname flags
109 */
110#define VFAT_SFN_DISPLAY_LOWER 0x0001 /* convert to lowercase for display */
111#define VFAT_SFN_DISPLAY_WIN95 0x0002 /* emulate win95 rule for display */
112#define VFAT_SFN_DISPLAY_WINNT 0x0004 /* emulate winnt rule for display */
113#define VFAT_SFN_CREATE_WIN95 0x0100 /* emulate win95 rule for create */
114#define VFAT_SFN_CREATE_WINNT 0x0200 /* emulate winnt rule for create */
115
116struct fat_boot_sector { 108struct fat_boot_sector {
117 __u8 ignored[3]; /* Boot strap short or near jump */ 109 __u8 ignored[3]; /* Boot strap short or near jump */
118 __u8 system_id[8]; /* Name - can be used to special case 110 __u8 system_id[8]; /* Name - can be used to special case
@@ -174,14 +166,6 @@ struct msdos_dir_slot {
174 __u8 name11_12[4]; /* last 2 characters in name */ 166 __u8 name11_12[4]; /* last 2 characters in name */
175}; 167};
176 168
177struct fat_slot_info {
178 loff_t i_pos; /* on-disk position of directory entry */
179 loff_t slot_off; /* offset for slot or de start */
180 int nr_slots; /* number of slots + 1(de) in filename */
181 struct msdos_dir_entry *de;
182 struct buffer_head *bh;
183};
184
185#ifdef __KERNEL__ 169#ifdef __KERNEL__
186 170
187#include <linux/buffer_head.h> 171#include <linux/buffer_head.h>
@@ -190,6 +174,15 @@ struct fat_slot_info {
190#include <linux/fs.h> 174#include <linux/fs.h>
191#include <linux/mutex.h> 175#include <linux/mutex.h>
192 176
177/*
178 * vfat shortname flags
179 */
180#define VFAT_SFN_DISPLAY_LOWER 0x0001 /* convert to lowercase for display */
181#define VFAT_SFN_DISPLAY_WIN95 0x0002 /* emulate win95 rule for display */
182#define VFAT_SFN_DISPLAY_WINNT 0x0004 /* emulate winnt rule for display */
183#define VFAT_SFN_CREATE_WIN95 0x0100 /* emulate win95 rule for create */
184#define VFAT_SFN_CREATE_WINNT 0x0200 /* emulate winnt rule for create */
185
193struct fat_mount_options { 186struct fat_mount_options {
194 uid_t fs_uid; 187 uid_t fs_uid;
195 gid_t fs_gid; 188 gid_t fs_gid;
@@ -208,10 +201,10 @@ struct fat_mount_options {
208 utf8:1, /* Use of UTF-8 character set (Default) */ 201 utf8:1, /* Use of UTF-8 character set (Default) */
209 unicode_xlate:1, /* create escape sequences for unhandled Unicode */ 202 unicode_xlate:1, /* create escape sequences for unhandled Unicode */
210 numtail:1, /* Does first alias have a numeric '~1' type tail? */ 203 numtail:1, /* Does first alias have a numeric '~1' type tail? */
211 atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */
212 flush:1, /* write things quickly */ 204 flush:1, /* write things quickly */
213 nocase:1, /* Does this need case conversion? 0=need case conversion*/ 205 nocase:1, /* Does this need case conversion? 0=need case conversion*/
214 usefree:1; /* Use free_clusters for FAT32 */ 206 usefree:1, /* Use free_clusters for FAT32 */
207 tz_utc:1; /* Filesystem timestamps are in UTC */
215}; 208};
216 209
217#define FAT_HASH_BITS 8 210#define FAT_HASH_BITS 8
@@ -273,6 +266,14 @@ struct msdos_inode_info {
273 struct inode vfs_inode; 266 struct inode vfs_inode;
274}; 267};
275 268
269struct fat_slot_info {
270 loff_t i_pos; /* on-disk position of directory entry */
271 loff_t slot_off; /* offset for slot or de start */
272 int nr_slots; /* number of slots + 1(de) in filename */
273 struct msdos_dir_entry *de;
274 struct buffer_head *bh;
275};
276
276static inline struct msdos_sb_info *MSDOS_SB(struct super_block *sb) 277static inline struct msdos_sb_info *MSDOS_SB(struct super_block *sb)
277{ 278{
278 return sb->s_fs_info; 279 return sb->s_fs_info;
@@ -334,6 +335,12 @@ static inline void fatwchar_to16(__u8 *dst, const wchar_t *src, size_t len)
334#endif 335#endif
335} 336}
336 337
338/* media of boot sector */
339static inline int fat_valid_media(u8 media)
340{
341 return 0xf8 <= media || media == 0xf0;
342}
343
337/* fat/cache.c */ 344/* fat/cache.c */
338extern void fat_cache_inval_inode(struct inode *inode); 345extern void fat_cache_inval_inode(struct inode *inode);
339extern int fat_get_cluster(struct inode *inode, int cluster, 346extern int fat_get_cluster(struct inode *inode, int cluster,
@@ -428,8 +435,9 @@ extern int fat_flush_inodes(struct super_block *sb, struct inode *i1,
428extern void fat_fs_panic(struct super_block *s, const char *fmt, ...); 435extern void fat_fs_panic(struct super_block *s, const char *fmt, ...);
429extern void fat_clusters_flush(struct super_block *sb); 436extern void fat_clusters_flush(struct super_block *sb);
430extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster); 437extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster);
431extern int date_dos2unix(unsigned short time, unsigned short date); 438extern int date_dos2unix(unsigned short time, unsigned short date, int tz_utc);
432extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date); 439extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date,
440 int tz_utc);
433extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs); 441extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs);
434 442
435int fat_cache_init(void); 443int fat_cache_init(void);
diff --git a/include/linux/msg.h b/include/linux/msg.h
index 6f3b8e79a99..56abf1558fd 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -64,11 +64,11 @@ struct msginfo {
64#define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */ 64#define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */
65 65
66/* unused */ 66/* unused */
67#define MSGPOOL (MSGMNI * MSGMNB) /* size in bytes of message pool */ 67#define MSGPOOL (MSGMNI * MSGMNB / 1024) /* size in kbytes of message pool */
68#define MSGTQL MSGMNB /* number of system message headers */ 68#define MSGTQL MSGMNB /* number of system message headers */
69#define MSGMAP MSGMNB /* number of entries in message map */ 69#define MSGMAP MSGMNB /* number of entries in message map */
70#define MSGSSZ 16 /* message segment size */ 70#define MSGSSZ 16 /* message segment size */
71#define __MSGSEG (MSGPOOL / MSGSSZ) /* max no. of segments */ 71#define __MSGSEG ((MSGPOOL * 1024) / MSGSSZ) /* max no. of segments */
72#define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff) 72#define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff)
73 73
74#ifdef __KERNEL__ 74#ifdef __KERNEL__
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index 9a6e2f953cb..310e6160641 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: blktrans.h,v 1.6 2005/11/07 11:14:54 gleixner Exp $
3 *
4 * (C) 2003 David Woodhouse <dwmw2@infradead.org> 2 * (C) 2003 David Woodhouse <dwmw2@infradead.org>
5 * 3 *
6 * Interface to Linux block layer for MTD 'translation layers'. 4 * Interface to Linux block layer for MTD 'translation layers'.
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index b0ddf4b2586..d6fb115f5a0 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -1,7 +1,6 @@
1 1
2/* Common Flash Interface structures 2/* Common Flash Interface structures
3 * See http://support.intel.com/design/flash/technote/index.htm 3 * See http://support.intel.com/design/flash/technote/index.htm
4 * $Id: cfi.h,v 1.57 2005/11/15 23:28:17 tpoynor Exp $
5 */ 4 */
6 5
7#ifndef __MTD_CFI_H__ 6#ifndef __MTD_CFI_H__
diff --git a/include/linux/mtd/cfi_endian.h b/include/linux/mtd/cfi_endian.h
index 25724f7d386..d802f7736be 100644
--- a/include/linux/mtd/cfi_endian.h
+++ b/include/linux/mtd/cfi_endian.h
@@ -1,8 +1,3 @@
1/*
2 * $Id: cfi_endian.h,v 1.11 2002/01/30 23:20:48 awozniak Exp $
3 *
4 */
5
6#include <asm/byteorder.h> 1#include <asm/byteorder.h>
7 2
8#ifndef CONFIG_MTD_CFI_ADV_OPTIONS 3#ifndef CONFIG_MTD_CFI_ADV_OPTIONS
diff --git a/include/linux/mtd/concat.h b/include/linux/mtd/concat.h
index ed8dc675521..c02f3d264ec 100644
--- a/include/linux/mtd/concat.h
+++ b/include/linux/mtd/concat.h
@@ -4,8 +4,6 @@
4 * (C) 2002 Robert Kaiser <rkaiser@sysgo.de> 4 * (C) 2002 Robert Kaiser <rkaiser@sysgo.de>
5 * 5 *
6 * This code is GPL 6 * This code is GPL
7 *
8 * $Id: concat.h,v 1.1 2002/03/08 16:34:36 rkaiser Exp $
9 */ 7 */
10 8
11#ifndef MTD_CONCAT_H 9#ifndef MTD_CONCAT_H
diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h
index 9addd073bf1..0a6d516ab71 100644
--- a/include/linux/mtd/doc2000.h
+++ b/include/linux/mtd/doc2000.h
@@ -6,8 +6,6 @@
6 * Copyright (C) 2002-2003 Greg Ungerer <gerg@snapgear.com> 6 * Copyright (C) 2002-2003 Greg Ungerer <gerg@snapgear.com>
7 * Copyright (C) 2002-2003 SnapGear Inc 7 * Copyright (C) 2002-2003 SnapGear Inc
8 * 8 *
9 * $Id: doc2000.h,v 1.25 2005/11/07 11:14:54 gleixner Exp $
10 *
11 * Released under GPL 9 * Released under GPL
12 */ 10 */
13 11
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h
index 39e7d2a1be9..08dd131301c 100644
--- a/include/linux/mtd/flashchip.h
+++ b/include/linux/mtd/flashchip.h
@@ -5,9 +5,6 @@
5 * Contains information about the location and state of a given flash device 5 * Contains information about the location and state of a given flash device
6 * 6 *
7 * (C) 2000 Red Hat. GPLd. 7 * (C) 2000 Red Hat. GPLd.
8 *
9 * $Id: flashchip.h,v 1.18 2005/11/07 11:14:54 gleixner Exp $
10 *
11 */ 8 */
12 9
13#ifndef __MTD_FLASHCHIP_H__ 10#ifndef __MTD_FLASHCHIP_H__
diff --git a/include/linux/mtd/ftl.h b/include/linux/mtd/ftl.h
index d9960911330..0be442f881d 100644
--- a/include/linux/mtd/ftl.h
+++ b/include/linux/mtd/ftl.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: ftl.h,v 1.7 2005/11/07 11:14:54 gleixner Exp $
3 *
4 * Derived from (and probably identical to): 2 * Derived from (and probably identical to):
5 * ftl.h 1.7 1999/10/25 20:23:17 3 * ftl.h 1.7 1999/10/25 20:23:17
6 * 4 *
diff --git a/include/linux/mtd/gen_probe.h b/include/linux/mtd/gen_probe.h
index 256e7342ed1..df362ddf294 100644
--- a/include/linux/mtd/gen_probe.h
+++ b/include/linux/mtd/gen_probe.h
@@ -1,7 +1,6 @@
1/* 1/*
2 * (C) 2001, 2001 Red Hat, Inc. 2 * (C) 2001, 2001 Red Hat, Inc.
3 * GPL'd 3 * GPL'd
4 * $Id: gen_probe.h,v 1.4 2005/11/07 11:14:54 gleixner Exp $
5 */ 4 */
6 5
7#ifndef __LINUX_MTD_GEN_PROBE_H__ 6#ifndef __LINUX_MTD_GEN_PROBE_H__
diff --git a/include/linux/mtd/inftl.h b/include/linux/mtd/inftl.h
index 85fd041d44a..64ee53ce95a 100644
--- a/include/linux/mtd/inftl.h
+++ b/include/linux/mtd/inftl.h
@@ -2,8 +2,6 @@
2 * inftl.h -- defines to support the Inverse NAND Flash Translation Layer 2 * inftl.h -- defines to support the Inverse NAND Flash Translation Layer
3 * 3 *
4 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) 4 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
5 *
6 * $Id: inftl.h,v 1.7 2005/06/13 13:08:45 sean Exp $
7 */ 5 */
8 6
9#ifndef __MTD_INFTL_H__ 7#ifndef __MTD_INFTL_H__
@@ -52,8 +50,6 @@ struct INFTLrecord {
52int INFTL_mount(struct INFTLrecord *s); 50int INFTL_mount(struct INFTLrecord *s);
53int INFTL_formatblock(struct INFTLrecord *s, int block); 51int INFTL_formatblock(struct INFTLrecord *s, int block);
54 52
55extern char inftlmountrev[];
56
57void INFTL_dumptables(struct INFTLrecord *s); 53void INFTL_dumptables(struct INFTLrecord *s);
58void INFTL_dumpVUchains(struct INFTLrecord *s); 54void INFTL_dumpVUchains(struct INFTLrecord *s);
59 55
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index a9fae032ba8..aa30244492c 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -1,6 +1,5 @@
1 1
2/* Overhauled routines for dealing with different mmap regions of flash */ 2/* Overhauled routines for dealing with different mmap regions of flash */
3/* $Id: map.h,v 1.54 2005/11/07 11:14:54 gleixner Exp $ */
4 3
5#ifndef __LINUX_MTD_MAP_H__ 4#ifndef __LINUX_MTD_MAP_H__
6#define __LINUX_MTD_MAP_H__ 5#define __LINUX_MTD_MAP_H__
@@ -189,7 +188,7 @@ typedef union {
189*/ 188*/
190 189
191struct map_info { 190struct map_info {
192 char *name; 191 const char *name;
193 unsigned long size; 192 unsigned long size;
194 resource_size_t phys; 193 resource_size_t phys;
195#define NO_XIP (-1UL) 194#define NO_XIP (-1UL)
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 245f9098e17..4ed40caff4e 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: mtd.h,v 1.61 2005/11/07 11:14:54 gleixner Exp $
3 *
4 * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. 2 * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al.
5 * 3 *
6 * Released under GPL 4 * Released under GPL
@@ -121,7 +119,7 @@ struct mtd_info {
121 u_int32_t oobavail; // Available OOB bytes per block 119 u_int32_t oobavail; // Available OOB bytes per block
122 120
123 // Kernel-only stuff starts here. 121 // Kernel-only stuff starts here.
124 char *name; 122 const char *name;
125 int index; 123 int index;
126 124
127 /* ecc layout structure pointer - read only ! */ 125 /* ecc layout structure pointer - read only ! */
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index c42bc7f533a..83f678702df 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -1,12 +1,10 @@
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@mvhi.com> 4 * Copyright (c) 2000 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 * $Id: nand.h,v 1.74 2005/09/15 13:58:50 vwool Exp $
9 *
10 * 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
11 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
@@ -179,6 +177,7 @@ typedef enum {
179#define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING)) 177#define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING))
180#define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG)) 178#define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG))
181#define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK)) 179#define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK))
180#define NAND_SUBPAGE_READ(chip) ((chip->ecc.mode == NAND_ECC_SOFT))
182 181
183/* Mask to zero out the chip options, which come from the id table */ 182/* Mask to zero out the chip options, which come from the id table */
184#define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR) 183#define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR)
@@ -276,6 +275,10 @@ struct nand_ecc_ctrl {
276 int (*read_page)(struct mtd_info *mtd, 275 int (*read_page)(struct mtd_info *mtd,
277 struct nand_chip *chip, 276 struct nand_chip *chip,
278 uint8_t *buf); 277 uint8_t *buf);
278 int (*read_subpage)(struct mtd_info *mtd,
279 struct nand_chip *chip,
280 uint32_t offs, uint32_t len,
281 uint8_t *buf);
279 void (*write_page)(struct mtd_info *mtd, 282 void (*write_page)(struct mtd_info *mtd,
280 struct nand_chip *chip, 283 struct nand_chip *chip,
281 const uint8_t *buf); 284 const uint8_t *buf);
diff --git a/include/linux/mtd/nand_ecc.h b/include/linux/mtd/nand_ecc.h
index 12c5bc342ea..090da505425 100644
--- a/include/linux/mtd/nand_ecc.h
+++ b/include/linux/mtd/nand_ecc.h
@@ -3,8 +3,6 @@
3 * 3 *
4 * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) 4 * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com)
5 * 5 *
6 * $Id: nand_ecc.h,v 1.4 2004/06/17 02:35:02 dbrown Exp $
7 *
8 * 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
9 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
diff --git a/include/linux/mtd/nftl.h b/include/linux/mtd/nftl.h
index 001eec50cac..dcaf611ed74 100644
--- a/include/linux/mtd/nftl.h
+++ b/include/linux/mtd/nftl.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: nftl.h,v 1.16 2004/06/30 14:49:00 dbrown Exp $
3 *
4 * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> 2 * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org>
5 */ 3 */
6 4
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index 7c37d7e55ab..5014f7a9f5d 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -4,8 +4,6 @@
4 * (C) 2000 Nicolas Pitre <nico@cam.org> 4 * (C) 2000 Nicolas Pitre <nico@cam.org>
5 * 5 *
6 * This code is GPL 6 * This code is GPL
7 *
8 * $Id: partitions.h,v 1.17 2005/11/07 11:14:55 gleixner Exp $
9 */ 7 */
10 8
11#ifndef MTD_PARTITIONS_H 9#ifndef MTD_PARTITIONS_H
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index 0dc07d5f335..c8e63a5ee72 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -2,8 +2,6 @@
2 * For boards with physically mapped flash and using 2 * For boards with physically mapped flash and using
3 * drivers/mtd/maps/physmap.c mapping driver. 3 * drivers/mtd/maps/physmap.c mapping driver.
4 * 4 *
5 * $Id: physmap.h,v 1.4 2005/11/07 11:14:55 gleixner Exp $
6 *
7 * Copyright (C) 2003 MontaVista Software Inc. 5 * Copyright (C) 2003 MontaVista Software Inc.
8 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net 6 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
9 * 7 *
diff --git a/include/linux/mtd/plat-ram.h b/include/linux/mtd/plat-ram.h
index 0e37ad07bce..e07890aff1c 100644
--- a/include/linux/mtd/plat-ram.h
+++ b/include/linux/mtd/plat-ram.h
@@ -6,8 +6,6 @@
6 * 6 *
7 * Generic platform device based RAM map 7 * Generic platform device based RAM map
8 * 8 *
9 * $Id: plat-ram.h,v 1.2 2005/01/24 00:37:40 bjd Exp $
10 *
11 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
diff --git a/include/linux/mtd/pmc551.h b/include/linux/mtd/pmc551.h
index 5cc070c24d8..27ad40aed19 100644
--- a/include/linux/mtd/pmc551.h
+++ b/include/linux/mtd/pmc551.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: pmc551.h,v 1.6 2005/11/07 11:14:55 gleixner Exp $
3 *
4 * PMC551 PCI Mezzanine Ram Device 2 * PMC551 PCI Mezzanine Ram Device
5 * 3 *
6 * Author: 4 * Author:
@@ -17,7 +15,7 @@
17 15
18#include <linux/mtd/mtd.h> 16#include <linux/mtd/mtd.h>
19 17
20#define PMC551_VERSION "$Id: pmc551.h,v 1.6 2005/11/07 11:14:55 gleixner Exp $\n"\ 18#define PMC551_VERSION \
21 "Ramix PMC551 PCI Mezzanine Ram Driver. (C) 1999,2000 Nortel Networks.\n" 19 "Ramix PMC551 PCI Mezzanine Ram Driver. (C) 1999,2000 Nortel Networks.\n"
22 20
23/* 21/*
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h
index f71201d0f3e..6316fafe5c2 100644
--- a/include/linux/mtd/ubi.h
+++ b/include/linux/mtd/ubi.h
@@ -45,13 +45,13 @@ enum {
45 * @size: how many physical eraseblocks are reserved for this volume 45 * @size: how many physical eraseblocks are reserved for this volume
46 * @used_bytes: how many bytes of data this volume contains 46 * @used_bytes: how many bytes of data this volume contains
47 * @used_ebs: how many physical eraseblocks of this volume actually contain any 47 * @used_ebs: how many physical eraseblocks of this volume actually contain any
48 * data 48 * data
49 * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME) 49 * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME)
50 * @corrupted: non-zero if the volume is corrupted (static volumes only) 50 * @corrupted: non-zero if the volume is corrupted (static volumes only)
51 * @upd_marker: non-zero if the volume has update marker set 51 * @upd_marker: non-zero if the volume has update marker set
52 * @alignment: volume alignment 52 * @alignment: volume alignment
53 * @usable_leb_size: how many bytes are available in logical eraseblocks of 53 * @usable_leb_size: how many bytes are available in logical eraseblocks of
54 * this volume 54 * this volume
55 * @name_len: volume name length 55 * @name_len: volume name length
56 * @name: volume name 56 * @name: volume name
57 * @cdev: UBI volume character device major and minor numbers 57 * @cdev: UBI volume character device major and minor numbers
@@ -152,6 +152,7 @@ int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum);
152int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum); 152int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum);
153int ubi_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype); 153int ubi_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype);
154int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum); 154int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum);
155int ubi_sync(int ubi_num);
155 156
156/* 157/*
157 * This function is the same as the 'ubi_leb_read()' function, but it does not 158 * This function is the same as the 'ubi_leb_read()' function, but it does not
diff --git a/include/linux/mtd/xip.h b/include/linux/mtd/xip.h
index e9d40bdde48..36efcba15ec 100644
--- a/include/linux/mtd/xip.h
+++ b/include/linux/mtd/xip.h
@@ -11,8 +11,6 @@
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 *
15 * $Id: xip.h,v 1.5 2005/11/07 11:14:55 gleixner Exp $
16 */ 14 */
17 15
18#ifndef __LINUX_MTD_XIP_H__ 16#ifndef __LINUX_MTD_XIP_H__
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index 30e11aa3c1c..12078577aef 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -1,34 +1,75 @@
1/* 1/*
2 * MV-643XX ethernet platform device data definition file. 2 * MV-643XX ethernet platform device data definition file.
3 */ 3 */
4
4#ifndef __LINUX_MV643XX_ETH_H 5#ifndef __LINUX_MV643XX_ETH_H
5#define __LINUX_MV643XX_ETH_H 6#define __LINUX_MV643XX_ETH_H
6 7
7#define MV643XX_ETH_SHARED_NAME "mv643xx_eth_shared" 8#include <linux/mbus.h>
8#define MV643XX_ETH_NAME "mv643xx_eth" 9
10#define MV643XX_ETH_SHARED_NAME "mv643xx_eth"
11#define MV643XX_ETH_NAME "mv643xx_eth_port"
9#define MV643XX_ETH_SHARED_REGS 0x2000 12#define MV643XX_ETH_SHARED_REGS 0x2000
10#define MV643XX_ETH_SHARED_REGS_SIZE 0x2000 13#define MV643XX_ETH_SHARED_REGS_SIZE 0x2000
11#define MV643XX_ETH_BAR_4 0x2220 14#define MV643XX_ETH_BAR_4 0x2220
12#define MV643XX_ETH_SIZE_REG_4 0x2224 15#define MV643XX_ETH_SIZE_REG_4 0x2224
13#define MV643XX_ETH_BASE_ADDR_ENABLE_REG 0x2290 16#define MV643XX_ETH_BASE_ADDR_ENABLE_REG 0x2290
14 17
18struct mv643xx_eth_shared_platform_data {
19 struct mbus_dram_target_info *dram;
20 unsigned int t_clk;
21};
22
15struct mv643xx_eth_platform_data { 23struct mv643xx_eth_platform_data {
16 int port_number; 24 /*
17 u16 force_phy_addr; /* force override if phy_addr == 0 */ 25 * Pointer back to our parent instance, and our port number.
18 u16 phy_addr; 26 */
19 27 struct platform_device *shared;
20 /* If speed is 0, then speed and duplex are autonegotiated. */ 28 int port_number;
21 int speed; /* 0, SPEED_10, SPEED_100, SPEED_1000 */ 29
22 int duplex; /* DUPLEX_HALF or DUPLEX_FULL */ 30 /*
23 31 * Whether a PHY is present, and if yes, at which address.
24 /* non-zero values of the following fields override defaults */ 32 */
25 u32 tx_queue_size; 33 struct platform_device *shared_smi;
26 u32 rx_queue_size; 34 int force_phy_addr;
27 u32 tx_sram_addr; 35 int phy_addr;
28 u32 tx_sram_size; 36
29 u32 rx_sram_addr; 37 /*
30 u32 rx_sram_size; 38 * Use this MAC address if it is valid, overriding the
31 u8 mac_addr[6]; /* mac address if non-zero*/ 39 * address that is already in the hardware.
40 */
41 u8 mac_addr[6];
42
43 /*
44 * If speed is 0, autonegotiation is enabled.
45 * Valid values for speed: 0, SPEED_10, SPEED_100, SPEED_1000.
46 * Valid values for duplex: DUPLEX_HALF, DUPLEX_FULL.
47 */
48 int speed;
49 int duplex;
50
51 /*
52 * Which RX/TX queues to use.
53 */
54 int rx_queue_mask;
55 int tx_queue_mask;
56
57 /*
58 * Override default RX/TX queue sizes if nonzero.
59 */
60 int rx_queue_size;
61 int tx_queue_size;
62
63 /*
64 * Use on-chip SRAM for RX/TX descriptors if size is nonzero
65 * and sufficient to contain all descriptors for the requested
66 * ring sizes.
67 */
68 unsigned long rx_sram_addr;
69 int rx_sram_size;
70 unsigned long tx_sram_addr;
71 int tx_sram_size;
32}; 72};
33 73
34#endif /* __LINUX_MV643XX_ETH_H */ 74
75#endif
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 24d88e98a62..68f8c3203c8 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -47,27 +47,24 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
47#define LOOKUP_DIRECTORY 2 47#define LOOKUP_DIRECTORY 2
48#define LOOKUP_CONTINUE 4 48#define LOOKUP_CONTINUE 4
49#define LOOKUP_PARENT 16 49#define LOOKUP_PARENT 16
50#define LOOKUP_NOALT 32
51#define LOOKUP_REVAL 64 50#define LOOKUP_REVAL 64
52/* 51/*
53 * Intent data 52 * Intent data
54 */ 53 */
55#define LOOKUP_OPEN (0x0100) 54#define LOOKUP_OPEN (0x0100)
56#define LOOKUP_CREATE (0x0200) 55#define LOOKUP_CREATE (0x0200)
57#define LOOKUP_ACCESS (0x0400) 56
58#define LOOKUP_CHDIR (0x0800) 57extern int user_path_at(int, const char __user *, unsigned, struct path *);
59 58
60extern int __user_walk(const char __user *, unsigned, struct nameidata *); 59#define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path)
61extern int __user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *); 60#define user_lpath(name, path) user_path_at(AT_FDCWD, name, 0, path)
62#define user_path_walk(name,nd) \ 61#define user_path_dir(name, path) \
63 __user_walk_fd(AT_FDCWD, name, LOOKUP_FOLLOW, nd) 62 user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, path)
64#define user_path_walk_link(name,nd) \ 63
65 __user_walk_fd(AT_FDCWD, name, 0, nd)
66extern int path_lookup(const char *, unsigned, struct nameidata *); 64extern int path_lookup(const char *, unsigned, struct nameidata *);
67extern int vfs_path_lookup(struct dentry *, struct vfsmount *, 65extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
68 const char *, unsigned int, struct nameidata *); 66 const char *, unsigned int, struct nameidata *);
69 67
70extern int __user_path_lookup_open(const char __user *, unsigned lookup_flags, struct nameidata *nd, int open_flags);
71extern int path_lookup_open(int dfd, const char *name, unsigned lookup_flags, struct nameidata *, int open_flags); 68extern int path_lookup_open(int dfd, const char *name, unsigned lookup_flags, struct nameidata *, int open_flags);
72extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, 69extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry,
73 int (*open)(struct inode *, struct file *)); 70 int (*open)(struct inode *, struct file *));
diff --git a/include/linux/net.h b/include/linux/net.h
index 71f7dd55928..4a9a30f2d68 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -20,6 +20,7 @@
20 20
21#include <linux/wait.h> 21#include <linux/wait.h>
22#include <linux/socket.h> 22#include <linux/socket.h>
23#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */
23#include <asm/socket.h> 24#include <asm/socket.h>
24 25
25struct poll_table_struct; 26struct poll_table_struct;
@@ -46,6 +47,7 @@ struct net;
46#define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */ 47#define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */
47#define SYS_SENDMSG 16 /* sys_sendmsg(2) */ 48#define SYS_SENDMSG 16 /* sys_sendmsg(2) */
48#define SYS_RECVMSG 17 /* sys_recvmsg(2) */ 49#define SYS_RECVMSG 17 /* sys_recvmsg(2) */
50#define SYS_PACCEPT 18 /* sys_paccept(2) */
49 51
50typedef enum { 52typedef enum {
51 SS_FREE = 0, /* not allocated */ 53 SS_FREE = 0, /* not allocated */
@@ -94,6 +96,15 @@ enum sock_type {
94}; 96};
95 97
96#define SOCK_MAX (SOCK_PACKET + 1) 98#define SOCK_MAX (SOCK_PACKET + 1)
99/* Mask which covers at least up to SOCK_MASK-1. The
100 * remaining bits are used as flags. */
101#define SOCK_TYPE_MASK 0xf
102
103/* Flags for socket, socketpair, paccept */
104#define SOCK_CLOEXEC O_CLOEXEC
105#ifndef SOCK_NONBLOCK
106#define SOCK_NONBLOCK O_NONBLOCK
107#endif
97 108
98#endif /* ARCH_HAS_SOCKET_TYPES */ 109#endif /* ARCH_HAS_SOCKET_TYPES */
99 110
@@ -106,23 +117,23 @@ enum sock_shutdown_cmd {
106/** 117/**
107 * struct socket - general BSD socket 118 * struct socket - general BSD socket
108 * @state: socket state (%SS_CONNECTED, etc) 119 * @state: socket state (%SS_CONNECTED, etc)
120 * @type: socket type (%SOCK_STREAM, etc)
109 * @flags: socket flags (%SOCK_ASYNC_NOSPACE, etc) 121 * @flags: socket flags (%SOCK_ASYNC_NOSPACE, etc)
110 * @ops: protocol specific socket operations 122 * @ops: protocol specific socket operations
111 * @fasync_list: Asynchronous wake up list 123 * @fasync_list: Asynchronous wake up list
112 * @file: File back pointer for gc 124 * @file: File back pointer for gc
113 * @sk: internal networking protocol agnostic socket representation 125 * @sk: internal networking protocol agnostic socket representation
114 * @wait: wait queue for several uses 126 * @wait: wait queue for several uses
115 * @type: socket type (%SOCK_STREAM, etc)
116 */ 127 */
117struct socket { 128struct socket {
118 socket_state state; 129 socket_state state;
130 short type;
119 unsigned long flags; 131 unsigned long flags;
120 const struct proto_ops *ops; 132 const struct proto_ops *ops;
121 struct fasync_struct *fasync_list; 133 struct fasync_struct *fasync_list;
122 struct file *file; 134 struct file *file;
123 struct sock *sk; 135 struct sock *sk;
124 wait_queue_head_t wait; 136 wait_queue_head_t wait;
125 short type;
126}; 137};
127 138
128struct vm_area_struct; 139struct vm_area_struct;
@@ -208,10 +219,12 @@ extern int sock_sendmsg(struct socket *sock, struct msghdr *msg,
208 size_t len); 219 size_t len);
209extern int sock_recvmsg(struct socket *sock, struct msghdr *msg, 220extern int sock_recvmsg(struct socket *sock, struct msghdr *msg,
210 size_t size, int flags); 221 size_t size, int flags);
211extern int sock_map_fd(struct socket *sock); 222extern int sock_map_fd(struct socket *sock, int flags);
212extern struct socket *sockfd_lookup(int fd, int *err); 223extern struct socket *sockfd_lookup(int fd, int *err);
213#define sockfd_put(sock) fput(sock->file) 224#define sockfd_put(sock) fput(sock->file)
214extern int net_ratelimit(void); 225extern int net_ratelimit(void);
226extern long do_accept(int fd, struct sockaddr __user *upeer_sockaddr,
227 int __user *upeer_addrlen, int flags);
215 228
216#define net_random() random32() 229#define net_random() random32()
217#define net_srandom(seed) srandom32((__force u32)seed) 230#define net_srandom(seed) srandom32((__force u32)seed)
@@ -338,8 +351,7 @@ static const struct proto_ops name##_ops = { \
338 351
339#ifdef CONFIG_SYSCTL 352#ifdef CONFIG_SYSCTL
340#include <linux/sysctl.h> 353#include <linux/sysctl.h>
341extern int net_msg_cost; 354extern struct ratelimit_state net_ratelimit_state;
342extern int net_msg_burst;
343#endif 355#endif
344 356
345#endif /* __KERNEL__ */ 357#endif /* __KERNEL__ */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 7c1d4466583..b4d056ceab9 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -88,19 +88,23 @@ struct wireless_dev;
88#define NETDEV_TX_BUSY 1 /* driver tx path was busy*/ 88#define NETDEV_TX_BUSY 1 /* driver tx path was busy*/
89#define NETDEV_TX_LOCKED -1 /* driver tx lock was already taken */ 89#define NETDEV_TX_LOCKED -1 /* driver tx lock was already taken */
90 90
91#ifdef __KERNEL__
92
91/* 93/*
92 * Compute the worst case header length according to the protocols 94 * Compute the worst case header length according to the protocols
93 * used. 95 * used.
94 */ 96 */
95 97
96#if !defined(CONFIG_AX25) && !defined(CONFIG_AX25_MODULE) && !defined(CONFIG_TR) 98#if defined(CONFIG_WLAN_80211) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
97#define LL_MAX_HEADER 32 99# if defined(CONFIG_MAC80211_MESH)
98#else 100# define LL_MAX_HEADER 128
99#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) 101# else
100#define LL_MAX_HEADER 96 102# define LL_MAX_HEADER 96
103# endif
104#elif defined(CONFIG_TR)
105# define LL_MAX_HEADER 48
101#else 106#else
102#define LL_MAX_HEADER 48 107# define LL_MAX_HEADER 32
103#endif
104#endif 108#endif
105 109
106#if !defined(CONFIG_NET_IPIP) && !defined(CONFIG_NET_IPIP_MODULE) && \ 110#if !defined(CONFIG_NET_IPIP) && !defined(CONFIG_NET_IPIP_MODULE) && \
@@ -112,13 +116,7 @@ struct wireless_dev;
112#define MAX_HEADER (LL_MAX_HEADER + 48) 116#define MAX_HEADER (LL_MAX_HEADER + 48)
113#endif 117#endif
114 118
115struct net_device_subqueue 119#endif /* __KERNEL__ */
116{
117 /* Give a control state for each queue. This struct may contain
118 * per-queue locks in the future.
119 */
120 unsigned long state;
121};
122 120
123/* 121/*
124 * Network device statistics. Akin to the 2.0 ether stats but 122 * Network device statistics. Akin to the 2.0 ether stats but
@@ -244,11 +242,16 @@ struct hh_cache
244 * 242 *
245 * We could use other alignment values, but we must maintain the 243 * We could use other alignment values, but we must maintain the
246 * relationship HH alignment <= LL alignment. 244 * relationship HH alignment <= LL alignment.
245 *
246 * LL_ALLOCATED_SPACE also takes into account the tailroom the device
247 * may need.
247 */ 248 */
248#define LL_RESERVED_SPACE(dev) \ 249#define LL_RESERVED_SPACE(dev) \
249 (((dev)->hard_header_len&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) 250 ((((dev)->hard_header_len+(dev)->needed_headroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
250#define LL_RESERVED_SPACE_EXTRA(dev,extra) \ 251#define LL_RESERVED_SPACE_EXTRA(dev,extra) \
251 ((((dev)->hard_header_len+extra)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) 252 ((((dev)->hard_header_len+(dev)->needed_headroom+(extra))&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
253#define LL_ALLOCATED_SPACE(dev) \
254 ((((dev)->hard_header_len+(dev)->needed_headroom+(dev)->needed_tailroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
252 255
253struct header_ops { 256struct header_ops {
254 int (*create) (struct sk_buff *skb, struct net_device *dev, 257 int (*create) (struct sk_buff *skb, struct net_device *dev,
@@ -270,14 +273,11 @@ struct header_ops {
270 273
271enum netdev_state_t 274enum netdev_state_t
272{ 275{
273 __LINK_STATE_XOFF=0,
274 __LINK_STATE_START, 276 __LINK_STATE_START,
275 __LINK_STATE_PRESENT, 277 __LINK_STATE_PRESENT,
276 __LINK_STATE_SCHED,
277 __LINK_STATE_NOCARRIER, 278 __LINK_STATE_NOCARRIER,
278 __LINK_STATE_LINKWATCH_PENDING, 279 __LINK_STATE_LINKWATCH_PENDING,
279 __LINK_STATE_DORMANT, 280 __LINK_STATE_DORMANT,
280 __LINK_STATE_QDISC_RUNNING,
281}; 281};
282 282
283 283
@@ -437,6 +437,20 @@ static inline void napi_synchronize(const struct napi_struct *n)
437# define napi_synchronize(n) barrier() 437# define napi_synchronize(n) barrier()
438#endif 438#endif
439 439
440enum netdev_queue_state_t
441{
442 __QUEUE_STATE_XOFF,
443};
444
445struct netdev_queue {
446 struct net_device *dev;
447 struct Qdisc *qdisc;
448 unsigned long state;
449 spinlock_t _xmit_lock;
450 int xmit_lock_owner;
451 struct Qdisc *qdisc_sleeping;
452} ____cacheline_aligned_in_smp;
453
440/* 454/*
441 * The DEVICE structure. 455 * The DEVICE structure.
442 * Actually, this whole structure is a big mistake. It mixes I/O 456 * Actually, this whole structure is a big mistake. It mixes I/O
@@ -505,7 +519,6 @@ struct net_device
505#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */ 519#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */
506 /* do not use LLTX in new drivers */ 520 /* do not use LLTX in new drivers */
507#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */ 521#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */
508#define NETIF_F_MULTI_QUEUE 16384 /* Has multiple TX/RX queues */
509#define NETIF_F_LRO 32768 /* large receive offload */ 522#define NETIF_F_LRO 32768 /* large receive offload */
510 523
511 /* Segmentation offload features */ 524 /* Segmentation offload features */
@@ -526,8 +539,6 @@ struct net_device
526#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) 539#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
527#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM) 540#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
528 541
529 struct net_device *next_sched;
530
531 /* Interface index. Unique device identifier */ 542 /* Interface index. Unique device identifier */
532 int ifindex; 543 int ifindex;
533 int iflink; 544 int iflink;
@@ -567,6 +578,13 @@ struct net_device
567 unsigned short type; /* interface hardware type */ 578 unsigned short type; /* interface hardware type */
568 unsigned short hard_header_len; /* hardware hdr length */ 579 unsigned short hard_header_len; /* hardware hdr length */
569 580
581 /* extra head- and tailroom the hardware may need, but not in all cases
582 * can this be guaranteed, especially tailroom. Some cases also use
583 * LL_MAX_HEADER instead to allocate the skb.
584 */
585 unsigned short needed_headroom;
586 unsigned short needed_tailroom;
587
570 struct net_device *master; /* Pointer to master device of a group, 588 struct net_device *master; /* Pointer to master device of a group,
571 * which this device is member of. 589 * which this device is member of.
572 */ 590 */
@@ -576,13 +594,14 @@ struct net_device
576 unsigned char addr_len; /* hardware address length */ 594 unsigned char addr_len; /* hardware address length */
577 unsigned short dev_id; /* for shared network cards */ 595 unsigned short dev_id; /* for shared network cards */
578 596
597 spinlock_t addr_list_lock;
579 struct dev_addr_list *uc_list; /* Secondary unicast mac addresses */ 598 struct dev_addr_list *uc_list; /* Secondary unicast mac addresses */
580 int uc_count; /* Number of installed ucasts */ 599 int uc_count; /* Number of installed ucasts */
581 int uc_promisc; 600 int uc_promisc;
582 struct dev_addr_list *mc_list; /* Multicast mac addresses */ 601 struct dev_addr_list *mc_list; /* Multicast mac addresses */
583 int mc_count; /* Number of installed mcasts */ 602 int mc_count; /* Number of installed mcasts */
584 int promiscuity; 603 unsigned int promiscuity;
585 int allmulti; 604 unsigned int allmulti;
586 605
587 606
588 /* Protocol specific pointers */ 607 /* Protocol specific pointers */
@@ -606,32 +625,21 @@ struct net_device
606 625
607 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 626 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
608 627
609 /* ingress path synchronizer */ 628 struct netdev_queue rx_queue;
610 spinlock_t ingress_lock;
611 struct Qdisc *qdisc_ingress;
612 629
613/* 630 struct netdev_queue *_tx ____cacheline_aligned_in_smp;
614 * Cache line mostly used on queue transmit path (qdisc) 631
615 */ 632 /* Number of TX queues allocated at alloc_netdev_mq() time */
616 /* device queue lock */ 633 unsigned int num_tx_queues;
617 spinlock_t queue_lock ____cacheline_aligned_in_smp;
618 struct Qdisc *qdisc;
619 struct Qdisc *qdisc_sleeping;
620 struct list_head qdisc_list;
621 unsigned long tx_queue_len; /* Max frames per queue allowed */
622 634
623 /* Partially transmitted GSO packet. */ 635 /* Number of TX queues currently active in device */
624 struct sk_buff *gso_skb; 636 unsigned int real_num_tx_queues;
637
638 unsigned long tx_queue_len; /* Max frames per queue allowed */
625 639
626/* 640/*
627 * One part is mostly used on xmit path (device) 641 * One part is mostly used on xmit path (device)
628 */ 642 */
629 /* hard_start_xmit synchronizer */
630 spinlock_t _xmit_lock ____cacheline_aligned_in_smp;
631 /* cpu id of processor entered to hard_start_xmit or -1,
632 if nobody entered there.
633 */
634 int xmit_lock_owner;
635 void *priv; /* pointer to private data */ 643 void *priv; /* pointer to private data */
636 int (*hard_start_xmit) (struct sk_buff *skb, 644 int (*hard_start_xmit) (struct sk_buff *skb,
637 struct net_device *dev); 645 struct net_device *dev);
@@ -710,15 +718,23 @@ struct net_device
710 void (*poll_controller)(struct net_device *dev); 718 void (*poll_controller)(struct net_device *dev);
711#endif 719#endif
712 720
721 u16 (*select_queue)(struct net_device *dev,
722 struct sk_buff *skb);
723
713#ifdef CONFIG_NET_NS 724#ifdef CONFIG_NET_NS
714 /* Network namespace this network device is inside */ 725 /* Network namespace this network device is inside */
715 struct net *nd_net; 726 struct net *nd_net;
716#endif 727#endif
717 728
729 /* mid-layer private */
730 void *ml_priv;
731
718 /* bridge stuff */ 732 /* bridge stuff */
719 struct net_bridge_port *br_port; 733 struct net_bridge_port *br_port;
720 /* macvlan */ 734 /* macvlan */
721 struct macvlan_port *macvlan_port; 735 struct macvlan_port *macvlan_port;
736 /* GARP */
737 struct garp_port *garp_port;
722 738
723 /* class/net/name entry */ 739 /* class/net/name entry */
724 struct device dev; 740 struct device dev;
@@ -728,19 +744,37 @@ struct net_device
728 /* rtnetlink link ops */ 744 /* rtnetlink link ops */
729 const struct rtnl_link_ops *rtnl_link_ops; 745 const struct rtnl_link_ops *rtnl_link_ops;
730 746
747 /* VLAN feature mask */
748 unsigned long vlan_features;
749
731 /* for setting kernel sock attribute on TCP connection setup */ 750 /* for setting kernel sock attribute on TCP connection setup */
732#define GSO_MAX_SIZE 65536 751#define GSO_MAX_SIZE 65536
733 unsigned int gso_max_size; 752 unsigned int gso_max_size;
734
735 /* The TX queue control structures */
736 unsigned int egress_subqueue_count;
737 struct net_device_subqueue egress_subqueue[1];
738}; 753};
739#define to_net_dev(d) container_of(d, struct net_device, dev) 754#define to_net_dev(d) container_of(d, struct net_device, dev)
740 755
741#define NETDEV_ALIGN 32 756#define NETDEV_ALIGN 32
742#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) 757#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1)
743 758
759static inline
760struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
761 unsigned int index)
762{
763 return &dev->_tx[index];
764}
765
766static inline void netdev_for_each_tx_queue(struct net_device *dev,
767 void (*f)(struct net_device *,
768 struct netdev_queue *,
769 void *),
770 void *arg)
771{
772 unsigned int i;
773
774 for (i = 0; i < dev->num_tx_queues; i++)
775 f(dev, &dev->_tx[i], arg);
776}
777
744/* 778/*
745 * Net namespace inlines 779 * Net namespace inlines
746 */ 780 */
@@ -771,7 +805,9 @@ void dev_net_set(struct net_device *dev, struct net *net)
771 */ 805 */
772static inline void *netdev_priv(const struct net_device *dev) 806static inline void *netdev_priv(const struct net_device *dev)
773{ 807{
774 return dev->priv; 808 return (char *)dev + ((sizeof(struct net_device)
809 + NETDEV_ALIGN_CONST)
810 & ~NETDEV_ALIGN_CONST);
775} 811}
776 812
777/* Set the sysfs physical device reference for the network logical device 813/* Set the sysfs physical device reference for the network logical device
@@ -806,6 +842,19 @@ static inline void netif_napi_add(struct net_device *dev,
806 set_bit(NAPI_STATE_SCHED, &napi->state); 842 set_bit(NAPI_STATE_SCHED, &napi->state);
807} 843}
808 844
845/**
846 * netif_napi_del - remove a napi context
847 * @napi: napi context
848 *
849 * netif_napi_del() removes a napi context from the network device napi list
850 */
851static inline void netif_napi_del(struct napi_struct *napi)
852{
853#ifdef CONFIG_NETPOLL
854 list_del(&napi->dev_list);
855#endif
856}
857
809struct packet_type { 858struct packet_type {
810 __be16 type; /* This is really htons(ether_type). */ 859 __be16 type; /* This is really htons(ether_type). */
811 struct net_device *dev; /* NULL is wildcarded here */ 860 struct net_device *dev; /* NULL is wildcarded here */
@@ -866,6 +915,7 @@ extern struct net_device *__dev_get_by_name(struct net *net, const char *name);
866extern int dev_alloc_name(struct net_device *dev, const char *name); 915extern int dev_alloc_name(struct net_device *dev, const char *name);
867extern int dev_open(struct net_device *dev); 916extern int dev_open(struct net_device *dev);
868extern int dev_close(struct net_device *dev); 917extern int dev_close(struct net_device *dev);
918extern void dev_disable_lro(struct net_device *dev);
869extern int dev_queue_xmit(struct sk_buff *skb); 919extern int dev_queue_xmit(struct sk_buff *skb);
870extern int register_netdevice(struct net_device *dev); 920extern int register_netdevice(struct net_device *dev);
871extern void unregister_netdevice(struct net_device *dev); 921extern void unregister_netdevice(struct net_device *dev);
@@ -915,7 +965,7 @@ static inline int unregister_gifconf(unsigned int family)
915 */ 965 */
916struct softnet_data 966struct softnet_data
917{ 967{
918 struct net_device *output_queue; 968 struct Qdisc *output_queue;
919 struct sk_buff_head input_pkt_queue; 969 struct sk_buff_head input_pkt_queue;
920 struct list_head poll_list; 970 struct list_head poll_list;
921 struct sk_buff *completion_queue; 971 struct sk_buff *completion_queue;
@@ -930,12 +980,25 @@ DECLARE_PER_CPU(struct softnet_data,softnet_data);
930 980
931#define HAVE_NETIF_QUEUE 981#define HAVE_NETIF_QUEUE
932 982
933extern void __netif_schedule(struct net_device *dev); 983extern void __netif_schedule(struct Qdisc *q);
984
985static inline void netif_schedule_queue(struct netdev_queue *txq)
986{
987 if (!test_bit(__QUEUE_STATE_XOFF, &txq->state))
988 __netif_schedule(txq->qdisc);
989}
990
991static inline void netif_tx_schedule_all(struct net_device *dev)
992{
993 unsigned int i;
934 994
935static inline void netif_schedule(struct net_device *dev) 995 for (i = 0; i < dev->num_tx_queues; i++)
996 netif_schedule_queue(netdev_get_tx_queue(dev, i));
997}
998
999static inline void netif_tx_start_queue(struct netdev_queue *dev_queue)
936{ 1000{
937 if (!test_bit(__LINK_STATE_XOFF, &dev->state)) 1001 clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
938 __netif_schedule(dev);
939} 1002}
940 1003
941/** 1004/**
@@ -946,7 +1009,29 @@ static inline void netif_schedule(struct net_device *dev)
946 */ 1009 */
947static inline void netif_start_queue(struct net_device *dev) 1010static inline void netif_start_queue(struct net_device *dev)
948{ 1011{
949 clear_bit(__LINK_STATE_XOFF, &dev->state); 1012 netif_tx_start_queue(netdev_get_tx_queue(dev, 0));
1013}
1014
1015static inline void netif_tx_start_all_queues(struct net_device *dev)
1016{
1017 unsigned int i;
1018
1019 for (i = 0; i < dev->num_tx_queues; i++) {
1020 struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
1021 netif_tx_start_queue(txq);
1022 }
1023}
1024
1025static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue)
1026{
1027#ifdef CONFIG_NETPOLL_TRAP
1028 if (netpoll_trap()) {
1029 clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
1030 return;
1031 }
1032#endif
1033 if (test_and_clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state))
1034 __netif_schedule(dev_queue->qdisc);
950} 1035}
951 1036
952/** 1037/**
@@ -958,14 +1043,22 @@ static inline void netif_start_queue(struct net_device *dev)
958 */ 1043 */
959static inline void netif_wake_queue(struct net_device *dev) 1044static inline void netif_wake_queue(struct net_device *dev)
960{ 1045{
961#ifdef CONFIG_NETPOLL_TRAP 1046 netif_tx_wake_queue(netdev_get_tx_queue(dev, 0));
962 if (netpoll_trap()) { 1047}
963 clear_bit(__LINK_STATE_XOFF, &dev->state); 1048
964 return; 1049static inline void netif_tx_wake_all_queues(struct net_device *dev)
1050{
1051 unsigned int i;
1052
1053 for (i = 0; i < dev->num_tx_queues; i++) {
1054 struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
1055 netif_tx_wake_queue(txq);
965 } 1056 }
966#endif 1057}
967 if (test_and_clear_bit(__LINK_STATE_XOFF, &dev->state)) 1058
968 __netif_schedule(dev); 1059static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
1060{
1061 set_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
969} 1062}
970 1063
971/** 1064/**
@@ -977,7 +1070,22 @@ static inline void netif_wake_queue(struct net_device *dev)
977 */ 1070 */
978static inline void netif_stop_queue(struct net_device *dev) 1071static inline void netif_stop_queue(struct net_device *dev)
979{ 1072{
980 set_bit(__LINK_STATE_XOFF, &dev->state); 1073 netif_tx_stop_queue(netdev_get_tx_queue(dev, 0));
1074}
1075
1076static inline void netif_tx_stop_all_queues(struct net_device *dev)
1077{
1078 unsigned int i;
1079
1080 for (i = 0; i < dev->num_tx_queues; i++) {
1081 struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
1082 netif_tx_stop_queue(txq);
1083 }
1084}
1085
1086static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue)
1087{
1088 return test_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
981} 1089}
982 1090
983/** 1091/**
@@ -988,7 +1096,7 @@ static inline void netif_stop_queue(struct net_device *dev)
988 */ 1096 */
989static inline int netif_queue_stopped(const struct net_device *dev) 1097static inline int netif_queue_stopped(const struct net_device *dev)
990{ 1098{
991 return test_bit(__LINK_STATE_XOFF, &dev->state); 1099 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0));
992} 1100}
993 1101
994/** 1102/**
@@ -1018,9 +1126,8 @@ static inline int netif_running(const struct net_device *dev)
1018 */ 1126 */
1019static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index) 1127static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index)
1020{ 1128{
1021#ifdef CONFIG_NETDEVICES_MULTIQUEUE 1129 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
1022 clear_bit(__LINK_STATE_XOFF, &dev->egress_subqueue[queue_index].state); 1130 clear_bit(__QUEUE_STATE_XOFF, &txq->state);
1023#endif
1024} 1131}
1025 1132
1026/** 1133/**
@@ -1032,13 +1139,12 @@ static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index)
1032 */ 1139 */
1033static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index) 1140static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index)
1034{ 1141{
1035#ifdef CONFIG_NETDEVICES_MULTIQUEUE 1142 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
1036#ifdef CONFIG_NETPOLL_TRAP 1143#ifdef CONFIG_NETPOLL_TRAP
1037 if (netpoll_trap()) 1144 if (netpoll_trap())
1038 return; 1145 return;
1039#endif 1146#endif
1040 set_bit(__LINK_STATE_XOFF, &dev->egress_subqueue[queue_index].state); 1147 set_bit(__QUEUE_STATE_XOFF, &txq->state);
1041#endif
1042} 1148}
1043 1149
1044/** 1150/**
@@ -1051,12 +1157,8 @@ static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index)
1051static inline int __netif_subqueue_stopped(const struct net_device *dev, 1157static inline int __netif_subqueue_stopped(const struct net_device *dev,
1052 u16 queue_index) 1158 u16 queue_index)
1053{ 1159{
1054#ifdef CONFIG_NETDEVICES_MULTIQUEUE 1160 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
1055 return test_bit(__LINK_STATE_XOFF, 1161 return test_bit(__QUEUE_STATE_XOFF, &txq->state);
1056 &dev->egress_subqueue[queue_index].state);
1057#else
1058 return 0;
1059#endif
1060} 1162}
1061 1163
1062static inline int netif_subqueue_stopped(const struct net_device *dev, 1164static inline int netif_subqueue_stopped(const struct net_device *dev,
@@ -1074,15 +1176,13 @@ static inline int netif_subqueue_stopped(const struct net_device *dev,
1074 */ 1176 */
1075static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index) 1177static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
1076{ 1178{
1077#ifdef CONFIG_NETDEVICES_MULTIQUEUE 1179 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
1078#ifdef CONFIG_NETPOLL_TRAP 1180#ifdef CONFIG_NETPOLL_TRAP
1079 if (netpoll_trap()) 1181 if (netpoll_trap())
1080 return; 1182 return;
1081#endif 1183#endif
1082 if (test_and_clear_bit(__LINK_STATE_XOFF, 1184 if (test_and_clear_bit(__QUEUE_STATE_XOFF, &txq->state))
1083 &dev->egress_subqueue[queue_index].state)) 1185 __netif_schedule(txq->qdisc);
1084 __netif_schedule(dev);
1085#endif
1086} 1186}
1087 1187
1088/** 1188/**
@@ -1090,15 +1190,10 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
1090 * @dev: network device 1190 * @dev: network device
1091 * 1191 *
1092 * Check if device has multiple transmit queues 1192 * Check if device has multiple transmit queues
1093 * Always falls if NETDEVICE_MULTIQUEUE is not configured
1094 */ 1193 */
1095static inline int netif_is_multiqueue(const struct net_device *dev) 1194static inline int netif_is_multiqueue(const struct net_device *dev)
1096{ 1195{
1097#ifdef CONFIG_NETDEVICES_MULTIQUEUE 1196 return (dev->num_tx_queues > 1);
1098 return (!!(NETIF_F_MULTI_QUEUE & dev->features));
1099#else
1100 return 0;
1101#endif
1102} 1197}
1103 1198
1104/* Use this variant when it is known for sure that it 1199/* Use this variant when it is known for sure that it
@@ -1118,6 +1213,7 @@ extern int netif_rx(struct sk_buff *skb);
1118extern int netif_rx_ni(struct sk_buff *skb); 1213extern int netif_rx_ni(struct sk_buff *skb);
1119#define HAVE_NETIF_RECEIVE_SKB 1 1214#define HAVE_NETIF_RECEIVE_SKB 1
1120extern int netif_receive_skb(struct sk_buff *skb); 1215extern int netif_receive_skb(struct sk_buff *skb);
1216extern void netif_nit_deliver(struct sk_buff *skb);
1121extern int dev_valid_name(const char *name); 1217extern int dev_valid_name(const char *name);
1122extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 1218extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
1123extern int dev_ethtool(struct net *net, struct ifreq *); 1219extern int dev_ethtool(struct net *net, struct ifreq *);
@@ -1130,7 +1226,8 @@ extern int dev_set_mtu(struct net_device *, int);
1130extern int dev_set_mac_address(struct net_device *, 1226extern int dev_set_mac_address(struct net_device *,
1131 struct sockaddr *); 1227 struct sockaddr *);
1132extern int dev_hard_start_xmit(struct sk_buff *skb, 1228extern int dev_hard_start_xmit(struct sk_buff *skb,
1133 struct net_device *dev); 1229 struct net_device *dev,
1230 struct netdev_queue *txq);
1134 1231
1135extern int netdev_budget; 1232extern int netdev_budget;
1136 1233
@@ -1366,6 +1463,18 @@ static inline void netif_rx_complete(struct net_device *dev,
1366 local_irq_restore(flags); 1463 local_irq_restore(flags);
1367} 1464}
1368 1465
1466static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
1467{
1468 spin_lock(&txq->_xmit_lock);
1469 txq->xmit_lock_owner = cpu;
1470}
1471
1472static inline void __netif_tx_lock_bh(struct netdev_queue *txq)
1473{
1474 spin_lock_bh(&txq->_xmit_lock);
1475 txq->xmit_lock_owner = smp_processor_id();
1476}
1477
1369/** 1478/**
1370 * netif_tx_lock - grab network device transmit lock 1479 * netif_tx_lock - grab network device transmit lock
1371 * @dev: network device 1480 * @dev: network device
@@ -1373,62 +1482,109 @@ static inline void netif_rx_complete(struct net_device *dev,
1373 * 1482 *
1374 * Get network device transmit lock 1483 * Get network device transmit lock
1375 */ 1484 */
1376static inline void __netif_tx_lock(struct net_device *dev, int cpu)
1377{
1378 spin_lock(&dev->_xmit_lock);
1379 dev->xmit_lock_owner = cpu;
1380}
1381
1382static inline void netif_tx_lock(struct net_device *dev) 1485static inline void netif_tx_lock(struct net_device *dev)
1383{ 1486{
1384 __netif_tx_lock(dev, smp_processor_id()); 1487 int cpu = smp_processor_id();
1488 unsigned int i;
1489
1490 for (i = 0; i < dev->num_tx_queues; i++) {
1491 struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
1492 __netif_tx_lock(txq, cpu);
1493 }
1385} 1494}
1386 1495
1387static inline void netif_tx_lock_bh(struct net_device *dev) 1496static inline void netif_tx_lock_bh(struct net_device *dev)
1388{ 1497{
1389 spin_lock_bh(&dev->_xmit_lock); 1498 local_bh_disable();
1390 dev->xmit_lock_owner = smp_processor_id(); 1499 netif_tx_lock(dev);
1391} 1500}
1392 1501
1393static inline int netif_tx_trylock(struct net_device *dev) 1502static inline int __netif_tx_trylock(struct netdev_queue *txq)
1394{ 1503{
1395 int ok = spin_trylock(&dev->_xmit_lock); 1504 int ok = spin_trylock(&txq->_xmit_lock);
1396 if (likely(ok)) 1505 if (likely(ok))
1397 dev->xmit_lock_owner = smp_processor_id(); 1506 txq->xmit_lock_owner = smp_processor_id();
1398 return ok; 1507 return ok;
1399} 1508}
1400 1509
1510static inline int netif_tx_trylock(struct net_device *dev)
1511{
1512 return __netif_tx_trylock(netdev_get_tx_queue(dev, 0));
1513}
1514
1515static inline void __netif_tx_unlock(struct netdev_queue *txq)
1516{
1517 txq->xmit_lock_owner = -1;
1518 spin_unlock(&txq->_xmit_lock);
1519}
1520
1521static inline void __netif_tx_unlock_bh(struct netdev_queue *txq)
1522{
1523 txq->xmit_lock_owner = -1;
1524 spin_unlock_bh(&txq->_xmit_lock);
1525}
1526
1401static inline void netif_tx_unlock(struct net_device *dev) 1527static inline void netif_tx_unlock(struct net_device *dev)
1402{ 1528{
1403 dev->xmit_lock_owner = -1; 1529 unsigned int i;
1404 spin_unlock(&dev->_xmit_lock); 1530
1531 for (i = 0; i < dev->num_tx_queues; i++) {
1532 struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
1533 __netif_tx_unlock(txq);
1534 }
1535
1405} 1536}
1406 1537
1407static inline void netif_tx_unlock_bh(struct net_device *dev) 1538static inline void netif_tx_unlock_bh(struct net_device *dev)
1408{ 1539{
1409 dev->xmit_lock_owner = -1; 1540 netif_tx_unlock(dev);
1410 spin_unlock_bh(&dev->_xmit_lock); 1541 local_bh_enable();
1411} 1542}
1412 1543
1413#define HARD_TX_LOCK(dev, cpu) { \ 1544#define HARD_TX_LOCK(dev, txq, cpu) { \
1414 if ((dev->features & NETIF_F_LLTX) == 0) { \ 1545 if ((dev->features & NETIF_F_LLTX) == 0) { \
1415 __netif_tx_lock(dev, cpu); \ 1546 __netif_tx_lock(txq, cpu); \
1416 } \ 1547 } \
1417} 1548}
1418 1549
1419#define HARD_TX_UNLOCK(dev) { \ 1550#define HARD_TX_UNLOCK(dev, txq) { \
1420 if ((dev->features & NETIF_F_LLTX) == 0) { \ 1551 if ((dev->features & NETIF_F_LLTX) == 0) { \
1421 netif_tx_unlock(dev); \ 1552 __netif_tx_unlock(txq); \
1422 } \ 1553 } \
1423} 1554}
1424 1555
1425static inline void netif_tx_disable(struct net_device *dev) 1556static inline void netif_tx_disable(struct net_device *dev)
1426{ 1557{
1558 unsigned int i;
1559
1427 netif_tx_lock_bh(dev); 1560 netif_tx_lock_bh(dev);
1428 netif_stop_queue(dev); 1561 for (i = 0; i < dev->num_tx_queues; i++) {
1562 struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
1563 netif_tx_stop_queue(txq);
1564 }
1429 netif_tx_unlock_bh(dev); 1565 netif_tx_unlock_bh(dev);
1430} 1566}
1431 1567
1568static inline void netif_addr_lock(struct net_device *dev)
1569{
1570 spin_lock(&dev->addr_list_lock);
1571}
1572
1573static inline void netif_addr_lock_bh(struct net_device *dev)
1574{
1575 spin_lock_bh(&dev->addr_list_lock);
1576}
1577
1578static inline void netif_addr_unlock(struct net_device *dev)
1579{
1580 spin_unlock(&dev->addr_list_lock);
1581}
1582
1583static inline void netif_addr_unlock_bh(struct net_device *dev)
1584{
1585 spin_unlock_bh(&dev->addr_list_lock);
1586}
1587
1432/* These functions live elsewhere (drivers/net/net_init.c, but related) */ 1588/* These functions live elsewhere (drivers/net/net_init.c, but related) */
1433 1589
1434extern void ether_setup(struct net_device *dev); 1590extern void ether_setup(struct net_device *dev);
@@ -1456,9 +1612,10 @@ extern int __dev_addr_delete(struct dev_addr_list **list, int *count, void *ad
1456extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly); 1612extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly);
1457extern int __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count); 1613extern int __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
1458extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count); 1614extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
1459extern void dev_set_promiscuity(struct net_device *dev, int inc); 1615extern int dev_set_promiscuity(struct net_device *dev, int inc);
1460extern void dev_set_allmulti(struct net_device *dev, int inc); 1616extern int dev_set_allmulti(struct net_device *dev, int inc);
1461extern void netdev_state_change(struct net_device *dev); 1617extern void netdev_state_change(struct net_device *dev);
1618extern void netdev_bonding_change(struct net_device *dev);
1462extern void netdev_features_change(struct net_device *dev); 1619extern void netdev_features_change(struct net_device *dev);
1463/* Load a device via the kmod */ 1620/* Load a device via the kmod */
1464extern void dev_load(struct net *net, const char *name); 1621extern void dev_load(struct net *net, const char *name);
@@ -1485,6 +1642,11 @@ extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos);
1485extern void dev_seq_stop(struct seq_file *seq, void *v); 1642extern void dev_seq_stop(struct seq_file *seq, void *v);
1486#endif 1643#endif
1487 1644
1645extern int netdev_class_create_file(struct class_attribute *class_attr);
1646extern void netdev_class_remove_file(struct class_attribute *class_attr);
1647
1648extern char *netdev_drivername(struct net_device *dev, char *buffer, int len);
1649
1488extern void linkwatch_run_queue(void); 1650extern void linkwatch_run_queue(void);
1489 1651
1490extern int netdev_compute_features(unsigned long all, unsigned long one); 1652extern int netdev_compute_features(unsigned long all, unsigned long one);
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index e4c66593b5c..0c5eb7ed8b3 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -3,7 +3,6 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/types.h>
7#include <linux/skbuff.h> 6#include <linux/skbuff.h>
8#include <linux/net.h> 7#include <linux/net.h>
9#include <linux/netdevice.h> 8#include <linux/netdevice.h>
@@ -14,6 +13,7 @@
14#include <linux/list.h> 13#include <linux/list.h>
15#include <net/net_namespace.h> 14#include <net/net_namespace.h>
16#endif 15#endif
16#include <linux/types.h>
17#include <linux/compiler.h> 17#include <linux/compiler.h>
18 18
19/* Responses from hook functions. */ 19/* Responses from hook functions. */
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index bad1eb760f6..885cbe28226 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -122,7 +122,7 @@ enum ip_conntrack_events
122 IPCT_NATINFO_BIT = 10, 122 IPCT_NATINFO_BIT = 10,
123 IPCT_NATINFO = (1 << IPCT_NATINFO_BIT), 123 IPCT_NATINFO = (1 << IPCT_NATINFO_BIT),
124 124
125 /* Counter highest bit has been set */ 125 /* Counter highest bit has been set, unused */
126 IPCT_COUNTER_FILLING_BIT = 11, 126 IPCT_COUNTER_FILLING_BIT = 11,
127 IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT), 127 IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT),
128 128
@@ -145,12 +145,6 @@ enum ip_conntrack_expect_events {
145}; 145};
146 146
147#ifdef __KERNEL__ 147#ifdef __KERNEL__
148struct ip_conntrack_counter
149{
150 u_int32_t packets;
151 u_int32_t bytes;
152};
153
154struct ip_conntrack_stat 148struct ip_conntrack_stat
155{ 149{
156 unsigned int searched; 150 unsigned int searched;
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h
index 5da04e586a3..23aa2ec6b7b 100644
--- a/include/linux/netfilter/nf_conntrack_sip.h
+++ b/include/linux/netfilter/nf_conntrack_sip.h
@@ -7,6 +7,7 @@
7 7
8struct nf_ct_sip_master { 8struct nf_ct_sip_master {
9 unsigned int register_cseq; 9 unsigned int register_cseq;
10 unsigned int invite_cseq;
10}; 11};
11 12
12enum sip_expectation_classes { 13enum sip_expectation_classes {
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index 0a383ac083c..c19595c8930 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -81,6 +81,7 @@ enum ctattr_protoinfo {
81 CTA_PROTOINFO_UNSPEC, 81 CTA_PROTOINFO_UNSPEC,
82 CTA_PROTOINFO_TCP, 82 CTA_PROTOINFO_TCP,
83 CTA_PROTOINFO_DCCP, 83 CTA_PROTOINFO_DCCP,
84 CTA_PROTOINFO_SCTP,
84 __CTA_PROTOINFO_MAX 85 __CTA_PROTOINFO_MAX
85}; 86};
86#define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1) 87#define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1)
@@ -103,12 +104,21 @@ enum ctattr_protoinfo_dccp {
103}; 104};
104#define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1) 105#define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1)
105 106
107enum ctattr_protoinfo_sctp {
108 CTA_PROTOINFO_SCTP_UNSPEC,
109 CTA_PROTOINFO_SCTP_STATE,
110 CTA_PROTOINFO_SCTP_VTAG_ORIGINAL,
111 CTA_PROTOINFO_SCTP_VTAG_REPLY,
112 __CTA_PROTOINFO_SCTP_MAX
113};
114#define CTA_PROTOINFO_SCTP_MAX (__CTA_PROTOINFO_SCTP_MAX - 1)
115
106enum ctattr_counters { 116enum ctattr_counters {
107 CTA_COUNTERS_UNSPEC, 117 CTA_COUNTERS_UNSPEC,
108 CTA_COUNTERS_PACKETS, /* old 64bit counters */ 118 CTA_COUNTERS_PACKETS, /* 64bit counters */
109 CTA_COUNTERS_BYTES, /* old 64bit counters */ 119 CTA_COUNTERS_BYTES, /* 64bit counters */
110 CTA_COUNTERS32_PACKETS, 120 CTA_COUNTERS32_PACKETS, /* old 32bit counters, unused */
111 CTA_COUNTERS32_BYTES, 121 CTA_COUNTERS32_BYTES, /* old 32bit counters, unused */
112 __CTA_COUNTERS_MAX 122 __CTA_COUNTERS_MAX
113}; 123};
114#define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1) 124#define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1)
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h
index a8572133292..f661731f3cb 100644
--- a/include/linux/netfilter/nfnetlink_log.h
+++ b/include/linux/netfilter/nfnetlink_log.h
@@ -48,6 +48,9 @@ enum nfulnl_attr_type {
48 NFULA_SEQ, /* instance-local sequence number */ 48 NFULA_SEQ, /* instance-local sequence number */
49 NFULA_SEQ_GLOBAL, /* global sequence number */ 49 NFULA_SEQ_GLOBAL, /* global sequence number */
50 NFULA_GID, /* group id of socket */ 50 NFULA_GID, /* group id of socket */
51 NFULA_HWTYPE, /* hardware type */
52 NFULA_HWHEADER, /* hardware header */
53 NFULA_HWLEN, /* hardware header length */
51 54
52 __NFULA_MAX 55 __NFULA_MAX
53}; 56};
diff --git a/include/linux/netfilter/xt_string.h b/include/linux/netfilter/xt_string.h
index bb21dd1aee2..8a6ba7bbef9 100644
--- a/include/linux/netfilter/xt_string.h
+++ b/include/linux/netfilter/xt_string.h
@@ -4,6 +4,11 @@
4#define XT_STRING_MAX_PATTERN_SIZE 128 4#define XT_STRING_MAX_PATTERN_SIZE 128
5#define XT_STRING_MAX_ALGO_NAME_SIZE 16 5#define XT_STRING_MAX_ALGO_NAME_SIZE 16
6 6
7enum {
8 XT_STRING_FLAG_INVERT = 0x01,
9 XT_STRING_FLAG_IGNORECASE = 0x02
10};
11
7struct xt_string_info 12struct xt_string_info
8{ 13{
9 u_int16_t from_offset; 14 u_int16_t from_offset;
@@ -11,7 +16,15 @@ struct xt_string_info
11 char algo[XT_STRING_MAX_ALGO_NAME_SIZE]; 16 char algo[XT_STRING_MAX_ALGO_NAME_SIZE];
12 char pattern[XT_STRING_MAX_PATTERN_SIZE]; 17 char pattern[XT_STRING_MAX_PATTERN_SIZE];
13 u_int8_t patlen; 18 u_int8_t patlen;
14 u_int8_t invert; 19 union {
20 struct {
21 u_int8_t invert;
22 } v0;
23
24 struct {
25 u_int8_t flags;
26 } v1;
27 } u;
15 28
16 /* Used internally by the kernel */ 29 /* Used internally by the kernel */
17 struct ts_config __attribute__((aligned(8))) *config; 30 struct ts_config __attribute__((aligned(8))) *config;
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index dd9c97f2d43..590ac3d6d5d 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -11,11 +11,11 @@
11 11
12#ifdef __KERNEL__ 12#ifdef __KERNEL__
13#include <linux/if.h> 13#include <linux/if.h>
14#include <linux/types.h>
15#include <linux/in.h> 14#include <linux/in.h>
16#include <linux/if_arp.h> 15#include <linux/if_arp.h>
17#include <linux/skbuff.h> 16#include <linux/skbuff.h>
18#endif 17#endif
18#include <linux/types.h>
19#include <linux/compiler.h> 19#include <linux/compiler.h>
20#include <linux/netfilter_arp.h> 20#include <linux/netfilter_arp.h>
21 21
diff --git a/include/linux/netfilter_bridge/ebt_ip6.h b/include/linux/netfilter_bridge/ebt_ip6.h
new file mode 100644
index 00000000000..2273c3ae33c
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_ip6.h
@@ -0,0 +1,40 @@
1/*
2 * ebt_ip6
3 *
4 * Authors:
5 * Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
6 * Manohar Castelino <manohar.r.castelino@intel.com>
7 *
8 * Jan 11, 2008
9 *
10 */
11
12#ifndef __LINUX_BRIDGE_EBT_IP6_H
13#define __LINUX_BRIDGE_EBT_IP6_H
14
15#define EBT_IP6_SOURCE 0x01
16#define EBT_IP6_DEST 0x02
17#define EBT_IP6_TCLASS 0x04
18#define EBT_IP6_PROTO 0x08
19#define EBT_IP6_SPORT 0x10
20#define EBT_IP6_DPORT 0x20
21#define EBT_IP6_MASK (EBT_IP6_SOURCE | EBT_IP6_DEST | EBT_IP6_TCLASS |\
22 EBT_IP6_PROTO | EBT_IP6_SPORT | EBT_IP6_DPORT)
23#define EBT_IP6_MATCH "ip6"
24
25/* the same values are used for the invflags */
26struct ebt_ip6_info
27{
28 struct in6_addr saddr;
29 struct in6_addr daddr;
30 struct in6_addr smsk;
31 struct in6_addr dmsk;
32 uint8_t tclass;
33 uint8_t protocol;
34 uint8_t bitmask;
35 uint8_t invflags;
36 uint16_t sport[2];
37 uint16_t dport[2];
38};
39
40#endif
diff --git a/include/linux/netfilter_bridge/ebt_log.h b/include/linux/netfilter_bridge/ebt_log.h
index 96e231ae755..b76e653157e 100644
--- a/include/linux/netfilter_bridge/ebt_log.h
+++ b/include/linux/netfilter_bridge/ebt_log.h
@@ -4,7 +4,8 @@
4#define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */ 4#define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */
5#define EBT_LOG_ARP 0x02 5#define EBT_LOG_ARP 0x02
6#define EBT_LOG_NFLOG 0x04 6#define EBT_LOG_NFLOG 0x04
7#define EBT_LOG_MASK (EBT_LOG_IP | EBT_LOG_ARP) 7#define EBT_LOG_IP6 0x08
8#define EBT_LOG_MASK (EBT_LOG_IP | EBT_LOG_ARP | EBT_LOG_IP6)
8#define EBT_LOG_PREFIX_SIZE 30 9#define EBT_LOG_PREFIX_SIZE 30
9#define EBT_LOG_WATCHER "log" 10#define EBT_LOG_WATCHER "log"
10 11
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index 650318b0c40..29c7727ff0e 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -60,6 +60,7 @@ enum nf_ip_hook_priorities {
60 NF_IP_PRI_MANGLE = -150, 60 NF_IP_PRI_MANGLE = -150,
61 NF_IP_PRI_NAT_DST = -100, 61 NF_IP_PRI_NAT_DST = -100,
62 NF_IP_PRI_FILTER = 0, 62 NF_IP_PRI_FILTER = 0,
63 NF_IP_PRI_SECURITY = 50,
63 NF_IP_PRI_NAT_SRC = 100, 64 NF_IP_PRI_NAT_SRC = 100,
64 NF_IP_PRI_SELINUX_LAST = 225, 65 NF_IP_PRI_SELINUX_LAST = 225,
65 NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX, 66 NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX,
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index bfc889f9027..092bd50581a 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -17,11 +17,11 @@
17 17
18#ifdef __KERNEL__ 18#ifdef __KERNEL__
19#include <linux/if.h> 19#include <linux/if.h>
20#include <linux/types.h>
21#include <linux/in.h> 20#include <linux/in.h>
22#include <linux/ip.h> 21#include <linux/ip.h>
23#include <linux/skbuff.h> 22#include <linux/skbuff.h>
24#endif 23#endif
24#include <linux/types.h>
25#include <linux/compiler.h> 25#include <linux/compiler.h>
26#include <linux/netfilter_ipv4.h> 26#include <linux/netfilter_ipv4.h>
27 27
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index 3475a65dae9..d654873aa25 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -64,11 +64,14 @@ enum nf_ip6_hook_priorities {
64 NF_IP6_PRI_MANGLE = -150, 64 NF_IP6_PRI_MANGLE = -150,
65 NF_IP6_PRI_NAT_DST = -100, 65 NF_IP6_PRI_NAT_DST = -100,
66 NF_IP6_PRI_FILTER = 0, 66 NF_IP6_PRI_FILTER = 0,
67 NF_IP6_PRI_SECURITY = 50,
67 NF_IP6_PRI_NAT_SRC = 100, 68 NF_IP6_PRI_NAT_SRC = 100,
68 NF_IP6_PRI_SELINUX_LAST = 225, 69 NF_IP6_PRI_SELINUX_LAST = 225,
69 NF_IP6_PRI_LAST = INT_MAX, 70 NF_IP6_PRI_LAST = INT_MAX,
70}; 71};
71 72
73#ifdef __KERNEL__
74
72#ifdef CONFIG_NETFILTER 75#ifdef CONFIG_NETFILTER
73extern int ip6_route_me_harder(struct sk_buff *skb); 76extern int ip6_route_me_harder(struct sk_buff *skb);
74extern __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, 77extern __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
@@ -81,4 +84,6 @@ static inline int ipv6_netfilter_init(void) { return 0; }
81static inline void ipv6_netfilter_fini(void) { return; } 84static inline void ipv6_netfilter_fini(void) { return; }
82#endif /* CONFIG_NETFILTER */ 85#endif /* CONFIG_NETFILTER */
83 86
87#endif /* __KERNEL__ */
88
84#endif /*__LINUX_IP6_NETFILTER_H*/ 89#endif /*__LINUX_IP6_NETFILTER_H*/
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index f2507dcc575..1089e33cf63 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -17,11 +17,11 @@
17 17
18#ifdef __KERNEL__ 18#ifdef __KERNEL__
19#include <linux/if.h> 19#include <linux/if.h>
20#include <linux/types.h>
21#include <linux/in6.h> 20#include <linux/in6.h>
22#include <linux/ipv6.h> 21#include <linux/ipv6.h>
23#include <linux/skbuff.h> 22#include <linux/skbuff.h>
24#endif 23#endif
24#include <linux/types.h>
25#include <linux/compiler.h> 25#include <linux/compiler.h>
26#include <linux/netfilter_ipv6.h> 26#include <linux/netfilter_ipv6.h>
27 27
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index bec1062a25a..9ff1b54908f 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -193,7 +193,7 @@ extern int netlink_unregister_notifier(struct notifier_block *nb);
193 193
194/* finegrained unicast helpers: */ 194/* finegrained unicast helpers: */
195struct sock *netlink_getsockbyfilp(struct file *filp); 195struct sock *netlink_getsockbyfilp(struct file *filp);
196int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, 196int netlink_attachskb(struct sock *sk, struct sk_buff *skb,
197 long *timeo, struct sock *ssk); 197 long *timeo, struct sock *ssk);
198void netlink_detachskb(struct sock *sk, struct sk_buff *skb); 198void netlink_detachskb(struct sock *sk, struct sk_buff *skb);
199int netlink_sendskb(struct sock *sk, struct sk_buff *skb); 199int netlink_sendskb(struct sock *sk, struct sk_buff *skb);
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 8726491de15..ea036676948 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -65,9 +65,6 @@
65#define NFS4_ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010 65#define NFS4_ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010
66#define NFS4_ACE_FAILED_ACCESS_ACE_FLAG 0x00000020 66#define NFS4_ACE_FAILED_ACCESS_ACE_FLAG 0x00000020
67#define NFS4_ACE_IDENTIFIER_GROUP 0x00000040 67#define NFS4_ACE_IDENTIFIER_GROUP 0x00000040
68#define NFS4_ACE_OWNER 0x00000080
69#define NFS4_ACE_GROUP 0x00000100
70#define NFS4_ACE_EVERYONE 0x00000200
71 68
72#define NFS4_ACE_READ_DATA 0x00000001 69#define NFS4_ACE_READ_DATA 0x00000001
73#define NFS4_ACE_LIST_DIRECTORY 0x00000001 70#define NFS4_ACE_LIST_DIRECTORY 0x00000001
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 27d6a8d98ce..78a5922a2f1 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -12,9 +12,19 @@
12#include <linux/magic.h> 12#include <linux/magic.h>
13 13
14/* Default timeout values */ 14/* Default timeout values */
15#define NFS_DEF_UDP_TIMEO (11)
16#define NFS_DEF_UDP_RETRANS (3)
17#define NFS_DEF_TCP_TIMEO (600)
18#define NFS_DEF_TCP_RETRANS (2)
19
15#define NFS_MAX_UDP_TIMEOUT (60*HZ) 20#define NFS_MAX_UDP_TIMEOUT (60*HZ)
16#define NFS_MAX_TCP_TIMEOUT (600*HZ) 21#define NFS_MAX_TCP_TIMEOUT (600*HZ)
17 22
23#define NFS_DEF_ACREGMIN (3)
24#define NFS_DEF_ACREGMAX (60)
25#define NFS_DEF_ACDIRMIN (30)
26#define NFS_DEF_ACDIRMAX (60)
27
18/* 28/*
19 * When flushing a cluster of dirty pages, there can be different 29 * When flushing a cluster of dirty pages, there can be different
20 * strategies: 30 * strategies:
@@ -32,7 +42,6 @@
32#include <linux/in.h> 42#include <linux/in.h>
33#include <linux/kref.h> 43#include <linux/kref.h>
34#include <linux/mm.h> 44#include <linux/mm.h>
35#include <linux/namei.h>
36#include <linux/pagemap.h> 45#include <linux/pagemap.h>
37#include <linux/rbtree.h> 46#include <linux/rbtree.h>
38#include <linux/rwsem.h> 47#include <linux/rwsem.h>
@@ -322,7 +331,7 @@ extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *);
322extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); 331extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr);
323extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); 332extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr);
324extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); 333extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
325extern int nfs_permission(struct inode *, int, struct nameidata *); 334extern int nfs_permission(struct inode *, int);
326extern int nfs_open(struct inode *, struct file *); 335extern int nfs_open(struct inode *, struct file *);
327extern int nfs_release(struct inode *, struct file *); 336extern int nfs_release(struct inode *, struct file *);
328extern int nfs_attribute_timeout(struct inode *inode); 337extern int nfs_attribute_timeout(struct inode *inode);
diff --git a/include/linux/nfs_iostat.h b/include/linux/nfs_iostat.h
new file mode 100644
index 00000000000..1cb9a3fed2b
--- /dev/null
+++ b/include/linux/nfs_iostat.h
@@ -0,0 +1,119 @@
1/*
2 * User-space visible declarations for NFS client per-mount
3 * point statistics
4 *
5 * Copyright (C) 2005, 2006 Chuck Lever <cel@netapp.com>
6 *
7 * NFS client per-mount statistics provide information about the
8 * health of the NFS client and the health of each NFS mount point.
9 * Generally these are not for detailed problem diagnosis, but
10 * simply to indicate that there is a problem.
11 *
12 * These counters are not meant to be human-readable, but are meant
13 * to be integrated into system monitoring tools such as "sar" and
14 * "iostat". As such, the counters are sampled by the tools over
15 * time, and are never zeroed after a file system is mounted.
16 * Moving averages can be computed by the tools by taking the
17 * difference between two instantaneous samples and dividing that
18 * by the time between the samples.
19 */
20
21#ifndef _LINUX_NFS_IOSTAT
22#define _LINUX_NFS_IOSTAT
23
24#define NFS_IOSTAT_VERS "1.0"
25
26/*
27 * NFS byte counters
28 *
29 * 1. SERVER - the number of payload bytes read from or written
30 * to the server by the NFS client via an NFS READ or WRITE
31 * request.
32 *
33 * 2. NORMAL - the number of bytes read or written by applications
34 * via the read(2) and write(2) system call interfaces.
35 *
36 * 3. DIRECT - the number of bytes read or written from files
37 * opened with the O_DIRECT flag.
38 *
39 * These counters give a view of the data throughput into and out
40 * of the NFS client. Comparing the number of bytes requested by
41 * an application with the number of bytes the client requests from
42 * the server can provide an indication of client efficiency
43 * (per-op, cache hits, etc).
44 *
45 * These counters can also help characterize which access methods
46 * are in use. DIRECT by itself shows whether there is any O_DIRECT
47 * traffic. NORMAL + DIRECT shows how much data is going through
48 * the system call interface. A large amount of SERVER traffic
49 * without much NORMAL or DIRECT traffic shows that applications
50 * are using mapped files.
51 *
52 * NFS page counters
53 *
54 * These count the number of pages read or written via nfs_readpage(),
55 * nfs_readpages(), or their write equivalents.
56 *
57 * NB: When adding new byte counters, please include the measured
58 * units in the name of each byte counter to help users of this
59 * interface determine what exactly is being counted.
60 */
61enum nfs_stat_bytecounters {
62 NFSIOS_NORMALREADBYTES = 0,
63 NFSIOS_NORMALWRITTENBYTES,
64 NFSIOS_DIRECTREADBYTES,
65 NFSIOS_DIRECTWRITTENBYTES,
66 NFSIOS_SERVERREADBYTES,
67 NFSIOS_SERVERWRITTENBYTES,
68 NFSIOS_READPAGES,
69 NFSIOS_WRITEPAGES,
70 __NFSIOS_BYTESMAX,
71};
72
73/*
74 * NFS event counters
75 *
76 * These counters provide a low-overhead way of monitoring client
77 * activity without enabling NFS trace debugging. The counters
78 * show the rate at which VFS requests are made, and how often the
79 * client invalidates its data and attribute caches. This allows
80 * system administrators to monitor such things as how close-to-open
81 * is working, and answer questions such as "why are there so many
82 * GETATTR requests on the wire?"
83 *
84 * They also count anamolous events such as short reads and writes,
85 * silly renames due to close-after-delete, and operations that
86 * change the size of a file (such operations can often be the
87 * source of data corruption if applications aren't using file
88 * locking properly).
89 */
90enum nfs_stat_eventcounters {
91 NFSIOS_INODEREVALIDATE = 0,
92 NFSIOS_DENTRYREVALIDATE,
93 NFSIOS_DATAINVALIDATE,
94 NFSIOS_ATTRINVALIDATE,
95 NFSIOS_VFSOPEN,
96 NFSIOS_VFSLOOKUP,
97 NFSIOS_VFSACCESS,
98 NFSIOS_VFSUPDATEPAGE,
99 NFSIOS_VFSREADPAGE,
100 NFSIOS_VFSREADPAGES,
101 NFSIOS_VFSWRITEPAGE,
102 NFSIOS_VFSWRITEPAGES,
103 NFSIOS_VFSGETDENTS,
104 NFSIOS_VFSSETATTR,
105 NFSIOS_VFSFLUSH,
106 NFSIOS_VFSFSYNC,
107 NFSIOS_VFSLOCK,
108 NFSIOS_VFSRELEASE,
109 NFSIOS_CONGESTIONWAIT,
110 NFSIOS_SETATTRTRUNC,
111 NFSIOS_EXTENDWRITE,
112 NFSIOS_SILLYRENAME,
113 NFSIOS_SHORTREAD,
114 NFSIOS_SHORTWRITE,
115 NFSIOS_DELAY,
116 __NFSIOS_COUNTSMAX,
117};
118
119#endif /* _LINUX_NFS_IOSTAT */
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index a1676e19e49..3c60685d972 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -27,9 +27,12 @@
27/* 27/*
28 * Valid flags for a dirty buffer 28 * Valid flags for a dirty buffer
29 */ 29 */
30#define PG_BUSY 0 30enum {
31#define PG_NEED_COMMIT 1 31 PG_BUSY = 0,
32#define PG_NEED_RESCHED 2 32 PG_CLEAN,
33 PG_NEED_COMMIT,
34 PG_NEED_RESCHED,
35};
33 36
34struct nfs_inode; 37struct nfs_inode;
35struct nfs_page { 38struct nfs_page {
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 24263bb8e0b..8c77c11224d 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -829,9 +829,8 @@ struct nfs_rpc_ops {
829 int (*write_done) (struct rpc_task *, struct nfs_write_data *); 829 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
830 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *); 830 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
831 int (*commit_done) (struct rpc_task *, struct nfs_write_data *); 831 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
832 int (*file_open) (struct inode *, struct file *);
833 int (*file_release) (struct inode *, struct file *);
834 int (*lock)(struct file *, int, struct file_lock *); 832 int (*lock)(struct file *, int, struct file_lock *);
833 int (*lock_check_bounds)(const struct file_lock *);
835 void (*clear_acl_cache)(struct inode *); 834 void (*clear_acl_cache)(struct inode *);
836}; 835};
837 836
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 41d30c9c9de..108f47e5fd9 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -12,7 +12,6 @@
12 12
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/unistd.h> 14#include <linux/unistd.h>
15#include <linux/dirent.h>
16#include <linux/fs.h> 15#include <linux/fs.h>
17#include <linux/posix_acl.h> 16#include <linux/posix_acl.h>
18#include <linux/mount.h> 17#include <linux/mount.h>
@@ -28,20 +27,20 @@
28#define NFSD_SUPPORTED_MINOR_VERSION 0 27#define NFSD_SUPPORTED_MINOR_VERSION 0
29 28
30/* 29/*
31 * Special flags for nfsd_permission. These must be different from MAY_READ, 30 * Flags for nfsd_permission
32 * MAY_WRITE, and MAY_EXEC.
33 */ 31 */
34#define MAY_NOP 0 32#define NFSD_MAY_NOP 0
35#define MAY_SATTR 8 33#define NFSD_MAY_EXEC 1 /* == MAY_EXEC */
36#define MAY_TRUNC 16 34#define NFSD_MAY_WRITE 2 /* == MAY_WRITE */
37#define MAY_LOCK 32 35#define NFSD_MAY_READ 4 /* == MAY_READ */
38#define MAY_OWNER_OVERRIDE 64 36#define NFSD_MAY_SATTR 8
39#define MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/ 37#define NFSD_MAY_TRUNC 16
40#if (MAY_SATTR | MAY_TRUNC | MAY_LOCK | MAY_OWNER_OVERRIDE | MAY_LOCAL_ACCESS) & (MAY_READ | MAY_WRITE | MAY_EXEC) 38#define NFSD_MAY_LOCK 32
41# error "please use a different value for MAY_SATTR or MAY_TRUNC or MAY_LOCK or MAY_LOCAL_ACCESS or MAY_OWNER_OVERRIDE." 39#define NFSD_MAY_OWNER_OVERRIDE 64
42#endif 40#define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/
43#define MAY_CREATE (MAY_EXEC|MAY_WRITE) 41
44#define MAY_REMOVE (MAY_EXEC|MAY_WRITE|MAY_TRUNC) 42#define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE)
43#define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC)
45 44
46/* 45/*
47 * Callback function for readdir 46 * Callback function for readdir
@@ -54,6 +53,7 @@ typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int);
54extern struct svc_program nfsd_program; 53extern struct svc_program nfsd_program;
55extern struct svc_version nfsd_version2, nfsd_version3, 54extern struct svc_version nfsd_version2, nfsd_version3,
56 nfsd_version4; 55 nfsd_version4;
56extern struct mutex nfsd_mutex;
57extern struct svc_serv *nfsd_serv; 57extern struct svc_serv *nfsd_serv;
58 58
59extern struct seq_operations nfs_exports_op; 59extern struct seq_operations nfs_exports_op;
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index db348f74937..d0fe2e37845 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -98,8 +98,6 @@ struct nfs4_callback {
98 u32 cb_ident; 98 u32 cb_ident;
99 /* RPC client info */ 99 /* RPC client info */
100 atomic_t cb_set; /* successful CB_NULL call */ 100 atomic_t cb_set; /* successful CB_NULL call */
101 struct rpc_program cb_program;
102 struct rpc_stat cb_stat;
103 struct rpc_clnt * cb_client; 101 struct rpc_clnt * cb_client;
104}; 102};
105 103
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index ea6517e58b0..2be7c63bc0f 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -122,13 +122,13 @@ enum nl80211_commands {
122 NL80211_CMD_NEW_STATION, 122 NL80211_CMD_NEW_STATION,
123 NL80211_CMD_DEL_STATION, 123 NL80211_CMD_DEL_STATION,
124 124
125 /* add commands here */
126
127 NL80211_CMD_GET_MPATH, 125 NL80211_CMD_GET_MPATH,
128 NL80211_CMD_SET_MPATH, 126 NL80211_CMD_SET_MPATH,
129 NL80211_CMD_NEW_MPATH, 127 NL80211_CMD_NEW_MPATH,
130 NL80211_CMD_DEL_MPATH, 128 NL80211_CMD_DEL_MPATH,
131 129
130 /* add commands here */
131
132 /* used to define NL80211_CMD_MAX below */ 132 /* used to define NL80211_CMD_MAX below */
133 __NL80211_CMD_AFTER_LAST, 133 __NL80211_CMD_AFTER_LAST,
134 NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 134 NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1
@@ -230,18 +230,21 @@ enum nl80211_attrs {
230 230
231 NL80211_ATTR_MNTR_FLAGS, 231 NL80211_ATTR_MNTR_FLAGS,
232 232
233 /* add attributes here, update the policy in nl80211.c */
234
235 NL80211_ATTR_MESH_ID, 233 NL80211_ATTR_MESH_ID,
236 NL80211_ATTR_STA_PLINK_ACTION, 234 NL80211_ATTR_STA_PLINK_ACTION,
237 NL80211_ATTR_MPATH_NEXT_HOP, 235 NL80211_ATTR_MPATH_NEXT_HOP,
238 NL80211_ATTR_MPATH_INFO, 236 NL80211_ATTR_MPATH_INFO,
239 237
238 /* add attributes here, update the policy in nl80211.c */
239
240 __NL80211_ATTR_AFTER_LAST, 240 __NL80211_ATTR_AFTER_LAST,
241 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 241 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
242}; 242};
243 243
244#define NL80211_MAX_SUPP_RATES 32 244#define NL80211_MAX_SUPP_RATES 32
245#define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0
246#define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16
247#define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24
245 248
246/** 249/**
247 * enum nl80211_iftype - (virtual) interface types 250 * enum nl80211_iftype - (virtual) interface types
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 0ff6224d172..da2698b0fdd 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -197,6 +197,7 @@ static inline int notifier_to_errno(int ret)
197#define NETDEV_GOING_DOWN 0x0009 197#define NETDEV_GOING_DOWN 0x0009
198#define NETDEV_CHANGENAME 0x000A 198#define NETDEV_CHANGENAME 0x000A
199#define NETDEV_FEAT_CHANGE 0x000B 199#define NETDEV_FEAT_CHANGE 0x000B
200#define NETDEV_BONDING_FAILOVER 0x000C
200 201
201#define SYS_DOWN 0x0001 /* Notify of system down */ 202#define SYS_DOWN 0x0001 /* Notify of system down */
202#define SYS_RESTART SYS_DOWN 203#define SYS_RESTART SYS_DOWN
@@ -213,6 +214,8 @@ static inline int notifier_to_errno(int ret)
213#define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */ 214#define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */
214#define CPU_DYING 0x0008 /* CPU (unsigned)v not running any task, 215#define CPU_DYING 0x0008 /* CPU (unsigned)v not running any task,
215 * not handling interrupts, soon dead */ 216 * not handling interrupts, soon dead */
217#define CPU_POST_DEAD 0x0009 /* CPU (unsigned)v dead, cpu_hotplug
218 * lock is dropped */
216 219
217/* Used for CPU hotplug events occuring while tasks are frozen due to a suspend 220/* Used for CPU hotplug events occuring while tasks are frozen due to a suspend
218 * operation in progress 221 * operation in progress
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index 0e66b57631f..c8a768e5964 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -82,9 +82,12 @@ static inline void get_nsproxy(struct nsproxy *ns)
82} 82}
83 83
84#ifdef CONFIG_CGROUP_NS 84#ifdef CONFIG_CGROUP_NS
85int ns_cgroup_clone(struct task_struct *tsk); 85int ns_cgroup_clone(struct task_struct *tsk, struct pid *pid);
86#else 86#else
87static inline int ns_cgroup_clone(struct task_struct *tsk) { return 0; } 87static inline int ns_cgroup_clone(struct task_struct *tsk, struct pid *pid)
88{
89 return 0;
90}
88#endif 91#endif
89 92
90#endif 93#endif
diff --git a/include/linux/of.h b/include/linux/of.h
index 59a61bdc98b..79886ade070 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -70,5 +70,6 @@ extern int of_n_addr_cells(struct device_node *np);
70extern int of_n_size_cells(struct device_node *np); 70extern int of_n_size_cells(struct device_node *np);
71extern const struct of_device_id *of_match_node( 71extern const struct of_device_id *of_match_node(
72 const struct of_device_id *matches, const struct device_node *node); 72 const struct of_device_id *matches, const struct device_node *node);
73extern int of_modalias_node(struct device_node *node, char *modalias, int len);
73 74
74#endif /* _LINUX_OF_H */ 75#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index afe338217d9..d3a74e00a3e 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -24,4 +24,7 @@ static inline void of_device_free(struct of_device *dev)
24 of_release_dev(&dev->dev); 24 of_release_dev(&dev->dev);
25} 25}
26 26
27extern ssize_t of_device_get_modalias(struct of_device *ofdev,
28 char *str, ssize_t len);
29
27#endif /* _LINUX_OF_DEVICE_H */ 30#endif /* _LINUX_OF_DEVICE_H */
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index 2ee97e9877a..67db101d0eb 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -15,7 +15,7 @@
15#define __LINUX_OF_GPIO_H 15#define __LINUX_OF_GPIO_H
16 16
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <asm/gpio.h> 18#include <linux/gpio.h>
19 19
20#ifdef CONFIG_OF_GPIO 20#ifdef CONFIG_OF_GPIO
21 21
diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h
index 2e5a9673204..bd2a870ec29 100644
--- a/include/linux/of_i2c.h
+++ b/include/linux/of_i2c.h
@@ -14,11 +14,7 @@
14 14
15#include <linux/i2c.h> 15#include <linux/i2c.h>
16 16
17#ifdef CONFIG_OF_I2C
18
19void of_register_i2c_devices(struct i2c_adapter *adap, 17void of_register_i2c_devices(struct i2c_adapter *adap,
20 struct device_node *adap_node); 18 struct device_node *adap_node);
21 19
22#endif /* CONFIG_OF_I2C */
23
24#endif /* __LINUX_OF_I2C_H */ 20#endif /* __LINUX_OF_I2C_H */
diff --git a/include/linux/of_spi.h b/include/linux/of_spi.h
new file mode 100644
index 00000000000..5f71ee8c086
--- /dev/null
+++ b/include/linux/of_spi.h
@@ -0,0 +1,18 @@
1/*
2 * OpenFirmware SPI support routines
3 * Copyright (C) 2008 Secret Lab Technologies Ltd.
4 *
5 * Support routines for deriving SPI device attachments from the device
6 * tree.
7 */
8
9#ifndef __LINUX_OF_SPI_H
10#define __LINUX_OF_SPI_H
11
12#include <linux/of.h>
13#include <linux/spi/spi.h>
14
15extern void of_register_spi_devices(struct spi_master *master,
16 struct device_node *np);
17
18#endif /* __LINUX_OF_SPI */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 590cff32415..54590a9a103 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -96,7 +96,22 @@ enum pageflags {
96#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR 96#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR
97 PG_uncached, /* Page has been mapped as uncached */ 97 PG_uncached, /* Page has been mapped as uncached */
98#endif 98#endif
99 __NR_PAGEFLAGS 99 __NR_PAGEFLAGS,
100
101 /* Filesystems */
102 PG_checked = PG_owner_priv_1,
103
104 /* XEN */
105 PG_pinned = PG_owner_priv_1,
106 PG_savepinned = PG_dirty,
107
108 /* SLOB */
109 PG_slob_page = PG_active,
110 PG_slob_free = PG_private,
111
112 /* SLUB */
113 PG_slub_frozen = PG_active,
114 PG_slub_debug = PG_error,
100}; 115};
101 116
102#ifndef __GENERATING_BOUNDS_H 117#ifndef __GENERATING_BOUNDS_H
@@ -155,12 +170,19 @@ PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty)
155PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru) 170PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru)
156PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active) 171PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active)
157__PAGEFLAG(Slab, slab) 172__PAGEFLAG(Slab, slab)
158PAGEFLAG(Checked, owner_priv_1) /* Used by some filesystems */ 173PAGEFLAG(Checked, checked) /* Used by some filesystems */
159PAGEFLAG(Pinned, owner_priv_1) TESTSCFLAG(Pinned, owner_priv_1) /* Xen */ 174PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned) /* Xen */
175PAGEFLAG(SavePinned, savepinned); /* Xen */
160PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) 176PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved)
161PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private) 177PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private)
162 __SETPAGEFLAG(Private, private) 178 __SETPAGEFLAG(Private, private)
163 179
180__PAGEFLAG(SlobPage, slob_page)
181__PAGEFLAG(SlobFree, slob_free)
182
183__PAGEFLAG(SlubFrozen, slub_frozen)
184__PAGEFLAG(SlubDebug, slub_debug)
185
164/* 186/*
165 * Only test-and-set exist for PG_writeback. The unconditional operators are 187 * Only test-and-set exist for PG_writeback. The unconditional operators are
166 * risky: they bypass page accounting. 188 * risky: they bypass page accounting.
@@ -306,5 +328,29 @@ static inline void __ClearPageTail(struct page *page)
306} 328}
307 329
308#endif /* !PAGEFLAGS_EXTENDED */ 330#endif /* !PAGEFLAGS_EXTENDED */
331
332#define PAGE_FLAGS (1 << PG_lru | 1 << PG_private | 1 << PG_locked | \
333 1 << PG_buddy | 1 << PG_writeback | \
334 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active)
335
336/*
337 * Flags checked in bad_page(). Pages on the free list should not have
338 * these flags set. It they are, there is a problem.
339 */
340#define PAGE_FLAGS_CLEAR_WHEN_BAD (PAGE_FLAGS | 1 << PG_reclaim | 1 << PG_dirty)
341
342/*
343 * Flags checked when a page is freed. Pages being freed should not have
344 * these flags set. It they are, there is a problem.
345 */
346#define PAGE_FLAGS_CHECK_AT_FREE (PAGE_FLAGS | 1 << PG_reserved)
347
348/*
349 * Flags checked when a page is prepped for return by the page allocator.
350 * Pages being prepped should not have these flags set. It they are, there
351 * is a problem.
352 */
353#define PAGE_FLAGS_CHECK_AT_PREP (PAGE_FLAGS | 1 << PG_reserved | 1 << PG_dirty)
354
309#endif /* !__GENERATING_BOUNDS_H */ 355#endif /* !__GENERATING_BOUNDS_H */
310#endif /* PAGE_FLAGS_H */ 356#endif /* PAGE_FLAGS_H */
diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h
index e875905f7b1..e8c06122be3 100644
--- a/include/linux/pageblock-flags.h
+++ b/include/linux/pageblock-flags.h
@@ -25,13 +25,11 @@
25 25
26#include <linux/types.h> 26#include <linux/types.h>
27 27
28/* Macro to aid the definition of ranges of bits */
29#define PB_range(name, required_bits) \
30 name, name ## _end = (name + required_bits) - 1
31
32/* Bit indices that affect a whole block of pages */ 28/* Bit indices that affect a whole block of pages */
33enum pageblock_bits { 29enum pageblock_bits {
34 PB_range(PB_migrate, 3), /* 3 bits required for migrate types */ 30 PB_migrate,
31 PB_migrate_end = PB_migrate + 3 - 1,
32 /* 3 bits required for migrate types */
35 NR_PAGEBLOCK_BITS 33 NR_PAGEBLOCK_BITS
36}; 34};
37 35
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index d2fca802f80..a39b38ccdc9 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -12,6 +12,7 @@
12#include <asm/uaccess.h> 12#include <asm/uaccess.h>
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 16
16/* 17/*
17 * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page 18 * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page
@@ -19,10 +20,11 @@
19 */ 20 */
20#define AS_EIO (__GFP_BITS_SHIFT + 0) /* IO error on async write */ 21#define AS_EIO (__GFP_BITS_SHIFT + 0) /* IO error on async write */
21#define AS_ENOSPC (__GFP_BITS_SHIFT + 1) /* ENOSPC on async write */ 22#define AS_ENOSPC (__GFP_BITS_SHIFT + 1) /* ENOSPC on async write */
23#define AS_MM_ALL_LOCKS (__GFP_BITS_SHIFT + 2) /* under mm_take_all_locks() */
22 24
23static inline void mapping_set_error(struct address_space *mapping, int error) 25static inline void mapping_set_error(struct address_space *mapping, int error)
24{ 26{
25 if (error) { 27 if (unlikely(error)) {
26 if (error == -ENOSPC) 28 if (error == -ENOSPC)
27 set_bit(AS_ENOSPC, &mapping->flags); 29 set_bit(AS_ENOSPC, &mapping->flags);
28 else 30 else
@@ -62,6 +64,98 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)
62#define page_cache_release(page) put_page(page) 64#define page_cache_release(page) put_page(page)
63void release_pages(struct page **pages, int nr, int cold); 65void release_pages(struct page **pages, int nr, int cold);
64 66
67/*
68 * speculatively take a reference to a page.
69 * If the page is free (_count == 0), then _count is untouched, and 0
70 * is returned. Otherwise, _count is incremented by 1 and 1 is returned.
71 *
72 * This function must be called inside the same rcu_read_lock() section as has
73 * been used to lookup the page in the pagecache radix-tree (or page table):
74 * this allows allocators to use a synchronize_rcu() to stabilize _count.
75 *
76 * Unless an RCU grace period has passed, the count of all pages coming out
77 * of the allocator must be considered unstable. page_count may return higher
78 * than expected, and put_page must be able to do the right thing when the
79 * page has been finished with, no matter what it is subsequently allocated
80 * for (because put_page is what is used here to drop an invalid speculative
81 * reference).
82 *
83 * This is the interesting part of the lockless pagecache (and lockless
84 * get_user_pages) locking protocol, where the lookup-side (eg. find_get_page)
85 * has the following pattern:
86 * 1. find page in radix tree
87 * 2. conditionally increment refcount
88 * 3. check the page is still in pagecache (if no, goto 1)
89 *
90 * Remove-side that cares about stability of _count (eg. reclaim) has the
91 * following (with tree_lock held for write):
92 * A. atomically check refcount is correct and set it to 0 (atomic_cmpxchg)
93 * B. remove page from pagecache
94 * C. free the page
95 *
96 * There are 2 critical interleavings that matter:
97 * - 2 runs before A: in this case, A sees elevated refcount and bails out
98 * - A runs before 2: in this case, 2 sees zero refcount and retries;
99 * subsequently, B will complete and 1 will find no page, causing the
100 * lookup to return NULL.
101 *
102 * It is possible that between 1 and 2, the page is removed then the exact same
103 * page is inserted into the same position in pagecache. That's OK: the
104 * old find_get_page using tree_lock could equally have run before or after
105 * such a re-insertion, depending on order that locks are granted.
106 *
107 * Lookups racing against pagecache insertion isn't a big problem: either 1
108 * will find the page or it will not. Likewise, the old find_get_page could run
109 * either before the insertion or afterwards, depending on timing.
110 */
111static inline int page_cache_get_speculative(struct page *page)
112{
113 VM_BUG_ON(in_interrupt());
114
115#if !defined(CONFIG_SMP) && defined(CONFIG_CLASSIC_RCU)
116# ifdef CONFIG_PREEMPT
117 VM_BUG_ON(!in_atomic());
118# endif
119 /*
120 * Preempt must be disabled here - we rely on rcu_read_lock doing
121 * this for us.
122 *
123 * Pagecache won't be truncated from interrupt context, so if we have
124 * found a page in the radix tree here, we have pinned its refcount by
125 * disabling preempt, and hence no need for the "speculative get" that
126 * SMP requires.
127 */
128 VM_BUG_ON(page_count(page) == 0);
129 atomic_inc(&page->_count);
130
131#else
132 if (unlikely(!get_page_unless_zero(page))) {
133 /*
134 * Either the page has been freed, or will be freed.
135 * In either case, retry here and the caller should
136 * do the right thing (see comments above).
137 */
138 return 0;
139 }
140#endif
141 VM_BUG_ON(PageTail(page));
142
143 return 1;
144}
145
146static inline int page_freeze_refs(struct page *page, int count)
147{
148 return likely(atomic_cmpxchg(&page->_count, count, 0) == count);
149}
150
151static inline void page_unfreeze_refs(struct page *page, int count)
152{
153 VM_BUG_ON(page_count(page) != 0);
154 VM_BUG_ON(count == 0);
155
156 atomic_set(&page->_count, count);
157}
158
65#ifdef CONFIG_NUMA 159#ifdef CONFIG_NUMA
66extern struct page *__page_cache_alloc(gfp_t gfp); 160extern struct page *__page_cache_alloc(gfp_t gfp);
67#else 161#else
@@ -133,7 +227,7 @@ static inline struct page *read_mapping_page(struct address_space *mapping,
133 return read_cache_page(mapping, index, filler, data); 227 return read_cache_page(mapping, index, filler, data);
134} 228}
135 229
136int add_to_page_cache(struct page *page, struct address_space *mapping, 230int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
137 pgoff_t index, gfp_t gfp_mask); 231 pgoff_t index, gfp_t gfp_mask);
138int add_to_page_cache_lru(struct page *page, struct address_space *mapping, 232int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
139 pgoff_t index, gfp_t gfp_mask); 233 pgoff_t index, gfp_t gfp_mask);
@@ -141,6 +235,22 @@ extern void remove_from_page_cache(struct page *page);
141extern void __remove_from_page_cache(struct page *page); 235extern void __remove_from_page_cache(struct page *page);
142 236
143/* 237/*
238 * Like add_to_page_cache_locked, but used to add newly allocated pages:
239 * the page is new, so we can just run SetPageLocked() against it.
240 */
241static inline int add_to_page_cache(struct page *page,
242 struct address_space *mapping, pgoff_t offset, gfp_t gfp_mask)
243{
244 int error;
245
246 SetPageLocked(page);
247 error = add_to_page_cache_locked(page, mapping, offset, gfp_mask);
248 if (unlikely(error))
249 ClearPageLocked(page);
250 return error;
251}
252
253/*
144 * Return byte-offset into filesystem object for page. 254 * Return byte-offset into filesystem object for page.
145 */ 255 */
146static inline loff_t page_offset(struct page *page) 256static inline loff_t page_offset(struct page *page)
diff --git a/include/linux/parport.h b/include/linux/parport.h
index dcb9e01a69c..6a0d7cdb577 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -560,5 +560,8 @@ extern int parport_device_proc_unregister(struct pardevice *device);
560 560
561#endif /* !CONFIG_PARPORT_NOT_PC */ 561#endif /* !CONFIG_PARPORT_NOT_PC */
562 562
563extern unsigned long parport_default_timeslice;
564extern int parport_default_spintime;
565
563#endif /* __KERNEL__ */ 566#endif /* __KERNEL__ */
564#endif /* _PARPORT_H_ */ 567#endif /* _PARPORT_H_ */
diff --git a/include/linux/parser.h b/include/linux/parser.h
index 26b2bdfcaf0..cc554ca8bc7 100644
--- a/include/linux/parser.h
+++ b/include/linux/parser.h
@@ -14,7 +14,7 @@ struct match_token {
14 const char *pattern; 14 const char *pattern;
15}; 15};
16 16
17typedef struct match_token match_table_t[]; 17typedef const struct match_token match_table_t[];
18 18
19/* Maximum number of arguments that match_token will find in a pattern */ 19/* Maximum number of arguments that match_token will find in a pattern */
20enum {MAX_OPT_ARGS = 3}; 20enum {MAX_OPT_ARGS = 3};
@@ -29,5 +29,5 @@ int match_token(char *, match_table_t table, substring_t args[]);
29int match_int(substring_t *, int *result); 29int match_int(substring_t *, int *result);
30int match_octal(substring_t *, int *result); 30int match_octal(substring_t *, int *result);
31int match_hex(substring_t *, int *result); 31int match_hex(substring_t *, int *result);
32void match_strcpy(char *, const substring_t *); 32size_t match_strlcpy(char *, const substring_t *, size_t);
33char *match_strdup(const substring_t *); 33char *match_strdup(const substring_t *);
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
index a1a1e618e99..91ba0b338b4 100644
--- a/include/linux/pci-aspm.h
+++ b/include/linux/pci-aspm.h
@@ -27,6 +27,7 @@ extern void pcie_aspm_init_link_state(struct pci_dev *pdev);
27extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); 27extern void pcie_aspm_exit_link_state(struct pci_dev *pdev);
28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); 28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev);
29extern void pci_disable_link_state(struct pci_dev *pdev, int state); 29extern void pci_disable_link_state(struct pci_dev *pdev, int state);
30extern void pcie_no_aspm(void);
30#else 31#else
31static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) 32static inline void pcie_aspm_init_link_state(struct pci_dev *pdev)
32{ 33{
@@ -40,6 +41,10 @@ static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev)
40static inline void pci_disable_link_state(struct pci_dev *pdev, int state) 41static inline void pci_disable_link_state(struct pci_dev *pdev, int state)
41{ 42{
42} 43}
44
45static inline void pcie_no_aspm(void)
46{
47}
43#endif 48#endif
44 49
45#ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */ 50#ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 96acd0dae24..825be3878f6 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -17,8 +17,7 @@
17#ifndef LINUX_PCI_H 17#ifndef LINUX_PCI_H
18#define LINUX_PCI_H 18#define LINUX_PCI_H
19 19
20/* Include the pci register defines */ 20#include <linux/pci_regs.h> /* The pci register defines */
21#include <linux/pci_regs.h>
22 21
23/* 22/*
24 * The PCI interface treats multi-function devices as independent 23 * The PCI interface treats multi-function devices as independent
@@ -44,16 +43,27 @@
44#include <linux/mod_devicetable.h> 43#include <linux/mod_devicetable.h>
45 44
46#include <linux/types.h> 45#include <linux/types.h>
46#include <linux/init.h>
47#include <linux/ioport.h> 47#include <linux/ioport.h>
48#include <linux/list.h> 48#include <linux/list.h>
49#include <linux/compiler.h> 49#include <linux/compiler.h>
50#include <linux/errno.h> 50#include <linux/errno.h>
51#include <linux/kobject.h>
51#include <asm/atomic.h> 52#include <asm/atomic.h>
52#include <linux/device.h> 53#include <linux/device.h>
53 54
54/* Include the ID list */ 55/* Include the ID list */
55#include <linux/pci_ids.h> 56#include <linux/pci_ids.h>
56 57
58/* pci_slot represents a physical slot */
59struct pci_slot {
60 struct pci_bus *bus; /* The bus this slot is on */
61 struct list_head list; /* node in list of slots on this bus */
62 struct hotplug_slot *hotplug; /* Hotplug info (migrate over time) */
63 unsigned char number; /* PCI_SLOT(pci_dev->devfn) */
64 struct kobject kobj;
65};
66
57/* File state for mmap()s on /proc/bus/pci/X/Y */ 67/* File state for mmap()s on /proc/bus/pci/X/Y */
58enum pci_mmap_state { 68enum pci_mmap_state {
59 pci_mmap_io, 69 pci_mmap_io,
@@ -114,6 +124,8 @@ enum pci_dev_flags {
114 * generation too. 124 * generation too.
115 */ 125 */
116 PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1, 126 PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1,
127 /* Device configuration is irrevocably lost if disabled into D3 */
128 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2,
117}; 129};
118 130
119typedef unsigned short __bitwise pci_bus_flags_t; 131typedef unsigned short __bitwise pci_bus_flags_t;
@@ -141,6 +153,7 @@ struct pci_dev {
141 153
142 void *sysdata; /* hook for sys-specific extension */ 154 void *sysdata; /* hook for sys-specific extension */
143 struct proc_dir_entry *procent; /* device entry in /proc/bus/pci */ 155 struct proc_dir_entry *procent; /* device entry in /proc/bus/pci */
156 struct pci_slot *slot; /* Physical slot this device is in */
144 157
145 unsigned int devfn; /* encoded device & function index */ 158 unsigned int devfn; /* encoded device & function index */
146 unsigned short vendor; 159 unsigned short vendor;
@@ -166,6 +179,13 @@ struct pci_dev {
166 pci_power_t current_state; /* Current operating state. In ACPI-speak, 179 pci_power_t current_state; /* Current operating state. In ACPI-speak,
167 this is D0-D3, D0 being fully functional, 180 this is D0-D3, D0 being fully functional,
168 and D3 being off. */ 181 and D3 being off. */
182 int pm_cap; /* PM capability offset in the
183 configuration space */
184 unsigned int pme_support:5; /* Bitmask of states from which PME#
185 can be generated */
186 unsigned int d1_support:1; /* Low power state D1 is supported */
187 unsigned int d2_support:1; /* Low power state D2 is supported */
188 unsigned int no_d1d2:1; /* Only allow D0 and D3 */
169 189
170#ifdef CONFIG_PCIEASPM 190#ifdef CONFIG_PCIEASPM
171 struct pcie_link_state *link_state; /* ASPM link state. */ 191 struct pcie_link_state *link_state; /* ASPM link state. */
@@ -190,7 +210,6 @@ struct pci_dev {
190 unsigned int is_added:1; 210 unsigned int is_added:1;
191 unsigned int is_busmaster:1; /* device is busmaster */ 211 unsigned int is_busmaster:1; /* device is busmaster */
192 unsigned int no_msi:1; /* device may not use msi */ 212 unsigned int no_msi:1; /* device may not use msi */
193 unsigned int no_d1d2:1; /* only allow d0 or d3 */
194 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */ 213 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */
195 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 214 unsigned int broken_parity_status:1; /* Device generates false positive parity */
196 unsigned int msi_enabled:1; 215 unsigned int msi_enabled:1;
@@ -205,6 +224,7 @@ struct pci_dev {
205 struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */ 224 struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */
206 int rom_attr_enabled; /* has display of the rom attribute been enabled? */ 225 int rom_attr_enabled; /* has display of the rom attribute been enabled? */
207 struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */ 226 struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */
227 struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */
208#ifdef CONFIG_PCI_MSI 228#ifdef CONFIG_PCI_MSI
209 struct list_head msi_list; 229 struct list_head msi_list;
210#endif 230#endif
@@ -265,6 +285,7 @@ struct pci_bus {
265 struct list_head children; /* list of child buses */ 285 struct list_head children; /* list of child buses */
266 struct list_head devices; /* list of devices on this bus */ 286 struct list_head devices; /* list of devices on this bus */
267 struct pci_dev *self; /* bridge device as seen by parent */ 287 struct pci_dev *self; /* bridge device as seen by parent */
288 struct list_head slots; /* list of slots on this bus */
268 struct resource *resource[PCI_BUS_NUM_RESOURCES]; 289 struct resource *resource[PCI_BUS_NUM_RESOURCES];
269 /* address space routed to this bus */ 290 /* address space routed to this bus */
270 291
@@ -326,7 +347,7 @@ struct pci_bus_region {
326struct pci_dynids { 347struct pci_dynids {
327 spinlock_t lock; /* protects list, index */ 348 spinlock_t lock; /* protects list, index */
328 struct list_head list; /* for IDs added at runtime */ 349 struct list_head list; /* for IDs added at runtime */
329 unsigned int use_driver_data:1; /* pci_driver->driver_data is used */ 350 unsigned int use_driver_data:1; /* pci_device_id->driver_data is used */
330}; 351};
331 352
332/* ---------------------------------------------------------------- */ 353/* ---------------------------------------------------------------- */
@@ -388,7 +409,7 @@ struct pci_driver {
388 int (*resume_early) (struct pci_dev *dev); 409 int (*resume_early) (struct pci_dev *dev);
389 int (*resume) (struct pci_dev *dev); /* Device woken up */ 410 int (*resume) (struct pci_dev *dev); /* Device woken up */
390 void (*shutdown) (struct pci_dev *dev); 411 void (*shutdown) (struct pci_dev *dev);
391 412 struct pm_ext_ops *pm;
392 struct pci_error_handlers *err_handler; 413 struct pci_error_handlers *err_handler;
393 struct device_driver driver; 414 struct device_driver driver;
394 struct pci_dynids dynids; 415 struct pci_dynids dynids;
@@ -474,7 +495,7 @@ extern struct pci_bus *pci_find_bus(int domain, int busnr);
474void pci_bus_add_devices(struct pci_bus *bus); 495void pci_bus_add_devices(struct pci_bus *bus);
475struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, 496struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
476 struct pci_ops *ops, void *sysdata); 497 struct pci_ops *ops, void *sysdata);
477static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, 498static inline struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops,
478 void *sysdata) 499 void *sysdata)
479{ 500{
480 struct pci_bus *root_bus; 501 struct pci_bus *root_bus;
@@ -487,6 +508,10 @@ struct pci_bus *pci_create_bus(struct device *parent, int bus,
487 struct pci_ops *ops, void *sysdata); 508 struct pci_ops *ops, void *sysdata);
488struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, 509struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
489 int busnr); 510 int busnr);
511struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
512 const char *name);
513void pci_destroy_slot(struct pci_slot *slot);
514void pci_update_slot_number(struct pci_slot *slot, int slot_nr);
490int pci_scan_slot(struct pci_bus *bus, int devfn); 515int pci_scan_slot(struct pci_bus *bus, int devfn);
491struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); 516struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
492void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); 517void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
@@ -615,7 +640,11 @@ int pci_save_state(struct pci_dev *dev);
615int pci_restore_state(struct pci_dev *dev); 640int pci_restore_state(struct pci_dev *dev);
616int pci_set_power_state(struct pci_dev *dev, pci_power_t state); 641int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
617pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); 642pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
643bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
618int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); 644int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
645pci_power_t pci_target_state(struct pci_dev *dev);
646int pci_prepare_to_sleep(struct pci_dev *dev);
647int pci_back_from_sleep(struct pci_dev *dev);
619 648
620/* Functions for PCI Hotplug drivers to use */ 649/* Functions for PCI Hotplug drivers to use */
621int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); 650int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
@@ -666,7 +695,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
666 695
667void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), 696void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *),
668 void *userdata); 697 void *userdata);
669int pci_cfg_space_size_ext(struct pci_dev *dev, unsigned check_exp_pcix); 698int pci_cfg_space_size_ext(struct pci_dev *dev);
670int pci_cfg_space_size(struct pci_dev *dev); 699int pci_cfg_space_size(struct pci_dev *dev);
671unsigned char pci_bus_max_busnr(struct pci_bus *bus); 700unsigned char pci_bus_max_busnr(struct pci_bus *bus);
672 701
@@ -837,6 +866,11 @@ static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
837 return -EIO; 866 return -EIO;
838} 867}
839 868
869static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
870{
871 return -EIO;
872}
873
840static inline int pci_set_dma_max_seg_size(struct pci_dev *dev, 874static inline int pci_set_dma_max_seg_size(struct pci_dev *dev,
841 unsigned int size) 875 unsigned int size)
842{ 876{
@@ -975,9 +1009,9 @@ static inline void pci_set_drvdata(struct pci_dev *pdev, void *data)
975/* If you want to know what to call your pci_dev, ask this function. 1009/* If you want to know what to call your pci_dev, ask this function.
976 * Again, it's a wrapper around the generic device. 1010 * Again, it's a wrapper around the generic device.
977 */ 1011 */
978static inline char *pci_name(struct pci_dev *pdev) 1012static inline const char *pci_name(struct pci_dev *pdev)
979{ 1013{
980 return pdev->dev.bus_id; 1014 return dev_name(&pdev->dev);
981} 1015}
982 1016
983 1017
@@ -1012,7 +1046,9 @@ enum pci_fixup_pass {
1012 pci_fixup_header, /* After reading configuration header */ 1046 pci_fixup_header, /* After reading configuration header */
1013 pci_fixup_final, /* Final phase of device fixups */ 1047 pci_fixup_final, /* Final phase of device fixups */
1014 pci_fixup_enable, /* pci_enable_device() time */ 1048 pci_fixup_enable, /* pci_enable_device() time */
1015 pci_fixup_resume, /* pci_enable_device() time */ 1049 pci_fixup_resume, /* pci_device_resume() */
1050 pci_fixup_suspend, /* pci_device_suspend */
1051 pci_fixup_resume_early, /* pci_device_resume_early() */
1016}; 1052};
1017 1053
1018/* Anonymous variables would be nice... */ 1054/* Anonymous variables would be nice... */
@@ -1034,6 +1070,12 @@ enum pci_fixup_pass {
1034#define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ 1070#define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \
1035 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ 1071 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \
1036 resume##vendor##device##hook, vendor, device, hook) 1072 resume##vendor##device##hook, vendor, device, hook)
1073#define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \
1074 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \
1075 resume_early##vendor##device##hook, vendor, device, hook)
1076#define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \
1077 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \
1078 suspend##vendor##device##hook, vendor, device, hook)
1037 1079
1038 1080
1039void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1081void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
@@ -1058,7 +1100,10 @@ extern int pci_pci_problems;
1058extern unsigned long pci_cardbus_io_size; 1100extern unsigned long pci_cardbus_io_size;
1059extern unsigned long pci_cardbus_mem_size; 1101extern unsigned long pci_cardbus_mem_size;
1060 1102
1061extern int pcibios_add_platform_entries(struct pci_dev *dev); 1103int pcibios_add_platform_entries(struct pci_dev *dev);
1104void pcibios_disable_device(struct pci_dev *dev);
1105int pcibios_set_pcie_reset_state(struct pci_dev *dev,
1106 enum pcie_reset_state state);
1062 1107
1063#ifdef CONFIG_PCI_MMCONFIG 1108#ifdef CONFIG_PCI_MMCONFIG
1064extern void __init pci_mmcfg_early_init(void); 1109extern void __init pci_mmcfg_early_init(void);
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 8f67e8f2a3c..a08cd06b541 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -95,9 +95,6 @@ struct hotplug_slot_attribute {
95 * @get_adapter_status: Called to get see if an adapter is present in the slot or not. 95 * @get_adapter_status: Called to get see if an adapter is present in the slot or not.
96 * If this field is NULL, the value passed in the struct hotplug_slot_info 96 * If this field is NULL, the value passed in the struct hotplug_slot_info
97 * will be used when this value is requested by a user. 97 * will be used when this value is requested by a user.
98 * @get_address: Called to get pci address of a slot.
99 * If this field is NULL, the value passed in the struct hotplug_slot_info
100 * will be used when this value is requested by a user.
101 * @get_max_bus_speed: Called to get the max bus speed for a slot. 98 * @get_max_bus_speed: Called to get the max bus speed for a slot.
102 * If this field is NULL, the value passed in the struct hotplug_slot_info 99 * If this field is NULL, the value passed in the struct hotplug_slot_info
103 * will be used when this value is requested by a user. 100 * will be used when this value is requested by a user.
@@ -120,7 +117,6 @@ struct hotplug_slot_ops {
120 int (*get_attention_status) (struct hotplug_slot *slot, u8 *value); 117 int (*get_attention_status) (struct hotplug_slot *slot, u8 *value);
121 int (*get_latch_status) (struct hotplug_slot *slot, u8 *value); 118 int (*get_latch_status) (struct hotplug_slot *slot, u8 *value);
122 int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value); 119 int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value);
123 int (*get_address) (struct hotplug_slot *slot, u32 *value);
124 int (*get_max_bus_speed) (struct hotplug_slot *slot, enum pci_bus_speed *value); 120 int (*get_max_bus_speed) (struct hotplug_slot *slot, enum pci_bus_speed *value);
125 int (*get_cur_bus_speed) (struct hotplug_slot *slot, enum pci_bus_speed *value); 121 int (*get_cur_bus_speed) (struct hotplug_slot *slot, enum pci_bus_speed *value);
126}; 122};
@@ -140,7 +136,6 @@ struct hotplug_slot_info {
140 u8 attention_status; 136 u8 attention_status;
141 u8 latch_status; 137 u8 latch_status;
142 u8 adapter_status; 138 u8 adapter_status;
143 u32 address;
144 enum pci_bus_speed max_bus_speed; 139 enum pci_bus_speed max_bus_speed;
145 enum pci_bus_speed cur_bus_speed; 140 enum pci_bus_speed cur_bus_speed;
146}; 141};
@@ -166,15 +161,14 @@ struct hotplug_slot {
166 161
167 /* Variables below this are for use only by the hotplug pci core. */ 162 /* Variables below this are for use only by the hotplug pci core. */
168 struct list_head slot_list; 163 struct list_head slot_list;
169 struct kobject kobj; 164 struct pci_slot *pci_slot;
170}; 165};
171#define to_hotplug_slot(n) container_of(n, struct hotplug_slot, kobj) 166#define to_hotplug_slot(n) container_of(n, struct hotplug_slot, kobj)
172 167
173extern int pci_hp_register (struct hotplug_slot *slot); 168extern int pci_hp_register(struct hotplug_slot *, struct pci_bus *, int nr);
174extern int pci_hp_deregister (struct hotplug_slot *slot); 169extern int pci_hp_deregister(struct hotplug_slot *slot);
175extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, 170extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot,
176 struct hotplug_slot_info *info); 171 struct hotplug_slot_info *info);
177extern struct kset *pci_hotplug_slots_kset;
178 172
179/* PCI Setting Record (Type 0) */ 173/* PCI Setting Record (Type 0) */
180struct hpp_type0 { 174struct hpp_type0 {
@@ -227,9 +221,9 @@ struct hotplug_params {
227#include <acpi/acpi.h> 221#include <acpi/acpi.h>
228#include <acpi/acpi_bus.h> 222#include <acpi/acpi_bus.h>
229#include <acpi/actypes.h> 223#include <acpi/actypes.h>
230extern acpi_status acpi_run_oshp(acpi_handle handle);
231extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus, 224extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus,
232 struct hotplug_params *hpp); 225 struct hotplug_params *hpp);
226int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags);
233int acpi_root_bridge(acpi_handle handle); 227int acpi_root_bridge(acpi_handle handle);
234#endif 228#endif
235#endif 229#endif
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index cf6dbd75939..35a78415acc 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -716,6 +716,7 @@
716#define PCI_DEVICE_ID_HP_CISSA 0x3220 716#define PCI_DEVICE_ID_HP_CISSA 0x3220
717#define PCI_DEVICE_ID_HP_CISSC 0x3230 717#define PCI_DEVICE_ID_HP_CISSC 0x3230
718#define PCI_DEVICE_ID_HP_CISSD 0x3238 718#define PCI_DEVICE_ID_HP_CISSD 0x3238
719#define PCI_DEVICE_ID_HP_CISSE 0x323a
719#define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031 720#define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031
720 721
721#define PCI_VENDOR_ID_PCTECH 0x1042 722#define PCI_VENDOR_ID_PCTECH 0x1042
@@ -747,6 +748,7 @@
747#define PCI_VENDOR_ID_TI 0x104c 748#define PCI_VENDOR_ID_TI 0x104c
748#define PCI_DEVICE_ID_TI_TVP4020 0x3d07 749#define PCI_DEVICE_ID_TI_TVP4020 0x3d07
749#define PCI_DEVICE_ID_TI_4450 0x8011 750#define PCI_DEVICE_ID_TI_4450 0x8011
751#define PCI_DEVICE_ID_TI_TSB43AB22 0x8023
750#define PCI_DEVICE_ID_TI_XX21_XX11 0x8031 752#define PCI_DEVICE_ID_TI_XX21_XX11 0x8031
751#define PCI_DEVICE_ID_TI_XX21_XX11_FM 0x8033 753#define PCI_DEVICE_ID_TI_XX21_XX11_FM 0x8033
752#define PCI_DEVICE_ID_TI_XX21_XX11_SD 0x8034 754#define PCI_DEVICE_ID_TI_XX21_XX11_SD 0x8034
@@ -1519,6 +1521,7 @@
1519#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 1521#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430
1520#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 1522#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460
1521#define PCI_DEVICE_ID_MARVELL_MV64460 0x6480 1523#define PCI_DEVICE_ID_MARVELL_MV64460 0x6480
1524#define PCI_DEVICE_ID_MARVELL_CAFE_SD 0x4101
1522 1525
1523#define PCI_VENDOR_ID_V3 0x11b0 1526#define PCI_VENDOR_ID_V3 0x11b0
1524#define PCI_DEVICE_ID_V3_V960 0x0001 1527#define PCI_DEVICE_ID_V3_V960 0x0001
@@ -1761,6 +1764,7 @@
1761 1764
1762#define PCI_VENDOR_ID_INTASHIELD 0x135a 1765#define PCI_VENDOR_ID_INTASHIELD 0x135a
1763#define PCI_DEVICE_ID_INTASHIELD_IS200 0x0d80 1766#define PCI_DEVICE_ID_INTASHIELD_IS200 0x0d80
1767#define PCI_DEVICE_ID_INTASHIELD_IS400 0x0dc0
1764 1768
1765#define PCI_VENDOR_ID_QUATECH 0x135C 1769#define PCI_VENDOR_ID_QUATECH 0x135C
1766#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010 1770#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010
@@ -1829,7 +1833,13 @@
1829#define PCI_DEVICE_ID_MOXA_C320 0x3200 1833#define PCI_DEVICE_ID_MOXA_C320 0x3200
1830 1834
1831#define PCI_VENDOR_ID_CCD 0x1397 1835#define PCI_VENDOR_ID_CCD 0x1397
1836#define PCI_DEVICE_ID_CCD_HFC4S 0x08B4
1837#define PCI_SUBDEVICE_ID_CCD_PMX2S 0x1234
1838#define PCI_DEVICE_ID_CCD_HFC8S 0x16B8
1832#define PCI_DEVICE_ID_CCD_2BD0 0x2bd0 1839#define PCI_DEVICE_ID_CCD_2BD0 0x2bd0
1840#define PCI_DEVICE_ID_CCD_HFCE1 0x30B1
1841#define PCI_SUBDEVICE_ID_CCD_SPD4S 0x3136
1842#define PCI_SUBDEVICE_ID_CCD_SPDE1 0x3137
1833#define PCI_DEVICE_ID_CCD_B000 0xb000 1843#define PCI_DEVICE_ID_CCD_B000 0xb000
1834#define PCI_DEVICE_ID_CCD_B006 0xb006 1844#define PCI_DEVICE_ID_CCD_B006 0xb006
1835#define PCI_DEVICE_ID_CCD_B007 0xb007 1845#define PCI_DEVICE_ID_CCD_B007 0xb007
@@ -1839,8 +1849,32 @@
1839#define PCI_DEVICE_ID_CCD_B00B 0xb00b 1849#define PCI_DEVICE_ID_CCD_B00B 0xb00b
1840#define PCI_DEVICE_ID_CCD_B00C 0xb00c 1850#define PCI_DEVICE_ID_CCD_B00C 0xb00c
1841#define PCI_DEVICE_ID_CCD_B100 0xb100 1851#define PCI_DEVICE_ID_CCD_B100 0xb100
1852#define PCI_SUBDEVICE_ID_CCD_IOB4ST 0xB520
1853#define PCI_SUBDEVICE_ID_CCD_IOB8STR 0xB521
1854#define PCI_SUBDEVICE_ID_CCD_IOB8ST 0xB522
1855#define PCI_SUBDEVICE_ID_CCD_IOB1E1 0xB523
1856#define PCI_SUBDEVICE_ID_CCD_SWYX4S 0xB540
1857#define PCI_SUBDEVICE_ID_CCD_JH4S20 0xB550
1858#define PCI_SUBDEVICE_ID_CCD_IOB8ST_1 0xB552
1859#define PCI_SUBDEVICE_ID_CCD_BN4S 0xB560
1860#define PCI_SUBDEVICE_ID_CCD_BN8S 0xB562
1861#define PCI_SUBDEVICE_ID_CCD_BNE1 0xB563
1862#define PCI_SUBDEVICE_ID_CCD_BNE1D 0xB564
1863#define PCI_SUBDEVICE_ID_CCD_BNE1DP 0xB565
1864#define PCI_SUBDEVICE_ID_CCD_BN2S 0xB566
1865#define PCI_SUBDEVICE_ID_CCD_BN1SM 0xB567
1866#define PCI_SUBDEVICE_ID_CCD_BN4SM 0xB568
1867#define PCI_SUBDEVICE_ID_CCD_BN2SM 0xB569
1868#define PCI_SUBDEVICE_ID_CCD_BNE1M 0xB56A
1869#define PCI_SUBDEVICE_ID_CCD_BN8SP 0xB56B
1870#define PCI_SUBDEVICE_ID_CCD_HFC4S 0xB620
1871#define PCI_SUBDEVICE_ID_CCD_HFC8S 0xB622
1842#define PCI_DEVICE_ID_CCD_B700 0xb700 1872#define PCI_DEVICE_ID_CCD_B700 0xb700
1843#define PCI_DEVICE_ID_CCD_B701 0xb701 1873#define PCI_DEVICE_ID_CCD_B701 0xb701
1874#define PCI_SUBDEVICE_ID_CCD_HFCE1 0xC523
1875#define PCI_SUBDEVICE_ID_CCD_OV2S 0xE884
1876#define PCI_SUBDEVICE_ID_CCD_OV4S 0xE888
1877#define PCI_SUBDEVICE_ID_CCD_OV8S 0xE998
1844 1878
1845#define PCI_VENDOR_ID_EXAR 0x13a8 1879#define PCI_VENDOR_ID_EXAR 0x13a8
1846#define PCI_DEVICE_ID_EXAR_XR17C152 0x0152 1880#define PCI_DEVICE_ID_EXAR_XR17C152 0x0152
@@ -1947,6 +1981,8 @@
1947#define PCI_DEVICE_ID_NX2_5708 0x164c 1981#define PCI_DEVICE_ID_NX2_5708 0x164c
1948#define PCI_DEVICE_ID_TIGON3_5702FE 0x164d 1982#define PCI_DEVICE_ID_TIGON3_5702FE 0x164d
1949#define PCI_DEVICE_ID_NX2_57710 0x164e 1983#define PCI_DEVICE_ID_NX2_57710 0x164e
1984#define PCI_DEVICE_ID_NX2_57711 0x164f
1985#define PCI_DEVICE_ID_NX2_57711E 0x1650
1950#define PCI_DEVICE_ID_TIGON3_5705 0x1653 1986#define PCI_DEVICE_ID_TIGON3_5705 0x1653
1951#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 1987#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654
1952#define PCI_DEVICE_ID_TIGON3_5720 0x1658 1988#define PCI_DEVICE_ID_TIGON3_5720 0x1658
@@ -1979,6 +2015,7 @@
1979#define PCI_DEVICE_ID_TIGON3_5787M 0x1693 2015#define PCI_DEVICE_ID_TIGON3_5787M 0x1693
1980#define PCI_DEVICE_ID_TIGON3_5782 0x1696 2016#define PCI_DEVICE_ID_TIGON3_5782 0x1696
1981#define PCI_DEVICE_ID_TIGON3_5784 0x1698 2017#define PCI_DEVICE_ID_TIGON3_5784 0x1698
2018#define PCI_DEVICE_ID_TIGON3_5785 0x1699
1982#define PCI_DEVICE_ID_TIGON3_5786 0x169a 2019#define PCI_DEVICE_ID_TIGON3_5786 0x169a
1983#define PCI_DEVICE_ID_TIGON3_5787 0x169b 2020#define PCI_DEVICE_ID_TIGON3_5787 0x169b
1984#define PCI_DEVICE_ID_TIGON3_5788 0x169c 2021#define PCI_DEVICE_ID_TIGON3_5788 0x169c
@@ -2168,6 +2205,8 @@
2168#define PCI_DEVICE_ID_MPC8544 0x0033 2205#define PCI_DEVICE_ID_MPC8544 0x0033
2169#define PCI_DEVICE_ID_MPC8572E 0x0040 2206#define PCI_DEVICE_ID_MPC8572E 0x0040
2170#define PCI_DEVICE_ID_MPC8572 0x0041 2207#define PCI_DEVICE_ID_MPC8572 0x0041
2208#define PCI_DEVICE_ID_MPC8536E 0x0050
2209#define PCI_DEVICE_ID_MPC8536 0x0051
2171#define PCI_DEVICE_ID_MPC8641 0x7010 2210#define PCI_DEVICE_ID_MPC8641 0x7010
2172#define PCI_DEVICE_ID_MPC8641D 0x7011 2211#define PCI_DEVICE_ID_MPC8641D 0x7011
2173#define PCI_DEVICE_ID_MPC8610 0x7018 2212#define PCI_DEVICE_ID_MPC8610 0x7018
@@ -2185,6 +2224,7 @@
2185#define PCI_DEVICE_ID_JMICRON_JMB366 0x2366 2224#define PCI_DEVICE_ID_JMICRON_JMB366 0x2366
2186#define PCI_DEVICE_ID_JMICRON_JMB368 0x2368 2225#define PCI_DEVICE_ID_JMICRON_JMB368 0x2368
2187#define PCI_DEVICE_ID_JMICRON_JMB38X_SD 0x2381 2226#define PCI_DEVICE_ID_JMICRON_JMB38X_SD 0x2381
2227#define PCI_DEVICE_ID_JMICRON_JMB38X_MMC 0x2382
2188#define PCI_DEVICE_ID_JMICRON_JMB38X_MS 0x2383 2228#define PCI_DEVICE_ID_JMICRON_JMB38X_MS 0x2383
2189 2229
2190#define PCI_VENDOR_ID_KORENIX 0x1982 2230#define PCI_VENDOR_ID_KORENIX 0x1982
@@ -2362,6 +2402,14 @@
2362#define PCI_DEVICE_ID_INTEL_ICH9_7 0x2916 2402#define PCI_DEVICE_ID_INTEL_ICH9_7 0x2916
2363#define PCI_DEVICE_ID_INTEL_ICH9_8 0x2918 2403#define PCI_DEVICE_ID_INTEL_ICH9_8 0x2918
2364#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 2404#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340
2405#define PCI_DEVICE_ID_INTEL_IOAT_TBG4 0x3429
2406#define PCI_DEVICE_ID_INTEL_IOAT_TBG5 0x342a
2407#define PCI_DEVICE_ID_INTEL_IOAT_TBG6 0x342b
2408#define PCI_DEVICE_ID_INTEL_IOAT_TBG7 0x342c
2409#define PCI_DEVICE_ID_INTEL_IOAT_TBG0 0x3430
2410#define PCI_DEVICE_ID_INTEL_IOAT_TBG1 0x3431
2411#define PCI_DEVICE_ID_INTEL_IOAT_TBG2 0x3432
2412#define PCI_DEVICE_ID_INTEL_IOAT_TBG3 0x3433
2365#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 2413#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575
2366#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 2414#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577
2367#define PCI_DEVICE_ID_INTEL_82855GM_HB 0x3580 2415#define PCI_DEVICE_ID_INTEL_82855GM_HB 0x3580
@@ -2383,6 +2431,12 @@
2383#define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30 2431#define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30
2384#define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 2432#define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60
2385#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f 2433#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f
2434#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0
2435#define PCI_DEVICE_ID_INTEL_5100_21 0x65f5
2436#define PCI_DEVICE_ID_INTEL_5100_22 0x65f6
2437#define PCI_DEVICE_ID_INTEL_5400_ERR 0x4030
2438#define PCI_DEVICE_ID_INTEL_5400_FBD0 0x4035
2439#define PCI_DEVICE_ID_INTEL_5400_FBD1 0x4036
2386#define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff 2440#define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff
2387#define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031 2441#define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031
2388#define PCI_DEVICE_ID_INTEL_TOLAPAI_1 0x5032 2442#define PCI_DEVICE_ID_INTEL_TOLAPAI_1 0x5032
@@ -2500,6 +2554,9 @@
2500 2554
2501#define PCI_VENDOR_ID_3COM_2 0xa727 2555#define PCI_VENDOR_ID_3COM_2 0xa727
2502 2556
2557#define PCI_VENDOR_ID_DIGIUM 0xd161
2558#define PCI_DEVICE_ID_DIGIUM_HFC4S 0xb410
2559
2503#define PCI_SUBVENDOR_ID_EXSYS 0xd84d 2560#define PCI_SUBVENDOR_ID_EXSYS 0xd84d
2504#define PCI_SUBDEVICE_ID_EXSYS_4014 0x4014 2561#define PCI_SUBDEVICE_ID_EXSYS_4014 0x4014
2505#define PCI_SUBDEVICE_ID_EXSYS_4055 0x4055 2562#define PCI_SUBDEVICE_ID_EXSYS_4055 0x4055
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index c0c1223c919..450684f7eaa 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -231,6 +231,7 @@
231#define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */ 231#define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */
232#define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */ 232#define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */
233#define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */ 233#define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */
234#define PCI_PM_CAP_PME_SHIFT 11 /* Start of the PME Mask in PMC */
234#define PCI_PM_CTRL 4 /* PM control and status register */ 235#define PCI_PM_CTRL 4 /* PM control and status register */
235#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ 236#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */
236#define PCI_PM_CTRL_NO_SOFT_RESET 0x0004 /* No reset for D3hot->D0 */ 237#define PCI_PM_CTRL_NO_SOFT_RESET 0x0004 /* No reset for D3hot->D0 */
@@ -373,6 +374,7 @@
373#define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */ 374#define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */
374#define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */ 375#define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */
375#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */ 376#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */
377#define PCI_EXP_DEVCAP_RBER 0x8000 /* Role-Based Error Reporting */
376#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ 378#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */
377#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ 379#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */
378#define PCI_EXP_DEVCTL 8 /* Device Control */ 380#define PCI_EXP_DEVCTL 8 /* Device Control */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index d746a2abb32..fac3337547e 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -13,8 +13,14 @@
13 __attribute__((__section__(".data.percpu"))) \ 13 __attribute__((__section__(".data.percpu"))) \
14 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name 14 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
15 15
16#ifdef MODULE
17#define SHARED_ALIGNED_SECTION ".data.percpu"
18#else
19#define SHARED_ALIGNED_SECTION ".data.percpu.shared_aligned"
20#endif
21
16#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ 22#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
17 __attribute__((__section__(".data.percpu.shared_aligned"))) \ 23 __attribute__((__section__(SHARED_ALIGNED_SECTION))) \
18 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \ 24 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \
19 ____cacheline_aligned_in_smp 25 ____cacheline_aligned_in_smp
20#else 26#else
@@ -68,11 +74,6 @@ struct percpu_data {
68 (__typeof__(ptr))__p->ptrs[(cpu)]; \ 74 (__typeof__(ptr))__p->ptrs[(cpu)]; \
69}) 75})
70 76
71extern void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu);
72extern void percpu_depopulate(void *__pdata, int cpu);
73extern int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp,
74 cpumask_t *mask);
75extern void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask);
76extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask); 77extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask);
77extern void percpu_free(void *__pdata); 78extern void percpu_free(void *__pdata);
78 79
@@ -80,26 +81,6 @@ extern void percpu_free(void *__pdata);
80 81
81#define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) 82#define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); })
82 83
83static inline void percpu_depopulate(void *__pdata, int cpu)
84{
85}
86
87static inline void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask)
88{
89}
90
91static inline void *percpu_populate(void *__pdata, size_t size, gfp_t gfp,
92 int cpu)
93{
94 return percpu_ptr(__pdata, cpu);
95}
96
97static inline int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp,
98 cpumask_t *mask)
99{
100 return 0;
101}
102
103static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask) 84static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask)
104{ 85{
105 return kzalloc(size, gfp); 86 return kzalloc(size, gfp);
@@ -112,10 +93,6 @@ static inline void percpu_free(void *__pdata)
112 93
113#endif /* CONFIG_SMP */ 94#endif /* CONFIG_SMP */
114 95
115#define percpu_populate_mask(__pdata, size, gfp, mask) \
116 __percpu_populate_mask((__pdata), (size), (gfp), &(mask))
117#define percpu_depopulate_mask(__pdata, mask) \
118 __percpu_depopulate_mask((__pdata), &(mask))
119#define percpu_alloc_mask(size, gfp, mask) \ 96#define percpu_alloc_mask(size, gfp, mask) \
120 __percpu_alloc_mask((size), (gfp), &(mask)) 97 __percpu_alloc_mask((size), (gfp), &(mask))
121 98
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index 9007ccdfc11..20838883535 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -35,7 +35,7 @@ int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount);
35void percpu_counter_destroy(struct percpu_counter *fbc); 35void percpu_counter_destroy(struct percpu_counter *fbc);
36void percpu_counter_set(struct percpu_counter *fbc, s64 amount); 36void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
37void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); 37void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
38s64 __percpu_counter_sum(struct percpu_counter *fbc); 38s64 __percpu_counter_sum(struct percpu_counter *fbc, int set);
39 39
40static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) 40static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
41{ 41{
@@ -44,13 +44,19 @@ static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
44 44
45static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc) 45static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc)
46{ 46{
47 s64 ret = __percpu_counter_sum(fbc); 47 s64 ret = __percpu_counter_sum(fbc, 0);
48 return ret < 0 ? 0 : ret; 48 return ret < 0 ? 0 : ret;
49} 49}
50 50
51static inline s64 percpu_counter_sum_and_set(struct percpu_counter *fbc)
52{
53 return __percpu_counter_sum(fbc, 1);
54}
55
56
51static inline s64 percpu_counter_sum(struct percpu_counter *fbc) 57static inline s64 percpu_counter_sum(struct percpu_counter *fbc)
52{ 58{
53 return __percpu_counter_sum(fbc); 59 return __percpu_counter_sum(fbc, 0);
54} 60}
55 61
56static inline s64 percpu_counter_read(struct percpu_counter *fbc) 62static inline s64 percpu_counter_read(struct percpu_counter *fbc)
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 02df20f085f..7224c4099a2 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -412,6 +412,8 @@ int mdiobus_register(struct mii_bus *bus);
412void mdiobus_unregister(struct mii_bus *bus); 412void mdiobus_unregister(struct mii_bus *bus);
413void phy_sanitize_settings(struct phy_device *phydev); 413void phy_sanitize_settings(struct phy_device *phydev);
414int phy_stop_interrupts(struct phy_device *phydev); 414int phy_stop_interrupts(struct phy_device *phydev);
415int phy_enable_interrupts(struct phy_device *phydev);
416int phy_disable_interrupts(struct phy_device *phydev);
415 417
416static inline int phy_read_status(struct phy_device *phydev) { 418static inline int phy_read_status(struct phy_device *phydev) {
417 return phydev->drv->read_status(phydev); 419 return phydev->drv->read_status(phydev);
@@ -447,5 +449,8 @@ int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask,
447 int (*run)(struct phy_device *)); 449 int (*run)(struct phy_device *));
448int phy_scan_fixups(struct phy_device *phydev); 450int phy_scan_fixups(struct phy_device *phydev);
449 451
452int __init mdio_bus_init(void);
453void mdio_bus_exit(void);
454
450extern struct bus_type mdio_bus_type; 455extern struct bus_type mdio_bus_type;
451#endif /* __PHY_H */ 456#endif /* __PHY_H */
diff --git a/include/linux/pid.h b/include/linux/pid.h
index c21c7e8124a..22921ac4cfd 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -48,7 +48,7 @@ enum pid_type
48 */ 48 */
49 49
50struct upid { 50struct upid {
51 /* Try to keep pid_chain in the same cacheline as nr for find_pid */ 51 /* Try to keep pid_chain in the same cacheline as nr for find_vpid */
52 int nr; 52 int nr;
53 struct pid_namespace *ns; 53 struct pid_namespace *ns;
54 struct hlist_node pid_chain; 54 struct hlist_node pid_chain;
@@ -57,10 +57,10 @@ struct upid {
57struct pid 57struct pid
58{ 58{
59 atomic_t count; 59 atomic_t count;
60 unsigned int level;
60 /* lists of tasks that use this pid */ 61 /* lists of tasks that use this pid */
61 struct hlist_head tasks[PIDTYPE_MAX]; 62 struct hlist_head tasks[PIDTYPE_MAX];
62 struct rcu_head rcu; 63 struct rcu_head rcu;
63 unsigned int level;
64 struct upid numbers[1]; 64 struct upid numbers[1];
65}; 65};
66 66
@@ -105,14 +105,12 @@ extern struct pid_namespace init_pid_ns;
105 * or rcu_read_lock() held. 105 * or rcu_read_lock() held.
106 * 106 *
107 * find_pid_ns() finds the pid in the namespace specified 107 * find_pid_ns() finds the pid in the namespace specified
108 * find_pid() find the pid by its global id, i.e. in the init namespace
109 * find_vpid() finr the pid by its virtual id, i.e. in the current namespace 108 * find_vpid() finr the pid by its virtual id, i.e. in the current namespace
110 * 109 *
111 * see also find_task_by_pid() set in include/linux/sched.h 110 * see also find_task_by_vpid() set in include/linux/sched.h
112 */ 111 */
113extern struct pid *find_pid_ns(int nr, struct pid_namespace *ns); 112extern struct pid *find_pid_ns(int nr, struct pid_namespace *ns);
114extern struct pid *find_vpid(int nr); 113extern struct pid *find_vpid(int nr);
115extern struct pid *find_pid(int nr);
116 114
117/* 115/*
118 * Lookup a PID in the hash table, and return with it's count elevated. 116 * Lookup a PID in the hash table, and return with it's count elevated.
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index caff5283d15..1af82c4e17d 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -14,6 +14,8 @@ struct pidmap {
14 14
15#define PIDMAP_ENTRIES ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8) 15#define PIDMAP_ENTRIES ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8)
16 16
17struct bsd_acct_struct;
18
17struct pid_namespace { 19struct pid_namespace {
18 struct kref kref; 20 struct kref kref;
19 struct pidmap pidmap[PIDMAP_ENTRIES]; 21 struct pidmap pidmap[PIDMAP_ENTRIES];
@@ -25,6 +27,9 @@ struct pid_namespace {
25#ifdef CONFIG_PROC_FS 27#ifdef CONFIG_PROC_FS
26 struct vfsmount *proc_mnt; 28 struct vfsmount *proc_mnt;
27#endif 29#endif
30#ifdef CONFIG_BSD_PROCESS_ACCT
31 struct bsd_acct_struct *bacct;
32#endif
28}; 33};
29 34
30extern struct pid_namespace init_pid_ns; 35extern struct pid_namespace init_pid_ns;
@@ -85,4 +90,7 @@ static inline struct task_struct *task_child_reaper(struct task_struct *tsk)
85 return tsk->nsproxy->pid_ns->child_reaper; 90 return tsk->nsproxy->pid_ns->child_reaper;
86} 91}
87 92
93void pidhash_init(void);
94void pidmap_init(void);
95
88#endif /* _LINUX_PID_NS_H */ 96#endif /* _LINUX_PID_NS_H */
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
index 99efbed81fa..7cf7824df77 100644
--- a/include/linux/pkt_cls.h
+++ b/include/linux/pkt_cls.h
@@ -374,6 +374,7 @@ enum
374 TCA_FLOW_ACT, 374 TCA_FLOW_ACT,
375 TCA_FLOW_POLICE, 375 TCA_FLOW_POLICE,
376 TCA_FLOW_EMATCHES, 376 TCA_FLOW_EMATCHES,
377 TCA_FLOW_PERTURB,
377 __TCA_FLOW_MAX 378 __TCA_FLOW_MAX
378}; 379};
379 380
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index dbb7ac37960..e5de421ac7b 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -85,6 +85,26 @@ struct tc_ratespec
85 85
86#define TC_RTAB_SIZE 1024 86#define TC_RTAB_SIZE 1024
87 87
88struct tc_sizespec {
89 unsigned char cell_log;
90 unsigned char size_log;
91 short cell_align;
92 int overhead;
93 unsigned int linklayer;
94 unsigned int mpu;
95 unsigned int mtu;
96 unsigned int tsize;
97};
98
99enum {
100 TCA_STAB_UNSPEC,
101 TCA_STAB_BASE,
102 TCA_STAB_DATA,
103 __TCA_STAB_MAX
104};
105
106#define TCA_STAB_MAX (__TCA_STAB_MAX - 1)
107
88/* FIFO section */ 108/* FIFO section */
89 109
90struct tc_fifo_qopt 110struct tc_fifo_qopt
@@ -103,15 +123,6 @@ struct tc_prio_qopt
103 __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ 123 __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */
104}; 124};
105 125
106enum
107{
108 TCA_PRIO_UNSPEC,
109 TCA_PRIO_MQ,
110 __TCA_PRIO_MAX
111};
112
113#define TCA_PRIO_MAX (__TCA_PRIO_MAX - 1)
114
115/* TBF section */ 126/* TBF section */
116 127
117struct tc_tbf_qopt 128struct tc_tbf_qopt
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 3261681c82a..95ac21ab3a0 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -53,6 +53,7 @@ struct platform_driver {
53 int (*suspend_late)(struct platform_device *, pm_message_t state); 53 int (*suspend_late)(struct platform_device *, pm_message_t state);
54 int (*resume_early)(struct platform_device *); 54 int (*resume_early)(struct platform_device *);
55 int (*resume)(struct platform_device *); 55 int (*resume)(struct platform_device *);
56 struct pm_ext_ops *pm;
56 struct device_driver driver; 57 struct device_driver driver;
57}; 58};
58 59
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 39a7ee859b6..4dcce54b6d7 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -22,104 +22,345 @@
22#define _LINUX_PM_H 22#define _LINUX_PM_H
23 23
24#include <linux/list.h> 24#include <linux/list.h>
25#include <asm/atomic.h>
26#include <asm/errno.h>
27 25
28/* 26/*
29 * Power management requests... these are passed to pm_send_all() and friends. 27 * Callbacks for platform drivers to implement.
30 *
31 * these functions are old and deprecated, see below.
32 */ 28 */
33typedef int __bitwise pm_request_t; 29extern void (*pm_idle)(void);
34 30extern void (*pm_power_off)(void);
35#define PM_SUSPEND ((__force pm_request_t) 1) /* enter D1-D3 */ 31extern void (*pm_power_off_prepare)(void);
36#define PM_RESUME ((__force pm_request_t) 2) /* enter D0 */
37
38 32
39/* 33/*
40 * Device types... these are passed to pm_register 34 * Device power management
41 */ 35 */
42typedef int __bitwise pm_dev_t;
43 36
44#define PM_UNKNOWN_DEV ((__force pm_dev_t) 0) /* generic */ 37struct device;
45#define PM_SYS_DEV ((__force pm_dev_t) 1) /* system device (fan, KB controller, ...) */
46#define PM_PCI_DEV ((__force pm_dev_t) 2) /* PCI device */
47#define PM_USB_DEV ((__force pm_dev_t) 3) /* USB device */
48#define PM_SCSI_DEV ((__force pm_dev_t) 4) /* SCSI device */
49#define PM_ISA_DEV ((__force pm_dev_t) 5) /* ISA device */
50#define PM_MTD_DEV ((__force pm_dev_t) 6) /* Memory Technology Device */
51 38
52/* 39typedef struct pm_message {
53 * System device hardware ID (PnP) values 40 int event;
41} pm_message_t;
42
43/**
44 * struct pm_ops - device PM callbacks
45 *
46 * Several driver power state transitions are externally visible, affecting
47 * the state of pending I/O queues and (for drivers that touch hardware)
48 * interrupts, wakeups, DMA, and other hardware state. There may also be
49 * internal transitions to various low power modes, which are transparent
50 * to the rest of the driver stack (such as a driver that's ON gating off
51 * clocks which are not in active use).
52 *
53 * The externally visible transitions are handled with the help of the following
54 * callbacks included in this structure:
55 *
56 * @prepare: Prepare the device for the upcoming transition, but do NOT change
57 * its hardware state. Prevent new children of the device from being
58 * registered after @prepare() returns (the driver's subsystem and
59 * generally the rest of the kernel is supposed to prevent new calls to the
60 * probe method from being made too once @prepare() has succeeded). If
61 * @prepare() detects a situation it cannot handle (e.g. registration of a
62 * child already in progress), it may return -EAGAIN, so that the PM core
63 * can execute it once again (e.g. after the new child has been registered)
64 * to recover from the race condition. This method is executed for all
65 * kinds of suspend transitions and is followed by one of the suspend
66 * callbacks: @suspend(), @freeze(), or @poweroff().
67 * The PM core executes @prepare() for all devices before starting to
68 * execute suspend callbacks for any of them, so drivers may assume all of
69 * the other devices to be present and functional while @prepare() is being
70 * executed. In particular, it is safe to make GFP_KERNEL memory
71 * allocations from within @prepare(). However, drivers may NOT assume
72 * anything about the availability of the user space at that time and it
73 * is not correct to request firmware from within @prepare() (it's too
74 * late to do that). [To work around this limitation, drivers may
75 * register suspend and hibernation notifiers that are executed before the
76 * freezing of tasks.]
77 *
78 * @complete: Undo the changes made by @prepare(). This method is executed for
79 * all kinds of resume transitions, following one of the resume callbacks:
80 * @resume(), @thaw(), @restore(). Also called if the state transition
81 * fails before the driver's suspend callback (@suspend(), @freeze(),
82 * @poweroff()) can be executed (e.g. if the suspend callback fails for one
83 * of the other devices that the PM core has unsuccessfully attempted to
84 * suspend earlier).
85 * The PM core executes @complete() after it has executed the appropriate
86 * resume callback for all devices.
87 *
88 * @suspend: Executed before putting the system into a sleep state in which the
89 * contents of main memory are preserved. Quiesce the device, put it into
90 * a low power state appropriate for the upcoming system state (such as
91 * PCI_D3hot), and enable wakeup events as appropriate.
92 *
93 * @resume: Executed after waking the system up from a sleep state in which the
94 * contents of main memory were preserved. Put the device into the
95 * appropriate state, according to the information saved in memory by the
96 * preceding @suspend(). The driver starts working again, responding to
97 * hardware events and software requests. The hardware may have gone
98 * through a power-off reset, or it may have maintained state from the
99 * previous suspend() which the driver may rely on while resuming. On most
100 * platforms, there are no restrictions on availability of resources like
101 * clocks during @resume().
102 *
103 * @freeze: Hibernation-specific, executed before creating a hibernation image.
104 * Quiesce operations so that a consistent image can be created, but do NOT
105 * otherwise put the device into a low power device state and do NOT emit
106 * system wakeup events. Save in main memory the device settings to be
107 * used by @restore() during the subsequent resume from hibernation or by
108 * the subsequent @thaw(), if the creation of the image or the restoration
109 * of main memory contents from it fails.
110 *
111 * @thaw: Hibernation-specific, executed after creating a hibernation image OR
112 * if the creation of the image fails. Also executed after a failing
113 * attempt to restore the contents of main memory from such an image.
114 * Undo the changes made by the preceding @freeze(), so the device can be
115 * operated in the same way as immediately before the call to @freeze().
116 *
117 * @poweroff: Hibernation-specific, executed after saving a hibernation image.
118 * Quiesce the device, put it into a low power state appropriate for the
119 * upcoming system state (such as PCI_D3hot), and enable wakeup events as
120 * appropriate.
121 *
122 * @restore: Hibernation-specific, executed after restoring the contents of main
123 * memory from a hibernation image. Driver starts working again,
124 * responding to hardware events and software requests. Drivers may NOT
125 * make ANY assumptions about the hardware state right prior to @restore().
126 * On most platforms, there are no restrictions on availability of
127 * resources like clocks during @restore().
128 *
129 * All of the above callbacks, except for @complete(), return error codes.
130 * However, the error codes returned by the resume operations, @resume(),
131 * @thaw(), and @restore(), do not cause the PM core to abort the resume
132 * transition during which they are returned. The error codes returned in
133 * that cases are only printed by the PM core to the system logs for debugging
134 * purposes. Still, it is recommended that drivers only return error codes
135 * from their resume methods in case of an unrecoverable failure (i.e. when the
136 * device being handled refuses to resume and becomes unusable) to allow us to
137 * modify the PM core in the future, so that it can avoid attempting to handle
138 * devices that failed to resume and their children.
139 *
140 * It is allowed to unregister devices while the above callbacks are being
141 * executed. However, it is not allowed to unregister a device from within any
142 * of its own callbacks.
54 */ 143 */
55enum 144
56{ 145struct pm_ops {
57 PM_SYS_UNKNOWN = 0x00000000, /* generic */ 146 int (*prepare)(struct device *dev);
58 PM_SYS_KBC = 0x41d00303, /* keyboard controller */ 147 void (*complete)(struct device *dev);
59 PM_SYS_COM = 0x41d00500, /* serial port */ 148 int (*suspend)(struct device *dev);
60 PM_SYS_IRDA = 0x41d00510, /* IRDA controller */ 149 int (*resume)(struct device *dev);
61 PM_SYS_FDC = 0x41d00700, /* floppy controller */ 150 int (*freeze)(struct device *dev);
62 PM_SYS_VGA = 0x41d00900, /* VGA controller */ 151 int (*thaw)(struct device *dev);
63 PM_SYS_PCMCIA = 0x41d00e00, /* PCMCIA controller */ 152 int (*poweroff)(struct device *dev);
153 int (*restore)(struct device *dev);
64}; 154};
65 155
66/* 156/**
67 * Device identifier 157 * struct pm_ext_ops - extended device PM callbacks
158 *
159 * Some devices require certain operations related to suspend and hibernation
160 * to be carried out with interrupts disabled. Thus, 'struct pm_ext_ops' below
161 * is defined, adding callbacks to be executed with interrupts disabled to
162 * 'struct pm_ops'.
163 *
164 * The following callbacks included in 'struct pm_ext_ops' are executed with
165 * the nonboot CPUs switched off and with interrupts disabled on the only
166 * functional CPU. They also are executed with the PM core list of devices
167 * locked, so they must NOT unregister any devices.
168 *
169 * @suspend_noirq: Complete the operations of ->suspend() by carrying out any
170 * actions required for suspending the device that need interrupts to be
171 * disabled
172 *
173 * @resume_noirq: Prepare for the execution of ->resume() by carrying out any
174 * actions required for resuming the device that need interrupts to be
175 * disabled
176 *
177 * @freeze_noirq: Complete the operations of ->freeze() by carrying out any
178 * actions required for freezing the device that need interrupts to be
179 * disabled
180 *
181 * @thaw_noirq: Prepare for the execution of ->thaw() by carrying out any
182 * actions required for thawing the device that need interrupts to be
183 * disabled
184 *
185 * @poweroff_noirq: Complete the operations of ->poweroff() by carrying out any
186 * actions required for handling the device that need interrupts to be
187 * disabled
188 *
189 * @restore_noirq: Prepare for the execution of ->restore() by carrying out any
190 * actions required for restoring the operations of the device that need
191 * interrupts to be disabled
192 *
193 * All of the above callbacks return error codes, but the error codes returned
194 * by the resume operations, @resume_noirq(), @thaw_noirq(), and
195 * @restore_noirq(), do not cause the PM core to abort the resume transition
196 * during which they are returned. The error codes returned in that cases are
197 * only printed by the PM core to the system logs for debugging purposes.
198 * Still, as stated above, it is recommended that drivers only return error
199 * codes from their resume methods if the device being handled fails to resume
200 * and is not usable any more.
68 */ 201 */
69#define PM_PCI_ID(dev) ((dev)->bus->number << 16 | (dev)->devfn)
70 202
71/* 203struct pm_ext_ops {
72 * Request handler callback 204 struct pm_ops base;
205 int (*suspend_noirq)(struct device *dev);
206 int (*resume_noirq)(struct device *dev);
207 int (*freeze_noirq)(struct device *dev);
208 int (*thaw_noirq)(struct device *dev);
209 int (*poweroff_noirq)(struct device *dev);
210 int (*restore_noirq)(struct device *dev);
211};
212
213/**
214 * PM_EVENT_ messages
215 *
216 * The following PM_EVENT_ messages are defined for the internal use of the PM
217 * core, in order to provide a mechanism allowing the high level suspend and
218 * hibernation code to convey the necessary information to the device PM core
219 * code:
220 *
221 * ON No transition.
222 *
223 * FREEZE System is going to hibernate, call ->prepare() and ->freeze()
224 * for all devices.
225 *
226 * SUSPEND System is going to suspend, call ->prepare() and ->suspend()
227 * for all devices.
228 *
229 * HIBERNATE Hibernation image has been saved, call ->prepare() and
230 * ->poweroff() for all devices.
231 *
232 * QUIESCE Contents of main memory are going to be restored from a (loaded)
233 * hibernation image, call ->prepare() and ->freeze() for all
234 * devices.
235 *
236 * RESUME System is resuming, call ->resume() and ->complete() for all
237 * devices.
238 *
239 * THAW Hibernation image has been created, call ->thaw() and
240 * ->complete() for all devices.
241 *
242 * RESTORE Contents of main memory have been restored from a hibernation
243 * image, call ->restore() and ->complete() for all devices.
244 *
245 * RECOVER Creation of a hibernation image or restoration of the main
246 * memory contents from a hibernation image has failed, call
247 * ->thaw() and ->complete() for all devices.
248 *
249 * The following PM_EVENT_ messages are defined for internal use by
250 * kernel subsystems. They are never issued by the PM core.
251 *
252 * USER_SUSPEND Manual selective suspend was issued by userspace.
253 *
254 * USER_RESUME Manual selective resume was issued by userspace.
255 *
256 * REMOTE_WAKEUP Remote-wakeup request was received from the device.
257 *
258 * AUTO_SUSPEND Automatic (device idle) runtime suspend was
259 * initiated by the subsystem.
260 *
261 * AUTO_RESUME Automatic (device needed) runtime resume was
262 * requested by a driver.
73 */ 263 */
74struct pm_dev;
75 264
76typedef int (*pm_callback)(struct pm_dev *dev, pm_request_t rqst, void *data); 265#define PM_EVENT_ON 0x0000
266#define PM_EVENT_FREEZE 0x0001
267#define PM_EVENT_SUSPEND 0x0002
268#define PM_EVENT_HIBERNATE 0x0004
269#define PM_EVENT_QUIESCE 0x0008
270#define PM_EVENT_RESUME 0x0010
271#define PM_EVENT_THAW 0x0020
272#define PM_EVENT_RESTORE 0x0040
273#define PM_EVENT_RECOVER 0x0080
274#define PM_EVENT_USER 0x0100
275#define PM_EVENT_REMOTE 0x0200
276#define PM_EVENT_AUTO 0x0400
277
278#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE)
279#define PM_EVENT_USER_SUSPEND (PM_EVENT_USER | PM_EVENT_SUSPEND)
280#define PM_EVENT_USER_RESUME (PM_EVENT_USER | PM_EVENT_RESUME)
281#define PM_EVENT_REMOTE_WAKEUP (PM_EVENT_REMOTE | PM_EVENT_RESUME)
282#define PM_EVENT_AUTO_SUSPEND (PM_EVENT_AUTO | PM_EVENT_SUSPEND)
283#define PM_EVENT_AUTO_RESUME (PM_EVENT_AUTO | PM_EVENT_RESUME)
77 284
78/* 285#define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, })
79 * Dynamic device information 286#define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, })
287#define PMSG_QUIESCE ((struct pm_message){ .event = PM_EVENT_QUIESCE, })
288#define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, })
289#define PMSG_HIBERNATE ((struct pm_message){ .event = PM_EVENT_HIBERNATE, })
290#define PMSG_RESUME ((struct pm_message){ .event = PM_EVENT_RESUME, })
291#define PMSG_THAW ((struct pm_message){ .event = PM_EVENT_THAW, })
292#define PMSG_RESTORE ((struct pm_message){ .event = PM_EVENT_RESTORE, })
293#define PMSG_RECOVER ((struct pm_message){ .event = PM_EVENT_RECOVER, })
294#define PMSG_USER_SUSPEND ((struct pm_messge) \
295 { .event = PM_EVENT_USER_SUSPEND, })
296#define PMSG_USER_RESUME ((struct pm_messge) \
297 { .event = PM_EVENT_USER_RESUME, })
298#define PMSG_REMOTE_RESUME ((struct pm_messge) \
299 { .event = PM_EVENT_REMOTE_RESUME, })
300#define PMSG_AUTO_SUSPEND ((struct pm_messge) \
301 { .event = PM_EVENT_AUTO_SUSPEND, })
302#define PMSG_AUTO_RESUME ((struct pm_messge) \
303 { .event = PM_EVENT_AUTO_RESUME, })
304
305/**
306 * Device power management states
307 *
308 * These state labels are used internally by the PM core to indicate the current
309 * status of a device with respect to the PM core operations.
310 *
311 * DPM_ON Device is regarded as operational. Set this way
312 * initially and when ->complete() is about to be called.
313 * Also set when ->prepare() fails.
314 *
315 * DPM_PREPARING Device is going to be prepared for a PM transition. Set
316 * when ->prepare() is about to be called.
317 *
318 * DPM_RESUMING Device is going to be resumed. Set when ->resume(),
319 * ->thaw(), or ->restore() is about to be called.
320 *
321 * DPM_SUSPENDING Device has been prepared for a power transition. Set
322 * when ->prepare() has just succeeded.
323 *
324 * DPM_OFF Device is regarded as inactive. Set immediately after
325 * ->suspend(), ->freeze(), or ->poweroff() has succeeded.
326 * Also set when ->resume()_noirq, ->thaw_noirq(), or
327 * ->restore_noirq() is about to be called.
328 *
329 * DPM_OFF_IRQ Device is in a "deep sleep". Set immediately after
330 * ->suspend_noirq(), ->freeze_noirq(), or
331 * ->poweroff_noirq() has just succeeded.
80 */ 332 */
81struct pm_dev
82{
83 pm_dev_t type;
84 unsigned long id;
85 pm_callback callback;
86 void *data;
87 333
88 unsigned long flags; 334enum dpm_state {
89 unsigned long state; 335 DPM_INVALID,
90 unsigned long prev_state; 336 DPM_ON,
91 337 DPM_PREPARING,
92 struct list_head entry; 338 DPM_RESUMING,
339 DPM_SUSPENDING,
340 DPM_OFF,
341 DPM_OFF_IRQ,
93}; 342};
94 343
95/* Functions above this comment are list-based old-style power 344struct dev_pm_info {
96 * management. Please avoid using them. */ 345 pm_message_t power_state;
346 unsigned can_wakeup:1;
347 unsigned should_wakeup:1;
348 enum dpm_state status; /* Owned by the PM core */
349#ifdef CONFIG_PM_SLEEP
350 struct list_head entry;
351#endif
352};
97 353
98/* 354/*
99 * Callbacks for platform drivers to implement. 355 * The PM_EVENT_ messages are also used by drivers implementing the legacy
356 * suspend framework, based on the ->suspend() and ->resume() callbacks common
357 * for suspend and hibernation transitions, according to the rules below.
100 */ 358 */
101extern void (*pm_idle)(void);
102extern void (*pm_power_off)(void);
103extern void (*pm_power_off_prepare)(void);
104 359
105/* 360/* Necessary, because several drivers use PM_EVENT_PRETHAW */
106 * Device power management 361#define PM_EVENT_PRETHAW PM_EVENT_QUIESCE
107 */
108
109struct device;
110
111typedef struct pm_message {
112 int event;
113} pm_message_t;
114 362
115/* 363/*
116 * Several driver power state transitions are externally visible, affecting
117 * the state of pending I/O queues and (for drivers that touch hardware)
118 * interrupts, wakeups, DMA, and other hardware state. There may also be
119 * internal transitions to various low power modes, which are transparent
120 * to the rest of the driver stack (such as a driver that's ON gating off
121 * clocks which are not in active use).
122 *
123 * One transition is triggered by resume(), after a suspend() call; the 364 * One transition is triggered by resume(), after a suspend() call; the
124 * message is implicit: 365 * message is implicit:
125 * 366 *
@@ -164,35 +405,13 @@ typedef struct pm_message {
164 * or from system low-power states such as standby or suspend-to-RAM. 405 * or from system low-power states such as standby or suspend-to-RAM.
165 */ 406 */
166 407
167#define PM_EVENT_ON 0 408#ifdef CONFIG_PM_SLEEP
168#define PM_EVENT_FREEZE 1 409extern void device_pm_lock(void);
169#define PM_EVENT_SUSPEND 2 410extern void device_power_up(pm_message_t state);
170#define PM_EVENT_HIBERNATE 4 411extern void device_resume(pm_message_t state);
171#define PM_EVENT_PRETHAW 8
172
173#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE)
174
175#define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, })
176#define PMSG_PRETHAW ((struct pm_message){ .event = PM_EVENT_PRETHAW, })
177#define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, })
178#define PMSG_HIBERNATE ((struct pm_message){ .event = PM_EVENT_HIBERNATE, })
179#define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, })
180
181struct dev_pm_info {
182 pm_message_t power_state;
183 unsigned can_wakeup:1;
184 unsigned should_wakeup:1;
185 bool sleeping:1; /* Owned by the PM core */
186#ifdef CONFIG_PM_SLEEP
187 struct list_head entry;
188#endif
189};
190 412
413extern void device_pm_unlock(void);
191extern int device_power_down(pm_message_t state); 414extern int device_power_down(pm_message_t state);
192extern void device_power_up(void);
193extern void device_resume(void);
194
195#ifdef CONFIG_PM_SLEEP
196extern int device_suspend(pm_message_t state); 415extern int device_suspend(pm_message_t state);
197extern int device_prepare_suspend(pm_message_t state); 416extern int device_prepare_suspend(pm_message_t state);
198 417
diff --git a/include/linux/pm_legacy.h b/include/linux/pm_legacy.h
deleted file mode 100644
index 446f4f42b95..00000000000
--- a/include/linux/pm_legacy.h
+++ /dev/null
@@ -1,35 +0,0 @@
1#ifndef __LINUX_PM_LEGACY_H__
2#define __LINUX_PM_LEGACY_H__
3
4
5#ifdef CONFIG_PM_LEGACY
6
7/*
8 * Register a device with power management
9 */
10struct pm_dev __deprecated *
11pm_register(pm_dev_t type, unsigned long id, pm_callback callback);
12
13/*
14 * Send a request to all devices
15 */
16int __deprecated pm_send_all(pm_request_t rqst, void *data);
17
18#else /* CONFIG_PM_LEGACY */
19
20static inline struct pm_dev *pm_register(pm_dev_t type,
21 unsigned long id,
22 pm_callback callback)
23{
24 return NULL;
25}
26
27static inline int pm_send_all(pm_request_t rqst, void *data)
28{
29 return 0;
30}
31
32#endif /* CONFIG_PM_LEGACY */
33
34#endif /* __LINUX_PM_LEGACY_H__ */
35
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index f0d0b2cb8d2..0aae7776185 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -35,6 +35,11 @@ static inline void device_init_wakeup(struct device *dev, int val)
35 dev->power.can_wakeup = dev->power.should_wakeup = !!val; 35 dev->power.can_wakeup = dev->power.should_wakeup = !!val;
36} 36}
37 37
38static inline void device_set_wakeup_capable(struct device *dev, int val)
39{
40 dev->power.can_wakeup = !!val;
41}
42
38static inline int device_can_wakeup(struct device *dev) 43static inline int device_can_wakeup(struct device *dev)
39{ 44{
40 return dev->power.can_wakeup; 45 return dev->power.can_wakeup;
@@ -47,21 +52,7 @@ static inline void device_set_wakeup_enable(struct device *dev, int val)
47 52
48static inline int device_may_wakeup(struct device *dev) 53static inline int device_may_wakeup(struct device *dev)
49{ 54{
50 return dev->power.can_wakeup & dev->power.should_wakeup; 55 return dev->power.can_wakeup && dev->power.should_wakeup;
51}
52
53/*
54 * Platform hook to activate device wakeup capability, if that's not already
55 * handled by enable_irq_wake() etc.
56 * Returns zero on success, else negative errno
57 */
58extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
59
60static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
61{
62 if (platform_enable_wakeup)
63 return (*platform_enable_wakeup)(dev, is_on);
64 return 0;
65} 56}
66 57
67#else /* !CONFIG_PM */ 58#else /* !CONFIG_PM */
@@ -72,6 +63,8 @@ static inline void device_init_wakeup(struct device *dev, int val)
72 dev->power.can_wakeup = !!val; 63 dev->power.can_wakeup = !!val;
73} 64}
74 65
66static inline void device_set_wakeup_capable(struct device *dev, int val) { }
67
75static inline int device_can_wakeup(struct device *dev) 68static inline int device_can_wakeup(struct device *dev)
76{ 69{
77 return dev->power.can_wakeup; 70 return dev->power.can_wakeup;
@@ -80,11 +73,6 @@ static inline int device_can_wakeup(struct device *dev)
80#define device_set_wakeup_enable(dev, val) do {} while (0) 73#define device_set_wakeup_enable(dev, val) do {} while (0)
81#define device_may_wakeup(dev) 0 74#define device_may_wakeup(dev) 0
82 75
83static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
84{
85 return 0;
86}
87
88#endif /* !CONFIG_PM */ 76#endif /* !CONFIG_PM */
89 77
90#endif /* _LINUX_PM_WAKEUP_H */ 78#endif /* _LINUX_PM_WAKEUP_H */
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 63b128d512f..1ce54b63085 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -1,6 +1,8 @@
1/* 1/*
2 * Linux Plug and Play Support 2 * Linux Plug and Play Support
3 * Copyright by Adam Belay <ambx1@neo.rr.com> 3 * Copyright by Adam Belay <ambx1@neo.rr.com>
4 * Copyright (C) 2008 Hewlett-Packard Development Company, L.P.
5 * Bjorn Helgaas <bjorn.helgaas@hp.com>
4 */ 6 */
5 7
6#ifndef _LINUX_PNP_H 8#ifndef _LINUX_PNP_H
@@ -15,7 +17,6 @@
15 17
16struct pnp_protocol; 18struct pnp_protocol;
17struct pnp_dev; 19struct pnp_dev;
18struct pnp_resource_table;
19 20
20/* 21/*
21 * Resource Management 22 * Resource Management
@@ -24,7 +25,14 @@ struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int);
24 25
25static inline int pnp_resource_valid(struct resource *res) 26static inline int pnp_resource_valid(struct resource *res)
26{ 27{
27 if (res && !(res->flags & IORESOURCE_UNSET)) 28 if (res)
29 return 1;
30 return 0;
31}
32
33static inline int pnp_resource_enabled(struct resource *res)
34{
35 if (res && !(res->flags & IORESOURCE_DISABLED))
28 return 1; 36 return 1;
29 return 0; 37 return 0;
30} 38}
@@ -40,19 +48,31 @@ static inline resource_size_t pnp_resource_len(struct resource *res)
40static inline resource_size_t pnp_port_start(struct pnp_dev *dev, 48static inline resource_size_t pnp_port_start(struct pnp_dev *dev,
41 unsigned int bar) 49 unsigned int bar)
42{ 50{
43 return pnp_get_resource(dev, IORESOURCE_IO, bar)->start; 51 struct resource *res = pnp_get_resource(dev, IORESOURCE_IO, bar);
52
53 if (pnp_resource_valid(res))
54 return res->start;
55 return 0;
44} 56}
45 57
46static inline resource_size_t pnp_port_end(struct pnp_dev *dev, 58static inline resource_size_t pnp_port_end(struct pnp_dev *dev,
47 unsigned int bar) 59 unsigned int bar)
48{ 60{
49 return pnp_get_resource(dev, IORESOURCE_IO, bar)->end; 61 struct resource *res = pnp_get_resource(dev, IORESOURCE_IO, bar);
62
63 if (pnp_resource_valid(res))
64 return res->end;
65 return 0;
50} 66}
51 67
52static inline unsigned long pnp_port_flags(struct pnp_dev *dev, 68static inline unsigned long pnp_port_flags(struct pnp_dev *dev,
53 unsigned int bar) 69 unsigned int bar)
54{ 70{
55 return pnp_get_resource(dev, IORESOURCE_IO, bar)->flags; 71 struct resource *res = pnp_get_resource(dev, IORESOURCE_IO, bar);
72
73 if (pnp_resource_valid(res))
74 return res->flags;
75 return IORESOURCE_IO | IORESOURCE_AUTO;
56} 76}
57 77
58static inline int pnp_port_valid(struct pnp_dev *dev, unsigned int bar) 78static inline int pnp_port_valid(struct pnp_dev *dev, unsigned int bar)
@@ -63,25 +83,41 @@ static inline int pnp_port_valid(struct pnp_dev *dev, unsigned int bar)
63static inline resource_size_t pnp_port_len(struct pnp_dev *dev, 83static inline resource_size_t pnp_port_len(struct pnp_dev *dev,
64 unsigned int bar) 84 unsigned int bar)
65{ 85{
66 return pnp_resource_len(pnp_get_resource(dev, IORESOURCE_IO, bar)); 86 struct resource *res = pnp_get_resource(dev, IORESOURCE_IO, bar);
87
88 if (pnp_resource_valid(res))
89 return pnp_resource_len(res);
90 return 0;
67} 91}
68 92
69 93
70static inline resource_size_t pnp_mem_start(struct pnp_dev *dev, 94static inline resource_size_t pnp_mem_start(struct pnp_dev *dev,
71 unsigned int bar) 95 unsigned int bar)
72{ 96{
73 return pnp_get_resource(dev, IORESOURCE_MEM, bar)->start; 97 struct resource *res = pnp_get_resource(dev, IORESOURCE_MEM, bar);
98
99 if (pnp_resource_valid(res))
100 return res->start;
101 return 0;
74} 102}
75 103
76static inline resource_size_t pnp_mem_end(struct pnp_dev *dev, 104static inline resource_size_t pnp_mem_end(struct pnp_dev *dev,
77 unsigned int bar) 105 unsigned int bar)
78{ 106{
79 return pnp_get_resource(dev, IORESOURCE_MEM, bar)->end; 107 struct resource *res = pnp_get_resource(dev, IORESOURCE_MEM, bar);
108
109 if (pnp_resource_valid(res))
110 return res->end;
111 return 0;
80} 112}
81 113
82static inline unsigned long pnp_mem_flags(struct pnp_dev *dev, unsigned int bar) 114static inline unsigned long pnp_mem_flags(struct pnp_dev *dev, unsigned int bar)
83{ 115{
84 return pnp_get_resource(dev, IORESOURCE_MEM, bar)->flags; 116 struct resource *res = pnp_get_resource(dev, IORESOURCE_MEM, bar);
117
118 if (pnp_resource_valid(res))
119 return res->flags;
120 return IORESOURCE_MEM | IORESOURCE_AUTO;
85} 121}
86 122
87static inline int pnp_mem_valid(struct pnp_dev *dev, unsigned int bar) 123static inline int pnp_mem_valid(struct pnp_dev *dev, unsigned int bar)
@@ -92,18 +128,30 @@ static inline int pnp_mem_valid(struct pnp_dev *dev, unsigned int bar)
92static inline resource_size_t pnp_mem_len(struct pnp_dev *dev, 128static inline resource_size_t pnp_mem_len(struct pnp_dev *dev,
93 unsigned int bar) 129 unsigned int bar)
94{ 130{
95 return pnp_resource_len(pnp_get_resource(dev, IORESOURCE_MEM, bar)); 131 struct resource *res = pnp_get_resource(dev, IORESOURCE_MEM, bar);
132
133 if (pnp_resource_valid(res))
134 return pnp_resource_len(res);
135 return 0;
96} 136}
97 137
98 138
99static inline resource_size_t pnp_irq(struct pnp_dev *dev, unsigned int bar) 139static inline resource_size_t pnp_irq(struct pnp_dev *dev, unsigned int bar)
100{ 140{
101 return pnp_get_resource(dev, IORESOURCE_IRQ, bar)->start; 141 struct resource *res = pnp_get_resource(dev, IORESOURCE_IRQ, bar);
142
143 if (pnp_resource_valid(res))
144 return res->start;
145 return -1;
102} 146}
103 147
104static inline unsigned long pnp_irq_flags(struct pnp_dev *dev, unsigned int bar) 148static inline unsigned long pnp_irq_flags(struct pnp_dev *dev, unsigned int bar)
105{ 149{
106 return pnp_get_resource(dev, IORESOURCE_IRQ, bar)->flags; 150 struct resource *res = pnp_get_resource(dev, IORESOURCE_IRQ, bar);
151
152 if (pnp_resource_valid(res))
153 return res->flags;
154 return IORESOURCE_IRQ | IORESOURCE_AUTO;
107} 155}
108 156
109static inline int pnp_irq_valid(struct pnp_dev *dev, unsigned int bar) 157static inline int pnp_irq_valid(struct pnp_dev *dev, unsigned int bar)
@@ -114,12 +162,20 @@ static inline int pnp_irq_valid(struct pnp_dev *dev, unsigned int bar)
114 162
115static inline resource_size_t pnp_dma(struct pnp_dev *dev, unsigned int bar) 163static inline resource_size_t pnp_dma(struct pnp_dev *dev, unsigned int bar)
116{ 164{
117 return pnp_get_resource(dev, IORESOURCE_DMA, bar)->start; 165 struct resource *res = pnp_get_resource(dev, IORESOURCE_DMA, bar);
166
167 if (pnp_resource_valid(res))
168 return res->start;
169 return -1;
118} 170}
119 171
120static inline unsigned long pnp_dma_flags(struct pnp_dev *dev, unsigned int bar) 172static inline unsigned long pnp_dma_flags(struct pnp_dev *dev, unsigned int bar)
121{ 173{
122 return pnp_get_resource(dev, IORESOURCE_DMA, bar)->flags; 174 struct resource *res = pnp_get_resource(dev, IORESOURCE_DMA, bar);
175
176 if (pnp_resource_valid(res))
177 return res->flags;
178 return IORESOURCE_DMA | IORESOURCE_AUTO;
123} 179}
124 180
125static inline int pnp_dma_valid(struct pnp_dev *dev, unsigned int bar) 181static inline int pnp_dma_valid(struct pnp_dev *dev, unsigned int bar)
@@ -128,57 +184,6 @@ static inline int pnp_dma_valid(struct pnp_dev *dev, unsigned int bar)
128} 184}
129 185
130 186
131#define PNP_PORT_FLAG_16BITADDR (1<<0)
132#define PNP_PORT_FLAG_FIXED (1<<1)
133
134struct pnp_port {
135 unsigned short min; /* min base number */
136 unsigned short max; /* max base number */
137 unsigned char align; /* align boundary */
138 unsigned char size; /* size of range */
139 unsigned char flags; /* port flags */
140 unsigned char pad; /* pad */
141 struct pnp_port *next; /* next port */
142};
143
144#define PNP_IRQ_NR 256
145struct pnp_irq {
146 DECLARE_BITMAP(map, PNP_IRQ_NR); /* bitmask for IRQ lines */
147 unsigned char flags; /* IRQ flags */
148 unsigned char pad; /* pad */
149 struct pnp_irq *next; /* next IRQ */
150};
151
152struct pnp_dma {
153 unsigned char map; /* bitmask for DMA channels */
154 unsigned char flags; /* DMA flags */
155 struct pnp_dma *next; /* next port */
156};
157
158struct pnp_mem {
159 unsigned int min; /* min base number */
160 unsigned int max; /* max base number */
161 unsigned int align; /* align boundary */
162 unsigned int size; /* size of range */
163 unsigned char flags; /* memory flags */
164 unsigned char pad; /* pad */
165 struct pnp_mem *next; /* next memory resource */
166};
167
168#define PNP_RES_PRIORITY_PREFERRED 0
169#define PNP_RES_PRIORITY_ACCEPTABLE 1
170#define PNP_RES_PRIORITY_FUNCTIONAL 2
171#define PNP_RES_PRIORITY_INVALID 65535
172
173struct pnp_option {
174 unsigned short priority; /* priority */
175 struct pnp_port *port; /* first port */
176 struct pnp_irq *irq; /* first IRQ */
177 struct pnp_dma *dma; /* first DMA */
178 struct pnp_mem *mem; /* first memory resource */
179 struct pnp_option *next; /* used to chain dependent resources */
180};
181
182/* 187/*
183 * Device Management 188 * Device Management
184 */ 189 */
@@ -246,9 +251,9 @@ struct pnp_dev {
246 251
247 int active; 252 int active;
248 int capabilities; 253 int capabilities;
249 struct pnp_option *independent; 254 unsigned int num_dependent_sets;
250 struct pnp_option *dependent; 255 struct list_head resources;
251 struct pnp_resource_table *res; 256 struct list_head options;
252 257
253 char name[PNP_NAME_LEN]; /* contains a human-readable name */ 258 char name[PNP_NAME_LEN]; /* contains a human-readable name */
254 int flags; /* used by protocols */ 259 int flags; /* used by protocols */
@@ -425,6 +430,8 @@ void pnp_unregister_card_driver(struct pnp_card_driver *drv);
425extern struct list_head pnp_cards; 430extern struct list_head pnp_cards;
426 431
427/* resource management */ 432/* resource management */
433int pnp_possible_config(struct pnp_dev *dev, int type, resource_size_t base,
434 resource_size_t size);
428int pnp_auto_config_dev(struct pnp_dev *dev); 435int pnp_auto_config_dev(struct pnp_dev *dev);
429int pnp_start_dev(struct pnp_dev *dev); 436int pnp_start_dev(struct pnp_dev *dev);
430int pnp_stop_dev(struct pnp_dev *dev); 437int pnp_stop_dev(struct pnp_dev *dev);
@@ -452,6 +459,9 @@ static inline int pnp_register_card_driver(struct pnp_card_driver *drv) { return
452static inline void pnp_unregister_card_driver(struct pnp_card_driver *drv) { } 459static inline void pnp_unregister_card_driver(struct pnp_card_driver *drv) { }
453 460
454/* resource management */ 461/* resource management */
462static inline int pnp_possible_config(struct pnp_dev *dev, int type,
463 resource_size_t base,
464 resource_size_t size) { return 0; }
455static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; } 465static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; }
456static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; } 466static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; }
457static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; } 467static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; }
diff --git a/include/linux/ppp-comp.h b/include/linux/ppp-comp.h
index e86a7a5cf35..b8d4ddd2273 100644
--- a/include/linux/ppp-comp.h
+++ b/include/linux/ppp-comp.h
@@ -23,8 +23,6 @@
23 * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO 23 * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
24 * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, 24 * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
25 * OR MODIFICATIONS. 25 * OR MODIFICATIONS.
26 *
27 * $Id: ppp-comp.h,v 1.6 1997/11/27 06:04:44 paulus Exp $
28 */ 26 */
29 27
30/* 28/*
diff --git a/include/linux/ppp_defs.h b/include/linux/ppp_defs.h
index c6b13ff8502..6e8adc77522 100644
--- a/include/linux/ppp_defs.h
+++ b/include/linux/ppp_defs.h
@@ -1,5 +1,3 @@
1/* $Id: ppp_defs.h,v 1.2 1994/09/21 01:31:06 paulus Exp $ */
2
3/* 1/*
4 * ppp_defs.h - PPP definitions. 2 * ppp_defs.h - PPP definitions.
5 * 3 *
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index 23f0c54175c..72b1a10a59b 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -10,7 +10,7 @@
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11#include <linux/list.h> 11#include <linux/list.h>
12 12
13#ifdef CONFIG_DEBUG_PREEMPT 13#if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER)
14 extern void add_preempt_count(int val); 14 extern void add_preempt_count(int val);
15 extern void sub_preempt_count(int val); 15 extern void sub_preempt_count(int val);
16#else 16#else
@@ -52,6 +52,34 @@ do { \
52 preempt_check_resched(); \ 52 preempt_check_resched(); \
53} while (0) 53} while (0)
54 54
55/* For debugging and tracer internals only! */
56#define add_preempt_count_notrace(val) \
57 do { preempt_count() += (val); } while (0)
58#define sub_preempt_count_notrace(val) \
59 do { preempt_count() -= (val); } while (0)
60#define inc_preempt_count_notrace() add_preempt_count_notrace(1)
61#define dec_preempt_count_notrace() sub_preempt_count_notrace(1)
62
63#define preempt_disable_notrace() \
64do { \
65 inc_preempt_count_notrace(); \
66 barrier(); \
67} while (0)
68
69#define preempt_enable_no_resched_notrace() \
70do { \
71 barrier(); \
72 dec_preempt_count_notrace(); \
73} while (0)
74
75/* preempt_check_resched is OK to trace */
76#define preempt_enable_notrace() \
77do { \
78 preempt_enable_no_resched_notrace(); \
79 barrier(); \
80 preempt_check_resched(); \
81} while (0)
82
55#else 83#else
56 84
57#define preempt_disable() do { } while (0) 85#define preempt_disable() do { } while (0)
@@ -59,6 +87,10 @@ do { \
59#define preempt_enable() do { } while (0) 87#define preempt_enable() do { } while (0)
60#define preempt_check_resched() do { } while (0) 88#define preempt_check_resched() do { } while (0)
61 89
90#define preempt_disable_notrace() do { } while (0)
91#define preempt_enable_no_resched_notrace() do { } while (0)
92#define preempt_enable_notrace() do { } while (0)
93
62#endif 94#endif
63 95
64#ifdef CONFIG_PREEMPT_NOTIFIERS 96#ifdef CONFIG_PREEMPT_NOTIFIERS
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 9883bc94226..fb61850d1cf 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -9,6 +9,8 @@
9 9
10struct net; 10struct net;
11struct completion; 11struct completion;
12struct mm_struct;
13
12/* 14/*
13 * The proc filesystem constants/structures 15 * The proc filesystem constants/structures
14 */ 16 */
@@ -77,6 +79,7 @@ struct proc_dir_entry {
77 int pde_users; /* number of callers into module in progress */ 79 int pde_users; /* number of callers into module in progress */
78 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */ 80 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */
79 struct completion *pde_unload_completion; 81 struct completion *pde_unload_completion;
82 struct list_head pde_openers; /* who did ->open, but not ->release */
80}; 83};
81 84
82struct kcore_list { 85struct kcore_list {
@@ -101,8 +104,6 @@ extern spinlock_t proc_subdir_lock;
101extern void proc_root_init(void); 104extern void proc_root_init(void);
102extern void proc_misc_init(void); 105extern void proc_misc_init(void);
103 106
104struct mm_struct;
105
106void proc_flush_task(struct task_struct *task); 107void proc_flush_task(struct task_struct *task);
107struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *); 108struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *);
108int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir); 109int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir);
@@ -138,7 +139,6 @@ extern int proc_readdir(struct file *, void *, filldir_t);
138extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *); 139extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *);
139 140
140extern const struct file_operations proc_kcore_operations; 141extern const struct file_operations proc_kcore_operations;
141extern const struct file_operations proc_kmsg_operations;
142extern const struct file_operations ppc_htab_operations; 142extern const struct file_operations ppc_htab_operations;
143 143
144extern int pid_ns_prepare_proc(struct pid_namespace *ns); 144extern int pid_ns_prepare_proc(struct pid_namespace *ns);
@@ -282,11 +282,16 @@ union proc_op {
282 struct task_struct *task); 282 struct task_struct *task);
283}; 283};
284 284
285struct ctl_table_header;
286struct ctl_table;
287
285struct proc_inode { 288struct proc_inode {
286 struct pid *pid; 289 struct pid *pid;
287 int fd; 290 int fd;
288 union proc_op op; 291 union proc_op op;
289 struct proc_dir_entry *pde; 292 struct proc_dir_entry *pde;
293 struct ctl_table_header *sysctl;
294 struct ctl_table *sysctl_entry;
290 struct inode vfs_inode; 295 struct inode vfs_inode;
291}; 296};
292 297
@@ -305,8 +310,6 @@ static inline struct net *PDE_NET(struct proc_dir_entry *pde)
305 return pde->parent->data; 310 return pde->parent->data;
306} 311}
307 312
308struct net *get_proc_net(const struct inode *inode);
309
310struct proc_maps_private { 313struct proc_maps_private {
311 struct pid *pid; 314 struct pid *pid;
312 struct task_struct *task; 315 struct task_struct *task;
diff --git a/include/linux/profile.h b/include/linux/profile.h
index 05c1cc73693..7e7087239af 100644
--- a/include/linux/profile.h
+++ b/include/linux/profile.h
@@ -8,8 +8,6 @@
8 8
9#include <asm/errno.h> 9#include <asm/errno.h>
10 10
11extern int prof_on __read_mostly;
12
13#define CPU_PROFILING 1 11#define CPU_PROFILING 1
14#define SCHED_PROFILING 2 12#define SCHED_PROFILING 2
15#define SLEEP_PROFILING 3 13#define SLEEP_PROFILING 3
@@ -19,14 +17,31 @@ struct proc_dir_entry;
19struct pt_regs; 17struct pt_regs;
20struct notifier_block; 18struct notifier_block;
21 19
20#if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS)
21void create_prof_cpu_mask(struct proc_dir_entry *de);
22#else
23static inline void create_prof_cpu_mask(struct proc_dir_entry *de)
24{
25}
26#endif
27
28enum profile_type {
29 PROFILE_TASK_EXIT,
30 PROFILE_MUNMAP
31};
32
33#ifdef CONFIG_PROFILING
34
35extern int prof_on __read_mostly;
36
22/* init basic kernel profiler */ 37/* init basic kernel profiler */
23void __init profile_init(void); 38void __init profile_init(void);
24void profile_tick(int); 39void profile_tick(int type);
25 40
26/* 41/*
27 * Add multiple profiler hits to a given address: 42 * Add multiple profiler hits to a given address:
28 */ 43 */
29void profile_hits(int, void *ip, unsigned int nr_hits); 44void profile_hits(int type, void *ip, unsigned int nr_hits);
30 45
31/* 46/*
32 * Single profiler hit: 47 * Single profiler hit:
@@ -40,19 +55,6 @@ static inline void profile_hit(int type, void *ip)
40 profile_hits(type, ip, 1); 55 profile_hits(type, ip, 1);
41} 56}
42 57
43#ifdef CONFIG_PROC_FS
44void create_prof_cpu_mask(struct proc_dir_entry *);
45#else
46#define create_prof_cpu_mask(x) do { (void)(x); } while (0)
47#endif
48
49enum profile_type {
50 PROFILE_TASK_EXIT,
51 PROFILE_MUNMAP
52};
53
54#ifdef CONFIG_PROFILING
55
56struct task_struct; 58struct task_struct;
57struct mm_struct; 59struct mm_struct;
58 60
@@ -80,6 +82,28 @@ struct pt_regs;
80 82
81#else 83#else
82 84
85#define prof_on 0
86
87static inline void profile_init(void)
88{
89 return;
90}
91
92static inline void profile_tick(int type)
93{
94 return;
95}
96
97static inline void profile_hits(int type, void *ip, unsigned int nr_hits)
98{
99 return;
100}
101
102static inline void profile_hit(int type, void *ip)
103{
104 return;
105}
106
83static inline int task_handoff_register(struct notifier_block * n) 107static inline int task_handoff_register(struct notifier_block * n)
84{ 108{
85 return -ENOSYS; 109 return -ENOSYS;
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index f98501ba557..fd31756e1a0 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -95,8 +95,12 @@ extern void __ptrace_link(struct task_struct *child,
95 struct task_struct *new_parent); 95 struct task_struct *new_parent);
96extern void __ptrace_unlink(struct task_struct *child); 96extern void __ptrace_unlink(struct task_struct *child);
97extern void ptrace_untrace(struct task_struct *child); 97extern void ptrace_untrace(struct task_struct *child);
98extern int ptrace_may_attach(struct task_struct *task); 98#define PTRACE_MODE_READ 1
99extern int __ptrace_may_attach(struct task_struct *task); 99#define PTRACE_MODE_ATTACH 2
100/* Returns 0 on success, -errno on denial. */
101extern int __ptrace_may_access(struct task_struct *task, unsigned int mode);
102/* Returns true on success, false on denial. */
103extern bool ptrace_may_access(struct task_struct *task, unsigned int mode);
100 104
101static inline int ptrace_reparented(struct task_struct *child) 105static inline int ptrace_reparented(struct task_struct *child)
102{ 106{
@@ -117,6 +121,74 @@ static inline void ptrace_unlink(struct task_struct *child)
117int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data); 121int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data);
118int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data); 122int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data);
119 123
124/**
125 * task_ptrace - return %PT_* flags that apply to a task
126 * @task: pointer to &task_struct in question
127 *
128 * Returns the %PT_* flags that apply to @task.
129 */
130static inline int task_ptrace(struct task_struct *task)
131{
132 return task->ptrace;
133}
134
135/**
136 * ptrace_event - possibly stop for a ptrace event notification
137 * @mask: %PT_* bit to check in @current->ptrace
138 * @event: %PTRACE_EVENT_* value to report if @mask is set
139 * @message: value for %PTRACE_GETEVENTMSG to return
140 *
141 * This checks the @mask bit to see if ptrace wants stops for this event.
142 * If so we stop, reporting @event and @message to the ptrace parent.
143 *
144 * Returns nonzero if we did a ptrace notification, zero if not.
145 *
146 * Called without locks.
147 */
148static inline int ptrace_event(int mask, int event, unsigned long message)
149{
150 if (mask && likely(!(current->ptrace & mask)))
151 return 0;
152 current->ptrace_message = message;
153 ptrace_notify((event << 8) | SIGTRAP);
154 return 1;
155}
156
157/**
158 * ptrace_init_task - initialize ptrace state for a new child
159 * @child: new child task
160 * @ptrace: true if child should be ptrace'd by parent's tracer
161 *
162 * This is called immediately after adding @child to its parent's children
163 * list. @ptrace is false in the normal case, and true to ptrace @child.
164 *
165 * Called with current's siglock and write_lock_irq(&tasklist_lock) held.
166 */
167static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
168{
169 INIT_LIST_HEAD(&child->ptrace_entry);
170 INIT_LIST_HEAD(&child->ptraced);
171 child->parent = child->real_parent;
172 child->ptrace = 0;
173 if (unlikely(ptrace)) {
174 child->ptrace = current->ptrace;
175 __ptrace_link(child, current->parent);
176 }
177}
178
179/**
180 * ptrace_release_task - final ptrace-related cleanup of a zombie being reaped
181 * @task: task in %EXIT_DEAD state
182 *
183 * Called with write_lock(&tasklist_lock) held.
184 */
185static inline void ptrace_release_task(struct task_struct *task)
186{
187 BUG_ON(!list_empty(&task->ptraced));
188 ptrace_unlink(task);
189 BUG_ON(!list_empty(&task->ptrace_entry));
190}
191
120#ifndef force_successful_syscall_return 192#ifndef force_successful_syscall_return
121/* 193/*
122 * System call handlers that, upon successful completion, need to return a 194 * System call handlers that, upon successful completion, need to return a
@@ -242,6 +314,10 @@ static inline void user_enable_block_step(struct task_struct *task)
242#define arch_ptrace_stop(code, info) do { } while (0) 314#define arch_ptrace_stop(code, info) do { } while (0)
243#endif 315#endif
244 316
317extern int task_current_syscall(struct task_struct *target, long *callno,
318 unsigned long args[6], unsigned int maxargs,
319 unsigned long *sp, unsigned long *pc);
320
245#endif 321#endif
246 322
247#endif 323#endif
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
new file mode 100644
index 00000000000..3945f803d51
--- /dev/null
+++ b/include/linux/pwm.h
@@ -0,0 +1,31 @@
1#ifndef __LINUX_PWM_H
2#define __LINUX_PWM_H
3
4struct pwm_device;
5
6/*
7 * pwm_request - request a PWM device
8 */
9struct pwm_device *pwm_request(int pwm_id, const char *label);
10
11/*
12 * pwm_free - free a PWM device
13 */
14void pwm_free(struct pwm_device *pwm);
15
16/*
17 * pwm_config - change a PWM device configuration
18 */
19int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns);
20
21/*
22 * pwm_enable - start a PWM output toggling
23 */
24int pwm_enable(struct pwm_device *pwm);
25
26/*
27 * pwm_disable - stop a PWM output toggling
28 */
29void pwm_disable(struct pwm_device *pwm);
30
31#endif /* __ASM_ARCH_PWM_H */
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h
new file mode 100644
index 00000000000..7a9754c9677
--- /dev/null
+++ b/include/linux/pwm_backlight.h
@@ -0,0 +1,17 @@
1/*
2 * Generic PWM backlight driver data - see drivers/video/backlight/pwm_bl.c
3 */
4#ifndef __LINUX_PWM_BACKLIGHT_H
5#define __LINUX_PWM_BACKLIGHT_H
6
7struct platform_pwm_backlight_data {
8 int pwm_id;
9 unsigned int max_brightness;
10 unsigned int dft_brightness;
11 unsigned int pwm_period_ns;
12 int (*init)(struct device *dev);
13 int (*notify)(int brightness);
14 void (*exit)(struct device *dev);
15};
16
17#endif
diff --git a/include/linux/quota.h b/include/linux/quota.h
index dcddfb20094..376a05048bc 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -41,9 +41,6 @@
41#define __DQUOT_VERSION__ "dquot_6.5.1" 41#define __DQUOT_VERSION__ "dquot_6.5.1"
42#define __DQUOT_NUM_VERSION__ 6*10000+5*100+1 42#define __DQUOT_NUM_VERSION__ 6*10000+5*100+1
43 43
44typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
45typedef __u64 qsize_t; /* Type in which we store sizes */
46
47/* Size of blocks in which are counted size limits */ 44/* Size of blocks in which are counted size limits */
48#define QUOTABLOCK_BITS 10 45#define QUOTABLOCK_BITS 10
49#define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS) 46#define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS)
@@ -138,6 +135,10 @@ struct if_dqinfo {
138#define QUOTA_NL_BHARDWARN 4 /* Block hardlimit reached */ 135#define QUOTA_NL_BHARDWARN 4 /* Block hardlimit reached */
139#define QUOTA_NL_BSOFTLONGWARN 5 /* Block grace time expired */ 136#define QUOTA_NL_BSOFTLONGWARN 5 /* Block grace time expired */
140#define QUOTA_NL_BSOFTWARN 6 /* Block softlimit reached */ 137#define QUOTA_NL_BSOFTWARN 6 /* Block softlimit reached */
138#define QUOTA_NL_IHARDBELOW 7 /* Usage got below inode hardlimit */
139#define QUOTA_NL_ISOFTBELOW 8 /* Usage got below inode softlimit */
140#define QUOTA_NL_BHARDBELOW 9 /* Usage got below block hardlimit */
141#define QUOTA_NL_BSOFTBELOW 10 /* Usage got below block softlimit */
141 142
142enum { 143enum {
143 QUOTA_NL_C_UNSPEC, 144 QUOTA_NL_C_UNSPEC,
@@ -172,6 +173,9 @@ enum {
172 173
173#include <asm/atomic.h> 174#include <asm/atomic.h>
174 175
176typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
177typedef __u64 qsize_t; /* Type in which we store sizes */
178
175extern spinlock_t dq_data_lock; 179extern spinlock_t dq_data_lock;
176 180
177/* Maximal numbers of writes for quota operation (insert/delete/update) 181/* Maximal numbers of writes for quota operation (insert/delete/update)
@@ -223,12 +227,10 @@ struct super_block;
223#define DQF_INFO_DIRTY (1 << DQF_INFO_DIRTY_B) /* Is info dirty? */ 227#define DQF_INFO_DIRTY (1 << DQF_INFO_DIRTY_B) /* Is info dirty? */
224 228
225extern void mark_info_dirty(struct super_block *sb, int type); 229extern void mark_info_dirty(struct super_block *sb, int type);
226#define info_dirty(info) test_bit(DQF_INFO_DIRTY_B, &(info)->dqi_flags) 230static inline int info_dirty(struct mem_dqinfo *info)
227#define info_any_dquot_dirty(info) (!list_empty(&(info)->dqi_dirty_list)) 231{
228#define info_any_dirty(info) (info_dirty(info) || info_any_dquot_dirty(info)) 232 return test_bit(DQF_INFO_DIRTY_B, &info->dqi_flags);
229 233}
230#define sb_dqopt(sb) (&(sb)->s_dquot)
231#define sb_dqinfo(sb, type) (sb_dqopt(sb)->info+(type))
232 234
233struct dqstats { 235struct dqstats {
234 int lookups; 236 int lookups;
@@ -337,19 +339,6 @@ struct quota_info {
337 struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ 339 struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */
338}; 340};
339 341
340#define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \
341 (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED))
342
343#define sb_any_quota_enabled(sb) (sb_has_quota_enabled(sb, USRQUOTA) | \
344 sb_has_quota_enabled(sb, GRPQUOTA))
345
346#define sb_has_quota_suspended(sb, type) \
347 ((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \
348 (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED))
349
350#define sb_any_quota_suspended(sb) (sb_has_quota_suspended(sb, USRQUOTA) | \
351 sb_has_quota_suspended(sb, GRPQUOTA))
352
353int register_quota_format(struct quota_format_type *fmt); 342int register_quota_format(struct quota_format_type *fmt);
354void unregister_quota_format(struct quota_format_type *fmt); 343void unregister_quota_format(struct quota_format_type *fmt);
355 344
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index f8670205385..742187f7a05 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -11,42 +11,85 @@
11#define _LINUX_QUOTAOPS_ 11#define _LINUX_QUOTAOPS_
12 12
13#include <linux/smp_lock.h> 13#include <linux/smp_lock.h>
14
15#include <linux/fs.h> 14#include <linux/fs.h>
16 15
16static inline struct quota_info *sb_dqopt(struct super_block *sb)
17{
18 return &sb->s_dquot;
19}
20
17#if defined(CONFIG_QUOTA) 21#if defined(CONFIG_QUOTA)
18 22
19/* 23/*
20 * declaration of quota_function calls in kernel. 24 * declaration of quota_function calls in kernel.
21 */ 25 */
22extern void sync_dquots(struct super_block *sb, int type); 26void sync_dquots(struct super_block *sb, int type);
23 27
24extern int dquot_initialize(struct inode *inode, int type); 28int dquot_initialize(struct inode *inode, int type);
25extern int dquot_drop(struct inode *inode); 29int dquot_drop(struct inode *inode);
26 30
27extern int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); 31int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc);
28extern int dquot_alloc_inode(const struct inode *inode, unsigned long number); 32int dquot_alloc_inode(const struct inode *inode, unsigned long number);
29 33
30extern int dquot_free_space(struct inode *inode, qsize_t number); 34int dquot_free_space(struct inode *inode, qsize_t number);
31extern int dquot_free_inode(const struct inode *inode, unsigned long number); 35int dquot_free_inode(const struct inode *inode, unsigned long number);
32 36
33extern int dquot_transfer(struct inode *inode, struct iattr *iattr); 37int dquot_transfer(struct inode *inode, struct iattr *iattr);
34extern int dquot_commit(struct dquot *dquot); 38int dquot_commit(struct dquot *dquot);
35extern int dquot_acquire(struct dquot *dquot); 39int dquot_acquire(struct dquot *dquot);
36extern int dquot_release(struct dquot *dquot); 40int dquot_release(struct dquot *dquot);
37extern int dquot_commit_info(struct super_block *sb, int type); 41int dquot_commit_info(struct super_block *sb, int type);
38extern int dquot_mark_dquot_dirty(struct dquot *dquot); 42int dquot_mark_dquot_dirty(struct dquot *dquot);
39 43
40extern int vfs_quota_on(struct super_block *sb, int type, int format_id, 44int vfs_quota_on(struct super_block *sb, int type, int format_id,
41 char *path, int remount); 45 char *path, int remount);
42extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name, 46int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
43 int format_id, int type); 47 int format_id, int type);
44extern int vfs_quota_off(struct super_block *sb, int type, int remount); 48int vfs_quota_off(struct super_block *sb, int type, int remount);
45extern int vfs_quota_sync(struct super_block *sb, int type); 49int vfs_quota_sync(struct super_block *sb, int type);
46extern int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 50int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
47extern int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 51int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
48extern int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); 52int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
49extern int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); 53int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
54
55void vfs_dq_drop(struct inode *inode);
56int vfs_dq_transfer(struct inode *inode, struct iattr *iattr);
57int vfs_dq_quota_on_remount(struct super_block *sb);
58
59static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
60{
61 return sb_dqopt(sb)->info + type;
62}
63
64/*
65 * Functions for checking status of quota
66 */
67
68static inline int sb_has_quota_enabled(struct super_block *sb, int type)
69{
70 if (type == USRQUOTA)
71 return sb_dqopt(sb)->flags & DQUOT_USR_ENABLED;
72 return sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED;
73}
74
75static inline int sb_any_quota_enabled(struct super_block *sb)
76{
77 return sb_has_quota_enabled(sb, USRQUOTA) ||
78 sb_has_quota_enabled(sb, GRPQUOTA);
79}
80
81static inline int sb_has_quota_suspended(struct super_block *sb, int type)
82{
83 if (type == USRQUOTA)
84 return sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED;
85 return sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED;
86}
87
88static inline int sb_any_quota_suspended(struct super_block *sb)
89{
90 return sb_has_quota_suspended(sb, USRQUOTA) ||
91 sb_has_quota_suspended(sb, GRPQUOTA);
92}
50 93
51/* 94/*
52 * Operations supported for diskquotas. 95 * Operations supported for diskquotas.
@@ -59,38 +102,16 @@ extern struct quotactl_ops vfs_quotactl_ops;
59 102
60/* It is better to call this function outside of any transaction as it might 103/* It is better to call this function outside of any transaction as it might
61 * need a lot of space in journal for dquot structure allocation. */ 104 * need a lot of space in journal for dquot structure allocation. */
62static inline void DQUOT_INIT(struct inode *inode) 105static inline void vfs_dq_init(struct inode *inode)
63{ 106{
64 BUG_ON(!inode->i_sb); 107 BUG_ON(!inode->i_sb);
65 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) 108 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode))
66 inode->i_sb->dq_op->initialize(inode, -1); 109 inode->i_sb->dq_op->initialize(inode, -1);
67} 110}
68 111
69/* The same as with DQUOT_INIT */
70static inline void DQUOT_DROP(struct inode *inode)
71{
72 /* Here we can get arbitrary inode from clear_inode() so we have
73 * to be careful. OTOH we don't need locking as quota operations
74 * are allowed to change only at mount time */
75 if (!IS_NOQUOTA(inode) && inode->i_sb && inode->i_sb->dq_op
76 && inode->i_sb->dq_op->drop) {
77 int cnt;
78 /* Test before calling to rule out calls from proc and such
79 * where we are not allowed to block. Note that this is
80 * actually reliable test even without the lock - the caller
81 * must assure that nobody can come after the DQUOT_DROP and
82 * add quota pointers back anyway */
83 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
84 if (inode->i_dquot[cnt] != NODQUOT)
85 break;
86 if (cnt < MAXQUOTAS)
87 inode->i_sb->dq_op->drop(inode);
88 }
89}
90
91/* The following allocation/freeing/transfer functions *must* be called inside 112/* The following allocation/freeing/transfer functions *must* be called inside
92 * a transaction (deadlocks possible otherwise) */ 113 * a transaction (deadlocks possible otherwise) */
93static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 114static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
94{ 115{
95 if (sb_any_quota_enabled(inode->i_sb)) { 116 if (sb_any_quota_enabled(inode->i_sb)) {
96 /* Used space is updated in alloc_space() */ 117 /* Used space is updated in alloc_space() */
@@ -102,15 +123,15 @@ static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
102 return 0; 123 return 0;
103} 124}
104 125
105static inline int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr) 126static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
106{ 127{
107 int ret; 128 int ret;
108 if (!(ret = DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr))) 129 if (!(ret = vfs_dq_prealloc_space_nodirty(inode, nr)))
109 mark_inode_dirty(inode); 130 mark_inode_dirty(inode);
110 return ret; 131 return ret;
111} 132}
112 133
113static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 134static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
114{ 135{
115 if (sb_any_quota_enabled(inode->i_sb)) { 136 if (sb_any_quota_enabled(inode->i_sb)) {
116 /* Used space is updated in alloc_space() */ 137 /* Used space is updated in alloc_space() */
@@ -122,25 +143,25 @@ static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
122 return 0; 143 return 0;
123} 144}
124 145
125static inline int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr) 146static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
126{ 147{
127 int ret; 148 int ret;
128 if (!(ret = DQUOT_ALLOC_SPACE_NODIRTY(inode, nr))) 149 if (!(ret = vfs_dq_alloc_space_nodirty(inode, nr)))
129 mark_inode_dirty(inode); 150 mark_inode_dirty(inode);
130 return ret; 151 return ret;
131} 152}
132 153
133static inline int DQUOT_ALLOC_INODE(struct inode *inode) 154static inline int vfs_dq_alloc_inode(struct inode *inode)
134{ 155{
135 if (sb_any_quota_enabled(inode->i_sb)) { 156 if (sb_any_quota_enabled(inode->i_sb)) {
136 DQUOT_INIT(inode); 157 vfs_dq_init(inode);
137 if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) 158 if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA)
138 return 1; 159 return 1;
139 } 160 }
140 return 0; 161 return 0;
141} 162}
142 163
143static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 164static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
144{ 165{
145 if (sb_any_quota_enabled(inode->i_sb)) 166 if (sb_any_quota_enabled(inode->i_sb))
146 inode->i_sb->dq_op->free_space(inode, nr); 167 inode->i_sb->dq_op->free_space(inode, nr);
@@ -148,35 +169,25 @@ static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
148 inode_sub_bytes(inode, nr); 169 inode_sub_bytes(inode, nr);
149} 170}
150 171
151static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr) 172static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
152{ 173{
153 DQUOT_FREE_SPACE_NODIRTY(inode, nr); 174 vfs_dq_free_space_nodirty(inode, nr);
154 mark_inode_dirty(inode); 175 mark_inode_dirty(inode);
155} 176}
156 177
157static inline void DQUOT_FREE_INODE(struct inode *inode) 178static inline void vfs_dq_free_inode(struct inode *inode)
158{ 179{
159 if (sb_any_quota_enabled(inode->i_sb)) 180 if (sb_any_quota_enabled(inode->i_sb))
160 inode->i_sb->dq_op->free_inode(inode, 1); 181 inode->i_sb->dq_op->free_inode(inode, 1);
161} 182}
162 183
163static inline int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr)
164{
165 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) {
166 DQUOT_INIT(inode);
167 if (inode->i_sb->dq_op->transfer(inode, iattr) == NO_QUOTA)
168 return 1;
169 }
170 return 0;
171}
172
173/* The following two functions cannot be called inside a transaction */ 184/* The following two functions cannot be called inside a transaction */
174static inline void DQUOT_SYNC(struct super_block *sb) 185static inline void vfs_dq_sync(struct super_block *sb)
175{ 186{
176 sync_dquots(sb, -1); 187 sync_dquots(sb, -1);
177} 188}
178 189
179static inline int DQUOT_OFF(struct super_block *sb, int remount) 190static inline int vfs_dq_off(struct super_block *sb, int remount)
180{ 191{
181 int ret = -ENOSYS; 192 int ret = -ENOSYS;
182 193
@@ -185,22 +196,27 @@ static inline int DQUOT_OFF(struct super_block *sb, int remount)
185 return ret; 196 return ret;
186} 197}
187 198
188static inline int DQUOT_ON_REMOUNT(struct super_block *sb) 199#else
200
201static inline int sb_has_quota_enabled(struct super_block *sb, int type)
189{ 202{
190 int cnt; 203 return 0;
191 int ret = 0, err; 204}
192 205
193 if (!sb->s_qcop || !sb->s_qcop->quota_on) 206static inline int sb_any_quota_enabled(struct super_block *sb)
194 return -ENOSYS; 207{
195 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 208 return 0;
196 err = sb->s_qcop->quota_on(sb, cnt, 0, NULL, 1);
197 if (err < 0 && !ret)
198 ret = err;
199 }
200 return ret;
201} 209}
202 210
203#else 211static inline int sb_has_quota_suspended(struct super_block *sb, int type)
212{
213 return 0;
214}
215
216static inline int sb_any_quota_suspended(struct super_block *sb)
217{
218 return 0;
219}
204 220
205/* 221/*
206 * NO-OP when quota not configured. 222 * NO-OP when quota not configured.
@@ -208,113 +224,144 @@ static inline int DQUOT_ON_REMOUNT(struct super_block *sb)
208#define sb_dquot_ops (NULL) 224#define sb_dquot_ops (NULL)
209#define sb_quotactl_ops (NULL) 225#define sb_quotactl_ops (NULL)
210 226
211static inline void DQUOT_INIT(struct inode *inode) 227static inline void vfs_dq_init(struct inode *inode)
212{ 228{
213} 229}
214 230
215static inline void DQUOT_DROP(struct inode *inode) 231static inline void vfs_dq_drop(struct inode *inode)
216{ 232{
217} 233}
218 234
219static inline int DQUOT_ALLOC_INODE(struct inode *inode) 235static inline int vfs_dq_alloc_inode(struct inode *inode)
220{ 236{
221 return 0; 237 return 0;
222} 238}
223 239
224static inline void DQUOT_FREE_INODE(struct inode *inode) 240static inline void vfs_dq_free_inode(struct inode *inode)
225{ 241{
226} 242}
227 243
228static inline void DQUOT_SYNC(struct super_block *sb) 244static inline void vfs_dq_sync(struct super_block *sb)
229{ 245{
230} 246}
231 247
232static inline int DQUOT_OFF(struct super_block *sb, int remount) 248static inline int vfs_dq_off(struct super_block *sb, int remount)
233{ 249{
234 return 0; 250 return 0;
235} 251}
236 252
237static inline int DQUOT_ON_REMOUNT(struct super_block *sb) 253static inline int vfs_dq_quota_on_remount(struct super_block *sb)
238{ 254{
239 return 0; 255 return 0;
240} 256}
241 257
242static inline int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr) 258static inline int vfs_dq_transfer(struct inode *inode, struct iattr *iattr)
243{ 259{
244 return 0; 260 return 0;
245} 261}
246 262
247static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 263static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
248{ 264{
249 inode_add_bytes(inode, nr); 265 inode_add_bytes(inode, nr);
250 return 0; 266 return 0;
251} 267}
252 268
253static inline int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr) 269static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
254{ 270{
255 DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr); 271 vfs_dq_prealloc_space_nodirty(inode, nr);
256 mark_inode_dirty(inode); 272 mark_inode_dirty(inode);
257 return 0; 273 return 0;
258} 274}
259 275
260static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 276static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
261{ 277{
262 inode_add_bytes(inode, nr); 278 inode_add_bytes(inode, nr);
263 return 0; 279 return 0;
264} 280}
265 281
266static inline int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr) 282static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
267{ 283{
268 DQUOT_ALLOC_SPACE_NODIRTY(inode, nr); 284 vfs_dq_alloc_space_nodirty(inode, nr);
269 mark_inode_dirty(inode); 285 mark_inode_dirty(inode);
270 return 0; 286 return 0;
271} 287}
272 288
273static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 289static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
274{ 290{
275 inode_sub_bytes(inode, nr); 291 inode_sub_bytes(inode, nr);
276} 292}
277 293
278static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr) 294static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
279{ 295{
280 DQUOT_FREE_SPACE_NODIRTY(inode, nr); 296 vfs_dq_free_space_nodirty(inode, nr);
281 mark_inode_dirty(inode); 297 mark_inode_dirty(inode);
282} 298}
283 299
284#endif /* CONFIG_QUOTA */ 300#endif /* CONFIG_QUOTA */
285 301
286static inline int DQUOT_PREALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr) 302static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr)
287{ 303{
288 return DQUOT_PREALLOC_SPACE_NODIRTY(inode, 304 return vfs_dq_prealloc_space_nodirty(inode,
289 nr << inode->i_sb->s_blocksize_bits); 305 nr << inode->i_sb->s_blocksize_bits);
290} 306}
291 307
292static inline int DQUOT_PREALLOC_BLOCK(struct inode *inode, qsize_t nr) 308static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr)
293{ 309{
294 return DQUOT_PREALLOC_SPACE(inode, 310 return vfs_dq_prealloc_space(inode,
295 nr << inode->i_sb->s_blocksize_bits); 311 nr << inode->i_sb->s_blocksize_bits);
296} 312}
297 313
298static inline int DQUOT_ALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr) 314static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr)
299{ 315{
300 return DQUOT_ALLOC_SPACE_NODIRTY(inode, 316 return vfs_dq_alloc_space_nodirty(inode,
301 nr << inode->i_sb->s_blocksize_bits); 317 nr << inode->i_sb->s_blocksize_bits);
302} 318}
303 319
304static inline int DQUOT_ALLOC_BLOCK(struct inode *inode, qsize_t nr) 320static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr)
305{ 321{
306 return DQUOT_ALLOC_SPACE(inode, 322 return vfs_dq_alloc_space(inode,
307 nr << inode->i_sb->s_blocksize_bits); 323 nr << inode->i_sb->s_blocksize_bits);
308} 324}
309 325
310static inline void DQUOT_FREE_BLOCK_NODIRTY(struct inode *inode, qsize_t nr) 326static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr)
311{ 327{
312 DQUOT_FREE_SPACE_NODIRTY(inode, nr << inode->i_sb->s_blocksize_bits); 328 vfs_dq_free_space_nodirty(inode, nr << inode->i_sb->s_blocksize_bits);
313} 329}
314 330
315static inline void DQUOT_FREE_BLOCK(struct inode *inode, qsize_t nr) 331static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr)
316{ 332{
317 DQUOT_FREE_SPACE(inode, nr << inode->i_sb->s_blocksize_bits); 333 vfs_dq_free_space(inode, nr << inode->i_sb->s_blocksize_bits);
318} 334}
319 335
336/*
337 * Define uppercase equivalents for compatibility with old function names
338 * Can go away when we think all users have been converted (15/04/2008)
339 */
340#define DQUOT_INIT(inode) vfs_dq_init(inode)
341#define DQUOT_DROP(inode) vfs_dq_drop(inode)
342#define DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr) \
343 vfs_dq_prealloc_space_nodirty(inode, nr)
344#define DQUOT_PREALLOC_SPACE(inode, nr) vfs_dq_prealloc_space(inode, nr)
345#define DQUOT_ALLOC_SPACE_NODIRTY(inode, nr) \
346 vfs_dq_alloc_space_nodirty(inode, nr)
347#define DQUOT_ALLOC_SPACE(inode, nr) vfs_dq_alloc_space(inode, nr)
348#define DQUOT_PREALLOC_BLOCK_NODIRTY(inode, nr) \
349 vfs_dq_prealloc_block_nodirty(inode, nr)
350#define DQUOT_PREALLOC_BLOCK(inode, nr) vfs_dq_prealloc_block(inode, nr)
351#define DQUOT_ALLOC_BLOCK_NODIRTY(inode, nr) \
352 vfs_dq_alloc_block_nodirty(inode, nr)
353#define DQUOT_ALLOC_BLOCK(inode, nr) vfs_dq_alloc_block(inode, nr)
354#define DQUOT_ALLOC_INODE(inode) vfs_dq_alloc_inode(inode)
355#define DQUOT_FREE_SPACE_NODIRTY(inode, nr) \
356 vfs_dq_free_space_nodirty(inode, nr)
357#define DQUOT_FREE_SPACE(inode, nr) vfs_dq_free_space(inode, nr)
358#define DQUOT_FREE_BLOCK_NODIRTY(inode, nr) \
359 vfs_dq_free_block_nodirty(inode, nr)
360#define DQUOT_FREE_BLOCK(inode, nr) vfs_dq_free_block(inode, nr)
361#define DQUOT_FREE_INODE(inode) vfs_dq_free_inode(inode)
362#define DQUOT_TRANSFER(inode, iattr) vfs_dq_transfer(inode, iattr)
363#define DQUOT_SYNC(sb) vfs_dq_sync(sb)
364#define DQUOT_OFF(sb, remount) vfs_dq_off(sb, remount)
365#define DQUOT_ON_REMOUNT(sb) vfs_dq_quota_on_remount(sb)
366
320#endif /* _LINUX_QUOTAOPS_ */ 367#endif /* _LINUX_QUOTAOPS_ */
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index b8ce2b444bb..a916c6660df 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -99,12 +99,15 @@ do { \
99 * 99 *
100 * The notable exceptions to this rule are the following functions: 100 * The notable exceptions to this rule are the following functions:
101 * radix_tree_lookup 101 * radix_tree_lookup
102 * radix_tree_lookup_slot
102 * radix_tree_tag_get 103 * radix_tree_tag_get
103 * radix_tree_gang_lookup 104 * radix_tree_gang_lookup
105 * radix_tree_gang_lookup_slot
104 * radix_tree_gang_lookup_tag 106 * radix_tree_gang_lookup_tag
107 * radix_tree_gang_lookup_tag_slot
105 * radix_tree_tagged 108 * radix_tree_tagged
106 * 109 *
107 * The first 4 functions are able to be called locklessly, using RCU. The 110 * The first 7 functions are able to be called locklessly, using RCU. The
108 * caller must ensure calls to these functions are made within rcu_read_lock() 111 * caller must ensure calls to these functions are made within rcu_read_lock()
109 * regions. Other readers (lock-free or otherwise) and modifications may be 112 * regions. Other readers (lock-free or otherwise) and modifications may be
110 * running concurrently. 113 * running concurrently.
@@ -159,6 +162,9 @@ void *radix_tree_delete(struct radix_tree_root *, unsigned long);
159unsigned int 162unsigned int
160radix_tree_gang_lookup(struct radix_tree_root *root, void **results, 163radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
161 unsigned long first_index, unsigned int max_items); 164 unsigned long first_index, unsigned int max_items);
165unsigned int
166radix_tree_gang_lookup_slot(struct radix_tree_root *root, void ***results,
167 unsigned long first_index, unsigned int max_items);
162unsigned long radix_tree_next_hole(struct radix_tree_root *root, 168unsigned long radix_tree_next_hole(struct radix_tree_root *root,
163 unsigned long index, unsigned long max_scan); 169 unsigned long index, unsigned long max_scan);
164int radix_tree_preload(gfp_t gfp_mask); 170int radix_tree_preload(gfp_t gfp_mask);
@@ -173,6 +179,10 @@ unsigned int
173radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, 179radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results,
174 unsigned long first_index, unsigned int max_items, 180 unsigned long first_index, unsigned int max_items,
175 unsigned int tag); 181 unsigned int tag);
182unsigned int
183radix_tree_gang_lookup_tag_slot(struct radix_tree_root *root, void ***results,
184 unsigned long first_index, unsigned int max_items,
185 unsigned int tag);
176int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag); 186int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag);
177 187
178static inline void radix_tree_preload_end(void) 188static inline void radix_tree_preload_end(void)
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
index 47fbcba1185..e98900671ca 100644
--- a/include/linux/raid/bitmap.h
+++ b/include/linux/raid/bitmap.h
@@ -221,6 +221,7 @@ struct bitmap {
221 unsigned long syncchunk; 221 unsigned long syncchunk;
222 222
223 __u64 events_cleared; 223 __u64 events_cleared;
224 int need_sync;
224 225
225 /* bitmap spinlock */ 226 /* bitmap spinlock */
226 spinlock_t lock; 227 spinlock_t lock;
@@ -262,7 +263,6 @@ int bitmap_create(mddev_t *mddev);
262void bitmap_flush(mddev_t *mddev); 263void bitmap_flush(mddev_t *mddev);
263void bitmap_destroy(mddev_t *mddev); 264void bitmap_destroy(mddev_t *mddev);
264 265
265char *file_path(struct file *file, char *buf, int count);
266void bitmap_print_sb(struct bitmap *bitmap); 266void bitmap_print_sb(struct bitmap *bitmap);
267void bitmap_update_sb(struct bitmap *bitmap); 267void bitmap_update_sb(struct bitmap *bitmap);
268 268
diff --git a/include/linux/raid/linear.h b/include/linux/raid/linear.h
index ba15469daf1..7e375111d00 100644
--- a/include/linux/raid/linear.h
+++ b/include/linux/raid/linear.h
@@ -16,7 +16,7 @@ struct linear_private_data
16 struct linear_private_data *prev; /* earlier version */ 16 struct linear_private_data *prev; /* earlier version */
17 dev_info_t **hash_table; 17 dev_info_t **hash_table;
18 sector_t hash_spacing; 18 sector_t hash_spacing;
19 sector_t array_size; 19 sector_t array_sectors;
20 int preshift; /* shift before dividing by hash_spacing */ 20 int preshift; /* shift before dividing by hash_spacing */
21 dev_info_t disks[0]; 21 dev_info_t disks[0];
22}; 22};
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index 81a1a02d456..dc0e3fcb9f2 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -72,6 +72,8 @@
72 */ 72 */
73#define MD_PATCHLEVEL_VERSION 3 73#define MD_PATCHLEVEL_VERSION 3
74 74
75extern int mdp_major;
76
75extern int register_md_personality (struct mdk_personality *p); 77extern int register_md_personality (struct mdk_personality *p);
76extern int unregister_md_personality (struct mdk_personality *p); 78extern int unregister_md_personality (struct mdk_personality *p);
77extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev), 79extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev),
@@ -93,7 +95,7 @@ extern int sync_page_io(struct block_device *bdev, sector_t sector, int size,
93 struct page *page, int rw); 95 struct page *page, int rw);
94extern void md_do_sync(mddev_t *mddev); 96extern void md_do_sync(mddev_t *mddev);
95extern void md_new_event(mddev_t *mddev); 97extern void md_new_event(mddev_t *mddev);
96extern void md_allow_write(mddev_t *mddev); 98extern int md_allow_write(mddev_t *mddev);
97extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev); 99extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev);
98 100
99#endif /* CONFIG_MD */ 101#endif /* CONFIG_MD */
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 812ffa590cf..9f2549ac0e2 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -59,7 +59,7 @@ struct mdk_rdev_s
59 int sb_loaded; 59 int sb_loaded;
60 __u64 sb_events; 60 __u64 sb_events;
61 sector_t data_offset; /* start of data in array */ 61 sector_t data_offset; /* start of data in array */
62 sector_t sb_offset; 62 sector_t sb_start; /* offset of the super block (in 512byte sectors) */
63 int sb_size; /* bytes in the superblock */ 63 int sb_size; /* bytes in the superblock */
64 int preferred_minor; /* autorun support */ 64 int preferred_minor; /* autorun support */
65 65
@@ -87,6 +87,9 @@ struct mdk_rdev_s
87#define Blocked 8 /* An error occured on an externally 87#define Blocked 8 /* An error occured on an externally
88 * managed array, don't allow writes 88 * managed array, don't allow writes
89 * until it is cleared */ 89 * until it is cleared */
90#define StateChanged 9 /* Faulty or Blocked has changed during
91 * interrupt, so it needs to be
92 * notified by the thread */
90 wait_queue_head_t blocked_wait; 93 wait_queue_head_t blocked_wait;
91 94
92 int desc_nr; /* descriptor index in the superblock */ 95 int desc_nr; /* descriptor index in the superblock */
@@ -147,7 +150,7 @@ struct mddev_s
147 int raid_disks; 150 int raid_disks;
148 int max_disks; 151 int max_disks;
149 sector_t size; /* used size of component devices */ 152 sector_t size; /* used size of component devices */
150 sector_t array_size; /* exported array size */ 153 sector_t array_sectors; /* exported array size */
151 __u64 events; 154 __u64 events;
152 155
153 char uuid[16]; 156 char uuid[16];
@@ -180,13 +183,16 @@ struct mddev_s
180 int sync_speed_min; 183 int sync_speed_min;
181 int sync_speed_max; 184 int sync_speed_max;
182 185
186 /* resync even though the same disks are shared among md-devices */
187 int parallel_resync;
188
183 int ok_start_degraded; 189 int ok_start_degraded;
184 /* recovery/resync flags 190 /* recovery/resync flags
185 * NEEDED: we might need to start a resync/recover 191 * NEEDED: we might need to start a resync/recover
186 * RUNNING: a thread is running, or about to be started 192 * RUNNING: a thread is running, or about to be started
187 * SYNC: actually doing a resync, not a recovery 193 * SYNC: actually doing a resync, not a recovery
188 * ERR: and IO error was detected - abort the resync/recovery 194 * RECOVER: doing recovery, or need to try it.
189 * INTR: someone requested a (clean) early abort. 195 * INTR: resync needs to be aborted for some reason
190 * DONE: thread is done and is waiting to be reaped 196 * DONE: thread is done and is waiting to be reaped
191 * REQUEST: user-space has requested a sync (used with SYNC) 197 * REQUEST: user-space has requested a sync (used with SYNC)
192 * CHECK: user-space request for for check-only, no repair 198 * CHECK: user-space request for for check-only, no repair
@@ -196,7 +202,7 @@ struct mddev_s
196 */ 202 */
197#define MD_RECOVERY_RUNNING 0 203#define MD_RECOVERY_RUNNING 0
198#define MD_RECOVERY_SYNC 1 204#define MD_RECOVERY_SYNC 1
199#define MD_RECOVERY_ERR 2 205#define MD_RECOVERY_RECOVER 2
200#define MD_RECOVERY_INTR 3 206#define MD_RECOVERY_INTR 3
201#define MD_RECOVERY_DONE 4 207#define MD_RECOVERY_DONE 4
202#define MD_RECOVERY_NEEDED 5 208#define MD_RECOVERY_NEEDED 5
@@ -209,7 +215,8 @@ struct mddev_s
209 215
210 int in_sync; /* know to not need resync */ 216 int in_sync; /* know to not need resync */
211 struct mutex reconfig_mutex; 217 struct mutex reconfig_mutex;
212 atomic_t active; 218 atomic_t active; /* general refcount */
219 atomic_t openers; /* number of active opens */
213 220
214 int changed; /* true if we might need to reread partition info */ 221 int changed; /* true if we might need to reread partition info */
215 int degraded; /* whether md should consider 222 int degraded; /* whether md should consider
@@ -226,6 +233,8 @@ struct mddev_s
226 atomic_t recovery_active; /* blocks scheduled, but not written */ 233 atomic_t recovery_active; /* blocks scheduled, but not written */
227 wait_queue_head_t recovery_wait; 234 wait_queue_head_t recovery_wait;
228 sector_t recovery_cp; 235 sector_t recovery_cp;
236 sector_t resync_min; /* user requested sync
237 * starts here */
229 sector_t resync_max; /* resync should pause 238 sector_t resync_max; /* resync should pause
230 * when it gets here */ 239 * when it gets here */
231 240
@@ -330,6 +339,9 @@ static inline char * mdname (mddev_t * mddev)
330#define rdev_for_each(rdev, tmp, mddev) \ 339#define rdev_for_each(rdev, tmp, mddev) \
331 rdev_for_each_list(rdev, tmp, (mddev)->disks) 340 rdev_for_each_list(rdev, tmp, (mddev)->disks)
332 341
342#define rdev_for_each_rcu(rdev, mddev) \
343 list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set)
344
333typedef struct mdk_thread_s { 345typedef struct mdk_thread_s {
334 void (*run) (mddev_t *mddev); 346 void (*run) (mddev_t *mddev);
335 mddev_t *mddev; 347 mddev_t *mddev;
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index 3f2cd98c508..8b4de4a41ff 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -43,14 +43,11 @@
43 */ 43 */
44#define MD_RESERVED_BYTES (64 * 1024) 44#define MD_RESERVED_BYTES (64 * 1024)
45#define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512) 45#define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512)
46#define MD_RESERVED_BLOCKS (MD_RESERVED_BYTES / BLOCK_SIZE)
47 46
48#define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS) 47#define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS)
49#define MD_NEW_SIZE_BLOCKS(x) ((x & ~(MD_RESERVED_BLOCKS - 1)) - MD_RESERVED_BLOCKS)
50 48
51#define MD_SB_BYTES 4096 49#define MD_SB_BYTES 4096
52#define MD_SB_WORDS (MD_SB_BYTES / 4) 50#define MD_SB_WORDS (MD_SB_BYTES / 4)
53#define MD_SB_BLOCKS (MD_SB_BYTES / BLOCK_SIZE)
54#define MD_SB_SECTORS (MD_SB_BYTES / 512) 51#define MD_SB_SECTORS (MD_SB_BYTES / 512)
55 52
56/* 53/*
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index f0827d31ae6..3b267279245 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -158,6 +158,43 @@
158 * the compute block completes. 158 * the compute block completes.
159 */ 159 */
160 160
161/*
162 * Operations state - intermediate states that are visible outside of sh->lock
163 * In general _idle indicates nothing is running, _run indicates a data
164 * processing operation is active, and _result means the data processing result
165 * is stable and can be acted upon. For simple operations like biofill and
166 * compute that only have an _idle and _run state they are indicated with
167 * sh->state flags (STRIPE_BIOFILL_RUN and STRIPE_COMPUTE_RUN)
168 */
169/**
170 * enum check_states - handles syncing / repairing a stripe
171 * @check_state_idle - check operations are quiesced
172 * @check_state_run - check operation is running
173 * @check_state_result - set outside lock when check result is valid
174 * @check_state_compute_run - check failed and we are repairing
175 * @check_state_compute_result - set outside lock when compute result is valid
176 */
177enum check_states {
178 check_state_idle = 0,
179 check_state_run, /* parity check */
180 check_state_check_result,
181 check_state_compute_run, /* parity repair */
182 check_state_compute_result,
183};
184
185/**
186 * enum reconstruct_states - handles writing or expanding a stripe
187 */
188enum reconstruct_states {
189 reconstruct_state_idle = 0,
190 reconstruct_state_prexor_drain_run, /* prexor-write */
191 reconstruct_state_drain_run, /* write */
192 reconstruct_state_run, /* expand */
193 reconstruct_state_prexor_drain_result,
194 reconstruct_state_drain_result,
195 reconstruct_state_result,
196};
197
161struct stripe_head { 198struct stripe_head {
162 struct hlist_node hash; 199 struct hlist_node hash;
163 struct list_head lru; /* inactive_list or handle_list */ 200 struct list_head lru; /* inactive_list or handle_list */
@@ -169,19 +206,13 @@ struct stripe_head {
169 spinlock_t lock; 206 spinlock_t lock;
170 int bm_seq; /* sequence number for bitmap flushes */ 207 int bm_seq; /* sequence number for bitmap flushes */
171 int disks; /* disks in stripe */ 208 int disks; /* disks in stripe */
209 enum check_states check_state;
210 enum reconstruct_states reconstruct_state;
172 /* stripe_operations 211 /* stripe_operations
173 * @pending - pending ops flags (set for request->issue->complete)
174 * @ack - submitted ops flags (set for issue->complete)
175 * @complete - completed ops flags (set for complete)
176 * @target - STRIPE_OP_COMPUTE_BLK target 212 * @target - STRIPE_OP_COMPUTE_BLK target
177 * @count - raid5_runs_ops is set to run when this is non-zero
178 */ 213 */
179 struct stripe_operations { 214 struct stripe_operations {
180 unsigned long pending;
181 unsigned long ack;
182 unsigned long complete;
183 int target; 215 int target;
184 int count;
185 u32 zero_sum_result; 216 u32 zero_sum_result;
186 } ops; 217 } ops;
187 struct r5dev { 218 struct r5dev {
@@ -202,6 +233,7 @@ struct stripe_head_state {
202 int locked, uptodate, to_read, to_write, failed, written; 233 int locked, uptodate, to_read, to_write, failed, written;
203 int to_fill, compute, req_compute, non_overwrite; 234 int to_fill, compute, req_compute, non_overwrite;
204 int failed_num; 235 int failed_num;
236 unsigned long ops_request;
205}; 237};
206 238
207/* r6_state - extra state data only relevant to r6 */ 239/* r6_state - extra state data only relevant to r6 */
@@ -228,9 +260,7 @@ struct r6_state {
228#define R5_Wantfill 12 /* dev->toread contains a bio that needs 260#define R5_Wantfill 12 /* dev->toread contains a bio that needs
229 * filling 261 * filling
230 */ 262 */
231#define R5_Wantprexor 13 /* distinguish blocks ready for rmw from 263#define R5_Wantdrain 13 /* dev->towrite needs to be drained */
232 * other "towrites"
233 */
234/* 264/*
235 * Write method 265 * Write method
236 */ 266 */
@@ -254,8 +284,10 @@ struct r6_state {
254#define STRIPE_EXPAND_READY 11 284#define STRIPE_EXPAND_READY 11
255#define STRIPE_IO_STARTED 12 /* do not count towards 'bypass_count' */ 285#define STRIPE_IO_STARTED 12 /* do not count towards 'bypass_count' */
256#define STRIPE_FULL_WRITE 13 /* all blocks are set to be overwritten */ 286#define STRIPE_FULL_WRITE 13 /* all blocks are set to be overwritten */
287#define STRIPE_BIOFILL_RUN 14
288#define STRIPE_COMPUTE_RUN 15
257/* 289/*
258 * Operations flags (in issue order) 290 * Operation request flags
259 */ 291 */
260#define STRIPE_OP_BIOFILL 0 292#define STRIPE_OP_BIOFILL 0
261#define STRIPE_OP_COMPUTE_BLK 1 293#define STRIPE_OP_COMPUTE_BLK 1
@@ -263,14 +295,6 @@ struct r6_state {
263#define STRIPE_OP_BIODRAIN 3 295#define STRIPE_OP_BIODRAIN 3
264#define STRIPE_OP_POSTXOR 4 296#define STRIPE_OP_POSTXOR 4
265#define STRIPE_OP_CHECK 5 297#define STRIPE_OP_CHECK 5
266#define STRIPE_OP_IO 6
267
268/* modifiers to the base operations
269 * STRIPE_OP_MOD_REPAIR_PD - compute the parity block and write it back
270 * STRIPE_OP_MOD_DMA_CHECK - parity is not corrupted by the check
271 */
272#define STRIPE_OP_MOD_REPAIR_PD 7
273#define STRIPE_OP_MOD_DMA_CHECK 8
274 298
275/* 299/*
276 * Plugging: 300 * Plugging:
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
new file mode 100644
index 00000000000..18a5b9ba9d4
--- /dev/null
+++ b/include/linux/ratelimit.h
@@ -0,0 +1,27 @@
1#ifndef _LINUX_RATELIMIT_H
2#define _LINUX_RATELIMIT_H
3#include <linux/param.h>
4
5#define DEFAULT_RATELIMIT_INTERVAL (5 * HZ)
6#define DEFAULT_RATELIMIT_BURST 10
7
8struct ratelimit_state {
9 int interval;
10 int burst;
11 int printed;
12 int missed;
13 unsigned long begin;
14};
15
16#define DEFINE_RATELIMIT_STATE(name, interval, burst) \
17 struct ratelimit_state name = {interval, burst,}
18
19extern int __ratelimit(struct ratelimit_state *rs);
20
21static inline int ratelimit(void)
22{
23 static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL,
24 DEFAULT_RATELIMIT_BURST);
25 return __ratelimit(&rs);
26}
27#endif
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h
index b3aa05baab8..8c774905dcf 100644
--- a/include/linux/rcuclassic.h
+++ b/include/linux/rcuclassic.h
@@ -151,7 +151,10 @@ extern struct lockdep_map rcu_lock_map;
151 151
152#define __synchronize_sched() synchronize_rcu() 152#define __synchronize_sched() synchronize_rcu()
153 153
154#define call_rcu_sched(head, func) call_rcu(head, func)
155
154extern void __rcu_init(void); 156extern void __rcu_init(void);
157#define rcu_init_sched() do { } while (0)
155extern void rcu_check_callbacks(int cpu, int user); 158extern void rcu_check_callbacks(int cpu, int user);
156extern void rcu_restart_cpu(int cpu); 159extern void rcu_restart_cpu(int cpu);
157 160
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
new file mode 100644
index 00000000000..eb4443c7e05
--- /dev/null
+++ b/include/linux/rculist.h
@@ -0,0 +1,401 @@
1#ifndef _LINUX_RCULIST_H
2#define _LINUX_RCULIST_H
3
4#ifdef __KERNEL__
5
6/*
7 * RCU-protected list version
8 */
9#include <linux/list.h>
10#include <linux/rcupdate.h>
11
12/*
13 * Insert a new entry between two known consecutive entries.
14 *
15 * This is only for internal list manipulation where we know
16 * the prev/next entries already!
17 */
18static inline void __list_add_rcu(struct list_head *new,
19 struct list_head *prev, struct list_head *next)
20{
21 new->next = next;
22 new->prev = prev;
23 rcu_assign_pointer(prev->next, new);
24 next->prev = new;
25}
26
27/**
28 * list_add_rcu - add a new entry to rcu-protected list
29 * @new: new entry to be added
30 * @head: list head to add it after
31 *
32 * Insert a new entry after the specified head.
33 * This is good for implementing stacks.
34 *
35 * The caller must take whatever precautions are necessary
36 * (such as holding appropriate locks) to avoid racing
37 * with another list-mutation primitive, such as list_add_rcu()
38 * or list_del_rcu(), running on this same list.
39 * However, it is perfectly legal to run concurrently with
40 * the _rcu list-traversal primitives, such as
41 * list_for_each_entry_rcu().
42 */
43static inline void list_add_rcu(struct list_head *new, struct list_head *head)
44{
45 __list_add_rcu(new, head, head->next);
46}
47
48/**
49 * list_add_tail_rcu - add a new entry to rcu-protected list
50 * @new: new entry to be added
51 * @head: list head to add it before
52 *
53 * Insert a new entry before the specified head.
54 * This is useful for implementing queues.
55 *
56 * The caller must take whatever precautions are necessary
57 * (such as holding appropriate locks) to avoid racing
58 * with another list-mutation primitive, such as list_add_tail_rcu()
59 * or list_del_rcu(), running on this same list.
60 * However, it is perfectly legal to run concurrently with
61 * the _rcu list-traversal primitives, such as
62 * list_for_each_entry_rcu().
63 */
64static inline void list_add_tail_rcu(struct list_head *new,
65 struct list_head *head)
66{
67 __list_add_rcu(new, head->prev, head);
68}
69
70/**
71 * list_del_rcu - deletes entry from list without re-initialization
72 * @entry: the element to delete from the list.
73 *
74 * Note: list_empty() on entry does not return true after this,
75 * the entry is in an undefined state. It is useful for RCU based
76 * lockfree traversal.
77 *
78 * In particular, it means that we can not poison the forward
79 * pointers that may still be used for walking the list.
80 *
81 * The caller must take whatever precautions are necessary
82 * (such as holding appropriate locks) to avoid racing
83 * with another list-mutation primitive, such as list_del_rcu()
84 * or list_add_rcu(), running on this same list.
85 * However, it is perfectly legal to run concurrently with
86 * the _rcu list-traversal primitives, such as
87 * list_for_each_entry_rcu().
88 *
89 * Note that the caller is not permitted to immediately free
90 * the newly deleted entry. Instead, either synchronize_rcu()
91 * or call_rcu() must be used to defer freeing until an RCU
92 * grace period has elapsed.
93 */
94static inline void list_del_rcu(struct list_head *entry)
95{
96 __list_del(entry->prev, entry->next);
97 entry->prev = LIST_POISON2;
98}
99
100/**
101 * hlist_del_init_rcu - deletes entry from hash list with re-initialization
102 * @n: the element to delete from the hash list.
103 *
104 * Note: list_unhashed() on the node return true after this. It is
105 * useful for RCU based read lockfree traversal if the writer side
106 * must know if the list entry is still hashed or already unhashed.
107 *
108 * In particular, it means that we can not poison the forward pointers
109 * that may still be used for walking the hash list and we can only
110 * zero the pprev pointer so list_unhashed() will return true after
111 * this.
112 *
113 * The caller must take whatever precautions are necessary (such as
114 * holding appropriate locks) to avoid racing with another
115 * list-mutation primitive, such as hlist_add_head_rcu() or
116 * hlist_del_rcu(), running on this same list. However, it is
117 * perfectly legal to run concurrently with the _rcu list-traversal
118 * primitives, such as hlist_for_each_entry_rcu().
119 */
120static inline void hlist_del_init_rcu(struct hlist_node *n)
121{
122 if (!hlist_unhashed(n)) {
123 __hlist_del(n);
124 n->pprev = NULL;
125 }
126}
127
128/**
129 * list_replace_rcu - replace old entry by new one
130 * @old : the element to be replaced
131 * @new : the new element to insert
132 *
133 * The @old entry will be replaced with the @new entry atomically.
134 * Note: @old should not be empty.
135 */
136static inline void list_replace_rcu(struct list_head *old,
137 struct list_head *new)
138{
139 new->next = old->next;
140 new->prev = old->prev;
141 rcu_assign_pointer(new->prev->next, new);
142 new->next->prev = new;
143 old->prev = LIST_POISON2;
144}
145
146/**
147 * list_splice_init_rcu - splice an RCU-protected list into an existing list.
148 * @list: the RCU-protected list to splice
149 * @head: the place in the list to splice the first list into
150 * @sync: function to sync: synchronize_rcu(), synchronize_sched(), ...
151 *
152 * @head can be RCU-read traversed concurrently with this function.
153 *
154 * Note that this function blocks.
155 *
156 * Important note: the caller must take whatever action is necessary to
157 * prevent any other updates to @head. In principle, it is possible
158 * to modify the list as soon as sync() begins execution.
159 * If this sort of thing becomes necessary, an alternative version
160 * based on call_rcu() could be created. But only if -really-
161 * needed -- there is no shortage of RCU API members.
162 */
163static inline void list_splice_init_rcu(struct list_head *list,
164 struct list_head *head,
165 void (*sync)(void))
166{
167 struct list_head *first = list->next;
168 struct list_head *last = list->prev;
169 struct list_head *at = head->next;
170
171 if (list_empty(head))
172 return;
173
174 /* "first" and "last" tracking list, so initialize it. */
175
176 INIT_LIST_HEAD(list);
177
178 /*
179 * At this point, the list body still points to the source list.
180 * Wait for any readers to finish using the list before splicing
181 * the list body into the new list. Any new readers will see
182 * an empty list.
183 */
184
185 sync();
186
187 /*
188 * Readers are finished with the source list, so perform splice.
189 * The order is important if the new list is global and accessible
190 * to concurrent RCU readers. Note that RCU readers are not
191 * permitted to traverse the prev pointers without excluding
192 * this function.
193 */
194
195 last->next = at;
196 rcu_assign_pointer(head->next, first);
197 first->prev = head;
198 at->prev = last;
199}
200
201/**
202 * list_for_each_rcu - iterate over an rcu-protected list
203 * @pos: the &struct list_head to use as a loop cursor.
204 * @head: the head for your list.
205 *
206 * This list-traversal primitive may safely run concurrently with
207 * the _rcu list-mutation primitives such as list_add_rcu()
208 * as long as the traversal is guarded by rcu_read_lock().
209 */
210#define list_for_each_rcu(pos, head) \
211 for (pos = rcu_dereference((head)->next); \
212 prefetch(pos->next), pos != (head); \
213 pos = rcu_dereference(pos->next))
214
215#define __list_for_each_rcu(pos, head) \
216 for (pos = rcu_dereference((head)->next); \
217 pos != (head); \
218 pos = rcu_dereference(pos->next))
219
220/**
221 * list_for_each_entry_rcu - iterate over rcu list of given type
222 * @pos: the type * to use as a loop cursor.
223 * @head: the head for your list.
224 * @member: the name of the list_struct within the struct.
225 *
226 * This list-traversal primitive may safely run concurrently with
227 * the _rcu list-mutation primitives such as list_add_rcu()
228 * as long as the traversal is guarded by rcu_read_lock().
229 */
230#define list_for_each_entry_rcu(pos, head, member) \
231 for (pos = list_entry(rcu_dereference((head)->next), typeof(*pos), member); \
232 prefetch(pos->member.next), &pos->member != (head); \
233 pos = list_entry(rcu_dereference(pos->member.next), typeof(*pos), member))
234
235
236/**
237 * list_for_each_continue_rcu
238 * @pos: the &struct list_head to use as a loop cursor.
239 * @head: the head for your list.
240 *
241 * Iterate over an rcu-protected list, continuing after current point.
242 *
243 * This list-traversal primitive may safely run concurrently with
244 * the _rcu list-mutation primitives such as list_add_rcu()
245 * as long as the traversal is guarded by rcu_read_lock().
246 */
247#define list_for_each_continue_rcu(pos, head) \
248 for ((pos) = rcu_dereference((pos)->next); \
249 prefetch((pos)->next), (pos) != (head); \
250 (pos) = rcu_dereference((pos)->next))
251
252/**
253 * hlist_del_rcu - deletes entry from hash list without re-initialization
254 * @n: the element to delete from the hash list.
255 *
256 * Note: list_unhashed() on entry does not return true after this,
257 * the entry is in an undefined state. It is useful for RCU based
258 * lockfree traversal.
259 *
260 * In particular, it means that we can not poison the forward
261 * pointers that may still be used for walking the hash list.
262 *
263 * The caller must take whatever precautions are necessary
264 * (such as holding appropriate locks) to avoid racing
265 * with another list-mutation primitive, such as hlist_add_head_rcu()
266 * or hlist_del_rcu(), running on this same list.
267 * However, it is perfectly legal to run concurrently with
268 * the _rcu list-traversal primitives, such as
269 * hlist_for_each_entry().
270 */
271static inline void hlist_del_rcu(struct hlist_node *n)
272{
273 __hlist_del(n);
274 n->pprev = LIST_POISON2;
275}
276
277/**
278 * hlist_replace_rcu - replace old entry by new one
279 * @old : the element to be replaced
280 * @new : the new element to insert
281 *
282 * The @old entry will be replaced with the @new entry atomically.
283 */
284static inline void hlist_replace_rcu(struct hlist_node *old,
285 struct hlist_node *new)
286{
287 struct hlist_node *next = old->next;
288
289 new->next = next;
290 new->pprev = old->pprev;
291 rcu_assign_pointer(*new->pprev, new);
292 if (next)
293 new->next->pprev = &new->next;
294 old->pprev = LIST_POISON2;
295}
296
297/**
298 * hlist_add_head_rcu
299 * @n: the element to add to the hash list.
300 * @h: the list to add to.
301 *
302 * Description:
303 * Adds the specified element to the specified hlist,
304 * while permitting racing traversals.
305 *
306 * The caller must take whatever precautions are necessary
307 * (such as holding appropriate locks) to avoid racing
308 * with another list-mutation primitive, such as hlist_add_head_rcu()
309 * or hlist_del_rcu(), running on this same list.
310 * However, it is perfectly legal to run concurrently with
311 * the _rcu list-traversal primitives, such as
312 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
313 * problems on Alpha CPUs. Regardless of the type of CPU, the
314 * list-traversal primitive must be guarded by rcu_read_lock().
315 */
316static inline void hlist_add_head_rcu(struct hlist_node *n,
317 struct hlist_head *h)
318{
319 struct hlist_node *first = h->first;
320
321 n->next = first;
322 n->pprev = &h->first;
323 rcu_assign_pointer(h->first, n);
324 if (first)
325 first->pprev = &n->next;
326}
327
328/**
329 * hlist_add_before_rcu
330 * @n: the new element to add to the hash list.
331 * @next: the existing element to add the new element before.
332 *
333 * Description:
334 * Adds the specified element to the specified hlist
335 * before the specified node while permitting racing traversals.
336 *
337 * The caller must take whatever precautions are necessary
338 * (such as holding appropriate locks) to avoid racing
339 * with another list-mutation primitive, such as hlist_add_head_rcu()
340 * or hlist_del_rcu(), running on this same list.
341 * However, it is perfectly legal to run concurrently with
342 * the _rcu list-traversal primitives, such as
343 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
344 * problems on Alpha CPUs.
345 */
346static inline void hlist_add_before_rcu(struct hlist_node *n,
347 struct hlist_node *next)
348{
349 n->pprev = next->pprev;
350 n->next = next;
351 rcu_assign_pointer(*(n->pprev), n);
352 next->pprev = &n->next;
353}
354
355/**
356 * hlist_add_after_rcu
357 * @prev: the existing element to add the new element after.
358 * @n: the new element to add to the hash list.
359 *
360 * Description:
361 * Adds the specified element to the specified hlist
362 * after the specified node while permitting racing traversals.
363 *
364 * The caller must take whatever precautions are necessary
365 * (such as holding appropriate locks) to avoid racing
366 * with another list-mutation primitive, such as hlist_add_head_rcu()
367 * or hlist_del_rcu(), running on this same list.
368 * However, it is perfectly legal to run concurrently with
369 * the _rcu list-traversal primitives, such as
370 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
371 * problems on Alpha CPUs.
372 */
373static inline void hlist_add_after_rcu(struct hlist_node *prev,
374 struct hlist_node *n)
375{
376 n->next = prev->next;
377 n->pprev = &prev->next;
378 rcu_assign_pointer(prev->next, n);
379 if (n->next)
380 n->next->pprev = &n->next;
381}
382
383/**
384 * hlist_for_each_entry_rcu - iterate over rcu list of given type
385 * @tpos: the type * to use as a loop cursor.
386 * @pos: the &struct hlist_node to use as a loop cursor.
387 * @head: the head for your list.
388 * @member: the name of the hlist_node within the struct.
389 *
390 * This list-traversal primitive may safely run concurrently with
391 * the _rcu list-mutation primitives such as hlist_add_head_rcu()
392 * as long as the traversal is guarded by rcu_read_lock().
393 */
394#define hlist_for_each_entry_rcu(tpos, pos, head, member) \
395 for (pos = rcu_dereference((head)->first); \
396 pos && ({ prefetch(pos->next); 1; }) && \
397 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
398 pos = rcu_dereference(pos->next))
399
400#endif /* __KERNEL__ */
401#endif
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 8082d6587a0..e8b4039cfb2 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -40,6 +40,7 @@
40#include <linux/cpumask.h> 40#include <linux/cpumask.h>
41#include <linux/seqlock.h> 41#include <linux/seqlock.h>
42#include <linux/lockdep.h> 42#include <linux/lockdep.h>
43#include <linux/completion.h>
43 44
44/** 45/**
45 * struct rcu_head - callback structure for use with RCU 46 * struct rcu_head - callback structure for use with RCU
@@ -131,18 +132,6 @@ struct rcu_head {
131 */ 132 */
132#define rcu_read_unlock_bh() __rcu_read_unlock_bh() 133#define rcu_read_unlock_bh() __rcu_read_unlock_bh()
133 134
134/*
135 * Prevent the compiler from merging or refetching accesses. The compiler
136 * is also forbidden from reordering successive instances of ACCESS_ONCE(),
137 * but only when the compiler is aware of some particular ordering. One way
138 * to make the compiler aware of ordering is to put the two invocations of
139 * ACCESS_ONCE() in different C statements.
140 *
141 * This macro does absolutely -nothing- to prevent the CPU from reordering,
142 * merging, or refetching absolutely anything at any time.
143 */
144#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
145
146/** 135/**
147 * rcu_dereference - fetch an RCU-protected pointer in an 136 * rcu_dereference - fetch an RCU-protected pointer in an
148 * RCU read-side critical section. This pointer may later 137 * RCU read-side critical section. This pointer may later
@@ -180,6 +169,27 @@ struct rcu_head {
180 (p) = (v); \ 169 (p) = (v); \
181 }) 170 })
182 171
172/* Infrastructure to implement the synchronize_() primitives. */
173
174struct rcu_synchronize {
175 struct rcu_head head;
176 struct completion completion;
177};
178
179extern void wakeme_after_rcu(struct rcu_head *head);
180
181#define synchronize_rcu_xxx(name, func) \
182void name(void) \
183{ \
184 struct rcu_synchronize rcu; \
185 \
186 init_completion(&rcu.completion); \
187 /* Will wake me after RCU finished. */ \
188 func(&rcu.head, wakeme_after_rcu); \
189 /* Wait for it. */ \
190 wait_for_completion(&rcu.completion); \
191}
192
183/** 193/**
184 * synchronize_sched - block until all CPUs have exited any non-preemptive 194 * synchronize_sched - block until all CPUs have exited any non-preemptive
185 * kernel code sequences. 195 * kernel code sequences.
@@ -236,8 +246,8 @@ extern void call_rcu_bh(struct rcu_head *head,
236/* Exported common interfaces */ 246/* Exported common interfaces */
237extern void synchronize_rcu(void); 247extern void synchronize_rcu(void);
238extern void rcu_barrier(void); 248extern void rcu_barrier(void);
239extern long rcu_batches_completed(void); 249extern void rcu_barrier_bh(void);
240extern long rcu_batches_completed_bh(void); 250extern void rcu_barrier_sched(void);
241 251
242/* Internal to kernel */ 252/* Internal to kernel */
243extern void rcu_init(void); 253extern void rcu_init(void);
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h
index 8a05c7e20bc..0967f03b070 100644
--- a/include/linux/rcupreempt.h
+++ b/include/linux/rcupreempt.h
@@ -40,10 +40,39 @@
40#include <linux/cpumask.h> 40#include <linux/cpumask.h>
41#include <linux/seqlock.h> 41#include <linux/seqlock.h>
42 42
43#define rcu_qsctr_inc(cpu) 43struct rcu_dyntick_sched {
44 int dynticks;
45 int dynticks_snap;
46 int sched_qs;
47 int sched_qs_snap;
48 int sched_dynticks_snap;
49};
50
51DECLARE_PER_CPU(struct rcu_dyntick_sched, rcu_dyntick_sched);
52
53static inline void rcu_qsctr_inc(int cpu)
54{
55 struct rcu_dyntick_sched *rdssp = &per_cpu(rcu_dyntick_sched, cpu);
56
57 rdssp->sched_qs++;
58}
44#define rcu_bh_qsctr_inc(cpu) 59#define rcu_bh_qsctr_inc(cpu)
45#define call_rcu_bh(head, rcu) call_rcu(head, rcu) 60#define call_rcu_bh(head, rcu) call_rcu(head, rcu)
46 61
62/**
63 * call_rcu_sched - Queue RCU callback for invocation after sched grace period.
64 * @head: structure to be used for queueing the RCU updates.
65 * @func: actual update function to be invoked after the grace period
66 *
67 * The update function will be invoked some time after a full
68 * synchronize_sched()-style grace period elapses, in other words after
69 * all currently executing preempt-disabled sections of code (including
70 * hardirq handlers, NMI handlers, and local_irq_save() blocks) have
71 * completed.
72 */
73extern void call_rcu_sched(struct rcu_head *head,
74 void (*func)(struct rcu_head *head));
75
47extern void __rcu_read_lock(void) __acquires(RCU); 76extern void __rcu_read_lock(void) __acquires(RCU);
48extern void __rcu_read_unlock(void) __releases(RCU); 77extern void __rcu_read_unlock(void) __releases(RCU);
49extern int rcu_pending(int cpu); 78extern int rcu_pending(int cpu);
@@ -55,6 +84,7 @@ extern int rcu_needs_cpu(int cpu);
55extern void __synchronize_sched(void); 84extern void __synchronize_sched(void);
56 85
57extern void __rcu_init(void); 86extern void __rcu_init(void);
87extern void rcu_init_sched(void);
58extern void rcu_check_callbacks(int cpu, int user); 88extern void rcu_check_callbacks(int cpu, int user);
59extern void rcu_restart_cpu(int cpu); 89extern void rcu_restart_cpu(int cpu);
60extern long rcu_batches_completed(void); 90extern long rcu_batches_completed(void);
@@ -81,20 +111,25 @@ extern struct rcupreempt_trace *rcupreempt_trace_cpu(int cpu);
81struct softirq_action; 111struct softirq_action;
82 112
83#ifdef CONFIG_NO_HZ 113#ifdef CONFIG_NO_HZ
84DECLARE_PER_CPU(long, dynticks_progress_counter); 114DECLARE_PER_CPU(struct rcu_dyntick_sched, rcu_dyntick_sched);
85 115
86static inline void rcu_enter_nohz(void) 116static inline void rcu_enter_nohz(void)
87{ 117{
118 static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1);
119
88 smp_mb(); /* CPUs seeing ++ must see prior RCU read-side crit sects */ 120 smp_mb(); /* CPUs seeing ++ must see prior RCU read-side crit sects */
89 __get_cpu_var(dynticks_progress_counter)++; 121 __get_cpu_var(rcu_dyntick_sched).dynticks++;
90 WARN_ON(__get_cpu_var(dynticks_progress_counter) & 0x1); 122 WARN_ON_RATELIMIT(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1, &rs);
91} 123}
92 124
93static inline void rcu_exit_nohz(void) 125static inline void rcu_exit_nohz(void)
94{ 126{
95 __get_cpu_var(dynticks_progress_counter)++; 127 static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1);
128
96 smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */ 129 smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */
97 WARN_ON(!(__get_cpu_var(dynticks_progress_counter) & 0x1)); 130 __get_cpu_var(rcu_dyntick_sched).dynticks++;
131 WARN_ON_RATELIMIT(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1),
132 &rs);
98} 133}
99 134
100#else /* CONFIG_NO_HZ */ 135#else /* CONFIG_NO_HZ */
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 4aacaeecb56..e9963af16cd 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -526,8 +526,8 @@ struct item_head {
526** p is the array of __u32, i is the index into the array, v is the value 526** p is the array of __u32, i is the index into the array, v is the value
527** to store there. 527** to store there.
528*/ 528*/
529#define get_block_num(p, i) le32_to_cpu(get_unaligned((p) + (i))) 529#define get_block_num(p, i) get_unaligned_le32((p) + (i))
530#define put_block_num(p, i, v) put_unaligned(cpu_to_le32(v), (p) + (i)) 530#define put_block_num(p, i, v) put_unaligned_le32((v), (p) + (i))
531 531
532// 532//
533// in old version uniqueness field shows key type 533// in old version uniqueness field shows key type
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index 336ee43ed7d..315517e8bfa 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -152,7 +152,7 @@ struct reiserfs_journal_list {
152 atomic_t j_nonzerolen; 152 atomic_t j_nonzerolen;
153 atomic_t j_commit_left; 153 atomic_t j_commit_left;
154 atomic_t j_older_commits_done; /* all commits older than this on disk */ 154 atomic_t j_older_commits_done; /* all commits older than this on disk */
155 struct semaphore j_commit_lock; 155 struct mutex j_commit_mutex;
156 unsigned long j_trans_id; 156 unsigned long j_trans_id;
157 time_t j_timestamp; 157 time_t j_timestamp;
158 struct reiserfs_list_bitmap *j_list_bitmap; 158 struct reiserfs_list_bitmap *j_list_bitmap;
@@ -193,8 +193,8 @@ struct reiserfs_journal {
193 struct buffer_head *j_header_bh; 193 struct buffer_head *j_header_bh;
194 194
195 time_t j_trans_start_time; /* time this transaction started */ 195 time_t j_trans_start_time; /* time this transaction started */
196 struct semaphore j_lock; 196 struct mutex j_mutex;
197 struct semaphore j_flush_sem; 197 struct mutex j_flush_mutex;
198 wait_queue_head_t j_join_wait; /* wait for current transaction to finish before starting new one */ 198 wait_queue_head_t j_join_wait; /* wait for current transaction to finish before starting new one */
199 atomic_t j_jlock; /* lock for j_join_wait */ 199 atomic_t j_jlock; /* lock for j_join_wait */
200 int j_list_bitmap_index; /* number of next list bitmap to use */ 200 int j_list_bitmap_index; /* number of next list bitmap to use */
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index 66a96814d61..af135ae895d 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -55,7 +55,7 @@ int reiserfs_removexattr(struct dentry *dentry, const char *name);
55int reiserfs_delete_xattrs(struct inode *inode); 55int reiserfs_delete_xattrs(struct inode *inode);
56int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs); 56int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
57int reiserfs_xattr_init(struct super_block *sb, int mount_flags); 57int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
58int reiserfs_permission(struct inode *inode, int mask, struct nameidata *nd); 58int reiserfs_permission(struct inode *inode, int mask);
59 59
60int reiserfs_xattr_del(struct inode *, const char *); 60int reiserfs_xattr_del(struct inode *, const char *);
61int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t); 61int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t);
diff --git a/include/linux/relay.h b/include/linux/relay.h
index 6cd8c4425fc..953fc055e87 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -48,6 +48,7 @@ struct rchan_buf
48 size_t *padding; /* padding counts per sub-buffer */ 48 size_t *padding; /* padding counts per sub-buffer */
49 size_t prev_padding; /* temporary variable */ 49 size_t prev_padding; /* temporary variable */
50 size_t bytes_consumed; /* bytes consumed in cur read subbuf */ 50 size_t bytes_consumed; /* bytes consumed in cur read subbuf */
51 size_t early_bytes; /* bytes consumed before VFS inited */
51 unsigned int cpu; /* this buf's cpu */ 52 unsigned int cpu; /* this buf's cpu */
52} ____cacheline_aligned; 53} ____cacheline_aligned;
53 54
@@ -68,6 +69,7 @@ struct rchan
68 int is_global; /* One global buffer ? */ 69 int is_global; /* One global buffer ? */
69 struct list_head list; /* for channel list */ 70 struct list_head list; /* for channel list */
70 struct dentry *parent; /* parent dentry passed to open */ 71 struct dentry *parent; /* parent dentry passed to open */
72 int has_base_filename; /* has a filename associated? */
71 char base_filename[NAME_MAX]; /* saved base filename */ 73 char base_filename[NAME_MAX]; /* saved base filename */
72}; 74};
73 75
@@ -169,6 +171,9 @@ struct rchan *relay_open(const char *base_filename,
169 size_t n_subbufs, 171 size_t n_subbufs,
170 struct rchan_callbacks *cb, 172 struct rchan_callbacks *cb,
171 void *private_data); 173 void *private_data);
174extern int relay_late_setup_files(struct rchan *chan,
175 const char *base_filename,
176 struct dentry *parent);
172extern void relay_close(struct rchan *chan); 177extern void relay_close(struct rchan *chan);
173extern void relay_flush(struct rchan *chan); 178extern void relay_flush(struct rchan *chan);
174extern void relay_subbufs_consumed(struct rchan *chan, 179extern void relay_subbufs_consumed(struct rchan *chan,
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 6d9e1fca098..fdeadd9740d 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -63,9 +63,14 @@ u64 res_counter_read_u64(struct res_counter *counter, int member);
63ssize_t res_counter_read(struct res_counter *counter, int member, 63ssize_t res_counter_read(struct res_counter *counter, int member,
64 const char __user *buf, size_t nbytes, loff_t *pos, 64 const char __user *buf, size_t nbytes, loff_t *pos,
65 int (*read_strategy)(unsigned long long val, char *s)); 65 int (*read_strategy)(unsigned long long val, char *s));
66ssize_t res_counter_write(struct res_counter *counter, int member, 66
67 const char __user *buf, size_t nbytes, loff_t *pos, 67typedef int (*write_strategy_fn)(const char *buf, unsigned long long *val);
68 int (*write_strategy)(char *buf, unsigned long long *val)); 68
69int res_counter_memparse_write_strategy(const char *buf,
70 unsigned long long *res);
71
72int res_counter_write(struct res_counter *counter, int member,
73 const char *buffer, write_strategy_fn write_strategy);
69 74
70/* 75/*
71 * the field descriptors. one for each member of res_counter 76 * the field descriptors. one for each member of res_counter
@@ -95,8 +100,10 @@ void res_counter_init(struct res_counter *counter);
95 * counter->limit _locked call expects the counter->lock to be taken 100 * counter->limit _locked call expects the counter->lock to be taken
96 */ 101 */
97 102
98int res_counter_charge_locked(struct res_counter *counter, unsigned long val); 103int __must_check res_counter_charge_locked(struct res_counter *counter,
99int res_counter_charge(struct res_counter *counter, unsigned long val); 104 unsigned long val);
105int __must_check res_counter_charge(struct res_counter *counter,
106 unsigned long val);
100 107
101/* 108/*
102 * uncharge - tell that some portion of the resource is released 109 * uncharge - tell that some portion of the resource is released
@@ -151,4 +158,20 @@ static inline void res_counter_reset_failcnt(struct res_counter *cnt)
151 cnt->failcnt = 0; 158 cnt->failcnt = 0;
152 spin_unlock_irqrestore(&cnt->lock, flags); 159 spin_unlock_irqrestore(&cnt->lock, flags);
153} 160}
161
162static inline int res_counter_set_limit(struct res_counter *cnt,
163 unsigned long long limit)
164{
165 unsigned long flags;
166 int ret = -EBUSY;
167
168 spin_lock_irqsave(&cnt->lock, flags);
169 if (cnt->usage < limit) {
170 cnt->limit = limit;
171 ret = 0;
172 }
173 spin_unlock_irqrestore(&cnt->lock, flags);
174 return ret;
175}
176
154#endif 177#endif
diff --git a/include/linux/resume-trace.h b/include/linux/resume-trace.h
index f3f4f28c696..c9ba2fdf807 100644
--- a/include/linux/resume-trace.h
+++ b/include/linux/resume-trace.h
@@ -8,7 +8,7 @@ extern int pm_trace_enabled;
8 8
9struct device; 9struct device;
10extern void set_trace_device(struct device *); 10extern void set_trace_device(struct device *);
11extern void generate_resume_trace(void *tracedata, unsigned int user); 11extern void generate_resume_trace(const void *tracedata, unsigned int user);
12 12
13#define TRACE_DEVICE(dev) do { \ 13#define TRACE_DEVICE(dev) do { \
14 if (pm_trace_enabled) \ 14 if (pm_trace_enabled) \
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index e3ab21d7fc7..c5f6e54ec6a 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -34,26 +34,37 @@
34 * RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. 34 * RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device.
35 * RFKILL_TYPE_UWB: switch is on a ultra wideband device. 35 * RFKILL_TYPE_UWB: switch is on a ultra wideband device.
36 * RFKILL_TYPE_WIMAX: switch is on a WiMAX device. 36 * RFKILL_TYPE_WIMAX: switch is on a WiMAX device.
37 * RFKILL_TYPE_WWAN: switch is on a wireless WAN device.
37 */ 38 */
38enum rfkill_type { 39enum rfkill_type {
39 RFKILL_TYPE_WLAN , 40 RFKILL_TYPE_WLAN ,
40 RFKILL_TYPE_BLUETOOTH, 41 RFKILL_TYPE_BLUETOOTH,
41 RFKILL_TYPE_UWB, 42 RFKILL_TYPE_UWB,
42 RFKILL_TYPE_WIMAX, 43 RFKILL_TYPE_WIMAX,
44 RFKILL_TYPE_WWAN,
43 RFKILL_TYPE_MAX, 45 RFKILL_TYPE_MAX,
44}; 46};
45 47
46enum rfkill_state { 48enum rfkill_state {
47 RFKILL_STATE_OFF = 0, 49 RFKILL_STATE_SOFT_BLOCKED = 0, /* Radio output blocked */
48 RFKILL_STATE_ON = 1, 50 RFKILL_STATE_UNBLOCKED = 1, /* Radio output allowed */
51 RFKILL_STATE_HARD_BLOCKED = 2, /* Output blocked, non-overrideable */
49}; 52};
50 53
54/*
55 * These are DEPRECATED, drivers using them should be verified to
56 * comply with the rfkill usage guidelines in Documentation/rfkill.txt
57 * and then converted to use the new names for rfkill_state
58 */
59#define RFKILL_STATE_OFF RFKILL_STATE_SOFT_BLOCKED
60#define RFKILL_STATE_ON RFKILL_STATE_UNBLOCKED
61
51/** 62/**
52 * struct rfkill - rfkill control structure. 63 * struct rfkill - rfkill control structure.
53 * @name: Name of the switch. 64 * @name: Name of the switch.
54 * @type: Radio type which the button controls, the value stored 65 * @type: Radio type which the button controls, the value stored
55 * here should be a value from enum rfkill_type. 66 * here should be a value from enum rfkill_type.
56 * @state: State of the switch (on/off). 67 * @state: State of the switch, "UNBLOCKED" means radio can operate.
57 * @user_claim_unsupported: Whether the hardware supports exclusive 68 * @user_claim_unsupported: Whether the hardware supports exclusive
58 * RF-kill control by userspace. Set this before registering. 69 * RF-kill control by userspace. Set this before registering.
59 * @user_claim: Set when the switch is controlled exlusively by userspace. 70 * @user_claim: Set when the switch is controlled exlusively by userspace.
@@ -61,6 +72,12 @@ enum rfkill_state {
61 * @data: Pointer to the RF button drivers private data which will be 72 * @data: Pointer to the RF button drivers private data which will be
62 * passed along when toggling radio state. 73 * passed along when toggling radio state.
63 * @toggle_radio(): Mandatory handler to control state of the radio. 74 * @toggle_radio(): Mandatory handler to control state of the radio.
75 * only RFKILL_STATE_SOFT_BLOCKED and RFKILL_STATE_UNBLOCKED are
76 * valid parameters.
77 * @get_state(): handler to read current radio state from hardware,
78 * may be called from atomic context, should return 0 on success.
79 * Either this handler OR judicious use of rfkill_force_state() is
80 * MANDATORY for any driver capable of RFKILL_STATE_HARD_BLOCKED.
64 * @led_trigger: A LED trigger for this button's LED. 81 * @led_trigger: A LED trigger for this button's LED.
65 * @dev: Device structure integrating the switch into device tree. 82 * @dev: Device structure integrating the switch into device tree.
66 * @node: Used to place switch into list of all switches known to the 83 * @node: Used to place switch into list of all switches known to the
@@ -80,6 +97,7 @@ struct rfkill {
80 97
81 void *data; 98 void *data;
82 int (*toggle_radio)(void *data, enum rfkill_state state); 99 int (*toggle_radio)(void *data, enum rfkill_state state);
100 int (*get_state)(void *data, enum rfkill_state *state);
83 101
84#ifdef CONFIG_RFKILL_LEDS 102#ifdef CONFIG_RFKILL_LEDS
85 struct led_trigger led_trigger; 103 struct led_trigger led_trigger;
@@ -95,6 +113,21 @@ void rfkill_free(struct rfkill *rfkill);
95int rfkill_register(struct rfkill *rfkill); 113int rfkill_register(struct rfkill *rfkill);
96void rfkill_unregister(struct rfkill *rfkill); 114void rfkill_unregister(struct rfkill *rfkill);
97 115
116int rfkill_force_state(struct rfkill *rfkill, enum rfkill_state state);
117
118/**
119 * rfkill_state_complement - return complementar state
120 * @state: state to return the complement of
121 *
122 * Returns RFKILL_STATE_SOFT_BLOCKED if @state is RFKILL_STATE_UNBLOCKED,
123 * returns RFKILL_STATE_UNBLOCKED otherwise.
124 */
125static inline enum rfkill_state rfkill_state_complement(enum rfkill_state state)
126{
127 return (state == RFKILL_STATE_UNBLOCKED) ?
128 RFKILL_STATE_SOFT_BLOCKED : RFKILL_STATE_UNBLOCKED;
129}
130
98/** 131/**
99 * rfkill_get_led_name - Get the LED trigger name for the button's LED. 132 * rfkill_get_led_name - Get the LED trigger name for the button's LED.
100 * This function might return a NULL pointer if registering of the 133 * This function might return a NULL pointer if registering of the
@@ -110,4 +143,11 @@ static inline char *rfkill_get_led_name(struct rfkill *rfkill)
110#endif 143#endif
111} 144}
112 145
146/* rfkill notification chain */
147#define RFKILL_STATE_CHANGED 0x0001 /* state of a normal rfkill
148 switch has changed */
149
150int register_rfkill_notifier(struct notifier_block *nb);
151int unregister_rfkill_notifier(struct notifier_block *nb);
152
113#endif /* RFKILL_H */ 153#endif /* RFKILL_H */
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 1383692ac5b..69407f85e10 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -26,6 +26,14 @@
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 /*
30 * NOTE: the LSB of the head.next is set by
31 * mm_take_all_locks() _after_ taking the above lock. So the
32 * head must only be read/written after taking the above lock
33 * to be sure to see a valid next pointer. The LSB bit itself
34 * is serialized by a system wide lock only visible to
35 * mm_take_all_locks() (mm_all_locks_mutex).
36 */
29 struct list_head head; /* List of private "related" vmas */ 37 struct list_head head; /* List of private "related" vmas */
30}; 38};
31 39
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index f2d0d152772..91f597ad6ac 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -115,6 +115,23 @@ extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm);
115 115
116extern struct class *rtc_class; 116extern struct class *rtc_class;
117 117
118/*
119 * For these RTC methods the device parameter is the physical device
120 * on whatever bus holds the hardware (I2C, Platform, SPI, etc), which
121 * was passed to rtc_device_register(). Its driver_data normally holds
122 * device state, including the rtc_device pointer for the RTC.
123 *
124 * Most of these methods are called with rtc_device.ops_lock held,
125 * through the rtc_*(struct rtc_device *, ...) calls.
126 *
127 * The (current) exceptions are mostly filesystem hooks:
128 * - the proc() hook for procfs
129 * - non-ioctl() chardev hooks: open(), release(), read_callback()
130 * - periodic irq calls: irq_set_state(), irq_set_freq()
131 *
132 * REVISIT those periodic irq calls *do* have ops_lock when they're
133 * issued through ioctl() ...
134 */
118struct rtc_class_ops { 135struct rtc_class_ops {
119 int (*open)(struct device *); 136 int (*open)(struct device *);
120 void (*release)(struct device *); 137 void (*release)(struct device *);
@@ -208,8 +225,6 @@ typedef struct rtc_task {
208int rtc_register(rtc_task_t *task); 225int rtc_register(rtc_task_t *task);
209int rtc_unregister(rtc_task_t *task); 226int rtc_unregister(rtc_task_t *task);
210int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg); 227int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg);
211void rtc_get_rtc_time(struct rtc_time *rtc_tm);
212irqreturn_t rtc_interrupt(int irq, void *dev_id);
213 228
214#endif /* __KERNEL__ */ 229#endif /* __KERNEL__ */
215 230
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 44c81c74453..ca643b13b02 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -246,6 +246,7 @@ enum rt_class_t
246{ 246{
247 RT_TABLE_UNSPEC=0, 247 RT_TABLE_UNSPEC=0,
248/* User defined values */ 248/* User defined values */
249 RT_TABLE_COMPAT=252,
249 RT_TABLE_DEFAULT=253, 250 RT_TABLE_DEFAULT=253,
250 RT_TABLE_MAIN=254, 251 RT_TABLE_MAIN=254,
251 RT_TABLE_LOCAL=255, 252 RT_TABLE_LOCAL=255,
@@ -267,10 +268,10 @@ enum rtattr_type_t
267 RTA_PREFSRC, 268 RTA_PREFSRC,
268 RTA_METRICS, 269 RTA_METRICS,
269 RTA_MULTIPATH, 270 RTA_MULTIPATH,
270 RTA_PROTOINFO, 271 RTA_PROTOINFO, /* no longer used */
271 RTA_FLOW, 272 RTA_FLOW,
272 RTA_CACHEINFO, 273 RTA_CACHEINFO,
273 RTA_SESSION, 274 RTA_SESSION, /* no longer used */
274 RTA_MP_ALGO, /* no longer used */ 275 RTA_MP_ALGO, /* no longer used */
275 RTA_TABLE, 276 RTA_TABLE,
276 __RTA_MAX 277 __RTA_MAX
@@ -481,6 +482,7 @@ enum
481 TCA_RATE, 482 TCA_RATE,
482 TCA_FCNT, 483 TCA_FCNT,
483 TCA_STATS2, 484 TCA_STATS2,
485 TCA_STAB,
484 __TCA_MAX 486 __TCA_MAX
485}; 487};
486 488
@@ -753,13 +755,6 @@ extern void __rtnl_unlock(void);
753 } \ 755 } \
754} while(0) 756} while(0)
755 757
756#define BUG_TRAP(x) do { \
757 if (unlikely(!(x))) { \
758 printk(KERN_ERR "KERNEL: assertion (%s) failed at %s (%d)\n", \
759 #x, __FILE__ , __LINE__); \
760 } \
761} while(0)
762
763static inline u32 rtm_get_table(struct rtattr **rta, u8 table) 758static inline u32 rtm_get_table(struct rtattr **rta, u8 table)
764{ 759{
765 return RTA_GET_U32(rta[RTA_TABLE-1]); 760 return RTA_GET_U32(rta[RTA_TABLE-1]);
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 71fc8136004..e5996984ddd 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -224,4 +224,42 @@ size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents,
224 */ 224 */
225#define SG_MAX_SINGLE_ALLOC (PAGE_SIZE / sizeof(struct scatterlist)) 225#define SG_MAX_SINGLE_ALLOC (PAGE_SIZE / sizeof(struct scatterlist))
226 226
227
228/*
229 * Mapping sg iterator
230 *
231 * Iterates over sg entries mapping page-by-page. On each successful
232 * iteration, @miter->page points to the mapped page and
233 * @miter->length bytes of data can be accessed at @miter->addr. As
234 * long as an interation is enclosed between start and stop, the user
235 * is free to choose control structure and when to stop.
236 *
237 * @miter->consumed is set to @miter->length on each iteration. It
238 * can be adjusted if the user can't consume all the bytes in one go.
239 * Also, a stopped iteration can be resumed by calling next on it.
240 * This is useful when iteration needs to release all resources and
241 * continue later (e.g. at the next interrupt).
242 */
243
244#define SG_MITER_ATOMIC (1 << 0) /* use kmap_atomic */
245
246struct sg_mapping_iter {
247 /* the following three fields can be accessed directly */
248 struct page *page; /* currently mapped page */
249 void *addr; /* pointer to the mapped area */
250 size_t length; /* length of the mapped area */
251 size_t consumed; /* number of consumed bytes */
252
253 /* these are internal states, keep away */
254 struct scatterlist *__sg; /* current entry */
255 unsigned int __nents; /* nr of remaining entries */
256 unsigned int __offset; /* offset within sg */
257 unsigned int __flags;
258};
259
260void sg_miter_start(struct sg_mapping_iter *miter, struct scatterlist *sgl,
261 unsigned int nents, unsigned int flags);
262bool sg_miter_next(struct sg_mapping_iter *miter);
263void sg_miter_stop(struct sg_mapping_iter *miter);
264
227#endif /* _LINUX_SCATTERLIST_H */ 265#endif /* _LINUX_SCATTERLIST_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 03c238088ae..5270d449ff9 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -134,7 +134,6 @@ extern unsigned long nr_running(void);
134extern unsigned long nr_uninterruptible(void); 134extern unsigned long nr_uninterruptible(void);
135extern unsigned long nr_active(void); 135extern unsigned long nr_active(void);
136extern unsigned long nr_iowait(void); 136extern unsigned long nr_iowait(void);
137extern unsigned long weighted_cpuload(const int cpu);
138 137
139struct seq_file; 138struct seq_file;
140struct cfs_rq; 139struct cfs_rq;
@@ -158,6 +157,8 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
158} 157}
159#endif 158#endif
160 159
160extern unsigned long long time_sync_thresh;
161
161/* 162/*
162 * Task state bitmask. NOTE! These bits are also 163 * Task state bitmask. NOTE! These bits are also
163 * encoded in fs/proc/array.c: get_task_state(). 164 * encoded in fs/proc/array.c: get_task_state().
@@ -244,6 +245,8 @@ extern asmlinkage void schedule_tail(struct task_struct *prev);
244extern void init_idle(struct task_struct *idle, int cpu); 245extern void init_idle(struct task_struct *idle, int cpu);
245extern void init_idle_bootup_task(struct task_struct *idle); 246extern void init_idle_bootup_task(struct task_struct *idle);
246 247
248extern int runqueue_is_locked(void);
249
247extern cpumask_t nohz_cpu_mask; 250extern cpumask_t nohz_cpu_mask;
248#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) 251#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
249extern int select_nohz_load_balancer(int cpu); 252extern int select_nohz_load_balancer(int cpu);
@@ -289,13 +292,13 @@ extern void sched_show_task(struct task_struct *p);
289 292
290#ifdef CONFIG_DETECT_SOFTLOCKUP 293#ifdef CONFIG_DETECT_SOFTLOCKUP
291extern void softlockup_tick(void); 294extern void softlockup_tick(void);
292extern void spawn_softlockup_task(void);
293extern void touch_softlockup_watchdog(void); 295extern void touch_softlockup_watchdog(void);
294extern void touch_all_softlockup_watchdogs(void); 296extern void touch_all_softlockup_watchdogs(void);
295extern unsigned long softlockup_thresh; 297extern unsigned int softlockup_panic;
296extern unsigned long sysctl_hung_task_check_count; 298extern unsigned long sysctl_hung_task_check_count;
297extern unsigned long sysctl_hung_task_timeout_secs; 299extern unsigned long sysctl_hung_task_timeout_secs;
298extern unsigned long sysctl_hung_task_warnings; 300extern unsigned long sysctl_hung_task_warnings;
301extern int softlockup_thresh;
299#else 302#else
300static inline void softlockup_tick(void) 303static inline void softlockup_tick(void)
301{ 304{
@@ -502,6 +505,7 @@ struct signal_struct {
502 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; 505 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
503 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; 506 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
504 unsigned long inblock, oublock, cinblock, coublock; 507 unsigned long inblock, oublock, cinblock, coublock;
508 struct task_io_accounting ioac;
505 509
506 /* 510 /*
507 * Cumulative ns of scheduled CPU time for dead threads in the 511 * Cumulative ns of scheduled CPU time for dead threads in the
@@ -664,6 +668,10 @@ struct task_delay_info {
664 /* io operations performed */ 668 /* io operations performed */
665 u32 swapin_count; /* total count of the number of swapin block */ 669 u32 swapin_count; /* total count of the number of swapin block */
666 /* io operations performed */ 670 /* io operations performed */
671
672 struct timespec freepages_start, freepages_end;
673 u64 freepages_delay; /* wait for memory reclaim */
674 u32 freepages_count; /* total count of memory reclaim */
667}; 675};
668#endif /* CONFIG_TASK_DELAY_ACCT */ 676#endif /* CONFIG_TASK_DELAY_ACCT */
669 677
@@ -764,7 +772,6 @@ struct sched_domain {
764 struct sched_domain *child; /* bottom domain must be null terminated */ 772 struct sched_domain *child; /* bottom domain must be null terminated */
765 struct sched_group *groups; /* the balancing groups of the domain */ 773 struct sched_group *groups; /* the balancing groups of the domain */
766 cpumask_t span; /* span of all CPUs in this domain */ 774 cpumask_t span; /* span of all CPUs in this domain */
767 int first_cpu; /* cache of the first cpu in this domain */
768 unsigned long min_interval; /* Minimum balance interval ms */ 775 unsigned long min_interval; /* Minimum balance interval ms */
769 unsigned long max_interval; /* Maximum balance interval ms */ 776 unsigned long max_interval; /* Maximum balance interval ms */
770 unsigned int busy_factor; /* less balancing by factor if busy */ 777 unsigned int busy_factor; /* less balancing by factor if busy */
@@ -783,6 +790,8 @@ struct sched_domain {
783 unsigned int balance_interval; /* initialise to 1. units in ms. */ 790 unsigned int balance_interval; /* initialise to 1. units in ms. */
784 unsigned int nr_balance_failed; /* initialise to 0 */ 791 unsigned int nr_balance_failed; /* initialise to 0 */
785 792
793 u64 last_update;
794
786#ifdef CONFIG_SCHEDSTATS 795#ifdef CONFIG_SCHEDSTATS
787 /* load_balance() stats */ 796 /* load_balance() stats */
788 unsigned int lb_count[CPU_MAX_IDLE_TYPES]; 797 unsigned int lb_count[CPU_MAX_IDLE_TYPES];
@@ -820,24 +829,16 @@ extern void partition_sched_domains(int ndoms_new, cpumask_t *doms_new,
820 struct sched_domain_attr *dattr_new); 829 struct sched_domain_attr *dattr_new);
821extern int arch_reinit_sched_domains(void); 830extern int arch_reinit_sched_domains(void);
822 831
823#endif /* CONFIG_SMP */ 832#else /* CONFIG_SMP */
824 833
825/* 834struct sched_domain_attr;
826 * A runqueue laden with a single nice 0 task scores a weighted_cpuload of
827 * SCHED_LOAD_SCALE. This function returns 1 if any cpu is laden with a
828 * task of nice 0 or enough lower priority tasks to bring up the
829 * weighted_cpuload
830 */
831static inline int above_background_load(void)
832{
833 unsigned long cpu;
834 835
835 for_each_online_cpu(cpu) { 836static inline void
836 if (weighted_cpuload(cpu) >= SCHED_LOAD_SCALE) 837partition_sched_domains(int ndoms_new, cpumask_t *doms_new,
837 return 1; 838 struct sched_domain_attr *dattr_new)
838 } 839{
839 return 0;
840} 840}
841#endif /* !CONFIG_SMP */
841 842
842struct io_context; /* See blkdev.h */ 843struct io_context; /* See blkdev.h */
843#define NGROUPS_SMALL 32 844#define NGROUPS_SMALL 32
@@ -920,8 +921,8 @@ struct sched_class {
920 void (*set_cpus_allowed)(struct task_struct *p, 921 void (*set_cpus_allowed)(struct task_struct *p,
921 const cpumask_t *newmask); 922 const cpumask_t *newmask);
922 923
923 void (*join_domain)(struct rq *rq); 924 void (*rq_online)(struct rq *rq);
924 void (*leave_domain)(struct rq *rq); 925 void (*rq_offline)(struct rq *rq);
925 926
926 void (*switched_from) (struct rq *this_rq, struct task_struct *task, 927 void (*switched_from) (struct rq *this_rq, struct task_struct *task,
927 int running); 928 int running);
@@ -1038,6 +1039,7 @@ struct task_struct {
1038#endif 1039#endif
1039 1040
1040 int prio, static_prio, normal_prio; 1041 int prio, static_prio, normal_prio;
1042 unsigned int rt_priority;
1041 const struct sched_class *sched_class; 1043 const struct sched_class *sched_class;
1042 struct sched_entity se; 1044 struct sched_entity se;
1043 struct sched_rt_entity rt; 1045 struct sched_rt_entity rt;
@@ -1074,12 +1076,6 @@ struct task_struct {
1074#endif 1076#endif
1075 1077
1076 struct list_head tasks; 1078 struct list_head tasks;
1077 /*
1078 * ptrace_list/ptrace_children forms the list of my children
1079 * that were stolen by a ptracer.
1080 */
1081 struct list_head ptrace_children;
1082 struct list_head ptrace_list;
1083 1079
1084 struct mm_struct *mm, *active_mm; 1080 struct mm_struct *mm, *active_mm;
1085 1081
@@ -1101,18 +1097,25 @@ struct task_struct {
1101 /* 1097 /*
1102 * pointers to (original) parent process, youngest child, younger sibling, 1098 * pointers to (original) parent process, youngest child, younger sibling,
1103 * older sibling, respectively. (p->father can be replaced with 1099 * older sibling, respectively. (p->father can be replaced with
1104 * p->parent->pid) 1100 * p->real_parent->pid)
1105 */ 1101 */
1106 struct task_struct *real_parent; /* real parent process (when being debugged) */ 1102 struct task_struct *real_parent; /* real parent process */
1107 struct task_struct *parent; /* parent process */ 1103 struct task_struct *parent; /* recipient of SIGCHLD, wait4() reports */
1108 /* 1104 /*
1109 * children/sibling forms the list of my children plus the 1105 * children/sibling forms the list of my natural children
1110 * tasks I'm ptracing.
1111 */ 1106 */
1112 struct list_head children; /* list of my children */ 1107 struct list_head children; /* list of my children */
1113 struct list_head sibling; /* linkage in my parent's children list */ 1108 struct list_head sibling; /* linkage in my parent's children list */
1114 struct task_struct *group_leader; /* threadgroup leader */ 1109 struct task_struct *group_leader; /* threadgroup leader */
1115 1110
1111 /*
1112 * ptraced is the list of tasks this task is using ptrace on.
1113 * This includes both natural children and PTRACE_ATTACH targets.
1114 * p->ptrace_entry is p's link on the p->parent->ptraced list.
1115 */
1116 struct list_head ptraced;
1117 struct list_head ptrace_entry;
1118
1116 /* PID/PID hash table linkage. */ 1119 /* PID/PID hash table linkage. */
1117 struct pid_link pids[PIDTYPE_MAX]; 1120 struct pid_link pids[PIDTYPE_MAX];
1118 struct list_head thread_group; 1121 struct list_head thread_group;
@@ -1121,7 +1124,6 @@ struct task_struct {
1121 int __user *set_child_tid; /* CLONE_CHILD_SETTID */ 1124 int __user *set_child_tid; /* CLONE_CHILD_SETTID */
1122 int __user *clear_child_tid; /* CLONE_CHILD_CLEARTID */ 1125 int __user *clear_child_tid; /* CLONE_CHILD_CLEARTID */
1123 1126
1124 unsigned int rt_priority;
1125 cputime_t utime, stime, utimescaled, stimescaled; 1127 cputime_t utime, stime, utimescaled, stimescaled;
1126 cputime_t gtime; 1128 cputime_t gtime;
1127 cputime_t prev_utime, prev_stime; 1129 cputime_t prev_utime, prev_stime;
@@ -1140,12 +1142,12 @@ struct task_struct {
1140 gid_t gid,egid,sgid,fsgid; 1142 gid_t gid,egid,sgid,fsgid;
1141 struct group_info *group_info; 1143 struct group_info *group_info;
1142 kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset; 1144 kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset;
1143 unsigned securebits;
1144 struct user_struct *user; 1145 struct user_struct *user;
1146 unsigned securebits;
1145#ifdef CONFIG_KEYS 1147#ifdef CONFIG_KEYS
1148 unsigned char jit_keyring; /* default keyring to attach requested keys to */
1146 struct key *request_key_auth; /* assumed request_key authority */ 1149 struct key *request_key_auth; /* assumed request_key authority */
1147 struct key *thread_keyring; /* keyring private to this thread */ 1150 struct key *thread_keyring; /* keyring private to this thread */
1148 unsigned char jit_keyring; /* default keyring to attach requested keys to */
1149#endif 1151#endif
1150 char comm[TASK_COMM_LEN]; /* executable name excluding path 1152 char comm[TASK_COMM_LEN]; /* executable name excluding path
1151 - access with [gs]et_task_comm (which lock 1153 - access with [gs]et_task_comm (which lock
@@ -1232,8 +1234,8 @@ struct task_struct {
1232# define MAX_LOCK_DEPTH 48UL 1234# define MAX_LOCK_DEPTH 48UL
1233 u64 curr_chain_key; 1235 u64 curr_chain_key;
1234 int lockdep_depth; 1236 int lockdep_depth;
1235 struct held_lock held_locks[MAX_LOCK_DEPTH];
1236 unsigned int lockdep_recursion; 1237 unsigned int lockdep_recursion;
1238 struct held_lock held_locks[MAX_LOCK_DEPTH];
1237#endif 1239#endif
1238 1240
1239/* journalling filesystem info */ 1241/* journalling filesystem info */
@@ -1251,19 +1253,11 @@ struct task_struct {
1251 1253
1252 unsigned long ptrace_message; 1254 unsigned long ptrace_message;
1253 siginfo_t *last_siginfo; /* For ptrace use. */ 1255 siginfo_t *last_siginfo; /* For ptrace use. */
1254#ifdef CONFIG_TASK_XACCT
1255/* i/o counters(bytes read/written, #syscalls */
1256 u64 rchar, wchar, syscr, syscw;
1257#endif
1258 struct task_io_accounting ioac; 1256 struct task_io_accounting ioac;
1259#if defined(CONFIG_TASK_XACCT) 1257#if defined(CONFIG_TASK_XACCT)
1260 u64 acct_rss_mem1; /* accumulated rss usage */ 1258 u64 acct_rss_mem1; /* accumulated rss usage */
1261 u64 acct_vm_mem1; /* accumulated virtual memory usage */ 1259 u64 acct_vm_mem1; /* accumulated virtual memory usage */
1262 cputime_t acct_stimexpd;/* stime since last update */ 1260 cputime_t acct_timexpd; /* stime + utime since last update */
1263#endif
1264#ifdef CONFIG_NUMA
1265 struct mempolicy *mempolicy;
1266 short il_next;
1267#endif 1261#endif
1268#ifdef CONFIG_CPUSETS 1262#ifdef CONFIG_CPUSETS
1269 nodemask_t mems_allowed; 1263 nodemask_t mems_allowed;
@@ -1284,6 +1278,10 @@ struct task_struct {
1284 struct list_head pi_state_list; 1278 struct list_head pi_state_list;
1285 struct futex_pi_state *pi_state_cache; 1279 struct futex_pi_state *pi_state_cache;
1286#endif 1280#endif
1281#ifdef CONFIG_NUMA
1282 struct mempolicy *mempolicy;
1283 short il_next;
1284#endif
1287 atomic_t fs_excl; /* holding fs exclusive resources */ 1285 atomic_t fs_excl; /* holding fs exclusive resources */
1288 struct rcu_head rcu; 1286 struct rcu_head rcu;
1289 1287
@@ -1498,14 +1496,16 @@ static inline void put_task_struct(struct task_struct *t)
1498#define PF_KSWAPD 0x00040000 /* I am kswapd */ 1496#define PF_KSWAPD 0x00040000 /* I am kswapd */
1499#define PF_SWAPOFF 0x00080000 /* I am in swapoff */ 1497#define PF_SWAPOFF 0x00080000 /* I am in swapoff */
1500#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */ 1498#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */
1501#define PF_BORROWED_MM 0x00200000 /* I am a kthread doing use_mm */ 1499#define PF_KTHREAD 0x00200000 /* I am a kernel thread */
1502#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */ 1500#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */
1503#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ 1501#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */
1504#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ 1502#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */
1505#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ 1503#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */
1504#define PF_THREAD_BOUND 0x04000000 /* Thread bound to specific cpu */
1506#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1505#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1507#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1506#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1508#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */ 1507#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */
1508#define PF_FREEZER_NOSIG 0x80000000 /* Freezer won't send signals to it */
1509 1509
1510/* 1510/*
1511 * Only the _current_ task can read/write to tsk->flags, but other 1511 * Only the _current_ task can read/write to tsk->flags, but other
@@ -1551,6 +1551,50 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1551 1551
1552extern unsigned long long sched_clock(void); 1552extern unsigned long long sched_clock(void);
1553 1553
1554#ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
1555static inline void sched_clock_init(void)
1556{
1557}
1558
1559static inline u64 sched_clock_cpu(int cpu)
1560{
1561 return sched_clock();
1562}
1563
1564static inline void sched_clock_tick(void)
1565{
1566}
1567
1568static inline void sched_clock_idle_sleep_event(void)
1569{
1570}
1571
1572static inline void sched_clock_idle_wakeup_event(u64 delta_ns)
1573{
1574}
1575
1576#ifdef CONFIG_NO_HZ
1577static inline void sched_clock_tick_stop(int cpu)
1578{
1579}
1580
1581static inline void sched_clock_tick_start(int cpu)
1582{
1583}
1584#endif
1585
1586#else /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */
1587extern void sched_clock_init(void);
1588extern u64 sched_clock_cpu(int cpu);
1589extern void sched_clock_tick(void);
1590extern void sched_clock_idle_sleep_event(void);
1591extern void sched_clock_idle_wakeup_event(u64 delta_ns);
1592#ifdef CONFIG_NO_HZ
1593extern void sched_clock_tick_stop(int cpu);
1594extern void sched_clock_tick_start(int cpu);
1595#endif
1596#endif /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */
1597
1554/* 1598/*
1555 * For kernel-internal use: high-speed (but slightly incorrect) per-cpu 1599 * For kernel-internal use: high-speed (but slightly incorrect) per-cpu
1556 * clock constructed from sched_clock(): 1600 * clock constructed from sched_clock():
@@ -1592,6 +1636,7 @@ extern unsigned int sysctl_sched_child_runs_first;
1592extern unsigned int sysctl_sched_features; 1636extern unsigned int sysctl_sched_features;
1593extern unsigned int sysctl_sched_migration_cost; 1637extern unsigned int sysctl_sched_migration_cost;
1594extern unsigned int sysctl_sched_nr_migrate; 1638extern unsigned int sysctl_sched_nr_migrate;
1639extern unsigned int sysctl_sched_shares_ratelimit;
1595 1640
1596int sched_nr_latency_handler(struct ctl_table *table, int write, 1641int sched_nr_latency_handler(struct ctl_table *table, int write,
1597 struct file *file, void __user *buffer, size_t *length, 1642 struct file *file, void __user *buffer, size_t *length,
@@ -1625,6 +1670,8 @@ extern int can_nice(const struct task_struct *p, const int nice);
1625extern int task_curr(const struct task_struct *p); 1670extern int task_curr(const struct task_struct *p);
1626extern int idle_cpu(int cpu); 1671extern int idle_cpu(int cpu);
1627extern int sched_setscheduler(struct task_struct *, int, struct sched_param *); 1672extern int sched_setscheduler(struct task_struct *, int, struct sched_param *);
1673extern int sched_setscheduler_nocheck(struct task_struct *, int,
1674 struct sched_param *);
1628extern struct task_struct *idle_task(int cpu); 1675extern struct task_struct *idle_task(int cpu);
1629extern struct task_struct *curr_task(int cpu); 1676extern struct task_struct *curr_task(int cpu);
1630extern void set_curr_task(int cpu, struct task_struct *p); 1677extern void set_curr_task(int cpu, struct task_struct *p);
@@ -1668,19 +1715,13 @@ extern struct pid_namespace init_pid_ns;
1668 * finds a task by its pid in the specified namespace 1715 * finds a task by its pid in the specified namespace
1669 * find_task_by_vpid(): 1716 * find_task_by_vpid():
1670 * finds a task by its virtual pid 1717 * finds a task by its virtual pid
1671 * find_task_by_pid():
1672 * finds a task by its global pid
1673 * 1718 *
1674 * see also find_pid() etc in include/linux/pid.h 1719 * see also find_vpid() etc in include/linux/pid.h
1675 */ 1720 */
1676 1721
1677extern struct task_struct *find_task_by_pid_type_ns(int type, int pid, 1722extern struct task_struct *find_task_by_pid_type_ns(int type, int pid,
1678 struct pid_namespace *ns); 1723 struct pid_namespace *ns);
1679 1724
1680static inline struct task_struct *__deprecated find_task_by_pid(pid_t nr)
1681{
1682 return find_task_by_pid_type_ns(PIDTYPE_PID, nr, &init_pid_ns);
1683}
1684extern struct task_struct *find_task_by_vpid(pid_t nr); 1725extern struct task_struct *find_task_by_vpid(pid_t nr);
1685extern struct task_struct *find_task_by_pid_ns(pid_t nr, 1726extern struct task_struct *find_task_by_pid_ns(pid_t nr,
1686 struct pid_namespace *ns); 1727 struct pid_namespace *ns);
@@ -1748,12 +1789,11 @@ extern int kill_pid_info_as_uid(int, struct siginfo *, struct pid *, uid_t, uid_
1748extern int kill_pgrp(struct pid *pid, int sig, int priv); 1789extern int kill_pgrp(struct pid *pid, int sig, int priv);
1749extern int kill_pid(struct pid *pid, int sig, int priv); 1790extern int kill_pid(struct pid *pid, int sig, int priv);
1750extern int kill_proc_info(int, struct siginfo *, pid_t); 1791extern int kill_proc_info(int, struct siginfo *, pid_t);
1751extern void do_notify_parent(struct task_struct *, int); 1792extern int do_notify_parent(struct task_struct *, int);
1752extern void force_sig(int, struct task_struct *); 1793extern void force_sig(int, struct task_struct *);
1753extern void force_sig_specific(int, struct task_struct *); 1794extern void force_sig_specific(int, struct task_struct *);
1754extern int send_sig(int, struct task_struct *, int); 1795extern int send_sig(int, struct task_struct *, int);
1755extern void zap_other_threads(struct task_struct *p); 1796extern void zap_other_threads(struct task_struct *p);
1756extern int kill_proc(pid_t, int, int);
1757extern struct sigqueue *sigqueue_alloc(void); 1797extern struct sigqueue *sigqueue_alloc(void);
1758extern void sigqueue_free(struct sigqueue *); 1798extern void sigqueue_free(struct sigqueue *);
1759extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group); 1799extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group);
@@ -1817,7 +1857,9 @@ extern void exit_thread(void);
1817extern void exit_files(struct task_struct *); 1857extern void exit_files(struct task_struct *);
1818extern void __cleanup_signal(struct signal_struct *); 1858extern void __cleanup_signal(struct signal_struct *);
1819extern void __cleanup_sighand(struct sighand_struct *); 1859extern void __cleanup_sighand(struct sighand_struct *);
1860
1820extern void exit_itimers(struct signal_struct *); 1861extern void exit_itimers(struct signal_struct *);
1862extern void flush_itimer_signals(void);
1821 1863
1822extern NORET_TYPE void do_group_exit(int); 1864extern NORET_TYPE void do_group_exit(int);
1823 1865
@@ -1833,14 +1875,15 @@ extern void set_task_comm(struct task_struct *tsk, char *from);
1833extern char *get_task_comm(char *to, struct task_struct *tsk); 1875extern char *get_task_comm(char *to, struct task_struct *tsk);
1834 1876
1835#ifdef CONFIG_SMP 1877#ifdef CONFIG_SMP
1836extern void wait_task_inactive(struct task_struct * p); 1878extern unsigned long wait_task_inactive(struct task_struct *, long match_state);
1837#else 1879#else
1838#define wait_task_inactive(p) do { } while (0) 1880static inline unsigned long wait_task_inactive(struct task_struct *p,
1881 long match_state)
1882{
1883 return 1;
1884}
1839#endif 1885#endif
1840 1886
1841#define remove_parent(p) list_del_init(&(p)->sibling)
1842#define add_parent(p) list_add_tail(&(p)->sibling,&(p)->parent->children)
1843
1844#define next_task(p) list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks) 1887#define next_task(p) list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks)
1845 1888
1846#define for_each_process(p) \ 1889#define for_each_process(p) \
@@ -1937,6 +1980,13 @@ static inline unsigned long *end_of_stack(struct task_struct *p)
1937 1980
1938#endif 1981#endif
1939 1982
1983static inline int object_is_on_stack(void *obj)
1984{
1985 void *stack = task_stack_page(current);
1986
1987 return (obj >= stack) && (obj < (stack + THREAD_SIZE));
1988}
1989
1940extern void thread_info_cache_init(void); 1990extern void thread_info_cache_init(void);
1941 1991
1942/* set thread flags in other task's structures 1992/* set thread flags in other task's structures
@@ -1977,6 +2027,11 @@ static inline void clear_tsk_need_resched(struct task_struct *tsk)
1977 clear_tsk_thread_flag(tsk,TIF_NEED_RESCHED); 2027 clear_tsk_thread_flag(tsk,TIF_NEED_RESCHED);
1978} 2028}
1979 2029
2030static inline int test_tsk_need_resched(struct task_struct *tsk)
2031{
2032 return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED));
2033}
2034
1980static inline int signal_pending(struct task_struct *p) 2035static inline int signal_pending(struct task_struct *p)
1981{ 2036{
1982 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING)); 2037 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
@@ -1989,6 +2044,16 @@ static inline int fatal_signal_pending(struct task_struct *p)
1989 return signal_pending(p) && __fatal_signal_pending(p); 2044 return signal_pending(p) && __fatal_signal_pending(p);
1990} 2045}
1991 2046
2047static inline int signal_pending_state(long state, struct task_struct *p)
2048{
2049 if (!(state & (TASK_INTERRUPTIBLE | TASK_WAKEKILL)))
2050 return 0;
2051 if (!signal_pending(p))
2052 return 0;
2053
2054 return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p);
2055}
2056
1992static inline int need_resched(void) 2057static inline int need_resched(void)
1993{ 2058{
1994 return unlikely(test_thread_flag(TIF_NEED_RESCHED)); 2059 return unlikely(test_thread_flag(TIF_NEED_RESCHED));
@@ -2001,13 +2066,13 @@ static inline int need_resched(void)
2001 * cond_resched_lock() will drop the spinlock before scheduling, 2066 * cond_resched_lock() will drop the spinlock before scheduling,
2002 * cond_resched_softirq() will enable bhs before scheduling. 2067 * cond_resched_softirq() will enable bhs before scheduling.
2003 */ 2068 */
2004#ifdef CONFIG_PREEMPT 2069extern int _cond_resched(void);
2070#ifdef CONFIG_PREEMPT_BKL
2005static inline int cond_resched(void) 2071static inline int cond_resched(void)
2006{ 2072{
2007 return 0; 2073 return 0;
2008} 2074}
2009#else 2075#else
2010extern int _cond_resched(void);
2011static inline int cond_resched(void) 2076static inline int cond_resched(void)
2012{ 2077{
2013 return _cond_resched(); 2078 return _cond_resched();
@@ -2015,6 +2080,10 @@ static inline int cond_resched(void)
2015#endif 2080#endif
2016extern int cond_resched_lock(spinlock_t * lock); 2081extern int cond_resched_lock(spinlock_t * lock);
2017extern int cond_resched_softirq(void); 2082extern int cond_resched_softirq(void);
2083static inline int cond_resched_bkl(void)
2084{
2085 return _cond_resched();
2086}
2018 2087
2019/* 2088/*
2020 * Does a critical section need to be broken due to another 2089 * Does a critical section need to be broken due to another
@@ -2066,14 +2135,17 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
2066 2135
2067#endif /* CONFIG_SMP */ 2136#endif /* CONFIG_SMP */
2068 2137
2069#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
2070extern void arch_pick_mmap_layout(struct mm_struct *mm); 2138extern void arch_pick_mmap_layout(struct mm_struct *mm);
2139
2140#ifdef CONFIG_TRACING
2141extern void
2142__trace_special(void *__tr, void *__data,
2143 unsigned long arg1, unsigned long arg2, unsigned long arg3);
2071#else 2144#else
2072static inline void arch_pick_mmap_layout(struct mm_struct *mm) 2145static inline void
2146__trace_special(void *__tr, void *__data,
2147 unsigned long arg1, unsigned long arg2, unsigned long arg3)
2073{ 2148{
2074 mm->mmap_base = TASK_UNMAPPED_BASE;
2075 mm->get_unmapped_area = arch_get_unmapped_area;
2076 mm->unmap_area = arch_unmap_area;
2077} 2149}
2078#endif 2150#endif
2079 2151
@@ -2111,22 +2183,22 @@ extern long sched_group_rt_period(struct task_group *tg);
2111#ifdef CONFIG_TASK_XACCT 2183#ifdef CONFIG_TASK_XACCT
2112static inline void add_rchar(struct task_struct *tsk, ssize_t amt) 2184static inline void add_rchar(struct task_struct *tsk, ssize_t amt)
2113{ 2185{
2114 tsk->rchar += amt; 2186 tsk->ioac.rchar += amt;
2115} 2187}
2116 2188
2117static inline void add_wchar(struct task_struct *tsk, ssize_t amt) 2189static inline void add_wchar(struct task_struct *tsk, ssize_t amt)
2118{ 2190{
2119 tsk->wchar += amt; 2191 tsk->ioac.wchar += amt;
2120} 2192}
2121 2193
2122static inline void inc_syscr(struct task_struct *tsk) 2194static inline void inc_syscr(struct task_struct *tsk)
2123{ 2195{
2124 tsk->syscr++; 2196 tsk->ioac.syscr++;
2125} 2197}
2126 2198
2127static inline void inc_syscw(struct task_struct *tsk) 2199static inline void inc_syscw(struct task_struct *tsk)
2128{ 2200{
2129 tsk->syscw++; 2201 tsk->ioac.syscw++;
2130} 2202}
2131#else 2203#else
2132static inline void add_rchar(struct task_struct *tsk, ssize_t amt) 2204static inline void add_rchar(struct task_struct *tsk, ssize_t amt)
@@ -2146,14 +2218,6 @@ static inline void inc_syscw(struct task_struct *tsk)
2146} 2218}
2147#endif 2219#endif
2148 2220
2149#ifdef CONFIG_SMP
2150void migration_init(void);
2151#else
2152static inline void migration_init(void)
2153{
2154}
2155#endif
2156
2157#ifndef TASK_SIZE_OF 2221#ifndef TASK_SIZE_OF
2158#define TASK_SIZE_OF(tsk) TASK_SIZE 2222#define TASK_SIZE_OF(tsk) TASK_SIZE
2159#endif 2223#endif
@@ -2171,6 +2235,8 @@ static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
2171} 2235}
2172#endif /* CONFIG_MM_OWNER */ 2236#endif /* CONFIG_MM_OWNER */
2173 2237
2238#define TASK_STATE_TO_CHAR_STR "RSDTtZX"
2239
2174#endif /* __KERNEL__ */ 2240#endif /* __KERNEL__ */
2175 2241
2176#endif 2242#endif
diff --git a/include/linux/securebits.h b/include/linux/securebits.h
index c1f19dbceb0..92f09bdf117 100644
--- a/include/linux/securebits.h
+++ b/include/linux/securebits.h
@@ -7,14 +7,15 @@
7 inheritance of root-permissions and suid-root executable under 7 inheritance of root-permissions and suid-root executable under
8 compatibility mode. We raise the effective and inheritable bitmasks 8 compatibility mode. We raise the effective and inheritable bitmasks
9 *of the executable file* if the effective uid of the new process is 9 *of the executable file* if the effective uid of the new process is
10 0. If the real uid is 0, we raise the inheritable bitmask of the 10 0. If the real uid is 0, we raise the effective (legacy) bit of the
11 executable file. */ 11 executable file. */
12#define SECURE_NOROOT 0 12#define SECURE_NOROOT 0
13#define SECURE_NOROOT_LOCKED 1 /* make bit-0 immutable */ 13#define SECURE_NOROOT_LOCKED 1 /* make bit-0 immutable */
14 14
15/* When set, setuid to/from uid 0 does not trigger capability-"fixes" 15/* When set, setuid to/from uid 0 does not trigger capability-"fixup".
16 to be compatible with old programs relying on set*uid to loose 16 When unset, to provide compatiblility with old programs relying on
17 privileges. When unset, setuid doesn't change privileges. */ 17 set*uid to gain/lose privilege, transitions to/from uid 0 cause
18 capabilities to be gained/lost. */
18#define SECURE_NO_SETUID_FIXUP 2 19#define SECURE_NO_SETUID_FIXUP 2
19#define SECURE_NO_SETUID_FIXUP_LOCKED 3 /* make bit-2 immutable */ 20#define SECURE_NO_SETUID_FIXUP_LOCKED 3 /* make bit-2 immutable */
20 21
@@ -26,10 +27,10 @@
26#define SECURE_KEEP_CAPS 4 27#define SECURE_KEEP_CAPS 4
27#define SECURE_KEEP_CAPS_LOCKED 5 /* make bit-4 immutable */ 28#define SECURE_KEEP_CAPS_LOCKED 5 /* make bit-4 immutable */
28 29
29/* Each securesetting is implemented using two bits. One bit specify 30/* Each securesetting is implemented using two bits. One bit specifies
30 whether the setting is on or off. The other bit specify whether the 31 whether the setting is on or off. The other bit specify whether the
31 setting is fixed or not. A setting which is fixed cannot be changed 32 setting is locked or not. A setting which is locked cannot be
32 from user-level. */ 33 changed from user-level. */
33#define issecure_mask(X) (1 << (X)) 34#define issecure_mask(X) (1 << (X))
34#define issecure(X) (issecure_mask(X) & current->securebits) 35#define issecure(X) (issecure_mask(X) & current->securebits)
35 36
diff --git a/include/linux/security.h b/include/linux/security.h
index 50737c70e78..fd96e7f8a6f 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -46,7 +46,8 @@ struct audit_krule;
46 */ 46 */
47extern int cap_capable(struct task_struct *tsk, int cap); 47extern int cap_capable(struct task_struct *tsk, int cap);
48extern int cap_settime(struct timespec *ts, struct timezone *tz); 48extern int cap_settime(struct timespec *ts, struct timezone *tz);
49extern int cap_ptrace(struct task_struct *parent, struct task_struct *child); 49extern int cap_ptrace(struct task_struct *parent, struct task_struct *child,
50 unsigned int mode);
50extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 51extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
51extern int cap_capset_check(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 52extern int cap_capset_check(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
52extern void cap_capset_set(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 53extern void cap_capset_set(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
@@ -79,6 +80,7 @@ struct xfrm_selector;
79struct xfrm_policy; 80struct xfrm_policy;
80struct xfrm_state; 81struct xfrm_state;
81struct xfrm_user_sec_ctx; 82struct xfrm_user_sec_ctx;
83struct seq_file;
82 84
83extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); 85extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
84extern int cap_netlink_recv(struct sk_buff *skb, int cap); 86extern int cap_netlink_recv(struct sk_buff *skb, int cap);
@@ -100,9 +102,7 @@ extern unsigned long mmap_min_addr;
100#define LSM_SETID_FS 8 102#define LSM_SETID_FS 8
101 103
102/* forward declares to avoid warnings */ 104/* forward declares to avoid warnings */
103struct nfsctl_arg;
104struct sched_param; 105struct sched_param;
105struct swap_info_struct;
106struct request_sock; 106struct request_sock;
107 107
108/* bprm_apply_creds unsafe reasons */ 108/* bprm_apply_creds unsafe reasons */
@@ -289,10 +289,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
289 * Update module state after a successful pivot. 289 * Update module state after a successful pivot.
290 * @old_path contains the path for the old root. 290 * @old_path contains the path for the old root.
291 * @new_path contains the path for the new root. 291 * @new_path contains the path for the new root.
292 * @sb_get_mnt_opts:
293 * Get the security relevant mount options used for a superblock
294 * @sb the superblock to get security mount options from
295 * @opts binary data structure containing all lsm mount data
296 * @sb_set_mnt_opts: 292 * @sb_set_mnt_opts:
297 * Set the security relevant mount options used for a superblock 293 * Set the security relevant mount options used for a superblock
298 * @sb the superblock to set security mount options for 294 * @sb the superblock to set security mount options for
@@ -1170,6 +1166,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1170 * attributes would be changed by the execve. 1166 * attributes would be changed by the execve.
1171 * @parent contains the task_struct structure for parent process. 1167 * @parent contains the task_struct structure for parent process.
1172 * @child contains the task_struct structure for child process. 1168 * @child contains the task_struct structure for child process.
1169 * @mode contains the PTRACE_MODE flags indicating the form of access.
1173 * Return 0 if permission is granted. 1170 * Return 0 if permission is granted.
1174 * @capget: 1171 * @capget:
1175 * Get the @effective, @inheritable, and @permitted capability sets for 1172 * Get the @effective, @inheritable, and @permitted capability sets for
@@ -1240,11 +1237,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1240 * @pages contains the number of pages. 1237 * @pages contains the number of pages.
1241 * Return 0 if permission is granted. 1238 * Return 0 if permission is granted.
1242 * 1239 *
1243 * @register_security:
1244 * allow module stacking.
1245 * @name contains the name of the security module being stacked.
1246 * @ops contains a pointer to the struct security_operations of the module to stack.
1247 *
1248 * @secid_to_secctx: 1240 * @secid_to_secctx:
1249 * Convert secid to security context. 1241 * Convert secid to security context.
1250 * @secid contains the security ID. 1242 * @secid contains the security ID.
@@ -1295,7 +1287,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1295struct security_operations { 1287struct security_operations {
1296 char name[SECURITY_NAME_MAX + 1]; 1288 char name[SECURITY_NAME_MAX + 1];
1297 1289
1298 int (*ptrace) (struct task_struct *parent, struct task_struct *child); 1290 int (*ptrace) (struct task_struct *parent, struct task_struct *child,
1291 unsigned int mode);
1299 int (*capget) (struct task_struct *target, 1292 int (*capget) (struct task_struct *target,
1300 kernel_cap_t *effective, 1293 kernel_cap_t *effective,
1301 kernel_cap_t *inheritable, kernel_cap_t *permitted); 1294 kernel_cap_t *inheritable, kernel_cap_t *permitted);
@@ -1328,6 +1321,7 @@ struct security_operations {
1328 void (*sb_free_security) (struct super_block *sb); 1321 void (*sb_free_security) (struct super_block *sb);
1329 int (*sb_copy_data) (char *orig, char *copy); 1322 int (*sb_copy_data) (char *orig, char *copy);
1330 int (*sb_kern_mount) (struct super_block *sb, void *data); 1323 int (*sb_kern_mount) (struct super_block *sb, void *data);
1324 int (*sb_show_options) (struct seq_file *m, struct super_block *sb);
1331 int (*sb_statfs) (struct dentry *dentry); 1325 int (*sb_statfs) (struct dentry *dentry);
1332 int (*sb_mount) (char *dev_name, struct path *path, 1326 int (*sb_mount) (char *dev_name, struct path *path,
1333 char *type, unsigned long flags, void *data); 1327 char *type, unsigned long flags, void *data);
@@ -1343,8 +1337,6 @@ struct security_operations {
1343 struct path *new_path); 1337 struct path *new_path);
1344 void (*sb_post_pivotroot) (struct path *old_path, 1338 void (*sb_post_pivotroot) (struct path *old_path,
1345 struct path *new_path); 1339 struct path *new_path);
1346 int (*sb_get_mnt_opts) (const struct super_block *sb,
1347 struct security_mnt_opts *opts);
1348 int (*sb_set_mnt_opts) (struct super_block *sb, 1340 int (*sb_set_mnt_opts) (struct super_block *sb,
1349 struct security_mnt_opts *opts); 1341 struct security_mnt_opts *opts);
1350 void (*sb_clone_mnt_opts) (const struct super_block *oldsb, 1342 void (*sb_clone_mnt_opts) (const struct super_block *oldsb,
@@ -1370,7 +1362,7 @@ struct security_operations {
1370 struct inode *new_dir, struct dentry *new_dentry); 1362 struct inode *new_dir, struct dentry *new_dentry);
1371 int (*inode_readlink) (struct dentry *dentry); 1363 int (*inode_readlink) (struct dentry *dentry);
1372 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); 1364 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd);
1373 int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd); 1365 int (*inode_permission) (struct inode *inode, int mask);
1374 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); 1366 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr);
1375 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); 1367 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry);
1376 void (*inode_delete) (struct inode *inode); 1368 void (*inode_delete) (struct inode *inode);
@@ -1472,10 +1464,6 @@ struct security_operations {
1472 int (*netlink_send) (struct sock *sk, struct sk_buff *skb); 1464 int (*netlink_send) (struct sock *sk, struct sk_buff *skb);
1473 int (*netlink_recv) (struct sk_buff *skb, int cap); 1465 int (*netlink_recv) (struct sk_buff *skb, int cap);
1474 1466
1475 /* allow module stacking */
1476 int (*register_security) (const char *name,
1477 struct security_operations *ops);
1478
1479 void (*d_instantiate) (struct dentry *dentry, struct inode *inode); 1467 void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
1480 1468
1481 int (*getprocattr) (struct task_struct *p, char *name, char **value); 1469 int (*getprocattr) (struct task_struct *p, char *name, char **value);
@@ -1565,7 +1553,6 @@ struct security_operations {
1565extern int security_init(void); 1553extern int security_init(void);
1566extern int security_module_enable(struct security_operations *ops); 1554extern int security_module_enable(struct security_operations *ops);
1567extern int register_security(struct security_operations *ops); 1555extern int register_security(struct security_operations *ops);
1568extern int mod_reg_security(const char *name, struct security_operations *ops);
1569extern struct dentry *securityfs_create_file(const char *name, mode_t mode, 1556extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
1570 struct dentry *parent, void *data, 1557 struct dentry *parent, void *data,
1571 const struct file_operations *fops); 1558 const struct file_operations *fops);
@@ -1573,7 +1560,8 @@ extern struct dentry *securityfs_create_dir(const char *name, struct dentry *par
1573extern void securityfs_remove(struct dentry *dentry); 1560extern void securityfs_remove(struct dentry *dentry);
1574 1561
1575/* Security operations */ 1562/* Security operations */
1576int security_ptrace(struct task_struct *parent, struct task_struct *child); 1563int security_ptrace(struct task_struct *parent, struct task_struct *child,
1564 unsigned int mode);
1577int security_capget(struct task_struct *target, 1565int security_capget(struct task_struct *target,
1578 kernel_cap_t *effective, 1566 kernel_cap_t *effective,
1579 kernel_cap_t *inheritable, 1567 kernel_cap_t *inheritable,
@@ -1606,6 +1594,7 @@ int security_sb_alloc(struct super_block *sb);
1606void security_sb_free(struct super_block *sb); 1594void security_sb_free(struct super_block *sb);
1607int security_sb_copy_data(char *orig, char *copy); 1595int security_sb_copy_data(char *orig, char *copy);
1608int security_sb_kern_mount(struct super_block *sb, void *data); 1596int security_sb_kern_mount(struct super_block *sb, void *data);
1597int security_sb_show_options(struct seq_file *m, struct super_block *sb);
1609int security_sb_statfs(struct dentry *dentry); 1598int security_sb_statfs(struct dentry *dentry);
1610int security_sb_mount(char *dev_name, struct path *path, 1599int security_sb_mount(char *dev_name, struct path *path,
1611 char *type, unsigned long flags, void *data); 1600 char *type, unsigned long flags, void *data);
@@ -1617,8 +1606,6 @@ void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *d
1617void security_sb_post_addmount(struct vfsmount *mnt, struct path *mountpoint); 1606void security_sb_post_addmount(struct vfsmount *mnt, struct path *mountpoint);
1618int security_sb_pivotroot(struct path *old_path, struct path *new_path); 1607int security_sb_pivotroot(struct path *old_path, struct path *new_path);
1619void security_sb_post_pivotroot(struct path *old_path, struct path *new_path); 1608void security_sb_post_pivotroot(struct path *old_path, struct path *new_path);
1620int security_sb_get_mnt_opts(const struct super_block *sb,
1621 struct security_mnt_opts *opts);
1622int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); 1609int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts);
1623void security_sb_clone_mnt_opts(const struct super_block *oldsb, 1610void security_sb_clone_mnt_opts(const struct super_block *oldsb,
1624 struct super_block *newsb); 1611 struct super_block *newsb);
@@ -1641,7 +1628,7 @@ int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
1641 struct inode *new_dir, struct dentry *new_dentry); 1628 struct inode *new_dir, struct dentry *new_dentry);
1642int security_inode_readlink(struct dentry *dentry); 1629int security_inode_readlink(struct dentry *dentry);
1643int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); 1630int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
1644int security_inode_permission(struct inode *inode, int mask, struct nameidata *nd); 1631int security_inode_permission(struct inode *inode, int mask);
1645int security_inode_setattr(struct dentry *dentry, struct iattr *attr); 1632int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
1646int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); 1633int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry);
1647void security_inode_delete(struct inode *inode); 1634void security_inode_delete(struct inode *inode);
@@ -1755,9 +1742,11 @@ static inline int security_init(void)
1755 return 0; 1742 return 0;
1756} 1743}
1757 1744
1758static inline int security_ptrace(struct task_struct *parent, struct task_struct *child) 1745static inline int security_ptrace(struct task_struct *parent,
1746 struct task_struct *child,
1747 unsigned int mode)
1759{ 1748{
1760 return cap_ptrace(parent, child); 1749 return cap_ptrace(parent, child, mode);
1761} 1750}
1762 1751
1763static inline int security_capget(struct task_struct *target, 1752static inline int security_capget(struct task_struct *target,
@@ -1881,6 +1870,12 @@ static inline int security_sb_kern_mount(struct super_block *sb, void *data)
1881 return 0; 1870 return 0;
1882} 1871}
1883 1872
1873static inline int security_sb_show_options(struct seq_file *m,
1874 struct super_block *sb)
1875{
1876 return 0;
1877}
1878
1884static inline int security_sb_statfs(struct dentry *dentry) 1879static inline int security_sb_statfs(struct dentry *dentry)
1885{ 1880{
1886 return 0; 1881 return 0;
@@ -1927,12 +1922,6 @@ static inline int security_sb_pivotroot(struct path *old_path,
1927static inline void security_sb_post_pivotroot(struct path *old_path, 1922static inline void security_sb_post_pivotroot(struct path *old_path,
1928 struct path *new_path) 1923 struct path *new_path)
1929{ } 1924{ }
1930static inline int security_sb_get_mnt_opts(const struct super_block *sb,
1931 struct security_mnt_opts *opts)
1932{
1933 security_init_mnt_opts(opts);
1934 return 0;
1935}
1936 1925
1937static inline int security_sb_set_mnt_opts(struct super_block *sb, 1926static inline int security_sb_set_mnt_opts(struct super_block *sb,
1938 struct security_mnt_opts *opts) 1927 struct security_mnt_opts *opts)
@@ -2032,8 +2021,7 @@ static inline int security_inode_follow_link(struct dentry *dentry,
2032 return 0; 2021 return 0;
2033} 2022}
2034 2023
2035static inline int security_inode_permission(struct inode *inode, int mask, 2024static inline int security_inode_permission(struct inode *inode, int mask)
2036 struct nameidata *nd)
2037{ 2025{
2038 return 0; 2026 return 0;
2039} 2027}
diff --git a/include/linux/sem.h b/include/linux/sem.h
index c8eaad9e4b7..1b191c176bc 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -78,6 +78,7 @@ struct seminfo {
78 78
79#ifdef __KERNEL__ 79#ifdef __KERNEL__
80#include <asm/atomic.h> 80#include <asm/atomic.h>
81#include <linux/rcupdate.h>
81 82
82struct task_struct; 83struct task_struct;
83 84
@@ -93,23 +94,19 @@ struct sem_array {
93 time_t sem_otime; /* last semop time */ 94 time_t sem_otime; /* last semop time */
94 time_t sem_ctime; /* last change time */ 95 time_t sem_ctime; /* last change time */
95 struct sem *sem_base; /* ptr to first semaphore in array */ 96 struct sem *sem_base; /* ptr to first semaphore in array */
96 struct sem_queue *sem_pending; /* pending operations to be processed */ 97 struct list_head sem_pending; /* pending operations to be processed */
97 struct sem_queue **sem_pending_last; /* last pending operation */ 98 struct list_head list_id; /* undo requests on this array */
98 struct sem_undo *undo; /* undo requests on this array */
99 unsigned long sem_nsems; /* no. of semaphores in array */ 99 unsigned long sem_nsems; /* no. of semaphores in array */
100}; 100};
101 101
102/* One queue for each sleeping process in the system. */ 102/* One queue for each sleeping process in the system. */
103struct sem_queue { 103struct sem_queue {
104 struct sem_queue * next; /* next entry in the queue */ 104 struct list_head list; /* queue of pending operations */
105 struct sem_queue ** prev; /* previous entry in the queue, *(q->prev) == q */ 105 struct task_struct *sleeper; /* this process */
106 struct task_struct* sleeper; /* this process */ 106 struct sem_undo *undo; /* undo structure */
107 struct sem_undo * undo; /* undo structure */
108 int pid; /* process id of requesting process */ 107 int pid; /* process id of requesting process */
109 int status; /* completion status of operation */ 108 int status; /* completion status of operation */
110 struct sem_array * sma; /* semaphore array for operations */ 109 struct sembuf *sops; /* array of pending operations */
111 int id; /* internal sem id */
112 struct sembuf * sops; /* array of pending operations */
113 int nsops; /* number of operations */ 110 int nsops; /* number of operations */
114 int alter; /* does the operation alter the array? */ 111 int alter; /* does the operation alter the array? */
115}; 112};
@@ -118,8 +115,11 @@ struct sem_queue {
118 * when the process exits. 115 * when the process exits.
119 */ 116 */
120struct sem_undo { 117struct sem_undo {
121 struct sem_undo * proc_next; /* next entry on this process */ 118 struct list_head list_proc; /* per-process list: all undos from one process. */
122 struct sem_undo * id_next; /* next entry on this semaphore set */ 119 /* rcu protected */
120 struct rcu_head rcu; /* rcu struct for sem_undo() */
121 struct sem_undo_list *ulp; /* sem_undo_list for the process */
122 struct list_head list_id; /* per semaphore array list: all undos for one array */
123 int semid; /* semaphore set identifier */ 123 int semid; /* semaphore set identifier */
124 short * semadj; /* array of adjustments, one per semaphore */ 124 short * semadj; /* array of adjustments, one per semaphore */
125}; 125};
@@ -128,9 +128,9 @@ struct sem_undo {
128 * that may be shared among all a CLONE_SYSVSEM task group. 128 * that may be shared among all a CLONE_SYSVSEM task group.
129 */ 129 */
130struct sem_undo_list { 130struct sem_undo_list {
131 atomic_t refcnt; 131 atomic_t refcnt;
132 spinlock_t lock; 132 spinlock_t lock;
133 struct sem_undo *proc_list; 133 struct list_head list_proc;
134}; 134};
135 135
136struct sysv_sem { 136struct sysv_sem {
diff --git a/include/linux/semaphore.h b/include/linux/semaphore.h
index 9cae64b00d6..7415839ac89 100644
--- a/include/linux/semaphore.h
+++ b/include/linux/semaphore.h
@@ -26,10 +26,8 @@ struct semaphore {
26 .wait_list = LIST_HEAD_INIT((name).wait_list), \ 26 .wait_list = LIST_HEAD_INIT((name).wait_list), \
27} 27}
28 28
29#define __DECLARE_SEMAPHORE_GENERIC(name, count) \ 29#define DECLARE_MUTEX(name) \
30 struct semaphore name = __SEMAPHORE_INITIALIZER(name, count) 30 struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)
31
32#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name, 1)
33 31
34static inline void sema_init(struct semaphore *sem, int val) 32static inline void sema_init(struct semaphore *sem, int val)
35{ 33{
diff --git a/include/linux/seq_file_net.h b/include/linux/seq_file_net.h
index 4ac52542a56..32c89bbe24a 100644
--- a/include/linux/seq_file_net.h
+++ b/include/linux/seq_file_net.h
@@ -14,7 +14,10 @@ struct seq_net_private {
14 14
15int seq_open_net(struct inode *, struct file *, 15int seq_open_net(struct inode *, struct file *,
16 const struct seq_operations *, int); 16 const struct seq_operations *, int);
17int single_open_net(struct inode *, struct file *file,
18 int (*show)(struct seq_file *, void *));
17int seq_release_net(struct inode *, struct file *); 19int seq_release_net(struct inode *, struct file *);
20int single_release_net(struct inode *, struct file *);
18static inline struct net *seq_file_net(struct seq_file *seq) 21static inline struct net *seq_file_net(struct seq_file *seq)
19{ 22{
20#ifdef CONFIG_NET_NS 23#ifdef CONFIG_NET_NS
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index d32123ae08a..3b2f6c04855 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -59,9 +59,6 @@
59#define PORT_SUNZILOG 38 59#define PORT_SUNZILOG 38
60#define PORT_SUNSAB 39 60#define PORT_SUNSAB 39
61 61
62/* NEC v850. */
63#define PORT_V850E_UART 40
64
65/* DEC */ 62/* DEC */
66#define PORT_DZ 46 63#define PORT_DZ 46
67#define PORT_ZS 47 64#define PORT_ZS 47
@@ -190,8 +187,10 @@ struct uart_ops {
190 void (*break_ctl)(struct uart_port *, int ctl); 187 void (*break_ctl)(struct uart_port *, int ctl);
191 int (*startup)(struct uart_port *); 188 int (*startup)(struct uart_port *);
192 void (*shutdown)(struct uart_port *); 189 void (*shutdown)(struct uart_port *);
190 void (*flush_buffer)(struct uart_port *);
193 void (*set_termios)(struct uart_port *, struct ktermios *new, 191 void (*set_termios)(struct uart_port *, struct ktermios *new,
194 struct ktermios *old); 192 struct ktermios *old);
193 void (*set_ldisc)(struct uart_port *);
195 void (*pm)(struct uart_port *, unsigned int state, 194 void (*pm)(struct uart_port *, unsigned int state,
196 unsigned int oldstate); 195 unsigned int oldstate);
197 int (*set_wake)(struct uart_port *, unsigned int state); 196 int (*set_wake)(struct uart_port *, unsigned int state);
@@ -342,13 +341,15 @@ typedef unsigned int __bitwise__ uif_t;
342 * stuff here. 341 * stuff here.
343 */ 342 */
344struct uart_info { 343struct uart_info {
345 struct tty_struct *tty; 344 struct tty_port port;
346 struct circ_buf xmit; 345 struct circ_buf xmit;
347 uif_t flags; 346 uif_t flags;
348 347
349/* 348/*
350 * Definitions for info->flags. These are _private_ to serial_core, and 349 * Definitions for info->flags. These are _private_ to serial_core, and
351 * are specific to this structure. They may be queried by low level drivers. 350 * are specific to this structure. They may be queried by low level drivers.
351 *
352 * FIXME: use the ASY_ definitions
352 */ 353 */
353#define UIF_CHECK_CD ((__force uif_t) (1 << 25)) 354#define UIF_CHECK_CD ((__force uif_t) (1 << 25))
354#define UIF_CTS_FLOW ((__force uif_t) (1 << 26)) 355#define UIF_CTS_FLOW ((__force uif_t) (1 << 26))
@@ -356,11 +357,7 @@ struct uart_info {
356#define UIF_INITIALIZED ((__force uif_t) (1 << 31)) 357#define UIF_INITIALIZED ((__force uif_t) (1 << 31))
357#define UIF_SUSPENDED ((__force uif_t) (1 << 30)) 358#define UIF_SUSPENDED ((__force uif_t) (1 << 30))
358 359
359 int blocked_open;
360
361 struct tasklet_struct tlet; 360 struct tasklet_struct tlet;
362
363 wait_queue_head_t open_wait;
364 wait_queue_head_t delta_msr_wait; 361 wait_queue_head_t delta_msr_wait;
365}; 362};
366 363
@@ -437,8 +434,8 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port);
437#define uart_circ_chars_free(circ) \ 434#define uart_circ_chars_free(circ) \
438 (CIRC_SPACE((circ)->head, (circ)->tail, UART_XMIT_SIZE)) 435 (CIRC_SPACE((circ)->head, (circ)->tail, UART_XMIT_SIZE))
439 436
440#define uart_tx_stopped(port) \ 437#define uart_tx_stopped(portp) \
441 ((port)->info->tty->stopped || (port)->info->tty->hw_stopped) 438 ((portp)->info->port.tty->stopped || (portp)->info->port.tty->hw_stopped)
442 439
443/* 440/*
444 * The following are helper functions for the low level drivers. 441 * The following are helper functions for the low level drivers.
@@ -449,7 +446,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
449#ifdef SUPPORT_SYSRQ 446#ifdef SUPPORT_SYSRQ
450 if (port->sysrq) { 447 if (port->sysrq) {
451 if (ch && time_before(jiffies, port->sysrq)) { 448 if (ch && time_before(jiffies, port->sysrq)) {
452 handle_sysrq(ch, port->info ? port->info->tty : NULL); 449 handle_sysrq(ch, port->info ? port->info->port.tty : NULL);
453 port->sysrq = 0; 450 port->sysrq = 0;
454 return 1; 451 return 1;
455 } 452 }
@@ -478,7 +475,7 @@ static inline int uart_handle_break(struct uart_port *port)
478 } 475 }
479#endif 476#endif
480 if (port->flags & UPF_SAK) 477 if (port->flags & UPF_SAK)
481 do_SAK(info->tty); 478 do_SAK(info->port.tty);
482 return 0; 479 return 0;
483} 480}
484 481
@@ -501,9 +498,9 @@ uart_handle_dcd_change(struct uart_port *port, unsigned int status)
501 498
502 if (info->flags & UIF_CHECK_CD) { 499 if (info->flags & UIF_CHECK_CD) {
503 if (status) 500 if (status)
504 wake_up_interruptible(&info->open_wait); 501 wake_up_interruptible(&info->port.open_wait);
505 else if (info->tty) 502 else if (info->port.tty)
506 tty_hangup(info->tty); 503 tty_hangup(info->port.tty);
507 } 504 }
508} 505}
509 506
@@ -516,7 +513,7 @@ static inline void
516uart_handle_cts_change(struct uart_port *port, unsigned int status) 513uart_handle_cts_change(struct uart_port *port, unsigned int status)
517{ 514{
518 struct uart_info *info = port->info; 515 struct uart_info *info = port->info;
519 struct tty_struct *tty = info->tty; 516 struct tty_struct *tty = info->port.tty;
520 517
521 port->icount.cts++; 518 port->icount.cts++;
522 519
@@ -542,7 +539,7 @@ static inline void
542uart_insert_char(struct uart_port *port, unsigned int status, 539uart_insert_char(struct uart_port *port, unsigned int status,
543 unsigned int overrun, unsigned int ch, unsigned int flag) 540 unsigned int overrun, unsigned int ch, unsigned int flag)
544{ 541{
545 struct tty_struct *tty = port->info->tty; 542 struct tty_struct *tty = port->info->port.tty;
546 543
547 if ((status & port->ignore_status_mask & ~overrun) == 0) 544 if ((status & port->ignore_status_mask & ~overrun) == 0)
548 tty_insert_flip_char(tty, ch, flag); 545 tty_insert_flip_char(tty, ch, flag);
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 95674d97dab..25641d9e0ea 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -87,11 +87,10 @@ void serio_unregister_port(struct serio *serio);
87void serio_unregister_child_port(struct serio *serio); 87void serio_unregister_child_port(struct serio *serio);
88 88
89int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name); 89int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name);
90static inline int serio_register_driver(struct serio_driver *drv) 90static inline int __must_check serio_register_driver(struct serio_driver *drv)
91{ 91{
92 return __serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME); 92 return __serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME);
93} 93}
94int serio_register_driver(struct serio_driver *drv);
95void serio_unregister_driver(struct serio_driver *drv); 94void serio_unregister_driver(struct serio_driver *drv);
96 95
97static inline int serio_write(struct serio *serio, unsigned char data) 96static inline int serio_write(struct serio *serio, unsigned char data)
@@ -175,7 +174,7 @@ static inline void serio_unpin_driver(struct serio *serio)
175#define SERIO_8042_XL 0x06 174#define SERIO_8042_XL 0x06
176 175
177/* 176/*
178 * Serio types 177 * Serio protocols
179 */ 178 */
180#define SERIO_UNKNOWN 0x00 179#define SERIO_UNKNOWN 0x00
181#define SERIO_MSC 0x01 180#define SERIO_MSC 0x01
@@ -212,5 +211,7 @@ static inline void serio_unpin_driver(struct serio *serio)
212#define SERIO_TAOSEVM 0x34 211#define SERIO_TAOSEVM 0x34
213#define SERIO_FUJITSU 0x35 212#define SERIO_FUJITSU 0x35
214#define SERIO_ZHENHUA 0x36 213#define SERIO_ZHENHUA 0x36
214#define SERIO_INEXIO 0x37
215#define SERIO_TOUCHIT213 0x37
215 216
216#endif 217#endif
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index f2d12d5a21b..fd83f2584b1 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -43,7 +43,7 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
43} 43}
44 44
45#ifdef CONFIG_TMPFS_POSIX_ACL 45#ifdef CONFIG_TMPFS_POSIX_ACL
46int shmem_permission(struct inode *, int, struct nameidata *); 46int shmem_permission(struct inode *, int);
47int shmem_acl_init(struct inode *, struct inode *); 47int shmem_acl_init(struct inode *, struct inode *);
48void shmem_acl_destroy_inode(struct inode *); 48void shmem_acl_destroy_inode(struct inode *);
49 49
diff --git a/include/linux/signalfd.h b/include/linux/signalfd.h
index ea037f28df9..bef0c46d471 100644
--- a/include/linux/signalfd.h
+++ b/include/linux/signalfd.h
@@ -8,6 +8,12 @@
8#ifndef _LINUX_SIGNALFD_H 8#ifndef _LINUX_SIGNALFD_H
9#define _LINUX_SIGNALFD_H 9#define _LINUX_SIGNALFD_H
10 10
11/* For O_CLOEXEC and O_NONBLOCK */
12#include <linux/fcntl.h>
13
14/* Flags for signalfd4. */
15#define SFD_CLOEXEC O_CLOEXEC
16#define SFD_NONBLOCK O_NONBLOCK
11 17
12struct signalfd_siginfo { 18struct signalfd_siginfo {
13 __u32 ssi_signo; 19 __u32 ssi_signo;
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 299ec4b3141..7ea44f6621f 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -246,6 +246,7 @@ typedef unsigned char *sk_buff_data_t;
246 * @dma_cookie: a cookie to one of several possible DMA operations 246 * @dma_cookie: a cookie to one of several possible DMA operations
247 * done by skb DMA functions 247 * done by skb DMA functions
248 * @secmark: security marking 248 * @secmark: security marking
249 * @vlan_tci: vlan tag control information
249 */ 250 */
250 251
251struct sk_buff { 252struct sk_buff {
@@ -305,9 +306,7 @@ struct sk_buff {
305#endif 306#endif
306 307
307 int iif; 308 int iif;
308#ifdef CONFIG_NETDEVICES_MULTIQUEUE
309 __u16 queue_mapping; 309 __u16 queue_mapping;
310#endif
311#ifdef CONFIG_NET_SCHED 310#ifdef CONFIG_NET_SCHED
312 __u16 tc_index; /* traffic control index */ 311 __u16 tc_index; /* traffic control index */
313#ifdef CONFIG_NET_CLS_ACT 312#ifdef CONFIG_NET_CLS_ACT
@@ -328,6 +327,8 @@ struct sk_buff {
328 327
329 __u32 mark; 328 __u32 mark;
330 329
330 __u16 vlan_tci;
331
331 sk_buff_data_t transport_header; 332 sk_buff_data_t transport_header;
332 sk_buff_data_t network_header; 333 sk_buff_data_t network_header;
333 sk_buff_data_t mac_header; 334 sk_buff_data_t mac_header;
@@ -1671,25 +1672,17 @@ static inline void skb_init_secmark(struct sk_buff *skb)
1671 1672
1672static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping) 1673static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping)
1673{ 1674{
1674#ifdef CONFIG_NETDEVICES_MULTIQUEUE
1675 skb->queue_mapping = queue_mapping; 1675 skb->queue_mapping = queue_mapping;
1676#endif
1677} 1676}
1678 1677
1679static inline u16 skb_get_queue_mapping(struct sk_buff *skb) 1678static inline u16 skb_get_queue_mapping(struct sk_buff *skb)
1680{ 1679{
1681#ifdef CONFIG_NETDEVICES_MULTIQUEUE
1682 return skb->queue_mapping; 1680 return skb->queue_mapping;
1683#else
1684 return 0;
1685#endif
1686} 1681}
1687 1682
1688static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_buff *from) 1683static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_buff *from)
1689{ 1684{
1690#ifdef CONFIG_NETDEVICES_MULTIQUEUE
1691 to->queue_mapping = from->queue_mapping; 1685 to->queue_mapping = from->queue_mapping;
1692#endif
1693} 1686}
1694 1687
1695static inline int skb_is_gso(const struct sk_buff *skb) 1688static inline int skb_is_gso(const struct sk_buff *skb)
@@ -1702,6 +1695,20 @@ static inline int skb_is_gso_v6(const struct sk_buff *skb)
1702 return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6; 1695 return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6;
1703} 1696}
1704 1697
1698extern void __skb_warn_lro_forwarding(const struct sk_buff *skb);
1699
1700static inline bool skb_warn_if_lro(const struct sk_buff *skb)
1701{
1702 /* LRO sets gso_size but not gso_type, whereas if GSO is really
1703 * wanted then gso_type will be set. */
1704 struct skb_shared_info *shinfo = skb_shinfo(skb);
1705 if (shinfo->gso_size != 0 && unlikely(shinfo->gso_type == 0)) {
1706 __skb_warn_lro_forwarding(skb);
1707 return true;
1708 }
1709 return false;
1710}
1711
1705static inline void skb_forward_csum(struct sk_buff *skb) 1712static inline void skb_forward_csum(struct sk_buff *skb)
1706{ 1713{
1707 /* Unfortunately we don't support this one. Any brave souls? */ 1714 /* Unfortunately we don't support this one. Any brave souls? */
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 805ed4b92f9..5ff9676c1e2 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Written by Mark Hemment, 1996 (markhe@nextd.demon.co.uk). 2 * Written by Mark Hemment, 1996 (markhe@nextd.demon.co.uk).
3 * 3 *
4 * (C) SGI 2006, Christoph Lameter <clameter@sgi.com> 4 * (C) SGI 2006, Christoph Lameter
5 * Cleaned up and restructured to ease the addition of alternative 5 * Cleaned up and restructured to ease the addition of alternative
6 * implementations of SLAB allocators. 6 * implementations of SLAB allocators.
7 */ 7 */
@@ -58,7 +58,7 @@ int slab_is_available(void);
58 58
59struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, 59struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
60 unsigned long, 60 unsigned long,
61 void (*)(struct kmem_cache *, void *)); 61 void (*)(void *));
62void kmem_cache_destroy(struct kmem_cache *); 62void kmem_cache_destroy(struct kmem_cache *);
63int kmem_cache_shrink(struct kmem_cache *); 63int kmem_cache_shrink(struct kmem_cache *);
64void kmem_cache_free(struct kmem_cache *, void *); 64void kmem_cache_free(struct kmem_cache *, void *);
@@ -96,6 +96,7 @@ int kmem_ptr_validate(struct kmem_cache *cachep, const void *ptr);
96/* 96/*
97 * Common kmalloc functions provided by all allocators 97 * Common kmalloc functions provided by all allocators
98 */ 98 */
99void * __must_check __krealloc(const void *, size_t, gfp_t);
99void * __must_check krealloc(const void *, size_t, gfp_t); 100void * __must_check krealloc(const void *, size_t, gfp_t);
100void kfree(const void *); 101void kfree(const void *);
101size_t ksize(const void *); 102size_t ksize(const void *);
@@ -180,7 +181,7 @@ size_t ksize(const void *);
180 */ 181 */
181static inline void *kcalloc(size_t n, size_t size, gfp_t flags) 182static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
182{ 183{
183 if (n != 0 && size > ULONG_MAX / n) 184 if (size != 0 && n > ULONG_MAX / size)
184 return NULL; 185 return NULL;
185 return __kmalloc(n * size, flags | __GFP_ZERO); 186 return __kmalloc(n * size, flags | __GFP_ZERO);
186} 187}
@@ -276,6 +277,17 @@ static inline void *kzalloc(size_t size, gfp_t flags)
276 return kmalloc(size, flags | __GFP_ZERO); 277 return kmalloc(size, flags | __GFP_ZERO);
277} 278}
278 279
280/**
281 * kzalloc_node - allocate zeroed memory from a particular memory node.
282 * @size: how many bytes of memory are required.
283 * @flags: the type of memory to allocate (see kmalloc).
284 * @node: memory node from which to allocate
285 */
286static inline void *kzalloc_node(size_t size, gfp_t flags, int node)
287{
288 return kmalloc_node(size, flags | __GFP_ZERO, node);
289}
290
279#ifdef CONFIG_SLABINFO 291#ifdef CONFIG_SLABINFO
280extern const struct seq_operations slabinfo_op; 292extern const struct seq_operations slabinfo_op;
281ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *); 293ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 71e43a12ebb..5bad61a93f6 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -4,7 +4,7 @@
4/* 4/*
5 * SLUB : A Slab allocator without object queues. 5 * SLUB : A Slab allocator without object queues.
6 * 6 *
7 * (C) 2007 SGI, Christoph Lameter <clameter@sgi.com> 7 * (C) 2007 SGI, Christoph Lameter
8 */ 8 */
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/gfp.h> 10#include <linux/gfp.h>
@@ -85,7 +85,7 @@ struct kmem_cache {
85 struct kmem_cache_order_objects min; 85 struct kmem_cache_order_objects min;
86 gfp_t allocflags; /* gfp flags to use on each alloc */ 86 gfp_t allocflags; /* gfp flags to use on each alloc */
87 int refcount; /* Refcount for slab cache destroy */ 87 int refcount; /* Refcount for slab cache destroy */
88 void (*ctor)(struct kmem_cache *, void *); 88 void (*ctor)(void *);
89 int inuse; /* Offset to metadata */ 89 int inuse; /* Offset to metadata */
90 int align; /* Alignment */ 90 int align; /* Alignment */
91 const char *name; /* Name (only for display!) */ 91 const char *name; /* Name (only for display!) */
@@ -137,10 +137,12 @@ static __always_inline int kmalloc_index(size_t size)
137 if (size <= KMALLOC_MIN_SIZE) 137 if (size <= KMALLOC_MIN_SIZE)
138 return KMALLOC_SHIFT_LOW; 138 return KMALLOC_SHIFT_LOW;
139 139
140#if KMALLOC_MIN_SIZE <= 64
140 if (size > 64 && size <= 96) 141 if (size > 64 && size <= 96)
141 return 1; 142 return 1;
142 if (size > 128 && size <= 192) 143 if (size > 128 && size <= 192)
143 return 2; 144 return 2;
145#endif
144 if (size <= 8) return 3; 146 if (size <= 8) return 3;
145 if (size <= 16) return 4; 147 if (size <= 16) return 4;
146 if (size <= 32) return 5; 148 if (size <= 32) return 5;
diff --git a/include/linux/sm501.h b/include/linux/sm501.h
index bca13454470..214f93209b8 100644
--- a/include/linux/sm501.h
+++ b/include/linux/sm501.h
@@ -46,24 +46,6 @@ extern unsigned long sm501_modify_reg(struct device *dev,
46 unsigned long set, 46 unsigned long set,
47 unsigned long clear); 47 unsigned long clear);
48 48
49/* sm501_gpio_set
50 *
51 * set the state of the given GPIO line
52*/
53
54extern void sm501_gpio_set(struct device *dev,
55 unsigned long gpio,
56 unsigned int to,
57 unsigned int dir);
58
59/* sm501_gpio_get
60 *
61 * get the state of the given GPIO line
62*/
63
64extern unsigned long sm501_gpio_get(struct device *dev,
65 unsigned long gpio);
66
67 49
68/* Platform data definitions */ 50/* Platform data definitions */
69 51
@@ -71,8 +53,10 @@ extern unsigned long sm501_gpio_get(struct device *dev,
71#define SM501FB_FLAG_DISABLE_AT_EXIT (1<<1) 53#define SM501FB_FLAG_DISABLE_AT_EXIT (1<<1)
72#define SM501FB_FLAG_USE_HWCURSOR (1<<2) 54#define SM501FB_FLAG_USE_HWCURSOR (1<<2)
73#define SM501FB_FLAG_USE_HWACCEL (1<<3) 55#define SM501FB_FLAG_USE_HWACCEL (1<<3)
74#define SM501FB_FLAG_PANEL_USE_FPEN (1<<4) 56#define SM501FB_FLAG_PANEL_NO_FPEN (1<<4)
75#define SM501FB_FLAG_PANEL_USE_VBIASEN (1<<5) 57#define SM501FB_FLAG_PANEL_NO_VBIASEN (1<<5)
58#define SM501FB_FLAG_PANEL_INV_FPEN (1<<6)
59#define SM501FB_FLAG_PANEL_INV_VBIASEN (1<<7)
76 60
77struct sm501_platdata_fbsub { 61struct sm501_platdata_fbsub {
78 struct fb_videomode *def_mode; 62 struct fb_videomode *def_mode;
@@ -102,11 +86,19 @@ struct sm501_platdata_fb {
102 struct sm501_platdata_fbsub *fb_pnl; 86 struct sm501_platdata_fbsub *fb_pnl;
103}; 87};
104 88
105/* gpio i2c */ 89/* gpio i2c
90 *
91 * Note, we have to pass in the bus number, as the number used will be
92 * passed to the i2c-gpio driver's platform_device.id, subsequently used
93 * to register the i2c bus.
94*/
106 95
107struct sm501_platdata_gpio_i2c { 96struct sm501_platdata_gpio_i2c {
97 unsigned int bus_num;
108 unsigned int pin_sda; 98 unsigned int pin_sda;
109 unsigned int pin_scl; 99 unsigned int pin_scl;
100 int udelay;
101 int timeout;
110}; 102};
111 103
112/* sm501_initdata 104/* sm501_initdata
@@ -129,6 +121,7 @@ struct sm501_reg_init {
129#define SM501_USE_FBACCEL (1<<6) 121#define SM501_USE_FBACCEL (1<<6)
130#define SM501_USE_AC97 (1<<7) 122#define SM501_USE_AC97 (1<<7)
131#define SM501_USE_I2S (1<<8) 123#define SM501_USE_I2S (1<<8)
124#define SM501_USE_GPIO (1<<9)
132 125
133#define SM501_USE_ALL (0xffffffff) 126#define SM501_USE_ALL (0xffffffff)
134 127
@@ -155,6 +148,8 @@ struct sm501_init_gpio {
155 struct sm501_reg_init gpio_ddr_high; 148 struct sm501_reg_init gpio_ddr_high;
156}; 149};
157 150
151#define SM501_FLAG_SUSPEND_OFF (1<<4)
152
158/* sm501_platdata 153/* sm501_platdata
159 * 154 *
160 * This is passed with the platform device to allow the board 155 * This is passed with the platform device to allow the board
@@ -168,6 +163,12 @@ struct sm501_platdata {
168 struct sm501_init_gpio *init_gpiop; 163 struct sm501_init_gpio *init_gpiop;
169 struct sm501_platdata_fb *fb; 164 struct sm501_platdata_fb *fb;
170 165
166 int flags;
167 int gpio_base;
168
169 int (*get_power)(struct device *dev);
170 int (*set_power)(struct device *dev, unsigned int on);
171
171 struct sm501_platdata_gpio_i2c *gpio_i2c; 172 struct sm501_platdata_gpio_i2c *gpio_i2c;
172 unsigned int gpio_i2c_nr; 173 unsigned int gpio_i2c_nr;
173}; 174};
diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h
index 2c5cd55f44f..923cd8a247b 100644
--- a/include/linux/smb_fs.h
+++ b/include/linux/smb_fs.h
@@ -43,18 +43,13 @@ static inline struct smb_inode_info *SMB_I(struct inode *inode)
43} 43}
44 44
45/* macro names are short for word, double-word, long value (?) */ 45/* macro names are short for word, double-word, long value (?) */
46#define WVAL(buf,pos) \ 46#define WVAL(buf, pos) (get_unaligned_le16((u8 *)(buf) + (pos)))
47 (le16_to_cpu(get_unaligned((__le16 *)((u8 *)(buf) + (pos))))) 47#define DVAL(buf, pos) (get_unaligned_le32((u8 *)(buf) + (pos)))
48#define DVAL(buf,pos) \ 48#define LVAL(buf, pos) (get_unaligned_le64((u8 *)(buf) + (pos)))
49 (le32_to_cpu(get_unaligned((__le32 *)((u8 *)(buf) + (pos))))) 49
50#define LVAL(buf,pos) \ 50#define WSET(buf, pos, val) put_unaligned_le16((val), (u8 *)(buf) + (pos))
51 (le64_to_cpu(get_unaligned((__le64 *)((u8 *)(buf) + (pos))))) 51#define DSET(buf, pos, val) put_unaligned_le32((val), (u8 *)(buf) + (pos))
52#define WSET(buf,pos,val) \ 52#define LSET(buf, pos, val) put_unaligned_le64((val), (u8 *)(buf) + (pos))
53 put_unaligned(cpu_to_le16((u16)(val)), (__le16 *)((u8 *)(buf) + (pos)))
54#define DSET(buf,pos,val) \
55 put_unaligned(cpu_to_le32((u32)(val)), (__le32 *)((u8 *)(buf) + (pos)))
56#define LSET(buf,pos,val) \
57 put_unaligned(cpu_to_le64((u64)(val)), (__le64 *)((u8 *)(buf) + (pos)))
58 53
59/* where to find the base of the SMB packet proper */ 54/* where to find the base of the SMB packet proper */
60#define smb_base(buf) ((u8 *)(((u8 *)(buf))+4)) 55#define smb_base(buf) ((u8 *)(((u8 *)(buf))+4))
diff --git a/include/linux/smc911x.h b/include/linux/smc911x.h
new file mode 100644
index 00000000000..b58f54c2418
--- /dev/null
+++ b/include/linux/smc911x.h
@@ -0,0 +1,12 @@
1#ifndef __SMC911X_H__
2#define __SMC911X_H__
3
4#define SMC911X_USE_16BIT (1 << 0)
5#define SMC911X_USE_32BIT (1 << 1)
6
7struct smc911x_platdata {
8 unsigned long flags;
9 unsigned long irq_flags; /* IRQF_... */
10};
11
12#endif /* __SMC911X_H__ */
diff --git a/include/linux/smc91x.h b/include/linux/smc91x.h
index 8e0556b8781..3827b922ba1 100644
--- a/include/linux/smc91x.h
+++ b/include/linux/smc91x.h
@@ -5,9 +5,19 @@
5#define SMC91X_USE_16BIT (1 << 1) 5#define SMC91X_USE_16BIT (1 << 1)
6#define SMC91X_USE_32BIT (1 << 2) 6#define SMC91X_USE_32BIT (1 << 2)
7 7
8#define SMC91X_NOWAIT (1 << 3)
9
10/* two bits for IO_SHIFT, let's hope later designs will keep this sane */
11#define SMC91X_IO_SHIFT_0 (0 << 4)
12#define SMC91X_IO_SHIFT_1 (1 << 4)
13#define SMC91X_IO_SHIFT_2 (2 << 4)
14#define SMC91X_IO_SHIFT_3 (3 << 4)
15#define SMC91X_IO_SHIFT(x) (((x) >> 4) & 0x3)
16
17#define SMC91X_USE_DMA (1 << 6)
18
8struct smc91x_platdata { 19struct smc91x_platdata {
9 unsigned long flags; 20 unsigned long flags;
10 unsigned long irq_flags; /* IRQF_... */
11}; 21};
12 22
13#endif /* __SMC91X_H__ */ 23#endif /* __SMC91X_H__ */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 55232ccf9cf..66484d4a845 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -7,9 +7,18 @@
7 */ 7 */
8 8
9#include <linux/errno.h> 9#include <linux/errno.h>
10#include <linux/list.h>
11#include <linux/cpumask.h>
10 12
11extern void cpu_idle(void); 13extern void cpu_idle(void);
12 14
15struct call_single_data {
16 struct list_head list;
17 void (*func) (void *info);
18 void *info;
19 unsigned int flags;
20};
21
13#ifdef CONFIG_SMP 22#ifdef CONFIG_SMP
14 23
15#include <linux/preempt.h> 24#include <linux/preempt.h>
@@ -52,15 +61,29 @@ extern void smp_cpus_done(unsigned int max_cpus);
52/* 61/*
53 * Call a function on all other processors 62 * Call a function on all other processors
54 */ 63 */
55int smp_call_function(void(*func)(void *info), void *info, int retry, int wait); 64int smp_call_function(void(*func)(void *info), void *info, int wait);
56 65int smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info,
66 int wait);
57int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, 67int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
58 int retry, int wait); 68 int wait);
69void __smp_call_function_single(int cpuid, struct call_single_data *data);
70
71/*
72 * Generic and arch helpers
73 */
74#ifdef CONFIG_USE_GENERIC_SMP_HELPERS
75void generic_smp_call_function_single_interrupt(void);
76void generic_smp_call_function_interrupt(void);
77void ipi_call_lock(void);
78void ipi_call_unlock(void);
79void ipi_call_lock_irq(void);
80void ipi_call_unlock_irq(void);
81#endif
59 82
60/* 83/*
61 * Call a function on all processors 84 * Call a function on all processors
62 */ 85 */
63int on_each_cpu(void (*func) (void *info), void *info, int retry, int wait); 86int on_each_cpu(void (*func) (void *info), void *info, int wait);
64 87
65#define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */ 88#define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */
66#define MSG_ALL 0x8001 89#define MSG_ALL 0x8001
@@ -90,9 +113,9 @@ static inline int up_smp_call_function(void (*func)(void *), void *info)
90{ 113{
91 return 0; 114 return 0;
92} 115}
93#define smp_call_function(func, info, retry, wait) \ 116#define smp_call_function(func, info, wait) \
94 (up_smp_call_function(func, info)) 117 (up_smp_call_function(func, info))
95#define on_each_cpu(func,info,retry,wait) \ 118#define on_each_cpu(func,info,wait) \
96 ({ \ 119 ({ \
97 local_irq_disable(); \ 120 local_irq_disable(); \
98 func(info); \ 121 func(info); \
@@ -102,7 +125,7 @@ static inline int up_smp_call_function(void (*func)(void *), void *info)
102static inline void smp_send_reschedule(int cpu) { } 125static inline void smp_send_reschedule(int cpu) { }
103#define num_booting_cpus() 1 126#define num_booting_cpus() 1
104#define smp_prepare_boot_cpu() do {} while (0) 127#define smp_prepare_boot_cpu() do {} while (0)
105#define smp_call_function_single(cpuid, func, info, retry, wait) \ 128#define smp_call_function_single(cpuid, func, info, wait) \
106({ \ 129({ \
107 WARN_ON(cpuid != 0); \ 130 WARN_ON(cpuid != 0); \
108 local_irq_disable(); \ 131 local_irq_disable(); \
@@ -112,7 +135,9 @@ static inline void smp_send_reschedule(int cpu) { }
112}) 135})
113#define smp_call_function_mask(mask, func, info, wait) \ 136#define smp_call_function_mask(mask, func, info, wait) \
114 (up_smp_call_function(func, info)) 137 (up_smp_call_function(func, info))
115 138static inline void init_call_single_data(void)
139{
140}
116#endif /* !SMP */ 141#endif /* !SMP */
117 142
118/* 143/*
diff --git a/include/linux/smp_lock.h b/include/linux/smp_lock.h
index aab3a4cff4e..813be59bf34 100644
--- a/include/linux/smp_lock.h
+++ b/include/linux/smp_lock.h
@@ -27,11 +27,24 @@ static inline int reacquire_kernel_lock(struct task_struct *task)
27extern void __lockfunc lock_kernel(void) __acquires(kernel_lock); 27extern void __lockfunc lock_kernel(void) __acquires(kernel_lock);
28extern void __lockfunc unlock_kernel(void) __releases(kernel_lock); 28extern void __lockfunc unlock_kernel(void) __releases(kernel_lock);
29 29
30/*
31 * Various legacy drivers don't really need the BKL in a specific
32 * function, but they *do* need to know that the BKL became available.
33 * This function just avoids wrapping a bunch of lock/unlock pairs
34 * around code which doesn't really need it.
35 */
36static inline void cycle_kernel_lock(void)
37{
38 lock_kernel();
39 unlock_kernel();
40}
41
30#else 42#else
31 43
32#define lock_kernel() do { } while(0) 44#define lock_kernel() do { } while(0)
33#define unlock_kernel() do { } while(0) 45#define unlock_kernel() do { } while(0)
34#define release_kernel_lock(task) do { } while(0) 46#define release_kernel_lock(task) do { } while(0)
47#define cycle_kernel_lock() do { } while(0)
35#define reacquire_kernel_lock(task) 0 48#define reacquire_kernel_lock(task) 0
36#define kernel_locked() 1 49#define kernel_locked() 1
37 50
diff --git a/include/linux/socket.h b/include/linux/socket.h
index bd2b30a74e7..dc5086fe773 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -189,7 +189,8 @@ struct ucred {
189#define AF_BLUETOOTH 31 /* Bluetooth sockets */ 189#define AF_BLUETOOTH 31 /* Bluetooth sockets */
190#define AF_IUCV 32 /* IUCV sockets */ 190#define AF_IUCV 32 /* IUCV sockets */
191#define AF_RXRPC 33 /* RxRPC sockets */ 191#define AF_RXRPC 33 /* RxRPC sockets */
192#define AF_MAX 34 /* For now.. */ 192#define AF_ISDN 34 /* mISDN sockets */
193#define AF_MAX 35 /* For now.. */
193 194
194/* Protocol families, same as address families. */ 195/* Protocol families, same as address families. */
195#define PF_UNSPEC AF_UNSPEC 196#define PF_UNSPEC AF_UNSPEC
@@ -225,6 +226,7 @@ struct ucred {
225#define PF_BLUETOOTH AF_BLUETOOTH 226#define PF_BLUETOOTH AF_BLUETOOTH
226#define PF_IUCV AF_IUCV 227#define PF_IUCV AF_IUCV
227#define PF_RXRPC AF_RXRPC 228#define PF_RXRPC AF_RXRPC
229#define PF_ISDN AF_ISDN
228#define PF_MAX AF_MAX 230#define PF_MAX AF_MAX
229 231
230/* Maximum queue length specifiable by listen. */ 232/* Maximum queue length specifiable by listen. */
@@ -306,10 +308,10 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
306 int offset, 308 int offset,
307 unsigned int len, __wsum *csump); 309 unsigned int len, __wsum *csump);
308 310
309extern int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode); 311extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode);
310extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); 312extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len);
311extern int move_addr_to_user(void *kaddr, int klen, void __user *uaddr, int __user *ulen); 313extern int move_addr_to_user(struct sockaddr *kaddr, int klen, void __user *uaddr, int __user *ulen);
312extern int move_addr_to_kernel(void __user *uaddr, int ulen, void *kaddr); 314extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr *kaddr);
313extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); 315extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
314 316
315#endif 317#endif
diff --git a/include/linux/sonet.h b/include/linux/sonet.h
index 753680296e1..67ad11fcf88 100644
--- a/include/linux/sonet.h
+++ b/include/linux/sonet.h
@@ -34,7 +34,7 @@ struct sonet_stats {
34 /* clear error insertion */ 34 /* clear error insertion */
35#define SONET_GETDIAG _IOR('a',ATMIOC_PHYTYP+4,int) 35#define SONET_GETDIAG _IOR('a',ATMIOC_PHYTYP+4,int)
36 /* query error insertion */ 36 /* query error insertion */
37#define SONET_SETFRAMING _IO('a',ATMIOC_PHYTYP+5) 37#define SONET_SETFRAMING _IOW('a',ATMIOC_PHYTYP+5,int)
38 /* set framing mode (SONET/SDH) */ 38 /* set framing mode (SONET/SDH) */
39#define SONET_GETFRAMING _IOR('a',ATMIOC_PHYTYP+6,int) 39#define SONET_GETFRAMING _IOR('a',ATMIOC_PHYTYP+6,int)
40 /* get framing mode */ 40 /* get framing mode */
diff --git a/include/linux/spi/ds1305.h b/include/linux/spi/ds1305.h
new file mode 100644
index 00000000000..287ec830eab
--- /dev/null
+++ b/include/linux/spi/ds1305.h
@@ -0,0 +1,35 @@
1#ifndef __LINUX_SPI_DS1305_H
2#define __LINUX_SPI_DS1305_H
3
4/*
5 * One-time configuration for ds1305 and ds1306 RTC chips.
6 *
7 * Put a pointer to this in spi_board_info.platform_data if you want to
8 * be sure that Linux (re)initializes this as needed ... after losing
9 * backup power, and potentially on the first boot.
10 */
11struct ds1305_platform_data {
12
13 /* Trickle charge configuration: it's OK to leave out the MAGIC
14 * bitmask; mask in either DS1 or DS2, and then one of 2K/4k/8K.
15 */
16#define DS1305_TRICKLE_MAGIC 0xa0
17#define DS1305_TRICKLE_DS2 0x08 /* two diodes */
18#define DS1305_TRICKLE_DS1 0x04 /* one diode */
19#define DS1305_TRICKLE_2K 0x01 /* 2 KOhm resistance */
20#define DS1305_TRICKLE_4K 0x02 /* 4 KOhm resistance */
21#define DS1305_TRICKLE_8K 0x03 /* 8 KOhm resistance */
22 u8 trickle;
23
24 /* set only on ds1306 parts */
25 bool is_ds1306;
26
27 /* ds1306 only: enable 1 Hz output */
28 bool en_1hz;
29
30 /* REVISIT: the driver currently expects nINT0 to be wired
31 * as the alarm IRQ. ALM1 may also need to be set up ...
32 */
33};
34
35#endif /* __LINUX_SPI_DS1305_H */
diff --git a/include/linux/spi/max7301.h b/include/linux/spi/max7301.h
new file mode 100644
index 00000000000..6dfd83f19b4
--- /dev/null
+++ b/include/linux/spi/max7301.h
@@ -0,0 +1,9 @@
1#ifndef LINUX_SPI_MAX7301_H
2#define LINUX_SPI_MAX7301_H
3
4struct max7301_platform_data {
5 /* number assigned to the first GPIO */
6 unsigned base;
7};
8
9#endif
diff --git a/include/linux/spi/mcp23s08.h b/include/linux/spi/mcp23s08.h
index 835ddf47d45..22ef107d770 100644
--- a/include/linux/spi/mcp23s08.h
+++ b/include/linux/spi/mcp23s08.h
@@ -1,18 +1,25 @@
1 1
2/* FIXME driver should be able to handle all four slaves that 2/* FIXME driver should be able to handle IRQs... */
3 * can be hooked up to each chipselect, as well as IRQs... 3
4 */ 4struct mcp23s08_chip_info {
5 bool is_present; /* true iff populated */
6 u8 pullups; /* BIT(x) means enable pullup x */
7};
5 8
6struct mcp23s08_platform_data { 9struct mcp23s08_platform_data {
7 /* four slaves can share one SPI chipselect */ 10 /* Four slaves (numbered 0..3) can share one SPI chipselect, and
8 u8 slave; 11 * will provide 8..32 GPIOs using 1..4 gpio_chip instances.
12 */
13 struct mcp23s08_chip_info chip[4];
9 14
10 /* number assigned to the first GPIO */ 15 /* "base" is the number of the first GPIO. Dynamic assignment is
16 * not currently supported, and even if there are gaps in chip
17 * addressing the GPIO numbers are sequential .. so for example
18 * if only slaves 0 and 3 are present, their GPIOs range from
19 * base to base+15.
20 */
11 unsigned base; 21 unsigned base;
12 22
13 /* pins with pullups */
14 u8 pullups;
15
16 void *context; /* param to setup/teardown */ 23 void *context; /* param to setup/teardown */
17 24
18 int (*setup)(struct spi_device *spi, 25 int (*setup)(struct spi_device *spi,
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h
index e9bbe3ebd72..a3626aedaec 100644
--- a/include/linux/spi/mmc_spi.h
+++ b/include/linux/spi/mmc_spi.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_SPI_MMC_SPI_H 1#ifndef __LINUX_SPI_MMC_SPI_H
2#define __LINUX_SPI_MMC_SPI_H 2#define __LINUX_SPI_MMC_SPI_H
3 3
4#include <linux/interrupt.h>
5
4struct device; 6struct device;
5struct mmc_host; 7struct mmc_host;
6 8
@@ -21,6 +23,15 @@ struct mmc_spi_platform_data {
21 /* sense switch on sd cards */ 23 /* sense switch on sd cards */
22 int (*get_ro)(struct device *); 24 int (*get_ro)(struct device *);
23 25
26 /*
27 * If board does not use CD interrupts, driver can optimize polling
28 * using this function.
29 */
30 int (*get_cd)(struct device *);
31
32 /* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */
33 unsigned long caps;
34
24 /* how long to debounce card detect, in msecs */ 35 /* how long to debounce card detect, in msecs */
25 u16 detect_delay; 36 u16 detect_delay;
26 37
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 387e428f1cd..4be01bb4437 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -82,7 +82,7 @@ struct spi_device {
82 int irq; 82 int irq;
83 void *controller_state; 83 void *controller_state;
84 void *controller_data; 84 void *controller_data;
85 const char *modalias; 85 char modalias[32];
86 86
87 /* 87 /*
88 * likely need more hooks for more protocol options affecting how 88 * likely need more hooks for more protocol options affecting how
@@ -733,7 +733,7 @@ struct spi_board_info {
733 * controller_data goes to spi_device.controller_data, 733 * controller_data goes to spi_device.controller_data,
734 * irq is copied too 734 * irq is copied too
735 */ 735 */
736 char modalias[KOBJ_NAME_LEN]; 736 char modalias[32];
737 const void *platform_data; 737 const void *platform_data;
738 void *controller_data; 738 void *controller_data;
739 int irq; 739 int irq;
@@ -778,8 +778,20 @@ spi_register_board_info(struct spi_board_info const *info, unsigned n)
778 * use spi_new_device() to describe each device. You can also call 778 * use spi_new_device() to describe each device. You can also call
779 * spi_unregister_device() to start making that device vanish, but 779 * spi_unregister_device() to start making that device vanish, but
780 * normally that would be handled by spi_unregister_master(). 780 * normally that would be handled by spi_unregister_master().
781 *
782 * You can also use spi_alloc_device() and spi_add_device() to use a two
783 * stage registration sequence for each spi_device. This gives the caller
784 * some more control over the spi_device structure before it is registered,
785 * but requires that caller to initialize fields that would otherwise
786 * be defined using the board info.
781 */ 787 */
782extern struct spi_device * 788extern struct spi_device *
789spi_alloc_device(struct spi_master *master);
790
791extern int
792spi_add_device(struct spi_device *spi);
793
794extern struct spi_device *
783spi_new_device(struct spi_master *, struct spi_board_info *); 795spi_new_device(struct spi_master *, struct spi_board_info *);
784 796
785static inline void 797static inline void
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index d311a090fae..61e5610ad16 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -46,6 +46,7 @@
46 * linux/spinlock.h: builds the final spin_*() APIs. 46 * linux/spinlock.h: builds the final spin_*() APIs.
47 */ 47 */
48 48
49#include <linux/typecheck.h>
49#include <linux/preempt.h> 50#include <linux/preempt.h>
50#include <linux/linkage.h> 51#include <linux/linkage.h>
51#include <linux/compiler.h> 52#include <linux/compiler.h>
@@ -191,23 +192,53 @@ do { \
191 192
192#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) 193#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
193 194
194#define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock) 195#define spin_lock_irqsave(lock, flags) \
195#define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock) 196 do { \
196#define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock) 197 typecheck(unsigned long, flags); \
198 flags = _spin_lock_irqsave(lock); \
199 } while (0)
200#define read_lock_irqsave(lock, flags) \
201 do { \
202 typecheck(unsigned long, flags); \
203 flags = _read_lock_irqsave(lock); \
204 } while (0)
205#define write_lock_irqsave(lock, flags) \
206 do { \
207 typecheck(unsigned long, flags); \
208 flags = _write_lock_irqsave(lock); \
209 } while (0)
197 210
198#ifdef CONFIG_DEBUG_LOCK_ALLOC 211#ifdef CONFIG_DEBUG_LOCK_ALLOC
199#define spin_lock_irqsave_nested(lock, flags, subclass) \ 212#define spin_lock_irqsave_nested(lock, flags, subclass) \
200 flags = _spin_lock_irqsave_nested(lock, subclass) 213 do { \
214 typecheck(unsigned long, flags); \
215 flags = _spin_lock_irqsave_nested(lock, subclass); \
216 } while (0)
201#else 217#else
202#define spin_lock_irqsave_nested(lock, flags, subclass) \ 218#define spin_lock_irqsave_nested(lock, flags, subclass) \
203 flags = _spin_lock_irqsave(lock) 219 do { \
220 typecheck(unsigned long, flags); \
221 flags = _spin_lock_irqsave(lock); \
222 } while (0)
204#endif 223#endif
205 224
206#else 225#else
207 226
208#define spin_lock_irqsave(lock, flags) _spin_lock_irqsave(lock, flags) 227#define spin_lock_irqsave(lock, flags) \
209#define read_lock_irqsave(lock, flags) _read_lock_irqsave(lock, flags) 228 do { \
210#define write_lock_irqsave(lock, flags) _write_lock_irqsave(lock, flags) 229 typecheck(unsigned long, flags); \
230 _spin_lock_irqsave(lock, flags); \
231 } while (0)
232#define read_lock_irqsave(lock, flags) \
233 do { \
234 typecheck(unsigned long, flags); \
235 _read_lock_irqsave(lock, flags); \
236 } while (0)
237#define write_lock_irqsave(lock, flags) \
238 do { \
239 typecheck(unsigned long, flags); \
240 _write_lock_irqsave(lock, flags); \
241 } while (0)
211#define spin_lock_irqsave_nested(lock, flags, subclass) \ 242#define spin_lock_irqsave_nested(lock, flags, subclass) \
212 spin_lock_irqsave(lock, flags) 243 spin_lock_irqsave(lock, flags)
213 244
@@ -260,16 +291,25 @@ do { \
260} while (0) 291} while (0)
261#endif 292#endif
262 293
263#define spin_unlock_irqrestore(lock, flags) \ 294#define spin_unlock_irqrestore(lock, flags) \
264 _spin_unlock_irqrestore(lock, flags) 295 do { \
296 typecheck(unsigned long, flags); \
297 _spin_unlock_irqrestore(lock, flags); \
298 } while (0)
265#define spin_unlock_bh(lock) _spin_unlock_bh(lock) 299#define spin_unlock_bh(lock) _spin_unlock_bh(lock)
266 300
267#define read_unlock_irqrestore(lock, flags) \ 301#define read_unlock_irqrestore(lock, flags) \
268 _read_unlock_irqrestore(lock, flags) 302 do { \
303 typecheck(unsigned long, flags); \
304 _read_unlock_irqrestore(lock, flags); \
305 } while (0)
269#define read_unlock_bh(lock) _read_unlock_bh(lock) 306#define read_unlock_bh(lock) _read_unlock_bh(lock)
270 307
271#define write_unlock_irqrestore(lock, flags) \ 308#define write_unlock_irqrestore(lock, flags) \
272 _write_unlock_irqrestore(lock, flags) 309 do { \
310 typecheck(unsigned long, flags); \
311 _write_unlock_irqrestore(lock, flags); \
312 } while (0)
273#define write_unlock_bh(lock) _write_unlock_bh(lock) 313#define write_unlock_bh(lock) _write_unlock_bh(lock)
274 314
275#define spin_trylock_bh(lock) __cond_lock(lock, _spin_trylock_bh(lock)) 315#define spin_trylock_bh(lock) __cond_lock(lock, _spin_trylock_bh(lock))
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 50dfd0dc409..e530026eedf 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -7,6 +7,7 @@
7#include <linux/spinlock.h> 7#include <linux/spinlock.h>
8#include <linux/pci.h> 8#include <linux/pci.h>
9#include <linux/mod_devicetable.h> 9#include <linux/mod_devicetable.h>
10#include <linux/dma-mapping.h>
10 11
11#include <linux/ssb/ssb_regs.h> 12#include <linux/ssb/ssb_regs.h>
12 13
@@ -137,9 +138,6 @@ struct ssb_device {
137 const struct ssb_bus_ops *ops; 138 const struct ssb_bus_ops *ops;
138 139
139 struct device *dev; 140 struct device *dev;
140 /* Pointer to the device that has to be used for
141 * any DMA related operation. */
142 struct device *dma_dev;
143 141
144 struct ssb_bus *bus; 142 struct ssb_bus *bus;
145 struct ssb_device_id id; 143 struct ssb_device_id id;
@@ -399,13 +397,151 @@ static inline void ssb_block_write(struct ssb_device *dev, const void *buffer,
399#endif /* CONFIG_SSB_BLOCKIO */ 397#endif /* CONFIG_SSB_BLOCKIO */
400 398
401 399
400/* The SSB DMA API. Use this API for any DMA operation on the device.
401 * This API basically is a wrapper that calls the correct DMA API for
402 * the host device type the SSB device is attached to. */
403
402/* Translation (routing) bits that need to be ORed to DMA 404/* Translation (routing) bits that need to be ORed to DMA
403 * addresses before they are given to a device. */ 405 * addresses before they are given to a device. */
404extern u32 ssb_dma_translation(struct ssb_device *dev); 406extern u32 ssb_dma_translation(struct ssb_device *dev);
405#define SSB_DMA_TRANSLATION_MASK 0xC0000000 407#define SSB_DMA_TRANSLATION_MASK 0xC0000000
406#define SSB_DMA_TRANSLATION_SHIFT 30 408#define SSB_DMA_TRANSLATION_SHIFT 30
407 409
408extern int ssb_dma_set_mask(struct ssb_device *ssb_dev, u64 mask); 410extern int ssb_dma_set_mask(struct ssb_device *dev, u64 mask);
411
412extern void * ssb_dma_alloc_consistent(struct ssb_device *dev, size_t size,
413 dma_addr_t *dma_handle, gfp_t gfp_flags);
414extern void ssb_dma_free_consistent(struct ssb_device *dev, size_t size,
415 void *vaddr, dma_addr_t dma_handle,
416 gfp_t gfp_flags);
417
418static inline void __cold __ssb_dma_not_implemented(struct ssb_device *dev)
419{
420#ifdef CONFIG_SSB_DEBUG
421 printk(KERN_ERR "SSB: BUG! Calling DMA API for "
422 "unsupported bustype %d\n", dev->bus->bustype);
423#endif /* DEBUG */
424}
425
426static inline int ssb_dma_mapping_error(struct ssb_device *dev, dma_addr_t addr)
427{
428 switch (dev->bus->bustype) {
429 case SSB_BUSTYPE_PCI:
430 return pci_dma_mapping_error(dev->bus->host_pci, addr);
431 case SSB_BUSTYPE_SSB:
432 return dma_mapping_error(dev->dev, addr);
433 default:
434 __ssb_dma_not_implemented(dev);
435 }
436 return -ENOSYS;
437}
438
439static inline dma_addr_t ssb_dma_map_single(struct ssb_device *dev, void *p,
440 size_t size, enum dma_data_direction dir)
441{
442 switch (dev->bus->bustype) {
443 case SSB_BUSTYPE_PCI:
444 return pci_map_single(dev->bus->host_pci, p, size, dir);
445 case SSB_BUSTYPE_SSB:
446 return dma_map_single(dev->dev, p, size, dir);
447 default:
448 __ssb_dma_not_implemented(dev);
449 }
450 return 0;
451}
452
453static inline void ssb_dma_unmap_single(struct ssb_device *dev, dma_addr_t dma_addr,
454 size_t size, enum dma_data_direction dir)
455{
456 switch (dev->bus->bustype) {
457 case SSB_BUSTYPE_PCI:
458 pci_unmap_single(dev->bus->host_pci, dma_addr, size, dir);
459 return;
460 case SSB_BUSTYPE_SSB:
461 dma_unmap_single(dev->dev, dma_addr, size, dir);
462 return;
463 default:
464 __ssb_dma_not_implemented(dev);
465 }
466}
467
468static inline void ssb_dma_sync_single_for_cpu(struct ssb_device *dev,
469 dma_addr_t dma_addr,
470 size_t size,
471 enum dma_data_direction dir)
472{
473 switch (dev->bus->bustype) {
474 case SSB_BUSTYPE_PCI:
475 pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr,
476 size, dir);
477 return;
478 case SSB_BUSTYPE_SSB:
479 dma_sync_single_for_cpu(dev->dev, dma_addr, size, dir);
480 return;
481 default:
482 __ssb_dma_not_implemented(dev);
483 }
484}
485
486static inline void ssb_dma_sync_single_for_device(struct ssb_device *dev,
487 dma_addr_t dma_addr,
488 size_t size,
489 enum dma_data_direction dir)
490{
491 switch (dev->bus->bustype) {
492 case SSB_BUSTYPE_PCI:
493 pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr,
494 size, dir);
495 return;
496 case SSB_BUSTYPE_SSB:
497 dma_sync_single_for_device(dev->dev, dma_addr, size, dir);
498 return;
499 default:
500 __ssb_dma_not_implemented(dev);
501 }
502}
503
504static inline void ssb_dma_sync_single_range_for_cpu(struct ssb_device *dev,
505 dma_addr_t dma_addr,
506 unsigned long offset,
507 size_t size,
508 enum dma_data_direction dir)
509{
510 switch (dev->bus->bustype) {
511 case SSB_BUSTYPE_PCI:
512 /* Just sync everything. That's all the PCI API can do. */
513 pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr,
514 offset + size, dir);
515 return;
516 case SSB_BUSTYPE_SSB:
517 dma_sync_single_range_for_cpu(dev->dev, dma_addr, offset,
518 size, dir);
519 return;
520 default:
521 __ssb_dma_not_implemented(dev);
522 }
523}
524
525static inline void ssb_dma_sync_single_range_for_device(struct ssb_device *dev,
526 dma_addr_t dma_addr,
527 unsigned long offset,
528 size_t size,
529 enum dma_data_direction dir)
530{
531 switch (dev->bus->bustype) {
532 case SSB_BUSTYPE_PCI:
533 /* Just sync everything. That's all the PCI API can do. */
534 pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr,
535 offset + size, dir);
536 return;
537 case SSB_BUSTYPE_SSB:
538 dma_sync_single_range_for_device(dev->dev, dma_addr, offset,
539 size, dir);
540 return;
541 default:
542 __ssb_dma_not_implemented(dev);
543 }
544}
409 545
410 546
411#ifdef CONFIG_SSB_PCIHOST 547#ifdef CONFIG_SSB_PCIHOST
diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
index 01fbdf5fef2..942e3873690 100644
--- a/include/linux/ssb/ssb_driver_gige.h
+++ b/include/linux/ssb/ssb_driver_gige.h
@@ -100,7 +100,7 @@ extern char * nvram_get(const char *name);
100/* Get the device MAC address */ 100/* Get the device MAC address */
101static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) 101static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
102{ 102{
103#ifdef CONFIG_BCM947XX 103#ifdef CONFIG_BCM47XX
104 char *res = nvram_get("et0macaddr"); 104 char *res = nvram_get("et0macaddr");
105 if (res) 105 if (res)
106 memcpy(macaddr, res, 6); 106 memcpy(macaddr, res, 6);
diff --git a/include/linux/stallion.h b/include/linux/stallion.h
index 0424d75a5aa..336af33c6ea 100644
--- a/include/linux/stallion.h
+++ b/include/linux/stallion.h
@@ -69,6 +69,7 @@ struct stlrq {
69 */ 69 */
70struct stlport { 70struct stlport {
71 unsigned long magic; 71 unsigned long magic;
72 struct tty_port port;
72 unsigned int portnr; 73 unsigned int portnr;
73 unsigned int panelnr; 74 unsigned int panelnr;
74 unsigned int brdnr; 75 unsigned int brdnr;
@@ -76,12 +77,10 @@ struct stlport {
76 int uartaddr; 77 int uartaddr;
77 unsigned int pagenr; 78 unsigned int pagenr;
78 unsigned long istate; 79 unsigned long istate;
79 int flags;
80 int baud_base; 80 int baud_base;
81 int custom_divisor; 81 int custom_divisor;
82 int close_delay; 82 int close_delay;
83 int closing_wait; 83 int closing_wait;
84 int refcount;
85 int openwaitcnt; 84 int openwaitcnt;
86 int brklen; 85 int brklen;
87 unsigned int sigs; 86 unsigned int sigs;
@@ -92,9 +91,6 @@ struct stlport {
92 unsigned long clk; 91 unsigned long clk;
93 unsigned long hwid; 92 unsigned long hwid;
94 void *uartp; 93 void *uartp;
95 struct tty_struct *tty;
96 wait_queue_head_t open_wait;
97 wait_queue_head_t close_wait;
98 comstats_t stats; 94 comstats_t stats;
99 struct stlrq tx; 95 struct stlrq tx;
100}; 96};
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index 5bfc553bdb2..f1cb0ba6d71 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -5,41 +5,43 @@
5 (and more). So the "read" side to such a lock is anything which 5 (and more). So the "read" side to such a lock is anything which
6 diables preeempt. */ 6 diables preeempt. */
7#include <linux/cpu.h> 7#include <linux/cpu.h>
8#include <linux/cpumask.h>
8#include <asm/system.h> 9#include <asm/system.h>
9 10
10#if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP) 11#if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP)
12
13/* Deprecated, but useful for transition. */
14#define ALL_CPUS ~0U
15
11/** 16/**
12 * stop_machine_run: freeze the machine on all CPUs and run this function 17 * stop_machine: freeze the machine on all CPUs and run this function
13 * @fn: the function to run 18 * @fn: the function to run
14 * @data: the data ptr for the @fn() 19 * @data: the data ptr for the @fn()
15 * @cpu: the cpu to run @fn() on (or any, if @cpu == NR_CPUS. 20 * @cpus: the cpus to run the @fn() on (NULL = any online cpu)
16 * 21 *
17 * Description: This causes a thread to be scheduled on every other cpu, 22 * Description: This causes a thread to be scheduled on every cpu,
18 * each of which disables interrupts, and finally interrupts are disabled 23 * each of which disables interrupts. The result is that noone is
19 * on the current CPU. The result is that noone is holding a spinlock 24 * holding a spinlock or inside any other preempt-disabled region when
20 * or inside any other preempt-disabled region when @fn() runs. 25 * @fn() runs.
21 * 26 *
22 * This can be thought of as a very heavy write lock, equivalent to 27 * This can be thought of as a very heavy write lock, equivalent to
23 * grabbing every spinlock in the kernel. */ 28 * grabbing every spinlock in the kernel. */
24int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu); 29int stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus);
25 30
26/** 31/**
27 * __stop_machine_run: freeze the machine on all CPUs and run this function 32 * __stop_machine: freeze the machine on all CPUs and run this function
28 * @fn: the function to run 33 * @fn: the function to run
29 * @data: the data ptr for the @fn 34 * @data: the data ptr for the @fn
30 * @cpu: the cpu to run @fn on (or any, if @cpu == NR_CPUS. 35 * @cpus: the cpus to run the @fn() on (NULL = any online cpu)
31 * 36 *
32 * Description: This is a special version of the above, which returns the 37 * Description: This is a special version of the above, which assumes cpus
33 * thread which has run @fn(): kthread_stop will return the return value 38 * won't come or go while it's being called. Used by hotplug cpu.
34 * of @fn(). Used by hotplug cpu.
35 */ 39 */
36struct task_struct *__stop_machine_run(int (*fn)(void *), void *data, 40int __stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus);
37 unsigned int cpu);
38
39#else 41#else
40 42
41static inline int stop_machine_run(int (*fn)(void *), void *data, 43static inline int stop_machine(int (*fn)(void *), void *data,
42 unsigned int cpu) 44 const cpumask_t *cpus)
43{ 45{
44 int ret; 46 int ret;
45 local_irq_disable(); 47 local_irq_disable();
@@ -48,4 +50,18 @@ static inline int stop_machine_run(int (*fn)(void *), void *data,
48 return ret; 50 return ret;
49} 51}
50#endif /* CONFIG_SMP */ 52#endif /* CONFIG_SMP */
53
54static inline int __deprecated stop_machine_run(int (*fn)(void *), void *data,
55 unsigned int cpu)
56{
57 /* If they don't care which cpu fn runs on, just pick one. */
58 if (cpu == NR_CPUS)
59 return stop_machine(fn, data, NULL);
60 else if (cpu == ~0U)
61 return stop_machine(fn, data, &cpu_possible_map);
62 else {
63 cpumask_t cpus = cpumask_of_cpu(cpu);
64 return stop_machine(fn, data, &cpus);
65 }
66}
51#endif /* _LINUX_STOP_MACHINE */ 67#endif /* _LINUX_STOP_MACHINE */
diff --git a/include/linux/string.h b/include/linux/string.h
index efdc44593b5..810d80df0a1 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -111,5 +111,8 @@ extern void argv_free(char **argv);
111 111
112extern bool sysfs_streq(const char *s1, const char *s2); 112extern bool sysfs_streq(const char *s1, const char *s2);
113 113
114extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
115 const void *from, size_t available);
116
114#endif 117#endif
115#endif /* _LINUX_STRING_H_ */ 118#endif /* _LINUX_STRING_H_ */
diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h
index fec6899bf35..d48d4e605f7 100644
--- a/include/linux/sunrpc/auth_gss.h
+++ b/include/linux/sunrpc/auth_gss.h
@@ -7,8 +7,6 @@
7 * Andy Adamson <andros@umich.edu> 7 * Andy Adamson <andros@umich.edu>
8 * Bruce Fields <bfields@umich.edu> 8 * Bruce Fields <bfields@umich.edu>
9 * Copyright (c) 2000 The Regents of the University of Michigan 9 * Copyright (c) 2000 The Regents of the University of Michigan
10 *
11 * $Id$
12 */ 10 */
13 11
14#ifndef _LINUX_SUNRPC_AUTH_GSS_H 12#ifndef _LINUX_SUNRPC_AUTH_GSS_H
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 6fff7f82ef1..e5bfe01ee30 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -42,7 +42,8 @@ struct rpc_clnt {
42 42
43 unsigned int cl_softrtry : 1,/* soft timeouts */ 43 unsigned int cl_softrtry : 1,/* soft timeouts */
44 cl_discrtry : 1,/* disconnect before retry */ 44 cl_discrtry : 1,/* disconnect before retry */
45 cl_autobind : 1;/* use getport() */ 45 cl_autobind : 1,/* use getport() */
46 cl_chatty : 1;/* be verbose */
46 47
47 struct rpc_rtt * cl_rtt; /* RTO estimator data */ 48 struct rpc_rtt * cl_rtt; /* RTO estimator data */
48 const struct rpc_timeout *cl_timeout; /* Timeout strategy */ 49 const struct rpc_timeout *cl_timeout; /* Timeout strategy */
@@ -114,6 +115,7 @@ struct rpc_create_args {
114#define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 3) 115#define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 3)
115#define RPC_CLNT_CREATE_NOPING (1UL << 4) 116#define RPC_CLNT_CREATE_NOPING (1UL << 4)
116#define RPC_CLNT_CREATE_DISCRTRY (1UL << 5) 117#define RPC_CLNT_CREATE_DISCRTRY (1UL << 5)
118#define RPC_CLNT_CREATE_QUIET (1UL << 6)
117 119
118struct rpc_clnt *rpc_create(struct rpc_create_args *args); 120struct rpc_clnt *rpc_create(struct rpc_create_args *args);
119struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 121struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
@@ -123,6 +125,9 @@ void rpc_shutdown_client(struct rpc_clnt *);
123void rpc_release_client(struct rpc_clnt *); 125void rpc_release_client(struct rpc_clnt *);
124 126
125int rpcb_register(u32, u32, int, unsigned short, int *); 127int rpcb_register(u32, u32, int, unsigned short, int *);
128int rpcb_v4_register(const u32 program, const u32 version,
129 const struct sockaddr *address,
130 const char *netid, int *result);
126int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int); 131int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int);
127void rpcb_getport_async(struct rpc_task *); 132void rpcb_getport_async(struct rpc_task *);
128 133
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
index 459c5fc11d5..03f33330ece 100644
--- a/include/linux/sunrpc/gss_api.h
+++ b/include/linux/sunrpc/gss_api.h
@@ -7,8 +7,6 @@
7 * Andy Adamson <andros@umich.edu> 7 * Andy Adamson <andros@umich.edu>
8 * Bruce Fields <bfields@umich.edu> 8 * Bruce Fields <bfields@umich.edu>
9 * Copyright (c) 2000 The Regents of the University of Michigan 9 * Copyright (c) 2000 The Regents of the University of Michigan
10 *
11 * $Id$
12 */ 10 */
13 11
14#ifndef _LINUX_SUNRPC_GSS_API_H 12#ifndef _LINUX_SUNRPC_GSS_API_H
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h
index a10f1fb0bf7..e7bbdba474d 100644
--- a/include/linux/sunrpc/gss_krb5.h
+++ b/include/linux/sunrpc/gss_krb5.h
@@ -51,6 +51,9 @@ struct krb5_ctx {
51 51
52extern spinlock_t krb5_seq_lock; 52extern spinlock_t krb5_seq_lock;
53 53
54/* The length of the Kerberos GSS token header */
55#define GSS_KRB5_TOK_HDR_LEN (16)
56
54#define KG_TOK_MIC_MSG 0x0101 57#define KG_TOK_MIC_MSG 0x0101
55#define KG_TOK_WRAP_MSG 0x0201 58#define KG_TOK_WRAP_MSG 0x0201
56 59
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index d1a5c8c1a0f..64981a2f1ca 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -135,7 +135,6 @@ struct rpc_task_setup {
135#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) 135#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
136#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) 136#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS)
137#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) 137#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED)
138#define RPC_DO_CALLBACK(t) ((t)->tk_callback != NULL)
139#define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT) 138#define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT)
140 139
141#define RPC_TASK_RUNNING 0 140#define RPC_TASK_RUNNING 0
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 4b54c5fdcfd..dc69068d94c 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -22,7 +22,7 @@
22/* 22/*
23 * This is the RPC server thread function prototype 23 * This is the RPC server thread function prototype
24 */ 24 */
25typedef void (*svc_thread_fn)(struct svc_rqst *); 25typedef int (*svc_thread_fn)(void *);
26 26
27/* 27/*
28 * 28 *
@@ -80,7 +80,6 @@ struct svc_serv {
80 struct module * sv_module; /* optional module to count when 80 struct module * sv_module; /* optional module to count when
81 * adding threads */ 81 * adding threads */
82 svc_thread_fn sv_function; /* main function for threads */ 82 svc_thread_fn sv_function; /* main function for threads */
83 int sv_kill_signal; /* signal to kill threads */
84}; 83};
85 84
86/* 85/*
@@ -388,8 +387,8 @@ struct svc_rqst *svc_prepare_thread(struct svc_serv *serv,
388 struct svc_pool *pool); 387 struct svc_pool *pool);
389void svc_exit_thread(struct svc_rqst *); 388void svc_exit_thread(struct svc_rqst *);
390struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, 389struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
391 void (*shutdown)(struct svc_serv*), 390 void (*shutdown)(struct svc_serv*), svc_thread_fn,
392 svc_thread_fn, int sig, struct module *); 391 struct module *);
393int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); 392int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
394void svc_destroy(struct svc_serv *); 393void svc_destroy(struct svc_serv *);
395int svc_process(struct svc_rqst *); 394int svc_process(struct svc_rqst *);
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
index c11bbcc081f..ef2e3a20bf3 100644
--- a/include/linux/sunrpc/svc_rdma.h
+++ b/include/linux/sunrpc/svc_rdma.h
@@ -71,7 +71,8 @@ extern atomic_t rdma_stat_sq_prod;
71 * completes. 71 * completes.
72 */ 72 */
73struct svc_rdma_op_ctxt { 73struct svc_rdma_op_ctxt {
74 struct svc_rdma_op_ctxt *next; 74 struct svc_rdma_op_ctxt *read_hdr;
75 int hdr_count;
75 struct xdr_buf arg; 76 struct xdr_buf arg;
76 struct list_head dto_q; 77 struct list_head dto_q;
77 enum ib_wr_opcode wr_op; 78 enum ib_wr_opcode wr_op;
@@ -85,7 +86,31 @@ struct svc_rdma_op_ctxt {
85 struct page *pages[RPCSVC_MAXPAGES]; 86 struct page *pages[RPCSVC_MAXPAGES];
86}; 87};
87 88
88#define RDMACTXT_F_READ_DONE 1 89/*
90 * NFS_ requests are mapped on the client side by the chunk lists in
91 * the RPCRDMA header. During the fetching of the RPC from the client
92 * and the writing of the reply to the client, the memory in the
93 * client and the memory in the server must be mapped as contiguous
94 * vaddr/len for access by the hardware. These data strucures keep
95 * these mappings.
96 *
97 * For an RDMA_WRITE, the 'sge' maps the RPC REPLY. For RDMA_READ, the
98 * 'sge' in the svc_rdma_req_map maps the server side RPC reply and the
99 * 'ch' field maps the read-list of the RPCRDMA header to the 'sge'
100 * mapping of the reply.
101 */
102struct svc_rdma_chunk_sge {
103 int start; /* sge no for this chunk */
104 int count; /* sge count for this chunk */
105};
106struct svc_rdma_req_map {
107 unsigned long count;
108 union {
109 struct kvec sge[RPCSVC_MAXPAGES];
110 struct svc_rdma_chunk_sge ch[RPCSVC_MAXPAGES];
111 };
112};
113
89#define RDMACTXT_F_LAST_CTXT 2 114#define RDMACTXT_F_LAST_CTXT 2
90 115
91struct svcxprt_rdma { 116struct svcxprt_rdma {
@@ -93,7 +118,6 @@ struct svcxprt_rdma {
93 struct rdma_cm_id *sc_cm_id; /* RDMA connection id */ 118 struct rdma_cm_id *sc_cm_id; /* RDMA connection id */
94 struct list_head sc_accept_q; /* Conn. waiting accept */ 119 struct list_head sc_accept_q; /* Conn. waiting accept */
95 int sc_ord; /* RDMA read limit */ 120 int sc_ord; /* RDMA read limit */
96 wait_queue_head_t sc_read_wait;
97 int sc_max_sge; 121 int sc_max_sge;
98 122
99 int sc_sq_depth; /* Depth of SQ */ 123 int sc_sq_depth; /* Depth of SQ */
@@ -104,11 +128,8 @@ struct svcxprt_rdma {
104 128
105 struct ib_pd *sc_pd; 129 struct ib_pd *sc_pd;
106 130
107 struct svc_rdma_op_ctxt *sc_ctxt_head; 131 atomic_t sc_dma_used;
108 int sc_ctxt_cnt; 132 atomic_t sc_ctxt_used;
109 int sc_ctxt_bump;
110 int sc_ctxt_max;
111 spinlock_t sc_ctxt_lock;
112 struct list_head sc_rq_dto_q; 133 struct list_head sc_rq_dto_q;
113 spinlock_t sc_rq_dto_lock; 134 spinlock_t sc_rq_dto_lock;
114 struct ib_qp *sc_qp; 135 struct ib_qp *sc_qp;
@@ -123,6 +144,7 @@ struct svcxprt_rdma {
123 struct list_head sc_dto_q; /* DTO tasklet I/O pending Q */ 144 struct list_head sc_dto_q; /* DTO tasklet I/O pending Q */
124 struct list_head sc_read_complete_q; 145 struct list_head sc_read_complete_q;
125 spinlock_t sc_read_complete_lock; 146 spinlock_t sc_read_complete_lock;
147 struct work_struct sc_work;
126}; 148};
127/* sc_flags */ 149/* sc_flags */
128#define RDMAXPRT_RQ_PENDING 1 150#define RDMAXPRT_RQ_PENDING 1
@@ -164,13 +186,15 @@ extern int svc_rdma_sendto(struct svc_rqst *);
164 186
165/* svc_rdma_transport.c */ 187/* svc_rdma_transport.c */
166extern int svc_rdma_send(struct svcxprt_rdma *, struct ib_send_wr *); 188extern int svc_rdma_send(struct svcxprt_rdma *, struct ib_send_wr *);
167extern int svc_rdma_send_error(struct svcxprt_rdma *, struct rpcrdma_msg *, 189extern void svc_rdma_send_error(struct svcxprt_rdma *, struct rpcrdma_msg *,
168 enum rpcrdma_errcode); 190 enum rpcrdma_errcode);
169struct page *svc_rdma_get_page(void); 191struct page *svc_rdma_get_page(void);
170extern int svc_rdma_post_recv(struct svcxprt_rdma *); 192extern int svc_rdma_post_recv(struct svcxprt_rdma *);
171extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *); 193extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *);
172extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *); 194extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *);
173extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int); 195extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int);
196extern struct svc_rdma_req_map *svc_rdma_get_req_map(void);
197extern void svc_rdma_put_req_map(struct svc_rdma_req_map *);
174extern void svc_sq_reap(struct svcxprt_rdma *); 198extern void svc_sq_reap(struct svcxprt_rdma *);
175extern void svc_rq_reap(struct svcxprt_rdma *); 199extern void svc_rq_reap(struct svcxprt_rdma *);
176extern struct svc_xprt_class svc_rdma_class; 200extern struct svc_xprt_class svc_rdma_class;
diff --git a/include/linux/sunrpc/svcauth_gss.h b/include/linux/sunrpc/svcauth_gss.h
index 417a1def56d..c9165d9771a 100644
--- a/include/linux/sunrpc/svcauth_gss.h
+++ b/include/linux/sunrpc/svcauth_gss.h
@@ -3,9 +3,6 @@
3 * 3 *
4 * Bruce Fields <bfields@umich.edu> 4 * Bruce Fields <bfields@umich.edu>
5 * Copyright (c) 2002 The Regents of the Unviersity of Michigan 5 * Copyright (c) 2002 The Regents of the Unviersity of Michigan
6 *
7 * $Id$
8 *
9 */ 6 */
10 7
11#ifndef _LINUX_SUNRPC_SVCAUTH_GSS_H 8#ifndef _LINUX_SUNRPC_SVCAUTH_GSS_H
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index a6977423baf..c6343509597 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -86,6 +86,11 @@ typedef int __bitwise suspend_state_t;
86 * that implement @begin(), but platforms implementing @begin() should 86 * that implement @begin(), but platforms implementing @begin() should
87 * also provide a @end() which cleans up transitions aborted before 87 * also provide a @end() which cleans up transitions aborted before
88 * @enter(). 88 * @enter().
89 *
90 * @recover: Recover the platform from a suspend failure.
91 * Called by the PM core if the suspending of devices fails.
92 * This callback is optional and should only be implemented by platforms
93 * which require special recovery actions in that situation.
89 */ 94 */
90struct platform_suspend_ops { 95struct platform_suspend_ops {
91 int (*valid)(suspend_state_t state); 96 int (*valid)(suspend_state_t state);
@@ -94,6 +99,7 @@ struct platform_suspend_ops {
94 int (*enter)(suspend_state_t state); 99 int (*enter)(suspend_state_t state);
95 void (*finish)(void); 100 void (*finish)(void);
96 void (*end)(void); 101 void (*end)(void);
102 void (*recover)(void);
97}; 103};
98 104
99#ifdef CONFIG_SUSPEND 105#ifdef CONFIG_SUSPEND
@@ -149,7 +155,7 @@ extern void mark_free_pages(struct zone *zone);
149 * The methods in this structure allow a platform to carry out special 155 * The methods in this structure allow a platform to carry out special
150 * operations required by it during a hibernation transition. 156 * operations required by it during a hibernation transition.
151 * 157 *
152 * All the methods below must be implemented. 158 * All the methods below, except for @recover(), must be implemented.
153 * 159 *
154 * @begin: Tell the platform driver that we're starting hibernation. 160 * @begin: Tell the platform driver that we're starting hibernation.
155 * Called right after shrinking memory and before freezing devices. 161 * Called right after shrinking memory and before freezing devices.
@@ -189,6 +195,11 @@ extern void mark_free_pages(struct zone *zone);
189 * @restore_cleanup: Clean up after a failing image restoration. 195 * @restore_cleanup: Clean up after a failing image restoration.
190 * Called right after the nonboot CPUs have been enabled and before 196 * Called right after the nonboot CPUs have been enabled and before
191 * thawing devices (runs with IRQs on). 197 * thawing devices (runs with IRQs on).
198 *
199 * @recover: Recover the platform from a failure to suspend devices.
200 * Called by the PM core if the suspending of devices during hibernation
201 * fails. This callback is optional and should only be implemented by
202 * platforms which require special recovery actions in that situation.
192 */ 203 */
193struct platform_hibernation_ops { 204struct platform_hibernation_ops {
194 int (*begin)(void); 205 int (*begin)(void);
@@ -200,6 +211,7 @@ struct platform_hibernation_ops {
200 void (*leave)(void); 211 void (*leave)(void);
201 int (*pre_restore)(void); 212 int (*pre_restore)(void);
202 void (*restore_cleanup)(void); 213 void (*restore_cleanup)(void);
214 void (*recover)(void);
203}; 215};
204 216
205#ifdef CONFIG_HIBERNATION 217#ifdef CONFIG_HIBERNATION
@@ -266,4 +278,6 @@ static inline void register_nosave_region_late(unsigned long b, unsigned long e)
266} 278}
267#endif 279#endif
268 280
281extern struct mutex pm_mutex;
282
269#endif /* _LINUX_SUSPEND_H */ 283#endif /* _LINUX_SUSPEND_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 0b3377650c8..de40f169a4e 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -237,7 +237,6 @@ extern struct page *swapin_readahead(swp_entry_t, gfp_t,
237 237
238/* linux/mm/swapfile.c */ 238/* linux/mm/swapfile.c */
239extern long total_swap_pages; 239extern long total_swap_pages;
240extern unsigned int nr_swapfiles;
241extern void si_swapinfo(struct sysinfo *); 240extern void si_swapinfo(struct sysinfo *);
242extern swp_entry_t get_swap_page(void); 241extern swp_entry_t get_swap_page(void);
243extern swp_entry_t get_swap_page_of_type(int); 242extern swp_entry_t get_swap_page_of_type(int);
@@ -254,8 +253,6 @@ extern int can_share_swap_page(struct page *);
254extern int remove_exclusive_swap_page(struct page *); 253extern int remove_exclusive_swap_page(struct page *);
255struct backing_dev_info; 254struct backing_dev_info;
256 255
257extern spinlock_t swap_lock;
258
259/* linux/mm/thrash.c */ 256/* linux/mm/thrash.c */
260extern struct mm_struct * swap_token_mm; 257extern struct mm_struct * swap_token_mm;
261extern void grab_swap_token(void); 258extern void grab_swap_token(void);
diff --git a/include/linux/synclink.h b/include/linux/synclink.h
index 45f6bc82d31..c844a229acc 100644
--- a/include/linux/synclink.h
+++ b/include/linux/synclink.h
@@ -136,6 +136,7 @@
136#define MGSL_INTERFACE_RTS_EN 0x10 136#define MGSL_INTERFACE_RTS_EN 0x10
137#define MGSL_INTERFACE_LL 0x20 137#define MGSL_INTERFACE_LL 0x20
138#define MGSL_INTERFACE_RL 0x40 138#define MGSL_INTERFACE_RL 0x40
139#define MGSL_INTERFACE_MSB_FIRST 0x80
139 140
140typedef struct _MGSL_PARAMS 141typedef struct _MGSL_PARAMS
141{ 142{
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 0522f368f9d..d6ff145919c 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -305,6 +305,7 @@ asmlinkage long sys_fcntl64(unsigned int fd,
305#endif 305#endif
306asmlinkage long sys_dup(unsigned int fildes); 306asmlinkage long sys_dup(unsigned int fildes);
307asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd); 307asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd);
308asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags);
308asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int on); 309asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int on);
309asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd, 310asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd,
310 unsigned long arg); 311 unsigned long arg);
@@ -409,6 +410,8 @@ asmlinkage long sys_getsockopt(int fd, int level, int optname,
409asmlinkage long sys_bind(int, struct sockaddr __user *, int); 410asmlinkage long sys_bind(int, struct sockaddr __user *, int);
410asmlinkage long sys_connect(int, struct sockaddr __user *, int); 411asmlinkage long sys_connect(int, struct sockaddr __user *, int);
411asmlinkage long sys_accept(int, struct sockaddr __user *, int __user *); 412asmlinkage long sys_accept(int, struct sockaddr __user *, int __user *);
413asmlinkage long sys_paccept(int, struct sockaddr __user *, int __user *,
414 const __user sigset_t *, size_t, int);
412asmlinkage long sys_getsockname(int, struct sockaddr __user *, int __user *); 415asmlinkage long sys_getsockname(int, struct sockaddr __user *, int __user *);
413asmlinkage long sys_getpeername(int, struct sockaddr __user *, int __user *); 416asmlinkage long sys_getpeername(int, struct sockaddr __user *, int __user *);
414asmlinkage long sys_send(int, void __user *, size_t, unsigned); 417asmlinkage long sys_send(int, void __user *, size_t, unsigned);
@@ -428,6 +431,7 @@ asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
428asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp, 431asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
429 fd_set __user *exp, struct timeval __user *tvp); 432 fd_set __user *exp, struct timeval __user *tvp);
430asmlinkage long sys_epoll_create(int size); 433asmlinkage long sys_epoll_create(int size);
434asmlinkage long sys_epoll_create1(int flags);
431asmlinkage long sys_epoll_ctl(int epfd, int op, int fd, 435asmlinkage long sys_epoll_ctl(int epfd, int op, int fd,
432 struct epoll_event __user *event); 436 struct epoll_event __user *event);
433asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events, 437asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events,
@@ -443,7 +447,7 @@ asmlinkage long sys_newuname(struct new_utsname __user *name);
443 447
444asmlinkage long sys_getrlimit(unsigned int resource, 448asmlinkage long sys_getrlimit(unsigned int resource,
445 struct rlimit __user *rlim); 449 struct rlimit __user *rlim);
446#if defined(COMPAT_RLIM_OLD_INFINITY) || !(defined(CONFIG_IA64) || defined(CONFIG_V850)) 450#if defined(COMPAT_RLIM_OLD_INFINITY) || !(defined(CONFIG_IA64))
447asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *rlim); 451asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *rlim);
448#endif 452#endif
449asmlinkage long sys_setrlimit(unsigned int resource, 453asmlinkage long sys_setrlimit(unsigned int resource,
@@ -543,6 +547,7 @@ asmlinkage long sys_get_mempolicy(int __user *policy,
543 unsigned long addr, unsigned long flags); 547 unsigned long addr, unsigned long flags);
544 548
545asmlinkage long sys_inotify_init(void); 549asmlinkage long sys_inotify_init(void);
550asmlinkage long sys_inotify_init1(int flags);
546asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, 551asmlinkage long sys_inotify_add_watch(int fd, const char __user *path,
547 u32 mask); 552 u32 mask);
548asmlinkage long sys_inotify_rm_watch(int fd, u32 wd); 553asmlinkage long sys_inotify_rm_watch(int fd, u32 wd);
@@ -608,12 +613,14 @@ asmlinkage long sys_set_robust_list(struct robust_list_head __user *head,
608 size_t len); 613 size_t len);
609asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache); 614asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache);
610asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemask); 615asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemask);
616asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask, size_t sizemask, int flags);
611asmlinkage long sys_timerfd_create(int clockid, int flags); 617asmlinkage long sys_timerfd_create(int clockid, int flags);
612asmlinkage long sys_timerfd_settime(int ufd, int flags, 618asmlinkage long sys_timerfd_settime(int ufd, int flags,
613 const struct itimerspec __user *utmr, 619 const struct itimerspec __user *utmr,
614 struct itimerspec __user *otmr); 620 struct itimerspec __user *otmr);
615asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr); 621asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr);
616asmlinkage long sys_eventfd(unsigned int count); 622asmlinkage long sys_eventfd(unsigned int count);
623asmlinkage long sys_eventfd2(unsigned int count, int flags);
617asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len); 624asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len);
618 625
619int kernel_execve(const char *filename, char *const argv[], char *const envp[]); 626int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 24141b4d1a1..d0437f36921 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -947,6 +947,22 @@ struct ctl_table;
947struct nsproxy; 947struct nsproxy;
948struct ctl_table_root; 948struct ctl_table_root;
949 949
950struct ctl_table_set {
951 struct list_head list;
952 struct ctl_table_set *parent;
953 int (*is_seen)(struct ctl_table_set *);
954};
955
956extern void setup_sysctl_set(struct ctl_table_set *p,
957 struct ctl_table_set *parent,
958 int (*is_seen)(struct ctl_table_set *));
959
960struct ctl_table_header;
961
962extern void sysctl_head_get(struct ctl_table_header *);
963extern void sysctl_head_put(struct ctl_table_header *);
964extern int sysctl_is_seen(struct ctl_table_header *);
965extern struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *);
950extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev); 966extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev);
951extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces, 967extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
952 struct ctl_table_header *prev); 968 struct ctl_table_header *prev);
@@ -1049,8 +1065,8 @@ struct ctl_table
1049 1065
1050struct ctl_table_root { 1066struct ctl_table_root {
1051 struct list_head root_list; 1067 struct list_head root_list;
1052 struct list_head header_list; 1068 struct ctl_table_set default_set;
1053 struct list_head *(*lookup)(struct ctl_table_root *root, 1069 struct ctl_table_set *(*lookup)(struct ctl_table_root *root,
1054 struct nsproxy *namespaces); 1070 struct nsproxy *namespaces);
1055 int (*permissions)(struct ctl_table_root *root, 1071 int (*permissions)(struct ctl_table_root *root,
1056 struct nsproxy *namespaces, struct ctl_table *table); 1072 struct nsproxy *namespaces, struct ctl_table *table);
@@ -1063,9 +1079,14 @@ struct ctl_table_header
1063 struct ctl_table *ctl_table; 1079 struct ctl_table *ctl_table;
1064 struct list_head ctl_entry; 1080 struct list_head ctl_entry;
1065 int used; 1081 int used;
1082 int count;
1066 struct completion *unregistering; 1083 struct completion *unregistering;
1067 struct ctl_table *ctl_table_arg; 1084 struct ctl_table *ctl_table_arg;
1068 struct ctl_table_root *root; 1085 struct ctl_table_root *root;
1086 struct ctl_table_set *set;
1087 struct ctl_table *attached_by;
1088 struct ctl_table *attached_to;
1089 struct ctl_table_header *parent;
1069}; 1090};
1070 1091
1071/* struct ctl_path describes where in the hierarchy a table is added */ 1092/* struct ctl_path describes where in the hierarchy a table is added */
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
index f2767bc6b73..f395bb3fa2f 100644
--- a/include/linux/sysdev.h
+++ b/include/linux/sysdev.h
@@ -99,8 +99,9 @@ extern void sysdev_unregister(struct sys_device *);
99 99
100struct sysdev_attribute { 100struct sysdev_attribute {
101 struct attribute attr; 101 struct attribute attr;
102 ssize_t (*show)(struct sys_device *, char *); 102 ssize_t (*show)(struct sys_device *, struct sysdev_attribute *, char *);
103 ssize_t (*store)(struct sys_device *, const char *, size_t); 103 ssize_t (*store)(struct sys_device *, struct sysdev_attribute *,
104 const char *, size_t);
104}; 105};
105 106
106 107
@@ -118,4 +119,38 @@ struct sysdev_attribute {
118extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); 119extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *);
119extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); 120extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *);
120 121
122struct sysdev_ext_attribute {
123 struct sysdev_attribute attr;
124 void *var;
125};
126
127/*
128 * Support for simple variable sysdev attributes.
129 * The pointer to the variable is stored in a sysdev_ext_attribute
130 */
131
132/* Add more types as needed */
133
134extern ssize_t sysdev_show_ulong(struct sys_device *, struct sysdev_attribute *,
135 char *);
136extern ssize_t sysdev_store_ulong(struct sys_device *,
137 struct sysdev_attribute *, const char *, size_t);
138extern ssize_t sysdev_show_int(struct sys_device *, struct sysdev_attribute *,
139 char *);
140extern ssize_t sysdev_store_int(struct sys_device *,
141 struct sysdev_attribute *, const char *, size_t);
142
143#define _SYSDEV_ULONG_ATTR(_name, _mode, _var) \
144 { _SYSDEV_ATTR(_name, _mode, sysdev_show_ulong, sysdev_store_ulong), \
145 &(_var) }
146#define SYSDEV_ULONG_ATTR(_name, _mode, _var) \
147 struct sysdev_ext_attribute attr_##_name = \
148 _SYSDEV_ULONG_ATTR(_name, _mode, _var);
149#define _SYSDEV_INT_ATTR(_name, _mode, _var) \
150 { _SYSDEV_ATTR(_name, _mode, sysdev_show_int, sysdev_store_int), \
151 &(_var) }
152#define SYSDEV_INT_ATTR(_name, _mode, _var) \
153 struct sysdev_ext_attribute attr_##_name = \
154 _SYSDEV_INT_ATTR(_name, _mode, _var);
155
121#endif /* _SYSDEV_H_ */ 156#endif /* _SYSDEV_H_ */
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 27bad59dae7..37fa24152bd 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -101,6 +101,9 @@ void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr);
101 101
102int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, 102int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target,
103 const char *name); 103 const char *name);
104int __must_check sysfs_create_link_nowarn(struct kobject *kobj,
105 struct kobject *target,
106 const char *name);
104void sysfs_remove_link(struct kobject *kobj, const char *name); 107void sysfs_remove_link(struct kobject *kobj, const char *name);
105 108
106int __must_check sysfs_create_group(struct kobject *kobj, 109int __must_check sysfs_create_group(struct kobject *kobj,
@@ -180,18 +183,19 @@ static inline int sysfs_create_link(struct kobject *kobj,
180 return 0; 183 return 0;
181} 184}
182 185
183static inline void sysfs_remove_link(struct kobject *kobj, const char *name) 186static inline int sysfs_create_link_nowarn(struct kobject *kobj,
187 struct kobject *target,
188 const char *name)
184{ 189{
190 return 0;
185} 191}
186 192
187static inline int sysfs_create_group(struct kobject *kobj, 193static inline void sysfs_remove_link(struct kobject *kobj, const char *name)
188 const struct attribute_group *grp)
189{ 194{
190 return 0;
191} 195}
192 196
193static inline int sysfs_update_group(struct kobject *kobj, 197static inline int sysfs_create_group(struct kobject *kobj,
194 const struct attribute_group *grp) 198 const struct attribute_group *grp)
195{ 199{
196 return 0; 200 return 0;
197} 201}
diff --git a/include/linux/task_io_accounting.h b/include/linux/task_io_accounting.h
index 44d00e9ccee..5e88afc9a2f 100644
--- a/include/linux/task_io_accounting.h
+++ b/include/linux/task_io_accounting.h
@@ -8,8 +8,19 @@
8 * Blame akpm@osdl.org for all this. 8 * Blame akpm@osdl.org for all this.
9 */ 9 */
10 10
11#ifdef CONFIG_TASK_IO_ACCOUNTING
12struct task_io_accounting { 11struct task_io_accounting {
12#ifdef CONFIG_TASK_XACCT
13 /* bytes read */
14 u64 rchar;
15 /* bytes written */
16 u64 wchar;
17 /* # of read syscalls */
18 u64 syscr;
19 /* # of write syscalls */
20 u64 syscw;
21#endif /* CONFIG_TASK_XACCT */
22
23#ifdef CONFIG_TASK_IO_ACCOUNTING
13 /* 24 /*
14 * The number of bytes which this task has caused to be read from 25 * The number of bytes which this task has caused to be read from
15 * storage. 26 * storage.
@@ -30,8 +41,5 @@ struct task_io_accounting {
30 * information loss in doing that. 41 * information loss in doing that.
31 */ 42 */
32 u64 cancelled_write_bytes; 43 u64 cancelled_write_bytes;
44#endif /* CONFIG_TASK_IO_ACCOUNTING */
33}; 45};
34#else
35struct task_io_accounting {
36};
37#endif
diff --git a/include/linux/task_io_accounting_ops.h b/include/linux/task_io_accounting_ops.h
index ff46c6fad79..4d090f9ee60 100644
--- a/include/linux/task_io_accounting_ops.h
+++ b/include/linux/task_io_accounting_ops.h
@@ -40,9 +40,17 @@ static inline void task_io_account_cancelled_write(size_t bytes)
40 current->ioac.cancelled_write_bytes += bytes; 40 current->ioac.cancelled_write_bytes += bytes;
41} 41}
42 42
43static inline void task_io_accounting_init(struct task_struct *tsk) 43static inline void task_io_accounting_init(struct task_io_accounting *ioac)
44{ 44{
45 memset(&tsk->ioac, 0, sizeof(tsk->ioac)); 45 memset(ioac, 0, sizeof(*ioac));
46}
47
48static inline void task_blk_io_accounting_add(struct task_io_accounting *dst,
49 struct task_io_accounting *src)
50{
51 dst->read_bytes += src->read_bytes;
52 dst->write_bytes += src->write_bytes;
53 dst->cancelled_write_bytes += src->cancelled_write_bytes;
46} 54}
47 55
48#else 56#else
@@ -69,9 +77,37 @@ static inline void task_io_account_cancelled_write(size_t bytes)
69{ 77{
70} 78}
71 79
72static inline void task_io_accounting_init(struct task_struct *tsk) 80static inline void task_io_accounting_init(struct task_io_accounting *ioac)
81{
82}
83
84static inline void task_blk_io_accounting_add(struct task_io_accounting *dst,
85 struct task_io_accounting *src)
73{ 86{
74} 87}
75 88
76#endif /* CONFIG_TASK_IO_ACCOUNTING */ 89#endif /* CONFIG_TASK_IO_ACCOUNTING */
77#endif /* __TASK_IO_ACCOUNTING_OPS_INCLUDED */ 90
91#ifdef CONFIG_TASK_XACCT
92static inline void task_chr_io_accounting_add(struct task_io_accounting *dst,
93 struct task_io_accounting *src)
94{
95 dst->rchar += src->rchar;
96 dst->wchar += src->wchar;
97 dst->syscr += src->syscr;
98 dst->syscw += src->syscw;
99}
100#else
101static inline void task_chr_io_accounting_add(struct task_io_accounting *dst,
102 struct task_io_accounting *src)
103{
104}
105#endif /* CONFIG_TASK_XACCT */
106
107static inline void task_io_accounting_add(struct task_io_accounting *dst,
108 struct task_io_accounting *src)
109{
110 task_chr_io_accounting_add(dst, src);
111 task_blk_io_accounting_add(dst, src);
112}
113#endif /* __TASK_IO_ACCOUNTING_OPS_INCLUDED */
diff --git a/include/linux/taskstats.h b/include/linux/taskstats.h
index 5d69c0744ff..18269e956a7 100644
--- a/include/linux/taskstats.h
+++ b/include/linux/taskstats.h
@@ -31,7 +31,7 @@
31 */ 31 */
32 32
33 33
34#define TASKSTATS_VERSION 6 34#define TASKSTATS_VERSION 7
35#define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN 35#define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN
36 * in linux/sched.h */ 36 * in linux/sched.h */
37 37
@@ -157,6 +157,10 @@ struct taskstats {
157 __u64 ac_utimescaled; /* utime scaled on frequency etc */ 157 __u64 ac_utimescaled; /* utime scaled on frequency etc */
158 __u64 ac_stimescaled; /* stime scaled on frequency etc */ 158 __u64 ac_stimescaled; /* stime scaled on frequency etc */
159 __u64 cpu_scaled_run_real_total; /* scaled cpu_run_real_total */ 159 __u64 cpu_scaled_run_real_total; /* scaled cpu_run_real_total */
160
161 /* Delay waiting for memory reclaim */
162 __u64 freepages_count;
163 __u64 freepages_delay_total;
160}; 164};
161 165
162 166
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index d96d9b12230..2e2557388e3 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -224,6 +224,12 @@ struct tcp_options_received {
224 u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ 224 u16 mss_clamp; /* Maximal mss, negotiated at connection setup */
225}; 225};
226 226
227/* This is the max number of SACKS that we'll generate and process. It's safe
228 * to increse this, although since:
229 * size = TCPOLEN_SACK_BASE_ALIGNED (4) + n * TCPOLEN_SACK_PERBLOCK (8)
230 * only four options will fit in a standard TCP header */
231#define TCP_NUM_SACKS 4
232
227struct tcp_request_sock { 233struct tcp_request_sock {
228 struct inet_request_sock req; 234 struct inet_request_sock req;
229#ifdef CONFIG_TCP_MD5SIG 235#ifdef CONFIG_TCP_MD5SIG
@@ -239,11 +245,6 @@ static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
239 return (struct tcp_request_sock *)req; 245 return (struct tcp_request_sock *)req;
240} 246}
241 247
242struct tcp_deferred_accept_info {
243 struct sock *listen_sk;
244 struct request_sock *request;
245};
246
247struct tcp_sock { 248struct tcp_sock {
248 /* inet_connection_sock has to be the first member of tcp_sock */ 249 /* inet_connection_sock has to be the first member of tcp_sock */
249 struct inet_connection_sock inet_conn; 250 struct inet_connection_sock inet_conn;
@@ -296,10 +297,9 @@ struct tcp_sock {
296 u32 rcv_ssthresh; /* Current window clamp */ 297 u32 rcv_ssthresh; /* Current window clamp */
297 298
298 u32 frto_highmark; /* snd_nxt when RTO occurred */ 299 u32 frto_highmark; /* snd_nxt when RTO occurred */
299 u8 reordering; /* Packet reordering metric. */ 300 u16 advmss; /* Advertised MSS */
300 u8 frto_counter; /* Number of new acks after RTO */ 301 u8 frto_counter; /* Number of new acks after RTO */
301 u8 nonagle; /* Disable Nagle algorithm? */ 302 u8 nonagle; /* Disable Nagle algorithm? */
302 u8 keepalive_probes; /* num of allowed keep alive probes */
303 303
304/* RTT measurement */ 304/* RTT measurement */
305 u32 srtt; /* smoothed round trip time << 3 */ 305 u32 srtt; /* smoothed round trip time << 3 */
@@ -310,6 +310,10 @@ struct tcp_sock {
310 310
311 u32 packets_out; /* Packets which are "in flight" */ 311 u32 packets_out; /* Packets which are "in flight" */
312 u32 retrans_out; /* Retransmitted packets out */ 312 u32 retrans_out; /* Retransmitted packets out */
313
314 u16 urg_data; /* Saved octet of OOB data and control flags */
315 u8 urg_mode; /* In urgent mode */
316 u8 ecn_flags; /* ECN status bits. */
313/* 317/*
314 * Options received (usually on last packet, some only on SYN packets). 318 * Options received (usually on last packet, some only on SYN packets).
315 */ 319 */
@@ -325,13 +329,24 @@ struct tcp_sock {
325 u32 snd_cwnd_used; 329 u32 snd_cwnd_used;
326 u32 snd_cwnd_stamp; 330 u32 snd_cwnd_stamp;
327 331
328 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
329
330 u32 rcv_wnd; /* Current receiver window */ 332 u32 rcv_wnd; /* Current receiver window */
331 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ 333 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
332 u32 pushed_seq; /* Last pushed seq, required to talk to windows */ 334 u32 pushed_seq; /* Last pushed seq, required to talk to windows */
335 u32 lost_out; /* Lost packets */
336 u32 sacked_out; /* SACK'd packets */
337 u32 fackets_out; /* FACK'd packets */
338 u32 tso_deferred;
339 u32 bytes_acked; /* Appropriate Byte Counting - RFC3465 */
333 340
334/* SACKs data */ 341 /* from STCP, retrans queue hinting */
342 struct sk_buff* lost_skb_hint;
343 struct sk_buff *scoreboard_skb_hint;
344 struct sk_buff *retransmit_skb_hint;
345 struct sk_buff *forward_skb_hint;
346
347 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
348
349 /* SACKs data, these 2 need to be together (see tcp_build_and_update_options) */
335 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ 350 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
336 struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ 351 struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/
337 352
@@ -342,23 +357,14 @@ struct tcp_sock {
342 * sacked_out > 0) 357 * sacked_out > 0)
343 */ 358 */
344 359
345 /* from STCP, retrans queue hinting */
346 struct sk_buff* lost_skb_hint;
347
348 struct sk_buff *scoreboard_skb_hint;
349 struct sk_buff *retransmit_skb_hint;
350 struct sk_buff *forward_skb_hint;
351
352 int lost_cnt_hint; 360 int lost_cnt_hint;
353 int retransmit_cnt_hint; 361 int retransmit_cnt_hint;
354 362
355 u32 lost_retrans_low; /* Sent seq after any rxmit (lowest) */ 363 u32 lost_retrans_low; /* Sent seq after any rxmit (lowest) */
356 364
357 u16 advmss; /* Advertised MSS */ 365 u8 reordering; /* Packet reordering metric. */
358 u16 prior_ssthresh; /* ssthresh saved at recovery start */ 366 u8 keepalive_probes; /* num of allowed keep alive probes */
359 u32 lost_out; /* Lost packets */ 367 u32 prior_ssthresh; /* ssthresh saved at recovery start */
360 u32 sacked_out; /* SACK'd packets */
361 u32 fackets_out; /* FACK'd packets */
362 u32 high_seq; /* snd_nxt at onset of congestion */ 368 u32 high_seq; /* snd_nxt at onset of congestion */
363 369
364 u32 retrans_stamp; /* Timestamp of the last retransmit, 370 u32 retrans_stamp; /* Timestamp of the last retransmit,
@@ -366,25 +372,16 @@ struct tcp_sock {
366 * the first SYN. */ 372 * the first SYN. */
367 u32 undo_marker; /* tracking retrans started here. */ 373 u32 undo_marker; /* tracking retrans started here. */
368 int undo_retrans; /* number of undoable retransmissions. */ 374 int undo_retrans; /* number of undoable retransmissions. */
375 u32 total_retrans; /* Total retransmits for entire connection */
376
369 u32 urg_seq; /* Seq of received urgent pointer */ 377 u32 urg_seq; /* Seq of received urgent pointer */
370 u16 urg_data; /* Saved octet of OOB data and control flags */
371 u8 urg_mode; /* In urgent mode */
372 u8 ecn_flags; /* ECN status bits. */
373 u32 snd_up; /* Urgent pointer */ 378 u32 snd_up; /* Urgent pointer */
374 379
375 u32 total_retrans; /* Total retransmits for entire connection */
376 u32 bytes_acked; /* Appropriate Byte Counting - RFC3465 */
377
378 unsigned int keepalive_time; /* time before keep alive takes place */ 380 unsigned int keepalive_time; /* time before keep alive takes place */
379 unsigned int keepalive_intvl; /* time interval between keep alive probes */ 381 unsigned int keepalive_intvl; /* time interval between keep alive probes */
380 int linger2;
381
382 struct tcp_deferred_accept_info defer_tcp_accept;
383 382
384 unsigned long last_synq_overflow; 383 unsigned long last_synq_overflow;
385 384
386 u32 tso_deferred;
387
388/* Receiver side RTT estimation */ 385/* Receiver side RTT estimation */
389 struct { 386 struct {
390 u32 rtt; 387 u32 rtt;
@@ -412,6 +409,8 @@ struct tcp_sock {
412/* TCP MD5 Signagure Option information */ 409/* TCP MD5 Signagure Option information */
413 struct tcp_md5sig_info *md5sig_info; 410 struct tcp_md5sig_info *md5sig_info;
414#endif 411#endif
412
413 int linger2;
415}; 414};
416 415
417static inline struct tcp_sock *tcp_sk(const struct sock *sk) 416static inline struct tcp_sock *tcp_sk(const struct sock *sk)
diff --git a/include/linux/textsearch.h b/include/linux/textsearch.h
index 6f371f24160..d9a85d61638 100644
--- a/include/linux/textsearch.h
+++ b/include/linux/textsearch.h
@@ -10,10 +10,8 @@
10 10
11struct ts_config; 11struct ts_config;
12 12
13/** 13#define TS_AUTOLOAD 1 /* Automatically load textsearch modules when needed */
14 * TS_AUTOLOAD - Automatically load textsearch modules when needed 14#define TS_IGNORECASE 2 /* Searches string case insensitively */
15 */
16#define TS_AUTOLOAD 1
17 15
18/** 16/**
19 * struct ts_state - search state 17 * struct ts_state - search state
@@ -39,7 +37,7 @@ struct ts_state
39struct ts_ops 37struct ts_ops
40{ 38{
41 const char *name; 39 const char *name;
42 struct ts_config * (*init)(const void *, unsigned int, gfp_t); 40 struct ts_config * (*init)(const void *, unsigned int, gfp_t, int);
43 unsigned int (*find)(struct ts_config *, 41 unsigned int (*find)(struct ts_config *,
44 struct ts_state *); 42 struct ts_state *);
45 void (*destroy)(struct ts_config *); 43 void (*destroy)(struct ts_config *);
@@ -52,12 +50,14 @@ struct ts_ops
52/** 50/**
53 * struct ts_config - search configuration 51 * struct ts_config - search configuration
54 * @ops: operations of chosen algorithm 52 * @ops: operations of chosen algorithm
53 * @flags: flags
55 * @get_next_block: callback to fetch the next block to search in 54 * @get_next_block: callback to fetch the next block to search in
56 * @finish: callback to finalize a search 55 * @finish: callback to finalize a search
57 */ 56 */
58struct ts_config 57struct ts_config
59{ 58{
60 struct ts_ops *ops; 59 struct ts_ops *ops;
60 int flags;
61 61
62 /** 62 /**
63 * get_next_block - fetch next block of data 63 * get_next_block - fetch next block of data
@@ -162,11 +162,10 @@ static inline struct ts_config *alloc_ts_config(size_t payload,
162{ 162{
163 struct ts_config *conf; 163 struct ts_config *conf;
164 164
165 conf = kmalloc(TS_PRIV_ALIGN(sizeof(*conf)) + payload, gfp_mask); 165 conf = kzalloc(TS_PRIV_ALIGN(sizeof(*conf)) + payload, gfp_mask);
166 if (conf == NULL) 166 if (conf == NULL)
167 return ERR_PTR(-ENOMEM); 167 return ERR_PTR(-ENOMEM);
168 168
169 memset(conf, 0, TS_PRIV_ALIGN(sizeof(*conf)) + payload);
170 return conf; 169 return conf;
171} 170}
172 171
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 06d3e6eb9ca..917707e6151 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -66,8 +66,7 @@ struct thermal_cooling_device {
66 ((long)t-2732+5)/10 : ((long)t-2732-5)/10) 66 ((long)t-2732+5)/10 : ((long)t-2732-5)/10)
67#define CELSIUS_TO_KELVIN(t) ((t)*10+2732) 67#define CELSIUS_TO_KELVIN(t) ((t)*10+2732)
68 68
69#if defined(CONFIG_HWMON) || \ 69#if defined(CONFIG_THERMAL_HWMON)
70 (defined(CONFIG_HWMON_MODULE) && defined(CONFIG_THERMAL_MODULE))
71/* thermal zone devices with the same type share one hwmon device */ 70/* thermal zone devices with the same type share one hwmon device */
72struct thermal_hwmon_device { 71struct thermal_hwmon_device {
73 char type[THERMAL_NAME_LENGTH]; 72 char type[THERMAL_NAME_LENGTH];
@@ -94,8 +93,7 @@ struct thermal_zone_device {
94 struct idr idr; 93 struct idr idr;
95 struct mutex lock; /* protect cooling devices list */ 94 struct mutex lock; /* protect cooling devices list */
96 struct list_head node; 95 struct list_head node;
97#if defined(CONFIG_HWMON) || \ 96#if defined(CONFIG_THERMAL_HWMON)
98 (defined(CONFIG_HWMON_MODULE) && defined(CONFIG_THERMAL_MODULE))
99 struct list_head hwmon_node; 97 struct list_head hwmon_node;
100 struct thermal_hwmon_device *hwmon; 98 struct thermal_hwmon_device *hwmon;
101 struct thermal_hwmon_attr temp_input; /* hwmon sys attr */ 99 struct thermal_hwmon_attr temp_input; /* hwmon sys attr */
diff --git a/include/linux/tick.h b/include/linux/tick.h
index a881c652f7e..d3c02695dc5 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -49,6 +49,7 @@ struct tick_sched {
49 unsigned long check_clocks; 49 unsigned long check_clocks;
50 enum tick_nohz_mode nohz_mode; 50 enum tick_nohz_mode nohz_mode;
51 ktime_t idle_tick; 51 ktime_t idle_tick;
52 int inidle;
52 int tick_stopped; 53 int tick_stopped;
53 unsigned long idle_jiffies; 54 unsigned long idle_jiffies;
54 unsigned long idle_calls; 55 unsigned long idle_calls;
@@ -105,14 +106,14 @@ static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
105#endif /* !CONFIG_GENERIC_CLOCKEVENTS */ 106#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
106 107
107# ifdef CONFIG_NO_HZ 108# ifdef CONFIG_NO_HZ
108extern void tick_nohz_stop_sched_tick(void); 109extern void tick_nohz_stop_sched_tick(int inidle);
109extern void tick_nohz_restart_sched_tick(void); 110extern void tick_nohz_restart_sched_tick(void);
110extern void tick_nohz_update_jiffies(void); 111extern void tick_nohz_update_jiffies(void);
111extern ktime_t tick_nohz_get_sleep_length(void); 112extern ktime_t tick_nohz_get_sleep_length(void);
112extern void tick_nohz_stop_idle(int cpu); 113extern void tick_nohz_stop_idle(int cpu);
113extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); 114extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
114# else 115# else
115static inline void tick_nohz_stop_sched_tick(void) { } 116static inline void tick_nohz_stop_sched_tick(int inidle) { }
116static inline void tick_nohz_restart_sched_tick(void) { } 117static inline void tick_nohz_restart_sched_tick(void) { }
117static inline void tick_nohz_update_jiffies(void) { } 118static inline void tick_nohz_update_jiffies(void) { }
118static inline ktime_t tick_nohz_get_sleep_length(void) 119static inline ktime_t tick_nohz_get_sleep_length(void)
diff --git a/include/linux/time.h b/include/linux/time.h
index d32ef0ad4c0..e15206a7e82 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -6,6 +6,7 @@
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7# include <linux/cache.h> 7# include <linux/cache.h>
8# include <linux/seqlock.h> 8# include <linux/seqlock.h>
9# include <linux/math64.h>
9#endif 10#endif
10 11
11#ifndef _STRUCT_TIMESPEC 12#ifndef _STRUCT_TIMESPEC
@@ -169,18 +170,13 @@ extern struct timeval ns_to_timeval(const s64 nsec);
169 * timespec_add_ns - Adds nanoseconds to a timespec 170 * timespec_add_ns - Adds nanoseconds to a timespec
170 * @a: pointer to timespec to be incremented 171 * @a: pointer to timespec to be incremented
171 * @ns: unsigned nanoseconds value to be added 172 * @ns: unsigned nanoseconds value to be added
173 *
174 * This must always be inlined because its used from the x86-64 vdso,
175 * which cannot call other kernel functions.
172 */ 176 */
173static inline void timespec_add_ns(struct timespec *a, u64 ns) 177static __always_inline void timespec_add_ns(struct timespec *a, u64 ns)
174{ 178{
175 ns += a->tv_nsec; 179 a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns);
176 while(unlikely(ns >= NSEC_PER_SEC)) {
177 /* The following asm() prevents the compiler from
178 * optimising this loop into a modulo operation. */
179 asm("" : "+r"(ns));
180
181 ns -= NSEC_PER_SEC;
182 a->tv_sec++;
183 }
184 a->tv_nsec = ns; 180 a->tv_nsec = ns;
185} 181}
186#endif /* __KERNEL__ */ 182#endif /* __KERNEL__ */
diff --git a/include/linux/timerfd.h b/include/linux/timerfd.h
index cf2b10d7573..86cb0501d3e 100644
--- a/include/linux/timerfd.h
+++ b/include/linux/timerfd.h
@@ -8,9 +8,15 @@
8#ifndef _LINUX_TIMERFD_H 8#ifndef _LINUX_TIMERFD_H
9#define _LINUX_TIMERFD_H 9#define _LINUX_TIMERFD_H
10 10
11/* For O_CLOEXEC and O_NONBLOCK */
12#include <linux/fcntl.h>
11 13
14/* Flags for timerfd_settime. */
12#define TFD_TIMER_ABSTIME (1 << 0) 15#define TFD_TIMER_ABSTIME (1 << 0)
13 16
17/* Flags for timerfd_create. */
18#define TFD_CLOEXEC O_CLOEXEC
19#define TFD_NONBLOCK O_NONBLOCK
14 20
15 21
16#endif /* _LINUX_TIMERFD_H */ 22#endif /* _LINUX_TIMERFD_H */
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
index b0c916d1f37..2bc6fa4adeb 100644
--- a/include/linux/tipc_config.h
+++ b/include/linux/tipc_config.h
@@ -2,7 +2,7 @@
2 * include/linux/tipc_config.h: Include file for TIPC configuration interface 2 * include/linux/tipc_config.h: Include file for TIPC configuration interface
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005-2007, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -136,6 +136,14 @@
136#define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */ 136#define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */
137 137
138/* 138/*
139 * Reserved commands:
140 * May not be issued by any process.
141 * Used internally by TIPC.
142 */
143
144#define TIPC_CMD_NOT_NET_ADMIN 0xC001 /* tx none, rx none */
145
146/*
139 * TLV types defined for TIPC 147 * TLV types defined for TIPC
140 */ 148 */
141 149
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 4bb7074a2c3..2158fc0d5a5 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -166,7 +166,9 @@ void arch_update_cpu_topology(void);
166 .busy_idx = 3, \ 166 .busy_idx = 3, \
167 .idle_idx = 3, \ 167 .idle_idx = 3, \
168 .flags = SD_LOAD_BALANCE \ 168 .flags = SD_LOAD_BALANCE \
169 | SD_SERIALIZE, \ 169 | SD_BALANCE_NEWIDLE \
170 | SD_WAKE_AFFINE \
171 | SD_SERIALIZE, \
170 .last_balance = jiffies, \ 172 .last_balance = jiffies, \
171 .balance_interval = 64, \ 173 .balance_interval = 64, \
172} 174}
@@ -177,4 +179,17 @@ void arch_update_cpu_topology(void);
177#endif 179#endif
178#endif /* CONFIG_NUMA */ 180#endif /* CONFIG_NUMA */
179 181
182#ifndef topology_physical_package_id
183#define topology_physical_package_id(cpu) ((void)(cpu), -1)
184#endif
185#ifndef topology_core_id
186#define topology_core_id(cpu) ((void)(cpu), 0)
187#endif
188#ifndef topology_thread_siblings
189#define topology_thread_siblings(cpu) cpumask_of_cpu(cpu)
190#endif
191#ifndef topology_core_siblings
192#define topology_core_siblings(cpu) cpumask_of_cpu(cpu)
193#endif
194
180#endif /* _LINUX_TOPOLOGY_H */ 195#endif /* _LINUX_TOPOLOGY_H */
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
new file mode 100644
index 00000000000..b1875582c1a
--- /dev/null
+++ b/include/linux/tracehook.h
@@ -0,0 +1,576 @@
1/*
2 * Tracing hooks
3 *
4 * Copyright (C) 2008 Red Hat, Inc. All rights reserved.
5 *
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU General Public License v.2.
9 *
10 * This file defines hook entry points called by core code where
11 * user tracing/debugging support might need to do something. These
12 * entry points are called tracehook_*(). Each hook declared below
13 * has a detailed kerneldoc comment giving the context (locking et
14 * al) from which it is called, and the meaning of its return value.
15 *
16 * Each function here typically has only one call site, so it is ok
17 * to have some nontrivial tracehook_*() inlines. In all cases, the
18 * fast path when no tracing is enabled should be very short.
19 *
20 * The purpose of this file and the tracehook_* layer is to consolidate
21 * the interface that the kernel core and arch code uses to enable any
22 * user debugging or tracing facility (such as ptrace). The interfaces
23 * here are carefully documented so that maintainers of core and arch
24 * code do not need to think about the implementation details of the
25 * tracing facilities. Likewise, maintainers of the tracing code do not
26 * need to understand all the calling core or arch code in detail, just
27 * documented circumstances of each call, such as locking conditions.
28 *
29 * If the calling core code changes so that locking is different, then
30 * it is ok to change the interface documented here. The maintainer of
31 * core code changing should notify the maintainers of the tracing code
32 * that they need to work out the change.
33 *
34 * Some tracehook_*() inlines take arguments that the current tracing
35 * implementations might not necessarily use. These function signatures
36 * are chosen to pass in all the information that is on hand in the
37 * caller and might conceivably be relevant to a tracer, so that the
38 * core code won't have to be updated when tracing adds more features.
39 * If a call site changes so that some of those parameters are no longer
40 * already on hand without extra work, then the tracehook_* interface
41 * can change so there is no make-work burden on the core code. The
42 * maintainer of core code changing should notify the maintainers of the
43 * tracing code that they need to work out the change.
44 */
45
46#ifndef _LINUX_TRACEHOOK_H
47#define _LINUX_TRACEHOOK_H 1
48
49#include <linux/sched.h>
50#include <linux/ptrace.h>
51#include <linux/security.h>
52struct linux_binprm;
53
54/**
55 * tracehook_expect_breakpoints - guess if task memory might be touched
56 * @task: current task, making a new mapping
57 *
58 * Return nonzero if @task is expected to want breakpoint insertion in
59 * its memory at some point. A zero return is no guarantee it won't
60 * be done, but this is a hint that it's known to be likely.
61 *
62 * May be called with @task->mm->mmap_sem held for writing.
63 */
64static inline int tracehook_expect_breakpoints(struct task_struct *task)
65{
66 return (task_ptrace(task) & PT_PTRACED) != 0;
67}
68
69/*
70 * ptrace report for syscall entry and exit looks identical.
71 */
72static inline void ptrace_report_syscall(struct pt_regs *regs)
73{
74 int ptrace = task_ptrace(current);
75
76 if (!(ptrace & PT_PTRACED))
77 return;
78
79 ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
80
81 /*
82 * this isn't the same as continuing with a signal, but it will do
83 * for normal use. strace only continues with a signal if the
84 * stopping signal is not SIGTRAP. -brl
85 */
86 if (current->exit_code) {
87 send_sig(current->exit_code, current, 1);
88 current->exit_code = 0;
89 }
90}
91
92/**
93 * tracehook_report_syscall_entry - task is about to attempt a system call
94 * @regs: user register state of current task
95 *
96 * This will be called if %TIF_SYSCALL_TRACE has been set, when the
97 * current task has just entered the kernel for a system call.
98 * Full user register state is available here. Changing the values
99 * in @regs can affect the system call number and arguments to be tried.
100 * It is safe to block here, preventing the system call from beginning.
101 *
102 * Returns zero normally, or nonzero if the calling arch code should abort
103 * the system call. That must prevent normal entry so no system call is
104 * made. If @task ever returns to user mode after this, its register state
105 * is unspecified, but should be something harmless like an %ENOSYS error
106 * return. It should preserve enough information so that syscall_rollback()
107 * can work (see asm-generic/syscall.h).
108 *
109 * Called without locks, just after entering kernel mode.
110 */
111static inline __must_check int tracehook_report_syscall_entry(
112 struct pt_regs *regs)
113{
114 ptrace_report_syscall(regs);
115 return 0;
116}
117
118/**
119 * tracehook_report_syscall_exit - task has just finished a system call
120 * @regs: user register state of current task
121 * @step: nonzero if simulating single-step or block-step
122 *
123 * This will be called if %TIF_SYSCALL_TRACE has been set, when the
124 * current task has just finished an attempted system call. Full
125 * user register state is available here. It is safe to block here,
126 * preventing signals from being processed.
127 *
128 * If @step is nonzero, this report is also in lieu of the normal
129 * trap that would follow the system call instruction because
130 * user_enable_block_step() or user_enable_single_step() was used.
131 * In this case, %TIF_SYSCALL_TRACE might not be set.
132 *
133 * Called without locks, just before checking for pending signals.
134 */
135static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
136{
137 ptrace_report_syscall(regs);
138}
139
140/**
141 * tracehook_unsafe_exec - check for exec declared unsafe due to tracing
142 * @task: current task doing exec
143 *
144 * Return %LSM_UNSAFE_* bits applied to an exec because of tracing.
145 *
146 * Called with task_lock() held on @task.
147 */
148static inline int tracehook_unsafe_exec(struct task_struct *task)
149{
150 int unsafe = 0;
151 int ptrace = task_ptrace(task);
152 if (ptrace & PT_PTRACED) {
153 if (ptrace & PT_PTRACE_CAP)
154 unsafe |= LSM_UNSAFE_PTRACE_CAP;
155 else
156 unsafe |= LSM_UNSAFE_PTRACE;
157 }
158 return unsafe;
159}
160
161/**
162 * tracehook_tracer_task - return the task that is tracing the given task
163 * @tsk: task to consider
164 *
165 * Returns NULL if noone is tracing @task, or the &struct task_struct
166 * pointer to its tracer.
167 *
168 * Must called under rcu_read_lock(). The pointer returned might be kept
169 * live only by RCU. During exec, this may be called with task_lock()
170 * held on @task, still held from when tracehook_unsafe_exec() was called.
171 */
172static inline struct task_struct *tracehook_tracer_task(struct task_struct *tsk)
173{
174 if (task_ptrace(tsk) & PT_PTRACED)
175 return rcu_dereference(tsk->parent);
176 return NULL;
177}
178
179/**
180 * tracehook_report_exec - a successful exec was completed
181 * @fmt: &struct linux_binfmt that performed the exec
182 * @bprm: &struct linux_binprm containing exec details
183 * @regs: user-mode register state
184 *
185 * An exec just completed, we are shortly going to return to user mode.
186 * The freshly initialized register state can be seen and changed in @regs.
187 * The name, file and other pointers in @bprm are still on hand to be
188 * inspected, but will be freed as soon as this returns.
189 *
190 * Called with no locks, but with some kernel resources held live
191 * and a reference on @fmt->module.
192 */
193static inline void tracehook_report_exec(struct linux_binfmt *fmt,
194 struct linux_binprm *bprm,
195 struct pt_regs *regs)
196{
197 if (!ptrace_event(PT_TRACE_EXEC, PTRACE_EVENT_EXEC, 0) &&
198 unlikely(task_ptrace(current) & PT_PTRACED))
199 send_sig(SIGTRAP, current, 0);
200}
201
202/**
203 * tracehook_report_exit - task has begun to exit
204 * @exit_code: pointer to value destined for @current->exit_code
205 *
206 * @exit_code points to the value passed to do_exit(), which tracing
207 * might change here. This is almost the first thing in do_exit(),
208 * before freeing any resources or setting the %PF_EXITING flag.
209 *
210 * Called with no locks held.
211 */
212static inline void tracehook_report_exit(long *exit_code)
213{
214 ptrace_event(PT_TRACE_EXIT, PTRACE_EVENT_EXIT, *exit_code);
215}
216
217/**
218 * tracehook_prepare_clone - prepare for new child to be cloned
219 * @clone_flags: %CLONE_* flags from clone/fork/vfork system call
220 *
221 * This is called before a new user task is to be cloned.
222 * Its return value will be passed to tracehook_finish_clone().
223 *
224 * Called with no locks held.
225 */
226static inline int tracehook_prepare_clone(unsigned clone_flags)
227{
228 if (clone_flags & CLONE_UNTRACED)
229 return 0;
230
231 if (clone_flags & CLONE_VFORK) {
232 if (current->ptrace & PT_TRACE_VFORK)
233 return PTRACE_EVENT_VFORK;
234 } else if ((clone_flags & CSIGNAL) != SIGCHLD) {
235 if (current->ptrace & PT_TRACE_CLONE)
236 return PTRACE_EVENT_CLONE;
237 } else if (current->ptrace & PT_TRACE_FORK)
238 return PTRACE_EVENT_FORK;
239
240 return 0;
241}
242
243/**
244 * tracehook_finish_clone - new child created and being attached
245 * @child: new child task
246 * @clone_flags: %CLONE_* flags from clone/fork/vfork system call
247 * @trace: return value from tracehook_prepare_clone()
248 *
249 * This is called immediately after adding @child to its parent's children list.
250 * The @trace value is that returned by tracehook_prepare_clone().
251 *
252 * Called with current's siglock and write_lock_irq(&tasklist_lock) held.
253 */
254static inline void tracehook_finish_clone(struct task_struct *child,
255 unsigned long clone_flags, int trace)
256{
257 ptrace_init_task(child, (clone_flags & CLONE_PTRACE) || trace);
258}
259
260/**
261 * tracehook_report_clone - in parent, new child is about to start running
262 * @trace: return value from tracehook_prepare_clone()
263 * @regs: parent's user register state
264 * @clone_flags: flags from parent's system call
265 * @pid: new child's PID in the parent's namespace
266 * @child: new child task
267 *
268 * Called after a child is set up, but before it has been started
269 * running. @trace is the value returned by tracehook_prepare_clone().
270 * This is not a good place to block, because the child has not started
271 * yet. Suspend the child here if desired, and then block in
272 * tracehook_report_clone_complete(). This must prevent the child from
273 * self-reaping if tracehook_report_clone_complete() uses the @child
274 * pointer; otherwise it might have died and been released by the time
275 * tracehook_report_report_clone_complete() is called.
276 *
277 * Called with no locks held, but the child cannot run until this returns.
278 */
279static inline void tracehook_report_clone(int trace, struct pt_regs *regs,
280 unsigned long clone_flags,
281 pid_t pid, struct task_struct *child)
282{
283 if (unlikely(trace)) {
284 /*
285 * The child starts up with an immediate SIGSTOP.
286 */
287 sigaddset(&child->pending.signal, SIGSTOP);
288 set_tsk_thread_flag(child, TIF_SIGPENDING);
289 }
290}
291
292/**
293 * tracehook_report_clone_complete - new child is running
294 * @trace: return value from tracehook_prepare_clone()
295 * @regs: parent's user register state
296 * @clone_flags: flags from parent's system call
297 * @pid: new child's PID in the parent's namespace
298 * @child: child task, already running
299 *
300 * This is called just after the child has started running. This is
301 * just before the clone/fork syscall returns, or blocks for vfork
302 * child completion if @clone_flags has the %CLONE_VFORK bit set.
303 * The @child pointer may be invalid if a self-reaping child died and
304 * tracehook_report_clone() took no action to prevent it from self-reaping.
305 *
306 * Called with no locks held.
307 */
308static inline void tracehook_report_clone_complete(int trace,
309 struct pt_regs *regs,
310 unsigned long clone_flags,
311 pid_t pid,
312 struct task_struct *child)
313{
314 if (unlikely(trace))
315 ptrace_event(0, trace, pid);
316}
317
318/**
319 * tracehook_report_vfork_done - vfork parent's child has exited or exec'd
320 * @child: child task, already running
321 * @pid: new child's PID in the parent's namespace
322 *
323 * Called after a %CLONE_VFORK parent has waited for the child to complete.
324 * The clone/vfork system call will return immediately after this.
325 * The @child pointer may be invalid if a self-reaping child died and
326 * tracehook_report_clone() took no action to prevent it from self-reaping.
327 *
328 * Called with no locks held.
329 */
330static inline void tracehook_report_vfork_done(struct task_struct *child,
331 pid_t pid)
332{
333 ptrace_event(PT_TRACE_VFORK_DONE, PTRACE_EVENT_VFORK_DONE, pid);
334}
335
336/**
337 * tracehook_prepare_release_task - task is being reaped, clean up tracing
338 * @task: task in %EXIT_DEAD state
339 *
340 * This is called in release_task() just before @task gets finally reaped
341 * and freed. This would be the ideal place to remove and clean up any
342 * tracing-related state for @task.
343 *
344 * Called with no locks held.
345 */
346static inline void tracehook_prepare_release_task(struct task_struct *task)
347{
348}
349
350/**
351 * tracehook_finish_release_task - final tracing clean-up
352 * @task: task in %EXIT_DEAD state
353 *
354 * This is called in release_task() when @task is being in the middle of
355 * being reaped. After this, there must be no tracing entanglements.
356 *
357 * Called with write_lock_irq(&tasklist_lock) held.
358 */
359static inline void tracehook_finish_release_task(struct task_struct *task)
360{
361 ptrace_release_task(task);
362}
363
364/**
365 * tracehook_signal_handler - signal handler setup is complete
366 * @sig: number of signal being delivered
367 * @info: siginfo_t of signal being delivered
368 * @ka: sigaction setting that chose the handler
369 * @regs: user register state
370 * @stepping: nonzero if debugger single-step or block-step in use
371 *
372 * Called by the arch code after a signal handler has been set up.
373 * Register and stack state reflects the user handler about to run.
374 * Signal mask changes have already been made.
375 *
376 * Called without locks, shortly before returning to user mode
377 * (or handling more signals).
378 */
379static inline void tracehook_signal_handler(int sig, siginfo_t *info,
380 const struct k_sigaction *ka,
381 struct pt_regs *regs, int stepping)
382{
383 if (stepping)
384 ptrace_notify(SIGTRAP);
385}
386
387/**
388 * tracehook_consider_ignored_signal - suppress short-circuit of ignored signal
389 * @task: task receiving the signal
390 * @sig: signal number being sent
391 * @handler: %SIG_IGN or %SIG_DFL
392 *
393 * Return zero iff tracing doesn't care to examine this ignored signal,
394 * so it can short-circuit normal delivery and never even get queued.
395 * Either @handler is %SIG_DFL and @sig's default is ignore, or it's %SIG_IGN.
396 *
397 * Called with @task->sighand->siglock held.
398 */
399static inline int tracehook_consider_ignored_signal(struct task_struct *task,
400 int sig,
401 void __user *handler)
402{
403 return (task_ptrace(task) & PT_PTRACED) != 0;
404}
405
406/**
407 * tracehook_consider_fatal_signal - suppress special handling of fatal signal
408 * @task: task receiving the signal
409 * @sig: signal number being sent
410 * @handler: %SIG_DFL or %SIG_IGN
411 *
412 * Return nonzero to prevent special handling of this termination signal.
413 * Normally @handler is %SIG_DFL. It can be %SIG_IGN if @sig is ignored,
414 * in which case force_sig() is about to reset it to %SIG_DFL.
415 * When this returns zero, this signal might cause a quick termination
416 * that does not give the debugger a chance to intercept the signal.
417 *
418 * Called with or without @task->sighand->siglock held.
419 */
420static inline int tracehook_consider_fatal_signal(struct task_struct *task,
421 int sig,
422 void __user *handler)
423{
424 return (task_ptrace(task) & PT_PTRACED) != 0;
425}
426
427/**
428 * tracehook_force_sigpending - let tracing force signal_pending(current) on
429 *
430 * Called when recomputing our signal_pending() flag. Return nonzero
431 * to force the signal_pending() flag on, so that tracehook_get_signal()
432 * will be called before the next return to user mode.
433 *
434 * Called with @current->sighand->siglock held.
435 */
436static inline int tracehook_force_sigpending(void)
437{
438 return 0;
439}
440
441/**
442 * tracehook_get_signal - deliver synthetic signal to traced task
443 * @task: @current
444 * @regs: task_pt_regs(@current)
445 * @info: details of synthetic signal
446 * @return_ka: sigaction for synthetic signal
447 *
448 * Return zero to check for a real pending signal normally.
449 * Return -1 after releasing the siglock to repeat the check.
450 * Return a signal number to induce an artifical signal delivery,
451 * setting *@info and *@return_ka to specify its details and behavior.
452 *
453 * The @return_ka->sa_handler value controls the disposition of the
454 * signal, no matter the signal number. For %SIG_DFL, the return value
455 * is a representative signal to indicate the behavior (e.g. %SIGTERM
456 * for death, %SIGQUIT for core dump, %SIGSTOP for job control stop,
457 * %SIGTSTP for stop unless in an orphaned pgrp), but the signal number
458 * reported will be @info->si_signo instead.
459 *
460 * Called with @task->sighand->siglock held, before dequeuing pending signals.
461 */
462static inline int tracehook_get_signal(struct task_struct *task,
463 struct pt_regs *regs,
464 siginfo_t *info,
465 struct k_sigaction *return_ka)
466{
467 return 0;
468}
469
470/**
471 * tracehook_notify_jctl - report about job control stop/continue
472 * @notify: nonzero if this is the last thread in the group to stop
473 * @why: %CLD_STOPPED or %CLD_CONTINUED
474 *
475 * This is called when we might call do_notify_parent_cldstop().
476 * It's called when about to stop for job control; we are already in
477 * %TASK_STOPPED state, about to call schedule(). It's also called when
478 * a delayed %CLD_STOPPED or %CLD_CONTINUED report is ready to be made.
479 *
480 * Return nonzero to generate a %SIGCHLD with @why, which is
481 * normal if @notify is nonzero.
482 *
483 * Called with no locks held.
484 */
485static inline int tracehook_notify_jctl(int notify, int why)
486{
487 return notify || (current->ptrace & PT_PTRACED);
488}
489
490/**
491 * tracehook_notify_death - task is dead, ready to notify parent
492 * @task: @current task now exiting
493 * @death_cookie: value to pass to tracehook_report_death()
494 * @group_dead: nonzero if this was the last thread in the group to die
495 *
496 * Return the signal number to send our parent with do_notify_parent(), or
497 * zero to send no signal and leave a zombie, or -1 to self-reap right now.
498 *
499 * Called with write_lock_irq(&tasklist_lock) held.
500 */
501static inline int tracehook_notify_death(struct task_struct *task,
502 void **death_cookie, int group_dead)
503{
504 if (task->exit_signal == -1)
505 return task->ptrace ? SIGCHLD : -1;
506
507 /*
508 * If something other than our normal parent is ptracing us, then
509 * send it a SIGCHLD instead of honoring exit_signal. exit_signal
510 * only has special meaning to our real parent.
511 */
512 if (thread_group_empty(task) && !ptrace_reparented(task))
513 return task->exit_signal;
514
515 return task->ptrace ? SIGCHLD : 0;
516}
517
518/**
519 * tracehook_report_death - task is dead and ready to be reaped
520 * @task: @current task now exiting
521 * @signal: signal number sent to parent, or 0 or -1
522 * @death_cookie: value passed back from tracehook_notify_death()
523 * @group_dead: nonzero if this was the last thread in the group to die
524 *
525 * Thread has just become a zombie or is about to self-reap. If positive,
526 * @signal is the signal number just sent to the parent (usually %SIGCHLD).
527 * If @signal is -1, this thread will self-reap. If @signal is 0, this is
528 * a delayed_group_leader() zombie. The @death_cookie was passed back by
529 * tracehook_notify_death().
530 *
531 * If normal reaping is not inhibited, @task->exit_state might be changing
532 * in parallel.
533 *
534 * Called without locks.
535 */
536static inline void tracehook_report_death(struct task_struct *task,
537 int signal, void *death_cookie,
538 int group_dead)
539{
540}
541
542#ifdef TIF_NOTIFY_RESUME
543/**
544 * set_notify_resume - cause tracehook_notify_resume() to be called
545 * @task: task that will call tracehook_notify_resume()
546 *
547 * Calling this arranges that @task will call tracehook_notify_resume()
548 * before returning to user mode. If it's already running in user mode,
549 * it will enter the kernel and call tracehook_notify_resume() soon.
550 * If it's blocked, it will not be woken.
551 */
552static inline void set_notify_resume(struct task_struct *task)
553{
554 if (!test_and_set_tsk_thread_flag(task, TIF_NOTIFY_RESUME))
555 kick_process(task);
556}
557
558/**
559 * tracehook_notify_resume - report when about to return to user mode
560 * @regs: user-mode registers of @current task
561 *
562 * This is called when %TIF_NOTIFY_RESUME has been set. Now we are
563 * about to return to user mode, and the user state in @regs can be
564 * inspected or adjusted. The caller in arch code has cleared
565 * %TIF_NOTIFY_RESUME before the call. If the flag gets set again
566 * asynchronously, this will be called again before we return to
567 * user mode.
568 *
569 * Called without locks.
570 */
571static inline void tracehook_notify_resume(struct pt_regs *regs)
572{
573}
574#endif /* TIF_NOTIFY_RESUME */
575
576#endif /* <linux/tracehook.h> */
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 7f7121f9c96..e3579cb086e 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -36,7 +36,7 @@
36#define N_6PACK 7 36#define N_6PACK 7
37#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ 37#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
38#define N_R3964 9 /* Reserved for Simatic R3964 module */ 38#define N_R3964 9 /* Reserved for Simatic R3964 module */
39#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ 39#define N_PROFIBUS_FDL 10 /* Reserved for Profibus */
40#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */ 40#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
41#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data */ 41#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data */
42 /* cards about SMS messages */ 42 /* cards about SMS messages */
@@ -71,7 +71,8 @@ struct tty_bufhead {
71 struct tty_buffer *head; /* Queue head */ 71 struct tty_buffer *head; /* Queue head */
72 struct tty_buffer *tail; /* Active buffer */ 72 struct tty_buffer *tail; /* Active buffer */
73 struct tty_buffer *free; /* Free queue head */ 73 struct tty_buffer *free; /* Free queue head */
74 int memory_used; /* Buffer space used excluding free queue */ 74 int memory_used; /* Buffer space used excluding
75 free queue */
75}; 76};
76/* 77/*
77 * When a break, frame error, or parity error happens, these codes are 78 * When a break, frame error, or parity error happens, these codes are
@@ -101,71 +102,96 @@ struct tty_bufhead {
101#define LNEXT_CHAR(tty) ((tty)->termios->c_cc[VLNEXT]) 102#define LNEXT_CHAR(tty) ((tty)->termios->c_cc[VLNEXT])
102#define EOL2_CHAR(tty) ((tty)->termios->c_cc[VEOL2]) 103#define EOL2_CHAR(tty) ((tty)->termios->c_cc[VEOL2])
103 104
104#define _I_FLAG(tty,f) ((tty)->termios->c_iflag & (f)) 105#define _I_FLAG(tty, f) ((tty)->termios->c_iflag & (f))
105#define _O_FLAG(tty,f) ((tty)->termios->c_oflag & (f)) 106#define _O_FLAG(tty, f) ((tty)->termios->c_oflag & (f))
106#define _C_FLAG(tty,f) ((tty)->termios->c_cflag & (f)) 107#define _C_FLAG(tty, f) ((tty)->termios->c_cflag & (f))
107#define _L_FLAG(tty,f) ((tty)->termios->c_lflag & (f)) 108#define _L_FLAG(tty, f) ((tty)->termios->c_lflag & (f))
108 109
109#define I_IGNBRK(tty) _I_FLAG((tty),IGNBRK) 110#define I_IGNBRK(tty) _I_FLAG((tty), IGNBRK)
110#define I_BRKINT(tty) _I_FLAG((tty),BRKINT) 111#define I_BRKINT(tty) _I_FLAG((tty), BRKINT)
111#define I_IGNPAR(tty) _I_FLAG((tty),IGNPAR) 112#define I_IGNPAR(tty) _I_FLAG((tty), IGNPAR)
112#define I_PARMRK(tty) _I_FLAG((tty),PARMRK) 113#define I_PARMRK(tty) _I_FLAG((tty), PARMRK)
113#define I_INPCK(tty) _I_FLAG((tty),INPCK) 114#define I_INPCK(tty) _I_FLAG((tty), INPCK)
114#define I_ISTRIP(tty) _I_FLAG((tty),ISTRIP) 115#define I_ISTRIP(tty) _I_FLAG((tty), ISTRIP)
115#define I_INLCR(tty) _I_FLAG((tty),INLCR) 116#define I_INLCR(tty) _I_FLAG((tty), INLCR)
116#define I_IGNCR(tty) _I_FLAG((tty),IGNCR) 117#define I_IGNCR(tty) _I_FLAG((tty), IGNCR)
117#define I_ICRNL(tty) _I_FLAG((tty),ICRNL) 118#define I_ICRNL(tty) _I_FLAG((tty), ICRNL)
118#define I_IUCLC(tty) _I_FLAG((tty),IUCLC) 119#define I_IUCLC(tty) _I_FLAG((tty), IUCLC)
119#define I_IXON(tty) _I_FLAG((tty),IXON) 120#define I_IXON(tty) _I_FLAG((tty), IXON)
120#define I_IXANY(tty) _I_FLAG((tty),IXANY) 121#define I_IXANY(tty) _I_FLAG((tty), IXANY)
121#define I_IXOFF(tty) _I_FLAG((tty),IXOFF) 122#define I_IXOFF(tty) _I_FLAG((tty), IXOFF)
122#define I_IMAXBEL(tty) _I_FLAG((tty),IMAXBEL) 123#define I_IMAXBEL(tty) _I_FLAG((tty), IMAXBEL)
123#define I_IUTF8(tty) _I_FLAG((tty),IUTF8) 124#define I_IUTF8(tty) _I_FLAG((tty), IUTF8)
124 125
125#define O_OPOST(tty) _O_FLAG((tty),OPOST) 126#define O_OPOST(tty) _O_FLAG((tty), OPOST)
126#define O_OLCUC(tty) _O_FLAG((tty),OLCUC) 127#define O_OLCUC(tty) _O_FLAG((tty), OLCUC)
127#define O_ONLCR(tty) _O_FLAG((tty),ONLCR) 128#define O_ONLCR(tty) _O_FLAG((tty), ONLCR)
128#define O_OCRNL(tty) _O_FLAG((tty),OCRNL) 129#define O_OCRNL(tty) _O_FLAG((tty), OCRNL)
129#define O_ONOCR(tty) _O_FLAG((tty),ONOCR) 130#define O_ONOCR(tty) _O_FLAG((tty), ONOCR)
130#define O_ONLRET(tty) _O_FLAG((tty),ONLRET) 131#define O_ONLRET(tty) _O_FLAG((tty), ONLRET)
131#define O_OFILL(tty) _O_FLAG((tty),OFILL) 132#define O_OFILL(tty) _O_FLAG((tty), OFILL)
132#define O_OFDEL(tty) _O_FLAG((tty),OFDEL) 133#define O_OFDEL(tty) _O_FLAG((tty), OFDEL)
133#define O_NLDLY(tty) _O_FLAG((tty),NLDLY) 134#define O_NLDLY(tty) _O_FLAG((tty), NLDLY)
134#define O_CRDLY(tty) _O_FLAG((tty),CRDLY) 135#define O_CRDLY(tty) _O_FLAG((tty), CRDLY)
135#define O_TABDLY(tty) _O_FLAG((tty),TABDLY) 136#define O_TABDLY(tty) _O_FLAG((tty), TABDLY)
136#define O_BSDLY(tty) _O_FLAG((tty),BSDLY) 137#define O_BSDLY(tty) _O_FLAG((tty), BSDLY)
137#define O_VTDLY(tty) _O_FLAG((tty),VTDLY) 138#define O_VTDLY(tty) _O_FLAG((tty), VTDLY)
138#define O_FFDLY(tty) _O_FLAG((tty),FFDLY) 139#define O_FFDLY(tty) _O_FLAG((tty), FFDLY)
139 140
140#define C_BAUD(tty) _C_FLAG((tty),CBAUD) 141#define C_BAUD(tty) _C_FLAG((tty), CBAUD)
141#define C_CSIZE(tty) _C_FLAG((tty),CSIZE) 142#define C_CSIZE(tty) _C_FLAG((tty), CSIZE)
142#define C_CSTOPB(tty) _C_FLAG((tty),CSTOPB) 143#define C_CSTOPB(tty) _C_FLAG((tty), CSTOPB)
143#define C_CREAD(tty) _C_FLAG((tty),CREAD) 144#define C_CREAD(tty) _C_FLAG((tty), CREAD)
144#define C_PARENB(tty) _C_FLAG((tty),PARENB) 145#define C_PARENB(tty) _C_FLAG((tty), PARENB)
145#define C_PARODD(tty) _C_FLAG((tty),PARODD) 146#define C_PARODD(tty) _C_FLAG((tty), PARODD)
146#define C_HUPCL(tty) _C_FLAG((tty),HUPCL) 147#define C_HUPCL(tty) _C_FLAG((tty), HUPCL)
147#define C_CLOCAL(tty) _C_FLAG((tty),CLOCAL) 148#define C_CLOCAL(tty) _C_FLAG((tty), CLOCAL)
148#define C_CIBAUD(tty) _C_FLAG((tty),CIBAUD) 149#define C_CIBAUD(tty) _C_FLAG((tty), CIBAUD)
149#define C_CRTSCTS(tty) _C_FLAG((tty),CRTSCTS) 150#define C_CRTSCTS(tty) _C_FLAG((tty), CRTSCTS)
150 151
151#define L_ISIG(tty) _L_FLAG((tty),ISIG) 152#define L_ISIG(tty) _L_FLAG((tty), ISIG)
152#define L_ICANON(tty) _L_FLAG((tty),ICANON) 153#define L_ICANON(tty) _L_FLAG((tty), ICANON)
153#define L_XCASE(tty) _L_FLAG((tty),XCASE) 154#define L_XCASE(tty) _L_FLAG((tty), XCASE)
154#define L_ECHO(tty) _L_FLAG((tty),ECHO) 155#define L_ECHO(tty) _L_FLAG((tty), ECHO)
155#define L_ECHOE(tty) _L_FLAG((tty),ECHOE) 156#define L_ECHOE(tty) _L_FLAG((tty), ECHOE)
156#define L_ECHOK(tty) _L_FLAG((tty),ECHOK) 157#define L_ECHOK(tty) _L_FLAG((tty), ECHOK)
157#define L_ECHONL(tty) _L_FLAG((tty),ECHONL) 158#define L_ECHONL(tty) _L_FLAG((tty), ECHONL)
158#define L_NOFLSH(tty) _L_FLAG((tty),NOFLSH) 159#define L_NOFLSH(tty) _L_FLAG((tty), NOFLSH)
159#define L_TOSTOP(tty) _L_FLAG((tty),TOSTOP) 160#define L_TOSTOP(tty) _L_FLAG((tty), TOSTOP)
160#define L_ECHOCTL(tty) _L_FLAG((tty),ECHOCTL) 161#define L_ECHOCTL(tty) _L_FLAG((tty), ECHOCTL)
161#define L_ECHOPRT(tty) _L_FLAG((tty),ECHOPRT) 162#define L_ECHOPRT(tty) _L_FLAG((tty), ECHOPRT)
162#define L_ECHOKE(tty) _L_FLAG((tty),ECHOKE) 163#define L_ECHOKE(tty) _L_FLAG((tty), ECHOKE)
163#define L_FLUSHO(tty) _L_FLAG((tty),FLUSHO) 164#define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO)
164#define L_PENDIN(tty) _L_FLAG((tty),PENDIN) 165#define L_PENDIN(tty) _L_FLAG((tty), PENDIN)
165#define L_IEXTEN(tty) _L_FLAG((tty),IEXTEN) 166#define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN)
166 167
167struct device; 168struct device;
168struct signal_struct; 169struct signal_struct;
170
171/*
172 * Port level information. Each device keeps its own port level information
173 * so provide a common structure for those ports wanting to use common support
174 * routines.
175 *
176 * The tty port has a different lifetime to the tty so must be kept apart.
177 * In addition be careful as tty -> port mappings are valid for the life
178 * of the tty object but in many cases port -> tty mappings are valid only
179 * until a hangup so don't use the wrong path.
180 */
181
182struct tty_port {
183 struct tty_struct *tty; /* Back pointer */
184 int blocked_open; /* Waiting to open */
185 int count; /* Usage count */
186 wait_queue_head_t open_wait; /* Open waiters */
187 wait_queue_head_t close_wait; /* Close waiters */
188 unsigned long flags; /* TTY flags ASY_*/
189 struct mutex mutex; /* Locking */
190 unsigned char *xmit_buf; /* Optional buffer */
191 int close_delay; /* Close port delay */
192 int closing_wait; /* Delay for output */
193};
194
169/* 195/*
170 * Where all of the state associated with a tty is kept while the tty 196 * Where all of the state associated with a tty is kept while the tty
171 * is open. Since the termios state should be kept even if the tty 197 * is open. Since the termios state should be kept even if the tty
@@ -185,6 +211,7 @@ struct tty_struct {
185 struct tty_driver *driver; 211 struct tty_driver *driver;
186 const struct tty_operations *ops; 212 const struct tty_operations *ops;
187 int index; 213 int index;
214 /* The ldisc objects are protected by tty_ldisc_lock at the moment */
188 struct tty_ldisc ldisc; 215 struct tty_ldisc ldisc;
189 struct mutex termios_mutex; 216 struct mutex termios_mutex;
190 spinlock_t ctrl_lock; 217 spinlock_t ctrl_lock;
@@ -213,7 +240,7 @@ struct tty_struct {
213 struct list_head tty_files; 240 struct list_head tty_files;
214 241
215#define N_TTY_BUF_SIZE 4096 242#define N_TTY_BUF_SIZE 4096
216 243
217 /* 244 /*
218 * The following is data for the N_TTY line discipline. For 245 * The following is data for the N_TTY line discipline. For
219 * historical reasons, this is included in the tty structure. 246 * historical reasons, this is included in the tty structure.
@@ -241,6 +268,7 @@ struct tty_struct {
241 spinlock_t read_lock; 268 spinlock_t read_lock;
242 /* If the tty has a pending do_SAK, queue it here - akpm */ 269 /* If the tty has a pending do_SAK, queue it here - akpm */
243 struct work_struct SAK_work; 270 struct work_struct SAK_work;
271 struct tty_port *port;
244}; 272};
245 273
246/* tty magic number */ 274/* tty magic number */
@@ -248,14 +276,14 @@ struct tty_struct {
248 276
249/* 277/*
250 * These bits are used in the flags field of the tty structure. 278 * These bits are used in the flags field of the tty structure.
251 * 279 *
252 * So that interrupts won't be able to mess up the queues, 280 * So that interrupts won't be able to mess up the queues,
253 * copy_to_cooked must be atomic with respect to itself, as must 281 * copy_to_cooked must be atomic with respect to itself, as must
254 * tty->write. Thus, you must use the inline functions set_bit() and 282 * tty->write. Thus, you must use the inline functions set_bit() and
255 * clear_bit() to make things atomic. 283 * clear_bit() to make things atomic.
256 */ 284 */
257#define TTY_THROTTLED 0 /* Call unthrottle() at threshold min */ 285#define TTY_THROTTLED 0 /* Call unthrottle() at threshold min */
258#define TTY_IO_ERROR 1 /* Canse an I/O error (may be no ldisc too) */ 286#define TTY_IO_ERROR 1 /* Cause an I/O error (may be no ldisc too) */
259#define TTY_OTHER_CLOSED 2 /* Other side (if any) has closed */ 287#define TTY_OTHER_CLOSED 2 /* Other side (if any) has closed */
260#define TTY_EXCLUSIVE 3 /* Exclusive open mode */ 288#define TTY_EXCLUSIVE 3 /* Exclusive open mode */
261#define TTY_DEBUG 4 /* Debugging */ 289#define TTY_DEBUG 4 /* Debugging */
@@ -285,12 +313,10 @@ extern int vcs_init(void);
285extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, 313extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode,
286 const char *routine); 314 const char *routine);
287extern char *tty_name(struct tty_struct *tty, char *buf); 315extern char *tty_name(struct tty_struct *tty, char *buf);
288extern void tty_wait_until_sent(struct tty_struct * tty, long timeout); 316extern void tty_wait_until_sent(struct tty_struct *tty, long timeout);
289extern int tty_check_change(struct tty_struct * tty); 317extern int tty_check_change(struct tty_struct *tty);
290extern void stop_tty(struct tty_struct * tty); 318extern void stop_tty(struct tty_struct *tty);
291extern void start_tty(struct tty_struct * tty); 319extern void start_tty(struct tty_struct *tty);
292extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc);
293extern int tty_unregister_ldisc(int disc);
294extern int tty_register_driver(struct tty_driver *driver); 320extern int tty_register_driver(struct tty_driver *driver);
295extern int tty_unregister_driver(struct tty_driver *driver); 321extern int tty_unregister_driver(struct tty_driver *driver);
296extern struct device *tty_register_device(struct tty_driver *driver, 322extern struct device *tty_register_device(struct tty_driver *driver,
@@ -310,10 +336,10 @@ extern int is_current_pgrp_orphaned(void);
310extern struct pid *tty_get_pgrp(struct tty_struct *tty); 336extern struct pid *tty_get_pgrp(struct tty_struct *tty);
311extern int is_ignored(int sig); 337extern int is_ignored(int sig);
312extern int tty_signal(int sig, struct tty_struct *tty); 338extern int tty_signal(int sig, struct tty_struct *tty);
313extern void tty_hangup(struct tty_struct * tty); 339extern void tty_hangup(struct tty_struct *tty);
314extern void tty_vhangup(struct tty_struct * tty); 340extern void tty_vhangup(struct tty_struct *tty);
315extern void tty_unhangup(struct file *filp); 341extern void tty_unhangup(struct file *filp);
316extern int tty_hung_up_p(struct file * filp); 342extern int tty_hung_up_p(struct file *filp);
317extern void do_SAK(struct tty_struct *tty); 343extern void do_SAK(struct tty_struct *tty);
318extern void __do_SAK(struct tty_struct *tty); 344extern void __do_SAK(struct tty_struct *tty);
319extern void disassociate_ctty(int priv); 345extern void disassociate_ctty(int priv);
@@ -322,17 +348,17 @@ extern void tty_flip_buffer_push(struct tty_struct *tty);
322extern speed_t tty_get_baud_rate(struct tty_struct *tty); 348extern speed_t tty_get_baud_rate(struct tty_struct *tty);
323extern speed_t tty_termios_baud_rate(struct ktermios *termios); 349extern speed_t tty_termios_baud_rate(struct ktermios *termios);
324extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); 350extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
325extern void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud); 351extern void tty_termios_encode_baud_rate(struct ktermios *termios,
326extern void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud); 352 speed_t ibaud, speed_t obaud);
353extern void tty_encode_baud_rate(struct tty_struct *tty,
354 speed_t ibaud, speed_t obaud);
327extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); 355extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);
328extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); 356extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b);
329 357
330extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); 358extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *);
331extern void tty_ldisc_deref(struct tty_ldisc *); 359extern void tty_ldisc_deref(struct tty_ldisc *);
332extern struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *); 360extern struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *);
333 361extern const struct file_operations tty_ldiscs_proc_fops;
334extern struct tty_ldisc *tty_ldisc_get(int);
335extern void tty_ldisc_put(int);
336 362
337extern void tty_wakeup(struct tty_struct *tty); 363extern void tty_wakeup(struct tty_struct *tty);
338extern void tty_ldisc_flush(struct tty_struct *tty); 364extern void tty_ldisc_flush(struct tty_struct *tty);
@@ -351,10 +377,23 @@ extern void tty_write_unlock(struct tty_struct *tty);
351extern int tty_write_lock(struct tty_struct *tty, int ndelay); 377extern int tty_write_lock(struct tty_struct *tty, int ndelay);
352#define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock)) 378#define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock))
353 379
380extern void tty_port_init(struct tty_port *port);
381extern int tty_port_alloc_xmit_buf(struct tty_port *port);
382extern void tty_port_free_xmit_buf(struct tty_port *port);
383
384extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
385extern int tty_unregister_ldisc(int disc);
386extern int tty_set_ldisc(struct tty_struct *tty, int ldisc);
387extern int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty);
388extern void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty);
389extern void tty_ldisc_init(struct tty_struct *tty);
390extern void tty_ldisc_begin(void);
391/* This last one is just for the tty layer internals and shouldn't be used elsewhere */
392extern void tty_ldisc_enable(struct tty_struct *tty);
354 393
355 394
356/* n_tty.c */ 395/* n_tty.c */
357extern struct tty_ldisc tty_ldisc_N_TTY; 396extern struct tty_ldisc_ops tty_ldisc_N_TTY;
358 397
359/* tty_audit.c */ 398/* tty_audit.c */
360#ifdef CONFIG_AUDIT 399#ifdef CONFIG_AUDIT
@@ -363,7 +402,8 @@ extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
363extern void tty_audit_exit(void); 402extern void tty_audit_exit(void);
364extern void tty_audit_fork(struct signal_struct *sig); 403extern void tty_audit_fork(struct signal_struct *sig);
365extern void tty_audit_push(struct tty_struct *tty); 404extern void tty_audit_push(struct tty_struct *tty);
366extern void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid); 405extern void tty_audit_push_task(struct task_struct *tsk,
406 uid_t loginuid, u32 sessionid);
367#else 407#else
368static inline void tty_audit_add_data(struct tty_struct *tty, 408static inline void tty_audit_add_data(struct tty_struct *tty,
369 unsigned char *data, size_t size) 409 unsigned char *data, size_t size)
@@ -378,19 +418,20 @@ static inline void tty_audit_fork(struct signal_struct *sig)
378static inline void tty_audit_push(struct tty_struct *tty) 418static inline void tty_audit_push(struct tty_struct *tty)
379{ 419{
380} 420}
381static inline void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid) 421static inline void tty_audit_push_task(struct task_struct *tsk,
422 uid_t loginuid, u32 sessionid)
382{ 423{
383} 424}
384#endif 425#endif
385 426
386/* tty_ioctl.c */ 427/* tty_ioctl.c */
387extern int n_tty_ioctl(struct tty_struct * tty, struct file * file, 428extern int n_tty_ioctl(struct tty_struct *tty, struct file *file,
388 unsigned int cmd, unsigned long arg); 429 unsigned int cmd, unsigned long arg);
389 430
390/* serial.c */ 431/* serial.c */
391 432
392extern void serial_console_init(void); 433extern void serial_console_init(void);
393 434
394/* pcxx.c */ 435/* pcxx.c */
395 436
396extern int pcxe_open(struct tty_struct *tty, struct file *filp); 437extern int pcxe_open(struct tty_struct *tty, struct file *filp);
@@ -401,7 +442,7 @@ extern void console_print(const char *);
401 442
402/* vt.c */ 443/* vt.c */
403 444
404extern int vt_ioctl(struct tty_struct *tty, struct file * file, 445extern int vt_ioctl(struct tty_struct *tty, struct file *file,
405 unsigned int cmd, unsigned long arg); 446 unsigned int cmd, unsigned long arg);
406 447
407#endif /* __KERNEL__ */ 448#endif /* __KERNEL__ */
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 59f1c0bd8f9..e1065ac0d92 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -27,8 +27,7 @@
27 * This routine is called by the kernel to write a series of 27 * This routine is called by the kernel to write a series of
28 * characters to the tty device. The characters may come from 28 * characters to the tty device. The characters may come from
29 * user space or kernel space. This routine will return the 29 * user space or kernel space. This routine will return the
30 * number of characters actually accepted for writing. This 30 * number of characters actually accepted for writing.
31 * routine is mandatory.
32 * 31 *
33 * Optional: Required for writable devices. 32 * Optional: Required for writable devices.
34 * 33 *
@@ -134,9 +133,9 @@
134 * This routine notifies the tty driver that it should hangup the 133 * This routine notifies the tty driver that it should hangup the
135 * tty device. 134 * tty device.
136 * 135 *
137 * Required: 136 * Optional:
138 * 137 *
139 * void (*break_ctl)(struct tty_stuct *tty, int state); 138 * int (*break_ctl)(struct tty_stuct *tty, int state);
140 * 139 *
141 * This optional routine requests the tty driver to turn on or 140 * This optional routine requests the tty driver to turn on or
142 * off BREAK status on the RS-232 port. If state is -1, 141 * off BREAK status on the RS-232 port. If state is -1,
@@ -147,6 +146,10 @@
147 * handle the following ioctls: TCSBRK, TCSBRKP, TIOCSBRK, 146 * handle the following ioctls: TCSBRK, TCSBRKP, TIOCSBRK,
148 * TIOCCBRK. 147 * TIOCCBRK.
149 * 148 *
149 * If the driver sets TTY_DRIVER_HARDWARE_BREAK then the interface
150 * will also be called with actual times and the hardware is expected
151 * to do the delay work itself. 0 and -1 are still used for on/off.
152 *
150 * Optional: Required for TCSBRK/BRKP/etc handling. 153 * Optional: Required for TCSBRK/BRKP/etc handling.
151 * 154 *
152 * void (*wait_until_sent)(struct tty_struct *tty, int timeout); 155 * void (*wait_until_sent)(struct tty_struct *tty, int timeout);
@@ -193,7 +196,7 @@ struct tty_operations {
193 void (*stop)(struct tty_struct *tty); 196 void (*stop)(struct tty_struct *tty);
194 void (*start)(struct tty_struct *tty); 197 void (*start)(struct tty_struct *tty);
195 void (*hangup)(struct tty_struct *tty); 198 void (*hangup)(struct tty_struct *tty);
196 void (*break_ctl)(struct tty_struct *tty, int state); 199 int (*break_ctl)(struct tty_struct *tty, int state);
197 void (*flush_buffer)(struct tty_struct *tty); 200 void (*flush_buffer)(struct tty_struct *tty);
198 void (*set_ldisc)(struct tty_struct *tty); 201 void (*set_ldisc)(struct tty_struct *tty);
199 void (*wait_until_sent)(struct tty_struct *tty, int timeout); 202 void (*wait_until_sent)(struct tty_struct *tty, int timeout);
@@ -286,12 +289,18 @@ extern struct tty_driver *tty_find_polling_driver(char *name, int *line);
286 * TTY_DRIVER_DEVPTS_MEM -- don't use the standard arrays, instead 289 * TTY_DRIVER_DEVPTS_MEM -- don't use the standard arrays, instead
287 * use dynamic memory keyed through the devpts filesystem. This 290 * use dynamic memory keyed through the devpts filesystem. This
288 * is only applicable to the pty driver. 291 * is only applicable to the pty driver.
292 *
293 * TTY_DRIVER_HARDWARE_BREAK -- hardware handles break signals. Pass
294 * the requested timeout to the caller instead of using a simple
295 * on/off interface.
296 *
289 */ 297 */
290#define TTY_DRIVER_INSTALLED 0x0001 298#define TTY_DRIVER_INSTALLED 0x0001
291#define TTY_DRIVER_RESET_TERMIOS 0x0002 299#define TTY_DRIVER_RESET_TERMIOS 0x0002
292#define TTY_DRIVER_REAL_RAW 0x0004 300#define TTY_DRIVER_REAL_RAW 0x0004
293#define TTY_DRIVER_DYNAMIC_DEV 0x0008 301#define TTY_DRIVER_DYNAMIC_DEV 0x0008
294#define TTY_DRIVER_DEVPTS_MEM 0x0010 302#define TTY_DRIVER_DEVPTS_MEM 0x0010
303#define TTY_DRIVER_HARDWARE_BREAK 0x0020
295 304
296/* tty driver types */ 305/* tty driver types */
297#define TTY_DRIVER_TYPE_SYSTEM 0x0001 306#define TTY_DRIVER_TYPE_SYSTEM 0x0001
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index 6226504d910..40f38d89677 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -104,7 +104,7 @@
104#include <linux/fs.h> 104#include <linux/fs.h>
105#include <linux/wait.h> 105#include <linux/wait.h>
106 106
107struct tty_ldisc { 107struct tty_ldisc_ops {
108 int magic; 108 int magic;
109 char *name; 109 char *name;
110 int num; 110 int num;
@@ -142,6 +142,11 @@ struct tty_ldisc {
142 int refcount; 142 int refcount;
143}; 143};
144 144
145struct tty_ldisc {
146 struct tty_ldisc_ops *ops;
147 int refcount;
148};
149
145#define TTY_LDISC_MAGIC 0x5403 150#define TTY_LDISC_MAGIC 0x5403
146 151
147#define LDISC_FLAG_DEFINED 0x00000001 152#define LDISC_FLAG_DEFINED 0x00000001
diff --git a/include/linux/typecheck.h b/include/linux/typecheck.h
new file mode 100644
index 00000000000..eb5b74a575b
--- /dev/null
+++ b/include/linux/typecheck.h
@@ -0,0 +1,24 @@
1#ifndef TYPECHECK_H_INCLUDED
2#define TYPECHECK_H_INCLUDED
3
4/*
5 * Check at compile time that something is of a particular type.
6 * Always evaluates to 1 so you may use it easily in comparisons.
7 */
8#define typecheck(type,x) \
9({ type __dummy; \
10 typeof(x) __dummy2; \
11 (void)(&__dummy == &__dummy2); \
12 1; \
13})
14
15/*
16 * Check at compile time that 'function' is a certain type, or is a pointer
17 * to that type (needs to use typedef for the function type.)
18 */
19#define typecheck_fn(type,function) \
20({ typeof(type) __tmp = function; \
21 (void)__tmp; \
22})
23
24#endif /* TYPECHECK_H_INCLUDED */
diff --git a/include/linux/types.h b/include/linux/types.h
index 9dc2346627b..d4a9ce6e276 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -197,8 +197,6 @@ typedef u64 resource_size_t;
197typedef u32 resource_size_t; 197typedef u32 resource_size_t;
198#endif 198#endif
199 199
200#endif /* __KERNEL__ */
201
202struct ustat { 200struct ustat {
203 __kernel_daddr_t f_tfree; 201 __kernel_daddr_t f_tfree;
204 __kernel_ino_t f_tinode; 202 __kernel_ino_t f_tinode;
@@ -206,4 +204,6 @@ struct ustat {
206 char f_fpack[6]; 204 char f_fpack[6];
207}; 205};
208 206
207#endif /* __KERNEL__ */
208
209#endif /* _LINUX_TYPES_H */ 209#endif /* _LINUX_TYPES_H */
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 581ca2c14c5..0cf5c4c0ec8 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -38,6 +38,7 @@ struct udphdr {
38#ifdef __KERNEL__ 38#ifdef __KERNEL__
39#include <net/inet_sock.h> 39#include <net/inet_sock.h>
40#include <linux/skbuff.h> 40#include <linux/skbuff.h>
41#include <net/netns/hash.h>
41 42
42static inline struct udphdr *udp_hdr(const struct sk_buff *skb) 43static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
43{ 44{
@@ -46,6 +47,11 @@ static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
46 47
47#define UDP_HTABLE_SIZE 128 48#define UDP_HTABLE_SIZE 128
48 49
50static inline int udp_hashfn(struct net *net, const unsigned num)
51{
52 return (num + net_hash_mix(net)) & (UDP_HTABLE_SIZE - 1);
53}
54
49struct udp_sock { 55struct udp_sock {
50 /* inet_sock has to be the first member */ 56 /* inet_sock has to be the first member */
51 struct inet_sock inet; 57 struct inet_sock inet;
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index 973386d439d..cdf338d94b7 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -36,7 +36,7 @@ struct uio_mem {
36 struct uio_map *map; 36 struct uio_map *map;
37}; 37};
38 38
39#define MAX_UIO_MAPS 5 39#define MAX_UIO_MAPS 5
40 40
41struct uio_device; 41struct uio_device;
42 42
@@ -53,6 +53,7 @@ struct uio_device;
53 * @mmap: mmap operation for this uio device 53 * @mmap: mmap operation for this uio device
54 * @open: open operation for this uio device 54 * @open: open operation for this uio device
55 * @release: release operation for this uio device 55 * @release: release operation for this uio device
56 * @irqcontrol: disable/enable irqs when 0/1 is written to /dev/uioX
56 */ 57 */
57struct uio_info { 58struct uio_info {
58 struct uio_device *uio_dev; 59 struct uio_device *uio_dev;
@@ -66,6 +67,7 @@ struct uio_info {
66 int (*mmap)(struct uio_info *info, struct vm_area_struct *vma); 67 int (*mmap)(struct uio_info *info, struct vm_area_struct *vma);
67 int (*open)(struct uio_info *info, struct inode *inode); 68 int (*open)(struct uio_info *info, struct inode *inode);
68 int (*release)(struct uio_info *info, struct inode *inode); 69 int (*release)(struct uio_info *info, struct inode *inode);
70 int (*irqcontrol)(struct uio_info *info, s32 irq_on);
69}; 71};
70 72
71extern int __must_check 73extern int __must_check
@@ -80,11 +82,11 @@ static inline int __must_check
80extern void uio_unregister_device(struct uio_info *info); 82extern void uio_unregister_device(struct uio_info *info);
81extern void uio_event_notify(struct uio_info *info); 83extern void uio_event_notify(struct uio_info *info);
82 84
83/* defines for uio_device->irq */ 85/* defines for uio_info->irq */
84#define UIO_IRQ_CUSTOM -1 86#define UIO_IRQ_CUSTOM -1
85#define UIO_IRQ_NONE -2 87#define UIO_IRQ_NONE -2
86 88
87/* defines for uio_device->memtype */ 89/* defines for uio_mem->memtype */
88#define UIO_MEM_NONE 0 90#define UIO_MEM_NONE 0
89#define UIO_MEM_PHYS 1 91#define UIO_MEM_PHYS 1
90#define UIO_MEM_LOGICAL 2 92#define UIO_MEM_LOGICAL 2
diff --git a/include/linux/usb.h b/include/linux/usb.h
index c08689ea9b4..5811c5da69f 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -160,6 +160,7 @@ struct usb_interface {
160 unsigned is_active:1; /* the interface is not suspended */ 160 unsigned is_active:1; /* the interface is not suspended */
161 unsigned sysfs_files_created:1; /* the sysfs attributes exist */ 161 unsigned sysfs_files_created:1; /* the sysfs attributes exist */
162 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ 162 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
163 unsigned needs_binding:1; /* needs delayed unbind/rebind */
163 164
164 struct device dev; /* interface specific device info */ 165 struct device dev; /* interface specific device info */
165 struct device *usb_dev; 166 struct device *usb_dev;
@@ -293,7 +294,7 @@ struct usb_devmap {
293struct usb_bus { 294struct usb_bus {
294 struct device *controller; /* host/master side hardware */ 295 struct device *controller; /* host/master side hardware */
295 int busnum; /* Bus number (in order of reg) */ 296 int busnum; /* Bus number (in order of reg) */
296 char *bus_name; /* stable id (PCI slot_name etc) */ 297 const char *bus_name; /* stable id (PCI slot_name etc) */
297 u8 uses_dma; /* Does the host controller use DMA? */ 298 u8 uses_dma; /* Does the host controller use DMA? */
298 u8 otg_port; /* 0, or number of OTG/HNP port */ 299 u8 otg_port; /* 0, or number of OTG/HNP port */
299 unsigned is_b_host:1; /* true during some HNP roleswitches */ 300 unsigned is_b_host:1; /* true during some HNP roleswitches */
@@ -497,8 +498,6 @@ extern int usb_lock_device_for_reset(struct usb_device *udev,
497 498
498/* USB port reset for device reinitialization */ 499/* USB port reset for device reinitialization */
499extern int usb_reset_device(struct usb_device *dev); 500extern int usb_reset_device(struct usb_device *dev);
500extern int usb_reset_composite_device(struct usb_device *dev,
501 struct usb_interface *iface);
502 501
503extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); 502extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
504 503
@@ -958,9 +957,9 @@ struct usbdrv_wrap {
958 * @resume: Called when the device is being resumed by the system. 957 * @resume: Called when the device is being resumed by the system.
959 * @reset_resume: Called when the suspended device has been reset instead 958 * @reset_resume: Called when the suspended device has been reset instead
960 * of being resumed. 959 * of being resumed.
961 * @pre_reset: Called by usb_reset_composite_device() when the device 960 * @pre_reset: Called by usb_reset_device() when the device
962 * is about to be reset. 961 * is about to be reset.
963 * @post_reset: Called by usb_reset_composite_device() after the device 962 * @post_reset: Called by usb_reset_device() after the device
964 * has been reset 963 * has been reset
965 * @id_table: USB drivers use ID table to support hotplugging. 964 * @id_table: USB drivers use ID table to support hotplugging.
966 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set 965 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set
@@ -972,6 +971,8 @@ struct usbdrv_wrap {
972 * added to this driver by preventing the sysfs file from being created. 971 * added to this driver by preventing the sysfs file from being created.
973 * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend 972 * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend
974 * for interfaces bound to this driver. 973 * for interfaces bound to this driver.
974 * @soft_unbind: if set to 1, the USB core will not kill URBs and disable
975 * endpoints before calling the driver's disconnect method.
975 * 976 *
976 * USB interface drivers must provide a name, probe() and disconnect() 977 * USB interface drivers must provide a name, probe() and disconnect()
977 * methods, and an id_table. Other driver fields are optional. 978 * methods, and an id_table. Other driver fields are optional.
@@ -1012,6 +1013,7 @@ struct usb_driver {
1012 struct usbdrv_wrap drvwrap; 1013 struct usbdrv_wrap drvwrap;
1013 unsigned int no_dynamic_id:1; 1014 unsigned int no_dynamic_id:1;
1014 unsigned int supports_autosuspend:1; 1015 unsigned int supports_autosuspend:1;
1016 unsigned int soft_unbind:1;
1015}; 1017};
1016#define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver) 1018#define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver)
1017 1019
diff --git a/include/linux/usb/association.h b/include/linux/usb/association.h
new file mode 100644
index 00000000000..07c5e3cf589
--- /dev/null
+++ b/include/linux/usb/association.h
@@ -0,0 +1,150 @@
1/*
2 * Wireless USB - Cable Based Association
3 *
4 * Copyright (C) 2006 Intel Corporation
5 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License version
9 * 2 as published by the Free Software Foundation.
10 *
11 */
12#ifndef __LINUX_USB_ASSOCIATION_H
13#define __LINUX_USB_ASSOCIATION_H
14
15
16/*
17 * Association attributes
18 *
19 * Association Models Supplement to WUSB 1.0 T[3-1]
20 *
21 * Each field in the structures has it's ID, it's length and then the
22 * value. This is the actual definition of the field's ID and its
23 * length.
24 */
25struct wusb_am_attr {
26 __u8 id;
27 __u8 len;
28};
29
30/* Different fields defined by the spec */
31#define WUSB_AR_AssociationTypeId { .id = 0x0000, .len = 2 }
32#define WUSB_AR_AssociationSubTypeId { .id = 0x0001, .len = 2 }
33#define WUSB_AR_Length { .id = 0x0002, .len = 4 }
34#define WUSB_AR_AssociationStatus { .id = 0x0004, .len = 4 }
35#define WUSB_AR_LangID { .id = 0x0008, .len = 2 }
36#define WUSB_AR_DeviceFriendlyName { .id = 0x000b, .len = 64 } /* max */
37#define WUSB_AR_HostFriendlyName { .id = 0x000c, .len = 64 } /* max */
38#define WUSB_AR_CHID { .id = 0x1000, .len = 16 }
39#define WUSB_AR_CDID { .id = 0x1001, .len = 16 }
40#define WUSB_AR_ConnectionContext { .id = 0x1002, .len = 48 }
41#define WUSB_AR_BandGroups { .id = 0x1004, .len = 2 }
42
43/* CBAF Control Requests (AMS1.0[T4-1] */
44enum {
45 CBAF_REQ_GET_ASSOCIATION_INFORMATION = 0x01,
46 CBAF_REQ_GET_ASSOCIATION_REQUEST,
47 CBAF_REQ_SET_ASSOCIATION_RESPONSE
48};
49
50/*
51 * CBAF USB-interface defitions
52 *
53 * No altsettings, one optional interrupt endpoint.
54 */
55enum {
56 CBAF_IFACECLASS = 0xef,
57 CBAF_IFACESUBCLASS = 0x03,
58 CBAF_IFACEPROTOCOL = 0x01,
59};
60
61/* Association Information (AMS1.0[T4-3]) */
62struct wusb_cbaf_assoc_info {
63 __le16 Length;
64 __u8 NumAssociationRequests;
65 __le16 Flags;
66 __u8 AssociationRequestsArray[];
67} __attribute__((packed));
68
69/* Association Request (AMS1.0[T4-4]) */
70struct wusb_cbaf_assoc_request {
71 __u8 AssociationDataIndex;
72 __u8 Reserved;
73 __le16 AssociationTypeId;
74 __le16 AssociationSubTypeId;
75 __le32 AssociationTypeInfoSize;
76} __attribute__((packed));
77
78enum {
79 AR_TYPE_WUSB = 0x0001,
80 AR_TYPE_WUSB_RETRIEVE_HOST_INFO = 0x0000,
81 AR_TYPE_WUSB_ASSOCIATE = 0x0001,
82};
83
84/* Association Attribute header (AMS1.0[3.8]) */
85struct wusb_cbaf_attr_hdr {
86 __le16 id;
87 __le16 len;
88} __attribute__((packed));
89
90/* Host Info (AMS1.0[T4-7]) (yeah, more headers and fields...) */
91struct wusb_cbaf_host_info {
92 struct wusb_cbaf_attr_hdr AssociationTypeId_hdr;
93 __le16 AssociationTypeId;
94 struct wusb_cbaf_attr_hdr AssociationSubTypeId_hdr;
95 __le16 AssociationSubTypeId;
96 struct wusb_cbaf_attr_hdr CHID_hdr;
97 struct wusb_ckhdid CHID;
98 struct wusb_cbaf_attr_hdr LangID_hdr;
99 __le16 LangID;
100 struct wusb_cbaf_attr_hdr HostFriendlyName_hdr;
101 __u8 HostFriendlyName[];
102} __attribute__((packed));
103
104/* Device Info (AMS1.0[T4-8])
105 *
106 * I still don't get this tag'n'header stuff for each goddamn
107 * field...
108 */
109struct wusb_cbaf_device_info {
110 struct wusb_cbaf_attr_hdr Length_hdr;
111 __le32 Length;
112 struct wusb_cbaf_attr_hdr CDID_hdr;
113 struct wusb_ckhdid CDID;
114 struct wusb_cbaf_attr_hdr BandGroups_hdr;
115 __le16 BandGroups;
116 struct wusb_cbaf_attr_hdr LangID_hdr;
117 __le16 LangID;
118 struct wusb_cbaf_attr_hdr DeviceFriendlyName_hdr;
119 __u8 DeviceFriendlyName[];
120} __attribute__((packed));
121
122/* Connection Context; CC_DATA - Success case (AMS1.0[T4-9]) */
123struct wusb_cbaf_cc_data {
124 struct wusb_cbaf_attr_hdr AssociationTypeId_hdr;
125 __le16 AssociationTypeId;
126 struct wusb_cbaf_attr_hdr AssociationSubTypeId_hdr;
127 __le16 AssociationSubTypeId;
128 struct wusb_cbaf_attr_hdr Length_hdr;
129 __le32 Length;
130 struct wusb_cbaf_attr_hdr ConnectionContext_hdr;
131 struct wusb_ckhdid CHID;
132 struct wusb_ckhdid CDID;
133 struct wusb_ckhdid CK;
134 struct wusb_cbaf_attr_hdr BandGroups_hdr;
135 __le16 BandGroups;
136} __attribute__((packed));
137
138/* CC_DATA - Failure case (AMS1.0[T4-10]) */
139struct wusb_cbaf_cc_data_fail {
140 struct wusb_cbaf_attr_hdr AssociationTypeId_hdr;
141 __le16 AssociationTypeId;
142 struct wusb_cbaf_attr_hdr AssociationSubTypeId_hdr;
143 __le16 AssociationSubTypeId;
144 struct wusb_cbaf_attr_hdr Length_hdr;
145 __le16 Length;
146 struct wusb_cbaf_attr_hdr AssociationStatus_hdr;
147 __u32 AssociationStatus;
148} __attribute__((packed));
149
150#endif /* __LINUX_USB_ASSOCIATION_H */
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index 71e52f2f6a3..ca228bb9421 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -130,6 +130,15 @@ struct usb_cdc_ether_desc {
130 __u8 bNumberPowerFilters; 130 __u8 bNumberPowerFilters;
131} __attribute__ ((packed)); 131} __attribute__ ((packed));
132 132
133/* "Telephone Control Model Functional Descriptor" from CDC WMC spec 6.3..3 */
134struct usb_cdc_dmm_desc {
135 __u8 bFunctionLength;
136 __u8 bDescriptorType;
137 __u8 bDescriptorSubtype;
138 __u16 bcdVersion;
139 __le16 wMaxCommand;
140} __attribute__ ((packed));
141
133/* "MDLM Functional Descriptor" from CDC WMC spec 6.7.2.3 */ 142/* "MDLM Functional Descriptor" from CDC WMC spec 6.7.2.3 */
134struct usb_cdc_mdlm_desc { 143struct usb_cdc_mdlm_desc {
135 __u8 bLength; 144 __u8 bLength;
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
new file mode 100644
index 00000000000..c932390c6da
--- /dev/null
+++ b/include/linux/usb/composite.h
@@ -0,0 +1,338 @@
1/*
2 * composite.h -- framework for usb gadgets which are composite devices
3 *
4 * Copyright (C) 2006-2008 David Brownell
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
19 */
20
21#ifndef __LINUX_USB_COMPOSITE_H
22#define __LINUX_USB_COMPOSITE_H
23
24/*
25 * This framework is an optional layer on top of the USB Gadget interface,
26 * making it easier to build (a) Composite devices, supporting multiple
27 * functions within any single configuration, and (b) Multi-configuration
28 * devices, also supporting multiple functions but without necessarily
29 * having more than one function per configuration.
30 *
31 * Example: a device with a single configuration supporting both network
32 * link and mass storage functions is a composite device. Those functions
33 * might alternatively be packaged in individual configurations, but in
34 * the composite model the host can use both functions at the same time.
35 */
36
37#include <linux/usb/ch9.h>
38#include <linux/usb/gadget.h>
39
40
41struct usb_configuration;
42
43/**
44 * struct usb_function - describes one function of a configuration
45 * @name: For diagnostics, identifies the function.
46 * @strings: tables of strings, keyed by identifiers assigned during bind()
47 * and by language IDs provided in control requests
48 * @descriptors: Table of full (or low) speed descriptors, using interface and
49 * string identifiers assigned during @bind(). If this pointer is null,
50 * the function will not be available at full speed (or at low speed).
51 * @hs_descriptors: Table of high speed descriptors, using interface and
52 * string identifiers assigned during @bind(). If this pointer is null,
53 * the function will not be available at high speed.
54 * @config: assigned when @usb_add_function() is called; this is the
55 * configuration with which this function is associated.
56 * @bind: Before the gadget can register, all of its functions bind() to the
57 * available resources including string and interface identifiers used
58 * in interface or class descriptors; endpoints; I/O buffers; and so on.
59 * @unbind: Reverses @bind; called as a side effect of unregistering the
60 * driver which added this function.
61 * @set_alt: (REQUIRED) Reconfigures altsettings; function drivers may
62 * initialize usb_ep.driver data at this time (when it is used).
63 * Note that setting an interface to its current altsetting resets
64 * interface state, and that all interfaces have a disabled state.
65 * @get_alt: Returns the active altsetting. If this is not provided,
66 * then only altsetting zero is supported.
67 * @disable: (REQUIRED) Indicates the function should be disabled. Reasons
68 * include host resetting or reconfiguring the gadget, and disconnection.
69 * @setup: Used for interface-specific control requests.
70 * @suspend: Notifies functions when the host stops sending USB traffic.
71 * @resume: Notifies functions when the host restarts USB traffic.
72 *
73 * A single USB function uses one or more interfaces, and should in most
74 * cases support operation at both full and high speeds. Each function is
75 * associated by @usb_add_function() with a one configuration; that function
76 * causes @bind() to be called so resources can be allocated as part of
77 * setting up a gadget driver. Those resources include endpoints, which
78 * should be allocated using @usb_ep_autoconfig().
79 *
80 * To support dual speed operation, a function driver provides descriptors
81 * for both high and full speed operation. Except in rare cases that don't
82 * involve bulk endpoints, each speed needs different endpoint descriptors.
83 *
84 * Function drivers choose their own strategies for managing instance data.
85 * The simplest strategy just declares it "static', which means the function
86 * can only be activated once. If the function needs to be exposed in more
87 * than one configuration at a given speed, it needs to support multiple
88 * usb_function structures (one for each configuration).
89 *
90 * A more complex strategy might encapsulate a @usb_function structure inside
91 * a driver-specific instance structure to allows multiple activations. An
92 * example of multiple activations might be a CDC ACM function that supports
93 * two or more distinct instances within the same configuration, providing
94 * several independent logical data links to a USB host.
95 */
96struct usb_function {
97 const char *name;
98 struct usb_gadget_strings **strings;
99 struct usb_descriptor_header **descriptors;
100 struct usb_descriptor_header **hs_descriptors;
101
102 struct usb_configuration *config;
103
104 /* REVISIT: bind() functions can be marked __init, which
105 * makes trouble for section mismatch analysis. See if
106 * we can't restructure things to avoid mismatching.
107 * Related: unbind() may kfree() but bind() won't...
108 */
109
110 /* configuration management: bind/unbind */
111 int (*bind)(struct usb_configuration *,
112 struct usb_function *);
113 void (*unbind)(struct usb_configuration *,
114 struct usb_function *);
115
116 /* runtime state management */
117 int (*set_alt)(struct usb_function *,
118 unsigned interface, unsigned alt);
119 int (*get_alt)(struct usb_function *,
120 unsigned interface);
121 void (*disable)(struct usb_function *);
122 int (*setup)(struct usb_function *,
123 const struct usb_ctrlrequest *);
124 void (*suspend)(struct usb_function *);
125 void (*resume)(struct usb_function *);
126
127 /* internals */
128 struct list_head list;
129};
130
131int usb_add_function(struct usb_configuration *, struct usb_function *);
132
133int usb_interface_id(struct usb_configuration *, struct usb_function *);
134
135/**
136 * ep_choose - select descriptor endpoint at current device speed
137 * @g: gadget, connected and running at some speed
138 * @hs: descriptor to use for high speed operation
139 * @fs: descriptor to use for full or low speed operation
140 */
141static inline struct usb_endpoint_descriptor *
142ep_choose(struct usb_gadget *g, struct usb_endpoint_descriptor *hs,
143 struct usb_endpoint_descriptor *fs)
144{
145 if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
146 return hs;
147 return fs;
148}
149
150#define MAX_CONFIG_INTERFACES 16 /* arbitrary; max 255 */
151
152/**
153 * struct usb_configuration - represents one gadget configuration
154 * @label: For diagnostics, describes the configuration.
155 * @strings: Tables of strings, keyed by identifiers assigned during @bind()
156 * and by language IDs provided in control requests.
157 * @descriptors: Table of descriptors preceding all function descriptors.
158 * Examples include OTG and vendor-specific descriptors.
159 * @bind: Called from @usb_add_config() to allocate resources unique to this
160 * configuration and to call @usb_add_function() for each function used.
161 * @unbind: Reverses @bind; called as a side effect of unregistering the
162 * driver which added this configuration.
163 * @setup: Used to delegate control requests that aren't handled by standard
164 * device infrastructure or directed at a specific interface.
165 * @bConfigurationValue: Copied into configuration descriptor.
166 * @iConfiguration: Copied into configuration descriptor.
167 * @bmAttributes: Copied into configuration descriptor.
168 * @bMaxPower: Copied into configuration descriptor.
169 * @cdev: assigned by @usb_add_config() before calling @bind(); this is
170 * the device associated with this configuration.
171 *
172 * Configurations are building blocks for gadget drivers structured around
173 * function drivers. Simple USB gadgets require only one function and one
174 * configuration, and handle dual-speed hardware by always providing the same
175 * functionality. Slightly more complex gadgets may have more than one
176 * single-function configuration at a given speed; or have configurations
177 * that only work at one speed.
178 *
179 * Composite devices are, by definition, ones with configurations which
180 * include more than one function.
181 *
182 * The lifecycle of a usb_configuration includes allocation, initialization
183 * of the fields described above, and calling @usb_add_config() to set up
184 * internal data and bind it to a specific device. The configuration's
185 * @bind() method is then used to initialize all the functions and then
186 * call @usb_add_function() for them.
187 *
188 * Those functions would normally be independant of each other, but that's
189 * not mandatory. CDC WMC devices are an example where functions often
190 * depend on other functions, with some functions subsidiary to others.
191 * Such interdependency may be managed in any way, so long as all of the
192 * descriptors complete by the time the composite driver returns from
193 * its bind() routine.
194 */
195struct usb_configuration {
196 const char *label;
197 struct usb_gadget_strings **strings;
198 const struct usb_descriptor_header **descriptors;
199
200 /* REVISIT: bind() functions can be marked __init, which
201 * makes trouble for section mismatch analysis. See if
202 * we can't restructure things to avoid mismatching...
203 */
204
205 /* configuration management: bind/unbind */
206 int (*bind)(struct usb_configuration *);
207 void (*unbind)(struct usb_configuration *);
208 int (*setup)(struct usb_configuration *,
209 const struct usb_ctrlrequest *);
210
211 /* fields in the config descriptor */
212 u8 bConfigurationValue;
213 u8 iConfiguration;
214 u8 bmAttributes;
215 u8 bMaxPower;
216
217 struct usb_composite_dev *cdev;
218
219 /* internals */
220 struct list_head list;
221 struct list_head functions;
222 u8 next_interface_id;
223 unsigned highspeed:1;
224 unsigned fullspeed:1;
225 struct usb_function *interface[MAX_CONFIG_INTERFACES];
226};
227
228int usb_add_config(struct usb_composite_dev *,
229 struct usb_configuration *);
230
231/**
232 * struct usb_composite_driver - groups configurations into a gadget
233 * @name: For diagnostics, identifies the driver.
234 * @dev: Template descriptor for the device, including default device
235 * identifiers.
236 * @strings: tables of strings, keyed by identifiers assigned during bind()
237 * and language IDs provided in control requests
238 * @bind: (REQUIRED) Used to allocate resources that are shared across the
239 * whole device, such as string IDs, and add its configurations using
240 * @usb_add_config(). This may fail by returning a negative errno
241 * value; it should return zero on successful initialization.
242 * @unbind: Reverses @bind(); called as a side effect of unregistering
243 * this driver.
244 *
245 * Devices default to reporting self powered operation. Devices which rely
246 * on bus powered operation should report this in their @bind() method.
247 *
248 * Before returning from @bind, various fields in the template descriptor
249 * may be overridden. These include the idVendor/idProduct/bcdDevice values
250 * normally to bind the appropriate host side driver, and the three strings
251 * (iManufacturer, iProduct, iSerialNumber) normally used to provide user
252 * meaningful device identifiers. (The strings will not be defined unless
253 * they are defined in @dev and @strings.) The correct ep0 maxpacket size
254 * is also reported, as defined by the underlying controller driver.
255 */
256struct usb_composite_driver {
257 const char *name;
258 const struct usb_device_descriptor *dev;
259 struct usb_gadget_strings **strings;
260
261 /* REVISIT: bind() functions can be marked __init, which
262 * makes trouble for section mismatch analysis. See if
263 * we can't restructure things to avoid mismatching...
264 */
265
266 int (*bind)(struct usb_composite_dev *);
267 int (*unbind)(struct usb_composite_dev *);
268};
269
270extern int usb_composite_register(struct usb_composite_driver *);
271extern void usb_composite_unregister(struct usb_composite_driver *);
272
273
274/**
275 * struct usb_composite_device - represents one composite usb gadget
276 * @gadget: read-only, abstracts the gadget's usb peripheral controller
277 * @req: used for control responses; buffer is pre-allocated
278 * @bufsiz: size of buffer pre-allocated in @req
279 * @config: the currently active configuration
280 *
281 * One of these devices is allocated and initialized before the
282 * associated device driver's bind() is called.
283 *
284 * OPEN ISSUE: it appears that some WUSB devices will need to be
285 * built by combining a normal (wired) gadget with a wireless one.
286 * This revision of the gadget framework should probably try to make
287 * sure doing that won't hurt too much.
288 *
289 * One notion for how to handle Wireless USB devices involves:
290 * (a) a second gadget here, discovery mechanism TBD, but likely
291 * needing separate "register/unregister WUSB gadget" calls;
292 * (b) updates to usb_gadget to include flags "is it wireless",
293 * "is it wired", plus (presumably in a wrapper structure)
294 * bandgroup and PHY info;
295 * (c) presumably a wireless_ep wrapping a usb_ep, and reporting
296 * wireless-specific parameters like maxburst and maxsequence;
297 * (d) configurations that are specific to wireless links;
298 * (e) function drivers that understand wireless configs and will
299 * support wireless for (additional) function instances;
300 * (f) a function to support association setup (like CBAF), not
301 * necessarily requiring a wireless adapter;
302 * (g) composite device setup that can create one or more wireless
303 * configs, including appropriate association setup support;
304 * (h) more, TBD.
305 */
306struct usb_composite_dev {
307 struct usb_gadget *gadget;
308 struct usb_request *req;
309 unsigned bufsiz;
310
311 struct usb_configuration *config;
312
313 /* internals */
314 struct usb_device_descriptor desc;
315 struct list_head configs;
316 struct usb_composite_driver *driver;
317 u8 next_string_id;
318
319 spinlock_t lock;
320
321 /* REVISIT use and existence of lock ... */
322};
323
324extern int usb_string_id(struct usb_composite_dev *c);
325
326/* messaging utils */
327#define DBG(d, fmt, args...) \
328 dev_dbg(&(d)->gadget->dev , fmt , ## args)
329#define VDBG(d, fmt, args...) \
330 dev_vdbg(&(d)->gadget->dev , fmt , ## args)
331#define ERROR(d, fmt, args...) \
332 dev_err(&(d)->gadget->dev , fmt , ## args)
333#define WARNING(d, fmt, args...) \
334 dev_warn(&(d)->gadget->dev , fmt , ## args)
335#define INFO(d, fmt, args...) \
336 dev_info(&(d)->gadget->dev , fmt , ## args)
337
338#endif /* __LINUX_USB_COMPOSITE_H */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index cf468fbdbf8..0460a746480 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -33,7 +33,8 @@ struct usb_ep;
33 * @short_not_ok: When reading data, makes short packets be 33 * @short_not_ok: When reading data, makes short packets be
34 * treated as errors (queue stops advancing till cleanup). 34 * treated as errors (queue stops advancing till cleanup).
35 * @complete: Function called when request completes, so this request and 35 * @complete: Function called when request completes, so this request and
36 * its buffer may be re-used. 36 * its buffer may be re-used. The function will always be called with
37 * interrupts disabled, and it must not sleep.
37 * Reads terminate with a short packet, or when the buffer fills, 38 * Reads terminate with a short packet, or when the buffer fills,
38 * whichever comes first. When writes terminate, some data bytes 39 * whichever comes first. When writes terminate, some data bytes
39 * will usually still be in flight (often in a hardware fifo). 40 * will usually still be in flight (often in a hardware fifo).
@@ -271,7 +272,10 @@ static inline void usb_ep_free_request(struct usb_ep *ep,
271 * (Note that some USB device controllers disallow protocol stall responses 272 * (Note that some USB device controllers disallow protocol stall responses
272 * in some cases.) When control responses are deferred (the response is 273 * in some cases.) When control responses are deferred (the response is
273 * written after the setup callback returns), then usb_ep_set_halt() may be 274 * written after the setup callback returns), then usb_ep_set_halt() may be
274 * used on ep0 to trigger protocol stalls. 275 * used on ep0 to trigger protocol stalls. Depending on the controller,
276 * it may not be possible to trigger a status-stage protocol stall when the
277 * data stage is over, that is, from within the response's completion
278 * routine.
275 * 279 *
276 * For periodic endpoints, like interrupt or isochronous ones, the usb host 280 * For periodic endpoints, like interrupt or isochronous ones, the usb host
277 * arranges to poll once per interval, and the gadget driver usually will 281 * arranges to poll once per interval, and the gadget driver usually will
@@ -858,6 +862,25 @@ int usb_descriptor_fillbuf(void *, unsigned,
858int usb_gadget_config_buf(const struct usb_config_descriptor *config, 862int usb_gadget_config_buf(const struct usb_config_descriptor *config,
859 void *buf, unsigned buflen, const struct usb_descriptor_header **desc); 863 void *buf, unsigned buflen, const struct usb_descriptor_header **desc);
860 864
865/* copy a NULL-terminated vector of descriptors */
866struct usb_descriptor_header **usb_copy_descriptors(
867 struct usb_descriptor_header **);
868
869/* return copy of endpoint descriptor given original descriptor set */
870struct usb_endpoint_descriptor *usb_find_endpoint(
871 struct usb_descriptor_header **src,
872 struct usb_descriptor_header **copy,
873 struct usb_endpoint_descriptor *match);
874
875/**
876 * usb_free_descriptors - free descriptors returned by usb_copy_descriptors()
877 * @v: vector of descriptors
878 */
879static inline void usb_free_descriptors(struct usb_descriptor_header **v)
880{
881 kfree(v);
882}
883
861/*-------------------------------------------------------------------------*/ 884/*-------------------------------------------------------------------------*/
862 885
863/* utility wrapping a simple endpoint selection policy */ 886/* utility wrapping a simple endpoint selection policy */
diff --git a/include/linux/usb/irda.h b/include/linux/usb/irda.h
new file mode 100644
index 00000000000..e345ceaf72d
--- /dev/null
+++ b/include/linux/usb/irda.h
@@ -0,0 +1,151 @@
1/*
2 * USB IrDA Bridge Device Definition
3 */
4
5#ifndef __LINUX_USB_IRDA_H
6#define __LINUX_USB_IRDA_H
7
8/* This device should use Application-specific class */
9
10#define USB_SUBCLASS_IRDA 0x02
11
12/*-------------------------------------------------------------------------*/
13
14/* Class-Specific requests (bRequest field) */
15
16#define USB_REQ_CS_IRDA_RECEIVING 1
17#define USB_REQ_CS_IRDA_CHECK_MEDIA_BUSY 3
18#define USB_REQ_CS_IRDA_RATE_SNIFF 4
19#define USB_REQ_CS_IRDA_UNICAST_LIST 5
20#define USB_REQ_CS_IRDA_GET_CLASS_DESC 6
21
22/*-------------------------------------------------------------------------*/
23
24/* Class-Specific descriptor */
25
26#define USB_DT_CS_IRDA 0x21
27
28/*-------------------------------------------------------------------------*/
29
30/* Data sizes */
31
32#define USB_IRDA_DS_2048 (1 << 5)
33#define USB_IRDA_DS_1024 (1 << 4)
34#define USB_IRDA_DS_512 (1 << 3)
35#define USB_IRDA_DS_256 (1 << 2)
36#define USB_IRDA_DS_128 (1 << 1)
37#define USB_IRDA_DS_64 (1 << 0)
38
39/* Window sizes */
40
41#define USB_IRDA_WS_7 (1 << 6)
42#define USB_IRDA_WS_6 (1 << 5)
43#define USB_IRDA_WS_5 (1 << 4)
44#define USB_IRDA_WS_4 (1 << 3)
45#define USB_IRDA_WS_3 (1 << 2)
46#define USB_IRDA_WS_2 (1 << 1)
47#define USB_IRDA_WS_1 (1 << 0)
48
49/* Min turnaround times in usecs */
50
51#define USB_IRDA_MTT_0 (1 << 7)
52#define USB_IRDA_MTT_10 (1 << 6)
53#define USB_IRDA_MTT_50 (1 << 5)
54#define USB_IRDA_MTT_100 (1 << 4)
55#define USB_IRDA_MTT_500 (1 << 3)
56#define USB_IRDA_MTT_1000 (1 << 2)
57#define USB_IRDA_MTT_5000 (1 << 1)
58#define USB_IRDA_MTT_10000 (1 << 0)
59
60/* Baud rates */
61
62#define USB_IRDA_BR_4000000 (1 << 8)
63#define USB_IRDA_BR_1152000 (1 << 7)
64#define USB_IRDA_BR_576000 (1 << 6)
65#define USB_IRDA_BR_115200 (1 << 5)
66#define USB_IRDA_BR_57600 (1 << 4)
67#define USB_IRDA_BR_38400 (1 << 3)
68#define USB_IRDA_BR_19200 (1 << 2)
69#define USB_IRDA_BR_9600 (1 << 1)
70#define USB_IRDA_BR_2400 (1 << 0)
71
72/* Additional BOFs */
73
74#define USB_IRDA_AB_0 (1 << 7)
75#define USB_IRDA_AB_1 (1 << 6)
76#define USB_IRDA_AB_2 (1 << 5)
77#define USB_IRDA_AB_3 (1 << 4)
78#define USB_IRDA_AB_6 (1 << 3)
79#define USB_IRDA_AB_12 (1 << 2)
80#define USB_IRDA_AB_24 (1 << 1)
81#define USB_IRDA_AB_48 (1 << 0)
82
83/* IRDA Rate Sniff */
84
85#define USB_IRDA_RATE_SNIFF 1
86
87/*-------------------------------------------------------------------------*/
88
89struct usb_irda_cs_descriptor {
90 __u8 bLength;
91 __u8 bDescriptorType;
92
93 __le16 bcdSpecRevision;
94 __u8 bmDataSize;
95 __u8 bmWindowSize;
96 __u8 bmMinTurnaroundTime;
97 __le16 wBaudRate;
98 __u8 bmAdditionalBOFs;
99 __u8 bIrdaRateSniff;
100 __u8 bMaxUnicastList;
101} __attribute__ ((packed));
102
103/*-------------------------------------------------------------------------*/
104
105/* Data Format */
106
107#define USB_IRDA_STATUS_MEDIA_BUSY (1 << 7)
108
109/* The following is a 4-bit value used for both
110 * inbound and outbound headers:
111 *
112 * 0 - speed ignored
113 * 1 - 2400 bps
114 * 2 - 9600 bps
115 * 3 - 19200 bps
116 * 4 - 38400 bps
117 * 5 - 57600 bps
118 * 6 - 115200 bps
119 * 7 - 576000 bps
120 * 8 - 1.152 Mbps
121 * 9 - 5 mbps
122 * 10..15 - Reserved
123 */
124#define USB_IRDA_STATUS_LINK_SPEED 0x0f
125
126/* The following is a 4-bit value used only for
127 * outbound header:
128 *
129 * 0 - No change (BOF ignored)
130 * 1 - 48 BOFs
131 * 2 - 24 BOFs
132 * 3 - 12 BOFs
133 * 4 - 6 BOFs
134 * 5 - 3 BOFs
135 * 6 - 2 BOFs
136 * 7 - 1 BOFs
137 * 8 - 0 BOFs
138 * 9..15 - Reserved
139 */
140#define USB_IRDA_EXTRA_BOFS 0xf0
141
142struct usb_irda_inbound_header {
143 __u8 bmStatus;
144};
145
146struct usb_irda_outbound_header {
147 __u8 bmChange;
148};
149
150#endif /* __LINUX_USB_IRDA_H */
151
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h
index 29d6458ecb8..0a6e6d4b929 100644
--- a/include/linux/usb/rndis_host.h
+++ b/include/linux/usb/rndis_host.h
@@ -260,7 +260,8 @@ struct rndis_keepalive_c { /* IN (optionally OUT) */
260 260
261 261
262extern void rndis_status(struct usbnet *dev, struct urb *urb); 262extern void rndis_status(struct usbnet *dev, struct urb *urb);
263extern int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf); 263extern int
264rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen);
264extern int 265extern int
265generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags); 266generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags);
266extern void rndis_unbind(struct usbnet *dev, struct usb_interface *intf); 267extern void rndis_unbind(struct usbnet *dev, struct usb_interface *intf);
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 8f891cbaf9a..09a3e6a7518 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -62,7 +62,7 @@
62 */ 62 */
63struct usb_serial_port { 63struct usb_serial_port {
64 struct usb_serial *serial; 64 struct usb_serial *serial;
65 struct tty_struct *tty; 65 struct tty_port port;
66 spinlock_t lock; 66 spinlock_t lock;
67 struct mutex mutex; 67 struct mutex mutex;
68 unsigned char number; 68 unsigned char number;
@@ -89,7 +89,6 @@ struct usb_serial_port {
89 89
90 wait_queue_head_t write_wait; 90 wait_queue_head_t write_wait;
91 struct work_struct work; 91 struct work_struct work;
92 int open_count;
93 char throttled; 92 char throttled;
94 char throttle_req; 93 char throttle_req;
95 char console; 94 char console;
@@ -217,22 +216,27 @@ struct usb_serial_driver {
217 int (*resume)(struct usb_serial *serial); 216 int (*resume)(struct usb_serial *serial);
218 217
219 /* serial function calls */ 218 /* serial function calls */
220 int (*open)(struct usb_serial_port *port, struct file *filp); 219 /* Called by console with tty = NULL and by tty */
221 void (*close)(struct usb_serial_port *port, struct file *filp); 220 int (*open)(struct tty_struct *tty,
222 int (*write)(struct usb_serial_port *port, const unsigned char *buf, 221 struct usb_serial_port *port, struct file *filp);
223 int count); 222 void (*close)(struct tty_struct *tty,
224 int (*write_room)(struct usb_serial_port *port); 223 struct usb_serial_port *port, struct file *filp);
225 int (*ioctl)(struct usb_serial_port *port, struct file *file, 224 int (*write)(struct tty_struct *tty, struct usb_serial_port *port,
225 const unsigned char *buf, int count);
226 /* Called only by the tty layer */
227 int (*write_room)(struct tty_struct *tty);
228 int (*ioctl)(struct tty_struct *tty, struct file *file,
226 unsigned int cmd, unsigned long arg); 229 unsigned int cmd, unsigned long arg);
227 void (*set_termios)(struct usb_serial_port *port, struct ktermios *old); 230 void (*set_termios)(struct tty_struct *tty,
228 void (*break_ctl)(struct usb_serial_port *port, int break_state); 231 struct usb_serial_port *port, struct ktermios *old);
229 int (*chars_in_buffer)(struct usb_serial_port *port); 232 void (*break_ctl)(struct tty_struct *tty, int break_state);
230 void (*throttle)(struct usb_serial_port *port); 233 int (*chars_in_buffer)(struct tty_struct *tty);
231 void (*unthrottle)(struct usb_serial_port *port); 234 void (*throttle)(struct tty_struct *tty);
232 int (*tiocmget)(struct usb_serial_port *port, struct file *file); 235 void (*unthrottle)(struct tty_struct *tty);
233 int (*tiocmset)(struct usb_serial_port *port, struct file *file, 236 int (*tiocmget)(struct tty_struct *tty, struct file *file);
237 int (*tiocmset)(struct tty_struct *tty, struct file *file,
234 unsigned int set, unsigned int clear); 238 unsigned int set, unsigned int clear);
235 239 /* USB events */
236 void (*read_int_callback)(struct urb *urb); 240 void (*read_int_callback)(struct urb *urb);
237 void (*write_int_callback)(struct urb *urb); 241 void (*write_int_callback)(struct urb *urb);
238 void (*read_bulk_callback)(struct urb *urb); 242 void (*read_bulk_callback)(struct urb *urb);
@@ -270,19 +274,19 @@ static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}
270/* Functions needed by other parts of the usbserial core */ 274/* Functions needed by other parts of the usbserial core */
271extern struct usb_serial *usb_serial_get_by_index(unsigned int minor); 275extern struct usb_serial *usb_serial_get_by_index(unsigned int minor);
272extern void usb_serial_put(struct usb_serial *serial); 276extern void usb_serial_put(struct usb_serial *serial);
273extern int usb_serial_generic_open(struct usb_serial_port *port, 277extern int usb_serial_generic_open(struct tty_struct *tty,
274 struct file *filp); 278 struct usb_serial_port *port, struct file *filp);
275extern int usb_serial_generic_write(struct usb_serial_port *port, 279extern int usb_serial_generic_write(struct tty_struct *tty,
276 const unsigned char *buf, int count); 280 struct usb_serial_port *port, const unsigned char *buf, int count);
277extern void usb_serial_generic_close(struct usb_serial_port *port, 281extern void usb_serial_generic_close(struct tty_struct *tty,
278 struct file *filp); 282 struct usb_serial_port *port, struct file *filp);
279extern int usb_serial_generic_resume(struct usb_serial *serial); 283extern int usb_serial_generic_resume(struct usb_serial *serial);
280extern int usb_serial_generic_write_room(struct usb_serial_port *port); 284extern int usb_serial_generic_write_room(struct tty_struct *tty);
281extern int usb_serial_generic_chars_in_buffer(struct usb_serial_port *port); 285extern int usb_serial_generic_chars_in_buffer(struct tty_struct *tty);
282extern void usb_serial_generic_read_bulk_callback(struct urb *urb); 286extern void usb_serial_generic_read_bulk_callback(struct urb *urb);
283extern void usb_serial_generic_write_bulk_callback(struct urb *urb); 287extern void usb_serial_generic_write_bulk_callback(struct urb *urb);
284extern void usb_serial_generic_throttle(struct usb_serial_port *port); 288extern void usb_serial_generic_throttle(struct tty_struct *tty);
285extern void usb_serial_generic_unthrottle(struct usb_serial_port *port); 289extern void usb_serial_generic_unthrottle(struct tty_struct *tty);
286extern void usb_serial_generic_shutdown(struct usb_serial *serial); 290extern void usb_serial_generic_shutdown(struct usb_serial *serial);
287extern int usb_serial_generic_register(int debug); 291extern int usb_serial_generic_register(int debug);
288extern void usb_serial_generic_deregister(void); 292extern void usb_serial_generic_deregister(void);
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 3118ede2c67..0044d9b4cb8 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -22,8 +22,6 @@
22 * 22 *
23 * History: 23 * History:
24 * 0.1 04.01.2000 Created 24 * 0.1 04.01.2000 Created
25 *
26 * $Id: usbdevice_fs.h,v 1.1 2000/01/06 18:40:41 tom Exp $
27 */ 25 */
28 26
29/*****************************************************************************/ 27/*****************************************************************************/
diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h
index 4d0909e5359..79b9837d9ca 100644
--- a/include/linux/vermagic.h
+++ b/include/linux/vermagic.h
@@ -17,6 +17,11 @@
17#else 17#else
18#define MODULE_VERMAGIC_MODULE_UNLOAD "" 18#define MODULE_VERMAGIC_MODULE_UNLOAD ""
19#endif 19#endif
20#ifdef CONFIG_MODVERSIONS
21#define MODULE_VERMAGIC_MODVERSIONS "modversions "
22#else
23#define MODULE_VERMAGIC_MODVERSIONS ""
24#endif
20#ifndef MODULE_ARCH_VERMAGIC 25#ifndef MODULE_ARCH_VERMAGIC
21#define MODULE_ARCH_VERMAGIC "" 26#define MODULE_ARCH_VERMAGIC ""
22#endif 27#endif
@@ -24,5 +29,6 @@
24#define VERMAGIC_STRING \ 29#define VERMAGIC_STRING \
25 UTS_RELEASE " " \ 30 UTS_RELEASE " " \
26 MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \ 31 MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \
27 MODULE_VERMAGIC_MODULE_UNLOAD MODULE_ARCH_VERMAGIC 32 MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS \
33 MODULE_ARCH_VERMAGIC
28 34
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
index 9385a566aed..15a653d4113 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -17,6 +17,21 @@
17 17
18#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__) 18#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
19 19
20#define VID_TYPE_CAPTURE 1 /* Can capture */
21#define VID_TYPE_TUNER 2 /* Can tune */
22#define VID_TYPE_TELETEXT 4 /* Does teletext */
23#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
24#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
25#define VID_TYPE_CLIPPING 32 /* Can clip */
26#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
27#define VID_TYPE_SCALES 128 /* Scalable */
28#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
29#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
30#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
31#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
32#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
33#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
34
20struct video_capability 35struct video_capability
21{ 36{
22 char name[32]; 37 char name[32];
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index c1411189ba6..e466bd54a50 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -71,6 +71,11 @@
71 */ 71 */
72#define VIDEO_MAX_FRAME 32 72#define VIDEO_MAX_FRAME 32
73 73
74#ifndef __KERNEL__
75
76/* These defines are V4L1 specific and should not be used with the V4L2 API!
77 They will be removed from this header in the future. */
78
74#define VID_TYPE_CAPTURE 1 /* Can capture */ 79#define VID_TYPE_CAPTURE 1 /* Can capture */
75#define VID_TYPE_TUNER 2 /* Can tune */ 80#define VID_TYPE_TUNER 2 /* Can tune */
76#define VID_TYPE_TELETEXT 4 /* Does teletext */ 81#define VID_TYPE_TELETEXT 4 /* Does teletext */
@@ -85,14 +90,15 @@
85#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ 90#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
86#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ 91#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
87#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ 92#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
93#endif
88 94
89/* 95/*
90 * M I S C E L L A N E O U S 96 * M I S C E L L A N E O U S
91 */ 97 */
92 98
93/* Four-character-code (FOURCC) */ 99/* Four-character-code (FOURCC) */
94#define v4l2_fourcc(a,b,c,d)\ 100#define v4l2_fourcc(a, b, c, d)\
95 (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24)) 101 ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24))
96 102
97/* 103/*
98 * E N U M S 104 * E N U M S
@@ -226,8 +232,7 @@ struct v4l2_fract {
226/* 232/*
227 * D R I V E R C A P A B I L I T I E S 233 * D R I V E R C A P A B I L I T I E S
228 */ 234 */
229struct v4l2_capability 235struct v4l2_capability {
230{
231 __u8 driver[16]; /* i.e. "bttv" */ 236 __u8 driver[16]; /* i.e. "bttv" */
232 __u8 card[32]; /* i.e. "Hauppauge WinTV" */ 237 __u8 card[32]; /* i.e. "Hauppauge WinTV" */
233 __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */ 238 __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */
@@ -246,6 +251,7 @@ struct v4l2_capability
246#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ 251#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */
247#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ 252#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */
248#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */ 253#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */
254#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */
249 255
250#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ 256#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */
251#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ 257#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */
@@ -258,8 +264,7 @@ struct v4l2_capability
258/* 264/*
259 * V I D E O I M A G E F O R M A T 265 * V I D E O I M A G E F O R M A T
260 */ 266 */
261struct v4l2_pix_format 267struct v4l2_pix_format {
262{
263 __u32 width; 268 __u32 width;
264 __u32 height; 269 __u32 height;
265 __u32 pixelformat; 270 __u32 pixelformat;
@@ -271,64 +276,69 @@ struct v4l2_pix_format
271}; 276};
272 277
273/* Pixel format FOURCC depth Description */ 278/* Pixel format FOURCC depth Description */
274#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */ 279#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */
275#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R','4','4','4') /* 16 xxxxrrrr ggggbbbb */ 280#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */
276#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */ 281#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */
277#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */ 282#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 */ 283#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 */ 284#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */
280#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B','G','R','3') /* 24 BGR-8-8-8 */ 285#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 */ 286#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 */ 287#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */
283#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R','G','B','4') /* 32 RGB-8-8-8-8 */ 288#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */
284#define V4L2_PIX_FMT_GREY v4l2_fourcc('G','R','E','Y') /* 8 Greyscale */ 289#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
285#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y','1','6',' ') /* 16 Greyscale */ 290#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */
286#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P','A','L','8') /* 8 8-bit palette */ 291#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */
287#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y','V','U','9') /* 9 YVU 4:1:0 */ 292#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */
288#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */ 293#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */
289#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y','U','Y','V') /* 16 YUV 4:2:2 */ 294#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */
290#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U','Y','V','Y') /* 16 YUV 4:2:2 */ 295#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */
291#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4','2','2','P') /* 16 YVU422 planar */ 296#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */
292#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4','1','1','P') /* 16 YVU411 planar */ 297#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */
293#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y','4','1','P') /* 12 YUV 4:1:1 */ 298#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */
294#define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y','4','4','4') /* 16 xxxxyyyy uuuuvvvv */ 299#define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4') /* 16 xxxxyyyy uuuuvvvv */
295#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y','U','V','O') /* 16 YUV-5-5-5 */ 300#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */
296#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y','U','V','P') /* 16 YUV-5-6-5 */ 301#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */
297#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y','U','V','4') /* 32 YUV-8-8-8-8 */ 302#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */
298 303
299/* two planes -- one Y, one Cr + Cb interleaved */ 304/* two planes -- one Y, one Cr + Cb interleaved */
300#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N','V','1','2') /* 12 Y/CbCr 4:2:0 */ 305#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */
301#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N','V','2','1') /* 12 Y/CrCb 4:2:0 */ 306#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
302 307
303/* The following formats are not defined in the V4L2 specification */ 308/* The following formats are not defined in the V4L2 specification */
304#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y','U','V','9') /* 9 YUV 4:1:0 */ 309#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
305#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y','U','1','2') /* 12 YUV 4:2:0 */ 310#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */
306#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */ 311#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */
307#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */ 312#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */
308#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H','M','1','2') /* 8 YUV 4:2:0 16x16 macroblocks */ 313#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */
309 314
310/* see http://www.siliconimaging.com/RGB%20Bayer.htm */ 315/* see http://www.siliconimaging.com/RGB%20Bayer.htm */
311#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */ 316#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
312#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B','Y','R','2') /* 16 BGBG.. GRGR.. */ 317#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */
318#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */
313 319
314/* compressed formats */ 320/* compressed formats */
315#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M','J','P','G') /* Motion-JPEG */ 321#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */
316#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J','P','E','G') /* JFIF JPEG */ 322#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */
317#define V4L2_PIX_FMT_DV v4l2_fourcc('d','v','s','d') /* 1394 */ 323#define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */
318#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M','P','E','G') /* MPEG-1/2/4 */ 324#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */
319 325
320/* Vendor-specific formats */ 326/* Vendor-specific formats */
321#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compress */ 327#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */
322#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S','9','1','0') /* SN9C10x compression */ 328#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */
323#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P','W','C','1') /* pwc older webcam */ 329#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P', 'W', 'C', '1') /* pwc older webcam */
324#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P','W','C','2') /* pwc newer webcam */ 330#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P', 'W', 'C', '2') /* pwc newer webcam */
325#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E','6','2','5') /* ET61X251 compression */ 331#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') /* ET61X251 compression */
332#define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1') /* YUYV per line */
333#define V4L2_PIX_FMT_SPCA505 v4l2_fourcc('S', '5', '0', '5') /* YYUV per line */
334#define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */
335#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
336#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
326 337
327/* 338/*
328 * F O R M A T E N U M E R A T I O N 339 * F O R M A T E N U M E R A T I O N
329 */ 340 */
330struct v4l2_fmtdesc 341struct v4l2_fmtdesc {
331{
332 __u32 index; /* Format number */ 342 __u32 index; /* Format number */
333 enum v4l2_buf_type type; /* buffer type */ 343 enum v4l2_buf_type type; /* buffer type */
334 __u32 flags; 344 __u32 flags;
@@ -344,21 +354,18 @@ struct v4l2_fmtdesc
344/* 354/*
345 * F R A M E S I Z E E N U M E R A T I O N 355 * F R A M E S I Z E E N U M E R A T I O N
346 */ 356 */
347enum v4l2_frmsizetypes 357enum v4l2_frmsizetypes {
348{
349 V4L2_FRMSIZE_TYPE_DISCRETE = 1, 358 V4L2_FRMSIZE_TYPE_DISCRETE = 1,
350 V4L2_FRMSIZE_TYPE_CONTINUOUS = 2, 359 V4L2_FRMSIZE_TYPE_CONTINUOUS = 2,
351 V4L2_FRMSIZE_TYPE_STEPWISE = 3, 360 V4L2_FRMSIZE_TYPE_STEPWISE = 3,
352}; 361};
353 362
354struct v4l2_frmsize_discrete 363struct v4l2_frmsize_discrete {
355{
356 __u32 width; /* Frame width [pixel] */ 364 __u32 width; /* Frame width [pixel] */
357 __u32 height; /* Frame height [pixel] */ 365 __u32 height; /* Frame height [pixel] */
358}; 366};
359 367
360struct v4l2_frmsize_stepwise 368struct v4l2_frmsize_stepwise {
361{
362 __u32 min_width; /* Minimum frame width [pixel] */ 369 __u32 min_width; /* Minimum frame width [pixel] */
363 __u32 max_width; /* Maximum frame width [pixel] */ 370 __u32 max_width; /* Maximum frame width [pixel] */
364 __u32 step_width; /* Frame width step size [pixel] */ 371 __u32 step_width; /* Frame width step size [pixel] */
@@ -367,8 +374,7 @@ struct v4l2_frmsize_stepwise
367 __u32 step_height; /* Frame height step size [pixel] */ 374 __u32 step_height; /* Frame height step size [pixel] */
368}; 375};
369 376
370struct v4l2_frmsizeenum 377struct v4l2_frmsizeenum {
371{
372 __u32 index; /* Frame size number */ 378 __u32 index; /* Frame size number */
373 __u32 pixel_format; /* Pixel format */ 379 __u32 pixel_format; /* Pixel format */
374 __u32 type; /* Frame size type the device supports. */ 380 __u32 type; /* Frame size type the device supports. */
@@ -384,22 +390,19 @@ struct v4l2_frmsizeenum
384/* 390/*
385 * F R A M E R A T E E N U M E R A T I O N 391 * F R A M E R A T E E N U M E R A T I O N
386 */ 392 */
387enum v4l2_frmivaltypes 393enum v4l2_frmivaltypes {
388{
389 V4L2_FRMIVAL_TYPE_DISCRETE = 1, 394 V4L2_FRMIVAL_TYPE_DISCRETE = 1,
390 V4L2_FRMIVAL_TYPE_CONTINUOUS = 2, 395 V4L2_FRMIVAL_TYPE_CONTINUOUS = 2,
391 V4L2_FRMIVAL_TYPE_STEPWISE = 3, 396 V4L2_FRMIVAL_TYPE_STEPWISE = 3,
392}; 397};
393 398
394struct v4l2_frmival_stepwise 399struct v4l2_frmival_stepwise {
395{
396 struct v4l2_fract min; /* Minimum frame interval [s] */ 400 struct v4l2_fract min; /* Minimum frame interval [s] */
397 struct v4l2_fract max; /* Maximum frame interval [s] */ 401 struct v4l2_fract max; /* Maximum frame interval [s] */
398 struct v4l2_fract step; /* Frame interval step size [s] */ 402 struct v4l2_fract step; /* Frame interval step size [s] */
399}; 403};
400 404
401struct v4l2_frmivalenum 405struct v4l2_frmivalenum {
402{
403 __u32 index; /* Frame format index */ 406 __u32 index; /* Frame format index */
404 __u32 pixel_format; /* Pixel format */ 407 __u32 pixel_format; /* Pixel format */
405 __u32 width; /* Frame width */ 408 __u32 width; /* Frame width */
@@ -418,8 +421,7 @@ struct v4l2_frmivalenum
418/* 421/*
419 * T I M E C O D E 422 * T I M E C O D E
420 */ 423 */
421struct v4l2_timecode 424struct v4l2_timecode {
422{
423 __u32 type; 425 __u32 type;
424 __u32 flags; 426 __u32 flags;
425 __u8 frames; 427 __u8 frames;
@@ -444,8 +446,7 @@ struct v4l2_timecode
444#define V4L2_TC_USERBITS_8BITCHARS 0x0008 446#define V4L2_TC_USERBITS_8BITCHARS 0x0008
445/* The above is based on SMPTE timecodes */ 447/* The above is based on SMPTE timecodes */
446 448
447struct v4l2_jpegcompression 449struct v4l2_jpegcompression {
448{
449 int quality; 450 int quality;
450 451
451 int APPn; /* Number of APP segment to be written, 452 int APPn; /* Number of APP segment to be written,
@@ -477,16 +478,14 @@ struct v4l2_jpegcompression
477/* 478/*
478 * M E M O R Y - M A P P I N G B U F F E R S 479 * M E M O R Y - M A P P I N G B U F F E R S
479 */ 480 */
480struct v4l2_requestbuffers 481struct v4l2_requestbuffers {
481{
482 __u32 count; 482 __u32 count;
483 enum v4l2_buf_type type; 483 enum v4l2_buf_type type;
484 enum v4l2_memory memory; 484 enum v4l2_memory memory;
485 __u32 reserved[2]; 485 __u32 reserved[2];
486}; 486};
487 487
488struct v4l2_buffer 488struct v4l2_buffer {
489{
490 __u32 index; 489 __u32 index;
491 enum v4l2_buf_type type; 490 enum v4l2_buf_type type;
492 __u32 bytesused; 491 __u32 bytesused;
@@ -520,13 +519,12 @@ struct v4l2_buffer
520/* 519/*
521 * O V E R L A Y P R E V I E W 520 * O V E R L A Y P R E V I E W
522 */ 521 */
523struct v4l2_framebuffer 522struct v4l2_framebuffer {
524{
525 __u32 capability; 523 __u32 capability;
526 __u32 flags; 524 __u32 flags;
527/* FIXME: in theory we should pass something like PCI device + memory 525/* FIXME: in theory we should pass something like PCI device + memory
528 * region + offset instead of some physical address */ 526 * region + offset instead of some physical address */
529 void* base; 527 void *base;
530 struct v4l2_pix_format fmt; 528 struct v4l2_pix_format fmt;
531}; 529};
532/* Flags for the 'capability' field. Read only */ 530/* Flags for the 'capability' field. Read only */
@@ -545,14 +543,12 @@ struct v4l2_framebuffer
545#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 543#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010
546#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 544#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020
547 545
548struct v4l2_clip 546struct v4l2_clip {
549{
550 struct v4l2_rect c; 547 struct v4l2_rect c;
551 struct v4l2_clip __user *next; 548 struct v4l2_clip __user *next;
552}; 549};
553 550
554struct v4l2_window 551struct v4l2_window {
555{
556 struct v4l2_rect w; 552 struct v4l2_rect w;
557 enum v4l2_field field; 553 enum v4l2_field field;
558 __u32 chromakey; 554 __u32 chromakey;
@@ -565,8 +561,7 @@ struct v4l2_window
565/* 561/*
566 * C A P T U R E P A R A M E T E R S 562 * C A P T U R E P A R A M E T E R S
567 */ 563 */
568struct v4l2_captureparm 564struct v4l2_captureparm {
569{
570 __u32 capability; /* Supported modes */ 565 __u32 capability; /* Supported modes */
571 __u32 capturemode; /* Current mode */ 566 __u32 capturemode; /* Current mode */
572 struct v4l2_fract timeperframe; /* Time per frame in .1us units */ 567 struct v4l2_fract timeperframe; /* Time per frame in .1us units */
@@ -579,8 +574,7 @@ struct v4l2_captureparm
579#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */ 574#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */
580#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */ 575#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */
581 576
582struct v4l2_outputparm 577struct v4l2_outputparm {
583{
584 __u32 capability; /* Supported modes */ 578 __u32 capability; /* Supported modes */
585 __u32 outputmode; /* Current mode */ 579 __u32 outputmode; /* Current mode */
586 struct v4l2_fract timeperframe; /* Time per frame in seconds */ 580 struct v4l2_fract timeperframe; /* Time per frame in seconds */
@@ -697,8 +691,7 @@ typedef __u64 v4l2_std_id;
697#define V4L2_STD_ALL (V4L2_STD_525_60 |\ 691#define V4L2_STD_ALL (V4L2_STD_525_60 |\
698 V4L2_STD_625_50) 692 V4L2_STD_625_50)
699 693
700struct v4l2_standard 694struct v4l2_standard {
701{
702 __u32 index; 695 __u32 index;
703 v4l2_std_id id; 696 v4l2_std_id id;
704 __u8 name[24]; 697 __u8 name[24];
@@ -710,8 +703,7 @@ struct v4l2_standard
710/* 703/*
711 * V I D E O I N P U T S 704 * V I D E O I N P U T S
712 */ 705 */
713struct v4l2_input 706struct v4l2_input {
714{
715 __u32 index; /* Which input */ 707 __u32 index; /* Which input */
716 __u8 name[32]; /* Label */ 708 __u8 name[32]; /* Label */
717 __u32 type; /* Type of input */ 709 __u32 type; /* Type of input */
@@ -748,8 +740,7 @@ struct v4l2_input
748/* 740/*
749 * V I D E O O U T P U T S 741 * V I D E O O U T P U T S
750 */ 742 */
751struct v4l2_output 743struct v4l2_output {
752{
753 __u32 index; /* Which output */ 744 __u32 index; /* Which output */
754 __u8 name[32]; /* Label */ 745 __u8 name[32]; /* Label */
755 __u32 type; /* Type of output */ 746 __u32 type; /* Type of output */
@@ -766,14 +757,12 @@ struct v4l2_output
766/* 757/*
767 * C O N T R O L S 758 * C O N T R O L S
768 */ 759 */
769struct v4l2_control 760struct v4l2_control {
770{
771 __u32 id; 761 __u32 id;
772 __s32 value; 762 __s32 value;
773}; 763};
774 764
775struct v4l2_ext_control 765struct v4l2_ext_control {
776{
777 __u32 id; 766 __u32 id;
778 __u32 reserved2[2]; 767 __u32 reserved2[2];
779 union { 768 union {
@@ -783,8 +772,7 @@ struct v4l2_ext_control
783 }; 772 };
784} __attribute__ ((packed)); 773} __attribute__ ((packed));
785 774
786struct v4l2_ext_controls 775struct v4l2_ext_controls {
787{
788 __u32 ctrl_class; 776 __u32 ctrl_class;
789 __u32 count; 777 __u32 count;
790 __u32 error_idx; 778 __u32 error_idx;
@@ -802,8 +790,7 @@ struct v4l2_ext_controls
802#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) 790#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
803 791
804/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ 792/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
805struct v4l2_queryctrl 793struct v4l2_queryctrl {
806{
807 __u32 id; 794 __u32 id;
808 enum v4l2_ctrl_type type; 795 enum v4l2_ctrl_type type;
809 __u8 name[32]; /* Whatever */ 796 __u8 name[32]; /* Whatever */
@@ -816,8 +803,7 @@ struct v4l2_queryctrl
816}; 803};
817 804
818/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */ 805/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
819struct v4l2_querymenu 806struct v4l2_querymenu {
820{
821 __u32 id; 807 __u32 id;
822 __u32 index; 808 __u32 index;
823 __u8 name[32]; /* Whatever */ 809 __u8 name[32]; /* Whatever */
@@ -865,9 +851,9 @@ struct v4l2_querymenu
865#define V4L2_CID_HFLIP (V4L2_CID_BASE+20) 851#define V4L2_CID_HFLIP (V4L2_CID_BASE+20)
866#define V4L2_CID_VFLIP (V4L2_CID_BASE+21) 852#define V4L2_CID_VFLIP (V4L2_CID_BASE+21)
867 853
868/* Deprecated, use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */ 854/* Deprecated; use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */
869#define V4L2_CID_HCENTER_DEPRECATED (V4L2_CID_BASE+22) 855#define V4L2_CID_HCENTER (V4L2_CID_BASE+22)
870#define V4L2_CID_VCENTER_DEPRECATED (V4L2_CID_BASE+23) 856#define V4L2_CID_VCENTER (V4L2_CID_BASE+23)
871 857
872#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24) 858#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24)
873enum v4l2_power_line_frequency { 859enum v4l2_power_line_frequency {
@@ -1099,8 +1085,7 @@ enum v4l2_exposure_auto_type {
1099/* 1085/*
1100 * T U N I N G 1086 * T U N I N G
1101 */ 1087 */
1102struct v4l2_tuner 1088struct v4l2_tuner {
1103{
1104 __u32 index; 1089 __u32 index;
1105 __u8 name[32]; 1090 __u8 name[32];
1106 enum v4l2_tuner_type type; 1091 enum v4l2_tuner_type type;
@@ -1114,8 +1099,7 @@ struct v4l2_tuner
1114 __u32 reserved[4]; 1099 __u32 reserved[4];
1115}; 1100};
1116 1101
1117struct v4l2_modulator 1102struct v4l2_modulator {
1118{
1119 __u32 index; 1103 __u32 index;
1120 __u8 name[32]; 1104 __u8 name[32];
1121 __u32 capability; 1105 __u32 capability;
@@ -1148,19 +1132,25 @@ struct v4l2_modulator
1148#define V4L2_TUNER_MODE_LANG1 0x0003 1132#define V4L2_TUNER_MODE_LANG1 0x0003
1149#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 1133#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004
1150 1134
1151struct v4l2_frequency 1135struct v4l2_frequency {
1152{
1153 __u32 tuner; 1136 __u32 tuner;
1154 enum v4l2_tuner_type type; 1137 enum v4l2_tuner_type type;
1155 __u32 frequency; 1138 __u32 frequency;
1156 __u32 reserved[8]; 1139 __u32 reserved[8];
1157}; 1140};
1158 1141
1142struct v4l2_hw_freq_seek {
1143 __u32 tuner;
1144 enum v4l2_tuner_type type;
1145 __u32 seek_upward;
1146 __u32 wrap_around;
1147 __u32 reserved[8];
1148};
1149
1159/* 1150/*
1160 * A U D I O 1151 * A U D I O
1161 */ 1152 */
1162struct v4l2_audio 1153struct v4l2_audio {
1163{
1164 __u32 index; 1154 __u32 index;
1165 __u8 name[32]; 1155 __u8 name[32];
1166 __u32 capability; 1156 __u32 capability;
@@ -1175,8 +1165,7 @@ struct v4l2_audio
1175/* Flags for the 'mode' field */ 1165/* Flags for the 'mode' field */
1176#define V4L2_AUDMODE_AVL 0x00001 1166#define V4L2_AUDMODE_AVL 0x00001
1177 1167
1178struct v4l2_audioout 1168struct v4l2_audioout {
1179{
1180 __u32 index; 1169 __u32 index;
1181 __u8 name[32]; 1170 __u8 name[32];
1182 __u32 capability; 1171 __u32 capability;
@@ -1240,8 +1229,7 @@ struct v4l2_encoder_cmd {
1240 */ 1229 */
1241 1230
1242/* Raw VBI */ 1231/* Raw VBI */
1243struct v4l2_vbi_format 1232struct v4l2_vbi_format {
1244{
1245 __u32 sampling_rate; /* in 1 Hz */ 1233 __u32 sampling_rate; /* in 1 Hz */
1246 __u32 offset; 1234 __u32 offset;
1247 __u32 samples_per_line; 1235 __u32 samples_per_line;
@@ -1253,8 +1241,8 @@ struct v4l2_vbi_format
1253}; 1241};
1254 1242
1255/* VBI flags */ 1243/* VBI flags */
1256#define V4L2_VBI_UNSYNC (1<< 0) 1244#define V4L2_VBI_UNSYNC (1 << 0)
1257#define V4L2_VBI_INTERLACED (1<< 1) 1245#define V4L2_VBI_INTERLACED (1 << 1)
1258 1246
1259/* Sliced VBI 1247/* Sliced VBI
1260 * 1248 *
@@ -1263,8 +1251,7 @@ struct v4l2_vbi_format
1263 * notice in the definitive implementation. 1251 * notice in the definitive implementation.
1264 */ 1252 */
1265 1253
1266struct v4l2_sliced_vbi_format 1254struct v4l2_sliced_vbi_format {
1267{
1268 __u16 service_set; 1255 __u16 service_set;
1269 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field 1256 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
1270 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field 1257 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
@@ -1288,8 +1275,7 @@ struct v4l2_sliced_vbi_format
1288#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) 1275#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525)
1289#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) 1276#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625)
1290 1277
1291struct v4l2_sliced_vbi_cap 1278struct v4l2_sliced_vbi_cap {
1292{
1293 __u16 service_set; 1279 __u16 service_set;
1294 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field 1280 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
1295 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field 1281 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
@@ -1300,8 +1286,7 @@ struct v4l2_sliced_vbi_cap
1300 __u32 reserved[3]; /* must be 0 */ 1286 __u32 reserved[3]; /* must be 0 */
1301}; 1287};
1302 1288
1303struct v4l2_sliced_vbi_data 1289struct v4l2_sliced_vbi_data {
1304{
1305 __u32 id; 1290 __u32 id;
1306 __u32 field; /* 0: first field, 1: second field */ 1291 __u32 field; /* 0: first field, 1: second field */
1307 __u32 line; /* 1-23 */ 1292 __u32 line; /* 1-23 */
@@ -1315,27 +1300,23 @@ struct v4l2_sliced_vbi_data
1315 1300
1316/* Stream data format 1301/* Stream data format
1317 */ 1302 */
1318struct v4l2_format 1303struct v4l2_format {
1319{
1320 enum v4l2_buf_type type; 1304 enum v4l2_buf_type type;
1321 union 1305 union {
1322 { 1306 struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
1323 struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE 1307 struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
1324 struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY 1308 struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */
1325 struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE 1309 struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
1326 struct v4l2_sliced_vbi_format sliced; // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE 1310 __u8 raw_data[200]; /* user-defined */
1327 __u8 raw_data[200]; // user-defined
1328 } fmt; 1311 } fmt;
1329}; 1312};
1330 1313
1331 1314
1332/* Stream type-dependent parameters 1315/* Stream type-dependent parameters
1333 */ 1316 */
1334struct v4l2_streamparm 1317struct v4l2_streamparm {
1335{
1336 enum v4l2_buf_type type; 1318 enum v4l2_buf_type type;
1337 union 1319 union {
1338 {
1339 struct v4l2_captureparm capture; 1320 struct v4l2_captureparm capture;
1340 struct v4l2_outputparm output; 1321 struct v4l2_outputparm output;
1341 __u8 raw_data[200]; /* user-defined */ 1322 __u8 raw_data[200]; /* user-defined */
@@ -1373,91 +1354,86 @@ struct v4l2_chip_ident {
1373 * I O C T L C O D E S F O R V I D E O D E V I C E S 1354 * I O C T L C O D E S F O R V I D E O D E V I C E S
1374 * 1355 *
1375 */ 1356 */
1376#define VIDIOC_QUERYCAP _IOR ('V', 0, struct v4l2_capability) 1357#define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability)
1377#define VIDIOC_RESERVED _IO ('V', 1) 1358#define VIDIOC_RESERVED _IO('V', 1)
1378#define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) 1359#define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc)
1379#define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) 1360#define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format)
1380#define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) 1361#define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format)
1381#define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) 1362#define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers)
1382#define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) 1363#define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer)
1383#define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer) 1364#define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer)
1384#define VIDIOC_S_FBUF _IOW ('V', 11, struct v4l2_framebuffer) 1365#define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer)
1385#define VIDIOC_OVERLAY _IOW ('V', 14, int) 1366#define VIDIOC_OVERLAY _IOW('V', 14, int)
1386#define VIDIOC_QBUF _IOWR ('V', 15, struct v4l2_buffer) 1367#define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer)
1387#define VIDIOC_DQBUF _IOWR ('V', 17, struct v4l2_buffer) 1368#define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer)
1388#define VIDIOC_STREAMON _IOW ('V', 18, int) 1369#define VIDIOC_STREAMON _IOW('V', 18, int)
1389#define VIDIOC_STREAMOFF _IOW ('V', 19, int) 1370#define VIDIOC_STREAMOFF _IOW('V', 19, int)
1390#define VIDIOC_G_PARM _IOWR ('V', 21, struct v4l2_streamparm) 1371#define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm)
1391#define VIDIOC_S_PARM _IOWR ('V', 22, struct v4l2_streamparm) 1372#define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm)
1392#define VIDIOC_G_STD _IOR ('V', 23, v4l2_std_id) 1373#define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id)
1393#define VIDIOC_S_STD _IOW ('V', 24, v4l2_std_id) 1374#define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id)
1394#define VIDIOC_ENUMSTD _IOWR ('V', 25, struct v4l2_standard) 1375#define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard)
1395#define VIDIOC_ENUMINPUT _IOWR ('V', 26, struct v4l2_input) 1376#define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input)
1396#define VIDIOC_G_CTRL _IOWR ('V', 27, struct v4l2_control) 1377#define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control)
1397#define VIDIOC_S_CTRL _IOWR ('V', 28, struct v4l2_control) 1378#define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control)
1398#define VIDIOC_G_TUNER _IOWR ('V', 29, struct v4l2_tuner) 1379#define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner)
1399#define VIDIOC_S_TUNER _IOW ('V', 30, struct v4l2_tuner) 1380#define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner)
1400#define VIDIOC_G_AUDIO _IOR ('V', 33, struct v4l2_audio) 1381#define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio)
1401#define VIDIOC_S_AUDIO _IOW ('V', 34, struct v4l2_audio) 1382#define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio)
1402#define VIDIOC_QUERYCTRL _IOWR ('V', 36, struct v4l2_queryctrl) 1383#define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl)
1403#define VIDIOC_QUERYMENU _IOWR ('V', 37, struct v4l2_querymenu) 1384#define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu)
1404#define VIDIOC_G_INPUT _IOR ('V', 38, int) 1385#define VIDIOC_G_INPUT _IOR('V', 38, int)
1405#define VIDIOC_S_INPUT _IOWR ('V', 39, int) 1386#define VIDIOC_S_INPUT _IOWR('V', 39, int)
1406#define VIDIOC_G_OUTPUT _IOR ('V', 46, int) 1387#define VIDIOC_G_OUTPUT _IOR('V', 46, int)
1407#define VIDIOC_S_OUTPUT _IOWR ('V', 47, int) 1388#define VIDIOC_S_OUTPUT _IOWR('V', 47, int)
1408#define VIDIOC_ENUMOUTPUT _IOWR ('V', 48, struct v4l2_output) 1389#define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output)
1409#define VIDIOC_G_AUDOUT _IOR ('V', 49, struct v4l2_audioout) 1390#define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout)
1410#define VIDIOC_S_AUDOUT _IOW ('V', 50, struct v4l2_audioout) 1391#define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout)
1411#define VIDIOC_G_MODULATOR _IOWR ('V', 54, struct v4l2_modulator) 1392#define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator)
1412#define VIDIOC_S_MODULATOR _IOW ('V', 55, struct v4l2_modulator) 1393#define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator)
1413#define VIDIOC_G_FREQUENCY _IOWR ('V', 56, struct v4l2_frequency) 1394#define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency)
1414#define VIDIOC_S_FREQUENCY _IOW ('V', 57, struct v4l2_frequency) 1395#define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency)
1415#define VIDIOC_CROPCAP _IOWR ('V', 58, struct v4l2_cropcap) 1396#define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap)
1416#define VIDIOC_G_CROP _IOWR ('V', 59, struct v4l2_crop) 1397#define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop)
1417#define VIDIOC_S_CROP _IOW ('V', 60, struct v4l2_crop) 1398#define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop)
1418#define VIDIOC_G_JPEGCOMP _IOR ('V', 61, struct v4l2_jpegcompression) 1399#define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression)
1419#define VIDIOC_S_JPEGCOMP _IOW ('V', 62, struct v4l2_jpegcompression) 1400#define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression)
1420#define VIDIOC_QUERYSTD _IOR ('V', 63, v4l2_std_id) 1401#define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id)
1421#define VIDIOC_TRY_FMT _IOWR ('V', 64, struct v4l2_format) 1402#define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format)
1422#define VIDIOC_ENUMAUDIO _IOWR ('V', 65, struct v4l2_audio) 1403#define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio)
1423#define VIDIOC_ENUMAUDOUT _IOWR ('V', 66, struct v4l2_audioout) 1404#define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout)
1424#define VIDIOC_G_PRIORITY _IOR ('V', 67, enum v4l2_priority) 1405#define VIDIOC_G_PRIORITY _IOR('V', 67, enum v4l2_priority)
1425#define VIDIOC_S_PRIORITY _IOW ('V', 68, enum v4l2_priority) 1406#define VIDIOC_S_PRIORITY _IOW('V', 68, enum v4l2_priority)
1426#define VIDIOC_G_SLICED_VBI_CAP _IOWR ('V', 69, struct v4l2_sliced_vbi_cap) 1407#define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap)
1427#define VIDIOC_LOG_STATUS _IO ('V', 70) 1408#define VIDIOC_LOG_STATUS _IO('V', 70)
1428#define VIDIOC_G_EXT_CTRLS _IOWR ('V', 71, struct v4l2_ext_controls) 1409#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls)
1429#define VIDIOC_S_EXT_CTRLS _IOWR ('V', 72, struct v4l2_ext_controls) 1410#define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls)
1430#define VIDIOC_TRY_EXT_CTRLS _IOWR ('V', 73, struct v4l2_ext_controls) 1411#define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls)
1431#if 1 1412#if 1
1432#define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum) 1413#define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum)
1433#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum) 1414#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum)
1434#define VIDIOC_G_ENC_INDEX _IOR ('V', 76, struct v4l2_enc_idx) 1415#define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx)
1435#define VIDIOC_ENCODER_CMD _IOWR ('V', 77, struct v4l2_encoder_cmd) 1416#define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd)
1436#define VIDIOC_TRY_ENCODER_CMD _IOWR ('V', 78, struct v4l2_encoder_cmd) 1417#define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd)
1437 1418
1438/* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ 1419/* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */
1439#define VIDIOC_DBG_S_REGISTER _IOW ('V', 79, struct v4l2_register) 1420#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_register)
1440#define VIDIOC_DBG_G_REGISTER _IOWR ('V', 80, struct v4l2_register) 1421#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_register)
1441 1422
1442#define VIDIOC_G_CHIP_IDENT _IOWR ('V', 81, struct v4l2_chip_ident) 1423#define VIDIOC_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_chip_ident)
1443#endif 1424#endif
1425#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
1444 1426
1445#ifdef __OLD_VIDIOC_ 1427#ifdef __OLD_VIDIOC_
1446/* for compatibility, will go away some day */ 1428/* for compatibility, will go away some day */
1447#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) 1429#define VIDIOC_OVERLAY_OLD _IOWR('V', 14, int)
1448#define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm) 1430#define VIDIOC_S_PARM_OLD _IOW('V', 22, struct v4l2_streamparm)
1449#define VIDIOC_S_CTRL_OLD _IOW ('V', 28, struct v4l2_control) 1431#define VIDIOC_S_CTRL_OLD _IOW('V', 28, struct v4l2_control)
1450#define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio) 1432#define VIDIOC_G_AUDIO_OLD _IOWR('V', 33, struct v4l2_audio)
1451#define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout) 1433#define VIDIOC_G_AUDOUT_OLD _IOWR('V', 49, struct v4l2_audioout)
1452#define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap) 1434#define VIDIOC_CROPCAP_OLD _IOR('V', 58, struct v4l2_cropcap)
1453#endif 1435#endif
1454 1436
1455#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ 1437#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
1456 1438
1457#endif /* __LINUX_VIDEODEV2_H */ 1439#endif /* __LINUX_VIDEODEV2_H */
1458
1459/*
1460 * Local variables:
1461 * c-basic-offset: 8
1462 * End:
1463 */
diff --git a/include/linux/videotext.h b/include/linux/videotext.h
index 018f92047ff..3e68c8d1c7f 100644
--- a/include/linux/videotext.h
+++ b/include/linux/videotext.h
@@ -45,10 +45,10 @@
45#define VTXIOCCLRCACHE_OLD 0x710b /* clear cache on VTX-interface (if avail.) */ 45#define VTXIOCCLRCACHE_OLD 0x710b /* clear cache on VTX-interface (if avail.) */
46#define VTXIOCSETVIRT_OLD 0x710c /* turn on virtual mode (this disables TV-display) */ 46#define VTXIOCSETVIRT_OLD 0x710c /* turn on virtual mode (this disables TV-display) */
47 47
48/* 48/*
49 * Definitions for VTXIOCGETINFO 49 * Definitions for VTXIOCGETINFO
50 */ 50 */
51 51
52#define SAA5243 0 52#define SAA5243 0
53#define SAA5246 1 53#define SAA5246 1
54#define SAA5249 2 54#define SAA5249 2
@@ -57,10 +57,10 @@
57 57
58typedef struct { 58typedef struct {
59 int version_major, version_minor; /* version of driver; if version_major changes, driver */ 59 int version_major, version_minor; /* version of driver; if version_major changes, driver */
60 /* is not backward compatible!!! CHECK THIS!!! */ 60 /* is not backward compatible!!! CHECK THIS!!! */
61 int numpages; /* number of page-buffers of vtx-chipset */ 61 int numpages; /* number of page-buffers of vtx-chipset */
62 int cct_type; /* type of vtx-chipset (SAA5243, SAA5246, SAA5248 or 62 int cct_type; /* type of vtx-chipset (SAA5243, SAA5246, SAA5248 or
63 * SAA5249) */ 63 * SAA5249) */
64} 64}
65vtx_info_t; 65vtx_info_t;
66 66
@@ -81,7 +81,7 @@ vtx_info_t;
81#define PGMASK_HOUR (HR_TEN | HR_UNIT) 81#define PGMASK_HOUR (HR_TEN | HR_UNIT)
82#define PGMASK_MINUTE (MIN_TEN | MIN_UNIT) 82#define PGMASK_MINUTE (MIN_TEN | MIN_UNIT)
83 83
84typedef struct 84typedef struct
85{ 85{
86 int page; /* number of requested page (hexadecimal) */ 86 int page; /* number of requested page (hexadecimal) */
87 int hour; /* requested hour (hexadecimal) */ 87 int hour; /* requested hour (hexadecimal) */
@@ -98,11 +98,11 @@ vtx_pagereq_t;
98/* 98/*
99 * Definitions for VTXIOC{GETSTAT,PUTSTAT} 99 * Definitions for VTXIOC{GETSTAT,PUTSTAT}
100 */ 100 */
101 101
102#define VTX_PAGESIZE (40 * 24) 102#define VTX_PAGESIZE (40 * 24)
103#define VTX_VIRTUALSIZE (40 * 49) 103#define VTX_VIRTUALSIZE (40 * 49)
104 104
105typedef struct 105typedef struct
106{ 106{
107 int pagenum; /* number of page (hexadecimal) */ 107 int pagenum; /* number of page (hexadecimal) */
108 int hour; /* hour (hexadecimal) */ 108 int hour; /* hour (hexadecimal) */
@@ -121,5 +121,5 @@ typedef struct
121 unsigned hamming : 1; /* hamming-error occurred */ 121 unsigned hamming : 1; /* hamming-error occurred */
122} 122}
123vtx_pageinfo_t; 123vtx_pageinfo_t;
124 124
125#endif /* _VTX_H */ 125#endif /* _VTX_H */
diff --git a/include/linux/virtio_9p.h b/include/linux/virtio_9p.h
index 8eff0b53910..b3c4a60ceeb 100644
--- a/include/linux/virtio_9p.h
+++ b/include/linux/virtio_9p.h
@@ -1,5 +1,7 @@
1#ifndef _LINUX_VIRTIO_9P_H 1#ifndef _LINUX_VIRTIO_9P_H
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
4 * compatible drivers/servers. */
3#include <linux/virtio_config.h> 5#include <linux/virtio_config.h>
4 6
5/* The ID for virtio console */ 7/* The ID for virtio console */
diff --git a/include/linux/virtio_balloon.h b/include/linux/virtio_balloon.h
index 979524ee75b..c30c7bfbf39 100644
--- a/include/linux/virtio_balloon.h
+++ b/include/linux/virtio_balloon.h
@@ -1,5 +1,7 @@
1#ifndef _LINUX_VIRTIO_BALLOON_H 1#ifndef _LINUX_VIRTIO_BALLOON_H
2#define _LINUX_VIRTIO_BALLOON_H 2#define _LINUX_VIRTIO_BALLOON_H
3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */
3#include <linux/virtio_config.h> 5#include <linux/virtio_config.h>
4 6
5/* The ID for virtio_balloon */ 7/* The ID for virtio_balloon */
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h
index d4695a3356d..c1aef85243b 100644
--- a/include/linux/virtio_blk.h
+++ b/include/linux/virtio_blk.h
@@ -1,5 +1,7 @@
1#ifndef _LINUX_VIRTIO_BLK_H 1#ifndef _LINUX_VIRTIO_BLK_H
2#define _LINUX_VIRTIO_BLK_H 2#define _LINUX_VIRTIO_BLK_H
3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */
3#include <linux/virtio_config.h> 5#include <linux/virtio_config.h>
4 6
5/* The ID for virtio_block */ 7/* The ID for virtio_block */
@@ -10,21 +12,25 @@
10#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ 12#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
11#define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */ 13#define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */
12#define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */ 14#define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */
15#define VIRTIO_BLK_F_RO 5 /* Disk is read-only */
16#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/
13 17
14struct virtio_blk_config 18struct virtio_blk_config
15{ 19{
16 /* The capacity (in 512-byte sectors). */ 20 /* The capacity (in 512-byte sectors). */
17 __le64 capacity; 21 __u64 capacity;
18 /* The maximum segment size (if VIRTIO_BLK_F_SIZE_MAX) */ 22 /* The maximum segment size (if VIRTIO_BLK_F_SIZE_MAX) */
19 __le32 size_max; 23 __u32 size_max;
20 /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ 24 /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */
21 __le32 seg_max; 25 __u32 seg_max;
22 /* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */ 26 /* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */
23 struct virtio_blk_geometry { 27 struct virtio_blk_geometry {
24 __le16 cylinders; 28 __u16 cylinders;
25 __u8 heads; 29 __u8 heads;
26 __u8 sectors; 30 __u8 sectors;
27 } geometry; 31 } geometry;
32 /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */
33 __u32 blk_size;
28} __attribute__((packed)); 34} __attribute__((packed));
29 35
30/* These two define direction. */ 36/* These two define direction. */
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 50db245c81a..bf8ec283b23 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -1,5 +1,8 @@
1#ifndef _LINUX_VIRTIO_CONFIG_H 1#ifndef _LINUX_VIRTIO_CONFIG_H
2#define _LINUX_VIRTIO_CONFIG_H 2#define _LINUX_VIRTIO_CONFIG_H
3/* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
4 * anyone can use the definitions to implement compatible drivers/servers. */
5
3/* Virtio devices use a standardized configuration space to define their 6/* Virtio devices use a standardized configuration space to define their
4 * features and pass configuration information, but each implementation can 7 * features and pass configuration information, but each implementation can
5 * store and access that space differently. */ 8 * store and access that space differently. */
@@ -15,6 +18,16 @@
15/* We've given up on this device. */ 18/* We've given up on this device. */
16#define VIRTIO_CONFIG_S_FAILED 0x80 19#define VIRTIO_CONFIG_S_FAILED 0x80
17 20
21/* Some virtio feature bits (currently bits 28 through 31) are reserved for the
22 * transport being used (eg. virtio_ring), the rest are per-device feature
23 * bits. */
24#define VIRTIO_TRANSPORT_F_START 28
25#define VIRTIO_TRANSPORT_F_END 32
26
27/* Do we get callbacks when the ring is completely used, even if we've
28 * suppressed them? */
29#define VIRTIO_F_NOTIFY_ON_EMPTY 24
30
18#ifdef __KERNEL__ 31#ifdef __KERNEL__
19#include <linux/virtio.h> 32#include <linux/virtio.h>
20 33
@@ -48,9 +61,10 @@
48 * @get_features: get the array of feature bits for this device. 61 * @get_features: get the array of feature bits for this device.
49 * vdev: the virtio_device 62 * vdev: the virtio_device
50 * Returns the first 32 feature bits (all we currently need). 63 * Returns the first 32 feature bits (all we currently need).
51 * @set_features: confirm what device features we'll be using. 64 * @finalize_features: confirm what device features we'll be using.
52 * vdev: the virtio_device 65 * vdev: the virtio_device
53 * feature: the first 32 feature bits 66 * This gives the final feature bits for the device: it can change
67 * the dev->feature bits if it wants.
54 */ 68 */
55struct virtio_config_ops 69struct virtio_config_ops
56{ 70{
@@ -66,7 +80,7 @@ struct virtio_config_ops
66 void (*callback)(struct virtqueue *)); 80 void (*callback)(struct virtqueue *));
67 void (*del_vq)(struct virtqueue *vq); 81 void (*del_vq)(struct virtqueue *vq);
68 u32 (*get_features)(struct virtio_device *vdev); 82 u32 (*get_features)(struct virtio_device *vdev);
69 void (*set_features)(struct virtio_device *vdev, u32 features); 83 void (*finalize_features)(struct virtio_device *vdev);
70}; 84};
71 85
72/* If driver didn't advertise the feature, it will never appear. */ 86/* If driver didn't advertise the feature, it will never appear. */
@@ -99,7 +113,7 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
99 * The return value is -ENOENT if the feature doesn't exist. Otherwise 113 * The return value is -ENOENT if the feature doesn't exist. Otherwise
100 * the config value is copied into whatever is pointed to by v. */ 114 * the config value is copied into whatever is pointed to by v. */
101#define virtio_config_val(vdev, fbit, offset, v) \ 115#define virtio_config_val(vdev, fbit, offset, v) \
102 virtio_config_buf((vdev), (fbit), (offset), (v), sizeof(v)) 116 virtio_config_buf((vdev), (fbit), (offset), (v), sizeof(*v))
103 117
104static inline int virtio_config_buf(struct virtio_device *vdev, 118static inline int virtio_config_buf(struct virtio_device *vdev,
105 unsigned int fbit, 119 unsigned int fbit,
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h
index ed2d4ead7eb..19a0da0dba4 100644
--- a/include/linux/virtio_console.h
+++ b/include/linux/virtio_console.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_VIRTIO_CONSOLE_H 1#ifndef _LINUX_VIRTIO_CONSOLE_H
2#define _LINUX_VIRTIO_CONSOLE_H 2#define _LINUX_VIRTIO_CONSOLE_H
3#include <linux/virtio_config.h> 3#include <linux/virtio_config.h>
4/* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
5 * anyone can use the definitions to implement compatible drivers/servers. */
4 6
5/* The ID for virtio console */ 7/* The ID for virtio console */
6#define VIRTIO_ID_CONSOLE 3 8#define VIRTIO_ID_CONSOLE 3
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 9405aa6cdf2..5e33761b9b8 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -1,5 +1,7 @@
1#ifndef _LINUX_VIRTIO_NET_H 1#ifndef _LINUX_VIRTIO_NET_H
2#define _LINUX_VIRTIO_NET_H 2#define _LINUX_VIRTIO_NET_H
3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */
3#include <linux/virtio_config.h> 5#include <linux/virtio_config.h>
4 6
5/* The ID for virtio_net */ 7/* The ID for virtio_net */
@@ -38,7 +40,7 @@ struct virtio_net_hdr
38#define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set 40#define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set
39 __u8 gso_type; 41 __u8 gso_type;
40 __u16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ 42 __u16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */
41 __u16 gso_size; /* Bytes to append to gso_hdr_len per frame */ 43 __u16 gso_size; /* Bytes to append to hdr_len per frame */
42 __u16 csum_start; /* Position to start checksumming from */ 44 __u16 csum_start; /* Position to start checksumming from */
43 __u16 csum_offset; /* Offset after that to place checksum */ 45 __u16 csum_offset; /* Offset after that to place checksum */
44}; 46};
diff --git a/include/linux/virtio_pci.h b/include/linux/virtio_pci.h
index b3151659cf4..cdef3574293 100644
--- a/include/linux/virtio_pci.h
+++ b/include/linux/virtio_pci.h
@@ -9,9 +9,8 @@
9 * Authors: 9 * Authors:
10 * Anthony Liguori <aliguori@us.ibm.com> 10 * Anthony Liguori <aliguori@us.ibm.com>
11 * 11 *
12 * This work is licensed under the terms of the GNU GPL, version 2 or later. 12 * This header is BSD licensed so anyone can use the definitions to implement
13 * See the COPYING file in the top-level directory. 13 * compatible drivers/servers.
14 *
15 */ 14 */
16 15
17#ifndef _LINUX_VIRTIO_PCI_H 16#ifndef _LINUX_VIRTIO_PCI_H
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index abe481ed990..c4a598fb382 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -120,6 +120,8 @@ struct virtqueue *vring_new_virtqueue(unsigned int num,
120 void (*notify)(struct virtqueue *vq), 120 void (*notify)(struct virtqueue *vq),
121 void (*callback)(struct virtqueue *vq)); 121 void (*callback)(struct virtqueue *vq));
122void vring_del_virtqueue(struct virtqueue *vq); 122void vring_del_virtqueue(struct virtqueue *vq);
123/* Filter out transport-specific feature bits. */
124void vring_transport_features(struct virtio_device *vdev);
123 125
124irqreturn_t vring_interrupt(int irq, void *_vq); 126irqreturn_t vring_interrupt(int irq, void *_vq);
125#endif /* __KERNEL__ */ 127#endif /* __KERNEL__ */
diff --git a/include/linux/virtio_rng.h b/include/linux/virtio_rng.h
new file mode 100644
index 00000000000..1a85dab8a94
--- /dev/null
+++ b/include/linux/virtio_rng.h
@@ -0,0 +1,10 @@
1#ifndef _LINUX_VIRTIO_RNG_H
2#define _LINUX_VIRTIO_RNG_H
3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */
5#include <linux/virtio_config.h>
6
7/* The ID for virtio_rng */
8#define VIRTIO_ID_RNG 4
9
10#endif /* _LINUX_VIRTIO_RNG_H */
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index e83b69346d2..58334d43951 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -44,6 +44,12 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
44 NR_VM_EVENT_ITEMS 44 NR_VM_EVENT_ITEMS
45}; 45};
46 46
47extern const struct seq_operations fragmentation_op;
48extern const struct seq_operations pagetypeinfo_op;
49extern const struct seq_operations zoneinfo_op;
50extern const struct seq_operations vmstat_op;
51extern int sysctl_stat_interval;
52
47#ifdef CONFIG_VM_EVENT_COUNTERS 53#ifdef CONFIG_VM_EVENT_COUNTERS
48/* 54/*
49 * Light weight per cpu counter implementation. 55 * Light weight per cpu counter implementation.
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 9448ffbdcbf..14c0e91be9b 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -12,6 +12,7 @@
12#include <linux/mutex.h> 12#include <linux/mutex.h>
13#include <linux/console_struct.h> 13#include <linux/console_struct.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/consolemap.h>
15 16
16/* 17/*
17 * Presently, a lot of graphics programs do not restore the contents of 18 * Presently, a lot of graphics programs do not restore the contents of
@@ -54,6 +55,7 @@ void redraw_screen(struct vc_data *vc, int is_switch);
54struct tty_struct; 55struct tty_struct;
55int tioclinux(struct tty_struct *tty, unsigned long arg); 56int tioclinux(struct tty_struct *tty, unsigned long arg);
56 57
58#ifdef CONFIG_CONSOLE_TRANSLATIONS
57/* consolemap.c */ 59/* consolemap.c */
58 60
59struct unimapinit; 61struct unimapinit;
@@ -71,6 +73,23 @@ void con_free_unimap(struct vc_data *vc);
71void con_protect_unimap(struct vc_data *vc, int rdonly); 73void con_protect_unimap(struct vc_data *vc, int rdonly);
72int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc); 74int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
73 75
76#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \
77 (vc)->vc_toggle_meta ? 0x80 : 0])
78#else
79#define con_set_trans_old(arg) (0)
80#define con_get_trans_old(arg) (-EINVAL)
81#define con_set_trans_new(arg) (0)
82#define con_get_trans_new(arg) (-EINVAL)
83#define con_clear_unimap(vc, ui) (0)
84#define con_set_unimap(vc, ct, list) (0)
85#define con_set_default_unimap(vc) (0)
86#define con_copy_unimap(d, s) (0)
87#define con_get_unimap(vc, ct, uct, list) (-EINVAL)
88#define con_free_unimap(vc) do { ; } while (0)
89
90#define vc_translate(vc, c) (c)
91#endif
92
74/* vt.c */ 93/* vt.c */
75int vt_waitactive(int vt); 94int vt_waitactive(int vt);
76void change_console(struct vc_data *new_vc); 95void change_console(struct vc_data *new_vc);
diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h
index 3add87465b1..e0aa39612eb 100644
--- a/include/linux/wanrouter.h
+++ b/include/linux/wanrouter.h
@@ -522,7 +522,7 @@ extern int wanrouter_proc_init(void);
522extern void wanrouter_proc_cleanup(void); 522extern void wanrouter_proc_cleanup(void);
523extern int wanrouter_proc_add(struct wan_device *wandev); 523extern int wanrouter_proc_add(struct wan_device *wandev);
524extern int wanrouter_proc_delete(struct wan_device *wandev); 524extern int wanrouter_proc_delete(struct wan_device *wandev);
525extern int wanrouter_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); 525extern long wanrouter_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
526 526
527/* Public Data */ 527/* Public Data */
528/* list of registered devices */ 528/* list of registered devices */
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 0a9b5b41ed6..d7958f9b52c 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -611,6 +611,7 @@
611#define IW_ENCODE_ALG_WEP 1 611#define IW_ENCODE_ALG_WEP 1
612#define IW_ENCODE_ALG_TKIP 2 612#define IW_ENCODE_ALG_TKIP 2
613#define IW_ENCODE_ALG_CCMP 3 613#define IW_ENCODE_ALG_CCMP 3
614#define IW_ENCODE_ALG_PMK 4
614/* struct iw_encode_ext ->ext_flags */ 615/* struct iw_encode_ext ->ext_flags */
615#define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001 616#define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001
616#define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002 617#define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002
@@ -630,6 +631,7 @@
630#define IW_ENC_CAPA_WPA2 0x00000002 631#define IW_ENC_CAPA_WPA2 0x00000002
631#define IW_ENC_CAPA_CIPHER_TKIP 0x00000004 632#define IW_ENC_CAPA_CIPHER_TKIP 0x00000004
632#define IW_ENC_CAPA_CIPHER_CCMP 0x00000008 633#define IW_ENC_CAPA_CIPHER_CCMP 0x00000008
634#define IW_ENC_CAPA_4WAY_HANDSHAKE 0x00000010
633 635
634/* Event capability macros - in (struct iw_range *)->event_capa 636/* Event capability macros - in (struct iw_range *)->event_capa
635 * Because we have more than 32 possible events, we use an array of 637 * Because we have more than 32 possible events, we use an array of
@@ -675,6 +677,19 @@ struct iw_point
675 __u16 flags; /* Optional params */ 677 __u16 flags; /* Optional params */
676}; 678};
677 679
680#ifdef __KERNEL__
681#ifdef CONFIG_COMPAT
682
683#include <linux/compat.h>
684
685struct compat_iw_point {
686 compat_caddr_t pointer;
687 __u16 length;
688 __u16 flags;
689};
690#endif
691#endif
692
678/* 693/*
679 * A frequency 694 * A frequency
680 * For numbers lower than 10^9, we encode the number in 'm' and 695 * For numbers lower than 10^9, we encode the number in 'm' and
@@ -1098,6 +1113,21 @@ struct iw_event
1098#define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \ 1113#define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \
1099 IW_EV_POINT_OFF) 1114 IW_EV_POINT_OFF)
1100 1115
1116#ifdef __KERNEL__
1117#ifdef CONFIG_COMPAT
1118struct __compat_iw_event {
1119 __u16 len; /* Real length of this stuff */
1120 __u16 cmd; /* Wireless IOCTL */
1121 compat_caddr_t pointer;
1122};
1123#define IW_EV_COMPAT_LCP_LEN offsetof(struct __compat_iw_event, pointer)
1124#define IW_EV_COMPAT_POINT_OFF offsetof(struct compat_iw_point, length)
1125#define IW_EV_COMPAT_POINT_LEN \
1126 (IW_EV_COMPAT_LCP_LEN + sizeof(struct compat_iw_point) - \
1127 IW_EV_COMPAT_POINT_OFF)
1128#endif
1129#endif
1130
1101/* Size of the Event prefix when packed in stream */ 1131/* Size of the Event prefix when packed in stream */
1102#define IW_EV_LCP_PK_LEN (4) 1132#define IW_EV_LCP_PK_LEN (4)
1103/* Size of the various events when packed in stream */ 1133/* Size of the various events when packed in stream */
diff --git a/include/linux/wm97xx.h b/include/linux/wm97xx.h
index 4d13732e9cf..6f69968eab2 100644
--- a/include/linux/wm97xx.h
+++ b/include/linux/wm97xx.h
@@ -100,6 +100,7 @@
100#define WM9713_ADCSEL_Y 0x0004 /* Y measurement */ 100#define WM9713_ADCSEL_Y 0x0004 /* Y measurement */
101#define WM9713_ADCSEL_PRES 0x0008 /* Pressure measurement */ 101#define WM9713_ADCSEL_PRES 0x0008 /* Pressure measurement */
102#define WM9713_COO 0x0001 /* enable coordinate mode */ 102#define WM9713_COO 0x0001 /* enable coordinate mode */
103#define WM9713_45W 0x1000 /* set for 5 wire panel */
103#define WM9713_PDEN 0x0800 /* measure only when pen down */ 104#define WM9713_PDEN 0x0800 /* measure only when pen down */
104#define WM9713_ADCSEL_MASK 0x00fe /* ADC selection mask */ 105#define WM9713_ADCSEL_MASK 0x00fe /* ADC selection mask */
105#define WM9713_WAIT 0x0200 /* coordinate wait */ 106#define WM9713_WAIT 0x0200 /* coordinate wait */
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 542526c6e8e..5c158c477ac 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -179,6 +179,8 @@ __create_workqueue_key(const char *name, int singlethread,
179extern void destroy_workqueue(struct workqueue_struct *wq); 179extern void destroy_workqueue(struct workqueue_struct *wq);
180 180
181extern int queue_work(struct workqueue_struct *wq, struct work_struct *work); 181extern int queue_work(struct workqueue_struct *wq, struct work_struct *work);
182extern int queue_work_on(int cpu, struct workqueue_struct *wq,
183 struct work_struct *work);
182extern int queue_delayed_work(struct workqueue_struct *wq, 184extern int queue_delayed_work(struct workqueue_struct *wq,
183 struct delayed_work *work, unsigned long delay); 185 struct delayed_work *work, unsigned long delay);
184extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, 186extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
@@ -188,6 +190,7 @@ extern void flush_workqueue(struct workqueue_struct *wq);
188extern void flush_scheduled_work(void); 190extern void flush_scheduled_work(void);
189 191
190extern int schedule_work(struct work_struct *work); 192extern int schedule_work(struct work_struct *work);
193extern int schedule_work_on(int cpu, struct work_struct *work);
191extern int schedule_delayed_work(struct delayed_work *work, unsigned long delay); 194extern int schedule_delayed_work(struct delayed_work *work, unsigned long delay);
192extern int schedule_delayed_work_on(int cpu, struct delayed_work *work, 195extern int schedule_delayed_work_on(int cpu, struct delayed_work *work,
193 unsigned long delay); 196 unsigned long delay);
@@ -198,6 +201,8 @@ extern int keventd_up(void);
198extern void init_workqueues(void); 201extern void init_workqueues(void);
199int execute_in_process_context(work_func_t fn, struct execute_work *); 202int execute_in_process_context(work_func_t fn, struct execute_work *);
200 203
204extern int flush_work(struct work_struct *work);
205
201extern int cancel_work_sync(struct work_struct *work); 206extern int cancel_work_sync(struct work_struct *work);
202 207
203/* 208/*
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index f462439cc28..12b15c561a1 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -63,6 +63,7 @@ struct writeback_control {
63 unsigned for_writepages:1; /* This is a writepages() call */ 63 unsigned for_writepages:1; /* This is a writepages() call */
64 unsigned range_cyclic:1; /* range_start is cyclic */ 64 unsigned range_cyclic:1; /* range_start is cyclic */
65 unsigned more_io:1; /* more io to be dispatched */ 65 unsigned more_io:1; /* more io to be dispatched */
66 unsigned range_cont:1;
66}; 67};
67 68
68/* 69/*
@@ -105,6 +106,8 @@ extern int vm_highmem_is_dirtyable;
105extern int block_dump; 106extern int block_dump;
106extern int laptop_mode; 107extern int laptop_mode;
107 108
109extern unsigned long determine_dirtyable_memory(void);
110
108extern int dirty_ratio_handler(struct ctl_table *table, int write, 111extern int dirty_ratio_handler(struct ctl_table *table, int write,
109 struct file *filp, void __user *buffer, size_t *lenp, 112 struct file *filp, void __user *buffer, size_t *lenp,
110 loff_t *ppos); 113 loff_t *ppos);
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 2ca6bae8872..fb0c215a305 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -339,6 +339,7 @@ struct xfrm_usersa_info {
339#define XFRM_STATE_NOPMTUDISC 4 339#define XFRM_STATE_NOPMTUDISC 4
340#define XFRM_STATE_WILDRECV 8 340#define XFRM_STATE_WILDRECV 8
341#define XFRM_STATE_ICMP 16 341#define XFRM_STATE_ICMP 16
342#define XFRM_STATE_AF_UNSPEC 32
342}; 343};
343 344
344struct xfrm_usersa_id { 345struct xfrm_usersa_id {