aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-12-07 01:28:35 -0500
committerFrederic Weisbecker <fweisbec@gmail.com>2009-12-07 01:29:22 -0500
commit6548698f929814375fa5d62ae1db96959b0418c1 (patch)
tree340924ae82cb0946aa15045b2b72186de52a8146 /include/linux
parent1d2c6cfd40b2dece3bb958cbbc405a2c1536ab75 (diff)
parent22763c5cf3690a681551162c15d34d935308c8d7 (diff)
Merge commit 'v2.6.32' into reiserfs/kill-bkl
Merge-reason: The tree was based 2.6.31. It's better to be up to date with 2.6.32. Although no conflicting changes were made in between, it gives benchmarking results closer to the lastest kernel behaviour.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild6
-rw-r--r--include/linux/acpi.h15
-rw-r--r--include/linux/agp_backend.h7
-rw-r--r--include/linux/aio.h2
-rw-r--r--include/linux/amba/bus.h5
-rw-r--r--include/linux/amba/mmci.h18
-rw-r--r--include/linux/amba/pl022.h8
-rw-r--r--include/linux/amba/pl093.h80
-rw-r--r--include/linux/anon_inodes.h3
-rw-r--r--include/linux/arcdevice.h3
-rw-r--r--include/linux/async_tx.h129
-rw-r--r--include/linux/ata.h43
-rw-r--r--include/linux/atmdev.h2
-rw-r--r--include/linux/attribute_container.h2
-rw-r--r--include/linux/backing-dev.h57
-rw-r--r--include/linux/backlight.h7
-rw-r--r--include/linux/binfmts.h2
-rw-r--r--include/linux/bio.h69
-rw-r--r--include/linux/blk-iopoll.h48
-rw-r--r--include/linux/blkdev.h88
-rw-r--r--include/linux/blktrace_api.h2
-rw-r--r--include/linux/bootmem.h5
-rw-r--r--include/linux/can/dev.h1
-rw-r--r--include/linux/capability.h2
-rw-r--r--include/linux/cgroup.h55
-rw-r--r--include/linux/clocksource.h122
-rw-r--r--include/linux/cn_proc.h10
-rw-r--r--include/linux/configfs.h4
-rw-r--r--include/linux/connector.h11
-rw-r--r--include/linux/cpu.h17
-rw-r--r--include/linux/cpufreq.h17
-rw-r--r--include/linux/cpumask.h721
-rw-r--r--include/linux/cred.h56
-rw-r--r--include/linux/crypto.h43
-rw-r--r--include/linux/cyclades.h11
-rw-r--r--include/linux/dca.h11
-rw-r--r--include/linux/dcbnl.h18
-rw-r--r--include/linux/debugfs.h2
-rw-r--r--include/linux/delayacct.h1
-rw-r--r--include/linux/device.h65
-rw-r--r--include/linux/dma-mapping.h6
-rw-r--r--include/linux/dmaengine.h179
-rw-r--r--include/linux/dmi.h13
-rw-r--r--include/linux/dtlk.h19
-rw-r--r--include/linux/dvb/dmx.h2
-rw-r--r--include/linux/dvb/frontend.h46
-rw-r--r--include/linux/dvb/version.h2
-rw-r--r--include/linux/elf.h1
-rw-r--r--include/linux/enclosure.h5
-rw-r--r--include/linux/ethtool.h15
-rw-r--r--include/linux/eventfd.h6
-rw-r--r--include/linux/ext3_fs_i.h8
-rw-r--r--include/linux/fb.h7
-rw-r--r--include/linux/fips.h10
-rw-r--r--include/linux/firewire.h14
-rw-r--r--include/linux/flex_array.h32
-rw-r--r--include/linux/fs.h78
-rw-r--r--include/linux/fscache-cache.h40
-rw-r--r--include/linux/fscache.h27
-rw-r--r--include/linux/ftrace.h7
-rw-r--r--include/linux/ftrace_event.h67
-rw-r--r--include/linux/fuse.h29
-rw-r--r--include/linux/futex.h14
-rw-r--r--include/linux/genhd.h25
-rw-r--r--include/linux/gfp.h15
-rw-r--r--include/linux/gfs2_ondisk.h22
-rw-r--r--include/linux/gpio.h11
-rw-r--r--include/linux/hardirq.h10
-rw-r--r--include/linux/hayesesp.h1
-rw-r--r--include/linux/hdlc.h8
-rw-r--r--include/linux/hid-debug.h48
-rw-r--r--include/linux/hid.h25
-rw-r--r--include/linux/hrtimer.h2
-rw-r--r--include/linux/hugetlb.h44
-rw-r--r--include/linux/i2c-id.h11
-rw-r--r--include/linux/i2c-pnx.h2
-rw-r--r--include/linux/i2c.h20
-rw-r--r--include/linux/i2c/adp5588.h92
-rw-r--r--include/linux/i2c/mcs5000_ts.h24
-rw-r--r--include/linux/i2c/twl4030.h113
-rw-r--r--include/linux/i8042.h30
-rw-r--r--include/linux/icmpv6.h2
-rw-r--r--include/linux/ide.h30
-rw-r--r--include/linux/ieee80211.h31
-rw-r--r--include/linux/if_addr.h1
-rw-r--r--include/linux/if_arp.h1
-rw-r--r--include/linux/if_ether.h4
-rw-r--r--include/linux/if_frad.h5
-rw-r--r--include/linux/if_tun.h1
-rw-r--r--include/linux/if_tunnel.h2
-rw-r--r--include/linux/igmp.h2
-rw-r--r--include/linux/init.h13
-rw-r--r--include/linux/init_task.h25
-rw-r--r--include/linux/input.h6
-rw-r--r--include/linux/input/eeti_ts.h9
-rw-r--r--include/linux/input/matrix_keypad.h32
-rw-r--r--include/linux/intel-iommu.h2
-rw-r--r--include/linux/interrupt.h9
-rw-r--r--include/linux/io-mapping.h17
-rw-r--r--include/linux/ioport.h4
-rw-r--r--include/linux/iova.h1
-rw-r--r--include/linux/ipc.h2
-rw-r--r--include/linux/irq.h18
-rw-r--r--include/linux/irqnr.h6
-rw-r--r--include/linux/isdn/hdlc.h82
-rw-r--r--include/linux/isdn_ppp.h2
-rw-r--r--include/linux/jbd.h28
-rw-r--r--include/linux/jbd2.h29
-rw-r--r--include/linux/kernel.h27
-rw-r--r--include/linux/key.h8
-rw-r--r--include/linux/keyctl.h1
-rw-r--r--include/linux/kfifo.h4
-rw-r--r--include/linux/kmemcheck.h18
-rw-r--r--include/linux/kmemleak.h18
-rw-r--r--include/linux/kprobes.h4
-rw-r--r--include/linux/kref.h1
-rw-r--r--include/linux/ksm.h79
-rw-r--r--include/linux/kvm.h127
-rw-r--r--include/linux/kvm_host.h115
-rw-r--r--include/linux/kvm_para.h1
-rw-r--r--include/linux/libata.h15
-rw-r--r--include/linux/libps2.h3
-rw-r--r--include/linux/linkage.h2
-rw-r--r--include/linux/lis3lv02d.h11
-rw-r--r--include/linux/lockd/lockd.h45
-rw-r--r--include/linux/lockdep.h18
-rw-r--r--include/linux/lsm_audit.h12
-rw-r--r--include/linux/mISDNhw.h1
-rw-r--r--include/linux/mISDNif.h18
-rw-r--r--include/linux/magic.h6
-rw-r--r--include/linux/marker.h221
-rw-r--r--include/linux/mdio.h2
-rw-r--r--include/linux/memcontrol.h10
-rw-r--r--include/linux/memory_hotplug.h8
-rw-r--r--include/linux/mempool.h10
-rw-r--r--include/linux/mfd/ab3100.h37
-rw-r--r--include/linux/mfd/core.h1
-rw-r--r--include/linux/mfd/da903x.h4
-rw-r--r--include/linux/mfd/ezx-pcap.h7
-rw-r--r--include/linux/mfd/mc13783-private.h396
-rw-r--r--include/linux/mfd/mc13783.h84
-rw-r--r--include/linux/mfd/pcf50633/adc.h3
-rw-r--r--include/linux/mfd/pcf50633/core.h1
-rw-r--r--include/linux/mfd/wm831x/auxadc.h216
-rw-r--r--include/linux/mfd/wm831x/core.h289
-rw-r--r--include/linux/mfd/wm831x/gpio.h55
-rw-r--r--include/linux/mfd/wm831x/irq.h764
-rw-r--r--include/linux/mfd/wm831x/otp.h162
-rw-r--r--include/linux/mfd/wm831x/pdata.h113
-rw-r--r--include/linux/mfd/wm831x/pmu.h189
-rw-r--r--include/linux/mfd/wm831x/regulator.h1218
-rw-r--r--include/linux/mfd/wm831x/status.h34
-rw-r--r--include/linux/mfd/wm831x/watchdog.h52
-rw-r--r--include/linux/mfd/wm8350/core.h7
-rw-r--r--include/linux/miscdevice.h3
-rw-r--r--include/linux/mm.h49
-rw-r--r--include/linux/mm_inline.h31
-rw-r--r--include/linux/mm_types.h9
-rw-r--r--include/linux/mmc/card.h12
-rw-r--r--include/linux/mmc/core.h1
-rw-r--r--include/linux/mmc/host.h59
-rw-r--r--include/linux/mmc/mmc.h3
-rw-r--r--include/linux/mmc/sdio_func.h3
-rw-r--r--include/linux/mmc/sdio_ids.h6
-rw-r--r--include/linux/mmu_context.h9
-rw-r--r--include/linux/mmu_notifier.h34
-rw-r--r--include/linux/mmzone.h30
-rw-r--r--include/linux/mod_devicetable.h11
-rw-r--r--include/linux/module.h42
-rw-r--r--include/linux/moduleparam.h1
-rw-r--r--include/linux/mroute.h4
-rw-r--r--include/linux/mroute6.h4
-rw-r--r--include/linux/mtd/nand.h5
-rw-r--r--include/linux/mtd/nand_ecc.h6
-rw-r--r--include/linux/mtd/onenand.h8
-rw-r--r--include/linux/mtd/onenand_regs.h3
-rw-r--r--include/linux/mtd/partitions.h2
-rw-r--r--include/linux/namei.h2
-rw-r--r--include/linux/net.h13
-rw-r--r--include/linux/net_dropmon.h1
-rw-r--r--include/linux/netdevice.h58
-rw-r--r--include/linux/netfilter.h4
-rw-r--r--include/linux/netfilter/nfnetlink.h3
-rw-r--r--include/linux/netfilter/x_tables.h4
-rw-r--r--include/linux/netfilter/xt_CONNMARK.h6
-rw-r--r--include/linux/netfilter/xt_MARK.h17
-rw-r--r--include/linux/netfilter/xt_connmark.h5
-rw-r--r--include/linux/netfilter/xt_conntrack.h36
-rw-r--r--include/linux/netfilter/xt_mark.h5
-rw-r--r--include/linux/netfilter_arp/arp_tables.h2
-rw-r--r--include/linux/netfilter_bridge/ebtables.h2
-rw-r--r--include/linux/netfilter_ipv4/Kbuild32
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h2
-rw-r--r--include/linux/netfilter_ipv4/ipt_CLASSIFY.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_CONNMARK.h19
-rw-r--r--include/linux/netfilter_ipv4/ipt_DSCP.h18
-rw-r--r--include/linux/netfilter_ipv4/ipt_ECN.h4
-rw-r--r--include/linux/netfilter_ipv4/ipt_MARK.h18
-rw-r--r--include/linux/netfilter_ipv4/ipt_NFQUEUE.h16
-rw-r--r--include/linux/netfilter_ipv4/ipt_TCPMSS.h9
-rw-r--r--include/linux/netfilter_ipv4/ipt_TOS.h12
-rw-r--r--include/linux/netfilter_ipv4/ipt_comment.h10
-rw-r--r--include/linux/netfilter_ipv4/ipt_connbytes.h18
-rw-r--r--include/linux/netfilter_ipv4/ipt_connmark.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_conntrack.h28
-rw-r--r--include/linux/netfilter_ipv4/ipt_dccp.h15
-rw-r--r--include/linux/netfilter_ipv4/ipt_dscp.h21
-rw-r--r--include/linux/netfilter_ipv4/ipt_ecn.h4
-rw-r--r--include/linux/netfilter_ipv4/ipt_esp.h10
-rw-r--r--include/linux/netfilter_ipv4/ipt_hashlimit.h14
-rw-r--r--include/linux/netfilter_ipv4/ipt_helper.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_iprange.h21
-rw-r--r--include/linux/netfilter_ipv4/ipt_length.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_limit.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_mac.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_mark.h9
-rw-r--r--include/linux/netfilter_ipv4/ipt_multiport.h15
-rw-r--r--include/linux/netfilter_ipv4/ipt_owner.h20
-rw-r--r--include/linux/netfilter_ipv4/ipt_physdev.h17
-rw-r--r--include/linux/netfilter_ipv4/ipt_pkttype.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_policy.h23
-rw-r--r--include/linux/netfilter_ipv4/ipt_recent.h21
-rw-r--r--include/linux/netfilter_ipv4/ipt_sctp.h105
-rw-r--r--include/linux/netfilter_ipv4/ipt_state.h15
-rw-r--r--include/linux/netfilter_ipv4/ipt_string.h10
-rw-r--r--include/linux/netfilter_ipv4/ipt_tcpmss.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_tos.h13
-rw-r--r--include/linux/netfilter_ipv6/Kbuild12
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h2
-rw-r--r--include/linux/netfilter_ipv6/ip6t_MARK.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6t_esp.h10
-rw-r--r--include/linux/netfilter_ipv6/ip6t_length.h8
-rw-r--r--include/linux/netfilter_ipv6/ip6t_limit.h8
-rw-r--r--include/linux/netfilter_ipv6/ip6t_mac.h7
-rw-r--r--include/linux/netfilter_ipv6/ip6t_mark.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6t_multiport.h14
-rw-r--r--include/linux/netfilter_ipv6/ip6t_owner.h18
-rw-r--r--include/linux/netfilter_ipv6/ip6t_physdev.h17
-rw-r--r--include/linux/netfilter_ipv6/ip6t_policy.h23
-rw-r--r--include/linux/netlink.h20
-rw-r--r--include/linux/nfs4.h3
-rw-r--r--include/linux/nfs_fs.h1
-rw-r--r--include/linux/nfs_fs_sb.h9
-rw-r--r--include/linux/nfsd/nfsd.h9
-rw-r--r--include/linux/nfsd/state.h77
-rw-r--r--include/linux/nfsd/xdr4.h19
-rw-r--r--include/linux/nilfs2_fs.h9
-rw-r--r--include/linux/nl80211.h174
-rw-r--r--include/linux/nl802154.h6
-rw-r--r--include/linux/nmi.h19
-rw-r--r--include/linux/notifier.h2
-rw-r--r--include/linux/oom.h11
-rw-r--r--include/linux/oprofile.h5
-rw-r--r--include/linux/page-flags.h46
-rw-r--r--include/linux/page_cgroup.h17
-rw-r--r--include/linux/pagemap.h4
-rw-r--r--include/linux/pci.h14
-rw-r--r--include/linux/pci_hotplug.h16
-rw-r--r--include/linux/pci_ids.h34
-rw-r--r--include/linux/pci_regs.h1
-rw-r--r--include/linux/percpu-defs.h82
-rw-r--r--include/linux/percpu.h88
-rw-r--r--include/linux/perf_counter.h459
-rw-r--r--include/linux/perf_event.h863
-rw-r--r--include/linux/phonet.h21
-rw-r--r--include/linux/platform_device.h5
-rw-r--r--include/linux/pm.h115
-rw-r--r--include/linux/pm_runtime.h114
-rw-r--r--include/linux/pnp.h1
-rw-r--r--include/linux/poison.h3
-rw-r--r--include/linux/poll.h2
-rw-r--r--include/linux/power_supply.h21
-rw-r--r--include/linux/prctl.h18
-rw-r--r--include/linux/proc_fs.h16
-rw-r--r--include/linux/quotaops.h4
-rw-r--r--include/linux/ramfs.h2
-rw-r--r--include/linux/rcuclassic.h178
-rw-r--r--include/linux/rculist_nulls.h2
-rw-r--r--include/linux/rcupdate.h143
-rw-r--r--include/linux/rcupreempt.h127
-rw-r--r--include/linux/rcupreempt_trace.h97
-rw-r--r--include/linux/rcutree.h267
-rw-r--r--include/linux/rds.h12
-rw-r--r--include/linux/regulator/consumer.h4
-rw-r--r--include/linux/regulator/driver.h7
-rw-r--r--include/linux/regulator/fixed.h24
-rw-r--r--include/linux/regulator/machine.h26
-rw-r--r--include/linux/regulator/max1586.h4
-rw-r--r--include/linux/relay.h2
-rw-r--r--include/linux/res_counter.h58
-rw-r--r--include/linux/rfkill.h38
-rw-r--r--include/linux/ring_buffer.h24
-rw-r--r--include/linux/rmap.h27
-rw-r--r--include/linux/rtnetlink.h2
-rw-r--r--include/linux/rxrpc.h7
-rw-r--r--include/linux/sched.h224
-rw-r--r--include/linux/security.h156
-rw-r--r--include/linux/selinux.h9
-rw-r--r--include/linux/seq_file.h38
-rw-r--r--include/linux/serial.h2
-rw-r--r--include/linux/serial_8250.h1
-rw-r--r--include/linux/serial_core.h100
-rw-r--r--include/linux/serio.h2
-rw-r--r--include/linux/sfi.h206
-rw-r--r--include/linux/sfi_acpi.h93
-rw-r--r--include/linux/sh_intc.h1
-rw-r--r--include/linux/shmem_fs.h5
-rw-r--r--include/linux/signal.h2
-rw-r--r--include/linux/skbuff.h12
-rw-r--r--include/linux/slob_def.h5
-rw-r--r--include/linux/slow-work.h72
-rw-r--r--include/linux/slub_def.h8
-rw-r--r--include/linux/smp.h11
-rw-r--r--include/linux/socket.h21
-rw-r--r--include/linux/spi/lms283gf05.h28
-rw-r--r--include/linux/spi/mc33880.h10
-rw-r--r--include/linux/spi/spi.h51
-rw-r--r--include/linux/spinlock.h64
-rw-r--r--include/linux/spinlock_api_smp.h394
-rw-r--r--include/linux/ssb/ssb.h69
-rw-r--r--include/linux/ssb/ssb_driver_chipcommon.h10
-rw-r--r--include/linux/ssb/ssb_regs.h66
-rw-r--r--include/linux/string.h2
-rw-r--r--include/linux/sunrpc/auth.h4
-rw-r--r--include/linux/sunrpc/cache.h40
-rw-r--r--include/linux/sunrpc/clnt.h157
-rw-r--r--include/linux/sunrpc/msg_prot.h17
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h20
-rw-r--r--include/linux/sunrpc/svc.h2
-rw-r--r--include/linux/sunrpc/svc_xprt.h1
-rw-r--r--include/linux/sunrpc/svcsock.h1
-rw-r--r--include/linux/sunrpc/xdr.h11
-rw-r--r--include/linux/sunrpc/xprt.h21
-rw-r--r--include/linux/sunrpc/xprtrdma.h5
-rw-r--r--include/linux/sunrpc/xprtsock.h11
-rw-r--r--include/linux/suspend.h21
-rw-r--r--include/linux/swap.h61
-rw-r--r--include/linux/swapops.h38
-rw-r--r--include/linux/swiotlb.h11
-rw-r--r--include/linux/syscalls.h132
-rw-r--r--include/linux/sysctl.h19
-rw-r--r--include/linux/taskstats_kern.h1
-rw-r--r--include/linux/tboot.h162
-rw-r--r--include/linux/tcp.h6
-rw-r--r--include/linux/time.h38
-rw-r--r--include/linux/timer.h5
-rw-r--r--include/linux/tipc.h2
-rw-r--r--include/linux/topology.h168
-rw-r--r--include/linux/trace_seq.h2
-rw-r--r--include/linux/tracehook.h34
-rw-r--r--include/linux/tracepoint.h33
-rw-r--r--include/linux/transport_class.h2
-rw-r--r--include/linux/tty.h27
-rw-r--r--include/linux/tty_driver.h13
-rw-r--r--include/linux/ucb1400.h19
-rw-r--r--include/linux/unaligned/be_byteshift.h2
-rw-r--r--include/linux/unaligned/le_byteshift.h2
-rw-r--r--include/linux/usb.h31
-rw-r--r--include/linux/usb/audio.h287
-rw-r--r--include/linux/usb/ch9.h8
-rw-r--r--include/linux/usb/ehci_def.h35
-rw-r--r--include/linux/usb/isp1362.h46
-rw-r--r--include/linux/usb/isp1760.h18
-rw-r--r--include/linux/usb/m66592.h44
-rw-r--r--include/linux/usb/r8a66597.h375
-rw-r--r--include/linux/usb/rndis_host.h13
-rw-r--r--include/linux/usb/serial.h13
-rw-r--r--include/linux/usb/usbnet.h19
-rw-r--r--include/linux/usb/video.h164
-rw-r--r--include/linux/usbdevice_fs.h3
-rw-r--r--include/linux/utsname.h1
-rw-r--r--include/linux/uwb.h2
-rw-r--r--include/linux/vgaarb.h210
-rw-r--r--include/linux/videodev2.h108
-rw-r--r--include/linux/virtio.h2
-rw-r--r--include/linux/virtio_9p.h3
-rw-r--r--include/linux/virtio_balloon.h4
-rw-r--r--include/linux/virtio_blk.h23
-rw-r--r--include/linux/virtio_config.h3
-rw-r--r--include/linux/virtio_console.h4
-rw-r--r--include/linux/virtio_ids.h17
-rw-r--r--include/linux/virtio_net.h4
-rw-r--r--include/linux/virtio_rng.h4
-rw-r--r--include/linux/vmalloc.h6
-rw-r--r--include/linux/vmstat.h16
-rw-r--r--include/linux/vt.h32
-rw-r--r--include/linux/vt_kern.h16
-rw-r--r--include/linux/wait.h4
-rw-r--r--include/linux/wireless.h8
-rw-r--r--include/linux/wm97xx.h25
-rw-r--r--include/linux/wm97xx_batt.h18
-rw-r--r--include/linux/workqueue.h3
-rw-r--r--include/linux/writeback.h39
-rw-r--r--include/linux/xattr.h1
394 files changed, 12140 insertions, 4463 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 334a3593cdfd..1feed71551c9 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -126,6 +126,7 @@ header-y += nfs_mount.h
126header-y += nl80211.h 126header-y += nl80211.h
127header-y += param.h 127header-y += param.h
128header-y += pci_regs.h 128header-y += pci_regs.h
129header-y += perf_event.h
129header-y += pfkeyv2.h 130header-y += pfkeyv2.h
130header-y += pg.h 131header-y += pg.h
131header-y += phantom.h 132header-y += phantom.h
@@ -268,6 +269,10 @@ ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \
268 $(srctree)/include/asm-$(SRCARCH)/kvm.h),) 269 $(srctree)/include/asm-$(SRCARCH)/kvm.h),)
269unifdef-y += kvm.h 270unifdef-y += kvm.h
270endif 271endif
272ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \
273 $(srctree)/include/asm-$(SRCARCH)/kvm_para.h),)
274unifdef-y += kvm_para.h
275endif
271unifdef-y += llc.h 276unifdef-y += llc.h
272unifdef-y += loop.h 277unifdef-y += loop.h
273unifdef-y += lp.h 278unifdef-y += lp.h
@@ -359,6 +364,7 @@ unifdef-y += utsname.h
359unifdef-y += videodev2.h 364unifdef-y += videodev2.h
360unifdef-y += videodev.h 365unifdef-y += videodev.h
361unifdef-y += virtio_config.h 366unifdef-y += virtio_config.h
367unifdef-y += virtio_ids.h
362unifdef-y += virtio_blk.h 368unifdef-y += virtio_blk.h
363unifdef-y += virtio_net.h 369unifdef-y += virtio_net.h
364unifdef-y += virtio_9p.h 370unifdef-y += virtio_9p.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 34321cfffeab..dfcd920c3e54 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -41,8 +41,6 @@
41#include <acpi/acpi_drivers.h> 41#include <acpi/acpi_drivers.h>
42#include <acpi/acpi_numa.h> 42#include <acpi/acpi_numa.h>
43#include <asm/acpi.h> 43#include <asm/acpi.h>
44#include <linux/dmi.h>
45
46 44
47enum acpi_irq_model_id { 45enum acpi_irq_model_id {
48 ACPI_IRQ_MODEL_PIC = 0, 46 ACPI_IRQ_MODEL_PIC = 0,
@@ -219,10 +217,8 @@ static inline int acpi_video_display_switch_support(void)
219#endif /* defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) */ 217#endif /* defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) */
220 218
221extern int acpi_blacklisted(void); 219extern int acpi_blacklisted(void);
222#ifdef CONFIG_DMI
223extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); 220extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d);
224extern int acpi_osi_setup(char *str); 221extern int acpi_osi_setup(char *str);
225#endif
226 222
227#ifdef CONFIG_ACPI_NUMA 223#ifdef CONFIG_ACPI_NUMA
228int acpi_get_pxm(acpi_handle handle); 224int acpi_get_pxm(acpi_handle handle);
@@ -292,7 +288,10 @@ void __init acpi_s4_no_nvs(void);
292extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags); 288extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags);
293extern void acpi_early_init(void); 289extern void acpi_early_init(void);
294 290
295#else /* CONFIG_ACPI */ 291#else /* !CONFIG_ACPI */
292
293#define acpi_disabled 1
294
296static inline void acpi_early_init(void) { } 295static inline void acpi_early_init(void) { }
297 296
298static inline int early_acpi_boot_init(void) 297static inline int early_acpi_boot_init(void)
@@ -331,5 +330,11 @@ static inline int acpi_check_mem_region(resource_size_t start,
331 return 0; 330 return 0;
332} 331}
333 332
333struct acpi_table_header;
334static inline int acpi_table_parse(char *id,
335 int (*handler)(struct acpi_table_header *))
336{
337 return -1;
338}
334#endif /* !CONFIG_ACPI */ 339#endif /* !CONFIG_ACPI */
335#endif /*_LINUX_ACPI_H*/ 340#endif /*_LINUX_ACPI_H*/
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h
index 76fa794fdac0..9101ed64f803 100644
--- a/include/linux/agp_backend.h
+++ b/include/linux/agp_backend.h
@@ -53,7 +53,7 @@ struct agp_kern_info {
53 int current_memory; 53 int current_memory;
54 bool cant_use_aperture; 54 bool cant_use_aperture;
55 unsigned long page_mask; 55 unsigned long page_mask;
56 struct vm_operations_struct *vm_ops; 56 const struct vm_operations_struct *vm_ops;
57}; 57};
58 58
59/* 59/*
@@ -79,9 +79,12 @@ struct agp_memory {
79 u32 physical; 79 u32 physical;
80 bool is_bound; 80 bool is_bound;
81 bool is_flushed; 81 bool is_flushed;
82 bool vmalloc_flag; 82 bool vmalloc_flag;
83 /* list of agp_memory mapped to the aperture */ 83 /* list of agp_memory mapped to the aperture */
84 struct list_head mapped_list; 84 struct list_head mapped_list;
85 /* DMA-mapped addresses */
86 struct scatterlist *sg_list;
87 int num_sg;
85}; 88};
86 89
87#define AGP_NORMAL_MEMORY 0 90#define AGP_NORMAL_MEMORY 0
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 47f7d932a01d..aea219d7d8d1 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -225,8 +225,6 @@ static inline void exit_aio(struct mm_struct *mm) { }
225 225
226#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait) 226#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait)
227 227
228#include <linux/aio_abi.h>
229
230static inline struct kiocb *list_kiocb(struct list_head *h) 228static inline struct kiocb *list_kiocb(struct list_head *h)
231{ 229{
232 return list_entry(h, struct kiocb, ki_list); 230 return list_entry(h, struct kiocb, ki_list);
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 9b93cafa82a0..ab94335b4bb9 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -36,6 +36,11 @@ struct amba_driver {
36 struct amba_id *id_table; 36 struct amba_id *id_table;
37}; 37};
38 38
39enum amba_vendor {
40 AMBA_VENDOR_ARM = 0x41,
41 AMBA_VENDOR_ST = 0x80,
42};
43
39#define amba_get_drvdata(d) dev_get_drvdata(&d->dev) 44#define amba_get_drvdata(d) dev_get_drvdata(&d->dev)
40#define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p) 45#define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p)
41 46
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
new file mode 100644
index 000000000000..6b4241748dda
--- /dev/null
+++ b/include/linux/amba/mmci.h
@@ -0,0 +1,18 @@
1/*
2 * include/linux/amba/mmci.h
3 */
4#ifndef AMBA_MMCI_H
5#define AMBA_MMCI_H
6
7#include <linux/mmc/host.h>
8
9struct mmci_platform_data {
10 unsigned int ocr_mask; /* available voltages */
11 u32 (*translate_vdd)(struct device *, unsigned int);
12 unsigned int (*status)(struct device *);
13 int gpio_wp;
14 int gpio_cd;
15 unsigned long capabilities;
16};
17
18#endif
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
index dcad0ffd1755..e4836c6b3dd7 100644
--- a/include/linux/amba/pl022.h
+++ b/include/linux/amba/pl022.h
@@ -136,12 +136,12 @@ enum ssp_tx_level_trig {
136 136
137/** 137/**
138 * enum SPI Clock Phase - clock phase (Motorola SPI interface only) 138 * enum SPI Clock Phase - clock phase (Motorola SPI interface only)
139 * @SSP_CLK_RISING_EDGE: Receive data on rising edge 139 * @SSP_CLK_FIRST_EDGE: Receive data on first edge transition (actual direction depends on polarity)
140 * @SSP_CLK_FALLING_EDGE: Receive data on falling edge 140 * @SSP_CLK_SECOND_EDGE: Receive data on second edge transition (actual direction depends on polarity)
141 */ 141 */
142enum ssp_spi_clk_phase { 142enum ssp_spi_clk_phase {
143 SSP_CLK_RISING_EDGE, 143 SSP_CLK_FIRST_EDGE,
144 SSP_CLK_FALLING_EDGE 144 SSP_CLK_SECOND_EDGE
145}; 145};
146 146
147/** 147/**
diff --git a/include/linux/amba/pl093.h b/include/linux/amba/pl093.h
new file mode 100644
index 000000000000..2983e3671adb
--- /dev/null
+++ b/include/linux/amba/pl093.h
@@ -0,0 +1,80 @@
1/* linux/amba/pl093.h
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * AMBA PL093 SSMC (synchronous static memory controller)
8 * See DDI0236.pdf (r0p4) for more details
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#define SMB_BANK(x) ((x) * 0x20) /* each bank control set is 0x20 apart */
16
17/* Offsets for SMBxxxxRy registers */
18
19#define SMBIDCYR (0x00)
20#define SMBWSTRDR (0x04)
21#define SMBWSTWRR (0x08)
22#define SMBWSTOENR (0x0C)
23#define SMBWSTWENR (0x10)
24#define SMBCR (0x14)
25#define SMBSR (0x18)
26#define SMBWSTBRDR (0x1C)
27
28/* Masks for SMB registers */
29#define IDCY_MASK (0xf)
30#define WSTRD_MASK (0xf)
31#define WSTWR_MASK (0xf)
32#define WSTOEN_MASK (0xf)
33#define WSTWEN_MASK (0xf)
34
35/* Notes from datasheet:
36 * WSTOEN <= WSTRD
37 * WSTWEN <= WSTWR
38 *
39 * WSTOEN is not used with nWAIT
40 */
41
42/* SMBCR bit definitions */
43#define SMBCR_BIWRITEEN (1 << 21)
44#define SMBCR_ADDRVALIDWRITEEN (1 << 20)
45#define SMBCR_SYNCWRITE (1 << 17)
46#define SMBCR_BMWRITE (1 << 16)
47#define SMBCR_WRAPREAD (1 << 14)
48#define SMBCR_BIREADEN (1 << 13)
49#define SMBCR_ADDRVALIDREADEN (1 << 12)
50#define SMBCR_SYNCREAD (1 << 9)
51#define SMBCR_BMREAD (1 << 8)
52#define SMBCR_SMBLSPOL (1 << 6)
53#define SMBCR_WP (1 << 3)
54#define SMBCR_WAITEN (1 << 2)
55#define SMBCR_WAITPOL (1 << 1)
56#define SMBCR_RBLE (1 << 0)
57
58#define SMBCR_BURSTLENWRITE_MASK (3 << 18)
59#define SMBCR_BURSTLENWRITE_4 (0 << 18)
60#define SMBCR_BURSTLENWRITE_8 (1 << 18)
61#define SMBCR_BURSTLENWRITE_RESERVED (2 << 18)
62#define SMBCR_BURSTLENWRITE_CONTINUOUS (3 << 18)
63
64#define SMBCR_BURSTLENREAD_MASK (3 << 10)
65#define SMBCR_BURSTLENREAD_4 (0 << 10)
66#define SMBCR_BURSTLENREAD_8 (1 << 10)
67#define SMBCR_BURSTLENREAD_16 (2 << 10)
68#define SMBCR_BURSTLENREAD_CONTINUOUS (3 << 10)
69
70#define SMBCR_MW_MASK (3 << 4)
71#define SMBCR_MW_8BIT (0 << 4)
72#define SMBCR_MW_16BIT (1 << 4)
73#define SMBCR_MW_M32BIT (2 << 4)
74
75/* SSMC status registers */
76#define SSMCCSR (0x200)
77#define SSMCCR (0x204)
78#define SSMCITCR (0x208)
79#define SSMCITIP (0x20C)
80#define SSMCITIOP (0x210)
diff --git a/include/linux/anon_inodes.h b/include/linux/anon_inodes.h
index e0a0cdc2da43..69a21e0ebd33 100644
--- a/include/linux/anon_inodes.h
+++ b/include/linux/anon_inodes.h
@@ -8,6 +8,9 @@
8#ifndef _LINUX_ANON_INODES_H 8#ifndef _LINUX_ANON_INODES_H
9#define _LINUX_ANON_INODES_H 9#define _LINUX_ANON_INODES_H
10 10
11struct file *anon_inode_getfile(const char *name,
12 const struct file_operations *fops,
13 void *priv, int flags);
11int anon_inode_getfd(const char *name, const struct file_operations *fops, 14int anon_inode_getfd(const char *name, const struct file_operations *fops,
12 void *priv, int flags); 15 void *priv, int flags);
13 16
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index cd4bcb6989ce..7d650a0e3d8f 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -337,7 +337,8 @@ struct net_device *alloc_arcdev(const char *name);
337 337
338int arcnet_open(struct net_device *dev); 338int arcnet_open(struct net_device *dev);
339int arcnet_close(struct net_device *dev); 339int arcnet_close(struct net_device *dev);
340int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev); 340netdev_tx_t arcnet_send_packet(struct sk_buff *skb,
341 struct net_device *dev);
341void arcnet_timeout(struct net_device *dev); 342void arcnet_timeout(struct net_device *dev);
342 343
343#endif /* __KERNEL__ */ 344#endif /* __KERNEL__ */
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index 5fc2ef8d97fa..a1c486a88e88 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -58,25 +58,60 @@ struct dma_chan_ref {
58 * array. 58 * array.
59 * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a 59 * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a
60 * dependency chain 60 * dependency chain
61 * @ASYNC_TX_DEP_ACK: ack the dependency descriptor. Useful for chaining. 61 * @ASYNC_TX_FENCE: specify that the next operation in the dependency
62 * chain uses this operation's result as an input
62 */ 63 */
63enum async_tx_flags { 64enum async_tx_flags {
64 ASYNC_TX_XOR_ZERO_DST = (1 << 0), 65 ASYNC_TX_XOR_ZERO_DST = (1 << 0),
65 ASYNC_TX_XOR_DROP_DST = (1 << 1), 66 ASYNC_TX_XOR_DROP_DST = (1 << 1),
66 ASYNC_TX_ACK = (1 << 3), 67 ASYNC_TX_ACK = (1 << 2),
67 ASYNC_TX_DEP_ACK = (1 << 4), 68 ASYNC_TX_FENCE = (1 << 3),
69};
70
71/**
72 * struct async_submit_ctl - async_tx submission/completion modifiers
73 * @flags: submission modifiers
74 * @depend_tx: parent dependency of the current operation being submitted
75 * @cb_fn: callback routine to run at operation completion
76 * @cb_param: parameter for the callback routine
77 * @scribble: caller provided space for dma/page address conversions
78 */
79struct async_submit_ctl {
80 enum async_tx_flags flags;
81 struct dma_async_tx_descriptor *depend_tx;
82 dma_async_tx_callback cb_fn;
83 void *cb_param;
84 void *scribble;
68}; 85};
69 86
70#ifdef CONFIG_DMA_ENGINE 87#ifdef CONFIG_DMA_ENGINE
71#define async_tx_issue_pending_all dma_issue_pending_all 88#define async_tx_issue_pending_all dma_issue_pending_all
89
90/**
91 * async_tx_issue_pending - send pending descriptor to the hardware channel
92 * @tx: descriptor handle to retrieve hardware context
93 *
94 * Note: any dependent operations will have already been issued by
95 * async_tx_channel_switch, or (in the case of no channel switch) will
96 * be already pending on this channel.
97 */
98static inline void async_tx_issue_pending(struct dma_async_tx_descriptor *tx)
99{
100 if (likely(tx)) {
101 struct dma_chan *chan = tx->chan;
102 struct dma_device *dma = chan->device;
103
104 dma->device_issue_pending(chan);
105 }
106}
72#ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL 107#ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL
73#include <asm/async_tx.h> 108#include <asm/async_tx.h>
74#else 109#else
75#define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, len) \ 110#define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, len) \
76 __async_tx_find_channel(dep, type) 111 __async_tx_find_channel(dep, type)
77struct dma_chan * 112struct dma_chan *
78__async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, 113__async_tx_find_channel(struct async_submit_ctl *submit,
79 enum dma_transaction_type tx_type); 114 enum dma_transaction_type tx_type);
80#endif /* CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL */ 115#endif /* CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL */
81#else 116#else
82static inline void async_tx_issue_pending_all(void) 117static inline void async_tx_issue_pending_all(void)
@@ -84,10 +119,16 @@ static inline void async_tx_issue_pending_all(void)
84 do { } while (0); 119 do { } while (0);
85} 120}
86 121
122static inline void async_tx_issue_pending(struct dma_async_tx_descriptor *tx)
123{
124 do { } while (0);
125}
126
87static inline struct dma_chan * 127static inline struct dma_chan *
88async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, 128async_tx_find_channel(struct async_submit_ctl *submit,
89 enum dma_transaction_type tx_type, struct page **dst, int dst_count, 129 enum dma_transaction_type tx_type, struct page **dst,
90 struct page **src, int src_count, size_t len) 130 int dst_count, struct page **src, int src_count,
131 size_t len)
91{ 132{
92 return NULL; 133 return NULL;
93} 134}
@@ -99,46 +140,70 @@ async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx,
99 * @cb_fn_param: parameter to pass to the callback routine 140 * @cb_fn_param: parameter to pass to the callback routine
100 */ 141 */
101static inline void 142static inline void
102async_tx_sync_epilog(dma_async_tx_callback cb_fn, void *cb_fn_param) 143async_tx_sync_epilog(struct async_submit_ctl *submit)
103{ 144{
104 if (cb_fn) 145 if (submit->cb_fn)
105 cb_fn(cb_fn_param); 146 submit->cb_fn(submit->cb_param);
106} 147}
107 148
108void 149typedef union {
109async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx, 150 unsigned long addr;
110 enum async_tx_flags flags, struct dma_async_tx_descriptor *depend_tx, 151 struct page *page;
111 dma_async_tx_callback cb_fn, void *cb_fn_param); 152 dma_addr_t dma;
153} addr_conv_t;
154
155static inline void
156init_async_submit(struct async_submit_ctl *args, enum async_tx_flags flags,
157 struct dma_async_tx_descriptor *tx,
158 dma_async_tx_callback cb_fn, void *cb_param,
159 addr_conv_t *scribble)
160{
161 args->flags = flags;
162 args->depend_tx = tx;
163 args->cb_fn = cb_fn;
164 args->cb_param = cb_param;
165 args->scribble = scribble;
166}
167
168void async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx,
169 struct async_submit_ctl *submit);
112 170
113struct dma_async_tx_descriptor * 171struct dma_async_tx_descriptor *
114async_xor(struct page *dest, struct page **src_list, unsigned int offset, 172async_xor(struct page *dest, struct page **src_list, unsigned int offset,
115 int src_cnt, size_t len, enum async_tx_flags flags, 173 int src_cnt, size_t len, struct async_submit_ctl *submit);
116 struct dma_async_tx_descriptor *depend_tx,
117 dma_async_tx_callback cb_fn, void *cb_fn_param);
118 174
119struct dma_async_tx_descriptor * 175struct dma_async_tx_descriptor *
120async_xor_zero_sum(struct page *dest, struct page **src_list, 176async_xor_val(struct page *dest, struct page **src_list, unsigned int offset,
121 unsigned int offset, int src_cnt, size_t len, 177 int src_cnt, size_t len, enum sum_check_flags *result,
122 u32 *result, enum async_tx_flags flags, 178 struct async_submit_ctl *submit);
123 struct dma_async_tx_descriptor *depend_tx,
124 dma_async_tx_callback cb_fn, void *cb_fn_param);
125 179
126struct dma_async_tx_descriptor * 180struct dma_async_tx_descriptor *
127async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset, 181async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset,
128 unsigned int src_offset, size_t len, enum async_tx_flags flags, 182 unsigned int src_offset, size_t len,
129 struct dma_async_tx_descriptor *depend_tx, 183 struct async_submit_ctl *submit);
130 dma_async_tx_callback cb_fn, void *cb_fn_param);
131 184
132struct dma_async_tx_descriptor * 185struct dma_async_tx_descriptor *
133async_memset(struct page *dest, int val, unsigned int offset, 186async_memset(struct page *dest, int val, unsigned int offset,
134 size_t len, enum async_tx_flags flags, 187 size_t len, struct async_submit_ctl *submit);
135 struct dma_async_tx_descriptor *depend_tx, 188
136 dma_async_tx_callback cb_fn, void *cb_fn_param); 189struct dma_async_tx_descriptor *async_trigger_callback(struct async_submit_ctl *submit);
190
191struct dma_async_tx_descriptor *
192async_gen_syndrome(struct page **blocks, unsigned int offset, int src_cnt,
193 size_t len, struct async_submit_ctl *submit);
194
195struct dma_async_tx_descriptor *
196async_syndrome_val(struct page **blocks, unsigned int offset, int src_cnt,
197 size_t len, enum sum_check_flags *pqres, struct page *spare,
198 struct async_submit_ctl *submit);
199
200struct dma_async_tx_descriptor *
201async_raid6_2data_recov(int src_num, size_t bytes, int faila, int failb,
202 struct page **ptrs, struct async_submit_ctl *submit);
137 203
138struct dma_async_tx_descriptor * 204struct dma_async_tx_descriptor *
139async_trigger_callback(enum async_tx_flags flags, 205async_raid6_datap_recov(int src_num, size_t bytes, int faila,
140 struct dma_async_tx_descriptor *depend_tx, 206 struct page **ptrs, struct async_submit_ctl *submit);
141 dma_async_tx_callback cb_fn, void *cb_fn_param);
142 207
143void async_tx_quiesce(struct dma_async_tx_descriptor **tx); 208void async_tx_quiesce(struct dma_async_tx_descriptor **tx);
144#endif /* _ASYNC_TX_H_ */ 209#endif /* _ASYNC_TX_H_ */
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 9c75921f0c16..4fb357312b3b 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -210,15 +210,25 @@ enum {
210 ATA_CMD_STANDBY = 0xE2, /* place in standby power mode */ 210 ATA_CMD_STANDBY = 0xE2, /* place in standby power mode */
211 ATA_CMD_IDLE = 0xE3, /* place in idle power mode */ 211 ATA_CMD_IDLE = 0xE3, /* place in idle power mode */
212 ATA_CMD_EDD = 0x90, /* execute device diagnostic */ 212 ATA_CMD_EDD = 0x90, /* execute device diagnostic */
213 ATA_CMD_DOWNLOAD_MICRO = 0x92,
214 ATA_CMD_NOP = 0x00,
213 ATA_CMD_FLUSH = 0xE7, 215 ATA_CMD_FLUSH = 0xE7,
214 ATA_CMD_FLUSH_EXT = 0xEA, 216 ATA_CMD_FLUSH_EXT = 0xEA,
215 ATA_CMD_ID_ATA = 0xEC, 217 ATA_CMD_ID_ATA = 0xEC,
216 ATA_CMD_ID_ATAPI = 0xA1, 218 ATA_CMD_ID_ATAPI = 0xA1,
219 ATA_CMD_SERVICE = 0xA2,
217 ATA_CMD_READ = 0xC8, 220 ATA_CMD_READ = 0xC8,
218 ATA_CMD_READ_EXT = 0x25, 221 ATA_CMD_READ_EXT = 0x25,
222 ATA_CMD_READ_QUEUED = 0x26,
223 ATA_CMD_READ_STREAM_EXT = 0x2B,
224 ATA_CMD_READ_STREAM_DMA_EXT = 0x2A,
219 ATA_CMD_WRITE = 0xCA, 225 ATA_CMD_WRITE = 0xCA,
220 ATA_CMD_WRITE_EXT = 0x35, 226 ATA_CMD_WRITE_EXT = 0x35,
227 ATA_CMD_WRITE_QUEUED = 0x36,
228 ATA_CMD_WRITE_STREAM_EXT = 0x3B,
229 ATA_CMD_WRITE_STREAM_DMA_EXT = 0x3A,
221 ATA_CMD_WRITE_FUA_EXT = 0x3D, 230 ATA_CMD_WRITE_FUA_EXT = 0x3D,
231 ATA_CMD_WRITE_QUEUED_FUA_EXT = 0x3E,
222 ATA_CMD_FPDMA_READ = 0x60, 232 ATA_CMD_FPDMA_READ = 0x60,
223 ATA_CMD_FPDMA_WRITE = 0x61, 233 ATA_CMD_FPDMA_WRITE = 0x61,
224 ATA_CMD_PIO_READ = 0x20, 234 ATA_CMD_PIO_READ = 0x20,
@@ -235,6 +245,7 @@ enum {
235 ATA_CMD_PACKET = 0xA0, 245 ATA_CMD_PACKET = 0xA0,
236 ATA_CMD_VERIFY = 0x40, 246 ATA_CMD_VERIFY = 0x40,
237 ATA_CMD_VERIFY_EXT = 0x42, 247 ATA_CMD_VERIFY_EXT = 0x42,
248 ATA_CMD_WRITE_UNCORR_EXT = 0x45,
238 ATA_CMD_STANDBYNOW1 = 0xE0, 249 ATA_CMD_STANDBYNOW1 = 0xE0,
239 ATA_CMD_IDLEIMMEDIATE = 0xE1, 250 ATA_CMD_IDLEIMMEDIATE = 0xE1,
240 ATA_CMD_SLEEP = 0xE6, 251 ATA_CMD_SLEEP = 0xE6,
@@ -243,15 +254,34 @@ enum {
243 ATA_CMD_READ_NATIVE_MAX_EXT = 0x27, 254 ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
244 ATA_CMD_SET_MAX = 0xF9, 255 ATA_CMD_SET_MAX = 0xF9,
245 ATA_CMD_SET_MAX_EXT = 0x37, 256 ATA_CMD_SET_MAX_EXT = 0x37,
246 ATA_CMD_READ_LOG_EXT = 0x2f, 257 ATA_CMD_READ_LOG_EXT = 0x2F,
258 ATA_CMD_WRITE_LOG_EXT = 0x3F,
259 ATA_CMD_READ_LOG_DMA_EXT = 0x47,
260 ATA_CMD_WRITE_LOG_DMA_EXT = 0x57,
261 ATA_CMD_TRUSTED_RCV = 0x5C,
262 ATA_CMD_TRUSTED_RCV_DMA = 0x5D,
263 ATA_CMD_TRUSTED_SND = 0x5E,
264 ATA_CMD_TRUSTED_SND_DMA = 0x5F,
247 ATA_CMD_PMP_READ = 0xE4, 265 ATA_CMD_PMP_READ = 0xE4,
248 ATA_CMD_PMP_WRITE = 0xE8, 266 ATA_CMD_PMP_WRITE = 0xE8,
249 ATA_CMD_CONF_OVERLAY = 0xB1, 267 ATA_CMD_CONF_OVERLAY = 0xB1,
268 ATA_CMD_SEC_SET_PASS = 0xF1,
269 ATA_CMD_SEC_UNLOCK = 0xF2,
270 ATA_CMD_SEC_ERASE_PREP = 0xF3,
271 ATA_CMD_SEC_ERASE_UNIT = 0xF4,
250 ATA_CMD_SEC_FREEZE_LOCK = 0xF5, 272 ATA_CMD_SEC_FREEZE_LOCK = 0xF5,
273 ATA_CMD_SEC_DISABLE_PASS = 0xF6,
274 ATA_CMD_CONFIG_STREAM = 0x51,
251 ATA_CMD_SMART = 0xB0, 275 ATA_CMD_SMART = 0xB0,
252 ATA_CMD_MEDIA_LOCK = 0xDE, 276 ATA_CMD_MEDIA_LOCK = 0xDE,
253 ATA_CMD_MEDIA_UNLOCK = 0xDF, 277 ATA_CMD_MEDIA_UNLOCK = 0xDF,
254 ATA_CMD_DSM = 0x06, 278 ATA_CMD_DSM = 0x06,
279 ATA_CMD_CHK_MED_CRD_TYP = 0xD1,
280 ATA_CMD_CFA_REQ_EXT_ERR = 0x03,
281 ATA_CMD_CFA_WRITE_NE = 0x38,
282 ATA_CMD_CFA_TRANS_SECT = 0x87,
283 ATA_CMD_CFA_ERASE = 0xC0,
284 ATA_CMD_CFA_WRITE_MULT_NE = 0xCD,
255 /* marked obsolete in the ATA/ATAPI-7 spec */ 285 /* marked obsolete in the ATA/ATAPI-7 spec */
256 ATA_CMD_RESTORE = 0x10, 286 ATA_CMD_RESTORE = 0x10,
257 287
@@ -304,8 +334,12 @@ enum {
304 SETFEATURES_SATA_DISABLE = 0x90, /* Disable use of SATA feature */ 334 SETFEATURES_SATA_DISABLE = 0x90, /* Disable use of SATA feature */
305 335
306 /* SETFEATURE Sector counts for SATA features */ 336 /* SETFEATURE Sector counts for SATA features */
307 SATA_AN = 0x05, /* Asynchronous Notification */ 337 SATA_FPDMA_OFFSET = 0x01, /* FPDMA non-zero buffer offsets */
308 SATA_DIPM = 0x03, /* Device Initiated Power Management */ 338 SATA_FPDMA_AA = 0x02, /* FPDMA Setup FIS Auto-Activate */
339 SATA_DIPM = 0x03, /* Device Initiated Power Management */
340 SATA_FPDMA_IN_ORDER = 0x04, /* FPDMA in-order data delivery */
341 SATA_AN = 0x05, /* Asynchronous Notification */
342 SATA_SSP = 0x06, /* Software Settings Preservation */
309 343
310 /* feature values for SET_MAX */ 344 /* feature values for SET_MAX */
311 ATA_SET_MAX_ADDR = 0x00, 345 ATA_SET_MAX_ADDR = 0x00,
@@ -525,6 +559,9 @@ static inline int ata_is_data(u8 prot)
525#define ata_id_has_atapi_AN(id) \ 559#define ata_id_has_atapi_AN(id) \
526 ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \ 560 ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \
527 ((id)[78] & (1 << 5)) ) 561 ((id)[78] & (1 << 5)) )
562#define ata_id_has_fpdma_aa(id) \
563 ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \
564 ((id)[78] & (1 << 2)) )
528#define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10)) 565#define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10))
529#define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11)) 566#define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11))
530#define ata_id_u32(id,n) \ 567#define ata_id_u32(id,n) \
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 086e5c362d3a..817b23705c91 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -397,7 +397,7 @@ struct atmdev_ops { /* only send is required */
397 int (*getsockopt)(struct atm_vcc *vcc,int level,int optname, 397 int (*getsockopt)(struct atm_vcc *vcc,int level,int optname,
398 void __user *optval,int optlen); 398 void __user *optval,int optlen);
399 int (*setsockopt)(struct atm_vcc *vcc,int level,int optname, 399 int (*setsockopt)(struct atm_vcc *vcc,int level,int optname,
400 void __user *optval,int optlen); 400 void __user *optval,unsigned int optlen);
401 int (*send)(struct atm_vcc *vcc,struct sk_buff *skb); 401 int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
402 int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags); 402 int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags);
403 void (*phy_put)(struct atm_dev *dev,unsigned char value, 403 void (*phy_put)(struct atm_dev *dev,unsigned char value,
diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h
index 794ad74b1d61..c3ab81428c66 100644
--- a/include/linux/attribute_container.h
+++ b/include/linux/attribute_container.h
@@ -17,7 +17,7 @@ struct attribute_container {
17 struct list_head node; 17 struct list_head node;
18 struct klist containers; 18 struct klist containers;
19 struct class *class; 19 struct class *class;
20 struct attribute_group *grp; 20 const struct attribute_group *grp;
21 struct device_attribute **attrs; 21 struct device_attribute **attrs;
22 int (*match)(struct attribute_container *, struct device *); 22 int (*match)(struct attribute_container *, struct device *);
23#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01 23#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 1d52425a6118..b449e738533a 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -13,6 +13,8 @@
13#include <linux/proportions.h> 13#include <linux/proportions.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/fs.h> 15#include <linux/fs.h>
16#include <linux/sched.h>
17#include <linux/writeback.h>
16#include <asm/atomic.h> 18#include <asm/atomic.h>
17 19
18struct page; 20struct page;
@@ -23,9 +25,11 @@ struct dentry;
23 * Bits in backing_dev_info.state 25 * Bits in backing_dev_info.state
24 */ 26 */
25enum bdi_state { 27enum bdi_state {
26 BDI_pdflush, /* A pdflush thread is working this device */ 28 BDI_pending, /* On its way to being activated */
29 BDI_wb_alloc, /* Default embedded wb allocated */
27 BDI_async_congested, /* The async (write) queue is getting full */ 30 BDI_async_congested, /* The async (write) queue is getting full */
28 BDI_sync_congested, /* The sync queue is getting full */ 31 BDI_sync_congested, /* The sync queue is getting full */
32 BDI_registered, /* bdi_register() was done */
29 BDI_unused, /* Available bits start here */ 33 BDI_unused, /* Available bits start here */
30}; 34};
31 35
@@ -39,7 +43,23 @@ enum bdi_stat_item {
39 43
40#define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids))) 44#define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids)))
41 45
46struct bdi_writeback {
47 struct list_head list; /* hangs off the bdi */
48
49 struct backing_dev_info *bdi; /* our parent bdi */
50 unsigned int nr;
51
52 unsigned long last_old_flush; /* last old data flush */
53
54 struct task_struct *task; /* writeback task */
55 struct list_head b_dirty; /* dirty inodes */
56 struct list_head b_io; /* parked for writeback */
57 struct list_head b_more_io; /* parked for more writeback */
58};
59
42struct backing_dev_info { 60struct backing_dev_info {
61 struct list_head bdi_list;
62 struct rcu_head rcu_head;
43 unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */ 63 unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */
44 unsigned long state; /* Always use atomic bitops on this */ 64 unsigned long state; /* Always use atomic bitops on this */
45 unsigned int capabilities; /* Device capabilities */ 65 unsigned int capabilities; /* Device capabilities */
@@ -48,6 +68,8 @@ struct backing_dev_info {
48 void (*unplug_io_fn)(struct backing_dev_info *, struct page *); 68 void (*unplug_io_fn)(struct backing_dev_info *, struct page *);
49 void *unplug_io_data; 69 void *unplug_io_data;
50 70
71 char *name;
72
51 struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS]; 73 struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS];
52 74
53 struct prop_local_percpu completions; 75 struct prop_local_percpu completions;
@@ -56,6 +78,14 @@ struct backing_dev_info {
56 unsigned int min_ratio; 78 unsigned int min_ratio;
57 unsigned int max_ratio, max_prop_frac; 79 unsigned int max_ratio, max_prop_frac;
58 80
81 struct bdi_writeback wb; /* default writeback info for this bdi */
82 spinlock_t wb_lock; /* protects update side of wb_list */
83 struct list_head wb_list; /* the flusher threads hanging off this bdi */
84 unsigned long wb_mask; /* bitmask of registered tasks */
85 unsigned int wb_cnt; /* number of registered tasks */
86
87 struct list_head work_list;
88
59 struct device *dev; 89 struct device *dev;
60 90
61#ifdef CONFIG_DEBUG_FS 91#ifdef CONFIG_DEBUG_FS
@@ -71,6 +101,20 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent,
71 const char *fmt, ...); 101 const char *fmt, ...);
72int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); 102int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev);
73void bdi_unregister(struct backing_dev_info *bdi); 103void bdi_unregister(struct backing_dev_info *bdi);
104void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb,
105 long nr_pages);
106int bdi_writeback_task(struct bdi_writeback *wb);
107int bdi_has_dirty_io(struct backing_dev_info *bdi);
108
109extern spinlock_t bdi_lock;
110extern struct list_head bdi_list;
111
112static inline int wb_has_dirty_io(struct bdi_writeback *wb)
113{
114 return !list_empty(&wb->b_dirty) ||
115 !list_empty(&wb->b_io) ||
116 !list_empty(&wb->b_more_io);
117}
74 118
75static inline void __add_bdi_stat(struct backing_dev_info *bdi, 119static inline void __add_bdi_stat(struct backing_dev_info *bdi,
76 enum bdi_stat_item item, s64 amount) 120 enum bdi_stat_item item, s64 amount)
@@ -261,6 +305,11 @@ static inline bool bdi_cap_swap_backed(struct backing_dev_info *bdi)
261 return bdi->capabilities & BDI_CAP_SWAP_BACKED; 305 return bdi->capabilities & BDI_CAP_SWAP_BACKED;
262} 306}
263 307
308static inline bool bdi_cap_flush_forker(struct backing_dev_info *bdi)
309{
310 return bdi == &default_backing_dev_info;
311}
312
264static inline bool mapping_cap_writeback_dirty(struct address_space *mapping) 313static inline bool mapping_cap_writeback_dirty(struct address_space *mapping)
265{ 314{
266 return bdi_cap_writeback_dirty(mapping->backing_dev_info); 315 return bdi_cap_writeback_dirty(mapping->backing_dev_info);
@@ -276,4 +325,10 @@ static inline bool mapping_cap_swap_backed(struct address_space *mapping)
276 return bdi_cap_swap_backed(mapping->backing_dev_info); 325 return bdi_cap_swap_backed(mapping->backing_dev_info);
277} 326}
278 327
328static inline int bdi_sched_wait(void *word)
329{
330 schedule();
331 return 0;
332}
333
279#endif /* _LINUX_BACKING_DEV_H */ 334#endif /* _LINUX_BACKING_DEV_H */
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 79ca2da81c87..0f5f57858a23 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -27,6 +27,11 @@
27 * Any other use of the locks below is probably wrong. 27 * Any other use of the locks below is probably wrong.
28 */ 28 */
29 29
30enum backlight_update_reason {
31 BACKLIGHT_UPDATE_HOTKEY,
32 BACKLIGHT_UPDATE_SYSFS,
33};
34
30struct backlight_device; 35struct backlight_device;
31struct fb_info; 36struct fb_info;
32 37
@@ -100,6 +105,8 @@ static inline void backlight_update_status(struct backlight_device *bd)
100extern struct backlight_device *backlight_device_register(const char *name, 105extern struct backlight_device *backlight_device_register(const char *name,
101 struct device *dev, void *devdata, struct backlight_ops *ops); 106 struct device *dev, void *devdata, struct backlight_ops *ops);
102extern void backlight_device_unregister(struct backlight_device *bd); 107extern void backlight_device_unregister(struct backlight_device *bd);
108extern void backlight_force_update(struct backlight_device *bd,
109 enum backlight_update_reason reason);
103 110
104#define to_backlight_device(obj) container_of(obj, struct backlight_device, dev) 111#define to_backlight_device(obj) container_of(obj, struct backlight_device, dev)
105 112
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 2046b5b8af48..aece486ac734 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -120,7 +120,7 @@ extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
120extern int prepare_bprm_creds(struct linux_binprm *bprm); 120extern int prepare_bprm_creds(struct linux_binprm *bprm);
121extern void install_exec_creds(struct linux_binprm *bprm); 121extern void install_exec_creds(struct linux_binprm *bprm);
122extern void do_coredump(long signr, int exit_code, struct pt_regs *regs); 122extern void do_coredump(long signr, int exit_code, struct pt_regs *regs);
123extern int set_binfmt(struct linux_binfmt *new); 123extern void set_binfmt(struct linux_binfmt *new);
124extern void free_bprm(struct linux_binprm *); 124extern void free_bprm(struct linux_binprm *);
125 125
126#endif /* __KERNEL__ */ 126#endif /* __KERNEL__ */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 2892b710771c..5be93f18d842 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -142,56 +142,51 @@ struct bio {
142 * 142 *
143 * bit 0 -- data direction 143 * bit 0 -- data direction
144 * If not set, bio is a read from device. If set, it's a write to device. 144 * If not set, bio is a read from device. If set, it's a write to device.
145 * bit 1 -- rw-ahead when set 145 * bit 1 -- fail fast device errors
146 * bit 2 -- barrier 146 * bit 2 -- fail fast transport errors
147 * bit 3 -- fail fast driver errors
148 * bit 4 -- rw-ahead when set
149 * bit 5 -- barrier
147 * Insert a serialization point in the IO queue, forcing previously 150 * Insert a serialization point in the IO queue, forcing previously
148 * submitted IO to be completed before this one is issued. 151 * submitted IO to be completed before this one is issued.
149 * bit 3 -- synchronous I/O hint. 152 * bit 6 -- synchronous I/O hint.
150 * bit 4 -- Unplug the device immediately after submitting this bio. 153 * bit 7 -- Unplug the device immediately after submitting this bio.
151 * bit 5 -- metadata request 154 * bit 8 -- metadata request
152 * Used for tracing to differentiate metadata and data IO. May also 155 * Used for tracing to differentiate metadata and data IO. May also
153 * get some preferential treatment in the IO scheduler 156 * get some preferential treatment in the IO scheduler
154 * bit 6 -- discard sectors 157 * bit 9 -- discard sectors
155 * Informs the lower level device that this range of sectors is no longer 158 * Informs the lower level device that this range of sectors is no longer
156 * used by the file system and may thus be freed by the device. Used 159 * used by the file system and may thus be freed by the device. Used
157 * for flash based storage. 160 * for flash based storage.
158 * bit 7 -- fail fast device errors
159 * bit 8 -- fail fast transport errors
160 * bit 9 -- fail fast driver errors
161 * Don't want driver retries for any fast fail whatever the reason. 161 * Don't want driver retries for any fast fail whatever the reason.
162 * bit 10 -- Tell the IO scheduler not to wait for more requests after this 162 * bit 10 -- Tell the IO scheduler not to wait for more requests after this
163 one has been submitted, even if it is a SYNC request. 163 one has been submitted, even if it is a SYNC request.
164 */ 164 */
165#define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */ 165enum bio_rw_flags {
166#define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */ 166 BIO_RW,
167#define BIO_RW_BARRIER 2 167 BIO_RW_FAILFAST_DEV,
168#define BIO_RW_SYNCIO 3 168 BIO_RW_FAILFAST_TRANSPORT,
169#define BIO_RW_UNPLUG 4 169 BIO_RW_FAILFAST_DRIVER,
170#define BIO_RW_META 5 170 /* above flags must match REQ_* */
171#define BIO_RW_DISCARD 6 171 BIO_RW_AHEAD,
172#define BIO_RW_FAILFAST_DEV 7 172 BIO_RW_BARRIER,
173#define BIO_RW_FAILFAST_TRANSPORT 8 173 BIO_RW_SYNCIO,
174#define BIO_RW_FAILFAST_DRIVER 9 174 BIO_RW_UNPLUG,
175#define BIO_RW_NOIDLE 10 175 BIO_RW_META,
176 176 BIO_RW_DISCARD,
177#define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag))) 177 BIO_RW_NOIDLE,
178};
178 179
179/* 180/*
180 * Old defines, these should eventually be replaced by direct usage of 181 * First four bits must match between bio->bi_rw and rq->cmd_flags, make
181 * bio_rw_flagged() 182 * that explicit here.
182 */ 183 */
183#define bio_barrier(bio) bio_rw_flagged(bio, BIO_RW_BARRIER) 184#define BIO_RW_RQ_MASK 0xf
184#define bio_sync(bio) bio_rw_flagged(bio, BIO_RW_SYNCIO) 185
185#define bio_unplug(bio) bio_rw_flagged(bio, BIO_RW_UNPLUG) 186static inline bool bio_rw_flagged(struct bio *bio, enum bio_rw_flags flag)
186#define bio_failfast_dev(bio) bio_rw_flagged(bio, BIO_RW_FAILFAST_DEV) 187{
187#define bio_failfast_transport(bio) \ 188 return (bio->bi_rw & (1 << flag)) != 0;
188 bio_rw_flagged(bio, BIO_RW_FAILFAST_TRANSPORT) 189}
189#define bio_failfast_driver(bio) \
190 bio_rw_flagged(bio, BIO_RW_FAILFAST_DRIVER)
191#define bio_rw_ahead(bio) bio_rw_flagged(bio, BIO_RW_AHEAD)
192#define bio_rw_meta(bio) bio_rw_flagged(bio, BIO_RW_META)
193#define bio_discard(bio) bio_rw_flagged(bio, BIO_RW_DISCARD)
194#define bio_noidle(bio) bio_rw_flagged(bio, BIO_RW_NOIDLE)
195 190
196/* 191/*
197 * upper 16 bits of bi_rw define the io priority of this bio 192 * upper 16 bits of bi_rw define the io priority of this bio
@@ -216,7 +211,7 @@ struct bio {
216#define bio_offset(bio) bio_iovec((bio))->bv_offset 211#define bio_offset(bio) bio_iovec((bio))->bv_offset
217#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) 212#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
218#define bio_sectors(bio) ((bio)->bi_size >> 9) 213#define bio_sectors(bio) ((bio)->bi_size >> 9)
219#define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio)) 214#define bio_empty_barrier(bio) (bio_rw_flagged(bio, BIO_RW_BARRIER) && !bio_has_data(bio) && !bio_rw_flagged(bio, BIO_RW_DISCARD))
220 215
221static inline unsigned int bio_cur_bytes(struct bio *bio) 216static inline unsigned int bio_cur_bytes(struct bio *bio)
222{ 217{
diff --git a/include/linux/blk-iopoll.h b/include/linux/blk-iopoll.h
new file mode 100644
index 000000000000..308734d3d4a2
--- /dev/null
+++ b/include/linux/blk-iopoll.h
@@ -0,0 +1,48 @@
1#ifndef BLK_IOPOLL_H
2#define BLK_IOPOLL_H
3
4struct blk_iopoll;
5typedef int (blk_iopoll_fn)(struct blk_iopoll *, int);
6
7struct blk_iopoll {
8 struct list_head list;
9 unsigned long state;
10 unsigned long data;
11 int weight;
12 int max;
13 blk_iopoll_fn *poll;
14};
15
16enum {
17 IOPOLL_F_SCHED = 0,
18 IOPOLL_F_DISABLE = 1,
19};
20
21/*
22 * Returns 0 if we successfully set the IOPOLL_F_SCHED bit, indicating
23 * that we were the first to acquire this iop for scheduling. If this iop
24 * is currently disabled, return "failure".
25 */
26static inline int blk_iopoll_sched_prep(struct blk_iopoll *iop)
27{
28 if (!test_bit(IOPOLL_F_DISABLE, &iop->state))
29 return test_and_set_bit(IOPOLL_F_SCHED, &iop->state);
30
31 return 1;
32}
33
34static inline int blk_iopoll_disable_pending(struct blk_iopoll *iop)
35{
36 return test_bit(IOPOLL_F_DISABLE, &iop->state);
37}
38
39extern void blk_iopoll_sched(struct blk_iopoll *);
40extern void blk_iopoll_init(struct blk_iopoll *, int, blk_iopoll_fn *);
41extern void blk_iopoll_complete(struct blk_iopoll *);
42extern void __blk_iopoll_complete(struct blk_iopoll *);
43extern void blk_iopoll_enable(struct blk_iopoll *);
44extern void blk_iopoll_disable(struct blk_iopoll *);
45
46extern int blk_iopoll_enabled;
47
48#endif
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 69103e053c92..221cecd86bd3 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -82,17 +82,17 @@ enum rq_cmd_type_bits {
82enum { 82enum {
83 REQ_LB_OP_EJECT = 0x40, /* eject request */ 83 REQ_LB_OP_EJECT = 0x40, /* eject request */
84 REQ_LB_OP_FLUSH = 0x41, /* flush request */ 84 REQ_LB_OP_FLUSH = 0x41, /* flush request */
85 REQ_LB_OP_DISCARD = 0x42, /* discard sectors */
86}; 85};
87 86
88/* 87/*
89 * request type modified bits. first two bits match BIO_RW* bits, important 88 * request type modified bits. first four bits match BIO_RW* bits, important
90 */ 89 */
91enum rq_flag_bits { 90enum rq_flag_bits {
92 __REQ_RW, /* not set, read. set, write */ 91 __REQ_RW, /* not set, read. set, write */
93 __REQ_FAILFAST_DEV, /* no driver retries of device errors */ 92 __REQ_FAILFAST_DEV, /* no driver retries of device errors */
94 __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */ 93 __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */
95 __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */ 94 __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */
95 /* above flags must match BIO_RW_* */
96 __REQ_DISCARD, /* request to discard sectors */ 96 __REQ_DISCARD, /* request to discard sectors */
97 __REQ_SORTED, /* elevator knows about this request */ 97 __REQ_SORTED, /* elevator knows about this request */
98 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ 98 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
@@ -114,6 +114,7 @@ enum rq_flag_bits {
114 __REQ_INTEGRITY, /* integrity metadata has been remapped */ 114 __REQ_INTEGRITY, /* integrity metadata has been remapped */
115 __REQ_NOIDLE, /* Don't anticipate more IO after this one */ 115 __REQ_NOIDLE, /* Don't anticipate more IO after this one */
116 __REQ_IO_STAT, /* account I/O stat */ 116 __REQ_IO_STAT, /* account I/O stat */
117 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
117 __REQ_NR_BITS, /* stops here */ 118 __REQ_NR_BITS, /* stops here */
118}; 119};
119 120
@@ -142,6 +143,10 @@ enum rq_flag_bits {
142#define REQ_INTEGRITY (1 << __REQ_INTEGRITY) 143#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
143#define REQ_NOIDLE (1 << __REQ_NOIDLE) 144#define REQ_NOIDLE (1 << __REQ_NOIDLE)
144#define REQ_IO_STAT (1 << __REQ_IO_STAT) 145#define REQ_IO_STAT (1 << __REQ_IO_STAT)
146#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)
147
148#define REQ_FAILFAST_MASK (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | \
149 REQ_FAILFAST_DRIVER)
145 150
146#define BLK_MAX_CDB 16 151#define BLK_MAX_CDB 16
147 152
@@ -255,7 +260,6 @@ typedef void (request_fn_proc) (struct request_queue *q);
255typedef int (make_request_fn) (struct request_queue *q, struct bio *bio); 260typedef int (make_request_fn) (struct request_queue *q, struct bio *bio);
256typedef int (prep_rq_fn) (struct request_queue *, struct request *); 261typedef int (prep_rq_fn) (struct request_queue *, struct request *);
257typedef void (unplug_fn) (struct request_queue *); 262typedef void (unplug_fn) (struct request_queue *);
258typedef int (prepare_discard_fn) (struct request_queue *, struct request *);
259 263
260struct bio_vec; 264struct bio_vec;
261struct bvec_merge_data { 265struct bvec_merge_data {
@@ -307,6 +311,7 @@ struct queue_limits {
307 unsigned int alignment_offset; 311 unsigned int alignment_offset;
308 unsigned int io_min; 312 unsigned int io_min;
309 unsigned int io_opt; 313 unsigned int io_opt;
314 unsigned int max_discard_sectors;
310 315
311 unsigned short logical_block_size; 316 unsigned short logical_block_size;
312 unsigned short max_hw_segments; 317 unsigned short max_hw_segments;
@@ -334,7 +339,6 @@ struct request_queue
334 make_request_fn *make_request_fn; 339 make_request_fn *make_request_fn;
335 prep_rq_fn *prep_rq_fn; 340 prep_rq_fn *prep_rq_fn;
336 unplug_fn *unplug_fn; 341 unplug_fn *unplug_fn;
337 prepare_discard_fn *prepare_discard_fn;
338 merge_bvec_fn *merge_bvec_fn; 342 merge_bvec_fn *merge_bvec_fn;
339 prepare_flush_fn *prepare_flush_fn; 343 prepare_flush_fn *prepare_flush_fn;
340 softirq_done_fn *softirq_done_fn; 344 softirq_done_fn *softirq_done_fn;
@@ -453,10 +457,13 @@ struct request_queue
453#define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */ 457#define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */
454#define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ 458#define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */
455#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ 459#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */
460#define QUEUE_FLAG_CQ 16 /* hardware does queuing */
461#define QUEUE_FLAG_DISCARD 17 /* supports DISCARD */
456 462
457#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 463#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
458 (1 << QUEUE_FLAG_CLUSTER) | \ 464 (1 << QUEUE_FLAG_CLUSTER) | \
459 (1 << QUEUE_FLAG_STACKABLE)) 465 (1 << QUEUE_FLAG_STACKABLE) | \
466 (1 << QUEUE_FLAG_SAME_COMP))
460 467
461static inline int queue_is_locked(struct request_queue *q) 468static inline int queue_is_locked(struct request_queue *q)
462{ 469{
@@ -575,6 +582,7 @@ enum {
575 582
576#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) 583#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags)
577#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) 584#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
585#define blk_queue_queuing(q) test_bit(QUEUE_FLAG_CQ, &(q)->queue_flags)
578#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) 586#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
579#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) 587#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
580#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) 588#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags)
@@ -582,6 +590,7 @@ enum {
582#define blk_queue_flushing(q) ((q)->ordseq) 590#define blk_queue_flushing(q) ((q)->ordseq)
583#define blk_queue_stackable(q) \ 591#define blk_queue_stackable(q) \
584 test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags) 592 test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags)
593#define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags)
585 594
586#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) 595#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS)
587#define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC) 596#define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC)
@@ -828,11 +837,13 @@ static inline void blk_run_address_space(struct address_space *mapping)
828} 837}
829 838
830/* 839/*
831 * blk_rq_pos() : the current sector 840 * blk_rq_pos() : the current sector
832 * blk_rq_bytes() : bytes left in the entire request 841 * blk_rq_bytes() : bytes left in the entire request
833 * blk_rq_cur_bytes() : bytes left in the current segment 842 * blk_rq_cur_bytes() : bytes left in the current segment
834 * blk_rq_sectors() : sectors left in the entire request 843 * blk_rq_err_bytes() : bytes left till the next error boundary
835 * blk_rq_cur_sectors() : sectors left in the current segment 844 * blk_rq_sectors() : sectors left in the entire request
845 * blk_rq_cur_sectors() : sectors left in the current segment
846 * blk_rq_err_sectors() : sectors left till the next error boundary
836 */ 847 */
837static inline sector_t blk_rq_pos(const struct request *rq) 848static inline sector_t blk_rq_pos(const struct request *rq)
838{ 849{
@@ -849,6 +860,8 @@ static inline int blk_rq_cur_bytes(const struct request *rq)
849 return rq->bio ? bio_cur_bytes(rq->bio) : 0; 860 return rq->bio ? bio_cur_bytes(rq->bio) : 0;
850} 861}
851 862
863extern unsigned int blk_rq_err_bytes(const struct request *rq);
864
852static inline unsigned int blk_rq_sectors(const struct request *rq) 865static inline unsigned int blk_rq_sectors(const struct request *rq)
853{ 866{
854 return blk_rq_bytes(rq) >> 9; 867 return blk_rq_bytes(rq) >> 9;
@@ -859,6 +872,11 @@ static inline unsigned int blk_rq_cur_sectors(const struct request *rq)
859 return blk_rq_cur_bytes(rq) >> 9; 872 return blk_rq_cur_bytes(rq) >> 9;
860} 873}
861 874
875static inline unsigned int blk_rq_err_sectors(const struct request *rq)
876{
877 return blk_rq_err_bytes(rq) >> 9;
878}
879
862/* 880/*
863 * Request issue related functions. 881 * Request issue related functions.
864 */ 882 */
@@ -885,10 +903,12 @@ extern bool blk_end_request(struct request *rq, int error,
885 unsigned int nr_bytes); 903 unsigned int nr_bytes);
886extern void blk_end_request_all(struct request *rq, int error); 904extern void blk_end_request_all(struct request *rq, int error);
887extern bool blk_end_request_cur(struct request *rq, int error); 905extern bool blk_end_request_cur(struct request *rq, int error);
906extern bool blk_end_request_err(struct request *rq, int error);
888extern bool __blk_end_request(struct request *rq, int error, 907extern bool __blk_end_request(struct request *rq, int error,
889 unsigned int nr_bytes); 908 unsigned int nr_bytes);
890extern void __blk_end_request_all(struct request *rq, int error); 909extern void __blk_end_request_all(struct request *rq, int error);
891extern bool __blk_end_request_cur(struct request *rq, int error); 910extern bool __blk_end_request_cur(struct request *rq, int error);
911extern bool __blk_end_request_err(struct request *rq, int error);
892 912
893extern void blk_complete_request(struct request *); 913extern void blk_complete_request(struct request *);
894extern void __blk_complete_request(struct request *); 914extern void __blk_complete_request(struct request *);
@@ -909,12 +929,15 @@ extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int);
909extern void blk_queue_max_phys_segments(struct request_queue *, unsigned short); 929extern void blk_queue_max_phys_segments(struct request_queue *, unsigned short);
910extern void blk_queue_max_hw_segments(struct request_queue *, unsigned short); 930extern void blk_queue_max_hw_segments(struct request_queue *, unsigned short);
911extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); 931extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
932extern void blk_queue_max_discard_sectors(struct request_queue *q,
933 unsigned int max_discard_sectors);
912extern void blk_queue_logical_block_size(struct request_queue *, unsigned short); 934extern void blk_queue_logical_block_size(struct request_queue *, unsigned short);
913extern void blk_queue_physical_block_size(struct request_queue *, unsigned short); 935extern void blk_queue_physical_block_size(struct request_queue *, unsigned short);
914extern void blk_queue_alignment_offset(struct request_queue *q, 936extern void blk_queue_alignment_offset(struct request_queue *q,
915 unsigned int alignment); 937 unsigned int alignment);
916extern void blk_limits_io_min(struct queue_limits *limits, unsigned int min); 938extern void blk_limits_io_min(struct queue_limits *limits, unsigned int min);
917extern void blk_queue_io_min(struct request_queue *q, unsigned int min); 939extern void blk_queue_io_min(struct request_queue *q, unsigned int min);
940extern void blk_limits_io_opt(struct queue_limits *limits, unsigned int opt);
918extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt); 941extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt);
919extern void blk_set_default_limits(struct queue_limits *lim); 942extern void blk_set_default_limits(struct queue_limits *lim);
920extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, 943extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
@@ -934,7 +957,6 @@ extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *);
934extern void blk_queue_dma_alignment(struct request_queue *, int); 957extern void blk_queue_dma_alignment(struct request_queue *, int);
935extern void blk_queue_update_dma_alignment(struct request_queue *, int); 958extern void blk_queue_update_dma_alignment(struct request_queue *, int);
936extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *); 959extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *);
937extern void blk_queue_set_discard(struct request_queue *, prepare_discard_fn *);
938extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *); 960extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *);
939extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); 961extern void blk_queue_rq_timeout(struct request_queue *, unsigned int);
940extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 962extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
@@ -977,15 +999,18 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
977} 999}
978 1000
979extern int blkdev_issue_flush(struct block_device *, sector_t *); 1001extern int blkdev_issue_flush(struct block_device *, sector_t *);
980extern int blkdev_issue_discard(struct block_device *, 1002#define DISCARD_FL_WAIT 0x01 /* wait for completion */
981 sector_t sector, sector_t nr_sects, gfp_t); 1003#define DISCARD_FL_BARRIER 0x02 /* issue DISCARD_BARRIER request */
1004extern int blkdev_issue_discard(struct block_device *, sector_t sector,
1005 sector_t nr_sects, gfp_t, int flags);
982 1006
983static inline int sb_issue_discard(struct super_block *sb, 1007static inline int sb_issue_discard(struct super_block *sb,
984 sector_t block, sector_t nr_blocks) 1008 sector_t block, sector_t nr_blocks)
985{ 1009{
986 block <<= (sb->s_blocksize_bits - 9); 1010 block <<= (sb->s_blocksize_bits - 9);
987 nr_blocks <<= (sb->s_blocksize_bits - 9); 1011 nr_blocks <<= (sb->s_blocksize_bits - 9);
988 return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL); 1012 return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL,
1013 DISCARD_FL_BARRIER);
989} 1014}
990 1015
991extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm); 1016extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm);
@@ -1056,25 +1081,37 @@ static inline unsigned int queue_physical_block_size(struct request_queue *q)
1056 return q->limits.physical_block_size; 1081 return q->limits.physical_block_size;
1057} 1082}
1058 1083
1084static inline int bdev_physical_block_size(struct block_device *bdev)
1085{
1086 return queue_physical_block_size(bdev_get_queue(bdev));
1087}
1088
1059static inline unsigned int queue_io_min(struct request_queue *q) 1089static inline unsigned int queue_io_min(struct request_queue *q)
1060{ 1090{
1061 return q->limits.io_min; 1091 return q->limits.io_min;
1062} 1092}
1063 1093
1094static inline int bdev_io_min(struct block_device *bdev)
1095{
1096 return queue_io_min(bdev_get_queue(bdev));
1097}
1098
1064static inline unsigned int queue_io_opt(struct request_queue *q) 1099static inline unsigned int queue_io_opt(struct request_queue *q)
1065{ 1100{
1066 return q->limits.io_opt; 1101 return q->limits.io_opt;
1067} 1102}
1068 1103
1104static inline int bdev_io_opt(struct block_device *bdev)
1105{
1106 return queue_io_opt(bdev_get_queue(bdev));
1107}
1108
1069static inline int queue_alignment_offset(struct request_queue *q) 1109static inline int queue_alignment_offset(struct request_queue *q)
1070{ 1110{
1071 if (q && q->limits.misaligned) 1111 if (q->limits.misaligned)
1072 return -1; 1112 return -1;
1073 1113
1074 if (q && q->limits.alignment_offset) 1114 return q->limits.alignment_offset;
1075 return q->limits.alignment_offset;
1076
1077 return 0;
1078} 1115}
1079 1116
1080static inline int queue_sector_alignment_offset(struct request_queue *q, 1117static inline int queue_sector_alignment_offset(struct request_queue *q,
@@ -1084,6 +1121,19 @@ static inline int queue_sector_alignment_offset(struct request_queue *q,
1084 & (q->limits.io_min - 1); 1121 & (q->limits.io_min - 1);
1085} 1122}
1086 1123
1124static inline int bdev_alignment_offset(struct block_device *bdev)
1125{
1126 struct request_queue *q = bdev_get_queue(bdev);
1127
1128 if (q->limits.misaligned)
1129 return -1;
1130
1131 if (bdev != bdev->bd_contains)
1132 return bdev->bd_part->alignment_offset;
1133
1134 return q->limits.alignment_offset;
1135}
1136
1087static inline int queue_dma_alignment(struct request_queue *q) 1137static inline int queue_dma_alignment(struct request_queue *q)
1088{ 1138{
1089 return q ? q->dma_alignment : 511; 1139 return q ? q->dma_alignment : 511;
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 7e4350ece0f8..3b73b9992b26 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -198,6 +198,7 @@ extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
198 char __user *arg); 198 char __user *arg);
199extern int blk_trace_startstop(struct request_queue *q, int start); 199extern int blk_trace_startstop(struct request_queue *q, int start);
200extern int blk_trace_remove(struct request_queue *q); 200extern int blk_trace_remove(struct request_queue *q);
201extern void blk_trace_remove_sysfs(struct device *dev);
201extern int blk_trace_init_sysfs(struct device *dev); 202extern int blk_trace_init_sysfs(struct device *dev);
202 203
203extern struct attribute_group blk_trace_attr_group; 204extern struct attribute_group blk_trace_attr_group;
@@ -211,6 +212,7 @@ extern struct attribute_group blk_trace_attr_group;
211# define blk_trace_startstop(q, start) (-ENOTTY) 212# define blk_trace_startstop(q, start) (-ENOTTY)
212# define blk_trace_remove(q) (-ENOTTY) 213# define blk_trace_remove(q) (-ENOTTY)
213# define blk_add_trace_msg(q, fmt, ...) do { } while (0) 214# define blk_add_trace_msg(q, fmt, ...) do { } while (0)
215# define blk_trace_remove_sysfs(dev) do { } while (0)
214static inline int blk_trace_init_sysfs(struct device *dev) 216static inline int blk_trace_init_sysfs(struct device *dev)
215{ 217{
216 return 0; 218 return 0;
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index bc3ab7073695..dd97fb8408a8 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -132,9 +132,6 @@ static inline void *alloc_remap(int nid, unsigned long size)
132} 132}
133#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */ 133#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */
134 134
135extern unsigned long __meminitdata nr_kernel_pages;
136extern unsigned long __meminitdata nr_all_pages;
137
138extern void *alloc_large_system_hash(const char *tablename, 135extern void *alloc_large_system_hash(const char *tablename,
139 unsigned long bucketsize, 136 unsigned long bucketsize,
140 unsigned long numentries, 137 unsigned long numentries,
@@ -145,6 +142,8 @@ extern void *alloc_large_system_hash(const char *tablename,
145 unsigned long limit); 142 unsigned long limit);
146 143
147#define HASH_EARLY 0x00000001 /* Allocating during early boot? */ 144#define HASH_EARLY 0x00000001 /* Allocating during early boot? */
145#define HASH_SMALL 0x00000002 /* sub-page allocation allowed, min
146 * shift passed via *_hash_shift */
148 147
149/* Only NUMA needs hash distribution. 64bit NUMA architectures have 148/* Only NUMA needs hash distribution. 64bit NUMA architectures have
150 * sufficient vmalloc space. 149 * sufficient vmalloc space.
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index 4a37a56f6cdd..5824b20b5fcb 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -66,5 +66,6 @@ void can_bus_off(struct net_device *dev);
66 66
67void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, int idx); 67void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, int idx);
68void can_get_echo_skb(struct net_device *dev, int idx); 68void can_get_echo_skb(struct net_device *dev, int idx);
69void can_free_echo_skb(struct net_device *dev, int idx);
69 70
70#endif /* CAN_DEV_H */ 71#endif /* CAN_DEV_H */
diff --git a/include/linux/capability.h b/include/linux/capability.h
index c3021105edc0..c8f2a5f70ed5 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -7,7 +7,7 @@
7 * 7 *
8 * See here for the libcap library ("POSIX draft" compliance): 8 * See here for the libcap library ("POSIX draft" compliance):
9 * 9 *
10 * ftp://linux.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/ 10 * ftp://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/
11 */ 11 */
12 12
13#ifndef _LINUX_CAPABILITY_H 13#ifndef _LINUX_CAPABILITY_H
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 90bba9e62286..0008dee66514 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -37,7 +37,7 @@ extern void cgroup_exit(struct task_struct *p, int run_callbacks);
37extern int cgroupstats_build(struct cgroupstats *stats, 37extern int cgroupstats_build(struct cgroupstats *stats,
38 struct dentry *dentry); 38 struct dentry *dentry);
39 39
40extern struct file_operations proc_cgroup_operations; 40extern const struct file_operations proc_cgroup_operations;
41 41
42/* Define the enumeration of all cgroup subsystems */ 42/* Define the enumeration of all cgroup subsystems */
43#define SUBSYS(_x) _x ## _subsys_id, 43#define SUBSYS(_x) _x ## _subsys_id,
@@ -141,6 +141,38 @@ enum {
141 CGRP_WAIT_ON_RMDIR, 141 CGRP_WAIT_ON_RMDIR,
142}; 142};
143 143
144/* which pidlist file are we talking about? */
145enum cgroup_filetype {
146 CGROUP_FILE_PROCS,
147 CGROUP_FILE_TASKS,
148};
149
150/*
151 * A pidlist is a list of pids that virtually represents the contents of one
152 * of the cgroup files ("procs" or "tasks"). We keep a list of such pidlists,
153 * a pair (one each for procs, tasks) for each pid namespace that's relevant
154 * to the cgroup.
155 */
156struct cgroup_pidlist {
157 /*
158 * used to find which pidlist is wanted. doesn't change as long as
159 * this particular list stays in the list.
160 */
161 struct { enum cgroup_filetype type; struct pid_namespace *ns; } key;
162 /* array of xids */
163 pid_t *list;
164 /* how many elements the above list has */
165 int length;
166 /* how many files are using the current array */
167 int use_count;
168 /* each of these stored in a list by its cgroup */
169 struct list_head links;
170 /* pointer to the cgroup we belong to, for list removal purposes */
171 struct cgroup *owner;
172 /* protects the other fields */
173 struct rw_semaphore mutex;
174};
175
144struct cgroup { 176struct cgroup {
145 unsigned long flags; /* "unsigned long" so bitops work */ 177 unsigned long flags; /* "unsigned long" so bitops work */
146 178
@@ -179,11 +211,12 @@ struct cgroup {
179 */ 211 */
180 struct list_head release_list; 212 struct list_head release_list;
181 213
182 /* pids_mutex protects pids_list and cached pid arrays. */ 214 /*
183 struct rw_semaphore pids_mutex; 215 * list of pidlists, up to two for each namespace (one for procs, one
184 216 * for tasks); created on demand.
185 /* Linked list of struct cgroup_pids */ 217 */
186 struct list_head pids_list; 218 struct list_head pidlists;
219 struct mutex pidlist_mutex;
187 220
188 /* For RCU-protected deletion */ 221 /* For RCU-protected deletion */
189 struct rcu_head rcu_head; 222 struct rcu_head rcu_head;
@@ -227,6 +260,9 @@ struct css_set {
227 * during subsystem registration (at boot time). 260 * during subsystem registration (at boot time).
228 */ 261 */
229 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 262 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
263
264 /* For RCU-protected deletion */
265 struct rcu_head rcu_head;
230}; 266};
231 267
232/* 268/*
@@ -389,10 +425,11 @@ struct cgroup_subsys {
389 struct cgroup *cgrp); 425 struct cgroup *cgrp);
390 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 426 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
391 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 427 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
392 int (*can_attach)(struct cgroup_subsys *ss, 428 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
393 struct cgroup *cgrp, struct task_struct *tsk); 429 struct task_struct *tsk, bool threadgroup);
394 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 430 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
395 struct cgroup *old_cgrp, struct task_struct *tsk); 431 struct cgroup *old_cgrp, struct task_struct *tsk,
432 bool threadgroup);
396 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); 433 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task);
397 void (*exit)(struct cgroup_subsys *ss, struct task_struct *task); 434 void (*exit)(struct cgroup_subsys *ss, struct task_struct *task);
398 int (*populate)(struct cgroup_subsys *ss, 435 int (*populate)(struct cgroup_subsys *ss,
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 1219be4fb42e..83d2fbd81b93 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -14,6 +14,7 @@
14#include <linux/list.h> 14#include <linux/list.h>
15#include <linux/cache.h> 15#include <linux/cache.h>
16#include <linux/timer.h> 16#include <linux/timer.h>
17#include <linux/init.h>
17#include <asm/div64.h> 18#include <asm/div64.h>
18#include <asm/io.h> 19#include <asm/io.h>
19 20
@@ -148,14 +149,11 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
148 * @disable: optional function to disable the clocksource 149 * @disable: optional function to disable the clocksource
149 * @mask: bitmask for two's complement 150 * @mask: bitmask for two's complement
150 * subtraction of non 64 bit counters 151 * subtraction of non 64 bit counters
151 * @mult: cycle to nanosecond multiplier (adjusted by NTP) 152 * @mult: cycle to nanosecond multiplier
152 * @mult_orig: cycle to nanosecond multiplier (unadjusted by NTP)
153 * @shift: cycle to nanosecond divisor (power of two) 153 * @shift: cycle to nanosecond divisor (power of two)
154 * @flags: flags describing special properties 154 * @flags: flags describing special properties
155 * @vread: vsyscall based read 155 * @vread: vsyscall based read
156 * @resume: resume function for the clocksource, if necessary 156 * @resume: resume function for the clocksource, if necessary
157 * @cycle_interval: Used internally by timekeeping core, please ignore.
158 * @xtime_interval: Used internally by timekeeping core, please ignore.
159 */ 157 */
160struct clocksource { 158struct clocksource {
161 /* 159 /*
@@ -169,7 +167,6 @@ struct clocksource {
169 void (*disable)(struct clocksource *cs); 167 void (*disable)(struct clocksource *cs);
170 cycle_t mask; 168 cycle_t mask;
171 u32 mult; 169 u32 mult;
172 u32 mult_orig;
173 u32 shift; 170 u32 shift;
174 unsigned long flags; 171 unsigned long flags;
175 cycle_t (*vread)(void); 172 cycle_t (*vread)(void);
@@ -181,19 +178,12 @@ struct clocksource {
181#define CLKSRC_FSYS_MMIO_SET(mmio, addr) do { } while (0) 178#define CLKSRC_FSYS_MMIO_SET(mmio, addr) do { } while (0)
182#endif 179#endif
183 180
184 /* timekeeping specific data, ignore */
185 cycle_t cycle_interval;
186 u64 xtime_interval;
187 u32 raw_interval;
188 /* 181 /*
189 * Second part is written at each timer interrupt 182 * Second part is written at each timer interrupt
190 * Keep it in a different cache line to dirty no 183 * Keep it in a different cache line to dirty no
191 * more than one cache line. 184 * more than one cache line.
192 */ 185 */
193 cycle_t cycle_last ____cacheline_aligned_in_smp; 186 cycle_t cycle_last ____cacheline_aligned_in_smp;
194 u64 xtime_nsec;
195 s64 error;
196 struct timespec raw_time;
197 187
198#ifdef CONFIG_CLOCKSOURCE_WATCHDOG 188#ifdef CONFIG_CLOCKSOURCE_WATCHDOG
199 /* Watchdog related data, used by the framework */ 189 /* Watchdog related data, used by the framework */
@@ -202,8 +192,6 @@ struct clocksource {
202#endif 192#endif
203}; 193};
204 194
205extern struct clocksource *clock; /* current clocksource */
206
207/* 195/*
208 * Clock source flags bits:: 196 * Clock source flags bits::
209 */ 197 */
@@ -212,6 +200,7 @@ extern struct clocksource *clock; /* current clocksource */
212 200
213#define CLOCK_SOURCE_WATCHDOG 0x10 201#define CLOCK_SOURCE_WATCHDOG 0x10
214#define CLOCK_SOURCE_VALID_FOR_HRES 0x20 202#define CLOCK_SOURCE_VALID_FOR_HRES 0x20
203#define CLOCK_SOURCE_UNSTABLE 0x40
215 204
216/* simplify initialization of mask field */ 205/* simplify initialization of mask field */
217#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) 206#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
@@ -268,108 +257,15 @@ static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
268} 257}
269 258
270/** 259/**
271 * clocksource_read: - Access the clocksource's current cycle value 260 * clocksource_cyc2ns - converts clocksource cycles to nanoseconds
272 * @cs: pointer to clocksource being read
273 *
274 * Uses the clocksource to return the current cycle_t value
275 */
276static inline cycle_t clocksource_read(struct clocksource *cs)
277{
278 return cs->read(cs);
279}
280
281/**
282 * clocksource_enable: - enable clocksource
283 * @cs: pointer to clocksource
284 *
285 * Enables the specified clocksource. The clocksource callback
286 * function should start up the hardware and setup mult and field
287 * members of struct clocksource to reflect hardware capabilities.
288 */
289static inline int clocksource_enable(struct clocksource *cs)
290{
291 int ret = 0;
292
293 if (cs->enable)
294 ret = cs->enable(cs);
295
296 /*
297 * The frequency may have changed while the clocksource
298 * was disabled. If so the code in ->enable() must update
299 * the mult value to reflect the new frequency. Make sure
300 * mult_orig follows this change.
301 */
302 cs->mult_orig = cs->mult;
303
304 return ret;
305}
306
307/**
308 * clocksource_disable: - disable clocksource
309 * @cs: pointer to clocksource
310 *
311 * Disables the specified clocksource. The clocksource callback
312 * function should power down the now unused hardware block to
313 * save power.
314 */
315static inline void clocksource_disable(struct clocksource *cs)
316{
317 /*
318 * Save mult_orig in mult so clocksource_enable() can
319 * restore the value regardless if ->enable() updates
320 * the value of mult or not.
321 */
322 cs->mult = cs->mult_orig;
323
324 if (cs->disable)
325 cs->disable(cs);
326}
327
328/**
329 * cyc2ns - converts clocksource cycles to nanoseconds
330 * @cs: Pointer to clocksource
331 * @cycles: Cycles
332 * 261 *
333 * Uses the clocksource and ntp ajdustment to convert cycle_ts to nanoseconds. 262 * Converts cycles to nanoseconds, using the given mult and shift.
334 * 263 *
335 * XXX - This could use some mult_lxl_ll() asm optimization 264 * XXX - This could use some mult_lxl_ll() asm optimization
336 */ 265 */
337static inline s64 cyc2ns(struct clocksource *cs, cycle_t cycles) 266static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 mult, u32 shift)
338{
339 u64 ret = (u64)cycles;
340 ret = (ret * cs->mult) >> cs->shift;
341 return ret;
342}
343
344/**
345 * clocksource_calculate_interval - Calculates a clocksource interval struct
346 *
347 * @c: Pointer to clocksource.
348 * @length_nsec: Desired interval length in nanoseconds.
349 *
350 * Calculates a fixed cycle/nsec interval for a given clocksource/adjustment
351 * pair and interval request.
352 *
353 * Unless you're the timekeeping code, you should not be using this!
354 */
355static inline void clocksource_calculate_interval(struct clocksource *c,
356 unsigned long length_nsec)
357{ 267{
358 u64 tmp; 268 return ((u64) cycles * mult) >> shift;
359
360 /* Do the ns -> cycle conversion first, using original mult */
361 tmp = length_nsec;
362 tmp <<= c->shift;
363 tmp += c->mult_orig/2;
364 do_div(tmp, c->mult_orig);
365
366 c->cycle_interval = (cycle_t)tmp;
367 if (c->cycle_interval == 0)
368 c->cycle_interval = 1;
369
370 /* Go back from cycles -> shifted ns, this time use ntp adjused mult */
371 c->xtime_interval = (u64)c->cycle_interval * c->mult;
372 c->raw_interval = ((u64)c->cycle_interval * c->mult_orig) >> c->shift;
373} 269}
374 270
375 271
@@ -380,6 +276,8 @@ extern void clocksource_touch_watchdog(void);
380extern struct clocksource* clocksource_get_next(void); 276extern struct clocksource* clocksource_get_next(void);
381extern void clocksource_change_rating(struct clocksource *cs, int rating); 277extern void clocksource_change_rating(struct clocksource *cs, int rating);
382extern void clocksource_resume(void); 278extern void clocksource_resume(void);
279extern struct clocksource * __init __weak clocksource_default_clock(void);
280extern void clocksource_mark_unstable(struct clocksource *cs);
383 281
384#ifdef CONFIG_GENERIC_TIME_VSYSCALL 282#ifdef CONFIG_GENERIC_TIME_VSYSCALL
385extern void update_vsyscall(struct timespec *ts, struct clocksource *c); 283extern void update_vsyscall(struct timespec *ts, struct clocksource *c);
@@ -394,4 +292,6 @@ static inline void update_vsyscall_tz(void)
394} 292}
395#endif 293#endif
396 294
295extern void timekeeping_notify(struct clocksource *clock);
296
397#endif /* _LINUX_CLOCKSOURCE_H */ 297#endif /* _LINUX_CLOCKSOURCE_H */
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h
index b8125b2eb665..47dac5ea8d3a 100644
--- a/include/linux/cn_proc.h
+++ b/include/linux/cn_proc.h
@@ -52,6 +52,7 @@ struct proc_event {
52 PROC_EVENT_EXEC = 0x00000002, 52 PROC_EVENT_EXEC = 0x00000002,
53 PROC_EVENT_UID = 0x00000004, 53 PROC_EVENT_UID = 0x00000004,
54 PROC_EVENT_GID = 0x00000040, 54 PROC_EVENT_GID = 0x00000040,
55 PROC_EVENT_SID = 0x00000080,
55 /* "next" should be 0x00000400 */ 56 /* "next" should be 0x00000400 */
56 /* "last" is the last process event: exit */ 57 /* "last" is the last process event: exit */
57 PROC_EVENT_EXIT = 0x80000000 58 PROC_EVENT_EXIT = 0x80000000
@@ -89,6 +90,11 @@ struct proc_event {
89 } e; 90 } e;
90 } id; 91 } id;
91 92
93 struct sid_proc_event {
94 __kernel_pid_t process_pid;
95 __kernel_pid_t process_tgid;
96 } sid;
97
92 struct exit_proc_event { 98 struct exit_proc_event {
93 __kernel_pid_t process_pid; 99 __kernel_pid_t process_pid;
94 __kernel_pid_t process_tgid; 100 __kernel_pid_t process_tgid;
@@ -102,6 +108,7 @@ struct proc_event {
102void proc_fork_connector(struct task_struct *task); 108void proc_fork_connector(struct task_struct *task);
103void proc_exec_connector(struct task_struct *task); 109void proc_exec_connector(struct task_struct *task);
104void proc_id_connector(struct task_struct *task, int which_id); 110void proc_id_connector(struct task_struct *task, int which_id);
111void proc_sid_connector(struct task_struct *task);
105void proc_exit_connector(struct task_struct *task); 112void proc_exit_connector(struct task_struct *task);
106#else 113#else
107static inline void proc_fork_connector(struct task_struct *task) 114static inline void proc_fork_connector(struct task_struct *task)
@@ -114,6 +121,9 @@ static inline void proc_id_connector(struct task_struct *task,
114 int which_id) 121 int which_id)
115{} 122{}
116 123
124static inline void proc_sid_connector(struct task_struct *task)
125{}
126
117static inline void proc_exit_connector(struct task_struct *task) 127static inline void proc_exit_connector(struct task_struct *task)
118{} 128{}
119#endif /* CONFIG_PROC_EVENTS */ 129#endif /* CONFIG_PROC_EVENTS */
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 7f627775c947..ddb7a97c78c2 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -27,8 +27,8 @@
27 * 27 *
28 * configfs Copyright (C) 2005 Oracle. All rights reserved. 28 * configfs Copyright (C) 2005 Oracle. All rights reserved.
29 * 29 *
30 * Please read Documentation/filesystems/configfs.txt before using the 30 * Please read Documentation/filesystems/configfs/configfs.txt before using
31 * configfs interface, ESPECIALLY the parts about reference counts and 31 * the configfs interface, ESPECIALLY the parts about reference counts and
32 * item destructors. 32 * item destructors.
33 */ 33 */
34 34
diff --git a/include/linux/connector.h b/include/linux/connector.h
index b68d27850d51..3a14615fd35c 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -132,11 +132,8 @@ struct cn_callback_id {
132}; 132};
133 133
134struct cn_callback_data { 134struct cn_callback_data {
135 void (*destruct_data) (void *); 135 struct sk_buff *skb;
136 void *ddata; 136 void (*callback) (struct cn_msg *, struct netlink_skb_parms *);
137
138 void *callback_priv;
139 void (*callback) (void *);
140 137
141 void *free; 138 void *free;
142}; 139};
@@ -167,11 +164,11 @@ struct cn_dev {
167 struct cn_queue_dev *cbdev; 164 struct cn_queue_dev *cbdev;
168}; 165};
169 166
170int cn_add_callback(struct cb_id *, char *, void (*callback) (void *)); 167int cn_add_callback(struct cb_id *, char *, void (*callback) (struct cn_msg *, struct netlink_skb_parms *));
171void cn_del_callback(struct cb_id *); 168void cn_del_callback(struct cb_id *);
172int cn_netlink_send(struct cn_msg *, u32, gfp_t); 169int cn_netlink_send(struct cn_msg *, u32, gfp_t);
173 170
174int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *)); 171int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
175void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); 172void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
176 173
177int queue_cn_work(struct cn_callback_entry *cbq, struct work_struct *work); 174int queue_cn_work(struct cn_callback_entry *cbq, struct work_struct *work);
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 4d668e05d458..47536197ffdd 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -48,6 +48,15 @@ struct notifier_block;
48 48
49#ifdef CONFIG_SMP 49#ifdef CONFIG_SMP
50/* Need to know about CPUs going up/down? */ 50/* Need to know about CPUs going up/down? */
51#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE)
52#define cpu_notifier(fn, pri) { \
53 static struct notifier_block fn##_nb __cpuinitdata = \
54 { .notifier_call = fn, .priority = pri }; \
55 register_cpu_notifier(&fn##_nb); \
56}
57#else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */
58#define cpu_notifier(fn, pri) do { (void)(fn); } while (0)
59#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */
51#ifdef CONFIG_HOTPLUG_CPU 60#ifdef CONFIG_HOTPLUG_CPU
52extern int register_cpu_notifier(struct notifier_block *nb); 61extern int register_cpu_notifier(struct notifier_block *nb);
53extern void unregister_cpu_notifier(struct notifier_block *nb); 62extern void unregister_cpu_notifier(struct notifier_block *nb);
@@ -74,6 +83,8 @@ extern void cpu_maps_update_done(void);
74 83
75#else /* CONFIG_SMP */ 84#else /* CONFIG_SMP */
76 85
86#define cpu_notifier(fn, pri) do { (void)(fn); } while (0)
87
77static inline int register_cpu_notifier(struct notifier_block *nb) 88static inline int register_cpu_notifier(struct notifier_block *nb)
78{ 89{
79 return 0; 90 return 0;
@@ -99,11 +110,7 @@ extern struct sysdev_class cpu_sysdev_class;
99 110
100extern void get_online_cpus(void); 111extern void get_online_cpus(void);
101extern void put_online_cpus(void); 112extern void put_online_cpus(void);
102#define hotcpu_notifier(fn, pri) { \ 113#define hotcpu_notifier(fn, pri) cpu_notifier(fn, pri)
103 static struct notifier_block fn##_nb __cpuinitdata = \
104 { .notifier_call = fn, .priority = pri }; \
105 register_cpu_notifier(&fn##_nb); \
106}
107#define register_hotcpu_notifier(nb) register_cpu_notifier(nb) 114#define register_hotcpu_notifier(nb) register_cpu_notifier(nb)
108#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) 115#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb)
109int cpu_down(unsigned int cpu); 116int cpu_down(unsigned int cpu);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 161042746afc..79a2340d83cd 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -65,6 +65,9 @@ static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
65 65
66struct cpufreq_governor; 66struct cpufreq_governor;
67 67
68/* /sys/devices/system/cpu/cpufreq: entry point for global variables */
69extern struct kobject *cpufreq_global_kobject;
70
68#define CPUFREQ_ETERNAL (-1) 71#define CPUFREQ_ETERNAL (-1)
69struct cpufreq_cpuinfo { 72struct cpufreq_cpuinfo {
70 unsigned int max_freq; 73 unsigned int max_freq;
@@ -274,6 +277,13 @@ struct freq_attr {
274 ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count); 277 ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count);
275}; 278};
276 279
280struct global_attr {
281 struct attribute attr;
282 ssize_t (*show)(struct kobject *kobj,
283 struct attribute *attr, char *buf);
284 ssize_t (*store)(struct kobject *a, struct attribute *b,
285 const char *c, size_t count);
286};
277 287
278/********************************************************************* 288/*********************************************************************
279 * CPUFREQ 2.6. INTERFACE * 289 * CPUFREQ 2.6. INTERFACE *
@@ -281,8 +291,15 @@ struct freq_attr {
281int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); 291int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
282int cpufreq_update_policy(unsigned int cpu); 292int cpufreq_update_policy(unsigned int cpu);
283 293
294#ifdef CONFIG_CPU_FREQ
284/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ 295/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */
285unsigned int cpufreq_get(unsigned int cpu); 296unsigned int cpufreq_get(unsigned int cpu);
297#else
298static inline unsigned int cpufreq_get(unsigned int cpu)
299{
300 return 0;
301}
302#endif
286 303
287/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */ 304/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */
288#ifdef CONFIG_CPU_FREQ 305#ifdef CONFIG_CPU_FREQ
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 796df12091b7..789cf5f920ce 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -3,444 +3,37 @@
3 3
4/* 4/*
5 * Cpumasks provide a bitmap suitable for representing the 5 * Cpumasks provide a bitmap suitable for representing the
6 * set of CPU's in a system, one bit position per CPU number. 6 * set of CPU's in a system, one bit position per CPU number. In general,
7 * 7 * only nr_cpu_ids (<= NR_CPUS) bits are valid.
8 * The new cpumask_ ops take a "struct cpumask *"; the old ones
9 * use cpumask_t.
10 *
11 * See detailed comments in the file linux/bitmap.h describing the
12 * data type on which these cpumasks are based.
13 *
14 * For details of cpumask_scnprintf() and cpumask_parse_user(),
15 * see bitmap_scnprintf() and bitmap_parse_user() in lib/bitmap.c.
16 * For details of cpulist_scnprintf() and cpulist_parse(), see
17 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c.
18 * For details of cpu_remap(), see bitmap_bitremap in lib/bitmap.c
19 * For details of cpus_remap(), see bitmap_remap in lib/bitmap.c.
20 * For details of cpus_onto(), see bitmap_onto in lib/bitmap.c.
21 * For details of cpus_fold(), see bitmap_fold in lib/bitmap.c.
22 *
23 * . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24 * Note: The alternate operations with the suffix "_nr" are used
25 * to limit the range of the loop to nr_cpu_ids instead of
26 * NR_CPUS when NR_CPUS > 64 for performance reasons.
27 * If NR_CPUS is <= 64 then most assembler bitmask
28 * operators execute faster with a constant range, so
29 * the operator will continue to use NR_CPUS.
30 *
31 * Another consideration is that nr_cpu_ids is initialized
32 * to NR_CPUS and isn't lowered until the possible cpus are
33 * discovered (including any disabled cpus). So early uses
34 * will span the entire range of NR_CPUS.
35 * . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36 *
37 * The obsolescent cpumask operations are:
38 *
39 * void cpu_set(cpu, mask) turn on bit 'cpu' in mask
40 * void cpu_clear(cpu, mask) turn off bit 'cpu' in mask
41 * void cpus_setall(mask) set all bits
42 * void cpus_clear(mask) clear all bits
43 * int cpu_isset(cpu, mask) true iff bit 'cpu' set in mask
44 * int cpu_test_and_set(cpu, mask) test and set bit 'cpu' in mask
45 *
46 * int cpus_and(dst, src1, src2) dst = src1 & src2 [intersection]
47 * void cpus_or(dst, src1, src2) dst = src1 | src2 [union]
48 * void cpus_xor(dst, src1, src2) dst = src1 ^ src2
49 * int cpus_andnot(dst, src1, src2) dst = src1 & ~src2
50 * void cpus_complement(dst, src) dst = ~src
51 *
52 * int cpus_equal(mask1, mask2) Does mask1 == mask2?
53 * int cpus_intersects(mask1, mask2) Do mask1 and mask2 intersect?
54 * int cpus_subset(mask1, mask2) Is mask1 a subset of mask2?
55 * int cpus_empty(mask) Is mask empty (no bits sets)?
56 * int cpus_full(mask) Is mask full (all bits sets)?
57 * int cpus_weight(mask) Hamming weigh - number of set bits
58 * int cpus_weight_nr(mask) Same using nr_cpu_ids instead of NR_CPUS
59 *
60 * void cpus_shift_right(dst, src, n) Shift right
61 * void cpus_shift_left(dst, src, n) Shift left
62 *
63 * int first_cpu(mask) Number lowest set bit, or NR_CPUS
64 * int next_cpu(cpu, mask) Next cpu past 'cpu', or NR_CPUS
65 * int next_cpu_nr(cpu, mask) Next cpu past 'cpu', or nr_cpu_ids
66 *
67 * cpumask_t cpumask_of_cpu(cpu) Return cpumask with bit 'cpu' set
68 * (can be used as an lvalue)
69 * CPU_MASK_ALL Initializer - all bits set
70 * CPU_MASK_NONE Initializer - no bits set
71 * unsigned long *cpus_addr(mask) Array of unsigned long's in mask
72 *
73 * CPUMASK_ALLOC kmalloc's a structure that is a composite of many cpumask_t
74 * variables, and CPUMASK_PTR provides pointers to each field.
75 *
76 * The structure should be defined something like this:
77 * struct my_cpumasks {
78 * cpumask_t mask1;
79 * cpumask_t mask2;
80 * };
81 *
82 * Usage is then:
83 * CPUMASK_ALLOC(my_cpumasks);
84 * CPUMASK_PTR(mask1, my_cpumasks);
85 * CPUMASK_PTR(mask2, my_cpumasks);
86 *
87 * --- DO NOT reference cpumask_t pointers until this check ---
88 * if (my_cpumasks == NULL)
89 * "kmalloc failed"...
90 *
91 * References are now pointers to the cpumask_t variables (*mask1, ...)
92 *
93 *if NR_CPUS > BITS_PER_LONG
94 * CPUMASK_ALLOC(m) Declares and allocates struct m *m =
95 * kmalloc(sizeof(*m), GFP_KERNEL)
96 * CPUMASK_FREE(m) Macro for kfree(m)
97 *else
98 * CPUMASK_ALLOC(m) Declares struct m _m, *m = &_m
99 * CPUMASK_FREE(m) Nop
100 *endif
101 * CPUMASK_PTR(v, m) Declares cpumask_t *v = &(m->v)
102 * ------------------------------------------------------------------------
103 *
104 * int cpumask_scnprintf(buf, len, mask) Format cpumask for printing
105 * int cpumask_parse_user(ubuf, ulen, mask) Parse ascii string as cpumask
106 * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing
107 * int cpulist_parse(buf, map) Parse ascii string as cpulist
108 * int cpu_remap(oldbit, old, new) newbit = map(old, new)(oldbit)
109 * void cpus_remap(dst, src, old, new) *dst = map(old, new)(src)
110 * void cpus_onto(dst, orig, relmap) *dst = orig relative to relmap
111 * void cpus_fold(dst, orig, sz) dst bits = orig bits mod sz
112 *
113 * for_each_cpu_mask(cpu, mask) for-loop cpu over mask using NR_CPUS
114 * for_each_cpu_mask_nr(cpu, mask) for-loop cpu over mask using nr_cpu_ids
115 *
116 * int num_online_cpus() Number of online CPUs
117 * int num_possible_cpus() Number of all possible CPUs
118 * int num_present_cpus() Number of present CPUs
119 *
120 * int cpu_online(cpu) Is some cpu online?
121 * int cpu_possible(cpu) Is some cpu possible?
122 * int cpu_present(cpu) Is some cpu present (can schedule)?
123 *
124 * int any_online_cpu(mask) First online cpu in mask
125 *
126 * for_each_possible_cpu(cpu) for-loop cpu over cpu_possible_map
127 * for_each_online_cpu(cpu) for-loop cpu over cpu_online_map
128 * for_each_present_cpu(cpu) for-loop cpu over cpu_present_map
129 *
130 * Subtlety:
131 * 1) The 'type-checked' form of cpu_isset() causes gcc (3.3.2, anyway)
132 * to generate slightly worse code. Note for example the additional
133 * 40 lines of assembly code compiling the "for each possible cpu"
134 * loops buried in the disk_stat_read() macros calls when compiling
135 * drivers/block/genhd.c (arch i386, CONFIG_SMP=y). So use a simple
136 * one-line #define for cpu_isset(), instead of wrapping an inline
137 * inside a macro, the way we do the other calls.
138 */ 8 */
139
140#include <linux/kernel.h> 9#include <linux/kernel.h>
141#include <linux/threads.h> 10#include <linux/threads.h>
142#include <linux/bitmap.h> 11#include <linux/bitmap.h>
143 12
144typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; 13typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
145extern cpumask_t _unused_cpumask_arg_;
146
147#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
148#define cpu_set(cpu, dst) __cpu_set((cpu), &(dst))
149static inline void __cpu_set(int cpu, volatile cpumask_t *dstp)
150{
151 set_bit(cpu, dstp->bits);
152}
153
154#define cpu_clear(cpu, dst) __cpu_clear((cpu), &(dst))
155static inline void __cpu_clear(int cpu, volatile cpumask_t *dstp)
156{
157 clear_bit(cpu, dstp->bits);
158}
159
160#define cpus_setall(dst) __cpus_setall(&(dst), NR_CPUS)
161static inline void __cpus_setall(cpumask_t *dstp, int nbits)
162{
163 bitmap_fill(dstp->bits, nbits);
164}
165
166#define cpus_clear(dst) __cpus_clear(&(dst), NR_CPUS)
167static inline void __cpus_clear(cpumask_t *dstp, int nbits)
168{
169 bitmap_zero(dstp->bits, nbits);
170}
171
172/* No static inline type checking - see Subtlety (1) above. */
173#define cpu_isset(cpu, cpumask) test_bit((cpu), (cpumask).bits)
174
175#define cpu_test_and_set(cpu, cpumask) __cpu_test_and_set((cpu), &(cpumask))
176static inline int __cpu_test_and_set(int cpu, cpumask_t *addr)
177{
178 return test_and_set_bit(cpu, addr->bits);
179}
180
181#define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS)
182static inline int __cpus_and(cpumask_t *dstp, const cpumask_t *src1p,
183 const cpumask_t *src2p, int nbits)
184{
185 return bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
186}
187
188#define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS)
189static inline void __cpus_or(cpumask_t *dstp, const cpumask_t *src1p,
190 const cpumask_t *src2p, int nbits)
191{
192 bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits);
193}
194
195#define cpus_xor(dst, src1, src2) __cpus_xor(&(dst), &(src1), &(src2), NR_CPUS)
196static inline void __cpus_xor(cpumask_t *dstp, const cpumask_t *src1p,
197 const cpumask_t *src2p, int nbits)
198{
199 bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits);
200}
201
202#define cpus_andnot(dst, src1, src2) \
203 __cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS)
204static inline int __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p,
205 const cpumask_t *src2p, int nbits)
206{
207 return bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
208}
209
210#define cpus_complement(dst, src) __cpus_complement(&(dst), &(src), NR_CPUS)
211static inline void __cpus_complement(cpumask_t *dstp,
212 const cpumask_t *srcp, int nbits)
213{
214 bitmap_complement(dstp->bits, srcp->bits, nbits);
215}
216
217#define cpus_equal(src1, src2) __cpus_equal(&(src1), &(src2), NR_CPUS)
218static inline int __cpus_equal(const cpumask_t *src1p,
219 const cpumask_t *src2p, int nbits)
220{
221 return bitmap_equal(src1p->bits, src2p->bits, nbits);
222}
223
224#define cpus_intersects(src1, src2) __cpus_intersects(&(src1), &(src2), NR_CPUS)
225static inline int __cpus_intersects(const cpumask_t *src1p,
226 const cpumask_t *src2p, int nbits)
227{
228 return bitmap_intersects(src1p->bits, src2p->bits, nbits);
229}
230
231#define cpus_subset(src1, src2) __cpus_subset(&(src1), &(src2), NR_CPUS)
232static inline int __cpus_subset(const cpumask_t *src1p,
233 const cpumask_t *src2p, int nbits)
234{
235 return bitmap_subset(src1p->bits, src2p->bits, nbits);
236}
237
238#define cpus_empty(src) __cpus_empty(&(src), NR_CPUS)
239static inline int __cpus_empty(const cpumask_t *srcp, int nbits)
240{
241 return bitmap_empty(srcp->bits, nbits);
242}
243
244#define cpus_full(cpumask) __cpus_full(&(cpumask), NR_CPUS)
245static inline int __cpus_full(const cpumask_t *srcp, int nbits)
246{
247 return bitmap_full(srcp->bits, nbits);
248}
249
250#define cpus_weight(cpumask) __cpus_weight(&(cpumask), NR_CPUS)
251static inline int __cpus_weight(const cpumask_t *srcp, int nbits)
252{
253 return bitmap_weight(srcp->bits, nbits);
254}
255
256#define cpus_shift_right(dst, src, n) \
257 __cpus_shift_right(&(dst), &(src), (n), NR_CPUS)
258static inline void __cpus_shift_right(cpumask_t *dstp,
259 const cpumask_t *srcp, int n, int nbits)
260{
261 bitmap_shift_right(dstp->bits, srcp->bits, n, nbits);
262}
263
264#define cpus_shift_left(dst, src, n) \
265 __cpus_shift_left(&(dst), &(src), (n), NR_CPUS)
266static inline void __cpus_shift_left(cpumask_t *dstp,
267 const cpumask_t *srcp, int n, int nbits)
268{
269 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
270}
271#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
272 14
273/** 15/**
274 * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask * 16 * cpumask_bits - get the bits in a cpumask
275 * @bitmap: the bitmap 17 * @maskp: the struct cpumask *
276 *
277 * There are a few places where cpumask_var_t isn't appropriate and
278 * static cpumasks must be used (eg. very early boot), yet we don't
279 * expose the definition of 'struct cpumask'.
280 * 18 *
281 * This does the conversion, and can be used as a constant initializer. 19 * You should only assume nr_cpu_ids bits of this mask are valid. This is
20 * a macro so it's const-correct.
282 */ 21 */
283#define to_cpumask(bitmap) \ 22#define cpumask_bits(maskp) ((maskp)->bits)
284 ((struct cpumask *)(1 ? (bitmap) \
285 : (void *)sizeof(__check_is_bitmap(bitmap))))
286
287static inline int __check_is_bitmap(const unsigned long *bitmap)
288{
289 return 1;
290}
291
292/*
293 * Special-case data structure for "single bit set only" constant CPU masks.
294 *
295 * We pre-generate all the 64 (or 32) possible bit positions, with enough
296 * padding to the left and the right, and return the constant pointer
297 * appropriately offset.
298 */
299extern const unsigned long
300 cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)];
301
302static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
303{
304 const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG];
305 p -= cpu / BITS_PER_LONG;
306 return to_cpumask(p);
307}
308
309#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
310/*
311 * In cases where we take the address of the cpumask immediately,
312 * gcc optimizes it out (it's a constant) and there's no huge stack
313 * variable created:
314 */
315#define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu))
316
317
318#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
319
320#if NR_CPUS <= BITS_PER_LONG
321
322#define CPU_MASK_ALL \
323(cpumask_t) { { \
324 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
325} }
326
327#define CPU_MASK_ALL_PTR (&CPU_MASK_ALL)
328
329#else
330
331#define CPU_MASK_ALL \
332(cpumask_t) { { \
333 [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \
334 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
335} }
336
337/* cpu_mask_all is in init/main.c */
338extern cpumask_t cpu_mask_all;
339#define CPU_MASK_ALL_PTR (&cpu_mask_all)
340
341#endif
342
343#define CPU_MASK_NONE \
344(cpumask_t) { { \
345 [0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL \
346} }
347
348#define CPU_MASK_CPU0 \
349(cpumask_t) { { \
350 [0] = 1UL \
351} }
352
353#define cpus_addr(src) ((src).bits)
354
355#if NR_CPUS > BITS_PER_LONG
356#define CPUMASK_ALLOC(m) struct m *m = kmalloc(sizeof(*m), GFP_KERNEL)
357#define CPUMASK_FREE(m) kfree(m)
358#else
359#define CPUMASK_ALLOC(m) struct m _m, *m = &_m
360#define CPUMASK_FREE(m)
361#endif
362#define CPUMASK_PTR(v, m) cpumask_t *v = &(m->v)
363
364#define cpu_remap(oldbit, old, new) \
365 __cpu_remap((oldbit), &(old), &(new), NR_CPUS)
366static inline int __cpu_remap(int oldbit,
367 const cpumask_t *oldp, const cpumask_t *newp, int nbits)
368{
369 return bitmap_bitremap(oldbit, oldp->bits, newp->bits, nbits);
370}
371
372#define cpus_remap(dst, src, old, new) \
373 __cpus_remap(&(dst), &(src), &(old), &(new), NR_CPUS)
374static inline void __cpus_remap(cpumask_t *dstp, const cpumask_t *srcp,
375 const cpumask_t *oldp, const cpumask_t *newp, int nbits)
376{
377 bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits);
378}
379
380#define cpus_onto(dst, orig, relmap) \
381 __cpus_onto(&(dst), &(orig), &(relmap), NR_CPUS)
382static inline void __cpus_onto(cpumask_t *dstp, const cpumask_t *origp,
383 const cpumask_t *relmapp, int nbits)
384{
385 bitmap_onto(dstp->bits, origp->bits, relmapp->bits, nbits);
386}
387
388#define cpus_fold(dst, orig, sz) \
389 __cpus_fold(&(dst), &(orig), sz, NR_CPUS)
390static inline void __cpus_fold(cpumask_t *dstp, const cpumask_t *origp,
391 int sz, int nbits)
392{
393 bitmap_fold(dstp->bits, origp->bits, sz, nbits);
394}
395#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
396 23
397#if NR_CPUS == 1 24#if NR_CPUS == 1
398
399#define nr_cpu_ids 1 25#define nr_cpu_ids 1
400#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS 26#else
401#define first_cpu(src) ({ (void)(src); 0; })
402#define next_cpu(n, src) ({ (void)(src); 1; })
403#define any_online_cpu(mask) 0
404#define for_each_cpu_mask(cpu, mask) \
405 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
406#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
407#else /* NR_CPUS > 1 */
408
409extern int nr_cpu_ids; 27extern int nr_cpu_ids;
410#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
411int __first_cpu(const cpumask_t *srcp);
412int __next_cpu(int n, const cpumask_t *srcp);
413int __any_online_cpu(const cpumask_t *mask);
414
415#define first_cpu(src) __first_cpu(&(src))
416#define next_cpu(n, src) __next_cpu((n), &(src))
417#define any_online_cpu(mask) __any_online_cpu(&(mask))
418#define for_each_cpu_mask(cpu, mask) \
419 for ((cpu) = -1; \
420 (cpu) = next_cpu((cpu), (mask)), \
421 (cpu) < NR_CPUS; )
422#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
423#endif 28#endif
424 29
425#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS 30#ifdef CONFIG_CPUMASK_OFFSTACK
426#if NR_CPUS <= 64 31/* Assuming NR_CPUS is huge, a runtime limit is more efficient. Also,
427 32 * not all bits may be allocated. */
428#define next_cpu_nr(n, src) next_cpu(n, src) 33#define nr_cpumask_bits nr_cpu_ids
429#define cpus_weight_nr(cpumask) cpus_weight(cpumask) 34#else
430#define for_each_cpu_mask_nr(cpu, mask) for_each_cpu_mask(cpu, mask) 35#define nr_cpumask_bits NR_CPUS
431 36#endif
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 */
443#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
444 37
445/* 38/*
446 * The following particular system cpumasks and operations manage 39 * The following particular system cpumasks and operations manage
@@ -487,12 +80,6 @@ extern const struct cpumask *const cpu_online_mask;
487extern const struct cpumask *const cpu_present_mask; 80extern const struct cpumask *const cpu_present_mask;
488extern const struct cpumask *const cpu_active_mask; 81extern const struct cpumask *const cpu_active_mask;
489 82
490/* These strip const, as traditionally they weren't const. */
491#define cpu_possible_map (*(cpumask_t *)cpu_possible_mask)
492#define cpu_online_map (*(cpumask_t *)cpu_online_mask)
493#define cpu_present_map (*(cpumask_t *)cpu_present_mask)
494#define cpu_active_map (*(cpumask_t *)cpu_active_mask)
495
496#if NR_CPUS > 1 83#if NR_CPUS > 1
497#define num_online_cpus() cpumask_weight(cpu_online_mask) 84#define num_online_cpus() cpumask_weight(cpu_online_mask)
498#define num_possible_cpus() cpumask_weight(cpu_possible_mask) 85#define num_possible_cpus() cpumask_weight(cpu_possible_mask)
@@ -511,35 +98,6 @@ extern const struct cpumask *const cpu_active_mask;
511#define cpu_active(cpu) ((cpu) == 0) 98#define cpu_active(cpu) ((cpu) == 0)
512#endif 99#endif
513 100
514#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
515
516/* These are the new versions of the cpumask operators: passed by pointer.
517 * The older versions will be implemented in terms of these, then deleted. */
518#define cpumask_bits(maskp) ((maskp)->bits)
519
520#if NR_CPUS <= BITS_PER_LONG
521#define CPU_BITS_ALL \
522{ \
523 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
524}
525
526#else /* NR_CPUS > BITS_PER_LONG */
527
528#define CPU_BITS_ALL \
529{ \
530 [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \
531 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
532}
533#endif /* NR_CPUS > BITS_PER_LONG */
534
535#ifdef CONFIG_CPUMASK_OFFSTACK
536/* Assuming NR_CPUS is huge, a runtime limit is more efficient. Also,
537 * not all bits may be allocated. */
538#define nr_cpumask_bits nr_cpu_ids
539#else
540#define nr_cpumask_bits NR_CPUS
541#endif
542
543/* verify cpu argument to cpumask_* operators */ 101/* verify cpu argument to cpumask_* operators */
544static inline unsigned int cpumask_check(unsigned int cpu) 102static inline unsigned int cpumask_check(unsigned int cpu)
545{ 103{
@@ -715,6 +273,18 @@ static inline int cpumask_test_and_set_cpu(int cpu, struct cpumask *cpumask)
715} 273}
716 274
717/** 275/**
276 * cpumask_test_and_clear_cpu - atomically test and clear a cpu in a cpumask
277 * @cpu: cpu number (< nr_cpu_ids)
278 * @cpumask: the cpumask pointer
279 *
280 * test_and_clear_bit wrapper for cpumasks.
281 */
282static inline int cpumask_test_and_clear_cpu(int cpu, struct cpumask *cpumask)
283{
284 return test_and_clear_bit(cpumask_check(cpu), cpumask_bits(cpumask));
285}
286
287/**
718 * cpumask_setall - set all cpus (< nr_cpu_ids) in a cpumask 288 * cpumask_setall - set all cpus (< nr_cpu_ids) in a cpumask
719 * @dstp: the cpumask pointer 289 * @dstp: the cpumask pointer
720 */ 290 */
@@ -1088,4 +658,241 @@ void set_cpu_active(unsigned int cpu, bool active);
1088void init_cpu_present(const struct cpumask *src); 658void init_cpu_present(const struct cpumask *src);
1089void init_cpu_possible(const struct cpumask *src); 659void init_cpu_possible(const struct cpumask *src);
1090void init_cpu_online(const struct cpumask *src); 660void init_cpu_online(const struct cpumask *src);
661
662/**
663 * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask *
664 * @bitmap: the bitmap
665 *
666 * There are a few places where cpumask_var_t isn't appropriate and
667 * static cpumasks must be used (eg. very early boot), yet we don't
668 * expose the definition of 'struct cpumask'.
669 *
670 * This does the conversion, and can be used as a constant initializer.
671 */
672#define to_cpumask(bitmap) \
673 ((struct cpumask *)(1 ? (bitmap) \
674 : (void *)sizeof(__check_is_bitmap(bitmap))))
675
676static inline int __check_is_bitmap(const unsigned long *bitmap)
677{
678 return 1;
679}
680
681/*
682 * Special-case data structure for "single bit set only" constant CPU masks.
683 *
684 * We pre-generate all the 64 (or 32) possible bit positions, with enough
685 * padding to the left and the right, and return the constant pointer
686 * appropriately offset.
687 */
688extern const unsigned long
689 cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)];
690
691static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
692{
693 const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG];
694 p -= cpu / BITS_PER_LONG;
695 return to_cpumask(p);
696}
697
698#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
699
700#if NR_CPUS <= BITS_PER_LONG
701#define CPU_BITS_ALL \
702{ \
703 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
704}
705
706#else /* NR_CPUS > BITS_PER_LONG */
707
708#define CPU_BITS_ALL \
709{ \
710 [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \
711 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
712}
713#endif /* NR_CPUS > BITS_PER_LONG */
714
715/*
716 *
717 * From here down, all obsolete. Use cpumask_ variants!
718 *
719 */
720#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
721/* These strip const, as traditionally they weren't const. */
722#define cpu_possible_map (*(cpumask_t *)cpu_possible_mask)
723#define cpu_online_map (*(cpumask_t *)cpu_online_mask)
724#define cpu_present_map (*(cpumask_t *)cpu_present_mask)
725#define cpu_active_map (*(cpumask_t *)cpu_active_mask)
726
727#define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu))
728
729#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
730
731#if NR_CPUS <= BITS_PER_LONG
732
733#define CPU_MASK_ALL \
734(cpumask_t) { { \
735 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
736} }
737
738#else
739
740#define CPU_MASK_ALL \
741(cpumask_t) { { \
742 [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \
743 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
744} }
745
746#endif
747
748#define CPU_MASK_NONE \
749(cpumask_t) { { \
750 [0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL \
751} }
752
753#define CPU_MASK_CPU0 \
754(cpumask_t) { { \
755 [0] = 1UL \
756} }
757
758#if NR_CPUS == 1
759#define first_cpu(src) ({ (void)(src); 0; })
760#define next_cpu(n, src) ({ (void)(src); 1; })
761#define any_online_cpu(mask) 0
762#define for_each_cpu_mask(cpu, mask) \
763 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
764#else /* NR_CPUS > 1 */
765int __first_cpu(const cpumask_t *srcp);
766int __next_cpu(int n, const cpumask_t *srcp);
767int __any_online_cpu(const cpumask_t *mask);
768
769#define first_cpu(src) __first_cpu(&(src))
770#define next_cpu(n, src) __next_cpu((n), &(src))
771#define any_online_cpu(mask) __any_online_cpu(&(mask))
772#define for_each_cpu_mask(cpu, mask) \
773 for ((cpu) = -1; \
774 (cpu) = next_cpu((cpu), (mask)), \
775 (cpu) < NR_CPUS; )
776#endif /* SMP */
777
778#if NR_CPUS <= 64
779
780#define for_each_cpu_mask_nr(cpu, mask) for_each_cpu_mask(cpu, mask)
781
782#else /* NR_CPUS > 64 */
783
784int __next_cpu_nr(int n, const cpumask_t *srcp);
785#define for_each_cpu_mask_nr(cpu, mask) \
786 for ((cpu) = -1; \
787 (cpu) = __next_cpu_nr((cpu), &(mask)), \
788 (cpu) < nr_cpu_ids; )
789
790#endif /* NR_CPUS > 64 */
791
792#define cpus_addr(src) ((src).bits)
793
794#define cpu_set(cpu, dst) __cpu_set((cpu), &(dst))
795static inline void __cpu_set(int cpu, volatile cpumask_t *dstp)
796{
797 set_bit(cpu, dstp->bits);
798}
799
800#define cpu_clear(cpu, dst) __cpu_clear((cpu), &(dst))
801static inline void __cpu_clear(int cpu, volatile cpumask_t *dstp)
802{
803 clear_bit(cpu, dstp->bits);
804}
805
806#define cpus_setall(dst) __cpus_setall(&(dst), NR_CPUS)
807static inline void __cpus_setall(cpumask_t *dstp, int nbits)
808{
809 bitmap_fill(dstp->bits, nbits);
810}
811
812#define cpus_clear(dst) __cpus_clear(&(dst), NR_CPUS)
813static inline void __cpus_clear(cpumask_t *dstp, int nbits)
814{
815 bitmap_zero(dstp->bits, nbits);
816}
817
818/* No static inline type checking - see Subtlety (1) above. */
819#define cpu_isset(cpu, cpumask) test_bit((cpu), (cpumask).bits)
820
821#define cpu_test_and_set(cpu, cpumask) __cpu_test_and_set((cpu), &(cpumask))
822static inline int __cpu_test_and_set(int cpu, cpumask_t *addr)
823{
824 return test_and_set_bit(cpu, addr->bits);
825}
826
827#define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS)
828static inline int __cpus_and(cpumask_t *dstp, const cpumask_t *src1p,
829 const cpumask_t *src2p, int nbits)
830{
831 return bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
832}
833
834#define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS)
835static inline void __cpus_or(cpumask_t *dstp, const cpumask_t *src1p,
836 const cpumask_t *src2p, int nbits)
837{
838 bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits);
839}
840
841#define cpus_xor(dst, src1, src2) __cpus_xor(&(dst), &(src1), &(src2), NR_CPUS)
842static inline void __cpus_xor(cpumask_t *dstp, const cpumask_t *src1p,
843 const cpumask_t *src2p, int nbits)
844{
845 bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits);
846}
847
848#define cpus_andnot(dst, src1, src2) \
849 __cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS)
850static inline int __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p,
851 const cpumask_t *src2p, int nbits)
852{
853 return bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
854}
855
856#define cpus_equal(src1, src2) __cpus_equal(&(src1), &(src2), NR_CPUS)
857static inline int __cpus_equal(const cpumask_t *src1p,
858 const cpumask_t *src2p, int nbits)
859{
860 return bitmap_equal(src1p->bits, src2p->bits, nbits);
861}
862
863#define cpus_intersects(src1, src2) __cpus_intersects(&(src1), &(src2), NR_CPUS)
864static inline int __cpus_intersects(const cpumask_t *src1p,
865 const cpumask_t *src2p, int nbits)
866{
867 return bitmap_intersects(src1p->bits, src2p->bits, nbits);
868}
869
870#define cpus_subset(src1, src2) __cpus_subset(&(src1), &(src2), NR_CPUS)
871static inline int __cpus_subset(const cpumask_t *src1p,
872 const cpumask_t *src2p, int nbits)
873{
874 return bitmap_subset(src1p->bits, src2p->bits, nbits);
875}
876
877#define cpus_empty(src) __cpus_empty(&(src), NR_CPUS)
878static inline int __cpus_empty(const cpumask_t *srcp, int nbits)
879{
880 return bitmap_empty(srcp->bits, nbits);
881}
882
883#define cpus_weight(cpumask) __cpus_weight(&(cpumask), NR_CPUS)
884static inline int __cpus_weight(const cpumask_t *srcp, int nbits)
885{
886 return bitmap_weight(srcp->bits, nbits);
887}
888
889#define cpus_shift_left(dst, src, n) \
890 __cpus_shift_left(&(dst), &(src), (n), NR_CPUS)
891static inline void __cpus_shift_left(cpumask_t *dstp,
892 const cpumask_t *srcp, int n, int nbits)
893{
894 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
895}
896#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
897
1091#endif /* __LINUX_CPUMASK_H */ 898#endif /* __LINUX_CPUMASK_H */
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 4fa999696310..4e3387a89cb9 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -15,6 +15,7 @@
15#include <linux/capability.h> 15#include <linux/capability.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/key.h> 17#include <linux/key.h>
18#include <linux/selinux.h>
18#include <asm/atomic.h> 19#include <asm/atomic.h>
19 20
20struct user_struct; 21struct user_struct;
@@ -114,6 +115,13 @@ struct thread_group_cred {
114 */ 115 */
115struct cred { 116struct cred {
116 atomic_t usage; 117 atomic_t usage;
118#ifdef CONFIG_DEBUG_CREDENTIALS
119 atomic_t subscribers; /* number of processes subscribed */
120 void *put_addr;
121 unsigned magic;
122#define CRED_MAGIC 0x43736564
123#define CRED_MAGIC_DEAD 0x44656144
124#endif
117 uid_t uid; /* real UID of the task */ 125 uid_t uid; /* real UID of the task */
118 gid_t gid; /* real GID of the task */ 126 gid_t gid; /* real GID of the task */
119 uid_t suid; /* saved UID of the task */ 127 uid_t suid; /* saved UID of the task */
@@ -143,7 +151,9 @@ struct cred {
143}; 151};
144 152
145extern void __put_cred(struct cred *); 153extern void __put_cred(struct cred *);
154extern void exit_creds(struct task_struct *);
146extern int copy_creds(struct task_struct *, unsigned long); 155extern int copy_creds(struct task_struct *, unsigned long);
156extern struct cred *cred_alloc_blank(void);
147extern struct cred *prepare_creds(void); 157extern struct cred *prepare_creds(void);
148extern struct cred *prepare_exec_creds(void); 158extern struct cred *prepare_exec_creds(void);
149extern struct cred *prepare_usermodehelper_creds(void); 159extern struct cred *prepare_usermodehelper_creds(void);
@@ -158,6 +168,46 @@ extern int set_security_override_from_ctx(struct cred *, const char *);
158extern int set_create_files_as(struct cred *, struct inode *); 168extern int set_create_files_as(struct cred *, struct inode *);
159extern void __init cred_init(void); 169extern void __init cred_init(void);
160 170
171/*
172 * check for validity of credentials
173 */
174#ifdef CONFIG_DEBUG_CREDENTIALS
175extern void __invalid_creds(const struct cred *, const char *, unsigned);
176extern void __validate_process_creds(struct task_struct *,
177 const char *, unsigned);
178
179extern bool creds_are_invalid(const struct cred *cred);
180
181static inline void __validate_creds(const struct cred *cred,
182 const char *file, unsigned line)
183{
184 if (unlikely(creds_are_invalid(cred)))
185 __invalid_creds(cred, file, line);
186}
187
188#define validate_creds(cred) \
189do { \
190 __validate_creds((cred), __FILE__, __LINE__); \
191} while(0)
192
193#define validate_process_creds() \
194do { \
195 __validate_process_creds(current, __FILE__, __LINE__); \
196} while(0)
197
198extern void validate_creds_for_do_exit(struct task_struct *);
199#else
200static inline void validate_creds(const struct cred *cred)
201{
202}
203static inline void validate_creds_for_do_exit(struct task_struct *tsk)
204{
205}
206static inline void validate_process_creds(void)
207{
208}
209#endif
210
161/** 211/**
162 * get_new_cred - Get a reference on a new set of credentials 212 * get_new_cred - Get a reference on a new set of credentials
163 * @cred: The new credentials to reference 213 * @cred: The new credentials to reference
@@ -186,7 +236,9 @@ static inline struct cred *get_new_cred(struct cred *cred)
186 */ 236 */
187static inline const struct cred *get_cred(const struct cred *cred) 237static inline const struct cred *get_cred(const struct cred *cred)
188{ 238{
189 return get_new_cred((struct cred *) cred); 239 struct cred *nonconst_cred = (struct cred *) cred;
240 validate_creds(cred);
241 return get_new_cred(nonconst_cred);
190} 242}
191 243
192/** 244/**
@@ -204,7 +256,7 @@ static inline void put_cred(const struct cred *_cred)
204{ 256{
205 struct cred *cred = (struct cred *) _cred; 257 struct cred *cred = (struct cred *) _cred;
206 258
207 BUG_ON(atomic_read(&(cred)->usage) <= 0); 259 validate_creds(cred);
208 if (atomic_dec_and_test(&(cred)->usage)) 260 if (atomic_dec_and_test(&(cred)->usage))
209 __put_cred(cred); 261 __put_cred(cred);
210} 262}
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index ec29fa268b94..fd929889e8dc 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -115,7 +115,6 @@ struct crypto_async_request;
115struct crypto_aead; 115struct crypto_aead;
116struct crypto_blkcipher; 116struct crypto_blkcipher;
117struct crypto_hash; 117struct crypto_hash;
118struct crypto_ahash;
119struct crypto_rng; 118struct crypto_rng;
120struct crypto_tfm; 119struct crypto_tfm;
121struct crypto_type; 120struct crypto_type;
@@ -146,16 +145,6 @@ struct ablkcipher_request {
146 void *__ctx[] CRYPTO_MINALIGN_ATTR; 145 void *__ctx[] CRYPTO_MINALIGN_ATTR;
147}; 146};
148 147
149struct ahash_request {
150 struct crypto_async_request base;
151
152 unsigned int nbytes;
153 struct scatterlist *src;
154 u8 *result;
155
156 void *__ctx[] CRYPTO_MINALIGN_ATTR;
157};
158
159/** 148/**
160 * struct aead_request - AEAD request 149 * struct aead_request - AEAD request
161 * @base: Common attributes for async crypto requests 150 * @base: Common attributes for async crypto requests
@@ -220,18 +209,6 @@ struct ablkcipher_alg {
220 unsigned int ivsize; 209 unsigned int ivsize;
221}; 210};
222 211
223struct ahash_alg {
224 int (*init)(struct ahash_request *req);
225 int (*reinit)(struct ahash_request *req);
226 int (*update)(struct ahash_request *req);
227 int (*final)(struct ahash_request *req);
228 int (*digest)(struct ahash_request *req);
229 int (*setkey)(struct crypto_ahash *tfm, const u8 *key,
230 unsigned int keylen);
231
232 unsigned int digestsize;
233};
234
235struct aead_alg { 212struct aead_alg {
236 int (*setkey)(struct crypto_aead *tfm, const u8 *key, 213 int (*setkey)(struct crypto_aead *tfm, const u8 *key,
237 unsigned int keylen); 214 unsigned int keylen);
@@ -318,7 +295,6 @@ struct rng_alg {
318#define cra_cipher cra_u.cipher 295#define cra_cipher cra_u.cipher
319#define cra_digest cra_u.digest 296#define cra_digest cra_u.digest
320#define cra_hash cra_u.hash 297#define cra_hash cra_u.hash
321#define cra_ahash cra_u.ahash
322#define cra_compress cra_u.compress 298#define cra_compress cra_u.compress
323#define cra_rng cra_u.rng 299#define cra_rng cra_u.rng
324 300
@@ -346,7 +322,6 @@ struct crypto_alg {
346 struct cipher_alg cipher; 322 struct cipher_alg cipher;
347 struct digest_alg digest; 323 struct digest_alg digest;
348 struct hash_alg hash; 324 struct hash_alg hash;
349 struct ahash_alg ahash;
350 struct compress_alg compress; 325 struct compress_alg compress;
351 struct rng_alg rng; 326 struct rng_alg rng;
352 } cra_u; 327 } cra_u;
@@ -433,18 +408,6 @@ struct hash_tfm {
433 unsigned int digestsize; 408 unsigned int digestsize;
434}; 409};
435 410
436struct ahash_tfm {
437 int (*init)(struct ahash_request *req);
438 int (*update)(struct ahash_request *req);
439 int (*final)(struct ahash_request *req);
440 int (*digest)(struct ahash_request *req);
441 int (*setkey)(struct crypto_ahash *tfm, const u8 *key,
442 unsigned int keylen);
443
444 unsigned int digestsize;
445 unsigned int reqsize;
446};
447
448struct compress_tfm { 411struct compress_tfm {
449 int (*cot_compress)(struct crypto_tfm *tfm, 412 int (*cot_compress)(struct crypto_tfm *tfm,
450 const u8 *src, unsigned int slen, 413 const u8 *src, unsigned int slen,
@@ -465,7 +428,6 @@ struct rng_tfm {
465#define crt_blkcipher crt_u.blkcipher 428#define crt_blkcipher crt_u.blkcipher
466#define crt_cipher crt_u.cipher 429#define crt_cipher crt_u.cipher
467#define crt_hash crt_u.hash 430#define crt_hash crt_u.hash
468#define crt_ahash crt_u.ahash
469#define crt_compress crt_u.compress 431#define crt_compress crt_u.compress
470#define crt_rng crt_u.rng 432#define crt_rng crt_u.rng
471 433
@@ -479,7 +441,6 @@ struct crypto_tfm {
479 struct blkcipher_tfm blkcipher; 441 struct blkcipher_tfm blkcipher;
480 struct cipher_tfm cipher; 442 struct cipher_tfm cipher;
481 struct hash_tfm hash; 443 struct hash_tfm hash;
482 struct ahash_tfm ahash;
483 struct compress_tfm compress; 444 struct compress_tfm compress;
484 struct rng_tfm rng; 445 struct rng_tfm rng;
485 } crt_u; 446 } crt_u;
@@ -770,7 +731,7 @@ static inline struct ablkcipher_request *ablkcipher_request_alloc(
770 731
771static inline void ablkcipher_request_free(struct ablkcipher_request *req) 732static inline void ablkcipher_request_free(struct ablkcipher_request *req)
772{ 733{
773 kfree(req); 734 kzfree(req);
774} 735}
775 736
776static inline void ablkcipher_request_set_callback( 737static inline void ablkcipher_request_set_callback(
@@ -901,7 +862,7 @@ static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm,
901 862
902static inline void aead_request_free(struct aead_request *req) 863static inline void aead_request_free(struct aead_request *req)
903{ 864{
904 kfree(req); 865 kzfree(req);
905} 866}
906 867
907static inline void aead_request_set_callback(struct aead_request *req, 868static inline void aead_request_set_callback(struct aead_request *req,
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index 1fbdea4f08eb..a5049eaf782d 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -499,6 +499,7 @@ struct cyclades_card {
499 void __iomem *p9050; 499 void __iomem *p9050;
500 struct RUNTIME_9060 __iomem *p9060; 500 struct RUNTIME_9060 __iomem *p9060;
501 } ctl_addr; 501 } ctl_addr;
502 struct BOARD_CTRL __iomem *board_ctrl; /* cyz specific */
502 int irq; 503 int irq;
503 unsigned int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */ 504 unsigned int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */
504 unsigned int first_line; /* minor number of first channel on card */ 505 unsigned int first_line; /* minor number of first channel on card */
@@ -541,6 +542,15 @@ struct cyclades_port {
541 int magic; 542 int magic;
542 struct tty_port port; 543 struct tty_port port;
543 struct cyclades_card *card; 544 struct cyclades_card *card;
545 union {
546 struct {
547 void __iomem *base_addr;
548 } cyy;
549 struct {
550 struct CH_CTRL __iomem *ch_ctrl;
551 struct BUF_CTRL __iomem *buf_ctrl;
552 } cyz;
553 } u;
544 int line; 554 int line;
545 int flags; /* defined in tty.h */ 555 int flags; /* defined in tty.h */
546 int type; /* UART type */ 556 int type; /* UART type */
@@ -568,7 +578,6 @@ struct cyclades_port {
568 struct cyclades_idle_stats idle_stats; 578 struct cyclades_idle_stats idle_stats;
569 struct cyclades_icount icount; 579 struct cyclades_icount icount;
570 struct completion shutdown_wait; 580 struct completion shutdown_wait;
571 wait_queue_head_t delta_msr_wait;
572 int throttle; 581 int throttle;
573}; 582};
574 583
diff --git a/include/linux/dca.h b/include/linux/dca.h
index 9c20c7e87d0a..d27a7a05718d 100644
--- a/include/linux/dca.h
+++ b/include/linux/dca.h
@@ -20,6 +20,9 @@
20 */ 20 */
21#ifndef DCA_H 21#ifndef DCA_H
22#define DCA_H 22#define DCA_H
23
24#include <linux/pci.h>
25
23/* DCA Provider API */ 26/* DCA Provider API */
24 27
25/* DCA Notifier Interface */ 28/* DCA Notifier Interface */
@@ -36,6 +39,12 @@ struct dca_provider {
36 int id; 39 int id;
37}; 40};
38 41
42struct dca_domain {
43 struct list_head node;
44 struct list_head dca_providers;
45 struct pci_bus *pci_rc;
46};
47
39struct dca_ops { 48struct dca_ops {
40 int (*add_requester) (struct dca_provider *, struct device *); 49 int (*add_requester) (struct dca_provider *, struct device *);
41 int (*remove_requester) (struct dca_provider *, struct device *); 50 int (*remove_requester) (struct dca_provider *, struct device *);
@@ -47,7 +56,7 @@ struct dca_ops {
47struct dca_provider *alloc_dca_provider(struct dca_ops *ops, int priv_size); 56struct dca_provider *alloc_dca_provider(struct dca_ops *ops, int priv_size);
48void free_dca_provider(struct dca_provider *dca); 57void free_dca_provider(struct dca_provider *dca);
49int register_dca_provider(struct dca_provider *dca, struct device *dev); 58int register_dca_provider(struct dca_provider *dca, struct device *dev);
50void unregister_dca_provider(struct dca_provider *dca); 59void unregister_dca_provider(struct dca_provider *dca, struct device *dev);
51 60
52static inline void *dca_priv(struct dca_provider *dca) 61static inline void *dca_priv(struct dca_provider *dca)
53{ 62{
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
index 7d2e10006188..b7cdbb4373df 100644
--- a/include/linux/dcbnl.h
+++ b/include/linux/dcbnl.h
@@ -50,6 +50,8 @@ struct dcbmsg {
50 * @DCB_CMD_SNUMTCS: set the number of traffic classes 50 * @DCB_CMD_SNUMTCS: set the number of traffic classes
51 * @DCB_CMD_GBCN: set backward congestion notification configuration 51 * @DCB_CMD_GBCN: set backward congestion notification configuration
52 * @DCB_CMD_SBCN: get backward congestion notification configration. 52 * @DCB_CMD_SBCN: get backward congestion notification configration.
53 * @DCB_CMD_GAPP: get application protocol configuration
54 * @DCB_CMD_SAPP: set application protocol configuration
53 */ 55 */
54enum dcbnl_commands { 56enum dcbnl_commands {
55 DCB_CMD_UNDEFINED, 57 DCB_CMD_UNDEFINED,
@@ -80,6 +82,9 @@ enum dcbnl_commands {
80 DCB_CMD_BCN_GCFG, 82 DCB_CMD_BCN_GCFG,
81 DCB_CMD_BCN_SCFG, 83 DCB_CMD_BCN_SCFG,
82 84
85 DCB_CMD_GAPP,
86 DCB_CMD_SAPP,
87
83 __DCB_CMD_ENUM_MAX, 88 __DCB_CMD_ENUM_MAX,
84 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1, 89 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1,
85}; 90};
@@ -114,6 +119,7 @@ enum dcbnl_attrs {
114 DCB_ATTR_CAP, 119 DCB_ATTR_CAP,
115 DCB_ATTR_NUMTCS, 120 DCB_ATTR_NUMTCS,
116 DCB_ATTR_BCN, 121 DCB_ATTR_BCN,
122 DCB_ATTR_APP,
117 123
118 __DCB_ATTR_ENUM_MAX, 124 __DCB_ATTR_ENUM_MAX,
119 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1, 125 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1,
@@ -338,5 +344,17 @@ enum dcb_general_attr_values {
338 DCB_ATTR_VALUE_UNDEFINED = 0xff 344 DCB_ATTR_VALUE_UNDEFINED = 0xff
339}; 345};
340 346
347#define DCB_APP_IDTYPE_ETHTYPE 0x00
348#define DCB_APP_IDTYPE_PORTNUM 0x01
349enum dcbnl_app_attrs {
350 DCB_APP_ATTR_UNDEFINED,
351
352 DCB_APP_ATTR_IDTYPE,
353 DCB_APP_ATTR_ID,
354 DCB_APP_ATTR_PRIORITY,
355
356 __DCB_APP_ATTR_ENUM_MAX,
357 DCB_APP_ATTR_MAX = __DCB_APP_ATTR_ENUM_MAX - 1,
358};
341 359
342#endif /* __LINUX_DCBNL_H__ */ 360#endif /* __LINUX_DCBNL_H__ */
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index eb5c2ba2f81a..fc1b930f246c 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -9,7 +9,7 @@
9 * 2 as published by the Free Software Foundation. 9 * 2 as published by the Free Software Foundation.
10 * 10 *
11 * debugfs is for people to use instead of /proc or /sys. 11 * debugfs is for people to use instead of /proc or /sys.
12 * See Documentation/DocBook/kernel-api for more details. 12 * See Documentation/DocBook/filesystems for more details.
13 */ 13 */
14 14
15#ifndef _DEBUGFS_H_ 15#ifndef _DEBUGFS_H_
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h
index f352f06fa063..5076fe0c8a96 100644
--- a/include/linux/delayacct.h
+++ b/include/linux/delayacct.h
@@ -18,7 +18,6 @@
18#define _LINUX_DELAYACCT_H 18#define _LINUX_DELAYACCT_H
19 19
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/taskstats_kern.h>
22 21
23/* 22/*
24 * Per-task flags relevant to delay accounting 23 * Per-task flags relevant to delay accounting
diff --git a/include/linux/device.h b/include/linux/device.h
index aebb81036db2..2ea3e4921812 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -2,7 +2,8 @@
2 * device.h - generic, centralized driver model 2 * device.h - generic, centralized driver model
3 * 3 *
4 * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org> 4 * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org>
5 * Copyright (c) 2004-2007 Greg Kroah-Hartman <gregkh@suse.de> 5 * Copyright (c) 2004-2009 Greg Kroah-Hartman <gregkh@suse.de>
6 * Copyright (c) 2008-2009 Novell Inc.
6 * 7 *
7 * This file is released under the GPLv2 8 * This file is released under the GPLv2
8 * 9 *
@@ -62,7 +63,7 @@ struct bus_type {
62 int (*suspend)(struct device *dev, pm_message_t state); 63 int (*suspend)(struct device *dev, pm_message_t state);
63 int (*resume)(struct device *dev); 64 int (*resume)(struct device *dev);
64 65
65 struct dev_pm_ops *pm; 66 const struct dev_pm_ops *pm;
66 67
67 struct bus_type_private *p; 68 struct bus_type_private *p;
68}; 69};
@@ -123,16 +124,18 @@ struct device_driver {
123 struct bus_type *bus; 124 struct bus_type *bus;
124 125
125 struct module *owner; 126 struct module *owner;
126 const char *mod_name; /* used for built-in modules */ 127 const char *mod_name; /* used for built-in modules */
128
129 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */
127 130
128 int (*probe) (struct device *dev); 131 int (*probe) (struct device *dev);
129 int (*remove) (struct device *dev); 132 int (*remove) (struct device *dev);
130 void (*shutdown) (struct device *dev); 133 void (*shutdown) (struct device *dev);
131 int (*suspend) (struct device *dev, pm_message_t state); 134 int (*suspend) (struct device *dev, pm_message_t state);
132 int (*resume) (struct device *dev); 135 int (*resume) (struct device *dev);
133 struct attribute_group **groups; 136 const struct attribute_group **groups;
134 137
135 struct dev_pm_ops *pm; 138 const struct dev_pm_ops *pm;
136 139
137 struct driver_private *p; 140 struct driver_private *p;
138}; 141};
@@ -192,7 +195,7 @@ struct class {
192 struct kobject *dev_kobj; 195 struct kobject *dev_kobj;
193 196
194 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 197 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
195 char *(*nodename)(struct device *dev); 198 char *(*devnode)(struct device *dev, mode_t *mode);
196 199
197 void (*class_release)(struct class *class); 200 void (*class_release)(struct class *class);
198 void (*dev_release)(struct device *dev); 201 void (*dev_release)(struct device *dev);
@@ -200,7 +203,8 @@ struct class {
200 int (*suspend)(struct device *dev, pm_message_t state); 203 int (*suspend)(struct device *dev, pm_message_t state);
201 int (*resume)(struct device *dev); 204 int (*resume)(struct device *dev);
202 205
203 struct dev_pm_ops *pm; 206 const struct dev_pm_ops *pm;
207
204 struct class_private *p; 208 struct class_private *p;
205}; 209};
206 210
@@ -223,6 +227,14 @@ extern void class_unregister(struct class *class);
223 __class_register(class, &__key); \ 227 __class_register(class, &__key); \
224}) 228})
225 229
230struct class_compat;
231struct class_compat *class_compat_register(const char *name);
232void class_compat_unregister(struct class_compat *cls);
233int class_compat_create_link(struct class_compat *cls, struct device *dev,
234 struct device *device_link);
235void class_compat_remove_link(struct class_compat *cls, struct device *dev,
236 struct device *device_link);
237
226extern void class_dev_iter_init(struct class_dev_iter *iter, 238extern void class_dev_iter_init(struct class_dev_iter *iter,
227 struct class *class, 239 struct class *class,
228 struct device *start, 240 struct device *start,
@@ -286,12 +298,12 @@ extern void class_destroy(struct class *cls);
286 */ 298 */
287struct device_type { 299struct device_type {
288 const char *name; 300 const char *name;
289 struct attribute_group **groups; 301 const struct attribute_group **groups;
290 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 302 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
291 char *(*nodename)(struct device *dev); 303 char *(*devnode)(struct device *dev, mode_t *mode);
292 void (*release)(struct device *dev); 304 void (*release)(struct device *dev);
293 305
294 struct dev_pm_ops *pm; 306 const struct dev_pm_ops *pm;
295}; 307};
296 308
297/* interface for exporting device attributes */ 309/* interface for exporting device attributes */
@@ -380,7 +392,6 @@ struct device {
380 struct bus_type *bus; /* type of bus device is on */ 392 struct bus_type *bus; /* type of bus device is on */
381 struct device_driver *driver; /* which driver has allocated this 393 struct device_driver *driver; /* which driver has allocated this
382 device */ 394 device */
383 void *driver_data; /* data private to the driver */
384 void *platform_data; /* Platform specific data, device 395 void *platform_data; /* Platform specific data, device
385 core doesn't touch it */ 396 core doesn't touch it */
386 struct dev_pm_info power; 397 struct dev_pm_info power;
@@ -411,7 +422,7 @@ struct device {
411 422
412 struct klist_node knode_class; 423 struct klist_node knode_class;
413 struct class *class; 424 struct class *class;
414 struct attribute_group **groups; /* optional groups */ 425 const struct attribute_group **groups; /* optional groups */
415 426
416 void (*release)(struct device *dev); 427 void (*release)(struct device *dev);
417}; 428};
@@ -446,16 +457,6 @@ static inline void set_dev_node(struct device *dev, int node)
446} 457}
447#endif 458#endif
448 459
449static inline void *dev_get_drvdata(const struct device *dev)
450{
451 return dev->driver_data;
452}
453
454static inline void dev_set_drvdata(struct device *dev, void *data)
455{
456 dev->driver_data = data;
457}
458
459static inline unsigned int dev_get_uevent_suppress(const struct device *dev) 460static inline unsigned int dev_get_uevent_suppress(const struct device *dev)
460{ 461{
461 return dev->kobj.uevent_suppress; 462 return dev->kobj.uevent_suppress;
@@ -488,7 +489,10 @@ extern struct device *device_find_child(struct device *dev, void *data,
488extern int device_rename(struct device *dev, char *new_name); 489extern int device_rename(struct device *dev, char *new_name);
489extern int device_move(struct device *dev, struct device *new_parent, 490extern int device_move(struct device *dev, struct device *new_parent,
490 enum dpm_order dpm_order); 491 enum dpm_order dpm_order);
491extern const char *device_get_nodename(struct device *dev, const char **tmp); 492extern const char *device_get_devnode(struct device *dev,
493 mode_t *mode, const char **tmp);
494extern void *dev_get_drvdata(const struct device *dev);
495extern void dev_set_drvdata(struct device *dev, void *data);
492 496
493/* 497/*
494 * Root device objects for grouping under /sys/devices 498 * Root device objects for grouping under /sys/devices
@@ -501,6 +505,11 @@ static inline struct device *root_device_register(const char *name)
501} 505}
502extern void root_device_unregister(struct device *root); 506extern void root_device_unregister(struct device *root);
503 507
508static inline void *dev_get_platdata(const struct device *dev)
509{
510 return dev->platform_data;
511}
512
504/* 513/*
505 * Manual binding of a device to driver. See drivers/base/bus.c 514 * Manual binding of a device to driver. See drivers/base/bus.c
506 * for information on use. 515 * for information on use.
@@ -546,6 +555,16 @@ extern void put_device(struct device *dev);
546 555
547extern void wait_for_device_probe(void); 556extern void wait_for_device_probe(void);
548 557
558#ifdef CONFIG_DEVTMPFS
559extern int devtmpfs_create_node(struct device *dev);
560extern int devtmpfs_delete_node(struct device *dev);
561extern int devtmpfs_mount(const char *mountpoint);
562#else
563static inline int devtmpfs_create_node(struct device *dev) { return 0; }
564static inline int devtmpfs_delete_node(struct device *dev) { return 0; }
565static inline int devtmpfs_mount(const char *mountpoint) { return 0; }
566#endif
567
549/* drivers/base/power/shutdown.c */ 568/* drivers/base/power/shutdown.c */
550extern void device_shutdown(void); 569extern void device_shutdown(void);
551 570
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 07dfd460d286..91b761846061 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -58,6 +58,7 @@ struct dma_map_ops {
58 enum dma_data_direction dir); 58 enum dma_data_direction dir);
59 int (*mapping_error)(struct device *dev, dma_addr_t dma_addr); 59 int (*mapping_error)(struct device *dev, dma_addr_t dma_addr);
60 int (*dma_supported)(struct device *dev, u64 mask); 60 int (*dma_supported)(struct device *dev, u64 mask);
61 int (*set_dma_mask)(struct device *dev, u64 mask);
61 int is_phys; 62 int is_phys;
62}; 63};
63 64
@@ -98,11 +99,6 @@ static inline int is_device_dma_capable(struct device *dev)
98 return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE; 99 return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE;
99} 100}
100 101
101static inline int is_buffer_dma_capable(u64 mask, dma_addr_t addr, size_t size)
102{
103 return addr + size <= mask;
104}
105
106#ifdef CONFIG_HAS_DMA 102#ifdef CONFIG_HAS_DMA
107#include <asm/dma-mapping.h> 103#include <asm/dma-mapping.h>
108#else 104#else
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index ffefba81c818..2b9f2ac7ed60 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -48,19 +48,20 @@ enum dma_status {
48 48
49/** 49/**
50 * enum dma_transaction_type - DMA transaction types/indexes 50 * enum dma_transaction_type - DMA transaction types/indexes
51 *
52 * Note: The DMA_ASYNC_TX capability is not to be set by drivers. It is
53 * automatically set as dma devices are registered.
51 */ 54 */
52enum dma_transaction_type { 55enum dma_transaction_type {
53 DMA_MEMCPY, 56 DMA_MEMCPY,
54 DMA_XOR, 57 DMA_XOR,
55 DMA_PQ_XOR, 58 DMA_PQ,
56 DMA_DUAL_XOR, 59 DMA_XOR_VAL,
57 DMA_PQ_UPDATE, 60 DMA_PQ_VAL,
58 DMA_ZERO_SUM,
59 DMA_PQ_ZERO_SUM,
60 DMA_MEMSET, 61 DMA_MEMSET,
61 DMA_MEMCPY_CRC32C,
62 DMA_INTERRUPT, 62 DMA_INTERRUPT,
63 DMA_PRIVATE, 63 DMA_PRIVATE,
64 DMA_ASYNC_TX,
64 DMA_SLAVE, 65 DMA_SLAVE,
65}; 66};
66 67
@@ -70,18 +71,25 @@ enum dma_transaction_type {
70 71
71/** 72/**
72 * enum dma_ctrl_flags - DMA flags to augment operation preparation, 73 * enum dma_ctrl_flags - DMA flags to augment operation preparation,
73 * control completion, and communicate status. 74 * control completion, and communicate status.
74 * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of 75 * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of
75 * this transaction 76 * this transaction
76 * @DMA_CTRL_ACK - the descriptor cannot be reused until the client 77 * @DMA_CTRL_ACK - the descriptor cannot be reused until the client
77 * acknowledges receipt, i.e. has has a chance to establish any 78 * acknowledges receipt, i.e. has has a chance to establish any dependency
78 * dependency chains 79 * chains
79 * @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s) 80 * @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s)
80 * @DMA_COMPL_SKIP_DEST_UNMAP - set to disable dma-unmapping the destination(s) 81 * @DMA_COMPL_SKIP_DEST_UNMAP - set to disable dma-unmapping the destination(s)
81 * @DMA_COMPL_SRC_UNMAP_SINGLE - set to do the source dma-unmapping as single 82 * @DMA_COMPL_SRC_UNMAP_SINGLE - set to do the source dma-unmapping as single
82 * (if not set, do the source dma-unmapping as page) 83 * (if not set, do the source dma-unmapping as page)
83 * @DMA_COMPL_DEST_UNMAP_SINGLE - set to do the destination dma-unmapping as single 84 * @DMA_COMPL_DEST_UNMAP_SINGLE - set to do the destination dma-unmapping as single
84 * (if not set, do the destination dma-unmapping as page) 85 * (if not set, do the destination dma-unmapping as page)
86 * @DMA_PREP_PQ_DISABLE_P - prevent generation of P while generating Q
87 * @DMA_PREP_PQ_DISABLE_Q - prevent generation of Q while generating P
88 * @DMA_PREP_CONTINUE - indicate to a driver that it is reusing buffers as
89 * sources that were the result of a previous operation, in the case of a PQ
90 * operation it continues the calculation with new sources
91 * @DMA_PREP_FENCE - tell the driver that subsequent operations depend
92 * on the result of this operation
85 */ 93 */
86enum dma_ctrl_flags { 94enum dma_ctrl_flags {
87 DMA_PREP_INTERRUPT = (1 << 0), 95 DMA_PREP_INTERRUPT = (1 << 0),
@@ -90,9 +98,32 @@ enum dma_ctrl_flags {
90 DMA_COMPL_SKIP_DEST_UNMAP = (1 << 3), 98 DMA_COMPL_SKIP_DEST_UNMAP = (1 << 3),
91 DMA_COMPL_SRC_UNMAP_SINGLE = (1 << 4), 99 DMA_COMPL_SRC_UNMAP_SINGLE = (1 << 4),
92 DMA_COMPL_DEST_UNMAP_SINGLE = (1 << 5), 100 DMA_COMPL_DEST_UNMAP_SINGLE = (1 << 5),
101 DMA_PREP_PQ_DISABLE_P = (1 << 6),
102 DMA_PREP_PQ_DISABLE_Q = (1 << 7),
103 DMA_PREP_CONTINUE = (1 << 8),
104 DMA_PREP_FENCE = (1 << 9),
93}; 105};
94 106
95/** 107/**
108 * enum sum_check_bits - bit position of pq_check_flags
109 */
110enum sum_check_bits {
111 SUM_CHECK_P = 0,
112 SUM_CHECK_Q = 1,
113};
114
115/**
116 * enum pq_check_flags - result of async_{xor,pq}_zero_sum operations
117 * @SUM_CHECK_P_RESULT - 1 if xor zero sum error, 0 otherwise
118 * @SUM_CHECK_Q_RESULT - 1 if reed-solomon zero sum error, 0 otherwise
119 */
120enum sum_check_flags {
121 SUM_CHECK_P_RESULT = (1 << SUM_CHECK_P),
122 SUM_CHECK_Q_RESULT = (1 << SUM_CHECK_Q),
123};
124
125
126/**
96 * dma_cap_mask_t - capabilities bitmap modeled after cpumask_t. 127 * dma_cap_mask_t - capabilities bitmap modeled after cpumask_t.
97 * See linux/cpumask.h 128 * See linux/cpumask.h
98 */ 129 */
@@ -180,8 +211,6 @@ typedef void (*dma_async_tx_callback)(void *dma_async_param);
180 * @flags: flags to augment operation preparation, control completion, and 211 * @flags: flags to augment operation preparation, control completion, and
181 * communicate status 212 * communicate status
182 * @phys: physical address of the descriptor 213 * @phys: physical address of the descriptor
183 * @tx_list: driver common field for operations that require multiple
184 * descriptors
185 * @chan: target channel for this operation 214 * @chan: target channel for this operation
186 * @tx_submit: set the prepared descriptor(s) to be executed by the engine 215 * @tx_submit: set the prepared descriptor(s) to be executed by the engine
187 * @callback: routine to call after this operation is complete 216 * @callback: routine to call after this operation is complete
@@ -195,7 +224,6 @@ struct dma_async_tx_descriptor {
195 dma_cookie_t cookie; 224 dma_cookie_t cookie;
196 enum dma_ctrl_flags flags; /* not a 'long' to pack with cookie */ 225 enum dma_ctrl_flags flags; /* not a 'long' to pack with cookie */
197 dma_addr_t phys; 226 dma_addr_t phys;
198 struct list_head tx_list;
199 struct dma_chan *chan; 227 struct dma_chan *chan;
200 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx); 228 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx);
201 dma_async_tx_callback callback; 229 dma_async_tx_callback callback;
@@ -213,6 +241,11 @@ struct dma_async_tx_descriptor {
213 * @global_node: list_head for global dma_device_list 241 * @global_node: list_head for global dma_device_list
214 * @cap_mask: one or more dma_capability flags 242 * @cap_mask: one or more dma_capability flags
215 * @max_xor: maximum number of xor sources, 0 if no capability 243 * @max_xor: maximum number of xor sources, 0 if no capability
244 * @max_pq: maximum number of PQ sources and PQ-continue capability
245 * @copy_align: alignment shift for memcpy operations
246 * @xor_align: alignment shift for xor operations
247 * @pq_align: alignment shift for pq operations
248 * @fill_align: alignment shift for memset operations
216 * @dev_id: unique device ID 249 * @dev_id: unique device ID
217 * @dev: struct device reference for dma mapping api 250 * @dev: struct device reference for dma mapping api
218 * @device_alloc_chan_resources: allocate resources and return the 251 * @device_alloc_chan_resources: allocate resources and return the
@@ -220,7 +253,9 @@ struct dma_async_tx_descriptor {
220 * @device_free_chan_resources: release DMA channel's resources 253 * @device_free_chan_resources: release DMA channel's resources
221 * @device_prep_dma_memcpy: prepares a memcpy operation 254 * @device_prep_dma_memcpy: prepares a memcpy operation
222 * @device_prep_dma_xor: prepares a xor operation 255 * @device_prep_dma_xor: prepares a xor operation
223 * @device_prep_dma_zero_sum: prepares a zero_sum operation 256 * @device_prep_dma_xor_val: prepares a xor validation operation
257 * @device_prep_dma_pq: prepares a pq operation
258 * @device_prep_dma_pq_val: prepares a pqzero_sum operation
224 * @device_prep_dma_memset: prepares a memset operation 259 * @device_prep_dma_memset: prepares a memset operation
225 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation 260 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation
226 * @device_prep_slave_sg: prepares a slave dma operation 261 * @device_prep_slave_sg: prepares a slave dma operation
@@ -235,7 +270,13 @@ struct dma_device {
235 struct list_head channels; 270 struct list_head channels;
236 struct list_head global_node; 271 struct list_head global_node;
237 dma_cap_mask_t cap_mask; 272 dma_cap_mask_t cap_mask;
238 int max_xor; 273 unsigned short max_xor;
274 unsigned short max_pq;
275 u8 copy_align;
276 u8 xor_align;
277 u8 pq_align;
278 u8 fill_align;
279 #define DMA_HAS_PQ_CONTINUE (1 << 15)
239 280
240 int dev_id; 281 int dev_id;
241 struct device *dev; 282 struct device *dev;
@@ -249,9 +290,17 @@ struct dma_device {
249 struct dma_async_tx_descriptor *(*device_prep_dma_xor)( 290 struct dma_async_tx_descriptor *(*device_prep_dma_xor)(
250 struct dma_chan *chan, dma_addr_t dest, dma_addr_t *src, 291 struct dma_chan *chan, dma_addr_t dest, dma_addr_t *src,
251 unsigned int src_cnt, size_t len, unsigned long flags); 292 unsigned int src_cnt, size_t len, unsigned long flags);
252 struct dma_async_tx_descriptor *(*device_prep_dma_zero_sum)( 293 struct dma_async_tx_descriptor *(*device_prep_dma_xor_val)(
253 struct dma_chan *chan, dma_addr_t *src, unsigned int src_cnt, 294 struct dma_chan *chan, dma_addr_t *src, unsigned int src_cnt,
254 size_t len, u32 *result, unsigned long flags); 295 size_t len, enum sum_check_flags *result, unsigned long flags);
296 struct dma_async_tx_descriptor *(*device_prep_dma_pq)(
297 struct dma_chan *chan, dma_addr_t *dst, dma_addr_t *src,
298 unsigned int src_cnt, const unsigned char *scf,
299 size_t len, unsigned long flags);
300 struct dma_async_tx_descriptor *(*device_prep_dma_pq_val)(
301 struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src,
302 unsigned int src_cnt, const unsigned char *scf, size_t len,
303 enum sum_check_flags *pqres, unsigned long flags);
255 struct dma_async_tx_descriptor *(*device_prep_dma_memset)( 304 struct dma_async_tx_descriptor *(*device_prep_dma_memset)(
256 struct dma_chan *chan, dma_addr_t dest, int value, size_t len, 305 struct dma_chan *chan, dma_addr_t dest, int value, size_t len,
257 unsigned long flags); 306 unsigned long flags);
@@ -270,6 +319,96 @@ struct dma_device {
270 void (*device_issue_pending)(struct dma_chan *chan); 319 void (*device_issue_pending)(struct dma_chan *chan);
271}; 320};
272 321
322static inline bool dmaengine_check_align(u8 align, size_t off1, size_t off2, size_t len)
323{
324 size_t mask;
325
326 if (!align)
327 return true;
328 mask = (1 << align) - 1;
329 if (mask & (off1 | off2 | len))
330 return false;
331 return true;
332}
333
334static inline bool is_dma_copy_aligned(struct dma_device *dev, size_t off1,
335 size_t off2, size_t len)
336{
337 return dmaengine_check_align(dev->copy_align, off1, off2, len);
338}
339
340static inline bool is_dma_xor_aligned(struct dma_device *dev, size_t off1,
341 size_t off2, size_t len)
342{
343 return dmaengine_check_align(dev->xor_align, off1, off2, len);
344}
345
346static inline bool is_dma_pq_aligned(struct dma_device *dev, size_t off1,
347 size_t off2, size_t len)
348{
349 return dmaengine_check_align(dev->pq_align, off1, off2, len);
350}
351
352static inline bool is_dma_fill_aligned(struct dma_device *dev, size_t off1,
353 size_t off2, size_t len)
354{
355 return dmaengine_check_align(dev->fill_align, off1, off2, len);
356}
357
358static inline void
359dma_set_maxpq(struct dma_device *dma, int maxpq, int has_pq_continue)
360{
361 dma->max_pq = maxpq;
362 if (has_pq_continue)
363 dma->max_pq |= DMA_HAS_PQ_CONTINUE;
364}
365
366static inline bool dmaf_continue(enum dma_ctrl_flags flags)
367{
368 return (flags & DMA_PREP_CONTINUE) == DMA_PREP_CONTINUE;
369}
370
371static inline bool dmaf_p_disabled_continue(enum dma_ctrl_flags flags)
372{
373 enum dma_ctrl_flags mask = DMA_PREP_CONTINUE | DMA_PREP_PQ_DISABLE_P;
374
375 return (flags & mask) == mask;
376}
377
378static inline bool dma_dev_has_pq_continue(struct dma_device *dma)
379{
380 return (dma->max_pq & DMA_HAS_PQ_CONTINUE) == DMA_HAS_PQ_CONTINUE;
381}
382
383static unsigned short dma_dev_to_maxpq(struct dma_device *dma)
384{
385 return dma->max_pq & ~DMA_HAS_PQ_CONTINUE;
386}
387
388/* dma_maxpq - reduce maxpq in the face of continued operations
389 * @dma - dma device with PQ capability
390 * @flags - to check if DMA_PREP_CONTINUE and DMA_PREP_PQ_DISABLE_P are set
391 *
392 * When an engine does not support native continuation we need 3 extra
393 * source slots to reuse P and Q with the following coefficients:
394 * 1/ {00} * P : remove P from Q', but use it as a source for P'
395 * 2/ {01} * Q : use Q to continue Q' calculation
396 * 3/ {00} * Q : subtract Q from P' to cancel (2)
397 *
398 * In the case where P is disabled we only need 1 extra source:
399 * 1/ {01} * Q : use Q to continue Q' calculation
400 */
401static inline int dma_maxpq(struct dma_device *dma, enum dma_ctrl_flags flags)
402{
403 if (dma_dev_has_pq_continue(dma) || !dmaf_continue(flags))
404 return dma_dev_to_maxpq(dma);
405 else if (dmaf_p_disabled_continue(flags))
406 return dma_dev_to_maxpq(dma) - 1;
407 else if (dmaf_continue(flags))
408 return dma_dev_to_maxpq(dma) - 3;
409 BUG();
410}
411
273/* --- public DMA engine API --- */ 412/* --- public DMA engine API --- */
274 413
275#ifdef CONFIG_DMA_ENGINE 414#ifdef CONFIG_DMA_ENGINE
@@ -299,7 +438,11 @@ static inline void net_dmaengine_put(void)
299#ifdef CONFIG_ASYNC_TX_DMA 438#ifdef CONFIG_ASYNC_TX_DMA
300#define async_dmaengine_get() dmaengine_get() 439#define async_dmaengine_get() dmaengine_get()
301#define async_dmaengine_put() dmaengine_put() 440#define async_dmaengine_put() dmaengine_put()
441#ifdef CONFIG_ASYNC_TX_DISABLE_CHANNEL_SWITCH
442#define async_dma_find_channel(type) dma_find_channel(DMA_ASYNC_TX)
443#else
302#define async_dma_find_channel(type) dma_find_channel(type) 444#define async_dma_find_channel(type) dma_find_channel(type)
445#endif /* CONFIG_ASYNC_TX_DISABLE_CHANNEL_SWITCH */
303#else 446#else
304static inline void async_dmaengine_get(void) 447static inline void async_dmaengine_get(void)
305{ 448{
@@ -312,7 +455,7 @@ async_dma_find_channel(enum dma_transaction_type type)
312{ 455{
313 return NULL; 456 return NULL;
314} 457}
315#endif 458#endif /* CONFIG_ASYNC_TX_DMA */
316 459
317dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan, 460dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
318 void *dest, void *src, size_t len); 461 void *dest, void *src, size_t len);
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index bb5489c82c99..a8a3e1ac281d 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -43,7 +43,7 @@ extern const char * dmi_get_system_info(int field);
43extern const struct dmi_device * dmi_find_device(int type, const char *name, 43extern const struct dmi_device * dmi_find_device(int type, const char *name,
44 const struct dmi_device *from); 44 const struct dmi_device *from);
45extern void dmi_scan_machine(void); 45extern void dmi_scan_machine(void);
46extern int dmi_get_year(int field); 46extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp);
47extern int dmi_name_in_vendors(const char *str); 47extern int dmi_name_in_vendors(const char *str);
48extern int dmi_name_in_serial(const char *str); 48extern int dmi_name_in_serial(const char *str);
49extern int dmi_available; 49extern int dmi_available;
@@ -58,7 +58,16 @@ static inline const char * dmi_get_system_info(int field) { return NULL; }
58static inline const struct dmi_device * dmi_find_device(int type, const char *name, 58static inline const struct dmi_device * dmi_find_device(int type, const char *name,
59 const struct dmi_device *from) { return NULL; } 59 const struct dmi_device *from) { return NULL; }
60static inline void dmi_scan_machine(void) { return; } 60static inline void dmi_scan_machine(void) { return; }
61static inline int dmi_get_year(int year) { return 0; } 61static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
62{
63 if (yearp)
64 *yearp = 0;
65 if (monthp)
66 *monthp = 0;
67 if (dayp)
68 *dayp = 0;
69 return false;
70}
62static inline int dmi_name_in_vendors(const char *s) { return 0; } 71static inline int dmi_name_in_vendors(const char *s) { return 0; }
63static inline int dmi_name_in_serial(const char *s) { return 0; } 72static inline int dmi_name_in_serial(const char *s) { return 0; }
64#define dmi_available 0 73#define dmi_available 0
diff --git a/include/linux/dtlk.h b/include/linux/dtlk.h
index 2896d90118a9..22a7b9a5f5d1 100644
--- a/include/linux/dtlk.h
+++ b/include/linux/dtlk.h
@@ -1,22 +1,3 @@
1#if 0
2
3#define TRACE_TXT(text) \
4 { \
5 if(dtlk_trace) \
6 { \
7 console_print(text); \
8 console_print("\n"); \
9 } \
10 }
11
12#define TRACE_CHR(chr) \
13 { \
14 if(dtlk_trace) \
15 console_print(chr); \
16 } \
17
18#endif
19
20#define DTLK_MINOR 0 1#define DTLK_MINOR 0
21#define DTLK_IO_EXTENT 0x02 2#define DTLK_IO_EXTENT 0x02
22 3
diff --git a/include/linux/dvb/dmx.h b/include/linux/dvb/dmx.h
index fef943738a24..f078f3ac82d4 100644
--- a/include/linux/dvb/dmx.h
+++ b/include/linux/dvb/dmx.h
@@ -151,5 +151,7 @@ struct dmx_stc {
151#define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t) 151#define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t)
152#define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t) 152#define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t)
153#define DMX_GET_STC _IOWR('o', 50, struct dmx_stc) 153#define DMX_GET_STC _IOWR('o', 50, struct dmx_stc)
154#define DMX_ADD_PID _IOW('o', 51, __u16)
155#define DMX_REMOVE_PID _IOW('o', 52, __u16)
154 156
155#endif /*_DVBDMX_H_*/ 157#endif /*_DVBDMX_H_*/
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index 51c8d2d49e42..b6cb5425cde3 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -173,7 +173,8 @@ typedef enum fe_modulation {
173typedef enum fe_transmit_mode { 173typedef enum fe_transmit_mode {
174 TRANSMISSION_MODE_2K, 174 TRANSMISSION_MODE_2K,
175 TRANSMISSION_MODE_8K, 175 TRANSMISSION_MODE_8K,
176 TRANSMISSION_MODE_AUTO 176 TRANSMISSION_MODE_AUTO,
177 TRANSMISSION_MODE_4K
177} fe_transmit_mode_t; 178} fe_transmit_mode_t;
178 179
179typedef enum fe_bandwidth { 180typedef enum fe_bandwidth {
@@ -268,15 +269,42 @@ struct dvb_frontend_event {
268#define DTV_FE_CAPABILITY 16 269#define DTV_FE_CAPABILITY 16
269#define DTV_DELIVERY_SYSTEM 17 270#define DTV_DELIVERY_SYSTEM 17
270 271
271#define DTV_API_VERSION 35 272/* ISDB-T and ISDB-Tsb */
272#define DTV_API_VERSION 35 273#define DTV_ISDBT_PARTIAL_RECEPTION 18
273#define DTV_CODE_RATE_HP 36 274#define DTV_ISDBT_SOUND_BROADCASTING 19
274#define DTV_CODE_RATE_LP 37
275#define DTV_GUARD_INTERVAL 38
276#define DTV_TRANSMISSION_MODE 39
277#define DTV_HIERARCHY 40
278 275
279#define DTV_MAX_COMMAND DTV_HIERARCHY 276#define DTV_ISDBT_SB_SUBCHANNEL_ID 20
277#define DTV_ISDBT_SB_SEGMENT_IDX 21
278#define DTV_ISDBT_SB_SEGMENT_COUNT 22
279
280#define DTV_ISDBT_LAYERA_FEC 23
281#define DTV_ISDBT_LAYERA_MODULATION 24
282#define DTV_ISDBT_LAYERA_SEGMENT_COUNT 25
283#define DTV_ISDBT_LAYERA_TIME_INTERLEAVING 26
284
285#define DTV_ISDBT_LAYERB_FEC 27
286#define DTV_ISDBT_LAYERB_MODULATION 28
287#define DTV_ISDBT_LAYERB_SEGMENT_COUNT 29
288#define DTV_ISDBT_LAYERB_TIME_INTERLEAVING 30
289
290#define DTV_ISDBT_LAYERC_FEC 31
291#define DTV_ISDBT_LAYERC_MODULATION 32
292#define DTV_ISDBT_LAYERC_SEGMENT_COUNT 33
293#define DTV_ISDBT_LAYERC_TIME_INTERLEAVING 34
294
295#define DTV_API_VERSION 35
296
297#define DTV_CODE_RATE_HP 36
298#define DTV_CODE_RATE_LP 37
299#define DTV_GUARD_INTERVAL 38
300#define DTV_TRANSMISSION_MODE 39
301#define DTV_HIERARCHY 40
302
303#define DTV_ISDBT_LAYER_ENABLED 41
304
305#define DTV_ISDBS_TS_ID 42
306
307#define DTV_MAX_COMMAND DTV_ISDBS_TS_ID
280 308
281typedef enum fe_pilot { 309typedef enum fe_pilot {
282 PILOT_ON, 310 PILOT_ON,
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h
index 25b823b81734..540b0583d9fb 100644
--- a/include/linux/dvb/version.h
+++ b/include/linux/dvb/version.h
@@ -24,6 +24,6 @@
24#define _DVBVERSION_H_ 24#define _DVBVERSION_H_
25 25
26#define DVB_API_VERSION 5 26#define DVB_API_VERSION 5
27#define DVB_API_VERSION_MINOR 0 27#define DVB_API_VERSION_MINOR 1
28 28
29#endif /*_DVBVERSION_H_*/ 29#endif /*_DVBVERSION_H_*/
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 45a937be6d38..90a4ed0ea0e5 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -361,6 +361,7 @@ typedef struct elf64_shdr {
361#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ 361#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
362#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ 362#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
363#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ 363#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
364#define NT_PRXSTATUS 0x300 /* s390 upper register halves */
364 365
365 366
366/* Note header in a PT_NOTE section */ 367/* Note header in a PT_NOTE section */
diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h
index 4332442b1b57..90d1c2184112 100644
--- a/include/linux/enclosure.h
+++ b/include/linux/enclosure.h
@@ -122,8 +122,9 @@ enclosure_component_register(struct enclosure_device *, unsigned int,
122 enum enclosure_component_type, const char *); 122 enum enclosure_component_type, const char *);
123int enclosure_add_device(struct enclosure_device *enclosure, int component, 123int enclosure_add_device(struct enclosure_device *enclosure, int component,
124 struct device *dev); 124 struct device *dev);
125int enclosure_remove_device(struct enclosure_device *enclosure, int component); 125int enclosure_remove_device(struct enclosure_device *, struct device *);
126struct enclosure_device *enclosure_find(struct device *dev); 126struct enclosure_device *enclosure_find(struct device *dev,
127 struct enclosure_device *start);
127int enclosure_for_each_device(int (*fn)(struct enclosure_device *, void *), 128int enclosure_for_each_device(int (*fn)(struct enclosure_device *, void *),
128 void *data); 129 void *data);
129 130
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 9b660bd2e2b3..15e4eb713694 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -362,12 +362,25 @@ struct ethtool_rxnfc {
362 __u32 rule_locs[0]; 362 __u32 rule_locs[0];
363}; 363};
364 364
365#define ETHTOOL_FLASH_MAX_FILENAME 128
366enum ethtool_flash_op_type {
367 ETHTOOL_FLASH_ALL_REGIONS = 0,
368};
369
370/* for passing firmware flashing related parameters */
371struct ethtool_flash {
372 __u32 cmd;
373 __u32 region;
374 char data[ETHTOOL_FLASH_MAX_FILENAME];
375};
376
365#ifdef __KERNEL__ 377#ifdef __KERNEL__
366 378
367struct net_device; 379struct net_device;
368 380
369/* Some generic methods drivers may use in their ethtool_ops */ 381/* Some generic methods drivers may use in their ethtool_ops */
370u32 ethtool_op_get_link(struct net_device *dev); 382u32 ethtool_op_get_link(struct net_device *dev);
383u32 ethtool_op_get_rx_csum(struct net_device *dev);
371u32 ethtool_op_get_tx_csum(struct net_device *dev); 384u32 ethtool_op_get_tx_csum(struct net_device *dev);
372int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); 385int ethtool_op_set_tx_csum(struct net_device *dev, u32 data);
373int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data); 386int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data);
@@ -488,6 +501,7 @@ struct ethtool_ops {
488 int (*get_stats_count)(struct net_device *);/* use get_sset_count */ 501 int (*get_stats_count)(struct net_device *);/* use get_sset_count */
489 int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *); 502 int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *);
490 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); 503 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
504 int (*flash_device)(struct net_device *, struct ethtool_flash *);
491}; 505};
492#endif /* __KERNEL__ */ 506#endif /* __KERNEL__ */
493 507
@@ -544,6 +558,7 @@ struct ethtool_ops {
544#define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */ 558#define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */
545#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */ 559#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */
546#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */ 560#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */
561#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */
547 562
548/* compatibility with older code */ 563/* compatibility with older code */
549#define SPARC_ETH_GSET ETHTOOL_GSET 564#define SPARC_ETH_GSET ETHTOOL_GSET
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index 3b85ba6479f4..94dd10366a78 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -27,6 +27,7 @@
27 27
28#ifdef CONFIG_EVENTFD 28#ifdef CONFIG_EVENTFD
29 29
30struct file *eventfd_file_create(unsigned int count, int flags);
30struct eventfd_ctx *eventfd_ctx_get(struct eventfd_ctx *ctx); 31struct eventfd_ctx *eventfd_ctx_get(struct eventfd_ctx *ctx);
31void eventfd_ctx_put(struct eventfd_ctx *ctx); 32void eventfd_ctx_put(struct eventfd_ctx *ctx);
32struct file *eventfd_fget(int fd); 33struct file *eventfd_fget(int fd);
@@ -40,6 +41,11 @@ int eventfd_signal(struct eventfd_ctx *ctx, int n);
40 * Ugly ugly ugly error layer to support modules that uses eventfd but 41 * Ugly ugly ugly error layer to support modules that uses eventfd but
41 * pretend to work in !CONFIG_EVENTFD configurations. Namely, AIO. 42 * pretend to work in !CONFIG_EVENTFD configurations. Namely, AIO.
42 */ 43 */
44static inline struct file *eventfd_file_create(unsigned int count, int flags)
45{
46 return ERR_PTR(-ENOSYS);
47}
48
43static inline struct eventfd_ctx *eventfd_ctx_fdget(int fd) 49static inline struct eventfd_ctx *eventfd_ctx_fdget(int fd)
44{ 50{
45 return ERR_PTR(-ENOSYS); 51 return ERR_PTR(-ENOSYS);
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h
index ca1bfe90004f..93e7428156ba 100644
--- a/include/linux/ext3_fs_i.h
+++ b/include/linux/ext3_fs_i.h
@@ -137,6 +137,14 @@ struct ext3_inode_info {
137 * by other means, so we have truncate_mutex. 137 * by other means, so we have truncate_mutex.
138 */ 138 */
139 struct mutex truncate_mutex; 139 struct mutex truncate_mutex;
140
141 /*
142 * Transactions that contain inode's metadata needed to complete
143 * fsync and fdatasync, respectively.
144 */
145 atomic_t i_sync_tid;
146 atomic_t i_datasync_tid;
147
140 struct inode vfs_inode; 148 struct inode vfs_inode;
141}; 149};
142 150
diff --git a/include/linux/fb.h b/include/linux/fb.h
index f847df9e99b6..de9c722e7b90 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -133,6 +133,7 @@ struct dentry;
133#define FB_ACCEL_NEOMAGIC_NM2230 96 /* NeoMagic NM2230 */ 133#define FB_ACCEL_NEOMAGIC_NM2230 96 /* NeoMagic NM2230 */
134#define FB_ACCEL_NEOMAGIC_NM2360 97 /* NeoMagic NM2360 */ 134#define FB_ACCEL_NEOMAGIC_NM2360 97 /* NeoMagic NM2360 */
135#define FB_ACCEL_NEOMAGIC_NM2380 98 /* NeoMagic NM2380 */ 135#define FB_ACCEL_NEOMAGIC_NM2380 98 /* NeoMagic NM2380 */
136#define FB_ACCEL_PXA3XX 99 /* PXA3xx */
136 137
137#define FB_ACCEL_SAVAGE4 0x80 /* S3 Savage4 */ 138#define FB_ACCEL_SAVAGE4 0x80 /* S3 Savage4 */
138#define FB_ACCEL_SAVAGE3D 0x81 /* S3 Savage3D */ 139#define FB_ACCEL_SAVAGE3D 0x81 /* S3 Savage3D */
@@ -668,12 +669,6 @@ struct fb_ops {
668 /* perform fb specific mmap */ 669 /* perform fb specific mmap */
669 int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma); 670 int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma);
670 671
671 /* save current hardware state */
672 void (*fb_save_state)(struct fb_info *info);
673
674 /* restore saved state */
675 void (*fb_restore_state)(struct fb_info *info);
676
677 /* get capability given var */ 672 /* get capability given var */
678 void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps, 673 void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps,
679 struct fb_var_screeninfo *var); 674 struct fb_var_screeninfo *var);
diff --git a/include/linux/fips.h b/include/linux/fips.h
new file mode 100644
index 000000000000..f8fb07b0b6b8
--- /dev/null
+++ b/include/linux/fips.h
@@ -0,0 +1,10 @@
1#ifndef _FIPS_H
2#define _FIPS_H
3
4#ifdef CONFIG_CRYPTO_FIPS
5extern int fips_enabled;
6#else
7#define fips_enabled 0
8#endif
9
10#endif
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 192d1e43c43c..7e1d4dec83e7 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -134,20 +134,6 @@ struct fw_card {
134 u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4]; 134 u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];
135}; 135};
136 136
137static inline struct fw_card *fw_card_get(struct fw_card *card)
138{
139 kref_get(&card->kref);
140
141 return card;
142}
143
144void fw_card_release(struct kref *kref);
145
146static inline void fw_card_put(struct fw_card *card)
147{
148 kref_put(&card->kref, fw_card_release);
149}
150
151struct fw_attribute_group { 137struct fw_attribute_group {
152 struct attribute_group *groups[2]; 138 struct attribute_group *groups[2];
153 struct attribute_group group; 139 struct attribute_group group;
diff --git a/include/linux/flex_array.h b/include/linux/flex_array.h
index 45ff18491514..1d747f72298b 100644
--- a/include/linux/flex_array.h
+++ b/include/linux/flex_array.h
@@ -31,10 +31,32 @@ struct flex_array {
31 }; 31 };
32}; 32};
33 33
34#define FLEX_ARRAY_INIT(size, total) { { {\ 34/* Number of bytes left in base struct flex_array, excluding metadata */
35 .element_size = (size), \ 35#define FLEX_ARRAY_BASE_BYTES_LEFT \
36 .total_nr_elements = (total), \ 36 (FLEX_ARRAY_BASE_SIZE - offsetof(struct flex_array, parts))
37} } } 37
38/* Number of pointers in base to struct flex_array_part pages */
39#define FLEX_ARRAY_NR_BASE_PTRS \
40 (FLEX_ARRAY_BASE_BYTES_LEFT / sizeof(struct flex_array_part *))
41
42/* Number of elements of size that fit in struct flex_array_part */
43#define FLEX_ARRAY_ELEMENTS_PER_PART(size) \
44 (FLEX_ARRAY_PART_SIZE / size)
45
46/*
47 * Defines a statically allocated flex array and ensures its parameters are
48 * valid.
49 */
50#define DEFINE_FLEX_ARRAY(__arrayname, __element_size, __total) \
51 struct flex_array __arrayname = { { { \
52 .element_size = (__element_size), \
53 .total_nr_elements = (__total), \
54 } } }; \
55 static inline void __arrayname##_invalid_parameter(void) \
56 { \
57 BUILD_BUG_ON((__total) > FLEX_ARRAY_NR_BASE_PTRS * \
58 FLEX_ARRAY_ELEMENTS_PER_PART(__element_size)); \
59 }
38 60
39struct flex_array *flex_array_alloc(int element_size, unsigned int total, 61struct flex_array *flex_array_alloc(int element_size, unsigned int total,
40 gfp_t flags); 62 gfp_t flags);
@@ -44,6 +66,8 @@ void flex_array_free(struct flex_array *fa);
44void flex_array_free_parts(struct flex_array *fa); 66void flex_array_free_parts(struct flex_array *fa);
45int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, 67int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src,
46 gfp_t flags); 68 gfp_t flags);
69int flex_array_clear(struct flex_array *fa, unsigned int element_nr);
47void *flex_array_get(struct flex_array *fa, unsigned int element_nr); 70void *flex_array_get(struct flex_array *fa, unsigned int element_nr);
71int flex_array_shrink(struct flex_array *fa);
48 72
49#endif /* _FLEX_ARRAY_H */ 73#endif /* _FLEX_ARRAY_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 73e9b643e455..2620a8c63571 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -161,8 +161,8 @@ struct inodes_stat_t {
161 * These aren't really reads or writes, they pass down information about 161 * These aren't really reads or writes, they pass down information about
162 * parts of device that are now unused by the file system. 162 * parts of device that are now unused by the file system.
163 */ 163 */
164#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) 164#define DISCARD_NOBARRIER (WRITE | (1 << BIO_RW_DISCARD))
165#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER)) 165#define DISCARD_BARRIER (DISCARD_NOBARRIER | (1 << BIO_RW_BARRIER))
166 166
167#define SEL_IN 1 167#define SEL_IN 1
168#define SEL_OUT 2 168#define SEL_OUT 2
@@ -300,6 +300,10 @@ struct inodes_stat_t {
300#define BLKTRACESTOP _IO(0x12,117) 300#define BLKTRACESTOP _IO(0x12,117)
301#define BLKTRACETEARDOWN _IO(0x12,118) 301#define BLKTRACETEARDOWN _IO(0x12,118)
302#define BLKDISCARD _IO(0x12,119) 302#define BLKDISCARD _IO(0x12,119)
303#define BLKIOMIN _IO(0x12,120)
304#define BLKIOOPT _IO(0x12,121)
305#define BLKALIGNOFF _IO(0x12,122)
306#define BLKPBSZGET _IO(0x12,123)
303 307
304#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ 308#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
305#define FIBMAP _IO(0x00,1) /* bmap access */ 309#define FIBMAP _IO(0x00,1) /* bmap access */
@@ -595,6 +599,7 @@ struct address_space_operations {
595 int (*launder_page) (struct page *); 599 int (*launder_page) (struct page *);
596 int (*is_partially_uptodate) (struct page *, read_descriptor_t *, 600 int (*is_partially_uptodate) (struct page *, read_descriptor_t *,
597 unsigned long); 601 unsigned long);
602 int (*error_remove_page)(struct address_space *, struct page *);
598}; 603};
599 604
600/* 605/*
@@ -640,7 +645,6 @@ struct block_device {
640 struct super_block * bd_super; 645 struct super_block * bd_super;
641 int bd_openers; 646 int bd_openers;
642 struct mutex bd_mutex; /* open/close mutex */ 647 struct mutex bd_mutex; /* open/close mutex */
643 struct semaphore bd_mount_sem;
644 struct list_head bd_inodes; 648 struct list_head bd_inodes;
645 void * bd_holder; 649 void * bd_holder;
646 int bd_holders; 650 int bd_holders;
@@ -655,7 +659,6 @@ struct block_device {
655 int bd_invalidated; 659 int bd_invalidated;
656 struct gendisk * bd_disk; 660 struct gendisk * bd_disk;
657 struct list_head bd_list; 661 struct list_head bd_list;
658 struct backing_dev_info *bd_inode_backing_dev_info;
659 /* 662 /*
660 * Private data. You must have bd_claim'ed the block_device 663 * Private data. You must have bd_claim'ed the block_device
661 * to use this. NOTE: bd_claim allows an owner to claim 664 * to use this. NOTE: bd_claim allows an owner to claim
@@ -715,7 +718,7 @@ struct posix_acl;
715 718
716struct inode { 719struct inode {
717 struct hlist_node i_hash; 720 struct hlist_node i_hash;
718 struct list_head i_list; 721 struct list_head i_list; /* backing dev IO list */
719 struct list_head i_sb_list; 722 struct list_head i_sb_list;
720 struct list_head i_dentry; 723 struct list_head i_dentry;
721 unsigned long i_ino; 724 unsigned long i_ino;
@@ -1067,8 +1070,8 @@ struct file_lock {
1067 struct fasync_struct * fl_fasync; /* for lease break notifications */ 1070 struct fasync_struct * fl_fasync; /* for lease break notifications */
1068 unsigned long fl_break_time; /* for nonblocking lease breaks */ 1071 unsigned long fl_break_time; /* for nonblocking lease breaks */
1069 1072
1070 struct file_lock_operations *fl_ops; /* Callbacks for filesystems */ 1073 const struct file_lock_operations *fl_ops; /* Callbacks for filesystems */
1071 struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */ 1074 const struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */
1072 union { 1075 union {
1073 struct nfs_lock_info nfs_fl; 1076 struct nfs_lock_info nfs_fl;
1074 struct nfs4_lock_info nfs4_fl; 1077 struct nfs4_lock_info nfs4_fl;
@@ -1316,11 +1319,11 @@ struct super_block {
1316 unsigned long s_blocksize; 1319 unsigned long s_blocksize;
1317 unsigned char s_blocksize_bits; 1320 unsigned char s_blocksize_bits;
1318 unsigned char s_dirt; 1321 unsigned char s_dirt;
1319 unsigned long long s_maxbytes; /* Max file size */ 1322 loff_t s_maxbytes; /* Max file size */
1320 struct file_system_type *s_type; 1323 struct file_system_type *s_type;
1321 const struct super_operations *s_op; 1324 const struct super_operations *s_op;
1322 struct dquot_operations *dq_op; 1325 const struct dquot_operations *dq_op;
1323 struct quotactl_ops *s_qcop; 1326 const struct quotactl_ops *s_qcop;
1324 const struct export_operations *s_export_op; 1327 const struct export_operations *s_export_op;
1325 unsigned long s_flags; 1328 unsigned long s_flags;
1326 unsigned long s_magic; 1329 unsigned long s_magic;
@@ -1336,9 +1339,6 @@ struct super_block {
1336 struct xattr_handler **s_xattr; 1339 struct xattr_handler **s_xattr;
1337 1340
1338 struct list_head s_inodes; /* all inodes */ 1341 struct list_head s_inodes; /* all inodes */
1339 struct list_head s_dirty; /* dirty inodes */
1340 struct list_head s_io; /* parked for writeback */
1341 struct list_head s_more_io; /* parked for more writeback */
1342 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ 1342 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */
1343 struct list_head s_files; 1343 struct list_head s_files;
1344 /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */ 1344 /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */
@@ -1346,6 +1346,7 @@ struct super_block {
1346 int s_nr_dentry_unused; /* # of dentry on lru */ 1346 int s_nr_dentry_unused; /* # of dentry on lru */
1347 1347
1348 struct block_device *s_bdev; 1348 struct block_device *s_bdev;
1349 struct backing_dev_info *s_bdi;
1349 struct mtd_info *s_mtd; 1350 struct mtd_info *s_mtd;
1350 struct list_head s_instances; 1351 struct list_head s_instances;
1351 struct quota_info s_dquot; /* Diskquota specific options */ 1352 struct quota_info s_dquot; /* Diskquota specific options */
@@ -1458,11 +1459,6 @@ int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags);
1458#define DT_SOCK 12 1459#define DT_SOCK 12
1459#define DT_WHT 14 1460#define DT_WHT 14
1460 1461
1461#define OSYNC_METADATA (1<<0)
1462#define OSYNC_DATA (1<<1)
1463#define OSYNC_INODE (1<<2)
1464int generic_osync_inode(struct inode *, struct address_space *, int);
1465
1466/* 1462/*
1467 * This is the "filldir" function type, used by readdir() to let 1463 * This is the "filldir" function type, used by readdir() to let
1468 * the kernel specify what kind of dirent layout it wants to have. 1464 * the kernel specify what kind of dirent layout it wants to have.
@@ -1528,6 +1524,7 @@ struct inode_operations {
1528 void (*put_link) (struct dentry *, struct nameidata *, void *); 1524 void (*put_link) (struct dentry *, struct nameidata *, void *);
1529 void (*truncate) (struct inode *); 1525 void (*truncate) (struct inode *);
1530 int (*permission) (struct inode *, int); 1526 int (*permission) (struct inode *, int);
1527 int (*check_acl)(struct inode *, int);
1531 int (*setattr) (struct dentry *, struct iattr *); 1528 int (*setattr) (struct dentry *, struct iattr *);
1532 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); 1529 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
1533 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); 1530 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
@@ -1788,6 +1785,7 @@ extern int get_sb_pseudo(struct file_system_type *, char *,
1788 struct vfsmount *mnt); 1785 struct vfsmount *mnt);
1789extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); 1786extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1790int __put_super_and_need_restart(struct super_block *sb); 1787int __put_super_and_need_restart(struct super_block *sb);
1788void put_super(struct super_block *sb);
1791 1789
1792/* Alas, no aliases. Too much hassle with bringing module.h everywhere */ 1790/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
1793#define fops_get(fops) \ 1791#define fops_get(fops) \
@@ -1998,12 +1996,25 @@ extern void bd_release_from_disk(struct block_device *, struct gendisk *);
1998#define CHRDEV_MAJOR_HASH_SIZE 255 1996#define CHRDEV_MAJOR_HASH_SIZE 255
1999extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *); 1997extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *);
2000extern int register_chrdev_region(dev_t, unsigned, const char *); 1998extern int register_chrdev_region(dev_t, unsigned, const char *);
2001extern int register_chrdev(unsigned int, const char *, 1999extern int __register_chrdev(unsigned int major, unsigned int baseminor,
2002 const struct file_operations *); 2000 unsigned int count, const char *name,
2003extern void unregister_chrdev(unsigned int, const char *); 2001 const struct file_operations *fops);
2002extern void __unregister_chrdev(unsigned int major, unsigned int baseminor,
2003 unsigned int count, const char *name);
2004extern void unregister_chrdev_region(dev_t, unsigned); 2004extern void unregister_chrdev_region(dev_t, unsigned);
2005extern void chrdev_show(struct seq_file *,off_t); 2005extern void chrdev_show(struct seq_file *,off_t);
2006 2006
2007static inline int register_chrdev(unsigned int major, const char *name,
2008 const struct file_operations *fops)
2009{
2010 return __register_chrdev(major, 0, 256, name, fops);
2011}
2012
2013static inline void unregister_chrdev(unsigned int major, const char *name)
2014{
2015 __unregister_chrdev(major, 0, 256, name);
2016}
2017
2007/* fs/block_dev.c */ 2018/* fs/block_dev.c */
2008#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ 2019#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */
2009#define BDEVT_SIZE 10 /* Largest string for MAJ:MIN for blkdev */ 2020#define BDEVT_SIZE 10 /* Largest string for MAJ:MIN for blkdev */
@@ -2070,12 +2081,12 @@ static inline void invalidate_remote_inode(struct inode *inode)
2070extern int invalidate_inode_pages2(struct address_space *mapping); 2081extern int invalidate_inode_pages2(struct address_space *mapping);
2071extern int invalidate_inode_pages2_range(struct address_space *mapping, 2082extern int invalidate_inode_pages2_range(struct address_space *mapping,
2072 pgoff_t start, pgoff_t end); 2083 pgoff_t start, pgoff_t end);
2073extern void generic_sync_sb_inodes(struct super_block *sb,
2074 struct writeback_control *wbc);
2075extern int write_inode_now(struct inode *, int); 2084extern int write_inode_now(struct inode *, int);
2076extern int filemap_fdatawrite(struct address_space *); 2085extern int filemap_fdatawrite(struct address_space *);
2077extern int filemap_flush(struct address_space *); 2086extern int filemap_flush(struct address_space *);
2078extern int filemap_fdatawait(struct address_space *); 2087extern int filemap_fdatawait(struct address_space *);
2088extern int filemap_fdatawait_range(struct address_space *, loff_t lstart,
2089 loff_t lend);
2079extern int filemap_write_and_wait(struct address_space *mapping); 2090extern int filemap_write_and_wait(struct address_space *mapping);
2080extern int filemap_write_and_wait_range(struct address_space *mapping, 2091extern int filemap_write_and_wait_range(struct address_space *mapping,
2081 loff_t lstart, loff_t lend); 2092 loff_t lstart, loff_t lend);
@@ -2086,7 +2097,10 @@ extern int __filemap_fdatawrite_range(struct address_space *mapping,
2086extern int filemap_fdatawrite_range(struct address_space *mapping, 2097extern int filemap_fdatawrite_range(struct address_space *mapping,
2087 loff_t start, loff_t end); 2098 loff_t start, loff_t end);
2088 2099
2100extern int vfs_fsync_range(struct file *file, struct dentry *dentry,
2101 loff_t start, loff_t end, int datasync);
2089extern int vfs_fsync(struct file *file, struct dentry *dentry, int datasync); 2102extern int vfs_fsync(struct file *file, struct dentry *dentry, int datasync);
2103extern int generic_write_sync(struct file *file, loff_t pos, loff_t count);
2090extern void sync_supers(void); 2104extern void sync_supers(void);
2091extern void emergency_sync(void); 2105extern void emergency_sync(void);
2092extern void emergency_remount(void); 2106extern void emergency_remount(void);
@@ -2146,6 +2160,7 @@ extern ino_t iunique(struct super_block *, ino_t);
2146extern int inode_needs_sync(struct inode *inode); 2160extern int inode_needs_sync(struct inode *inode);
2147extern void generic_delete_inode(struct inode *inode); 2161extern void generic_delete_inode(struct inode *inode);
2148extern void generic_drop_inode(struct inode *inode); 2162extern void generic_drop_inode(struct inode *inode);
2163extern int generic_detach_inode(struct inode *inode);
2149 2164
2150extern struct inode *ilookup5_nowait(struct super_block *sb, 2165extern struct inode *ilookup5_nowait(struct super_block *sb,
2151 unsigned long hashval, int (*test)(struct inode *, void *), 2166 unsigned long hashval, int (*test)(struct inode *, void *),
@@ -2186,16 +2201,15 @@ extern int bdev_read_only(struct block_device *);
2186extern int set_blocksize(struct block_device *, int); 2201extern int set_blocksize(struct block_device *, int);
2187extern int sb_set_blocksize(struct super_block *, int); 2202extern int sb_set_blocksize(struct super_block *, int);
2188extern int sb_min_blocksize(struct super_block *, int); 2203extern int sb_min_blocksize(struct super_block *, int);
2189extern int sb_has_dirty_inodes(struct super_block *);
2190 2204
2191extern int generic_file_mmap(struct file *, struct vm_area_struct *); 2205extern int generic_file_mmap(struct file *, struct vm_area_struct *);
2192extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); 2206extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
2193extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); 2207extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
2194int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); 2208int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
2195extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); 2209extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t);
2210extern ssize_t __generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long,
2211 loff_t *);
2196extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t); 2212extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t);
2197extern ssize_t generic_file_aio_write_nolock(struct kiocb *, const struct iovec *,
2198 unsigned long, loff_t);
2199extern ssize_t generic_file_direct_write(struct kiocb *, const struct iovec *, 2213extern ssize_t generic_file_direct_write(struct kiocb *, const struct iovec *,
2200 unsigned long *, loff_t, loff_t *, size_t, size_t); 2214 unsigned long *, loff_t, loff_t *, size_t, size_t);
2201extern ssize_t generic_file_buffered_write(struct kiocb *, const struct iovec *, 2215extern ssize_t generic_file_buffered_write(struct kiocb *, const struct iovec *,
@@ -2205,6 +2219,10 @@ extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t l
2205extern int generic_segment_checks(const struct iovec *iov, 2219extern int generic_segment_checks(const struct iovec *iov,
2206 unsigned long *nr_segs, size_t *count, int access_flags); 2220 unsigned long *nr_segs, size_t *count, int access_flags);
2207 2221
2222/* fs/block_dev.c */
2223extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
2224 unsigned long nr_segs, loff_t pos);
2225
2208/* fs/splice.c */ 2226/* fs/splice.c */
2209extern ssize_t generic_file_splice_read(struct file *, loff_t *, 2227extern ssize_t generic_file_splice_read(struct file *, loff_t *,
2210 struct pipe_inode_info *, size_t, unsigned int); 2228 struct pipe_inode_info *, size_t, unsigned int);
@@ -2321,6 +2339,7 @@ extern void get_filesystem(struct file_system_type *fs);
2321extern void put_filesystem(struct file_system_type *fs); 2339extern void put_filesystem(struct file_system_type *fs);
2322extern struct file_system_type *get_fs_type(const char *name); 2340extern struct file_system_type *get_fs_type(const char *name);
2323extern struct super_block *get_super(struct block_device *); 2341extern struct super_block *get_super(struct block_device *);
2342extern struct super_block *get_active_super(struct block_device *bdev);
2324extern struct super_block *user_get_super(dev_t); 2343extern struct super_block *user_get_super(dev_t);
2325extern void drop_super(struct super_block *sb); 2344extern void drop_super(struct super_block *sb);
2326 2345
@@ -2368,7 +2387,8 @@ extern int buffer_migrate_page(struct address_space *,
2368#define buffer_migrate_page NULL 2387#define buffer_migrate_page NULL
2369#endif 2388#endif
2370 2389
2371extern int inode_change_ok(struct inode *, struct iattr *); 2390extern int inode_change_ok(const struct inode *, struct iattr *);
2391extern int inode_newsize_ok(const struct inode *, loff_t offset);
2372extern int __must_check inode_setattr(struct inode *, struct iattr *); 2392extern int __must_check inode_setattr(struct inode *, struct iattr *);
2373 2393
2374extern void file_update_time(struct file *file); 2394extern void file_update_time(struct file *file);
@@ -2430,7 +2450,7 @@ static int __fops ## _open(struct inode *inode, struct file *file) \
2430 __simple_attr_check_format(__fmt, 0ull); \ 2450 __simple_attr_check_format(__fmt, 0ull); \
2431 return simple_attr_open(inode, file, __get, __set, __fmt); \ 2451 return simple_attr_open(inode, file, __get, __set, __fmt); \
2432} \ 2452} \
2433static struct file_operations __fops = { \ 2453static const struct file_operations __fops = { \
2434 .owner = THIS_MODULE, \ 2454 .owner = THIS_MODULE, \
2435 .open = __fops ## _open, \ 2455 .open = __fops ## _open, \
2436 .release = simple_attr_release, \ 2456 .release = simple_attr_release, \
@@ -2454,7 +2474,7 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf,
2454 size_t len, loff_t *ppos); 2474 size_t len, loff_t *ppos);
2455 2475
2456struct ctl_table; 2476struct ctl_table;
2457int proc_nr_files(struct ctl_table *table, int write, struct file *filp, 2477int proc_nr_files(struct ctl_table *table, int write,
2458 void __user *buffer, size_t *lenp, loff_t *ppos); 2478 void __user *buffer, size_t *lenp, loff_t *ppos);
2459 2479
2460int __init get_filesystem_list(char *buf); 2480int __init get_filesystem_list(char *buf);
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index 84d3532dd3ea..7be0c6fbe880 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -91,6 +91,8 @@ struct fscache_operation {
91#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */ 91#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */
92#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */ 92#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */
93#define FSCACHE_OP_DEAD 6 /* op is now dead */ 93#define FSCACHE_OP_DEAD 6 /* op is now dead */
94#define FSCACHE_OP_DEC_READ_CNT 7 /* decrement object->n_reads on destruction */
95#define FSCACHE_OP_KEEP_FLAGS 0xc0 /* flags to keep when repurposing an op */
94 96
95 atomic_t usage; 97 atomic_t usage;
96 unsigned debug_id; /* debugging ID */ 98 unsigned debug_id; /* debugging ID */
@@ -102,6 +104,16 @@ struct fscache_operation {
102 104
103 /* operation releaser */ 105 /* operation releaser */
104 fscache_operation_release_t release; 106 fscache_operation_release_t release;
107
108#ifdef CONFIG_SLOW_WORK_PROC
109 const char *name; /* operation name */
110 const char *state; /* operation state */
111#define fscache_set_op_name(OP, N) do { (OP)->name = (N); } while(0)
112#define fscache_set_op_state(OP, S) do { (OP)->state = (S); } while(0)
113#else
114#define fscache_set_op_name(OP, N) do { } while(0)
115#define fscache_set_op_state(OP, S) do { } while(0)
116#endif
105}; 117};
106 118
107extern atomic_t fscache_op_debug_id; 119extern atomic_t fscache_op_debug_id;
@@ -125,6 +137,7 @@ static inline void fscache_operation_init(struct fscache_operation *op,
125 op->debug_id = atomic_inc_return(&fscache_op_debug_id); 137 op->debug_id = atomic_inc_return(&fscache_op_debug_id);
126 op->release = release; 138 op->release = release;
127 INIT_LIST_HEAD(&op->pend_link); 139 INIT_LIST_HEAD(&op->pend_link);
140 fscache_set_op_state(op, "Init");
128} 141}
129 142
130/** 143/**
@@ -221,8 +234,10 @@ struct fscache_cache_ops {
221 struct fscache_object *(*alloc_object)(struct fscache_cache *cache, 234 struct fscache_object *(*alloc_object)(struct fscache_cache *cache,
222 struct fscache_cookie *cookie); 235 struct fscache_cookie *cookie);
223 236
224 /* look up the object for a cookie */ 237 /* look up the object for a cookie
225 void (*lookup_object)(struct fscache_object *object); 238 * - return -ETIMEDOUT to be requeued
239 */
240 int (*lookup_object)(struct fscache_object *object);
226 241
227 /* finished looking up */ 242 /* finished looking up */
228 void (*lookup_complete)(struct fscache_object *object); 243 void (*lookup_complete)(struct fscache_object *object);
@@ -297,12 +312,14 @@ struct fscache_cookie {
297 atomic_t usage; /* number of users of this cookie */ 312 atomic_t usage; /* number of users of this cookie */
298 atomic_t n_children; /* number of children of this cookie */ 313 atomic_t n_children; /* number of children of this cookie */
299 spinlock_t lock; 314 spinlock_t lock;
315 spinlock_t stores_lock; /* lock on page store tree */
300 struct hlist_head backing_objects; /* object(s) backing this file/index */ 316 struct hlist_head backing_objects; /* object(s) backing this file/index */
301 const struct fscache_cookie_def *def; /* definition */ 317 const struct fscache_cookie_def *def; /* definition */
302 struct fscache_cookie *parent; /* parent of this entry */ 318 struct fscache_cookie *parent; /* parent of this entry */
303 void *netfs_data; /* back pointer to netfs */ 319 void *netfs_data; /* back pointer to netfs */
304 struct radix_tree_root stores; /* pages to be stored on this cookie */ 320 struct radix_tree_root stores; /* pages to be stored on this cookie */
305#define FSCACHE_COOKIE_PENDING_TAG 0 /* pages tag: pending write to cache */ 321#define FSCACHE_COOKIE_PENDING_TAG 0 /* pages tag: pending write to cache */
322#define FSCACHE_COOKIE_STORING_TAG 1 /* pages tag: writing to cache */
306 323
307 unsigned long flags; 324 unsigned long flags;
308#define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */ 325#define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */
@@ -337,6 +354,7 @@ struct fscache_object {
337 FSCACHE_OBJECT_RECYCLING, /* retiring object */ 354 FSCACHE_OBJECT_RECYCLING, /* retiring object */
338 FSCACHE_OBJECT_WITHDRAWING, /* withdrawing object */ 355 FSCACHE_OBJECT_WITHDRAWING, /* withdrawing object */
339 FSCACHE_OBJECT_DEAD, /* object is now dead */ 356 FSCACHE_OBJECT_DEAD, /* object is now dead */
357 FSCACHE_OBJECT__NSTATES
340 } state; 358 } state;
341 359
342 int debug_id; /* debugging ID */ 360 int debug_id; /* debugging ID */
@@ -345,6 +363,7 @@ struct fscache_object {
345 int n_obj_ops; /* number of object ops outstanding on object */ 363 int n_obj_ops; /* number of object ops outstanding on object */
346 int n_in_progress; /* number of ops in progress */ 364 int n_in_progress; /* number of ops in progress */
347 int n_exclusive; /* number of exclusive ops queued */ 365 int n_exclusive; /* number of exclusive ops queued */
366 atomic_t n_reads; /* number of read ops in progress */
348 spinlock_t lock; /* state and operations lock */ 367 spinlock_t lock; /* state and operations lock */
349 368
350 unsigned long lookup_jif; /* time at which lookup started */ 369 unsigned long lookup_jif; /* time at which lookup started */
@@ -358,6 +377,7 @@ struct fscache_object {
358#define FSCACHE_OBJECT_EV_RELEASE 4 /* T if netfs requested object release */ 377#define FSCACHE_OBJECT_EV_RELEASE 4 /* T if netfs requested object release */
359#define FSCACHE_OBJECT_EV_RETIRE 5 /* T if netfs requested object retirement */ 378#define FSCACHE_OBJECT_EV_RETIRE 5 /* T if netfs requested object retirement */
360#define FSCACHE_OBJECT_EV_WITHDRAW 6 /* T if cache requested object withdrawal */ 379#define FSCACHE_OBJECT_EV_WITHDRAW 6 /* T if cache requested object withdrawal */
380#define FSCACHE_OBJECT_EVENTS_MASK 0x7f /* mask of all events*/
361 381
362 unsigned long flags; 382 unsigned long flags;
363#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */ 383#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */
@@ -373,7 +393,11 @@ struct fscache_object {
373 struct list_head dependents; /* FIFO of dependent objects */ 393 struct list_head dependents; /* FIFO of dependent objects */
374 struct list_head dep_link; /* link in parent's dependents list */ 394 struct list_head dep_link; /* link in parent's dependents list */
375 struct list_head pending_ops; /* unstarted operations on this object */ 395 struct list_head pending_ops; /* unstarted operations on this object */
396#ifdef CONFIG_FSCACHE_OBJECT_LIST
397 struct rb_node objlist_link; /* link in global object list */
398#endif
376 pgoff_t store_limit; /* current storage limit */ 399 pgoff_t store_limit; /* current storage limit */
400 loff_t store_limit_l; /* current storage limit */
377}; 401};
378 402
379extern const char *fscache_object_states[]; 403extern const char *fscache_object_states[];
@@ -383,6 +407,10 @@ extern const char *fscache_object_states[];
383 (obj)->state >= FSCACHE_OBJECT_AVAILABLE && \ 407 (obj)->state >= FSCACHE_OBJECT_AVAILABLE && \
384 (obj)->state < FSCACHE_OBJECT_DYING) 408 (obj)->state < FSCACHE_OBJECT_DYING)
385 409
410#define fscache_object_is_dead(obj) \
411 (test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \
412 (obj)->state >= FSCACHE_OBJECT_DYING)
413
386extern const struct slow_work_ops fscache_object_slow_work_ops; 414extern const struct slow_work_ops fscache_object_slow_work_ops;
387 415
388/** 416/**
@@ -414,6 +442,7 @@ void fscache_object_init(struct fscache_object *object,
414 object->events = object->event_mask = 0; 442 object->events = object->event_mask = 0;
415 object->flags = 0; 443 object->flags = 0;
416 object->store_limit = 0; 444 object->store_limit = 0;
445 object->store_limit_l = 0;
417 object->cache = cache; 446 object->cache = cache;
418 object->cookie = cookie; 447 object->cookie = cookie;
419 object->parent = NULL; 448 object->parent = NULL;
@@ -422,6 +451,12 @@ void fscache_object_init(struct fscache_object *object,
422extern void fscache_object_lookup_negative(struct fscache_object *object); 451extern void fscache_object_lookup_negative(struct fscache_object *object);
423extern void fscache_obtained_object(struct fscache_object *object); 452extern void fscache_obtained_object(struct fscache_object *object);
424 453
454#ifdef CONFIG_FSCACHE_OBJECT_LIST
455extern void fscache_object_destroy(struct fscache_object *object);
456#else
457#define fscache_object_destroy(object) do {} while(0)
458#endif
459
425/** 460/**
426 * fscache_object_destroyed - Note destruction of an object in a cache 461 * fscache_object_destroyed - Note destruction of an object in a cache
427 * @cache: The cache from which the object came 462 * @cache: The cache from which the object came
@@ -460,6 +495,7 @@ static inline void fscache_object_lookup_error(struct fscache_object *object)
460static inline 495static inline
461void fscache_set_store_limit(struct fscache_object *object, loff_t i_size) 496void fscache_set_store_limit(struct fscache_object *object, loff_t i_size)
462{ 497{
498 object->store_limit_l = i_size;
463 object->store_limit = i_size >> PAGE_SHIFT; 499 object->store_limit = i_size >> PAGE_SHIFT;
464 if (i_size & ~PAGE_MASK) 500 if (i_size & ~PAGE_MASK)
465 object->store_limit++; 501 object->store_limit++;
diff --git a/include/linux/fscache.h b/include/linux/fscache.h
index 6d8ee466e0a0..595ce49288b7 100644
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -202,6 +202,8 @@ extern int __fscache_write_page(struct fscache_cookie *, struct page *, gfp_t);
202extern void __fscache_uncache_page(struct fscache_cookie *, struct page *); 202extern void __fscache_uncache_page(struct fscache_cookie *, struct page *);
203extern bool __fscache_check_page_write(struct fscache_cookie *, struct page *); 203extern bool __fscache_check_page_write(struct fscache_cookie *, struct page *);
204extern void __fscache_wait_on_page_write(struct fscache_cookie *, struct page *); 204extern void __fscache_wait_on_page_write(struct fscache_cookie *, struct page *);
205extern bool __fscache_maybe_release_page(struct fscache_cookie *, struct page *,
206 gfp_t);
205 207
206/** 208/**
207 * fscache_register_netfs - Register a filesystem as desiring caching services 209 * fscache_register_netfs - Register a filesystem as desiring caching services
@@ -615,4 +617,29 @@ void fscache_wait_on_page_write(struct fscache_cookie *cookie,
615 __fscache_wait_on_page_write(cookie, page); 617 __fscache_wait_on_page_write(cookie, page);
616} 618}
617 619
620/**
621 * fscache_maybe_release_page - Consider releasing a page, cancelling a store
622 * @cookie: The cookie representing the cache object
623 * @page: The netfs page that is being cached.
624 * @gfp: The gfp flags passed to releasepage()
625 *
626 * Consider releasing a page for the vmscan algorithm, on behalf of the netfs's
627 * releasepage() call. A storage request on the page may cancelled if it is
628 * not currently being processed.
629 *
630 * The function returns true if the page no longer has a storage request on it,
631 * and false if a storage request is left in place. If true is returned, the
632 * page will have been passed to fscache_uncache_page(). If false is returned
633 * the page cannot be freed yet.
634 */
635static inline
636bool fscache_maybe_release_page(struct fscache_cookie *cookie,
637 struct page *page,
638 gfp_t gfp)
639{
640 if (fscache_cookie_valid(cookie) && PageFsCache(page))
641 return __fscache_maybe_release_page(cookie, page, gfp);
642 return false;
643}
644
618#endif /* _LINUX_FSCACHE_H */ 645#endif /* _LINUX_FSCACHE_H */
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index dc3b1328aaeb..0b4f97d24d7f 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -19,7 +19,7 @@
19extern int ftrace_enabled; 19extern int ftrace_enabled;
20extern int 20extern int
21ftrace_enable_sysctl(struct ctl_table *table, int write, 21ftrace_enable_sysctl(struct ctl_table *table, int write,
22 struct file *filp, void __user *buffer, size_t *lenp, 22 void __user *buffer, size_t *lenp,
23 loff_t *ppos); 23 loff_t *ppos);
24 24
25typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip); 25typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip);
@@ -94,7 +94,7 @@ static inline void ftrace_start(void) { }
94extern int stack_tracer_enabled; 94extern int stack_tracer_enabled;
95int 95int
96stack_trace_sysctl(struct ctl_table *table, int write, 96stack_trace_sysctl(struct ctl_table *table, int write,
97 struct file *file, void __user *buffer, size_t *lenp, 97 void __user *buffer, size_t *lenp,
98 loff_t *ppos); 98 loff_t *ppos);
99#endif 99#endif
100 100
@@ -241,7 +241,7 @@ extern void ftrace_enable_daemon(void);
241# define ftrace_set_filter(buf, len, reset) do { } while (0) 241# define ftrace_set_filter(buf, len, reset) do { } while (0)
242# define ftrace_disable_daemon() do { } while (0) 242# define ftrace_disable_daemon() do { } while (0)
243# define ftrace_enable_daemon() do { } while (0) 243# define ftrace_enable_daemon() do { } while (0)
244static inline void ftrace_release(void *start, unsigned long size) { } 244static inline void ftrace_release_mod(struct module *mod) {}
245static inline int register_ftrace_command(struct ftrace_func_command *cmd) 245static inline int register_ftrace_command(struct ftrace_func_command *cmd)
246{ 246{
247 return -EINVAL; 247 return -EINVAL;
@@ -446,7 +446,6 @@ static inline void unpause_graph_tracing(void) { }
446#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 446#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
447 447
448#ifdef CONFIG_TRACING 448#ifdef CONFIG_TRACING
449#include <linux/sched.h>
450 449
451/* flags for current->trace */ 450/* flags for current->trace */
452enum { 451enum {
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index a81170de7f6b..4ec5e67e18cf 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -1,9 +1,10 @@
1#ifndef _LINUX_FTRACE_EVENT_H 1#ifndef _LINUX_FTRACE_EVENT_H
2#define _LINUX_FTRACE_EVENT_H 2#define _LINUX_FTRACE_EVENT_H
3 3
4#include <linux/trace_seq.h>
5#include <linux/ring_buffer.h> 4#include <linux/ring_buffer.h>
5#include <linux/trace_seq.h>
6#include <linux/percpu.h> 6#include <linux/percpu.h>
7#include <linux/hardirq.h>
7 8
8struct trace_array; 9struct trace_array;
9struct tracer; 10struct tracer;
@@ -34,7 +35,7 @@ struct trace_entry {
34 unsigned char flags; 35 unsigned char flags;
35 unsigned char preempt_count; 36 unsigned char preempt_count;
36 int pid; 37 int pid;
37 int tgid; 38 int lock_depth;
38}; 39};
39 40
40#define FTRACE_MAX_EVENT \ 41#define FTRACE_MAX_EVENT \
@@ -93,16 +94,22 @@ void tracing_generic_entry_update(struct trace_entry *entry,
93 unsigned long flags, 94 unsigned long flags,
94 int pc); 95 int pc);
95struct ring_buffer_event * 96struct ring_buffer_event *
96trace_current_buffer_lock_reserve(int type, unsigned long len, 97trace_current_buffer_lock_reserve(struct ring_buffer **current_buffer,
98 int type, unsigned long len,
97 unsigned long flags, int pc); 99 unsigned long flags, int pc);
98void trace_current_buffer_unlock_commit(struct ring_buffer_event *event, 100void trace_current_buffer_unlock_commit(struct ring_buffer *buffer,
101 struct ring_buffer_event *event,
99 unsigned long flags, int pc); 102 unsigned long flags, int pc);
100void trace_nowake_buffer_unlock_commit(struct ring_buffer_event *event, 103void trace_nowake_buffer_unlock_commit(struct ring_buffer *buffer,
104 struct ring_buffer_event *event,
101 unsigned long flags, int pc); 105 unsigned long flags, int pc);
102void trace_current_buffer_discard_commit(struct ring_buffer_event *event); 106void trace_current_buffer_discard_commit(struct ring_buffer *buffer,
107 struct ring_buffer_event *event);
103 108
104void tracing_record_cmdline(struct task_struct *tsk); 109void tracing_record_cmdline(struct task_struct *tsk);
105 110
111struct event_filter;
112
106struct ftrace_event_call { 113struct ftrace_event_call {
107 struct list_head list; 114 struct list_head list;
108 char *name; 115 char *name;
@@ -110,34 +117,51 @@ struct ftrace_event_call {
110 struct dentry *dir; 117 struct dentry *dir;
111 struct trace_event *event; 118 struct trace_event *event;
112 int enabled; 119 int enabled;
113 int (*regfunc)(void); 120 int (*regfunc)(void *);
114 void (*unregfunc)(void); 121 void (*unregfunc)(void *);
115 int id; 122 int id;
116 int (*raw_init)(void); 123 int (*raw_init)(void);
117 int (*show_format)(struct trace_seq *s); 124 int (*show_format)(struct ftrace_event_call *call,
118 int (*define_fields)(void); 125 struct trace_seq *s);
126 int (*define_fields)(struct ftrace_event_call *);
119 struct list_head fields; 127 struct list_head fields;
120 int filter_active; 128 int filter_active;
121 void *filter; 129 struct event_filter *filter;
122 void *mod; 130 void *mod;
131 void *data;
123 132
124 atomic_t profile_count; 133 atomic_t profile_count;
125 int (*profile_enable)(struct ftrace_event_call *); 134 int (*profile_enable)(void);
126 void (*profile_disable)(struct ftrace_event_call *); 135 void (*profile_disable)(void);
127}; 136};
128 137
138#define FTRACE_MAX_PROFILE_SIZE 2048
139
140extern char *trace_profile_buf;
141extern char *trace_profile_buf_nmi;
142
129#define MAX_FILTER_PRED 32 143#define MAX_FILTER_PRED 32
130#define MAX_FILTER_STR_VAL 128 144#define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */
131 145
132extern int init_preds(struct ftrace_event_call *call);
133extern void destroy_preds(struct ftrace_event_call *call); 146extern void destroy_preds(struct ftrace_event_call *call);
134extern int filter_match_preds(struct ftrace_event_call *call, void *rec); 147extern int filter_match_preds(struct ftrace_event_call *call, void *rec);
135extern int filter_current_check_discard(struct ftrace_event_call *call, 148extern int filter_current_check_discard(struct ring_buffer *buffer,
149 struct ftrace_event_call *call,
136 void *rec, 150 void *rec,
137 struct ring_buffer_event *event); 151 struct ring_buffer_event *event);
138 152
139extern int trace_define_field(struct ftrace_event_call *call, char *type, 153enum {
140 char *name, int offset, int size, int is_signed); 154 FILTER_OTHER = 0,
155 FILTER_STATIC_STRING,
156 FILTER_DYN_STRING,
157 FILTER_PTR_STRING,
158};
159
160extern int trace_define_field(struct ftrace_event_call *call,
161 const char *type, const char *name,
162 int offset, int size, int is_signed,
163 int filter_type);
164extern int trace_define_common_fields(struct ftrace_event_call *call);
141 165
142#define is_signed_type(type) (((type)(-1)) < 0) 166#define is_signed_type(type) (((type)(-1)) < 0)
143 167
@@ -162,11 +186,4 @@ do { \
162 __trace_printk(ip, fmt, ##args); \ 186 __trace_printk(ip, fmt, ##args); \
163} while (0) 187} while (0)
164 188
165#define __common_field(type, item, is_signed) \
166 ret = trace_define_field(event_call, #type, "common_" #item, \
167 offsetof(typeof(field.ent), item), \
168 sizeof(field.ent.item), is_signed); \
169 if (ret) \
170 return ret;
171
172#endif /* _LINUX_FTRACE_EVENT_H */ 189#endif /* _LINUX_FTRACE_EVENT_H */
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index cf593bf9fd32..3e2925a34bf0 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -30,6 +30,10 @@
30 * - add umask flag to input argument of open, mknod and mkdir 30 * - add umask flag to input argument of open, mknod and mkdir
31 * - add notification messages for invalidation of inodes and 31 * - add notification messages for invalidation of inodes and
32 * directory entries 32 * directory entries
33 *
34 * 7.13
35 * - make max number of background requests and congestion threshold
36 * tunables
33 */ 37 */
34 38
35#ifndef _LINUX_FUSE_H 39#ifndef _LINUX_FUSE_H
@@ -37,11 +41,31 @@
37 41
38#include <linux/types.h> 42#include <linux/types.h>
39 43
44/*
45 * Version negotiation:
46 *
47 * Both the kernel and userspace send the version they support in the
48 * INIT request and reply respectively.
49 *
50 * If the major versions match then both shall use the smallest
51 * of the two minor versions for communication.
52 *
53 * If the kernel supports a larger major version, then userspace shall
54 * reply with the major version it supports, ignore the rest of the
55 * INIT message and expect a new INIT message from the kernel with a
56 * matching major version.
57 *
58 * If the library supports a larger major version, then it shall fall
59 * back to the major protocol version sent by the kernel for
60 * communication and reply with that major version (and an arbitrary
61 * supported minor version).
62 */
63
40/** Version number of this interface */ 64/** Version number of this interface */
41#define FUSE_KERNEL_VERSION 7 65#define FUSE_KERNEL_VERSION 7
42 66
43/** Minor version number of this interface */ 67/** Minor version number of this interface */
44#define FUSE_KERNEL_MINOR_VERSION 12 68#define FUSE_KERNEL_MINOR_VERSION 13
45 69
46/** The node ID of the root inode */ 70/** The node ID of the root inode */
47#define FUSE_ROOT_ID 1 71#define FUSE_ROOT_ID 1
@@ -427,7 +451,8 @@ struct fuse_init_out {
427 __u32 minor; 451 __u32 minor;
428 __u32 max_readahead; 452 __u32 max_readahead;
429 __u32 flags; 453 __u32 flags;
430 __u32 unused; 454 __u16 max_background;
455 __u16 congestion_threshold;
431 __u32 max_write; 456 __u32 max_write;
432}; 457};
433 458
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 34956c8fdebf..1e5a26d79232 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -4,11 +4,6 @@
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/types.h> 5#include <linux/types.h>
6 6
7struct inode;
8struct mm_struct;
9struct task_struct;
10union ktime;
11
12/* Second argument to futex syscall */ 7/* Second argument to futex syscall */
13 8
14 9
@@ -38,8 +33,8 @@ union ktime;
38#define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG) 33#define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG)
39#define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG) 34#define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG)
40#define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG) 35#define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG)
41#define FUTEX_WAIT_BITSET_PRIVATE (FUTEX_WAIT_BITS | FUTEX_PRIVATE_FLAG) 36#define FUTEX_WAIT_BITSET_PRIVATE (FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG)
42#define FUTEX_WAKE_BITSET_PRIVATE (FUTEX_WAKE_BITS | FUTEX_PRIVATE_FLAG) 37#define FUTEX_WAKE_BITSET_PRIVATE (FUTEX_WAKE_BITSET | FUTEX_PRIVATE_FLAG)
43#define FUTEX_WAIT_REQUEUE_PI_PRIVATE (FUTEX_WAIT_REQUEUE_PI | \ 38#define FUTEX_WAIT_REQUEUE_PI_PRIVATE (FUTEX_WAIT_REQUEUE_PI | \
44 FUTEX_PRIVATE_FLAG) 39 FUTEX_PRIVATE_FLAG)
45#define FUTEX_CMP_REQUEUE_PI_PRIVATE (FUTEX_CMP_REQUEUE_PI | \ 40#define FUTEX_CMP_REQUEUE_PI_PRIVATE (FUTEX_CMP_REQUEUE_PI | \
@@ -129,6 +124,11 @@ struct robust_list_head {
129#define FUTEX_BITSET_MATCH_ANY 0xffffffff 124#define FUTEX_BITSET_MATCH_ANY 0xffffffff
130 125
131#ifdef __KERNEL__ 126#ifdef __KERNEL__
127struct inode;
128struct mm_struct;
129struct task_struct;
130union ktime;
131
132long do_futex(u32 __user *uaddr, int op, u32 val, union ktime *timeout, 132long do_futex(u32 __user *uaddr, int op, u32 val, union ktime *timeout,
133 u32 __user *uaddr2, u32 val2, u32 val3); 133 u32 __user *uaddr2, u32 val2, u32 val3);
134 134
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 45fc320a53c6..297df45ffd0a 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -98,7 +98,7 @@ struct hd_struct {
98 int make_it_fail; 98 int make_it_fail;
99#endif 99#endif
100 unsigned long stamp; 100 unsigned long stamp;
101 int in_flight; 101 int in_flight[2];
102#ifdef CONFIG_SMP 102#ifdef CONFIG_SMP
103 struct disk_stats *dkstats; 103 struct disk_stats *dkstats;
104#else 104#else
@@ -142,7 +142,7 @@ struct gendisk {
142 * disks that can't be partitioned. */ 142 * disks that can't be partitioned. */
143 143
144 char disk_name[DISK_NAME_LEN]; /* name of major driver */ 144 char disk_name[DISK_NAME_LEN]; /* name of major driver */
145 char *(*nodename)(struct gendisk *gd); 145 char *(*devnode)(struct gendisk *gd, mode_t *mode);
146 /* Array of pointers to partitions indexed by partno. 146 /* Array of pointers to partitions indexed by partno.
147 * Protected with matching bdev lock but stat and other 147 * Protected with matching bdev lock but stat and other
148 * non-critical accesses use RCU. Always access through 148 * non-critical accesses use RCU. Always access through
@@ -151,7 +151,7 @@ struct gendisk {
151 struct disk_part_tbl *part_tbl; 151 struct disk_part_tbl *part_tbl;
152 struct hd_struct part0; 152 struct hd_struct part0;
153 153
154 struct block_device_operations *fops; 154 const struct block_device_operations *fops;
155 struct request_queue *queue; 155 struct request_queue *queue;
156 void *private_data; 156 void *private_data;
157 157
@@ -322,18 +322,23 @@ static inline void free_part_stats(struct hd_struct *part)
322#define part_stat_sub(cpu, gendiskp, field, subnd) \ 322#define part_stat_sub(cpu, gendiskp, field, subnd) \
323 part_stat_add(cpu, gendiskp, field, -subnd) 323 part_stat_add(cpu, gendiskp, field, -subnd)
324 324
325static inline void part_inc_in_flight(struct hd_struct *part) 325static inline void part_inc_in_flight(struct hd_struct *part, int rw)
326{ 326{
327 part->in_flight++; 327 part->in_flight[rw]++;
328 if (part->partno) 328 if (part->partno)
329 part_to_disk(part)->part0.in_flight++; 329 part_to_disk(part)->part0.in_flight[rw]++;
330} 330}
331 331
332static inline void part_dec_in_flight(struct hd_struct *part) 332static inline void part_dec_in_flight(struct hd_struct *part, int rw)
333{ 333{
334 part->in_flight--; 334 part->in_flight[rw]--;
335 if (part->partno) 335 if (part->partno)
336 part_to_disk(part)->part0.in_flight--; 336 part_to_disk(part)->part0.in_flight[rw]--;
337}
338
339static inline int part_in_flight(struct hd_struct *part)
340{
341 return part->in_flight[0] + part->in_flight[1];
337} 342}
338 343
339/* block/blk-core.c */ 344/* block/blk-core.c */
@@ -546,6 +551,8 @@ extern ssize_t part_size_show(struct device *dev,
546 struct device_attribute *attr, char *buf); 551 struct device_attribute *attr, char *buf);
547extern ssize_t part_stat_show(struct device *dev, 552extern ssize_t part_stat_show(struct device *dev,
548 struct device_attribute *attr, char *buf); 553 struct device_attribute *attr, char *buf);
554extern ssize_t part_inflight_show(struct device *dev,
555 struct device_attribute *attr, char *buf);
549#ifdef CONFIG_FAIL_MAKE_REQUEST 556#ifdef CONFIG_FAIL_MAKE_REQUEST
550extern ssize_t part_fail_show(struct device *dev, 557extern ssize_t part_fail_show(struct device *dev,
551 struct device_attribute *attr, char *buf); 558 struct device_attribute *attr, char *buf);
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 7c777a0da17a..557bdad320b6 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -220,7 +220,7 @@ static inline enum zone_type gfp_zone(gfp_t flags)
220 ((1 << ZONES_SHIFT) - 1); 220 ((1 << ZONES_SHIFT) - 1);
221 221
222 if (__builtin_constant_p(bit)) 222 if (__builtin_constant_p(bit))
223 BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1); 223 MAYBE_BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
224 else { 224 else {
225#ifdef CONFIG_DEBUG_VM 225#ifdef CONFIG_DEBUG_VM
226 BUG_ON((GFP_ZONE_BAD >> bit) & 1); 226 BUG_ON((GFP_ZONE_BAD >> bit) & 1);
@@ -326,7 +326,6 @@ void free_pages_exact(void *virt, size_t size);
326extern void __free_pages(struct page *page, unsigned int order); 326extern void __free_pages(struct page *page, unsigned int order);
327extern void free_pages(unsigned long addr, unsigned int order); 327extern void free_pages(unsigned long addr, unsigned int order);
328extern void free_hot_page(struct page *page); 328extern void free_hot_page(struct page *page);
329extern void free_cold_page(struct page *page);
330 329
331#define __free_page(page) __free_pages((page), 0) 330#define __free_page(page) __free_pages((page), 0)
332#define free_page(addr) free_pages((addr),0) 331#define free_page(addr) free_pages((addr),0)
@@ -336,18 +335,6 @@ void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp);
336void drain_all_pages(void); 335void drain_all_pages(void);
337void drain_local_pages(void *dummy); 336void drain_local_pages(void *dummy);
338 337
339extern bool oom_killer_disabled;
340
341static inline void oom_killer_disable(void)
342{
343 oom_killer_disabled = true;
344}
345
346static inline void oom_killer_enable(void)
347{
348 oom_killer_disabled = false;
349}
350
351extern gfp_t gfp_allowed_mask; 338extern gfp_t gfp_allowed_mask;
352 339
353static inline void set_gfp_allowed_mask(gfp_t mask) 340static inline void set_gfp_allowed_mask(gfp_t mask)
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h
index c56b4bce56d0..b80c88dedbbb 100644
--- a/include/linux/gfs2_ondisk.h
+++ b/include/linux/gfs2_ondisk.h
@@ -333,6 +333,28 @@ struct gfs2_leaf {
333 333
334/* 334/*
335 * Extended attribute header format 335 * Extended attribute header format
336 *
337 * This works in a similar way to dirents. There is a fixed size header
338 * followed by a variable length section made up of the name and the
339 * associated data. In the case of a "stuffed" entry, the value is
340 * inline directly after the name, the ea_num_ptrs entry will be
341 * zero in that case. For non-"stuffed" entries, there will be
342 * a set of pointers (aligned to 8 byte boundary) to the block(s)
343 * containing the value.
344 *
345 * The blocks containing the values and the blocks containing the
346 * extended attribute headers themselves all start with the common
347 * metadata header. Each inode, if it has extended attributes, will
348 * have either a single block containing the extended attribute headers
349 * or a single indirect block pointing to blocks containing the
350 * extended attribure headers.
351 *
352 * The maximim size of the data part of an extended attribute is 64k
353 * so the number of blocks required depends upon block size. Since the
354 * block size also determines the number of pointers in an indirect
355 * block, its a fairly complicated calculation to work out the maximum
356 * number of blocks that an inode may have relating to extended attributes.
357 *
336 */ 358 */
337 359
338#define GFS2_EA_MAX_NAME_LEN 255 360#define GFS2_EA_MAX_NAME_LEN 255
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index e10c49a5b96e..059bd189d35d 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -12,6 +12,8 @@
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/errno.h> 13#include <linux/errno.h>
14 14
15struct device;
16
15/* 17/*
16 * Some platforms don't support the GPIO programming interface. 18 * Some platforms don't support the GPIO programming interface.
17 * 19 *
@@ -89,6 +91,15 @@ static inline int gpio_export(unsigned gpio, bool direction_may_change)
89 return -EINVAL; 91 return -EINVAL;
90} 92}
91 93
94static inline int gpio_export_link(struct device *dev, const char *name,
95 unsigned gpio)
96{
97 /* GPIO can never have been exported */
98 WARN_ON(1);
99 return -EINVAL;
100}
101
102
92static inline void gpio_unexport(unsigned gpio) 103static inline void gpio_unexport(unsigned gpio)
93{ 104{
94 /* GPIO can never have been exported */ 105 /* GPIO can never have been exported */
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 8246c697863d..6d527ee82b2b 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -64,6 +64,12 @@
64#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) 64#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT)
65#define NMI_OFFSET (1UL << NMI_SHIFT) 65#define NMI_OFFSET (1UL << NMI_SHIFT)
66 66
67#ifndef PREEMPT_ACTIVE
68#define PREEMPT_ACTIVE_BITS 1
69#define PREEMPT_ACTIVE_SHIFT (NMI_SHIFT + NMI_BITS)
70#define PREEMPT_ACTIVE (__IRQ_MASK(PREEMPT_ACTIVE_BITS) << PREEMPT_ACTIVE_SHIFT)
71#endif
72
67#if PREEMPT_ACTIVE < (1 << (NMI_SHIFT + NMI_BITS)) 73#if PREEMPT_ACTIVE < (1 << (NMI_SHIFT + NMI_BITS))
68#error PREEMPT_ACTIVE is too low! 74#error PREEMPT_ACTIVE is too low!
69#endif 75#endif
@@ -132,7 +138,7 @@ static inline void account_system_vtime(struct task_struct *tsk)
132} 138}
133#endif 139#endif
134 140
135#if defined(CONFIG_NO_HZ) && !defined(CONFIG_CLASSIC_RCU) 141#if defined(CONFIG_NO_HZ)
136extern void rcu_irq_enter(void); 142extern void rcu_irq_enter(void);
137extern void rcu_irq_exit(void); 143extern void rcu_irq_exit(void);
138extern void rcu_nmi_enter(void); 144extern void rcu_nmi_enter(void);
@@ -142,7 +148,7 @@ extern void rcu_nmi_exit(void);
142# define rcu_irq_exit() do { } while (0) 148# define rcu_irq_exit() do { } while (0)
143# define rcu_nmi_enter() do { } while (0) 149# define rcu_nmi_enter() do { } while (0)
144# define rcu_nmi_exit() do { } while (0) 150# define rcu_nmi_exit() do { } while (0)
145#endif /* #if defined(CONFIG_NO_HZ) && !defined(CONFIG_CLASSIC_RCU) */ 151#endif /* #if defined(CONFIG_NO_HZ) */
146 152
147/* 153/*
148 * It is safe to do non-atomic ops on ->hardirq_context, 154 * It is safe to do non-atomic ops on ->hardirq_context,
diff --git a/include/linux/hayesesp.h b/include/linux/hayesesp.h
index 940aeb51d53f..92b08cfe4a75 100644
--- a/include/linux/hayesesp.h
+++ b/include/linux/hayesesp.h
@@ -96,7 +96,6 @@ struct esp_struct {
96 int xmit_head; 96 int xmit_head;
97 int xmit_tail; 97 int xmit_tail;
98 int xmit_cnt; 98 int xmit_cnt;
99 wait_queue_head_t delta_msr_wait;
100 wait_queue_head_t break_wait; 99 wait_queue_head_t break_wait;
101 struct async_icount icount; /* kernel counters for the 4 input interrupts */ 100 struct async_icount icount; /* kernel counters for the 4 input interrupts */
102 struct hayes_esp_config config; /* port configuration */ 101 struct hayes_esp_config config; /* port configuration */
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index 6a6e701f1631..ee275c8b3df1 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -38,7 +38,7 @@ struct hdlc_proto {
38 int (*ioctl)(struct net_device *dev, struct ifreq *ifr); 38 int (*ioctl)(struct net_device *dev, struct ifreq *ifr);
39 __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev); 39 __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev);
40 int (*netif_rx)(struct sk_buff *skb); 40 int (*netif_rx)(struct sk_buff *skb);
41 int (*xmit)(struct sk_buff *skb, struct net_device *dev); 41 netdev_tx_t (*xmit)(struct sk_buff *skb, struct net_device *dev);
42 struct module *module; 42 struct module *module;
43 struct hdlc_proto *next; /* next protocol in the list */ 43 struct hdlc_proto *next; /* next protocol in the list */
44}; 44};
@@ -51,7 +51,7 @@ typedef struct hdlc_device {
51 unsigned short encoding, unsigned short parity); 51 unsigned short encoding, unsigned short parity);
52 52
53 /* hardware driver must handle this instead of dev->hard_start_xmit */ 53 /* hardware driver must handle this instead of dev->hard_start_xmit */
54 int (*xmit)(struct sk_buff *skb, struct net_device *dev); 54 netdev_tx_t (*xmit)(struct sk_buff *skb, struct net_device *dev);
55 55
56 /* Things below are for HDLC layer internal use only */ 56 /* Things below are for HDLC layer internal use only */
57 const struct hdlc_proto *proto; 57 const struct hdlc_proto *proto;
@@ -60,7 +60,7 @@ typedef struct hdlc_device {
60 spinlock_t state_lock; 60 spinlock_t state_lock;
61 void *state; 61 void *state;
62 void *priv; 62 void *priv;
63}hdlc_device; 63} hdlc_device;
64 64
65 65
66 66
@@ -106,7 +106,7 @@ void hdlc_close(struct net_device *dev);
106/* May be used by hardware driver */ 106/* May be used by hardware driver */
107int hdlc_change_mtu(struct net_device *dev, int new_mtu); 107int hdlc_change_mtu(struct net_device *dev, int new_mtu);
108/* Must be pointed to by hw driver's dev->netdev_ops->ndo_start_xmit */ 108/* Must be pointed to by hw driver's dev->netdev_ops->ndo_start_xmit */
109int hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev); 109netdev_tx_t hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev);
110 110
111int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto, 111int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
112 size_t size); 112 size_t size);
diff --git a/include/linux/hid-debug.h b/include/linux/hid-debug.h
index 50d568ec178a..53744fa1c8b7 100644
--- a/include/linux/hid-debug.h
+++ b/include/linux/hid-debug.h
@@ -2,7 +2,7 @@
2#define __HID_DEBUG_H 2#define __HID_DEBUG_H
3 3
4/* 4/*
5 * Copyright (c) 2007 Jiri Kosina 5 * Copyright (c) 2007-2009 Jiri Kosina
6 */ 6 */
7 7
8/* 8/*
@@ -22,24 +22,44 @@
22 * 22 *
23 */ 23 */
24 24
25#ifdef CONFIG_HID_DEBUG 25#define HID_DEBUG_BUFSIZE 512
26 26
27void hid_dump_input(struct hid_usage *, __s32); 27#ifdef CONFIG_DEBUG_FS
28void hid_dump_device(struct hid_device *); 28
29void hid_dump_field(struct hid_field *, int); 29void hid_dump_input(struct hid_device *, struct hid_usage *, __s32);
30void hid_resolv_usage(unsigned); 30void hid_dump_device(struct hid_device *, struct seq_file *);
31void hid_resolv_event(__u8, __u16); 31void hid_dump_field(struct hid_field *, int, struct seq_file *);
32char *hid_resolv_usage(unsigned, struct seq_file *);
33void hid_debug_register(struct hid_device *, const char *);
34void hid_debug_unregister(struct hid_device *);
35void hid_debug_init(void);
36void hid_debug_exit(void);
37void hid_debug_event(struct hid_device *, char *);
32 38
33#else
34 39
35#define hid_dump_input(a,b) do { } while (0) 40struct hid_debug_list {
36#define hid_dump_device(c) do { } while (0) 41 char *hid_debug_buf;
37#define hid_dump_field(a,b) do { } while (0) 42 int head;
38#define hid_resolv_usage(a) do { } while (0) 43 int tail;
39#define hid_resolv_event(a,b) do { } while (0) 44 struct fasync_struct *fasync;
45 struct hid_device *hdev;
46 struct list_head node;
47 struct mutex read_mutex;
48};
40 49
41#endif /* CONFIG_HID_DEBUG */ 50#else
42 51
52#define hid_dump_input(a,b,c) do { } while (0)
53#define hid_dump_device(a,b) do { } while (0)
54#define hid_dump_field(a,b,c) do { } while (0)
55#define hid_resolv_usage(a,b) do { } while (0)
56#define hid_debug_register(a, b) do { } while (0)
57#define hid_debug_unregister(a) do { } while (0)
58#define hid_debug_init() do { } while (0)
59#define hid_debug_exit() do { } while (0)
60#define hid_debug_event(a,b) do { } while (0)
61
62#endif
43 63
44#endif 64#endif
45 65
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 53489fd4d700..10f628416740 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -494,12 +494,21 @@ struct hid_device { /* device report descriptor */
494 494
495 /* hiddev event handler */ 495 /* hiddev event handler */
496 int (*hiddev_connect)(struct hid_device *, unsigned int); 496 int (*hiddev_connect)(struct hid_device *, unsigned int);
497 void (*hiddev_disconnect)(struct hid_device *);
497 void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field, 498 void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field,
498 struct hid_usage *, __s32); 499 struct hid_usage *, __s32);
499 void (*hiddev_report_event) (struct hid_device *, struct hid_report *); 500 void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
500 501
501 /* handler for raw output data, used by hidraw */ 502 /* handler for raw output data, used by hidraw */
502 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); 503 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t);
504
505 /* debugging support via debugfs */
506 unsigned short debug;
507 struct dentry *debug_dir;
508 struct dentry *debug_rdesc;
509 struct dentry *debug_events;
510 struct list_head debug_list;
511 wait_queue_head_t debug_wait;
503}; 512};
504 513
505static inline void *hid_get_drvdata(struct hid_device *hdev) 514static inline void *hid_get_drvdata(struct hid_device *hdev)
@@ -657,9 +666,7 @@ struct hid_ll_driver {
657 666
658/* HID core API */ 667/* HID core API */
659 668
660#ifdef CONFIG_HID_DEBUG
661extern int hid_debug; 669extern int hid_debug;
662#endif
663 670
664extern int hid_add_device(struct hid_device *); 671extern int hid_add_device(struct hid_device *);
665extern void hid_destroy_device(struct hid_device *); 672extern void hid_destroy_device(struct hid_device *);
@@ -685,6 +692,7 @@ struct hid_device *hid_allocate_device(void);
685int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); 692int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
686int hid_check_keys_pressed(struct hid_device *hid); 693int hid_check_keys_pressed(struct hid_device *hid);
687int hid_connect(struct hid_device *hid, unsigned int connect_mask); 694int hid_connect(struct hid_device *hid, unsigned int connect_mask);
695void hid_disconnect(struct hid_device *hid);
688 696
689/** 697/**
690 * hid_map_usage - map usage input bits 698 * hid_map_usage - map usage input bits
@@ -794,6 +802,7 @@ static inline int __must_check hid_hw_start(struct hid_device *hdev,
794 */ 802 */
795static inline void hid_hw_stop(struct hid_device *hdev) 803static inline void hid_hw_stop(struct hid_device *hdev)
796{ 804{
805 hid_disconnect(hdev);
797 hdev->ll_driver->stop(hdev); 806 hdev->ll_driver->stop(hdev);
798} 807}
799 808
@@ -815,21 +824,9 @@ int hid_pidff_init(struct hid_device *hid);
815#define hid_pidff_init NULL 824#define hid_pidff_init NULL
816#endif 825#endif
817 826
818#ifdef CONFIG_HID_DEBUG
819#define dbg_hid(format, arg...) if (hid_debug) \ 827#define dbg_hid(format, arg...) if (hid_debug) \
820 printk(KERN_DEBUG "%s: " format ,\ 828 printk(KERN_DEBUG "%s: " format ,\
821 __FILE__ , ## arg) 829 __FILE__ , ## arg)
822#define dbg_hid_line(format, arg...) if (hid_debug) \
823 printk(format, ## arg)
824#else
825static inline int __attribute__((format(printf, 1, 2)))
826dbg_hid(const char *fmt, ...)
827{
828 return 0;
829}
830#define dbg_hid_line dbg_hid
831#endif /* HID_DEBUG */
832
833#define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ 830#define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \
834 __FILE__ , ## arg) 831 __FILE__ , ## arg)
835#endif /* HID_FF */ 832#endif /* HID_FF */
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 4759917adc71..ff037f0b1b4e 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -91,7 +91,6 @@ enum hrtimer_restart {
91 * @function: timer expiry callback function 91 * @function: timer expiry callback function
92 * @base: pointer to the timer base (per cpu and per clock) 92 * @base: pointer to the timer base (per cpu and per clock)
93 * @state: state information (See bit values above) 93 * @state: state information (See bit values above)
94 * @cb_entry: list head to enqueue an expired timer into the callback list
95 * @start_site: timer statistics field to store the site where the timer 94 * @start_site: timer statistics field to store the site where the timer
96 * was started 95 * was started
97 * @start_comm: timer statistics field to store the name of the process which 96 * @start_comm: timer statistics field to store the name of the process which
@@ -108,7 +107,6 @@ struct hrtimer {
108 enum hrtimer_restart (*function)(struct hrtimer *); 107 enum hrtimer_restart (*function)(struct hrtimer *);
109 struct hrtimer_clock_base *base; 108 struct hrtimer_clock_base *base;
110 unsigned long state; 109 unsigned long state;
111 struct list_head cb_entry;
112#ifdef CONFIG_TIMER_STATS 110#ifdef CONFIG_TIMER_STATS
113 int start_pid; 111 int start_pid;
114 void *start_site; 112 void *start_site;
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 5cbc620bdfe0..41a59afc70fa 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -3,15 +3,15 @@
3 3
4#include <linux/fs.h> 4#include <linux/fs.h>
5 5
6struct ctl_table;
7struct user_struct;
8
6#ifdef CONFIG_HUGETLB_PAGE 9#ifdef CONFIG_HUGETLB_PAGE
7 10
8#include <linux/mempolicy.h> 11#include <linux/mempolicy.h>
9#include <linux/shm.h> 12#include <linux/shm.h>
10#include <asm/tlbflush.h> 13#include <asm/tlbflush.h>
11 14
12struct ctl_table;
13struct user_struct;
14
15int PageHuge(struct page *page); 15int PageHuge(struct page *page);
16 16
17static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) 17static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
@@ -20,11 +20,13 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
20} 20}
21 21
22void reset_vma_resv_huge_pages(struct vm_area_struct *vma); 22void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
23int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 23int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
24int hugetlb_overcommit_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 24int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
25int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 25int hugetlb_treat_movable_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
26int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); 26int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
27int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int, int); 27int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *,
28 struct page **, struct vm_area_struct **,
29 unsigned long *, int *, int, unsigned int flags);
28void unmap_hugepage_range(struct vm_area_struct *, 30void unmap_hugepage_range(struct vm_area_struct *,
29 unsigned long, unsigned long, struct page *); 31 unsigned long, unsigned long, struct page *);
30void __unmap_hugepage_range(struct vm_area_struct *, 32void __unmap_hugepage_range(struct vm_area_struct *,
@@ -110,6 +112,21 @@ static inline void hugetlb_report_meminfo(struct seq_file *m)
110 112
111#endif /* !CONFIG_HUGETLB_PAGE */ 113#endif /* !CONFIG_HUGETLB_PAGE */
112 114
115#define HUGETLB_ANON_FILE "anon_hugepage"
116
117enum {
118 /*
119 * The file will be used as an shm file so shmfs accounting rules
120 * apply
121 */
122 HUGETLB_SHMFS_INODE = 1,
123 /*
124 * The file is being created on the internal vfs mount and shmfs
125 * accounting rules do not apply
126 */
127 HUGETLB_ANONHUGE_INODE = 2,
128};
129
113#ifdef CONFIG_HUGETLBFS 130#ifdef CONFIG_HUGETLBFS
114struct hugetlbfs_config { 131struct hugetlbfs_config {
115 uid_t uid; 132 uid_t uid;
@@ -146,9 +163,9 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
146} 163}
147 164
148extern const struct file_operations hugetlbfs_file_operations; 165extern const struct file_operations hugetlbfs_file_operations;
149extern struct vm_operations_struct hugetlb_vm_ops; 166extern const struct vm_operations_struct hugetlb_vm_ops;
150struct file *hugetlb_file_setup(const char *name, size_t size, int acct, 167struct file *hugetlb_file_setup(const char *name, size_t size, int acct,
151 struct user_struct **user); 168 struct user_struct **user, int creat_flags);
152int hugetlb_get_quota(struct address_space *mapping, long delta); 169int hugetlb_get_quota(struct address_space *mapping, long delta);
153void hugetlb_put_quota(struct address_space *mapping, long delta); 170void hugetlb_put_quota(struct address_space *mapping, long delta);
154 171
@@ -170,7 +187,11 @@ static inline void set_file_hugepages(struct file *file)
170 187
171#define is_file_hugepages(file) 0 188#define is_file_hugepages(file) 0
172#define set_file_hugepages(file) BUG() 189#define set_file_hugepages(file) BUG()
173#define hugetlb_file_setup(name,size,acct,user) ERR_PTR(-ENOSYS) 190static inline struct file *hugetlb_file_setup(const char *name, size_t size,
191 int acctflag, struct user_struct **user, int creat_flags)
192{
193 return ERR_PTR(-ENOSYS);
194}
174 195
175#endif /* !CONFIG_HUGETLBFS */ 196#endif /* !CONFIG_HUGETLBFS */
176 197
@@ -185,7 +206,8 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
185#define HSTATE_NAME_LEN 32 206#define HSTATE_NAME_LEN 32
186/* Defines one hugetlb page size */ 207/* Defines one hugetlb page size */
187struct hstate { 208struct hstate {
188 int hugetlb_next_nid; 209 int next_nid_to_alloc;
210 int next_nid_to_free;
189 unsigned int order; 211 unsigned int order;
190 unsigned long mask; 212 unsigned long mask;
191 unsigned long max_huge_pages; 213 unsigned long max_huge_pages;
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index c9087de5c6c6..e844a0b18695 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -28,17 +28,6 @@
28 identify a legacy client. If you don't need them, just don't set them. */ 28 identify a legacy client. If you don't need them, just don't set them. */
29 29
30/* 30/*
31 * ---- Driver types -----------------------------------------------------
32 */
33
34#define I2C_DRIVERID_MSP3400 1
35#define I2C_DRIVERID_TUNER 2
36#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */
37#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */
38#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */
39#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */
40
41/*
42 * ---- Adapter types ---------------------------------------------------- 31 * ---- Adapter types ----------------------------------------------------
43 */ 32 */
44 33
diff --git a/include/linux/i2c-pnx.h b/include/linux/i2c-pnx.h
index f13255e06406..9eb07bbc6522 100644
--- a/include/linux/i2c-pnx.h
+++ b/include/linux/i2c-pnx.h
@@ -21,7 +21,7 @@ struct i2c_pnx_mif {
21 int mode; /* Interface mode */ 21 int mode; /* Interface mode */
22 struct completion complete; /* I/O completion */ 22 struct completion complete; /* I/O completion */
23 struct timer_list timer; /* Timeout */ 23 struct timer_list timer; /* Timeout */
24 char * buf; /* Data buffer */ 24 u8 * buf; /* Data buffer */
25 int len; /* Length of data buffer */ 25 int len; /* Length of data buffer */
26}; 26};
27 27
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index f4784c0fe975..7b40cda57a70 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -98,7 +98,6 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
98 98
99/** 99/**
100 * struct i2c_driver - represent an I2C device driver 100 * struct i2c_driver - represent an I2C device driver
101 * @id: Unique driver ID (optional)
102 * @class: What kind of i2c device we instantiate (for detect) 101 * @class: What kind of i2c device we instantiate (for detect)
103 * @attach_adapter: Callback for bus addition (for legacy drivers) 102 * @attach_adapter: Callback for bus addition (for legacy drivers)
104 * @detach_adapter: Callback for bus removal (for legacy drivers) 103 * @detach_adapter: Callback for bus removal (for legacy drivers)
@@ -135,7 +134,6 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
135 * not allowed. 134 * not allowed.
136 */ 135 */
137struct i2c_driver { 136struct i2c_driver {
138 int id;
139 unsigned int class; 137 unsigned int class;
140 138
141 /* Notifies the driver that a new bus has appeared or is about to be 139 /* Notifies the driver that a new bus has appeared or is about to be
@@ -363,6 +361,24 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
363 dev_set_drvdata(&dev->dev, data); 361 dev_set_drvdata(&dev->dev, data);
364} 362}
365 363
364/**
365 * i2c_lock_adapter - Prevent access to an I2C bus segment
366 * @adapter: Target I2C bus segment
367 */
368static inline void i2c_lock_adapter(struct i2c_adapter *adapter)
369{
370 mutex_lock(&adapter->bus_lock);
371}
372
373/**
374 * i2c_unlock_adapter - Reauthorize access to an I2C bus segment
375 * @adapter: Target I2C bus segment
376 */
377static inline void i2c_unlock_adapter(struct i2c_adapter *adapter)
378{
379 mutex_unlock(&adapter->bus_lock);
380}
381
366/*flags for the client struct: */ 382/*flags for the client struct: */
367#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ 383#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */
368#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ 384#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */
diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h
new file mode 100644
index 000000000000..fc5db826b48e
--- /dev/null
+++ b/include/linux/i2c/adp5588.h
@@ -0,0 +1,92 @@
1/*
2 * Analog Devices ADP5588 I/O Expander and QWERTY Keypad Controller
3 *
4 * Copyright 2009 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef _ADP5588_H
10#define _ADP5588_H
11
12#define DEV_ID 0x00 /* Device ID */
13#define CFG 0x01 /* Configuration Register1 */
14#define INT_STAT 0x02 /* Interrupt Status Register */
15#define KEY_LCK_EC_STAT 0x03 /* Key Lock and Event Counter Register */
16#define Key_EVENTA 0x04 /* Key Event Register A */
17#define Key_EVENTB 0x05 /* Key Event Register B */
18#define Key_EVENTC 0x06 /* Key Event Register C */
19#define Key_EVENTD 0x07 /* Key Event Register D */
20#define Key_EVENTE 0x08 /* Key Event Register E */
21#define Key_EVENTF 0x09 /* Key Event Register F */
22#define Key_EVENTG 0x0A /* Key Event Register G */
23#define Key_EVENTH 0x0B /* Key Event Register H */
24#define Key_EVENTI 0x0C /* Key Event Register I */
25#define Key_EVENTJ 0x0D /* Key Event Register J */
26#define KP_LCK_TMR 0x0E /* Keypad Lock1 to Lock2 Timer */
27#define UNLOCK1 0x0F /* Unlock Key1 */
28#define UNLOCK2 0x10 /* Unlock Key2 */
29#define GPIO_INT_STAT1 0x11 /* GPIO Interrupt Status */
30#define GPIO_INT_STAT2 0x12 /* GPIO Interrupt Status */
31#define GPIO_INT_STAT3 0x13 /* GPIO Interrupt Status */
32#define GPIO_DAT_STAT1 0x14 /* GPIO Data Status, Read twice to clear */
33#define GPIO_DAT_STAT2 0x15 /* GPIO Data Status, Read twice to clear */
34#define GPIO_DAT_STAT3 0x16 /* GPIO Data Status, Read twice to clear */
35#define GPIO_DAT_OUT1 0x17 /* GPIO DATA OUT */
36#define GPIO_DAT_OUT2 0x18 /* GPIO DATA OUT */
37#define GPIO_DAT_OUT3 0x19 /* GPIO DATA OUT */
38#define GPIO_INT_EN1 0x1A /* GPIO Interrupt Enable */
39#define GPIO_INT_EN2 0x1B /* GPIO Interrupt Enable */
40#define GPIO_INT_EN3 0x1C /* GPIO Interrupt Enable */
41#define KP_GPIO1 0x1D /* Keypad or GPIO Selection */
42#define KP_GPIO2 0x1E /* Keypad or GPIO Selection */
43#define KP_GPIO3 0x1F /* Keypad or GPIO Selection */
44#define GPI_EM1 0x20 /* GPI Event Mode 1 */
45#define GPI_EM2 0x21 /* GPI Event Mode 2 */
46#define GPI_EM3 0x22 /* GPI Event Mode 3 */
47#define GPIO_DIR1 0x23 /* GPIO Data Direction */
48#define GPIO_DIR2 0x24 /* GPIO Data Direction */
49#define GPIO_DIR3 0x25 /* GPIO Data Direction */
50#define GPIO_INT_LVL1 0x26 /* GPIO Edge/Level Detect */
51#define GPIO_INT_LVL2 0x27 /* GPIO Edge/Level Detect */
52#define GPIO_INT_LVL3 0x28 /* GPIO Edge/Level Detect */
53#define Debounce_DIS1 0x29 /* Debounce Disable */
54#define Debounce_DIS2 0x2A /* Debounce Disable */
55#define Debounce_DIS3 0x2B /* Debounce Disable */
56#define GPIO_PULL1 0x2C /* GPIO Pull Disable */
57#define GPIO_PULL2 0x2D /* GPIO Pull Disable */
58#define GPIO_PULL3 0x2E /* GPIO Pull Disable */
59#define CMP_CFG_STAT 0x30 /* Comparator Configuration and Status Register */
60#define CMP_CONFG_SENS1 0x31 /* Sensor1 Comparator Configuration Register */
61#define CMP_CONFG_SENS2 0x32 /* L2 Light Sensor Reference Level, Output Falling for Sensor 1 */
62#define CMP1_LVL2_TRIP 0x33 /* L2 Light Sensor Hysteresis (Active when Output Rising) for Sensor 1 */
63#define CMP1_LVL2_HYS 0x34 /* L3 Light Sensor Reference Level, Output Falling For Sensor 1 */
64#define CMP1_LVL3_TRIP 0x35 /* L3 Light Sensor Hysteresis (Active when Output Rising) For Sensor 1 */
65#define CMP1_LVL3_HYS 0x36 /* Sensor 2 Comparator Configuration Register */
66#define CMP2_LVL2_TRIP 0x37 /* L2 Light Sensor Reference Level, Output Falling for Sensor 2 */
67#define CMP2_LVL2_HYS 0x38 /* L2 Light Sensor Hysteresis (Active when Output Rising) for Sensor 2 */
68#define CMP2_LVL3_TRIP 0x39 /* L3 Light Sensor Reference Level, Output Falling For Sensor 2 */
69#define CMP2_LVL3_HYS 0x3A /* L3 Light Sensor Hysteresis (Active when Output Rising) For Sensor 2 */
70#define CMP1_ADC_DAT_R1 0x3B /* Comparator 1 ADC data Register1 */
71#define CMP1_ADC_DAT_R2 0x3C /* Comparator 1 ADC data Register2 */
72#define CMP2_ADC_DAT_R1 0x3D /* Comparator 2 ADC data Register1 */
73#define CMP2_ADC_DAT_R2 0x3E /* Comparator 2 ADC data Register2 */
74
75#define ADP5588_DEVICE_ID_MASK 0xF
76
77/* Put one of these structures in i2c_board_info platform_data */
78
79#define ADP5588_KEYMAPSIZE 80
80
81struct adp5588_kpad_platform_data {
82 int rows; /* Number of rows */
83 int cols; /* Number of columns */
84 const unsigned short *keymap; /* Pointer to keymap */
85 unsigned short keymapsize; /* Keymap size */
86 unsigned repeat:1; /* Enable key repeat */
87 unsigned en_keylock:1; /* Enable Key Lock feature */
88 unsigned short unlock_key1; /* Unlock Key 1 */
89 unsigned short unlock_key2; /* Unlock Key 2 */
90};
91
92#endif
diff --git a/include/linux/i2c/mcs5000_ts.h b/include/linux/i2c/mcs5000_ts.h
new file mode 100644
index 000000000000..5a117b5ca15e
--- /dev/null
+++ b/include/linux/i2c/mcs5000_ts.h
@@ -0,0 +1,24 @@
1/*
2 * mcs5000_ts.h
3 *
4 * Copyright (C) 2009 Samsung Electronics Co.Ltd
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#ifndef __LINUX_MCS5000_TS_H
15#define __LINUX_MCS5000_TS_H
16
17/* platform data for the MELFAS MCS-5000 touchscreen driver */
18struct mcs5000_ts_platform_data {
19 void (*cfg_pin)(void);
20 int x_size;
21 int y_size;
22};
23
24#endif /* __LINUX_MCS5000_TS_H */
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h
index 0dc80ef24975..508824ee35e6 100644
--- a/include/linux/i2c/twl4030.h
+++ b/include/linux/i2c/twl4030.h
@@ -25,6 +25,9 @@
25#ifndef __TWL4030_H_ 25#ifndef __TWL4030_H_
26#define __TWL4030_H_ 26#define __TWL4030_H_
27 27
28#include <linux/types.h>
29#include <linux/input/matrix_keypad.h>
30
28/* 31/*
29 * Using the twl4030 core we address registers using a pair 32 * Using the twl4030 core we address registers using a pair
30 * { module id, relative register offset } 33 * { module id, relative register offset }
@@ -220,19 +223,28 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
220 223
221/* Power bus message definitions */ 224/* Power bus message definitions */
222 225
223#define DEV_GRP_NULL 0x0 226/* The TWL4030/5030 splits its power-management resources (the various
224#define DEV_GRP_P1 0x1 227 * regulators, clock and reset lines) into 3 processor groups - P1, P2 and
225#define DEV_GRP_P2 0x2 228 * P3. These groups can then be configured to transition between sleep, wait-on
226#define DEV_GRP_P3 0x4 229 * and active states by sending messages to the power bus. See Section 5.4.2
230 * Power Resources of TWL4030 TRM
231 */
227 232
228#define RES_GRP_RES 0x0 233/* Processor groups */
229#define RES_GRP_PP 0x1 234#define DEV_GRP_NULL 0x0
230#define RES_GRP_RC 0x2 235#define DEV_GRP_P1 0x1 /* P1: all OMAP devices */
236#define DEV_GRP_P2 0x2 /* P2: all Modem devices */
237#define DEV_GRP_P3 0x4 /* P3: all peripheral devices */
238
239/* Resource groups */
240#define RES_GRP_RES 0x0 /* Reserved */
241#define RES_GRP_PP 0x1 /* Power providers */
242#define RES_GRP_RC 0x2 /* Reset and control */
231#define RES_GRP_PP_RC 0x3 243#define RES_GRP_PP_RC 0x3
232#define RES_GRP_PR 0x4 244#define RES_GRP_PR 0x4 /* Power references */
233#define RES_GRP_PP_PR 0x5 245#define RES_GRP_PP_PR 0x5
234#define RES_GRP_RC_PR 0x6 246#define RES_GRP_RC_PR 0x6
235#define RES_GRP_ALL 0x7 247#define RES_GRP_ALL 0x7 /* All resource groups */
236 248
237#define RES_TYPE2_R0 0x0 249#define RES_TYPE2_R0 0x0
238 250
@@ -243,6 +255,41 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
243#define RES_STATE_SLEEP 0x8 255#define RES_STATE_SLEEP 0x8
244#define RES_STATE_OFF 0x0 256#define RES_STATE_OFF 0x0
245 257
258/* Power resources */
259
260/* Power providers */
261#define RES_VAUX1 1
262#define RES_VAUX2 2
263#define RES_VAUX3 3
264#define RES_VAUX4 4
265#define RES_VMMC1 5
266#define RES_VMMC2 6
267#define RES_VPLL1 7
268#define RES_VPLL2 8
269#define RES_VSIM 9
270#define RES_VDAC 10
271#define RES_VINTANA1 11
272#define RES_VINTANA2 12
273#define RES_VINTDIG 13
274#define RES_VIO 14
275#define RES_VDD1 15
276#define RES_VDD2 16
277#define RES_VUSB_1V5 17
278#define RES_VUSB_1V8 18
279#define RES_VUSB_3V1 19
280#define RES_VUSBCP 20
281#define RES_REGEN 21
282/* Reset and control */
283#define RES_NRES_PWRON 22
284#define RES_CLKEN 23
285#define RES_SYSEN 24
286#define RES_HFCLKOUT 25
287#define RES_32KCLKOUT 26
288#define RES_RESET 27
289/* Power Reference */
290#define RES_Main_Ref 28
291
292#define TOTAL_RESOURCES 28
246/* 293/*
247 * Power Bus Message Format ... these can be sent individually by Linux, 294 * Power Bus Message Format ... these can be sent individually by Linux,
248 * but are usually part of downloaded scripts that are run when various 295 * but are usually part of downloaded scripts that are run when various
@@ -302,13 +349,17 @@ struct twl4030_madc_platform_data {
302 int irq_line; 349 int irq_line;
303}; 350};
304 351
352/* Boards have uniqe mappings of {row, col} --> keycode.
353 * Column and row are 8 bits each, but range only from 0..7.
354 * a PERSISTENT_KEY is "always on" and never reported.
355 */
356#define PERSISTENT_KEY(r, c) KEY((r), (c), KEY_RESERVED)
357
305struct twl4030_keypad_data { 358struct twl4030_keypad_data {
306 int rows; 359 const struct matrix_keymap_data *keymap_data;
307 int cols; 360 unsigned rows;
308 int *keymap; 361 unsigned cols;
309 int irq; 362 bool rep;
310 unsigned int keymapsize;
311 unsigned int rep:1;
312}; 363};
313 364
314enum twl4030_usb_mode { 365enum twl4030_usb_mode {
@@ -320,6 +371,36 @@ struct twl4030_usb_data {
320 enum twl4030_usb_mode usb_mode; 371 enum twl4030_usb_mode usb_mode;
321}; 372};
322 373
374struct twl4030_ins {
375 u16 pmb_message;
376 u8 delay;
377};
378
379struct twl4030_script {
380 struct twl4030_ins *script;
381 unsigned size;
382 u8 flags;
383#define TWL4030_WRST_SCRIPT (1<<0)
384#define TWL4030_WAKEUP12_SCRIPT (1<<1)
385#define TWL4030_WAKEUP3_SCRIPT (1<<2)
386#define TWL4030_SLEEP_SCRIPT (1<<3)
387};
388
389struct twl4030_resconfig {
390 u8 resource;
391 u8 devgroup; /* Processor group that Power resource belongs to */
392 u8 type; /* Power resource addressed, 6 / broadcast message */
393 u8 type2; /* Power resource addressed, 3 / broadcast message */
394};
395
396struct twl4030_power_data {
397 struct twl4030_script **scripts;
398 unsigned num;
399 struct twl4030_resconfig *resource_config;
400};
401
402extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
403
323struct twl4030_platform_data { 404struct twl4030_platform_data {
324 unsigned irq_base, irq_end; 405 unsigned irq_base, irq_end;
325 struct twl4030_bci_platform_data *bci; 406 struct twl4030_bci_platform_data *bci;
@@ -327,6 +408,7 @@ struct twl4030_platform_data {
327 struct twl4030_madc_platform_data *madc; 408 struct twl4030_madc_platform_data *madc;
328 struct twl4030_keypad_data *keypad; 409 struct twl4030_keypad_data *keypad;
329 struct twl4030_usb_data *usb; 410 struct twl4030_usb_data *usb;
411 struct twl4030_power_data *power;
330 412
331 /* LDO regulators */ 413 /* LDO regulators */
332 struct regulator_init_data *vdac; 414 struct regulator_init_data *vdac;
@@ -357,7 +439,6 @@ int twl4030_sih_setup(int module);
357#define TWL4030_VAUX3_DEV_GRP 0x1F 439#define TWL4030_VAUX3_DEV_GRP 0x1F
358#define TWL4030_VAUX3_DEDICATED 0x22 440#define TWL4030_VAUX3_DEDICATED 0x22
359 441
360
361#if defined(CONFIG_TWL4030_BCI_BATTERY) || \ 442#if defined(CONFIG_TWL4030_BCI_BATTERY) || \
362 defined(CONFIG_TWL4030_BCI_BATTERY_MODULE) 443 defined(CONFIG_TWL4030_BCI_BATTERY_MODULE)
363 extern int twl4030charger_usb_en(int enable); 444 extern int twl4030charger_usb_en(int enable);
diff --git a/include/linux/i8042.h b/include/linux/i8042.h
index 7907a72403ee..60c3360ef6ad 100644
--- a/include/linux/i8042.h
+++ b/include/linux/i8042.h
@@ -7,6 +7,7 @@
7 * the Free Software Foundation. 7 * the Free Software Foundation.
8 */ 8 */
9 9
10#include <linux/types.h>
10 11
11/* 12/*
12 * Standard commands. 13 * Standard commands.
@@ -30,6 +31,35 @@
30#define I8042_CMD_MUX_PFX 0x0090 31#define I8042_CMD_MUX_PFX 0x0090
31#define I8042_CMD_MUX_SEND 0x1090 32#define I8042_CMD_MUX_SEND 0x1090
32 33
34struct serio;
35
36#if defined(CONFIG_SERIO_I8042) || defined(CONFIG_SERIO_I8042_MODULE)
37
38void i8042_lock_chip(void);
39void i8042_unlock_chip(void);
33int i8042_command(unsigned char *param, int command); 40int i8042_command(unsigned char *param, int command);
41bool i8042_check_port_owner(const struct serio *);
42
43#else
44
45void i8042_lock_chip(void)
46{
47}
48
49void i8042_unlock_chip(void)
50{
51}
52
53int i8042_command(unsigned char *param, int command)
54{
55 return -ENOSYS;
56}
57
58bool i8042_check_port_owner(const struct serio *serio)
59{
60 return false;
61}
62
63#endif
34 64
35#endif 65#endif
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index b6a85183c333..c0d8357917e2 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -171,8 +171,6 @@ struct icmp6_filter {
171#ifdef __KERNEL__ 171#ifdef __KERNEL__
172 172
173#include <linux/netdevice.h> 173#include <linux/netdevice.h>
174#include <linux/skbuff.h>
175
176 174
177extern void icmpv6_send(struct sk_buff *skb, 175extern void icmpv6_send(struct sk_buff *skb,
178 u8 type, u8 code, 176 u8 type, u8 code,
diff --git a/include/linux/ide.h b/include/linux/ide.h
index edc93a6d931d..e4135d6e0556 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -258,6 +258,7 @@ enum {
258 IDE_TFLAG_DYN = (1 << 5), 258 IDE_TFLAG_DYN = (1 << 5),
259 IDE_TFLAG_FS = (1 << 6), 259 IDE_TFLAG_FS = (1 << 6),
260 IDE_TFLAG_MULTI_PIO = (1 << 7), 260 IDE_TFLAG_MULTI_PIO = (1 << 7),
261 IDE_TFLAG_SET_XFER = (1 << 8),
261}; 262};
262 263
263enum { 264enum {
@@ -294,7 +295,7 @@ struct ide_cmd {
294 } out, in; 295 } out, in;
295 } valid; 296 } valid;
296 297
297 u8 tf_flags; 298 u16 tf_flags;
298 u8 ftf_flags; /* for TASKFILE ioctl */ 299 u8 ftf_flags; /* for TASKFILE ioctl */
299 int protocol; 300 int protocol;
300 301
@@ -918,8 +919,7 @@ __IDE_PROC_DEVSET(_name, _min, _max, NULL, NULL)
918typedef struct { 919typedef struct {
919 const char *name; 920 const char *name;
920 mode_t mode; 921 mode_t mode;
921 read_proc_t *read_proc; 922 const struct file_operations *proc_fops;
922 write_proc_t *write_proc;
923} ide_proc_entry_t; 923} ide_proc_entry_t;
924 924
925void proc_ide_create(void); 925void proc_ide_create(void);
@@ -931,24 +931,8 @@ void ide_proc_unregister_port(ide_hwif_t *);
931void ide_proc_register_driver(ide_drive_t *, struct ide_driver *); 931void ide_proc_register_driver(ide_drive_t *, struct ide_driver *);
932void ide_proc_unregister_driver(ide_drive_t *, struct ide_driver *); 932void ide_proc_unregister_driver(ide_drive_t *, struct ide_driver *);
933 933
934read_proc_t proc_ide_read_capacity; 934extern const struct file_operations ide_capacity_proc_fops;
935read_proc_t proc_ide_read_geometry; 935extern const struct file_operations ide_geometry_proc_fops;
936
937/*
938 * Standard exit stuff:
939 */
940#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) \
941{ \
942 len -= off; \
943 if (len < count) { \
944 *eof = 1; \
945 if (len <= 0) \
946 return 0; \
947 } else \
948 len = count; \
949 *start = page + off; \
950 return len; \
951}
952#else 936#else
953static inline void proc_ide_create(void) { ; } 937static inline void proc_ide_create(void) { ; }
954static inline void proc_ide_destroy(void) { ; } 938static inline void proc_ide_destroy(void) { ; }
@@ -960,7 +944,6 @@ static inline void ide_proc_register_driver(ide_drive_t *drive,
960 struct ide_driver *driver) { ; } 944 struct ide_driver *driver) { ; }
961static inline void ide_proc_unregister_driver(ide_drive_t *drive, 945static inline void ide_proc_unregister_driver(ide_drive_t *drive,
962 struct ide_driver *driver) { ; } 946 struct ide_driver *driver) { ; }
963#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0;
964#endif 947#endif
965 948
966enum { 949enum {
@@ -1081,6 +1064,7 @@ extern void ide_fixstring(u8 *, const int, const int);
1081 1064
1082int ide_busy_sleep(ide_drive_t *, unsigned long, int); 1065int ide_busy_sleep(ide_drive_t *, unsigned long, int);
1083 1066
1067int __ide_wait_stat(ide_drive_t *, u8, u8, unsigned long, u8 *);
1084int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); 1068int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
1085 1069
1086ide_startstop_t ide_do_park_unpark(ide_drive_t *, struct request *); 1070ide_startstop_t ide_do_park_unpark(ide_drive_t *, struct request *);
@@ -1169,7 +1153,7 @@ int ide_no_data_taskfile(ide_drive_t *, struct ide_cmd *);
1169 1153
1170int ide_taskfile_ioctl(ide_drive_t *, unsigned long); 1154int ide_taskfile_ioctl(ide_drive_t *, unsigned long);
1171 1155
1172int ide_dev_read_id(ide_drive_t *, u8, u16 *); 1156int ide_dev_read_id(ide_drive_t *, u8, u16 *, int);
1173 1157
1174extern int ide_driveid_update(ide_drive_t *); 1158extern int ide_driveid_update(ide_drive_t *);
1175extern int ide_config_drive_speed(ide_drive_t *, u8); 1159extern int ide_config_drive_speed(ide_drive_t *, u8);
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index a9173d5434d1..52e15e079c61 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -115,7 +115,7 @@
115#define IEEE80211_MAX_SSID_LEN 32 115#define IEEE80211_MAX_SSID_LEN 32
116 116
117#define IEEE80211_MAX_MESH_ID_LEN 32 117#define IEEE80211_MAX_MESH_ID_LEN 32
118#define IEEE80211_MESH_CONFIG_LEN 19 118#define IEEE80211_MESH_CONFIG_LEN 24
119 119
120#define IEEE80211_QOS_CTL_LEN 2 120#define IEEE80211_QOS_CTL_LEN 2
121#define IEEE80211_QOS_CTL_TID_MASK 0x000F 121#define IEEE80211_QOS_CTL_TID_MASK 0x000F
@@ -802,6 +802,31 @@ struct ieee80211_ht_cap {
802#define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03 802#define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03
803#define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C 803#define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C
804 804
805/*
806 * Maximum length of AMPDU that the STA can receive.
807 * Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets)
808 */
809enum ieee80211_max_ampdu_length_exp {
810 IEEE80211_HT_MAX_AMPDU_8K = 0,
811 IEEE80211_HT_MAX_AMPDU_16K = 1,
812 IEEE80211_HT_MAX_AMPDU_32K = 2,
813 IEEE80211_HT_MAX_AMPDU_64K = 3
814};
815
816#define IEEE80211_HT_MAX_AMPDU_FACTOR 13
817
818/* Minimum MPDU start spacing */
819enum ieee80211_min_mpdu_spacing {
820 IEEE80211_HT_MPDU_DENSITY_NONE = 0, /* No restriction */
821 IEEE80211_HT_MPDU_DENSITY_0_25 = 1, /* 1/4 usec */
822 IEEE80211_HT_MPDU_DENSITY_0_5 = 2, /* 1/2 usec */
823 IEEE80211_HT_MPDU_DENSITY_1 = 3, /* 1 usec */
824 IEEE80211_HT_MPDU_DENSITY_2 = 4, /* 2 usec */
825 IEEE80211_HT_MPDU_DENSITY_4 = 5, /* 4 usec */
826 IEEE80211_HT_MPDU_DENSITY_8 = 6, /* 8 usec */
827 IEEE80211_HT_MPDU_DENSITY_16 = 7 /* 16 usec */
828};
829
805/** 830/**
806 * struct ieee80211_ht_info - HT information 831 * struct ieee80211_ht_info - HT information
807 * 832 *
@@ -1196,6 +1221,10 @@ enum ieee80211_sa_query_action {
1196#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05 1221#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
1197#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06 1222#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06
1198 1223
1224/* AKM suite selectors */
1225#define WLAN_AKM_SUITE_8021X 0x000FAC01
1226#define WLAN_AKM_SUITE_PSK 0x000FAC02
1227
1199#define WLAN_MAX_KEY_LEN 32 1228#define WLAN_MAX_KEY_LEN 32
1200 1229
1201/** 1230/**
diff --git a/include/linux/if_addr.h b/include/linux/if_addr.h
index a60c821be44c..fd9740466757 100644
--- a/include/linux/if_addr.h
+++ b/include/linux/if_addr.h
@@ -41,6 +41,7 @@ enum
41 41
42#define IFA_F_NODAD 0x02 42#define IFA_F_NODAD 0x02
43#define IFA_F_OPTIMISTIC 0x04 43#define IFA_F_OPTIMISTIC 0x04
44#define IFA_F_DADFAILED 0x08
44#define IFA_F_HOMEADDRESS 0x10 45#define IFA_F_HOMEADDRESS 0x10
45#define IFA_F_DEPRECATED 0x20 46#define IFA_F_DEPRECATED 0x20
46#define IFA_F_TENTATIVE 0x40 47#define IFA_F_TENTATIVE 0x40
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index b554300ef8bf..282eb37e2dec 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -87,7 +87,6 @@
87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ 87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */
88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ 88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */
89#define ARPHRD_IEEE802154 804 89#define ARPHRD_IEEE802154 804
90#define ARPHRD_IEEE802154_PHY 805
91 90
92#define ARPHRD_PHONET 820 /* PhoNet media type */ 91#define ARPHRD_PHONET 820 /* PhoNet media type */
93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ 92#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 70fdba2bbf71..580b6004d00e 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -139,10 +139,10 @@ extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
139/* 139/*
140 * Display a 6 byte device address (MAC) in a readable format. 140 * Display a 6 byte device address (MAC) in a readable format.
141 */ 141 */
142extern char *print_mac(char *buf, const unsigned char *addr); 142extern char *print_mac(char *buf, const unsigned char *addr) __deprecated;
143#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" 143#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
144#define MAC_BUF_SIZE 18 144#define MAC_BUF_SIZE 18
145#define DECLARE_MAC_BUF(var) char var[MAC_BUF_SIZE] __maybe_unused 145#define DECLARE_MAC_BUF(var) char var[MAC_BUF_SIZE]
146 146
147#endif 147#endif
148 148
diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h
index 673f2209453d..80b3a1056a5f 100644
--- a/include/linux/if_frad.h
+++ b/include/linux/if_frad.h
@@ -69,11 +69,6 @@ struct dlci_conf {
69 69
70#define DLCI_VALID_FLAGS 0x000B 70#define DLCI_VALID_FLAGS 0x000B
71 71
72/* FRAD driver uses these to indicate what it did with packet */
73#define DLCI_RET_OK 0x00
74#define DLCI_RET_ERR 0x01
75#define DLCI_RET_DROP 0x02
76
77/* defines for the actual Frame Relay hardware */ 72/* defines for the actual Frame Relay hardware */
78#define FRAD_GET_CONF (SIOCDEVPRIVATE) 73#define FRAD_GET_CONF (SIOCDEVPRIVATE)
79#define FRAD_SET_CONF (SIOCDEVPRIVATE + 1) 74#define FRAD_SET_CONF (SIOCDEVPRIVATE + 1)
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 915ba5789f0e..3f5fd523b49d 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -62,6 +62,7 @@
62#define TUN_F_TSO4 0x02 /* I can handle TSO for IPv4 packets */ 62#define TUN_F_TSO4 0x02 /* I can handle TSO for IPv4 packets */
63#define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */ 63#define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */
64#define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */ 64#define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */
65#define TUN_F_UFO 0x10 /* I can handle UFO packets */
65 66
66/* Protocol info prepended to the packets (when IFF_NO_PI is not set) */ 67/* Protocol info prepended to the packets (when IFF_NO_PI is not set) */
67#define TUN_PKT_STRIP 0x0001 68#define TUN_PKT_STRIP 0x0001
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 5eb9b0f857e0..5a9aae4adb44 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -44,7 +44,7 @@ struct ip_tunnel_prl {
44 __u16 flags; 44 __u16 flags;
45 __u16 __reserved; 45 __u16 __reserved;
46 __u32 datalen; 46 __u32 datalen;
47 __u32 rs_delay; 47 __u32 __reserved2;
48 /* data follows */ 48 /* data follows */
49}; 49};
50 50
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 92fbd8cbd68f..fe158e0e20e6 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -233,6 +233,8 @@ extern void ip_mc_init_dev(struct in_device *);
233extern void ip_mc_destroy_dev(struct in_device *); 233extern void ip_mc_destroy_dev(struct in_device *);
234extern void ip_mc_up(struct in_device *); 234extern void ip_mc_up(struct in_device *);
235extern void ip_mc_down(struct in_device *); 235extern void ip_mc_down(struct in_device *);
236extern void ip_mc_unmap(struct in_device *);
237extern void ip_mc_remap(struct in_device *);
236extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr); 238extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr);
237extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr); 239extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr);
238extern void ip_mc_rejoin_group(struct ip_mc_list *im); 240extern void ip_mc_rejoin_group(struct ip_mc_list *im);
diff --git a/include/linux/init.h b/include/linux/init.h
index 13b633ed695e..ff8bde520d03 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -103,8 +103,8 @@
103#define __INIT .section ".init.text","ax" 103#define __INIT .section ".init.text","ax"
104#define __FINIT .previous 104#define __FINIT .previous
105 105
106#define __INITDATA .section ".init.data","aw" 106#define __INITDATA .section ".init.data","aw",%progbits
107#define __INITRODATA .section ".init.rodata","a" 107#define __INITRODATA .section ".init.rodata","a",%progbits
108#define __FINITDATA .previous 108#define __FINITDATA .previous
109 109
110#define __DEVINIT .section ".devinit.text", "ax" 110#define __DEVINIT .section ".devinit.text", "ax"
@@ -271,6 +271,7 @@ void __init parse_early_options(char *cmdline);
271#else /* MODULE */ 271#else /* MODULE */
272 272
273/* Don't use these in modules, but some people do... */ 273/* Don't use these in modules, but some people do... */
274#define early_initcall(fn) module_init(fn)
274#define core_initcall(fn) module_init(fn) 275#define core_initcall(fn) module_init(fn)
275#define postcore_initcall(fn) module_init(fn) 276#define postcore_initcall(fn) module_init(fn)
276#define arch_initcall(fn) module_init(fn) 277#define arch_initcall(fn) module_init(fn)
@@ -305,9 +306,17 @@ void __init parse_early_options(char *cmdline);
305#ifdef CONFIG_MODULES 306#ifdef CONFIG_MODULES
306#define __init_or_module 307#define __init_or_module
307#define __initdata_or_module 308#define __initdata_or_module
309#define __initconst_or_module
310#define __INIT_OR_MODULE .text
311#define __INITDATA_OR_MODULE .data
312#define __INITRODATA_OR_MODULE .section ".rodata","a",%progbits
308#else 313#else
309#define __init_or_module __init 314#define __init_or_module __init
310#define __initdata_or_module __initdata 315#define __initdata_or_module __initdata
316#define __initconst_or_module __initconst
317#define __INIT_OR_MODULE __INIT
318#define __INITDATA_OR_MODULE __INITDATA
319#define __INITRODATA_OR_MODULE __INITRODATA
311#endif /*CONFIG_MODULES*/ 320#endif /*CONFIG_MODULES*/
312 321
313/* Functions marked as __devexit may be discarded at kernel link time, depending 322/* Functions marked as __devexit may be discarded at kernel link time, depending
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 7fc01b13be43..21a6f5d9af22 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -94,15 +94,25 @@ extern struct group_info init_groups;
94# define CAP_INIT_BSET CAP_INIT_EFF_SET 94# define CAP_INIT_BSET CAP_INIT_EFF_SET
95#endif 95#endif
96 96
97#ifdef CONFIG_TREE_PREEMPT_RCU
98#define INIT_TASK_RCU_PREEMPT(tsk) \
99 .rcu_read_lock_nesting = 0, \
100 .rcu_read_unlock_special = 0, \
101 .rcu_blocked_node = NULL, \
102 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry),
103#else
104#define INIT_TASK_RCU_PREEMPT(tsk)
105#endif
106
97extern struct cred init_cred; 107extern struct cred init_cred;
98 108
99#ifdef CONFIG_PERF_COUNTERS 109#ifdef CONFIG_PERF_EVENTS
100# define INIT_PERF_COUNTERS(tsk) \ 110# define INIT_PERF_EVENTS(tsk) \
101 .perf_counter_mutex = \ 111 .perf_event_mutex = \
102 __MUTEX_INITIALIZER(tsk.perf_counter_mutex), \ 112 __MUTEX_INITIALIZER(tsk.perf_event_mutex), \
103 .perf_counter_list = LIST_HEAD_INIT(tsk.perf_counter_list), 113 .perf_event_list = LIST_HEAD_INIT(tsk.perf_event_list),
104#else 114#else
105# define INIT_PERF_COUNTERS(tsk) 115# define INIT_PERF_EVENTS(tsk)
106#endif 116#endif
107 117
108/* 118/*
@@ -168,11 +178,12 @@ extern struct cred init_cred;
168 }, \ 178 }, \
169 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \ 179 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
170 INIT_IDS \ 180 INIT_IDS \
171 INIT_PERF_COUNTERS(tsk) \ 181 INIT_PERF_EVENTS(tsk) \
172 INIT_TRACE_IRQFLAGS \ 182 INIT_TRACE_IRQFLAGS \
173 INIT_LOCKDEP \ 183 INIT_LOCKDEP \
174 INIT_FTRACE_GRAPH \ 184 INIT_FTRACE_GRAPH \
175 INIT_TRACE_RECURSION \ 185 INIT_TRACE_RECURSION \
186 INIT_TASK_RCU_PREEMPT(tsk) \
176} 187}
177 188
178 189
diff --git a/include/linux/input.h b/include/linux/input.h
index 8b3bc3e0d146..c2b1a7d244d9 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1123,7 +1123,7 @@ struct input_dev {
1123 struct mutex mutex; 1123 struct mutex mutex;
1124 1124
1125 unsigned int users; 1125 unsigned int users;
1126 int going_away; 1126 bool going_away;
1127 1127
1128 struct device dev; 1128 struct device dev;
1129 1129
@@ -1377,6 +1377,10 @@ extern struct class input_class;
1377 * methods; erase() is optional. set_gain() and set_autocenter() need 1377 * methods; erase() is optional. set_gain() and set_autocenter() need
1378 * only be implemented if driver sets up FF_GAIN and FF_AUTOCENTER 1378 * only be implemented if driver sets up FF_GAIN and FF_AUTOCENTER
1379 * bits. 1379 * bits.
1380 *
1381 * Note that playback(), set_gain() and set_autocenter() are called with
1382 * dev->event_lock spinlock held and interrupts off and thus may not
1383 * sleep.
1380 */ 1384 */
1381struct ff_device { 1385struct ff_device {
1382 int (*upload)(struct input_dev *dev, struct ff_effect *effect, 1386 int (*upload)(struct input_dev *dev, struct ff_effect *effect,
diff --git a/include/linux/input/eeti_ts.h b/include/linux/input/eeti_ts.h
new file mode 100644
index 000000000000..f875b316249d
--- /dev/null
+++ b/include/linux/input/eeti_ts.h
@@ -0,0 +1,9 @@
1#ifndef LINUX_INPUT_EETI_TS_H
2#define LINUX_INPUT_EETI_TS_H
3
4struct eeti_ts_platform_data {
5 unsigned int irq_active_high;
6};
7
8#endif /* LINUX_INPUT_EETI_TS_H */
9
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
index 15d5903af2dd..b3cd42d50e16 100644
--- a/include/linux/input/matrix_keypad.h
+++ b/include/linux/input/matrix_keypad.h
@@ -63,4 +63,36 @@ struct matrix_keypad_platform_data {
63 bool wakeup; 63 bool wakeup;
64}; 64};
65 65
66/**
67 * matrix_keypad_build_keymap - convert platform keymap into matrix keymap
68 * @keymap_data: keymap supplied by the platform code
69 * @row_shift: number of bits to shift row value by to advance to the next
70 * line in the keymap
71 * @keymap: expanded version of keymap that is suitable for use by
72 * matrix keyboad driver
73 * @keybit: pointer to bitmap of keys supported by input device
74 *
75 * This function converts platform keymap (encoded with KEY() macro) into
76 * an array of keycodes that is suitable for using in a standard matrix
77 * keyboard driver that uses row and col as indices.
78 */
79static inline void
80matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
81 unsigned int row_shift,
82 unsigned short *keymap, unsigned long *keybit)
83{
84 int i;
85
86 for (i = 0; i < keymap_data->keymap_size; i++) {
87 unsigned int key = keymap_data->keymap[i];
88 unsigned int row = KEY_ROW(key);
89 unsigned int col = KEY_COL(key);
90 unsigned short code = KEY_VAL(key);
91
92 keymap[MATRIX_SCAN_CODE(row, col, row_shift)] = code;
93 __set_bit(code, keybit);
94 }
95 __clear_bit(KEY_RESERVED, keybit);
96}
97
66#endif /* _MATRIX_KEYPAD_H */ 98#endif /* _MATRIX_KEYPAD_H */
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 482dc91fd53a..4f0a72a9740c 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -360,4 +360,6 @@ extern void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 qdep,
360 360
361extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); 361extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
362 362
363extern int dmar_ir_support(void);
364
363#endif 365#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 35e7df1e9f30..7ca72b74eec7 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -10,7 +10,6 @@
10#include <linux/irqreturn.h> 10#include <linux/irqreturn.h>
11#include <linux/irqnr.h> 11#include <linux/irqnr.h>
12#include <linux/hardirq.h> 12#include <linux/hardirq.h>
13#include <linux/sched.h>
14#include <linux/irqflags.h> 13#include <linux/irqflags.h>
15#include <linux/smp.h> 14#include <linux/smp.h>
16#include <linux/percpu.h> 15#include <linux/percpu.h>
@@ -50,6 +49,9 @@
50 * IRQF_IRQPOLL - Interrupt is used for polling (only the interrupt that is 49 * IRQF_IRQPOLL - Interrupt is used for polling (only the interrupt that is
51 * registered first in an shared interrupt is considered for 50 * registered first in an shared interrupt is considered for
52 * performance reasons) 51 * performance reasons)
52 * IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished.
53 * Used by threaded interrupts which need to keep the
54 * irq line disabled until the threaded handler has been run.
53 */ 55 */
54#define IRQF_DISABLED 0x00000020 56#define IRQF_DISABLED 0x00000020
55#define IRQF_SAMPLE_RANDOM 0x00000040 57#define IRQF_SAMPLE_RANDOM 0x00000040
@@ -59,6 +61,7 @@
59#define IRQF_PERCPU 0x00000400 61#define IRQF_PERCPU 0x00000400
60#define IRQF_NOBALANCING 0x00000800 62#define IRQF_NOBALANCING 0x00000800
61#define IRQF_IRQPOLL 0x00001000 63#define IRQF_IRQPOLL 0x00001000
64#define IRQF_ONESHOT 0x00002000
62 65
63/* 66/*
64 * Bits used by threaded handlers: 67 * Bits used by threaded handlers:
@@ -80,7 +83,6 @@ typedef irqreturn_t (*irq_handler_t)(int, void *);
80 * struct irqaction - per interrupt action descriptor 83 * struct irqaction - per interrupt action descriptor
81 * @handler: interrupt handler function 84 * @handler: interrupt handler function
82 * @flags: flags (see IRQF_* above) 85 * @flags: flags (see IRQF_* above)
83 * @mask: no comment as it is useless and about to be removed
84 * @name: name of the device 86 * @name: name of the device
85 * @dev_id: cookie to identify the device 87 * @dev_id: cookie to identify the device
86 * @next: pointer to the next irqaction for shared interrupts 88 * @next: pointer to the next irqaction for shared interrupts
@@ -93,7 +95,6 @@ typedef irqreturn_t (*irq_handler_t)(int, void *);
93struct irqaction { 95struct irqaction {
94 irq_handler_t handler; 96 irq_handler_t handler;
95 unsigned long flags; 97 unsigned long flags;
96 cpumask_t mask;
97 const char *name; 98 const char *name;
98 void *dev_id; 99 void *dev_id;
99 struct irqaction *next; 100 struct irqaction *next;
@@ -344,6 +345,7 @@ enum
344 NET_TX_SOFTIRQ, 345 NET_TX_SOFTIRQ,
345 NET_RX_SOFTIRQ, 346 NET_RX_SOFTIRQ,
346 BLOCK_SOFTIRQ, 347 BLOCK_SOFTIRQ,
348 BLOCK_IOPOLL_SOFTIRQ,
347 TASKLET_SOFTIRQ, 349 TASKLET_SOFTIRQ,
348 SCHED_SOFTIRQ, 350 SCHED_SOFTIRQ,
349 HRTIMER_SOFTIRQ, 351 HRTIMER_SOFTIRQ,
@@ -607,6 +609,7 @@ extern void debug_poll_all_shared_irqs(void);
607static inline void debug_poll_all_shared_irqs(void) { } 609static inline void debug_poll_all_shared_irqs(void) { }
608#endif 610#endif
609 611
612struct seq_file;
610int show_interrupts(struct seq_file *p, void *v); 613int show_interrupts(struct seq_file *p, void *v);
611 614
612struct irq_desc; 615struct irq_desc;
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index 0adb0f91568c..97eb928b4924 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -49,23 +49,30 @@ static inline struct io_mapping *
49io_mapping_create_wc(resource_size_t base, unsigned long size) 49io_mapping_create_wc(resource_size_t base, unsigned long size)
50{ 50{
51 struct io_mapping *iomap; 51 struct io_mapping *iomap;
52 52 pgprot_t prot;
53 if (!is_io_mapping_possible(base, size))
54 return NULL;
55 53
56 iomap = kmalloc(sizeof(*iomap), GFP_KERNEL); 54 iomap = kmalloc(sizeof(*iomap), GFP_KERNEL);
57 if (!iomap) 55 if (!iomap)
58 return NULL; 56 goto out_err;
57
58 if (iomap_create_wc(base, size, &prot))
59 goto out_free;
59 60
60 iomap->base = base; 61 iomap->base = base;
61 iomap->size = size; 62 iomap->size = size;
62 iomap->prot = pgprot_writecombine(__pgprot(__PAGE_KERNEL)); 63 iomap->prot = prot;
63 return iomap; 64 return iomap;
65
66out_free:
67 kfree(iomap);
68out_err:
69 return NULL;
64} 70}
65 71
66static inline void 72static inline void
67io_mapping_free(struct io_mapping *mapping) 73io_mapping_free(struct io_mapping *mapping)
68{ 74{
75 iomap_free(mapping->base, mapping->size);
69 kfree(mapping); 76 kfree(mapping);
70} 77}
71 78
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 786e7b8cece9..83aa81297ea3 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -184,5 +184,9 @@ extern void __devm_release_region(struct device *dev, struct resource *parent,
184extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size); 184extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size);
185extern int iomem_is_exclusive(u64 addr); 185extern int iomem_is_exclusive(u64 addr);
186 186
187extern int
188walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
189 void *arg, int (*func)(unsigned long, unsigned long, void *));
190
187#endif /* __ASSEMBLY__ */ 191#endif /* __ASSEMBLY__ */
188#endif /* _LINUX_IOPORT_H */ 192#endif /* _LINUX_IOPORT_H */
diff --git a/include/linux/iova.h b/include/linux/iova.h
index 228f6c94b69c..76a0759e88ec 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -28,7 +28,6 @@ struct iova {
28 28
29/* holds all the iova translations for a domain */ 29/* holds all the iova translations for a domain */
30struct iova_domain { 30struct iova_domain {
31 spinlock_t iova_alloc_lock;/* Lock to protect iova allocation */
32 spinlock_t iova_rbtree_lock; /* Lock to protect update of rbtree */ 31 spinlock_t iova_rbtree_lock; /* Lock to protect update of rbtree */
33 struct rb_root rbroot; /* iova domain rbtree root */ 32 struct rb_root rbroot; /* iova domain rbtree root */
34 struct rb_node *cached32_node; /* Save last alloced node */ 33 struct rb_node *cached32_node; /* Save last alloced node */
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index b8826107b518..3b1594d662b0 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -78,8 +78,6 @@ struct ipc_kludge {
78#define IPCCALL(version,op) ((version)<<16 | (op)) 78#define IPCCALL(version,op) ((version)<<16 | (op))
79 79
80#ifdef __KERNEL__ 80#ifdef __KERNEL__
81
82#include <linux/kref.h>
83#include <linux/spinlock.h> 81#include <linux/spinlock.h>
84 82
85#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */ 83#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index cb2e77a3f7f7..ae9653dbcd78 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -69,6 +69,8 @@ typedef void (*irq_flow_handler_t)(unsigned int irq,
69#define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */ 69#define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */
70#define IRQ_AFFINITY_SET 0x02000000 /* IRQ affinity was set from userspace*/ 70#define IRQ_AFFINITY_SET 0x02000000 /* IRQ affinity was set from userspace*/
71#define IRQ_SUSPENDED 0x04000000 /* IRQ has gone through suspend sequence */ 71#define IRQ_SUSPENDED 0x04000000 /* IRQ has gone through suspend sequence */
72#define IRQ_ONESHOT 0x08000000 /* IRQ is not unmasked after hardirq */
73#define IRQ_NESTED_THREAD 0x10000000 /* IRQ is nested into another, no own handler thread */
72 74
73#ifdef CONFIG_IRQ_PER_CPU 75#ifdef CONFIG_IRQ_PER_CPU
74# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) 76# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
@@ -100,6 +102,9 @@ struct msi_desc;
100 * @set_type: set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ 102 * @set_type: set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ
101 * @set_wake: enable/disable power-management wake-on of an IRQ 103 * @set_wake: enable/disable power-management wake-on of an IRQ
102 * 104 *
105 * @bus_lock: function to lock access to slow bus (i2c) chips
106 * @bus_sync_unlock: function to sync and unlock slow bus (i2c) chips
107 *
103 * @release: release function solely used by UML 108 * @release: release function solely used by UML
104 * @typename: obsoleted by name, kept as migration helper 109 * @typename: obsoleted by name, kept as migration helper
105 */ 110 */
@@ -123,6 +128,9 @@ struct irq_chip {
123 int (*set_type)(unsigned int irq, unsigned int flow_type); 128 int (*set_type)(unsigned int irq, unsigned int flow_type);
124 int (*set_wake)(unsigned int irq, unsigned int on); 129 int (*set_wake)(unsigned int irq, unsigned int on);
125 130
131 void (*bus_lock)(unsigned int irq);
132 void (*bus_sync_unlock)(unsigned int irq);
133
126 /* Currently used only by UML, might disappear one day.*/ 134 /* Currently used only by UML, might disappear one day.*/
127#ifdef CONFIG_IRQ_RELEASE_METHOD 135#ifdef CONFIG_IRQ_RELEASE_METHOD
128 void (*release)(unsigned int irq, void *dev_id); 136 void (*release)(unsigned int irq, void *dev_id);
@@ -220,13 +228,6 @@ static inline struct irq_desc *move_irq_desc(struct irq_desc *desc, int node)
220extern struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node); 228extern struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node);
221 229
222/* 230/*
223 * Migration helpers for obsolete names, they will go away:
224 */
225#define hw_interrupt_type irq_chip
226#define no_irq_type no_irq_chip
227typedef struct irq_desc irq_desc_t;
228
229/*
230 * Pick up the arch-dependent methods: 231 * Pick up the arch-dependent methods:
231 */ 232 */
232#include <asm/hw_irq.h> 233#include <asm/hw_irq.h>
@@ -289,6 +290,7 @@ extern void handle_edge_irq(unsigned int irq, struct irq_desc *desc);
289extern void handle_simple_irq(unsigned int irq, struct irq_desc *desc); 290extern void handle_simple_irq(unsigned int irq, struct irq_desc *desc);
290extern void handle_percpu_irq(unsigned int irq, struct irq_desc *desc); 291extern void handle_percpu_irq(unsigned int irq, struct irq_desc *desc);
291extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc); 292extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc);
293extern void handle_nested_irq(unsigned int irq);
292 294
293/* 295/*
294 * Monolithic do_IRQ implementation. 296 * Monolithic do_IRQ implementation.
@@ -379,6 +381,8 @@ set_irq_chained_handler(unsigned int irq,
379 __set_irq_handler(irq, handle, 1, NULL); 381 __set_irq_handler(irq, handle, 1, NULL);
380} 382}
381 383
384extern void set_irq_nested_thread(unsigned int irq, int nest);
385
382extern void set_irq_noprobe(unsigned int irq); 386extern void set_irq_noprobe(unsigned int irq);
383extern void set_irq_probe(unsigned int irq); 387extern void set_irq_probe(unsigned int irq);
384 388
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h
index ec87b212ff7d..7bf89bc8cbca 100644
--- a/include/linux/irqnr.h
+++ b/include/linux/irqnr.h
@@ -41,6 +41,12 @@ extern struct irq_desc *irq_to_desc(unsigned int irq);
41 ; \ 41 ; \
42 else 42 else
43 43
44#ifdef CONFIG_SMP
45#define irq_node(irq) (irq_to_desc(irq)->node)
46#else
47#define irq_node(irq) 0
48#endif
49
44#endif /* CONFIG_GENERIC_HARDIRQS */ 50#endif /* CONFIG_GENERIC_HARDIRQS */
45 51
46#define for_each_irq_nr(irq) \ 52#define for_each_irq_nr(irq) \
diff --git a/include/linux/isdn/hdlc.h b/include/linux/isdn/hdlc.h
new file mode 100644
index 000000000000..4b3ecc40889a
--- /dev/null
+++ b/include/linux/isdn/hdlc.h
@@ -0,0 +1,82 @@
1/*
2 * hdlc.h -- General purpose ISDN HDLC decoder.
3 *
4 * Implementation of a HDLC decoder/encoder in software.
5 * Neccessary because some ISDN devices don't have HDLC
6 * controllers.
7 *
8 * Copyright (C)
9 * 2009 Karsten Keil <keil@b1-systems.de>
10 * 2002 Wolfgang Mües <wolfgang@iksw-muees.de>
11 * 2001 Frode Isaksen <fisaksen@bewan.com>
12 * 2001 Kai Germaschewski <kai.germaschewski@gmx.de>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29#ifndef __ISDNHDLC_H__
30#define __ISDNHDLC_H__
31
32struct isdnhdlc_vars {
33 int bit_shift;
34 int hdlc_bits1;
35 int data_bits;
36 int ffbit_shift; /* encoding only */
37 int state;
38 int dstpos;
39
40 u16 crc;
41
42 u8 cbin;
43 u8 shift_reg;
44 u8 ffvalue;
45
46 /* set if transferring data */
47 u32 data_received:1;
48 /* set if D channel (send idle instead of flags) */
49 u32 dchannel:1;
50 /* set if 56K adaptation */
51 u32 do_adapt56:1;
52 /* set if in closing phase (need to send CRC + flag) */
53 u32 do_closing:1;
54 /* set if data is bitreverse */
55 u32 do_bitreverse:1;
56};
57
58/* Feature Flags */
59#define HDLC_56KBIT 0x01
60#define HDLC_DCHANNEL 0x02
61#define HDLC_BITREVERSE 0x04
62
63/*
64 The return value from isdnhdlc_decode is
65 the frame length, 0 if no complete frame was decoded,
66 or a negative error number
67*/
68#define HDLC_FRAMING_ERROR 1
69#define HDLC_CRC_ERROR 2
70#define HDLC_LENGTH_ERROR 3
71
72extern void isdnhdlc_rcv_init(struct isdnhdlc_vars *hdlc, u32 features);
73
74extern int isdnhdlc_decode(struct isdnhdlc_vars *hdlc, const u8 *src,
75 int slen, int *count, u8 *dst, int dsize);
76
77extern void isdnhdlc_out_init(struct isdnhdlc_vars *hdlc, u32 features);
78
79extern int isdnhdlc_encode(struct isdnhdlc_vars *hdlc, const u8 *src,
80 u16 slen, int *count, u8 *dst, int dsize);
81
82#endif /* __ISDNHDLC_H__ */
diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h
index 4c218ee7587a..8687a7dc0632 100644
--- a/include/linux/isdn_ppp.h
+++ b/include/linux/isdn_ppp.h
@@ -157,7 +157,7 @@ typedef struct {
157 157
158typedef struct { 158typedef struct {
159 int mp_mrru; /* unused */ 159 int mp_mrru; /* unused */
160 struct sk_buff_head frags; /* fragments sl list */ 160 struct sk_buff * frags; /* fragments sl list -- use skb->next */
161 long frames; /* number of frames in the frame list */ 161 long frames; /* number of frames in the frame list */
162 unsigned int seq; /* last processed packet seq #: any packets 162 unsigned int seq; /* last processed packet seq #: any packets
163 * with smaller seq # will be dropped 163 * with smaller seq # will be dropped
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index c2049a04fa0b..331530cd3cc6 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -446,7 +446,7 @@ struct transaction_s
446 /* 446 /*
447 * Where in the log does this transaction's commit start? [no locking] 447 * Where in the log does this transaction's commit start? [no locking]
448 */ 448 */
449 unsigned long t_log_start; 449 unsigned int t_log_start;
450 450
451 /* Number of buffers on the t_buffers list [j_list_lock] */ 451 /* Number of buffers on the t_buffers list [j_list_lock] */
452 int t_nr_buffers; 452 int t_nr_buffers;
@@ -556,7 +556,7 @@ struct transaction_s
556 * This transaction is being forced and some process is 556 * This transaction is being forced and some process is
557 * waiting for it to finish. 557 * waiting for it to finish.
558 */ 558 */
559 int t_synchronous_commit:1; 559 unsigned int t_synchronous_commit:1;
560}; 560};
561 561
562/** 562/**
@@ -701,26 +701,26 @@ struct journal_s
701 * Journal head: identifies the first unused block in the journal. 701 * Journal head: identifies the first unused block in the journal.
702 * [j_state_lock] 702 * [j_state_lock]
703 */ 703 */
704 unsigned long j_head; 704 unsigned int j_head;
705 705
706 /* 706 /*
707 * Journal tail: identifies the oldest still-used block in the journal. 707 * Journal tail: identifies the oldest still-used block in the journal.
708 * [j_state_lock] 708 * [j_state_lock]
709 */ 709 */
710 unsigned long j_tail; 710 unsigned int j_tail;
711 711
712 /* 712 /*
713 * Journal free: how many free blocks are there in the journal? 713 * Journal free: how many free blocks are there in the journal?
714 * [j_state_lock] 714 * [j_state_lock]
715 */ 715 */
716 unsigned long j_free; 716 unsigned int j_free;
717 717
718 /* 718 /*
719 * Journal start and end: the block numbers of the first usable block 719 * Journal start and end: the block numbers of the first usable block
720 * and one beyond the last usable block in the journal. [j_state_lock] 720 * and one beyond the last usable block in the journal. [j_state_lock]
721 */ 721 */
722 unsigned long j_first; 722 unsigned int j_first;
723 unsigned long j_last; 723 unsigned int j_last;
724 724
725 /* 725 /*
726 * Device, blocksize and starting block offset for the location where we 726 * Device, blocksize and starting block offset for the location where we
@@ -728,7 +728,7 @@ struct journal_s
728 */ 728 */
729 struct block_device *j_dev; 729 struct block_device *j_dev;
730 int j_blocksize; 730 int j_blocksize;
731 unsigned long j_blk_offset; 731 unsigned int j_blk_offset;
732 732
733 /* 733 /*
734 * Device which holds the client fs. For internal journal this will be 734 * Device which holds the client fs. For internal journal this will be
@@ -859,7 +859,7 @@ extern void __journal_clean_data_list(transaction_t *transaction);
859 859
860/* Log buffer allocation */ 860/* Log buffer allocation */
861extern struct journal_head * journal_get_descriptor_buffer(journal_t *); 861extern struct journal_head * journal_get_descriptor_buffer(journal_t *);
862int journal_next_log_block(journal_t *, unsigned long *); 862int journal_next_log_block(journal_t *, unsigned int *);
863 863
864/* Commit management */ 864/* Commit management */
865extern void journal_commit_transaction(journal_t *); 865extern void journal_commit_transaction(journal_t *);
@@ -874,7 +874,7 @@ extern int
874journal_write_metadata_buffer(transaction_t *transaction, 874journal_write_metadata_buffer(transaction_t *transaction,
875 struct journal_head *jh_in, 875 struct journal_head *jh_in,
876 struct journal_head **jh_out, 876 struct journal_head **jh_out,
877 unsigned long blocknr); 877 unsigned int blocknr);
878 878
879/* Transaction locking */ 879/* Transaction locking */
880extern void __wait_on_journal (journal_t *); 880extern void __wait_on_journal (journal_t *);
@@ -942,7 +942,7 @@ extern void journal_abort (journal_t *, int);
942extern int journal_errno (journal_t *); 942extern int journal_errno (journal_t *);
943extern void journal_ack_err (journal_t *); 943extern void journal_ack_err (journal_t *);
944extern int journal_clear_err (journal_t *); 944extern int journal_clear_err (journal_t *);
945extern int journal_bmap(journal_t *, unsigned long, unsigned long *); 945extern int journal_bmap(journal_t *, unsigned int, unsigned int *);
946extern int journal_force_commit(journal_t *); 946extern int journal_force_commit(journal_t *);
947 947
948/* 948/*
@@ -976,14 +976,14 @@ extern int journal_init_revoke_caches(void);
976 976
977extern void journal_destroy_revoke(journal_t *); 977extern void journal_destroy_revoke(journal_t *);
978extern int journal_revoke (handle_t *, 978extern int journal_revoke (handle_t *,
979 unsigned long, struct buffer_head *); 979 unsigned int, struct buffer_head *);
980extern int journal_cancel_revoke(handle_t *, struct journal_head *); 980extern int journal_cancel_revoke(handle_t *, struct journal_head *);
981extern void journal_write_revoke_records(journal_t *, 981extern void journal_write_revoke_records(journal_t *,
982 transaction_t *, int); 982 transaction_t *, int);
983 983
984/* Recovery revoke support */ 984/* Recovery revoke support */
985extern int journal_set_revoke(journal_t *, unsigned long, tid_t); 985extern int journal_set_revoke(journal_t *, unsigned int, tid_t);
986extern int journal_test_revoke(journal_t *, unsigned long, tid_t); 986extern int journal_test_revoke(journal_t *, unsigned int, tid_t);
987extern void journal_clear_revoke(journal_t *); 987extern void journal_clear_revoke(journal_t *);
988extern void journal_switch_revoke_table(journal_t *journal); 988extern void journal_switch_revoke_table(journal_t *journal);
989 989
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index d97eb652d6ca..f1011f7f3d41 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -464,9 +464,9 @@ struct handle_s
464 */ 464 */
465struct transaction_chp_stats_s { 465struct transaction_chp_stats_s {
466 unsigned long cs_chp_time; 466 unsigned long cs_chp_time;
467 unsigned long cs_forced_to_close; 467 __u32 cs_forced_to_close;
468 unsigned long cs_written; 468 __u32 cs_written;
469 unsigned long cs_dropped; 469 __u32 cs_dropped;
470}; 470};
471 471
472/* The transaction_t type is the guts of the journaling mechanism. It 472/* The transaction_t type is the guts of the journaling mechanism. It
@@ -652,7 +652,7 @@ struct transaction_s
652 * This transaction is being forced and some process is 652 * This transaction is being forced and some process is
653 * waiting for it to finish. 653 * waiting for it to finish.
654 */ 654 */
655 int t_synchronous_commit:1; 655 unsigned int t_synchronous_commit:1;
656 656
657 /* 657 /*
658 * For use by the filesystem to store fs-specific data 658 * For use by the filesystem to store fs-specific data
@@ -668,23 +668,16 @@ struct transaction_run_stats_s {
668 unsigned long rs_flushing; 668 unsigned long rs_flushing;
669 unsigned long rs_logging; 669 unsigned long rs_logging;
670 670
671 unsigned long rs_handle_count; 671 __u32 rs_handle_count;
672 unsigned long rs_blocks; 672 __u32 rs_blocks;
673 unsigned long rs_blocks_logged; 673 __u32 rs_blocks_logged;
674}; 674};
675 675
676struct transaction_stats_s { 676struct transaction_stats_s {
677 int ts_type;
678 unsigned long ts_tid; 677 unsigned long ts_tid;
679 union { 678 struct transaction_run_stats_s run;
680 struct transaction_run_stats_s run;
681 struct transaction_chp_stats_s chp;
682 } u;
683}; 679};
684 680
685#define JBD2_STATS_RUN 1
686#define JBD2_STATS_CHECKPOINT 2
687
688static inline unsigned long 681static inline unsigned long
689jbd2_time_diff(unsigned long start, unsigned long end) 682jbd2_time_diff(unsigned long start, unsigned long end)
690{ 683{
@@ -988,12 +981,6 @@ struct journal_s
988 /* 981 /*
989 * Journal statistics 982 * Journal statistics
990 */ 983 */
991 struct transaction_stats_s *j_history;
992 int j_history_max;
993 int j_history_cur;
994 /*
995 * Protect the transactions statistics history
996 */
997 spinlock_t j_history_lock; 984 spinlock_t j_history_lock;
998 struct proc_dir_entry *j_proc_entry; 985 struct proc_dir_entry *j_proc_entry;
999 struct transaction_stats_s j_stats; 986 struct transaction_stats_s j_stats;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index d6320a3e8def..f4e3184fa054 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -125,7 +125,7 @@ extern int _cond_resched(void);
125#endif 125#endif
126 126
127#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP 127#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
128 void __might_sleep(char *file, int line); 128 void __might_sleep(char *file, int line, int preempt_offset);
129/** 129/**
130 * might_sleep - annotation for functions that can sleep 130 * might_sleep - annotation for functions that can sleep
131 * 131 *
@@ -137,15 +137,16 @@ extern int _cond_resched(void);
137 * supposed to. 137 * supposed to.
138 */ 138 */
139# define might_sleep() \ 139# define might_sleep() \
140 do { __might_sleep(__FILE__, __LINE__); might_resched(); } while (0) 140 do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0)
141#else 141#else
142 static inline void __might_sleep(char *file, int line, int preempt_offset) { }
142# define might_sleep() do { might_resched(); } while (0) 143# define might_sleep() do { might_resched(); } while (0)
143#endif 144#endif
144 145
145#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) 146#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0)
146 147
147#define abs(x) ({ \ 148#define abs(x) ({ \
148 int __x = (x); \ 149 long __x = (x); \
149 (__x < 0) ? -__x : __x; \ 150 (__x < 0) ? -__x : __x; \
150 }) 151 })
151 152
@@ -245,14 +246,16 @@ extern int printk_ratelimit(void);
245extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, 246extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
246 unsigned int interval_msec); 247 unsigned int interval_msec);
247 248
249extern int printk_delay_msec;
250
248/* 251/*
249 * Print a one-time message (analogous to WARN_ONCE() et al): 252 * Print a one-time message (analogous to WARN_ONCE() et al):
250 */ 253 */
251#define printk_once(x...) ({ \ 254#define printk_once(x...) ({ \
252 static int __print_once = 1; \ 255 static bool __print_once = true; \
253 \ 256 \
254 if (__print_once) { \ 257 if (__print_once) { \
255 __print_once = 0; \ 258 __print_once = false; \
256 printk(x); \ 259 printk(x); \
257 } \ 260 } \
258}) 261})
@@ -656,6 +659,12 @@ extern int do_sysinfo(struct sysinfo *info);
656 659
657#endif /* __KERNEL__ */ 660#endif /* __KERNEL__ */
658 661
662#ifndef __EXPORTED_HEADERS__
663#ifndef __KERNEL__
664#warning Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders
665#endif /* __KERNEL__ */
666#endif /* __EXPORTED_HEADERS__ */
667
659#define SI_LOAD_SHIFT 16 668#define SI_LOAD_SHIFT 16
660struct sysinfo { 669struct sysinfo {
661 long uptime; /* Seconds since boot */ 670 long uptime; /* Seconds since boot */
@@ -675,13 +684,17 @@ struct sysinfo {
675}; 684};
676 685
677/* Force a compilation error if condition is true */ 686/* Force a compilation error if condition is true */
678#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) 687#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))
688
689/* Force a compilation error if condition is constant and true */
690#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
679 691
680/* Force a compilation error if condition is true, but also produce a 692/* Force a compilation error if condition is true, but also produce a
681 result (of value 0 and type size_t), so the expression can be used 693 result (of value 0 and type size_t), so the expression can be used
682 e.g. in a structure initializer (or where-ever else comma expressions 694 e.g. in a structure initializer (or where-ever else comma expressions
683 aren't permitted). */ 695 aren't permitted). */
684#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1) 696#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
697#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
685 698
686/* Trap pasters of __FUNCTION__ at compile-time */ 699/* Trap pasters of __FUNCTION__ at compile-time */
687#define __FUNCTION__ (__func__) 700#define __FUNCTION__ (__func__)
diff --git a/include/linux/key.h b/include/linux/key.h
index e544f466d69a..cd50dfa1d4c2 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -129,7 +129,10 @@ struct key {
129 struct rw_semaphore sem; /* change vs change sem */ 129 struct rw_semaphore sem; /* change vs change sem */
130 struct key_user *user; /* owner of this key */ 130 struct key_user *user; /* owner of this key */
131 void *security; /* security data for this key */ 131 void *security; /* security data for this key */
132 time_t expiry; /* time at which key expires (or 0) */ 132 union {
133 time_t expiry; /* time at which key expires (or 0) */
134 time_t revoked_at; /* time at which key was revoked */
135 };
133 uid_t uid; 136 uid_t uid;
134 gid_t gid; 137 gid_t gid;
135 key_perm_t perm; /* access permissions */ 138 key_perm_t perm; /* access permissions */
@@ -275,6 +278,8 @@ static inline key_serial_t key_serial(struct key *key)
275extern ctl_table key_sysctls[]; 278extern ctl_table key_sysctls[];
276#endif 279#endif
277 280
281extern void key_replace_session_keyring(void);
282
278/* 283/*
279 * the userspace interface 284 * the userspace interface
280 */ 285 */
@@ -297,6 +302,7 @@ extern void key_init(void);
297#define key_fsuid_changed(t) do { } while(0) 302#define key_fsuid_changed(t) do { } while(0)
298#define key_fsgid_changed(t) do { } while(0) 303#define key_fsgid_changed(t) do { } while(0)
299#define key_init() do { } while(0) 304#define key_init() do { } while(0)
305#define key_replace_session_keyring() do { } while(0)
300 306
301#endif /* CONFIG_KEYS */ 307#endif /* CONFIG_KEYS */
302#endif /* __KERNEL__ */ 308#endif /* __KERNEL__ */
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h
index c0688eb72093..bd383f1944fb 100644
--- a/include/linux/keyctl.h
+++ b/include/linux/keyctl.h
@@ -52,5 +52,6 @@
52#define KEYCTL_SET_TIMEOUT 15 /* set key timeout */ 52#define KEYCTL_SET_TIMEOUT 15 /* set key timeout */
53#define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */ 53#define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */
54#define KEYCTL_GET_SECURITY 17 /* get key security label */ 54#define KEYCTL_GET_SECURITY 17 /* get key security label */
55#define KEYCTL_SESSION_TO_PARENT 18 /* apply session keyring to parent process */
55 56
56#endif /* _LINUX_KEYCTL_H */ 57#endif /* _LINUX_KEYCTL_H */
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 29f62e1733ff..ad6bdf5a5970 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -38,7 +38,7 @@ extern struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask,
38 spinlock_t *lock); 38 spinlock_t *lock);
39extern void kfifo_free(struct kfifo *fifo); 39extern void kfifo_free(struct kfifo *fifo);
40extern unsigned int __kfifo_put(struct kfifo *fifo, 40extern unsigned int __kfifo_put(struct kfifo *fifo,
41 unsigned char *buffer, unsigned int len); 41 const unsigned char *buffer, unsigned int len);
42extern unsigned int __kfifo_get(struct kfifo *fifo, 42extern unsigned int __kfifo_get(struct kfifo *fifo,
43 unsigned char *buffer, unsigned int len); 43 unsigned char *buffer, unsigned int len);
44 44
@@ -77,7 +77,7 @@ static inline void kfifo_reset(struct kfifo *fifo)
77 * bytes copied. 77 * bytes copied.
78 */ 78 */
79static inline unsigned int kfifo_put(struct kfifo *fifo, 79static inline unsigned int kfifo_put(struct kfifo *fifo,
80 unsigned char *buffer, unsigned int len) 80 const unsigned char *buffer, unsigned int len)
81{ 81{
82 unsigned long flags; 82 unsigned long flags;
83 unsigned int ret; 83 unsigned int ret;
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h
index 47b39b7c7e84..e880d4cf9e22 100644
--- a/include/linux/kmemcheck.h
+++ b/include/linux/kmemcheck.h
@@ -34,6 +34,8 @@ void kmemcheck_mark_initialized_pages(struct page *p, unsigned int n);
34int kmemcheck_show_addr(unsigned long address); 34int kmemcheck_show_addr(unsigned long address);
35int kmemcheck_hide_addr(unsigned long address); 35int kmemcheck_hide_addr(unsigned long address);
36 36
37bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size);
38
37#else 39#else
38#define kmemcheck_enabled 0 40#define kmemcheck_enabled 0
39 41
@@ -99,6 +101,11 @@ static inline void kmemcheck_mark_initialized_pages(struct page *p,
99{ 101{
100} 102}
101 103
104static inline bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size)
105{
106 return true;
107}
108
102#endif /* CONFIG_KMEMCHECK */ 109#endif /* CONFIG_KMEMCHECK */
103 110
104/* 111/*
@@ -137,10 +144,15 @@ static inline void kmemcheck_mark_initialized_pages(struct page *p,
137 int name##_end[0]; 144 int name##_end[0];
138 145
139#define kmemcheck_annotate_bitfield(ptr, name) \ 146#define kmemcheck_annotate_bitfield(ptr, name) \
140 do if (ptr) { \ 147 do { \
141 int _n = (long) &((ptr)->name##_end) \ 148 int _n; \
149 \
150 if (!ptr) \
151 break; \
152 \
153 _n = (long) &((ptr)->name##_end) \
142 - (long) &((ptr)->name##_begin); \ 154 - (long) &((ptr)->name##_begin); \
143 BUILD_BUG_ON(_n < 0); \ 155 MAYBE_BUILD_BUG_ON(_n < 0); \
144 \ 156 \
145 kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \ 157 kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
146 } while (0) 158 } while (0)
diff --git a/include/linux/kmemleak.h b/include/linux/kmemleak.h
index 6a63807f714e..3c7497d46ee9 100644
--- a/include/linux/kmemleak.h
+++ b/include/linux/kmemleak.h
@@ -23,18 +23,18 @@
23 23
24#ifdef CONFIG_DEBUG_KMEMLEAK 24#ifdef CONFIG_DEBUG_KMEMLEAK
25 25
26extern void kmemleak_init(void); 26extern void kmemleak_init(void) __ref;
27extern void kmemleak_alloc(const void *ptr, size_t size, int min_count, 27extern void kmemleak_alloc(const void *ptr, size_t size, int min_count,
28 gfp_t gfp); 28 gfp_t gfp) __ref;
29extern void kmemleak_free(const void *ptr); 29extern void kmemleak_free(const void *ptr) __ref;
30extern void kmemleak_free_part(const void *ptr, size_t size); 30extern void kmemleak_free_part(const void *ptr, size_t size) __ref;
31extern void kmemleak_padding(const void *ptr, unsigned long offset, 31extern void kmemleak_padding(const void *ptr, unsigned long offset,
32 size_t size); 32 size_t size) __ref;
33extern void kmemleak_not_leak(const void *ptr); 33extern void kmemleak_not_leak(const void *ptr) __ref;
34extern void kmemleak_ignore(const void *ptr); 34extern void kmemleak_ignore(const void *ptr) __ref;
35extern void kmemleak_scan_area(const void *ptr, unsigned long offset, 35extern void kmemleak_scan_area(const void *ptr, unsigned long offset,
36 size_t length, gfp_t gfp); 36 size_t length, gfp_t gfp) __ref;
37extern void kmemleak_no_scan(const void *ptr); 37extern void kmemleak_no_scan(const void *ptr) __ref;
38 38
39static inline void kmemleak_alloc_recursive(const void *ptr, size_t size, 39static inline void kmemleak_alloc_recursive(const void *ptr, size_t size,
40 int min_count, unsigned long flags, 40 int min_count, unsigned long flags,
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index bcd9c07848be..3a46b7b7abb2 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -48,13 +48,13 @@
48#define KPROBE_HIT_SSDONE 0x00000008 48#define KPROBE_HIT_SSDONE 0x00000008
49 49
50/* Attach to insert probes on any functions which should be ignored*/ 50/* Attach to insert probes on any functions which should be ignored*/
51#define __kprobes __attribute__((__section__(".kprobes.text"))) notrace 51#define __kprobes __attribute__((__section__(".kprobes.text")))
52#else /* CONFIG_KPROBES */ 52#else /* CONFIG_KPROBES */
53typedef int kprobe_opcode_t; 53typedef int kprobe_opcode_t;
54struct arch_specific_insn { 54struct arch_specific_insn {
55 int dummy; 55 int dummy;
56}; 56};
57#define __kprobes notrace 57#define __kprobes
58#endif /* CONFIG_KPROBES */ 58#endif /* CONFIG_KPROBES */
59 59
60struct kprobe; 60struct kprobe;
diff --git a/include/linux/kref.h b/include/linux/kref.h
index 0cef6badd6fb..b0cb0ebad9e6 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -16,7 +16,6 @@
16#define _KREF_H_ 16#define _KREF_H_
17 17
18#include <linux/types.h> 18#include <linux/types.h>
19#include <asm/atomic.h>
20 19
21struct kref { 20struct kref {
22 atomic_t refcount; 21 atomic_t refcount;
diff --git a/include/linux/ksm.h b/include/linux/ksm.h
new file mode 100644
index 000000000000..a485c14ecd5d
--- /dev/null
+++ b/include/linux/ksm.h
@@ -0,0 +1,79 @@
1#ifndef __LINUX_KSM_H
2#define __LINUX_KSM_H
3/*
4 * Memory merging support.
5 *
6 * This code enables dynamic sharing of identical pages found in different
7 * memory areas, even if they are not shared by fork().
8 */
9
10#include <linux/bitops.h>
11#include <linux/mm.h>
12#include <linux/sched.h>
13#include <linux/vmstat.h>
14
15#ifdef CONFIG_KSM
16int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
17 unsigned long end, int advice, unsigned long *vm_flags);
18int __ksm_enter(struct mm_struct *mm);
19void __ksm_exit(struct mm_struct *mm);
20
21static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
22{
23 if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags))
24 return __ksm_enter(mm);
25 return 0;
26}
27
28static inline void ksm_exit(struct mm_struct *mm)
29{
30 if (test_bit(MMF_VM_MERGEABLE, &mm->flags))
31 __ksm_exit(mm);
32}
33
34/*
35 * A KSM page is one of those write-protected "shared pages" or "merged pages"
36 * which KSM maps into multiple mms, wherever identical anonymous page content
37 * is found in VM_MERGEABLE vmas. It's a PageAnon page, with NULL anon_vma.
38 */
39static inline int PageKsm(struct page *page)
40{
41 return ((unsigned long)page->mapping == PAGE_MAPPING_ANON);
42}
43
44/*
45 * But we have to avoid the checking which page_add_anon_rmap() performs.
46 */
47static inline void page_add_ksm_rmap(struct page *page)
48{
49 if (atomic_inc_and_test(&page->_mapcount)) {
50 page->mapping = (void *) PAGE_MAPPING_ANON;
51 __inc_zone_page_state(page, NR_ANON_PAGES);
52 }
53}
54#else /* !CONFIG_KSM */
55
56static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
57 unsigned long end, int advice, unsigned long *vm_flags)
58{
59 return 0;
60}
61
62static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
63{
64 return 0;
65}
66
67static inline void ksm_exit(struct mm_struct *mm)
68{
69}
70
71static inline int PageKsm(struct page *page)
72{
73 return 0;
74}
75
76/* No stub required for page_add_ksm_rmap(page) */
77#endif /* !CONFIG_KSM */
78
79#endif
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 3db5d8d37485..f8f8900fc5ec 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -14,7 +14,7 @@
14 14
15#define KVM_API_VERSION 12 15#define KVM_API_VERSION 12
16 16
17/* for KVM_TRACE_ENABLE */ 17/* for KVM_TRACE_ENABLE, deprecated */
18struct kvm_user_trace_setup { 18struct kvm_user_trace_setup {
19 __u32 buf_size; /* sub_buffer size of each per-cpu */ 19 __u32 buf_size; /* sub_buffer size of each per-cpu */
20 __u32 buf_nr; /* the number of sub_buffers of each per-cpu */ 20 __u32 buf_nr; /* the number of sub_buffers of each per-cpu */
@@ -70,6 +70,14 @@ struct kvm_irqchip {
70 } chip; 70 } chip;
71}; 71};
72 72
73/* for KVM_CREATE_PIT2 */
74struct kvm_pit_config {
75 __u32 flags;
76 __u32 pad[15];
77};
78
79#define KVM_PIT_SPEAKER_DUMMY 1
80
73#define KVM_EXIT_UNKNOWN 0 81#define KVM_EXIT_UNKNOWN 0
74#define KVM_EXIT_EXCEPTION 1 82#define KVM_EXIT_EXCEPTION 1
75#define KVM_EXIT_IO 2 83#define KVM_EXIT_IO 2
@@ -87,6 +95,10 @@ struct kvm_irqchip {
87#define KVM_EXIT_S390_RESET 14 95#define KVM_EXIT_S390_RESET 14
88#define KVM_EXIT_DCR 15 96#define KVM_EXIT_DCR 15
89#define KVM_EXIT_NMI 16 97#define KVM_EXIT_NMI 16
98#define KVM_EXIT_INTERNAL_ERROR 17
99
100/* For KVM_EXIT_INTERNAL_ERROR */
101#define KVM_INTERNAL_ERROR_EMULATION 1
90 102
91/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ 103/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */
92struct kvm_run { 104struct kvm_run {
@@ -173,6 +185,9 @@ struct kvm_run {
173 __u32 data; 185 __u32 data;
174 __u8 is_write; 186 __u8 is_write;
175 } dcr; 187 } dcr;
188 struct {
189 __u32 suberror;
190 } internal;
176 /* Fix the size of the union. */ 191 /* Fix the size of the union. */
177 char padding[256]; 192 char padding[256];
178 }; 193 };
@@ -292,6 +307,28 @@ struct kvm_guest_debug {
292 struct kvm_guest_debug_arch arch; 307 struct kvm_guest_debug_arch arch;
293}; 308};
294 309
310enum {
311 kvm_ioeventfd_flag_nr_datamatch,
312 kvm_ioeventfd_flag_nr_pio,
313 kvm_ioeventfd_flag_nr_deassign,
314 kvm_ioeventfd_flag_nr_max,
315};
316
317#define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch)
318#define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio)
319#define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign)
320
321#define KVM_IOEVENTFD_VALID_FLAG_MASK ((1 << kvm_ioeventfd_flag_nr_max) - 1)
322
323struct kvm_ioeventfd {
324 __u64 datamatch;
325 __u64 addr; /* legal pio/mmio address */
326 __u32 len; /* 1, 2, 4, or 8 bytes */
327 __s32 fd;
328 __u32 flags;
329 __u8 pad[36];
330};
331
295#define KVM_TRC_SHIFT 16 332#define KVM_TRC_SHIFT 16
296/* 333/*
297 * kvm trace categories 334 * kvm trace categories
@@ -310,35 +347,6 @@ struct kvm_guest_debug {
310#define KVM_TRC_CYCLE_SIZE 8 347#define KVM_TRC_CYCLE_SIZE 8
311#define KVM_TRC_EXTRA_MAX 7 348#define KVM_TRC_EXTRA_MAX 7
312 349
313/* This structure represents a single trace buffer record. */
314struct kvm_trace_rec {
315 /* variable rec_val
316 * is split into:
317 * bits 0 - 27 -> event id
318 * bits 28 -30 -> number of extra data args of size u32
319 * bits 31 -> binary indicator for if tsc is in record
320 */
321 __u32 rec_val;
322 __u32 pid;
323 __u32 vcpu_id;
324 union {
325 struct {
326 __u64 timestamp;
327 __u32 extra_u32[KVM_TRC_EXTRA_MAX];
328 } __attribute__((packed)) timestamp;
329 struct {
330 __u32 extra_u32[KVM_TRC_EXTRA_MAX];
331 } notimestamp;
332 } u;
333};
334
335#define TRACE_REC_EVENT_ID(val) \
336 (0x0fffffff & (val))
337#define TRACE_REC_NUM_DATA_ARGS(val) \
338 (0x70000000 & ((val) << 28))
339#define TRACE_REC_TCS(val) \
340 (0x80000000 & ((val) << 31))
341
342#define KVMIO 0xAE 350#define KVMIO 0xAE
343 351
344/* 352/*
@@ -415,6 +423,19 @@ struct kvm_trace_rec {
415#define KVM_CAP_ASSIGN_DEV_IRQ 29 423#define KVM_CAP_ASSIGN_DEV_IRQ 29
416/* Another bug in KVM_SET_USER_MEMORY_REGION fixed: */ 424/* Another bug in KVM_SET_USER_MEMORY_REGION fixed: */
417#define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30 425#define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30
426#ifdef __KVM_HAVE_MCE
427#define KVM_CAP_MCE 31
428#endif
429#define KVM_CAP_IRQFD 32
430#ifdef __KVM_HAVE_PIT
431#define KVM_CAP_PIT2 33
432#endif
433#define KVM_CAP_SET_BOOT_CPU_ID 34
434#ifdef __KVM_HAVE_PIT_STATE2
435#define KVM_CAP_PIT_STATE2 35
436#endif
437#define KVM_CAP_IOEVENTFD 36
438#define KVM_CAP_SET_IDENTITY_MAP_ADDR 37
418 439
419#ifdef KVM_CAP_IRQ_ROUTING 440#ifdef KVM_CAP_IRQ_ROUTING
420 441
@@ -454,15 +475,32 @@ struct kvm_irq_routing {
454 475
455#endif 476#endif
456 477
478#ifdef KVM_CAP_MCE
479/* x86 MCE */
480struct kvm_x86_mce {
481 __u64 status;
482 __u64 addr;
483 __u64 misc;
484 __u64 mcg_status;
485 __u8 bank;
486 __u8 pad1[7];
487 __u64 pad2[3];
488};
489#endif
490
491#define KVM_IRQFD_FLAG_DEASSIGN (1 << 0)
492
493struct kvm_irqfd {
494 __u32 fd;
495 __u32 gsi;
496 __u32 flags;
497 __u8 pad[20];
498};
499
457/* 500/*
458 * ioctls for VM fds 501 * ioctls for VM fds
459 */ 502 */
460#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region) 503#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region)
461#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44)
462#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45)
463#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46,\
464 struct kvm_userspace_memory_region)
465#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
466/* 504/*
467 * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns 505 * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns
468 * a vcpu fd. 506 * a vcpu fd.
@@ -470,6 +508,12 @@ struct kvm_irq_routing {
470#define KVM_CREATE_VCPU _IO(KVMIO, 0x41) 508#define KVM_CREATE_VCPU _IO(KVMIO, 0x41)
471#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log) 509#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log)
472#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias) 510#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias)
511#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44)
512#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45)
513#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46,\
514 struct kvm_userspace_memory_region)
515#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
516#define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64)
473/* Device model IOC */ 517/* Device model IOC */
474#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60) 518#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60)
475#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) 519#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level)
@@ -498,6 +542,10 @@ struct kvm_irq_routing {
498#define KVM_ASSIGN_SET_MSIX_ENTRY \ 542#define KVM_ASSIGN_SET_MSIX_ENTRY \
499 _IOW(KVMIO, 0x74, struct kvm_assigned_msix_entry) 543 _IOW(KVMIO, 0x74, struct kvm_assigned_msix_entry)
500#define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq) 544#define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq)
545#define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd)
546#define KVM_CREATE_PIT2 _IOW(KVMIO, 0x77, struct kvm_pit_config)
547#define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78)
548#define KVM_IOEVENTFD _IOW(KVMIO, 0x79, struct kvm_ioeventfd)
501 549
502/* 550/*
503 * ioctls for vcpu fds 551 * ioctls for vcpu fds
@@ -541,6 +589,10 @@ struct kvm_irq_routing {
541#define KVM_NMI _IO(KVMIO, 0x9a) 589#define KVM_NMI _IO(KVMIO, 0x9a)
542/* Available with KVM_CAP_SET_GUEST_DEBUG */ 590/* Available with KVM_CAP_SET_GUEST_DEBUG */
543#define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug) 591#define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug)
592/* MCE for x86 */
593#define KVM_X86_SETUP_MCE _IOW(KVMIO, 0x9c, __u64)
594#define KVM_X86_GET_MCE_CAP_SUPPORTED _IOR(KVMIO, 0x9d, __u64)
595#define KVM_X86_SET_MCE _IOW(KVMIO, 0x9e, struct kvm_x86_mce)
544 596
545/* 597/*
546 * Deprecated interfaces 598 * Deprecated interfaces
@@ -563,6 +615,9 @@ struct kvm_debug_guest {
563#define KVM_IA64_VCPU_GET_STACK _IOR(KVMIO, 0x9a, void *) 615#define KVM_IA64_VCPU_GET_STACK _IOR(KVMIO, 0x9a, void *)
564#define KVM_IA64_VCPU_SET_STACK _IOW(KVMIO, 0x9b, void *) 616#define KVM_IA64_VCPU_SET_STACK _IOW(KVMIO, 0x9b, void *)
565 617
618#define KVM_GET_PIT2 _IOR(KVMIO, 0x9f, struct kvm_pit_state2)
619#define KVM_SET_PIT2 _IOW(KVMIO, 0xa0, struct kvm_pit_state2)
620
566#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02) 621#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02)
567#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03) 622#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03)
568#define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04) 623#define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04)
@@ -633,7 +688,7 @@ struct kvm_assigned_msix_nr {
633 __u16 padding; 688 __u16 padding;
634}; 689};
635 690
636#define KVM_MAX_MSIX_PER_DEV 512 691#define KVM_MAX_MSIX_PER_DEV 256
637struct kvm_assigned_msix_entry { 692struct kvm_assigned_msix_entry {
638 __u32 assigned_dev_id; 693 __u32 assigned_dev_id;
639 __u32 gsi; 694 __u32 gsi;
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 3060bdc35ffe..b7bbb5ddd7ae 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -15,7 +15,6 @@
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/preempt.h> 17#include <linux/preempt.h>
18#include <linux/marker.h>
19#include <linux/msi.h> 18#include <linux/msi.h>
20#include <asm/signal.h> 19#include <asm/signal.h>
21 20
@@ -42,6 +41,7 @@
42 41
43#define KVM_USERSPACE_IRQ_SOURCE_ID 0 42#define KVM_USERSPACE_IRQ_SOURCE_ID 0
44 43
44struct kvm;
45struct kvm_vcpu; 45struct kvm_vcpu;
46extern struct kmem_cache *kvm_vcpu_cache; 46extern struct kmem_cache *kvm_vcpu_cache;
47 47
@@ -59,10 +59,18 @@ struct kvm_io_bus {
59 59
60void kvm_io_bus_init(struct kvm_io_bus *bus); 60void kvm_io_bus_init(struct kvm_io_bus *bus);
61void kvm_io_bus_destroy(struct kvm_io_bus *bus); 61void kvm_io_bus_destroy(struct kvm_io_bus *bus);
62struct kvm_io_device *kvm_io_bus_find_dev(struct kvm_io_bus *bus, 62int kvm_io_bus_write(struct kvm_io_bus *bus, gpa_t addr, int len,
63 gpa_t addr, int len, int is_write); 63 const void *val);
64void kvm_io_bus_register_dev(struct kvm_io_bus *bus, 64int kvm_io_bus_read(struct kvm_io_bus *bus, gpa_t addr, int len,
65 struct kvm_io_device *dev); 65 void *val);
66int __kvm_io_bus_register_dev(struct kvm_io_bus *bus,
67 struct kvm_io_device *dev);
68int kvm_io_bus_register_dev(struct kvm *kvm, struct kvm_io_bus *bus,
69 struct kvm_io_device *dev);
70void __kvm_io_bus_unregister_dev(struct kvm_io_bus *bus,
71 struct kvm_io_device *dev);
72void kvm_io_bus_unregister_dev(struct kvm *kvm, struct kvm_io_bus *bus,
73 struct kvm_io_device *dev);
66 74
67struct kvm_vcpu { 75struct kvm_vcpu {
68 struct kvm *kvm; 76 struct kvm *kvm;
@@ -103,7 +111,7 @@ struct kvm_memory_slot {
103 struct { 111 struct {
104 unsigned long rmap_pde; 112 unsigned long rmap_pde;
105 int write_count; 113 int write_count;
106 } *lpage_info; 114 } *lpage_info[KVM_NR_PAGE_SIZES - 1];
107 unsigned long userspace_addr; 115 unsigned long userspace_addr;
108 int user_alloc; 116 int user_alloc;
109}; 117};
@@ -124,7 +132,6 @@ struct kvm_kernel_irq_routing_entry {
124}; 132};
125 133
126struct kvm { 134struct kvm {
127 struct mutex lock; /* protects the vcpus array and APIC accesses */
128 spinlock_t mmu_lock; 135 spinlock_t mmu_lock;
129 spinlock_t requests_lock; 136 spinlock_t requests_lock;
130 struct rw_semaphore slots_lock; 137 struct rw_semaphore slots_lock;
@@ -132,10 +139,23 @@ struct kvm {
132 int nmemslots; 139 int nmemslots;
133 struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS + 140 struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS +
134 KVM_PRIVATE_MEM_SLOTS]; 141 KVM_PRIVATE_MEM_SLOTS];
142#ifdef CONFIG_KVM_APIC_ARCHITECTURE
143 u32 bsp_vcpu_id;
144 struct kvm_vcpu *bsp_vcpu;
145#endif
135 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS]; 146 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
147 atomic_t online_vcpus;
136 struct list_head vm_list; 148 struct list_head vm_list;
149 struct mutex lock;
137 struct kvm_io_bus mmio_bus; 150 struct kvm_io_bus mmio_bus;
138 struct kvm_io_bus pio_bus; 151 struct kvm_io_bus pio_bus;
152#ifdef CONFIG_HAVE_KVM_EVENTFD
153 struct {
154 spinlock_t lock;
155 struct list_head items;
156 } irqfds;
157 struct list_head ioeventfds;
158#endif
139 struct kvm_vm_stat stat; 159 struct kvm_vm_stat stat;
140 struct kvm_arch arch; 160 struct kvm_arch arch;
141 atomic_t users_count; 161 atomic_t users_count;
@@ -144,6 +164,7 @@ struct kvm {
144 struct kvm_coalesced_mmio_ring *coalesced_mmio_ring; 164 struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
145#endif 165#endif
146 166
167 struct mutex irq_lock;
147#ifdef CONFIG_HAVE_KVM_IRQCHIP 168#ifdef CONFIG_HAVE_KVM_IRQCHIP
148 struct list_head irq_routing; /* of kvm_kernel_irq_routing_entry */ 169 struct list_head irq_routing; /* of kvm_kernel_irq_routing_entry */
149 struct hlist_head mask_notifier_list; 170 struct hlist_head mask_notifier_list;
@@ -167,6 +188,17 @@ struct kvm {
167#define kvm_printf(kvm, fmt ...) printk(KERN_DEBUG fmt) 188#define kvm_printf(kvm, fmt ...) printk(KERN_DEBUG fmt)
168#define vcpu_printf(vcpu, fmt...) kvm_printf(vcpu->kvm, fmt) 189#define vcpu_printf(vcpu, fmt...) kvm_printf(vcpu->kvm, fmt)
169 190
191static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i)
192{
193 smp_rmb();
194 return kvm->vcpus[i];
195}
196
197#define kvm_for_each_vcpu(idx, vcpup, kvm) \
198 for (idx = 0, vcpup = kvm_get_vcpu(kvm, idx); \
199 idx < atomic_read(&kvm->online_vcpus) && vcpup; \
200 vcpup = kvm_get_vcpu(kvm, ++idx))
201
170int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id); 202int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id);
171void kvm_vcpu_uninit(struct kvm_vcpu *vcpu); 203void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
172 204
@@ -201,6 +233,7 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
201 struct kvm_userspace_memory_region *mem, 233 struct kvm_userspace_memory_region *mem,
202 struct kvm_memory_slot old, 234 struct kvm_memory_slot old,
203 int user_alloc); 235 int user_alloc);
236void kvm_disable_largepages(void);
204void kvm_arch_flush_shadow(struct kvm *kvm); 237void kvm_arch_flush_shadow(struct kvm *kvm);
205gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn); 238gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn);
206struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); 239struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
@@ -243,8 +276,6 @@ long kvm_arch_dev_ioctl(struct file *filp,
243 unsigned int ioctl, unsigned long arg); 276 unsigned int ioctl, unsigned long arg);
244long kvm_arch_vcpu_ioctl(struct file *filp, 277long kvm_arch_vcpu_ioctl(struct file *filp,
245 unsigned int ioctl, unsigned long arg); 278 unsigned int ioctl, unsigned long arg);
246void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
247void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
248 279
249int kvm_dev_ioctl_check_extension(long ext); 280int kvm_dev_ioctl_check_extension(long ext);
250 281
@@ -300,7 +331,6 @@ int kvm_arch_hardware_setup(void);
300void kvm_arch_hardware_unsetup(void); 331void kvm_arch_hardware_unsetup(void);
301void kvm_arch_check_processor_compat(void *rtn); 332void kvm_arch_check_processor_compat(void *rtn);
302int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu); 333int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
303int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu);
304 334
305void kvm_free_physmem(struct kvm *kvm); 335void kvm_free_physmem(struct kvm *kvm);
306 336
@@ -309,8 +339,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm);
309void kvm_free_all_assigned_devices(struct kvm *kvm); 339void kvm_free_all_assigned_devices(struct kvm *kvm);
310void kvm_arch_sync_events(struct kvm *kvm); 340void kvm_arch_sync_events(struct kvm *kvm);
311 341
312int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
313int kvm_cpu_has_interrupt(struct kvm_vcpu *v);
314int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); 342int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu);
315void kvm_vcpu_kick(struct kvm_vcpu *vcpu); 343void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
316 344
@@ -366,7 +394,8 @@ int kvm_set_irq(struct kvm *kvm, int irq_source_id, int irq, int level);
366void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin); 394void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin);
367void kvm_register_irq_ack_notifier(struct kvm *kvm, 395void kvm_register_irq_ack_notifier(struct kvm *kvm,
368 struct kvm_irq_ack_notifier *kian); 396 struct kvm_irq_ack_notifier *kian);
369void kvm_unregister_irq_ack_notifier(struct kvm_irq_ack_notifier *kian); 397void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
398 struct kvm_irq_ack_notifier *kian);
370int kvm_request_irq_source_id(struct kvm *kvm); 399int kvm_request_irq_source_id(struct kvm *kvm);
371void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); 400void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id);
372 401
@@ -459,37 +488,6 @@ struct kvm_stats_debugfs_item {
459extern struct kvm_stats_debugfs_item debugfs_entries[]; 488extern struct kvm_stats_debugfs_item debugfs_entries[];
460extern struct dentry *kvm_debugfs_dir; 489extern struct dentry *kvm_debugfs_dir;
461 490
462#define KVMTRACE_5D(evt, vcpu, d1, d2, d3, d4, d5, name) \
463 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
464 vcpu, 5, d1, d2, d3, d4, d5)
465#define KVMTRACE_4D(evt, vcpu, d1, d2, d3, d4, name) \
466 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
467 vcpu, 4, d1, d2, d3, d4, 0)
468#define KVMTRACE_3D(evt, vcpu, d1, d2, d3, name) \
469 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
470 vcpu, 3, d1, d2, d3, 0, 0)
471#define KVMTRACE_2D(evt, vcpu, d1, d2, name) \
472 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
473 vcpu, 2, d1, d2, 0, 0, 0)
474#define KVMTRACE_1D(evt, vcpu, d1, name) \
475 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
476 vcpu, 1, d1, 0, 0, 0, 0)
477#define KVMTRACE_0D(evt, vcpu, name) \
478 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
479 vcpu, 0, 0, 0, 0, 0, 0)
480
481#ifdef CONFIG_KVM_TRACE
482int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg);
483void kvm_trace_cleanup(void);
484#else
485static inline
486int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg)
487{
488 return -EINVAL;
489}
490#define kvm_trace_cleanup() ((void)0)
491#endif
492
493#ifdef KVM_ARCH_WANT_MMU_NOTIFIER 491#ifdef KVM_ARCH_WANT_MMU_NOTIFIER
494static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_seq) 492static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_seq)
495{ 493{
@@ -525,4 +523,33 @@ static inline void kvm_free_irq_routing(struct kvm *kvm) {}
525 523
526#endif 524#endif
527 525
526#ifdef CONFIG_HAVE_KVM_EVENTFD
527
528void kvm_eventfd_init(struct kvm *kvm);
529int kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags);
530void kvm_irqfd_release(struct kvm *kvm);
531int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args);
532
533#else
534
535static inline void kvm_eventfd_init(struct kvm *kvm) {}
536static inline int kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags)
537{
538 return -EINVAL;
539}
540
541static inline void kvm_irqfd_release(struct kvm *kvm) {}
542static inline int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
543{
544 return -ENOSYS;
545}
546
547#endif /* CONFIG_HAVE_KVM_EVENTFD */
548
549#ifdef CONFIG_KVM_APIC_ARCHITECTURE
550static inline bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu)
551{
552 return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id;
553}
554#endif
528#endif 555#endif
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h
index 3ddce03766ca..d73109243fda 100644
--- a/include/linux/kvm_para.h
+++ b/include/linux/kvm_para.h
@@ -13,6 +13,7 @@
13#define KVM_ENOSYS 1000 13#define KVM_ENOSYS 1000
14#define KVM_EFAULT EFAULT 14#define KVM_EFAULT EFAULT
15#define KVM_E2BIG E2BIG 15#define KVM_E2BIG E2BIG
16#define KVM_EPERM EPERM
16 17
17#define KVM_HC_VAPIC_POLL_IRQ 1 18#define KVM_HC_VAPIC_POLL_IRQ 1
18#define KVM_HC_MMU_OP 2 19#define KVM_HC_MMU_OP 2
diff --git a/include/linux/libata.h b/include/linux/libata.h
index e5b6e33c6571..87698640c091 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -143,7 +143,6 @@ enum {
143 143
144 ATA_DFLAG_PIO = (1 << 12), /* device limited to PIO mode */ 144 ATA_DFLAG_PIO = (1 << 12), /* device limited to PIO mode */
145 ATA_DFLAG_NCQ_OFF = (1 << 13), /* device limited to non-NCQ mode */ 145 ATA_DFLAG_NCQ_OFF = (1 << 13), /* device limited to non-NCQ mode */
146 ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */
147 ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */ 146 ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */
148 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ 147 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */
149 ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */ 148 ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */
@@ -190,6 +189,7 @@ enum {
190 ATA_FLAG_NO_POWEROFF_SPINDOWN = (1 << 11), /* don't spindown before poweroff */ 189 ATA_FLAG_NO_POWEROFF_SPINDOWN = (1 << 11), /* don't spindown before poweroff */
191 ATA_FLAG_NO_HIBERNATE_SPINDOWN = (1 << 12), /* don't spindown before hibernation */ 190 ATA_FLAG_NO_HIBERNATE_SPINDOWN = (1 << 12), /* don't spindown before hibernation */
192 ATA_FLAG_DEBUGMSG = (1 << 13), 191 ATA_FLAG_DEBUGMSG = (1 << 13),
192 ATA_FLAG_FPDMA_AA = (1 << 14), /* driver supports Auto-Activate */
193 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */ 193 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */
194 ATA_FLAG_NO_IORDY = (1 << 16), /* controller lacks iordy */ 194 ATA_FLAG_NO_IORDY = (1 << 16), /* controller lacks iordy */
195 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ 195 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */
@@ -386,6 +386,7 @@ enum {
386 ATA_HORKAGE_FIRMWARE_WARN = (1 << 12), /* firmware update warning */ 386 ATA_HORKAGE_FIRMWARE_WARN = (1 << 12), /* firmware update warning */
387 ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */ 387 ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */
388 ATA_HORKAGE_NOSETXFER = (1 << 14), /* skip SETXFER, SATA only */ 388 ATA_HORKAGE_NOSETXFER = (1 << 14), /* skip SETXFER, SATA only */
389 ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */
389 390
390 /* DMA mask for user DMA control: User visible values; DO NOT 391 /* DMA mask for user DMA control: User visible values; DO NOT
391 renumber */ 392 renumber */
@@ -417,6 +418,17 @@ enum {
417 ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER | 418 ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER |
418 ATA_TIMING_DMACK_HOLD | ATA_TIMING_CYCLE | 419 ATA_TIMING_DMACK_HOLD | ATA_TIMING_CYCLE |
419 ATA_TIMING_UDMA, 420 ATA_TIMING_UDMA,
421
422 /* ACPI constants */
423 ATA_ACPI_FILTER_SETXFER = 1 << 0,
424 ATA_ACPI_FILTER_LOCK = 1 << 1,
425 ATA_ACPI_FILTER_DIPM = 1 << 2,
426 ATA_ACPI_FILTER_FPDMA_OFFSET = 1 << 3, /* FPDMA non-zero offset */
427 ATA_ACPI_FILTER_FPDMA_AA = 1 << 4, /* FPDMA auto activate */
428
429 ATA_ACPI_FILTER_DEFAULT = ATA_ACPI_FILTER_SETXFER |
430 ATA_ACPI_FILTER_LOCK |
431 ATA_ACPI_FILTER_DIPM,
420}; 432};
421 433
422enum ata_xfer_mask { 434enum ata_xfer_mask {
@@ -586,6 +598,7 @@ struct ata_device {
586#ifdef CONFIG_ATA_ACPI 598#ifdef CONFIG_ATA_ACPI
587 acpi_handle acpi_handle; 599 acpi_handle acpi_handle;
588 union acpi_object *gtf_cache; 600 union acpi_object *gtf_cache;
601 unsigned int gtf_filter;
589#endif 602#endif
590 /* n_sector is CLEAR_BEGIN, read comment above CLEAR_BEGIN */ 603 /* n_sector is CLEAR_BEGIN, read comment above CLEAR_BEGIN */
591 u64 n_sectors; /* size of device, if ATA */ 604 u64 n_sectors; /* size of device, if ATA */
diff --git a/include/linux/libps2.h b/include/linux/libps2.h
index b94534b7e266..79603a6c356f 100644
--- a/include/linux/libps2.h
+++ b/include/linux/libps2.h
@@ -44,6 +44,9 @@ struct ps2dev {
44void ps2_init(struct ps2dev *ps2dev, struct serio *serio); 44void ps2_init(struct ps2dev *ps2dev, struct serio *serio);
45int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout); 45int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout);
46void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout); 46void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout);
47void ps2_begin_command(struct ps2dev *ps2dev);
48void ps2_end_command(struct ps2dev *ps2dev);
49int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command);
47int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command); 50int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command);
48int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data); 51int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data);
49int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data); 52int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data);
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 691f59171c6c..5126cceb6ae9 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -57,6 +57,7 @@
57 57
58#ifdef __ASSEMBLY__ 58#ifdef __ASSEMBLY__
59 59
60#ifndef LINKER_SCRIPT
60#define ALIGN __ALIGN 61#define ALIGN __ALIGN
61#define ALIGN_STR __ALIGN_STR 62#define ALIGN_STR __ALIGN_STR
62 63
@@ -66,6 +67,7 @@
66 ALIGN; \ 67 ALIGN; \
67 name: 68 name:
68#endif 69#endif
70#endif /* LINKER_SCRIPT */
69 71
70#ifndef WEAK 72#ifndef WEAK
71#define WEAK(name) \ 73#define WEAK(name) \
diff --git a/include/linux/lis3lv02d.h b/include/linux/lis3lv02d.h
index ad651f4e45ac..3cc2f2c53e4c 100644
--- a/include/linux/lis3lv02d.h
+++ b/include/linux/lis3lv02d.h
@@ -32,8 +32,17 @@ struct lis3lv02d_platform_data {
32#define LIS3_IRQ2_DATA_READY (4 << 3) 32#define LIS3_IRQ2_DATA_READY (4 << 3)
33#define LIS3_IRQ2_CLICK (7 << 3) 33#define LIS3_IRQ2_CLICK (7 << 3)
34#define LIS3_IRQ_OPEN_DRAIN (1 << 6) 34#define LIS3_IRQ_OPEN_DRAIN (1 << 6)
35#define LIS3_IRQ_ACTIVE_HIGH (1 << 7) 35#define LIS3_IRQ_ACTIVE_LOW (1 << 7)
36 unsigned char irq_cfg; 36 unsigned char irq_cfg;
37
38#define LIS3_WAKEUP_X_LO (1 << 0)
39#define LIS3_WAKEUP_X_HI (1 << 1)
40#define LIS3_WAKEUP_Y_LO (1 << 2)
41#define LIS3_WAKEUP_Y_HI (1 << 3)
42#define LIS3_WAKEUP_Z_LO (1 << 4)
43#define LIS3_WAKEUP_Z_HI (1 << 5)
44 unsigned char wakeup_flags;
45 unsigned char wakeup_thresh;
37}; 46};
38 47
39#endif /* __LIS3LV02D_H_ */ 48#endif /* __LIS3LV02D_H_ */
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index c325b187966b..a34dea46b629 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -338,49 +338,6 @@ static inline int nlm_privileged_requester(const struct svc_rqst *rqstp)
338 } 338 }
339} 339}
340 340
341static inline int __nlm_cmp_addr4(const struct sockaddr *sap1,
342 const struct sockaddr *sap2)
343{
344 const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1;
345 const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2;
346 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
347}
348
349#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
350static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
351 const struct sockaddr *sap2)
352{
353 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
354 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
355 return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr);
356}
357#else /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
358static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
359 const struct sockaddr *sap2)
360{
361 return 0;
362}
363#endif /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
364
365/*
366 * Compare two host addresses
367 *
368 * Return TRUE if the addresses are the same; otherwise FALSE.
369 */
370static inline int nlm_cmp_addr(const struct sockaddr *sap1,
371 const struct sockaddr *sap2)
372{
373 if (sap1->sa_family == sap2->sa_family) {
374 switch (sap1->sa_family) {
375 case AF_INET:
376 return __nlm_cmp_addr4(sap1, sap2);
377 case AF_INET6:
378 return __nlm_cmp_addr6(sap1, sap2);
379 }
380 }
381 return 0;
382}
383
384/* 341/*
385 * Compare two NLM locks. 342 * Compare two NLM locks.
386 * When the second lock is of type F_UNLCK, this acts like a wildcard. 343 * When the second lock is of type F_UNLCK, this acts like a wildcard.
@@ -395,7 +352,7 @@ static inline int nlm_compare_locks(const struct file_lock *fl1,
395 &&(fl1->fl_type == fl2->fl_type || fl2->fl_type == F_UNLCK); 352 &&(fl1->fl_type == fl2->fl_type || fl2->fl_type == F_UNLCK);
396} 353}
397 354
398extern struct lock_manager_operations nlmsvc_lock_operations; 355extern const struct lock_manager_operations nlmsvc_lock_operations;
399 356
400#endif /* __KERNEL__ */ 357#endif /* __KERNEL__ */
401 358
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index b25d1b53df0d..9ccf0e286b2a 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -149,6 +149,12 @@ struct lock_list {
149 struct lock_class *class; 149 struct lock_class *class;
150 struct stack_trace trace; 150 struct stack_trace trace;
151 int distance; 151 int distance;
152
153 /*
154 * The parent field is used to implement breadth-first search, and the
155 * bit 0 is reused to indicate if the lock has been accessed in BFS.
156 */
157 struct lock_list *parent;
152}; 158};
153 159
154/* 160/*
@@ -208,10 +214,12 @@ struct held_lock {
208 * interrupt context: 214 * interrupt context:
209 */ 215 */
210 unsigned int irq_context:2; /* bit 0 - soft, bit 1 - hard */ 216 unsigned int irq_context:2; /* bit 0 - soft, bit 1 - hard */
211 unsigned int trylock:1; 217 unsigned int trylock:1; /* 16 bits */
218
212 unsigned int read:2; /* see lock_acquire() comment */ 219 unsigned int read:2; /* see lock_acquire() comment */
213 unsigned int check:2; /* see lock_acquire() comment */ 220 unsigned int check:2; /* see lock_acquire() comment */
214 unsigned int hardirqs_off:1; 221 unsigned int hardirqs_off:1;
222 unsigned int references:11; /* 32 bits */
215}; 223};
216 224
217/* 225/*
@@ -291,6 +299,10 @@ extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
291extern void lock_release(struct lockdep_map *lock, int nested, 299extern void lock_release(struct lockdep_map *lock, int nested,
292 unsigned long ip); 300 unsigned long ip);
293 301
302#define lockdep_is_held(lock) lock_is_held(&(lock)->dep_map)
303
304extern int lock_is_held(struct lockdep_map *lock);
305
294extern void lock_set_class(struct lockdep_map *lock, const char *name, 306extern void lock_set_class(struct lockdep_map *lock, const char *name,
295 struct lock_class_key *key, unsigned int subclass, 307 struct lock_class_key *key, unsigned int subclass,
296 unsigned long ip); 308 unsigned long ip);
@@ -309,6 +321,8 @@ extern void lockdep_trace_alloc(gfp_t mask);
309 321
310#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0) 322#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0)
311 323
324#define lockdep_assert_held(l) WARN_ON(debug_locks && !lockdep_is_held(l))
325
312#else /* !LOCKDEP */ 326#else /* !LOCKDEP */
313 327
314static inline void lockdep_off(void) 328static inline void lockdep_off(void)
@@ -353,6 +367,8 @@ struct lock_class_key { };
353 367
354#define lockdep_depth(tsk) (0) 368#define lockdep_depth(tsk) (0)
355 369
370#define lockdep_assert_held(l) do { } while (0)
371
356#endif /* !LOCKDEP */ 372#endif /* !LOCKDEP */
357 373
358#ifdef CONFIG_LOCK_STAT 374#ifdef CONFIG_LOCK_STAT
diff --git a/include/linux/lsm_audit.h b/include/linux/lsm_audit.h
index e461b2c3d711..190c37854870 100644
--- a/include/linux/lsm_audit.h
+++ b/include/linux/lsm_audit.h
@@ -33,6 +33,7 @@ struct common_audit_data {
33#define LSM_AUDIT_DATA_IPC 4 33#define LSM_AUDIT_DATA_IPC 4
34#define LSM_AUDIT_DATA_TASK 5 34#define LSM_AUDIT_DATA_TASK 5
35#define LSM_AUDIT_DATA_KEY 6 35#define LSM_AUDIT_DATA_KEY 6
36#define LSM_AUDIT_NO_AUDIT 7
36 struct task_struct *tsk; 37 struct task_struct *tsk;
37 union { 38 union {
38 struct { 39 struct {
@@ -66,16 +67,19 @@ struct common_audit_data {
66 } key_struct; 67 } key_struct;
67#endif 68#endif
68 } u; 69 } u;
69 const char *function;
70 /* this union contains LSM specific data */ 70 /* this union contains LSM specific data */
71 union { 71 union {
72#ifdef CONFIG_SECURITY_SMACK
72 /* SMACK data */ 73 /* SMACK data */
73 struct smack_audit_data { 74 struct smack_audit_data {
75 const char *function;
74 char *subject; 76 char *subject;
75 char *object; 77 char *object;
76 char *request; 78 char *request;
77 int result; 79 int result;
78 } smack_audit_data; 80 } smack_audit_data;
81#endif
82#ifdef CONFIG_SECURITY_SELINUX
79 /* SELinux data */ 83 /* SELinux data */
80 struct { 84 struct {
81 u32 ssid; 85 u32 ssid;
@@ -83,10 +87,12 @@ struct common_audit_data {
83 u16 tclass; 87 u16 tclass;
84 u32 requested; 88 u32 requested;
85 u32 audited; 89 u32 audited;
90 u32 denied;
86 struct av_decision *avd; 91 struct av_decision *avd;
87 int result; 92 int result;
88 } selinux_audit_data; 93 } selinux_audit_data;
89 } lsm_priv; 94#endif
95 };
90 /* these callback will be implemented by a specific LSM */ 96 /* these callback will be implemented by a specific LSM */
91 void (*lsm_pre_audit)(struct audit_buffer *, void *); 97 void (*lsm_pre_audit)(struct audit_buffer *, void *);
92 void (*lsm_post_audit)(struct audit_buffer *, void *); 98 void (*lsm_post_audit)(struct audit_buffer *, void *);
@@ -104,7 +110,7 @@ int ipv6_skb_to_auditdata(struct sk_buff *skb,
104/* Initialize an LSM audit data structure. */ 110/* Initialize an LSM audit data structure. */
105#define COMMON_AUDIT_DATA_INIT(_d, _t) \ 111#define COMMON_AUDIT_DATA_INIT(_d, _t) \
106 { memset((_d), 0, sizeof(struct common_audit_data)); \ 112 { memset((_d), 0, sizeof(struct common_audit_data)); \
107 (_d)->type = LSM_AUDIT_DATA_##_t; (_d)->function = __func__; } 113 (_d)->type = LSM_AUDIT_DATA_##_t; }
108 114
109void common_lsm_audit(struct common_audit_data *a); 115void common_lsm_audit(struct common_audit_data *a);
110 116
diff --git a/include/linux/mISDNhw.h b/include/linux/mISDNhw.h
index 7f9831da847f..4af841408fb5 100644
--- a/include/linux/mISDNhw.h
+++ b/include/linux/mISDNhw.h
@@ -168,6 +168,7 @@ struct bchannel {
168extern int mISDN_initdchannel(struct dchannel *, int, void *); 168extern int mISDN_initdchannel(struct dchannel *, int, void *);
169extern int mISDN_initbchannel(struct bchannel *, int); 169extern int mISDN_initbchannel(struct bchannel *, int);
170extern int mISDN_freedchannel(struct dchannel *); 170extern int mISDN_freedchannel(struct dchannel *);
171extern void mISDN_clear_bchannel(struct bchannel *);
171extern int mISDN_freebchannel(struct bchannel *); 172extern int mISDN_freebchannel(struct bchannel *);
172extern void queue_ch_frame(struct mISDNchannel *, u_int, 173extern void queue_ch_frame(struct mISDNchannel *, u_int,
173 int, struct sk_buff *); 174 int, struct sk_buff *);
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h
index 45100b39a7cf..78c3bed1c3f5 100644
--- a/include/linux/mISDNif.h
+++ b/include/linux/mISDNif.h
@@ -37,7 +37,7 @@
37 */ 37 */
38#define MISDN_MAJOR_VERSION 1 38#define MISDN_MAJOR_VERSION 1
39#define MISDN_MINOR_VERSION 1 39#define MISDN_MINOR_VERSION 1
40#define MISDN_RELEASE 20 40#define MISDN_RELEASE 21
41 41
42/* primitives for information exchange 42/* primitives for information exchange
43 * generell format 43 * generell format
@@ -104,7 +104,7 @@
104#define DL_UNITDATA_IND 0x3108 104#define DL_UNITDATA_IND 0x3108
105#define DL_INFORMATION_IND 0x0008 105#define DL_INFORMATION_IND 0x0008
106 106
107/* intern layer 2 managment */ 107/* intern layer 2 management */
108#define MDL_ASSIGN_REQ 0x1804 108#define MDL_ASSIGN_REQ 0x1804
109#define MDL_ASSIGN_IND 0x1904 109#define MDL_ASSIGN_IND 0x1904
110#define MDL_REMOVE_REQ 0x1A04 110#define MDL_REMOVE_REQ 0x1A04
@@ -153,6 +153,18 @@
153#define HFC_VOL_CHANGE_RX 0x2602 153#define HFC_VOL_CHANGE_RX 0x2602
154#define HFC_SPL_LOOP_ON 0x2603 154#define HFC_SPL_LOOP_ON 0x2603
155#define HFC_SPL_LOOP_OFF 0x2604 155#define HFC_SPL_LOOP_OFF 0x2604
156/* for T30 FAX and analog modem */
157#define HW_MOD_FRM 0x4000
158#define HW_MOD_FRH 0x4001
159#define HW_MOD_FTM 0x4002
160#define HW_MOD_FTH 0x4003
161#define HW_MOD_FTS 0x4004
162#define HW_MOD_CONNECT 0x4010
163#define HW_MOD_OK 0x4011
164#define HW_MOD_NOCARR 0x4012
165#define HW_MOD_FCERROR 0x4013
166#define HW_MOD_READY 0x4014
167#define HW_MOD_LASTDATA 0x4015
156 168
157/* DSP_TONE_PATT_ON parameter */ 169/* DSP_TONE_PATT_ON parameter */
158#define TONE_OFF 0x0000 170#define TONE_OFF 0x0000
@@ -224,6 +236,8 @@
224#define ISDN_P_B_L2DTMF 0x24 236#define ISDN_P_B_L2DTMF 0x24
225#define ISDN_P_B_L2DSP 0x25 237#define ISDN_P_B_L2DSP 0x25
226#define ISDN_P_B_L2DSPHDLC 0x26 238#define ISDN_P_B_L2DSPHDLC 0x26
239#define ISDN_P_B_T30_FAX 0x27
240#define ISDN_P_B_MODEM_ASYNC 0x28
227 241
228#define OPTION_L2_PMX 1 242#define OPTION_L2_PMX 1
229#define OPTION_L2_PTP 2 243#define OPTION_L2_PTP 2
diff --git a/include/linux/magic.h b/include/linux/magic.h
index 1923327b9869..76285e01b39e 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -12,7 +12,9 @@
12#define SYSFS_MAGIC 0x62656572 12#define SYSFS_MAGIC 0x62656572
13#define SECURITYFS_MAGIC 0x73636673 13#define SECURITYFS_MAGIC 0x73636673
14#define SELINUX_MAGIC 0xf97cff8c 14#define SELINUX_MAGIC 0xf97cff8c
15#define RAMFS_MAGIC 0x858458f6 /* some random number */
15#define TMPFS_MAGIC 0x01021994 16#define TMPFS_MAGIC 0x01021994
17#define HUGETLBFS_MAGIC 0x958458f6 /* some random number */
16#define SQUASHFS_MAGIC 0x73717368 18#define SQUASHFS_MAGIC 0x73717368
17#define EFS_SUPER_MAGIC 0x414A53 19#define EFS_SUPER_MAGIC 0x414A53
18#define EXT2_SUPER_MAGIC 0xEF53 20#define EXT2_SUPER_MAGIC 0xEF53
@@ -53,4 +55,8 @@
53#define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA 55#define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA
54 56
55#define STACK_END_MAGIC 0x57AC6E9D 57#define STACK_END_MAGIC 0x57AC6E9D
58
59#define DEVPTS_SUPER_MAGIC 0x1cd1
60#define SOCKFS_MAGIC 0x534F434B
61
56#endif /* __LINUX_MAGIC_H__ */ 62#endif /* __LINUX_MAGIC_H__ */
diff --git a/include/linux/marker.h b/include/linux/marker.h
deleted file mode 100644
index b85e74ca782f..000000000000
--- a/include/linux/marker.h
+++ /dev/null
@@ -1,221 +0,0 @@
1#ifndef _LINUX_MARKER_H
2#define _LINUX_MARKER_H
3
4/*
5 * Code markup for dynamic and static tracing.
6 *
7 * See Documentation/marker.txt.
8 *
9 * (C) Copyright 2006 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
10 *
11 * This file is released under the GPLv2.
12 * See the file COPYING for more details.
13 */
14
15#include <stdarg.h>
16#include <linux/types.h>
17
18struct module;
19struct marker;
20
21/**
22 * marker_probe_func - Type of a marker probe function
23 * @probe_private: probe private data
24 * @call_private: call site private data
25 * @fmt: format string
26 * @args: variable argument list pointer. Use a pointer to overcome C's
27 * inability to pass this around as a pointer in a portable manner in
28 * the callee otherwise.
29 *
30 * Type of marker probe functions. They receive the mdata and need to parse the
31 * format string to recover the variable argument list.
32 */
33typedef void marker_probe_func(void *probe_private, void *call_private,
34 const char *fmt, va_list *args);
35
36struct marker_probe_closure {
37 marker_probe_func *func; /* Callback */
38 void *probe_private; /* Private probe data */
39};
40
41struct marker {
42 const char *name; /* Marker name */
43 const char *format; /* Marker format string, describing the
44 * variable argument list.
45 */
46 char state; /* Marker state. */
47 char ptype; /* probe type : 0 : single, 1 : multi */
48 /* Probe wrapper */
49 void (*call)(const struct marker *mdata, void *call_private, ...);
50 struct marker_probe_closure single;
51 struct marker_probe_closure *multi;
52 const char *tp_name; /* Optional tracepoint name */
53 void *tp_cb; /* Optional tracepoint callback */
54} __attribute__((aligned(8)));
55
56#ifdef CONFIG_MARKERS
57
58#define _DEFINE_MARKER(name, tp_name_str, tp_cb, format) \
59 static const char __mstrtab_##name[] \
60 __attribute__((section("__markers_strings"))) \
61 = #name "\0" format; \
62 static struct marker __mark_##name \
63 __attribute__((section("__markers"), aligned(8))) = \
64 { __mstrtab_##name, &__mstrtab_##name[sizeof(#name)], \
65 0, 0, marker_probe_cb, { __mark_empty_function, NULL},\
66 NULL, tp_name_str, tp_cb }
67
68#define DEFINE_MARKER(name, format) \
69 _DEFINE_MARKER(name, NULL, NULL, format)
70
71#define DEFINE_MARKER_TP(name, tp_name, tp_cb, format) \
72 _DEFINE_MARKER(name, #tp_name, tp_cb, format)
73
74/*
75 * Note : the empty asm volatile with read constraint is used here instead of a
76 * "used" attribute to fix a gcc 4.1.x bug.
77 * Make sure the alignment of the structure in the __markers section will
78 * not add unwanted padding between the beginning of the section and the
79 * structure. Force alignment to the same alignment as the section start.
80 *
81 * The "generic" argument controls which marker enabling mechanism must be used.
82 * If generic is true, a variable read is used.
83 * If generic is false, immediate values are used.
84 */
85#define __trace_mark(generic, name, call_private, format, args...) \
86 do { \
87 DEFINE_MARKER(name, format); \
88 __mark_check_format(format, ## args); \
89 if (unlikely(__mark_##name.state)) { \
90 (*__mark_##name.call) \
91 (&__mark_##name, call_private, ## args);\
92 } \
93 } while (0)
94
95#define __trace_mark_tp(name, call_private, tp_name, tp_cb, format, args...) \
96 do { \
97 void __check_tp_type(void) \
98 { \
99 register_trace_##tp_name(tp_cb); \
100 } \
101 DEFINE_MARKER_TP(name, tp_name, tp_cb, format); \
102 __mark_check_format(format, ## args); \
103 (*__mark_##name.call)(&__mark_##name, call_private, \
104 ## args); \
105 } while (0)
106
107extern void marker_update_probe_range(struct marker *begin,
108 struct marker *end);
109
110#define GET_MARKER(name) (__mark_##name)
111
112#else /* !CONFIG_MARKERS */
113#define DEFINE_MARKER(name, tp_name, tp_cb, format)
114#define __trace_mark(generic, name, call_private, format, args...) \
115 __mark_check_format(format, ## args)
116#define __trace_mark_tp(name, call_private, tp_name, tp_cb, format, args...) \
117 do { \
118 void __check_tp_type(void) \
119 { \
120 register_trace_##tp_name(tp_cb); \
121 } \
122 __mark_check_format(format, ## args); \
123 } while (0)
124static inline void marker_update_probe_range(struct marker *begin,
125 struct marker *end)
126{ }
127#define GET_MARKER(name)
128#endif /* CONFIG_MARKERS */
129
130/**
131 * trace_mark - Marker using code patching
132 * @name: marker name, not quoted.
133 * @format: format string
134 * @args...: variable argument list
135 *
136 * Places a marker using optimized code patching technique (imv_read())
137 * to be enabled when immediate values are present.
138 */
139#define trace_mark(name, format, args...) \
140 __trace_mark(0, name, NULL, format, ## args)
141
142/**
143 * _trace_mark - Marker using variable read
144 * @name: marker name, not quoted.
145 * @format: format string
146 * @args...: variable argument list
147 *
148 * Places a marker using a standard memory read (_imv_read()) to be
149 * enabled. Should be used for markers in code paths where instruction
150 * modification based enabling is not welcome. (__init and __exit functions,
151 * lockdep, some traps, printk).
152 */
153#define _trace_mark(name, format, args...) \
154 __trace_mark(1, name, NULL, format, ## args)
155
156/**
157 * trace_mark_tp - Marker in a tracepoint callback
158 * @name: marker name, not quoted.
159 * @tp_name: tracepoint name, not quoted.
160 * @tp_cb: tracepoint callback. Should have an associated global symbol so it
161 * is not optimized away by the compiler (should not be static).
162 * @format: format string
163 * @args...: variable argument list
164 *
165 * Places a marker in a tracepoint callback.
166 */
167#define trace_mark_tp(name, tp_name, tp_cb, format, args...) \
168 __trace_mark_tp(name, NULL, tp_name, tp_cb, format, ## args)
169
170/**
171 * MARK_NOARGS - Format string for a marker with no argument.
172 */
173#define MARK_NOARGS " "
174
175/* To be used for string format validity checking with gcc */
176static inline void __printf(1, 2) ___mark_check_format(const char *fmt, ...)
177{
178}
179
180#define __mark_check_format(format, args...) \
181 do { \
182 if (0) \
183 ___mark_check_format(format, ## args); \
184 } while (0)
185
186extern marker_probe_func __mark_empty_function;
187
188extern void marker_probe_cb(const struct marker *mdata,
189 void *call_private, ...);
190
191/*
192 * Connect a probe to a marker.
193 * private data pointer must be a valid allocated memory address, or NULL.
194 */
195extern int marker_probe_register(const char *name, const char *format,
196 marker_probe_func *probe, void *probe_private);
197
198/*
199 * Returns the private data given to marker_probe_register.
200 */
201extern int marker_probe_unregister(const char *name,
202 marker_probe_func *probe, void *probe_private);
203/*
204 * Unregister a marker by providing the registered private data.
205 */
206extern int marker_probe_unregister_private_data(marker_probe_func *probe,
207 void *probe_private);
208
209extern void *marker_get_private_data(const char *name, marker_probe_func *probe,
210 int num);
211
212/*
213 * marker_synchronize_unregister must be called between the last marker probe
214 * unregistration and the first one of
215 * - the end of module exit function
216 * - the free of any resource used by the probes
217 * to ensure the code and data are valid for any possibly running probes.
218 */
219#define marker_synchronize_unregister() synchronize_sched()
220
221#endif
diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index cfdf1df2875e..c779b49a1fda 100644
--- a/include/linux/mdio.h
+++ b/include/linux/mdio.h
@@ -304,7 +304,7 @@ static inline __u16 mdio_phy_id_devad(int phy_id)
304 */ 304 */
305struct mdio_if_info { 305struct mdio_if_info {
306 int prtad; 306 int prtad;
307 u32 __bitwise mmds; 307 u32 mmds;
308 unsigned mode_support; 308 unsigned mode_support;
309 309
310 struct net_device *dev; 310 struct net_device *dev;
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index e46a0734ab6e..bf9213b2db8f 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -118,6 +118,9 @@ static inline bool mem_cgroup_disabled(void)
118 118
119extern bool mem_cgroup_oom_called(struct task_struct *task); 119extern bool mem_cgroup_oom_called(struct task_struct *task);
120void mem_cgroup_update_mapped_file_stat(struct page *page, int val); 120void mem_cgroup_update_mapped_file_stat(struct page *page, int val);
121unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
122 gfp_t gfp_mask, int nid,
123 int zid);
121#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 124#else /* CONFIG_CGROUP_MEM_RES_CTLR */
122struct mem_cgroup; 125struct mem_cgroup;
123 126
@@ -276,6 +279,13 @@ static inline void mem_cgroup_update_mapped_file_stat(struct page *page,
276{ 279{
277} 280}
278 281
282static inline
283unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
284 gfp_t gfp_mask, int nid, int zid)
285{
286 return 0;
287}
288
279#endif /* CONFIG_CGROUP_MEM_CONT */ 289#endif /* CONFIG_CGROUP_MEM_CONT */
280 290
281#endif /* _LINUX_MEMCONTROL_H */ 291#endif /* _LINUX_MEMCONTROL_H */
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index d95f72e79b82..fed969281a41 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -191,14 +191,6 @@ static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
191 191
192#endif /* ! CONFIG_MEMORY_HOTPLUG */ 192#endif /* ! CONFIG_MEMORY_HOTPLUG */
193 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 194#ifdef CONFIG_MEMORY_HOTREMOVE
203 195
204extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages); 196extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
diff --git a/include/linux/mempool.h b/include/linux/mempool.h
index 9be484d11283..7c08052e3321 100644
--- a/include/linux/mempool.h
+++ b/include/linux/mempool.h
@@ -47,22 +47,16 @@ mempool_create_slab_pool(int min_nr, struct kmem_cache *kc)
47} 47}
48 48
49/* 49/*
50 * 2 mempool_alloc_t's and a mempool_free_t to kmalloc/kzalloc and kfree 50 * a mempool_alloc_t and a mempool_free_t to kmalloc and kfree the
51 * the amount of memory specified by pool_data 51 * amount of memory specified by pool_data
52 */ 52 */
53void *mempool_kmalloc(gfp_t gfp_mask, void *pool_data); 53void *mempool_kmalloc(gfp_t gfp_mask, void *pool_data);
54void *mempool_kzalloc(gfp_t gfp_mask, void *pool_data);
55void mempool_kfree(void *element, void *pool_data); 54void mempool_kfree(void *element, void *pool_data);
56static inline mempool_t *mempool_create_kmalloc_pool(int min_nr, size_t size) 55static inline mempool_t *mempool_create_kmalloc_pool(int min_nr, size_t size)
57{ 56{
58 return mempool_create(min_nr, mempool_kmalloc, mempool_kfree, 57 return mempool_create(min_nr, mempool_kmalloc, mempool_kfree,
59 (void *) size); 58 (void *) size);
60} 59}
61static inline mempool_t *mempool_create_kzalloc_pool(int min_nr, size_t size)
62{
63 return mempool_create(min_nr, mempool_kzalloc, mempool_kfree,
64 (void *) size);
65}
66 60
67/* 61/*
68 * A mempool_alloc_t and mempool_free_t for a simple page allocator that 62 * A mempool_alloc_t and mempool_free_t for a simple page allocator that
diff --git a/include/linux/mfd/ab3100.h b/include/linux/mfd/ab3100.h
index 7a3f316e3848..e9aa4c9d749d 100644
--- a/include/linux/mfd/ab3100.h
+++ b/include/linux/mfd/ab3100.h
@@ -6,6 +6,8 @@
6 */ 6 */
7 7
8#include <linux/device.h> 8#include <linux/device.h>
9#include <linux/workqueue.h>
10#include <linux/regulator/machine.h>
9 11
10#ifndef MFD_AB3100_H 12#ifndef MFD_AB3100_H
11#define MFD_AB3100_H 13#define MFD_AB3100_H
@@ -56,6 +58,14 @@
56#define AB3100_STR_BATT_REMOVAL (0x40) 58#define AB3100_STR_BATT_REMOVAL (0x40)
57#define AB3100_STR_VBUS (0x80) 59#define AB3100_STR_VBUS (0x80)
58 60
61/*
62 * AB3100 contains 8 regulators, one external regulator controller
63 * and a buck converter, further the LDO E and buck converter can
64 * have separate settings if they are in sleep mode, this is
65 * modeled as a separate regulator.
66 */
67#define AB3100_NUM_REGULATORS 10
68
59/** 69/**
60 * struct ab3100 70 * struct ab3100
61 * @access_mutex: lock out concurrent accesses to the AB3100 registers 71 * @access_mutex: lock out concurrent accesses to the AB3100 registers
@@ -86,11 +96,30 @@ struct ab3100 {
86 bool startup_events_read; 96 bool startup_events_read;
87}; 97};
88 98
89int ab3100_set_register(struct ab3100 *ab3100, u8 reg, u8 regval); 99/**
90int ab3100_get_register(struct ab3100 *ab3100, u8 reg, u8 *regval); 100 * struct ab3100_platform_data
91int ab3100_get_register_page(struct ab3100 *ab3100, 101 * Data supplied to initialize board connections to the AB3100
102 * @reg_constraints: regulator constraints for target board
103 * the order of these constraints are: LDO A, C, D, E,
104 * F, G, H, K, EXT and BUCK.
105 * @reg_initvals: initial values for the regulator registers
106 * plus two sleep settings for LDO E and the BUCK converter.
107 * exactly AB3100_NUM_REGULATORS+2 values must be sent in.
108 * Order: LDO A, C, E, E sleep, F, G, H, K, EXT, BUCK,
109 * BUCK sleep, LDO D. (LDO D need to be initialized last.)
110 * @external_voltage: voltage level of the external regulator.
111 */
112struct ab3100_platform_data {
113 struct regulator_init_data reg_constraints[AB3100_NUM_REGULATORS];
114 u8 reg_initvals[AB3100_NUM_REGULATORS+2];
115 int external_voltage;
116};
117
118int ab3100_set_register_interruptible(struct ab3100 *ab3100, u8 reg, u8 regval);
119int ab3100_get_register_interruptible(struct ab3100 *ab3100, u8 reg, u8 *regval);
120int ab3100_get_register_page_interruptible(struct ab3100 *ab3100,
92 u8 first_reg, u8 *regvals, u8 numregs); 121 u8 first_reg, u8 *regvals, u8 numregs);
93int ab3100_mask_and_set_register(struct ab3100 *ab3100, 122int ab3100_mask_and_set_register_interruptible(struct ab3100 *ab3100,
94 u8 reg, u8 andmask, u8 ormask); 123 u8 reg, u8 andmask, u8 ormask);
95u8 ab3100_get_chip_type(struct ab3100 *ab3100); 124u8 ab3100_get_chip_type(struct ab3100 *ab3100);
96int ab3100_event_register(struct ab3100 *ab3100, 125int ab3100_event_register(struct ab3100 *ab3100,
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index 49ef857cdb2d..11d740b8831d 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -23,6 +23,7 @@
23 */ 23 */
24struct mfd_cell { 24struct mfd_cell {
25 const char *name; 25 const char *name;
26 int id;
26 27
27 int (*enable)(struct platform_device *dev); 28 int (*enable)(struct platform_device *dev);
28 int (*disable)(struct platform_device *dev); 29 int (*disable)(struct platform_device *dev);
diff --git a/include/linux/mfd/da903x.h b/include/linux/mfd/da903x.h
index 115dbe965082..c63b65c94429 100644
--- a/include/linux/mfd/da903x.h
+++ b/include/linux/mfd/da903x.h
@@ -1,7 +1,7 @@
1#ifndef __LINUX_PMIC_DA903X_H 1#ifndef __LINUX_PMIC_DA903X_H
2#define __LINUX_PMIC_DA903X_H 2#define __LINUX_PMIC_DA903X_H
3 3
4/* Unified sub device IDs for DA9030/DA9034 */ 4/* Unified sub device IDs for DA9030/DA9034/DA9035 */
5enum { 5enum {
6 DA9030_ID_LED_1, 6 DA9030_ID_LED_1,
7 DA9030_ID_LED_2, 7 DA9030_ID_LED_2,
@@ -57,6 +57,8 @@ enum {
57 DA9034_ID_LDO13, 57 DA9034_ID_LDO13,
58 DA9034_ID_LDO14, 58 DA9034_ID_LDO14,
59 DA9034_ID_LDO15, 59 DA9034_ID_LDO15,
60
61 DA9035_ID_BUCK3,
60}; 62};
61 63
62/* 64/*
diff --git a/include/linux/mfd/ezx-pcap.h b/include/linux/mfd/ezx-pcap.h
index c12c3c0932bf..e5124ceea769 100644
--- a/include/linux/mfd/ezx-pcap.h
+++ b/include/linux/mfd/ezx-pcap.h
@@ -25,9 +25,12 @@ struct pcap_chip;
25 25
26int ezx_pcap_write(struct pcap_chip *, u8, u32); 26int ezx_pcap_write(struct pcap_chip *, u8, u32);
27int ezx_pcap_read(struct pcap_chip *, u8, u32 *); 27int ezx_pcap_read(struct pcap_chip *, u8, u32 *);
28int ezx_pcap_set_bits(struct pcap_chip *, u8, u32, u32);
28int pcap_to_irq(struct pcap_chip *, int); 29int pcap_to_irq(struct pcap_chip *, int);
30int irq_to_pcap(struct pcap_chip *, int);
29int pcap_adc_async(struct pcap_chip *, u8, u32, u8[], void *, void *); 31int pcap_adc_async(struct pcap_chip *, u8, u32, u8[], void *, void *);
30int pcap_adc_sync(struct pcap_chip *, u8, u32, u8[], u16[]); 32int pcap_adc_sync(struct pcap_chip *, u8, u32, u8[], u16[]);
33void pcap_set_ts_bits(struct pcap_chip *, u32);
31 34
32#define PCAP_SECOND_PORT 1 35#define PCAP_SECOND_PORT 1
33#define PCAP_CS_AH 2 36#define PCAP_CS_AH 2
@@ -224,7 +227,6 @@ int pcap_adc_sync(struct pcap_chip *, u8, u32, u8[], u16[]);
224#define PCAP_LED1 1 227#define PCAP_LED1 1
225#define PCAP_BL0 2 228#define PCAP_BL0 2
226#define PCAP_BL1 3 229#define PCAP_BL1 3
227#define PCAP_VIB 4
228#define PCAP_LED_3MA 0 230#define PCAP_LED_3MA 0
229#define PCAP_LED_4MA 1 231#define PCAP_LED_4MA 1
230#define PCAP_LED_5MA 2 232#define PCAP_LED_5MA 2
@@ -243,9 +245,6 @@ int pcap_adc_sync(struct pcap_chip *, u8, u32, u8[], u16[]);
243#define PCAP_LED0_C_SHIFT 15 245#define PCAP_LED0_C_SHIFT 15
244#define PCAP_LED1_C_SHIFT 17 246#define PCAP_LED1_C_SHIFT 17
245#define PCAP_BL1_SHIFT 20 247#define PCAP_BL1_SHIFT 20
246#define PCAP_VIB_MASK 0x3
247#define PCAP_VIB_SHIFT 20
248#define PCAP_VIB_EN (1 << 19)
249 248
250/* RTC */ 249/* RTC */
251#define PCAP_RTC_DAY_MASK 0x3fff 250#define PCAP_RTC_DAY_MASK 0x3fff
diff --git a/include/linux/mfd/mc13783-private.h b/include/linux/mfd/mc13783-private.h
new file mode 100644
index 000000000000..47e698cb0f16
--- /dev/null
+++ b/include/linux/mfd/mc13783-private.h
@@ -0,0 +1,396 @@
1/*
2 * Copyright 2009 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
3 *
4 * Initial development of this code was funded by
5 * Phytec Messtechnik GmbH, http://www.phytec.de
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#ifndef __LINUX_MFD_MC13783_PRIV_H
23#define __LINUX_MFD_MC13783_PRIV_H
24
25#include <linux/platform_device.h>
26#include <linux/mfd/mc13783.h>
27#include <linux/workqueue.h>
28#include <linux/mutex.h>
29
30struct mc13783_irq {
31 void (*handler)(int, void *);
32 void *data;
33};
34
35#define MC13783_NUM_IRQ 2
36#define MC13783_IRQ_TS 0
37#define MC13783_IRQ_REGULATOR 1
38
39#define MC13783_ADC_MODE_TS 1
40#define MC13783_ADC_MODE_SINGLE_CHAN 2
41#define MC13783_ADC_MODE_MULT_CHAN 3
42
43struct mc13783 {
44 int revision;
45 struct device *dev;
46 struct spi_device *spi_device;
47
48 int (*read_dev)(void *data, char reg, int count, u32 *dst);
49 int (*write_dev)(void *data, char reg, int count, const u32 *src);
50
51 struct mutex io_lock;
52 void *io_data;
53 int irq;
54 unsigned int flags;
55
56 struct mc13783_irq irq_handler[MC13783_NUM_IRQ];
57 struct work_struct work;
58 struct completion adc_done;
59 unsigned int ts_active;
60 struct mutex adc_conv_lock;
61
62 struct mc13783_regulator_init_data *regulators;
63 int num_regulators;
64};
65
66int mc13783_reg_read(struct mc13783 *, int reg_num, u32 *);
67int mc13783_reg_write(struct mc13783 *, int, u32);
68int mc13783_set_bits(struct mc13783 *, int, u32, u32);
69int mc13783_free_irq(struct mc13783 *mc13783, int irq);
70int mc13783_register_irq(struct mc13783 *mc13783, int irq,
71 void (*handler) (int, void *), void *data);
72
73#define MC13783_REG_INTERRUPT_STATUS_0 0
74#define MC13783_REG_INTERRUPT_MASK_0 1
75#define MC13783_REG_INTERRUPT_SENSE_0 2
76#define MC13783_REG_INTERRUPT_STATUS_1 3
77#define MC13783_REG_INTERRUPT_MASK_1 4
78#define MC13783_REG_INTERRUPT_SENSE_1 5
79#define MC13783_REG_POWER_UP_MODE_SENSE 6
80#define MC13783_REG_REVISION 7
81#define MC13783_REG_SEMAPHORE 8
82#define MC13783_REG_ARBITRATION_PERIPHERAL_AUDIO 9
83#define MC13783_REG_ARBITRATION_SWITCHERS 10
84#define MC13783_REG_ARBITRATION_REGULATORS_0 11
85#define MC13783_REG_ARBITRATION_REGULATORS_1 12
86#define MC13783_REG_POWER_CONTROL_0 13
87#define MC13783_REG_POWER_CONTROL_1 14
88#define MC13783_REG_POWER_CONTROL_2 15
89#define MC13783_REG_REGEN_ASSIGNMENT 16
90#define MC13783_REG_CONTROL_SPARE 17
91#define MC13783_REG_MEMORY_A 18
92#define MC13783_REG_MEMORY_B 19
93#define MC13783_REG_RTC_TIME 20
94#define MC13783_REG_RTC_ALARM 21
95#define MC13783_REG_RTC_DAY 22
96#define MC13783_REG_RTC_DAY_ALARM 23
97#define MC13783_REG_SWITCHERS_0 24
98#define MC13783_REG_SWITCHERS_1 25
99#define MC13783_REG_SWITCHERS_2 26
100#define MC13783_REG_SWITCHERS_3 27
101#define MC13783_REG_SWITCHERS_4 28
102#define MC13783_REG_SWITCHERS_5 29
103#define MC13783_REG_REGULATOR_SETTING_0 30
104#define MC13783_REG_REGULATOR_SETTING_1 31
105#define MC13783_REG_REGULATOR_MODE_0 32
106#define MC13783_REG_REGULATOR_MODE_1 33
107#define MC13783_REG_POWER_MISCELLANEOUS 34
108#define MC13783_REG_POWER_SPARE 35
109#define MC13783_REG_AUDIO_RX_0 36
110#define MC13783_REG_AUDIO_RX_1 37
111#define MC13783_REG_AUDIO_TX 38
112#define MC13783_REG_AUDIO_SSI_NETWORK 39
113#define MC13783_REG_AUDIO_CODEC 40
114#define MC13783_REG_AUDIO_STEREO_DAC 41
115#define MC13783_REG_AUDIO_SPARE 42
116#define MC13783_REG_ADC_0 43
117#define MC13783_REG_ADC_1 44
118#define MC13783_REG_ADC_2 45
119#define MC13783_REG_ADC_3 46
120#define MC13783_REG_ADC_4 47
121#define MC13783_REG_CHARGER 48
122#define MC13783_REG_USB 49
123#define MC13783_REG_CHARGE_USB_SPARE 50
124#define MC13783_REG_LED_CONTROL_0 51
125#define MC13783_REG_LED_CONTROL_1 52
126#define MC13783_REG_LED_CONTROL_2 53
127#define MC13783_REG_LED_CONTROL_3 54
128#define MC13783_REG_LED_CONTROL_4 55
129#define MC13783_REG_LED_CONTROL_5 56
130#define MC13783_REG_SPARE 57
131#define MC13783_REG_TRIM_0 58
132#define MC13783_REG_TRIM_1 59
133#define MC13783_REG_TEST_0 60
134#define MC13783_REG_TEST_1 61
135#define MC13783_REG_TEST_2 62
136#define MC13783_REG_TEST_3 63
137#define MC13783_REG_NB 64
138
139
140/*
141 * Interrupt Status
142 */
143#define MC13783_INT_STAT_ADCDONEI (1 << 0)
144#define MC13783_INT_STAT_ADCBISDONEI (1 << 1)
145#define MC13783_INT_STAT_TSI (1 << 2)
146#define MC13783_INT_STAT_WHIGHI (1 << 3)
147#define MC13783_INT_STAT_WLOWI (1 << 4)
148#define MC13783_INT_STAT_CHGDETI (1 << 6)
149#define MC13783_INT_STAT_CHGOVI (1 << 7)
150#define MC13783_INT_STAT_CHGREVI (1 << 8)
151#define MC13783_INT_STAT_CHGSHORTI (1 << 9)
152#define MC13783_INT_STAT_CCCVI (1 << 10)
153#define MC13783_INT_STAT_CHGCURRI (1 << 11)
154#define MC13783_INT_STAT_BPONI (1 << 12)
155#define MC13783_INT_STAT_LOBATLI (1 << 13)
156#define MC13783_INT_STAT_LOBATHI (1 << 14)
157#define MC13783_INT_STAT_UDPI (1 << 15)
158#define MC13783_INT_STAT_USBI (1 << 16)
159#define MC13783_INT_STAT_IDI (1 << 19)
160#define MC13783_INT_STAT_Unused (1 << 20)
161#define MC13783_INT_STAT_SE1I (1 << 21)
162#define MC13783_INT_STAT_CKDETI (1 << 22)
163#define MC13783_INT_STAT_UDMI (1 << 23)
164
165/*
166 * Interrupt Mask
167 */
168#define MC13783_INT_MASK_ADCDONEM (1 << 0)
169#define MC13783_INT_MASK_ADCBISDONEM (1 << 1)
170#define MC13783_INT_MASK_TSM (1 << 2)
171#define MC13783_INT_MASK_WHIGHM (1 << 3)
172#define MC13783_INT_MASK_WLOWM (1 << 4)
173#define MC13783_INT_MASK_CHGDETM (1 << 6)
174#define MC13783_INT_MASK_CHGOVM (1 << 7)
175#define MC13783_INT_MASK_CHGREVM (1 << 8)
176#define MC13783_INT_MASK_CHGSHORTM (1 << 9)
177#define MC13783_INT_MASK_CCCVM (1 << 10)
178#define MC13783_INT_MASK_CHGCURRM (1 << 11)
179#define MC13783_INT_MASK_BPONM (1 << 12)
180#define MC13783_INT_MASK_LOBATLM (1 << 13)
181#define MC13783_INT_MASK_LOBATHM (1 << 14)
182#define MC13783_INT_MASK_UDPM (1 << 15)
183#define MC13783_INT_MASK_USBM (1 << 16)
184#define MC13783_INT_MASK_IDM (1 << 19)
185#define MC13783_INT_MASK_SE1M (1 << 21)
186#define MC13783_INT_MASK_CKDETM (1 << 22)
187
188/*
189 * Reg Regulator Mode 0
190 */
191#define MC13783_REGCTRL_VAUDIO_EN (1 << 0)
192#define MC13783_REGCTRL_VAUDIO_STBY (1 << 1)
193#define MC13783_REGCTRL_VAUDIO_MODE (1 << 2)
194#define MC13783_REGCTRL_VIOHI_EN (1 << 3)
195#define MC13783_REGCTRL_VIOHI_STBY (1 << 4)
196#define MC13783_REGCTRL_VIOHI_MODE (1 << 5)
197#define MC13783_REGCTRL_VIOLO_EN (1 << 6)
198#define MC13783_REGCTRL_VIOLO_STBY (1 << 7)
199#define MC13783_REGCTRL_VIOLO_MODE (1 << 8)
200#define MC13783_REGCTRL_VDIG_EN (1 << 9)
201#define MC13783_REGCTRL_VDIG_STBY (1 << 10)
202#define MC13783_REGCTRL_VDIG_MODE (1 << 11)
203#define MC13783_REGCTRL_VGEN_EN (1 << 12)
204#define MC13783_REGCTRL_VGEN_STBY (1 << 13)
205#define MC13783_REGCTRL_VGEN_MODE (1 << 14)
206#define MC13783_REGCTRL_VRFDIG_EN (1 << 15)
207#define MC13783_REGCTRL_VRFDIG_STBY (1 << 16)
208#define MC13783_REGCTRL_VRFDIG_MODE (1 << 17)
209#define MC13783_REGCTRL_VRFREF_EN (1 << 18)
210#define MC13783_REGCTRL_VRFREF_STBY (1 << 19)
211#define MC13783_REGCTRL_VRFREF_MODE (1 << 20)
212#define MC13783_REGCTRL_VRFCP_EN (1 << 21)
213#define MC13783_REGCTRL_VRFCP_STBY (1 << 22)
214#define MC13783_REGCTRL_VRFCP_MODE (1 << 23)
215
216/*
217 * Reg Regulator Mode 1
218 */
219#define MC13783_REGCTRL_VSIM_EN (1 << 0)
220#define MC13783_REGCTRL_VSIM_STBY (1 << 1)
221#define MC13783_REGCTRL_VSIM_MODE (1 << 2)
222#define MC13783_REGCTRL_VESIM_EN (1 << 3)
223#define MC13783_REGCTRL_VESIM_STBY (1 << 4)
224#define MC13783_REGCTRL_VESIM_MODE (1 << 5)
225#define MC13783_REGCTRL_VCAM_EN (1 << 6)
226#define MC13783_REGCTRL_VCAM_STBY (1 << 7)
227#define MC13783_REGCTRL_VCAM_MODE (1 << 8)
228#define MC13783_REGCTRL_VRFBG_EN (1 << 9)
229#define MC13783_REGCTRL_VRFBG_STBY (1 << 10)
230#define MC13783_REGCTRL_VVIB_EN (1 << 11)
231#define MC13783_REGCTRL_VRF1_EN (1 << 12)
232#define MC13783_REGCTRL_VRF1_STBY (1 << 13)
233#define MC13783_REGCTRL_VRF1_MODE (1 << 14)
234#define MC13783_REGCTRL_VRF2_EN (1 << 15)
235#define MC13783_REGCTRL_VRF2_STBY (1 << 16)
236#define MC13783_REGCTRL_VRF2_MODE (1 << 17)
237#define MC13783_REGCTRL_VMMC1_EN (1 << 18)
238#define MC13783_REGCTRL_VMMC1_STBY (1 << 19)
239#define MC13783_REGCTRL_VMMC1_MODE (1 << 20)
240#define MC13783_REGCTRL_VMMC2_EN (1 << 21)
241#define MC13783_REGCTRL_VMMC2_STBY (1 << 22)
242#define MC13783_REGCTRL_VMMC2_MODE (1 << 23)
243
244/*
245 * Reg Regulator Misc.
246 */
247#define MC13783_REGCTRL_GPO1_EN (1 << 6)
248#define MC13783_REGCTRL_GPO2_EN (1 << 8)
249#define MC13783_REGCTRL_GPO3_EN (1 << 10)
250#define MC13783_REGCTRL_GPO4_EN (1 << 12)
251#define MC13783_REGCTRL_VIBPINCTRL (1 << 14)
252
253/*
254 * Reg Switcher 4
255 */
256#define MC13783_SWCTRL_SW1A_MODE (1 << 0)
257#define MC13783_SWCTRL_SW1A_STBY_MODE (1 << 2)
258#define MC13783_SWCTRL_SW1A_DVS_SPEED (1 << 6)
259#define MC13783_SWCTRL_SW1A_PANIC_MODE (1 << 8)
260#define MC13783_SWCTRL_SW1A_SOFTSTART (1 << 9)
261#define MC13783_SWCTRL_SW1B_MODE (1 << 10)
262#define MC13783_SWCTRL_SW1B_STBY_MODE (1 << 12)
263#define MC13783_SWCTRL_SW1B_DVS_SPEED (1 << 14)
264#define MC13783_SWCTRL_SW1B_PANIC_MODE (1 << 16)
265#define MC13783_SWCTRL_SW1B_SOFTSTART (1 << 17)
266#define MC13783_SWCTRL_PLL_EN (1 << 18)
267#define MC13783_SWCTRL_PLL_FACTOR (1 << 19)
268
269/*
270 * Reg Switcher 5
271 */
272#define MC13783_SWCTRL_SW2A_MODE (1 << 0)
273#define MC13783_SWCTRL_SW2A_STBY_MODE (1 << 2)
274#define MC13783_SWCTRL_SW2A_DVS_SPEED (1 << 6)
275#define MC13783_SWCTRL_SW2A_PANIC_MODE (1 << 8)
276#define MC13783_SWCTRL_SW2A_SOFTSTART (1 << 9)
277#define MC13783_SWCTRL_SW2B_MODE (1 << 10)
278#define MC13783_SWCTRL_SW2B_STBY_MODE (1 << 12)
279#define MC13783_SWCTRL_SW2B_DVS_SPEED (1 << 14)
280#define MC13783_SWCTRL_SW2B_PANIC_MODE (1 << 16)
281#define MC13783_SWCTRL_SW2B_SOFTSTART (1 << 17)
282#define MC13783_SWSET_SW3 (1 << 18)
283#define MC13783_SWCTRL_SW3_EN (1 << 20)
284#define MC13783_SWCTRL_SW3_STBY (1 << 21)
285#define MC13783_SWCTRL_SW3_MODE (1 << 22)
286
287/*
288 * ADC/Touch
289 */
290#define MC13783_ADC0_LICELLCON (1 << 0)
291#define MC13783_ADC0_CHRGICON (1 << 1)
292#define MC13783_ADC0_BATICON (1 << 2)
293#define MC13783_ADC0_RTHEN (1 << 3)
294#define MC13783_ADC0_DTHEN (1 << 4)
295#define MC13783_ADC0_UIDEN (1 << 5)
296#define MC13783_ADC0_ADOUTEN (1 << 6)
297#define MC13783_ADC0_ADOUTPER (1 << 7)
298#define MC13783_ADC0_ADREFEN (1 << 10)
299#define MC13783_ADC0_ADREFMODE (1 << 11)
300#define MC13783_ADC0_TSMOD0 (1 << 12)
301#define MC13783_ADC0_TSMOD1 (1 << 13)
302#define MC13783_ADC0_TSMOD2 (1 << 14)
303#define MC13783_ADC0_CHRGRAWDIV (1 << 15)
304#define MC13783_ADC0_ADINC1 (1 << 16)
305#define MC13783_ADC0_ADINC2 (1 << 17)
306#define MC13783_ADC0_WCOMP (1 << 18)
307#define MC13783_ADC0_ADCBIS0 (1 << 23)
308
309#define MC13783_ADC1_ADEN (1 << 0)
310#define MC13783_ADC1_RAND (1 << 1)
311#define MC13783_ADC1_ADSEL (1 << 3)
312#define MC13783_ADC1_TRIGMASK (1 << 4)
313#define MC13783_ADC1_ADA10 (1 << 5)
314#define MC13783_ADC1_ADA11 (1 << 6)
315#define MC13783_ADC1_ADA12 (1 << 7)
316#define MC13783_ADC1_ADA20 (1 << 8)
317#define MC13783_ADC1_ADA21 (1 << 9)
318#define MC13783_ADC1_ADA22 (1 << 10)
319#define MC13783_ADC1_ATO0 (1 << 11)
320#define MC13783_ADC1_ATO1 (1 << 12)
321#define MC13783_ADC1_ATO2 (1 << 13)
322#define MC13783_ADC1_ATO3 (1 << 14)
323#define MC13783_ADC1_ATO4 (1 << 15)
324#define MC13783_ADC1_ATO5 (1 << 16)
325#define MC13783_ADC1_ATO6 (1 << 17)
326#define MC13783_ADC1_ATO7 (1 << 18)
327#define MC13783_ADC1_ATOX (1 << 19)
328#define MC13783_ADC1_ASC (1 << 20)
329#define MC13783_ADC1_ADTRIGIGN (1 << 21)
330#define MC13783_ADC1_ADONESHOT (1 << 22)
331#define MC13783_ADC1_ADCBIS1 (1 << 23)
332
333#define MC13783_ADC1_CHAN0_SHIFT 5
334#define MC13783_ADC1_CHAN1_SHIFT 8
335
336#define MC13783_ADC2_ADD10 (1 << 2)
337#define MC13783_ADC2_ADD11 (1 << 3)
338#define MC13783_ADC2_ADD12 (1 << 4)
339#define MC13783_ADC2_ADD13 (1 << 5)
340#define MC13783_ADC2_ADD14 (1 << 6)
341#define MC13783_ADC2_ADD15 (1 << 7)
342#define MC13783_ADC2_ADD16 (1 << 8)
343#define MC13783_ADC2_ADD17 (1 << 9)
344#define MC13783_ADC2_ADD18 (1 << 10)
345#define MC13783_ADC2_ADD19 (1 << 11)
346#define MC13783_ADC2_ADD20 (1 << 14)
347#define MC13783_ADC2_ADD21 (1 << 15)
348#define MC13783_ADC2_ADD22 (1 << 16)
349#define MC13783_ADC2_ADD23 (1 << 17)
350#define MC13783_ADC2_ADD24 (1 << 18)
351#define MC13783_ADC2_ADD25 (1 << 19)
352#define MC13783_ADC2_ADD26 (1 << 20)
353#define MC13783_ADC2_ADD27 (1 << 21)
354#define MC13783_ADC2_ADD28 (1 << 22)
355#define MC13783_ADC2_ADD29 (1 << 23)
356
357#define MC13783_ADC3_WHIGH0 (1 << 0)
358#define MC13783_ADC3_WHIGH1 (1 << 1)
359#define MC13783_ADC3_WHIGH2 (1 << 2)
360#define MC13783_ADC3_WHIGH3 (1 << 3)
361#define MC13783_ADC3_WHIGH4 (1 << 4)
362#define MC13783_ADC3_WHIGH5 (1 << 5)
363#define MC13783_ADC3_ICID0 (1 << 6)
364#define MC13783_ADC3_ICID1 (1 << 7)
365#define MC13783_ADC3_ICID2 (1 << 8)
366#define MC13783_ADC3_WLOW0 (1 << 9)
367#define MC13783_ADC3_WLOW1 (1 << 10)
368#define MC13783_ADC3_WLOW2 (1 << 11)
369#define MC13783_ADC3_WLOW3 (1 << 12)
370#define MC13783_ADC3_WLOW4 (1 << 13)
371#define MC13783_ADC3_WLOW5 (1 << 14)
372#define MC13783_ADC3_ADCBIS2 (1 << 23)
373
374#define MC13783_ADC4_ADDBIS10 (1 << 2)
375#define MC13783_ADC4_ADDBIS11 (1 << 3)
376#define MC13783_ADC4_ADDBIS12 (1 << 4)
377#define MC13783_ADC4_ADDBIS13 (1 << 5)
378#define MC13783_ADC4_ADDBIS14 (1 << 6)
379#define MC13783_ADC4_ADDBIS15 (1 << 7)
380#define MC13783_ADC4_ADDBIS16 (1 << 8)
381#define MC13783_ADC4_ADDBIS17 (1 << 9)
382#define MC13783_ADC4_ADDBIS18 (1 << 10)
383#define MC13783_ADC4_ADDBIS19 (1 << 11)
384#define MC13783_ADC4_ADDBIS20 (1 << 14)
385#define MC13783_ADC4_ADDBIS21 (1 << 15)
386#define MC13783_ADC4_ADDBIS22 (1 << 16)
387#define MC13783_ADC4_ADDBIS23 (1 << 17)
388#define MC13783_ADC4_ADDBIS24 (1 << 18)
389#define MC13783_ADC4_ADDBIS25 (1 << 19)
390#define MC13783_ADC4_ADDBIS26 (1 << 20)
391#define MC13783_ADC4_ADDBIS27 (1 << 21)
392#define MC13783_ADC4_ADDBIS28 (1 << 22)
393#define MC13783_ADC4_ADDBIS29 (1 << 23)
394
395#endif /* __LINUX_MFD_MC13783_PRIV_H */
396
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h
new file mode 100644
index 000000000000..b3a2a7243573
--- /dev/null
+++ b/include/linux/mfd/mc13783.h
@@ -0,0 +1,84 @@
1/*
2 * Copyright 2009 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
3 *
4 * Initial development of this code was funded by
5 * Phytec Messtechnik GmbH, http://www.phytec.de
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#ifndef __INCLUDE_LINUX_MFD_MC13783_H
23#define __INCLUDE_LINUX_MFD_MC13783_H
24
25struct mc13783;
26struct regulator_init_data;
27
28struct mc13783_regulator_init_data {
29 int id;
30 struct regulator_init_data *init_data;
31};
32
33struct mc13783_platform_data {
34 struct mc13783_regulator_init_data *regulators;
35 int num_regulators;
36 unsigned int flags;
37};
38
39/* mc13783_platform_data flags */
40#define MC13783_USE_TOUCHSCREEN (1 << 0)
41#define MC13783_USE_CODEC (1 << 1)
42#define MC13783_USE_ADC (1 << 2)
43#define MC13783_USE_RTC (1 << 3)
44#define MC13783_USE_REGULATOR (1 << 4)
45
46int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode,
47 unsigned int channel, unsigned int *sample);
48
49void mc13783_adc_set_ts_status(struct mc13783 *mc13783, unsigned int status);
50
51#define MC13783_SW_SW1A 0
52#define MC13783_SW_SW1B 1
53#define MC13783_SW_SW2A 2
54#define MC13783_SW_SW2B 3
55#define MC13783_SW_SW3 4
56#define MC13783_SW_PLL 5
57#define MC13783_REGU_VAUDIO 6
58#define MC13783_REGU_VIOHI 7
59#define MC13783_REGU_VIOLO 8
60#define MC13783_REGU_VDIG 9
61#define MC13783_REGU_VGEN 10
62#define MC13783_REGU_VRFDIG 11
63#define MC13783_REGU_VRFREF 12
64#define MC13783_REGU_VRFCP 13
65#define MC13783_REGU_VSIM 14
66#define MC13783_REGU_VESIM 15
67#define MC13783_REGU_VCAM 16
68#define MC13783_REGU_VRFBG 17
69#define MC13783_REGU_VVIB 18
70#define MC13783_REGU_VRF1 19
71#define MC13783_REGU_VRF2 20
72#define MC13783_REGU_VMMC1 21
73#define MC13783_REGU_VMMC2 22
74#define MC13783_REGU_GPO1 23
75#define MC13783_REGU_GPO2 24
76#define MC13783_REGU_GPO3 25
77#define MC13783_REGU_GPO4 26
78#define MC13783_REGU_V1 27
79#define MC13783_REGU_V2 28
80#define MC13783_REGU_V3 29
81#define MC13783_REGU_V4 30
82
83#endif /* __INCLUDE_LINUX_MFD_MC13783_H */
84
diff --git a/include/linux/mfd/pcf50633/adc.h b/include/linux/mfd/pcf50633/adc.h
index 56669b4183ad..b35e62801ffa 100644
--- a/include/linux/mfd/pcf50633/adc.h
+++ b/include/linux/mfd/pcf50633/adc.h
@@ -25,7 +25,8 @@
25#define PCF50633_REG_ADCS3 0x57 25#define PCF50633_REG_ADCS3 0x57
26 26
27#define PCF50633_ADCC1_ADCSTART 0x01 27#define PCF50633_ADCC1_ADCSTART 0x01
28#define PCF50633_ADCC1_RES_10BIT 0x02 28#define PCF50633_ADCC1_RES_8BIT 0x02
29#define PCF50633_ADCC1_RES_10BIT 0x00
29#define PCF50633_ADCC1_AVERAGE_NO 0x00 30#define PCF50633_ADCC1_AVERAGE_NO 0x00
30#define PCF50633_ADCC1_AVERAGE_4 0x04 31#define PCF50633_ADCC1_AVERAGE_4 0x04
31#define PCF50633_ADCC1_AVERAGE_8 0x08 32#define PCF50633_ADCC1_AVERAGE_8 0x08
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h
index c8f51c3c0a72..9aba7b779fbc 100644
--- a/include/linux/mfd/pcf50633/core.h
+++ b/include/linux/mfd/pcf50633/core.h
@@ -136,6 +136,7 @@ struct pcf50633 {
136 int irq; 136 int irq;
137 struct pcf50633_irq irq_handler[PCF50633_NUM_IRQ]; 137 struct pcf50633_irq irq_handler[PCF50633_NUM_IRQ];
138 struct work_struct irq_work; 138 struct work_struct irq_work;
139 struct workqueue_struct *work_queue;
139 struct mutex lock; 140 struct mutex lock;
140 141
141 u8 mask_regs[5]; 142 u8 mask_regs[5];
diff --git a/include/linux/mfd/wm831x/auxadc.h b/include/linux/mfd/wm831x/auxadc.h
new file mode 100644
index 000000000000..b132067e9e99
--- /dev/null
+++ b/include/linux/mfd/wm831x/auxadc.h
@@ -0,0 +1,216 @@
1/*
2 * include/linux/mfd/wm831x/auxadc.h -- Auxiliary ADC interface for WM831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_AUXADC_H__
16#define __MFD_WM831X_AUXADC_H__
17
18/*
19 * R16429 (0x402D) - AuxADC Data
20 */
21#define WM831X_AUX_DATA_SRC_MASK 0xF000 /* AUX_DATA_SRC - [15:12] */
22#define WM831X_AUX_DATA_SRC_SHIFT 12 /* AUX_DATA_SRC - [15:12] */
23#define WM831X_AUX_DATA_SRC_WIDTH 4 /* AUX_DATA_SRC - [15:12] */
24#define WM831X_AUX_DATA_MASK 0x0FFF /* AUX_DATA - [11:0] */
25#define WM831X_AUX_DATA_SHIFT 0 /* AUX_DATA - [11:0] */
26#define WM831X_AUX_DATA_WIDTH 12 /* AUX_DATA - [11:0] */
27
28/*
29 * R16430 (0x402E) - AuxADC Control
30 */
31#define WM831X_AUX_ENA 0x8000 /* AUX_ENA */
32#define WM831X_AUX_ENA_MASK 0x8000 /* AUX_ENA */
33#define WM831X_AUX_ENA_SHIFT 15 /* AUX_ENA */
34#define WM831X_AUX_ENA_WIDTH 1 /* AUX_ENA */
35#define WM831X_AUX_CVT_ENA 0x4000 /* AUX_CVT_ENA */
36#define WM831X_AUX_CVT_ENA_MASK 0x4000 /* AUX_CVT_ENA */
37#define WM831X_AUX_CVT_ENA_SHIFT 14 /* AUX_CVT_ENA */
38#define WM831X_AUX_CVT_ENA_WIDTH 1 /* AUX_CVT_ENA */
39#define WM831X_AUX_SLPENA 0x1000 /* AUX_SLPENA */
40#define WM831X_AUX_SLPENA_MASK 0x1000 /* AUX_SLPENA */
41#define WM831X_AUX_SLPENA_SHIFT 12 /* AUX_SLPENA */
42#define WM831X_AUX_SLPENA_WIDTH 1 /* AUX_SLPENA */
43#define WM831X_AUX_FRC_ENA 0x0800 /* AUX_FRC_ENA */
44#define WM831X_AUX_FRC_ENA_MASK 0x0800 /* AUX_FRC_ENA */
45#define WM831X_AUX_FRC_ENA_SHIFT 11 /* AUX_FRC_ENA */
46#define WM831X_AUX_FRC_ENA_WIDTH 1 /* AUX_FRC_ENA */
47#define WM831X_AUX_RATE_MASK 0x003F /* AUX_RATE - [5:0] */
48#define WM831X_AUX_RATE_SHIFT 0 /* AUX_RATE - [5:0] */
49#define WM831X_AUX_RATE_WIDTH 6 /* AUX_RATE - [5:0] */
50
51/*
52 * R16431 (0x402F) - AuxADC Source
53 */
54#define WM831X_AUX_CAL_SEL 0x8000 /* AUX_CAL_SEL */
55#define WM831X_AUX_CAL_SEL_MASK 0x8000 /* AUX_CAL_SEL */
56#define WM831X_AUX_CAL_SEL_SHIFT 15 /* AUX_CAL_SEL */
57#define WM831X_AUX_CAL_SEL_WIDTH 1 /* AUX_CAL_SEL */
58#define WM831X_AUX_BKUP_BATT_SEL 0x0400 /* AUX_BKUP_BATT_SEL */
59#define WM831X_AUX_BKUP_BATT_SEL_MASK 0x0400 /* AUX_BKUP_BATT_SEL */
60#define WM831X_AUX_BKUP_BATT_SEL_SHIFT 10 /* AUX_BKUP_BATT_SEL */
61#define WM831X_AUX_BKUP_BATT_SEL_WIDTH 1 /* AUX_BKUP_BATT_SEL */
62#define WM831X_AUX_WALL_SEL 0x0200 /* AUX_WALL_SEL */
63#define WM831X_AUX_WALL_SEL_MASK 0x0200 /* AUX_WALL_SEL */
64#define WM831X_AUX_WALL_SEL_SHIFT 9 /* AUX_WALL_SEL */
65#define WM831X_AUX_WALL_SEL_WIDTH 1 /* AUX_WALL_SEL */
66#define WM831X_AUX_BATT_SEL 0x0100 /* AUX_BATT_SEL */
67#define WM831X_AUX_BATT_SEL_MASK 0x0100 /* AUX_BATT_SEL */
68#define WM831X_AUX_BATT_SEL_SHIFT 8 /* AUX_BATT_SEL */
69#define WM831X_AUX_BATT_SEL_WIDTH 1 /* AUX_BATT_SEL */
70#define WM831X_AUX_USB_SEL 0x0080 /* AUX_USB_SEL */
71#define WM831X_AUX_USB_SEL_MASK 0x0080 /* AUX_USB_SEL */
72#define WM831X_AUX_USB_SEL_SHIFT 7 /* AUX_USB_SEL */
73#define WM831X_AUX_USB_SEL_WIDTH 1 /* AUX_USB_SEL */
74#define WM831X_AUX_SYSVDD_SEL 0x0040 /* AUX_SYSVDD_SEL */
75#define WM831X_AUX_SYSVDD_SEL_MASK 0x0040 /* AUX_SYSVDD_SEL */
76#define WM831X_AUX_SYSVDD_SEL_SHIFT 6 /* AUX_SYSVDD_SEL */
77#define WM831X_AUX_SYSVDD_SEL_WIDTH 1 /* AUX_SYSVDD_SEL */
78#define WM831X_AUX_BATT_TEMP_SEL 0x0020 /* AUX_BATT_TEMP_SEL */
79#define WM831X_AUX_BATT_TEMP_SEL_MASK 0x0020 /* AUX_BATT_TEMP_SEL */
80#define WM831X_AUX_BATT_TEMP_SEL_SHIFT 5 /* AUX_BATT_TEMP_SEL */
81#define WM831X_AUX_BATT_TEMP_SEL_WIDTH 1 /* AUX_BATT_TEMP_SEL */
82#define WM831X_AUX_CHIP_TEMP_SEL 0x0010 /* AUX_CHIP_TEMP_SEL */
83#define WM831X_AUX_CHIP_TEMP_SEL_MASK 0x0010 /* AUX_CHIP_TEMP_SEL */
84#define WM831X_AUX_CHIP_TEMP_SEL_SHIFT 4 /* AUX_CHIP_TEMP_SEL */
85#define WM831X_AUX_CHIP_TEMP_SEL_WIDTH 1 /* AUX_CHIP_TEMP_SEL */
86#define WM831X_AUX_AUX4_SEL 0x0008 /* AUX_AUX4_SEL */
87#define WM831X_AUX_AUX4_SEL_MASK 0x0008 /* AUX_AUX4_SEL */
88#define WM831X_AUX_AUX4_SEL_SHIFT 3 /* AUX_AUX4_SEL */
89#define WM831X_AUX_AUX4_SEL_WIDTH 1 /* AUX_AUX4_SEL */
90#define WM831X_AUX_AUX3_SEL 0x0004 /* AUX_AUX3_SEL */
91#define WM831X_AUX_AUX3_SEL_MASK 0x0004 /* AUX_AUX3_SEL */
92#define WM831X_AUX_AUX3_SEL_SHIFT 2 /* AUX_AUX3_SEL */
93#define WM831X_AUX_AUX3_SEL_WIDTH 1 /* AUX_AUX3_SEL */
94#define WM831X_AUX_AUX2_SEL 0x0002 /* AUX_AUX2_SEL */
95#define WM831X_AUX_AUX2_SEL_MASK 0x0002 /* AUX_AUX2_SEL */
96#define WM831X_AUX_AUX2_SEL_SHIFT 1 /* AUX_AUX2_SEL */
97#define WM831X_AUX_AUX2_SEL_WIDTH 1 /* AUX_AUX2_SEL */
98#define WM831X_AUX_AUX1_SEL 0x0001 /* AUX_AUX1_SEL */
99#define WM831X_AUX_AUX1_SEL_MASK 0x0001 /* AUX_AUX1_SEL */
100#define WM831X_AUX_AUX1_SEL_SHIFT 0 /* AUX_AUX1_SEL */
101#define WM831X_AUX_AUX1_SEL_WIDTH 1 /* AUX_AUX1_SEL */
102
103/*
104 * R16432 (0x4030) - Comparator Control
105 */
106#define WM831X_DCOMP4_STS 0x0800 /* DCOMP4_STS */
107#define WM831X_DCOMP4_STS_MASK 0x0800 /* DCOMP4_STS */
108#define WM831X_DCOMP4_STS_SHIFT 11 /* DCOMP4_STS */
109#define WM831X_DCOMP4_STS_WIDTH 1 /* DCOMP4_STS */
110#define WM831X_DCOMP3_STS 0x0400 /* DCOMP3_STS */
111#define WM831X_DCOMP3_STS_MASK 0x0400 /* DCOMP3_STS */
112#define WM831X_DCOMP3_STS_SHIFT 10 /* DCOMP3_STS */
113#define WM831X_DCOMP3_STS_WIDTH 1 /* DCOMP3_STS */
114#define WM831X_DCOMP2_STS 0x0200 /* DCOMP2_STS */
115#define WM831X_DCOMP2_STS_MASK 0x0200 /* DCOMP2_STS */
116#define WM831X_DCOMP2_STS_SHIFT 9 /* DCOMP2_STS */
117#define WM831X_DCOMP2_STS_WIDTH 1 /* DCOMP2_STS */
118#define WM831X_DCOMP1_STS 0x0100 /* DCOMP1_STS */
119#define WM831X_DCOMP1_STS_MASK 0x0100 /* DCOMP1_STS */
120#define WM831X_DCOMP1_STS_SHIFT 8 /* DCOMP1_STS */
121#define WM831X_DCOMP1_STS_WIDTH 1 /* DCOMP1_STS */
122#define WM831X_DCMP4_ENA 0x0008 /* DCMP4_ENA */
123#define WM831X_DCMP4_ENA_MASK 0x0008 /* DCMP4_ENA */
124#define WM831X_DCMP4_ENA_SHIFT 3 /* DCMP4_ENA */
125#define WM831X_DCMP4_ENA_WIDTH 1 /* DCMP4_ENA */
126#define WM831X_DCMP3_ENA 0x0004 /* DCMP3_ENA */
127#define WM831X_DCMP3_ENA_MASK 0x0004 /* DCMP3_ENA */
128#define WM831X_DCMP3_ENA_SHIFT 2 /* DCMP3_ENA */
129#define WM831X_DCMP3_ENA_WIDTH 1 /* DCMP3_ENA */
130#define WM831X_DCMP2_ENA 0x0002 /* DCMP2_ENA */
131#define WM831X_DCMP2_ENA_MASK 0x0002 /* DCMP2_ENA */
132#define WM831X_DCMP2_ENA_SHIFT 1 /* DCMP2_ENA */
133#define WM831X_DCMP2_ENA_WIDTH 1 /* DCMP2_ENA */
134#define WM831X_DCMP1_ENA 0x0001 /* DCMP1_ENA */
135#define WM831X_DCMP1_ENA_MASK 0x0001 /* DCMP1_ENA */
136#define WM831X_DCMP1_ENA_SHIFT 0 /* DCMP1_ENA */
137#define WM831X_DCMP1_ENA_WIDTH 1 /* DCMP1_ENA */
138
139/*
140 * R16433 (0x4031) - Comparator 1
141 */
142#define WM831X_DCMP1_SRC_MASK 0xE000 /* DCMP1_SRC - [15:13] */
143#define WM831X_DCMP1_SRC_SHIFT 13 /* DCMP1_SRC - [15:13] */
144#define WM831X_DCMP1_SRC_WIDTH 3 /* DCMP1_SRC - [15:13] */
145#define WM831X_DCMP1_GT 0x1000 /* DCMP1_GT */
146#define WM831X_DCMP1_GT_MASK 0x1000 /* DCMP1_GT */
147#define WM831X_DCMP1_GT_SHIFT 12 /* DCMP1_GT */
148#define WM831X_DCMP1_GT_WIDTH 1 /* DCMP1_GT */
149#define WM831X_DCMP1_THR_MASK 0x0FFF /* DCMP1_THR - [11:0] */
150#define WM831X_DCMP1_THR_SHIFT 0 /* DCMP1_THR - [11:0] */
151#define WM831X_DCMP1_THR_WIDTH 12 /* DCMP1_THR - [11:0] */
152
153/*
154 * R16434 (0x4032) - Comparator 2
155 */
156#define WM831X_DCMP2_SRC_MASK 0xE000 /* DCMP2_SRC - [15:13] */
157#define WM831X_DCMP2_SRC_SHIFT 13 /* DCMP2_SRC - [15:13] */
158#define WM831X_DCMP2_SRC_WIDTH 3 /* DCMP2_SRC - [15:13] */
159#define WM831X_DCMP2_GT 0x1000 /* DCMP2_GT */
160#define WM831X_DCMP2_GT_MASK 0x1000 /* DCMP2_GT */
161#define WM831X_DCMP2_GT_SHIFT 12 /* DCMP2_GT */
162#define WM831X_DCMP2_GT_WIDTH 1 /* DCMP2_GT */
163#define WM831X_DCMP2_THR_MASK 0x0FFF /* DCMP2_THR - [11:0] */
164#define WM831X_DCMP2_THR_SHIFT 0 /* DCMP2_THR - [11:0] */
165#define WM831X_DCMP2_THR_WIDTH 12 /* DCMP2_THR - [11:0] */
166
167/*
168 * R16435 (0x4033) - Comparator 3
169 */
170#define WM831X_DCMP3_SRC_MASK 0xE000 /* DCMP3_SRC - [15:13] */
171#define WM831X_DCMP3_SRC_SHIFT 13 /* DCMP3_SRC - [15:13] */
172#define WM831X_DCMP3_SRC_WIDTH 3 /* DCMP3_SRC - [15:13] */
173#define WM831X_DCMP3_GT 0x1000 /* DCMP3_GT */
174#define WM831X_DCMP3_GT_MASK 0x1000 /* DCMP3_GT */
175#define WM831X_DCMP3_GT_SHIFT 12 /* DCMP3_GT */
176#define WM831X_DCMP3_GT_WIDTH 1 /* DCMP3_GT */
177#define WM831X_DCMP3_THR_MASK 0x0FFF /* DCMP3_THR - [11:0] */
178#define WM831X_DCMP3_THR_SHIFT 0 /* DCMP3_THR - [11:0] */
179#define WM831X_DCMP3_THR_WIDTH 12 /* DCMP3_THR - [11:0] */
180
181/*
182 * R16436 (0x4034) - Comparator 4
183 */
184#define WM831X_DCMP4_SRC_MASK 0xE000 /* DCMP4_SRC - [15:13] */
185#define WM831X_DCMP4_SRC_SHIFT 13 /* DCMP4_SRC - [15:13] */
186#define WM831X_DCMP4_SRC_WIDTH 3 /* DCMP4_SRC - [15:13] */
187#define WM831X_DCMP4_GT 0x1000 /* DCMP4_GT */
188#define WM831X_DCMP4_GT_MASK 0x1000 /* DCMP4_GT */
189#define WM831X_DCMP4_GT_SHIFT 12 /* DCMP4_GT */
190#define WM831X_DCMP4_GT_WIDTH 1 /* DCMP4_GT */
191#define WM831X_DCMP4_THR_MASK 0x0FFF /* DCMP4_THR - [11:0] */
192#define WM831X_DCMP4_THR_SHIFT 0 /* DCMP4_THR - [11:0] */
193#define WM831X_DCMP4_THR_WIDTH 12 /* DCMP4_THR - [11:0] */
194
195#define WM831X_AUX_CAL_FACTOR 0xfff
196#define WM831X_AUX_CAL_NOMINAL 0x222
197
198enum wm831x_auxadc {
199 WM831X_AUX_CAL = 15,
200 WM831X_AUX_BKUP_BATT = 10,
201 WM831X_AUX_WALL = 9,
202 WM831X_AUX_BATT = 8,
203 WM831X_AUX_USB = 7,
204 WM831X_AUX_SYSVDD = 6,
205 WM831X_AUX_BATT_TEMP = 5,
206 WM831X_AUX_CHIP_TEMP = 4,
207 WM831X_AUX_AUX4 = 3,
208 WM831X_AUX_AUX3 = 2,
209 WM831X_AUX_AUX2 = 1,
210 WM831X_AUX_AUX1 = 0,
211};
212
213int wm831x_auxadc_read(struct wm831x *wm831x, enum wm831x_auxadc input);
214int wm831x_auxadc_read_uv(struct wm831x *wm831x, enum wm831x_auxadc input);
215
216#endif
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h
new file mode 100644
index 000000000000..91eb493bf14c
--- /dev/null
+++ b/include/linux/mfd/wm831x/core.h
@@ -0,0 +1,289 @@
1/*
2 * include/linux/mfd/wm831x/core.h -- Core interface for WM831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_CORE_H__
16#define __MFD_WM831X_CORE_H__
17
18#include <linux/interrupt.h>
19#include <linux/workqueue.h>
20
21/*
22 * Register values.
23 */
24#define WM831X_RESET_ID 0x00
25#define WM831X_REVISION 0x01
26#define WM831X_PARENT_ID 0x4000
27#define WM831X_SYSVDD_CONTROL 0x4001
28#define WM831X_THERMAL_MONITORING 0x4002
29#define WM831X_POWER_STATE 0x4003
30#define WM831X_WATCHDOG 0x4004
31#define WM831X_ON_PIN_CONTROL 0x4005
32#define WM831X_RESET_CONTROL 0x4006
33#define WM831X_CONTROL_INTERFACE 0x4007
34#define WM831X_SECURITY_KEY 0x4008
35#define WM831X_SOFTWARE_SCRATCH 0x4009
36#define WM831X_OTP_CONTROL 0x400A
37#define WM831X_GPIO_LEVEL 0x400C
38#define WM831X_SYSTEM_STATUS 0x400D
39#define WM831X_ON_SOURCE 0x400E
40#define WM831X_OFF_SOURCE 0x400F
41#define WM831X_SYSTEM_INTERRUPTS 0x4010
42#define WM831X_INTERRUPT_STATUS_1 0x4011
43#define WM831X_INTERRUPT_STATUS_2 0x4012
44#define WM831X_INTERRUPT_STATUS_3 0x4013
45#define WM831X_INTERRUPT_STATUS_4 0x4014
46#define WM831X_INTERRUPT_STATUS_5 0x4015
47#define WM831X_IRQ_CONFIG 0x4017
48#define WM831X_SYSTEM_INTERRUPTS_MASK 0x4018
49#define WM831X_INTERRUPT_STATUS_1_MASK 0x4019
50#define WM831X_INTERRUPT_STATUS_2_MASK 0x401A
51#define WM831X_INTERRUPT_STATUS_3_MASK 0x401B
52#define WM831X_INTERRUPT_STATUS_4_MASK 0x401C
53#define WM831X_INTERRUPT_STATUS_5_MASK 0x401D
54#define WM831X_RTC_WRITE_COUNTER 0x4020
55#define WM831X_RTC_TIME_1 0x4021
56#define WM831X_RTC_TIME_2 0x4022
57#define WM831X_RTC_ALARM_1 0x4023
58#define WM831X_RTC_ALARM_2 0x4024
59#define WM831X_RTC_CONTROL 0x4025
60#define WM831X_RTC_TRIM 0x4026
61#define WM831X_TOUCH_CONTROL_1 0x4028
62#define WM831X_TOUCH_CONTROL_2 0x4029
63#define WM831X_TOUCH_DATA_X 0x402A
64#define WM831X_TOUCH_DATA_Y 0x402B
65#define WM831X_TOUCH_DATA_Z 0x402C
66#define WM831X_AUXADC_DATA 0x402D
67#define WM831X_AUXADC_CONTROL 0x402E
68#define WM831X_AUXADC_SOURCE 0x402F
69#define WM831X_COMPARATOR_CONTROL 0x4030
70#define WM831X_COMPARATOR_1 0x4031
71#define WM831X_COMPARATOR_2 0x4032
72#define WM831X_COMPARATOR_3 0x4033
73#define WM831X_COMPARATOR_4 0x4034
74#define WM831X_GPIO1_CONTROL 0x4038
75#define WM831X_GPIO2_CONTROL 0x4039
76#define WM831X_GPIO3_CONTROL 0x403A
77#define WM831X_GPIO4_CONTROL 0x403B
78#define WM831X_GPIO5_CONTROL 0x403C
79#define WM831X_GPIO6_CONTROL 0x403D
80#define WM831X_GPIO7_CONTROL 0x403E
81#define WM831X_GPIO8_CONTROL 0x403F
82#define WM831X_GPIO9_CONTROL 0x4040
83#define WM831X_GPIO10_CONTROL 0x4041
84#define WM831X_GPIO11_CONTROL 0x4042
85#define WM831X_GPIO12_CONTROL 0x4043
86#define WM831X_GPIO13_CONTROL 0x4044
87#define WM831X_GPIO14_CONTROL 0x4045
88#define WM831X_GPIO15_CONTROL 0x4046
89#define WM831X_GPIO16_CONTROL 0x4047
90#define WM831X_CHARGER_CONTROL_1 0x4048
91#define WM831X_CHARGER_CONTROL_2 0x4049
92#define WM831X_CHARGER_STATUS 0x404A
93#define WM831X_BACKUP_CHARGER_CONTROL 0x404B
94#define WM831X_STATUS_LED_1 0x404C
95#define WM831X_STATUS_LED_2 0x404D
96#define WM831X_CURRENT_SINK_1 0x404E
97#define WM831X_CURRENT_SINK_2 0x404F
98#define WM831X_DCDC_ENABLE 0x4050
99#define WM831X_LDO_ENABLE 0x4051
100#define WM831X_DCDC_STATUS 0x4052
101#define WM831X_LDO_STATUS 0x4053
102#define WM831X_DCDC_UV_STATUS 0x4054
103#define WM831X_LDO_UV_STATUS 0x4055
104#define WM831X_DC1_CONTROL_1 0x4056
105#define WM831X_DC1_CONTROL_2 0x4057
106#define WM831X_DC1_ON_CONFIG 0x4058
107#define WM831X_DC1_SLEEP_CONTROL 0x4059
108#define WM831X_DC1_DVS_CONTROL 0x405A
109#define WM831X_DC2_CONTROL_1 0x405B
110#define WM831X_DC2_CONTROL_2 0x405C
111#define WM831X_DC2_ON_CONFIG 0x405D
112#define WM831X_DC2_SLEEP_CONTROL 0x405E
113#define WM831X_DC2_DVS_CONTROL 0x405F
114#define WM831X_DC3_CONTROL_1 0x4060
115#define WM831X_DC3_CONTROL_2 0x4061
116#define WM831X_DC3_ON_CONFIG 0x4062
117#define WM831X_DC3_SLEEP_CONTROL 0x4063
118#define WM831X_DC4_CONTROL 0x4064
119#define WM831X_DC4_SLEEP_CONTROL 0x4065
120#define WM831X_EPE1_CONTROL 0x4066
121#define WM831X_EPE2_CONTROL 0x4067
122#define WM831X_LDO1_CONTROL 0x4068
123#define WM831X_LDO1_ON_CONTROL 0x4069
124#define WM831X_LDO1_SLEEP_CONTROL 0x406A
125#define WM831X_LDO2_CONTROL 0x406B
126#define WM831X_LDO2_ON_CONTROL 0x406C
127#define WM831X_LDO2_SLEEP_CONTROL 0x406D
128#define WM831X_LDO3_CONTROL 0x406E
129#define WM831X_LDO3_ON_CONTROL 0x406F
130#define WM831X_LDO3_SLEEP_CONTROL 0x4070
131#define WM831X_LDO4_CONTROL 0x4071
132#define WM831X_LDO4_ON_CONTROL 0x4072
133#define WM831X_LDO4_SLEEP_CONTROL 0x4073
134#define WM831X_LDO5_CONTROL 0x4074
135#define WM831X_LDO5_ON_CONTROL 0x4075
136#define WM831X_LDO5_SLEEP_CONTROL 0x4076
137#define WM831X_LDO6_CONTROL 0x4077
138#define WM831X_LDO6_ON_CONTROL 0x4078
139#define WM831X_LDO6_SLEEP_CONTROL 0x4079
140#define WM831X_LDO7_CONTROL 0x407A
141#define WM831X_LDO7_ON_CONTROL 0x407B
142#define WM831X_LDO7_SLEEP_CONTROL 0x407C
143#define WM831X_LDO8_CONTROL 0x407D
144#define WM831X_LDO8_ON_CONTROL 0x407E
145#define WM831X_LDO8_SLEEP_CONTROL 0x407F
146#define WM831X_LDO9_CONTROL 0x4080
147#define WM831X_LDO9_ON_CONTROL 0x4081
148#define WM831X_LDO9_SLEEP_CONTROL 0x4082
149#define WM831X_LDO10_CONTROL 0x4083
150#define WM831X_LDO10_ON_CONTROL 0x4084
151#define WM831X_LDO10_SLEEP_CONTROL 0x4085
152#define WM831X_LDO11_ON_CONTROL 0x4087
153#define WM831X_LDO11_SLEEP_CONTROL 0x4088
154#define WM831X_POWER_GOOD_SOURCE_1 0x408E
155#define WM831X_POWER_GOOD_SOURCE_2 0x408F
156#define WM831X_CLOCK_CONTROL_1 0x4090
157#define WM831X_CLOCK_CONTROL_2 0x4091
158#define WM831X_FLL_CONTROL_1 0x4092
159#define WM831X_FLL_CONTROL_2 0x4093
160#define WM831X_FLL_CONTROL_3 0x4094
161#define WM831X_FLL_CONTROL_4 0x4095
162#define WM831X_FLL_CONTROL_5 0x4096
163#define WM831X_UNIQUE_ID_1 0x7800
164#define WM831X_UNIQUE_ID_2 0x7801
165#define WM831X_UNIQUE_ID_3 0x7802
166#define WM831X_UNIQUE_ID_4 0x7803
167#define WM831X_UNIQUE_ID_5 0x7804
168#define WM831X_UNIQUE_ID_6 0x7805
169#define WM831X_UNIQUE_ID_7 0x7806
170#define WM831X_UNIQUE_ID_8 0x7807
171#define WM831X_FACTORY_OTP_ID 0x7808
172#define WM831X_FACTORY_OTP_1 0x7809
173#define WM831X_FACTORY_OTP_2 0x780A
174#define WM831X_FACTORY_OTP_3 0x780B
175#define WM831X_FACTORY_OTP_4 0x780C
176#define WM831X_FACTORY_OTP_5 0x780D
177#define WM831X_CUSTOMER_OTP_ID 0x7810
178#define WM831X_DC1_OTP_CONTROL 0x7811
179#define WM831X_DC2_OTP_CONTROL 0x7812
180#define WM831X_DC3_OTP_CONTROL 0x7813
181#define WM831X_LDO1_2_OTP_CONTROL 0x7814
182#define WM831X_LDO3_4_OTP_CONTROL 0x7815
183#define WM831X_LDO5_6_OTP_CONTROL 0x7816
184#define WM831X_LDO7_8_OTP_CONTROL 0x7817
185#define WM831X_LDO9_10_OTP_CONTROL 0x7818
186#define WM831X_LDO11_EPE_CONTROL 0x7819
187#define WM831X_GPIO1_OTP_CONTROL 0x781A
188#define WM831X_GPIO2_OTP_CONTROL 0x781B
189#define WM831X_GPIO3_OTP_CONTROL 0x781C
190#define WM831X_GPIO4_OTP_CONTROL 0x781D
191#define WM831X_GPIO5_OTP_CONTROL 0x781E
192#define WM831X_GPIO6_OTP_CONTROL 0x781F
193#define WM831X_DBE_CHECK_DATA 0x7827
194
195/*
196 * R0 (0x00) - Reset ID
197 */
198#define WM831X_CHIP_ID_MASK 0xFFFF /* CHIP_ID - [15:0] */
199#define WM831X_CHIP_ID_SHIFT 0 /* CHIP_ID - [15:0] */
200#define WM831X_CHIP_ID_WIDTH 16 /* CHIP_ID - [15:0] */
201
202/*
203 * R1 (0x01) - Revision
204 */
205#define WM831X_PARENT_REV_MASK 0xFF00 /* PARENT_REV - [15:8] */
206#define WM831X_PARENT_REV_SHIFT 8 /* PARENT_REV - [15:8] */
207#define WM831X_PARENT_REV_WIDTH 8 /* PARENT_REV - [15:8] */
208#define WM831X_CHILD_REV_MASK 0x00FF /* CHILD_REV - [7:0] */
209#define WM831X_CHILD_REV_SHIFT 0 /* CHILD_REV - [7:0] */
210#define WM831X_CHILD_REV_WIDTH 8 /* CHILD_REV - [7:0] */
211
212/*
213 * R16384 (0x4000) - Parent ID
214 */
215#define WM831X_PARENT_ID_MASK 0xFFFF /* PARENT_ID - [15:0] */
216#define WM831X_PARENT_ID_SHIFT 0 /* PARENT_ID - [15:0] */
217#define WM831X_PARENT_ID_WIDTH 16 /* PARENT_ID - [15:0] */
218
219/*
220 * R16389 (0x4005) - ON Pin Control
221 */
222#define WM831X_ON_PIN_SECACT_MASK 0x0300 /* ON_PIN_SECACT - [9:8] */
223#define WM831X_ON_PIN_SECACT_SHIFT 8 /* ON_PIN_SECACT - [9:8] */
224#define WM831X_ON_PIN_SECACT_WIDTH 2 /* ON_PIN_SECACT - [9:8] */
225#define WM831X_ON_PIN_PRIMACT_MASK 0x0030 /* ON_PIN_PRIMACT - [5:4] */
226#define WM831X_ON_PIN_PRIMACT_SHIFT 4 /* ON_PIN_PRIMACT - [5:4] */
227#define WM831X_ON_PIN_PRIMACT_WIDTH 2 /* ON_PIN_PRIMACT - [5:4] */
228#define WM831X_ON_PIN_STS 0x0008 /* ON_PIN_STS */
229#define WM831X_ON_PIN_STS_MASK 0x0008 /* ON_PIN_STS */
230#define WM831X_ON_PIN_STS_SHIFT 3 /* ON_PIN_STS */
231#define WM831X_ON_PIN_STS_WIDTH 1 /* ON_PIN_STS */
232#define WM831X_ON_PIN_TO_MASK 0x0003 /* ON_PIN_TO - [1:0] */
233#define WM831X_ON_PIN_TO_SHIFT 0 /* ON_PIN_TO - [1:0] */
234#define WM831X_ON_PIN_TO_WIDTH 2 /* ON_PIN_TO - [1:0] */
235
236struct regulator_dev;
237
238struct wm831x {
239 struct mutex io_lock;
240
241 struct device *dev;
242 int (*read_dev)(struct wm831x *wm831x, unsigned short reg,
243 int bytes, void *dest);
244 int (*write_dev)(struct wm831x *wm831x, unsigned short reg,
245 int bytes, void *src);
246
247 void *control_data;
248
249 int irq; /* Our chip IRQ */
250 struct mutex irq_lock;
251 struct workqueue_struct *irq_wq;
252 struct work_struct irq_work;
253 unsigned int irq_base;
254 int irq_masks[5];
255
256 struct mutex auxadc_lock;
257
258 /* The WM831x has a security key blocking access to certain
259 * registers. The mutex is taken by the accessors for locking
260 * and unlocking the security key, locked is used to fail
261 * writes if the lock is held.
262 */
263 struct mutex key_lock;
264 unsigned int locked:1;
265};
266
267/* Device I/O API */
268int wm831x_reg_read(struct wm831x *wm831x, unsigned short reg);
269int wm831x_reg_write(struct wm831x *wm831x, unsigned short reg,
270 unsigned short val);
271void wm831x_reg_lock(struct wm831x *wm831x);
272int wm831x_reg_unlock(struct wm831x *wm831x);
273int wm831x_set_bits(struct wm831x *wm831x, unsigned short reg,
274 unsigned short mask, unsigned short val);
275int wm831x_bulk_read(struct wm831x *wm831x, unsigned short reg,
276 int count, u16 *buf);
277
278int wm831x_irq_init(struct wm831x *wm831x, int irq);
279void wm831x_irq_exit(struct wm831x *wm831x);
280
281int __must_check wm831x_request_irq(struct wm831x *wm831x,
282 unsigned int irq, irq_handler_t handler,
283 unsigned long flags, const char *name,
284 void *dev);
285void wm831x_free_irq(struct wm831x *wm831x, unsigned int, void *);
286void wm831x_disable_irq(struct wm831x *wm831x, int irq);
287void wm831x_enable_irq(struct wm831x *wm831x, int irq);
288
289#endif
diff --git a/include/linux/mfd/wm831x/gpio.h b/include/linux/mfd/wm831x/gpio.h
new file mode 100644
index 000000000000..2835614af0e3
--- /dev/null
+++ b/include/linux/mfd/wm831x/gpio.h
@@ -0,0 +1,55 @@
1/*
2 * include/linux/mfd/wm831x/gpio.h -- GPIO for WM831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_GPIO_H__
16#define __MFD_WM831X_GPIO_H__
17
18/*
19 * R16440-16455 (0x4038-0x4047) - GPIOx Control
20 */
21#define WM831X_GPN_DIR 0x8000 /* GPN_DIR */
22#define WM831X_GPN_DIR_MASK 0x8000 /* GPN_DIR */
23#define WM831X_GPN_DIR_SHIFT 15 /* GPN_DIR */
24#define WM831X_GPN_DIR_WIDTH 1 /* GPN_DIR */
25#define WM831X_GPN_PULL_MASK 0x6000 /* GPN_PULL - [14:13] */
26#define WM831X_GPN_PULL_SHIFT 13 /* GPN_PULL - [14:13] */
27#define WM831X_GPN_PULL_WIDTH 2 /* GPN_PULL - [14:13] */
28#define WM831X_GPN_INT_MODE 0x1000 /* GPN_INT_MODE */
29#define WM831X_GPN_INT_MODE_MASK 0x1000 /* GPN_INT_MODE */
30#define WM831X_GPN_INT_MODE_SHIFT 12 /* GPN_INT_MODE */
31#define WM831X_GPN_INT_MODE_WIDTH 1 /* GPN_INT_MODE */
32#define WM831X_GPN_PWR_DOM 0x0800 /* GPN_PWR_DOM */
33#define WM831X_GPN_PWR_DOM_MASK 0x0800 /* GPN_PWR_DOM */
34#define WM831X_GPN_PWR_DOM_SHIFT 11 /* GPN_PWR_DOM */
35#define WM831X_GPN_PWR_DOM_WIDTH 1 /* GPN_PWR_DOM */
36#define WM831X_GPN_POL 0x0400 /* GPN_POL */
37#define WM831X_GPN_POL_MASK 0x0400 /* GPN_POL */
38#define WM831X_GPN_POL_SHIFT 10 /* GPN_POL */
39#define WM831X_GPN_POL_WIDTH 1 /* GPN_POL */
40#define WM831X_GPN_OD 0x0200 /* GPN_OD */
41#define WM831X_GPN_OD_MASK 0x0200 /* GPN_OD */
42#define WM831X_GPN_OD_SHIFT 9 /* GPN_OD */
43#define WM831X_GPN_OD_WIDTH 1 /* GPN_OD */
44#define WM831X_GPN_TRI 0x0080 /* GPN_TRI */
45#define WM831X_GPN_TRI_MASK 0x0080 /* GPN_TRI */
46#define WM831X_GPN_TRI_SHIFT 7 /* GPN_TRI */
47#define WM831X_GPN_TRI_WIDTH 1 /* GPN_TRI */
48#define WM831X_GPN_FN_MASK 0x000F /* GPN_FN - [3:0] */
49#define WM831X_GPN_FN_SHIFT 0 /* GPN_FN - [3:0] */
50#define WM831X_GPN_FN_WIDTH 4 /* GPN_FN - [3:0] */
51
52#define WM831X_GPIO_PULL_NONE (0 << WM831X_GPN_PULL_SHIFT)
53#define WM831X_GPIO_PULL_DOWN (1 << WM831X_GPN_PULL_SHIFT)
54#define WM831X_GPIO_PULL_UP (2 << WM831X_GPN_PULL_SHIFT)
55#endif
diff --git a/include/linux/mfd/wm831x/irq.h b/include/linux/mfd/wm831x/irq.h
new file mode 100644
index 000000000000..3a8c97656fda
--- /dev/null
+++ b/include/linux/mfd/wm831x/irq.h
@@ -0,0 +1,764 @@
1/*
2 * include/linux/mfd/wm831x/irq.h -- Interrupt controller for WM831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_IRQ_H__
16#define __MFD_WM831X_IRQ_H__
17
18/* Interrupt number assignments within Linux */
19#define WM831X_IRQ_TEMP_THW 0
20#define WM831X_IRQ_GPIO_1 1
21#define WM831X_IRQ_GPIO_2 2
22#define WM831X_IRQ_GPIO_3 3
23#define WM831X_IRQ_GPIO_4 4
24#define WM831X_IRQ_GPIO_5 5
25#define WM831X_IRQ_GPIO_6 6
26#define WM831X_IRQ_GPIO_7 7
27#define WM831X_IRQ_GPIO_8 8
28#define WM831X_IRQ_GPIO_9 9
29#define WM831X_IRQ_GPIO_10 10
30#define WM831X_IRQ_GPIO_11 11
31#define WM831X_IRQ_GPIO_12 12
32#define WM831X_IRQ_GPIO_13 13
33#define WM831X_IRQ_GPIO_14 14
34#define WM831X_IRQ_GPIO_15 15
35#define WM831X_IRQ_GPIO_16 16
36#define WM831X_IRQ_ON 17
37#define WM831X_IRQ_PPM_SYSLO 18
38#define WM831X_IRQ_PPM_PWR_SRC 19
39#define WM831X_IRQ_PPM_USB_CURR 20
40#define WM831X_IRQ_WDOG_TO 21
41#define WM831X_IRQ_RTC_PER 22
42#define WM831X_IRQ_RTC_ALM 23
43#define WM831X_IRQ_CHG_BATT_HOT 24
44#define WM831X_IRQ_CHG_BATT_COLD 25
45#define WM831X_IRQ_CHG_BATT_FAIL 26
46#define WM831X_IRQ_CHG_OV 27
47#define WM831X_IRQ_CHG_END 29
48#define WM831X_IRQ_CHG_TO 30
49#define WM831X_IRQ_CHG_MODE 31
50#define WM831X_IRQ_CHG_START 32
51#define WM831X_IRQ_TCHDATA 33
52#define WM831X_IRQ_TCHPD 34
53#define WM831X_IRQ_AUXADC_DATA 35
54#define WM831X_IRQ_AUXADC_DCOMP1 36
55#define WM831X_IRQ_AUXADC_DCOMP2 37
56#define WM831X_IRQ_AUXADC_DCOMP3 38
57#define WM831X_IRQ_AUXADC_DCOMP4 39
58#define WM831X_IRQ_CS1 40
59#define WM831X_IRQ_CS2 41
60#define WM831X_IRQ_HC_DC1 42
61#define WM831X_IRQ_HC_DC2 43
62#define WM831X_IRQ_UV_LDO1 44
63#define WM831X_IRQ_UV_LDO2 45
64#define WM831X_IRQ_UV_LDO3 46
65#define WM831X_IRQ_UV_LDO4 47
66#define WM831X_IRQ_UV_LDO5 48
67#define WM831X_IRQ_UV_LDO6 49
68#define WM831X_IRQ_UV_LDO7 50
69#define WM831X_IRQ_UV_LDO8 51
70#define WM831X_IRQ_UV_LDO9 52
71#define WM831X_IRQ_UV_LDO10 53
72#define WM831X_IRQ_UV_DC1 54
73#define WM831X_IRQ_UV_DC2 55
74#define WM831X_IRQ_UV_DC3 56
75#define WM831X_IRQ_UV_DC4 57
76
77#define WM831X_NUM_IRQS 58
78
79/*
80 * R16400 (0x4010) - System Interrupts
81 */
82#define WM831X_PS_INT 0x8000 /* PS_INT */
83#define WM831X_PS_INT_MASK 0x8000 /* PS_INT */
84#define WM831X_PS_INT_SHIFT 15 /* PS_INT */
85#define WM831X_PS_INT_WIDTH 1 /* PS_INT */
86#define WM831X_TEMP_INT 0x4000 /* TEMP_INT */
87#define WM831X_TEMP_INT_MASK 0x4000 /* TEMP_INT */
88#define WM831X_TEMP_INT_SHIFT 14 /* TEMP_INT */
89#define WM831X_TEMP_INT_WIDTH 1 /* TEMP_INT */
90#define WM831X_GP_INT 0x2000 /* GP_INT */
91#define WM831X_GP_INT_MASK 0x2000 /* GP_INT */
92#define WM831X_GP_INT_SHIFT 13 /* GP_INT */
93#define WM831X_GP_INT_WIDTH 1 /* GP_INT */
94#define WM831X_ON_PIN_INT 0x1000 /* ON_PIN_INT */
95#define WM831X_ON_PIN_INT_MASK 0x1000 /* ON_PIN_INT */
96#define WM831X_ON_PIN_INT_SHIFT 12 /* ON_PIN_INT */
97#define WM831X_ON_PIN_INT_WIDTH 1 /* ON_PIN_INT */
98#define WM831X_WDOG_INT 0x0800 /* WDOG_INT */
99#define WM831X_WDOG_INT_MASK 0x0800 /* WDOG_INT */
100#define WM831X_WDOG_INT_SHIFT 11 /* WDOG_INT */
101#define WM831X_WDOG_INT_WIDTH 1 /* WDOG_INT */
102#define WM831X_TCHDATA_INT 0x0400 /* TCHDATA_INT */
103#define WM831X_TCHDATA_INT_MASK 0x0400 /* TCHDATA_INT */
104#define WM831X_TCHDATA_INT_SHIFT 10 /* TCHDATA_INT */
105#define WM831X_TCHDATA_INT_WIDTH 1 /* TCHDATA_INT */
106#define WM831X_TCHPD_INT 0x0200 /* TCHPD_INT */
107#define WM831X_TCHPD_INT_MASK 0x0200 /* TCHPD_INT */
108#define WM831X_TCHPD_INT_SHIFT 9 /* TCHPD_INT */
109#define WM831X_TCHPD_INT_WIDTH 1 /* TCHPD_INT */
110#define WM831X_AUXADC_INT 0x0100 /* AUXADC_INT */
111#define WM831X_AUXADC_INT_MASK 0x0100 /* AUXADC_INT */
112#define WM831X_AUXADC_INT_SHIFT 8 /* AUXADC_INT */
113#define WM831X_AUXADC_INT_WIDTH 1 /* AUXADC_INT */
114#define WM831X_PPM_INT 0x0080 /* PPM_INT */
115#define WM831X_PPM_INT_MASK 0x0080 /* PPM_INT */
116#define WM831X_PPM_INT_SHIFT 7 /* PPM_INT */
117#define WM831X_PPM_INT_WIDTH 1 /* PPM_INT */
118#define WM831X_CS_INT 0x0040 /* CS_INT */
119#define WM831X_CS_INT_MASK 0x0040 /* CS_INT */
120#define WM831X_CS_INT_SHIFT 6 /* CS_INT */
121#define WM831X_CS_INT_WIDTH 1 /* CS_INT */
122#define WM831X_RTC_INT 0x0020 /* RTC_INT */
123#define WM831X_RTC_INT_MASK 0x0020 /* RTC_INT */
124#define WM831X_RTC_INT_SHIFT 5 /* RTC_INT */
125#define WM831X_RTC_INT_WIDTH 1 /* RTC_INT */
126#define WM831X_OTP_INT 0x0010 /* OTP_INT */
127#define WM831X_OTP_INT_MASK 0x0010 /* OTP_INT */
128#define WM831X_OTP_INT_SHIFT 4 /* OTP_INT */
129#define WM831X_OTP_INT_WIDTH 1 /* OTP_INT */
130#define WM831X_CHILD_INT 0x0008 /* CHILD_INT */
131#define WM831X_CHILD_INT_MASK 0x0008 /* CHILD_INT */
132#define WM831X_CHILD_INT_SHIFT 3 /* CHILD_INT */
133#define WM831X_CHILD_INT_WIDTH 1 /* CHILD_INT */
134#define WM831X_CHG_INT 0x0004 /* CHG_INT */
135#define WM831X_CHG_INT_MASK 0x0004 /* CHG_INT */
136#define WM831X_CHG_INT_SHIFT 2 /* CHG_INT */
137#define WM831X_CHG_INT_WIDTH 1 /* CHG_INT */
138#define WM831X_HC_INT 0x0002 /* HC_INT */
139#define WM831X_HC_INT_MASK 0x0002 /* HC_INT */
140#define WM831X_HC_INT_SHIFT 1 /* HC_INT */
141#define WM831X_HC_INT_WIDTH 1 /* HC_INT */
142#define WM831X_UV_INT 0x0001 /* UV_INT */
143#define WM831X_UV_INT_MASK 0x0001 /* UV_INT */
144#define WM831X_UV_INT_SHIFT 0 /* UV_INT */
145#define WM831X_UV_INT_WIDTH 1 /* UV_INT */
146
147/*
148 * R16401 (0x4011) - Interrupt Status 1
149 */
150#define WM831X_PPM_SYSLO_EINT 0x8000 /* PPM_SYSLO_EINT */
151#define WM831X_PPM_SYSLO_EINT_MASK 0x8000 /* PPM_SYSLO_EINT */
152#define WM831X_PPM_SYSLO_EINT_SHIFT 15 /* PPM_SYSLO_EINT */
153#define WM831X_PPM_SYSLO_EINT_WIDTH 1 /* PPM_SYSLO_EINT */
154#define WM831X_PPM_PWR_SRC_EINT 0x4000 /* PPM_PWR_SRC_EINT */
155#define WM831X_PPM_PWR_SRC_EINT_MASK 0x4000 /* PPM_PWR_SRC_EINT */
156#define WM831X_PPM_PWR_SRC_EINT_SHIFT 14 /* PPM_PWR_SRC_EINT */
157#define WM831X_PPM_PWR_SRC_EINT_WIDTH 1 /* PPM_PWR_SRC_EINT */
158#define WM831X_PPM_USB_CURR_EINT 0x2000 /* PPM_USB_CURR_EINT */
159#define WM831X_PPM_USB_CURR_EINT_MASK 0x2000 /* PPM_USB_CURR_EINT */
160#define WM831X_PPM_USB_CURR_EINT_SHIFT 13 /* PPM_USB_CURR_EINT */
161#define WM831X_PPM_USB_CURR_EINT_WIDTH 1 /* PPM_USB_CURR_EINT */
162#define WM831X_ON_PIN_EINT 0x1000 /* ON_PIN_EINT */
163#define WM831X_ON_PIN_EINT_MASK 0x1000 /* ON_PIN_EINT */
164#define WM831X_ON_PIN_EINT_SHIFT 12 /* ON_PIN_EINT */
165#define WM831X_ON_PIN_EINT_WIDTH 1 /* ON_PIN_EINT */
166#define WM831X_WDOG_TO_EINT 0x0800 /* WDOG_TO_EINT */
167#define WM831X_WDOG_TO_EINT_MASK 0x0800 /* WDOG_TO_EINT */
168#define WM831X_WDOG_TO_EINT_SHIFT 11 /* WDOG_TO_EINT */
169#define WM831X_WDOG_TO_EINT_WIDTH 1 /* WDOG_TO_EINT */
170#define WM831X_TCHDATA_EINT 0x0400 /* TCHDATA_EINT */
171#define WM831X_TCHDATA_EINT_MASK 0x0400 /* TCHDATA_EINT */
172#define WM831X_TCHDATA_EINT_SHIFT 10 /* TCHDATA_EINT */
173#define WM831X_TCHDATA_EINT_WIDTH 1 /* TCHDATA_EINT */
174#define WM831X_TCHPD_EINT 0x0200 /* TCHPD_EINT */
175#define WM831X_TCHPD_EINT_MASK 0x0200 /* TCHPD_EINT */
176#define WM831X_TCHPD_EINT_SHIFT 9 /* TCHPD_EINT */
177#define WM831X_TCHPD_EINT_WIDTH 1 /* TCHPD_EINT */
178#define WM831X_AUXADC_DATA_EINT 0x0100 /* AUXADC_DATA_EINT */
179#define WM831X_AUXADC_DATA_EINT_MASK 0x0100 /* AUXADC_DATA_EINT */
180#define WM831X_AUXADC_DATA_EINT_SHIFT 8 /* AUXADC_DATA_EINT */
181#define WM831X_AUXADC_DATA_EINT_WIDTH 1 /* AUXADC_DATA_EINT */
182#define WM831X_AUXADC_DCOMP4_EINT 0x0080 /* AUXADC_DCOMP4_EINT */
183#define WM831X_AUXADC_DCOMP4_EINT_MASK 0x0080 /* AUXADC_DCOMP4_EINT */
184#define WM831X_AUXADC_DCOMP4_EINT_SHIFT 7 /* AUXADC_DCOMP4_EINT */
185#define WM831X_AUXADC_DCOMP4_EINT_WIDTH 1 /* AUXADC_DCOMP4_EINT */
186#define WM831X_AUXADC_DCOMP3_EINT 0x0040 /* AUXADC_DCOMP3_EINT */
187#define WM831X_AUXADC_DCOMP3_EINT_MASK 0x0040 /* AUXADC_DCOMP3_EINT */
188#define WM831X_AUXADC_DCOMP3_EINT_SHIFT 6 /* AUXADC_DCOMP3_EINT */
189#define WM831X_AUXADC_DCOMP3_EINT_WIDTH 1 /* AUXADC_DCOMP3_EINT */
190#define WM831X_AUXADC_DCOMP2_EINT 0x0020 /* AUXADC_DCOMP2_EINT */
191#define WM831X_AUXADC_DCOMP2_EINT_MASK 0x0020 /* AUXADC_DCOMP2_EINT */
192#define WM831X_AUXADC_DCOMP2_EINT_SHIFT 5 /* AUXADC_DCOMP2_EINT */
193#define WM831X_AUXADC_DCOMP2_EINT_WIDTH 1 /* AUXADC_DCOMP2_EINT */
194#define WM831X_AUXADC_DCOMP1_EINT 0x0010 /* AUXADC_DCOMP1_EINT */
195#define WM831X_AUXADC_DCOMP1_EINT_MASK 0x0010 /* AUXADC_DCOMP1_EINT */
196#define WM831X_AUXADC_DCOMP1_EINT_SHIFT 4 /* AUXADC_DCOMP1_EINT */
197#define WM831X_AUXADC_DCOMP1_EINT_WIDTH 1 /* AUXADC_DCOMP1_EINT */
198#define WM831X_RTC_PER_EINT 0x0008 /* RTC_PER_EINT */
199#define WM831X_RTC_PER_EINT_MASK 0x0008 /* RTC_PER_EINT */
200#define WM831X_RTC_PER_EINT_SHIFT 3 /* RTC_PER_EINT */
201#define WM831X_RTC_PER_EINT_WIDTH 1 /* RTC_PER_EINT */
202#define WM831X_RTC_ALM_EINT 0x0004 /* RTC_ALM_EINT */
203#define WM831X_RTC_ALM_EINT_MASK 0x0004 /* RTC_ALM_EINT */
204#define WM831X_RTC_ALM_EINT_SHIFT 2 /* RTC_ALM_EINT */
205#define WM831X_RTC_ALM_EINT_WIDTH 1 /* RTC_ALM_EINT */
206#define WM831X_TEMP_THW_EINT 0x0002 /* TEMP_THW_EINT */
207#define WM831X_TEMP_THW_EINT_MASK 0x0002 /* TEMP_THW_EINT */
208#define WM831X_TEMP_THW_EINT_SHIFT 1 /* TEMP_THW_EINT */
209#define WM831X_TEMP_THW_EINT_WIDTH 1 /* TEMP_THW_EINT */
210
211/*
212 * R16402 (0x4012) - Interrupt Status 2
213 */
214#define WM831X_CHG_BATT_HOT_EINT 0x8000 /* CHG_BATT_HOT_EINT */
215#define WM831X_CHG_BATT_HOT_EINT_MASK 0x8000 /* CHG_BATT_HOT_EINT */
216#define WM831X_CHG_BATT_HOT_EINT_SHIFT 15 /* CHG_BATT_HOT_EINT */
217#define WM831X_CHG_BATT_HOT_EINT_WIDTH 1 /* CHG_BATT_HOT_EINT */
218#define WM831X_CHG_BATT_COLD_EINT 0x4000 /* CHG_BATT_COLD_EINT */
219#define WM831X_CHG_BATT_COLD_EINT_MASK 0x4000 /* CHG_BATT_COLD_EINT */
220#define WM831X_CHG_BATT_COLD_EINT_SHIFT 14 /* CHG_BATT_COLD_EINT */
221#define WM831X_CHG_BATT_COLD_EINT_WIDTH 1 /* CHG_BATT_COLD_EINT */
222#define WM831X_CHG_BATT_FAIL_EINT 0x2000 /* CHG_BATT_FAIL_EINT */
223#define WM831X_CHG_BATT_FAIL_EINT_MASK 0x2000 /* CHG_BATT_FAIL_EINT */
224#define WM831X_CHG_BATT_FAIL_EINT_SHIFT 13 /* CHG_BATT_FAIL_EINT */
225#define WM831X_CHG_BATT_FAIL_EINT_WIDTH 1 /* CHG_BATT_FAIL_EINT */
226#define WM831X_CHG_OV_EINT 0x1000 /* CHG_OV_EINT */
227#define WM831X_CHG_OV_EINT_MASK 0x1000 /* CHG_OV_EINT */
228#define WM831X_CHG_OV_EINT_SHIFT 12 /* CHG_OV_EINT */
229#define WM831X_CHG_OV_EINT_WIDTH 1 /* CHG_OV_EINT */
230#define WM831X_CHG_END_EINT 0x0800 /* CHG_END_EINT */
231#define WM831X_CHG_END_EINT_MASK 0x0800 /* CHG_END_EINT */
232#define WM831X_CHG_END_EINT_SHIFT 11 /* CHG_END_EINT */
233#define WM831X_CHG_END_EINT_WIDTH 1 /* CHG_END_EINT */
234#define WM831X_CHG_TO_EINT 0x0400 /* CHG_TO_EINT */
235#define WM831X_CHG_TO_EINT_MASK 0x0400 /* CHG_TO_EINT */
236#define WM831X_CHG_TO_EINT_SHIFT 10 /* CHG_TO_EINT */
237#define WM831X_CHG_TO_EINT_WIDTH 1 /* CHG_TO_EINT */
238#define WM831X_CHG_MODE_EINT 0x0200 /* CHG_MODE_EINT */
239#define WM831X_CHG_MODE_EINT_MASK 0x0200 /* CHG_MODE_EINT */
240#define WM831X_CHG_MODE_EINT_SHIFT 9 /* CHG_MODE_EINT */
241#define WM831X_CHG_MODE_EINT_WIDTH 1 /* CHG_MODE_EINT */
242#define WM831X_CHG_START_EINT 0x0100 /* CHG_START_EINT */
243#define WM831X_CHG_START_EINT_MASK 0x0100 /* CHG_START_EINT */
244#define WM831X_CHG_START_EINT_SHIFT 8 /* CHG_START_EINT */
245#define WM831X_CHG_START_EINT_WIDTH 1 /* CHG_START_EINT */
246#define WM831X_CS2_EINT 0x0080 /* CS2_EINT */
247#define WM831X_CS2_EINT_MASK 0x0080 /* CS2_EINT */
248#define WM831X_CS2_EINT_SHIFT 7 /* CS2_EINT */
249#define WM831X_CS2_EINT_WIDTH 1 /* CS2_EINT */
250#define WM831X_CS1_EINT 0x0040 /* CS1_EINT */
251#define WM831X_CS1_EINT_MASK 0x0040 /* CS1_EINT */
252#define WM831X_CS1_EINT_SHIFT 6 /* CS1_EINT */
253#define WM831X_CS1_EINT_WIDTH 1 /* CS1_EINT */
254#define WM831X_OTP_CMD_END_EINT 0x0020 /* OTP_CMD_END_EINT */
255#define WM831X_OTP_CMD_END_EINT_MASK 0x0020 /* OTP_CMD_END_EINT */
256#define WM831X_OTP_CMD_END_EINT_SHIFT 5 /* OTP_CMD_END_EINT */
257#define WM831X_OTP_CMD_END_EINT_WIDTH 1 /* OTP_CMD_END_EINT */
258#define WM831X_OTP_ERR_EINT 0x0010 /* OTP_ERR_EINT */
259#define WM831X_OTP_ERR_EINT_MASK 0x0010 /* OTP_ERR_EINT */
260#define WM831X_OTP_ERR_EINT_SHIFT 4 /* OTP_ERR_EINT */
261#define WM831X_OTP_ERR_EINT_WIDTH 1 /* OTP_ERR_EINT */
262#define WM831X_PS_POR_EINT 0x0004 /* PS_POR_EINT */
263#define WM831X_PS_POR_EINT_MASK 0x0004 /* PS_POR_EINT */
264#define WM831X_PS_POR_EINT_SHIFT 2 /* PS_POR_EINT */
265#define WM831X_PS_POR_EINT_WIDTH 1 /* PS_POR_EINT */
266#define WM831X_PS_SLEEP_OFF_EINT 0x0002 /* PS_SLEEP_OFF_EINT */
267#define WM831X_PS_SLEEP_OFF_EINT_MASK 0x0002 /* PS_SLEEP_OFF_EINT */
268#define WM831X_PS_SLEEP_OFF_EINT_SHIFT 1 /* PS_SLEEP_OFF_EINT */
269#define WM831X_PS_SLEEP_OFF_EINT_WIDTH 1 /* PS_SLEEP_OFF_EINT */
270#define WM831X_PS_ON_WAKE_EINT 0x0001 /* PS_ON_WAKE_EINT */
271#define WM831X_PS_ON_WAKE_EINT_MASK 0x0001 /* PS_ON_WAKE_EINT */
272#define WM831X_PS_ON_WAKE_EINT_SHIFT 0 /* PS_ON_WAKE_EINT */
273#define WM831X_PS_ON_WAKE_EINT_WIDTH 1 /* PS_ON_WAKE_EINT */
274
275/*
276 * R16403 (0x4013) - Interrupt Status 3
277 */
278#define WM831X_UV_LDO10_EINT 0x0200 /* UV_LDO10_EINT */
279#define WM831X_UV_LDO10_EINT_MASK 0x0200 /* UV_LDO10_EINT */
280#define WM831X_UV_LDO10_EINT_SHIFT 9 /* UV_LDO10_EINT */
281#define WM831X_UV_LDO10_EINT_WIDTH 1 /* UV_LDO10_EINT */
282#define WM831X_UV_LDO9_EINT 0x0100 /* UV_LDO9_EINT */
283#define WM831X_UV_LDO9_EINT_MASK 0x0100 /* UV_LDO9_EINT */
284#define WM831X_UV_LDO9_EINT_SHIFT 8 /* UV_LDO9_EINT */
285#define WM831X_UV_LDO9_EINT_WIDTH 1 /* UV_LDO9_EINT */
286#define WM831X_UV_LDO8_EINT 0x0080 /* UV_LDO8_EINT */
287#define WM831X_UV_LDO8_EINT_MASK 0x0080 /* UV_LDO8_EINT */
288#define WM831X_UV_LDO8_EINT_SHIFT 7 /* UV_LDO8_EINT */
289#define WM831X_UV_LDO8_EINT_WIDTH 1 /* UV_LDO8_EINT */
290#define WM831X_UV_LDO7_EINT 0x0040 /* UV_LDO7_EINT */
291#define WM831X_UV_LDO7_EINT_MASK 0x0040 /* UV_LDO7_EINT */
292#define WM831X_UV_LDO7_EINT_SHIFT 6 /* UV_LDO7_EINT */
293#define WM831X_UV_LDO7_EINT_WIDTH 1 /* UV_LDO7_EINT */
294#define WM831X_UV_LDO6_EINT 0x0020 /* UV_LDO6_EINT */
295#define WM831X_UV_LDO6_EINT_MASK 0x0020 /* UV_LDO6_EINT */
296#define WM831X_UV_LDO6_EINT_SHIFT 5 /* UV_LDO6_EINT */
297#define WM831X_UV_LDO6_EINT_WIDTH 1 /* UV_LDO6_EINT */
298#define WM831X_UV_LDO5_EINT 0x0010 /* UV_LDO5_EINT */
299#define WM831X_UV_LDO5_EINT_MASK 0x0010 /* UV_LDO5_EINT */
300#define WM831X_UV_LDO5_EINT_SHIFT 4 /* UV_LDO5_EINT */
301#define WM831X_UV_LDO5_EINT_WIDTH 1 /* UV_LDO5_EINT */
302#define WM831X_UV_LDO4_EINT 0x0008 /* UV_LDO4_EINT */
303#define WM831X_UV_LDO4_EINT_MASK 0x0008 /* UV_LDO4_EINT */
304#define WM831X_UV_LDO4_EINT_SHIFT 3 /* UV_LDO4_EINT */
305#define WM831X_UV_LDO4_EINT_WIDTH 1 /* UV_LDO4_EINT */
306#define WM831X_UV_LDO3_EINT 0x0004 /* UV_LDO3_EINT */
307#define WM831X_UV_LDO3_EINT_MASK 0x0004 /* UV_LDO3_EINT */
308#define WM831X_UV_LDO3_EINT_SHIFT 2 /* UV_LDO3_EINT */
309#define WM831X_UV_LDO3_EINT_WIDTH 1 /* UV_LDO3_EINT */
310#define WM831X_UV_LDO2_EINT 0x0002 /* UV_LDO2_EINT */
311#define WM831X_UV_LDO2_EINT_MASK 0x0002 /* UV_LDO2_EINT */
312#define WM831X_UV_LDO2_EINT_SHIFT 1 /* UV_LDO2_EINT */
313#define WM831X_UV_LDO2_EINT_WIDTH 1 /* UV_LDO2_EINT */
314#define WM831X_UV_LDO1_EINT 0x0001 /* UV_LDO1_EINT */
315#define WM831X_UV_LDO1_EINT_MASK 0x0001 /* UV_LDO1_EINT */
316#define WM831X_UV_LDO1_EINT_SHIFT 0 /* UV_LDO1_EINT */
317#define WM831X_UV_LDO1_EINT_WIDTH 1 /* UV_LDO1_EINT */
318
319/*
320 * R16404 (0x4014) - Interrupt Status 4
321 */
322#define WM831X_HC_DC2_EINT 0x0200 /* HC_DC2_EINT */
323#define WM831X_HC_DC2_EINT_MASK 0x0200 /* HC_DC2_EINT */
324#define WM831X_HC_DC2_EINT_SHIFT 9 /* HC_DC2_EINT */
325#define WM831X_HC_DC2_EINT_WIDTH 1 /* HC_DC2_EINT */
326#define WM831X_HC_DC1_EINT 0x0100 /* HC_DC1_EINT */
327#define WM831X_HC_DC1_EINT_MASK 0x0100 /* HC_DC1_EINT */
328#define WM831X_HC_DC1_EINT_SHIFT 8 /* HC_DC1_EINT */
329#define WM831X_HC_DC1_EINT_WIDTH 1 /* HC_DC1_EINT */
330#define WM831X_UV_DC4_EINT 0x0008 /* UV_DC4_EINT */
331#define WM831X_UV_DC4_EINT_MASK 0x0008 /* UV_DC4_EINT */
332#define WM831X_UV_DC4_EINT_SHIFT 3 /* UV_DC4_EINT */
333#define WM831X_UV_DC4_EINT_WIDTH 1 /* UV_DC4_EINT */
334#define WM831X_UV_DC3_EINT 0x0004 /* UV_DC3_EINT */
335#define WM831X_UV_DC3_EINT_MASK 0x0004 /* UV_DC3_EINT */
336#define WM831X_UV_DC3_EINT_SHIFT 2 /* UV_DC3_EINT */
337#define WM831X_UV_DC3_EINT_WIDTH 1 /* UV_DC3_EINT */
338#define WM831X_UV_DC2_EINT 0x0002 /* UV_DC2_EINT */
339#define WM831X_UV_DC2_EINT_MASK 0x0002 /* UV_DC2_EINT */
340#define WM831X_UV_DC2_EINT_SHIFT 1 /* UV_DC2_EINT */
341#define WM831X_UV_DC2_EINT_WIDTH 1 /* UV_DC2_EINT */
342#define WM831X_UV_DC1_EINT 0x0001 /* UV_DC1_EINT */
343#define WM831X_UV_DC1_EINT_MASK 0x0001 /* UV_DC1_EINT */
344#define WM831X_UV_DC1_EINT_SHIFT 0 /* UV_DC1_EINT */
345#define WM831X_UV_DC1_EINT_WIDTH 1 /* UV_DC1_EINT */
346
347/*
348 * R16405 (0x4015) - Interrupt Status 5
349 */
350#define WM831X_GP16_EINT 0x8000 /* GP16_EINT */
351#define WM831X_GP16_EINT_MASK 0x8000 /* GP16_EINT */
352#define WM831X_GP16_EINT_SHIFT 15 /* GP16_EINT */
353#define WM831X_GP16_EINT_WIDTH 1 /* GP16_EINT */
354#define WM831X_GP15_EINT 0x4000 /* GP15_EINT */
355#define WM831X_GP15_EINT_MASK 0x4000 /* GP15_EINT */
356#define WM831X_GP15_EINT_SHIFT 14 /* GP15_EINT */
357#define WM831X_GP15_EINT_WIDTH 1 /* GP15_EINT */
358#define WM831X_GP14_EINT 0x2000 /* GP14_EINT */
359#define WM831X_GP14_EINT_MASK 0x2000 /* GP14_EINT */
360#define WM831X_GP14_EINT_SHIFT 13 /* GP14_EINT */
361#define WM831X_GP14_EINT_WIDTH 1 /* GP14_EINT */
362#define WM831X_GP13_EINT 0x1000 /* GP13_EINT */
363#define WM831X_GP13_EINT_MASK 0x1000 /* GP13_EINT */
364#define WM831X_GP13_EINT_SHIFT 12 /* GP13_EINT */
365#define WM831X_GP13_EINT_WIDTH 1 /* GP13_EINT */
366#define WM831X_GP12_EINT 0x0800 /* GP12_EINT */
367#define WM831X_GP12_EINT_MASK 0x0800 /* GP12_EINT */
368#define WM831X_GP12_EINT_SHIFT 11 /* GP12_EINT */
369#define WM831X_GP12_EINT_WIDTH 1 /* GP12_EINT */
370#define WM831X_GP11_EINT 0x0400 /* GP11_EINT */
371#define WM831X_GP11_EINT_MASK 0x0400 /* GP11_EINT */
372#define WM831X_GP11_EINT_SHIFT 10 /* GP11_EINT */
373#define WM831X_GP11_EINT_WIDTH 1 /* GP11_EINT */
374#define WM831X_GP10_EINT 0x0200 /* GP10_EINT */
375#define WM831X_GP10_EINT_MASK 0x0200 /* GP10_EINT */
376#define WM831X_GP10_EINT_SHIFT 9 /* GP10_EINT */
377#define WM831X_GP10_EINT_WIDTH 1 /* GP10_EINT */
378#define WM831X_GP9_EINT 0x0100 /* GP9_EINT */
379#define WM831X_GP9_EINT_MASK 0x0100 /* GP9_EINT */
380#define WM831X_GP9_EINT_SHIFT 8 /* GP9_EINT */
381#define WM831X_GP9_EINT_WIDTH 1 /* GP9_EINT */
382#define WM831X_GP8_EINT 0x0080 /* GP8_EINT */
383#define WM831X_GP8_EINT_MASK 0x0080 /* GP8_EINT */
384#define WM831X_GP8_EINT_SHIFT 7 /* GP8_EINT */
385#define WM831X_GP8_EINT_WIDTH 1 /* GP8_EINT */
386#define WM831X_GP7_EINT 0x0040 /* GP7_EINT */
387#define WM831X_GP7_EINT_MASK 0x0040 /* GP7_EINT */
388#define WM831X_GP7_EINT_SHIFT 6 /* GP7_EINT */
389#define WM831X_GP7_EINT_WIDTH 1 /* GP7_EINT */
390#define WM831X_GP6_EINT 0x0020 /* GP6_EINT */
391#define WM831X_GP6_EINT_MASK 0x0020 /* GP6_EINT */
392#define WM831X_GP6_EINT_SHIFT 5 /* GP6_EINT */
393#define WM831X_GP6_EINT_WIDTH 1 /* GP6_EINT */
394#define WM831X_GP5_EINT 0x0010 /* GP5_EINT */
395#define WM831X_GP5_EINT_MASK 0x0010 /* GP5_EINT */
396#define WM831X_GP5_EINT_SHIFT 4 /* GP5_EINT */
397#define WM831X_GP5_EINT_WIDTH 1 /* GP5_EINT */
398#define WM831X_GP4_EINT 0x0008 /* GP4_EINT */
399#define WM831X_GP4_EINT_MASK 0x0008 /* GP4_EINT */
400#define WM831X_GP4_EINT_SHIFT 3 /* GP4_EINT */
401#define WM831X_GP4_EINT_WIDTH 1 /* GP4_EINT */
402#define WM831X_GP3_EINT 0x0004 /* GP3_EINT */
403#define WM831X_GP3_EINT_MASK 0x0004 /* GP3_EINT */
404#define WM831X_GP3_EINT_SHIFT 2 /* GP3_EINT */
405#define WM831X_GP3_EINT_WIDTH 1 /* GP3_EINT */
406#define WM831X_GP2_EINT 0x0002 /* GP2_EINT */
407#define WM831X_GP2_EINT_MASK 0x0002 /* GP2_EINT */
408#define WM831X_GP2_EINT_SHIFT 1 /* GP2_EINT */
409#define WM831X_GP2_EINT_WIDTH 1 /* GP2_EINT */
410#define WM831X_GP1_EINT 0x0001 /* GP1_EINT */
411#define WM831X_GP1_EINT_MASK 0x0001 /* GP1_EINT */
412#define WM831X_GP1_EINT_SHIFT 0 /* GP1_EINT */
413#define WM831X_GP1_EINT_WIDTH 1 /* GP1_EINT */
414
415/*
416 * R16407 (0x4017) - IRQ Config
417 */
418#define WM831X_IRQ_OD 0x0002 /* IRQ_OD */
419#define WM831X_IRQ_OD_MASK 0x0002 /* IRQ_OD */
420#define WM831X_IRQ_OD_SHIFT 1 /* IRQ_OD */
421#define WM831X_IRQ_OD_WIDTH 1 /* IRQ_OD */
422#define WM831X_IM_IRQ 0x0001 /* IM_IRQ */
423#define WM831X_IM_IRQ_MASK 0x0001 /* IM_IRQ */
424#define WM831X_IM_IRQ_SHIFT 0 /* IM_IRQ */
425#define WM831X_IM_IRQ_WIDTH 1 /* IM_IRQ */
426
427/*
428 * R16408 (0x4018) - System Interrupts Mask
429 */
430#define WM831X_IM_PS_INT 0x8000 /* IM_PS_INT */
431#define WM831X_IM_PS_INT_MASK 0x8000 /* IM_PS_INT */
432#define WM831X_IM_PS_INT_SHIFT 15 /* IM_PS_INT */
433#define WM831X_IM_PS_INT_WIDTH 1 /* IM_PS_INT */
434#define WM831X_IM_TEMP_INT 0x4000 /* IM_TEMP_INT */
435#define WM831X_IM_TEMP_INT_MASK 0x4000 /* IM_TEMP_INT */
436#define WM831X_IM_TEMP_INT_SHIFT 14 /* IM_TEMP_INT */
437#define WM831X_IM_TEMP_INT_WIDTH 1 /* IM_TEMP_INT */
438#define WM831X_IM_GP_INT 0x2000 /* IM_GP_INT */
439#define WM831X_IM_GP_INT_MASK 0x2000 /* IM_GP_INT */
440#define WM831X_IM_GP_INT_SHIFT 13 /* IM_GP_INT */
441#define WM831X_IM_GP_INT_WIDTH 1 /* IM_GP_INT */
442#define WM831X_IM_ON_PIN_INT 0x1000 /* IM_ON_PIN_INT */
443#define WM831X_IM_ON_PIN_INT_MASK 0x1000 /* IM_ON_PIN_INT */
444#define WM831X_IM_ON_PIN_INT_SHIFT 12 /* IM_ON_PIN_INT */
445#define WM831X_IM_ON_PIN_INT_WIDTH 1 /* IM_ON_PIN_INT */
446#define WM831X_IM_WDOG_INT 0x0800 /* IM_WDOG_INT */
447#define WM831X_IM_WDOG_INT_MASK 0x0800 /* IM_WDOG_INT */
448#define WM831X_IM_WDOG_INT_SHIFT 11 /* IM_WDOG_INT */
449#define WM831X_IM_WDOG_INT_WIDTH 1 /* IM_WDOG_INT */
450#define WM831X_IM_TCHDATA_INT 0x0400 /* IM_TCHDATA_INT */
451#define WM831X_IM_TCHDATA_INT_MASK 0x0400 /* IM_TCHDATA_INT */
452#define WM831X_IM_TCHDATA_INT_SHIFT 10 /* IM_TCHDATA_INT */
453#define WM831X_IM_TCHDATA_INT_WIDTH 1 /* IM_TCHDATA_INT */
454#define WM831X_IM_TCHPD_INT 0x0200 /* IM_TCHPD_INT */
455#define WM831X_IM_TCHPD_INT_MASK 0x0200 /* IM_TCHPD_INT */
456#define WM831X_IM_TCHPD_INT_SHIFT 9 /* IM_TCHPD_INT */
457#define WM831X_IM_TCHPD_INT_WIDTH 1 /* IM_TCHPD_INT */
458#define WM831X_IM_AUXADC_INT 0x0100 /* IM_AUXADC_INT */
459#define WM831X_IM_AUXADC_INT_MASK 0x0100 /* IM_AUXADC_INT */
460#define WM831X_IM_AUXADC_INT_SHIFT 8 /* IM_AUXADC_INT */
461#define WM831X_IM_AUXADC_INT_WIDTH 1 /* IM_AUXADC_INT */
462#define WM831X_IM_PPM_INT 0x0080 /* IM_PPM_INT */
463#define WM831X_IM_PPM_INT_MASK 0x0080 /* IM_PPM_INT */
464#define WM831X_IM_PPM_INT_SHIFT 7 /* IM_PPM_INT */
465#define WM831X_IM_PPM_INT_WIDTH 1 /* IM_PPM_INT */
466#define WM831X_IM_CS_INT 0x0040 /* IM_CS_INT */
467#define WM831X_IM_CS_INT_MASK 0x0040 /* IM_CS_INT */
468#define WM831X_IM_CS_INT_SHIFT 6 /* IM_CS_INT */
469#define WM831X_IM_CS_INT_WIDTH 1 /* IM_CS_INT */
470#define WM831X_IM_RTC_INT 0x0020 /* IM_RTC_INT */
471#define WM831X_IM_RTC_INT_MASK 0x0020 /* IM_RTC_INT */
472#define WM831X_IM_RTC_INT_SHIFT 5 /* IM_RTC_INT */
473#define WM831X_IM_RTC_INT_WIDTH 1 /* IM_RTC_INT */
474#define WM831X_IM_OTP_INT 0x0010 /* IM_OTP_INT */
475#define WM831X_IM_OTP_INT_MASK 0x0010 /* IM_OTP_INT */
476#define WM831X_IM_OTP_INT_SHIFT 4 /* IM_OTP_INT */
477#define WM831X_IM_OTP_INT_WIDTH 1 /* IM_OTP_INT */
478#define WM831X_IM_CHILD_INT 0x0008 /* IM_CHILD_INT */
479#define WM831X_IM_CHILD_INT_MASK 0x0008 /* IM_CHILD_INT */
480#define WM831X_IM_CHILD_INT_SHIFT 3 /* IM_CHILD_INT */
481#define WM831X_IM_CHILD_INT_WIDTH 1 /* IM_CHILD_INT */
482#define WM831X_IM_CHG_INT 0x0004 /* IM_CHG_INT */
483#define WM831X_IM_CHG_INT_MASK 0x0004 /* IM_CHG_INT */
484#define WM831X_IM_CHG_INT_SHIFT 2 /* IM_CHG_INT */
485#define WM831X_IM_CHG_INT_WIDTH 1 /* IM_CHG_INT */
486#define WM831X_IM_HC_INT 0x0002 /* IM_HC_INT */
487#define WM831X_IM_HC_INT_MASK 0x0002 /* IM_HC_INT */
488#define WM831X_IM_HC_INT_SHIFT 1 /* IM_HC_INT */
489#define WM831X_IM_HC_INT_WIDTH 1 /* IM_HC_INT */
490#define WM831X_IM_UV_INT 0x0001 /* IM_UV_INT */
491#define WM831X_IM_UV_INT_MASK 0x0001 /* IM_UV_INT */
492#define WM831X_IM_UV_INT_SHIFT 0 /* IM_UV_INT */
493#define WM831X_IM_UV_INT_WIDTH 1 /* IM_UV_INT */
494
495/*
496 * R16409 (0x4019) - Interrupt Status 1 Mask
497 */
498#define WM831X_IM_PPM_SYSLO_EINT 0x8000 /* IM_PPM_SYSLO_EINT */
499#define WM831X_IM_PPM_SYSLO_EINT_MASK 0x8000 /* IM_PPM_SYSLO_EINT */
500#define WM831X_IM_PPM_SYSLO_EINT_SHIFT 15 /* IM_PPM_SYSLO_EINT */
501#define WM831X_IM_PPM_SYSLO_EINT_WIDTH 1 /* IM_PPM_SYSLO_EINT */
502#define WM831X_IM_PPM_PWR_SRC_EINT 0x4000 /* IM_PPM_PWR_SRC_EINT */
503#define WM831X_IM_PPM_PWR_SRC_EINT_MASK 0x4000 /* IM_PPM_PWR_SRC_EINT */
504#define WM831X_IM_PPM_PWR_SRC_EINT_SHIFT 14 /* IM_PPM_PWR_SRC_EINT */
505#define WM831X_IM_PPM_PWR_SRC_EINT_WIDTH 1 /* IM_PPM_PWR_SRC_EINT */
506#define WM831X_IM_PPM_USB_CURR_EINT 0x2000 /* IM_PPM_USB_CURR_EINT */
507#define WM831X_IM_PPM_USB_CURR_EINT_MASK 0x2000 /* IM_PPM_USB_CURR_EINT */
508#define WM831X_IM_PPM_USB_CURR_EINT_SHIFT 13 /* IM_PPM_USB_CURR_EINT */
509#define WM831X_IM_PPM_USB_CURR_EINT_WIDTH 1 /* IM_PPM_USB_CURR_EINT */
510#define WM831X_IM_ON_PIN_EINT 0x1000 /* IM_ON_PIN_EINT */
511#define WM831X_IM_ON_PIN_EINT_MASK 0x1000 /* IM_ON_PIN_EINT */
512#define WM831X_IM_ON_PIN_EINT_SHIFT 12 /* IM_ON_PIN_EINT */
513#define WM831X_IM_ON_PIN_EINT_WIDTH 1 /* IM_ON_PIN_EINT */
514#define WM831X_IM_WDOG_TO_EINT 0x0800 /* IM_WDOG_TO_EINT */
515#define WM831X_IM_WDOG_TO_EINT_MASK 0x0800 /* IM_WDOG_TO_EINT */
516#define WM831X_IM_WDOG_TO_EINT_SHIFT 11 /* IM_WDOG_TO_EINT */
517#define WM831X_IM_WDOG_TO_EINT_WIDTH 1 /* IM_WDOG_TO_EINT */
518#define WM831X_IM_TCHDATA_EINT 0x0400 /* IM_TCHDATA_EINT */
519#define WM831X_IM_TCHDATA_EINT_MASK 0x0400 /* IM_TCHDATA_EINT */
520#define WM831X_IM_TCHDATA_EINT_SHIFT 10 /* IM_TCHDATA_EINT */
521#define WM831X_IM_TCHDATA_EINT_WIDTH 1 /* IM_TCHDATA_EINT */
522#define WM831X_IM_TCHPD_EINT 0x0200 /* IM_TCHPD_EINT */
523#define WM831X_IM_TCHPD_EINT_MASK 0x0200 /* IM_TCHPD_EINT */
524#define WM831X_IM_TCHPD_EINT_SHIFT 9 /* IM_TCHPD_EINT */
525#define WM831X_IM_TCHPD_EINT_WIDTH 1 /* IM_TCHPD_EINT */
526#define WM831X_IM_AUXADC_DATA_EINT 0x0100 /* IM_AUXADC_DATA_EINT */
527#define WM831X_IM_AUXADC_DATA_EINT_MASK 0x0100 /* IM_AUXADC_DATA_EINT */
528#define WM831X_IM_AUXADC_DATA_EINT_SHIFT 8 /* IM_AUXADC_DATA_EINT */
529#define WM831X_IM_AUXADC_DATA_EINT_WIDTH 1 /* IM_AUXADC_DATA_EINT */
530#define WM831X_IM_AUXADC_DCOMP4_EINT 0x0080 /* IM_AUXADC_DCOMP4_EINT */
531#define WM831X_IM_AUXADC_DCOMP4_EINT_MASK 0x0080 /* IM_AUXADC_DCOMP4_EINT */
532#define WM831X_IM_AUXADC_DCOMP4_EINT_SHIFT 7 /* IM_AUXADC_DCOMP4_EINT */
533#define WM831X_IM_AUXADC_DCOMP4_EINT_WIDTH 1 /* IM_AUXADC_DCOMP4_EINT */
534#define WM831X_IM_AUXADC_DCOMP3_EINT 0x0040 /* IM_AUXADC_DCOMP3_EINT */
535#define WM831X_IM_AUXADC_DCOMP3_EINT_MASK 0x0040 /* IM_AUXADC_DCOMP3_EINT */
536#define WM831X_IM_AUXADC_DCOMP3_EINT_SHIFT 6 /* IM_AUXADC_DCOMP3_EINT */
537#define WM831X_IM_AUXADC_DCOMP3_EINT_WIDTH 1 /* IM_AUXADC_DCOMP3_EINT */
538#define WM831X_IM_AUXADC_DCOMP2_EINT 0x0020 /* IM_AUXADC_DCOMP2_EINT */
539#define WM831X_IM_AUXADC_DCOMP2_EINT_MASK 0x0020 /* IM_AUXADC_DCOMP2_EINT */
540#define WM831X_IM_AUXADC_DCOMP2_EINT_SHIFT 5 /* IM_AUXADC_DCOMP2_EINT */
541#define WM831X_IM_AUXADC_DCOMP2_EINT_WIDTH 1 /* IM_AUXADC_DCOMP2_EINT */
542#define WM831X_IM_AUXADC_DCOMP1_EINT 0x0010 /* IM_AUXADC_DCOMP1_EINT */
543#define WM831X_IM_AUXADC_DCOMP1_EINT_MASK 0x0010 /* IM_AUXADC_DCOMP1_EINT */
544#define WM831X_IM_AUXADC_DCOMP1_EINT_SHIFT 4 /* IM_AUXADC_DCOMP1_EINT */
545#define WM831X_IM_AUXADC_DCOMP1_EINT_WIDTH 1 /* IM_AUXADC_DCOMP1_EINT */
546#define WM831X_IM_RTC_PER_EINT 0x0008 /* IM_RTC_PER_EINT */
547#define WM831X_IM_RTC_PER_EINT_MASK 0x0008 /* IM_RTC_PER_EINT */
548#define WM831X_IM_RTC_PER_EINT_SHIFT 3 /* IM_RTC_PER_EINT */
549#define WM831X_IM_RTC_PER_EINT_WIDTH 1 /* IM_RTC_PER_EINT */
550#define WM831X_IM_RTC_ALM_EINT 0x0004 /* IM_RTC_ALM_EINT */
551#define WM831X_IM_RTC_ALM_EINT_MASK 0x0004 /* IM_RTC_ALM_EINT */
552#define WM831X_IM_RTC_ALM_EINT_SHIFT 2 /* IM_RTC_ALM_EINT */
553#define WM831X_IM_RTC_ALM_EINT_WIDTH 1 /* IM_RTC_ALM_EINT */
554#define WM831X_IM_TEMP_THW_EINT 0x0002 /* IM_TEMP_THW_EINT */
555#define WM831X_IM_TEMP_THW_EINT_MASK 0x0002 /* IM_TEMP_THW_EINT */
556#define WM831X_IM_TEMP_THW_EINT_SHIFT 1 /* IM_TEMP_THW_EINT */
557#define WM831X_IM_TEMP_THW_EINT_WIDTH 1 /* IM_TEMP_THW_EINT */
558
559/*
560 * R16410 (0x401A) - Interrupt Status 2 Mask
561 */
562#define WM831X_IM_CHG_BATT_HOT_EINT 0x8000 /* IM_CHG_BATT_HOT_EINT */
563#define WM831X_IM_CHG_BATT_HOT_EINT_MASK 0x8000 /* IM_CHG_BATT_HOT_EINT */
564#define WM831X_IM_CHG_BATT_HOT_EINT_SHIFT 15 /* IM_CHG_BATT_HOT_EINT */
565#define WM831X_IM_CHG_BATT_HOT_EINT_WIDTH 1 /* IM_CHG_BATT_HOT_EINT */
566#define WM831X_IM_CHG_BATT_COLD_EINT 0x4000 /* IM_CHG_BATT_COLD_EINT */
567#define WM831X_IM_CHG_BATT_COLD_EINT_MASK 0x4000 /* IM_CHG_BATT_COLD_EINT */
568#define WM831X_IM_CHG_BATT_COLD_EINT_SHIFT 14 /* IM_CHG_BATT_COLD_EINT */
569#define WM831X_IM_CHG_BATT_COLD_EINT_WIDTH 1 /* IM_CHG_BATT_COLD_EINT */
570#define WM831X_IM_CHG_BATT_FAIL_EINT 0x2000 /* IM_CHG_BATT_FAIL_EINT */
571#define WM831X_IM_CHG_BATT_FAIL_EINT_MASK 0x2000 /* IM_CHG_BATT_FAIL_EINT */
572#define WM831X_IM_CHG_BATT_FAIL_EINT_SHIFT 13 /* IM_CHG_BATT_FAIL_EINT */
573#define WM831X_IM_CHG_BATT_FAIL_EINT_WIDTH 1 /* IM_CHG_BATT_FAIL_EINT */
574#define WM831X_IM_CHG_OV_EINT 0x1000 /* IM_CHG_OV_EINT */
575#define WM831X_IM_CHG_OV_EINT_MASK 0x1000 /* IM_CHG_OV_EINT */
576#define WM831X_IM_CHG_OV_EINT_SHIFT 12 /* IM_CHG_OV_EINT */
577#define WM831X_IM_CHG_OV_EINT_WIDTH 1 /* IM_CHG_OV_EINT */
578#define WM831X_IM_CHG_END_EINT 0x0800 /* IM_CHG_END_EINT */
579#define WM831X_IM_CHG_END_EINT_MASK 0x0800 /* IM_CHG_END_EINT */
580#define WM831X_IM_CHG_END_EINT_SHIFT 11 /* IM_CHG_END_EINT */
581#define WM831X_IM_CHG_END_EINT_WIDTH 1 /* IM_CHG_END_EINT */
582#define WM831X_IM_CHG_TO_EINT 0x0400 /* IM_CHG_TO_EINT */
583#define WM831X_IM_CHG_TO_EINT_MASK 0x0400 /* IM_CHG_TO_EINT */
584#define WM831X_IM_CHG_TO_EINT_SHIFT 10 /* IM_CHG_TO_EINT */
585#define WM831X_IM_CHG_TO_EINT_WIDTH 1 /* IM_CHG_TO_EINT */
586#define WM831X_IM_CHG_MODE_EINT 0x0200 /* IM_CHG_MODE_EINT */
587#define WM831X_IM_CHG_MODE_EINT_MASK 0x0200 /* IM_CHG_MODE_EINT */
588#define WM831X_IM_CHG_MODE_EINT_SHIFT 9 /* IM_CHG_MODE_EINT */
589#define WM831X_IM_CHG_MODE_EINT_WIDTH 1 /* IM_CHG_MODE_EINT */
590#define WM831X_IM_CHG_START_EINT 0x0100 /* IM_CHG_START_EINT */
591#define WM831X_IM_CHG_START_EINT_MASK 0x0100 /* IM_CHG_START_EINT */
592#define WM831X_IM_CHG_START_EINT_SHIFT 8 /* IM_CHG_START_EINT */
593#define WM831X_IM_CHG_START_EINT_WIDTH 1 /* IM_CHG_START_EINT */
594#define WM831X_IM_CS2_EINT 0x0080 /* IM_CS2_EINT */
595#define WM831X_IM_CS2_EINT_MASK 0x0080 /* IM_CS2_EINT */
596#define WM831X_IM_CS2_EINT_SHIFT 7 /* IM_CS2_EINT */
597#define WM831X_IM_CS2_EINT_WIDTH 1 /* IM_CS2_EINT */
598#define WM831X_IM_CS1_EINT 0x0040 /* IM_CS1_EINT */
599#define WM831X_IM_CS1_EINT_MASK 0x0040 /* IM_CS1_EINT */
600#define WM831X_IM_CS1_EINT_SHIFT 6 /* IM_CS1_EINT */
601#define WM831X_IM_CS1_EINT_WIDTH 1 /* IM_CS1_EINT */
602#define WM831X_IM_OTP_CMD_END_EINT 0x0020 /* IM_OTP_CMD_END_EINT */
603#define WM831X_IM_OTP_CMD_END_EINT_MASK 0x0020 /* IM_OTP_CMD_END_EINT */
604#define WM831X_IM_OTP_CMD_END_EINT_SHIFT 5 /* IM_OTP_CMD_END_EINT */
605#define WM831X_IM_OTP_CMD_END_EINT_WIDTH 1 /* IM_OTP_CMD_END_EINT */
606#define WM831X_IM_OTP_ERR_EINT 0x0010 /* IM_OTP_ERR_EINT */
607#define WM831X_IM_OTP_ERR_EINT_MASK 0x0010 /* IM_OTP_ERR_EINT */
608#define WM831X_IM_OTP_ERR_EINT_SHIFT 4 /* IM_OTP_ERR_EINT */
609#define WM831X_IM_OTP_ERR_EINT_WIDTH 1 /* IM_OTP_ERR_EINT */
610#define WM831X_IM_PS_POR_EINT 0x0004 /* IM_PS_POR_EINT */
611#define WM831X_IM_PS_POR_EINT_MASK 0x0004 /* IM_PS_POR_EINT */
612#define WM831X_IM_PS_POR_EINT_SHIFT 2 /* IM_PS_POR_EINT */
613#define WM831X_IM_PS_POR_EINT_WIDTH 1 /* IM_PS_POR_EINT */
614#define WM831X_IM_PS_SLEEP_OFF_EINT 0x0002 /* IM_PS_SLEEP_OFF_EINT */
615#define WM831X_IM_PS_SLEEP_OFF_EINT_MASK 0x0002 /* IM_PS_SLEEP_OFF_EINT */
616#define WM831X_IM_PS_SLEEP_OFF_EINT_SHIFT 1 /* IM_PS_SLEEP_OFF_EINT */
617#define WM831X_IM_PS_SLEEP_OFF_EINT_WIDTH 1 /* IM_PS_SLEEP_OFF_EINT */
618#define WM831X_IM_PS_ON_WAKE_EINT 0x0001 /* IM_PS_ON_WAKE_EINT */
619#define WM831X_IM_PS_ON_WAKE_EINT_MASK 0x0001 /* IM_PS_ON_WAKE_EINT */
620#define WM831X_IM_PS_ON_WAKE_EINT_SHIFT 0 /* IM_PS_ON_WAKE_EINT */
621#define WM831X_IM_PS_ON_WAKE_EINT_WIDTH 1 /* IM_PS_ON_WAKE_EINT */
622
623/*
624 * R16411 (0x401B) - Interrupt Status 3 Mask
625 */
626#define WM831X_IM_UV_LDO10_EINT 0x0200 /* IM_UV_LDO10_EINT */
627#define WM831X_IM_UV_LDO10_EINT_MASK 0x0200 /* IM_UV_LDO10_EINT */
628#define WM831X_IM_UV_LDO10_EINT_SHIFT 9 /* IM_UV_LDO10_EINT */
629#define WM831X_IM_UV_LDO10_EINT_WIDTH 1 /* IM_UV_LDO10_EINT */
630#define WM831X_IM_UV_LDO9_EINT 0x0100 /* IM_UV_LDO9_EINT */
631#define WM831X_IM_UV_LDO9_EINT_MASK 0x0100 /* IM_UV_LDO9_EINT */
632#define WM831X_IM_UV_LDO9_EINT_SHIFT 8 /* IM_UV_LDO9_EINT */
633#define WM831X_IM_UV_LDO9_EINT_WIDTH 1 /* IM_UV_LDO9_EINT */
634#define WM831X_IM_UV_LDO8_EINT 0x0080 /* IM_UV_LDO8_EINT */
635#define WM831X_IM_UV_LDO8_EINT_MASK 0x0080 /* IM_UV_LDO8_EINT */
636#define WM831X_IM_UV_LDO8_EINT_SHIFT 7 /* IM_UV_LDO8_EINT */
637#define WM831X_IM_UV_LDO8_EINT_WIDTH 1 /* IM_UV_LDO8_EINT */
638#define WM831X_IM_UV_LDO7_EINT 0x0040 /* IM_UV_LDO7_EINT */
639#define WM831X_IM_UV_LDO7_EINT_MASK 0x0040 /* IM_UV_LDO7_EINT */
640#define WM831X_IM_UV_LDO7_EINT_SHIFT 6 /* IM_UV_LDO7_EINT */
641#define WM831X_IM_UV_LDO7_EINT_WIDTH 1 /* IM_UV_LDO7_EINT */
642#define WM831X_IM_UV_LDO6_EINT 0x0020 /* IM_UV_LDO6_EINT */
643#define WM831X_IM_UV_LDO6_EINT_MASK 0x0020 /* IM_UV_LDO6_EINT */
644#define WM831X_IM_UV_LDO6_EINT_SHIFT 5 /* IM_UV_LDO6_EINT */
645#define WM831X_IM_UV_LDO6_EINT_WIDTH 1 /* IM_UV_LDO6_EINT */
646#define WM831X_IM_UV_LDO5_EINT 0x0010 /* IM_UV_LDO5_EINT */
647#define WM831X_IM_UV_LDO5_EINT_MASK 0x0010 /* IM_UV_LDO5_EINT */
648#define WM831X_IM_UV_LDO5_EINT_SHIFT 4 /* IM_UV_LDO5_EINT */
649#define WM831X_IM_UV_LDO5_EINT_WIDTH 1 /* IM_UV_LDO5_EINT */
650#define WM831X_IM_UV_LDO4_EINT 0x0008 /* IM_UV_LDO4_EINT */
651#define WM831X_IM_UV_LDO4_EINT_MASK 0x0008 /* IM_UV_LDO4_EINT */
652#define WM831X_IM_UV_LDO4_EINT_SHIFT 3 /* IM_UV_LDO4_EINT */
653#define WM831X_IM_UV_LDO4_EINT_WIDTH 1 /* IM_UV_LDO4_EINT */
654#define WM831X_IM_UV_LDO3_EINT 0x0004 /* IM_UV_LDO3_EINT */
655#define WM831X_IM_UV_LDO3_EINT_MASK 0x0004 /* IM_UV_LDO3_EINT */
656#define WM831X_IM_UV_LDO3_EINT_SHIFT 2 /* IM_UV_LDO3_EINT */
657#define WM831X_IM_UV_LDO3_EINT_WIDTH 1 /* IM_UV_LDO3_EINT */
658#define WM831X_IM_UV_LDO2_EINT 0x0002 /* IM_UV_LDO2_EINT */
659#define WM831X_IM_UV_LDO2_EINT_MASK 0x0002 /* IM_UV_LDO2_EINT */
660#define WM831X_IM_UV_LDO2_EINT_SHIFT 1 /* IM_UV_LDO2_EINT */
661#define WM831X_IM_UV_LDO2_EINT_WIDTH 1 /* IM_UV_LDO2_EINT */
662#define WM831X_IM_UV_LDO1_EINT 0x0001 /* IM_UV_LDO1_EINT */
663#define WM831X_IM_UV_LDO1_EINT_MASK 0x0001 /* IM_UV_LDO1_EINT */
664#define WM831X_IM_UV_LDO1_EINT_SHIFT 0 /* IM_UV_LDO1_EINT */
665#define WM831X_IM_UV_LDO1_EINT_WIDTH 1 /* IM_UV_LDO1_EINT */
666
667/*
668 * R16412 (0x401C) - Interrupt Status 4 Mask
669 */
670#define WM831X_IM_HC_DC2_EINT 0x0200 /* IM_HC_DC2_EINT */
671#define WM831X_IM_HC_DC2_EINT_MASK 0x0200 /* IM_HC_DC2_EINT */
672#define WM831X_IM_HC_DC2_EINT_SHIFT 9 /* IM_HC_DC2_EINT */
673#define WM831X_IM_HC_DC2_EINT_WIDTH 1 /* IM_HC_DC2_EINT */
674#define WM831X_IM_HC_DC1_EINT 0x0100 /* IM_HC_DC1_EINT */
675#define WM831X_IM_HC_DC1_EINT_MASK 0x0100 /* IM_HC_DC1_EINT */
676#define WM831X_IM_HC_DC1_EINT_SHIFT 8 /* IM_HC_DC1_EINT */
677#define WM831X_IM_HC_DC1_EINT_WIDTH 1 /* IM_HC_DC1_EINT */
678#define WM831X_IM_UV_DC4_EINT 0x0008 /* IM_UV_DC4_EINT */
679#define WM831X_IM_UV_DC4_EINT_MASK 0x0008 /* IM_UV_DC4_EINT */
680#define WM831X_IM_UV_DC4_EINT_SHIFT 3 /* IM_UV_DC4_EINT */
681#define WM831X_IM_UV_DC4_EINT_WIDTH 1 /* IM_UV_DC4_EINT */
682#define WM831X_IM_UV_DC3_EINT 0x0004 /* IM_UV_DC3_EINT */
683#define WM831X_IM_UV_DC3_EINT_MASK 0x0004 /* IM_UV_DC3_EINT */
684#define WM831X_IM_UV_DC3_EINT_SHIFT 2 /* IM_UV_DC3_EINT */
685#define WM831X_IM_UV_DC3_EINT_WIDTH 1 /* IM_UV_DC3_EINT */
686#define WM831X_IM_UV_DC2_EINT 0x0002 /* IM_UV_DC2_EINT */
687#define WM831X_IM_UV_DC2_EINT_MASK 0x0002 /* IM_UV_DC2_EINT */
688#define WM831X_IM_UV_DC2_EINT_SHIFT 1 /* IM_UV_DC2_EINT */
689#define WM831X_IM_UV_DC2_EINT_WIDTH 1 /* IM_UV_DC2_EINT */
690#define WM831X_IM_UV_DC1_EINT 0x0001 /* IM_UV_DC1_EINT */
691#define WM831X_IM_UV_DC1_EINT_MASK 0x0001 /* IM_UV_DC1_EINT */
692#define WM831X_IM_UV_DC1_EINT_SHIFT 0 /* IM_UV_DC1_EINT */
693#define WM831X_IM_UV_DC1_EINT_WIDTH 1 /* IM_UV_DC1_EINT */
694
695/*
696 * R16413 (0x401D) - Interrupt Status 5 Mask
697 */
698#define WM831X_IM_GP16_EINT 0x8000 /* IM_GP16_EINT */
699#define WM831X_IM_GP16_EINT_MASK 0x8000 /* IM_GP16_EINT */
700#define WM831X_IM_GP16_EINT_SHIFT 15 /* IM_GP16_EINT */
701#define WM831X_IM_GP16_EINT_WIDTH 1 /* IM_GP16_EINT */
702#define WM831X_IM_GP15_EINT 0x4000 /* IM_GP15_EINT */
703#define WM831X_IM_GP15_EINT_MASK 0x4000 /* IM_GP15_EINT */
704#define WM831X_IM_GP15_EINT_SHIFT 14 /* IM_GP15_EINT */
705#define WM831X_IM_GP15_EINT_WIDTH 1 /* IM_GP15_EINT */
706#define WM831X_IM_GP14_EINT 0x2000 /* IM_GP14_EINT */
707#define WM831X_IM_GP14_EINT_MASK 0x2000 /* IM_GP14_EINT */
708#define WM831X_IM_GP14_EINT_SHIFT 13 /* IM_GP14_EINT */
709#define WM831X_IM_GP14_EINT_WIDTH 1 /* IM_GP14_EINT */
710#define WM831X_IM_GP13_EINT 0x1000 /* IM_GP13_EINT */
711#define WM831X_IM_GP13_EINT_MASK 0x1000 /* IM_GP13_EINT */
712#define WM831X_IM_GP13_EINT_SHIFT 12 /* IM_GP13_EINT */
713#define WM831X_IM_GP13_EINT_WIDTH 1 /* IM_GP13_EINT */
714#define WM831X_IM_GP12_EINT 0x0800 /* IM_GP12_EINT */
715#define WM831X_IM_GP12_EINT_MASK 0x0800 /* IM_GP12_EINT */
716#define WM831X_IM_GP12_EINT_SHIFT 11 /* IM_GP12_EINT */
717#define WM831X_IM_GP12_EINT_WIDTH 1 /* IM_GP12_EINT */
718#define WM831X_IM_GP11_EINT 0x0400 /* IM_GP11_EINT */
719#define WM831X_IM_GP11_EINT_MASK 0x0400 /* IM_GP11_EINT */
720#define WM831X_IM_GP11_EINT_SHIFT 10 /* IM_GP11_EINT */
721#define WM831X_IM_GP11_EINT_WIDTH 1 /* IM_GP11_EINT */
722#define WM831X_IM_GP10_EINT 0x0200 /* IM_GP10_EINT */
723#define WM831X_IM_GP10_EINT_MASK 0x0200 /* IM_GP10_EINT */
724#define WM831X_IM_GP10_EINT_SHIFT 9 /* IM_GP10_EINT */
725#define WM831X_IM_GP10_EINT_WIDTH 1 /* IM_GP10_EINT */
726#define WM831X_IM_GP9_EINT 0x0100 /* IM_GP9_EINT */
727#define WM831X_IM_GP9_EINT_MASK 0x0100 /* IM_GP9_EINT */
728#define WM831X_IM_GP9_EINT_SHIFT 8 /* IM_GP9_EINT */
729#define WM831X_IM_GP9_EINT_WIDTH 1 /* IM_GP9_EINT */
730#define WM831X_IM_GP8_EINT 0x0080 /* IM_GP8_EINT */
731#define WM831X_IM_GP8_EINT_MASK 0x0080 /* IM_GP8_EINT */
732#define WM831X_IM_GP8_EINT_SHIFT 7 /* IM_GP8_EINT */
733#define WM831X_IM_GP8_EINT_WIDTH 1 /* IM_GP8_EINT */
734#define WM831X_IM_GP7_EINT 0x0040 /* IM_GP7_EINT */
735#define WM831X_IM_GP7_EINT_MASK 0x0040 /* IM_GP7_EINT */
736#define WM831X_IM_GP7_EINT_SHIFT 6 /* IM_GP7_EINT */
737#define WM831X_IM_GP7_EINT_WIDTH 1 /* IM_GP7_EINT */
738#define WM831X_IM_GP6_EINT 0x0020 /* IM_GP6_EINT */
739#define WM831X_IM_GP6_EINT_MASK 0x0020 /* IM_GP6_EINT */
740#define WM831X_IM_GP6_EINT_SHIFT 5 /* IM_GP6_EINT */
741#define WM831X_IM_GP6_EINT_WIDTH 1 /* IM_GP6_EINT */
742#define WM831X_IM_GP5_EINT 0x0010 /* IM_GP5_EINT */
743#define WM831X_IM_GP5_EINT_MASK 0x0010 /* IM_GP5_EINT */
744#define WM831X_IM_GP5_EINT_SHIFT 4 /* IM_GP5_EINT */
745#define WM831X_IM_GP5_EINT_WIDTH 1 /* IM_GP5_EINT */
746#define WM831X_IM_GP4_EINT 0x0008 /* IM_GP4_EINT */
747#define WM831X_IM_GP4_EINT_MASK 0x0008 /* IM_GP4_EINT */
748#define WM831X_IM_GP4_EINT_SHIFT 3 /* IM_GP4_EINT */
749#define WM831X_IM_GP4_EINT_WIDTH 1 /* IM_GP4_EINT */
750#define WM831X_IM_GP3_EINT 0x0004 /* IM_GP3_EINT */
751#define WM831X_IM_GP3_EINT_MASK 0x0004 /* IM_GP3_EINT */
752#define WM831X_IM_GP3_EINT_SHIFT 2 /* IM_GP3_EINT */
753#define WM831X_IM_GP3_EINT_WIDTH 1 /* IM_GP3_EINT */
754#define WM831X_IM_GP2_EINT 0x0002 /* IM_GP2_EINT */
755#define WM831X_IM_GP2_EINT_MASK 0x0002 /* IM_GP2_EINT */
756#define WM831X_IM_GP2_EINT_SHIFT 1 /* IM_GP2_EINT */
757#define WM831X_IM_GP2_EINT_WIDTH 1 /* IM_GP2_EINT */
758#define WM831X_IM_GP1_EINT 0x0001 /* IM_GP1_EINT */
759#define WM831X_IM_GP1_EINT_MASK 0x0001 /* IM_GP1_EINT */
760#define WM831X_IM_GP1_EINT_SHIFT 0 /* IM_GP1_EINT */
761#define WM831X_IM_GP1_EINT_WIDTH 1 /* IM_GP1_EINT */
762
763
764#endif
diff --git a/include/linux/mfd/wm831x/otp.h b/include/linux/mfd/wm831x/otp.h
new file mode 100644
index 000000000000..ce1f81a39bfc
--- /dev/null
+++ b/include/linux/mfd/wm831x/otp.h
@@ -0,0 +1,162 @@
1/*
2 * include/linux/mfd/wm831x/otp.h -- OTP interface for WM831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_OTP_H__
16#define __MFD_WM831X_OTP_H__
17
18int wm831x_otp_init(struct wm831x *wm831x);
19void wm831x_otp_exit(struct wm831x *wm831x);
20
21/*
22 * R30720 (0x7800) - Unique ID 1
23 */
24#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
25#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
26#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
27
28/*
29 * R30721 (0x7801) - Unique ID 2
30 */
31#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
32#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
33#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
34
35/*
36 * R30722 (0x7802) - Unique ID 3
37 */
38#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
39#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
40#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
41
42/*
43 * R30723 (0x7803) - Unique ID 4
44 */
45#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
46#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
47#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
48
49/*
50 * R30724 (0x7804) - Unique ID 5
51 */
52#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
53#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
54#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
55
56/*
57 * R30725 (0x7805) - Unique ID 6
58 */
59#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
60#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
61#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
62
63/*
64 * R30726 (0x7806) - Unique ID 7
65 */
66#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
67#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
68#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
69
70/*
71 * R30727 (0x7807) - Unique ID 8
72 */
73#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
74#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
75#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
76
77/*
78 * R30728 (0x7808) - Factory OTP ID
79 */
80#define WM831X_OTP_FACT_ID_MASK 0xFFFE /* OTP_FACT_ID - [15:1] */
81#define WM831X_OTP_FACT_ID_SHIFT 1 /* OTP_FACT_ID - [15:1] */
82#define WM831X_OTP_FACT_ID_WIDTH 15 /* OTP_FACT_ID - [15:1] */
83#define WM831X_OTP_FACT_FINAL 0x0001 /* OTP_FACT_FINAL */
84#define WM831X_OTP_FACT_FINAL_MASK 0x0001 /* OTP_FACT_FINAL */
85#define WM831X_OTP_FACT_FINAL_SHIFT 0 /* OTP_FACT_FINAL */
86#define WM831X_OTP_FACT_FINAL_WIDTH 1 /* OTP_FACT_FINAL */
87
88/*
89 * R30729 (0x7809) - Factory OTP 1
90 */
91#define WM831X_DC3_TRIM_MASK 0xF000 /* DC3_TRIM - [15:12] */
92#define WM831X_DC3_TRIM_SHIFT 12 /* DC3_TRIM - [15:12] */
93#define WM831X_DC3_TRIM_WIDTH 4 /* DC3_TRIM - [15:12] */
94#define WM831X_DC2_TRIM_MASK 0x0FC0 /* DC2_TRIM - [11:6] */
95#define WM831X_DC2_TRIM_SHIFT 6 /* DC2_TRIM - [11:6] */
96#define WM831X_DC2_TRIM_WIDTH 6 /* DC2_TRIM - [11:6] */
97#define WM831X_DC1_TRIM_MASK 0x003F /* DC1_TRIM - [5:0] */
98#define WM831X_DC1_TRIM_SHIFT 0 /* DC1_TRIM - [5:0] */
99#define WM831X_DC1_TRIM_WIDTH 6 /* DC1_TRIM - [5:0] */
100
101/*
102 * R30730 (0x780A) - Factory OTP 2
103 */
104#define WM831X_CHIP_ID_MASK 0xFFFF /* CHIP_ID - [15:0] */
105#define WM831X_CHIP_ID_SHIFT 0 /* CHIP_ID - [15:0] */
106#define WM831X_CHIP_ID_WIDTH 16 /* CHIP_ID - [15:0] */
107
108/*
109 * R30731 (0x780B) - Factory OTP 3
110 */
111#define WM831X_OSC_TRIM_MASK 0x0780 /* OSC_TRIM - [10:7] */
112#define WM831X_OSC_TRIM_SHIFT 7 /* OSC_TRIM - [10:7] */
113#define WM831X_OSC_TRIM_WIDTH 4 /* OSC_TRIM - [10:7] */
114#define WM831X_BG_TRIM_MASK 0x0078 /* BG_TRIM - [6:3] */
115#define WM831X_BG_TRIM_SHIFT 3 /* BG_TRIM - [6:3] */
116#define WM831X_BG_TRIM_WIDTH 4 /* BG_TRIM - [6:3] */
117#define WM831X_LPBG_TRIM_MASK 0x0007 /* LPBG_TRIM - [2:0] */
118#define WM831X_LPBG_TRIM_SHIFT 0 /* LPBG_TRIM - [2:0] */
119#define WM831X_LPBG_TRIM_WIDTH 3 /* LPBG_TRIM - [2:0] */
120
121/*
122 * R30732 (0x780C) - Factory OTP 4
123 */
124#define WM831X_CHILD_I2C_ADDR_MASK 0x00FE /* CHILD_I2C_ADDR - [7:1] */
125#define WM831X_CHILD_I2C_ADDR_SHIFT 1 /* CHILD_I2C_ADDR - [7:1] */
126#define WM831X_CHILD_I2C_ADDR_WIDTH 7 /* CHILD_I2C_ADDR - [7:1] */
127#define WM831X_CH_AW 0x0001 /* CH_AW */
128#define WM831X_CH_AW_MASK 0x0001 /* CH_AW */
129#define WM831X_CH_AW_SHIFT 0 /* CH_AW */
130#define WM831X_CH_AW_WIDTH 1 /* CH_AW */
131
132/*
133 * R30733 (0x780D) - Factory OTP 5
134 */
135#define WM831X_CHARGE_TRIM_MASK 0x003F /* CHARGE_TRIM - [5:0] */
136#define WM831X_CHARGE_TRIM_SHIFT 0 /* CHARGE_TRIM - [5:0] */
137#define WM831X_CHARGE_TRIM_WIDTH 6 /* CHARGE_TRIM - [5:0] */
138
139/*
140 * R30736 (0x7810) - Customer OTP ID
141 */
142#define WM831X_OTP_AUTO_PROG 0x8000 /* OTP_AUTO_PROG */
143#define WM831X_OTP_AUTO_PROG_MASK 0x8000 /* OTP_AUTO_PROG */
144#define WM831X_OTP_AUTO_PROG_SHIFT 15 /* OTP_AUTO_PROG */
145#define WM831X_OTP_AUTO_PROG_WIDTH 1 /* OTP_AUTO_PROG */
146#define WM831X_OTP_CUST_ID_MASK 0x7FFE /* OTP_CUST_ID - [14:1] */
147#define WM831X_OTP_CUST_ID_SHIFT 1 /* OTP_CUST_ID - [14:1] */
148#define WM831X_OTP_CUST_ID_WIDTH 14 /* OTP_CUST_ID - [14:1] */
149#define WM831X_OTP_CUST_FINAL 0x0001 /* OTP_CUST_FINAL */
150#define WM831X_OTP_CUST_FINAL_MASK 0x0001 /* OTP_CUST_FINAL */
151#define WM831X_OTP_CUST_FINAL_SHIFT 0 /* OTP_CUST_FINAL */
152#define WM831X_OTP_CUST_FINAL_WIDTH 1 /* OTP_CUST_FINAL */
153
154/*
155 * R30759 (0x7827) - DBE CHECK DATA
156 */
157#define WM831X_DBE_VALID_DATA_MASK 0xFFFF /* DBE_VALID_DATA - [15:0] */
158#define WM831X_DBE_VALID_DATA_SHIFT 0 /* DBE_VALID_DATA - [15:0] */
159#define WM831X_DBE_VALID_DATA_WIDTH 16 /* DBE_VALID_DATA - [15:0] */
160
161
162#endif
diff --git a/include/linux/mfd/wm831x/pdata.h b/include/linux/mfd/wm831x/pdata.h
new file mode 100644
index 000000000000..90d820260aad
--- /dev/null
+++ b/include/linux/mfd/wm831x/pdata.h
@@ -0,0 +1,113 @@
1/*
2 * include/linux/mfd/wm831x/pdata.h -- Platform data for WM831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_PDATA_H__
16#define __MFD_WM831X_PDATA_H__
17
18struct wm831x;
19struct regulator_init_data;
20
21struct wm831x_backlight_pdata {
22 int isink; /** ISINK to use, 1 or 2 */
23 int max_uA; /** Maximum current to allow */
24};
25
26struct wm831x_backup_pdata {
27 int charger_enable;
28 int no_constant_voltage; /** Disable constant voltage charging */
29 int vlim; /** Voltage limit in milivolts */
30 int ilim; /** Current limit in microamps */
31};
32
33struct wm831x_battery_pdata {
34 int enable; /** Enable charging */
35 int fast_enable; /** Enable fast charging */
36 int off_mask; /** Mask OFF while charging */
37 int trickle_ilim; /** Trickle charge current limit, in mA */
38 int vsel; /** Target voltage, in mV */
39 int eoc_iterm; /** End of trickle charge current, in mA */
40 int fast_ilim; /** Fast charge current limit, in mA */
41 int timeout; /** Charge cycle timeout, in minutes */
42};
43
44/* Sources for status LED configuration. Values are register values
45 * plus 1 to allow for a zero default for preserve.
46 */
47enum wm831x_status_src {
48 WM831X_STATUS_PRESERVE = 0, /* Keep the current hardware setting */
49 WM831X_STATUS_OTP = 1,
50 WM831X_STATUS_POWER = 2,
51 WM831X_STATUS_CHARGER = 3,
52 WM831X_STATUS_MANUAL = 4,
53};
54
55struct wm831x_status_pdata {
56 enum wm831x_status_src default_src;
57 const char *name;
58 const char *default_trigger;
59};
60
61struct wm831x_touch_pdata {
62 int fivewire; /** 1 for five wire mode, 0 for 4 wire */
63 int isel; /** Current for pen down (uA) */
64 int rpu; /** Pen down sensitivity resistor divider */
65 int pressure; /** Report pressure (boolean) */
66 int data_irq; /** Touch data ready IRQ */
67};
68
69enum wm831x_watchdog_action {
70 WM831X_WDOG_NONE = 0,
71 WM831X_WDOG_INTERRUPT = 1,
72 WM831X_WDOG_RESET = 2,
73 WM831X_WDOG_WAKE = 3,
74};
75
76struct wm831x_watchdog_pdata {
77 enum wm831x_watchdog_action primary, secondary;
78 int update_gpio;
79 unsigned int software:1;
80};
81
82#define WM831X_MAX_STATUS 2
83#define WM831X_MAX_DCDC 4
84#define WM831X_MAX_EPE 2
85#define WM831X_MAX_LDO 11
86#define WM831X_MAX_ISINK 2
87
88struct wm831x_pdata {
89 /** Called before subdevices are set up */
90 int (*pre_init)(struct wm831x *wm831x);
91 /** Called after subdevices are set up */
92 int (*post_init)(struct wm831x *wm831x);
93
94 int gpio_base;
95 struct wm831x_backlight_pdata *backlight;
96 struct wm831x_backup_pdata *backup;
97 struct wm831x_battery_pdata *battery;
98 struct wm831x_touch_pdata *touch;
99 struct wm831x_watchdog_pdata *watchdog;
100
101 /** LED1 = 0 and so on */
102 struct wm831x_status_pdata *status[WM831X_MAX_STATUS];
103 /** DCDC1 = 0 and so on */
104 struct regulator_init_data *dcdc[WM831X_MAX_DCDC];
105 /** EPE1 = 0 and so on */
106 struct regulator_init_data *epe[WM831X_MAX_EPE];
107 /** LDO1 = 0 and so on */
108 struct regulator_init_data *ldo[WM831X_MAX_LDO];
109 /** ISINK1 = 0 and so on*/
110 struct regulator_init_data *isink[WM831X_MAX_ISINK];
111};
112
113#endif
diff --git a/include/linux/mfd/wm831x/pmu.h b/include/linux/mfd/wm831x/pmu.h
new file mode 100644
index 000000000000..b18cbb027bc3
--- /dev/null
+++ b/include/linux/mfd/wm831x/pmu.h
@@ -0,0 +1,189 @@
1/*
2 * include/linux/mfd/wm831x/pmu.h -- PMU for WM831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_PMU_H__
16#define __MFD_WM831X_PMU_H__
17
18/*
19 * R16387 (0x4003) - Power State
20 */
21#define WM831X_CHIP_ON 0x8000 /* CHIP_ON */
22#define WM831X_CHIP_ON_MASK 0x8000 /* CHIP_ON */
23#define WM831X_CHIP_ON_SHIFT 15 /* CHIP_ON */
24#define WM831X_CHIP_ON_WIDTH 1 /* CHIP_ON */
25#define WM831X_CHIP_SLP 0x4000 /* CHIP_SLP */
26#define WM831X_CHIP_SLP_MASK 0x4000 /* CHIP_SLP */
27#define WM831X_CHIP_SLP_SHIFT 14 /* CHIP_SLP */
28#define WM831X_CHIP_SLP_WIDTH 1 /* CHIP_SLP */
29#define WM831X_REF_LP 0x1000 /* REF_LP */
30#define WM831X_REF_LP_MASK 0x1000 /* REF_LP */
31#define WM831X_REF_LP_SHIFT 12 /* REF_LP */
32#define WM831X_REF_LP_WIDTH 1 /* REF_LP */
33#define WM831X_PWRSTATE_DLY_MASK 0x0C00 /* PWRSTATE_DLY - [11:10] */
34#define WM831X_PWRSTATE_DLY_SHIFT 10 /* PWRSTATE_DLY - [11:10] */
35#define WM831X_PWRSTATE_DLY_WIDTH 2 /* PWRSTATE_DLY - [11:10] */
36#define WM831X_SWRST_DLY 0x0200 /* SWRST_DLY */
37#define WM831X_SWRST_DLY_MASK 0x0200 /* SWRST_DLY */
38#define WM831X_SWRST_DLY_SHIFT 9 /* SWRST_DLY */
39#define WM831X_SWRST_DLY_WIDTH 1 /* SWRST_DLY */
40#define WM831X_USB100MA_STARTUP_MASK 0x0030 /* USB100MA_STARTUP - [5:4] */
41#define WM831X_USB100MA_STARTUP_SHIFT 4 /* USB100MA_STARTUP - [5:4] */
42#define WM831X_USB100MA_STARTUP_WIDTH 2 /* USB100MA_STARTUP - [5:4] */
43#define WM831X_USB_CURR_STS 0x0008 /* USB_CURR_STS */
44#define WM831X_USB_CURR_STS_MASK 0x0008 /* USB_CURR_STS */
45#define WM831X_USB_CURR_STS_SHIFT 3 /* USB_CURR_STS */
46#define WM831X_USB_CURR_STS_WIDTH 1 /* USB_CURR_STS */
47#define WM831X_USB_ILIM_MASK 0x0007 /* USB_ILIM - [2:0] */
48#define WM831X_USB_ILIM_SHIFT 0 /* USB_ILIM - [2:0] */
49#define WM831X_USB_ILIM_WIDTH 3 /* USB_ILIM - [2:0] */
50
51/*
52 * R16397 (0x400D) - System Status
53 */
54#define WM831X_THW_STS 0x8000 /* THW_STS */
55#define WM831X_THW_STS_MASK 0x8000 /* THW_STS */
56#define WM831X_THW_STS_SHIFT 15 /* THW_STS */
57#define WM831X_THW_STS_WIDTH 1 /* THW_STS */
58#define WM831X_PWR_SRC_BATT 0x0400 /* PWR_SRC_BATT */
59#define WM831X_PWR_SRC_BATT_MASK 0x0400 /* PWR_SRC_BATT */
60#define WM831X_PWR_SRC_BATT_SHIFT 10 /* PWR_SRC_BATT */
61#define WM831X_PWR_SRC_BATT_WIDTH 1 /* PWR_SRC_BATT */
62#define WM831X_PWR_WALL 0x0200 /* PWR_WALL */
63#define WM831X_PWR_WALL_MASK 0x0200 /* PWR_WALL */
64#define WM831X_PWR_WALL_SHIFT 9 /* PWR_WALL */
65#define WM831X_PWR_WALL_WIDTH 1 /* PWR_WALL */
66#define WM831X_PWR_USB 0x0100 /* PWR_USB */
67#define WM831X_PWR_USB_MASK 0x0100 /* PWR_USB */
68#define WM831X_PWR_USB_SHIFT 8 /* PWR_USB */
69#define WM831X_PWR_USB_WIDTH 1 /* PWR_USB */
70#define WM831X_MAIN_STATE_MASK 0x001F /* MAIN_STATE - [4:0] */
71#define WM831X_MAIN_STATE_SHIFT 0 /* MAIN_STATE - [4:0] */
72#define WM831X_MAIN_STATE_WIDTH 5 /* MAIN_STATE - [4:0] */
73
74/*
75 * R16456 (0x4048) - Charger Control 1
76 */
77#define WM831X_CHG_ENA 0x8000 /* CHG_ENA */
78#define WM831X_CHG_ENA_MASK 0x8000 /* CHG_ENA */
79#define WM831X_CHG_ENA_SHIFT 15 /* CHG_ENA */
80#define WM831X_CHG_ENA_WIDTH 1 /* CHG_ENA */
81#define WM831X_CHG_FRC 0x4000 /* CHG_FRC */
82#define WM831X_CHG_FRC_MASK 0x4000 /* CHG_FRC */
83#define WM831X_CHG_FRC_SHIFT 14 /* CHG_FRC */
84#define WM831X_CHG_FRC_WIDTH 1 /* CHG_FRC */
85#define WM831X_CHG_ITERM_MASK 0x1C00 /* CHG_ITERM - [12:10] */
86#define WM831X_CHG_ITERM_SHIFT 10 /* CHG_ITERM - [12:10] */
87#define WM831X_CHG_ITERM_WIDTH 3 /* CHG_ITERM - [12:10] */
88#define WM831X_CHG_FAST 0x0020 /* CHG_FAST */
89#define WM831X_CHG_FAST_MASK 0x0020 /* CHG_FAST */
90#define WM831X_CHG_FAST_SHIFT 5 /* CHG_FAST */
91#define WM831X_CHG_FAST_WIDTH 1 /* CHG_FAST */
92#define WM831X_CHG_IMON_ENA 0x0002 /* CHG_IMON_ENA */
93#define WM831X_CHG_IMON_ENA_MASK 0x0002 /* CHG_IMON_ENA */
94#define WM831X_CHG_IMON_ENA_SHIFT 1 /* CHG_IMON_ENA */
95#define WM831X_CHG_IMON_ENA_WIDTH 1 /* CHG_IMON_ENA */
96#define WM831X_CHG_CHIP_TEMP_MON 0x0001 /* CHG_CHIP_TEMP_MON */
97#define WM831X_CHG_CHIP_TEMP_MON_MASK 0x0001 /* CHG_CHIP_TEMP_MON */
98#define WM831X_CHG_CHIP_TEMP_MON_SHIFT 0 /* CHG_CHIP_TEMP_MON */
99#define WM831X_CHG_CHIP_TEMP_MON_WIDTH 1 /* CHG_CHIP_TEMP_MON */
100
101/*
102 * R16457 (0x4049) - Charger Control 2
103 */
104#define WM831X_CHG_OFF_MSK 0x4000 /* CHG_OFF_MSK */
105#define WM831X_CHG_OFF_MSK_MASK 0x4000 /* CHG_OFF_MSK */
106#define WM831X_CHG_OFF_MSK_SHIFT 14 /* CHG_OFF_MSK */
107#define WM831X_CHG_OFF_MSK_WIDTH 1 /* CHG_OFF_MSK */
108#define WM831X_CHG_TIME_MASK 0x0F00 /* CHG_TIME - [11:8] */
109#define WM831X_CHG_TIME_SHIFT 8 /* CHG_TIME - [11:8] */
110#define WM831X_CHG_TIME_WIDTH 4 /* CHG_TIME - [11:8] */
111#define WM831X_CHG_TRKL_ILIM_MASK 0x00C0 /* CHG_TRKL_ILIM - [7:6] */
112#define WM831X_CHG_TRKL_ILIM_SHIFT 6 /* CHG_TRKL_ILIM - [7:6] */
113#define WM831X_CHG_TRKL_ILIM_WIDTH 2 /* CHG_TRKL_ILIM - [7:6] */
114#define WM831X_CHG_VSEL_MASK 0x0030 /* CHG_VSEL - [5:4] */
115#define WM831X_CHG_VSEL_SHIFT 4 /* CHG_VSEL - [5:4] */
116#define WM831X_CHG_VSEL_WIDTH 2 /* CHG_VSEL - [5:4] */
117#define WM831X_CHG_FAST_ILIM_MASK 0x000F /* CHG_FAST_ILIM - [3:0] */
118#define WM831X_CHG_FAST_ILIM_SHIFT 0 /* CHG_FAST_ILIM - [3:0] */
119#define WM831X_CHG_FAST_ILIM_WIDTH 4 /* CHG_FAST_ILIM - [3:0] */
120
121/*
122 * R16458 (0x404A) - Charger Status
123 */
124#define WM831X_BATT_OV_STS 0x8000 /* BATT_OV_STS */
125#define WM831X_BATT_OV_STS_MASK 0x8000 /* BATT_OV_STS */
126#define WM831X_BATT_OV_STS_SHIFT 15 /* BATT_OV_STS */
127#define WM831X_BATT_OV_STS_WIDTH 1 /* BATT_OV_STS */
128#define WM831X_CHG_STATE_MASK 0x7000 /* CHG_STATE - [14:12] */
129#define WM831X_CHG_STATE_SHIFT 12 /* CHG_STATE - [14:12] */
130#define WM831X_CHG_STATE_WIDTH 3 /* CHG_STATE - [14:12] */
131#define WM831X_BATT_HOT_STS 0x0800 /* BATT_HOT_STS */
132#define WM831X_BATT_HOT_STS_MASK 0x0800 /* BATT_HOT_STS */
133#define WM831X_BATT_HOT_STS_SHIFT 11 /* BATT_HOT_STS */
134#define WM831X_BATT_HOT_STS_WIDTH 1 /* BATT_HOT_STS */
135#define WM831X_BATT_COLD_STS 0x0400 /* BATT_COLD_STS */
136#define WM831X_BATT_COLD_STS_MASK 0x0400 /* BATT_COLD_STS */
137#define WM831X_BATT_COLD_STS_SHIFT 10 /* BATT_COLD_STS */
138#define WM831X_BATT_COLD_STS_WIDTH 1 /* BATT_COLD_STS */
139#define WM831X_CHG_TOPOFF 0x0200 /* CHG_TOPOFF */
140#define WM831X_CHG_TOPOFF_MASK 0x0200 /* CHG_TOPOFF */
141#define WM831X_CHG_TOPOFF_SHIFT 9 /* CHG_TOPOFF */
142#define WM831X_CHG_TOPOFF_WIDTH 1 /* CHG_TOPOFF */
143#define WM831X_CHG_ACTIVE 0x0100 /* CHG_ACTIVE */
144#define WM831X_CHG_ACTIVE_MASK 0x0100 /* CHG_ACTIVE */
145#define WM831X_CHG_ACTIVE_SHIFT 8 /* CHG_ACTIVE */
146#define WM831X_CHG_ACTIVE_WIDTH 1 /* CHG_ACTIVE */
147#define WM831X_CHG_TIME_ELAPSED_MASK 0x00FF /* CHG_TIME_ELAPSED - [7:0] */
148#define WM831X_CHG_TIME_ELAPSED_SHIFT 0 /* CHG_TIME_ELAPSED - [7:0] */
149#define WM831X_CHG_TIME_ELAPSED_WIDTH 8 /* CHG_TIME_ELAPSED - [7:0] */
150
151#define WM831X_CHG_STATE_OFF (0 << WM831X_CHG_STATE_SHIFT)
152#define WM831X_CHG_STATE_TRICKLE (1 << WM831X_CHG_STATE_SHIFT)
153#define WM831X_CHG_STATE_FAST (2 << WM831X_CHG_STATE_SHIFT)
154#define WM831X_CHG_STATE_TRICKLE_OT (3 << WM831X_CHG_STATE_SHIFT)
155#define WM831X_CHG_STATE_FAST_OT (4 << WM831X_CHG_STATE_SHIFT)
156#define WM831X_CHG_STATE_DEFECTIVE (5 << WM831X_CHG_STATE_SHIFT)
157
158/*
159 * R16459 (0x404B) - Backup Charger Control
160 */
161#define WM831X_BKUP_CHG_ENA 0x8000 /* BKUP_CHG_ENA */
162#define WM831X_BKUP_CHG_ENA_MASK 0x8000 /* BKUP_CHG_ENA */
163#define WM831X_BKUP_CHG_ENA_SHIFT 15 /* BKUP_CHG_ENA */
164#define WM831X_BKUP_CHG_ENA_WIDTH 1 /* BKUP_CHG_ENA */
165#define WM831X_BKUP_CHG_STS 0x4000 /* BKUP_CHG_STS */
166#define WM831X_BKUP_CHG_STS_MASK 0x4000 /* BKUP_CHG_STS */
167#define WM831X_BKUP_CHG_STS_SHIFT 14 /* BKUP_CHG_STS */
168#define WM831X_BKUP_CHG_STS_WIDTH 1 /* BKUP_CHG_STS */
169#define WM831X_BKUP_CHG_MODE 0x1000 /* BKUP_CHG_MODE */
170#define WM831X_BKUP_CHG_MODE_MASK 0x1000 /* BKUP_CHG_MODE */
171#define WM831X_BKUP_CHG_MODE_SHIFT 12 /* BKUP_CHG_MODE */
172#define WM831X_BKUP_CHG_MODE_WIDTH 1 /* BKUP_CHG_MODE */
173#define WM831X_BKUP_BATT_DET_ENA 0x0800 /* BKUP_BATT_DET_ENA */
174#define WM831X_BKUP_BATT_DET_ENA_MASK 0x0800 /* BKUP_BATT_DET_ENA */
175#define WM831X_BKUP_BATT_DET_ENA_SHIFT 11 /* BKUP_BATT_DET_ENA */
176#define WM831X_BKUP_BATT_DET_ENA_WIDTH 1 /* BKUP_BATT_DET_ENA */
177#define WM831X_BKUP_BATT_STS 0x0400 /* BKUP_BATT_STS */
178#define WM831X_BKUP_BATT_STS_MASK 0x0400 /* BKUP_BATT_STS */
179#define WM831X_BKUP_BATT_STS_SHIFT 10 /* BKUP_BATT_STS */
180#define WM831X_BKUP_BATT_STS_WIDTH 1 /* BKUP_BATT_STS */
181#define WM831X_BKUP_CHG_VLIM 0x0010 /* BKUP_CHG_VLIM */
182#define WM831X_BKUP_CHG_VLIM_MASK 0x0010 /* BKUP_CHG_VLIM */
183#define WM831X_BKUP_CHG_VLIM_SHIFT 4 /* BKUP_CHG_VLIM */
184#define WM831X_BKUP_CHG_VLIM_WIDTH 1 /* BKUP_CHG_VLIM */
185#define WM831X_BKUP_CHG_ILIM_MASK 0x0003 /* BKUP_CHG_ILIM - [1:0] */
186#define WM831X_BKUP_CHG_ILIM_SHIFT 0 /* BKUP_CHG_ILIM - [1:0] */
187#define WM831X_BKUP_CHG_ILIM_WIDTH 2 /* BKUP_CHG_ILIM - [1:0] */
188
189#endif
diff --git a/include/linux/mfd/wm831x/regulator.h b/include/linux/mfd/wm831x/regulator.h
new file mode 100644
index 000000000000..955d30fc6a27
--- /dev/null
+++ b/include/linux/mfd/wm831x/regulator.h
@@ -0,0 +1,1218 @@
1/*
2 * linux/mfd/wm831x/regulator.h -- Regulator definitons for wm831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_REGULATOR_H__
16#define __MFD_WM831X_REGULATOR_H__
17
18/*
19 * R16462 (0x404E) - Current Sink 1
20 */
21#define WM831X_CS1_ENA 0x8000 /* CS1_ENA */
22#define WM831X_CS1_ENA_MASK 0x8000 /* CS1_ENA */
23#define WM831X_CS1_ENA_SHIFT 15 /* CS1_ENA */
24#define WM831X_CS1_ENA_WIDTH 1 /* CS1_ENA */
25#define WM831X_CS1_DRIVE 0x4000 /* CS1_DRIVE */
26#define WM831X_CS1_DRIVE_MASK 0x4000 /* CS1_DRIVE */
27#define WM831X_CS1_DRIVE_SHIFT 14 /* CS1_DRIVE */
28#define WM831X_CS1_DRIVE_WIDTH 1 /* CS1_DRIVE */
29#define WM831X_CS1_SLPENA 0x1000 /* CS1_SLPENA */
30#define WM831X_CS1_SLPENA_MASK 0x1000 /* CS1_SLPENA */
31#define WM831X_CS1_SLPENA_SHIFT 12 /* CS1_SLPENA */
32#define WM831X_CS1_SLPENA_WIDTH 1 /* CS1_SLPENA */
33#define WM831X_CS1_OFF_RAMP_MASK 0x0C00 /* CS1_OFF_RAMP - [11:10] */
34#define WM831X_CS1_OFF_RAMP_SHIFT 10 /* CS1_OFF_RAMP - [11:10] */
35#define WM831X_CS1_OFF_RAMP_WIDTH 2 /* CS1_OFF_RAMP - [11:10] */
36#define WM831X_CS1_ON_RAMP_MASK 0x0300 /* CS1_ON_RAMP - [9:8] */
37#define WM831X_CS1_ON_RAMP_SHIFT 8 /* CS1_ON_RAMP - [9:8] */
38#define WM831X_CS1_ON_RAMP_WIDTH 2 /* CS1_ON_RAMP - [9:8] */
39#define WM831X_CS1_ISEL_MASK 0x003F /* CS1_ISEL - [5:0] */
40#define WM831X_CS1_ISEL_SHIFT 0 /* CS1_ISEL - [5:0] */
41#define WM831X_CS1_ISEL_WIDTH 6 /* CS1_ISEL - [5:0] */
42
43/*
44 * R16463 (0x404F) - Current Sink 2
45 */
46#define WM831X_CS2_ENA 0x8000 /* CS2_ENA */
47#define WM831X_CS2_ENA_MASK 0x8000 /* CS2_ENA */
48#define WM831X_CS2_ENA_SHIFT 15 /* CS2_ENA */
49#define WM831X_CS2_ENA_WIDTH 1 /* CS2_ENA */
50#define WM831X_CS2_DRIVE 0x4000 /* CS2_DRIVE */
51#define WM831X_CS2_DRIVE_MASK 0x4000 /* CS2_DRIVE */
52#define WM831X_CS2_DRIVE_SHIFT 14 /* CS2_DRIVE */
53#define WM831X_CS2_DRIVE_WIDTH 1 /* CS2_DRIVE */
54#define WM831X_CS2_SLPENA 0x1000 /* CS2_SLPENA */
55#define WM831X_CS2_SLPENA_MASK 0x1000 /* CS2_SLPENA */
56#define WM831X_CS2_SLPENA_SHIFT 12 /* CS2_SLPENA */
57#define WM831X_CS2_SLPENA_WIDTH 1 /* CS2_SLPENA */
58#define WM831X_CS2_OFF_RAMP_MASK 0x0C00 /* CS2_OFF_RAMP - [11:10] */
59#define WM831X_CS2_OFF_RAMP_SHIFT 10 /* CS2_OFF_RAMP - [11:10] */
60#define WM831X_CS2_OFF_RAMP_WIDTH 2 /* CS2_OFF_RAMP - [11:10] */
61#define WM831X_CS2_ON_RAMP_MASK 0x0300 /* CS2_ON_RAMP - [9:8] */
62#define WM831X_CS2_ON_RAMP_SHIFT 8 /* CS2_ON_RAMP - [9:8] */
63#define WM831X_CS2_ON_RAMP_WIDTH 2 /* CS2_ON_RAMP - [9:8] */
64#define WM831X_CS2_ISEL_MASK 0x003F /* CS2_ISEL - [5:0] */
65#define WM831X_CS2_ISEL_SHIFT 0 /* CS2_ISEL - [5:0] */
66#define WM831X_CS2_ISEL_WIDTH 6 /* CS2_ISEL - [5:0] */
67
68/*
69 * R16464 (0x4050) - DCDC Enable
70 */
71#define WM831X_EPE2_ENA 0x0080 /* EPE2_ENA */
72#define WM831X_EPE2_ENA_MASK 0x0080 /* EPE2_ENA */
73#define WM831X_EPE2_ENA_SHIFT 7 /* EPE2_ENA */
74#define WM831X_EPE2_ENA_WIDTH 1 /* EPE2_ENA */
75#define WM831X_EPE1_ENA 0x0040 /* EPE1_ENA */
76#define WM831X_EPE1_ENA_MASK 0x0040 /* EPE1_ENA */
77#define WM831X_EPE1_ENA_SHIFT 6 /* EPE1_ENA */
78#define WM831X_EPE1_ENA_WIDTH 1 /* EPE1_ENA */
79#define WM831X_DC4_ENA 0x0008 /* DC4_ENA */
80#define WM831X_DC4_ENA_MASK 0x0008 /* DC4_ENA */
81#define WM831X_DC4_ENA_SHIFT 3 /* DC4_ENA */
82#define WM831X_DC4_ENA_WIDTH 1 /* DC4_ENA */
83#define WM831X_DC3_ENA 0x0004 /* DC3_ENA */
84#define WM831X_DC3_ENA_MASK 0x0004 /* DC3_ENA */
85#define WM831X_DC3_ENA_SHIFT 2 /* DC3_ENA */
86#define WM831X_DC3_ENA_WIDTH 1 /* DC3_ENA */
87#define WM831X_DC2_ENA 0x0002 /* DC2_ENA */
88#define WM831X_DC2_ENA_MASK 0x0002 /* DC2_ENA */
89#define WM831X_DC2_ENA_SHIFT 1 /* DC2_ENA */
90#define WM831X_DC2_ENA_WIDTH 1 /* DC2_ENA */
91#define WM831X_DC1_ENA 0x0001 /* DC1_ENA */
92#define WM831X_DC1_ENA_MASK 0x0001 /* DC1_ENA */
93#define WM831X_DC1_ENA_SHIFT 0 /* DC1_ENA */
94#define WM831X_DC1_ENA_WIDTH 1 /* DC1_ENA */
95
96/*
97 * R16465 (0x4051) - LDO Enable
98 */
99#define WM831X_LDO11_ENA 0x0400 /* LDO11_ENA */
100#define WM831X_LDO11_ENA_MASK 0x0400 /* LDO11_ENA */
101#define WM831X_LDO11_ENA_SHIFT 10 /* LDO11_ENA */
102#define WM831X_LDO11_ENA_WIDTH 1 /* LDO11_ENA */
103#define WM831X_LDO10_ENA 0x0200 /* LDO10_ENA */
104#define WM831X_LDO10_ENA_MASK 0x0200 /* LDO10_ENA */
105#define WM831X_LDO10_ENA_SHIFT 9 /* LDO10_ENA */
106#define WM831X_LDO10_ENA_WIDTH 1 /* LDO10_ENA */
107#define WM831X_LDO9_ENA 0x0100 /* LDO9_ENA */
108#define WM831X_LDO9_ENA_MASK 0x0100 /* LDO9_ENA */
109#define WM831X_LDO9_ENA_SHIFT 8 /* LDO9_ENA */
110#define WM831X_LDO9_ENA_WIDTH 1 /* LDO9_ENA */
111#define WM831X_LDO8_ENA 0x0080 /* LDO8_ENA */
112#define WM831X_LDO8_ENA_MASK 0x0080 /* LDO8_ENA */
113#define WM831X_LDO8_ENA_SHIFT 7 /* LDO8_ENA */
114#define WM831X_LDO8_ENA_WIDTH 1 /* LDO8_ENA */
115#define WM831X_LDO7_ENA 0x0040 /* LDO7_ENA */
116#define WM831X_LDO7_ENA_MASK 0x0040 /* LDO7_ENA */
117#define WM831X_LDO7_ENA_SHIFT 6 /* LDO7_ENA */
118#define WM831X_LDO7_ENA_WIDTH 1 /* LDO7_ENA */
119#define WM831X_LDO6_ENA 0x0020 /* LDO6_ENA */
120#define WM831X_LDO6_ENA_MASK 0x0020 /* LDO6_ENA */
121#define WM831X_LDO6_ENA_SHIFT 5 /* LDO6_ENA */
122#define WM831X_LDO6_ENA_WIDTH 1 /* LDO6_ENA */
123#define WM831X_LDO5_ENA 0x0010 /* LDO5_ENA */
124#define WM831X_LDO5_ENA_MASK 0x0010 /* LDO5_ENA */
125#define WM831X_LDO5_ENA_SHIFT 4 /* LDO5_ENA */
126#define WM831X_LDO5_ENA_WIDTH 1 /* LDO5_ENA */
127#define WM831X_LDO4_ENA 0x0008 /* LDO4_ENA */
128#define WM831X_LDO4_ENA_MASK 0x0008 /* LDO4_ENA */
129#define WM831X_LDO4_ENA_SHIFT 3 /* LDO4_ENA */
130#define WM831X_LDO4_ENA_WIDTH 1 /* LDO4_ENA */
131#define WM831X_LDO3_ENA 0x0004 /* LDO3_ENA */
132#define WM831X_LDO3_ENA_MASK 0x0004 /* LDO3_ENA */
133#define WM831X_LDO3_ENA_SHIFT 2 /* LDO3_ENA */
134#define WM831X_LDO3_ENA_WIDTH 1 /* LDO3_ENA */
135#define WM831X_LDO2_ENA 0x0002 /* LDO2_ENA */
136#define WM831X_LDO2_ENA_MASK 0x0002 /* LDO2_ENA */
137#define WM831X_LDO2_ENA_SHIFT 1 /* LDO2_ENA */
138#define WM831X_LDO2_ENA_WIDTH 1 /* LDO2_ENA */
139#define WM831X_LDO1_ENA 0x0001 /* LDO1_ENA */
140#define WM831X_LDO1_ENA_MASK 0x0001 /* LDO1_ENA */
141#define WM831X_LDO1_ENA_SHIFT 0 /* LDO1_ENA */
142#define WM831X_LDO1_ENA_WIDTH 1 /* LDO1_ENA */
143
144/*
145 * R16466 (0x4052) - DCDC Status
146 */
147#define WM831X_EPE2_STS 0x0080 /* EPE2_STS */
148#define WM831X_EPE2_STS_MASK 0x0080 /* EPE2_STS */
149#define WM831X_EPE2_STS_SHIFT 7 /* EPE2_STS */
150#define WM831X_EPE2_STS_WIDTH 1 /* EPE2_STS */
151#define WM831X_EPE1_STS 0x0040 /* EPE1_STS */
152#define WM831X_EPE1_STS_MASK 0x0040 /* EPE1_STS */
153#define WM831X_EPE1_STS_SHIFT 6 /* EPE1_STS */
154#define WM831X_EPE1_STS_WIDTH 1 /* EPE1_STS */
155#define WM831X_DC4_STS 0x0008 /* DC4_STS */
156#define WM831X_DC4_STS_MASK 0x0008 /* DC4_STS */
157#define WM831X_DC4_STS_SHIFT 3 /* DC4_STS */
158#define WM831X_DC4_STS_WIDTH 1 /* DC4_STS */
159#define WM831X_DC3_STS 0x0004 /* DC3_STS */
160#define WM831X_DC3_STS_MASK 0x0004 /* DC3_STS */
161#define WM831X_DC3_STS_SHIFT 2 /* DC3_STS */
162#define WM831X_DC3_STS_WIDTH 1 /* DC3_STS */
163#define WM831X_DC2_STS 0x0002 /* DC2_STS */
164#define WM831X_DC2_STS_MASK 0x0002 /* DC2_STS */
165#define WM831X_DC2_STS_SHIFT 1 /* DC2_STS */
166#define WM831X_DC2_STS_WIDTH 1 /* DC2_STS */
167#define WM831X_DC1_STS 0x0001 /* DC1_STS */
168#define WM831X_DC1_STS_MASK 0x0001 /* DC1_STS */
169#define WM831X_DC1_STS_SHIFT 0 /* DC1_STS */
170#define WM831X_DC1_STS_WIDTH 1 /* DC1_STS */
171
172/*
173 * R16467 (0x4053) - LDO Status
174 */
175#define WM831X_LDO11_STS 0x0400 /* LDO11_STS */
176#define WM831X_LDO11_STS_MASK 0x0400 /* LDO11_STS */
177#define WM831X_LDO11_STS_SHIFT 10 /* LDO11_STS */
178#define WM831X_LDO11_STS_WIDTH 1 /* LDO11_STS */
179#define WM831X_LDO10_STS 0x0200 /* LDO10_STS */
180#define WM831X_LDO10_STS_MASK 0x0200 /* LDO10_STS */
181#define WM831X_LDO10_STS_SHIFT 9 /* LDO10_STS */
182#define WM831X_LDO10_STS_WIDTH 1 /* LDO10_STS */
183#define WM831X_LDO9_STS 0x0100 /* LDO9_STS */
184#define WM831X_LDO9_STS_MASK 0x0100 /* LDO9_STS */
185#define WM831X_LDO9_STS_SHIFT 8 /* LDO9_STS */
186#define WM831X_LDO9_STS_WIDTH 1 /* LDO9_STS */
187#define WM831X_LDO8_STS 0x0080 /* LDO8_STS */
188#define WM831X_LDO8_STS_MASK 0x0080 /* LDO8_STS */
189#define WM831X_LDO8_STS_SHIFT 7 /* LDO8_STS */
190#define WM831X_LDO8_STS_WIDTH 1 /* LDO8_STS */
191#define WM831X_LDO7_STS 0x0040 /* LDO7_STS */
192#define WM831X_LDO7_STS_MASK 0x0040 /* LDO7_STS */
193#define WM831X_LDO7_STS_SHIFT 6 /* LDO7_STS */
194#define WM831X_LDO7_STS_WIDTH 1 /* LDO7_STS */
195#define WM831X_LDO6_STS 0x0020 /* LDO6_STS */
196#define WM831X_LDO6_STS_MASK 0x0020 /* LDO6_STS */
197#define WM831X_LDO6_STS_SHIFT 5 /* LDO6_STS */
198#define WM831X_LDO6_STS_WIDTH 1 /* LDO6_STS */
199#define WM831X_LDO5_STS 0x0010 /* LDO5_STS */
200#define WM831X_LDO5_STS_MASK 0x0010 /* LDO5_STS */
201#define WM831X_LDO5_STS_SHIFT 4 /* LDO5_STS */
202#define WM831X_LDO5_STS_WIDTH 1 /* LDO5_STS */
203#define WM831X_LDO4_STS 0x0008 /* LDO4_STS */
204#define WM831X_LDO4_STS_MASK 0x0008 /* LDO4_STS */
205#define WM831X_LDO4_STS_SHIFT 3 /* LDO4_STS */
206#define WM831X_LDO4_STS_WIDTH 1 /* LDO4_STS */
207#define WM831X_LDO3_STS 0x0004 /* LDO3_STS */
208#define WM831X_LDO3_STS_MASK 0x0004 /* LDO3_STS */
209#define WM831X_LDO3_STS_SHIFT 2 /* LDO3_STS */
210#define WM831X_LDO3_STS_WIDTH 1 /* LDO3_STS */
211#define WM831X_LDO2_STS 0x0002 /* LDO2_STS */
212#define WM831X_LDO2_STS_MASK 0x0002 /* LDO2_STS */
213#define WM831X_LDO2_STS_SHIFT 1 /* LDO2_STS */
214#define WM831X_LDO2_STS_WIDTH 1 /* LDO2_STS */
215#define WM831X_LDO1_STS 0x0001 /* LDO1_STS */
216#define WM831X_LDO1_STS_MASK 0x0001 /* LDO1_STS */
217#define WM831X_LDO1_STS_SHIFT 0 /* LDO1_STS */
218#define WM831X_LDO1_STS_WIDTH 1 /* LDO1_STS */
219
220/*
221 * R16468 (0x4054) - DCDC UV Status
222 */
223#define WM831X_DC2_OV_STS 0x2000 /* DC2_OV_STS */
224#define WM831X_DC2_OV_STS_MASK 0x2000 /* DC2_OV_STS */
225#define WM831X_DC2_OV_STS_SHIFT 13 /* DC2_OV_STS */
226#define WM831X_DC2_OV_STS_WIDTH 1 /* DC2_OV_STS */
227#define WM831X_DC1_OV_STS 0x1000 /* DC1_OV_STS */
228#define WM831X_DC1_OV_STS_MASK 0x1000 /* DC1_OV_STS */
229#define WM831X_DC1_OV_STS_SHIFT 12 /* DC1_OV_STS */
230#define WM831X_DC1_OV_STS_WIDTH 1 /* DC1_OV_STS */
231#define WM831X_DC2_HC_STS 0x0200 /* DC2_HC_STS */
232#define WM831X_DC2_HC_STS_MASK 0x0200 /* DC2_HC_STS */
233#define WM831X_DC2_HC_STS_SHIFT 9 /* DC2_HC_STS */
234#define WM831X_DC2_HC_STS_WIDTH 1 /* DC2_HC_STS */
235#define WM831X_DC1_HC_STS 0x0100 /* DC1_HC_STS */
236#define WM831X_DC1_HC_STS_MASK 0x0100 /* DC1_HC_STS */
237#define WM831X_DC1_HC_STS_SHIFT 8 /* DC1_HC_STS */
238#define WM831X_DC1_HC_STS_WIDTH 1 /* DC1_HC_STS */
239#define WM831X_DC4_UV_STS 0x0008 /* DC4_UV_STS */
240#define WM831X_DC4_UV_STS_MASK 0x0008 /* DC4_UV_STS */
241#define WM831X_DC4_UV_STS_SHIFT 3 /* DC4_UV_STS */
242#define WM831X_DC4_UV_STS_WIDTH 1 /* DC4_UV_STS */
243#define WM831X_DC3_UV_STS 0x0004 /* DC3_UV_STS */
244#define WM831X_DC3_UV_STS_MASK 0x0004 /* DC3_UV_STS */
245#define WM831X_DC3_UV_STS_SHIFT 2 /* DC3_UV_STS */
246#define WM831X_DC3_UV_STS_WIDTH 1 /* DC3_UV_STS */
247#define WM831X_DC2_UV_STS 0x0002 /* DC2_UV_STS */
248#define WM831X_DC2_UV_STS_MASK 0x0002 /* DC2_UV_STS */
249#define WM831X_DC2_UV_STS_SHIFT 1 /* DC2_UV_STS */
250#define WM831X_DC2_UV_STS_WIDTH 1 /* DC2_UV_STS */
251#define WM831X_DC1_UV_STS 0x0001 /* DC1_UV_STS */
252#define WM831X_DC1_UV_STS_MASK 0x0001 /* DC1_UV_STS */
253#define WM831X_DC1_UV_STS_SHIFT 0 /* DC1_UV_STS */
254#define WM831X_DC1_UV_STS_WIDTH 1 /* DC1_UV_STS */
255
256/*
257 * R16469 (0x4055) - LDO UV Status
258 */
259#define WM831X_INTLDO_UV_STS 0x8000 /* INTLDO_UV_STS */
260#define WM831X_INTLDO_UV_STS_MASK 0x8000 /* INTLDO_UV_STS */
261#define WM831X_INTLDO_UV_STS_SHIFT 15 /* INTLDO_UV_STS */
262#define WM831X_INTLDO_UV_STS_WIDTH 1 /* INTLDO_UV_STS */
263#define WM831X_LDO10_UV_STS 0x0200 /* LDO10_UV_STS */
264#define WM831X_LDO10_UV_STS_MASK 0x0200 /* LDO10_UV_STS */
265#define WM831X_LDO10_UV_STS_SHIFT 9 /* LDO10_UV_STS */
266#define WM831X_LDO10_UV_STS_WIDTH 1 /* LDO10_UV_STS */
267#define WM831X_LDO9_UV_STS 0x0100 /* LDO9_UV_STS */
268#define WM831X_LDO9_UV_STS_MASK 0x0100 /* LDO9_UV_STS */
269#define WM831X_LDO9_UV_STS_SHIFT 8 /* LDO9_UV_STS */
270#define WM831X_LDO9_UV_STS_WIDTH 1 /* LDO9_UV_STS */
271#define WM831X_LDO8_UV_STS 0x0080 /* LDO8_UV_STS */
272#define WM831X_LDO8_UV_STS_MASK 0x0080 /* LDO8_UV_STS */
273#define WM831X_LDO8_UV_STS_SHIFT 7 /* LDO8_UV_STS */
274#define WM831X_LDO8_UV_STS_WIDTH 1 /* LDO8_UV_STS */
275#define WM831X_LDO7_UV_STS 0x0040 /* LDO7_UV_STS */
276#define WM831X_LDO7_UV_STS_MASK 0x0040 /* LDO7_UV_STS */
277#define WM831X_LDO7_UV_STS_SHIFT 6 /* LDO7_UV_STS */
278#define WM831X_LDO7_UV_STS_WIDTH 1 /* LDO7_UV_STS */
279#define WM831X_LDO6_UV_STS 0x0020 /* LDO6_UV_STS */
280#define WM831X_LDO6_UV_STS_MASK 0x0020 /* LDO6_UV_STS */
281#define WM831X_LDO6_UV_STS_SHIFT 5 /* LDO6_UV_STS */
282#define WM831X_LDO6_UV_STS_WIDTH 1 /* LDO6_UV_STS */
283#define WM831X_LDO5_UV_STS 0x0010 /* LDO5_UV_STS */
284#define WM831X_LDO5_UV_STS_MASK 0x0010 /* LDO5_UV_STS */
285#define WM831X_LDO5_UV_STS_SHIFT 4 /* LDO5_UV_STS */
286#define WM831X_LDO5_UV_STS_WIDTH 1 /* LDO5_UV_STS */
287#define WM831X_LDO4_UV_STS 0x0008 /* LDO4_UV_STS */
288#define WM831X_LDO4_UV_STS_MASK 0x0008 /* LDO4_UV_STS */
289#define WM831X_LDO4_UV_STS_SHIFT 3 /* LDO4_UV_STS */
290#define WM831X_LDO4_UV_STS_WIDTH 1 /* LDO4_UV_STS */
291#define WM831X_LDO3_UV_STS 0x0004 /* LDO3_UV_STS */
292#define WM831X_LDO3_UV_STS_MASK 0x0004 /* LDO3_UV_STS */
293#define WM831X_LDO3_UV_STS_SHIFT 2 /* LDO3_UV_STS */
294#define WM831X_LDO3_UV_STS_WIDTH 1 /* LDO3_UV_STS */
295#define WM831X_LDO2_UV_STS 0x0002 /* LDO2_UV_STS */
296#define WM831X_LDO2_UV_STS_MASK 0x0002 /* LDO2_UV_STS */
297#define WM831X_LDO2_UV_STS_SHIFT 1 /* LDO2_UV_STS */
298#define WM831X_LDO2_UV_STS_WIDTH 1 /* LDO2_UV_STS */
299#define WM831X_LDO1_UV_STS 0x0001 /* LDO1_UV_STS */
300#define WM831X_LDO1_UV_STS_MASK 0x0001 /* LDO1_UV_STS */
301#define WM831X_LDO1_UV_STS_SHIFT 0 /* LDO1_UV_STS */
302#define WM831X_LDO1_UV_STS_WIDTH 1 /* LDO1_UV_STS */
303
304/*
305 * R16470 (0x4056) - DC1 Control 1
306 */
307#define WM831X_DC1_RATE_MASK 0xC000 /* DC1_RATE - [15:14] */
308#define WM831X_DC1_RATE_SHIFT 14 /* DC1_RATE - [15:14] */
309#define WM831X_DC1_RATE_WIDTH 2 /* DC1_RATE - [15:14] */
310#define WM831X_DC1_PHASE 0x1000 /* DC1_PHASE */
311#define WM831X_DC1_PHASE_MASK 0x1000 /* DC1_PHASE */
312#define WM831X_DC1_PHASE_SHIFT 12 /* DC1_PHASE */
313#define WM831X_DC1_PHASE_WIDTH 1 /* DC1_PHASE */
314#define WM831X_DC1_FREQ_MASK 0x0300 /* DC1_FREQ - [9:8] */
315#define WM831X_DC1_FREQ_SHIFT 8 /* DC1_FREQ - [9:8] */
316#define WM831X_DC1_FREQ_WIDTH 2 /* DC1_FREQ - [9:8] */
317#define WM831X_DC1_FLT 0x0080 /* DC1_FLT */
318#define WM831X_DC1_FLT_MASK 0x0080 /* DC1_FLT */
319#define WM831X_DC1_FLT_SHIFT 7 /* DC1_FLT */
320#define WM831X_DC1_FLT_WIDTH 1 /* DC1_FLT */
321#define WM831X_DC1_SOFT_START_MASK 0x0030 /* DC1_SOFT_START - [5:4] */
322#define WM831X_DC1_SOFT_START_SHIFT 4 /* DC1_SOFT_START - [5:4] */
323#define WM831X_DC1_SOFT_START_WIDTH 2 /* DC1_SOFT_START - [5:4] */
324#define WM831X_DC1_CAP_MASK 0x0003 /* DC1_CAP - [1:0] */
325#define WM831X_DC1_CAP_SHIFT 0 /* DC1_CAP - [1:0] */
326#define WM831X_DC1_CAP_WIDTH 2 /* DC1_CAP - [1:0] */
327
328/*
329 * R16471 (0x4057) - DC1 Control 2
330 */
331#define WM831X_DC1_ERR_ACT_MASK 0xC000 /* DC1_ERR_ACT - [15:14] */
332#define WM831X_DC1_ERR_ACT_SHIFT 14 /* DC1_ERR_ACT - [15:14] */
333#define WM831X_DC1_ERR_ACT_WIDTH 2 /* DC1_ERR_ACT - [15:14] */
334#define WM831X_DC1_HWC_SRC_MASK 0x1800 /* DC1_HWC_SRC - [12:11] */
335#define WM831X_DC1_HWC_SRC_SHIFT 11 /* DC1_HWC_SRC - [12:11] */
336#define WM831X_DC1_HWC_SRC_WIDTH 2 /* DC1_HWC_SRC - [12:11] */
337#define WM831X_DC1_HWC_VSEL 0x0400 /* DC1_HWC_VSEL */
338#define WM831X_DC1_HWC_VSEL_MASK 0x0400 /* DC1_HWC_VSEL */
339#define WM831X_DC1_HWC_VSEL_SHIFT 10 /* DC1_HWC_VSEL */
340#define WM831X_DC1_HWC_VSEL_WIDTH 1 /* DC1_HWC_VSEL */
341#define WM831X_DC1_HWC_MODE_MASK 0x0300 /* DC1_HWC_MODE - [9:8] */
342#define WM831X_DC1_HWC_MODE_SHIFT 8 /* DC1_HWC_MODE - [9:8] */
343#define WM831X_DC1_HWC_MODE_WIDTH 2 /* DC1_HWC_MODE - [9:8] */
344#define WM831X_DC1_HC_THR_MASK 0x0070 /* DC1_HC_THR - [6:4] */
345#define WM831X_DC1_HC_THR_SHIFT 4 /* DC1_HC_THR - [6:4] */
346#define WM831X_DC1_HC_THR_WIDTH 3 /* DC1_HC_THR - [6:4] */
347#define WM831X_DC1_HC_IND_ENA 0x0001 /* DC1_HC_IND_ENA */
348#define WM831X_DC1_HC_IND_ENA_MASK 0x0001 /* DC1_HC_IND_ENA */
349#define WM831X_DC1_HC_IND_ENA_SHIFT 0 /* DC1_HC_IND_ENA */
350#define WM831X_DC1_HC_IND_ENA_WIDTH 1 /* DC1_HC_IND_ENA */
351
352/*
353 * R16472 (0x4058) - DC1 ON Config
354 */
355#define WM831X_DC1_ON_SLOT_MASK 0xE000 /* DC1_ON_SLOT - [15:13] */
356#define WM831X_DC1_ON_SLOT_SHIFT 13 /* DC1_ON_SLOT - [15:13] */
357#define WM831X_DC1_ON_SLOT_WIDTH 3 /* DC1_ON_SLOT - [15:13] */
358#define WM831X_DC1_ON_MODE_MASK 0x0300 /* DC1_ON_MODE - [9:8] */
359#define WM831X_DC1_ON_MODE_SHIFT 8 /* DC1_ON_MODE - [9:8] */
360#define WM831X_DC1_ON_MODE_WIDTH 2 /* DC1_ON_MODE - [9:8] */
361#define WM831X_DC1_ON_VSEL_MASK 0x007F /* DC1_ON_VSEL - [6:0] */
362#define WM831X_DC1_ON_VSEL_SHIFT 0 /* DC1_ON_VSEL - [6:0] */
363#define WM831X_DC1_ON_VSEL_WIDTH 7 /* DC1_ON_VSEL - [6:0] */
364
365/*
366 * R16473 (0x4059) - DC1 SLEEP Control
367 */
368#define WM831X_DC1_SLP_SLOT_MASK 0xE000 /* DC1_SLP_SLOT - [15:13] */
369#define WM831X_DC1_SLP_SLOT_SHIFT 13 /* DC1_SLP_SLOT - [15:13] */
370#define WM831X_DC1_SLP_SLOT_WIDTH 3 /* DC1_SLP_SLOT - [15:13] */
371#define WM831X_DC1_SLP_MODE_MASK 0x0300 /* DC1_SLP_MODE - [9:8] */
372#define WM831X_DC1_SLP_MODE_SHIFT 8 /* DC1_SLP_MODE - [9:8] */
373#define WM831X_DC1_SLP_MODE_WIDTH 2 /* DC1_SLP_MODE - [9:8] */
374#define WM831X_DC1_SLP_VSEL_MASK 0x007F /* DC1_SLP_VSEL - [6:0] */
375#define WM831X_DC1_SLP_VSEL_SHIFT 0 /* DC1_SLP_VSEL - [6:0] */
376#define WM831X_DC1_SLP_VSEL_WIDTH 7 /* DC1_SLP_VSEL - [6:0] */
377
378/*
379 * R16474 (0x405A) - DC1 DVS Control
380 */
381#define WM831X_DC1_DVS_SRC_MASK 0x1800 /* DC1_DVS_SRC - [12:11] */
382#define WM831X_DC1_DVS_SRC_SHIFT 11 /* DC1_DVS_SRC - [12:11] */
383#define WM831X_DC1_DVS_SRC_WIDTH 2 /* DC1_DVS_SRC - [12:11] */
384#define WM831X_DC1_DVS_VSEL_MASK 0x007F /* DC1_DVS_VSEL - [6:0] */
385#define WM831X_DC1_DVS_VSEL_SHIFT 0 /* DC1_DVS_VSEL - [6:0] */
386#define WM831X_DC1_DVS_VSEL_WIDTH 7 /* DC1_DVS_VSEL - [6:0] */
387
388/*
389 * R16475 (0x405B) - DC2 Control 1
390 */
391#define WM831X_DC2_RATE_MASK 0xC000 /* DC2_RATE - [15:14] */
392#define WM831X_DC2_RATE_SHIFT 14 /* DC2_RATE - [15:14] */
393#define WM831X_DC2_RATE_WIDTH 2 /* DC2_RATE - [15:14] */
394#define WM831X_DC2_PHASE 0x1000 /* DC2_PHASE */
395#define WM831X_DC2_PHASE_MASK 0x1000 /* DC2_PHASE */
396#define WM831X_DC2_PHASE_SHIFT 12 /* DC2_PHASE */
397#define WM831X_DC2_PHASE_WIDTH 1 /* DC2_PHASE */
398#define WM831X_DC2_FREQ_MASK 0x0300 /* DC2_FREQ - [9:8] */
399#define WM831X_DC2_FREQ_SHIFT 8 /* DC2_FREQ - [9:8] */
400#define WM831X_DC2_FREQ_WIDTH 2 /* DC2_FREQ - [9:8] */
401#define WM831X_DC2_FLT 0x0080 /* DC2_FLT */
402#define WM831X_DC2_FLT_MASK 0x0080 /* DC2_FLT */
403#define WM831X_DC2_FLT_SHIFT 7 /* DC2_FLT */
404#define WM831X_DC2_FLT_WIDTH 1 /* DC2_FLT */
405#define WM831X_DC2_SOFT_START_MASK 0x0030 /* DC2_SOFT_START - [5:4] */
406#define WM831X_DC2_SOFT_START_SHIFT 4 /* DC2_SOFT_START - [5:4] */
407#define WM831X_DC2_SOFT_START_WIDTH 2 /* DC2_SOFT_START - [5:4] */
408#define WM831X_DC2_CAP_MASK 0x0003 /* DC2_CAP - [1:0] */
409#define WM831X_DC2_CAP_SHIFT 0 /* DC2_CAP - [1:0] */
410#define WM831X_DC2_CAP_WIDTH 2 /* DC2_CAP - [1:0] */
411
412/*
413 * R16476 (0x405C) - DC2 Control 2
414 */
415#define WM831X_DC2_ERR_ACT_MASK 0xC000 /* DC2_ERR_ACT - [15:14] */
416#define WM831X_DC2_ERR_ACT_SHIFT 14 /* DC2_ERR_ACT - [15:14] */
417#define WM831X_DC2_ERR_ACT_WIDTH 2 /* DC2_ERR_ACT - [15:14] */
418#define WM831X_DC2_HWC_SRC_MASK 0x1800 /* DC2_HWC_SRC - [12:11] */
419#define WM831X_DC2_HWC_SRC_SHIFT 11 /* DC2_HWC_SRC - [12:11] */
420#define WM831X_DC2_HWC_SRC_WIDTH 2 /* DC2_HWC_SRC - [12:11] */
421#define WM831X_DC2_HWC_VSEL 0x0400 /* DC2_HWC_VSEL */
422#define WM831X_DC2_HWC_VSEL_MASK 0x0400 /* DC2_HWC_VSEL */
423#define WM831X_DC2_HWC_VSEL_SHIFT 10 /* DC2_HWC_VSEL */
424#define WM831X_DC2_HWC_VSEL_WIDTH 1 /* DC2_HWC_VSEL */
425#define WM831X_DC2_HWC_MODE_MASK 0x0300 /* DC2_HWC_MODE - [9:8] */
426#define WM831X_DC2_HWC_MODE_SHIFT 8 /* DC2_HWC_MODE - [9:8] */
427#define WM831X_DC2_HWC_MODE_WIDTH 2 /* DC2_HWC_MODE - [9:8] */
428#define WM831X_DC2_HC_THR_MASK 0x0070 /* DC2_HC_THR - [6:4] */
429#define WM831X_DC2_HC_THR_SHIFT 4 /* DC2_HC_THR - [6:4] */
430#define WM831X_DC2_HC_THR_WIDTH 3 /* DC2_HC_THR - [6:4] */
431#define WM831X_DC2_HC_IND_ENA 0x0001 /* DC2_HC_IND_ENA */
432#define WM831X_DC2_HC_IND_ENA_MASK 0x0001 /* DC2_HC_IND_ENA */
433#define WM831X_DC2_HC_IND_ENA_SHIFT 0 /* DC2_HC_IND_ENA */
434#define WM831X_DC2_HC_IND_ENA_WIDTH 1 /* DC2_HC_IND_ENA */
435
436/*
437 * R16477 (0x405D) - DC2 ON Config
438 */
439#define WM831X_DC2_ON_SLOT_MASK 0xE000 /* DC2_ON_SLOT - [15:13] */
440#define WM831X_DC2_ON_SLOT_SHIFT 13 /* DC2_ON_SLOT - [15:13] */
441#define WM831X_DC2_ON_SLOT_WIDTH 3 /* DC2_ON_SLOT - [15:13] */
442#define WM831X_DC2_ON_MODE_MASK 0x0300 /* DC2_ON_MODE - [9:8] */
443#define WM831X_DC2_ON_MODE_SHIFT 8 /* DC2_ON_MODE - [9:8] */
444#define WM831X_DC2_ON_MODE_WIDTH 2 /* DC2_ON_MODE - [9:8] */
445#define WM831X_DC2_ON_VSEL_MASK 0x007F /* DC2_ON_VSEL - [6:0] */
446#define WM831X_DC2_ON_VSEL_SHIFT 0 /* DC2_ON_VSEL - [6:0] */
447#define WM831X_DC2_ON_VSEL_WIDTH 7 /* DC2_ON_VSEL - [6:0] */
448
449/*
450 * R16478 (0x405E) - DC2 SLEEP Control
451 */
452#define WM831X_DC2_SLP_SLOT_MASK 0xE000 /* DC2_SLP_SLOT - [15:13] */
453#define WM831X_DC2_SLP_SLOT_SHIFT 13 /* DC2_SLP_SLOT - [15:13] */
454#define WM831X_DC2_SLP_SLOT_WIDTH 3 /* DC2_SLP_SLOT - [15:13] */
455#define WM831X_DC2_SLP_MODE_MASK 0x0300 /* DC2_SLP_MODE - [9:8] */
456#define WM831X_DC2_SLP_MODE_SHIFT 8 /* DC2_SLP_MODE - [9:8] */
457#define WM831X_DC2_SLP_MODE_WIDTH 2 /* DC2_SLP_MODE - [9:8] */
458#define WM831X_DC2_SLP_VSEL_MASK 0x007F /* DC2_SLP_VSEL - [6:0] */
459#define WM831X_DC2_SLP_VSEL_SHIFT 0 /* DC2_SLP_VSEL - [6:0] */
460#define WM831X_DC2_SLP_VSEL_WIDTH 7 /* DC2_SLP_VSEL - [6:0] */
461
462/*
463 * R16479 (0x405F) - DC2 DVS Control
464 */
465#define WM831X_DC2_DVS_SRC_MASK 0x1800 /* DC2_DVS_SRC - [12:11] */
466#define WM831X_DC2_DVS_SRC_SHIFT 11 /* DC2_DVS_SRC - [12:11] */
467#define WM831X_DC2_DVS_SRC_WIDTH 2 /* DC2_DVS_SRC - [12:11] */
468#define WM831X_DC2_DVS_VSEL_MASK 0x007F /* DC2_DVS_VSEL - [6:0] */
469#define WM831X_DC2_DVS_VSEL_SHIFT 0 /* DC2_DVS_VSEL - [6:0] */
470#define WM831X_DC2_DVS_VSEL_WIDTH 7 /* DC2_DVS_VSEL - [6:0] */
471
472/*
473 * R16480 (0x4060) - DC3 Control 1
474 */
475#define WM831X_DC3_PHASE 0x1000 /* DC3_PHASE */
476#define WM831X_DC3_PHASE_MASK 0x1000 /* DC3_PHASE */
477#define WM831X_DC3_PHASE_SHIFT 12 /* DC3_PHASE */
478#define WM831X_DC3_PHASE_WIDTH 1 /* DC3_PHASE */
479#define WM831X_DC3_FLT 0x0080 /* DC3_FLT */
480#define WM831X_DC3_FLT_MASK 0x0080 /* DC3_FLT */
481#define WM831X_DC3_FLT_SHIFT 7 /* DC3_FLT */
482#define WM831X_DC3_FLT_WIDTH 1 /* DC3_FLT */
483#define WM831X_DC3_SOFT_START_MASK 0x0030 /* DC3_SOFT_START - [5:4] */
484#define WM831X_DC3_SOFT_START_SHIFT 4 /* DC3_SOFT_START - [5:4] */
485#define WM831X_DC3_SOFT_START_WIDTH 2 /* DC3_SOFT_START - [5:4] */
486#define WM831X_DC3_STNBY_LIM_MASK 0x000C /* DC3_STNBY_LIM - [3:2] */
487#define WM831X_DC3_STNBY_LIM_SHIFT 2 /* DC3_STNBY_LIM - [3:2] */
488#define WM831X_DC3_STNBY_LIM_WIDTH 2 /* DC3_STNBY_LIM - [3:2] */
489#define WM831X_DC3_CAP_MASK 0x0003 /* DC3_CAP - [1:0] */
490#define WM831X_DC3_CAP_SHIFT 0 /* DC3_CAP - [1:0] */
491#define WM831X_DC3_CAP_WIDTH 2 /* DC3_CAP - [1:0] */
492
493/*
494 * R16481 (0x4061) - DC3 Control 2
495 */
496#define WM831X_DC3_ERR_ACT_MASK 0xC000 /* DC3_ERR_ACT - [15:14] */
497#define WM831X_DC3_ERR_ACT_SHIFT 14 /* DC3_ERR_ACT - [15:14] */
498#define WM831X_DC3_ERR_ACT_WIDTH 2 /* DC3_ERR_ACT - [15:14] */
499#define WM831X_DC3_HWC_SRC_MASK 0x1800 /* DC3_HWC_SRC - [12:11] */
500#define WM831X_DC3_HWC_SRC_SHIFT 11 /* DC3_HWC_SRC - [12:11] */
501#define WM831X_DC3_HWC_SRC_WIDTH 2 /* DC3_HWC_SRC - [12:11] */
502#define WM831X_DC3_HWC_VSEL 0x0400 /* DC3_HWC_VSEL */
503#define WM831X_DC3_HWC_VSEL_MASK 0x0400 /* DC3_HWC_VSEL */
504#define WM831X_DC3_HWC_VSEL_SHIFT 10 /* DC3_HWC_VSEL */
505#define WM831X_DC3_HWC_VSEL_WIDTH 1 /* DC3_HWC_VSEL */
506#define WM831X_DC3_HWC_MODE_MASK 0x0300 /* DC3_HWC_MODE - [9:8] */
507#define WM831X_DC3_HWC_MODE_SHIFT 8 /* DC3_HWC_MODE - [9:8] */
508#define WM831X_DC3_HWC_MODE_WIDTH 2 /* DC3_HWC_MODE - [9:8] */
509#define WM831X_DC3_OVP 0x0080 /* DC3_OVP */
510#define WM831X_DC3_OVP_MASK 0x0080 /* DC3_OVP */
511#define WM831X_DC3_OVP_SHIFT 7 /* DC3_OVP */
512#define WM831X_DC3_OVP_WIDTH 1 /* DC3_OVP */
513
514/*
515 * R16482 (0x4062) - DC3 ON Config
516 */
517#define WM831X_DC3_ON_SLOT_MASK 0xE000 /* DC3_ON_SLOT - [15:13] */
518#define WM831X_DC3_ON_SLOT_SHIFT 13 /* DC3_ON_SLOT - [15:13] */
519#define WM831X_DC3_ON_SLOT_WIDTH 3 /* DC3_ON_SLOT - [15:13] */
520#define WM831X_DC3_ON_MODE_MASK 0x0300 /* DC3_ON_MODE - [9:8] */
521#define WM831X_DC3_ON_MODE_SHIFT 8 /* DC3_ON_MODE - [9:8] */
522#define WM831X_DC3_ON_MODE_WIDTH 2 /* DC3_ON_MODE - [9:8] */
523#define WM831X_DC3_ON_VSEL_MASK 0x007F /* DC3_ON_VSEL - [6:0] */
524#define WM831X_DC3_ON_VSEL_SHIFT 0 /* DC3_ON_VSEL - [6:0] */
525#define WM831X_DC3_ON_VSEL_WIDTH 7 /* DC3_ON_VSEL - [6:0] */
526
527/*
528 * R16483 (0x4063) - DC3 SLEEP Control
529 */
530#define WM831X_DC3_SLP_SLOT_MASK 0xE000 /* DC3_SLP_SLOT - [15:13] */
531#define WM831X_DC3_SLP_SLOT_SHIFT 13 /* DC3_SLP_SLOT - [15:13] */
532#define WM831X_DC3_SLP_SLOT_WIDTH 3 /* DC3_SLP_SLOT - [15:13] */
533#define WM831X_DC3_SLP_MODE_MASK 0x0300 /* DC3_SLP_MODE - [9:8] */
534#define WM831X_DC3_SLP_MODE_SHIFT 8 /* DC3_SLP_MODE - [9:8] */
535#define WM831X_DC3_SLP_MODE_WIDTH 2 /* DC3_SLP_MODE - [9:8] */
536#define WM831X_DC3_SLP_VSEL_MASK 0x007F /* DC3_SLP_VSEL - [6:0] */
537#define WM831X_DC3_SLP_VSEL_SHIFT 0 /* DC3_SLP_VSEL - [6:0] */
538#define WM831X_DC3_SLP_VSEL_WIDTH 7 /* DC3_SLP_VSEL - [6:0] */
539
540/*
541 * R16484 (0x4064) - DC4 Control
542 */
543#define WM831X_DC4_ERR_ACT_MASK 0xC000 /* DC4_ERR_ACT - [15:14] */
544#define WM831X_DC4_ERR_ACT_SHIFT 14 /* DC4_ERR_ACT - [15:14] */
545#define WM831X_DC4_ERR_ACT_WIDTH 2 /* DC4_ERR_ACT - [15:14] */
546#define WM831X_DC4_HWC_SRC_MASK 0x1800 /* DC4_HWC_SRC - [12:11] */
547#define WM831X_DC4_HWC_SRC_SHIFT 11 /* DC4_HWC_SRC - [12:11] */
548#define WM831X_DC4_HWC_SRC_WIDTH 2 /* DC4_HWC_SRC - [12:11] */
549#define WM831X_DC4_HWC_MODE 0x0100 /* DC4_HWC_MODE */
550#define WM831X_DC4_HWC_MODE_MASK 0x0100 /* DC4_HWC_MODE */
551#define WM831X_DC4_HWC_MODE_SHIFT 8 /* DC4_HWC_MODE */
552#define WM831X_DC4_HWC_MODE_WIDTH 1 /* DC4_HWC_MODE */
553#define WM831X_DC4_RANGE_MASK 0x000C /* DC4_RANGE - [3:2] */
554#define WM831X_DC4_RANGE_SHIFT 2 /* DC4_RANGE - [3:2] */
555#define WM831X_DC4_RANGE_WIDTH 2 /* DC4_RANGE - [3:2] */
556#define WM831X_DC4_FBSRC 0x0001 /* DC4_FBSRC */
557#define WM831X_DC4_FBSRC_MASK 0x0001 /* DC4_FBSRC */
558#define WM831X_DC4_FBSRC_SHIFT 0 /* DC4_FBSRC */
559#define WM831X_DC4_FBSRC_WIDTH 1 /* DC4_FBSRC */
560
561/*
562 * R16485 (0x4065) - DC4 SLEEP Control
563 */
564#define WM831X_DC4_SLPENA 0x0100 /* DC4_SLPENA */
565#define WM831X_DC4_SLPENA_MASK 0x0100 /* DC4_SLPENA */
566#define WM831X_DC4_SLPENA_SHIFT 8 /* DC4_SLPENA */
567#define WM831X_DC4_SLPENA_WIDTH 1 /* DC4_SLPENA */
568
569/*
570 * R16488 (0x4068) - LDO1 Control
571 */
572#define WM831X_LDO1_ERR_ACT_MASK 0xC000 /* LDO1_ERR_ACT - [15:14] */
573#define WM831X_LDO1_ERR_ACT_SHIFT 14 /* LDO1_ERR_ACT - [15:14] */
574#define WM831X_LDO1_ERR_ACT_WIDTH 2 /* LDO1_ERR_ACT - [15:14] */
575#define WM831X_LDO1_HWC_SRC_MASK 0x1800 /* LDO1_HWC_SRC - [12:11] */
576#define WM831X_LDO1_HWC_SRC_SHIFT 11 /* LDO1_HWC_SRC - [12:11] */
577#define WM831X_LDO1_HWC_SRC_WIDTH 2 /* LDO1_HWC_SRC - [12:11] */
578#define WM831X_LDO1_HWC_VSEL 0x0400 /* LDO1_HWC_VSEL */
579#define WM831X_LDO1_HWC_VSEL_MASK 0x0400 /* LDO1_HWC_VSEL */
580#define WM831X_LDO1_HWC_VSEL_SHIFT 10 /* LDO1_HWC_VSEL */
581#define WM831X_LDO1_HWC_VSEL_WIDTH 1 /* LDO1_HWC_VSEL */
582#define WM831X_LDO1_HWC_MODE_MASK 0x0300 /* LDO1_HWC_MODE - [9:8] */
583#define WM831X_LDO1_HWC_MODE_SHIFT 8 /* LDO1_HWC_MODE - [9:8] */
584#define WM831X_LDO1_HWC_MODE_WIDTH 2 /* LDO1_HWC_MODE - [9:8] */
585#define WM831X_LDO1_FLT 0x0080 /* LDO1_FLT */
586#define WM831X_LDO1_FLT_MASK 0x0080 /* LDO1_FLT */
587#define WM831X_LDO1_FLT_SHIFT 7 /* LDO1_FLT */
588#define WM831X_LDO1_FLT_WIDTH 1 /* LDO1_FLT */
589#define WM831X_LDO1_SWI 0x0040 /* LDO1_SWI */
590#define WM831X_LDO1_SWI_MASK 0x0040 /* LDO1_SWI */
591#define WM831X_LDO1_SWI_SHIFT 6 /* LDO1_SWI */
592#define WM831X_LDO1_SWI_WIDTH 1 /* LDO1_SWI */
593#define WM831X_LDO1_LP_MODE 0x0001 /* LDO1_LP_MODE */
594#define WM831X_LDO1_LP_MODE_MASK 0x0001 /* LDO1_LP_MODE */
595#define WM831X_LDO1_LP_MODE_SHIFT 0 /* LDO1_LP_MODE */
596#define WM831X_LDO1_LP_MODE_WIDTH 1 /* LDO1_LP_MODE */
597
598/*
599 * R16489 (0x4069) - LDO1 ON Control
600 */
601#define WM831X_LDO1_ON_SLOT_MASK 0xE000 /* LDO1_ON_SLOT - [15:13] */
602#define WM831X_LDO1_ON_SLOT_SHIFT 13 /* LDO1_ON_SLOT - [15:13] */
603#define WM831X_LDO1_ON_SLOT_WIDTH 3 /* LDO1_ON_SLOT - [15:13] */
604#define WM831X_LDO1_ON_MODE 0x0100 /* LDO1_ON_MODE */
605#define WM831X_LDO1_ON_MODE_MASK 0x0100 /* LDO1_ON_MODE */
606#define WM831X_LDO1_ON_MODE_SHIFT 8 /* LDO1_ON_MODE */
607#define WM831X_LDO1_ON_MODE_WIDTH 1 /* LDO1_ON_MODE */
608#define WM831X_LDO1_ON_VSEL_MASK 0x001F /* LDO1_ON_VSEL - [4:0] */
609#define WM831X_LDO1_ON_VSEL_SHIFT 0 /* LDO1_ON_VSEL - [4:0] */
610#define WM831X_LDO1_ON_VSEL_WIDTH 5 /* LDO1_ON_VSEL - [4:0] */
611
612/*
613 * R16490 (0x406A) - LDO1 SLEEP Control
614 */
615#define WM831X_LDO1_SLP_SLOT_MASK 0xE000 /* LDO1_SLP_SLOT - [15:13] */
616#define WM831X_LDO1_SLP_SLOT_SHIFT 13 /* LDO1_SLP_SLOT - [15:13] */
617#define WM831X_LDO1_SLP_SLOT_WIDTH 3 /* LDO1_SLP_SLOT - [15:13] */
618#define WM831X_LDO1_SLP_MODE 0x0100 /* LDO1_SLP_MODE */
619#define WM831X_LDO1_SLP_MODE_MASK 0x0100 /* LDO1_SLP_MODE */
620#define WM831X_LDO1_SLP_MODE_SHIFT 8 /* LDO1_SLP_MODE */
621#define WM831X_LDO1_SLP_MODE_WIDTH 1 /* LDO1_SLP_MODE */
622#define WM831X_LDO1_SLP_VSEL_MASK 0x001F /* LDO1_SLP_VSEL - [4:0] */
623#define WM831X_LDO1_SLP_VSEL_SHIFT 0 /* LDO1_SLP_VSEL - [4:0] */
624#define WM831X_LDO1_SLP_VSEL_WIDTH 5 /* LDO1_SLP_VSEL - [4:0] */
625
626/*
627 * R16491 (0x406B) - LDO2 Control
628 */
629#define WM831X_LDO2_ERR_ACT_MASK 0xC000 /* LDO2_ERR_ACT - [15:14] */
630#define WM831X_LDO2_ERR_ACT_SHIFT 14 /* LDO2_ERR_ACT - [15:14] */
631#define WM831X_LDO2_ERR_ACT_WIDTH 2 /* LDO2_ERR_ACT - [15:14] */
632#define WM831X_LDO2_HWC_SRC_MASK 0x1800 /* LDO2_HWC_SRC - [12:11] */
633#define WM831X_LDO2_HWC_SRC_SHIFT 11 /* LDO2_HWC_SRC - [12:11] */
634#define WM831X_LDO2_HWC_SRC_WIDTH 2 /* LDO2_HWC_SRC - [12:11] */
635#define WM831X_LDO2_HWC_VSEL 0x0400 /* LDO2_HWC_VSEL */
636#define WM831X_LDO2_HWC_VSEL_MASK 0x0400 /* LDO2_HWC_VSEL */
637#define WM831X_LDO2_HWC_VSEL_SHIFT 10 /* LDO2_HWC_VSEL */
638#define WM831X_LDO2_HWC_VSEL_WIDTH 1 /* LDO2_HWC_VSEL */
639#define WM831X_LDO2_HWC_MODE_MASK 0x0300 /* LDO2_HWC_MODE - [9:8] */
640#define WM831X_LDO2_HWC_MODE_SHIFT 8 /* LDO2_HWC_MODE - [9:8] */
641#define WM831X_LDO2_HWC_MODE_WIDTH 2 /* LDO2_HWC_MODE - [9:8] */
642#define WM831X_LDO2_FLT 0x0080 /* LDO2_FLT */
643#define WM831X_LDO2_FLT_MASK 0x0080 /* LDO2_FLT */
644#define WM831X_LDO2_FLT_SHIFT 7 /* LDO2_FLT */
645#define WM831X_LDO2_FLT_WIDTH 1 /* LDO2_FLT */
646#define WM831X_LDO2_SWI 0x0040 /* LDO2_SWI */
647#define WM831X_LDO2_SWI_MASK 0x0040 /* LDO2_SWI */
648#define WM831X_LDO2_SWI_SHIFT 6 /* LDO2_SWI */
649#define WM831X_LDO2_SWI_WIDTH 1 /* LDO2_SWI */
650#define WM831X_LDO2_LP_MODE 0x0001 /* LDO2_LP_MODE */
651#define WM831X_LDO2_LP_MODE_MASK 0x0001 /* LDO2_LP_MODE */
652#define WM831X_LDO2_LP_MODE_SHIFT 0 /* LDO2_LP_MODE */
653#define WM831X_LDO2_LP_MODE_WIDTH 1 /* LDO2_LP_MODE */
654
655/*
656 * R16492 (0x406C) - LDO2 ON Control
657 */
658#define WM831X_LDO2_ON_SLOT_MASK 0xE000 /* LDO2_ON_SLOT - [15:13] */
659#define WM831X_LDO2_ON_SLOT_SHIFT 13 /* LDO2_ON_SLOT - [15:13] */
660#define WM831X_LDO2_ON_SLOT_WIDTH 3 /* LDO2_ON_SLOT - [15:13] */
661#define WM831X_LDO2_ON_MODE 0x0100 /* LDO2_ON_MODE */
662#define WM831X_LDO2_ON_MODE_MASK 0x0100 /* LDO2_ON_MODE */
663#define WM831X_LDO2_ON_MODE_SHIFT 8 /* LDO2_ON_MODE */
664#define WM831X_LDO2_ON_MODE_WIDTH 1 /* LDO2_ON_MODE */
665#define WM831X_LDO2_ON_VSEL_MASK 0x001F /* LDO2_ON_VSEL - [4:0] */
666#define WM831X_LDO2_ON_VSEL_SHIFT 0 /* LDO2_ON_VSEL - [4:0] */
667#define WM831X_LDO2_ON_VSEL_WIDTH 5 /* LDO2_ON_VSEL - [4:0] */
668
669/*
670 * R16493 (0x406D) - LDO2 SLEEP Control
671 */
672#define WM831X_LDO2_SLP_SLOT_MASK 0xE000 /* LDO2_SLP_SLOT - [15:13] */
673#define WM831X_LDO2_SLP_SLOT_SHIFT 13 /* LDO2_SLP_SLOT - [15:13] */
674#define WM831X_LDO2_SLP_SLOT_WIDTH 3 /* LDO2_SLP_SLOT - [15:13] */
675#define WM831X_LDO2_SLP_MODE 0x0100 /* LDO2_SLP_MODE */
676#define WM831X_LDO2_SLP_MODE_MASK 0x0100 /* LDO2_SLP_MODE */
677#define WM831X_LDO2_SLP_MODE_SHIFT 8 /* LDO2_SLP_MODE */
678#define WM831X_LDO2_SLP_MODE_WIDTH 1 /* LDO2_SLP_MODE */
679#define WM831X_LDO2_SLP_VSEL_MASK 0x001F /* LDO2_SLP_VSEL - [4:0] */
680#define WM831X_LDO2_SLP_VSEL_SHIFT 0 /* LDO2_SLP_VSEL - [4:0] */
681#define WM831X_LDO2_SLP_VSEL_WIDTH 5 /* LDO2_SLP_VSEL - [4:0] */
682
683/*
684 * R16494 (0x406E) - LDO3 Control
685 */
686#define WM831X_LDO3_ERR_ACT_MASK 0xC000 /* LDO3_ERR_ACT - [15:14] */
687#define WM831X_LDO3_ERR_ACT_SHIFT 14 /* LDO3_ERR_ACT - [15:14] */
688#define WM831X_LDO3_ERR_ACT_WIDTH 2 /* LDO3_ERR_ACT - [15:14] */
689#define WM831X_LDO3_HWC_SRC_MASK 0x1800 /* LDO3_HWC_SRC - [12:11] */
690#define WM831X_LDO3_HWC_SRC_SHIFT 11 /* LDO3_HWC_SRC - [12:11] */
691#define WM831X_LDO3_HWC_SRC_WIDTH 2 /* LDO3_HWC_SRC - [12:11] */
692#define WM831X_LDO3_HWC_VSEL 0x0400 /* LDO3_HWC_VSEL */
693#define WM831X_LDO3_HWC_VSEL_MASK 0x0400 /* LDO3_HWC_VSEL */
694#define WM831X_LDO3_HWC_VSEL_SHIFT 10 /* LDO3_HWC_VSEL */
695#define WM831X_LDO3_HWC_VSEL_WIDTH 1 /* LDO3_HWC_VSEL */
696#define WM831X_LDO3_HWC_MODE_MASK 0x0300 /* LDO3_HWC_MODE - [9:8] */
697#define WM831X_LDO3_HWC_MODE_SHIFT 8 /* LDO3_HWC_MODE - [9:8] */
698#define WM831X_LDO3_HWC_MODE_WIDTH 2 /* LDO3_HWC_MODE - [9:8] */
699#define WM831X_LDO3_FLT 0x0080 /* LDO3_FLT */
700#define WM831X_LDO3_FLT_MASK 0x0080 /* LDO3_FLT */
701#define WM831X_LDO3_FLT_SHIFT 7 /* LDO3_FLT */
702#define WM831X_LDO3_FLT_WIDTH 1 /* LDO3_FLT */
703#define WM831X_LDO3_SWI 0x0040 /* LDO3_SWI */
704#define WM831X_LDO3_SWI_MASK 0x0040 /* LDO3_SWI */
705#define WM831X_LDO3_SWI_SHIFT 6 /* LDO3_SWI */
706#define WM831X_LDO3_SWI_WIDTH 1 /* LDO3_SWI */
707#define WM831X_LDO3_LP_MODE 0x0001 /* LDO3_LP_MODE */
708#define WM831X_LDO3_LP_MODE_MASK 0x0001 /* LDO3_LP_MODE */
709#define WM831X_LDO3_LP_MODE_SHIFT 0 /* LDO3_LP_MODE */
710#define WM831X_LDO3_LP_MODE_WIDTH 1 /* LDO3_LP_MODE */
711
712/*
713 * R16495 (0x406F) - LDO3 ON Control
714 */
715#define WM831X_LDO3_ON_SLOT_MASK 0xE000 /* LDO3_ON_SLOT - [15:13] */
716#define WM831X_LDO3_ON_SLOT_SHIFT 13 /* LDO3_ON_SLOT - [15:13] */
717#define WM831X_LDO3_ON_SLOT_WIDTH 3 /* LDO3_ON_SLOT - [15:13] */
718#define WM831X_LDO3_ON_MODE 0x0100 /* LDO3_ON_MODE */
719#define WM831X_LDO3_ON_MODE_MASK 0x0100 /* LDO3_ON_MODE */
720#define WM831X_LDO3_ON_MODE_SHIFT 8 /* LDO3_ON_MODE */
721#define WM831X_LDO3_ON_MODE_WIDTH 1 /* LDO3_ON_MODE */
722#define WM831X_LDO3_ON_VSEL_MASK 0x001F /* LDO3_ON_VSEL - [4:0] */
723#define WM831X_LDO3_ON_VSEL_SHIFT 0 /* LDO3_ON_VSEL - [4:0] */
724#define WM831X_LDO3_ON_VSEL_WIDTH 5 /* LDO3_ON_VSEL - [4:0] */
725
726/*
727 * R16496 (0x4070) - LDO3 SLEEP Control
728 */
729#define WM831X_LDO3_SLP_SLOT_MASK 0xE000 /* LDO3_SLP_SLOT - [15:13] */
730#define WM831X_LDO3_SLP_SLOT_SHIFT 13 /* LDO3_SLP_SLOT - [15:13] */
731#define WM831X_LDO3_SLP_SLOT_WIDTH 3 /* LDO3_SLP_SLOT - [15:13] */
732#define WM831X_LDO3_SLP_MODE 0x0100 /* LDO3_SLP_MODE */
733#define WM831X_LDO3_SLP_MODE_MASK 0x0100 /* LDO3_SLP_MODE */
734#define WM831X_LDO3_SLP_MODE_SHIFT 8 /* LDO3_SLP_MODE */
735#define WM831X_LDO3_SLP_MODE_WIDTH 1 /* LDO3_SLP_MODE */
736#define WM831X_LDO3_SLP_VSEL_MASK 0x001F /* LDO3_SLP_VSEL - [4:0] */
737#define WM831X_LDO3_SLP_VSEL_SHIFT 0 /* LDO3_SLP_VSEL - [4:0] */
738#define WM831X_LDO3_SLP_VSEL_WIDTH 5 /* LDO3_SLP_VSEL - [4:0] */
739
740/*
741 * R16497 (0x4071) - LDO4 Control
742 */
743#define WM831X_LDO4_ERR_ACT_MASK 0xC000 /* LDO4_ERR_ACT - [15:14] */
744#define WM831X_LDO4_ERR_ACT_SHIFT 14 /* LDO4_ERR_ACT - [15:14] */
745#define WM831X_LDO4_ERR_ACT_WIDTH 2 /* LDO4_ERR_ACT - [15:14] */
746#define WM831X_LDO4_HWC_SRC_MASK 0x1800 /* LDO4_HWC_SRC - [12:11] */
747#define WM831X_LDO4_HWC_SRC_SHIFT 11 /* LDO4_HWC_SRC - [12:11] */
748#define WM831X_LDO4_HWC_SRC_WIDTH 2 /* LDO4_HWC_SRC - [12:11] */
749#define WM831X_LDO4_HWC_VSEL 0x0400 /* LDO4_HWC_VSEL */
750#define WM831X_LDO4_HWC_VSEL_MASK 0x0400 /* LDO4_HWC_VSEL */
751#define WM831X_LDO4_HWC_VSEL_SHIFT 10 /* LDO4_HWC_VSEL */
752#define WM831X_LDO4_HWC_VSEL_WIDTH 1 /* LDO4_HWC_VSEL */
753#define WM831X_LDO4_HWC_MODE_MASK 0x0300 /* LDO4_HWC_MODE - [9:8] */
754#define WM831X_LDO4_HWC_MODE_SHIFT 8 /* LDO4_HWC_MODE - [9:8] */
755#define WM831X_LDO4_HWC_MODE_WIDTH 2 /* LDO4_HWC_MODE - [9:8] */
756#define WM831X_LDO4_FLT 0x0080 /* LDO4_FLT */
757#define WM831X_LDO4_FLT_MASK 0x0080 /* LDO4_FLT */
758#define WM831X_LDO4_FLT_SHIFT 7 /* LDO4_FLT */
759#define WM831X_LDO4_FLT_WIDTH 1 /* LDO4_FLT */
760#define WM831X_LDO4_SWI 0x0040 /* LDO4_SWI */
761#define WM831X_LDO4_SWI_MASK 0x0040 /* LDO4_SWI */
762#define WM831X_LDO4_SWI_SHIFT 6 /* LDO4_SWI */
763#define WM831X_LDO4_SWI_WIDTH 1 /* LDO4_SWI */
764#define WM831X_LDO4_LP_MODE 0x0001 /* LDO4_LP_MODE */
765#define WM831X_LDO4_LP_MODE_MASK 0x0001 /* LDO4_LP_MODE */
766#define WM831X_LDO4_LP_MODE_SHIFT 0 /* LDO4_LP_MODE */
767#define WM831X_LDO4_LP_MODE_WIDTH 1 /* LDO4_LP_MODE */
768
769/*
770 * R16498 (0x4072) - LDO4 ON Control
771 */
772#define WM831X_LDO4_ON_SLOT_MASK 0xE000 /* LDO4_ON_SLOT - [15:13] */
773#define WM831X_LDO4_ON_SLOT_SHIFT 13 /* LDO4_ON_SLOT - [15:13] */
774#define WM831X_LDO4_ON_SLOT_WIDTH 3 /* LDO4_ON_SLOT - [15:13] */
775#define WM831X_LDO4_ON_MODE 0x0100 /* LDO4_ON_MODE */
776#define WM831X_LDO4_ON_MODE_MASK 0x0100 /* LDO4_ON_MODE */
777#define WM831X_LDO4_ON_MODE_SHIFT 8 /* LDO4_ON_MODE */
778#define WM831X_LDO4_ON_MODE_WIDTH 1 /* LDO4_ON_MODE */
779#define WM831X_LDO4_ON_VSEL_MASK 0x001F /* LDO4_ON_VSEL - [4:0] */
780#define WM831X_LDO4_ON_VSEL_SHIFT 0 /* LDO4_ON_VSEL - [4:0] */
781#define WM831X_LDO4_ON_VSEL_WIDTH 5 /* LDO4_ON_VSEL - [4:0] */
782
783/*
784 * R16499 (0x4073) - LDO4 SLEEP Control
785 */
786#define WM831X_LDO4_SLP_SLOT_MASK 0xE000 /* LDO4_SLP_SLOT - [15:13] */
787#define WM831X_LDO4_SLP_SLOT_SHIFT 13 /* LDO4_SLP_SLOT - [15:13] */
788#define WM831X_LDO4_SLP_SLOT_WIDTH 3 /* LDO4_SLP_SLOT - [15:13] */
789#define WM831X_LDO4_SLP_MODE 0x0100 /* LDO4_SLP_MODE */
790#define WM831X_LDO4_SLP_MODE_MASK 0x0100 /* LDO4_SLP_MODE */
791#define WM831X_LDO4_SLP_MODE_SHIFT 8 /* LDO4_SLP_MODE */
792#define WM831X_LDO4_SLP_MODE_WIDTH 1 /* LDO4_SLP_MODE */
793#define WM831X_LDO4_SLP_VSEL_MASK 0x001F /* LDO4_SLP_VSEL - [4:0] */
794#define WM831X_LDO4_SLP_VSEL_SHIFT 0 /* LDO4_SLP_VSEL - [4:0] */
795#define WM831X_LDO4_SLP_VSEL_WIDTH 5 /* LDO4_SLP_VSEL - [4:0] */
796
797/*
798 * R16500 (0x4074) - LDO5 Control
799 */
800#define WM831X_LDO5_ERR_ACT_MASK 0xC000 /* LDO5_ERR_ACT - [15:14] */
801#define WM831X_LDO5_ERR_ACT_SHIFT 14 /* LDO5_ERR_ACT - [15:14] */
802#define WM831X_LDO5_ERR_ACT_WIDTH 2 /* LDO5_ERR_ACT - [15:14] */
803#define WM831X_LDO5_HWC_SRC_MASK 0x1800 /* LDO5_HWC_SRC - [12:11] */
804#define WM831X_LDO5_HWC_SRC_SHIFT 11 /* LDO5_HWC_SRC - [12:11] */
805#define WM831X_LDO5_HWC_SRC_WIDTH 2 /* LDO5_HWC_SRC - [12:11] */
806#define WM831X_LDO5_HWC_VSEL 0x0400 /* LDO5_HWC_VSEL */
807#define WM831X_LDO5_HWC_VSEL_MASK 0x0400 /* LDO5_HWC_VSEL */
808#define WM831X_LDO5_HWC_VSEL_SHIFT 10 /* LDO5_HWC_VSEL */
809#define WM831X_LDO5_HWC_VSEL_WIDTH 1 /* LDO5_HWC_VSEL */
810#define WM831X_LDO5_HWC_MODE_MASK 0x0300 /* LDO5_HWC_MODE - [9:8] */
811#define WM831X_LDO5_HWC_MODE_SHIFT 8 /* LDO5_HWC_MODE - [9:8] */
812#define WM831X_LDO5_HWC_MODE_WIDTH 2 /* LDO5_HWC_MODE - [9:8] */
813#define WM831X_LDO5_FLT 0x0080 /* LDO5_FLT */
814#define WM831X_LDO5_FLT_MASK 0x0080 /* LDO5_FLT */
815#define WM831X_LDO5_FLT_SHIFT 7 /* LDO5_FLT */
816#define WM831X_LDO5_FLT_WIDTH 1 /* LDO5_FLT */
817#define WM831X_LDO5_SWI 0x0040 /* LDO5_SWI */
818#define WM831X_LDO5_SWI_MASK 0x0040 /* LDO5_SWI */
819#define WM831X_LDO5_SWI_SHIFT 6 /* LDO5_SWI */
820#define WM831X_LDO5_SWI_WIDTH 1 /* LDO5_SWI */
821#define WM831X_LDO5_LP_MODE 0x0001 /* LDO5_LP_MODE */
822#define WM831X_LDO5_LP_MODE_MASK 0x0001 /* LDO5_LP_MODE */
823#define WM831X_LDO5_LP_MODE_SHIFT 0 /* LDO5_LP_MODE */
824#define WM831X_LDO5_LP_MODE_WIDTH 1 /* LDO5_LP_MODE */
825
826/*
827 * R16501 (0x4075) - LDO5 ON Control
828 */
829#define WM831X_LDO5_ON_SLOT_MASK 0xE000 /* LDO5_ON_SLOT - [15:13] */
830#define WM831X_LDO5_ON_SLOT_SHIFT 13 /* LDO5_ON_SLOT - [15:13] */
831#define WM831X_LDO5_ON_SLOT_WIDTH 3 /* LDO5_ON_SLOT - [15:13] */
832#define WM831X_LDO5_ON_MODE 0x0100 /* LDO5_ON_MODE */
833#define WM831X_LDO5_ON_MODE_MASK 0x0100 /* LDO5_ON_MODE */
834#define WM831X_LDO5_ON_MODE_SHIFT 8 /* LDO5_ON_MODE */
835#define WM831X_LDO5_ON_MODE_WIDTH 1 /* LDO5_ON_MODE */
836#define WM831X_LDO5_ON_VSEL_MASK 0x001F /* LDO5_ON_VSEL - [4:0] */
837#define WM831X_LDO5_ON_VSEL_SHIFT 0 /* LDO5_ON_VSEL - [4:0] */
838#define WM831X_LDO5_ON_VSEL_WIDTH 5 /* LDO5_ON_VSEL - [4:0] */
839
840/*
841 * R16502 (0x4076) - LDO5 SLEEP Control
842 */
843#define WM831X_LDO5_SLP_SLOT_MASK 0xE000 /* LDO5_SLP_SLOT - [15:13] */
844#define WM831X_LDO5_SLP_SLOT_SHIFT 13 /* LDO5_SLP_SLOT - [15:13] */
845#define WM831X_LDO5_SLP_SLOT_WIDTH 3 /* LDO5_SLP_SLOT - [15:13] */
846#define WM831X_LDO5_SLP_MODE 0x0100 /* LDO5_SLP_MODE */
847#define WM831X_LDO5_SLP_MODE_MASK 0x0100 /* LDO5_SLP_MODE */
848#define WM831X_LDO5_SLP_MODE_SHIFT 8 /* LDO5_SLP_MODE */
849#define WM831X_LDO5_SLP_MODE_WIDTH 1 /* LDO5_SLP_MODE */
850#define WM831X_LDO5_SLP_VSEL_MASK 0x001F /* LDO5_SLP_VSEL - [4:0] */
851#define WM831X_LDO5_SLP_VSEL_SHIFT 0 /* LDO5_SLP_VSEL - [4:0] */
852#define WM831X_LDO5_SLP_VSEL_WIDTH 5 /* LDO5_SLP_VSEL - [4:0] */
853
854/*
855 * R16503 (0x4077) - LDO6 Control
856 */
857#define WM831X_LDO6_ERR_ACT_MASK 0xC000 /* LDO6_ERR_ACT - [15:14] */
858#define WM831X_LDO6_ERR_ACT_SHIFT 14 /* LDO6_ERR_ACT - [15:14] */
859#define WM831X_LDO6_ERR_ACT_WIDTH 2 /* LDO6_ERR_ACT - [15:14] */
860#define WM831X_LDO6_HWC_SRC_MASK 0x1800 /* LDO6_HWC_SRC - [12:11] */
861#define WM831X_LDO6_HWC_SRC_SHIFT 11 /* LDO6_HWC_SRC - [12:11] */
862#define WM831X_LDO6_HWC_SRC_WIDTH 2 /* LDO6_HWC_SRC - [12:11] */
863#define WM831X_LDO6_HWC_VSEL 0x0400 /* LDO6_HWC_VSEL */
864#define WM831X_LDO6_HWC_VSEL_MASK 0x0400 /* LDO6_HWC_VSEL */
865#define WM831X_LDO6_HWC_VSEL_SHIFT 10 /* LDO6_HWC_VSEL */
866#define WM831X_LDO6_HWC_VSEL_WIDTH 1 /* LDO6_HWC_VSEL */
867#define WM831X_LDO6_HWC_MODE_MASK 0x0300 /* LDO6_HWC_MODE - [9:8] */
868#define WM831X_LDO6_HWC_MODE_SHIFT 8 /* LDO6_HWC_MODE - [9:8] */
869#define WM831X_LDO6_HWC_MODE_WIDTH 2 /* LDO6_HWC_MODE - [9:8] */
870#define WM831X_LDO6_FLT 0x0080 /* LDO6_FLT */
871#define WM831X_LDO6_FLT_MASK 0x0080 /* LDO6_FLT */
872#define WM831X_LDO6_FLT_SHIFT 7 /* LDO6_FLT */
873#define WM831X_LDO6_FLT_WIDTH 1 /* LDO6_FLT */
874#define WM831X_LDO6_SWI 0x0040 /* LDO6_SWI */
875#define WM831X_LDO6_SWI_MASK 0x0040 /* LDO6_SWI */
876#define WM831X_LDO6_SWI_SHIFT 6 /* LDO6_SWI */
877#define WM831X_LDO6_SWI_WIDTH 1 /* LDO6_SWI */
878#define WM831X_LDO6_LP_MODE 0x0001 /* LDO6_LP_MODE */
879#define WM831X_LDO6_LP_MODE_MASK 0x0001 /* LDO6_LP_MODE */
880#define WM831X_LDO6_LP_MODE_SHIFT 0 /* LDO6_LP_MODE */
881#define WM831X_LDO6_LP_MODE_WIDTH 1 /* LDO6_LP_MODE */
882
883/*
884 * R16504 (0x4078) - LDO6 ON Control
885 */
886#define WM831X_LDO6_ON_SLOT_MASK 0xE000 /* LDO6_ON_SLOT - [15:13] */
887#define WM831X_LDO6_ON_SLOT_SHIFT 13 /* LDO6_ON_SLOT - [15:13] */
888#define WM831X_LDO6_ON_SLOT_WIDTH 3 /* LDO6_ON_SLOT - [15:13] */
889#define WM831X_LDO6_ON_MODE 0x0100 /* LDO6_ON_MODE */
890#define WM831X_LDO6_ON_MODE_MASK 0x0100 /* LDO6_ON_MODE */
891#define WM831X_LDO6_ON_MODE_SHIFT 8 /* LDO6_ON_MODE */
892#define WM831X_LDO6_ON_MODE_WIDTH 1 /* LDO6_ON_MODE */
893#define WM831X_LDO6_ON_VSEL_MASK 0x001F /* LDO6_ON_VSEL - [4:0] */
894#define WM831X_LDO6_ON_VSEL_SHIFT 0 /* LDO6_ON_VSEL - [4:0] */
895#define WM831X_LDO6_ON_VSEL_WIDTH 5 /* LDO6_ON_VSEL - [4:0] */
896
897/*
898 * R16505 (0x4079) - LDO6 SLEEP Control
899 */
900#define WM831X_LDO6_SLP_SLOT_MASK 0xE000 /* LDO6_SLP_SLOT - [15:13] */
901#define WM831X_LDO6_SLP_SLOT_SHIFT 13 /* LDO6_SLP_SLOT - [15:13] */
902#define WM831X_LDO6_SLP_SLOT_WIDTH 3 /* LDO6_SLP_SLOT - [15:13] */
903#define WM831X_LDO6_SLP_MODE 0x0100 /* LDO6_SLP_MODE */
904#define WM831X_LDO6_SLP_MODE_MASK 0x0100 /* LDO6_SLP_MODE */
905#define WM831X_LDO6_SLP_MODE_SHIFT 8 /* LDO6_SLP_MODE */
906#define WM831X_LDO6_SLP_MODE_WIDTH 1 /* LDO6_SLP_MODE */
907#define WM831X_LDO6_SLP_VSEL_MASK 0x001F /* LDO6_SLP_VSEL - [4:0] */
908#define WM831X_LDO6_SLP_VSEL_SHIFT 0 /* LDO6_SLP_VSEL - [4:0] */
909#define WM831X_LDO6_SLP_VSEL_WIDTH 5 /* LDO6_SLP_VSEL - [4:0] */
910
911/*
912 * R16506 (0x407A) - LDO7 Control
913 */
914#define WM831X_LDO7_ERR_ACT_MASK 0xC000 /* LDO7_ERR_ACT - [15:14] */
915#define WM831X_LDO7_ERR_ACT_SHIFT 14 /* LDO7_ERR_ACT - [15:14] */
916#define WM831X_LDO7_ERR_ACT_WIDTH 2 /* LDO7_ERR_ACT - [15:14] */
917#define WM831X_LDO7_HWC_SRC_MASK 0x1800 /* LDO7_HWC_SRC - [12:11] */
918#define WM831X_LDO7_HWC_SRC_SHIFT 11 /* LDO7_HWC_SRC - [12:11] */
919#define WM831X_LDO7_HWC_SRC_WIDTH 2 /* LDO7_HWC_SRC - [12:11] */
920#define WM831X_LDO7_HWC_VSEL 0x0400 /* LDO7_HWC_VSEL */
921#define WM831X_LDO7_HWC_VSEL_MASK 0x0400 /* LDO7_HWC_VSEL */
922#define WM831X_LDO7_HWC_VSEL_SHIFT 10 /* LDO7_HWC_VSEL */
923#define WM831X_LDO7_HWC_VSEL_WIDTH 1 /* LDO7_HWC_VSEL */
924#define WM831X_LDO7_HWC_MODE_MASK 0x0300 /* LDO7_HWC_MODE - [9:8] */
925#define WM831X_LDO7_HWC_MODE_SHIFT 8 /* LDO7_HWC_MODE - [9:8] */
926#define WM831X_LDO7_HWC_MODE_WIDTH 2 /* LDO7_HWC_MODE - [9:8] */
927#define WM831X_LDO7_FLT 0x0080 /* LDO7_FLT */
928#define WM831X_LDO7_FLT_MASK 0x0080 /* LDO7_FLT */
929#define WM831X_LDO7_FLT_SHIFT 7 /* LDO7_FLT */
930#define WM831X_LDO7_FLT_WIDTH 1 /* LDO7_FLT */
931#define WM831X_LDO7_SWI 0x0040 /* LDO7_SWI */
932#define WM831X_LDO7_SWI_MASK 0x0040 /* LDO7_SWI */
933#define WM831X_LDO7_SWI_SHIFT 6 /* LDO7_SWI */
934#define WM831X_LDO7_SWI_WIDTH 1 /* LDO7_SWI */
935
936/*
937 * R16507 (0x407B) - LDO7 ON Control
938 */
939#define WM831X_LDO7_ON_SLOT_MASK 0xE000 /* LDO7_ON_SLOT - [15:13] */
940#define WM831X_LDO7_ON_SLOT_SHIFT 13 /* LDO7_ON_SLOT - [15:13] */
941#define WM831X_LDO7_ON_SLOT_WIDTH 3 /* LDO7_ON_SLOT - [15:13] */
942#define WM831X_LDO7_ON_MODE 0x0100 /* LDO7_ON_MODE */
943#define WM831X_LDO7_ON_MODE_MASK 0x0100 /* LDO7_ON_MODE */
944#define WM831X_LDO7_ON_MODE_SHIFT 8 /* LDO7_ON_MODE */
945#define WM831X_LDO7_ON_MODE_WIDTH 1 /* LDO7_ON_MODE */
946#define WM831X_LDO7_ON_VSEL_MASK 0x001F /* LDO7_ON_VSEL - [4:0] */
947#define WM831X_LDO7_ON_VSEL_SHIFT 0 /* LDO7_ON_VSEL - [4:0] */
948#define WM831X_LDO7_ON_VSEL_WIDTH 5 /* LDO7_ON_VSEL - [4:0] */
949
950/*
951 * R16508 (0x407C) - LDO7 SLEEP Control
952 */
953#define WM831X_LDO7_SLP_SLOT_MASK 0xE000 /* LDO7_SLP_SLOT - [15:13] */
954#define WM831X_LDO7_SLP_SLOT_SHIFT 13 /* LDO7_SLP_SLOT - [15:13] */
955#define WM831X_LDO7_SLP_SLOT_WIDTH 3 /* LDO7_SLP_SLOT - [15:13] */
956#define WM831X_LDO7_SLP_MODE 0x0100 /* LDO7_SLP_MODE */
957#define WM831X_LDO7_SLP_MODE_MASK 0x0100 /* LDO7_SLP_MODE */
958#define WM831X_LDO7_SLP_MODE_SHIFT 8 /* LDO7_SLP_MODE */
959#define WM831X_LDO7_SLP_MODE_WIDTH 1 /* LDO7_SLP_MODE */
960#define WM831X_LDO7_SLP_VSEL_MASK 0x001F /* LDO7_SLP_VSEL - [4:0] */
961#define WM831X_LDO7_SLP_VSEL_SHIFT 0 /* LDO7_SLP_VSEL - [4:0] */
962#define WM831X_LDO7_SLP_VSEL_WIDTH 5 /* LDO7_SLP_VSEL - [4:0] */
963
964/*
965 * R16509 (0x407D) - LDO8 Control
966 */
967#define WM831X_LDO8_ERR_ACT_MASK 0xC000 /* LDO8_ERR_ACT - [15:14] */
968#define WM831X_LDO8_ERR_ACT_SHIFT 14 /* LDO8_ERR_ACT - [15:14] */
969#define WM831X_LDO8_ERR_ACT_WIDTH 2 /* LDO8_ERR_ACT - [15:14] */
970#define WM831X_LDO8_HWC_SRC_MASK 0x1800 /* LDO8_HWC_SRC - [12:11] */
971#define WM831X_LDO8_HWC_SRC_SHIFT 11 /* LDO8_HWC_SRC - [12:11] */
972#define WM831X_LDO8_HWC_SRC_WIDTH 2 /* LDO8_HWC_SRC - [12:11] */
973#define WM831X_LDO8_HWC_VSEL 0x0400 /* LDO8_HWC_VSEL */
974#define WM831X_LDO8_HWC_VSEL_MASK 0x0400 /* LDO8_HWC_VSEL */
975#define WM831X_LDO8_HWC_VSEL_SHIFT 10 /* LDO8_HWC_VSEL */
976#define WM831X_LDO8_HWC_VSEL_WIDTH 1 /* LDO8_HWC_VSEL */
977#define WM831X_LDO8_HWC_MODE_MASK 0x0300 /* LDO8_HWC_MODE - [9:8] */
978#define WM831X_LDO8_HWC_MODE_SHIFT 8 /* LDO8_HWC_MODE - [9:8] */
979#define WM831X_LDO8_HWC_MODE_WIDTH 2 /* LDO8_HWC_MODE - [9:8] */
980#define WM831X_LDO8_FLT 0x0080 /* LDO8_FLT */
981#define WM831X_LDO8_FLT_MASK 0x0080 /* LDO8_FLT */
982#define WM831X_LDO8_FLT_SHIFT 7 /* LDO8_FLT */
983#define WM831X_LDO8_FLT_WIDTH 1 /* LDO8_FLT */
984#define WM831X_LDO8_SWI 0x0040 /* LDO8_SWI */
985#define WM831X_LDO8_SWI_MASK 0x0040 /* LDO8_SWI */
986#define WM831X_LDO8_SWI_SHIFT 6 /* LDO8_SWI */
987#define WM831X_LDO8_SWI_WIDTH 1 /* LDO8_SWI */
988
989/*
990 * R16510 (0x407E) - LDO8 ON Control
991 */
992#define WM831X_LDO8_ON_SLOT_MASK 0xE000 /* LDO8_ON_SLOT - [15:13] */
993#define WM831X_LDO8_ON_SLOT_SHIFT 13 /* LDO8_ON_SLOT - [15:13] */
994#define WM831X_LDO8_ON_SLOT_WIDTH 3 /* LDO8_ON_SLOT - [15:13] */
995#define WM831X_LDO8_ON_MODE 0x0100 /* LDO8_ON_MODE */
996#define WM831X_LDO8_ON_MODE_MASK 0x0100 /* LDO8_ON_MODE */
997#define WM831X_LDO8_ON_MODE_SHIFT 8 /* LDO8_ON_MODE */
998#define WM831X_LDO8_ON_MODE_WIDTH 1 /* LDO8_ON_MODE */
999#define WM831X_LDO8_ON_VSEL_MASK 0x001F /* LDO8_ON_VSEL - [4:0] */
1000#define WM831X_LDO8_ON_VSEL_SHIFT 0 /* LDO8_ON_VSEL - [4:0] */
1001#define WM831X_LDO8_ON_VSEL_WIDTH 5 /* LDO8_ON_VSEL - [4:0] */
1002
1003/*
1004 * R16511 (0x407F) - LDO8 SLEEP Control
1005 */
1006#define WM831X_LDO8_SLP_SLOT_MASK 0xE000 /* LDO8_SLP_SLOT - [15:13] */
1007#define WM831X_LDO8_SLP_SLOT_SHIFT 13 /* LDO8_SLP_SLOT - [15:13] */
1008#define WM831X_LDO8_SLP_SLOT_WIDTH 3 /* LDO8_SLP_SLOT - [15:13] */
1009#define WM831X_LDO8_SLP_MODE 0x0100 /* LDO8_SLP_MODE */
1010#define WM831X_LDO8_SLP_MODE_MASK 0x0100 /* LDO8_SLP_MODE */
1011#define WM831X_LDO8_SLP_MODE_SHIFT 8 /* LDO8_SLP_MODE */
1012#define WM831X_LDO8_SLP_MODE_WIDTH 1 /* LDO8_SLP_MODE */
1013#define WM831X_LDO8_SLP_VSEL_MASK 0x001F /* LDO8_SLP_VSEL - [4:0] */
1014#define WM831X_LDO8_SLP_VSEL_SHIFT 0 /* LDO8_SLP_VSEL - [4:0] */
1015#define WM831X_LDO8_SLP_VSEL_WIDTH 5 /* LDO8_SLP_VSEL - [4:0] */
1016
1017/*
1018 * R16512 (0x4080) - LDO9 Control
1019 */
1020#define WM831X_LDO9_ERR_ACT_MASK 0xC000 /* LDO9_ERR_ACT - [15:14] */
1021#define WM831X_LDO9_ERR_ACT_SHIFT 14 /* LDO9_ERR_ACT - [15:14] */
1022#define WM831X_LDO9_ERR_ACT_WIDTH 2 /* LDO9_ERR_ACT - [15:14] */
1023#define WM831X_LDO9_HWC_SRC_MASK 0x1800 /* LDO9_HWC_SRC - [12:11] */
1024#define WM831X_LDO9_HWC_SRC_SHIFT 11 /* LDO9_HWC_SRC - [12:11] */
1025#define WM831X_LDO9_HWC_SRC_WIDTH 2 /* LDO9_HWC_SRC - [12:11] */
1026#define WM831X_LDO9_HWC_VSEL 0x0400 /* LDO9_HWC_VSEL */
1027#define WM831X_LDO9_HWC_VSEL_MASK 0x0400 /* LDO9_HWC_VSEL */
1028#define WM831X_LDO9_HWC_VSEL_SHIFT 10 /* LDO9_HWC_VSEL */
1029#define WM831X_LDO9_HWC_VSEL_WIDTH 1 /* LDO9_HWC_VSEL */
1030#define WM831X_LDO9_HWC_MODE_MASK 0x0300 /* LDO9_HWC_MODE - [9:8] */
1031#define WM831X_LDO9_HWC_MODE_SHIFT 8 /* LDO9_HWC_MODE - [9:8] */
1032#define WM831X_LDO9_HWC_MODE_WIDTH 2 /* LDO9_HWC_MODE - [9:8] */
1033#define WM831X_LDO9_FLT 0x0080 /* LDO9_FLT */
1034#define WM831X_LDO9_FLT_MASK 0x0080 /* LDO9_FLT */
1035#define WM831X_LDO9_FLT_SHIFT 7 /* LDO9_FLT */
1036#define WM831X_LDO9_FLT_WIDTH 1 /* LDO9_FLT */
1037#define WM831X_LDO9_SWI 0x0040 /* LDO9_SWI */
1038#define WM831X_LDO9_SWI_MASK 0x0040 /* LDO9_SWI */
1039#define WM831X_LDO9_SWI_SHIFT 6 /* LDO9_SWI */
1040#define WM831X_LDO9_SWI_WIDTH 1 /* LDO9_SWI */
1041
1042/*
1043 * R16513 (0x4081) - LDO9 ON Control
1044 */
1045#define WM831X_LDO9_ON_SLOT_MASK 0xE000 /* LDO9_ON_SLOT - [15:13] */
1046#define WM831X_LDO9_ON_SLOT_SHIFT 13 /* LDO9_ON_SLOT - [15:13] */
1047#define WM831X_LDO9_ON_SLOT_WIDTH 3 /* LDO9_ON_SLOT - [15:13] */
1048#define WM831X_LDO9_ON_MODE 0x0100 /* LDO9_ON_MODE */
1049#define WM831X_LDO9_ON_MODE_MASK 0x0100 /* LDO9_ON_MODE */
1050#define WM831X_LDO9_ON_MODE_SHIFT 8 /* LDO9_ON_MODE */
1051#define WM831X_LDO9_ON_MODE_WIDTH 1 /* LDO9_ON_MODE */
1052#define WM831X_LDO9_ON_VSEL_MASK 0x001F /* LDO9_ON_VSEL - [4:0] */
1053#define WM831X_LDO9_ON_VSEL_SHIFT 0 /* LDO9_ON_VSEL - [4:0] */
1054#define WM831X_LDO9_ON_VSEL_WIDTH 5 /* LDO9_ON_VSEL - [4:0] */
1055
1056/*
1057 * R16514 (0x4082) - LDO9 SLEEP Control
1058 */
1059#define WM831X_LDO9_SLP_SLOT_MASK 0xE000 /* LDO9_SLP_SLOT - [15:13] */
1060#define WM831X_LDO9_SLP_SLOT_SHIFT 13 /* LDO9_SLP_SLOT - [15:13] */
1061#define WM831X_LDO9_SLP_SLOT_WIDTH 3 /* LDO9_SLP_SLOT - [15:13] */
1062#define WM831X_LDO9_SLP_MODE 0x0100 /* LDO9_SLP_MODE */
1063#define WM831X_LDO9_SLP_MODE_MASK 0x0100 /* LDO9_SLP_MODE */
1064#define WM831X_LDO9_SLP_MODE_SHIFT 8 /* LDO9_SLP_MODE */
1065#define WM831X_LDO9_SLP_MODE_WIDTH 1 /* LDO9_SLP_MODE */
1066#define WM831X_LDO9_SLP_VSEL_MASK 0x001F /* LDO9_SLP_VSEL - [4:0] */
1067#define WM831X_LDO9_SLP_VSEL_SHIFT 0 /* LDO9_SLP_VSEL - [4:0] */
1068#define WM831X_LDO9_SLP_VSEL_WIDTH 5 /* LDO9_SLP_VSEL - [4:0] */
1069
1070/*
1071 * R16515 (0x4083) - LDO10 Control
1072 */
1073#define WM831X_LDO10_ERR_ACT_MASK 0xC000 /* LDO10_ERR_ACT - [15:14] */
1074#define WM831X_LDO10_ERR_ACT_SHIFT 14 /* LDO10_ERR_ACT - [15:14] */
1075#define WM831X_LDO10_ERR_ACT_WIDTH 2 /* LDO10_ERR_ACT - [15:14] */
1076#define WM831X_LDO10_HWC_SRC_MASK 0x1800 /* LDO10_HWC_SRC - [12:11] */
1077#define WM831X_LDO10_HWC_SRC_SHIFT 11 /* LDO10_HWC_SRC - [12:11] */
1078#define WM831X_LDO10_HWC_SRC_WIDTH 2 /* LDO10_HWC_SRC - [12:11] */
1079#define WM831X_LDO10_HWC_VSEL 0x0400 /* LDO10_HWC_VSEL */
1080#define WM831X_LDO10_HWC_VSEL_MASK 0x0400 /* LDO10_HWC_VSEL */
1081#define WM831X_LDO10_HWC_VSEL_SHIFT 10 /* LDO10_HWC_VSEL */
1082#define WM831X_LDO10_HWC_VSEL_WIDTH 1 /* LDO10_HWC_VSEL */
1083#define WM831X_LDO10_HWC_MODE_MASK 0x0300 /* LDO10_HWC_MODE - [9:8] */
1084#define WM831X_LDO10_HWC_MODE_SHIFT 8 /* LDO10_HWC_MODE - [9:8] */
1085#define WM831X_LDO10_HWC_MODE_WIDTH 2 /* LDO10_HWC_MODE - [9:8] */
1086#define WM831X_LDO10_FLT 0x0080 /* LDO10_FLT */
1087#define WM831X_LDO10_FLT_MASK 0x0080 /* LDO10_FLT */
1088#define WM831X_LDO10_FLT_SHIFT 7 /* LDO10_FLT */
1089#define WM831X_LDO10_FLT_WIDTH 1 /* LDO10_FLT */
1090#define WM831X_LDO10_SWI 0x0040 /* LDO10_SWI */
1091#define WM831X_LDO10_SWI_MASK 0x0040 /* LDO10_SWI */
1092#define WM831X_LDO10_SWI_SHIFT 6 /* LDO10_SWI */
1093#define WM831X_LDO10_SWI_WIDTH 1 /* LDO10_SWI */
1094
1095/*
1096 * R16516 (0x4084) - LDO10 ON Control
1097 */
1098#define WM831X_LDO10_ON_SLOT_MASK 0xE000 /* LDO10_ON_SLOT - [15:13] */
1099#define WM831X_LDO10_ON_SLOT_SHIFT 13 /* LDO10_ON_SLOT - [15:13] */
1100#define WM831X_LDO10_ON_SLOT_WIDTH 3 /* LDO10_ON_SLOT - [15:13] */
1101#define WM831X_LDO10_ON_MODE 0x0100 /* LDO10_ON_MODE */
1102#define WM831X_LDO10_ON_MODE_MASK 0x0100 /* LDO10_ON_MODE */
1103#define WM831X_LDO10_ON_MODE_SHIFT 8 /* LDO10_ON_MODE */
1104#define WM831X_LDO10_ON_MODE_WIDTH 1 /* LDO10_ON_MODE */
1105#define WM831X_LDO10_ON_VSEL_MASK 0x001F /* LDO10_ON_VSEL - [4:0] */
1106#define WM831X_LDO10_ON_VSEL_SHIFT 0 /* LDO10_ON_VSEL - [4:0] */
1107#define WM831X_LDO10_ON_VSEL_WIDTH 5 /* LDO10_ON_VSEL - [4:0] */
1108
1109/*
1110 * R16517 (0x4085) - LDO10 SLEEP Control
1111 */
1112#define WM831X_LDO10_SLP_SLOT_MASK 0xE000 /* LDO10_SLP_SLOT - [15:13] */
1113#define WM831X_LDO10_SLP_SLOT_SHIFT 13 /* LDO10_SLP_SLOT - [15:13] */
1114#define WM831X_LDO10_SLP_SLOT_WIDTH 3 /* LDO10_SLP_SLOT - [15:13] */
1115#define WM831X_LDO10_SLP_MODE 0x0100 /* LDO10_SLP_MODE */
1116#define WM831X_LDO10_SLP_MODE_MASK 0x0100 /* LDO10_SLP_MODE */
1117#define WM831X_LDO10_SLP_MODE_SHIFT 8 /* LDO10_SLP_MODE */
1118#define WM831X_LDO10_SLP_MODE_WIDTH 1 /* LDO10_SLP_MODE */
1119#define WM831X_LDO10_SLP_VSEL_MASK 0x001F /* LDO10_SLP_VSEL - [4:0] */
1120#define WM831X_LDO10_SLP_VSEL_SHIFT 0 /* LDO10_SLP_VSEL - [4:0] */
1121#define WM831X_LDO10_SLP_VSEL_WIDTH 5 /* LDO10_SLP_VSEL - [4:0] */
1122
1123/*
1124 * R16519 (0x4087) - LDO11 ON Control
1125 */
1126#define WM831X_LDO11_ON_SLOT_MASK 0xE000 /* LDO11_ON_SLOT - [15:13] */
1127#define WM831X_LDO11_ON_SLOT_SHIFT 13 /* LDO11_ON_SLOT - [15:13] */
1128#define WM831X_LDO11_ON_SLOT_WIDTH 3 /* LDO11_ON_SLOT - [15:13] */
1129#define WM831X_LDO11_OFFENA 0x1000 /* LDO11_OFFENA */
1130#define WM831X_LDO11_OFFENA_MASK 0x1000 /* LDO11_OFFENA */
1131#define WM831X_LDO11_OFFENA_SHIFT 12 /* LDO11_OFFENA */
1132#define WM831X_LDO11_OFFENA_WIDTH 1 /* LDO11_OFFENA */
1133#define WM831X_LDO11_VSEL_SRC 0x0080 /* LDO11_VSEL_SRC */
1134#define WM831X_LDO11_VSEL_SRC_MASK 0x0080 /* LDO11_VSEL_SRC */
1135#define WM831X_LDO11_VSEL_SRC_SHIFT 7 /* LDO11_VSEL_SRC */
1136#define WM831X_LDO11_VSEL_SRC_WIDTH 1 /* LDO11_VSEL_SRC */
1137#define WM831X_LDO11_ON_VSEL_MASK 0x000F /* LDO11_ON_VSEL - [3:0] */
1138#define WM831X_LDO11_ON_VSEL_SHIFT 0 /* LDO11_ON_VSEL - [3:0] */
1139#define WM831X_LDO11_ON_VSEL_WIDTH 4 /* LDO11_ON_VSEL - [3:0] */
1140
1141/*
1142 * R16520 (0x4088) - LDO11 SLEEP Control
1143 */
1144#define WM831X_LDO11_SLP_SLOT_MASK 0xE000 /* LDO11_SLP_SLOT - [15:13] */
1145#define WM831X_LDO11_SLP_SLOT_SHIFT 13 /* LDO11_SLP_SLOT - [15:13] */
1146#define WM831X_LDO11_SLP_SLOT_WIDTH 3 /* LDO11_SLP_SLOT - [15:13] */
1147#define WM831X_LDO11_SLP_VSEL_MASK 0x000F /* LDO11_SLP_VSEL - [3:0] */
1148#define WM831X_LDO11_SLP_VSEL_SHIFT 0 /* LDO11_SLP_VSEL - [3:0] */
1149#define WM831X_LDO11_SLP_VSEL_WIDTH 4 /* LDO11_SLP_VSEL - [3:0] */
1150
1151/*
1152 * R16526 (0x408E) - Power Good Source 1
1153 */
1154#define WM831X_DC4_OK 0x0008 /* DC4_OK */
1155#define WM831X_DC4_OK_MASK 0x0008 /* DC4_OK */
1156#define WM831X_DC4_OK_SHIFT 3 /* DC4_OK */
1157#define WM831X_DC4_OK_WIDTH 1 /* DC4_OK */
1158#define WM831X_DC3_OK 0x0004 /* DC3_OK */
1159#define WM831X_DC3_OK_MASK 0x0004 /* DC3_OK */
1160#define WM831X_DC3_OK_SHIFT 2 /* DC3_OK */
1161#define WM831X_DC3_OK_WIDTH 1 /* DC3_OK */
1162#define WM831X_DC2_OK 0x0002 /* DC2_OK */
1163#define WM831X_DC2_OK_MASK 0x0002 /* DC2_OK */
1164#define WM831X_DC2_OK_SHIFT 1 /* DC2_OK */
1165#define WM831X_DC2_OK_WIDTH 1 /* DC2_OK */
1166#define WM831X_DC1_OK 0x0001 /* DC1_OK */
1167#define WM831X_DC1_OK_MASK 0x0001 /* DC1_OK */
1168#define WM831X_DC1_OK_SHIFT 0 /* DC1_OK */
1169#define WM831X_DC1_OK_WIDTH 1 /* DC1_OK */
1170
1171/*
1172 * R16527 (0x408F) - Power Good Source 2
1173 */
1174#define WM831X_LDO10_OK 0x0200 /* LDO10_OK */
1175#define WM831X_LDO10_OK_MASK 0x0200 /* LDO10_OK */
1176#define WM831X_LDO10_OK_SHIFT 9 /* LDO10_OK */
1177#define WM831X_LDO10_OK_WIDTH 1 /* LDO10_OK */
1178#define WM831X_LDO9_OK 0x0100 /* LDO9_OK */
1179#define WM831X_LDO9_OK_MASK 0x0100 /* LDO9_OK */
1180#define WM831X_LDO9_OK_SHIFT 8 /* LDO9_OK */
1181#define WM831X_LDO9_OK_WIDTH 1 /* LDO9_OK */
1182#define WM831X_LDO8_OK 0x0080 /* LDO8_OK */
1183#define WM831X_LDO8_OK_MASK 0x0080 /* LDO8_OK */
1184#define WM831X_LDO8_OK_SHIFT 7 /* LDO8_OK */
1185#define WM831X_LDO8_OK_WIDTH 1 /* LDO8_OK */
1186#define WM831X_LDO7_OK 0x0040 /* LDO7_OK */
1187#define WM831X_LDO7_OK_MASK 0x0040 /* LDO7_OK */
1188#define WM831X_LDO7_OK_SHIFT 6 /* LDO7_OK */
1189#define WM831X_LDO7_OK_WIDTH 1 /* LDO7_OK */
1190#define WM831X_LDO6_OK 0x0020 /* LDO6_OK */
1191#define WM831X_LDO6_OK_MASK 0x0020 /* LDO6_OK */
1192#define WM831X_LDO6_OK_SHIFT 5 /* LDO6_OK */
1193#define WM831X_LDO6_OK_WIDTH 1 /* LDO6_OK */
1194#define WM831X_LDO5_OK 0x0010 /* LDO5_OK */
1195#define WM831X_LDO5_OK_MASK 0x0010 /* LDO5_OK */
1196#define WM831X_LDO5_OK_SHIFT 4 /* LDO5_OK */
1197#define WM831X_LDO5_OK_WIDTH 1 /* LDO5_OK */
1198#define WM831X_LDO4_OK 0x0008 /* LDO4_OK */
1199#define WM831X_LDO4_OK_MASK 0x0008 /* LDO4_OK */
1200#define WM831X_LDO4_OK_SHIFT 3 /* LDO4_OK */
1201#define WM831X_LDO4_OK_WIDTH 1 /* LDO4_OK */
1202#define WM831X_LDO3_OK 0x0004 /* LDO3_OK */
1203#define WM831X_LDO3_OK_MASK 0x0004 /* LDO3_OK */
1204#define WM831X_LDO3_OK_SHIFT 2 /* LDO3_OK */
1205#define WM831X_LDO3_OK_WIDTH 1 /* LDO3_OK */
1206#define WM831X_LDO2_OK 0x0002 /* LDO2_OK */
1207#define WM831X_LDO2_OK_MASK 0x0002 /* LDO2_OK */
1208#define WM831X_LDO2_OK_SHIFT 1 /* LDO2_OK */
1209#define WM831X_LDO2_OK_WIDTH 1 /* LDO2_OK */
1210#define WM831X_LDO1_OK 0x0001 /* LDO1_OK */
1211#define WM831X_LDO1_OK_MASK 0x0001 /* LDO1_OK */
1212#define WM831X_LDO1_OK_SHIFT 0 /* LDO1_OK */
1213#define WM831X_LDO1_OK_WIDTH 1 /* LDO1_OK */
1214
1215#define WM831X_ISINK_MAX_ISEL 55
1216extern int wm831x_isinkv_values[WM831X_ISINK_MAX_ISEL + 1];
1217
1218#endif
diff --git a/include/linux/mfd/wm831x/status.h b/include/linux/mfd/wm831x/status.h
new file mode 100644
index 000000000000..6bc090d0e3ac
--- /dev/null
+++ b/include/linux/mfd/wm831x/status.h
@@ -0,0 +1,34 @@
1/*
2 * include/linux/mfd/wm831x/status.h -- Status LEDs for WM831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_STATUS_H__
16#define __MFD_WM831X_STATUS_H__
17
18#define WM831X_LED_SRC_MASK 0xC000 /* LED_SRC - [15:14] */
19#define WM831X_LED_SRC_SHIFT 14 /* LED_SRC - [15:14] */
20#define WM831X_LED_SRC_WIDTH 2 /* LED_SRC - [15:14] */
21#define WM831X_LED_MODE_MASK 0x0300 /* LED_MODE - [9:8] */
22#define WM831X_LED_MODE_SHIFT 8 /* LED_MODE - [9:8] */
23#define WM831X_LED_MODE_WIDTH 2 /* LED_MODE - [9:8] */
24#define WM831X_LED_SEQ_LEN_MASK 0x0030 /* LED_SEQ_LEN - [5:4] */
25#define WM831X_LED_SEQ_LEN_SHIFT 4 /* LED_SEQ_LEN - [5:4] */
26#define WM831X_LED_SEQ_LEN_WIDTH 2 /* LED_SEQ_LEN - [5:4] */
27#define WM831X_LED_DUR_MASK 0x000C /* LED_DUR - [3:2] */
28#define WM831X_LED_DUR_SHIFT 2 /* LED_DUR - [3:2] */
29#define WM831X_LED_DUR_WIDTH 2 /* LED_DUR - [3:2] */
30#define WM831X_LED_DUTY_CYC_MASK 0x0003 /* LED_DUTY_CYC - [1:0] */
31#define WM831X_LED_DUTY_CYC_SHIFT 0 /* LED_DUTY_CYC - [1:0] */
32#define WM831X_LED_DUTY_CYC_WIDTH 2 /* LED_DUTY_CYC - [1:0] */
33
34#endif
diff --git a/include/linux/mfd/wm831x/watchdog.h b/include/linux/mfd/wm831x/watchdog.h
new file mode 100644
index 000000000000..97a99b52956f
--- /dev/null
+++ b/include/linux/mfd/wm831x/watchdog.h
@@ -0,0 +1,52 @@
1/*
2 * include/linux/mfd/wm831x/watchdog.h -- Watchdog for WM831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_WATCHDOG_H__
16#define __MFD_WM831X_WATCHDOG_H__
17
18
19/*
20 * R16388 (0x4004) - Watchdog
21 */
22#define WM831X_WDOG_ENA 0x8000 /* WDOG_ENA */
23#define WM831X_WDOG_ENA_MASK 0x8000 /* WDOG_ENA */
24#define WM831X_WDOG_ENA_SHIFT 15 /* WDOG_ENA */
25#define WM831X_WDOG_ENA_WIDTH 1 /* WDOG_ENA */
26#define WM831X_WDOG_DEBUG 0x4000 /* WDOG_DEBUG */
27#define WM831X_WDOG_DEBUG_MASK 0x4000 /* WDOG_DEBUG */
28#define WM831X_WDOG_DEBUG_SHIFT 14 /* WDOG_DEBUG */
29#define WM831X_WDOG_DEBUG_WIDTH 1 /* WDOG_DEBUG */
30#define WM831X_WDOG_RST_SRC 0x2000 /* WDOG_RST_SRC */
31#define WM831X_WDOG_RST_SRC_MASK 0x2000 /* WDOG_RST_SRC */
32#define WM831X_WDOG_RST_SRC_SHIFT 13 /* WDOG_RST_SRC */
33#define WM831X_WDOG_RST_SRC_WIDTH 1 /* WDOG_RST_SRC */
34#define WM831X_WDOG_SLPENA 0x1000 /* WDOG_SLPENA */
35#define WM831X_WDOG_SLPENA_MASK 0x1000 /* WDOG_SLPENA */
36#define WM831X_WDOG_SLPENA_SHIFT 12 /* WDOG_SLPENA */
37#define WM831X_WDOG_SLPENA_WIDTH 1 /* WDOG_SLPENA */
38#define WM831X_WDOG_RESET 0x0800 /* WDOG_RESET */
39#define WM831X_WDOG_RESET_MASK 0x0800 /* WDOG_RESET */
40#define WM831X_WDOG_RESET_SHIFT 11 /* WDOG_RESET */
41#define WM831X_WDOG_RESET_WIDTH 1 /* WDOG_RESET */
42#define WM831X_WDOG_SECACT_MASK 0x0300 /* WDOG_SECACT - [9:8] */
43#define WM831X_WDOG_SECACT_SHIFT 8 /* WDOG_SECACT - [9:8] */
44#define WM831X_WDOG_SECACT_WIDTH 2 /* WDOG_SECACT - [9:8] */
45#define WM831X_WDOG_PRIMACT_MASK 0x0030 /* WDOG_PRIMACT - [5:4] */
46#define WM831X_WDOG_PRIMACT_SHIFT 4 /* WDOG_PRIMACT - [5:4] */
47#define WM831X_WDOG_PRIMACT_WIDTH 2 /* WDOG_PRIMACT - [5:4] */
48#define WM831X_WDOG_TO_MASK 0x0007 /* WDOG_TO - [2:0] */
49#define WM831X_WDOG_TO_SHIFT 0 /* WDOG_TO - [2:0] */
50#define WM831X_WDOG_TO_WIDTH 3 /* WDOG_TO - [2:0] */
51
52#endif
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 42cca672f340..1d595de6a055 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -605,6 +605,11 @@ struct wm8350_irq {
605 void *data; 605 void *data;
606}; 606};
607 607
608struct wm8350_hwmon {
609 struct platform_device *pdev;
610 struct device *classdev;
611};
612
608struct wm8350 { 613struct wm8350 {
609 struct device *dev; 614 struct device *dev;
610 615
@@ -621,7 +626,6 @@ struct wm8350 {
621 struct mutex auxadc_mutex; 626 struct mutex auxadc_mutex;
622 627
623 /* Interrupt handling */ 628 /* Interrupt handling */
624 struct work_struct irq_work;
625 struct mutex irq_mutex; /* IRQ table mutex */ 629 struct mutex irq_mutex; /* IRQ table mutex */
626 struct wm8350_irq irq[WM8350_NUM_IRQ]; 630 struct wm8350_irq irq[WM8350_NUM_IRQ];
627 int chip_irq; 631 int chip_irq;
@@ -629,6 +633,7 @@ struct wm8350 {
629 /* Client devices */ 633 /* Client devices */
630 struct wm8350_codec codec; 634 struct wm8350_codec codec;
631 struct wm8350_gpio gpio; 635 struct wm8350_gpio gpio;
636 struct wm8350_hwmon hwmon;
632 struct wm8350_pmic pmic; 637 struct wm8350_pmic pmic;
633 struct wm8350_power power; 638 struct wm8350_power power;
634 struct wm8350_rtc rtc; 639 struct wm8350_rtc rtc;
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 052117744629..adaf3c15e449 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -41,7 +41,8 @@ struct miscdevice {
41 struct list_head list; 41 struct list_head list;
42 struct device *parent; 42 struct device *parent;
43 struct device *this_device; 43 struct device *this_device;
44 const char *devnode; 44 const char *nodename;
45 mode_t mode;
45}; 46};
46 47
47extern int misc_register(struct miscdevice * misc); 48extern int misc_register(struct miscdevice * misc);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 9a72cc78e6b8..24c395694f4d 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -25,6 +25,7 @@ extern unsigned long max_mapnr;
25#endif 25#endif
26 26
27extern unsigned long num_physpages; 27extern unsigned long num_physpages;
28extern unsigned long totalram_pages;
28extern void * high_memory; 29extern void * high_memory;
29extern int page_cluster; 30extern int page_cluster;
30 31
@@ -103,6 +104,7 @@ extern unsigned int kobjsize(const void *objp);
103#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ 104#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
104#define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */ 105#define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */
105#define VM_PFN_AT_MMAP 0x40000000 /* PFNMAP vma that is fully mapped at mmap time */ 106#define VM_PFN_AT_MMAP 0x40000000 /* PFNMAP vma that is fully mapped at mmap time */
107#define VM_MERGEABLE 0x80000000 /* KSM may merge identical pages */
106 108
107#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ 109#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
108#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS 110#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
@@ -283,6 +285,14 @@ static inline int is_vmalloc_addr(const void *x)
283 return 0; 285 return 0;
284#endif 286#endif
285} 287}
288#ifdef CONFIG_MMU
289extern int is_vmalloc_or_module_addr(const void *x);
290#else
291static inline int is_vmalloc_or_module_addr(const void *x)
292{
293 return 0;
294}
295#endif
286 296
287static inline struct page *compound_head(struct page *page) 297static inline struct page *compound_head(struct page *page)
288{ 298{
@@ -685,11 +695,12 @@ static inline int page_mapped(struct page *page)
685#define VM_FAULT_SIGBUS 0x0002 695#define VM_FAULT_SIGBUS 0x0002
686#define VM_FAULT_MAJOR 0x0004 696#define VM_FAULT_MAJOR 0x0004
687#define VM_FAULT_WRITE 0x0008 /* Special case for get_user_pages */ 697#define VM_FAULT_WRITE 0x0008 /* Special case for get_user_pages */
698#define VM_FAULT_HWPOISON 0x0010 /* Hit poisoned page */
688 699
689#define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */ 700#define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */
690#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */ 701#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */
691 702
692#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS) 703#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_HWPOISON)
693 704
694/* 705/*
695 * Can be called by the pagefault handler when it gets a VM_FAULT_OOM. 706 * Can be called by the pagefault handler when it gets a VM_FAULT_OOM.
@@ -700,17 +711,8 @@ extern void pagefault_out_of_memory(void);
700 711
701extern void show_free_areas(void); 712extern void show_free_areas(void);
702 713
703#ifdef CONFIG_SHMEM 714int shmem_lock(struct file *file, int lock, struct user_struct *user);
704extern int shmem_lock(struct file *file, int lock, struct user_struct *user);
705#else
706static inline int shmem_lock(struct file *file, int lock,
707 struct user_struct *user)
708{
709 return 0;
710}
711#endif
712struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); 715struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags);
713
714int shmem_zero_setup(struct vm_area_struct *); 716int shmem_zero_setup(struct vm_area_struct *);
715 717
716#ifndef CONFIG_MMU 718#ifndef CONFIG_MMU
@@ -790,8 +792,14 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
790 unmap_mapping_range(mapping, holebegin, holelen, 0); 792 unmap_mapping_range(mapping, holebegin, holelen, 0);
791} 793}
792 794
793extern int vmtruncate(struct inode * inode, loff_t offset); 795extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new);
794extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end); 796extern int vmtruncate(struct inode *inode, loff_t offset);
797extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end);
798
799int truncate_inode_page(struct address_space *mapping, struct page *page);
800int generic_error_remove_page(struct address_space *mapping, struct page *page);
801
802int invalidate_inode_page(struct page *page);
795 803
796#ifdef CONFIG_MMU 804#ifdef CONFIG_MMU
797extern int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, 805extern int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma,
@@ -815,6 +823,7 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
815 struct page **pages, struct vm_area_struct **vmas); 823 struct page **pages, struct vm_area_struct **vmas);
816int get_user_pages_fast(unsigned long start, int nr_pages, int write, 824int get_user_pages_fast(unsigned long start, int nr_pages, int write,
817 struct page **pages); 825 struct page **pages);
826struct page *get_dump_page(unsigned long addr);
818 827
819extern int try_to_release_page(struct page * page, gfp_t gfp_mask); 828extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
820extern void do_invalidatepage(struct page *page, unsigned long offset); 829extern void do_invalidatepage(struct page *page, unsigned long offset);
@@ -1058,6 +1067,8 @@ extern void setup_per_cpu_pageset(void);
1058static inline void setup_per_cpu_pageset(void) {} 1067static inline void setup_per_cpu_pageset(void) {}
1059#endif 1068#endif
1060 1069
1070extern void zone_pcp_update(struct zone *zone);
1071
1061/* nommu.c */ 1072/* nommu.c */
1062extern atomic_long_t mmap_pages_allocated; 1073extern atomic_long_t mmap_pages_allocated;
1063 1074
@@ -1226,7 +1237,8 @@ struct page *follow_page(struct vm_area_struct *, unsigned long address,
1226#define FOLL_WRITE 0x01 /* check pte is writable */ 1237#define FOLL_WRITE 0x01 /* check pte is writable */
1227#define FOLL_TOUCH 0x02 /* mark page accessed */ 1238#define FOLL_TOUCH 0x02 /* mark page accessed */
1228#define FOLL_GET 0x04 /* do get_page on page */ 1239#define FOLL_GET 0x04 /* do get_page on page */
1229#define FOLL_ANON 0x08 /* give ZERO_PAGE if no pgtable */ 1240#define FOLL_DUMP 0x08 /* give error on hole if it would be zero */
1241#define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */
1230 1242
1231typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, 1243typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
1232 void *data); 1244 void *data);
@@ -1274,7 +1286,7 @@ int in_gate_area_no_task(unsigned long addr);
1274#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);}) 1286#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);})
1275#endif /* __HAVE_ARCH_GATE_AREA */ 1287#endif /* __HAVE_ARCH_GATE_AREA */
1276 1288
1277int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *, 1289int drop_caches_sysctl_handler(struct ctl_table *, int,
1278 void __user *, size_t *, loff_t *); 1290 void __user *, size_t *, loff_t *);
1279unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask, 1291unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
1280 unsigned long lru_pages); 1292 unsigned long lru_pages);
@@ -1303,5 +1315,12 @@ void vmemmap_populate_print_last(void);
1303extern int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim, 1315extern int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim,
1304 size_t size); 1316 size_t size);
1305extern void refund_locked_memory(struct mm_struct *mm, size_t size); 1317extern void refund_locked_memory(struct mm_struct *mm, size_t size);
1318
1319extern void memory_failure(unsigned long pfn, int trapno);
1320extern int __memory_failure(unsigned long pfn, int trapno, int ref);
1321extern int sysctl_memory_failure_early_kill;
1322extern int sysctl_memory_failure_recovery;
1323extern atomic_long_t mce_bad_pages;
1324
1306#endif /* __KERNEL__ */ 1325#endif /* __KERNEL__ */
1307#endif /* _LINUX_MM_H */ 1326#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 7fbb97267556..8835b877b8db 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -5,7 +5,7 @@
5 * page_is_file_cache - should the page be on a file LRU or anon LRU? 5 * page_is_file_cache - should the page be on a file LRU or anon LRU?
6 * @page: the page to test 6 * @page: the page to test
7 * 7 *
8 * Returns LRU_FILE if @page is page cache page backed by a regular filesystem, 8 * Returns 1 if @page is page cache page backed by a regular filesystem,
9 * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed. 9 * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed.
10 * Used by functions that manipulate the LRU lists, to sort a page 10 * Used by functions that manipulate the LRU lists, to sort a page
11 * onto the right LRU list. 11 * onto the right LRU list.
@@ -16,11 +16,7 @@
16 */ 16 */
17static inline int page_is_file_cache(struct page *page) 17static inline int page_is_file_cache(struct page *page)
18{ 18{
19 if (PageSwapBacked(page)) 19 return !PageSwapBacked(page);
20 return 0;
21
22 /* The page is page cache backed by a normal filesystem. */
23 return LRU_FILE;
24} 20}
25 21
26static inline void 22static inline void
@@ -39,21 +35,36 @@ del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l)
39 mem_cgroup_del_lru_list(page, l); 35 mem_cgroup_del_lru_list(page, l);
40} 36}
41 37
38/**
39 * page_lru_base_type - which LRU list type should a page be on?
40 * @page: the page to test
41 *
42 * Used for LRU list index arithmetic.
43 *
44 * Returns the base LRU type - file or anon - @page should be on.
45 */
46static inline enum lru_list page_lru_base_type(struct page *page)
47{
48 if (page_is_file_cache(page))
49 return LRU_INACTIVE_FILE;
50 return LRU_INACTIVE_ANON;
51}
52
42static inline void 53static inline void
43del_page_from_lru(struct zone *zone, struct page *page) 54del_page_from_lru(struct zone *zone, struct page *page)
44{ 55{
45 enum lru_list l = LRU_BASE; 56 enum lru_list l;
46 57
47 list_del(&page->lru); 58 list_del(&page->lru);
48 if (PageUnevictable(page)) { 59 if (PageUnevictable(page)) {
49 __ClearPageUnevictable(page); 60 __ClearPageUnevictable(page);
50 l = LRU_UNEVICTABLE; 61 l = LRU_UNEVICTABLE;
51 } else { 62 } else {
63 l = page_lru_base_type(page);
52 if (PageActive(page)) { 64 if (PageActive(page)) {
53 __ClearPageActive(page); 65 __ClearPageActive(page);
54 l += LRU_ACTIVE; 66 l += LRU_ACTIVE;
55 } 67 }
56 l += page_is_file_cache(page);
57 } 68 }
58 __dec_zone_state(zone, NR_LRU_BASE + l); 69 __dec_zone_state(zone, NR_LRU_BASE + l);
59 mem_cgroup_del_lru_list(page, l); 70 mem_cgroup_del_lru_list(page, l);
@@ -68,14 +79,14 @@ del_page_from_lru(struct zone *zone, struct page *page)
68 */ 79 */
69static inline enum lru_list page_lru(struct page *page) 80static inline enum lru_list page_lru(struct page *page)
70{ 81{
71 enum lru_list lru = LRU_BASE; 82 enum lru_list lru;
72 83
73 if (PageUnevictable(page)) 84 if (PageUnevictable(page))
74 lru = LRU_UNEVICTABLE; 85 lru = LRU_UNEVICTABLE;
75 else { 86 else {
87 lru = page_lru_base_type(page);
76 if (PageActive(page)) 88 if (PageActive(page))
77 lru += LRU_ACTIVE; 89 lru += LRU_ACTIVE;
78 lru += page_is_file_cache(page);
79 } 90 }
80 91
81 return lru; 92 return lru;
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 0042090a4d70..84a524afb3dc 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -171,7 +171,7 @@ struct vm_area_struct {
171 struct anon_vma *anon_vma; /* Serialized by page_table_lock */ 171 struct anon_vma *anon_vma; /* Serialized by page_table_lock */
172 172
173 /* Function pointers to deal with this struct. */ 173 /* Function pointers to deal with this struct. */
174 struct vm_operations_struct * vm_ops; 174 const struct vm_operations_struct *vm_ops;
175 175
176 /* Information about our backing store: */ 176 /* Information about our backing store: */
177 unsigned long vm_pgoff; /* Offset (within vm_file) in PAGE_SIZE 177 unsigned long vm_pgoff; /* Offset (within vm_file) in PAGE_SIZE
@@ -240,6 +240,8 @@ struct mm_struct {
240 240
241 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ 241 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */
242 242
243 struct linux_binfmt *binfmt;
244
243 cpumask_t cpu_vm_mask; 245 cpumask_t cpu_vm_mask;
244 246
245 /* Architecture-specific MM context */ 247 /* Architecture-specific MM context */
@@ -259,11 +261,10 @@ struct mm_struct {
259 unsigned long flags; /* Must use atomic bitops to access the bits */ 261 unsigned long flags; /* Must use atomic bitops to access the bits */
260 262
261 struct core_state *core_state; /* coredumping support */ 263 struct core_state *core_state; /* coredumping support */
262 264#ifdef CONFIG_AIO
263 /* aio bits */
264 spinlock_t ioctx_lock; 265 spinlock_t ioctx_lock;
265 struct hlist_head ioctx_list; 266 struct hlist_head ioctx_list;
266 267#endif
267#ifdef CONFIG_MM_OWNER 268#ifdef CONFIG_MM_OWNER
268 /* 269 /*
269 * "owner" points to a task that is regarded as the canonical 270 * "owner" points to a task that is regarded as the canonical
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 403aa505f27e..2ee22e8af110 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -40,6 +40,8 @@ struct mmc_csd {
40}; 40};
41 41
42struct mmc_ext_csd { 42struct mmc_ext_csd {
43 u8 rev;
44 unsigned int sa_timeout; /* Units: 100ns */
43 unsigned int hs_max_dtr; 45 unsigned int hs_max_dtr;
44 unsigned int sectors; 46 unsigned int sectors;
45}; 47};
@@ -62,7 +64,8 @@ struct sdio_cccr {
62 low_speed:1, 64 low_speed:1,
63 wide_bus:1, 65 wide_bus:1,
64 high_power:1, 66 high_power:1,
65 high_speed:1; 67 high_speed:1,
68 disable_cd:1;
66}; 69};
67 70
68struct sdio_cis { 71struct sdio_cis {
@@ -94,6 +97,8 @@ struct mmc_card {
94#define MMC_STATE_READONLY (1<<1) /* card is read-only */ 97#define MMC_STATE_READONLY (1<<1) /* card is read-only */
95#define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */ 98#define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */
96#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */ 99#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */
100 unsigned int quirks; /* card quirks */
101#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
97 102
98 u32 raw_cid[4]; /* raw card CID */ 103 u32 raw_cid[4]; /* raw card CID */
99 u32 raw_csd[4]; /* raw card CSD */ 104 u32 raw_csd[4]; /* raw card CSD */
@@ -129,6 +134,11 @@ struct mmc_card {
129#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED) 134#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
130#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) 135#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
131 136
137static inline int mmc_card_lenient_fn0(const struct mmc_card *c)
138{
139 return c->quirks & MMC_QUIRK_LENIENT_FN0;
140}
141
132#define mmc_card_name(c) ((c)->cid.prod_name) 142#define mmc_card_name(c) ((c)->cid.prod_name)
133#define mmc_card_id(c) (dev_name(&(c)->dev)) 143#define mmc_card_id(c) (dev_name(&(c)->dev))
134 144
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 7ac8b500d55c..e4898e9eeb59 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -139,6 +139,7 @@ extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int);
139 139
140extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort); 140extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort);
141extern void mmc_release_host(struct mmc_host *host); 141extern void mmc_release_host(struct mmc_host *host);
142extern int mmc_try_claim_host(struct mmc_host *host);
142 143
143/** 144/**
144 * mmc_claim_host - exclusively claim a host 145 * mmc_claim_host - exclusively claim a host
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 3e7615e9087e..eaf36364b7d4 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -11,6 +11,7 @@
11#define LINUX_MMC_HOST_H 11#define LINUX_MMC_HOST_H
12 12
13#include <linux/leds.h> 13#include <linux/leds.h>
14#include <linux/sched.h>
14 15
15#include <linux/mmc/core.h> 16#include <linux/mmc/core.h>
16 17
@@ -51,6 +52,35 @@ struct mmc_ios {
51}; 52};
52 53
53struct mmc_host_ops { 54struct mmc_host_ops {
55 /*
56 * Hosts that support power saving can use the 'enable' and 'disable'
57 * methods to exit and enter power saving states. 'enable' is called
58 * when the host is claimed and 'disable' is called (or scheduled with
59 * a delay) when the host is released. The 'disable' is scheduled if
60 * the disable delay set by 'mmc_set_disable_delay()' is non-zero,
61 * otherwise 'disable' is called immediately. 'disable' may be
62 * scheduled repeatedly, to permit ever greater power saving at the
63 * expense of ever greater latency to re-enable. Rescheduling is
64 * determined by the return value of the 'disable' method. A positive
65 * value gives the delay in milliseconds.
66 *
67 * In the case where a host function (like set_ios) may be called
68 * with or without the host claimed, enabling and disabling can be
69 * done directly and will nest correctly. Call 'mmc_host_enable()' and
70 * 'mmc_host_lazy_disable()' for this purpose, but note that these
71 * functions must be paired.
72 *
73 * Alternatively, 'mmc_host_enable()' may be paired with
74 * 'mmc_host_disable()' which calls 'disable' immediately. In this
75 * case the 'disable' method will be called with 'lazy' set to 0.
76 * This is mainly useful for error paths.
77 *
78 * Because lazy disable may be called from a work queue, the 'disable'
79 * method must claim the host when 'lazy' != 0, which will work
80 * correctly because recursion is detected and handled.
81 */
82 int (*enable)(struct mmc_host *host);
83 int (*disable)(struct mmc_host *host, int lazy);
54 void (*request)(struct mmc_host *host, struct mmc_request *req); 84 void (*request)(struct mmc_host *host, struct mmc_request *req);
55 /* 85 /*
56 * Avoid calling these three functions too often or in a "fast path", 86 * Avoid calling these three functions too often or in a "fast path",
@@ -118,6 +148,9 @@ struct mmc_host {
118#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ 148#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */
119#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ 149#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */
120#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */ 150#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */
151#define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */
152#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */
153#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
121 154
122 /* host specific block data */ 155 /* host specific block data */
123 unsigned int max_seg_size; /* see blk_queue_max_segment_size */ 156 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
@@ -142,9 +175,18 @@ struct mmc_host {
142 unsigned int removed:1; /* host is being removed */ 175 unsigned int removed:1; /* host is being removed */
143#endif 176#endif
144 177
178 /* Only used with MMC_CAP_DISABLE */
179 int enabled; /* host is enabled */
180 int nesting_cnt; /* "enable" nesting count */
181 int en_dis_recurs; /* detect recursion */
182 unsigned int disable_delay; /* disable delay in msecs */
183 struct delayed_work disable; /* disabling work */
184
145 struct mmc_card *card; /* device attached to this host */ 185 struct mmc_card *card; /* device attached to this host */
146 186
147 wait_queue_head_t wq; 187 wait_queue_head_t wq;
188 struct task_struct *claimer; /* task that has host claimed */
189 int claim_cnt; /* "claim" nesting count */
148 190
149 struct delayed_work detect; 191 struct delayed_work detect;
150 192
@@ -183,6 +225,9 @@ static inline void *mmc_priv(struct mmc_host *host)
183extern int mmc_suspend_host(struct mmc_host *, pm_message_t); 225extern int mmc_suspend_host(struct mmc_host *, pm_message_t);
184extern int mmc_resume_host(struct mmc_host *); 226extern int mmc_resume_host(struct mmc_host *);
185 227
228extern void mmc_power_save_host(struct mmc_host *host);
229extern void mmc_power_restore_host(struct mmc_host *host);
230
186extern void mmc_detect_change(struct mmc_host *, unsigned long delay); 231extern void mmc_detect_change(struct mmc_host *, unsigned long delay);
187extern void mmc_request_done(struct mmc_host *, struct mmc_request *); 232extern void mmc_request_done(struct mmc_host *, struct mmc_request *);
188 233
@@ -197,5 +242,19 @@ struct regulator;
197int mmc_regulator_get_ocrmask(struct regulator *supply); 242int mmc_regulator_get_ocrmask(struct regulator *supply);
198int mmc_regulator_set_ocr(struct regulator *supply, unsigned short vdd_bit); 243int mmc_regulator_set_ocr(struct regulator *supply, unsigned short vdd_bit);
199 244
245int mmc_card_awake(struct mmc_host *host);
246int mmc_card_sleep(struct mmc_host *host);
247int mmc_card_can_sleep(struct mmc_host *host);
248
249int mmc_host_enable(struct mmc_host *host);
250int mmc_host_disable(struct mmc_host *host);
251int mmc_host_lazy_disable(struct mmc_host *host);
252
253static inline void mmc_set_disable_delay(struct mmc_host *host,
254 unsigned int disable_delay)
255{
256 host->disable_delay = disable_delay;
257}
258
200#endif 259#endif
201 260
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 14b81f3e5232..c02c8db73701 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -31,6 +31,7 @@
31#define MMC_ALL_SEND_CID 2 /* bcr R2 */ 31#define MMC_ALL_SEND_CID 2 /* bcr R2 */
32#define MMC_SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */ 32#define MMC_SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */
33#define MMC_SET_DSR 4 /* bc [31:16] RCA */ 33#define MMC_SET_DSR 4 /* bc [31:16] RCA */
34#define MMC_SLEEP_AWAKE 5 /* ac [31:16] RCA 15:flg R1b */
34#define MMC_SWITCH 6 /* ac [31:0] See below R1b */ 35#define MMC_SWITCH 6 /* ac [31:0] See below R1b */
35#define MMC_SELECT_CARD 7 /* ac [31:16] RCA R1 */ 36#define MMC_SELECT_CARD 7 /* ac [31:16] RCA R1 */
36#define MMC_SEND_EXT_CSD 8 /* adtc R1 */ 37#define MMC_SEND_EXT_CSD 8 /* adtc R1 */
@@ -127,6 +128,7 @@
127#define R1_STATUS(x) (x & 0xFFFFE000) 128#define R1_STATUS(x) (x & 0xFFFFE000)
128#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */ 129#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */
129#define R1_READY_FOR_DATA (1 << 8) /* sx, a */ 130#define R1_READY_FOR_DATA (1 << 8) /* sx, a */
131#define R1_SWITCH_ERROR (1 << 7) /* sx, c */
130#define R1_APP_CMD (1 << 5) /* sr, c */ 132#define R1_APP_CMD (1 << 5) /* sr, c */
131 133
132/* 134/*
@@ -254,6 +256,7 @@ struct _mmc_csd {
254#define EXT_CSD_CARD_TYPE 196 /* RO */ 256#define EXT_CSD_CARD_TYPE 196 /* RO */
255#define EXT_CSD_REV 192 /* RO */ 257#define EXT_CSD_REV 192 /* RO */
256#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ 258#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
259#define EXT_CSD_S_A_TIMEOUT 217
257 260
258/* 261/*
259 * EXT_CSD field definitions 262 * EXT_CSD field definitions
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
index 451bdfc85830..ac3ab683fec6 100644
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -67,6 +67,7 @@ struct sdio_func {
67 67
68#define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev) 68#define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev)
69#define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d) 69#define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d)
70#define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev)
70 71
71/* 72/*
72 * SDIO function device driver 73 * SDIO function device driver
@@ -81,6 +82,8 @@ struct sdio_driver {
81 struct device_driver drv; 82 struct device_driver drv;
82}; 83};
83 84
85#define to_sdio_driver(d) container_of(d, struct sdio_driver, drv)
86
84/** 87/**
85 * SDIO_DEVICE - macro used to describe a specific SDIO device 88 * SDIO_DEVICE - macro used to describe a specific SDIO device
86 * @vend: the 16 bit manufacturer code 89 * @vend: the 16 bit manufacturer code
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index 39751c8cde9c..2dbfb5a05994 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -22,6 +22,12 @@
22/* 22/*
23 * Vendors and devices. Sort key: vendor first, device next. 23 * Vendors and devices. Sort key: vendor first, device next.
24 */ 24 */
25#define SDIO_VENDOR_ID_INTEL 0x0089
26#define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX 0x1402
27#define SDIO_DEVICE_ID_INTEL_IWMC3200WIFI 0x1403
28#define SDIO_DEVICE_ID_INTEL_IWMC3200TOP 0x1404
29#define SDIO_DEVICE_ID_INTEL_IWMC3200GPS 0x1405
30#define SDIO_DEVICE_ID_INTEL_IWMC3200BT 0x1406
25 31
26#define SDIO_VENDOR_ID_MARVELL 0x02df 32#define SDIO_VENDOR_ID_MARVELL 0x02df
27#define SDIO_DEVICE_ID_MARVELL_LIBERTAS 0x9103 33#define SDIO_DEVICE_ID_MARVELL_LIBERTAS 0x9103
diff --git a/include/linux/mmu_context.h b/include/linux/mmu_context.h
new file mode 100644
index 000000000000..70fffeba7495
--- /dev/null
+++ b/include/linux/mmu_context.h
@@ -0,0 +1,9 @@
1#ifndef _LINUX_MMU_CONTEXT_H
2#define _LINUX_MMU_CONTEXT_H
3
4struct mm_struct;
5
6void use_mm(struct mm_struct *mm);
7void unuse_mm(struct mm_struct *mm);
8
9#endif
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index b77486d152cd..4e02ee2b071e 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -62,6 +62,15 @@ struct mmu_notifier_ops {
62 unsigned long address); 62 unsigned long address);
63 63
64 /* 64 /*
65 * change_pte is called in cases that pte mapping to page is changed:
66 * for example, when ksm remaps pte to point to a new shared page.
67 */
68 void (*change_pte)(struct mmu_notifier *mn,
69 struct mm_struct *mm,
70 unsigned long address,
71 pte_t pte);
72
73 /*
65 * Before this is invoked any secondary MMU is still ok to 74 * Before this is invoked any secondary MMU is still ok to
66 * read/write to the page previously pointed to by the Linux 75 * 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 76 * pte because the page hasn't been freed yet and it won't be
@@ -154,6 +163,8 @@ extern void __mmu_notifier_mm_destroy(struct mm_struct *mm);
154extern void __mmu_notifier_release(struct mm_struct *mm); 163extern void __mmu_notifier_release(struct mm_struct *mm);
155extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm, 164extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm,
156 unsigned long address); 165 unsigned long address);
166extern void __mmu_notifier_change_pte(struct mm_struct *mm,
167 unsigned long address, pte_t pte);
157extern void __mmu_notifier_invalidate_page(struct mm_struct *mm, 168extern void __mmu_notifier_invalidate_page(struct mm_struct *mm,
158 unsigned long address); 169 unsigned long address);
159extern void __mmu_notifier_invalidate_range_start(struct mm_struct *mm, 170extern void __mmu_notifier_invalidate_range_start(struct mm_struct *mm,
@@ -175,6 +186,13 @@ static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
175 return 0; 186 return 0;
176} 187}
177 188
189static inline void mmu_notifier_change_pte(struct mm_struct *mm,
190 unsigned long address, pte_t pte)
191{
192 if (mm_has_notifiers(mm))
193 __mmu_notifier_change_pte(mm, address, pte);
194}
195
178static inline void mmu_notifier_invalidate_page(struct mm_struct *mm, 196static inline void mmu_notifier_invalidate_page(struct mm_struct *mm,
179 unsigned long address) 197 unsigned long address)
180{ 198{
@@ -236,6 +254,16 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
236 __young; \ 254 __young; \
237}) 255})
238 256
257#define set_pte_at_notify(__mm, __address, __ptep, __pte) \
258({ \
259 struct mm_struct *___mm = __mm; \
260 unsigned long ___address = __address; \
261 pte_t ___pte = __pte; \
262 \
263 set_pte_at(___mm, ___address, __ptep, ___pte); \
264 mmu_notifier_change_pte(___mm, ___address, ___pte); \
265})
266
239#else /* CONFIG_MMU_NOTIFIER */ 267#else /* CONFIG_MMU_NOTIFIER */
240 268
241static inline void mmu_notifier_release(struct mm_struct *mm) 269static inline void mmu_notifier_release(struct mm_struct *mm)
@@ -248,6 +276,11 @@ static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
248 return 0; 276 return 0;
249} 277}
250 278
279static inline void mmu_notifier_change_pte(struct mm_struct *mm,
280 unsigned long address, pte_t pte)
281{
282}
283
251static inline void mmu_notifier_invalidate_page(struct mm_struct *mm, 284static inline void mmu_notifier_invalidate_page(struct mm_struct *mm,
252 unsigned long address) 285 unsigned long address)
253{ 286{
@@ -273,6 +306,7 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
273 306
274#define ptep_clear_flush_young_notify ptep_clear_flush_young 307#define ptep_clear_flush_young_notify ptep_clear_flush_young
275#define ptep_clear_flush_notify ptep_clear_flush 308#define ptep_clear_flush_notify ptep_clear_flush
309#define set_pte_at_notify set_pte_at
276 310
277#endif /* CONFIG_MMU_NOTIFIER */ 311#endif /* CONFIG_MMU_NOTIFIER */
278 312
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 889598537370..6f7561730d88 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -38,6 +38,7 @@
38#define MIGRATE_UNMOVABLE 0 38#define MIGRATE_UNMOVABLE 0
39#define MIGRATE_RECLAIMABLE 1 39#define MIGRATE_RECLAIMABLE 1
40#define MIGRATE_MOVABLE 2 40#define MIGRATE_MOVABLE 2
41#define MIGRATE_PCPTYPES 3 /* the number of types on the pcp lists */
41#define MIGRATE_RESERVE 3 42#define MIGRATE_RESERVE 3
42#define MIGRATE_ISOLATE 4 /* can't allocate from here */ 43#define MIGRATE_ISOLATE 4 /* can't allocate from here */
43#define MIGRATE_TYPES 5 44#define MIGRATE_TYPES 5
@@ -94,11 +95,15 @@ enum zone_stat_item {
94 NR_SLAB_RECLAIMABLE, 95 NR_SLAB_RECLAIMABLE,
95 NR_SLAB_UNRECLAIMABLE, 96 NR_SLAB_UNRECLAIMABLE,
96 NR_PAGETABLE, /* used for pagetables */ 97 NR_PAGETABLE, /* used for pagetables */
98 NR_KERNEL_STACK,
99 /* Second 128 byte cacheline */
97 NR_UNSTABLE_NFS, /* NFS unstable pages */ 100 NR_UNSTABLE_NFS, /* NFS unstable pages */
98 NR_BOUNCE, 101 NR_BOUNCE,
99 NR_VMSCAN_WRITE, 102 NR_VMSCAN_WRITE,
100 /* Second 128 byte cacheline */
101 NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */ 103 NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */
104 NR_ISOLATED_ANON, /* Temporary isolated pages from anon lru */
105 NR_ISOLATED_FILE, /* Temporary isolated pages from file lru */
106 NR_SHMEM, /* shmem pages (included tmpfs/GEM pages) */
102#ifdef CONFIG_NUMA 107#ifdef CONFIG_NUMA
103 NUMA_HIT, /* allocated in intended node */ 108 NUMA_HIT, /* allocated in intended node */
104 NUMA_MISS, /* allocated in non intended node */ 109 NUMA_MISS, /* allocated in non intended node */
@@ -165,7 +170,9 @@ struct per_cpu_pages {
165 int count; /* number of pages in the list */ 170 int count; /* number of pages in the list */
166 int high; /* high watermark, emptying needed */ 171 int high; /* high watermark, emptying needed */
167 int batch; /* chunk size for buddy add/remove */ 172 int batch; /* chunk size for buddy add/remove */
168 struct list_head list; /* the list of pages */ 173
174 /* Lists of pages, one per migrate type stored on the pcp-lists */
175 struct list_head lists[MIGRATE_PCPTYPES];
169}; 176};
170 177
171struct per_cpu_pageset { 178struct per_cpu_pageset {
@@ -269,6 +276,11 @@ struct zone_reclaim_stat {
269 */ 276 */
270 unsigned long recent_rotated[2]; 277 unsigned long recent_rotated[2];
271 unsigned long recent_scanned[2]; 278 unsigned long recent_scanned[2];
279
280 /*
281 * accumulated for batching
282 */
283 unsigned long nr_saved_scan[NR_LRU_LISTS];
272}; 284};
273 285
274struct zone { 286struct zone {
@@ -323,7 +335,6 @@ struct zone {
323 spinlock_t lru_lock; 335 spinlock_t lru_lock;
324 struct zone_lru { 336 struct zone_lru {
325 struct list_head list; 337 struct list_head list;
326 unsigned long nr_saved_scan; /* accumulated for batching */
327 } lru[NR_LRU_LISTS]; 338 } lru[NR_LRU_LISTS];
328 339
329 struct zone_reclaim_stat reclaim_stat; 340 struct zone_reclaim_stat reclaim_stat;
@@ -744,21 +755,20 @@ static inline int is_dma(struct zone *zone)
744 755
745/* These two functions are used to setup the per zone pages min values */ 756/* These two functions are used to setup the per zone pages min values */
746struct ctl_table; 757struct ctl_table;
747struct file; 758int min_free_kbytes_sysctl_handler(struct ctl_table *, int,
748int min_free_kbytes_sysctl_handler(struct ctl_table *, int, struct file *,
749 void __user *, size_t *, loff_t *); 759 void __user *, size_t *, loff_t *);
750extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1]; 760extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1];
751int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *, 761int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int,
752 void __user *, size_t *, loff_t *); 762 void __user *, size_t *, loff_t *);
753int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int, struct file *, 763int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int,
754 void __user *, size_t *, loff_t *); 764 void __user *, size_t *, loff_t *);
755int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int, 765int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int,
756 struct file *, void __user *, size_t *, loff_t *); 766 void __user *, size_t *, loff_t *);
757int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int, 767int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int,
758 struct file *, void __user *, size_t *, loff_t *); 768 void __user *, size_t *, loff_t *);
759 769
760extern int numa_zonelist_order_handler(struct ctl_table *, int, 770extern int numa_zonelist_order_handler(struct ctl_table *, int,
761 struct file *, void __user *, size_t *, loff_t *); 771 void __user *, size_t *, loff_t *);
762extern char numa_zonelist_order[]; 772extern char numa_zonelist_order[];
763#define NUMA_ZONELIST_ORDER_LEN 16 /* string buffer size */ 773#define NUMA_ZONELIST_ORDER_LEN 16 /* string buffer size */
764 774
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 1bf5900ffe43..f58e9d836f32 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -399,6 +399,17 @@ struct i2c_device_id {
399 __attribute__((aligned(sizeof(kernel_ulong_t)))); 399 __attribute__((aligned(sizeof(kernel_ulong_t))));
400}; 400};
401 401
402/* spi */
403
404#define SPI_NAME_SIZE 32
405#define SPI_MODULE_PREFIX "spi:"
406
407struct spi_device_id {
408 char name[SPI_NAME_SIZE];
409 kernel_ulong_t driver_data /* Data private to the driver */
410 __attribute__((aligned(sizeof(kernel_ulong_t))));
411};
412
402/* dmi */ 413/* dmi */
403enum dmi_field { 414enum dmi_field {
404 DMI_NONE, 415 DMI_NONE,
diff --git a/include/linux/module.h b/include/linux/module.h
index 098bdb7bfacf..482efc865acf 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -15,12 +15,13 @@
15#include <linux/stringify.h> 15#include <linux/stringify.h>
16#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/moduleparam.h> 17#include <linux/moduleparam.h>
18#include <linux/marker.h>
19#include <linux/tracepoint.h> 18#include <linux/tracepoint.h>
20#include <asm/local.h>
21 19
20#include <asm/local.h>
22#include <asm/module.h> 21#include <asm/module.h>
23 22
23#include <trace/events/module.h>
24
24/* Not Yet Implemented */ 25/* Not Yet Implemented */
25#define MODULE_SUPPORTED_DEVICE(name) 26#define MODULE_SUPPORTED_DEVICE(name)
26 27
@@ -127,7 +128,10 @@ extern struct module __this_module;
127 */ 128 */
128#define MODULE_LICENSE(_license) MODULE_INFO(license, _license) 129#define MODULE_LICENSE(_license) MODULE_INFO(license, _license)
129 130
130/* Author, ideally of form NAME[, NAME]*[ and NAME] */ 131/*
132 * Author(s), use "Name <email>" or just "Name", for multiple
133 * authors use multiple MODULE_AUTHOR() statements/lines.
134 */
131#define MODULE_AUTHOR(_author) MODULE_INFO(author, _author) 135#define MODULE_AUTHOR(_author) MODULE_INFO(author, _author)
132 136
133/* What your module does. */ 137/* What your module does. */
@@ -307,10 +311,14 @@ struct module
307#endif 311#endif
308 312
309#ifdef CONFIG_KALLSYMS 313#ifdef CONFIG_KALLSYMS
310 /* We keep the symbol and string tables for kallsyms. */ 314 /*
311 Elf_Sym *symtab; 315 * We keep the symbol and string tables for kallsyms.
312 unsigned int num_symtab; 316 * The core_* fields below are temporary, loader-only (they
313 char *strtab; 317 * could really be discarded after module init).
318 */
319 Elf_Sym *symtab, *core_symtab;
320 unsigned int num_symtab, core_num_syms;
321 char *strtab, *core_strtab;
314 322
315 /* Section attributes */ 323 /* Section attributes */
316 struct module_sect_attrs *sect_attrs; 324 struct module_sect_attrs *sect_attrs;
@@ -325,10 +333,6 @@ struct module
325 /* The command line arguments (may be mangled). People like 333 /* The command line arguments (may be mangled). People like
326 keeping pointers to this stuff */ 334 keeping pointers to this stuff */
327 char *args; 335 char *args;
328#ifdef CONFIG_MARKERS
329 struct marker *markers;
330 unsigned int num_markers;
331#endif
332#ifdef CONFIG_TRACEPOINTS 336#ifdef CONFIG_TRACEPOINTS
333 struct tracepoint *tracepoints; 337 struct tracepoint *tracepoints;
334 unsigned int num_tracepoints; 338 unsigned int num_tracepoints;
@@ -462,7 +466,10 @@ static inline local_t *__module_ref_addr(struct module *mod, int cpu)
462static inline void __module_get(struct module *module) 466static inline void __module_get(struct module *module)
463{ 467{
464 if (module) { 468 if (module) {
465 local_inc(__module_ref_addr(module, get_cpu())); 469 unsigned int cpu = get_cpu();
470 local_inc(__module_ref_addr(module, cpu));
471 trace_module_get(module, _THIS_IP_,
472 local_read(__module_ref_addr(module, cpu)));
466 put_cpu(); 473 put_cpu();
467 } 474 }
468} 475}
@@ -473,8 +480,11 @@ static inline int try_module_get(struct module *module)
473 480
474 if (module) { 481 if (module) {
475 unsigned int cpu = get_cpu(); 482 unsigned int cpu = get_cpu();
476 if (likely(module_is_live(module))) 483 if (likely(module_is_live(module))) {
477 local_inc(__module_ref_addr(module, cpu)); 484 local_inc(__module_ref_addr(module, cpu));
485 trace_module_get(module, _THIS_IP_,
486 local_read(__module_ref_addr(module, cpu)));
487 }
478 else 488 else
479 ret = 0; 489 ret = 0;
480 put_cpu(); 490 put_cpu();
@@ -527,8 +537,6 @@ int unregister_module_notifier(struct notifier_block * nb);
527 537
528extern void print_modules(void); 538extern void print_modules(void);
529 539
530extern void module_update_markers(void);
531
532extern void module_update_tracepoints(void); 540extern void module_update_tracepoints(void);
533extern int module_get_iter_tracepoints(struct tracepoint_iter *iter); 541extern int module_get_iter_tracepoints(struct tracepoint_iter *iter);
534 542
@@ -643,10 +651,6 @@ static inline void print_modules(void)
643{ 651{
644} 652}
645 653
646static inline void module_update_markers(void)
647{
648}
649
650static inline void module_update_tracepoints(void) 654static inline void module_update_tracepoints(void)
651{ 655{
652} 656}
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 6547c3cdbc4c..82a9124f7d75 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -37,7 +37,6 @@ typedef int (*param_set_fn)(const char *val, struct kernel_param *kp);
37typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp); 37typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp);
38 38
39/* Flag bits for kernel_param.flags */ 39/* Flag bits for kernel_param.flags */
40#define KPARAM_KMALLOCED 1
41#define KPARAM_ISBOOL 2 40#define KPARAM_ISBOOL 2
42 41
43struct kernel_param { 42struct kernel_param {
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index 0d45b4e8d367..08bc776d05e2 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -145,14 +145,14 @@ static inline int ip_mroute_opt(int opt)
145#endif 145#endif
146 146
147#ifdef CONFIG_IP_MROUTE 147#ifdef CONFIG_IP_MROUTE
148extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int); 148extern int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
149extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); 149extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
150extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); 150extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
151extern int ip_mr_init(void); 151extern int ip_mr_init(void);
152#else 152#else
153static inline 153static inline
154int ip_mroute_setsockopt(struct sock *sock, 154int ip_mroute_setsockopt(struct sock *sock,
155 int optname, char __user *optval, int optlen) 155 int optname, char __user *optval, unsigned int optlen)
156{ 156{
157 return -ENOPROTOOPT; 157 return -ENOPROTOOPT;
158} 158}
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index 43dc97e32183..b191865a6ca3 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -134,7 +134,7 @@ static inline int ip6_mroute_opt(int opt)
134struct sock; 134struct sock;
135 135
136#ifdef CONFIG_IPV6_MROUTE 136#ifdef CONFIG_IPV6_MROUTE
137extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, int); 137extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
138extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *); 138extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
139extern int ip6_mr_input(struct sk_buff *skb); 139extern int ip6_mr_input(struct sk_buff *skb);
140extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg); 140extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);
@@ -143,7 +143,7 @@ extern void ip6_mr_cleanup(void);
143#else 143#else
144static inline 144static inline
145int ip6_mroute_setsockopt(struct sock *sock, 145int ip6_mroute_setsockopt(struct sock *sock,
146 int optname, char __user *optval, int optlen) 146 int optname, char __user *optval, unsigned int optlen)
147{ 147{
148 return -ENOPROTOOPT; 148 return -ENOPROTOOPT;
149} 149}
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 4030ebada49e..7a232a9bdd62 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -121,6 +121,7 @@ typedef enum {
121 NAND_ECC_SOFT, 121 NAND_ECC_SOFT,
122 NAND_ECC_HW, 122 NAND_ECC_HW,
123 NAND_ECC_HW_SYNDROME, 123 NAND_ECC_HW_SYNDROME,
124 NAND_ECC_HW_OOB_FIRST,
124} nand_ecc_modes_t; 125} nand_ecc_modes_t;
125 126
126/* 127/*
@@ -271,13 +272,13 @@ struct nand_ecc_ctrl {
271 uint8_t *calc_ecc); 272 uint8_t *calc_ecc);
272 int (*read_page_raw)(struct mtd_info *mtd, 273 int (*read_page_raw)(struct mtd_info *mtd,
273 struct nand_chip *chip, 274 struct nand_chip *chip,
274 uint8_t *buf); 275 uint8_t *buf, int page);
275 void (*write_page_raw)(struct mtd_info *mtd, 276 void (*write_page_raw)(struct mtd_info *mtd,
276 struct nand_chip *chip, 277 struct nand_chip *chip,
277 const uint8_t *buf); 278 const uint8_t *buf);
278 int (*read_page)(struct mtd_info *mtd, 279 int (*read_page)(struct mtd_info *mtd,
279 struct nand_chip *chip, 280 struct nand_chip *chip,
280 uint8_t *buf); 281 uint8_t *buf, int page);
281 int (*read_subpage)(struct mtd_info *mtd, 282 int (*read_subpage)(struct mtd_info *mtd,
282 struct nand_chip *chip, 283 struct nand_chip *chip,
283 uint32_t offs, uint32_t len, 284 uint32_t offs, uint32_t len,
diff --git a/include/linux/mtd/nand_ecc.h b/include/linux/mtd/nand_ecc.h
index 090da505425d..052ea8ca2434 100644
--- a/include/linux/mtd/nand_ecc.h
+++ b/include/linux/mtd/nand_ecc.h
@@ -21,6 +21,12 @@ struct mtd_info;
21int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code); 21int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code);
22 22
23/* 23/*
24 * Detect and correct a 1 bit error for eccsize byte block
25 */
26int __nand_correct_data(u_char *dat, u_char *read_ecc, u_char *calc_ecc,
27 unsigned int eccsize);
28
29/*
24 * Detect and correct a 1 bit error for 256 byte block 30 * Detect and correct a 1 bit error for 256 byte block
25 */ 31 */
26int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc); 32int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc);
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 8ed873374381..4e49f3350678 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -214,4 +214,12 @@ unsigned onenand_block(struct onenand_chip *this, loff_t addr);
214loff_t onenand_addr(struct onenand_chip *this, int block); 214loff_t onenand_addr(struct onenand_chip *this, int block);
215int flexonenand_region(struct mtd_info *mtd, loff_t addr); 215int flexonenand_region(struct mtd_info *mtd, loff_t addr);
216 216
217struct mtd_partition;
218
219struct onenand_platform_data {
220 void (*mmcontrol)(struct mtd_info *mtd, int sync_read);
221 struct mtd_partition *parts;
222 unsigned int nr_parts;
223};
224
217#endif /* __LINUX_MTD_ONENAND_H */ 225#endif /* __LINUX_MTD_ONENAND_H */
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h
index 86a6bbef6465..acadbf53a69f 100644
--- a/include/linux/mtd/onenand_regs.h
+++ b/include/linux/mtd/onenand_regs.h
@@ -207,6 +207,9 @@
207#define ONENAND_ECC_2BIT (1 << 1) 207#define ONENAND_ECC_2BIT (1 << 1)
208#define ONENAND_ECC_2BIT_ALL (0xAAAA) 208#define ONENAND_ECC_2BIT_ALL (0xAAAA)
209#define FLEXONENAND_UNCORRECTABLE_ERROR (0x1010) 209#define FLEXONENAND_UNCORRECTABLE_ERROR (0x1010)
210#define ONENAND_ECC_3BIT (1 << 2)
211#define ONENAND_ECC_4BIT (1 << 3)
212#define ONENAND_ECC_4BIT_UNCORRECTABLE (0x1010)
210 213
211/* 214/*
212 * One-Time Programmable (OTP) 215 * One-Time Programmable (OTP)
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index b70313d33ff8..274b6196091d 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * MTD partitioning layer definitions 2 * MTD partitioning layer definitions
3 * 3 *
4 * (C) 2000 Nicolas Pitre <nico@cam.org> 4 * (C) 2000 Nicolas Pitre <nico@fluxnic.net>
5 * 5 *
6 * This code is GPL 6 * This code is GPL
7 */ 7 */
diff --git a/include/linux/namei.h b/include/linux/namei.h
index d870ae2faedc..ec0f607b364a 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -40,7 +40,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
40 * - follow links at the end 40 * - follow links at the end
41 * - require a directory 41 * - require a directory
42 * - ending slashes ok even for nonexistent files 42 * - ending slashes ok even for nonexistent files
43 * - internal "there are more path compnents" flag 43 * - internal "there are more path components" flag
44 * - locked when lookup done with dcache_lock held 44 * - locked when lookup done with dcache_lock held
45 * - dentry cache is untrusted; force a real lookup 45 * - dentry cache is untrusted; force a real lookup
46 */ 46 */
diff --git a/include/linux/net.h b/include/linux/net.h
index 4fc2ffd527f9..529a0931711d 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -57,6 +57,7 @@ typedef enum {
57#include <linux/random.h> 57#include <linux/random.h>
58#include <linux/wait.h> 58#include <linux/wait.h>
59#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */ 59#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */
60#include <linux/kmemcheck.h>
60 61
61struct poll_table_struct; 62struct poll_table_struct;
62struct pipe_inode_info; 63struct pipe_inode_info;
@@ -127,7 +128,11 @@ enum sock_shutdown_cmd {
127 */ 128 */
128struct socket { 129struct socket {
129 socket_state state; 130 socket_state state;
131
132 kmemcheck_bitfield_begin(type);
130 short type; 133 short type;
134 kmemcheck_bitfield_end(type);
135
131 unsigned long flags; 136 unsigned long flags;
132 /* 137 /*
133 * Please keep fasync_list & wait fields in the same cache line 138 * Please keep fasync_list & wait fields in the same cache line
@@ -173,11 +178,11 @@ struct proto_ops {
173 int (*listen) (struct socket *sock, int len); 178 int (*listen) (struct socket *sock, int len);
174 int (*shutdown) (struct socket *sock, int flags); 179 int (*shutdown) (struct socket *sock, int flags);
175 int (*setsockopt)(struct socket *sock, int level, 180 int (*setsockopt)(struct socket *sock, int level,
176 int optname, char __user *optval, int optlen); 181 int optname, char __user *optval, unsigned int optlen);
177 int (*getsockopt)(struct socket *sock, int level, 182 int (*getsockopt)(struct socket *sock, int level,
178 int optname, char __user *optval, int __user *optlen); 183 int optname, char __user *optval, int __user *optlen);
179 int (*compat_setsockopt)(struct socket *sock, int level, 184 int (*compat_setsockopt)(struct socket *sock, int level,
180 int optname, char __user *optval, int optlen); 185 int optname, char __user *optval, unsigned int optlen);
181 int (*compat_getsockopt)(struct socket *sock, int level, 186 int (*compat_getsockopt)(struct socket *sock, int level,
182 int optname, char __user *optval, int __user *optlen); 187 int optname, char __user *optval, int __user *optlen);
183 int (*sendmsg) (struct kiocb *iocb, struct socket *sock, 188 int (*sendmsg) (struct kiocb *iocb, struct socket *sock,
@@ -251,7 +256,7 @@ extern int kernel_getpeername(struct socket *sock, struct sockaddr *addr,
251extern int kernel_getsockopt(struct socket *sock, int level, int optname, 256extern int kernel_getsockopt(struct socket *sock, int level, int optname,
252 char *optval, int *optlen); 257 char *optval, int *optlen);
253extern int kernel_setsockopt(struct socket *sock, int level, int optname, 258extern int kernel_setsockopt(struct socket *sock, int level, int optname,
254 char *optval, int optlen); 259 char *optval, unsigned int optlen);
255extern int kernel_sendpage(struct socket *sock, struct page *page, int offset, 260extern int kernel_sendpage(struct socket *sock, struct page *page, int offset,
256 size_t size, int flags); 261 size_t size, int flags);
257extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg); 262extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg);
@@ -308,7 +313,7 @@ SOCKCALL_WRAP(name, compat_ioctl, (struct socket *sock, unsigned int cmd, \
308SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \ 313SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \
309SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \ 314SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \
310SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \ 315SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \
311 char __user *optval, int optlen), (sock, level, optname, optval, optlen)) \ 316 char __user *optval, unsigned int optlen), (sock, level, optname, optval, optlen)) \
312SOCKCALL_WRAP(name, getsockopt, (struct socket *sock, int level, int optname, \ 317SOCKCALL_WRAP(name, getsockopt, (struct socket *sock, int level, int optname, \
313 char __user *optval, int __user *optlen), (sock, level, optname, optval, optlen)) \ 318 char __user *optval, int __user *optlen), (sock, level, optname, optval, optlen)) \
314SOCKCALL_WRAP(name, sendmsg, (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len), \ 319SOCKCALL_WRAP(name, sendmsg, (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len), \
diff --git a/include/linux/net_dropmon.h b/include/linux/net_dropmon.h
index 3ceb0cc1bc78..2a739462caeb 100644
--- a/include/linux/net_dropmon.h
+++ b/include/linux/net_dropmon.h
@@ -3,7 +3,6 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/netlink.h> 5#include <linux/netlink.h>
6#include <linux/types.h>
7 6
8struct net_dm_drop_point { 7struct net_dm_drop_point {
9 __u8 pc[8]; 8 __u8 pc[8];
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d4a4d9867794..812a5f3c2abe 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -72,10 +72,6 @@ struct wireless_dev;
72/* Backlog congestion levels */ 72/* Backlog congestion levels */
73#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ 73#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
74#define NET_RX_DROP 1 /* packet dropped */ 74#define NET_RX_DROP 1 /* packet dropped */
75#define NET_RX_CN_LOW 2 /* storm alert, just in case */
76#define NET_RX_CN_MOD 3 /* Storm on its way! */
77#define NET_RX_CN_HIGH 4 /* The storm is here */
78#define NET_RX_BAD 5 /* packet dropped due to kernel error */
79 75
80/* NET_XMIT_CN is special. It does not guarantee that this packet is lost. It 76/* NET_XMIT_CN is special. It does not guarantee that this packet is lost. It
81 * indicates that the device will soon be dropping packets, or already drops 77 * indicates that the device will soon be dropping packets, or already drops
@@ -83,17 +79,19 @@ struct wireless_dev;
83#define net_xmit_eval(e) ((e) == NET_XMIT_CN? 0 : (e)) 79#define net_xmit_eval(e) ((e) == NET_XMIT_CN? 0 : (e))
84#define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0) 80#define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0)
85 81
82/* Driver transmit return codes */
83enum netdev_tx {
84 NETDEV_TX_OK = 0, /* driver took care of packet */
85 NETDEV_TX_BUSY, /* driver tx path was busy*/
86 NETDEV_TX_LOCKED = -1, /* driver tx lock was already taken */
87};
88typedef enum netdev_tx netdev_tx_t;
89
86#endif 90#endif
87 91
88#define MAX_ADDR_LEN 32 /* Largest hardware address length */ 92#define MAX_ADDR_LEN 32 /* Largest hardware address length */
89 93
90/* Driver transmit return codes */
91#define NETDEV_TX_OK 0 /* driver took care of packet */
92#define NETDEV_TX_BUSY 1 /* driver tx path was busy*/
93#define NETDEV_TX_LOCKED -1 /* driver tx lock was already taken */
94
95#ifdef __KERNEL__ 94#ifdef __KERNEL__
96
97/* 95/*
98 * Compute the worst case header length according to the protocols 96 * Compute the worst case header length according to the protocols
99 * used. 97 * used.
@@ -511,9 +509,11 @@ struct netdev_queue {
511 * This function is called when network device transistions to the down 509 * This function is called when network device transistions to the down
512 * state. 510 * state.
513 * 511 *
514 * int (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev); 512 * netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb,
513 * struct net_device *dev);
515 * Called when a packet needs to be transmitted. 514 * Called when a packet needs to be transmitted.
516 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY, or NETDEV_TX_LOCKED, 515 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY.
516 * (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX)
517 * Required can not be NULL. 517 * Required can not be NULL.
518 * 518 *
519 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb); 519 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb);
@@ -557,7 +557,7 @@ struct netdev_queue {
557 * Callback uses when the transmitter has not made any progress 557 * Callback uses when the transmitter has not made any progress
558 * for dev->watchdog ticks. 558 * for dev->watchdog ticks.
559 * 559 *
560 * struct net_device_stats* (*get_stats)(struct net_device *dev); 560 * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
561 * Called when a user wants to get the network device usage 561 * Called when a user wants to get the network device usage
562 * statistics. If not defined, the counters in dev->stats will 562 * statistics. If not defined, the counters in dev->stats will
563 * be used. 563 * be used.
@@ -584,7 +584,7 @@ struct net_device_ops {
584 void (*ndo_uninit)(struct net_device *dev); 584 void (*ndo_uninit)(struct net_device *dev);
585 int (*ndo_open)(struct net_device *dev); 585 int (*ndo_open)(struct net_device *dev);
586 int (*ndo_stop)(struct net_device *dev); 586 int (*ndo_stop)(struct net_device *dev);
587 int (*ndo_start_xmit) (struct sk_buff *skb, 587 netdev_tx_t (*ndo_start_xmit) (struct sk_buff *skb,
588 struct net_device *dev); 588 struct net_device *dev);
589 u16 (*ndo_select_queue)(struct net_device *dev, 589 u16 (*ndo_select_queue)(struct net_device *dev,
590 struct sk_buff *skb); 590 struct sk_buff *skb);
@@ -627,6 +627,8 @@ struct net_device_ops {
627 void (*ndo_poll_controller)(struct net_device *dev); 627 void (*ndo_poll_controller)(struct net_device *dev);
628#endif 628#endif
629#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 629#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
630 int (*ndo_fcoe_enable)(struct net_device *dev);
631 int (*ndo_fcoe_disable)(struct net_device *dev);
630 int (*ndo_fcoe_ddp_setup)(struct net_device *dev, 632 int (*ndo_fcoe_ddp_setup)(struct net_device *dev,
631 u16 xid, 633 u16 xid,
632 struct scatterlist *sgl, 634 struct scatterlist *sgl,
@@ -705,6 +707,7 @@ struct net_device
705/* the GSO_MASK reserves bits 16 through 23 */ 707/* the GSO_MASK reserves bits 16 through 23 */
706#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ 708#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */
707#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */ 709#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */
710#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
708 711
709 /* Segmentation offload features */ 712 /* Segmentation offload features */
710#define NETIF_F_GSO_SHIFT 16 713#define NETIF_F_GSO_SHIFT 16
@@ -829,6 +832,9 @@ struct net_device
829 /* Number of TX queues currently active in device */ 832 /* Number of TX queues currently active in device */
830 unsigned int real_num_tx_queues; 833 unsigned int real_num_tx_queues;
831 834
835 /* root qdisc from userspace point of view */
836 struct Qdisc *qdisc;
837
832 unsigned long tx_queue_len; /* Max frames per queue allowed */ 838 unsigned long tx_queue_len; /* Max frames per queue allowed */
833 spinlock_t tx_global_lock; 839 spinlock_t tx_global_lock;
834/* 840/*
@@ -889,7 +895,7 @@ struct net_device
889 /* class/net/name entry */ 895 /* class/net/name entry */
890 struct device dev; 896 struct device dev;
891 /* space for optional statistics and wireless sysfs groups */ 897 /* space for optional statistics and wireless sysfs groups */
892 struct attribute_group *sysfs_groups[3]; 898 const struct attribute_group *sysfs_groups[3];
893 899
894 /* rtnetlink link ops */ 900 /* rtnetlink link ops */
895 const struct rtnl_link_ops *rtnl_link_ops; 901 const struct rtnl_link_ops *rtnl_link_ops;
@@ -992,6 +998,12 @@ static inline void *netdev_priv(const struct net_device *dev)
992 */ 998 */
993#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev)) 999#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev))
994 1000
1001/* Set the sysfs device type for the network logical device to allow
1002 * fin grained indentification of different network device types. For
1003 * example Ethernet, Wirelss LAN, Bluetooth, WiMAX etc.
1004 */
1005#define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype))
1006
995/** 1007/**
996 * netif_napi_add - initialize a napi context 1008 * netif_napi_add - initialize a napi context
997 * @dev: network device 1009 * @dev: network device
@@ -1260,7 +1272,7 @@ static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue)
1260{ 1272{
1261#ifdef CONFIG_NETPOLL_TRAP 1273#ifdef CONFIG_NETPOLL_TRAP
1262 if (netpoll_trap()) { 1274 if (netpoll_trap()) {
1263 clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state); 1275 netif_tx_start_queue(dev_queue);
1264 return; 1276 return;
1265 } 1277 }
1266#endif 1278#endif
@@ -1366,7 +1378,8 @@ static inline int netif_running(const struct net_device *dev)
1366static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index) 1378static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index)
1367{ 1379{
1368 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); 1380 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
1369 clear_bit(__QUEUE_STATE_XOFF, &txq->state); 1381
1382 netif_tx_start_queue(txq);
1370} 1383}
1371 1384
1372/** 1385/**
@@ -1383,7 +1396,7 @@ static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index)
1383 if (netpoll_trap()) 1396 if (netpoll_trap())
1384 return; 1397 return;
1385#endif 1398#endif
1386 set_bit(__QUEUE_STATE_XOFF, &txq->state); 1399 netif_tx_stop_queue(txq);
1387} 1400}
1388 1401
1389/** 1402/**
@@ -1397,7 +1410,8 @@ static inline int __netif_subqueue_stopped(const struct net_device *dev,
1397 u16 queue_index) 1410 u16 queue_index)
1398{ 1411{
1399 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); 1412 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
1400 return test_bit(__QUEUE_STATE_XOFF, &txq->state); 1413
1414 return netif_tx_queue_stopped(txq);
1401} 1415}
1402 1416
1403static inline int netif_subqueue_stopped(const struct net_device *dev, 1417static inline int netif_subqueue_stopped(const struct net_device *dev,
@@ -1749,8 +1763,7 @@ static inline void netif_tx_unlock(struct net_device *dev)
1749 * force a schedule. 1763 * force a schedule.
1750 */ 1764 */
1751 clear_bit(__QUEUE_STATE_FROZEN, &txq->state); 1765 clear_bit(__QUEUE_STATE_FROZEN, &txq->state);
1752 if (!test_bit(__QUEUE_STATE_XOFF, &txq->state)) 1766 netif_schedule_queue(txq);
1753 __netif_schedule(txq->qdisc);
1754 } 1767 }
1755 spin_unlock(&dev->tx_global_lock); 1768 spin_unlock(&dev->tx_global_lock);
1756} 1769}
@@ -1860,7 +1873,8 @@ extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct
1860extern int dev_set_promiscuity(struct net_device *dev, int inc); 1873extern int dev_set_promiscuity(struct net_device *dev, int inc);
1861extern int dev_set_allmulti(struct net_device *dev, int inc); 1874extern int dev_set_allmulti(struct net_device *dev, int inc);
1862extern void netdev_state_change(struct net_device *dev); 1875extern void netdev_state_change(struct net_device *dev);
1863extern void netdev_bonding_change(struct net_device *dev); 1876extern void netdev_bonding_change(struct net_device *dev,
1877 unsigned long event);
1864extern void netdev_features_change(struct net_device *dev); 1878extern void netdev_features_change(struct net_device *dev);
1865/* Load a device via the kmod */ 1879/* Load a device via the kmod */
1866extern void dev_load(struct net *net, const char *name); 1880extern void dev_load(struct net *net, const char *name);
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 48cfe51bfddc..6132b5e6d9d3 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -221,12 +221,12 @@ __ret;})
221 221
222/* Call setsockopt() */ 222/* Call setsockopt() */
223int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, 223int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
224 int len); 224 unsigned int len);
225int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, 225int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
226 int *len); 226 int *len);
227 227
228int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, 228int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval,
229 char __user *opt, int len); 229 char __user *opt, unsigned int len);
230int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, 230int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval,
231 char __user *opt, int *len); 231 char __user *opt, int *len);
232 232
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index bff4d5741d98..9f00da287f2c 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -58,7 +58,8 @@ struct nfgenmsg {
58struct nfnl_callback 58struct nfnl_callback
59{ 59{
60 int (*call)(struct sock *nl, struct sk_buff *skb, 60 int (*call)(struct sock *nl, struct sk_buff *skb,
61 struct nlmsghdr *nlh, struct nlattr *cda[]); 61 const struct nlmsghdr *nlh,
62 const struct nlattr * const cda[]);
62 const struct nla_policy *policy; /* netlink attribute policy */ 63 const struct nla_policy *policy; /* netlink attribute policy */
63 const u_int16_t attr_count; /* number of nlattr's */ 64 const u_int16_t attr_count; /* number of nlattr's */
64}; 65};
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 1030b7593898..812cb153cabb 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -238,9 +238,9 @@ struct xt_mtdtor_param {
238 */ 238 */
239struct xt_target_param { 239struct xt_target_param {
240 const struct net_device *in, *out; 240 const struct net_device *in, *out;
241 unsigned int hooknum;
242 const struct xt_target *target; 241 const struct xt_target *target;
243 const void *targinfo; 242 const void *targinfo;
243 unsigned int hooknum;
244 u_int8_t family; 244 u_int8_t family;
245}; 245};
246 246
@@ -407,7 +407,7 @@ extern int xt_check_target(struct xt_tgchk_param *,
407 unsigned int size, u_int8_t proto, bool inv_proto); 407 unsigned int size, u_int8_t proto, bool inv_proto);
408 408
409extern struct xt_table *xt_register_table(struct net *net, 409extern struct xt_table *xt_register_table(struct net *net,
410 struct xt_table *table, 410 const struct xt_table *table,
411 struct xt_table_info *bootstrap, 411 struct xt_table_info *bootstrap,
412 struct xt_table_info *newinfo); 412 struct xt_table_info *newinfo);
413extern void *xt_unregister_table(struct xt_table *table); 413extern void *xt_unregister_table(struct xt_table *table);
diff --git a/include/linux/netfilter/xt_CONNMARK.h b/include/linux/netfilter/xt_CONNMARK.h
index 7635c8ffdadb..0a8545866752 100644
--- a/include/linux/netfilter/xt_CONNMARK.h
+++ b/include/linux/netfilter/xt_CONNMARK.h
@@ -18,12 +18,6 @@ enum {
18 XT_CONNMARK_RESTORE 18 XT_CONNMARK_RESTORE
19}; 19};
20 20
21struct xt_connmark_target_info {
22 unsigned long mark;
23 unsigned long mask;
24 __u8 mode;
25};
26
27struct xt_connmark_tginfo1 { 21struct xt_connmark_tginfo1 {
28 __u32 ctmark, ctmask, nfmask; 22 __u32 ctmark, ctmask, nfmask;
29 __u8 mode; 23 __u8 mode;
diff --git a/include/linux/netfilter/xt_MARK.h b/include/linux/netfilter/xt_MARK.h
index 028304bcc0b1..bc9561bdef79 100644
--- a/include/linux/netfilter/xt_MARK.h
+++ b/include/linux/netfilter/xt_MARK.h
@@ -3,23 +3,6 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6/* Version 0 */
7struct xt_mark_target_info {
8 unsigned long mark;
9};
10
11/* Version 1 */
12enum {
13 XT_MARK_SET=0,
14 XT_MARK_AND,
15 XT_MARK_OR,
16};
17
18struct xt_mark_target_info_v1 {
19 unsigned long mark;
20 __u8 mode;
21};
22
23struct xt_mark_tginfo2 { 6struct xt_mark_tginfo2 {
24 __u32 mark, mask; 7 __u32 mark, mask;
25}; 8};
diff --git a/include/linux/netfilter/xt_connmark.h b/include/linux/netfilter/xt_connmark.h
index 571e266d004c..619e47cde01a 100644
--- a/include/linux/netfilter/xt_connmark.h
+++ b/include/linux/netfilter/xt_connmark.h
@@ -12,11 +12,6 @@
12 * (at your option) any later version. 12 * (at your option) any later version.
13 */ 13 */
14 14
15struct xt_connmark_info {
16 unsigned long mark, mask;
17 __u8 invert;
18};
19
20struct xt_connmark_mtinfo1 { 15struct xt_connmark_mtinfo1 {
21 __u32 mark, mask; 16 __u32 mark, mask;
22 __u8 invert; 17 __u8 invert;
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h
index 7ae05338e94c..54f47a2f6152 100644
--- a/include/linux/netfilter/xt_conntrack.h
+++ b/include/linux/netfilter/xt_conntrack.h
@@ -32,42 +32,6 @@ enum {
32 XT_CONNTRACK_DIRECTION = 1 << 12, 32 XT_CONNTRACK_DIRECTION = 1 << 12,
33}; 33};
34 34
35/* This is exposed to userspace, so remains frozen in time. */
36struct ip_conntrack_old_tuple
37{
38 struct {
39 __be32 ip;
40 union {
41 __u16 all;
42 } u;
43 } src;
44
45 struct {
46 __be32 ip;
47 union {
48 __u16 all;
49 } u;
50
51 /* The protocol. */
52 __u16 protonum;
53 } dst;
54};
55
56struct xt_conntrack_info
57{
58 unsigned int statemask, statusmask;
59
60 struct ip_conntrack_old_tuple tuple[IP_CT_DIR_MAX];
61 struct in_addr sipmsk[IP_CT_DIR_MAX], dipmsk[IP_CT_DIR_MAX];
62
63 unsigned long expires_min, expires_max;
64
65 /* Flags word */
66 __u8 flags;
67 /* Inverse flags */
68 __u8 invflags;
69};
70
71struct xt_conntrack_mtinfo1 { 35struct xt_conntrack_mtinfo1 {
72 union nf_inet_addr origsrc_addr, origsrc_mask; 36 union nf_inet_addr origsrc_addr, origsrc_mask;
73 union nf_inet_addr origdst_addr, origdst_mask; 37 union nf_inet_addr origdst_addr, origdst_mask;
diff --git a/include/linux/netfilter/xt_mark.h b/include/linux/netfilter/xt_mark.h
index 6fa460a3cc29..6607c8f38ea5 100644
--- a/include/linux/netfilter/xt_mark.h
+++ b/include/linux/netfilter/xt_mark.h
@@ -3,11 +3,6 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6struct xt_mark_info {
7 unsigned long mark, mask;
8 __u8 invert;
9};
10
11struct xt_mark_mtinfo1 { 6struct xt_mark_mtinfo1 {
12 __u32 mark, mask; 7 __u32 mark, mask;
13 __u8 invert; 8 __u8 invert;
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index 590ac3d6d5d6..6fe3e6aa10db 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -265,7 +265,7 @@ struct arpt_error
265} 265}
266 266
267extern struct xt_table *arpt_register_table(struct net *net, 267extern struct xt_table *arpt_register_table(struct net *net,
268 struct xt_table *table, 268 const struct xt_table *table,
269 const struct arpt_replace *repl); 269 const struct arpt_replace *repl);
270extern void arpt_unregister_table(struct xt_table *table); 270extern void arpt_unregister_table(struct xt_table *table);
271extern unsigned int arpt_do_table(struct sk_buff *skb, 271extern unsigned int arpt_do_table(struct sk_buff *skb,
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index e40ddb94b1af..ea281e6a2048 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -301,7 +301,7 @@ struct ebt_table
301#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_replace)-1)) & \ 301#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_replace)-1)) & \
302 ~(__alignof__(struct ebt_replace)-1)) 302 ~(__alignof__(struct ebt_replace)-1))
303extern struct ebt_table *ebt_register_table(struct net *net, 303extern struct ebt_table *ebt_register_table(struct net *net,
304 struct ebt_table *table); 304 const struct ebt_table *table);
305extern void ebt_unregister_table(struct ebt_table *table); 305extern void ebt_unregister_table(struct ebt_table *table);
306extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, 306extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb,
307 const struct net_device *in, const struct net_device *out, 307 const struct net_device *in, const struct net_device *out,
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index 3a7105bb8f33..431b40761920 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -1,46 +1,14 @@
1header-y += ipt_CLASSIFY.h
2header-y += ipt_CLUSTERIP.h 1header-y += ipt_CLUSTERIP.h
3header-y += ipt_CONNMARK.h
4header-y += ipt_DSCP.h
5header-y += ipt_ECN.h 2header-y += ipt_ECN.h
6header-y += ipt_LOG.h 3header-y += ipt_LOG.h
7header-y += ipt_MARK.h
8header-y += ipt_NFQUEUE.h
9header-y += ipt_REJECT.h 4header-y += ipt_REJECT.h
10header-y += ipt_SAME.h 5header-y += ipt_SAME.h
11header-y += ipt_TCPMSS.h
12header-y += ipt_TOS.h
13header-y += ipt_TTL.h 6header-y += ipt_TTL.h
14header-y += ipt_ULOG.h 7header-y += ipt_ULOG.h
15header-y += ipt_addrtype.h 8header-y += ipt_addrtype.h
16header-y += ipt_ah.h 9header-y += ipt_ah.h
17header-y += ipt_comment.h
18header-y += ipt_connbytes.h
19header-y += ipt_connmark.h
20header-y += ipt_conntrack.h
21header-y += ipt_dccp.h
22header-y += ipt_dscp.h
23header-y += ipt_ecn.h 10header-y += ipt_ecn.h
24header-y += ipt_esp.h
25header-y += ipt_hashlimit.h
26header-y += ipt_helper.h
27header-y += ipt_iprange.h
28header-y += ipt_length.h
29header-y += ipt_limit.h
30header-y += ipt_mac.h
31header-y += ipt_mark.h
32header-y += ipt_multiport.h
33header-y += ipt_owner.h
34header-y += ipt_physdev.h
35header-y += ipt_pkttype.h
36header-y += ipt_policy.h
37header-y += ipt_realm.h 11header-y += ipt_realm.h
38header-y += ipt_recent.h
39header-y += ipt_sctp.h
40header-y += ipt_state.h
41header-y += ipt_string.h
42header-y += ipt_tcpmss.h
43header-y += ipt_tos.h
44header-y += ipt_ttl.h 12header-y += ipt_ttl.h
45 13
46unifdef-y += ip_queue.h 14unifdef-y += ip_queue.h
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 092bd50581a9..61fafc868a7b 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -245,7 +245,7 @@ ipt_get_target(struct ipt_entry *e)
245extern void ipt_init(void) __init; 245extern void ipt_init(void) __init;
246 246
247extern struct xt_table *ipt_register_table(struct net *net, 247extern struct xt_table *ipt_register_table(struct net *net,
248 struct xt_table *table, 248 const struct xt_table *table,
249 const struct ipt_replace *repl); 249 const struct ipt_replace *repl);
250extern void ipt_unregister_table(struct xt_table *table); 250extern void ipt_unregister_table(struct xt_table *table);
251 251
diff --git a/include/linux/netfilter_ipv4/ipt_CLASSIFY.h b/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
deleted file mode 100644
index a46d511b5c36..000000000000
--- a/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _IPT_CLASSIFY_H
2#define _IPT_CLASSIFY_H
3
4#include <linux/netfilter/xt_CLASSIFY.h>
5#define ipt_classify_target_info xt_classify_target_info
6
7#endif /*_IPT_CLASSIFY_H */
diff --git a/include/linux/netfilter_ipv4/ipt_CONNMARK.h b/include/linux/netfilter_ipv4/ipt_CONNMARK.h
deleted file mode 100644
index 9ecfee0a9e33..000000000000
--- a/include/linux/netfilter_ipv4/ipt_CONNMARK.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef _IPT_CONNMARK_H_target
2#define _IPT_CONNMARK_H_target
3
4/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
5 * by Henrik Nordstrom <hno@marasystems.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12#include <linux/netfilter/xt_CONNMARK.h>
13#define IPT_CONNMARK_SET XT_CONNMARK_SET
14#define IPT_CONNMARK_SAVE XT_CONNMARK_SAVE
15#define IPT_CONNMARK_RESTORE XT_CONNMARK_RESTORE
16
17#define ipt_connmark_target_info xt_connmark_target_info
18
19#endif /*_IPT_CONNMARK_H_target*/
diff --git a/include/linux/netfilter_ipv4/ipt_DSCP.h b/include/linux/netfilter_ipv4/ipt_DSCP.h
deleted file mode 100644
index 3491e524d5ea..000000000000
--- a/include/linux/netfilter_ipv4/ipt_DSCP.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* iptables module for setting the IPv4 DSCP field
2 *
3 * (C) 2002 Harald Welte <laforge@gnumonks.org>
4 * based on ipt_FTOS.c (C) 2000 by Matthew G. Marsh <mgm@paktronix.com>
5 * This software is distributed under GNU GPL v2, 1991
6 *
7 * See RFC2474 for a description of the DSCP field within the IP Header.
8 *
9 * ipt_DSCP.h,v 1.7 2002/03/14 12:03:13 laforge Exp
10*/
11#ifndef _IPT_DSCP_TARGET_H
12#define _IPT_DSCP_TARGET_H
13#include <linux/netfilter_ipv4/ipt_dscp.h>
14#include <linux/netfilter/xt_DSCP.h>
15
16#define ipt_DSCP_info xt_DSCP_info
17
18#endif /* _IPT_DSCP_TARGET_H */
diff --git a/include/linux/netfilter_ipv4/ipt_ECN.h b/include/linux/netfilter_ipv4/ipt_ECN.h
index 94e0d9866469..7ca45918ab8e 100644
--- a/include/linux/netfilter_ipv4/ipt_ECN.h
+++ b/include/linux/netfilter_ipv4/ipt_ECN.h
@@ -8,9 +8,9 @@
8*/ 8*/
9#ifndef _IPT_ECN_TARGET_H 9#ifndef _IPT_ECN_TARGET_H
10#define _IPT_ECN_TARGET_H 10#define _IPT_ECN_TARGET_H
11#include <linux/netfilter_ipv4/ipt_DSCP.h> 11#include <linux/netfilter/xt_DSCP.h>
12 12
13#define IPT_ECN_IP_MASK (~IPT_DSCP_MASK) 13#define IPT_ECN_IP_MASK (~XT_DSCP_MASK)
14 14
15#define IPT_ECN_OP_SET_IP 0x01 /* set ECN bits of IPv4 header */ 15#define IPT_ECN_OP_SET_IP 0x01 /* set ECN bits of IPv4 header */
16#define IPT_ECN_OP_SET_ECE 0x10 /* set ECE bit of TCP header */ 16#define IPT_ECN_OP_SET_ECE 0x10 /* set ECE bit of TCP header */
diff --git a/include/linux/netfilter_ipv4/ipt_MARK.h b/include/linux/netfilter_ipv4/ipt_MARK.h
deleted file mode 100644
index 697a486a96d3..000000000000
--- a/include/linux/netfilter_ipv4/ipt_MARK.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _IPT_MARK_H_target
2#define _IPT_MARK_H_target
3
4/* Backwards compatibility for old userspace */
5
6#include <linux/netfilter/xt_MARK.h>
7
8/* Version 0 */
9#define ipt_mark_target_info xt_mark_target_info
10
11/* Version 1 */
12#define IPT_MARK_SET XT_MARK_SET
13#define IPT_MARK_AND XT_MARK_AND
14#define IPT_MARK_OR XT_MARK_OR
15
16#define ipt_mark_target_info_v1 xt_mark_target_info_v1
17
18#endif /*_IPT_MARK_H_target*/
diff --git a/include/linux/netfilter_ipv4/ipt_NFQUEUE.h b/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
deleted file mode 100644
index 97a2a7557cb9..000000000000
--- a/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/* iptables module for using NFQUEUE mechanism
2 *
3 * (C) 2005 Harald Welte <laforge@netfilter.org>
4 *
5 * This software is distributed under GNU GPL v2, 1991
6 *
7*/
8#ifndef _IPT_NFQ_TARGET_H
9#define _IPT_NFQ_TARGET_H
10
11/* Backwards compatibility for old userspace */
12#include <linux/netfilter/xt_NFQUEUE.h>
13
14#define ipt_NFQ_info xt_NFQ_info
15
16#endif /* _IPT_DSCP_TARGET_H */
diff --git a/include/linux/netfilter_ipv4/ipt_TCPMSS.h b/include/linux/netfilter_ipv4/ipt_TCPMSS.h
deleted file mode 100644
index 7a850f945824..000000000000
--- a/include/linux/netfilter_ipv4/ipt_TCPMSS.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _IPT_TCPMSS_H
2#define _IPT_TCPMSS_H
3
4#include <linux/netfilter/xt_TCPMSS.h>
5
6#define ipt_tcpmss_info xt_tcpmss_info
7#define IPT_TCPMSS_CLAMP_PMTU XT_TCPMSS_CLAMP_PMTU
8
9#endif /*_IPT_TCPMSS_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_TOS.h b/include/linux/netfilter_ipv4/ipt_TOS.h
deleted file mode 100644
index 6bf9e1fdfd88..000000000000
--- a/include/linux/netfilter_ipv4/ipt_TOS.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _IPT_TOS_H_target
2#define _IPT_TOS_H_target
3
4#ifndef IPTOS_NORMALSVC
5#define IPTOS_NORMALSVC 0
6#endif
7
8struct ipt_tos_target_info {
9 u_int8_t tos;
10};
11
12#endif /*_IPT_TOS_H_target*/
diff --git a/include/linux/netfilter_ipv4/ipt_comment.h b/include/linux/netfilter_ipv4/ipt_comment.h
deleted file mode 100644
index ae2afc2f7481..000000000000
--- a/include/linux/netfilter_ipv4/ipt_comment.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _IPT_COMMENT_H
2#define _IPT_COMMENT_H
3
4#include <linux/netfilter/xt_comment.h>
5
6#define IPT_MAX_COMMENT_LEN XT_MAX_COMMENT_LEN
7
8#define ipt_comment_info xt_comment_info
9
10#endif /* _IPT_COMMENT_H */
diff --git a/include/linux/netfilter_ipv4/ipt_connbytes.h b/include/linux/netfilter_ipv4/ipt_connbytes.h
deleted file mode 100644
index f63e6ee91113..000000000000
--- a/include/linux/netfilter_ipv4/ipt_connbytes.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _IPT_CONNBYTES_H
2#define _IPT_CONNBYTES_H
3
4#include <linux/netfilter/xt_connbytes.h>
5#define ipt_connbytes_what xt_connbytes_what
6
7#define IPT_CONNBYTES_PKTS XT_CONNBYTES_PKTS
8#define IPT_CONNBYTES_BYTES XT_CONNBYTES_BYTES
9#define IPT_CONNBYTES_AVGPKT XT_CONNBYTES_AVGPKT
10
11#define ipt_connbytes_direction xt_connbytes_direction
12#define IPT_CONNBYTES_DIR_ORIGINAL XT_CONNBYTES_DIR_ORIGINAL
13#define IPT_CONNBYTES_DIR_REPLY XT_CONNBYTES_DIR_REPLY
14#define IPT_CONNBYTES_DIR_BOTH XT_CONNBYTES_DIR_BOTH
15
16#define ipt_connbytes_info xt_connbytes_info
17
18#endif
diff --git a/include/linux/netfilter_ipv4/ipt_connmark.h b/include/linux/netfilter_ipv4/ipt_connmark.h
deleted file mode 100644
index c7ba6560d44c..000000000000
--- a/include/linux/netfilter_ipv4/ipt_connmark.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _IPT_CONNMARK_H
2#define _IPT_CONNMARK_H
3
4#include <linux/netfilter/xt_connmark.h>
5#define ipt_connmark_info xt_connmark_info
6
7#endif /*_IPT_CONNMARK_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_conntrack.h b/include/linux/netfilter_ipv4/ipt_conntrack.h
deleted file mode 100644
index cde6762949c5..000000000000
--- a/include/linux/netfilter_ipv4/ipt_conntrack.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/* Header file for kernel module to match connection tracking information.
2 * GPL (C) 2001 Marc Boucher (marc@mbsi.ca).
3 */
4
5#ifndef _IPT_CONNTRACK_H
6#define _IPT_CONNTRACK_H
7
8#include <linux/netfilter/xt_conntrack.h>
9
10#define IPT_CONNTRACK_STATE_BIT(ctinfo) XT_CONNTRACK_STATE_BIT(ctinfo)
11#define IPT_CONNTRACK_STATE_INVALID XT_CONNTRACK_STATE_INVALID
12
13#define IPT_CONNTRACK_STATE_SNAT XT_CONNTRACK_STATE_SNAT
14#define IPT_CONNTRACK_STATE_DNAT XT_CONNTRACK_STATE_DNAT
15#define IPT_CONNTRACK_STATE_UNTRACKED XT_CONNTRACK_STATE_UNTRACKED
16
17/* flags, invflags: */
18#define IPT_CONNTRACK_STATE XT_CONNTRACK_STATE
19#define IPT_CONNTRACK_PROTO XT_CONNTRACK_PROTO
20#define IPT_CONNTRACK_ORIGSRC XT_CONNTRACK_ORIGSRC
21#define IPT_CONNTRACK_ORIGDST XT_CONNTRACK_ORIGDST
22#define IPT_CONNTRACK_REPLSRC XT_CONNTRACK_REPLSRC
23#define IPT_CONNTRACK_REPLDST XT_CONNTRACK_REPLDST
24#define IPT_CONNTRACK_STATUS XT_CONNTRACK_STATUS
25#define IPT_CONNTRACK_EXPIRES XT_CONNTRACK_EXPIRES
26
27#define ipt_conntrack_info xt_conntrack_info
28#endif /*_IPT_CONNTRACK_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_dccp.h b/include/linux/netfilter_ipv4/ipt_dccp.h
deleted file mode 100644
index e70d11e1f53c..000000000000
--- a/include/linux/netfilter_ipv4/ipt_dccp.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _IPT_DCCP_H_
2#define _IPT_DCCP_H_
3
4#include <linux/netfilter/xt_dccp.h>
5#define IPT_DCCP_SRC_PORTS XT_DCCP_SRC_PORTS
6#define IPT_DCCP_DEST_PORTS XT_DCCP_DEST_PORTS
7#define IPT_DCCP_TYPE XT_DCCP_TYPE
8#define IPT_DCCP_OPTION XT_DCCP_OPTION
9
10#define IPT_DCCP_VALID_FLAGS XT_DCCP_VALID_FLAGS
11
12#define ipt_dccp_info xt_dccp_info
13
14#endif /* _IPT_DCCP_H_ */
15
diff --git a/include/linux/netfilter_ipv4/ipt_dscp.h b/include/linux/netfilter_ipv4/ipt_dscp.h
deleted file mode 100644
index 4b82ca912b0e..000000000000
--- a/include/linux/netfilter_ipv4/ipt_dscp.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/* iptables module for matching the IPv4 DSCP field
2 *
3 * (C) 2002 Harald Welte <laforge@gnumonks.org>
4 * This software is distributed under GNU GPL v2, 1991
5 *
6 * See RFC2474 for a description of the DSCP field within the IP Header.
7 *
8 * ipt_dscp.h,v 1.3 2002/08/05 19:00:21 laforge Exp
9*/
10#ifndef _IPT_DSCP_H
11#define _IPT_DSCP_H
12
13#include <linux/netfilter/xt_dscp.h>
14
15#define IPT_DSCP_MASK XT_DSCP_MASK
16#define IPT_DSCP_SHIFT XT_DSCP_SHIFT
17#define IPT_DSCP_MAX XT_DSCP_MAX
18
19#define ipt_dscp_info xt_dscp_info
20
21#endif /* _IPT_DSCP_H */
diff --git a/include/linux/netfilter_ipv4/ipt_ecn.h b/include/linux/netfilter_ipv4/ipt_ecn.h
index 1f0d9a4d3378..9945baa4ccd7 100644
--- a/include/linux/netfilter_ipv4/ipt_ecn.h
+++ b/include/linux/netfilter_ipv4/ipt_ecn.h
@@ -8,9 +8,9 @@
8*/ 8*/
9#ifndef _IPT_ECN_H 9#ifndef _IPT_ECN_H
10#define _IPT_ECN_H 10#define _IPT_ECN_H
11#include <linux/netfilter_ipv4/ipt_dscp.h> 11#include <linux/netfilter/xt_dscp.h>
12 12
13#define IPT_ECN_IP_MASK (~IPT_DSCP_MASK) 13#define IPT_ECN_IP_MASK (~XT_DSCP_MASK)
14 14
15#define IPT_ECN_OP_MATCH_IP 0x01 15#define IPT_ECN_OP_MATCH_IP 0x01
16#define IPT_ECN_OP_MATCH_ECE 0x10 16#define IPT_ECN_OP_MATCH_ECE 0x10
diff --git a/include/linux/netfilter_ipv4/ipt_esp.h b/include/linux/netfilter_ipv4/ipt_esp.h
deleted file mode 100644
index 78296e7eeff9..000000000000
--- a/include/linux/netfilter_ipv4/ipt_esp.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _IPT_ESP_H
2#define _IPT_ESP_H
3
4#include <linux/netfilter/xt_esp.h>
5
6#define ipt_esp xt_esp
7#define IPT_ESP_INV_SPI XT_ESP_INV_SPI
8#define IPT_ESP_INV_MASK XT_ESP_INV_MASK
9
10#endif /*_IPT_ESP_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_hashlimit.h b/include/linux/netfilter_ipv4/ipt_hashlimit.h
deleted file mode 100644
index 5662120a3d7b..000000000000
--- a/include/linux/netfilter_ipv4/ipt_hashlimit.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef _IPT_HASHLIMIT_H
2#define _IPT_HASHLIMIT_H
3
4#include <linux/netfilter/xt_hashlimit.h>
5
6#define IPT_HASHLIMIT_SCALE XT_HASHLIMIT_SCALE
7#define IPT_HASHLIMIT_HASH_DIP XT_HASHLIMIT_HASH_DIP
8#define IPT_HASHLIMIT_HASH_DPT XT_HASHLIMIT_HASH_DPT
9#define IPT_HASHLIMIT_HASH_SIP XT_HASHLIMIT_HASH_SIP
10#define IPT_HASHLIMIT_HASH_SPT XT_HASHLIMIT_HASH_SPT
11
12#define ipt_hashlimit_info xt_hashlimit_info
13
14#endif /* _IPT_HASHLIMIT_H */
diff --git a/include/linux/netfilter_ipv4/ipt_helper.h b/include/linux/netfilter_ipv4/ipt_helper.h
deleted file mode 100644
index 80452c218551..000000000000
--- a/include/linux/netfilter_ipv4/ipt_helper.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _IPT_HELPER_H
2#define _IPT_HELPER_H
3
4#include <linux/netfilter/xt_helper.h>
5#define ipt_helper_info xt_helper_info
6
7#endif /* _IPT_HELPER_H */
diff --git a/include/linux/netfilter_ipv4/ipt_iprange.h b/include/linux/netfilter_ipv4/ipt_iprange.h
deleted file mode 100644
index 5f1aebde4d2f..000000000000
--- a/include/linux/netfilter_ipv4/ipt_iprange.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef _IPT_IPRANGE_H
2#define _IPT_IPRANGE_H
3
4#include <linux/types.h>
5#include <linux/netfilter/xt_iprange.h>
6
7struct ipt_iprange {
8 /* Inclusive: network order. */
9 __be32 min_ip, max_ip;
10};
11
12struct ipt_iprange_info
13{
14 struct ipt_iprange src;
15 struct ipt_iprange dst;
16
17 /* Flags from above */
18 u_int8_t flags;
19};
20
21#endif /* _IPT_IPRANGE_H */
diff --git a/include/linux/netfilter_ipv4/ipt_length.h b/include/linux/netfilter_ipv4/ipt_length.h
deleted file mode 100644
index 9b45206ffcef..000000000000
--- a/include/linux/netfilter_ipv4/ipt_length.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _IPT_LENGTH_H
2#define _IPT_LENGTH_H
3
4#include <linux/netfilter/xt_length.h>
5#define ipt_length_info xt_length_info
6
7#endif /*_IPT_LENGTH_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_limit.h b/include/linux/netfilter_ipv4/ipt_limit.h
deleted file mode 100644
index 92f5cd07bbc4..000000000000
--- a/include/linux/netfilter_ipv4/ipt_limit.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _IPT_RATE_H
2#define _IPT_RATE_H
3
4#include <linux/netfilter/xt_limit.h>
5#define IPT_LIMIT_SCALE XT_LIMIT_SCALE
6#define ipt_rateinfo xt_rateinfo
7
8#endif /*_IPT_RATE_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_mac.h b/include/linux/netfilter_ipv4/ipt_mac.h
deleted file mode 100644
index b186008a3c47..000000000000
--- a/include/linux/netfilter_ipv4/ipt_mac.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _IPT_MAC_H
2#define _IPT_MAC_H
3
4#include <linux/netfilter/xt_mac.h>
5#define ipt_mac_info xt_mac_info
6
7#endif /*_IPT_MAC_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_mark.h b/include/linux/netfilter_ipv4/ipt_mark.h
deleted file mode 100644
index bfde67c61224..000000000000
--- a/include/linux/netfilter_ipv4/ipt_mark.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _IPT_MARK_H
2#define _IPT_MARK_H
3
4/* Backwards compatibility for old userspace */
5#include <linux/netfilter/xt_mark.h>
6
7#define ipt_mark_info xt_mark_info
8
9#endif /*_IPT_MARK_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_multiport.h b/include/linux/netfilter_ipv4/ipt_multiport.h
deleted file mode 100644
index 55fe85eca88c..000000000000
--- a/include/linux/netfilter_ipv4/ipt_multiport.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _IPT_MULTIPORT_H
2#define _IPT_MULTIPORT_H
3
4#include <linux/netfilter/xt_multiport.h>
5
6#define IPT_MULTIPORT_SOURCE XT_MULTIPORT_SOURCE
7#define IPT_MULTIPORT_DESTINATION XT_MULTIPORT_DESTINATION
8#define IPT_MULTIPORT_EITHER XT_MULTIPORT_EITHER
9
10#define IPT_MULTI_PORTS XT_MULTI_PORTS
11
12#define ipt_multiport xt_multiport
13#define ipt_multiport_v1 xt_multiport_v1
14
15#endif /*_IPT_MULTIPORT_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_owner.h b/include/linux/netfilter_ipv4/ipt_owner.h
deleted file mode 100644
index a78445be9992..000000000000
--- a/include/linux/netfilter_ipv4/ipt_owner.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _IPT_OWNER_H
2#define _IPT_OWNER_H
3
4/* match and invert flags */
5#define IPT_OWNER_UID 0x01
6#define IPT_OWNER_GID 0x02
7#define IPT_OWNER_PID 0x04
8#define IPT_OWNER_SID 0x08
9#define IPT_OWNER_COMM 0x10
10
11struct ipt_owner_info {
12 __kernel_uid32_t uid;
13 __kernel_gid32_t gid;
14 __kernel_pid_t pid;
15 __kernel_pid_t sid;
16 char comm[16];
17 u_int8_t match, invert; /* flags */
18};
19
20#endif /*_IPT_OWNER_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_physdev.h b/include/linux/netfilter_ipv4/ipt_physdev.h
deleted file mode 100644
index 2400e7140f26..000000000000
--- a/include/linux/netfilter_ipv4/ipt_physdev.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef _IPT_PHYSDEV_H
2#define _IPT_PHYSDEV_H
3
4/* Backwards compatibility for old userspace */
5
6#include <linux/netfilter/xt_physdev.h>
7
8#define IPT_PHYSDEV_OP_IN XT_PHYSDEV_OP_IN
9#define IPT_PHYSDEV_OP_OUT XT_PHYSDEV_OP_OUT
10#define IPT_PHYSDEV_OP_BRIDGED XT_PHYSDEV_OP_BRIDGED
11#define IPT_PHYSDEV_OP_ISIN XT_PHYSDEV_OP_ISIN
12#define IPT_PHYSDEV_OP_ISOUT XT_PHYSDEV_OP_ISOUT
13#define IPT_PHYSDEV_OP_MASK XT_PHYSDEV_OP_MASK
14
15#define ipt_physdev_info xt_physdev_info
16
17#endif /*_IPT_PHYSDEV_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_pkttype.h b/include/linux/netfilter_ipv4/ipt_pkttype.h
deleted file mode 100644
index ff1fbc949a0c..000000000000
--- a/include/linux/netfilter_ipv4/ipt_pkttype.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _IPT_PKTTYPE_H
2#define _IPT_PKTTYPE_H
3
4#include <linux/netfilter/xt_pkttype.h>
5#define ipt_pkttype_info xt_pkttype_info
6
7#endif /*_IPT_PKTTYPE_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_policy.h b/include/linux/netfilter_ipv4/ipt_policy.h
deleted file mode 100644
index 1037fb2cd206..000000000000
--- a/include/linux/netfilter_ipv4/ipt_policy.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef _IPT_POLICY_H
2#define _IPT_POLICY_H
3
4#include <linux/netfilter/xt_policy.h>
5
6#define IPT_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM
7
8/* ipt_policy_flags */
9#define IPT_POLICY_MATCH_IN XT_POLICY_MATCH_IN
10#define IPT_POLICY_MATCH_OUT XT_POLICY_MATCH_OUT
11#define IPT_POLICY_MATCH_NONE XT_POLICY_MATCH_NONE
12#define IPT_POLICY_MATCH_STRICT XT_POLICY_MATCH_STRICT
13
14/* ipt_policy_modes */
15#define IPT_POLICY_MODE_TRANSPORT XT_POLICY_MODE_TRANSPORT
16#define IPT_POLICY_MODE_TUNNEL XT_POLICY_MODE_TUNNEL
17
18#define ipt_policy_spec xt_policy_spec
19#define ipt_policy_addr xt_policy_addr
20#define ipt_policy_elem xt_policy_elem
21#define ipt_policy_info xt_policy_info
22
23#endif /* _IPT_POLICY_H */
diff --git a/include/linux/netfilter_ipv4/ipt_recent.h b/include/linux/netfilter_ipv4/ipt_recent.h
deleted file mode 100644
index d636cca133c2..000000000000
--- a/include/linux/netfilter_ipv4/ipt_recent.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef _IPT_RECENT_H
2#define _IPT_RECENT_H
3
4#include <linux/netfilter/xt_recent.h>
5
6#define ipt_recent_info xt_recent_mtinfo
7
8enum {
9 IPT_RECENT_CHECK = XT_RECENT_CHECK,
10 IPT_RECENT_SET = XT_RECENT_SET,
11 IPT_RECENT_UPDATE = XT_RECENT_UPDATE,
12 IPT_RECENT_REMOVE = XT_RECENT_REMOVE,
13 IPT_RECENT_TTL = XT_RECENT_TTL,
14
15 IPT_RECENT_SOURCE = XT_RECENT_SOURCE,
16 IPT_RECENT_DEST = XT_RECENT_DEST,
17
18 IPT_RECENT_NAME_LEN = XT_RECENT_NAME_LEN,
19};
20
21#endif /*_IPT_RECENT_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_sctp.h b/include/linux/netfilter_ipv4/ipt_sctp.h
deleted file mode 100644
index 80b3dbacd193..000000000000
--- a/include/linux/netfilter_ipv4/ipt_sctp.h
+++ /dev/null
@@ -1,105 +0,0 @@
1#ifndef _IPT_SCTP_H_
2#define _IPT_SCTP_H_
3
4#define IPT_SCTP_SRC_PORTS 0x01
5#define IPT_SCTP_DEST_PORTS 0x02
6#define IPT_SCTP_CHUNK_TYPES 0x04
7
8#define IPT_SCTP_VALID_FLAGS 0x07
9
10
11struct ipt_sctp_flag_info {
12 u_int8_t chunktype;
13 u_int8_t flag;
14 u_int8_t flag_mask;
15};
16
17#define IPT_NUM_SCTP_FLAGS 4
18
19struct ipt_sctp_info {
20 u_int16_t dpts[2]; /* Min, Max */
21 u_int16_t spts[2]; /* Min, Max */
22
23 u_int32_t chunkmap[256 / sizeof (u_int32_t)]; /* Bit mask of chunks to be matched according to RFC 2960 */
24
25#define SCTP_CHUNK_MATCH_ANY 0x01 /* Match if any of the chunk types are present */
26#define SCTP_CHUNK_MATCH_ALL 0x02 /* Match if all of the chunk types are present */
27#define SCTP_CHUNK_MATCH_ONLY 0x04 /* Match if these are the only chunk types present */
28
29 u_int32_t chunk_match_type;
30 struct ipt_sctp_flag_info flag_info[IPT_NUM_SCTP_FLAGS];
31 int flag_count;
32
33 u_int32_t flags;
34 u_int32_t invflags;
35};
36
37#define bytes(type) (sizeof(type) * 8)
38
39#define SCTP_CHUNKMAP_SET(chunkmap, type) \
40 do { \
41 chunkmap[type / bytes(u_int32_t)] |= \
42 1 << (type % bytes(u_int32_t)); \
43 } while (0)
44
45#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
46 do { \
47 chunkmap[type / bytes(u_int32_t)] &= \
48 ~(1 << (type % bytes(u_int32_t))); \
49 } while (0)
50
51#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
52({ \
53 (chunkmap[type / bytes (u_int32_t)] & \
54 (1 << (type % bytes (u_int32_t)))) ? 1: 0; \
55})
56
57#define SCTP_CHUNKMAP_RESET(chunkmap) \
58 do { \
59 int i; \
60 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
61 chunkmap[i] = 0; \
62 } while (0)
63
64#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
65 do { \
66 int i; \
67 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
68 chunkmap[i] = ~0; \
69 } while (0)
70
71#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
72 do { \
73 int i; \
74 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
75 destmap[i] = srcmap[i]; \
76 } while (0)
77
78#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
79({ \
80 int i; \
81 int flag = 1; \
82 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
83 if (chunkmap[i]) { \
84 flag = 0; \
85 break; \
86 } \
87 } \
88 flag; \
89})
90
91#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
92({ \
93 int i; \
94 int flag = 1; \
95 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
96 if (chunkmap[i] != ~0) { \
97 flag = 0; \
98 break; \
99 } \
100 } \
101 flag; \
102})
103
104#endif /* _IPT_SCTP_H_ */
105
diff --git a/include/linux/netfilter_ipv4/ipt_state.h b/include/linux/netfilter_ipv4/ipt_state.h
deleted file mode 100644
index a44a99cc28cc..000000000000
--- a/include/linux/netfilter_ipv4/ipt_state.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _IPT_STATE_H
2#define _IPT_STATE_H
3
4/* Backwards compatibility for old userspace */
5
6#include <linux/netfilter/xt_state.h>
7
8#define IPT_STATE_BIT XT_STATE_BIT
9#define IPT_STATE_INVALID XT_STATE_INVALID
10
11#define IPT_STATE_UNTRACKED XT_STATE_UNTRACKED
12
13#define ipt_state_info xt_state_info
14
15#endif /*_IPT_STATE_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_string.h b/include/linux/netfilter_ipv4/ipt_string.h
deleted file mode 100644
index c26de3059903..000000000000
--- a/include/linux/netfilter_ipv4/ipt_string.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _IPT_STRING_H
2#define _IPT_STRING_H
3
4#include <linux/netfilter/xt_string.h>
5
6#define IPT_STRING_MAX_PATTERN_SIZE XT_STRING_MAX_PATTERN_SIZE
7#define IPT_STRING_MAX_ALGO_NAME_SIZE XT_STRING_MAX_ALGO_NAME_SIZE
8#define ipt_string_info xt_string_info
9
10#endif /*_IPT_STRING_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_tcpmss.h b/include/linux/netfilter_ipv4/ipt_tcpmss.h
deleted file mode 100644
index 18bbc8e8e009..000000000000
--- a/include/linux/netfilter_ipv4/ipt_tcpmss.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _IPT_TCPMSS_MATCH_H
2#define _IPT_TCPMSS_MATCH_H
3
4#include <linux/netfilter/xt_tcpmss.h>
5#define ipt_tcpmss_match_info xt_tcpmss_match_info
6
7#endif /*_IPT_TCPMSS_MATCH_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_tos.h b/include/linux/netfilter_ipv4/ipt_tos.h
deleted file mode 100644
index a21f5df23c50..000000000000
--- a/include/linux/netfilter_ipv4/ipt_tos.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef _IPT_TOS_H
2#define _IPT_TOS_H
3
4struct ipt_tos_info {
5 u_int8_t tos;
6 u_int8_t invert;
7};
8
9#ifndef IPTOS_NORMALSVC
10#define IPTOS_NORMALSVC 0
11#endif
12
13#endif /*_IPT_TOS_H*/
diff --git a/include/linux/netfilter_ipv6/Kbuild b/include/linux/netfilter_ipv6/Kbuild
index aca4bd1f6d7c..e864eaee9e5e 100644
--- a/include/linux/netfilter_ipv6/Kbuild
+++ b/include/linux/netfilter_ipv6/Kbuild
@@ -1,22 +1,12 @@
1header-y += ip6t_HL.h 1header-y += ip6t_HL.h
2header-y += ip6t_LOG.h 2header-y += ip6t_LOG.h
3header-y += ip6t_MARK.h
4header-y += ip6t_REJECT.h 3header-y += ip6t_REJECT.h
5header-y += ip6t_ah.h 4header-y += ip6t_ah.h
6header-y += ip6t_esp.h
7header-y += ip6t_frag.h 5header-y += ip6t_frag.h
8header-y += ip6t_hl.h
9header-y += ip6t_ipv6header.h 6header-y += ip6t_ipv6header.h
10header-y += ip6t_length.h 7header-y += ip6t_hl.h
11header-y += ip6t_limit.h
12header-y += ip6t_mac.h
13header-y += ip6t_mark.h
14header-y += ip6t_mh.h 8header-y += ip6t_mh.h
15header-y += ip6t_multiport.h
16header-y += ip6t_opts.h 9header-y += ip6t_opts.h
17header-y += ip6t_owner.h
18header-y += ip6t_physdev.h
19header-y += ip6t_policy.h
20header-y += ip6t_rt.h 10header-y += ip6t_rt.h
21 11
22unifdef-y += ip6_tables.h 12unifdef-y += ip6_tables.h
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 1089e33cf633..a64e1451ac38 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -306,7 +306,7 @@ ip6t_get_target(struct ip6t_entry *e)
306extern void ip6t_init(void) __init; 306extern void ip6t_init(void) __init;
307 307
308extern struct xt_table *ip6t_register_table(struct net *net, 308extern struct xt_table *ip6t_register_table(struct net *net,
309 struct xt_table *table, 309 const struct xt_table *table,
310 const struct ip6t_replace *repl); 310 const struct ip6t_replace *repl);
311extern void ip6t_unregister_table(struct xt_table *table); 311extern void ip6t_unregister_table(struct xt_table *table);
312extern unsigned int ip6t_do_table(struct sk_buff *skb, 312extern unsigned int ip6t_do_table(struct sk_buff *skb,
diff --git a/include/linux/netfilter_ipv6/ip6t_MARK.h b/include/linux/netfilter_ipv6/ip6t_MARK.h
deleted file mode 100644
index 7cf629a8ab92..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_MARK.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _IP6T_MARK_H_target
2#define _IP6T_MARK_H_target
3
4/* Backwards compatibility for old userspace */
5#include <linux/netfilter/xt_MARK.h>
6
7#define ip6t_mark_target_info xt_mark_target_info
8
9#endif /*_IP6T_MARK_H_target*/
diff --git a/include/linux/netfilter_ipv6/ip6t_esp.h b/include/linux/netfilter_ipv6/ip6t_esp.h
deleted file mode 100644
index f62eaf53c16c..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_esp.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _IP6T_ESP_H
2#define _IP6T_ESP_H
3
4#include <linux/netfilter/xt_esp.h>
5
6#define ip6t_esp xt_esp
7#define IP6T_ESP_INV_SPI XT_ESP_INV_SPI
8#define IP6T_ESP_INV_MASK XT_ESP_INV_MASK
9
10#endif /*_IP6T_ESP_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_length.h b/include/linux/netfilter_ipv6/ip6t_length.h
deleted file mode 100644
index 9e9689d03ed7..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_length.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _IP6T_LENGTH_H
2#define _IP6T_LENGTH_H
3
4#include <linux/netfilter/xt_length.h>
5#define ip6t_length_info xt_length_info
6
7#endif /*_IP6T_LENGTH_H*/
8
diff --git a/include/linux/netfilter_ipv6/ip6t_limit.h b/include/linux/netfilter_ipv6/ip6t_limit.h
deleted file mode 100644
index 487e5ea342c6..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_limit.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _IP6T_RATE_H
2#define _IP6T_RATE_H
3
4#include <linux/netfilter/xt_limit.h>
5#define IP6T_LIMIT_SCALE XT_LIMIT_SCALE
6#define ip6t_rateinfo xt_rateinfo
7
8#endif /*_IP6T_RATE_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_mac.h b/include/linux/netfilter_ipv6/ip6t_mac.h
deleted file mode 100644
index ac58e83e9423..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_mac.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _IP6T_MAC_H
2#define _IP6T_MAC_H
3
4#include <linux/netfilter/xt_mac.h>
5#define ip6t_mac_info xt_mac_info
6
7#endif /*_IP6T_MAC_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_mark.h b/include/linux/netfilter_ipv6/ip6t_mark.h
deleted file mode 100644
index ff204951ddc3..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_mark.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _IP6T_MARK_H
2#define _IP6T_MARK_H
3
4/* Backwards compatibility for old userspace */
5#include <linux/netfilter/xt_mark.h>
6
7#define ip6t_mark_info xt_mark_info
8
9#endif /*_IPT_MARK_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_multiport.h b/include/linux/netfilter_ipv6/ip6t_multiport.h
deleted file mode 100644
index 042c92661cee..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_multiport.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef _IP6T_MULTIPORT_H
2#define _IP6T_MULTIPORT_H
3
4#include <linux/netfilter/xt_multiport.h>
5
6#define IP6T_MULTIPORT_SOURCE XT_MULTIPORT_SOURCE
7#define IP6T_MULTIPORT_DESTINATION XT_MULTIPORT_DESTINATION
8#define IP6T_MULTIPORT_EITHER XT_MULTIPORT_EITHER
9
10#define IP6T_MULTI_PORTS XT_MULTI_PORTS
11
12#define ip6t_multiport xt_multiport
13
14#endif /*_IP6T_MULTIPORT_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_owner.h b/include/linux/netfilter_ipv6/ip6t_owner.h
deleted file mode 100644
index ec5cc7a38c42..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_owner.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _IP6T_OWNER_H
2#define _IP6T_OWNER_H
3
4/* match and invert flags */
5#define IP6T_OWNER_UID 0x01
6#define IP6T_OWNER_GID 0x02
7#define IP6T_OWNER_PID 0x04
8#define IP6T_OWNER_SID 0x08
9
10struct ip6t_owner_info {
11 __kernel_uid32_t uid;
12 __kernel_gid32_t gid;
13 __kernel_pid_t pid;
14 __kernel_pid_t sid;
15 u_int8_t match, invert; /* flags */
16};
17
18#endif /*_IPT_OWNER_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_physdev.h b/include/linux/netfilter_ipv6/ip6t_physdev.h
deleted file mode 100644
index c161c0a81b55..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_physdev.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef _IP6T_PHYSDEV_H
2#define _IP6T_PHYSDEV_H
3
4/* Backwards compatibility for old userspace */
5
6#include <linux/netfilter/xt_physdev.h>
7
8#define IP6T_PHYSDEV_OP_IN XT_PHYSDEV_OP_IN
9#define IP6T_PHYSDEV_OP_OUT XT_PHYSDEV_OP_OUT
10#define IP6T_PHYSDEV_OP_BRIDGED XT_PHYSDEV_OP_BRIDGED
11#define IP6T_PHYSDEV_OP_ISIN XT_PHYSDEV_OP_ISIN
12#define IP6T_PHYSDEV_OP_ISOUT XT_PHYSDEV_OP_ISOUT
13#define IP6T_PHYSDEV_OP_MASK XT_PHYSDEV_OP_MASK
14
15#define ip6t_physdev_info xt_physdev_info
16
17#endif /*_IP6T_PHYSDEV_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_policy.h b/include/linux/netfilter_ipv6/ip6t_policy.h
deleted file mode 100644
index b1c449d7ec89..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_policy.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef _IP6T_POLICY_H
2#define _IP6T_POLICY_H
3
4#include <linux/netfilter/xt_policy.h>
5
6#define IP6T_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM
7
8/* ip6t_policy_flags */
9#define IP6T_POLICY_MATCH_IN XT_POLICY_MATCH_IN
10#define IP6T_POLICY_MATCH_OUT XT_POLICY_MATCH_OUT
11#define IP6T_POLICY_MATCH_NONE XT_POLICY_MATCH_NONE
12#define IP6T_POLICY_MATCH_STRICT XT_POLICY_MATCH_STRICT
13
14/* ip6t_policy_modes */
15#define IP6T_POLICY_MODE_TRANSPORT XT_POLICY_MODE_TRANSPORT
16#define IP6T_POLICY_MODE_TUNNEL XT_POLICY_MODE_TUNNEL
17
18#define ip6t_policy_spec xt_policy_spec
19#define ip6t_policy_addr xt_policy_addr
20#define ip6t_policy_elem xt_policy_elem
21#define ip6t_policy_info xt_policy_info
22
23#endif /* _IP6T_POLICY_H */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 5ba398e90304..ab5d3126831f 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -176,13 +176,18 @@ struct netlink_skb_parms
176#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds) 176#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds)
177 177
178 178
179extern void netlink_table_grab(void);
180extern void netlink_table_ungrab(void);
181
179extern struct sock *netlink_kernel_create(struct net *net, 182extern struct sock *netlink_kernel_create(struct net *net,
180 int unit,unsigned int groups, 183 int unit,unsigned int groups,
181 void (*input)(struct sk_buff *skb), 184 void (*input)(struct sk_buff *skb),
182 struct mutex *cb_mutex, 185 struct mutex *cb_mutex,
183 struct module *module); 186 struct module *module);
184extern void netlink_kernel_release(struct sock *sk); 187extern void netlink_kernel_release(struct sock *sk);
188extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups);
185extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); 189extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
190extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group);
186extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); 191extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group);
187extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 192extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
188extern int netlink_has_listeners(struct sock *sk, unsigned int group); 193extern int netlink_has_listeners(struct sock *sk, unsigned int group);
@@ -217,12 +222,13 @@ int netlink_sendskb(struct sock *sk, struct sk_buff *skb);
217 222
218struct netlink_callback 223struct netlink_callback
219{ 224{
220 struct sk_buff *skb; 225 struct sk_buff *skb;
221 struct nlmsghdr *nlh; 226 const struct nlmsghdr *nlh;
222 int (*dump)(struct sk_buff * skb, struct netlink_callback *cb); 227 int (*dump)(struct sk_buff * skb,
223 int (*done)(struct netlink_callback *cb); 228 struct netlink_callback *cb);
224 int family; 229 int (*done)(struct netlink_callback *cb);
225 long args[6]; 230 int family;
231 long args[6];
226}; 232};
227 233
228struct netlink_notify 234struct netlink_notify
@@ -258,7 +264,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
258 NLMSG_NEW(skb, pid, seq, type, len, 0) 264 NLMSG_NEW(skb, pid, seq, type, len, 0)
259 265
260extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, 266extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
261 struct nlmsghdr *nlh, 267 const struct nlmsghdr *nlh,
262 int (*dump)(struct sk_buff *skb, struct netlink_callback*), 268 int (*dump)(struct sk_buff *skb, struct netlink_callback*),
263 int (*done)(struct netlink_callback*)); 269 int (*done)(struct netlink_callback*));
264 270
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index bd2eba530667..c4c060208109 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -234,7 +234,7 @@ enum nfs_opnum4 {
234Needs to be updated if more operations are defined in future.*/ 234Needs to be updated if more operations are defined in future.*/
235 235
236#define FIRST_NFS4_OP OP_ACCESS 236#define FIRST_NFS4_OP OP_ACCESS
237#define LAST_NFS4_OP OP_RELEASE_LOCKOWNER 237#define LAST_NFS4_OP OP_RECLAIM_COMPLETE
238 238
239enum nfsstat4 { 239enum nfsstat4 {
240 NFS4_OK = 0, 240 NFS4_OK = 0,
@@ -472,6 +472,7 @@ enum lock_type4 {
472 472
473#define NFSPROC4_NULL 0 473#define NFSPROC4_NULL 0
474#define NFSPROC4_COMPOUND 1 474#define NFSPROC4_COMPOUND 1
475#define NFS4_VERSION 4
475#define NFS4_MINOR_VERSION 0 476#define NFS4_MINOR_VERSION 0
476 477
477#if defined(CONFIG_NFS_V4_1) 478#if defined(CONFIG_NFS_V4_1)
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index f6b90240dd41..d09db1bc9083 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -40,7 +40,6 @@
40#ifdef __KERNEL__ 40#ifdef __KERNEL__
41 41
42#include <linux/in.h> 42#include <linux/in.h>
43#include <linux/kref.h>
44#include <linux/mm.h> 43#include <linux/mm.h>
45#include <linux/pagemap.h> 44#include <linux/pagemap.h>
46#include <linux/rbtree.h> 45#include <linux/rbtree.h>
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 19fe15d12042..320569eabe3b 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -167,6 +167,15 @@ struct nfs_server {
167#define NFS_CAP_SYMLINKS (1U << 2) 167#define NFS_CAP_SYMLINKS (1U << 2)
168#define NFS_CAP_ACLS (1U << 3) 168#define NFS_CAP_ACLS (1U << 3)
169#define NFS_CAP_ATOMIC_OPEN (1U << 4) 169#define NFS_CAP_ATOMIC_OPEN (1U << 4)
170#define NFS_CAP_CHANGE_ATTR (1U << 5)
171#define NFS_CAP_FILEID (1U << 6)
172#define NFS_CAP_MODE (1U << 7)
173#define NFS_CAP_NLINK (1U << 8)
174#define NFS_CAP_OWNER (1U << 9)
175#define NFS_CAP_OWNER_GROUP (1U << 10)
176#define NFS_CAP_ATIME (1U << 11)
177#define NFS_CAP_CTIME (1U << 12)
178#define NFS_CAP_MTIME (1U << 13)
170 179
171 180
172/* maximum number of slots to use */ 181/* maximum number of slots to use */
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 2b49d676d0c9..510ffdd5020e 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -56,8 +56,11 @@ extern struct svc_version nfsd_version2, nfsd_version3,
56extern u32 nfsd_supported_minorversion; 56extern u32 nfsd_supported_minorversion;
57extern struct mutex nfsd_mutex; 57extern struct mutex nfsd_mutex;
58extern struct svc_serv *nfsd_serv; 58extern struct svc_serv *nfsd_serv;
59extern spinlock_t nfsd_drc_lock;
60extern unsigned int nfsd_drc_max_mem;
61extern unsigned int nfsd_drc_mem_used;
59 62
60extern struct seq_operations nfs_exports_op; 63extern const struct seq_operations nfs_exports_op;
61 64
62/* 65/*
63 * Function prototypes. 66 * Function prototypes.
@@ -163,7 +166,7 @@ extern int nfsd_max_blksize;
163extern unsigned int max_delegations; 166extern unsigned int max_delegations;
164int nfs4_state_init(void); 167int nfs4_state_init(void);
165void nfsd4_free_slabs(void); 168void nfsd4_free_slabs(void);
166void nfs4_state_start(void); 169int nfs4_state_start(void);
167void nfs4_state_shutdown(void); 170void nfs4_state_shutdown(void);
168time_t nfs4_lease_time(void); 171time_t nfs4_lease_time(void);
169void nfs4_reset_lease(time_t leasetime); 172void nfs4_reset_lease(time_t leasetime);
@@ -171,7 +174,7 @@ int nfs4_reset_recoverydir(char *recdir);
171#else 174#else
172static inline int nfs4_state_init(void) { return 0; } 175static inline int nfs4_state_init(void) { return 0; }
173static inline void nfsd4_free_slabs(void) { } 176static inline void nfsd4_free_slabs(void) { }
174static inline void nfs4_state_start(void) { } 177static inline int nfs4_state_start(void) { return 0; }
175static inline void nfs4_state_shutdown(void) { } 178static inline void nfs4_state_shutdown(void) { }
176static inline time_t nfs4_lease_time(void) { return 0; } 179static inline time_t nfs4_lease_time(void) { return 0; }
177static inline void nfs4_reset_lease(time_t leasetime) { } 180static inline void nfs4_reset_lease(time_t leasetime) { }
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index 57ab2ed08459..b38d11324189 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -60,6 +60,12 @@ typedef struct {
60#define si_stateownerid si_opaque.so_stateownerid 60#define si_stateownerid si_opaque.so_stateownerid
61#define si_fileid si_opaque.so_fileid 61#define si_fileid si_opaque.so_fileid
62 62
63struct nfsd4_cb_sequence {
64 /* args/res */
65 u32 cbs_minorversion;
66 struct nfs4_client *cbs_clp;
67};
68
63struct nfs4_delegation { 69struct nfs4_delegation {
64 struct list_head dl_perfile; 70 struct list_head dl_perfile;
65 struct list_head dl_perclnt; 71 struct list_head dl_perclnt;
@@ -81,38 +87,35 @@ struct nfs4_delegation {
81/* client delegation callback info */ 87/* client delegation callback info */
82struct nfs4_cb_conn { 88struct nfs4_cb_conn {
83 /* SETCLIENTID info */ 89 /* SETCLIENTID info */
84 u32 cb_addr; 90 struct sockaddr_storage cb_addr;
85 unsigned short cb_port; 91 size_t cb_addrlen;
86 u32 cb_prog; 92 u32 cb_prog;
87 u32 cb_minorversion; 93 u32 cb_minorversion;
88 u32 cb_ident; /* minorversion 0 only */ 94 u32 cb_ident; /* minorversion 0 only */
89 /* RPC client info */ 95 /* RPC client info */
90 atomic_t cb_set; /* successful CB_NULL call */ 96 atomic_t cb_set; /* successful CB_NULL call */
91 struct rpc_clnt * cb_client; 97 struct rpc_clnt * cb_client;
92 struct rpc_cred * cb_cred;
93}; 98};
94 99
95/* Maximum number of slots per session. 128 is useful for long haul TCP */ 100/* Maximum number of slots per session. 160 is useful for long haul TCP */
96#define NFSD_MAX_SLOTS_PER_SESSION 128 101#define NFSD_MAX_SLOTS_PER_SESSION 160
97/* Maximum number of pages per slot cache entry */
98#define NFSD_PAGES_PER_SLOT 1
99/* Maximum number of operations per session compound */ 102/* Maximum number of operations per session compound */
100#define NFSD_MAX_OPS_PER_COMPOUND 16 103#define NFSD_MAX_OPS_PER_COMPOUND 16
101 104/* Maximum session per slot cache size */
102struct nfsd4_cache_entry { 105#define NFSD_SLOT_CACHE_SIZE 1024
103 __be32 ce_status; 106/* Maximum number of NFSD_SLOT_CACHE_SIZE slots per session */
104 struct kvec ce_datav; /* encoded NFSv4.1 data in rq_res.head[0] */ 107#define NFSD_CACHE_SIZE_SLOTS_PER_SESSION 32
105 struct page *ce_respages[NFSD_PAGES_PER_SLOT + 1]; 108#define NFSD_MAX_MEM_PER_SESSION \
106 int ce_cachethis; 109 (NFSD_CACHE_SIZE_SLOTS_PER_SESSION * NFSD_SLOT_CACHE_SIZE)
107 short ce_resused;
108 int ce_opcnt;
109 int ce_rpchdrlen;
110};
111 110
112struct nfsd4_slot { 111struct nfsd4_slot {
113 bool sl_inuse; 112 bool sl_inuse;
114 u32 sl_seqid; 113 bool sl_cachethis;
115 struct nfsd4_cache_entry sl_cache_entry; 114 u16 sl_opcnt;
115 u32 sl_seqid;
116 __be32 sl_status;
117 u32 sl_datalen;
118 char sl_data[];
116}; 119};
117 120
118struct nfsd4_channel_attrs { 121struct nfsd4_channel_attrs {
@@ -126,6 +129,25 @@ struct nfsd4_channel_attrs {
126 u32 rdma_attrs; 129 u32 rdma_attrs;
127}; 130};
128 131
132struct nfsd4_create_session {
133 clientid_t clientid;
134 struct nfs4_sessionid sessionid;
135 u32 seqid;
136 u32 flags;
137 struct nfsd4_channel_attrs fore_channel;
138 struct nfsd4_channel_attrs back_channel;
139 u32 callback_prog;
140 u32 uid;
141 u32 gid;
142};
143
144/* The single slot clientid cache structure */
145struct nfsd4_clid_slot {
146 u32 sl_seqid;
147 __be32 sl_status;
148 struct nfsd4_create_session sl_cr_ses;
149};
150
129struct nfsd4_session { 151struct nfsd4_session {
130 struct kref se_ref; 152 struct kref se_ref;
131 struct list_head se_hash; /* hash by sessionid */ 153 struct list_head se_hash; /* hash by sessionid */
@@ -135,7 +157,7 @@ struct nfsd4_session {
135 struct nfs4_sessionid se_sessionid; 157 struct nfs4_sessionid se_sessionid;
136 struct nfsd4_channel_attrs se_fchannel; 158 struct nfsd4_channel_attrs se_fchannel;
137 struct nfsd4_channel_attrs se_bchannel; 159 struct nfsd4_channel_attrs se_bchannel;
138 struct nfsd4_slot se_slots[]; /* forward channel slots */ 160 struct nfsd4_slot *se_slots[]; /* forward channel slots */
139}; 161};
140 162
141static inline void 163static inline void
@@ -180,7 +202,7 @@ struct nfs4_client {
180 char cl_recdir[HEXDIR_LEN]; /* recovery dir */ 202 char cl_recdir[HEXDIR_LEN]; /* recovery dir */
181 nfs4_verifier cl_verifier; /* generated by client */ 203 nfs4_verifier cl_verifier; /* generated by client */
182 time_t cl_time; /* time of last lease renewal */ 204 time_t cl_time; /* time of last lease renewal */
183 __be32 cl_addr; /* client ipaddress */ 205 struct sockaddr_storage cl_addr; /* client ipaddress */
184 u32 cl_flavor; /* setclientid pseudoflavor */ 206 u32 cl_flavor; /* setclientid pseudoflavor */
185 char *cl_principal; /* setclientid principal name */ 207 char *cl_principal; /* setclientid principal name */
186 struct svc_cred cl_cred; /* setclientid principal */ 208 struct svc_cred cl_cred; /* setclientid principal */
@@ -192,9 +214,17 @@ struct nfs4_client {
192 214
193 /* for nfs41 */ 215 /* for nfs41 */
194 struct list_head cl_sessions; 216 struct list_head cl_sessions;
195 struct nfsd4_slot cl_slot; /* create_session slot */ 217 struct nfsd4_clid_slot cl_cs_slot; /* create_session slot */
196 u32 cl_exchange_flags; 218 u32 cl_exchange_flags;
197 struct nfs4_sessionid cl_sessionid; 219 struct nfs4_sessionid cl_sessionid;
220
221 /* for nfs41 callbacks */
222 /* We currently support a single back channel with a single slot */
223 unsigned long cl_cb_slot_busy;
224 u32 cl_cb_seq_nr;
225 struct svc_xprt *cl_cb_xprt; /* 4.1 callback transport */
226 struct rpc_wait_queue cl_cb_waitq; /* backchannel callers may */
227 /* wait here for slots */
198}; 228};
199 229
200/* struct nfs4_client_reset 230/* struct nfs4_client_reset
@@ -345,6 +375,7 @@ extern int nfs4_in_grace(void);
345extern __be32 nfs4_check_open_reclaim(clientid_t *clid); 375extern __be32 nfs4_check_open_reclaim(clientid_t *clid);
346extern void put_nfs4_client(struct nfs4_client *clp); 376extern void put_nfs4_client(struct nfs4_client *clp);
347extern void nfs4_free_stateowner(struct kref *kref); 377extern void nfs4_free_stateowner(struct kref *kref);
378extern int set_callback_cred(void);
348extern void nfsd4_probe_callback(struct nfs4_client *clp); 379extern void nfsd4_probe_callback(struct nfs4_client *clp);
349extern void nfsd4_cb_recall(struct nfs4_delegation *dp); 380extern void nfsd4_cb_recall(struct nfs4_delegation *dp);
350extern void nfs4_put_delegation(struct nfs4_delegation *dp); 381extern void nfs4_put_delegation(struct nfs4_delegation *dp);
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index 2bacf7535069..73164c2b3d29 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -51,7 +51,7 @@ struct nfsd4_compound_state {
51 /* For sessions DRC */ 51 /* For sessions DRC */
52 struct nfsd4_session *session; 52 struct nfsd4_session *session;
53 struct nfsd4_slot *slot; 53 struct nfsd4_slot *slot;
54 __be32 *statp; 54 __be32 *datap;
55 size_t iovlen; 55 size_t iovlen;
56 u32 minorversion; 56 u32 minorversion;
57 u32 status; 57 u32 status;
@@ -366,18 +366,6 @@ struct nfsd4_exchange_id {
366 int spa_how; 366 int spa_how;
367}; 367};
368 368
369struct nfsd4_create_session {
370 clientid_t clientid;
371 struct nfs4_sessionid sessionid;
372 u32 seqid;
373 u32 flags;
374 struct nfsd4_channel_attrs fore_channel;
375 struct nfsd4_channel_attrs back_channel;
376 u32 callback_prog;
377 u32 uid;
378 u32 gid;
379};
380
381struct nfsd4_sequence { 369struct nfsd4_sequence {
382 struct nfs4_sessionid sessionid; /* request/response */ 370 struct nfs4_sessionid sessionid; /* request/response */
383 u32 seqid; /* request/response */ 371 u32 seqid; /* request/response */
@@ -479,13 +467,12 @@ struct nfsd4_compoundres {
479static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp) 467static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp)
480{ 468{
481 struct nfsd4_compoundargs *args = resp->rqstp->rq_argp; 469 struct nfsd4_compoundargs *args = resp->rqstp->rq_argp;
482 return args->opcnt == 1; 470 return resp->opcnt == 1 && args->ops[0].opnum == OP_SEQUENCE;
483} 471}
484 472
485static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp) 473static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp)
486{ 474{
487 return !resp->cstate.slot->sl_cache_entry.ce_cachethis || 475 return !resp->cstate.slot->sl_cachethis || nfsd4_is_solo_sequence(resp);
488 nfsd4_is_solo_sequence(resp);
489} 476}
490 477
491#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) 478#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs)
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index 79fec6af3f9f..ce520402e840 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -425,15 +425,6 @@ struct nilfs_dat_entry {
425}; 425};
426 426
427/** 427/**
428 * struct nilfs_dat_group_desc - block group descriptor
429 * @dg_nfrees: number of free virtual block numbers in block group
430 */
431struct nilfs_dat_group_desc {
432 __le32 dg_nfrees;
433};
434
435
436/**
437 * struct nilfs_snapshot_list - snapshot list 428 * struct nilfs_snapshot_list - snapshot list
438 * @ssl_next: next checkpoint number on snapshot list 429 * @ssl_next: next checkpoint number on snapshot list
439 * @ssl_prev: previous checkpoint number on snapshot list 430 * @ssl_prev: previous checkpoint number on snapshot list
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index dbea93b694e5..a8d71ed43a0e 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -242,6 +242,29 @@
242 * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is 242 * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is
243 * determined by the network interface. 243 * determined by the network interface.
244 * 244 *
245 * @NL80211_CMD_TESTMODE: testmode command, takes a wiphy (or ifindex) attribute
246 * to identify the device, and the TESTDATA blob attribute to pass through
247 * to the driver.
248 *
249 * @NL80211_CMD_CONNECT: connection request and notification; this command
250 * requests to connect to a specified network but without separating
251 * auth and assoc steps. For this, you need to specify the SSID in a
252 * %NL80211_ATTR_SSID attribute, and can optionally specify the association
253 * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_MAC,
254 * %NL80211_ATTR_WIPHY_FREQ and %NL80211_ATTR_CONTROL_PORT.
255 * It is also sent as an event, with the BSSID and response IEs when the
256 * connection is established or failed to be established. This can be
257 * determined by the STATUS_CODE attribute.
258 * @NL80211_CMD_ROAM: request that the card roam (currently not implemented),
259 * sent as an event when the card/driver roamed by itself.
260 * @NL80211_CMD_DISCONNECT: drop a given connection; also used to notify
261 * userspace that a connection was dropped by the AP or due to other
262 * reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and
263 * %NL80211_ATTR_REASON_CODE attributes are used.
264 *
265 * @NL80211_CMD_SET_WIPHY_NETNS: Set a wiphy's netns. Note that all devices
266 * associated with this wiphy must be down and will follow.
267 *
245 * @NL80211_CMD_MAX: highest used command number 268 * @NL80211_CMD_MAX: highest used command number
246 * @__NL80211_CMD_AFTER_LAST: internal use 269 * @__NL80211_CMD_AFTER_LAST: internal use
247 */ 270 */
@@ -310,6 +333,14 @@ enum nl80211_commands {
310 NL80211_CMD_JOIN_IBSS, 333 NL80211_CMD_JOIN_IBSS,
311 NL80211_CMD_LEAVE_IBSS, 334 NL80211_CMD_LEAVE_IBSS,
312 335
336 NL80211_CMD_TESTMODE,
337
338 NL80211_CMD_CONNECT,
339 NL80211_CMD_ROAM,
340 NL80211_CMD_DISCONNECT,
341
342 NL80211_CMD_SET_WIPHY_NETNS,
343
313 /* add new commands above here */ 344 /* add new commands above here */
314 345
315 /* used to define NL80211_CMD_MAX below */ 346 /* used to define NL80211_CMD_MAX below */
@@ -449,10 +480,6 @@ enum nl80211_commands {
449 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) 480 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz)
450 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive 481 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive
451 * scanning and include a zero-length SSID (wildcard) for wildcard scan 482 * scanning and include a zero-length SSID (wildcard) for wildcard scan
452 * @NL80211_ATTR_SCAN_GENERATION: the scan generation increases whenever the
453 * scan result list changes (BSS expired or added) so that applications
454 * can verify that they got a single, consistent snapshot (when all dump
455 * messages carried the same generation number)
456 * @NL80211_ATTR_BSS: scan result BSS 483 * @NL80211_ATTR_BSS: scan result BSS
457 * 484 *
458 * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain 485 * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain
@@ -511,6 +538,52 @@ enum nl80211_commands {
511 * authorized by user space. Otherwise, port is marked authorized by 538 * authorized by user space. Otherwise, port is marked authorized by
512 * default in station mode. 539 * default in station mode.
513 * 540 *
541 * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver.
542 * We recommend using nested, driver-specific attributes within this.
543 *
544 * @NL80211_ATTR_DISCONNECTED_BY_AP: A flag indicating that the DISCONNECT
545 * event was due to the AP disconnecting the station, and not due to
546 * a local disconnect request.
547 * @NL80211_ATTR_STATUS_CODE: StatusCode for the %NL80211_CMD_CONNECT
548 * event (u16)
549 * @NL80211_ATTR_PRIVACY: Flag attribute, used with connect(), indicating
550 * that protected APs should be used.
551 *
552 * @NL80211_ATTR_CIPHERS_PAIRWISE: Used with CONNECT and ASSOCIATE to
553 * indicate which unicast key ciphers will be used with the connection
554 * (an array of u32).
555 * @NL80211_ATTR_CIPHER_GROUP: Used with CONNECT and ASSOCIATE to indicate
556 * which group key cipher will be used with the connection (a u32).
557 * @NL80211_ATTR_WPA_VERSIONS: Used with CONNECT and ASSOCIATE to indicate
558 * which WPA version(s) the AP we want to associate with is using
559 * (a u32 with flags from &enum nl80211_wpa_versions).
560 * @NL80211_ATTR_AKM_SUITES: Used with CONNECT and ASSOCIATE to indicate
561 * which key management algorithm(s) to use (an array of u32).
562 *
563 * @NL80211_ATTR_REQ_IE: (Re)association request information elements as
564 * sent out by the card, for ROAM and successful CONNECT events.
565 * @NL80211_ATTR_RESP_IE: (Re)association response information elements as
566 * sent by peer, for ROAM and successful CONNECT events.
567 *
568 * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used by in ASSOCIATE
569 * commands to specify using a reassociate frame
570 *
571 * @NL80211_ATTR_KEY: key information in a nested attribute with
572 * %NL80211_KEY_* sub-attributes
573 * @NL80211_ATTR_KEYS: array of keys for static WEP keys for connect()
574 * and join_ibss(), key information is in a nested attribute each
575 * with %NL80211_KEY_* sub-attributes
576 *
577 * @NL80211_ATTR_PID: Process ID of a network namespace.
578 *
579 * @NL80211_ATTR_GENERATION: Used to indicate consistent snapshots for
580 * dumps. This number increases whenever the object list being
581 * dumped changes, and as such userspace can verify that it has
582 * obtained a complete and consistent snapshot by verifying that
583 * all dump messages contain the same generation number. If it
584 * changed then the list changed and the dump should be repeated
585 * completely from scratch.
586 *
514 * @NL80211_ATTR_MAX: highest attribute number currently defined 587 * @NL80211_ATTR_MAX: highest attribute number currently defined
515 * @__NL80211_ATTR_AFTER_LAST: internal use 588 * @__NL80211_ATTR_AFTER_LAST: internal use
516 */ 589 */
@@ -582,7 +655,7 @@ enum nl80211_attrs {
582 655
583 NL80211_ATTR_SCAN_FREQUENCIES, 656 NL80211_ATTR_SCAN_FREQUENCIES,
584 NL80211_ATTR_SCAN_SSIDS, 657 NL80211_ATTR_SCAN_SSIDS,
585 NL80211_ATTR_SCAN_GENERATION, 658 NL80211_ATTR_GENERATION, /* replaces old SCAN_GENERATION */
586 NL80211_ATTR_BSS, 659 NL80211_ATTR_BSS,
587 660
588 NL80211_ATTR_REG_INITIATOR, 661 NL80211_ATTR_REG_INITIATOR,
@@ -619,16 +692,42 @@ enum nl80211_attrs {
619 692
620 NL80211_ATTR_CONTROL_PORT, 693 NL80211_ATTR_CONTROL_PORT,
621 694
695 NL80211_ATTR_TESTDATA,
696
697 NL80211_ATTR_PRIVACY,
698
699 NL80211_ATTR_DISCONNECTED_BY_AP,
700 NL80211_ATTR_STATUS_CODE,
701
702 NL80211_ATTR_CIPHER_SUITES_PAIRWISE,
703 NL80211_ATTR_CIPHER_SUITE_GROUP,
704 NL80211_ATTR_WPA_VERSIONS,
705 NL80211_ATTR_AKM_SUITES,
706
707 NL80211_ATTR_REQ_IE,
708 NL80211_ATTR_RESP_IE,
709
710 NL80211_ATTR_PREV_BSSID,
711
712 NL80211_ATTR_KEY,
713 NL80211_ATTR_KEYS,
714
715 NL80211_ATTR_PID,
716
622 /* add attributes here, update the policy in nl80211.c */ 717 /* add attributes here, update the policy in nl80211.c */
623 718
624 __NL80211_ATTR_AFTER_LAST, 719 __NL80211_ATTR_AFTER_LAST,
625 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 720 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
626}; 721};
627 722
723/* source-level API compatibility */
724#define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION
725
628/* 726/*
629 * Allow user space programs to use #ifdef on new attributes by defining them 727 * Allow user space programs to use #ifdef on new attributes by defining them
630 * here 728 * here
631 */ 729 */
730#define NL80211_CMD_CONNECT NL80211_CMD_CONNECT
632#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY 731#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY
633#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES 732#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES
634#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS 733#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS
@@ -642,6 +741,12 @@ enum nl80211_attrs {
642#define NL80211_ATTR_SSID NL80211_ATTR_SSID 741#define NL80211_ATTR_SSID NL80211_ATTR_SSID
643#define NL80211_ATTR_AUTH_TYPE NL80211_ATTR_AUTH_TYPE 742#define NL80211_ATTR_AUTH_TYPE NL80211_ATTR_AUTH_TYPE
644#define NL80211_ATTR_REASON_CODE NL80211_ATTR_REASON_CODE 743#define NL80211_ATTR_REASON_CODE NL80211_ATTR_REASON_CODE
744#define NL80211_ATTR_CIPHER_SUITES_PAIRWISE NL80211_ATTR_CIPHER_SUITES_PAIRWISE
745#define NL80211_ATTR_CIPHER_SUITE_GROUP NL80211_ATTR_CIPHER_SUITE_GROUP
746#define NL80211_ATTR_WPA_VERSIONS NL80211_ATTR_WPA_VERSIONS
747#define NL80211_ATTR_AKM_SUITES NL80211_ATTR_AKM_SUITES
748#define NL80211_ATTR_KEY NL80211_ATTR_KEY
749#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS
645 750
646#define NL80211_MAX_SUPP_RATES 32 751#define NL80211_MAX_SUPP_RATES 32
647#define NL80211_MAX_SUPP_REG_RULES 32 752#define NL80211_MAX_SUPP_REG_RULES 32
@@ -650,6 +755,9 @@ enum nl80211_attrs {
650#define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 755#define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24
651#define NL80211_HT_CAPABILITY_LEN 26 756#define NL80211_HT_CAPABILITY_LEN 26
652 757
758#define NL80211_MAX_NR_CIPHER_SUITES 5
759#define NL80211_MAX_NR_AKM_SUITES 2
760
653/** 761/**
654 * enum nl80211_iftype - (virtual) interface types 762 * enum nl80211_iftype - (virtual) interface types
655 * 763 *
@@ -1168,6 +1276,7 @@ enum nl80211_channel_type {
1168 * in mBm (100 * dBm) (s32) 1276 * in mBm (100 * dBm) (s32)
1169 * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon 1277 * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon
1170 * in unspecified units, scaled to 0..100 (u8) 1278 * in unspecified units, scaled to 0..100 (u8)
1279 * @NL80211_BSS_STATUS: status, if this BSS is "used"
1171 * @__NL80211_BSS_AFTER_LAST: internal 1280 * @__NL80211_BSS_AFTER_LAST: internal
1172 * @NL80211_BSS_MAX: highest BSS attribute 1281 * @NL80211_BSS_MAX: highest BSS attribute
1173 */ 1282 */
@@ -1181,6 +1290,7 @@ enum nl80211_bss {
1181 NL80211_BSS_INFORMATION_ELEMENTS, 1290 NL80211_BSS_INFORMATION_ELEMENTS,
1182 NL80211_BSS_SIGNAL_MBM, 1291 NL80211_BSS_SIGNAL_MBM,
1183 NL80211_BSS_SIGNAL_UNSPEC, 1292 NL80211_BSS_SIGNAL_UNSPEC,
1293 NL80211_BSS_STATUS,
1184 1294
1185 /* keep last */ 1295 /* keep last */
1186 __NL80211_BSS_AFTER_LAST, 1296 __NL80211_BSS_AFTER_LAST,
@@ -1188,18 +1298,37 @@ enum nl80211_bss {
1188}; 1298};
1189 1299
1190/** 1300/**
1301 * enum nl80211_bss_status - BSS "status"
1302 */
1303enum nl80211_bss_status {
1304 NL80211_BSS_STATUS_AUTHENTICATED,
1305 NL80211_BSS_STATUS_ASSOCIATED,
1306 NL80211_BSS_STATUS_IBSS_JOINED,
1307};
1308
1309/**
1191 * enum nl80211_auth_type - AuthenticationType 1310 * enum nl80211_auth_type - AuthenticationType
1192 * 1311 *
1193 * @NL80211_AUTHTYPE_OPEN_SYSTEM: Open System authentication 1312 * @NL80211_AUTHTYPE_OPEN_SYSTEM: Open System authentication
1194 * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only) 1313 * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only)
1195 * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r) 1314 * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r)
1196 * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP) 1315 * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP)
1316 * @__NL80211_AUTHTYPE_NUM: internal
1317 * @NL80211_AUTHTYPE_MAX: maximum valid auth algorithm
1318 * @NL80211_AUTHTYPE_AUTOMATIC: determine automatically (if necessary by
1319 * trying multiple times); this is invalid in netlink -- leave out
1320 * the attribute for this on CONNECT commands.
1197 */ 1321 */
1198enum nl80211_auth_type { 1322enum nl80211_auth_type {
1199 NL80211_AUTHTYPE_OPEN_SYSTEM, 1323 NL80211_AUTHTYPE_OPEN_SYSTEM,
1200 NL80211_AUTHTYPE_SHARED_KEY, 1324 NL80211_AUTHTYPE_SHARED_KEY,
1201 NL80211_AUTHTYPE_FT, 1325 NL80211_AUTHTYPE_FT,
1202 NL80211_AUTHTYPE_NETWORK_EAP, 1326 NL80211_AUTHTYPE_NETWORK_EAP,
1327
1328 /* keep last */
1329 __NL80211_AUTHTYPE_NUM,
1330 NL80211_AUTHTYPE_MAX = __NL80211_AUTHTYPE_NUM - 1,
1331 NL80211_AUTHTYPE_AUTOMATIC
1203}; 1332};
1204 1333
1205/** 1334/**
@@ -1224,4 +1353,39 @@ enum nl80211_mfp {
1224 NL80211_MFP_REQUIRED, 1353 NL80211_MFP_REQUIRED,
1225}; 1354};
1226 1355
1356enum nl80211_wpa_versions {
1357 NL80211_WPA_VERSION_1 = 1 << 0,
1358 NL80211_WPA_VERSION_2 = 1 << 1,
1359};
1360
1361/**
1362 * enum nl80211_key_attributes - key attributes
1363 * @__NL80211_KEY_INVALID: invalid
1364 * @NL80211_KEY_DATA: (temporal) key data; for TKIP this consists of
1365 * 16 bytes encryption key followed by 8 bytes each for TX and RX MIC
1366 * keys
1367 * @NL80211_KEY_IDX: key ID (u8, 0-3)
1368 * @NL80211_KEY_CIPHER: key cipher suite (u32, as defined by IEEE 802.11
1369 * section 7.3.2.25.1, e.g. 0x000FAC04)
1370 * @NL80211_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and
1371 * CCMP keys, each six bytes in little endian
1372 * @NL80211_KEY_DEFAULT: flag indicating default key
1373 * @NL80211_KEY_DEFAULT_MGMT: flag indicating default management key
1374 * @__NL80211_KEY_AFTER_LAST: internal
1375 * @NL80211_KEY_MAX: highest key attribute
1376 */
1377enum nl80211_key_attributes {
1378 __NL80211_KEY_INVALID,
1379 NL80211_KEY_DATA,
1380 NL80211_KEY_IDX,
1381 NL80211_KEY_CIPHER,
1382 NL80211_KEY_SEQ,
1383 NL80211_KEY_DEFAULT,
1384 NL80211_KEY_DEFAULT_MGMT,
1385
1386 /* keep last */
1387 __NL80211_KEY_AFTER_LAST,
1388 NL80211_KEY_MAX = __NL80211_KEY_AFTER_LAST - 1
1389};
1390
1227#endif /* __LINUX_NL80211_H */ 1391#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h
index 2cda00ccfcca..b7d9435d5a9f 100644
--- a/include/linux/nl802154.h
+++ b/include/linux/nl802154.h
@@ -64,12 +64,14 @@ enum {
64 IEEE802154_ATTR_COORD_REALIGN, 64 IEEE802154_ATTR_COORD_REALIGN,
65 IEEE802154_ATTR_SEC, 65 IEEE802154_ATTR_SEC,
66 66
67 IEEE802154_ATTR_PAGE,
68
67 __IEEE802154_ATTR_MAX, 69 __IEEE802154_ATTR_MAX,
68}; 70};
69 71
70#define IEEE802154_ATTR_MAX (__IEEE802154_ATTR_MAX - 1) 72#define IEEE802154_ATTR_MAX (__IEEE802154_ATTR_MAX - 1)
71 73
72extern struct nla_policy ieee802154_policy[]; 74extern const struct nla_policy ieee802154_policy[];
73 75
74/* commands */ 76/* commands */
75/* REQ should be responded with CONF 77/* REQ should be responded with CONF
@@ -111,6 +113,8 @@ enum {
111 IEEE802154_RX_ENABLE_REQ, /* Not supported yet */ 113 IEEE802154_RX_ENABLE_REQ, /* Not supported yet */
112 IEEE802154_RX_ENABLE_CONF, /* Not supported yet */ 114 IEEE802154_RX_ENABLE_CONF, /* Not supported yet */
113 115
116 IEEE802154_LIST_IFACE,
117
114 __IEEE802154_CMD_MAX, 118 __IEEE802154_CMD_MAX,
115}; 119};
116 120
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 29af2d5df097..b752e807adde 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -28,8 +28,23 @@ static inline void acpi_nmi_disable(void) { }
28static inline void acpi_nmi_enable(void) { } 28static inline void acpi_nmi_enable(void) { }
29#endif 29#endif
30 30
31#ifndef trigger_all_cpu_backtrace 31/*
32#define trigger_all_cpu_backtrace() do { } while (0) 32 * Create trigger_all_cpu_backtrace() out of the arch-provided
33 * base function. Return whether such support was available,
34 * to allow calling code to fall back to some other mechanism:
35 */
36#ifdef arch_trigger_all_cpu_backtrace
37static inline bool trigger_all_cpu_backtrace(void)
38{
39 arch_trigger_all_cpu_backtrace();
40
41 return true;
42}
43#else
44static inline bool trigger_all_cpu_backtrace(void)
45{
46 return false;
47}
33#endif 48#endif
34 49
35#endif 50#endif
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 81bc252dc8ac..44428d247dbe 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -199,6 +199,8 @@ static inline int notifier_to_errno(int ret)
199#define NETDEV_FEAT_CHANGE 0x000B 199#define NETDEV_FEAT_CHANGE 0x000B
200#define NETDEV_BONDING_FAILOVER 0x000C 200#define NETDEV_BONDING_FAILOVER 0x000C
201#define NETDEV_PRE_UP 0x000D 201#define NETDEV_PRE_UP 0x000D
202#define NETDEV_BONDING_OLDTYPE 0x000E
203#define NETDEV_BONDING_NEWTYPE 0x000F
202 204
203#define SYS_DOWN 0x0001 /* Notify of system down */ 205#define SYS_DOWN 0x0001 /* Notify of system down */
204#define SYS_RESTART SYS_DOWN 206#define SYS_RESTART SYS_DOWN
diff --git a/include/linux/oom.h b/include/linux/oom.h
index a7979baf1e39..6aac5fe4f6f1 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -30,5 +30,16 @@ extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order);
30extern int register_oom_notifier(struct notifier_block *nb); 30extern int register_oom_notifier(struct notifier_block *nb);
31extern int unregister_oom_notifier(struct notifier_block *nb); 31extern int unregister_oom_notifier(struct notifier_block *nb);
32 32
33extern bool oom_killer_disabled;
34
35static inline void oom_killer_disable(void)
36{
37 oom_killer_disabled = true;
38}
39
40static inline void oom_killer_enable(void)
41{
42 oom_killer_disabled = false;
43}
33#endif /* __KERNEL__*/ 44#endif /* __KERNEL__*/
34#endif /* _INCLUDE_LINUX_OOM_H */ 45#endif /* _INCLUDE_LINUX_OOM_H */
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 1d9518bc4c58..5171639ecf0f 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -67,6 +67,9 @@ struct oprofile_operations {
67 67
68 /* Initiate a stack backtrace. Optional. */ 68 /* Initiate a stack backtrace. Optional. */
69 void (*backtrace)(struct pt_regs * const regs, unsigned int depth); 69 void (*backtrace)(struct pt_regs * const regs, unsigned int depth);
70
71 /* Multiplex between different events. Optional. */
72 int (*switch_events)(void);
70 /* CPU identification string. */ 73 /* CPU identification string. */
71 char * cpu_type; 74 char * cpu_type;
72}; 75};
@@ -171,7 +174,6 @@ struct op_sample;
171struct op_entry { 174struct op_entry {
172 struct ring_buffer_event *event; 175 struct ring_buffer_event *event;
173 struct op_sample *sample; 176 struct op_sample *sample;
174 unsigned long irq_flags;
175 unsigned long size; 177 unsigned long size;
176 unsigned long *data; 178 unsigned long *data;
177}; 179};
@@ -180,6 +182,7 @@ void oprofile_write_reserve(struct op_entry *entry,
180 struct pt_regs * const regs, 182 struct pt_regs * const regs,
181 unsigned long pc, int code, int size); 183 unsigned long pc, int code, int size);
182int oprofile_add_data(struct op_entry *entry, unsigned long val); 184int oprofile_add_data(struct op_entry *entry, unsigned long val);
185int oprofile_add_data64(struct op_entry *entry, u64 val);
183int oprofile_write_commit(struct op_entry *entry); 186int oprofile_write_commit(struct op_entry *entry);
184 187
185#endif /* OPROFILE_H */ 188#endif /* OPROFILE_H */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index e2e5ce543595..6b202b173955 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -51,6 +51,9 @@
51 * PG_buddy is set to indicate that the page is free and in the buddy system 51 * PG_buddy is set to indicate that the page is free and in the buddy system
52 * (see mm/page_alloc.c). 52 * (see mm/page_alloc.c).
53 * 53 *
54 * PG_hwpoison indicates that a page got corrupted in hardware and contains
55 * data with incorrect ECC bits that triggered a machine check. Accessing is
56 * not safe since it may cause another machine check. Don't touch!
54 */ 57 */
55 58
56/* 59/*
@@ -99,9 +102,12 @@ enum pageflags {
99#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT 102#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
100 PG_mlocked, /* Page is vma mlocked */ 103 PG_mlocked, /* Page is vma mlocked */
101#endif 104#endif
102#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR 105#ifdef CONFIG_ARCH_USES_PG_UNCACHED
103 PG_uncached, /* Page has been mapped as uncached */ 106 PG_uncached, /* Page has been mapped as uncached */
104#endif 107#endif
108#ifdef CONFIG_MEMORY_FAILURE
109 PG_hwpoison, /* hardware poisoned page. Don't touch */
110#endif
105 __NR_PAGEFLAGS, 111 __NR_PAGEFLAGS,
106 112
107 /* Filesystems */ 113 /* Filesystems */
@@ -158,6 +164,9 @@ static inline int TestSetPage##uname(struct page *page) \
158static inline int TestClearPage##uname(struct page *page) \ 164static inline int TestClearPage##uname(struct page *page) \
159 { return test_and_clear_bit(PG_##lname, &page->flags); } 165 { return test_and_clear_bit(PG_##lname, &page->flags); }
160 166
167#define __TESTCLEARFLAG(uname, lname) \
168static inline int __TestClearPage##uname(struct page *page) \
169 { return __test_and_clear_bit(PG_##lname, &page->flags); }
161 170
162#define PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \ 171#define PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \
163 SETPAGEFLAG(uname, lname) CLEARPAGEFLAG(uname, lname) 172 SETPAGEFLAG(uname, lname) CLEARPAGEFLAG(uname, lname)
@@ -184,6 +193,9 @@ static inline void __ClearPage##uname(struct page *page) { }
184#define TESTCLEARFLAG_FALSE(uname) \ 193#define TESTCLEARFLAG_FALSE(uname) \
185static inline int TestClearPage##uname(struct page *page) { return 0; } 194static inline int TestClearPage##uname(struct page *page) { return 0; }
186 195
196#define __TESTCLEARFLAG_FALSE(uname) \
197static inline int __TestClearPage##uname(struct page *page) { return 0; }
198
187struct page; /* forward declaration */ 199struct page; /* forward declaration */
188 200
189TESTPAGEFLAG(Locked, locked) TESTSETFLAG(Locked, locked) 201TESTPAGEFLAG(Locked, locked) TESTSETFLAG(Locked, locked)
@@ -250,19 +262,28 @@ PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
250#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT 262#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
251#define MLOCK_PAGES 1 263#define MLOCK_PAGES 1
252PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked) 264PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked)
253 TESTSCFLAG(Mlocked, mlocked) 265 TESTSCFLAG(Mlocked, mlocked) __TESTCLEARFLAG(Mlocked, mlocked)
254#else 266#else
255#define MLOCK_PAGES 0 267#define MLOCK_PAGES 0
256PAGEFLAG_FALSE(Mlocked) 268PAGEFLAG_FALSE(Mlocked) SETPAGEFLAG_NOOP(Mlocked)
257 SETPAGEFLAG_NOOP(Mlocked) TESTCLEARFLAG_FALSE(Mlocked) 269 TESTCLEARFLAG_FALSE(Mlocked) __TESTCLEARFLAG_FALSE(Mlocked)
258#endif 270#endif
259 271
260#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR 272#ifdef CONFIG_ARCH_USES_PG_UNCACHED
261PAGEFLAG(Uncached, uncached) 273PAGEFLAG(Uncached, uncached)
262#else 274#else
263PAGEFLAG_FALSE(Uncached) 275PAGEFLAG_FALSE(Uncached)
264#endif 276#endif
265 277
278#ifdef CONFIG_MEMORY_FAILURE
279PAGEFLAG(HWPoison, hwpoison)
280TESTSETFLAG(HWPoison, hwpoison)
281#define __PG_HWPOISON (1UL << PG_hwpoison)
282#else
283PAGEFLAG_FALSE(HWPoison)
284#define __PG_HWPOISON 0
285#endif
286
266static inline int PageUptodate(struct page *page) 287static inline int PageUptodate(struct page *page)
267{ 288{
268 int ret = test_bit(PG_uptodate, &(page)->flags); 289 int ret = test_bit(PG_uptodate, &(page)->flags);
@@ -387,7 +408,7 @@ static inline void __ClearPageTail(struct page *page)
387 1 << PG_private | 1 << PG_private_2 | \ 408 1 << PG_private | 1 << PG_private_2 | \
388 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \ 409 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \
389 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ 410 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
390 1 << PG_unevictable | __PG_MLOCKED) 411 1 << PG_unevictable | __PG_MLOCKED | __PG_HWPOISON)
391 412
392/* 413/*
393 * Flags checked when a page is prepped for return by the page allocator. 414 * Flags checked when a page is prepped for return by the page allocator.
@@ -396,8 +417,8 @@ static inline void __ClearPageTail(struct page *page)
396 */ 417 */
397#define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1) 418#define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1)
398 419
399#endif /* !__GENERATING_BOUNDS_H */ 420#define PAGE_FLAGS_PRIVATE \
400 421 (1 << PG_private | 1 << PG_private_2)
401/** 422/**
402 * page_has_private - Determine if page has private stuff 423 * page_has_private - Determine if page has private stuff
403 * @page: The page to be checked 424 * @page: The page to be checked
@@ -405,8 +426,11 @@ static inline void __ClearPageTail(struct page *page)
405 * Determine if a page has private stuff, indicating that release routines 426 * Determine if a page has private stuff, indicating that release routines
406 * should be invoked upon it. 427 * should be invoked upon it.
407 */ 428 */
408#define page_has_private(page) \ 429static inline int page_has_private(struct page *page)
409 ((page)->flags & ((1 << PG_private) | \ 430{
410 (1 << PG_private_2))) 431 return !!(page->flags & PAGE_FLAGS_PRIVATE);
432}
433
434#endif /* !__GENERATING_BOUNDS_H */
411 435
412#endif /* PAGE_FLAGS_H */ 436#endif /* PAGE_FLAGS_H */
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 13f126c89ae8..4b938d4f3ac2 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -38,6 +38,7 @@ enum {
38 PCG_LOCK, /* page cgroup is locked */ 38 PCG_LOCK, /* page cgroup is locked */
39 PCG_CACHE, /* charged as cache */ 39 PCG_CACHE, /* charged as cache */
40 PCG_USED, /* this object is in use. */ 40 PCG_USED, /* this object is in use. */
41 PCG_ACCT_LRU, /* page has been accounted for */
41}; 42};
42 43
43#define TESTPCGFLAG(uname, lname) \ 44#define TESTPCGFLAG(uname, lname) \
@@ -52,11 +53,23 @@ static inline void SetPageCgroup##uname(struct page_cgroup *pc)\
52static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \ 53static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \
53 { clear_bit(PCG_##lname, &pc->flags); } 54 { clear_bit(PCG_##lname, &pc->flags); }
54 55
56#define TESTCLEARPCGFLAG(uname, lname) \
57static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \
58 { return test_and_clear_bit(PCG_##lname, &pc->flags); }
59
55/* Cache flag is set only once (at allocation) */ 60/* Cache flag is set only once (at allocation) */
56TESTPCGFLAG(Cache, CACHE) 61TESTPCGFLAG(Cache, CACHE)
62CLEARPCGFLAG(Cache, CACHE)
63SETPCGFLAG(Cache, CACHE)
57 64
58TESTPCGFLAG(Used, USED) 65TESTPCGFLAG(Used, USED)
59CLEARPCGFLAG(Used, USED) 66CLEARPCGFLAG(Used, USED)
67SETPCGFLAG(Used, USED)
68
69SETPCGFLAG(AcctLRU, ACCT_LRU)
70CLEARPCGFLAG(AcctLRU, ACCT_LRU)
71TESTPCGFLAG(AcctLRU, ACCT_LRU)
72TESTCLEARPCGFLAG(AcctLRU, ACCT_LRU)
60 73
61static inline int page_cgroup_nid(struct page_cgroup *pc) 74static inline int page_cgroup_nid(struct page_cgroup *pc)
62{ 75{
@@ -105,14 +118,14 @@ static inline void __init page_cgroup_init_flatmem(void)
105 118
106#endif 119#endif
107 120
108#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
109#include <linux/swap.h> 121#include <linux/swap.h>
122
123#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
110extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); 124extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id);
111extern unsigned short lookup_swap_cgroup(swp_entry_t ent); 125extern unsigned short lookup_swap_cgroup(swp_entry_t ent);
112extern int swap_cgroup_swapon(int type, unsigned long max_pages); 126extern int swap_cgroup_swapon(int type, unsigned long max_pages);
113extern void swap_cgroup_swapoff(int type); 127extern void swap_cgroup_swapoff(int type);
114#else 128#else
115#include <linux/swap.h>
116 129
117static inline 130static inline
118unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id) 131unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index aec3252afcf5..ed5d7501e181 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -132,7 +132,7 @@ static inline int page_cache_get_speculative(struct page *page)
132{ 132{
133 VM_BUG_ON(in_interrupt()); 133 VM_BUG_ON(in_interrupt());
134 134
135#if !defined(CONFIG_SMP) && defined(CONFIG_CLASSIC_RCU) 135#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU)
136# ifdef CONFIG_PREEMPT 136# ifdef CONFIG_PREEMPT
137 VM_BUG_ON(!in_atomic()); 137 VM_BUG_ON(!in_atomic());
138# endif 138# endif
@@ -170,7 +170,7 @@ static inline int page_cache_add_speculative(struct page *page, int count)
170{ 170{
171 VM_BUG_ON(in_interrupt()); 171 VM_BUG_ON(in_interrupt());
172 172
173#if !defined(CONFIG_SMP) && defined(CONFIG_CLASSIC_RCU) 173#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU)
174# ifdef CONFIG_PREEMPT 174# ifdef CONFIG_PREEMPT
175 VM_BUG_ON(!in_atomic()); 175 VM_BUG_ON(!in_atomic());
176# endif 176# endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 115fb7ba5089..f5c7cd343e56 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -241,6 +241,7 @@ struct pci_dev {
241 unsigned int d1_support:1; /* Low power state D1 is supported */ 241 unsigned int d1_support:1; /* Low power state D1 is supported */
242 unsigned int d2_support:1; /* Low power state D2 is supported */ 242 unsigned int d2_support:1; /* Low power state D2 is supported */
243 unsigned int no_d1d2:1; /* Only allow D0 and D3 */ 243 unsigned int no_d1d2:1; /* Only allow D0 and D3 */
244 unsigned int wakeup_prepared:1;
244 245
245#ifdef CONFIG_PCIEASPM 246#ifdef CONFIG_PCIEASPM
246 struct pcie_link_state *link_state; /* ASPM link state. */ 247 struct pcie_link_state *link_state; /* ASPM link state. */
@@ -273,9 +274,12 @@ struct pci_dev {
273 unsigned int ari_enabled:1; /* ARI forwarding */ 274 unsigned int ari_enabled:1; /* ARI forwarding */
274 unsigned int is_managed:1; 275 unsigned int is_managed:1;
275 unsigned int is_pcie:1; 276 unsigned int is_pcie:1;
277 unsigned int needs_freset:1; /* Dev requires fundamental reset */
276 unsigned int state_saved:1; 278 unsigned int state_saved:1;
277 unsigned int is_physfn:1; 279 unsigned int is_physfn:1;
278 unsigned int is_virtfn:1; 280 unsigned int is_virtfn:1;
281 unsigned int reset_fn:1;
282 unsigned int is_hotplug_bridge:1;
279 pci_dev_flags_t dev_flags; 283 pci_dev_flags_t dev_flags;
280 atomic_t enable_cnt; /* pci_enable_device has been called */ 284 atomic_t enable_cnt; /* pci_enable_device has been called */
281 285
@@ -794,6 +798,11 @@ int __must_check __pci_register_driver(struct pci_driver *, struct module *,
794void pci_unregister_driver(struct pci_driver *dev); 798void pci_unregister_driver(struct pci_driver *dev);
795void pci_remove_behind_bridge(struct pci_dev *dev); 799void pci_remove_behind_bridge(struct pci_dev *dev);
796struct pci_driver *pci_dev_driver(const struct pci_dev *dev); 800struct pci_driver *pci_dev_driver(const struct pci_dev *dev);
801int pci_add_dynid(struct pci_driver *drv,
802 unsigned int vendor, unsigned int device,
803 unsigned int subvendor, unsigned int subdevice,
804 unsigned int class, unsigned int class_mask,
805 unsigned long driver_data);
797const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, 806const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,
798 struct pci_dev *dev); 807 struct pci_dev *dev);
799int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, 808int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
@@ -805,6 +814,8 @@ int pci_cfg_space_size_ext(struct pci_dev *dev);
805int pci_cfg_space_size(struct pci_dev *dev); 814int pci_cfg_space_size(struct pci_dev *dev);
806unsigned char pci_bus_max_busnr(struct pci_bus *bus); 815unsigned char pci_bus_max_busnr(struct pci_bus *bus);
807 816
817int pci_set_vga_state(struct pci_dev *pdev, bool decode,
818 unsigned int command_bits, bool change_bridge);
808/* kmem_cache style wrapper around pci_alloc_consistent() */ 819/* kmem_cache style wrapper around pci_alloc_consistent() */
809 820
810#include <linux/dmapool.h> 821#include <linux/dmapool.h>
@@ -1236,6 +1247,9 @@ extern int pci_pci_problems;
1236extern unsigned long pci_cardbus_io_size; 1247extern unsigned long pci_cardbus_io_size;
1237extern unsigned long pci_cardbus_mem_size; 1248extern unsigned long pci_cardbus_mem_size;
1238 1249
1250extern unsigned long pci_hotplug_io_size;
1251extern unsigned long pci_hotplug_mem_size;
1252
1239int pcibios_add_platform_entries(struct pci_dev *dev); 1253int pcibios_add_platform_entries(struct pci_dev *dev);
1240void pcibios_disable_device(struct pci_dev *dev); 1254void pcibios_disable_device(struct pci_dev *dev);
1241int pcibios_set_pcie_reset_state(struct pci_dev *dev, 1255int pcibios_set_pcie_reset_state(struct pci_dev *dev,
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 4391741b99dc..652ba797696d 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -62,7 +62,8 @@ enum pcie_link_width {
62}; 62};
63 63
64enum pcie_link_speed { 64enum pcie_link_speed {
65 PCIE_2PT5GB = 0x14, 65 PCIE_2_5GB = 0x14,
66 PCIE_5_0GB = 0x15,
66 PCIE_LNK_SPEED_UNKNOWN = 0xFF, 67 PCIE_LNK_SPEED_UNKNOWN = 0xFF,
67}; 68};
68 69
@@ -226,11 +227,18 @@ struct hotplug_params {
226#ifdef CONFIG_ACPI 227#ifdef CONFIG_ACPI
227#include <acpi/acpi.h> 228#include <acpi/acpi.h>
228#include <acpi/acpi_bus.h> 229#include <acpi/acpi_bus.h>
229extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus, 230int pci_get_hp_params(struct pci_dev *dev, struct hotplug_params *hpp);
230 struct hotplug_params *hpp);
231int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags); 231int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags);
232int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle); 232int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle);
233int acpi_pci_detect_ejectable(struct pci_bus *pbus); 233int acpi_pci_detect_ejectable(acpi_handle handle);
234#else
235static inline int pci_get_hp_params(struct pci_dev *dev,
236 struct hotplug_params *hpp)
237{
238 return -ENODEV;
239}
234#endif 240#endif
241
242void pci_configure_slot(struct pci_dev *dev);
235#endif 243#endif
236 244
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 73b46b6b904f..84cf1f3b7838 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2,6 +2,9 @@
2 * PCI Class, Vendor and Device IDs 2 * PCI Class, Vendor and Device IDs
3 * 3 *
4 * Please keep sorted. 4 * Please keep sorted.
5 *
6 * Do not add new entries to this file unless the definitions
7 * are shared between multiple drivers.
5 */ 8 */
6 9
7/* Device classes and subclasses */ 10/* Device classes and subclasses */
@@ -479,6 +482,9 @@
479#define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM_PCIE 0x0361 482#define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM_PCIE 0x0361
480#define PCI_DEVICE_ID_IBM_ICOM_FOUR_PORT_MODEL 0x252 483#define PCI_DEVICE_ID_IBM_ICOM_FOUR_PORT_MODEL 0x252
481 484
485#define PCI_SUBVENDOR_ID_IBM 0x1014
486#define PCI_SUBDEVICE_ID_IBM_SATURN_SERIAL_ONE_PORT 0x03d4
487
482#define PCI_VENDOR_ID_UNISYS 0x1018 488#define PCI_VENDOR_ID_UNISYS 0x1018
483#define PCI_DEVICE_ID_UNISYS_DMA_DIRECTOR 0x001C 489#define PCI_DEVICE_ID_UNISYS_DMA_DIRECTOR 0x001C
484 490
@@ -537,6 +543,8 @@
537#define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450 543#define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450
538#define PCI_DEVICE_ID_AMD_8131_APIC 0x7451 544#define PCI_DEVICE_ID_AMD_8131_APIC 0x7451
539#define PCI_DEVICE_ID_AMD_8132_BRIDGE 0x7458 545#define PCI_DEVICE_ID_AMD_8132_BRIDGE 0x7458
546#define PCI_DEVICE_ID_AMD_HUDSON2_SMBUS 0x780b
547#define PCI_DEVICE_ID_AMD_CS5535_IDE 0x208F
540#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090 548#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090
541#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091 549#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091
542#define PCI_DEVICE_ID_AMD_CS5536_AUDIO 0x2093 550#define PCI_DEVICE_ID_AMD_CS5536_AUDIO 0x2093
@@ -545,9 +553,10 @@
545#define PCI_DEVICE_ID_AMD_CS5536_UDC 0x2096 553#define PCI_DEVICE_ID_AMD_CS5536_UDC 0x2096
546#define PCI_DEVICE_ID_AMD_CS5536_UOC 0x2097 554#define PCI_DEVICE_ID_AMD_CS5536_UOC 0x2097
547#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A 555#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A
548
549#define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081 556#define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081
550#define PCI_DEVICE_ID_AMD_LX_AES 0x2082 557#define PCI_DEVICE_ID_AMD_LX_AES 0x2082
558#define PCI_DEVICE_ID_AMD_HUDSON2_IDE 0x780c
559#define PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE 0x7800
551 560
552#define PCI_VENDOR_ID_TRIDENT 0x1023 561#define PCI_VENDOR_ID_TRIDENT 0x1023
553#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 562#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000
@@ -768,6 +777,7 @@
768#define PCI_DEVICE_ID_TI_X515 0x8036 777#define PCI_DEVICE_ID_TI_X515 0x8036
769#define PCI_DEVICE_ID_TI_XX12 0x8039 778#define PCI_DEVICE_ID_TI_XX12 0x8039
770#define PCI_DEVICE_ID_TI_XX12_FM 0x803b 779#define PCI_DEVICE_ID_TI_XX12_FM 0x803b
780#define PCI_DEVICE_ID_TI_XIO2000A 0x8231
771#define PCI_DEVICE_ID_TI_1130 0xac12 781#define PCI_DEVICE_ID_TI_1130 0xac12
772#define PCI_DEVICE_ID_TI_1031 0xac13 782#define PCI_DEVICE_ID_TI_1031 0xac13
773#define PCI_DEVICE_ID_TI_1131 0xac15 783#define PCI_DEVICE_ID_TI_1131 0xac15
@@ -877,6 +887,7 @@
877#define PCI_DEVICE_ID_APPLE_SH_SUNGEM 0x0051 887#define PCI_DEVICE_ID_APPLE_SH_SUNGEM 0x0051
878#define PCI_DEVICE_ID_APPLE_U3L_AGP 0x0058 888#define PCI_DEVICE_ID_APPLE_U3L_AGP 0x0058
879#define PCI_DEVICE_ID_APPLE_U3H_AGP 0x0059 889#define PCI_DEVICE_ID_APPLE_U3H_AGP 0x0059
890#define PCI_DEVICE_ID_APPLE_U4_PCIE 0x005b
880#define PCI_DEVICE_ID_APPLE_IPID2_AGP 0x0066 891#define PCI_DEVICE_ID_APPLE_IPID2_AGP 0x0066
881#define PCI_DEVICE_ID_APPLE_IPID2_ATA 0x0069 892#define PCI_DEVICE_ID_APPLE_IPID2_ATA 0x0069
882#define PCI_DEVICE_ID_APPLE_IPID2_FW 0x006a 893#define PCI_DEVICE_ID_APPLE_IPID2_FW 0x006a
@@ -1521,6 +1532,8 @@
1521#define PCI_DEVICE_ID_ARTOP_ATP860R 0x0007 1532#define PCI_DEVICE_ID_ARTOP_ATP860R 0x0007
1522#define PCI_DEVICE_ID_ARTOP_ATP865 0x0008 1533#define PCI_DEVICE_ID_ARTOP_ATP865 0x0008
1523#define PCI_DEVICE_ID_ARTOP_ATP865R 0x0009 1534#define PCI_DEVICE_ID_ARTOP_ATP865R 0x0009
1535#define PCI_DEVICE_ID_ARTOP_ATP867A 0x000A
1536#define PCI_DEVICE_ID_ARTOP_ATP867B 0x000B
1524#define PCI_DEVICE_ID_ARTOP_AEC7610 0x8002 1537#define PCI_DEVICE_ID_ARTOP_AEC7610 0x8002
1525#define PCI_DEVICE_ID_ARTOP_AEC7612UW 0x8010 1538#define PCI_DEVICE_ID_ARTOP_AEC7612UW 0x8010
1526#define PCI_DEVICE_ID_ARTOP_AEC7612U 0x8020 1539#define PCI_DEVICE_ID_ARTOP_AEC7612U 0x8020
@@ -1943,6 +1956,8 @@
1943#define PCI_DEVICE_ID_LAVA_DSERIAL 0x0100 /* 2x 16550 */ 1956#define PCI_DEVICE_ID_LAVA_DSERIAL 0x0100 /* 2x 16550 */
1944#define PCI_DEVICE_ID_LAVA_QUATRO_A 0x0101 /* 2x 16550, half of 4 port */ 1957#define PCI_DEVICE_ID_LAVA_QUATRO_A 0x0101 /* 2x 16550, half of 4 port */
1945#define PCI_DEVICE_ID_LAVA_QUATRO_B 0x0102 /* 2x 16550, half of 4 port */ 1958#define PCI_DEVICE_ID_LAVA_QUATRO_B 0x0102 /* 2x 16550, half of 4 port */
1959#define PCI_DEVICE_ID_LAVA_QUATTRO_A 0x0120 /* 2x 16550A, half of 4 port */
1960#define PCI_DEVICE_ID_LAVA_QUATTRO_B 0x0121 /* 2x 16550A, half of 4 port */
1946#define PCI_DEVICE_ID_LAVA_OCTO_A 0x0180 /* 4x 16550A, half of 8 port */ 1961#define PCI_DEVICE_ID_LAVA_OCTO_A 0x0180 /* 4x 16550A, half of 8 port */
1947#define PCI_DEVICE_ID_LAVA_OCTO_B 0x0181 /* 4x 16550A, half of 8 port */ 1962#define PCI_DEVICE_ID_LAVA_OCTO_B 0x0181 /* 4x 16550A, half of 8 port */
1948#define PCI_DEVICE_ID_LAVA_PORT_PLUS 0x0200 /* 2x 16650 */ 1963#define PCI_DEVICE_ID_LAVA_PORT_PLUS 0x0200 /* 2x 16650 */
@@ -1984,6 +1999,8 @@
1984 1999
1985#define PCI_VENDOR_ID_SAMSUNG 0x144d 2000#define PCI_VENDOR_ID_SAMSUNG 0x144d
1986 2001
2002#define PCI_VENDOR_ID_GIGABYTE 0x1458
2003
1987#define PCI_VENDOR_ID_AMBIT 0x1468 2004#define PCI_VENDOR_ID_AMBIT 0x1468
1988 2005
1989#define PCI_VENDOR_ID_MYRICOM 0x14c1 2006#define PCI_VENDOR_ID_MYRICOM 0x14c1
@@ -2062,7 +2079,6 @@
2062#define PCI_DEVICE_ID_TIGON3_5787M 0x1693 2079#define PCI_DEVICE_ID_TIGON3_5787M 0x1693
2063#define PCI_DEVICE_ID_TIGON3_5782 0x1696 2080#define PCI_DEVICE_ID_TIGON3_5782 0x1696
2064#define PCI_DEVICE_ID_TIGON3_5784 0x1698 2081#define PCI_DEVICE_ID_TIGON3_5784 0x1698
2065#define PCI_DEVICE_ID_TIGON3_5785 0x1699
2066#define PCI_DEVICE_ID_TIGON3_5786 0x169a 2082#define PCI_DEVICE_ID_TIGON3_5786 0x169a
2067#define PCI_DEVICE_ID_TIGON3_5787 0x169b 2083#define PCI_DEVICE_ID_TIGON3_5787 0x169b
2068#define PCI_DEVICE_ID_TIGON3_5788 0x169c 2084#define PCI_DEVICE_ID_TIGON3_5788 0x169c
@@ -2149,6 +2165,10 @@
2149#define PCI_DEVICE_ID_ADDIDATA_APCI7420_3 0x700D 2165#define PCI_DEVICE_ID_ADDIDATA_APCI7420_3 0x700D
2150#define PCI_DEVICE_ID_ADDIDATA_APCI7300_3 0x700E 2166#define PCI_DEVICE_ID_ADDIDATA_APCI7300_3 0x700E
2151#define PCI_DEVICE_ID_ADDIDATA_APCI7800_3 0x700F 2167#define PCI_DEVICE_ID_ADDIDATA_APCI7800_3 0x700F
2168#define PCI_DEVICE_ID_ADDIDATA_APCIe7300 0x7010
2169#define PCI_DEVICE_ID_ADDIDATA_APCIe7420 0x7011
2170#define PCI_DEVICE_ID_ADDIDATA_APCIe7500 0x7012
2171#define PCI_DEVICE_ID_ADDIDATA_APCIe7800 0x7013
2152 2172
2153#define PCI_VENDOR_ID_PDC 0x15e9 2173#define PCI_VENDOR_ID_PDC 0x15e9
2154 2174
@@ -2515,6 +2535,16 @@
2515#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e 2535#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e
2516#define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b 2536#define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b
2517#define PCI_DEVICE_ID_INTEL_FBD_CNB 0x360c 2537#define PCI_DEVICE_ID_INTEL_FBD_CNB 0x360c
2538#define PCI_DEVICE_ID_INTEL_IOAT_JSF0 0x3710
2539#define PCI_DEVICE_ID_INTEL_IOAT_JSF1 0x3711
2540#define PCI_DEVICE_ID_INTEL_IOAT_JSF2 0x3712
2541#define PCI_DEVICE_ID_INTEL_IOAT_JSF3 0x3713
2542#define PCI_DEVICE_ID_INTEL_IOAT_JSF4 0x3714
2543#define PCI_DEVICE_ID_INTEL_IOAT_JSF5 0x3715
2544#define PCI_DEVICE_ID_INTEL_IOAT_JSF6 0x3716
2545#define PCI_DEVICE_ID_INTEL_IOAT_JSF7 0x3717
2546#define PCI_DEVICE_ID_INTEL_IOAT_JSF8 0x3718
2547#define PCI_DEVICE_ID_INTEL_IOAT_JSF9 0x3719
2518#define PCI_DEVICE_ID_INTEL_ICH10_0 0x3a14 2548#define PCI_DEVICE_ID_INTEL_ICH10_0 0x3a14
2519#define PCI_DEVICE_ID_INTEL_ICH10_1 0x3a16 2549#define PCI_DEVICE_ID_INTEL_ICH10_1 0x3a16
2520#define PCI_DEVICE_ID_INTEL_ICH10_2 0x3a18 2550#define PCI_DEVICE_ID_INTEL_ICH10_2 0x3a18
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index fcaee42c7ac2..dd0bed4f1cf0 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -42,6 +42,7 @@
42#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */ 42#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */
43 43
44#define PCI_STATUS 0x06 /* 16 bits */ 44#define PCI_STATUS 0x06 /* 16 bits */
45#define PCI_STATUS_INTERRUPT 0x08 /* Interrupt status */
45#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ 46#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */
46#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */ 47#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */
47#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */ 48#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index 68438e18fff4..9bd03193ecd4 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -10,22 +10,70 @@
10/* 10/*
11 * Base implementations of per-CPU variable declarations and definitions, where 11 * Base implementations of per-CPU variable declarations and definitions, where
12 * the section in which the variable is to be placed is provided by the 12 * the section in which the variable is to be placed is provided by the
13 * 'section' argument. This may be used to affect the parameters governing the 13 * 'sec' argument. This may be used to affect the parameters governing the
14 * variable's storage. 14 * variable's storage.
15 * 15 *
16 * NOTE! The sections for the DECLARE and for the DEFINE must match, lest 16 * NOTE! The sections for the DECLARE and for the DEFINE must match, lest
17 * linkage errors occur due the compiler generating the wrong code to access 17 * linkage errors occur due the compiler generating the wrong code to access
18 * that section. 18 * that section.
19 */ 19 */
20#define DECLARE_PER_CPU_SECTION(type, name, section) \ 20#define __PCPU_ATTRS(sec) \
21 extern \ 21 __attribute__((section(PER_CPU_BASE_SECTION sec))) \
22 __attribute__((__section__(PER_CPU_BASE_SECTION section))) \ 22 PER_CPU_ATTRIBUTES
23 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name 23
24 24#define __PCPU_DUMMY_ATTRS \
25#define DEFINE_PER_CPU_SECTION(type, name, section) \ 25 __attribute__((section(".discard"), unused))
26 __attribute__((__section__(PER_CPU_BASE_SECTION section))) \ 26
27 PER_CPU_ATTRIBUTES PER_CPU_DEF_ATTRIBUTES \ 27/*
28 * s390 and alpha modules require percpu variables to be defined as
29 * weak to force the compiler to generate GOT based external
30 * references for them. This is necessary because percpu sections
31 * will be located outside of the usually addressable area.
32 *
33 * This definition puts the following two extra restrictions when
34 * defining percpu variables.
35 *
36 * 1. The symbol must be globally unique, even the static ones.
37 * 2. Static percpu variables cannot be defined inside a function.
38 *
39 * Archs which need weak percpu definitions should define
40 * ARCH_NEEDS_WEAK_PER_CPU in asm/percpu.h when necessary.
41 *
42 * To ensure that the generic code observes the above two
43 * restrictions, if CONFIG_DEBUG_FORCE_WEAK_PER_CPU is set weak
44 * definition is used for all cases.
45 */
46#if defined(ARCH_NEEDS_WEAK_PER_CPU) || defined(CONFIG_DEBUG_FORCE_WEAK_PER_CPU)
47/*
48 * __pcpu_scope_* dummy variable is used to enforce scope. It
49 * receives the static modifier when it's used in front of
50 * DEFINE_PER_CPU() and will trigger build failure if
51 * DECLARE_PER_CPU() is used for the same variable.
52 *
53 * __pcpu_unique_* dummy variable is used to enforce symbol uniqueness
54 * such that hidden weak symbol collision, which will cause unrelated
55 * variables to share the same address, can be detected during build.
56 */
57#define DECLARE_PER_CPU_SECTION(type, name, sec) \
58 extern __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \
59 extern __PCPU_ATTRS(sec) __typeof__(type) per_cpu__##name
60
61#define DEFINE_PER_CPU_SECTION(type, name, sec) \
62 __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \
63 __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \
64 __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak \
28 __typeof__(type) per_cpu__##name 65 __typeof__(type) per_cpu__##name
66#else
67/*
68 * Normal declaration and definition macros.
69 */
70#define DECLARE_PER_CPU_SECTION(type, name, sec) \
71 extern __PCPU_ATTRS(sec) __typeof__(type) per_cpu__##name
72
73#define DEFINE_PER_CPU_SECTION(type, name, sec) \
74 __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES \
75 __typeof__(type) per_cpu__##name
76#endif
29 77
30/* 78/*
31 * Variant on the per-CPU variable declaration/definition theme used for 79 * Variant on the per-CPU variable declaration/definition theme used for
@@ -66,14 +114,24 @@
66 DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \ 114 DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \
67 ____cacheline_aligned_in_smp 115 ____cacheline_aligned_in_smp
68 116
117#define DECLARE_PER_CPU_ALIGNED(type, name) \
118 DECLARE_PER_CPU_SECTION(type, name, PER_CPU_ALIGNED_SECTION) \
119 ____cacheline_aligned
120
121#define DEFINE_PER_CPU_ALIGNED(type, name) \
122 DEFINE_PER_CPU_SECTION(type, name, PER_CPU_ALIGNED_SECTION) \
123 ____cacheline_aligned
124
69/* 125/*
70 * Declaration/definition used for per-CPU variables that must be page aligned. 126 * Declaration/definition used for per-CPU variables that must be page aligned.
71 */ 127 */
72#define DECLARE_PER_CPU_PAGE_ALIGNED(type, name) \ 128#define DECLARE_PER_CPU_PAGE_ALIGNED(type, name) \
73 DECLARE_PER_CPU_SECTION(type, name, ".page_aligned") 129 DECLARE_PER_CPU_SECTION(type, name, ".page_aligned") \
130 __aligned(PAGE_SIZE)
74 131
75#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ 132#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \
76 DEFINE_PER_CPU_SECTION(type, name, ".page_aligned") 133 DEFINE_PER_CPU_SECTION(type, name, ".page_aligned") \
134 __aligned(PAGE_SIZE)
77 135
78/* 136/*
79 * Intermodule exports for per-CPU variables. 137 * Intermodule exports for per-CPU variables.
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 26fd9d12f050..878836ca999c 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -34,7 +34,7 @@
34 34
35#ifdef CONFIG_SMP 35#ifdef CONFIG_SMP
36 36
37#ifdef CONFIG_HAVE_DYNAMIC_PER_CPU_AREA 37#ifndef CONFIG_HAVE_LEGACY_PER_CPU_AREA
38 38
39/* minimum unit size, also is the maximum supported allocation size */ 39/* minimum unit size, also is the maximum supported allocation size */
40#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10) 40#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10)
@@ -57,19 +57,70 @@
57#endif 57#endif
58 58
59extern void *pcpu_base_addr; 59extern void *pcpu_base_addr;
60extern const unsigned long *pcpu_unit_offsets;
60 61
61typedef struct page * (*pcpu_get_page_fn_t)(unsigned int cpu, int pageno); 62struct pcpu_group_info {
62typedef void (*pcpu_populate_pte_fn_t)(unsigned long addr); 63 int nr_units; /* aligned # of units */
64 unsigned long base_offset; /* base address offset */
65 unsigned int *cpu_map; /* unit->cpu map, empty
66 * entries contain NR_CPUS */
67};
68
69struct pcpu_alloc_info {
70 size_t static_size;
71 size_t reserved_size;
72 size_t dyn_size;
73 size_t unit_size;
74 size_t atom_size;
75 size_t alloc_size;
76 size_t __ai_size; /* internal, don't use */
77 int nr_groups; /* 0 if grouping unnecessary */
78 struct pcpu_group_info groups[];
79};
63 80
64extern size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn, 81enum pcpu_fc {
65 size_t static_size, size_t reserved_size, 82 PCPU_FC_AUTO,
66 ssize_t dyn_size, ssize_t unit_size, 83 PCPU_FC_EMBED,
67 void *base_addr, 84 PCPU_FC_PAGE,
68 pcpu_populate_pte_fn_t populate_pte_fn);
69 85
70extern ssize_t __init pcpu_embed_first_chunk( 86 PCPU_FC_NR,
71 size_t static_size, size_t reserved_size, 87};
72 ssize_t dyn_size, ssize_t unit_size); 88extern const char *pcpu_fc_names[PCPU_FC_NR];
89
90extern enum pcpu_fc pcpu_chosen_fc;
91
92typedef void * (*pcpu_fc_alloc_fn_t)(unsigned int cpu, size_t size,
93 size_t align);
94typedef void (*pcpu_fc_free_fn_t)(void *ptr, size_t size);
95typedef void (*pcpu_fc_populate_pte_fn_t)(unsigned long addr);
96typedef int (pcpu_fc_cpu_distance_fn_t)(unsigned int from, unsigned int to);
97
98extern struct pcpu_alloc_info * __init pcpu_alloc_alloc_info(int nr_groups,
99 int nr_units);
100extern void __init pcpu_free_alloc_info(struct pcpu_alloc_info *ai);
101
102extern struct pcpu_alloc_info * __init pcpu_build_alloc_info(
103 size_t reserved_size, ssize_t dyn_size,
104 size_t atom_size,
105 pcpu_fc_cpu_distance_fn_t cpu_distance_fn);
106
107extern int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
108 void *base_addr);
109
110#ifdef CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK
111extern int __init pcpu_embed_first_chunk(size_t reserved_size, ssize_t dyn_size,
112 size_t atom_size,
113 pcpu_fc_cpu_distance_fn_t cpu_distance_fn,
114 pcpu_fc_alloc_fn_t alloc_fn,
115 pcpu_fc_free_fn_t free_fn);
116#endif
117
118#ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK
119extern int __init pcpu_page_first_chunk(size_t reserved_size,
120 pcpu_fc_alloc_fn_t alloc_fn,
121 pcpu_fc_free_fn_t free_fn,
122 pcpu_fc_populate_pte_fn_t populate_pte_fn);
123#endif
73 124
74/* 125/*
75 * Use this to get to a cpu's version of the per-cpu object 126 * Use this to get to a cpu's version of the per-cpu object
@@ -80,7 +131,7 @@ extern ssize_t __init pcpu_embed_first_chunk(
80 131
81extern void *__alloc_reserved_percpu(size_t size, size_t align); 132extern void *__alloc_reserved_percpu(size_t size, size_t align);
82 133
83#else /* CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */ 134#else /* CONFIG_HAVE_LEGACY_PER_CPU_AREA */
84 135
85struct percpu_data { 136struct percpu_data {
86 void *ptrs[1]; 137 void *ptrs[1];
@@ -99,11 +150,15 @@ struct percpu_data {
99 (__typeof__(ptr))__p->ptrs[(cpu)]; \ 150 (__typeof__(ptr))__p->ptrs[(cpu)]; \
100}) 151})
101 152
102#endif /* CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */ 153#endif /* CONFIG_HAVE_LEGACY_PER_CPU_AREA */
103 154
104extern void *__alloc_percpu(size_t size, size_t align); 155extern void *__alloc_percpu(size_t size, size_t align);
105extern void free_percpu(void *__pdata); 156extern void free_percpu(void *__pdata);
106 157
158#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA
159extern void __init setup_per_cpu_areas(void);
160#endif
161
107#else /* CONFIG_SMP */ 162#else /* CONFIG_SMP */
108 163
109#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) 164#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); })
@@ -124,6 +179,13 @@ static inline void free_percpu(void *p)
124 kfree(p); 179 kfree(p);
125} 180}
126 181
182static inline void __init setup_per_cpu_areas(void) { }
183
184static inline void *pcpu_lpage_remapped(void *kaddr)
185{
186 return NULL;
187}
188
127#endif /* CONFIG_SMP */ 189#endif /* CONFIG_SMP */
128 190
129#define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type), \ 191#define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type), \
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index b53f7006cc4e..7b7fbf433cff 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -1,5 +1,9 @@
1/* 1/*
2 * Performance counters: 2 * NOTE: this file will be removed in a future kernel release, it is
3 * provided as a courtesy copy of user-space code that relies on the
4 * old (pre-rename) symbols and constants.
5 *
6 * Performance events:
3 * 7 *
4 * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de> 8 * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>
5 * Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar 9 * Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar
@@ -131,19 +135,19 @@ enum perf_counter_sample_format {
131 * as specified by attr.read_format: 135 * as specified by attr.read_format:
132 * 136 *
133 * struct read_format { 137 * struct read_format {
134 * { u64 value; 138 * { u64 value;
135 * { u64 time_enabled; } && PERF_FORMAT_ENABLED 139 * { u64 time_enabled; } && PERF_FORMAT_ENABLED
136 * { u64 time_running; } && PERF_FORMAT_RUNNING 140 * { u64 time_running; } && PERF_FORMAT_RUNNING
137 * { u64 id; } && PERF_FORMAT_ID 141 * { u64 id; } && PERF_FORMAT_ID
138 * } && !PERF_FORMAT_GROUP 142 * } && !PERF_FORMAT_GROUP
139 * 143 *
140 * { u64 nr; 144 * { u64 nr;
141 * { u64 time_enabled; } && PERF_FORMAT_ENABLED 145 * { u64 time_enabled; } && PERF_FORMAT_ENABLED
142 * { u64 time_running; } && PERF_FORMAT_RUNNING 146 * { u64 time_running; } && PERF_FORMAT_RUNNING
143 * { u64 value; 147 * { u64 value;
144 * { u64 id; } && PERF_FORMAT_ID 148 * { u64 id; } && PERF_FORMAT_ID
145 * } cntr[nr]; 149 * } cntr[nr];
146 * } && PERF_FORMAT_GROUP 150 * } && PERF_FORMAT_GROUP
147 * }; 151 * };
148 */ 152 */
149enum perf_counter_read_format { 153enum perf_counter_read_format {
@@ -199,10 +203,14 @@ struct perf_counter_attr {
199 inherit_stat : 1, /* per task counts */ 203 inherit_stat : 1, /* per task counts */
200 enable_on_exec : 1, /* next exec enables */ 204 enable_on_exec : 1, /* next exec enables */
201 task : 1, /* trace fork/exit */ 205 task : 1, /* trace fork/exit */
206 watermark : 1, /* wakeup_watermark */
202 207
203 __reserved_1 : 50; 208 __reserved_1 : 49;
204 209
205 __u32 wakeup_events; /* wakeup every n events */ 210 union {
211 __u32 wakeup_events; /* wakeup every n events */
212 __u32 wakeup_watermark; /* bytes before wakeup */
213 };
206 __u32 __reserved_2; 214 __u32 __reserved_2;
207 215
208 __u64 __reserved_3; 216 __u64 __reserved_3;
@@ -216,6 +224,7 @@ struct perf_counter_attr {
216#define PERF_COUNTER_IOC_REFRESH _IO ('$', 2) 224#define PERF_COUNTER_IOC_REFRESH _IO ('$', 2)
217#define PERF_COUNTER_IOC_RESET _IO ('$', 3) 225#define PERF_COUNTER_IOC_RESET _IO ('$', 3)
218#define PERF_COUNTER_IOC_PERIOD _IOW('$', 4, u64) 226#define PERF_COUNTER_IOC_PERIOD _IOW('$', 4, u64)
227#define PERF_COUNTER_IOC_SET_OUTPUT _IO ('$', 5)
219 228
220enum perf_counter_ioc_flags { 229enum perf_counter_ioc_flags {
221 PERF_IOC_FLAG_GROUP = 1U << 0, 230 PERF_IOC_FLAG_GROUP = 1U << 0,
@@ -309,9 +318,9 @@ enum perf_event_type {
309 318
310 /* 319 /*
311 * struct { 320 * struct {
312 * struct perf_event_header header; 321 * struct perf_event_header header;
313 * u64 id; 322 * u64 id;
314 * u64 lost; 323 * u64 lost;
315 * }; 324 * };
316 */ 325 */
317 PERF_EVENT_LOST = 2, 326 PERF_EVENT_LOST = 2,
@@ -331,6 +340,7 @@ enum perf_event_type {
331 * struct perf_event_header header; 340 * struct perf_event_header header;
332 * u32 pid, ppid; 341 * u32 pid, ppid;
333 * u32 tid, ptid; 342 * u32 tid, ptid;
343 * u64 time;
334 * }; 344 * };
335 */ 345 */
336 PERF_EVENT_EXIT = 4, 346 PERF_EVENT_EXIT = 4,
@@ -351,16 +361,17 @@ enum perf_event_type {
351 * struct perf_event_header header; 361 * struct perf_event_header header;
352 * u32 pid, ppid; 362 * u32 pid, ppid;
353 * u32 tid, ptid; 363 * u32 tid, ptid;
364 * u64 time;
354 * }; 365 * };
355 */ 366 */
356 PERF_EVENT_FORK = 7, 367 PERF_EVENT_FORK = 7,
357 368
358 /* 369 /*
359 * struct { 370 * struct {
360 * struct perf_event_header header; 371 * struct perf_event_header header;
361 * u32 pid, tid; 372 * u32 pid, tid;
362 * 373 *
363 * struct read_format values; 374 * struct read_format values;
364 * }; 375 * };
365 */ 376 */
366 PERF_EVENT_READ = 8, 377 PERF_EVENT_READ = 8,
@@ -376,23 +387,23 @@ enum perf_event_type {
376 * { u64 id; } && PERF_SAMPLE_ID 387 * { u64 id; } && PERF_SAMPLE_ID
377 * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID 388 * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID
378 * { u32 cpu, res; } && PERF_SAMPLE_CPU 389 * { u32 cpu, res; } && PERF_SAMPLE_CPU
379 * { u64 period; } && PERF_SAMPLE_PERIOD 390 * { u64 period; } && PERF_SAMPLE_PERIOD
380 * 391 *
381 * { struct read_format values; } && PERF_SAMPLE_READ 392 * { struct read_format values; } && PERF_SAMPLE_READ
382 * 393 *
383 * { u64 nr, 394 * { u64 nr,
384 * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN 395 * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN
385 * 396 *
386 * # 397 * #
387 * # The RAW record below is opaque data wrt the ABI 398 * # The RAW record below is opaque data wrt the ABI
388 * # 399 * #
389 * # That is, the ABI doesn't make any promises wrt to 400 * # That is, the ABI doesn't make any promises wrt to
390 * # the stability of its content, it may vary depending 401 * # the stability of its content, it may vary depending
391 * # on event, hardware, kernel version and phase of 402 * # on event, hardware, kernel version and phase of
392 * # the moon. 403 * # the moon.
393 * # 404 * #
394 * # In other words, PERF_SAMPLE_RAW contents are not an ABI. 405 * # In other words, PERF_SAMPLE_RAW contents are not an ABI.
395 * # 406 * #
396 * 407 *
397 * { u32 size; 408 * { u32 size;
398 * char data[size];}&& PERF_SAMPLE_RAW 409 * char data[size];}&& PERF_SAMPLE_RAW
@@ -415,386 +426,16 @@ enum perf_callchain_context {
415 PERF_CONTEXT_MAX = (__u64)-4095, 426 PERF_CONTEXT_MAX = (__u64)-4095,
416}; 427};
417 428
418#ifdef __KERNEL__ 429#define PERF_FLAG_FD_NO_GROUP (1U << 0)
419/* 430#define PERF_FLAG_FD_OUTPUT (1U << 1)
420 * Kernel-internal data types and definitions:
421 */
422
423#ifdef CONFIG_PERF_COUNTERS
424# include <asm/perf_counter.h>
425#endif
426
427#include <linux/list.h>
428#include <linux/mutex.h>
429#include <linux/rculist.h>
430#include <linux/rcupdate.h>
431#include <linux/spinlock.h>
432#include <linux/hrtimer.h>
433#include <linux/fs.h>
434#include <linux/pid_namespace.h>
435#include <asm/atomic.h>
436
437#define PERF_MAX_STACK_DEPTH 255
438
439struct perf_callchain_entry {
440 __u64 nr;
441 __u64 ip[PERF_MAX_STACK_DEPTH];
442};
443
444struct perf_raw_record {
445 u32 size;
446 void *data;
447};
448
449struct task_struct;
450
451/**
452 * struct hw_perf_counter - performance counter hardware details:
453 */
454struct hw_perf_counter {
455#ifdef CONFIG_PERF_COUNTERS
456 union {
457 struct { /* hardware */
458 u64 config;
459 unsigned long config_base;
460 unsigned long counter_base;
461 int idx;
462 };
463 union { /* software */
464 atomic64_t count;
465 struct hrtimer hrtimer;
466 };
467 };
468 atomic64_t prev_count;
469 u64 sample_period;
470 u64 last_period;
471 atomic64_t period_left;
472 u64 interrupts;
473
474 u64 freq_count;
475 u64 freq_interrupts;
476 u64 freq_stamp;
477#endif
478};
479
480struct perf_counter;
481
482/**
483 * struct pmu - generic performance monitoring unit
484 */
485struct pmu {
486 int (*enable) (struct perf_counter *counter);
487 void (*disable) (struct perf_counter *counter);
488 void (*read) (struct perf_counter *counter);
489 void (*unthrottle) (struct perf_counter *counter);
490};
491
492/**
493 * enum perf_counter_active_state - the states of a counter
494 */
495enum perf_counter_active_state {
496 PERF_COUNTER_STATE_ERROR = -2,
497 PERF_COUNTER_STATE_OFF = -1,
498 PERF_COUNTER_STATE_INACTIVE = 0,
499 PERF_COUNTER_STATE_ACTIVE = 1,
500};
501
502struct file;
503
504struct perf_mmap_data {
505 struct rcu_head rcu_head;
506 int nr_pages; /* nr of data pages */
507 int writable; /* are we writable */
508 int nr_locked; /* nr pages mlocked */
509
510 atomic_t poll; /* POLL_ for wakeups */
511 atomic_t events; /* event limit */
512
513 atomic_long_t head; /* write position */
514 atomic_long_t done_head; /* completed head */
515
516 atomic_t lock; /* concurrent writes */
517 atomic_t wakeup; /* needs a wakeup */
518 atomic_t lost; /* nr records lost */
519
520 struct perf_counter_mmap_page *user_page;
521 void *data_pages[0];
522};
523
524struct perf_pending_entry {
525 struct perf_pending_entry *next;
526 void (*func)(struct perf_pending_entry *);
527};
528
529/**
530 * struct perf_counter - performance counter kernel representation:
531 */
532struct perf_counter {
533#ifdef CONFIG_PERF_COUNTERS
534 struct list_head list_entry;
535 struct list_head event_entry;
536 struct list_head sibling_list;
537 int nr_siblings;
538 struct perf_counter *group_leader;
539 const struct pmu *pmu;
540
541 enum perf_counter_active_state state;
542 atomic64_t count;
543
544 /*
545 * These are the total time in nanoseconds that the counter
546 * has been enabled (i.e. eligible to run, and the task has
547 * been scheduled in, if this is a per-task counter)
548 * and running (scheduled onto the CPU), respectively.
549 *
550 * They are computed from tstamp_enabled, tstamp_running and
551 * tstamp_stopped when the counter is in INACTIVE or ACTIVE state.
552 */
553 u64 total_time_enabled;
554 u64 total_time_running;
555
556 /*
557 * These are timestamps used for computing total_time_enabled
558 * and total_time_running when the counter is in INACTIVE or
559 * ACTIVE state, measured in nanoseconds from an arbitrary point
560 * in time.
561 * tstamp_enabled: the notional time when the counter was enabled
562 * tstamp_running: the notional time when the counter was scheduled on
563 * tstamp_stopped: in INACTIVE state, the notional time when the
564 * counter was scheduled off.
565 */
566 u64 tstamp_enabled;
567 u64 tstamp_running;
568 u64 tstamp_stopped;
569
570 struct perf_counter_attr attr;
571 struct hw_perf_counter hw;
572
573 struct perf_counter_context *ctx;
574 struct file *filp;
575
576 /*
577 * These accumulate total time (in nanoseconds) that children
578 * counters have been enabled and running, respectively.
579 */
580 atomic64_t child_total_time_enabled;
581 atomic64_t child_total_time_running;
582
583 /*
584 * Protect attach/detach and child_list:
585 */
586 struct mutex child_mutex;
587 struct list_head child_list;
588 struct perf_counter *parent;
589
590 int oncpu;
591 int cpu;
592
593 struct list_head owner_entry;
594 struct task_struct *owner;
595
596 /* mmap bits */
597 struct mutex mmap_mutex;
598 atomic_t mmap_count;
599 struct perf_mmap_data *data;
600
601 /* poll related */
602 wait_queue_head_t waitq;
603 struct fasync_struct *fasync;
604
605 /* delayed work for NMIs and such */
606 int pending_wakeup;
607 int pending_kill;
608 int pending_disable;
609 struct perf_pending_entry pending;
610
611 atomic_t event_limit;
612
613 void (*destroy)(struct perf_counter *);
614 struct rcu_head rcu_head;
615
616 struct pid_namespace *ns;
617 u64 id;
618#endif
619};
620
621/**
622 * struct perf_counter_context - counter context structure
623 *
624 * Used as a container for task counters and CPU counters as well:
625 */
626struct perf_counter_context {
627 /*
628 * Protect the states of the counters in the list,
629 * nr_active, and the list:
630 */
631 spinlock_t lock;
632 /*
633 * Protect the list of counters. Locking either mutex or lock
634 * is sufficient to ensure the list doesn't change; to change
635 * the list you need to lock both the mutex and the spinlock.
636 */
637 struct mutex mutex;
638
639 struct list_head counter_list;
640 struct list_head event_list;
641 int nr_counters;
642 int nr_active;
643 int is_active;
644 int nr_stat;
645 atomic_t refcount;
646 struct task_struct *task;
647
648 /*
649 * Context clock, runs when context enabled.
650 */
651 u64 time;
652 u64 timestamp;
653
654 /*
655 * These fields let us detect when two contexts have both
656 * been cloned (inherited) from a common ancestor.
657 */
658 struct perf_counter_context *parent_ctx;
659 u64 parent_gen;
660 u64 generation;
661 int pin_count;
662 struct rcu_head rcu_head;
663};
664
665/**
666 * struct perf_counter_cpu_context - per cpu counter context structure
667 */
668struct perf_cpu_context {
669 struct perf_counter_context ctx;
670 struct perf_counter_context *task_ctx;
671 int active_oncpu;
672 int max_pertask;
673 int exclusive;
674
675 /*
676 * Recursion avoidance:
677 *
678 * task, softirq, irq, nmi context
679 */
680 int recursion[4];
681};
682
683#ifdef CONFIG_PERF_COUNTERS
684 431
685/* 432/*
686 * Set by architecture code: 433 * In case some app still references the old symbols:
687 */ 434 */
688extern int perf_max_counters;
689
690extern const struct pmu *hw_perf_counter_init(struct perf_counter *counter);
691
692extern void perf_counter_task_sched_in(struct task_struct *task, int cpu);
693extern void perf_counter_task_sched_out(struct task_struct *task,
694 struct task_struct *next, int cpu);
695extern void perf_counter_task_tick(struct task_struct *task, int cpu);
696extern int perf_counter_init_task(struct task_struct *child);
697extern void perf_counter_exit_task(struct task_struct *child);
698extern void perf_counter_free_task(struct task_struct *task);
699extern void set_perf_counter_pending(void);
700extern void perf_counter_do_pending(void);
701extern void perf_counter_print_debug(void);
702extern void __perf_disable(void);
703extern bool __perf_enable(void);
704extern void perf_disable(void);
705extern void perf_enable(void);
706extern int perf_counter_task_disable(void);
707extern int perf_counter_task_enable(void);
708extern int hw_perf_group_sched_in(struct perf_counter *group_leader,
709 struct perf_cpu_context *cpuctx,
710 struct perf_counter_context *ctx, int cpu);
711extern void perf_counter_update_userpage(struct perf_counter *counter);
712
713struct perf_sample_data {
714 struct pt_regs *regs;
715 u64 addr;
716 u64 period;
717 struct perf_raw_record *raw;
718};
719 435
720extern int perf_counter_overflow(struct perf_counter *counter, int nmi, 436#define __NR_perf_counter_open __NR_perf_event_open
721 struct perf_sample_data *data); 437
722extern void perf_counter_output(struct perf_counter *counter, int nmi, 438#define PR_TASK_PERF_COUNTERS_DISABLE PR_TASK_PERF_EVENTS_DISABLE
723 struct perf_sample_data *data); 439#define PR_TASK_PERF_COUNTERS_ENABLE PR_TASK_PERF_EVENTS_ENABLE
724 440
725/*
726 * Return 1 for a software counter, 0 for a hardware counter
727 */
728static inline int is_software_counter(struct perf_counter *counter)
729{
730 return (counter->attr.type != PERF_TYPE_RAW) &&
731 (counter->attr.type != PERF_TYPE_HARDWARE) &&
732 (counter->attr.type != PERF_TYPE_HW_CACHE);
733}
734
735extern atomic_t perf_swcounter_enabled[PERF_COUNT_SW_MAX];
736
737extern void __perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);
738
739static inline void
740perf_swcounter_event(u32 event, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
741{
742 if (atomic_read(&perf_swcounter_enabled[event]))
743 __perf_swcounter_event(event, nr, nmi, regs, addr);
744}
745
746extern void __perf_counter_mmap(struct vm_area_struct *vma);
747
748static inline void perf_counter_mmap(struct vm_area_struct *vma)
749{
750 if (vma->vm_flags & VM_EXEC)
751 __perf_counter_mmap(vma);
752}
753
754extern void perf_counter_comm(struct task_struct *tsk);
755extern void perf_counter_fork(struct task_struct *tsk);
756
757extern struct perf_callchain_entry *perf_callchain(struct pt_regs *regs);
758
759extern int sysctl_perf_counter_paranoid;
760extern int sysctl_perf_counter_mlock;
761extern int sysctl_perf_counter_sample_rate;
762
763extern void perf_counter_init(void);
764
765#ifndef perf_misc_flags
766#define perf_misc_flags(regs) (user_mode(regs) ? PERF_EVENT_MISC_USER : \
767 PERF_EVENT_MISC_KERNEL)
768#define perf_instruction_pointer(regs) instruction_pointer(regs)
769#endif
770
771#else
772static inline void
773perf_counter_task_sched_in(struct task_struct *task, int cpu) { }
774static inline void
775perf_counter_task_sched_out(struct task_struct *task,
776 struct task_struct *next, int cpu) { }
777static inline void
778perf_counter_task_tick(struct task_struct *task, int cpu) { }
779static inline int perf_counter_init_task(struct task_struct *child) { return 0; }
780static inline void perf_counter_exit_task(struct task_struct *child) { }
781static inline void perf_counter_free_task(struct task_struct *task) { }
782static inline void perf_counter_do_pending(void) { }
783static inline void perf_counter_print_debug(void) { }
784static inline void perf_disable(void) { }
785static inline void perf_enable(void) { }
786static inline int perf_counter_task_disable(void) { return -EINVAL; }
787static inline int perf_counter_task_enable(void) { return -EINVAL; }
788
789static inline void
790perf_swcounter_event(u32 event, u64 nr, int nmi,
791 struct pt_regs *regs, u64 addr) { }
792
793static inline void perf_counter_mmap(struct vm_area_struct *vma) { }
794static inline void perf_counter_comm(struct task_struct *tsk) { }
795static inline void perf_counter_fork(struct task_struct *tsk) { }
796static inline void perf_counter_init(void) { }
797#endif
798
799#endif /* __KERNEL__ */
800#endif /* _LINUX_PERF_COUNTER_H */ 441#endif /* _LINUX_PERF_COUNTER_H */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
new file mode 100644
index 000000000000..9e7012689a84
--- /dev/null
+++ b/include/linux/perf_event.h
@@ -0,0 +1,863 @@
1/*
2 * Performance events:
3 *
4 * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>
5 * Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar
6 * Copyright (C) 2008-2009, Red Hat, Inc., Peter Zijlstra
7 *
8 * Data type definitions, declarations, prototypes.
9 *
10 * Started by: Thomas Gleixner and Ingo Molnar
11 *
12 * For licencing details see kernel-base/COPYING
13 */
14#ifndef _LINUX_PERF_EVENT_H
15#define _LINUX_PERF_EVENT_H
16
17#include <linux/types.h>
18#include <linux/ioctl.h>
19#include <asm/byteorder.h>
20
21/*
22 * User-space ABI bits:
23 */
24
25/*
26 * attr.type
27 */
28enum perf_type_id {
29 PERF_TYPE_HARDWARE = 0,
30 PERF_TYPE_SOFTWARE = 1,
31 PERF_TYPE_TRACEPOINT = 2,
32 PERF_TYPE_HW_CACHE = 3,
33 PERF_TYPE_RAW = 4,
34
35 PERF_TYPE_MAX, /* non-ABI */
36};
37
38/*
39 * Generalized performance event event_id types, used by the
40 * attr.event_id parameter of the sys_perf_event_open()
41 * syscall:
42 */
43enum perf_hw_id {
44 /*
45 * Common hardware events, generalized by the kernel:
46 */
47 PERF_COUNT_HW_CPU_CYCLES = 0,
48 PERF_COUNT_HW_INSTRUCTIONS = 1,
49 PERF_COUNT_HW_CACHE_REFERENCES = 2,
50 PERF_COUNT_HW_CACHE_MISSES = 3,
51 PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4,
52 PERF_COUNT_HW_BRANCH_MISSES = 5,
53 PERF_COUNT_HW_BUS_CYCLES = 6,
54
55 PERF_COUNT_HW_MAX, /* non-ABI */
56};
57
58/*
59 * Generalized hardware cache events:
60 *
61 * { L1-D, L1-I, LLC, ITLB, DTLB, BPU } x
62 * { read, write, prefetch } x
63 * { accesses, misses }
64 */
65enum perf_hw_cache_id {
66 PERF_COUNT_HW_CACHE_L1D = 0,
67 PERF_COUNT_HW_CACHE_L1I = 1,
68 PERF_COUNT_HW_CACHE_LL = 2,
69 PERF_COUNT_HW_CACHE_DTLB = 3,
70 PERF_COUNT_HW_CACHE_ITLB = 4,
71 PERF_COUNT_HW_CACHE_BPU = 5,
72
73 PERF_COUNT_HW_CACHE_MAX, /* non-ABI */
74};
75
76enum perf_hw_cache_op_id {
77 PERF_COUNT_HW_CACHE_OP_READ = 0,
78 PERF_COUNT_HW_CACHE_OP_WRITE = 1,
79 PERF_COUNT_HW_CACHE_OP_PREFETCH = 2,
80
81 PERF_COUNT_HW_CACHE_OP_MAX, /* non-ABI */
82};
83
84enum perf_hw_cache_op_result_id {
85 PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0,
86 PERF_COUNT_HW_CACHE_RESULT_MISS = 1,
87
88 PERF_COUNT_HW_CACHE_RESULT_MAX, /* non-ABI */
89};
90
91/*
92 * Special "software" events provided by the kernel, even if the hardware
93 * does not support performance events. These events measure various
94 * physical and sw events of the kernel (and allow the profiling of them as
95 * well):
96 */
97enum perf_sw_ids {
98 PERF_COUNT_SW_CPU_CLOCK = 0,
99 PERF_COUNT_SW_TASK_CLOCK = 1,
100 PERF_COUNT_SW_PAGE_FAULTS = 2,
101 PERF_COUNT_SW_CONTEXT_SWITCHES = 3,
102 PERF_COUNT_SW_CPU_MIGRATIONS = 4,
103 PERF_COUNT_SW_PAGE_FAULTS_MIN = 5,
104 PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6,
105
106 PERF_COUNT_SW_MAX, /* non-ABI */
107};
108
109/*
110 * Bits that can be set in attr.sample_type to request information
111 * in the overflow packets.
112 */
113enum perf_event_sample_format {
114 PERF_SAMPLE_IP = 1U << 0,
115 PERF_SAMPLE_TID = 1U << 1,
116 PERF_SAMPLE_TIME = 1U << 2,
117 PERF_SAMPLE_ADDR = 1U << 3,
118 PERF_SAMPLE_READ = 1U << 4,
119 PERF_SAMPLE_CALLCHAIN = 1U << 5,
120 PERF_SAMPLE_ID = 1U << 6,
121 PERF_SAMPLE_CPU = 1U << 7,
122 PERF_SAMPLE_PERIOD = 1U << 8,
123 PERF_SAMPLE_STREAM_ID = 1U << 9,
124 PERF_SAMPLE_RAW = 1U << 10,
125
126 PERF_SAMPLE_MAX = 1U << 11, /* non-ABI */
127};
128
129/*
130 * The format of the data returned by read() on a perf event fd,
131 * as specified by attr.read_format:
132 *
133 * struct read_format {
134 * { u64 value;
135 * { u64 time_enabled; } && PERF_FORMAT_ENABLED
136 * { u64 time_running; } && PERF_FORMAT_RUNNING
137 * { u64 id; } && PERF_FORMAT_ID
138 * } && !PERF_FORMAT_GROUP
139 *
140 * { u64 nr;
141 * { u64 time_enabled; } && PERF_FORMAT_ENABLED
142 * { u64 time_running; } && PERF_FORMAT_RUNNING
143 * { u64 value;
144 * { u64 id; } && PERF_FORMAT_ID
145 * } cntr[nr];
146 * } && PERF_FORMAT_GROUP
147 * };
148 */
149enum perf_event_read_format {
150 PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0,
151 PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1,
152 PERF_FORMAT_ID = 1U << 2,
153 PERF_FORMAT_GROUP = 1U << 3,
154
155 PERF_FORMAT_MAX = 1U << 4, /* non-ABI */
156};
157
158#define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */
159
160/*
161 * Hardware event_id to monitor via a performance monitoring event:
162 */
163struct perf_event_attr {
164
165 /*
166 * Major type: hardware/software/tracepoint/etc.
167 */
168 __u32 type;
169
170 /*
171 * Size of the attr structure, for fwd/bwd compat.
172 */
173 __u32 size;
174
175 /*
176 * Type specific configuration information.
177 */
178 __u64 config;
179
180 union {
181 __u64 sample_period;
182 __u64 sample_freq;
183 };
184
185 __u64 sample_type;
186 __u64 read_format;
187
188 __u64 disabled : 1, /* off by default */
189 inherit : 1, /* children inherit it */
190 pinned : 1, /* must always be on PMU */
191 exclusive : 1, /* only group on PMU */
192 exclude_user : 1, /* don't count user */
193 exclude_kernel : 1, /* ditto kernel */
194 exclude_hv : 1, /* ditto hypervisor */
195 exclude_idle : 1, /* don't count when idle */
196 mmap : 1, /* include mmap data */
197 comm : 1, /* include comm data */
198 freq : 1, /* use freq, not period */
199 inherit_stat : 1, /* per task counts */
200 enable_on_exec : 1, /* next exec enables */
201 task : 1, /* trace fork/exit */
202 watermark : 1, /* wakeup_watermark */
203
204 __reserved_1 : 49;
205
206 union {
207 __u32 wakeup_events; /* wakeup every n events */
208 __u32 wakeup_watermark; /* bytes before wakeup */
209 };
210 __u32 __reserved_2;
211
212 __u64 __reserved_3;
213};
214
215/*
216 * Ioctls that can be done on a perf event fd:
217 */
218#define PERF_EVENT_IOC_ENABLE _IO ('$', 0)
219#define PERF_EVENT_IOC_DISABLE _IO ('$', 1)
220#define PERF_EVENT_IOC_REFRESH _IO ('$', 2)
221#define PERF_EVENT_IOC_RESET _IO ('$', 3)
222#define PERF_EVENT_IOC_PERIOD _IOW('$', 4, u64)
223#define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5)
224
225enum perf_event_ioc_flags {
226 PERF_IOC_FLAG_GROUP = 1U << 0,
227};
228
229/*
230 * Structure of the page that can be mapped via mmap
231 */
232struct perf_event_mmap_page {
233 __u32 version; /* version number of this structure */
234 __u32 compat_version; /* lowest version this is compat with */
235
236 /*
237 * Bits needed to read the hw events in user-space.
238 *
239 * u32 seq;
240 * s64 count;
241 *
242 * do {
243 * seq = pc->lock;
244 *
245 * barrier()
246 * if (pc->index) {
247 * count = pmc_read(pc->index - 1);
248 * count += pc->offset;
249 * } else
250 * goto regular_read;
251 *
252 * barrier();
253 * } while (pc->lock != seq);
254 *
255 * NOTE: for obvious reason this only works on self-monitoring
256 * processes.
257 */
258 __u32 lock; /* seqlock for synchronization */
259 __u32 index; /* hardware event identifier */
260 __s64 offset; /* add to hardware event value */
261 __u64 time_enabled; /* time event active */
262 __u64 time_running; /* time event on cpu */
263
264 /*
265 * Hole for extension of the self monitor capabilities
266 */
267
268 __u64 __reserved[123]; /* align to 1k */
269
270 /*
271 * Control data for the mmap() data buffer.
272 *
273 * User-space reading the @data_head value should issue an rmb(), on
274 * SMP capable platforms, after reading this value -- see
275 * perf_event_wakeup().
276 *
277 * When the mapping is PROT_WRITE the @data_tail value should be
278 * written by userspace to reflect the last read data. In this case
279 * the kernel will not over-write unread data.
280 */
281 __u64 data_head; /* head in the data section */
282 __u64 data_tail; /* user-space written tail */
283};
284
285#define PERF_RECORD_MISC_CPUMODE_MASK (3 << 0)
286#define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0)
287#define PERF_RECORD_MISC_KERNEL (1 << 0)
288#define PERF_RECORD_MISC_USER (2 << 0)
289#define PERF_RECORD_MISC_HYPERVISOR (3 << 0)
290
291struct perf_event_header {
292 __u32 type;
293 __u16 misc;
294 __u16 size;
295};
296
297enum perf_event_type {
298
299 /*
300 * The MMAP events record the PROT_EXEC mappings so that we can
301 * correlate userspace IPs to code. They have the following structure:
302 *
303 * struct {
304 * struct perf_event_header header;
305 *
306 * u32 pid, tid;
307 * u64 addr;
308 * u64 len;
309 * u64 pgoff;
310 * char filename[];
311 * };
312 */
313 PERF_RECORD_MMAP = 1,
314
315 /*
316 * struct {
317 * struct perf_event_header header;
318 * u64 id;
319 * u64 lost;
320 * };
321 */
322 PERF_RECORD_LOST = 2,
323
324 /*
325 * struct {
326 * struct perf_event_header header;
327 *
328 * u32 pid, tid;
329 * char comm[];
330 * };
331 */
332 PERF_RECORD_COMM = 3,
333
334 /*
335 * struct {
336 * struct perf_event_header header;
337 * u32 pid, ppid;
338 * u32 tid, ptid;
339 * u64 time;
340 * };
341 */
342 PERF_RECORD_EXIT = 4,
343
344 /*
345 * struct {
346 * struct perf_event_header header;
347 * u64 time;
348 * u64 id;
349 * u64 stream_id;
350 * };
351 */
352 PERF_RECORD_THROTTLE = 5,
353 PERF_RECORD_UNTHROTTLE = 6,
354
355 /*
356 * struct {
357 * struct perf_event_header header;
358 * u32 pid, ppid;
359 * u32 tid, ptid;
360 * u64 time;
361 * };
362 */
363 PERF_RECORD_FORK = 7,
364
365 /*
366 * struct {
367 * struct perf_event_header header;
368 * u32 pid, tid;
369 *
370 * struct read_format values;
371 * };
372 */
373 PERF_RECORD_READ = 8,
374
375 /*
376 * struct {
377 * struct perf_event_header header;
378 *
379 * { u64 ip; } && PERF_SAMPLE_IP
380 * { u32 pid, tid; } && PERF_SAMPLE_TID
381 * { u64 time; } && PERF_SAMPLE_TIME
382 * { u64 addr; } && PERF_SAMPLE_ADDR
383 * { u64 id; } && PERF_SAMPLE_ID
384 * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID
385 * { u32 cpu, res; } && PERF_SAMPLE_CPU
386 * { u64 period; } && PERF_SAMPLE_PERIOD
387 *
388 * { struct read_format values; } && PERF_SAMPLE_READ
389 *
390 * { u64 nr,
391 * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN
392 *
393 * #
394 * # The RAW record below is opaque data wrt the ABI
395 * #
396 * # That is, the ABI doesn't make any promises wrt to
397 * # the stability of its content, it may vary depending
398 * # on event, hardware, kernel version and phase of
399 * # the moon.
400 * #
401 * # In other words, PERF_SAMPLE_RAW contents are not an ABI.
402 * #
403 *
404 * { u32 size;
405 * char data[size];}&& PERF_SAMPLE_RAW
406 * };
407 */
408 PERF_RECORD_SAMPLE = 9,
409
410 PERF_RECORD_MAX, /* non-ABI */
411};
412
413enum perf_callchain_context {
414 PERF_CONTEXT_HV = (__u64)-32,
415 PERF_CONTEXT_KERNEL = (__u64)-128,
416 PERF_CONTEXT_USER = (__u64)-512,
417
418 PERF_CONTEXT_GUEST = (__u64)-2048,
419 PERF_CONTEXT_GUEST_KERNEL = (__u64)-2176,
420 PERF_CONTEXT_GUEST_USER = (__u64)-2560,
421
422 PERF_CONTEXT_MAX = (__u64)-4095,
423};
424
425#define PERF_FLAG_FD_NO_GROUP (1U << 0)
426#define PERF_FLAG_FD_OUTPUT (1U << 1)
427
428#ifdef __KERNEL__
429/*
430 * Kernel-internal data types and definitions:
431 */
432
433#ifdef CONFIG_PERF_EVENTS
434# include <asm/perf_event.h>
435#endif
436
437#include <linux/list.h>
438#include <linux/mutex.h>
439#include <linux/rculist.h>
440#include <linux/rcupdate.h>
441#include <linux/spinlock.h>
442#include <linux/hrtimer.h>
443#include <linux/fs.h>
444#include <linux/pid_namespace.h>
445#include <linux/workqueue.h>
446#include <asm/atomic.h>
447
448#define PERF_MAX_STACK_DEPTH 255
449
450struct perf_callchain_entry {
451 __u64 nr;
452 __u64 ip[PERF_MAX_STACK_DEPTH];
453};
454
455struct perf_raw_record {
456 u32 size;
457 void *data;
458};
459
460struct task_struct;
461
462/**
463 * struct hw_perf_event - performance event hardware details:
464 */
465struct hw_perf_event {
466#ifdef CONFIG_PERF_EVENTS
467 union {
468 struct { /* hardware */
469 u64 config;
470 unsigned long config_base;
471 unsigned long event_base;
472 int idx;
473 };
474 struct { /* software */
475 s64 remaining;
476 struct hrtimer hrtimer;
477 };
478 };
479 atomic64_t prev_count;
480 u64 sample_period;
481 u64 last_period;
482 atomic64_t period_left;
483 u64 interrupts;
484
485 u64 freq_count;
486 u64 freq_interrupts;
487 u64 freq_stamp;
488#endif
489};
490
491struct perf_event;
492
493/**
494 * struct pmu - generic performance monitoring unit
495 */
496struct pmu {
497 int (*enable) (struct perf_event *event);
498 void (*disable) (struct perf_event *event);
499 void (*read) (struct perf_event *event);
500 void (*unthrottle) (struct perf_event *event);
501};
502
503/**
504 * enum perf_event_active_state - the states of a event
505 */
506enum perf_event_active_state {
507 PERF_EVENT_STATE_ERROR = -2,
508 PERF_EVENT_STATE_OFF = -1,
509 PERF_EVENT_STATE_INACTIVE = 0,
510 PERF_EVENT_STATE_ACTIVE = 1,
511};
512
513struct file;
514
515struct perf_mmap_data {
516 struct rcu_head rcu_head;
517#ifdef CONFIG_PERF_USE_VMALLOC
518 struct work_struct work;
519#endif
520 int data_order;
521 int nr_pages; /* nr of data pages */
522 int writable; /* are we writable */
523 int nr_locked; /* nr pages mlocked */
524
525 atomic_t poll; /* POLL_ for wakeups */
526 atomic_t events; /* event_id limit */
527
528 atomic_long_t head; /* write position */
529 atomic_long_t done_head; /* completed head */
530
531 atomic_t lock; /* concurrent writes */
532 atomic_t wakeup; /* needs a wakeup */
533 atomic_t lost; /* nr records lost */
534
535 long watermark; /* wakeup watermark */
536
537 struct perf_event_mmap_page *user_page;
538 void *data_pages[0];
539};
540
541struct perf_pending_entry {
542 struct perf_pending_entry *next;
543 void (*func)(struct perf_pending_entry *);
544};
545
546/**
547 * struct perf_event - performance event kernel representation:
548 */
549struct perf_event {
550#ifdef CONFIG_PERF_EVENTS
551 struct list_head group_entry;
552 struct list_head event_entry;
553 struct list_head sibling_list;
554 int nr_siblings;
555 struct perf_event *group_leader;
556 struct perf_event *output;
557 const struct pmu *pmu;
558
559 enum perf_event_active_state state;
560 atomic64_t count;
561
562 /*
563 * These are the total time in nanoseconds that the event
564 * has been enabled (i.e. eligible to run, and the task has
565 * been scheduled in, if this is a per-task event)
566 * and running (scheduled onto the CPU), respectively.
567 *
568 * They are computed from tstamp_enabled, tstamp_running and
569 * tstamp_stopped when the event is in INACTIVE or ACTIVE state.
570 */
571 u64 total_time_enabled;
572 u64 total_time_running;
573
574 /*
575 * These are timestamps used for computing total_time_enabled
576 * and total_time_running when the event is in INACTIVE or
577 * ACTIVE state, measured in nanoseconds from an arbitrary point
578 * in time.
579 * tstamp_enabled: the notional time when the event was enabled
580 * tstamp_running: the notional time when the event was scheduled on
581 * tstamp_stopped: in INACTIVE state, the notional time when the
582 * event was scheduled off.
583 */
584 u64 tstamp_enabled;
585 u64 tstamp_running;
586 u64 tstamp_stopped;
587
588 struct perf_event_attr attr;
589 struct hw_perf_event hw;
590
591 struct perf_event_context *ctx;
592 struct file *filp;
593
594 /*
595 * These accumulate total time (in nanoseconds) that children
596 * events have been enabled and running, respectively.
597 */
598 atomic64_t child_total_time_enabled;
599 atomic64_t child_total_time_running;
600
601 /*
602 * Protect attach/detach and child_list:
603 */
604 struct mutex child_mutex;
605 struct list_head child_list;
606 struct perf_event *parent;
607
608 int oncpu;
609 int cpu;
610
611 struct list_head owner_entry;
612 struct task_struct *owner;
613
614 /* mmap bits */
615 struct mutex mmap_mutex;
616 atomic_t mmap_count;
617 struct perf_mmap_data *data;
618
619 /* poll related */
620 wait_queue_head_t waitq;
621 struct fasync_struct *fasync;
622
623 /* delayed work for NMIs and such */
624 int pending_wakeup;
625 int pending_kill;
626 int pending_disable;
627 struct perf_pending_entry pending;
628
629 atomic_t event_limit;
630
631 void (*destroy)(struct perf_event *);
632 struct rcu_head rcu_head;
633
634 struct pid_namespace *ns;
635 u64 id;
636#endif
637};
638
639/**
640 * struct perf_event_context - event context structure
641 *
642 * Used as a container for task events and CPU events as well:
643 */
644struct perf_event_context {
645 /*
646 * Protect the states of the events in the list,
647 * nr_active, and the list:
648 */
649 spinlock_t lock;
650 /*
651 * Protect the list of events. Locking either mutex or lock
652 * is sufficient to ensure the list doesn't change; to change
653 * the list you need to lock both the mutex and the spinlock.
654 */
655 struct mutex mutex;
656
657 struct list_head group_list;
658 struct list_head event_list;
659 int nr_events;
660 int nr_active;
661 int is_active;
662 int nr_stat;
663 atomic_t refcount;
664 struct task_struct *task;
665
666 /*
667 * Context clock, runs when context enabled.
668 */
669 u64 time;
670 u64 timestamp;
671
672 /*
673 * These fields let us detect when two contexts have both
674 * been cloned (inherited) from a common ancestor.
675 */
676 struct perf_event_context *parent_ctx;
677 u64 parent_gen;
678 u64 generation;
679 int pin_count;
680 struct rcu_head rcu_head;
681};
682
683/**
684 * struct perf_event_cpu_context - per cpu event context structure
685 */
686struct perf_cpu_context {
687 struct perf_event_context ctx;
688 struct perf_event_context *task_ctx;
689 int active_oncpu;
690 int max_pertask;
691 int exclusive;
692
693 /*
694 * Recursion avoidance:
695 *
696 * task, softirq, irq, nmi context
697 */
698 int recursion[4];
699};
700
701struct perf_output_handle {
702 struct perf_event *event;
703 struct perf_mmap_data *data;
704 unsigned long head;
705 unsigned long offset;
706 int nmi;
707 int sample;
708 int locked;
709 unsigned long flags;
710};
711
712#ifdef CONFIG_PERF_EVENTS
713
714/*
715 * Set by architecture code:
716 */
717extern int perf_max_events;
718
719extern const struct pmu *hw_perf_event_init(struct perf_event *event);
720
721extern void perf_event_task_sched_in(struct task_struct *task, int cpu);
722extern void perf_event_task_sched_out(struct task_struct *task,
723 struct task_struct *next, int cpu);
724extern void perf_event_task_tick(struct task_struct *task, int cpu);
725extern int perf_event_init_task(struct task_struct *child);
726extern void perf_event_exit_task(struct task_struct *child);
727extern void perf_event_free_task(struct task_struct *task);
728extern void set_perf_event_pending(void);
729extern void perf_event_do_pending(void);
730extern void perf_event_print_debug(void);
731extern void __perf_disable(void);
732extern bool __perf_enable(void);
733extern void perf_disable(void);
734extern void perf_enable(void);
735extern int perf_event_task_disable(void);
736extern int perf_event_task_enable(void);
737extern int hw_perf_group_sched_in(struct perf_event *group_leader,
738 struct perf_cpu_context *cpuctx,
739 struct perf_event_context *ctx, int cpu);
740extern void perf_event_update_userpage(struct perf_event *event);
741
742struct perf_sample_data {
743 u64 type;
744
745 u64 ip;
746 struct {
747 u32 pid;
748 u32 tid;
749 } tid_entry;
750 u64 time;
751 u64 addr;
752 u64 id;
753 u64 stream_id;
754 struct {
755 u32 cpu;
756 u32 reserved;
757 } cpu_entry;
758 u64 period;
759 struct perf_callchain_entry *callchain;
760 struct perf_raw_record *raw;
761};
762
763extern void perf_output_sample(struct perf_output_handle *handle,
764 struct perf_event_header *header,
765 struct perf_sample_data *data,
766 struct perf_event *event);
767extern void perf_prepare_sample(struct perf_event_header *header,
768 struct perf_sample_data *data,
769 struct perf_event *event,
770 struct pt_regs *regs);
771
772extern int perf_event_overflow(struct perf_event *event, int nmi,
773 struct perf_sample_data *data,
774 struct pt_regs *regs);
775
776/*
777 * Return 1 for a software event, 0 for a hardware event
778 */
779static inline int is_software_event(struct perf_event *event)
780{
781 return (event->attr.type != PERF_TYPE_RAW) &&
782 (event->attr.type != PERF_TYPE_HARDWARE) &&
783 (event->attr.type != PERF_TYPE_HW_CACHE);
784}
785
786extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX];
787
788extern void __perf_sw_event(u32, u64, int, struct pt_regs *, u64);
789
790static inline void
791perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
792{
793 if (atomic_read(&perf_swevent_enabled[event_id]))
794 __perf_sw_event(event_id, nr, nmi, regs, addr);
795}
796
797extern void __perf_event_mmap(struct vm_area_struct *vma);
798
799static inline void perf_event_mmap(struct vm_area_struct *vma)
800{
801 if (vma->vm_flags & VM_EXEC)
802 __perf_event_mmap(vma);
803}
804
805extern void perf_event_comm(struct task_struct *tsk);
806extern void perf_event_fork(struct task_struct *tsk);
807
808extern struct perf_callchain_entry *perf_callchain(struct pt_regs *regs);
809
810extern int sysctl_perf_event_paranoid;
811extern int sysctl_perf_event_mlock;
812extern int sysctl_perf_event_sample_rate;
813
814extern void perf_event_init(void);
815extern void perf_tp_event(int event_id, u64 addr, u64 count,
816 void *record, int entry_size);
817
818#ifndef perf_misc_flags
819#define perf_misc_flags(regs) (user_mode(regs) ? PERF_RECORD_MISC_USER : \
820 PERF_RECORD_MISC_KERNEL)
821#define perf_instruction_pointer(regs) instruction_pointer(regs)
822#endif
823
824extern int perf_output_begin(struct perf_output_handle *handle,
825 struct perf_event *event, unsigned int size,
826 int nmi, int sample);
827extern void perf_output_end(struct perf_output_handle *handle);
828extern void perf_output_copy(struct perf_output_handle *handle,
829 const void *buf, unsigned int len);
830#else
831static inline void
832perf_event_task_sched_in(struct task_struct *task, int cpu) { }
833static inline void
834perf_event_task_sched_out(struct task_struct *task,
835 struct task_struct *next, int cpu) { }
836static inline void
837perf_event_task_tick(struct task_struct *task, int cpu) { }
838static inline int perf_event_init_task(struct task_struct *child) { return 0; }
839static inline void perf_event_exit_task(struct task_struct *child) { }
840static inline void perf_event_free_task(struct task_struct *task) { }
841static inline void perf_event_do_pending(void) { }
842static inline void perf_event_print_debug(void) { }
843static inline void perf_disable(void) { }
844static inline void perf_enable(void) { }
845static inline int perf_event_task_disable(void) { return -EINVAL; }
846static inline int perf_event_task_enable(void) { return -EINVAL; }
847
848static inline void
849perf_sw_event(u32 event_id, u64 nr, int nmi,
850 struct pt_regs *regs, u64 addr) { }
851
852static inline void perf_event_mmap(struct vm_area_struct *vma) { }
853static inline void perf_event_comm(struct task_struct *tsk) { }
854static inline void perf_event_fork(struct task_struct *tsk) { }
855static inline void perf_event_init(void) { }
856
857#endif
858
859#define perf_output_put(handle, x) \
860 perf_output_copy((handle), &(x), sizeof(x))
861
862#endif /* __KERNEL__ */
863#endif /* _LINUX_PERF_EVENT_H */
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
index ee5e3c9e2bca..e5126cff9b2a 100644
--- a/include/linux/phonet.h
+++ b/include/linux/phonet.h
@@ -38,6 +38,7 @@
38#define PNPIPE_IFINDEX 2 38#define PNPIPE_IFINDEX 2
39 39
40#define PNADDR_ANY 0 40#define PNADDR_ANY 0
41#define PNADDR_BROADCAST 0xFC
41#define PNPORT_RESOURCE_ROUTING 0 42#define PNPORT_RESOURCE_ROUTING 0
42 43
43/* Values for PNPIPE_ENCAP option */ 44/* Values for PNPIPE_ENCAP option */
@@ -99,6 +100,9 @@ struct sockaddr_pn {
99 __u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3]; 100 __u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3];
100} __attribute__ ((packed)); 101} __attribute__ ((packed));
101 102
103/* Well known address */
104#define PN_DEV_PC 0x10
105
102static inline __u16 pn_object(__u8 addr, __u16 port) 106static inline __u16 pn_object(__u8 addr, __u16 port)
103{ 107{
104 return (addr << 8) | (port & 0x3ff); 108 return (addr << 8) | (port & 0x3ff);
@@ -170,4 +174,21 @@ static inline __u8 pn_sockaddr_get_resource(const struct sockaddr_pn *spn)
170 return spn->spn_resource; 174 return spn->spn_resource;
171} 175}
172 176
177/* Phonet device ioctl requests */
178#ifdef __KERNEL__
179#define SIOCPNGAUTOCONF (SIOCDEVPRIVATE + 0)
180
181struct if_phonet_autoconf {
182 uint8_t device;
183};
184
185struct if_phonet_req {
186 char ifr_phonet_name[16];
187 union {
188 struct if_phonet_autoconf ifru_phonet_autoconf;
189 } ifr_ifru;
190};
191#define ifr_phonet_autoconf ifr_ifru.ifru_phonet_autoconf
192#endif /* __KERNEL__ */
193
173#endif 194#endif
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 8dc5123b6305..3c6675c2444b 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -22,6 +22,9 @@ struct platform_device {
22 struct resource * resource; 22 struct resource * resource;
23 23
24 struct platform_device_id *id_entry; 24 struct platform_device_id *id_entry;
25
26 /* arch specific additions */
27 struct pdev_archdata archdata;
25}; 28};
26 29
27#define platform_get_device_id(pdev) ((pdev)->id_entry) 30#define platform_get_device_id(pdev) ((pdev)->id_entry)
@@ -57,8 +60,6 @@ struct platform_driver {
57 int (*remove)(struct platform_device *); 60 int (*remove)(struct platform_device *);
58 void (*shutdown)(struct platform_device *); 61 void (*shutdown)(struct platform_device *);
59 int (*suspend)(struct platform_device *, pm_message_t state); 62 int (*suspend)(struct platform_device *, pm_message_t state);
60 int (*suspend_late)(struct platform_device *, pm_message_t state);
61 int (*resume_early)(struct platform_device *);
62 int (*resume)(struct platform_device *); 63 int (*resume)(struct platform_device *);
63 struct device_driver driver; 64 struct device_driver driver;
64 struct platform_device_id *id_table; 65 struct platform_device_id *id_table;
diff --git a/include/linux/pm.h b/include/linux/pm.h
index b3f74764a586..3b7e04b95bd2 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -22,6 +22,10 @@
22#define _LINUX_PM_H 22#define _LINUX_PM_H
23 23
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/workqueue.h>
26#include <linux/spinlock.h>
27#include <linux/wait.h>
28#include <linux/timer.h>
25 29
26/* 30/*
27 * Callbacks for platform drivers to implement. 31 * Callbacks for platform drivers to implement.
@@ -165,6 +169,28 @@ typedef struct pm_message {
165 * It is allowed to unregister devices while the above callbacks are being 169 * It is allowed to unregister devices while the above callbacks are being
166 * executed. However, it is not allowed to unregister a device from within any 170 * executed. However, it is not allowed to unregister a device from within any
167 * of its own callbacks. 171 * of its own callbacks.
172 *
173 * There also are the following callbacks related to run-time power management
174 * of devices:
175 *
176 * @runtime_suspend: Prepare the device for a condition in which it won't be
177 * able to communicate with the CPU(s) and RAM due to power management.
178 * This need not mean that the device should be put into a low power state.
179 * For example, if the device is behind a link which is about to be turned
180 * off, the device may remain at full power. If the device does go to low
181 * power and if device_may_wakeup(dev) is true, remote wake-up (i.e., a
182 * hardware mechanism allowing the device to request a change of its power
183 * state, such as PCI PME) should be enabled for it.
184 *
185 * @runtime_resume: Put the device into the fully active state in response to a
186 * wake-up event generated by hardware or at the request of software. If
187 * necessary, put the device into the full power state and restore its
188 * registers, so that it is fully operational.
189 *
190 * @runtime_idle: Device appears to be inactive and it might be put into a low
191 * power state if all of the necessary conditions are satisfied. Check
192 * these conditions and handle the device as appropriate, possibly queueing
193 * a suspend request for it. The return value is ignored by the PM core.
168 */ 194 */
169 195
170struct dev_pm_ops { 196struct dev_pm_ops {
@@ -182,8 +208,25 @@ struct dev_pm_ops {
182 int (*thaw_noirq)(struct device *dev); 208 int (*thaw_noirq)(struct device *dev);
183 int (*poweroff_noirq)(struct device *dev); 209 int (*poweroff_noirq)(struct device *dev);
184 int (*restore_noirq)(struct device *dev); 210 int (*restore_noirq)(struct device *dev);
211 int (*runtime_suspend)(struct device *dev);
212 int (*runtime_resume)(struct device *dev);
213 int (*runtime_idle)(struct device *dev);
185}; 214};
186 215
216/*
217 * Use this if you want to use the same suspend and resume callbacks for suspend
218 * to RAM and hibernation.
219 */
220#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
221struct dev_pm_ops name = { \
222 .suspend = suspend_fn, \
223 .resume = resume_fn, \
224 .freeze = suspend_fn, \
225 .thaw = resume_fn, \
226 .poweroff = suspend_fn, \
227 .restore = resume_fn, \
228}
229
187/** 230/**
188 * PM_EVENT_ messages 231 * PM_EVENT_ messages
189 * 232 *
@@ -315,14 +358,80 @@ enum dpm_state {
315 DPM_OFF_IRQ, 358 DPM_OFF_IRQ,
316}; 359};
317 360
361/**
362 * Device run-time power management status.
363 *
364 * These status labels are used internally by the PM core to indicate the
365 * current status of a device with respect to the PM core operations. They do
366 * not reflect the actual power state of the device or its status as seen by the
367 * driver.
368 *
369 * RPM_ACTIVE Device is fully operational. Indicates that the device
370 * bus type's ->runtime_resume() callback has completed
371 * successfully.
372 *
373 * RPM_SUSPENDED Device bus type's ->runtime_suspend() callback has
374 * completed successfully. The device is regarded as
375 * suspended.
376 *
377 * RPM_RESUMING Device bus type's ->runtime_resume() callback is being
378 * executed.
379 *
380 * RPM_SUSPENDING Device bus type's ->runtime_suspend() callback is being
381 * executed.
382 */
383
384enum rpm_status {
385 RPM_ACTIVE = 0,
386 RPM_RESUMING,
387 RPM_SUSPENDED,
388 RPM_SUSPENDING,
389};
390
391/**
392 * Device run-time power management request types.
393 *
394 * RPM_REQ_NONE Do nothing.
395 *
396 * RPM_REQ_IDLE Run the device bus type's ->runtime_idle() callback
397 *
398 * RPM_REQ_SUSPEND Run the device bus type's ->runtime_suspend() callback
399 *
400 * RPM_REQ_RESUME Run the device bus type's ->runtime_resume() callback
401 */
402
403enum rpm_request {
404 RPM_REQ_NONE = 0,
405 RPM_REQ_IDLE,
406 RPM_REQ_SUSPEND,
407 RPM_REQ_RESUME,
408};
409
318struct dev_pm_info { 410struct dev_pm_info {
319 pm_message_t power_state; 411 pm_message_t power_state;
320 unsigned can_wakeup:1; 412 unsigned int can_wakeup:1;
321 unsigned should_wakeup:1; 413 unsigned int should_wakeup:1;
322 enum dpm_state status; /* Owned by the PM core */ 414 enum dpm_state status; /* Owned by the PM core */
323#ifdef CONFIG_PM_SLEEP 415#ifdef CONFIG_PM_SLEEP
324 struct list_head entry; 416 struct list_head entry;
325#endif 417#endif
418#ifdef CONFIG_PM_RUNTIME
419 struct timer_list suspend_timer;
420 unsigned long timer_expires;
421 struct work_struct work;
422 wait_queue_head_t wait_queue;
423 spinlock_t lock;
424 atomic_t usage_count;
425 atomic_t child_count;
426 unsigned int disable_depth:3;
427 unsigned int ignore_children:1;
428 unsigned int idle_notification:1;
429 unsigned int request_pending:1;
430 unsigned int deferred_resume:1;
431 enum rpm_request request;
432 enum rpm_status runtime_status;
433 int runtime_error;
434#endif
326}; 435};
327 436
328/* 437/*
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
new file mode 100644
index 000000000000..44087044910f
--- /dev/null
+++ b/include/linux/pm_runtime.h
@@ -0,0 +1,114 @@
1/*
2 * pm_runtime.h - Device run-time power management helper functions.
3 *
4 * Copyright (C) 2009 Rafael J. Wysocki <rjw@sisk.pl>
5 *
6 * This file is released under the GPLv2.
7 */
8
9#ifndef _LINUX_PM_RUNTIME_H
10#define _LINUX_PM_RUNTIME_H
11
12#include <linux/device.h>
13#include <linux/pm.h>
14
15#ifdef CONFIG_PM_RUNTIME
16
17extern struct workqueue_struct *pm_wq;
18
19extern int pm_runtime_idle(struct device *dev);
20extern int pm_runtime_suspend(struct device *dev);
21extern int pm_runtime_resume(struct device *dev);
22extern int pm_request_idle(struct device *dev);
23extern int pm_schedule_suspend(struct device *dev, unsigned int delay);
24extern int pm_request_resume(struct device *dev);
25extern int __pm_runtime_get(struct device *dev, bool sync);
26extern int __pm_runtime_put(struct device *dev, bool sync);
27extern int __pm_runtime_set_status(struct device *dev, unsigned int status);
28extern int pm_runtime_barrier(struct device *dev);
29extern void pm_runtime_enable(struct device *dev);
30extern void __pm_runtime_disable(struct device *dev, bool check_resume);
31
32static inline bool pm_children_suspended(struct device *dev)
33{
34 return dev->power.ignore_children
35 || !atomic_read(&dev->power.child_count);
36}
37
38static inline void pm_suspend_ignore_children(struct device *dev, bool enable)
39{
40 dev->power.ignore_children = enable;
41}
42
43static inline void pm_runtime_get_noresume(struct device *dev)
44{
45 atomic_inc(&dev->power.usage_count);
46}
47
48static inline void pm_runtime_put_noidle(struct device *dev)
49{
50 atomic_add_unless(&dev->power.usage_count, -1, 0);
51}
52
53#else /* !CONFIG_PM_RUNTIME */
54
55static inline int pm_runtime_idle(struct device *dev) { return -ENOSYS; }
56static inline int pm_runtime_suspend(struct device *dev) { return -ENOSYS; }
57static inline int pm_runtime_resume(struct device *dev) { return 0; }
58static inline int pm_request_idle(struct device *dev) { return -ENOSYS; }
59static inline int pm_schedule_suspend(struct device *dev, unsigned int delay)
60{
61 return -ENOSYS;
62}
63static inline int pm_request_resume(struct device *dev) { return 0; }
64static inline int __pm_runtime_get(struct device *dev, bool sync) { return 1; }
65static inline int __pm_runtime_put(struct device *dev, bool sync) { return 0; }
66static inline int __pm_runtime_set_status(struct device *dev,
67 unsigned int status) { return 0; }
68static inline int pm_runtime_barrier(struct device *dev) { return 0; }
69static inline void pm_runtime_enable(struct device *dev) {}
70static inline void __pm_runtime_disable(struct device *dev, bool c) {}
71
72static inline bool pm_children_suspended(struct device *dev) { return false; }
73static inline void pm_suspend_ignore_children(struct device *dev, bool en) {}
74static inline void pm_runtime_get_noresume(struct device *dev) {}
75static inline void pm_runtime_put_noidle(struct device *dev) {}
76
77#endif /* !CONFIG_PM_RUNTIME */
78
79static inline int pm_runtime_get(struct device *dev)
80{
81 return __pm_runtime_get(dev, false);
82}
83
84static inline int pm_runtime_get_sync(struct device *dev)
85{
86 return __pm_runtime_get(dev, true);
87}
88
89static inline int pm_runtime_put(struct device *dev)
90{
91 return __pm_runtime_put(dev, false);
92}
93
94static inline int pm_runtime_put_sync(struct device *dev)
95{
96 return __pm_runtime_put(dev, true);
97}
98
99static inline int pm_runtime_set_active(struct device *dev)
100{
101 return __pm_runtime_set_status(dev, RPM_ACTIVE);
102}
103
104static inline void pm_runtime_set_suspended(struct device *dev)
105{
106 __pm_runtime_set_status(dev, RPM_SUSPENDED);
107}
108
109static inline void pm_runtime_disable(struct device *dev)
110{
111 __pm_runtime_disable(dev, true);
112}
113
114#endif
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index b063c7328ba5..fddfafaed024 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -360,6 +360,7 @@ struct pnp_driver {
360 unsigned int flags; 360 unsigned int flags;
361 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id); 361 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id);
362 void (*remove) (struct pnp_dev *dev); 362 void (*remove) (struct pnp_dev *dev);
363 void (*shutdown) (struct pnp_dev *dev);
363 int (*suspend) (struct pnp_dev *dev, pm_message_t state); 364 int (*suspend) (struct pnp_dev *dev, pm_message_t state);
364 int (*resume) (struct pnp_dev *dev); 365 int (*resume) (struct pnp_dev *dev);
365 struct device_driver driver; 366 struct device_driver driver;
diff --git a/include/linux/poison.h b/include/linux/poison.h
index 6729f7dcd60e..7fc194aef8c2 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -65,6 +65,9 @@
65#define MUTEX_DEBUG_INIT 0x11 65#define MUTEX_DEBUG_INIT 0x11
66#define MUTEX_DEBUG_FREE 0x22 66#define MUTEX_DEBUG_FREE 0x22
67 67
68/********** lib/flex_array.c **********/
69#define FLEX_ARRAY_FREE 0x6c /* for use-after-free poisoning */
70
68/********** security/ **********/ 71/********** security/ **********/
69#define KEY_DESTROY 0xbd 72#define KEY_DESTROY 0xbd
70 73
diff --git a/include/linux/poll.h b/include/linux/poll.h
index fa287f25138d..6673743946f7 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -6,10 +6,10 @@
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7 7
8#include <linux/compiler.h> 8#include <linux/compiler.h>
9#include <linux/ktime.h>
9#include <linux/wait.h> 10#include <linux/wait.h>
10#include <linux/string.h> 11#include <linux/string.h>
11#include <linux/fs.h> 12#include <linux/fs.h>
12#include <linux/sched.h>
13#include <asm/uaccess.h> 13#include <asm/uaccess.h>
14 14
15/* ~832 bytes of stack space used max in sys_select/sys_poll before allocating 15/* ~832 bytes of stack space used max in sys_select/sys_poll before allocating
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 594c494ac3f0..b5d096d3a9be 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -39,6 +39,13 @@ enum {
39}; 39};
40 40
41enum { 41enum {
42 POWER_SUPPLY_CHARGE_TYPE_UNKNOWN = 0,
43 POWER_SUPPLY_CHARGE_TYPE_NONE,
44 POWER_SUPPLY_CHARGE_TYPE_TRICKLE,
45 POWER_SUPPLY_CHARGE_TYPE_FAST,
46};
47
48enum {
42 POWER_SUPPLY_HEALTH_UNKNOWN = 0, 49 POWER_SUPPLY_HEALTH_UNKNOWN = 0,
43 POWER_SUPPLY_HEALTH_GOOD, 50 POWER_SUPPLY_HEALTH_GOOD,
44 POWER_SUPPLY_HEALTH_OVERHEAT, 51 POWER_SUPPLY_HEALTH_OVERHEAT,
@@ -58,9 +65,19 @@ enum {
58 POWER_SUPPLY_TECHNOLOGY_LiMn, 65 POWER_SUPPLY_TECHNOLOGY_LiMn,
59}; 66};
60 67
68enum {
69 POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN = 0,
70 POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL,
71 POWER_SUPPLY_CAPACITY_LEVEL_LOW,
72 POWER_SUPPLY_CAPACITY_LEVEL_NORMAL,
73 POWER_SUPPLY_CAPACITY_LEVEL_HIGH,
74 POWER_SUPPLY_CAPACITY_LEVEL_FULL,
75};
76
61enum power_supply_property { 77enum power_supply_property {
62 /* Properties of type `int' */ 78 /* Properties of type `int' */
63 POWER_SUPPLY_PROP_STATUS = 0, 79 POWER_SUPPLY_PROP_STATUS = 0,
80 POWER_SUPPLY_PROP_CHARGE_TYPE,
64 POWER_SUPPLY_PROP_HEALTH, 81 POWER_SUPPLY_PROP_HEALTH,
65 POWER_SUPPLY_PROP_PRESENT, 82 POWER_SUPPLY_PROP_PRESENT,
66 POWER_SUPPLY_PROP_ONLINE, 83 POWER_SUPPLY_PROP_ONLINE,
@@ -89,6 +106,7 @@ enum power_supply_property {
89 POWER_SUPPLY_PROP_ENERGY_NOW, 106 POWER_SUPPLY_PROP_ENERGY_NOW,
90 POWER_SUPPLY_PROP_ENERGY_AVG, 107 POWER_SUPPLY_PROP_ENERGY_AVG,
91 POWER_SUPPLY_PROP_CAPACITY, /* in percents! */ 108 POWER_SUPPLY_PROP_CAPACITY, /* in percents! */
109 POWER_SUPPLY_PROP_CAPACITY_LEVEL,
92 POWER_SUPPLY_PROP_TEMP, 110 POWER_SUPPLY_PROP_TEMP,
93 POWER_SUPPLY_PROP_TEMP_AMBIENT, 111 POWER_SUPPLY_PROP_TEMP_AMBIENT,
94 POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW, 112 POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
@@ -126,6 +144,7 @@ struct power_supply {
126 enum power_supply_property psp, 144 enum power_supply_property psp,
127 union power_supply_propval *val); 145 union power_supply_propval *val);
128 void (*external_power_changed)(struct power_supply *psy); 146 void (*external_power_changed)(struct power_supply *psy);
147 void (*set_charged)(struct power_supply *psy);
129 148
130 /* For APM emulation, think legacy userspace. */ 149 /* For APM emulation, think legacy userspace. */
131 int use_for_apm; 150 int use_for_apm;
@@ -165,8 +184,10 @@ struct power_supply_info {
165 int use_for_apm; 184 int use_for_apm;
166}; 185};
167 186
187extern struct power_supply *power_supply_get_by_name(char *name);
168extern void power_supply_changed(struct power_supply *psy); 188extern void power_supply_changed(struct power_supply *psy);
169extern int power_supply_am_i_supplied(struct power_supply *psy); 189extern int power_supply_am_i_supplied(struct power_supply *psy);
190extern int power_supply_set_battery_charged(struct power_supply *psy);
170 191
171#if defined(CONFIG_POWER_SUPPLY) || defined(CONFIG_POWER_SUPPLY_MODULE) 192#if defined(CONFIG_POWER_SUPPLY) || defined(CONFIG_POWER_SUPPLY_MODULE)
172extern int power_supply_is_system_supplied(void); 193extern int power_supply_is_system_supplied(void);
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index b00df4c79c63..a3baeb2c2161 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -85,7 +85,21 @@
85#define PR_SET_TIMERSLACK 29 85#define PR_SET_TIMERSLACK 29
86#define PR_GET_TIMERSLACK 30 86#define PR_GET_TIMERSLACK 30
87 87
88#define PR_TASK_PERF_COUNTERS_DISABLE 31 88#define PR_TASK_PERF_EVENTS_DISABLE 31
89#define PR_TASK_PERF_COUNTERS_ENABLE 32 89#define PR_TASK_PERF_EVENTS_ENABLE 32
90
91/*
92 * Set early/late kill mode for hwpoison memory corruption.
93 * This influences when the process gets killed on a memory corruption.
94 */
95#define PR_MCE_KILL 33
96# define PR_MCE_KILL_CLEAR 0
97# define PR_MCE_KILL_SET 1
98
99# define PR_MCE_KILL_LATE 0
100# define PR_MCE_KILL_EARLY 1
101# define PR_MCE_KILL_DEFAULT 2
102
103#define PR_MCE_KILL_GET 34
90 104
91#endif /* _LINUX_PRCTL_H */ 105#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index e6e77d31c418..379eaed72d4b 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -78,10 +78,19 @@ struct proc_dir_entry {
78 struct list_head pde_openers; /* who did ->open, but not ->release */ 78 struct list_head pde_openers; /* who did ->open, but not ->release */
79}; 79};
80 80
81enum kcore_type {
82 KCORE_TEXT,
83 KCORE_VMALLOC,
84 KCORE_RAM,
85 KCORE_VMEMMAP,
86 KCORE_OTHER,
87};
88
81struct kcore_list { 89struct kcore_list {
82 struct kcore_list *next; 90 struct list_head list;
83 unsigned long addr; 91 unsigned long addr;
84 size_t size; 92 size_t size;
93 int type;
85}; 94};
86 95
87struct vmcore { 96struct vmcore {
@@ -233,11 +242,12 @@ static inline void dup_mm_exe_file(struct mm_struct *oldmm,
233#endif /* CONFIG_PROC_FS */ 242#endif /* CONFIG_PROC_FS */
234 243
235#if !defined(CONFIG_PROC_KCORE) 244#if !defined(CONFIG_PROC_KCORE)
236static inline void kclist_add(struct kcore_list *new, void *addr, size_t size) 245static inline void
246kclist_add(struct kcore_list *new, void *addr, size_t size, int type)
237{ 247{
238} 248}
239#else 249#else
240extern void kclist_add(struct kcore_list *, void *, size_t); 250extern void kclist_add(struct kcore_list *, void *, size_t, int type);
241#endif 251#endif
242 252
243union proc_op { 253union proc_op {
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 26361c4c037a..3ebb23153640 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -135,8 +135,8 @@ static inline int sb_any_quota_active(struct super_block *sb)
135/* 135/*
136 * Operations supported for diskquotas. 136 * Operations supported for diskquotas.
137 */ 137 */
138extern struct dquot_operations dquot_operations; 138extern const struct dquot_operations dquot_operations;
139extern struct quotactl_ops vfs_quotactl_ops; 139extern const struct quotactl_ops vfs_quotactl_ops;
140 140
141#define sb_dquot_ops (&dquot_operations) 141#define sb_dquot_ops (&dquot_operations)
142#define sb_quotactl_ops (&vfs_quotactl_ops) 142#define sb_quotactl_ops (&vfs_quotactl_ops)
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 37aaf2b39863..4e768dda87b0 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -17,7 +17,7 @@ extern int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma);
17#endif 17#endif
18 18
19extern const struct file_operations ramfs_file_operations; 19extern const struct file_operations ramfs_file_operations;
20extern struct vm_operations_struct generic_file_vm_ops; 20extern const struct vm_operations_struct generic_file_vm_ops;
21extern int __init init_rootfs(void); 21extern int __init init_rootfs(void);
22 22
23#endif 23#endif
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h
deleted file mode 100644
index bfd92e1e5d2c..000000000000
--- a/include/linux/rcuclassic.h
+++ /dev/null
@@ -1,178 +0,0 @@
1/*
2 * Read-Copy Update mechanism for mutual exclusion (classic version)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright IBM Corporation, 2001
19 *
20 * Author: Dipankar Sarma <dipankar@in.ibm.com>
21 *
22 * Based on the original work by Paul McKenney <paulmck@us.ibm.com>
23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
24 * Papers:
25 * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf
26 * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001)
27 *
28 * For detailed explanation of Read-Copy Update mechanism see -
29 * Documentation/RCU
30 *
31 */
32
33#ifndef __LINUX_RCUCLASSIC_H
34#define __LINUX_RCUCLASSIC_H
35
36#include <linux/cache.h>
37#include <linux/spinlock.h>
38#include <linux/threads.h>
39#include <linux/cpumask.h>
40#include <linux/seqlock.h>
41
42#ifdef CONFIG_RCU_CPU_STALL_DETECTOR
43#define RCU_SECONDS_TILL_STALL_CHECK (10 * HZ) /* for rcp->jiffies_stall */
44#define RCU_SECONDS_TILL_STALL_RECHECK (30 * HZ) /* for rcp->jiffies_stall */
45#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
46
47/* Global control variables for rcupdate callback mechanism. */
48struct rcu_ctrlblk {
49 long cur; /* Current batch number. */
50 long completed; /* Number of the last completed batch */
51 long pending; /* Number of the last pending batch */
52#ifdef CONFIG_RCU_CPU_STALL_DETECTOR
53 unsigned long gp_start; /* Time at which GP started in jiffies. */
54 unsigned long jiffies_stall;
55 /* Time at which to check for CPU stalls. */
56#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
57
58 int signaled;
59
60 spinlock_t lock ____cacheline_internodealigned_in_smp;
61 DECLARE_BITMAP(cpumask, NR_CPUS); /* CPUs that need to switch for */
62 /* current batch to proceed. */
63} ____cacheline_internodealigned_in_smp;
64
65/* Is batch a before batch b ? */
66static inline int rcu_batch_before(long a, long b)
67{
68 return (a - b) < 0;
69}
70
71/* Is batch a after batch b ? */
72static inline int rcu_batch_after(long a, long b)
73{
74 return (a - b) > 0;
75}
76
77/* Per-CPU data for Read-Copy UPdate. */
78struct rcu_data {
79 /* 1) quiescent state handling : */
80 long quiescbatch; /* Batch # for grace period */
81 int passed_quiesc; /* User-mode/idle loop etc. */
82 int qs_pending; /* core waits for quiesc state */
83
84 /* 2) batch handling */
85 /*
86 * if nxtlist is not NULL, then:
87 * batch:
88 * The batch # for the last entry of nxtlist
89 * [*nxttail[1], NULL = *nxttail[2]):
90 * Entries that batch # <= batch
91 * [*nxttail[0], *nxttail[1]):
92 * Entries that batch # <= batch - 1
93 * [nxtlist, *nxttail[0]):
94 * Entries that batch # <= batch - 2
95 * The grace period for these entries has completed, and
96 * the other grace-period-completed entries may be moved
97 * here temporarily in rcu_process_callbacks().
98 */
99 long batch;
100 struct rcu_head *nxtlist;
101 struct rcu_head **nxttail[3];
102 long qlen; /* # of queued callbacks */
103 struct rcu_head *donelist;
104 struct rcu_head **donetail;
105 long blimit; /* Upper limit on a processed batch */
106 int cpu;
107 struct rcu_head barrier;
108};
109
110/*
111 * Increment the quiescent state counter.
112 * The counter is a bit degenerated: We do not need to know
113 * how many quiescent states passed, just if there was at least
114 * one since the start of the grace period. Thus just a flag.
115 */
116extern void rcu_qsctr_inc(int cpu);
117extern void rcu_bh_qsctr_inc(int cpu);
118
119extern int rcu_pending(int cpu);
120extern int rcu_needs_cpu(int cpu);
121
122#ifdef CONFIG_DEBUG_LOCK_ALLOC
123extern struct lockdep_map rcu_lock_map;
124# define rcu_read_acquire() \
125 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
126# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_)
127#else
128# define rcu_read_acquire() do { } while (0)
129# define rcu_read_release() do { } while (0)
130#endif
131
132#define __rcu_read_lock() \
133 do { \
134 preempt_disable(); \
135 __acquire(RCU); \
136 rcu_read_acquire(); \
137 } while (0)
138#define __rcu_read_unlock() \
139 do { \
140 rcu_read_release(); \
141 __release(RCU); \
142 preempt_enable(); \
143 } while (0)
144#define __rcu_read_lock_bh() \
145 do { \
146 local_bh_disable(); \
147 __acquire(RCU_BH); \
148 rcu_read_acquire(); \
149 } while (0)
150#define __rcu_read_unlock_bh() \
151 do { \
152 rcu_read_release(); \
153 __release(RCU_BH); \
154 local_bh_enable(); \
155 } while (0)
156
157#define __synchronize_sched() synchronize_rcu()
158
159#define call_rcu_sched(head, func) call_rcu(head, func)
160
161extern void __rcu_init(void);
162#define rcu_init_sched() do { } while (0)
163extern void rcu_check_callbacks(int cpu, int user);
164extern void rcu_restart_cpu(int cpu);
165
166extern long rcu_batches_completed(void);
167extern long rcu_batches_completed_bh(void);
168
169#define rcu_enter_nohz() do { } while (0)
170#define rcu_exit_nohz() do { } while (0)
171
172/* A context switch is a grace period for rcuclassic. */
173static inline int rcu_blocking_is_gp(void)
174{
175 return num_online_cpus() == 1;
176}
177
178#endif /* __LINUX_RCUCLASSIC_H */
diff --git a/include/linux/rculist_nulls.h b/include/linux/rculist_nulls.h
index f9ddd03961a8..589a40919f01 100644
--- a/include/linux/rculist_nulls.h
+++ b/include/linux/rculist_nulls.h
@@ -102,7 +102,7 @@ static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n,
102 */ 102 */
103#define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \ 103#define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \
104 for (pos = rcu_dereference((head)->first); \ 104 for (pos = rcu_dereference((head)->first); \
105 (!is_a_nulls(pos)) && \ 105 (!is_a_nulls(pos)) && \
106 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \ 106 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \
107 pos = rcu_dereference(pos->next)) 107 pos = rcu_dereference(pos->next))
108 108
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 15fbb3ca634d..3ebd0b7bcb08 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Read-Copy Update mechanism for mutual exclusion 2 * Read-Copy Update mechanism for mutual exclusion
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
18 * Copyright IBM Corporation, 2001 18 * Copyright IBM Corporation, 2001
19 * 19 *
20 * Author: Dipankar Sarma <dipankar@in.ibm.com> 20 * Author: Dipankar Sarma <dipankar@in.ibm.com>
21 * 21 *
22 * Based on the original work by Paul McKenney <paulmck@us.ibm.com> 22 * Based on the original work by Paul McKenney <paulmck@us.ibm.com>
23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen. 23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
24 * Papers: 24 * Papers:
@@ -26,7 +26,7 @@
26 * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001) 26 * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001)
27 * 27 *
28 * For detailed explanation of Read-Copy Update mechanism see - 28 * For detailed explanation of Read-Copy Update mechanism see -
29 * http://lse.sourceforge.net/locking/rcupdate.html 29 * http://lse.sourceforge.net/locking/rcupdate.html
30 * 30 *
31 */ 31 */
32 32
@@ -51,25 +51,48 @@ struct rcu_head {
51 void (*func)(struct rcu_head *head); 51 void (*func)(struct rcu_head *head);
52}; 52};
53 53
54/* Internal to kernel, but needed by rcupreempt.h. */ 54/* Exported common interfaces */
55#ifdef CONFIG_TREE_PREEMPT_RCU
56extern void synchronize_rcu(void);
57#else /* #ifdef CONFIG_TREE_PREEMPT_RCU */
58#define synchronize_rcu synchronize_sched
59#endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */
60extern void synchronize_rcu_bh(void);
61extern void synchronize_sched(void);
62extern void rcu_barrier(void);
63extern void rcu_barrier_bh(void);
64extern void rcu_barrier_sched(void);
65extern void synchronize_sched_expedited(void);
66extern int sched_expedited_torture_stats(char *page);
67
68/* Internal to kernel */
69extern void rcu_init(void);
70extern void rcu_scheduler_starting(void);
71extern int rcu_needs_cpu(int cpu);
55extern int rcu_scheduler_active; 72extern int rcu_scheduler_active;
56 73
57#if defined(CONFIG_CLASSIC_RCU) 74#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
58#include <linux/rcuclassic.h>
59#elif defined(CONFIG_TREE_RCU)
60#include <linux/rcutree.h> 75#include <linux/rcutree.h>
61#elif defined(CONFIG_PREEMPT_RCU)
62#include <linux/rcupreempt.h>
63#else 76#else
64#error "Unknown RCU implementation specified to kernel configuration" 77#error "Unknown RCU implementation specified to kernel configuration"
65#endif /* #else #if defined(CONFIG_CLASSIC_RCU) */ 78#endif
66 79
67#define RCU_HEAD_INIT { .next = NULL, .func = NULL } 80#define RCU_HEAD_INIT { .next = NULL, .func = NULL }
68#define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT 81#define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT
69#define INIT_RCU_HEAD(ptr) do { \ 82#define INIT_RCU_HEAD(ptr) do { \
70 (ptr)->next = NULL; (ptr)->func = NULL; \ 83 (ptr)->next = NULL; (ptr)->func = NULL; \
71} while (0) 84} while (0)
72 85
86#ifdef CONFIG_DEBUG_LOCK_ALLOC
87extern struct lockdep_map rcu_lock_map;
88# define rcu_read_acquire() \
89 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
90# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_)
91#else
92# define rcu_read_acquire() do { } while (0)
93# define rcu_read_release() do { } while (0)
94#endif
95
73/** 96/**
74 * rcu_read_lock - mark the beginning of an RCU read-side critical section. 97 * rcu_read_lock - mark the beginning of an RCU read-side critical section.
75 * 98 *
@@ -99,13 +122,12 @@ extern int rcu_scheduler_active;
99 * 122 *
100 * It is illegal to block while in an RCU read-side critical section. 123 * It is illegal to block while in an RCU read-side critical section.
101 */ 124 */
102#define rcu_read_lock() __rcu_read_lock() 125static inline void rcu_read_lock(void)
103 126{
104/** 127 __rcu_read_lock();
105 * rcu_read_unlock - marks the end of an RCU read-side critical section. 128 __acquire(RCU);
106 * 129 rcu_read_acquire();
107 * See rcu_read_lock() for more information. 130}
108 */
109 131
110/* 132/*
111 * So where is rcu_write_lock()? It does not exist, as there is no 133 * So where is rcu_write_lock()? It does not exist, as there is no
@@ -116,7 +138,18 @@ extern int rcu_scheduler_active;
116 * used as well. RCU does not care how the writers keep out of each 138 * used as well. RCU does not care how the writers keep out of each
117 * others' way, as long as they do so. 139 * others' way, as long as they do so.
118 */ 140 */
119#define rcu_read_unlock() __rcu_read_unlock() 141
142/**
143 * rcu_read_unlock - marks the end of an RCU read-side critical section.
144 *
145 * See rcu_read_lock() for more information.
146 */
147static inline void rcu_read_unlock(void)
148{
149 rcu_read_release();
150 __release(RCU);
151 __rcu_read_unlock();
152}
120 153
121/** 154/**
122 * rcu_read_lock_bh - mark the beginning of a softirq-only RCU critical section 155 * rcu_read_lock_bh - mark the beginning of a softirq-only RCU critical section
@@ -129,14 +162,24 @@ extern int rcu_scheduler_active;
129 * can use just rcu_read_lock(). 162 * can use just rcu_read_lock().
130 * 163 *
131 */ 164 */
132#define rcu_read_lock_bh() __rcu_read_lock_bh() 165static inline void rcu_read_lock_bh(void)
166{
167 __rcu_read_lock_bh();
168 __acquire(RCU_BH);
169 rcu_read_acquire();
170}
133 171
134/* 172/*
135 * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section 173 * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section
136 * 174 *
137 * See rcu_read_lock_bh() for more information. 175 * See rcu_read_lock_bh() for more information.
138 */ 176 */
139#define rcu_read_unlock_bh() __rcu_read_unlock_bh() 177static inline void rcu_read_unlock_bh(void)
178{
179 rcu_read_release();
180 __release(RCU_BH);
181 __rcu_read_unlock_bh();
182}
140 183
141/** 184/**
142 * rcu_read_lock_sched - mark the beginning of a RCU-classic critical section 185 * rcu_read_lock_sched - mark the beginning of a RCU-classic critical section
@@ -147,17 +190,38 @@ extern int rcu_scheduler_active;
147 * - call_rcu_sched() and rcu_barrier_sched() 190 * - call_rcu_sched() and rcu_barrier_sched()
148 * on the write-side to insure proper synchronization. 191 * on the write-side to insure proper synchronization.
149 */ 192 */
150#define rcu_read_lock_sched() preempt_disable() 193static inline void rcu_read_lock_sched(void)
151#define rcu_read_lock_sched_notrace() preempt_disable_notrace() 194{
195 preempt_disable();
196 __acquire(RCU_SCHED);
197 rcu_read_acquire();
198}
199
200/* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */
201static inline notrace void rcu_read_lock_sched_notrace(void)
202{
203 preempt_disable_notrace();
204 __acquire(RCU_SCHED);
205}
152 206
153/* 207/*
154 * rcu_read_unlock_sched - marks the end of a RCU-classic critical section 208 * rcu_read_unlock_sched - marks the end of a RCU-classic critical section
155 * 209 *
156 * See rcu_read_lock_sched for more information. 210 * See rcu_read_lock_sched for more information.
157 */ 211 */
158#define rcu_read_unlock_sched() preempt_enable() 212static inline void rcu_read_unlock_sched(void)
159#define rcu_read_unlock_sched_notrace() preempt_enable_notrace() 213{
214 rcu_read_release();
215 __release(RCU_SCHED);
216 preempt_enable();
217}
160 218
219/* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */
220static inline notrace void rcu_read_unlock_sched_notrace(void)
221{
222 __release(RCU_SCHED);
223 preempt_enable_notrace();
224}
161 225
162 226
163/** 227/**
@@ -207,24 +271,6 @@ struct rcu_synchronize {
207extern void wakeme_after_rcu(struct rcu_head *head); 271extern void wakeme_after_rcu(struct rcu_head *head);
208 272
209/** 273/**
210 * synchronize_sched - block until all CPUs have exited any non-preemptive
211 * kernel code sequences.
212 *
213 * This means that all preempt_disable code sequences, including NMI and
214 * hardware-interrupt handlers, in progress on entry will have completed
215 * before this primitive returns. However, this does not guarantee that
216 * softirq handlers will have completed, since in some kernels, these
217 * handlers can run in process context, and can block.
218 *
219 * This primitive provides the guarantees made by the (now removed)
220 * synchronize_kernel() API. In contrast, synchronize_rcu() only
221 * guarantees that rcu_read_lock() sections will have completed.
222 * In "classic RCU", these two guarantees happen to be one and
223 * the same, but can differ in realtime RCU implementations.
224 */
225#define synchronize_sched() __synchronize_sched()
226
227/**
228 * call_rcu - Queue an RCU callback for invocation after a grace period. 274 * call_rcu - Queue an RCU callback for invocation after a grace period.
229 * @head: structure to be used for queueing the RCU updates. 275 * @head: structure to be used for queueing the RCU updates.
230 * @func: actual update function to be invoked after the grace period 276 * @func: actual update function to be invoked after the grace period
@@ -259,15 +305,4 @@ extern void call_rcu(struct rcu_head *head,
259extern void call_rcu_bh(struct rcu_head *head, 305extern void call_rcu_bh(struct rcu_head *head,
260 void (*func)(struct rcu_head *head)); 306 void (*func)(struct rcu_head *head));
261 307
262/* Exported common interfaces */
263extern void synchronize_rcu(void);
264extern void rcu_barrier(void);
265extern void rcu_barrier_bh(void);
266extern void rcu_barrier_sched(void);
267
268/* Internal to kernel */
269extern void rcu_init(void);
270extern void rcu_scheduler_starting(void);
271extern int rcu_needs_cpu(int cpu);
272
273#endif /* __LINUX_RCUPDATE_H */ 308#endif /* __LINUX_RCUPDATE_H */
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h
deleted file mode 100644
index fce522782ffa..000000000000
--- a/include/linux/rcupreempt.h
+++ /dev/null
@@ -1,127 +0,0 @@
1/*
2 * Read-Copy Update mechanism for mutual exclusion (RT implementation)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright (C) IBM Corporation, 2006
19 *
20 * Author: Paul McKenney <paulmck@us.ibm.com>
21 *
22 * Based on the original work by Paul McKenney <paul.mckenney@us.ibm.com>
23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
24 * Papers:
25 * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf
26 * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001)
27 *
28 * For detailed explanation of Read-Copy Update mechanism see -
29 * Documentation/RCU
30 *
31 */
32
33#ifndef __LINUX_RCUPREEMPT_H
34#define __LINUX_RCUPREEMPT_H
35
36#include <linux/cache.h>
37#include <linux/spinlock.h>
38#include <linux/threads.h>
39#include <linux/smp.h>
40#include <linux/cpumask.h>
41#include <linux/seqlock.h>
42
43extern void rcu_qsctr_inc(int cpu);
44static inline void rcu_bh_qsctr_inc(int cpu) { }
45
46/*
47 * Someone might want to pass call_rcu_bh as a function pointer.
48 * So this needs to just be a rename and not a macro function.
49 * (no parentheses)
50 */
51#define call_rcu_bh call_rcu
52
53/**
54 * call_rcu_sched - Queue RCU callback for invocation after sched grace period.
55 * @head: structure to be used for queueing the RCU updates.
56 * @func: actual update function to be invoked after the grace period
57 *
58 * The update function will be invoked some time after a full
59 * synchronize_sched()-style grace period elapses, in other words after
60 * all currently executing preempt-disabled sections of code (including
61 * hardirq handlers, NMI handlers, and local_irq_save() blocks) have
62 * completed.
63 */
64extern void call_rcu_sched(struct rcu_head *head,
65 void (*func)(struct rcu_head *head));
66
67extern void __rcu_read_lock(void) __acquires(RCU);
68extern void __rcu_read_unlock(void) __releases(RCU);
69extern int rcu_pending(int cpu);
70extern int rcu_needs_cpu(int cpu);
71
72#define __rcu_read_lock_bh() { rcu_read_lock(); local_bh_disable(); }
73#define __rcu_read_unlock_bh() { local_bh_enable(); rcu_read_unlock(); }
74
75extern void __synchronize_sched(void);
76
77extern void __rcu_init(void);
78extern void rcu_init_sched(void);
79extern void rcu_check_callbacks(int cpu, int user);
80extern void rcu_restart_cpu(int cpu);
81extern long rcu_batches_completed(void);
82
83/*
84 * Return the number of RCU batches processed thus far. Useful for debug
85 * and statistic. The _bh variant is identifcal to straight RCU
86 */
87static inline long rcu_batches_completed_bh(void)
88{
89 return rcu_batches_completed();
90}
91
92#ifdef CONFIG_RCU_TRACE
93struct rcupreempt_trace;
94extern long *rcupreempt_flipctr(int cpu);
95extern long rcupreempt_data_completed(void);
96extern int rcupreempt_flip_flag(int cpu);
97extern int rcupreempt_mb_flag(int cpu);
98extern char *rcupreempt_try_flip_state_name(void);
99extern struct rcupreempt_trace *rcupreempt_trace_cpu(int cpu);
100#endif
101
102struct softirq_action;
103
104#ifdef CONFIG_NO_HZ
105extern void rcu_enter_nohz(void);
106extern void rcu_exit_nohz(void);
107#else
108# define rcu_enter_nohz() do { } while (0)
109# define rcu_exit_nohz() do { } while (0)
110#endif
111
112/*
113 * A context switch is a grace period for rcupreempt synchronize_rcu()
114 * only during early boot, before the scheduler has been initialized.
115 * So, how the heck do we get a context switch? Well, if the caller
116 * invokes synchronize_rcu(), they are willing to accept a context
117 * switch, so we simply pretend that one happened.
118 *
119 * After boot, there might be a blocked or preempted task in an RCU
120 * read-side critical section, so we cannot then take the fastpath.
121 */
122static inline int rcu_blocking_is_gp(void)
123{
124 return num_online_cpus() == 1 && !rcu_scheduler_active;
125}
126
127#endif /* __LINUX_RCUPREEMPT_H */
diff --git a/include/linux/rcupreempt_trace.h b/include/linux/rcupreempt_trace.h
deleted file mode 100644
index b99ae073192a..000000000000
--- a/include/linux/rcupreempt_trace.h
+++ /dev/null
@@ -1,97 +0,0 @@
1/*
2 * Read-Copy Update mechanism for mutual exclusion (RT implementation)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright (C) IBM Corporation, 2006
19 *
20 * Author: Paul McKenney <paulmck@us.ibm.com>
21 *
22 * Based on the original work by Paul McKenney <paul.mckenney@us.ibm.com>
23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
24 * Papers:
25 * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf
26 * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001)
27 *
28 * For detailed explanation of the Preemptible Read-Copy Update mechanism see -
29 * http://lwn.net/Articles/253651/
30 */
31
32#ifndef __LINUX_RCUPREEMPT_TRACE_H
33#define __LINUX_RCUPREEMPT_TRACE_H
34
35#include <linux/types.h>
36#include <linux/kernel.h>
37
38#include <asm/atomic.h>
39
40/*
41 * PREEMPT_RCU data structures.
42 */
43
44struct rcupreempt_trace {
45 long next_length;
46 long next_add;
47 long wait_length;
48 long wait_add;
49 long done_length;
50 long done_add;
51 long done_remove;
52 atomic_t done_invoked;
53 long rcu_check_callbacks;
54 atomic_t rcu_try_flip_1;
55 atomic_t rcu_try_flip_e1;
56 long rcu_try_flip_i1;
57 long rcu_try_flip_ie1;
58 long rcu_try_flip_g1;
59 long rcu_try_flip_a1;
60 long rcu_try_flip_ae1;
61 long rcu_try_flip_a2;
62 long rcu_try_flip_z1;
63 long rcu_try_flip_ze1;
64 long rcu_try_flip_z2;
65 long rcu_try_flip_m1;
66 long rcu_try_flip_me1;
67 long rcu_try_flip_m2;
68};
69
70#ifdef CONFIG_RCU_TRACE
71#define RCU_TRACE(fn, arg) fn(arg);
72#else
73#define RCU_TRACE(fn, arg)
74#endif
75
76extern void rcupreempt_trace_move2done(struct rcupreempt_trace *trace);
77extern void rcupreempt_trace_move2wait(struct rcupreempt_trace *trace);
78extern void rcupreempt_trace_try_flip_1(struct rcupreempt_trace *trace);
79extern void rcupreempt_trace_try_flip_e1(struct rcupreempt_trace *trace);
80extern void rcupreempt_trace_try_flip_i1(struct rcupreempt_trace *trace);
81extern void rcupreempt_trace_try_flip_ie1(struct rcupreempt_trace *trace);
82extern void rcupreempt_trace_try_flip_g1(struct rcupreempt_trace *trace);
83extern void rcupreempt_trace_try_flip_a1(struct rcupreempt_trace *trace);
84extern void rcupreempt_trace_try_flip_ae1(struct rcupreempt_trace *trace);
85extern void rcupreempt_trace_try_flip_a2(struct rcupreempt_trace *trace);
86extern void rcupreempt_trace_try_flip_z1(struct rcupreempt_trace *trace);
87extern void rcupreempt_trace_try_flip_ze1(struct rcupreempt_trace *trace);
88extern void rcupreempt_trace_try_flip_z2(struct rcupreempt_trace *trace);
89extern void rcupreempt_trace_try_flip_m1(struct rcupreempt_trace *trace);
90extern void rcupreempt_trace_try_flip_me1(struct rcupreempt_trace *trace);
91extern void rcupreempt_trace_try_flip_m2(struct rcupreempt_trace *trace);
92extern void rcupreempt_trace_check_callbacks(struct rcupreempt_trace *trace);
93extern void rcupreempt_trace_done_remove(struct rcupreempt_trace *trace);
94extern void rcupreempt_trace_invoke(struct rcupreempt_trace *trace);
95extern void rcupreempt_trace_next_add(struct rcupreempt_trace *trace);
96
97#endif /* __LINUX_RCUPREEMPT_TRACE_H */
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 5a5153806c42..9642c6bcb399 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -24,278 +24,71 @@
24 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen. 24 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
25 * 25 *
26 * For detailed explanation of Read-Copy Update mechanism see - 26 * For detailed explanation of Read-Copy Update mechanism see -
27 * Documentation/RCU 27 * Documentation/RCU
28 */ 28 */
29 29
30#ifndef __LINUX_RCUTREE_H 30#ifndef __LINUX_RCUTREE_H
31#define __LINUX_RCUTREE_H 31#define __LINUX_RCUTREE_H
32 32
33#include <linux/cache.h> 33struct notifier_block;
34#include <linux/spinlock.h>
35#include <linux/threads.h>
36#include <linux/cpumask.h>
37#include <linux/seqlock.h>
38 34
39/* 35extern void rcu_sched_qs(int cpu);
40 * Define shape of hierarchy based on NR_CPUS and CONFIG_RCU_FANOUT. 36extern void rcu_bh_qs(int cpu);
41 * In theory, it should be possible to add more levels straightforwardly. 37extern int rcu_cpu_notify(struct notifier_block *self,
42 * In practice, this has not been tested, so there is probably some 38 unsigned long action, void *hcpu);
43 * bug somewhere. 39extern int rcu_needs_cpu(int cpu);
44 */ 40extern int rcu_expedited_torture_stats(char *page);
45#define MAX_RCU_LVLS 3
46#define RCU_FANOUT (CONFIG_RCU_FANOUT)
47#define RCU_FANOUT_SQ (RCU_FANOUT * RCU_FANOUT)
48#define RCU_FANOUT_CUBE (RCU_FANOUT_SQ * RCU_FANOUT)
49
50#if NR_CPUS <= RCU_FANOUT
51# define NUM_RCU_LVLS 1
52# define NUM_RCU_LVL_0 1
53# define NUM_RCU_LVL_1 (NR_CPUS)
54# define NUM_RCU_LVL_2 0
55# define NUM_RCU_LVL_3 0
56#elif NR_CPUS <= RCU_FANOUT_SQ
57# define NUM_RCU_LVLS 2
58# define NUM_RCU_LVL_0 1
59# define NUM_RCU_LVL_1 (((NR_CPUS) + RCU_FANOUT - 1) / RCU_FANOUT)
60# define NUM_RCU_LVL_2 (NR_CPUS)
61# define NUM_RCU_LVL_3 0
62#elif NR_CPUS <= RCU_FANOUT_CUBE
63# define NUM_RCU_LVLS 3
64# define NUM_RCU_LVL_0 1
65# define NUM_RCU_LVL_1 (((NR_CPUS) + RCU_FANOUT_SQ - 1) / RCU_FANOUT_SQ)
66# define NUM_RCU_LVL_2 (((NR_CPUS) + (RCU_FANOUT) - 1) / (RCU_FANOUT))
67# define NUM_RCU_LVL_3 NR_CPUS
68#else
69# error "CONFIG_RCU_FANOUT insufficient for NR_CPUS"
70#endif /* #if (NR_CPUS) <= RCU_FANOUT */
71
72#define RCU_SUM (NUM_RCU_LVL_0 + NUM_RCU_LVL_1 + NUM_RCU_LVL_2 + NUM_RCU_LVL_3)
73#define NUM_RCU_NODES (RCU_SUM - NR_CPUS)
74
75/*
76 * Dynticks per-CPU state.
77 */
78struct rcu_dynticks {
79 int dynticks_nesting; /* Track nesting level, sort of. */
80 int dynticks; /* Even value for dynticks-idle, else odd. */
81 int dynticks_nmi; /* Even value for either dynticks-idle or */
82 /* not in nmi handler, else odd. So this */
83 /* remains even for nmi from irq handler. */
84};
85
86/*
87 * Definition for node within the RCU grace-period-detection hierarchy.
88 */
89struct rcu_node {
90 spinlock_t lock;
91 unsigned long qsmask; /* CPUs or groups that need to switch in */
92 /* order for current grace period to proceed.*/
93 unsigned long qsmaskinit;
94 /* Per-GP initialization for qsmask. */
95 unsigned long grpmask; /* Mask to apply to parent qsmask. */
96 int grplo; /* lowest-numbered CPU or group here. */
97 int grphi; /* highest-numbered CPU or group here. */
98 u8 grpnum; /* CPU/group number for next level up. */
99 u8 level; /* root is at level 0. */
100 struct rcu_node *parent;
101} ____cacheline_internodealigned_in_smp;
102
103/* Index values for nxttail array in struct rcu_data. */
104#define RCU_DONE_TAIL 0 /* Also RCU_WAIT head. */
105#define RCU_WAIT_TAIL 1 /* Also RCU_NEXT_READY head. */
106#define RCU_NEXT_READY_TAIL 2 /* Also RCU_NEXT head. */
107#define RCU_NEXT_TAIL 3
108#define RCU_NEXT_SIZE 4
109
110/* Per-CPU data for read-copy update. */
111struct rcu_data {
112 /* 1) quiescent-state and grace-period handling : */
113 long completed; /* Track rsp->completed gp number */
114 /* in order to detect GP end. */
115 long gpnum; /* Highest gp number that this CPU */
116 /* is aware of having started. */
117 long passed_quiesc_completed;
118 /* Value of completed at time of qs. */
119 bool passed_quiesc; /* User-mode/idle loop etc. */
120 bool qs_pending; /* Core waits for quiesc state. */
121 bool beenonline; /* CPU online at least once. */
122 struct rcu_node *mynode; /* This CPU's leaf of hierarchy */
123 unsigned long grpmask; /* Mask to apply to leaf qsmask. */
124
125 /* 2) batch handling */
126 /*
127 * If nxtlist is not NULL, it is partitioned as follows.
128 * Any of the partitions might be empty, in which case the
129 * pointer to that partition will be equal to the pointer for
130 * the following partition. When the list is empty, all of
131 * the nxttail elements point to nxtlist, which is NULL.
132 *
133 * [*nxttail[RCU_NEXT_READY_TAIL], NULL = *nxttail[RCU_NEXT_TAIL]):
134 * Entries that might have arrived after current GP ended
135 * [*nxttail[RCU_WAIT_TAIL], *nxttail[RCU_NEXT_READY_TAIL]):
136 * Entries known to have arrived before current GP ended
137 * [*nxttail[RCU_DONE_TAIL], *nxttail[RCU_WAIT_TAIL]):
138 * Entries that batch # <= ->completed - 1: waiting for current GP
139 * [nxtlist, *nxttail[RCU_DONE_TAIL]):
140 * Entries that batch # <= ->completed
141 * The grace period for these entries has completed, and
142 * the other grace-period-completed entries may be moved
143 * here temporarily in rcu_process_callbacks().
144 */
145 struct rcu_head *nxtlist;
146 struct rcu_head **nxttail[RCU_NEXT_SIZE];
147 long qlen; /* # of queued callbacks */
148 long blimit; /* Upper limit on a processed batch */
149
150#ifdef CONFIG_NO_HZ
151 /* 3) dynticks interface. */
152 struct rcu_dynticks *dynticks; /* Shared per-CPU dynticks state. */
153 int dynticks_snap; /* Per-GP tracking for dynticks. */
154 int dynticks_nmi_snap; /* Per-GP tracking for dynticks_nmi. */
155#endif /* #ifdef CONFIG_NO_HZ */
156
157 /* 4) reasons this CPU needed to be kicked by force_quiescent_state */
158#ifdef CONFIG_NO_HZ
159 unsigned long dynticks_fqs; /* Kicked due to dynticks idle. */
160#endif /* #ifdef CONFIG_NO_HZ */
161 unsigned long offline_fqs; /* Kicked due to being offline. */
162 unsigned long resched_ipi; /* Sent a resched IPI. */
163
164 /* 5) __rcu_pending() statistics. */
165 long n_rcu_pending; /* rcu_pending() calls since boot. */
166 long n_rp_qs_pending;
167 long n_rp_cb_ready;
168 long n_rp_cpu_needs_gp;
169 long n_rp_gp_completed;
170 long n_rp_gp_started;
171 long n_rp_need_fqs;
172 long n_rp_need_nothing;
173
174 int cpu;
175};
176
177/* Values for signaled field in struct rcu_state. */
178#define RCU_GP_INIT 0 /* Grace period being initialized. */
179#define RCU_SAVE_DYNTICK 1 /* Need to scan dyntick state. */
180#define RCU_FORCE_QS 2 /* Need to force quiescent state. */
181#ifdef CONFIG_NO_HZ
182#define RCU_SIGNAL_INIT RCU_SAVE_DYNTICK
183#else /* #ifdef CONFIG_NO_HZ */
184#define RCU_SIGNAL_INIT RCU_FORCE_QS
185#endif /* #else #ifdef CONFIG_NO_HZ */
186
187#define RCU_JIFFIES_TILL_FORCE_QS 3 /* for rsp->jiffies_force_qs */
188#ifdef CONFIG_RCU_CPU_STALL_DETECTOR
189#define RCU_SECONDS_TILL_STALL_CHECK (10 * HZ) /* for rsp->jiffies_stall */
190#define RCU_SECONDS_TILL_STALL_RECHECK (30 * HZ) /* for rsp->jiffies_stall */
191#define RCU_STALL_RAT_DELAY 2 /* Allow other CPUs time */
192 /* to take at least one */
193 /* scheduling clock irq */
194 /* before ratting on them. */
195
196#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
197
198/*
199 * RCU global state, including node hierarchy. This hierarchy is
200 * represented in "heap" form in a dense array. The root (first level)
201 * of the hierarchy is in ->node[0] (referenced by ->level[0]), the second
202 * level in ->node[1] through ->node[m] (->node[1] referenced by ->level[1]),
203 * and the third level in ->node[m+1] and following (->node[m+1] referenced
204 * by ->level[2]). The number of levels is determined by the number of
205 * CPUs and by CONFIG_RCU_FANOUT. Small systems will have a "hierarchy"
206 * consisting of a single rcu_node.
207 */
208struct rcu_state {
209 struct rcu_node node[NUM_RCU_NODES]; /* Hierarchy. */
210 struct rcu_node *level[NUM_RCU_LVLS]; /* Hierarchy levels. */
211 u32 levelcnt[MAX_RCU_LVLS + 1]; /* # nodes in each level. */
212 u8 levelspread[NUM_RCU_LVLS]; /* kids/node in each level. */
213 struct rcu_data *rda[NR_CPUS]; /* array of rdp pointers. */
214
215 /* The following fields are guarded by the root rcu_node's lock. */
216
217 u8 signaled ____cacheline_internodealigned_in_smp;
218 /* Force QS state. */
219 long gpnum; /* Current gp number. */
220 long completed; /* # of last completed gp. */
221 spinlock_t onofflock; /* exclude on/offline and */
222 /* starting new GP. */
223 spinlock_t fqslock; /* Only one task forcing */
224 /* quiescent states. */
225 unsigned long jiffies_force_qs; /* Time at which to invoke */
226 /* force_quiescent_state(). */
227 unsigned long n_force_qs; /* Number of calls to */
228 /* force_quiescent_state(). */
229 unsigned long n_force_qs_lh; /* ~Number of calls leaving */
230 /* due to lock unavailable. */
231 unsigned long n_force_qs_ngp; /* Number of calls leaving */
232 /* due to no GP active. */
233#ifdef CONFIG_RCU_CPU_STALL_DETECTOR
234 unsigned long gp_start; /* Time at which GP started, */
235 /* but in jiffies. */
236 unsigned long jiffies_stall; /* Time at which to check */
237 /* for CPU stalls. */
238#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
239#ifdef CONFIG_NO_HZ
240 long dynticks_completed; /* Value of completed @ snap. */
241#endif /* #ifdef CONFIG_NO_HZ */
242};
243 41
244extern void rcu_qsctr_inc(int cpu); 42#ifdef CONFIG_TREE_PREEMPT_RCU
245extern void rcu_bh_qsctr_inc(int cpu);
246 43
247extern int rcu_pending(int cpu); 44extern void __rcu_read_lock(void);
248extern int rcu_needs_cpu(int cpu); 45extern void __rcu_read_unlock(void);
46extern void exit_rcu(void);
249 47
250#ifdef CONFIG_DEBUG_LOCK_ALLOC 48#else /* #ifdef CONFIG_TREE_PREEMPT_RCU */
251extern struct lockdep_map rcu_lock_map;
252# define rcu_read_acquire() \
253 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
254# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_)
255#else
256# define rcu_read_acquire() do { } while (0)
257# define rcu_read_release() do { } while (0)
258#endif
259 49
260static inline void __rcu_read_lock(void) 50static inline void __rcu_read_lock(void)
261{ 51{
262 preempt_disable(); 52 preempt_disable();
263 __acquire(RCU);
264 rcu_read_acquire();
265} 53}
54
266static inline void __rcu_read_unlock(void) 55static inline void __rcu_read_unlock(void)
267{ 56{
268 rcu_read_release();
269 __release(RCU);
270 preempt_enable(); 57 preempt_enable();
271} 58}
59
60#define __synchronize_sched() synchronize_rcu()
61
62static inline void exit_rcu(void)
63{
64}
65
66#endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */
67
272static inline void __rcu_read_lock_bh(void) 68static inline void __rcu_read_lock_bh(void)
273{ 69{
274 local_bh_disable(); 70 local_bh_disable();
275 __acquire(RCU_BH);
276 rcu_read_acquire();
277} 71}
278static inline void __rcu_read_unlock_bh(void) 72static inline void __rcu_read_unlock_bh(void)
279{ 73{
280 rcu_read_release();
281 __release(RCU_BH);
282 local_bh_enable(); 74 local_bh_enable();
283} 75}
284 76
285#define __synchronize_sched() synchronize_rcu() 77extern void call_rcu_sched(struct rcu_head *head,
286 78 void (*func)(struct rcu_head *rcu));
287#define call_rcu_sched(head, func) call_rcu(head, func) 79extern void synchronize_rcu_expedited(void);
288 80
289static inline void rcu_init_sched(void) 81static inline void synchronize_rcu_bh_expedited(void)
290{ 82{
83 synchronize_sched_expedited();
291} 84}
292 85
293extern void __rcu_init(void); 86extern void __rcu_init(void);
294extern void rcu_check_callbacks(int cpu, int user); 87extern void rcu_check_callbacks(int cpu, int user);
295extern void rcu_restart_cpu(int cpu);
296 88
297extern long rcu_batches_completed(void); 89extern long rcu_batches_completed(void);
298extern long rcu_batches_completed_bh(void); 90extern long rcu_batches_completed_bh(void);
91extern long rcu_batches_completed_sched(void);
299 92
300#ifdef CONFIG_NO_HZ 93#ifdef CONFIG_NO_HZ
301void rcu_enter_nohz(void); 94void rcu_enter_nohz(void);
@@ -309,7 +102,7 @@ static inline void rcu_exit_nohz(void)
309} 102}
310#endif /* CONFIG_NO_HZ */ 103#endif /* CONFIG_NO_HZ */
311 104
312/* A context switch is a grace period for rcutree. */ 105/* A context switch is a grace period for RCU-sched and RCU-bh. */
313static inline int rcu_blocking_is_gp(void) 106static inline int rcu_blocking_is_gp(void)
314{ 107{
315 return num_online_cpus() == 1; 108 return num_online_cpus() == 1;
diff --git a/include/linux/rds.h b/include/linux/rds.h
index d91dc91f5443..89d46e1afbb1 100644
--- a/include/linux/rds.h
+++ b/include/linux/rds.h
@@ -147,6 +147,18 @@ struct rds_info_socket {
147 u_int64_t inum; 147 u_int64_t inum;
148} __attribute__((packed)); 148} __attribute__((packed));
149 149
150struct rds_info_tcp_socket {
151 __be32 local_addr;
152 __be16 local_port;
153 __be32 peer_addr;
154 __be16 peer_port;
155 u_int64_t hdr_rem;
156 u_int64_t data_rem;
157 u_int32_t last_sent_nxt;
158 u_int32_t last_expected_una;
159 u_int32_t last_seen_una;
160} __attribute__((packed));
161
150#define RDS_IB_GID_LEN 16 162#define RDS_IB_GID_LEN 16
151struct rds_info_rdma_connection { 163struct rds_info_rdma_connection {
152 __be32 src_addr; 164 __be32 src_addr;
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 277f4b964df5..490c5b37b6d7 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -125,6 +125,8 @@ struct regulator_bulk_data {
125/* regulator get and put */ 125/* regulator get and put */
126struct regulator *__must_check regulator_get(struct device *dev, 126struct regulator *__must_check regulator_get(struct device *dev,
127 const char *id); 127 const char *id);
128struct regulator *__must_check regulator_get_exclusive(struct device *dev,
129 const char *id);
128void regulator_put(struct regulator *regulator); 130void regulator_put(struct regulator *regulator);
129 131
130/* regulator output control and status */ 132/* regulator output control and status */
@@ -144,6 +146,8 @@ void regulator_bulk_free(int num_consumers,
144 146
145int regulator_count_voltages(struct regulator *regulator); 147int regulator_count_voltages(struct regulator *regulator);
146int regulator_list_voltage(struct regulator *regulator, unsigned selector); 148int regulator_list_voltage(struct regulator *regulator, unsigned selector);
149int regulator_is_supported_voltage(struct regulator *regulator,
150 int min_uV, int max_uV);
147int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV); 151int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
148int regulator_get_voltage(struct regulator *regulator); 152int regulator_get_voltage(struct regulator *regulator);
149int regulator_set_current_limit(struct regulator *regulator, 153int regulator_set_current_limit(struct regulator *regulator,
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 225f733e7533..31f2055eae28 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -37,7 +37,8 @@ enum regulator_status {
37 * 37 *
38 * @enable: Configure the regulator as enabled. 38 * @enable: Configure the regulator as enabled.
39 * @disable: Configure the regulator as disabled. 39 * @disable: Configure the regulator as disabled.
40 * @is_enabled: Return 1 if the regulator is enabled, 0 otherwise. 40 * @is_enabled: Return 1 if the regulator is enabled, 0 if not.
41 * May also return negative errno.
41 * 42 *
42 * @set_voltage: Set the voltage for the regulator within the range specified. 43 * @set_voltage: Set the voltage for the regulator within the range specified.
43 * The driver should select the voltage closest to min_uV. 44 * The driver should select the voltage closest to min_uV.
@@ -162,6 +163,8 @@ struct regulator_desc {
162struct regulator_dev { 163struct regulator_dev {
163 struct regulator_desc *desc; 164 struct regulator_desc *desc;
164 int use_count; 165 int use_count;
166 int open_count;
167 int exclusive;
165 168
166 /* lists we belong to */ 169 /* lists we belong to */
167 struct list_head list; /* list of all regulators */ 170 struct list_head list; /* list of all regulators */
@@ -193,6 +196,8 @@ void *rdev_get_drvdata(struct regulator_dev *rdev);
193struct device *rdev_get_dev(struct regulator_dev *rdev); 196struct device *rdev_get_dev(struct regulator_dev *rdev);
194int rdev_get_id(struct regulator_dev *rdev); 197int rdev_get_id(struct regulator_dev *rdev);
195 198
199int regulator_mode_to_status(unsigned int);
200
196void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data); 201void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);
197 202
198#endif 203#endif
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h
index 91b4da31f1b5..e94a4a1c7c8a 100644
--- a/include/linux/regulator/fixed.h
+++ b/include/linux/regulator/fixed.h
@@ -5,6 +5,9 @@
5 * 5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> 6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 * 7 *
8 * Copyright (c) 2009 Nokia Corporation
9 * Roger Quadros <ext-roger.quadros@nokia.com>
10 *
8 * This program is free software; you can redistribute it and/or 11 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as 12 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the 13 * published by the Free Software Foundation; either version 2 of the
@@ -16,9 +19,30 @@
16 19
17struct regulator_init_data; 20struct regulator_init_data;
18 21
22/**
23 * struct fixed_voltage_config - fixed_voltage_config structure
24 * @supply_name: Name of the regulator supply
25 * @microvolts: Output voltage of regulator
26 * @gpio: GPIO to use for enable control
27 * set to -EINVAL if not used
28 * @enable_high: Polarity of enable GPIO
29 * 1 = Active high, 0 = Active low
30 * @enabled_at_boot: Whether regulator has been enabled at
31 * boot or not. 1 = Yes, 0 = No
32 * This is used to keep the regulator at
33 * the default state
34 * @init_data: regulator_init_data
35 *
36 * This structure contains fixed voltage regulator configuration
37 * information that must be passed by platform code to the fixed
38 * voltage regulator driver.
39 */
19struct fixed_voltage_config { 40struct fixed_voltage_config {
20 const char *supply_name; 41 const char *supply_name;
21 int microvolts; 42 int microvolts;
43 int gpio;
44 unsigned enable_high:1;
45 unsigned enabled_at_boot:1;
22 struct regulator_init_data *init_data; 46 struct regulator_init_data *init_data;
23}; 47};
24 48
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index bac64fa390f2..87f5f176d4ef 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -41,7 +41,7 @@ struct regulator;
41#define REGULATOR_CHANGE_DRMS 0x10 41#define REGULATOR_CHANGE_DRMS 0x10
42 42
43/** 43/**
44 * struct regulator_state - regulator state during low power syatem states 44 * struct regulator_state - regulator state during low power system states
45 * 45 *
46 * This describes a regulators state during a system wide low power state. 46 * This describes a regulators state during a system wide low power state.
47 * 47 *
@@ -117,25 +117,37 @@ struct regulation_constraints {
117 /* mode to set on startup */ 117 /* mode to set on startup */
118 unsigned int initial_mode; 118 unsigned int initial_mode;
119 119
120 /* constriant flags */ 120 /* constraint flags */
121 unsigned always_on:1; /* regulator never off when system is on */ 121 unsigned always_on:1; /* regulator never off when system is on */
122 unsigned boot_on:1; /* bootloader/firmware enabled regulator */ 122 unsigned boot_on:1; /* bootloader/firmware enabled regulator */
123 unsigned apply_uV:1; /* apply uV constraint iff min == max */ 123 unsigned apply_uV:1; /* apply uV constraint if min == max */
124}; 124};
125 125
126/** 126/**
127 * struct regulator_consumer_supply - supply -> device mapping 127 * struct regulator_consumer_supply - supply -> device mapping
128 * 128 *
129 * This maps a supply name to a device. 129 * This maps a supply name to a device. Only one of dev or dev_name
130 * can be specified. Use of dev_name allows support for buses which
131 * make struct device available late such as I2C and is the preferred
132 * form.
130 * 133 *
131 * @dev: Device structure for the consumer. 134 * @dev: Device structure for the consumer.
135 * @dev_name: Result of dev_name() for the consumer.
132 * @supply: Name for the supply. 136 * @supply: Name for the supply.
133 */ 137 */
134struct regulator_consumer_supply { 138struct regulator_consumer_supply {
135 struct device *dev; /* consumer */ 139 struct device *dev; /* consumer */
140 const char *dev_name; /* dev_name() for consumer */
136 const char *supply; /* consumer supply - e.g. "vcc" */ 141 const char *supply; /* consumer supply - e.g. "vcc" */
137}; 142};
138 143
144/* Initialize struct regulator_consumer_supply */
145#define REGULATOR_SUPPLY(_name, _dev_name) \
146{ \
147 .supply = _name, \
148 .dev_name = _dev_name, \
149}
150
139/** 151/**
140 * struct regulator_init_data - regulator platform initialisation data. 152 * struct regulator_init_data - regulator platform initialisation data.
141 * 153 *
@@ -166,6 +178,12 @@ struct regulator_init_data {
166 178
167int regulator_suspend_prepare(suspend_state_t state); 179int regulator_suspend_prepare(suspend_state_t state);
168 180
181#ifdef CONFIG_REGULATOR
169void regulator_has_full_constraints(void); 182void regulator_has_full_constraints(void);
183#else
184static inline void regulator_has_full_constraints(void)
185{
186}
187#endif
170 188
171#endif 189#endif
diff --git a/include/linux/regulator/max1586.h b/include/linux/regulator/max1586.h
index 44563192bf16..de9a7fae20be 100644
--- a/include/linux/regulator/max1586.h
+++ b/include/linux/regulator/max1586.h
@@ -36,7 +36,7 @@
36 * max1586_subdev_data - regulator data 36 * max1586_subdev_data - regulator data
37 * @id: regulator Id (either MAX1586_V3 or MAX1586_V6) 37 * @id: regulator Id (either MAX1586_V3 or MAX1586_V6)
38 * @name: regulator cute name (example for V3: "vcc_core") 38 * @name: regulator cute name (example for V3: "vcc_core")
39 * @platform_data: regulator init data (contraints, supplies, ...) 39 * @platform_data: regulator init data (constraints, supplies, ...)
40 */ 40 */
41struct max1586_subdev_data { 41struct max1586_subdev_data {
42 int id; 42 int id;
@@ -46,7 +46,7 @@ struct max1586_subdev_data {
46 46
47/** 47/**
48 * max1586_platform_data - platform data for max1586 48 * max1586_platform_data - platform data for max1586
49 * @num_subdevs: number of regultors used (may be 1 or 2) 49 * @num_subdevs: number of regulators used (may be 1 or 2)
50 * @subdevs: regulator used 50 * @subdevs: regulator used
51 * At most, there will be a regulator for V3 and one for V6 voltages. 51 * At most, there will be a regulator for V3 and one for V6 voltages.
52 * @v3_gain: gain on the V3 voltage output multiplied by 1e6. 52 * @v3_gain: gain on the V3 voltage output multiplied by 1e6.
diff --git a/include/linux/relay.h b/include/linux/relay.h
index 953fc055e875..14a86bc7102b 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -140,7 +140,7 @@ struct rchan_callbacks
140 * cause relay_open() to create a single global buffer rather 140 * cause relay_open() to create a single global buffer rather
141 * than the default set of per-cpu buffers. 141 * than the default set of per-cpu buffers.
142 * 142 *
143 * See Documentation/filesystems/relayfs.txt for more info. 143 * See Documentation/filesystems/relay.txt for more info.
144 */ 144 */
145 struct dentry *(*create_buf_file)(const char *filename, 145 struct dentry *(*create_buf_file)(const char *filename,
146 struct dentry *parent, 146 struct dentry *parent,
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 511f42fc6816..fcb9884df618 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -35,6 +35,10 @@ struct res_counter {
35 */ 35 */
36 unsigned long long limit; 36 unsigned long long limit;
37 /* 37 /*
38 * the limit that usage can be exceed
39 */
40 unsigned long long soft_limit;
41 /*
38 * the number of unsuccessful attempts to consume the resource 42 * the number of unsuccessful attempts to consume the resource
39 */ 43 */
40 unsigned long long failcnt; 44 unsigned long long failcnt;
@@ -87,6 +91,7 @@ enum {
87 RES_MAX_USAGE, 91 RES_MAX_USAGE,
88 RES_LIMIT, 92 RES_LIMIT,
89 RES_FAILCNT, 93 RES_FAILCNT,
94 RES_SOFT_LIMIT,
90}; 95};
91 96
92/* 97/*
@@ -132,6 +137,36 @@ static inline bool res_counter_limit_check_locked(struct res_counter *cnt)
132 return false; 137 return false;
133} 138}
134 139
140static inline bool res_counter_soft_limit_check_locked(struct res_counter *cnt)
141{
142 if (cnt->usage < cnt->soft_limit)
143 return true;
144
145 return false;
146}
147
148/**
149 * Get the difference between the usage and the soft limit
150 * @cnt: The counter
151 *
152 * Returns 0 if usage is less than or equal to soft limit
153 * The difference between usage and soft limit, otherwise.
154 */
155static inline unsigned long long
156res_counter_soft_limit_excess(struct res_counter *cnt)
157{
158 unsigned long long excess;
159 unsigned long flags;
160
161 spin_lock_irqsave(&cnt->lock, flags);
162 if (cnt->usage <= cnt->soft_limit)
163 excess = 0;
164 else
165 excess = cnt->usage - cnt->soft_limit;
166 spin_unlock_irqrestore(&cnt->lock, flags);
167 return excess;
168}
169
135/* 170/*
136 * Helper function to detect if the cgroup is within it's limit or 171 * Helper function to detect if the cgroup is within it's limit or
137 * not. It's currently called from cgroup_rss_prepare() 172 * not. It's currently called from cgroup_rss_prepare()
@@ -147,6 +182,17 @@ static inline bool res_counter_check_under_limit(struct res_counter *cnt)
147 return ret; 182 return ret;
148} 183}
149 184
185static inline bool res_counter_check_under_soft_limit(struct res_counter *cnt)
186{
187 bool ret;
188 unsigned long flags;
189
190 spin_lock_irqsave(&cnt->lock, flags);
191 ret = res_counter_soft_limit_check_locked(cnt);
192 spin_unlock_irqrestore(&cnt->lock, flags);
193 return ret;
194}
195
150static inline void res_counter_reset_max(struct res_counter *cnt) 196static inline void res_counter_reset_max(struct res_counter *cnt)
151{ 197{
152 unsigned long flags; 198 unsigned long flags;
@@ -180,4 +226,16 @@ static inline int res_counter_set_limit(struct res_counter *cnt,
180 return ret; 226 return ret;
181} 227}
182 228
229static inline int
230res_counter_set_soft_limit(struct res_counter *cnt,
231 unsigned long long soft_limit)
232{
233 unsigned long flags;
234
235 spin_lock_irqsave(&cnt->lock, flags);
236 cnt->soft_limit = soft_limit;
237 spin_unlock_irqrestore(&cnt->lock, flags);
238 return 0;
239}
240
183#endif 241#endif
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 278777fa8a3a..3392c59d2706 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -6,20 +6,17 @@
6 * Copyright (C) 2007 Dmitry Torokhov 6 * Copyright (C) 2007 Dmitry Torokhov
7 * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> 7 * Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * Permission to use, copy, modify, and/or distribute this software for any
10 * it under the terms of the GNU General Public License as published by 10 * purpose with or without fee is hereby granted, provided that the above
11 * the Free Software Foundation; either version 2 of the License, or 11 * copyright notice and this permission notice appear in all copies.
12 * (at your option) any later version.
13 * 12 *
14 * This program is distributed in the hope that it will be useful, 13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17 * GNU General Public License for more details. 16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18 * 17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19 * You should have received a copy of the GNU General Public License 18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20 * along with this program; if not, write to the 19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 * Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 */ 20 */
24 21
25#include <linux/types.h> 22#include <linux/types.h>
@@ -47,6 +44,7 @@ enum rfkill_type {
47 RFKILL_TYPE_UWB, 44 RFKILL_TYPE_UWB,
48 RFKILL_TYPE_WIMAX, 45 RFKILL_TYPE_WIMAX,
49 RFKILL_TYPE_WWAN, 46 RFKILL_TYPE_WWAN,
47 RFKILL_TYPE_GPS,
50 NUM_RFKILL_TYPES, 48 NUM_RFKILL_TYPES,
51}; 49};
52 50
@@ -82,6 +80,20 @@ struct rfkill_event {
82 __u8 soft, hard; 80 __u8 soft, hard;
83} __packed; 81} __packed;
84 82
83/*
84 * We are planning to be backward and forward compatible with changes
85 * to the event struct, by adding new, optional, members at the end.
86 * When reading an event (whether the kernel from userspace or vice
87 * versa) we need to accept anything that's at least as large as the
88 * version 1 event size, but might be able to accept other sizes in
89 * the future.
90 *
91 * One exception is the kernel -- we already have two event sizes in
92 * that we've made the 'hard' member optional since our only option
93 * is to ignore it anyway.
94 */
95#define RFKILL_EVENT_SIZE_V1 8
96
85/* ioctl for turning off rfkill-input (if present) */ 97/* ioctl for turning off rfkill-input (if present) */
86#define RFKILL_IOC_MAGIC 'R' 98#define RFKILL_IOC_MAGIC 'R'
87#define RFKILL_IOC_NOINPUT 1 99#define RFKILL_IOC_NOINPUT 1
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 29f8599e6bea..5fcc31ed5771 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -75,20 +75,6 @@ ring_buffer_event_time_delta(struct ring_buffer_event *event)
75} 75}
76 76
77/* 77/*
78 * ring_buffer_event_discard can discard any event in the ring buffer.
79 * it is up to the caller to protect against a reader from
80 * consuming it or a writer from wrapping and replacing it.
81 *
82 * No external protection is needed if this is called before
83 * the event is commited. But in that case it would be better to
84 * use ring_buffer_discard_commit.
85 *
86 * Note, if an event that has not been committed is discarded
87 * with ring_buffer_event_discard, it must still be committed.
88 */
89void ring_buffer_event_discard(struct ring_buffer_event *event);
90
91/*
92 * ring_buffer_discard_commit will remove an event that has not 78 * ring_buffer_discard_commit will remove an event that has not
93 * ben committed yet. If this is used, then ring_buffer_unlock_commit 79 * ben committed yet. If this is used, then ring_buffer_unlock_commit
94 * must not be called on the discarded event. This function 80 * must not be called on the discarded event. This function
@@ -154,8 +140,17 @@ unsigned long ring_buffer_size(struct ring_buffer *buffer);
154void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu); 140void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu);
155void ring_buffer_reset(struct ring_buffer *buffer); 141void ring_buffer_reset(struct ring_buffer *buffer);
156 142
143#ifdef CONFIG_RING_BUFFER_ALLOW_SWAP
157int ring_buffer_swap_cpu(struct ring_buffer *buffer_a, 144int ring_buffer_swap_cpu(struct ring_buffer *buffer_a,
158 struct ring_buffer *buffer_b, int cpu); 145 struct ring_buffer *buffer_b, int cpu);
146#else
147static inline int
148ring_buffer_swap_cpu(struct ring_buffer *buffer_a,
149 struct ring_buffer *buffer_b, int cpu)
150{
151 return -ENODEV;
152}
153#endif
159 154
160int ring_buffer_empty(struct ring_buffer *buffer); 155int ring_buffer_empty(struct ring_buffer *buffer);
161int ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu); 156int ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu);
@@ -170,7 +165,6 @@ unsigned long ring_buffer_overruns(struct ring_buffer *buffer);
170unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu); 165unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu);
171unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu); 166unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu);
172unsigned long ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu); 167unsigned long ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu);
173unsigned long ring_buffer_nmi_dropped_cpu(struct ring_buffer *buffer, int cpu);
174 168
175u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu); 169u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu);
176void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer, 170void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer,
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index bf116d0dbf23..cb0ba7032609 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -71,21 +71,29 @@ void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned lon
71void page_add_file_rmap(struct page *); 71void page_add_file_rmap(struct page *);
72void page_remove_rmap(struct page *); 72void page_remove_rmap(struct page *);
73 73
74#ifdef CONFIG_DEBUG_VM 74static inline void page_dup_rmap(struct page *page)
75void page_dup_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address);
76#else
77static inline void page_dup_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address)
78{ 75{
79 atomic_inc(&page->_mapcount); 76 atomic_inc(&page->_mapcount);
80} 77}
81#endif
82 78
83/* 79/*
84 * Called from mm/vmscan.c to handle paging out 80 * Called from mm/vmscan.c to handle paging out
85 */ 81 */
86int page_referenced(struct page *, int is_locked, 82int page_referenced(struct page *, int is_locked,
87 struct mem_cgroup *cnt, unsigned long *vm_flags); 83 struct mem_cgroup *cnt, unsigned long *vm_flags);
88int try_to_unmap(struct page *, int ignore_refs); 84enum ttu_flags {
85 TTU_UNMAP = 0, /* unmap mode */
86 TTU_MIGRATION = 1, /* migration mode */
87 TTU_MUNLOCK = 2, /* munlock mode */
88 TTU_ACTION_MASK = 0xff,
89
90 TTU_IGNORE_MLOCK = (1 << 8), /* ignore mlock */
91 TTU_IGNORE_ACCESS = (1 << 9), /* don't age */
92 TTU_IGNORE_HWPOISON = (1 << 10),/* corrupted page is recoverable */
93};
94#define TTU_ACTION(x) ((x) & TTU_ACTION_MASK)
95
96int try_to_unmap(struct page *, enum ttu_flags flags);
89 97
90/* 98/*
91 * Called from mm/filemap_xip.c to unmap empty zero page 99 * Called from mm/filemap_xip.c to unmap empty zero page
@@ -112,6 +120,13 @@ int page_mkclean(struct page *);
112 */ 120 */
113int try_to_munlock(struct page *); 121int try_to_munlock(struct page *);
114 122
123/*
124 * Called by memory-failure.c to kill processes.
125 */
126struct anon_vma *page_lock_anon_vma(struct page *page);
127void page_unlock_anon_vma(struct anon_vma *anon_vma);
128int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma);
129
115#else /* !CONFIG_MMU */ 130#else /* !CONFIG_MMU */
116 131
117#define anon_vma_init() do {} while (0) 132#define anon_vma_init() do {} while (0)
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index ba3254ecf7fb..adf2068d12b5 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -104,7 +104,7 @@ enum {
104 RTM_NEWADDRLABEL = 72, 104 RTM_NEWADDRLABEL = 72,
105#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL 105#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL
106 RTM_DELADDRLABEL, 106 RTM_DELADDRLABEL,
107#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL 107#define RTM_DELADDRLABEL RTM_DELADDRLABEL
108 RTM_GETADDRLABEL, 108 RTM_GETADDRLABEL,
109#define RTM_GETADDRLABEL RTM_GETADDRLABEL 109#define RTM_GETADDRLABEL RTM_GETADDRLABEL
110 110
diff --git a/include/linux/rxrpc.h b/include/linux/rxrpc.h
index f7b826b565c7..a53915cd5581 100644
--- a/include/linux/rxrpc.h
+++ b/include/linux/rxrpc.h
@@ -58,5 +58,12 @@ struct sockaddr_rxrpc {
58#define RXRPC_SECURITY_AUTH 1 /* authenticated packets */ 58#define RXRPC_SECURITY_AUTH 1 /* authenticated packets */
59#define RXRPC_SECURITY_ENCRYPT 2 /* encrypted packets */ 59#define RXRPC_SECURITY_ENCRYPT 2 /* encrypted packets */
60 60
61/*
62 * RxRPC security indices
63 */
64#define RXRPC_SECURITY_NONE 0 /* no security protocol */
65#define RXRPC_SECURITY_RXKAD 2 /* kaserver or kerberos 4 */
66#define RXRPC_SECURITY_RXGK 4 /* gssapi-based */
67#define RXRPC_SECURITY_RXK5 5 /* kerberos 5 */
61 68
62#endif /* _LINUX_RXRPC_H */ 69#endif /* _LINUX_RXRPC_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 0f1ea4a66957..75e6e60bf583 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -38,6 +38,8 @@
38#define SCHED_BATCH 3 38#define SCHED_BATCH 3
39/* SCHED_ISO: reserved but not implemented yet */ 39/* SCHED_ISO: reserved but not implemented yet */
40#define SCHED_IDLE 5 40#define SCHED_IDLE 5
41/* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */
42#define SCHED_RESET_ON_FORK 0x40000000
41 43
42#ifdef __KERNEL__ 44#ifdef __KERNEL__
43 45
@@ -98,7 +100,7 @@ struct robust_list_head;
98struct bio; 100struct bio;
99struct fs_struct; 101struct fs_struct;
100struct bts_context; 102struct bts_context;
101struct perf_counter_context; 103struct perf_event_context;
102 104
103/* 105/*
104 * List of flags we want to share for kernel threads, 106 * List of flags we want to share for kernel threads,
@@ -138,6 +140,10 @@ extern int nr_processes(void);
138extern unsigned long nr_running(void); 140extern unsigned long nr_running(void);
139extern unsigned long nr_uninterruptible(void); 141extern unsigned long nr_uninterruptible(void);
140extern unsigned long nr_iowait(void); 142extern unsigned long nr_iowait(void);
143extern unsigned long nr_iowait_cpu(void);
144extern unsigned long this_cpu_load(void);
145
146
141extern void calc_global_load(void); 147extern void calc_global_load(void);
142extern u64 cpu_nr_migrations(int cpu); 148extern u64 cpu_nr_migrations(int cpu);
143 149
@@ -188,6 +194,7 @@ extern unsigned long long time_sync_thresh;
188/* in tsk->state again */ 194/* in tsk->state again */
189#define TASK_DEAD 64 195#define TASK_DEAD 64
190#define TASK_WAKEKILL 128 196#define TASK_WAKEKILL 128
197#define TASK_WAKING 256
191 198
192/* Convenience macros for the sake of set_task_state */ 199/* Convenience macros for the sake of set_task_state */
193#define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) 200#define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE)
@@ -254,7 +261,7 @@ extern asmlinkage void schedule_tail(struct task_struct *prev);
254extern void init_idle(struct task_struct *idle, int cpu); 261extern void init_idle(struct task_struct *idle, int cpu);
255extern void init_idle_bootup_task(struct task_struct *idle); 262extern void init_idle_bootup_task(struct task_struct *idle);
256 263
257extern int runqueue_is_locked(void); 264extern int runqueue_is_locked(int cpu);
258extern void task_rq_unlock_wait(struct task_struct *p); 265extern void task_rq_unlock_wait(struct task_struct *p);
259 266
260extern cpumask_var_t nohz_cpu_mask; 267extern cpumask_var_t nohz_cpu_mask;
@@ -302,7 +309,7 @@ extern void softlockup_tick(void);
302extern void touch_softlockup_watchdog(void); 309extern void touch_softlockup_watchdog(void);
303extern void touch_all_softlockup_watchdogs(void); 310extern void touch_all_softlockup_watchdogs(void);
304extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write, 311extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write,
305 struct file *filp, void __user *buffer, 312 void __user *buffer,
306 size_t *lenp, loff_t *ppos); 313 size_t *lenp, loff_t *ppos);
307extern unsigned int softlockup_panic; 314extern unsigned int softlockup_panic;
308extern int softlockup_thresh; 315extern int softlockup_thresh;
@@ -324,7 +331,7 @@ extern unsigned long sysctl_hung_task_check_count;
324extern unsigned long sysctl_hung_task_timeout_secs; 331extern unsigned long sysctl_hung_task_timeout_secs;
325extern unsigned long sysctl_hung_task_warnings; 332extern unsigned long sysctl_hung_task_warnings;
326extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write, 333extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
327 struct file *filp, void __user *buffer, 334 void __user *buffer,
328 size_t *lenp, loff_t *ppos); 335 size_t *lenp, loff_t *ppos);
329#endif 336#endif
330 337
@@ -419,6 +426,15 @@ static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm)
419 return max(mm->hiwater_rss, get_mm_rss(mm)); 426 return max(mm->hiwater_rss, get_mm_rss(mm));
420} 427}
421 428
429static inline void setmax_mm_hiwater_rss(unsigned long *maxrss,
430 struct mm_struct *mm)
431{
432 unsigned long hiwater_rss = get_mm_hiwater_rss(mm);
433
434 if (*maxrss < hiwater_rss)
435 *maxrss = hiwater_rss;
436}
437
422static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm) 438static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm)
423{ 439{
424 return max(mm->hiwater_vm, mm->total_vm); 440 return max(mm->hiwater_vm, mm->total_vm);
@@ -431,7 +447,9 @@ extern int get_dumpable(struct mm_struct *mm);
431/* dumpable bits */ 447/* dumpable bits */
432#define MMF_DUMPABLE 0 /* core dump is permitted */ 448#define MMF_DUMPABLE 0 /* core dump is permitted */
433#define MMF_DUMP_SECURELY 1 /* core file is readable only by root */ 449#define MMF_DUMP_SECURELY 1 /* core file is readable only by root */
450
434#define MMF_DUMPABLE_BITS 2 451#define MMF_DUMPABLE_BITS 2
452#define MMF_DUMPABLE_MASK ((1 << MMF_DUMPABLE_BITS) - 1)
435 453
436/* coredump filter bits */ 454/* coredump filter bits */
437#define MMF_DUMP_ANON_PRIVATE 2 455#define MMF_DUMP_ANON_PRIVATE 2
@@ -441,6 +459,7 @@ extern int get_dumpable(struct mm_struct *mm);
441#define MMF_DUMP_ELF_HEADERS 6 459#define MMF_DUMP_ELF_HEADERS 6
442#define MMF_DUMP_HUGETLB_PRIVATE 7 460#define MMF_DUMP_HUGETLB_PRIVATE 7
443#define MMF_DUMP_HUGETLB_SHARED 8 461#define MMF_DUMP_HUGETLB_SHARED 8
462
444#define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS 463#define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS
445#define MMF_DUMP_FILTER_BITS 7 464#define MMF_DUMP_FILTER_BITS 7
446#define MMF_DUMP_FILTER_MASK \ 465#define MMF_DUMP_FILTER_MASK \
@@ -454,6 +473,10 @@ extern int get_dumpable(struct mm_struct *mm);
454#else 473#else
455# define MMF_DUMP_MASK_DEFAULT_ELF 0 474# define MMF_DUMP_MASK_DEFAULT_ELF 0
456#endif 475#endif
476 /* leave room for more dump flags */
477#define MMF_VM_MERGEABLE 16 /* KSM may merge identical pages */
478
479#define MMF_INIT_MASK (MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK)
457 480
458struct sighand_struct { 481struct sighand_struct {
459 atomic_t count; 482 atomic_t count;
@@ -470,6 +493,13 @@ struct pacct_struct {
470 unsigned long ac_minflt, ac_majflt; 493 unsigned long ac_minflt, ac_majflt;
471}; 494};
472 495
496struct cpu_itimer {
497 cputime_t expires;
498 cputime_t incr;
499 u32 error;
500 u32 incr_error;
501};
502
473/** 503/**
474 * struct task_cputime - collected CPU time counts 504 * struct task_cputime - collected CPU time counts
475 * @utime: time spent in user mode, in &cputime_t units 505 * @utime: time spent in user mode, in &cputime_t units
@@ -564,9 +594,12 @@ struct signal_struct {
564 struct pid *leader_pid; 594 struct pid *leader_pid;
565 ktime_t it_real_incr; 595 ktime_t it_real_incr;
566 596
567 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ 597 /*
568 cputime_t it_prof_expires, it_virt_expires; 598 * ITIMER_PROF and ITIMER_VIRTUAL timers for the process, we use
569 cputime_t it_prof_incr, it_virt_incr; 599 * CPUCLOCK_PROF and CPUCLOCK_VIRT for indexing array as these
600 * values are defined to 0 and 1 respectively
601 */
602 struct cpu_itimer it[2];
570 603
571 /* 604 /*
572 * Thread group totals for process CPU timers. 605 * Thread group totals for process CPU timers.
@@ -598,6 +631,7 @@ struct signal_struct {
598 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; 631 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
599 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; 632 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
600 unsigned long inblock, oublock, cinblock, coublock; 633 unsigned long inblock, oublock, cinblock, coublock;
634 unsigned long maxrss, cmaxrss;
601 struct task_io_accounting ioac; 635 struct task_io_accounting ioac;
602 636
603 /* 637 /*
@@ -629,6 +663,8 @@ struct signal_struct {
629 unsigned audit_tty; 663 unsigned audit_tty;
630 struct tty_audit_buf *tty_audit_buf; 664 struct tty_audit_buf *tty_audit_buf;
631#endif 665#endif
666
667 int oom_adj; /* OOM kill score adjustment (bit shift) */
632}; 668};
633 669
634/* Context switch must be unlocked if interrupts are to be enabled */ 670/* Context switch must be unlocked if interrupts are to be enabled */
@@ -698,7 +734,7 @@ struct user_struct {
698#endif 734#endif
699#endif 735#endif
700 736
701#ifdef CONFIG_PERF_COUNTERS 737#ifdef CONFIG_PERF_EVENTS
702 atomic_long_t locked_vm; 738 atomic_long_t locked_vm;
703#endif 739#endif
704}; 740};
@@ -796,18 +832,19 @@ enum cpu_idle_type {
796#define SCHED_LOAD_SCALE_FUZZ SCHED_LOAD_SCALE 832#define SCHED_LOAD_SCALE_FUZZ SCHED_LOAD_SCALE
797 833
798#ifdef CONFIG_SMP 834#ifdef CONFIG_SMP
799#define SD_LOAD_BALANCE 1 /* Do load balancing on this domain. */ 835#define SD_LOAD_BALANCE 0x0001 /* Do load balancing on this domain. */
800#define SD_BALANCE_NEWIDLE 2 /* Balance when about to become idle */ 836#define SD_BALANCE_NEWIDLE 0x0002 /* Balance when about to become idle */
801#define SD_BALANCE_EXEC 4 /* Balance on exec */ 837#define SD_BALANCE_EXEC 0x0004 /* Balance on exec */
802#define SD_BALANCE_FORK 8 /* Balance on fork, clone */ 838#define SD_BALANCE_FORK 0x0008 /* Balance on fork, clone */
803#define SD_WAKE_IDLE 16 /* Wake to idle CPU on task wakeup */ 839#define SD_BALANCE_WAKE 0x0010 /* Balance on wakeup */
804#define SD_WAKE_AFFINE 32 /* Wake task to waking CPU */ 840#define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */
805#define SD_WAKE_BALANCE 64 /* Perform balancing at task wakeup */ 841#define SD_PREFER_LOCAL 0x0040 /* Prefer to keep tasks local to this domain */
806#define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */ 842#define SD_SHARE_CPUPOWER 0x0080 /* Domain members share cpu power */
807#define SD_POWERSAVINGS_BALANCE 256 /* Balance for power savings */ 843#define SD_POWERSAVINGS_BALANCE 0x0100 /* Balance for power savings */
808#define SD_SHARE_PKG_RESOURCES 512 /* Domain members share cpu pkg resources */ 844#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */
809#define SD_SERIALIZE 1024 /* Only a single load balancing instance */ 845#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */
810#define SD_WAKE_IDLE_FAR 2048 /* Gain latency sacrificing cache hit */ 846
847#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */
811 848
812enum powersavings_balance_level { 849enum powersavings_balance_level {
813 POWERSAVINGS_BALANCE_NONE = 0, /* No power saving load balance */ 850 POWERSAVINGS_BALANCE_NONE = 0, /* No power saving load balance */
@@ -827,7 +864,7 @@ static inline int sd_balance_for_mc_power(void)
827 if (sched_smt_power_savings) 864 if (sched_smt_power_savings)
828 return SD_POWERSAVINGS_BALANCE; 865 return SD_POWERSAVINGS_BALANCE;
829 866
830 return 0; 867 return SD_PREFER_SIBLING;
831} 868}
832 869
833static inline int sd_balance_for_package_power(void) 870static inline int sd_balance_for_package_power(void)
@@ -835,7 +872,7 @@ static inline int sd_balance_for_package_power(void)
835 if (sched_mc_power_savings | sched_smt_power_savings) 872 if (sched_mc_power_savings | sched_smt_power_savings)
836 return SD_POWERSAVINGS_BALANCE; 873 return SD_POWERSAVINGS_BALANCE;
837 874
838 return 0; 875 return SD_PREFER_SIBLING;
839} 876}
840 877
841/* 878/*
@@ -857,15 +894,9 @@ struct sched_group {
857 894
858 /* 895 /*
859 * CPU power of this group, SCHED_LOAD_SCALE being max power for a 896 * CPU power of this group, SCHED_LOAD_SCALE being max power for a
860 * single CPU. This is read only (except for setup, hotplug CPU). 897 * single CPU.
861 * Note : Never change cpu_power without recompute its reciprocal
862 */ 898 */
863 unsigned int __cpu_power; 899 unsigned int cpu_power;
864 /*
865 * reciprocal value of cpu_power to avoid expensive divides
866 * (see include/linux/reciprocal_div.h)
867 */
868 u32 reciprocal_cpu_power;
869 900
870 /* 901 /*
871 * The CPUs this group covers. 902 * The CPUs this group covers.
@@ -918,6 +949,7 @@ struct sched_domain {
918 unsigned int newidle_idx; 949 unsigned int newidle_idx;
919 unsigned int wake_idx; 950 unsigned int wake_idx;
920 unsigned int forkexec_idx; 951 unsigned int forkexec_idx;
952 unsigned int smt_gain;
921 int flags; /* See SD_* */ 953 int flags; /* See SD_* */
922 enum sched_domain_level level; 954 enum sched_domain_level level;
923 955
@@ -993,6 +1025,9 @@ static inline int test_sd_parent(struct sched_domain *sd, int flag)
993 return 0; 1025 return 0;
994} 1026}
995 1027
1028unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu);
1029unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu);
1030
996#else /* CONFIG_SMP */ 1031#else /* CONFIG_SMP */
997 1032
998struct sched_domain_attr; 1033struct sched_domain_attr;
@@ -1004,6 +1039,7 @@ partition_sched_domains(int ndoms_new, struct cpumask *doms_new,
1004} 1039}
1005#endif /* !CONFIG_SMP */ 1040#endif /* !CONFIG_SMP */
1006 1041
1042
1007struct io_context; /* See blkdev.h */ 1043struct io_context; /* See blkdev.h */
1008 1044
1009 1045
@@ -1021,6 +1057,12 @@ struct uts_namespace;
1021struct rq; 1057struct rq;
1022struct sched_domain; 1058struct sched_domain;
1023 1059
1060/*
1061 * wake flags
1062 */
1063#define WF_SYNC 0x01 /* waker goes to sleep after wakup */
1064#define WF_FORK 0x02 /* child wakeup after fork */
1065
1024struct sched_class { 1066struct sched_class {
1025 const struct sched_class *next; 1067 const struct sched_class *next;
1026 1068
@@ -1028,13 +1070,13 @@ struct sched_class {
1028 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep); 1070 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep);
1029 void (*yield_task) (struct rq *rq); 1071 void (*yield_task) (struct rq *rq);
1030 1072
1031 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int sync); 1073 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags);
1032 1074
1033 struct task_struct * (*pick_next_task) (struct rq *rq); 1075 struct task_struct * (*pick_next_task) (struct rq *rq);
1034 void (*put_prev_task) (struct rq *rq, struct task_struct *p); 1076 void (*put_prev_task) (struct rq *rq, struct task_struct *p);
1035 1077
1036#ifdef CONFIG_SMP 1078#ifdef CONFIG_SMP
1037 int (*select_task_rq)(struct task_struct *p, int sync); 1079 int (*select_task_rq)(struct task_struct *p, int sd_flag, int flags);
1038 1080
1039 unsigned long (*load_balance) (struct rq *this_rq, int this_cpu, 1081 unsigned long (*load_balance) (struct rq *this_rq, int this_cpu,
1040 struct rq *busiest, unsigned long max_load_move, 1082 struct rq *busiest, unsigned long max_load_move,
@@ -1045,7 +1087,6 @@ struct sched_class {
1045 struct rq *busiest, struct sched_domain *sd, 1087 struct rq *busiest, struct sched_domain *sd,
1046 enum cpu_idle_type idle); 1088 enum cpu_idle_type idle);
1047 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); 1089 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
1048 int (*needs_post_schedule) (struct rq *this_rq);
1049 void (*post_schedule) (struct rq *this_rq); 1090 void (*post_schedule) (struct rq *this_rq);
1050 void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); 1091 void (*task_wake_up) (struct rq *this_rq, struct task_struct *task);
1051 1092
@@ -1067,6 +1108,8 @@ struct sched_class {
1067 void (*prio_changed) (struct rq *this_rq, struct task_struct *task, 1108 void (*prio_changed) (struct rq *this_rq, struct task_struct *task,
1068 int oldprio, int running); 1109 int oldprio, int running);
1069 1110
1111 unsigned int (*get_rr_interval) (struct task_struct *task);
1112
1070#ifdef CONFIG_FAIR_GROUP_SCHED 1113#ifdef CONFIG_FAIR_GROUP_SCHED
1071 void (*moved_group) (struct task_struct *p); 1114 void (*moved_group) (struct task_struct *p);
1072#endif 1115#endif
@@ -1105,11 +1148,15 @@ struct sched_entity {
1105 u64 start_runtime; 1148 u64 start_runtime;
1106 u64 avg_wakeup; 1149 u64 avg_wakeup;
1107 1150
1151 u64 avg_running;
1152
1108#ifdef CONFIG_SCHEDSTATS 1153#ifdef CONFIG_SCHEDSTATS
1109 u64 wait_start; 1154 u64 wait_start;
1110 u64 wait_max; 1155 u64 wait_max;
1111 u64 wait_count; 1156 u64 wait_count;
1112 u64 wait_sum; 1157 u64 wait_sum;
1158 u64 iowait_count;
1159 u64 iowait_sum;
1113 1160
1114 u64 sleep_start; 1161 u64 sleep_start;
1115 u64 sleep_max; 1162 u64 sleep_max;
@@ -1163,6 +1210,8 @@ struct sched_rt_entity {
1163#endif 1210#endif
1164}; 1211};
1165 1212
1213struct rcu_node;
1214
1166struct task_struct { 1215struct task_struct {
1167 volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ 1216 volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */
1168 void *stack; 1217 void *stack;
@@ -1198,7 +1247,6 @@ struct task_struct {
1198 * a short time 1247 * a short time
1199 */ 1248 */
1200 unsigned char fpu_counter; 1249 unsigned char fpu_counter;
1201 s8 oomkilladj; /* OOM kill score adjustment (bit shift). */
1202#ifdef CONFIG_BLK_DEV_IO_TRACE 1250#ifdef CONFIG_BLK_DEV_IO_TRACE
1203 unsigned int btrace_seq; 1251 unsigned int btrace_seq;
1204#endif 1252#endif
@@ -1206,10 +1254,12 @@ struct task_struct {
1206 unsigned int policy; 1254 unsigned int policy;
1207 cpumask_t cpus_allowed; 1255 cpumask_t cpus_allowed;
1208 1256
1209#ifdef CONFIG_PREEMPT_RCU 1257#ifdef CONFIG_TREE_PREEMPT_RCU
1210 int rcu_read_lock_nesting; 1258 int rcu_read_lock_nesting;
1211 int rcu_flipctr_idx; 1259 char rcu_read_unlock_special;
1212#endif /* #ifdef CONFIG_PREEMPT_RCU */ 1260 struct rcu_node *rcu_blocked_node;
1261 struct list_head rcu_node_entry;
1262#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
1213 1263
1214#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 1264#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
1215 struct sched_info sched_info; 1265 struct sched_info sched_info;
@@ -1221,7 +1271,6 @@ struct task_struct {
1221 struct mm_struct *mm, *active_mm; 1271 struct mm_struct *mm, *active_mm;
1222 1272
1223/* task state */ 1273/* task state */
1224 struct linux_binfmt *binfmt;
1225 int exit_state; 1274 int exit_state;
1226 int exit_code, exit_signal; 1275 int exit_code, exit_signal;
1227 int pdeath_signal; /* The signal sent when the parent dies */ 1276 int pdeath_signal; /* The signal sent when the parent dies */
@@ -1230,11 +1279,19 @@ struct task_struct {
1230 unsigned did_exec:1; 1279 unsigned did_exec:1;
1231 unsigned in_execve:1; /* Tell the LSMs that the process is doing an 1280 unsigned in_execve:1; /* Tell the LSMs that the process is doing an
1232 * execve */ 1281 * execve */
1282 unsigned in_iowait:1;
1283
1284
1285 /* Revert to default priority/policy when forking */
1286 unsigned sched_reset_on_fork:1;
1287
1233 pid_t pid; 1288 pid_t pid;
1234 pid_t tgid; 1289 pid_t tgid;
1235 1290
1291#ifdef CONFIG_CC_STACKPROTECTOR
1236 /* Canary value for the -fstack-protector gcc feature */ 1292 /* Canary value for the -fstack-protector gcc feature */
1237 unsigned long stack_canary; 1293 unsigned long stack_canary;
1294#endif
1238 1295
1239 /* 1296 /*
1240 * pointers to (original) parent process, youngest child, younger sibling, 1297 * pointers to (original) parent process, youngest child, younger sibling,
@@ -1292,6 +1349,7 @@ struct task_struct {
1292 struct mutex cred_guard_mutex; /* guard against foreign influences on 1349 struct mutex cred_guard_mutex; /* guard against foreign influences on
1293 * credential calculations 1350 * credential calculations
1294 * (notably. ptrace) */ 1351 * (notably. ptrace) */
1352 struct cred *replacement_session_keyring; /* for KEYCTL_SESSION_TO_PARENT */
1295 1353
1296 char comm[TASK_COMM_LEN]; /* executable name excluding path 1354 char comm[TASK_COMM_LEN]; /* executable name excluding path
1297 - access with [gs]et_task_comm (which lock 1355 - access with [gs]et_task_comm (which lock
@@ -1424,10 +1482,10 @@ struct task_struct {
1424 struct list_head pi_state_list; 1482 struct list_head pi_state_list;
1425 struct futex_pi_state *pi_state_cache; 1483 struct futex_pi_state *pi_state_cache;
1426#endif 1484#endif
1427#ifdef CONFIG_PERF_COUNTERS 1485#ifdef CONFIG_PERF_EVENTS
1428 struct perf_counter_context *perf_counter_ctxp; 1486 struct perf_event_context *perf_event_ctxp;
1429 struct mutex perf_counter_mutex; 1487 struct mutex perf_event_mutex;
1430 struct list_head perf_counter_list; 1488 struct list_head perf_event_list;
1431#endif 1489#endif
1432#ifdef CONFIG_NUMA 1490#ifdef CONFIG_NUMA
1433 struct mempolicy *mempolicy; /* Protected by alloc_lock */ 1491 struct mempolicy *mempolicy; /* Protected by alloc_lock */
@@ -1480,6 +1538,7 @@ struct task_struct {
1480 /* bitmask of trace recursion */ 1538 /* bitmask of trace recursion */
1481 unsigned long trace_recursion; 1539 unsigned long trace_recursion;
1482#endif /* CONFIG_TRACING */ 1540#endif /* CONFIG_TRACING */
1541 unsigned long stack_start;
1483}; 1542};
1484 1543
1485/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1544/* Future-safe accessor for struct task_struct's cpus_allowed. */
@@ -1675,6 +1734,7 @@ extern cputime_t task_gtime(struct task_struct *p);
1675#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ 1734#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */
1676#define PF_VCPU 0x00000010 /* I'm a virtual CPU */ 1735#define PF_VCPU 0x00000010 /* I'm a virtual CPU */
1677#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */ 1736#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */
1737#define PF_MCE_PROCESS 0x00000080 /* process policy on mce errors */
1678#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */ 1738#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */
1679#define PF_DUMPCORE 0x00000200 /* dumped core */ 1739#define PF_DUMPCORE 0x00000200 /* dumped core */
1680#define PF_SIGNALED 0x00000400 /* killed by a signal */ 1740#define PF_SIGNALED 0x00000400 /* killed by a signal */
@@ -1686,7 +1746,7 @@ extern cputime_t task_gtime(struct task_struct *p);
1686#define PF_FROZEN 0x00010000 /* frozen for system suspend */ 1746#define PF_FROZEN 0x00010000 /* frozen for system suspend */
1687#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */ 1747#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */
1688#define PF_KSWAPD 0x00040000 /* I am kswapd */ 1748#define PF_KSWAPD 0x00040000 /* I am kswapd */
1689#define PF_SWAPOFF 0x00080000 /* I am in swapoff */ 1749#define PF_OOM_ORIGIN 0x00080000 /* Allocating much memory to others */
1690#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */ 1750#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */
1691#define PF_KTHREAD 0x00200000 /* I am a kernel thread */ 1751#define PF_KTHREAD 0x00200000 /* I am a kernel thread */
1692#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */ 1752#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */
@@ -1694,6 +1754,7 @@ extern cputime_t task_gtime(struct task_struct *p);
1694#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ 1754#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */
1695#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ 1755#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */
1696#define PF_THREAD_BOUND 0x04000000 /* Thread bound to specific cpu */ 1756#define PF_THREAD_BOUND 0x04000000 /* Thread bound to specific cpu */
1757#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */
1697#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1758#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1698#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1759#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1699#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */ 1760#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */
@@ -1724,6 +1785,27 @@ extern cputime_t task_gtime(struct task_struct *p);
1724#define tsk_used_math(p) ((p)->flags & PF_USED_MATH) 1785#define tsk_used_math(p) ((p)->flags & PF_USED_MATH)
1725#define used_math() tsk_used_math(current) 1786#define used_math() tsk_used_math(current)
1726 1787
1788#ifdef CONFIG_TREE_PREEMPT_RCU
1789
1790#define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */
1791#define RCU_READ_UNLOCK_NEED_QS (1 << 1) /* RCU core needs CPU response. */
1792
1793static inline void rcu_copy_process(struct task_struct *p)
1794{
1795 p->rcu_read_lock_nesting = 0;
1796 p->rcu_read_unlock_special = 0;
1797 p->rcu_blocked_node = NULL;
1798 INIT_LIST_HEAD(&p->rcu_node_entry);
1799}
1800
1801#else
1802
1803static inline void rcu_copy_process(struct task_struct *p)
1804{
1805}
1806
1807#endif
1808
1727#ifdef CONFIG_SMP 1809#ifdef CONFIG_SMP
1728extern int set_cpus_allowed_ptr(struct task_struct *p, 1810extern int set_cpus_allowed_ptr(struct task_struct *p,
1729 const struct cpumask *new_mask); 1811 const struct cpumask *new_mask);
@@ -1736,10 +1818,13 @@ static inline int set_cpus_allowed_ptr(struct task_struct *p,
1736 return 0; 1818 return 0;
1737} 1819}
1738#endif 1820#endif
1821
1822#ifndef CONFIG_CPUMASK_OFFSTACK
1739static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) 1823static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1740{ 1824{
1741 return set_cpus_allowed_ptr(p, &new_mask); 1825 return set_cpus_allowed_ptr(p, &new_mask);
1742} 1826}
1827#endif
1743 1828
1744/* 1829/*
1745 * Architectures can set this to 1 if they have specified 1830 * Architectures can set this to 1 if they have specified
@@ -1813,15 +1898,16 @@ extern unsigned int sysctl_sched_min_granularity;
1813extern unsigned int sysctl_sched_wakeup_granularity; 1898extern unsigned int sysctl_sched_wakeup_granularity;
1814extern unsigned int sysctl_sched_shares_ratelimit; 1899extern unsigned int sysctl_sched_shares_ratelimit;
1815extern unsigned int sysctl_sched_shares_thresh; 1900extern unsigned int sysctl_sched_shares_thresh;
1816#ifdef CONFIG_SCHED_DEBUG
1817extern unsigned int sysctl_sched_child_runs_first; 1901extern unsigned int sysctl_sched_child_runs_first;
1902#ifdef CONFIG_SCHED_DEBUG
1818extern unsigned int sysctl_sched_features; 1903extern unsigned int sysctl_sched_features;
1819extern unsigned int sysctl_sched_migration_cost; 1904extern unsigned int sysctl_sched_migration_cost;
1820extern unsigned int sysctl_sched_nr_migrate; 1905extern unsigned int sysctl_sched_nr_migrate;
1906extern unsigned int sysctl_sched_time_avg;
1821extern unsigned int sysctl_timer_migration; 1907extern unsigned int sysctl_timer_migration;
1822 1908
1823int sched_nr_latency_handler(struct ctl_table *table, int write, 1909int sched_nr_latency_handler(struct ctl_table *table, int write,
1824 struct file *file, void __user *buffer, size_t *length, 1910 void __user *buffer, size_t *length,
1825 loff_t *ppos); 1911 loff_t *ppos);
1826#endif 1912#endif
1827#ifdef CONFIG_SCHED_DEBUG 1913#ifdef CONFIG_SCHED_DEBUG
@@ -1839,7 +1925,7 @@ extern unsigned int sysctl_sched_rt_period;
1839extern int sysctl_sched_rt_runtime; 1925extern int sysctl_sched_rt_runtime;
1840 1926
1841int sched_rt_handler(struct ctl_table *table, int write, 1927int sched_rt_handler(struct ctl_table *table, int write,
1842 struct file *filp, void __user *buffer, size_t *lenp, 1928 void __user *buffer, size_t *lenp,
1843 loff_t *ppos); 1929 loff_t *ppos);
1844 1930
1845extern unsigned int sysctl_sched_compat_yield; 1931extern unsigned int sysctl_sched_compat_yield;
@@ -1974,6 +2060,7 @@ extern int kill_pgrp(struct pid *pid, int sig, int priv);
1974extern int kill_pid(struct pid *pid, int sig, int priv); 2060extern int kill_pid(struct pid *pid, int sig, int priv);
1975extern int kill_proc_info(int, struct siginfo *, pid_t); 2061extern int kill_proc_info(int, struct siginfo *, pid_t);
1976extern int do_notify_parent(struct task_struct *, int); 2062extern int do_notify_parent(struct task_struct *, int);
2063extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent);
1977extern void force_sig(int, struct task_struct *); 2064extern void force_sig(int, struct task_struct *);
1978extern void force_sig_specific(int, struct task_struct *); 2065extern void force_sig_specific(int, struct task_struct *);
1979extern int send_sig(int, struct task_struct *, int); 2066extern int send_sig(int, struct task_struct *, int);
@@ -2077,7 +2164,7 @@ static inline unsigned long wait_task_inactive(struct task_struct *p,
2077#define for_each_process(p) \ 2164#define for_each_process(p) \
2078 for (p = &init_task ; (p = next_task(p)) != &init_task ; ) 2165 for (p = &init_task ; (p = next_task(p)) != &init_task ; )
2079 2166
2080extern bool is_single_threaded(struct task_struct *); 2167extern bool current_is_single_threaded(void);
2081 2168
2082/* 2169/*
2083 * Careful: do_each_thread/while_each_thread is a double loop so 2170 * Careful: do_each_thread/while_each_thread is a double loop so
@@ -2251,7 +2338,10 @@ static inline int signal_pending(struct task_struct *p)
2251 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING)); 2338 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
2252} 2339}
2253 2340
2254extern int __fatal_signal_pending(struct task_struct *p); 2341static inline int __fatal_signal_pending(struct task_struct *p)
2342{
2343 return unlikely(sigismember(&p->pending.signal, SIGKILL));
2344}
2255 2345
2256static inline int fatal_signal_pending(struct task_struct *p) 2346static inline int fatal_signal_pending(struct task_struct *p)
2257{ 2347{
@@ -2281,23 +2371,31 @@ static inline int need_resched(void)
2281 * cond_resched_softirq() will enable bhs before scheduling. 2371 * cond_resched_softirq() will enable bhs before scheduling.
2282 */ 2372 */
2283extern int _cond_resched(void); 2373extern int _cond_resched(void);
2284#ifdef CONFIG_PREEMPT_BKL 2374
2285static inline int cond_resched(void) 2375#define cond_resched() ({ \
2286{ 2376 __might_sleep(__FILE__, __LINE__, 0); \
2287 return 0; 2377 _cond_resched(); \
2288} 2378})
2379
2380extern int __cond_resched_lock(spinlock_t *lock);
2381
2382#ifdef CONFIG_PREEMPT
2383#define PREEMPT_LOCK_OFFSET PREEMPT_OFFSET
2289#else 2384#else
2290static inline int cond_resched(void) 2385#define PREEMPT_LOCK_OFFSET 0
2291{
2292 return _cond_resched();
2293}
2294#endif 2386#endif
2295extern int cond_resched_lock(spinlock_t * lock); 2387
2296extern int cond_resched_softirq(void); 2388#define cond_resched_lock(lock) ({ \
2297static inline int cond_resched_bkl(void) 2389 __might_sleep(__FILE__, __LINE__, PREEMPT_LOCK_OFFSET); \
2298{ 2390 __cond_resched_lock(lock); \
2299 return _cond_resched(); 2391})
2300} 2392
2393extern int __cond_resched_softirq(void);
2394
2395#define cond_resched_softirq() ({ \
2396 __might_sleep(__FILE__, __LINE__, SOFTIRQ_OFFSET); \
2397 __cond_resched_softirq(); \
2398})
2301 2399
2302/* 2400/*
2303 * Does a critical section need to be broken due to another 2401 * Does a critical section need to be broken due to another
diff --git a/include/linux/security.h b/include/linux/security.h
index 1f16eea2017b..239e40d0450b 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -53,7 +53,7 @@ struct audit_krule;
53extern int cap_capable(struct task_struct *tsk, const struct cred *cred, 53extern int cap_capable(struct task_struct *tsk, const struct cred *cred,
54 int cap, int audit); 54 int cap, int audit);
55extern int cap_settime(struct timespec *ts, struct timezone *tz); 55extern int cap_settime(struct timespec *ts, struct timezone *tz);
56extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode); 56extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode);
57extern int cap_ptrace_traceme(struct task_struct *parent); 57extern int cap_ptrace_traceme(struct task_struct *parent);
58extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 58extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
59extern int cap_capset(struct cred *new, const struct cred *old, 59extern int cap_capset(struct cred *new, const struct cred *old,
@@ -133,7 +133,7 @@ static inline unsigned long round_hint_to_min(unsigned long hint)
133 return PAGE_ALIGN(mmap_min_addr); 133 return PAGE_ALIGN(mmap_min_addr);
134 return hint; 134 return hint;
135} 135}
136extern int mmap_min_addr_handler(struct ctl_table *table, int write, struct file *filp, 136extern int mmap_min_addr_handler(struct ctl_table *table, int write,
137 void __user *buffer, size_t *lenp, loff_t *ppos); 137 void __user *buffer, size_t *lenp, loff_t *ppos);
138 138
139#ifdef CONFIG_SECURITY 139#ifdef CONFIG_SECURITY
@@ -653,6 +653,11 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
653 * manual page for definitions of the @clone_flags. 653 * manual page for definitions of the @clone_flags.
654 * @clone_flags contains the flags indicating what should be shared. 654 * @clone_flags contains the flags indicating what should be shared.
655 * Return 0 if permission is granted. 655 * Return 0 if permission is granted.
656 * @cred_alloc_blank:
657 * @cred points to the credentials.
658 * @gfp indicates the atomicity of any memory allocations.
659 * Only allocate sufficient memory and attach to @cred such that
660 * cred_transfer() will not get ENOMEM.
656 * @cred_free: 661 * @cred_free:
657 * @cred points to the credentials. 662 * @cred points to the credentials.
658 * Deallocate and clear the cred->security field in a set of credentials. 663 * Deallocate and clear the cred->security field in a set of credentials.
@@ -665,6 +670,10 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
665 * @new points to the new credentials. 670 * @new points to the new credentials.
666 * @old points to the original credentials. 671 * @old points to the original credentials.
667 * Install a new set of credentials. 672 * Install a new set of credentials.
673 * @cred_transfer:
674 * @new points to the new credentials.
675 * @old points to the original credentials.
676 * Transfer data from original creds to new creds
668 * @kernel_act_as: 677 * @kernel_act_as:
669 * Set the credentials for a kernel service to act as (subjective context). 678 * Set the credentials for a kernel service to act as (subjective context).
670 * @new points to the credentials to be modified. 679 * @new points to the credentials to be modified.
@@ -678,6 +687,10 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
678 * @inode points to the inode to use as a reference. 687 * @inode points to the inode to use as a reference.
679 * The current task must be the one that nominated @inode. 688 * The current task must be the one that nominated @inode.
680 * Return 0 if successful. 689 * Return 0 if successful.
690 * @kernel_module_request:
691 * Ability to trigger the kernel to automatically upcall to userspace for
692 * userspace to load a kernel module with the given name.
693 * Return 0 if successful.
681 * @task_setuid: 694 * @task_setuid:
682 * Check permission before setting one or more of the user identity 695 * Check permission before setting one or more of the user identity
683 * attributes of the current process. The @flags parameter indicates 696 * attributes of the current process. The @flags parameter indicates
@@ -994,6 +1007,17 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
994 * Sets the connection's peersid to the secmark on skb. 1007 * Sets the connection's peersid to the secmark on skb.
995 * @req_classify_flow: 1008 * @req_classify_flow:
996 * Sets the flow's sid to the openreq sid. 1009 * Sets the flow's sid to the openreq sid.
1010 * @tun_dev_create:
1011 * Check permissions prior to creating a new TUN device.
1012 * @tun_dev_post_create:
1013 * This hook allows a module to update or allocate a per-socket security
1014 * structure.
1015 * @sk contains the newly created sock structure.
1016 * @tun_dev_attach:
1017 * Check permissions prior to attaching to a persistent TUN device. This
1018 * hook can also be used by the module to update any security state
1019 * associated with the TUN device's sock structure.
1020 * @sk contains the existing sock structure.
997 * 1021 *
998 * Security hooks for XFRM operations. 1022 * Security hooks for XFRM operations.
999 * 1023 *
@@ -1088,6 +1112,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1088 * Return the length of the string (including terminating NUL) or -ve if 1112 * Return the length of the string (including terminating NUL) or -ve if
1089 * an error. 1113 * an error.
1090 * May also return 0 (and a NULL buffer pointer) if there is no label. 1114 * May also return 0 (and a NULL buffer pointer) if there is no label.
1115 * @key_session_to_parent:
1116 * Forcibly assign the session keyring from a process to its parent
1117 * process.
1118 * @cred: Pointer to process's credentials
1119 * @parent_cred: Pointer to parent process's credentials
1120 * @keyring: Proposed new session keyring
1121 * Return 0 if permission is granted, -ve error otherwise.
1091 * 1122 *
1092 * Security hooks affecting all System V IPC operations. 1123 * Security hooks affecting all System V IPC operations.
1093 * 1124 *
@@ -1229,7 +1260,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1229 * @alter contains the flag indicating whether changes are to be made. 1260 * @alter contains the flag indicating whether changes are to be made.
1230 * Return 0 if permission is granted. 1261 * Return 0 if permission is granted.
1231 * 1262 *
1232 * @ptrace_may_access: 1263 * @ptrace_access_check:
1233 * Check permission before allowing the current process to trace the 1264 * Check permission before allowing the current process to trace the
1234 * @child process. 1265 * @child process.
1235 * Security modules may also want to perform a process tracing check 1266 * Security modules may also want to perform a process tracing check
@@ -1244,7 +1275,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1244 * Check that the @parent process has sufficient permission to trace the 1275 * Check that the @parent process has sufficient permission to trace the
1245 * current process before allowing the current process to present itself 1276 * current process before allowing the current process to present itself
1246 * to the @parent process for tracing. 1277 * to the @parent process for tracing.
1247 * The parent process will still have to undergo the ptrace_may_access 1278 * The parent process will still have to undergo the ptrace_access_check
1248 * checks before it is allowed to trace this one. 1279 * checks before it is allowed to trace this one.
1249 * @parent contains the task_struct structure for debugger process. 1280 * @parent contains the task_struct structure for debugger process.
1250 * Return 0 if permission is granted. 1281 * Return 0 if permission is granted.
@@ -1351,12 +1382,47 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1351 * audit_rule_init. 1382 * audit_rule_init.
1352 * @rule contains the allocated rule 1383 * @rule contains the allocated rule
1353 * 1384 *
1385 * @inode_notifysecctx:
1386 * Notify the security module of what the security context of an inode
1387 * should be. Initializes the incore security context managed by the
1388 * security module for this inode. Example usage: NFS client invokes
1389 * this hook to initialize the security context in its incore inode to the
1390 * value provided by the server for the file when the server returned the
1391 * file's attributes to the client.
1392 *
1393 * Must be called with inode->i_mutex locked.
1394 *
1395 * @inode we wish to set the security context of.
1396 * @ctx contains the string which we wish to set in the inode.
1397 * @ctxlen contains the length of @ctx.
1398 *
1399 * @inode_setsecctx:
1400 * Change the security context of an inode. Updates the
1401 * incore security context managed by the security module and invokes the
1402 * fs code as needed (via __vfs_setxattr_noperm) to update any backing
1403 * xattrs that represent the context. Example usage: NFS server invokes
1404 * this hook to change the security context in its incore inode and on the
1405 * backing filesystem to a value provided by the client on a SETATTR
1406 * operation.
1407 *
1408 * Must be called with inode->i_mutex locked.
1409 *
1410 * @dentry contains the inode we wish to set the security context of.
1411 * @ctx contains the string which we wish to set in the inode.
1412 * @ctxlen contains the length of @ctx.
1413 *
1414 * @inode_getsecctx:
1415 * Returns a string containing all relavent security context information
1416 *
1417 * @inode we wish to set the security context of.
1418 * @ctx is a pointer in which to place the allocated security context.
1419 * @ctxlen points to the place to put the length of @ctx.
1354 * This is the main security structure. 1420 * This is the main security structure.
1355 */ 1421 */
1356struct security_operations { 1422struct security_operations {
1357 char name[SECURITY_NAME_MAX + 1]; 1423 char name[SECURITY_NAME_MAX + 1];
1358 1424
1359 int (*ptrace_may_access) (struct task_struct *child, unsigned int mode); 1425 int (*ptrace_access_check) (struct task_struct *child, unsigned int mode);
1360 int (*ptrace_traceme) (struct task_struct *parent); 1426 int (*ptrace_traceme) (struct task_struct *parent);
1361 int (*capget) (struct task_struct *target, 1427 int (*capget) (struct task_struct *target,
1362 kernel_cap_t *effective, 1428 kernel_cap_t *effective,
@@ -1483,12 +1549,15 @@ struct security_operations {
1483 int (*dentry_open) (struct file *file, const struct cred *cred); 1549 int (*dentry_open) (struct file *file, const struct cred *cred);
1484 1550
1485 int (*task_create) (unsigned long clone_flags); 1551 int (*task_create) (unsigned long clone_flags);
1552 int (*cred_alloc_blank) (struct cred *cred, gfp_t gfp);
1486 void (*cred_free) (struct cred *cred); 1553 void (*cred_free) (struct cred *cred);
1487 int (*cred_prepare)(struct cred *new, const struct cred *old, 1554 int (*cred_prepare)(struct cred *new, const struct cred *old,
1488 gfp_t gfp); 1555 gfp_t gfp);
1489 void (*cred_commit)(struct cred *new, const struct cred *old); 1556 void (*cred_commit)(struct cred *new, const struct cred *old);
1557 void (*cred_transfer)(struct cred *new, const struct cred *old);
1490 int (*kernel_act_as)(struct cred *new, u32 secid); 1558 int (*kernel_act_as)(struct cred *new, u32 secid);
1491 int (*kernel_create_files_as)(struct cred *new, struct inode *inode); 1559 int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
1560 int (*kernel_module_request)(void);
1492 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags); 1561 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags);
1493 int (*task_fix_setuid) (struct cred *new, const struct cred *old, 1562 int (*task_fix_setuid) (struct cred *new, const struct cred *old,
1494 int flags); 1563 int flags);
@@ -1556,6 +1625,10 @@ struct security_operations {
1556 int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid); 1625 int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid);
1557 void (*release_secctx) (char *secdata, u32 seclen); 1626 void (*release_secctx) (char *secdata, u32 seclen);
1558 1627
1628 int (*inode_notifysecctx)(struct inode *inode, void *ctx, u32 ctxlen);
1629 int (*inode_setsecctx)(struct dentry *dentry, void *ctx, u32 ctxlen);
1630 int (*inode_getsecctx)(struct inode *inode, void **ctx, u32 *ctxlen);
1631
1559#ifdef CONFIG_SECURITY_NETWORK 1632#ifdef CONFIG_SECURITY_NETWORK
1560 int (*unix_stream_connect) (struct socket *sock, 1633 int (*unix_stream_connect) (struct socket *sock,
1561 struct socket *other, struct sock *newsk); 1634 struct socket *other, struct sock *newsk);
@@ -1592,6 +1665,9 @@ struct security_operations {
1592 void (*inet_csk_clone) (struct sock *newsk, const struct request_sock *req); 1665 void (*inet_csk_clone) (struct sock *newsk, const struct request_sock *req);
1593 void (*inet_conn_established) (struct sock *sk, struct sk_buff *skb); 1666 void (*inet_conn_established) (struct sock *sk, struct sk_buff *skb);
1594 void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl); 1667 void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl);
1668 int (*tun_dev_create)(void);
1669 void (*tun_dev_post_create)(struct sock *sk);
1670 int (*tun_dev_attach)(struct sock *sk);
1595#endif /* CONFIG_SECURITY_NETWORK */ 1671#endif /* CONFIG_SECURITY_NETWORK */
1596 1672
1597#ifdef CONFIG_SECURITY_NETWORK_XFRM 1673#ifdef CONFIG_SECURITY_NETWORK_XFRM
@@ -1620,6 +1696,9 @@ struct security_operations {
1620 const struct cred *cred, 1696 const struct cred *cred,
1621 key_perm_t perm); 1697 key_perm_t perm);
1622 int (*key_getsecurity)(struct key *key, char **_buffer); 1698 int (*key_getsecurity)(struct key *key, char **_buffer);
1699 int (*key_session_to_parent)(const struct cred *cred,
1700 const struct cred *parent_cred,
1701 struct key *key);
1623#endif /* CONFIG_KEYS */ 1702#endif /* CONFIG_KEYS */
1624 1703
1625#ifdef CONFIG_AUDIT 1704#ifdef CONFIG_AUDIT
@@ -1637,7 +1716,7 @@ extern int security_module_enable(struct security_operations *ops);
1637extern int register_security(struct security_operations *ops); 1716extern int register_security(struct security_operations *ops);
1638 1717
1639/* Security operations */ 1718/* Security operations */
1640int security_ptrace_may_access(struct task_struct *child, unsigned int mode); 1719int security_ptrace_access_check(struct task_struct *child, unsigned int mode);
1641int security_ptrace_traceme(struct task_struct *parent); 1720int security_ptrace_traceme(struct task_struct *parent);
1642int security_capget(struct task_struct *target, 1721int security_capget(struct task_struct *target,
1643 kernel_cap_t *effective, 1722 kernel_cap_t *effective,
@@ -1736,11 +1815,14 @@ int security_file_send_sigiotask(struct task_struct *tsk,
1736int security_file_receive(struct file *file); 1815int security_file_receive(struct file *file);
1737int security_dentry_open(struct file *file, const struct cred *cred); 1816int security_dentry_open(struct file *file, const struct cred *cred);
1738int security_task_create(unsigned long clone_flags); 1817int security_task_create(unsigned long clone_flags);
1818int security_cred_alloc_blank(struct cred *cred, gfp_t gfp);
1739void security_cred_free(struct cred *cred); 1819void security_cred_free(struct cred *cred);
1740int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp); 1820int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp);
1741void security_commit_creds(struct cred *new, const struct cred *old); 1821void security_commit_creds(struct cred *new, const struct cred *old);
1822void security_transfer_creds(struct cred *new, const struct cred *old);
1742int security_kernel_act_as(struct cred *new, u32 secid); 1823int security_kernel_act_as(struct cred *new, u32 secid);
1743int security_kernel_create_files_as(struct cred *new, struct inode *inode); 1824int security_kernel_create_files_as(struct cred *new, struct inode *inode);
1825int security_kernel_module_request(void);
1744int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags); 1826int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags);
1745int security_task_fix_setuid(struct cred *new, const struct cred *old, 1827int security_task_fix_setuid(struct cred *new, const struct cred *old,
1746 int flags); 1828 int flags);
@@ -1796,6 +1878,9 @@ int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
1796int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); 1878int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
1797void security_release_secctx(char *secdata, u32 seclen); 1879void security_release_secctx(char *secdata, u32 seclen);
1798 1880
1881int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen);
1882int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen);
1883int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen);
1799#else /* CONFIG_SECURITY */ 1884#else /* CONFIG_SECURITY */
1800struct security_mnt_opts { 1885struct security_mnt_opts {
1801}; 1886};
@@ -1818,10 +1903,10 @@ static inline int security_init(void)
1818 return 0; 1903 return 0;
1819} 1904}
1820 1905
1821static inline int security_ptrace_may_access(struct task_struct *child, 1906static inline int security_ptrace_access_check(struct task_struct *child,
1822 unsigned int mode) 1907 unsigned int mode)
1823{ 1908{
1824 return cap_ptrace_may_access(child, mode); 1909 return cap_ptrace_access_check(child, mode);
1825} 1910}
1826 1911
1827static inline int security_ptrace_traceme(struct task_struct *parent) 1912static inline int security_ptrace_traceme(struct task_struct *parent)
@@ -2266,6 +2351,11 @@ static inline int security_task_create(unsigned long clone_flags)
2266 return 0; 2351 return 0;
2267} 2352}
2268 2353
2354static inline int security_cred_alloc_blank(struct cred *cred, gfp_t gfp)
2355{
2356 return 0;
2357}
2358
2269static inline void security_cred_free(struct cred *cred) 2359static inline void security_cred_free(struct cred *cred)
2270{ } 2360{ }
2271 2361
@@ -2281,6 +2371,11 @@ static inline void security_commit_creds(struct cred *new,
2281{ 2371{
2282} 2372}
2283 2373
2374static inline void security_transfer_creds(struct cred *new,
2375 const struct cred *old)
2376{
2377}
2378
2284static inline int security_kernel_act_as(struct cred *cred, u32 secid) 2379static inline int security_kernel_act_as(struct cred *cred, u32 secid)
2285{ 2380{
2286 return 0; 2381 return 0;
@@ -2292,6 +2387,11 @@ static inline int security_kernel_create_files_as(struct cred *cred,
2292 return 0; 2387 return 0;
2293} 2388}
2294 2389
2390static inline int security_kernel_module_request(void)
2391{
2392 return 0;
2393}
2394
2295static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, 2395static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2,
2296 int flags) 2396 int flags)
2297{ 2397{
@@ -2537,6 +2637,19 @@ static inline int security_secctx_to_secid(const char *secdata,
2537static inline void security_release_secctx(char *secdata, u32 seclen) 2637static inline void security_release_secctx(char *secdata, u32 seclen)
2538{ 2638{
2539} 2639}
2640
2641static inline int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen)
2642{
2643 return -EOPNOTSUPP;
2644}
2645static inline int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen)
2646{
2647 return -EOPNOTSUPP;
2648}
2649static inline int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen)
2650{
2651 return -EOPNOTSUPP;
2652}
2540#endif /* CONFIG_SECURITY */ 2653#endif /* CONFIG_SECURITY */
2541 2654
2542#ifdef CONFIG_SECURITY_NETWORK 2655#ifdef CONFIG_SECURITY_NETWORK
@@ -2575,6 +2688,9 @@ void security_inet_csk_clone(struct sock *newsk,
2575 const struct request_sock *req); 2688 const struct request_sock *req);
2576void security_inet_conn_established(struct sock *sk, 2689void security_inet_conn_established(struct sock *sk,
2577 struct sk_buff *skb); 2690 struct sk_buff *skb);
2691int security_tun_dev_create(void);
2692void security_tun_dev_post_create(struct sock *sk);
2693int security_tun_dev_attach(struct sock *sk);
2578 2694
2579#else /* CONFIG_SECURITY_NETWORK */ 2695#else /* CONFIG_SECURITY_NETWORK */
2580static inline int security_unix_stream_connect(struct socket *sock, 2696static inline int security_unix_stream_connect(struct socket *sock,
@@ -2725,6 +2841,20 @@ static inline void security_inet_conn_established(struct sock *sk,
2725 struct sk_buff *skb) 2841 struct sk_buff *skb)
2726{ 2842{
2727} 2843}
2844
2845static inline int security_tun_dev_create(void)
2846{
2847 return 0;
2848}
2849
2850static inline void security_tun_dev_post_create(struct sock *sk)
2851{
2852}
2853
2854static inline int security_tun_dev_attach(struct sock *sk)
2855{
2856 return 0;
2857}
2728#endif /* CONFIG_SECURITY_NETWORK */ 2858#endif /* CONFIG_SECURITY_NETWORK */
2729 2859
2730#ifdef CONFIG_SECURITY_NETWORK_XFRM 2860#ifdef CONFIG_SECURITY_NETWORK_XFRM
@@ -2881,6 +3011,9 @@ void security_key_free(struct key *key);
2881int security_key_permission(key_ref_t key_ref, 3011int security_key_permission(key_ref_t key_ref,
2882 const struct cred *cred, key_perm_t perm); 3012 const struct cred *cred, key_perm_t perm);
2883int security_key_getsecurity(struct key *key, char **_buffer); 3013int security_key_getsecurity(struct key *key, char **_buffer);
3014int security_key_session_to_parent(const struct cred *cred,
3015 const struct cred *parent_cred,
3016 struct key *key);
2884 3017
2885#else 3018#else
2886 3019
@@ -2908,6 +3041,13 @@ static inline int security_key_getsecurity(struct key *key, char **_buffer)
2908 return 0; 3041 return 0;
2909} 3042}
2910 3043
3044static inline int security_key_session_to_parent(const struct cred *cred,
3045 const struct cred *parent_cred,
3046 struct key *key)
3047{
3048 return 0;
3049}
3050
2911#endif 3051#endif
2912#endif /* CONFIG_KEYS */ 3052#endif /* CONFIG_KEYS */
2913 3053
diff --git a/include/linux/selinux.h b/include/linux/selinux.h
index 20f965d4b041..82e0f26a1299 100644
--- a/include/linux/selinux.h
+++ b/include/linux/selinux.h
@@ -61,6 +61,11 @@ void selinux_secmark_refcount_inc(void);
61 * existing SECMARK targets has been removed/flushed. 61 * existing SECMARK targets has been removed/flushed.
62 */ 62 */
63void selinux_secmark_refcount_dec(void); 63void selinux_secmark_refcount_dec(void);
64
65/**
66 * selinux_is_enabled - is SELinux enabled?
67 */
68bool selinux_is_enabled(void);
64#else 69#else
65 70
66static inline int selinux_string_to_sid(const char *str, u32 *sid) 71static inline int selinux_string_to_sid(const char *str, u32 *sid)
@@ -84,6 +89,10 @@ static inline void selinux_secmark_refcount_dec(void)
84 return; 89 return;
85} 90}
86 91
92static inline bool selinux_is_enabled(void)
93{
94 return false;
95}
87#endif /* CONFIG_SECURITY_SELINUX */ 96#endif /* CONFIG_SECURITY_SELINUX */
88 97
89#endif /* _LINUX_SELINUX_H */ 98#endif /* _LINUX_SELINUX_H */
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 0c6a86b79596..8366d8f12e53 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -35,6 +35,44 @@ struct seq_operations {
35 35
36#define SEQ_SKIP 1 36#define SEQ_SKIP 1
37 37
38/**
39 * seq_get_buf - get buffer to write arbitrary data to
40 * @m: the seq_file handle
41 * @bufp: the beginning of the buffer is stored here
42 *
43 * Return the number of bytes available in the buffer, or zero if
44 * there's no space.
45 */
46static inline size_t seq_get_buf(struct seq_file *m, char **bufp)
47{
48 BUG_ON(m->count > m->size);
49 if (m->count < m->size)
50 *bufp = m->buf + m->count;
51 else
52 *bufp = NULL;
53
54 return m->size - m->count;
55}
56
57/**
58 * seq_commit - commit data to the buffer
59 * @m: the seq_file handle
60 * @num: the number of bytes to commit
61 *
62 * Commit @num bytes of data written to a buffer previously acquired
63 * by seq_buf_get. To signal an error condition, or that the data
64 * didn't fit in the available space, pass a negative @num value.
65 */
66static inline void seq_commit(struct seq_file *m, int num)
67{
68 if (num < 0) {
69 m->count = m->size;
70 } else {
71 BUG_ON(m->count + num > m->size);
72 m->count += num;
73 }
74}
75
38char *mangle_path(char *s, char *p, char *esc); 76char *mangle_path(char *s, char *p, char *esc);
39int seq_open(struct file *, const struct seq_operations *); 77int seq_open(struct file *, const struct seq_operations *);
40ssize_t seq_read(struct file *, char __user *, size_t, loff_t *); 78ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
diff --git a/include/linux/serial.h b/include/linux/serial.h
index e5bb75a63802..c8613c3ff9d3 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -122,6 +122,7 @@ struct serial_uart_config {
122 122
123/* Internal flags used only by kernel */ 123/* Internal flags used only by kernel */
124#define ASYNCB_INITIALIZED 31 /* Serial port was initialized */ 124#define ASYNCB_INITIALIZED 31 /* Serial port was initialized */
125#define ASYNCB_SUSPENDED 30 /* Serial port is suspended */
125#define ASYNCB_NORMAL_ACTIVE 29 /* Normal device is active */ 126#define ASYNCB_NORMAL_ACTIVE 29 /* Normal device is active */
126#define ASYNCB_BOOT_AUTOCONF 28 /* Autoconfigure port on bootup */ 127#define ASYNCB_BOOT_AUTOCONF 28 /* Autoconfigure port on bootup */
127#define ASYNCB_CLOSING 27 /* Serial port is closing */ 128#define ASYNCB_CLOSING 27 /* Serial port is closing */
@@ -133,6 +134,7 @@ struct serial_uart_config {
133#define ASYNCB_FIRST_KERNEL 22 134#define ASYNCB_FIRST_KERNEL 22
134 135
135#define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY) 136#define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY)
137#define ASYNC_SUSPENDED (1U << ASYNCB_SUSPENDED)
136#define ASYNC_FOURPORT (1U << ASYNCB_FOURPORT) 138#define ASYNC_FOURPORT (1U << ASYNCB_FOURPORT)
137#define ASYNC_SAK (1U << ASYNCB_SAK) 139#define ASYNC_SAK (1U << ASYNCB_SAK)
138#define ASYNC_SPLIT_TERMIOS (1U << ASYNCB_SPLIT_TERMIOS) 140#define ASYNC_SPLIT_TERMIOS (1U << ASYNCB_SPLIT_TERMIOS)
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index d4d2a78ad43e..fb46aba11fb5 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -22,6 +22,7 @@ struct plat_serial8250_port {
22 void __iomem *membase; /* ioremap cookie or NULL */ 22 void __iomem *membase; /* ioremap cookie or NULL */
23 resource_size_t mapbase; /* resource base */ 23 resource_size_t mapbase; /* resource base */
24 unsigned int irq; /* interrupt number */ 24 unsigned int irq; /* interrupt number */
25 unsigned long irqflags; /* request_irq flags */
25 unsigned int uartclk; /* UART clock rate */ 26 unsigned int uartclk; /* UART clock rate */
26 void *private_data; 27 void *private_data;
27 unsigned char regshift; /* register shift */ 28 unsigned char regshift; /* register shift */
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 23d2fb051f97..db532ce288be 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -20,6 +20,8 @@
20#ifndef LINUX_SERIAL_CORE_H 20#ifndef LINUX_SERIAL_CORE_H
21#define LINUX_SERIAL_CORE_H 21#define LINUX_SERIAL_CORE_H
22 22
23#include <linux/serial.h>
24
23/* 25/*
24 * The type definitions. These are from Ted Ts'o's serial.h 26 * The type definitions. These are from Ted Ts'o's serial.h
25 */ 27 */
@@ -174,6 +176,9 @@
174/* Qualcomm MSM SoCs */ 176/* Qualcomm MSM SoCs */
175#define PORT_MSM 88 177#define PORT_MSM 88
176 178
179/* BCM63xx family SoCs */
180#define PORT_BCM63XX 89
181
177#ifdef __KERNEL__ 182#ifdef __KERNEL__
178 183
179#include <linux/compiler.h> 184#include <linux/compiler.h>
@@ -186,7 +191,6 @@
186#include <linux/sysrq.h> 191#include <linux/sysrq.h>
187 192
188struct uart_port; 193struct uart_port;
189struct uart_info;
190struct serial_struct; 194struct serial_struct;
191struct device; 195struct device;
192 196
@@ -265,6 +269,7 @@ struct uart_port {
265 unsigned int (*serial_in)(struct uart_port *, int); 269 unsigned int (*serial_in)(struct uart_port *, int);
266 void (*serial_out)(struct uart_port *, int, int); 270 void (*serial_out)(struct uart_port *, int, int);
267 unsigned int irq; /* irq number */ 271 unsigned int irq; /* irq number */
272 unsigned long irqflags; /* irq flags */
268 unsigned int uartclk; /* base uart clock */ 273 unsigned int uartclk; /* base uart clock */
269 unsigned int fifosize; /* tx fifo size */ 274 unsigned int fifosize; /* tx fifo size */
270 unsigned char x_char; /* xon/xoff char */ 275 unsigned char x_char; /* xon/xoff char */
@@ -283,7 +288,7 @@ struct uart_port {
283 288
284 unsigned int read_status_mask; /* driver specific */ 289 unsigned int read_status_mask; /* driver specific */
285 unsigned int ignore_status_mask; /* driver specific */ 290 unsigned int ignore_status_mask; /* driver specific */
286 struct uart_info *info; /* pointer to parent info */ 291 struct uart_state *state; /* pointer to parent state */
287 struct uart_icount icount; /* statistics */ 292 struct uart_icount icount; /* statistics */
288 293
289 struct console *cons; /* struct console, if any */ 294 struct console *cons; /* struct console, if any */
@@ -335,52 +340,16 @@ struct uart_port {
335}; 340};
336 341
337/* 342/*
338 * This is the state information which is only valid when the port
339 * is open; it may be cleared the core driver once the device has
340 * been closed. Either the low level driver or the core can modify
341 * stuff here.
342 */
343typedef unsigned int __bitwise__ uif_t;
344
345struct uart_info {
346 struct tty_port port;
347 struct circ_buf xmit;
348 uif_t flags;
349
350/*
351 * Definitions for info->flags. These are _private_ to serial_core, and
352 * are specific to this structure. They may be queried by low level drivers.
353 *
354 * FIXME: use the ASY_ definitions
355 */
356#define UIF_CHECK_CD ((__force uif_t) (1 << 25))
357#define UIF_CTS_FLOW ((__force uif_t) (1 << 26))
358#define UIF_NORMAL_ACTIVE ((__force uif_t) (1 << 29))
359#define UIF_INITIALIZED ((__force uif_t) (1 << 31))
360#define UIF_SUSPENDED ((__force uif_t) (1 << 30))
361
362 struct tasklet_struct tlet;
363 wait_queue_head_t delta_msr_wait;
364};
365
366/*
367 * This is the state information which is persistent across opens. 343 * This is the state information which is persistent across opens.
368 * The low level driver must not to touch any elements contained
369 * within.
370 */ 344 */
371struct uart_state { 345struct uart_state {
372 unsigned int close_delay; /* msec */ 346 struct tty_port port;
373 unsigned int closing_wait; /* msec */
374
375#define USF_CLOSING_WAIT_INF (0)
376#define USF_CLOSING_WAIT_NONE (~0U)
377 347
378 int count;
379 int pm_state; 348 int pm_state;
380 struct uart_info info; 349 struct circ_buf xmit;
381 struct uart_port *port;
382 350
383 struct mutex mutex; 351 struct tasklet_struct tlet;
352 struct uart_port *uart_port;
384}; 353};
385 354
386#define UART_XMIT_SIZE PAGE_SIZE 355#define UART_XMIT_SIZE PAGE_SIZE
@@ -461,7 +430,7 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port);
461 430
462static inline int uart_tx_stopped(struct uart_port *port) 431static inline int uart_tx_stopped(struct uart_port *port)
463{ 432{
464 struct tty_struct *tty = port->info->port.tty; 433 struct tty_struct *tty = port->state->port.tty;
465 if(tty->stopped || tty->hw_stopped) 434 if(tty->stopped || tty->hw_stopped)
466 return 1; 435 return 1;
467 return 0; 436 return 0;
@@ -476,7 +445,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
476#ifdef SUPPORT_SYSRQ 445#ifdef SUPPORT_SYSRQ
477 if (port->sysrq) { 446 if (port->sysrq) {
478 if (ch && time_before(jiffies, port->sysrq)) { 447 if (ch && time_before(jiffies, port->sysrq)) {
479 handle_sysrq(ch, port->info->port.tty); 448 handle_sysrq(ch, port->state->port.tty);
480 port->sysrq = 0; 449 port->sysrq = 0;
481 return 1; 450 return 1;
482 } 451 }
@@ -494,7 +463,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
494 */ 463 */
495static inline int uart_handle_break(struct uart_port *port) 464static inline int uart_handle_break(struct uart_port *port)
496{ 465{
497 struct uart_info *info = port->info; 466 struct uart_state *state = port->state;
498#ifdef SUPPORT_SYSRQ 467#ifdef SUPPORT_SYSRQ
499 if (port->cons && port->cons->index == port->line) { 468 if (port->cons && port->cons->index == port->line) {
500 if (!port->sysrq) { 469 if (!port->sysrq) {
@@ -505,59 +474,60 @@ static inline int uart_handle_break(struct uart_port *port)
505 } 474 }
506#endif 475#endif
507 if (port->flags & UPF_SAK) 476 if (port->flags & UPF_SAK)
508 do_SAK(info->port.tty); 477 do_SAK(state->port.tty);
509 return 0; 478 return 0;
510} 479}
511 480
512/** 481/**
513 * uart_handle_dcd_change - handle a change of carrier detect state 482 * uart_handle_dcd_change - handle a change of carrier detect state
514 * @port: uart_port structure for the open port 483 * @uport: uart_port structure for the open port
515 * @status: new carrier detect status, nonzero if active 484 * @status: new carrier detect status, nonzero if active
516 */ 485 */
517static inline void 486static inline void
518uart_handle_dcd_change(struct uart_port *port, unsigned int status) 487uart_handle_dcd_change(struct uart_port *uport, unsigned int status)
519{ 488{
520 struct uart_info *info = port->info; 489 struct uart_state *state = uport->state;
490 struct tty_port *port = &state->port;
521 491
522 port->icount.dcd++; 492 uport->icount.dcd++;
523 493
524#ifdef CONFIG_HARD_PPS 494#ifdef CONFIG_HARD_PPS
525 if ((port->flags & UPF_HARDPPS_CD) && status) 495 if ((uport->flags & UPF_HARDPPS_CD) && status)
526 hardpps(); 496 hardpps();
527#endif 497#endif
528 498
529 if (info->flags & UIF_CHECK_CD) { 499 if (port->flags & ASYNC_CHECK_CD) {
530 if (status) 500 if (status)
531 wake_up_interruptible(&info->port.open_wait); 501 wake_up_interruptible(&port->open_wait);
532 else if (info->port.tty) 502 else if (port->tty)
533 tty_hangup(info->port.tty); 503 tty_hangup(port->tty);
534 } 504 }
535} 505}
536 506
537/** 507/**
538 * uart_handle_cts_change - handle a change of clear-to-send state 508 * uart_handle_cts_change - handle a change of clear-to-send state
539 * @port: uart_port structure for the open port 509 * @uport: uart_port structure for the open port
540 * @status: new clear to send status, nonzero if active 510 * @status: new clear to send status, nonzero if active
541 */ 511 */
542static inline void 512static inline void
543uart_handle_cts_change(struct uart_port *port, unsigned int status) 513uart_handle_cts_change(struct uart_port *uport, unsigned int status)
544{ 514{
545 struct uart_info *info = port->info; 515 struct tty_port *port = &uport->state->port;
546 struct tty_struct *tty = info->port.tty; 516 struct tty_struct *tty = port->tty;
547 517
548 port->icount.cts++; 518 uport->icount.cts++;
549 519
550 if (info->flags & UIF_CTS_FLOW) { 520 if (port->flags & ASYNC_CTS_FLOW) {
551 if (tty->hw_stopped) { 521 if (tty->hw_stopped) {
552 if (status) { 522 if (status) {
553 tty->hw_stopped = 0; 523 tty->hw_stopped = 0;
554 port->ops->start_tx(port); 524 uport->ops->start_tx(uport);
555 uart_write_wakeup(port); 525 uart_write_wakeup(uport);
556 } 526 }
557 } else { 527 } else {
558 if (!status) { 528 if (!status) {
559 tty->hw_stopped = 1; 529 tty->hw_stopped = 1;
560 port->ops->stop_tx(port); 530 uport->ops->stop_tx(uport);
561 } 531 }
562 } 532 }
563 } 533 }
@@ -569,7 +539,7 @@ static inline void
569uart_insert_char(struct uart_port *port, unsigned int status, 539uart_insert_char(struct uart_port *port, unsigned int status,
570 unsigned int overrun, unsigned int ch, unsigned int flag) 540 unsigned int overrun, unsigned int ch, unsigned int flag)
571{ 541{
572 struct tty_struct *tty = port->info->port.tty; 542 struct tty_struct *tty = port->state->port.tty;
573 543
574 if ((status & port->ignore_status_mask & ~overrun) == 0) 544 if ((status & port->ignore_status_mask & ~overrun) == 0)
575 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 126d24c9eaa8..a640bc2afe76 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -31,8 +31,6 @@ struct serio {
31 31
32 bool manual_bind; 32 bool manual_bind;
33 bool registered; /* port has been fully registered with driver core */ 33 bool registered; /* port has been fully registered with driver core */
34 bool suspended; /* port is suspended */
35
36 34
37 struct serio_device_id id; 35 struct serio_device_id id;
38 36
diff --git a/include/linux/sfi.h b/include/linux/sfi.h
new file mode 100644
index 000000000000..9a6f7607174e
--- /dev/null
+++ b/include/linux/sfi.h
@@ -0,0 +1,206 @@
1/* sfi.h Simple Firmware Interface */
2
3/*
4
5 This file is provided under a dual BSD/GPLv2 license. When using or
6 redistributing this file, you may do so under either license.
7
8 GPL LICENSE SUMMARY
9
10 Copyright(c) 2009 Intel Corporation. All rights reserved.
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of version 2 of the GNU General Public License as
14 published by the Free Software Foundation.
15
16 This program is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
24 The full GNU General Public License is included in this distribution
25 in the file called LICENSE.GPL.
26
27 BSD LICENSE
28
29 Copyright(c) 2009 Intel Corporation. All rights reserved.
30
31 Redistribution and use in source and binary forms, with or without
32 modification, are permitted provided that the following conditions
33 are met:
34
35 * Redistributions of source code must retain the above copyright
36 notice, this list of conditions and the following disclaimer.
37 * Redistributions in binary form must reproduce the above copyright
38 notice, this list of conditions and the following disclaimer in
39 the documentation and/or other materials provided with the
40 distribution.
41 * Neither the name of Intel Corporation nor the names of its
42 contributors may be used to endorse or promote products derived
43 from this software without specific prior written permission.
44
45 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
46 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
47 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
48 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
49 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
50 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
51 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
52 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
53 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
54 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
55 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56
57*/
58
59#ifndef _LINUX_SFI_H
60#define _LINUX_SFI_H
61
62/* Table signatures reserved by the SFI specification */
63#define SFI_SIG_SYST "SYST"
64#define SFI_SIG_FREQ "FREQ"
65#define SFI_SIG_IDLE "IDLE"
66#define SFI_SIG_CPUS "CPUS"
67#define SFI_SIG_MTMR "MTMR"
68#define SFI_SIG_MRTC "MRTC"
69#define SFI_SIG_MMAP "MMAP"
70#define SFI_SIG_APIC "APIC"
71#define SFI_SIG_XSDT "XSDT"
72#define SFI_SIG_WAKE "WAKE"
73#define SFI_SIG_SPIB "SPIB"
74#define SFI_SIG_I2CB "I2CB"
75#define SFI_SIG_GPEM "GPEM"
76
77#define SFI_SIGNATURE_SIZE 4
78#define SFI_OEM_ID_SIZE 6
79#define SFI_OEM_TABLE_ID_SIZE 8
80
81#define SFI_SYST_SEARCH_BEGIN 0x000E0000
82#define SFI_SYST_SEARCH_END 0x000FFFFF
83
84#define SFI_GET_NUM_ENTRIES(ptable, entry_type) \
85 ((ptable->header.len - sizeof(struct sfi_table_header)) / \
86 (sizeof(entry_type)))
87/*
88 * Table structures must be byte-packed to match the SFI specification,
89 * as they are provided by the BIOS.
90 */
91struct sfi_table_header {
92 char sig[SFI_SIGNATURE_SIZE];
93 u32 len;
94 u8 rev;
95 u8 csum;
96 char oem_id[SFI_OEM_ID_SIZE];
97 char oem_table_id[SFI_OEM_TABLE_ID_SIZE];
98} __packed;
99
100struct sfi_table_simple {
101 struct sfi_table_header header;
102 u64 pentry[1];
103} __packed;
104
105/* Comply with UEFI spec 2.1 */
106struct sfi_mem_entry {
107 u32 type;
108 u64 phys_start;
109 u64 virt_start;
110 u64 pages;
111 u64 attrib;
112} __packed;
113
114struct sfi_cpu_table_entry {
115 u32 apic_id;
116} __packed;
117
118struct sfi_cstate_table_entry {
119 u32 hint; /* MWAIT hint */
120 u32 latency; /* latency in ms */
121} __packed;
122
123struct sfi_apic_table_entry {
124 u64 phys_addr; /* phy base addr for APIC reg */
125} __packed;
126
127struct sfi_freq_table_entry {
128 u32 freq_mhz; /* in MHZ */
129 u32 latency; /* transition latency in ms */
130 u32 ctrl_val; /* value to write to PERF_CTL */
131} __packed;
132
133struct sfi_wake_table_entry {
134 u64 phys_addr; /* pointer to where the wake vector locates */
135} __packed;
136
137struct sfi_timer_table_entry {
138 u64 phys_addr; /* phy base addr for the timer */
139 u32 freq_hz; /* in HZ */
140 u32 irq;
141} __packed;
142
143struct sfi_rtc_table_entry {
144 u64 phys_addr; /* phy base addr for the RTC */
145 u32 irq;
146} __packed;
147
148struct sfi_spi_table_entry {
149 u16 host_num; /* attached to host 0, 1...*/
150 u16 cs; /* chip select */
151 u16 irq_info;
152 char name[16];
153 u8 dev_info[10];
154} __packed;
155
156struct sfi_i2c_table_entry {
157 u16 host_num;
158 u16 addr; /* slave addr */
159 u16 irq_info;
160 char name[16];
161 u8 dev_info[10];
162} __packed;
163
164struct sfi_gpe_table_entry {
165 u16 logical_id; /* logical id */
166 u16 phys_id; /* physical GPE id */
167} __packed;
168
169
170typedef int (*sfi_table_handler) (struct sfi_table_header *table);
171
172#ifdef CONFIG_SFI
173extern void __init sfi_init(void);
174extern int __init sfi_platform_init(void);
175extern void __init sfi_init_late(void);
176extern int sfi_table_parse(char *signature, char *oem_id, char *oem_table_id,
177 sfi_table_handler handler);
178
179extern int sfi_disabled;
180static inline void disable_sfi(void)
181{
182 sfi_disabled = 1;
183}
184
185#else /* !CONFIG_SFI */
186
187static inline void sfi_init(void)
188{
189}
190
191static inline void sfi_init_late(void)
192{
193}
194
195#define sfi_disabled 0
196
197static inline int sfi_table_parse(char *signature, char *oem_id,
198 char *oem_table_id,
199 sfi_table_handler handler)
200{
201 return -1;
202}
203
204#endif /* !CONFIG_SFI */
205
206#endif /*_LINUX_SFI_H*/
diff --git a/include/linux/sfi_acpi.h b/include/linux/sfi_acpi.h
new file mode 100644
index 000000000000..c4a5a8cd4469
--- /dev/null
+++ b/include/linux/sfi_acpi.h
@@ -0,0 +1,93 @@
1/* sfi.h Simple Firmware Interface */
2
3/*
4
5 This file is provided under a dual BSD/GPLv2 license. When using or
6 redistributing this file, you may do so under either license.
7
8 GPL LICENSE SUMMARY
9
10 Copyright(c) 2009 Intel Corporation. All rights reserved.
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of version 2 of the GNU General Public License as
14 published by the Free Software Foundation.
15
16 This program is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
24 The full GNU General Public License is included in this distribution
25 in the file called LICENSE.GPL.
26
27 BSD LICENSE
28
29 Copyright(c) 2009 Intel Corporation. All rights reserved.
30
31 Redistribution and use in source and binary forms, with or without
32 modification, are permitted provided that the following conditions
33 are met:
34
35 * Redistributions of source code must retain the above copyright
36 notice, this list of conditions and the following disclaimer.
37 * Redistributions in binary form must reproduce the above copyright
38 notice, this list of conditions and the following disclaimer in
39 the documentation and/or other materials provided with the
40 distribution.
41 * Neither the name of Intel Corporation nor the names of its
42 contributors may be used to endorse or promote products derived
43 from this software without specific prior written permission.
44
45 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
46 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
47 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
48 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
49 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
50 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
51 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
52 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
53 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
54 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
55 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56
57*/
58
59#ifndef _LINUX_SFI_ACPI_H
60#define _LINUX_SFI_ACPI_H
61
62#ifdef CONFIG_SFI
63#include <acpi/acpi.h> /* struct acpi_table_header */
64
65extern int sfi_acpi_table_parse(char *signature, char *oem_id,
66 char *oem_table_id,
67 int (*handler)(struct acpi_table_header *));
68
69static inline int acpi_sfi_table_parse(char *signature,
70 int (*handler)(struct acpi_table_header *))
71{
72 if (!acpi_table_parse(signature, handler))
73 return 0;
74
75 return sfi_acpi_table_parse(signature, NULL, NULL, handler);
76}
77#else /* !CONFIG_SFI */
78
79static inline int sfi_acpi_table_parse(char *signature, char *oem_id,
80 char *oem_table_id,
81 int (*handler)(struct acpi_table_header *))
82{
83 return -1;
84}
85
86static inline int acpi_sfi_table_parse(char *signature,
87 int (*handler)(struct acpi_table_header *))
88{
89 return acpi_table_parse(signature, handler);
90}
91#endif /* !CONFIG_SFI */
92
93#endif /*_LINUX_SFI_ACPI_H*/
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index eb1423a0078d..68e212ff9dde 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -85,7 +85,6 @@ struct intc_desc symbol __initdata = { \
85} 85}
86#endif 86#endif
87 87
88unsigned int intc_evt2irq(unsigned int vector);
89void __init register_intc_controller(struct intc_desc *desc); 88void __init register_intc_controller(struct intc_desc *desc);
90int intc_set_priority(unsigned int irq, unsigned int prio); 89int intc_set_priority(unsigned int irq, unsigned int prio);
91 90
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index abff6c9b413c..deee7afd8d66 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -38,8 +38,11 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
38 return container_of(inode, struct shmem_inode_info, vfs_inode); 38 return container_of(inode, struct shmem_inode_info, vfs_inode);
39} 39}
40 40
41extern int init_tmpfs(void);
42extern int shmem_fill_super(struct super_block *sb, void *data, int silent);
43
41#ifdef CONFIG_TMPFS_POSIX_ACL 44#ifdef CONFIG_TMPFS_POSIX_ACL
42int shmem_permission(struct inode *, int); 45int shmem_check_acl(struct inode *, int);
43int shmem_acl_init(struct inode *, struct inode *); 46int shmem_acl_init(struct inode *, struct inode *);
44 47
45extern struct xattr_handler shmem_xattr_acl_access_handler; 48extern struct xattr_handler shmem_xattr_acl_access_handler;
diff --git a/include/linux/signal.h b/include/linux/signal.h
index c7552836bd95..ab9272cc270c 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -233,6 +233,8 @@ static inline int valid_signal(unsigned long sig)
233} 233}
234 234
235extern int next_signal(struct sigpending *pending, sigset_t *mask); 235extern int next_signal(struct sigpending *pending, sigset_t *mask);
236extern int do_send_sig_info(int sig, struct siginfo *info,
237 struct task_struct *p, bool group);
236extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p); 238extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p);
237extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *); 239extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *);
238extern long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, 240extern long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig,
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index f2c69a2cca17..bcdd6606f468 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -304,7 +304,6 @@ typedef unsigned char *sk_buff_data_t;
304 * @tc_index: Traffic control index 304 * @tc_index: Traffic control index
305 * @tc_verd: traffic control verdict 305 * @tc_verd: traffic control verdict
306 * @ndisc_nodetype: router type (from link layer) 306 * @ndisc_nodetype: router type (from link layer)
307 * @do_not_encrypt: set to prevent encryption of this frame
308 * @dma_cookie: a cookie to one of several possible DMA operations 307 * @dma_cookie: a cookie to one of several possible DMA operations
309 * done by skb DMA functions 308 * done by skb DMA functions
310 * @secmark: security marking 309 * @secmark: security marking
@@ -355,8 +354,8 @@ struct sk_buff {
355 ipvs_property:1, 354 ipvs_property:1,
356 peeked:1, 355 peeked:1,
357 nf_trace:1; 356 nf_trace:1;
357 __be16 protocol:16;
358 kmemcheck_bitfield_end(flags1); 358 kmemcheck_bitfield_end(flags1);
359 __be16 protocol;
360 359
361 void (*destructor)(struct sk_buff *skb); 360 void (*destructor)(struct sk_buff *skb);
362#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 361#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
@@ -368,7 +367,6 @@ struct sk_buff {
368#endif 367#endif
369 368
370 int iif; 369 int iif;
371 __u16 queue_mapping;
372#ifdef CONFIG_NET_SCHED 370#ifdef CONFIG_NET_SCHED
373 __u16 tc_index; /* traffic control index */ 371 __u16 tc_index; /* traffic control index */
374#ifdef CONFIG_NET_CLS_ACT 372#ifdef CONFIG_NET_CLS_ACT
@@ -377,15 +375,13 @@ struct sk_buff {
377#endif 375#endif
378 376
379 kmemcheck_bitfield_begin(flags2); 377 kmemcheck_bitfield_begin(flags2);
378 __u16 queue_mapping:16;
380#ifdef CONFIG_IPV6_NDISC_NODETYPE 379#ifdef CONFIG_IPV6_NDISC_NODETYPE
381 __u8 ndisc_nodetype:2; 380 __u8 ndisc_nodetype:2;
382#endif 381#endif
383#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
384 __u8 do_not_encrypt:1;
385#endif
386 kmemcheck_bitfield_end(flags2); 382 kmemcheck_bitfield_end(flags2);
387 383
388 /* 0/13/14 bit hole */ 384 /* 0/14 bit hole */
389 385
390#ifdef CONFIG_NET_DMA 386#ifdef CONFIG_NET_DMA
391 dma_cookie_t dma_cookie; 387 dma_cookie_t dma_cookie;
@@ -1761,6 +1757,8 @@ extern int skb_copy_datagram_const_iovec(const struct sk_buff *from,
1761 int to_offset, 1757 int to_offset,
1762 int size); 1758 int size);
1763extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 1759extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
1760extern void skb_free_datagram_locked(struct sock *sk,
1761 struct sk_buff *skb);
1764extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, 1762extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
1765 unsigned int flags); 1763 unsigned int flags);
1766extern __wsum skb_checksum(const struct sk_buff *skb, int offset, 1764extern __wsum skb_checksum(const struct sk_buff *skb, int offset,
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
index bb5368df4be8..0ec00b39d006 100644
--- a/include/linux/slob_def.h
+++ b/include/linux/slob_def.h
@@ -34,9 +34,4 @@ static __always_inline void *__kmalloc(size_t size, gfp_t flags)
34 return kmalloc(size, flags); 34 return kmalloc(size, flags);
35} 35}
36 36
37static inline void kmem_cache_init_late(void)
38{
39 /* Nothing to do */
40}
41
42#endif /* __LINUX_SLOB_DEF_H */ 37#endif /* __LINUX_SLOB_DEF_H */
diff --git a/include/linux/slow-work.h b/include/linux/slow-work.h
index b65c8881f07a..13337bf6c3f5 100644
--- a/include/linux/slow-work.h
+++ b/include/linux/slow-work.h
@@ -17,13 +17,20 @@
17#ifdef CONFIG_SLOW_WORK 17#ifdef CONFIG_SLOW_WORK
18 18
19#include <linux/sysctl.h> 19#include <linux/sysctl.h>
20#include <linux/timer.h>
20 21
21struct slow_work; 22struct slow_work;
23#ifdef CONFIG_SLOW_WORK_DEBUG
24struct seq_file;
25#endif
22 26
23/* 27/*
24 * The operations used to support slow work items 28 * The operations used to support slow work items
25 */ 29 */
26struct slow_work_ops { 30struct slow_work_ops {
31 /* owner */
32 struct module *owner;
33
27 /* get a ref on a work item 34 /* get a ref on a work item
28 * - return 0 if successful, -ve if not 35 * - return 0 if successful, -ve if not
29 */ 36 */
@@ -34,6 +41,11 @@ struct slow_work_ops {
34 41
35 /* execute a work item */ 42 /* execute a work item */
36 void (*execute)(struct slow_work *work); 43 void (*execute)(struct slow_work *work);
44
45#ifdef CONFIG_SLOW_WORK_DEBUG
46 /* describe a work item for debugfs */
47 void (*desc)(struct slow_work *work, struct seq_file *m);
48#endif
37}; 49};
38 50
39/* 51/*
@@ -42,13 +54,24 @@ struct slow_work_ops {
42 * queued 54 * queued
43 */ 55 */
44struct slow_work { 56struct slow_work {
57 struct module *owner; /* the owning module */
45 unsigned long flags; 58 unsigned long flags;
46#define SLOW_WORK_PENDING 0 /* item pending (further) execution */ 59#define SLOW_WORK_PENDING 0 /* item pending (further) execution */
47#define SLOW_WORK_EXECUTING 1 /* item currently executing */ 60#define SLOW_WORK_EXECUTING 1 /* item currently executing */
48#define SLOW_WORK_ENQ_DEFERRED 2 /* item enqueue deferred */ 61#define SLOW_WORK_ENQ_DEFERRED 2 /* item enqueue deferred */
49#define SLOW_WORK_VERY_SLOW 3 /* item is very slow */ 62#define SLOW_WORK_VERY_SLOW 3 /* item is very slow */
63#define SLOW_WORK_CANCELLING 4 /* item is being cancelled, don't enqueue */
64#define SLOW_WORK_DELAYED 5 /* item is struct delayed_slow_work with active timer */
50 const struct slow_work_ops *ops; /* operations table for this item */ 65 const struct slow_work_ops *ops; /* operations table for this item */
51 struct list_head link; /* link in queue */ 66 struct list_head link; /* link in queue */
67#ifdef CONFIG_SLOW_WORK_DEBUG
68 struct timespec mark; /* jiffies at which queued or exec begun */
69#endif
70};
71
72struct delayed_slow_work {
73 struct slow_work work;
74 struct timer_list timer;
52}; 75};
53 76
54/** 77/**
@@ -67,6 +90,20 @@ static inline void slow_work_init(struct slow_work *work,
67} 90}
68 91
69/** 92/**
93 * slow_work_init - Initialise a delayed slow work item
94 * @work: The work item to initialise
95 * @ops: The operations to use to handle the slow work item
96 *
97 * Initialise a delayed slow work item.
98 */
99static inline void delayed_slow_work_init(struct delayed_slow_work *dwork,
100 const struct slow_work_ops *ops)
101{
102 init_timer(&dwork->timer);
103 slow_work_init(&dwork->work, ops);
104}
105
106/**
70 * vslow_work_init - Initialise a very slow work item 107 * vslow_work_init - Initialise a very slow work item
71 * @work: The work item to initialise 108 * @work: The work item to initialise
72 * @ops: The operations to use to handle the slow work item 109 * @ops: The operations to use to handle the slow work item
@@ -83,9 +120,40 @@ static inline void vslow_work_init(struct slow_work *work,
83 INIT_LIST_HEAD(&work->link); 120 INIT_LIST_HEAD(&work->link);
84} 121}
85 122
123/**
124 * slow_work_is_queued - Determine if a slow work item is on the work queue
125 * work: The work item to test
126 *
127 * Determine if the specified slow-work item is on the work queue. This
128 * returns true if it is actually on the queue.
129 *
130 * If the item is executing and has been marked for requeue when execution
131 * finishes, then false will be returned.
132 *
133 * Anyone wishing to wait for completion of execution can wait on the
134 * SLOW_WORK_EXECUTING bit.
135 */
136static inline bool slow_work_is_queued(struct slow_work *work)
137{
138 unsigned long flags = work->flags;
139 return flags & SLOW_WORK_PENDING && !(flags & SLOW_WORK_EXECUTING);
140}
141
86extern int slow_work_enqueue(struct slow_work *work); 142extern int slow_work_enqueue(struct slow_work *work);
87extern int slow_work_register_user(void); 143extern void slow_work_cancel(struct slow_work *work);
88extern void slow_work_unregister_user(void); 144extern int slow_work_register_user(struct module *owner);
145extern void slow_work_unregister_user(struct module *owner);
146
147extern int delayed_slow_work_enqueue(struct delayed_slow_work *dwork,
148 unsigned long delay);
149
150static inline void delayed_slow_work_cancel(struct delayed_slow_work *dwork)
151{
152 slow_work_cancel(&dwork->work);
153}
154
155extern bool slow_work_sleep_till_thread_needed(struct slow_work *work,
156 signed long *_timeout);
89 157
90#ifdef CONFIG_SYSCTL 158#ifdef CONFIG_SYSCTL
91extern ctl_table slow_work_sysctls[]; 159extern ctl_table slow_work_sysctls[];
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index c1c862b1d01a..5ad70a60fd74 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -153,12 +153,10 @@ static __always_inline int kmalloc_index(size_t size)
153 if (size <= KMALLOC_MIN_SIZE) 153 if (size <= KMALLOC_MIN_SIZE)
154 return KMALLOC_SHIFT_LOW; 154 return KMALLOC_SHIFT_LOW;
155 155
156#if KMALLOC_MIN_SIZE <= 64 156 if (KMALLOC_MIN_SIZE <= 32 && size > 64 && size <= 96)
157 if (size > 64 && size <= 96)
158 return 1; 157 return 1;
159 if (size > 128 && size <= 192) 158 if (KMALLOC_MIN_SIZE <= 64 && size > 128 && size <= 192)
160 return 2; 159 return 2;
161#endif
162 if (size <= 8) return 3; 160 if (size <= 8) return 3;
163 if (size <= 16) return 4; 161 if (size <= 16) return 4;
164 if (size <= 32) return 5; 162 if (size <= 32) return 5;
@@ -304,6 +302,4 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
304} 302}
305#endif 303#endif
306 304
307void __init kmem_cache_init_late(void);
308
309#endif /* _LINUX_SLUB_DEF_H */ 305#endif /* _LINUX_SLUB_DEF_H */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 9e3d8af09207..39c64bae776d 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -73,15 +73,6 @@ int smp_call_function(void(*func)(void *info), void *info, int wait);
73void smp_call_function_many(const struct cpumask *mask, 73void smp_call_function_many(const struct cpumask *mask,
74 void (*func)(void *info), void *info, bool wait); 74 void (*func)(void *info), void *info, bool wait);
75 75
76/* Deprecated: Use smp_call_function_many which takes a pointer to the mask. */
77static inline int
78smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info,
79 int wait)
80{
81 smp_call_function_many(&mask, func, info, wait);
82 return 0;
83}
84
85void __smp_call_function_single(int cpuid, struct call_single_data *data, 76void __smp_call_function_single(int cpuid, struct call_single_data *data,
86 int wait); 77 int wait);
87 78
@@ -144,8 +135,6 @@ static inline int up_smp_call_function(void (*func)(void *), void *info)
144static inline void smp_send_reschedule(int cpu) { } 135static inline void smp_send_reschedule(int cpu) { }
145#define num_booting_cpus() 1 136#define num_booting_cpus() 1
146#define smp_prepare_boot_cpu() do {} while (0) 137#define smp_prepare_boot_cpu() do {} while (0)
147#define smp_call_function_mask(mask, func, info, wait) \
148 (up_smp_call_function(func, info))
149#define smp_call_function_many(mask, func, info, wait) \ 138#define smp_call_function_many(mask, func, info, wait) \
150 (up_smp_call_function(func, info)) 139 (up_smp_call_function(func, info))
151static inline void init_call_single_data(void) 140static inline void init_call_single_data(void)
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 3b461dffe244..3273a0c5043b 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -16,7 +16,7 @@ struct __kernel_sockaddr_storage {
16 /* _SS_MAXSIZE value minus size of ss_family */ 16 /* _SS_MAXSIZE value minus size of ss_family */
17} __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */ 17} __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */
18 18
19#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) 19#ifdef __KERNEL__
20 20
21#include <asm/socket.h> /* arch-dependent defines */ 21#include <asm/socket.h> /* arch-dependent defines */
22#include <linux/sockios.h> /* the SIOCxxx I/O controls */ 22#include <linux/sockios.h> /* the SIOCxxx I/O controls */
@@ -101,21 +101,6 @@ struct cmsghdr {
101 ((char *)(cmsg) - (char *)(mhdr)->msg_control))) 101 ((char *)(cmsg) - (char *)(mhdr)->msg_control)))
102 102
103/* 103/*
104 * This mess will go away with glibc
105 */
106
107#ifdef __KERNEL__
108#define __KINLINE static inline
109#elif defined(__GNUC__)
110#define __KINLINE static __inline__
111#elif defined(__cplusplus)
112#define __KINLINE static inline
113#else
114#define __KINLINE static
115#endif
116
117
118/*
119 * Get the next cmsg header 104 * Get the next cmsg header
120 * 105 *
121 * PLEASE, do not touch this function. If you think, that it is 106 * PLEASE, do not touch this function. If you think, that it is
@@ -128,7 +113,7 @@ struct cmsghdr {
128 * ancillary object DATA. --ANK (980731) 113 * ancillary object DATA. --ANK (980731)
129 */ 114 */
130 115
131__KINLINE struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size, 116static inline struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size,
132 struct cmsghdr *__cmsg) 117 struct cmsghdr *__cmsg)
133{ 118{
134 struct cmsghdr * __ptr; 119 struct cmsghdr * __ptr;
@@ -140,7 +125,7 @@ __KINLINE struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size,
140 return __ptr; 125 return __ptr;
141} 126}
142 127
143__KINLINE struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg) 128static inline struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg)
144{ 129{
145 return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg); 130 return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
146} 131}
diff --git a/include/linux/spi/lms283gf05.h b/include/linux/spi/lms283gf05.h
new file mode 100644
index 000000000000..555d254e6606
--- /dev/null
+++ b/include/linux/spi/lms283gf05.h
@@ -0,0 +1,28 @@
1/*
2 * lms283gf05.h - Platform glue for Samsung LMS283GF05 LCD
3 *
4 * Copyright (C) 2009 Marek Vasut <marek.vasut@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19
20#ifndef _INCLUDE_LINUX_SPI_LMS283GF05_H_
21#define _INCLUDE_LINUX_SPI_LMS283GF05_H_
22
23struct lms283gf05_pdata {
24 unsigned long reset_gpio;
25 bool reset_inverted;
26};
27
28#endif /* _INCLUDE_LINUX_SPI_LMS283GF05_H_ */
diff --git a/include/linux/spi/mc33880.h b/include/linux/spi/mc33880.h
new file mode 100644
index 000000000000..82ffccd6fbe5
--- /dev/null
+++ b/include/linux/spi/mc33880.h
@@ -0,0 +1,10 @@
1#ifndef LINUX_SPI_MC33880_H
2#define LINUX_SPI_MC33880_H
3
4struct mc33880_platform_data {
5 /* number assigned to the first GPIO */
6 unsigned base;
7};
8
9#endif
10
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index c47c4b4da97e..97b60b37f445 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -20,6 +20,7 @@
20#define __LINUX_SPI_H 20#define __LINUX_SPI_H
21 21
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/mod_devicetable.h>
23 24
24/* 25/*
25 * INTERFACES between SPI master-side drivers and SPI infrastructure. 26 * INTERFACES between SPI master-side drivers and SPI infrastructure.
@@ -86,7 +87,7 @@ struct spi_device {
86 int irq; 87 int irq;
87 void *controller_state; 88 void *controller_state;
88 void *controller_data; 89 void *controller_data;
89 char modalias[32]; 90 char modalias[SPI_NAME_SIZE];
90 91
91 /* 92 /*
92 * likely need more hooks for more protocol options affecting how 93 * likely need more hooks for more protocol options affecting how
@@ -145,6 +146,7 @@ struct spi_message;
145 146
146/** 147/**
147 * struct spi_driver - Host side "protocol" driver 148 * struct spi_driver - Host side "protocol" driver
149 * @id_table: List of SPI devices supported by this driver
148 * @probe: Binds this driver to the spi device. Drivers can verify 150 * @probe: Binds this driver to the spi device. Drivers can verify
149 * that the device is actually present, and may need to configure 151 * that the device is actually present, and may need to configure
150 * characteristics (such as bits_per_word) which weren't needed for 152 * characteristics (such as bits_per_word) which weren't needed for
@@ -170,6 +172,7 @@ struct spi_message;
170 * MMC, RTC, filesystem character device nodes, and hardware monitoring. 172 * MMC, RTC, filesystem character device nodes, and hardware monitoring.
171 */ 173 */
172struct spi_driver { 174struct spi_driver {
175 const struct spi_device_id *id_table;
173 int (*probe)(struct spi_device *spi); 176 int (*probe)(struct spi_device *spi);
174 int (*remove)(struct spi_device *spi); 177 int (*remove)(struct spi_device *spi);
175 void (*shutdown)(struct spi_device *spi); 178 void (*shutdown)(struct spi_device *spi);
@@ -207,6 +210,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
207 * each slave has a chipselect signal, but it's common that not 210 * each slave has a chipselect signal, but it's common that not
208 * every chipselect is connected to a slave. 211 * every chipselect is connected to a slave.
209 * @dma_alignment: SPI controller constraint on DMA buffers alignment. 212 * @dma_alignment: SPI controller constraint on DMA buffers alignment.
213 * @mode_bits: flags understood by this controller driver
214 * @flags: other constraints relevant to this driver
210 * @setup: updates the device mode and clocking records used by a 215 * @setup: updates the device mode and clocking records used by a
211 * device's SPI controller; protocol code may call this. This 216 * device's SPI controller; protocol code may call this. This
212 * must fail if an unrecognized or unsupported mode is requested. 217 * must fail if an unrecognized or unsupported mode is requested.
@@ -253,6 +258,8 @@ struct spi_master {
253 /* other constraints relevant to this driver */ 258 /* other constraints relevant to this driver */
254 u16 flags; 259 u16 flags;
255#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */ 260#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */
261#define SPI_MASTER_NO_RX BIT(1) /* can't do buffer read */
262#define SPI_MASTER_NO_TX BIT(2) /* can't do buffer write */
256 263
257 /* Setup mode and clock, etc (spi driver may call many times). 264 /* Setup mode and clock, etc (spi driver may call many times).
258 * 265 *
@@ -533,42 +540,7 @@ static inline void spi_message_free(struct spi_message *m)
533} 540}
534 541
535extern int spi_setup(struct spi_device *spi); 542extern int spi_setup(struct spi_device *spi);
536 543extern int spi_async(struct spi_device *spi, struct spi_message *message);
537/**
538 * spi_async - asynchronous SPI transfer
539 * @spi: device with which data will be exchanged
540 * @message: describes the data transfers, including completion callback
541 * Context: any (irqs may be blocked, etc)
542 *
543 * This call may be used in_irq and other contexts which can't sleep,
544 * as well as from task contexts which can sleep.
545 *
546 * The completion callback is invoked in a context which can't sleep.
547 * Before that invocation, the value of message->status is undefined.
548 * When the callback is issued, message->status holds either zero (to
549 * indicate complete success) or a negative error code. After that
550 * callback returns, the driver which issued the transfer request may
551 * deallocate the associated memory; it's no longer in use by any SPI
552 * core or controller driver code.
553 *
554 * Note that although all messages to a spi_device are handled in
555 * FIFO order, messages may go to different devices in other orders.
556 * Some device might be higher priority, or have various "hard" access
557 * time requirements, for example.
558 *
559 * On detection of any fault during the transfer, processing of
560 * the entire message is aborted, and the device is deselected.
561 * Until returning from the associated message completion callback,
562 * no other spi_message queued to that device will be processed.
563 * (This rule applies equally to all the synchronous transfer calls,
564 * which are wrappers around this core asynchronous primitive.)
565 */
566static inline int
567spi_async(struct spi_device *spi, struct spi_message *message)
568{
569 message->spi = spi;
570 return spi->master->transfer(spi, message);
571}
572 544
573/*---------------------------------------------------------------------------*/ 545/*---------------------------------------------------------------------------*/
574 546
@@ -732,7 +704,7 @@ struct spi_board_info {
732 * controller_data goes to spi_device.controller_data, 704 * controller_data goes to spi_device.controller_data,
733 * irq is copied too 705 * irq is copied too
734 */ 706 */
735 char modalias[32]; 707 char modalias[SPI_NAME_SIZE];
736 const void *platform_data; 708 const void *platform_data;
737 void *controller_data; 709 void *controller_data;
738 int irq; 710 int irq;
@@ -800,4 +772,7 @@ spi_unregister_device(struct spi_device *spi)
800 device_unregister(&spi->dev); 772 device_unregister(&spi->dev);
801} 773}
802 774
775extern const struct spi_device_id *
776spi_get_device_id(const struct spi_device *sdev);
777
803#endif /* __LINUX_SPI_H */ 778#endif /* __LINUX_SPI_H */
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 4be57ab03478..f0ca7a7a1757 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -143,15 +143,6 @@ static inline void smp_mb__after_lock(void) { smp_mb(); }
143 */ 143 */
144#define spin_unlock_wait(lock) __raw_spin_unlock_wait(&(lock)->raw_lock) 144#define spin_unlock_wait(lock) __raw_spin_unlock_wait(&(lock)->raw_lock)
145 145
146/*
147 * Pull the _spin_*()/_read_*()/_write_*() functions/declarations:
148 */
149#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
150# include <linux/spinlock_api_smp.h>
151#else
152# include <linux/spinlock_api_up.h>
153#endif
154
155#ifdef CONFIG_DEBUG_SPINLOCK 146#ifdef CONFIG_DEBUG_SPINLOCK
156 extern void _raw_spin_lock(spinlock_t *lock); 147 extern void _raw_spin_lock(spinlock_t *lock);
157#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) 148#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
@@ -268,50 +259,16 @@ static inline void smp_mb__after_lock(void) { smp_mb(); }
268 259
269#define spin_lock_irq(lock) _spin_lock_irq(lock) 260#define spin_lock_irq(lock) _spin_lock_irq(lock)
270#define spin_lock_bh(lock) _spin_lock_bh(lock) 261#define spin_lock_bh(lock) _spin_lock_bh(lock)
271
272#define read_lock_irq(lock) _read_lock_irq(lock) 262#define read_lock_irq(lock) _read_lock_irq(lock)
273#define read_lock_bh(lock) _read_lock_bh(lock) 263#define read_lock_bh(lock) _read_lock_bh(lock)
274
275#define write_lock_irq(lock) _write_lock_irq(lock) 264#define write_lock_irq(lock) _write_lock_irq(lock)
276#define write_lock_bh(lock) _write_lock_bh(lock) 265#define write_lock_bh(lock) _write_lock_bh(lock)
277 266#define spin_unlock(lock) _spin_unlock(lock)
278/* 267#define read_unlock(lock) _read_unlock(lock)
279 * We inline the unlock functions in the nondebug case: 268#define write_unlock(lock) _write_unlock(lock)
280 */ 269#define spin_unlock_irq(lock) _spin_unlock_irq(lock)
281#if defined(CONFIG_DEBUG_SPINLOCK) || defined(CONFIG_PREEMPT) || \ 270#define read_unlock_irq(lock) _read_unlock_irq(lock)
282 !defined(CONFIG_SMP) 271#define write_unlock_irq(lock) _write_unlock_irq(lock)
283# define spin_unlock(lock) _spin_unlock(lock)
284# define read_unlock(lock) _read_unlock(lock)
285# define write_unlock(lock) _write_unlock(lock)
286# define spin_unlock_irq(lock) _spin_unlock_irq(lock)
287# define read_unlock_irq(lock) _read_unlock_irq(lock)
288# define write_unlock_irq(lock) _write_unlock_irq(lock)
289#else
290# define spin_unlock(lock) \
291 do {__raw_spin_unlock(&(lock)->raw_lock); __release(lock); } while (0)
292# define read_unlock(lock) \
293 do {__raw_read_unlock(&(lock)->raw_lock); __release(lock); } while (0)
294# define write_unlock(lock) \
295 do {__raw_write_unlock(&(lock)->raw_lock); __release(lock); } while (0)
296# define spin_unlock_irq(lock) \
297do { \
298 __raw_spin_unlock(&(lock)->raw_lock); \
299 __release(lock); \
300 local_irq_enable(); \
301} while (0)
302# define read_unlock_irq(lock) \
303do { \
304 __raw_read_unlock(&(lock)->raw_lock); \
305 __release(lock); \
306 local_irq_enable(); \
307} while (0)
308# define write_unlock_irq(lock) \
309do { \
310 __raw_write_unlock(&(lock)->raw_lock); \
311 __release(lock); \
312 local_irq_enable(); \
313} while (0)
314#endif
315 272
316#define spin_unlock_irqrestore(lock, flags) \ 273#define spin_unlock_irqrestore(lock, flags) \
317 do { \ 274 do { \
@@ -380,4 +337,13 @@ extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock);
380 */ 337 */
381#define spin_can_lock(lock) (!spin_is_locked(lock)) 338#define spin_can_lock(lock) (!spin_is_locked(lock))
382 339
340/*
341 * Pull the _spin_*()/_read_*()/_write_*() functions/declarations:
342 */
343#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
344# include <linux/spinlock_api_smp.h>
345#else
346# include <linux/spinlock_api_up.h>
347#endif
348
383#endif /* __LINUX_SPINLOCK_H */ 349#endif /* __LINUX_SPINLOCK_H */
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
index d79845d034b5..7a7e18fc2415 100644
--- a/include/linux/spinlock_api_smp.h
+++ b/include/linux/spinlock_api_smp.h
@@ -60,4 +60,398 @@ void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
60void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) 60void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
61 __releases(lock); 61 __releases(lock);
62 62
63/*
64 * We inline the unlock functions in the nondebug case:
65 */
66#if !defined(CONFIG_DEBUG_SPINLOCK) && !defined(CONFIG_PREEMPT)
67#define __always_inline__spin_unlock
68#define __always_inline__read_unlock
69#define __always_inline__write_unlock
70#define __always_inline__spin_unlock_irq
71#define __always_inline__read_unlock_irq
72#define __always_inline__write_unlock_irq
73#endif
74
75#ifndef CONFIG_DEBUG_SPINLOCK
76#ifndef CONFIG_GENERIC_LOCKBREAK
77
78#ifdef __always_inline__spin_lock
79#define _spin_lock(lock) __spin_lock(lock)
80#endif
81
82#ifdef __always_inline__read_lock
83#define _read_lock(lock) __read_lock(lock)
84#endif
85
86#ifdef __always_inline__write_lock
87#define _write_lock(lock) __write_lock(lock)
88#endif
89
90#ifdef __always_inline__spin_lock_bh
91#define _spin_lock_bh(lock) __spin_lock_bh(lock)
92#endif
93
94#ifdef __always_inline__read_lock_bh
95#define _read_lock_bh(lock) __read_lock_bh(lock)
96#endif
97
98#ifdef __always_inline__write_lock_bh
99#define _write_lock_bh(lock) __write_lock_bh(lock)
100#endif
101
102#ifdef __always_inline__spin_lock_irq
103#define _spin_lock_irq(lock) __spin_lock_irq(lock)
104#endif
105
106#ifdef __always_inline__read_lock_irq
107#define _read_lock_irq(lock) __read_lock_irq(lock)
108#endif
109
110#ifdef __always_inline__write_lock_irq
111#define _write_lock_irq(lock) __write_lock_irq(lock)
112#endif
113
114#ifdef __always_inline__spin_lock_irqsave
115#define _spin_lock_irqsave(lock) __spin_lock_irqsave(lock)
116#endif
117
118#ifdef __always_inline__read_lock_irqsave
119#define _read_lock_irqsave(lock) __read_lock_irqsave(lock)
120#endif
121
122#ifdef __always_inline__write_lock_irqsave
123#define _write_lock_irqsave(lock) __write_lock_irqsave(lock)
124#endif
125
126#endif /* !CONFIG_GENERIC_LOCKBREAK */
127
128#ifdef __always_inline__spin_trylock
129#define _spin_trylock(lock) __spin_trylock(lock)
130#endif
131
132#ifdef __always_inline__read_trylock
133#define _read_trylock(lock) __read_trylock(lock)
134#endif
135
136#ifdef __always_inline__write_trylock
137#define _write_trylock(lock) __write_trylock(lock)
138#endif
139
140#ifdef __always_inline__spin_trylock_bh
141#define _spin_trylock_bh(lock) __spin_trylock_bh(lock)
142#endif
143
144#ifdef __always_inline__spin_unlock
145#define _spin_unlock(lock) __spin_unlock(lock)
146#endif
147
148#ifdef __always_inline__read_unlock
149#define _read_unlock(lock) __read_unlock(lock)
150#endif
151
152#ifdef __always_inline__write_unlock
153#define _write_unlock(lock) __write_unlock(lock)
154#endif
155
156#ifdef __always_inline__spin_unlock_bh
157#define _spin_unlock_bh(lock) __spin_unlock_bh(lock)
158#endif
159
160#ifdef __always_inline__read_unlock_bh
161#define _read_unlock_bh(lock) __read_unlock_bh(lock)
162#endif
163
164#ifdef __always_inline__write_unlock_bh
165#define _write_unlock_bh(lock) __write_unlock_bh(lock)
166#endif
167
168#ifdef __always_inline__spin_unlock_irq
169#define _spin_unlock_irq(lock) __spin_unlock_irq(lock)
170#endif
171
172#ifdef __always_inline__read_unlock_irq
173#define _read_unlock_irq(lock) __read_unlock_irq(lock)
174#endif
175
176#ifdef __always_inline__write_unlock_irq
177#define _write_unlock_irq(lock) __write_unlock_irq(lock)
178#endif
179
180#ifdef __always_inline__spin_unlock_irqrestore
181#define _spin_unlock_irqrestore(lock, flags) __spin_unlock_irqrestore(lock, flags)
182#endif
183
184#ifdef __always_inline__read_unlock_irqrestore
185#define _read_unlock_irqrestore(lock, flags) __read_unlock_irqrestore(lock, flags)
186#endif
187
188#ifdef __always_inline__write_unlock_irqrestore
189#define _write_unlock_irqrestore(lock, flags) __write_unlock_irqrestore(lock, flags)
190#endif
191
192#endif /* CONFIG_DEBUG_SPINLOCK */
193
194static inline int __spin_trylock(spinlock_t *lock)
195{
196 preempt_disable();
197 if (_raw_spin_trylock(lock)) {
198 spin_acquire(&lock->dep_map, 0, 1, _RET_IP_);
199 return 1;
200 }
201 preempt_enable();
202 return 0;
203}
204
205static inline int __read_trylock(rwlock_t *lock)
206{
207 preempt_disable();
208 if (_raw_read_trylock(lock)) {
209 rwlock_acquire_read(&lock->dep_map, 0, 1, _RET_IP_);
210 return 1;
211 }
212 preempt_enable();
213 return 0;
214}
215
216static inline int __write_trylock(rwlock_t *lock)
217{
218 preempt_disable();
219 if (_raw_write_trylock(lock)) {
220 rwlock_acquire(&lock->dep_map, 0, 1, _RET_IP_);
221 return 1;
222 }
223 preempt_enable();
224 return 0;
225}
226
227/*
228 * If lockdep is enabled then we use the non-preemption spin-ops
229 * even on CONFIG_PREEMPT, because lockdep assumes that interrupts are
230 * not re-enabled during lock-acquire (which the preempt-spin-ops do):
231 */
232#if !defined(CONFIG_GENERIC_LOCKBREAK) || defined(CONFIG_DEBUG_LOCK_ALLOC)
233
234static inline void __read_lock(rwlock_t *lock)
235{
236 preempt_disable();
237 rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
238 LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock);
239}
240
241static inline unsigned long __spin_lock_irqsave(spinlock_t *lock)
242{
243 unsigned long flags;
244
245 local_irq_save(flags);
246 preempt_disable();
247 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
248 /*
249 * On lockdep we dont want the hand-coded irq-enable of
250 * _raw_spin_lock_flags() code, because lockdep assumes
251 * that interrupts are not re-enabled during lock-acquire:
252 */
253#ifdef CONFIG_LOCKDEP
254 LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
255#else
256 _raw_spin_lock_flags(lock, &flags);
257#endif
258 return flags;
259}
260
261static inline void __spin_lock_irq(spinlock_t *lock)
262{
263 local_irq_disable();
264 preempt_disable();
265 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
266 LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
267}
268
269static inline void __spin_lock_bh(spinlock_t *lock)
270{
271 local_bh_disable();
272 preempt_disable();
273 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
274 LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
275}
276
277static inline unsigned long __read_lock_irqsave(rwlock_t *lock)
278{
279 unsigned long flags;
280
281 local_irq_save(flags);
282 preempt_disable();
283 rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
284 LOCK_CONTENDED_FLAGS(lock, _raw_read_trylock, _raw_read_lock,
285 _raw_read_lock_flags, &flags);
286 return flags;
287}
288
289static inline void __read_lock_irq(rwlock_t *lock)
290{
291 local_irq_disable();
292 preempt_disable();
293 rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
294 LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock);
295}
296
297static inline void __read_lock_bh(rwlock_t *lock)
298{
299 local_bh_disable();
300 preempt_disable();
301 rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
302 LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock);
303}
304
305static inline unsigned long __write_lock_irqsave(rwlock_t *lock)
306{
307 unsigned long flags;
308
309 local_irq_save(flags);
310 preempt_disable();
311 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
312 LOCK_CONTENDED_FLAGS(lock, _raw_write_trylock, _raw_write_lock,
313 _raw_write_lock_flags, &flags);
314 return flags;
315}
316
317static inline void __write_lock_irq(rwlock_t *lock)
318{
319 local_irq_disable();
320 preempt_disable();
321 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
322 LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock);
323}
324
325static inline void __write_lock_bh(rwlock_t *lock)
326{
327 local_bh_disable();
328 preempt_disable();
329 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
330 LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock);
331}
332
333static inline void __spin_lock(spinlock_t *lock)
334{
335 preempt_disable();
336 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
337 LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
338}
339
340static inline void __write_lock(rwlock_t *lock)
341{
342 preempt_disable();
343 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
344 LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock);
345}
346
347#endif /* CONFIG_PREEMPT */
348
349static inline void __spin_unlock(spinlock_t *lock)
350{
351 spin_release(&lock->dep_map, 1, _RET_IP_);
352 _raw_spin_unlock(lock);
353 preempt_enable();
354}
355
356static inline void __write_unlock(rwlock_t *lock)
357{
358 rwlock_release(&lock->dep_map, 1, _RET_IP_);
359 _raw_write_unlock(lock);
360 preempt_enable();
361}
362
363static inline void __read_unlock(rwlock_t *lock)
364{
365 rwlock_release(&lock->dep_map, 1, _RET_IP_);
366 _raw_read_unlock(lock);
367 preempt_enable();
368}
369
370static inline void __spin_unlock_irqrestore(spinlock_t *lock,
371 unsigned long flags)
372{
373 spin_release(&lock->dep_map, 1, _RET_IP_);
374 _raw_spin_unlock(lock);
375 local_irq_restore(flags);
376 preempt_enable();
377}
378
379static inline void __spin_unlock_irq(spinlock_t *lock)
380{
381 spin_release(&lock->dep_map, 1, _RET_IP_);
382 _raw_spin_unlock(lock);
383 local_irq_enable();
384 preempt_enable();
385}
386
387static inline void __spin_unlock_bh(spinlock_t *lock)
388{
389 spin_release(&lock->dep_map, 1, _RET_IP_);
390 _raw_spin_unlock(lock);
391 preempt_enable_no_resched();
392 local_bh_enable_ip((unsigned long)__builtin_return_address(0));
393}
394
395static inline void __read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
396{
397 rwlock_release(&lock->dep_map, 1, _RET_IP_);
398 _raw_read_unlock(lock);
399 local_irq_restore(flags);
400 preempt_enable();
401}
402
403static inline void __read_unlock_irq(rwlock_t *lock)
404{
405 rwlock_release(&lock->dep_map, 1, _RET_IP_);
406 _raw_read_unlock(lock);
407 local_irq_enable();
408 preempt_enable();
409}
410
411static inline void __read_unlock_bh(rwlock_t *lock)
412{
413 rwlock_release(&lock->dep_map, 1, _RET_IP_);
414 _raw_read_unlock(lock);
415 preempt_enable_no_resched();
416 local_bh_enable_ip((unsigned long)__builtin_return_address(0));
417}
418
419static inline void __write_unlock_irqrestore(rwlock_t *lock,
420 unsigned long flags)
421{
422 rwlock_release(&lock->dep_map, 1, _RET_IP_);
423 _raw_write_unlock(lock);
424 local_irq_restore(flags);
425 preempt_enable();
426}
427
428static inline void __write_unlock_irq(rwlock_t *lock)
429{
430 rwlock_release(&lock->dep_map, 1, _RET_IP_);
431 _raw_write_unlock(lock);
432 local_irq_enable();
433 preempt_enable();
434}
435
436static inline void __write_unlock_bh(rwlock_t *lock)
437{
438 rwlock_release(&lock->dep_map, 1, _RET_IP_);
439 _raw_write_unlock(lock);
440 preempt_enable_no_resched();
441 local_bh_enable_ip((unsigned long)__builtin_return_address(0));
442}
443
444static inline int __spin_trylock_bh(spinlock_t *lock)
445{
446 local_bh_disable();
447 preempt_disable();
448 if (_raw_spin_trylock(lock)) {
449 spin_acquire(&lock->dep_map, 0, 1, _RET_IP_);
450 return 1;
451 }
452 preempt_enable_no_resched();
453 local_bh_enable_ip((unsigned long)__builtin_return_address(0));
454 return 0;
455}
456
63#endif /* __LINUX_SPINLOCK_API_SMP_H */ 457#endif /* __LINUX_SPINLOCK_API_SMP_H */
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 5ae8fa22d331..3d0a9ff24f01 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -27,24 +27,54 @@ struct ssb_sprom {
27 u8 et1mdcport; /* MDIO for enet1 */ 27 u8 et1mdcport; /* MDIO for enet1 */
28 u8 board_rev; /* Board revision number from SPROM. */ 28 u8 board_rev; /* Board revision number from SPROM. */
29 u8 country_code; /* Country Code */ 29 u8 country_code; /* Country Code */
30 u8 ant_available_a; /* A-PHY antenna available bits (up to 4) */ 30 u8 ant_available_a; /* 2GHz antenna available bits (up to 4) */
31 u8 ant_available_bg; /* B/G-PHY antenna available bits (up to 4) */ 31 u8 ant_available_bg; /* 5GHz antenna available bits (up to 4) */
32 u16 pa0b0; 32 u16 pa0b0;
33 u16 pa0b1; 33 u16 pa0b1;
34 u16 pa0b2; 34 u16 pa0b2;
35 u16 pa1b0; 35 u16 pa1b0;
36 u16 pa1b1; 36 u16 pa1b1;
37 u16 pa1b2; 37 u16 pa1b2;
38 u16 pa1lob0;
39 u16 pa1lob1;
40 u16 pa1lob2;
41 u16 pa1hib0;
42 u16 pa1hib1;
43 u16 pa1hib2;
38 u8 gpio0; /* GPIO pin 0 */ 44 u8 gpio0; /* GPIO pin 0 */
39 u8 gpio1; /* GPIO pin 1 */ 45 u8 gpio1; /* GPIO pin 1 */
40 u8 gpio2; /* GPIO pin 2 */ 46 u8 gpio2; /* GPIO pin 2 */
41 u8 gpio3; /* GPIO pin 3 */ 47 u8 gpio3; /* GPIO pin 3 */
42 u16 maxpwr_a; /* A-PHY Amplifier Max Power (in dBm Q5.2) */ 48 u16 maxpwr_bg; /* 2.4GHz Amplifier Max Power (in dBm Q5.2) */
43 u16 maxpwr_bg; /* B/G-PHY Amplifier Max Power (in dBm Q5.2) */ 49 u16 maxpwr_al; /* 5.2GHz Amplifier Max Power (in dBm Q5.2) */
50 u16 maxpwr_a; /* 5.3GHz Amplifier Max Power (in dBm Q5.2) */
51 u16 maxpwr_ah; /* 5.8GHz Amplifier Max Power (in dBm Q5.2) */
44 u8 itssi_a; /* Idle TSSI Target for A-PHY */ 52 u8 itssi_a; /* Idle TSSI Target for A-PHY */
45 u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */ 53 u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */
46 u16 boardflags_lo; /* Boardflags (low 16 bits) */ 54 u8 tri2g; /* 2.4GHz TX isolation */
47 u16 boardflags_hi; /* Boardflags (high 16 bits) */ 55 u8 tri5gl; /* 5.2GHz TX isolation */
56 u8 tri5g; /* 5.3GHz TX isolation */
57 u8 tri5gh; /* 5.8GHz TX isolation */
58 u8 rxpo2g; /* 2GHz RX power offset */
59 u8 rxpo5g; /* 5GHz RX power offset */
60 u8 rssisav2g; /* 2GHz RSSI params */
61 u8 rssismc2g;
62 u8 rssismf2g;
63 u8 bxa2g; /* 2GHz BX arch */
64 u8 rssisav5g; /* 5GHz RSSI params */
65 u8 rssismc5g;
66 u8 rssismf5g;
67 u8 bxa5g; /* 5GHz BX arch */
68 u16 cck2gpo; /* CCK power offset */
69 u32 ofdm2gpo; /* 2.4GHz OFDM power offset */
70 u32 ofdm5glpo; /* 5.2GHz OFDM power offset */
71 u32 ofdm5gpo; /* 5.3GHz OFDM power offset */
72 u32 ofdm5ghpo; /* 5.8GHz OFDM power offset */
73 u16 boardflags_lo; /* Board flags (bits 0-15) */
74 u16 boardflags_hi; /* Board flags (bits 16-31) */
75 u16 boardflags2_lo; /* Board flags (bits 32-47) */
76 u16 boardflags2_hi; /* Board flags (bits 48-63) */
77 /* TODO store board flags in a single u64 */
48 78
49 /* Antenna gain values for up to 4 antennas 79 /* Antenna gain values for up to 4 antennas
50 * on each band. Values in dBm/4 (Q5.2). Negative gain means the 80 * on each band. Values in dBm/4 (Q5.2). Negative gain means the
@@ -58,7 +88,7 @@ struct ssb_sprom {
58 } ghz5; /* 5GHz band */ 88 } ghz5; /* 5GHz band */
59 } antenna_gain; 89 } antenna_gain;
60 90
61 /* TODO - add any parameters needed from rev 2, 3, or 4 SPROMs */ 91 /* TODO - add any parameters needed from rev 2, 3, 4, 5 or 8 SPROMs */
62}; 92};
63 93
64/* Information about the PCB the circuitry is soldered on. */ 94/* Information about the PCB the circuitry is soldered on. */
@@ -208,6 +238,7 @@ enum ssb_bustype {
208 SSB_BUSTYPE_SSB, /* This SSB bus is the system bus */ 238 SSB_BUSTYPE_SSB, /* This SSB bus is the system bus */
209 SSB_BUSTYPE_PCI, /* SSB is connected to PCI bus */ 239 SSB_BUSTYPE_PCI, /* SSB is connected to PCI bus */
210 SSB_BUSTYPE_PCMCIA, /* SSB is connected to PCMCIA bus */ 240 SSB_BUSTYPE_PCMCIA, /* SSB is connected to PCMCIA bus */
241 SSB_BUSTYPE_SDIO, /* SSB is connected to SDIO bus */
211}; 242};
212 243
213/* board_vendor */ 244/* board_vendor */
@@ -240,8 +271,12 @@ struct ssb_bus {
240 271
241 /* The core in the basic address register window. (PCI bus only) */ 272 /* The core in the basic address register window. (PCI bus only) */
242 struct ssb_device *mapped_device; 273 struct ssb_device *mapped_device;
243 /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */ 274 union {
244 u8 mapped_pcmcia_seg; 275 /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */
276 u8 mapped_pcmcia_seg;
277 /* Current SSB base address window for SDIO. */
278 u32 sdio_sbaddr;
279 };
245 /* Lock for core and segment switching. 280 /* Lock for core and segment switching.
246 * On PCMCIA-host busses this is used to protect the whole MMIO access. */ 281 * On PCMCIA-host busses this is used to protect the whole MMIO access. */
247 spinlock_t bar_lock; 282 spinlock_t bar_lock;
@@ -252,6 +287,11 @@ struct ssb_bus {
252 struct pci_dev *host_pci; 287 struct pci_dev *host_pci;
253 /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */ 288 /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */
254 struct pcmcia_device *host_pcmcia; 289 struct pcmcia_device *host_pcmcia;
290 /* Pointer to the SDIO device (only if bustype == SSB_BUSTYPE_SDIO). */
291 struct sdio_func *host_sdio;
292
293 /* See enum ssb_quirks */
294 unsigned int quirks;
255 295
256#ifdef CONFIG_SSB_SPROM 296#ifdef CONFIG_SSB_SPROM
257 /* Mutex to protect the SPROM writing. */ 297 /* Mutex to protect the SPROM writing. */
@@ -306,6 +346,11 @@ struct ssb_bus {
306#endif /* DEBUG */ 346#endif /* DEBUG */
307}; 347};
308 348
349enum ssb_quirks {
350 /* SDIO connected card requires performing a read after writing a 32-bit value */
351 SSB_QUIRK_SDIO_READ_AFTER_WRITE32 = (1 << 0),
352};
353
309/* The initialization-invariants. */ 354/* The initialization-invariants. */
310struct ssb_init_invariants { 355struct ssb_init_invariants {
311 /* Versioning information about the PCB. */ 356 /* Versioning information about the PCB. */
@@ -336,6 +381,12 @@ extern int ssb_bus_pcmciabus_register(struct ssb_bus *bus,
336 struct pcmcia_device *pcmcia_dev, 381 struct pcmcia_device *pcmcia_dev,
337 unsigned long baseaddr); 382 unsigned long baseaddr);
338#endif /* CONFIG_SSB_PCMCIAHOST */ 383#endif /* CONFIG_SSB_PCMCIAHOST */
384#ifdef CONFIG_SSB_SDIOHOST
385extern int ssb_bus_sdiobus_register(struct ssb_bus *bus,
386 struct sdio_func *sdio_func,
387 unsigned int quirks);
388#endif /* CONFIG_SSB_SDIOHOST */
389
339 390
340extern void ssb_bus_unregister(struct ssb_bus *bus); 391extern void ssb_bus_unregister(struct ssb_bus *bus);
341 392
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h
index d3b1d18922f2..4e27acf0a92f 100644
--- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -629,5 +629,15 @@ extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
629/* PMU support */ 629/* PMU support */
630extern void ssb_pmu_init(struct ssb_chipcommon *cc); 630extern void ssb_pmu_init(struct ssb_chipcommon *cc);
631 631
632enum ssb_pmu_ldo_volt_id {
633 LDO_PAREF = 0,
634 LDO_VOLT1,
635 LDO_VOLT2,
636 LDO_VOLT3,
637};
638
639void ssb_pmu_set_ldo_voltage(struct ssb_chipcommon *cc,
640 enum ssb_pmu_ldo_volt_id id, u32 voltage);
641void ssb_pmu_set_ldo_paref(struct ssb_chipcommon *cc, bool on);
632 642
633#endif /* LINUX_SSB_CHIPCO_H_ */ 643#endif /* LINUX_SSB_CHIPCO_H_ */
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index a01b982b5783..9ae9082eaeb4 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -162,7 +162,7 @@
162 162
163/* SPROM shadow area. If not otherwise noted, fields are 163/* SPROM shadow area. If not otherwise noted, fields are
164 * two bytes wide. Note that the SPROM can _only_ be read 164 * two bytes wide. Note that the SPROM can _only_ be read
165 * in two-byte quantinies. 165 * in two-byte quantities.
166 */ 166 */
167#define SSB_SPROMSIZE_WORDS 64 167#define SSB_SPROMSIZE_WORDS 64
168#define SSB_SPROMSIZE_BYTES (SSB_SPROMSIZE_WORDS * sizeof(u16)) 168#define SSB_SPROMSIZE_BYTES (SSB_SPROMSIZE_WORDS * sizeof(u16))
@@ -327,8 +327,11 @@
327#define SSB_SPROM5_GPIOB_P3_SHIFT 8 327#define SSB_SPROM5_GPIOB_P3_SHIFT 8
328 328
329/* SPROM Revision 8 */ 329/* SPROM Revision 8 */
330#define SSB_SPROM8_BFLLO 0x1084 /* Boardflags (low 16 bits) */ 330#define SSB_SPROM8_BOARDREV 0x1082 /* Board revision */
331#define SSB_SPROM8_BFLHI 0x1086 /* Boardflags Hi */ 331#define SSB_SPROM8_BFLLO 0x1084 /* Board flags (bits 0-15) */
332#define SSB_SPROM8_BFLHI 0x1086 /* Board flags (bits 16-31) */
333#define SSB_SPROM8_BFL2LO 0x1088 /* Board flags (bits 32-47) */
334#define SSB_SPROM8_BFL2HI 0x108A /* Board flags (bits 48-63) */
332#define SSB_SPROM8_IL0MAC 0x108C /* 6 byte MAC address */ 335#define SSB_SPROM8_IL0MAC 0x108C /* 6 byte MAC address */
333#define SSB_SPROM8_CCODE 0x1092 /* 2 byte country code */ 336#define SSB_SPROM8_CCODE 0x1092 /* 2 byte country code */
334#define SSB_SPROM8_ANTAVAIL 0x109C /* Antenna available bitfields*/ 337#define SSB_SPROM8_ANTAVAIL 0x109C /* Antenna available bitfields*/
@@ -354,14 +357,63 @@
354#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */ 357#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */
355#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */ 358#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */
356#define SSB_SPROM8_GPIOB_P3_SHIFT 8 359#define SSB_SPROM8_GPIOB_P3_SHIFT 8
357#define SSB_SPROM8_MAXP_BG 0x10C0 /* Max Power BG in path 1 */ 360#define SSB_SPROM8_RSSIPARM2G 0x10A4 /* RSSI params for 2GHz */
358#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */ 361#define SSB_SPROM8_RSSISMF2G 0x000F
362#define SSB_SPROM8_RSSISMC2G 0x00F0
363#define SSB_SPROM8_RSSISMC2G_SHIFT 4
364#define SSB_SPROM8_RSSISAV2G 0x0700
365#define SSB_SPROM8_RSSISAV2G_SHIFT 8
366#define SSB_SPROM8_BXA2G 0x1800
367#define SSB_SPROM8_BXA2G_SHIFT 11
368#define SSB_SPROM8_RSSIPARM5G 0x10A6 /* RSSI params for 5GHz */
369#define SSB_SPROM8_RSSISMF5G 0x000F
370#define SSB_SPROM8_RSSISMC5G 0x00F0
371#define SSB_SPROM8_RSSISMC5G_SHIFT 4
372#define SSB_SPROM8_RSSISAV5G 0x0700
373#define SSB_SPROM8_RSSISAV5G_SHIFT 8
374#define SSB_SPROM8_BXA5G 0x1800
375#define SSB_SPROM8_BXA5G_SHIFT 11
376#define SSB_SPROM8_TRI25G 0x10A8 /* TX isolation 2.4&5.3GHz */
377#define SSB_SPROM8_TRI2G 0x00FF /* TX isolation 2.4GHz */
378#define SSB_SPROM8_TRI5G 0xFF00 /* TX isolation 5.3GHz */
379#define SSB_SPROM8_TRI5G_SHIFT 8
380#define SSB_SPROM8_TRI5GHL 0x10AA /* TX isolation 5.2/5.8GHz */
381#define SSB_SPROM8_TRI5GL 0x00FF /* TX isolation 5.2GHz */
382#define SSB_SPROM8_TRI5GH 0xFF00 /* TX isolation 5.8GHz */
383#define SSB_SPROM8_TRI5GH_SHIFT 8
384#define SSB_SPROM8_RXPO 0x10AC /* RX power offsets */
385#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */
386#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */
387#define SSB_SPROM8_RXPO5G_SHIFT 8
388#define SSB_SPROM8_MAXP_BG 0x10C0 /* Max Power 2GHz in path 1 */
389#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */
359#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ 390#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
360#define SSB_SPROM8_ITSSI_BG_SHIFT 8 391#define SSB_SPROM8_ITSSI_BG_SHIFT 8
361#define SSB_SPROM8_MAXP_A 0x10C8 /* Max Power A in path 1 */ 392#define SSB_SPROM8_PA0B0 0x10C2 /* 2GHz power amp settings */
362#define SSB_SPROM8_MAXP_A_MASK 0x00FF /* Mask for Max Power A */ 393#define SSB_SPROM8_PA0B1 0x10C4
394#define SSB_SPROM8_PA0B2 0x10C6
395#define SSB_SPROM8_MAXP_A 0x10C8 /* Max Power 5.3GHz */
396#define SSB_SPROM8_MAXP_A_MASK 0x00FF /* Mask for Max Power 5.3GHz */
363#define SSB_SPROM8_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */ 397#define SSB_SPROM8_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */
364#define SSB_SPROM8_ITSSI_A_SHIFT 8 398#define SSB_SPROM8_ITSSI_A_SHIFT 8
399#define SSB_SPROM8_MAXP_AHL 0x10CA /* Max Power 5.2/5.8GHz */
400#define SSB_SPROM8_MAXP_AH_MASK 0x00FF /* Mask for Max Power 5.8GHz */
401#define SSB_SPROM8_MAXP_AL_MASK 0xFF00 /* Mask for Max Power 5.2GHz */
402#define SSB_SPROM8_MAXP_AL_SHIFT 8
403#define SSB_SPROM8_PA1B0 0x10CC /* 5.3GHz power amp settings */
404#define SSB_SPROM8_PA1B1 0x10CE
405#define SSB_SPROM8_PA1B2 0x10D0
406#define SSB_SPROM8_PA1LOB0 0x10D2 /* 5.2GHz power amp settings */
407#define SSB_SPROM8_PA1LOB1 0x10D4
408#define SSB_SPROM8_PA1LOB2 0x10D6
409#define SSB_SPROM8_PA1HIB0 0x10D8 /* 5.8GHz power amp settings */
410#define SSB_SPROM8_PA1HIB1 0x10DA
411#define SSB_SPROM8_PA1HIB2 0x10DC
412#define SSB_SPROM8_CCK2GPO 0x1140 /* CCK power offset */
413#define SSB_SPROM8_OFDM2GPO 0x1142 /* 2.4GHz OFDM power offset */
414#define SSB_SPROM8_OFDM5GPO 0x1146 /* 5.3GHz OFDM power offset */
415#define SSB_SPROM8_OFDM5GLPO 0x114A /* 5.2GHz OFDM power offset */
416#define SSB_SPROM8_OFDM5GHPO 0x114E /* 5.8GHz OFDM power offset */
365 417
366/* Values for SSB_SPROM1_BINF_CCODE */ 418/* Values for SSB_SPROM1_BINF_CCODE */
367enum { 419enum {
diff --git a/include/linux/string.h b/include/linux/string.h
index 489019ef1694..b8508868d5ad 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -62,7 +62,7 @@ extern char * strnchr(const char *, size_t, int);
62#ifndef __HAVE_ARCH_STRRCHR 62#ifndef __HAVE_ARCH_STRRCHR
63extern char * strrchr(const char *,int); 63extern char * strrchr(const char *,int);
64#endif 64#endif
65extern char * strstrip(char *); 65extern char * __must_check strstrip(char *);
66#ifndef __HAVE_ARCH_STRSTR 66#ifndef __HAVE_ARCH_STRSTR
67extern char * strstr(const char *,const char *); 67extern char * strstr(const char *,const char *);
68#endif 68#endif
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 3f632182d8eb..996df4dac7d4 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -111,7 +111,7 @@ struct rpc_credops {
111 void (*crdestroy)(struct rpc_cred *); 111 void (*crdestroy)(struct rpc_cred *);
112 112
113 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int); 113 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int);
114 void (*crbind)(struct rpc_task *, struct rpc_cred *); 114 void (*crbind)(struct rpc_task *, struct rpc_cred *, int);
115 __be32 * (*crmarshal)(struct rpc_task *, __be32 *); 115 __be32 * (*crmarshal)(struct rpc_task *, __be32 *);
116 int (*crrefresh)(struct rpc_task *); 116 int (*crrefresh)(struct rpc_task *);
117 __be32 * (*crvalidate)(struct rpc_task *, __be32 *); 117 __be32 * (*crvalidate)(struct rpc_task *, __be32 *);
@@ -140,7 +140,7 @@ struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *
140void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *); 140void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *);
141struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int); 141struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int);
142void rpcauth_bindcred(struct rpc_task *, struct rpc_cred *, int); 142void rpcauth_bindcred(struct rpc_task *, struct rpc_cred *, int);
143void rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *); 143void rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *, int);
144void put_rpccred(struct rpc_cred *); 144void put_rpccred(struct rpc_cred *);
145void rpcauth_unbindcred(struct rpc_task *); 145void rpcauth_unbindcred(struct rpc_task *);
146__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *); 146__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *);
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 2d8b211b9324..6f52b4d7c447 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -59,6 +59,15 @@ struct cache_head {
59 59
60#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */ 60#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */
61 61
62struct cache_detail_procfs {
63 struct proc_dir_entry *proc_ent;
64 struct proc_dir_entry *flush_ent, *channel_ent, *content_ent;
65};
66
67struct cache_detail_pipefs {
68 struct dentry *dir;
69};
70
62struct cache_detail { 71struct cache_detail {
63 struct module * owner; 72 struct module * owner;
64 int hash_size; 73 int hash_size;
@@ -70,15 +79,17 @@ struct cache_detail {
70 char *name; 79 char *name;
71 void (*cache_put)(struct kref *); 80 void (*cache_put)(struct kref *);
72 81
73 void (*cache_request)(struct cache_detail *cd, 82 int (*cache_upcall)(struct cache_detail *,
74 struct cache_head *h, 83 struct cache_head *);
75 char **bpp, int *blen); 84
76 int (*cache_parse)(struct cache_detail *, 85 int (*cache_parse)(struct cache_detail *,
77 char *buf, int len); 86 char *buf, int len);
78 87
79 int (*cache_show)(struct seq_file *m, 88 int (*cache_show)(struct seq_file *m,
80 struct cache_detail *cd, 89 struct cache_detail *cd,
81 struct cache_head *h); 90 struct cache_head *h);
91 void (*warn_no_listener)(struct cache_detail *cd,
92 int has_died);
82 93
83 struct cache_head * (*alloc)(void); 94 struct cache_head * (*alloc)(void);
84 int (*match)(struct cache_head *orig, struct cache_head *new); 95 int (*match)(struct cache_head *orig, struct cache_head *new);
@@ -96,13 +107,15 @@ struct cache_detail {
96 107
97 /* fields for communication over channel */ 108 /* fields for communication over channel */
98 struct list_head queue; 109 struct list_head queue;
99 struct proc_dir_entry *proc_ent;
100 struct proc_dir_entry *flush_ent, *channel_ent, *content_ent;
101 110
102 atomic_t readers; /* how many time is /chennel open */ 111 atomic_t readers; /* how many time is /chennel open */
103 time_t last_close; /* if no readers, when did last close */ 112 time_t last_close; /* if no readers, when did last close */
104 time_t last_warn; /* when we last warned about no readers */ 113 time_t last_warn; /* when we last warned about no readers */
105 void (*warn_no_listener)(struct cache_detail *cd); 114
115 union {
116 struct cache_detail_procfs procfs;
117 struct cache_detail_pipefs pipefs;
118 } u;
106}; 119};
107 120
108 121
@@ -127,6 +140,10 @@ struct cache_deferred_req {
127}; 140};
128 141
129 142
143extern const struct file_operations cache_file_operations_pipefs;
144extern const struct file_operations content_file_operations_pipefs;
145extern const struct file_operations cache_flush_operations_pipefs;
146
130extern struct cache_head * 147extern struct cache_head *
131sunrpc_cache_lookup(struct cache_detail *detail, 148sunrpc_cache_lookup(struct cache_detail *detail,
132 struct cache_head *key, int hash); 149 struct cache_head *key, int hash);
@@ -134,6 +151,13 @@ extern struct cache_head *
134sunrpc_cache_update(struct cache_detail *detail, 151sunrpc_cache_update(struct cache_detail *detail,
135 struct cache_head *new, struct cache_head *old, int hash); 152 struct cache_head *new, struct cache_head *old, int hash);
136 153
154extern int
155sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h,
156 void (*cache_request)(struct cache_detail *,
157 struct cache_head *,
158 char **,
159 int *));
160
137 161
138extern void cache_clean_deferred(void *owner); 162extern void cache_clean_deferred(void *owner);
139 163
@@ -171,6 +195,10 @@ extern void cache_purge(struct cache_detail *detail);
171extern int cache_register(struct cache_detail *cd); 195extern int cache_register(struct cache_detail *cd);
172extern void cache_unregister(struct cache_detail *cd); 196extern void cache_unregister(struct cache_detail *cd);
173 197
198extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *,
199 mode_t, struct cache_detail *);
200extern void sunrpc_cache_unregister_pipefs(struct cache_detail *);
201
174extern void qword_add(char **bpp, int *lp, char *str); 202extern void qword_add(char **bpp, int *lp, char *str);
175extern void qword_addhex(char **bpp, int *lp, char *buf, int blen); 203extern void qword_addhex(char **bpp, int *lp, char *buf, int blen);
176extern int qword_get(char **bpp, char *dest, int bufsize); 204extern int qword_get(char **bpp, char *dest, int bufsize);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 37881f1a0bd7..8ed9642a5a76 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -9,6 +9,10 @@
9#ifndef _LINUX_SUNRPC_CLNT_H 9#ifndef _LINUX_SUNRPC_CLNT_H
10#define _LINUX_SUNRPC_CLNT_H 10#define _LINUX_SUNRPC_CLNT_H
11 11
12#include <linux/socket.h>
13#include <linux/in.h>
14#include <linux/in6.h>
15
12#include <linux/sunrpc/msg_prot.h> 16#include <linux/sunrpc/msg_prot.h>
13#include <linux/sunrpc/sched.h> 17#include <linux/sunrpc/sched.h>
14#include <linux/sunrpc/xprt.h> 18#include <linux/sunrpc/xprt.h>
@@ -17,6 +21,8 @@
17#include <linux/sunrpc/xdr.h> 21#include <linux/sunrpc/xdr.h>
18#include <linux/sunrpc/timer.h> 22#include <linux/sunrpc/timer.h>
19#include <asm/signal.h> 23#include <asm/signal.h>
24#include <linux/path.h>
25#include <net/ipv6.h>
20 26
21struct rpc_inode; 27struct rpc_inode;
22 28
@@ -50,9 +56,7 @@ struct rpc_clnt {
50 56
51 int cl_nodelen; /* nodename length */ 57 int cl_nodelen; /* nodename length */
52 char cl_nodename[UNX_MAXNODENAME]; 58 char cl_nodename[UNX_MAXNODENAME];
53 char cl_pathname[30];/* Path in rpc_pipe_fs */ 59 struct path cl_path;
54 struct vfsmount * cl_vfsmnt;
55 struct dentry * cl_dentry; /* inode */
56 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 60 struct rpc_clnt * cl_parent; /* Points to parent of clones */
57 struct rpc_rtt cl_rtt_default; 61 struct rpc_rtt cl_rtt_default;
58 struct rpc_timeout cl_timeout_default; 62 struct rpc_timeout cl_timeout_default;
@@ -110,6 +114,7 @@ struct rpc_create_args {
110 rpc_authflavor_t authflavor; 114 rpc_authflavor_t authflavor;
111 unsigned long flags; 115 unsigned long flags;
112 char *client_name; 116 char *client_name;
117 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
113}; 118};
114 119
115/* Values for "flags" field */ 120/* Values for "flags" field */
@@ -151,5 +156,151 @@ void rpc_force_rebind(struct rpc_clnt *);
151size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); 156size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
152const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); 157const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
153 158
159size_t rpc_ntop(const struct sockaddr *, char *, const size_t);
160size_t rpc_pton(const char *, const size_t,
161 struct sockaddr *, const size_t);
162char * rpc_sockaddr2uaddr(const struct sockaddr *);
163size_t rpc_uaddr2sockaddr(const char *, const size_t,
164 struct sockaddr *, const size_t);
165
166static inline unsigned short rpc_get_port(const struct sockaddr *sap)
167{
168 switch (sap->sa_family) {
169 case AF_INET:
170 return ntohs(((struct sockaddr_in *)sap)->sin_port);
171 case AF_INET6:
172 return ntohs(((struct sockaddr_in6 *)sap)->sin6_port);
173 }
174 return 0;
175}
176
177static inline void rpc_set_port(struct sockaddr *sap,
178 const unsigned short port)
179{
180 switch (sap->sa_family) {
181 case AF_INET:
182 ((struct sockaddr_in *)sap)->sin_port = htons(port);
183 break;
184 case AF_INET6:
185 ((struct sockaddr_in6 *)sap)->sin6_port = htons(port);
186 break;
187 }
188}
189
190#define IPV6_SCOPE_DELIMITER '%'
191#define IPV6_SCOPE_ID_LEN sizeof("%nnnnnnnnnn")
192
193static inline bool __rpc_cmp_addr4(const struct sockaddr *sap1,
194 const struct sockaddr *sap2)
195{
196 const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1;
197 const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2;
198
199 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
200}
201
202static inline bool __rpc_copy_addr4(struct sockaddr *dst,
203 const struct sockaddr *src)
204{
205 const struct sockaddr_in *ssin = (struct sockaddr_in *) src;
206 struct sockaddr_in *dsin = (struct sockaddr_in *) dst;
207
208 dsin->sin_family = ssin->sin_family;
209 dsin->sin_addr.s_addr = ssin->sin_addr.s_addr;
210 return true;
211}
212
213#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
214static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
215 const struct sockaddr *sap2)
216{
217 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
218 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
219 return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr);
220}
221
222static inline bool __rpc_copy_addr6(struct sockaddr *dst,
223 const struct sockaddr *src)
224{
225 const struct sockaddr_in6 *ssin6 = (const struct sockaddr_in6 *) src;
226 struct sockaddr_in6 *dsin6 = (struct sockaddr_in6 *) dst;
227
228 dsin6->sin6_family = ssin6->sin6_family;
229 ipv6_addr_copy(&dsin6->sin6_addr, &ssin6->sin6_addr);
230 return true;
231}
232#else /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
233static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
234 const struct sockaddr *sap2)
235{
236 return false;
237}
238
239static inline bool __rpc_copy_addr6(struct sockaddr *dst,
240 const struct sockaddr *src)
241{
242 return false;
243}
244#endif /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
245
246/**
247 * rpc_cmp_addr - compare the address portion of two sockaddrs.
248 * @sap1: first sockaddr
249 * @sap2: second sockaddr
250 *
251 * Just compares the family and address portion. Ignores port, scope, etc.
252 * Returns true if the addrs are equal, false if they aren't.
253 */
254static inline bool rpc_cmp_addr(const struct sockaddr *sap1,
255 const struct sockaddr *sap2)
256{
257 if (sap1->sa_family == sap2->sa_family) {
258 switch (sap1->sa_family) {
259 case AF_INET:
260 return __rpc_cmp_addr4(sap1, sap2);
261 case AF_INET6:
262 return __rpc_cmp_addr6(sap1, sap2);
263 }
264 }
265 return false;
266}
267
268/**
269 * rpc_copy_addr - copy the address portion of one sockaddr to another
270 * @dst: destination sockaddr
271 * @src: source sockaddr
272 *
273 * Just copies the address portion and family. Ignores port, scope, etc.
274 * Caller is responsible for making certain that dst is large enough to hold
275 * the address in src. Returns true if address family is supported. Returns
276 * false otherwise.
277 */
278static inline bool rpc_copy_addr(struct sockaddr *dst,
279 const struct sockaddr *src)
280{
281 switch (src->sa_family) {
282 case AF_INET:
283 return __rpc_copy_addr4(dst, src);
284 case AF_INET6:
285 return __rpc_copy_addr6(dst, src);
286 }
287 return false;
288}
289
290/**
291 * rpc_get_scope_id - return scopeid for a given sockaddr
292 * @sa: sockaddr to get scopeid from
293 *
294 * Returns the value of the sin6_scope_id for AF_INET6 addrs, or 0 if
295 * not an AF_INET6 address.
296 */
297static inline u32 rpc_get_scope_id(const struct sockaddr *sa)
298{
299 if (sa->sa_family != AF_INET6)
300 return 0;
301
302 return ((struct sockaddr_in6 *) sa)->sin6_scope_id;
303}
304
154#endif /* __KERNEL__ */ 305#endif /* __KERNEL__ */
155#endif /* _LINUX_SUNRPC_CLNT_H */ 306#endif /* _LINUX_SUNRPC_CLNT_H */
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index 70df4f1d8847..77e624883393 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -189,7 +189,22 @@ typedef __be32 rpc_fraghdr;
189 * Additionally, the two alternative forms specified in Section 2.2 of 189 * Additionally, the two alternative forms specified in Section 2.2 of
190 * [RFC2373] are also acceptable. 190 * [RFC2373] are also acceptable.
191 */ 191 */
192#define RPCBIND_MAXUADDRLEN (56u) 192
193#include <linux/inet.h>
194
195/* Maximum size of the port number part of a universal address */
196#define RPCBIND_MAXUADDRPLEN sizeof(".255.255")
197
198/* Maximum size of an IPv4 universal address */
199#define RPCBIND_MAXUADDR4LEN \
200 (INET_ADDRSTRLEN + RPCBIND_MAXUADDRPLEN)
201
202/* Maximum size of an IPv6 universal address */
203#define RPCBIND_MAXUADDR6LEN \
204 (INET6_ADDRSTRLEN + RPCBIND_MAXUADDRPLEN)
205
206/* Assume INET6_ADDRSTRLEN will always be larger than INET_ADDRSTRLEN... */
207#define RPCBIND_MAXUADDRLEN RPCBIND_MAXUADDR6LEN
193 208
194#endif /* __KERNEL__ */ 209#endif /* __KERNEL__ */
195#endif /* _LINUX_SUNRPC_MSGPROT_H_ */ 210#endif /* _LINUX_SUNRPC_MSGPROT_H_ */
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index cea764c2359f..cf14db975da0 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -3,6 +3,8 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/workqueue.h>
7
6struct rpc_pipe_msg { 8struct rpc_pipe_msg {
7 struct list_head list; 9 struct list_head list;
8 void *data; 10 void *data;
@@ -32,8 +34,8 @@ struct rpc_inode {
32 wait_queue_head_t waitq; 34 wait_queue_head_t waitq;
33#define RPC_PIPE_WAIT_FOR_OPEN 1 35#define RPC_PIPE_WAIT_FOR_OPEN 1
34 int flags; 36 int flags;
35 struct rpc_pipe_ops *ops;
36 struct delayed_work queue_timeout; 37 struct delayed_work queue_timeout;
38 const struct rpc_pipe_ops *ops;
37}; 39};
38 40
39static inline struct rpc_inode * 41static inline struct rpc_inode *
@@ -44,9 +46,19 @@ RPC_I(struct inode *inode)
44 46
45extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); 47extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
46 48
47extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *); 49struct rpc_clnt;
48extern int rpc_rmdir(struct dentry *); 50extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *);
49extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *, struct rpc_pipe_ops *, int flags); 51extern int rpc_remove_client_dir(struct dentry *);
52
53struct cache_detail;
54extern struct dentry *rpc_create_cache_dir(struct dentry *,
55 struct qstr *,
56 mode_t umode,
57 struct cache_detail *);
58extern void rpc_remove_cache_dir(struct dentry *);
59
60extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *,
61 const struct rpc_pipe_ops *, int flags);
50extern int rpc_unlink(struct dentry *); 62extern int rpc_unlink(struct dentry *);
51extern struct vfsmount *rpc_get_mount(void); 63extern struct vfsmount *rpc_get_mount(void);
52extern void rpc_put_mount(void); 64extern void rpc_put_mount(void);
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index ea8009695c69..52e8cb0a7569 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -94,8 +94,6 @@ struct svc_serv {
94 struct module * sv_module; /* optional module to count when 94 struct module * sv_module; /* optional module to count when
95 * adding threads */ 95 * adding threads */
96 svc_thread_fn sv_function; /* main function for threads */ 96 svc_thread_fn sv_function; /* main function for threads */
97 unsigned int sv_drc_max_pages; /* Total pages for DRC */
98 unsigned int sv_drc_pages_used;/* DRC pages used */
99#if defined(CONFIG_NFS_V4_1) 97#if defined(CONFIG_NFS_V4_1)
100 struct list_head sv_cb_list; /* queue for callback requests 98 struct list_head sv_cb_list; /* queue for callback requests
101 * that arrive over the same 99 * that arrive over the same
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 2223ae0b5ed5..5f4e18b3ce73 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -65,6 +65,7 @@ struct svc_xprt {
65 size_t xpt_locallen; /* length of address */ 65 size_t xpt_locallen; /* length of address */
66 struct sockaddr_storage xpt_remote; /* remote peer's address */ 66 struct sockaddr_storage xpt_remote; /* remote peer's address */
67 size_t xpt_remotelen; /* length of address */ 67 size_t xpt_remotelen; /* length of address */
68 struct rpc_wait_queue xpt_bc_pending; /* backchannel wait queue */
68}; 69};
69 70
70int svc_reg_xprt_class(struct svc_xprt_class *); 71int svc_reg_xprt_class(struct svc_xprt_class *);
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 04dba23c59f2..1b353a76c304 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -28,6 +28,7 @@ struct svc_sock {
28 /* private TCP part */ 28 /* private TCP part */
29 u32 sk_reclen; /* length of record */ 29 u32 sk_reclen; /* length of record */
30 u32 sk_tcplen; /* current read length */ 30 u32 sk_tcplen; /* current read length */
31 struct rpc_xprt *sk_bc_xprt; /* NFSv4.1 backchannel xprt */
31}; 32};
32 33
33/* 34/*
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index b99c625fddfe..f5cc0898bc53 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -11,6 +11,7 @@
11 11
12#include <linux/uio.h> 12#include <linux/uio.h>
13#include <asm/byteorder.h> 13#include <asm/byteorder.h>
14#include <asm/unaligned.h>
14#include <linux/scatterlist.h> 15#include <linux/scatterlist.h>
15 16
16/* 17/*
@@ -117,17 +118,15 @@ static inline __be32 *xdr_encode_array(__be32 *p, const void *s, unsigned int le
117static inline __be32 * 118static inline __be32 *
118xdr_encode_hyper(__be32 *p, __u64 val) 119xdr_encode_hyper(__be32 *p, __u64 val)
119{ 120{
120 *p++ = htonl(val >> 32); 121 put_unaligned_be64(val, p);
121 *p++ = htonl(val & 0xFFFFFFFF); 122 return p + 2;
122 return p;
123} 123}
124 124
125static inline __be32 * 125static inline __be32 *
126xdr_decode_hyper(__be32 *p, __u64 *valp) 126xdr_decode_hyper(__be32 *p, __u64 *valp)
127{ 127{
128 *valp = ((__u64) ntohl(*p++)) << 32; 128 *valp = get_unaligned_be64(p);
129 *valp |= ntohl(*p++); 129 return p + 2;
130 return p;
131} 130}
132 131
133/* 132/*
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 1175d58efc2e..6f9457a75b8f 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -38,10 +38,8 @@ enum rpc_display_format_t {
38 RPC_DISPLAY_ADDR = 0, 38 RPC_DISPLAY_ADDR = 0,
39 RPC_DISPLAY_PORT, 39 RPC_DISPLAY_PORT,
40 RPC_DISPLAY_PROTO, 40 RPC_DISPLAY_PROTO,
41 RPC_DISPLAY_ALL,
42 RPC_DISPLAY_HEX_ADDR, 41 RPC_DISPLAY_HEX_ADDR,
43 RPC_DISPLAY_HEX_PORT, 42 RPC_DISPLAY_HEX_PORT,
44 RPC_DISPLAY_UNIVERSAL_ADDR,
45 RPC_DISPLAY_NETID, 43 RPC_DISPLAY_NETID,
46 RPC_DISPLAY_MAX, 44 RPC_DISPLAY_MAX,
47}; 45};
@@ -126,6 +124,23 @@ struct rpc_xprt_ops {
126 void (*print_stats)(struct rpc_xprt *xprt, struct seq_file *seq); 124 void (*print_stats)(struct rpc_xprt *xprt, struct seq_file *seq);
127}; 125};
128 126
127/*
128 * RPC transport identifiers
129 *
130 * To preserve compatibility with the historical use of raw IP protocol
131 * id's for transport selection, UDP and TCP identifiers are specified
132 * with the previous values. No such restriction exists for new transports,
133 * except that they may not collide with these values (17 and 6,
134 * respectively).
135 */
136#define XPRT_TRANSPORT_BC (1 << 31)
137enum xprt_transports {
138 XPRT_TRANSPORT_UDP = IPPROTO_UDP,
139 XPRT_TRANSPORT_TCP = IPPROTO_TCP,
140 XPRT_TRANSPORT_BC_TCP = IPPROTO_TCP | XPRT_TRANSPORT_BC,
141 XPRT_TRANSPORT_RDMA = 256
142};
143
129struct rpc_xprt { 144struct rpc_xprt {
130 struct kref kref; /* Reference count */ 145 struct kref kref; /* Reference count */
131 struct rpc_xprt_ops * ops; /* transport methods */ 146 struct rpc_xprt_ops * ops; /* transport methods */
@@ -181,6 +196,7 @@ struct rpc_xprt {
181 spinlock_t reserve_lock; /* lock slot table */ 196 spinlock_t reserve_lock; /* lock slot table */
182 u32 xid; /* Next XID value to use */ 197 u32 xid; /* Next XID value to use */
183 struct rpc_task * snd_task; /* Task blocked in send */ 198 struct rpc_task * snd_task; /* Task blocked in send */
199 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
184#if defined(CONFIG_NFS_V4_1) 200#if defined(CONFIG_NFS_V4_1)
185 struct svc_serv *bc_serv; /* The RPC service which will */ 201 struct svc_serv *bc_serv; /* The RPC service which will */
186 /* process the callback */ 202 /* process the callback */
@@ -233,6 +249,7 @@ struct xprt_create {
233 struct sockaddr * srcaddr; /* optional local address */ 249 struct sockaddr * srcaddr; /* optional local address */
234 struct sockaddr * dstaddr; /* remote peer address */ 250 struct sockaddr * dstaddr; /* remote peer address */
235 size_t addrlen; 251 size_t addrlen;
252 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
236}; 253};
237 254
238struct xprt_class { 255struct xprt_class {
diff --git a/include/linux/sunrpc/xprtrdma.h b/include/linux/sunrpc/xprtrdma.h
index 54a379c9e8eb..c2f04e1ae159 100644
--- a/include/linux/sunrpc/xprtrdma.h
+++ b/include/linux/sunrpc/xprtrdma.h
@@ -41,11 +41,6 @@
41#define _LINUX_SUNRPC_XPRTRDMA_H 41#define _LINUX_SUNRPC_XPRTRDMA_H
42 42
43/* 43/*
44 * RPC transport identifier for RDMA
45 */
46#define XPRT_TRANSPORT_RDMA 256
47
48/*
49 * rpcbind (v3+) RDMA netid. 44 * rpcbind (v3+) RDMA netid.
50 */ 45 */
51#define RPCBIND_NETID_RDMA "rdma" 46#define RPCBIND_NETID_RDMA "rdma"
diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h
index c2a46c45c8f7..3f14a02e9cc0 100644
--- a/include/linux/sunrpc/xprtsock.h
+++ b/include/linux/sunrpc/xprtsock.h
@@ -13,17 +13,6 @@ int init_socket_xprt(void);
13void cleanup_socket_xprt(void); 13void cleanup_socket_xprt(void);
14 14
15/* 15/*
16 * RPC transport identifiers for UDP, TCP
17 *
18 * To preserve compatibility with the historical use of raw IP protocol
19 * id's for transport selection, these are specified with the previous
20 * values. No such restriction exists for new transports, except that
21 * they may not collide with these values (17 and 6, respectively).
22 */
23#define XPRT_TRANSPORT_UDP IPPROTO_UDP
24#define XPRT_TRANSPORT_TCP IPPROTO_TCP
25
26/*
27 * RPC slot table sizes for UDP, TCP transports 16 * RPC slot table sizes for UDP, TCP transports
28 */ 17 */
29extern unsigned int xprt_udp_slot_table_entries; 18extern unsigned int xprt_udp_slot_table_entries;
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index cd15df6c63cd..5e781d824e6d 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -301,6 +301,8 @@ static inline int unregister_pm_notifier(struct notifier_block *nb)
301#define pm_notifier(fn, pri) do { (void)(fn); } while (0) 301#define pm_notifier(fn, pri) do { (void)(fn); } while (0)
302#endif /* !CONFIG_PM_SLEEP */ 302#endif /* !CONFIG_PM_SLEEP */
303 303
304extern struct mutex pm_mutex;
305
304#ifndef CONFIG_HIBERNATION 306#ifndef CONFIG_HIBERNATION
305static inline void register_nosave_region(unsigned long b, unsigned long e) 307static inline void register_nosave_region(unsigned long b, unsigned long e)
306{ 308{
@@ -308,8 +310,23 @@ static inline void register_nosave_region(unsigned long b, unsigned long e)
308static inline void register_nosave_region_late(unsigned long b, unsigned long e) 310static inline void register_nosave_region_late(unsigned long b, unsigned long e)
309{ 311{
310} 312}
311#endif
312 313
313extern struct mutex pm_mutex; 314static inline void lock_system_sleep(void) {}
315static inline void unlock_system_sleep(void) {}
316
317#else
318
319/* Let some subsystems like memory hotadd exclude hibernation */
320
321static inline void lock_system_sleep(void)
322{
323 mutex_lock(&pm_mutex);
324}
325
326static inline void unlock_system_sleep(void)
327{
328 mutex_unlock(&pm_mutex);
329}
330#endif
314 331
315#endif /* _LINUX_SUSPEND_H */ 332#endif /* _LINUX_SUSPEND_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 7c15334f3ff2..4ec90019c1a4 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -34,15 +34,37 @@ static inline int current_is_kswapd(void)
34 * the type/offset into the pte as 5/27 as well. 34 * the type/offset into the pte as 5/27 as well.
35 */ 35 */
36#define MAX_SWAPFILES_SHIFT 5 36#define MAX_SWAPFILES_SHIFT 5
37#ifndef CONFIG_MIGRATION 37
38#define MAX_SWAPFILES (1 << MAX_SWAPFILES_SHIFT) 38/*
39 * Use some of the swap files numbers for other purposes. This
40 * is a convenient way to hook into the VM to trigger special
41 * actions on faults.
42 */
43
44/*
45 * NUMA node memory migration support
46 */
47#ifdef CONFIG_MIGRATION
48#define SWP_MIGRATION_NUM 2
49#define SWP_MIGRATION_READ (MAX_SWAPFILES + SWP_HWPOISON_NUM)
50#define SWP_MIGRATION_WRITE (MAX_SWAPFILES + SWP_HWPOISON_NUM + 1)
51#else
52#define SWP_MIGRATION_NUM 0
53#endif
54
55/*
56 * Handling of hardware poisoned pages with memory corruption.
57 */
58#ifdef CONFIG_MEMORY_FAILURE
59#define SWP_HWPOISON_NUM 1
60#define SWP_HWPOISON MAX_SWAPFILES
39#else 61#else
40/* Use last two entries for page migration swap entries */ 62#define SWP_HWPOISON_NUM 0
41#define MAX_SWAPFILES ((1 << MAX_SWAPFILES_SHIFT)-2)
42#define SWP_MIGRATION_READ MAX_SWAPFILES
43#define SWP_MIGRATION_WRITE (MAX_SWAPFILES + 1)
44#endif 63#endif
45 64
65#define MAX_SWAPFILES \
66 ((1 << MAX_SWAPFILES_SHIFT) - SWP_MIGRATION_NUM - SWP_HWPOISON_NUM)
67
46/* 68/*
47 * Magic header for a swap area. The first part of the union is 69 * Magic header for a swap area. The first part of the union is
48 * what the swap magic looks like for the old (limited to 128MB) 70 * what the swap magic looks like for the old (limited to 128MB)
@@ -217,6 +239,11 @@ extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
217extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, 239extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
218 gfp_t gfp_mask, bool noswap, 240 gfp_t gfp_mask, bool noswap,
219 unsigned int swappiness); 241 unsigned int swappiness);
242extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
243 gfp_t gfp_mask, bool noswap,
244 unsigned int swappiness,
245 struct zone *zone,
246 int nid);
220extern int __isolate_lru_page(struct page *page, int mode, int file); 247extern int __isolate_lru_page(struct page *page, int mode, int file);
221extern unsigned long shrink_all_memory(unsigned long nr_pages); 248extern unsigned long shrink_all_memory(unsigned long nr_pages);
222extern int vm_swappiness; 249extern int vm_swappiness;
@@ -240,7 +267,7 @@ extern int page_evictable(struct page *page, struct vm_area_struct *vma);
240extern void scan_mapping_unevictable_pages(struct address_space *); 267extern void scan_mapping_unevictable_pages(struct address_space *);
241 268
242extern unsigned long scan_unevictable_pages; 269extern unsigned long scan_unevictable_pages;
243extern int scan_unevictable_handler(struct ctl_table *, int, struct file *, 270extern int scan_unevictable_handler(struct ctl_table *, int,
244 void __user *, size_t *, loff_t *); 271 void __user *, size_t *, loff_t *);
245extern int scan_unevictable_register_node(struct node *node); 272extern int scan_unevictable_register_node(struct node *node);
246extern void scan_unevictable_unregister_node(struct node *node); 273extern void scan_unevictable_unregister_node(struct node *node);
@@ -419,10 +446,22 @@ static inline swp_entry_t get_swap_page(void)
419} 446}
420 447
421/* linux/mm/thrash.c */ 448/* linux/mm/thrash.c */
422#define put_swap_token(mm) do { } while (0) 449static inline void put_swap_token(struct mm_struct *mm)
423#define grab_swap_token(mm) do { } while (0) 450{
424#define has_swap_token(mm) 0 451}
425#define disable_swap_token() do { } while (0) 452
453static inline void grab_swap_token(struct mm_struct *mm)
454{
455}
456
457static inline int has_swap_token(struct mm_struct *mm)
458{
459 return 0;
460}
461
462static inline void disable_swap_token(void)
463{
464}
426 465
427static inline void 466static inline void
428mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent) 467mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent)
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 6ec39ab27b4b..cd42e30b7c6e 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -131,3 +131,41 @@ static inline int is_write_migration_entry(swp_entry_t entry)
131 131
132#endif 132#endif
133 133
134#ifdef CONFIG_MEMORY_FAILURE
135/*
136 * Support for hardware poisoned pages
137 */
138static inline swp_entry_t make_hwpoison_entry(struct page *page)
139{
140 BUG_ON(!PageLocked(page));
141 return swp_entry(SWP_HWPOISON, page_to_pfn(page));
142}
143
144static inline int is_hwpoison_entry(swp_entry_t entry)
145{
146 return swp_type(entry) == SWP_HWPOISON;
147}
148#else
149
150static inline swp_entry_t make_hwpoison_entry(struct page *page)
151{
152 return swp_entry(0, 0);
153}
154
155static inline int is_hwpoison_entry(swp_entry_t swp)
156{
157 return 0;
158}
159#endif
160
161#if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION)
162static inline int non_swap_entry(swp_entry_t entry)
163{
164 return swp_type(entry) >= MAX_SWAPFILES;
165}
166#else
167static inline int non_swap_entry(swp_entry_t entry)
168{
169 return 0;
170}
171#endif
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index cb1a6631b8f4..73b1f1cec423 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -14,7 +14,6 @@ struct scatterlist;
14 */ 14 */
15#define IO_TLB_SEGSIZE 128 15#define IO_TLB_SEGSIZE 128
16 16
17
18/* 17/*
19 * log of the size of each IO TLB slab. The number of slabs is command line 18 * log of the size of each IO TLB slab. The number of slabs is command line
20 * controllable. 19 * controllable.
@@ -24,16 +23,6 @@ struct scatterlist;
24extern void 23extern void
25swiotlb_init(void); 24swiotlb_init(void);
26 25
27extern void *swiotlb_alloc_boot(size_t bytes, unsigned long nslabs);
28extern void *swiotlb_alloc(unsigned order, unsigned long nslabs);
29
30extern dma_addr_t swiotlb_phys_to_bus(struct device *hwdev,
31 phys_addr_t address);
32extern phys_addr_t swiotlb_bus_to_phys(struct device *hwdev,
33 dma_addr_t address);
34
35extern int swiotlb_arch_range_needs_mapping(phys_addr_t paddr, size_t size);
36
37extern void 26extern void
38*swiotlb_alloc_coherent(struct device *hwdev, size_t size, 27*swiotlb_alloc_coherent(struct device *hwdev, size_t size,
39 dma_addr_t *dma_handle, gfp_t flags); 28 dma_addr_t *dma_handle, gfp_t flags);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 80de7003d8c2..a990ace1a838 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -55,7 +55,7 @@ struct compat_timeval;
55struct robust_list_head; 55struct robust_list_head;
56struct getcpu_cache; 56struct getcpu_cache;
57struct old_linux_dirent; 57struct old_linux_dirent;
58struct perf_counter_attr; 58struct perf_event_attr;
59 59
60#include <linux/types.h> 60#include <linux/types.h>
61#include <linux/aio_abi.h> 61#include <linux/aio_abi.h>
@@ -64,6 +64,7 @@ struct perf_counter_attr;
64#include <linux/sem.h> 64#include <linux/sem.h>
65#include <asm/siginfo.h> 65#include <asm/siginfo.h>
66#include <asm/signal.h> 66#include <asm/signal.h>
67#include <linux/unistd.h>
67#include <linux/quota.h> 68#include <linux/quota.h>
68#include <linux/key.h> 69#include <linux/key.h>
69#include <trace/syscall.h> 70#include <trace/syscall.h>
@@ -97,6 +98,45 @@ struct perf_counter_attr;
97#define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__) 98#define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__)
98#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__) 99#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__)
99 100
101#ifdef CONFIG_EVENT_PROFILE
102#define TRACE_SYS_ENTER_PROFILE(sname) \
103static int prof_sysenter_enable_##sname(void) \
104{ \
105 return reg_prof_syscall_enter("sys"#sname); \
106} \
107 \
108static void prof_sysenter_disable_##sname(void) \
109{ \
110 unreg_prof_syscall_enter("sys"#sname); \
111}
112
113#define TRACE_SYS_EXIT_PROFILE(sname) \
114static int prof_sysexit_enable_##sname(void) \
115{ \
116 return reg_prof_syscall_exit("sys"#sname); \
117} \
118 \
119static void prof_sysexit_disable_##sname(void) \
120{ \
121 unreg_prof_syscall_exit("sys"#sname); \
122}
123
124#define TRACE_SYS_ENTER_PROFILE_INIT(sname) \
125 .profile_count = ATOMIC_INIT(-1), \
126 .profile_enable = prof_sysenter_enable_##sname, \
127 .profile_disable = prof_sysenter_disable_##sname,
128
129#define TRACE_SYS_EXIT_PROFILE_INIT(sname) \
130 .profile_count = ATOMIC_INIT(-1), \
131 .profile_enable = prof_sysexit_enable_##sname, \
132 .profile_disable = prof_sysexit_disable_##sname,
133#else
134#define TRACE_SYS_ENTER_PROFILE(sname)
135#define TRACE_SYS_ENTER_PROFILE_INIT(sname)
136#define TRACE_SYS_EXIT_PROFILE(sname)
137#define TRACE_SYS_EXIT_PROFILE_INIT(sname)
138#endif
139
100#ifdef CONFIG_FTRACE_SYSCALLS 140#ifdef CONFIG_FTRACE_SYSCALLS
101#define __SC_STR_ADECL1(t, a) #a 141#define __SC_STR_ADECL1(t, a) #a
102#define __SC_STR_ADECL2(t, a, ...) #a, __SC_STR_ADECL1(__VA_ARGS__) 142#define __SC_STR_ADECL2(t, a, ...) #a, __SC_STR_ADECL1(__VA_ARGS__)
@@ -112,7 +152,81 @@ struct perf_counter_attr;
112#define __SC_STR_TDECL5(t, a, ...) #t, __SC_STR_TDECL4(__VA_ARGS__) 152#define __SC_STR_TDECL5(t, a, ...) #t, __SC_STR_TDECL4(__VA_ARGS__)
113#define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__) 153#define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__)
114 154
155#define SYSCALL_TRACE_ENTER_EVENT(sname) \
156 static struct ftrace_event_call event_enter_##sname; \
157 struct trace_event enter_syscall_print_##sname = { \
158 .trace = print_syscall_enter, \
159 }; \
160 static int init_enter_##sname(void) \
161 { \
162 int num, id; \
163 num = syscall_name_to_nr("sys"#sname); \
164 if (num < 0) \
165 return -ENOSYS; \
166 id = register_ftrace_event(&enter_syscall_print_##sname);\
167 if (!id) \
168 return -ENODEV; \
169 event_enter_##sname.id = id; \
170 set_syscall_enter_id(num, id); \
171 INIT_LIST_HEAD(&event_enter_##sname.fields); \
172 return 0; \
173 } \
174 TRACE_SYS_ENTER_PROFILE(sname); \
175 static struct ftrace_event_call __used \
176 __attribute__((__aligned__(4))) \
177 __attribute__((section("_ftrace_events"))) \
178 event_enter_##sname = { \
179 .name = "sys_enter"#sname, \
180 .system = "syscalls", \
181 .event = &event_syscall_enter, \
182 .raw_init = init_enter_##sname, \
183 .show_format = syscall_enter_format, \
184 .define_fields = syscall_enter_define_fields, \
185 .regfunc = reg_event_syscall_enter, \
186 .unregfunc = unreg_event_syscall_enter, \
187 .data = "sys"#sname, \
188 TRACE_SYS_ENTER_PROFILE_INIT(sname) \
189 }
190
191#define SYSCALL_TRACE_EXIT_EVENT(sname) \
192 static struct ftrace_event_call event_exit_##sname; \
193 struct trace_event exit_syscall_print_##sname = { \
194 .trace = print_syscall_exit, \
195 }; \
196 static int init_exit_##sname(void) \
197 { \
198 int num, id; \
199 num = syscall_name_to_nr("sys"#sname); \
200 if (num < 0) \
201 return -ENOSYS; \
202 id = register_ftrace_event(&exit_syscall_print_##sname);\
203 if (!id) \
204 return -ENODEV; \
205 event_exit_##sname.id = id; \
206 set_syscall_exit_id(num, id); \
207 INIT_LIST_HEAD(&event_exit_##sname.fields); \
208 return 0; \
209 } \
210 TRACE_SYS_EXIT_PROFILE(sname); \
211 static struct ftrace_event_call __used \
212 __attribute__((__aligned__(4))) \
213 __attribute__((section("_ftrace_events"))) \
214 event_exit_##sname = { \
215 .name = "sys_exit"#sname, \
216 .system = "syscalls", \
217 .event = &event_syscall_exit, \
218 .raw_init = init_exit_##sname, \
219 .show_format = syscall_exit_format, \
220 .define_fields = syscall_exit_define_fields, \
221 .regfunc = reg_event_syscall_exit, \
222 .unregfunc = unreg_event_syscall_exit, \
223 .data = "sys"#sname, \
224 TRACE_SYS_EXIT_PROFILE_INIT(sname) \
225 }
226
115#define SYSCALL_METADATA(sname, nb) \ 227#define SYSCALL_METADATA(sname, nb) \
228 SYSCALL_TRACE_ENTER_EVENT(sname); \
229 SYSCALL_TRACE_EXIT_EVENT(sname); \
116 static const struct syscall_metadata __used \ 230 static const struct syscall_metadata __used \
117 __attribute__((__aligned__(4))) \ 231 __attribute__((__aligned__(4))) \
118 __attribute__((section("__syscalls_metadata"))) \ 232 __attribute__((section("__syscalls_metadata"))) \
@@ -121,18 +235,23 @@ struct perf_counter_attr;
121 .nb_args = nb, \ 235 .nb_args = nb, \
122 .types = types_##sname, \ 236 .types = types_##sname, \
123 .args = args_##sname, \ 237 .args = args_##sname, \
124 } 238 .enter_event = &event_enter_##sname, \
239 .exit_event = &event_exit_##sname, \
240 };
125 241
126#define SYSCALL_DEFINE0(sname) \ 242#define SYSCALL_DEFINE0(sname) \
243 SYSCALL_TRACE_ENTER_EVENT(_##sname); \
244 SYSCALL_TRACE_EXIT_EVENT(_##sname); \
127 static const struct syscall_metadata __used \ 245 static const struct syscall_metadata __used \
128 __attribute__((__aligned__(4))) \ 246 __attribute__((__aligned__(4))) \
129 __attribute__((section("__syscalls_metadata"))) \ 247 __attribute__((section("__syscalls_metadata"))) \
130 __syscall_meta_##sname = { \ 248 __syscall_meta_##sname = { \
131 .name = "sys_"#sname, \ 249 .name = "sys_"#sname, \
132 .nb_args = 0, \ 250 .nb_args = 0, \
251 .enter_event = &event_enter__##sname, \
252 .exit_event = &event_exit__##sname, \
133 }; \ 253 }; \
134 asmlinkage long sys_##sname(void) 254 asmlinkage long sys_##sname(void)
135
136#else 255#else
137#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void) 256#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void)
138#endif 257#endif
@@ -341,8 +460,7 @@ asmlinkage long sys_mount(char __user *dev_name, char __user *dir_name,
341 void __user *data); 460 void __user *data);
342asmlinkage long sys_umount(char __user *name, int flags); 461asmlinkage long sys_umount(char __user *name, int flags);
343asmlinkage long sys_oldumount(char __user *name); 462asmlinkage long sys_oldumount(char __user *name);
344asmlinkage long sys_truncate(const char __user *path, 463asmlinkage long sys_truncate(const char __user *path, long length);
345 unsigned long length);
346asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length); 464asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length);
347asmlinkage long sys_stat(char __user *filename, 465asmlinkage long sys_stat(char __user *filename,
348 struct __old_kernel_stat __user *statbuf); 466 struct __old_kernel_stat __user *statbuf);
@@ -758,7 +876,7 @@ asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int,
758int kernel_execve(const char *filename, char *const argv[], char *const envp[]); 876int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
759 877
760 878
761asmlinkage long sys_perf_counter_open( 879asmlinkage long sys_perf_event_open(
762 struct perf_counter_attr __user *attr_uptr, 880 struct perf_event_attr __user *attr_uptr,
763 pid_t pid, int cpu, int group_fd, unsigned long flags); 881 pid_t pid, int cpu, int group_fd, unsigned long flags);
764#endif 882#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index e76d3b22a466..1e4743ee6831 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -29,7 +29,6 @@
29#include <linux/types.h> 29#include <linux/types.h>
30#include <linux/compiler.h> 30#include <linux/compiler.h>
31 31
32struct file;
33struct completion; 32struct completion;
34 33
35#define CTL_MAXNAME 10 /* how many path components do we allow in a 34#define CTL_MAXNAME 10 /* how many path components do we allow in a
@@ -977,25 +976,25 @@ typedef int ctl_handler (struct ctl_table *table,
977 void __user *oldval, size_t __user *oldlenp, 976 void __user *oldval, size_t __user *oldlenp,
978 void __user *newval, size_t newlen); 977 void __user *newval, size_t newlen);
979 978
980typedef int proc_handler (struct ctl_table *ctl, int write, struct file * filp, 979typedef int proc_handler (struct ctl_table *ctl, int write,
981 void __user *buffer, size_t *lenp, loff_t *ppos); 980 void __user *buffer, size_t *lenp, loff_t *ppos);
982 981
983extern int proc_dostring(struct ctl_table *, int, struct file *, 982extern int proc_dostring(struct ctl_table *, int,
984 void __user *, size_t *, loff_t *); 983 void __user *, size_t *, loff_t *);
985extern int proc_dointvec(struct ctl_table *, int, struct file *, 984extern int proc_dointvec(struct ctl_table *, int,
986 void __user *, size_t *, loff_t *); 985 void __user *, size_t *, loff_t *);
987extern int proc_dointvec_minmax(struct ctl_table *, int, struct file *, 986extern int proc_dointvec_minmax(struct ctl_table *, int,
988 void __user *, size_t *, loff_t *); 987 void __user *, size_t *, loff_t *);
989extern int proc_dointvec_jiffies(struct ctl_table *, int, struct file *, 988extern int proc_dointvec_jiffies(struct ctl_table *, int,
990 void __user *, size_t *, loff_t *); 989 void __user *, size_t *, loff_t *);
991extern int proc_dointvec_userhz_jiffies(struct ctl_table *, int, struct file *, 990extern int proc_dointvec_userhz_jiffies(struct ctl_table *, int,
992 void __user *, size_t *, loff_t *); 991 void __user *, size_t *, loff_t *);
993extern int proc_dointvec_ms_jiffies(struct ctl_table *, int, struct file *, 992extern int proc_dointvec_ms_jiffies(struct ctl_table *, int,
994 void __user *, size_t *, loff_t *); 993 void __user *, size_t *, loff_t *);
995extern int proc_doulongvec_minmax(struct ctl_table *, int, struct file *, 994extern int proc_doulongvec_minmax(struct ctl_table *, int,
996 void __user *, size_t *, loff_t *); 995 void __user *, size_t *, loff_t *);
997extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int, 996extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int,
998 struct file *, void __user *, size_t *, loff_t *); 997 void __user *, size_t *, loff_t *);
999 998
1000extern int do_sysctl (int __user *name, int nlen, 999extern int do_sysctl (int __user *name, int nlen,
1001 void __user *oldval, size_t __user *oldlenp, 1000 void __user *oldval, size_t __user *oldlenp,
diff --git a/include/linux/taskstats_kern.h b/include/linux/taskstats_kern.h
index 7e9680f4afdd..3398f4553269 100644
--- a/include/linux/taskstats_kern.h
+++ b/include/linux/taskstats_kern.h
@@ -9,7 +9,6 @@
9 9
10#include <linux/taskstats.h> 10#include <linux/taskstats.h>
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <net/genetlink.h>
13 12
14#ifdef CONFIG_TASKSTATS 13#ifdef CONFIG_TASKSTATS
15extern struct kmem_cache *taskstats_cache; 14extern struct kmem_cache *taskstats_cache;
diff --git a/include/linux/tboot.h b/include/linux/tboot.h
new file mode 100644
index 000000000000..bf2a0c748878
--- /dev/null
+++ b/include/linux/tboot.h
@@ -0,0 +1,162 @@
1/*
2 * tboot.h: shared data structure with tboot and kernel and functions
3 * used by kernel for runtime support of Intel(R) Trusted
4 * Execution Technology
5 *
6 * Copyright (c) 2006-2009, Intel Corporation
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 */
22
23#ifndef _LINUX_TBOOT_H
24#define _LINUX_TBOOT_H
25
26/* these must have the values from 0-5 in this order */
27enum {
28 TB_SHUTDOWN_REBOOT = 0,
29 TB_SHUTDOWN_S5,
30 TB_SHUTDOWN_S4,
31 TB_SHUTDOWN_S3,
32 TB_SHUTDOWN_HALT,
33 TB_SHUTDOWN_WFS
34};
35
36#ifdef CONFIG_INTEL_TXT
37#include <acpi/acpi.h>
38/* used to communicate between tboot and the launched kernel */
39
40#define TB_KEY_SIZE 64 /* 512 bits */
41
42#define MAX_TB_MAC_REGIONS 32
43
44struct tboot_mac_region {
45 u64 start; /* must be 64 byte -aligned */
46 u32 size; /* must be 64 byte -granular */
47} __packed;
48
49/* GAS - Generic Address Structure (ACPI 2.0+) */
50struct tboot_acpi_generic_address {
51 u8 space_id;
52 u8 bit_width;
53 u8 bit_offset;
54 u8 access_width;
55 u64 address;
56} __packed;
57
58/*
59 * combines Sx info from FADT and FACS tables per ACPI 2.0+ spec
60 * (http://www.acpi.info/)
61 */
62struct tboot_acpi_sleep_info {
63 struct tboot_acpi_generic_address pm1a_cnt_blk;
64 struct tboot_acpi_generic_address pm1b_cnt_blk;
65 struct tboot_acpi_generic_address pm1a_evt_blk;
66 struct tboot_acpi_generic_address pm1b_evt_blk;
67 u16 pm1a_cnt_val;
68 u16 pm1b_cnt_val;
69 u64 wakeup_vector;
70 u32 vector_width;
71 u64 kernel_s3_resume_vector;
72} __packed;
73
74/*
75 * shared memory page used for communication between tboot and kernel
76 */
77struct tboot {
78 /*
79 * version 3+ fields:
80 */
81
82 /* TBOOT_UUID */
83 u8 uuid[16];
84
85 /* version number: 5 is current */
86 u32 version;
87
88 /* physical addr of tb_log_t log */
89 u32 log_addr;
90
91 /*
92 * physical addr of entry point for tboot shutdown and
93 * type of shutdown (TB_SHUTDOWN_*) being requested
94 */
95 u32 shutdown_entry;
96 u32 shutdown_type;
97
98 /* kernel-specified ACPI info for Sx shutdown */
99 struct tboot_acpi_sleep_info acpi_sinfo;
100
101 /* tboot location in memory (physical) */
102 u32 tboot_base;
103 u32 tboot_size;
104
105 /* memory regions (phys addrs) for tboot to MAC on S3 */
106 u8 num_mac_regions;
107 struct tboot_mac_region mac_regions[MAX_TB_MAC_REGIONS];
108
109
110 /*
111 * version 4+ fields:
112 */
113
114 /* symmetric key for use by kernel; will be encrypted on S3 */
115 u8 s3_key[TB_KEY_SIZE];
116
117
118 /*
119 * version 5+ fields:
120 */
121
122 /* used to 4byte-align num_in_wfs */
123 u8 reserved_align[3];
124
125 /* number of processors in wait-for-SIPI */
126 u32 num_in_wfs;
127} __packed;
128
129/*
130 * UUID for tboot data struct to facilitate matching
131 * defined as {663C8DFF-E8B3-4b82-AABF-19EA4D057A08} by tboot, which is
132 * represented as {} in the char array used here
133 */
134#define TBOOT_UUID {0xff, 0x8d, 0x3c, 0x66, 0xb3, 0xe8, 0x82, 0x4b, 0xbf,\
135 0xaa, 0x19, 0xea, 0x4d, 0x5, 0x7a, 0x8}
136
137extern struct tboot *tboot;
138
139static inline int tboot_enabled(void)
140{
141 return tboot != NULL;
142}
143
144extern void tboot_probe(void);
145extern void tboot_shutdown(u32 shutdown_type);
146extern void tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control);
147extern struct acpi_table_header *tboot_get_dmar_table(
148 struct acpi_table_header *dmar_tbl);
149extern int tboot_force_iommu(void);
150
151#else
152
153#define tboot_probe() do { } while (0)
154#define tboot_shutdown(shutdown_type) do { } while (0)
155#define tboot_sleep(sleep_state, pm1a_control, pm1b_control) \
156 do { } while (0)
157#define tboot_get_dmar_table(dmar_tbl) (dmar_tbl)
158#define tboot_force_iommu() 0
159
160#endif /* !CONFIG_INTEL_TXT */
161
162#endif /* _LINUX_TBOOT_H */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 8afac76cd748..61723a7c21fe 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -233,7 +233,7 @@ struct tcp_request_sock {
233 struct inet_request_sock req; 233 struct inet_request_sock req;
234#ifdef CONFIG_TCP_MD5SIG 234#ifdef CONFIG_TCP_MD5SIG
235 /* Only used by TCP MD5 Signature so far. */ 235 /* Only used by TCP MD5 Signature so far. */
236 struct tcp_request_sock_ops *af_specific; 236 const struct tcp_request_sock_ops *af_specific;
237#endif 237#endif
238 u32 rcv_isn; 238 u32 rcv_isn;
239 u32 snt_isn; 239 u32 snt_isn;
@@ -401,9 +401,9 @@ struct tcp_sock {
401 401
402#ifdef CONFIG_TCP_MD5SIG 402#ifdef CONFIG_TCP_MD5SIG
403/* TCP AF-Specific parts; only used by MD5 Signature support so far */ 403/* TCP AF-Specific parts; only used by MD5 Signature support so far */
404 struct tcp_sock_af_ops *af_specific; 404 const struct tcp_sock_af_ops *af_specific;
405 405
406/* TCP MD5 Signagure Option information */ 406/* TCP MD5 Signature Option information */
407 struct tcp_md5sig_info *md5sig_info; 407 struct tcp_md5sig_info *md5sig_info;
408#endif 408#endif
409}; 409};
diff --git a/include/linux/time.h b/include/linux/time.h
index ea16c1a01d51..fe04e5ef6a59 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -75,7 +75,7 @@ extern unsigned long mktime(const unsigned int year, const unsigned int mon,
75 const unsigned int day, const unsigned int hour, 75 const unsigned int day, const unsigned int hour,
76 const unsigned int min, const unsigned int sec); 76 const unsigned int min, const unsigned int sec);
77 77
78extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec); 78extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec);
79extern struct timespec timespec_add_safe(const struct timespec lhs, 79extern struct timespec timespec_add_safe(const struct timespec lhs,
80 const struct timespec rhs); 80 const struct timespec rhs);
81 81
@@ -101,7 +101,8 @@ extern struct timespec xtime;
101extern struct timespec wall_to_monotonic; 101extern struct timespec wall_to_monotonic;
102extern seqlock_t xtime_lock; 102extern seqlock_t xtime_lock;
103 103
104extern unsigned long read_persistent_clock(void); 104extern void read_persistent_clock(struct timespec *ts);
105extern void read_boot_clock(struct timespec *ts);
105extern int update_persistent_clock(struct timespec now); 106extern int update_persistent_clock(struct timespec now);
106extern int no_sync_cmos_clock __read_mostly; 107extern int no_sync_cmos_clock __read_mostly;
107void timekeeping_init(void); 108void timekeeping_init(void);
@@ -109,6 +110,8 @@ extern int timekeeping_suspended;
109 110
110unsigned long get_seconds(void); 111unsigned long get_seconds(void);
111struct timespec current_kernel_time(void); 112struct timespec current_kernel_time(void);
113struct timespec __current_kernel_time(void); /* does not hold xtime_lock */
114struct timespec get_monotonic_coarse(void);
112 115
113#define CURRENT_TIME (current_kernel_time()) 116#define CURRENT_TIME (current_kernel_time())
114#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 }) 117#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 })
@@ -147,10 +150,39 @@ extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
147extern int timekeeping_valid_for_hres(void); 150extern int timekeeping_valid_for_hres(void);
148extern void update_wall_time(void); 151extern void update_wall_time(void);
149extern void update_xtime_cache(u64 nsec); 152extern void update_xtime_cache(u64 nsec);
153extern void timekeeping_leap_insert(int leapsecond);
150 154
151struct tms; 155struct tms;
152extern void do_sys_times(struct tms *); 156extern void do_sys_times(struct tms *);
153 157
158/*
159 * Similar to the struct tm in userspace <time.h>, but it needs to be here so
160 * that the kernel source is self contained.
161 */
162struct tm {
163 /*
164 * the number of seconds after the minute, normally in the range
165 * 0 to 59, but can be up to 60 to allow for leap seconds
166 */
167 int tm_sec;
168 /* the number of minutes after the hour, in the range 0 to 59*/
169 int tm_min;
170 /* the number of hours past midnight, in the range 0 to 23 */
171 int tm_hour;
172 /* the day of the month, in the range 1 to 31 */
173 int tm_mday;
174 /* the number of months since January, in the range 0 to 11 */
175 int tm_mon;
176 /* the number of years since 1900 */
177 long tm_year;
178 /* the number of days since Sunday, in the range 0 to 6 */
179 int tm_wday;
180 /* the number of days since January 1, in the range 0 to 365 */
181 int tm_yday;
182};
183
184void time_to_tm(time_t totalsecs, int offset, struct tm *result);
185
154/** 186/**
155 * timespec_to_ns - Convert timespec to nanoseconds 187 * timespec_to_ns - Convert timespec to nanoseconds
156 * @ts: pointer to the timespec variable to be converted 188 * @ts: pointer to the timespec variable to be converted
@@ -241,6 +273,8 @@ struct itimerval {
241#define CLOCK_PROCESS_CPUTIME_ID 2 273#define CLOCK_PROCESS_CPUTIME_ID 2
242#define CLOCK_THREAD_CPUTIME_ID 3 274#define CLOCK_THREAD_CPUTIME_ID 3
243#define CLOCK_MONOTONIC_RAW 4 275#define CLOCK_MONOTONIC_RAW 4
276#define CLOCK_REALTIME_COARSE 5
277#define CLOCK_MONOTONIC_COARSE 6
244 278
245/* 279/*
246 * The IDs of various hardware clocks: 280 * The IDs of various hardware clocks:
diff --git a/include/linux/timer.h b/include/linux/timer.h
index be62ec2ebea5..a2d1eb6cb3f0 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -175,11 +175,6 @@ extern int mod_timer_pinned(struct timer_list *timer, unsigned long expires);
175 175
176/* 176/*
177 * Return when the next timer-wheel timeout occurs (in absolute jiffies), 177 * Return when the next timer-wheel timeout occurs (in absolute jiffies),
178 * locks the timer base:
179 */
180extern unsigned long next_timer_interrupt(void);
181/*
182 * Return when the next timer-wheel timeout occurs (in absolute jiffies),
183 * locks the timer base and does the comparison against the given 178 * locks the timer base and does the comparison against the given
184 * jiffie. 179 * jiffie.
185 */ 180 */
diff --git a/include/linux/tipc.h b/include/linux/tipc.h
index bea469455a0c..3d92396639de 100644
--- a/include/linux/tipc.h
+++ b/include/linux/tipc.h
@@ -209,5 +209,7 @@ struct sockaddr_tipc {
209#define TIPC_SRC_DROPPABLE 128 /* Default: 0 (resend congested msg) */ 209#define TIPC_SRC_DROPPABLE 128 /* Default: 0 (resend congested msg) */
210#define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */ 210#define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */
211#define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */ 211#define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */
212#define TIPC_NODE_RECVQ_DEPTH 131 /* Default: none (read only) */
213#define TIPC_SOCK_RECVQ_DEPTH 132 /* Default: none (read only) */
212 214
213#endif 215#endif
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 7402c1a27c4f..57e63579bfdd 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -85,20 +85,27 @@ int arch_update_cpu_topology(void);
85#define ARCH_HAS_SCHED_WAKE_IDLE 85#define ARCH_HAS_SCHED_WAKE_IDLE
86/* Common values for SMT siblings */ 86/* Common values for SMT siblings */
87#ifndef SD_SIBLING_INIT 87#ifndef SD_SIBLING_INIT
88#define SD_SIBLING_INIT (struct sched_domain) { \ 88#define SD_SIBLING_INIT (struct sched_domain) { \
89 .min_interval = 1, \ 89 .min_interval = 1, \
90 .max_interval = 2, \ 90 .max_interval = 2, \
91 .busy_factor = 64, \ 91 .busy_factor = 64, \
92 .imbalance_pct = 110, \ 92 .imbalance_pct = 110, \
93 .flags = SD_LOAD_BALANCE \ 93 \
94 | SD_BALANCE_NEWIDLE \ 94 .flags = 1*SD_LOAD_BALANCE \
95 | SD_BALANCE_FORK \ 95 | 1*SD_BALANCE_NEWIDLE \
96 | SD_BALANCE_EXEC \ 96 | 1*SD_BALANCE_EXEC \
97 | SD_WAKE_AFFINE \ 97 | 1*SD_BALANCE_FORK \
98 | SD_WAKE_BALANCE \ 98 | 0*SD_BALANCE_WAKE \
99 | SD_SHARE_CPUPOWER, \ 99 | 1*SD_WAKE_AFFINE \
100 .last_balance = jiffies, \ 100 | 1*SD_SHARE_CPUPOWER \
101 .balance_interval = 1, \ 101 | 0*SD_POWERSAVINGS_BALANCE \
102 | 0*SD_SHARE_PKG_RESOURCES \
103 | 0*SD_SERIALIZE \
104 | 0*SD_PREFER_SIBLING \
105 , \
106 .last_balance = jiffies, \
107 .balance_interval = 1, \
108 .smt_gain = 1178, /* 15% */ \
102} 109}
103#endif 110#endif
104#endif /* CONFIG_SCHED_SMT */ 111#endif /* CONFIG_SCHED_SMT */
@@ -106,69 +113,90 @@ int arch_update_cpu_topology(void);
106#ifdef CONFIG_SCHED_MC 113#ifdef CONFIG_SCHED_MC
107/* Common values for MC siblings. for now mostly derived from SD_CPU_INIT */ 114/* Common values for MC siblings. for now mostly derived from SD_CPU_INIT */
108#ifndef SD_MC_INIT 115#ifndef SD_MC_INIT
109#define SD_MC_INIT (struct sched_domain) { \ 116#define SD_MC_INIT (struct sched_domain) { \
110 .min_interval = 1, \ 117 .min_interval = 1, \
111 .max_interval = 4, \ 118 .max_interval = 4, \
112 .busy_factor = 64, \ 119 .busy_factor = 64, \
113 .imbalance_pct = 125, \ 120 .imbalance_pct = 125, \
114 .cache_nice_tries = 1, \ 121 .cache_nice_tries = 1, \
115 .busy_idx = 2, \ 122 .busy_idx = 2, \
116 .wake_idx = 1, \ 123 .wake_idx = 0, \
117 .forkexec_idx = 1, \ 124 .forkexec_idx = 0, \
118 .flags = SD_LOAD_BALANCE \ 125 \
119 | SD_BALANCE_FORK \ 126 .flags = 1*SD_LOAD_BALANCE \
120 | SD_BALANCE_EXEC \ 127 | 1*SD_BALANCE_NEWIDLE \
121 | SD_WAKE_AFFINE \ 128 | 1*SD_BALANCE_EXEC \
122 | SD_WAKE_BALANCE \ 129 | 1*SD_BALANCE_FORK \
123 | SD_SHARE_PKG_RESOURCES\ 130 | 0*SD_BALANCE_WAKE \
124 | sd_balance_for_mc_power()\ 131 | 1*SD_WAKE_AFFINE \
125 | sd_power_saving_flags(),\ 132 | 0*SD_PREFER_LOCAL \
126 .last_balance = jiffies, \ 133 | 0*SD_SHARE_CPUPOWER \
127 .balance_interval = 1, \ 134 | 1*SD_SHARE_PKG_RESOURCES \
135 | 0*SD_SERIALIZE \
136 | sd_balance_for_mc_power() \
137 | sd_power_saving_flags() \
138 , \
139 .last_balance = jiffies, \
140 .balance_interval = 1, \
128} 141}
129#endif 142#endif
130#endif /* CONFIG_SCHED_MC */ 143#endif /* CONFIG_SCHED_MC */
131 144
132/* Common values for CPUs */ 145/* Common values for CPUs */
133#ifndef SD_CPU_INIT 146#ifndef SD_CPU_INIT
134#define SD_CPU_INIT (struct sched_domain) { \ 147#define SD_CPU_INIT (struct sched_domain) { \
135 .min_interval = 1, \ 148 .min_interval = 1, \
136 .max_interval = 4, \ 149 .max_interval = 4, \
137 .busy_factor = 64, \ 150 .busy_factor = 64, \
138 .imbalance_pct = 125, \ 151 .imbalance_pct = 125, \
139 .cache_nice_tries = 1, \ 152 .cache_nice_tries = 1, \
140 .busy_idx = 2, \ 153 .busy_idx = 2, \
141 .idle_idx = 1, \ 154 .idle_idx = 1, \
142 .newidle_idx = 2, \ 155 .newidle_idx = 0, \
143 .wake_idx = 1, \ 156 .wake_idx = 0, \
144 .forkexec_idx = 1, \ 157 .forkexec_idx = 0, \
145 .flags = SD_LOAD_BALANCE \ 158 \
146 | SD_BALANCE_EXEC \ 159 .flags = 1*SD_LOAD_BALANCE \
147 | SD_BALANCE_FORK \ 160 | 1*SD_BALANCE_NEWIDLE \
148 | SD_WAKE_AFFINE \ 161 | 1*SD_BALANCE_EXEC \
149 | SD_WAKE_BALANCE \ 162 | 1*SD_BALANCE_FORK \
150 | sd_balance_for_package_power()\ 163 | 0*SD_BALANCE_WAKE \
151 | sd_power_saving_flags(),\ 164 | 1*SD_WAKE_AFFINE \
152 .last_balance = jiffies, \ 165 | 0*SD_PREFER_LOCAL \
153 .balance_interval = 1, \ 166 | 0*SD_SHARE_CPUPOWER \
167 | 0*SD_SHARE_PKG_RESOURCES \
168 | 0*SD_SERIALIZE \
169 | sd_balance_for_package_power() \
170 | sd_power_saving_flags() \
171 , \
172 .last_balance = jiffies, \
173 .balance_interval = 1, \
154} 174}
155#endif 175#endif
156 176
157/* sched_domains SD_ALLNODES_INIT for NUMA machines */ 177/* sched_domains SD_ALLNODES_INIT for NUMA machines */
158#define SD_ALLNODES_INIT (struct sched_domain) { \ 178#define SD_ALLNODES_INIT (struct sched_domain) { \
159 .min_interval = 64, \ 179 .min_interval = 64, \
160 .max_interval = 64*num_online_cpus(), \ 180 .max_interval = 64*num_online_cpus(), \
161 .busy_factor = 128, \ 181 .busy_factor = 128, \
162 .imbalance_pct = 133, \ 182 .imbalance_pct = 133, \
163 .cache_nice_tries = 1, \ 183 .cache_nice_tries = 1, \
164 .busy_idx = 3, \ 184 .busy_idx = 3, \
165 .idle_idx = 3, \ 185 .idle_idx = 3, \
166 .flags = SD_LOAD_BALANCE \ 186 .flags = 1*SD_LOAD_BALANCE \
167 | SD_BALANCE_NEWIDLE \ 187 | 1*SD_BALANCE_NEWIDLE \
168 | SD_WAKE_AFFINE \ 188 | 0*SD_BALANCE_EXEC \
169 | SD_SERIALIZE, \ 189 | 0*SD_BALANCE_FORK \
170 .last_balance = jiffies, \ 190 | 0*SD_BALANCE_WAKE \
171 .balance_interval = 64, \ 191 | 0*SD_WAKE_AFFINE \
192 | 0*SD_SHARE_CPUPOWER \
193 | 0*SD_POWERSAVINGS_BALANCE \
194 | 0*SD_SHARE_PKG_RESOURCES \
195 | 1*SD_SERIALIZE \
196 | 0*SD_PREFER_SIBLING \
197 , \
198 .last_balance = jiffies, \
199 .balance_interval = 64, \
172} 200}
173 201
174#ifdef CONFIG_NUMA 202#ifdef CONFIG_NUMA
@@ -183,12 +211,6 @@ int arch_update_cpu_topology(void);
183#ifndef topology_core_id 211#ifndef topology_core_id
184#define topology_core_id(cpu) ((void)(cpu), 0) 212#define topology_core_id(cpu) ((void)(cpu), 0)
185#endif 213#endif
186#ifndef topology_thread_siblings
187#define topology_thread_siblings(cpu) cpumask_of_cpu(cpu)
188#endif
189#ifndef topology_core_siblings
190#define topology_core_siblings(cpu) cpumask_of_cpu(cpu)
191#endif
192#ifndef topology_thread_cpumask 214#ifndef topology_thread_cpumask
193#define topology_thread_cpumask(cpu) cpumask_of(cpu) 215#define topology_thread_cpumask(cpu) cpumask_of(cpu)
194#endif 216#endif
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
index c134dd1fe6b6..09077f6ed128 100644
--- a/include/linux/trace_seq.h
+++ b/include/linux/trace_seq.h
@@ -7,7 +7,7 @@
7 7
8/* 8/*
9 * Trace sequences are used to allow a function to call several other functions 9 * Trace sequences are used to allow a function to call several other functions
10 * to create a string of data to use (up to a max of PAGE_SIZE. 10 * to create a string of data to use (up to a max of PAGE_SIZE).
11 */ 11 */
12 12
13struct trace_seq { 13struct trace_seq {
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 17ba82efa483..1eb44a924e56 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Tracing hooks 2 * Tracing hooks
3 * 3 *
4 * Copyright (C) 2008 Red Hat, Inc. All rights reserved. 4 * Copyright (C) 2008-2009 Red Hat, Inc. All rights reserved.
5 * 5 *
6 * This copyrighted material is made available to anyone wishing to use, 6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions 7 * modify, copy, or redistribute it subject to the terms and conditions
@@ -463,22 +463,38 @@ static inline int tracehook_get_signal(struct task_struct *task,
463 463
464/** 464/**
465 * tracehook_notify_jctl - report about job control stop/continue 465 * tracehook_notify_jctl - report about job control stop/continue
466 * @notify: nonzero if this is the last thread in the group to stop 466 * @notify: zero, %CLD_STOPPED or %CLD_CONTINUED
467 * @why: %CLD_STOPPED or %CLD_CONTINUED 467 * @why: %CLD_STOPPED or %CLD_CONTINUED
468 * 468 *
469 * This is called when we might call do_notify_parent_cldstop(). 469 * This is called when we might call do_notify_parent_cldstop().
470 * It's called when about to stop for job control; we are already in
471 * %TASK_STOPPED state, about to call schedule(). It's also called when
472 * a delayed %CLD_STOPPED or %CLD_CONTINUED report is ready to be made.
473 * 470 *
474 * Return nonzero to generate a %SIGCHLD with @why, which is 471 * @notify is zero if we would not ordinarily send a %SIGCHLD,
475 * normal if @notify is nonzero. 472 * or is the %CLD_STOPPED or %CLD_CONTINUED .si_code for %SIGCHLD.
476 * 473 *
477 * Called with no locks held. 474 * @why is %CLD_STOPPED when about to stop for job control;
475 * we are already in %TASK_STOPPED state, about to call schedule().
476 * It might also be that we have just exited (check %PF_EXITING),
477 * but need to report that a group-wide stop is complete.
478 *
479 * @why is %CLD_CONTINUED when waking up after job control stop and
480 * ready to make a delayed @notify report.
481 *
482 * Return the %CLD_* value for %SIGCHLD, or zero to generate no signal.
483 *
484 * Called with the siglock held.
478 */ 485 */
479static inline int tracehook_notify_jctl(int notify, int why) 486static inline int tracehook_notify_jctl(int notify, int why)
480{ 487{
481 return notify || (current->ptrace & PT_PTRACED); 488 return notify ?: (current->ptrace & PT_PTRACED) ? why : 0;
489}
490
491/**
492 * tracehook_finish_jctl - report about return from job control stop
493 *
494 * This is called by do_signal_stop() after wakeup.
495 */
496static inline void tracehook_finish_jctl(void)
497{
482} 498}
483 499
484#define DEATH_REAP -1 500#define DEATH_REAP -1
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index b9dc4ca0246f..2aac8a83e89b 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -4,7 +4,7 @@
4/* 4/*
5 * Kernel Tracepoint API. 5 * Kernel Tracepoint API.
6 * 6 *
7 * See Documentation/tracepoint.txt. 7 * See Documentation/trace/tracepoints.txt.
8 * 8 *
9 * (C) Copyright 2008 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> 9 * (C) Copyright 2008 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
10 * 10 *
@@ -23,6 +23,8 @@ struct tracepoint;
23struct tracepoint { 23struct tracepoint {
24 const char *name; /* Tracepoint name */ 24 const char *name; /* Tracepoint name */
25 int state; /* State. */ 25 int state; /* State. */
26 void (*regfunc)(void);
27 void (*unregfunc)(void);
26 void **funcs; 28 void **funcs;
27} __attribute__((aligned(32))); /* 29} __attribute__((aligned(32))); /*
28 * Aligned on 32 bytes because it is 30 * Aligned on 32 bytes because it is
@@ -34,7 +36,7 @@ struct tracepoint {
34#ifndef DECLARE_TRACE 36#ifndef DECLARE_TRACE
35 37
36#define TP_PROTO(args...) args 38#define TP_PROTO(args...) args
37#define TP_ARGS(args...) args 39#define TP_ARGS(args...) args
38 40
39#ifdef CONFIG_TRACEPOINTS 41#ifdef CONFIG_TRACEPOINTS
40 42
@@ -78,12 +80,16 @@ struct tracepoint {
78 return tracepoint_probe_unregister(#name, (void *)probe);\ 80 return tracepoint_probe_unregister(#name, (void *)probe);\
79 } 81 }
80 82
81#define DEFINE_TRACE(name) \ 83
84#define DEFINE_TRACE_FN(name, reg, unreg) \
82 static const char __tpstrtab_##name[] \ 85 static const char __tpstrtab_##name[] \
83 __attribute__((section("__tracepoints_strings"))) = #name; \ 86 __attribute__((section("__tracepoints_strings"))) = #name; \
84 struct tracepoint __tracepoint_##name \ 87 struct tracepoint __tracepoint_##name \
85 __attribute__((section("__tracepoints"), aligned(32))) = \ 88 __attribute__((section("__tracepoints"), aligned(32))) = \
86 { __tpstrtab_##name, 0, NULL } 89 { __tpstrtab_##name, 0, reg, unreg, NULL }
90
91#define DEFINE_TRACE(name) \
92 DEFINE_TRACE_FN(name, NULL, NULL);
87 93
88#define EXPORT_TRACEPOINT_SYMBOL_GPL(name) \ 94#define EXPORT_TRACEPOINT_SYMBOL_GPL(name) \
89 EXPORT_SYMBOL_GPL(__tracepoint_##name) 95 EXPORT_SYMBOL_GPL(__tracepoint_##name)
@@ -108,6 +114,7 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin,
108 return -ENOSYS; \ 114 return -ENOSYS; \
109 } 115 }
110 116
117#define DEFINE_TRACE_FN(name, reg, unreg)
111#define DEFINE_TRACE(name) 118#define DEFINE_TRACE(name)
112#define EXPORT_TRACEPOINT_SYMBOL_GPL(name) 119#define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
113#define EXPORT_TRACEPOINT_SYMBOL(name) 120#define EXPORT_TRACEPOINT_SYMBOL(name)
@@ -158,6 +165,15 @@ static inline void tracepoint_synchronize_unregister(void)
158 165
159#define PARAMS(args...) args 166#define PARAMS(args...) args
160 167
168#endif /* _LINUX_TRACEPOINT_H */
169
170/*
171 * Note: we keep the TRACE_EVENT outside the include file ifdef protection.
172 * This is due to the way trace events work. If a file includes two
173 * trace event headers under one "CREATE_TRACE_POINTS" the first include
174 * will override the TRACE_EVENT and break the second include.
175 */
176
161#ifndef TRACE_EVENT 177#ifndef TRACE_EVENT
162/* 178/*
163 * For use with the TRACE_EVENT macro: 179 * For use with the TRACE_EVENT macro:
@@ -259,10 +275,15 @@ static inline void tracepoint_synchronize_unregister(void)
259 * can also by used by generic instrumentation like SystemTap), and 275 * can also by used by generic instrumentation like SystemTap), and
260 * it is also used to expose a structured trace record in 276 * it is also used to expose a structured trace record in
261 * /sys/kernel/debug/tracing/events/. 277 * /sys/kernel/debug/tracing/events/.
278 *
279 * A set of (un)registration functions can be passed to the variant
280 * TRACE_EVENT_FN to perform any (un)registration work.
262 */ 281 */
263 282
264#define TRACE_EVENT(name, proto, args, struct, assign, print) \ 283#define TRACE_EVENT(name, proto, args, struct, assign, print) \
265 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) 284 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
266#endif 285#define TRACE_EVENT_FN(name, proto, args, struct, \
286 assign, print, reg, unreg) \
287 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
267 288
268#endif 289#endif /* ifdef TRACE_EVENT (see note above) */
diff --git a/include/linux/transport_class.h b/include/linux/transport_class.h
index eaec1ea9558e..9ae8da3e6407 100644
--- a/include/linux/transport_class.h
+++ b/include/linux/transport_class.h
@@ -55,7 +55,7 @@ struct anon_transport_class cls = { \
55 55
56struct transport_container { 56struct transport_container {
57 struct attribute_container ac; 57 struct attribute_container ac;
58 struct attribute_group *statistics; 58 const struct attribute_group *statistics;
59}; 59};
60 60
61#define attribute_container_to_transport_container(x) \ 61#define attribute_container_to_transport_container(x) \
diff --git a/include/linux/tty.h b/include/linux/tty.h
index e8c6c9136c97..f0f43d08d8b8 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -23,7 +23,7 @@
23 */ 23 */
24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ 24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ 25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
26#define NR_LDISCS 19 26#define NR_LDISCS 20
27 27
28/* line disciplines */ 28/* line disciplines */
29#define N_TTY 0 29#define N_TTY 0
@@ -47,6 +47,8 @@
47#define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */ 47#define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */
48#define N_PPS 18 /* Pulse per Second */ 48#define N_PPS 18 /* Pulse per Second */
49 49
50#define N_V253 19 /* Codec control over voice modem */
51
50/* 52/*
51 * This character is the same as _POSIX_VDISABLE: it cannot be used as 53 * This character is the same as _POSIX_VDISABLE: it cannot be used as
52 * a c_cc[] character, but indicates that a particular special character 54 * a c_cc[] character, but indicates that a particular special character
@@ -185,7 +187,12 @@ struct tty_port;
185struct tty_port_operations { 187struct tty_port_operations {
186 /* Return 1 if the carrier is raised */ 188 /* Return 1 if the carrier is raised */
187 int (*carrier_raised)(struct tty_port *port); 189 int (*carrier_raised)(struct tty_port *port);
190 /* Control the DTR line */
188 void (*dtr_rts)(struct tty_port *port, int raise); 191 void (*dtr_rts)(struct tty_port *port, int raise);
192 /* Called when the last close completes or a hangup finishes
193 IFF the port was initialized. Do not use to free resources */
194 void (*shutdown)(struct tty_port *port);
195 void (*drop)(struct tty_port *port);
189}; 196};
190 197
191struct tty_port { 198struct tty_port {
@@ -196,11 +203,12 @@ struct tty_port {
196 int count; /* Usage count */ 203 int count; /* Usage count */
197 wait_queue_head_t open_wait; /* Open waiters */ 204 wait_queue_head_t open_wait; /* Open waiters */
198 wait_queue_head_t close_wait; /* Close waiters */ 205 wait_queue_head_t close_wait; /* Close waiters */
206 wait_queue_head_t delta_msr_wait; /* Modem status change */
199 unsigned long flags; /* TTY flags ASY_*/ 207 unsigned long flags; /* TTY flags ASY_*/
200 struct mutex mutex; /* Locking */ 208 struct mutex mutex; /* Locking */
201 unsigned char *xmit_buf; /* Optional buffer */ 209 unsigned char *xmit_buf; /* Optional buffer */
202 int close_delay; /* Close port delay */ 210 unsigned int close_delay; /* Close port delay */
203 int closing_wait; /* Delay for output */ 211 unsigned int closing_wait; /* Delay for output */
204 int drain_delay; /* Set to zero if no pure time 212 int drain_delay; /* Set to zero if no pure time
205 based drain is needed else 213 based drain is needed else
206 set to size of fifo */ 214 set to size of fifo */
@@ -457,6 +465,12 @@ extern int tty_port_block_til_ready(struct tty_port *port,
457extern int tty_port_close_start(struct tty_port *port, 465extern int tty_port_close_start(struct tty_port *port,
458 struct tty_struct *tty, struct file *filp); 466 struct tty_struct *tty, struct file *filp);
459extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty); 467extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty);
468extern void tty_port_close(struct tty_port *port,
469 struct tty_struct *tty, struct file *filp);
470extern inline int tty_port_users(struct tty_port *port)
471{
472 return port->count + port->blocked_open;
473}
460 474
461extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc); 475extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
462extern int tty_unregister_ldisc(int disc); 476extern int tty_unregister_ldisc(int disc);
@@ -517,14 +531,13 @@ extern void serial_console_init(void);
517 531
518extern int pcxe_open(struct tty_struct *tty, struct file *filp); 532extern int pcxe_open(struct tty_struct *tty, struct file *filp);
519 533
520/* printk.c */
521
522extern void console_print(const char *);
523
524/* vt.c */ 534/* vt.c */
525 535
526extern int vt_ioctl(struct tty_struct *tty, struct file *file, 536extern int vt_ioctl(struct tty_struct *tty, struct file *file,
527 unsigned int cmd, unsigned long arg); 537 unsigned int cmd, unsigned long arg);
528 538
539extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file,
540 unsigned int cmd, unsigned long arg);
541
529#endif /* __KERNEL__ */ 542#endif /* __KERNEL__ */
530#endif 543#endif
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 3566129384a4..b08677982525 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -45,8 +45,16 @@
45 * 45 *
46 * void (*shutdown)(struct tty_struct * tty); 46 * void (*shutdown)(struct tty_struct * tty);
47 * 47 *
48 * This routine is called when a particular tty device is closed for 48 * This routine is called synchronously when a particular tty device
49 * the last time freeing up the resources. 49 * is closed for the last time freeing up the resources.
50 *
51 *
52 * void (*cleanup)(struct tty_struct * tty);
53 *
54 * This routine is called asynchronously when a particular tty device
55 * is closed for the last time freeing up the resources. This is
56 * actually the second part of shutdown for routines that might sleep.
57 *
50 * 58 *
51 * int (*write)(struct tty_struct * tty, 59 * int (*write)(struct tty_struct * tty,
52 * const unsigned char *buf, int count); 60 * const unsigned char *buf, int count);
@@ -233,6 +241,7 @@ struct tty_operations {
233 int (*open)(struct tty_struct * tty, struct file * filp); 241 int (*open)(struct tty_struct * tty, struct file * filp);
234 void (*close)(struct tty_struct * tty, struct file * filp); 242 void (*close)(struct tty_struct * tty, struct file * filp);
235 void (*shutdown)(struct tty_struct *tty); 243 void (*shutdown)(struct tty_struct *tty);
244 void (*cleanup)(struct tty_struct *tty);
236 int (*write)(struct tty_struct * tty, 245 int (*write)(struct tty_struct * tty,
237 const unsigned char *buf, int count); 246 const unsigned char *buf, int count);
238 int (*put_char)(struct tty_struct *tty, unsigned char ch); 247 int (*put_char)(struct tty_struct *tty, unsigned char ch);
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h
index ae779bb8cc0f..adb44066680c 100644
--- a/include/linux/ucb1400.h
+++ b/include/linux/ucb1400.h
@@ -26,6 +26,7 @@
26#include <sound/ac97_codec.h> 26#include <sound/ac97_codec.h>
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/gpio.h>
29 30
30/* 31/*
31 * UCB1400 AC-link registers 32 * UCB1400 AC-link registers
@@ -82,6 +83,17 @@
82#define UCB_ID 0x7e 83#define UCB_ID 0x7e
83#define UCB_ID_1400 0x4304 84#define UCB_ID_1400 0x4304
84 85
86struct ucb1400_gpio_data {
87 int gpio_offset;
88 int (*gpio_setup)(struct device *dev, int ngpio);
89 int (*gpio_teardown)(struct device *dev, int ngpio);
90};
91
92struct ucb1400_gpio {
93 struct gpio_chip gc;
94 struct snd_ac97 *ac97;
95};
96
85struct ucb1400_ts { 97struct ucb1400_ts {
86 struct input_dev *ts_idev; 98 struct input_dev *ts_idev;
87 struct task_struct *ts_task; 99 struct task_struct *ts_task;
@@ -95,6 +107,7 @@ struct ucb1400_ts {
95 107
96struct ucb1400 { 108struct ucb1400 {
97 struct platform_device *ucb1400_ts; 109 struct platform_device *ucb1400_ts;
110 struct platform_device *ucb1400_gpio;
98}; 111};
99 112
100static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg) 113static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg)
@@ -147,4 +160,10 @@ static inline void ucb1400_adc_disable(struct snd_ac97 *ac97)
147unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel, 160unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel,
148 int adcsync); 161 int adcsync);
149 162
163#ifdef CONFIG_GPIO_UCB1400
164void __init ucb1400_gpio_set_data(struct ucb1400_gpio_data *data);
165#else
166static inline void ucb1400_gpio_set_data(struct ucb1400_gpio_data *data) {}
167#endif
168
150#endif 169#endif
diff --git a/include/linux/unaligned/be_byteshift.h b/include/linux/unaligned/be_byteshift.h
index 46dd12c5709e..9356b24223ac 100644
--- a/include/linux/unaligned/be_byteshift.h
+++ b/include/linux/unaligned/be_byteshift.h
@@ -1,7 +1,7 @@
1#ifndef _LINUX_UNALIGNED_BE_BYTESHIFT_H 1#ifndef _LINUX_UNALIGNED_BE_BYTESHIFT_H
2#define _LINUX_UNALIGNED_BE_BYTESHIFT_H 2#define _LINUX_UNALIGNED_BE_BYTESHIFT_H
3 3
4#include <linux/kernel.h> 4#include <linux/types.h>
5 5
6static inline u16 __get_unaligned_be16(const u8 *p) 6static inline u16 __get_unaligned_be16(const u8 *p)
7{ 7{
diff --git a/include/linux/unaligned/le_byteshift.h b/include/linux/unaligned/le_byteshift.h
index 59777e951baf..be376fb79b64 100644
--- a/include/linux/unaligned/le_byteshift.h
+++ b/include/linux/unaligned/le_byteshift.h
@@ -1,7 +1,7 @@
1#ifndef _LINUX_UNALIGNED_LE_BYTESHIFT_H 1#ifndef _LINUX_UNALIGNED_LE_BYTESHIFT_H
2#define _LINUX_UNALIGNED_LE_BYTESHIFT_H 2#define _LINUX_UNALIGNED_LE_BYTESHIFT_H
3 3
4#include <linux/kernel.h> 4#include <linux/types.h>
5 5
6static inline u16 __get_unaligned_le16(const u8 *p) 6static inline u16 __get_unaligned_le16(const u8 *p)
7{ 7{
diff --git a/include/linux/usb.h b/include/linux/usb.h
index b1e3c2fbfe11..a34fa89f1474 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -195,7 +195,7 @@ struct usb_interface {
195 195
196 struct device dev; /* interface specific device info */ 196 struct device dev; /* interface specific device info */
197 struct device *usb_dev; 197 struct device *usb_dev;
198 int pm_usage_cnt; /* usage counter for autosuspend */ 198 atomic_t pm_usage_cnt; /* usage counter for autosuspend */
199 struct work_struct reset_ws; /* for resets in atomic context */ 199 struct work_struct reset_ws; /* for resets in atomic context */
200}; 200};
201#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 201#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
@@ -551,13 +551,13 @@ extern void usb_autopm_put_interface_async(struct usb_interface *intf);
551 551
552static inline void usb_autopm_enable(struct usb_interface *intf) 552static inline void usb_autopm_enable(struct usb_interface *intf)
553{ 553{
554 intf->pm_usage_cnt = 0; 554 atomic_set(&intf->pm_usage_cnt, 0);
555 usb_autopm_set_interface(intf); 555 usb_autopm_set_interface(intf);
556} 556}
557 557
558static inline void usb_autopm_disable(struct usb_interface *intf) 558static inline void usb_autopm_disable(struct usb_interface *intf)
559{ 559{
560 intf->pm_usage_cnt = 1; 560 atomic_set(&intf->pm_usage_cnt, 1);
561 usb_autopm_set_interface(intf); 561 usb_autopm_set_interface(intf);
562} 562}
563 563
@@ -922,7 +922,7 @@ extern struct bus_type usb_bus_type;
922/** 922/**
923 * struct usb_class_driver - identifies a USB driver that wants to use the USB major number 923 * struct usb_class_driver - identifies a USB driver that wants to use the USB major number
924 * @name: the usb class device name for this driver. Will show up in sysfs. 924 * @name: the usb class device name for this driver. Will show up in sysfs.
925 * @nodename: Callback to provide a naming hint for a possible 925 * @devnode: Callback to provide a naming hint for a possible
926 * device node to create. 926 * device node to create.
927 * @fops: pointer to the struct file_operations of this driver. 927 * @fops: pointer to the struct file_operations of this driver.
928 * @minor_base: the start of the minor range for this driver. 928 * @minor_base: the start of the minor range for this driver.
@@ -933,7 +933,7 @@ extern struct bus_type usb_bus_type;
933 */ 933 */
934struct usb_class_driver { 934struct usb_class_driver {
935 char *name; 935 char *name;
936 char *(*nodename)(struct device *dev); 936 char *(*devnode)(struct device *dev, mode_t *mode);
937 const struct file_operations *fops; 937 const struct file_operations *fops;
938 int minor_base; 938 int minor_base;
939}; 939};
@@ -1036,9 +1036,10 @@ typedef void (*usb_complete_t)(struct urb *);
1036 * @transfer_flags: A variety of flags may be used to affect how URB 1036 * @transfer_flags: A variety of flags may be used to affect how URB
1037 * submission, unlinking, or operation are handled. Different 1037 * submission, unlinking, or operation are handled. Different
1038 * kinds of URB can use different flags. 1038 * kinds of URB can use different flags.
1039 * @transfer_buffer: This identifies the buffer to (or from) which 1039 * @transfer_buffer: This identifies the buffer to (or from) which the I/O
1040 * the I/O request will be performed (unless URB_NO_TRANSFER_DMA_MAP 1040 * request will be performed unless URB_NO_TRANSFER_DMA_MAP is set
1041 * is set). This buffer must be suitable for DMA; allocate it with 1041 * (however, do not leave garbage in transfer_buffer even then).
1042 * This buffer must be suitable for DMA; allocate it with
1042 * kmalloc() or equivalent. For transfers to "in" endpoints, contents 1043 * kmalloc() or equivalent. For transfers to "in" endpoints, contents
1043 * of this buffer will be modified. This buffer is used for the data 1044 * of this buffer will be modified. This buffer is used for the data
1044 * stage of control transfers. 1045 * stage of control transfers.
@@ -1071,7 +1072,7 @@ typedef void (*usb_complete_t)(struct urb *);
1071 * @start_frame: Returns the initial frame for isochronous transfers. 1072 * @start_frame: Returns the initial frame for isochronous transfers.
1072 * @number_of_packets: Lists the number of ISO transfer buffers. 1073 * @number_of_packets: Lists the number of ISO transfer buffers.
1073 * @interval: Specifies the polling interval for interrupt or isochronous 1074 * @interval: Specifies the polling interval for interrupt or isochronous
1074 * transfers. The units are frames (milliseconds) for for full and low 1075 * transfers. The units are frames (milliseconds) for full and low
1075 * speed devices, and microframes (1/8 millisecond) for highspeed ones. 1076 * speed devices, and microframes (1/8 millisecond) for highspeed ones.
1076 * @error_count: Returns the number of ISO transfers that reported errors. 1077 * @error_count: Returns the number of ISO transfers that reported errors.
1077 * @context: For use in completion functions. This normally points to 1078 * @context: For use in completion functions. This normally points to
@@ -1104,9 +1105,15 @@ typedef void (*usb_complete_t)(struct urb *);
1104 * allocate a DMA buffer with usb_buffer_alloc() or call usb_buffer_map(). 1105 * allocate a DMA buffer with usb_buffer_alloc() or call usb_buffer_map().
1105 * When these transfer flags are provided, host controller drivers will 1106 * When these transfer flags are provided, host controller drivers will
1106 * attempt to use the dma addresses found in the transfer_dma and/or 1107 * attempt to use the dma addresses found in the transfer_dma and/or
1107 * setup_dma fields rather than determining a dma address themselves. (Note 1108 * setup_dma fields rather than determining a dma address themselves.
1108 * that transfer_buffer and setup_packet must still be set because not all 1109 *
1109 * host controllers use DMA, nor do virtual root hubs). 1110 * Note that transfer_buffer must still be set if the controller
1111 * does not support DMA (as indicated by bus.uses_dma) and when talking
1112 * to root hub. If you have to trasfer between highmem zone and the device
1113 * on such controller, create a bounce buffer or bail out with an error.
1114 * If transfer_buffer cannot be set (is in highmem) and the controller is DMA
1115 * capable, assign NULL to it, so that usbmon knows not to use the value.
1116 * The setup_packet must always be set, so it cannot be located in highmem.
1110 * 1117 *
1111 * Initialization: 1118 * Initialization:
1112 * 1119 *
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index b5744bc218ab..eaf9dffe0a01 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -24,88 +24,78 @@
24#define USB_SUBCLASS_AUDIOCONTROL 0x01 24#define USB_SUBCLASS_AUDIOCONTROL 0x01
25#define USB_SUBCLASS_AUDIOSTREAMING 0x02 25#define USB_SUBCLASS_AUDIOSTREAMING 0x02
26#define USB_SUBCLASS_MIDISTREAMING 0x03 26#define USB_SUBCLASS_MIDISTREAMING 0x03
27#define USB_SUBCLASS_VENDOR_SPEC 0xff 27
28 28/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */
29/* A.5 Audio Class-Specific AC interface Descriptor Subtypes*/ 29#define UAC_HEADER 0x01
30#define HEADER 0x01 30#define UAC_INPUT_TERMINAL 0x02
31#define INPUT_TERMINAL 0x02 31#define UAC_OUTPUT_TERMINAL 0x03
32#define OUTPUT_TERMINAL 0x03 32#define UAC_MIXER_UNIT 0x04
33#define MIXER_UNIT 0x04 33#define UAC_SELECTOR_UNIT 0x05
34#define SELECTOR_UNIT 0x05 34#define UAC_FEATURE_UNIT 0x06
35#define FEATURE_UNIT 0x06 35#define UAC_PROCESSING_UNIT 0x07
36#define PROCESSING_UNIT 0x07 36#define UAC_EXTENSION_UNIT 0x08
37#define EXTENSION_UNIT 0x08 37
38 38/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
39#define AS_GENERAL 0x01 39#define UAC_AS_GENERAL 0x01
40#define FORMAT_TYPE 0x02 40#define UAC_FORMAT_TYPE 0x02
41#define FORMAT_SPECIFIC 0x03 41#define UAC_FORMAT_SPECIFIC 0x03
42 42
43#define EP_GENERAL 0x01 43/* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */
44 44#define UAC_EP_GENERAL 0x01
45#define MS_GENERAL 0x01 45
46#define MIDI_IN_JACK 0x02 46/* A.9 Audio Class-Specific Request Codes */
47#define MIDI_OUT_JACK 0x03 47#define UAC_SET_ 0x00
48 48#define UAC_GET_ 0x80
49/* endpoint attributes */ 49
50#define EP_ATTR_MASK 0x0c 50#define UAC__CUR 0x1
51#define EP_ATTR_ASYNC 0x04 51#define UAC__MIN 0x2
52#define EP_ATTR_ADAPTIVE 0x08 52#define UAC__MAX 0x3
53#define EP_ATTR_SYNC 0x0c 53#define UAC__RES 0x4
54 54#define UAC__MEM 0x5
55/* cs endpoint attributes */ 55
56#define EP_CS_ATTR_SAMPLE_RATE 0x01 56#define UAC_SET_CUR (UAC_SET_ | UAC__CUR)
57#define EP_CS_ATTR_PITCH_CONTROL 0x02 57#define UAC_GET_CUR (UAC_GET_ | UAC__CUR)
58#define EP_CS_ATTR_FILL_MAX 0x80 58#define UAC_SET_MIN (UAC_SET_ | UAC__MIN)
59 59#define UAC_GET_MIN (UAC_GET_ | UAC__MIN)
60/* Audio Class specific Request Codes */ 60#define UAC_SET_MAX (UAC_SET_ | UAC__MAX)
61#define USB_AUDIO_SET_INTF 0x21 61#define UAC_GET_MAX (UAC_GET_ | UAC__MAX)
62#define USB_AUDIO_SET_ENDPOINT 0x22 62#define UAC_SET_RES (UAC_SET_ | UAC__RES)
63#define USB_AUDIO_GET_INTF 0xa1 63#define UAC_GET_RES (UAC_GET_ | UAC__RES)
64#define USB_AUDIO_GET_ENDPOINT 0xa2 64#define UAC_SET_MEM (UAC_SET_ | UAC__MEM)
65 65#define UAC_GET_MEM (UAC_GET_ | UAC__MEM)
66#define SET_ 0x00 66
67#define GET_ 0x80 67#define UAC_GET_STAT 0xff
68 68
69#define _CUR 0x1 69/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
70#define _MIN 0x2 70#define UAC_MS_HEADER 0x01
71#define _MAX 0x3 71#define UAC_MIDI_IN_JACK 0x02
72#define _RES 0x4 72#define UAC_MIDI_OUT_JACK 0x03
73#define _MEM 0x5 73
74 74/* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */
75#define SET_CUR (SET_ | _CUR) 75#define UAC_MS_GENERAL 0x01
76#define GET_CUR (GET_ | _CUR) 76
77#define SET_MIN (SET_ | _MIN) 77/* Terminals - 2.1 USB Terminal Types */
78#define GET_MIN (GET_ | _MIN) 78#define UAC_TERMINAL_UNDEFINED 0x100
79#define SET_MAX (SET_ | _MAX) 79#define UAC_TERMINAL_STREAMING 0x101
80#define GET_MAX (GET_ | _MAX) 80#define UAC_TERMINAL_VENDOR_SPEC 0x1FF
81#define SET_RES (SET_ | _RES)
82#define GET_RES (GET_ | _RES)
83#define SET_MEM (SET_ | _MEM)
84#define GET_MEM (GET_ | _MEM)
85
86#define GET_STAT 0xff
87
88#define USB_AC_TERMINAL_UNDEFINED 0x100
89#define USB_AC_TERMINAL_STREAMING 0x101
90#define USB_AC_TERMINAL_VENDOR_SPEC 0x1FF
91 81
92/* Terminal Control Selectors */ 82/* Terminal Control Selectors */
93/* 4.3.2 Class-Specific AC Interface Descriptor */ 83/* 4.3.2 Class-Specific AC Interface Descriptor */
94struct usb_ac_header_descriptor { 84struct uac_ac_header_descriptor {
95 __u8 bLength; /* 8 + n */ 85 __u8 bLength; /* 8 + n */
96 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 86 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
97 __u8 bDescriptorSubtype; /* USB_MS_HEADER */ 87 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */
98 __le16 bcdADC; /* 0x0100 */ 88 __le16 bcdADC; /* 0x0100 */
99 __le16 wTotalLength; /* includes Unit and Terminal desc. */ 89 __le16 wTotalLength; /* includes Unit and Terminal desc. */
100 __u8 bInCollection; /* n */ 90 __u8 bInCollection; /* n */
101 __u8 baInterfaceNr[]; /* [n] */ 91 __u8 baInterfaceNr[]; /* [n] */
102} __attribute__ ((packed)); 92} __attribute__ ((packed));
103 93
104#define USB_DT_AC_HEADER_SIZE(n) (8 + (n)) 94#define UAC_DT_AC_HEADER_SIZE(n) (8 + (n))
105 95
106/* As above, but more useful for defining your own descriptors: */ 96/* As above, but more useful for defining your own descriptors: */
107#define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \ 97#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \
108struct usb_ac_header_descriptor_##n { \ 98struct uac_ac_header_descriptor_##n { \
109 __u8 bLength; \ 99 __u8 bLength; \
110 __u8 bDescriptorType; \ 100 __u8 bDescriptorType; \
111 __u8 bDescriptorSubtype; \ 101 __u8 bDescriptorSubtype; \
@@ -116,7 +106,7 @@ struct usb_ac_header_descriptor_##n { \
116} __attribute__ ((packed)) 106} __attribute__ ((packed))
117 107
118/* 4.3.2.1 Input Terminal Descriptor */ 108/* 4.3.2.1 Input Terminal Descriptor */
119struct usb_input_terminal_descriptor { 109struct uac_input_terminal_descriptor {
120 __u8 bLength; /* in bytes: 12 */ 110 __u8 bLength; /* in bytes: 12 */
121 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ 111 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
122 __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */ 112 __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */
@@ -129,18 +119,19 @@ struct usb_input_terminal_descriptor {
129 __u8 iTerminal; 119 __u8 iTerminal;
130} __attribute__ ((packed)); 120} __attribute__ ((packed));
131 121
132#define USB_DT_AC_INPUT_TERMINAL_SIZE 12 122#define UAC_DT_INPUT_TERMINAL_SIZE 12
133 123
134#define USB_AC_INPUT_TERMINAL_UNDEFINED 0x200 124/* Terminals - 2.2 Input Terminal Types */
135#define USB_AC_INPUT_TERMINAL_MICROPHONE 0x201 125#define UAC_INPUT_TERMINAL_UNDEFINED 0x200
136#define USB_AC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202 126#define UAC_INPUT_TERMINAL_MICROPHONE 0x201
137#define USB_AC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203 127#define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202
138#define USB_AC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204 128#define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203
139#define USB_AC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205 129#define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204
140#define USB_AC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206 130#define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205
131#define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206
141 132
142/* 4.3.2.2 Output Terminal Descriptor */ 133/* 4.3.2.2 Output Terminal Descriptor */
143struct usb_output_terminal_descriptor { 134struct uac_output_terminal_descriptor {
144 __u8 bLength; /* in bytes: 9 */ 135 __u8 bLength; /* in bytes: 9 */
145 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ 136 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
146 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */ 137 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */
@@ -151,23 +142,24 @@ struct usb_output_terminal_descriptor {
151 __u8 iTerminal; 142 __u8 iTerminal;
152} __attribute__ ((packed)); 143} __attribute__ ((packed));
153 144
154#define USB_DT_AC_OUTPUT_TERMINAL_SIZE 9 145#define UAC_DT_OUTPUT_TERMINAL_SIZE 9
155 146
156#define USB_AC_OUTPUT_TERMINAL_UNDEFINED 0x300 147/* Terminals - 2.3 Output Terminal Types */
157#define USB_AC_OUTPUT_TERMINAL_SPEAKER 0x301 148#define UAC_OUTPUT_TERMINAL_UNDEFINED 0x300
158#define USB_AC_OUTPUT_TERMINAL_HEADPHONES 0x302 149#define UAC_OUTPUT_TERMINAL_SPEAKER 0x301
159#define USB_AC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303 150#define UAC_OUTPUT_TERMINAL_HEADPHONES 0x302
160#define USB_AC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304 151#define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303
161#define USB_AC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305 152#define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304
162#define USB_AC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306 153#define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305
163#define USB_AC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307 154#define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306
155#define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307
164 156
165/* Set bControlSize = 2 as default setting */ 157/* Set bControlSize = 2 as default setting */
166#define USB_DT_AC_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2) 158#define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2)
167 159
168/* As above, but more useful for defining your own descriptors: */ 160/* As above, but more useful for defining your own descriptors: */
169#define DECLARE_USB_AC_FEATURE_UNIT_DESCRIPTOR(ch) \ 161#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \
170struct usb_ac_feature_unit_descriptor_##ch { \ 162struct uac_feature_unit_descriptor_##ch { \
171 __u8 bLength; \ 163 __u8 bLength; \
172 __u8 bDescriptorType; \ 164 __u8 bDescriptorType; \
173 __u8 bDescriptorSubtype; \ 165 __u8 bDescriptorSubtype; \
@@ -179,7 +171,7 @@ struct usb_ac_feature_unit_descriptor_##ch { \
179} __attribute__ ((packed)) 171} __attribute__ ((packed))
180 172
181/* 4.5.2 Class-Specific AS Interface Descriptor */ 173/* 4.5.2 Class-Specific AS Interface Descriptor */
182struct usb_as_header_descriptor { 174struct uac_as_header_descriptor {
183 __u8 bLength; /* in bytes: 7 */ 175 __u8 bLength; /* in bytes: 7 */
184 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 176 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
185 __u8 bDescriptorSubtype; /* AS_GENERAL */ 177 __u8 bDescriptorSubtype; /* AS_GENERAL */
@@ -188,16 +180,17 @@ struct usb_as_header_descriptor {
188 __le16 wFormatTag; /* The Audio Data Format */ 180 __le16 wFormatTag; /* The Audio Data Format */
189} __attribute__ ((packed)); 181} __attribute__ ((packed));
190 182
191#define USB_DT_AS_HEADER_SIZE 7 183#define UAC_DT_AS_HEADER_SIZE 7
192 184
193#define USB_AS_AUDIO_FORMAT_TYPE_I_UNDEFINED 0x0 185/* Formats - A.1.1 Audio Data Format Type I Codes */
194#define USB_AS_AUDIO_FORMAT_TYPE_I_PCM 0x1 186#define UAC_FORMAT_TYPE_I_UNDEFINED 0x0
195#define USB_AS_AUDIO_FORMAT_TYPE_I_PCM8 0x2 187#define UAC_FORMAT_TYPE_I_PCM 0x1
196#define USB_AS_AUDIO_FORMAT_TYPE_I_IEEE_FLOAT 0x3 188#define UAC_FORMAT_TYPE_I_PCM8 0x2
197#define USB_AS_AUDIO_FORMAT_TYPE_I_ALAW 0x4 189#define UAC_FORMAT_TYPE_I_IEEE_FLOAT 0x3
198#define USB_AS_AUDIO_FORMAT_TYPE_I_MULAW 0x5 190#define UAC_FORMAT_TYPE_I_ALAW 0x4
191#define UAC_FORMAT_TYPE_I_MULAW 0x5
199 192
200struct usb_as_format_type_i_continuous_descriptor { 193struct uac_format_type_i_continuous_descriptor {
201 __u8 bLength; /* in bytes: 8 + (ns * 3) */ 194 __u8 bLength; /* in bytes: 8 + (ns * 3) */
202 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 195 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
203 __u8 bDescriptorSubtype; /* FORMAT_TYPE */ 196 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
@@ -210,9 +203,9 @@ struct usb_as_format_type_i_continuous_descriptor {
210 __u8 tUpperSamFreq[3]; 203 __u8 tUpperSamFreq[3];
211} __attribute__ ((packed)); 204} __attribute__ ((packed));
212 205
213#define USB_AS_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14 206#define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14
214 207
215struct usb_as_formate_type_i_discrete_descriptor { 208struct uac_format_type_i_discrete_descriptor {
216 __u8 bLength; /* in bytes: 8 + (ns * 3) */ 209 __u8 bLength; /* in bytes: 8 + (ns * 3) */
217 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 210 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
218 __u8 bDescriptorSubtype; /* FORMAT_TYPE */ 211 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
@@ -224,8 +217,8 @@ struct usb_as_formate_type_i_discrete_descriptor {
224 __u8 tSamFreq[][3]; 217 __u8 tSamFreq[][3];
225} __attribute__ ((packed)); 218} __attribute__ ((packed));
226 219
227#define DECLARE_USB_AS_FORMAT_TYPE_I_DISCRETE_DESC(n) \ 220#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \
228struct usb_as_formate_type_i_discrete_descriptor_##n { \ 221struct uac_format_type_i_discrete_descriptor_##n { \
229 __u8 bLength; \ 222 __u8 bLength; \
230 __u8 bDescriptorType; \ 223 __u8 bDescriptorType; \
231 __u8 bDescriptorSubtype; \ 224 __u8 bDescriptorSubtype; \
@@ -237,18 +230,15 @@ struct usb_as_formate_type_i_discrete_descriptor_##n { \
237 __u8 tSamFreq[n][3]; \ 230 __u8 tSamFreq[n][3]; \
238} __attribute__ ((packed)) 231} __attribute__ ((packed))
239 232
240#define USB_AS_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3)) 233#define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3))
241
242#define USB_AS_FORMAT_TYPE_UNDEFINED 0x0
243#define USB_AS_FORMAT_TYPE_I 0x1
244#define USB_AS_FORMAT_TYPE_II 0x2
245#define USB_AS_FORMAT_TYPE_III 0x3
246 234
247#define USB_AS_ENDPOINT_ASYNC (1 << 2) 235/* Formats - A.2 Format Type Codes */
248#define USB_AS_ENDPOINT_ADAPTIVE (2 << 2) 236#define UAC_FORMAT_TYPE_UNDEFINED 0x0
249#define USB_AS_ENDPOINT_SYNC (3 << 2) 237#define UAC_FORMAT_TYPE_I 0x1
238#define UAC_FORMAT_TYPE_II 0x2
239#define UAC_FORMAT_TYPE_III 0x3
250 240
251struct usb_as_iso_endpoint_descriptor { 241struct uac_iso_endpoint_descriptor {
252 __u8 bLength; /* in bytes: 7 */ 242 __u8 bLength; /* in bytes: 7 */
253 __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ 243 __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
254 __u8 bDescriptorSubtype; /* EP_GENERAL */ 244 __u8 bDescriptorSubtype; /* EP_GENERAL */
@@ -256,30 +246,37 @@ struct usb_as_iso_endpoint_descriptor {
256 __u8 bLockDelayUnits; 246 __u8 bLockDelayUnits;
257 __le16 wLockDelay; 247 __le16 wLockDelay;
258}; 248};
259#define USB_AS_ISO_ENDPOINT_DESC_SIZE 7 249#define UAC_ISO_ENDPOINT_DESC_SIZE 7
260 250
261#define FU_CONTROL_UNDEFINED 0x00 251#define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01
262#define MUTE_CONTROL 0x01 252#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02
263#define VOLUME_CONTROL 0x02 253#define UAC_EP_CS_ATTR_FILL_MAX 0x80
264#define BASS_CONTROL 0x03 254
265#define MID_CONTROL 0x04 255/* A.10.2 Feature Unit Control Selectors */
266#define TREBLE_CONTROL 0x05 256#define UAC_FU_CONTROL_UNDEFINED 0x00
267#define GRAPHIC_EQUALIZER_CONTROL 0x06 257#define UAC_MUTE_CONTROL 0x01
268#define AUTOMATIC_GAIN_CONTROL 0x07 258#define UAC_VOLUME_CONTROL 0x02
269#define DELAY_CONTROL 0x08 259#define UAC_BASS_CONTROL 0x03
270#define BASS_BOOST_CONTROL 0x09 260#define UAC_MID_CONTROL 0x04
271#define LOUDNESS_CONTROL 0x0a 261#define UAC_TREBLE_CONTROL 0x05
272 262#define UAC_GRAPHIC_EQUALIZER_CONTROL 0x06
273#define FU_MUTE (1 << (MUTE_CONTROL - 1)) 263#define UAC_AUTOMATIC_GAIN_CONTROL 0x07
274#define FU_VOLUME (1 << (VOLUME_CONTROL - 1)) 264#define UAC_DELAY_CONTROL 0x08
275#define FU_BASS (1 << (BASS_CONTROL - 1)) 265#define UAC_BASS_BOOST_CONTROL 0x09
276#define FU_MID (1 << (MID_CONTROL - 1)) 266#define UAC_LOUDNESS_CONTROL 0x0a
277#define FU_TREBLE (1 << (TREBLE_CONTROL - 1)) 267
278#define FU_GRAPHIC_EQ (1 << (GRAPHIC_EQUALIZER_CONTROL - 1)) 268#define UAC_FU_MUTE (1 << (UAC_MUTE_CONTROL - 1))
279#define FU_AUTO_GAIN (1 << (AUTOMATIC_GAIN_CONTROL - 1)) 269#define UAC_FU_VOLUME (1 << (UAC_VOLUME_CONTROL - 1))
280#define FU_DELAY (1 << (DELAY_CONTROL - 1)) 270#define UAC_FU_BASS (1 << (UAC_BASS_CONTROL - 1))
281#define FU_BASS_BOOST (1 << (BASS_BOOST_CONTROL - 1)) 271#define UAC_FU_MID (1 << (UAC_MID_CONTROL - 1))
282#define FU_LOUDNESS (1 << (LOUDNESS_CONTROL - 1)) 272#define UAC_FU_TREBLE (1 << (UAC_TREBLE_CONTROL - 1))
273#define UAC_FU_GRAPHIC_EQ (1 << (UAC_GRAPHIC_EQUALIZER_CONTROL - 1))
274#define UAC_FU_AUTO_GAIN (1 << (UAC_AUTOMATIC_GAIN_CONTROL - 1))
275#define UAC_FU_DELAY (1 << (UAC_DELAY_CONTROL - 1))
276#define UAC_FU_BASS_BOOST (1 << (UAC_BASS_BOOST_CONTROL - 1))
277#define UAC_FU_LOUDNESS (1 << (UAC_LOUDNESS_CONTROL - 1))
278
279#ifdef __KERNEL__
283 280
284struct usb_audio_control { 281struct usb_audio_control {
285 struct list_head list; 282 struct list_head list;
@@ -290,18 +287,6 @@ struct usb_audio_control {
290 int (*get)(struct usb_audio_control *con, u8 cmd); 287 int (*get)(struct usb_audio_control *con, u8 cmd);
291}; 288};
292 289
293static inline int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value)
294{
295 con->data[cmd] = value;
296
297 return 0;
298}
299
300static inline int generic_get_cmd(struct usb_audio_control *con, u8 cmd)
301{
302 return con->data[cmd];
303}
304
305struct usb_audio_control_selector { 290struct usb_audio_control_selector {
306 struct list_head list; 291 struct list_head list;
307 struct list_head control; 292 struct list_head control;
@@ -311,4 +296,6 @@ struct usb_audio_control_selector {
311 struct usb_descriptor_header *desc; 296 struct usb_descriptor_header *desc;
312}; 297};
313 298
299#endif /* __KERNEL__ */
300
314#endif /* __LINUX_USB_AUDIO_H */ 301#endif /* __LINUX_USB_AUDIO_H */
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 93223638f702..94012e649d86 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -258,6 +258,8 @@ struct usb_device_descriptor {
258#define USB_CLASS_APP_SPEC 0xfe 258#define USB_CLASS_APP_SPEC 0xfe
259#define USB_CLASS_VENDOR_SPEC 0xff 259#define USB_CLASS_VENDOR_SPEC 0xff
260 260
261#define USB_SUBCLASS_VENDOR_SPEC 0xff
262
261/*-------------------------------------------------------------------------*/ 263/*-------------------------------------------------------------------------*/
262 264
263/* USB_DT_CONFIG: Configuration descriptor information. 265/* USB_DT_CONFIG: Configuration descriptor information.
@@ -348,6 +350,12 @@ struct usb_endpoint_descriptor {
348#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */ 350#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */
349#define USB_ENDPOINT_DIR_MASK 0x80 351#define USB_ENDPOINT_DIR_MASK 0x80
350 352
353#define USB_ENDPOINT_SYNCTYPE 0x0c
354#define USB_ENDPOINT_SYNC_NONE (0 << 2)
355#define USB_ENDPOINT_SYNC_ASYNC (1 << 2)
356#define USB_ENDPOINT_SYNC_ADAPTIVE (2 << 2)
357#define USB_ENDPOINT_SYNC_SYNC (3 << 2)
358
351#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */ 359#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */
352#define USB_ENDPOINT_XFER_CONTROL 0 360#define USB_ENDPOINT_XFER_CONTROL 0
353#define USB_ENDPOINT_XFER_ISOC 1 361#define USB_ENDPOINT_XFER_ISOC 1
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
index 5b88e36c9103..af4b86f3aca3 100644
--- a/include/linux/usb/ehci_def.h
+++ b/include/linux/usb/ehci_def.h
@@ -105,6 +105,7 @@ struct ehci_regs {
105#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ 105#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */
106#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */ 106#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */
107/* 19:16 for port testing */ 107/* 19:16 for port testing */
108#define PORT_TEST_PKT (0x4<<16) /* Port Test Control - packet test */
108#define PORT_LED_OFF (0<<14) 109#define PORT_LED_OFF (0<<14)
109#define PORT_LED_AMBER (1<<14) 110#define PORT_LED_AMBER (1<<14)
110#define PORT_LED_GREEN (2<<14) 111#define PORT_LED_GREEN (2<<14)
@@ -132,6 +133,19 @@ struct ehci_regs {
132#define USBMODE_CM_HC (3<<0) /* host controller mode */ 133#define USBMODE_CM_HC (3<<0) /* host controller mode */
133#define USBMODE_CM_IDLE (0<<0) /* idle state */ 134#define USBMODE_CM_IDLE (0<<0) /* idle state */
134 135
136/* Moorestown has some non-standard registers, partially due to the fact that
137 * its EHCI controller has both TT and LPM support. HOSTPCx are extentions to
138 * PORTSCx
139 */
140#define HOSTPC0 0x84 /* HOSTPC extension */
141#define HOSTPC_PHCD (1<<22) /* Phy clock disable */
142#define HOSTPC_PSPD (3<<25) /* Port speed detection */
143#define USBMODE_EX 0xc8 /* USB Device mode extension */
144#define USBMODE_EX_VBPS (1<<5) /* VBus Power Select On */
145#define USBMODE_EX_HC (3<<0) /* host controller mode */
146#define TXFILLTUNING 0x24 /* TX FIFO Tuning register */
147#define TXFIFO_DEFAULT (8<<16) /* FIFO burst threshold 8 */
148
135/* Appendix C, Debug port ... intended for use with special "debug devices" 149/* Appendix C, Debug port ... intended for use with special "debug devices"
136 * that can help if there's no serial console. (nonstandard enumeration.) 150 * that can help if there's no serial console. (nonstandard enumeration.)
137 */ 151 */
@@ -157,4 +171,25 @@ struct ehci_dbg_port {
157#define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep)) 171#define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep))
158} __attribute__ ((packed)); 172} __attribute__ ((packed));
159 173
174#ifdef CONFIG_EARLY_PRINTK_DBGP
175#include <linux/init.h>
176extern int __init early_dbgp_init(char *s);
177extern struct console early_dbgp_console;
178#endif /* CONFIG_EARLY_PRINTK_DBGP */
179
180#ifdef CONFIG_EARLY_PRINTK_DBGP
181/* Call backs from ehci host driver to ehci debug driver */
182extern int dbgp_external_startup(void);
183extern int dbgp_reset_prep(void);
184#else
185static inline int dbgp_reset_prep(void)
186{
187 return 1;
188}
189static inline int dbgp_external_startup(void)
190{
191 return -1;
192}
193#endif
194
160#endif /* __LINUX_USB_EHCI_DEF_H */ 195#endif /* __LINUX_USB_EHCI_DEF_H */
diff --git a/include/linux/usb/isp1362.h b/include/linux/usb/isp1362.h
new file mode 100644
index 000000000000..642684bb9292
--- /dev/null
+++ b/include/linux/usb/isp1362.h
@@ -0,0 +1,46 @@
1/*
2 * board initialization code should put one of these into dev->platform_data
3 * and place the isp1362 onto platform_bus.
4 */
5
6#ifndef __LINUX_USB_ISP1362_H__
7#define __LINUX_USB_ISP1362_H__
8
9struct isp1362_platform_data {
10 /* Enable internal pulldown resistors on downstream ports */
11 unsigned sel15Kres:1;
12 /* Clock cannot be stopped */
13 unsigned clknotstop:1;
14 /* On-chip overcurrent protection */
15 unsigned oc_enable:1;
16 /* INT output polarity */
17 unsigned int_act_high:1;
18 /* INT edge or level triggered */
19 unsigned int_edge_triggered:1;
20 /* DREQ output polarity */
21 unsigned dreq_act_high:1;
22 /* DACK input polarity */
23 unsigned dack_act_high:1;
24 /* chip can be resumed via H_WAKEUP pin */
25 unsigned remote_wakeup_connected:1;
26 /* Switch or not to switch (keep always powered) */
27 unsigned no_power_switching:1;
28 /* Ganged port power switching (0) or individual port power switching (1) */
29 unsigned power_switching_mode:1;
30 /* Given port_power, msec/2 after power on till power good */
31 u8 potpg;
32 /* Hardware reset set/clear */
33 void (*reset) (struct device *dev, int set);
34 /* Clock start/stop */
35 void (*clock) (struct device *dev, int start);
36 /* Inter-io delay (ns). The chip is picky about access timings; it
37 * expects at least:
38 * 110ns delay between consecutive accesses to DATA_REG,
39 * 300ns delay between access to ADDR_REG and DATA_REG (registers)
40 * 462ns delay between access to ADDR_REG and DATA_REG (buffer memory)
41 * WE MUST NOT be activated during these intervals (even without CS!)
42 */
43 void (*delay) (struct device *dev, unsigned int delay);
44};
45
46#endif
diff --git a/include/linux/usb/isp1760.h b/include/linux/usb/isp1760.h
new file mode 100644
index 000000000000..de7de53c5531
--- /dev/null
+++ b/include/linux/usb/isp1760.h
@@ -0,0 +1,18 @@
1/*
2 * board initialization should put one of these into dev->platform_data
3 * and place the isp1760 onto platform_bus named "isp1760-hcd".
4 */
5
6#ifndef __LINUX_USB_ISP1760_H
7#define __LINUX_USB_ISP1760_H
8
9struct isp1760_platform_data {
10 unsigned is_isp1761:1; /* Chip is ISP1761 */
11 unsigned bus_width_16:1; /* 16/32-bit data bus width */
12 unsigned port1_otg:1; /* Port 1 supports OTG */
13 unsigned analog_oc:1; /* Analog overcurrent */
14 unsigned dack_polarity_high:1; /* DACK active high */
15 unsigned dreq_polarity_high:1; /* DREQ active high */
16};
17
18#endif /* __LINUX_USB_ISP1760_H */
diff --git a/include/linux/usb/m66592.h b/include/linux/usb/m66592.h
new file mode 100644
index 000000000000..cda9625e7df0
--- /dev/null
+++ b/include/linux/usb/m66592.h
@@ -0,0 +1,44 @@
1/*
2 * M66592 driver platform data
3 *
4 * Copyright (C) 2009 Renesas Solutions Corp.
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 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 */
20
21#ifndef __LINUX_USB_M66592_H
22#define __LINUX_USB_M66592_H
23
24#define M66592_PLATDATA_XTAL_12MHZ 0x01
25#define M66592_PLATDATA_XTAL_24MHZ 0x02
26#define M66592_PLATDATA_XTAL_48MHZ 0x03
27
28struct m66592_platdata {
29 /* one = on chip controller, zero = external controller */
30 unsigned on_chip:1;
31
32 /* one = big endian, zero = little endian */
33 unsigned endian:1;
34
35 /* (external controller only) M66592_PLATDATA_XTAL_nnMHZ */
36 unsigned xtal:2;
37
38 /* (external controller only) one = 3.3V, zero = 1.5V */
39 unsigned vif:1;
40
41};
42
43#endif /* __LINUX_USB_M66592_H */
44
diff --git a/include/linux/usb/r8a66597.h b/include/linux/usb/r8a66597.h
index e9f0384fa20c..26d216734057 100644
--- a/include/linux/usb/r8a66597.h
+++ b/include/linux/usb/r8a66597.h
@@ -28,9 +28,12 @@
28#define R8A66597_PLATDATA_XTAL_48MHZ 0x03 28#define R8A66597_PLATDATA_XTAL_48MHZ 0x03
29 29
30struct r8a66597_platdata { 30struct r8a66597_platdata {
31 /* This ops can controll port power instead of DVSTCTR register. */ 31 /* This callback can control port power instead of DVSTCTR register. */
32 void (*port_power)(int port, int power); 32 void (*port_power)(int port, int power);
33 33
34 /* set one = on chip controller, set zero = external controller */
35 unsigned on_chip:1;
36
34 /* (external controller only) set R8A66597_PLATDATA_XTAL_nnMHZ */ 37 /* (external controller only) set R8A66597_PLATDATA_XTAL_nnMHZ */
35 unsigned xtal:2; 38 unsigned xtal:2;
36 39
@@ -40,5 +43,373 @@ struct r8a66597_platdata {
40 /* set one = big endian, set zero = little endian */ 43 /* set one = big endian, set zero = little endian */
41 unsigned endian:1; 44 unsigned endian:1;
42}; 45};
43#endif 46
47/* Register definitions */
48#define SYSCFG0 0x00
49#define SYSCFG1 0x02
50#define SYSSTS0 0x04
51#define SYSSTS1 0x06
52#define DVSTCTR0 0x08
53#define DVSTCTR1 0x0A
54#define TESTMODE 0x0C
55#define PINCFG 0x0E
56#define DMA0CFG 0x10
57#define DMA1CFG 0x12
58#define CFIFO 0x14
59#define D0FIFO 0x18
60#define D1FIFO 0x1C
61#define CFIFOSEL 0x20
62#define CFIFOCTR 0x22
63#define CFIFOSIE 0x24
64#define D0FIFOSEL 0x28
65#define D0FIFOCTR 0x2A
66#define D1FIFOSEL 0x2C
67#define D1FIFOCTR 0x2E
68#define INTENB0 0x30
69#define INTENB1 0x32
70#define INTENB2 0x34
71#define BRDYENB 0x36
72#define NRDYENB 0x38
73#define BEMPENB 0x3A
74#define SOFCFG 0x3C
75#define INTSTS0 0x40
76#define INTSTS1 0x42
77#define INTSTS2 0x44
78#define BRDYSTS 0x46
79#define NRDYSTS 0x48
80#define BEMPSTS 0x4A
81#define FRMNUM 0x4C
82#define UFRMNUM 0x4E
83#define USBADDR 0x50
84#define USBREQ 0x54
85#define USBVAL 0x56
86#define USBINDX 0x58
87#define USBLENG 0x5A
88#define DCPCFG 0x5C
89#define DCPMAXP 0x5E
90#define DCPCTR 0x60
91#define PIPESEL 0x64
92#define PIPECFG 0x68
93#define PIPEBUF 0x6A
94#define PIPEMAXP 0x6C
95#define PIPEPERI 0x6E
96#define PIPE1CTR 0x70
97#define PIPE2CTR 0x72
98#define PIPE3CTR 0x74
99#define PIPE4CTR 0x76
100#define PIPE5CTR 0x78
101#define PIPE6CTR 0x7A
102#define PIPE7CTR 0x7C
103#define PIPE8CTR 0x7E
104#define PIPE9CTR 0x80
105#define PIPE1TRE 0x90
106#define PIPE1TRN 0x92
107#define PIPE2TRE 0x94
108#define PIPE2TRN 0x96
109#define PIPE3TRE 0x98
110#define PIPE3TRN 0x9A
111#define PIPE4TRE 0x9C
112#define PIPE4TRN 0x9E
113#define PIPE5TRE 0xA0
114#define PIPE5TRN 0xA2
115#define DEVADD0 0xD0
116#define DEVADD1 0xD2
117#define DEVADD2 0xD4
118#define DEVADD3 0xD6
119#define DEVADD4 0xD8
120#define DEVADD5 0xDA
121#define DEVADD6 0xDC
122#define DEVADD7 0xDE
123#define DEVADD8 0xE0
124#define DEVADD9 0xE2
125#define DEVADDA 0xE4
126
127/* System Configuration Control Register */
128#define XTAL 0xC000 /* b15-14: Crystal selection */
129#define XTAL48 0x8000 /* 48MHz */
130#define XTAL24 0x4000 /* 24MHz */
131#define XTAL12 0x0000 /* 12MHz */
132#define XCKE 0x2000 /* b13: External clock enable */
133#define PLLC 0x0800 /* b11: PLL control */
134#define SCKE 0x0400 /* b10: USB clock enable */
135#define PCSDIS 0x0200 /* b9: not CS wakeup */
136#define LPSME 0x0100 /* b8: Low power sleep mode */
137#define HSE 0x0080 /* b7: Hi-speed enable */
138#define DCFM 0x0040 /* b6: Controller function select */
139#define DRPD 0x0020 /* b5: D+/- pull down control */
140#define DPRPU 0x0010 /* b4: D+ pull up control */
141#define USBE 0x0001 /* b0: USB module operation enable */
142
143/* System Configuration Status Register */
144#define OVCBIT 0x8000 /* b15-14: Over-current bit */
145#define OVCMON 0xC000 /* b15-14: Over-current monitor */
146#define SOFEA 0x0020 /* b5: SOF monitor */
147#define IDMON 0x0004 /* b3: ID-pin monitor */
148#define LNST 0x0003 /* b1-0: D+, D- line status */
149#define SE1 0x0003 /* SE1 */
150#define FS_KSTS 0x0002 /* Full-Speed K State */
151#define FS_JSTS 0x0001 /* Full-Speed J State */
152#define LS_JSTS 0x0002 /* Low-Speed J State */
153#define LS_KSTS 0x0001 /* Low-Speed K State */
154#define SE0 0x0000 /* SE0 */
155
156/* Device State Control Register */
157#define EXTLP0 0x0400 /* b10: External port */
158#define VBOUT 0x0200 /* b9: VBUS output */
159#define WKUP 0x0100 /* b8: Remote wakeup */
160#define RWUPE 0x0080 /* b7: Remote wakeup sense */
161#define USBRST 0x0040 /* b6: USB reset enable */
162#define RESUME 0x0020 /* b5: Resume enable */
163#define UACT 0x0010 /* b4: USB bus enable */
164#define RHST 0x0007 /* b1-0: Reset handshake status */
165#define HSPROC 0x0004 /* HS handshake is processing */
166#define HSMODE 0x0003 /* Hi-Speed mode */
167#define FSMODE 0x0002 /* Full-Speed mode */
168#define LSMODE 0x0001 /* Low-Speed mode */
169#define UNDECID 0x0000 /* Undecided */
170
171/* Test Mode Register */
172#define UTST 0x000F /* b3-0: Test select */
173#define H_TST_PACKET 0x000C /* HOST TEST Packet */
174#define H_TST_SE0_NAK 0x000B /* HOST TEST SE0 NAK */
175#define H_TST_K 0x000A /* HOST TEST K */
176#define H_TST_J 0x0009 /* HOST TEST J */
177#define H_TST_NORMAL 0x0000 /* HOST Normal Mode */
178#define P_TST_PACKET 0x0004 /* PERI TEST Packet */
179#define P_TST_SE0_NAK 0x0003 /* PERI TEST SE0 NAK */
180#define P_TST_K 0x0002 /* PERI TEST K */
181#define P_TST_J 0x0001 /* PERI TEST J */
182#define P_TST_NORMAL 0x0000 /* PERI Normal Mode */
183
184/* Data Pin Configuration Register */
185#define LDRV 0x8000 /* b15: Drive Current Adjust */
186#define VIF1 0x0000 /* VIF = 1.8V */
187#define VIF3 0x8000 /* VIF = 3.3V */
188#define INTA 0x0001 /* b1: USB INT-pin active */
189
190/* DMAx Pin Configuration Register */
191#define DREQA 0x4000 /* b14: Dreq active select */
192#define BURST 0x2000 /* b13: Burst mode */
193#define DACKA 0x0400 /* b10: Dack active select */
194#define DFORM 0x0380 /* b9-7: DMA mode select */
195#define CPU_ADR_RD_WR 0x0000 /* Address + RD/WR mode (CPU bus) */
196#define CPU_DACK_RD_WR 0x0100 /* DACK + RD/WR mode (CPU bus) */
197#define CPU_DACK_ONLY 0x0180 /* DACK only mode (CPU bus) */
198#define SPLIT_DACK_ONLY 0x0200 /* DACK only mode (SPLIT bus) */
199#define DENDA 0x0040 /* b6: Dend active select */
200#define PKTM 0x0020 /* b5: Packet mode */
201#define DENDE 0x0010 /* b4: Dend enable */
202#define OBUS 0x0004 /* b2: OUTbus mode */
203
204/* CFIFO/DxFIFO Port Select Register */
205#define RCNT 0x8000 /* b15: Read count mode */
206#define REW 0x4000 /* b14: Buffer rewind */
207#define DCLRM 0x2000 /* b13: DMA buffer clear mode */
208#define DREQE 0x1000 /* b12: DREQ output enable */
209#define MBW_8 0x0000 /* 8bit */
210#define MBW_16 0x0400 /* 16bit */
211#define MBW_32 0x0800 /* 32bit */
212#define BIGEND 0x0100 /* b8: Big endian mode */
213#define BYTE_LITTLE 0x0000 /* little dendian */
214#define BYTE_BIG 0x0100 /* big endifan */
215#define ISEL 0x0020 /* b5: DCP FIFO port direction select */
216#define CURPIPE 0x000F /* b2-0: PIPE select */
217
218/* CFIFO/DxFIFO Port Control Register */
219#define BVAL 0x8000 /* b15: Buffer valid flag */
220#define BCLR 0x4000 /* b14: Buffer clear */
221#define FRDY 0x2000 /* b13: FIFO ready */
222#define DTLN 0x0FFF /* b11-0: FIFO received data length */
223
224/* Interrupt Enable Register 0 */
225#define VBSE 0x8000 /* b15: VBUS interrupt */
226#define RSME 0x4000 /* b14: Resume interrupt */
227#define SOFE 0x2000 /* b13: Frame update interrupt */
228#define DVSE 0x1000 /* b12: Device state transition interrupt */
229#define CTRE 0x0800 /* b11: Control transfer stage transition interrupt */
230#define BEMPE 0x0400 /* b10: Buffer empty interrupt */
231#define NRDYE 0x0200 /* b9: Buffer not ready interrupt */
232#define BRDYE 0x0100 /* b8: Buffer ready interrupt */
233
234/* Interrupt Enable Register 1 */
235#define OVRCRE 0x8000 /* b15: Over-current interrupt */
236#define BCHGE 0x4000 /* b14: USB us chenge interrupt */
237#define DTCHE 0x1000 /* b12: Detach sense interrupt */
238#define ATTCHE 0x0800 /* b11: Attach sense interrupt */
239#define EOFERRE 0x0040 /* b6: EOF error interrupt */
240#define SIGNE 0x0020 /* b5: SETUP IGNORE interrupt */
241#define SACKE 0x0010 /* b4: SETUP ACK interrupt */
242
243/* BRDY Interrupt Enable/Status Register */
244#define BRDY9 0x0200 /* b9: PIPE9 */
245#define BRDY8 0x0100 /* b8: PIPE8 */
246#define BRDY7 0x0080 /* b7: PIPE7 */
247#define BRDY6 0x0040 /* b6: PIPE6 */
248#define BRDY5 0x0020 /* b5: PIPE5 */
249#define BRDY4 0x0010 /* b4: PIPE4 */
250#define BRDY3 0x0008 /* b3: PIPE3 */
251#define BRDY2 0x0004 /* b2: PIPE2 */
252#define BRDY1 0x0002 /* b1: PIPE1 */
253#define BRDY0 0x0001 /* b1: PIPE0 */
254
255/* NRDY Interrupt Enable/Status Register */
256#define NRDY9 0x0200 /* b9: PIPE9 */
257#define NRDY8 0x0100 /* b8: PIPE8 */
258#define NRDY7 0x0080 /* b7: PIPE7 */
259#define NRDY6 0x0040 /* b6: PIPE6 */
260#define NRDY5 0x0020 /* b5: PIPE5 */
261#define NRDY4 0x0010 /* b4: PIPE4 */
262#define NRDY3 0x0008 /* b3: PIPE3 */
263#define NRDY2 0x0004 /* b2: PIPE2 */
264#define NRDY1 0x0002 /* b1: PIPE1 */
265#define NRDY0 0x0001 /* b1: PIPE0 */
266
267/* BEMP Interrupt Enable/Status Register */
268#define BEMP9 0x0200 /* b9: PIPE9 */
269#define BEMP8 0x0100 /* b8: PIPE8 */
270#define BEMP7 0x0080 /* b7: PIPE7 */
271#define BEMP6 0x0040 /* b6: PIPE6 */
272#define BEMP5 0x0020 /* b5: PIPE5 */
273#define BEMP4 0x0010 /* b4: PIPE4 */
274#define BEMP3 0x0008 /* b3: PIPE3 */
275#define BEMP2 0x0004 /* b2: PIPE2 */
276#define BEMP1 0x0002 /* b1: PIPE1 */
277#define BEMP0 0x0001 /* b0: PIPE0 */
278
279/* SOF Pin Configuration Register */
280#define TRNENSEL 0x0100 /* b8: Select transaction enable period */
281#define BRDYM 0x0040 /* b6: BRDY clear timing */
282#define INTL 0x0020 /* b5: Interrupt sense select */
283#define EDGESTS 0x0010 /* b4: */
284#define SOFMODE 0x000C /* b3-2: SOF pin select */
285#define SOF_125US 0x0008 /* SOF OUT 125us Frame Signal */
286#define SOF_1MS 0x0004 /* SOF OUT 1ms Frame Signal */
287#define SOF_DISABLE 0x0000 /* SOF OUT Disable */
288
289/* Interrupt Status Register 0 */
290#define VBINT 0x8000 /* b15: VBUS interrupt */
291#define RESM 0x4000 /* b14: Resume interrupt */
292#define SOFR 0x2000 /* b13: SOF frame update interrupt */
293#define DVST 0x1000 /* b12: Device state transition interrupt */
294#define CTRT 0x0800 /* b11: Control transfer stage transition interrupt */
295#define BEMP 0x0400 /* b10: Buffer empty interrupt */
296#define NRDY 0x0200 /* b9: Buffer not ready interrupt */
297#define BRDY 0x0100 /* b8: Buffer ready interrupt */
298#define VBSTS 0x0080 /* b7: VBUS input port */
299#define DVSQ 0x0070 /* b6-4: Device state */
300#define DS_SPD_CNFG 0x0070 /* Suspend Configured */
301#define DS_SPD_ADDR 0x0060 /* Suspend Address */
302#define DS_SPD_DFLT 0x0050 /* Suspend Default */
303#define DS_SPD_POWR 0x0040 /* Suspend Powered */
304#define DS_SUSP 0x0040 /* Suspend */
305#define DS_CNFG 0x0030 /* Configured */
306#define DS_ADDS 0x0020 /* Address */
307#define DS_DFLT 0x0010 /* Default */
308#define DS_POWR 0x0000 /* Powered */
309#define DVSQS 0x0030 /* b5-4: Device state */
310#define VALID 0x0008 /* b3: Setup packet detected flag */
311#define CTSQ 0x0007 /* b2-0: Control transfer stage */
312#define CS_SQER 0x0006 /* Sequence error */
313#define CS_WRND 0x0005 /* Control write nodata status stage */
314#define CS_WRSS 0x0004 /* Control write status stage */
315#define CS_WRDS 0x0003 /* Control write data stage */
316#define CS_RDSS 0x0002 /* Control read status stage */
317#define CS_RDDS 0x0001 /* Control read data stage */
318#define CS_IDST 0x0000 /* Idle or setup stage */
319
320/* Interrupt Status Register 1 */
321#define OVRCR 0x8000 /* b15: Over-current interrupt */
322#define BCHG 0x4000 /* b14: USB bus chenge interrupt */
323#define DTCH 0x1000 /* b12: Detach sense interrupt */
324#define ATTCH 0x0800 /* b11: Attach sense interrupt */
325#define EOFERR 0x0040 /* b6: EOF-error interrupt */
326#define SIGN 0x0020 /* b5: Setup ignore interrupt */
327#define SACK 0x0010 /* b4: Setup acknowledge interrupt */
328
329/* Frame Number Register */
330#define OVRN 0x8000 /* b15: Overrun error */
331#define CRCE 0x4000 /* b14: Received data error */
332#define FRNM 0x07FF /* b10-0: Frame number */
333
334/* Micro Frame Number Register */
335#define UFRNM 0x0007 /* b2-0: Micro frame number */
336
337/* Default Control Pipe Maxpacket Size Register */
338/* Pipe Maxpacket Size Register */
339#define DEVSEL 0xF000 /* b15-14: Device address select */
340#define MAXP 0x007F /* b6-0: Maxpacket size of default control pipe */
341
342/* Default Control Pipe Control Register */
343#define BSTS 0x8000 /* b15: Buffer status */
344#define SUREQ 0x4000 /* b14: Send USB request */
345#define CSCLR 0x2000 /* b13: complete-split status clear */
346#define CSSTS 0x1000 /* b12: complete-split status */
347#define SUREQCLR 0x0800 /* b11: stop setup request */
348#define SQCLR 0x0100 /* b8: Sequence toggle bit clear */
349#define SQSET 0x0080 /* b7: Sequence toggle bit set */
350#define SQMON 0x0040 /* b6: Sequence toggle bit monitor */
351#define PBUSY 0x0020 /* b5: pipe busy */
352#define PINGE 0x0010 /* b4: ping enable */
353#define CCPL 0x0004 /* b2: Enable control transfer complete */
354#define PID 0x0003 /* b1-0: Response PID */
355#define PID_STALL11 0x0003 /* STALL */
356#define PID_STALL 0x0002 /* STALL */
357#define PID_BUF 0x0001 /* BUF */
358#define PID_NAK 0x0000 /* NAK */
359
360/* Pipe Window Select Register */
361#define PIPENM 0x0007 /* b2-0: Pipe select */
362
363/* Pipe Configuration Register */
364#define R8A66597_TYP 0xC000 /* b15-14: Transfer type */
365#define R8A66597_ISO 0xC000 /* Isochronous */
366#define R8A66597_INT 0x8000 /* Interrupt */
367#define R8A66597_BULK 0x4000 /* Bulk */
368#define R8A66597_BFRE 0x0400 /* b10: Buffer ready interrupt mode select */
369#define R8A66597_DBLB 0x0200 /* b9: Double buffer mode select */
370#define R8A66597_CNTMD 0x0100 /* b8: Continuous transfer mode select */
371#define R8A66597_SHTNAK 0x0080 /* b7: Transfer end NAK */
372#define R8A66597_DIR 0x0010 /* b4: Transfer direction select */
373#define R8A66597_EPNUM 0x000F /* b3-0: Eendpoint number select */
374
375/* Pipe Buffer Configuration Register */
376#define BUFSIZE 0x7C00 /* b14-10: Pipe buffer size */
377#define BUFNMB 0x007F /* b6-0: Pipe buffer number */
378#define PIPE0BUF 256
379#define PIPExBUF 64
380
381/* Pipe Maxpacket Size Register */
382#define MXPS 0x07FF /* b10-0: Maxpacket size */
383
384/* Pipe Cycle Configuration Register */
385#define IFIS 0x1000 /* b12: Isochronous in-buffer flush mode select */
386#define IITV 0x0007 /* b2-0: Isochronous interval */
387
388/* Pipex Control Register */
389#define BSTS 0x8000 /* b15: Buffer status */
390#define INBUFM 0x4000 /* b14: IN buffer monitor (Only for PIPE1 to 5) */
391#define CSCLR 0x2000 /* b13: complete-split status clear */
392#define CSSTS 0x1000 /* b12: complete-split status */
393#define ATREPM 0x0400 /* b10: Auto repeat mode */
394#define ACLRM 0x0200 /* b9: Out buffer auto clear mode */
395#define SQCLR 0x0100 /* b8: Sequence toggle bit clear */
396#define SQSET 0x0080 /* b7: Sequence toggle bit set */
397#define SQMON 0x0040 /* b6: Sequence toggle bit monitor */
398#define PBUSY 0x0020 /* b5: pipe busy */
399#define PID 0x0003 /* b1-0: Response PID */
400
401/* PIPExTRE */
402#define TRENB 0x0200 /* b9: Transaction counter enable */
403#define TRCLR 0x0100 /* b8: Transaction counter clear */
404
405/* PIPExTRN */
406#define TRNCNT 0xFFFF /* b15-0: Transaction counter */
407
408/* DEVADDx */
409#define UPPHUB 0x7800
410#define HUBPORT 0x0700
411#define USBSPD 0x00C0
412#define RTPORT 0x0001
413
414#endif /* __LINUX_USB_R8A66597_H */
44 415
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h
index 37836b937d97..1ef1ebc2b04f 100644
--- a/include/linux/usb/rndis_host.h
+++ b/include/linux/usb/rndis_host.h
@@ -70,12 +70,13 @@ struct rndis_msg_hdr {
70#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION) 70#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
71 71
72/* codes for "status" field of completion messages */ 72/* codes for "status" field of completion messages */
73#define RNDIS_STATUS_SUCCESS cpu_to_le32(0x00000000) 73#define RNDIS_STATUS_SUCCESS cpu_to_le32(0x00000000)
74#define RNDIS_STATUS_FAILURE cpu_to_le32(0xc0000001) 74#define RNDIS_STATUS_FAILURE cpu_to_le32(0xc0000001)
75#define RNDIS_STATUS_INVALID_DATA cpu_to_le32(0xc0010015) 75#define RNDIS_STATUS_INVALID_DATA cpu_to_le32(0xc0010015)
76#define RNDIS_STATUS_NOT_SUPPORTED cpu_to_le32(0xc00000bb) 76#define RNDIS_STATUS_NOT_SUPPORTED cpu_to_le32(0xc00000bb)
77#define RNDIS_STATUS_MEDIA_CONNECT cpu_to_le32(0x4001000b) 77#define RNDIS_STATUS_MEDIA_CONNECT cpu_to_le32(0x4001000b)
78#define RNDIS_STATUS_MEDIA_DISCONNECT cpu_to_le32(0x4001000c) 78#define RNDIS_STATUS_MEDIA_DISCONNECT cpu_to_le32(0x4001000c)
79#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION cpu_to_le32(0x40010012)
79 80
80/* codes for OID_GEN_PHYSICAL_MEDIUM */ 81/* codes for OID_GEN_PHYSICAL_MEDIUM */
81#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED cpu_to_le32(0x00000000) 82#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED cpu_to_le32(0x00000000)
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 0ec50ba62139..ce911ebf91e8 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -59,6 +59,7 @@ enum port_dev_state {
59 * @bulk_out_buffer: pointer to the bulk out buffer for this port. 59 * @bulk_out_buffer: pointer to the bulk out buffer for this port.
60 * @bulk_out_size: the size of the bulk_out_buffer, in bytes. 60 * @bulk_out_size: the size of the bulk_out_buffer, in bytes.
61 * @write_urb: pointer to the bulk out struct urb for this port. 61 * @write_urb: pointer to the bulk out struct urb for this port.
62 * @write_fifo: kfifo used to buffer outgoing data
62 * @write_urb_busy: port`s writing status 63 * @write_urb_busy: port`s writing status
63 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this 64 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this
64 * port. 65 * port.
@@ -96,6 +97,7 @@ struct usb_serial_port {
96 unsigned char *bulk_out_buffer; 97 unsigned char *bulk_out_buffer;
97 int bulk_out_size; 98 int bulk_out_size;
98 struct urb *write_urb; 99 struct urb *write_urb;
100 struct kfifo *write_fifo;
99 int write_urb_busy; 101 int write_urb_busy;
100 __u8 bulk_out_endpointAddress; 102 __u8 bulk_out_endpointAddress;
101 103
@@ -148,6 +150,7 @@ struct usb_serial {
148 struct usb_interface *interface; 150 struct usb_interface *interface;
149 unsigned char disconnected:1; 151 unsigned char disconnected:1;
150 unsigned char suspending:1; 152 unsigned char suspending:1;
153 unsigned char attached:1;
151 unsigned char minor; 154 unsigned char minor;
152 unsigned char num_ports; 155 unsigned char num_ports;
153 unsigned char num_port_pointers; 156 unsigned char num_port_pointers;
@@ -238,9 +241,8 @@ struct usb_serial_driver {
238 int (*resume)(struct usb_serial *serial); 241 int (*resume)(struct usb_serial *serial);
239 242
240 /* serial function calls */ 243 /* serial function calls */
241 /* Called by console with tty = NULL and by tty */ 244 /* Called by console and by the tty layer */
242 int (*open)(struct tty_struct *tty, 245 int (*open)(struct tty_struct *tty, struct usb_serial_port *port);
243 struct usb_serial_port *port, struct file *filp);
244 void (*close)(struct usb_serial_port *port); 246 void (*close)(struct usb_serial_port *port);
245 int (*write)(struct tty_struct *tty, struct usb_serial_port *port, 247 int (*write)(struct tty_struct *tty, struct usb_serial_port *port,
246 const unsigned char *buf, int count); 248 const unsigned char *buf, int count);
@@ -261,6 +263,9 @@ struct usb_serial_driver {
261 be an attached tty at this point */ 263 be an attached tty at this point */
262 void (*dtr_rts)(struct usb_serial_port *port, int on); 264 void (*dtr_rts)(struct usb_serial_port *port, int on);
263 int (*carrier_raised)(struct usb_serial_port *port); 265 int (*carrier_raised)(struct usb_serial_port *port);
266 /* Called by the usb serial hooks to allow the user to rework the
267 termios state */
268 void (*init_termios)(struct tty_struct *tty);
264 /* USB events */ 269 /* USB events */
265 void (*read_int_callback)(struct urb *urb); 270 void (*read_int_callback)(struct urb *urb);
266 void (*write_int_callback)(struct urb *urb); 271 void (*write_int_callback)(struct urb *urb);
@@ -300,7 +305,7 @@ static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}
300extern struct usb_serial *usb_serial_get_by_index(unsigned int minor); 305extern struct usb_serial *usb_serial_get_by_index(unsigned int minor);
301extern void usb_serial_put(struct usb_serial *serial); 306extern void usb_serial_put(struct usb_serial *serial);
302extern int usb_serial_generic_open(struct tty_struct *tty, 307extern int usb_serial_generic_open(struct tty_struct *tty,
303 struct usb_serial_port *port, struct file *filp); 308 struct usb_serial_port *port);
304extern int usb_serial_generic_write(struct tty_struct *tty, 309extern int usb_serial_generic_write(struct tty_struct *tty,
305 struct usb_serial_port *port, const unsigned char *buf, int count); 310 struct usb_serial_port *port, const unsigned char *buf, int count);
306extern void usb_serial_generic_close(struct usb_serial_port *port); 311extern void usb_serial_generic_close(struct usb_serial_port *port);
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 310e18a880ff..f81473052059 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -53,6 +53,7 @@ struct usbnet {
53 struct sk_buff_head rxq; 53 struct sk_buff_head rxq;
54 struct sk_buff_head txq; 54 struct sk_buff_head txq;
55 struct sk_buff_head done; 55 struct sk_buff_head done;
56 struct sk_buff_head rxq_pause;
56 struct urb *interrupt; 57 struct urb *interrupt;
57 struct tasklet_struct bh; 58 struct tasklet_struct bh;
58 59
@@ -63,6 +64,7 @@ struct usbnet {
63# define EVENT_RX_MEMORY 2 64# define EVENT_RX_MEMORY 2
64# define EVENT_STS_SPLIT 3 65# define EVENT_STS_SPLIT 3
65# define EVENT_LINK_RESET 4 66# define EVENT_LINK_RESET 4
67# define EVENT_RX_PAUSED 5
66}; 68};
67 69
68static inline struct usb_driver *driver_of(struct usb_interface *intf) 70static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -86,6 +88,8 @@ struct driver_info {
86 88
87#define FLAG_FRAMING_AX 0x0040 /* AX88772/178 packets */ 89#define FLAG_FRAMING_AX 0x0040 /* AX88772/178 packets */
88#define FLAG_WLAN 0x0080 /* use "wlan%d" names */ 90#define FLAG_WLAN 0x0080 /* use "wlan%d" names */
91#define FLAG_AVOID_UNLINK_URBS 0x0100 /* don't unlink urbs at usbnet_stop() */
92#define FLAG_SEND_ZLP 0x0200 /* hw requires ZLPs are sent */
89 93
90 94
91 /* init device ... can sleep, or cause probe() failure */ 95 /* init device ... can sleep, or cause probe() failure */
@@ -97,6 +101,9 @@ struct driver_info {
97 /* reset device ... can sleep */ 101 /* reset device ... can sleep */
98 int (*reset)(struct usbnet *); 102 int (*reset)(struct usbnet *);
99 103
104 /* stop device ... can sleep */
105 int (*stop)(struct usbnet *);
106
100 /* see if peer is connected ... can sleep */ 107 /* see if peer is connected ... can sleep */
101 int (*check_connect)(struct usbnet *); 108 int (*check_connect)(struct usbnet *);
102 109
@@ -118,9 +125,8 @@ struct driver_info {
118 * right after minidriver have initialized hardware. */ 125 * right after minidriver have initialized hardware. */
119 int (*early_init)(struct usbnet *dev); 126 int (*early_init)(struct usbnet *dev);
120 127
121 /* called by minidriver when link state changes, state: 0=disconnect, 128 /* called by minidriver when receiving indication */
122 * 1=connect */ 129 void (*indication)(struct usbnet *dev, void *ind, int indlen);
123 void (*link_change)(struct usbnet *dev, int state);
124 130
125 /* for new devices, use the descriptor-reading code instead */ 131 /* for new devices, use the descriptor-reading code instead */
126 int in; /* rx endpoint */ 132 int in; /* rx endpoint */
@@ -177,7 +183,8 @@ struct skb_data { /* skb->cb is one of these */
177 183
178extern int usbnet_open (struct net_device *net); 184extern int usbnet_open (struct net_device *net);
179extern int usbnet_stop (struct net_device *net); 185extern int usbnet_stop (struct net_device *net);
180extern int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net); 186extern netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
187 struct net_device *net);
181extern void usbnet_tx_timeout (struct net_device *net); 188extern void usbnet_tx_timeout (struct net_device *net);
182extern int usbnet_change_mtu (struct net_device *net, int new_mtu); 189extern int usbnet_change_mtu (struct net_device *net, int new_mtu);
183 190
@@ -187,6 +194,10 @@ extern void usbnet_defer_kevent (struct usbnet *, int);
187extern void usbnet_skb_return (struct usbnet *, struct sk_buff *); 194extern void usbnet_skb_return (struct usbnet *, struct sk_buff *);
188extern void usbnet_unlink_rx_urbs(struct usbnet *); 195extern void usbnet_unlink_rx_urbs(struct usbnet *);
189 196
197extern void usbnet_pause_rx(struct usbnet *);
198extern void usbnet_resume_rx(struct usbnet *);
199extern void usbnet_purge_paused_rxq(struct usbnet *);
200
190extern int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd); 201extern int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd);
191extern int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd); 202extern int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd);
192extern u32 usbnet_get_link (struct net_device *net); 203extern u32 usbnet_get_link (struct net_device *net);
diff --git a/include/linux/usb/video.h b/include/linux/usb/video.h
new file mode 100644
index 000000000000..be436d9ee479
--- /dev/null
+++ b/include/linux/usb/video.h
@@ -0,0 +1,164 @@
1/*
2 * USB Video Class definitions.
3 *
4 * Copyright (C) 2009 Laurent Pinchart <laurent.pinchart@skynet.be>
5 *
6 * This file holds USB constants and structures defined by the USB Device
7 * Class Definition for Video Devices. Unless otherwise stated, comments
8 * below reference relevant sections of the USB Video Class 1.1 specification
9 * available at
10 *
11 * http://www.usb.org/developers/devclass_docs/USB_Video_Class_1_1.zip
12 */
13
14#ifndef __LINUX_USB_VIDEO_H
15#define __LINUX_USB_VIDEO_H
16
17#include <linux/types.h>
18
19/* --------------------------------------------------------------------------
20 * UVC constants
21 */
22
23/* A.2. Video Interface Subclass Codes */
24#define UVC_SC_UNDEFINED 0x00
25#define UVC_SC_VIDEOCONTROL 0x01
26#define UVC_SC_VIDEOSTREAMING 0x02
27#define UVC_SC_VIDEO_INTERFACE_COLLECTION 0x03
28
29/* A.3. Video Interface Protocol Codes */
30#define UVC_PC_PROTOCOL_UNDEFINED 0x00
31
32/* A.5. Video Class-Specific VC Interface Descriptor Subtypes */
33#define UVC_VC_DESCRIPTOR_UNDEFINED 0x00
34#define UVC_VC_HEADER 0x01
35#define UVC_VC_INPUT_TERMINAL 0x02
36#define UVC_VC_OUTPUT_TERMINAL 0x03
37#define UVC_VC_SELECTOR_UNIT 0x04
38#define UVC_VC_PROCESSING_UNIT 0x05
39#define UVC_VC_EXTENSION_UNIT 0x06
40
41/* A.6. Video Class-Specific VS Interface Descriptor Subtypes */
42#define UVC_VS_UNDEFINED 0x00
43#define UVC_VS_INPUT_HEADER 0x01
44#define UVC_VS_OUTPUT_HEADER 0x02
45#define UVC_VS_STILL_IMAGE_FRAME 0x03
46#define UVC_VS_FORMAT_UNCOMPRESSED 0x04
47#define UVC_VS_FRAME_UNCOMPRESSED 0x05
48#define UVC_VS_FORMAT_MJPEG 0x06
49#define UVC_VS_FRAME_MJPEG 0x07
50#define UVC_VS_FORMAT_MPEG2TS 0x0a
51#define UVC_VS_FORMAT_DV 0x0c
52#define UVC_VS_COLORFORMAT 0x0d
53#define UVC_VS_FORMAT_FRAME_BASED 0x10
54#define UVC_VS_FRAME_FRAME_BASED 0x11
55#define UVC_VS_FORMAT_STREAM_BASED 0x12
56
57/* A.7. Video Class-Specific Endpoint Descriptor Subtypes */
58#define UVC_EP_UNDEFINED 0x00
59#define UVC_EP_GENERAL 0x01
60#define UVC_EP_ENDPOINT 0x02
61#define UVC_EP_INTERRUPT 0x03
62
63/* A.8. Video Class-Specific Request Codes */
64#define UVC_RC_UNDEFINED 0x00
65#define UVC_SET_CUR 0x01
66#define UVC_GET_CUR 0x81
67#define UVC_GET_MIN 0x82
68#define UVC_GET_MAX 0x83
69#define UVC_GET_RES 0x84
70#define UVC_GET_LEN 0x85
71#define UVC_GET_INFO 0x86
72#define UVC_GET_DEF 0x87
73
74/* A.9.1. VideoControl Interface Control Selectors */
75#define UVC_VC_CONTROL_UNDEFINED 0x00
76#define UVC_VC_VIDEO_POWER_MODE_CONTROL 0x01
77#define UVC_VC_REQUEST_ERROR_CODE_CONTROL 0x02
78
79/* A.9.2. Terminal Control Selectors */
80#define UVC_TE_CONTROL_UNDEFINED 0x00
81
82/* A.9.3. Selector Unit Control Selectors */
83#define UVC_SU_CONTROL_UNDEFINED 0x00
84#define UVC_SU_INPUT_SELECT_CONTROL 0x01
85
86/* A.9.4. Camera Terminal Control Selectors */
87#define UVC_CT_CONTROL_UNDEFINED 0x00
88#define UVC_CT_SCANNING_MODE_CONTROL 0x01
89#define UVC_CT_AE_MODE_CONTROL 0x02
90#define UVC_CT_AE_PRIORITY_CONTROL 0x03
91#define UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x04
92#define UVC_CT_EXPOSURE_TIME_RELATIVE_CONTROL 0x05
93#define UVC_CT_FOCUS_ABSOLUTE_CONTROL 0x06
94#define UVC_CT_FOCUS_RELATIVE_CONTROL 0x07
95#define UVC_CT_FOCUS_AUTO_CONTROL 0x08
96#define UVC_CT_IRIS_ABSOLUTE_CONTROL 0x09
97#define UVC_CT_IRIS_RELATIVE_CONTROL 0x0a
98#define UVC_CT_ZOOM_ABSOLUTE_CONTROL 0x0b
99#define UVC_CT_ZOOM_RELATIVE_CONTROL 0x0c
100#define UVC_CT_PANTILT_ABSOLUTE_CONTROL 0x0d
101#define UVC_CT_PANTILT_RELATIVE_CONTROL 0x0e
102#define UVC_CT_ROLL_ABSOLUTE_CONTROL 0x0f
103#define UVC_CT_ROLL_RELATIVE_CONTROL 0x10
104#define UVC_CT_PRIVACY_CONTROL 0x11
105
106/* A.9.5. Processing Unit Control Selectors */
107#define UVC_PU_CONTROL_UNDEFINED 0x00
108#define UVC_PU_BACKLIGHT_COMPENSATION_CONTROL 0x01
109#define UVC_PU_BRIGHTNESS_CONTROL 0x02
110#define UVC_PU_CONTRAST_CONTROL 0x03
111#define UVC_PU_GAIN_CONTROL 0x04
112#define UVC_PU_POWER_LINE_FREQUENCY_CONTROL 0x05
113#define UVC_PU_HUE_CONTROL 0x06
114#define UVC_PU_SATURATION_CONTROL 0x07
115#define UVC_PU_SHARPNESS_CONTROL 0x08
116#define UVC_PU_GAMMA_CONTROL 0x09
117#define UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x0a
118#define UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL 0x0b
119#define UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL 0x0c
120#define UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x0d
121#define UVC_PU_DIGITAL_MULTIPLIER_CONTROL 0x0e
122#define UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x0f
123#define UVC_PU_HUE_AUTO_CONTROL 0x10
124#define UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL 0x11
125#define UVC_PU_ANALOG_LOCK_STATUS_CONTROL 0x12
126
127/* A.9.7. VideoStreaming Interface Control Selectors */
128#define UVC_VS_CONTROL_UNDEFINED 0x00
129#define UVC_VS_PROBE_CONTROL 0x01
130#define UVC_VS_COMMIT_CONTROL 0x02
131#define UVC_VS_STILL_PROBE_CONTROL 0x03
132#define UVC_VS_STILL_COMMIT_CONTROL 0x04
133#define UVC_VS_STILL_IMAGE_TRIGGER_CONTROL 0x05
134#define UVC_VS_STREAM_ERROR_CODE_CONTROL 0x06
135#define UVC_VS_GENERATE_KEY_FRAME_CONTROL 0x07
136#define UVC_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08
137#define UVC_VS_SYNC_DELAY_CONTROL 0x09
138
139/* B.1. USB Terminal Types */
140#define UVC_TT_VENDOR_SPECIFIC 0x0100
141#define UVC_TT_STREAMING 0x0101
142
143/* B.2. Input Terminal Types */
144#define UVC_ITT_VENDOR_SPECIFIC 0x0200
145#define UVC_ITT_CAMERA 0x0201
146#define UVC_ITT_MEDIA_TRANSPORT_INPUT 0x0202
147
148/* B.3. Output Terminal Types */
149#define UVC_OTT_VENDOR_SPECIFIC 0x0300
150#define UVC_OTT_DISPLAY 0x0301
151#define UVC_OTT_MEDIA_TRANSPORT_OUTPUT 0x0302
152
153/* B.4. External Terminal Types */
154#define UVC_EXTERNAL_VENDOR_SPECIFIC 0x0400
155#define UVC_COMPOSITE_CONNECTOR 0x0401
156#define UVC_SVIDEO_CONNECTOR 0x0402
157#define UVC_COMPONENT_CONNECTOR 0x0403
158
159/* 2.4.2.2. Status Packet Type */
160#define UVC_STATUS_TYPE_CONTROL 1
161#define UVC_STATUS_TYPE_STREAMING 2
162
163#endif /* __LINUX_USB_VIDEO_H */
164
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 0044d9b4cb85..b2a7d8ba6ee3 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -77,6 +77,7 @@ struct usbdevfs_connectinfo {
77 77
78#define USBDEVFS_URB_SHORT_NOT_OK 0x01 78#define USBDEVFS_URB_SHORT_NOT_OK 0x01
79#define USBDEVFS_URB_ISO_ASAP 0x02 79#define USBDEVFS_URB_ISO_ASAP 0x02
80#define USBDEVFS_URB_BULK_CONTINUATION 0x04
80#define USBDEVFS_URB_NO_FSBR 0x20 81#define USBDEVFS_URB_NO_FSBR 0x20
81#define USBDEVFS_URB_ZERO_PACKET 0x40 82#define USBDEVFS_URB_ZERO_PACKET 0x40
82#define USBDEVFS_URB_NO_INTERRUPT 0x80 83#define USBDEVFS_URB_NO_INTERRUPT 0x80
@@ -175,4 +176,6 @@ struct usbdevfs_ioctl32 {
175#define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int) 176#define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int)
176#define USBDEVFS_DISCONNECT _IO('U', 22) 177#define USBDEVFS_DISCONNECT _IO('U', 22)
177#define USBDEVFS_CONNECT _IO('U', 23) 178#define USBDEVFS_CONNECT _IO('U', 23)
179#define USBDEVFS_CLAIM_PORT _IOR('U', 24, unsigned int)
180#define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int)
178#endif /* _LINUX_USBDEVICE_FS_H */ 181#endif /* _LINUX_USBDEVICE_FS_H */
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 3656b300de3a..69f39974c041 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -36,7 +36,6 @@ struct new_utsname {
36#include <linux/kref.h> 36#include <linux/kref.h>
37#include <linux/nsproxy.h> 37#include <linux/nsproxy.h>
38#include <linux/err.h> 38#include <linux/err.h>
39#include <asm/atomic.h>
40 39
41struct uts_namespace { 40struct uts_namespace {
42 struct kref kref; 41 struct kref kref;
diff --git a/include/linux/uwb.h b/include/linux/uwb.h
index c02128991ff7..7fc9746f22cd 100644
--- a/include/linux/uwb.h
+++ b/include/linux/uwb.h
@@ -597,7 +597,7 @@ void uwb_rc_neh_grok(struct uwb_rc *, void *, size_t);
597void uwb_rc_neh_error(struct uwb_rc *, int); 597void uwb_rc_neh_error(struct uwb_rc *, int);
598void uwb_rc_reset_all(struct uwb_rc *rc); 598void uwb_rc_reset_all(struct uwb_rc *rc);
599void uwb_rc_pre_reset(struct uwb_rc *rc); 599void uwb_rc_pre_reset(struct uwb_rc *rc);
600void uwb_rc_post_reset(struct uwb_rc *rc); 600int uwb_rc_post_reset(struct uwb_rc *rc);
601 601
602/** 602/**
603 * uwb_rsv_is_owner - is the owner of this reservation the RC? 603 * uwb_rsv_is_owner - is the owner of this reservation the RC?
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
new file mode 100644
index 000000000000..2dfaa293ae8c
--- /dev/null
+++ b/include/linux/vgaarb.h
@@ -0,0 +1,210 @@
1/*
2 * The VGA aribiter manages VGA space routing and VGA resource decode to
3 * allow multiple VGA devices to be used in a system in a safe way.
4 *
5 * (C) Copyright 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org>
6 * (C) Copyright 2007 Paulo R. Zanoni <przanoni@gmail.com>
7 * (C) Copyright 2007, 2009 Tiago Vignatti <vignatti@freedesktop.org>
8 */
9
10#ifndef LINUX_VGA_H
11
12#include <asm/vga.h>
13
14/* Legacy VGA regions */
15#define VGA_RSRC_NONE 0x00
16#define VGA_RSRC_LEGACY_IO 0x01
17#define VGA_RSRC_LEGACY_MEM 0x02
18#define VGA_RSRC_LEGACY_MASK (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM)
19/* Non-legacy access */
20#define VGA_RSRC_NORMAL_IO 0x04
21#define VGA_RSRC_NORMAL_MEM 0x08
22
23/* Passing that instead of a pci_dev to use the system "default"
24 * device, that is the one used by vgacon. Archs will probably
25 * have to provide their own vga_default_device();
26 */
27#define VGA_DEFAULT_DEVICE (NULL)
28
29/* For use by clients */
30
31/**
32 * vga_set_legacy_decoding
33 *
34 * @pdev: pci device of the VGA card
35 * @decodes: bit mask of what legacy regions the card decodes
36 *
37 * Indicates to the arbiter if the card decodes legacy VGA IOs,
38 * legacy VGA Memory, both, or none. All cards default to both,
39 * the card driver (fbdev for example) should tell the arbiter
40 * if it has disabled legacy decoding, so the card can be left
41 * out of the arbitration process (and can be safe to take
42 * interrupts at any time.
43 */
44extern void vga_set_legacy_decoding(struct pci_dev *pdev,
45 unsigned int decodes);
46
47/**
48 * vga_get - acquire & locks VGA resources
49 *
50 * @pdev: pci device of the VGA card or NULL for the system default
51 * @rsrc: bit mask of resources to acquire and lock
52 * @interruptible: blocking should be interruptible by signals ?
53 *
54 * This function acquires VGA resources for the given
55 * card and mark those resources locked. If the resource requested
56 * are "normal" (and not legacy) resources, the arbiter will first check
57 * wether the card is doing legacy decoding for that type of resource. If
58 * yes, the lock is "converted" into a legacy resource lock.
59 * The arbiter will first look for all VGA cards that might conflict
60 * and disable their IOs and/or Memory access, inlcuding VGA forwarding
61 * on P2P bridges if necessary, so that the requested resources can
62 * be used. Then, the card is marked as locking these resources and
63 * the IO and/or Memory accesse are enabled on the card (including
64 * VGA forwarding on parent P2P bridges if any).
65 * This function will block if some conflicting card is already locking
66 * one of the required resources (or any resource on a different bus
67 * segment, since P2P bridges don't differenciate VGA memory and IO
68 * afaik). You can indicate wether this blocking should be interruptible
69 * by a signal (for userland interface) or not.
70 * Must not be called at interrupt time or in atomic context.
71 * If the card already owns the resources, the function succeeds.
72 * Nested calls are supported (a per-resource counter is maintained)
73 */
74
75extern int vga_get(struct pci_dev *pdev, unsigned int rsrc,
76 int interruptible);
77
78/**
79 * vga_get_interruptible
80 *
81 * Shortcut to vga_get
82 */
83
84static inline int vga_get_interruptible(struct pci_dev *pdev,
85 unsigned int rsrc)
86{
87 return vga_get(pdev, rsrc, 1);
88}
89
90/**
91 * vga_get_uninterruptible
92 *
93 * Shortcut to vga_get
94 */
95
96static inline int vga_get_uninterruptible(struct pci_dev *pdev,
97 unsigned int rsrc)
98{
99 return vga_get(pdev, rsrc, 0);
100}
101
102/**
103 * vga_tryget - try to acquire & lock legacy VGA resources
104 *
105 * @pdev: pci devivce of VGA card or NULL for system default
106 * @rsrc: bit mask of resources to acquire and lock
107 *
108 * This function performs the same operation as vga_get(), but
109 * will return an error (-EBUSY) instead of blocking if the resources
110 * are already locked by another card. It can be called in any context
111 */
112
113extern int vga_tryget(struct pci_dev *pdev, unsigned int rsrc);
114
115/**
116 * vga_put - release lock on legacy VGA resources
117 *
118 * @pdev: pci device of VGA card or NULL for system default
119 * @rsrc: but mask of resource to release
120 *
121 * This function releases resources previously locked by vga_get()
122 * or vga_tryget(). The resources aren't disabled right away, so
123 * that a subsequence vga_get() on the same card will succeed
124 * immediately. Resources have a counter, so locks are only
125 * released if the counter reaches 0.
126 */
127
128extern void vga_put(struct pci_dev *pdev, unsigned int rsrc);
129
130
131/**
132 * vga_default_device
133 *
134 * This can be defined by the platform. The default implementation
135 * is rather dumb and will probably only work properly on single
136 * vga card setups and/or x86 platforms.
137 *
138 * If your VGA default device is not PCI, you'll have to return
139 * NULL here. In this case, I assume it will not conflict with
140 * any PCI card. If this is not true, I'll have to define two archs
141 * hooks for enabling/disabling the VGA default device if that is
142 * possible. This may be a problem with real _ISA_ VGA cards, in
143 * addition to a PCI one. I don't know at this point how to deal
144 * with that card. Can theirs IOs be disabled at all ? If not, then
145 * I suppose it's a matter of having the proper arch hook telling
146 * us about it, so we basically never allow anybody to succeed a
147 * vga_get()...
148 */
149
150#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
151extern struct pci_dev *vga_default_device(void);
152#endif
153
154/**
155 * vga_conflicts
156 *
157 * Architectures should define this if they have several
158 * independant PCI domains that can afford concurrent VGA
159 * decoding
160 */
161
162#ifndef __ARCH_HAS_VGA_CONFLICT
163static inline int vga_conflicts(struct pci_dev *p1, struct pci_dev *p2)
164{
165 return 1;
166}
167#endif
168
169/**
170 * vga_client_register
171 *
172 * @pdev: pci device of the VGA client
173 * @cookie: client cookie to be used in callbacks
174 * @irq_set_state: irq state change callback
175 * @set_vga_decode: vga decode change callback
176 *
177 * return value: 0 on success, -1 on failure
178 * Register a client with the VGA arbitration logic
179 *
180 * Clients have two callback mechanisms they can use.
181 * irq enable/disable callback -
182 * If a client can't disable its GPUs VGA resources, then we
183 * need to be able to ask it to turn off its irqs when we
184 * turn off its mem and io decoding.
185 * set_vga_decode
186 * If a client can disable its GPU VGA resource, it will
187 * get a callback from this to set the encode/decode state
188 *
189 * Rationale: we cannot disable VGA decode resources unconditionally
190 * some single GPU laptops seem to require ACPI or BIOS access to the
191 * VGA registers to control things like backlights etc.
192 * Hopefully newer multi-GPU laptops do something saner, and desktops
193 * won't have any special ACPI for this.
194 * They driver will get a callback when VGA arbitration is first used
195 * by userspace since we some older X servers have issues.
196 */
197#if defined(CONFIG_VGA_ARB)
198int vga_client_register(struct pci_dev *pdev, void *cookie,
199 void (*irq_set_state)(void *cookie, bool state),
200 unsigned int (*set_vga_decode)(void *cookie, bool state));
201#else
202static inline int vga_client_register(struct pci_dev *pdev, void *cookie,
203 void (*irq_set_state)(void *cookie, bool state),
204 unsigned int (*set_vga_decode)(void *cookie, bool state))
205{
206 return 0;
207}
208#endif
209
210#endif /* LINUX_VGA_H */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 74f16876f38d..b59e78c57161 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -167,6 +167,7 @@ enum v4l2_ctrl_type {
167 V4L2_CTRL_TYPE_BUTTON = 4, 167 V4L2_CTRL_TYPE_BUTTON = 4,
168 V4L2_CTRL_TYPE_INTEGER64 = 5, 168 V4L2_CTRL_TYPE_INTEGER64 = 5,
169 V4L2_CTRL_TYPE_CTRL_CLASS = 6, 169 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
170 V4L2_CTRL_TYPE_STRING = 7,
170}; 171};
171 172
172enum v4l2_tuner_type { 173enum v4l2_tuner_type {
@@ -252,10 +253,12 @@ struct v4l2_capability {
252#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ 253#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */
253#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */ 254#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 */ 255#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */
256#define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */
255 257
256#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ 258#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */
257#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ 259#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */
258#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ 260#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */
261#define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */
259 262
260#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ 263#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */
261#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ 264#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */
@@ -275,7 +278,9 @@ struct v4l2_pix_format {
275 __u32 priv; /* private data, depends on pixelformat */ 278 __u32 priv; /* private data, depends on pixelformat */
276}; 279};
277 280
278/* Pixel format FOURCC depth Description */ 281/* Pixel format FOURCC depth Description */
282
283/* RGB formats */
279#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */ 284#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */
280#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */ 285#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */
281#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */ 286#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */
@@ -286,12 +291,20 @@ struct v4l2_pix_format {
286#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */ 291#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */
287#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */ 292#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */
288#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */ 293#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */
294
295/* Grey formats */
289#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ 296#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
290#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ 297#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */
298
299/* Palette formats */
291#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */ 300#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */
301
302/* Luminance+Chrominance formats */
292#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */ 303#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */
293#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */ 304#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */
294#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */ 305#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */
306#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */
307#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
295#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */ 308#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */
296#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */ 309#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */
297#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */ 310#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */
@@ -301,6 +314,10 @@ struct v4l2_pix_format {
301#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */ 314#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */
302#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */ 315#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */
303#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */ 316#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */
317#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
318#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */
319#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */
320#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */
304 321
305/* two planes -- one Y, one Cr + Cb interleaved */ 322/* two planes -- one Y, one Cr + Cb interleaved */
306#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ 323#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */
@@ -308,25 +325,17 @@ struct v4l2_pix_format {
308#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */ 325#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
309#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */ 326#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
310 327
311/* The following formats are not defined in the V4L2 specification */ 328/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
312#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
313#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */
314#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */
315#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */
316#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */
317
318/* see http://www.siliconimaging.com/RGB%20Bayer.htm */
319#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ 329#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
320#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ 330#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */
321#define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */ 331#define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */
322 332#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10bit raw bayer */
323/* 333 /* 10bit raw bayer DPCM compressed to 8 bits */
324 * 10bit raw bayer, expanded to 16 bits
325 * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb...
326 */
327#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0')
328/* 10bit raw bayer DPCM compressed to 8 bits */
329#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') 334#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
335 /*
336 * 10bit raw bayer, expanded to 16 bits
337 * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb...
338 */
330#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */ 339#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */
331 340
332/* compressed formats */ 341/* compressed formats */
@@ -350,7 +359,6 @@ struct v4l2_pix_format {
350#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */ 359#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
351#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */ 360#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
352#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ 361#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
353#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
354#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ 362#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */
355#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ 363#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
356 364
@@ -367,6 +375,7 @@ struct v4l2_fmtdesc {
367}; 375};
368 376
369#define V4L2_FMT_FLAG_COMPRESSED 0x0001 377#define V4L2_FMT_FLAG_COMPRESSED 0x0001
378#define V4L2_FMT_FLAG_EMULATED 0x0002
370 379
371#if 1 380#if 1
372 /* Experimental Frame Size and frame rate enumeration */ 381 /* Experimental Frame Size and frame rate enumeration */
@@ -788,11 +797,12 @@ struct v4l2_control {
788 797
789struct v4l2_ext_control { 798struct v4l2_ext_control {
790 __u32 id; 799 __u32 id;
791 __u32 reserved2[2]; 800 __u32 size;
801 __u32 reserved2[1];
792 union { 802 union {
793 __s32 value; 803 __s32 value;
794 __s64 value64; 804 __s64 value64;
795 void *reserved; 805 char *string;
796 }; 806 };
797} __attribute__ ((packed)); 807} __attribute__ ((packed));
798 808
@@ -808,6 +818,7 @@ struct v4l2_ext_controls {
808#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */ 818#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */
809#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ 819#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
810#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ 820#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
821#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
811 822
812#define V4L2_CTRL_ID_MASK (0x0fffffff) 823#define V4L2_CTRL_ID_MASK (0x0fffffff)
813#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 824#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
@@ -899,9 +910,10 @@ enum v4l2_colorfx {
899 V4L2_COLORFX_SEPIA = 2, 910 V4L2_COLORFX_SEPIA = 2,
900}; 911};
901#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) 912#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
913#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
902 914
903/* last CID + 1 */ 915/* last CID + 1 */
904#define V4L2_CID_LASTP1 (V4L2_CID_BASE+33) 916#define V4L2_CID_LASTP1 (V4L2_CID_BASE+34)
905 917
906/* MPEG-class control IDs defined by V4L2 */ 918/* MPEG-class control IDs defined by V4L2 */
907#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 919#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
@@ -1147,6 +1159,39 @@ enum v4l2_exposure_auto_type {
1147 1159
1148#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) 1160#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16)
1149 1161
1162/* FM Modulator class control IDs */
1163#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
1164#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
1165
1166#define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1)
1167#define V4L2_CID_RDS_TX_PI (V4L2_CID_FM_TX_CLASS_BASE + 2)
1168#define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3)
1169#define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5)
1170#define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6)
1171
1172#define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64)
1173#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65)
1174#define V4L2_CID_AUDIO_LIMITER_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 66)
1175
1176#define V4L2_CID_AUDIO_COMPRESSION_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 80)
1177#define V4L2_CID_AUDIO_COMPRESSION_GAIN (V4L2_CID_FM_TX_CLASS_BASE + 81)
1178#define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD (V4L2_CID_FM_TX_CLASS_BASE + 82)
1179#define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME (V4L2_CID_FM_TX_CLASS_BASE + 83)
1180#define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 84)
1181
1182#define V4L2_CID_PILOT_TONE_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 96)
1183#define V4L2_CID_PILOT_TONE_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 97)
1184#define V4L2_CID_PILOT_TONE_FREQUENCY (V4L2_CID_FM_TX_CLASS_BASE + 98)
1185
1186#define V4L2_CID_TUNE_PREEMPHASIS (V4L2_CID_FM_TX_CLASS_BASE + 112)
1187enum v4l2_preemphasis {
1188 V4L2_PREEMPHASIS_DISABLED = 0,
1189 V4L2_PREEMPHASIS_50_uS = 1,
1190 V4L2_PREEMPHASIS_75_uS = 2,
1191};
1192#define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113)
1193#define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114)
1194
1150/* 1195/*
1151 * T U N I N G 1196 * T U N I N G
1152 */ 1197 */
@@ -1181,6 +1226,7 @@ struct v4l2_modulator {
1181#define V4L2_TUNER_CAP_LANG2 0x0020 1226#define V4L2_TUNER_CAP_LANG2 0x0020
1182#define V4L2_TUNER_CAP_SAP 0x0020 1227#define V4L2_TUNER_CAP_SAP 0x0020
1183#define V4L2_TUNER_CAP_LANG1 0x0040 1228#define V4L2_TUNER_CAP_LANG1 0x0040
1229#define V4L2_TUNER_CAP_RDS 0x0080
1184 1230
1185/* Flags for the 'rxsubchans' field */ 1231/* Flags for the 'rxsubchans' field */
1186#define V4L2_TUNER_SUB_MONO 0x0001 1232#define V4L2_TUNER_SUB_MONO 0x0001
@@ -1188,6 +1234,7 @@ struct v4l2_modulator {
1188#define V4L2_TUNER_SUB_LANG2 0x0004 1234#define V4L2_TUNER_SUB_LANG2 0x0004
1189#define V4L2_TUNER_SUB_SAP 0x0004 1235#define V4L2_TUNER_SUB_SAP 0x0004
1190#define V4L2_TUNER_SUB_LANG1 0x0008 1236#define V4L2_TUNER_SUB_LANG1 0x0008
1237#define V4L2_TUNER_SUB_RDS 0x0010
1191 1238
1192/* Values for the 'audmode' field */ 1239/* Values for the 'audmode' field */
1193#define V4L2_TUNER_MODE_MONO 0x0000 1240#define V4L2_TUNER_MODE_MONO 0x0000
@@ -1213,6 +1260,27 @@ struct v4l2_hw_freq_seek {
1213}; 1260};
1214 1261
1215/* 1262/*
1263 * R D S
1264 */
1265
1266struct v4l2_rds_data {
1267 __u8 lsb;
1268 __u8 msb;
1269 __u8 block;
1270} __attribute__ ((packed));
1271
1272#define V4L2_RDS_BLOCK_MSK 0x7
1273#define V4L2_RDS_BLOCK_A 0
1274#define V4L2_RDS_BLOCK_B 1
1275#define V4L2_RDS_BLOCK_C 2
1276#define V4L2_RDS_BLOCK_D 3
1277#define V4L2_RDS_BLOCK_C_ALT 4
1278#define V4L2_RDS_BLOCK_INVALID 7
1279
1280#define V4L2_RDS_BLOCK_CORRECTED 0x40
1281#define V4L2_RDS_BLOCK_ERROR 0x80
1282
1283/*
1216 * A U D I O 1284 * A U D I O
1217 */ 1285 */
1218struct v4l2_audio { 1286struct v4l2_audio {
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 4fca4f5440ba..057a2e010758 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -34,7 +34,7 @@ struct virtqueue {
34 * out_num: the number of sg readable by other side 34 * out_num: the number of sg readable by other side
35 * in_num: the number of sg which are writable (after readable ones) 35 * in_num: the number of sg which are writable (after readable ones)
36 * data: the token identifying the buffer. 36 * data: the token identifying the buffer.
37 * Returns 0 or an error. 37 * Returns remaining capacity of queue (sg segments) or a negative error.
38 * @kick: update after add_buf 38 * @kick: update after add_buf
39 * vq: the struct virtqueue 39 * vq: the struct virtqueue
40 * After one or more add_buf calls, invoke this to kick the other side. 40 * After one or more add_buf calls, invoke this to kick the other side.
diff --git a/include/linux/virtio_9p.h b/include/linux/virtio_9p.h
index b3c4a60ceeb3..095e10d148b4 100644
--- a/include/linux/virtio_9p.h
+++ b/include/linux/virtio_9p.h
@@ -2,10 +2,9 @@
2#define _LINUX_VIRTIO_9P_H 2#define _LINUX_VIRTIO_9P_H
3/* This header is BSD licensed so anyone can use the definitions to implement 3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/virtio_ids.h>
5#include <linux/virtio_config.h> 6#include <linux/virtio_config.h>
6 7
7/* The ID for virtio console */
8#define VIRTIO_ID_9P 9
9/* Maximum number of virtio channels per partition (1 for now) */ 8/* Maximum number of virtio channels per partition (1 for now) */
10#define MAX_9P_CHAN 1 9#define MAX_9P_CHAN 1
11 10
diff --git a/include/linux/virtio_balloon.h b/include/linux/virtio_balloon.h
index 8726ff77763e..1418f048cb34 100644
--- a/include/linux/virtio_balloon.h
+++ b/include/linux/virtio_balloon.h
@@ -2,11 +2,9 @@
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 3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/virtio_ids.h>
5#include <linux/virtio_config.h> 6#include <linux/virtio_config.h>
6 7
7/* The ID for virtio_balloon */
8#define VIRTIO_ID_BALLOON 5
9
10/* The feature bitmap for virtio balloon */ 8/* The feature bitmap for virtio balloon */
11#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */ 9#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */
12 10
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h
index 8dab9f2b8832..fd294c56d571 100644
--- a/include/linux/virtio_blk.h
+++ b/include/linux/virtio_blk.h
@@ -3,11 +3,9 @@
3/* This header is BSD licensed so anyone can use the definitions to implement 3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/virtio_ids.h>
6#include <linux/virtio_config.h> 7#include <linux/virtio_config.h>
7 8
8/* The ID for virtio_block */
9#define VIRTIO_ID_BLOCK 2
10
11/* Feature bits */ 9/* Feature bits */
12#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ 10#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */
13#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ 11#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
@@ -16,9 +14,7 @@
16#define VIRTIO_BLK_F_RO 5 /* Disk is read-only */ 14#define VIRTIO_BLK_F_RO 5 /* Disk is read-only */
17#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ 15#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/
18#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ 16#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */
19#define VIRTIO_BLK_F_IDENTIFY 8 /* ATA IDENTIFY supported */ 17#define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */
20
21#define VIRTIO_BLK_ID_BYTES (sizeof(__u16[256])) /* IDENTIFY DATA */
22 18
23struct virtio_blk_config { 19struct virtio_blk_config {
24 /* The capacity (in 512-byte sectors). */ 20 /* The capacity (in 512-byte sectors). */
@@ -35,9 +31,19 @@ struct virtio_blk_config {
35 } geometry; 31 } geometry;
36 /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ 32 /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */
37 __u32 blk_size; 33 __u32 blk_size;
38 __u8 identify[VIRTIO_BLK_ID_BYTES];
39} __attribute__((packed)); 34} __attribute__((packed));
40 35
36/*
37 * Command types
38 *
39 * Usage is a bit tricky as some bits are used as flags and some are not.
40 *
41 * Rules:
42 * VIRTIO_BLK_T_OUT may be combined with VIRTIO_BLK_T_SCSI_CMD or
43 * VIRTIO_BLK_T_BARRIER. VIRTIO_BLK_T_FLUSH is a command of its own
44 * and may not be combined with any of the other flags.
45 */
46
41/* These two define direction. */ 47/* These two define direction. */
42#define VIRTIO_BLK_T_IN 0 48#define VIRTIO_BLK_T_IN 0
43#define VIRTIO_BLK_T_OUT 1 49#define VIRTIO_BLK_T_OUT 1
@@ -45,6 +51,9 @@ struct virtio_blk_config {
45/* This bit says it's a scsi command, not an actual read or write. */ 51/* This bit says it's a scsi command, not an actual read or write. */
46#define VIRTIO_BLK_T_SCSI_CMD 2 52#define VIRTIO_BLK_T_SCSI_CMD 2
47 53
54/* Cache flush command */
55#define VIRTIO_BLK_T_FLUSH 4
56
48/* Barrier before this op. */ 57/* Barrier before this op. */
49#define VIRTIO_BLK_T_BARRIER 0x80000000 58#define VIRTIO_BLK_T_BARRIER 0x80000000
50 59
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index e547e3c8ee9a..0093dd7c1d6f 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -109,8 +109,7 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
109 unsigned int fbit) 109 unsigned int fbit)
110{ 110{
111 /* Did you forget to fix assumptions on max features? */ 111 /* Did you forget to fix assumptions on max features? */
112 if (__builtin_constant_p(fbit)) 112 MAYBE_BUILD_BUG_ON(fbit >= 32);
113 BUILD_BUG_ON(fbit >= 32);
114 113
115 if (fbit < VIRTIO_TRANSPORT_F_START) 114 if (fbit < VIRTIO_TRANSPORT_F_START)
116 virtio_check_driver_offered_feature(vdev, fbit); 115 virtio_check_driver_offered_feature(vdev, fbit);
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h
index dc161115ae35..fe885174cc1f 100644
--- a/include/linux/virtio_console.h
+++ b/include/linux/virtio_console.h
@@ -1,13 +1,11 @@
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/types.h> 3#include <linux/types.h>
4#include <linux/virtio_ids.h>
4#include <linux/virtio_config.h> 5#include <linux/virtio_config.h>
5/* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so 6/* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
6 * anyone can use the definitions to implement compatible drivers/servers. */ 7 * anyone can use the definitions to implement compatible drivers/servers. */
7 8
8/* The ID for virtio console */
9#define VIRTIO_ID_CONSOLE 3
10
11/* Feature bits */ 9/* Feature bits */
12#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ 10#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */
13 11
diff --git a/include/linux/virtio_ids.h b/include/linux/virtio_ids.h
new file mode 100644
index 000000000000..06660c0a78d7
--- /dev/null
+++ b/include/linux/virtio_ids.h
@@ -0,0 +1,17 @@
1#ifndef _LINUX_VIRTIO_IDS_H
2#define _LINUX_VIRTIO_IDS_H
3/*
4 * Virtio IDs
5 *
6 * This header is BSD licensed so anyone can use the definitions to implement
7 * compatible drivers/servers.
8 */
9
10#define VIRTIO_ID_NET 1 /* virtio net */
11#define VIRTIO_ID_BLOCK 2 /* virtio block */
12#define VIRTIO_ID_CONSOLE 3 /* virtio console */
13#define VIRTIO_ID_RNG 4 /* virtio ring */
14#define VIRTIO_ID_BALLOON 5 /* virtio balloon */
15#define VIRTIO_ID_9P 9 /* 9p virtio console */
16
17#endif /* _LINUX_VIRTIO_IDS_H */
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index d8dd539c9f48..085e42298ce5 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -3,12 +3,10 @@
3/* This header is BSD licensed so anyone can use the definitions to implement 3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/virtio_ids.h>
6#include <linux/virtio_config.h> 7#include <linux/virtio_config.h>
7#include <linux/if_ether.h> 8#include <linux/if_ether.h>
8 9
9/* The ID for virtio_net */
10#define VIRTIO_ID_NET 1
11
12/* The feature bitmap for virtio net */ 10/* The feature bitmap for virtio net */
13#define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */ 11#define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */
14#define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */ 12#define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */
diff --git a/include/linux/virtio_rng.h b/include/linux/virtio_rng.h
index 1a85dab8a940..c4d5de896f0c 100644
--- a/include/linux/virtio_rng.h
+++ b/include/linux/virtio_rng.h
@@ -2,9 +2,7 @@
2#define _LINUX_VIRTIO_RNG_H 2#define _LINUX_VIRTIO_RNG_H
3/* This header is BSD licensed so anyone can use the definitions to implement 3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/virtio_ids.h>
5#include <linux/virtio_config.h> 6#include <linux/virtio_config.h>
6 7
7/* The ID for virtio_rng */
8#define VIRTIO_ID_RNG 4
9
10#endif /* _LINUX_VIRTIO_RNG_H */ 8#endif /* _LINUX_VIRTIO_RNG_H */
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index a43ebec3a7b9..227c2a585e4f 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -115,4 +115,10 @@ extern rwlock_t vmlist_lock;
115extern struct vm_struct *vmlist; 115extern struct vm_struct *vmlist;
116extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); 116extern __init void vm_area_register_early(struct vm_struct *vm, size_t align);
117 117
118struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
119 const size_t *sizes, int nr_vms,
120 size_t align, gfp_t gfp_mask);
121
122void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms);
123
118#endif /* _LINUX_VMALLOC_H */ 124#endif /* _LINUX_VMALLOC_H */
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 81a97cf8f0a0..2d0f222388a8 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -166,15 +166,8 @@ static inline unsigned long zone_page_state(struct zone *zone,
166 return x; 166 return x;
167} 167}
168 168
169extern unsigned long global_lru_pages(void); 169extern unsigned long global_reclaimable_pages(void);
170 170extern unsigned long zone_reclaimable_pages(struct zone *zone);
171static inline unsigned long zone_lru_pages(struct zone *zone)
172{
173 return (zone_page_state(zone, NR_ACTIVE_ANON)
174 + zone_page_state(zone, NR_ACTIVE_FILE)
175 + zone_page_state(zone, NR_INACTIVE_ANON)
176 + zone_page_state(zone, NR_INACTIVE_FILE));
177}
178 171
179#ifdef CONFIG_NUMA 172#ifdef CONFIG_NUMA
180/* 173/*
@@ -210,11 +203,6 @@ extern void zone_statistics(struct zone *, struct zone *);
210 203
211#endif /* CONFIG_NUMA */ 204#endif /* CONFIG_NUMA */
212 205
213#define __add_zone_page_state(__z, __i, __d) \
214 __mod_zone_page_state(__z, __i, __d)
215#define __sub_zone_page_state(__z, __i, __d) \
216 __mod_zone_page_state(__z, __i,-(__d))
217
218#define add_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, __d) 206#define add_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, __d)
219#define sub_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, -(__d)) 207#define sub_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, -(__d))
220 208
diff --git a/include/linux/vt.h b/include/linux/vt.h
index 02c1c0288770..7ffa11f06232 100644
--- a/include/linux/vt.h
+++ b/include/linux/vt.h
@@ -1,17 +1,6 @@
1#ifndef _LINUX_VT_H 1#ifndef _LINUX_VT_H
2#define _LINUX_VT_H 2#define _LINUX_VT_H
3 3
4#ifdef __KERNEL__
5struct notifier_block;
6
7struct vt_notifier_param {
8 struct vc_data *vc; /* VC on which the update happened */
9 unsigned int c; /* Printed char */
10};
11
12extern int register_vt_notifier(struct notifier_block *nb);
13extern int unregister_vt_notifier(struct notifier_block *nb);
14#endif
15 4
16/* 5/*
17 * These constants are also useful for user-level apps (e.g., VC 6 * These constants are also useful for user-level apps (e.g., VC
@@ -74,4 +63,25 @@ struct vt_consize {
74#define VT_UNLOCKSWITCH 0x560C /* allow vt switching */ 63#define VT_UNLOCKSWITCH 0x560C /* allow vt switching */
75#define VT_GETHIFONTMASK 0x560D /* return hi font mask */ 64#define VT_GETHIFONTMASK 0x560D /* return hi font mask */
76 65
66struct vt_event {
67 unsigned int event;
68#define VT_EVENT_SWITCH 0x0001 /* Console switch */
69#define VT_EVENT_BLANK 0x0002 /* Screen blank */
70#define VT_EVENT_UNBLANK 0x0004 /* Screen unblank */
71#define VT_EVENT_RESIZE 0x0008 /* Resize display */
72#define VT_MAX_EVENT 0x000F
73 unsigned int oldev; /* Old console */
74 unsigned int newev; /* New console (if changing) */
75 unsigned int pad[4]; /* Padding for expansion */
76};
77
78#define VT_WAITEVENT 0x560E /* Wait for an event */
79
80struct vt_setactivate {
81 unsigned int console;
82 struct vt_mode mode;
83};
84
85#define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */
86
77#endif /* _LINUX_VT_H */ 87#endif /* _LINUX_VT_H */
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 2f1113467f70..c0c4e1103a73 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -13,6 +13,7 @@
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#include <linux/consolemap.h>
16#include <linux/notifier.h>
16 17
17/* 18/*
18 * Presently, a lot of graphics programs do not restore the contents of 19 * Presently, a lot of graphics programs do not restore the contents of
@@ -91,7 +92,8 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
91#endif 92#endif
92 93
93/* vt.c */ 94/* vt.c */
94int vt_waitactive(int vt); 95void vt_event_post(unsigned int event, unsigned int old, unsigned int new);
96int vt_waitactive(int n);
95void change_console(struct vc_data *new_vc); 97void change_console(struct vc_data *new_vc);
96void reset_vc(struct vc_data *vc); 98void reset_vc(struct vc_data *vc);
97extern int unbind_con_driver(const struct consw *csw, int first, int last, 99extern int unbind_con_driver(const struct consw *csw, int first, int last,
@@ -116,4 +118,16 @@ struct vt_spawn_console {
116}; 118};
117extern struct vt_spawn_console vt_spawn_con; 119extern struct vt_spawn_console vt_spawn_con;
118 120
121extern int vt_move_to_console(unsigned int vt, int alloc);
122
123/* Interfaces for VC notification of character events (for accessibility etc) */
124
125struct vt_notifier_param {
126 struct vc_data *vc; /* VC on which the update happened */
127 unsigned int c; /* Printed char */
128};
129
130extern int register_vt_notifier(struct notifier_block *nb);
131extern int unregister_vt_notifier(struct notifier_block *nb);
132
119#endif /* _VT_KERN_H */ 133#endif /* _VT_KERN_H */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index cf3c2f5dba51..a48e16b77d5e 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -26,8 +26,8 @@
26#include <asm/current.h> 26#include <asm/current.h>
27 27
28typedef struct __wait_queue wait_queue_t; 28typedef struct __wait_queue wait_queue_t;
29typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int sync, void *key); 29typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int flags, void *key);
30int default_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); 30int default_wake_function(wait_queue_t *wait, unsigned mode, int flags, void *key);
31 31
32struct __wait_queue { 32struct __wait_queue {
33 unsigned int flags; 33 unsigned int flags;
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index cb24204851f7..5b4c6c772a9b 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -1132,6 +1132,14 @@ struct __compat_iw_event {
1132}; 1132};
1133#define IW_EV_COMPAT_LCP_LEN offsetof(struct __compat_iw_event, pointer) 1133#define IW_EV_COMPAT_LCP_LEN offsetof(struct __compat_iw_event, pointer)
1134#define IW_EV_COMPAT_POINT_OFF offsetof(struct compat_iw_point, length) 1134#define IW_EV_COMPAT_POINT_OFF offsetof(struct compat_iw_point, length)
1135
1136/* Size of the various events for compat */
1137#define IW_EV_COMPAT_CHAR_LEN (IW_EV_COMPAT_LCP_LEN + IFNAMSIZ)
1138#define IW_EV_COMPAT_UINT_LEN (IW_EV_COMPAT_LCP_LEN + sizeof(__u32))
1139#define IW_EV_COMPAT_FREQ_LEN (IW_EV_COMPAT_LCP_LEN + sizeof(struct iw_freq))
1140#define IW_EV_COMPAT_PARAM_LEN (IW_EV_COMPAT_LCP_LEN + sizeof(struct iw_param))
1141#define IW_EV_COMPAT_ADDR_LEN (IW_EV_COMPAT_LCP_LEN + sizeof(struct sockaddr))
1142#define IW_EV_COMPAT_QUAL_LEN (IW_EV_COMPAT_LCP_LEN + sizeof(struct iw_quality))
1135#define IW_EV_COMPAT_POINT_LEN \ 1143#define IW_EV_COMPAT_POINT_LEN \
1136 (IW_EV_COMPAT_LCP_LEN + sizeof(struct compat_iw_point) - \ 1144 (IW_EV_COMPAT_LCP_LEN + sizeof(struct compat_iw_point) - \
1137 IW_EV_COMPAT_POINT_OFF) 1145 IW_EV_COMPAT_POINT_OFF)
diff --git a/include/linux/wm97xx.h b/include/linux/wm97xx.h
index 6f69968eab24..38e8c4d9289e 100644
--- a/include/linux/wm97xx.h
+++ b/include/linux/wm97xx.h
@@ -16,6 +16,12 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17 17
18/* 18/*
19 * WM97xx variants
20 */
21#define WM97xx_GENERIC 0x0000
22#define WM97xx_WM1613 0x1613
23
24/*
19 * WM97xx AC97 Touchscreen registers 25 * WM97xx AC97 Touchscreen registers
20 */ 26 */
21#define AC97_WM97XX_DIGITISER1 0x76 27#define AC97_WM97XX_DIGITISER1 0x76
@@ -283,9 +289,28 @@ struct wm97xx {
283 unsigned pen_is_down:1; /* Pen is down */ 289 unsigned pen_is_down:1; /* Pen is down */
284 unsigned aux_waiting:1; /* aux measurement waiting */ 290 unsigned aux_waiting:1; /* aux measurement waiting */
285 unsigned pen_probably_down:1; /* used in polling mode */ 291 unsigned pen_probably_down:1; /* used in polling mode */
292 u16 variant; /* WM97xx chip variant */
286 u16 suspend_mode; /* PRP in suspend mode */ 293 u16 suspend_mode; /* PRP in suspend mode */
287}; 294};
288 295
296struct wm97xx_batt_pdata {
297 int batt_aux;
298 int temp_aux;
299 int charge_gpio;
300 int min_voltage;
301 int max_voltage;
302 int batt_div;
303 int batt_mult;
304 int temp_div;
305 int temp_mult;
306 int batt_tech;
307 char *batt_name;
308};
309
310struct wm97xx_pdata {
311 struct wm97xx_batt_pdata *batt_pdata; /* battery data */
312};
313
289/* 314/*
290 * Codec GPIO access (not supported on WM9705) 315 * Codec GPIO access (not supported on WM9705)
291 * This can be used to set/get codec GPIO and Virtual GPIO status. 316 * This can be used to set/get codec GPIO and Virtual GPIO status.
diff --git a/include/linux/wm97xx_batt.h b/include/linux/wm97xx_batt.h
index 9681d1ab0e4f..a1d6419c2ff8 100644
--- a/include/linux/wm97xx_batt.h
+++ b/include/linux/wm97xx_batt.h
@@ -3,22 +3,12 @@
3 3
4#include <linux/wm97xx.h> 4#include <linux/wm97xx.h>
5 5
6struct wm97xx_batt_info { 6#warning This file will be removed soon, use wm97xx.h instead!
7 int batt_aux; 7
8 int temp_aux; 8#define wm97xx_batt_info wm97xx_batt_pdata
9 int charge_gpio;
10 int min_voltage;
11 int max_voltage;
12 int batt_div;
13 int batt_mult;
14 int temp_div;
15 int temp_mult;
16 int batt_tech;
17 char *batt_name;
18};
19 9
20#ifdef CONFIG_BATTERY_WM97XX 10#ifdef CONFIG_BATTERY_WM97XX
21void __init wm97xx_bat_set_pdata(struct wm97xx_batt_info *data); 11void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data);
22#else 12#else
23static inline void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data) {} 13static inline void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data) {}
24#endif 14#endif
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 6273fa97b527..cf24c20de9e4 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -94,7 +94,7 @@ struct execute_work {
94/* 94/*
95 * initialize all of a work item in one go 95 * initialize all of a work item in one go
96 * 96 *
97 * NOTE! No point in using "atomic_long_set()": useing a direct 97 * NOTE! No point in using "atomic_long_set()": using a direct
98 * assignment of the work data initializer allows the compiler 98 * assignment of the work data initializer allows the compiler
99 * to generate better code. 99 * to generate better code.
100 */ 100 */
@@ -207,6 +207,7 @@ extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
207 207
208extern void flush_workqueue(struct workqueue_struct *wq); 208extern void flush_workqueue(struct workqueue_struct *wq);
209extern void flush_scheduled_work(void); 209extern void flush_scheduled_work(void);
210extern void flush_delayed_work(struct delayed_work *work);
210 211
211extern int schedule_work(struct work_struct *work); 212extern int schedule_work(struct work_struct *work);
212extern int schedule_work_on(int cpu, struct work_struct *work); 213extern int schedule_work_on(int cpu, struct work_struct *work);
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 3224820c8514..66ebddcff664 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -14,17 +14,6 @@ extern struct list_head inode_in_use;
14extern struct list_head inode_unused; 14extern struct list_head inode_unused;
15 15
16/* 16/*
17 * Yes, writeback.h requires sched.h
18 * No, sched.h is not included from here.
19 */
20static inline int task_is_pdflush(struct task_struct *task)
21{
22 return task->flags & PF_FLUSHER;
23}
24
25#define current_is_pdflush() task_is_pdflush(current)
26
27/*
28 * fs/fs-writeback.c 17 * fs/fs-writeback.c
29 */ 18 */
30enum writeback_sync_modes { 19enum writeback_sync_modes {
@@ -40,6 +29,8 @@ enum writeback_sync_modes {
40struct writeback_control { 29struct writeback_control {
41 struct backing_dev_info *bdi; /* If !NULL, only write back this 30 struct backing_dev_info *bdi; /* If !NULL, only write back this
42 queue */ 31 queue */
32 struct super_block *sb; /* if !NULL, only write inodes from
33 this super_block */
43 enum writeback_sync_modes sync_mode; 34 enum writeback_sync_modes sync_mode;
44 unsigned long *older_than_this; /* If !NULL, only write back inodes 35 unsigned long *older_than_this; /* If !NULL, only write back inodes
45 older than this */ 36 older than this */
@@ -59,7 +50,6 @@ struct writeback_control {
59 unsigned encountered_congestion:1; /* An output: a queue is full */ 50 unsigned encountered_congestion:1; /* An output: a queue is full */
60 unsigned for_kupdate:1; /* A kupdate writeback */ 51 unsigned for_kupdate:1; /* A kupdate writeback */
61 unsigned for_reclaim:1; /* Invoked from the page allocator */ 52 unsigned for_reclaim:1; /* Invoked from the page allocator */
62 unsigned for_writepages:1; /* This is a writepages() call */
63 unsigned range_cyclic:1; /* range_start is cyclic */ 53 unsigned range_cyclic:1; /* range_start is cyclic */
64 unsigned more_io:1; /* more io to be dispatched */ 54 unsigned more_io:1; /* more io to be dispatched */
65 /* 55 /*
@@ -76,9 +66,13 @@ struct writeback_control {
76/* 66/*
77 * fs/fs-writeback.c 67 * fs/fs-writeback.c
78 */ 68 */
79void writeback_inodes(struct writeback_control *wbc); 69struct bdi_writeback;
80int inode_wait(void *); 70int inode_wait(void *);
81void sync_inodes_sb(struct super_block *, int wait); 71void writeback_inodes_sb(struct super_block *);
72void sync_inodes_sb(struct super_block *);
73void writeback_inodes_wbc(struct writeback_control *wbc);
74long wb_do_writeback(struct bdi_writeback *wb, int force_wait);
75void wakeup_flusher_threads(long nr_pages);
82 76
83/* writeback.h requires fs.h; it, too, is not included from here. */ 77/* writeback.h requires fs.h; it, too, is not included from here. */
84static inline void wait_on_inode(struct inode *inode) 78static inline void wait_on_inode(struct inode *inode)
@@ -98,7 +92,6 @@ static inline void inode_sync_wait(struct inode *inode)
98/* 92/*
99 * mm/page-writeback.c 93 * mm/page-writeback.c
100 */ 94 */
101int wakeup_pdflush(long nr_pages);
102void laptop_io_completion(void); 95void laptop_io_completion(void);
103void laptop_sync_completion(void); 96void laptop_sync_completion(void);
104void throttle_vm_writeout(gfp_t gfp_mask); 97void throttle_vm_writeout(gfp_t gfp_mask);
@@ -117,21 +110,20 @@ extern int laptop_mode;
117extern unsigned long determine_dirtyable_memory(void); 110extern unsigned long determine_dirtyable_memory(void);
118 111
119extern int dirty_background_ratio_handler(struct ctl_table *table, int write, 112extern int dirty_background_ratio_handler(struct ctl_table *table, int write,
120 struct file *filp, void __user *buffer, size_t *lenp, 113 void __user *buffer, size_t *lenp,
121 loff_t *ppos); 114 loff_t *ppos);
122extern int dirty_background_bytes_handler(struct ctl_table *table, int write, 115extern int dirty_background_bytes_handler(struct ctl_table *table, int write,
123 struct file *filp, void __user *buffer, size_t *lenp, 116 void __user *buffer, size_t *lenp,
124 loff_t *ppos); 117 loff_t *ppos);
125extern int dirty_ratio_handler(struct ctl_table *table, int write, 118extern int dirty_ratio_handler(struct ctl_table *table, int write,
126 struct file *filp, void __user *buffer, size_t *lenp, 119 void __user *buffer, size_t *lenp,
127 loff_t *ppos); 120 loff_t *ppos);
128extern int dirty_bytes_handler(struct ctl_table *table, int write, 121extern int dirty_bytes_handler(struct ctl_table *table, int write,
129 struct file *filp, void __user *buffer, size_t *lenp, 122 void __user *buffer, size_t *lenp,
130 loff_t *ppos); 123 loff_t *ppos);
131 124
132struct ctl_table; 125struct ctl_table;
133struct file; 126int dirty_writeback_centisecs_handler(struct ctl_table *, int,
134int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *,
135 void __user *, size_t *, loff_t *); 127 void __user *, size_t *, loff_t *);
136 128
137void get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty, 129void get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty,
@@ -150,17 +142,12 @@ balance_dirty_pages_ratelimited(struct address_space *mapping)
150typedef int (*writepage_t)(struct page *page, struct writeback_control *wbc, 142typedef int (*writepage_t)(struct page *page, struct writeback_control *wbc,
151 void *data); 143 void *data);
152 144
153int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0);
154int generic_writepages(struct address_space *mapping, 145int generic_writepages(struct address_space *mapping,
155 struct writeback_control *wbc); 146 struct writeback_control *wbc);
156int write_cache_pages(struct address_space *mapping, 147int write_cache_pages(struct address_space *mapping,
157 struct writeback_control *wbc, writepage_t writepage, 148 struct writeback_control *wbc, writepage_t writepage,
158 void *data); 149 void *data);
159int do_writepages(struct address_space *mapping, struct writeback_control *wbc); 150int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
160int sync_page_range(struct inode *inode, struct address_space *mapping,
161 loff_t pos, loff_t count);
162int sync_page_range_nolock(struct inode *inode, struct address_space *mapping,
163 loff_t pos, loff_t count);
164void set_page_dirty_balance(struct page *page, int page_mkwrite); 151void set_page_dirty_balance(struct page *page, int page_mkwrite);
165void writeback_set_ratelimit(void); 152void writeback_set_ratelimit(void);
166 153
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index d131e352cfe1..5c84af8c5f6f 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -49,6 +49,7 @@ struct xattr_handler {
49ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t); 49ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t);
50ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t); 50ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t);
51ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size); 51ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
52int __vfs_setxattr_noperm(struct dentry *, const char *, const void *, size_t, int);
52int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int); 53int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int);
53int vfs_removexattr(struct dentry *, const char *); 54int vfs_removexattr(struct dentry *, const char *);
54 55