aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2012-03-23 07:06:43 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-03-23 07:06:43 -0400
commit7483d45f0aee3afc0646d185cabd4af9f6cab58c (patch)
treea312f7d77c34748bec62f0431df33007b10e4e7f /include/linux
parent3e85fc1b9fc1c7e20b9a01f2314bb633bb10501a (diff)
parentf92c97c8bd77992ff8bd6ef29a23dc82dca799cb (diff)
Merge branch 'staging/for_v3.4' into v4l_for_linus
* staging/for_v3.4: (10117 commits) [media] update CARDLIST.em28xx [media] partially reverts changeset fa5527c [media] stb0899: fix the limits for signal strength values [media] em28xx: support for 2304:0242 PCTV QuatroStick (510e) [media] em28xx: support for 2013:0251 PCTV QuatroStick nano (520e) [media] -EINVAL -> -ENOTTY [media] gspca - sn9c20x: Cleanup source [media] gspca - sn9c20x: Simplify register write for capture start/stop [media] gspca - sn9c20x: Add automatic JPEG compression mechanism [media] gspca - sn9c20x: Greater delay in case of sensor no response [media] gspca - sn9c20x: Optimize the code of write sequences [media] gspca - sn9c20x: Add the JPEG compression quality control [media] gspca - sn9c20x: Add a delay after Omnivision sensor reset [media] gspca - sn9c20x: Propagate USB errors to higher level [media] gspca - sn9c20x: Use the new video control mechanism [media] gspca - sn9c20x: Fix loss of frame start [media] gspca - zc3xx: Lack of register 08 value for sensor cs2102k [media] gspca - ov534_9: Add brightness to OmniVision 5621 sensor [media] gspca - zc3xx: Add V4L2_CID_JPEG_COMPRESSION_QUALITY control support [media] pvrusb2: fix 7MHz & 8MHz DVB-T tuner support for HVR1900 rev D1F5 ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild3
-rw-r--r--include/linux/acct.h3
-rw-r--r--include/linux/acpi.h24
-rw-r--r--include/linux/acpi_io.h3
-rw-r--r--include/linux/ahci_platform.h2
-rw-r--r--include/linux/amba/bus.h7
-rw-r--r--include/linux/amba/mmci.h2
-rw-r--r--include/linux/amba/pl022.h4
-rw-r--r--include/linux/amba/pl061.h2
-rw-r--r--include/linux/amba/pl08x.h4
-rw-r--r--include/linux/amba/pl330.h15
-rw-r--r--include/linux/amba/serial.h2
-rw-r--r--include/linux/amd-iommu.h138
-rw-r--r--include/linux/ata_platform.h3
-rw-r--r--include/linux/atmdev.h10
-rw-r--r--include/linux/audit.h124
-rw-r--r--include/linux/bcma/bcma.h57
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h1
-rw-r--r--include/linux/binfmts.h3
-rw-r--r--include/linux/bio.h66
-rw-r--r--include/linux/bitops.h30
-rw-r--r--include/linux/blkdev.h101
-rw-r--r--include/linux/bootmem.h2
-rw-r--r--include/linux/can/platform/cc770.h33
-rw-r--r--include/linux/capability.h4
-rw-r--r--include/linux/cdrom.h3
-rw-r--r--include/linux/cgroup.h33
-rw-r--r--include/linux/cgroup_subsys.h8
-rw-r--r--include/linux/clk.h22
-rw-r--r--include/linux/compat.h8
-rw-r--r--include/linux/compiler-gcc.h5
-rw-r--r--include/linux/compiler-gcc4.h1
-rw-r--r--include/linux/compiler.h4
-rw-r--r--include/linux/configfs.h2
-rw-r--r--include/linux/console.h2
-rw-r--r--include/linux/cordic.h4
-rw-r--r--include/linux/cpu.h19
-rw-r--r--include/linux/cpuidle.h9
-rw-r--r--include/linux/crash_dump.h1
-rw-r--r--include/linux/cred.h6
-rw-r--r--include/linux/cuda.h5
-rw-r--r--include/linux/dcache.h36
-rw-r--r--include/linux/debugfs.h72
-rw-r--r--include/linux/debugobjects.h6
-rw-r--r--include/linux/device.h119
-rw-r--r--include/linux/digsig.h64
-rw-r--r--include/linux/display.h61
-rw-r--r--include/linux/dlm.h71
-rw-r--r--include/linux/dma-buf.h176
-rw-r--r--include/linux/dmaengine.h99
-rw-r--r--include/linux/dw_dmac.h2
-rw-r--r--include/linux/dynamic_queue_limits.h97
-rw-r--r--include/linux/edac.h8
-rw-r--r--include/linux/eeprom_93cx6.h8
-rw-r--r--include/linux/efi.h136
-rw-r--r--include/linux/elevator.h50
-rw-r--r--include/linux/elf-em.h1
-rw-r--r--include/linux/elf.h18
-rw-r--r--include/linux/errqueue.h7
-rw-r--r--include/linux/ethtool.h116
-rw-r--r--include/linux/eventpoll.h1
-rw-r--r--include/linux/ext3_fs.h2
-rw-r--r--include/linux/fb.h14
-rw-r--r--include/linux/freezer.h161
-rw-r--r--include/linux/fs.h123
-rw-r--r--include/linux/ftrace.h77
-rw-r--r--include/linux/fuse.h16
-rw-r--r--include/linux/genetlink.h24
-rw-r--r--include/linux/genhd.h3
-rw-r--r--include/linux/gfp.h23
-rw-r--r--include/linux/gfs2_ondisk.h2
-rw-r--r--include/linux/gpio-pxa.h16
-rw-r--r--include/linux/gpio_keys.h2
-rw-r--r--include/linux/hardirq.h21
-rw-r--r--include/linux/hid.h21
-rw-r--r--include/linux/huge_mm.h2
-rw-r--r--include/linux/hyperv.h2
-rw-r--r--include/linux/i2c.h13
-rw-r--r--include/linux/i2c/twl.h2
-rw-r--r--include/linux/ide.h2
-rw-r--r--include/linux/ieee80211.h32
-rw-r--r--include/linux/if.h1
-rw-r--r--include/linux/if_ether.h1
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/if_team.h252
-rw-r--r--include/linux/if_vlan.h80
-rw-r--r--include/linux/inet_diag.h41
-rw-r--r--include/linux/init.h3
-rw-r--r--include/linux/init_task.h9
-rw-r--r--include/linux/input/auo-pixcir-ts.h56
-rw-r--r--include/linux/input/gp2ap002a00f.h22
-rw-r--r--include/linux/input/gpio_tilt.h73
-rw-r--r--include/linux/input/pixcir_ts.h10
-rw-r--r--include/linux/input/samsung-keypad.h43
-rw-r--r--include/linux/input/tca8418_keypad.h44
-rw-r--r--include/linux/iocontext.h137
-rw-r--r--include/linux/iommu.h33
-rw-r--r--include/linux/ipc.h2
-rw-r--r--include/linux/ipv6.h4
-rw-r--r--include/linux/irqdomain.h3
-rw-r--r--include/linux/iscsi_boot_sysfs.h8
-rw-r--r--include/linux/isdn_divertif.h4
-rw-r--r--include/linux/ivtv.h6
-rw-r--r--include/linux/jbd.h5
-rw-r--r--include/linux/jbd2.h1
-rw-r--r--include/linux/jump_label.h27
-rw-r--r--include/linux/kernel.h30
-rw-r--r--include/linux/kernel_stat.h36
-rw-r--r--include/linux/kexec.h2
-rw-r--r--include/linux/key-type.h1
-rw-r--r--include/linux/key.h5
-rw-r--r--include/linux/kmemleak.h8
-rw-r--r--include/linux/kmod.h2
-rw-r--r--include/linux/kmsg_dump.h10
-rw-r--r--include/linux/kobject.h2
-rw-r--r--include/linux/kref.h78
-rw-r--r--include/linux/kthread.h1
-rw-r--r--include/linux/kvm_host.h39
-rw-r--r--include/linux/kvm_para.h1
-rw-r--r--include/linux/latencytop.h3
-rw-r--r--include/linux/leds-tca6507.h34
-rw-r--r--include/linux/linkage.h4
-rw-r--r--include/linux/lockd/lockd.h8
-rw-r--r--include/linux/lockdep.h4
-rw-r--r--include/linux/lp8727.h51
-rw-r--r--include/linux/mbus.h13
-rw-r--r--include/linux/mdio-bitbang.h2
-rw-r--r--include/linux/mdio-gpio.h2
-rw-r--r--include/linux/memblock.h170
-rw-r--r--include/linux/memcontrol.h121
-rw-r--r--include/linux/memory.h3
-rw-r--r--include/linux/mempolicy.h10
-rw-r--r--include/linux/mfd/88pm860x.h3
-rw-r--r--include/linux/mfd/abx500/ab5500.h (renamed from include/linux/mfd/ab5500/ab5500.h)0
-rw-r--r--include/linux/mfd/abx500/ab8500-gpadc.h (renamed from include/linux/mfd/ab8500/gpadc.h)0
-rw-r--r--include/linux/mfd/abx500/ab8500-gpio.h (renamed from include/linux/mfd/ab8500/gpio.h)0
-rw-r--r--include/linux/mfd/abx500/ab8500-sysctrl.h (renamed from include/linux/mfd/ab8500/sysctrl.h)0
-rw-r--r--include/linux/mfd/abx500/ab8500.h (renamed from include/linux/mfd/ab8500.h)0
-rw-r--r--include/linux/mfd/da9052/da9052.h131
-rw-r--r--include/linux/mfd/da9052/pdata.h40
-rw-r--r--include/linux/mfd/da9052/reg.h749
-rw-r--r--include/linux/mfd/max8925.h9
-rw-r--r--include/linux/mfd/max8997.h83
-rw-r--r--include/linux/mfd/mc13xxx.h9
-rw-r--r--include/linux/mfd/mcp.h5
-rw-r--r--include/linux/mfd/s5m87xx/s5m-core.h373
-rw-r--r--include/linux/mfd/s5m87xx/s5m-pmic.h100
-rw-r--r--include/linux/mfd/s5m87xx/s5m-rtc.h84
-rw-r--r--include/linux/mfd/stmpe.h16
-rw-r--r--include/linux/mfd/tps65910.h30
-rw-r--r--include/linux/mfd/twl6040.h2
-rw-r--r--include/linux/mfd/wm8994/core.h7
-rw-r--r--include/linux/mfd/wm8994/pdata.h31
-rw-r--r--include/linux/mfd/wm8994/registers.h112
-rw-r--r--include/linux/migrate.h11
-rw-r--r--include/linux/migrate_mode.h16
-rw-r--r--include/linux/mii.h200
-rw-r--r--include/linux/miscdevice.h3
-rw-r--r--include/linux/mlx4/cmd.h51
-rw-r--r--include/linux/mlx4/device.h81
-rw-r--r--include/linux/mlx4/qp.h28
-rw-r--r--include/linux/mm.h73
-rw-r--r--include/linux/mm_inline.h44
-rw-r--r--include/linux/mm_types.h9
-rw-r--r--include/linux/mmc/card.h27
-rw-r--r--include/linux/mmc/cd-gpio.h19
-rw-r--r--include/linux/mmc/core.h2
-rw-r--r--include/linux/mmc/dw_mmc.h7
-rw-r--r--include/linux/mmc/host.h47
-rw-r--r--include/linux/mmc/mmc.h72
-rw-r--r--include/linux/mmc/sdhci-pci-data.h18
-rw-r--r--include/linux/mmc/sdhci.h3
-rw-r--r--include/linux/mmc/sdio.h29
-rw-r--r--include/linux/mmzone.h42
-rw-r--r--include/linux/mnt_namespace.h31
-rw-r--r--include/linux/mod_devicetable.h18
-rw-r--r--include/linux/module.h21
-rw-r--r--include/linux/moduleparam.h17
-rw-r--r--include/linux/mount.h39
-rw-r--r--include/linux/mpi.h144
-rw-r--r--include/linux/mroute6.h4
-rw-r--r--include/linux/msi.h3
-rw-r--r--include/linux/mtd/cfi.h16
-rw-r--r--include/linux/mtd/cfi_endian.h76
-rw-r--r--include/linux/mtd/gpmi-nand.h68
-rw-r--r--include/linux/mtd/map.h3
-rw-r--r--include/linux/mtd/mtd.h332
-rw-r--r--include/linux/mtd/nand.h1
-rw-r--r--include/linux/mtd/physmap.h1
-rw-r--r--include/linux/neighbour.h1
-rw-r--r--include/linux/netdev_features.h146
-rw-r--r--include/linux/netdevice.h352
-rw-r--r--include/linux/netfilter.h26
-rw-r--r--include/linux/netfilter/Kbuild4
-rw-r--r--include/linux/netfilter/nf_conntrack_tuple_common.h27
-rw-r--r--include/linux/netfilter/nf_nat.h25
-rw-r--r--include/linux/netfilter/nfnetlink.h3
-rw-r--r--include/linux/netfilter/nfnetlink_acct.h36
-rw-r--r--include/linux/netfilter/x_tables.h4
-rw-r--r--include/linux/netfilter/xt_ecn.h35
-rw-r--r--include/linux/netfilter/xt_nfacct.h13
-rw-r--r--include/linux/netfilter/xt_rpfilter.h23
-rw-r--r--include/linux/netfilter_bridge/ebtables.h4
-rw-r--r--include/linux/netfilter_ipv4/Kbuild1
-rw-r--r--include/linux/netfilter_ipv4/ipt_ecn.h38
-rw-r--r--include/linux/netfilter_ipv4/nf_nat.h58
-rw-r--r--include/linux/netlink.h4
-rw-r--r--include/linux/nfc.h31
-rw-r--r--include/linux/nfs_fs.h2
-rw-r--r--include/linux/nfs_fs_sb.h1
-rw-r--r--include/linux/nfs_idmap.h8
-rw-r--r--include/linux/nfs_xdr.h22
-rw-r--r--include/linux/nl80211.h171
-rw-r--r--include/linux/nls.h5
-rw-r--r--include/linux/node.h6
-rw-r--r--include/linux/nvme.h434
-rw-r--r--include/linux/of.h52
-rw-r--r--include/linux/of_fdt.h4
-rw-r--r--include/linux/of_gpio.h10
-rw-r--r--include/linux/oom.h2
-rw-r--r--include/linux/openvswitch.h452
-rw-r--r--include/linux/page-debug-flags.h4
-rw-r--r--include/linux/page_cgroup.h46
-rw-r--r--include/linux/pagevec.h19
-rw-r--r--include/linux/patchkey.h4
-rw-r--r--include/linux/pci-aspm.h4
-rw-r--r--include/linux/pci.h51
-rw-r--r--include/linux/pci_ids.h23
-rw-r--r--include/linux/pci_regs.h36
-rw-r--r--include/linux/pda_power.h2
-rw-r--r--include/linux/percpu.h199
-rw-r--r--include/linux/perf_event.h9
-rw-r--r--include/linux/phonet.h2
-rw-r--r--include/linux/phy.h7
-rw-r--r--include/linux/pid_namespace.h2
-rw-r--r--include/linux/pinctrl/machine.h30
-rw-r--r--include/linux/pinctrl/pinconf.h97
-rw-r--r--include/linux/pinctrl/pinctrl.h15
-rw-r--r--include/linux/pinctrl/pinmux.h29
-rw-r--r--include/linux/pkt_sched.h52
-rw-r--r--include/linux/platform_data/macb.h17
-rw-r--r--include/linux/platform_data/mv_usb.h18
-rw-r--r--include/linux/platform_data/s3c-hsudc.h34
-rw-r--r--include/linux/platform_device.h44
-rw-r--r--include/linux/pm.h15
-rw-r--r--include/linux/pm_domain.h103
-rw-r--r--include/linux/pm_qos.h22
-rw-r--r--include/linux/pm_runtime.h5
-rw-r--r--include/linux/pmu.h4
-rw-r--r--include/linux/poison.h6
-rw-r--r--include/linux/power/charger-manager.h147
-rw-r--r--include/linux/power/sbs-battery.h (renamed from include/linux/power/bq20z75.h)10
-rw-r--r--include/linux/power_supply.h11
-rw-r--r--include/linux/prctl.h12
-rw-r--r--include/linux/proc_fs.h26
-rw-r--r--include/linux/proportions.h4
-rw-r--r--include/linux/pstore.h12
-rw-r--r--include/linux/ptrace.h15
-rw-r--r--include/linux/quota.h6
-rw-r--r--include/linux/radix-tree.h3
-rw-r--r--include/linux/raid/md_p.h7
-rw-r--r--include/linux/raid/pq.h2
-rw-r--r--include/linux/ramfs.h2
-rw-r--r--include/linux/rcupdate.h115
-rw-r--r--include/linux/regmap.h59
-rw-r--r--include/linux/regset.h10
-rw-r--r--include/linux/regulator/consumer.h13
-rw-r--r--include/linux/regulator/driver.h4
-rw-r--r--include/linux/regulator/of_regulator.h22
-rw-r--r--include/linux/reiserfs_fs.h9
-rw-r--r--include/linux/reiserfs_fs_sb.h4
-rw-r--r--include/linux/relay.h2
-rw-r--r--include/linux/res_counter.h11
-rw-r--r--include/linux/rmap.h5
-rw-r--r--include/linux/rtnetlink.h3
-rw-r--r--include/linux/s3c_adc_battery.h4
-rw-r--r--include/linux/sched.h120
-rw-r--r--include/linux/security.h130
-rw-r--r--include/linux/seq_file.h10
-rw-r--r--include/linux/serial_8250.h5
-rw-r--r--include/linux/serial_core.h104
-rw-r--r--include/linux/serial_sci.h22
-rw-r--r--include/linux/sh_clk.h10
-rw-r--r--include/linux/sh_dma.h5
-rw-r--r--include/linux/sh_intc.h1
-rw-r--r--include/linux/sh_pfc.h22
-rw-r--r--include/linux/shmem_fs.h3
-rw-r--r--include/linux/sigma.h55
-rw-r--r--include/linux/signal.h1
-rw-r--r--include/linux/signalfd.h5
-rw-r--r--include/linux/sirfsoc_dma.h6
-rw-r--r--include/linux/skbuff.h96
-rw-r--r--include/linux/slab_def.h2
-rw-r--r--include/linux/smscphy.h25
-rw-r--r--include/linux/snmp.h1
-rw-r--r--include/linux/sock_diag.h48
-rw-r--r--include/linux/sound.h4
-rw-r--r--include/linux/soundcard.h4
-rw-r--r--include/linux/spi/spi.h11
-rw-r--r--include/linux/srcu.h87
-rw-r--r--include/linux/ssb/ssb.h9
-rw-r--r--include/linux/ssb/ssb_regs.h17
-rw-r--r--include/linux/sunrpc/auth.h3
-rw-r--r--include/linux/sunrpc/auth_gss.h2
-rw-r--r--include/linux/sunrpc/cache.h2
-rw-r--r--include/linux/sunrpc/clnt.h8
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h2
-rw-r--r--include/linux/sunrpc/svc_xprt.h3
-rw-r--r--include/linux/sunrpc/svcsock.h2
-rw-r--r--include/linux/sunrpc/xdr.h2
-rw-r--r--include/linux/suspend.h50
-rw-r--r--include/linux/swap.h3
-rw-r--r--include/linux/swiotlb.h2
-rw-r--r--include/linux/syscalls.h26
-rw-r--r--include/linux/sysctl.h2
-rw-r--r--include/linux/sysdev.h164
-rw-r--r--include/linux/sysfs.h8
-rw-r--r--include/linux/tcp.h8
-rw-r--r--include/linux/thermal.h4
-rw-r--r--include/linux/tick.h11
-rw-r--r--include/linux/tty_driver.h1
-rw-r--r--include/linux/types.h3
-rw-r--r--include/linux/ucb1400.h6
-rw-r--r--include/linux/unix_diag.h54
-rw-r--r--include/linux/usb.h29
-rw-r--r--include/linux/usb/ch11.h41
-rw-r--r--include/linux/usb/ch9.h22
-rw-r--r--include/linux/usb/gadget.h26
-rw-r--r--include/linux/usb/hcd.h2
-rw-r--r--include/linux/usb/langwell_otg.h139
-rw-r--r--include/linux/usb/renesas_usbhs.h10
-rw-r--r--include/linux/usb/serial.h11
-rw-r--r--include/linux/videodev2.h151
-rw-r--r--include/linux/virtio.h75
-rw-r--r--include/linux/virtio_config.h14
-rw-r--r--include/linux/virtio_ring.h1
-rw-r--r--include/linux/vmalloc.h1
-rw-r--r--include/linux/wait.h4
-rw-r--r--include/linux/wanrouter.h2
-rw-r--r--include/linux/watchdog.h21
-rw-r--r--include/linux/wl12xx.h5
-rw-r--r--include/linux/workqueue.h51
-rw-r--r--include/linux/writeback.h12
-rw-r--r--include/linux/zorro_ids.h4
344 files changed, 9758 insertions, 2776 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 619b5657af77..c94e71781b79 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -185,6 +185,7 @@ header-y += if_pppol2tp.h
185header-y += if_pppox.h 185header-y += if_pppox.h
186header-y += if_slip.h 186header-y += if_slip.h
187header-y += if_strip.h 187header-y += if_strip.h
188header-y += if_team.h
188header-y += if_tr.h 189header-y += if_tr.h
189header-y += if_tun.h 190header-y += if_tun.h
190header-y += if_tunnel.h 191header-y += if_tunnel.h
@@ -194,7 +195,9 @@ header-y += igmp.h
194header-y += in.h 195header-y += in.h
195header-y += in6.h 196header-y += in6.h
196header-y += in_route.h 197header-y += in_route.h
198header-y += sock_diag.h
197header-y += inet_diag.h 199header-y += inet_diag.h
200header-y += unix_diag.h
198header-y += inotify.h 201header-y += inotify.h
199header-y += input.h 202header-y += input.h
200header-y += ioctl.h 203header-y += ioctl.h
diff --git a/include/linux/acct.h b/include/linux/acct.h
index 3e4737fa6cce..d537aa0ec414 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -146,6 +146,9 @@ extern void acct_exit_ns(struct pid_namespace *);
146 * 146 *
147 */ 147 */
148 148
149#undef ACCT_VERSION
150#undef AHZ
151
149#ifdef CONFIG_BSD_PROCESS_ACCT_V3 152#ifdef CONFIG_BSD_PROCESS_ACCT_V3
150#define ACCT_VERSION 3 153#define ACCT_VERSION 3
151#define AHZ 100 154#define AHZ 100
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 6001b4da39dd..3f968665899b 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -302,10 +302,19 @@ extern bool osc_sb_apei_support_acked;
302 OSC_PCI_EXPRESS_PME_CONTROL | \ 302 OSC_PCI_EXPRESS_PME_CONTROL | \
303 OSC_PCI_EXPRESS_AER_CONTROL | \ 303 OSC_PCI_EXPRESS_AER_CONTROL | \
304 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL) 304 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL)
305
306#define OSC_PCI_NATIVE_HOTPLUG (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \
307 OSC_SHPC_NATIVE_HP_CONTROL)
308
305extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, 309extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
306 u32 *mask, u32 req); 310 u32 *mask, u32 req);
307extern void acpi_early_init(void); 311extern void acpi_early_init(void);
308 312
313extern int acpi_nvs_register(__u64 start, __u64 size);
314
315extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
316 void *data);
317
309#else /* !CONFIG_ACPI */ 318#else /* !CONFIG_ACPI */
310 319
311#define acpi_disabled 1 320#define acpi_disabled 1
@@ -348,15 +357,18 @@ static inline int acpi_table_parse(char *id,
348{ 357{
349 return -1; 358 return -1;
350} 359}
351#endif /* !CONFIG_ACPI */
352 360
353#ifdef CONFIG_ACPI_SLEEP 361static inline int acpi_nvs_register(__u64 start, __u64 size)
354int suspend_nvs_register(unsigned long start, unsigned long size);
355#else
356static inline int suspend_nvs_register(unsigned long a, unsigned long b)
357{ 362{
358 return 0; 363 return 0;
359} 364}
360#endif 365
366static inline int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
367 void *data)
368{
369 return 0;
370}
371
372#endif /* !CONFIG_ACPI */
361 373
362#endif /*_LINUX_ACPI_H*/ 374#endif /*_LINUX_ACPI_H*/
diff --git a/include/linux/acpi_io.h b/include/linux/acpi_io.h
index 4afd7102459d..b0ffa219993e 100644
--- a/include/linux/acpi_io.h
+++ b/include/linux/acpi_io.h
@@ -12,4 +12,7 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
12 12
13void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size); 13void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size);
14 14
15int acpi_os_map_generic_address(struct acpi_generic_address *addr);
16void acpi_os_unmap_generic_address(struct acpi_generic_address *addr);
17
15#endif 18#endif
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
index be3d9a77d6ed..73a25005d88a 100644
--- a/include/linux/ahci_platform.h
+++ b/include/linux/ahci_platform.h
@@ -23,6 +23,8 @@ struct ata_port_info;
23struct ahci_platform_data { 23struct ahci_platform_data {
24 int (*init)(struct device *dev, void __iomem *addr); 24 int (*init)(struct device *dev, void __iomem *addr);
25 void (*exit)(struct device *dev); 25 void (*exit)(struct device *dev);
26 int (*suspend)(struct device *dev);
27 int (*resume)(struct device *dev);
26 const struct ata_port_info *ata_port_info; 28 const struct ata_port_info *ata_port_info;
27 unsigned int force_port_map; 29 unsigned int force_port_map;
28 unsigned int mask_port_map; 30 unsigned int mask_port_map;
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index fcbbe71a3cc1..724c69c40bb8 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -16,6 +16,7 @@
16 16
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/mod_devicetable.h>
19#include <linux/err.h> 20#include <linux/err.h>
20#include <linux/resource.h> 21#include <linux/resource.h>
21#include <linux/regulator/consumer.h> 22#include <linux/regulator/consumer.h>
@@ -35,12 +36,6 @@ struct amba_device {
35 unsigned int irq[AMBA_NR_IRQS]; 36 unsigned int irq[AMBA_NR_IRQS];
36}; 37};
37 38
38struct amba_id {
39 unsigned int id;
40 unsigned int mask;
41 void *data;
42};
43
44struct amba_driver { 39struct amba_driver {
45 struct device_driver drv; 40 struct device_driver drv;
46 int (*probe)(struct amba_device *, const struct amba_id *); 41 int (*probe)(struct amba_device *, const struct amba_id *);
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
index 21114810c7c0..0101e9c17fa1 100644
--- a/include/linux/amba/mmci.h
+++ b/include/linux/amba/mmci.h
@@ -30,6 +30,7 @@ struct dma_chan;
30 * @cd_invert: true if the gpio_cd pin value is active low 30 * @cd_invert: true if the gpio_cd pin value is active low
31 * @capabilities: the capabilities of the block as implemented in 31 * @capabilities: the capabilities of the block as implemented in
32 * this platform, signify anything MMC_CAP_* from mmc/host.h 32 * this platform, signify anything MMC_CAP_* from mmc/host.h
33 * @capabilities2: more capabilities, MMC_CAP2_* from mmc/host.h
33 * @dma_filter: function used to select an appropriate RX and TX 34 * @dma_filter: function used to select an appropriate RX and TX
34 * DMA channel to be used for DMA, if and only if you're deploying the 35 * DMA channel to be used for DMA, if and only if you're deploying the
35 * generic DMA engine 36 * generic DMA engine
@@ -52,6 +53,7 @@ struct mmci_platform_data {
52 int gpio_cd; 53 int gpio_cd;
53 bool cd_invert; 54 bool cd_invert;
54 unsigned long capabilities; 55 unsigned long capabilities;
56 unsigned long capabilities2;
55 bool (*dma_filter)(struct dma_chan *chan, void *filter_param); 57 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
56 void *dma_rx_param; 58 void *dma_rx_param;
57 void *dma_tx_param; 59 void *dma_tx_param;
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
index 4ce98f54186b..572f637299c9 100644
--- a/include/linux/amba/pl022.h
+++ b/include/linux/amba/pl022.h
@@ -238,6 +238,9 @@ struct dma_chan;
238 * @enable_dma: if true enables DMA driven transfers. 238 * @enable_dma: if true enables DMA driven transfers.
239 * @dma_rx_param: parameter to locate an RX DMA channel. 239 * @dma_rx_param: parameter to locate an RX DMA channel.
240 * @dma_tx_param: parameter to locate a TX DMA channel. 240 * @dma_tx_param: parameter to locate a TX DMA channel.
241 * @autosuspend_delay: delay in ms following transfer completion before the
242 * runtime power management system suspends the device. A setting of 0
243 * indicates no delay and the device will be suspended immediately.
241 */ 244 */
242struct pl022_ssp_controller { 245struct pl022_ssp_controller {
243 u16 bus_id; 246 u16 bus_id;
@@ -246,6 +249,7 @@ struct pl022_ssp_controller {
246 bool (*dma_filter)(struct dma_chan *chan, void *filter_param); 249 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
247 void *dma_rx_param; 250 void *dma_rx_param;
248 void *dma_tx_param; 251 void *dma_tx_param;
252 int autosuspend_delay;
249}; 253};
250 254
251/** 255/**
diff --git a/include/linux/amba/pl061.h b/include/linux/amba/pl061.h
index 2412af944f1f..fb83c0453489 100644
--- a/include/linux/amba/pl061.h
+++ b/include/linux/amba/pl061.h
@@ -7,7 +7,7 @@ struct pl061_platform_data {
7 unsigned gpio_base; 7 unsigned gpio_base;
8 8
9 /* number of the first IRQ. 9 /* number of the first IRQ.
10 * If the IRQ functionality in not desired this must be set to NO_IRQ. 10 * If the IRQ functionality in not desired this must be set to 0.
11 */ 11 */
12 unsigned irq_base; 12 unsigned irq_base;
13 13
diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h
index 9eabffbc4e50..033f6aa670de 100644
--- a/include/linux/amba/pl08x.h
+++ b/include/linux/amba/pl08x.h
@@ -134,7 +134,7 @@ struct pl08x_txd {
134 struct dma_async_tx_descriptor tx; 134 struct dma_async_tx_descriptor tx;
135 struct list_head node; 135 struct list_head node;
136 struct list_head dsg_list; 136 struct list_head dsg_list;
137 enum dma_data_direction direction; 137 enum dma_transfer_direction direction;
138 dma_addr_t llis_bus; 138 dma_addr_t llis_bus;
139 struct pl08x_lli *llis_va; 139 struct pl08x_lli *llis_va;
140 /* Default cctl value for LLIs */ 140 /* Default cctl value for LLIs */
@@ -197,7 +197,7 @@ struct pl08x_dma_chan {
197 dma_addr_t dst_addr; 197 dma_addr_t dst_addr;
198 u32 src_cctl; 198 u32 src_cctl;
199 u32 dst_cctl; 199 u32 dst_cctl;
200 enum dma_data_direction runtime_direction; 200 enum dma_transfer_direction runtime_direction;
201 dma_cookie_t lc; 201 dma_cookie_t lc;
202 struct list_head pend_list; 202 struct list_head pend_list;
203 struct pl08x_txd *at; 203 struct pl08x_txd *at;
diff --git a/include/linux/amba/pl330.h b/include/linux/amba/pl330.h
index d12f077a6daf..12e023c19ac1 100644
--- a/include/linux/amba/pl330.h
+++ b/include/linux/amba/pl330.h
@@ -12,17 +12,9 @@
12#ifndef __AMBA_PL330_H_ 12#ifndef __AMBA_PL330_H_
13#define __AMBA_PL330_H_ 13#define __AMBA_PL330_H_
14 14
15#include <linux/dmaengine.h>
15#include <asm/hardware/pl330.h> 16#include <asm/hardware/pl330.h>
16 17
17struct dma_pl330_peri {
18 /*
19 * Peri_Req i/f of the DMAC that is
20 * peripheral could be reached from.
21 */
22 u8 peri_id; /* specific dma id */
23 enum pl330_reqtype rqtype;
24};
25
26struct dma_pl330_platdata { 18struct dma_pl330_platdata {
27 /* 19 /*
28 * Number of valid peripherals connected to DMAC. 20 * Number of valid peripherals connected to DMAC.
@@ -33,9 +25,12 @@ struct dma_pl330_platdata {
33 */ 25 */
34 u8 nr_valid_peri; 26 u8 nr_valid_peri;
35 /* Array of valid peripherals */ 27 /* Array of valid peripherals */
36 struct dma_pl330_peri *peri; 28 u8 *peri_id;
29 /* Operational capabilities */
30 dma_cap_mask_t cap_mask;
37 /* Bytes to allocate for MC buffer */ 31 /* Bytes to allocate for MC buffer */
38 unsigned mcbuf_sz; 32 unsigned mcbuf_sz;
39}; 33};
40 34
35extern bool pl330_filter(struct dma_chan *chan, void *param);
41#endif /* __AMBA_PL330_H_ */ 36#endif /* __AMBA_PL330_H_ */
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
index 514ed45c462e..d117b29d1062 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -23,6 +23,8 @@
23#ifndef ASM_ARM_HARDWARE_SERIAL_AMBA_H 23#ifndef ASM_ARM_HARDWARE_SERIAL_AMBA_H
24#define ASM_ARM_HARDWARE_SERIAL_AMBA_H 24#define ASM_ARM_HARDWARE_SERIAL_AMBA_H
25 25
26#include <linux/types.h>
27
26/* ------------------------------------------------------------------------------- 28/* -------------------------------------------------------------------------------
27 * From AMBA UART (PL010) Block Specification 29 * From AMBA UART (PL010) Block Specification
28 * ------------------------------------------------------------------------------- 30 * -------------------------------------------------------------------------------
diff --git a/include/linux/amd-iommu.h b/include/linux/amd-iommu.h
index a6863a2dec1f..ef00610837d4 100644
--- a/include/linux/amd-iommu.h
+++ b/include/linux/amd-iommu.h
@@ -20,12 +20,148 @@
20#ifndef _ASM_X86_AMD_IOMMU_H 20#ifndef _ASM_X86_AMD_IOMMU_H
21#define _ASM_X86_AMD_IOMMU_H 21#define _ASM_X86_AMD_IOMMU_H
22 22
23#include <linux/irqreturn.h> 23#include <linux/types.h>
24 24
25#ifdef CONFIG_AMD_IOMMU 25#ifdef CONFIG_AMD_IOMMU
26 26
27struct task_struct;
28struct pci_dev;
29
27extern int amd_iommu_detect(void); 30extern int amd_iommu_detect(void);
28 31
32
33/**
34 * amd_iommu_enable_device_erratum() - Enable erratum workaround for device
35 * in the IOMMUv2 driver
36 * @pdev: The PCI device the workaround is necessary for
37 * @erratum: The erratum workaround to enable
38 *
39 * The function needs to be called before amd_iommu_init_device().
40 * Possible values for the erratum number are for now:
41 * - AMD_PRI_DEV_ERRATUM_ENABLE_RESET - Reset PRI capability when PRI
42 * is enabled
43 * - AMD_PRI_DEV_ERRATUM_LIMIT_REQ_ONE - Limit number of outstanding PRI
44 * requests to one
45 */
46#define AMD_PRI_DEV_ERRATUM_ENABLE_RESET 0
47#define AMD_PRI_DEV_ERRATUM_LIMIT_REQ_ONE 1
48
49extern void amd_iommu_enable_device_erratum(struct pci_dev *pdev, u32 erratum);
50
51/**
52 * amd_iommu_init_device() - Init device for use with IOMMUv2 driver
53 * @pdev: The PCI device to initialize
54 * @pasids: Number of PASIDs to support for this device
55 *
56 * This function does all setup for the device pdev so that it can be
57 * used with IOMMUv2.
58 * Returns 0 on success or negative value on error.
59 */
60extern int amd_iommu_init_device(struct pci_dev *pdev, int pasids);
61
62/**
63 * amd_iommu_free_device() - Free all IOMMUv2 related device resources
64 * and disable IOMMUv2 usage for this device
65 * @pdev: The PCI device to disable IOMMUv2 usage for'
66 */
67extern void amd_iommu_free_device(struct pci_dev *pdev);
68
69/**
70 * amd_iommu_bind_pasid() - Bind a given task to a PASID on a device
71 * @pdev: The PCI device to bind the task to
72 * @pasid: The PASID on the device the task should be bound to
73 * @task: the task to bind
74 *
75 * The function returns 0 on success or a negative value on error.
76 */
77extern int amd_iommu_bind_pasid(struct pci_dev *pdev, int pasid,
78 struct task_struct *task);
79
80/**
81 * amd_iommu_unbind_pasid() - Unbind a PASID from its task on
82 * a device
83 * @pdev: The device of the PASID
84 * @pasid: The PASID to unbind
85 *
86 * When this function returns the device is no longer using the PASID
87 * and the PASID is no longer bound to its task.
88 */
89extern void amd_iommu_unbind_pasid(struct pci_dev *pdev, int pasid);
90
91/**
92 * amd_iommu_set_invalid_ppr_cb() - Register a call-back for failed
93 * PRI requests
94 * @pdev: The PCI device the call-back should be registered for
95 * @cb: The call-back function
96 *
97 * The IOMMUv2 driver invokes this call-back when it is unable to
98 * successfully handle a PRI request. The device driver can then decide
99 * which PRI response the device should see. Possible return values for
100 * the call-back are:
101 *
102 * - AMD_IOMMU_INV_PRI_RSP_SUCCESS - Send SUCCESS back to the device
103 * - AMD_IOMMU_INV_PRI_RSP_INVALID - Send INVALID back to the device
104 * - AMD_IOMMU_INV_PRI_RSP_FAIL - Send Failure back to the device,
105 * the device is required to disable
106 * PRI when it receives this response
107 *
108 * The function returns 0 on success or negative value on error.
109 */
110#define AMD_IOMMU_INV_PRI_RSP_SUCCESS 0
111#define AMD_IOMMU_INV_PRI_RSP_INVALID 1
112#define AMD_IOMMU_INV_PRI_RSP_FAIL 2
113
114typedef int (*amd_iommu_invalid_ppr_cb)(struct pci_dev *pdev,
115 int pasid,
116 unsigned long address,
117 u16);
118
119extern int amd_iommu_set_invalid_ppr_cb(struct pci_dev *pdev,
120 amd_iommu_invalid_ppr_cb cb);
121
122/**
123 * amd_iommu_device_info() - Get information about IOMMUv2 support of a
124 * PCI device
125 * @pdev: PCI device to query information from
126 * @info: A pointer to an amd_iommu_device_info structure which will contain
127 * the information about the PCI device
128 *
129 * Returns 0 on success, negative value on error
130 */
131
132#define AMD_IOMMU_DEVICE_FLAG_ATS_SUP 0x1 /* ATS feature supported */
133#define AMD_IOMMU_DEVICE_FLAG_PRI_SUP 0x2 /* PRI feature supported */
134#define AMD_IOMMU_DEVICE_FLAG_PASID_SUP 0x4 /* PASID context supported */
135#define AMD_IOMMU_DEVICE_FLAG_EXEC_SUP 0x8 /* Device may request execution
136 on memory pages */
137#define AMD_IOMMU_DEVICE_FLAG_PRIV_SUP 0x10 /* Device may request
138 super-user privileges */
139
140struct amd_iommu_device_info {
141 int max_pasids;
142 u32 flags;
143};
144
145extern int amd_iommu_device_info(struct pci_dev *pdev,
146 struct amd_iommu_device_info *info);
147
148/**
149 * amd_iommu_set_invalidate_ctx_cb() - Register a call-back for invalidating
150 * a pasid context. This call-back is
151 * invoked when the IOMMUv2 driver needs to
152 * invalidate a PASID context, for example
153 * because the task that is bound to that
154 * context is about to exit.
155 *
156 * @pdev: The PCI device the call-back should be registered for
157 * @cb: The call-back function
158 */
159
160typedef void (*amd_iommu_invalidate_ctx)(struct pci_dev *pdev, int pasid);
161
162extern int amd_iommu_set_invalidate_ctx_cb(struct pci_dev *pdev,
163 amd_iommu_invalidate_ctx cb);
164
29#else 165#else
30 166
31static inline int amd_iommu_detect(void) { return -ENODEV; } 167static inline int amd_iommu_detect(void) { return -ENODEV; }
diff --git a/include/linux/ata_platform.h b/include/linux/ata_platform.h
index 9a26c83a2c9e..b856a2a590d9 100644
--- a/include/linux/ata_platform.h
+++ b/include/linux/ata_platform.h
@@ -27,10 +27,7 @@ extern int __devexit __pata_platform_remove(struct device *dev);
27/* 27/*
28 * Marvell SATA private data 28 * Marvell SATA private data
29 */ 29 */
30struct mbus_dram_target_info;
31
32struct mv_sata_platform_data { 30struct mv_sata_platform_data {
33 struct mbus_dram_target_info *dram;
34 int n_ports; /* number of sata ports */ 31 int n_ports; /* number of sata ports */
35}; 32};
36 33
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 49a83ca900ba..f4ff882cb2da 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -445,16 +445,6 @@ void vcc_insert_socket(struct sock *sk);
445 445
446void atm_dev_release_vccs(struct atm_dev *dev); 446void atm_dev_release_vccs(struct atm_dev *dev);
447 447
448/*
449 * This is approximately the algorithm used by alloc_skb.
450 *
451 */
452
453static inline int atm_guess_pdu2truesize(int size)
454{
455 return SKB_DATA_ALIGN(size) + sizeof(struct skb_shared_info);
456}
457
458 448
459static inline void atm_force_charge(struct atm_vcc *vcc,int truesize) 449static inline void atm_force_charge(struct atm_vcc *vcc,int truesize)
460{ 450{
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 2f81c6f3b630..9ff7a2c48b50 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -26,6 +26,7 @@
26 26
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/elf-em.h> 28#include <linux/elf-em.h>
29#include <linux/ptrace.h>
29 30
30/* The netlink messages for the audit system is divided into blocks: 31/* The netlink messages for the audit system is divided into blocks:
31 * 1000 - 1099 are for commanding the audit system 32 * 1000 - 1099 are for commanding the audit system
@@ -181,6 +182,40 @@
181 * AUDIT_UNUSED_BITS is updated if need be. */ 182 * AUDIT_UNUSED_BITS is updated if need be. */
182#define AUDIT_UNUSED_BITS 0x07FFFC00 183#define AUDIT_UNUSED_BITS 0x07FFFC00
183 184
185/* AUDIT_FIELD_COMPARE rule list */
186#define AUDIT_COMPARE_UID_TO_OBJ_UID 1
187#define AUDIT_COMPARE_GID_TO_OBJ_GID 2
188#define AUDIT_COMPARE_EUID_TO_OBJ_UID 3
189#define AUDIT_COMPARE_EGID_TO_OBJ_GID 4
190#define AUDIT_COMPARE_AUID_TO_OBJ_UID 5
191#define AUDIT_COMPARE_SUID_TO_OBJ_UID 6
192#define AUDIT_COMPARE_SGID_TO_OBJ_GID 7
193#define AUDIT_COMPARE_FSUID_TO_OBJ_UID 8
194#define AUDIT_COMPARE_FSGID_TO_OBJ_GID 9
195
196#define AUDIT_COMPARE_UID_TO_AUID 10
197#define AUDIT_COMPARE_UID_TO_EUID 11
198#define AUDIT_COMPARE_UID_TO_FSUID 12
199#define AUDIT_COMPARE_UID_TO_SUID 13
200
201#define AUDIT_COMPARE_AUID_TO_FSUID 14
202#define AUDIT_COMPARE_AUID_TO_SUID 15
203#define AUDIT_COMPARE_AUID_TO_EUID 16
204
205#define AUDIT_COMPARE_EUID_TO_SUID 17
206#define AUDIT_COMPARE_EUID_TO_FSUID 18
207
208#define AUDIT_COMPARE_SUID_TO_FSUID 19
209
210#define AUDIT_COMPARE_GID_TO_EGID 20
211#define AUDIT_COMPARE_GID_TO_FSGID 21
212#define AUDIT_COMPARE_GID_TO_SGID 22
213
214#define AUDIT_COMPARE_EGID_TO_FSGID 23
215#define AUDIT_COMPARE_EGID_TO_SGID 24
216#define AUDIT_COMPARE_SGID_TO_FSGID 25
217
218#define AUDIT_MAX_FIELD_COMPARE AUDIT_COMPARE_SGID_TO_FSGID
184 219
185/* Rule fields */ 220/* Rule fields */
186 /* These are useful when checking the 221 /* These are useful when checking the
@@ -222,6 +257,9 @@
222#define AUDIT_PERM 106 257#define AUDIT_PERM 106
223#define AUDIT_DIR 107 258#define AUDIT_DIR 107
224#define AUDIT_FILETYPE 108 259#define AUDIT_FILETYPE 108
260#define AUDIT_OBJ_UID 109
261#define AUDIT_OBJ_GID 110
262#define AUDIT_FIELD_COMPARE 111
225 263
226#define AUDIT_ARG0 200 264#define AUDIT_ARG0 200
227#define AUDIT_ARG1 (AUDIT_ARG0+1) 265#define AUDIT_ARG1 (AUDIT_ARG0+1)
@@ -408,28 +446,24 @@ struct audit_field {
408 void *lsm_rule; 446 void *lsm_rule;
409}; 447};
410 448
411#define AUDITSC_INVALID 0
412#define AUDITSC_SUCCESS 1
413#define AUDITSC_FAILURE 2
414#define AUDITSC_RESULT(x) ( ((long)(x))<0?AUDITSC_FAILURE:AUDITSC_SUCCESS )
415extern int __init audit_register_class(int class, unsigned *list); 449extern int __init audit_register_class(int class, unsigned *list);
416extern int audit_classify_syscall(int abi, unsigned syscall); 450extern int audit_classify_syscall(int abi, unsigned syscall);
417extern int audit_classify_arch(int arch); 451extern int audit_classify_arch(int arch);
418#ifdef CONFIG_AUDITSYSCALL 452#ifdef CONFIG_AUDITSYSCALL
419/* These are defined in auditsc.c */ 453/* These are defined in auditsc.c */
420 /* Public API */ 454 /* Public API */
421extern void audit_finish_fork(struct task_struct *child);
422extern int audit_alloc(struct task_struct *task); 455extern int audit_alloc(struct task_struct *task);
423extern void audit_free(struct task_struct *task); 456extern void __audit_free(struct task_struct *task);
424extern void audit_syscall_entry(int arch, 457extern void __audit_syscall_entry(int arch,
425 int major, unsigned long a0, unsigned long a1, 458 int major, unsigned long a0, unsigned long a1,
426 unsigned long a2, unsigned long a3); 459 unsigned long a2, unsigned long a3);
427extern void audit_syscall_exit(int failed, long return_code); 460extern void __audit_syscall_exit(int ret_success, long ret_value);
428extern void __audit_getname(const char *name); 461extern void __audit_getname(const char *name);
429extern void audit_putname(const char *name); 462extern void audit_putname(const char *name);
430extern void __audit_inode(const char *name, const struct dentry *dentry); 463extern void __audit_inode(const char *name, const struct dentry *dentry);
431extern void __audit_inode_child(const struct dentry *dentry, 464extern void __audit_inode_child(const struct dentry *dentry,
432 const struct inode *parent); 465 const struct inode *parent);
466extern void __audit_seccomp(unsigned long syscall);
433extern void __audit_ptrace(struct task_struct *t); 467extern void __audit_ptrace(struct task_struct *t);
434 468
435static inline int audit_dummy_context(void) 469static inline int audit_dummy_context(void)
@@ -437,6 +471,27 @@ static inline int audit_dummy_context(void)
437 void *p = current->audit_context; 471 void *p = current->audit_context;
438 return !p || *(int *)p; 472 return !p || *(int *)p;
439} 473}
474static inline void audit_free(struct task_struct *task)
475{
476 if (unlikely(task->audit_context))
477 __audit_free(task);
478}
479static inline void audit_syscall_entry(int arch, int major, unsigned long a0,
480 unsigned long a1, unsigned long a2,
481 unsigned long a3)
482{
483 if (unlikely(!audit_dummy_context()))
484 __audit_syscall_entry(arch, major, a0, a1, a2, a3);
485}
486static inline void audit_syscall_exit(void *pt_regs)
487{
488 if (unlikely(current->audit_context)) {
489 int success = is_syscall_success(pt_regs);
490 int return_code = regs_return_value(pt_regs);
491
492 __audit_syscall_exit(success, return_code);
493 }
494}
440static inline void audit_getname(const char *name) 495static inline void audit_getname(const char *name)
441{ 496{
442 if (unlikely(!audit_dummy_context())) 497 if (unlikely(!audit_dummy_context()))
@@ -453,6 +508,12 @@ static inline void audit_inode_child(const struct dentry *dentry,
453} 508}
454void audit_core_dumps(long signr); 509void audit_core_dumps(long signr);
455 510
511static inline void audit_seccomp(unsigned long syscall)
512{
513 if (unlikely(!audit_dummy_context()))
514 __audit_seccomp(syscall);
515}
516
456static inline void audit_ptrace(struct task_struct *t) 517static inline void audit_ptrace(struct task_struct *t)
457{ 518{
458 if (unlikely(!audit_dummy_context())) 519 if (unlikely(!audit_dummy_context()))
@@ -463,18 +524,17 @@ static inline void audit_ptrace(struct task_struct *t)
463extern unsigned int audit_serial(void); 524extern unsigned int audit_serial(void);
464extern int auditsc_get_stamp(struct audit_context *ctx, 525extern int auditsc_get_stamp(struct audit_context *ctx,
465 struct timespec *t, unsigned int *serial); 526 struct timespec *t, unsigned int *serial);
466extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid); 527extern int audit_set_loginuid(uid_t loginuid);
467#define audit_get_loginuid(t) ((t)->loginuid) 528#define audit_get_loginuid(t) ((t)->loginuid)
468#define audit_get_sessionid(t) ((t)->sessionid) 529#define audit_get_sessionid(t) ((t)->sessionid)
469extern void audit_log_task_context(struct audit_buffer *ab); 530extern void audit_log_task_context(struct audit_buffer *ab);
470extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); 531extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
471extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); 532extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode);
472extern int audit_bprm(struct linux_binprm *bprm); 533extern int __audit_bprm(struct linux_binprm *bprm);
473extern void audit_socketcall(int nargs, unsigned long *args); 534extern void __audit_socketcall(int nargs, unsigned long *args);
474extern int audit_sockaddr(int len, void *addr); 535extern int __audit_sockaddr(int len, void *addr);
475extern void __audit_fd_pair(int fd1, int fd2); 536extern void __audit_fd_pair(int fd1, int fd2);
476extern int audit_set_macxattr(const char *name); 537extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr);
477extern void __audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr);
478extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout); 538extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout);
479extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification); 539extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification);
480extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat); 540extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
@@ -494,12 +554,29 @@ static inline void audit_fd_pair(int fd1, int fd2)
494 if (unlikely(!audit_dummy_context())) 554 if (unlikely(!audit_dummy_context()))
495 __audit_fd_pair(fd1, fd2); 555 __audit_fd_pair(fd1, fd2);
496} 556}
497static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode) 557static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode)
498{ 558{
499 if (unlikely(!audit_dummy_context())) 559 if (unlikely(!audit_dummy_context()))
500 __audit_ipc_set_perm(qbytes, uid, gid, mode); 560 __audit_ipc_set_perm(qbytes, uid, gid, mode);
501} 561}
502static inline void audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr) 562static inline int audit_bprm(struct linux_binprm *bprm)
563{
564 if (unlikely(!audit_dummy_context()))
565 return __audit_bprm(bprm);
566 return 0;
567}
568static inline void audit_socketcall(int nargs, unsigned long *args)
569{
570 if (unlikely(!audit_dummy_context()))
571 __audit_socketcall(nargs, args);
572}
573static inline int audit_sockaddr(int len, void *addr)
574{
575 if (unlikely(!audit_dummy_context()))
576 return __audit_sockaddr(len, addr);
577 return 0;
578}
579static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
503{ 580{
504 if (unlikely(!audit_dummy_context())) 581 if (unlikely(!audit_dummy_context()))
505 __audit_mq_open(oflag, mode, attr); 582 __audit_mq_open(oflag, mode, attr);
@@ -544,12 +621,11 @@ static inline void audit_mmap_fd(int fd, int flags)
544 621
545extern int audit_n_rules; 622extern int audit_n_rules;
546extern int audit_signals; 623extern int audit_signals;
547#else 624#else /* CONFIG_AUDITSYSCALL */
548#define audit_finish_fork(t)
549#define audit_alloc(t) ({ 0; }) 625#define audit_alloc(t) ({ 0; })
550#define audit_free(t) do { ; } while (0) 626#define audit_free(t) do { ; } while (0)
551#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0) 627#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0)
552#define audit_syscall_exit(f,r) do { ; } while (0) 628#define audit_syscall_exit(r) do { ; } while (0)
553#define audit_dummy_context() 1 629#define audit_dummy_context() 1
554#define audit_getname(n) do { ; } while (0) 630#define audit_getname(n) do { ; } while (0)
555#define audit_putname(n) do { ; } while (0) 631#define audit_putname(n) do { ; } while (0)
@@ -558,6 +634,7 @@ extern int audit_signals;
558#define audit_inode(n,d) do { (void)(d); } while (0) 634#define audit_inode(n,d) do { (void)(d); } while (0)
559#define audit_inode_child(i,p) do { ; } while (0) 635#define audit_inode_child(i,p) do { ; } while (0)
560#define audit_core_dumps(i) do { ; } while (0) 636#define audit_core_dumps(i) do { ; } while (0)
637#define audit_seccomp(i) do { ; } while (0)
561#define auditsc_get_stamp(c,t,s) (0) 638#define auditsc_get_stamp(c,t,s) (0)
562#define audit_get_loginuid(t) (-1) 639#define audit_get_loginuid(t) (-1)
563#define audit_get_sessionid(t) (-1) 640#define audit_get_sessionid(t) (-1)
@@ -568,7 +645,6 @@ extern int audit_signals;
568#define audit_socketcall(n,a) ((void)0) 645#define audit_socketcall(n,a) ((void)0)
569#define audit_fd_pair(n,a) ((void)0) 646#define audit_fd_pair(n,a) ((void)0)
570#define audit_sockaddr(len, addr) ({ 0; }) 647#define audit_sockaddr(len, addr) ({ 0; })
571#define audit_set_macxattr(n) do { ; } while (0)
572#define audit_mq_open(o,m,a) ((void)0) 648#define audit_mq_open(o,m,a) ((void)0)
573#define audit_mq_sendrecv(d,l,p,t) ((void)0) 649#define audit_mq_sendrecv(d,l,p,t) ((void)0)
574#define audit_mq_notify(d,n) ((void)0) 650#define audit_mq_notify(d,n) ((void)0)
@@ -579,7 +655,7 @@ extern int audit_signals;
579#define audit_ptrace(t) ((void)0) 655#define audit_ptrace(t) ((void)0)
580#define audit_n_rules 0 656#define audit_n_rules 0
581#define audit_signals 0 657#define audit_signals 0
582#endif 658#endif /* CONFIG_AUDITSYSCALL */
583 659
584#ifdef CONFIG_AUDIT 660#ifdef CONFIG_AUDIT
585/* These are defined in audit.c */ 661/* These are defined in audit.c */
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 4d4b59de9467..83c209f39493 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -162,7 +162,7 @@ struct bcma_driver {
162 162
163 int (*probe)(struct bcma_device *dev); 163 int (*probe)(struct bcma_device *dev);
164 void (*remove)(struct bcma_device *dev); 164 void (*remove)(struct bcma_device *dev);
165 int (*suspend)(struct bcma_device *dev, pm_message_t state); 165 int (*suspend)(struct bcma_device *dev);
166 int (*resume)(struct bcma_device *dev); 166 int (*resume)(struct bcma_device *dev);
167 void (*shutdown)(struct bcma_device *dev); 167 void (*shutdown)(struct bcma_device *dev);
168 168
@@ -205,61 +205,82 @@ struct bcma_bus {
205 struct ssb_sprom sprom; 205 struct ssb_sprom sprom;
206}; 206};
207 207
208extern inline u32 bcma_read8(struct bcma_device *core, u16 offset) 208static inline u32 bcma_read8(struct bcma_device *core, u16 offset)
209{ 209{
210 return core->bus->ops->read8(core, offset); 210 return core->bus->ops->read8(core, offset);
211} 211}
212extern inline u32 bcma_read16(struct bcma_device *core, u16 offset) 212static inline u32 bcma_read16(struct bcma_device *core, u16 offset)
213{ 213{
214 return core->bus->ops->read16(core, offset); 214 return core->bus->ops->read16(core, offset);
215} 215}
216extern inline u32 bcma_read32(struct bcma_device *core, u16 offset) 216static inline u32 bcma_read32(struct bcma_device *core, u16 offset)
217{ 217{
218 return core->bus->ops->read32(core, offset); 218 return core->bus->ops->read32(core, offset);
219} 219}
220extern inline 220static inline
221void bcma_write8(struct bcma_device *core, u16 offset, u32 value) 221void bcma_write8(struct bcma_device *core, u16 offset, u32 value)
222{ 222{
223 core->bus->ops->write8(core, offset, value); 223 core->bus->ops->write8(core, offset, value);
224} 224}
225extern inline 225static inline
226void bcma_write16(struct bcma_device *core, u16 offset, u32 value) 226void bcma_write16(struct bcma_device *core, u16 offset, u32 value)
227{ 227{
228 core->bus->ops->write16(core, offset, value); 228 core->bus->ops->write16(core, offset, value);
229} 229}
230extern inline 230static inline
231void bcma_write32(struct bcma_device *core, u16 offset, u32 value) 231void bcma_write32(struct bcma_device *core, u16 offset, u32 value)
232{ 232{
233 core->bus->ops->write32(core, offset, value); 233 core->bus->ops->write32(core, offset, value);
234} 234}
235#ifdef CONFIG_BCMA_BLOCKIO 235#ifdef CONFIG_BCMA_BLOCKIO
236extern inline void bcma_block_read(struct bcma_device *core, void *buffer, 236static inline void bcma_block_read(struct bcma_device *core, void *buffer,
237 size_t count, u16 offset, u8 reg_width) 237 size_t count, u16 offset, u8 reg_width)
238{ 238{
239 core->bus->ops->block_read(core, buffer, count, offset, reg_width); 239 core->bus->ops->block_read(core, buffer, count, offset, reg_width);
240} 240}
241extern inline void bcma_block_write(struct bcma_device *core, const void *buffer, 241static inline void bcma_block_write(struct bcma_device *core,
242 size_t count, u16 offset, u8 reg_width) 242 const void *buffer, size_t count,
243 u16 offset, u8 reg_width)
243{ 244{
244 core->bus->ops->block_write(core, buffer, count, offset, reg_width); 245 core->bus->ops->block_write(core, buffer, count, offset, reg_width);
245} 246}
246#endif 247#endif
247extern inline u32 bcma_aread32(struct bcma_device *core, u16 offset) 248static inline u32 bcma_aread32(struct bcma_device *core, u16 offset)
248{ 249{
249 return core->bus->ops->aread32(core, offset); 250 return core->bus->ops->aread32(core, offset);
250} 251}
251extern inline 252static inline
252void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value) 253void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value)
253{ 254{
254 core->bus->ops->awrite32(core, offset, value); 255 core->bus->ops->awrite32(core, offset, value);
255} 256}
256 257
257#define bcma_mask32(cc, offset, mask) \ 258static inline void bcma_mask32(struct bcma_device *cc, u16 offset, u32 mask)
258 bcma_write32(cc, offset, bcma_read32(cc, offset) & (mask)) 259{
259#define bcma_set32(cc, offset, set) \ 260 bcma_write32(cc, offset, bcma_read32(cc, offset) & mask);
260 bcma_write32(cc, offset, bcma_read32(cc, offset) | (set)) 261}
261#define bcma_maskset32(cc, offset, mask, set) \ 262static inline void bcma_set32(struct bcma_device *cc, u16 offset, u32 set)
262 bcma_write32(cc, offset, (bcma_read32(cc, offset) & (mask)) | (set)) 263{
264 bcma_write32(cc, offset, bcma_read32(cc, offset) | set);
265}
266static inline void bcma_maskset32(struct bcma_device *cc,
267 u16 offset, u32 mask, u32 set)
268{
269 bcma_write32(cc, offset, (bcma_read32(cc, offset) & mask) | set);
270}
271static inline void bcma_mask16(struct bcma_device *cc, u16 offset, u16 mask)
272{
273 bcma_write16(cc, offset, bcma_read16(cc, offset) & mask);
274}
275static inline void bcma_set16(struct bcma_device *cc, u16 offset, u16 set)
276{
277 bcma_write16(cc, offset, bcma_read16(cc, offset) | set);
278}
279static inline void bcma_maskset16(struct bcma_device *cc,
280 u16 offset, u16 mask, u16 set)
281{
282 bcma_write16(cc, offset, (bcma_read16(cc, offset) & mask) | set);
283}
263 284
264extern bool bcma_core_is_enabled(struct bcma_device *core); 285extern bool bcma_core_is_enabled(struct bcma_device *core);
265extern void bcma_core_disable(struct bcma_device *core, u32 flags); 286extern void bcma_core_disable(struct bcma_device *core, u32 flags);
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 1526d965ed06..a33086a7530b 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -203,6 +203,7 @@
203#define BCMA_CC_PMU_CTL 0x0600 /* PMU control */ 203#define BCMA_CC_PMU_CTL 0x0600 /* PMU control */
204#define BCMA_CC_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */ 204#define BCMA_CC_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */
205#define BCMA_CC_PMU_CTL_ILP_DIV_SHIFT 16 205#define BCMA_CC_PMU_CTL_ILP_DIV_SHIFT 16
206#define BCMA_CC_PMU_CTL_PLL_UPD 0x00000400
206#define BCMA_CC_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */ 207#define BCMA_CC_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */
207#define BCMA_CC_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */ 208#define BCMA_CC_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */
208#define BCMA_CC_PMU_CTL_ALPREQEN 0x00000080 /* ALP req enable */ 209#define BCMA_CC_PMU_CTL_ALPREQEN 0x00000080 /* ALP req enable */
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index fd88a3945aa1..0092102db2de 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -18,7 +18,7 @@ struct pt_regs;
18#define BINPRM_BUF_SIZE 128 18#define BINPRM_BUF_SIZE 128
19 19
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21#include <linux/list.h> 21#include <linux/sched.h>
22 22
23#define CORENAME_MAX_SIZE 128 23#define CORENAME_MAX_SIZE 128
24 24
@@ -58,6 +58,7 @@ struct linux_binprm {
58 unsigned interp_flags; 58 unsigned interp_flags;
59 unsigned interp_data; 59 unsigned interp_data;
60 unsigned long loader, exec; 60 unsigned long loader, exec;
61 char tcomm[TASK_COMM_LEN];
61}; 62};
62 63
63#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 64#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 847994aef0e9..129a9c097958 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -515,24 +515,64 @@ extern void bio_integrity_init(void);
515 515
516#else /* CONFIG_BLK_DEV_INTEGRITY */ 516#else /* CONFIG_BLK_DEV_INTEGRITY */
517 517
518#define bio_integrity(a) (0) 518static inline int bio_integrity(struct bio *bio)
519#define bioset_integrity_create(a, b) (0) 519{
520#define bio_integrity_prep(a) (0) 520 return 0;
521#define bio_integrity_enabled(a) (0) 521}
522
523static inline int bio_integrity_enabled(struct bio *bio)
524{
525 return 0;
526}
527
528static inline int bioset_integrity_create(struct bio_set *bs, int pool_size)
529{
530 return 0;
531}
532
533static inline void bioset_integrity_free (struct bio_set *bs)
534{
535 return;
536}
537
538static inline int bio_integrity_prep(struct bio *bio)
539{
540 return 0;
541}
542
543static inline void bio_integrity_free(struct bio *bio, struct bio_set *bs)
544{
545 return;
546}
547
522static inline int bio_integrity_clone(struct bio *bio, struct bio *bio_src, 548static inline int bio_integrity_clone(struct bio *bio, struct bio *bio_src,
523 gfp_t gfp_mask, struct bio_set *bs) 549 gfp_t gfp_mask, struct bio_set *bs)
524{ 550{
525 return 0; 551 return 0;
526} 552}
527#define bioset_integrity_free(a) do { } while (0) 553
528#define bio_integrity_free(a, b) do { } while (0) 554static inline void bio_integrity_split(struct bio *bio, struct bio_pair *bp,
529#define bio_integrity_endio(a, b) do { } while (0) 555 int sectors)
530#define bio_integrity_advance(a, b) do { } while (0) 556{
531#define bio_integrity_trim(a, b, c) do { } while (0) 557 return;
532#define bio_integrity_split(a, b, c) do { } while (0) 558}
533#define bio_integrity_set_tag(a, b, c) do { } while (0) 559
534#define bio_integrity_get_tag(a, b, c) do { } while (0) 560static inline void bio_integrity_advance(struct bio *bio,
535#define bio_integrity_init(a) do { } while (0) 561 unsigned int bytes_done)
562{
563 return;
564}
565
566static inline void bio_integrity_trim(struct bio *bio, unsigned int offset,
567 unsigned int sectors)
568{
569 return;
570}
571
572static inline void bio_integrity_init(void)
573{
574 return;
575}
536 576
537#endif /* CONFIG_BLK_DEV_INTEGRITY */ 577#endif /* CONFIG_BLK_DEV_INTEGRITY */
538 578
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index a3ef66a2a083..94300fe46cce 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -22,8 +22,14 @@ extern unsigned long __sw_hweight64(__u64 w);
22#include <asm/bitops.h> 22#include <asm/bitops.h>
23 23
24#define for_each_set_bit(bit, addr, size) \ 24#define for_each_set_bit(bit, addr, size) \
25 for ((bit) = find_first_bit((addr), (size)); \ 25 for ((bit) = find_first_bit((addr), (size)); \
26 (bit) < (size); \ 26 (bit) < (size); \
27 (bit) = find_next_bit((addr), (size), (bit) + 1))
28
29/* same as for_each_set_bit() but use bit as value to start with */
30#define for_each_set_bit_cont(bit, addr, size) \
31 for ((bit) = find_next_bit((addr), (size), (bit)); \
32 (bit) < (size); \
27 (bit) = find_next_bit((addr), (size), (bit) + 1)) 33 (bit) = find_next_bit((addr), (size), (bit) + 1))
28 34
29static __inline__ int get_bitmask_order(unsigned int count) 35static __inline__ int get_bitmask_order(unsigned int count)
@@ -50,6 +56,26 @@ static inline unsigned long hweight_long(unsigned long w)
50} 56}
51 57
52/** 58/**
59 * rol64 - rotate a 64-bit value left
60 * @word: value to rotate
61 * @shift: bits to roll
62 */
63static inline __u64 rol64(__u64 word, unsigned int shift)
64{
65 return (word << shift) | (word >> (64 - shift));
66}
67
68/**
69 * ror64 - rotate a 64-bit value right
70 * @word: value to rotate
71 * @shift: bits to roll
72 */
73static inline __u64 ror64(__u64 word, unsigned int shift)
74{
75 return (word >> shift) | (word << (64 - shift));
76}
77
78/**
53 * rol32 - rotate a 32-bit value left 79 * rol32 - rotate a 32-bit value left
54 * @word: value to rotate 80 * @word: value to rotate
55 * @shift: bits to roll 81 * @shift: bits to roll
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 94acd8172b5b..606cf339bb56 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -111,10 +111,14 @@ struct request {
111 * Three pointers are available for the IO schedulers, if they need 111 * Three pointers are available for the IO schedulers, if they need
112 * more they have to dynamically allocate it. Flush requests are 112 * more they have to dynamically allocate it. Flush requests are
113 * never put on the IO scheduler. So let the flush fields share 113 * never put on the IO scheduler. So let the flush fields share
114 * space with the three elevator_private pointers. 114 * space with the elevator data.
115 */ 115 */
116 union { 116 union {
117 void *elevator_private[3]; 117 struct {
118 struct io_cq *icq;
119 void *priv[2];
120 } elv;
121
118 struct { 122 struct {
119 unsigned int seq; 123 unsigned int seq;
120 struct list_head list; 124 struct list_head list;
@@ -311,6 +315,12 @@ struct request_queue {
311 unsigned long queue_flags; 315 unsigned long queue_flags;
312 316
313 /* 317 /*
318 * ida allocated id for this queue. Used to index queues from
319 * ioctx.
320 */
321 int id;
322
323 /*
314 * queue needs bounce pages for pages above this limit 324 * queue needs bounce pages for pages above this limit
315 */ 325 */
316 gfp_t bounce_gfp; 326 gfp_t bounce_gfp;
@@ -351,6 +361,8 @@ struct request_queue {
351 struct timer_list timeout; 361 struct timer_list timeout;
352 struct list_head timeout_list; 362 struct list_head timeout_list;
353 363
364 struct list_head icq_list;
365
354 struct queue_limits limits; 366 struct queue_limits limits;
355 367
356 /* 368 /*
@@ -481,6 +493,7 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
481 493
482#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) 494#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
483#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) 495#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
496#define blk_queue_dead(q) test_bit(QUEUE_FLAG_DEAD, &(q)->queue_flags)
484#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) 497#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
485#define blk_queue_noxmerges(q) \ 498#define blk_queue_noxmerges(q) \
486 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags) 499 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags)
@@ -660,7 +673,6 @@ extern void __blk_put_request(struct request_queue *, struct request *);
660extern struct request *blk_get_request(struct request_queue *, int, gfp_t); 673extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
661extern struct request *blk_make_request(struct request_queue *, struct bio *, 674extern struct request *blk_make_request(struct request_queue *, struct bio *,
662 gfp_t); 675 gfp_t);
663extern void blk_insert_request(struct request_queue *, struct request *, int, void *);
664extern void blk_requeue_request(struct request_queue *, struct request *); 676extern void blk_requeue_request(struct request_queue *, struct request *);
665extern void blk_add_request_payload(struct request *rq, struct page *page, 677extern void blk_add_request_payload(struct request *rq, struct page *page,
666 unsigned int len); 678 unsigned int len);
@@ -675,6 +687,9 @@ extern int blk_insert_cloned_request(struct request_queue *q,
675 struct request *rq); 687 struct request *rq);
676extern void blk_delay_queue(struct request_queue *, unsigned long); 688extern void blk_delay_queue(struct request_queue *, unsigned long);
677extern void blk_recount_segments(struct request_queue *, struct bio *); 689extern void blk_recount_segments(struct request_queue *, struct bio *);
690extern int scsi_verify_blk_ioctl(struct block_device *, unsigned int);
691extern int scsi_cmd_blk_ioctl(struct block_device *, fmode_t,
692 unsigned int, void __user *);
678extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t, 693extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t,
679 unsigned int, void __user *); 694 unsigned int, void __user *);
680extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, 695extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
@@ -826,6 +841,7 @@ extern void blk_queue_io_min(struct request_queue *q, unsigned int min);
826extern void blk_limits_io_opt(struct queue_limits *limits, unsigned int opt); 841extern void blk_limits_io_opt(struct queue_limits *limits, unsigned int opt);
827extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt); 842extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt);
828extern void blk_set_default_limits(struct queue_limits *lim); 843extern void blk_set_default_limits(struct queue_limits *lim);
844extern void blk_set_stacking_limits(struct queue_limits *lim);
829extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, 845extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
830 sector_t offset); 846 sector_t offset);
831extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev, 847extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev,
@@ -856,7 +872,7 @@ extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatte
856extern void blk_dump_rq_flags(struct request *, char *); 872extern void blk_dump_rq_flags(struct request *, char *);
857extern long nr_blockdev_pages(void); 873extern long nr_blockdev_pages(void);
858 874
859int blk_get_queue(struct request_queue *); 875bool __must_check blk_get_queue(struct request_queue *);
860struct request_queue *blk_alloc_queue(gfp_t); 876struct request_queue *blk_alloc_queue(gfp_t);
861struct request_queue *blk_alloc_queue_node(gfp_t, int); 877struct request_queue *blk_alloc_queue_node(gfp_t, int);
862extern void blk_put_queue(struct request_queue *); 878extern void blk_put_queue(struct request_queue *);
@@ -1279,19 +1295,70 @@ queue_max_integrity_segments(struct request_queue *q)
1279 1295
1280#else /* CONFIG_BLK_DEV_INTEGRITY */ 1296#else /* CONFIG_BLK_DEV_INTEGRITY */
1281 1297
1282#define blk_integrity_rq(rq) (0) 1298struct bio;
1283#define blk_rq_count_integrity_sg(a, b) (0) 1299struct block_device;
1284#define blk_rq_map_integrity_sg(a, b, c) (0) 1300struct gendisk;
1285#define bdev_get_integrity(a) (0) 1301struct blk_integrity;
1286#define blk_get_integrity(a) (0) 1302
1287#define blk_integrity_compare(a, b) (0) 1303static inline int blk_integrity_rq(struct request *rq)
1288#define blk_integrity_register(a, b) (0) 1304{
1289#define blk_integrity_unregister(a) do { } while (0) 1305 return 0;
1290#define blk_queue_max_integrity_segments(a, b) do { } while (0) 1306}
1291#define queue_max_integrity_segments(a) (0) 1307static inline int blk_rq_count_integrity_sg(struct request_queue *q,
1292#define blk_integrity_merge_rq(a, b, c) (0) 1308 struct bio *b)
1293#define blk_integrity_merge_bio(a, b, c) (0) 1309{
1294#define blk_integrity_is_initialized(a) (0) 1310 return 0;
1311}
1312static inline int blk_rq_map_integrity_sg(struct request_queue *q,
1313 struct bio *b,
1314 struct scatterlist *s)
1315{
1316 return 0;
1317}
1318static inline struct blk_integrity *bdev_get_integrity(struct block_device *b)
1319{
1320 return 0;
1321}
1322static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk)
1323{
1324 return NULL;
1325}
1326static inline int blk_integrity_compare(struct gendisk *a, struct gendisk *b)
1327{
1328 return 0;
1329}
1330static inline int blk_integrity_register(struct gendisk *d,
1331 struct blk_integrity *b)
1332{
1333 return 0;
1334}
1335static inline void blk_integrity_unregister(struct gendisk *d)
1336{
1337}
1338static inline void blk_queue_max_integrity_segments(struct request_queue *q,
1339 unsigned int segs)
1340{
1341}
1342static inline unsigned short queue_max_integrity_segments(struct request_queue *q)
1343{
1344 return 0;
1345}
1346static inline int blk_integrity_merge_rq(struct request_queue *rq,
1347 struct request *r1,
1348 struct request *r2)
1349{
1350 return 0;
1351}
1352static inline int blk_integrity_merge_bio(struct request_queue *rq,
1353 struct request *r,
1354 struct bio *b)
1355{
1356 return 0;
1357}
1358static inline bool blk_integrity_is_initialized(struct gendisk *g)
1359{
1360 return 0;
1361}
1295 1362
1296#endif /* CONFIG_BLK_DEV_INTEGRITY */ 1363#endif /* CONFIG_BLK_DEV_INTEGRITY */
1297 1364
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index ab344a521105..66d3e954eb6c 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -44,7 +44,7 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat,
44 unsigned long endpfn); 44 unsigned long endpfn);
45extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); 45extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
46 46
47unsigned long free_all_memory_core_early(int nodeid); 47extern unsigned long free_low_memory_core_early(int nodeid);
48extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); 48extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
49extern unsigned long free_all_bootmem(void); 49extern unsigned long free_all_bootmem(void);
50 50
diff --git a/include/linux/can/platform/cc770.h b/include/linux/can/platform/cc770.h
new file mode 100644
index 000000000000..7702641f87ee
--- /dev/null
+++ b/include/linux/can/platform/cc770.h
@@ -0,0 +1,33 @@
1#ifndef _CAN_PLATFORM_CC770_H_
2#define _CAN_PLATFORM_CC770_H_
3
4/* CPU Interface Register (0x02) */
5#define CPUIF_CEN 0x01 /* Clock Out Enable */
6#define CPUIF_MUX 0x04 /* Multiplex */
7#define CPUIF_SLP 0x08 /* Sleep */
8#define CPUIF_PWD 0x10 /* Power Down Mode */
9#define CPUIF_DMC 0x20 /* Divide Memory Clock */
10#define CPUIF_DSC 0x40 /* Divide System Clock */
11#define CPUIF_RST 0x80 /* Hardware Reset Status */
12
13/* Clock Out Register (0x1f) */
14#define CLKOUT_CD_MASK 0x0f /* Clock Divider mask */
15#define CLKOUT_SL_MASK 0x30 /* Slew Rate mask */
16#define CLKOUT_SL_SHIFT 4
17
18/* Bus Configuration Register (0x2f) */
19#define BUSCFG_DR0 0x01 /* Disconnect RX0 Input / Select RX input */
20#define BUSCFG_DR1 0x02 /* Disconnect RX1 Input / Silent mode */
21#define BUSCFG_DT1 0x08 /* Disconnect TX1 Output */
22#define BUSCFG_POL 0x20 /* Polarity dominant or recessive */
23#define BUSCFG_CBY 0x40 /* Input Comparator Bypass */
24
25struct cc770_platform_data {
26 u32 osc_freq; /* CAN bus oscillator frequency in Hz */
27
28 u8 cir; /* CPU Interface Register */
29 u8 cor; /* Clock Out Register */
30 u8 bcr; /* Bus Configuration Register */
31};
32
33#endif /* !_CAN_PLATFORM_CC770_H_ */
diff --git a/include/linux/capability.h b/include/linux/capability.h
index a63d13d84ad8..12d52dedb229 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -380,7 +380,6 @@ struct user_namespace;
380struct user_namespace *current_user_ns(void); 380struct user_namespace *current_user_ns(void);
381 381
382extern const kernel_cap_t __cap_empty_set; 382extern const kernel_cap_t __cap_empty_set;
383extern const kernel_cap_t __cap_full_set;
384extern const kernel_cap_t __cap_init_eff_set; 383extern const kernel_cap_t __cap_init_eff_set;
385 384
386/* 385/*
@@ -544,9 +543,10 @@ extern bool has_capability(struct task_struct *t, int cap);
544extern bool has_ns_capability(struct task_struct *t, 543extern bool has_ns_capability(struct task_struct *t,
545 struct user_namespace *ns, int cap); 544 struct user_namespace *ns, int cap);
546extern bool has_capability_noaudit(struct task_struct *t, int cap); 545extern bool has_capability_noaudit(struct task_struct *t, int cap);
546extern bool has_ns_capability_noaudit(struct task_struct *t,
547 struct user_namespace *ns, int cap);
547extern bool capable(int cap); 548extern bool capable(int cap);
548extern bool ns_capable(struct user_namespace *ns, int cap); 549extern bool ns_capable(struct user_namespace *ns, int cap);
549extern bool task_ns_capable(struct task_struct *t, int cap);
550extern bool nsown_capable(int cap); 550extern bool nsown_capable(int cap);
551 551
552/* audit system wants to get cap info from files as well */ 552/* audit system wants to get cap info from files as well */
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index 35eae4b67503..7c48029dffe6 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -952,7 +952,8 @@ struct cdrom_device_info {
952 char name[20]; /* name of the device type */ 952 char name[20]; /* name of the device type */
953/* per-device flags */ 953/* per-device flags */
954 __u8 sanyo_slot : 2; /* Sanyo 3 CD changer support */ 954 __u8 sanyo_slot : 2; /* Sanyo 3 CD changer support */
955 __u8 reserved : 6; /* not used yet */ 955 __u8 keeplocked : 1; /* CDROM_LOCKDOOR status */
956 __u8 reserved : 5; /* not used yet */
956 int cdda_method; /* see flags */ 957 int cdda_method; /* see flags */
957 __u8 last_sense; 958 __u8 last_sense;
958 __u8 media_written; /* dirty flag, DVD+RW bookkeeping */ 959 __u8 media_written; /* dirty flag, DVD+RW bookkeeping */
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 1b7f9d525013..e9b602151caf 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -319,7 +319,7 @@ struct cftype {
319 * If not 0, file mode is set to this value, otherwise it will 319 * If not 0, file mode is set to this value, otherwise it will
320 * be figured out automatically 320 * be figured out automatically
321 */ 321 */
322 mode_t mode; 322 umode_t mode;
323 323
324 /* 324 /*
325 * If non-zero, defines the maximum length of string that can 325 * If non-zero, defines the maximum length of string that can
@@ -457,6 +457,28 @@ void cgroup_exclude_rmdir(struct cgroup_subsys_state *css);
457void cgroup_release_and_wakeup_rmdir(struct cgroup_subsys_state *css); 457void cgroup_release_and_wakeup_rmdir(struct cgroup_subsys_state *css);
458 458
459/* 459/*
460 * Control Group taskset, used to pass around set of tasks to cgroup_subsys
461 * methods.
462 */
463struct cgroup_taskset;
464struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset);
465struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset);
466struct cgroup *cgroup_taskset_cur_cgroup(struct cgroup_taskset *tset);
467int cgroup_taskset_size(struct cgroup_taskset *tset);
468
469/**
470 * cgroup_taskset_for_each - iterate cgroup_taskset
471 * @task: the loop cursor
472 * @skip_cgrp: skip if task's cgroup matches this, %NULL to iterate through all
473 * @tset: taskset to iterate
474 */
475#define cgroup_taskset_for_each(task, skip_cgrp, tset) \
476 for ((task) = cgroup_taskset_first((tset)); (task); \
477 (task) = cgroup_taskset_next((tset))) \
478 if (!(skip_cgrp) || \
479 cgroup_taskset_cur_cgroup((tset)) != (skip_cgrp))
480
481/*
460 * Control Group subsystem type. 482 * Control Group subsystem type.
461 * See Documentation/cgroups/cgroups.txt for details 483 * See Documentation/cgroups/cgroups.txt for details
462 */ 484 */
@@ -467,14 +489,11 @@ struct cgroup_subsys {
467 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 489 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
468 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 490 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
469 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 491 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
470 struct task_struct *tsk); 492 struct cgroup_taskset *tset);
471 int (*can_attach_task)(struct cgroup *cgrp, struct task_struct *tsk);
472 void (*cancel_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 493 void (*cancel_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
473 struct task_struct *tsk); 494 struct cgroup_taskset *tset);
474 void (*pre_attach)(struct cgroup *cgrp);
475 void (*attach_task)(struct cgroup *cgrp, struct task_struct *tsk);
476 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 495 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
477 struct cgroup *old_cgrp, struct task_struct *tsk); 496 struct cgroup_taskset *tset);
478 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); 497 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task);
479 void (*exit)(struct cgroup_subsys *ss, struct cgroup *cgrp, 498 void (*exit)(struct cgroup_subsys *ss, struct cgroup *cgrp,
480 struct cgroup *old_cgrp, struct task_struct *task); 499 struct cgroup *old_cgrp, struct task_struct *task);
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index ac663c18776c..0bd390ce98b2 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -59,8 +59,16 @@ SUBSYS(net_cls)
59SUBSYS(blkio) 59SUBSYS(blkio)
60#endif 60#endif
61 61
62/* */
63
62#ifdef CONFIG_CGROUP_PERF 64#ifdef CONFIG_CGROUP_PERF
63SUBSYS(perf) 65SUBSYS(perf)
64#endif 66#endif
65 67
66/* */ 68/* */
69
70#ifdef CONFIG_NETPRIO_CGROUP
71SUBSYS(net_prio)
72#endif
73
74/* */
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 7213b52b2c0e..b9d46fa154b4 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -107,6 +107,28 @@ static inline void clk_unprepare(struct clk *clk)
107} 107}
108#endif 108#endif
109 109
110/* clk_prepare_enable helps cases using clk_enable in non-atomic context. */
111static inline int clk_prepare_enable(struct clk *clk)
112{
113 int ret;
114
115 ret = clk_prepare(clk);
116 if (ret)
117 return ret;
118 ret = clk_enable(clk);
119 if (ret)
120 clk_unprepare(clk);
121
122 return ret;
123}
124
125/* clk_disable_unprepare helps cases using clk_disable in non-atomic context. */
126static inline void clk_disable_unprepare(struct clk *clk)
127{
128 clk_disable(clk);
129 clk_unprepare(clk);
130}
131
110/** 132/**
111 * clk_get_rate - obtain the current clock rate (in Hz) for a clock source. 133 * clk_get_rate - obtain the current clock rate (in Hz) for a clock source.
112 * This is only valid once the clock source has been enabled. 134 * This is only valid once the clock source has been enabled.
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 66ed067fb729..7e05fcee75a1 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -422,9 +422,9 @@ asmlinkage long compat_sys_getdents64(unsigned int fd,
422asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *, 422asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *,
423 unsigned int nr_segs, unsigned int flags); 423 unsigned int nr_segs, unsigned int flags);
424asmlinkage long compat_sys_open(const char __user *filename, int flags, 424asmlinkage long compat_sys_open(const char __user *filename, int flags,
425 int mode); 425 umode_t mode);
426asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, 426asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
427 int flags, int mode); 427 int flags, umode_t mode);
428asmlinkage long compat_sys_open_by_handle_at(int mountdirfd, 428asmlinkage long compat_sys_open_by_handle_at(int mountdirfd,
429 struct file_handle __user *handle, 429 struct file_handle __user *handle,
430 int flags); 430 int flags);
@@ -561,5 +561,9 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
561 unsigned long liovcnt, const struct compat_iovec __user *rvec, 561 unsigned long liovcnt, const struct compat_iovec __user *rvec,
562 unsigned long riovcnt, unsigned long flags); 562 unsigned long riovcnt, unsigned long flags);
563 563
564#else
565
566#define is_compat_task() (0)
567
564#endif /* CONFIG_COMPAT */ 568#endif /* CONFIG_COMPAT */
565#endif /* _LINUX_COMPAT_H */ 569#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 59e4028e833d..3fd17c249221 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -50,6 +50,11 @@
50# define inline inline __attribute__((always_inline)) 50# define inline inline __attribute__((always_inline))
51# define __inline__ __inline__ __attribute__((always_inline)) 51# define __inline__ __inline__ __attribute__((always_inline))
52# define __inline __inline __attribute__((always_inline)) 52# define __inline __inline __attribute__((always_inline))
53#else
54/* A lot of inline functions can cause havoc with function tracing */
55# define inline inline notrace
56# define __inline__ __inline__ notrace
57# define __inline __inline notrace
53#endif 58#endif
54 59
55#define __deprecated __attribute__((deprecated)) 60#define __deprecated __attribute__((deprecated))
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index dfadc96e9d63..2f4079175afb 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -29,6 +29,7 @@
29 the kernel context */ 29 the kernel context */
30#define __cold __attribute__((__cold__)) 30#define __cold __attribute__((__cold__))
31 31
32#define __linktime_error(message) __attribute__((__error__(message)))
32 33
33#if __GNUC_MINOR__ >= 5 34#if __GNUC_MINOR__ >= 5
34/* 35/*
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 320d6c94ff84..4a243546d142 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -293,7 +293,9 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
293#ifndef __compiletime_error 293#ifndef __compiletime_error
294# define __compiletime_error(message) 294# define __compiletime_error(message)
295#endif 295#endif
296 296#ifndef __linktime_error
297# define __linktime_error(message)
298#endif
297/* 299/*
298 * Prevent the compiler from merging or refetching accesses. The compiler 300 * Prevent the compiler from merging or refetching accesses. The compiler
299 * is also forbidden from reordering successive instances of ACCESS_ONCE(), 301 * is also forbidden from reordering successive instances of ACCESS_ONCE(),
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 3081c58d696e..34025df61829 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -124,7 +124,7 @@ extern struct config_item *config_group_find_item(struct config_group *,
124struct configfs_attribute { 124struct configfs_attribute {
125 const char *ca_name; 125 const char *ca_name;
126 struct module *ca_owner; 126 struct module *ca_owner;
127 mode_t ca_mode; 127 umode_t ca_mode;
128}; 128};
129 129
130/* 130/*
diff --git a/include/linux/console.h b/include/linux/console.h
index 7453cfd593c8..7201ce4280ca 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -152,7 +152,7 @@ extern int braille_register_console(struct console *, int index,
152 char *console_options, char *braille_options); 152 char *console_options, char *braille_options);
153extern int braille_unregister_console(struct console *); 153extern int braille_unregister_console(struct console *);
154extern void console_sysfs_notify(void); 154extern void console_sysfs_notify(void);
155extern int console_suspend_enabled; 155extern bool console_suspend_enabled;
156 156
157/* Suspend and resume console messages over PM events */ 157/* Suspend and resume console messages over PM events */
158extern void suspend_console(void); 158extern void suspend_console(void);
diff --git a/include/linux/cordic.h b/include/linux/cordic.h
index f932093e20c2..cf68ca4a508c 100644
--- a/include/linux/cordic.h
+++ b/include/linux/cordic.h
@@ -35,8 +35,8 @@ struct cordic_iq {
35 * @theta: angle in degrees for which i/q coordinate is to be calculated. 35 * @theta: angle in degrees for which i/q coordinate is to be calculated.
36 * @coord: function output parameter holding the i/q coordinate. 36 * @coord: function output parameter holding the i/q coordinate.
37 * 37 *
38 * The function calculates the i/q coordinate for a given angle using 38 * The function calculates the i/q coordinate for a given angle using the
39 * cordic algorithm. The coordinate consists of a real (i) and an 39 * CORDIC algorithm. The coordinate consists of a real (i) and an
40 * imaginary (q) part. The real part is essentially the cosine of the 40 * imaginary (q) part. The real part is essentially the cosine of the
41 * angle and the imaginary part is the sine of the angle. The returned 41 * angle and the imaginary part is the sine of the angle. The returned
42 * values are scaled by 2^16 for precision. The range for theta is 42 * values are scaled by 2^16 for precision. The range for theta is
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 6cb60fd2ea84..1f6587590a1a 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -14,7 +14,7 @@
14#ifndef _LINUX_CPU_H_ 14#ifndef _LINUX_CPU_H_
15#define _LINUX_CPU_H_ 15#define _LINUX_CPU_H_
16 16
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/node.h> 18#include <linux/node.h>
19#include <linux/compiler.h> 19#include <linux/compiler.h>
20#include <linux/cpumask.h> 20#include <linux/cpumask.h>
@@ -22,19 +22,20 @@
22struct cpu { 22struct cpu {
23 int node_id; /* The node which contains the CPU */ 23 int node_id; /* The node which contains the CPU */
24 int hotpluggable; /* creates sysfs control file if hotpluggable */ 24 int hotpluggable; /* creates sysfs control file if hotpluggable */
25 struct sys_device sysdev; 25 struct device dev;
26}; 26};
27 27
28extern int register_cpu(struct cpu *cpu, int num); 28extern int register_cpu(struct cpu *cpu, int num);
29extern struct sys_device *get_cpu_sysdev(unsigned cpu); 29extern struct device *get_cpu_device(unsigned cpu);
30extern bool cpu_is_hotpluggable(unsigned cpu);
30 31
31extern int cpu_add_sysdev_attr(struct sysdev_attribute *attr); 32extern int cpu_add_dev_attr(struct device_attribute *attr);
32extern void cpu_remove_sysdev_attr(struct sysdev_attribute *attr); 33extern void cpu_remove_dev_attr(struct device_attribute *attr);
33 34
34extern int cpu_add_sysdev_attr_group(struct attribute_group *attrs); 35extern int cpu_add_dev_attr_group(struct attribute_group *attrs);
35extern void cpu_remove_sysdev_attr_group(struct attribute_group *attrs); 36extern void cpu_remove_dev_attr_group(struct attribute_group *attrs);
36 37
37extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls); 38extern int sched_create_sysfs_power_savings_entries(struct device *dev);
38 39
39#ifdef CONFIG_HOTPLUG_CPU 40#ifdef CONFIG_HOTPLUG_CPU
40extern void unregister_cpu(struct cpu *cpu); 41extern void unregister_cpu(struct cpu *cpu);
@@ -160,7 +161,7 @@ static inline void cpu_maps_update_done(void)
160} 161}
161 162
162#endif /* CONFIG_SMP */ 163#endif /* CONFIG_SMP */
163extern struct sysdev_class cpu_sysdev_class; 164extern struct bus_type cpu_subsys;
164 165
165#ifdef CONFIG_HOTPLUG_CPU 166#ifdef CONFIG_HOTPLUG_CPU
166/* Stop CPUs going up and down. */ 167/* Stop CPUs going up and down. */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 7408af843b8a..712abcc205ae 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -130,7 +130,6 @@ struct cpuidle_driver {
130#ifdef CONFIG_CPU_IDLE 130#ifdef CONFIG_CPU_IDLE
131extern void disable_cpuidle(void); 131extern void disable_cpuidle(void);
132extern int cpuidle_idle_call(void); 132extern int cpuidle_idle_call(void);
133
134extern int cpuidle_register_driver(struct cpuidle_driver *drv); 133extern int cpuidle_register_driver(struct cpuidle_driver *drv);
135struct cpuidle_driver *cpuidle_get_driver(void); 134struct cpuidle_driver *cpuidle_get_driver(void);
136extern void cpuidle_unregister_driver(struct cpuidle_driver *drv); 135extern void cpuidle_unregister_driver(struct cpuidle_driver *drv);
@@ -145,7 +144,6 @@ extern void cpuidle_disable_device(struct cpuidle_device *dev);
145#else 144#else
146static inline void disable_cpuidle(void) { } 145static inline void disable_cpuidle(void) { }
147static inline int cpuidle_idle_call(void) { return -ENODEV; } 146static inline int cpuidle_idle_call(void) { return -ENODEV; }
148
149static inline int cpuidle_register_driver(struct cpuidle_driver *drv) 147static inline int cpuidle_register_driver(struct cpuidle_driver *drv)
150{return -ENODEV; } 148{return -ENODEV; }
151static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; } 149static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; }
@@ -188,7 +186,14 @@ struct cpuidle_governor {
188extern int cpuidle_register_governor(struct cpuidle_governor *gov); 186extern int cpuidle_register_governor(struct cpuidle_governor *gov);
189extern void cpuidle_unregister_governor(struct cpuidle_governor *gov); 187extern void cpuidle_unregister_governor(struct cpuidle_governor *gov);
190 188
189#ifdef CONFIG_INTEL_IDLE
190extern int intel_idle_cpu_init(int cpu);
191#else
192static inline int intel_idle_cpu_init(int cpu) { return -1; }
193#endif
194
191#else 195#else
196static inline int intel_idle_cpu_init(int cpu) { return -1; }
192 197
193static inline int cpuidle_register_governor(struct cpuidle_governor *gov) 198static inline int cpuidle_register_governor(struct cpuidle_governor *gov)
194{return 0;} 199{return 0;}
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 5c4abce94ad1..b936763f2236 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -5,6 +5,7 @@
5#include <linux/kexec.h> 5#include <linux/kexec.h>
6#include <linux/device.h> 6#include <linux/device.h>
7#include <linux/proc_fs.h> 7#include <linux/proc_fs.h>
8#include <linux/elf.h>
8 9
9#define ELFCORE_ADDR_MAX (-1ULL) 10#define ELFCORE_ADDR_MAX (-1ULL)
10#define ELFCORE_ADDR_ERR (-2ULL) 11#define ELFCORE_ADDR_ERR (-2ULL)
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 40308969ed00..adadf71a7327 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -358,10 +358,12 @@ static inline void put_cred(const struct cred *_cred)
358#define current_security() (current_cred_xxx(security)) 358#define current_security() (current_cred_xxx(security))
359 359
360#ifdef CONFIG_USER_NS 360#ifdef CONFIG_USER_NS
361#define current_user_ns() (current_cred_xxx(user_ns)) 361#define current_user_ns() (current_cred_xxx(user_ns))
362#define task_user_ns(task) (task_cred_xxx((task), user_ns))
362#else 363#else
363extern struct user_namespace init_user_ns; 364extern struct user_namespace init_user_ns;
364#define current_user_ns() (&init_user_ns) 365#define current_user_ns() (&init_user_ns)
366#define task_user_ns(task) (&init_user_ns)
365#endif 367#endif
366 368
367 369
diff --git a/include/linux/cuda.h b/include/linux/cuda.h
index 6a3e6385d3f3..9f9865ff781e 100644
--- a/include/linux/cuda.h
+++ b/include/linux/cuda.h
@@ -5,6 +5,9 @@
5 * Copyright (C) 1996 Paul Mackerras. 5 * Copyright (C) 1996 Paul Mackerras.
6 */ 6 */
7 7
8#ifndef _LINUX_CUDA_H
9#define _LINUX_CUDA_H
10
8/* CUDA commands (2nd byte) */ 11/* CUDA commands (2nd byte) */
9#define CUDA_WARM_START 0 12#define CUDA_WARM_START 0
10#define CUDA_AUTOPOLL 1 13#define CUDA_AUTOPOLL 1
@@ -34,3 +37,5 @@ extern int cuda_request(struct adb_request *req,
34extern void cuda_poll(void); 37extern void cuda_poll(void);
35 38
36#endif /* __KERNEL */ 39#endif /* __KERNEL */
40
41#endif /* _LINUX_CUDA_H */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index ed9f74f6c519..ff5f5256d175 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -47,27 +47,6 @@ struct dentry_stat_t {
47}; 47};
48extern struct dentry_stat_t dentry_stat; 48extern struct dentry_stat_t dentry_stat;
49 49
50/*
51 * Compare 2 name strings, return 0 if they match, otherwise non-zero.
52 * The strings are both count bytes long, and count is non-zero.
53 */
54static inline int dentry_cmp(const unsigned char *cs, size_t scount,
55 const unsigned char *ct, size_t tcount)
56{
57 int ret;
58 if (scount != tcount)
59 return 1;
60 do {
61 ret = (*cs != *ct);
62 if (ret)
63 break;
64 cs++;
65 ct++;
66 tcount--;
67 } while (tcount);
68 return ret;
69}
70
71/* Name hashing routines. Initial hash value */ 50/* Name hashing routines. Initial hash value */
72/* Hash courtesy of the R5 hash in reiserfs modulo sign bits */ 51/* Hash courtesy of the R5 hash in reiserfs modulo sign bits */
73#define init_name_hash() 0 52#define init_name_hash() 0
@@ -89,14 +68,7 @@ static inline unsigned long end_name_hash(unsigned long hash)
89} 68}
90 69
91/* Compute the hash for a name string. */ 70/* Compute the hash for a name string. */
92static inline unsigned int 71extern unsigned int full_name_hash(const unsigned char *, unsigned int);
93full_name_hash(const unsigned char *name, unsigned int len)
94{
95 unsigned long hash = init_name_hash();
96 while (len--)
97 hash = partial_name_hash(*name++, hash);
98 return end_name_hash(hash);
99}
100 72
101/* 73/*
102 * Try to keep struct dentry aligned on 64 byte cachelines (this will 74 * Try to keep struct dentry aligned on 64 byte cachelines (this will
@@ -203,6 +175,7 @@ struct dentry_operations {
203 175
204#define DCACHE_CANT_MOUNT 0x0100 176#define DCACHE_CANT_MOUNT 0x0100
205#define DCACHE_GENOCIDE 0x0200 177#define DCACHE_GENOCIDE 0x0200
178#define DCACHE_SHRINK_LIST 0x0400
206 179
207#define DCACHE_NFSFS_RENAMED 0x1000 180#define DCACHE_NFSFS_RENAMED 0x1000
208 /* this dentry has been "silly renamed" and has to be deleted on the last 181 /* this dentry has been "silly renamed" and has to be deleted on the last
@@ -241,6 +214,7 @@ extern struct dentry * d_alloc(struct dentry *, const struct qstr *);
241extern struct dentry * d_alloc_pseudo(struct super_block *, const struct qstr *); 214extern struct dentry * d_alloc_pseudo(struct super_block *, const struct qstr *);
242extern struct dentry * d_splice_alias(struct inode *, struct dentry *); 215extern struct dentry * d_splice_alias(struct inode *, struct dentry *);
243extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *); 216extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *);
217extern struct dentry *d_find_any_alias(struct inode *inode);
244extern struct dentry * d_obtain_alias(struct inode *); 218extern struct dentry * d_obtain_alias(struct inode *);
245extern void shrink_dcache_sb(struct super_block *); 219extern void shrink_dcache_sb(struct super_block *);
246extern void shrink_dcache_parent(struct dentry *); 220extern void shrink_dcache_parent(struct dentry *);
@@ -249,6 +223,7 @@ extern int d_invalidate(struct dentry *);
249 223
250/* only used at mount-time */ 224/* only used at mount-time */
251extern struct dentry * d_alloc_root(struct inode *); 225extern struct dentry * d_alloc_root(struct inode *);
226extern struct dentry * d_make_root(struct inode *);
252 227
253/* <clickety>-<click> the ramfs-type tree */ 228/* <clickety>-<click> the ramfs-type tree */
254extern void d_genocide(struct dentry *); 229extern void d_genocide(struct dentry *);
@@ -306,7 +281,8 @@ extern struct dentry *d_ancestor(struct dentry *, struct dentry *);
306extern struct dentry *d_lookup(struct dentry *, struct qstr *); 281extern struct dentry *d_lookup(struct dentry *, struct qstr *);
307extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *); 282extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *);
308extern struct dentry *__d_lookup(struct dentry *, struct qstr *); 283extern struct dentry *__d_lookup(struct dentry *, struct qstr *);
309extern struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name, 284extern struct dentry *__d_lookup_rcu(const struct dentry *parent,
285 const struct qstr *name,
310 unsigned *seq, struct inode **inode); 286 unsigned *seq, struct inode **inode);
311 287
312/** 288/**
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index e7d9b20ddc5b..6169c26fd8c8 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -16,6 +16,7 @@
16#define _DEBUGFS_H_ 16#define _DEBUGFS_H_
17 17
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/seq_file.h>
19 20
20#include <linux/types.h> 21#include <linux/types.h>
21 22
@@ -26,6 +27,17 @@ struct debugfs_blob_wrapper {
26 unsigned long size; 27 unsigned long size;
27}; 28};
28 29
30struct debugfs_reg32 {
31 char *name;
32 unsigned long offset;
33};
34
35struct debugfs_regset32 {
36 struct debugfs_reg32 *regs;
37 int nregs;
38 void __iomem *base;
39};
40
29extern struct dentry *arch_debugfs_dir; 41extern struct dentry *arch_debugfs_dir;
30 42
31#if defined(CONFIG_DEBUG_FS) 43#if defined(CONFIG_DEBUG_FS)
@@ -34,7 +46,7 @@ extern struct dentry *arch_debugfs_dir;
34extern const struct file_operations debugfs_file_operations; 46extern const struct file_operations debugfs_file_operations;
35extern const struct inode_operations debugfs_link_operations; 47extern const struct inode_operations debugfs_link_operations;
36 48
37struct dentry *debugfs_create_file(const char *name, mode_t mode, 49struct dentry *debugfs_create_file(const char *name, umode_t mode,
38 struct dentry *parent, void *data, 50 struct dentry *parent, void *data,
39 const struct file_operations *fops); 51 const struct file_operations *fops);
40 52
@@ -49,31 +61,38 @@ void debugfs_remove_recursive(struct dentry *dentry);
49struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, 61struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
50 struct dentry *new_dir, const char *new_name); 62 struct dentry *new_dir, const char *new_name);
51 63
52struct dentry *debugfs_create_u8(const char *name, mode_t mode, 64struct dentry *debugfs_create_u8(const char *name, umode_t mode,
53 struct dentry *parent, u8 *value); 65 struct dentry *parent, u8 *value);
54struct dentry *debugfs_create_u16(const char *name, mode_t mode, 66struct dentry *debugfs_create_u16(const char *name, umode_t mode,
55 struct dentry *parent, u16 *value); 67 struct dentry *parent, u16 *value);
56struct dentry *debugfs_create_u32(const char *name, mode_t mode, 68struct dentry *debugfs_create_u32(const char *name, umode_t mode,
57 struct dentry *parent, u32 *value); 69 struct dentry *parent, u32 *value);
58struct dentry *debugfs_create_u64(const char *name, mode_t mode, 70struct dentry *debugfs_create_u64(const char *name, umode_t mode,
59 struct dentry *parent, u64 *value); 71 struct dentry *parent, u64 *value);
60struct dentry *debugfs_create_x8(const char *name, mode_t mode, 72struct dentry *debugfs_create_x8(const char *name, umode_t mode,
61 struct dentry *parent, u8 *value); 73 struct dentry *parent, u8 *value);
62struct dentry *debugfs_create_x16(const char *name, mode_t mode, 74struct dentry *debugfs_create_x16(const char *name, umode_t mode,
63 struct dentry *parent, u16 *value); 75 struct dentry *parent, u16 *value);
64struct dentry *debugfs_create_x32(const char *name, mode_t mode, 76struct dentry *debugfs_create_x32(const char *name, umode_t mode,
65 struct dentry *parent, u32 *value); 77 struct dentry *parent, u32 *value);
66struct dentry *debugfs_create_x64(const char *name, mode_t mode, 78struct dentry *debugfs_create_x64(const char *name, umode_t mode,
67 struct dentry *parent, u64 *value); 79 struct dentry *parent, u64 *value);
68struct dentry *debugfs_create_size_t(const char *name, mode_t mode, 80struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
69 struct dentry *parent, size_t *value); 81 struct dentry *parent, size_t *value);
70struct dentry *debugfs_create_bool(const char *name, mode_t mode, 82struct dentry *debugfs_create_bool(const char *name, umode_t mode,
71 struct dentry *parent, u32 *value); 83 struct dentry *parent, u32 *value);
72 84
73struct dentry *debugfs_create_blob(const char *name, mode_t mode, 85struct dentry *debugfs_create_blob(const char *name, umode_t mode,
74 struct dentry *parent, 86 struct dentry *parent,
75 struct debugfs_blob_wrapper *blob); 87 struct debugfs_blob_wrapper *blob);
76 88
89struct dentry *debugfs_create_regset32(const char *name, mode_t mode,
90 struct dentry *parent,
91 struct debugfs_regset32 *regset);
92
93int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
94 int nregs, void __iomem *base, char *prefix);
95
77bool debugfs_initialized(void); 96bool debugfs_initialized(void);
78 97
79#else 98#else
@@ -86,7 +105,7 @@ bool debugfs_initialized(void);
86 * want to duplicate the design decision mistakes of procfs and devfs again. 105 * want to duplicate the design decision mistakes of procfs and devfs again.
87 */ 106 */
88 107
89static inline struct dentry *debugfs_create_file(const char *name, mode_t mode, 108static inline struct dentry *debugfs_create_file(const char *name, umode_t mode,
90 struct dentry *parent, void *data, 109 struct dentry *parent, void *data,
91 const struct file_operations *fops) 110 const struct file_operations *fops)
92{ 111{
@@ -118,76 +137,83 @@ static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentr
118 return ERR_PTR(-ENODEV); 137 return ERR_PTR(-ENODEV);
119} 138}
120 139
121static inline struct dentry *debugfs_create_u8(const char *name, mode_t mode, 140static inline struct dentry *debugfs_create_u8(const char *name, umode_t mode,
122 struct dentry *parent, 141 struct dentry *parent,
123 u8 *value) 142 u8 *value)
124{ 143{
125 return ERR_PTR(-ENODEV); 144 return ERR_PTR(-ENODEV);
126} 145}
127 146
128static inline struct dentry *debugfs_create_u16(const char *name, mode_t mode, 147static inline struct dentry *debugfs_create_u16(const char *name, umode_t mode,
129 struct dentry *parent, 148 struct dentry *parent,
130 u16 *value) 149 u16 *value)
131{ 150{
132 return ERR_PTR(-ENODEV); 151 return ERR_PTR(-ENODEV);
133} 152}
134 153
135static inline struct dentry *debugfs_create_u32(const char *name, mode_t mode, 154static inline struct dentry *debugfs_create_u32(const char *name, umode_t mode,
136 struct dentry *parent, 155 struct dentry *parent,
137 u32 *value) 156 u32 *value)
138{ 157{
139 return ERR_PTR(-ENODEV); 158 return ERR_PTR(-ENODEV);
140} 159}
141 160
142static inline struct dentry *debugfs_create_u64(const char *name, mode_t mode, 161static inline struct dentry *debugfs_create_u64(const char *name, umode_t mode,
143 struct dentry *parent, 162 struct dentry *parent,
144 u64 *value) 163 u64 *value)
145{ 164{
146 return ERR_PTR(-ENODEV); 165 return ERR_PTR(-ENODEV);
147} 166}
148 167
149static inline struct dentry *debugfs_create_x8(const char *name, mode_t mode, 168static inline struct dentry *debugfs_create_x8(const char *name, umode_t mode,
150 struct dentry *parent, 169 struct dentry *parent,
151 u8 *value) 170 u8 *value)
152{ 171{
153 return ERR_PTR(-ENODEV); 172 return ERR_PTR(-ENODEV);
154} 173}
155 174
156static inline struct dentry *debugfs_create_x16(const char *name, mode_t mode, 175static inline struct dentry *debugfs_create_x16(const char *name, umode_t mode,
157 struct dentry *parent, 176 struct dentry *parent,
158 u16 *value) 177 u16 *value)
159{ 178{
160 return ERR_PTR(-ENODEV); 179 return ERR_PTR(-ENODEV);
161} 180}
162 181
163static inline struct dentry *debugfs_create_x32(const char *name, mode_t mode, 182static inline struct dentry *debugfs_create_x32(const char *name, umode_t mode,
164 struct dentry *parent, 183 struct dentry *parent,
165 u32 *value) 184 u32 *value)
166{ 185{
167 return ERR_PTR(-ENODEV); 186 return ERR_PTR(-ENODEV);
168} 187}
169 188
170static inline struct dentry *debugfs_create_size_t(const char *name, mode_t mode, 189static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
171 struct dentry *parent, 190 struct dentry *parent,
172 size_t *value) 191 size_t *value)
173{ 192{
174 return ERR_PTR(-ENODEV); 193 return ERR_PTR(-ENODEV);
175} 194}
176 195
177static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode, 196static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode,
178 struct dentry *parent, 197 struct dentry *parent,
179 u32 *value) 198 u32 *value)
180{ 199{
181 return ERR_PTR(-ENODEV); 200 return ERR_PTR(-ENODEV);
182} 201}
183 202
184static inline struct dentry *debugfs_create_blob(const char *name, mode_t mode, 203static inline struct dentry *debugfs_create_blob(const char *name, umode_t mode,
185 struct dentry *parent, 204 struct dentry *parent,
186 struct debugfs_blob_wrapper *blob) 205 struct debugfs_blob_wrapper *blob)
187{ 206{
188 return ERR_PTR(-ENODEV); 207 return ERR_PTR(-ENODEV);
189} 208}
190 209
210static inline struct dentry *debugfs_create_regset32(const char *name,
211 mode_t mode, struct dentry *parent,
212 struct debugfs_regset32 *regset)
213{
214 return ERR_PTR(-ENODEV);
215}
216
191static inline bool debugfs_initialized(void) 217static inline bool debugfs_initialized(void)
192{ 218{
193 return false; 219 return false;
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h
index 65970b811e22..0e5f5785d9f2 100644
--- a/include/linux/debugobjects.h
+++ b/include/linux/debugobjects.h
@@ -46,6 +46,8 @@ struct debug_obj {
46 * fails 46 * fails
47 * @fixup_free: fixup function, which is called when the free check 47 * @fixup_free: fixup function, which is called when the free check
48 * fails 48 * fails
49 * @fixup_assert_init: fixup function, which is called when the assert_init
50 * check fails
49 */ 51 */
50struct debug_obj_descr { 52struct debug_obj_descr {
51 const char *name; 53 const char *name;
@@ -54,6 +56,7 @@ struct debug_obj_descr {
54 int (*fixup_activate) (void *addr, enum debug_obj_state state); 56 int (*fixup_activate) (void *addr, enum debug_obj_state state);
55 int (*fixup_destroy) (void *addr, enum debug_obj_state state); 57 int (*fixup_destroy) (void *addr, enum debug_obj_state state);
56 int (*fixup_free) (void *addr, enum debug_obj_state state); 58 int (*fixup_free) (void *addr, enum debug_obj_state state);
59 int (*fixup_assert_init)(void *addr, enum debug_obj_state state);
57}; 60};
58 61
59#ifdef CONFIG_DEBUG_OBJECTS 62#ifdef CONFIG_DEBUG_OBJECTS
@@ -64,6 +67,7 @@ extern void debug_object_activate (void *addr, struct debug_obj_descr *descr);
64extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr); 67extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr);
65extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr); 68extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr);
66extern void debug_object_free (void *addr, struct debug_obj_descr *descr); 69extern void debug_object_free (void *addr, struct debug_obj_descr *descr);
70extern void debug_object_assert_init(void *addr, struct debug_obj_descr *descr);
67 71
68/* 72/*
69 * Active state: 73 * Active state:
@@ -89,6 +93,8 @@ static inline void
89debug_object_destroy (void *addr, struct debug_obj_descr *descr) { } 93debug_object_destroy (void *addr, struct debug_obj_descr *descr) { }
90static inline void 94static inline void
91debug_object_free (void *addr, struct debug_obj_descr *descr) { } 95debug_object_free (void *addr, struct debug_obj_descr *descr) { }
96static inline void
97debug_object_assert_init(void *addr, struct debug_obj_descr *descr) { }
92 98
93static inline void debug_objects_early_init(void) { } 99static inline void debug_objects_early_init(void) { }
94static inline void debug_objects_mem_init(void) { } 100static inline void debug_objects_mem_init(void) { }
diff --git a/include/linux/device.h b/include/linux/device.h
index 3136ede5a1e1..b63fb393aa58 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -53,6 +53,8 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
53 * struct bus_type - The bus type of the device 53 * struct bus_type - The bus type of the device
54 * 54 *
55 * @name: The name of the bus. 55 * @name: The name of the bus.
56 * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id).
57 * @dev_root: Default device to use as the parent.
56 * @bus_attrs: Default attributes of the bus. 58 * @bus_attrs: Default attributes of the bus.
57 * @dev_attrs: Default attributes of the devices on the bus. 59 * @dev_attrs: Default attributes of the devices on the bus.
58 * @drv_attrs: Default attributes of the device drivers on the bus. 60 * @drv_attrs: Default attributes of the device drivers on the bus.
@@ -86,6 +88,8 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
86 */ 88 */
87struct bus_type { 89struct bus_type {
88 const char *name; 90 const char *name;
91 const char *dev_name;
92 struct device *dev_root;
89 struct bus_attribute *bus_attrs; 93 struct bus_attribute *bus_attrs;
90 struct device_attribute *dev_attrs; 94 struct device_attribute *dev_attrs;
91 struct driver_attribute *drv_attrs; 95 struct driver_attribute *drv_attrs;
@@ -106,12 +110,30 @@ struct bus_type {
106 struct subsys_private *p; 110 struct subsys_private *p;
107}; 111};
108 112
109extern int __must_check bus_register(struct bus_type *bus); 113/* This is a #define to keep the compiler from merging different
114 * instances of the __key variable */
115#define bus_register(subsys) \
116({ \
117 static struct lock_class_key __key; \
118 __bus_register(subsys, &__key); \
119})
120extern int __must_check __bus_register(struct bus_type *bus,
121 struct lock_class_key *key);
110extern void bus_unregister(struct bus_type *bus); 122extern void bus_unregister(struct bus_type *bus);
111 123
112extern int __must_check bus_rescan_devices(struct bus_type *bus); 124extern int __must_check bus_rescan_devices(struct bus_type *bus);
113 125
114/* iterator helpers for buses */ 126/* iterator helpers for buses */
127struct subsys_dev_iter {
128 struct klist_iter ki;
129 const struct device_type *type;
130};
131void subsys_dev_iter_init(struct subsys_dev_iter *iter,
132 struct bus_type *subsys,
133 struct device *start,
134 const struct device_type *type);
135struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
136void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
115 137
116int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, 138int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
117 int (*fn)(struct device *dev, void *data)); 139 int (*fn)(struct device *dev, void *data));
@@ -121,10 +143,10 @@ struct device *bus_find_device(struct bus_type *bus, struct device *start,
121struct device *bus_find_device_by_name(struct bus_type *bus, 143struct device *bus_find_device_by_name(struct bus_type *bus,
122 struct device *start, 144 struct device *start,
123 const char *name); 145 const char *name);
124 146struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id,
147 struct device *hint);
125int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, 148int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
126 void *data, int (*fn)(struct device_driver *, void *)); 149 void *data, int (*fn)(struct device_driver *, void *));
127
128void bus_sort_breadthfirst(struct bus_type *bus, 150void bus_sort_breadthfirst(struct bus_type *bus,
129 int (*compare)(const struct device *a, 151 int (*compare)(const struct device *a,
130 const struct device *b)); 152 const struct device *b));
@@ -256,6 +278,33 @@ struct device *driver_find_device(struct device_driver *drv,
256 int (*match)(struct device *dev, void *data)); 278 int (*match)(struct device *dev, void *data));
257 279
258/** 280/**
281 * struct subsys_interface - interfaces to device functions
282 * @name: name of the device function
283 * @subsys: subsytem of the devices to attach to
284 * @node: the list of functions registered at the subsystem
285 * @add_dev: device hookup to device function handler
286 * @remove_dev: device hookup to device function handler
287 *
288 * Simple interfaces attached to a subsystem. Multiple interfaces can
289 * attach to a subsystem and its devices. Unlike drivers, they do not
290 * exclusively claim or control devices. Interfaces usually represent
291 * a specific functionality of a subsystem/class of devices.
292 */
293struct subsys_interface {
294 const char *name;
295 struct bus_type *subsys;
296 struct list_head node;
297 int (*add_dev)(struct device *dev, struct subsys_interface *sif);
298 int (*remove_dev)(struct device *dev, struct subsys_interface *sif);
299};
300
301int subsys_interface_register(struct subsys_interface *sif);
302void subsys_interface_unregister(struct subsys_interface *sif);
303
304int subsys_system_register(struct bus_type *subsys,
305 const struct attribute_group **groups);
306
307/**
259 * struct class - device classes 308 * struct class - device classes
260 * @name: Name of the class. 309 * @name: Name of the class.
261 * @owner: The module owner. 310 * @owner: The module owner.
@@ -294,7 +343,7 @@ struct class {
294 struct kobject *dev_kobj; 343 struct kobject *dev_kobj;
295 344
296 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 345 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
297 char *(*devnode)(struct device *dev, mode_t *mode); 346 char *(*devnode)(struct device *dev, umode_t *mode);
298 347
299 void (*class_release)(struct class *class); 348 void (*class_release)(struct class *class);
300 void (*dev_release)(struct device *dev); 349 void (*dev_release)(struct device *dev);
@@ -423,7 +472,7 @@ struct device_type {
423 const char *name; 472 const char *name;
424 const struct attribute_group **groups; 473 const struct attribute_group **groups;
425 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 474 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
426 char *(*devnode)(struct device *dev, mode_t *mode); 475 char *(*devnode)(struct device *dev, umode_t *mode);
427 void (*release)(struct device *dev); 476 void (*release)(struct device *dev);
428 477
429 const struct dev_pm_ops *pm; 478 const struct dev_pm_ops *pm;
@@ -438,11 +487,31 @@ struct device_attribute {
438 const char *buf, size_t count); 487 const char *buf, size_t count);
439}; 488};
440 489
441#define DEVICE_ATTR(_name, _mode, _show, _store) \ 490struct dev_ext_attribute {
442struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) 491 struct device_attribute attr;
492 void *var;
493};
494
495ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr,
496 char *buf);
497ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr,
498 const char *buf, size_t count);
499ssize_t device_show_int(struct device *dev, struct device_attribute *attr,
500 char *buf);
501ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
502 const char *buf, size_t count);
443 503
444extern int __must_check device_create_file(struct device *device, 504#define DEVICE_ATTR(_name, _mode, _show, _store) \
445 const struct device_attribute *entry); 505 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
506#define DEVICE_ULONG_ATTR(_name, _mode, _var) \
507 struct dev_ext_attribute dev_attr_##_name = \
508 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
509#define DEVICE_INT_ATTR(_name, _mode, _var) \
510 struct dev_ext_attribute dev_attr_##_name = \
511 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
512
513extern int device_create_file(struct device *device,
514 const struct device_attribute *entry);
446extern void device_remove_file(struct device *dev, 515extern void device_remove_file(struct device *dev,
447 const struct device_attribute *attr); 516 const struct device_attribute *attr);
448extern int __must_check device_create_bin_file(struct device *dev, 517extern int __must_check device_create_bin_file(struct device *dev,
@@ -490,6 +559,9 @@ extern int devres_release_group(struct device *dev, void *id);
490extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); 559extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp);
491extern void devm_kfree(struct device *dev, void *p); 560extern void devm_kfree(struct device *dev, void *p);
492 561
562void __iomem *devm_request_and_ioremap(struct device *dev,
563 struct resource *res);
564
493struct device_dma_parameters { 565struct device_dma_parameters {
494 /* 566 /*
495 * a low level driver may set these to teach IOMMU code about 567 * a low level driver may set these to teach IOMMU code about
@@ -540,6 +612,7 @@ struct device_dma_parameters {
540 * @archdata: For arch-specific additions. 612 * @archdata: For arch-specific additions.
541 * @of_node: Associated device tree node. 613 * @of_node: Associated device tree node.
542 * @devt: For creating the sysfs "dev". 614 * @devt: For creating the sysfs "dev".
615 * @id: device instance
543 * @devres_lock: Spinlock to protect the resource of the device. 616 * @devres_lock: Spinlock to protect the resource of the device.
544 * @devres_head: The resources list of the device. 617 * @devres_head: The resources list of the device.
545 * @knode_class: The node used to add the device to the class list. 618 * @knode_class: The node used to add the device to the class list.
@@ -600,6 +673,7 @@ struct device {
600 struct device_node *of_node; /* associated device tree node */ 673 struct device_node *of_node; /* associated device tree node */
601 674
602 dev_t devt; /* dev_t, creates the sysfs "dev" */ 675 dev_t devt; /* dev_t, creates the sysfs "dev" */
676 u32 id; /* device instance */
603 677
604 spinlock_t devres_lock; 678 spinlock_t devres_lock;
605 struct list_head devres_head; 679 struct list_head devres_head;
@@ -720,7 +794,7 @@ extern int device_rename(struct device *dev, const char *new_name);
720extern int device_move(struct device *dev, struct device *new_parent, 794extern int device_move(struct device *dev, struct device *new_parent,
721 enum dpm_order dpm_order); 795 enum dpm_order dpm_order);
722extern const char *device_get_devnode(struct device *dev, 796extern const char *device_get_devnode(struct device *dev,
723 mode_t *mode, const char **tmp); 797 umode_t *mode, const char **tmp);
724extern void *dev_get_drvdata(const struct device *dev); 798extern void *dev_get_drvdata(const struct device *dev);
725extern int dev_set_drvdata(struct device *dev, void *data); 799extern int dev_set_drvdata(struct device *dev, void *data);
726 800
@@ -924,4 +998,29 @@ extern long sysfs_deprecated;
924#define sysfs_deprecated 0 998#define sysfs_deprecated 0
925#endif 999#endif
926 1000
1001/**
1002 * module_driver() - Helper macro for drivers that don't do anything
1003 * special in module init/exit. This eliminates a lot of boilerplate.
1004 * Each module may only use this macro once, and calling it replaces
1005 * module_init() and module_exit().
1006 *
1007 * @__driver: driver name
1008 * @__register: register function for this driver type
1009 * @__unregister: unregister function for this driver type
1010 *
1011 * Use this macro to construct bus specific macros for registering
1012 * drivers, and do not use it on its own.
1013 */
1014#define module_driver(__driver, __register, __unregister) \
1015static int __init __driver##_init(void) \
1016{ \
1017 return __register(&(__driver)); \
1018} \
1019module_init(__driver##_init); \
1020static void __exit __driver##_exit(void) \
1021{ \
1022 __unregister(&(__driver)); \
1023} \
1024module_exit(__driver##_exit);
1025
927#endif /* _DEVICE_H_ */ 1026#endif /* _DEVICE_H_ */
diff --git a/include/linux/digsig.h b/include/linux/digsig.h
new file mode 100644
index 000000000000..6f85a070bb45
--- /dev/null
+++ b/include/linux/digsig.h
@@ -0,0 +1,64 @@
1/*
2 * Copyright (C) 2011 Nokia Corporation
3 * Copyright (C) 2011 Intel Corporation
4 *
5 * Author:
6 * Dmitry Kasatkin <dmitry.kasatkin@nokia.com>
7 * <dmitry.kasatkin@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, version 2 of the License.
12 *
13 */
14
15#ifndef _DIGSIG_H
16#define _DIGSIG_H
17
18#include <linux/key.h>
19
20enum pubkey_algo {
21 PUBKEY_ALGO_RSA,
22 PUBKEY_ALGO_MAX,
23};
24
25enum digest_algo {
26 DIGEST_ALGO_SHA1,
27 DIGEST_ALGO_SHA256,
28 DIGEST_ALGO_MAX
29};
30
31struct pubkey_hdr {
32 uint8_t version; /* key format version */
33 uint32_t timestamp; /* key made, always 0 for now */
34 uint8_t algo;
35 uint8_t nmpi;
36 char mpi[0];
37} __packed;
38
39struct signature_hdr {
40 uint8_t version; /* signature format version */
41 uint32_t timestamp; /* signature made */
42 uint8_t algo;
43 uint8_t hash;
44 uint8_t keyid[8];
45 uint8_t nmpi;
46 char mpi[0];
47} __packed;
48
49#if defined(CONFIG_SIGNATURE) || defined(CONFIG_SIGNATURE_MODULE)
50
51int digsig_verify(struct key *keyring, const char *sig, int siglen,
52 const char *digest, int digestlen);
53
54#else
55
56static inline int digsig_verify(struct key *keyring, const char *sig,
57 int siglen, const char *digest, int digestlen)
58{
59 return -EOPNOTSUPP;
60}
61
62#endif /* CONFIG_SIGNATURE */
63
64#endif /* _DIGSIG_H */
diff --git a/include/linux/display.h b/include/linux/display.h
deleted file mode 100644
index 3bf70d639728..000000000000
--- a/include/linux/display.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * Copyright (C) 2006 James Simmons <jsimmons@infradead.org>
3 *
4 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19 *
20 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21 */
22
23#ifndef _LINUX_DISPLAY_H
24#define _LINUX_DISPLAY_H
25
26#include <linux/device.h>
27
28struct display_device;
29
30/* This structure defines all the properties of a Display. */
31struct display_driver {
32 int (*set_contrast)(struct display_device *, unsigned int);
33 int (*get_contrast)(struct display_device *);
34 void (*suspend)(struct display_device *, pm_message_t state);
35 void (*resume)(struct display_device *);
36 int (*probe)(struct display_device *, void *);
37 int (*remove)(struct display_device *);
38 int max_contrast;
39};
40
41struct display_device {
42 struct module *owner; /* Owner module */
43 struct display_driver *driver;
44 struct device *parent; /* This is the parent */
45 struct device *dev; /* This is this display device */
46 struct mutex lock;
47 void *priv_data;
48 char type[16];
49 char *name;
50 int idx;
51};
52
53extern struct display_device *display_device_register(struct display_driver *driver,
54 struct device *dev, void *devdata);
55extern void display_device_unregister(struct display_device *dev);
56
57extern int probe_edid(struct display_device *dev, void *devdata);
58
59#define to_display_device(obj) container_of(obj, struct display_device, class_dev)
60
61#endif
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
index d4e02f5353a0..6c7f6e9546c7 100644
--- a/include/linux/dlm.h
+++ b/include/linux/dlm.h
@@ -2,7 +2,7 @@
2******************************************************************************* 2*******************************************************************************
3** 3**
4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
5** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 5** Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
6** 6**
7** This copyrighted material is made available to anyone wishing to use, 7** This copyrighted material is made available to anyone wishing to use,
8** modify, copy, or redistribute it subject to the terms and conditions 8** modify, copy, or redistribute it subject to the terms and conditions
@@ -74,15 +74,76 @@ struct dlm_lksb {
74 74
75#ifdef __KERNEL__ 75#ifdef __KERNEL__
76 76
77struct dlm_slot {
78 int nodeid; /* 1 to MAX_INT */
79 int slot; /* 1 to MAX_INT */
80};
81
82/*
83 * recover_prep: called before the dlm begins lock recovery.
84 * Notfies lockspace user that locks from failed members will be granted.
85 * recover_slot: called after recover_prep and before recover_done.
86 * Identifies a failed lockspace member.
87 * recover_done: called after the dlm completes lock recovery.
88 * Identifies lockspace members and lockspace generation number.
89 */
90
91struct dlm_lockspace_ops {
92 void (*recover_prep) (void *ops_arg);
93 void (*recover_slot) (void *ops_arg, struct dlm_slot *slot);
94 void (*recover_done) (void *ops_arg, struct dlm_slot *slots,
95 int num_slots, int our_slot, uint32_t generation);
96};
97
77/* 98/*
78 * dlm_new_lockspace 99 * dlm_new_lockspace
79 * 100 *
80 * Starts a lockspace with the given name. If the named lockspace exists in 101 * Create/join a lockspace.
81 * the cluster, the calling node joins it. 102 *
103 * name: lockspace name, null terminated, up to DLM_LOCKSPACE_LEN (not
104 * including terminating null).
105 *
106 * cluster: cluster name, null terminated, up to DLM_LOCKSPACE_LEN (not
107 * including terminating null). Optional. When cluster is null, it
108 * is not used. When set, dlm_new_lockspace() returns -EBADR if cluster
109 * is not equal to the dlm cluster name.
110 *
111 * flags:
112 * DLM_LSFL_NODIR
113 * The dlm should not use a resource directory, but statically assign
114 * resource mastery to nodes based on the name hash that is otherwise
115 * used to select the directory node. Must be the same on all nodes.
116 * DLM_LSFL_TIMEWARN
117 * The dlm should emit netlink messages if locks have been waiting
118 * for a configurable amount of time. (Unused.)
119 * DLM_LSFL_FS
120 * The lockspace user is in the kernel (i.e. filesystem). Enables
121 * direct bast/cast callbacks.
122 * DLM_LSFL_NEWEXCL
123 * dlm_new_lockspace() should return -EEXIST if the lockspace exists.
124 *
125 * lvblen: length of lvb in bytes. Must be multiple of 8.
126 * dlm_new_lockspace() returns an error if this does not match
127 * what other nodes are using.
128 *
129 * ops: callbacks that indicate lockspace recovery points so the
130 * caller can coordinate its recovery and know lockspace members.
131 * This is only used by the initial dlm_new_lockspace() call.
132 * Optional.
133 *
134 * ops_arg: arg for ops callbacks.
135 *
136 * ops_result: tells caller if the ops callbacks (if provided) will
137 * be used or not. 0: will be used, -EXXX will not be used.
138 * -EOPNOTSUPP: the dlm does not have recovery_callbacks enabled.
139 *
140 * lockspace: handle for dlm functions
82 */ 141 */
83 142
84int dlm_new_lockspace(const char *name, int namelen, 143int dlm_new_lockspace(const char *name, const char *cluster,
85 dlm_lockspace_t **lockspace, uint32_t flags, int lvblen); 144 uint32_t flags, int lvblen,
145 const struct dlm_lockspace_ops *ops, void *ops_arg,
146 int *ops_result, dlm_lockspace_t **lockspace);
86 147
87/* 148/*
88 * dlm_release_lockspace 149 * dlm_release_lockspace
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
new file mode 100644
index 000000000000..f8ac076afa52
--- /dev/null
+++ b/include/linux/dma-buf.h
@@ -0,0 +1,176 @@
1/*
2 * Header file for dma buffer sharing framework.
3 *
4 * Copyright(C) 2011 Linaro Limited. All rights reserved.
5 * Author: Sumit Semwal <sumit.semwal@ti.com>
6 *
7 * Many thanks to linaro-mm-sig list, and specially
8 * Arnd Bergmann <arnd@arndb.de>, Rob Clark <rob@ti.com> and
9 * Daniel Vetter <daniel@ffwll.ch> for their support in creation and
10 * refining of this idea.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License version 2 as published by
14 * the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 * more details.
20 *
21 * You should have received a copy of the GNU General Public License along with
22 * this program. If not, see <http://www.gnu.org/licenses/>.
23 */
24#ifndef __DMA_BUF_H__
25#define __DMA_BUF_H__
26
27#include <linux/file.h>
28#include <linux/err.h>
29#include <linux/device.h>
30#include <linux/scatterlist.h>
31#include <linux/list.h>
32#include <linux/dma-mapping.h>
33
34struct dma_buf;
35struct dma_buf_attachment;
36
37/**
38 * struct dma_buf_ops - operations possible on struct dma_buf
39 * @attach: [optional] allows different devices to 'attach' themselves to the
40 * given buffer. It might return -EBUSY to signal that backing storage
41 * is already allocated and incompatible with the requirements
42 * of requesting device.
43 * @detach: [optional] detach a given device from this buffer.
44 * @map_dma_buf: returns list of scatter pages allocated, increases usecount
45 * of the buffer. Requires atleast one attach to be called
46 * before. Returned sg list should already be mapped into
47 * _device_ address space. This call may sleep. May also return
48 * -EINTR. Should return -EINVAL if attach hasn't been called yet.
49 * @unmap_dma_buf: decreases usecount of buffer, might deallocate scatter
50 * pages.
51 * @release: release this buffer; to be called after the last dma_buf_put.
52 */
53struct dma_buf_ops {
54 int (*attach)(struct dma_buf *, struct device *,
55 struct dma_buf_attachment *);
56
57 void (*detach)(struct dma_buf *, struct dma_buf_attachment *);
58
59 /* For {map,unmap}_dma_buf below, any specific buffer attributes
60 * required should get added to device_dma_parameters accessible
61 * via dev->dma_params.
62 */
63 struct sg_table * (*map_dma_buf)(struct dma_buf_attachment *,
64 enum dma_data_direction);
65 void (*unmap_dma_buf)(struct dma_buf_attachment *,
66 struct sg_table *);
67 /* TODO: Add try_map_dma_buf version, to return immed with -EBUSY
68 * if the call would block.
69 */
70
71 /* after final dma_buf_put() */
72 void (*release)(struct dma_buf *);
73
74};
75
76/**
77 * struct dma_buf - shared buffer object
78 * @size: size of the buffer
79 * @file: file pointer used for sharing buffers across, and for refcounting.
80 * @attachments: list of dma_buf_attachment that denotes all devices attached.
81 * @ops: dma_buf_ops associated with this buffer object.
82 * @priv: exporter specific private data for this buffer object.
83 */
84struct dma_buf {
85 size_t size;
86 struct file *file;
87 struct list_head attachments;
88 const struct dma_buf_ops *ops;
89 /* mutex to serialize list manipulation and other ops */
90 struct mutex lock;
91 void *priv;
92};
93
94/**
95 * struct dma_buf_attachment - holds device-buffer attachment data
96 * @dmabuf: buffer for this attachment.
97 * @dev: device attached to the buffer.
98 * @node: list of dma_buf_attachment.
99 * @priv: exporter specific attachment data.
100 *
101 * This structure holds the attachment information between the dma_buf buffer
102 * and its user device(s). The list contains one attachment struct per device
103 * attached to the buffer.
104 */
105struct dma_buf_attachment {
106 struct dma_buf *dmabuf;
107 struct device *dev;
108 struct list_head node;
109 void *priv;
110};
111
112#ifdef CONFIG_DMA_SHARED_BUFFER
113struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
114 struct device *dev);
115void dma_buf_detach(struct dma_buf *dmabuf,
116 struct dma_buf_attachment *dmabuf_attach);
117struct dma_buf *dma_buf_export(void *priv, struct dma_buf_ops *ops,
118 size_t size, int flags);
119int dma_buf_fd(struct dma_buf *dmabuf);
120struct dma_buf *dma_buf_get(int fd);
121void dma_buf_put(struct dma_buf *dmabuf);
122
123struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *,
124 enum dma_data_direction);
125void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *);
126#else
127
128static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
129 struct device *dev)
130{
131 return ERR_PTR(-ENODEV);
132}
133
134static inline void dma_buf_detach(struct dma_buf *dmabuf,
135 struct dma_buf_attachment *dmabuf_attach)
136{
137 return;
138}
139
140static inline struct dma_buf *dma_buf_export(void *priv,
141 struct dma_buf_ops *ops,
142 size_t size, int flags)
143{
144 return ERR_PTR(-ENODEV);
145}
146
147static inline int dma_buf_fd(struct dma_buf *dmabuf)
148{
149 return -ENODEV;
150}
151
152static inline struct dma_buf *dma_buf_get(int fd)
153{
154 return ERR_PTR(-ENODEV);
155}
156
157static inline void dma_buf_put(struct dma_buf *dmabuf)
158{
159 return;
160}
161
162static inline struct sg_table *dma_buf_map_attachment(
163 struct dma_buf_attachment *attach, enum dma_data_direction write)
164{
165 return ERR_PTR(-ENODEV);
166}
167
168static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
169 struct sg_table *sg)
170{
171 return;
172}
173
174#endif /* CONFIG_DMA_SHARED_BUFFER */
175
176#endif /* __DMA_BUF_H__ */
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 75f53f874b24..679b349d9b66 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -23,7 +23,6 @@
23 23
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/uio.h> 25#include <linux/uio.h>
26#include <linux/dma-direction.h>
27#include <linux/scatterlist.h> 26#include <linux/scatterlist.h>
28#include <linux/bitmap.h> 27#include <linux/bitmap.h>
29#include <asm/page.h> 28#include <asm/page.h>
@@ -72,11 +71,93 @@ enum dma_transaction_type {
72 DMA_ASYNC_TX, 71 DMA_ASYNC_TX,
73 DMA_SLAVE, 72 DMA_SLAVE,
74 DMA_CYCLIC, 73 DMA_CYCLIC,
74 DMA_INTERLEAVE,
75/* last transaction type for creation of the capabilities mask */
76 DMA_TX_TYPE_END,
75}; 77};
76 78
77/* last transaction type for creation of the capabilities mask */ 79/**
78#define DMA_TX_TYPE_END (DMA_CYCLIC + 1) 80 * enum dma_transfer_direction - dma transfer mode and direction indicator
81 * @DMA_MEM_TO_MEM: Async/Memcpy mode
82 * @DMA_MEM_TO_DEV: Slave mode & From Memory to Device
83 * @DMA_DEV_TO_MEM: Slave mode & From Device to Memory
84 * @DMA_DEV_TO_DEV: Slave mode & From Device to Device
85 */
86enum dma_transfer_direction {
87 DMA_MEM_TO_MEM,
88 DMA_MEM_TO_DEV,
89 DMA_DEV_TO_MEM,
90 DMA_DEV_TO_DEV,
91 DMA_TRANS_NONE,
92};
93
94/**
95 * Interleaved Transfer Request
96 * ----------------------------
97 * A chunk is collection of contiguous bytes to be transfered.
98 * The gap(in bytes) between two chunks is called inter-chunk-gap(ICG).
99 * ICGs may or maynot change between chunks.
100 * A FRAME is the smallest series of contiguous {chunk,icg} pairs,
101 * that when repeated an integral number of times, specifies the transfer.
102 * A transfer template is specification of a Frame, the number of times
103 * it is to be repeated and other per-transfer attributes.
104 *
105 * Practically, a client driver would have ready a template for each
106 * type of transfer it is going to need during its lifetime and
107 * set only 'src_start' and 'dst_start' before submitting the requests.
108 *
109 *
110 * | Frame-1 | Frame-2 | ~ | Frame-'numf' |
111 * |====....==.===...=...|====....==.===...=...| ~ |====....==.===...=...|
112 *
113 * == Chunk size
114 * ... ICG
115 */
116
117/**
118 * struct data_chunk - Element of scatter-gather list that makes a frame.
119 * @size: Number of bytes to read from source.
120 * size_dst := fn(op, size_src), so doesn't mean much for destination.
121 * @icg: Number of bytes to jump after last src/dst address of this
122 * chunk and before first src/dst address for next chunk.
123 * Ignored for dst(assumed 0), if dst_inc is true and dst_sgl is false.
124 * Ignored for src(assumed 0), if src_inc is true and src_sgl is false.
125 */
126struct data_chunk {
127 size_t size;
128 size_t icg;
129};
79 130
131/**
132 * struct dma_interleaved_template - Template to convey DMAC the transfer pattern
133 * and attributes.
134 * @src_start: Bus address of source for the first chunk.
135 * @dst_start: Bus address of destination for the first chunk.
136 * @dir: Specifies the type of Source and Destination.
137 * @src_inc: If the source address increments after reading from it.
138 * @dst_inc: If the destination address increments after writing to it.
139 * @src_sgl: If the 'icg' of sgl[] applies to Source (scattered read).
140 * Otherwise, source is read contiguously (icg ignored).
141 * Ignored if src_inc is false.
142 * @dst_sgl: If the 'icg' of sgl[] applies to Destination (scattered write).
143 * Otherwise, destination is filled contiguously (icg ignored).
144 * Ignored if dst_inc is false.
145 * @numf: Number of frames in this template.
146 * @frame_size: Number of chunks in a frame i.e, size of sgl[].
147 * @sgl: Array of {chunk,icg} pairs that make up a frame.
148 */
149struct dma_interleaved_template {
150 dma_addr_t src_start;
151 dma_addr_t dst_start;
152 enum dma_transfer_direction dir;
153 bool src_inc;
154 bool dst_inc;
155 bool src_sgl;
156 bool dst_sgl;
157 size_t numf;
158 size_t frame_size;
159 struct data_chunk sgl[0];
160};
80 161
81/** 162/**
82 * enum dma_ctrl_flags - DMA flags to augment operation preparation, 163 * enum dma_ctrl_flags - DMA flags to augment operation preparation,
@@ -269,7 +350,7 @@ enum dma_slave_buswidth {
269 * struct, if applicable. 350 * struct, if applicable.
270 */ 351 */
271struct dma_slave_config { 352struct dma_slave_config {
272 enum dma_data_direction direction; 353 enum dma_transfer_direction direction;
273 dma_addr_t src_addr; 354 dma_addr_t src_addr;
274 dma_addr_t dst_addr; 355 dma_addr_t dst_addr;
275 enum dma_slave_buswidth src_addr_width; 356 enum dma_slave_buswidth src_addr_width;
@@ -433,6 +514,7 @@ struct dma_tx_state {
433 * @device_prep_dma_cyclic: prepare a cyclic dma operation suitable for audio. 514 * @device_prep_dma_cyclic: prepare a cyclic dma operation suitable for audio.
434 * The function takes a buffer of size buf_len. The callback function will 515 * The function takes a buffer of size buf_len. The callback function will
435 * be called after period_len bytes have been transferred. 516 * be called after period_len bytes have been transferred.
517 * @device_prep_interleaved_dma: Transfer expression in a generic way.
436 * @device_control: manipulate all pending operations on a channel, returns 518 * @device_control: manipulate all pending operations on a channel, returns
437 * zero or error code 519 * zero or error code
438 * @device_tx_status: poll for transaction completion, the optional 520 * @device_tx_status: poll for transaction completion, the optional
@@ -492,11 +574,14 @@ struct dma_device {
492 574
493 struct dma_async_tx_descriptor *(*device_prep_slave_sg)( 575 struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
494 struct dma_chan *chan, struct scatterlist *sgl, 576 struct dma_chan *chan, struct scatterlist *sgl,
495 unsigned int sg_len, enum dma_data_direction direction, 577 unsigned int sg_len, enum dma_transfer_direction direction,
496 unsigned long flags); 578 unsigned long flags);
497 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)( 579 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)(
498 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, 580 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
499 size_t period_len, enum dma_data_direction direction); 581 size_t period_len, enum dma_transfer_direction direction);
582 struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)(
583 struct dma_chan *chan, struct dma_interleaved_template *xt,
584 unsigned long flags);
500 int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd, 585 int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
501 unsigned long arg); 586 unsigned long arg);
502 587
@@ -522,7 +607,7 @@ static inline int dmaengine_slave_config(struct dma_chan *chan,
522 607
523static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single( 608static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
524 struct dma_chan *chan, void *buf, size_t len, 609 struct dma_chan *chan, void *buf, size_t len,
525 enum dma_data_direction dir, unsigned long flags) 610 enum dma_transfer_direction dir, unsigned long flags)
526{ 611{
527 struct scatterlist sg; 612 struct scatterlist sg;
528 sg_init_one(&sg, buf, len); 613 sg_init_one(&sg, buf, len);
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
index 4bfe0a2f7d50..f2c64f92c4a0 100644
--- a/include/linux/dw_dmac.h
+++ b/include/linux/dw_dmac.h
@@ -127,7 +127,7 @@ struct dw_cyclic_desc {
127 127
128struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan, 128struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
129 dma_addr_t buf_addr, size_t buf_len, size_t period_len, 129 dma_addr_t buf_addr, size_t buf_len, size_t period_len,
130 enum dma_data_direction direction); 130 enum dma_transfer_direction direction);
131void dw_dma_cyclic_free(struct dma_chan *chan); 131void dw_dma_cyclic_free(struct dma_chan *chan);
132int dw_dma_cyclic_start(struct dma_chan *chan); 132int dw_dma_cyclic_start(struct dma_chan *chan);
133void dw_dma_cyclic_stop(struct dma_chan *chan); 133void dw_dma_cyclic_stop(struct dma_chan *chan);
diff --git a/include/linux/dynamic_queue_limits.h b/include/linux/dynamic_queue_limits.h
new file mode 100644
index 000000000000..5621547d631b
--- /dev/null
+++ b/include/linux/dynamic_queue_limits.h
@@ -0,0 +1,97 @@
1/*
2 * Dynamic queue limits (dql) - Definitions
3 *
4 * Copyright (c) 2011, Tom Herbert <therbert@google.com>
5 *
6 * This header file contains the definitions for dynamic queue limits (dql).
7 * dql would be used in conjunction with a producer/consumer type queue
8 * (possibly a HW queue). Such a queue would have these general properties:
9 *
10 * 1) Objects are queued up to some limit specified as number of objects.
11 * 2) Periodically a completion process executes which retires consumed
12 * objects.
13 * 3) Starvation occurs when limit has been reached, all queued data has
14 * actually been consumed, but completion processing has not yet run
15 * so queuing new data is blocked.
16 * 4) Minimizing the amount of queued data is desirable.
17 *
18 * The goal of dql is to calculate the limit as the minimum number of objects
19 * needed to prevent starvation.
20 *
21 * The primary functions of dql are:
22 * dql_queued - called when objects are enqueued to record number of objects
23 * dql_avail - returns how many objects are available to be queued based
24 * on the object limit and how many objects are already enqueued
25 * dql_completed - called at completion time to indicate how many objects
26 * were retired from the queue
27 *
28 * The dql implementation does not implement any locking for the dql data
29 * structures, the higher layer should provide this. dql_queued should
30 * be serialized to prevent concurrent execution of the function; this
31 * is also true for dql_completed. However, dql_queued and dlq_completed can
32 * be executed concurrently (i.e. they can be protected by different locks).
33 */
34
35#ifndef _LINUX_DQL_H
36#define _LINUX_DQL_H
37
38#ifdef __KERNEL__
39
40struct dql {
41 /* Fields accessed in enqueue path (dql_queued) */
42 unsigned int num_queued; /* Total ever queued */
43 unsigned int adj_limit; /* limit + num_completed */
44 unsigned int last_obj_cnt; /* Count at last queuing */
45
46 /* Fields accessed only by completion path (dql_completed) */
47
48 unsigned int limit ____cacheline_aligned_in_smp; /* Current limit */
49 unsigned int num_completed; /* Total ever completed */
50
51 unsigned int prev_ovlimit; /* Previous over limit */
52 unsigned int prev_num_queued; /* Previous queue total */
53 unsigned int prev_last_obj_cnt; /* Previous queuing cnt */
54
55 unsigned int lowest_slack; /* Lowest slack found */
56 unsigned long slack_start_time; /* Time slacks seen */
57
58 /* Configuration */
59 unsigned int max_limit; /* Max limit */
60 unsigned int min_limit; /* Minimum limit */
61 unsigned int slack_hold_time; /* Time to measure slack */
62};
63
64/* Set some static maximums */
65#define DQL_MAX_OBJECT (UINT_MAX / 16)
66#define DQL_MAX_LIMIT ((UINT_MAX / 2) - DQL_MAX_OBJECT)
67
68/*
69 * Record number of objects queued. Assumes that caller has already checked
70 * availability in the queue with dql_avail.
71 */
72static inline void dql_queued(struct dql *dql, unsigned int count)
73{
74 BUG_ON(count > DQL_MAX_OBJECT);
75
76 dql->num_queued += count;
77 dql->last_obj_cnt = count;
78}
79
80/* Returns how many objects can be queued, < 0 indicates over limit. */
81static inline int dql_avail(const struct dql *dql)
82{
83 return dql->adj_limit - dql->num_queued;
84}
85
86/* Record number of completed objects and recalculate the limit. */
87void dql_completed(struct dql *dql, unsigned int count);
88
89/* Reset dql state */
90void dql_reset(struct dql *dql);
91
92/* Initialize dql state */
93int dql_init(struct dql *dql, unsigned hold_time);
94
95#endif /* _KERNEL_ */
96
97#endif /* _LINUX_DQL_H */
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 055b248bdd53..1cd3947987e5 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -13,7 +13,7 @@
13#define _LINUX_EDAC_H_ 13#define _LINUX_EDAC_H_
14 14
15#include <linux/atomic.h> 15#include <linux/atomic.h>
16#include <linux/sysdev.h> 16#include <linux/device.h>
17 17
18#define EDAC_OPSTATE_INVAL -1 18#define EDAC_OPSTATE_INVAL -1
19#define EDAC_OPSTATE_POLL 0 19#define EDAC_OPSTATE_POLL 0
@@ -23,12 +23,12 @@
23extern int edac_op_state; 23extern int edac_op_state;
24extern int edac_err_assert; 24extern int edac_err_assert;
25extern atomic_t edac_handlers; 25extern atomic_t edac_handlers;
26extern struct sysdev_class edac_class; 26extern struct bus_type edac_subsys;
27 27
28extern int edac_handler_set(void); 28extern int edac_handler_set(void);
29extern void edac_atomic_assert_error(void); 29extern void edac_atomic_assert_error(void);
30extern struct sysdev_class *edac_get_sysfs_class(void); 30extern struct bus_type *edac_get_sysfs_subsys(void);
31extern void edac_put_sysfs_class(void); 31extern void edac_put_sysfs_subsys(void);
32 32
33static inline void opstate_init(void) 33static inline void opstate_init(void)
34{ 34{
diff --git a/include/linux/eeprom_93cx6.h b/include/linux/eeprom_93cx6.h
index c4627cbdb8e0..e50f98b0297a 100644
--- a/include/linux/eeprom_93cx6.h
+++ b/include/linux/eeprom_93cx6.h
@@ -33,6 +33,7 @@
33#define PCI_EEPROM_WIDTH_93C86 8 33#define PCI_EEPROM_WIDTH_93C86 8
34#define PCI_EEPROM_WIDTH_OPCODE 3 34#define PCI_EEPROM_WIDTH_OPCODE 3
35#define PCI_EEPROM_WRITE_OPCODE 0x05 35#define PCI_EEPROM_WRITE_OPCODE 0x05
36#define PCI_EEPROM_ERASE_OPCODE 0x07
36#define PCI_EEPROM_READ_OPCODE 0x06 37#define PCI_EEPROM_READ_OPCODE 0x06
37#define PCI_EEPROM_EWDS_OPCODE 0x10 38#define PCI_EEPROM_EWDS_OPCODE 0x10
38#define PCI_EEPROM_EWEN_OPCODE 0x13 39#define PCI_EEPROM_EWEN_OPCODE 0x13
@@ -46,6 +47,7 @@
46 * @register_write(struct eeprom_93cx6 *eeprom): handler to 47 * @register_write(struct eeprom_93cx6 *eeprom): handler to
47 * write to the eeprom register by using all reg_* fields. 48 * write to the eeprom register by using all reg_* fields.
48 * @width: eeprom width, should be one of the PCI_EEPROM_WIDTH_* defines 49 * @width: eeprom width, should be one of the PCI_EEPROM_WIDTH_* defines
50 * @drive_data: Set if we're driving the data line.
49 * @reg_data_in: register field to indicate data input 51 * @reg_data_in: register field to indicate data input
50 * @reg_data_out: register field to indicate data output 52 * @reg_data_out: register field to indicate data output
51 * @reg_data_clock: register field to set the data clock 53 * @reg_data_clock: register field to set the data clock
@@ -62,6 +64,7 @@ struct eeprom_93cx6 {
62 64
63 int width; 65 int width;
64 66
67 char drive_data;
65 char reg_data_in; 68 char reg_data_in;
66 char reg_data_out; 69 char reg_data_out;
67 char reg_data_clock; 70 char reg_data_clock;
@@ -72,3 +75,8 @@ extern void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom,
72 const u8 word, u16 *data); 75 const u8 word, u16 *data);
73extern void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom, 76extern void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom,
74 const u8 word, __le16 *data, const u16 words); 77 const u8 word, __le16 *data, const u16 words);
78
79extern void eeprom_93cx6_wren(struct eeprom_93cx6 *eeprom, bool enable);
80
81extern void eeprom_93cx6_write(struct eeprom_93cx6 *eeprom,
82 u8 addr, u16 data);
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 2362a0bc7f0d..37c300712e02 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -109,6 +109,14 @@ typedef struct {
109 u32 imagesize; 109 u32 imagesize;
110} efi_capsule_header_t; 110} efi_capsule_header_t;
111 111
112/*
113 * Allocation types for calls to boottime->allocate_pages.
114 */
115#define EFI_ALLOCATE_ANY_PAGES 0
116#define EFI_ALLOCATE_MAX_ADDRESS 1
117#define EFI_ALLOCATE_ADDRESS 2
118#define EFI_MAX_ALLOCATE_TYPE 3
119
112typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg); 120typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg);
113 121
114/* 122/*
@@ -139,6 +147,57 @@ typedef struct {
139} efi_time_cap_t; 147} efi_time_cap_t;
140 148
141/* 149/*
150 * EFI Boot Services table
151 */
152typedef struct {
153 efi_table_hdr_t hdr;
154 void *raise_tpl;
155 void *restore_tpl;
156 void *allocate_pages;
157 void *free_pages;
158 void *get_memory_map;
159 void *allocate_pool;
160 void *free_pool;
161 void *create_event;
162 void *set_timer;
163 void *wait_for_event;
164 void *signal_event;
165 void *close_event;
166 void *check_event;
167 void *install_protocol_interface;
168 void *reinstall_protocol_interface;
169 void *uninstall_protocol_interface;
170 void *handle_protocol;
171 void *__reserved;
172 void *register_protocol_notify;
173 void *locate_handle;
174 void *locate_device_path;
175 void *install_configuration_table;
176 void *load_image;
177 void *start_image;
178 void *exit;
179 void *unload_image;
180 void *exit_boot_services;
181 void *get_next_monotonic_count;
182 void *stall;
183 void *set_watchdog_timer;
184 void *connect_controller;
185 void *disconnect_controller;
186 void *open_protocol;
187 void *close_protocol;
188 void *open_protocol_information;
189 void *protocols_per_handle;
190 void *locate_handle_buffer;
191 void *locate_protocol;
192 void *install_multiple_protocol_interfaces;
193 void *uninstall_multiple_protocol_interfaces;
194 void *calculate_crc32;
195 void *copy_mem;
196 void *set_mem;
197 void *create_event_ex;
198} efi_boot_services_t;
199
200/*
142 * Types and defines for EFI ResetSystem 201 * Types and defines for EFI ResetSystem
143 */ 202 */
144#define EFI_RESET_COLD 0 203#define EFI_RESET_COLD 0
@@ -236,6 +295,24 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,
236#define LINUX_EFI_CRASH_GUID \ 295#define LINUX_EFI_CRASH_GUID \
237 EFI_GUID( 0xcfc8fc79, 0xbe2e, 0x4ddc, 0x97, 0xf0, 0x9f, 0x98, 0xbf, 0xe2, 0x98, 0xa0 ) 296 EFI_GUID( 0xcfc8fc79, 0xbe2e, 0x4ddc, 0x97, 0xf0, 0x9f, 0x98, 0xbf, 0xe2, 0x98, 0xa0 )
238 297
298#define LOADED_IMAGE_PROTOCOL_GUID \
299 EFI_GUID( 0x5b1b31a1, 0x9562, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
300
301#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
302 EFI_GUID( 0x9042a9de, 0x23dc, 0x4a38, 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a )
303
304#define EFI_UGA_PROTOCOL_GUID \
305 EFI_GUID( 0x982c298b, 0xf4fa, 0x41cb, 0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 )
306
307#define EFI_PCI_IO_PROTOCOL_GUID \
308 EFI_GUID( 0x4cf5b200, 0x68b8, 0x4ca5, 0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a )
309
310#define EFI_FILE_INFO_ID \
311 EFI_GUID( 0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
312
313#define EFI_FILE_SYSTEM_GUID \
314 EFI_GUID( 0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
315
239typedef struct { 316typedef struct {
240 efi_guid_t guid; 317 efi_guid_t guid;
241 unsigned long table; 318 unsigned long table;
@@ -261,7 +338,7 @@ typedef struct {
261 unsigned long stderr_handle; 338 unsigned long stderr_handle;
262 unsigned long stderr; 339 unsigned long stderr;
263 efi_runtime_services_t *runtime; 340 efi_runtime_services_t *runtime;
264 unsigned long boottime; 341 efi_boot_services_t *boottime;
265 unsigned long nr_tables; 342 unsigned long nr_tables;
266 unsigned long tables; 343 unsigned long tables;
267} efi_system_table_t; 344} efi_system_table_t;
@@ -275,6 +352,56 @@ struct efi_memory_map {
275 unsigned long desc_size; 352 unsigned long desc_size;
276}; 353};
277 354
355typedef struct {
356 u32 revision;
357 void *parent_handle;
358 efi_system_table_t *system_table;
359 void *device_handle;
360 void *file_path;
361 void *reserved;
362 u32 load_options_size;
363 void *load_options;
364 void *image_base;
365 __aligned_u64 image_size;
366 unsigned int image_code_type;
367 unsigned int image_data_type;
368 unsigned long unload;
369} efi_loaded_image_t;
370
371typedef struct {
372 u64 revision;
373 void *open_volume;
374} efi_file_io_interface_t;
375
376typedef struct {
377 u64 size;
378 u64 file_size;
379 u64 phys_size;
380 efi_time_t create_time;
381 efi_time_t last_access_time;
382 efi_time_t modification_time;
383 __aligned_u64 attribute;
384 efi_char16_t filename[1];
385} efi_file_info_t;
386
387typedef struct {
388 u64 revision;
389 void *open;
390 void *close;
391 void *delete;
392 void *read;
393 void *write;
394 void *get_position;
395 void *set_position;
396 void *get_info;
397 void *set_info;
398 void *flush;
399} efi_file_handle_t;
400
401#define EFI_FILE_MODE_READ 0x0000000000000001
402#define EFI_FILE_MODE_WRITE 0x0000000000000002
403#define EFI_FILE_MODE_CREATE 0x8000000000000000
404
278#define EFI_INVALID_TABLE_ADDR (~0UL) 405#define EFI_INVALID_TABLE_ADDR (~0UL)
279 406
280/* 407/*
@@ -385,6 +512,13 @@ extern int __init efi_setup_pcdp_console(char *);
385#define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004 512#define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004
386 513
387/* 514/*
515 * The type of search to perform when calling boottime->locate_handle
516 */
517#define EFI_LOCATE_ALL_HANDLES 0
518#define EFI_LOCATE_BY_REGISTER_NOTIFY 1
519#define EFI_LOCATE_BY_PROTOCOL 2
520
521/*
388 * EFI Device Path information 522 * EFI Device Path information
389 */ 523 */
390#define EFI_DEV_HW 0x01 524#define EFI_DEV_HW 0x01
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 1d0f7a2ff73b..7d4e0356f329 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -5,6 +5,8 @@
5 5
6#ifdef CONFIG_BLOCK 6#ifdef CONFIG_BLOCK
7 7
8struct io_cq;
9
8typedef int (elevator_merge_fn) (struct request_queue *, struct request **, 10typedef int (elevator_merge_fn) (struct request_queue *, struct request **,
9 struct bio *); 11 struct bio *);
10 12
@@ -24,6 +26,8 @@ typedef struct request *(elevator_request_list_fn) (struct request_queue *, stru
24typedef void (elevator_completed_req_fn) (struct request_queue *, struct request *); 26typedef void (elevator_completed_req_fn) (struct request_queue *, struct request *);
25typedef int (elevator_may_queue_fn) (struct request_queue *, int); 27typedef int (elevator_may_queue_fn) (struct request_queue *, int);
26 28
29typedef void (elevator_init_icq_fn) (struct io_cq *);
30typedef void (elevator_exit_icq_fn) (struct io_cq *);
27typedef int (elevator_set_req_fn) (struct request_queue *, struct request *, gfp_t); 31typedef int (elevator_set_req_fn) (struct request_queue *, struct request *, gfp_t);
28typedef void (elevator_put_req_fn) (struct request *); 32typedef void (elevator_put_req_fn) (struct request *);
29typedef void (elevator_activate_req_fn) (struct request_queue *, struct request *); 33typedef void (elevator_activate_req_fn) (struct request_queue *, struct request *);
@@ -38,12 +42,6 @@ struct elevator_ops
38 elevator_merged_fn *elevator_merged_fn; 42 elevator_merged_fn *elevator_merged_fn;
39 elevator_merge_req_fn *elevator_merge_req_fn; 43 elevator_merge_req_fn *elevator_merge_req_fn;
40 elevator_allow_merge_fn *elevator_allow_merge_fn; 44 elevator_allow_merge_fn *elevator_allow_merge_fn;
41
42 /*
43 * Used for both plugged list and elevator merging and in the
44 * former case called without queue_lock. Read comment on top of
45 * attempt_plug_merge() for details.
46 */
47 elevator_bio_merged_fn *elevator_bio_merged_fn; 45 elevator_bio_merged_fn *elevator_bio_merged_fn;
48 46
49 elevator_dispatch_fn *elevator_dispatch_fn; 47 elevator_dispatch_fn *elevator_dispatch_fn;
@@ -56,6 +54,9 @@ struct elevator_ops
56 elevator_request_list_fn *elevator_former_req_fn; 54 elevator_request_list_fn *elevator_former_req_fn;
57 elevator_request_list_fn *elevator_latter_req_fn; 55 elevator_request_list_fn *elevator_latter_req_fn;
58 56
57 elevator_init_icq_fn *elevator_init_icq_fn; /* see iocontext.h */
58 elevator_exit_icq_fn *elevator_exit_icq_fn; /* ditto */
59
59 elevator_set_req_fn *elevator_set_req_fn; 60 elevator_set_req_fn *elevator_set_req_fn;
60 elevator_put_req_fn *elevator_put_req_fn; 61 elevator_put_req_fn *elevator_put_req_fn;
61 62
@@ -63,7 +64,6 @@ struct elevator_ops
63 64
64 elevator_init_fn *elevator_init_fn; 65 elevator_init_fn *elevator_init_fn;
65 elevator_exit_fn *elevator_exit_fn; 66 elevator_exit_fn *elevator_exit_fn;
66 void (*trim)(struct io_context *);
67}; 67};
68 68
69#define ELV_NAME_MAX (16) 69#define ELV_NAME_MAX (16)
@@ -79,11 +79,20 @@ struct elv_fs_entry {
79 */ 79 */
80struct elevator_type 80struct elevator_type
81{ 81{
82 struct list_head list; 82 /* managed by elevator core */
83 struct kmem_cache *icq_cache;
84
85 /* fields provided by elevator implementation */
83 struct elevator_ops ops; 86 struct elevator_ops ops;
87 size_t icq_size; /* see iocontext.h */
88 size_t icq_align; /* ditto */
84 struct elv_fs_entry *elevator_attrs; 89 struct elv_fs_entry *elevator_attrs;
85 char elevator_name[ELV_NAME_MAX]; 90 char elevator_name[ELV_NAME_MAX];
86 struct module *elevator_owner; 91 struct module *elevator_owner;
92
93 /* managed by elevator core */
94 char icq_cache_name[ELV_NAME_MAX + 5]; /* elvname + "_io_cq" */
95 struct list_head list;
87}; 96};
88 97
89/* 98/*
@@ -91,10 +100,9 @@ struct elevator_type
91 */ 100 */
92struct elevator_queue 101struct elevator_queue
93{ 102{
94 struct elevator_ops *ops; 103 struct elevator_type *type;
95 void *elevator_data; 104 void *elevator_data;
96 struct kobject kobj; 105 struct kobject kobj;
97 struct elevator_type *elevator_type;
98 struct mutex sysfs_lock; 106 struct mutex sysfs_lock;
99 struct hlist_head *hash; 107 struct hlist_head *hash;
100 unsigned int registered:1; 108 unsigned int registered:1;
@@ -108,7 +116,6 @@ extern void elv_dispatch_add_tail(struct request_queue *, struct request *);
108extern void elv_add_request(struct request_queue *, struct request *, int); 116extern void elv_add_request(struct request_queue *, struct request *, int);
109extern void __elv_add_request(struct request_queue *, struct request *, int); 117extern void __elv_add_request(struct request_queue *, struct request *, int);
110extern int elv_merge(struct request_queue *, struct request **, struct bio *); 118extern int elv_merge(struct request_queue *, struct request **, struct bio *);
111extern int elv_try_merge(struct request *, struct bio *);
112extern void elv_merge_requests(struct request_queue *, struct request *, 119extern void elv_merge_requests(struct request_queue *, struct request *,
113 struct request *); 120 struct request *);
114extern void elv_merged_request(struct request_queue *, struct request *, int); 121extern void elv_merged_request(struct request_queue *, struct request *, int);
@@ -129,7 +136,7 @@ extern void elv_drain_elevator(struct request_queue *);
129/* 136/*
130 * io scheduler registration 137 * io scheduler registration
131 */ 138 */
132extern void elv_register(struct elevator_type *); 139extern int elv_register(struct elevator_type *);
133extern void elv_unregister(struct elevator_type *); 140extern void elv_unregister(struct elevator_type *);
134 141
135/* 142/*
@@ -141,7 +148,7 @@ extern ssize_t elv_iosched_store(struct request_queue *, const char *, size_t);
141extern int elevator_init(struct request_queue *, char *); 148extern int elevator_init(struct request_queue *, char *);
142extern void elevator_exit(struct elevator_queue *); 149extern void elevator_exit(struct elevator_queue *);
143extern int elevator_change(struct request_queue *, const char *); 150extern int elevator_change(struct request_queue *, const char *);
144extern int elv_rq_merge_ok(struct request *, struct bio *); 151extern bool elv_rq_merge_ok(struct request *, struct bio *);
145 152
146/* 153/*
147 * Helper functions. 154 * Helper functions.
@@ -197,22 +204,5 @@ enum {
197 INIT_LIST_HEAD(&(rq)->csd.list); \ 204 INIT_LIST_HEAD(&(rq)->csd.list); \
198 } while (0) 205 } while (0)
199 206
200/*
201 * io context count accounting
202 */
203#define elv_ioc_count_mod(name, __val) this_cpu_add(name, __val)
204#define elv_ioc_count_inc(name) this_cpu_inc(name)
205#define elv_ioc_count_dec(name) this_cpu_dec(name)
206
207#define elv_ioc_count_read(name) \
208({ \
209 unsigned long __val = 0; \
210 int __cpu; \
211 smp_wmb(); \
212 for_each_possible_cpu(__cpu) \
213 __val += per_cpu(name, __cpu); \
214 __val; \
215})
216
217#endif /* CONFIG_BLOCK */ 207#endif /* CONFIG_BLOCK */
218#endif 208#endif
diff --git a/include/linux/elf-em.h b/include/linux/elf-em.h
index 18bea78fe47b..8e2b7bac4378 100644
--- a/include/linux/elf-em.h
+++ b/include/linux/elf-em.h
@@ -33,6 +33,7 @@
33#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */ 33#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */
34#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ 34#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */
35#define EM_BLACKFIN 106 /* ADI Blackfin Processor */ 35#define EM_BLACKFIN 106 /* ADI Blackfin Processor */
36#define EM_TI_C6000 140 /* TI C6X DSPs */
36#define EM_FRV 0x5441 /* Fujitsu FR-V */ 37#define EM_FRV 0x5441 /* Fujitsu FR-V */
37#define EM_AVR32 0x18ad /* Atmel AVR32 */ 38#define EM_AVR32 0x18ad /* Atmel AVR32 */
38 39
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 31f0508d7da7..999b4f52e8e5 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -7,15 +7,6 @@
7#include <asm/elf.h> 7#include <asm/elf.h>
8#endif 8#endif
9 9
10struct file;
11
12#ifndef elf_read_implies_exec
13 /* Executables for which elf_read_implies_exec() returns TRUE will
14 have the READ_IMPLIES_EXEC personality flag set automatically.
15 Override in asm/elf.h as needed. */
16# define elf_read_implies_exec(ex, have_pt_gnu_stack) 0
17#endif
18
19/* 32-bit ELF base types. */ 10/* 32-bit ELF base types. */
20typedef __u32 Elf32_Addr; 11typedef __u32 Elf32_Addr;
21typedef __u16 Elf32_Half; 12typedef __u16 Elf32_Half;
@@ -414,6 +405,13 @@ typedef struct elf64_note {
414} Elf64_Nhdr; 405} Elf64_Nhdr;
415 406
416#ifdef __KERNEL__ 407#ifdef __KERNEL__
408#ifndef elf_read_implies_exec
409 /* Executables for which elf_read_implies_exec() returns TRUE will
410 have the READ_IMPLIES_EXEC personality flag set automatically.
411 Override in asm/elf.h as needed. */
412# define elf_read_implies_exec(ex, have_pt_gnu_stack) 0
413#endif
414
417#if ELF_CLASS == ELFCLASS32 415#if ELF_CLASS == ELFCLASS32
418 416
419extern Elf32_Dyn _DYNAMIC []; 417extern Elf32_Dyn _DYNAMIC [];
@@ -437,6 +435,8 @@ extern Elf64_Dyn _DYNAMIC [];
437#endif 435#endif
438 436
439/* Optional callbacks to write extra ELF notes. */ 437/* Optional callbacks to write extra ELF notes. */
438struct file;
439
440#ifndef ARCH_HAVE_EXTRA_ELF_NOTES 440#ifndef ARCH_HAVE_EXTRA_ELF_NOTES
441static inline int elf_coredump_extra_notes_size(void) { return 0; } 441static inline int elf_coredump_extra_notes_size(void) { return 0; }
442static inline int elf_coredump_extra_notes_write(struct file *file, 442static inline int elf_coredump_extra_notes_write(struct file *file,
diff --git a/include/linux/errqueue.h b/include/linux/errqueue.h
index 034072cea853..fd0628be45ce 100644
--- a/include/linux/errqueue.h
+++ b/include/linux/errqueue.h
@@ -17,14 +17,15 @@ struct sock_extended_err {
17#define SO_EE_ORIGIN_LOCAL 1 17#define SO_EE_ORIGIN_LOCAL 1
18#define SO_EE_ORIGIN_ICMP 2 18#define SO_EE_ORIGIN_ICMP 2
19#define SO_EE_ORIGIN_ICMP6 3 19#define SO_EE_ORIGIN_ICMP6 3
20#define SO_EE_ORIGIN_TIMESTAMPING 4 20#define SO_EE_ORIGIN_TXSTATUS 4
21#define SO_EE_ORIGIN_TIMESTAMPING SO_EE_ORIGIN_TXSTATUS
21 22
22#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1)) 23#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1))
23 24
24#ifdef __KERNEL__ 25#ifdef __KERNEL__
25 26
26#include <net/ip.h> 27#include <net/ip.h>
27#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 28#if IS_ENABLED(CONFIG_IPV6)
28#include <linux/ipv6.h> 29#include <linux/ipv6.h>
29#endif 30#endif
30 31
@@ -33,7 +34,7 @@ struct sock_extended_err {
33struct sock_exterr_skb { 34struct sock_exterr_skb {
34 union { 35 union {
35 struct inet_skb_parm h4; 36 struct inet_skb_parm h4;
36#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 37#if IS_ENABLED(CONFIG_IPV6)
37 struct inet6_skb_parm h6; 38 struct inet6_skb_parm h6;
38#endif 39#endif
39 } header; 40 } header;
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index de33de1e2052..da5b2de99ae4 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -489,7 +489,10 @@ struct ethtool_rx_flow_spec {
489 * on return. 489 * on return.
490 * 490 *
491 * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined 491 * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
492 * rules on return. 492 * rules on return. If @data is non-zero on return then it is the
493 * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the
494 * driver supports any special location values. If that flag is not
495 * set in @data then special location values should not be used.
493 * 496 *
494 * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an 497 * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an
495 * existing rule on entry and @fs contains the rule on return. 498 * existing rule on entry and @fs contains the rule on return.
@@ -501,10 +504,23 @@ struct ethtool_rx_flow_spec {
501 * must use the second parameter to get_rxnfc() instead of @rule_locs. 504 * must use the second parameter to get_rxnfc() instead of @rule_locs.
502 * 505 *
503 * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update. 506 * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
504 * @fs.@location specifies the location to use and must not be ignored. 507 * @fs.@location either specifies the location to use or is a special
508 * location value with %RX_CLS_LOC_SPECIAL flag set. On return,
509 * @fs.@location is the actual rule location.
505 * 510 *
506 * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an 511 * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
507 * existing rule on entry. 512 * existing rule on entry.
513 *
514 * A driver supporting the special location values for
515 * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
516 * location, and may remove a rule at a later location (lower
517 * priority) that matches exactly the same set of flows. The special
518 * values are: %RX_CLS_LOC_ANY, selecting any location;
519 * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
520 * priority); and %RX_CLS_LOC_LAST, selecting the last suitable
521 * location (minimum priority). Additional special values may be
522 * defined in future and drivers must return -%EINVAL for any
523 * unrecognised value.
508 */ 524 */
509struct ethtool_rxnfc { 525struct ethtool_rxnfc {
510 __u32 cmd; 526 __u32 cmd;
@@ -543,9 +559,15 @@ struct compat_ethtool_rxnfc {
543/** 559/**
544 * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection 560 * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
545 * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR 561 * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
546 * @size: On entry, the array size of the user buffer. On return from 562 * @size: On entry, the array size of the user buffer, which may be zero.
547 * %ETHTOOL_GRXFHINDIR, the array size of the hardware indirection table. 563 * On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware
564 * indirection table.
548 * @ring_index: RX ring/queue index for each hash value 565 * @ring_index: RX ring/queue index for each hash value
566 *
567 * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size
568 * should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means
569 * the table should be reset to default values. This last feature
570 * is not supported by the original implementations.
549 */ 571 */
550struct ethtool_rxfh_indir { 572struct ethtool_rxfh_indir {
551 __u32 cmd; 573 __u32 cmd;
@@ -724,9 +746,6 @@ enum ethtool_sfeatures_retval_bits {
724 746
725#include <linux/rculist.h> 747#include <linux/rculist.h>
726 748
727/* needed by dev_disable_lro() */
728extern int __ethtool_set_flags(struct net_device *dev, u32 flags);
729
730extern int __ethtool_get_settings(struct net_device *dev, 749extern int __ethtool_get_settings(struct net_device *dev,
731 struct ethtool_cmd *cmd); 750 struct ethtool_cmd *cmd);
732 751
@@ -750,19 +769,18 @@ struct net_device;
750 769
751/* Some generic methods drivers may use in their ethtool_ops */ 770/* Some generic methods drivers may use in their ethtool_ops */
752u32 ethtool_op_get_link(struct net_device *dev); 771u32 ethtool_op_get_link(struct net_device *dev);
753u32 ethtool_op_get_tx_csum(struct net_device *dev); 772
754int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); 773/**
755int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data); 774 * ethtool_rxfh_indir_default - get default value for RX flow hash indirection
756int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data); 775 * @index: Index in RX flow hash indirection table
757u32 ethtool_op_get_sg(struct net_device *dev); 776 * @n_rx_rings: Number of RX rings to use
758int ethtool_op_set_sg(struct net_device *dev, u32 data); 777 *
759u32 ethtool_op_get_tso(struct net_device *dev); 778 * This function provides the default policy for RX flow hash indirection.
760int ethtool_op_set_tso(struct net_device *dev, u32 data); 779 */
761u32 ethtool_op_get_ufo(struct net_device *dev); 780static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
762int ethtool_op_set_ufo(struct net_device *dev, u32 data); 781{
763u32 ethtool_op_get_flags(struct net_device *dev); 782 return index % n_rx_rings;
764int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported); 783}
765bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
766 784
767/** 785/**
768 * struct ethtool_ops - optional netdev operations 786 * struct ethtool_ops - optional netdev operations
@@ -807,22 +825,6 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
807 * @get_pauseparam: Report pause parameters 825 * @get_pauseparam: Report pause parameters
808 * @set_pauseparam: Set pause parameters. Returns a negative error code 826 * @set_pauseparam: Set pause parameters. Returns a negative error code
809 * or zero. 827 * or zero.
810 * @get_rx_csum: Deprecated in favour of the netdev feature %NETIF_F_RXCSUM.
811 * Report whether receive checksums are turned on or off.
812 * @set_rx_csum: Deprecated in favour of generic netdev features. Turn
813 * receive checksum on or off. Returns a negative error code or zero.
814 * @get_tx_csum: Deprecated as redundant. Report whether transmit checksums
815 * are turned on or off.
816 * @set_tx_csum: Deprecated in favour of generic netdev features. Turn
817 * transmit checksums on or off. Returns a negative error code or zero.
818 * @get_sg: Deprecated as redundant. Report whether scatter-gather is
819 * enabled.
820 * @set_sg: Deprecated in favour of generic netdev features. Turn
821 * scatter-gather on or off. Returns a negative error code or zero.
822 * @get_tso: Deprecated as redundant. Report whether TCP segmentation
823 * offload is enabled.
824 * @set_tso: Deprecated in favour of generic netdev features. Turn TCP
825 * segmentation offload on or off. Returns a negative error code or zero.
826 * @self_test: Run specified self-tests 828 * @self_test: Run specified self-tests
827 * @get_strings: Return a set of strings that describe the requested objects 829 * @get_strings: Return a set of strings that describe the requested objects
828 * @set_phys_id: Identify the physical devices, e.g. by flashing an LED 830 * @set_phys_id: Identify the physical devices, e.g. by flashing an LED
@@ -844,15 +846,6 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
844 * negative error code or zero. 846 * negative error code or zero.
845 * @complete: Function to be called after any other operation except 847 * @complete: Function to be called after any other operation except
846 * @begin. Will be called even if the other operation failed. 848 * @begin. Will be called even if the other operation failed.
847 * @get_ufo: Deprecated as redundant. Report whether UDP fragmentation
848 * offload is enabled.
849 * @set_ufo: Deprecated in favour of generic netdev features. Turn UDP
850 * fragmentation offload on or off. Returns a negative error code or zero.
851 * @get_flags: Deprecated as redundant. Report features included in
852 * &enum ethtool_flags that are enabled.
853 * @set_flags: Deprecated in favour of generic netdev features. Turn
854 * features included in &enum ethtool_flags on or off. Returns a
855 * negative error code or zero.
856 * @get_priv_flags: Report driver-specific feature flags. 849 * @get_priv_flags: Report driver-specific feature flags.
857 * @set_priv_flags: Set driver-specific feature flags. Returns a negative 850 * @set_priv_flags: Set driver-specific feature flags. Returns a negative
858 * error code or zero. 851 * error code or zero.
@@ -866,11 +859,13 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
866 * @reset: Reset (part of) the device, as specified by a bitmask of 859 * @reset: Reset (part of) the device, as specified by a bitmask of
867 * flags from &enum ethtool_reset_flags. Returns a negative 860 * flags from &enum ethtool_reset_flags. Returns a negative
868 * error code or zero. 861 * error code or zero.
869 * @set_rx_ntuple: Set an RX n-tuple rule. Returns a negative error code 862 * @get_rxfh_indir_size: Get the size of the RX flow hash indirection table.
870 * or zero. 863 * Returns zero if not supported for this specific device.
871 * @get_rxfh_indir: Get the contents of the RX flow hash indirection table. 864 * @get_rxfh_indir: Get the contents of the RX flow hash indirection table.
865 * Will not be called if @get_rxfh_indir_size returns zero.
872 * Returns a negative error code or zero. 866 * Returns a negative error code or zero.
873 * @set_rxfh_indir: Set the contents of the RX flow hash indirection table. 867 * @set_rxfh_indir: Set the contents of the RX flow hash indirection table.
868 * Will not be called if @get_rxfh_indir_size returns zero.
874 * Returns a negative error code or zero. 869 * Returns a negative error code or zero.
875 * @get_channels: Get number of channels. 870 * @get_channels: Get number of channels.
876 * @set_channels: Set number of channels. Returns a negative error code or 871 * @set_channels: Set number of channels. Returns a negative error code or
@@ -917,14 +912,6 @@ struct ethtool_ops {
917 struct ethtool_pauseparam*); 912 struct ethtool_pauseparam*);
918 int (*set_pauseparam)(struct net_device *, 913 int (*set_pauseparam)(struct net_device *,
919 struct ethtool_pauseparam*); 914 struct ethtool_pauseparam*);
920 u32 (*get_rx_csum)(struct net_device *);
921 int (*set_rx_csum)(struct net_device *, u32);
922 u32 (*get_tx_csum)(struct net_device *);
923 int (*set_tx_csum)(struct net_device *, u32);
924 u32 (*get_sg)(struct net_device *);
925 int (*set_sg)(struct net_device *, u32);
926 u32 (*get_tso)(struct net_device *);
927 int (*set_tso)(struct net_device *, u32);
928 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); 915 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
929 void (*get_strings)(struct net_device *, u32 stringset, u8 *); 916 void (*get_strings)(struct net_device *, u32 stringset, u8 *);
930 int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state); 917 int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state);
@@ -932,10 +919,6 @@ struct ethtool_ops {
932 struct ethtool_stats *, u64 *); 919 struct ethtool_stats *, u64 *);
933 int (*begin)(struct net_device *); 920 int (*begin)(struct net_device *);
934 void (*complete)(struct net_device *); 921 void (*complete)(struct net_device *);
935 u32 (*get_ufo)(struct net_device *);
936 int (*set_ufo)(struct net_device *, u32);
937 u32 (*get_flags)(struct net_device *);
938 int (*set_flags)(struct net_device *, u32);
939 u32 (*get_priv_flags)(struct net_device *); 922 u32 (*get_priv_flags)(struct net_device *);
940 int (*set_priv_flags)(struct net_device *, u32); 923 int (*set_priv_flags)(struct net_device *, u32);
941 int (*get_sset_count)(struct net_device *, int); 924 int (*get_sset_count)(struct net_device *, int);
@@ -944,12 +927,9 @@ struct ethtool_ops {
944 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); 927 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
945 int (*flash_device)(struct net_device *, struct ethtool_flash *); 928 int (*flash_device)(struct net_device *, struct ethtool_flash *);
946 int (*reset)(struct net_device *, u32 *); 929 int (*reset)(struct net_device *, u32 *);
947 int (*set_rx_ntuple)(struct net_device *, 930 u32 (*get_rxfh_indir_size)(struct net_device *);
948 struct ethtool_rx_ntuple *); 931 int (*get_rxfh_indir)(struct net_device *, u32 *);
949 int (*get_rxfh_indir)(struct net_device *, 932 int (*set_rxfh_indir)(struct net_device *, const u32 *);
950 struct ethtool_rxfh_indir *);
951 int (*set_rxfh_indir)(struct net_device *,
952 const struct ethtool_rxfh_indir *);
953 void (*get_channels)(struct net_device *, struct ethtool_channels *); 933 void (*get_channels)(struct net_device *, struct ethtool_channels *);
954 int (*set_channels)(struct net_device *, struct ethtool_channels *); 934 int (*set_channels)(struct net_device *, struct ethtool_channels *);
955 int (*get_dump_flag)(struct net_device *, struct ethtool_dump *); 935 int (*get_dump_flag)(struct net_device *, struct ethtool_dump *);
@@ -1173,6 +1153,12 @@ struct ethtool_ops {
1173 1153
1174#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL 1154#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
1175 1155
1156/* Special RX classification rule insert location values */
1157#define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */
1158#define RX_CLS_LOC_ANY 0xffffffff
1159#define RX_CLS_LOC_FIRST 0xfffffffe
1160#define RX_CLS_LOC_LAST 0xfffffffd
1161
1176/* Reset flags */ 1162/* Reset flags */
1177/* The reset() operation must clear the flags for the components which 1163/* The reset() operation must clear the flags for the components which
1178 * were actually reset. On successful return, the flags indicate the 1164 * were actually reset. On successful return, the flags indicate the
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index f362733186a5..657ab55beda0 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -61,6 +61,7 @@ struct file;
61static inline void eventpoll_init_file(struct file *file) 61static inline void eventpoll_init_file(struct file *file)
62{ 62{
63 INIT_LIST_HEAD(&file->f_ep_links); 63 INIT_LIST_HEAD(&file->f_ep_links);
64 INIT_LIST_HEAD(&file->f_tfile_llink);
64} 65}
65 66
66 67
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index dec99116a0e4..f957085d40ed 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -884,7 +884,7 @@ extern int ext3fs_dirhash(const char *name, int len, struct
884 884
885/* ialloc.c */ 885/* ialloc.c */
886extern struct inode * ext3_new_inode (handle_t *, struct inode *, 886extern struct inode * ext3_new_inode (handle_t *, struct inode *,
887 const struct qstr *, int); 887 const struct qstr *, umode_t);
888extern void ext3_free_inode (handle_t *, struct inode *); 888extern void ext3_free_inode (handle_t *, struct inode *);
889extern struct inode * ext3_orphan_get (struct super_block *, unsigned long); 889extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
890extern unsigned long ext3_count_free_inodes (struct super_block *); 890extern unsigned long ext3_count_free_inodes (struct super_block *);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 1d6836c498dd..c18122f40543 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -45,6 +45,7 @@
45#define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */ 45#define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */
46#define FB_TYPE_TEXT 3 /* Text/attributes */ 46#define FB_TYPE_TEXT 3 /* Text/attributes */
47#define FB_TYPE_VGA_PLANES 4 /* EGA/VGA planes */ 47#define FB_TYPE_VGA_PLANES 4 /* EGA/VGA planes */
48#define FB_TYPE_FOURCC 5 /* Type identified by a V4L2 FOURCC */
48 49
49#define FB_AUX_TEXT_MDA 0 /* Monochrome text */ 50#define FB_AUX_TEXT_MDA 0 /* Monochrome text */
50#define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */ 51#define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */
@@ -69,6 +70,7 @@
69#define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */ 70#define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */
70#define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */ 71#define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */
71#define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */ 72#define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */
73#define FB_VISUAL_FOURCC 6 /* Visual identified by a V4L2 FOURCC */
72 74
73#define FB_ACCEL_NONE 0 /* no hardware accelerator */ 75#define FB_ACCEL_NONE 0 /* no hardware accelerator */
74#define FB_ACCEL_ATARIBLITT 1 /* Atari Blitter */ 76#define FB_ACCEL_ATARIBLITT 1 /* Atari Blitter */
@@ -154,6 +156,8 @@
154 156
155#define FB_ACCEL_PUV3_UNIGFX 0xa0 /* PKUnity-v3 Unigfx */ 157#define FB_ACCEL_PUV3_UNIGFX 0xa0 /* PKUnity-v3 Unigfx */
156 158
159#define FB_CAP_FOURCC 1 /* Device supports FOURCC-based formats */
160
157struct fb_fix_screeninfo { 161struct fb_fix_screeninfo {
158 char id[16]; /* identification string eg "TT Builtin" */ 162 char id[16]; /* identification string eg "TT Builtin" */
159 unsigned long smem_start; /* Start of frame buffer mem */ 163 unsigned long smem_start; /* Start of frame buffer mem */
@@ -171,7 +175,8 @@ struct fb_fix_screeninfo {
171 __u32 mmio_len; /* Length of Memory Mapped I/O */ 175 __u32 mmio_len; /* Length of Memory Mapped I/O */
172 __u32 accel; /* Indicate to driver which */ 176 __u32 accel; /* Indicate to driver which */
173 /* specific chip/card we have */ 177 /* specific chip/card we have */
174 __u16 reserved[3]; /* Reserved for future compatibility */ 178 __u16 capabilities; /* see FB_CAP_* */
179 __u16 reserved[2]; /* Reserved for future compatibility */
175}; 180};
176 181
177/* Interpretation of offset for color fields: All offsets are from the right, 182/* Interpretation of offset for color fields: All offsets are from the right,
@@ -246,8 +251,8 @@ struct fb_var_screeninfo {
246 __u32 yoffset; /* resolution */ 251 __u32 yoffset; /* resolution */
247 252
248 __u32 bits_per_pixel; /* guess what */ 253 __u32 bits_per_pixel; /* guess what */
249 __u32 grayscale; /* != 0 Graylevels instead of colors */ 254 __u32 grayscale; /* 0 = color, 1 = grayscale, */
250 255 /* >1 = FOURCC */
251 struct fb_bitfield red; /* bitfield in fb mem if true color, */ 256 struct fb_bitfield red; /* bitfield in fb mem if true color, */
252 struct fb_bitfield green; /* else only length is significant */ 257 struct fb_bitfield green; /* else only length is significant */
253 struct fb_bitfield blue; 258 struct fb_bitfield blue;
@@ -273,7 +278,8 @@ struct fb_var_screeninfo {
273 __u32 sync; /* see FB_SYNC_* */ 278 __u32 sync; /* see FB_SYNC_* */
274 __u32 vmode; /* see FB_VMODE_* */ 279 __u32 vmode; /* see FB_VMODE_* */
275 __u32 rotate; /* angle we rotate counter clockwise */ 280 __u32 rotate; /* angle we rotate counter clockwise */
276 __u32 reserved[5]; /* Reserved for future compatibility */ 281 __u32 colorspace; /* colorspace for FOURCC-based modes */
282 __u32 reserved[4]; /* Reserved for future compatibility */
277}; 283};
278 284
279struct fb_cmap { 285struct fb_cmap {
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index a5386e3ee756..d09af4b67cf1 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -5,71 +5,59 @@
5 5
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/wait.h> 7#include <linux/wait.h>
8#include <linux/atomic.h>
8 9
9#ifdef CONFIG_FREEZER 10#ifdef CONFIG_FREEZER
11extern atomic_t system_freezing_cnt; /* nr of freezing conds in effect */
12extern bool pm_freezing; /* PM freezing in effect */
13extern bool pm_nosig_freezing; /* PM nosig freezing in effect */
14
10/* 15/*
11 * Check if a process has been frozen 16 * Check if a process has been frozen
12 */ 17 */
13static inline int frozen(struct task_struct *p) 18static inline bool frozen(struct task_struct *p)
14{ 19{
15 return p->flags & PF_FROZEN; 20 return p->flags & PF_FROZEN;
16} 21}
17 22
18/* 23extern bool freezing_slow_path(struct task_struct *p);
19 * Check if there is a request to freeze a process
20 */
21static inline int freezing(struct task_struct *p)
22{
23 return test_tsk_thread_flag(p, TIF_FREEZE);
24}
25
26/*
27 * Request that a process be frozen
28 */
29static inline void set_freeze_flag(struct task_struct *p)
30{
31 set_tsk_thread_flag(p, TIF_FREEZE);
32}
33 24
34/* 25/*
35 * Sometimes we may need to cancel the previous 'freeze' request 26 * Check if there is a request to freeze a process
36 */ 27 */
37static inline void clear_freeze_flag(struct task_struct *p) 28static inline bool freezing(struct task_struct *p)
38{
39 clear_tsk_thread_flag(p, TIF_FREEZE);
40}
41
42static inline bool should_send_signal(struct task_struct *p)
43{ 29{
44 return !(p->flags & PF_FREEZER_NOSIG); 30 if (likely(!atomic_read(&system_freezing_cnt)))
31 return false;
32 return freezing_slow_path(p);
45} 33}
46 34
47/* Takes and releases task alloc lock using task_lock() */ 35/* Takes and releases task alloc lock using task_lock() */
48extern int thaw_process(struct task_struct *p); 36extern void __thaw_task(struct task_struct *t);
49 37
50extern void refrigerator(void); 38extern bool __refrigerator(bool check_kthr_stop);
51extern int freeze_processes(void); 39extern int freeze_processes(void);
52extern int freeze_kernel_threads(void); 40extern int freeze_kernel_threads(void);
53extern void thaw_processes(void); 41extern void thaw_processes(void);
42extern void thaw_kernel_threads(void);
54 43
55static inline int try_to_freeze(void) 44static inline bool try_to_freeze(void)
56{ 45{
57 if (freezing(current)) { 46 might_sleep();
58 refrigerator(); 47 if (likely(!freezing(current)))
59 return 1; 48 return false;
60 } else 49 return __refrigerator(false);
61 return 0;
62} 50}
63 51
64extern bool freeze_task(struct task_struct *p, bool sig_only); 52extern bool freeze_task(struct task_struct *p);
65extern void cancel_freezing(struct task_struct *p); 53extern bool set_freezable(void);
66 54
67#ifdef CONFIG_CGROUP_FREEZER 55#ifdef CONFIG_CGROUP_FREEZER
68extern int cgroup_freezing_or_frozen(struct task_struct *task); 56extern bool cgroup_freezing(struct task_struct *task);
69#else /* !CONFIG_CGROUP_FREEZER */ 57#else /* !CONFIG_CGROUP_FREEZER */
70static inline int cgroup_freezing_or_frozen(struct task_struct *task) 58static inline bool cgroup_freezing(struct task_struct *task)
71{ 59{
72 return 0; 60 return false;
73} 61}
74#endif /* !CONFIG_CGROUP_FREEZER */ 62#endif /* !CONFIG_CGROUP_FREEZER */
75 63
@@ -80,33 +68,27 @@ static inline int cgroup_freezing_or_frozen(struct task_struct *task)
80 * appropriately in case the child has exited before the freezing of tasks is 68 * appropriately in case the child has exited before the freezing of tasks is
81 * complete. However, we don't want kernel threads to be frozen in unexpected 69 * complete. However, we don't want kernel threads to be frozen in unexpected
82 * places, so we allow them to block freeze_processes() instead or to set 70 * places, so we allow them to block freeze_processes() instead or to set
83 * PF_NOFREEZE if needed and PF_FREEZER_SKIP is only set for userland vfork 71 * PF_NOFREEZE if needed. Fortunately, in the ____call_usermodehelper() case the
84 * parents. Fortunately, in the ____call_usermodehelper() case the parent won't 72 * parent won't really block freeze_processes(), since ____call_usermodehelper()
85 * really block freeze_processes(), since ____call_usermodehelper() (the child) 73 * (the child) does a little before exec/exit and it can't be frozen before
86 * does a little before exec/exit and it can't be frozen before waking up the 74 * waking up the parent.
87 * parent.
88 */ 75 */
89 76
90/* 77
91 * If the current task is a user space one, tell the freezer not to count it as 78/* Tell the freezer not to count the current task as freezable. */
92 * freezable.
93 */
94static inline void freezer_do_not_count(void) 79static inline void freezer_do_not_count(void)
95{ 80{
96 if (current->mm) 81 current->flags |= PF_FREEZER_SKIP;
97 current->flags |= PF_FREEZER_SKIP;
98} 82}
99 83
100/* 84/*
101 * If the current task is a user space one, tell the freezer to count it as 85 * Tell the freezer to count the current task as freezable again and try to
102 * freezable again and try to freeze it. 86 * freeze it.
103 */ 87 */
104static inline void freezer_count(void) 88static inline void freezer_count(void)
105{ 89{
106 if (current->mm) { 90 current->flags &= ~PF_FREEZER_SKIP;
107 current->flags &= ~PF_FREEZER_SKIP; 91 try_to_freeze();
108 try_to_freeze();
109 }
110} 92}
111 93
112/* 94/*
@@ -118,21 +100,29 @@ static inline int freezer_should_skip(struct task_struct *p)
118} 100}
119 101
120/* 102/*
121 * Tell the freezer that the current task should be frozen by it 103 * These macros are intended to be used whenever you want allow a task that's
104 * sleeping in TASK_UNINTERRUPTIBLE or TASK_KILLABLE state to be frozen. Note
105 * that neither return any clear indication of whether a freeze event happened
106 * while in this function.
122 */ 107 */
123static inline void set_freezable(void)
124{
125 current->flags &= ~PF_NOFREEZE;
126}
127 108
128/* 109/* Like schedule(), but should not block the freezer. */
129 * Tell the freezer that the current task should be frozen by it and that it 110#define freezable_schedule() \
130 * should send a fake signal to the task to freeze it. 111({ \
131 */ 112 freezer_do_not_count(); \
132static inline void set_freezable_with_signal(void) 113 schedule(); \
133{ 114 freezer_count(); \
134 current->flags &= ~(PF_NOFREEZE | PF_FREEZER_NOSIG); 115})
135} 116
117/* Like schedule_timeout_killable(), but should not block the freezer. */
118#define freezable_schedule_timeout_killable(timeout) \
119({ \
120 long __retval; \
121 freezer_do_not_count(); \
122 __retval = schedule_timeout_killable(timeout); \
123 freezer_count(); \
124 __retval; \
125})
136 126
137/* 127/*
138 * Freezer-friendly wrappers around wait_event_interruptible(), 128 * Freezer-friendly wrappers around wait_event_interruptible(),
@@ -152,47 +142,52 @@ static inline void set_freezable_with_signal(void)
152#define wait_event_freezable(wq, condition) \ 142#define wait_event_freezable(wq, condition) \
153({ \ 143({ \
154 int __retval; \ 144 int __retval; \
155 do { \ 145 for (;;) { \
156 __retval = wait_event_interruptible(wq, \ 146 __retval = wait_event_interruptible(wq, \
157 (condition) || freezing(current)); \ 147 (condition) || freezing(current)); \
158 if (__retval && !freezing(current)) \ 148 if (__retval || (condition)) \
159 break; \ 149 break; \
160 else if (!(condition)) \ 150 try_to_freeze(); \
161 __retval = -ERESTARTSYS; \ 151 } \
162 } while (try_to_freeze()); \
163 __retval; \ 152 __retval; \
164}) 153})
165 154
166
167#define wait_event_freezable_timeout(wq, condition, timeout) \ 155#define wait_event_freezable_timeout(wq, condition, timeout) \
168({ \ 156({ \
169 long __retval = timeout; \ 157 long __retval = timeout; \
170 do { \ 158 for (;;) { \
171 __retval = wait_event_interruptible_timeout(wq, \ 159 __retval = wait_event_interruptible_timeout(wq, \
172 (condition) || freezing(current), \ 160 (condition) || freezing(current), \
173 __retval); \ 161 __retval); \
174 } while (try_to_freeze()); \ 162 if (__retval <= 0 || (condition)) \
163 break; \
164 try_to_freeze(); \
165 } \
175 __retval; \ 166 __retval; \
176}) 167})
168
177#else /* !CONFIG_FREEZER */ 169#else /* !CONFIG_FREEZER */
178static inline int frozen(struct task_struct *p) { return 0; } 170static inline bool frozen(struct task_struct *p) { return false; }
179static inline int freezing(struct task_struct *p) { return 0; } 171static inline bool freezing(struct task_struct *p) { return false; }
180static inline void set_freeze_flag(struct task_struct *p) {} 172static inline void __thaw_task(struct task_struct *t) {}
181static inline void clear_freeze_flag(struct task_struct *p) {}
182static inline int thaw_process(struct task_struct *p) { return 1; }
183 173
184static inline void refrigerator(void) {} 174static inline bool __refrigerator(bool check_kthr_stop) { return false; }
185static inline int freeze_processes(void) { return -ENOSYS; } 175static inline int freeze_processes(void) { return -ENOSYS; }
186static inline int freeze_kernel_threads(void) { return -ENOSYS; } 176static inline int freeze_kernel_threads(void) { return -ENOSYS; }
187static inline void thaw_processes(void) {} 177static inline void thaw_processes(void) {}
178static inline void thaw_kernel_threads(void) {}
188 179
189static inline int try_to_freeze(void) { return 0; } 180static inline bool try_to_freeze(void) { return false; }
190 181
191static inline void freezer_do_not_count(void) {} 182static inline void freezer_do_not_count(void) {}
192static inline void freezer_count(void) {} 183static inline void freezer_count(void) {}
193static inline int freezer_should_skip(struct task_struct *p) { return 0; } 184static inline int freezer_should_skip(struct task_struct *p) { return 0; }
194static inline void set_freezable(void) {} 185static inline void set_freezable(void) {}
195static inline void set_freezable_with_signal(void) {} 186
187#define freezable_schedule() schedule()
188
189#define freezable_schedule_timeout_killable(timeout) \
190 schedule_timeout_killable(timeout)
196 191
197#define wait_event_freezable(wq, condition) \ 192#define wait_event_freezable(wq, condition) \
198 wait_event_interruptible(wq, condition) 193 wait_event_interruptible(wq, condition)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e0bc4ffb8e7f..69cd5bb640f5 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -319,6 +319,7 @@ struct inodes_stat_t {
319#define BLKPBSZGET _IO(0x12,123) 319#define BLKPBSZGET _IO(0x12,123)
320#define BLKDISCARDZEROES _IO(0x12,124) 320#define BLKDISCARDZEROES _IO(0x12,124)
321#define BLKSECDISCARD _IO(0x12,125) 321#define BLKSECDISCARD _IO(0x12,125)
322#define BLKROTATIONAL _IO(0x12,126)
322 323
323#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ 324#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
324#define FIBMAP _IO(0x00,1) /* bmap access */ 325#define FIBMAP _IO(0x00,1) /* bmap access */
@@ -395,6 +396,7 @@ struct inodes_stat_t {
395#include <linux/rculist_bl.h> 396#include <linux/rculist_bl.h>
396#include <linux/atomic.h> 397#include <linux/atomic.h>
397#include <linux/shrinker.h> 398#include <linux/shrinker.h>
399#include <linux/migrate_mode.h>
398 400
399#include <asm/byteorder.h> 401#include <asm/byteorder.h>
400 402
@@ -609,9 +611,12 @@ struct address_space_operations {
609 loff_t offset, unsigned long nr_segs); 611 loff_t offset, unsigned long nr_segs);
610 int (*get_xip_mem)(struct address_space *, pgoff_t, int, 612 int (*get_xip_mem)(struct address_space *, pgoff_t, int,
611 void **, unsigned long *); 613 void **, unsigned long *);
612 /* migrate the contents of a page to the specified target */ 614 /*
615 * migrate the contents of a page to the specified target. If sync
616 * is false, it must not block.
617 */
613 int (*migratepage) (struct address_space *, 618 int (*migratepage) (struct address_space *,
614 struct page *, struct page *); 619 struct page *, struct page *, enum migrate_mode);
615 int (*launder_page) (struct page *); 620 int (*launder_page) (struct page *);
616 int (*is_partially_uptodate) (struct page *, read_descriptor_t *, 621 int (*is_partially_uptodate) (struct page *, read_descriptor_t *,
617 unsigned long); 622 unsigned long);
@@ -656,6 +661,7 @@ struct address_space {
656 * must be enforced here for CRIS, to let the least significant bit 661 * must be enforced here for CRIS, to let the least significant bit
657 * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON. 662 * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON.
658 */ 663 */
664struct request_queue;
659 665
660struct block_device { 666struct block_device {
661 dev_t bd_dev; /* not a kdev_t - it's a search key */ 667 dev_t bd_dev; /* not a kdev_t - it's a search key */
@@ -678,6 +684,7 @@ struct block_device {
678 unsigned bd_part_count; 684 unsigned bd_part_count;
679 int bd_invalidated; 685 int bd_invalidated;
680 struct gendisk * bd_disk; 686 struct gendisk * bd_disk;
687 struct request_queue * bd_queue;
681 struct list_head bd_list; 688 struct list_head bd_list;
682 /* 689 /*
683 * Private data. You must have bd_claim'ed the block_device 690 * Private data. You must have bd_claim'ed the block_device
@@ -1001,6 +1008,7 @@ struct file {
1001#ifdef CONFIG_EPOLL 1008#ifdef CONFIG_EPOLL
1002 /* Used by fs/eventpoll.c to link all the hooks to this file */ 1009 /* Used by fs/eventpoll.c to link all the hooks to this file */
1003 struct list_head f_ep_links; 1010 struct list_head f_ep_links;
1011 struct list_head f_tfile_llink;
1004#endif /* #ifdef CONFIG_EPOLL */ 1012#endif /* #ifdef CONFIG_EPOLL */
1005 struct address_space *f_mapping; 1013 struct address_space *f_mapping;
1006#ifdef CONFIG_DEBUG_WRITECOUNT 1014#ifdef CONFIG_DEBUG_WRITECOUNT
@@ -1428,6 +1436,7 @@ struct super_block {
1428#else 1436#else
1429 struct list_head s_files; 1437 struct list_head s_files;
1430#endif 1438#endif
1439 struct list_head s_mounts; /* list of mounts; _not_ for fs use */
1431 /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */ 1440 /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */
1432 struct list_head s_dentry_lru; /* unused dentry lru */ 1441 struct list_head s_dentry_lru; /* unused dentry lru */
1433 int s_nr_dentry_unused; /* # of dentry on lru */ 1442 int s_nr_dentry_unused; /* # of dentry on lru */
@@ -1440,7 +1449,7 @@ struct super_block {
1440 struct block_device *s_bdev; 1449 struct block_device *s_bdev;
1441 struct backing_dev_info *s_bdi; 1450 struct backing_dev_info *s_bdi;
1442 struct mtd_info *s_mtd; 1451 struct mtd_info *s_mtd;
1443 struct list_head s_instances; 1452 struct hlist_node s_instances;
1444 struct quota_info s_dquot; /* Diskquota specific options */ 1453 struct quota_info s_dquot; /* Diskquota specific options */
1445 1454
1446 int s_frozen; 1455 int s_frozen;
@@ -1481,6 +1490,12 @@ struct super_block {
1481 int cleancache_poolid; 1490 int cleancache_poolid;
1482 1491
1483 struct shrinker s_shrink; /* per-sb shrinker handle */ 1492 struct shrinker s_shrink; /* per-sb shrinker handle */
1493
1494 /* Number of inodes with nlink == 0 but still referenced */
1495 atomic_long_t s_remove_count;
1496
1497 /* Being remounted read-only */
1498 int s_readonly_remount;
1484}; 1499};
1485 1500
1486/* superblock cache pruning functions */ 1501/* superblock cache pruning functions */
@@ -1516,9 +1531,9 @@ extern void unlock_super(struct super_block *);
1516/* 1531/*
1517 * VFS helper functions.. 1532 * VFS helper functions..
1518 */ 1533 */
1519extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); 1534extern int vfs_create(struct inode *, struct dentry *, umode_t, struct nameidata *);
1520extern int vfs_mkdir(struct inode *, struct dentry *, int); 1535extern int vfs_mkdir(struct inode *, struct dentry *, umode_t);
1521extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); 1536extern int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
1522extern int vfs_symlink(struct inode *, struct dentry *, const char *); 1537extern int vfs_symlink(struct inode *, struct dentry *, const char *);
1523extern int vfs_link(struct dentry *, struct inode *, struct dentry *); 1538extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
1524extern int vfs_rmdir(struct inode *, struct dentry *); 1539extern int vfs_rmdir(struct inode *, struct dentry *);
@@ -1534,7 +1549,7 @@ extern void dentry_unhash(struct dentry *dentry);
1534 * VFS file helper functions. 1549 * VFS file helper functions.
1535 */ 1550 */
1536extern void inode_init_owner(struct inode *inode, const struct inode *dir, 1551extern void inode_init_owner(struct inode *inode, const struct inode *dir,
1537 mode_t mode); 1552 umode_t mode);
1538/* 1553/*
1539 * VFS FS_IOC_FIEMAP helper definitions. 1554 * VFS FS_IOC_FIEMAP helper definitions.
1540 */ 1555 */
@@ -1619,13 +1634,13 @@ struct inode_operations {
1619 int (*readlink) (struct dentry *, char __user *,int); 1634 int (*readlink) (struct dentry *, char __user *,int);
1620 void (*put_link) (struct dentry *, struct nameidata *, void *); 1635 void (*put_link) (struct dentry *, struct nameidata *, void *);
1621 1636
1622 int (*create) (struct inode *,struct dentry *,int, struct nameidata *); 1637 int (*create) (struct inode *,struct dentry *,umode_t,struct nameidata *);
1623 int (*link) (struct dentry *,struct inode *,struct dentry *); 1638 int (*link) (struct dentry *,struct inode *,struct dentry *);
1624 int (*unlink) (struct inode *,struct dentry *); 1639 int (*unlink) (struct inode *,struct dentry *);
1625 int (*symlink) (struct inode *,struct dentry *,const char *); 1640 int (*symlink) (struct inode *,struct dentry *,const char *);
1626 int (*mkdir) (struct inode *,struct dentry *,int); 1641 int (*mkdir) (struct inode *,struct dentry *,umode_t);
1627 int (*rmdir) (struct inode *,struct dentry *); 1642 int (*rmdir) (struct inode *,struct dentry *);
1628 int (*mknod) (struct inode *,struct dentry *,int,dev_t); 1643 int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
1629 int (*rename) (struct inode *, struct dentry *, 1644 int (*rename) (struct inode *, struct dentry *,
1630 struct inode *, struct dentry *); 1645 struct inode *, struct dentry *);
1631 void (*truncate) (struct inode *); 1646 void (*truncate) (struct inode *);
@@ -1672,10 +1687,10 @@ struct super_operations {
1672 int (*remount_fs) (struct super_block *, int *, char *); 1687 int (*remount_fs) (struct super_block *, int *, char *);
1673 void (*umount_begin) (struct super_block *); 1688 void (*umount_begin) (struct super_block *);
1674 1689
1675 int (*show_options)(struct seq_file *, struct vfsmount *); 1690 int (*show_options)(struct seq_file *, struct dentry *);
1676 int (*show_devname)(struct seq_file *, struct vfsmount *); 1691 int (*show_devname)(struct seq_file *, struct dentry *);
1677 int (*show_path)(struct seq_file *, struct vfsmount *); 1692 int (*show_path)(struct seq_file *, struct dentry *);
1678 int (*show_stats)(struct seq_file *, struct vfsmount *); 1693 int (*show_stats)(struct seq_file *, struct dentry *);
1679#ifdef CONFIG_QUOTA 1694#ifdef CONFIG_QUOTA
1680 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 1695 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
1681 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1696 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
@@ -1764,31 +1779,10 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
1764 __mark_inode_dirty(inode, I_DIRTY_SYNC); 1779 __mark_inode_dirty(inode, I_DIRTY_SYNC);
1765} 1780}
1766 1781
1767/** 1782extern void inc_nlink(struct inode *inode);
1768 * set_nlink - directly set an inode's link count 1783extern void drop_nlink(struct inode *inode);
1769 * @inode: inode 1784extern void clear_nlink(struct inode *inode);
1770 * @nlink: new nlink (should be non-zero) 1785extern void set_nlink(struct inode *inode, unsigned int nlink);
1771 *
1772 * This is a low-level filesystem helper to replace any
1773 * direct filesystem manipulation of i_nlink.
1774 */
1775static inline void set_nlink(struct inode *inode, unsigned int nlink)
1776{
1777 inode->__i_nlink = nlink;
1778}
1779
1780/**
1781 * inc_nlink - directly increment an inode's link count
1782 * @inode: inode
1783 *
1784 * This is a low-level filesystem helper to replace any
1785 * direct filesystem manipulation of i_nlink. Currently,
1786 * it is only here for parity with dec_nlink().
1787 */
1788static inline void inc_nlink(struct inode *inode)
1789{
1790 inode->__i_nlink++;
1791}
1792 1786
1793static inline void inode_inc_link_count(struct inode *inode) 1787static inline void inode_inc_link_count(struct inode *inode)
1794{ 1788{
@@ -1796,35 +1790,6 @@ static inline void inode_inc_link_count(struct inode *inode)
1796 mark_inode_dirty(inode); 1790 mark_inode_dirty(inode);
1797} 1791}
1798 1792
1799/**
1800 * drop_nlink - directly drop an inode's link count
1801 * @inode: inode
1802 *
1803 * This is a low-level filesystem helper to replace any
1804 * direct filesystem manipulation of i_nlink. In cases
1805 * where we are attempting to track writes to the
1806 * filesystem, a decrement to zero means an imminent
1807 * write when the file is truncated and actually unlinked
1808 * on the filesystem.
1809 */
1810static inline void drop_nlink(struct inode *inode)
1811{
1812 inode->__i_nlink--;
1813}
1814
1815/**
1816 * clear_nlink - directly zero an inode's link count
1817 * @inode: inode
1818 *
1819 * This is a low-level filesystem helper to replace any
1820 * direct filesystem manipulation of i_nlink. See
1821 * drop_nlink() for why we care about i_nlink hitting zero.
1822 */
1823static inline void clear_nlink(struct inode *inode)
1824{
1825 inode->__i_nlink = 0;
1826}
1827
1828static inline void inode_dec_link_count(struct inode *inode) 1793static inline void inode_dec_link_count(struct inode *inode)
1829{ 1794{
1830 drop_nlink(inode); 1795 drop_nlink(inode);
@@ -1864,7 +1829,7 @@ struct file_system_type {
1864 void (*kill_sb) (struct super_block *); 1829 void (*kill_sb) (struct super_block *);
1865 struct module *owner; 1830 struct module *owner;
1866 struct file_system_type * next; 1831 struct file_system_type * next;
1867 struct list_head fs_supers; 1832 struct hlist_head fs_supers;
1868 1833
1869 struct lock_class_key s_lock_key; 1834 struct lock_class_key s_lock_key;
1870 struct lock_class_key s_umount_key; 1835 struct lock_class_key s_umount_key;
@@ -1939,7 +1904,7 @@ extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
1939extern int vfs_statfs(struct path *, struct kstatfs *); 1904extern int vfs_statfs(struct path *, struct kstatfs *);
1940extern int user_statfs(const char __user *, struct kstatfs *); 1905extern int user_statfs(const char __user *, struct kstatfs *);
1941extern int fd_statfs(int, struct kstatfs *); 1906extern int fd_statfs(int, struct kstatfs *);
1942extern int statfs_by_dentry(struct dentry *, struct kstatfs *); 1907extern int vfs_ustat(dev_t, struct kstatfs *);
1943extern int freeze_super(struct super_block *super); 1908extern int freeze_super(struct super_block *super);
1944extern int thaw_super(struct super_block *super); 1909extern int thaw_super(struct super_block *super);
1945extern bool our_mnt(struct vfsmount *mnt); 1910extern bool our_mnt(struct vfsmount *mnt);
@@ -2054,8 +2019,8 @@ extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
2054extern int do_fallocate(struct file *file, int mode, loff_t offset, 2019extern int do_fallocate(struct file *file, int mode, loff_t offset,
2055 loff_t len); 2020 loff_t len);
2056extern long do_sys_open(int dfd, const char __user *filename, int flags, 2021extern long do_sys_open(int dfd, const char __user *filename, int flags,
2057 int mode); 2022 umode_t mode);
2058extern struct file *filp_open(const char *, int, int); 2023extern struct file *filp_open(const char *, int, umode_t);
2059extern struct file *file_open_root(struct dentry *, struct vfsmount *, 2024extern struct file *file_open_root(struct dentry *, struct vfsmount *,
2060 const char *, int); 2025 const char *, int);
2061extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, 2026extern struct file * dentry_open(struct dentry *, struct vfsmount *, int,
@@ -2092,6 +2057,7 @@ extern void bd_forget(struct inode *inode);
2092extern void bdput(struct block_device *); 2057extern void bdput(struct block_device *);
2093extern void invalidate_bdev(struct block_device *); 2058extern void invalidate_bdev(struct block_device *);
2094extern int sync_blockdev(struct block_device *bdev); 2059extern int sync_blockdev(struct block_device *bdev);
2060extern void kill_bdev(struct block_device *);
2095extern struct super_block *freeze_bdev(struct block_device *); 2061extern struct super_block *freeze_bdev(struct block_device *);
2096extern void emergency_thaw_all(void); 2062extern void emergency_thaw_all(void);
2097extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); 2063extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
@@ -2099,6 +2065,7 @@ extern int fsync_bdev(struct block_device *);
2099#else 2065#else
2100static inline void bd_forget(struct inode *inode) {} 2066static inline void bd_forget(struct inode *inode) {}
2101static inline int sync_blockdev(struct block_device *bdev) { return 0; } 2067static inline int sync_blockdev(struct block_device *bdev) { return 0; }
2068static inline void kill_bdev(struct block_device *bdev) {}
2102static inline void invalidate_bdev(struct block_device *bdev) {} 2069static inline void invalidate_bdev(struct block_device *bdev) {}
2103 2070
2104static inline struct super_block *freeze_bdev(struct block_device *sb) 2071static inline struct super_block *freeze_bdev(struct block_device *sb)
@@ -2191,8 +2158,6 @@ extern const struct file_operations read_pipefifo_fops;
2191extern const struct file_operations write_pipefifo_fops; 2158extern const struct file_operations write_pipefifo_fops;
2192extern const struct file_operations rdwr_pipefifo_fops; 2159extern const struct file_operations rdwr_pipefifo_fops;
2193 2160
2194extern int fs_may_remount_ro(struct super_block *);
2195
2196#ifdef CONFIG_BLOCK 2161#ifdef CONFIG_BLOCK
2197/* 2162/*
2198 * return READ, READA, or WRITE 2163 * return READ, READA, or WRITE
@@ -2415,6 +2380,7 @@ extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
2415 unsigned long nr_segs, loff_t pos); 2380 unsigned long nr_segs, loff_t pos);
2416extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, 2381extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
2417 int datasync); 2382 int datasync);
2383extern void block_sync_page(struct page *page);
2418 2384
2419/* fs/splice.c */ 2385/* fs/splice.c */
2420extern ssize_t generic_file_splice_read(struct file *, loff_t *, 2386extern ssize_t generic_file_splice_read(struct file *, loff_t *,
@@ -2530,8 +2496,8 @@ extern void get_filesystem(struct file_system_type *fs);
2530extern void put_filesystem(struct file_system_type *fs); 2496extern void put_filesystem(struct file_system_type *fs);
2531extern struct file_system_type *get_fs_type(const char *name); 2497extern struct file_system_type *get_fs_type(const char *name);
2532extern struct super_block *get_super(struct block_device *); 2498extern struct super_block *get_super(struct block_device *);
2499extern struct super_block *get_super_thawed(struct block_device *);
2533extern struct super_block *get_active_super(struct block_device *bdev); 2500extern struct super_block *get_active_super(struct block_device *bdev);
2534extern struct super_block *user_get_super(dev_t);
2535extern void drop_super(struct super_block *sb); 2501extern void drop_super(struct super_block *sb);
2536extern void iterate_supers(void (*)(struct super_block *, void *), void *); 2502extern void iterate_supers(void (*)(struct super_block *, void *), void *);
2537extern void iterate_supers_type(struct file_system_type *, 2503extern void iterate_supers_type(struct file_system_type *,
@@ -2579,7 +2545,8 @@ extern int generic_check_addressable(unsigned, u64);
2579 2545
2580#ifdef CONFIG_MIGRATION 2546#ifdef CONFIG_MIGRATION
2581extern int buffer_migrate_page(struct address_space *, 2547extern int buffer_migrate_page(struct address_space *,
2582 struct page *, struct page *); 2548 struct page *, struct page *,
2549 enum migrate_mode);
2583#else 2550#else
2584#define buffer_migrate_page NULL 2551#define buffer_migrate_page NULL
2585#endif 2552#endif
@@ -2590,7 +2557,7 @@ extern void setattr_copy(struct inode *inode, const struct iattr *attr);
2590 2557
2591extern void file_update_time(struct file *file); 2558extern void file_update_time(struct file *file);
2592 2559
2593extern int generic_show_options(struct seq_file *m, struct vfsmount *mnt); 2560extern int generic_show_options(struct seq_file *m, struct dentry *root);
2594extern void save_mount_options(struct super_block *sb, char *options); 2561extern void save_mount_options(struct super_block *sb, char *options);
2595extern void replace_mount_options(struct super_block *sb, char *options); 2562extern void replace_mount_options(struct super_block *sb, char *options);
2596 2563
@@ -2691,7 +2658,7 @@ int __init get_filesystem_list(char *buf);
2691#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \ 2658#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \
2692 (flag & __FMODE_NONOTIFY))) 2659 (flag & __FMODE_NONOTIFY)))
2693 2660
2694static inline int is_sxid(mode_t mode) 2661static inline int is_sxid(umode_t mode)
2695{ 2662{
2696 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP)); 2663 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP));
2697} 2664}
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 26eafcef75be..028e26f0bf08 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -133,6 +133,8 @@ struct ftrace_func_command {
133int ftrace_arch_code_modify_prepare(void); 133int ftrace_arch_code_modify_prepare(void);
134int ftrace_arch_code_modify_post_process(void); 134int ftrace_arch_code_modify_post_process(void);
135 135
136void ftrace_bug(int err, unsigned long ip);
137
136struct seq_file; 138struct seq_file;
137 139
138struct ftrace_probe_ops { 140struct ftrace_probe_ops {
@@ -161,7 +163,6 @@ extern int ftrace_text_reserved(void *start, void *end);
161 163
162enum { 164enum {
163 FTRACE_FL_ENABLED = (1 << 30), 165 FTRACE_FL_ENABLED = (1 << 30),
164 FTRACE_FL_FREE = (1 << 31),
165}; 166};
166 167
167#define FTRACE_FL_MASK (0x3UL << 30) 168#define FTRACE_FL_MASK (0x3UL << 30)
@@ -172,10 +173,7 @@ struct dyn_ftrace {
172 unsigned long ip; /* address of mcount call-site */ 173 unsigned long ip; /* address of mcount call-site */
173 struct dyn_ftrace *freelist; 174 struct dyn_ftrace *freelist;
174 }; 175 };
175 union { 176 unsigned long flags;
176 unsigned long flags;
177 struct dyn_ftrace *newlist;
178 };
179 struct dyn_arch_ftrace arch; 177 struct dyn_arch_ftrace arch;
180}; 178};
181 179
@@ -190,6 +188,56 @@ void ftrace_set_global_notrace(unsigned char *buf, int len, int reset);
190int register_ftrace_command(struct ftrace_func_command *cmd); 188int register_ftrace_command(struct ftrace_func_command *cmd);
191int unregister_ftrace_command(struct ftrace_func_command *cmd); 189int unregister_ftrace_command(struct ftrace_func_command *cmd);
192 190
191enum {
192 FTRACE_UPDATE_CALLS = (1 << 0),
193 FTRACE_DISABLE_CALLS = (1 << 1),
194 FTRACE_UPDATE_TRACE_FUNC = (1 << 2),
195 FTRACE_START_FUNC_RET = (1 << 3),
196 FTRACE_STOP_FUNC_RET = (1 << 4),
197};
198
199enum {
200 FTRACE_UPDATE_IGNORE,
201 FTRACE_UPDATE_MAKE_CALL,
202 FTRACE_UPDATE_MAKE_NOP,
203};
204
205enum {
206 FTRACE_ITER_FILTER = (1 << 0),
207 FTRACE_ITER_NOTRACE = (1 << 1),
208 FTRACE_ITER_PRINTALL = (1 << 2),
209 FTRACE_ITER_DO_HASH = (1 << 3),
210 FTRACE_ITER_HASH = (1 << 4),
211 FTRACE_ITER_ENABLED = (1 << 5),
212};
213
214void arch_ftrace_update_code(int command);
215
216struct ftrace_rec_iter;
217
218struct ftrace_rec_iter *ftrace_rec_iter_start(void);
219struct ftrace_rec_iter *ftrace_rec_iter_next(struct ftrace_rec_iter *iter);
220struct dyn_ftrace *ftrace_rec_iter_record(struct ftrace_rec_iter *iter);
221
222int ftrace_update_record(struct dyn_ftrace *rec, int enable);
223int ftrace_test_record(struct dyn_ftrace *rec, int enable);
224void ftrace_run_stop_machine(int command);
225int ftrace_location(unsigned long ip);
226
227extern ftrace_func_t ftrace_trace_function;
228
229int ftrace_regex_open(struct ftrace_ops *ops, int flag,
230 struct inode *inode, struct file *file);
231ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf,
232 size_t cnt, loff_t *ppos);
233ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
234 size_t cnt, loff_t *ppos);
235loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int origin);
236int ftrace_regex_release(struct inode *inode, struct file *file);
237
238void __init
239ftrace_set_early_filter(struct ftrace_ops *ops, char *buf, int enable);
240
193/* defined in arch */ 241/* defined in arch */
194extern int ftrace_ip_converted(unsigned long ip); 242extern int ftrace_ip_converted(unsigned long ip);
195extern int ftrace_dyn_arch_init(void *data); 243extern int ftrace_dyn_arch_init(void *data);
@@ -284,6 +332,25 @@ static inline int ftrace_text_reserved(void *start, void *end)
284{ 332{
285 return 0; 333 return 0;
286} 334}
335
336/*
337 * Again users of functions that have ftrace_ops may not
338 * have them defined when ftrace is not enabled, but these
339 * functions may still be called. Use a macro instead of inline.
340 */
341#define ftrace_regex_open(ops, flag, inod, file) ({ -ENODEV; })
342#define ftrace_set_early_filter(ops, buf, enable) do { } while (0)
343
344static inline ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf,
345 size_t cnt, loff_t *ppos) { return -ENODEV; }
346static inline ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
347 size_t cnt, loff_t *ppos) { return -ENODEV; }
348static inline loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int origin)
349{
350 return -ENODEV;
351}
352static inline int
353ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; }
287#endif /* CONFIG_DYNAMIC_FTRACE */ 354#endif /* CONFIG_DYNAMIC_FTRACE */
288 355
289/* totally disable ftrace - can not re-enable after this */ 356/* totally disable ftrace - can not re-enable after this */
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 464cff526860..8ba2c9460b28 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -50,6 +50,10 @@
50 * 50 *
51 * 7.17 51 * 7.17
52 * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK 52 * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK
53 *
54 * 7.18
55 * - add FUSE_IOCTL_DIR flag
56 * - add FUSE_NOTIFY_DELETE
53 */ 57 */
54 58
55#ifndef _LINUX_FUSE_H 59#ifndef _LINUX_FUSE_H
@@ -81,7 +85,7 @@
81#define FUSE_KERNEL_VERSION 7 85#define FUSE_KERNEL_VERSION 7
82 86
83/** Minor version number of this interface */ 87/** Minor version number of this interface */
84#define FUSE_KERNEL_MINOR_VERSION 17 88#define FUSE_KERNEL_MINOR_VERSION 18
85 89
86/** The node ID of the root inode */ 90/** The node ID of the root inode */
87#define FUSE_ROOT_ID 1 91#define FUSE_ROOT_ID 1
@@ -214,6 +218,7 @@ struct fuse_file_lock {
214 * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed 218 * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
215 * FUSE_IOCTL_RETRY: retry with new iovecs 219 * FUSE_IOCTL_RETRY: retry with new iovecs
216 * FUSE_IOCTL_32BIT: 32bit ioctl 220 * FUSE_IOCTL_32BIT: 32bit ioctl
221 * FUSE_IOCTL_DIR: is a directory
217 * 222 *
218 * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs 223 * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
219 */ 224 */
@@ -221,6 +226,7 @@ struct fuse_file_lock {
221#define FUSE_IOCTL_UNRESTRICTED (1 << 1) 226#define FUSE_IOCTL_UNRESTRICTED (1 << 1)
222#define FUSE_IOCTL_RETRY (1 << 2) 227#define FUSE_IOCTL_RETRY (1 << 2)
223#define FUSE_IOCTL_32BIT (1 << 3) 228#define FUSE_IOCTL_32BIT (1 << 3)
229#define FUSE_IOCTL_DIR (1 << 4)
224 230
225#define FUSE_IOCTL_MAX_IOV 256 231#define FUSE_IOCTL_MAX_IOV 256
226 232
@@ -283,6 +289,7 @@ enum fuse_notify_code {
283 FUSE_NOTIFY_INVAL_ENTRY = 3, 289 FUSE_NOTIFY_INVAL_ENTRY = 3,
284 FUSE_NOTIFY_STORE = 4, 290 FUSE_NOTIFY_STORE = 4,
285 FUSE_NOTIFY_RETRIEVE = 5, 291 FUSE_NOTIFY_RETRIEVE = 5,
292 FUSE_NOTIFY_DELETE = 6,
286 FUSE_NOTIFY_CODE_MAX, 293 FUSE_NOTIFY_CODE_MAX,
287}; 294};
288 295
@@ -606,6 +613,13 @@ struct fuse_notify_inval_entry_out {
606 __u32 padding; 613 __u32 padding;
607}; 614};
608 615
616struct fuse_notify_delete_out {
617 __u64 parent;
618 __u64 child;
619 __u32 namelen;
620 __u32 padding;
621};
622
609struct fuse_notify_store_out { 623struct fuse_notify_store_out {
610 __u64 nodeid; 624 __u64 nodeid;
611 __u64 offset; 625 __u64 offset;
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index 61549b26ad6f..73c28dea10ae 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -85,6 +85,30 @@ enum {
85/* All generic netlink requests are serialized by a global lock. */ 85/* All generic netlink requests are serialized by a global lock. */
86extern void genl_lock(void); 86extern void genl_lock(void);
87extern void genl_unlock(void); 87extern void genl_unlock(void);
88#ifdef CONFIG_PROVE_LOCKING
89extern int lockdep_genl_is_held(void);
90#endif
91
92/**
93 * rcu_dereference_genl - rcu_dereference with debug checking
94 * @p: The pointer to read, prior to dereferencing
95 *
96 * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
97 * or genl mutex. Note : Please prefer genl_dereference() or rcu_dereference()
98 */
99#define rcu_dereference_genl(p) \
100 rcu_dereference_check(p, lockdep_genl_is_held())
101
102/**
103 * genl_dereference - fetch RCU pointer when updates are prevented by genl mutex
104 * @p: The pointer to read, prior to dereferencing
105 *
106 * Return the value of the specified RCU-protected pointer, but omit
107 * both the smp_read_barrier_depends() and the ACCESS_ONCE(), because
108 * caller holds genl mutex.
109 */
110#define genl_dereference(p) \
111 rcu_dereference_protected(p, lockdep_genl_is_held())
88 112
89#endif /* __KERNEL__ */ 113#endif /* __KERNEL__ */
90 114
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 6d18f3531f18..e61d3192448e 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -163,7 +163,7 @@ struct gendisk {
163 * disks that can't be partitioned. */ 163 * disks that can't be partitioned. */
164 164
165 char disk_name[DISK_NAME_LEN]; /* name of major driver */ 165 char disk_name[DISK_NAME_LEN]; /* name of major driver */
166 char *(*devnode)(struct gendisk *gd, mode_t *mode); 166 char *(*devnode)(struct gendisk *gd, umode_t *mode);
167 167
168 unsigned int events; /* supported events */ 168 unsigned int events; /* supported events */
169 unsigned int async_events; /* async events, subset of all */ 169 unsigned int async_events; /* async events, subset of all */
@@ -596,6 +596,7 @@ extern char *disk_name (struct gendisk *hd, int partno, char *buf);
596 596
597extern int disk_expand_part_tbl(struct gendisk *disk, int target); 597extern int disk_expand_part_tbl(struct gendisk *disk, int target);
598extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); 598extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
599extern int invalidate_partitions(struct gendisk *disk, struct block_device *bdev);
599extern struct hd_struct * __must_check add_partition(struct gendisk *disk, 600extern struct hd_struct * __must_check add_partition(struct gendisk *disk,
600 int partno, sector_t start, 601 int partno, sector_t start,
601 sector_t len, int flags, 602 sector_t len, int flags,
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 3a76faf6a3ee..581e74b7df95 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -36,6 +36,7 @@ struct vm_area_struct;
36#endif 36#endif
37#define ___GFP_NO_KSWAPD 0x400000u 37#define ___GFP_NO_KSWAPD 0x400000u
38#define ___GFP_OTHER_NODE 0x800000u 38#define ___GFP_OTHER_NODE 0x800000u
39#define ___GFP_WRITE 0x1000000u
39 40
40/* 41/*
41 * GFP bitmasks.. 42 * GFP bitmasks..
@@ -85,6 +86,7 @@ struct vm_area_struct;
85 86
86#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD) 87#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD)
87#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */ 88#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */
89#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */
88 90
89/* 91/*
90 * This may seem redundant, but it's a way of annotating false positives vs. 92 * This may seem redundant, but it's a way of annotating false positives vs.
@@ -92,7 +94,7 @@ struct vm_area_struct;
92 */ 94 */
93#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK) 95#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK)
94 96
95#define __GFP_BITS_SHIFT 24 /* Room for N __GFP_FOO bits */ 97#define __GFP_BITS_SHIFT 25 /* Room for N __GFP_FOO bits */
96#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) 98#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
97 99
98/* This equals 0, but use constants in case they ever change */ 100/* This equals 0, but use constants in case they ever change */
@@ -313,7 +315,7 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
313static inline struct page *alloc_pages_exact_node(int nid, gfp_t gfp_mask, 315static inline struct page *alloc_pages_exact_node(int nid, gfp_t gfp_mask,
314 unsigned int order) 316 unsigned int order)
315{ 317{
316 VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES); 318 VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES || !node_online(nid));
317 319
318 return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); 320 return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask));
319} 321}
@@ -358,6 +360,7 @@ void *alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask);
358extern void __free_pages(struct page *page, unsigned int order); 360extern void __free_pages(struct page *page, unsigned int order);
359extern void free_pages(unsigned long addr, unsigned int order); 361extern void free_pages(unsigned long addr, unsigned int order);
360extern void free_hot_cold_page(struct page *page, int cold); 362extern void free_hot_cold_page(struct page *page, int cold);
363extern void free_hot_cold_page_list(struct list_head *list, int cold);
361 364
362#define __free_page(page) __free_pages((page), 0) 365#define __free_page(page) __free_pages((page), 0)
363#define free_page(addr) free_pages((addr), 0) 366#define free_page(addr) free_pages((addr), 0)
@@ -367,9 +370,25 @@ void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp);
367void drain_all_pages(void); 370void drain_all_pages(void);
368void drain_local_pages(void *dummy); 371void drain_local_pages(void *dummy);
369 372
373/*
374 * gfp_allowed_mask is set to GFP_BOOT_MASK during early boot to restrict what
375 * GFP flags are used before interrupts are enabled. Once interrupts are
376 * enabled, it is set to __GFP_BITS_MASK while the system is running. During
377 * hibernation, it is used by PM to avoid I/O during memory allocation while
378 * devices are suspended.
379 */
370extern gfp_t gfp_allowed_mask; 380extern gfp_t gfp_allowed_mask;
371 381
372extern void pm_restrict_gfp_mask(void); 382extern void pm_restrict_gfp_mask(void);
373extern void pm_restore_gfp_mask(void); 383extern void pm_restore_gfp_mask(void);
374 384
385#ifdef CONFIG_PM_SLEEP
386extern bool pm_suspended_storage(void);
387#else
388static inline bool pm_suspended_storage(void)
389{
390 return false;
391}
392#endif /* CONFIG_PM_SLEEP */
393
375#endif /* __LINUX_GFP_H */ 394#endif /* __LINUX_GFP_H */
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h
index 4f4462974c14..b148087f49a6 100644
--- a/include/linux/gfs2_ondisk.h
+++ b/include/linux/gfs2_ondisk.h
@@ -22,6 +22,8 @@
22#define GFS2_LIVE_LOCK 1 22#define GFS2_LIVE_LOCK 1
23#define GFS2_TRANS_LOCK 2 23#define GFS2_TRANS_LOCK 2
24#define GFS2_RENAME_LOCK 3 24#define GFS2_RENAME_LOCK 3
25#define GFS2_CONTROL_LOCK 4
26#define GFS2_MOUNTED_LOCK 5
25 27
26/* Format numbers for various metadata types */ 28/* Format numbers for various metadata types */
27 29
diff --git a/include/linux/gpio-pxa.h b/include/linux/gpio-pxa.h
new file mode 100644
index 000000000000..05071ee34c3f
--- /dev/null
+++ b/include/linux/gpio-pxa.h
@@ -0,0 +1,16 @@
1#ifndef __GPIO_PXA_H
2#define __GPIO_PXA_H
3
4#define GPIO_bit(x) (1 << ((x) & 0x1f))
5
6#define gpio_to_bank(gpio) ((gpio) >> 5)
7
8/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
9 * Those cases currently cause holes in the GPIO number space, the
10 * actual number of the last GPIO is recorded by 'pxa_last_gpio'.
11 */
12extern int pxa_last_gpio;
13
14extern int pxa_irq_to_gpio(int irq);
15
16#endif /* __GPIO_PXA_H */
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index b5ca4b2c08ec..004ff33ab38e 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -1,6 +1,8 @@
1#ifndef _GPIO_KEYS_H 1#ifndef _GPIO_KEYS_H
2#define _GPIO_KEYS_H 2#define _GPIO_KEYS_H
3 3
4struct device;
5
4struct gpio_keys_button { 6struct gpio_keys_button {
5 /* Configuration parameters */ 7 /* Configuration parameters */
6 unsigned int code; /* input event code (KEY_*, SW_*) */ 8 unsigned int code; /* input event code (KEY_*, SW_*) */
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index f743883f769e..bb7f30971858 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -139,20 +139,7 @@ static inline void account_system_vtime(struct task_struct *tsk)
139extern void account_system_vtime(struct task_struct *tsk); 139extern void account_system_vtime(struct task_struct *tsk);
140#endif 140#endif
141 141
142#if defined(CONFIG_NO_HZ)
143#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU) 142#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU)
144extern void rcu_enter_nohz(void);
145extern void rcu_exit_nohz(void);
146
147static inline void rcu_irq_enter(void)
148{
149 rcu_exit_nohz();
150}
151
152static inline void rcu_irq_exit(void)
153{
154 rcu_enter_nohz();
155}
156 143
157static inline void rcu_nmi_enter(void) 144static inline void rcu_nmi_enter(void)
158{ 145{
@@ -163,17 +150,9 @@ static inline void rcu_nmi_exit(void)
163} 150}
164 151
165#else 152#else
166extern void rcu_irq_enter(void);
167extern void rcu_irq_exit(void);
168extern void rcu_nmi_enter(void); 153extern void rcu_nmi_enter(void);
169extern void rcu_nmi_exit(void); 154extern void rcu_nmi_exit(void);
170#endif 155#endif
171#else
172# define rcu_irq_enter() do { } while (0)
173# define rcu_irq_exit() do { } while (0)
174# define rcu_nmi_enter() do { } while (0)
175# define rcu_nmi_exit() do { } while (0)
176#endif /* #if defined(CONFIG_NO_HZ) */
177 156
178/* 157/*
179 * It is safe to do non-atomic ops on ->hardirq_context, 158 * It is safe to do non-atomic ops on ->hardirq_context,
diff --git a/include/linux/hid.h b/include/linux/hid.h
index c235e4e8767c..3a95da60fd3e 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -72,6 +72,7 @@
72#include <linux/workqueue.h> 72#include <linux/workqueue.h>
73#include <linux/input.h> 73#include <linux/input.h>
74#include <linux/semaphore.h> 74#include <linux/semaphore.h>
75#include <linux/power_supply.h>
75 76
76/* 77/*
77 * We parse each description item into this structure. Short items data 78 * We parse each description item into this structure. Short items data
@@ -190,6 +191,7 @@ struct hid_item {
190#define HID_UP_UNDEFINED 0x00000000 191#define HID_UP_UNDEFINED 0x00000000
191#define HID_UP_GENDESK 0x00010000 192#define HID_UP_GENDESK 0x00010000
192#define HID_UP_SIMULATION 0x00020000 193#define HID_UP_SIMULATION 0x00020000
194#define HID_UP_GENDEVCTRLS 0x00060000
193#define HID_UP_KEYBOARD 0x00070000 195#define HID_UP_KEYBOARD 0x00070000
194#define HID_UP_LED 0x00080000 196#define HID_UP_LED 0x00080000
195#define HID_UP_BUTTON 0x00090000 197#define HID_UP_BUTTON 0x00090000
@@ -239,6 +241,8 @@ struct hid_item {
239#define HID_GD_RIGHT 0x00010092 241#define HID_GD_RIGHT 0x00010092
240#define HID_GD_LEFT 0x00010093 242#define HID_GD_LEFT 0x00010093
241 243
244#define HID_DC_BATTERYSTRENGTH 0x00060020
245
242#define HID_DG_DIGITIZER 0x000d0001 246#define HID_DG_DIGITIZER 0x000d0001
243#define HID_DG_PEN 0x000d0002 247#define HID_DG_PEN 0x000d0002
244#define HID_DG_LIGHTPEN 0x000d0003 248#define HID_DG_LIGHTPEN 0x000d0003
@@ -482,6 +486,19 @@ struct hid_device { /* device report descriptor */
482 struct hid_driver *driver; 486 struct hid_driver *driver;
483 struct hid_ll_driver *ll_driver; 487 struct hid_ll_driver *ll_driver;
484 488
489#ifdef CONFIG_HID_BATTERY_STRENGTH
490 /*
491 * Power supply information for HID devices which report
492 * battery strength. power_supply is registered iff
493 * battery.name is non-NULL.
494 */
495 struct power_supply battery;
496 __s32 battery_min;
497 __s32 battery_max;
498 __s32 battery_report_type;
499 __s32 battery_report_id;
500#endif
501
485 unsigned int status; /* see STAT flags above */ 502 unsigned int status; /* see STAT flags above */
486 unsigned claimed; /* Claimed by hidinput, hiddev? */ 503 unsigned claimed; /* Claimed by hidinput, hiddev? */
487 unsigned quirks; /* Various quirks the device can pull on us */ 504 unsigned quirks; /* Various quirks the device can pull on us */
@@ -712,6 +729,8 @@ extern void hidinput_disconnect(struct hid_device *);
712int hid_set_field(struct hid_field *, unsigned, __s32); 729int hid_set_field(struct hid_field *, unsigned, __s32);
713int hid_input_report(struct hid_device *, int type, u8 *, int, int); 730int hid_input_report(struct hid_device *, int type, u8 *, int, int);
714int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); 731int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
732struct hid_field *hidinput_get_led_field(struct hid_device *hid);
733unsigned int hidinput_count_leds(struct hid_device *hid);
715void hid_output_report(struct hid_report *report, __u8 *data); 734void hid_output_report(struct hid_report *report, __u8 *data);
716struct hid_device *hid_allocate_device(void); 735struct hid_device *hid_allocate_device(void);
717struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); 736struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
@@ -719,6 +738,8 @@ int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
719int hid_check_keys_pressed(struct hid_device *hid); 738int hid_check_keys_pressed(struct hid_device *hid);
720int hid_connect(struct hid_device *hid, unsigned int connect_mask); 739int hid_connect(struct hid_device *hid, unsigned int connect_mask);
721void hid_disconnect(struct hid_device *hid); 740void hid_disconnect(struct hid_device *hid);
741const struct hid_device_id *hid_match_id(struct hid_device *hdev,
742 const struct hid_device_id *id);
722 743
723/** 744/**
724 * hid_map_usage - map usage input bits 745 * hid_map_usage - map usage input bits
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index a9ace9c32507..1b921299abc4 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -18,7 +18,7 @@ extern struct page *follow_trans_huge_pmd(struct mm_struct *mm,
18 unsigned int flags); 18 unsigned int flags);
19extern int zap_huge_pmd(struct mmu_gather *tlb, 19extern int zap_huge_pmd(struct mmu_gather *tlb,
20 struct vm_area_struct *vma, 20 struct vm_area_struct *vma,
21 pmd_t *pmd); 21 pmd_t *pmd, unsigned long addr);
22extern int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, 22extern int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
23 unsigned long addr, unsigned long end, 23 unsigned long addr, unsigned long end,
24 unsigned char *vec); 24 unsigned char *vec);
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 12ec328481de..0ae065a5fcb2 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -35,7 +35,7 @@
35#include <linux/mod_devicetable.h> 35#include <linux/mod_devicetable.h>
36 36
37 37
38#define MAX_PAGE_BUFFER_COUNT 16 38#define MAX_PAGE_BUFFER_COUNT 19
39#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */ 39#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
40 40
41#pragma pack(push, 1) 41#pragma pack(push, 1)
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 07d103a06d64..8e25a9167f13 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -482,6 +482,19 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap)
482{ 482{
483 return adap->nr; 483 return adap->nr;
484} 484}
485
486/**
487 * module_i2c_driver() - Helper macro for registering a I2C driver
488 * @__i2c_driver: i2c_driver struct
489 *
490 * Helper macro for I2C drivers which do not do anything special in module
491 * init/exit. This eliminates a lot of boilerplate. Each module may only
492 * use this macro once, and calling it replaces module_init() and module_exit()
493 */
494#define module_i2c_driver(__i2c_driver) \
495 module_driver(__i2c_driver, i2c_add_driver, \
496 i2c_del_driver)
497
485#endif /* I2C */ 498#endif /* I2C */
486#endif /* __KERNEL__ */ 499#endif /* __KERNEL__ */
487 500
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 114c0f6fc63d..78d3465251d6 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -652,10 +652,12 @@ struct twl4030_power_data {
652 unsigned num; 652 unsigned num;
653 struct twl4030_resconfig *resource_config; 653 struct twl4030_resconfig *resource_config;
654#define TWL4030_RESCONFIG_UNDEF ((u8)-1) 654#define TWL4030_RESCONFIG_UNDEF ((u8)-1)
655 bool use_poweroff; /* Board is wired for TWL poweroff */
655}; 656};
656 657
657extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts); 658extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
658extern int twl4030_remove_script(u8 flags); 659extern int twl4030_remove_script(u8 flags);
660extern void twl4030_power_off(void);
659 661
660struct twl4030_codec_data { 662struct twl4030_codec_data {
661 unsigned int digimic_delay; /* in ms */ 663 unsigned int digimic_delay; /* in ms */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 42557851b12e..501370b61ee5 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -920,7 +920,7 @@ __IDE_PROC_DEVSET(_name, _min, _max, NULL, NULL)
920 920
921typedef struct { 921typedef struct {
922 const char *name; 922 const char *name;
923 mode_t mode; 923 umode_t mode;
924 const struct file_operations *proc_fops; 924 const struct file_operations *proc_fops;
925} ide_proc_entry_t; 925} ide_proc_entry_t;
926 926
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 48363c3c40f8..210e2c325534 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -128,6 +128,7 @@
128#define IEEE80211_QOS_CTL_ACK_POLICY_NOACK 0x0020 128#define IEEE80211_QOS_CTL_ACK_POLICY_NOACK 0x0020
129#define IEEE80211_QOS_CTL_ACK_POLICY_NO_EXPL 0x0040 129#define IEEE80211_QOS_CTL_ACK_POLICY_NO_EXPL 0x0040
130#define IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK 0x0060 130#define IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK 0x0060
131#define IEEE80211_QOS_CTL_ACK_POLICY_MASK 0x0060
131/* A-MSDU 802.11n */ 132/* A-MSDU 802.11n */
132#define IEEE80211_QOS_CTL_A_MSDU_PRESENT 0x0080 133#define IEEE80211_QOS_CTL_A_MSDU_PRESENT 0x0080
133/* Mesh Control 802.11s */ 134/* Mesh Control 802.11s */
@@ -543,6 +544,15 @@ static inline int ieee80211_is_qos_nullfunc(__le16 fc)
543 cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC); 544 cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC);
544} 545}
545 546
547/**
548 * ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set
549 * @seq_ctrl: frame sequence control bytes in little-endian byteorder
550 */
551static inline int ieee80211_is_first_frag(__le16 seq_ctrl)
552{
553 return (seq_ctrl & cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0;
554}
555
546struct ieee80211s_hdr { 556struct ieee80211s_hdr {
547 u8 flags; 557 u8 flags;
548 u8 ttl; 558 u8 ttl;
@@ -770,6 +780,9 @@ struct ieee80211_mgmt {
770 } u; 780 } u;
771} __attribute__ ((packed)); 781} __attribute__ ((packed));
772 782
783/* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
784#define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
785
773/* mgmt header + 1 byte category code */ 786/* mgmt header + 1 byte category code */
774#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u) 787#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
775 788
@@ -1552,6 +1565,8 @@ enum ieee80211_sa_query_action {
1552#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05 1565#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
1553#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06 1566#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06
1554 1567
1568#define WLAN_CIPHER_SUITE_SMS4 0x00147201
1569
1555/* AKM suite selectors */ 1570/* AKM suite selectors */
1556#define WLAN_AKM_SUITE_8021X 0x000FAC01 1571#define WLAN_AKM_SUITE_8021X 0x000FAC01
1557#define WLAN_AKM_SUITE_PSK 0x000FAC02 1572#define WLAN_AKM_SUITE_PSK 0x000FAC02
@@ -1689,6 +1704,23 @@ static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
1689} 1704}
1690 1705
1691/** 1706/**
1707 * ieee80211_is_public_action - check if frame is a public action frame
1708 * @hdr: the frame
1709 * @len: length of the frame
1710 */
1711static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr,
1712 size_t len)
1713{
1714 struct ieee80211_mgmt *mgmt = (void *)hdr;
1715
1716 if (len < IEEE80211_MIN_ACTION_SIZE)
1717 return false;
1718 if (!ieee80211_is_action(hdr->frame_control))
1719 return false;
1720 return mgmt->u.action.category == WLAN_CATEGORY_PUBLIC;
1721}
1722
1723/**
1692 * ieee80211_fhss_chan_to_freq - get channel frequency 1724 * ieee80211_fhss_chan_to_freq - get channel frequency
1693 * @channel: the FHSS channel 1725 * @channel: the FHSS channel
1694 * 1726 *
diff --git a/include/linux/if.h b/include/linux/if.h
index db20bd4fd16b..06b6ef60c821 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -79,6 +79,7 @@
79#define IFF_TX_SKB_SHARING 0x10000 /* The interface supports sharing 79#define IFF_TX_SKB_SHARING 0x10000 /* The interface supports sharing
80 * skbs on transmit */ 80 * skbs on transmit */
81#define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */ 81#define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */
82#define IFF_TEAM_PORT 0x40000 /* device used as team port */
82 83
83#define IF_GET_IFACE 0x0001 /* for querying only */ 84#define IF_GET_IFACE 0x0001 /* for querying only */
84#define IF_GET_PROTO 0x0002 85#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index e473003e4bda..56d907a2c804 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -79,6 +79,7 @@
79#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ 79#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
80#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ 80#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */
81#define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */ 81#define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */
82#define ETH_P_802_EX1 0x88B5 /* 802.1 Local Experimental 1. */
82#define ETH_P_TIPC 0x88CA /* TIPC */ 83#define ETH_P_TIPC 0x88CA /* TIPC */
83#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */ 84#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */
84#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */ 85#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index c52d4b5f872a..4b24ff453aee 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -137,6 +137,7 @@ enum {
137 IFLA_AF_SPEC, 137 IFLA_AF_SPEC,
138 IFLA_GROUP, /* Group the device belongs to */ 138 IFLA_GROUP, /* Group the device belongs to */
139 IFLA_NET_NS_FD, 139 IFLA_NET_NS_FD,
140 IFLA_EXT_MASK, /* Extended info mask, VFs, etc */
140 __IFLA_MAX 141 __IFLA_MAX
141}; 142};
142 143
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
new file mode 100644
index 000000000000..58404b0c5010
--- /dev/null
+++ b/include/linux/if_team.h
@@ -0,0 +1,252 @@
1/*
2 * include/linux/if_team.h - Network team device driver header
3 * Copyright (c) 2011 Jiri Pirko <jpirko@redhat.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 */
10
11#ifndef _LINUX_IF_TEAM_H_
12#define _LINUX_IF_TEAM_H_
13
14#ifdef __KERNEL__
15
16struct team_pcpu_stats {
17 u64 rx_packets;
18 u64 rx_bytes;
19 u64 rx_multicast;
20 u64 tx_packets;
21 u64 tx_bytes;
22 struct u64_stats_sync syncp;
23 u32 rx_dropped;
24 u32 tx_dropped;
25};
26
27struct team;
28
29struct team_port {
30 struct net_device *dev;
31 struct hlist_node hlist; /* node in hash list */
32 struct list_head list; /* node in ordinary list */
33 struct team *team;
34 int index;
35
36 /*
37 * A place for storing original values of the device before it
38 * become a port.
39 */
40 struct {
41 unsigned char dev_addr[MAX_ADDR_LEN];
42 unsigned int mtu;
43 } orig;
44
45 bool linkup;
46 u32 speed;
47 u8 duplex;
48
49 /* Custom gennetlink interface related flags */
50 bool changed;
51 bool removed;
52
53 struct rcu_head rcu;
54};
55
56struct team_mode_ops {
57 int (*init)(struct team *team);
58 void (*exit)(struct team *team);
59 rx_handler_result_t (*receive)(struct team *team,
60 struct team_port *port,
61 struct sk_buff *skb);
62 bool (*transmit)(struct team *team, struct sk_buff *skb);
63 int (*port_enter)(struct team *team, struct team_port *port);
64 void (*port_leave)(struct team *team, struct team_port *port);
65 void (*port_change_mac)(struct team *team, struct team_port *port);
66};
67
68enum team_option_type {
69 TEAM_OPTION_TYPE_U32,
70 TEAM_OPTION_TYPE_STRING,
71};
72
73struct team_option {
74 struct list_head list;
75 const char *name;
76 enum team_option_type type;
77 int (*getter)(struct team *team, void *arg);
78 int (*setter)(struct team *team, void *arg);
79
80 /* Custom gennetlink interface related flags */
81 bool changed;
82 bool removed;
83};
84
85struct team_mode {
86 struct list_head list;
87 const char *kind;
88 struct module *owner;
89 size_t priv_size;
90 const struct team_mode_ops *ops;
91};
92
93#define TEAM_PORT_HASHBITS 4
94#define TEAM_PORT_HASHENTRIES (1 << TEAM_PORT_HASHBITS)
95
96#define TEAM_MODE_PRIV_LONGS 4
97#define TEAM_MODE_PRIV_SIZE (sizeof(long) * TEAM_MODE_PRIV_LONGS)
98
99struct team {
100 struct net_device *dev; /* associated netdevice */
101 struct team_pcpu_stats __percpu *pcpu_stats;
102
103 struct mutex lock; /* used for overall locking, e.g. port lists write */
104
105 /*
106 * port lists with port count
107 */
108 int port_count;
109 struct hlist_head port_hlist[TEAM_PORT_HASHENTRIES];
110 struct list_head port_list;
111
112 struct list_head option_list;
113
114 const struct team_mode *mode;
115 struct team_mode_ops ops;
116 long mode_priv[TEAM_MODE_PRIV_LONGS];
117};
118
119static inline struct hlist_head *team_port_index_hash(struct team *team,
120 int port_index)
121{
122 return &team->port_hlist[port_index & (TEAM_PORT_HASHENTRIES - 1)];
123}
124
125static inline struct team_port *team_get_port_by_index(struct team *team,
126 int port_index)
127{
128 struct hlist_node *p;
129 struct team_port *port;
130 struct hlist_head *head = team_port_index_hash(team, port_index);
131
132 hlist_for_each_entry(port, p, head, hlist)
133 if (port->index == port_index)
134 return port;
135 return NULL;
136}
137static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
138 int port_index)
139{
140 struct hlist_node *p;
141 struct team_port *port;
142 struct hlist_head *head = team_port_index_hash(team, port_index);
143
144 hlist_for_each_entry_rcu(port, p, head, hlist)
145 if (port->index == port_index)
146 return port;
147 return NULL;
148}
149
150extern int team_port_set_team_mac(struct team_port *port);
151extern int team_options_register(struct team *team,
152 const struct team_option *option,
153 size_t option_count);
154extern void team_options_unregister(struct team *team,
155 const struct team_option *option,
156 size_t option_count);
157extern int team_mode_register(struct team_mode *mode);
158extern int team_mode_unregister(struct team_mode *mode);
159
160#endif /* __KERNEL__ */
161
162#define TEAM_STRING_MAX_LEN 32
163
164/**********************************
165 * NETLINK_GENERIC netlink family.
166 **********************************/
167
168enum {
169 TEAM_CMD_NOOP,
170 TEAM_CMD_OPTIONS_SET,
171 TEAM_CMD_OPTIONS_GET,
172 TEAM_CMD_PORT_LIST_GET,
173
174 __TEAM_CMD_MAX,
175 TEAM_CMD_MAX = (__TEAM_CMD_MAX - 1),
176};
177
178enum {
179 TEAM_ATTR_UNSPEC,
180 TEAM_ATTR_TEAM_IFINDEX, /* u32 */
181 TEAM_ATTR_LIST_OPTION, /* nest */
182 TEAM_ATTR_LIST_PORT, /* nest */
183
184 __TEAM_ATTR_MAX,
185 TEAM_ATTR_MAX = __TEAM_ATTR_MAX - 1,
186};
187
188/* Nested layout of get/set msg:
189 *
190 * [TEAM_ATTR_LIST_OPTION]
191 * [TEAM_ATTR_ITEM_OPTION]
192 * [TEAM_ATTR_OPTION_*], ...
193 * [TEAM_ATTR_ITEM_OPTION]
194 * [TEAM_ATTR_OPTION_*], ...
195 * ...
196 * [TEAM_ATTR_LIST_PORT]
197 * [TEAM_ATTR_ITEM_PORT]
198 * [TEAM_ATTR_PORT_*], ...
199 * [TEAM_ATTR_ITEM_PORT]
200 * [TEAM_ATTR_PORT_*], ...
201 * ...
202 */
203
204enum {
205 TEAM_ATTR_ITEM_OPTION_UNSPEC,
206 TEAM_ATTR_ITEM_OPTION, /* nest */
207
208 __TEAM_ATTR_ITEM_OPTION_MAX,
209 TEAM_ATTR_ITEM_OPTION_MAX = __TEAM_ATTR_ITEM_OPTION_MAX - 1,
210};
211
212enum {
213 TEAM_ATTR_OPTION_UNSPEC,
214 TEAM_ATTR_OPTION_NAME, /* string */
215 TEAM_ATTR_OPTION_CHANGED, /* flag */
216 TEAM_ATTR_OPTION_TYPE, /* u8 */
217 TEAM_ATTR_OPTION_DATA, /* dynamic */
218 TEAM_ATTR_OPTION_REMOVED, /* flag */
219
220 __TEAM_ATTR_OPTION_MAX,
221 TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1,
222};
223
224enum {
225 TEAM_ATTR_ITEM_PORT_UNSPEC,
226 TEAM_ATTR_ITEM_PORT, /* nest */
227
228 __TEAM_ATTR_ITEM_PORT_MAX,
229 TEAM_ATTR_ITEM_PORT_MAX = __TEAM_ATTR_ITEM_PORT_MAX - 1,
230};
231
232enum {
233 TEAM_ATTR_PORT_UNSPEC,
234 TEAM_ATTR_PORT_IFINDEX, /* u32 */
235 TEAM_ATTR_PORT_CHANGED, /* flag */
236 TEAM_ATTR_PORT_LINKUP, /* flag */
237 TEAM_ATTR_PORT_SPEED, /* u32 */
238 TEAM_ATTR_PORT_DUPLEX, /* u8 */
239 TEAM_ATTR_PORT_REMOVED, /* flag */
240
241 __TEAM_ATTR_PORT_MAX,
242 TEAM_ATTR_PORT_MAX = __TEAM_ATTR_PORT_MAX - 1,
243};
244
245/*
246 * NETLINK_GENERIC related info
247 */
248#define TEAM_GENL_NAME "team"
249#define TEAM_GENL_VERSION 0x1
250#define TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME "change_event"
251
252#endif /* _LINUX_IF_TEAM_H_ */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 12d5543b14f2..13aff1e2183b 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -74,22 +74,7 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
74/* found in socket.c */ 74/* found in socket.c */
75extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); 75extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
76 76
77/* if this changes, algorithm will have to be reworked because this 77struct vlan_info;
78 * depends on completely exhausting the VLAN identifier space. Thus
79 * it gives constant time look-up, but in many cases it wastes memory.
80 */
81#define VLAN_GROUP_ARRAY_SPLIT_PARTS 8
82#define VLAN_GROUP_ARRAY_PART_LEN (VLAN_N_VID/VLAN_GROUP_ARRAY_SPLIT_PARTS)
83
84struct vlan_group {
85 struct net_device *real_dev; /* The ethernet(like) device
86 * the vlan is attached to.
87 */
88 unsigned int nr_vlans;
89 struct hlist_node hlist; /* linked list */
90 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS];
91 struct rcu_head rcu;
92};
93 78
94static inline int is_vlan_dev(struct net_device *dev) 79static inline int is_vlan_dev(struct net_device *dev)
95{ 80{
@@ -109,6 +94,13 @@ extern u16 vlan_dev_vlan_id(const struct net_device *dev);
109extern bool vlan_do_receive(struct sk_buff **skb, bool last_handler); 94extern bool vlan_do_receive(struct sk_buff **skb, bool last_handler);
110extern struct sk_buff *vlan_untag(struct sk_buff *skb); 95extern struct sk_buff *vlan_untag(struct sk_buff *skb);
111 96
97extern int vlan_vid_add(struct net_device *dev, unsigned short vid);
98extern void vlan_vid_del(struct net_device *dev, unsigned short vid);
99
100extern int vlan_vids_add_by_dev(struct net_device *dev,
101 const struct net_device *by_dev);
102extern void vlan_vids_del_by_dev(struct net_device *dev,
103 const struct net_device *by_dev);
112#else 104#else
113static inline struct net_device * 105static inline struct net_device *
114__vlan_find_dev_deep(struct net_device *real_dev, u16 vlan_id) 106__vlan_find_dev_deep(struct net_device *real_dev, u16 vlan_id)
@@ -139,6 +131,26 @@ static inline struct sk_buff *vlan_untag(struct sk_buff *skb)
139{ 131{
140 return skb; 132 return skb;
141} 133}
134
135static inline int vlan_vid_add(struct net_device *dev, unsigned short vid)
136{
137 return 0;
138}
139
140static inline void vlan_vid_del(struct net_device *dev, unsigned short vid)
141{
142}
143
144static inline int vlan_vids_add_by_dev(struct net_device *dev,
145 const struct net_device *by_dev)
146{
147 return 0;
148}
149
150static inline void vlan_vids_del_by_dev(struct net_device *dev,
151 const struct net_device *by_dev)
152{
153}
142#endif 154#endif
143 155
144/** 156/**
@@ -310,6 +322,40 @@ static inline __be16 vlan_get_protocol(const struct sk_buff *skb)
310 322
311 return protocol; 323 return protocol;
312} 324}
325
326static inline void vlan_set_encap_proto(struct sk_buff *skb,
327 struct vlan_hdr *vhdr)
328{
329 __be16 proto;
330 unsigned char *rawp;
331
332 /*
333 * Was a VLAN packet, grab the encapsulated protocol, which the layer
334 * three protocols care about.
335 */
336
337 proto = vhdr->h_vlan_encapsulated_proto;
338 if (ntohs(proto) >= 1536) {
339 skb->protocol = proto;
340 return;
341 }
342
343 rawp = skb->data;
344 if (*(unsigned short *) rawp == 0xFFFF)
345 /*
346 * This is a magic hack to spot IPX packets. Older Novell
347 * breaks the protocol design and runs IPX over 802.3 without
348 * an 802.2 LLC layer. We look for FFFF which isn't a used
349 * 802.2 SSAP/DSAP. This won't work for fault tolerant netware
350 * but does for the rest.
351 */
352 skb->protocol = htons(ETH_P_802_3);
353 else
354 /*
355 * Real 802.2 LLC
356 */
357 skb->protocol = htons(ETH_P_802_2);
358}
313#endif /* __KERNEL__ */ 359#endif /* __KERNEL__ */
314 360
315/* VLAN IOCTLs are found in sockios.h */ 361/* VLAN IOCTLs are found in sockios.h */
@@ -352,7 +398,7 @@ struct vlan_ioctl_args {
352 unsigned int skb_priority; 398 unsigned int skb_priority;
353 unsigned int name_type; 399 unsigned int name_type;
354 unsigned int bind_type; 400 unsigned int bind_type;
355 unsigned int flag; /* Matches vlan_dev_info flags */ 401 unsigned int flag; /* Matches vlan_dev_priv flags */
356 } u; 402 } u;
357 403
358 short vlan_qos; 404 short vlan_qos;
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index abf5028db981..f1362b5447fc 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -34,6 +34,15 @@ struct inet_diag_req {
34 __u32 idiag_dbs; /* Tables to dump (NI) */ 34 __u32 idiag_dbs; /* Tables to dump (NI) */
35}; 35};
36 36
37struct inet_diag_req_v2 {
38 __u8 sdiag_family;
39 __u8 sdiag_protocol;
40 __u8 idiag_ext;
41 __u8 pad;
42 __u32 idiag_states;
43 struct inet_diag_sockid id;
44};
45
37enum { 46enum {
38 INET_DIAG_REQ_NONE, 47 INET_DIAG_REQ_NONE,
39 INET_DIAG_REQ_BYTECODE, 48 INET_DIAG_REQ_BYTECODE,
@@ -99,9 +108,10 @@ enum {
99 INET_DIAG_CONG, 108 INET_DIAG_CONG,
100 INET_DIAG_TOS, 109 INET_DIAG_TOS,
101 INET_DIAG_TCLASS, 110 INET_DIAG_TCLASS,
111 INET_DIAG_SKMEMINFO,
102}; 112};
103 113
104#define INET_DIAG_MAX INET_DIAG_TCLASS 114#define INET_DIAG_MAX INET_DIAG_SKMEMINFO
105 115
106 116
107/* INET_DIAG_MEM */ 117/* INET_DIAG_MEM */
@@ -125,16 +135,41 @@ struct tcpvegas_info {
125#ifdef __KERNEL__ 135#ifdef __KERNEL__
126struct sock; 136struct sock;
127struct inet_hashinfo; 137struct inet_hashinfo;
138struct nlattr;
139struct nlmsghdr;
140struct sk_buff;
141struct netlink_callback;
128 142
129struct inet_diag_handler { 143struct inet_diag_handler {
130 struct inet_hashinfo *idiag_hashinfo; 144 void (*dump)(struct sk_buff *skb,
145 struct netlink_callback *cb,
146 struct inet_diag_req_v2 *r,
147 struct nlattr *bc);
148
149 int (*dump_one)(struct sk_buff *in_skb,
150 const struct nlmsghdr *nlh,
151 struct inet_diag_req_v2 *req);
152
131 void (*idiag_get_info)(struct sock *sk, 153 void (*idiag_get_info)(struct sock *sk,
132 struct inet_diag_msg *r, 154 struct inet_diag_msg *r,
133 void *info); 155 void *info);
134 __u16 idiag_info_size;
135 __u16 idiag_type; 156 __u16 idiag_type;
136}; 157};
137 158
159struct inet_connection_sock;
160int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
161 struct sk_buff *skb, struct inet_diag_req_v2 *req,
162 u32 pid, u32 seq, u16 nlmsg_flags,
163 const struct nlmsghdr *unlh);
164void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb,
165 struct netlink_callback *cb, struct inet_diag_req_v2 *r,
166 struct nlattr *bc);
167int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
168 struct sk_buff *in_skb, const struct nlmsghdr *nlh,
169 struct inet_diag_req_v2 *req);
170
171int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk);
172
138extern int inet_diag_register(const struct inet_diag_handler *handler); 173extern int inet_diag_register(const struct inet_diag_handler *handler);
139extern void inet_diag_unregister(const struct inet_diag_handler *handler); 174extern void inet_diag_unregister(const struct inet_diag_handler *handler);
140#endif /* __KERNEL__ */ 175#endif /* __KERNEL__ */
diff --git a/include/linux/init.h b/include/linux/init.h
index 9146f39cdddf..6b951095a42f 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -2,6 +2,7 @@
2#define _LINUX_INIT_H 2#define _LINUX_INIT_H
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/types.h>
5 6
6/* These macros are used to mark some functions or 7/* These macros are used to mark some functions or
7 * initialized data (doesn't apply to uninitialized data) 8 * initialized data (doesn't apply to uninitialized data)
@@ -156,7 +157,7 @@ void prepare_namespace(void);
156 157
157extern void (*late_time_init)(void); 158extern void (*late_time_init)(void);
158 159
159extern int initcall_debug; 160extern bool initcall_debug;
160 161
161#endif 162#endif
162 163
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 32574eef9394..9c66b1ada9d7 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -23,11 +23,10 @@ extern struct files_struct init_files;
23extern struct fs_struct init_fs; 23extern struct fs_struct init_fs;
24 24
25#ifdef CONFIG_CGROUPS 25#ifdef CONFIG_CGROUPS
26#define INIT_THREADGROUP_FORK_LOCK(sig) \ 26#define INIT_GROUP_RWSEM(sig) \
27 .threadgroup_fork_lock = \ 27 .group_rwsem = __RWSEM_INITIALIZER(sig.group_rwsem),
28 __RWSEM_INITIALIZER(sig.threadgroup_fork_lock),
29#else 28#else
30#define INIT_THREADGROUP_FORK_LOCK(sig) 29#define INIT_GROUP_RWSEM(sig)
31#endif 30#endif
32 31
33#define INIT_SIGNALS(sig) { \ 32#define INIT_SIGNALS(sig) { \
@@ -46,7 +45,7 @@ extern struct fs_struct init_fs;
46 }, \ 45 }, \
47 .cred_guard_mutex = \ 46 .cred_guard_mutex = \
48 __MUTEX_INITIALIZER(sig.cred_guard_mutex), \ 47 __MUTEX_INITIALIZER(sig.cred_guard_mutex), \
49 INIT_THREADGROUP_FORK_LOCK(sig) \ 48 INIT_GROUP_RWSEM(sig) \
50} 49}
51 50
52extern struct nsproxy init_nsproxy; 51extern struct nsproxy init_nsproxy;
diff --git a/include/linux/input/auo-pixcir-ts.h b/include/linux/input/auo-pixcir-ts.h
new file mode 100644
index 000000000000..75d4be717714
--- /dev/null
+++ b/include/linux/input/auo-pixcir-ts.h
@@ -0,0 +1,56 @@
1/*
2 * Driver for AUO in-cell touchscreens
3 *
4 * Copyright (c) 2011 Heiko Stuebner <heiko@sntech.de>
5 *
6 * based on auo_touch.h from Dell Streak kernel
7 *
8 * Copyright (c) 2008 QUALCOMM Incorporated.
9 * Copyright (c) 2008 QUALCOMM USA, INC.
10 *
11 *
12 * This software is licensed under the terms of the GNU General Public
13 * License version 2, as published by the Free Software Foundation, and
14 * may be copied, distributed, and modified under those terms.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 */
22
23#ifndef __AUO_PIXCIR_TS_H__
24#define __AUO_PIXCIR_TS_H__
25
26/*
27 * Interrupt modes:
28 * periodical: interrupt is asserted periodicaly
29 * compare coordinates: interrupt is asserted when coordinates change
30 * indicate touch: interrupt is asserted during touch
31 */
32#define AUO_PIXCIR_INT_PERIODICAL 0x00
33#define AUO_PIXCIR_INT_COMP_COORD 0x01
34#define AUO_PIXCIR_INT_TOUCH_IND 0x02
35
36/*
37 * @gpio_int interrupt gpio
38 * @int_setting one of AUO_PIXCIR_INT_*
39 * @init_hw hardwarespecific init
40 * @exit_hw hardwarespecific shutdown
41 * @x_max x-resolution
42 * @y_max y-resolution
43 */
44struct auo_pixcir_ts_platdata {
45 int gpio_int;
46
47 int int_setting;
48
49 void (*init_hw)(struct i2c_client *);
50 void (*exit_hw)(struct i2c_client *);
51
52 unsigned int x_max;
53 unsigned int y_max;
54};
55
56#endif
diff --git a/include/linux/input/gp2ap002a00f.h b/include/linux/input/gp2ap002a00f.h
new file mode 100644
index 000000000000..aad2fd44a61a
--- /dev/null
+++ b/include/linux/input/gp2ap002a00f.h
@@ -0,0 +1,22 @@
1#ifndef _GP2AP002A00F_H_
2#define _GP2AP002A00F_H_
3
4#include <linux/i2c.h>
5
6#define GP2A_I2C_NAME "gp2ap002a00f"
7
8/**
9 * struct gp2a_platform_data - Sharp gp2ap002a00f proximity platform data
10 * @vout_gpio: The gpio connected to the object detected pin (VOUT)
11 * @wakeup: Set to true if the proximity can wake the device from suspend
12 * @hw_setup: Callback for setting up hardware such as gpios and vregs
13 * @hw_shutdown: Callback for properly shutting down hardware
14 */
15struct gp2a_platform_data {
16 int vout_gpio;
17 bool wakeup;
18 int (*hw_setup)(struct i2c_client *client);
19 int (*hw_shutdown)(struct i2c_client *client);
20};
21
22#endif
diff --git a/include/linux/input/gpio_tilt.h b/include/linux/input/gpio_tilt.h
new file mode 100644
index 000000000000..c1cc52d380e0
--- /dev/null
+++ b/include/linux/input/gpio_tilt.h
@@ -0,0 +1,73 @@
1#ifndef _INPUT_GPIO_TILT_H
2#define _INPUT_GPIO_TILT_H
3
4/**
5 * struct gpio_tilt_axis - Axis used by the tilt switch
6 * @axis: Constant describing the axis, e.g. ABS_X
7 * @min: minimum value for abs_param
8 * @max: maximum value for abs_param
9 * @fuzz: fuzz value for abs_param
10 * @flat: flat value for abs_param
11 */
12struct gpio_tilt_axis {
13 int axis;
14 int min;
15 int max;
16 int fuzz;
17 int flat;
18};
19
20/**
21 * struct gpio_tilt_state - state description
22 * @gpios: bitfield of gpio target-states for the value
23 * @axes: array containing the axes settings for the gpio state
24 * The array indizes must correspond to the axes defined
25 * in platform_data
26 *
27 * This structure describes a supported axis settings
28 * and the necessary gpio-state which represent it.
29 *
30 * The n-th bit in the bitfield describes the state of the n-th GPIO
31 * from the gpios-array defined in gpio_regulator_config below.
32 */
33struct gpio_tilt_state {
34 int gpios;
35 int *axes;
36};
37
38/**
39 * struct gpio_tilt_platform_data
40 * @gpios: Array containing the gpios determining the tilt state
41 * @nr_gpios: Number of gpios
42 * @axes: Array of gpio_tilt_axis descriptions
43 * @nr_axes: Number of axes
44 * @states: Array of gpio_tilt_state entries describing
45 * the gpio state for specific tilts
46 * @nr_states: Number of states available
47 * @debounce_interval: debounce ticks interval in msecs
48 * @poll_interval: polling interval in msecs - for polling driver only
49 * @enable: callback to enable the tilt switch
50 * @disable: callback to disable the tilt switch
51 *
52 * This structure contains gpio-tilt-switch configuration
53 * information that must be passed by platform code to the
54 * gpio-tilt input driver.
55 */
56struct gpio_tilt_platform_data {
57 struct gpio *gpios;
58 int nr_gpios;
59
60 struct gpio_tilt_axis *axes;
61 int nr_axes;
62
63 struct gpio_tilt_state *states;
64 int nr_states;
65
66 int debounce_interval;
67
68 unsigned int poll_interval;
69 int (*enable)(struct device *dev);
70 void (*disable)(struct device *dev);
71};
72
73#endif
diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
new file mode 100644
index 000000000000..7163d91c0373
--- /dev/null
+++ b/include/linux/input/pixcir_ts.h
@@ -0,0 +1,10 @@
1#ifndef _PIXCIR_I2C_TS_H
2#define _PIXCIR_I2C_TS_H
3
4struct pixcir_ts_platform_data {
5 int (*attb_read_val)(void);
6 int x_max;
7 int y_max;
8};
9
10#endif
diff --git a/include/linux/input/samsung-keypad.h b/include/linux/input/samsung-keypad.h
new file mode 100644
index 000000000000..f25619bfd8a8
--- /dev/null
+++ b/include/linux/input/samsung-keypad.h
@@ -0,0 +1,43 @@
1/*
2 * Samsung Keypad platform data definitions
3 *
4 * Copyright (C) 2010 Samsung Electronics Co.Ltd
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#ifndef __SAMSUNG_KEYPAD_H
14#define __SAMSUNG_KEYPAD_H
15
16#include <linux/input/matrix_keypad.h>
17
18#define SAMSUNG_MAX_ROWS 8
19#define SAMSUNG_MAX_COLS 8
20
21/**
22 * struct samsung_keypad_platdata - Platform device data for Samsung Keypad.
23 * @keymap_data: pointer to &matrix_keymap_data.
24 * @rows: number of keypad row supported.
25 * @cols: number of keypad col supported.
26 * @no_autorepeat: disable key autorepeat.
27 * @wakeup: controls whether the device should be set up as wakeup source.
28 * @cfg_gpio: configure the GPIO.
29 *
30 * Initialisation data specific to either the machine or the platform
31 * for the device driver to use or call-back when configuring gpio.
32 */
33struct samsung_keypad_platdata {
34 const struct matrix_keymap_data *keymap_data;
35 unsigned int rows;
36 unsigned int cols;
37 bool no_autorepeat;
38 bool wakeup;
39
40 void (*cfg_gpio)(unsigned int rows, unsigned int cols);
41};
42
43#endif /* __SAMSUNG_KEYPAD_H */
diff --git a/include/linux/input/tca8418_keypad.h b/include/linux/input/tca8418_keypad.h
new file mode 100644
index 000000000000..e71a85dc2cbd
--- /dev/null
+++ b/include/linux/input/tca8418_keypad.h
@@ -0,0 +1,44 @@
1/*
2 * TCA8418 keypad platform support
3 *
4 * Copyright (C) 2011 Fuel7, Inc. All rights reserved.
5 *
6 * Author: Kyle Manna <kyle.manna@fuel7.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License v2 as published by the Free Software Foundation.
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 GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public
18 * License along with this program; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 021110-1307, USA.
21 *
22 * If you can't comply with GPLv2, alternative licensing terms may be
23 * arranged. Please contact Fuel7, Inc. (http://fuel7.com/) for proprietary
24 * alternative licensing inquiries.
25 */
26
27#ifndef _TCA8418_KEYPAD_H
28#define _TCA8418_KEYPAD_H
29
30#include <linux/types.h>
31#include <linux/input/matrix_keypad.h>
32
33#define TCA8418_I2C_ADDR 0x34
34#define TCA8418_NAME "tca8418_keypad"
35
36struct tca8418_keypad_platform_data {
37 const struct matrix_keymap_data *keymap_data;
38 unsigned rows;
39 unsigned cols;
40 bool rep;
41 bool irq_is_gpio;
42};
43
44#endif
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index 5037a0ad2312..1a3018063034 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -3,32 +3,95 @@
3 3
4#include <linux/radix-tree.h> 4#include <linux/radix-tree.h>
5#include <linux/rcupdate.h> 5#include <linux/rcupdate.h>
6#include <linux/workqueue.h>
6 7
7struct cfq_queue; 8enum {
8struct cfq_ttime { 9 ICQ_IOPRIO_CHANGED = 1 << 0,
9 unsigned long last_end_request; 10 ICQ_CGROUP_CHANGED = 1 << 1,
11 ICQ_EXITED = 1 << 2,
10 12
11 unsigned long ttime_total; 13 ICQ_CHANGED_MASK = ICQ_IOPRIO_CHANGED | ICQ_CGROUP_CHANGED,
12 unsigned long ttime_samples;
13 unsigned long ttime_mean;
14}; 14};
15 15
16struct cfq_io_context { 16/*
17 void *key; 17 * An io_cq (icq) is association between an io_context (ioc) and a
18 18 * request_queue (q). This is used by elevators which need to track
19 struct cfq_queue *cfqq[2]; 19 * information per ioc - q pair.
20 20 *
21 struct io_context *ioc; 21 * Elevator can request use of icq by setting elevator_type->icq_size and
22 22 * ->icq_align. Both size and align must be larger than that of struct
23 struct cfq_ttime ttime; 23 * io_cq and elevator can use the tail area for private information. The
24 24 * recommended way to do this is defining a struct which contains io_cq as
25 struct list_head queue_list; 25 * the first member followed by private members and using its size and
26 struct hlist_node cic_list; 26 * align. For example,
27 27 *
28 void (*dtor)(struct io_context *); /* destructor */ 28 * struct snail_io_cq {
29 void (*exit)(struct io_context *); /* called on task exit */ 29 * struct io_cq icq;
30 * int poke_snail;
31 * int feed_snail;
32 * };
33 *
34 * struct elevator_type snail_elv_type {
35 * .ops = { ... },
36 * .icq_size = sizeof(struct snail_io_cq),
37 * .icq_align = __alignof__(struct snail_io_cq),
38 * ...
39 * };
40 *
41 * If icq_size is set, block core will manage icq's. All requests will
42 * have its ->elv.icq field set before elevator_ops->elevator_set_req_fn()
43 * is called and be holding a reference to the associated io_context.
44 *
45 * Whenever a new icq is created, elevator_ops->elevator_init_icq_fn() is
46 * called and, on destruction, ->elevator_exit_icq_fn(). Both functions
47 * are called with both the associated io_context and queue locks held.
48 *
49 * Elevator is allowed to lookup icq using ioc_lookup_icq() while holding
50 * queue lock but the returned icq is valid only until the queue lock is
51 * released. Elevators can not and should not try to create or destroy
52 * icq's.
53 *
54 * As icq's are linked from both ioc and q, the locking rules are a bit
55 * complex.
56 *
57 * - ioc lock nests inside q lock.
58 *
59 * - ioc->icq_list and icq->ioc_node are protected by ioc lock.
60 * q->icq_list and icq->q_node by q lock.
61 *
62 * - ioc->icq_tree and ioc->icq_hint are protected by ioc lock, while icq
63 * itself is protected by q lock. However, both the indexes and icq
64 * itself are also RCU managed and lookup can be performed holding only
65 * the q lock.
66 *
67 * - icq's are not reference counted. They are destroyed when either the
68 * ioc or q goes away. Each request with icq set holds an extra
69 * reference to ioc to ensure it stays until the request is completed.
70 *
71 * - Linking and unlinking icq's are performed while holding both ioc and q
72 * locks. Due to the lock ordering, q exit is simple but ioc exit
73 * requires reverse-order double lock dance.
74 */
75struct io_cq {
76 struct request_queue *q;
77 struct io_context *ioc;
30 78
31 struct rcu_head rcu_head; 79 /*
80 * q_node and ioc_node link io_cq through icq_list of q and ioc
81 * respectively. Both fields are unused once ioc_exit_icq() is
82 * called and shared with __rcu_icq_cache and __rcu_head which are
83 * used for RCU free of io_cq.
84 */
85 union {
86 struct list_head q_node;
87 struct kmem_cache *__rcu_icq_cache;
88 };
89 union {
90 struct hlist_node ioc_node;
91 struct rcu_head __rcu_head;
92 };
93
94 unsigned int flags;
32}; 95};
33 96
34/* 97/*
@@ -43,11 +106,6 @@ struct io_context {
43 spinlock_t lock; 106 spinlock_t lock;
44 107
45 unsigned short ioprio; 108 unsigned short ioprio;
46 unsigned short ioprio_changed;
47
48#if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE)
49 unsigned short cgroup_changed;
50#endif
51 109
52 /* 110 /*
53 * For request batching 111 * For request batching
@@ -55,9 +113,11 @@ struct io_context {
55 int nr_batch_requests; /* Number of requests left in the batch */ 113 int nr_batch_requests; /* Number of requests left in the batch */
56 unsigned long last_waited; /* Time last woken after wait for request */ 114 unsigned long last_waited; /* Time last woken after wait for request */
57 115
58 struct radix_tree_root radix_root; 116 struct radix_tree_root icq_tree;
59 struct hlist_head cic_list; 117 struct io_cq __rcu *icq_hint;
60 void __rcu *ioc_data; 118 struct hlist_head icq_list;
119
120 struct work_struct release_work;
61}; 121};
62 122
63static inline struct io_context *ioc_task_link(struct io_context *ioc) 123static inline struct io_context *ioc_task_link(struct io_context *ioc)
@@ -76,20 +136,17 @@ static inline struct io_context *ioc_task_link(struct io_context *ioc)
76 136
77struct task_struct; 137struct task_struct;
78#ifdef CONFIG_BLOCK 138#ifdef CONFIG_BLOCK
79int put_io_context(struct io_context *ioc); 139void put_io_context(struct io_context *ioc);
80void exit_io_context(struct task_struct *task); 140void exit_io_context(struct task_struct *task);
81struct io_context *get_io_context(gfp_t gfp_flags, int node); 141struct io_context *get_task_io_context(struct task_struct *task,
82struct io_context *alloc_io_context(gfp_t gfp_flags, int node); 142 gfp_t gfp_flags, int node);
143void ioc_ioprio_changed(struct io_context *ioc, int ioprio);
144void ioc_cgroup_changed(struct io_context *ioc);
145unsigned int icq_get_changed(struct io_cq *icq);
83#else 146#else
84static inline void exit_io_context(struct task_struct *task)
85{
86}
87
88struct io_context; 147struct io_context;
89static inline int put_io_context(struct io_context *ioc) 148static inline void put_io_context(struct io_context *ioc) { }
90{ 149static inline void exit_io_context(struct task_struct *task) { }
91 return 1;
92}
93#endif 150#endif
94 151
95#endif 152#endif
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 432acc4c054d..d937580417ba 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -48,19 +48,34 @@ struct iommu_domain {
48 48
49#ifdef CONFIG_IOMMU_API 49#ifdef CONFIG_IOMMU_API
50 50
51/**
52 * struct iommu_ops - iommu ops and capabilities
53 * @domain_init: init iommu domain
54 * @domain_destroy: destroy iommu domain
55 * @attach_dev: attach device to an iommu domain
56 * @detach_dev: detach device from an iommu domain
57 * @map: map a physically contiguous memory region to an iommu domain
58 * @unmap: unmap a physically contiguous memory region from an iommu domain
59 * @iova_to_phys: translate iova to physical address
60 * @domain_has_cap: domain capabilities query
61 * @commit: commit iommu domain
62 * @pgsize_bitmap: bitmap of supported page sizes
63 */
51struct iommu_ops { 64struct iommu_ops {
52 int (*domain_init)(struct iommu_domain *domain); 65 int (*domain_init)(struct iommu_domain *domain);
53 void (*domain_destroy)(struct iommu_domain *domain); 66 void (*domain_destroy)(struct iommu_domain *domain);
54 int (*attach_dev)(struct iommu_domain *domain, struct device *dev); 67 int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
55 void (*detach_dev)(struct iommu_domain *domain, struct device *dev); 68 void (*detach_dev)(struct iommu_domain *domain, struct device *dev);
56 int (*map)(struct iommu_domain *domain, unsigned long iova, 69 int (*map)(struct iommu_domain *domain, unsigned long iova,
57 phys_addr_t paddr, int gfp_order, int prot); 70 phys_addr_t paddr, size_t size, int prot);
58 int (*unmap)(struct iommu_domain *domain, unsigned long iova, 71 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova,
59 int gfp_order); 72 size_t size);
60 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, 73 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain,
61 unsigned long iova); 74 unsigned long iova);
62 int (*domain_has_cap)(struct iommu_domain *domain, 75 int (*domain_has_cap)(struct iommu_domain *domain,
63 unsigned long cap); 76 unsigned long cap);
77 int (*device_group)(struct device *dev, unsigned int *groupid);
78 unsigned long pgsize_bitmap;
64}; 79};
65 80
66extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops); 81extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops);
@@ -72,15 +87,16 @@ extern int iommu_attach_device(struct iommu_domain *domain,
72extern void iommu_detach_device(struct iommu_domain *domain, 87extern void iommu_detach_device(struct iommu_domain *domain,
73 struct device *dev); 88 struct device *dev);
74extern int iommu_map(struct iommu_domain *domain, unsigned long iova, 89extern int iommu_map(struct iommu_domain *domain, unsigned long iova,
75 phys_addr_t paddr, int gfp_order, int prot); 90 phys_addr_t paddr, size_t size, int prot);
76extern int iommu_unmap(struct iommu_domain *domain, unsigned long iova, 91extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
77 int gfp_order); 92 size_t size);
78extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, 93extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
79 unsigned long iova); 94 unsigned long iova);
80extern int iommu_domain_has_cap(struct iommu_domain *domain, 95extern int iommu_domain_has_cap(struct iommu_domain *domain,
81 unsigned long cap); 96 unsigned long cap);
82extern void iommu_set_fault_handler(struct iommu_domain *domain, 97extern void iommu_set_fault_handler(struct iommu_domain *domain,
83 iommu_fault_handler_t handler); 98 iommu_fault_handler_t handler);
99extern int iommu_device_group(struct device *dev, unsigned int *groupid);
84 100
85/** 101/**
86 * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework 102 * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework
@@ -179,6 +195,11 @@ static inline void iommu_set_fault_handler(struct iommu_domain *domain,
179{ 195{
180} 196}
181 197
198static inline int iommu_device_group(struct device *dev, unsigned int *groupid)
199{
200 return -ENODEV;
201}
202
182#endif /* CONFIG_IOMMU_API */ 203#endif /* CONFIG_IOMMU_API */
183 204
184#endif /* __LINUX_IOMMU_H */ 205#endif /* __LINUX_IOMMU_H */
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 3b1594d662b0..30e816148df4 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -93,7 +93,7 @@ struct kern_ipc_perm
93 gid_t gid; 93 gid_t gid;
94 uid_t cuid; 94 uid_t cuid;
95 gid_t cgid; 95 gid_t cgid;
96 mode_t mode; 96 umode_t mode;
97 unsigned long seq; 97 unsigned long seq;
98 void *security; 98 void *security;
99}; 99};
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 0c997767429a..6318268dcaf5 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -404,7 +404,7 @@ struct tcp6_sock {
404 404
405extern int inet6_sk_rebuild_header(struct sock *sk); 405extern int inet6_sk_rebuild_header(struct sock *sk);
406 406
407#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 407#if IS_ENABLED(CONFIG_IPV6)
408static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) 408static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
409{ 409{
410 return inet_sk(__sk)->pinet6; 410 return inet_sk(__sk)->pinet6;
@@ -515,7 +515,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
515#define inet6_rcv_saddr(__sk) NULL 515#define inet6_rcv_saddr(__sk) NULL
516#define tcp_twsk_ipv6only(__sk) 0 516#define tcp_twsk_ipv6only(__sk) 0
517#define inet_v6_ipv6only(__sk) 0 517#define inet_v6_ipv6only(__sk) 0
518#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 518#endif /* IS_ENABLED(CONFIG_IPV6) */
519 519
520#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\ 520#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\
521 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 521 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 99834e581b9e..bd4272b61a14 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -91,10 +91,11 @@ static inline unsigned int irq_domain_to_irq(struct irq_domain *d,
91 91
92extern void irq_domain_add(struct irq_domain *domain); 92extern void irq_domain_add(struct irq_domain *domain);
93extern void irq_domain_del(struct irq_domain *domain); 93extern void irq_domain_del(struct irq_domain *domain);
94
95extern struct irq_domain_ops irq_domain_simple_ops;
94#endif /* CONFIG_IRQ_DOMAIN */ 96#endif /* CONFIG_IRQ_DOMAIN */
95 97
96#if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ) 98#if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ)
97extern struct irq_domain_ops irq_domain_simple_ops;
98extern void irq_domain_add_simple(struct device_node *controller, int irq_base); 99extern void irq_domain_add_simple(struct device_node *controller, int irq_base);
99extern void irq_domain_generate_simple(const struct of_device_id *match, 100extern void irq_domain_generate_simple(const struct of_device_id *match,
100 u64 phys_base, unsigned int irq_start); 101 u64 phys_base, unsigned int irq_start);
diff --git a/include/linux/iscsi_boot_sysfs.h b/include/linux/iscsi_boot_sysfs.h
index f0a2f8b0aa13..2a8b1659bf35 100644
--- a/include/linux/iscsi_boot_sysfs.h
+++ b/include/linux/iscsi_boot_sysfs.h
@@ -91,7 +91,7 @@ struct iscsi_boot_kobj {
91 * The enum of the type. This can be any value of the above 91 * The enum of the type. This can be any value of the above
92 * properties. 92 * properties.
93 */ 93 */
94 mode_t (*is_visible) (void *data, int type); 94 umode_t (*is_visible) (void *data, int type);
95 95
96 /* 96 /*
97 * Driver specific release function. 97 * Driver specific release function.
@@ -110,20 +110,20 @@ struct iscsi_boot_kobj *
110iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index, 110iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index,
111 void *data, 111 void *data,
112 ssize_t (*show) (void *data, int type, char *buf), 112 ssize_t (*show) (void *data, int type, char *buf),
113 mode_t (*is_visible) (void *data, int type), 113 umode_t (*is_visible) (void *data, int type),
114 void (*release) (void *data)); 114 void (*release) (void *data));
115 115
116struct iscsi_boot_kobj * 116struct iscsi_boot_kobj *
117iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index, 117iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index,
118 void *data, 118 void *data,
119 ssize_t (*show) (void *data, int type, char *buf), 119 ssize_t (*show) (void *data, int type, char *buf),
120 mode_t (*is_visible) (void *data, int type), 120 umode_t (*is_visible) (void *data, int type),
121 void (*release) (void *data)); 121 void (*release) (void *data));
122struct iscsi_boot_kobj * 122struct iscsi_boot_kobj *
123iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index, 123iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index,
124 void *data, 124 void *data,
125 ssize_t (*show) (void *data, int type, char *buf), 125 ssize_t (*show) (void *data, int type, char *buf),
126 mode_t (*is_visible) (void *data, int type), 126 umode_t (*is_visible) (void *data, int type),
127 void (*release) (void *data)); 127 void (*release) (void *data));
128 128
129struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name); 129struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name);
diff --git a/include/linux/isdn_divertif.h b/include/linux/isdn_divertif.h
index 07821ca5955f..a5a50f523807 100644
--- a/include/linux/isdn_divertif.h
+++ b/include/linux/isdn_divertif.h
@@ -10,6 +10,8 @@
10 * 10 *
11 */ 11 */
12 12
13#ifndef _LINUX_ISDN_DIVERTIF_H
14#define _LINUX_ISDN_DIVERTIF_H
13 15
14/***********************************************************/ 16/***********************************************************/
15/* magic value is also used to control version information */ 17/* magic value is also used to control version information */
@@ -45,3 +47,5 @@ typedef struct
45/*********************/ 47/*********************/
46extern int DIVERT_REG_NAME(isdn_divert_if *); 48extern int DIVERT_REG_NAME(isdn_divert_if *);
47#endif 49#endif
50
51#endif /* _LINUX_ISDN_DIVERTIF_H */
diff --git a/include/linux/ivtv.h b/include/linux/ivtv.h
index 062d20f74322..42bf725751af 100644
--- a/include/linux/ivtv.h
+++ b/include/linux/ivtv.h
@@ -58,7 +58,11 @@ struct ivtv_dma_frame {
58 __u32 src_height; 58 __u32 src_height;
59}; 59};
60 60
61#define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame) 61#define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame)
62
63/* Select the passthrough mode (if the argument is non-zero). In the passthrough
64 mode the output of the encoder is passed immediately into the decoder. */
65#define IVTV_IOC_PASSTHROUGH_MODE _IOW ('V', BASE_VIDIOC_PRIVATE+1, int)
62 66
63/* Deprecated defines: applications should use the defines from videodev2.h */ 67/* Deprecated defines: applications should use the defines from videodev2.h */
64#define IVTV_SLICED_TYPE_TELETEXT_B V4L2_MPEG_VBI_IVTV_TELETEXT_B 68#define IVTV_SLICED_TYPE_TELETEXT_B V4L2_MPEG_VBI_IVTV_TELETEXT_B
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index c7acdde3243d..d211732b9e99 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -497,7 +497,6 @@ struct transaction_s
497 * @j_format_version: Version of the superblock format 497 * @j_format_version: Version of the superblock format
498 * @j_state_lock: Protect the various scalars in the journal 498 * @j_state_lock: Protect the various scalars in the journal
499 * @j_barrier_count: Number of processes waiting to create a barrier lock 499 * @j_barrier_count: Number of processes waiting to create a barrier lock
500 * @j_barrier: The barrier lock itself
501 * @j_running_transaction: The current running transaction.. 500 * @j_running_transaction: The current running transaction..
502 * @j_committing_transaction: the transaction we are pushing to disk 501 * @j_committing_transaction: the transaction we are pushing to disk
503 * @j_checkpoint_transactions: a linked circular list of all transactions 502 * @j_checkpoint_transactions: a linked circular list of all transactions
@@ -580,9 +579,6 @@ struct journal_s
580 */ 579 */
581 int j_barrier_count; 580 int j_barrier_count;
582 581
583 /* The barrier lock itself */
584 struct mutex j_barrier;
585
586 /* 582 /*
587 * Transactions: The current running transaction... 583 * Transactions: The current running transaction...
588 * [j_state_lock] [caller holding open handle] 584 * [j_state_lock] [caller holding open handle]
@@ -913,6 +909,7 @@ extern int journal_set_revoke(journal_t *, unsigned int, tid_t);
913extern int journal_test_revoke(journal_t *, unsigned int, tid_t); 909extern int journal_test_revoke(journal_t *, unsigned int, tid_t);
914extern void journal_clear_revoke(journal_t *); 910extern void journal_clear_revoke(journal_t *);
915extern void journal_switch_revoke_table(journal_t *journal); 911extern void journal_switch_revoke_table(journal_t *journal);
912extern void journal_clear_buffer_revoked_flags(journal_t *journal);
916 913
917/* 914/*
918 * The log thread user interface: 915 * The log thread user interface:
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 2092ea21e469..5557baefed60 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1151,6 +1151,7 @@ extern int jbd2_journal_set_revoke(journal_t *, unsigned long long, tid_t);
1151extern int jbd2_journal_test_revoke(journal_t *, unsigned long long, tid_t); 1151extern int jbd2_journal_test_revoke(journal_t *, unsigned long long, tid_t);
1152extern void jbd2_journal_clear_revoke(journal_t *); 1152extern void jbd2_journal_clear_revoke(journal_t *);
1153extern void jbd2_journal_switch_revoke_table(journal_t *journal); 1153extern void jbd2_journal_switch_revoke_table(journal_t *journal);
1154extern void jbd2_clear_buffer_revoked_flags(journal_t *journal);
1154 1155
1155/* 1156/*
1156 * The log thread user interface: 1157 * The log thread user interface:
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 388b0d425b50..5ce8b140428f 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/compiler.h> 5#include <linux/compiler.h>
6#include <linux/workqueue.h>
6 7
7#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) 8#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
8 9
@@ -14,6 +15,12 @@ struct jump_label_key {
14#endif 15#endif
15}; 16};
16 17
18struct jump_label_key_deferred {
19 struct jump_label_key key;
20 unsigned long timeout;
21 struct delayed_work work;
22};
23
17# include <asm/jump_label.h> 24# include <asm/jump_label.h>
18# define HAVE_JUMP_LABEL 25# define HAVE_JUMP_LABEL
19#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */ 26#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */
@@ -51,8 +58,11 @@ extern void arch_jump_label_transform_static(struct jump_entry *entry,
51extern int jump_label_text_reserved(void *start, void *end); 58extern int jump_label_text_reserved(void *start, void *end);
52extern void jump_label_inc(struct jump_label_key *key); 59extern void jump_label_inc(struct jump_label_key *key);
53extern void jump_label_dec(struct jump_label_key *key); 60extern void jump_label_dec(struct jump_label_key *key);
61extern void jump_label_dec_deferred(struct jump_label_key_deferred *key);
54extern bool jump_label_enabled(struct jump_label_key *key); 62extern bool jump_label_enabled(struct jump_label_key *key);
55extern void jump_label_apply_nops(struct module *mod); 63extern void jump_label_apply_nops(struct module *mod);
64extern void jump_label_rate_limit(struct jump_label_key_deferred *key,
65 unsigned long rl);
56 66
57#else /* !HAVE_JUMP_LABEL */ 67#else /* !HAVE_JUMP_LABEL */
58 68
@@ -68,6 +78,10 @@ static __always_inline void jump_label_init(void)
68{ 78{
69} 79}
70 80
81struct jump_label_key_deferred {
82 struct jump_label_key key;
83};
84
71static __always_inline bool static_branch(struct jump_label_key *key) 85static __always_inline bool static_branch(struct jump_label_key *key)
72{ 86{
73 if (unlikely(atomic_read(&key->enabled))) 87 if (unlikely(atomic_read(&key->enabled)))
@@ -85,6 +99,11 @@ static inline void jump_label_dec(struct jump_label_key *key)
85 atomic_dec(&key->enabled); 99 atomic_dec(&key->enabled);
86} 100}
87 101
102static inline void jump_label_dec_deferred(struct jump_label_key_deferred *key)
103{
104 jump_label_dec(&key->key);
105}
106
88static inline int jump_label_text_reserved(void *start, void *end) 107static inline int jump_label_text_reserved(void *start, void *end)
89{ 108{
90 return 0; 109 return 0;
@@ -102,6 +121,14 @@ static inline int jump_label_apply_nops(struct module *mod)
102{ 121{
103 return 0; 122 return 0;
104} 123}
124
125static inline void jump_label_rate_limit(struct jump_label_key_deferred *key,
126 unsigned long rl)
127{
128}
105#endif /* HAVE_JUMP_LABEL */ 129#endif /* HAVE_JUMP_LABEL */
106 130
131#define jump_label_key_enabled ((struct jump_label_key){ .enabled = ATOMIC_INIT(1), })
132#define jump_label_key_disabled ((struct jump_label_key){ .enabled = ATOMIC_INIT(0), })
133
107#endif /* _LINUX_JUMP_LABEL_H */ 134#endif /* _LINUX_JUMP_LABEL_H */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e8b1597b5cf2..e8343422240a 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -185,16 +185,17 @@ static inline void might_fault(void)
185 185
186extern struct atomic_notifier_head panic_notifier_list; 186extern struct atomic_notifier_head panic_notifier_list;
187extern long (*panic_blink)(int state); 187extern long (*panic_blink)(int state);
188NORET_TYPE void panic(const char * fmt, ...) 188__printf(1, 2)
189 __attribute__ ((NORET_AND format (printf, 1, 2))) __cold; 189void panic(const char *fmt, ...)
190 __noreturn __cold;
190extern void oops_enter(void); 191extern void oops_enter(void);
191extern void oops_exit(void); 192extern void oops_exit(void);
192void print_oops_end_marker(void); 193void print_oops_end_marker(void);
193extern int oops_may_print(void); 194extern int oops_may_print(void);
194NORET_TYPE void do_exit(long error_code) 195void do_exit(long error_code)
195 ATTRIB_NORET; 196 __noreturn;
196NORET_TYPE void complete_and_exit(struct completion *, long) 197void complete_and_exit(struct completion *, long)
197 ATTRIB_NORET; 198 __noreturn;
198 199
199/* Internal, do not use. */ 200/* Internal, do not use. */
200int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res); 201int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res);
@@ -341,6 +342,7 @@ extern int panic_timeout;
341extern int panic_on_oops; 342extern int panic_on_oops;
342extern int panic_on_unrecovered_nmi; 343extern int panic_on_unrecovered_nmi;
343extern int panic_on_io_nmi; 344extern int panic_on_io_nmi;
345extern int sysctl_panic_on_stackoverflow;
344extern const char *print_tainted(void); 346extern const char *print_tainted(void);
345extern void add_taint(unsigned flag); 347extern void add_taint(unsigned flag);
346extern int test_taint(unsigned flag); 348extern int test_taint(unsigned flag);
@@ -665,6 +667,7 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
665#define BUILD_BUG_ON_ZERO(e) (0) 667#define BUILD_BUG_ON_ZERO(e) (0)
666#define BUILD_BUG_ON_NULL(e) ((void*)0) 668#define BUILD_BUG_ON_NULL(e) ((void*)0)
667#define BUILD_BUG_ON(condition) 669#define BUILD_BUG_ON(condition)
670#define BUILD_BUG() (0)
668#else /* __CHECKER__ */ 671#else /* __CHECKER__ */
669 672
670/* Force a compilation error if a constant expression is not a power of 2 */ 673/* Force a compilation error if a constant expression is not a power of 2 */
@@ -703,6 +706,21 @@ extern int __build_bug_on_failed;
703 if (condition) __build_bug_on_failed = 1; \ 706 if (condition) __build_bug_on_failed = 1; \
704 } while(0) 707 } while(0)
705#endif 708#endif
709
710/**
711 * BUILD_BUG - break compile if used.
712 *
713 * If you have some code that you expect the compiler to eliminate at
714 * build time, you should use BUILD_BUG to detect if it is
715 * unexpectedly used.
716 */
717#define BUILD_BUG() \
718 do { \
719 extern void __build_bug_failed(void) \
720 __linktime_error("BUILD_BUG failed"); \
721 __build_bug_failed(); \
722 } while (0)
723
706#endif /* __CHECKER__ */ 724#endif /* __CHECKER__ */
707 725
708/* Trap pasters of __FUNCTION__ at compile-time */ 726/* Trap pasters of __FUNCTION__ at compile-time */
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 0cce2db580c3..2fbd9053c2df 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -6,6 +6,7 @@
6#include <linux/percpu.h> 6#include <linux/percpu.h>
7#include <linux/cpumask.h> 7#include <linux/cpumask.h>
8#include <linux/interrupt.h> 8#include <linux/interrupt.h>
9#include <linux/sched.h>
9#include <asm/irq.h> 10#include <asm/irq.h>
10#include <asm/cputime.h> 11#include <asm/cputime.h>
11 12
@@ -15,21 +16,25 @@
15 * used by rstatd/perfmeter 16 * used by rstatd/perfmeter
16 */ 17 */
17 18
18struct cpu_usage_stat { 19enum cpu_usage_stat {
19 cputime64_t user; 20 CPUTIME_USER,
20 cputime64_t nice; 21 CPUTIME_NICE,
21 cputime64_t system; 22 CPUTIME_SYSTEM,
22 cputime64_t softirq; 23 CPUTIME_SOFTIRQ,
23 cputime64_t irq; 24 CPUTIME_IRQ,
24 cputime64_t idle; 25 CPUTIME_IDLE,
25 cputime64_t iowait; 26 CPUTIME_IOWAIT,
26 cputime64_t steal; 27 CPUTIME_STEAL,
27 cputime64_t guest; 28 CPUTIME_GUEST,
28 cputime64_t guest_nice; 29 CPUTIME_GUEST_NICE,
30 NR_STATS,
31};
32
33struct kernel_cpustat {
34 u64 cpustat[NR_STATS];
29}; 35};
30 36
31struct kernel_stat { 37struct kernel_stat {
32 struct cpu_usage_stat cpustat;
33#ifndef CONFIG_GENERIC_HARDIRQS 38#ifndef CONFIG_GENERIC_HARDIRQS
34 unsigned int irqs[NR_IRQS]; 39 unsigned int irqs[NR_IRQS];
35#endif 40#endif
@@ -38,10 +43,13 @@ struct kernel_stat {
38}; 43};
39 44
40DECLARE_PER_CPU(struct kernel_stat, kstat); 45DECLARE_PER_CPU(struct kernel_stat, kstat);
46DECLARE_PER_CPU(struct kernel_cpustat, kernel_cpustat);
41 47
42#define kstat_cpu(cpu) per_cpu(kstat, cpu)
43/* Must have preemption disabled for this to be meaningful. */ 48/* Must have preemption disabled for this to be meaningful. */
44#define kstat_this_cpu __get_cpu_var(kstat) 49#define kstat_this_cpu (&__get_cpu_var(kstat))
50#define kcpustat_this_cpu (&__get_cpu_var(kernel_cpustat))
51#define kstat_cpu(cpu) per_cpu(kstat, cpu)
52#define kcpustat_cpu(cpu) per_cpu(kernel_cpustat, cpu)
45 53
46extern unsigned long long nr_context_switches(void); 54extern unsigned long long nr_context_switches(void);
47 55
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 2fa0901219d4..0d7d6a1b172f 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -50,9 +50,11 @@
50 * note header. For kdump, the code in vmcore.c runs in the context 50 * note header. For kdump, the code in vmcore.c runs in the context
51 * of the second kernel to combine them into one note. 51 * of the second kernel to combine them into one note.
52 */ 52 */
53#ifndef KEXEC_NOTE_BYTES
53#define KEXEC_NOTE_BYTES ( (KEXEC_NOTE_HEAD_BYTES * 2) + \ 54#define KEXEC_NOTE_BYTES ( (KEXEC_NOTE_HEAD_BYTES * 2) + \
54 KEXEC_CORE_NOTE_NAME_BYTES + \ 55 KEXEC_CORE_NOTE_NAME_BYTES + \
55 KEXEC_CORE_NOTE_DESC_BYTES ) 56 KEXEC_CORE_NOTE_DESC_BYTES )
57#endif
56 58
57/* 59/*
58 * This structure is used to hold the arguments that are used when loading 60 * This structure is used to hold the arguments that are used when loading
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index 9efd081bb31e..39e3c082c49d 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -92,6 +92,7 @@ struct key_type {
92 92
93 /* internal fields */ 93 /* internal fields */
94 struct list_head link; /* link in types list */ 94 struct list_head link; /* link in types list */
95 struct lock_class_key lock_class; /* key->sem lock class */
95}; 96};
96 97
97extern struct key_type key_type_keyring; 98extern struct key_type key_type_keyring;
diff --git a/include/linux/key.h b/include/linux/key.h
index 183a6af7715d..5253471cd2ea 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -271,7 +271,7 @@ extern int keyring_add_key(struct key *keyring,
271 271
272extern struct key *key_lookup(key_serial_t id); 272extern struct key *key_lookup(key_serial_t id);
273 273
274static inline key_serial_t key_serial(struct key *key) 274static inline key_serial_t key_serial(const struct key *key)
275{ 275{
276 return key ? key->serial : 0; 276 return key ? key->serial : 0;
277} 277}
@@ -293,6 +293,9 @@ static inline bool key_is_instantiated(const struct key *key)
293 (rcu_dereference_protected((KEY)->payload.rcudata, \ 293 (rcu_dereference_protected((KEY)->payload.rcudata, \
294 rwsem_is_locked(&((struct key *)(KEY))->sem))) 294 rwsem_is_locked(&((struct key *)(KEY))->sem)))
295 295
296#define rcu_assign_keypointer(KEY, PAYLOAD) \
297 (rcu_assign_pointer((KEY)->payload.rcudata, PAYLOAD))
298
296#ifdef CONFIG_SYSCTL 299#ifdef CONFIG_SYSCTL
297extern ctl_table key_sysctls[]; 300extern ctl_table key_sysctls[];
298#endif 301#endif
diff --git a/include/linux/kmemleak.h b/include/linux/kmemleak.h
index 99d9a6766f7e..2a5e5548a1d2 100644
--- a/include/linux/kmemleak.h
+++ b/include/linux/kmemleak.h
@@ -26,8 +26,10 @@
26extern void kmemleak_init(void) __ref; 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) __ref; 28 gfp_t gfp) __ref;
29extern void kmemleak_alloc_percpu(const void __percpu *ptr, size_t size) __ref;
29extern void kmemleak_free(const void *ptr) __ref; 30extern void kmemleak_free(const void *ptr) __ref;
30extern void kmemleak_free_part(const void *ptr, size_t size) __ref; 31extern void kmemleak_free_part(const void *ptr, size_t size) __ref;
32extern void kmemleak_free_percpu(const void __percpu *ptr) __ref;
31extern void kmemleak_padding(const void *ptr, unsigned long offset, 33extern void kmemleak_padding(const void *ptr, unsigned long offset,
32 size_t size) __ref; 34 size_t size) __ref;
33extern void kmemleak_not_leak(const void *ptr) __ref; 35extern void kmemleak_not_leak(const void *ptr) __ref;
@@ -68,6 +70,9 @@ static inline void kmemleak_alloc_recursive(const void *ptr, size_t size,
68 gfp_t gfp) 70 gfp_t gfp)
69{ 71{
70} 72}
73static inline void kmemleak_alloc_percpu(const void __percpu *ptr, size_t size)
74{
75}
71static inline void kmemleak_free(const void *ptr) 76static inline void kmemleak_free(const void *ptr)
72{ 77{
73} 78}
@@ -77,6 +82,9 @@ static inline void kmemleak_free_part(const void *ptr, size_t size)
77static inline void kmemleak_free_recursive(const void *ptr, unsigned long flags) 82static inline void kmemleak_free_recursive(const void *ptr, unsigned long flags)
78{ 83{
79} 84}
85static inline void kmemleak_free_percpu(const void __percpu *ptr)
86{
87}
80static inline void kmemleak_not_leak(const void *ptr) 88static inline void kmemleak_not_leak(const void *ptr)
81{ 89{
82} 90}
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index b16f65390734..722f477c4ef7 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -117,5 +117,7 @@ extern void usermodehelper_init(void);
117extern int usermodehelper_disable(void); 117extern int usermodehelper_disable(void);
118extern void usermodehelper_enable(void); 118extern void usermodehelper_enable(void);
119extern bool usermodehelper_is_disabled(void); 119extern bool usermodehelper_is_disabled(void);
120extern void read_lock_usermodehelper(void);
121extern void read_unlock_usermodehelper(void);
120 122
121#endif /* __LINUX_KMOD_H__ */ 123#endif /* __LINUX_KMOD_H__ */
diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h
index ee0c952188de..35f7237ec972 100644
--- a/include/linux/kmsg_dump.h
+++ b/include/linux/kmsg_dump.h
@@ -15,14 +15,18 @@
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/list.h> 16#include <linux/list.h>
17 17
18/*
19 * Keep this list arranged in rough order of priority. Anything listed after
20 * KMSG_DUMP_OOPS will not be logged by default unless printk.always_kmsg_dump
21 * is passed to the kernel.
22 */
18enum kmsg_dump_reason { 23enum kmsg_dump_reason {
19 KMSG_DUMP_OOPS,
20 KMSG_DUMP_PANIC, 24 KMSG_DUMP_PANIC,
21 KMSG_DUMP_KEXEC, 25 KMSG_DUMP_OOPS,
26 KMSG_DUMP_EMERG,
22 KMSG_DUMP_RESTART, 27 KMSG_DUMP_RESTART,
23 KMSG_DUMP_HALT, 28 KMSG_DUMP_HALT,
24 KMSG_DUMP_POWEROFF, 29 KMSG_DUMP_POWEROFF,
25 KMSG_DUMP_EMERG,
26}; 30};
27 31
28/** 32/**
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index ad81e1c51487..fc615a97e2d3 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -191,8 +191,6 @@ static inline struct kobj_type *get_ktype(struct kobject *kobj)
191} 191}
192 192
193extern struct kobject *kset_find_obj(struct kset *, const char *); 193extern struct kobject *kset_find_obj(struct kset *, const char *);
194extern struct kobject *kset_find_obj_hinted(struct kset *, const char *,
195 struct kobject *);
196 194
197/* The global /sys/kernel/ kobject for people to chain off of */ 195/* The global /sys/kernel/ kobject for people to chain off of */
198extern struct kobject *kernel_kobj; 196extern struct kobject *kernel_kobj;
diff --git a/include/linux/kref.h b/include/linux/kref.h
index d4a62ab2ee5e..9c07dcebded7 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -15,16 +15,82 @@
15#ifndef _KREF_H_ 15#ifndef _KREF_H_
16#define _KREF_H_ 16#define _KREF_H_
17 17
18#include <linux/types.h> 18#include <linux/bug.h>
19#include <linux/atomic.h>
20#include <linux/kernel.h>
19 21
20struct kref { 22struct kref {
21 atomic_t refcount; 23 atomic_t refcount;
22}; 24};
23 25
24void kref_init(struct kref *kref); 26/**
25void kref_get(struct kref *kref); 27 * kref_init - initialize object.
26int kref_put(struct kref *kref, void (*release) (struct kref *kref)); 28 * @kref: object in question.
27int kref_sub(struct kref *kref, unsigned int count, 29 */
28 void (*release) (struct kref *kref)); 30static inline void kref_init(struct kref *kref)
31{
32 atomic_set(&kref->refcount, 1);
33}
34
35/**
36 * kref_get - increment refcount for object.
37 * @kref: object.
38 */
39static inline void kref_get(struct kref *kref)
40{
41 WARN_ON(!atomic_read(&kref->refcount));
42 atomic_inc(&kref->refcount);
43}
29 44
45/**
46 * kref_sub - subtract a number of refcounts for object.
47 * @kref: object.
48 * @count: Number of recounts to subtract.
49 * @release: pointer to the function that will clean up the object when the
50 * last reference to the object is released.
51 * This pointer is required, and it is not acceptable to pass kfree
52 * in as this function. If the caller does pass kfree to this
53 * function, you will be publicly mocked mercilessly by the kref
54 * maintainer, and anyone else who happens to notice it. You have
55 * been warned.
56 *
57 * Subtract @count from the refcount, and if 0, call release().
58 * Return 1 if the object was removed, otherwise return 0. Beware, if this
59 * function returns 0, you still can not count on the kref from remaining in
60 * memory. Only use the return value if you want to see if the kref is now
61 * gone, not present.
62 */
63static inline int kref_sub(struct kref *kref, unsigned int count,
64 void (*release)(struct kref *kref))
65{
66 WARN_ON(release == NULL);
67
68 if (atomic_sub_and_test((int) count, &kref->refcount)) {
69 release(kref);
70 return 1;
71 }
72 return 0;
73}
74
75/**
76 * kref_put - decrement refcount for object.
77 * @kref: object.
78 * @release: pointer to the function that will clean up the object when the
79 * last reference to the object is released.
80 * This pointer is required, and it is not acceptable to pass kfree
81 * in as this function. If the caller does pass kfree to this
82 * function, you will be publicly mocked mercilessly by the kref
83 * maintainer, and anyone else who happens to notice it. You have
84 * been warned.
85 *
86 * Decrement the refcount, and if 0, call release().
87 * Return 1 if the object was removed, otherwise return 0. Beware, if this
88 * function returns 0, you still can not count on the kref from remaining in
89 * memory. Only use the return value if you want to see if the kref is now
90 * gone, not present.
91 */
92static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref))
93{
94 return kref_sub(kref, 1, release);
95}
30#endif /* _KREF_H_ */ 96#endif /* _KREF_H_ */
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 5cac19b3a266..0714b24c0e45 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -35,6 +35,7 @@ struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
35void kthread_bind(struct task_struct *k, unsigned int cpu); 35void kthread_bind(struct task_struct *k, unsigned int cpu);
36int kthread_stop(struct task_struct *k); 36int kthread_stop(struct task_struct *k);
37int kthread_should_stop(void); 37int kthread_should_stop(void);
38bool kthread_freezable_should_stop(bool *was_frozen);
38void *kthread_data(struct task_struct *k); 39void *kthread_data(struct task_struct *k);
39 40
40int kthreadd(void *unused); 41int kthreadd(void *unused);
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index d52623199978..900c76337e8f 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -14,6 +14,7 @@
14#include <linux/signal.h> 14#include <linux/signal.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/mmu_notifier.h>
17#include <linux/preempt.h> 18#include <linux/preempt.h>
18#include <linux/msi.h> 19#include <linux/msi.h>
19#include <linux/slab.h> 20#include <linux/slab.h>
@@ -50,6 +51,9 @@
50#define KVM_REQ_APF_HALT 12 51#define KVM_REQ_APF_HALT 12
51#define KVM_REQ_STEAL_UPDATE 13 52#define KVM_REQ_STEAL_UPDATE 13
52#define KVM_REQ_NMI 14 53#define KVM_REQ_NMI 14
54#define KVM_REQ_IMMEDIATE_EXIT 15
55#define KVM_REQ_PMU 16
56#define KVM_REQ_PMI 17
53 57
54#define KVM_USERSPACE_IRQ_SOURCE_ID 0 58#define KVM_USERSPACE_IRQ_SOURCE_ID 0
55 59
@@ -179,6 +183,7 @@ struct kvm_memory_slot {
179 unsigned long *rmap; 183 unsigned long *rmap;
180 unsigned long *dirty_bitmap; 184 unsigned long *dirty_bitmap;
181 unsigned long *dirty_bitmap_head; 185 unsigned long *dirty_bitmap_head;
186 unsigned long nr_dirty_pages;
182 struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1]; 187 struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1];
183 unsigned long userspace_addr; 188 unsigned long userspace_addr;
184 int user_alloc; 189 int user_alloc;
@@ -224,11 +229,20 @@ struct kvm_irq_routing_table {};
224 229
225#endif 230#endif
226 231
232#ifndef KVM_MEM_SLOTS_NUM
233#define KVM_MEM_SLOTS_NUM (KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS)
234#endif
235
236/*
237 * Note:
238 * memslots are not sorted by id anymore, please use id_to_memslot()
239 * to get the memslot by its id.
240 */
227struct kvm_memslots { 241struct kvm_memslots {
228 int nmemslots;
229 u64 generation; 242 u64 generation;
230 struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS + 243 struct kvm_memory_slot memslots[KVM_MEM_SLOTS_NUM];
231 KVM_PRIVATE_MEM_SLOTS]; 244 /* The mapping table from slot id to the index in memslots[]. */
245 int id_to_index[KVM_MEM_SLOTS_NUM];
232}; 246};
233 247
234struct kvm { 248struct kvm {
@@ -239,7 +253,6 @@ struct kvm {
239 struct srcu_struct srcu; 253 struct srcu_struct srcu;
240#ifdef CONFIG_KVM_APIC_ARCHITECTURE 254#ifdef CONFIG_KVM_APIC_ARCHITECTURE
241 u32 bsp_vcpu_id; 255 u32 bsp_vcpu_id;
242 struct kvm_vcpu *bsp_vcpu;
243#endif 256#endif
244 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS]; 257 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
245 atomic_t online_vcpus; 258 atomic_t online_vcpus;
@@ -302,6 +315,11 @@ static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i)
302 (vcpup = kvm_get_vcpu(kvm, idx)) != NULL; \ 315 (vcpup = kvm_get_vcpu(kvm, idx)) != NULL; \
303 idx++) 316 idx++)
304 317
318#define kvm_for_each_memslot(memslot, slots) \
319 for (memslot = &slots->memslots[0]; \
320 memslot < slots->memslots + KVM_MEM_SLOTS_NUM && memslot->npages;\
321 memslot++)
322
305int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id); 323int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id);
306void kvm_vcpu_uninit(struct kvm_vcpu *vcpu); 324void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
307 325
@@ -314,6 +332,7 @@ void kvm_exit(void);
314 332
315void kvm_get_kvm(struct kvm *kvm); 333void kvm_get_kvm(struct kvm *kvm);
316void kvm_put_kvm(struct kvm *kvm); 334void kvm_put_kvm(struct kvm *kvm);
335void update_memslots(struct kvm_memslots *slots, struct kvm_memory_slot *new);
317 336
318static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm) 337static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm)
319{ 338{
@@ -322,6 +341,18 @@ static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm)
322 || lockdep_is_held(&kvm->slots_lock)); 341 || lockdep_is_held(&kvm->slots_lock));
323} 342}
324 343
344static inline struct kvm_memory_slot *
345id_to_memslot(struct kvm_memslots *slots, int id)
346{
347 int index = slots->id_to_index[id];
348 struct kvm_memory_slot *slot;
349
350 slot = &slots->memslots[index];
351
352 WARN_ON(slot->id != id);
353 return slot;
354}
355
325#define HPA_MSB ((sizeof(hpa_t) * 8) - 1) 356#define HPA_MSB ((sizeof(hpa_t) * 8) - 1)
326#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) 357#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB)
327static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } 358static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; }
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h
index 47a070b0520e..ff476ddaf310 100644
--- a/include/linux/kvm_para.h
+++ b/include/linux/kvm_para.h
@@ -35,4 +35,3 @@ static inline int kvm_para_has_feature(unsigned int feature)
35} 35}
36#endif /* __KERNEL__ */ 36#endif /* __KERNEL__ */
37#endif /* __LINUX_KVM_PARA_H */ 37#endif /* __LINUX_KVM_PARA_H */
38
diff --git a/include/linux/latencytop.h b/include/linux/latencytop.h
index b0e99898527c..e23121f9d82a 100644
--- a/include/linux/latencytop.h
+++ b/include/linux/latencytop.h
@@ -10,6 +10,8 @@
10#define _INCLUDE_GUARD_LATENCYTOP_H_ 10#define _INCLUDE_GUARD_LATENCYTOP_H_
11 11
12#include <linux/compiler.h> 12#include <linux/compiler.h>
13struct task_struct;
14
13#ifdef CONFIG_LATENCYTOP 15#ifdef CONFIG_LATENCYTOP
14 16
15#define LT_SAVECOUNT 32 17#define LT_SAVECOUNT 32
@@ -23,7 +25,6 @@ struct latency_record {
23}; 25};
24 26
25 27
26struct task_struct;
27 28
28extern int latencytop_enabled; 29extern int latencytop_enabled;
29void __account_scheduler_latency(struct task_struct *task, int usecs, int inter); 30void __account_scheduler_latency(struct task_struct *task, int usecs, int inter);
diff --git a/include/linux/leds-tca6507.h b/include/linux/leds-tca6507.h
new file mode 100644
index 000000000000..dcabf4fa2aef
--- /dev/null
+++ b/include/linux/leds-tca6507.h
@@ -0,0 +1,34 @@
1/*
2 * TCA6507 LED chip driver.
3 *
4 * Copyright (C) 2011 Neil Brown <neil@brown.name>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * 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
18 * 02110-1301 USA
19 */
20
21#ifndef __LINUX_TCA6507_H
22#define __LINUX_TCA6507_H
23#include <linux/leds.h>
24
25struct tca6507_platform_data {
26 struct led_platform_data leds;
27#ifdef CONFIG_GPIOLIB
28 int gpio_base;
29 void (*setup)(unsigned gpio_base, unsigned ngpio);
30#endif
31};
32
33#define TCA6507_MAKE_GPIO 1
34#endif /* __LINUX_TCA6507_H*/
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 3f46aedea42f..807f1e533226 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -88,8 +88,4 @@
88 88
89#endif 89#endif
90 90
91#define NORET_TYPE /**/
92#define ATTRIB_NORET __attribute__((noreturn))
93#define NORET_AND noreturn,
94
95#endif 91#endif
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index ff9abff55aa0..88a114fce477 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -195,7 +195,7 @@ extern struct svc_procedure nlmsvc_procedures4[];
195#endif 195#endif
196extern int nlmsvc_grace_period; 196extern int nlmsvc_grace_period;
197extern unsigned long nlmsvc_timeout; 197extern unsigned long nlmsvc_timeout;
198extern int nsm_use_hostnames; 198extern bool nsm_use_hostnames;
199extern u32 nsm_local_state; 199extern u32 nsm_local_state;
200 200
201/* 201/*
@@ -301,7 +301,7 @@ static inline int __nlm_privileged_request4(const struct sockaddr *sap)
301 return ipv4_is_loopback(sin->sin_addr.s_addr); 301 return ipv4_is_loopback(sin->sin_addr.s_addr);
302} 302}
303 303
304#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 304#if IS_ENABLED(CONFIG_IPV6)
305static inline int __nlm_privileged_request6(const struct sockaddr *sap) 305static inline int __nlm_privileged_request6(const struct sockaddr *sap)
306{ 306{
307 const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap; 307 const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;
@@ -314,12 +314,12 @@ static inline int __nlm_privileged_request6(const struct sockaddr *sap)
314 314
315 return ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK; 315 return ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK;
316} 316}
317#else /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 317#else /* IS_ENABLED(CONFIG_IPV6) */
318static inline int __nlm_privileged_request6(const struct sockaddr *sap) 318static inline int __nlm_privileged_request6(const struct sockaddr *sap)
319{ 319{
320 return 0; 320 return 0;
321} 321}
322#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 322#endif /* IS_ENABLED(CONFIG_IPV6) */
323 323
324/* 324/*
325 * Ensure incoming requests are from local privileged callers. 325 * Ensure incoming requests are from local privileged callers.
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index b6a56e37284c..d36619ead3ba 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -343,6 +343,8 @@ extern void lockdep_trace_alloc(gfp_t mask);
343 343
344#define lockdep_assert_held(l) WARN_ON(debug_locks && !lockdep_is_held(l)) 344#define lockdep_assert_held(l) WARN_ON(debug_locks && !lockdep_is_held(l))
345 345
346#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
347
346#else /* !LOCKDEP */ 348#else /* !LOCKDEP */
347 349
348static inline void lockdep_off(void) 350static inline void lockdep_off(void)
@@ -392,6 +394,8 @@ struct lock_class_key { };
392 394
393#define lockdep_assert_held(l) do { } while (0) 395#define lockdep_assert_held(l) do { } while (0)
394 396
397#define lockdep_recursing(tsk) (0)
398
395#endif /* !LOCKDEP */ 399#endif /* !LOCKDEP */
396 400
397#ifdef CONFIG_LOCK_STAT 401#ifdef CONFIG_LOCK_STAT
diff --git a/include/linux/lp8727.h b/include/linux/lp8727.h
new file mode 100644
index 000000000000..d21fa2865bf4
--- /dev/null
+++ b/include/linux/lp8727.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright (C) 2011 National Semiconductor
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef _LP8727_H
10#define _LP8727_H
11
12enum lp8727_eoc_level {
13 EOC_5P,
14 EOC_10P,
15 EOC_16P,
16 EOC_20P,
17 EOC_25P,
18 EOC_33P,
19 EOC_50P,
20};
21
22enum lp8727_ichg {
23 ICHG_90mA,
24 ICHG_100mA,
25 ICHG_400mA,
26 ICHG_450mA,
27 ICHG_500mA,
28 ICHG_600mA,
29 ICHG_700mA,
30 ICHG_800mA,
31 ICHG_900mA,
32 ICHG_1000mA,
33};
34
35struct lp8727_chg_param {
36 /* end of charge level setting */
37 enum lp8727_eoc_level eoc_level;
38 /* charging current */
39 enum lp8727_ichg ichg;
40};
41
42struct lp8727_platform_data {
43 u8 (*get_batt_present)(void);
44 u16 (*get_batt_level)(void);
45 u8 (*get_batt_capacity)(void);
46 u8 (*get_batt_temp)(void);
47 struct lp8727_chg_param ac;
48 struct lp8727_chg_param usb;
49};
50
51#endif
diff --git a/include/linux/mbus.h b/include/linux/mbus.h
index c11ff2932549..efa1a6d7aca8 100644
--- a/include/linux/mbus.h
+++ b/include/linux/mbus.h
@@ -32,5 +32,16 @@ struct mbus_dram_target_info
32 } cs[4]; 32 } cs[4];
33}; 33};
34 34
35 35/*
36 * The Marvell mbus is to be found only on SOCs from the Orion family
37 * at the moment. Provide a dummy stub for other architectures.
38 */
39#ifdef CONFIG_PLAT_ORION
40extern const struct mbus_dram_target_info *mv_mbus_dram_info(void);
41#else
42static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void)
43{
44 return NULL;
45}
46#endif
36#endif 47#endif
diff --git a/include/linux/mdio-bitbang.h b/include/linux/mdio-bitbang.h
index 0fe00cd4c93c..76f52bbbb2f4 100644
--- a/include/linux/mdio-bitbang.h
+++ b/include/linux/mdio-bitbang.h
@@ -32,6 +32,8 @@ struct mdiobb_ops {
32 32
33struct mdiobb_ctrl { 33struct mdiobb_ctrl {
34 const struct mdiobb_ops *ops; 34 const struct mdiobb_ops *ops;
35 /* reset callback */
36 int (*reset)(struct mii_bus *bus);
35}; 37};
36 38
37/* The returned bus is not yet registered with the phy layer. */ 39/* The returned bus is not yet registered with the phy layer. */
diff --git a/include/linux/mdio-gpio.h b/include/linux/mdio-gpio.h
index e9d3fdfe41d7..7c9fe3c2be73 100644
--- a/include/linux/mdio-gpio.h
+++ b/include/linux/mdio-gpio.h
@@ -20,6 +20,8 @@ struct mdio_gpio_platform_data {
20 20
21 unsigned int phy_mask; 21 unsigned int phy_mask;
22 int irqs[PHY_MAX_ADDR]; 22 int irqs[PHY_MAX_ADDR];
23 /* reset callback */
24 int (*reset)(struct mii_bus *bus);
23}; 25};
24 26
25#endif /* __LINUX_MDIO_GPIO_H */ 27#endif /* __LINUX_MDIO_GPIO_H */
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index e6b843e16e81..a6bb10235148 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -2,8 +2,6 @@
2#define _LINUX_MEMBLOCK_H 2#define _LINUX_MEMBLOCK_H
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#define MEMBLOCK_ERROR 0
6
7#ifdef CONFIG_HAVE_MEMBLOCK 5#ifdef CONFIG_HAVE_MEMBLOCK
8/* 6/*
9 * Logical memory blocks. 7 * Logical memory blocks.
@@ -19,81 +17,161 @@
19#include <linux/init.h> 17#include <linux/init.h>
20#include <linux/mm.h> 18#include <linux/mm.h>
21 19
22#include <asm/memblock.h>
23
24#define INIT_MEMBLOCK_REGIONS 128 20#define INIT_MEMBLOCK_REGIONS 128
25 21
26struct memblock_region { 22struct memblock_region {
27 phys_addr_t base; 23 phys_addr_t base;
28 phys_addr_t size; 24 phys_addr_t size;
25#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
26 int nid;
27#endif
29}; 28};
30 29
31struct memblock_type { 30struct memblock_type {
32 unsigned long cnt; /* number of regions */ 31 unsigned long cnt; /* number of regions */
33 unsigned long max; /* size of the allocated array */ 32 unsigned long max; /* size of the allocated array */
33 phys_addr_t total_size; /* size of all regions */
34 struct memblock_region *regions; 34 struct memblock_region *regions;
35}; 35};
36 36
37struct memblock { 37struct memblock {
38 phys_addr_t current_limit; 38 phys_addr_t current_limit;
39 phys_addr_t memory_size; /* Updated by memblock_analyze() */
40 struct memblock_type memory; 39 struct memblock_type memory;
41 struct memblock_type reserved; 40 struct memblock_type reserved;
42}; 41};
43 42
44extern struct memblock memblock; 43extern struct memblock memblock;
45extern int memblock_debug; 44extern int memblock_debug;
46extern int memblock_can_resize;
47 45
48#define memblock_dbg(fmt, ...) \ 46#define memblock_dbg(fmt, ...) \
49 if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 47 if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
50 48
51u64 memblock_find_in_range(u64 start, u64 end, u64 size, u64 align); 49phys_addr_t memblock_find_in_range_node(phys_addr_t start, phys_addr_t end,
50 phys_addr_t size, phys_addr_t align, int nid);
51phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end,
52 phys_addr_t size, phys_addr_t align);
52int memblock_free_reserved_regions(void); 53int memblock_free_reserved_regions(void);
53int memblock_reserve_reserved_regions(void); 54int memblock_reserve_reserved_regions(void);
54 55
55extern void memblock_init(void); 56void memblock_allow_resize(void);
56extern void memblock_analyze(void); 57int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid);
57extern long memblock_add(phys_addr_t base, phys_addr_t size); 58int memblock_add(phys_addr_t base, phys_addr_t size);
58extern long memblock_remove(phys_addr_t base, phys_addr_t size); 59int memblock_remove(phys_addr_t base, phys_addr_t size);
59extern long memblock_free(phys_addr_t base, phys_addr_t size); 60int memblock_free(phys_addr_t base, phys_addr_t size);
60extern long memblock_reserve(phys_addr_t base, phys_addr_t size); 61int memblock_reserve(phys_addr_t base, phys_addr_t size);
62
63#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
64void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
65 unsigned long *out_end_pfn, int *out_nid);
66
67/**
68 * for_each_mem_pfn_range - early memory pfn range iterator
69 * @i: an integer used as loop variable
70 * @nid: node selector, %MAX_NUMNODES for all nodes
71 * @p_start: ptr to ulong for start pfn of the range, can be %NULL
72 * @p_end: ptr to ulong for end pfn of the range, can be %NULL
73 * @p_nid: ptr to int for nid of the range, can be %NULL
74 *
75 * Walks over configured memory ranges. Available after early_node_map is
76 * populated.
77 */
78#define for_each_mem_pfn_range(i, nid, p_start, p_end, p_nid) \
79 for (i = -1, __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid); \
80 i >= 0; __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid))
81#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
82
83void __next_free_mem_range(u64 *idx, int nid, phys_addr_t *out_start,
84 phys_addr_t *out_end, int *out_nid);
85
86/**
87 * for_each_free_mem_range - iterate through free memblock areas
88 * @i: u64 used as loop variable
89 * @nid: node selector, %MAX_NUMNODES for all nodes
90 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL
91 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL
92 * @p_nid: ptr to int for nid of the range, can be %NULL
93 *
94 * Walks over free (memory && !reserved) areas of memblock. Available as
95 * soon as memblock is initialized.
96 */
97#define for_each_free_mem_range(i, nid, p_start, p_end, p_nid) \
98 for (i = 0, \
99 __next_free_mem_range(&i, nid, p_start, p_end, p_nid); \
100 i != (u64)ULLONG_MAX; \
101 __next_free_mem_range(&i, nid, p_start, p_end, p_nid))
102
103void __next_free_mem_range_rev(u64 *idx, int nid, phys_addr_t *out_start,
104 phys_addr_t *out_end, int *out_nid);
61 105
62/* The numa aware allocator is only available if 106/**
63 * CONFIG_ARCH_POPULATES_NODE_MAP is set 107 * for_each_free_mem_range_reverse - rev-iterate through free memblock areas
108 * @i: u64 used as loop variable
109 * @nid: node selector, %MAX_NUMNODES for all nodes
110 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL
111 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL
112 * @p_nid: ptr to int for nid of the range, can be %NULL
113 *
114 * Walks over free (memory && !reserved) areas of memblock in reverse
115 * order. Available as soon as memblock is initialized.
64 */ 116 */
65extern phys_addr_t memblock_alloc_nid(phys_addr_t size, phys_addr_t align, 117#define for_each_free_mem_range_reverse(i, nid, p_start, p_end, p_nid) \
66 int nid); 118 for (i = (u64)ULLONG_MAX, \
67extern phys_addr_t memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, 119 __next_free_mem_range_rev(&i, nid, p_start, p_end, p_nid); \
68 int nid); 120 i != (u64)ULLONG_MAX; \
121 __next_free_mem_range_rev(&i, nid, p_start, p_end, p_nid))
69 122
70extern phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align); 123#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
124int memblock_set_node(phys_addr_t base, phys_addr_t size, int nid);
125
126static inline void memblock_set_region_node(struct memblock_region *r, int nid)
127{
128 r->nid = nid;
129}
130
131static inline int memblock_get_region_node(const struct memblock_region *r)
132{
133 return r->nid;
134}
135#else
136static inline void memblock_set_region_node(struct memblock_region *r, int nid)
137{
138}
139
140static inline int memblock_get_region_node(const struct memblock_region *r)
141{
142 return 0;
143}
144#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
145
146phys_addr_t memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid);
147phys_addr_t memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid);
148
149phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align);
71 150
72/* Flags for memblock_alloc_base() amd __memblock_alloc_base() */ 151/* Flags for memblock_alloc_base() amd __memblock_alloc_base() */
73#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0) 152#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0)
74#define MEMBLOCK_ALLOC_ACCESSIBLE 0 153#define MEMBLOCK_ALLOC_ACCESSIBLE 0
75 154
76extern phys_addr_t memblock_alloc_base(phys_addr_t size, 155phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align,
77 phys_addr_t align, 156 phys_addr_t max_addr);
78 phys_addr_t max_addr); 157phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align,
79extern phys_addr_t __memblock_alloc_base(phys_addr_t size, 158 phys_addr_t max_addr);
80 phys_addr_t align, 159phys_addr_t memblock_phys_mem_size(void);
81 phys_addr_t max_addr); 160phys_addr_t memblock_start_of_DRAM(void);
82extern phys_addr_t memblock_phys_mem_size(void); 161phys_addr_t memblock_end_of_DRAM(void);
83extern phys_addr_t memblock_start_of_DRAM(void); 162void memblock_enforce_memory_limit(phys_addr_t memory_limit);
84extern phys_addr_t memblock_end_of_DRAM(void); 163int memblock_is_memory(phys_addr_t addr);
85extern void memblock_enforce_memory_limit(phys_addr_t memory_limit); 164int memblock_is_region_memory(phys_addr_t base, phys_addr_t size);
86extern int memblock_is_memory(phys_addr_t addr); 165int memblock_is_reserved(phys_addr_t addr);
87extern int memblock_is_region_memory(phys_addr_t base, phys_addr_t size); 166int memblock_is_region_reserved(phys_addr_t base, phys_addr_t size);
88extern int memblock_is_reserved(phys_addr_t addr); 167
89extern int memblock_is_region_reserved(phys_addr_t base, phys_addr_t size); 168extern void __memblock_dump_all(void);
90 169
91extern void memblock_dump_all(void); 170static inline void memblock_dump_all(void)
92 171{
93/* Provided by the architecture */ 172 if (memblock_debug)
94extern phys_addr_t memblock_nid_range(phys_addr_t start, phys_addr_t end, int *nid); 173 __memblock_dump_all();
95extern int memblock_memory_can_coalesce(phys_addr_t addr1, phys_addr_t size1, 174}
96 phys_addr_t addr2, phys_addr_t size2);
97 175
98/** 176/**
99 * memblock_set_current_limit - Set the current allocation limit to allow 177 * memblock_set_current_limit - Set the current allocation limit to allow
@@ -101,7 +179,7 @@ extern int memblock_memory_can_coalesce(phys_addr_t addr1, phys_addr_t size1,
101 * accessible during boot 179 * accessible during boot
102 * @limit: New limit value (physical address) 180 * @limit: New limit value (physical address)
103 */ 181 */
104extern void memblock_set_current_limit(phys_addr_t limit); 182void memblock_set_current_limit(phys_addr_t limit);
105 183
106 184
107/* 185/*
@@ -154,9 +232,9 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo
154 region++) 232 region++)
155 233
156 234
157#ifdef ARCH_DISCARD_MEMBLOCK 235#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK
158#define __init_memblock __init 236#define __init_memblock __meminit
159#define __initdata_memblock __initdata 237#define __initdata_memblock __meminitdata
160#else 238#else
161#define __init_memblock 239#define __init_memblock
162#define __initdata_memblock 240#define __initdata_memblock
@@ -165,7 +243,7 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo
165#else 243#else
166static inline phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align) 244static inline phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align)
167{ 245{
168 return MEMBLOCK_ERROR; 246 return 0;
169} 247}
170 248
171#endif /* CONFIG_HAVE_MEMBLOCK */ 249#endif /* CONFIG_HAVE_MEMBLOCK */
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index b87068a1a09e..b80de520670b 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -32,13 +32,11 @@ enum mem_cgroup_page_stat_item {
32 MEMCG_NR_FILE_MAPPED, /* # of pages charged as file rss */ 32 MEMCG_NR_FILE_MAPPED, /* # of pages charged as file rss */
33}; 33};
34 34
35extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, 35struct mem_cgroup_reclaim_cookie {
36 struct list_head *dst, 36 struct zone *zone;
37 unsigned long *scanned, int order, 37 int priority;
38 isolate_mode_t mode, 38 unsigned int generation;
39 struct zone *z, 39};
40 struct mem_cgroup *mem_cont,
41 int active, int file);
42 40
43#ifdef CONFIG_CGROUP_MEM_RES_CTLR 41#ifdef CONFIG_CGROUP_MEM_RES_CTLR
44/* 42/*
@@ -56,20 +54,21 @@ extern int mem_cgroup_newpage_charge(struct page *page, struct mm_struct *mm,
56 gfp_t gfp_mask); 54 gfp_t gfp_mask);
57/* for swap handling */ 55/* for swap handling */
58extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm, 56extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
59 struct page *page, gfp_t mask, struct mem_cgroup **ptr); 57 struct page *page, gfp_t mask, struct mem_cgroup **memcgp);
60extern void mem_cgroup_commit_charge_swapin(struct page *page, 58extern void mem_cgroup_commit_charge_swapin(struct page *page,
61 struct mem_cgroup *ptr); 59 struct mem_cgroup *memcg);
62extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *ptr); 60extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg);
63 61
64extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, 62extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
65 gfp_t gfp_mask); 63 gfp_t gfp_mask);
66extern void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru); 64
67extern void mem_cgroup_del_lru_list(struct page *page, enum lru_list lru); 65struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *);
68extern void mem_cgroup_rotate_reclaimable_page(struct page *page); 66struct lruvec *mem_cgroup_lru_add_list(struct zone *, struct page *,
69extern void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru); 67 enum lru_list);
70extern void mem_cgroup_del_lru(struct page *page); 68void mem_cgroup_lru_del_list(struct page *, enum lru_list);
71extern void mem_cgroup_move_lists(struct page *page, 69void mem_cgroup_lru_del(struct page *);
72 enum lru_list from, enum lru_list to); 70struct lruvec *mem_cgroup_lru_move_lists(struct zone *, struct page *,
71 enum lru_list, enum lru_list);
73 72
74/* For coalescing uncharge for reducing memcg' overhead*/ 73/* For coalescing uncharge for reducing memcg' overhead*/
75extern void mem_cgroup_uncharge_start(void); 74extern void mem_cgroup_uncharge_start(void);
@@ -85,6 +84,9 @@ extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page);
85extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); 84extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
86extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm); 85extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm);
87 86
87extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg);
88extern struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont);
89
88static inline 90static inline
89int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup) 91int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
90{ 92{
@@ -99,10 +101,15 @@ extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *memcg);
99 101
100extern int 102extern int
101mem_cgroup_prepare_migration(struct page *page, 103mem_cgroup_prepare_migration(struct page *page,
102 struct page *newpage, struct mem_cgroup **ptr, gfp_t gfp_mask); 104 struct page *newpage, struct mem_cgroup **memcgp, gfp_t gfp_mask);
103extern void mem_cgroup_end_migration(struct mem_cgroup *memcg, 105extern void mem_cgroup_end_migration(struct mem_cgroup *memcg,
104 struct page *oldpage, struct page *newpage, bool migration_ok); 106 struct page *oldpage, struct page *newpage, bool migration_ok);
105 107
108struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *,
109 struct mem_cgroup *,
110 struct mem_cgroup_reclaim_cookie *);
111void mem_cgroup_iter_break(struct mem_cgroup *, struct mem_cgroup *);
112
106/* 113/*
107 * For memory reclaim. 114 * For memory reclaim.
108 */ 115 */
@@ -119,6 +126,8 @@ struct zone_reclaim_stat*
119mem_cgroup_get_reclaim_stat_from_page(struct page *page); 126mem_cgroup_get_reclaim_stat_from_page(struct page *page);
120extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, 127extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
121 struct task_struct *p); 128 struct task_struct *p);
129extern void mem_cgroup_replace_page_cache(struct page *oldpage,
130 struct page *newpage);
122 131
123#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP 132#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
124extern int do_swap_account; 133extern int do_swap_account;
@@ -154,7 +163,7 @@ u64 mem_cgroup_get_limit(struct mem_cgroup *memcg);
154 163
155void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx); 164void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx);
156#ifdef CONFIG_TRANSPARENT_HUGEPAGE 165#ifdef CONFIG_TRANSPARENT_HUGEPAGE
157void mem_cgroup_split_huge_fixup(struct page *head, struct page *tail); 166void mem_cgroup_split_huge_fixup(struct page *head);
158#endif 167#endif
159 168
160#ifdef CONFIG_DEBUG_VM 169#ifdef CONFIG_DEBUG_VM
@@ -177,17 +186,17 @@ static inline int mem_cgroup_cache_charge(struct page *page,
177} 186}
178 187
179static inline int mem_cgroup_try_charge_swapin(struct mm_struct *mm, 188static inline int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
180 struct page *page, gfp_t gfp_mask, struct mem_cgroup **ptr) 189 struct page *page, gfp_t gfp_mask, struct mem_cgroup **memcgp)
181{ 190{
182 return 0; 191 return 0;
183} 192}
184 193
185static inline void mem_cgroup_commit_charge_swapin(struct page *page, 194static inline void mem_cgroup_commit_charge_swapin(struct page *page,
186 struct mem_cgroup *ptr) 195 struct mem_cgroup *memcg)
187{ 196{
188} 197}
189 198
190static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *ptr) 199static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg)
191{ 200{
192} 201}
193 202
@@ -207,33 +216,33 @@ static inline void mem_cgroup_uncharge_cache_page(struct page *page)
207{ 216{
208} 217}
209 218
210static inline void mem_cgroup_add_lru_list(struct page *page, int lru) 219static inline struct lruvec *mem_cgroup_zone_lruvec(struct zone *zone,
211{ 220 struct mem_cgroup *memcg)
212}
213
214static inline void mem_cgroup_del_lru_list(struct page *page, int lru)
215{ 221{
216 return ; 222 return &zone->lruvec;
217} 223}
218 224
219static inline void mem_cgroup_rotate_reclaimable_page(struct page *page) 225static inline struct lruvec *mem_cgroup_lru_add_list(struct zone *zone,
226 struct page *page,
227 enum lru_list lru)
220{ 228{
221 return ; 229 return &zone->lruvec;
222} 230}
223 231
224static inline void mem_cgroup_rotate_lru_list(struct page *page, int lru) 232static inline void mem_cgroup_lru_del_list(struct page *page, enum lru_list lru)
225{ 233{
226 return ;
227} 234}
228 235
229static inline void mem_cgroup_del_lru(struct page *page) 236static inline void mem_cgroup_lru_del(struct page *page)
230{ 237{
231 return ;
232} 238}
233 239
234static inline void 240static inline struct lruvec *mem_cgroup_lru_move_lists(struct zone *zone,
235mem_cgroup_move_lists(struct page *page, enum lru_list from, enum lru_list to) 241 struct page *page,
242 enum lru_list from,
243 enum lru_list to)
236{ 244{
245 return &zone->lruvec;
237} 246}
238 247
239static inline struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page) 248static inline struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page)
@@ -266,7 +275,7 @@ static inline struct cgroup_subsys_state
266 275
267static inline int 276static inline int
268mem_cgroup_prepare_migration(struct page *page, struct page *newpage, 277mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
269 struct mem_cgroup **ptr, gfp_t gfp_mask) 278 struct mem_cgroup **memcgp, gfp_t gfp_mask)
270{ 279{
271 return 0; 280 return 0;
272} 281}
@@ -276,6 +285,19 @@ static inline void mem_cgroup_end_migration(struct mem_cgroup *memcg,
276{ 285{
277} 286}
278 287
288static inline struct mem_cgroup *
289mem_cgroup_iter(struct mem_cgroup *root,
290 struct mem_cgroup *prev,
291 struct mem_cgroup_reclaim_cookie *reclaim)
292{
293 return NULL;
294}
295
296static inline void mem_cgroup_iter_break(struct mem_cgroup *root,
297 struct mem_cgroup *prev)
298{
299}
300
279static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *memcg) 301static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *memcg)
280{ 302{
281 return 0; 303 return 0;
@@ -357,8 +379,7 @@ u64 mem_cgroup_get_limit(struct mem_cgroup *memcg)
357 return 0; 379 return 0;
358} 380}
359 381
360static inline void mem_cgroup_split_huge_fixup(struct page *head, 382static inline void mem_cgroup_split_huge_fixup(struct page *head)
361 struct page *tail)
362{ 383{
363} 384}
364 385
@@ -366,6 +387,10 @@ static inline
366void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx) 387void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx)
367{ 388{
368} 389}
390static inline void mem_cgroup_replace_page_cache(struct page *oldpage,
391 struct page *newpage)
392{
393}
369#endif /* CONFIG_CGROUP_MEM_CONT */ 394#endif /* CONFIG_CGROUP_MEM_CONT */
370 395
371#if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM) 396#if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM)
@@ -381,5 +406,23 @@ mem_cgroup_print_bad_page(struct page *page)
381} 406}
382#endif 407#endif
383 408
409enum {
410 UNDER_LIMIT,
411 SOFT_LIMIT,
412 OVER_LIMIT,
413};
414
415struct sock;
416#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
417void sock_update_memcg(struct sock *sk);
418void sock_release_memcg(struct sock *sk);
419#else
420static inline void sock_update_memcg(struct sock *sk)
421{
422}
423static inline void sock_release_memcg(struct sock *sk)
424{
425}
426#endif /* CONFIG_CGROUP_MEM_RES_CTLR_KMEM */
384#endif /* _LINUX_MEMCONTROL_H */ 427#endif /* _LINUX_MEMCONTROL_H */
385 428
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 935699b30b7c..1ac7f6e405f9 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -15,7 +15,6 @@
15#ifndef _LINUX_MEMORY_H_ 15#ifndef _LINUX_MEMORY_H_
16#define _LINUX_MEMORY_H_ 16#define _LINUX_MEMORY_H_
17 17
18#include <linux/sysdev.h>
19#include <linux/node.h> 18#include <linux/node.h>
20#include <linux/compiler.h> 19#include <linux/compiler.h>
21#include <linux/mutex.h> 20#include <linux/mutex.h>
@@ -38,7 +37,7 @@ struct memory_block {
38 int phys_device; /* to which fru does this belong? */ 37 int phys_device; /* to which fru does this belong? */
39 void *hw; /* optional pointer to fw/hw data */ 38 void *hw; /* optional pointer to fw/hw data */
40 int (*phys_callback)(struct memory_block *); 39 int (*phys_callback)(struct memory_block *);
41 struct sys_device sysdev; 40 struct device dev;
42}; 41};
43 42
44int arch_get_memory_phys_device(unsigned long start_pfn); 43int arch_get_memory_phys_device(unsigned long start_pfn);
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 7978eec1b7d9..7c727a90d70d 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -164,11 +164,11 @@ static inline void mpol_get(struct mempolicy *pol)
164 atomic_inc(&pol->refcnt); 164 atomic_inc(&pol->refcnt);
165} 165}
166 166
167extern int __mpol_equal(struct mempolicy *a, struct mempolicy *b); 167extern bool __mpol_equal(struct mempolicy *a, struct mempolicy *b);
168static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b) 168static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b)
169{ 169{
170 if (a == b) 170 if (a == b)
171 return 1; 171 return true;
172 return __mpol_equal(a, b); 172 return __mpol_equal(a, b);
173} 173}
174 174
@@ -257,9 +257,9 @@ static inline int vma_migratable(struct vm_area_struct *vma)
257 257
258struct mempolicy {}; 258struct mempolicy {};
259 259
260static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b) 260static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b)
261{ 261{
262 return 1; 262 return true;
263} 263}
264 264
265static inline void mpol_put(struct mempolicy *p) 265static inline void mpol_put(struct mempolicy *p)
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h
index 63b4fb8e3b6f..92be3476c9f5 100644
--- a/include/linux/mfd/88pm860x.h
+++ b/include/linux/mfd/88pm860x.h
@@ -297,10 +297,11 @@ enum {
297 297
298struct pm860x_chip { 298struct pm860x_chip {
299 struct device *dev; 299 struct device *dev;
300 struct mutex io_lock;
301 struct mutex irq_lock; 300 struct mutex irq_lock;
302 struct i2c_client *client; 301 struct i2c_client *client;
303 struct i2c_client *companion; /* companion chip client */ 302 struct i2c_client *companion; /* companion chip client */
303 struct regmap *regmap;
304 struct regmap *regmap_companion;
304 305
305 int buck3_double; /* DVC ramp slope double */ 306 int buck3_double; /* DVC ramp slope double */
306 unsigned short companion_addr; 307 unsigned short companion_addr;
diff --git a/include/linux/mfd/ab5500/ab5500.h b/include/linux/mfd/abx500/ab5500.h
index a720051ae933..a720051ae933 100644
--- a/include/linux/mfd/ab5500/ab5500.h
+++ b/include/linux/mfd/abx500/ab5500.h
diff --git a/include/linux/mfd/ab8500/gpadc.h b/include/linux/mfd/abx500/ab8500-gpadc.h
index 252966769d93..252966769d93 100644
--- a/include/linux/mfd/ab8500/gpadc.h
+++ b/include/linux/mfd/abx500/ab8500-gpadc.h
diff --git a/include/linux/mfd/ab8500/gpio.h b/include/linux/mfd/abx500/ab8500-gpio.h
index 488a8c920a29..488a8c920a29 100644
--- a/include/linux/mfd/ab8500/gpio.h
+++ b/include/linux/mfd/abx500/ab8500-gpio.h
diff --git a/include/linux/mfd/ab8500/sysctrl.h b/include/linux/mfd/abx500/ab8500-sysctrl.h
index 10da0291f8f8..10da0291f8f8 100644
--- a/include/linux/mfd/ab8500/sysctrl.h
+++ b/include/linux/mfd/abx500/ab8500-sysctrl.h
diff --git a/include/linux/mfd/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 838c6b487cc5..838c6b487cc5 100644
--- a/include/linux/mfd/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
new file mode 100644
index 000000000000..5702d1be13b4
--- /dev/null
+++ b/include/linux/mfd/da9052/da9052.h
@@ -0,0 +1,131 @@
1/*
2 * da9052 declarations for DA9052 PMICs.
3 *
4 * Copyright(c) 2011 Dialog Semiconductor Ltd.
5 *
6 * Author: David Dajun Chen <dchen@diasemi.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#ifndef __MFD_DA9052_DA9052_H
25#define __MFD_DA9052_DA9052_H
26
27#include <linux/interrupt.h>
28#include <linux/regmap.h>
29#include <linux/slab.h>
30#include <linux/completion.h>
31#include <linux/list.h>
32#include <linux/mfd/core.h>
33
34#include <linux/mfd/da9052/reg.h>
35
36#define DA9052_IRQ_DCIN 0
37#define DA9052_IRQ_VBUS 1
38#define DA9052_IRQ_DCINREM 2
39#define DA9052_IRQ_VBUSREM 3
40#define DA9052_IRQ_VDDLOW 4
41#define DA9052_IRQ_ALARM 5
42#define DA9052_IRQ_SEQRDY 6
43#define DA9052_IRQ_COMP1V2 7
44#define DA9052_IRQ_NONKEY 8
45#define DA9052_IRQ_IDFLOAT 9
46#define DA9052_IRQ_IDGND 10
47#define DA9052_IRQ_CHGEND 11
48#define DA9052_IRQ_TBAT 12
49#define DA9052_IRQ_ADC_EOM 13
50#define DA9052_IRQ_PENDOWN 14
51#define DA9052_IRQ_TSIREADY 15
52#define DA9052_IRQ_GPI0 16
53#define DA9052_IRQ_GPI1 17
54#define DA9052_IRQ_GPI2 18
55#define DA9052_IRQ_GPI3 19
56#define DA9052_IRQ_GPI4 20
57#define DA9052_IRQ_GPI5 21
58#define DA9052_IRQ_GPI6 22
59#define DA9052_IRQ_GPI7 23
60#define DA9052_IRQ_GPI8 24
61#define DA9052_IRQ_GPI9 25
62#define DA9052_IRQ_GPI10 26
63#define DA9052_IRQ_GPI11 27
64#define DA9052_IRQ_GPI12 28
65#define DA9052_IRQ_GPI13 29
66#define DA9052_IRQ_GPI14 30
67#define DA9052_IRQ_GPI15 31
68
69enum da9052_chip_id {
70 DA9052,
71 DA9053_AA,
72 DA9053_BA,
73 DA9053_BB,
74};
75
76struct da9052_pdata;
77
78struct da9052 {
79 struct mutex io_lock;
80
81 struct device *dev;
82 struct regmap *regmap;
83
84 int irq_base;
85 u8 chip_id;
86
87 int chip_irq;
88};
89
90/* Device I/O API */
91static inline int da9052_reg_read(struct da9052 *da9052, unsigned char reg)
92{
93 int val, ret;
94
95 ret = regmap_read(da9052->regmap, reg, &val);
96 if (ret < 0)
97 return ret;
98 return val;
99}
100
101static inline int da9052_reg_write(struct da9052 *da9052, unsigned char reg,
102 unsigned char val)
103{
104 return regmap_write(da9052->regmap, reg, val);
105}
106
107static inline int da9052_group_read(struct da9052 *da9052, unsigned char reg,
108 unsigned reg_cnt, unsigned char *val)
109{
110 return regmap_bulk_read(da9052->regmap, reg, val, reg_cnt);
111}
112
113static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg,
114 unsigned reg_cnt, unsigned char *val)
115{
116 return regmap_raw_write(da9052->regmap, reg, val, reg_cnt);
117}
118
119static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg,
120 unsigned char bit_mask,
121 unsigned char reg_val)
122{
123 return regmap_update_bits(da9052->regmap, reg, bit_mask, reg_val);
124}
125
126int da9052_device_init(struct da9052 *da9052, u8 chip_id);
127void da9052_device_exit(struct da9052 *da9052);
128
129extern struct regmap_config da9052_regmap_config;
130
131#endif /* __MFD_DA9052_DA9052_H */
diff --git a/include/linux/mfd/da9052/pdata.h b/include/linux/mfd/da9052/pdata.h
new file mode 100644
index 000000000000..62c5c3c2992e
--- /dev/null
+++ b/include/linux/mfd/da9052/pdata.h
@@ -0,0 +1,40 @@
1/*
2 * Platform data declarations for DA9052 PMICs.
3 *
4 * Copyright(c) 2011 Dialog Semiconductor Ltd.
5 *
6 * Author: David Dajun Chen <dchen@diasemi.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#ifndef __MFD_DA9052_PDATA_H__
25#define __MFD_DA9052_PDATA_H__
26
27#define DA9052_MAX_REGULATORS 14
28
29struct da9052;
30
31struct da9052_pdata {
32 struct led_platform_data *pled;
33 int (*init) (struct da9052 *da9052);
34 int irq_base;
35 int gpio_base;
36 int use_for_apm;
37 struct regulator_init_data *regulators[DA9052_MAX_REGULATORS];
38};
39
40#endif
diff --git a/include/linux/mfd/da9052/reg.h b/include/linux/mfd/da9052/reg.h
new file mode 100644
index 000000000000..b97f7309d7f6
--- /dev/null
+++ b/include/linux/mfd/da9052/reg.h
@@ -0,0 +1,749 @@
1/*
2 * Register declarations for DA9052 PMICs.
3 *
4 * Copyright(c) 2011 Dialog Semiconductor Ltd.
5 *
6 * Author: David Dajun Chen <dchen@diasemi.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#ifndef __LINUX_MFD_DA9052_REG_H
25#define __LINUX_MFD_DA9052_REG_H
26
27/* PAGE REGISTERS */
28#define DA9052_PAGE0_CON_REG 0
29#define DA9052_PAGE1_CON_REG 128
30
31/* STATUS REGISTERS */
32#define DA9052_STATUS_A_REG 1
33#define DA9052_STATUS_B_REG 2
34#define DA9052_STATUS_C_REG 3
35#define DA9052_STATUS_D_REG 4
36
37/* EVENT REGISTERS */
38#define DA9052_EVENT_A_REG 5
39#define DA9052_EVENT_B_REG 6
40#define DA9052_EVENT_C_REG 7
41#define DA9052_EVENT_D_REG 8
42#define DA9052_FAULTLOG_REG 9
43
44/* IRQ REGISTERS */
45#define DA9052_IRQ_MASK_A_REG 10
46#define DA9052_IRQ_MASK_B_REG 11
47#define DA9052_IRQ_MASK_C_REG 12
48#define DA9052_IRQ_MASK_D_REG 13
49
50/* CONTROL REGISTERS */
51#define DA9052_CONTROL_A_REG 14
52#define DA9052_CONTROL_B_REG 15
53#define DA9052_CONTROL_C_REG 16
54#define DA9052_CONTROL_D_REG 17
55
56#define DA9052_PDDIS_REG 18
57#define DA9052_INTERFACE_REG 19
58#define DA9052_RESET_REG 20
59
60/* GPIO REGISTERS */
61#define DA9052_GPIO_0_1_REG 21
62#define DA9052_GPIO_2_3_REG 22
63#define DA9052_GPIO_4_5_REG 23
64#define DA9052_GPIO_6_7_REG 24
65#define DA9052_GPIO_14_15_REG 28
66
67/* POWER SEQUENCER CONTROL REGISTERS */
68#define DA9052_ID_0_1_REG 29
69#define DA9052_ID_2_3_REG 30
70#define DA9052_ID_4_5_REG 31
71#define DA9052_ID_6_7_REG 32
72#define DA9052_ID_8_9_REG 33
73#define DA9052_ID_10_11_REG 34
74#define DA9052_ID_12_13_REG 35
75#define DA9052_ID_14_15_REG 36
76#define DA9052_ID_16_17_REG 37
77#define DA9052_ID_18_19_REG 38
78#define DA9052_ID_20_21_REG 39
79#define DA9052_SEQ_STATUS_REG 40
80#define DA9052_SEQ_A_REG 41
81#define DA9052_SEQ_B_REG 42
82#define DA9052_SEQ_TIMER_REG 43
83
84/* LDO AND BUCK REGISTERS */
85#define DA9052_BUCKA_REG 44
86#define DA9052_BUCKB_REG 45
87#define DA9052_BUCKCORE_REG 46
88#define DA9052_BUCKPRO_REG 47
89#define DA9052_BUCKMEM_REG 48
90#define DA9052_BUCKPERI_REG 49
91#define DA9052_LDO1_REG 50
92#define DA9052_LDO2_REG 51
93#define DA9052_LDO3_REG 52
94#define DA9052_LDO4_REG 53
95#define DA9052_LDO5_REG 54
96#define DA9052_LDO6_REG 55
97#define DA9052_LDO7_REG 56
98#define DA9052_LDO8_REG 57
99#define DA9052_LDO9_REG 58
100#define DA9052_LDO10_REG 59
101#define DA9052_SUPPLY_REG 60
102#define DA9052_PULLDOWN_REG 61
103#define DA9052_CHGBUCK_REG 62
104#define DA9052_WAITCONT_REG 63
105#define DA9052_ISET_REG 64
106#define DA9052_BATCHG_REG 65
107
108/* BATTERY CONTROL REGISTRS */
109#define DA9052_CHG_CONT_REG 66
110#define DA9052_INPUT_CONT_REG 67
111#define DA9052_CHG_TIME_REG 68
112#define DA9052_BBAT_CONT_REG 69
113
114/* LED CONTROL REGISTERS */
115#define DA9052_BOOST_REG 70
116#define DA9052_LED_CONT_REG 71
117#define DA9052_LEDMIN123_REG 72
118#define DA9052_LED1_CONF_REG 73
119#define DA9052_LED2_CONF_REG 74
120#define DA9052_LED3_CONF_REG 75
121#define DA9052_LED1CONT_REG 76
122#define DA9052_LED2CONT_REG 77
123#define DA9052_LED3CONT_REG 78
124#define DA9052_LED_CONT_4_REG 79
125#define DA9052_LED_CONT_5_REG 80
126
127/* ADC CONTROL REGISTERS */
128#define DA9052_ADC_MAN_REG 81
129#define DA9052_ADC_CONT_REG 82
130#define DA9052_ADC_RES_L_REG 83
131#define DA9052_ADC_RES_H_REG 84
132#define DA9052_VDD_RES_REG 85
133#define DA9052_VDD_MON_REG 86
134
135#define DA9052_ICHG_AV_REG 87
136#define DA9052_ICHG_THD_REG 88
137#define DA9052_ICHG_END_REG 89
138#define DA9052_TBAT_RES_REG 90
139#define DA9052_TBAT_HIGHP_REG 91
140#define DA9052_TBAT_HIGHN_REG 92
141#define DA9052_TBAT_LOW_REG 93
142#define DA9052_T_OFFSET_REG 94
143
144#define DA9052_ADCIN4_RES_REG 95
145#define DA9052_AUTO4_HIGH_REG 96
146#define DA9052_AUTO4_LOW_REG 97
147#define DA9052_ADCIN5_RES_REG 98
148#define DA9052_AUTO5_HIGH_REG 99
149#define DA9052_AUTO5_LOW_REG 100
150#define DA9052_ADCIN6_RES_REG 101
151#define DA9052_AUTO6_HIGH_REG 102
152#define DA9052_AUTO6_LOW_REG 103
153
154#define DA9052_TJUNC_RES_REG 104
155
156/* TSI CONTROL REGISTERS */
157#define DA9052_TSI_CONT_A_REG 105
158#define DA9052_TSI_CONT_B_REG 106
159#define DA9052_TSI_X_MSB_REG 107
160#define DA9052_TSI_Y_MSB_REG 108
161#define DA9052_TSI_LSB_REG 109
162#define DA9052_TSI_Z_MSB_REG 110
163
164/* RTC COUNT REGISTERS */
165#define DA9052_COUNT_S_REG 111
166#define DA9052_COUNT_MI_REG 112
167#define DA9052_COUNT_H_REG 113
168#define DA9052_COUNT_D_REG 114
169#define DA9052_COUNT_MO_REG 115
170#define DA9052_COUNT_Y_REG 116
171
172/* RTC CONTROL REGISTERS */
173#define DA9052_ALARM_MI_REG 117
174#define DA9052_ALARM_H_REG 118
175#define DA9052_ALARM_D_REG 119
176#define DA9052_ALARM_MO_REG 120
177#define DA9052_ALARM_Y_REG 121
178#define DA9052_SECOND_A_REG 122
179#define DA9052_SECOND_B_REG 123
180#define DA9052_SECOND_C_REG 124
181#define DA9052_SECOND_D_REG 125
182
183/* PAGE CONFIGURATION BIT */
184#define DA9052_PAGE_CONF 0X80
185
186/* STATUS REGISTER A BITS */
187#define DA9052_STATUSA_VDATDET 0X80
188#define DA9052_STATUSA_VBUSSEL 0X40
189#define DA9052_STATUSA_DCINSEL 0X20
190#define DA9052_STATUSA_VBUSDET 0X10
191#define DA9052_STATUSA_DCINDET 0X08
192#define DA9052_STATUSA_IDGND 0X04
193#define DA9052_STATUSA_IDFLOAT 0X02
194#define DA9052_STATUSA_NONKEY 0X01
195
196/* STATUS REGISTER B BITS */
197#define DA9052_STATUSB_COMPDET 0X80
198#define DA9052_STATUSB_SEQUENCING 0X40
199#define DA9052_STATUSB_GPFB2 0X20
200#define DA9052_STATUSB_CHGTO 0X10
201#define DA9052_STATUSB_CHGEND 0X08
202#define DA9052_STATUSB_CHGLIM 0X04
203#define DA9052_STATUSB_CHGPRE 0X02
204#define DA9052_STATUSB_CHGATT 0X01
205
206/* STATUS REGISTER C BITS */
207#define DA9052_STATUSC_GPI7 0X80
208#define DA9052_STATUSC_GPI6 0X40
209#define DA9052_STATUSC_GPI5 0X20
210#define DA9052_STATUSC_GPI4 0X10
211#define DA9052_STATUSC_GPI3 0X08
212#define DA9052_STATUSC_GPI2 0X04
213#define DA9052_STATUSC_GPI1 0X02
214#define DA9052_STATUSC_GPI0 0X01
215
216/* STATUS REGISTER D BITS */
217#define DA9052_STATUSD_GPI15 0X80
218#define DA9052_STATUSD_GPI14 0X40
219#define DA9052_STATUSD_GPI13 0X20
220#define DA9052_STATUSD_GPI12 0X10
221#define DA9052_STATUSD_GPI11 0X08
222#define DA9052_STATUSD_GPI10 0X04
223#define DA9052_STATUSD_GPI9 0X02
224#define DA9052_STATUSD_GPI8 0X01
225
226/* EVENT REGISTER A BITS */
227#define DA9052_EVENTA_ECOMP1V2 0X80
228#define DA9052_EVENTA_ESEQRDY 0X40
229#define DA9052_EVENTA_EALRAM 0X20
230#define DA9052_EVENTA_EVDDLOW 0X10
231#define DA9052_EVENTA_EVBUSREM 0X08
232#define DA9052_EVENTA_EDCINREM 0X04
233#define DA9052_EVENTA_EVBUSDET 0X02
234#define DA9052_EVENTA_EDCINDET 0X01
235
236/* EVENT REGISTER B BITS */
237#define DA9052_EVENTB_ETSIREADY 0X80
238#define DA9052_EVENTB_EPENDOWN 0X40
239#define DA9052_EVENTB_EADCEOM 0X20
240#define DA9052_EVENTB_ETBAT 0X10
241#define DA9052_EVENTB_ECHGEND 0X08
242#define DA9052_EVENTB_EIDGND 0X04
243#define DA9052_EVENTB_EIDFLOAT 0X02
244#define DA9052_EVENTB_ENONKEY 0X01
245
246/* EVENT REGISTER C BITS */
247#define DA9052_EVENTC_EGPI7 0X80
248#define DA9052_EVENTC_EGPI6 0X40
249#define DA9052_EVENTC_EGPI5 0X20
250#define DA9052_EVENTC_EGPI4 0X10
251#define DA9052_EVENTC_EGPI3 0X08
252#define DA9052_EVENTC_EGPI2 0X04
253#define DA9052_EVENTC_EGPI1 0X02
254#define DA9052_EVENTC_EGPI0 0X01
255
256/* EVENT REGISTER D BITS */
257#define DA9052_EVENTD_EGPI15 0X80
258#define DA9052_EVENTD_EGPI14 0X40
259#define DA9052_EVENTD_EGPI13 0X20
260#define DA9052_EVENTD_EGPI12 0X10
261#define DA9052_EVENTD_EGPI11 0X08
262#define DA9052_EVENTD_EGPI10 0X04
263#define DA9052_EVENTD_EGPI9 0X02
264#define DA9052_EVENTD_EGPI8 0X01
265
266/* IRQ MASK REGISTERS BITS */
267#define DA9052_M_NONKEY 0X0100
268
269/* TSI EVENT REGISTERS BITS */
270#define DA9052_E_PEN_DOWN 0X4000
271#define DA9052_E_TSI_READY 0X8000
272
273/* FAULT LOG REGISTER BITS */
274#define DA9052_FAULTLOG_WAITSET 0X80
275#define DA9052_FAULTLOG_NSDSET 0X40
276#define DA9052_FAULTLOG_KEYSHUT 0X20
277#define DA9052_FAULTLOG_TEMPOVER 0X08
278#define DA9052_FAULTLOG_VDDSTART 0X04
279#define DA9052_FAULTLOG_VDDFAULT 0X02
280#define DA9052_FAULTLOG_TWDERROR 0X01
281
282/* CONTROL REGISTER A BITS */
283#define DA9052_CONTROLA_GPIV 0X80
284#define DA9052_CONTROLA_PMOTYPE 0X20
285#define DA9052_CONTROLA_PMOV 0X10
286#define DA9052_CONTROLA_PMIV 0X08
287#define DA9052_CONTROLA_PMIFV 0X08
288#define DA9052_CONTROLA_PWR1EN 0X04
289#define DA9052_CONTROLA_PWREN 0X02
290#define DA9052_CONTROLA_SYSEN 0X01
291
292/* CONTROL REGISTER B BITS */
293#define DA9052_CONTROLB_SHUTDOWN 0X80
294#define DA9052_CONTROLB_DEEPSLEEP 0X40
295#define DA9052_CONTROL_B_WRITEMODE 0X20
296#define DA9052_CONTROLB_BBATEN 0X10
297#define DA9052_CONTROLB_OTPREADEN 0X08
298#define DA9052_CONTROLB_AUTOBOOT 0X04
299#define DA9052_CONTROLB_ACTDIODE 0X02
300#define DA9052_CONTROLB_BUCKMERGE 0X01
301
302/* CONTROL REGISTER C BITS */
303#define DA9052_CONTROLC_BLINKDUR 0X80
304#define DA9052_CONTROLC_BLINKFRQ 0X60
305#define DA9052_CONTROLC_DEBOUNCING 0X1C
306#define DA9052_CONTROLC_PMFB2PIN 0X02
307#define DA9052_CONTROLC_PMFB1PIN 0X01
308
309/* CONTROL REGISTER D BITS */
310#define DA9052_CONTROLD_WATCHDOG 0X80
311#define DA9052_CONTROLD_ACCDETEN 0X40
312#define DA9052_CONTROLD_GPI1415SD 0X20
313#define DA9052_CONTROLD_NONKEYSD 0X10
314#define DA9052_CONTROLD_KEEPACTEN 0X08
315#define DA9052_CONTROLD_TWDSCALE 0X07
316
317/* POWER DOWN DISABLE REGISTER BITS */
318#define DA9052_PDDIS_PMCONTPD 0X80
319#define DA9052_PDDIS_OUT32KPD 0X40
320#define DA9052_PDDIS_CHGBBATPD 0X20
321#define DA9052_PDDIS_CHGPD 0X10
322#define DA9052_PDDIS_HS2WIREPD 0X08
323#define DA9052_PDDIS_PMIFPD 0X04
324#define DA9052_PDDIS_GPADCPD 0X02
325#define DA9052_PDDIS_GPIOPD 0X01
326
327/* CONTROL REGISTER D BITS */
328#define DA9052_INTERFACE_IFBASEADDR 0XE0
329#define DA9052_INTERFACE_NCSPOL 0X10
330#define DA9052_INTERFACE_RWPOL 0X08
331#define DA9052_INTERFACE_CPHA 0X04
332#define DA9052_INTERFACE_CPOL 0X02
333#define DA9052_INTERFACE_IFTYPE 0X01
334
335/* CONTROL REGISTER D BITS */
336#define DA9052_RESET_RESETEVENT 0XC0
337#define DA9052_RESET_RESETTIMER 0X3F
338
339/* GPIO REGISTERS */
340/* GPIO CONTROL REGISTER BITS */
341#define DA9052_GPIO_EVEN_PORT_PIN 0X03
342#define DA9052_GPIO_EVEN_PORT_TYPE 0X04
343#define DA9052_GPIO_EVEN_PORT_MODE 0X08
344
345#define DA9052_GPIO_ODD_PORT_PIN 0X30
346#define DA9052_GPIO_ODD_PORT_TYPE 0X40
347#define DA9052_GPIO_ODD_PORT_MODE 0X80
348
349/*POWER SEQUENCER REGISTER BITS */
350/* SEQ CONTROL REGISTER BITS FOR ID 0 AND 1 */
351#define DA9052_ID01_LDO1STEP 0XF0
352#define DA9052_ID01_SYSPRE 0X04
353#define DA9052_ID01_DEFSUPPLY 0X02
354#define DA9052_ID01_NRESMODE 0X01
355
356/* SEQ CONTROL REGISTER BITS FOR ID 2 AND 3 */
357#define DA9052_ID23_LDO3STEP 0XF0
358#define DA9052_ID23_LDO2STEP 0X0F
359
360/* SEQ CONTROL REGISTER BITS FOR ID 4 AND 5 */
361#define DA9052_ID45_LDO5STEP 0XF0
362#define DA9052_ID45_LDO4STEP 0X0F
363
364/* SEQ CONTROL REGISTER BITS FOR ID 6 AND 7 */
365#define DA9052_ID67_LDO7STEP 0XF0
366#define DA9052_ID67_LDO6STEP 0X0F
367
368/* SEQ CONTROL REGISTER BITS FOR ID 8 AND 9 */
369#define DA9052_ID89_LDO9STEP 0XF0
370#define DA9052_ID89_LDO8STEP 0X0F
371
372/* SEQ CONTROL REGISTER BITS FOR ID 10 AND 11 */
373#define DA9052_ID1011_PDDISSTEP 0XF0
374#define DA9052_ID1011_LDO10STEP 0X0F
375
376/* SEQ CONTROL REGISTER BITS FOR ID 12 AND 13 */
377#define DA9052_ID1213_VMEMSWSTEP 0XF0
378#define DA9052_ID1213_VPERISWSTEP 0X0F
379
380/* SEQ CONTROL REGISTER BITS FOR ID 14 AND 15 */
381#define DA9052_ID1415_BUCKPROSTEP 0XF0
382#define DA9052_ID1415_BUCKCORESTEP 0X0F
383
384/* SEQ CONTROL REGISTER BITS FOR ID 16 AND 17 */
385#define DA9052_ID1617_BUCKPERISTEP 0XF0
386#define DA9052_ID1617_BUCKMEMSTEP 0X0F
387
388/* SEQ CONTROL REGISTER BITS FOR ID 18 AND 19 */
389#define DA9052_ID1819_GPRISE2STEP 0XF0
390#define DA9052_ID1819_GPRISE1STEP 0X0F
391
392/* SEQ CONTROL REGISTER BITS FOR ID 20 AND 21 */
393#define DA9052_ID2021_GPFALL2STEP 0XF0
394#define DA9052_ID2021_GPFALL1STEP 0X0F
395
396/* POWER SEQ STATUS REGISTER BITS */
397#define DA9052_SEQSTATUS_SEQPOINTER 0XF0
398#define DA9052_SEQSTATUS_WAITSTEP 0X0F
399
400/* POWER SEQ A REGISTER BITS */
401#define DA9052_SEQA_POWEREND 0XF0
402#define DA9052_SEQA_SYSTEMEND 0X0F
403
404/* POWER SEQ B REGISTER BITS */
405#define DA9052_SEQB_PARTDOWN 0XF0
406#define DA9052_SEQB_MAXCOUNT 0X0F
407
408/* POWER SEQ TIMER REGISTER BITS */
409#define DA9052_SEQTIMER_SEQDUMMY 0XF0
410#define DA9052_SEQTIMER_SEQTIME 0X0F
411
412/*POWER SUPPLY CONTROL REGISTER BITS */
413/* BUCK REGISTER A BITS */
414#define DA9052_BUCKA_BPROILIM 0XC0
415#define DA9052_BUCKA_BPROMODE 0X30
416#define DA9052_BUCKA_BCOREILIM 0X0C
417#define DA9052_BUCKA_BCOREMODE 0X03
418
419/* BUCK REGISTER B BITS */
420#define DA9052_BUCKB_BERIILIM 0XC0
421#define DA9052_BUCKB_BPERIMODE 0X30
422#define DA9052_BUCKB_BMEMILIM 0X0C
423#define DA9052_BUCKB_BMEMMODE 0X03
424
425/* BUCKCORE REGISTER BITS */
426#define DA9052_BUCKCORE_BCORECONF 0X80
427#define DA9052_BUCKCORE_BCOREEN 0X40
428#define DA9052_BUCKCORE_VBCORE 0X3F
429
430/* BUCKPRO REGISTER BITS */
431#define DA9052_BUCKPRO_BPROCONF 0X80
432#define DA9052_BUCKPRO_BPROEN 0X40
433#define DA9052_BUCKPRO_VBPRO 0X3F
434
435/* BUCKMEM REGISTER BITS */
436#define DA9052_BUCKMEM_BMEMCONF 0X80
437#define DA9052_BUCKMEM_BMEMEN 0X40
438#define DA9052_BUCKMEM_VBMEM 0X3F
439
440/* BUCKPERI REGISTER BITS */
441#define DA9052_BUCKPERI_BPERICONF 0X80
442#define DA9052_BUCKPERI_BPERIEN 0X40
443#define DA9052_BUCKPERI_BPERIHS 0X20
444#define DA9052_BUCKPERI_VBPERI 0X1F
445
446/* LDO1 REGISTER BITS */
447#define DA9052_LDO1_LDO1CONF 0X80
448#define DA9052_LDO1_LDO1EN 0X40
449#define DA9052_LDO1_VLDO1 0X1F
450
451/* LDO2 REGISTER BITS */
452#define DA9052_LDO2_LDO2CONF 0X80
453#define DA9052_LDO2_LDO2EN 0X40
454#define DA9052_LDO2_VLDO2 0X3F
455
456/* LDO3 REGISTER BITS */
457#define DA9052_LDO3_LDO3CONF 0X80
458#define DA9052_LDO3_LDO3EN 0X40
459#define DA9052_LDO3_VLDO3 0X3F
460
461/* LDO4 REGISTER BITS */
462#define DA9052_LDO4_LDO4CONF 0X80
463#define DA9052_LDO4_LDO4EN 0X40
464#define DA9052_LDO4_VLDO4 0X3F
465
466/* LDO5 REGISTER BITS */
467#define DA9052_LDO5_LDO5CONF 0X80
468#define DA9052_LDO5_LDO5EN 0X40
469#define DA9052_LDO5_VLDO5 0X3F
470
471/* LDO6 REGISTER BITS */
472#define DA9052_LDO6_LDO6CONF 0X80
473#define DA9052_LDO6_LDO6EN 0X40
474#define DA9052_LDO6_VLDO6 0X3F
475
476/* LDO7 REGISTER BITS */
477#define DA9052_LDO7_LDO7CONF 0X80
478#define DA9052_LDO7_LDO7EN 0X40
479#define DA9052_LDO7_VLDO7 0X3F
480
481/* LDO8 REGISTER BITS */
482#define DA9052_LDO8_LDO8CONF 0X80
483#define DA9052_LDO8_LDO8EN 0X40
484#define DA9052_LDO8_VLDO8 0X3F
485
486/* LDO9 REGISTER BITS */
487#define DA9052_LDO9_LDO9CONF 0X80
488#define DA9052_LDO9_LDO9EN 0X40
489#define DA9052_LDO9_VLDO9 0X3F
490
491/* LDO10 REGISTER BITS */
492#define DA9052_LDO10_LDO10CONF 0X80
493#define DA9052_LDO10_LDO10EN 0X40
494#define DA9052_LDO10_VLDO10 0X3F
495
496/* SUPPLY REGISTER BITS */
497#define DA9052_SUPPLY_VLOCK 0X80
498#define DA9052_SUPPLY_VMEMSWEN 0X40
499#define DA9052_SUPPLY_VPERISWEN 0X20
500#define DA9052_SUPPLY_VLDO3GO 0X10
501#define DA9052_SUPPLY_VLDO2GO 0X08
502#define DA9052_SUPPLY_VBMEMGO 0X04
503#define DA9052_SUPPLY_VBPROGO 0X02
504#define DA9052_SUPPLY_VBCOREGO 0X01
505
506/* PULLDOWN REGISTER BITS */
507#define DA9052_PULLDOWN_LDO5PDDIS 0X20
508#define DA9052_PULLDOWN_LDO2PDDIS 0X10
509#define DA9052_PULLDOWN_LDO1PDDIS 0X08
510#define DA9052_PULLDOWN_MEMPDDIS 0X04
511#define DA9052_PULLDOWN_PROPDDIS 0X02
512#define DA9052_PULLDOWN_COREPDDIS 0X01
513
514/* BAT CHARGER REGISTER BITS */
515/* CHARGER BUCK REGISTER BITS */
516#define DA9052_CHGBUCK_CHGTEMP 0X80
517#define DA9052_CHGBUCK_CHGUSBILIM 0X40
518#define DA9052_CHGBUCK_CHGBUCKLP 0X20
519#define DA9052_CHGBUCK_CHGBUCKEN 0X10
520#define DA9052_CHGBUCK_ISETBUCK 0X0F
521
522/* WAIT COUNTER REGISTER BITS */
523#define DA9052_WAITCONT_WAITDIR 0X80
524#define DA9052_WAITCONT_RTCCLOCK 0X40
525#define DA9052_WAITCONT_WAITMODE 0X20
526#define DA9052_WAITCONT_EN32KOUT 0X10
527#define DA9052_WAITCONT_DELAYTIME 0X0F
528
529/* ISET CONTROL REGISTER BITS */
530#define DA9052_ISET_ISETDCIN 0XF0
531#define DA9052_ISET_ISETVBUS 0X0F
532
533/* BATTERY CHARGER CONTROL REGISTER BITS */
534#define DA9052_BATCHG_ICHGPRE 0XC0
535#define DA9052_BATCHG_ICHGBAT 0X3F
536
537/* CHARGER COUNTER REGISTER BITS */
538#define DA9052_CHG_CONT_VCHG_BAT 0XF8
539#define DA9052_CHG_CONT_TCTR 0X07
540
541/* INPUT CONTROL REGISTER BITS */
542#define DA9052_INPUT_CONT_TCTR_MODE 0X80
543#define DA9052_INPUT_CONT_VBUS_SUSP 0X10
544#define DA9052_INPUT_CONT_DCIN_SUSP 0X08
545
546/* CHARGING TIME REGISTER BITS */
547#define DA9052_CHGTIME_CHGTIME 0XFF
548
549/* BACKUP BATTERY CONTROL REGISTER BITS */
550#define DA9052_BBATCONT_BCHARGERISET 0XF0
551#define DA9052_BBATCONT_BCHARGERVSET 0X0F
552
553/* LED REGISTERS BITS */
554/* LED BOOST REGISTER BITS */
555#define DA9052_BOOST_EBFAULT 0X80
556#define DA9052_BOOST_MBFAULT 0X40
557#define DA9052_BOOST_BOOSTFRQ 0X20
558#define DA9052_BOOST_BOOSTILIM 0X10
559#define DA9052_BOOST_LED3INEN 0X08
560#define DA9052_BOOST_LED2INEN 0X04
561#define DA9052_BOOST_LED1INEN 0X02
562#define DA9052_BOOST_BOOSTEN 0X01
563
564/* LED CONTROL REGISTER BITS */
565#define DA9052_LEDCONT_SELLEDMODE 0X80
566#define DA9052_LEDCONT_LED3ICONT 0X40
567#define DA9052_LEDCONT_LED3RAMP 0X20
568#define DA9052_LEDCONT_LED3EN 0X10
569#define DA9052_LEDCONT_LED2RAMP 0X08
570#define DA9052_LEDCONT_LED2EN 0X04
571#define DA9052_LEDCONT_LED1RAMP 0X02
572#define DA9052_LEDCONT_LED1EN 0X01
573
574/* LEDMIN123 REGISTER BIT */
575#define DA9052_LEDMIN123_LEDMINCURRENT 0XFF
576
577/* LED1CONF REGISTER BIT */
578#define DA9052_LED1CONF_LED1CURRENT 0XFF
579
580/* LED2CONF REGISTER BIT */
581#define DA9052_LED2CONF_LED2CURRENT 0XFF
582
583/* LED3CONF REGISTER BIT */
584#define DA9052_LED3CONF_LED3CURRENT 0XFF
585
586/* LED COUNT REGISTER BIT */
587#define DA9052_LED_CONT_DIM 0X80
588
589/* ADC MAN REGISTERS BITS */
590#define DA9052_ADC_MAN_MAN_CONV 0X10
591#define DA9052_ADC_MAN_MUXSEL_VDDOUT 0X00
592#define DA9052_ADC_MAN_MUXSEL_ICH 0X01
593#define DA9052_ADC_MAN_MUXSEL_TBAT 0X02
594#define DA9052_ADC_MAN_MUXSEL_VBAT 0X03
595#define DA9052_ADC_MAN_MUXSEL_AD4 0X04
596#define DA9052_ADC_MAN_MUXSEL_AD5 0X05
597#define DA9052_ADC_MAN_MUXSEL_AD6 0X06
598#define DA9052_ADC_MAN_MUXSEL_VBBAT 0X09
599
600/* ADC CONTROL REGSISTERS BITS */
601#define DA9052_ADCCONT_COMP1V2EN 0X80
602#define DA9052_ADCCONT_ADCMODE 0X40
603#define DA9052_ADCCONT_TBATISRCEN 0X20
604#define DA9052_ADCCONT_AD4ISRCEN 0X10
605#define DA9052_ADCCONT_AUTOAD6EN 0X08
606#define DA9052_ADCCONT_AUTOAD5EN 0X04
607#define DA9052_ADCCONT_AUTOAD4EN 0X02
608#define DA9052_ADCCONT_AUTOVDDEN 0X01
609
610/* ADC 10 BIT MANUAL CONVERSION RESULT LOW REGISTER */
611#define DA9052_ADC_RES_LSB 0X03
612
613/* ADC 10 BIT MANUAL CONVERSION RESULT HIGH REGISTER */
614#define DA9052_ADCRESH_ADCRESMSB 0XFF
615
616/* VDD RES REGSISTER BIT*/
617#define DA9052_VDDRES_VDDOUTRES 0XFF
618
619/* VDD MON REGSISTER BIT */
620#define DA9052_VDDMON_VDDOUTMON 0XFF
621
622/* ICHG_AV REGSISTER BIT */
623#define DA9052_ICHGAV_ICHGAV 0XFF
624
625/* ICHG_THD REGSISTER BIT */
626#define DA9052_ICHGTHD_ICHGTHD 0XFF
627
628/* ICHG_END REGSISTER BIT */
629#define DA9052_ICHGEND_ICHGEND 0XFF
630
631/* TBAT_RES REGSISTER BIT */
632#define DA9052_TBATRES_TBATRES 0XFF
633
634/* TBAT_HIGHP REGSISTER BIT */
635#define DA9052_TBATHIGHP_TBATHIGHP 0XFF
636
637/* TBAT_HIGHN REGSISTER BIT */
638#define DA9052_TBATHIGHN_TBATHIGHN 0XFF
639
640/* TBAT_LOW REGSISTER BIT */
641#define DA9052_TBATLOW_TBATLOW 0XFF
642
643/* T_OFFSET REGSISTER BIT */
644#define DA9052_TOFFSET_TOFFSET 0XFF
645
646/* ADCIN4_RES REGSISTER BIT */
647#define DA9052_ADCIN4RES_ADCIN4RES 0XFF
648
649/* ADCIN4_HIGH REGSISTER BIT */
650#define DA9052_AUTO4HIGH_AUTO4HIGH 0XFF
651
652/* ADCIN4_LOW REGSISTER BIT */
653#define DA9052_AUTO4LOW_AUTO4LOW 0XFF
654
655/* ADCIN5_RES REGSISTER BIT */
656#define DA9052_ADCIN5RES_ADCIN5RES 0XFF
657
658/* ADCIN5_HIGH REGSISTER BIT */
659#define DA9052_AUTO5HIGH_AUTOHIGH 0XFF
660
661/* ADCIN5_LOW REGSISTER BIT */
662#define DA9052_AUTO5LOW_AUTO5LOW 0XFF
663
664/* ADCIN6_RES REGSISTER BIT */
665#define DA9052_ADCIN6RES_ADCIN6RES 0XFF
666
667/* ADCIN6_HIGH REGSISTER BIT */
668#define DA9052_AUTO6HIGH_AUTO6HIGH 0XFF
669
670/* ADCIN6_LOW REGSISTER BIT */
671#define DA9052_AUTO6LOW_AUTO6LOW 0XFF
672
673/* TJUNC_RES REGSISTER BIT*/
674#define DA9052_TJUNCRES_TJUNCRES 0XFF
675
676/* TSI REGISTER */
677/* TSI CONTROL REGISTER A BITS */
678#define DA9052_TSICONTA_TSIDELAY 0XC0
679#define DA9052_TSICONTA_TSISKIP 0X38
680#define DA9052_TSICONTA_TSIMODE 0X04
681#define DA9052_TSICONTA_PENDETEN 0X02
682#define DA9052_TSICONTA_AUTOTSIEN 0X01
683
684/* TSI CONTROL REGISTER B BITS */
685#define DA9052_TSICONTB_ADCREF 0X80
686#define DA9052_TSICONTB_TSIMAN 0X40
687#define DA9052_TSICONTB_TSIMUX 0X30
688#define DA9052_TSICONTB_TSISEL3 0X08
689#define DA9052_TSICONTB_TSISEL2 0X04
690#define DA9052_TSICONTB_TSISEL1 0X02
691#define DA9052_TSICONTB_TSISEL0 0X01
692
693/* TSI X CO-ORDINATE MSB RESULT REGISTER BITS */
694#define DA9052_TSIXMSB_TSIXM 0XFF
695
696/* TSI Y CO-ORDINATE MSB RESULT REGISTER BITS */
697#define DA9052_TSIYMSB_TSIYM 0XFF
698
699/* TSI CO-ORDINATE LSB RESULT REGISTER BITS */
700#define DA9052_TSILSB_PENDOWN 0X40
701#define DA9052_TSILSB_TSIZL 0X30
702#define DA9052_TSILSB_TSIYL 0X0C
703#define DA9052_TSILSB_TSIXL 0X03
704
705/* TSI Z MEASUREMENT MSB RESULT REGISTER BIT */
706#define DA9052_TSIZMSB_TSIZM 0XFF
707
708/* RTC REGISTER */
709/* RTC TIMER SECONDS REGISTER BITS */
710#define DA9052_COUNTS_MONITOR 0X40
711#define DA9052_RTC_SEC 0X3F
712
713/* RTC TIMER MINUTES REGISTER BIT */
714#define DA9052_RTC_MIN 0X3F
715
716/* RTC TIMER HOUR REGISTER BIT */
717#define DA9052_RTC_HOUR 0X1F
718
719/* RTC TIMER DAYS REGISTER BIT */
720#define DA9052_RTC_DAY 0X1F
721
722/* RTC TIMER MONTHS REGISTER BIT */
723#define DA9052_RTC_MONTH 0X0F
724
725/* RTC TIMER YEARS REGISTER BIT */
726#define DA9052_RTC_YEAR 0X3F
727
728/* RTC ALARM MINUTES REGISTER BITS */
729#define DA9052_ALARMM_I_TICK_TYPE 0X80
730#define DA9052_ALARMMI_ALARMTYPE 0X40
731
732/* RTC ALARM YEARS REGISTER BITS */
733#define DA9052_ALARM_Y_TICK_ON 0X80
734#define DA9052_ALARM_Y_ALARM_ON 0X40
735
736/* RTC SECONDS REGISTER A BITS */
737#define DA9052_SECONDA_SECONDSA 0XFF
738
739/* RTC SECONDS REGISTER B BITS */
740#define DA9052_SECONDB_SECONDSB 0XFF
741
742/* RTC SECONDS REGISTER C BITS */
743#define DA9052_SECONDC_SECONDSC 0XFF
744
745/* RTC SECONDS REGISTER D BITS */
746#define DA9052_SECONDD_SECONDSD 0XFF
747
748#endif
749/* __LINUX_MFD_DA9052_REG_H */
diff --git a/include/linux/mfd/max8925.h b/include/linux/mfd/max8925.h
index 5259dfe8c585..15b2392a56fb 100644
--- a/include/linux/mfd/max8925.h
+++ b/include/linux/mfd/max8925.h
@@ -167,9 +167,6 @@ enum {
167 MAX8925_IRQ_VCHG_DC_OVP, 167 MAX8925_IRQ_VCHG_DC_OVP,
168 MAX8925_IRQ_VCHG_DC_F, 168 MAX8925_IRQ_VCHG_DC_F,
169 MAX8925_IRQ_VCHG_DC_R, 169 MAX8925_IRQ_VCHG_DC_R,
170 MAX8925_IRQ_VCHG_USB_OVP,
171 MAX8925_IRQ_VCHG_USB_F,
172 MAX8925_IRQ_VCHG_USB_R,
173 MAX8925_IRQ_VCHG_THM_OK_R, 170 MAX8925_IRQ_VCHG_THM_OK_R,
174 MAX8925_IRQ_VCHG_THM_OK_F, 171 MAX8925_IRQ_VCHG_THM_OK_F,
175 MAX8925_IRQ_VCHG_SYSLOW_F, 172 MAX8925_IRQ_VCHG_SYSLOW_F,
@@ -206,6 +203,8 @@ struct max8925_chip {
206 int irq_base; 203 int irq_base;
207 int core_irq; 204 int core_irq;
208 int tsc_irq; 205 int tsc_irq;
206
207 unsigned int wakeup_flag;
209}; 208};
210 209
211struct max8925_backlight_pdata { 210struct max8925_backlight_pdata {
@@ -223,6 +222,10 @@ struct max8925_power_pdata {
223 unsigned batt_detect:1; 222 unsigned batt_detect:1;
224 unsigned topoff_threshold:2; 223 unsigned topoff_threshold:2;
225 unsigned fast_charge:3; /* charge current */ 224 unsigned fast_charge:3; /* charge current */
225 unsigned no_temp_support:1; /* set if no temperature detect */
226 unsigned no_insert_detect:1; /* set if no ac insert detect */
227 char **supplied_to;
228 int num_supplicants;
226}; 229};
227 230
228/* 231/*
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index 0bbd13dbe336..fff590521e50 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -77,6 +77,82 @@ struct max8997_regulator_data {
77 struct regulator_init_data *initdata; 77 struct regulator_init_data *initdata;
78}; 78};
79 79
80enum max8997_muic_usb_type {
81 MAX8997_USB_HOST,
82 MAX8997_USB_DEVICE,
83};
84
85enum max8997_muic_charger_type {
86 MAX8997_CHARGER_TYPE_NONE = 0,
87 MAX8997_CHARGER_TYPE_USB,
88 MAX8997_CHARGER_TYPE_DOWNSTREAM_PORT,
89 MAX8997_CHARGER_TYPE_DEDICATED_CHG,
90 MAX8997_CHARGER_TYPE_500MA,
91 MAX8997_CHARGER_TYPE_1A,
92 MAX8997_CHARGER_TYPE_DEAD_BATTERY = 7,
93};
94
95struct max8997_muic_reg_data {
96 u8 addr;
97 u8 data;
98};
99
100/**
101 * struct max8997_muic_platform_data
102 * @usb_callback: callback function for USB
103 * inform callee of USB type (HOST or DEVICE)
104 * and attached state(true or false)
105 * @charger_callback: callback function for charger
106 * inform callee of charger_type
107 * and attached state(true or false)
108 * @deskdock_callback: callback function for desk dock
109 * inform callee of attached state(true or false)
110 * @cardock_callback: callback function for car dock
111 * inform callee of attached state(true or false)
112 * @mhl_callback: callback function for MHL (Mobile High-definition Link)
113 * inform callee of attached state(true or false)
114 * @uart_callback: callback function for JIG UART
115 * inform callee of attached state(true or false)
116 * @init_data: array of max8997_muic_reg_data
117 * used for initializing registers of MAX8997 MUIC device
118 * @num_init_data: array size of init_data
119 */
120struct max8997_muic_platform_data {
121 void (*usb_callback)(enum max8997_muic_usb_type usb_type,
122 bool attached);
123 void (*charger_callback)(bool attached,
124 enum max8997_muic_charger_type charger_type);
125 void (*deskdock_callback) (bool attached);
126 void (*cardock_callback) (bool attached);
127 void (*mhl_callback) (bool attached);
128 void (*uart_callback) (bool attached);
129
130 struct max8997_muic_reg_data *init_data;
131 int num_init_data;
132};
133
134enum max8997_led_mode {
135 MAX8997_NONE,
136 MAX8997_FLASH_MODE,
137 MAX8997_MOVIE_MODE,
138 MAX8997_FLASH_PIN_CONTROL_MODE,
139 MAX8997_MOVIE_PIN_CONTROL_MODE,
140};
141
142/**
143 * struct max8997_led_platform_data
144 * The number of LED devices for MAX8997 is two
145 * @mode: LED mode for each LED device
146 * @brightness: initial brightness for each LED device
147 * range:
148 * [0 - 31]: MAX8997_FLASH_MODE and MAX8997_FLASH_PIN_CONTROL_MODE
149 * [0 - 15]: MAX8997_MOVIE_MODE and MAX8997_MOVIE_PIN_CONTROL_MODE
150 */
151struct max8997_led_platform_data {
152 enum max8997_led_mode mode[2];
153 u8 brightness[2];
154};
155
80struct max8997_platform_data { 156struct max8997_platform_data {
81 /* IRQ */ 157 /* IRQ */
82 int irq_base; 158 int irq_base;
@@ -113,10 +189,13 @@ struct max8997_platform_data {
113 /* charge Full Timeout */ 189 /* charge Full Timeout */
114 int timeout; /* 0 (no timeout), 5, 6, 7 hours */ 190 int timeout; /* 0 (no timeout), 5, 6, 7 hours */
115 191
116 /* MUIC: Not implemented */ 192 /* ---- MUIC ---- */
193 struct max8997_muic_platform_data *muic_pdata;
194
117 /* HAPTIC: Not implemented */ 195 /* HAPTIC: Not implemented */
118 /* RTC: Not implemented */ 196 /* RTC: Not implemented */
119 /* Flash: Not implemented */ 197 /* ---- LED ---- */
198 struct max8997_led_platform_data *led_pdata;
120}; 199};
121 200
122#endif /* __LINUX_MFD_MAX8998_H */ 201#endif /* __LINUX_MFD_MAX8998_H */
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index 3816c2fac0ad..b86ee45c8b03 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -69,6 +69,7 @@ struct regulator_init_data;
69struct mc13xxx_regulator_init_data { 69struct mc13xxx_regulator_init_data {
70 int id; 70 int id;
71 struct regulator_init_data *init_data; 71 struct regulator_init_data *init_data;
72 struct device_node *node;
72}; 73};
73 74
74struct mc13xxx_regulator_platform_data { 75struct mc13xxx_regulator_platform_data {
@@ -173,6 +174,9 @@ struct mc13xxx_platform_data {
173#define MC13XXX_ADC_MODE_MULT_CHAN 3 174#define MC13XXX_ADC_MODE_MULT_CHAN 3
174 175
175#define MC13XXX_ADC0 43 176#define MC13XXX_ADC0 43
177#define MC13XXX_ADC0_LICELLCON (1 << 0)
178#define MC13XXX_ADC0_CHRGICON (1 << 1)
179#define MC13XXX_ADC0_BATICON (1 << 2)
176#define MC13XXX_ADC0_ADREFEN (1 << 10) 180#define MC13XXX_ADC0_ADREFEN (1 << 10)
177#define MC13XXX_ADC0_TSMOD0 (1 << 12) 181#define MC13XXX_ADC0_TSMOD0 (1 << 12)
178#define MC13XXX_ADC0_TSMOD1 (1 << 13) 182#define MC13XXX_ADC0_TSMOD1 (1 << 13)
@@ -184,4 +188,9 @@ struct mc13xxx_platform_data {
184 MC13XXX_ADC0_TSMOD1 | \ 188 MC13XXX_ADC0_TSMOD1 | \
185 MC13XXX_ADC0_TSMOD2) 189 MC13XXX_ADC0_TSMOD2)
186 190
191#define MC13XXX_ADC0_CONFIG_MASK (MC13XXX_ADC0_TSMOD_MASK | \
192 MC13XXX_ADC0_LICELLCON | \
193 MC13XXX_ADC0_CHRGICON | \
194 MC13XXX_ADC0_BATICON)
195
187#endif /* ifndef __LINUX_MFD_MC13XXX_H */ 196#endif /* ifndef __LINUX_MFD_MC13XXX_H */
diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h
index ee496708e38b..f88c1cc0cb0f 100644
--- a/include/linux/mfd/mcp.h
+++ b/include/linux/mfd/mcp.h
@@ -64,6 +64,9 @@ void mcp_driver_unregister(struct mcp_driver *);
64#define mcp_get_drvdata(mcp) dev_get_drvdata(&(mcp)->attached_device) 64#define mcp_get_drvdata(mcp) dev_get_drvdata(&(mcp)->attached_device)
65#define mcp_set_drvdata(mcp,d) dev_set_drvdata(&(mcp)->attached_device, d) 65#define mcp_set_drvdata(mcp,d) dev_set_drvdata(&(mcp)->attached_device, d)
66 66
67#define mcp_priv(mcp) ((void *)((mcp)+1)) 67static inline void *mcp_priv(struct mcp *mcp)
68{
69 return mcp + 1;
70}
68 71
69#endif 72#endif
diff --git a/include/linux/mfd/s5m87xx/s5m-core.h b/include/linux/mfd/s5m87xx/s5m-core.h
new file mode 100644
index 000000000000..a7480b57f92d
--- /dev/null
+++ b/include/linux/mfd/s5m87xx/s5m-core.h
@@ -0,0 +1,373 @@
1/*
2 * s5m-core.h
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd
5 * http://www.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_MFD_S5M_CORE_H
15#define __LINUX_MFD_S5M_CORE_H
16
17#define NUM_IRQ_REGS 4
18
19enum s5m_device_type {
20 S5M8751X,
21 S5M8763X,
22 S5M8767X,
23};
24
25/* S5M8767 registers */
26enum s5m8767_reg {
27 S5M8767_REG_ID,
28 S5M8767_REG_INT1,
29 S5M8767_REG_INT2,
30 S5M8767_REG_INT3,
31 S5M8767_REG_INT1M,
32 S5M8767_REG_INT2M,
33 S5M8767_REG_INT3M,
34 S5M8767_REG_STATUS1,
35 S5M8767_REG_STATUS2,
36 S5M8767_REG_STATUS3,
37 S5M8767_REG_CTRL1,
38 S5M8767_REG_CTRL2,
39 S5M8767_REG_LOWBAT1,
40 S5M8767_REG_LOWBAT2,
41 S5M8767_REG_BUCHG,
42 S5M8767_REG_DVSRAMP,
43 S5M8767_REG_DVSTIMER2 = 0x10,
44 S5M8767_REG_DVSTIMER3,
45 S5M8767_REG_DVSTIMER4,
46 S5M8767_REG_LDO1,
47 S5M8767_REG_LDO2,
48 S5M8767_REG_LDO3,
49 S5M8767_REG_LDO4,
50 S5M8767_REG_LDO5,
51 S5M8767_REG_LDO6,
52 S5M8767_REG_LDO7,
53 S5M8767_REG_LDO8,
54 S5M8767_REG_LDO9,
55 S5M8767_REG_LDO10,
56 S5M8767_REG_LDO11,
57 S5M8767_REG_LDO12,
58 S5M8767_REG_LDO13,
59 S5M8767_REG_LDO14 = 0x20,
60 S5M8767_REG_LDO15,
61 S5M8767_REG_LDO16,
62 S5M8767_REG_LDO17,
63 S5M8767_REG_LDO18,
64 S5M8767_REG_LDO19,
65 S5M8767_REG_LDO20,
66 S5M8767_REG_LDO21,
67 S5M8767_REG_LDO22,
68 S5M8767_REG_LDO23,
69 S5M8767_REG_LDO24,
70 S5M8767_REG_LDO25,
71 S5M8767_REG_LDO26,
72 S5M8767_REG_LDO27,
73 S5M8767_REG_LDO28,
74 S5M8767_REG_UVLO = 0x31,
75 S5M8767_REG_BUCK1CTRL1,
76 S5M8767_REG_BUCK1CTRL2,
77 S5M8767_REG_BUCK2CTRL,
78 S5M8767_REG_BUCK2DVS1,
79 S5M8767_REG_BUCK2DVS2,
80 S5M8767_REG_BUCK2DVS3,
81 S5M8767_REG_BUCK2DVS4,
82 S5M8767_REG_BUCK2DVS5,
83 S5M8767_REG_BUCK2DVS6,
84 S5M8767_REG_BUCK2DVS7,
85 S5M8767_REG_BUCK2DVS8,
86 S5M8767_REG_BUCK3CTRL,
87 S5M8767_REG_BUCK3DVS1,
88 S5M8767_REG_BUCK3DVS2,
89 S5M8767_REG_BUCK3DVS3,
90 S5M8767_REG_BUCK3DVS4,
91 S5M8767_REG_BUCK3DVS5,
92 S5M8767_REG_BUCK3DVS6,
93 S5M8767_REG_BUCK3DVS7,
94 S5M8767_REG_BUCK3DVS8,
95 S5M8767_REG_BUCK4CTRL,
96 S5M8767_REG_BUCK4DVS1,
97 S5M8767_REG_BUCK4DVS2,
98 S5M8767_REG_BUCK4DVS3,
99 S5M8767_REG_BUCK4DVS4,
100 S5M8767_REG_BUCK4DVS5,
101 S5M8767_REG_BUCK4DVS6,
102 S5M8767_REG_BUCK4DVS7,
103 S5M8767_REG_BUCK4DVS8,
104 S5M8767_REG_BUCK5CTRL1,
105 S5M8767_REG_BUCK5CTRL2,
106 S5M8767_REG_BUCK5CTRL3,
107 S5M8767_REG_BUCK5CTRL4,
108 S5M8767_REG_BUCK5CTRL5,
109 S5M8767_REG_BUCK6CTRL1,
110 S5M8767_REG_BUCK6CTRL2,
111 S5M8767_REG_BUCK7CTRL1,
112 S5M8767_REG_BUCK7CTRL2,
113 S5M8767_REG_BUCK8CTRL1,
114 S5M8767_REG_BUCK8CTRL2,
115 S5M8767_REG_BUCK9CTRL1,
116 S5M8767_REG_BUCK9CTRL2,
117 S5M8767_REG_LDO1CTRL,
118 S5M8767_REG_LDO2_1CTRL,
119 S5M8767_REG_LDO2_2CTRL,
120 S5M8767_REG_LDO2_3CTRL,
121 S5M8767_REG_LDO2_4CTRL,
122 S5M8767_REG_LDO3CTRL,
123 S5M8767_REG_LDO4CTRL,
124 S5M8767_REG_LDO5CTRL,
125 S5M8767_REG_LDO6CTRL,
126 S5M8767_REG_LDO7CTRL,
127 S5M8767_REG_LDO8CTRL,
128 S5M8767_REG_LDO9CTRL,
129 S5M8767_REG_LDO10CTRL,
130 S5M8767_REG_LDO11CTRL,
131 S5M8767_REG_LDO12CTRL,
132 S5M8767_REG_LDO13CTRL,
133 S5M8767_REG_LDO14CTRL,
134 S5M8767_REG_LDO15CTRL,
135 S5M8767_REG_LDO16CTRL,
136 S5M8767_REG_LDO17CTRL,
137 S5M8767_REG_LDO18CTRL,
138 S5M8767_REG_LDO19CTRL,
139 S5M8767_REG_LDO20CTRL,
140 S5M8767_REG_LDO21CTRL,
141 S5M8767_REG_LDO22CTRL,
142 S5M8767_REG_LDO23CTRL,
143 S5M8767_REG_LDO24CTRL,
144 S5M8767_REG_LDO25CTRL,
145 S5M8767_REG_LDO26CTRL,
146 S5M8767_REG_LDO27CTRL,
147 S5M8767_REG_LDO28CTRL,
148};
149
150/* S5M8763 registers */
151enum s5m8763_reg {
152 S5M8763_REG_IRQ1,
153 S5M8763_REG_IRQ2,
154 S5M8763_REG_IRQ3,
155 S5M8763_REG_IRQ4,
156 S5M8763_REG_IRQM1,
157 S5M8763_REG_IRQM2,
158 S5M8763_REG_IRQM3,
159 S5M8763_REG_IRQM4,
160 S5M8763_REG_STATUS1,
161 S5M8763_REG_STATUS2,
162 S5M8763_REG_STATUSM1,
163 S5M8763_REG_STATUSM2,
164 S5M8763_REG_CHGR1,
165 S5M8763_REG_CHGR2,
166 S5M8763_REG_LDO_ACTIVE_DISCHARGE1,
167 S5M8763_REG_LDO_ACTIVE_DISCHARGE2,
168 S5M8763_REG_BUCK_ACTIVE_DISCHARGE3,
169 S5M8763_REG_ONOFF1,
170 S5M8763_REG_ONOFF2,
171 S5M8763_REG_ONOFF3,
172 S5M8763_REG_ONOFF4,
173 S5M8763_REG_BUCK1_VOLTAGE1,
174 S5M8763_REG_BUCK1_VOLTAGE2,
175 S5M8763_REG_BUCK1_VOLTAGE3,
176 S5M8763_REG_BUCK1_VOLTAGE4,
177 S5M8763_REG_BUCK2_VOLTAGE1,
178 S5M8763_REG_BUCK2_VOLTAGE2,
179 S5M8763_REG_BUCK3,
180 S5M8763_REG_BUCK4,
181 S5M8763_REG_LDO1_LDO2,
182 S5M8763_REG_LDO3,
183 S5M8763_REG_LDO4,
184 S5M8763_REG_LDO5,
185 S5M8763_REG_LDO6,
186 S5M8763_REG_LDO7,
187 S5M8763_REG_LDO7_LDO8,
188 S5M8763_REG_LDO9_LDO10,
189 S5M8763_REG_LDO11,
190 S5M8763_REG_LDO12,
191 S5M8763_REG_LDO13,
192 S5M8763_REG_LDO14,
193 S5M8763_REG_LDO15,
194 S5M8763_REG_LDO16,
195 S5M8763_REG_BKCHR,
196 S5M8763_REG_LBCNFG1,
197 S5M8763_REG_LBCNFG2,
198};
199
200enum s5m8767_irq {
201 S5M8767_IRQ_PWRR,
202 S5M8767_IRQ_PWRF,
203 S5M8767_IRQ_PWR1S,
204 S5M8767_IRQ_JIGR,
205 S5M8767_IRQ_JIGF,
206 S5M8767_IRQ_LOWBAT2,
207 S5M8767_IRQ_LOWBAT1,
208
209 S5M8767_IRQ_MRB,
210 S5M8767_IRQ_DVSOK2,
211 S5M8767_IRQ_DVSOK3,
212 S5M8767_IRQ_DVSOK4,
213
214 S5M8767_IRQ_RTC60S,
215 S5M8767_IRQ_RTCA1,
216 S5M8767_IRQ_RTCA2,
217 S5M8767_IRQ_SMPL,
218 S5M8767_IRQ_RTC1S,
219 S5M8767_IRQ_WTSR,
220
221 S5M8767_IRQ_NR,
222};
223
224#define S5M8767_IRQ_PWRR_MASK (1 << 0)
225#define S5M8767_IRQ_PWRF_MASK (1 << 1)
226#define S5M8767_IRQ_PWR1S_MASK (1 << 3)
227#define S5M8767_IRQ_JIGR_MASK (1 << 4)
228#define S5M8767_IRQ_JIGF_MASK (1 << 5)
229#define S5M8767_IRQ_LOWBAT2_MASK (1 << 6)
230#define S5M8767_IRQ_LOWBAT1_MASK (1 << 7)
231
232#define S5M8767_IRQ_MRB_MASK (1 << 2)
233#define S5M8767_IRQ_DVSOK2_MASK (1 << 3)
234#define S5M8767_IRQ_DVSOK3_MASK (1 << 4)
235#define S5M8767_IRQ_DVSOK4_MASK (1 << 5)
236
237#define S5M8767_IRQ_RTC60S_MASK (1 << 0)
238#define S5M8767_IRQ_RTCA1_MASK (1 << 1)
239#define S5M8767_IRQ_RTCA2_MASK (1 << 2)
240#define S5M8767_IRQ_SMPL_MASK (1 << 3)
241#define S5M8767_IRQ_RTC1S_MASK (1 << 4)
242#define S5M8767_IRQ_WTSR_MASK (1 << 5)
243
244enum s5m8763_irq {
245 S5M8763_IRQ_DCINF,
246 S5M8763_IRQ_DCINR,
247 S5M8763_IRQ_JIGF,
248 S5M8763_IRQ_JIGR,
249 S5M8763_IRQ_PWRONF,
250 S5M8763_IRQ_PWRONR,
251
252 S5M8763_IRQ_WTSREVNT,
253 S5M8763_IRQ_SMPLEVNT,
254 S5M8763_IRQ_ALARM1,
255 S5M8763_IRQ_ALARM0,
256
257 S5M8763_IRQ_ONKEY1S,
258 S5M8763_IRQ_TOPOFFR,
259 S5M8763_IRQ_DCINOVPR,
260 S5M8763_IRQ_CHGRSTF,
261 S5M8763_IRQ_DONER,
262 S5M8763_IRQ_CHGFAULT,
263
264 S5M8763_IRQ_LOBAT1,
265 S5M8763_IRQ_LOBAT2,
266
267 S5M8763_IRQ_NR,
268};
269
270#define S5M8763_IRQ_DCINF_MASK (1 << 2)
271#define S5M8763_IRQ_DCINR_MASK (1 << 3)
272#define S5M8763_IRQ_JIGF_MASK (1 << 4)
273#define S5M8763_IRQ_JIGR_MASK (1 << 5)
274#define S5M8763_IRQ_PWRONF_MASK (1 << 6)
275#define S5M8763_IRQ_PWRONR_MASK (1 << 7)
276
277#define S5M8763_IRQ_WTSREVNT_MASK (1 << 0)
278#define S5M8763_IRQ_SMPLEVNT_MASK (1 << 1)
279#define S5M8763_IRQ_ALARM1_MASK (1 << 2)
280#define S5M8763_IRQ_ALARM0_MASK (1 << 3)
281
282#define S5M8763_IRQ_ONKEY1S_MASK (1 << 0)
283#define S5M8763_IRQ_TOPOFFR_MASK (1 << 2)
284#define S5M8763_IRQ_DCINOVPR_MASK (1 << 3)
285#define S5M8763_IRQ_CHGRSTF_MASK (1 << 4)
286#define S5M8763_IRQ_DONER_MASK (1 << 5)
287#define S5M8763_IRQ_CHGFAULT_MASK (1 << 7)
288
289#define S5M8763_IRQ_LOBAT1_MASK (1 << 0)
290#define S5M8763_IRQ_LOBAT2_MASK (1 << 1)
291
292#define S5M8763_ENRAMP (1 << 4)
293
294/**
295 * struct s5m87xx_dev - s5m87xx master device for sub-drivers
296 * @dev: master device of the chip (can be used to access platform data)
297 * @i2c: i2c client private data for regulator
298 * @rtc: i2c client private data for rtc
299 * @iolock: mutex for serializing io access
300 * @irqlock: mutex for buslock
301 * @irq_base: base IRQ number for s5m87xx, required for IRQs
302 * @irq: generic IRQ number for s5m87xx
303 * @ono: power onoff IRQ number for s5m87xx
304 * @irq_masks_cur: currently active value
305 * @irq_masks_cache: cached hardware value
306 * @type: indicate which s5m87xx "variant" is used
307 */
308struct s5m87xx_dev {
309 struct device *dev;
310 struct regmap *regmap;
311 struct i2c_client *i2c;
312 struct i2c_client *rtc;
313 struct mutex iolock;
314 struct mutex irqlock;
315
316 int device_type;
317 int irq_base;
318 int irq;
319 int ono;
320 u8 irq_masks_cur[NUM_IRQ_REGS];
321 u8 irq_masks_cache[NUM_IRQ_REGS];
322 int type;
323 bool wakeup;
324};
325
326int s5m_irq_init(struct s5m87xx_dev *s5m87xx);
327void s5m_irq_exit(struct s5m87xx_dev *s5m87xx);
328int s5m_irq_resume(struct s5m87xx_dev *s5m87xx);
329
330extern int s5m_reg_read(struct s5m87xx_dev *s5m87xx, u8 reg, void *dest);
331extern int s5m_bulk_read(struct s5m87xx_dev *s5m87xx, u8 reg, int count, u8 *buf);
332extern int s5m_reg_write(struct s5m87xx_dev *s5m87xx, u8 reg, u8 value);
333extern int s5m_bulk_write(struct s5m87xx_dev *s5m87xx, u8 reg, int count, u8 *buf);
334extern int s5m_reg_update(struct s5m87xx_dev *s5m87xx, u8 reg, u8 val, u8 mask);
335
336struct s5m_platform_data {
337 struct s5m_regulator_data *regulators;
338 int device_type;
339 int num_regulators;
340
341 int irq_base;
342 int (*cfg_pmic_irq)(void);
343
344 int ono;
345 bool wakeup;
346 bool buck_voltage_lock;
347
348 int buck_gpios[3];
349 int buck2_voltage[8];
350 bool buck2_gpiodvs;
351 int buck3_voltage[8];
352 bool buck3_gpiodvs;
353 int buck4_voltage[8];
354 bool buck4_gpiodvs;
355
356 int buck_set1;
357 int buck_set2;
358 int buck_set3;
359 int buck2_enable;
360 int buck3_enable;
361 int buck4_enable;
362 int buck_default_idx;
363 int buck2_default_idx;
364 int buck3_default_idx;
365 int buck4_default_idx;
366
367 int buck_ramp_delay;
368 bool buck2_ramp_enable;
369 bool buck3_ramp_enable;
370 bool buck4_ramp_enable;
371};
372
373#endif /* __LINUX_MFD_S5M_CORE_H */
diff --git a/include/linux/mfd/s5m87xx/s5m-pmic.h b/include/linux/mfd/s5m87xx/s5m-pmic.h
new file mode 100644
index 000000000000..a72a5d27e62e
--- /dev/null
+++ b/include/linux/mfd/s5m87xx/s5m-pmic.h
@@ -0,0 +1,100 @@
1/* s5m87xx.h
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.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
11#ifndef __LINUX_MFD_S5M_PMIC_H
12#define __LINUX_MFD_S5M_PMIC_H
13
14#include <linux/regulator/machine.h>
15
16/* S5M8767 regulator ids */
17enum s5m8767_regulators {
18 S5M8767_LDO1,
19 S5M8767_LDO2,
20 S5M8767_LDO3,
21 S5M8767_LDO4,
22 S5M8767_LDO5,
23 S5M8767_LDO6,
24 S5M8767_LDO7,
25 S5M8767_LDO8,
26 S5M8767_LDO9,
27 S5M8767_LDO10,
28 S5M8767_LDO11,
29 S5M8767_LDO12,
30 S5M8767_LDO13,
31 S5M8767_LDO14,
32 S5M8767_LDO15,
33 S5M8767_LDO16,
34 S5M8767_LDO17,
35 S5M8767_LDO18,
36 S5M8767_LDO19,
37 S5M8767_LDO20,
38 S5M8767_LDO21,
39 S5M8767_LDO22,
40 S5M8767_LDO23,
41 S5M8767_LDO24,
42 S5M8767_LDO25,
43 S5M8767_LDO26,
44 S5M8767_LDO27,
45 S5M8767_LDO28,
46 S5M8767_BUCK1,
47 S5M8767_BUCK2,
48 S5M8767_BUCK3,
49 S5M8767_BUCK4,
50 S5M8767_BUCK5,
51 S5M8767_BUCK6,
52 S5M8767_BUCK7,
53 S5M8767_BUCK8,
54 S5M8767_BUCK9,
55 S5M8767_AP_EN32KHZ,
56 S5M8767_CP_EN32KHZ,
57
58 S5M8767_REG_MAX,
59};
60
61/* S5M8763 regulator ids */
62enum s5m8763_regulators {
63 S5M8763_LDO1,
64 S5M8763_LDO2,
65 S5M8763_LDO3,
66 S5M8763_LDO4,
67 S5M8763_LDO5,
68 S5M8763_LDO6,
69 S5M8763_LDO7,
70 S5M8763_LDO8,
71 S5M8763_LDO9,
72 S5M8763_LDO10,
73 S5M8763_LDO11,
74 S5M8763_LDO12,
75 S5M8763_LDO13,
76 S5M8763_LDO14,
77 S5M8763_LDO15,
78 S5M8763_LDO16,
79 S5M8763_BUCK1,
80 S5M8763_BUCK2,
81 S5M8763_BUCK3,
82 S5M8763_BUCK4,
83 S5M8763_AP_EN32KHZ,
84 S5M8763_CP_EN32KHZ,
85 S5M8763_ENCHGVI,
86 S5M8763_ESAFEUSB1,
87 S5M8763_ESAFEUSB2,
88};
89
90/**
91 * s5m87xx_regulator_data - regulator data
92 * @id: regulator id
93 * @initdata: regulator init data (contraints, supplies, ...)
94 */
95struct s5m_regulator_data {
96 int id;
97 struct regulator_init_data *initdata;
98};
99
100#endif /* __LINUX_MFD_S5M_PMIC_H */
diff --git a/include/linux/mfd/s5m87xx/s5m-rtc.h b/include/linux/mfd/s5m87xx/s5m-rtc.h
new file mode 100644
index 000000000000..6ce8da264cec
--- /dev/null
+++ b/include/linux/mfd/s5m87xx/s5m-rtc.h
@@ -0,0 +1,84 @@
1/*
2 * s5m-rtc.h
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd
5 * http://www.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_MFD_S5M_RTC_H
15#define __LINUX_MFD_S5M_RTC_H
16
17enum s5m87xx_rtc_reg {
18 S5M87XX_RTC_SEC,
19 S5M87XX_RTC_MIN,
20 S5M87XX_RTC_HOUR,
21 S5M87XX_RTC_WEEKDAY,
22 S5M87XX_RTC_DATE,
23 S5M87XX_RTC_MONTH,
24 S5M87XX_RTC_YEAR1,
25 S5M87XX_RTC_YEAR2,
26 S5M87XX_ALARM0_SEC,
27 S5M87XX_ALARM0_MIN,
28 S5M87XX_ALARM0_HOUR,
29 S5M87XX_ALARM0_WEEKDAY,
30 S5M87XX_ALARM0_DATE,
31 S5M87XX_ALARM0_MONTH,
32 S5M87XX_ALARM0_YEAR1,
33 S5M87XX_ALARM0_YEAR2,
34 S5M87XX_ALARM1_SEC,
35 S5M87XX_ALARM1_MIN,
36 S5M87XX_ALARM1_HOUR,
37 S5M87XX_ALARM1_WEEKDAY,
38 S5M87XX_ALARM1_DATE,
39 S5M87XX_ALARM1_MONTH,
40 S5M87XX_ALARM1_YEAR1,
41 S5M87XX_ALARM1_YEAR2,
42 S5M87XX_ALARM0_CONF,
43 S5M87XX_ALARM1_CONF,
44 S5M87XX_RTC_STATUS,
45 S5M87XX_WTSR_SMPL_CNTL,
46 S5M87XX_RTC_UDR_CON,
47};
48
49#define RTC_I2C_ADDR (0x0C >> 1)
50
51#define HOUR_12 (1 << 7)
52#define HOUR_AMPM (1 << 6)
53#define HOUR_PM (1 << 5)
54#define ALARM0_STATUS (1 << 1)
55#define ALARM1_STATUS (1 << 2)
56#define UPDATE_AD (1 << 0)
57
58/* RTC Control Register */
59#define BCD_EN_SHIFT 0
60#define BCD_EN_MASK (1 << BCD_EN_SHIFT)
61#define MODEL24_SHIFT 1
62#define MODEL24_MASK (1 << MODEL24_SHIFT)
63/* RTC Update Register1 */
64#define RTC_UDR_SHIFT 0
65#define RTC_UDR_MASK (1 << RTC_UDR_SHIFT)
66/* RTC Hour register */
67#define HOUR_PM_SHIFT 6
68#define HOUR_PM_MASK (1 << HOUR_PM_SHIFT)
69/* RTC Alarm Enable */
70#define ALARM_ENABLE_SHIFT 7
71#define ALARM_ENABLE_MASK (1 << ALARM_ENABLE_SHIFT)
72
73enum {
74 RTC_SEC = 0,
75 RTC_MIN,
76 RTC_HOUR,
77 RTC_WEEKDAY,
78 RTC_DATE,
79 RTC_MONTH,
80 RTC_YEAR1,
81 RTC_YEAR2,
82};
83
84#endif /* __LINUX_MFD_S5M_RTC_H */
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index be1af7c42e57..ca1d7a347600 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -20,6 +20,8 @@ enum stmpe_block {
20}; 20};
21 21
22enum stmpe_partnum { 22enum stmpe_partnum {
23 STMPE610,
24 STMPE801,
23 STMPE811, 25 STMPE811,
24 STMPE1601, 26 STMPE1601,
25 STMPE2401, 27 STMPE2401,
@@ -50,17 +52,20 @@ enum {
50 52
51 53
52struct stmpe_variant_info; 54struct stmpe_variant_info;
55struct stmpe_client_info;
53 56
54/** 57/**
55 * struct stmpe - STMPE MFD structure 58 * struct stmpe - STMPE MFD structure
56 * @lock: lock protecting I/O operations 59 * @lock: lock protecting I/O operations
57 * @irq_lock: IRQ bus lock 60 * @irq_lock: IRQ bus lock
58 * @dev: device, mostly for dev_dbg() 61 * @dev: device, mostly for dev_dbg()
59 * @i2c: i2c client 62 * @client: client - i2c or spi
63 * @ci: client specific information
60 * @partnum: part number 64 * @partnum: part number
61 * @variant: the detected STMPE model number 65 * @variant: the detected STMPE model number
62 * @regs: list of addresses of registers which are at different addresses on 66 * @regs: list of addresses of registers which are at different addresses on
63 * different variants. Indexed by one of STMPE_IDX_*. 67 * different variants. Indexed by one of STMPE_IDX_*.
68 * @irq: irq number for stmpe
64 * @irq_base: starting IRQ number for internal IRQs 69 * @irq_base: starting IRQ number for internal IRQs
65 * @num_gpios: number of gpios, differs for variants 70 * @num_gpios: number of gpios, differs for variants
66 * @ier: cache of IER registers for bus_lock 71 * @ier: cache of IER registers for bus_lock
@@ -71,11 +76,13 @@ struct stmpe {
71 struct mutex lock; 76 struct mutex lock;
72 struct mutex irq_lock; 77 struct mutex irq_lock;
73 struct device *dev; 78 struct device *dev;
74 struct i2c_client *i2c; 79 void *client;
80 struct stmpe_client_info *ci;
75 enum stmpe_partnum partnum; 81 enum stmpe_partnum partnum;
76 struct stmpe_variant_info *variant; 82 struct stmpe_variant_info *variant;
77 const u8 *regs; 83 const u8 *regs;
78 84
85 int irq;
79 int irq_base; 86 int irq_base;
80 int num_gpios; 87 int num_gpios;
81 u8 ier[2]; 88 u8 ier[2];
@@ -183,6 +190,9 @@ struct stmpe_ts_platform_data {
183 * @autosleep_timeout: inactivity timeout in milliseconds for autosleep 190 * @autosleep_timeout: inactivity timeout in milliseconds for autosleep
184 * @irq_base: base IRQ number. %STMPE_NR_IRQS irqs will be used, or 191 * @irq_base: base IRQ number. %STMPE_NR_IRQS irqs will be used, or
185 * %STMPE_NR_INTERNAL_IRQS if the GPIO driver is not used. 192 * %STMPE_NR_INTERNAL_IRQS if the GPIO driver is not used.
193 * @irq_over_gpio: true if gpio is used to get irq
194 * @irq_gpio: gpio number over which irq will be requested (significant only if
195 * irq_over_gpio is true)
186 * @gpio: GPIO-specific platform data 196 * @gpio: GPIO-specific platform data
187 * @keypad: keypad-specific platform data 197 * @keypad: keypad-specific platform data
188 * @ts: touchscreen-specific platform data 198 * @ts: touchscreen-specific platform data
@@ -194,6 +204,8 @@ struct stmpe_platform_data {
194 unsigned int irq_trigger; 204 unsigned int irq_trigger;
195 bool irq_invert_polarity; 205 bool irq_invert_polarity;
196 bool autosleep; 206 bool autosleep;
207 bool irq_over_gpio;
208 int irq_gpio;
197 int autosleep_timeout; 209 int autosleep_timeout;
198 210
199 struct stmpe_gpio_platform_data *gpio; 211 struct stmpe_gpio_platform_data *gpio;
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index 8bf2cb9502dd..d0cb12eba402 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -740,6 +740,34 @@
740#define TPS65910_GPIO_STS BIT(1) 740#define TPS65910_GPIO_STS BIT(1)
741#define TPS65910_GPIO_SET BIT(0) 741#define TPS65910_GPIO_SET BIT(0)
742 742
743/* Regulator Index Definitions */
744#define TPS65910_REG_VRTC 0
745#define TPS65910_REG_VIO 1
746#define TPS65910_REG_VDD1 2
747#define TPS65910_REG_VDD2 3
748#define TPS65910_REG_VDD3 4
749#define TPS65910_REG_VDIG1 5
750#define TPS65910_REG_VDIG2 6
751#define TPS65910_REG_VPLL 7
752#define TPS65910_REG_VDAC 8
753#define TPS65910_REG_VAUX1 9
754#define TPS65910_REG_VAUX2 10
755#define TPS65910_REG_VAUX33 11
756#define TPS65910_REG_VMMC 12
757
758#define TPS65911_REG_VDDCTRL 4
759#define TPS65911_REG_LDO1 5
760#define TPS65911_REG_LDO2 6
761#define TPS65911_REG_LDO3 7
762#define TPS65911_REG_LDO4 8
763#define TPS65911_REG_LDO5 9
764#define TPS65911_REG_LDO6 10
765#define TPS65911_REG_LDO7 11
766#define TPS65911_REG_LDO8 12
767
768/* Max number of TPS65910/11 regulators */
769#define TPS65910_NUM_REGS 13
770
743/** 771/**
744 * struct tps65910_board 772 * struct tps65910_board
745 * Board platform data may be used to initialize regulators. 773 * Board platform data may be used to initialize regulators.
@@ -751,7 +779,7 @@ struct tps65910_board {
751 int irq_base; 779 int irq_base;
752 int vmbch_threshold; 780 int vmbch_threshold;
753 int vmbch2_threshold; 781 int vmbch2_threshold;
754 struct regulator_init_data *tps65910_pmic_init_data; 782 struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS];
755}; 783};
756 784
757/** 785/**
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index 2463c2619596..9bc9ac651dad 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -187,8 +187,10 @@ struct twl6040 {
187 int rev; 187 int rev;
188 u8 vibra_ctrl_cache[2]; 188 u8 vibra_ctrl_cache[2];
189 189
190 /* PLL configuration */
190 int pll; 191 int pll;
191 unsigned int sysclk; 192 unsigned int sysclk;
193 unsigned int mclk;
192 194
193 unsigned int irq; 195 unsigned int irq;
194 unsigned int irq_base; 196 unsigned int irq_base;
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index f44bdb7273bd..9eff2a351ec5 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -15,6 +15,7 @@
15#ifndef __MFD_WM8994_CORE_H__ 15#ifndef __MFD_WM8994_CORE_H__
16#define __MFD_WM8994_CORE_H__ 16#define __MFD_WM8994_CORE_H__
17 17
18#include <linux/mutex.h>
18#include <linux/interrupt.h> 19#include <linux/interrupt.h>
19 20
20enum wm8994_type { 21enum wm8994_type {
@@ -55,6 +56,7 @@ struct wm8994 {
55 struct mutex irq_lock; 56 struct mutex irq_lock;
56 57
57 enum wm8994_type type; 58 enum wm8994_type type;
59 int revision;
58 60
59 struct device *dev; 61 struct device *dev;
60 struct regmap *regmap; 62 struct regmap *regmap;
@@ -65,13 +67,10 @@ struct wm8994 {
65 int irq_base; 67 int irq_base;
66 68
67 int irq; 69 int irq;
68 u16 irq_masks_cur[WM8994_NUM_IRQ_REGS]; 70 struct regmap_irq_chip_data *irq_data;
69 u16 irq_masks_cache[WM8994_NUM_IRQ_REGS];
70 71
71 /* Used over suspend/resume */ 72 /* Used over suspend/resume */
72 bool suspended; 73 bool suspended;
73 u16 ldo_regs[WM8994_NUM_LDO_REGS];
74 u16 gpio_regs[WM8994_NUM_GPIO_REGS];
75 74
76 struct regulator_dev *dbvdd; 75 struct regulator_dev *dbvdd;
77 int num_supplies; 76 int num_supplies;
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index ea32f306dca6..3fb1f407d5e6 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -23,7 +23,7 @@ struct wm8994_ldo_pdata {
23 int enable; 23 int enable;
24 24
25 const char *supply; 25 const char *supply;
26 struct regulator_init_data *init_data; 26 const struct regulator_init_data *init_data;
27}; 27};
28 28
29#define WM8994_CONFIGURE_GPIO 0x10000 29#define WM8994_CONFIGURE_GPIO 0x10000
@@ -113,6 +113,23 @@ struct wm8958_enh_eq_cfg {
113 u16 regs[WM8958_ENH_EQ_REGS]; 113 u16 regs[WM8958_ENH_EQ_REGS];
114}; 114};
115 115
116/**
117 * Microphone detection rates, used to tune response rates and power
118 * consumption for WM8958/WM1811 microphone detection.
119 *
120 * @sysclk: System clock rate to use this configuration for.
121 * @idle: True if this configuration should use when no accessory is detected,
122 * false otherwise.
123 * @start: Value for MICD_BIAS_START_TIME register field (not shifted).
124 * @rate: Value for MICD_RATE register field (not shifted).
125 */
126struct wm8958_micd_rate {
127 int sysclk;
128 bool idle;
129 int start;
130 int rate;
131};
132
116struct wm8994_pdata { 133struct wm8994_pdata {
117 int gpio_base; 134 int gpio_base;
118 135
@@ -144,6 +161,9 @@ struct wm8994_pdata {
144 int num_enh_eq_cfgs; 161 int num_enh_eq_cfgs;
145 struct wm8958_enh_eq_cfg *enh_eq_cfgs; 162 struct wm8958_enh_eq_cfg *enh_eq_cfgs;
146 163
164 int num_micd_rates;
165 struct wm8958_micd_rate *micd_rates;
166
147 /* LINEOUT can be differential or single ended */ 167 /* LINEOUT can be differential or single ended */
148 unsigned int lineout1_diff:1; 168 unsigned int lineout1_diff:1;
149 unsigned int lineout2_diff:1; 169 unsigned int lineout2_diff:1;
@@ -168,12 +188,21 @@ struct wm8994_pdata {
168 /* WM8958 microphone bias configuration */ 188 /* WM8958 microphone bias configuration */
169 int micbias[2]; 189 int micbias[2];
170 190
191 /* WM8958 microphone detection ranges */
192 u16 micd_lvl_sel;
193
171 /* Disable the internal pull downs on the LDOs if they are 194 /* Disable the internal pull downs on the LDOs if they are
172 * always driven (eg, connected to an always on supply or 195 * always driven (eg, connected to an always on supply or
173 * GPIO that always drives an output. If they float power 196 * GPIO that always drives an output. If they float power
174 * consumption will rise. 197 * consumption will rise.
175 */ 198 */
176 bool ldo_ena_always_driven; 199 bool ldo_ena_always_driven;
200
201 /*
202 * SPKMODE must be pulled internally by the device on this
203 * system.
204 */
205 bool spkmode_pu;
177}; 206};
178 207
179#endif 208#endif
diff --git a/include/linux/mfd/wm8994/registers.h b/include/linux/mfd/wm8994/registers.h
index 83a9caec0e43..86e6a032a078 100644
--- a/include/linux/mfd/wm8994/registers.h
+++ b/include/linux/mfd/wm8994/registers.h
@@ -95,11 +95,15 @@
95#define WM8994_FLL1_CONTROL_3 0x222 95#define WM8994_FLL1_CONTROL_3 0x222
96#define WM8994_FLL1_CONTROL_4 0x223 96#define WM8994_FLL1_CONTROL_4 0x223
97#define WM8994_FLL1_CONTROL_5 0x224 97#define WM8994_FLL1_CONTROL_5 0x224
98#define WM8958_FLL1_EFS_1 0x226
99#define WM8958_FLL1_EFS_2 0x227
98#define WM8994_FLL2_CONTROL_1 0x240 100#define WM8994_FLL2_CONTROL_1 0x240
99#define WM8994_FLL2_CONTROL_2 0x241 101#define WM8994_FLL2_CONTROL_2 0x241
100#define WM8994_FLL2_CONTROL_3 0x242 102#define WM8994_FLL2_CONTROL_3 0x242
101#define WM8994_FLL2_CONTROL_4 0x243 103#define WM8994_FLL2_CONTROL_4 0x243
102#define WM8994_FLL2_CONTROL_5 0x244 104#define WM8994_FLL2_CONTROL_5 0x244
105#define WM8958_FLL2_EFS_1 0x246
106#define WM8958_FLL2_EFS_2 0x247
103#define WM8994_AIF1_CONTROL_1 0x300 107#define WM8994_AIF1_CONTROL_1 0x300
104#define WM8994_AIF1_CONTROL_2 0x301 108#define WM8994_AIF1_CONTROL_2 0x301
105#define WM8994_AIF1_MASTER_SLAVE 0x302 109#define WM8994_AIF1_MASTER_SLAVE 0x302
@@ -116,6 +120,7 @@
116#define WM8994_AIF2DAC_LRCLK 0x315 120#define WM8994_AIF2DAC_LRCLK 0x315
117#define WM8994_AIF2DAC_DATA 0x316 121#define WM8994_AIF2DAC_DATA 0x316
118#define WM8994_AIF2ADC_DATA 0x317 122#define WM8994_AIF2ADC_DATA 0x317
123#define WM1811_AIF2TX_CONTROL 0x318
119#define WM8958_AIF3_CONTROL_1 0x320 124#define WM8958_AIF3_CONTROL_1 0x320
120#define WM8958_AIF3_CONTROL_2 0x321 125#define WM8958_AIF3_CONTROL_2 0x321
121#define WM8958_AIF3DAC_DATA 0x322 126#define WM8958_AIF3DAC_DATA 0x322
@@ -166,6 +171,7 @@
166#define WM8994_AIF1_DAC1_EQ_BAND_5_A 0x491 171#define WM8994_AIF1_DAC1_EQ_BAND_5_A 0x491
167#define WM8994_AIF1_DAC1_EQ_BAND_5_B 0x492 172#define WM8994_AIF1_DAC1_EQ_BAND_5_B 0x492
168#define WM8994_AIF1_DAC1_EQ_BAND_5_PG 0x493 173#define WM8994_AIF1_DAC1_EQ_BAND_5_PG 0x493
174#define WM8994_AIF1_DAC1_EQ_BAND_1_C 0x494
169#define WM8994_AIF1_DAC2_EQ_GAINS_1 0x4A0 175#define WM8994_AIF1_DAC2_EQ_GAINS_1 0x4A0
170#define WM8994_AIF1_DAC2_EQ_GAINS_2 0x4A1 176#define WM8994_AIF1_DAC2_EQ_GAINS_2 0x4A1
171#define WM8994_AIF1_DAC2_EQ_BAND_1_A 0x4A2 177#define WM8994_AIF1_DAC2_EQ_BAND_1_A 0x4A2
@@ -186,6 +192,7 @@
186#define WM8994_AIF1_DAC2_EQ_BAND_5_A 0x4B1 192#define WM8994_AIF1_DAC2_EQ_BAND_5_A 0x4B1
187#define WM8994_AIF1_DAC2_EQ_BAND_5_B 0x4B2 193#define WM8994_AIF1_DAC2_EQ_BAND_5_B 0x4B2
188#define WM8994_AIF1_DAC2_EQ_BAND_5_PG 0x4B3 194#define WM8994_AIF1_DAC2_EQ_BAND_5_PG 0x4B3
195#define WM8994_AIF1_DAC2_EQ_BAND_1_C 0x4B4
189#define WM8994_AIF2_ADC_LEFT_VOLUME 0x500 196#define WM8994_AIF2_ADC_LEFT_VOLUME 0x500
190#define WM8994_AIF2_ADC_RIGHT_VOLUME 0x501 197#define WM8994_AIF2_ADC_RIGHT_VOLUME 0x501
191#define WM8994_AIF2_DAC_LEFT_VOLUME 0x502 198#define WM8994_AIF2_DAC_LEFT_VOLUME 0x502
@@ -219,6 +226,7 @@
219#define WM8994_AIF2_EQ_BAND_5_A 0x591 226#define WM8994_AIF2_EQ_BAND_5_A 0x591
220#define WM8994_AIF2_EQ_BAND_5_B 0x592 227#define WM8994_AIF2_EQ_BAND_5_B 0x592
221#define WM8994_AIF2_EQ_BAND_5_PG 0x593 228#define WM8994_AIF2_EQ_BAND_5_PG 0x593
229#define WM8994_AIF2_EQ_BAND_1_C 0x594
222#define WM8994_DAC1_MIXER_VOLUMES 0x600 230#define WM8994_DAC1_MIXER_VOLUMES 0x600
223#define WM8994_DAC1_LEFT_MIXER_ROUTING 0x601 231#define WM8994_DAC1_LEFT_MIXER_ROUTING 0x601
224#define WM8994_DAC1_RIGHT_MIXER_ROUTING 0x602 232#define WM8994_DAC1_RIGHT_MIXER_ROUTING 0x602
@@ -242,6 +250,7 @@
242#define WM8994_GPIO_4 0x703 250#define WM8994_GPIO_4 0x703
243#define WM8994_GPIO_5 0x704 251#define WM8994_GPIO_5 0x704
244#define WM8994_GPIO_6 0x705 252#define WM8994_GPIO_6 0x705
253#define WM1811_JACKDET_CTRL 0x705
245#define WM8994_GPIO_7 0x706 254#define WM8994_GPIO_7 0x706
246#define WM8994_GPIO_8 0x707 255#define WM8994_GPIO_8 0x707
247#define WM8994_GPIO_9 0x708 256#define WM8994_GPIO_9 0x708
@@ -264,7 +273,43 @@
264#define WM8958_DSP2_RELEASETIME 0xA03 273#define WM8958_DSP2_RELEASETIME 0xA03
265#define WM8958_DSP2_VERMAJMIN 0xA04 274#define WM8958_DSP2_VERMAJMIN 0xA04
266#define WM8958_DSP2_VERBUILD 0xA05 275#define WM8958_DSP2_VERBUILD 0xA05
276#define WM8958_DSP2_TESTREG 0xA06
277#define WM8958_DSP2_XORREG 0xA07
278#define WM8958_DSP2_SHIFTMAXX 0xA08
279#define WM8958_DSP2_SHIFTMAXY 0xA09
280#define WM8958_DSP2_SHIFTMAXZ 0xA0A
281#define WM8958_DSP2_SHIFTMAXEXTLO 0xA0B
282#define WM8958_DSP2_AESSELECT 0xA0C
267#define WM8958_DSP2_EXECCONTROL 0xA0D 283#define WM8958_DSP2_EXECCONTROL 0xA0D
284#define WM8958_DSP2_SAMPLEBREAK 0xA0E
285#define WM8958_DSP2_COUNTBREAK 0xA0F
286#define WM8958_DSP2_INTSTATUS 0xA10
287#define WM8958_DSP2_EVENTSTATUS 0xA11
288#define WM8958_DSP2_INTMASK 0xA12
289#define WM8958_DSP2_CONFIGDWIDTH 0xA13
290#define WM8958_DSP2_CONFIGINSTR 0xA14
291#define WM8958_DSP2_CONFIGDMEM 0xA15
292#define WM8958_DSP2_CONFIGDELAYS 0xA16
293#define WM8958_DSP2_CONFIGNUMIO 0xA17
294#define WM8958_DSP2_CONFIGEXTDEPTH 0xA18
295#define WM8958_DSP2_CONFIGMULTIPLIER 0xA19
296#define WM8958_DSP2_CONFIGCTRLDWIDTH 0xA1A
297#define WM8958_DSP2_CONFIGPIPELINE 0xA1B
298#define WM8958_DSP2_SHIFTMAXEXTHI 0xA1C
299#define WM8958_DSP2_SWVERSIONREG 0xA1D
300#define WM8958_DSP2_CONFIGXMEM 0xA1E
301#define WM8958_DSP2_CONFIGYMEM 0xA1F
302#define WM8958_DSP2_CONFIGZMEM 0xA20
303#define WM8958_FW_BUILD_1 0x2000
304#define WM8958_FW_BUILD_0 0x2001
305#define WM8958_FW_ID_1 0x2002
306#define WM8958_FW_ID_0 0x2003
307#define WM8958_FW_MAJOR_1 0x2004
308#define WM8958_FW_MAJOR_0 0x2005
309#define WM8958_FW_MINOR_1 0x2006
310#define WM8958_FW_MINOR_0 0x2007
311#define WM8958_FW_PATCH_1 0x2008
312#define WM8958_FW_PATCH_0 0x2009
268#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C1_1 0x2200 313#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C1_1 0x2200
269#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C1_2 0x2201 314#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C1_2 0x2201
270#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C2_1 0x2202 315#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C2_1 0x2202
@@ -333,6 +378,14 @@
333#define WM8958_MBC_B2_PG2_2 0x242D 378#define WM8958_MBC_B2_PG2_2 0x242D
334#define WM8958_MBC_B1_PG2_1 0x242E 379#define WM8958_MBC_B1_PG2_1 0x242E
335#define WM8958_MBC_B1_PG2_2 0x242F 380#define WM8958_MBC_B1_PG2_2 0x242F
381#define WM8958_MBC_CROSSOVER_1 0x2600
382#define WM8958_MBC_CROSSOVER_2 0x2601
383#define WM8958_MBC_HPF_1 0x2602
384#define WM8958_MBC_HPF_2 0x2603
385#define WM8958_MBC_LPF_1 0x2606
386#define WM8958_MBC_LPF_2 0x2607
387#define WM8958_MBC_RMS_LIMIT_1 0x260A
388#define WM8958_MBC_RMS_LIMIT_2 0x260B
336#define WM8994_WRITE_SEQUENCER_0 0x3000 389#define WM8994_WRITE_SEQUENCER_0 0x3000
337#define WM8994_WRITE_SEQUENCER_1 0x3001 390#define WM8994_WRITE_SEQUENCER_1 0x3001
338#define WM8994_WRITE_SEQUENCER_2 0x3002 391#define WM8994_WRITE_SEQUENCER_2 0x3002
@@ -1852,6 +1905,9 @@
1852/* 1905/*
1853 * R57 (0x39) - AntiPOP (2) 1906 * R57 (0x39) - AntiPOP (2)
1854 */ 1907 */
1908#define WM1811_JACKDET_MODE_MASK 0x0180 /* JACKDET_MODE - [8:7] */
1909#define WM1811_JACKDET_MODE_SHIFT 7 /* JACKDET_MODE - [8:7] */
1910#define WM1811_JACKDET_MODE_WIDTH 2 /* JACKDET_MODE - [8:7] */
1855#define WM8994_MICB2_DISCH 0x0100 /* MICB2_DISCH */ 1911#define WM8994_MICB2_DISCH 0x0100 /* MICB2_DISCH */
1856#define WM8994_MICB2_DISCH_MASK 0x0100 /* MICB2_DISCH */ 1912#define WM8994_MICB2_DISCH_MASK 0x0100 /* MICB2_DISCH */
1857#define WM8994_MICB2_DISCH_SHIFT 8 /* MICB2_DISCH */ 1913#define WM8994_MICB2_DISCH_SHIFT 8 /* MICB2_DISCH */
@@ -2389,6 +2445,10 @@
2389/* 2445/*
2390 * R548 (0x224) - FLL1 Control (5) 2446 * R548 (0x224) - FLL1 Control (5)
2391 */ 2447 */
2448#define WM8958_FLL1_BYP 0x8000 /* FLL1_BYP */
2449#define WM8958_FLL1_BYP_MASK 0x8000 /* FLL1_BYP */
2450#define WM8958_FLL1_BYP_SHIFT 15 /* FLL1_BYP */
2451#define WM8958_FLL1_BYP_WIDTH 1 /* FLL1_BYP */
2392#define WM8994_FLL1_FRC_NCO_VAL_MASK 0x1F80 /* FLL1_FRC_NCO_VAL - [12:7] */ 2452#define WM8994_FLL1_FRC_NCO_VAL_MASK 0x1F80 /* FLL1_FRC_NCO_VAL - [12:7] */
2393#define WM8994_FLL1_FRC_NCO_VAL_SHIFT 7 /* FLL1_FRC_NCO_VAL - [12:7] */ 2453#define WM8994_FLL1_FRC_NCO_VAL_SHIFT 7 /* FLL1_FRC_NCO_VAL - [12:7] */
2394#define WM8994_FLL1_FRC_NCO_VAL_WIDTH 6 /* FLL1_FRC_NCO_VAL - [12:7] */ 2454#define WM8994_FLL1_FRC_NCO_VAL_WIDTH 6 /* FLL1_FRC_NCO_VAL - [12:7] */
@@ -2404,6 +2464,24 @@
2404#define WM8994_FLL1_REFCLK_SRC_WIDTH 2 /* FLL1_REFCLK_SRC - [1:0] */ 2464#define WM8994_FLL1_REFCLK_SRC_WIDTH 2 /* FLL1_REFCLK_SRC - [1:0] */
2405 2465
2406/* 2466/*
2467 * R550 (0x226) - FLL1 EFS 1
2468 */
2469#define WM8958_FLL1_LAMBDA_MASK 0xFFFF /* FLL1_LAMBDA - [15:0] */
2470#define WM8958_FLL1_LAMBDA_SHIFT 0 /* FLL1_LAMBDA - [15:0] */
2471#define WM8958_FLL1_LAMBDA_WIDTH 16 /* FLL1_LAMBDA - [15:0] */
2472
2473/*
2474 * R551 (0x227) - FLL1 EFS 2
2475 */
2476#define WM8958_FLL1_LFSR_SEL_MASK 0x0006 /* FLL1_LFSR_SEL - [2:1] */
2477#define WM8958_FLL1_LFSR_SEL_SHIFT 1 /* FLL1_LFSR_SEL - [2:1] */
2478#define WM8958_FLL1_LFSR_SEL_WIDTH 2 /* FLL1_LFSR_SEL - [2:1] */
2479#define WM8958_FLL1_EFS_ENA 0x0001 /* FLL1_EFS_ENA */
2480#define WM8958_FLL1_EFS_ENA_MASK 0x0001 /* FLL1_EFS_ENA */
2481#define WM8958_FLL1_EFS_ENA_SHIFT 0 /* FLL1_EFS_ENA */
2482#define WM8958_FLL1_EFS_ENA_WIDTH 1 /* FLL1_EFS_ENA */
2483
2484/*
2407 * R576 (0x240) - FLL2 Control (1) 2485 * R576 (0x240) - FLL2 Control (1)
2408 */ 2486 */
2409#define WM8994_FLL2_FRAC 0x0004 /* FLL2_FRAC */ 2487#define WM8994_FLL2_FRAC 0x0004 /* FLL2_FRAC */
@@ -2452,6 +2530,10 @@
2452/* 2530/*
2453 * R580 (0x244) - FLL2 Control (5) 2531 * R580 (0x244) - FLL2 Control (5)
2454 */ 2532 */
2533#define WM8958_FLL2_BYP 0x8000 /* FLL2_BYP */
2534#define WM8958_FLL2_BYP_MASK 0x8000 /* FLL2_BYP */
2535#define WM8958_FLL2_BYP_SHIFT 15 /* FLL2_BYP */
2536#define WM8958_FLL2_BYP_WIDTH 1 /* FLL2_BYP */
2455#define WM8994_FLL2_FRC_NCO_VAL_MASK 0x1F80 /* FLL2_FRC_NCO_VAL - [12:7] */ 2537#define WM8994_FLL2_FRC_NCO_VAL_MASK 0x1F80 /* FLL2_FRC_NCO_VAL - [12:7] */
2456#define WM8994_FLL2_FRC_NCO_VAL_SHIFT 7 /* FLL2_FRC_NCO_VAL - [12:7] */ 2538#define WM8994_FLL2_FRC_NCO_VAL_SHIFT 7 /* FLL2_FRC_NCO_VAL - [12:7] */
2457#define WM8994_FLL2_FRC_NCO_VAL_WIDTH 6 /* FLL2_FRC_NCO_VAL - [12:7] */ 2539#define WM8994_FLL2_FRC_NCO_VAL_WIDTH 6 /* FLL2_FRC_NCO_VAL - [12:7] */
@@ -2467,6 +2549,24 @@
2467#define WM8994_FLL2_REFCLK_SRC_WIDTH 2 /* FLL2_REFCLK_SRC - [1:0] */ 2549#define WM8994_FLL2_REFCLK_SRC_WIDTH 2 /* FLL2_REFCLK_SRC - [1:0] */
2468 2550
2469/* 2551/*
2552 * R582 (0x246) - FLL2 EFS 1
2553 */
2554#define WM8958_FLL2_LAMBDA_MASK 0xFFFF /* FLL2_LAMBDA - [15:0] */
2555#define WM8958_FLL2_LAMBDA_SHIFT 0 /* FLL2_LAMBDA - [15:0] */
2556#define WM8958_FLL2_LAMBDA_WIDTH 16 /* FLL2_LAMBDA - [15:0] */
2557
2558/*
2559 * R583 (0x247) - FLL2 EFS 2
2560 */
2561#define WM8958_FLL2_LFSR_SEL_MASK 0x0006 /* FLL2_LFSR_SEL - [2:1] */
2562#define WM8958_FLL2_LFSR_SEL_SHIFT 1 /* FLL2_LFSR_SEL - [2:1] */
2563#define WM8958_FLL2_LFSR_SEL_WIDTH 2 /* FLL2_LFSR_SEL - [2:1] */
2564#define WM8958_FLL2_EFS_ENA 0x0001 /* FLL2_EFS_ENA */
2565#define WM8958_FLL2_EFS_ENA_MASK 0x0001 /* FLL2_EFS_ENA */
2566#define WM8958_FLL2_EFS_ENA_SHIFT 0 /* FLL2_EFS_ENA */
2567#define WM8958_FLL2_EFS_ENA_WIDTH 1 /* FLL2_EFS_ENA */
2568
2569/*
2470 * R768 (0x300) - AIF1 Control (1) 2570 * R768 (0x300) - AIF1 Control (1)
2471 */ 2571 */
2472#define WM8994_AIF1ADCL_SRC 0x8000 /* AIF1ADCL_SRC */ 2572#define WM8994_AIF1ADCL_SRC 0x8000 /* AIF1ADCL_SRC */
@@ -4187,6 +4287,18 @@
4187#define WM8994_STL_SEL_WIDTH 1 /* STL_SEL */ 4287#define WM8994_STL_SEL_WIDTH 1 /* STL_SEL */
4188 4288
4189/* 4289/*
4290 * R1797 (0x705) - JACKDET Ctrl
4291 */
4292#define WM1811_JACKDET_DB 0x0100 /* JACKDET_DB */
4293#define WM1811_JACKDET_DB_MASK 0x0100 /* JACKDET_DB */
4294#define WM1811_JACKDET_DB_SHIFT 8 /* JACKDET_DB */
4295#define WM1811_JACKDET_DB_WIDTH 1 /* JACKDET_DB */
4296#define WM1811_JACKDET_LVL 0x0040 /* JACKDET_LVL */
4297#define WM1811_JACKDET_LVL_MASK 0x0040 /* JACKDET_LVL */
4298#define WM1811_JACKDET_LVL_SHIFT 6 /* JACKDET_LVL */
4299#define WM1811_JACKDET_LVL_WIDTH 1 /* JACKDET_LVL */
4300
4301/*
4190 * R1824 (0x720) - Pull Control (1) 4302 * R1824 (0x720) - Pull Control (1)
4191 */ 4303 */
4192#define WM8994_DMICDAT2_PU 0x0800 /* DMICDAT2_PU */ 4304#define WM8994_DMICDAT2_PU 0x0800 /* DMICDAT2_PU */
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index e39aeecfe9a2..05ed2828a553 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <linux/mempolicy.h> 5#include <linux/mempolicy.h>
6#include <linux/migrate_mode.h>
6 7
7typedef struct page *new_page_t(struct page *, unsigned long private, int **); 8typedef struct page *new_page_t(struct page *, unsigned long private, int **);
8 9
@@ -11,13 +12,13 @@ typedef struct page *new_page_t(struct page *, unsigned long private, int **);
11 12
12extern void putback_lru_pages(struct list_head *l); 13extern void putback_lru_pages(struct list_head *l);
13extern int migrate_page(struct address_space *, 14extern int migrate_page(struct address_space *,
14 struct page *, struct page *); 15 struct page *, struct page *, enum migrate_mode);
15extern int migrate_pages(struct list_head *l, new_page_t x, 16extern int migrate_pages(struct list_head *l, new_page_t x,
16 unsigned long private, bool offlining, 17 unsigned long private, bool offlining,
17 bool sync); 18 enum migrate_mode mode);
18extern int migrate_huge_pages(struct list_head *l, new_page_t x, 19extern int migrate_huge_pages(struct list_head *l, new_page_t x,
19 unsigned long private, bool offlining, 20 unsigned long private, bool offlining,
20 bool sync); 21 enum migrate_mode mode);
21 22
22extern int fail_migrate_page(struct address_space *, 23extern int fail_migrate_page(struct address_space *,
23 struct page *, struct page *); 24 struct page *, struct page *);
@@ -36,10 +37,10 @@ extern int migrate_huge_page_move_mapping(struct address_space *mapping,
36static inline void putback_lru_pages(struct list_head *l) {} 37static inline void putback_lru_pages(struct list_head *l) {}
37static inline int migrate_pages(struct list_head *l, new_page_t x, 38static inline int migrate_pages(struct list_head *l, new_page_t x,
38 unsigned long private, bool offlining, 39 unsigned long private, bool offlining,
39 bool sync) { return -ENOSYS; } 40 enum migrate_mode mode) { return -ENOSYS; }
40static inline int migrate_huge_pages(struct list_head *l, new_page_t x, 41static inline int migrate_huge_pages(struct list_head *l, new_page_t x,
41 unsigned long private, bool offlining, 42 unsigned long private, bool offlining,
42 bool sync) { return -ENOSYS; } 43 enum migrate_mode mode) { return -ENOSYS; }
43 44
44static inline int migrate_prep(void) { return -ENOSYS; } 45static inline int migrate_prep(void) { return -ENOSYS; }
45static inline int migrate_prep_local(void) { return -ENOSYS; } 46static inline int migrate_prep_local(void) { return -ENOSYS; }
diff --git a/include/linux/migrate_mode.h b/include/linux/migrate_mode.h
new file mode 100644
index 000000000000..ebf3d89a3919
--- /dev/null
+++ b/include/linux/migrate_mode.h
@@ -0,0 +1,16 @@
1#ifndef MIGRATE_MODE_H_INCLUDED
2#define MIGRATE_MODE_H_INCLUDED
3/*
4 * MIGRATE_ASYNC means never block
5 * MIGRATE_SYNC_LIGHT in the current implementation means to allow blocking
6 * on most operations but not ->writepage as the potential stall time
7 * is too significant
8 * MIGRATE_SYNC will block when migrating pages
9 */
10enum migrate_mode {
11 MIGRATE_ASYNC,
12 MIGRATE_SYNC_LIGHT,
13 MIGRATE_SYNC,
14};
15
16#endif /* MIGRATE_MODE_H_INCLUDED */
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 27748230aa69..2783eca629a0 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -9,6 +9,7 @@
9#define __LINUX_MII_H__ 9#define __LINUX_MII_H__
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/ethtool.h>
12 13
13/* Generic MII registers. */ 14/* Generic MII registers. */
14#define MII_BMCR 0x00 /* Basic mode control register */ 15#define MII_BMCR 0x00 /* Basic mode control register */
@@ -240,6 +241,205 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
240} 241}
241 242
242/** 243/**
244 * ethtool_adv_to_mii_adv_t
245 * @ethadv: the ethtool advertisement settings
246 *
247 * A small helper function that translates ethtool advertisement
248 * settings to phy autonegotiation advertisements for the
249 * MII_ADVERTISE register.
250 */
251static inline u32 ethtool_adv_to_mii_adv_t(u32 ethadv)
252{
253 u32 result = 0;
254
255 if (ethadv & ADVERTISED_10baseT_Half)
256 result |= ADVERTISE_10HALF;
257 if (ethadv & ADVERTISED_10baseT_Full)
258 result |= ADVERTISE_10FULL;
259 if (ethadv & ADVERTISED_100baseT_Half)
260 result |= ADVERTISE_100HALF;
261 if (ethadv & ADVERTISED_100baseT_Full)
262 result |= ADVERTISE_100FULL;
263 if (ethadv & ADVERTISED_Pause)
264 result |= ADVERTISE_PAUSE_CAP;
265 if (ethadv & ADVERTISED_Asym_Pause)
266 result |= ADVERTISE_PAUSE_ASYM;
267
268 return result;
269}
270
271/**
272 * mii_adv_to_ethtool_adv_t
273 * @adv: value of the MII_ADVERTISE register
274 *
275 * A small helper function that translates MII_ADVERTISE bits
276 * to ethtool advertisement settings.
277 */
278static inline u32 mii_adv_to_ethtool_adv_t(u32 adv)
279{
280 u32 result = 0;
281
282 if (adv & ADVERTISE_10HALF)
283 result |= ADVERTISED_10baseT_Half;
284 if (adv & ADVERTISE_10FULL)
285 result |= ADVERTISED_10baseT_Full;
286 if (adv & ADVERTISE_100HALF)
287 result |= ADVERTISED_100baseT_Half;
288 if (adv & ADVERTISE_100FULL)
289 result |= ADVERTISED_100baseT_Full;
290 if (adv & ADVERTISE_PAUSE_CAP)
291 result |= ADVERTISED_Pause;
292 if (adv & ADVERTISE_PAUSE_ASYM)
293 result |= ADVERTISED_Asym_Pause;
294
295 return result;
296}
297
298/**
299 * ethtool_adv_to_mii_ctrl1000_t
300 * @ethadv: the ethtool advertisement settings
301 *
302 * A small helper function that translates ethtool advertisement
303 * settings to phy autonegotiation advertisements for the
304 * MII_CTRL1000 register when in 1000T mode.
305 */
306static inline u32 ethtool_adv_to_mii_ctrl1000_t(u32 ethadv)
307{
308 u32 result = 0;
309
310 if (ethadv & ADVERTISED_1000baseT_Half)
311 result |= ADVERTISE_1000HALF;
312 if (ethadv & ADVERTISED_1000baseT_Full)
313 result |= ADVERTISE_1000FULL;
314
315 return result;
316}
317
318/**
319 * mii_ctrl1000_to_ethtool_adv_t
320 * @adv: value of the MII_CTRL1000 register
321 *
322 * A small helper function that translates MII_CTRL1000
323 * bits, when in 1000Base-T mode, to ethtool
324 * advertisement settings.
325 */
326static inline u32 mii_ctrl1000_to_ethtool_adv_t(u32 adv)
327{
328 u32 result = 0;
329
330 if (adv & ADVERTISE_1000HALF)
331 result |= ADVERTISED_1000baseT_Half;
332 if (adv & ADVERTISE_1000FULL)
333 result |= ADVERTISED_1000baseT_Full;
334
335 return result;
336}
337
338/**
339 * mii_lpa_to_ethtool_lpa_t
340 * @adv: value of the MII_LPA register
341 *
342 * A small helper function that translates MII_LPA
343 * bits, when in 1000Base-T mode, to ethtool
344 * LP advertisement settings.
345 */
346static inline u32 mii_lpa_to_ethtool_lpa_t(u32 lpa)
347{
348 u32 result = 0;
349
350 if (lpa & LPA_LPACK)
351 result |= ADVERTISED_Autoneg;
352
353 return result | mii_adv_to_ethtool_adv_t(lpa);
354}
355
356/**
357 * mii_stat1000_to_ethtool_lpa_t
358 * @adv: value of the MII_STAT1000 register
359 *
360 * A small helper function that translates MII_STAT1000
361 * bits, when in 1000Base-T mode, to ethtool
362 * advertisement settings.
363 */
364static inline u32 mii_stat1000_to_ethtool_lpa_t(u32 lpa)
365{
366 u32 result = 0;
367
368 if (lpa & LPA_1000HALF)
369 result |= ADVERTISED_1000baseT_Half;
370 if (lpa & LPA_1000FULL)
371 result |= ADVERTISED_1000baseT_Full;
372
373 return result;
374}
375
376/**
377 * ethtool_adv_to_mii_adv_x
378 * @ethadv: the ethtool advertisement settings
379 *
380 * A small helper function that translates ethtool advertisement
381 * settings to phy autonegotiation advertisements for the
382 * MII_CTRL1000 register when in 1000Base-X mode.
383 */
384static inline u32 ethtool_adv_to_mii_adv_x(u32 ethadv)
385{
386 u32 result = 0;
387
388 if (ethadv & ADVERTISED_1000baseT_Half)
389 result |= ADVERTISE_1000XHALF;
390 if (ethadv & ADVERTISED_1000baseT_Full)
391 result |= ADVERTISE_1000XFULL;
392 if (ethadv & ADVERTISED_Pause)
393 result |= ADVERTISE_1000XPAUSE;
394 if (ethadv & ADVERTISED_Asym_Pause)
395 result |= ADVERTISE_1000XPSE_ASYM;
396
397 return result;
398}
399
400/**
401 * mii_adv_to_ethtool_adv_x
402 * @adv: value of the MII_CTRL1000 register
403 *
404 * A small helper function that translates MII_CTRL1000
405 * bits, when in 1000Base-X mode, to ethtool
406 * advertisement settings.
407 */
408static inline u32 mii_adv_to_ethtool_adv_x(u32 adv)
409{
410 u32 result = 0;
411
412 if (adv & ADVERTISE_1000XHALF)
413 result |= ADVERTISED_1000baseT_Half;
414 if (adv & ADVERTISE_1000XFULL)
415 result |= ADVERTISED_1000baseT_Full;
416 if (adv & ADVERTISE_1000XPAUSE)
417 result |= ADVERTISED_Pause;
418 if (adv & ADVERTISE_1000XPSE_ASYM)
419 result |= ADVERTISED_Asym_Pause;
420
421 return result;
422}
423
424/**
425 * mii_lpa_to_ethtool_lpa_x
426 * @adv: value of the MII_LPA register
427 *
428 * A small helper function that translates MII_LPA
429 * bits, when in 1000Base-X mode, to ethtool
430 * LP advertisement settings.
431 */
432static inline u32 mii_lpa_to_ethtool_lpa_x(u32 lpa)
433{
434 u32 result = 0;
435
436 if (lpa & LPA_LPACK)
437 result |= ADVERTISED_Autoneg;
438
439 return result | mii_adv_to_ethtool_adv_x(lpa);
440}
441
442/**
243 * mii_advertise_flowctrl - get flow control advertisement flags 443 * mii_advertise_flowctrl - get flow control advertisement flags
244 * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both) 444 * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both)
245 */ 445 */
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index c41d7270c6c6..0549d2115507 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -42,6 +42,7 @@
42#define AUTOFS_MINOR 235 42#define AUTOFS_MINOR 235
43#define MAPPER_CTRL_MINOR 236 43#define MAPPER_CTRL_MINOR 236
44#define LOOP_CTRL_MINOR 237 44#define LOOP_CTRL_MINOR 237
45#define VHOST_NET_MINOR 238
45#define MISC_DYNAMIC_MINOR 255 46#define MISC_DYNAMIC_MINOR 255
46 47
47struct device; 48struct device;
@@ -54,7 +55,7 @@ struct miscdevice {
54 struct device *parent; 55 struct device *parent;
55 struct device *this_device; 56 struct device *this_device;
56 const char *nodename; 57 const char *nodename;
57 mode_t mode; 58 umode_t mode;
58}; 59};
59 60
60extern int misc_register(struct miscdevice * misc); 61extern int misc_register(struct miscdevice * misc);
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index b56e4587208d..9958ff2cad3c 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -59,12 +59,15 @@ enum {
59 MLX4_CMD_HW_HEALTH_CHECK = 0x50, 59 MLX4_CMD_HW_HEALTH_CHECK = 0x50,
60 MLX4_CMD_SET_PORT = 0xc, 60 MLX4_CMD_SET_PORT = 0xc,
61 MLX4_CMD_SET_NODE = 0x5a, 61 MLX4_CMD_SET_NODE = 0x5a,
62 MLX4_CMD_QUERY_FUNC = 0x56,
62 MLX4_CMD_ACCESS_DDR = 0x2e, 63 MLX4_CMD_ACCESS_DDR = 0x2e,
63 MLX4_CMD_MAP_ICM = 0xffa, 64 MLX4_CMD_MAP_ICM = 0xffa,
64 MLX4_CMD_UNMAP_ICM = 0xff9, 65 MLX4_CMD_UNMAP_ICM = 0xff9,
65 MLX4_CMD_MAP_ICM_AUX = 0xffc, 66 MLX4_CMD_MAP_ICM_AUX = 0xffc,
66 MLX4_CMD_UNMAP_ICM_AUX = 0xffb, 67 MLX4_CMD_UNMAP_ICM_AUX = 0xffb,
67 MLX4_CMD_SET_ICM_SIZE = 0xffd, 68 MLX4_CMD_SET_ICM_SIZE = 0xffd,
69 /*master notify fw on finish for slave's flr*/
70 MLX4_CMD_INFORM_FLR_DONE = 0x5b,
68 71
69 /* TPT commands */ 72 /* TPT commands */
70 MLX4_CMD_SW2HW_MPT = 0xd, 73 MLX4_CMD_SW2HW_MPT = 0xd,
@@ -119,6 +122,26 @@ enum {
119 /* miscellaneous commands */ 122 /* miscellaneous commands */
120 MLX4_CMD_DIAG_RPRT = 0x30, 123 MLX4_CMD_DIAG_RPRT = 0x30,
121 MLX4_CMD_NOP = 0x31, 124 MLX4_CMD_NOP = 0x31,
125 MLX4_CMD_ACCESS_MEM = 0x2e,
126 MLX4_CMD_SET_VEP = 0x52,
127
128 /* Ethernet specific commands */
129 MLX4_CMD_SET_VLAN_FLTR = 0x47,
130 MLX4_CMD_SET_MCAST_FLTR = 0x48,
131 MLX4_CMD_DUMP_ETH_STATS = 0x49,
132
133 /* Communication channel commands */
134 MLX4_CMD_ARM_COMM_CHANNEL = 0x57,
135 MLX4_CMD_GEN_EQE = 0x58,
136
137 /* virtual commands */
138 MLX4_CMD_ALLOC_RES = 0xf00,
139 MLX4_CMD_FREE_RES = 0xf01,
140 MLX4_CMD_MCAST_ATTACH = 0xf05,
141 MLX4_CMD_UCAST_ATTACH = 0xf06,
142 MLX4_CMD_PROMISC = 0xf08,
143 MLX4_CMD_QUERY_FUNC_CAP = 0xf0a,
144 MLX4_CMD_QP_ATTACH = 0xf0b,
122 145
123 /* debug commands */ 146 /* debug commands */
124 MLX4_CMD_QUERY_DEBUG_MSG = 0x2a, 147 MLX4_CMD_QUERY_DEBUG_MSG = 0x2a,
@@ -126,6 +149,7 @@ enum {
126 149
127 /* statistics commands */ 150 /* statistics commands */
128 MLX4_CMD_QUERY_IF_STAT = 0X54, 151 MLX4_CMD_QUERY_IF_STAT = 0X54,
152 MLX4_CMD_SET_IF_STAT = 0X55,
129}; 153};
130 154
131enum { 155enum {
@@ -135,7 +159,8 @@ enum {
135}; 159};
136 160
137enum { 161enum {
138 MLX4_MAILBOX_SIZE = 4096 162 MLX4_MAILBOX_SIZE = 4096,
163 MLX4_ACCESS_MEM_ALIGN = 256,
139}; 164};
140 165
141enum { 166enum {
@@ -148,6 +173,11 @@ enum {
148 MLX4_SET_PORT_GID_TABLE = 0x5, 173 MLX4_SET_PORT_GID_TABLE = 0x5,
149}; 174};
150 175
176enum {
177 MLX4_CMD_WRAPPED,
178 MLX4_CMD_NATIVE
179};
180
151struct mlx4_dev; 181struct mlx4_dev;
152 182
153struct mlx4_cmd_mailbox { 183struct mlx4_cmd_mailbox {
@@ -157,23 +187,24 @@ struct mlx4_cmd_mailbox {
157 187
158int __mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u64 *out_param, 188int __mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
159 int out_is_imm, u32 in_modifier, u8 op_modifier, 189 int out_is_imm, u32 in_modifier, u8 op_modifier,
160 u16 op, unsigned long timeout); 190 u16 op, unsigned long timeout, int native);
161 191
162/* Invoke a command with no output parameter */ 192/* Invoke a command with no output parameter */
163static inline int mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u32 in_modifier, 193static inline int mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u32 in_modifier,
164 u8 op_modifier, u16 op, unsigned long timeout) 194 u8 op_modifier, u16 op, unsigned long timeout,
195 int native)
165{ 196{
166 return __mlx4_cmd(dev, in_param, NULL, 0, in_modifier, 197 return __mlx4_cmd(dev, in_param, NULL, 0, in_modifier,
167 op_modifier, op, timeout); 198 op_modifier, op, timeout, native);
168} 199}
169 200
170/* Invoke a command with an output mailbox */ 201/* Invoke a command with an output mailbox */
171static inline int mlx4_cmd_box(struct mlx4_dev *dev, u64 in_param, u64 out_param, 202static inline int mlx4_cmd_box(struct mlx4_dev *dev, u64 in_param, u64 out_param,
172 u32 in_modifier, u8 op_modifier, u16 op, 203 u32 in_modifier, u8 op_modifier, u16 op,
173 unsigned long timeout) 204 unsigned long timeout, int native)
174{ 205{
175 return __mlx4_cmd(dev, in_param, &out_param, 0, in_modifier, 206 return __mlx4_cmd(dev, in_param, &out_param, 0, in_modifier,
176 op_modifier, op, timeout); 207 op_modifier, op, timeout, native);
177} 208}
178 209
179/* 210/*
@@ -183,13 +214,17 @@ static inline int mlx4_cmd_box(struct mlx4_dev *dev, u64 in_param, u64 out_param
183 */ 214 */
184static inline int mlx4_cmd_imm(struct mlx4_dev *dev, u64 in_param, u64 *out_param, 215static inline int mlx4_cmd_imm(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
185 u32 in_modifier, u8 op_modifier, u16 op, 216 u32 in_modifier, u8 op_modifier, u16 op,
186 unsigned long timeout) 217 unsigned long timeout, int native)
187{ 218{
188 return __mlx4_cmd(dev, in_param, out_param, 1, in_modifier, 219 return __mlx4_cmd(dev, in_param, out_param, 1, in_modifier,
189 op_modifier, op, timeout); 220 op_modifier, op, timeout, native);
190} 221}
191 222
192struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev); 223struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev);
193void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox); 224void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox);
194 225
226u32 mlx4_comm_get_version(void);
227
228#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8)
229
195#endif /* MLX4_CMD_H */ 230#endif /* MLX4_CMD_H */
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 84b0b1848f17..aea61905499b 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -47,6 +47,9 @@
47enum { 47enum {
48 MLX4_FLAG_MSI_X = 1 << 0, 48 MLX4_FLAG_MSI_X = 1 << 0,
49 MLX4_FLAG_OLD_PORT_CMDS = 1 << 1, 49 MLX4_FLAG_OLD_PORT_CMDS = 1 << 1,
50 MLX4_FLAG_MASTER = 1 << 2,
51 MLX4_FLAG_SLAVE = 1 << 3,
52 MLX4_FLAG_SRIOV = 1 << 4,
50}; 53};
51 54
52enum { 55enum {
@@ -58,6 +61,15 @@ enum {
58}; 61};
59 62
60enum { 63enum {
64 MLX4_MAX_NUM_PF = 16,
65 MLX4_MAX_NUM_VF = 64,
66 MLX4_MFUNC_MAX = 80,
67 MLX4_MFUNC_EQ_NUM = 4,
68 MLX4_MFUNC_MAX_EQES = 8,
69 MLX4_MFUNC_EQE_MASK = (MLX4_MFUNC_MAX_EQES - 1)
70};
71
72enum {
61 MLX4_DEV_CAP_FLAG_RC = 1LL << 0, 73 MLX4_DEV_CAP_FLAG_RC = 1LL << 0,
62 MLX4_DEV_CAP_FLAG_UC = 1LL << 1, 74 MLX4_DEV_CAP_FLAG_UC = 1LL << 1,
63 MLX4_DEV_CAP_FLAG_UD = 1LL << 2, 75 MLX4_DEV_CAP_FLAG_UD = 1LL << 2,
@@ -77,11 +89,13 @@ enum {
77 MLX4_DEV_CAP_FLAG_IBOE = 1LL << 30, 89 MLX4_DEV_CAP_FLAG_IBOE = 1LL << 30,
78 MLX4_DEV_CAP_FLAG_UC_LOOPBACK = 1LL << 32, 90 MLX4_DEV_CAP_FLAG_UC_LOOPBACK = 1LL << 32,
79 MLX4_DEV_CAP_FLAG_FCS_KEEP = 1LL << 34, 91 MLX4_DEV_CAP_FLAG_FCS_KEEP = 1LL << 34,
80 MLX4_DEV_CAP_FLAG_WOL = 1LL << 38, 92 MLX4_DEV_CAP_FLAG_WOL_PORT1 = 1LL << 37,
93 MLX4_DEV_CAP_FLAG_WOL_PORT2 = 1LL << 38,
81 MLX4_DEV_CAP_FLAG_UDP_RSS = 1LL << 40, 94 MLX4_DEV_CAP_FLAG_UDP_RSS = 1LL << 40,
82 MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41, 95 MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41,
83 MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42, 96 MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42,
84 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48 97 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48,
98 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55
85}; 99};
86 100
87#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) 101#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
@@ -116,7 +130,11 @@ enum mlx4_event {
116 MLX4_EVENT_TYPE_PORT_CHANGE = 0x09, 130 MLX4_EVENT_TYPE_PORT_CHANGE = 0x09,
117 MLX4_EVENT_TYPE_EQ_OVERFLOW = 0x0f, 131 MLX4_EVENT_TYPE_EQ_OVERFLOW = 0x0f,
118 MLX4_EVENT_TYPE_ECC_DETECT = 0x0e, 132 MLX4_EVENT_TYPE_ECC_DETECT = 0x0e,
119 MLX4_EVENT_TYPE_CMD = 0x0a 133 MLX4_EVENT_TYPE_CMD = 0x0a,
134 MLX4_EVENT_TYPE_VEP_UPDATE = 0x19,
135 MLX4_EVENT_TYPE_COMM_CHANNEL = 0x18,
136 MLX4_EVENT_TYPE_FLR_EVENT = 0x1c,
137 MLX4_EVENT_TYPE_NONE = 0xff,
120}; 138};
121 139
122enum { 140enum {
@@ -183,6 +201,7 @@ enum mlx4_qp_region {
183}; 201};
184 202
185enum mlx4_port_type { 203enum mlx4_port_type {
204 MLX4_PORT_TYPE_NONE = 0,
186 MLX4_PORT_TYPE_IB = 1, 205 MLX4_PORT_TYPE_IB = 1,
187 MLX4_PORT_TYPE_ETH = 2, 206 MLX4_PORT_TYPE_ETH = 2,
188 MLX4_PORT_TYPE_AUTO = 3 207 MLX4_PORT_TYPE_AUTO = 3
@@ -215,6 +234,7 @@ static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
215 234
216struct mlx4_caps { 235struct mlx4_caps {
217 u64 fw_ver; 236 u64 fw_ver;
237 u32 function;
218 int num_ports; 238 int num_ports;
219 int vl_cap[MLX4_MAX_PORTS + 1]; 239 int vl_cap[MLX4_MAX_PORTS + 1];
220 int ib_mtu_cap[MLX4_MAX_PORTS + 1]; 240 int ib_mtu_cap[MLX4_MAX_PORTS + 1];
@@ -229,6 +249,7 @@ struct mlx4_caps {
229 u64 trans_code[MLX4_MAX_PORTS + 1]; 249 u64 trans_code[MLX4_MAX_PORTS + 1];
230 int local_ca_ack_delay; 250 int local_ca_ack_delay;
231 int num_uars; 251 int num_uars;
252 u32 uar_page_size;
232 int bf_reg_size; 253 int bf_reg_size;
233 int bf_regs_per_page; 254 int bf_regs_per_page;
234 int max_sq_sg; 255 int max_sq_sg;
@@ -252,8 +273,7 @@ struct mlx4_caps {
252 int num_comp_vectors; 273 int num_comp_vectors;
253 int comp_pool; 274 int comp_pool;
254 int num_mpts; 275 int num_mpts;
255 int num_mtt_segs; 276 int num_mtts;
256 int mtts_per_seg;
257 int fmr_reserved_mtts; 277 int fmr_reserved_mtts;
258 int reserved_mtts; 278 int reserved_mtts;
259 int reserved_mrws; 279 int reserved_mrws;
@@ -283,7 +303,9 @@ struct mlx4_caps {
283 int log_num_prios; 303 int log_num_prios;
284 enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1]; 304 enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1];
285 u8 supported_type[MLX4_MAX_PORTS + 1]; 305 u8 supported_type[MLX4_MAX_PORTS + 1];
286 u32 port_mask; 306 u8 suggested_type[MLX4_MAX_PORTS + 1];
307 u8 default_sense[MLX4_MAX_PORTS + 1];
308 u32 port_mask[MLX4_MAX_PORTS + 1];
287 enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1]; 309 enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1];
288 u32 max_counters; 310 u32 max_counters;
289 u8 ext_port_cap[MLX4_MAX_PORTS + 1]; 311 u8 ext_port_cap[MLX4_MAX_PORTS + 1];
@@ -303,7 +325,7 @@ struct mlx4_buf {
303}; 325};
304 326
305struct mlx4_mtt { 327struct mlx4_mtt {
306 u32 first_seg; 328 u32 offset;
307 int order; 329 int order;
308 int page_shift; 330 int page_shift;
309}; 331};
@@ -465,10 +487,12 @@ struct mlx4_counter {
465struct mlx4_dev { 487struct mlx4_dev {
466 struct pci_dev *pdev; 488 struct pci_dev *pdev;
467 unsigned long flags; 489 unsigned long flags;
490 unsigned long num_slaves;
468 struct mlx4_caps caps; 491 struct mlx4_caps caps;
469 struct radix_tree_root qp_table_tree; 492 struct radix_tree_root qp_table_tree;
470 u8 rev_id; 493 u8 rev_id;
471 char board_id[MLX4_BOARD_ID_LEN]; 494 char board_id[MLX4_BOARD_ID_LEN];
495 int num_vfs;
472}; 496};
473 497
474struct mlx4_init_port_param { 498struct mlx4_init_port_param {
@@ -487,14 +511,32 @@ struct mlx4_init_port_param {
487 511
488#define mlx4_foreach_port(port, dev, type) \ 512#define mlx4_foreach_port(port, dev, type) \
489 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ 513 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
490 if (((type) == MLX4_PORT_TYPE_IB ? (dev)->caps.port_mask : \ 514 if ((type) == (dev)->caps.port_mask[(port)])
491 ~(dev)->caps.port_mask) & 1 << ((port) - 1))
492 515
493#define mlx4_foreach_ib_transport_port(port, dev) \ 516#define mlx4_foreach_ib_transport_port(port, dev) \
494 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ 517 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
495 if (((dev)->caps.port_mask & 1 << ((port) - 1)) || \ 518 if (((dev)->caps.port_mask[port] == MLX4_PORT_TYPE_IB) || \
496 ((dev)->caps.flags & MLX4_DEV_CAP_FLAG_IBOE)) 519 ((dev)->caps.flags & MLX4_DEV_CAP_FLAG_IBOE))
497 520
521static inline int mlx4_is_master(struct mlx4_dev *dev)
522{
523 return dev->flags & MLX4_FLAG_MASTER;
524}
525
526static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn)
527{
528 return (qpn < dev->caps.sqp_start + 8);
529}
530
531static inline int mlx4_is_mfunc(struct mlx4_dev *dev)
532{
533 return dev->flags & (MLX4_FLAG_SLAVE | MLX4_FLAG_MASTER);
534}
535
536static inline int mlx4_is_slave(struct mlx4_dev *dev)
537{
538 return dev->flags & MLX4_FLAG_SLAVE;
539}
498 540
499int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, 541int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
500 struct mlx4_buf *buf); 542 struct mlx4_buf *buf);
@@ -560,6 +602,10 @@ int mlx4_srq_query(struct mlx4_dev *dev, struct mlx4_srq *srq, int *limit_waterm
560int mlx4_INIT_PORT(struct mlx4_dev *dev, int port); 602int mlx4_INIT_PORT(struct mlx4_dev *dev, int port);
561int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port); 603int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port);
562 604
605int mlx4_unicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
606 int block_mcast_loopback, enum mlx4_protocol prot);
607int mlx4_unicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
608 enum mlx4_protocol prot);
563int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], 609int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
564 int block_mcast_loopback, enum mlx4_protocol protocol); 610 int block_mcast_loopback, enum mlx4_protocol protocol);
565int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], 611int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
@@ -570,9 +616,12 @@ int mlx4_unicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port);
570int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port); 616int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port);
571int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode); 617int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode);
572 618
573int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn, u8 wrap); 619int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac);
574void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int qpn); 620void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac);
575int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac, u8 wrap); 621int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac);
622int mlx4_get_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn);
623void mlx4_put_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int qpn);
624void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap);
576 625
577int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 626int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
578int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 627int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 48cc4cb97858..bee8fa231276 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -97,6 +97,33 @@ enum {
97 MLX4_QP_BIT_RIC = 1 << 4, 97 MLX4_QP_BIT_RIC = 1 << 4,
98}; 98};
99 99
100enum {
101 MLX4_RSS_HASH_XOR = 0,
102 MLX4_RSS_HASH_TOP = 1,
103
104 MLX4_RSS_UDP_IPV6 = 1 << 0,
105 MLX4_RSS_UDP_IPV4 = 1 << 1,
106 MLX4_RSS_TCP_IPV6 = 1 << 2,
107 MLX4_RSS_IPV6 = 1 << 3,
108 MLX4_RSS_TCP_IPV4 = 1 << 4,
109 MLX4_RSS_IPV4 = 1 << 5,
110
111 /* offset of mlx4_rss_context within mlx4_qp_context.pri_path */
112 MLX4_RSS_OFFSET_IN_QPC_PRI_PATH = 0x24,
113 /* offset of being RSS indirection QP within mlx4_qp_context.flags */
114 MLX4_RSS_QPC_FLAG_OFFSET = 13,
115};
116
117struct mlx4_rss_context {
118 __be32 base_qpn;
119 __be32 default_qpn;
120 u16 reserved;
121 u8 hash_fn;
122 u8 flags;
123 __be32 rss_key[10];
124 __be32 base_qpn_udp;
125};
126
100struct mlx4_qp_path { 127struct mlx4_qp_path {
101 u8 fl; 128 u8 fl;
102 u8 reserved1[2]; 129 u8 reserved1[2];
@@ -183,6 +210,7 @@ struct mlx4_wqe_ctrl_seg {
183 * [4] IP checksum 210 * [4] IP checksum
184 * [3:2] C (generate completion queue entry) 211 * [3:2] C (generate completion queue entry)
185 * [1] SE (solicited event) 212 * [1] SE (solicited event)
213 * [0] FL (force loopback)
186 */ 214 */
187 __be32 srcrb_flags; 215 __be32 srcrb_flags;
188 /* 216 /*
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 4baadd18f4ad..17b27cd269c4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1253,41 +1253,34 @@ static inline void pgtable_page_dtor(struct page *page)
1253extern void free_area_init(unsigned long * zones_size); 1253extern void free_area_init(unsigned long * zones_size);
1254extern void free_area_init_node(int nid, unsigned long * zones_size, 1254extern void free_area_init_node(int nid, unsigned long * zones_size,
1255 unsigned long zone_start_pfn, unsigned long *zholes_size); 1255 unsigned long zone_start_pfn, unsigned long *zholes_size);
1256#ifdef CONFIG_ARCH_POPULATES_NODE_MAP 1256#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
1257/* 1257/*
1258 * With CONFIG_ARCH_POPULATES_NODE_MAP set, an architecture may initialise its 1258 * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its
1259 * zones, allocate the backing mem_map and account for memory holes in a more 1259 * zones, allocate the backing mem_map and account for memory holes in a more
1260 * architecture independent manner. This is a substitute for creating the 1260 * architecture independent manner. This is a substitute for creating the
1261 * zone_sizes[] and zholes_size[] arrays and passing them to 1261 * zone_sizes[] and zholes_size[] arrays and passing them to
1262 * free_area_init_node() 1262 * free_area_init_node()
1263 * 1263 *
1264 * An architecture is expected to register range of page frames backed by 1264 * An architecture is expected to register range of page frames backed by
1265 * physical memory with add_active_range() before calling 1265 * physical memory with memblock_add[_node]() before calling
1266 * free_area_init_nodes() passing in the PFN each zone ends at. At a basic 1266 * free_area_init_nodes() passing in the PFN each zone ends at. At a basic
1267 * usage, an architecture is expected to do something like 1267 * usage, an architecture is expected to do something like
1268 * 1268 *
1269 * unsigned long max_zone_pfns[MAX_NR_ZONES] = {max_dma, max_normal_pfn, 1269 * unsigned long max_zone_pfns[MAX_NR_ZONES] = {max_dma, max_normal_pfn,
1270 * max_highmem_pfn}; 1270 * max_highmem_pfn};
1271 * for_each_valid_physical_page_range() 1271 * for_each_valid_physical_page_range()
1272 * add_active_range(node_id, start_pfn, end_pfn) 1272 * memblock_add_node(base, size, nid)
1273 * free_area_init_nodes(max_zone_pfns); 1273 * free_area_init_nodes(max_zone_pfns);
1274 * 1274 *
1275 * If the architecture guarantees that there are no holes in the ranges 1275 * free_bootmem_with_active_regions() calls free_bootmem_node() for each
1276 * registered with add_active_range(), free_bootmem_active_regions() 1276 * registered physical page range. Similarly
1277 * will call free_bootmem_node() for each registered physical page range. 1277 * sparse_memory_present_with_active_regions() calls memory_present() for
1278 * Similarly sparse_memory_present_with_active_regions() calls 1278 * each range when SPARSEMEM is enabled.
1279 * memory_present() for each range when SPARSEMEM is enabled.
1280 * 1279 *
1281 * See mm/page_alloc.c for more information on each function exposed by 1280 * See mm/page_alloc.c for more information on each function exposed by
1282 * CONFIG_ARCH_POPULATES_NODE_MAP 1281 * CONFIG_HAVE_MEMBLOCK_NODE_MAP.
1283 */ 1282 */
1284extern void free_area_init_nodes(unsigned long *max_zone_pfn); 1283extern void free_area_init_nodes(unsigned long *max_zone_pfn);
1285extern void add_active_range(unsigned int nid, unsigned long start_pfn,
1286 unsigned long end_pfn);
1287extern void remove_active_range(unsigned int nid, unsigned long start_pfn,
1288 unsigned long end_pfn);
1289extern void remove_all_active_ranges(void);
1290void sort_node_map(void);
1291unsigned long node_map_pfn_alignment(void); 1284unsigned long node_map_pfn_alignment(void);
1292unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn, 1285unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn,
1293 unsigned long end_pfn); 1286 unsigned long end_pfn);
@@ -1300,14 +1293,11 @@ extern void free_bootmem_with_active_regions(int nid,
1300 unsigned long max_low_pfn); 1293 unsigned long max_low_pfn);
1301int add_from_early_node_map(struct range *range, int az, 1294int add_from_early_node_map(struct range *range, int az,
1302 int nr_range, int nid); 1295 int nr_range, int nid);
1303u64 __init find_memory_core_early(int nid, u64 size, u64 align,
1304 u64 goal, u64 limit);
1305typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
1306extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data);
1307extern void sparse_memory_present_with_active_regions(int nid); 1296extern void sparse_memory_present_with_active_regions(int nid);
1308#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
1309 1297
1310#if !defined(CONFIG_ARCH_POPULATES_NODE_MAP) && \ 1298#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
1299
1300#if !defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) && \
1311 !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) 1301 !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID)
1312static inline int __early_pfn_to_nid(unsigned long pfn) 1302static inline int __early_pfn_to_nid(unsigned long pfn)
1313{ 1303{
@@ -1492,6 +1482,18 @@ static inline unsigned long vma_pages(struct vm_area_struct *vma)
1492 return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 1482 return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
1493} 1483}
1494 1484
1485/* Look up the first VMA which exactly match the interval vm_start ... vm_end */
1486static inline struct vm_area_struct *find_exact_vma(struct mm_struct *mm,
1487 unsigned long vm_start, unsigned long vm_end)
1488{
1489 struct vm_area_struct *vma = find_vma(mm, vm_start);
1490
1491 if (vma && (vma->vm_start != vm_start || vma->vm_end != vm_end))
1492 vma = NULL;
1493
1494 return vma;
1495}
1496
1495#ifdef CONFIG_MMU 1497#ifdef CONFIG_MMU
1496pgprot_t vm_get_page_prot(unsigned long vm_flags); 1498pgprot_t vm_get_page_prot(unsigned long vm_flags);
1497#else 1499#else
@@ -1538,23 +1540,13 @@ static inline void vm_stat_account(struct mm_struct *mm,
1538#endif /* CONFIG_PROC_FS */ 1540#endif /* CONFIG_PROC_FS */
1539 1541
1540#ifdef CONFIG_DEBUG_PAGEALLOC 1542#ifdef CONFIG_DEBUG_PAGEALLOC
1541extern int debug_pagealloc_enabled;
1542
1543extern void kernel_map_pages(struct page *page, int numpages, int enable); 1543extern void kernel_map_pages(struct page *page, int numpages, int enable);
1544
1545static inline void enable_debug_pagealloc(void)
1546{
1547 debug_pagealloc_enabled = 1;
1548}
1549#ifdef CONFIG_HIBERNATION 1544#ifdef CONFIG_HIBERNATION
1550extern bool kernel_page_present(struct page *page); 1545extern bool kernel_page_present(struct page *page);
1551#endif /* CONFIG_HIBERNATION */ 1546#endif /* CONFIG_HIBERNATION */
1552#else 1547#else
1553static inline void 1548static inline void
1554kernel_map_pages(struct page *page, int numpages, int enable) {} 1549kernel_map_pages(struct page *page, int numpages, int enable) {}
1555static inline void enable_debug_pagealloc(void)
1556{
1557}
1558#ifdef CONFIG_HIBERNATION 1550#ifdef CONFIG_HIBERNATION
1559static inline bool kernel_page_present(struct page *page) { return true; } 1551static inline bool kernel_page_present(struct page *page) { return true; }
1560#endif /* CONFIG_HIBERNATION */ 1552#endif /* CONFIG_HIBERNATION */
@@ -1628,5 +1620,22 @@ extern void copy_user_huge_page(struct page *dst, struct page *src,
1628 unsigned int pages_per_huge_page); 1620 unsigned int pages_per_huge_page);
1629#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ 1621#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
1630 1622
1623#ifdef CONFIG_DEBUG_PAGEALLOC
1624extern unsigned int _debug_guardpage_minorder;
1625
1626static inline unsigned int debug_guardpage_minorder(void)
1627{
1628 return _debug_guardpage_minorder;
1629}
1630
1631static inline bool page_is_guard(struct page *page)
1632{
1633 return test_bit(PAGE_DEBUG_FLAG_GUARD, &page->debug_flags);
1634}
1635#else
1636static inline unsigned int debug_guardpage_minorder(void) { return 0; }
1637static inline bool page_is_guard(struct page *page) { return false; }
1638#endif /* CONFIG_DEBUG_PAGEALLOC */
1639
1631#endif /* __KERNEL__ */ 1640#endif /* __KERNEL__ */
1632#endif /* _LINUX_MM_H */ 1641#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 8f7d24712dc1..227fd3e9a9c9 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -22,26 +22,21 @@ static inline int page_is_file_cache(struct page *page)
22} 22}
23 23
24static inline void 24static inline void
25__add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l, 25add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list lru)
26 struct list_head *head)
27{ 26{
28 list_add(&page->lru, head); 27 struct lruvec *lruvec;
29 __mod_zone_page_state(zone, NR_LRU_BASE + l, hpage_nr_pages(page));
30 mem_cgroup_add_lru_list(page, l);
31}
32 28
33static inline void 29 lruvec = mem_cgroup_lru_add_list(zone, page, lru);
34add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l) 30 list_add(&page->lru, &lruvec->lists[lru]);
35{ 31 __mod_zone_page_state(zone, NR_LRU_BASE + lru, hpage_nr_pages(page));
36 __add_page_to_lru_list(zone, page, l, &zone->lru[l].list);
37} 32}
38 33
39static inline void 34static inline void
40del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l) 35del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list lru)
41{ 36{
37 mem_cgroup_lru_del_list(page, lru);
42 list_del(&page->lru); 38 list_del(&page->lru);
43 __mod_zone_page_state(zone, NR_LRU_BASE + l, -hpage_nr_pages(page)); 39 __mod_zone_page_state(zone, NR_LRU_BASE + lru, -hpage_nr_pages(page));
44 mem_cgroup_del_lru_list(page, l);
45} 40}
46 41
47/** 42/**
@@ -59,24 +54,28 @@ static inline enum lru_list page_lru_base_type(struct page *page)
59 return LRU_INACTIVE_ANON; 54 return LRU_INACTIVE_ANON;
60} 55}
61 56
62static inline void 57/**
63del_page_from_lru(struct zone *zone, struct page *page) 58 * page_off_lru - which LRU list was page on? clearing its lru flags.
59 * @page: the page to test
60 *
61 * Returns the LRU list a page was on, as an index into the array of LRU
62 * lists; and clears its Unevictable or Active flags, ready for freeing.
63 */
64static inline enum lru_list page_off_lru(struct page *page)
64{ 65{
65 enum lru_list l; 66 enum lru_list lru;
66 67
67 list_del(&page->lru);
68 if (PageUnevictable(page)) { 68 if (PageUnevictable(page)) {
69 __ClearPageUnevictable(page); 69 __ClearPageUnevictable(page);
70 l = LRU_UNEVICTABLE; 70 lru = LRU_UNEVICTABLE;
71 } else { 71 } else {
72 l = page_lru_base_type(page); 72 lru = page_lru_base_type(page);
73 if (PageActive(page)) { 73 if (PageActive(page)) {
74 __ClearPageActive(page); 74 __ClearPageActive(page);
75 l += LRU_ACTIVE; 75 lru += LRU_ACTIVE;
76 } 76 }
77 } 77 }
78 __mod_zone_page_state(zone, NR_LRU_BASE + l, -hpage_nr_pages(page)); 78 return lru;
79 mem_cgroup_del_lru_list(page, l);
80} 79}
81 80
82/** 81/**
@@ -97,7 +96,6 @@ static inline enum lru_list page_lru(struct page *page)
97 if (PageActive(page)) 96 if (PageActive(page))
98 lru += LRU_ACTIVE; 97 lru += LRU_ACTIVE;
99 } 98 }
100
101 return lru; 99 return lru;
102} 100}
103 101
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 5b42f1b34eb7..3cc3062b3767 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -151,12 +151,11 @@ struct page {
151#endif 151#endif
152} 152}
153/* 153/*
154 * If another subsystem starts using the double word pairing for atomic 154 * The struct page can be forced to be double word aligned so that atomic ops
155 * operations on struct page then it must change the #if to ensure 155 * on double words work. The SLUB allocator can make use of such a feature.
156 * proper alignment of the page struct.
157 */ 156 */
158#if defined(CONFIG_SLUB) && defined(CONFIG_CMPXCHG_LOCAL) 157#ifdef CONFIG_HAVE_ALIGNED_STRUCT_PAGE
159 __attribute__((__aligned__(2*sizeof(unsigned long)))) 158 __aligned(2 * sizeof(unsigned long))
160#endif 159#endif
161; 160;
162 161
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index c8ef9bc54d50..19a41d1737af 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -71,6 +71,8 @@ struct mmc_ext_csd {
71 bool hpi_en; /* HPI enablebit */ 71 bool hpi_en; /* HPI enablebit */
72 bool hpi; /* HPI support bit */ 72 bool hpi; /* HPI support bit */
73 unsigned int hpi_cmd; /* cmd used as HPI */ 73 unsigned int hpi_cmd; /* cmd used as HPI */
74 unsigned int boot_ro_lock; /* ro lock support */
75 bool boot_ro_lockable;
74 u8 raw_partition_support; /* 160 */ 76 u8 raw_partition_support; /* 160 */
75 u8 raw_erased_mem_count; /* 181 */ 77 u8 raw_erased_mem_count; /* 181 */
76 u8 raw_ext_csd_structure; /* 194 */ 78 u8 raw_ext_csd_structure; /* 194 */
@@ -110,6 +112,7 @@ struct sd_ssr {
110struct sd_switch_caps { 112struct sd_switch_caps {
111 unsigned int hs_max_dtr; 113 unsigned int hs_max_dtr;
112 unsigned int uhs_max_dtr; 114 unsigned int uhs_max_dtr;
115#define HIGH_SPEED_MAX_DTR 50000000
113#define UHS_SDR104_MAX_DTR 208000000 116#define UHS_SDR104_MAX_DTR 208000000
114#define UHS_SDR50_MAX_DTR 100000000 117#define UHS_SDR50_MAX_DTR 100000000
115#define UHS_DDR50_MAX_DTR 50000000 118#define UHS_DDR50_MAX_DTR 50000000
@@ -117,11 +120,13 @@ struct sd_switch_caps {
117#define UHS_SDR12_MAX_DTR 25000000 120#define UHS_SDR12_MAX_DTR 25000000
118 unsigned int sd3_bus_mode; 121 unsigned int sd3_bus_mode;
119#define UHS_SDR12_BUS_SPEED 0 122#define UHS_SDR12_BUS_SPEED 0
123#define HIGH_SPEED_BUS_SPEED 1
120#define UHS_SDR25_BUS_SPEED 1 124#define UHS_SDR25_BUS_SPEED 1
121#define UHS_SDR50_BUS_SPEED 2 125#define UHS_SDR50_BUS_SPEED 2
122#define UHS_SDR104_BUS_SPEED 3 126#define UHS_SDR104_BUS_SPEED 3
123#define UHS_DDR50_BUS_SPEED 4 127#define UHS_DDR50_BUS_SPEED 4
124 128
129#define SD_MODE_HIGH_SPEED (1 << HIGH_SPEED_BUS_SPEED)
125#define SD_MODE_UHS_SDR12 (1 << UHS_SDR12_BUS_SPEED) 130#define SD_MODE_UHS_SDR12 (1 << UHS_SDR12_BUS_SPEED)
126#define SD_MODE_UHS_SDR25 (1 << UHS_SDR25_BUS_SPEED) 131#define SD_MODE_UHS_SDR25 (1 << UHS_SDR25_BUS_SPEED)
127#define SD_MODE_UHS_SDR50 (1 << UHS_SDR50_BUS_SPEED) 132#define SD_MODE_UHS_SDR50 (1 << UHS_SDR50_BUS_SPEED)
@@ -184,6 +189,10 @@ struct mmc_part {
184 unsigned int part_cfg; /* partition type */ 189 unsigned int part_cfg; /* partition type */
185 char name[MAX_MMC_PART_NAME_LEN]; 190 char name[MAX_MMC_PART_NAME_LEN];
186 bool force_ro; /* to make boot parts RO by default */ 191 bool force_ro; /* to make boot parts RO by default */
192 unsigned int area_type;
193#define MMC_BLK_DATA_AREA_MAIN (1<<0)
194#define MMC_BLK_DATA_AREA_BOOT (1<<1)
195#define MMC_BLK_DATA_AREA_GP (1<<2)
187}; 196};
188 197
189/* 198/*
@@ -206,6 +215,9 @@ struct mmc_card {
206#define MMC_STATE_HIGHSPEED_DDR (1<<4) /* card is in high speed mode */ 215#define MMC_STATE_HIGHSPEED_DDR (1<<4) /* card is in high speed mode */
207#define MMC_STATE_ULTRAHIGHSPEED (1<<5) /* card is in ultra high speed mode */ 216#define MMC_STATE_ULTRAHIGHSPEED (1<<5) /* card is in ultra high speed mode */
208#define MMC_CARD_SDXC (1<<6) /* card is SDXC */ 217#define MMC_CARD_SDXC (1<<6) /* card is SDXC */
218#define MMC_CARD_REMOVED (1<<7) /* card has been removed */
219#define MMC_STATE_HIGHSPEED_200 (1<<8) /* card is in HS200 mode */
220#define MMC_STATE_SLEEP (1<<9) /* card is in sleep state */
209 unsigned int quirks; /* card quirks */ 221 unsigned int quirks; /* card quirks */
210#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ 222#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
211#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ 223#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */
@@ -261,12 +273,14 @@ struct mmc_card {
261 * This function fill contents in mmc_part. 273 * This function fill contents in mmc_part.
262 */ 274 */
263static inline void mmc_part_add(struct mmc_card *card, unsigned int size, 275static inline void mmc_part_add(struct mmc_card *card, unsigned int size,
264 unsigned int part_cfg, char *name, int idx, bool ro) 276 unsigned int part_cfg, char *name, int idx, bool ro,
277 int area_type)
265{ 278{
266 card->part[card->nr_parts].size = size; 279 card->part[card->nr_parts].size = size;
267 card->part[card->nr_parts].part_cfg = part_cfg; 280 card->part[card->nr_parts].part_cfg = part_cfg;
268 sprintf(card->part[card->nr_parts].name, name, idx); 281 sprintf(card->part[card->nr_parts].name, name, idx);
269 card->part[card->nr_parts].force_ro = ro; 282 card->part[card->nr_parts].force_ro = ro;
283 card->part[card->nr_parts].area_type = area_type;
270 card->nr_parts++; 284 card->nr_parts++;
271} 285}
272 286
@@ -362,19 +376,28 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
362#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) 376#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT)
363#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) 377#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
364#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED) 378#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED)
379#define mmc_card_hs200(c) ((c)->state & MMC_STATE_HIGHSPEED_200)
365#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR) 380#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR)
366#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR) 381#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR)
367#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED) 382#define mmc_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
383#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
368#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC) 384#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC)
385#define mmc_card_removed(c) ((c) && ((c)->state & MMC_CARD_REMOVED))
386#define mmc_card_is_sleep(c) ((c)->state & MMC_STATE_SLEEP)
369 387
370#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) 388#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
371#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) 389#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
372#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED) 390#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
391#define mmc_card_set_hs200(c) ((c)->state |= MMC_STATE_HIGHSPEED_200)
373#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) 392#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
374#define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR) 393#define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR)
394#define mmc_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED)
375#define mmc_sd_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED) 395#define mmc_sd_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED)
376#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC) 396#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC)
397#define mmc_card_set_removed(c) ((c)->state |= MMC_CARD_REMOVED)
398#define mmc_card_set_sleep(c) ((c)->state |= MMC_STATE_SLEEP)
377 399
400#define mmc_card_clr_sleep(c) ((c)->state &= ~MMC_STATE_SLEEP)
378/* 401/*
379 * Quirk add/remove for MMC products. 402 * Quirk add/remove for MMC products.
380 */ 403 */
diff --git a/include/linux/mmc/cd-gpio.h b/include/linux/mmc/cd-gpio.h
new file mode 100644
index 000000000000..a8e469783318
--- /dev/null
+++ b/include/linux/mmc/cd-gpio.h
@@ -0,0 +1,19 @@
1/*
2 * Generic GPIO card-detect helper header
3 *
4 * Copyright (C) 2011, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef MMC_CD_GPIO_H
12#define MMC_CD_GPIO_H
13
14struct mmc_host;
15int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio,
16 unsigned int irq, unsigned long flags);
17void mmc_cd_gpio_free(struct mmc_host *host);
18
19#endif
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 174a844a5dda..87a976cc5654 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -180,6 +180,8 @@ extern int mmc_try_claim_host(struct mmc_host *host);
180 180
181extern int mmc_flush_cache(struct mmc_card *); 181extern int mmc_flush_cache(struct mmc_card *);
182 182
183extern int mmc_detect_card_removed(struct mmc_host *host);
184
183/** 185/**
184 * mmc_claim_host - exclusively claim a host 186 * mmc_claim_host - exclusively claim a host
185 * @host: mmc host to claim 187 * @host: mmc host to claim
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 6dc9b80568a0..aae5d1f1bb39 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -14,6 +14,8 @@
14#ifndef LINUX_MMC_DW_MMC_H 14#ifndef LINUX_MMC_DW_MMC_H
15#define LINUX_MMC_DW_MMC_H 15#define LINUX_MMC_DW_MMC_H
16 16
17#include <linux/scatterlist.h>
18
17#define MAX_MCI_SLOTS 2 19#define MAX_MCI_SLOTS 2
18 20
19enum dw_mci_state { 21enum dw_mci_state {
@@ -40,7 +42,7 @@ struct mmc_data;
40 * @lock: Spinlock protecting the queue and associated data. 42 * @lock: Spinlock protecting the queue and associated data.
41 * @regs: Pointer to MMIO registers. 43 * @regs: Pointer to MMIO registers.
42 * @sg: Scatterlist entry currently being processed by PIO code, if any. 44 * @sg: Scatterlist entry currently being processed by PIO code, if any.
43 * @pio_offset: Offset into the current scatterlist entry. 45 * @sg_miter: PIO mapping scatterlist iterator.
44 * @cur_slot: The slot which is currently using the controller. 46 * @cur_slot: The slot which is currently using the controller.
45 * @mrq: The request currently being processed on @cur_slot, 47 * @mrq: The request currently being processed on @cur_slot,
46 * or NULL if the controller is idle. 48 * or NULL if the controller is idle.
@@ -115,7 +117,7 @@ struct dw_mci {
115 void __iomem *regs; 117 void __iomem *regs;
116 118
117 struct scatterlist *sg; 119 struct scatterlist *sg;
118 unsigned int pio_offset; 120 struct sg_mapping_iter sg_miter;
119 121
120 struct dw_mci_slot *cur_slot; 122 struct dw_mci_slot *cur_slot;
121 struct mmc_request *mrq; 123 struct mmc_request *mrq;
@@ -214,6 +216,7 @@ struct dw_mci_board {
214 unsigned int bus_hz; /* Bus speed */ 216 unsigned int bus_hz; /* Bus speed */
215 217
216 unsigned int caps; /* Capabilities */ 218 unsigned int caps; /* Capabilities */
219 unsigned int caps2; /* More capabilities */
217 /* 220 /*
218 * Override fifo depth. If 0, autodetect it from the FIFOTH register, 221 * Override fifo depth. If 0, autodetect it from the FIFOTH register,
219 * but note that this may not be reliable after a bootloader has used 222 * but note that this may not be reliable after a bootloader has used
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index a3ac9c48e5de..ee2b0363c040 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -56,10 +56,13 @@ struct mmc_ios {
56#define MMC_TIMING_UHS_SDR50 3 56#define MMC_TIMING_UHS_SDR50 3
57#define MMC_TIMING_UHS_SDR104 4 57#define MMC_TIMING_UHS_SDR104 4
58#define MMC_TIMING_UHS_DDR50 5 58#define MMC_TIMING_UHS_DDR50 5
59#define MMC_TIMING_MMC_HS200 6
59 60
60#define MMC_SDR_MODE 0 61#define MMC_SDR_MODE 0
61#define MMC_1_2V_DDR_MODE 1 62#define MMC_1_2V_DDR_MODE 1
62#define MMC_1_8V_DDR_MODE 2 63#define MMC_1_8V_DDR_MODE 2
64#define MMC_1_2V_SDR_MODE 3
65#define MMC_1_8V_SDR_MODE 4
63 66
64 unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */ 67 unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */
65 68
@@ -148,7 +151,9 @@ struct mmc_host_ops {
148 void (*init_card)(struct mmc_host *host, struct mmc_card *card); 151 void (*init_card)(struct mmc_host *host, struct mmc_card *card);
149 152
150 int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios); 153 int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios);
151 int (*execute_tuning)(struct mmc_host *host); 154
155 /* The tuning command opcode value is different for SD and eMMC cards */
156 int (*execute_tuning)(struct mmc_host *host, u32 opcode);
152 void (*enable_preset_value)(struct mmc_host *host, bool enable); 157 void (*enable_preset_value)(struct mmc_host *host, bool enable);
153 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv); 158 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv);
154 void (*hw_reset)(struct mmc_host *host); 159 void (*hw_reset)(struct mmc_host *host);
@@ -167,6 +172,11 @@ struct mmc_async_req {
167 int (*err_check) (struct mmc_card *, struct mmc_async_req *); 172 int (*err_check) (struct mmc_card *, struct mmc_async_req *);
168}; 173};
169 174
175struct mmc_hotplug {
176 unsigned int irq;
177 void *handler_priv;
178};
179
170struct mmc_host { 180struct mmc_host {
171 struct device *parent; 181 struct device *parent;
172 struct device class_dev; 182 struct device class_dev;
@@ -242,6 +252,12 @@ struct mmc_host {
242#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */ 252#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */
243#define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */ 253#define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */
244#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */ 254#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */
255#define MMC_CAP2_NO_SLEEP_CMD (1 << 4) /* Don't allow sleep command */
256#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */
257#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */
258#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
259 MMC_CAP2_HS200_1_2V_SDR)
260#define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */
245 261
246 mmc_pm_flag_t pm_caps; /* supported pm features */ 262 mmc_pm_flag_t pm_caps; /* supported pm features */
247 unsigned int power_notify_type; 263 unsigned int power_notify_type;
@@ -253,10 +269,12 @@ struct mmc_host {
253 int clk_requests; /* internal reference counter */ 269 int clk_requests; /* internal reference counter */
254 unsigned int clk_delay; /* number of MCI clk hold cycles */ 270 unsigned int clk_delay; /* number of MCI clk hold cycles */
255 bool clk_gated; /* clock gated */ 271 bool clk_gated; /* clock gated */
256 struct work_struct clk_gate_work; /* delayed clock gate */ 272 struct delayed_work clk_gate_work; /* delayed clock gate */
257 unsigned int clk_old; /* old clock value cache */ 273 unsigned int clk_old; /* old clock value cache */
258 spinlock_t clk_lock; /* lock for clk fields */ 274 spinlock_t clk_lock; /* lock for clk fields */
259 struct mutex clk_gate_mutex; /* mutex for clock gating */ 275 struct mutex clk_gate_mutex; /* mutex for clock gating */
276 struct device_attribute clkgate_delay_attr;
277 unsigned long clkgate_delay;
260#endif 278#endif
261 279
262 /* host specific block data */ 280 /* host specific block data */
@@ -297,6 +315,8 @@ struct mmc_host {
297 int claim_cnt; /* "claim" nesting count */ 315 int claim_cnt; /* "claim" nesting count */
298 316
299 struct delayed_work detect; 317 struct delayed_work detect;
318 int detect_change; /* card detect flag */
319 struct mmc_hotplug hotplug;
300 320
301 const struct mmc_bus_ops *bus_ops; /* current bus driver */ 321 const struct mmc_bus_ops *bus_ops; /* current bus driver */
302 unsigned int bus_refs; /* reference counter */ 322 unsigned int bus_refs; /* reference counter */
@@ -323,6 +343,8 @@ struct mmc_host {
323 struct fault_attr fail_mmc_request; 343 struct fault_attr fail_mmc_request;
324#endif 344#endif
325 345
346 unsigned int actual_clock; /* Actual HC clock rate */
347
326 unsigned long private[0] ____cacheline_aligned; 348 unsigned long private[0] ____cacheline_aligned;
327}; 349};
328 350
@@ -396,7 +418,7 @@ static inline void mmc_set_disable_delay(struct mmc_host *host,
396} 418}
397 419
398/* Module parameter */ 420/* Module parameter */
399extern int mmc_assume_removable; 421extern bool mmc_assume_removable;
400 422
401static inline int mmc_card_is_removable(struct mmc_host *host) 423static inline int mmc_card_is_removable(struct mmc_host *host)
402{ 424{
@@ -423,4 +445,23 @@ static inline int mmc_boot_partition_access(struct mmc_host *host)
423 return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC); 445 return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC);
424} 446}
425 447
448#ifdef CONFIG_MMC_CLKGATE
449void mmc_host_clk_hold(struct mmc_host *host);
450void mmc_host_clk_release(struct mmc_host *host);
451unsigned int mmc_host_clk_rate(struct mmc_host *host);
452
453#else
454static inline void mmc_host_clk_hold(struct mmc_host *host)
455{
456}
457
458static inline void mmc_host_clk_release(struct mmc_host *host)
459{
460}
461
462static inline unsigned int mmc_host_clk_rate(struct mmc_host *host)
463{
464 return host->ios.clock;
465}
466#endif
426#endif /* LINUX_MMC_HOST_H */ 467#endif /* LINUX_MMC_HOST_H */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 0e7135697d11..fb9f6e116e1c 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -51,6 +51,7 @@
51#define MMC_READ_SINGLE_BLOCK 17 /* adtc [31:0] data addr R1 */ 51#define MMC_READ_SINGLE_BLOCK 17 /* adtc [31:0] data addr R1 */
52#define MMC_READ_MULTIPLE_BLOCK 18 /* adtc [31:0] data addr R1 */ 52#define MMC_READ_MULTIPLE_BLOCK 18 /* adtc [31:0] data addr R1 */
53#define MMC_SEND_TUNING_BLOCK 19 /* adtc R1 */ 53#define MMC_SEND_TUNING_BLOCK 19 /* adtc R1 */
54#define MMC_SEND_TUNING_BLOCK_HS200 21 /* adtc R1 */
54 55
55 /* class 3 */ 56 /* class 3 */
56#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */ 57#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */
@@ -280,6 +281,7 @@ struct _mmc_csd {
280#define EXT_CSD_RST_N_FUNCTION 162 /* R/W */ 281#define EXT_CSD_RST_N_FUNCTION 162 /* R/W */
281#define EXT_CSD_SANITIZE_START 165 /* W */ 282#define EXT_CSD_SANITIZE_START 165 /* W */
282#define EXT_CSD_WR_REL_PARAM 166 /* RO */ 283#define EXT_CSD_WR_REL_PARAM 166 /* RO */
284#define EXT_CSD_BOOT_WP 173 /* R/W */
283#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ 285#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
284#define EXT_CSD_PART_CONFIG 179 /* R/W */ 286#define EXT_CSD_PART_CONFIG 179 /* R/W */
285#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */ 287#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */
@@ -321,6 +323,11 @@ struct _mmc_csd {
321 323
322#define EXT_CSD_WR_REL_PARAM_EN (1<<2) 324#define EXT_CSD_WR_REL_PARAM_EN (1<<2)
323 325
326#define EXT_CSD_BOOT_WP_B_PWR_WP_DIS (0x40)
327#define EXT_CSD_BOOT_WP_B_PERM_WP_DIS (0x10)
328#define EXT_CSD_BOOT_WP_B_PERM_WP_EN (0x04)
329#define EXT_CSD_BOOT_WP_B_PWR_WP_EN (0x01)
330
324#define EXT_CSD_PART_CONFIG_ACC_MASK (0x7) 331#define EXT_CSD_PART_CONFIG_ACC_MASK (0x7)
325#define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1) 332#define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1)
326#define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4) 333#define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4)
@@ -333,13 +340,76 @@ struct _mmc_csd {
333 340
334#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */ 341#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */
335#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */ 342#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */
336#define EXT_CSD_CARD_TYPE_MASK 0xF /* Mask out reserved bits */ 343#define EXT_CSD_CARD_TYPE_MASK 0x3F /* Mask out reserved bits */
337#define EXT_CSD_CARD_TYPE_DDR_1_8V (1<<2) /* Card can run at 52MHz */ 344#define EXT_CSD_CARD_TYPE_DDR_1_8V (1<<2) /* Card can run at 52MHz */
338 /* DDR mode @1.8V or 3V I/O */ 345 /* DDR mode @1.8V or 3V I/O */
339#define EXT_CSD_CARD_TYPE_DDR_1_2V (1<<3) /* Card can run at 52MHz */ 346#define EXT_CSD_CARD_TYPE_DDR_1_2V (1<<3) /* Card can run at 52MHz */
340 /* DDR mode @1.2V I/O */ 347 /* DDR mode @1.2V I/O */
341#define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V \ 348#define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V \
342 | EXT_CSD_CARD_TYPE_DDR_1_2V) 349 | EXT_CSD_CARD_TYPE_DDR_1_2V)
350#define EXT_CSD_CARD_TYPE_SDR_1_8V (1<<4) /* Card can run at 200MHz */
351#define EXT_CSD_CARD_TYPE_SDR_1_2V (1<<5) /* Card can run at 200MHz */
352 /* SDR mode @1.2V I/O */
353
354#define EXT_CSD_CARD_TYPE_SDR_200 (EXT_CSD_CARD_TYPE_SDR_1_8V | \
355 EXT_CSD_CARD_TYPE_SDR_1_2V)
356
357#define EXT_CSD_CARD_TYPE_SDR_ALL (EXT_CSD_CARD_TYPE_SDR_200 | \
358 EXT_CSD_CARD_TYPE_52 | \
359 EXT_CSD_CARD_TYPE_26)
360
361#define EXT_CSD_CARD_TYPE_SDR_1_2V_ALL (EXT_CSD_CARD_TYPE_SDR_1_2V | \
362 EXT_CSD_CARD_TYPE_52 | \
363 EXT_CSD_CARD_TYPE_26)
364
365#define EXT_CSD_CARD_TYPE_SDR_1_8V_ALL (EXT_CSD_CARD_TYPE_SDR_1_8V | \
366 EXT_CSD_CARD_TYPE_52 | \
367 EXT_CSD_CARD_TYPE_26)
368
369#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_1_2V | \
370 EXT_CSD_CARD_TYPE_DDR_1_8V | \
371 EXT_CSD_CARD_TYPE_52 | \
372 EXT_CSD_CARD_TYPE_26)
373
374#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_1_8V | \
375 EXT_CSD_CARD_TYPE_DDR_1_8V | \
376 EXT_CSD_CARD_TYPE_52 | \
377 EXT_CSD_CARD_TYPE_26)
378
379#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_1_2V | \
380 EXT_CSD_CARD_TYPE_DDR_1_2V | \
381 EXT_CSD_CARD_TYPE_52 | \
382 EXT_CSD_CARD_TYPE_26)
383
384#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_1_8V | \
385 EXT_CSD_CARD_TYPE_DDR_1_2V | \
386 EXT_CSD_CARD_TYPE_52 | \
387 EXT_CSD_CARD_TYPE_26)
388
389#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_52 (EXT_CSD_CARD_TYPE_SDR_1_2V | \
390 EXT_CSD_CARD_TYPE_DDR_52 | \
391 EXT_CSD_CARD_TYPE_52 | \
392 EXT_CSD_CARD_TYPE_26)
393
394#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_52 (EXT_CSD_CARD_TYPE_SDR_1_8V | \
395 EXT_CSD_CARD_TYPE_DDR_52 | \
396 EXT_CSD_CARD_TYPE_52 | \
397 EXT_CSD_CARD_TYPE_26)
398
399#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_200 | \
400 EXT_CSD_CARD_TYPE_DDR_1_8V | \
401 EXT_CSD_CARD_TYPE_52 | \
402 EXT_CSD_CARD_TYPE_26)
403
404#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_200 | \
405 EXT_CSD_CARD_TYPE_DDR_1_2V | \
406 EXT_CSD_CARD_TYPE_52 | \
407 EXT_CSD_CARD_TYPE_26)
408
409#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_52 (EXT_CSD_CARD_TYPE_SDR_200 | \
410 EXT_CSD_CARD_TYPE_DDR_52 | \
411 EXT_CSD_CARD_TYPE_52 | \
412 EXT_CSD_CARD_TYPE_26)
343 413
344#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */ 414#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */
345#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ 415#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */
diff --git a/include/linux/mmc/sdhci-pci-data.h b/include/linux/mmc/sdhci-pci-data.h
new file mode 100644
index 000000000000..8959604a13d3
--- /dev/null
+++ b/include/linux/mmc/sdhci-pci-data.h
@@ -0,0 +1,18 @@
1#ifndef LINUX_MMC_SDHCI_PCI_DATA_H
2#define LINUX_MMC_SDHCI_PCI_DATA_H
3
4struct pci_dev;
5
6struct sdhci_pci_data {
7 struct pci_dev *pdev;
8 int slotno;
9 int rst_n_gpio; /* Set to -EINVAL if unused */
10 int cd_gpio; /* Set to -EINVAL if unused */
11 int (*setup)(struct sdhci_pci_data *data);
12 void (*cleanup)(struct sdhci_pci_data *data);
13};
14
15extern struct sdhci_pci_data *(*sdhci_pci_get_data)(struct pci_dev *pdev,
16 int slotno);
17
18#endif
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index e4b69353678d..c750f85177d9 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -90,8 +90,6 @@ struct sdhci_host {
90 90
91 unsigned int quirks2; /* More deviations from spec. */ 91 unsigned int quirks2; /* More deviations from spec. */
92 92
93#define SDHCI_QUIRK2_OWN_CARD_DETECTION (1<<0)
94
95 int irq; /* Device IRQ */ 93 int irq; /* Device IRQ */
96 void __iomem *ioaddr; /* Mapped address */ 94 void __iomem *ioaddr; /* Mapped address */
97 95
@@ -121,6 +119,7 @@ struct sdhci_host {
121#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */ 119#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */
122#define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */ 120#define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */
123#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ 121#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */
122#define SDHCI_HS200_NEEDS_TUNING (1<<10) /* HS200 needs tuning */
124 123
125 unsigned int version; /* SDHCI spec. version */ 124 unsigned int version; /* SDHCI spec. version */
126 125
diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h
index e0b1123497b9..c9fe66c58f8f 100644
--- a/include/linux/mmc/sdio.h
+++ b/include/linux/mmc/sdio.h
@@ -38,6 +38,7 @@
38 * [8:0] Byte/block count 38 * [8:0] Byte/block count
39 */ 39 */
40 40
41#define R4_18V_PRESENT (1<<24)
41#define R4_MEMORY_PRESENT (1 << 27) 42#define R4_MEMORY_PRESENT (1 << 27)
42 43
43/* 44/*
@@ -85,6 +86,7 @@
85#define SDIO_SD_REV_1_01 0 /* SD Physical Spec Version 1.01 */ 86#define SDIO_SD_REV_1_01 0 /* SD Physical Spec Version 1.01 */
86#define SDIO_SD_REV_1_10 1 /* SD Physical Spec Version 1.10 */ 87#define SDIO_SD_REV_1_10 1 /* SD Physical Spec Version 1.10 */
87#define SDIO_SD_REV_2_00 2 /* SD Physical Spec Version 2.00 */ 88#define SDIO_SD_REV_2_00 2 /* SD Physical Spec Version 2.00 */
89#define SDIO_SD_REV_3_00 3 /* SD Physical Spev Version 3.00 */
88 90
89#define SDIO_CCCR_IOEx 0x02 91#define SDIO_CCCR_IOEx 0x02
90#define SDIO_CCCR_IORx 0x03 92#define SDIO_CCCR_IORx 0x03
@@ -134,8 +136,31 @@
134#define SDIO_CCCR_SPEED 0x13 136#define SDIO_CCCR_SPEED 0x13
135 137
136#define SDIO_SPEED_SHS 0x01 /* Supports High-Speed mode */ 138#define SDIO_SPEED_SHS 0x01 /* Supports High-Speed mode */
137#define SDIO_SPEED_EHS 0x02 /* Enable High-Speed mode */ 139#define SDIO_SPEED_BSS_SHIFT 1
138 140#define SDIO_SPEED_BSS_MASK (7<<SDIO_SPEED_BSS_SHIFT)
141#define SDIO_SPEED_SDR12 (0<<SDIO_SPEED_BSS_SHIFT)
142#define SDIO_SPEED_SDR25 (1<<SDIO_SPEED_BSS_SHIFT)
143#define SDIO_SPEED_SDR50 (2<<SDIO_SPEED_BSS_SHIFT)
144#define SDIO_SPEED_SDR104 (3<<SDIO_SPEED_BSS_SHIFT)
145#define SDIO_SPEED_DDR50 (4<<SDIO_SPEED_BSS_SHIFT)
146#define SDIO_SPEED_EHS SDIO_SPEED_SDR25 /* Enable High-Speed */
147
148#define SDIO_CCCR_UHS 0x14
149#define SDIO_UHS_SDR50 0x01
150#define SDIO_UHS_SDR104 0x02
151#define SDIO_UHS_DDR50 0x04
152
153#define SDIO_CCCR_DRIVE_STRENGTH 0x15
154#define SDIO_SDTx_MASK 0x07
155#define SDIO_DRIVE_SDTA (1<<0)
156#define SDIO_DRIVE_SDTC (1<<1)
157#define SDIO_DRIVE_SDTD (1<<2)
158#define SDIO_DRIVE_DTSx_MASK 0x03
159#define SDIO_DRIVE_DTSx_SHIFT 4
160#define SDIO_DTSx_SET_TYPE_B (0 << SDIO_DRIVE_DTSx_SHIFT)
161#define SDIO_DTSx_SET_TYPE_A (1 << SDIO_DRIVE_DTSx_SHIFT)
162#define SDIO_DTSx_SET_TYPE_C (2 << SDIO_DRIVE_DTSx_SHIFT)
163#define SDIO_DTSx_SET_TYPE_D (3 << SDIO_DRIVE_DTSx_SHIFT)
139/* 164/*
140 * Function Basic Registers (FBR) 165 * Function Basic Registers (FBR)
141 */ 166 */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 188cb2ffe8db..650ba2fb3301 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -140,25 +140,29 @@ enum lru_list {
140 NR_LRU_LISTS 140 NR_LRU_LISTS
141}; 141};
142 142
143#define for_each_lru(l) for (l = 0; l < NR_LRU_LISTS; l++) 143#define for_each_lru(lru) for (lru = 0; lru < NR_LRU_LISTS; lru++)
144 144
145#define for_each_evictable_lru(l) for (l = 0; l <= LRU_ACTIVE_FILE; l++) 145#define for_each_evictable_lru(lru) for (lru = 0; lru <= LRU_ACTIVE_FILE; lru++)
146 146
147static inline int is_file_lru(enum lru_list l) 147static inline int is_file_lru(enum lru_list lru)
148{ 148{
149 return (l == LRU_INACTIVE_FILE || l == LRU_ACTIVE_FILE); 149 return (lru == LRU_INACTIVE_FILE || lru == LRU_ACTIVE_FILE);
150} 150}
151 151
152static inline int is_active_lru(enum lru_list l) 152static inline int is_active_lru(enum lru_list lru)
153{ 153{
154 return (l == LRU_ACTIVE_ANON || l == LRU_ACTIVE_FILE); 154 return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE);
155} 155}
156 156
157static inline int is_unevictable_lru(enum lru_list l) 157static inline int is_unevictable_lru(enum lru_list lru)
158{ 158{
159 return (l == LRU_UNEVICTABLE); 159 return (lru == LRU_UNEVICTABLE);
160} 160}
161 161
162struct lruvec {
163 struct list_head lists[NR_LRU_LISTS];
164};
165
162/* Mask used at gathering information at once (see memcontrol.c) */ 166/* Mask used at gathering information at once (see memcontrol.c) */
163#define LRU_ALL_FILE (BIT(LRU_INACTIVE_FILE) | BIT(LRU_ACTIVE_FILE)) 167#define LRU_ALL_FILE (BIT(LRU_INACTIVE_FILE) | BIT(LRU_ACTIVE_FILE))
164#define LRU_ALL_ANON (BIT(LRU_INACTIVE_ANON) | BIT(LRU_ACTIVE_ANON)) 168#define LRU_ALL_ANON (BIT(LRU_INACTIVE_ANON) | BIT(LRU_ACTIVE_ANON))
@@ -173,6 +177,8 @@ static inline int is_unevictable_lru(enum lru_list l)
173#define ISOLATE_CLEAN ((__force isolate_mode_t)0x4) 177#define ISOLATE_CLEAN ((__force isolate_mode_t)0x4)
174/* Isolate unmapped file */ 178/* Isolate unmapped file */
175#define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x8) 179#define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x8)
180/* Isolate for asynchronous migration */
181#define ISOLATE_ASYNC_MIGRATE ((__force isolate_mode_t)0x10)
176 182
177/* LRU Isolation modes. */ 183/* LRU Isolation modes. */
178typedef unsigned __bitwise__ isolate_mode_t; 184typedef unsigned __bitwise__ isolate_mode_t;
@@ -317,6 +323,12 @@ struct zone {
317 */ 323 */
318 unsigned long lowmem_reserve[MAX_NR_ZONES]; 324 unsigned long lowmem_reserve[MAX_NR_ZONES];
319 325
326 /*
327 * This is a per-zone reserve of pages that should not be
328 * considered dirtyable memory.
329 */
330 unsigned long dirty_balance_reserve;
331
320#ifdef CONFIG_NUMA 332#ifdef CONFIG_NUMA
321 int node; 333 int node;
322 /* 334 /*
@@ -358,10 +370,8 @@ struct zone {
358 ZONE_PADDING(_pad1_) 370 ZONE_PADDING(_pad1_)
359 371
360 /* Fields commonly accessed by the page reclaim scanner */ 372 /* Fields commonly accessed by the page reclaim scanner */
361 spinlock_t lru_lock; 373 spinlock_t lru_lock;
362 struct zone_lru { 374 struct lruvec lruvec;
363 struct list_head list;
364 } lru[NR_LRU_LISTS];
365 375
366 struct zone_reclaim_stat reclaim_stat; 376 struct zone_reclaim_stat reclaim_stat;
367 377
@@ -598,13 +608,13 @@ struct zonelist {
598#endif 608#endif
599}; 609};
600 610
601#ifdef CONFIG_ARCH_POPULATES_NODE_MAP 611#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
602struct node_active_region { 612struct node_active_region {
603 unsigned long start_pfn; 613 unsigned long start_pfn;
604 unsigned long end_pfn; 614 unsigned long end_pfn;
605 int nid; 615 int nid;
606}; 616};
607#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ 617#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
608 618
609#ifndef CONFIG_DISCONTIGMEM 619#ifndef CONFIG_DISCONTIGMEM
610/* The array of struct pages - for discontigmem use pgdat->lmem_map */ 620/* The array of struct pages - for discontigmem use pgdat->lmem_map */
@@ -720,7 +730,7 @@ extern int movable_zone;
720 730
721static inline int zone_movable_is_highmem(void) 731static inline int zone_movable_is_highmem(void)
722{ 732{
723#if defined(CONFIG_HIGHMEM) && defined(CONFIG_ARCH_POPULATES_NODE_MAP) 733#if defined(CONFIG_HIGHMEM) && defined(CONFIG_HAVE_MEMBLOCK_NODE)
724 return movable_zone == ZONE_HIGHMEM; 734 return movable_zone == ZONE_HIGHMEM;
725#else 735#else
726 return 0; 736 return 0;
@@ -938,7 +948,7 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
938#endif 948#endif
939 949
940#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \ 950#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \
941 !defined(CONFIG_ARCH_POPULATES_NODE_MAP) 951 !defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP)
942static inline unsigned long early_pfn_to_nid(unsigned long pfn) 952static inline unsigned long early_pfn_to_nid(unsigned long pfn)
943{ 953{
944 return 0; 954 return 0;
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
index 29304855652d..5a8e3903d770 100644
--- a/include/linux/mnt_namespace.h
+++ b/include/linux/mnt_namespace.h
@@ -2,39 +2,16 @@
2#define _NAMESPACE_H_ 2#define _NAMESPACE_H_
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/path.h> 5struct mnt_namespace;
6#include <linux/seq_file.h>
7#include <linux/wait.h>
8
9struct mnt_namespace {
10 atomic_t count;
11 struct vfsmount * root;
12 struct list_head list;
13 wait_queue_head_t poll;
14 int event;
15};
16
17struct proc_mounts {
18 struct seq_file m; /* must be the first element */
19 struct mnt_namespace *ns;
20 struct path root;
21};
22
23struct fs_struct; 6struct fs_struct;
24 7
25extern struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt);
26extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, 8extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
27 struct fs_struct *); 9 struct fs_struct *);
28extern void put_mnt_ns(struct mnt_namespace *ns); 10extern void put_mnt_ns(struct mnt_namespace *ns);
29static inline void get_mnt_ns(struct mnt_namespace *ns)
30{
31 atomic_inc(&ns->count);
32}
33 11
34extern const struct seq_operations mounts_op; 12extern const struct file_operations proc_mounts_operations;
35extern const struct seq_operations mountinfo_op; 13extern const struct file_operations proc_mountinfo_operations;
36extern const struct seq_operations mountstats_op; 14extern const struct file_operations proc_mountstats_operations;
37extern int mnt_had_events(struct proc_mounts *);
38 15
39#endif 16#endif
40#endif 17#endif
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 468819cdde87..83ac0713ed0a 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -542,4 +542,22 @@ struct isapnp_device_id {
542 kernel_ulong_t driver_data; /* data private to the driver */ 542 kernel_ulong_t driver_data; /* data private to the driver */
543}; 543};
544 544
545/**
546 * struct amba_id - identifies a device on an AMBA bus
547 * @id: The significant bits if the hardware device ID
548 * @mask: Bitmask specifying which bits of the id field are significant when
549 * matching. A driver binds to a device when ((hardware device ID) & mask)
550 * == id.
551 * @data: Private data used by the driver.
552 */
553struct amba_id {
554 unsigned int id;
555 unsigned int mask;
556#ifndef __KERNEL__
557 kernel_ulong_t data;
558#else
559 void *data;
560#endif
561};
562
545#endif /* LINUX_MOD_DEVICETABLE_H */ 563#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index 3cb7839a60b9..4598bf03e98b 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -205,6 +205,20 @@ enum module_state
205 MODULE_STATE_GOING, 205 MODULE_STATE_GOING,
206}; 206};
207 207
208/**
209 * struct module_ref - per cpu module reference counts
210 * @incs: number of module get on this cpu
211 * @decs: number of module put on this cpu
212 *
213 * We force an alignment on 8 or 16 bytes, so that alloc_percpu()
214 * put @incs/@decs in same cache line, with no extra memory cost,
215 * since alloc_percpu() is fine grained.
216 */
217struct module_ref {
218 unsigned long incs;
219 unsigned long decs;
220} __attribute((aligned(2 * sizeof(unsigned long))));
221
208struct module 222struct module
209{ 223{
210 enum module_state state; 224 enum module_state state;
@@ -347,10 +361,7 @@ struct module
347 /* Destruction function. */ 361 /* Destruction function. */
348 void (*exit)(void); 362 void (*exit)(void);
349 363
350 struct module_ref { 364 struct module_ref __percpu *refptr;
351 unsigned int incs;
352 unsigned int decs;
353 } __percpu *refptr;
354#endif 365#endif
355 366
356#ifdef CONFIG_CONSTRUCTORS 367#ifdef CONFIG_CONSTRUCTORS
@@ -434,7 +445,7 @@ extern void __module_put_and_exit(struct module *mod, long code)
434#define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code); 445#define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code);
435 446
436#ifdef CONFIG_MODULE_UNLOAD 447#ifdef CONFIG_MODULE_UNLOAD
437unsigned int module_refcount(struct module *mod); 448unsigned long module_refcount(struct module *mod);
438void __symbol_put(const char *symbol); 449void __symbol_put(const char *symbol);
439#define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x) 450#define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x)
440void symbol_put_addr(void *addr); 451void symbol_put_addr(void *addr);
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 7939f636c8ba..c47f4d60db0b 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -350,23 +350,23 @@ extern int param_set_charp(const char *val, const struct kernel_param *kp);
350extern int param_get_charp(char *buffer, const struct kernel_param *kp); 350extern int param_get_charp(char *buffer, const struct kernel_param *kp);
351#define param_check_charp(name, p) __param_check(name, p, char *) 351#define param_check_charp(name, p) __param_check(name, p, char *)
352 352
353/* For historical reasons "bool" parameters can be (unsigned) "int". */ 353/* We used to allow int as well as bool. We're taking that away! */
354extern struct kernel_param_ops param_ops_bool; 354extern struct kernel_param_ops param_ops_bool;
355extern int param_set_bool(const char *val, const struct kernel_param *kp); 355extern int param_set_bool(const char *val, const struct kernel_param *kp);
356extern int param_get_bool(char *buffer, const struct kernel_param *kp); 356extern int param_get_bool(char *buffer, const struct kernel_param *kp);
357#define param_check_bool(name, p) \ 357#define param_check_bool(name, p) __param_check(name, p, bool)
358 static inline void __check_##name(void) \
359 { \
360 BUILD_BUG_ON(!__same_type((p), bool *) && \
361 !__same_type((p), unsigned int *) && \
362 !__same_type((p), int *)); \
363 }
364 358
365extern struct kernel_param_ops param_ops_invbool; 359extern struct kernel_param_ops param_ops_invbool;
366extern int param_set_invbool(const char *val, const struct kernel_param *kp); 360extern int param_set_invbool(const char *val, const struct kernel_param *kp);
367extern int param_get_invbool(char *buffer, const struct kernel_param *kp); 361extern int param_get_invbool(char *buffer, const struct kernel_param *kp);
368#define param_check_invbool(name, p) __param_check(name, p, bool) 362#define param_check_invbool(name, p) __param_check(name, p, bool)
369 363
364/* An int, which can only be set like a bool (though it shows as an int). */
365extern struct kernel_param_ops param_ops_bint;
366extern int param_set_bint(const char *val, const struct kernel_param *kp);
367#define param_get_bint param_get_int
368#define param_check_bint param_check_int
369
370/** 370/**
371 * module_param_array - a parameter which is an array of some type 371 * module_param_array - a parameter which is an array of some type
372 * @name: the name of the array variable 372 * @name: the name of the array variable
@@ -395,6 +395,7 @@ extern int param_get_invbool(char *buffer, const struct kernel_param *kp);
395 * module_param_named() for why this might be necessary. 395 * module_param_named() for why this might be necessary.
396 */ 396 */
397#define module_param_array_named(name, array, type, nump, perm) \ 397#define module_param_array_named(name, array, type, nump, perm) \
398 param_check_##type(name, &(array)[0]); \
398 static const struct kparam_array __param_arr_##name \ 399 static const struct kparam_array __param_arr_##name \
399 = { .max = ARRAY_SIZE(array), .num = nump, \ 400 = { .max = ARRAY_SIZE(array), .num = nump, \
400 .ops = &param_ops_##type, \ 401 .ops = &param_ops_##type, \
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 33fe53d78110..d7029f4a191a 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -47,45 +47,10 @@ struct mnt_namespace;
47 47
48#define MNT_INTERNAL 0x4000 48#define MNT_INTERNAL 0x4000
49 49
50struct mnt_pcp {
51 int mnt_count;
52 int mnt_writers;
53};
54
55struct vfsmount { 50struct vfsmount {
56 struct list_head mnt_hash;
57 struct vfsmount *mnt_parent; /* fs we are mounted on */
58 struct dentry *mnt_mountpoint; /* dentry of mountpoint */
59 struct dentry *mnt_root; /* root of the mounted tree */ 51 struct dentry *mnt_root; /* root of the mounted tree */
60 struct super_block *mnt_sb; /* pointer to superblock */ 52 struct super_block *mnt_sb; /* pointer to superblock */
61#ifdef CONFIG_SMP
62 struct mnt_pcp __percpu *mnt_pcp;
63 atomic_t mnt_longterm; /* how many of the refs are longterm */
64#else
65 int mnt_count;
66 int mnt_writers;
67#endif
68 struct list_head mnt_mounts; /* list of children, anchored here */
69 struct list_head mnt_child; /* and going through their mnt_child */
70 int mnt_flags; 53 int mnt_flags;
71 /* 4 bytes hole on 64bits arches without fsnotify */
72#ifdef CONFIG_FSNOTIFY
73 __u32 mnt_fsnotify_mask;
74 struct hlist_head mnt_fsnotify_marks;
75#endif
76 const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
77 struct list_head mnt_list;
78 struct list_head mnt_expire; /* link in fs-specific expiry list */
79 struct list_head mnt_share; /* circular list of shared mounts */
80 struct list_head mnt_slave_list;/* list of slave mounts */
81 struct list_head mnt_slave; /* slave list entry */
82 struct vfsmount *mnt_master; /* slave is on master->mnt_slave_list */
83 struct mnt_namespace *mnt_ns; /* containing namespace */
84 int mnt_id; /* mount identifier */
85 int mnt_group_id; /* peer group identifier */
86 int mnt_expiry_mark; /* true if marked for expiry */
87 int mnt_pinned;
88 int mnt_ghosts;
89}; 54};
90 55
91struct file; /* forward dec */ 56struct file; /* forward dec */
@@ -94,15 +59,13 @@ extern int mnt_want_write(struct vfsmount *mnt);
94extern int mnt_want_write_file(struct file *file); 59extern int mnt_want_write_file(struct file *file);
95extern int mnt_clone_write(struct vfsmount *mnt); 60extern int mnt_clone_write(struct vfsmount *mnt);
96extern void mnt_drop_write(struct vfsmount *mnt); 61extern void mnt_drop_write(struct vfsmount *mnt);
62extern void mnt_drop_write_file(struct file *file);
97extern void mntput(struct vfsmount *mnt); 63extern void mntput(struct vfsmount *mnt);
98extern struct vfsmount *mntget(struct vfsmount *mnt); 64extern struct vfsmount *mntget(struct vfsmount *mnt);
99extern void mnt_pin(struct vfsmount *mnt); 65extern void mnt_pin(struct vfsmount *mnt);
100extern void mnt_unpin(struct vfsmount *mnt); 66extern void mnt_unpin(struct vfsmount *mnt);
101extern int __mnt_is_readonly(struct vfsmount *mnt); 67extern int __mnt_is_readonly(struct vfsmount *mnt);
102 68
103extern struct vfsmount *do_kern_mount(const char *fstype, int flags,
104 const char *name, void *data);
105
106struct file_system_type; 69struct file_system_type;
107extern struct vfsmount *vfs_kern_mount(struct file_system_type *type, 70extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
108 int flags, const char *name, 71 int flags, const char *name,
diff --git a/include/linux/mpi.h b/include/linux/mpi.h
new file mode 100644
index 000000000000..d02cca6cc8ce
--- /dev/null
+++ b/include/linux/mpi.h
@@ -0,0 +1,144 @@
1/* mpi.h - Multi Precision Integers
2 * Copyright (C) 1994, 1996, 1998, 1999,
3 * 2000, 2001 Free Software Foundation, Inc.
4 *
5 * This file is part of GNUPG.
6 *
7 * GNUPG 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 * GNUPG is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 *
21 * Note: This code is heavily based on the GNU MP Library.
22 * Actually it's the same code with only minor changes in the
23 * way the data is stored; this is to support the abstraction
24 * of an optional secure memory allocation which may be used
25 * to avoid revealing of sensitive data due to paging etc.
26 * The GNU MP Library itself is published under the LGPL;
27 * however I decided to publish this code under the plain GPL.
28 */
29
30#ifndef G10_MPI_H
31#define G10_MPI_H
32
33#include <linux/types.h>
34
35/* DSI defines */
36
37#define SHA1_DIGEST_LENGTH 20
38
39/*end of DSI defines */
40
41#define BYTES_PER_MPI_LIMB (BITS_PER_LONG / 8)
42#define BITS_PER_MPI_LIMB BITS_PER_LONG
43
44typedef unsigned long int mpi_limb_t;
45typedef signed long int mpi_limb_signed_t;
46
47struct gcry_mpi {
48 int alloced; /* array size (# of allocated limbs) */
49 int nlimbs; /* number of valid limbs */
50 int nbits; /* the real number of valid bits (info only) */
51 int sign; /* indicates a negative number */
52 unsigned flags; /* bit 0: array must be allocated in secure memory space */
53 /* bit 1: not used */
54 /* bit 2: the limb is a pointer to some m_alloced data */
55 mpi_limb_t *d; /* array with the limbs */
56};
57
58typedef struct gcry_mpi *MPI;
59
60#define mpi_get_nlimbs(a) ((a)->nlimbs)
61#define mpi_is_neg(a) ((a)->sign)
62
63/*-- mpiutil.c --*/
64MPI mpi_alloc(unsigned nlimbs);
65MPI mpi_alloc_secure(unsigned nlimbs);
66MPI mpi_alloc_like(MPI a);
67void mpi_free(MPI a);
68int mpi_resize(MPI a, unsigned nlimbs);
69int mpi_copy(MPI *copy, const MPI a);
70void mpi_clear(MPI a);
71int mpi_set(MPI w, MPI u);
72int mpi_set_ui(MPI w, ulong u);
73MPI mpi_alloc_set_ui(unsigned long u);
74void mpi_m_check(MPI a);
75void mpi_swap(MPI a, MPI b);
76
77/*-- mpicoder.c --*/
78MPI do_encode_md(const void *sha_buffer, unsigned nbits);
79MPI mpi_read_from_buffer(const void *buffer, unsigned *ret_nread);
80int mpi_fromstr(MPI val, const char *str);
81u32 mpi_get_keyid(MPI a, u32 *keyid);
82void *mpi_get_buffer(MPI a, unsigned *nbytes, int *sign);
83void *mpi_get_secure_buffer(MPI a, unsigned *nbytes, int *sign);
84int mpi_set_buffer(MPI a, const void *buffer, unsigned nbytes, int sign);
85
86#define log_mpidump g10_log_mpidump
87
88/*-- mpi-add.c --*/
89int mpi_add_ui(MPI w, MPI u, ulong v);
90int mpi_add(MPI w, MPI u, MPI v);
91int mpi_addm(MPI w, MPI u, MPI v, MPI m);
92int mpi_sub_ui(MPI w, MPI u, ulong v);
93int mpi_sub(MPI w, MPI u, MPI v);
94int mpi_subm(MPI w, MPI u, MPI v, MPI m);
95
96/*-- mpi-mul.c --*/
97int mpi_mul_ui(MPI w, MPI u, ulong v);
98int mpi_mul_2exp(MPI w, MPI u, ulong cnt);
99int mpi_mul(MPI w, MPI u, MPI v);
100int mpi_mulm(MPI w, MPI u, MPI v, MPI m);
101
102/*-- mpi-div.c --*/
103ulong mpi_fdiv_r_ui(MPI rem, MPI dividend, ulong divisor);
104int mpi_fdiv_r(MPI rem, MPI dividend, MPI divisor);
105int mpi_fdiv_q(MPI quot, MPI dividend, MPI divisor);
106int mpi_fdiv_qr(MPI quot, MPI rem, MPI dividend, MPI divisor);
107int mpi_tdiv_r(MPI rem, MPI num, MPI den);
108int mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den);
109int mpi_tdiv_q_2exp(MPI w, MPI u, unsigned count);
110int mpi_divisible_ui(const MPI dividend, ulong divisor);
111
112/*-- mpi-gcd.c --*/
113int mpi_gcd(MPI g, const MPI a, const MPI b);
114
115/*-- mpi-pow.c --*/
116int mpi_pow(MPI w, MPI u, MPI v);
117int mpi_powm(MPI res, MPI base, MPI exp, MPI mod);
118
119/*-- mpi-mpow.c --*/
120int mpi_mulpowm(MPI res, MPI *basearray, MPI *exparray, MPI mod);
121
122/*-- mpi-cmp.c --*/
123int mpi_cmp_ui(MPI u, ulong v);
124int mpi_cmp(MPI u, MPI v);
125
126/*-- mpi-scan.c --*/
127int mpi_getbyte(MPI a, unsigned idx);
128void mpi_putbyte(MPI a, unsigned idx, int value);
129unsigned mpi_trailing_zeros(MPI a);
130
131/*-- mpi-bit.c --*/
132void mpi_normalize(MPI a);
133unsigned mpi_get_nbits(MPI a);
134int mpi_test_bit(MPI a, unsigned n);
135int mpi_set_bit(MPI a, unsigned n);
136int mpi_set_highbit(MPI a, unsigned n);
137void mpi_clear_highbit(MPI a, unsigned n);
138void mpi_clear_bit(MPI a, unsigned n);
139int mpi_rshift(MPI x, MPI a, unsigned n);
140
141/*-- mpi-inv.c --*/
142int mpi_invm(MPI x, MPI u, MPI v);
143
144#endif /*G10_MPI_H */
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index a3759cb0ac10..6d8c7251eb8d 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -43,9 +43,11 @@ typedef unsigned short mifi_t;
43typedef __u32 if_mask; 43typedef __u32 if_mask;
44#define NIFBITS (sizeof(if_mask) * 8) /* bits per mask */ 44#define NIFBITS (sizeof(if_mask) * 8) /* bits per mask */
45 45
46#if !defined(__KERNEL__) && !defined(DIV_ROUND_UP) 46#if !defined(__KERNEL__)
47#if !defined(DIV_ROUND_UP)
47#define DIV_ROUND_UP(x,y) (((x) + ((y) - 1)) / (y)) 48#define DIV_ROUND_UP(x,y) (((x) + ((y) - 1)) / (y))
48#endif 49#endif
50#endif
49 51
50typedef struct if_set { 52typedef struct if_set {
51 if_mask ifs_bits[DIV_ROUND_UP(IF_SETSIZE, NIFBITS)]; 53 if_mask ifs_bits[DIV_ROUND_UP(IF_SETSIZE, NIFBITS)];
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 05acced439a3..ce93a341337d 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -1,6 +1,7 @@
1#ifndef LINUX_MSI_H 1#ifndef LINUX_MSI_H
2#define LINUX_MSI_H 2#define LINUX_MSI_H
3 3
4#include <linux/kobject.h>
4#include <linux/list.h> 5#include <linux/list.h>
5 6
6struct msi_msg { 7struct msi_msg {
@@ -44,6 +45,8 @@ struct msi_desc {
44 45
45 /* Last set MSI message */ 46 /* Last set MSI message */
46 struct msi_msg msg; 47 struct msi_msg msg;
48
49 struct kobject kobj;
47}; 50};
48 51
49/* 52/*
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index d24925492972..d5d2ec6494bb 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -354,10 +354,10 @@ static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cf
354 onecmd = cmd; 354 onecmd = cmd;
355 break; 355 break;
356 case 2: 356 case 2:
357 onecmd = cpu_to_cfi16(cmd); 357 onecmd = cpu_to_cfi16(map, cmd);
358 break; 358 break;
359 case 4: 359 case 4:
360 onecmd = cpu_to_cfi32(cmd); 360 onecmd = cpu_to_cfi32(map, cmd);
361 break; 361 break;
362 } 362 }
363 363
@@ -437,10 +437,10 @@ static inline unsigned long cfi_merge_status(map_word val, struct map_info *map,
437 case 1: 437 case 1:
438 break; 438 break;
439 case 2: 439 case 2:
440 res = cfi16_to_cpu(res); 440 res = cfi16_to_cpu(map, res);
441 break; 441 break;
442 case 4: 442 case 4:
443 res = cfi32_to_cpu(res); 443 res = cfi32_to_cpu(map, res);
444 break; 444 break;
445 default: BUG(); 445 default: BUG();
446 } 446 }
@@ -480,12 +480,12 @@ static inline uint8_t cfi_read_query(struct map_info *map, uint32_t addr)
480 if (map_bankwidth_is_1(map)) { 480 if (map_bankwidth_is_1(map)) {
481 return val.x[0]; 481 return val.x[0];
482 } else if (map_bankwidth_is_2(map)) { 482 } else if (map_bankwidth_is_2(map)) {
483 return cfi16_to_cpu(val.x[0]); 483 return cfi16_to_cpu(map, val.x[0]);
484 } else { 484 } else {
485 /* No point in a 64-bit byteswap since that would just be 485 /* No point in a 64-bit byteswap since that would just be
486 swapping the responses from different chips, and we are 486 swapping the responses from different chips, and we are
487 only interested in one chip (a representative sample) */ 487 only interested in one chip (a representative sample) */
488 return cfi32_to_cpu(val.x[0]); 488 return cfi32_to_cpu(map, val.x[0]);
489 } 489 }
490} 490}
491 491
@@ -496,12 +496,12 @@ static inline uint16_t cfi_read_query16(struct map_info *map, uint32_t addr)
496 if (map_bankwidth_is_1(map)) { 496 if (map_bankwidth_is_1(map)) {
497 return val.x[0] & 0xff; 497 return val.x[0] & 0xff;
498 } else if (map_bankwidth_is_2(map)) { 498 } else if (map_bankwidth_is_2(map)) {
499 return cfi16_to_cpu(val.x[0]); 499 return cfi16_to_cpu(map, val.x[0]);
500 } else { 500 } else {
501 /* No point in a 64-bit byteswap since that would just be 501 /* No point in a 64-bit byteswap since that would just be
502 swapping the responses from different chips, and we are 502 swapping the responses from different chips, and we are
503 only interested in one chip (a representative sample) */ 503 only interested in one chip (a representative sample) */
504 return cfi32_to_cpu(val.x[0]); 504 return cfi32_to_cpu(map, val.x[0]);
505 } 505 }
506} 506}
507 507
diff --git a/include/linux/mtd/cfi_endian.h b/include/linux/mtd/cfi_endian.h
index 51cc3f5917a8..b97a625071f8 100644
--- a/include/linux/mtd/cfi_endian.h
+++ b/include/linux/mtd/cfi_endian.h
@@ -19,53 +19,35 @@
19 19
20#include <asm/byteorder.h> 20#include <asm/byteorder.h>
21 21
22#ifndef CONFIG_MTD_CFI_ADV_OPTIONS 22#define CFI_HOST_ENDIAN 1
23 23#define CFI_LITTLE_ENDIAN 2
24#define CFI_HOST_ENDIAN 24#define CFI_BIG_ENDIAN 3
25 25
26#else 26#if !defined(CONFIG_MTD_CFI_ADV_OPTIONS) || defined(CONFIG_MTD_CFI_NOSWAP)
27 27#define CFI_DEFAULT_ENDIAN CFI_HOST_ENDIAN
28#ifdef CONFIG_MTD_CFI_NOSWAP 28#elif defined(CONFIG_MTD_CFI_LE_BYTE_SWAP)
29#define CFI_HOST_ENDIAN 29#define CFI_DEFAULT_ENDIAN CFI_LITTLE_ENDIAN
30#endif 30#elif defined(CONFIG_MTD_CFI_BE_BYTE_SWAP)
31 31#define CFI_DEFAULT_ENDIAN CFI_BIG_ENDIAN
32#ifdef CONFIG_MTD_CFI_LE_BYTE_SWAP
33#define CFI_LITTLE_ENDIAN
34#endif
35
36#ifdef CONFIG_MTD_CFI_BE_BYTE_SWAP
37#define CFI_BIG_ENDIAN
38#endif
39
40#endif
41
42#if defined(CFI_LITTLE_ENDIAN)
43#define cpu_to_cfi8(x) (x)
44#define cfi8_to_cpu(x) (x)
45#define cpu_to_cfi16(x) cpu_to_le16(x)
46#define cpu_to_cfi32(x) cpu_to_le32(x)
47#define cpu_to_cfi64(x) cpu_to_le64(x)
48#define cfi16_to_cpu(x) le16_to_cpu(x)
49#define cfi32_to_cpu(x) le32_to_cpu(x)
50#define cfi64_to_cpu(x) le64_to_cpu(x)
51#elif defined (CFI_BIG_ENDIAN)
52#define cpu_to_cfi8(x) (x)
53#define cfi8_to_cpu(x) (x)
54#define cpu_to_cfi16(x) cpu_to_be16(x)
55#define cpu_to_cfi32(x) cpu_to_be32(x)
56#define cpu_to_cfi64(x) cpu_to_be64(x)
57#define cfi16_to_cpu(x) be16_to_cpu(x)
58#define cfi32_to_cpu(x) be32_to_cpu(x)
59#define cfi64_to_cpu(x) be64_to_cpu(x)
60#elif defined (CFI_HOST_ENDIAN)
61#define cpu_to_cfi8(x) (x)
62#define cfi8_to_cpu(x) (x)
63#define cpu_to_cfi16(x) (x)
64#define cpu_to_cfi32(x) (x)
65#define cpu_to_cfi64(x) (x)
66#define cfi16_to_cpu(x) (x)
67#define cfi32_to_cpu(x) (x)
68#define cfi64_to_cpu(x) (x)
69#else 32#else
70#error No CFI endianness defined 33#error No CFI endianness defined
71#endif 34#endif
35
36#define cfi_default(s) ((s)?:CFI_DEFAULT_ENDIAN)
37#define cfi_be(s) (cfi_default(s) == CFI_BIG_ENDIAN)
38#define cfi_le(s) (cfi_default(s) == CFI_LITTLE_ENDIAN)
39#define cfi_host(s) (cfi_default(s) == CFI_HOST_ENDIAN)
40
41#define cpu_to_cfi8(map, x) (x)
42#define cfi8_to_cpu(map, x) (x)
43#define cpu_to_cfi16(map, x) _cpu_to_cfi(16, (map)->swap, (x))
44#define cpu_to_cfi32(map, x) _cpu_to_cfi(32, (map)->swap, (x))
45#define cpu_to_cfi64(map, x) _cpu_to_cfi(64, (map)->swap, (x))
46#define cfi16_to_cpu(map, x) _cfi_to_cpu(16, (map)->swap, (x))
47#define cfi32_to_cpu(map, x) _cfi_to_cpu(32, (map)->swap, (x))
48#define cfi64_to_cpu(map, x) _cfi_to_cpu(64, (map)->swap, (x))
49
50#define _cpu_to_cfi(w, s, x) (cfi_host(s)?(x):_swap_to_cfi(w, s, x))
51#define _cfi_to_cpu(w, s, x) (cfi_host(s)?(x):_swap_to_cpu(w, s, x))
52#define _swap_to_cfi(w, s, x) (cfi_be(s)?cpu_to_be##w(x):cpu_to_le##w(x))
53#define _swap_to_cpu(w, s, x) (cfi_be(s)?be##w##_to_cpu(x):le##w##_to_cpu(x))
diff --git a/include/linux/mtd/gpmi-nand.h b/include/linux/mtd/gpmi-nand.h
new file mode 100644
index 000000000000..69b6dbf46b5e
--- /dev/null
+++ b/include/linux/mtd/gpmi-nand.h
@@ -0,0 +1,68 @@
1/*
2 * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
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 along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#ifndef __MACH_MXS_GPMI_NAND_H__
20#define __MACH_MXS_GPMI_NAND_H__
21
22/* The size of the resources is fixed. */
23#define GPMI_NAND_RES_SIZE 6
24
25/* Resource names for the GPMI NAND driver. */
26#define GPMI_NAND_GPMI_REGS_ADDR_RES_NAME "GPMI NAND GPMI Registers"
27#define GPMI_NAND_GPMI_INTERRUPT_RES_NAME "GPMI NAND GPMI Interrupt"
28#define GPMI_NAND_BCH_REGS_ADDR_RES_NAME "GPMI NAND BCH Registers"
29#define GPMI_NAND_BCH_INTERRUPT_RES_NAME "GPMI NAND BCH Interrupt"
30#define GPMI_NAND_DMA_CHANNELS_RES_NAME "GPMI NAND DMA Channels"
31#define GPMI_NAND_DMA_INTERRUPT_RES_NAME "GPMI NAND DMA Interrupt"
32
33/**
34 * struct gpmi_nand_platform_data - GPMI NAND driver platform data.
35 *
36 * This structure communicates platform-specific information to the GPMI NAND
37 * driver that can't be expressed as resources.
38 *
39 * @platform_init: A pointer to a function the driver will call to
40 * initialize the platform (e.g., set up the pin mux).
41 * @min_prop_delay_in_ns: Minimum propagation delay of GPMI signals to and
42 * from the NAND Flash device, in nanoseconds.
43 * @max_prop_delay_in_ns: Maximum propagation delay of GPMI signals to and
44 * from the NAND Flash device, in nanoseconds.
45 * @max_chip_count: The maximum number of chips for which the driver
46 * should configure the hardware. This value most
47 * likely reflects the number of pins that are
48 * connected to a NAND Flash device. If this is
49 * greater than the SoC hardware can support, the
50 * driver will print a message and fail to initialize.
51 * @partitions: An optional pointer to an array of partition
52 * descriptions.
53 * @partition_count: The number of elements in the partitions array.
54 */
55struct gpmi_nand_platform_data {
56 /* SoC hardware information. */
57 int (*platform_init)(void);
58
59 /* NAND Flash information. */
60 unsigned int min_prop_delay_in_ns;
61 unsigned int max_prop_delay_in_ns;
62 unsigned int max_chip_count;
63
64 /* Medium information. */
65 struct mtd_partition *partitions;
66 unsigned partition_count;
67};
68#endif
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index a9e6ba46865e..94e924e2ecd5 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -26,7 +26,7 @@
26#include <linux/list.h> 26#include <linux/list.h>
27#include <linux/string.h> 27#include <linux/string.h>
28#include <linux/bug.h> 28#include <linux/bug.h>
29 29#include <linux/kernel.h>
30 30
31#include <asm/unaligned.h> 31#include <asm/unaligned.h>
32#include <asm/system.h> 32#include <asm/system.h>
@@ -214,6 +214,7 @@ struct map_info {
214 void __iomem *virt; 214 void __iomem *virt;
215 void *cached; 215 void *cached;
216 216
217 int swap; /* this mapping's byte-swapping requirement */
217 int bankwidth; /* in octets. This isn't necessarily the width 218 int bankwidth; /* in octets. This isn't necessarily the width
218 of actual bus cycles -- it's the repeat interval 219 of actual bus cycles -- it's the repeat interval
219 in bytes, before you are talking to the first chip again. 220 in bytes, before you are talking to the first chip again.
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 9f5b312af783..d43dc25af82e 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -171,87 +171,60 @@ struct mtd_info {
171 struct mtd_erase_region_info *eraseregions; 171 struct mtd_erase_region_info *eraseregions;
172 172
173 /* 173 /*
174 * Erase is an asynchronous operation. Device drivers are supposed 174 * Do not call via these pointers, use corresponding mtd_*()
175 * to call instr->callback() whenever the operation completes, even 175 * wrappers instead.
176 * if it completes with a failure.
177 * Callers are supposed to pass a callback function and wait for it
178 * to be called before writing to the block.
179 */ 176 */
180 int (*erase) (struct mtd_info *mtd, struct erase_info *instr); 177 int (*erase) (struct mtd_info *mtd, struct erase_info *instr);
181
182 /* This stuff for eXecute-In-Place */
183 /* phys is optional and may be set to NULL */
184 int (*point) (struct mtd_info *mtd, loff_t from, size_t len, 178 int (*point) (struct mtd_info *mtd, loff_t from, size_t len,
185 size_t *retlen, void **virt, resource_size_t *phys); 179 size_t *retlen, void **virt, resource_size_t *phys);
186
187 /* We probably shouldn't allow XIP if the unpoint isn't a NULL */
188 void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); 180 void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len);
189
190 /* Allow NOMMU mmap() to directly map the device (if not NULL)
191 * - return the address to which the offset maps
192 * - return -ENOSYS to indicate refusal to do the mapping
193 */
194 unsigned long (*get_unmapped_area) (struct mtd_info *mtd, 181 unsigned long (*get_unmapped_area) (struct mtd_info *mtd,
195 unsigned long len, 182 unsigned long len,
196 unsigned long offset, 183 unsigned long offset,
197 unsigned long flags); 184 unsigned long flags);
198 185 int (*read) (struct mtd_info *mtd, loff_t from, size_t len,
199 /* Backing device capabilities for this device 186 size_t *retlen, u_char *buf);
200 * - provides mmap capabilities 187 int (*write) (struct mtd_info *mtd, loff_t to, size_t len,
201 */ 188 size_t *retlen, const u_char *buf);
202 struct backing_dev_info *backing_dev_info; 189 int (*panic_write) (struct mtd_info *mtd, loff_t to, size_t len,
203 190 size_t *retlen, const u_char *buf);
204
205 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
206 int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf);
207
208 /* In blackbox flight recorder like scenarios we want to make successful
209 writes in interrupt context. panic_write() is only intended to be
210 called when its known the kernel is about to panic and we need the
211 write to succeed. Since the kernel is not going to be running for much
212 longer, this function can break locks and delay to ensure the write
213 succeeds (but not sleep). */
214
215 int (*panic_write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf);
216
217 int (*read_oob) (struct mtd_info *mtd, loff_t from, 191 int (*read_oob) (struct mtd_info *mtd, loff_t from,
218 struct mtd_oob_ops *ops); 192 struct mtd_oob_ops *ops);
219 int (*write_oob) (struct mtd_info *mtd, loff_t to, 193 int (*write_oob) (struct mtd_info *mtd, loff_t to,
220 struct mtd_oob_ops *ops); 194 struct mtd_oob_ops *ops);
221 195 int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf,
222 /* 196 size_t len);
223 * Methods to access the protection register area, present in some 197 int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from,
224 * flash devices. The user data is one time programmable but the 198 size_t len, size_t *retlen, u_char *buf);
225 * factory data is read only. 199 int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf,
226 */ 200 size_t len);
227 int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); 201 int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from,
228 int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 202 size_t len, size_t *retlen, u_char *buf);
229 int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); 203 int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t to, size_t len,
230 int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 204 size_t *retlen, u_char *buf);
231 int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 205 int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from,
232 int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len); 206 size_t len);
233 207 int (*writev) (struct mtd_info *mtd, const struct kvec *vecs,
234 /* kvec-based read/write methods. 208 unsigned long count, loff_t to, size_t *retlen);
235 NB: The 'count' parameter is the number of _vectors_, each of
236 which contains an (ofs, len) tuple.
237 */
238 int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen);
239
240 /* Sync */
241 void (*sync) (struct mtd_info *mtd); 209 void (*sync) (struct mtd_info *mtd);
242
243 /* Chip-supported device locking */
244 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 210 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
245 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 211 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
246 int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 212 int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
247 213 int (*block_isbad) (struct mtd_info *mtd, loff_t ofs);
248 /* Power Management functions */ 214 int (*block_markbad) (struct mtd_info *mtd, loff_t ofs);
249 int (*suspend) (struct mtd_info *mtd); 215 int (*suspend) (struct mtd_info *mtd);
250 void (*resume) (struct mtd_info *mtd); 216 void (*resume) (struct mtd_info *mtd);
217 /*
218 * If the driver is something smart, like UBI, it may need to maintain
219 * its own reference counting. The below functions are only for driver.
220 */
221 int (*get_device) (struct mtd_info *mtd);
222 void (*put_device) (struct mtd_info *mtd);
251 223
252 /* Bad block management functions */ 224 /* Backing device capabilities for this device
253 int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); 225 * - provides mmap capabilities
254 int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); 226 */
227 struct backing_dev_info *backing_dev_info;
255 228
256 struct notifier_block reboot_notifier; /* default mode before reboot */ 229 struct notifier_block reboot_notifier; /* default mode before reboot */
257 230
@@ -265,18 +238,216 @@ struct mtd_info {
265 struct module *owner; 238 struct module *owner;
266 struct device dev; 239 struct device dev;
267 int usecount; 240 int usecount;
268
269 /* If the driver is something smart, like UBI, it may need to maintain
270 * its own reference counting. The below functions are only for driver.
271 * The driver may register its callbacks. These callbacks are not
272 * supposed to be called by MTD users */
273 int (*get_device) (struct mtd_info *mtd);
274 void (*put_device) (struct mtd_info *mtd);
275}; 241};
276 242
277static inline struct mtd_info *dev_to_mtd(struct device *dev) 243/*
244 * Erase is an asynchronous operation. Device drivers are supposed
245 * to call instr->callback() whenever the operation completes, even
246 * if it completes with a failure.
247 * Callers are supposed to pass a callback function and wait for it
248 * to be called before writing to the block.
249 */
250static inline int mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
251{
252 return mtd->erase(mtd, instr);
253}
254
255/*
256 * This stuff for eXecute-In-Place. phys is optional and may be set to NULL.
257 */
258static inline int mtd_point(struct mtd_info *mtd, loff_t from, size_t len,
259 size_t *retlen, void **virt, resource_size_t *phys)
260{
261 *retlen = 0;
262 if (!mtd->point)
263 return -EOPNOTSUPP;
264 return mtd->point(mtd, from, len, retlen, virt, phys);
265}
266
267/* We probably shouldn't allow XIP if the unpoint isn't a NULL */
268static inline void mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
278{ 269{
279 return dev ? dev_get_drvdata(dev) : NULL; 270 return mtd->unpoint(mtd, from, len);
271}
272
273/*
274 * Allow NOMMU mmap() to directly map the device (if not NULL)
275 * - return the address to which the offset maps
276 * - return -ENOSYS to indicate refusal to do the mapping
277 */
278static inline unsigned long mtd_get_unmapped_area(struct mtd_info *mtd,
279 unsigned long len,
280 unsigned long offset,
281 unsigned long flags)
282{
283 if (!mtd->get_unmapped_area)
284 return -EOPNOTSUPP;
285 return mtd->get_unmapped_area(mtd, len, offset, flags);
286}
287
288static inline int mtd_read(struct mtd_info *mtd, loff_t from, size_t len,
289 size_t *retlen, u_char *buf)
290{
291 return mtd->read(mtd, from, len, retlen, buf);
292}
293
294static inline int mtd_write(struct mtd_info *mtd, loff_t to, size_t len,
295 size_t *retlen, const u_char *buf)
296{
297 *retlen = 0;
298 if (!mtd->write)
299 return -EROFS;
300 return mtd->write(mtd, to, len, retlen, buf);
301}
302
303/*
304 * In blackbox flight recorder like scenarios we want to make successful writes
305 * in interrupt context. panic_write() is only intended to be called when its
306 * known the kernel is about to panic and we need the write to succeed. Since
307 * the kernel is not going to be running for much longer, this function can
308 * break locks and delay to ensure the write succeeds (but not sleep).
309 */
310static inline int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len,
311 size_t *retlen, const u_char *buf)
312{
313 *retlen = 0;
314 if (!mtd->panic_write)
315 return -EOPNOTSUPP;
316 return mtd->panic_write(mtd, to, len, retlen, buf);
317}
318
319static inline int mtd_read_oob(struct mtd_info *mtd, loff_t from,
320 struct mtd_oob_ops *ops)
321{
322 ops->retlen = ops->oobretlen = 0;
323 if (!mtd->read_oob)
324 return -EOPNOTSUPP;
325 return mtd->read_oob(mtd, from, ops);
326}
327
328static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to,
329 struct mtd_oob_ops *ops)
330{
331 ops->retlen = ops->oobretlen = 0;
332 if (!mtd->write_oob)
333 return -EOPNOTSUPP;
334 return mtd->write_oob(mtd, to, ops);
335}
336
337/*
338 * Method to access the protection register area, present in some flash
339 * devices. The user data is one time programmable but the factory data is read
340 * only.
341 */
342static inline int mtd_get_fact_prot_info(struct mtd_info *mtd,
343 struct otp_info *buf, size_t len)
344{
345 if (!mtd->get_fact_prot_info)
346 return -EOPNOTSUPP;
347 return mtd->get_fact_prot_info(mtd, buf, len);
348}
349
350static inline int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from,
351 size_t len, size_t *retlen,
352 u_char *buf)
353{
354 *retlen = 0;
355 if (!mtd->read_fact_prot_reg)
356 return -EOPNOTSUPP;
357 return mtd->read_fact_prot_reg(mtd, from, len, retlen, buf);
358}
359
360static inline int mtd_get_user_prot_info(struct mtd_info *mtd,
361 struct otp_info *buf,
362 size_t len)
363{
364 if (!mtd->get_user_prot_info)
365 return -EOPNOTSUPP;
366 return mtd->get_user_prot_info(mtd, buf, len);
367}
368
369static inline int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from,
370 size_t len, size_t *retlen,
371 u_char *buf)
372{
373 *retlen = 0;
374 if (!mtd->read_user_prot_reg)
375 return -EOPNOTSUPP;
376 return mtd->read_user_prot_reg(mtd, from, len, retlen, buf);
377}
378
379static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to,
380 size_t len, size_t *retlen,
381 u_char *buf)
382{
383 *retlen = 0;
384 if (!mtd->write_user_prot_reg)
385 return -EOPNOTSUPP;
386 return mtd->write_user_prot_reg(mtd, to, len, retlen, buf);
387}
388
389static inline int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from,
390 size_t len)
391{
392 if (!mtd->lock_user_prot_reg)
393 return -EOPNOTSUPP;
394 return mtd->lock_user_prot_reg(mtd, from, len);
395}
396
397int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
398 unsigned long count, loff_t to, size_t *retlen);
399
400static inline void mtd_sync(struct mtd_info *mtd)
401{
402 if (mtd->sync)
403 mtd->sync(mtd);
404}
405
406/* Chip-supported device locking */
407static inline int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
408{
409 if (!mtd->lock)
410 return -EOPNOTSUPP;
411 return mtd->lock(mtd, ofs, len);
412}
413
414static inline int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
415{
416 if (!mtd->unlock)
417 return -EOPNOTSUPP;
418 return mtd->unlock(mtd, ofs, len);
419}
420
421static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
422{
423 if (!mtd->is_locked)
424 return -EOPNOTSUPP;
425 return mtd->is_locked(mtd, ofs, len);
426}
427
428static inline int mtd_suspend(struct mtd_info *mtd)
429{
430 return mtd->suspend ? mtd->suspend(mtd) : 0;
431}
432
433static inline void mtd_resume(struct mtd_info *mtd)
434{
435 if (mtd->resume)
436 mtd->resume(mtd);
437}
438
439static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs)
440{
441 if (!mtd->block_isbad)
442 return 0;
443 return mtd->block_isbad(mtd, ofs);
444}
445
446static inline int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs)
447{
448 if (!mtd->block_markbad)
449 return -EOPNOTSUPP;
450 return mtd->block_markbad(mtd, ofs);
280} 451}
281 452
282static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) 453static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd)
@@ -309,6 +480,16 @@ static inline uint32_t mtd_mod_by_ws(uint64_t sz, struct mtd_info *mtd)
309 return do_div(sz, mtd->writesize); 480 return do_div(sz, mtd->writesize);
310} 481}
311 482
483static inline int mtd_has_oob(const struct mtd_info *mtd)
484{
485 return mtd->read_oob && mtd->write_oob;
486}
487
488static inline int mtd_can_have_bb(const struct mtd_info *mtd)
489{
490 return !!mtd->block_isbad;
491}
492
312 /* Kernel-side ioctl definitions */ 493 /* Kernel-side ioctl definitions */
313 494
314struct mtd_partition; 495struct mtd_partition;
@@ -338,13 +519,6 @@ struct mtd_notifier {
338 519
339extern void register_mtd_user (struct mtd_notifier *new); 520extern void register_mtd_user (struct mtd_notifier *new);
340extern int unregister_mtd_user (struct mtd_notifier *old); 521extern int unregister_mtd_user (struct mtd_notifier *old);
341
342int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
343 unsigned long count, loff_t to, size_t *retlen);
344
345int default_mtd_readv(struct mtd_info *mtd, struct kvec *vecs,
346 unsigned long count, loff_t from, size_t *retlen);
347
348void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size); 522void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size);
349 523
350void mtd_erase_callback(struct erase_info *instr); 524void mtd_erase_callback(struct erase_info *instr);
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 904131bab501..63b5a8b6dfbd 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -555,6 +555,7 @@ struct nand_chip {
555#define NAND_MFR_HYNIX 0xad 555#define NAND_MFR_HYNIX 0xad
556#define NAND_MFR_MICRON 0x2c 556#define NAND_MFR_MICRON 0x2c
557#define NAND_MFR_AMD 0x01 557#define NAND_MFR_AMD 0x01
558#define NAND_MFR_MACRONIX 0xc2
558 559
559/** 560/**
560 * struct nand_flash_dev - NAND Flash Device ID Structure 561 * struct nand_flash_dev - NAND Flash Device ID Structure
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index 04e018160e2b..d2887e76b7f6 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -30,6 +30,7 @@ struct physmap_flash_data {
30 unsigned int pfow_base; 30 unsigned int pfow_base;
31 char *probe_type; 31 char *probe_type;
32 struct mtd_partition *parts; 32 struct mtd_partition *parts;
33 const char **part_probe_types;
33}; 34};
34 35
35#endif /* __LINUX_MTD_PHYSMAP__ */ 36#endif /* __LINUX_MTD_PHYSMAP__ */
diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h
index a7003b7a695d..b188f68a08c9 100644
--- a/include/linux/neighbour.h
+++ b/include/linux/neighbour.h
@@ -116,6 +116,7 @@ enum {
116 NDTPA_PROXY_DELAY, /* u64, msecs */ 116 NDTPA_PROXY_DELAY, /* u64, msecs */
117 NDTPA_PROXY_QLEN, /* u32 */ 117 NDTPA_PROXY_QLEN, /* u32 */
118 NDTPA_LOCKTIME, /* u64, msecs */ 118 NDTPA_LOCKTIME, /* u64, msecs */
119 NDTPA_QUEUE_LENBYTES, /* u32 */
119 __NDTPA_MAX 120 __NDTPA_MAX
120}; 121};
121#define NDTPA_MAX (__NDTPA_MAX - 1) 122#define NDTPA_MAX (__NDTPA_MAX - 1)
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
new file mode 100644
index 000000000000..77f5202977ce
--- /dev/null
+++ b/include/linux/netdev_features.h
@@ -0,0 +1,146 @@
1/*
2 * Network device features.
3 *
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10#ifndef _LINUX_NETDEV_FEATURES_H
11#define _LINUX_NETDEV_FEATURES_H
12
13#include <linux/types.h>
14
15typedef u64 netdev_features_t;
16
17enum {
18 NETIF_F_SG_BIT, /* Scatter/gather IO. */
19 NETIF_F_IP_CSUM_BIT, /* Can checksum TCP/UDP over IPv4. */
20 __UNUSED_NETIF_F_1,
21 NETIF_F_HW_CSUM_BIT, /* Can checksum all the packets. */
22 NETIF_F_IPV6_CSUM_BIT, /* Can checksum TCP/UDP over IPV6 */
23 NETIF_F_HIGHDMA_BIT, /* Can DMA to high memory. */
24 NETIF_F_FRAGLIST_BIT, /* Scatter/gather IO. */
25 NETIF_F_HW_VLAN_TX_BIT, /* Transmit VLAN hw acceleration */
26 NETIF_F_HW_VLAN_RX_BIT, /* Receive VLAN hw acceleration */
27 NETIF_F_HW_VLAN_FILTER_BIT, /* Receive filtering on VLAN */
28 NETIF_F_VLAN_CHALLENGED_BIT, /* Device cannot handle VLAN packets */
29 NETIF_F_GSO_BIT, /* Enable software GSO. */
30 NETIF_F_LLTX_BIT, /* LockLess TX - deprecated. Please */
31 /* do not use LLTX in new drivers */
32 NETIF_F_NETNS_LOCAL_BIT, /* Does not change network namespaces */
33 NETIF_F_GRO_BIT, /* Generic receive offload */
34 NETIF_F_LRO_BIT, /* large receive offload */
35
36 /**/NETIF_F_GSO_SHIFT, /* keep the order of SKB_GSO_* bits */
37 NETIF_F_TSO_BIT /* ... TCPv4 segmentation */
38 = NETIF_F_GSO_SHIFT,
39 NETIF_F_UFO_BIT, /* ... UDPv4 fragmentation */
40 NETIF_F_GSO_ROBUST_BIT, /* ... ->SKB_GSO_DODGY */
41 NETIF_F_TSO_ECN_BIT, /* ... TCP ECN support */
42 NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */
43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */
44 NETIF_F_GSO_RESERVED1, /* ... free (fill GSO_MASK to 8 bits) */
45 /**/NETIF_F_GSO_LAST, /* [can't be last bit, see GSO_MASK] */
46 NETIF_F_GSO_RESERVED2 /* ... free (fill GSO_MASK to 8 bits) */
47 = NETIF_F_GSO_LAST,
48
49 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
50 NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */
51 NETIF_F_FCOE_MTU_BIT, /* Supports max FCoE MTU, 2158 bytes*/
52 NETIF_F_NTUPLE_BIT, /* N-tuple filters supported */
53 NETIF_F_RXHASH_BIT, /* Receive hashing offload */
54 NETIF_F_RXCSUM_BIT, /* Receive checksumming offload */
55 NETIF_F_NOCACHE_COPY_BIT, /* Use no-cache copyfromuser */
56 NETIF_F_LOOPBACK_BIT, /* Enable loopback */
57
58 /*
59 * Add your fresh new feature above and remember to update
60 * netdev_features_strings[] in net/core/ethtool.c and maybe
61 * some feature mask #defines below. Please also describe it
62 * in Documentation/networking/netdev-features.txt.
63 */
64
65 /**/NETDEV_FEATURE_COUNT
66};
67
68/* copy'n'paste compression ;) */
69#define __NETIF_F_BIT(bit) ((netdev_features_t)1 << (bit))
70#define __NETIF_F(name) __NETIF_F_BIT(NETIF_F_##name##_BIT)
71
72#define NETIF_F_FCOE_CRC __NETIF_F(FCOE_CRC)
73#define NETIF_F_FCOE_MTU __NETIF_F(FCOE_MTU)
74#define NETIF_F_FRAGLIST __NETIF_F(FRAGLIST)
75#define NETIF_F_FSO __NETIF_F(FSO)
76#define NETIF_F_GRO __NETIF_F(GRO)
77#define NETIF_F_GSO __NETIF_F(GSO)
78#define NETIF_F_GSO_ROBUST __NETIF_F(GSO_ROBUST)
79#define NETIF_F_HIGHDMA __NETIF_F(HIGHDMA)
80#define NETIF_F_HW_CSUM __NETIF_F(HW_CSUM)
81#define NETIF_F_HW_VLAN_FILTER __NETIF_F(HW_VLAN_FILTER)
82#define NETIF_F_HW_VLAN_RX __NETIF_F(HW_VLAN_RX)
83#define NETIF_F_HW_VLAN_TX __NETIF_F(HW_VLAN_TX)
84#define NETIF_F_IP_CSUM __NETIF_F(IP_CSUM)
85#define NETIF_F_IPV6_CSUM __NETIF_F(IPV6_CSUM)
86#define NETIF_F_LLTX __NETIF_F(LLTX)
87#define NETIF_F_LOOPBACK __NETIF_F(LOOPBACK)
88#define NETIF_F_LRO __NETIF_F(LRO)
89#define NETIF_F_NETNS_LOCAL __NETIF_F(NETNS_LOCAL)
90#define NETIF_F_NOCACHE_COPY __NETIF_F(NOCACHE_COPY)
91#define NETIF_F_NTUPLE __NETIF_F(NTUPLE)
92#define NETIF_F_RXCSUM __NETIF_F(RXCSUM)
93#define NETIF_F_RXHASH __NETIF_F(RXHASH)
94#define NETIF_F_SCTP_CSUM __NETIF_F(SCTP_CSUM)
95#define NETIF_F_SG __NETIF_F(SG)
96#define NETIF_F_TSO6 __NETIF_F(TSO6)
97#define NETIF_F_TSO_ECN __NETIF_F(TSO_ECN)
98#define NETIF_F_TSO __NETIF_F(TSO)
99#define NETIF_F_UFO __NETIF_F(UFO)
100#define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED)
101
102/* Features valid for ethtool to change */
103/* = all defined minus driver/device-class-related */
104#define NETIF_F_NEVER_CHANGE (NETIF_F_VLAN_CHALLENGED | \
105 NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
106
107/* remember that ((t)1 << t_BITS) is undefined in C99 */
108#define NETIF_F_ETHTOOL_BITS ((__NETIF_F_BIT(NETDEV_FEATURE_COUNT - 1) | \
109 (__NETIF_F_BIT(NETDEV_FEATURE_COUNT - 1) - 1)) & \
110 ~NETIF_F_NEVER_CHANGE)
111
112/* Segmentation offload feature mask */
113#define NETIF_F_GSO_MASK (__NETIF_F_BIT(NETIF_F_GSO_LAST + 1) - \
114 __NETIF_F_BIT(NETIF_F_GSO_SHIFT))
115
116/* List of features with software fallbacks. */
117#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \
118 NETIF_F_TSO6 | NETIF_F_UFO)
119
120#define NETIF_F_GEN_CSUM NETIF_F_HW_CSUM
121#define NETIF_F_V4_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM)
122#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
123#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
124
125#define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
126
127#define NETIF_F_ALL_FCOE (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \
128 NETIF_F_FSO)
129
130/*
131 * If one device supports one of these features, then enable them
132 * for all in netdev_increment_features.
133 */
134#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
135 NETIF_F_SG | NETIF_F_HIGHDMA | \
136 NETIF_F_FRAGLIST | NETIF_F_VLAN_CHALLENGED)
137/*
138 * If one device doesn't support one of these features, then disable it
139 * for all in netdev_increment_features.
140 */
141#define NETIF_F_ALL_FOR_ALL (NETIF_F_NOCACHE_COPY | NETIF_F_FSO)
142
143/* changeable features with no special hardware requirements */
144#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO)
145
146#endif /* _LINUX_NETDEV_FEATURES_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index a82ad4dd306a..0eac07c95255 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -43,6 +43,7 @@
43#include <linux/rculist.h> 43#include <linux/rculist.h>
44#include <linux/dmaengine.h> 44#include <linux/dmaengine.h>
45#include <linux/workqueue.h> 45#include <linux/workqueue.h>
46#include <linux/dynamic_queue_limits.h>
46 47
47#include <linux/ethtool.h> 48#include <linux/ethtool.h>
48#include <net/net_namespace.h> 49#include <net/net_namespace.h>
@@ -50,8 +51,10 @@
50#ifdef CONFIG_DCB 51#ifdef CONFIG_DCB
51#include <net/dcbnl.h> 52#include <net/dcbnl.h>
52#endif 53#endif
54#include <net/netprio_cgroup.h>
55
56#include <linux/netdev_features.h>
53 57
54struct vlan_group;
55struct netpoll_info; 58struct netpoll_info;
56struct phy_device; 59struct phy_device;
57/* 802.11 specific */ 60/* 802.11 specific */
@@ -141,22 +144,20 @@ static inline bool dev_xmit_complete(int rc)
141 * used. 144 * used.
142 */ 145 */
143 146
144#if defined(CONFIG_WLAN) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) 147#if defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25)
145# if defined(CONFIG_MAC80211_MESH) 148# if defined(CONFIG_MAC80211_MESH)
146# define LL_MAX_HEADER 128 149# define LL_MAX_HEADER 128
147# else 150# else
148# define LL_MAX_HEADER 96 151# define LL_MAX_HEADER 96
149# endif 152# endif
150#elif defined(CONFIG_TR) || defined(CONFIG_TR_MODULE) 153#elif IS_ENABLED(CONFIG_TR)
151# define LL_MAX_HEADER 48 154# define LL_MAX_HEADER 48
152#else 155#else
153# define LL_MAX_HEADER 32 156# define LL_MAX_HEADER 32
154#endif 157#endif
155 158
156#if !defined(CONFIG_NET_IPIP) && !defined(CONFIG_NET_IPIP_MODULE) && \ 159#if !IS_ENABLED(CONFIG_NET_IPIP) && !IS_ENABLED(CONFIG_NET_IPGRE) && \
157 !defined(CONFIG_NET_IPGRE) && !defined(CONFIG_NET_IPGRE_MODULE) && \ 160 !IS_ENABLED(CONFIG_IPV6_SIT) && !IS_ENABLED(CONFIG_IPV6_TUNNEL)
158 !defined(CONFIG_IPV6_SIT) && !defined(CONFIG_IPV6_SIT_MODULE) && \
159 !defined(CONFIG_IPV6_TUNNEL) && !defined(CONFIG_IPV6_TUNNEL_MODULE)
160#define MAX_HEADER LL_MAX_HEADER 161#define MAX_HEADER LL_MAX_HEADER
161#else 162#else
162#define MAX_HEADER (LL_MAX_HEADER + 48) 163#define MAX_HEADER (LL_MAX_HEADER + 48)
@@ -212,6 +213,11 @@ enum {
212#include <linux/cache.h> 213#include <linux/cache.h>
213#include <linux/skbuff.h> 214#include <linux/skbuff.h>
214 215
216#ifdef CONFIG_RPS
217#include <linux/jump_label.h>
218extern struct jump_label_key rps_needed;
219#endif
220
215struct neighbour; 221struct neighbour;
216struct neigh_parms; 222struct neigh_parms;
217struct sk_buff; 223struct sk_buff;
@@ -272,16 +278,11 @@ struct hh_cache {
272 * 278 *
273 * We could use other alignment values, but we must maintain the 279 * We could use other alignment values, but we must maintain the
274 * relationship HH alignment <= LL alignment. 280 * relationship HH alignment <= LL alignment.
275 *
276 * LL_ALLOCATED_SPACE also takes into account the tailroom the device
277 * may need.
278 */ 281 */
279#define LL_RESERVED_SPACE(dev) \ 282#define LL_RESERVED_SPACE(dev) \
280 ((((dev)->hard_header_len+(dev)->needed_headroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) 283 ((((dev)->hard_header_len+(dev)->needed_headroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
281#define LL_RESERVED_SPACE_EXTRA(dev,extra) \ 284#define LL_RESERVED_SPACE_EXTRA(dev,extra) \
282 ((((dev)->hard_header_len+(dev)->needed_headroom+(extra))&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) 285 ((((dev)->hard_header_len+(dev)->needed_headroom+(extra))&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
283#define LL_ALLOCATED_SPACE(dev) \
284 ((((dev)->hard_header_len+(dev)->needed_headroom+(dev)->needed_tailroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
285 286
286struct header_ops { 287struct header_ops {
287 int (*create) (struct sk_buff *skb, struct net_device *dev, 288 int (*create) (struct sk_buff *skb, struct net_device *dev,
@@ -516,11 +517,23 @@ static inline void napi_synchronize(const struct napi_struct *n)
516#endif 517#endif
517 518
518enum netdev_queue_state_t { 519enum netdev_queue_state_t {
519 __QUEUE_STATE_XOFF, 520 __QUEUE_STATE_DRV_XOFF,
521 __QUEUE_STATE_STACK_XOFF,
520 __QUEUE_STATE_FROZEN, 522 __QUEUE_STATE_FROZEN,
521#define QUEUE_STATE_XOFF_OR_FROZEN ((1 << __QUEUE_STATE_XOFF) | \ 523#define QUEUE_STATE_ANY_XOFF ((1 << __QUEUE_STATE_DRV_XOFF) | \
522 (1 << __QUEUE_STATE_FROZEN)) 524 (1 << __QUEUE_STATE_STACK_XOFF))
525#define QUEUE_STATE_ANY_XOFF_OR_FROZEN (QUEUE_STATE_ANY_XOFF | \
526 (1 << __QUEUE_STATE_FROZEN))
523}; 527};
528/*
529 * __QUEUE_STATE_DRV_XOFF is used by drivers to stop the transmit queue. The
530 * netif_tx_* functions below are used to manipulate this flag. The
531 * __QUEUE_STATE_STACK_XOFF flag is used by the stack to stop the transmit
532 * queue independently. The netif_xmit_*stopped functions below are called
533 * to check if the queue has been stopped by the driver or stack (either
534 * of the XOFF bits are set in the state). Drivers should not need to call
535 * netif_xmit*stopped functions, they should only be using netif_tx_*.
536 */
524 537
525struct netdev_queue { 538struct netdev_queue {
526/* 539/*
@@ -528,9 +541,8 @@ struct netdev_queue {
528 */ 541 */
529 struct net_device *dev; 542 struct net_device *dev;
530 struct Qdisc *qdisc; 543 struct Qdisc *qdisc;
531 unsigned long state;
532 struct Qdisc *qdisc_sleeping; 544 struct Qdisc *qdisc_sleeping;
533#if defined(CONFIG_RPS) || defined(CONFIG_XPS) 545#ifdef CONFIG_SYSFS
534 struct kobject kobj; 546 struct kobject kobj;
535#endif 547#endif
536#if defined(CONFIG_XPS) && defined(CONFIG_NUMA) 548#if defined(CONFIG_XPS) && defined(CONFIG_NUMA)
@@ -545,6 +557,18 @@ struct netdev_queue {
545 * please use this field instead of dev->trans_start 557 * please use this field instead of dev->trans_start
546 */ 558 */
547 unsigned long trans_start; 559 unsigned long trans_start;
560
561 /*
562 * Number of TX timeouts for this queue
563 * (/sys/class/net/DEV/Q/trans_timeout)
564 */
565 unsigned long trans_timeout;
566
567 unsigned long state;
568
569#ifdef CONFIG_BQL
570 struct dql dql;
571#endif
548} ____cacheline_aligned_in_smp; 572} ____cacheline_aligned_in_smp;
549 573
550static inline int netdev_queue_numa_node_read(const struct netdev_queue *q) 574static inline int netdev_queue_numa_node_read(const struct netdev_queue *q)
@@ -573,7 +597,7 @@ struct rps_map {
573 struct rcu_head rcu; 597 struct rcu_head rcu;
574 u16 cpus[0]; 598 u16 cpus[0];
575}; 599};
576#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16))) 600#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + ((_num) * sizeof(u16)))
577 601
578/* 602/*
579 * The rps_dev_flow structure contains the mapping of a flow to a CPU, the 603 * The rps_dev_flow structure contains the mapping of a flow to a CPU, the
@@ -597,7 +621,7 @@ struct rps_dev_flow_table {
597 struct rps_dev_flow flows[0]; 621 struct rps_dev_flow flows[0];
598}; 622};
599#define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \ 623#define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \
600 (_num * sizeof(struct rps_dev_flow))) 624 ((_num) * sizeof(struct rps_dev_flow)))
601 625
602/* 626/*
603 * The rps_sock_flow_table contains mappings of flows to the last CPU 627 * The rps_sock_flow_table contains mappings of flows to the last CPU
@@ -608,7 +632,7 @@ struct rps_sock_flow_table {
608 u16 ents[0]; 632 u16 ents[0];
609}; 633};
610#define RPS_SOCK_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_sock_flow_table) + \ 634#define RPS_SOCK_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_sock_flow_table) + \
611 (_num * sizeof(u16))) 635 ((_num) * sizeof(u16)))
612 636
613#define RPS_NO_CPU 0xffff 637#define RPS_NO_CPU 0xffff
614 638
@@ -660,7 +684,7 @@ struct xps_map {
660 struct rcu_head rcu; 684 struct rcu_head rcu;
661 u16 queues[0]; 685 u16 queues[0];
662}; 686};
663#define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + (_num * sizeof(u16))) 687#define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + ((_num) * sizeof(u16)))
664#define XPS_MIN_MAP_ALLOC ((L1_CACHE_BYTES - sizeof(struct xps_map)) \ 688#define XPS_MIN_MAP_ALLOC ((L1_CACHE_BYTES - sizeof(struct xps_map)) \
665 / sizeof(u16)) 689 / sizeof(u16))
666 690
@@ -683,6 +707,23 @@ struct netdev_tc_txq {
683 u16 offset; 707 u16 offset;
684}; 708};
685 709
710#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
711/*
712 * This structure is to hold information about the device
713 * configured to run FCoE protocol stack.
714 */
715struct netdev_fcoe_hbainfo {
716 char manufacturer[64];
717 char serial_number[64];
718 char hardware_version[64];
719 char driver_version[64];
720 char optionrom_version[64];
721 char firmware_version[64];
722 char model[256];
723 char model_description[256];
724};
725#endif
726
686/* 727/*
687 * This structure defines the management hooks for network devices. 728 * This structure defines the management hooks for network devices.
688 * The following hooks can be defined; unless noted otherwise, they are 729 * The following hooks can be defined; unless noted otherwise, they are
@@ -767,11 +808,11 @@ struct netdev_tc_txq {
767 * 3. Update dev->stats asynchronously and atomically, and define 808 * 3. Update dev->stats asynchronously and atomically, and define
768 * neither operation. 809 * neither operation.
769 * 810 *
770 * void (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid); 811 * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid);
771 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) 812 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
772 * this function is called when a VLAN id is registered. 813 * this function is called when a VLAN id is registered.
773 * 814 *
774 * void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); 815 * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid);
775 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) 816 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
776 * this function is called when a VLAN id is unregistered. 817 * this function is called when a VLAN id is unregistered.
777 * 818 *
@@ -823,6 +864,13 @@ struct netdev_tc_txq {
823 * perform necessary setup and returns 1 to indicate the device is set up 864 * perform necessary setup and returns 1 to indicate the device is set up
824 * successfully to perform DDP on this I/O, otherwise this returns 0. 865 * successfully to perform DDP on this I/O, otherwise this returns 0.
825 * 866 *
867 * int (*ndo_fcoe_get_hbainfo)(struct net_device *dev,
868 * struct netdev_fcoe_hbainfo *hbainfo);
869 * Called when the FCoE Protocol stack wants information on the underlying
870 * device. This information is utilized by the FCoE protocol stack to
871 * register attributes with Fiber Channel management service as per the
872 * FC-GS Fabric Device Management Information(FDMI) specification.
873 *
826 * int (*ndo_fcoe_get_wwn)(struct net_device *dev, u64 *wwn, int type); 874 * int (*ndo_fcoe_get_wwn)(struct net_device *dev, u64 *wwn, int type);
827 * Called when the underlying device wants to override default World Wide 875 * Called when the underlying device wants to override default World Wide
828 * Name (WWN) generation mechanism in FCoE protocol stack to pass its own 876 * Name (WWN) generation mechanism in FCoE protocol stack to pass its own
@@ -845,12 +893,13 @@ struct netdev_tc_txq {
845 * Called to release previously enslaved netdev. 893 * Called to release previously enslaved netdev.
846 * 894 *
847 * Feature/offload setting functions. 895 * Feature/offload setting functions.
848 * u32 (*ndo_fix_features)(struct net_device *dev, u32 features); 896 * netdev_features_t (*ndo_fix_features)(struct net_device *dev,
897 * netdev_features_t features);
849 * Adjusts the requested feature flags according to device-specific 898 * Adjusts the requested feature flags according to device-specific
850 * constraints, and returns the resulting flags. Must not modify 899 * constraints, and returns the resulting flags. Must not modify
851 * the device state. 900 * the device state.
852 * 901 *
853 * int (*ndo_set_features)(struct net_device *dev, u32 features); 902 * int (*ndo_set_features)(struct net_device *dev, netdev_features_t features);
854 * Called to update device configuration to new features. Passed 903 * Called to update device configuration to new features. Passed
855 * feature set might be less than what was returned by ndo_fix_features()). 904 * feature set might be less than what was returned by ndo_fix_features()).
856 * Must return >0 or -errno if it changed dev->features itself. 905 * Must return >0 or -errno if it changed dev->features itself.
@@ -885,9 +934,9 @@ struct net_device_ops {
885 struct rtnl_link_stats64 *storage); 934 struct rtnl_link_stats64 *storage);
886 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 935 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
887 936
888 void (*ndo_vlan_rx_add_vid)(struct net_device *dev, 937 int (*ndo_vlan_rx_add_vid)(struct net_device *dev,
889 unsigned short vid); 938 unsigned short vid);
890 void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, 939 int (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
891 unsigned short vid); 940 unsigned short vid);
892#ifdef CONFIG_NET_POLL_CONTROLLER 941#ifdef CONFIG_NET_POLL_CONTROLLER
893 void (*ndo_poll_controller)(struct net_device *dev); 942 void (*ndo_poll_controller)(struct net_device *dev);
@@ -912,7 +961,7 @@ struct net_device_ops {
912 int (*ndo_get_vf_port)(struct net_device *dev, 961 int (*ndo_get_vf_port)(struct net_device *dev,
913 int vf, struct sk_buff *skb); 962 int vf, struct sk_buff *skb);
914 int (*ndo_setup_tc)(struct net_device *dev, u8 tc); 963 int (*ndo_setup_tc)(struct net_device *dev, u8 tc);
915#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 964#if IS_ENABLED(CONFIG_FCOE)
916 int (*ndo_fcoe_enable)(struct net_device *dev); 965 int (*ndo_fcoe_enable)(struct net_device *dev);
917 int (*ndo_fcoe_disable)(struct net_device *dev); 966 int (*ndo_fcoe_disable)(struct net_device *dev);
918 int (*ndo_fcoe_ddp_setup)(struct net_device *dev, 967 int (*ndo_fcoe_ddp_setup)(struct net_device *dev,
@@ -925,9 +974,11 @@ struct net_device_ops {
925 u16 xid, 974 u16 xid,
926 struct scatterlist *sgl, 975 struct scatterlist *sgl,
927 unsigned int sgc); 976 unsigned int sgc);
977 int (*ndo_fcoe_get_hbainfo)(struct net_device *dev,
978 struct netdev_fcoe_hbainfo *hbainfo);
928#endif 979#endif
929 980
930#if defined(CONFIG_LIBFCOE) || defined(CONFIG_LIBFCOE_MODULE) 981#if IS_ENABLED(CONFIG_LIBFCOE)
931#define NETDEV_FCOE_WWNN 0 982#define NETDEV_FCOE_WWNN 0
932#define NETDEV_FCOE_WWPN 1 983#define NETDEV_FCOE_WWPN 1
933 int (*ndo_fcoe_get_wwn)(struct net_device *dev, 984 int (*ndo_fcoe_get_wwn)(struct net_device *dev,
@@ -944,10 +995,12 @@ struct net_device_ops {
944 struct net_device *slave_dev); 995 struct net_device *slave_dev);
945 int (*ndo_del_slave)(struct net_device *dev, 996 int (*ndo_del_slave)(struct net_device *dev,
946 struct net_device *slave_dev); 997 struct net_device *slave_dev);
947 u32 (*ndo_fix_features)(struct net_device *dev, 998 netdev_features_t (*ndo_fix_features)(struct net_device *dev,
948 u32 features); 999 netdev_features_t features);
949 int (*ndo_set_features)(struct net_device *dev, 1000 int (*ndo_set_features)(struct net_device *dev,
950 u32 features); 1001 netdev_features_t features);
1002 int (*ndo_neigh_construct)(struct neighbour *n);
1003 void (*ndo_neigh_destroy)(struct neighbour *n);
951}; 1004};
952 1005
953/* 1006/*
@@ -997,91 +1050,13 @@ struct net_device {
997 struct list_head unreg_list; 1050 struct list_head unreg_list;
998 1051
999 /* currently active device features */ 1052 /* currently active device features */
1000 u32 features; 1053 netdev_features_t features;
1001 /* user-changeable features */ 1054 /* user-changeable features */
1002 u32 hw_features; 1055 netdev_features_t hw_features;
1003 /* user-requested features */ 1056 /* user-requested features */
1004 u32 wanted_features; 1057 netdev_features_t wanted_features;
1005 /* mask of features inheritable by VLAN devices */ 1058 /* mask of features inheritable by VLAN devices */
1006 u32 vlan_features; 1059 netdev_features_t vlan_features;
1007
1008 /* Net device feature bits; if you change something,
1009 * also update netdev_features_strings[] in ethtool.c */
1010
1011#define NETIF_F_SG 1 /* Scatter/gather IO. */
1012#define NETIF_F_IP_CSUM 2 /* Can checksum TCP/UDP over IPv4. */
1013#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */
1014#define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */
1015#define NETIF_F_IPV6_CSUM 16 /* Can checksum TCP/UDP over IPV6 */
1016#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */
1017#define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */
1018#define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */
1019#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */
1020#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */
1021#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
1022#define NETIF_F_GSO 2048 /* Enable software GSO. */
1023#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */
1024 /* do not use LLTX in new drivers */
1025#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */
1026#define NETIF_F_GRO 16384 /* Generic receive offload */
1027#define NETIF_F_LRO 32768 /* large receive offload */
1028
1029/* the GSO_MASK reserves bits 16 through 23 */
1030#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */
1031#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */
1032#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
1033#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */
1034#define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */
1035#define NETIF_F_RXCSUM (1 << 29) /* Receive checksumming offload */
1036#define NETIF_F_NOCACHE_COPY (1 << 30) /* Use no-cache copyfromuser */
1037#define NETIF_F_LOOPBACK (1 << 31) /* Enable loopback */
1038
1039 /* Segmentation offload features */
1040#define NETIF_F_GSO_SHIFT 16
1041#define NETIF_F_GSO_MASK 0x00ff0000
1042#define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT)
1043#define NETIF_F_UFO (SKB_GSO_UDP << NETIF_F_GSO_SHIFT)
1044#define NETIF_F_GSO_ROBUST (SKB_GSO_DODGY << NETIF_F_GSO_SHIFT)
1045#define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT)
1046#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT)
1047#define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT)
1048
1049 /* Features valid for ethtool to change */
1050 /* = all defined minus driver/device-class-related */
1051#define NETIF_F_NEVER_CHANGE (NETIF_F_VLAN_CHALLENGED | \
1052 NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
1053#define NETIF_F_ETHTOOL_BITS (0xff3fffff & ~NETIF_F_NEVER_CHANGE)
1054
1055 /* List of features with software fallbacks. */
1056#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \
1057 NETIF_F_TSO6 | NETIF_F_UFO)
1058
1059
1060#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
1061#define NETIF_F_V4_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM)
1062#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
1063#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
1064
1065#define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
1066
1067#define NETIF_F_ALL_FCOE (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \
1068 NETIF_F_FSO)
1069
1070 /*
1071 * If one device supports one of these features, then enable them
1072 * for all in netdev_increment_features.
1073 */
1074#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
1075 NETIF_F_SG | NETIF_F_HIGHDMA | \
1076 NETIF_F_FRAGLIST | NETIF_F_VLAN_CHALLENGED)
1077 /*
1078 * If one device doesn't support one of these features, then disable it
1079 * for all in netdev_increment_features.
1080 */
1081#define NETIF_F_ALL_FOR_ALL (NETIF_F_NOCACHE_COPY | NETIF_F_FSO)
1082
1083 /* changeable features with no special hardware requirements */
1084#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO)
1085 1060
1086 /* Interface index. Unique device identifier */ 1061 /* Interface index. Unique device identifier */
1087 int ifindex; 1062 int ifindex;
@@ -1132,6 +1107,7 @@ struct net_device {
1132 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ 1107 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */
1133 unsigned char addr_assign_type; /* hw address assignment type */ 1108 unsigned char addr_assign_type; /* hw address assignment type */
1134 unsigned char addr_len; /* hardware address length */ 1109 unsigned char addr_len; /* hardware address length */
1110 unsigned char neigh_priv_len;
1135 unsigned short dev_id; /* for shared network cards */ 1111 unsigned short dev_id; /* for shared network cards */
1136 1112
1137 spinlock_t addr_list_lock; 1113 spinlock_t addr_list_lock;
@@ -1144,11 +1120,11 @@ struct net_device {
1144 1120
1145 /* Protocol specific pointers */ 1121 /* Protocol specific pointers */
1146 1122
1147#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 1123#if IS_ENABLED(CONFIG_VLAN_8021Q)
1148 struct vlan_group __rcu *vlgrp; /* VLAN group */ 1124 struct vlan_info __rcu *vlan_info; /* VLAN info */
1149#endif 1125#endif
1150#ifdef CONFIG_NET_DSA 1126#if IS_ENABLED(CONFIG_NET_DSA)
1151 void *dsa_ptr; /* dsa specific data */ 1127 struct dsa_switch_tree *dsa_ptr; /* dsa specific data */
1152#endif 1128#endif
1153 void *atalk_ptr; /* AppleTalk link */ 1129 void *atalk_ptr; /* AppleTalk link */
1154 struct in_device __rcu *ip_ptr; /* IPv4 specific data */ 1130 struct in_device __rcu *ip_ptr; /* IPv4 specific data */
@@ -1184,9 +1160,11 @@ struct net_device {
1184 1160
1185 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 1161 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
1186 1162
1187#if defined(CONFIG_RPS) || defined(CONFIG_XPS) 1163#ifdef CONFIG_SYSFS
1188 struct kset *queues_kset; 1164 struct kset *queues_kset;
1165#endif
1189 1166
1167#ifdef CONFIG_RPS
1190 struct netdev_rx_queue *_rx; 1168 struct netdev_rx_queue *_rx;
1191 1169
1192 /* Number of RX queues allocated at register_netdev() time */ 1170 /* Number of RX queues allocated at register_netdev() time */
@@ -1308,10 +1286,13 @@ struct net_device {
1308 struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE]; 1286 struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE];
1309 u8 prio_tc_map[TC_BITMASK + 1]; 1287 u8 prio_tc_map[TC_BITMASK + 1];
1310 1288
1311#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 1289#if IS_ENABLED(CONFIG_FCOE)
1312 /* max exchange id for FCoE LRO by ddp */ 1290 /* max exchange id for FCoE LRO by ddp */
1313 unsigned int fcoe_ddp_xid; 1291 unsigned int fcoe_ddp_xid;
1314#endif 1292#endif
1293#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
1294 struct netprio_map __rcu *priomap;
1295#endif
1315 /* phy device may attach itself for hardware timestamping */ 1296 /* phy device may attach itself for hardware timestamping */
1316 struct phy_device *phydev; 1297 struct phy_device *phydev;
1317 1298
@@ -1515,7 +1496,7 @@ struct packet_type {
1515 struct packet_type *, 1496 struct packet_type *,
1516 struct net_device *); 1497 struct net_device *);
1517 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1498 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
1518 u32 features); 1499 netdev_features_t features);
1519 int (*gso_send_check)(struct sk_buff *skb); 1500 int (*gso_send_check)(struct sk_buff *skb);
1520 struct sk_buff **(*gro_receive)(struct sk_buff **head, 1501 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1521 struct sk_buff *skb); 1502 struct sk_buff *skb);
@@ -1783,7 +1764,7 @@ extern void __netif_schedule(struct Qdisc *q);
1783 1764
1784static inline void netif_schedule_queue(struct netdev_queue *txq) 1765static inline void netif_schedule_queue(struct netdev_queue *txq)
1785{ 1766{
1786 if (!test_bit(__QUEUE_STATE_XOFF, &txq->state)) 1767 if (!(txq->state & QUEUE_STATE_ANY_XOFF))
1787 __netif_schedule(txq->qdisc); 1768 __netif_schedule(txq->qdisc);
1788} 1769}
1789 1770
@@ -1797,7 +1778,7 @@ static inline void netif_tx_schedule_all(struct net_device *dev)
1797 1778
1798static inline void netif_tx_start_queue(struct netdev_queue *dev_queue) 1779static inline void netif_tx_start_queue(struct netdev_queue *dev_queue)
1799{ 1780{
1800 clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state); 1781 clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
1801} 1782}
1802 1783
1803/** 1784/**
@@ -1829,7 +1810,7 @@ static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue)
1829 return; 1810 return;
1830 } 1811 }
1831#endif 1812#endif
1832 if (test_and_clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state)) 1813 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state))
1833 __netif_schedule(dev_queue->qdisc); 1814 __netif_schedule(dev_queue->qdisc);
1834} 1815}
1835 1816
@@ -1861,7 +1842,7 @@ static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
1861 pr_info("netif_stop_queue() cannot be called before register_netdev()\n"); 1842 pr_info("netif_stop_queue() cannot be called before register_netdev()\n");
1862 return; 1843 return;
1863 } 1844 }
1864 set_bit(__QUEUE_STATE_XOFF, &dev_queue->state); 1845 set_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
1865} 1846}
1866 1847
1867/** 1848/**
@@ -1888,7 +1869,7 @@ static inline void netif_tx_stop_all_queues(struct net_device *dev)
1888 1869
1889static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue) 1870static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue)
1890{ 1871{
1891 return test_bit(__QUEUE_STATE_XOFF, &dev_queue->state); 1872 return test_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
1892} 1873}
1893 1874
1894/** 1875/**
@@ -1902,9 +1883,68 @@ static inline int netif_queue_stopped(const struct net_device *dev)
1902 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); 1883 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0));
1903} 1884}
1904 1885
1905static inline int netif_tx_queue_frozen_or_stopped(const struct netdev_queue *dev_queue) 1886static inline int netif_xmit_stopped(const struct netdev_queue *dev_queue)
1906{ 1887{
1907 return dev_queue->state & QUEUE_STATE_XOFF_OR_FROZEN; 1888 return dev_queue->state & QUEUE_STATE_ANY_XOFF;
1889}
1890
1891static inline int netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue)
1892{
1893 return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN;
1894}
1895
1896static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
1897 unsigned int bytes)
1898{
1899#ifdef CONFIG_BQL
1900 dql_queued(&dev_queue->dql, bytes);
1901 if (unlikely(dql_avail(&dev_queue->dql) < 0)) {
1902 set_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state);
1903 if (unlikely(dql_avail(&dev_queue->dql) >= 0))
1904 clear_bit(__QUEUE_STATE_STACK_XOFF,
1905 &dev_queue->state);
1906 }
1907#endif
1908}
1909
1910static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes)
1911{
1912 netdev_tx_sent_queue(netdev_get_tx_queue(dev, 0), bytes);
1913}
1914
1915static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
1916 unsigned pkts, unsigned bytes)
1917{
1918#ifdef CONFIG_BQL
1919 if (likely(bytes)) {
1920 dql_completed(&dev_queue->dql, bytes);
1921 if (unlikely(test_bit(__QUEUE_STATE_STACK_XOFF,
1922 &dev_queue->state) &&
1923 dql_avail(&dev_queue->dql) >= 0)) {
1924 if (test_and_clear_bit(__QUEUE_STATE_STACK_XOFF,
1925 &dev_queue->state))
1926 netif_schedule_queue(dev_queue);
1927 }
1928 }
1929#endif
1930}
1931
1932static inline void netdev_completed_queue(struct net_device *dev,
1933 unsigned pkts, unsigned bytes)
1934{
1935 netdev_tx_completed_queue(netdev_get_tx_queue(dev, 0), pkts, bytes);
1936}
1937
1938static inline void netdev_tx_reset_queue(struct netdev_queue *q)
1939{
1940#ifdef CONFIG_BQL
1941 dql_reset(&q->dql);
1942#endif
1943}
1944
1945static inline void netdev_reset_queue(struct net_device *dev_queue)
1946{
1947 netdev_tx_reset_queue(netdev_get_tx_queue(dev_queue, 0));
1908} 1948}
1909 1949
1910/** 1950/**
@@ -1991,7 +2031,7 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
1991 if (netpoll_trap()) 2031 if (netpoll_trap())
1992 return; 2032 return;
1993#endif 2033#endif
1994 if (test_and_clear_bit(__QUEUE_STATE_XOFF, &txq->state)) 2034 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state))
1995 __netif_schedule(txq->qdisc); 2035 __netif_schedule(txq->qdisc);
1996} 2036}
1997 2037
@@ -2115,7 +2155,7 @@ extern void netdev_run_todo(void);
2115 */ 2155 */
2116static inline void dev_put(struct net_device *dev) 2156static inline void dev_put(struct net_device *dev)
2117{ 2157{
2118 irqsafe_cpu_dec(*dev->pcpu_refcnt); 2158 this_cpu_dec(*dev->pcpu_refcnt);
2119} 2159}
2120 2160
2121/** 2161/**
@@ -2126,7 +2166,7 @@ static inline void dev_put(struct net_device *dev)
2126 */ 2166 */
2127static inline void dev_hold(struct net_device *dev) 2167static inline void dev_hold(struct net_device *dev)
2128{ 2168{
2129 irqsafe_cpu_inc(*dev->pcpu_refcnt); 2169 this_cpu_inc(*dev->pcpu_refcnt);
2130} 2170}
2131 2171
2132/* Carrier loss detection, dial on demand. The functions netif_carrier_on 2172/* Carrier loss detection, dial on demand. The functions netif_carrier_on
@@ -2410,6 +2450,11 @@ static inline void netif_addr_lock(struct net_device *dev)
2410 spin_lock(&dev->addr_list_lock); 2450 spin_lock(&dev->addr_list_lock);
2411} 2451}
2412 2452
2453static inline void netif_addr_lock_nested(struct net_device *dev)
2454{
2455 spin_lock_nested(&dev->addr_list_lock, SINGLE_DEPTH_NESTING);
2456}
2457
2413static inline void netif_addr_lock_bh(struct net_device *dev) 2458static inline void netif_addr_lock_bh(struct net_device *dev)
2414{ 2459{
2415 spin_lock_bh(&dev->addr_list_lock); 2460 spin_lock_bh(&dev->addr_list_lock);
@@ -2520,7 +2565,8 @@ extern int netdev_set_master(struct net_device *dev, struct net_device *master)
2520extern int netdev_set_bond_master(struct net_device *dev, 2565extern int netdev_set_bond_master(struct net_device *dev,
2521 struct net_device *master); 2566 struct net_device *master);
2522extern int skb_checksum_help(struct sk_buff *skb); 2567extern int skb_checksum_help(struct sk_buff *skb);
2523extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features); 2568extern struct sk_buff *skb_gso_segment(struct sk_buff *skb,
2569 netdev_features_t features);
2524#ifdef CONFIG_BUG 2570#ifdef CONFIG_BUG
2525extern void netdev_rx_csum_fault(struct net_device *dev); 2571extern void netdev_rx_csum_fault(struct net_device *dev);
2526#else 2572#else
@@ -2549,11 +2595,13 @@ extern const char *netdev_drivername(const struct net_device *dev);
2549 2595
2550extern void linkwatch_run_queue(void); 2596extern void linkwatch_run_queue(void);
2551 2597
2552static inline u32 netdev_get_wanted_features(struct net_device *dev) 2598static inline netdev_features_t netdev_get_wanted_features(
2599 struct net_device *dev)
2553{ 2600{
2554 return (dev->features & ~dev->hw_features) | dev->wanted_features; 2601 return (dev->features & ~dev->hw_features) | dev->wanted_features;
2555} 2602}
2556u32 netdev_increment_features(u32 all, u32 one, u32 mask); 2603netdev_features_t netdev_increment_features(netdev_features_t all,
2604 netdev_features_t one, netdev_features_t mask);
2557int __netdev_update_features(struct net_device *dev); 2605int __netdev_update_features(struct net_device *dev);
2558void netdev_update_features(struct net_device *dev); 2606void netdev_update_features(struct net_device *dev);
2559void netdev_change_features(struct net_device *dev); 2607void netdev_change_features(struct net_device *dev);
@@ -2561,21 +2609,31 @@ void netdev_change_features(struct net_device *dev);
2561void netif_stacked_transfer_operstate(const struct net_device *rootdev, 2609void netif_stacked_transfer_operstate(const struct net_device *rootdev,
2562 struct net_device *dev); 2610 struct net_device *dev);
2563 2611
2564u32 netif_skb_features(struct sk_buff *skb); 2612netdev_features_t netif_skb_features(struct sk_buff *skb);
2565 2613
2566static inline int net_gso_ok(u32 features, int gso_type) 2614static inline int net_gso_ok(netdev_features_t features, int gso_type)
2567{ 2615{
2568 int feature = gso_type << NETIF_F_GSO_SHIFT; 2616 netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT;
2617
2618 /* check flags correspondence */
2619 BUILD_BUG_ON(SKB_GSO_TCPV4 != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT));
2620 BUILD_BUG_ON(SKB_GSO_UDP != (NETIF_F_UFO >> NETIF_F_GSO_SHIFT));
2621 BUILD_BUG_ON(SKB_GSO_DODGY != (NETIF_F_GSO_ROBUST >> NETIF_F_GSO_SHIFT));
2622 BUILD_BUG_ON(SKB_GSO_TCP_ECN != (NETIF_F_TSO_ECN >> NETIF_F_GSO_SHIFT));
2623 BUILD_BUG_ON(SKB_GSO_TCPV6 != (NETIF_F_TSO6 >> NETIF_F_GSO_SHIFT));
2624 BUILD_BUG_ON(SKB_GSO_FCOE != (NETIF_F_FSO >> NETIF_F_GSO_SHIFT));
2625
2569 return (features & feature) == feature; 2626 return (features & feature) == feature;
2570} 2627}
2571 2628
2572static inline int skb_gso_ok(struct sk_buff *skb, u32 features) 2629static inline int skb_gso_ok(struct sk_buff *skb, netdev_features_t features)
2573{ 2630{
2574 return net_gso_ok(features, skb_shinfo(skb)->gso_type) && 2631 return net_gso_ok(features, skb_shinfo(skb)->gso_type) &&
2575 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); 2632 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
2576} 2633}
2577 2634
2578static inline int netif_needs_gso(struct sk_buff *skb, int features) 2635static inline int netif_needs_gso(struct sk_buff *skb,
2636 netdev_features_t features)
2579{ 2637{
2580 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || 2638 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) ||
2581 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 2639 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
@@ -2594,22 +2652,6 @@ static inline int netif_is_bond_slave(struct net_device *dev)
2594 2652
2595extern struct pernet_operations __net_initdata loopback_net_ops; 2653extern struct pernet_operations __net_initdata loopback_net_ops;
2596 2654
2597static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev)
2598{
2599 if (dev->features & NETIF_F_RXCSUM)
2600 return 1;
2601 if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum)
2602 return 0;
2603 return dev->ethtool_ops->get_rx_csum(dev);
2604}
2605
2606static inline u32 dev_ethtool_get_flags(struct net_device *dev)
2607{
2608 if (!dev->ethtool_ops || !dev->ethtool_ops->get_flags)
2609 return 0;
2610 return dev->ethtool_ops->get_flags(dev);
2611}
2612
2613/* Logging, debugging and troubleshooting/diagnostic helpers. */ 2655/* Logging, debugging and troubleshooting/diagnostic helpers. */
2614 2656
2615/* netdev_printk helpers, similar to dev_printk */ 2657/* netdev_printk helpers, similar to dev_printk */
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 857f5026ced6..b809265607d0 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -162,6 +162,24 @@ extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[];
162 162
163extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; 163extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
164 164
165#if defined(CONFIG_JUMP_LABEL)
166#include <linux/jump_label.h>
167extern struct jump_label_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
168static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
169{
170 if (__builtin_constant_p(pf) &&
171 __builtin_constant_p(hook))
172 return static_branch(&nf_hooks_needed[pf][hook]);
173
174 return !list_empty(&nf_hooks[pf][hook]);
175}
176#else
177static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
178{
179 return !list_empty(&nf_hooks[pf][hook]);
180}
181#endif
182
165int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb, 183int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
166 struct net_device *indev, struct net_device *outdev, 184 struct net_device *indev, struct net_device *outdev,
167 int (*okfn)(struct sk_buff *), int thresh); 185 int (*okfn)(struct sk_buff *), int thresh);
@@ -179,11 +197,9 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
179 struct net_device *outdev, 197 struct net_device *outdev,
180 int (*okfn)(struct sk_buff *), int thresh) 198 int (*okfn)(struct sk_buff *), int thresh)
181{ 199{
182#ifndef CONFIG_NETFILTER_DEBUG 200 if (nf_hooks_active(pf, hook))
183 if (list_empty(&nf_hooks[pf][hook])) 201 return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh);
184 return 1; 202 return 1;
185#endif
186 return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh);
187} 203}
188 204
189static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, 205static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index a1b410c76fc3..e144f54185c0 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -5,7 +5,9 @@ header-y += nf_conntrack_ftp.h
5header-y += nf_conntrack_sctp.h 5header-y += nf_conntrack_sctp.h
6header-y += nf_conntrack_tcp.h 6header-y += nf_conntrack_tcp.h
7header-y += nf_conntrack_tuple_common.h 7header-y += nf_conntrack_tuple_common.h
8header-y += nf_nat.h
8header-y += nfnetlink.h 9header-y += nfnetlink.h
10header-y += nfnetlink_acct.h
9header-y += nfnetlink_compat.h 11header-y += nfnetlink_compat.h
10header-y += nfnetlink_conntrack.h 12header-y += nfnetlink_conntrack.h
11header-y += nfnetlink_log.h 13header-y += nfnetlink_log.h
@@ -21,6 +23,7 @@ header-y += xt_DSCP.h
21header-y += xt_IDLETIMER.h 23header-y += xt_IDLETIMER.h
22header-y += xt_LED.h 24header-y += xt_LED.h
23header-y += xt_MARK.h 25header-y += xt_MARK.h
26header-y += xt_nfacct.h
24header-y += xt_NFLOG.h 27header-y += xt_NFLOG.h
25header-y += xt_NFQUEUE.h 28header-y += xt_NFQUEUE.h
26header-y += xt_RATEEST.h 29header-y += xt_RATEEST.h
@@ -40,6 +43,7 @@ header-y += xt_cpu.h
40header-y += xt_dccp.h 43header-y += xt_dccp.h
41header-y += xt_devgroup.h 44header-y += xt_devgroup.h
42header-y += xt_dscp.h 45header-y += xt_dscp.h
46header-y += xt_ecn.h
43header-y += xt_esp.h 47header-y += xt_esp.h
44header-y += xt_hashlimit.h 48header-y += xt_hashlimit.h
45header-y += xt_helper.h 49header-y += xt_helper.h
diff --git a/include/linux/netfilter/nf_conntrack_tuple_common.h b/include/linux/netfilter/nf_conntrack_tuple_common.h
index 2ea22b018a87..2f6bbc5b8125 100644
--- a/include/linux/netfilter/nf_conntrack_tuple_common.h
+++ b/include/linux/netfilter/nf_conntrack_tuple_common.h
@@ -7,6 +7,33 @@ enum ip_conntrack_dir {
7 IP_CT_DIR_MAX 7 IP_CT_DIR_MAX
8}; 8};
9 9
10/* The protocol-specific manipulable parts of the tuple: always in
11 * network order
12 */
13union nf_conntrack_man_proto {
14 /* Add other protocols here. */
15 __be16 all;
16
17 struct {
18 __be16 port;
19 } tcp;
20 struct {
21 __be16 port;
22 } udp;
23 struct {
24 __be16 id;
25 } icmp;
26 struct {
27 __be16 port;
28 } dccp;
29 struct {
30 __be16 port;
31 } sctp;
32 struct {
33 __be16 key; /* GRE key is 32bit, PPtP only uses 16bit */
34 } gre;
35};
36
10#define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL) 37#define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL)
11 38
12#endif /* _NF_CONNTRACK_TUPLE_COMMON_H */ 39#endif /* _NF_CONNTRACK_TUPLE_COMMON_H */
diff --git a/include/linux/netfilter/nf_nat.h b/include/linux/netfilter/nf_nat.h
new file mode 100644
index 000000000000..8df2d13730b2
--- /dev/null
+++ b/include/linux/netfilter/nf_nat.h
@@ -0,0 +1,25 @@
1#ifndef _NETFILTER_NF_NAT_H
2#define _NETFILTER_NF_NAT_H
3
4#include <linux/netfilter.h>
5#include <linux/netfilter/nf_conntrack_tuple_common.h>
6
7#define NF_NAT_RANGE_MAP_IPS 1
8#define NF_NAT_RANGE_PROTO_SPECIFIED 2
9#define NF_NAT_RANGE_PROTO_RANDOM 4
10#define NF_NAT_RANGE_PERSISTENT 8
11
12struct nf_nat_ipv4_range {
13 unsigned int flags;
14 __be32 min_ip;
15 __be32 max_ip;
16 union nf_conntrack_man_proto min;
17 union nf_conntrack_man_proto max;
18};
19
20struct nf_nat_ipv4_multi_range_compat {
21 unsigned int rangesize;
22 struct nf_nat_ipv4_range range[1];
23};
24
25#endif /* _NETFILTER_NF_NAT_H */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 74d33861473c..b64454c2f79f 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -48,7 +48,8 @@ struct nfgenmsg {
48#define NFNL_SUBSYS_ULOG 4 48#define NFNL_SUBSYS_ULOG 4
49#define NFNL_SUBSYS_OSF 5 49#define NFNL_SUBSYS_OSF 5
50#define NFNL_SUBSYS_IPSET 6 50#define NFNL_SUBSYS_IPSET 6
51#define NFNL_SUBSYS_COUNT 7 51#define NFNL_SUBSYS_ACCT 7
52#define NFNL_SUBSYS_COUNT 8
52 53
53#ifdef __KERNEL__ 54#ifdef __KERNEL__
54 55
diff --git a/include/linux/netfilter/nfnetlink_acct.h b/include/linux/netfilter/nfnetlink_acct.h
new file mode 100644
index 000000000000..7c4279b4ae7a
--- /dev/null
+++ b/include/linux/netfilter/nfnetlink_acct.h
@@ -0,0 +1,36 @@
1#ifndef _NFNL_ACCT_H_
2#define _NFNL_ACCT_H_
3
4#ifndef NFACCT_NAME_MAX
5#define NFACCT_NAME_MAX 32
6#endif
7
8enum nfnl_acct_msg_types {
9 NFNL_MSG_ACCT_NEW,
10 NFNL_MSG_ACCT_GET,
11 NFNL_MSG_ACCT_GET_CTRZERO,
12 NFNL_MSG_ACCT_DEL,
13 NFNL_MSG_ACCT_MAX
14};
15
16enum nfnl_acct_type {
17 NFACCT_UNSPEC,
18 NFACCT_NAME,
19 NFACCT_PKTS,
20 NFACCT_BYTES,
21 NFACCT_USE,
22 __NFACCT_MAX
23};
24#define NFACCT_MAX (__NFACCT_MAX - 1)
25
26#ifdef __KERNEL__
27
28struct nf_acct;
29
30extern struct nf_acct *nfnl_acct_find_get(const char *filter_name);
31extern void nfnl_acct_put(struct nf_acct *acct);
32extern void nfnl_acct_update(const struct sk_buff *skb, struct nf_acct *nfacct);
33
34#endif /* __KERNEL__ */
35
36#endif /* _NFNL_ACCT_H */
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 32cddf78b13e..8d674a786744 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -471,7 +471,7 @@ DECLARE_PER_CPU(seqcount_t, xt_recseq);
471 * 471 *
472 * Begin packet processing : all readers must wait the end 472 * Begin packet processing : all readers must wait the end
473 * 1) Must be called with preemption disabled 473 * 1) Must be called with preemption disabled
474 * 2) softirqs must be disabled too (or we should use irqsafe_cpu_add()) 474 * 2) softirqs must be disabled too (or we should use this_cpu_add())
475 * Returns : 475 * Returns :
476 * 1 if no recursion on this cpu 476 * 1 if no recursion on this cpu
477 * 0 if recursion detected 477 * 0 if recursion detected
@@ -503,7 +503,7 @@ static inline unsigned int xt_write_recseq_begin(void)
503 * 503 *
504 * End packet processing : all readers can proceed 504 * End packet processing : all readers can proceed
505 * 1) Must be called with preemption disabled 505 * 1) Must be called with preemption disabled
506 * 2) softirqs must be disabled too (or we should use irqsafe_cpu_add()) 506 * 2) softirqs must be disabled too (or we should use this_cpu_add())
507 */ 507 */
508static inline void xt_write_recseq_end(unsigned int addend) 508static inline void xt_write_recseq_end(unsigned int addend)
509{ 509{
diff --git a/include/linux/netfilter/xt_ecn.h b/include/linux/netfilter/xt_ecn.h
new file mode 100644
index 000000000000..7158fca364f2
--- /dev/null
+++ b/include/linux/netfilter/xt_ecn.h
@@ -0,0 +1,35 @@
1/* iptables module for matching the ECN header in IPv4 and TCP header
2 *
3 * (C) 2002 Harald Welte <laforge@gnumonks.org>
4 *
5 * This software is distributed under GNU GPL v2, 1991
6 *
7 * ipt_ecn.h,v 1.4 2002/08/05 19:39:00 laforge Exp
8*/
9#ifndef _XT_ECN_H
10#define _XT_ECN_H
11
12#include <linux/types.h>
13#include <linux/netfilter/xt_dscp.h>
14
15#define XT_ECN_IP_MASK (~XT_DSCP_MASK)
16
17#define XT_ECN_OP_MATCH_IP 0x01
18#define XT_ECN_OP_MATCH_ECE 0x10
19#define XT_ECN_OP_MATCH_CWR 0x20
20
21#define XT_ECN_OP_MATCH_MASK 0xce
22
23/* match info */
24struct xt_ecn_info {
25 __u8 operation;
26 __u8 invert;
27 __u8 ip_ect;
28 union {
29 struct {
30 __u8 ect;
31 } tcp;
32 } proto;
33};
34
35#endif /* _XT_ECN_H */
diff --git a/include/linux/netfilter/xt_nfacct.h b/include/linux/netfilter/xt_nfacct.h
new file mode 100644
index 000000000000..3e19c8a86576
--- /dev/null
+++ b/include/linux/netfilter/xt_nfacct.h
@@ -0,0 +1,13 @@
1#ifndef _XT_NFACCT_MATCH_H
2#define _XT_NFACCT_MATCH_H
3
4#include <linux/netfilter/nfnetlink_acct.h>
5
6struct nf_acct;
7
8struct xt_nfacct_match_info {
9 char name[NFACCT_NAME_MAX];
10 struct nf_acct *nfacct;
11};
12
13#endif /* _XT_NFACCT_MATCH_H */
diff --git a/include/linux/netfilter/xt_rpfilter.h b/include/linux/netfilter/xt_rpfilter.h
new file mode 100644
index 000000000000..8358d4f71952
--- /dev/null
+++ b/include/linux/netfilter/xt_rpfilter.h
@@ -0,0 +1,23 @@
1#ifndef _XT_RPATH_H
2#define _XT_RPATH_H
3
4#include <linux/types.h>
5
6enum {
7 XT_RPFILTER_LOOSE = 1 << 0,
8 XT_RPFILTER_VALID_MARK = 1 << 1,
9 XT_RPFILTER_ACCEPT_LOCAL = 1 << 2,
10 XT_RPFILTER_INVERT = 1 << 3,
11#ifdef __KERNEL__
12 XT_RPFILTER_OPTION_MASK = XT_RPFILTER_LOOSE |
13 XT_RPFILTER_VALID_MARK |
14 XT_RPFILTER_ACCEPT_LOCAL |
15 XT_RPFILTER_INVERT,
16#endif
17};
18
19struct xt_rpfilter_info {
20 __u8 flags;
21};
22
23#endif
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index 8797ed16feb2..4dd5bd6994a8 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -285,8 +285,8 @@ struct ebt_table {
285 struct module *me; 285 struct module *me;
286}; 286};
287 287
288#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_replace)-1)) & \ 288#define EBT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) & \
289 ~(__alignof__(struct ebt_replace)-1)) 289 ~(__alignof__(struct _xt_align)-1))
290extern struct ebt_table *ebt_register_table(struct net *net, 290extern struct ebt_table *ebt_register_table(struct net *net,
291 const struct ebt_table *table); 291 const struct ebt_table *table);
292extern void ebt_unregister_table(struct net *net, struct ebt_table *table); 292extern void ebt_unregister_table(struct net *net, struct ebt_table *table);
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index c3b45480ecf7..f9930c87fff3 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -12,4 +12,3 @@ header-y += ipt_ah.h
12header-y += ipt_ecn.h 12header-y += ipt_ecn.h
13header-y += ipt_realm.h 13header-y += ipt_realm.h
14header-y += ipt_ttl.h 14header-y += ipt_ttl.h
15header-y += nf_nat.h
diff --git a/include/linux/netfilter_ipv4/ipt_ecn.h b/include/linux/netfilter_ipv4/ipt_ecn.h
index eabf95fb7d3e..0e0c063dbf60 100644
--- a/include/linux/netfilter_ipv4/ipt_ecn.h
+++ b/include/linux/netfilter_ipv4/ipt_ecn.h
@@ -1,35 +1,15 @@
1/* iptables module for matching the ECN header in IPv4 and TCP header
2 *
3 * (C) 2002 Harald Welte <laforge@gnumonks.org>
4 *
5 * This software is distributed under GNU GPL v2, 1991
6 *
7 * ipt_ecn.h,v 1.4 2002/08/05 19:39:00 laforge Exp
8*/
9#ifndef _IPT_ECN_H 1#ifndef _IPT_ECN_H
10#define _IPT_ECN_H 2#define _IPT_ECN_H
11 3
12#include <linux/types.h> 4#include <linux/netfilter/xt_ecn.h>
13#include <linux/netfilter/xt_dscp.h> 5#define ipt_ecn_info xt_ecn_info
14 6
15#define IPT_ECN_IP_MASK (~XT_DSCP_MASK) 7enum {
16 8 IPT_ECN_IP_MASK = XT_ECN_IP_MASK,
17#define IPT_ECN_OP_MATCH_IP 0x01 9 IPT_ECN_OP_MATCH_IP = XT_ECN_OP_MATCH_IP,
18#define IPT_ECN_OP_MATCH_ECE 0x10 10 IPT_ECN_OP_MATCH_ECE = XT_ECN_OP_MATCH_ECE,
19#define IPT_ECN_OP_MATCH_CWR 0x20 11 IPT_ECN_OP_MATCH_CWR = XT_ECN_OP_MATCH_CWR,
20 12 IPT_ECN_OP_MATCH_MASK = XT_ECN_OP_MATCH_MASK,
21#define IPT_ECN_OP_MATCH_MASK 0xce
22
23/* match info */
24struct ipt_ecn_info {
25 __u8 operation;
26 __u8 invert;
27 __u8 ip_ect;
28 union {
29 struct {
30 __u8 ect;
31 } tcp;
32 } proto;
33}; 13};
34 14
35#endif /* _IPT_ECN_H */ 15#endif /* IPT_ECN_H */
diff --git a/include/linux/netfilter_ipv4/nf_nat.h b/include/linux/netfilter_ipv4/nf_nat.h
deleted file mode 100644
index 7a861d09fc86..000000000000
--- a/include/linux/netfilter_ipv4/nf_nat.h
+++ /dev/null
@@ -1,58 +0,0 @@
1#ifndef _LINUX_NF_NAT_H
2#define _LINUX_NF_NAT_H
3
4#include <linux/types.h>
5
6#define IP_NAT_RANGE_MAP_IPS 1
7#define IP_NAT_RANGE_PROTO_SPECIFIED 2
8#define IP_NAT_RANGE_PROTO_RANDOM 4
9#define IP_NAT_RANGE_PERSISTENT 8
10
11/* The protocol-specific manipulable parts of the tuple. */
12union nf_conntrack_man_proto {
13 /* Add other protocols here. */
14 __be16 all;
15
16 struct {
17 __be16 port;
18 } tcp;
19 struct {
20 __be16 port;
21 } udp;
22 struct {
23 __be16 id;
24 } icmp;
25 struct {
26 __be16 port;
27 } dccp;
28 struct {
29 __be16 port;
30 } sctp;
31 struct {
32 __be16 key; /* GRE key is 32bit, PPtP only uses 16bit */
33 } gre;
34};
35
36/* Single range specification. */
37struct nf_nat_range {
38 /* Set to OR of flags above. */
39 unsigned int flags;
40
41 /* Inclusive: network order. */
42 __be32 min_ip, max_ip;
43
44 /* Inclusive: network order */
45 union nf_conntrack_man_proto min, max;
46};
47
48/* For backwards compat: don't use in modern code. */
49struct nf_nat_multi_range_compat {
50 unsigned int rangesize; /* Must be 1. */
51
52 /* hangs off end. */
53 struct nf_nat_range range[1];
54};
55
56#define nf_nat_multi_range nf_nat_multi_range_compat
57
58#endif
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 8374d2967362..52e48959cfa1 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -8,7 +8,7 @@
8#define NETLINK_UNUSED 1 /* Unused number */ 8#define NETLINK_UNUSED 1 /* Unused number */
9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ 9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
10#define NETLINK_FIREWALL 3 /* Firewalling hook */ 10#define NETLINK_FIREWALL 3 /* Firewalling hook */
11#define NETLINK_INET_DIAG 4 /* INET socket monitoring */ 11#define NETLINK_SOCK_DIAG 4 /* socket monitoring */
12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ 12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
13#define NETLINK_XFRM 6 /* ipsec */ 13#define NETLINK_XFRM 6 /* ipsec */
14#define NETLINK_SELINUX 7 /* SELinux event notifications */ 14#define NETLINK_SELINUX 7 /* SELinux event notifications */
@@ -27,6 +27,8 @@
27#define NETLINK_RDMA 20 27#define NETLINK_RDMA 20
28#define NETLINK_CRYPTO 21 /* Crypto layer */ 28#define NETLINK_CRYPTO 21 /* Crypto layer */
29 29
30#define NETLINK_INET_DIAG NETLINK_SOCK_DIAG
31
30#define MAX_LINKS 32 32#define MAX_LINKS 32
31 33
32struct sockaddr_nl { 34struct sockaddr_nl {
diff --git a/include/linux/nfc.h b/include/linux/nfc.h
index 36cb955b05cc..01d4e5d60325 100644
--- a/include/linux/nfc.h
+++ b/include/linux/nfc.h
@@ -62,6 +62,8 @@ enum nfc_commands {
62 NFC_CMD_GET_DEVICE, 62 NFC_CMD_GET_DEVICE,
63 NFC_CMD_DEV_UP, 63 NFC_CMD_DEV_UP,
64 NFC_CMD_DEV_DOWN, 64 NFC_CMD_DEV_DOWN,
65 NFC_CMD_DEP_LINK_UP,
66 NFC_CMD_DEP_LINK_DOWN,
65 NFC_CMD_START_POLL, 67 NFC_CMD_START_POLL,
66 NFC_CMD_STOP_POLL, 68 NFC_CMD_STOP_POLL,
67 NFC_CMD_GET_TARGET, 69 NFC_CMD_GET_TARGET,
@@ -86,6 +88,9 @@ enum nfc_commands {
86 * @NFC_ATTR_TARGET_SENS_RES: NFC-A targets extra information such as NFCID 88 * @NFC_ATTR_TARGET_SENS_RES: NFC-A targets extra information such as NFCID
87 * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the 89 * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the
88 * target is not NFC-Forum compliant) 90 * target is not NFC-Forum compliant)
91 * @NFC_ATTR_TARGET_NFCID1: NFC-A targets identifier, max 10 bytes
92 * @NFC_ATTR_COMM_MODE: Passive or active mode
93 * @NFC_ATTR_RF_MODE: Initiator or target
89 */ 94 */
90enum nfc_attrs { 95enum nfc_attrs {
91 NFC_ATTR_UNSPEC, 96 NFC_ATTR_UNSPEC,
@@ -95,6 +100,9 @@ enum nfc_attrs {
95 NFC_ATTR_TARGET_INDEX, 100 NFC_ATTR_TARGET_INDEX,
96 NFC_ATTR_TARGET_SENS_RES, 101 NFC_ATTR_TARGET_SENS_RES,
97 NFC_ATTR_TARGET_SEL_RES, 102 NFC_ATTR_TARGET_SEL_RES,
103 NFC_ATTR_TARGET_NFCID1,
104 NFC_ATTR_COMM_MODE,
105 NFC_ATTR_RF_MODE,
98/* private: internal use only */ 106/* private: internal use only */
99 __NFC_ATTR_AFTER_LAST 107 __NFC_ATTR_AFTER_LAST
100}; 108};
@@ -111,6 +119,14 @@ enum nfc_attrs {
111 119
112#define NFC_PROTO_MAX 6 120#define NFC_PROTO_MAX 6
113 121
122/* NFC communication modes */
123#define NFC_COMM_ACTIVE 0
124#define NFC_COMM_PASSIVE 1
125
126/* NFC RF modes */
127#define NFC_RF_INITIATOR 0
128#define NFC_RF_TARGET 1
129
114/* NFC protocols masks used in bitsets */ 130/* NFC protocols masks used in bitsets */
115#define NFC_PROTO_JEWEL_MASK (1 << NFC_PROTO_JEWEL) 131#define NFC_PROTO_JEWEL_MASK (1 << NFC_PROTO_JEWEL)
116#define NFC_PROTO_MIFARE_MASK (1 << NFC_PROTO_MIFARE) 132#define NFC_PROTO_MIFARE_MASK (1 << NFC_PROTO_MIFARE)
@@ -125,9 +141,22 @@ struct sockaddr_nfc {
125 __u32 nfc_protocol; 141 __u32 nfc_protocol;
126}; 142};
127 143
144#define NFC_LLCP_MAX_SERVICE_NAME 63
145struct sockaddr_nfc_llcp {
146 sa_family_t sa_family;
147 __u32 dev_idx;
148 __u32 target_idx;
149 __u32 nfc_protocol;
150 __u8 dsap; /* Destination SAP, if known */
151 __u8 ssap; /* Source SAP to be bound to */
152 char service_name[NFC_LLCP_MAX_SERVICE_NAME]; /* Service name URI */;
153 size_t service_name_len;
154};
155
128/* NFC socket protocols */ 156/* NFC socket protocols */
129#define NFC_SOCKPROTO_RAW 0 157#define NFC_SOCKPROTO_RAW 0
130#define NFC_SOCKPROTO_MAX 1 158#define NFC_SOCKPROTO_LLCP 1
159#define NFC_SOCKPROTO_MAX 2
131 160
132#define NFC_HEADER_SIZE 1 161#define NFC_HEADER_SIZE 1
133 162
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 92ecf5585fac..8c29950d2fa5 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -373,7 +373,7 @@ extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
373extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 373extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
374extern void put_nfs_open_context(struct nfs_open_context *ctx); 374extern void put_nfs_open_context(struct nfs_open_context *ctx);
375extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode); 375extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode);
376extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred, fmode_t f_mode); 376extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f_mode);
377extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx); 377extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx);
378extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx); 378extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx);
379extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx); 379extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx);
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index b5479df8378d..ba4d7656ecfd 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -153,6 +153,7 @@ struct nfs_server {
153 struct rb_root openowner_id; 153 struct rb_root openowner_id;
154 struct rb_root lockowner_id; 154 struct rb_root lockowner_id;
155#endif 155#endif
156 struct list_head state_owners_lru;
156 struct list_head layouts; 157 struct list_head layouts;
157 struct list_head delegations; 158 struct list_head delegations;
158 void (*destroy)(struct nfs_server *); 159 void (*destroy)(struct nfs_server *);
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
index ae7d6a380dae..308c18877018 100644
--- a/include/linux/nfs_idmap.h
+++ b/include/linux/nfs_idmap.h
@@ -66,6 +66,8 @@ struct idmap_msg {
66/* Forward declaration to make this header independent of others */ 66/* Forward declaration to make this header independent of others */
67struct nfs_client; 67struct nfs_client;
68struct nfs_server; 68struct nfs_server;
69struct nfs_fattr;
70struct nfs4_string;
69 71
70#ifdef CONFIG_NFS_USE_NEW_IDMAPPER 72#ifdef CONFIG_NFS_USE_NEW_IDMAPPER
71 73
@@ -97,6 +99,12 @@ void nfs_idmap_delete(struct nfs_client *);
97 99
98#endif /* CONFIG_NFS_USE_NEW_IDMAPPER */ 100#endif /* CONFIG_NFS_USE_NEW_IDMAPPER */
99 101
102void nfs_fattr_init_names(struct nfs_fattr *fattr,
103 struct nfs4_string *owner_name,
104 struct nfs4_string *group_name);
105void nfs_fattr_free_names(struct nfs_fattr *);
106void nfs_fattr_map_and_free_names(struct nfs_server *, struct nfs_fattr *);
107
100int nfs_map_name_to_uid(const struct nfs_server *, const char *, size_t, __u32 *); 108int nfs_map_name_to_uid(const struct nfs_server *, const char *, size_t, __u32 *);
101int nfs_map_group_to_gid(const struct nfs_server *, const char *, size_t, __u32 *); 109int nfs_map_group_to_gid(const struct nfs_server *, const char *, size_t, __u32 *);
102int nfs_map_uid_to_name(const struct nfs_server *, __u32, char *, size_t); 110int nfs_map_uid_to_name(const struct nfs_server *, __u32, char *, size_t);
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 2a7c533be5dd..d6ba9a12591e 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -18,6 +18,11 @@
18/* Forward declaration for NFS v3 */ 18/* Forward declaration for NFS v3 */
19struct nfs4_secinfo_flavors; 19struct nfs4_secinfo_flavors;
20 20
21struct nfs4_string {
22 unsigned int len;
23 char *data;
24};
25
21struct nfs_fsid { 26struct nfs_fsid {
22 uint64_t major; 27 uint64_t major;
23 uint64_t minor; 28 uint64_t minor;
@@ -61,6 +66,8 @@ struct nfs_fattr {
61 struct timespec pre_ctime; /* pre_op_attr.ctime */ 66 struct timespec pre_ctime; /* pre_op_attr.ctime */
62 unsigned long time_start; 67 unsigned long time_start;
63 unsigned long gencount; 68 unsigned long gencount;
69 struct nfs4_string *owner_name;
70 struct nfs4_string *group_name;
64}; 71};
65 72
66#define NFS_ATTR_FATTR_TYPE (1U << 0) 73#define NFS_ATTR_FATTR_TYPE (1U << 0)
@@ -85,6 +92,8 @@ struct nfs_fattr {
85#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */ 92#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */
86#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */ 93#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */
87#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 21) 94#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 21)
95#define NFS_ATTR_FATTR_OWNER_NAME (1U << 22)
96#define NFS_ATTR_FATTR_GROUP_NAME (1U << 23)
88 97
89#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ 98#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
90 | NFS_ATTR_FATTR_MODE \ 99 | NFS_ATTR_FATTR_MODE \
@@ -324,6 +333,7 @@ struct nfs_openargs {
324 const struct qstr * name; 333 const struct qstr * name;
325 const struct nfs_server *server; /* Needed for ID mapping */ 334 const struct nfs_server *server; /* Needed for ID mapping */
326 const u32 * bitmask; 335 const u32 * bitmask;
336 const u32 * dir_bitmask;
327 __u32 claim; 337 __u32 claim;
328 struct nfs4_sequence_args seq_args; 338 struct nfs4_sequence_args seq_args;
329}; 339};
@@ -342,6 +352,8 @@ struct nfs_openres {
342 __u32 do_recall; 352 __u32 do_recall;
343 __u64 maxsize; 353 __u64 maxsize;
344 __u32 attrset[NFS4_BITMAP_SIZE]; 354 __u32 attrset[NFS4_BITMAP_SIZE];
355 struct nfs4_string *owner;
356 struct nfs4_string *group_owner;
345 struct nfs4_sequence_res seq_res; 357 struct nfs4_sequence_res seq_res;
346}; 358};
347 359
@@ -605,8 +617,13 @@ struct nfs_getaclargs {
605 struct nfs4_sequence_args seq_args; 617 struct nfs4_sequence_args seq_args;
606}; 618};
607 619
620/* getxattr ACL interface flags */
621#define NFS4_ACL_LEN_REQUEST 0x0001 /* zero length getxattr buffer */
608struct nfs_getaclres { 622struct nfs_getaclres {
609 size_t acl_len; 623 size_t acl_len;
624 size_t acl_data_offset;
625 int acl_flags;
626 struct page * acl_scratch;
610 struct nfs4_sequence_res seq_res; 627 struct nfs4_sequence_res seq_res;
611}; 628};
612 629
@@ -773,11 +790,6 @@ struct nfs3_getaclres {
773 struct posix_acl * acl_default; 790 struct posix_acl * acl_default;
774}; 791};
775 792
776struct nfs4_string {
777 unsigned int len;
778 char *data;
779};
780
781#ifdef CONFIG_NFS_V4 793#ifdef CONFIG_NFS_V4
782 794
783typedef u64 clientid4; 795typedef u64 clientid4;
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 8049bf77d799..0f5ff3739820 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -509,6 +509,38 @@
509 * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup). 509 * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup).
510 * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame. 510 * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame.
511 * 511 *
512 * @NL80211_CMD_UNEXPECTED_FRAME: Used by an application controlling an AP
513 * (or GO) interface (i.e. hostapd) to ask for unexpected frames to
514 * implement sending deauth to stations that send unexpected class 3
515 * frames. Also used as the event sent by the kernel when such a frame
516 * is received.
517 * For the event, the %NL80211_ATTR_MAC attribute carries the TA and
518 * other attributes like the interface index are present.
519 * If used as the command it must have an interface index and you can
520 * only unsubscribe from the event by closing the socket. Subscription
521 * is also for %NL80211_CMD_UNEXPECTED_4ADDR_FRAME events.
522 *
523 * @NL80211_CMD_UNEXPECTED_4ADDR_FRAME: Sent as an event indicating that the
524 * associated station identified by %NL80211_ATTR_MAC sent a 4addr frame
525 * and wasn't already in a 4-addr VLAN. The event will be sent similarly
526 * to the %NL80211_CMD_UNEXPECTED_FRAME event, to the same listener.
527 *
528 * @NL80211_CMD_PROBE_CLIENT: Probe an associated station on an AP interface
529 * by sending a null data frame to it and reporting when the frame is
530 * acknowleged. This is used to allow timing out inactive clients. Uses
531 * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_MAC. The command returns a
532 * direct reply with an %NL80211_ATTR_COOKIE that is later used to match
533 * up the event with the request. The event includes the same data and
534 * has %NL80211_ATTR_ACK set if the frame was ACKed.
535 *
536 * @NL80211_CMD_REGISTER_BEACONS: Register this socket to receive beacons from
537 * other BSSes when any interfaces are in AP mode. This helps implement
538 * OLBC handling in hostapd. Beacons are reported in %NL80211_CMD_FRAME
539 * messages. Note that per PHY only one application may register.
540 *
541 * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether
542 * No Acknowledgement Policy should be applied.
543 *
512 * @NL80211_CMD_MAX: highest used command number 544 * @NL80211_CMD_MAX: highest used command number
513 * @__NL80211_CMD_AFTER_LAST: internal use 545 * @__NL80211_CMD_AFTER_LAST: internal use
514 */ 546 */
@@ -638,6 +670,16 @@ enum nl80211_commands {
638 NL80211_CMD_TDLS_OPER, 670 NL80211_CMD_TDLS_OPER,
639 NL80211_CMD_TDLS_MGMT, 671 NL80211_CMD_TDLS_MGMT,
640 672
673 NL80211_CMD_UNEXPECTED_FRAME,
674
675 NL80211_CMD_PROBE_CLIENT,
676
677 NL80211_CMD_REGISTER_BEACONS,
678
679 NL80211_CMD_UNEXPECTED_4ADDR_FRAME,
680
681 NL80211_CMD_SET_NOACK_MAP,
682
641 /* add new commands above here */ 683 /* add new commands above here */
642 684
643 /* used to define NL80211_CMD_MAX below */ 685 /* used to define NL80211_CMD_MAX below */
@@ -658,6 +700,8 @@ enum nl80211_commands {
658#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE 700#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE
659#define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT 701#define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT
660 702
703#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
704
661/* source-level API compatibility */ 705/* source-level API compatibility */
662#define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG 706#define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG
663#define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG 707#define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG
@@ -1109,6 +1153,46 @@ enum nl80211_commands {
1109 * %NL80211_CMD_TDLS_MGMT. Otherwise %NL80211_CMD_TDLS_OPER should be 1153 * %NL80211_CMD_TDLS_MGMT. Otherwise %NL80211_CMD_TDLS_OPER should be
1110 * used for asking the driver to perform a TDLS operation. 1154 * used for asking the driver to perform a TDLS operation.
1111 * 1155 *
1156 * @NL80211_ATTR_DEVICE_AP_SME: This u32 attribute may be listed for devices
1157 * that have AP support to indicate that they have the AP SME integrated
1158 * with support for the features listed in this attribute, see
1159 * &enum nl80211_ap_sme_features.
1160 *
1161 * @NL80211_ATTR_DONT_WAIT_FOR_ACK: Used with %NL80211_CMD_FRAME, this tells
1162 * the driver to not wait for an acknowledgement. Note that due to this,
1163 * it will also not give a status callback nor return a cookie. This is
1164 * mostly useful for probe responses to save airtime.
1165 *
1166 * @NL80211_ATTR_FEATURE_FLAGS: This u32 attribute contains flags from
1167 * &enum nl80211_feature_flags and is advertised in wiphy information.
1168 * @NL80211_ATTR_PROBE_RESP_OFFLOAD: Indicates that the HW responds to probe
1169 *
1170 * requests while operating in AP-mode.
1171 * This attribute holds a bitmap of the supported protocols for
1172 * offloading (see &enum nl80211_probe_resp_offload_support_attr).
1173 *
1174 * @NL80211_ATTR_PROBE_RESP: Probe Response template data. Contains the entire
1175 * probe-response frame. The DA field in the 802.11 header is zero-ed out,
1176 * to be filled by the FW.
1177 * @NL80211_ATTR_DISABLE_HT: Force HT capable interfaces to disable
1178 * this feature. Currently, only supported in mac80211 drivers.
1179 * @NL80211_ATTR_HT_CAPABILITY_MASK: Specify which bits of the
1180 * ATTR_HT_CAPABILITY to which attention should be paid.
1181 * Currently, only mac80211 NICs support this feature.
1182 * The values that may be configured are:
1183 * MCS rates, MAX-AMSDU, HT-20-40 and HT_CAP_SGI_40
1184 * AMPDU density and AMPDU factor.
1185 * All values are treated as suggestions and may be ignored
1186 * by the driver as required. The actual values may be seen in
1187 * the station debugfs ht_caps file.
1188 *
1189 * @NL80211_ATTR_DFS_REGION: region for regulatory rules which this country
1190 * abides to when initiating radiation on DFS channels. A country maps
1191 * to one DFS region.
1192 *
1193 * @NL80211_ATTR_NOACK_MAP: This u16 bitmap contains the No Ack Policy of
1194 * up to 16 TIDs.
1195 *
1112 * @NL80211_ATTR_MAX: highest attribute number currently defined 1196 * @NL80211_ATTR_MAX: highest attribute number currently defined
1113 * @__NL80211_ATTR_AFTER_LAST: internal use 1197 * @__NL80211_ATTR_AFTER_LAST: internal use
1114 */ 1198 */
@@ -1337,6 +1421,23 @@ enum nl80211_attrs {
1337 NL80211_ATTR_TDLS_SUPPORT, 1421 NL80211_ATTR_TDLS_SUPPORT,
1338 NL80211_ATTR_TDLS_EXTERNAL_SETUP, 1422 NL80211_ATTR_TDLS_EXTERNAL_SETUP,
1339 1423
1424 NL80211_ATTR_DEVICE_AP_SME,
1425
1426 NL80211_ATTR_DONT_WAIT_FOR_ACK,
1427
1428 NL80211_ATTR_FEATURE_FLAGS,
1429
1430 NL80211_ATTR_PROBE_RESP_OFFLOAD,
1431
1432 NL80211_ATTR_PROBE_RESP,
1433
1434 NL80211_ATTR_DFS_REGION,
1435
1436 NL80211_ATTR_DISABLE_HT,
1437 NL80211_ATTR_HT_CAPABILITY_MASK,
1438
1439 NL80211_ATTR_NOACK_MAP,
1440
1340 /* add attributes here, update the policy in nl80211.c */ 1441 /* add attributes here, update the policy in nl80211.c */
1341 1442
1342 __NL80211_ATTR_AFTER_LAST, 1443 __NL80211_ATTR_AFTER_LAST,
@@ -1371,6 +1472,7 @@ enum nl80211_attrs {
1371#define NL80211_ATTR_AKM_SUITES NL80211_ATTR_AKM_SUITES 1472#define NL80211_ATTR_AKM_SUITES NL80211_ATTR_AKM_SUITES
1372#define NL80211_ATTR_KEY NL80211_ATTR_KEY 1473#define NL80211_ATTR_KEY NL80211_ATTR_KEY
1373#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS 1474#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS
1475#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
1374 1476
1375#define NL80211_MAX_SUPP_RATES 32 1477#define NL80211_MAX_SUPP_RATES 32
1376#define NL80211_MAX_SUPP_REG_RULES 32 1478#define NL80211_MAX_SUPP_REG_RULES 32
@@ -1434,7 +1536,11 @@ enum nl80211_iftype {
1434 * @NL80211_STA_FLAG_WME: station is WME/QoS capable 1536 * @NL80211_STA_FLAG_WME: station is WME/QoS capable
1435 * @NL80211_STA_FLAG_MFP: station uses management frame protection 1537 * @NL80211_STA_FLAG_MFP: station uses management frame protection
1436 * @NL80211_STA_FLAG_AUTHENTICATED: station is authenticated 1538 * @NL80211_STA_FLAG_AUTHENTICATED: station is authenticated
1437 * @NL80211_STA_FLAG_TDLS_PEER: station is a TDLS peer 1539 * @NL80211_STA_FLAG_TDLS_PEER: station is a TDLS peer -- this flag should
1540 * only be used in managed mode (even in the flags mask). Note that the
1541 * flag can't be changed, it is only valid while adding a station, and
1542 * attempts to change it will silently be ignored (rather than rejected
1543 * as errors.)
1438 * @NL80211_STA_FLAG_MAX: highest station flag number currently defined 1544 * @NL80211_STA_FLAG_MAX: highest station flag number currently defined
1439 * @__NL80211_STA_FLAG_AFTER_LAST: internal use 1545 * @__NL80211_STA_FLAG_AFTER_LAST: internal use
1440 */ 1546 */
@@ -1549,6 +1655,7 @@ enum nl80211_sta_bss_param {
1549 * containing info as possible, see &enum nl80211_sta_bss_param 1655 * containing info as possible, see &enum nl80211_sta_bss_param
1550 * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected 1656 * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected
1551 * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update. 1657 * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update.
1658 * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32)
1552 * @__NL80211_STA_INFO_AFTER_LAST: internal 1659 * @__NL80211_STA_INFO_AFTER_LAST: internal
1553 * @NL80211_STA_INFO_MAX: highest possible station info attribute 1660 * @NL80211_STA_INFO_MAX: highest possible station info attribute
1554 */ 1661 */
@@ -1571,6 +1678,7 @@ enum nl80211_sta_info {
1571 NL80211_STA_INFO_BSS_PARAM, 1678 NL80211_STA_INFO_BSS_PARAM,
1572 NL80211_STA_INFO_CONNECTED_TIME, 1679 NL80211_STA_INFO_CONNECTED_TIME,
1573 NL80211_STA_INFO_STA_FLAGS, 1680 NL80211_STA_INFO_STA_FLAGS,
1681 NL80211_STA_INFO_BEACON_LOSS,
1574 1682
1575 /* keep last */ 1683 /* keep last */
1576 __NL80211_STA_INFO_AFTER_LAST, 1684 __NL80211_STA_INFO_AFTER_LAST,
@@ -1845,6 +1953,21 @@ enum nl80211_reg_rule_flags {
1845}; 1953};
1846 1954
1847/** 1955/**
1956 * enum nl80211_dfs_regions - regulatory DFS regions
1957 *
1958 * @NL80211_DFS_UNSET: Country has no DFS master region specified
1959 * @NL80211_DFS_FCC_: Country follows DFS master rules from FCC
1960 * @NL80211_DFS_FCC_: Country follows DFS master rules from ETSI
1961 * @NL80211_DFS_JP_: Country follows DFS master rules from JP/MKK/Telec
1962 */
1963enum nl80211_dfs_regions {
1964 NL80211_DFS_UNSET = 0,
1965 NL80211_DFS_FCC = 1,
1966 NL80211_DFS_ETSI = 2,
1967 NL80211_DFS_JP = 3,
1968};
1969
1970/**
1848 * enum nl80211_survey_info - survey information 1971 * enum nl80211_survey_info - survey information
1849 * 1972 *
1850 * These attribute types are used with %NL80211_ATTR_SURVEY_INFO 1973 * These attribute types are used with %NL80211_ATTR_SURVEY_INFO
@@ -1977,6 +2100,10 @@ enum nl80211_mntr_flags {
1977 * access to a broader network beyond the MBSS. This is done via Root 2100 * access to a broader network beyond the MBSS. This is done via Root
1978 * Announcement frames. 2101 * Announcement frames.
1979 * 2102 *
2103 * @NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL: The minimum interval of time (in
2104 * TUs) during which a mesh STA can send only one Action frame containing a
2105 * PERR element.
2106 *
1980 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute 2107 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
1981 * 2108 *
1982 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use 2109 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
@@ -2000,6 +2127,7 @@ enum nl80211_meshconf_params {
2000 NL80211_MESHCONF_ELEMENT_TTL, 2127 NL80211_MESHCONF_ELEMENT_TTL,
2001 NL80211_MESHCONF_HWMP_RANN_INTERVAL, 2128 NL80211_MESHCONF_HWMP_RANN_INTERVAL,
2002 NL80211_MESHCONF_GATE_ANNOUNCEMENTS, 2129 NL80211_MESHCONF_GATE_ANNOUNCEMENTS,
2130 NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL,
2003 2131
2004 /* keep last */ 2132 /* keep last */
2005 __NL80211_MESHCONF_ATTR_AFTER_LAST, 2133 __NL80211_MESHCONF_ATTR_AFTER_LAST,
@@ -2650,4 +2778,45 @@ enum nl80211_tdls_operation {
2650 NL80211_TDLS_DISABLE_LINK, 2778 NL80211_TDLS_DISABLE_LINK,
2651}; 2779};
2652 2780
2781/*
2782 * enum nl80211_ap_sme_features - device-integrated AP features
2783 * Reserved for future use, no bits are defined in
2784 * NL80211_ATTR_DEVICE_AP_SME yet.
2785enum nl80211_ap_sme_features {
2786};
2787 */
2788
2789/**
2790 * enum nl80211_feature_flags - device/driver features
2791 * @NL80211_FEATURE_SK_TX_STATUS: This driver supports reflecting back
2792 * TX status to the socket error queue when requested with the
2793 * socket option.
2794 * @NL80211_FEATURE_HT_IBSS: This driver supports IBSS with HT datarates.
2795 */
2796enum nl80211_feature_flags {
2797 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
2798 NL80211_FEATURE_HT_IBSS = 1 << 1,
2799};
2800
2801/**
2802 * enum nl80211_probe_resp_offload_support_attr - optional supported
2803 * protocols for probe-response offloading by the driver/FW.
2804 * To be used with the %NL80211_ATTR_PROBE_RESP_OFFLOAD attribute.
2805 * Each enum value represents a bit in the bitmap of supported
2806 * protocols. Typically a subset of probe-requests belonging to a
2807 * supported protocol will be excluded from offload and uploaded
2808 * to the host.
2809 *
2810 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS: Support for WPS ver. 1
2811 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2: Support for WPS ver. 2
2812 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P: Support for P2P
2813 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U: Support for 802.11u
2814 */
2815enum nl80211_probe_resp_offload_support_attr {
2816 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS = 1<<0,
2817 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 = 1<<1,
2818 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P = 1<<2,
2819 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U = 1<<3,
2820};
2821
2653#endif /* __LINUX_NL80211_H */ 2822#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nls.h b/include/linux/nls.h
index d47beef08dfd..5dc635f8d79e 100644
--- a/include/linux/nls.h
+++ b/include/linux/nls.h
@@ -43,7 +43,7 @@ enum utf16_endian {
43 UTF16_BIG_ENDIAN 43 UTF16_BIG_ENDIAN
44}; 44};
45 45
46/* nls.c */ 46/* nls_base.c */
47extern int register_nls(struct nls_table *); 47extern int register_nls(struct nls_table *);
48extern int unregister_nls(struct nls_table *); 48extern int unregister_nls(struct nls_table *);
49extern struct nls_table *load_nls(char *); 49extern struct nls_table *load_nls(char *);
@@ -52,7 +52,8 @@ extern struct nls_table *load_nls_default(void);
52 52
53extern int utf8_to_utf32(const u8 *s, int len, unicode_t *pu); 53extern int utf8_to_utf32(const u8 *s, int len, unicode_t *pu);
54extern int utf32_to_utf8(unicode_t u, u8 *s, int maxlen); 54extern int utf32_to_utf8(unicode_t u, u8 *s, int maxlen);
55extern int utf8s_to_utf16s(const u8 *s, int len, wchar_t *pwcs); 55extern int utf8s_to_utf16s(const u8 *s, int len,
56 enum utf16_endian endian, wchar_t *pwcs, int maxlen);
56extern int utf16s_to_utf8s(const wchar_t *pwcs, int len, 57extern int utf16s_to_utf8s(const wchar_t *pwcs, int len,
57 enum utf16_endian endian, u8 *s, int maxlen); 58 enum utf16_endian endian, u8 *s, int maxlen);
58 59
diff --git a/include/linux/node.h b/include/linux/node.h
index 92370e22343c..624e53cecc02 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -14,12 +14,12 @@
14#ifndef _LINUX_NODE_H_ 14#ifndef _LINUX_NODE_H_
15#define _LINUX_NODE_H_ 15#define _LINUX_NODE_H_
16 16
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/cpumask.h> 18#include <linux/cpumask.h>
19#include <linux/workqueue.h> 19#include <linux/workqueue.h>
20 20
21struct node { 21struct node {
22 struct sys_device sysdev; 22 struct device dev;
23 23
24#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS) 24#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
25 struct work_struct node_work; 25 struct work_struct node_work;
@@ -80,6 +80,6 @@ static inline void register_hugetlbfs_with_node(node_registration_func_t reg,
80} 80}
81#endif 81#endif
82 82
83#define to_node(sys_device) container_of(sys_device, struct node, sysdev) 83#define to_node(device) container_of(device, struct node, dev)
84 84
85#endif /* _LINUX_NODE_H_ */ 85#endif /* _LINUX_NODE_H_ */
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
new file mode 100644
index 000000000000..9490a00529f4
--- /dev/null
+++ b/include/linux/nvme.h
@@ -0,0 +1,434 @@
1/*
2 * Definitions for the NVM Express interface
3 * Copyright (c) 2011, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#ifndef _LINUX_NVME_H
20#define _LINUX_NVME_H
21
22#include <linux/types.h>
23
24struct nvme_bar {
25 __u64 cap; /* Controller Capabilities */
26 __u32 vs; /* Version */
27 __u32 intms; /* Interrupt Mask Set */
28 __u32 intmc; /* Interrupt Mask Clear */
29 __u32 cc; /* Controller Configuration */
30 __u32 rsvd1; /* Reserved */
31 __u32 csts; /* Controller Status */
32 __u32 rsvd2; /* Reserved */
33 __u32 aqa; /* Admin Queue Attributes */
34 __u64 asq; /* Admin SQ Base Address */
35 __u64 acq; /* Admin CQ Base Address */
36};
37
38#define NVME_CAP_TIMEOUT(cap) (((cap) >> 24) & 0xff)
39#define NVME_CAP_STRIDE(cap) (((cap) >> 32) & 0xf)
40
41enum {
42 NVME_CC_ENABLE = 1 << 0,
43 NVME_CC_CSS_NVM = 0 << 4,
44 NVME_CC_MPS_SHIFT = 7,
45 NVME_CC_ARB_RR = 0 << 11,
46 NVME_CC_ARB_WRRU = 1 << 11,
47 NVME_CC_ARB_VS = 7 << 11,
48 NVME_CC_SHN_NONE = 0 << 14,
49 NVME_CC_SHN_NORMAL = 1 << 14,
50 NVME_CC_SHN_ABRUPT = 2 << 14,
51 NVME_CC_IOSQES = 6 << 16,
52 NVME_CC_IOCQES = 4 << 20,
53 NVME_CSTS_RDY = 1 << 0,
54 NVME_CSTS_CFS = 1 << 1,
55 NVME_CSTS_SHST_NORMAL = 0 << 2,
56 NVME_CSTS_SHST_OCCUR = 1 << 2,
57 NVME_CSTS_SHST_CMPLT = 2 << 2,
58};
59
60struct nvme_id_power_state {
61 __le16 max_power; /* centiwatts */
62 __u16 rsvd2;
63 __le32 entry_lat; /* microseconds */
64 __le32 exit_lat; /* microseconds */
65 __u8 read_tput;
66 __u8 read_lat;
67 __u8 write_tput;
68 __u8 write_lat;
69 __u8 rsvd16[16];
70};
71
72#define NVME_VS(major, minor) (major << 16 | minor)
73
74struct nvme_id_ctrl {
75 __le16 vid;
76 __le16 ssvid;
77 char sn[20];
78 char mn[40];
79 char fr[8];
80 __u8 rab;
81 __u8 ieee[3];
82 __u8 mic;
83 __u8 mdts;
84 __u8 rsvd78[178];
85 __le16 oacs;
86 __u8 acl;
87 __u8 aerl;
88 __u8 frmw;
89 __u8 lpa;
90 __u8 elpe;
91 __u8 npss;
92 __u8 rsvd264[248];
93 __u8 sqes;
94 __u8 cqes;
95 __u8 rsvd514[2];
96 __le32 nn;
97 __le16 oncs;
98 __le16 fuses;
99 __u8 fna;
100 __u8 vwc;
101 __le16 awun;
102 __le16 awupf;
103 __u8 rsvd530[1518];
104 struct nvme_id_power_state psd[32];
105 __u8 vs[1024];
106};
107
108struct nvme_lbaf {
109 __le16 ms;
110 __u8 ds;
111 __u8 rp;
112};
113
114struct nvme_id_ns {
115 __le64 nsze;
116 __le64 ncap;
117 __le64 nuse;
118 __u8 nsfeat;
119 __u8 nlbaf;
120 __u8 flbas;
121 __u8 mc;
122 __u8 dpc;
123 __u8 dps;
124 __u8 rsvd30[98];
125 struct nvme_lbaf lbaf[16];
126 __u8 rsvd192[192];
127 __u8 vs[3712];
128};
129
130enum {
131 NVME_NS_FEAT_THIN = 1 << 0,
132 NVME_LBAF_RP_BEST = 0,
133 NVME_LBAF_RP_BETTER = 1,
134 NVME_LBAF_RP_GOOD = 2,
135 NVME_LBAF_RP_DEGRADED = 3,
136};
137
138struct nvme_lba_range_type {
139 __u8 type;
140 __u8 attributes;
141 __u8 rsvd2[14];
142 __u64 slba;
143 __u64 nlb;
144 __u8 guid[16];
145 __u8 rsvd48[16];
146};
147
148enum {
149 NVME_LBART_TYPE_FS = 0x01,
150 NVME_LBART_TYPE_RAID = 0x02,
151 NVME_LBART_TYPE_CACHE = 0x03,
152 NVME_LBART_TYPE_SWAP = 0x04,
153
154 NVME_LBART_ATTRIB_TEMP = 1 << 0,
155 NVME_LBART_ATTRIB_HIDE = 1 << 1,
156};
157
158/* I/O commands */
159
160enum nvme_opcode {
161 nvme_cmd_flush = 0x00,
162 nvme_cmd_write = 0x01,
163 nvme_cmd_read = 0x02,
164 nvme_cmd_write_uncor = 0x04,
165 nvme_cmd_compare = 0x05,
166 nvme_cmd_dsm = 0x09,
167};
168
169struct nvme_common_command {
170 __u8 opcode;
171 __u8 flags;
172 __u16 command_id;
173 __le32 nsid;
174 __u32 cdw2[2];
175 __le64 metadata;
176 __le64 prp1;
177 __le64 prp2;
178 __u32 cdw10[6];
179};
180
181struct nvme_rw_command {
182 __u8 opcode;
183 __u8 flags;
184 __u16 command_id;
185 __le32 nsid;
186 __u64 rsvd2;
187 __le64 metadata;
188 __le64 prp1;
189 __le64 prp2;
190 __le64 slba;
191 __le16 length;
192 __le16 control;
193 __le32 dsmgmt;
194 __le32 reftag;
195 __le16 apptag;
196 __le16 appmask;
197};
198
199enum {
200 NVME_RW_LR = 1 << 15,
201 NVME_RW_FUA = 1 << 14,
202 NVME_RW_DSM_FREQ_UNSPEC = 0,
203 NVME_RW_DSM_FREQ_TYPICAL = 1,
204 NVME_RW_DSM_FREQ_RARE = 2,
205 NVME_RW_DSM_FREQ_READS = 3,
206 NVME_RW_DSM_FREQ_WRITES = 4,
207 NVME_RW_DSM_FREQ_RW = 5,
208 NVME_RW_DSM_FREQ_ONCE = 6,
209 NVME_RW_DSM_FREQ_PREFETCH = 7,
210 NVME_RW_DSM_FREQ_TEMP = 8,
211 NVME_RW_DSM_LATENCY_NONE = 0 << 4,
212 NVME_RW_DSM_LATENCY_IDLE = 1 << 4,
213 NVME_RW_DSM_LATENCY_NORM = 2 << 4,
214 NVME_RW_DSM_LATENCY_LOW = 3 << 4,
215 NVME_RW_DSM_SEQ_REQ = 1 << 6,
216 NVME_RW_DSM_COMPRESSED = 1 << 7,
217};
218
219/* Admin commands */
220
221enum nvme_admin_opcode {
222 nvme_admin_delete_sq = 0x00,
223 nvme_admin_create_sq = 0x01,
224 nvme_admin_get_log_page = 0x02,
225 nvme_admin_delete_cq = 0x04,
226 nvme_admin_create_cq = 0x05,
227 nvme_admin_identify = 0x06,
228 nvme_admin_abort_cmd = 0x08,
229 nvme_admin_set_features = 0x09,
230 nvme_admin_get_features = 0x0a,
231 nvme_admin_async_event = 0x0c,
232 nvme_admin_activate_fw = 0x10,
233 nvme_admin_download_fw = 0x11,
234 nvme_admin_format_nvm = 0x80,
235 nvme_admin_security_send = 0x81,
236 nvme_admin_security_recv = 0x82,
237};
238
239enum {
240 NVME_QUEUE_PHYS_CONTIG = (1 << 0),
241 NVME_CQ_IRQ_ENABLED = (1 << 1),
242 NVME_SQ_PRIO_URGENT = (0 << 1),
243 NVME_SQ_PRIO_HIGH = (1 << 1),
244 NVME_SQ_PRIO_MEDIUM = (2 << 1),
245 NVME_SQ_PRIO_LOW = (3 << 1),
246 NVME_FEAT_ARBITRATION = 0x01,
247 NVME_FEAT_POWER_MGMT = 0x02,
248 NVME_FEAT_LBA_RANGE = 0x03,
249 NVME_FEAT_TEMP_THRESH = 0x04,
250 NVME_FEAT_ERR_RECOVERY = 0x05,
251 NVME_FEAT_VOLATILE_WC = 0x06,
252 NVME_FEAT_NUM_QUEUES = 0x07,
253 NVME_FEAT_IRQ_COALESCE = 0x08,
254 NVME_FEAT_IRQ_CONFIG = 0x09,
255 NVME_FEAT_WRITE_ATOMIC = 0x0a,
256 NVME_FEAT_ASYNC_EVENT = 0x0b,
257 NVME_FEAT_SW_PROGRESS = 0x0c,
258};
259
260struct nvme_identify {
261 __u8 opcode;
262 __u8 flags;
263 __u16 command_id;
264 __le32 nsid;
265 __u64 rsvd2[2];
266 __le64 prp1;
267 __le64 prp2;
268 __le32 cns;
269 __u32 rsvd11[5];
270};
271
272struct nvme_features {
273 __u8 opcode;
274 __u8 flags;
275 __u16 command_id;
276 __le32 nsid;
277 __u64 rsvd2[2];
278 __le64 prp1;
279 __le64 prp2;
280 __le32 fid;
281 __le32 dword11;
282 __u32 rsvd12[4];
283};
284
285struct nvme_create_cq {
286 __u8 opcode;
287 __u8 flags;
288 __u16 command_id;
289 __u32 rsvd1[5];
290 __le64 prp1;
291 __u64 rsvd8;
292 __le16 cqid;
293 __le16 qsize;
294 __le16 cq_flags;
295 __le16 irq_vector;
296 __u32 rsvd12[4];
297};
298
299struct nvme_create_sq {
300 __u8 opcode;
301 __u8 flags;
302 __u16 command_id;
303 __u32 rsvd1[5];
304 __le64 prp1;
305 __u64 rsvd8;
306 __le16 sqid;
307 __le16 qsize;
308 __le16 sq_flags;
309 __le16 cqid;
310 __u32 rsvd12[4];
311};
312
313struct nvme_delete_queue {
314 __u8 opcode;
315 __u8 flags;
316 __u16 command_id;
317 __u32 rsvd1[9];
318 __le16 qid;
319 __u16 rsvd10;
320 __u32 rsvd11[5];
321};
322
323struct nvme_download_firmware {
324 __u8 opcode;
325 __u8 flags;
326 __u16 command_id;
327 __u32 rsvd1[5];
328 __le64 prp1;
329 __le64 prp2;
330 __le32 numd;
331 __le32 offset;
332 __u32 rsvd12[4];
333};
334
335struct nvme_command {
336 union {
337 struct nvme_common_command common;
338 struct nvme_rw_command rw;
339 struct nvme_identify identify;
340 struct nvme_features features;
341 struct nvme_create_cq create_cq;
342 struct nvme_create_sq create_sq;
343 struct nvme_delete_queue delete_queue;
344 struct nvme_download_firmware dlfw;
345 };
346};
347
348enum {
349 NVME_SC_SUCCESS = 0x0,
350 NVME_SC_INVALID_OPCODE = 0x1,
351 NVME_SC_INVALID_FIELD = 0x2,
352 NVME_SC_CMDID_CONFLICT = 0x3,
353 NVME_SC_DATA_XFER_ERROR = 0x4,
354 NVME_SC_POWER_LOSS = 0x5,
355 NVME_SC_INTERNAL = 0x6,
356 NVME_SC_ABORT_REQ = 0x7,
357 NVME_SC_ABORT_QUEUE = 0x8,
358 NVME_SC_FUSED_FAIL = 0x9,
359 NVME_SC_FUSED_MISSING = 0xa,
360 NVME_SC_INVALID_NS = 0xb,
361 NVME_SC_LBA_RANGE = 0x80,
362 NVME_SC_CAP_EXCEEDED = 0x81,
363 NVME_SC_NS_NOT_READY = 0x82,
364 NVME_SC_CQ_INVALID = 0x100,
365 NVME_SC_QID_INVALID = 0x101,
366 NVME_SC_QUEUE_SIZE = 0x102,
367 NVME_SC_ABORT_LIMIT = 0x103,
368 NVME_SC_ABORT_MISSING = 0x104,
369 NVME_SC_ASYNC_LIMIT = 0x105,
370 NVME_SC_FIRMWARE_SLOT = 0x106,
371 NVME_SC_FIRMWARE_IMAGE = 0x107,
372 NVME_SC_INVALID_VECTOR = 0x108,
373 NVME_SC_INVALID_LOG_PAGE = 0x109,
374 NVME_SC_INVALID_FORMAT = 0x10a,
375 NVME_SC_BAD_ATTRIBUTES = 0x180,
376 NVME_SC_WRITE_FAULT = 0x280,
377 NVME_SC_READ_ERROR = 0x281,
378 NVME_SC_GUARD_CHECK = 0x282,
379 NVME_SC_APPTAG_CHECK = 0x283,
380 NVME_SC_REFTAG_CHECK = 0x284,
381 NVME_SC_COMPARE_FAILED = 0x285,
382 NVME_SC_ACCESS_DENIED = 0x286,
383};
384
385struct nvme_completion {
386 __le32 result; /* Used by admin commands to return data */
387 __u32 rsvd;
388 __le16 sq_head; /* how much of this queue may be reclaimed */
389 __le16 sq_id; /* submission queue that generated this entry */
390 __u16 command_id; /* of the command which completed */
391 __le16 status; /* did the command fail, and if so, why? */
392};
393
394struct nvme_user_io {
395 __u8 opcode;
396 __u8 flags;
397 __u16 control;
398 __u16 nblocks;
399 __u16 rsvd;
400 __u64 metadata;
401 __u64 addr;
402 __u64 slba;
403 __u32 dsmgmt;
404 __u32 reftag;
405 __u16 apptag;
406 __u16 appmask;
407};
408
409struct nvme_admin_cmd {
410 __u8 opcode;
411 __u8 flags;
412 __u16 rsvd1;
413 __u32 nsid;
414 __u32 cdw2;
415 __u32 cdw3;
416 __u64 metadata;
417 __u64 addr;
418 __u32 metadata_len;
419 __u32 data_len;
420 __u32 cdw10;
421 __u32 cdw11;
422 __u32 cdw12;
423 __u32 cdw13;
424 __u32 cdw14;
425 __u32 cdw15;
426 __u32 timeout_ms;
427 __u32 result;
428};
429
430#define NVME_IOCTL_ID _IO('N', 0x40)
431#define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd)
432#define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io)
433
434#endif /* _LINUX_NVME_H */
diff --git a/include/linux/of.h b/include/linux/of.h
index 4948552d60f5..92cf6ad35e0e 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -65,6 +65,27 @@ struct device_node {
65#endif 65#endif
66}; 66};
67 67
68#define MAX_PHANDLE_ARGS 8
69struct of_phandle_args {
70 struct device_node *np;
71 int args_count;
72 uint32_t args[MAX_PHANDLE_ARGS];
73};
74
75#if defined(CONFIG_SPARC) || !defined(CONFIG_OF)
76/* Dummy ref counting routines - to be implemented later */
77static inline struct device_node *of_node_get(struct device_node *node)
78{
79 return node;
80}
81static inline void of_node_put(struct device_node *node)
82{
83}
84#else
85extern struct device_node *of_node_get(struct device_node *node);
86extern void of_node_put(struct device_node *node);
87#endif
88
68#ifdef CONFIG_OF 89#ifdef CONFIG_OF
69 90
70/* Pointer for first entry in chain of all nodes. */ 91/* Pointer for first entry in chain of all nodes. */
@@ -95,21 +116,6 @@ static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
95 116
96extern struct device_node *of_find_all_nodes(struct device_node *prev); 117extern struct device_node *of_find_all_nodes(struct device_node *prev);
97 118
98#if defined(CONFIG_SPARC)
99/* Dummy ref counting routines - to be implemented later */
100static inline struct device_node *of_node_get(struct device_node *node)
101{
102 return node;
103}
104static inline void of_node_put(struct device_node *node)
105{
106}
107
108#else
109extern struct device_node *of_node_get(struct device_node *node);
110extern void of_node_put(struct device_node *node);
111#endif
112
113/* 119/*
114 * OF address retrieval & translation 120 * OF address retrieval & translation
115 */ 121 */
@@ -219,8 +225,8 @@ extern int of_device_is_available(const struct device_node *device);
219extern const void *of_get_property(const struct device_node *node, 225extern const void *of_get_property(const struct device_node *node,
220 const char *name, 226 const char *name,
221 int *lenp); 227 int *lenp);
222#define for_each_property(pp, properties) \ 228#define for_each_property_of_node(dn, pp) \
223 for (pp = properties; pp != NULL; pp = pp->next) 229 for (pp = dn->properties; pp != NULL; pp = pp->next)
224 230
225extern int of_n_addr_cells(struct device_node *np); 231extern int of_n_addr_cells(struct device_node *np);
226extern int of_n_size_cells(struct device_node *np); 232extern int of_n_size_cells(struct device_node *np);
@@ -230,9 +236,9 @@ extern int of_modalias_node(struct device_node *node, char *modalias, int len);
230extern struct device_node *of_parse_phandle(struct device_node *np, 236extern struct device_node *of_parse_phandle(struct device_node *np,
231 const char *phandle_name, 237 const char *phandle_name,
232 int index); 238 int index);
233extern int of_parse_phandles_with_args(struct device_node *np, 239extern int of_parse_phandle_with_args(struct device_node *np,
234 const char *list_name, const char *cells_name, int index, 240 const char *list_name, const char *cells_name, int index,
235 struct device_node **out_node, const void **out_args); 241 struct of_phandle_args *out_args);
236 242
237extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); 243extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
238extern int of_alias_get_id(struct device_node *np, const char *stem); 244extern int of_alias_get_id(struct device_node *np, const char *stem);
@@ -275,6 +281,14 @@ static inline struct property *of_find_property(const struct device_node *np,
275 return NULL; 281 return NULL;
276} 282}
277 283
284static inline struct device_node *of_find_compatible_node(
285 struct device_node *from,
286 const char *type,
287 const char *compat)
288{
289 return NULL;
290}
291
278static inline int of_property_read_u32_array(const struct device_node *np, 292static inline int of_property_read_u32_array(const struct device_node *np,
279 const char *propname, 293 const char *propname,
280 u32 *out_values, size_t sz) 294 u32 *out_values, size_t sz)
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index c84d900fbbb3..ed136ad698ce 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -71,7 +71,7 @@ extern int of_fdt_is_compatible(struct boot_param_header *blob,
71 unsigned long node, 71 unsigned long node,
72 const char *compat); 72 const char *compat);
73extern int of_fdt_match(struct boot_param_header *blob, unsigned long node, 73extern int of_fdt_match(struct boot_param_header *blob, unsigned long node,
74 const char **compat); 74 const char *const *compat);
75extern void of_fdt_unflatten_tree(unsigned long *blob, 75extern void of_fdt_unflatten_tree(unsigned long *blob,
76 struct device_node **mynodes); 76 struct device_node **mynodes);
77 77
@@ -88,7 +88,7 @@ extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
88extern void *of_get_flat_dt_prop(unsigned long node, const char *name, 88extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
89 unsigned long *size); 89 unsigned long *size);
90extern int of_flat_dt_is_compatible(unsigned long node, const char *name); 90extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
91extern int of_flat_dt_match(unsigned long node, const char **matches); 91extern int of_flat_dt_match(unsigned long node, const char *const *matches);
92extern unsigned long of_get_flat_dt_root(void); 92extern unsigned long of_get_flat_dt_root(void);
93 93
94extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, 94extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index 52280a2b5e63..b254052a49d7 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -18,6 +18,7 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21#include <linux/of.h>
21 22
22struct device_node; 23struct device_node;
23 24
@@ -57,8 +58,9 @@ extern int of_mm_gpiochip_add(struct device_node *np,
57extern void of_gpiochip_add(struct gpio_chip *gc); 58extern void of_gpiochip_add(struct gpio_chip *gc);
58extern void of_gpiochip_remove(struct gpio_chip *gc); 59extern void of_gpiochip_remove(struct gpio_chip *gc);
59extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np); 60extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np);
60extern int of_gpio_simple_xlate(struct gpio_chip *gc, struct device_node *np, 61extern int of_gpio_simple_xlate(struct gpio_chip *gc,
61 const void *gpio_spec, u32 *flags); 62 const struct of_phandle_args *gpiospec,
63 u32 *flags);
62 64
63#else /* CONFIG_OF_GPIO */ 65#else /* CONFIG_OF_GPIO */
64 66
@@ -75,8 +77,8 @@ static inline unsigned int of_gpio_count(struct device_node *np)
75} 77}
76 78
77static inline int of_gpio_simple_xlate(struct gpio_chip *gc, 79static inline int of_gpio_simple_xlate(struct gpio_chip *gc,
78 struct device_node *np, 80 const struct of_phandle_args *gpiospec,
79 const void *gpio_spec, u32 *flags) 81 u32 *flags)
80{ 82{
81 return -ENOSYS; 83 return -ENOSYS;
82} 84}
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 6f9d04a85336..552fba9c7d5a 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -43,7 +43,7 @@ enum oom_constraint {
43extern void compare_swap_oom_score_adj(int old_val, int new_val); 43extern void compare_swap_oom_score_adj(int old_val, int new_val);
44extern int test_set_oom_score_adj(int new_val); 44extern int test_set_oom_score_adj(int new_val);
45 45
46extern unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem, 46extern unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *memcg,
47 const nodemask_t *nodemask, unsigned long totalpages); 47 const nodemask_t *nodemask, unsigned long totalpages);
48extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 48extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
49extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 49extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h
new file mode 100644
index 000000000000..eb1efa54fe84
--- /dev/null
+++ b/include/linux/openvswitch.h
@@ -0,0 +1,452 @@
1/*
2 * Copyright (c) 2007-2011 Nicira Networks.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General Public
6 * License as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16 * 02110-1301, USA
17 */
18
19#ifndef _LINUX_OPENVSWITCH_H
20#define _LINUX_OPENVSWITCH_H 1
21
22#include <linux/types.h>
23
24/**
25 * struct ovs_header - header for OVS Generic Netlink messages.
26 * @dp_ifindex: ifindex of local port for datapath (0 to make a request not
27 * specific to a datapath).
28 *
29 * Attributes following the header are specific to a particular OVS Generic
30 * Netlink family, but all of the OVS families use this header.
31 */
32
33struct ovs_header {
34 int dp_ifindex;
35};
36
37/* Datapaths. */
38
39#define OVS_DATAPATH_FAMILY "ovs_datapath"
40#define OVS_DATAPATH_MCGROUP "ovs_datapath"
41#define OVS_DATAPATH_VERSION 0x1
42
43enum ovs_datapath_cmd {
44 OVS_DP_CMD_UNSPEC,
45 OVS_DP_CMD_NEW,
46 OVS_DP_CMD_DEL,
47 OVS_DP_CMD_GET,
48 OVS_DP_CMD_SET
49};
50
51/**
52 * enum ovs_datapath_attr - attributes for %OVS_DP_* commands.
53 * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local
54 * port". This is the name of the network device whose dp_ifindex is given in
55 * the &struct ovs_header. Always present in notifications. Required in
56 * %OVS_DP_NEW requests. May be used as an alternative to specifying
57 * dp_ifindex in other requests (with a dp_ifindex of 0).
58 * @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially
59 * set on the datapath port (for OVS_ACTION_ATTR_MISS). Only valid on
60 * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should
61 * not be sent.
62 * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the
63 * datapath. Always present in notifications.
64 *
65 * These attributes follow the &struct ovs_header within the Generic Netlink
66 * payload for %OVS_DP_* commands.
67 */
68enum ovs_datapath_attr {
69 OVS_DP_ATTR_UNSPEC,
70 OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */
71 OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */
72 OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */
73 __OVS_DP_ATTR_MAX
74};
75
76#define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1)
77
78struct ovs_dp_stats {
79 __u64 n_hit; /* Number of flow table matches. */
80 __u64 n_missed; /* Number of flow table misses. */
81 __u64 n_lost; /* Number of misses not sent to userspace. */
82 __u64 n_flows; /* Number of flows present */
83};
84
85struct ovs_vport_stats {
86 __u64 rx_packets; /* total packets received */
87 __u64 tx_packets; /* total packets transmitted */
88 __u64 rx_bytes; /* total bytes received */
89 __u64 tx_bytes; /* total bytes transmitted */
90 __u64 rx_errors; /* bad packets received */
91 __u64 tx_errors; /* packet transmit problems */
92 __u64 rx_dropped; /* no space in linux buffers */
93 __u64 tx_dropped; /* no space available in linux */
94};
95
96/* Fixed logical ports. */
97#define OVSP_LOCAL ((__u16)0)
98
99/* Packet transfer. */
100
101#define OVS_PACKET_FAMILY "ovs_packet"
102#define OVS_PACKET_VERSION 0x1
103
104enum ovs_packet_cmd {
105 OVS_PACKET_CMD_UNSPEC,
106
107 /* Kernel-to-user notifications. */
108 OVS_PACKET_CMD_MISS, /* Flow table miss. */
109 OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */
110
111 /* Userspace commands. */
112 OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */
113};
114
115/**
116 * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands.
117 * @OVS_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire
118 * packet as received, from the start of the Ethernet header onward. For
119 * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by
120 * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is
121 * the flow key extracted from the packet as originally received.
122 * @OVS_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key
123 * extracted from the packet as nested %OVS_KEY_ATTR_* attributes. This allows
124 * userspace to adapt its flow setup strategy by comparing its notion of the
125 * flow key against the kernel's.
126 * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet. Used
127 * for %OVS_PACKET_CMD_EXECUTE. It has nested %OVS_ACTION_ATTR_* attributes.
128 * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION
129 * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an
130 * %OVS_USERSPACE_ATTR_USERDATA attribute.
131 *
132 * These attributes follow the &struct ovs_header within the Generic Netlink
133 * payload for %OVS_PACKET_* commands.
134 */
135enum ovs_packet_attr {
136 OVS_PACKET_ATTR_UNSPEC,
137 OVS_PACKET_ATTR_PACKET, /* Packet data. */
138 OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */
139 OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
140 OVS_PACKET_ATTR_USERDATA, /* u64 OVS_ACTION_ATTR_USERSPACE arg. */
141 __OVS_PACKET_ATTR_MAX
142};
143
144#define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1)
145
146/* Virtual ports. */
147
148#define OVS_VPORT_FAMILY "ovs_vport"
149#define OVS_VPORT_MCGROUP "ovs_vport"
150#define OVS_VPORT_VERSION 0x1
151
152enum ovs_vport_cmd {
153 OVS_VPORT_CMD_UNSPEC,
154 OVS_VPORT_CMD_NEW,
155 OVS_VPORT_CMD_DEL,
156 OVS_VPORT_CMD_GET,
157 OVS_VPORT_CMD_SET
158};
159
160enum ovs_vport_type {
161 OVS_VPORT_TYPE_UNSPEC,
162 OVS_VPORT_TYPE_NETDEV, /* network device */
163 OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */
164 __OVS_VPORT_TYPE_MAX
165};
166
167#define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1)
168
169/**
170 * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands.
171 * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath.
172 * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type
173 * of vport.
174 * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device
175 * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes
176 * plus a null terminator.
177 * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information.
178 * @OVS_VPORT_ATTR_UPCALL_PID: The Netlink socket in userspace that
179 * OVS_PACKET_CMD_MISS upcalls will be directed to for packets received on
180 * this port. A value of zero indicates that upcalls should not be sent.
181 * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for
182 * packets sent or received through the vport.
183 *
184 * These attributes follow the &struct ovs_header within the Generic Netlink
185 * payload for %OVS_VPORT_* commands.
186 *
187 * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and
188 * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is
189 * optional; if not specified a free port number is automatically selected.
190 * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type
191 * of vport.
192 * and other attributes are ignored.
193 *
194 * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to
195 * look up the vport to operate on; otherwise dp_idx from the &struct
196 * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport.
197 */
198enum ovs_vport_attr {
199 OVS_VPORT_ATTR_UNSPEC,
200 OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */
201 OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */
202 OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */
203 OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */
204 OVS_VPORT_ATTR_UPCALL_PID, /* u32 Netlink PID to receive upcalls */
205 OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */
206 __OVS_VPORT_ATTR_MAX
207};
208
209#define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1)
210
211/* Flows. */
212
213#define OVS_FLOW_FAMILY "ovs_flow"
214#define OVS_FLOW_MCGROUP "ovs_flow"
215#define OVS_FLOW_VERSION 0x1
216
217enum ovs_flow_cmd {
218 OVS_FLOW_CMD_UNSPEC,
219 OVS_FLOW_CMD_NEW,
220 OVS_FLOW_CMD_DEL,
221 OVS_FLOW_CMD_GET,
222 OVS_FLOW_CMD_SET
223};
224
225struct ovs_flow_stats {
226 __u64 n_packets; /* Number of matched packets. */
227 __u64 n_bytes; /* Number of matched bytes. */
228};
229
230enum ovs_key_attr {
231 OVS_KEY_ATTR_UNSPEC,
232 OVS_KEY_ATTR_ENCAP, /* Nested set of encapsulated attributes. */
233 OVS_KEY_ATTR_PRIORITY, /* u32 skb->priority */
234 OVS_KEY_ATTR_IN_PORT, /* u32 OVS dp port number */
235 OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */
236 OVS_KEY_ATTR_VLAN, /* be16 VLAN TCI */
237 OVS_KEY_ATTR_ETHERTYPE, /* be16 Ethernet type */
238 OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */
239 OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */
240 OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */
241 OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */
242 OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */
243 OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */
244 OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */
245 OVS_KEY_ATTR_ND, /* struct ovs_key_nd */
246 __OVS_KEY_ATTR_MAX
247};
248
249#define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1)
250
251/**
252 * enum ovs_frag_type - IPv4 and IPv6 fragment type
253 * @OVS_FRAG_TYPE_NONE: Packet is not a fragment.
254 * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0.
255 * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset.
256 *
257 * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct
258 * ovs_key_ipv6.
259 */
260enum ovs_frag_type {
261 OVS_FRAG_TYPE_NONE,
262 OVS_FRAG_TYPE_FIRST,
263 OVS_FRAG_TYPE_LATER,
264 __OVS_FRAG_TYPE_MAX
265};
266
267#define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1)
268
269struct ovs_key_ethernet {
270 __u8 eth_src[6];
271 __u8 eth_dst[6];
272};
273
274struct ovs_key_ipv4 {
275 __be32 ipv4_src;
276 __be32 ipv4_dst;
277 __u8 ipv4_proto;
278 __u8 ipv4_tos;
279 __u8 ipv4_ttl;
280 __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */
281};
282
283struct ovs_key_ipv6 {
284 __be32 ipv6_src[4];
285 __be32 ipv6_dst[4];
286 __be32 ipv6_label; /* 20-bits in least-significant bits. */
287 __u8 ipv6_proto;
288 __u8 ipv6_tclass;
289 __u8 ipv6_hlimit;
290 __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */
291};
292
293struct ovs_key_tcp {
294 __be16 tcp_src;
295 __be16 tcp_dst;
296};
297
298struct ovs_key_udp {
299 __be16 udp_src;
300 __be16 udp_dst;
301};
302
303struct ovs_key_icmp {
304 __u8 icmp_type;
305 __u8 icmp_code;
306};
307
308struct ovs_key_icmpv6 {
309 __u8 icmpv6_type;
310 __u8 icmpv6_code;
311};
312
313struct ovs_key_arp {
314 __be32 arp_sip;
315 __be32 arp_tip;
316 __be16 arp_op;
317 __u8 arp_sha[6];
318 __u8 arp_tha[6];
319};
320
321struct ovs_key_nd {
322 __u32 nd_target[4];
323 __u8 nd_sll[6];
324 __u8 nd_tll[6];
325};
326
327/**
328 * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands.
329 * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow
330 * key. Always present in notifications. Required for all requests (except
331 * dumps).
332 * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying
333 * the actions to take for packets that match the key. Always present in
334 * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for
335 * %OVS_FLOW_CMD_SET requests.
336 * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this
337 * flow. Present in notifications if the stats would be nonzero. Ignored in
338 * requests.
339 * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the
340 * TCP flags seen on packets in this flow. Only present in notifications for
341 * TCP flows, and only if it would be nonzero. Ignored in requests.
342 * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on
343 * the system monotonic clock, at which a packet was last processed for this
344 * flow. Only present in notifications if a packet has been processed for this
345 * flow. Ignored in requests.
346 * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the
347 * last-used time, accumulated TCP flags, and statistics for this flow.
348 * Otherwise ignored in requests. Never present in notifications.
349 *
350 * These attributes follow the &struct ovs_header within the Generic Netlink
351 * payload for %OVS_FLOW_* commands.
352 */
353enum ovs_flow_attr {
354 OVS_FLOW_ATTR_UNSPEC,
355 OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */
356 OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
357 OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */
358 OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */
359 OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */
360 OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */
361 __OVS_FLOW_ATTR_MAX
362};
363
364#define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1)
365
366/**
367 * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action.
368 * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with
369 * @OVS_ACTION_ATTR_SAMPLE. A value of 0 samples no packets, a value of
370 * %UINT32_MAX samples all packets and intermediate values sample intermediate
371 * fractions of packets.
372 * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event.
373 * Actions are passed as nested attributes.
374 *
375 * Executes the specified actions with the given probability on a per-packet
376 * basis.
377 */
378enum ovs_sample_attr {
379 OVS_SAMPLE_ATTR_UNSPEC,
380 OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */
381 OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
382 __OVS_SAMPLE_ATTR_MAX,
383};
384
385#define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1)
386
387/**
388 * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action.
389 * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION
390 * message should be sent. Required.
391 * @OVS_USERSPACE_ATTR_USERDATA: If present, its u64 argument is copied to the
392 * %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA,
393 */
394enum ovs_userspace_attr {
395 OVS_USERSPACE_ATTR_UNSPEC,
396 OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */
397 OVS_USERSPACE_ATTR_USERDATA, /* u64 optional user-specified cookie. */
398 __OVS_USERSPACE_ATTR_MAX
399};
400
401#define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1)
402
403/**
404 * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument.
405 * @vlan_tpid: Tag protocol identifier (TPID) to push.
406 * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set
407 * (but it will not be set in the 802.1Q header that is pushed).
408 *
409 * The @vlan_tpid value is typically %ETH_P_8021Q. The only acceptable TPID
410 * values are those that the kernel module also parses as 802.1Q headers, to
411 * prevent %OVS_ACTION_ATTR_PUSH_VLAN followed by %OVS_ACTION_ATTR_POP_VLAN
412 * from having surprising results.
413 */
414struct ovs_action_push_vlan {
415 __be16 vlan_tpid; /* 802.1Q TPID. */
416 __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */
417};
418
419/**
420 * enum ovs_action_attr - Action types.
421 *
422 * @OVS_ACTION_ATTR_OUTPUT: Output packet to port.
423 * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested
424 * %OVS_USERSPACE_ATTR_* attributes.
425 * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header. The
426 * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its
427 * value.
428 * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q header onto the
429 * packet.
430 * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet.
431 * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in
432 * the nested %OVS_SAMPLE_ATTR_* attributes.
433 *
434 * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all
435 * fields within a header are modifiable, e.g. the IPv4 protocol and fragment
436 * type may not be changed.
437 */
438
439enum ovs_action_attr {
440 OVS_ACTION_ATTR_UNSPEC,
441 OVS_ACTION_ATTR_OUTPUT, /* u32 port number. */
442 OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */
443 OVS_ACTION_ATTR_SET, /* One nested OVS_KEY_ATTR_*. */
444 OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */
445 OVS_ACTION_ATTR_POP_VLAN, /* No argument. */
446 OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */
447 __OVS_ACTION_ATTR_MAX
448};
449
450#define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1)
451
452#endif /* _LINUX_OPENVSWITCH_H */
diff --git a/include/linux/page-debug-flags.h b/include/linux/page-debug-flags.h
index b0638fd91e92..22691f614043 100644
--- a/include/linux/page-debug-flags.h
+++ b/include/linux/page-debug-flags.h
@@ -13,6 +13,7 @@
13 13
14enum page_debug_flags { 14enum page_debug_flags {
15 PAGE_DEBUG_FLAG_POISON, /* Page is poisoned */ 15 PAGE_DEBUG_FLAG_POISON, /* Page is poisoned */
16 PAGE_DEBUG_FLAG_GUARD,
16}; 17};
17 18
18/* 19/*
@@ -21,7 +22,8 @@ enum page_debug_flags {
21 */ 22 */
22 23
23#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS 24#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS
24#if !defined(CONFIG_PAGE_POISONING) \ 25#if !defined(CONFIG_PAGE_POISONING) && \
26 !defined(CONFIG_PAGE_GUARD) \
25/* && !defined(CONFIG_PAGE_DEBUG_SOMETHING_ELSE) && ... */ 27/* && !defined(CONFIG_PAGE_DEBUG_SOMETHING_ELSE) && ... */
26#error WANT_PAGE_DEBUG_FLAGS is turned on with no debug features! 28#error WANT_PAGE_DEBUG_FLAGS is turned on with no debug features!
27#endif 29#endif
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 961ecc7d30bc..a2d11771c84b 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -10,8 +10,6 @@ enum {
10 /* flags for mem_cgroup and file and I/O status */ 10 /* flags for mem_cgroup and file and I/O status */
11 PCG_MOVE_LOCK, /* For race between move_account v.s. following bits */ 11 PCG_MOVE_LOCK, /* For race between move_account v.s. following bits */
12 PCG_FILE_MAPPED, /* page is accounted as "mapped" */ 12 PCG_FILE_MAPPED, /* page is accounted as "mapped" */
13 /* No lock in page_cgroup */
14 PCG_ACCT_LRU, /* page has been accounted for (under lru_lock) */
15 __NR_PCG_FLAGS, 13 __NR_PCG_FLAGS,
16}; 14};
17 15
@@ -31,7 +29,6 @@ enum {
31struct page_cgroup { 29struct page_cgroup {
32 unsigned long flags; 30 unsigned long flags;
33 struct mem_cgroup *mem_cgroup; 31 struct mem_cgroup *mem_cgroup;
34 struct list_head lru; /* per cgroup LRU list */
35}; 32};
36 33
37void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat); 34void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat);
@@ -76,12 +73,6 @@ TESTPCGFLAG(Used, USED)
76CLEARPCGFLAG(Used, USED) 73CLEARPCGFLAG(Used, USED)
77SETPCGFLAG(Used, USED) 74SETPCGFLAG(Used, USED)
78 75
79SETPCGFLAG(AcctLRU, ACCT_LRU)
80CLEARPCGFLAG(AcctLRU, ACCT_LRU)
81TESTPCGFLAG(AcctLRU, ACCT_LRU)
82TESTCLEARPCGFLAG(AcctLRU, ACCT_LRU)
83
84
85SETPCGFLAG(FileMapped, FILE_MAPPED) 76SETPCGFLAG(FileMapped, FILE_MAPPED)
86CLEARPCGFLAG(FileMapped, FILE_MAPPED) 77CLEARPCGFLAG(FileMapped, FILE_MAPPED)
87TESTPCGFLAG(FileMapped, FILE_MAPPED) 78TESTPCGFLAG(FileMapped, FILE_MAPPED)
@@ -122,39 +113,6 @@ static inline void move_unlock_page_cgroup(struct page_cgroup *pc,
122 local_irq_restore(*flags); 113 local_irq_restore(*flags);
123} 114}
124 115
125#ifdef CONFIG_SPARSEMEM
126#define PCG_ARRAYID_WIDTH SECTIONS_SHIFT
127#else
128#define PCG_ARRAYID_WIDTH NODES_SHIFT
129#endif
130
131#if (PCG_ARRAYID_WIDTH > BITS_PER_LONG - NR_PCG_FLAGS)
132#error Not enough space left in pc->flags to store page_cgroup array IDs
133#endif
134
135/* pc->flags: ARRAY-ID | FLAGS */
136
137#define PCG_ARRAYID_MASK ((1UL << PCG_ARRAYID_WIDTH) - 1)
138
139#define PCG_ARRAYID_OFFSET (BITS_PER_LONG - PCG_ARRAYID_WIDTH)
140/*
141 * Zero the shift count for non-existent fields, to prevent compiler
142 * warnings and ensure references are optimized away.
143 */
144#define PCG_ARRAYID_SHIFT (PCG_ARRAYID_OFFSET * (PCG_ARRAYID_WIDTH != 0))
145
146static inline void set_page_cgroup_array_id(struct page_cgroup *pc,
147 unsigned long id)
148{
149 pc->flags &= ~(PCG_ARRAYID_MASK << PCG_ARRAYID_SHIFT);
150 pc->flags |= (id & PCG_ARRAYID_MASK) << PCG_ARRAYID_SHIFT;
151}
152
153static inline unsigned long page_cgroup_array_id(struct page_cgroup *pc)
154{
155 return (pc->flags >> PCG_ARRAYID_SHIFT) & PCG_ARRAYID_MASK;
156}
157
158#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 116#else /* CONFIG_CGROUP_MEM_RES_CTLR */
159struct page_cgroup; 117struct page_cgroup;
160 118
@@ -183,7 +141,7 @@ static inline void __init page_cgroup_init_flatmem(void)
183extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent, 141extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent,
184 unsigned short old, unsigned short new); 142 unsigned short old, unsigned short new);
185extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); 143extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id);
186extern unsigned short lookup_swap_cgroup(swp_entry_t ent); 144extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent);
187extern int swap_cgroup_swapon(int type, unsigned long max_pages); 145extern int swap_cgroup_swapon(int type, unsigned long max_pages);
188extern void swap_cgroup_swapoff(int type); 146extern void swap_cgroup_swapoff(int type);
189#else 147#else
@@ -195,7 +153,7 @@ unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id)
195} 153}
196 154
197static inline 155static inline
198unsigned short lookup_swap_cgroup(swp_entry_t ent) 156unsigned short lookup_swap_cgroup_id(swp_entry_t ent)
199{ 157{
200 return 0; 158 return 0;
201} 159}
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
index bab82f4c571c..2aa12b8499c0 100644
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@ -21,9 +21,7 @@ struct pagevec {
21}; 21};
22 22
23void __pagevec_release(struct pagevec *pvec); 23void __pagevec_release(struct pagevec *pvec);
24void __pagevec_free(struct pagevec *pvec); 24void __pagevec_lru_add(struct pagevec *pvec, enum lru_list lru);
25void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru);
26void pagevec_strip(struct pagevec *pvec);
27unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, 25unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping,
28 pgoff_t start, unsigned nr_pages); 26 pgoff_t start, unsigned nr_pages);
29unsigned pagevec_lookup_tag(struct pagevec *pvec, 27unsigned pagevec_lookup_tag(struct pagevec *pvec,
@@ -60,37 +58,30 @@ static inline unsigned pagevec_add(struct pagevec *pvec, struct page *page)
60 return pagevec_space(pvec); 58 return pagevec_space(pvec);
61} 59}
62 60
63
64static inline void pagevec_release(struct pagevec *pvec) 61static inline void pagevec_release(struct pagevec *pvec)
65{ 62{
66 if (pagevec_count(pvec)) 63 if (pagevec_count(pvec))
67 __pagevec_release(pvec); 64 __pagevec_release(pvec);
68} 65}
69 66
70static inline void pagevec_free(struct pagevec *pvec)
71{
72 if (pagevec_count(pvec))
73 __pagevec_free(pvec);
74}
75
76static inline void __pagevec_lru_add_anon(struct pagevec *pvec) 67static inline void __pagevec_lru_add_anon(struct pagevec *pvec)
77{ 68{
78 ____pagevec_lru_add(pvec, LRU_INACTIVE_ANON); 69 __pagevec_lru_add(pvec, LRU_INACTIVE_ANON);
79} 70}
80 71
81static inline void __pagevec_lru_add_active_anon(struct pagevec *pvec) 72static inline void __pagevec_lru_add_active_anon(struct pagevec *pvec)
82{ 73{
83 ____pagevec_lru_add(pvec, LRU_ACTIVE_ANON); 74 __pagevec_lru_add(pvec, LRU_ACTIVE_ANON);
84} 75}
85 76
86static inline void __pagevec_lru_add_file(struct pagevec *pvec) 77static inline void __pagevec_lru_add_file(struct pagevec *pvec)
87{ 78{
88 ____pagevec_lru_add(pvec, LRU_INACTIVE_FILE); 79 __pagevec_lru_add(pvec, LRU_INACTIVE_FILE);
89} 80}
90 81
91static inline void __pagevec_lru_add_active_file(struct pagevec *pvec) 82static inline void __pagevec_lru_add_active_file(struct pagevec *pvec)
92{ 83{
93 ____pagevec_lru_add(pvec, LRU_ACTIVE_FILE); 84 __pagevec_lru_add(pvec, LRU_ACTIVE_FILE);
94} 85}
95 86
96static inline void pagevec_lru_add_file(struct pagevec *pvec) 87static inline void pagevec_lru_add_file(struct pagevec *pvec)
diff --git a/include/linux/patchkey.h b/include/linux/patchkey.h
index d974a6e92372..aefda0ec6e62 100644
--- a/include/linux/patchkey.h
+++ b/include/linux/patchkey.h
@@ -32,7 +32,8 @@
32# else 32# else
33# error "could not determine byte order" 33# error "could not determine byte order"
34# endif 34# endif
35#elif defined(__BYTE_ORDER) 35#else
36#if defined(__BYTE_ORDER)
36# if __BYTE_ORDER == __BIG_ENDIAN 37# if __BYTE_ORDER == __BIG_ENDIAN
37# define _PATCHKEY(id) (0xfd00|id) 38# define _PATCHKEY(id) (0xfd00|id)
38# elif __BYTE_ORDER == __LITTLE_ENDIAN 39# elif __BYTE_ORDER == __LITTLE_ENDIAN
@@ -41,5 +42,6 @@
41# error "could not determine byte order" 42# error "could not determine byte order"
42# endif 43# endif
43#endif 44#endif
45#endif
44 46
45#endif /* _LINUX_PATCHKEY_H */ 47#endif /* _LINUX_PATCHKEY_H */
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
index 7cea7b6c1413..c8320144fe79 100644
--- a/include/linux/pci-aspm.h
+++ b/include/linux/pci-aspm.h
@@ -29,7 +29,7 @@ extern void pcie_aspm_pm_state_change(struct pci_dev *pdev);
29extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev); 29extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev);
30extern void pci_disable_link_state(struct pci_dev *pdev, int state); 30extern void pci_disable_link_state(struct pci_dev *pdev, int state);
31extern void pci_disable_link_state_locked(struct pci_dev *pdev, int state); 31extern void pci_disable_link_state_locked(struct pci_dev *pdev, int state);
32extern void pcie_clear_aspm(void); 32extern void pcie_clear_aspm(struct pci_bus *bus);
33extern void pcie_no_aspm(void); 33extern void pcie_no_aspm(void);
34#else 34#else
35static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) 35static inline void pcie_aspm_init_link_state(struct pci_dev *pdev)
@@ -47,7 +47,7 @@ static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
47static inline void pci_disable_link_state(struct pci_dev *pdev, int state) 47static inline void pci_disable_link_state(struct pci_dev *pdev, int state)
48{ 48{
49} 49}
50static inline void pcie_clear_aspm(void) 50static inline void pcie_clear_aspm(struct pci_bus *bus)
51{ 51{
52} 52}
53static inline void pcie_no_aspm(void) 53static inline void pcie_no_aspm(void)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 7cda65b5f798..a16b1df3deff 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -111,7 +111,7 @@ enum {
111 PCI_NUM_RESOURCES, 111 PCI_NUM_RESOURCES,
112 112
113 /* preserve this for compatibility */ 113 /* preserve this for compatibility */
114 DEVICE_COUNT_RESOURCE 114 DEVICE_COUNT_RESOURCE = PCI_NUM_RESOURCES,
115}; 115};
116 116
117typedef int __bitwise pci_power_t; 117typedef int __bitwise pci_power_t;
@@ -308,7 +308,7 @@ struct pci_dev {
308 unsigned int is_added:1; 308 unsigned int is_added:1;
309 unsigned int is_busmaster:1; /* device is busmaster */ 309 unsigned int is_busmaster:1; /* device is busmaster */
310 unsigned int no_msi:1; /* device may not use msi */ 310 unsigned int no_msi:1; /* device may not use msi */
311 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */ 311 unsigned int block_cfg_access:1; /* config space access is blocked */
312 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 312 unsigned int broken_parity_status:1; /* Device generates false positive parity */
313 unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */ 313 unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */
314 unsigned int msi_enabled:1; 314 unsigned int msi_enabled:1;
@@ -336,6 +336,7 @@ struct pci_dev {
336 struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */ 336 struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */
337#ifdef CONFIG_PCI_MSI 337#ifdef CONFIG_PCI_MSI
338 struct list_head msi_list; 338 struct list_head msi_list;
339 struct kset *msi_kset;
339#endif 340#endif
340 struct pci_vpd *vpd; 341 struct pci_vpd *vpd;
341#ifdef CONFIG_PCI_ATS 342#ifdef CONFIG_PCI_ATS
@@ -660,17 +661,13 @@ extern struct pci_bus *pci_find_bus(int domain, int busnr);
660void pci_bus_add_devices(const struct pci_bus *bus); 661void pci_bus_add_devices(const struct pci_bus *bus);
661struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, 662struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
662 struct pci_ops *ops, void *sysdata); 663 struct pci_ops *ops, void *sysdata);
663static inline struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops, 664struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
664 void *sysdata) 665struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
665{ 666 struct pci_ops *ops, void *sysdata,
666 struct pci_bus *root_bus; 667 struct list_head *resources);
667 root_bus = pci_scan_bus_parented(NULL, bus, ops, sysdata); 668struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus,
668 if (root_bus) 669 struct pci_ops *ops, void *sysdata,
669 pci_bus_add_devices(root_bus); 670 struct list_head *resources);
670 return root_bus;
671}
672struct pci_bus *pci_create_bus(struct device *parent, int bus,
673 struct pci_ops *ops, void *sysdata);
674struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, 671struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
675 int busnr); 672 int busnr);
676void pcie_update_link_speed(struct pci_bus *bus, u16 link_status); 673void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
@@ -794,8 +791,11 @@ static inline int pci_is_managed(struct pci_dev *pdev)
794} 791}
795 792
796void pci_disable_device(struct pci_dev *dev); 793void pci_disable_device(struct pci_dev *dev);
794
795extern unsigned int pcibios_max_latency;
797void pci_set_master(struct pci_dev *dev); 796void pci_set_master(struct pci_dev *dev);
798void pci_clear_master(struct pci_dev *dev); 797void pci_clear_master(struct pci_dev *dev);
798
799int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state); 799int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state);
800int pci_set_cacheline_size(struct pci_dev *dev); 800int pci_set_cacheline_size(struct pci_dev *dev);
801#define HAVE_PCI_SET_MWI 801#define HAVE_PCI_SET_MWI
@@ -803,6 +803,9 @@ int __must_check pci_set_mwi(struct pci_dev *dev);
803int pci_try_set_mwi(struct pci_dev *dev); 803int pci_try_set_mwi(struct pci_dev *dev);
804void pci_clear_mwi(struct pci_dev *dev); 804void pci_clear_mwi(struct pci_dev *dev);
805void pci_intx(struct pci_dev *dev, int enable); 805void pci_intx(struct pci_dev *dev, int enable);
806bool pci_intx_mask_supported(struct pci_dev *dev);
807bool pci_check_and_mask_intx(struct pci_dev *dev);
808bool pci_check_and_unmask_intx(struct pci_dev *dev);
806void pci_msi_off(struct pci_dev *dev); 809void pci_msi_off(struct pci_dev *dev);
807int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size); 810int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size);
808int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask); 811int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask);
@@ -910,6 +913,8 @@ int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *);
910void pci_release_selected_regions(struct pci_dev *, int); 913void pci_release_selected_regions(struct pci_dev *, int);
911 914
912/* drivers/pci/bus.c */ 915/* drivers/pci/bus.c */
916void pci_add_resource(struct list_head *resources, struct resource *res);
917void pci_free_resource_list(struct list_head *resources);
913void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags); 918void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags);
914struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n); 919struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n);
915void pci_bus_remove_resources(struct pci_bus *bus); 920void pci_bus_remove_resources(struct pci_bus *bus);
@@ -1084,8 +1089,9 @@ int ht_create_irq(struct pci_dev *dev, int idx);
1084void ht_destroy_irq(unsigned int irq); 1089void ht_destroy_irq(unsigned int irq);
1085#endif /* CONFIG_HT_IRQ */ 1090#endif /* CONFIG_HT_IRQ */
1086 1091
1087extern void pci_block_user_cfg_access(struct pci_dev *dev); 1092extern void pci_cfg_access_lock(struct pci_dev *dev);
1088extern void pci_unblock_user_cfg_access(struct pci_dev *dev); 1093extern bool pci_cfg_access_trylock(struct pci_dev *dev);
1094extern void pci_cfg_access_unlock(struct pci_dev *dev);
1089 1095
1090/* 1096/*
1091 * PCI domain support. Sometimes called PCI segment (eg by ACPI), 1097 * PCI domain support. Sometimes called PCI segment (eg by ACPI),
@@ -1282,10 +1288,13 @@ static inline void pci_release_regions(struct pci_dev *dev)
1282 1288
1283#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) 1289#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0)
1284 1290
1285static inline void pci_block_user_cfg_access(struct pci_dev *dev) 1291static inline void pci_block_cfg_access(struct pci_dev *dev)
1286{ } 1292{ }
1287 1293
1288static inline void pci_unblock_user_cfg_access(struct pci_dev *dev) 1294static inline int pci_block_cfg_access_in_atomic(struct pci_dev *dev)
1295{ return 0; }
1296
1297static inline void pci_unblock_cfg_access(struct pci_dev *dev)
1289{ } 1298{ }
1290 1299
1291static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from) 1300static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from)
@@ -1423,10 +1432,10 @@ static inline void pci_fixup_device(enum pci_fixup_pass pass,
1423void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); 1432void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
1424void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); 1433void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr);
1425void __iomem * const *pcim_iomap_table(struct pci_dev *pdev); 1434void __iomem * const *pcim_iomap_table(struct pci_dev *pdev);
1426int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name); 1435int pcim_iomap_regions(struct pci_dev *pdev, int mask, const char *name);
1427int pcim_iomap_regions_request_all(struct pci_dev *pdev, u16 mask, 1436int pcim_iomap_regions_request_all(struct pci_dev *pdev, int mask,
1428 const char *name); 1437 const char *name);
1429void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask); 1438void pcim_iounmap_regions(struct pci_dev *pdev, int mask);
1430 1439
1431extern int pci_pci_problems; 1440extern int pci_pci_problems;
1432#define PCIPCI_FAIL 1 /* No PCI PCI DMA */ 1441#define PCIPCI_FAIL 1 /* No PCI PCI DMA */
@@ -1445,8 +1454,10 @@ extern u8 pci_cache_line_size;
1445extern unsigned long pci_hotplug_io_size; 1454extern unsigned long pci_hotplug_io_size;
1446extern unsigned long pci_hotplug_mem_size; 1455extern unsigned long pci_hotplug_mem_size;
1447 1456
1457/* Architecture specific versions may override these (weak) */
1448int pcibios_add_platform_entries(struct pci_dev *dev); 1458int pcibios_add_platform_entries(struct pci_dev *dev);
1449void pcibios_disable_device(struct pci_dev *dev); 1459void pcibios_disable_device(struct pci_dev *dev);
1460void pcibios_set_master(struct pci_dev *dev);
1450int pcibios_set_pcie_reset_state(struct pci_dev *dev, 1461int pcibios_set_pcie_reset_state(struct pci_dev *dev,
1451 enum pcie_reset_state state); 1462 enum pcie_reset_state state);
1452 1463
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 2aaee0ca9da8..31d77af2ef42 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -776,6 +776,29 @@
776#define PCI_DEVICE_ID_ELSA_QS3000 0x3000 776#define PCI_DEVICE_ID_ELSA_QS3000 0x3000
777 777
778#define PCI_VENDOR_ID_STMICRO 0x104A 778#define PCI_VENDOR_ID_STMICRO 0x104A
779#define PCI_DEVICE_ID_STMICRO_USB_HOST 0xCC00
780#define PCI_DEVICE_ID_STMICRO_USB_OHCI 0xCC01
781#define PCI_DEVICE_ID_STMICRO_USB_OTG 0xCC02
782#define PCI_DEVICE_ID_STMICRO_UART_HWFC 0xCC03
783#define PCI_DEVICE_ID_STMICRO_UART_NO_HWFC 0xCC04
784#define PCI_DEVICE_ID_STMICRO_SOC_DMA 0xCC05
785#define PCI_DEVICE_ID_STMICRO_SATA 0xCC06
786#define PCI_DEVICE_ID_STMICRO_I2C 0xCC07
787#define PCI_DEVICE_ID_STMICRO_SPI_HS 0xCC08
788#define PCI_DEVICE_ID_STMICRO_MAC 0xCC09
789#define PCI_DEVICE_ID_STMICRO_SDIO_EMMC 0xCC0A
790#define PCI_DEVICE_ID_STMICRO_SDIO 0xCC0B
791#define PCI_DEVICE_ID_STMICRO_GPIO 0xCC0C
792#define PCI_DEVICE_ID_STMICRO_VIP 0xCC0D
793#define PCI_DEVICE_ID_STMICRO_AUDIO_ROUTER_DMA 0xCC0E
794#define PCI_DEVICE_ID_STMICRO_AUDIO_ROUTER_SRCS 0xCC0F
795#define PCI_DEVICE_ID_STMICRO_AUDIO_ROUTER_MSPS 0xCC10
796#define PCI_DEVICE_ID_STMICRO_CAN 0xCC11
797#define PCI_DEVICE_ID_STMICRO_MLB 0xCC12
798#define PCI_DEVICE_ID_STMICRO_DBP 0xCC13
799#define PCI_DEVICE_ID_STMICRO_SATA_PHY 0xCC14
800#define PCI_DEVICE_ID_STMICRO_ESRAM 0xCC15
801#define PCI_DEVICE_ID_STMICRO_VIC 0xCC16
779 802
780#define PCI_VENDOR_ID_BUSLOGIC 0x104B 803#define PCI_VENDOR_ID_BUSLOGIC 0x104B
781#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140 804#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index b5d9657f3100..e41a10f5ae83 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -392,7 +392,7 @@
392#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ 392#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */
393#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ 393#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */
394#define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */ 394#define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */
395#define PCI_EXP_TYPE_RC_EC 0x10 /* Root Complex Event Collector */ 395#define PCI_EXP_TYPE_RC_EC 0xa /* Root Complex Event Collector */
396#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ 396#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */
397#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ 397#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */
398#define PCI_EXP_DEVCAP 4 /* Device capabilities */ 398#define PCI_EXP_DEVCAP 4 /* Device capabilities */
@@ -537,7 +537,9 @@
537#define PCI_EXT_CAP_ID_ARI 14 537#define PCI_EXT_CAP_ID_ARI 14
538#define PCI_EXT_CAP_ID_ATS 15 538#define PCI_EXT_CAP_ID_ATS 15
539#define PCI_EXT_CAP_ID_SRIOV 16 539#define PCI_EXT_CAP_ID_SRIOV 16
540#define PCI_EXT_CAP_ID_PRI 19
540#define PCI_EXT_CAP_ID_LTR 24 541#define PCI_EXT_CAP_ID_LTR 24
542#define PCI_EXT_CAP_ID_PASID 27
541 543
542/* Advanced Error Reporting */ 544/* Advanced Error Reporting */
543#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ 545#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */
@@ -664,24 +666,24 @@
664#define PCI_ATS_MIN_STU 12 /* shift of minimum STU block */ 666#define PCI_ATS_MIN_STU 12 /* shift of minimum STU block */
665 667
666/* Page Request Interface */ 668/* Page Request Interface */
667#define PCI_PRI_CAP 0x13 /* PRI capability ID */ 669#define PCI_PRI_CTRL 0x04 /* PRI control register */
668#define PCI_PRI_CONTROL_OFF 0x04 /* Offset of control register */ 670#define PCI_PRI_CTRL_ENABLE 0x01 /* Enable */
669#define PCI_PRI_STATUS_OFF 0x06 /* Offset of status register */ 671#define PCI_PRI_CTRL_RESET 0x02 /* Reset */
670#define PCI_PRI_ENABLE 0x0001 /* Enable mask */ 672#define PCI_PRI_STATUS 0x06 /* PRI status register */
671#define PCI_PRI_RESET 0x0002 /* Reset bit mask */ 673#define PCI_PRI_STATUS_RF 0x001 /* Response Failure */
672#define PCI_PRI_STATUS_RF 0x0001 /* Request Failure */ 674#define PCI_PRI_STATUS_UPRGI 0x002 /* Unexpected PRG index */
673#define PCI_PRI_STATUS_UPRGI 0x0002 /* Unexpected PRG index */ 675#define PCI_PRI_STATUS_STOPPED 0x100 /* PRI Stopped */
674#define PCI_PRI_STATUS_STOPPED 0x0100 /* PRI Stopped */ 676#define PCI_PRI_MAX_REQ 0x08 /* PRI max reqs supported */
675#define PCI_PRI_MAX_REQ_OFF 0x08 /* Cap offset for max reqs supported */ 677#define PCI_PRI_ALLOC_REQ 0x0c /* PRI max reqs allowed */
676#define PCI_PRI_ALLOC_REQ_OFF 0x0c /* Cap offset for max reqs allowed */
677 678
678/* PASID capability */ 679/* PASID capability */
679#define PCI_PASID_CAP 0x1b /* PASID capability ID */ 680#define PCI_PASID_CAP 0x04 /* PASID feature register */
680#define PCI_PASID_CAP_OFF 0x04 /* PASID feature register */ 681#define PCI_PASID_CAP_EXEC 0x02 /* Exec permissions Supported */
681#define PCI_PASID_CONTROL_OFF 0x06 /* PASID control register */ 682#define PCI_PASID_CAP_PRIV 0x04 /* Priviledge Mode Supported */
682#define PCI_PASID_ENABLE 0x01 /* Enable/Supported bit */ 683#define PCI_PASID_CTRL 0x06 /* PASID control register */
683#define PCI_PASID_EXEC 0x02 /* Exec permissions Enable/Supported */ 684#define PCI_PASID_CTRL_ENABLE 0x01 /* Enable bit */
684#define PCI_PASID_PRIV 0x04 /* Priviledge Mode Enable/Support */ 685#define PCI_PASID_CTRL_EXEC 0x02 /* Exec permissions Enable */
686#define PCI_PASID_CTRL_PRIV 0x04 /* Priviledge Mode Enable */
685 687
686/* Single Root I/O Virtualization */ 688/* Single Root I/O Virtualization */
687#define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */ 689#define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */
diff --git a/include/linux/pda_power.h b/include/linux/pda_power.h
index c9e4d814ff77..2bb62bf296ac 100644
--- a/include/linux/pda_power.h
+++ b/include/linux/pda_power.h
@@ -35,6 +35,8 @@ struct pda_power_pdata {
35 unsigned int polling_interval; /* msecs, default is 2000 */ 35 unsigned int polling_interval; /* msecs, default is 2000 */
36 36
37 unsigned long ac_max_uA; /* current to draw when on AC */ 37 unsigned long ac_max_uA; /* current to draw when on AC */
38
39 bool use_otg_notifier;
38}; 40};
39 41
40#endif /* __PDA_POWER_H__ */ 42#endif /* __PDA_POWER_H__ */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 9ca008f0c542..21638ae14e07 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -172,10 +172,10 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
172 * equal char, int or long. percpu_read() evaluates to a lvalue and 172 * equal char, int or long. percpu_read() evaluates to a lvalue and
173 * all others to void. 173 * all others to void.
174 * 174 *
175 * These operations are guaranteed to be atomic w.r.t. preemption. 175 * These operations are guaranteed to be atomic.
176 * The generic versions use plain get/put_cpu_var(). Archs are 176 * The generic versions disable interrupts. Archs are
177 * encouraged to implement single-instruction alternatives which don't 177 * encouraged to implement single-instruction alternatives which don't
178 * require preemption protection. 178 * require protection.
179 */ 179 */
180#ifndef percpu_read 180#ifndef percpu_read
181# define percpu_read(var) \ 181# define percpu_read(var) \
@@ -347,9 +347,10 @@ do { \
347 347
348#define _this_cpu_generic_to_op(pcp, val, op) \ 348#define _this_cpu_generic_to_op(pcp, val, op) \
349do { \ 349do { \
350 preempt_disable(); \ 350 unsigned long flags; \
351 raw_local_irq_save(flags); \
351 *__this_cpu_ptr(&(pcp)) op val; \ 352 *__this_cpu_ptr(&(pcp)) op val; \
352 preempt_enable(); \ 353 raw_local_irq_restore(flags); \
353} while (0) 354} while (0)
354 355
355#ifndef this_cpu_write 356#ifndef this_cpu_write
@@ -447,10 +448,11 @@ do { \
447#define _this_cpu_generic_add_return(pcp, val) \ 448#define _this_cpu_generic_add_return(pcp, val) \
448({ \ 449({ \
449 typeof(pcp) ret__; \ 450 typeof(pcp) ret__; \
450 preempt_disable(); \ 451 unsigned long flags; \
452 raw_local_irq_save(flags); \
451 __this_cpu_add(pcp, val); \ 453 __this_cpu_add(pcp, val); \
452 ret__ = __this_cpu_read(pcp); \ 454 ret__ = __this_cpu_read(pcp); \
453 preempt_enable(); \ 455 raw_local_irq_restore(flags); \
454 ret__; \ 456 ret__; \
455}) 457})
456 458
@@ -476,10 +478,11 @@ do { \
476 478
477#define _this_cpu_generic_xchg(pcp, nval) \ 479#define _this_cpu_generic_xchg(pcp, nval) \
478({ typeof(pcp) ret__; \ 480({ typeof(pcp) ret__; \
479 preempt_disable(); \ 481 unsigned long flags; \
482 raw_local_irq_save(flags); \
480 ret__ = __this_cpu_read(pcp); \ 483 ret__ = __this_cpu_read(pcp); \
481 __this_cpu_write(pcp, nval); \ 484 __this_cpu_write(pcp, nval); \
482 preempt_enable(); \ 485 raw_local_irq_restore(flags); \
483 ret__; \ 486 ret__; \
484}) 487})
485 488
@@ -501,12 +504,14 @@ do { \
501#endif 504#endif
502 505
503#define _this_cpu_generic_cmpxchg(pcp, oval, nval) \ 506#define _this_cpu_generic_cmpxchg(pcp, oval, nval) \
504({ typeof(pcp) ret__; \ 507({ \
505 preempt_disable(); \ 508 typeof(pcp) ret__; \
509 unsigned long flags; \
510 raw_local_irq_save(flags); \
506 ret__ = __this_cpu_read(pcp); \ 511 ret__ = __this_cpu_read(pcp); \
507 if (ret__ == (oval)) \ 512 if (ret__ == (oval)) \
508 __this_cpu_write(pcp, nval); \ 513 __this_cpu_write(pcp, nval); \
509 preempt_enable(); \ 514 raw_local_irq_restore(flags); \
510 ret__; \ 515 ret__; \
511}) 516})
512 517
@@ -538,10 +543,11 @@ do { \
538#define _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ 543#define _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
539({ \ 544({ \
540 int ret__; \ 545 int ret__; \
541 preempt_disable(); \ 546 unsigned long flags; \
547 raw_local_irq_save(flags); \
542 ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \ 548 ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \
543 oval1, oval2, nval1, nval2); \ 549 oval1, oval2, nval1, nval2); \
544 preempt_enable(); \ 550 raw_local_irq_restore(flags); \
545 ret__; \ 551 ret__; \
546}) 552})
547 553
@@ -567,9 +573,9 @@ do { \
567#endif 573#endif
568 574
569/* 575/*
570 * Generic percpu operations that do not require preemption handling. 576 * Generic percpu operations for context that are safe from preemption/interrupts.
571 * Either we do not care about races or the caller has the 577 * Either we do not care about races or the caller has the
572 * responsibility of handling preemptions issues. Arch code can still 578 * responsibility of handling preemption/interrupt issues. Arch code can still
573 * override these instructions since the arch per cpu code may be more 579 * override these instructions since the arch per cpu code may be more
574 * efficient and may actually get race freeness for free (that is the 580 * efficient and may actually get race freeness for free (that is the
575 * case for x86 for example). 581 * case for x86 for example).
@@ -712,12 +718,13 @@ do { \
712# ifndef __this_cpu_add_return_8 718# ifndef __this_cpu_add_return_8
713# define __this_cpu_add_return_8(pcp, val) __this_cpu_generic_add_return(pcp, val) 719# define __this_cpu_add_return_8(pcp, val) __this_cpu_generic_add_return(pcp, val)
714# endif 720# endif
715# define __this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val) 721# define __this_cpu_add_return(pcp, val) \
722 __pcpu_size_call_return2(__this_cpu_add_return_, pcp, val)
716#endif 723#endif
717 724
718#define __this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(val)) 725#define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(val))
719#define __this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1) 726#define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1)
720#define __this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1) 727#define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1)
721 728
722#define __this_cpu_generic_xchg(pcp, nval) \ 729#define __this_cpu_generic_xchg(pcp, nval) \
723({ typeof(pcp) ret__; \ 730({ typeof(pcp) ret__; \
@@ -802,156 +809,4 @@ do { \
802 __pcpu_double_call_return_bool(__this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2)) 809 __pcpu_double_call_return_bool(__this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
803#endif 810#endif
804 811
805/*
806 * IRQ safe versions of the per cpu RMW operations. Note that these operations
807 * are *not* safe against modification of the same variable from another
808 * processors (which one gets when using regular atomic operations)
809 * They are guaranteed to be atomic vs. local interrupts and
810 * preemption only.
811 */
812#define irqsafe_cpu_generic_to_op(pcp, val, op) \
813do { \
814 unsigned long flags; \
815 local_irq_save(flags); \
816 *__this_cpu_ptr(&(pcp)) op val; \
817 local_irq_restore(flags); \
818} while (0)
819
820#ifndef irqsafe_cpu_add
821# ifndef irqsafe_cpu_add_1
822# define irqsafe_cpu_add_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=)
823# endif
824# ifndef irqsafe_cpu_add_2
825# define irqsafe_cpu_add_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=)
826# endif
827# ifndef irqsafe_cpu_add_4
828# define irqsafe_cpu_add_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=)
829# endif
830# ifndef irqsafe_cpu_add_8
831# define irqsafe_cpu_add_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=)
832# endif
833# define irqsafe_cpu_add(pcp, val) __pcpu_size_call(irqsafe_cpu_add_, (pcp), (val))
834#endif
835
836#ifndef irqsafe_cpu_sub
837# define irqsafe_cpu_sub(pcp, val) irqsafe_cpu_add((pcp), -(val))
838#endif
839
840#ifndef irqsafe_cpu_inc
841# define irqsafe_cpu_inc(pcp) irqsafe_cpu_add((pcp), 1)
842#endif
843
844#ifndef irqsafe_cpu_dec
845# define irqsafe_cpu_dec(pcp) irqsafe_cpu_sub((pcp), 1)
846#endif
847
848#ifndef irqsafe_cpu_and
849# ifndef irqsafe_cpu_and_1
850# define irqsafe_cpu_and_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=)
851# endif
852# ifndef irqsafe_cpu_and_2
853# define irqsafe_cpu_and_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=)
854# endif
855# ifndef irqsafe_cpu_and_4
856# define irqsafe_cpu_and_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=)
857# endif
858# ifndef irqsafe_cpu_and_8
859# define irqsafe_cpu_and_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=)
860# endif
861# define irqsafe_cpu_and(pcp, val) __pcpu_size_call(irqsafe_cpu_and_, (val))
862#endif
863
864#ifndef irqsafe_cpu_or
865# ifndef irqsafe_cpu_or_1
866# define irqsafe_cpu_or_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=)
867# endif
868# ifndef irqsafe_cpu_or_2
869# define irqsafe_cpu_or_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=)
870# endif
871# ifndef irqsafe_cpu_or_4
872# define irqsafe_cpu_or_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=)
873# endif
874# ifndef irqsafe_cpu_or_8
875# define irqsafe_cpu_or_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=)
876# endif
877# define irqsafe_cpu_or(pcp, val) __pcpu_size_call(irqsafe_cpu_or_, (val))
878#endif
879
880#ifndef irqsafe_cpu_xor
881# ifndef irqsafe_cpu_xor_1
882# define irqsafe_cpu_xor_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=)
883# endif
884# ifndef irqsafe_cpu_xor_2
885# define irqsafe_cpu_xor_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=)
886# endif
887# ifndef irqsafe_cpu_xor_4
888# define irqsafe_cpu_xor_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=)
889# endif
890# ifndef irqsafe_cpu_xor_8
891# define irqsafe_cpu_xor_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=)
892# endif
893# define irqsafe_cpu_xor(pcp, val) __pcpu_size_call(irqsafe_cpu_xor_, (val))
894#endif
895
896#define irqsafe_cpu_generic_cmpxchg(pcp, oval, nval) \
897({ \
898 typeof(pcp) ret__; \
899 unsigned long flags; \
900 local_irq_save(flags); \
901 ret__ = __this_cpu_read(pcp); \
902 if (ret__ == (oval)) \
903 __this_cpu_write(pcp, nval); \
904 local_irq_restore(flags); \
905 ret__; \
906})
907
908#ifndef irqsafe_cpu_cmpxchg
909# ifndef irqsafe_cpu_cmpxchg_1
910# define irqsafe_cpu_cmpxchg_1(pcp, oval, nval) irqsafe_cpu_generic_cmpxchg(pcp, oval, nval)
911# endif
912# ifndef irqsafe_cpu_cmpxchg_2
913# define irqsafe_cpu_cmpxchg_2(pcp, oval, nval) irqsafe_cpu_generic_cmpxchg(pcp, oval, nval)
914# endif
915# ifndef irqsafe_cpu_cmpxchg_4
916# define irqsafe_cpu_cmpxchg_4(pcp, oval, nval) irqsafe_cpu_generic_cmpxchg(pcp, oval, nval)
917# endif
918# ifndef irqsafe_cpu_cmpxchg_8
919# define irqsafe_cpu_cmpxchg_8(pcp, oval, nval) irqsafe_cpu_generic_cmpxchg(pcp, oval, nval)
920# endif
921# define irqsafe_cpu_cmpxchg(pcp, oval, nval) \
922 __pcpu_size_call_return2(irqsafe_cpu_cmpxchg_, (pcp), oval, nval)
923#endif
924
925#define irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
926({ \
927 int ret__; \
928 unsigned long flags; \
929 local_irq_save(flags); \
930 ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \
931 oval1, oval2, nval1, nval2); \
932 local_irq_restore(flags); \
933 ret__; \
934})
935
936#ifndef irqsafe_cpu_cmpxchg_double
937# ifndef irqsafe_cpu_cmpxchg_double_1
938# define irqsafe_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
939 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
940# endif
941# ifndef irqsafe_cpu_cmpxchg_double_2
942# define irqsafe_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
943 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
944# endif
945# ifndef irqsafe_cpu_cmpxchg_double_4
946# define irqsafe_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
947 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
948# endif
949# ifndef irqsafe_cpu_cmpxchg_double_8
950# define irqsafe_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
951 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
952# endif
953# define irqsafe_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
954 __pcpu_double_call_return_bool(irqsafe_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
955#endif
956
957#endif /* __LINUX_PERCPU_H */ 812#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index b1f89122bf6a..abb2776be1ba 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -54,6 +54,7 @@ enum perf_hw_id {
54 PERF_COUNT_HW_BUS_CYCLES = 6, 54 PERF_COUNT_HW_BUS_CYCLES = 6,
55 PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7, 55 PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7,
56 PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8, 56 PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8,
57 PERF_COUNT_HW_REF_CPU_CYCLES = 9,
57 58
58 PERF_COUNT_HW_MAX, /* non-ABI */ 59 PERF_COUNT_HW_MAX, /* non-ABI */
59}; 60};
@@ -586,6 +587,7 @@ struct hw_perf_event {
586 u64 sample_period; 587 u64 sample_period;
587 u64 last_period; 588 u64 last_period;
588 local64_t period_left; 589 local64_t period_left;
590 u64 interrupts_seq;
589 u64 interrupts; 591 u64 interrupts;
590 592
591 u64 freq_time_stamp; 593 u64 freq_time_stamp;
@@ -890,6 +892,7 @@ struct perf_event_context {
890 int nr_active; 892 int nr_active;
891 int is_active; 893 int is_active;
892 int nr_stat; 894 int nr_stat;
895 int nr_freq;
893 int rotate_disable; 896 int rotate_disable;
894 atomic_t refcount; 897 atomic_t refcount;
895 struct task_struct *task; 898 struct task_struct *task;
@@ -1063,12 +1066,12 @@ perf_sw_event(u32 event_id, u64 nr, struct pt_regs *regs, u64 addr)
1063 } 1066 }
1064} 1067}
1065 1068
1066extern struct jump_label_key perf_sched_events; 1069extern struct jump_label_key_deferred perf_sched_events;
1067 1070
1068static inline void perf_event_task_sched_in(struct task_struct *prev, 1071static inline void perf_event_task_sched_in(struct task_struct *prev,
1069 struct task_struct *task) 1072 struct task_struct *task)
1070{ 1073{
1071 if (static_branch(&perf_sched_events)) 1074 if (static_branch(&perf_sched_events.key))
1072 __perf_event_task_sched_in(prev, task); 1075 __perf_event_task_sched_in(prev, task);
1073} 1076}
1074 1077
@@ -1077,7 +1080,7 @@ static inline void perf_event_task_sched_out(struct task_struct *prev,
1077{ 1080{
1078 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0); 1081 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0);
1079 1082
1080 if (static_branch(&perf_sched_events)) 1083 if (static_branch(&perf_sched_events.key))
1081 __perf_event_task_sched_out(prev, next); 1084 __perf_event_task_sched_out(prev, next);
1082} 1085}
1083 1086
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
index f53a4167c5f4..f48bfc80cb4b 100644
--- a/include/linux/phonet.h
+++ b/include/linux/phonet.h
@@ -38,6 +38,7 @@
38#define PNPIPE_ENCAP 1 38#define PNPIPE_ENCAP 1
39#define PNPIPE_IFINDEX 2 39#define PNPIPE_IFINDEX 2
40#define PNPIPE_HANDLE 3 40#define PNPIPE_HANDLE 3
41#define PNPIPE_INITSTATE 4
41 42
42#define PNADDR_ANY 0 43#define PNADDR_ANY 0
43#define PNADDR_BROADCAST 0xFC 44#define PNADDR_BROADCAST 0xFC
@@ -49,6 +50,7 @@
49 50
50/* ioctls */ 51/* ioctls */
51#define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0) 52#define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0)
53#define SIOCPNENABLEPIPE (SIOCPROTOPRIVATE + 13)
52#define SIOCPNADDRESOURCE (SIOCPROTOPRIVATE + 14) 54#define SIOCPNADDRESOURCE (SIOCPROTOPRIVATE + 14)
53#define SIOCPNDELRESOURCE (SIOCPROTOPRIVATE + 15) 55#define SIOCPNDELRESOURCE (SIOCPROTOPRIVATE + 15)
54 56
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 79f337c47388..c599f7eca1e7 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -129,7 +129,12 @@ struct mii_bus {
129}; 129};
130#define to_mii_bus(d) container_of(d, struct mii_bus, dev) 130#define to_mii_bus(d) container_of(d, struct mii_bus, dev)
131 131
132struct mii_bus *mdiobus_alloc(void); 132struct mii_bus *mdiobus_alloc_size(size_t);
133static inline struct mii_bus *mdiobus_alloc(void)
134{
135 return mdiobus_alloc_size(0);
136}
137
133int mdiobus_register(struct mii_bus *bus); 138int mdiobus_register(struct mii_bus *bus);
134void mdiobus_unregister(struct mii_bus *bus); 139void mdiobus_unregister(struct mii_bus *bus);
135void mdiobus_free(struct mii_bus *bus); 140void mdiobus_free(struct mii_bus *bus);
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 38d10326246a..e7cf6669ac34 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -30,6 +30,8 @@ struct pid_namespace {
30#ifdef CONFIG_BSD_PROCESS_ACCT 30#ifdef CONFIG_BSD_PROCESS_ACCT
31 struct bsd_acct_struct *bacct; 31 struct bsd_acct_struct *bacct;
32#endif 32#endif
33 gid_t pid_gid;
34 int hide_pid;
33}; 35};
34 36
35extern struct pid_namespace init_pid_ns; 37extern struct pid_namespace init_pid_ns;
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h
index 88863531d862..d0aecb7f6fb9 100644
--- a/include/linux/pinctrl/machine.h
+++ b/include/linux/pinctrl/machine.h
@@ -48,7 +48,7 @@ struct pinmux_map {
48 const char *group; 48 const char *group;
49 struct device *dev; 49 struct device *dev;
50 const char *dev_name; 50 const char *dev_name;
51 const bool hog_on_boot; 51 bool hog_on_boot;
52}; 52};
53 53
54/* 54/*
@@ -66,30 +66,22 @@ struct pinmux_map {
66 { .name = a, .ctrl_dev_name = b, .function = c } 66 { .name = a, .ctrl_dev_name = b, .function = c }
67 67
68/* 68/*
69 * Convenience macro to map a function onto the primary device pinctrl device 69 * Convenience macro to map a system function onto a certain pinctrl device,
70 * this is especially helpful on systems that have only one pin controller 70 * to be hogged by the pinmux core until the system shuts down.
71 * or need to set up a lot of mappings on the primary controller.
72 */
73#define PINMUX_MAP_PRIMARY(a, b, c) \
74 { .name = a, .ctrl_dev_name = "pinctrl.0", .function = b, \
75 .dev_name = c }
76
77/*
78 * Convenience macro to map a system function onto the primary pinctrl device.
79 * System functions are not assigned to a particular device.
80 */ 71 */
81#define PINMUX_MAP_PRIMARY_SYS(a, b) \ 72#define PINMUX_MAP_SYS_HOG(a, b, c) \
82 { .name = a, .ctrl_dev_name = "pinctrl.0", .function = b } 73 { .name = a, .ctrl_dev_name = b, .function = c, \
74 .hog_on_boot = true }
83 75
84/* 76/*
85 * Convenience macro to map a system function onto the primary pinctrl device, 77 * Convenience macro to map a system function onto a certain pinctrl device
86 * to be hogged by the pinmux core until the system shuts down. 78 * using a specified group, to be hogged by the pinmux core until the system
79 * shuts down.
87 */ 80 */
88#define PINMUX_MAP_PRIMARY_SYS_HOG(a, b) \ 81#define PINMUX_MAP_SYS_HOG_GROUP(a, b, c, d) \
89 { .name = a, .ctrl_dev_name = "pinctrl.0", .function = b, \ 82 { .name = a, .ctrl_dev_name = b, .function = c, .group = d, \
90 .hog_on_boot = true } 83 .hog_on_boot = true }
91 84
92
93#ifdef CONFIG_PINMUX 85#ifdef CONFIG_PINMUX
94 86
95extern int pinmux_register_mappings(struct pinmux_map const *map, 87extern int pinmux_register_mappings(struct pinmux_map const *map,
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h
new file mode 100644
index 000000000000..477922cf043a
--- /dev/null
+++ b/include/linux/pinctrl/pinconf.h
@@ -0,0 +1,97 @@
1/*
2 * Interface the pinconfig portions of the pinctrl subsystem
3 *
4 * Copyright (C) 2011 ST-Ericsson SA
5 * Written on behalf of Linaro for ST-Ericsson
6 * This interface is used in the core to keep track of pins.
7 *
8 * Author: Linus Walleij <linus.walleij@linaro.org>
9 *
10 * License terms: GNU General Public License (GPL) version 2
11 */
12#ifndef __LINUX_PINCTRL_PINCONF_H
13#define __LINUX_PINCTRL_PINCONF_H
14
15#ifdef CONFIG_PINCONF
16
17struct pinctrl_dev;
18struct seq_file;
19
20/**
21 * struct pinconf_ops - pin config operations, to be implemented by
22 * pin configuration capable drivers.
23 * @pin_config_get: get the config of a certain pin, if the requested config
24 * is not available on this controller this should return -ENOTSUPP
25 * and if it is available but disabled it should return -EINVAL
26 * @pin_config_get: get the config of a certain pin
27 * @pin_config_set: configure an individual pin
28 * @pin_config_group_get: get configurations for an entire pin group
29 * @pin_config_group_set: configure all pins in a group
30 * @pin_config_dbg_show: optional debugfs display hook that will provide
31 * per-device info for a certain pin in debugfs
32 * @pin_config_group_dbg_show: optional debugfs display hook that will provide
33 * per-device info for a certain group in debugfs
34 */
35struct pinconf_ops {
36 int (*pin_config_get) (struct pinctrl_dev *pctldev,
37 unsigned pin,
38 unsigned long *config);
39 int (*pin_config_set) (struct pinctrl_dev *pctldev,
40 unsigned pin,
41 unsigned long config);
42 int (*pin_config_group_get) (struct pinctrl_dev *pctldev,
43 unsigned selector,
44 unsigned long *config);
45 int (*pin_config_group_set) (struct pinctrl_dev *pctldev,
46 unsigned selector,
47 unsigned long config);
48 void (*pin_config_dbg_show) (struct pinctrl_dev *pctldev,
49 struct seq_file *s,
50 unsigned offset);
51 void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev,
52 struct seq_file *s,
53 unsigned selector);
54};
55
56extern int pin_config_get(const char *dev_name, const char *name,
57 unsigned long *config);
58extern int pin_config_set(const char *dev_name, const char *name,
59 unsigned long config);
60extern int pin_config_group_get(const char *dev_name,
61 const char *pin_group,
62 unsigned long *config);
63extern int pin_config_group_set(const char *dev_name,
64 const char *pin_group,
65 unsigned long config);
66
67#else
68
69static inline int pin_config_get(const char *dev_name, const char *name,
70 unsigned long *config)
71{
72 return 0;
73}
74
75static inline int pin_config_set(const char *dev_name, const char *name,
76 unsigned long config)
77{
78 return 0;
79}
80
81static inline int pin_config_group_get(const char *dev_name,
82 const char *pin_group,
83 unsigned long *config)
84{
85 return 0;
86}
87
88static inline int pin_config_group_set(const char *dev_name,
89 const char *pin_group,
90 unsigned long config)
91{
92 return 0;
93}
94
95#endif
96
97#endif /* __LINUX_PINCTRL_PINCONF_H */
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 04c011038f32..8bd22ee7aa09 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -21,6 +21,7 @@
21 21
22struct pinctrl_dev; 22struct pinctrl_dev;
23struct pinmux_ops; 23struct pinmux_ops;
24struct pinconf_ops;
24struct gpio_chip; 25struct gpio_chip;
25 26
26/** 27/**
@@ -45,6 +46,7 @@ struct pinctrl_pin_desc {
45 * @name: a name for the chip in this range 46 * @name: a name for the chip in this range
46 * @id: an ID number for the chip in this range 47 * @id: an ID number for the chip in this range
47 * @base: base offset of the GPIO range 48 * @base: base offset of the GPIO range
49 * @pin_base: base pin number of the GPIO range
48 * @npins: number of pins in the GPIO range, including the base number 50 * @npins: number of pins in the GPIO range, including the base number
49 * @gc: an optional pointer to a gpio_chip 51 * @gc: an optional pointer to a gpio_chip
50 */ 52 */
@@ -53,6 +55,7 @@ struct pinctrl_gpio_range {
53 const char *name; 55 const char *name;
54 unsigned int id; 56 unsigned int id;
55 unsigned int base; 57 unsigned int base;
58 unsigned int pin_base;
56 unsigned int npins; 59 unsigned int npins;
57 struct gpio_chip *gc; 60 struct gpio_chip *gc;
58}; 61};
@@ -89,22 +92,20 @@ struct pinctrl_ops {
89 * this pin controller 92 * this pin controller
90 * @npins: number of descriptors in the array, usually just ARRAY_SIZE() 93 * @npins: number of descriptors in the array, usually just ARRAY_SIZE()
91 * of the pins field above 94 * of the pins field above
92 * @maxpin: since pin spaces may be sparse, there can he "holes" in the
93 * pin range, this attribute gives the maximum pin number in the
94 * total range. This should not be lower than npins for example,
95 * but may be equal to npins if you have no holes in the pin range.
96 * @pctlops: pin control operation vtable, to support global concepts like 95 * @pctlops: pin control operation vtable, to support global concepts like
97 * grouping of pins, this is optional. 96 * grouping of pins, this is optional.
98 * @pmxops: pinmux operation vtable, if you support pinmuxing in your driver 97 * @pmxops: pinmux operations vtable, if you support pinmuxing in your driver
98 * @confops: pin config operations vtable, if you support pin configuration in
99 * your driver
99 * @owner: module providing the pin controller, used for refcounting 100 * @owner: module providing the pin controller, used for refcounting
100 */ 101 */
101struct pinctrl_desc { 102struct pinctrl_desc {
102 const char *name; 103 const char *name;
103 struct pinctrl_pin_desc const *pins; 104 struct pinctrl_pin_desc const *pins;
104 unsigned int npins; 105 unsigned int npins;
105 unsigned int maxpin;
106 struct pinctrl_ops *pctlops; 106 struct pinctrl_ops *pctlops;
107 struct pinmux_ops *pmxops; 107 struct pinmux_ops *pmxops;
108 struct pinconf_ops *confops;
108 struct module *owner; 109 struct module *owner;
109}; 110};
110 111
@@ -123,7 +124,7 @@ extern void *pinctrl_dev_get_drvdata(struct pinctrl_dev *pctldev);
123 124
124struct pinctrl_dev; 125struct pinctrl_dev;
125 126
126/* Sufficiently stupid default function when pinctrl is not in use */ 127/* Sufficiently stupid default functions when pinctrl is not in use */
127static inline bool pin_is_valid(struct pinctrl_dev *pctldev, int pin) 128static inline bool pin_is_valid(struct pinctrl_dev *pctldev, int pin)
128{ 129{
129 return pin >= 0; 130 return pin >= 0;
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
index 3c430e797efc..937b3e2fa36f 100644
--- a/include/linux/pinctrl/pinmux.h
+++ b/include/linux/pinctrl/pinmux.h
@@ -52,9 +52,15 @@ struct pinctrl_dev;
52 * @disable: disable a certain muxing selector with a certain pin group 52 * @disable: disable a certain muxing selector with a certain pin group
53 * @gpio_request_enable: requests and enables GPIO on a certain pin. 53 * @gpio_request_enable: requests and enables GPIO on a certain pin.
54 * Implement this only if you can mux every pin individually as GPIO. The 54 * Implement this only if you can mux every pin individually as GPIO. The
55 * affected GPIO range is passed along with an offset into that 55 * affected GPIO range is passed along with an offset(pin number) into that
56 * specific GPIO range - function selectors and pin groups are orthogonal 56 * specific GPIO range - function selectors and pin groups are orthogonal
57 * to this, the core will however make sure the pins do not collide 57 * to this, the core will however make sure the pins do not collide.
58 * @gpio_disable_free: free up GPIO muxing on a certain pin, the reverse of
59 * @gpio_request_enable
60 * @gpio_set_direction: Since controllers may need different configurations
61 * depending on whether the GPIO is configured as input or output,
62 * a direction selector function may be implemented as a backing
63 * to the GPIO controllers that need pin muxing.
58 */ 64 */
59struct pinmux_ops { 65struct pinmux_ops {
60 int (*request) (struct pinctrl_dev *pctldev, unsigned offset); 66 int (*request) (struct pinctrl_dev *pctldev, unsigned offset);
@@ -73,11 +79,20 @@ struct pinmux_ops {
73 int (*gpio_request_enable) (struct pinctrl_dev *pctldev, 79 int (*gpio_request_enable) (struct pinctrl_dev *pctldev,
74 struct pinctrl_gpio_range *range, 80 struct pinctrl_gpio_range *range,
75 unsigned offset); 81 unsigned offset);
82 void (*gpio_disable_free) (struct pinctrl_dev *pctldev,
83 struct pinctrl_gpio_range *range,
84 unsigned offset);
85 int (*gpio_set_direction) (struct pinctrl_dev *pctldev,
86 struct pinctrl_gpio_range *range,
87 unsigned offset,
88 bool input);
76}; 89};
77 90
78/* External interface to pinmux */ 91/* External interface to pinmux */
79extern int pinmux_request_gpio(unsigned gpio); 92extern int pinmux_request_gpio(unsigned gpio);
80extern void pinmux_free_gpio(unsigned gpio); 93extern void pinmux_free_gpio(unsigned gpio);
94extern int pinmux_gpio_direction_input(unsigned gpio);
95extern int pinmux_gpio_direction_output(unsigned gpio);
81extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name); 96extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name);
82extern void pinmux_put(struct pinmux *pmx); 97extern void pinmux_put(struct pinmux *pmx);
83extern int pinmux_enable(struct pinmux *pmx); 98extern int pinmux_enable(struct pinmux *pmx);
@@ -94,6 +109,16 @@ static inline void pinmux_free_gpio(unsigned gpio)
94{ 109{
95} 110}
96 111
112static inline int pinmux_gpio_direction_input(unsigned gpio)
113{
114 return 0;
115}
116
117static inline int pinmux_gpio_direction_output(unsigned gpio)
118{
119 return 0;
120}
121
97static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name) 122static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name)
98{ 123{
99 return NULL; 124 return NULL;
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 7281d5acf2f9..0d5b79365d03 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -162,25 +162,44 @@ struct tc_sfq_qopt {
162 unsigned flows; /* Maximal number of flows */ 162 unsigned flows; /* Maximal number of flows */
163}; 163};
164 164
165struct tc_sfqred_stats {
166 __u32 prob_drop; /* Early drops, below max threshold */
167 __u32 forced_drop; /* Early drops, after max threshold */
168 __u32 prob_mark; /* Marked packets, below max threshold */
169 __u32 forced_mark; /* Marked packets, after max threshold */
170 __u32 prob_mark_head; /* Marked packets, below max threshold */
171 __u32 forced_mark_head;/* Marked packets, after max threshold */
172};
173
174struct tc_sfq_qopt_v1 {
175 struct tc_sfq_qopt v0;
176 unsigned int depth; /* max number of packets per flow */
177 unsigned int headdrop;
178/* SFQRED parameters */
179 __u32 limit; /* HARD maximal flow queue length (bytes) */
180 __u32 qth_min; /* Min average length threshold (bytes) */
181 __u32 qth_max; /* Max average length threshold (bytes) */
182 unsigned char Wlog; /* log(W) */
183 unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
184 unsigned char Scell_log; /* cell size for idle damping */
185 unsigned char flags;
186 __u32 max_P; /* probability, high resolution */
187/* SFQRED stats */
188 struct tc_sfqred_stats stats;
189};
190
191
165struct tc_sfq_xstats { 192struct tc_sfq_xstats {
166 __s32 allot; 193 __s32 allot;
167}; 194};
168 195
169/*
170 * NOTE: limit, divisor and flows are hardwired to code at the moment.
171 *
172 * limit=flows=128, divisor=1024;
173 *
174 * The only reason for this is efficiency, it is possible
175 * to change these parameters in compile time.
176 */
177
178/* RED section */ 196/* RED section */
179 197
180enum { 198enum {
181 TCA_RED_UNSPEC, 199 TCA_RED_UNSPEC,
182 TCA_RED_PARMS, 200 TCA_RED_PARMS,
183 TCA_RED_STAB, 201 TCA_RED_STAB,
202 TCA_RED_MAX_P,
184 __TCA_RED_MAX, 203 __TCA_RED_MAX,
185}; 204};
186 205
@@ -194,8 +213,9 @@ struct tc_red_qopt {
194 unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ 213 unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
195 unsigned char Scell_log; /* cell size for idle damping */ 214 unsigned char Scell_log; /* cell size for idle damping */
196 unsigned char flags; 215 unsigned char flags;
197#define TC_RED_ECN 1 216#define TC_RED_ECN 1
198#define TC_RED_HARDDROP 2 217#define TC_RED_HARDDROP 2
218#define TC_RED_ADAPTATIVE 4
199}; 219};
200 220
201struct tc_red_xstats { 221struct tc_red_xstats {
@@ -214,6 +234,7 @@ enum {
214 TCA_GRED_PARMS, 234 TCA_GRED_PARMS,
215 TCA_GRED_STAB, 235 TCA_GRED_STAB,
216 TCA_GRED_DPS, 236 TCA_GRED_DPS,
237 TCA_GRED_MAX_P,
217 __TCA_GRED_MAX, 238 __TCA_GRED_MAX,
218}; 239};
219 240
@@ -253,6 +274,7 @@ enum {
253 TCA_CHOKE_UNSPEC, 274 TCA_CHOKE_UNSPEC,
254 TCA_CHOKE_PARMS, 275 TCA_CHOKE_PARMS,
255 TCA_CHOKE_STAB, 276 TCA_CHOKE_STAB,
277 TCA_CHOKE_MAX_P,
256 __TCA_CHOKE_MAX, 278 __TCA_CHOKE_MAX,
257}; 279};
258 280
@@ -465,6 +487,7 @@ enum {
465 TCA_NETEM_REORDER, 487 TCA_NETEM_REORDER,
466 TCA_NETEM_CORRUPT, 488 TCA_NETEM_CORRUPT,
467 TCA_NETEM_LOSS, 489 TCA_NETEM_LOSS,
490 TCA_NETEM_RATE,
468 __TCA_NETEM_MAX, 491 __TCA_NETEM_MAX,
469}; 492};
470 493
@@ -495,6 +518,13 @@ struct tc_netem_corrupt {
495 __u32 correlation; 518 __u32 correlation;
496}; 519};
497 520
521struct tc_netem_rate {
522 __u32 rate; /* byte/s */
523 __s32 packet_overhead;
524 __u32 cell_size;
525 __s32 cell_overhead;
526};
527
498enum { 528enum {
499 NETEM_LOSS_UNSPEC, 529 NETEM_LOSS_UNSPEC,
500 NETEM_LOSS_GI, /* General Intuitive - 4 state model */ 530 NETEM_LOSS_GI, /* General Intuitive - 4 state model */
diff --git a/include/linux/platform_data/macb.h b/include/linux/platform_data/macb.h
new file mode 100644
index 000000000000..b081c7245ec8
--- /dev/null
+++ b/include/linux/platform_data/macb.h
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __MACB_PDATA_H__
9#define __MACB_PDATA_H__
10
11struct macb_platform_data {
12 u32 phy_mask;
13 int phy_irq_pin; /* PHY IRQ */
14 u8 is_rmii; /* using RMII interface? */
15};
16
17#endif /* __MACB_PDATA_H__ */
diff --git a/include/linux/platform_data/mv_usb.h b/include/linux/platform_data/mv_usb.h
index e9d9149ddf38..d94804aca764 100644
--- a/include/linux/platform_data/mv_usb.h
+++ b/include/linux/platform_data/mv_usb.h
@@ -42,9 +42,23 @@ struct mv_usb_platform_data {
42 /* only valid for HCD. OTG or Host only*/ 42 /* only valid for HCD. OTG or Host only*/
43 unsigned int mode; 43 unsigned int mode;
44 44
45 int (*phy_init)(unsigned int regbase); 45 /* This flag is used for that needs id pin checked by otg */
46 void (*phy_deinit)(unsigned int regbase); 46 unsigned int disable_otg_clock_gating:1;
47 /* Force a_bus_req to be asserted */
48 unsigned int otg_force_a_bus_req:1;
49
50 int (*phy_init)(void __iomem *regbase);
51 void (*phy_deinit)(void __iomem *regbase);
47 int (*set_vbus)(unsigned int vbus); 52 int (*set_vbus)(unsigned int vbus);
53 int (*private_init)(void __iomem *opregs, void __iomem *phyregs);
48}; 54};
49 55
56#ifndef CONFIG_HAVE_CLK
57/* Dummy stub for clk framework */
58#define clk_get(dev, id) NULL
59#define clk_put(clock) do {} while (0)
60#define clk_enable(clock) do {} while (0)
61#define clk_disable(clock) do {} while (0)
62#endif
63
50#endif 64#endif
diff --git a/include/linux/platform_data/s3c-hsudc.h b/include/linux/platform_data/s3c-hsudc.h
new file mode 100644
index 000000000000..6fa109339bf9
--- /dev/null
+++ b/include/linux/platform_data/s3c-hsudc.h
@@ -0,0 +1,34 @@
1/*
2 * S3C24XX USB 2.0 High-speed USB controller gadget driver
3 *
4 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com/
6 *
7 * The S3C24XX USB 2.0 high-speed USB controller supports upto 9 endpoints.
8 * Each endpoint can be configured as either in or out endpoint. Endpoints
9 * can be configured for Bulk or Interrupt transfer mode.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14*/
15
16#ifndef __LINUX_USB_S3C_HSUDC_H
17#define __LINUX_USB_S3C_HSUDC_H
18
19/**
20 * s3c24xx_hsudc_platdata - Platform data for USB High-Speed gadget controller.
21 * @epnum: Number of endpoints to be instantiated by the controller driver.
22 * @gpio_init: Platform specific USB related GPIO initialization.
23 * @gpio_uninit: Platform specific USB releted GPIO uninitialzation.
24 *
25 * Representation of platform data for the S3C24XX USB 2.0 High Speed gadget
26 * controllers.
27 */
28struct s3c24xx_hsudc_platdata {
29 unsigned int epnum;
30 void (*gpio_init)(void);
31 void (*gpio_uninit)(void);
32};
33
34#endif /* __LINUX_USB_S3C_HSUDC_H */
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 2a23f7d1a825..60e9994ef405 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -63,7 +63,7 @@ struct platform_device_info {
63 u64 dma_mask; 63 u64 dma_mask;
64}; 64};
65extern struct platform_device *platform_device_register_full( 65extern struct platform_device *platform_device_register_full(
66 struct platform_device_info *pdevinfo); 66 const struct platform_device_info *pdevinfo);
67 67
68/** 68/**
69 * platform_device_register_resndata - add a platform-level device with 69 * platform_device_register_resndata - add a platform-level device with
@@ -196,16 +196,8 @@ static inline void platform_set_drvdata(struct platform_device *pdev, void *data
196 * calling it replaces module_init() and module_exit() 196 * calling it replaces module_init() and module_exit()
197 */ 197 */
198#define module_platform_driver(__platform_driver) \ 198#define module_platform_driver(__platform_driver) \
199static int __init __platform_driver##_init(void) \ 199 module_driver(__platform_driver, platform_driver_register, \
200{ \ 200 platform_driver_unregister)
201 return platform_driver_register(&(__platform_driver)); \
202} \
203module_init(__platform_driver##_init); \
204static void __exit __platform_driver##_exit(void) \
205{ \
206 platform_driver_unregister(&(__platform_driver)); \
207} \
208module_exit(__platform_driver##_exit);
209 201
210extern struct platform_device *platform_create_bundle(struct platform_driver *driver, 202extern struct platform_device *platform_create_bundle(struct platform_driver *driver,
211 int (*probe)(struct platform_device *), 203 int (*probe)(struct platform_device *),
@@ -264,62 +256,34 @@ static inline char *early_platform_driver_setup_func(void) \
264} 256}
265#endif /* MODULE */ 257#endif /* MODULE */
266 258
267#ifdef CONFIG_PM_SLEEP
268extern int platform_pm_prepare(struct device *dev);
269extern void platform_pm_complete(struct device *dev);
270#else
271#define platform_pm_prepare NULL
272#define platform_pm_complete NULL
273#endif
274
275#ifdef CONFIG_SUSPEND 259#ifdef CONFIG_SUSPEND
276extern int platform_pm_suspend(struct device *dev); 260extern int platform_pm_suspend(struct device *dev);
277extern int platform_pm_suspend_noirq(struct device *dev);
278extern int platform_pm_resume(struct device *dev); 261extern int platform_pm_resume(struct device *dev);
279extern int platform_pm_resume_noirq(struct device *dev);
280#else 262#else
281#define platform_pm_suspend NULL 263#define platform_pm_suspend NULL
282#define platform_pm_resume NULL 264#define platform_pm_resume NULL
283#define platform_pm_suspend_noirq NULL
284#define platform_pm_resume_noirq NULL
285#endif 265#endif
286 266
287#ifdef CONFIG_HIBERNATE_CALLBACKS 267#ifdef CONFIG_HIBERNATE_CALLBACKS
288extern int platform_pm_freeze(struct device *dev); 268extern int platform_pm_freeze(struct device *dev);
289extern int platform_pm_freeze_noirq(struct device *dev);
290extern int platform_pm_thaw(struct device *dev); 269extern int platform_pm_thaw(struct device *dev);
291extern int platform_pm_thaw_noirq(struct device *dev);
292extern int platform_pm_poweroff(struct device *dev); 270extern int platform_pm_poweroff(struct device *dev);
293extern int platform_pm_poweroff_noirq(struct device *dev);
294extern int platform_pm_restore(struct device *dev); 271extern int platform_pm_restore(struct device *dev);
295extern int platform_pm_restore_noirq(struct device *dev);
296#else 272#else
297#define platform_pm_freeze NULL 273#define platform_pm_freeze NULL
298#define platform_pm_thaw NULL 274#define platform_pm_thaw NULL
299#define platform_pm_poweroff NULL 275#define platform_pm_poweroff NULL
300#define platform_pm_restore NULL 276#define platform_pm_restore NULL
301#define platform_pm_freeze_noirq NULL
302#define platform_pm_thaw_noirq NULL
303#define platform_pm_poweroff_noirq NULL
304#define platform_pm_restore_noirq NULL
305#endif 277#endif
306 278
307#ifdef CONFIG_PM_SLEEP 279#ifdef CONFIG_PM_SLEEP
308#define USE_PLATFORM_PM_SLEEP_OPS \ 280#define USE_PLATFORM_PM_SLEEP_OPS \
309 .prepare = platform_pm_prepare, \
310 .complete = platform_pm_complete, \
311 .suspend = platform_pm_suspend, \ 281 .suspend = platform_pm_suspend, \
312 .resume = platform_pm_resume, \ 282 .resume = platform_pm_resume, \
313 .freeze = platform_pm_freeze, \ 283 .freeze = platform_pm_freeze, \
314 .thaw = platform_pm_thaw, \ 284 .thaw = platform_pm_thaw, \
315 .poweroff = platform_pm_poweroff, \ 285 .poweroff = platform_pm_poweroff, \
316 .restore = platform_pm_restore, \ 286 .restore = platform_pm_restore,
317 .suspend_noirq = platform_pm_suspend_noirq, \
318 .resume_noirq = platform_pm_resume_noirq, \
319 .freeze_noirq = platform_pm_freeze_noirq, \
320 .thaw_noirq = platform_pm_thaw_noirq, \
321 .poweroff_noirq = platform_pm_poweroff_noirq, \
322 .restore_noirq = platform_pm_restore_noirq,
323#else 287#else
324#define USE_PLATFORM_PM_SLEEP_OPS 288#define USE_PLATFORM_PM_SLEEP_OPS
325#endif 289#endif
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 3f3ed83a9aa5..e4982ac3fbbc 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -300,19 +300,6 @@ const struct dev_pm_ops name = { \
300 SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \ 300 SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
301} 301}
302 302
303/*
304 * Use this for subsystems (bus types, device types, device classes) that don't
305 * need any special suspend/resume handling in addition to invoking the PM
306 * callbacks provided by device drivers supporting both the system sleep PM and
307 * runtime PM, make the pm member point to generic_subsys_pm_ops.
308 */
309#ifdef CONFIG_PM
310extern struct dev_pm_ops generic_subsys_pm_ops;
311#define GENERIC_SUBSYS_PM_OPS (&generic_subsys_pm_ops)
312#else
313#define GENERIC_SUBSYS_PM_OPS NULL
314#endif
315
316/** 303/**
317 * PM_EVENT_ messages 304 * PM_EVENT_ messages
318 * 305 *
@@ -521,6 +508,8 @@ struct dev_pm_info {
521 unsigned long active_jiffies; 508 unsigned long active_jiffies;
522 unsigned long suspended_jiffies; 509 unsigned long suspended_jiffies;
523 unsigned long accounting_timestamp; 510 unsigned long accounting_timestamp;
511 ktime_t suspend_time;
512 s64 max_time_suspended_ns;
524#endif 513#endif
525 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ 514 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */
526 struct pm_qos_constraints *constraints; 515 struct pm_qos_constraints *constraints;
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 65633e5a2bc0..a03a0ad998b8 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -10,6 +10,7 @@
10#define _LINUX_PM_DOMAIN_H 10#define _LINUX_PM_DOMAIN_H
11 11
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/err.h>
13 14
14enum gpd_status { 15enum gpd_status {
15 GPD_STATE_ACTIVE = 0, /* PM domain is active */ 16 GPD_STATE_ACTIVE = 0, /* PM domain is active */
@@ -21,6 +22,23 @@ enum gpd_status {
21 22
22struct dev_power_governor { 23struct dev_power_governor {
23 bool (*power_down_ok)(struct dev_pm_domain *domain); 24 bool (*power_down_ok)(struct dev_pm_domain *domain);
25 bool (*stop_ok)(struct device *dev);
26};
27
28struct gpd_dev_ops {
29 int (*start)(struct device *dev);
30 int (*stop)(struct device *dev);
31 int (*save_state)(struct device *dev);
32 int (*restore_state)(struct device *dev);
33 int (*suspend)(struct device *dev);
34 int (*suspend_late)(struct device *dev);
35 int (*resume_early)(struct device *dev);
36 int (*resume)(struct device *dev);
37 int (*freeze)(struct device *dev);
38 int (*freeze_late)(struct device *dev);
39 int (*thaw_early)(struct device *dev);
40 int (*thaw)(struct device *dev);
41 bool (*active_wakeup)(struct device *dev);
24}; 42};
25 43
26struct generic_pm_domain { 44struct generic_pm_domain {
@@ -32,6 +50,7 @@ struct generic_pm_domain {
32 struct mutex lock; 50 struct mutex lock;
33 struct dev_power_governor *gov; 51 struct dev_power_governor *gov;
34 struct work_struct power_off_work; 52 struct work_struct power_off_work;
53 char *name;
35 unsigned int in_progress; /* Number of devices being suspended now */ 54 unsigned int in_progress; /* Number of devices being suspended now */
36 atomic_t sd_count; /* Number of subdomains with power "on" */ 55 atomic_t sd_count; /* Number of subdomains with power "on" */
37 enum gpd_status status; /* Current state of the domain */ 56 enum gpd_status status; /* Current state of the domain */
@@ -44,10 +63,13 @@ struct generic_pm_domain {
44 bool suspend_power_off; /* Power status before system suspend */ 63 bool suspend_power_off; /* Power status before system suspend */
45 bool dev_irq_safe; /* Device callbacks are IRQ-safe */ 64 bool dev_irq_safe; /* Device callbacks are IRQ-safe */
46 int (*power_off)(struct generic_pm_domain *domain); 65 int (*power_off)(struct generic_pm_domain *domain);
66 s64 power_off_latency_ns;
47 int (*power_on)(struct generic_pm_domain *domain); 67 int (*power_on)(struct generic_pm_domain *domain);
48 int (*start_device)(struct device *dev); 68 s64 power_on_latency_ns;
49 int (*stop_device)(struct device *dev); 69 struct gpd_dev_ops dev_ops;
50 bool (*active_wakeup)(struct device *dev); 70 s64 break_even_ns; /* Power break even for the entire domain. */
71 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */
72 ktime_t power_off_time;
51}; 73};
52 74
53static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) 75static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
@@ -62,8 +84,18 @@ struct gpd_link {
62 struct list_head slave_node; 84 struct list_head slave_node;
63}; 85};
64 86
87struct gpd_timing_data {
88 s64 stop_latency_ns;
89 s64 start_latency_ns;
90 s64 save_state_latency_ns;
91 s64 restore_state_latency_ns;
92 s64 break_even_ns;
93};
94
65struct generic_pm_domain_data { 95struct generic_pm_domain_data {
66 struct pm_domain_data base; 96 struct pm_domain_data base;
97 struct gpd_dev_ops ops;
98 struct gpd_timing_data td;
67 bool need_restore; 99 bool need_restore;
68}; 100};
69 101
@@ -73,18 +105,54 @@ static inline struct generic_pm_domain_data *to_gpd_data(struct pm_domain_data *
73} 105}
74 106
75#ifdef CONFIG_PM_GENERIC_DOMAINS 107#ifdef CONFIG_PM_GENERIC_DOMAINS
76extern int pm_genpd_add_device(struct generic_pm_domain *genpd, 108static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
77 struct device *dev); 109{
110 return to_gpd_data(dev->power.subsys_data->domain_data);
111}
112
113extern struct dev_power_governor simple_qos_governor;
114
115extern struct generic_pm_domain *dev_to_genpd(struct device *dev);
116extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
117 struct device *dev,
118 struct gpd_timing_data *td);
119
120static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
121 struct device *dev)
122{
123 return __pm_genpd_add_device(genpd, dev, NULL);
124}
125
78extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, 126extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
79 struct device *dev); 127 struct device *dev);
80extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 128extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
81 struct generic_pm_domain *new_subdomain); 129 struct generic_pm_domain *new_subdomain);
82extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, 130extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
83 struct generic_pm_domain *target); 131 struct generic_pm_domain *target);
132extern int pm_genpd_add_callbacks(struct device *dev,
133 struct gpd_dev_ops *ops,
134 struct gpd_timing_data *td);
135extern int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td);
84extern void pm_genpd_init(struct generic_pm_domain *genpd, 136extern void pm_genpd_init(struct generic_pm_domain *genpd,
85 struct dev_power_governor *gov, bool is_off); 137 struct dev_power_governor *gov, bool is_off);
138
86extern int pm_genpd_poweron(struct generic_pm_domain *genpd); 139extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
140
141extern bool default_stop_ok(struct device *dev);
142
143extern struct dev_power_governor pm_domain_always_on_gov;
87#else 144#else
145
146static inline struct generic_pm_domain *dev_to_genpd(struct device *dev)
147{
148 return ERR_PTR(-ENOSYS);
149}
150static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd,
151 struct device *dev,
152 struct gpd_timing_data *td)
153{
154 return -ENOSYS;
155}
88static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, 156static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
89 struct device *dev) 157 struct device *dev)
90{ 158{
@@ -105,14 +173,35 @@ static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
105{ 173{
106 return -ENOSYS; 174 return -ENOSYS;
107} 175}
108static inline void pm_genpd_init(struct generic_pm_domain *genpd, 176static inline int pm_genpd_add_callbacks(struct device *dev,
109 struct dev_power_governor *gov, bool is_off) {} 177 struct gpd_dev_ops *ops,
178 struct gpd_timing_data *td)
179{
180 return -ENOSYS;
181}
182static inline int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td)
183{
184 return -ENOSYS;
185}
186static inline void pm_genpd_init(struct generic_pm_domain *genpd, bool is_off)
187{
188}
110static inline int pm_genpd_poweron(struct generic_pm_domain *genpd) 189static inline int pm_genpd_poweron(struct generic_pm_domain *genpd)
111{ 190{
112 return -ENOSYS; 191 return -ENOSYS;
113} 192}
193static inline bool default_stop_ok(struct device *dev)
194{
195 return false;
196}
197#define pm_domain_always_on_gov NULL
114#endif 198#endif
115 199
200static inline int pm_genpd_remove_callbacks(struct device *dev)
201{
202 return __pm_genpd_remove_callbacks(dev, true);
203}
204
116#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME 205#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME
117extern void genpd_queue_power_off_work(struct generic_pm_domain *genpd); 206extern void genpd_queue_power_off_work(struct generic_pm_domain *genpd);
118extern void pm_genpd_poweroff_unused(void); 207extern void pm_genpd_poweroff_unused(void);
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 83b0ea302a80..4d99e4e6ef83 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -78,6 +78,7 @@ int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier);
78int pm_qos_request_active(struct pm_qos_request *req); 78int pm_qos_request_active(struct pm_qos_request *req);
79s32 pm_qos_read_value(struct pm_qos_constraints *c); 79s32 pm_qos_read_value(struct pm_qos_constraints *c);
80 80
81s32 __dev_pm_qos_read_value(struct device *dev);
81s32 dev_pm_qos_read_value(struct device *dev); 82s32 dev_pm_qos_read_value(struct device *dev);
82int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, 83int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req,
83 s32 value); 84 s32 value);
@@ -91,6 +92,8 @@ int dev_pm_qos_add_global_notifier(struct notifier_block *notifier);
91int dev_pm_qos_remove_global_notifier(struct notifier_block *notifier); 92int dev_pm_qos_remove_global_notifier(struct notifier_block *notifier);
92void dev_pm_qos_constraints_init(struct device *dev); 93void dev_pm_qos_constraints_init(struct device *dev);
93void dev_pm_qos_constraints_destroy(struct device *dev); 94void dev_pm_qos_constraints_destroy(struct device *dev);
95int dev_pm_qos_add_ancestor_request(struct device *dev,
96 struct dev_pm_qos_request *req, s32 value);
94#else 97#else
95static inline int pm_qos_update_target(struct pm_qos_constraints *c, 98static inline int pm_qos_update_target(struct pm_qos_constraints *c,
96 struct plist_node *node, 99 struct plist_node *node,
@@ -107,7 +110,19 @@ static inline void pm_qos_remove_request(struct pm_qos_request *req)
107 { return; } 110 { return; }
108 111
109static inline int pm_qos_request(int pm_qos_class) 112static inline int pm_qos_request(int pm_qos_class)
110 { return 0; } 113{
114 switch (pm_qos_class) {
115 case PM_QOS_CPU_DMA_LATENCY:
116 return PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE;
117 case PM_QOS_NETWORK_LATENCY:
118 return PM_QOS_NETWORK_LAT_DEFAULT_VALUE;
119 case PM_QOS_NETWORK_THROUGHPUT:
120 return PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE;
121 default:
122 return PM_QOS_DEFAULT_VALUE;
123 }
124}
125
111static inline int pm_qos_add_notifier(int pm_qos_class, 126static inline int pm_qos_add_notifier(int pm_qos_class,
112 struct notifier_block *notifier) 127 struct notifier_block *notifier)
113 { return 0; } 128 { return 0; }
@@ -119,6 +134,8 @@ static inline int pm_qos_request_active(struct pm_qos_request *req)
119static inline s32 pm_qos_read_value(struct pm_qos_constraints *c) 134static inline s32 pm_qos_read_value(struct pm_qos_constraints *c)
120 { return 0; } 135 { return 0; }
121 136
137static inline s32 __dev_pm_qos_read_value(struct device *dev)
138 { return 0; }
122static inline s32 dev_pm_qos_read_value(struct device *dev) 139static inline s32 dev_pm_qos_read_value(struct device *dev)
123 { return 0; } 140 { return 0; }
124static inline int dev_pm_qos_add_request(struct device *dev, 141static inline int dev_pm_qos_add_request(struct device *dev,
@@ -150,6 +167,9 @@ static inline void dev_pm_qos_constraints_destroy(struct device *dev)
150{ 167{
151 dev->power.power_state = PMSG_INVALID; 168 dev->power.power_state = PMSG_INVALID;
152} 169}
170static inline int dev_pm_qos_add_ancestor_request(struct device *dev,
171 struct dev_pm_qos_request *req, s32 value)
172 { return 0; }
153#endif 173#endif
154 174
155#endif 175#endif
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index d3085e72a0ee..609daae7a014 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -45,6 +45,8 @@ extern void pm_runtime_irq_safe(struct device *dev);
45extern void __pm_runtime_use_autosuspend(struct device *dev, bool use); 45extern void __pm_runtime_use_autosuspend(struct device *dev, bool use);
46extern void pm_runtime_set_autosuspend_delay(struct device *dev, int delay); 46extern void pm_runtime_set_autosuspend_delay(struct device *dev, int delay);
47extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev); 47extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev);
48extern void pm_runtime_update_max_time_suspended(struct device *dev,
49 s64 delta_ns);
48 50
49static inline bool pm_children_suspended(struct device *dev) 51static inline bool pm_children_suspended(struct device *dev)
50{ 52{
@@ -148,6 +150,9 @@ static inline void pm_runtime_set_autosuspend_delay(struct device *dev,
148static inline unsigned long pm_runtime_autosuspend_expiration( 150static inline unsigned long pm_runtime_autosuspend_expiration(
149 struct device *dev) { return 0; } 151 struct device *dev) { return 0; }
150 152
153static inline void pm_runtime_update_max_time_suspended(struct device *dev,
154 s64 delta_ns) {}
155
151#endif /* !CONFIG_PM_RUNTIME */ 156#endif /* !CONFIG_PM_RUNTIME */
152 157
153static inline int pm_runtime_idle(struct device *dev) 158static inline int pm_runtime_idle(struct device *dev)
diff --git a/include/linux/pmu.h b/include/linux/pmu.h
index cafe98d96948..84e6a55a1202 100644
--- a/include/linux/pmu.h
+++ b/include/linux/pmu.h
@@ -6,6 +6,8 @@
6 * Copyright (C) 1998 Paul Mackerras. 6 * Copyright (C) 1998 Paul Mackerras.
7 */ 7 */
8 8
9#ifndef _LINUX_PMU_H
10#define _LINUX_PMU_H
9 11
10#define PMU_DRIVER_VERSION 2 12#define PMU_DRIVER_VERSION 2
11 13
@@ -207,3 +209,5 @@ extern int pmu_sys_suspended;
207#endif 209#endif
208 210
209#endif /* __KERNEL__ */ 211#endif /* __KERNEL__ */
212
213#endif /* _LINUX_PMU_H */
diff --git a/include/linux/poison.h b/include/linux/poison.h
index 79159de0e341..2110a81c5e2a 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -40,12 +40,6 @@
40#define RED_INACTIVE 0x09F911029D74E35BULL /* when obj is inactive */ 40#define RED_INACTIVE 0x09F911029D74E35BULL /* when obj is inactive */
41#define RED_ACTIVE 0xD84156C5635688C0ULL /* when obj is active */ 41#define RED_ACTIVE 0xD84156C5635688C0ULL /* when obj is active */
42 42
43#ifdef CONFIG_PHYS_ADDR_T_64BIT
44#define MEMBLOCK_INACTIVE 0x3a84fb0144c9e71bULL
45#else
46#define MEMBLOCK_INACTIVE 0x44c9e71bUL
47#endif
48
49#define SLUB_RED_INACTIVE 0xbb 43#define SLUB_RED_INACTIVE 0xbb
50#define SLUB_RED_ACTIVE 0xcc 44#define SLUB_RED_ACTIVE 0xcc
51 45
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h
new file mode 100644
index 000000000000..4f75e531c112
--- /dev/null
+++ b/include/linux/power/charger-manager.h
@@ -0,0 +1,147 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co., Ltd.
3 * MyungJoo.Ham <myungjoo.ham@samsung.com>
4 *
5 * Charger Manager.
6 * This framework enables to control and multiple chargers and to
7 * monitor charging even in the context of suspend-to-RAM with
8 * an interface combining the chargers.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13**/
14
15#ifndef _CHARGER_MANAGER_H
16#define _CHARGER_MANAGER_H
17
18#include <linux/power_supply.h>
19
20enum data_source {
21 CM_FUEL_GAUGE,
22 CM_CHARGER_STAT,
23};
24
25enum polling_modes {
26 CM_POLL_DISABLE = 0,
27 CM_POLL_ALWAYS,
28 CM_POLL_EXTERNAL_POWER_ONLY,
29 CM_POLL_CHARGING_ONLY,
30};
31
32/**
33 * struct charger_global_desc
34 * @rtc_name: the name of RTC used to wake up the system from suspend.
35 * @rtc_only_wakeup:
36 * If the system is woken up by waekup-sources other than the RTC or
37 * callbacks, Charger Manager should recognize with
38 * rtc_only_wakeup() returning false.
39 * If the RTC given to CM is the only wakeup reason,
40 * rtc_only_wakeup should return true.
41 */
42struct charger_global_desc {
43 char *rtc_name;
44
45 bool (*rtc_only_wakeup)(void);
46};
47
48/**
49 * struct charger_desc
50 * @psy_name: the name of power-supply-class for charger manager
51 * @polling_mode:
52 * Determine which polling mode will be used
53 * @fullbatt_uV: voltage in microvolt
54 * If it is not being charged and VBATT >= fullbatt_uV,
55 * it is assumed to be full.
56 * @polling_interval_ms: interval in millisecond at which
57 * charger manager will monitor battery health
58 * @battery_present:
59 * Specify where information for existance of battery can be obtained
60 * @psy_charger_stat: the names of power-supply for chargers
61 * @num_charger_regulator: the number of entries in charger_regulators
62 * @charger_regulators: array of regulator_bulk_data for chargers
63 * @psy_fuel_gauge: the name of power-supply for fuel gauge
64 * @temperature_out_of_range:
65 * Determine whether the status is overheat or cold or normal.
66 * return_value > 0: overheat
67 * return_value == 0: normal
68 * return_value < 0: cold
69 * @measure_battery_temp:
70 * true: measure battery temperature
71 * false: measure ambient temperature
72 */
73struct charger_desc {
74 char *psy_name;
75
76 enum polling_modes polling_mode;
77 unsigned int polling_interval_ms;
78
79 unsigned int fullbatt_uV;
80
81 enum data_source battery_present;
82
83 char **psy_charger_stat;
84
85 int num_charger_regulators;
86 struct regulator_bulk_data *charger_regulators;
87
88 char *psy_fuel_gauge;
89
90 int (*temperature_out_of_range)(int *mC);
91 bool measure_battery_temp;
92};
93
94#define PSY_NAME_MAX 30
95
96/**
97 * struct charger_manager
98 * @entry: entry for list
99 * @dev: device pointer
100 * @desc: instance of charger_desc
101 * @fuel_gauge: power_supply for fuel gauge
102 * @charger_stat: array of power_supply for chargers
103 * @charger_enabled: the state of charger
104 * @emergency_stop:
105 * When setting true, stop charging
106 * @last_temp_mC: the measured temperature in milli-Celsius
107 * @psy_name_buf: the name of power-supply-class for charger manager
108 * @charger_psy: power_supply for charger manager
109 * @status_save_ext_pwr_inserted:
110 * saved status of external power before entering suspend-to-RAM
111 * @status_save_batt:
112 * saved status of battery before entering suspend-to-RAM
113 */
114struct charger_manager {
115 struct list_head entry;
116 struct device *dev;
117 struct charger_desc *desc;
118
119 struct power_supply *fuel_gauge;
120 struct power_supply **charger_stat;
121
122 bool charger_enabled;
123
124 int emergency_stop;
125 int last_temp_mC;
126
127 char psy_name_buf[PSY_NAME_MAX + 1];
128 struct power_supply charger_psy;
129
130 bool status_save_ext_pwr_inserted;
131 bool status_save_batt;
132};
133
134#ifdef CONFIG_CHARGER_MANAGER
135extern int setup_charger_manager(struct charger_global_desc *gd);
136extern bool cm_suspend_again(void);
137#else
138static void __maybe_unused setup_charger_manager(struct charger_global_desc *gd)
139{ }
140
141static bool __maybe_unused cm_suspend_again(void)
142{
143 return false;
144}
145#endif
146
147#endif /* _CHARGER_MANAGER_H */
diff --git a/include/linux/power/bq20z75.h b/include/linux/power/sbs-battery.h
index 1398eb004e83..2b0a9d9ff57e 100644
--- a/include/linux/power/bq20z75.h
+++ b/include/linux/power/sbs-battery.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Gas Gauge driver for TI's BQ20Z75 2 * Gas Gauge driver for SBS Compliant Gas Gauges
3 * 3 *
4 * Copyright (c) 2010, NVIDIA Corporation. 4 * Copyright (c) 2010, NVIDIA Corporation.
5 * 5 *
@@ -18,21 +18,21 @@
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21#ifndef __LINUX_POWER_BQ20Z75_H_ 21#ifndef __LINUX_POWER_SBS_BATTERY_H_
22#define __LINUX_POWER_BQ20Z75_H_ 22#define __LINUX_POWER_SBS_BATTERY_H_
23 23
24#include <linux/power_supply.h> 24#include <linux/power_supply.h>
25#include <linux/types.h> 25#include <linux/types.h>
26 26
27/** 27/**
28 * struct bq20z75_platform_data - platform data for bq20z75 devices 28 * struct sbs_platform_data - platform data for sbs devices
29 * @battery_detect: GPIO which is used to detect battery presence 29 * @battery_detect: GPIO which is used to detect battery presence
30 * @battery_detect_present: gpio state when battery is present (0 / 1) 30 * @battery_detect_present: gpio state when battery is present (0 / 1)
31 * @i2c_retry_count: # of times to retry on i2c IO failure 31 * @i2c_retry_count: # of times to retry on i2c IO failure
32 * @poll_retry_count: # of times to retry looking for new status after 32 * @poll_retry_count: # of times to retry looking for new status after
33 * external change notification 33 * external change notification
34 */ 34 */
35struct bq20z75_platform_data { 35struct sbs_platform_data {
36 int battery_detect; 36 int battery_detect;
37 int battery_detect_present; 37 int battery_detect_present;
38 int i2c_retry_count; 38 int i2c_retry_count;
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 204c18dfdc9e..fa9b962aec12 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -74,6 +74,12 @@ enum {
74 POWER_SUPPLY_CAPACITY_LEVEL_FULL, 74 POWER_SUPPLY_CAPACITY_LEVEL_FULL,
75}; 75};
76 76
77enum {
78 POWER_SUPPLY_SCOPE_UNKNOWN = 0,
79 POWER_SUPPLY_SCOPE_SYSTEM,
80 POWER_SUPPLY_SCOPE_DEVICE,
81};
82
77enum power_supply_property { 83enum power_supply_property {
78 /* Properties of type `int' */ 84 /* Properties of type `int' */
79 POWER_SUPPLY_PROP_STATUS = 0, 85 POWER_SUPPLY_PROP_STATUS = 0,
@@ -116,6 +122,7 @@ enum power_supply_property {
116 POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, 122 POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
117 POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, 123 POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,
118 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */ 124 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */
125 POWER_SUPPLY_PROP_SCOPE,
119 /* Properties of type `const char *' */ 126 /* Properties of type `const char *' */
120 POWER_SUPPLY_PROP_MODEL_NAME, 127 POWER_SUPPLY_PROP_MODEL_NAME,
121 POWER_SUPPLY_PROP_MANUFACTURER, 128 POWER_SUPPLY_PROP_MANUFACTURER,
@@ -123,7 +130,8 @@ enum power_supply_property {
123}; 130};
124 131
125enum power_supply_type { 132enum power_supply_type {
126 POWER_SUPPLY_TYPE_BATTERY = 0, 133 POWER_SUPPLY_TYPE_UNKNOWN = 0,
134 POWER_SUPPLY_TYPE_BATTERY,
127 POWER_SUPPLY_TYPE_UPS, 135 POWER_SUPPLY_TYPE_UPS,
128 POWER_SUPPLY_TYPE_MAINS, 136 POWER_SUPPLY_TYPE_MAINS,
129 POWER_SUPPLY_TYPE_USB, /* Standard Downstream Port */ 137 POWER_SUPPLY_TYPE_USB, /* Standard Downstream Port */
@@ -211,6 +219,7 @@ static inline int power_supply_is_system_supplied(void) { return -ENOSYS; }
211extern int power_supply_register(struct device *parent, 219extern int power_supply_register(struct device *parent,
212 struct power_supply *psy); 220 struct power_supply *psy);
213extern void power_supply_unregister(struct power_supply *psy); 221extern void power_supply_unregister(struct power_supply *psy);
222extern int power_supply_powers(struct power_supply *psy, struct device *dev);
214 223
215/* For APM emulation, think legacy userspace. */ 224/* For APM emulation, think legacy userspace. */
216extern struct class *power_supply_class; 225extern struct class *power_supply_class;
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index a3baeb2c2161..7ddc7f1b480f 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -102,4 +102,16 @@
102 102
103#define PR_MCE_KILL_GET 34 103#define PR_MCE_KILL_GET 34
104 104
105/*
106 * Tune up process memory map specifics.
107 */
108#define PR_SET_MM 35
109# define PR_SET_MM_START_CODE 1
110# define PR_SET_MM_END_CODE 2
111# define PR_SET_MM_START_DATA 3
112# define PR_SET_MM_END_DATA 4
113# define PR_SET_MM_START_STACK 5
114# define PR_SET_MM_START_BRK 6
115# define PR_SET_MM_BRK 7
116
105#endif /* _LINUX_PRCTL_H */ 117#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 643b96c7a94f..85c507306239 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -50,7 +50,7 @@ typedef int (write_proc_t)(struct file *file, const char __user *buffer,
50 50
51struct proc_dir_entry { 51struct proc_dir_entry {
52 unsigned int low_ino; 52 unsigned int low_ino;
53 mode_t mode; 53 umode_t mode;
54 nlink_t nlink; 54 nlink_t nlink;
55 uid_t uid; 55 uid_t uid;
56 gid_t gid; 56 gid_t gid;
@@ -106,9 +106,9 @@ extern void proc_root_init(void);
106 106
107void proc_flush_task(struct task_struct *task); 107void proc_flush_task(struct task_struct *task);
108 108
109extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, 109extern struct proc_dir_entry *create_proc_entry(const char *name, umode_t mode,
110 struct proc_dir_entry *parent); 110 struct proc_dir_entry *parent);
111struct proc_dir_entry *proc_create_data(const char *name, mode_t mode, 111struct proc_dir_entry *proc_create_data(const char *name, umode_t mode,
112 struct proc_dir_entry *parent, 112 struct proc_dir_entry *parent,
113 const struct file_operations *proc_fops, 113 const struct file_operations *proc_fops,
114 void *data); 114 void *data);
@@ -146,17 +146,17 @@ extern void proc_device_tree_update_prop(struct proc_dir_entry *pde,
146extern struct proc_dir_entry *proc_symlink(const char *, 146extern struct proc_dir_entry *proc_symlink(const char *,
147 struct proc_dir_entry *, const char *); 147 struct proc_dir_entry *, const char *);
148extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *); 148extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *);
149extern struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode, 149extern struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
150 struct proc_dir_entry *parent); 150 struct proc_dir_entry *parent);
151 151
152static inline struct proc_dir_entry *proc_create(const char *name, mode_t mode, 152static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode,
153 struct proc_dir_entry *parent, const struct file_operations *proc_fops) 153 struct proc_dir_entry *parent, const struct file_operations *proc_fops)
154{ 154{
155 return proc_create_data(name, mode, parent, proc_fops, NULL); 155 return proc_create_data(name, mode, parent, proc_fops, NULL);
156} 156}
157 157
158static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 158static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
159 mode_t mode, struct proc_dir_entry *base, 159 umode_t mode, struct proc_dir_entry *base,
160 read_proc_t *read_proc, void * data) 160 read_proc_t *read_proc, void * data)
161{ 161{
162 struct proc_dir_entry *res=create_proc_entry(name,mode,base); 162 struct proc_dir_entry *res=create_proc_entry(name,mode,base);
@@ -168,7 +168,7 @@ static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
168} 168}
169 169
170extern struct proc_dir_entry *proc_net_fops_create(struct net *net, 170extern struct proc_dir_entry *proc_net_fops_create(struct net *net,
171 const char *name, mode_t mode, const struct file_operations *fops); 171 const char *name, umode_t mode, const struct file_operations *fops);
172extern void proc_net_remove(struct net *net, const char *name); 172extern void proc_net_remove(struct net *net, const char *name);
173extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, 173extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
174 struct proc_dir_entry *parent); 174 struct proc_dir_entry *parent);
@@ -185,15 +185,15 @@ static inline void proc_flush_task(struct task_struct *task)
185} 185}
186 186
187static inline struct proc_dir_entry *create_proc_entry(const char *name, 187static inline struct proc_dir_entry *create_proc_entry(const char *name,
188 mode_t mode, struct proc_dir_entry *parent) { return NULL; } 188 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
189static inline struct proc_dir_entry *proc_create(const char *name, 189static inline struct proc_dir_entry *proc_create(const char *name,
190 mode_t mode, struct proc_dir_entry *parent, 190 umode_t mode, struct proc_dir_entry *parent,
191 const struct file_operations *proc_fops) 191 const struct file_operations *proc_fops)
192{ 192{
193 return NULL; 193 return NULL;
194} 194}
195static inline struct proc_dir_entry *proc_create_data(const char *name, 195static inline struct proc_dir_entry *proc_create_data(const char *name,
196 mode_t mode, struct proc_dir_entry *parent, 196 umode_t mode, struct proc_dir_entry *parent,
197 const struct file_operations *proc_fops, void *data) 197 const struct file_operations *proc_fops, void *data)
198{ 198{
199 return NULL; 199 return NULL;
@@ -205,10 +205,10 @@ static inline struct proc_dir_entry *proc_symlink(const char *name,
205static inline struct proc_dir_entry *proc_mkdir(const char *name, 205static inline struct proc_dir_entry *proc_mkdir(const char *name,
206 struct proc_dir_entry *parent) {return NULL;} 206 struct proc_dir_entry *parent) {return NULL;}
207static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, 207static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
208 mode_t mode, struct proc_dir_entry *parent) { return NULL; } 208 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
209 209
210static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 210static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
211 mode_t mode, struct proc_dir_entry *base, 211 umode_t mode, struct proc_dir_entry *base,
212 read_proc_t *read_proc, void * data) { return NULL; } 212 read_proc_t *read_proc, void * data) { return NULL; }
213 213
214struct tty_driver; 214struct tty_driver;
@@ -253,7 +253,7 @@ extern const struct proc_ns_operations utsns_operations;
253extern const struct proc_ns_operations ipcns_operations; 253extern const struct proc_ns_operations ipcns_operations;
254 254
255union proc_op { 255union proc_op {
256 int (*proc_get_link)(struct inode *, struct path *); 256 int (*proc_get_link)(struct dentry *, struct path *);
257 int (*proc_read)(struct task_struct *task, char *page); 257 int (*proc_read)(struct task_struct *task, char *page);
258 int (*proc_show)(struct seq_file *m, 258 int (*proc_show)(struct seq_file *m,
259 struct pid_namespace *ns, struct pid *pid, 259 struct pid_namespace *ns, struct pid *pid,
diff --git a/include/linux/proportions.h b/include/linux/proportions.h
index ef35bb73f69b..26a8a4ed9b07 100644
--- a/include/linux/proportions.h
+++ b/include/linux/proportions.h
@@ -81,7 +81,11 @@ void prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl)
81 * Limit the time part in order to ensure there are some bits left for the 81 * Limit the time part in order to ensure there are some bits left for the
82 * cycle counter and fraction multiply. 82 * cycle counter and fraction multiply.
83 */ 83 */
84#if BITS_PER_LONG == 32
84#define PROP_MAX_SHIFT (3*BITS_PER_LONG/4) 85#define PROP_MAX_SHIFT (3*BITS_PER_LONG/4)
86#else
87#define PROP_MAX_SHIFT (BITS_PER_LONG/2)
88#endif
85 89
86#define PROP_FRAC_SHIFT (BITS_PER_LONG - PROP_MAX_SHIFT - 1) 90#define PROP_FRAC_SHIFT (BITS_PER_LONG - PROP_MAX_SHIFT - 1)
87#define PROP_FRAC_BASE (1UL << PROP_FRAC_SHIFT) 91#define PROP_FRAC_BASE (1UL << PROP_FRAC_SHIFT)
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 2ca8cde5459d..e1461e143be2 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -22,6 +22,9 @@
22#ifndef _LINUX_PSTORE_H 22#ifndef _LINUX_PSTORE_H
23#define _LINUX_PSTORE_H 23#define _LINUX_PSTORE_H
24 24
25#include <linux/time.h>
26#include <linux/kmsg_dump.h>
27
25/* types */ 28/* types */
26enum pstore_type_id { 29enum pstore_type_id {
27 PSTORE_TYPE_DMESG = 0, 30 PSTORE_TYPE_DMESG = 0,
@@ -41,7 +44,8 @@ struct pstore_info {
41 ssize_t (*read)(u64 *id, enum pstore_type_id *type, 44 ssize_t (*read)(u64 *id, enum pstore_type_id *type,
42 struct timespec *time, char **buf, 45 struct timespec *time, char **buf,
43 struct pstore_info *psi); 46 struct pstore_info *psi);
44 int (*write)(enum pstore_type_id type, u64 *id, 47 int (*write)(enum pstore_type_id type,
48 enum kmsg_dump_reason reason, u64 *id,
45 unsigned int part, size_t size, struct pstore_info *psi); 49 unsigned int part, size_t size, struct pstore_info *psi);
46 int (*erase)(enum pstore_type_id type, u64 id, 50 int (*erase)(enum pstore_type_id type, u64 id,
47 struct pstore_info *psi); 51 struct pstore_info *psi);
@@ -50,18 +54,12 @@ struct pstore_info {
50 54
51#ifdef CONFIG_PSTORE 55#ifdef CONFIG_PSTORE
52extern int pstore_register(struct pstore_info *); 56extern int pstore_register(struct pstore_info *);
53extern int pstore_write(enum pstore_type_id type, char *buf, size_t size);
54#else 57#else
55static inline int 58static inline int
56pstore_register(struct pstore_info *psi) 59pstore_register(struct pstore_info *psi)
57{ 60{
58 return -ENODEV; 61 return -ENODEV;
59} 62}
60static inline int
61pstore_write(enum pstore_type_id type, char *buf, size_t size)
62{
63 return -ENODEV;
64}
65#endif 63#endif
66 64
67#endif /*_LINUX_PSTORE_H*/ 65#endif /*_LINUX_PSTORE_H*/
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 800f113bea66..c2f1f6a5fcb8 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -112,6 +112,7 @@
112 112
113#include <linux/compiler.h> /* For unlikely. */ 113#include <linux/compiler.h> /* For unlikely. */
114#include <linux/sched.h> /* For struct task_struct. */ 114#include <linux/sched.h> /* For struct task_struct. */
115#include <linux/err.h> /* for IS_ERR_VALUE */
115 116
116 117
117extern long arch_ptrace(struct task_struct *child, long request, 118extern long arch_ptrace(struct task_struct *child, long request,
@@ -127,8 +128,9 @@ extern void __ptrace_link(struct task_struct *child,
127 struct task_struct *new_parent); 128 struct task_struct *new_parent);
128extern void __ptrace_unlink(struct task_struct *child); 129extern void __ptrace_unlink(struct task_struct *child);
129extern void exit_ptrace(struct task_struct *tracer); 130extern void exit_ptrace(struct task_struct *tracer);
130#define PTRACE_MODE_READ 1 131#define PTRACE_MODE_READ 0x01
131#define PTRACE_MODE_ATTACH 2 132#define PTRACE_MODE_ATTACH 0x02
133#define PTRACE_MODE_NOAUDIT 0x04
132/* Returns 0 on success, -errno on denial. */ 134/* Returns 0 on success, -errno on denial. */
133extern int __ptrace_may_access(struct task_struct *task, unsigned int mode); 135extern int __ptrace_may_access(struct task_struct *task, unsigned int mode);
134/* Returns true on success, false on denial. */ 136/* Returns true on success, false on denial. */
@@ -265,6 +267,15 @@ static inline void ptrace_release_task(struct task_struct *task)
265#define force_successful_syscall_return() do { } while (0) 267#define force_successful_syscall_return() do { } while (0)
266#endif 268#endif
267 269
270#ifndef is_syscall_success
271/*
272 * On most systems we can tell if a syscall is a success based on if the retval
273 * is an error value. On some systems like ia64 and powerpc they have different
274 * indicators of success/failure and must define their own.
275 */
276#define is_syscall_success(regs) (!IS_ERR_VALUE((unsigned long)(regs_return_value(regs))))
277#endif
278
268/* 279/*
269 * <asm/ptrace.h> should define the following things inside #ifdef __KERNEL__. 280 * <asm/ptrace.h> should define the following things inside #ifdef __KERNEL__.
270 * 281 *
diff --git a/include/linux/quota.h b/include/linux/quota.h
index cb7855699037..c09fa042b5ea 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -230,7 +230,11 @@ struct mem_dqinfo {
230struct super_block; 230struct super_block;
231 231
232#define DQF_MASK 0xffff /* Mask for format specific flags */ 232#define DQF_MASK 0xffff /* Mask for format specific flags */
233#define DQF_INFO_DIRTY_B 16 233#define DQF_GETINFO_MASK 0x1ffff /* Mask for flags passed to userspace */
234#define DQF_SETINFO_MASK 0xffff /* Mask for flags modifiable from userspace */
235#define DQF_SYS_FILE_B 16
236#define DQF_SYS_FILE (1 << DQF_SYS_FILE_B) /* Quota file stored as system file */
237#define DQF_INFO_DIRTY_B 31
234#define DQF_INFO_DIRTY (1 << DQF_INFO_DIRTY_B) /* Is info dirty? */ 238#define DQF_INFO_DIRTY (1 << DQF_INFO_DIRTY_B) /* Is info dirty? */
235 239
236extern void mark_info_dirty(struct super_block *sb, int type); 240extern void mark_info_dirty(struct super_block *sb, int type);
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 9d4539c52e53..07e360b1b282 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -49,9 +49,6 @@
49#define RADIX_TREE_EXCEPTIONAL_ENTRY 2 49#define RADIX_TREE_EXCEPTIONAL_ENTRY 2
50#define RADIX_TREE_EXCEPTIONAL_SHIFT 2 50#define RADIX_TREE_EXCEPTIONAL_SHIFT 2
51 51
52#define radix_tree_indirect_to_ptr(ptr) \
53 radix_tree_indirect_to_ptr((void __force *)(ptr))
54
55static inline int radix_tree_is_indirect_ptr(void *ptr) 52static inline int radix_tree_is_indirect_ptr(void *ptr)
56{ 53{
57 return (int)((unsigned long)ptr & RADIX_TREE_INDIRECT_PTR); 54 return (int)((unsigned long)ptr & RADIX_TREE_INDIRECT_PTR);
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index 9e65d9e20662..6f6df86f1ae5 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -277,7 +277,10 @@ struct mdp_superblock_1 {
277 */ 277 */
278#define MD_FEATURE_RESHAPE_ACTIVE 4 278#define MD_FEATURE_RESHAPE_ACTIVE 4
279#define MD_FEATURE_BAD_BLOCKS 8 /* badblock list is not empty */ 279#define MD_FEATURE_BAD_BLOCKS 8 /* badblock list is not empty */
280 280#define MD_FEATURE_REPLACEMENT 16 /* This device is replacing an
281#define MD_FEATURE_ALL (1|2|4|8) 281 * active device with same 'role'.
282 * 'recovery_offset' is also set.
283 */
284#define MD_FEATURE_ALL (1|2|4|8|16)
282 285
283#endif 286#endif
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
index 2b59cc824395..53272e9860a7 100644
--- a/include/linux/raid/pq.h
+++ b/include/linux/raid/pq.h
@@ -132,7 +132,7 @@ void raid6_dual_recov(int disks, size_t bytes, int faila, int failb,
132 PROT_READ|PROT_WRITE, \ 132 PROT_READ|PROT_WRITE, \
133 MAP_PRIVATE|MAP_ANONYMOUS,\ 133 MAP_PRIVATE|MAP_ANONYMOUS,\
134 0, 0)) 134 0, 0))
135# define free_pages(x, y) munmap((void *)(x), (y)*PAGE_SIZE) 135# define free_pages(x, y) munmap((void *)(x), PAGE_SIZE << (y))
136 136
137static inline void cpu_relax(void) 137static inline void cpu_relax(void)
138{ 138{
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 3a8f0c9b2933..5bf5500db83d 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -2,7 +2,7 @@
2#define _LINUX_RAMFS_H 2#define _LINUX_RAMFS_H
3 3
4struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir, 4struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir,
5 int mode, dev_t dev); 5 umode_t mode, dev_t dev);
6extern struct dentry *ramfs_mount(struct file_system_type *fs_type, 6extern struct dentry *ramfs_mount(struct file_system_type *fs_type,
7 int flags, const char *dev_name, void *data); 7 int flags, const char *dev_name, void *data);
8 8
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 2cf4226ade7e..81c04f4348ec 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -51,6 +51,8 @@ extern int rcutorture_runnable; /* for sysctl */
51#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 51#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
52extern void rcutorture_record_test_transition(void); 52extern void rcutorture_record_test_transition(void);
53extern void rcutorture_record_progress(unsigned long vernum); 53extern void rcutorture_record_progress(unsigned long vernum);
54extern void do_trace_rcu_torture_read(char *rcutorturename,
55 struct rcu_head *rhp);
54#else 56#else
55static inline void rcutorture_record_test_transition(void) 57static inline void rcutorture_record_test_transition(void)
56{ 58{
@@ -58,6 +60,12 @@ static inline void rcutorture_record_test_transition(void)
58static inline void rcutorture_record_progress(unsigned long vernum) 60static inline void rcutorture_record_progress(unsigned long vernum)
59{ 61{
60} 62}
63#ifdef CONFIG_RCU_TRACE
64extern void do_trace_rcu_torture_read(char *rcutorturename,
65 struct rcu_head *rhp);
66#else
67#define do_trace_rcu_torture_read(rcutorturename, rhp) do { } while (0)
68#endif
61#endif 69#endif
62 70
63#define UINT_CMP_GE(a, b) (UINT_MAX / 2 >= (a) - (b)) 71#define UINT_CMP_GE(a, b) (UINT_MAX / 2 >= (a) - (b))
@@ -177,23 +185,10 @@ extern void rcu_sched_qs(int cpu);
177extern void rcu_bh_qs(int cpu); 185extern void rcu_bh_qs(int cpu);
178extern void rcu_check_callbacks(int cpu, int user); 186extern void rcu_check_callbacks(int cpu, int user);
179struct notifier_block; 187struct notifier_block;
180 188extern void rcu_idle_enter(void);
181#ifdef CONFIG_NO_HZ 189extern void rcu_idle_exit(void);
182 190extern void rcu_irq_enter(void);
183extern void rcu_enter_nohz(void); 191extern void rcu_irq_exit(void);
184extern void rcu_exit_nohz(void);
185
186#else /* #ifdef CONFIG_NO_HZ */
187
188static inline void rcu_enter_nohz(void)
189{
190}
191
192static inline void rcu_exit_nohz(void)
193{
194}
195
196#endif /* #else #ifdef CONFIG_NO_HZ */
197 192
198/* 193/*
199 * Infrastructure to implement the synchronize_() primitives in 194 * Infrastructure to implement the synchronize_() primitives in
@@ -233,22 +228,30 @@ static inline void destroy_rcu_head_on_stack(struct rcu_head *head)
233 228
234#ifdef CONFIG_DEBUG_LOCK_ALLOC 229#ifdef CONFIG_DEBUG_LOCK_ALLOC
235 230
236extern struct lockdep_map rcu_lock_map; 231#ifdef CONFIG_PROVE_RCU
237# define rcu_read_acquire() \ 232extern int rcu_is_cpu_idle(void);
238 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) 233#else /* !CONFIG_PROVE_RCU */
239# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_) 234static inline int rcu_is_cpu_idle(void)
235{
236 return 0;
237}
238#endif /* else !CONFIG_PROVE_RCU */
240 239
241extern struct lockdep_map rcu_bh_lock_map; 240static inline void rcu_lock_acquire(struct lockdep_map *map)
242# define rcu_read_acquire_bh() \ 241{
243 lock_acquire(&rcu_bh_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) 242 WARN_ON_ONCE(rcu_is_cpu_idle());
244# define rcu_read_release_bh() lock_release(&rcu_bh_lock_map, 1, _THIS_IP_) 243 lock_acquire(map, 0, 0, 2, 1, NULL, _THIS_IP_);
244}
245 245
246extern struct lockdep_map rcu_sched_lock_map; 246static inline void rcu_lock_release(struct lockdep_map *map)
247# define rcu_read_acquire_sched() \ 247{
248 lock_acquire(&rcu_sched_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) 248 WARN_ON_ONCE(rcu_is_cpu_idle());
249# define rcu_read_release_sched() \ 249 lock_release(map, 1, _THIS_IP_);
250 lock_release(&rcu_sched_lock_map, 1, _THIS_IP_) 250}
251 251
252extern struct lockdep_map rcu_lock_map;
253extern struct lockdep_map rcu_bh_lock_map;
254extern struct lockdep_map rcu_sched_lock_map;
252extern int debug_lockdep_rcu_enabled(void); 255extern int debug_lockdep_rcu_enabled(void);
253 256
254/** 257/**
@@ -262,11 +265,18 @@ extern int debug_lockdep_rcu_enabled(void);
262 * 265 *
263 * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot 266 * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot
264 * and while lockdep is disabled. 267 * and while lockdep is disabled.
268 *
269 * Note that rcu_read_lock() and the matching rcu_read_unlock() must
270 * occur in the same context, for example, it is illegal to invoke
271 * rcu_read_unlock() in process context if the matching rcu_read_lock()
272 * was invoked from within an irq handler.
265 */ 273 */
266static inline int rcu_read_lock_held(void) 274static inline int rcu_read_lock_held(void)
267{ 275{
268 if (!debug_lockdep_rcu_enabled()) 276 if (!debug_lockdep_rcu_enabled())
269 return 1; 277 return 1;
278 if (rcu_is_cpu_idle())
279 return 0;
270 return lock_is_held(&rcu_lock_map); 280 return lock_is_held(&rcu_lock_map);
271} 281}
272 282
@@ -290,6 +300,19 @@ extern int rcu_read_lock_bh_held(void);
290 * 300 *
291 * Check debug_lockdep_rcu_enabled() to prevent false positives during boot 301 * Check debug_lockdep_rcu_enabled() to prevent false positives during boot
292 * and while lockdep is disabled. 302 * and while lockdep is disabled.
303 *
304 * Note that if the CPU is in the idle loop from an RCU point of
305 * view (ie: that we are in the section between rcu_idle_enter() and
306 * rcu_idle_exit()) then rcu_read_lock_held() returns false even if the CPU
307 * did an rcu_read_lock(). The reason for this is that RCU ignores CPUs
308 * that are in such a section, considering these as in extended quiescent
309 * state, so such a CPU is effectively never in an RCU read-side critical
310 * section regardless of what RCU primitives it invokes. This state of
311 * affairs is required --- we need to keep an RCU-free window in idle
312 * where the CPU may possibly enter into low power mode. This way we can
313 * notice an extended quiescent state to other CPUs that started a grace
314 * period. Otherwise we would delay any grace period as long as we run in
315 * the idle task.
293 */ 316 */
294#ifdef CONFIG_PREEMPT_COUNT 317#ifdef CONFIG_PREEMPT_COUNT
295static inline int rcu_read_lock_sched_held(void) 318static inline int rcu_read_lock_sched_held(void)
@@ -298,6 +321,8 @@ static inline int rcu_read_lock_sched_held(void)
298 321
299 if (!debug_lockdep_rcu_enabled()) 322 if (!debug_lockdep_rcu_enabled())
300 return 1; 323 return 1;
324 if (rcu_is_cpu_idle())
325 return 0;
301 if (debug_locks) 326 if (debug_locks)
302 lockdep_opinion = lock_is_held(&rcu_sched_lock_map); 327 lockdep_opinion = lock_is_held(&rcu_sched_lock_map);
303 return lockdep_opinion || preempt_count() != 0 || irqs_disabled(); 328 return lockdep_opinion || preempt_count() != 0 || irqs_disabled();
@@ -311,12 +336,8 @@ static inline int rcu_read_lock_sched_held(void)
311 336
312#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 337#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
313 338
314# define rcu_read_acquire() do { } while (0) 339# define rcu_lock_acquire(a) do { } while (0)
315# define rcu_read_release() do { } while (0) 340# define rcu_lock_release(a) do { } while (0)
316# define rcu_read_acquire_bh() do { } while (0)
317# define rcu_read_release_bh() do { } while (0)
318# define rcu_read_acquire_sched() do { } while (0)
319# define rcu_read_release_sched() do { } while (0)
320 341
321static inline int rcu_read_lock_held(void) 342static inline int rcu_read_lock_held(void)
322{ 343{
@@ -637,7 +658,7 @@ static inline void rcu_read_lock(void)
637{ 658{
638 __rcu_read_lock(); 659 __rcu_read_lock();
639 __acquire(RCU); 660 __acquire(RCU);
640 rcu_read_acquire(); 661 rcu_lock_acquire(&rcu_lock_map);
641} 662}
642 663
643/* 664/*
@@ -657,7 +678,7 @@ static inline void rcu_read_lock(void)
657 */ 678 */
658static inline void rcu_read_unlock(void) 679static inline void rcu_read_unlock(void)
659{ 680{
660 rcu_read_release(); 681 rcu_lock_release(&rcu_lock_map);
661 __release(RCU); 682 __release(RCU);
662 __rcu_read_unlock(); 683 __rcu_read_unlock();
663} 684}
@@ -673,12 +694,17 @@ static inline void rcu_read_unlock(void)
673 * critical sections in interrupt context can use just rcu_read_lock(), 694 * critical sections in interrupt context can use just rcu_read_lock(),
674 * though this should at least be commented to avoid confusing people 695 * though this should at least be commented to avoid confusing people
675 * reading the code. 696 * reading the code.
697 *
698 * Note that rcu_read_lock_bh() and the matching rcu_read_unlock_bh()
699 * must occur in the same context, for example, it is illegal to invoke
700 * rcu_read_unlock_bh() from one task if the matching rcu_read_lock_bh()
701 * was invoked from some other task.
676 */ 702 */
677static inline void rcu_read_lock_bh(void) 703static inline void rcu_read_lock_bh(void)
678{ 704{
679 local_bh_disable(); 705 local_bh_disable();
680 __acquire(RCU_BH); 706 __acquire(RCU_BH);
681 rcu_read_acquire_bh(); 707 rcu_lock_acquire(&rcu_bh_lock_map);
682} 708}
683 709
684/* 710/*
@@ -688,7 +714,7 @@ static inline void rcu_read_lock_bh(void)
688 */ 714 */
689static inline void rcu_read_unlock_bh(void) 715static inline void rcu_read_unlock_bh(void)
690{ 716{
691 rcu_read_release_bh(); 717 rcu_lock_release(&rcu_bh_lock_map);
692 __release(RCU_BH); 718 __release(RCU_BH);
693 local_bh_enable(); 719 local_bh_enable();
694} 720}
@@ -700,12 +726,17 @@ static inline void rcu_read_unlock_bh(void)
700 * are being done using call_rcu_sched() or synchronize_rcu_sched(). 726 * are being done using call_rcu_sched() or synchronize_rcu_sched().
701 * Read-side critical sections can also be introduced by anything that 727 * Read-side critical sections can also be introduced by anything that
702 * disables preemption, including local_irq_disable() and friends. 728 * disables preemption, including local_irq_disable() and friends.
729 *
730 * Note that rcu_read_lock_sched() and the matching rcu_read_unlock_sched()
731 * must occur in the same context, for example, it is illegal to invoke
732 * rcu_read_unlock_sched() from process context if the matching
733 * rcu_read_lock_sched() was invoked from an NMI handler.
703 */ 734 */
704static inline void rcu_read_lock_sched(void) 735static inline void rcu_read_lock_sched(void)
705{ 736{
706 preempt_disable(); 737 preempt_disable();
707 __acquire(RCU_SCHED); 738 __acquire(RCU_SCHED);
708 rcu_read_acquire_sched(); 739 rcu_lock_acquire(&rcu_sched_lock_map);
709} 740}
710 741
711/* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */ 742/* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */
@@ -722,7 +753,7 @@ static inline notrace void rcu_read_lock_sched_notrace(void)
722 */ 753 */
723static inline void rcu_read_unlock_sched(void) 754static inline void rcu_read_unlock_sched(void)
724{ 755{
725 rcu_read_release_sched(); 756 rcu_lock_release(&rcu_sched_lock_map);
726 __release(RCU_SCHED); 757 __release(RCU_SCHED);
727 preempt_enable(); 758 preempt_enable();
728} 759}
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 690276a642cf..eb93921cdd30 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -23,9 +23,8 @@ struct spi_device;
23/* An enum of all the supported cache types */ 23/* An enum of all the supported cache types */
24enum regcache_type { 24enum regcache_type {
25 REGCACHE_NONE, 25 REGCACHE_NONE,
26 REGCACHE_INDEXED,
27 REGCACHE_RBTREE, 26 REGCACHE_RBTREE,
28 REGCACHE_LZO 27 REGCACHE_COMPRESSED
29}; 28};
30 29
31/** 30/**
@@ -83,7 +82,7 @@ struct regmap_config {
83 bool (*precious_reg)(struct device *dev, unsigned int reg); 82 bool (*precious_reg)(struct device *dev, unsigned int reg);
84 83
85 unsigned int max_register; 84 unsigned int max_register;
86 struct reg_default *reg_defaults; 85 const struct reg_default *reg_defaults;
87 unsigned int num_reg_defaults; 86 unsigned int num_reg_defaults;
88 enum regcache_type cache_type; 87 enum regcache_type cache_type;
89 const void *reg_defaults_raw; 88 const void *reg_defaults_raw;
@@ -129,6 +128,8 @@ struct regmap *regmap_init_spi(struct spi_device *dev,
129 const struct regmap_config *config); 128 const struct regmap_config *config);
130 129
131void regmap_exit(struct regmap *map); 130void regmap_exit(struct regmap *map);
131int regmap_reinit_cache(struct regmap *map,
132 const struct regmap_config *config);
132int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); 133int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
133int regmap_raw_write(struct regmap *map, unsigned int reg, 134int regmap_raw_write(struct regmap *map, unsigned int reg,
134 const void *val, size_t val_len); 135 const void *val, size_t val_len);
@@ -139,9 +140,61 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
139 size_t val_count); 140 size_t val_count);
140int regmap_update_bits(struct regmap *map, unsigned int reg, 141int regmap_update_bits(struct regmap *map, unsigned int reg,
141 unsigned int mask, unsigned int val); 142 unsigned int mask, unsigned int val);
143int regmap_update_bits_check(struct regmap *map, unsigned int reg,
144 unsigned int mask, unsigned int val,
145 bool *change);
142 146
143int regcache_sync(struct regmap *map); 147int regcache_sync(struct regmap *map);
144void regcache_cache_only(struct regmap *map, bool enable); 148void regcache_cache_only(struct regmap *map, bool enable);
145void regcache_cache_bypass(struct regmap *map, bool enable); 149void regcache_cache_bypass(struct regmap *map, bool enable);
150void regcache_mark_dirty(struct regmap *map);
151
152/**
153 * Description of an IRQ for the generic regmap irq_chip.
154 *
155 * @reg_offset: Offset of the status/mask register within the bank
156 * @mask: Mask used to flag/control the register.
157 */
158struct regmap_irq {
159 unsigned int reg_offset;
160 unsigned int mask;
161};
162
163/**
164 * Description of a generic regmap irq_chip. This is not intended to
165 * handle every possible interrupt controller, but it should handle a
166 * substantial proportion of those that are found in the wild.
167 *
168 * @name: Descriptive name for IRQ controller.
169 *
170 * @status_base: Base status register address.
171 * @mask_base: Base mask register address.
172 * @ack_base: Base ack address. If zero then the chip is clear on read.
173 *
174 * @num_regs: Number of registers in each control bank.
175 * @irqs: Descriptors for individual IRQs. Interrupt numbers are
176 * assigned based on the index in the array of the interrupt.
177 * @num_irqs: Number of descriptors.
178 */
179struct regmap_irq_chip {
180 const char *name;
181
182 unsigned int status_base;
183 unsigned int mask_base;
184 unsigned int ack_base;
185
186 int num_regs;
187
188 const struct regmap_irq *irqs;
189 int num_irqs;
190};
191
192struct regmap_irq_chip_data;
193
194int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
195 int irq_base, struct regmap_irq_chip *chip,
196 struct regmap_irq_chip_data **data);
197void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
198int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
146 199
147#endif 200#endif
diff --git a/include/linux/regset.h b/include/linux/regset.h
index 8abee6556223..686f37327a49 100644
--- a/include/linux/regset.h
+++ b/include/linux/regset.h
@@ -335,8 +335,11 @@ static inline int copy_regset_to_user(struct task_struct *target,
335{ 335{
336 const struct user_regset *regset = &view->regsets[setno]; 336 const struct user_regset *regset = &view->regsets[setno];
337 337
338 if (!regset->get)
339 return -EOPNOTSUPP;
340
338 if (!access_ok(VERIFY_WRITE, data, size)) 341 if (!access_ok(VERIFY_WRITE, data, size))
339 return -EIO; 342 return -EFAULT;
340 343
341 return regset->get(target, regset, offset, size, NULL, data); 344 return regset->get(target, regset, offset, size, NULL, data);
342} 345}
@@ -358,8 +361,11 @@ static inline int copy_regset_from_user(struct task_struct *target,
358{ 361{
359 const struct user_regset *regset = &view->regsets[setno]; 362 const struct user_regset *regset = &view->regsets[setno];
360 363
364 if (!regset->set)
365 return -EOPNOTSUPP;
366
361 if (!access_ok(VERIFY_READ, data, size)) 367 if (!access_ok(VERIFY_READ, data, size))
362 return -EIO; 368 return -EFAULT;
363 369
364 return regset->set(target, regset, offset, size, NULL, data); 370 return regset->set(target, regset, offset, size, NULL, data);
365} 371}
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index f7756d146c61..f2698a0edfc4 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -149,6 +149,8 @@ int regulator_bulk_enable(int num_consumers,
149 struct regulator_bulk_data *consumers); 149 struct regulator_bulk_data *consumers);
150int regulator_bulk_disable(int num_consumers, 150int regulator_bulk_disable(int num_consumers,
151 struct regulator_bulk_data *consumers); 151 struct regulator_bulk_data *consumers);
152int regulator_bulk_force_disable(int num_consumers,
153 struct regulator_bulk_data *consumers);
152void regulator_bulk_free(int num_consumers, 154void regulator_bulk_free(int num_consumers,
153 struct regulator_bulk_data *consumers); 155 struct regulator_bulk_data *consumers);
154 156
@@ -212,6 +214,11 @@ static inline int regulator_disable(struct regulator *regulator)
212 return 0; 214 return 0;
213} 215}
214 216
217static inline int regulator_force_disable(struct regulator *regulator)
218{
219 return 0;
220}
221
215static inline int regulator_disable_deferred(struct regulator *regulator, 222static inline int regulator_disable_deferred(struct regulator *regulator,
216 int ms) 223 int ms)
217{ 224{
@@ -242,6 +249,12 @@ static inline int regulator_bulk_disable(int num_consumers,
242 return 0; 249 return 0;
243} 250}
244 251
252static inline int regulator_bulk_force_disable(int num_consumers,
253 struct regulator_bulk_data *consumers)
254{
255 return 0;
256}
257
245static inline void regulator_bulk_free(int num_consumers, 258static inline void regulator_bulk_free(int num_consumers,
246 struct regulator_bulk_data *consumers) 259 struct regulator_bulk_data *consumers)
247{ 260{
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 52c89ae32f64..4214b9a9d1c9 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -154,6 +154,7 @@ enum regulator_type {
154 * this type. 154 * this type.
155 * 155 *
156 * @name: Identifying name for the regulator. 156 * @name: Identifying name for the regulator.
157 * @supply_name: Identifying the regulator supply
157 * @id: Numerical identifier for the regulator. 158 * @id: Numerical identifier for the regulator.
158 * @n_voltages: Number of selectors available for ops.list_voltage(). 159 * @n_voltages: Number of selectors available for ops.list_voltage().
159 * @ops: Regulator operations table. 160 * @ops: Regulator operations table.
@@ -163,6 +164,7 @@ enum regulator_type {
163 */ 164 */
164struct regulator_desc { 165struct regulator_desc {
165 const char *name; 166 const char *name;
167 const char *supply_name;
166 int id; 168 int id;
167 unsigned n_voltages; 169 unsigned n_voltages;
168 struct regulator_ops *ops; 170 struct regulator_ops *ops;
@@ -212,7 +214,7 @@ struct regulator_dev {
212 214
213struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, 215struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
214 struct device *dev, const struct regulator_init_data *init_data, 216 struct device *dev, const struct regulator_init_data *init_data,
215 void *driver_data); 217 void *driver_data, struct device_node *of_node);
216void regulator_unregister(struct regulator_dev *rdev); 218void regulator_unregister(struct regulator_dev *rdev);
217 219
218int regulator_notifier_call_chain(struct regulator_dev *rdev, 220int regulator_notifier_call_chain(struct regulator_dev *rdev,
diff --git a/include/linux/regulator/of_regulator.h b/include/linux/regulator/of_regulator.h
new file mode 100644
index 000000000000..769704f296e5
--- /dev/null
+++ b/include/linux/regulator/of_regulator.h
@@ -0,0 +1,22 @@
1/*
2 * OpenFirmware regulator support routines
3 *
4 */
5
6#ifndef __LINUX_OF_REG_H
7#define __LINUX_OF_REG_H
8
9#if defined(CONFIG_OF)
10extern struct regulator_init_data
11 *of_get_regulator_init_data(struct device *dev,
12 struct device_node *node);
13#else
14static inline struct regulator_init_data
15 *of_get_regulator_init_data(struct device *dev,
16 struct device_node *node)
17{
18 return NULL;
19}
20#endif /* CONFIG_OF */
21
22#endif /* __LINUX_OF_REG_H */
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 96d465f8d3e6..2213ddcce20c 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1759,13 +1759,14 @@ struct reiserfs_journal_header {
1759 REISERFS_QUOTA_TRANS_BLOCKS(sb))) 1759 REISERFS_QUOTA_TRANS_BLOCKS(sb)))
1760 1760
1761#ifdef CONFIG_QUOTA 1761#ifdef CONFIG_QUOTA
1762#define REISERFS_QUOTA_OPTS ((1 << REISERFS_USRQUOTA) | (1 << REISERFS_GRPQUOTA))
1762/* We need to update data and inode (atime) */ 1763/* We need to update data and inode (atime) */
1763#define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? 2 : 0) 1764#define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & REISERFS_QUOTA_OPTS ? 2 : 0)
1764/* 1 balancing, 1 bitmap, 1 data per write + stat data update */ 1765/* 1 balancing, 1 bitmap, 1 data per write + stat data update */
1765#define REISERFS_QUOTA_INIT_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? \ 1766#define REISERFS_QUOTA_INIT_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & REISERFS_QUOTA_OPTS ? \
1766(DQUOT_INIT_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_INIT_REWRITE+1) : 0) 1767(DQUOT_INIT_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_INIT_REWRITE+1) : 0)
1767/* same as with INIT */ 1768/* same as with INIT */
1768#define REISERFS_QUOTA_DEL_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? \ 1769#define REISERFS_QUOTA_DEL_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & REISERFS_QUOTA_OPTS ? \
1769(DQUOT_DEL_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_DEL_REWRITE+1) : 0) 1770(DQUOT_DEL_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_DEL_REWRITE+1) : 0)
1770#else 1771#else
1771#define REISERFS_QUOTA_TRANS_BLOCKS(s) 0 1772#define REISERFS_QUOTA_TRANS_BLOCKS(s) 0
@@ -2056,7 +2057,7 @@ struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key);
2056 2057
2057struct reiserfs_security_handle; 2058struct reiserfs_security_handle;
2058int reiserfs_new_inode(struct reiserfs_transaction_handle *th, 2059int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
2059 struct inode *dir, int mode, 2060 struct inode *dir, umode_t mode,
2060 const char *symname, loff_t i_size, 2061 const char *symname, loff_t i_size,
2061 struct dentry *dentry, struct inode *inode, 2062 struct dentry *dentry, struct inode *inode,
2062 struct reiserfs_security_handle *security); 2063 struct reiserfs_security_handle *security);
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index 52c83b6a758a..8c9e85c64b46 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -417,6 +417,7 @@ struct reiserfs_sb_info {
417 char *s_qf_names[MAXQUOTAS]; 417 char *s_qf_names[MAXQUOTAS];
418 int s_jquota_fmt; 418 int s_jquota_fmt;
419#endif 419#endif
420 char *s_jdev; /* Stored jdev for mount option showing */
420#ifdef CONFIG_REISERFS_CHECK 421#ifdef CONFIG_REISERFS_CHECK
421 422
422 struct tree_balance *cur_tb; /* 423 struct tree_balance *cur_tb; /*
@@ -482,7 +483,8 @@ enum reiserfs_mount_options {
482 REISERFS_ERROR_RO, 483 REISERFS_ERROR_RO,
483 REISERFS_ERROR_CONTINUE, 484 REISERFS_ERROR_CONTINUE,
484 485
485 REISERFS_QUOTA, /* Some quota option specified */ 486 REISERFS_USRQUOTA, /* User quota option specified */
487 REISERFS_GRPQUOTA, /* Group quota option specified */
486 488
487 REISERFS_TEST1, 489 REISERFS_TEST1,
488 REISERFS_TEST2, 490 REISERFS_TEST2,
diff --git a/include/linux/relay.h b/include/linux/relay.h
index 14a86bc7102b..a822fd71fd64 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -144,7 +144,7 @@ struct rchan_callbacks
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,
147 int mode, 147 umode_t mode,
148 struct rchan_buf *buf, 148 struct rchan_buf *buf,
149 int *is_global); 149 int *is_global);
150 150
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index c9d625ca659e..da81af086eaf 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -109,12 +109,18 @@ void res_counter_init(struct res_counter *counter, struct res_counter *parent);
109 * 109 *
110 * returns 0 on success and <0 if the counter->usage will exceed the 110 * returns 0 on success and <0 if the counter->usage will exceed the
111 * counter->limit _locked call expects the counter->lock to be taken 111 * counter->limit _locked call expects the counter->lock to be taken
112 *
113 * charge_nofail works the same, except that it charges the resource
114 * counter unconditionally, and returns < 0 if the after the current
115 * charge we are over limit.
112 */ 116 */
113 117
114int __must_check res_counter_charge_locked(struct res_counter *counter, 118int __must_check res_counter_charge_locked(struct res_counter *counter,
115 unsigned long val); 119 unsigned long val);
116int __must_check res_counter_charge(struct res_counter *counter, 120int __must_check res_counter_charge(struct res_counter *counter,
117 unsigned long val, struct res_counter **limit_fail_at); 121 unsigned long val, struct res_counter **limit_fail_at);
122int __must_check res_counter_charge_nofail(struct res_counter *counter,
123 unsigned long val, struct res_counter **limit_fail_at);
118 124
119/* 125/*
120 * uncharge - tell that some portion of the resource is released 126 * uncharge - tell that some portion of the resource is released
@@ -142,7 +148,10 @@ static inline unsigned long long res_counter_margin(struct res_counter *cnt)
142 unsigned long flags; 148 unsigned long flags;
143 149
144 spin_lock_irqsave(&cnt->lock, flags); 150 spin_lock_irqsave(&cnt->lock, flags);
145 margin = cnt->limit - cnt->usage; 151 if (cnt->limit > cnt->usage)
152 margin = cnt->limit - cnt->usage;
153 else
154 margin = 0;
146 spin_unlock_irqrestore(&cnt->lock, flags); 155 spin_unlock_irqrestore(&cnt->lock, flags);
147 return margin; 156 return margin;
148} 157}
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 2148b122779b..1cdd62a2788a 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -120,6 +120,7 @@ void anon_vma_init(void); /* create anon_vma_cachep */
120int anon_vma_prepare(struct vm_area_struct *); 120int anon_vma_prepare(struct vm_area_struct *);
121void unlink_anon_vmas(struct vm_area_struct *); 121void unlink_anon_vmas(struct vm_area_struct *);
122int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *); 122int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *);
123void anon_vma_moveto_tail(struct vm_area_struct *);
123int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *); 124int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *);
124void __anon_vma_link(struct vm_area_struct *); 125void __anon_vma_link(struct vm_area_struct *);
125 126
@@ -157,7 +158,7 @@ static inline void page_dup_rmap(struct page *page)
157 * Called from mm/vmscan.c to handle paging out 158 * Called from mm/vmscan.c to handle paging out
158 */ 159 */
159int page_referenced(struct page *, int is_locked, 160int page_referenced(struct page *, int is_locked,
160 struct mem_cgroup *cnt, unsigned long *vm_flags); 161 struct mem_cgroup *memcg, unsigned long *vm_flags);
161int page_referenced_one(struct page *, struct vm_area_struct *, 162int page_referenced_one(struct page *, struct vm_area_struct *,
162 unsigned long address, unsigned int *mapcount, unsigned long *vm_flags); 163 unsigned long address, unsigned int *mapcount, unsigned long *vm_flags);
163 164
@@ -235,7 +236,7 @@ int rmap_walk(struct page *page, int (*rmap_one)(struct page *,
235#define anon_vma_link(vma) do {} while (0) 236#define anon_vma_link(vma) do {} while (0)
236 237
237static inline int page_referenced(struct page *page, int is_locked, 238static inline int page_referenced(struct page *page, int is_locked,
238 struct mem_cgroup *cnt, 239 struct mem_cgroup *memcg,
239 unsigned long *vm_flags) 240 unsigned long *vm_flags)
240{ 241{
241 *vm_flags = 0; 242 *vm_flags = 0;
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 8e872ead88b5..577592ea0ea0 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -602,6 +602,9 @@ struct tcamsg {
602#define TCA_ACT_TAB 1 /* attr type must be >=1 */ 602#define TCA_ACT_TAB 1 /* attr type must be >=1 */
603#define TCAA_MAX 1 603#define TCAA_MAX 1
604 604
605/* New extended info filters for IFLA_EXT_MASK */
606#define RTEXT_FILTER_VF (1 << 0)
607
605/* End of information exported to user level */ 608/* End of information exported to user level */
606 609
607#ifdef __KERNEL__ 610#ifdef __KERNEL__
diff --git a/include/linux/s3c_adc_battery.h b/include/linux/s3c_adc_battery.h
index fbe58b7e63eb..99dadbffdd4f 100644
--- a/include/linux/s3c_adc_battery.h
+++ b/include/linux/s3c_adc_battery.h
@@ -25,6 +25,10 @@ struct s3c_adc_bat_pdata {
25 const unsigned int current_channel; 25 const unsigned int current_channel;
26 const unsigned int backup_volt_channel; 26 const unsigned int backup_volt_channel;
27 27
28 const unsigned int volt_samples;
29 const unsigned int current_samples;
30 const unsigned int backup_volt_samples;
31
28 const unsigned int volt_mult; 32 const unsigned int volt_mult;
29 const unsigned int current_mult; 33 const unsigned int current_mult;
30 const unsigned int backup_volt_mult; 34 const unsigned int backup_volt_mult;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 1c4f3e9b9bc5..0657368bd78f 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -220,7 +220,7 @@ extern char ___assert_task_state[1 - 2*!!(
220 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0) 220 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)
221#define task_contributes_to_load(task) \ 221#define task_contributes_to_load(task) \
222 ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \ 222 ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \
223 (task->flags & PF_FREEZING) == 0) 223 (task->flags & PF_FROZEN) == 0)
224 224
225#define __set_task_state(tsk, state_value) \ 225#define __set_task_state(tsk, state_value) \
226 do { (tsk)->state = (state_value); } while (0) 226 do { (tsk)->state = (state_value); } while (0)
@@ -273,9 +273,11 @@ extern int runqueue_is_locked(int cpu);
273 273
274#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) 274#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
275extern void select_nohz_load_balancer(int stop_tick); 275extern void select_nohz_load_balancer(int stop_tick);
276extern void set_cpu_sd_state_idle(void);
276extern int get_nohz_timer_target(void); 277extern int get_nohz_timer_target(void);
277#else 278#else
278static inline void select_nohz_load_balancer(int stop_tick) { } 279static inline void select_nohz_load_balancer(int stop_tick) { }
280static inline void set_cpu_sd_state_idle(void) { }
279#endif 281#endif
280 282
281/* 283/*
@@ -483,8 +485,8 @@ struct task_cputime {
483 485
484#define INIT_CPUTIME \ 486#define INIT_CPUTIME \
485 (struct task_cputime) { \ 487 (struct task_cputime) { \
486 .utime = cputime_zero, \ 488 .utime = 0, \
487 .stime = cputime_zero, \ 489 .stime = 0, \
488 .sum_exec_runtime = 0, \ 490 .sum_exec_runtime = 0, \
489 } 491 }
490 492
@@ -635,13 +637,15 @@ struct signal_struct {
635#endif 637#endif
636#ifdef CONFIG_CGROUPS 638#ifdef CONFIG_CGROUPS
637 /* 639 /*
638 * The threadgroup_fork_lock prevents threads from forking with 640 * group_rwsem prevents new tasks from entering the threadgroup and
639 * CLONE_THREAD while held for writing. Use this for fork-sensitive 641 * member tasks from exiting,a more specifically, setting of
640 * threadgroup-wide operations. It's taken for reading in fork.c in 642 * PF_EXITING. fork and exit paths are protected with this rwsem
641 * copy_process(). 643 * using threadgroup_change_begin/end(). Users which require
642 * Currently only needed write-side by cgroups. 644 * threadgroup to remain stable should use threadgroup_[un]lock()
645 * which also takes care of exec path. Currently, cgroup is the
646 * only user.
643 */ 647 */
644 struct rw_semaphore threadgroup_fork_lock; 648 struct rw_semaphore group_rwsem;
645#endif 649#endif
646 650
647 int oom_adj; /* OOM kill score adjustment (bit shift) */ 651 int oom_adj; /* OOM kill score adjustment (bit shift) */
@@ -901,6 +905,10 @@ struct sched_group_power {
901 * single CPU. 905 * single CPU.
902 */ 906 */
903 unsigned int power, power_orig; 907 unsigned int power, power_orig;
908 /*
909 * Number of busy cpus in this group.
910 */
911 atomic_t nr_busy_cpus;
904}; 912};
905 913
906struct sched_group { 914struct sched_group {
@@ -925,6 +933,15 @@ static inline struct cpumask *sched_group_cpus(struct sched_group *sg)
925 return to_cpumask(sg->cpumask); 933 return to_cpumask(sg->cpumask);
926} 934}
927 935
936/**
937 * group_first_cpu - Returns the first cpu in the cpumask of a sched_group.
938 * @group: The group whose first cpu is to be returned.
939 */
940static inline unsigned int group_first_cpu(struct sched_group *group)
941{
942 return cpumask_first(sched_group_cpus(group));
943}
944
928struct sched_domain_attr { 945struct sched_domain_attr {
929 int relax_domain_level; 946 int relax_domain_level;
930}; 947};
@@ -1315,8 +1332,8 @@ struct task_struct {
1315 * older sibling, respectively. (p->father can be replaced with 1332 * older sibling, respectively. (p->father can be replaced with
1316 * p->real_parent->pid) 1333 * p->real_parent->pid)
1317 */ 1334 */
1318 struct task_struct *real_parent; /* real parent process */ 1335 struct task_struct __rcu *real_parent; /* real parent process */
1319 struct task_struct *parent; /* recipient of SIGCHLD, wait4() reports */ 1336 struct task_struct __rcu *parent; /* recipient of SIGCHLD, wait4() reports */
1320 /* 1337 /*
1321 * children/sibling forms the list of my natural children 1338 * children/sibling forms the list of my natural children
1322 */ 1339 */
@@ -1527,6 +1544,7 @@ struct task_struct {
1527 */ 1544 */
1528 int nr_dirtied; 1545 int nr_dirtied;
1529 int nr_dirtied_pause; 1546 int nr_dirtied_pause;
1547 unsigned long dirty_paused_when; /* start of a write-and-pause period */
1530 1548
1531#ifdef CONFIG_LATENCYTOP 1549#ifdef CONFIG_LATENCYTOP
1532 int latency_record_count; 1550 int latency_record_count;
@@ -1759,7 +1777,6 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1759/* 1777/*
1760 * Per process flags 1778 * Per process flags
1761 */ 1779 */
1762#define PF_STARTING 0x00000002 /* being created */
1763#define PF_EXITING 0x00000004 /* getting shut down */ 1780#define PF_EXITING 0x00000004 /* getting shut down */
1764#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ 1781#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */
1765#define PF_VCPU 0x00000010 /* I'm a virtual CPU */ 1782#define PF_VCPU 0x00000010 /* I'm a virtual CPU */
@@ -1772,7 +1789,6 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1772#define PF_MEMALLOC 0x00000800 /* Allocating memory */ 1789#define PF_MEMALLOC 0x00000800 /* Allocating memory */
1773#define PF_NPROC_EXCEEDED 0x00001000 /* set_user noticed that RLIMIT_NPROC was exceeded */ 1790#define PF_NPROC_EXCEEDED 0x00001000 /* set_user noticed that RLIMIT_NPROC was exceeded */
1774#define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */ 1791#define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */
1775#define PF_FREEZING 0x00004000 /* freeze in progress. do not account to load */
1776#define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */ 1792#define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */
1777#define PF_FROZEN 0x00010000 /* frozen for system suspend */ 1793#define PF_FROZEN 0x00010000 /* frozen for system suspend */
1778#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */ 1794#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */
@@ -1788,7 +1804,6 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1788#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1804#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1789#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1805#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1790#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ 1806#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */
1791#define PF_FREEZER_NOSIG 0x80000000 /* Freezer won't send signals to it */
1792 1807
1793/* 1808/*
1794 * Only the _current_ task can read/write to tsk->flags, but other 1809 * Only the _current_ task can read/write to tsk->flags, but other
@@ -2070,6 +2085,14 @@ extern int sched_setscheduler(struct task_struct *, int,
2070extern int sched_setscheduler_nocheck(struct task_struct *, int, 2085extern int sched_setscheduler_nocheck(struct task_struct *, int,
2071 const struct sched_param *); 2086 const struct sched_param *);
2072extern struct task_struct *idle_task(int cpu); 2087extern struct task_struct *idle_task(int cpu);
2088/**
2089 * is_idle_task - is the specified task an idle task?
2090 * @p: the task in question.
2091 */
2092static inline bool is_idle_task(const struct task_struct *p)
2093{
2094 return p->pid == 0;
2095}
2073extern struct task_struct *curr_task(int cpu); 2096extern struct task_struct *curr_task(int cpu);
2074extern void set_curr_task(int cpu, struct task_struct *p); 2097extern void set_curr_task(int cpu, struct task_struct *p);
2075 2098
@@ -2235,6 +2258,12 @@ static inline void mmdrop(struct mm_struct * mm)
2235extern void mmput(struct mm_struct *); 2258extern void mmput(struct mm_struct *);
2236/* Grab a reference to a task's mm, if it is not already going away */ 2259/* Grab a reference to a task's mm, if it is not already going away */
2237extern struct mm_struct *get_task_mm(struct task_struct *task); 2260extern struct mm_struct *get_task_mm(struct task_struct *task);
2261/*
2262 * Grab a reference to a task's mm, if it is not already going away
2263 * and ptrace_may_access with the mode parameter passed to it
2264 * succeeds.
2265 */
2266extern struct mm_struct *mm_access(struct task_struct *task, unsigned int mode);
2238/* Remove the current tasks stale references to the old mm_struct */ 2267/* Remove the current tasks stale references to the old mm_struct */
2239extern void mm_release(struct task_struct *, struct mm_struct *); 2268extern void mm_release(struct task_struct *, struct mm_struct *);
2240/* Allocate a new mm structure and copy contents from tsk->mm */ 2269/* Allocate a new mm structure and copy contents from tsk->mm */
@@ -2251,7 +2280,7 @@ extern void __cleanup_sighand(struct sighand_struct *);
2251extern void exit_itimers(struct signal_struct *); 2280extern void exit_itimers(struct signal_struct *);
2252extern void flush_itimer_signals(void); 2281extern void flush_itimer_signals(void);
2253 2282
2254extern NORET_TYPE void do_group_exit(int); 2283extern void do_group_exit(int);
2255 2284
2256extern void daemonize(const char *, ...); 2285extern void daemonize(const char *, ...);
2257extern int allow_signal(int); 2286extern int allow_signal(int);
@@ -2341,7 +2370,7 @@ static inline int thread_group_empty(struct task_struct *p)
2341 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring 2370 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring
2342 * subscriptions and synchronises with wait4(). Also used in procfs. Also 2371 * subscriptions and synchronises with wait4(). Also used in procfs. Also
2343 * pins the final release of task.io_context. Also protects ->cpuset and 2372 * pins the final release of task.io_context. Also protects ->cpuset and
2344 * ->cgroup.subsys[]. 2373 * ->cgroup.subsys[]. And ->vfork_done.
2345 * 2374 *
2346 * Nests both inside and outside of read_lock(&tasklist_lock). 2375 * Nests both inside and outside of read_lock(&tasklist_lock).
2347 * It must not be nested with write_lock_irq(&tasklist_lock), 2376 * It must not be nested with write_lock_irq(&tasklist_lock),
@@ -2373,29 +2402,62 @@ static inline void unlock_task_sighand(struct task_struct *tsk,
2373 spin_unlock_irqrestore(&tsk->sighand->siglock, *flags); 2402 spin_unlock_irqrestore(&tsk->sighand->siglock, *flags);
2374} 2403}
2375 2404
2376/* See the declaration of threadgroup_fork_lock in signal_struct. */
2377#ifdef CONFIG_CGROUPS 2405#ifdef CONFIG_CGROUPS
2378static inline void threadgroup_fork_read_lock(struct task_struct *tsk) 2406static inline void threadgroup_change_begin(struct task_struct *tsk)
2379{ 2407{
2380 down_read(&tsk->signal->threadgroup_fork_lock); 2408 down_read(&tsk->signal->group_rwsem);
2381} 2409}
2382static inline void threadgroup_fork_read_unlock(struct task_struct *tsk) 2410static inline void threadgroup_change_end(struct task_struct *tsk)
2383{ 2411{
2384 up_read(&tsk->signal->threadgroup_fork_lock); 2412 up_read(&tsk->signal->group_rwsem);
2385} 2413}
2386static inline void threadgroup_fork_write_lock(struct task_struct *tsk) 2414
2415/**
2416 * threadgroup_lock - lock threadgroup
2417 * @tsk: member task of the threadgroup to lock
2418 *
2419 * Lock the threadgroup @tsk belongs to. No new task is allowed to enter
2420 * and member tasks aren't allowed to exit (as indicated by PF_EXITING) or
2421 * perform exec. This is useful for cases where the threadgroup needs to
2422 * stay stable across blockable operations.
2423 *
2424 * fork and exit paths explicitly call threadgroup_change_{begin|end}() for
2425 * synchronization. While held, no new task will be added to threadgroup
2426 * and no existing live task will have its PF_EXITING set.
2427 *
2428 * During exec, a task goes and puts its thread group through unusual
2429 * changes. After de-threading, exclusive access is assumed to resources
2430 * which are usually shared by tasks in the same group - e.g. sighand may
2431 * be replaced with a new one. Also, the exec'ing task takes over group
2432 * leader role including its pid. Exclude these changes while locked by
2433 * grabbing cred_guard_mutex which is used to synchronize exec path.
2434 */
2435static inline void threadgroup_lock(struct task_struct *tsk)
2387{ 2436{
2388 down_write(&tsk->signal->threadgroup_fork_lock); 2437 /*
2438 * exec uses exit for de-threading nesting group_rwsem inside
2439 * cred_guard_mutex. Grab cred_guard_mutex first.
2440 */
2441 mutex_lock(&tsk->signal->cred_guard_mutex);
2442 down_write(&tsk->signal->group_rwsem);
2389} 2443}
2390static inline void threadgroup_fork_write_unlock(struct task_struct *tsk) 2444
2445/**
2446 * threadgroup_unlock - unlock threadgroup
2447 * @tsk: member task of the threadgroup to unlock
2448 *
2449 * Reverse threadgroup_lock().
2450 */
2451static inline void threadgroup_unlock(struct task_struct *tsk)
2391{ 2452{
2392 up_write(&tsk->signal->threadgroup_fork_lock); 2453 up_write(&tsk->signal->group_rwsem);
2454 mutex_unlock(&tsk->signal->cred_guard_mutex);
2393} 2455}
2394#else 2456#else
2395static inline void threadgroup_fork_read_lock(struct task_struct *tsk) {} 2457static inline void threadgroup_change_begin(struct task_struct *tsk) {}
2396static inline void threadgroup_fork_read_unlock(struct task_struct *tsk) {} 2458static inline void threadgroup_change_end(struct task_struct *tsk) {}
2397static inline void threadgroup_fork_write_lock(struct task_struct *tsk) {} 2459static inline void threadgroup_lock(struct task_struct *tsk) {}
2398static inline void threadgroup_fork_write_unlock(struct task_struct *tsk) {} 2460static inline void threadgroup_unlock(struct task_struct *tsk) {}
2399#endif 2461#endif
2400 2462
2401#ifndef __HAVE_THREAD_FUNCTIONS 2463#ifndef __HAVE_THREAD_FUNCTIONS
diff --git a/include/linux/security.h b/include/linux/security.h
index e8c619d39291..83c18e8c846d 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -54,8 +54,8 @@ struct user_namespace;
54 * These functions are in security/capability.c and are used 54 * These functions are in security/capability.c and are used
55 * as the default capabilities functions 55 * as the default capabilities functions
56 */ 56 */
57extern int cap_capable(struct task_struct *tsk, const struct cred *cred, 57extern int cap_capable(const struct cred *cred, struct user_namespace *ns,
58 struct user_namespace *ns, int cap, int audit); 58 int cap, int audit);
59extern int cap_settime(const struct timespec *ts, const struct timezone *tz); 59extern int cap_settime(const struct timespec *ts, const struct timezone *tz);
60extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode); 60extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode);
61extern int cap_ptrace_traceme(struct task_struct *parent); 61extern int cap_ptrace_traceme(struct task_struct *parent);
@@ -96,7 +96,6 @@ struct xfrm_user_sec_ctx;
96struct seq_file; 96struct seq_file;
97 97
98extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); 98extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
99extern int cap_netlink_recv(struct sk_buff *skb, int cap);
100 99
101void reset_security_ops(void); 100void reset_security_ops(void);
102 101
@@ -186,7 +185,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
186 * Security module identifier. 185 * Security module identifier.
187 * 186 *
188 * @name: 187 * @name:
189 * A string that acts as a unique identifeir for the LSM with max number 188 * A string that acts as a unique identifier for the LSM with max number
190 * of characters = SECURITY_NAME_MAX. 189 * of characters = SECURITY_NAME_MAX.
191 * 190 *
192 * Security hooks for program execution operations. 191 * Security hooks for program execution operations.
@@ -275,7 +274,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
275 * @copy copied data which will be passed to the security module. 274 * @copy copied data which will be passed to the security module.
276 * Returns 0 if the copy was successful. 275 * Returns 0 if the copy was successful.
277 * @sb_remount: 276 * @sb_remount:
278 * Extracts security system specifc mount options and verifys no changes 277 * Extracts security system specific mount options and verifies no changes
279 * are being made to those options. 278 * are being made to those options.
280 * @sb superblock being remounted 279 * @sb superblock being remounted
281 * @data contains the filesystem-specific data. 280 * @data contains the filesystem-specific data.
@@ -380,15 +379,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
380 * Return 0 if permission is granted. 379 * Return 0 if permission is granted.
381 * @inode_mkdir: 380 * @inode_mkdir:
382 * Check permissions to create a new directory in the existing directory 381 * Check permissions to create a new directory in the existing directory
383 * associated with inode strcture @dir. 382 * associated with inode structure @dir.
384 * @dir containst the inode structure of parent of the directory to be created. 383 * @dir contains the inode structure of parent of the directory to be created.
385 * @dentry contains the dentry structure of new directory. 384 * @dentry contains the dentry structure of new directory.
386 * @mode contains the mode of new directory. 385 * @mode contains the mode of new directory.
387 * Return 0 if permission is granted. 386 * Return 0 if permission is granted.
388 * @path_mkdir: 387 * @path_mkdir:
389 * Check permissions to create a new directory in the existing directory 388 * Check permissions to create a new directory in the existing directory
390 * associated with path strcture @path. 389 * associated with path structure @path.
391 * @dir containst the path structure of parent of the directory 390 * @dir contains the path structure of parent of the directory
392 * to be created. 391 * to be created.
393 * @dentry contains the dentry structure of new directory. 392 * @dentry contains the dentry structure of new directory.
394 * @mode contains the mode of new directory. 393 * @mode contains the mode of new directory.
@@ -578,7 +577,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
578 * @file contains the file structure. 577 * @file contains the file structure.
579 * @cmd contains the operation to perform. 578 * @cmd contains the operation to perform.
580 * @arg contains the operational arguments. 579 * @arg contains the operational arguments.
581 * Check permission for an ioctl operation on @file. Note that @arg can 580 * Check permission for an ioctl operation on @file. Note that @arg
582 * sometimes represents a user space pointer; in other cases, it may be a 581 * sometimes represents a user space pointer; in other cases, it may be a
583 * simple integer value. When @arg represents a user space pointer, it 582 * simple integer value. When @arg represents a user space pointer, it
584 * should never be used by the security module. 583 * should never be used by the security module.
@@ -590,6 +589,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
590 * @reqprot contains the protection requested by the application. 589 * @reqprot contains the protection requested by the application.
591 * @prot contains the protection that will be applied by the kernel. 590 * @prot contains the protection that will be applied by the kernel.
592 * @flags contains the operational flags. 591 * @flags contains the operational flags.
592 * @addr contains virtual address that will be used for the operation.
593 * @addr_only contains a boolean: 0 if file-backed VMA, otherwise 1.
593 * Return 0 if permission is granted. 594 * Return 0 if permission is granted.
594 * @file_mprotect: 595 * @file_mprotect:
595 * Check permissions before changing memory access permissions. 596 * Check permissions before changing memory access permissions.
@@ -606,7 +607,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
606 * Return 0 if permission is granted. 607 * Return 0 if permission is granted.
607 * @file_fcntl: 608 * @file_fcntl:
608 * Check permission before allowing the file operation specified by @cmd 609 * Check permission before allowing the file operation specified by @cmd
609 * from being performed on the file @file. Note that @arg can sometimes 610 * from being performed on the file @file. Note that @arg sometimes
610 * represents a user space pointer; in other cases, it may be a simple 611 * represents a user space pointer; in other cases, it may be a simple
611 * integer value. When @arg represents a user space pointer, it should 612 * integer value. When @arg represents a user space pointer, it should
612 * never be used by the security module. 613 * never be used by the security module.
@@ -793,16 +794,10 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
793 * information can be saved using the eff_cap field of the 794 * information can be saved using the eff_cap field of the
794 * netlink_skb_parms structure. Also may be used to provide fine 795 * netlink_skb_parms structure. Also may be used to provide fine
795 * grained control over message transmission. 796 * grained control over message transmission.
796 * @sk associated sock of task sending the message., 797 * @sk associated sock of task sending the message.
797 * @skb contains the sk_buff structure for the netlink message. 798 * @skb contains the sk_buff structure for the netlink message.
798 * Return 0 if the information was successfully saved and message 799 * Return 0 if the information was successfully saved and message
799 * is allowed to be transmitted. 800 * is allowed to be transmitted.
800 * @netlink_recv:
801 * Check permission before processing the received netlink message in
802 * @skb.
803 * @skb contains the sk_buff structure for the netlink message.
804 * @cap indicates the capability required
805 * Return 0 if permission is granted.
806 * 801 *
807 * Security hooks for Unix domain networking. 802 * Security hooks for Unix domain networking.
808 * 803 *
@@ -1080,9 +1075,9 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1080 * should free it. 1075 * should free it.
1081 * @key points to the key to be queried. 1076 * @key points to the key to be queried.
1082 * @_buffer points to a pointer that should be set to point to the 1077 * @_buffer points to a pointer that should be set to point to the
1083 * resulting string (if no label or an error occurs). 1078 * resulting string (if no label or an error occurs).
1084 * Return the length of the string (including terminating NUL) or -ve if 1079 * Return the length of the string (including terminating NUL) or -ve if
1085 * an error. 1080 * an error.
1086 * May also return 0 (and a NULL buffer pointer) if there is no label. 1081 * May also return 0 (and a NULL buffer pointer) if there is no label.
1087 * 1082 *
1088 * Security hooks affecting all System V IPC operations. 1083 * Security hooks affecting all System V IPC operations.
@@ -1266,9 +1261,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1266 * @capable: 1261 * @capable:
1267 * Check whether the @tsk process has the @cap capability in the indicated 1262 * Check whether the @tsk process has the @cap capability in the indicated
1268 * credentials. 1263 * credentials.
1269 * @tsk contains the task_struct for the process.
1270 * @cred contains the credentials to use. 1264 * @cred contains the credentials to use.
1271 * @ns contains the user namespace we want the capability in 1265 * @ns contains the user namespace we want the capability in
1272 * @cap contains the capability <include/linux/capability.h>. 1266 * @cap contains the capability <include/linux/capability.h>.
1273 * @audit: Whether to write an audit message or not 1267 * @audit: Whether to write an audit message or not
1274 * Return 0 if the capability is granted for @tsk. 1268 * Return 0 if the capability is granted for @tsk.
@@ -1370,7 +1364,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1370 * @ctxlen contains the length of @ctx. 1364 * @ctxlen contains the length of @ctx.
1371 * 1365 *
1372 * @inode_getsecctx: 1366 * @inode_getsecctx:
1373 * Returns a string containing all relavent security context information 1367 * Returns a string containing all relevant security context information
1374 * 1368 *
1375 * @inode we wish to get the security context of. 1369 * @inode we wish to get the security context of.
1376 * @ctx is a pointer in which to place the allocated security context. 1370 * @ctx is a pointer in which to place the allocated security context.
@@ -1390,8 +1384,8 @@ struct security_operations {
1390 const kernel_cap_t *effective, 1384 const kernel_cap_t *effective,
1391 const kernel_cap_t *inheritable, 1385 const kernel_cap_t *inheritable,
1392 const kernel_cap_t *permitted); 1386 const kernel_cap_t *permitted);
1393 int (*capable) (struct task_struct *tsk, const struct cred *cred, 1387 int (*capable) (const struct cred *cred, struct user_namespace *ns,
1394 struct user_namespace *ns, int cap, int audit); 1388 int cap, int audit);
1395 int (*quotactl) (int cmds, int type, int id, struct super_block *sb); 1389 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
1396 int (*quota_on) (struct dentry *dentry); 1390 int (*quota_on) (struct dentry *dentry);
1397 int (*syslog) (int type); 1391 int (*syslog) (int type);
@@ -1424,9 +1418,9 @@ struct security_operations {
1424 1418
1425#ifdef CONFIG_SECURITY_PATH 1419#ifdef CONFIG_SECURITY_PATH
1426 int (*path_unlink) (struct path *dir, struct dentry *dentry); 1420 int (*path_unlink) (struct path *dir, struct dentry *dentry);
1427 int (*path_mkdir) (struct path *dir, struct dentry *dentry, int mode); 1421 int (*path_mkdir) (struct path *dir, struct dentry *dentry, umode_t mode);
1428 int (*path_rmdir) (struct path *dir, struct dentry *dentry); 1422 int (*path_rmdir) (struct path *dir, struct dentry *dentry);
1429 int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode, 1423 int (*path_mknod) (struct path *dir, struct dentry *dentry, umode_t mode,
1430 unsigned int dev); 1424 unsigned int dev);
1431 int (*path_truncate) (struct path *path); 1425 int (*path_truncate) (struct path *path);
1432 int (*path_symlink) (struct path *dir, struct dentry *dentry, 1426 int (*path_symlink) (struct path *dir, struct dentry *dentry,
@@ -1435,8 +1429,7 @@ struct security_operations {
1435 struct dentry *new_dentry); 1429 struct dentry *new_dentry);
1436 int (*path_rename) (struct path *old_dir, struct dentry *old_dentry, 1430 int (*path_rename) (struct path *old_dir, struct dentry *old_dentry,
1437 struct path *new_dir, struct dentry *new_dentry); 1431 struct path *new_dir, struct dentry *new_dentry);
1438 int (*path_chmod) (struct dentry *dentry, struct vfsmount *mnt, 1432 int (*path_chmod) (struct path *path, umode_t mode);
1439 mode_t mode);
1440 int (*path_chown) (struct path *path, uid_t uid, gid_t gid); 1433 int (*path_chown) (struct path *path, uid_t uid, gid_t gid);
1441 int (*path_chroot) (struct path *path); 1434 int (*path_chroot) (struct path *path);
1442#endif 1435#endif
@@ -1447,16 +1440,16 @@ struct security_operations {
1447 const struct qstr *qstr, char **name, 1440 const struct qstr *qstr, char **name,
1448 void **value, size_t *len); 1441 void **value, size_t *len);
1449 int (*inode_create) (struct inode *dir, 1442 int (*inode_create) (struct inode *dir,
1450 struct dentry *dentry, int mode); 1443 struct dentry *dentry, umode_t mode);
1451 int (*inode_link) (struct dentry *old_dentry, 1444 int (*inode_link) (struct dentry *old_dentry,
1452 struct inode *dir, struct dentry *new_dentry); 1445 struct inode *dir, struct dentry *new_dentry);
1453 int (*inode_unlink) (struct inode *dir, struct dentry *dentry); 1446 int (*inode_unlink) (struct inode *dir, struct dentry *dentry);
1454 int (*inode_symlink) (struct inode *dir, 1447 int (*inode_symlink) (struct inode *dir,
1455 struct dentry *dentry, const char *old_name); 1448 struct dentry *dentry, const char *old_name);
1456 int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode); 1449 int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, umode_t mode);
1457 int (*inode_rmdir) (struct inode *dir, struct dentry *dentry); 1450 int (*inode_rmdir) (struct inode *dir, struct dentry *dentry);
1458 int (*inode_mknod) (struct inode *dir, struct dentry *dentry, 1451 int (*inode_mknod) (struct inode *dir, struct dentry *dentry,
1459 int mode, dev_t dev); 1452 umode_t mode, dev_t dev);
1460 int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry, 1453 int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry,
1461 struct inode *new_dir, struct dentry *new_dentry); 1454 struct inode *new_dir, struct dentry *new_dentry);
1462 int (*inode_readlink) (struct dentry *dentry); 1455 int (*inode_readlink) (struct dentry *dentry);
@@ -1562,7 +1555,6 @@ struct security_operations {
1562 struct sembuf *sops, unsigned nsops, int alter); 1555 struct sembuf *sops, unsigned nsops, int alter);
1563 1556
1564 int (*netlink_send) (struct sock *sk, struct sk_buff *skb); 1557 int (*netlink_send) (struct sock *sk, struct sk_buff *skb);
1565 int (*netlink_recv) (struct sk_buff *skb, int cap);
1566 1558
1567 void (*d_instantiate) (struct dentry *dentry, struct inode *inode); 1559 void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
1568 1560
@@ -1674,12 +1666,10 @@ int security_capset(struct cred *new, const struct cred *old,
1674 const kernel_cap_t *effective, 1666 const kernel_cap_t *effective,
1675 const kernel_cap_t *inheritable, 1667 const kernel_cap_t *inheritable,
1676 const kernel_cap_t *permitted); 1668 const kernel_cap_t *permitted);
1677int security_capable(struct user_namespace *ns, const struct cred *cred, 1669int security_capable(const struct cred *cred, struct user_namespace *ns,
1678 int cap);
1679int security_real_capable(struct task_struct *tsk, struct user_namespace *ns,
1680 int cap); 1670 int cap);
1681int security_real_capable_noaudit(struct task_struct *tsk, 1671int security_capable_noaudit(const struct cred *cred, struct user_namespace *ns,
1682 struct user_namespace *ns, int cap); 1672 int cap);
1683int security_quotactl(int cmds, int type, int id, struct super_block *sb); 1673int security_quotactl(int cmds, int type, int id, struct super_block *sb);
1684int security_quota_on(struct dentry *dentry); 1674int security_quota_on(struct dentry *dentry);
1685int security_syslog(int type); 1675int security_syslog(int type);
@@ -1716,15 +1706,15 @@ int security_inode_init_security(struct inode *inode, struct inode *dir,
1716int security_old_inode_init_security(struct inode *inode, struct inode *dir, 1706int security_old_inode_init_security(struct inode *inode, struct inode *dir,
1717 const struct qstr *qstr, char **name, 1707 const struct qstr *qstr, char **name,
1718 void **value, size_t *len); 1708 void **value, size_t *len);
1719int security_inode_create(struct inode *dir, struct dentry *dentry, int mode); 1709int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode);
1720int security_inode_link(struct dentry *old_dentry, struct inode *dir, 1710int security_inode_link(struct dentry *old_dentry, struct inode *dir,
1721 struct dentry *new_dentry); 1711 struct dentry *new_dentry);
1722int security_inode_unlink(struct inode *dir, struct dentry *dentry); 1712int security_inode_unlink(struct inode *dir, struct dentry *dentry);
1723int security_inode_symlink(struct inode *dir, struct dentry *dentry, 1713int security_inode_symlink(struct inode *dir, struct dentry *dentry,
1724 const char *old_name); 1714 const char *old_name);
1725int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode); 1715int security_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
1726int security_inode_rmdir(struct inode *dir, struct dentry *dentry); 1716int security_inode_rmdir(struct inode *dir, struct dentry *dentry);
1727int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev); 1717int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev);
1728int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, 1718int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
1729 struct inode *new_dir, struct dentry *new_dentry); 1719 struct inode *new_dir, struct dentry *new_dentry);
1730int security_inode_readlink(struct dentry *dentry); 1720int security_inode_readlink(struct dentry *dentry);
@@ -1816,7 +1806,6 @@ void security_d_instantiate(struct dentry *dentry, struct inode *inode);
1816int security_getprocattr(struct task_struct *p, char *name, char **value); 1806int security_getprocattr(struct task_struct *p, char *name, char **value);
1817int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); 1807int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size);
1818int security_netlink_send(struct sock *sk, struct sk_buff *skb); 1808int security_netlink_send(struct sock *sk, struct sk_buff *skb);
1819int security_netlink_recv(struct sk_buff *skb, int cap);
1820int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); 1809int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
1821int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); 1810int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
1822void security_release_secctx(char *secdata, u32 seclen); 1811void security_release_secctx(char *secdata, u32 seclen);
@@ -1874,32 +1863,15 @@ static inline int security_capset(struct cred *new,
1874 return cap_capset(new, old, effective, inheritable, permitted); 1863 return cap_capset(new, old, effective, inheritable, permitted);
1875} 1864}
1876 1865
1877static inline int security_capable(struct user_namespace *ns, 1866static inline int security_capable(const struct cred *cred,
1878 const struct cred *cred, int cap) 1867 struct user_namespace *ns, int cap)
1879{
1880 return cap_capable(current, cred, ns, cap, SECURITY_CAP_AUDIT);
1881}
1882
1883static inline int security_real_capable(struct task_struct *tsk, struct user_namespace *ns, int cap)
1884{ 1868{
1885 int ret; 1869 return cap_capable(cred, ns, cap, SECURITY_CAP_AUDIT);
1886
1887 rcu_read_lock();
1888 ret = cap_capable(tsk, __task_cred(tsk), ns, cap, SECURITY_CAP_AUDIT);
1889 rcu_read_unlock();
1890 return ret;
1891} 1870}
1892 1871
1893static inline 1872static inline int security_capable_noaudit(const struct cred *cred,
1894int security_real_capable_noaudit(struct task_struct *tsk, struct user_namespace *ns, int cap) 1873 struct user_namespace *ns, int cap) {
1895{ 1874 return cap_capable(cred, ns, cap, SECURITY_CAP_NOAUDIT);
1896 int ret;
1897
1898 rcu_read_lock();
1899 ret = cap_capable(tsk, __task_cred(tsk), ns, cap,
1900 SECURITY_CAP_NOAUDIT);
1901 rcu_read_unlock();
1902 return ret;
1903} 1875}
1904 1876
1905static inline int security_quotactl(int cmds, int type, int id, 1877static inline int security_quotactl(int cmds, int type, int id,
@@ -2044,7 +2016,7 @@ static inline void security_inode_free(struct inode *inode)
2044static inline int security_inode_init_security(struct inode *inode, 2016static inline int security_inode_init_security(struct inode *inode,
2045 struct inode *dir, 2017 struct inode *dir,
2046 const struct qstr *qstr, 2018 const struct qstr *qstr,
2047 initxattrs initxattrs, 2019 const initxattrs initxattrs,
2048 void *fs_data) 2020 void *fs_data)
2049{ 2021{
2050 return 0; 2022 return 0;
@@ -2061,7 +2033,7 @@ static inline int security_old_inode_init_security(struct inode *inode,
2061 2033
2062static inline int security_inode_create(struct inode *dir, 2034static inline int security_inode_create(struct inode *dir,
2063 struct dentry *dentry, 2035 struct dentry *dentry,
2064 int mode) 2036 umode_t mode)
2065{ 2037{
2066 return 0; 2038 return 0;
2067} 2039}
@@ -2516,11 +2488,6 @@ static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb)
2516 return cap_netlink_send(sk, skb); 2488 return cap_netlink_send(sk, skb);
2517} 2489}
2518 2490
2519static inline int security_netlink_recv(struct sk_buff *skb, int cap)
2520{
2521 return cap_netlink_recv(skb, cap);
2522}
2523
2524static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) 2491static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2525{ 2492{
2526 return -EOPNOTSUPP; 2493 return -EOPNOTSUPP;
@@ -2855,9 +2822,9 @@ static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi
2855 2822
2856#ifdef CONFIG_SECURITY_PATH 2823#ifdef CONFIG_SECURITY_PATH
2857int security_path_unlink(struct path *dir, struct dentry *dentry); 2824int security_path_unlink(struct path *dir, struct dentry *dentry);
2858int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode); 2825int security_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode);
2859int security_path_rmdir(struct path *dir, struct dentry *dentry); 2826int security_path_rmdir(struct path *dir, struct dentry *dentry);
2860int security_path_mknod(struct path *dir, struct dentry *dentry, int mode, 2827int security_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode,
2861 unsigned int dev); 2828 unsigned int dev);
2862int security_path_truncate(struct path *path); 2829int security_path_truncate(struct path *path);
2863int security_path_symlink(struct path *dir, struct dentry *dentry, 2830int security_path_symlink(struct path *dir, struct dentry *dentry,
@@ -2866,8 +2833,7 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir,
2866 struct dentry *new_dentry); 2833 struct dentry *new_dentry);
2867int security_path_rename(struct path *old_dir, struct dentry *old_dentry, 2834int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
2868 struct path *new_dir, struct dentry *new_dentry); 2835 struct path *new_dir, struct dentry *new_dentry);
2869int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt, 2836int security_path_chmod(struct path *path, umode_t mode);
2870 mode_t mode);
2871int security_path_chown(struct path *path, uid_t uid, gid_t gid); 2837int security_path_chown(struct path *path, uid_t uid, gid_t gid);
2872int security_path_chroot(struct path *path); 2838int security_path_chroot(struct path *path);
2873#else /* CONFIG_SECURITY_PATH */ 2839#else /* CONFIG_SECURITY_PATH */
@@ -2877,7 +2843,7 @@ static inline int security_path_unlink(struct path *dir, struct dentry *dentry)
2877} 2843}
2878 2844
2879static inline int security_path_mkdir(struct path *dir, struct dentry *dentry, 2845static inline int security_path_mkdir(struct path *dir, struct dentry *dentry,
2880 int mode) 2846 umode_t mode)
2881{ 2847{
2882 return 0; 2848 return 0;
2883} 2849}
@@ -2888,7 +2854,7 @@ static inline int security_path_rmdir(struct path *dir, struct dentry *dentry)
2888} 2854}
2889 2855
2890static inline int security_path_mknod(struct path *dir, struct dentry *dentry, 2856static inline int security_path_mknod(struct path *dir, struct dentry *dentry,
2891 int mode, unsigned int dev) 2857 umode_t mode, unsigned int dev)
2892{ 2858{
2893 return 0; 2859 return 0;
2894} 2860}
@@ -2919,9 +2885,7 @@ static inline int security_path_rename(struct path *old_dir,
2919 return 0; 2885 return 0;
2920} 2886}
2921 2887
2922static inline int security_path_chmod(struct dentry *dentry, 2888static inline int security_path_chmod(struct path *path, umode_t mode)
2923 struct vfsmount *mnt,
2924 mode_t mode)
2925{ 2889{
2926 return 0; 2890 return 0;
2927} 2891}
@@ -3010,7 +2974,7 @@ static inline void security_audit_rule_free(void *lsmrule)
3010 2974
3011#ifdef CONFIG_SECURITYFS 2975#ifdef CONFIG_SECURITYFS
3012 2976
3013extern struct dentry *securityfs_create_file(const char *name, mode_t mode, 2977extern struct dentry *securityfs_create_file(const char *name, umode_t mode,
3014 struct dentry *parent, void *data, 2978 struct dentry *parent, void *data,
3015 const struct file_operations *fops); 2979 const struct file_operations *fops);
3016extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent); 2980extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
@@ -3025,7 +2989,7 @@ static inline struct dentry *securityfs_create_dir(const char *name,
3025} 2989}
3026 2990
3027static inline struct dentry *securityfs_create_file(const char *name, 2991static inline struct dentry *securityfs_create_file(const char *name,
3028 mode_t mode, 2992 umode_t mode,
3029 struct dentry *parent, 2993 struct dentry *parent,
3030 void *data, 2994 void *data,
3031 const struct file_operations *fops) 2995 const struct file_operations *fops)
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 0b69a4684216..44f1514b00ba 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -74,7 +74,7 @@ static inline void seq_commit(struct seq_file *m, int num)
74 } 74 }
75} 75}
76 76
77char *mangle_path(char *s, char *p, char *esc); 77char *mangle_path(char *s, const char *p, const char *esc);
78int seq_open(struct file *, const struct seq_operations *); 78int seq_open(struct file *, const struct seq_operations *);
79ssize_t seq_read(struct file *, char __user *, size_t, loff_t *); 79ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
80loff_t seq_lseek(struct file *, loff_t, int); 80loff_t seq_lseek(struct file *, loff_t, int);
@@ -86,10 +86,10 @@ int seq_write(struct seq_file *seq, const void *data, size_t len);
86 86
87__printf(2, 3) int seq_printf(struct seq_file *, const char *, ...); 87__printf(2, 3) int seq_printf(struct seq_file *, const char *, ...);
88 88
89int seq_path(struct seq_file *, struct path *, char *); 89int seq_path(struct seq_file *, const struct path *, const char *);
90int seq_dentry(struct seq_file *, struct dentry *, char *); 90int seq_dentry(struct seq_file *, struct dentry *, const char *);
91int seq_path_root(struct seq_file *m, struct path *path, struct path *root, 91int seq_path_root(struct seq_file *m, const struct path *path,
92 char *esc); 92 const struct path *root, const char *esc);
93int seq_bitmap(struct seq_file *m, const unsigned long *bits, 93int seq_bitmap(struct seq_file *m, const unsigned long *bits,
94 unsigned int nr_bits); 94 unsigned int nr_bits);
95static inline int seq_cpumask(struct seq_file *m, const struct cpumask *mask) 95static inline int seq_cpumask(struct seq_file *m, const struct cpumask *mask)
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 1f05bbeac01e..8f012f8ac8e9 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -66,6 +66,7 @@ enum {
66 * dependent on the 8250 driver. 66 * dependent on the 8250 driver.
67 */ 67 */
68struct uart_port; 68struct uart_port;
69struct uart_8250_port;
69 70
70int serial8250_register_port(struct uart_port *); 71int serial8250_register_port(struct uart_port *);
71void serial8250_unregister_port(int line); 72void serial8250_unregister_port(int line);
@@ -81,7 +82,11 @@ extern void serial8250_do_set_termios(struct uart_port *port,
81 struct ktermios *termios, struct ktermios *old); 82 struct ktermios *termios, struct ktermios *old);
82extern void serial8250_do_pm(struct uart_port *port, unsigned int state, 83extern void serial8250_do_pm(struct uart_port *port, unsigned int state,
83 unsigned int oldstate); 84 unsigned int oldstate);
85extern int fsl8250_handle_irq(struct uart_port *port);
84int serial8250_handle_irq(struct uart_port *port, unsigned int iir); 86int serial8250_handle_irq(struct uart_port *port, unsigned int iir);
87unsigned char serial8250_rx_chars(struct uart_8250_port *up, unsigned char lsr);
88void serial8250_tx_chars(struct uart_8250_port *up);
89unsigned int serial8250_modem_status(struct uart_8250_port *up);
85 90
86extern void serial8250_set_isa_configurator(void (*v) 91extern void serial8250_set_isa_configurator(void (*v)
87 (int port, struct uart_port *up, 92 (int port, struct uart_port *up,
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index eadf33d0abba..c91ace70c21d 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -207,6 +207,10 @@
207/* Xilinx PSS UART */ 207/* Xilinx PSS UART */
208#define PORT_XUARTPS 98 208#define PORT_XUARTPS 98
209 209
210/* Atheros AR933X SoC */
211#define PORT_AR933X 99
212
213
210#ifdef __KERNEL__ 214#ifdef __KERNEL__
211 215
212#include <linux/compiler.h> 216#include <linux/compiler.h>
@@ -351,6 +355,7 @@ struct uart_port {
351#define UPF_CONS_FLOW ((__force upf_t) (1 << 23)) 355#define UPF_CONS_FLOW ((__force upf_t) (1 << 23))
352#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24)) 356#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24))
353#define UPF_EXAR_EFR ((__force upf_t) (1 << 25)) 357#define UPF_EXAR_EFR ((__force upf_t) (1 << 25))
358#define UPF_IIR_ONCE ((__force upf_t) (1 << 26))
354/* The exact UART type is known and should not be probed. */ 359/* The exact UART type is known and should not be probed. */
355#define UPF_FIXED_TYPE ((__force upf_t) (1 << 27)) 360#define UPF_FIXED_TYPE ((__force upf_t) (1 << 27))
356#define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28)) 361#define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28))
@@ -483,10 +488,19 @@ static inline int uart_tx_stopped(struct uart_port *port)
483/* 488/*
484 * The following are helper functions for the low level drivers. 489 * The following are helper functions for the low level drivers.
485 */ 490 */
491
492extern void uart_handle_dcd_change(struct uart_port *uport,
493 unsigned int status);
494extern void uart_handle_cts_change(struct uart_port *uport,
495 unsigned int status);
496
497extern void uart_insert_char(struct uart_port *port, unsigned int status,
498 unsigned int overrun, unsigned int ch, unsigned int flag);
499
500#ifdef SUPPORT_SYSRQ
486static inline int 501static inline int
487uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) 502uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
488{ 503{
489#ifdef SUPPORT_SYSRQ
490 if (port->sysrq) { 504 if (port->sysrq) {
491 if (ch && time_before(jiffies, port->sysrq)) { 505 if (ch && time_before(jiffies, port->sysrq)) {
492 handle_sysrq(ch); 506 handle_sysrq(ch);
@@ -495,11 +509,10 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
495 } 509 }
496 port->sysrq = 0; 510 port->sysrq = 0;
497 } 511 }
498#endif
499 return 0; 512 return 0;
500} 513}
501#ifndef SUPPORT_SYSRQ 514#else
502#define uart_handle_sysrq_char(port,ch) uart_handle_sysrq_char(port, 0) 515#define uart_handle_sysrq_char(port,ch) ({ (void)port; 0; })
503#endif 516#endif
504 517
505/* 518/*
@@ -522,89 +535,6 @@ static inline int uart_handle_break(struct uart_port *port)
522 return 0; 535 return 0;
523} 536}
524 537
525/**
526 * uart_handle_dcd_change - handle a change of carrier detect state
527 * @uport: uart_port structure for the open port
528 * @status: new carrier detect status, nonzero if active
529 */
530static inline void
531uart_handle_dcd_change(struct uart_port *uport, unsigned int status)
532{
533 struct uart_state *state = uport->state;
534 struct tty_port *port = &state->port;
535 struct tty_ldisc *ld = tty_ldisc_ref(port->tty);
536 struct pps_event_time ts;
537
538 if (ld && ld->ops->dcd_change)
539 pps_get_ts(&ts);
540
541 uport->icount.dcd++;
542#ifdef CONFIG_HARD_PPS
543 if ((uport->flags & UPF_HARDPPS_CD) && status)
544 hardpps();
545#endif
546
547 if (port->flags & ASYNC_CHECK_CD) {
548 if (status)
549 wake_up_interruptible(&port->open_wait);
550 else if (port->tty)
551 tty_hangup(port->tty);
552 }
553
554 if (ld && ld->ops->dcd_change)
555 ld->ops->dcd_change(port->tty, status, &ts);
556 if (ld)
557 tty_ldisc_deref(ld);
558}
559
560/**
561 * uart_handle_cts_change - handle a change of clear-to-send state
562 * @uport: uart_port structure for the open port
563 * @status: new clear to send status, nonzero if active
564 */
565static inline void
566uart_handle_cts_change(struct uart_port *uport, unsigned int status)
567{
568 struct tty_port *port = &uport->state->port;
569 struct tty_struct *tty = port->tty;
570
571 uport->icount.cts++;
572
573 if (port->flags & ASYNC_CTS_FLOW) {
574 if (tty->hw_stopped) {
575 if (status) {
576 tty->hw_stopped = 0;
577 uport->ops->start_tx(uport);
578 uart_write_wakeup(uport);
579 }
580 } else {
581 if (!status) {
582 tty->hw_stopped = 1;
583 uport->ops->stop_tx(uport);
584 }
585 }
586 }
587}
588
589#include <linux/tty_flip.h>
590
591static inline void
592uart_insert_char(struct uart_port *port, unsigned int status,
593 unsigned int overrun, unsigned int ch, unsigned int flag)
594{
595 struct tty_struct *tty = port->state->port.tty;
596
597 if ((status & port->ignore_status_mask & ~overrun) == 0)
598 tty_insert_flip_char(tty, ch, flag);
599
600 /*
601 * Overrun is special. Since it's reported immediately,
602 * it doesn't affect the current character.
603 */
604 if (status & ~port->ignore_status_mask & overrun)
605 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
606}
607
608/* 538/*
609 * UART_ENABLE_MS - determine if port should enable modem status irqs 539 * UART_ENABLE_MS - determine if port should enable modem status irqs
610 */ 540 */
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 369273a52679..78779074f6e8 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -49,6 +49,10 @@ enum {
49 49
50#define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK) 50#define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
51 51
52/* SCSPTR, optional */
53#define SCSPTR_RTSIO (1 << 7)
54#define SCSPTR_CTSIO (1 << 5)
55
52/* Offsets into the sci_port->irqs array */ 56/* Offsets into the sci_port->irqs array */
53enum { 57enum {
54 SCIx_ERI_IRQ, 58 SCIx_ERI_IRQ,
@@ -60,6 +64,17 @@ enum {
60 SCIx_MUX_IRQ = SCIx_NR_IRQS, /* special case */ 64 SCIx_MUX_IRQ = SCIx_NR_IRQS, /* special case */
61}; 65};
62 66
67/* Offsets into the sci_port->gpios array */
68enum {
69 SCIx_SCK,
70 SCIx_RXD,
71 SCIx_TXD,
72 SCIx_CTS,
73 SCIx_RTS,
74
75 SCIx_NR_FNS,
76};
77
63enum { 78enum {
64 SCIx_PROBE_REGTYPE, 79 SCIx_PROBE_REGTYPE,
65 80
@@ -109,13 +124,20 @@ struct plat_sci_port_ops {
109}; 124};
110 125
111/* 126/*
127 * Port-specific capabilities
128 */
129#define SCIx_HAVE_RTSCTS (1 << 0)
130
131/*
112 * Platform device specific platform_data struct 132 * Platform device specific platform_data struct
113 */ 133 */
114struct plat_sci_port { 134struct plat_sci_port {
115 unsigned long mapbase; /* resource base */ 135 unsigned long mapbase; /* resource base */
116 unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */ 136 unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */
137 unsigned int gpios[SCIx_NR_FNS]; /* SCK, RXD, TXD, CTS, RTS */
117 unsigned int type; /* SCI / SCIF / IRDA */ 138 unsigned int type; /* SCI / SCIF / IRDA */
118 upf_t flags; /* UPF_* flags */ 139 upf_t flags; /* UPF_* flags */
140 unsigned long capabilities; /* Port features/capabilities */
119 141
120 unsigned int scbrr_algo_id; /* SCBRR calculation algo */ 142 unsigned int scbrr_algo_id; /* SCBRR calculation algo */
121 unsigned int scscr; /* SCSCR initialization */ 143 unsigned int scscr; /* SCSCR initialization */
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index a20831cf336a..54341d811685 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -49,6 +49,7 @@ struct clk {
49 49
50 void __iomem *enable_reg; 50 void __iomem *enable_reg;
51 unsigned int enable_bit; 51 unsigned int enable_bit;
52 void __iomem *mapped_reg;
52 53
53 unsigned long arch_flags; 54 unsigned long arch_flags;
54 void *priv; 55 void *priv;
@@ -131,10 +132,9 @@ int sh_clk_div4_enable_register(struct clk *clks, int nr,
131int sh_clk_div4_reparent_register(struct clk *clks, int nr, 132int sh_clk_div4_reparent_register(struct clk *clks, int nr,
132 struct clk_div4_table *table); 133 struct clk_div4_table *table);
133 134
134#define SH_CLK_DIV6_EXT(_parent, _reg, _flags, _parents, \ 135#define SH_CLK_DIV6_EXT(_reg, _flags, _parents, \
135 _num_parents, _src_shift, _src_width) \ 136 _num_parents, _src_shift, _src_width) \
136{ \ 137{ \
137 .parent = _parent, \
138 .enable_reg = (void __iomem *)_reg, \ 138 .enable_reg = (void __iomem *)_reg, \
139 .flags = _flags, \ 139 .flags = _flags, \
140 .parent_table = _parents, \ 140 .parent_table = _parents, \
@@ -144,7 +144,11 @@ int sh_clk_div4_reparent_register(struct clk *clks, int nr,
144} 144}
145 145
146#define SH_CLK_DIV6(_parent, _reg, _flags) \ 146#define SH_CLK_DIV6(_parent, _reg, _flags) \
147 SH_CLK_DIV6_EXT(_parent, _reg, _flags, NULL, 0, 0, 0) 147{ \
148 .parent = _parent, \
149 .enable_reg = (void __iomem *)_reg, \
150 .flags = _flags, \
151}
148 152
149int sh_clk_div6_register(struct clk *clks, int nr); 153int sh_clk_div6_register(struct clk *clks, int nr);
150int sh_clk_div6_reparent_register(struct clk *clks, int nr); 154int sh_clk_div6_reparent_register(struct clk *clks, int nr);
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
index cb2dd118cc0f..425450b980b8 100644
--- a/include/linux/sh_dma.h
+++ b/include/linux/sh_dma.h
@@ -30,7 +30,7 @@ struct sh_desc {
30 struct sh_dmae_regs hw; 30 struct sh_dmae_regs hw;
31 struct list_head node; 31 struct list_head node;
32 struct dma_async_tx_descriptor async_tx; 32 struct dma_async_tx_descriptor async_tx;
33 enum dma_data_direction direction; 33 enum dma_transfer_direction direction;
34 dma_cookie_t cookie; 34 dma_cookie_t cookie;
35 size_t partial; 35 size_t partial;
36 int chunks; 36 int chunks;
@@ -48,6 +48,7 @@ struct sh_dmae_channel {
48 unsigned int offset; 48 unsigned int offset;
49 unsigned int dmars; 49 unsigned int dmars;
50 unsigned int dmars_bit; 50 unsigned int dmars_bit;
51 unsigned int chclr_offset;
51}; 52};
52 53
53struct sh_dmae_pdata { 54struct sh_dmae_pdata {
@@ -68,6 +69,8 @@ struct sh_dmae_pdata {
68 unsigned int dmaor_is_32bit:1; 69 unsigned int dmaor_is_32bit:1;
69 unsigned int needs_tend_set:1; 70 unsigned int needs_tend_set:1;
70 unsigned int no_dmars:1; 71 unsigned int no_dmars:1;
72 unsigned int chclr_present:1;
73 unsigned int slave_only:1;
71}; 74};
72 75
73/* DMA register */ 76/* DMA register */
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index 5812fefbcedf..b160645f5599 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -95,6 +95,7 @@ struct intc_desc {
95 unsigned int num_resources; 95 unsigned int num_resources;
96 intc_enum force_enable; 96 intc_enum force_enable;
97 intc_enum force_disable; 97 intc_enum force_disable;
98 bool skip_syscore_suspend;
98 struct intc_hw_desc hw; 99 struct intc_hw_desc hw;
99}; 100};
100 101
diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
index 8446789216e5..5c15aed9c4b2 100644
--- a/include/linux/sh_pfc.h
+++ b/include/linux/sh_pfc.h
@@ -45,16 +45,24 @@ struct pinmux_cfg_reg {
45 unsigned long reg, reg_width, field_width; 45 unsigned long reg, reg_width, field_width;
46 unsigned long *cnt; 46 unsigned long *cnt;
47 pinmux_enum_t *enum_ids; 47 pinmux_enum_t *enum_ids;
48 unsigned long *var_field_width;
48}; 49};
49 50
50#define PINMUX_CFG_REG(name, r, r_width, f_width) \ 51#define PINMUX_CFG_REG(name, r, r_width, f_width) \
51 .reg = r, .reg_width = r_width, .field_width = f_width, \ 52 .reg = r, .reg_width = r_width, .field_width = f_width, \
52 .cnt = (unsigned long [r_width / f_width]) {}, \ 53 .cnt = (unsigned long [r_width / f_width]) {}, \
53 .enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)]) \ 54 .enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)])
55
56#define PINMUX_CFG_REG_VAR(name, r, r_width, var_fw0, var_fwn...) \
57 .reg = r, .reg_width = r_width, \
58 .cnt = (unsigned long [r_width]) {}, \
59 .var_field_width = (unsigned long [r_width]) { var_fw0, var_fwn, 0 }, \
60 .enum_ids = (pinmux_enum_t [])
54 61
55struct pinmux_data_reg { 62struct pinmux_data_reg {
56 unsigned long reg, reg_width, reg_shadow; 63 unsigned long reg, reg_width, reg_shadow;
57 pinmux_enum_t *enum_ids; 64 pinmux_enum_t *enum_ids;
65 void __iomem *mapped_reg;
58}; 66};
59 67
60#define PINMUX_DATA_REG(name, r, r_width) \ 68#define PINMUX_DATA_REG(name, r, r_width) \
@@ -75,6 +83,12 @@ struct pinmux_range {
75 pinmux_enum_t force; 83 pinmux_enum_t force;
76}; 84};
77 85
86struct pfc_window {
87 phys_addr_t phys;
88 void __iomem *virt;
89 unsigned long size;
90};
91
78struct pinmux_info { 92struct pinmux_info {
79 char *name; 93 char *name;
80 pinmux_enum_t reserved_id; 94 pinmux_enum_t reserved_id;
@@ -98,6 +112,12 @@ struct pinmux_info {
98 struct pinmux_irq *gpio_irq; 112 struct pinmux_irq *gpio_irq;
99 unsigned int gpio_irq_size; 113 unsigned int gpio_irq_size;
100 114
115 struct resource *resource;
116 unsigned int num_resources;
117 struct pfc_window *window;
118
119 unsigned long unlock_reg;
120
101 struct gpio_chip chip; 121 struct gpio_chip chip;
102}; 122};
103 123
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 9291ac3cc627..79ab2555b3b0 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -30,7 +30,7 @@ struct shmem_sb_info {
30 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */ 30 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */
31 uid_t uid; /* Mount uid for root directory */ 31 uid_t uid; /* Mount uid for root directory */
32 gid_t gid; /* Mount gid for root directory */ 32 gid_t gid; /* Mount gid for root directory */
33 mode_t mode; /* Mount mode for root directory */ 33 umode_t mode; /* Mount mode for root directory */
34 struct mempolicy *mpol; /* default memory policy for mappings */ 34 struct mempolicy *mpol; /* default memory policy for mappings */
35}; 35};
36 36
@@ -48,6 +48,7 @@ extern struct file *shmem_file_setup(const char *name,
48 loff_t size, unsigned long flags); 48 loff_t size, unsigned long flags);
49extern int shmem_zero_setup(struct vm_area_struct *); 49extern int shmem_zero_setup(struct vm_area_struct *);
50extern int shmem_lock(struct file *file, int lock, struct user_struct *user); 50extern int shmem_lock(struct file *file, int lock, struct user_struct *user);
51extern void shmem_unlock_mapping(struct address_space *mapping);
51extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping, 52extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
52 pgoff_t index, gfp_t gfp_mask); 53 pgoff_t index, gfp_t gfp_mask);
53extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end); 54extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end);
diff --git a/include/linux/sigma.h b/include/linux/sigma.h
deleted file mode 100644
index d0de882c0d96..000000000000
--- a/include/linux/sigma.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * Load firmware files from Analog Devices SigmaStudio
3 *
4 * Copyright 2009-2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __SIGMA_FIRMWARE_H__
10#define __SIGMA_FIRMWARE_H__
11
12#include <linux/firmware.h>
13#include <linux/types.h>
14
15struct i2c_client;
16
17#define SIGMA_MAGIC "ADISIGM"
18
19struct sigma_firmware {
20 const struct firmware *fw;
21 size_t pos;
22};
23
24struct sigma_firmware_header {
25 unsigned char magic[7];
26 u8 version;
27 __le32 crc;
28};
29
30enum {
31 SIGMA_ACTION_WRITEXBYTES = 0,
32 SIGMA_ACTION_WRITESINGLE,
33 SIGMA_ACTION_WRITESAFELOAD,
34 SIGMA_ACTION_DELAY,
35 SIGMA_ACTION_PLLWAIT,
36 SIGMA_ACTION_NOOP,
37 SIGMA_ACTION_END,
38};
39
40struct sigma_action {
41 u8 instr;
42 u8 len_hi;
43 __le16 len;
44 __be16 addr;
45 unsigned char payload[];
46};
47
48static inline u32 sigma_action_len(struct sigma_action *sa)
49{
50 return (sa->len_hi << 16) | le16_to_cpu(sa->len);
51}
52
53extern int process_sigma_firmware(struct i2c_client *client, const char *name);
54
55#endif
diff --git a/include/linux/signal.h b/include/linux/signal.h
index a822300a253b..7987ce74874b 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -254,6 +254,7 @@ extern void set_current_blocked(const sigset_t *);
254extern int show_unhandled_signals; 254extern int show_unhandled_signals;
255 255
256extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 256extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie);
257extern void block_sigmask(struct k_sigaction *ka, int signr);
257extern void exit_signals(struct task_struct *tsk); 258extern void exit_signals(struct task_struct *tsk);
258 259
259extern struct kmem_cache *sighand_cachep; 260extern struct kmem_cache *sighand_cachep;
diff --git a/include/linux/signalfd.h b/include/linux/signalfd.h
index 3ff4961da9b5..247399b2979a 100644
--- a/include/linux/signalfd.h
+++ b/include/linux/signalfd.h
@@ -61,13 +61,16 @@ static inline void signalfd_notify(struct task_struct *tsk, int sig)
61 wake_up(&tsk->sighand->signalfd_wqh); 61 wake_up(&tsk->sighand->signalfd_wqh);
62} 62}
63 63
64extern void signalfd_cleanup(struct sighand_struct *sighand);
65
64#else /* CONFIG_SIGNALFD */ 66#else /* CONFIG_SIGNALFD */
65 67
66static inline void signalfd_notify(struct task_struct *tsk, int sig) { } 68static inline void signalfd_notify(struct task_struct *tsk, int sig) { }
67 69
70static inline void signalfd_cleanup(struct sighand_struct *sighand) { }
71
68#endif /* CONFIG_SIGNALFD */ 72#endif /* CONFIG_SIGNALFD */
69 73
70#endif /* __KERNEL__ */ 74#endif /* __KERNEL__ */
71 75
72#endif /* _LINUX_SIGNALFD_H */ 76#endif /* _LINUX_SIGNALFD_H */
73
diff --git a/include/linux/sirfsoc_dma.h b/include/linux/sirfsoc_dma.h
new file mode 100644
index 000000000000..29d959333d81
--- /dev/null
+++ b/include/linux/sirfsoc_dma.h
@@ -0,0 +1,6 @@
1#ifndef _SIRFSOC_DMA_H_
2#define _SIRFSOC_DMA_H_
3
4bool sirfsoc_dma_filter_id(struct dma_chan *chan, void *chan_id);
5
6#endif
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index fe864885c1ed..ae86adee3746 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -30,6 +30,7 @@
30#include <linux/dmaengine.h> 30#include <linux/dmaengine.h>
31#include <linux/hrtimer.h> 31#include <linux/hrtimer.h>
32#include <linux/dma-mapping.h> 32#include <linux/dma-mapping.h>
33#include <linux/netdev_features.h>
33 34
34/* Don't change this without changing skb_csum_unnecessary! */ 35/* Don't change this without changing skb_csum_unnecessary! */
35#define CHECKSUM_NONE 0 36#define CHECKSUM_NONE 0
@@ -87,7 +88,6 @@
87 * at device setup time. 88 * at device setup time.
88 * NETIF_F_HW_CSUM - it is clever device, it is able to checksum 89 * NETIF_F_HW_CSUM - it is clever device, it is able to checksum
89 * everything. 90 * everything.
90 * NETIF_F_NO_CSUM - loopback or reliable single hop media.
91 * NETIF_F_IP_CSUM - device is dumb. It is able to csum only 91 * NETIF_F_IP_CSUM - device is dumb. It is able to csum only
92 * TCP/UDP over IPv4. Sigh. Vendors like this 92 * TCP/UDP over IPv4. Sigh. Vendors like this
93 * way by an unknown reason. Though, see comment above 93 * way by an unknown reason. Though, see comment above
@@ -128,13 +128,17 @@ struct sk_buff_head {
128 128
129struct sk_buff; 129struct sk_buff;
130 130
131/* To allow 64K frame to be packed as single skb without frag_list. Since 131/* To allow 64K frame to be packed as single skb without frag_list we
132 * GRO uses frags we allocate at least 16 regardless of page size. 132 * require 64K/PAGE_SIZE pages plus 1 additional page to allow for
133 * buffers which do not start on a page boundary.
134 *
135 * Since GRO uses frags we allocate at least 16 regardless of page
136 * size.
133 */ 137 */
134#if (65536/PAGE_SIZE + 2) < 16 138#if (65536/PAGE_SIZE + 1) < 16
135#define MAX_SKB_FRAGS 16UL 139#define MAX_SKB_FRAGS 16UL
136#else 140#else
137#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 2) 141#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)
138#endif 142#endif
139 143
140typedef struct skb_frag_struct skb_frag_t; 144typedef struct skb_frag_struct skb_frag_t;
@@ -218,6 +222,9 @@ enum {
218 222
219 /* device driver supports TX zero-copy buffers */ 223 /* device driver supports TX zero-copy buffers */
220 SKBTX_DEV_ZEROCOPY = 1 << 4, 224 SKBTX_DEV_ZEROCOPY = 1 << 4,
225
226 /* generate wifi status information (where possible) */
227 SKBTX_WIFI_STATUS = 1 << 5,
221}; 228};
222 229
223/* 230/*
@@ -235,15 +242,15 @@ struct ubuf_info {
235 * the end of the header data, ie. at skb->end. 242 * the end of the header data, ie. at skb->end.
236 */ 243 */
237struct skb_shared_info { 244struct skb_shared_info {
238 unsigned short nr_frags; 245 unsigned char nr_frags;
246 __u8 tx_flags;
239 unsigned short gso_size; 247 unsigned short gso_size;
240 /* Warning: this field is not always filled in (UFO)! */ 248 /* Warning: this field is not always filled in (UFO)! */
241 unsigned short gso_segs; 249 unsigned short gso_segs;
242 unsigned short gso_type; 250 unsigned short gso_type;
243 __be32 ip6_frag_id;
244 __u8 tx_flags;
245 struct sk_buff *frag_list; 251 struct sk_buff *frag_list;
246 struct skb_shared_hwtstamps hwtstamps; 252 struct skb_shared_hwtstamps hwtstamps;
253 __be32 ip6_frag_id;
247 254
248 /* 255 /*
249 * Warning : all fields before dataref are cleared in __alloc_skb() 256 * Warning : all fields before dataref are cleared in __alloc_skb()
@@ -352,6 +359,8 @@ typedef unsigned char *sk_buff_data_t;
352 * @ooo_okay: allow the mapping of a socket to a queue to be changed 359 * @ooo_okay: allow the mapping of a socket to a queue to be changed
353 * @l4_rxhash: indicate rxhash is a canonical 4-tuple hash over transport 360 * @l4_rxhash: indicate rxhash is a canonical 4-tuple hash over transport
354 * ports. 361 * ports.
362 * @wifi_acked_valid: wifi_acked was set
363 * @wifi_acked: whether frame was acked on wifi or not
355 * @dma_cookie: a cookie to one of several possible DMA operations 364 * @dma_cookie: a cookie to one of several possible DMA operations
356 * done by skb DMA functions 365 * done by skb DMA functions
357 * @secmark: security marking 366 * @secmark: security marking
@@ -445,10 +454,11 @@ struct sk_buff {
445#endif 454#endif
446 __u8 ooo_okay:1; 455 __u8 ooo_okay:1;
447 __u8 l4_rxhash:1; 456 __u8 l4_rxhash:1;
457 __u8 wifi_acked_valid:1;
458 __u8 wifi_acked:1;
459 /* 10/12 bit hole (depending on ndisc_nodetype presence) */
448 kmemcheck_bitfield_end(flags2); 460 kmemcheck_bitfield_end(flags2);
449 461
450 /* 0/13 bit hole */
451
452#ifdef CONFIG_NET_DMA 462#ifdef CONFIG_NET_DMA
453 dma_cookie_t dma_cookie; 463 dma_cookie_t dma_cookie;
454#endif 464#endif
@@ -540,6 +550,7 @@ extern void consume_skb(struct sk_buff *skb);
540extern void __kfree_skb(struct sk_buff *skb); 550extern void __kfree_skb(struct sk_buff *skb);
541extern struct sk_buff *__alloc_skb(unsigned int size, 551extern struct sk_buff *__alloc_skb(unsigned int size,
542 gfp_t priority, int fclone, int node); 552 gfp_t priority, int fclone, int node);
553extern struct sk_buff *build_skb(void *data);
543static inline struct sk_buff *alloc_skb(unsigned int size, 554static inline struct sk_buff *alloc_skb(unsigned int size,
544 gfp_t priority) 555 gfp_t priority)
545{ 556{
@@ -561,8 +572,9 @@ extern struct sk_buff *skb_clone(struct sk_buff *skb,
561 gfp_t priority); 572 gfp_t priority);
562extern struct sk_buff *skb_copy(const struct sk_buff *skb, 573extern struct sk_buff *skb_copy(const struct sk_buff *skb,
563 gfp_t priority); 574 gfp_t priority);
564extern struct sk_buff *pskb_copy(struct sk_buff *skb, 575extern struct sk_buff *__pskb_copy(struct sk_buff *skb,
565 gfp_t gfp_mask); 576 int headroom, gfp_t gfp_mask);
577
566extern int pskb_expand_head(struct sk_buff *skb, 578extern int pskb_expand_head(struct sk_buff *skb,
567 int nhead, int ntail, 579 int nhead, int ntail,
568 gfp_t gfp_mask); 580 gfp_t gfp_mask);
@@ -1453,6 +1465,16 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1453} 1465}
1454#endif /* NET_SKBUFF_DATA_USES_OFFSET */ 1466#endif /* NET_SKBUFF_DATA_USES_OFFSET */
1455 1467
1468static inline void skb_mac_header_rebuild(struct sk_buff *skb)
1469{
1470 if (skb_mac_header_was_set(skb)) {
1471 const unsigned char *old_mac = skb_mac_header(skb);
1472
1473 skb_set_mac_header(skb, -skb->mac_len);
1474 memmove(skb_mac_header(skb), old_mac, skb->mac_len);
1475 }
1476}
1477
1456static inline int skb_checksum_start_offset(const struct sk_buff *skb) 1478static inline int skb_checksum_start_offset(const struct sk_buff *skb)
1457{ 1479{
1458 return skb->csum_start - skb_headroom(skb); 1480 return skb->csum_start - skb_headroom(skb);
@@ -1662,38 +1684,6 @@ static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
1662} 1684}
1663 1685
1664/** 1686/**
1665 * __netdev_alloc_page - allocate a page for ps-rx on a specific device
1666 * @dev: network device to receive on
1667 * @gfp_mask: alloc_pages_node mask
1668 *
1669 * Allocate a new page. dev currently unused.
1670 *
1671 * %NULL is returned if there is no free memory.
1672 */
1673static inline struct page *__netdev_alloc_page(struct net_device *dev, gfp_t gfp_mask)
1674{
1675 return alloc_pages_node(NUMA_NO_NODE, gfp_mask, 0);
1676}
1677
1678/**
1679 * netdev_alloc_page - allocate a page for ps-rx on a specific device
1680 * @dev: network device to receive on
1681 *
1682 * Allocate a new page. dev currently unused.
1683 *
1684 * %NULL is returned if there is no free memory.
1685 */
1686static inline struct page *netdev_alloc_page(struct net_device *dev)
1687{
1688 return __netdev_alloc_page(dev, GFP_ATOMIC);
1689}
1690
1691static inline void netdev_free_page(struct net_device *dev, struct page *page)
1692{
1693 __free_page(page);
1694}
1695
1696/**
1697 * skb_frag_page - retrieve the page refered to by a paged fragment 1687 * skb_frag_page - retrieve the page refered to by a paged fragment
1698 * @frag: the paged fragment 1688 * @frag: the paged fragment
1699 * 1689 *
@@ -1824,6 +1814,12 @@ static inline dma_addr_t skb_frag_dma_map(struct device *dev,
1824 frag->page_offset + offset, size, dir); 1814 frag->page_offset + offset, size, dir);
1825} 1815}
1826 1816
1817static inline struct sk_buff *pskb_copy(struct sk_buff *skb,
1818 gfp_t gfp_mask)
1819{
1820 return __pskb_copy(skb, skb_headroom(skb), gfp_mask);
1821}
1822
1827/** 1823/**
1828 * skb_clone_writable - is the header of a clone writable 1824 * skb_clone_writable - is the header of a clone writable
1829 * @skb: buffer to check 1825 * @skb: buffer to check
@@ -2105,7 +2101,8 @@ extern void skb_split(struct sk_buff *skb,
2105extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, 2101extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
2106 int shiftlen); 2102 int shiftlen);
2107 2103
2108extern struct sk_buff *skb_segment(struct sk_buff *skb, u32 features); 2104extern struct sk_buff *skb_segment(struct sk_buff *skb,
2105 netdev_features_t features);
2109 2106
2110static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 2107static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
2111 int len, void *buffer) 2108 int len, void *buffer)
@@ -2263,6 +2260,15 @@ static inline void skb_tx_timestamp(struct sk_buff *skb)
2263 sw_tx_timestamp(skb); 2260 sw_tx_timestamp(skb);
2264} 2261}
2265 2262
2263/**
2264 * skb_complete_wifi_ack - deliver skb with wifi status
2265 *
2266 * @skb: the original outgoing packet
2267 * @acked: ack status
2268 *
2269 */
2270void skb_complete_wifi_ack(struct sk_buff *skb, bool acked);
2271
2266extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); 2272extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
2267extern __sum16 __skb_checksum_complete(struct sk_buff *skb); 2273extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
2268 2274
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index d00e0bacda93..fbd1117fdfde 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -15,8 +15,6 @@
15#include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */ 15#include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17 17
18#include <trace/events/kmem.h>
19
20/* 18/*
21 * struct kmem_cache 19 * struct kmem_cache
22 * 20 *
diff --git a/include/linux/smscphy.h b/include/linux/smscphy.h
new file mode 100644
index 000000000000..ce718cbce435
--- /dev/null
+++ b/include/linux/smscphy.h
@@ -0,0 +1,25 @@
1#ifndef __LINUX_SMSCPHY_H__
2#define __LINUX_SMSCPHY_H__
3
4#define MII_LAN83C185_ISF 29 /* Interrupt Source Flags */
5#define MII_LAN83C185_IM 30 /* Interrupt Mask */
6#define MII_LAN83C185_CTRL_STATUS 17 /* Mode/Status Register */
7
8#define MII_LAN83C185_ISF_INT1 (1<<1) /* Auto-Negotiation Page Received */
9#define MII_LAN83C185_ISF_INT2 (1<<2) /* Parallel Detection Fault */
10#define MII_LAN83C185_ISF_INT3 (1<<3) /* Auto-Negotiation LP Ack */
11#define MII_LAN83C185_ISF_INT4 (1<<4) /* Link Down */
12#define MII_LAN83C185_ISF_INT5 (1<<5) /* Remote Fault Detected */
13#define MII_LAN83C185_ISF_INT6 (1<<6) /* Auto-Negotiation complete */
14#define MII_LAN83C185_ISF_INT7 (1<<7) /* ENERGYON */
15
16#define MII_LAN83C185_ISF_INT_ALL (0x0e)
17
18#define MII_LAN83C185_ISF_INT_PHYLIB_EVENTS \
19 (MII_LAN83C185_ISF_INT6 | MII_LAN83C185_ISF_INT4 | \
20 MII_LAN83C185_ISF_INT7)
21
22#define MII_LAN83C185_EDPWRDOWN (1 << 13) /* EDPWRDOWN */
23#define MII_LAN83C185_ENERGYON (1 << 1) /* ENERGYON */
24
25#endif /* __LINUX_SMSCPHY_H__ */
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index e16557a357e5..c1241c428179 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -192,7 +192,6 @@ enum
192 LINUX_MIB_TCPPARTIALUNDO, /* TCPPartialUndo */ 192 LINUX_MIB_TCPPARTIALUNDO, /* TCPPartialUndo */
193 LINUX_MIB_TCPDSACKUNDO, /* TCPDSACKUndo */ 193 LINUX_MIB_TCPDSACKUNDO, /* TCPDSACKUndo */
194 LINUX_MIB_TCPLOSSUNDO, /* TCPLossUndo */ 194 LINUX_MIB_TCPLOSSUNDO, /* TCPLossUndo */
195 LINUX_MIB_TCPLOSS, /* TCPLoss */
196 LINUX_MIB_TCPLOSTRETRANSMIT, /* TCPLostRetransmit */ 195 LINUX_MIB_TCPLOSTRETRANSMIT, /* TCPLostRetransmit */
197 LINUX_MIB_TCPRENOFAILURES, /* TCPRenoFailures */ 196 LINUX_MIB_TCPRENOFAILURES, /* TCPRenoFailures */
198 LINUX_MIB_TCPSACKFAILURES, /* TCPSackFailures */ 197 LINUX_MIB_TCPSACKFAILURES, /* TCPSackFailures */
diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h
new file mode 100644
index 000000000000..251729a47880
--- /dev/null
+++ b/include/linux/sock_diag.h
@@ -0,0 +1,48 @@
1#ifndef __SOCK_DIAG_H__
2#define __SOCK_DIAG_H__
3
4#include <linux/types.h>
5
6#define SOCK_DIAG_BY_FAMILY 20
7
8struct sock_diag_req {
9 __u8 sdiag_family;
10 __u8 sdiag_protocol;
11};
12
13enum {
14 SK_MEMINFO_RMEM_ALLOC,
15 SK_MEMINFO_RCVBUF,
16 SK_MEMINFO_WMEM_ALLOC,
17 SK_MEMINFO_SNDBUF,
18 SK_MEMINFO_FWD_ALLOC,
19 SK_MEMINFO_WMEM_QUEUED,
20 SK_MEMINFO_OPTMEM,
21
22 SK_MEMINFO_VARS,
23};
24
25#ifdef __KERNEL__
26struct sk_buff;
27struct nlmsghdr;
28struct sock;
29
30struct sock_diag_handler {
31 __u8 family;
32 int (*dump)(struct sk_buff *skb, struct nlmsghdr *nlh);
33};
34
35int sock_diag_register(struct sock_diag_handler *h);
36void sock_diag_unregister(struct sock_diag_handler *h);
37
38void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
39void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
40
41int sock_diag_check_cookie(void *sk, __u32 *cookie);
42void sock_diag_save_cookie(void *sk, __u32 *cookie);
43
44int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr);
45
46extern struct sock *sock_diag_nlsk;
47#endif /* KERNEL */
48#endif
diff --git a/include/linux/sound.h b/include/linux/sound.h
index 44dcf0570432..fae20ba01fbf 100644
--- a/include/linux/sound.h
+++ b/include/linux/sound.h
@@ -1,3 +1,5 @@
1#ifndef _LINUX_SOUND_H
2#define _LINUX_SOUND_H
1 3
2/* 4/*
3 * Minor numbers for the sound driver. 5 * Minor numbers for the sound driver.
@@ -42,3 +44,5 @@ extern void unregister_sound_mixer(int unit);
42extern void unregister_sound_midi(int unit); 44extern void unregister_sound_midi(int unit);
43extern void unregister_sound_dsp(int unit); 45extern void unregister_sound_dsp(int unit);
44#endif /* __KERNEL__ */ 46#endif /* __KERNEL__ */
47
48#endif /* _LINUX_SOUND_H */
diff --git a/include/linux/soundcard.h b/include/linux/soundcard.h
index fe204fe39f7c..dfcf86f013a9 100644
--- a/include/linux/soundcard.h
+++ b/include/linux/soundcard.h
@@ -198,7 +198,8 @@ typedef struct seq_event_rec {
198# else 198# else
199# error "could not determine byte order" 199# error "could not determine byte order"
200# endif 200# endif
201#elif defined(__BYTE_ORDER) 201#else
202# if defined(__BYTE_ORDER)
202# if __BYTE_ORDER == __BIG_ENDIAN 203# if __BYTE_ORDER == __BIG_ENDIAN
203# define AFMT_S16_NE AFMT_S16_BE 204# define AFMT_S16_NE AFMT_S16_BE
204# elif __BYTE_ORDER == __LITTLE_ENDIAN 205# elif __BYTE_ORDER == __LITTLE_ENDIAN
@@ -206,6 +207,7 @@ typedef struct seq_event_rec {
206# else 207# else
207# error "could not determine byte order" 208# error "could not determine byte order"
208# endif 209# endif
210# endif
209#endif 211#endif
210 212
211/* 213/*
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index bb4f5fbbbd8e..176fce9cc6b1 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -200,6 +200,17 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
200 driver_unregister(&sdrv->driver); 200 driver_unregister(&sdrv->driver);
201} 201}
202 202
203/**
204 * module_spi_driver() - Helper macro for registering a SPI driver
205 * @__spi_driver: spi_driver struct
206 *
207 * Helper macro for SPI drivers which do not do anything special in module
208 * init/exit. This eliminates a lot of boilerplate. Each module may only
209 * use this macro once, and calling it replaces module_init() and module_exit()
210 */
211#define module_spi_driver(__spi_driver) \
212 module_driver(__spi_driver, spi_register_driver, \
213 spi_unregister_driver)
203 214
204/** 215/**
205 * struct spi_master - interface to SPI master controller 216 * struct spi_master - interface to SPI master controller
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 58971e891f48..e1b005918bbb 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -28,6 +28,7 @@
28#define _LINUX_SRCU_H 28#define _LINUX_SRCU_H
29 29
30#include <linux/mutex.h> 30#include <linux/mutex.h>
31#include <linux/rcupdate.h>
31 32
32struct srcu_struct_array { 33struct srcu_struct_array {
33 int c[2]; 34 int c[2];
@@ -60,18 +61,10 @@ int __init_srcu_struct(struct srcu_struct *sp, const char *name,
60 __init_srcu_struct((sp), #sp, &__srcu_key); \ 61 __init_srcu_struct((sp), #sp, &__srcu_key); \
61}) 62})
62 63
63# define srcu_read_acquire(sp) \
64 lock_acquire(&(sp)->dep_map, 0, 0, 2, 1, NULL, _THIS_IP_)
65# define srcu_read_release(sp) \
66 lock_release(&(sp)->dep_map, 1, _THIS_IP_)
67
68#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 64#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
69 65
70int init_srcu_struct(struct srcu_struct *sp); 66int init_srcu_struct(struct srcu_struct *sp);
71 67
72# define srcu_read_acquire(sp) do { } while (0)
73# define srcu_read_release(sp) do { } while (0)
74
75#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 68#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
76 69
77void cleanup_srcu_struct(struct srcu_struct *sp); 70void cleanup_srcu_struct(struct srcu_struct *sp);
@@ -90,12 +83,32 @@ long srcu_batches_completed(struct srcu_struct *sp);
90 * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC, 83 * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC,
91 * this assumes we are in an SRCU read-side critical section unless it can 84 * this assumes we are in an SRCU read-side critical section unless it can
92 * prove otherwise. 85 * prove otherwise.
86 *
87 * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot
88 * and while lockdep is disabled.
89 *
90 * Note that if the CPU is in the idle loop from an RCU point of view
91 * (ie: that we are in the section between rcu_idle_enter() and
92 * rcu_idle_exit()) then srcu_read_lock_held() returns false even if
93 * the CPU did an srcu_read_lock(). The reason for this is that RCU
94 * ignores CPUs that are in such a section, considering these as in
95 * extended quiescent state, so such a CPU is effectively never in an
96 * RCU read-side critical section regardless of what RCU primitives it
97 * invokes. This state of affairs is required --- we need to keep an
98 * RCU-free window in idle where the CPU may possibly enter into low
99 * power mode. This way we can notice an extended quiescent state to
100 * other CPUs that started a grace period. Otherwise we would delay any
101 * grace period as long as we run in the idle task.
93 */ 102 */
94static inline int srcu_read_lock_held(struct srcu_struct *sp) 103static inline int srcu_read_lock_held(struct srcu_struct *sp)
95{ 104{
96 if (debug_locks) 105 if (rcu_is_cpu_idle())
97 return lock_is_held(&sp->dep_map); 106 return 0;
98 return 1; 107
108 if (!debug_lockdep_rcu_enabled())
109 return 1;
110
111 return lock_is_held(&sp->dep_map);
99} 112}
100 113
101#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 114#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
@@ -145,12 +158,17 @@ static inline int srcu_read_lock_held(struct srcu_struct *sp)
145 * one way to indirectly wait on an SRCU grace period is to acquire 158 * one way to indirectly wait on an SRCU grace period is to acquire
146 * a mutex that is held elsewhere while calling synchronize_srcu() or 159 * a mutex that is held elsewhere while calling synchronize_srcu() or
147 * synchronize_srcu_expedited(). 160 * synchronize_srcu_expedited().
161 *
162 * Note that srcu_read_lock() and the matching srcu_read_unlock() must
163 * occur in the same context, for example, it is illegal to invoke
164 * srcu_read_unlock() in an irq handler if the matching srcu_read_lock()
165 * was invoked in process context.
148 */ 166 */
149static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) 167static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
150{ 168{
151 int retval = __srcu_read_lock(sp); 169 int retval = __srcu_read_lock(sp);
152 170
153 srcu_read_acquire(sp); 171 rcu_lock_acquire(&(sp)->dep_map);
154 return retval; 172 return retval;
155} 173}
156 174
@@ -164,8 +182,51 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
164static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) 182static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)
165 __releases(sp) 183 __releases(sp)
166{ 184{
167 srcu_read_release(sp); 185 rcu_lock_release(&(sp)->dep_map);
186 __srcu_read_unlock(sp, idx);
187}
188
189/**
190 * srcu_read_lock_raw - register a new reader for an SRCU-protected structure.
191 * @sp: srcu_struct in which to register the new reader.
192 *
193 * Enter an SRCU read-side critical section. Similar to srcu_read_lock(),
194 * but avoids the RCU-lockdep checking. This means that it is legal to
195 * use srcu_read_lock_raw() in one context, for example, in an exception
196 * handler, and then have the matching srcu_read_unlock_raw() in another
197 * context, for example in the task that took the exception.
198 *
199 * However, the entire SRCU read-side critical section must reside within a
200 * single task. For example, beware of using srcu_read_lock_raw() in
201 * a device interrupt handler and srcu_read_unlock() in the interrupted
202 * task: This will not work if interrupts are threaded.
203 */
204static inline int srcu_read_lock_raw(struct srcu_struct *sp)
205{
206 unsigned long flags;
207 int ret;
208
209 local_irq_save(flags);
210 ret = __srcu_read_lock(sp);
211 local_irq_restore(flags);
212 return ret;
213}
214
215/**
216 * srcu_read_unlock_raw - unregister reader from an SRCU-protected structure.
217 * @sp: srcu_struct in which to unregister the old reader.
218 * @idx: return value from corresponding srcu_read_lock_raw().
219 *
220 * Exit an SRCU read-side critical section without lockdep-RCU checking.
221 * See srcu_read_lock_raw() for more details.
222 */
223static inline void srcu_read_unlock_raw(struct srcu_struct *sp, int idx)
224{
225 unsigned long flags;
226
227 local_irq_save(flags);
168 __srcu_read_unlock(sp, idx); 228 __srcu_read_unlock(sp, idx);
229 local_irq_restore(flags);
169} 230}
170 231
171#endif 232#endif
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 061e560251b4..dcf35b0f303a 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -94,6 +94,15 @@ struct ssb_sprom {
94 } ghz5; /* 5GHz band */ 94 } ghz5; /* 5GHz band */
95 } antenna_gain; 95 } antenna_gain;
96 96
97 struct {
98 struct {
99 u8 tssipos, extpa_gain, pdet_range, tr_iso, antswlut;
100 } ghz2;
101 struct {
102 u8 tssipos, extpa_gain, pdet_range, tr_iso, antswlut;
103 } ghz5;
104 } fem;
105
97 /* TODO - add any parameters needed from rev 2, 3, 4, 5 or 8 SPROMs */ 106 /* TODO - add any parameters needed from rev 2, 3, 4, 5 or 8 SPROMs */
98}; 107};
99 108
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 98941203a27f..c814ae6eeb22 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -432,6 +432,23 @@
432#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */ 432#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */
433#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */ 433#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */
434#define SSB_SPROM8_RXPO5G_SHIFT 8 434#define SSB_SPROM8_RXPO5G_SHIFT 8
435#define SSB_SPROM8_FEM2G 0x00AE
436#define SSB_SPROM8_FEM5G 0x00B0
437#define SSB_SROM8_FEM_TSSIPOS 0x0001
438#define SSB_SROM8_FEM_TSSIPOS_SHIFT 0
439#define SSB_SROM8_FEM_EXTPA_GAIN 0x0006
440#define SSB_SROM8_FEM_EXTPA_GAIN_SHIFT 1
441#define SSB_SROM8_FEM_PDET_RANGE 0x00F8
442#define SSB_SROM8_FEM_PDET_RANGE_SHIFT 3
443#define SSB_SROM8_FEM_TR_ISO 0x0700
444#define SSB_SROM8_FEM_TR_ISO_SHIFT 8
445#define SSB_SROM8_FEM_ANTSWLUT 0xF800
446#define SSB_SROM8_FEM_ANTSWLUT_SHIFT 11
447#define SSB_SPROM8_THERMAL 0x00B2
448#define SSB_SPROM8_MPWR_RAWTS 0x00B4
449#define SSB_SPROM8_TS_SLP_OPT_CORRX 0x00B6
450#define SSB_SPROM8_FOC_HWIQ_IQSWP 0x00B8
451#define SSB_SPROM8_PHYCAL_TEMPDELTA 0x00BA
435#define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */ 452#define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */
436#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */ 453#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */
437#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ 454#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index febc4dbec2ca..7874a8a56638 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -26,6 +26,7 @@ struct auth_cred {
26 uid_t uid; 26 uid_t uid;
27 gid_t gid; 27 gid_t gid;
28 struct group_info *group_info; 28 struct group_info *group_info;
29 const char *principal;
29 unsigned char machine_cred : 1; 30 unsigned char machine_cred : 1;
30}; 31};
31 32
@@ -127,7 +128,7 @@ void rpc_destroy_generic_auth(void);
127void rpc_destroy_authunix(void); 128void rpc_destroy_authunix(void);
128 129
129struct rpc_cred * rpc_lookup_cred(void); 130struct rpc_cred * rpc_lookup_cred(void);
130struct rpc_cred * rpc_lookup_machine_cred(void); 131struct rpc_cred * rpc_lookup_machine_cred(const char *service_name);
131int rpcauth_register(const struct rpc_authops *); 132int rpcauth_register(const struct rpc_authops *);
132int rpcauth_unregister(const struct rpc_authops *); 133int rpcauth_unregister(const struct rpc_authops *);
133struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *); 134struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *);
diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h
index 8eee9dbbfe7a..f1cfd4c85cd0 100644
--- a/include/linux/sunrpc/auth_gss.h
+++ b/include/linux/sunrpc/auth_gss.h
@@ -82,8 +82,8 @@ struct gss_cred {
82 enum rpc_gss_svc gc_service; 82 enum rpc_gss_svc gc_service;
83 struct gss_cl_ctx __rcu *gc_ctx; 83 struct gss_cl_ctx __rcu *gc_ctx;
84 struct gss_upcall_msg *gc_upcall; 84 struct gss_upcall_msg *gc_upcall;
85 const char *gc_principal;
85 unsigned long gc_upcall_timestamp; 86 unsigned long gc_upcall_timestamp;
86 unsigned char gc_machine_cred : 1;
87}; 87};
88 88
89#endif /* __KERNEL__ */ 89#endif /* __KERNEL__ */
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 5efd8cef389e..57531f8e5956 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -203,7 +203,7 @@ extern void cache_unregister(struct cache_detail *cd);
203extern void cache_unregister_net(struct cache_detail *cd, struct net *net); 203extern void cache_unregister_net(struct cache_detail *cd, struct net *net);
204 204
205extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *, 205extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *,
206 mode_t, struct cache_detail *); 206 umode_t, struct cache_detail *);
207extern void sunrpc_cache_unregister_pipefs(struct cache_detail *); 207extern void sunrpc_cache_unregister_pipefs(struct cache_detail *);
208 208
209extern void qword_add(char **bpp, int *lp, char *str); 209extern void qword_add(char **bpp, int *lp, char *str);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 3d8f9c44e27d..2c5993a17c33 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -215,7 +215,7 @@ static inline bool __rpc_copy_addr4(struct sockaddr *dst,
215 return true; 215 return true;
216} 216}
217 217
218#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 218#if IS_ENABLED(CONFIG_IPV6)
219static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1, 219static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
220 const struct sockaddr *sap2) 220 const struct sockaddr *sap2)
221{ 221{
@@ -237,10 +237,10 @@ static inline bool __rpc_copy_addr6(struct sockaddr *dst,
237 struct sockaddr_in6 *dsin6 = (struct sockaddr_in6 *) dst; 237 struct sockaddr_in6 *dsin6 = (struct sockaddr_in6 *) dst;
238 238
239 dsin6->sin6_family = ssin6->sin6_family; 239 dsin6->sin6_family = ssin6->sin6_family;
240 ipv6_addr_copy(&dsin6->sin6_addr, &ssin6->sin6_addr); 240 dsin6->sin6_addr = ssin6->sin6_addr;
241 return true; 241 return true;
242} 242}
243#else /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */ 243#else /* !(IS_ENABLED(CONFIG_IPV6) */
244static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1, 244static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
245 const struct sockaddr *sap2) 245 const struct sockaddr *sap2)
246{ 246{
@@ -252,7 +252,7 @@ static inline bool __rpc_copy_addr6(struct sockaddr *dst,
252{ 252{
253 return false; 253 return false;
254} 254}
255#endif /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */ 255#endif /* !(IS_ENABLED(CONFIG_IPV6) */
256 256
257/** 257/**
258 * rpc_cmp_addr - compare the address portion of two sockaddrs. 258 * rpc_cmp_addr - compare the address portion of two sockaddrs.
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index e4ea43058d8f..2bb03d77375a 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -55,7 +55,7 @@ extern int rpc_remove_client_dir(struct dentry *);
55struct cache_detail; 55struct cache_detail;
56extern struct dentry *rpc_create_cache_dir(struct dentry *, 56extern struct dentry *rpc_create_cache_dir(struct dentry *,
57 struct qstr *, 57 struct qstr *,
58 mode_t umode, 58 umode_t umode,
59 struct cache_detail *); 59 struct cache_detail *);
60extern void rpc_remove_cache_dir(struct dentry *); 60extern void rpc_remove_cache_dir(struct dentry *);
61 61
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 8620f79658d4..dfa900948af7 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -109,7 +109,7 @@ static inline int register_xpt_user(struct svc_xprt *xpt, struct svc_xpt_user *u
109 109
110int svc_reg_xprt_class(struct svc_xprt_class *); 110int svc_reg_xprt_class(struct svc_xprt_class *);
111void svc_unreg_xprt_class(struct svc_xprt_class *); 111void svc_unreg_xprt_class(struct svc_xprt_class *);
112void svc_xprt_init(struct svc_xprt_class *, struct svc_xprt *, 112void svc_xprt_init(struct net *, struct svc_xprt_class *, struct svc_xprt *,
113 struct svc_serv *); 113 struct svc_serv *);
114int svc_create_xprt(struct svc_serv *, const char *, struct net *, 114int svc_create_xprt(struct svc_serv *, const char *, struct net *,
115 const int, const unsigned short, int); 115 const int, const unsigned short, int);
@@ -118,7 +118,6 @@ void svc_xprt_received(struct svc_xprt *);
118void svc_xprt_put(struct svc_xprt *xprt); 118void svc_xprt_put(struct svc_xprt *xprt);
119void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt); 119void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt);
120void svc_close_xprt(struct svc_xprt *xprt); 120void svc_close_xprt(struct svc_xprt *xprt);
121void svc_delete_xprt(struct svc_xprt *xprt);
122int svc_port_is_privileged(struct sockaddr *sin); 121int svc_port_is_privileged(struct sockaddr *sin);
123int svc_print_xprts(char *buf, int maxlen); 122int svc_print_xprts(char *buf, int maxlen);
124struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name, 123struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name,
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 85c50b40759d..c84e9741cb2a 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -34,7 +34,7 @@ struct svc_sock {
34/* 34/*
35 * Function prototypes. 35 * Function prototypes.
36 */ 36 */
37void svc_close_all(struct list_head *); 37void svc_close_all(struct svc_serv *);
38int svc_recv(struct svc_rqst *, long); 38int svc_recv(struct svc_rqst *, long);
39int svc_send(struct svc_rqst *); 39int svc_send(struct svc_rqst *);
40void svc_drop(struct svc_rqst *); 40void svc_drop(struct svc_rqst *);
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index a20970ef9e4e..af70af333546 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -191,6 +191,8 @@ extern int xdr_decode_array2(struct xdr_buf *buf, unsigned int base,
191 struct xdr_array2_desc *desc); 191 struct xdr_array2_desc *desc);
192extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base, 192extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base,
193 struct xdr_array2_desc *desc); 193 struct xdr_array2_desc *desc);
194extern void _copy_from_pages(char *p, struct page **pages, size_t pgbase,
195 size_t len);
194 196
195/* 197/*
196 * Provide some simple tools for XDR buffer overflow-checking etc. 198 * Provide some simple tools for XDR buffer overflow-checking etc.
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 57a692432f8a..91784a4f8608 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -6,6 +6,7 @@
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/pm.h> 7#include <linux/pm.h>
8#include <linux/mm.h> 8#include <linux/mm.h>
9#include <linux/freezer.h>
9#include <asm/errno.h> 10#include <asm/errno.h>
10 11
11#ifdef CONFIG_VT 12#ifdef CONFIG_VT
@@ -331,6 +332,8 @@ static inline bool system_entering_hibernation(void) { return false; }
331#define PM_RESTORE_PREPARE 0x0005 /* Going to restore a saved image */ 332#define PM_RESTORE_PREPARE 0x0005 /* Going to restore a saved image */
332#define PM_POST_RESTORE 0x0006 /* Restore failed */ 333#define PM_POST_RESTORE 0x0006 /* Restore failed */
333 334
335extern struct mutex pm_mutex;
336
334#ifdef CONFIG_PM_SLEEP 337#ifdef CONFIG_PM_SLEEP
335void save_processor_state(void); 338void save_processor_state(void);
336void restore_processor_state(void); 339void restore_processor_state(void);
@@ -351,6 +354,34 @@ extern bool events_check_enabled;
351extern bool pm_wakeup_pending(void); 354extern bool pm_wakeup_pending(void);
352extern bool pm_get_wakeup_count(unsigned int *count); 355extern bool pm_get_wakeup_count(unsigned int *count);
353extern bool pm_save_wakeup_count(unsigned int count); 356extern bool pm_save_wakeup_count(unsigned int count);
357
358static inline void lock_system_sleep(void)
359{
360 current->flags |= PF_FREEZER_SKIP;
361 mutex_lock(&pm_mutex);
362}
363
364static inline void unlock_system_sleep(void)
365{
366 /*
367 * Don't use freezer_count() because we don't want the call to
368 * try_to_freeze() here.
369 *
370 * Reason:
371 * Fundamentally, we just don't need it, because freezing condition
372 * doesn't come into effect until we release the pm_mutex lock,
373 * since the freezer always works with pm_mutex held.
374 *
375 * More importantly, in the case of hibernation,
376 * unlock_system_sleep() gets called in snapshot_read() and
377 * snapshot_write() when the freezing condition is still in effect.
378 * Which means, if we use try_to_freeze() here, it would make them
379 * enter the refrigerator, thus causing hibernation to lockup.
380 */
381 current->flags &= ~PF_FREEZER_SKIP;
382 mutex_unlock(&pm_mutex);
383}
384
354#else /* !CONFIG_PM_SLEEP */ 385#else /* !CONFIG_PM_SLEEP */
355 386
356static inline int register_pm_notifier(struct notifier_block *nb) 387static inline int register_pm_notifier(struct notifier_block *nb)
@@ -366,28 +397,11 @@ static inline int unregister_pm_notifier(struct notifier_block *nb)
366#define pm_notifier(fn, pri) do { (void)(fn); } while (0) 397#define pm_notifier(fn, pri) do { (void)(fn); } while (0)
367 398
368static inline bool pm_wakeup_pending(void) { return false; } 399static inline bool pm_wakeup_pending(void) { return false; }
369#endif /* !CONFIG_PM_SLEEP */
370
371extern struct mutex pm_mutex;
372 400
373#ifndef CONFIG_HIBERNATE_CALLBACKS
374static inline void lock_system_sleep(void) {} 401static inline void lock_system_sleep(void) {}
375static inline void unlock_system_sleep(void) {} 402static inline void unlock_system_sleep(void) {}
376 403
377#else 404#endif /* !CONFIG_PM_SLEEP */
378
379/* Let some subsystems like memory hotadd exclude hibernation */
380
381static inline void lock_system_sleep(void)
382{
383 mutex_lock(&pm_mutex);
384}
385
386static inline void unlock_system_sleep(void)
387{
388 mutex_unlock(&pm_mutex);
389}
390#endif
391 405
392#ifdef CONFIG_ARCH_SAVE_PAGE_KEYS 406#ifdef CONFIG_ARCH_SAVE_PAGE_KEYS
393/* 407/*
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 1e22e126d2ac..3e60228e7299 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -207,6 +207,7 @@ struct swap_list_t {
207/* linux/mm/page_alloc.c */ 207/* linux/mm/page_alloc.c */
208extern unsigned long totalram_pages; 208extern unsigned long totalram_pages;
209extern unsigned long totalreserve_pages; 209extern unsigned long totalreserve_pages;
210extern unsigned long dirty_balance_reserve;
210extern unsigned int nr_free_buffer_pages(void); 211extern unsigned int nr_free_buffer_pages(void);
211extern unsigned int nr_free_pagecache_pages(void); 212extern unsigned int nr_free_pagecache_pages(void);
212 213
@@ -272,7 +273,7 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
272#endif 273#endif
273 274
274extern int page_evictable(struct page *page, struct vm_area_struct *vma); 275extern int page_evictable(struct page *page, struct vm_area_struct *vma);
275extern void scan_mapping_unevictable_pages(struct address_space *); 276extern void check_move_unevictable_pages(struct page **, int nr_pages);
276 277
277extern unsigned long scan_unevictable_pages; 278extern unsigned long scan_unevictable_pages;
278extern int scan_unevictable_handler(struct ctl_table *, int, 279extern int scan_unevictable_handler(struct ctl_table *, int,
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index 445702c60d04..e872526fdc5f 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -24,7 +24,7 @@ extern int swiotlb_force;
24 24
25extern void swiotlb_init(int verbose); 25extern void swiotlb_init(int verbose);
26extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose); 26extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose);
27extern unsigned long swioltb_nr_tbl(void); 27extern unsigned long swiotlb_nr_tbl(void);
28 28
29/* 29/*
30 * Enumeration for sync targets 30 * Enumeration for sync targets
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 86a24b1166d1..8ec1153ff57b 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -475,7 +475,7 @@ asmlinkage long sys_mincore(unsigned long start, size_t len,
475asmlinkage long sys_pivot_root(const char __user *new_root, 475asmlinkage long sys_pivot_root(const char __user *new_root,
476 const char __user *put_old); 476 const char __user *put_old);
477asmlinkage long sys_chroot(const char __user *filename); 477asmlinkage long sys_chroot(const char __user *filename);
478asmlinkage long sys_mknod(const char __user *filename, int mode, 478asmlinkage long sys_mknod(const char __user *filename, umode_t mode,
479 unsigned dev); 479 unsigned dev);
480asmlinkage long sys_link(const char __user *oldname, 480asmlinkage long sys_link(const char __user *oldname,
481 const char __user *newname); 481 const char __user *newname);
@@ -483,8 +483,8 @@ asmlinkage long sys_symlink(const char __user *old, const char __user *new);
483asmlinkage long sys_unlink(const char __user *pathname); 483asmlinkage long sys_unlink(const char __user *pathname);
484asmlinkage long sys_rename(const char __user *oldname, 484asmlinkage long sys_rename(const char __user *oldname,
485 const char __user *newname); 485 const char __user *newname);
486asmlinkage long sys_chmod(const char __user *filename, mode_t mode); 486asmlinkage long sys_chmod(const char __user *filename, umode_t mode);
487asmlinkage long sys_fchmod(unsigned int fd, mode_t mode); 487asmlinkage long sys_fchmod(unsigned int fd, umode_t mode);
488 488
489asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg); 489asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg);
490#if BITS_PER_LONG == 32 490#if BITS_PER_LONG == 32
@@ -517,9 +517,9 @@ asmlinkage long sys_sendfile64(int out_fd, int in_fd,
517 loff_t __user *offset, size_t count); 517 loff_t __user *offset, size_t count);
518asmlinkage long sys_readlink(const char __user *path, 518asmlinkage long sys_readlink(const char __user *path,
519 char __user *buf, int bufsiz); 519 char __user *buf, int bufsiz);
520asmlinkage long sys_creat(const char __user *pathname, int mode); 520asmlinkage long sys_creat(const char __user *pathname, umode_t mode);
521asmlinkage long sys_open(const char __user *filename, 521asmlinkage long sys_open(const char __user *filename,
522 int flags, int mode); 522 int flags, umode_t mode);
523asmlinkage long sys_close(unsigned int fd); 523asmlinkage long sys_close(unsigned int fd);
524asmlinkage long sys_access(const char __user *filename, int mode); 524asmlinkage long sys_access(const char __user *filename, int mode);
525asmlinkage long sys_vhangup(void); 525asmlinkage long sys_vhangup(void);
@@ -582,7 +582,7 @@ asmlinkage long sys_preadv(unsigned long fd, const struct iovec __user *vec,
582asmlinkage long sys_pwritev(unsigned long fd, const struct iovec __user *vec, 582asmlinkage long sys_pwritev(unsigned long fd, const struct iovec __user *vec,
583 unsigned long vlen, unsigned long pos_l, unsigned long pos_h); 583 unsigned long vlen, unsigned long pos_l, unsigned long pos_h);
584asmlinkage long sys_getcwd(char __user *buf, unsigned long size); 584asmlinkage long sys_getcwd(char __user *buf, unsigned long size);
585asmlinkage long sys_mkdir(const char __user *pathname, int mode); 585asmlinkage long sys_mkdir(const char __user *pathname, umode_t mode);
586asmlinkage long sys_chdir(const char __user *filename); 586asmlinkage long sys_chdir(const char __user *filename);
587asmlinkage long sys_fchdir(unsigned int fd); 587asmlinkage long sys_fchdir(unsigned int fd);
588asmlinkage long sys_rmdir(const char __user *pathname); 588asmlinkage long sys_rmdir(const char __user *pathname);
@@ -624,7 +624,7 @@ asmlinkage long sys_socketpair(int, int, int, int __user *);
624asmlinkage long sys_socketcall(int call, unsigned long __user *args); 624asmlinkage long sys_socketcall(int call, unsigned long __user *args);
625asmlinkage long sys_listen(int, int); 625asmlinkage long sys_listen(int, int);
626asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds, 626asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
627 long timeout); 627 int timeout);
628asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp, 628asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
629 fd_set __user *exp, struct timeval __user *tvp); 629 fd_set __user *exp, struct timeval __user *tvp);
630asmlinkage long sys_old_select(struct sel_arg_struct __user *arg); 630asmlinkage long sys_old_select(struct sel_arg_struct __user *arg);
@@ -679,7 +679,7 @@ asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
679asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second, 679asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second,
680 unsigned long third, void __user *ptr, long fifth); 680 unsigned long third, void __user *ptr, long fifth);
681 681
682asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr); 682asmlinkage long sys_mq_open(const char __user *name, int oflag, umode_t mode, struct mq_attr __user *attr);
683asmlinkage long sys_mq_unlink(const char __user *name); 683asmlinkage long sys_mq_unlink(const char __user *name);
684asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout); 684asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout);
685asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout); 685asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout);
@@ -753,11 +753,11 @@ asmlinkage long sys_inotify_rm_watch(int fd, __s32 wd);
753asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, 753asmlinkage long sys_spu_run(int fd, __u32 __user *unpc,
754 __u32 __user *ustatus); 754 __u32 __user *ustatus);
755asmlinkage long sys_spu_create(const char __user *name, 755asmlinkage long sys_spu_create(const char __user *name,
756 unsigned int flags, mode_t mode, int fd); 756 unsigned int flags, umode_t mode, int fd);
757 757
758asmlinkage long sys_mknodat(int dfd, const char __user * filename, int mode, 758asmlinkage long sys_mknodat(int dfd, const char __user * filename, umode_t mode,
759 unsigned dev); 759 unsigned dev);
760asmlinkage long sys_mkdirat(int dfd, const char __user * pathname, int mode); 760asmlinkage long sys_mkdirat(int dfd, const char __user * pathname, umode_t mode);
761asmlinkage long sys_unlinkat(int dfd, const char __user * pathname, int flag); 761asmlinkage long sys_unlinkat(int dfd, const char __user * pathname, int flag);
762asmlinkage long sys_symlinkat(const char __user * oldname, 762asmlinkage long sys_symlinkat(const char __user * oldname,
763 int newdfd, const char __user * newname); 763 int newdfd, const char __user * newname);
@@ -769,11 +769,11 @@ asmlinkage long sys_futimesat(int dfd, const char __user *filename,
769 struct timeval __user *utimes); 769 struct timeval __user *utimes);
770asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode); 770asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode);
771asmlinkage long sys_fchmodat(int dfd, const char __user * filename, 771asmlinkage long sys_fchmodat(int dfd, const char __user * filename,
772 mode_t mode); 772 umode_t mode);
773asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user, 773asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user,
774 gid_t group, int flag); 774 gid_t group, int flag);
775asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, 775asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
776 int mode); 776 umode_t mode);
777asmlinkage long sys_newfstatat(int dfd, const char __user *filename, 777asmlinkage long sys_newfstatat(int dfd, const char __user *filename,
778 struct stat __user *statbuf, int flag); 778 struct stat __user *statbuf, int flag);
779asmlinkage long sys_fstatat64(int dfd, const char __user *filename, 779asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 703cfa33a3ca..bb9127dd814b 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -1038,7 +1038,7 @@ struct ctl_table
1038 const char *procname; /* Text ID for /proc/sys, or zero */ 1038 const char *procname; /* Text ID for /proc/sys, or zero */
1039 void *data; 1039 void *data;
1040 int maxlen; 1040 int maxlen;
1041 mode_t mode; 1041 umode_t mode;
1042 struct ctl_table *child; 1042 struct ctl_table *child;
1043 struct ctl_table *parent; /* Automatically set */ 1043 struct ctl_table *parent; /* Automatically set */
1044 proc_handler *proc_handler; /* Callback for text formatting */ 1044 proc_handler *proc_handler; /* Callback for text formatting */
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
deleted file mode 100644
index 20f63d3e6144..000000000000
--- a/include/linux/sysdev.h
+++ /dev/null
@@ -1,164 +0,0 @@
1/**
2 * System devices follow a slightly different driver model.
3 * They don't need to do dynammic driver binding, can't be probed,
4 * and don't reside on any type of peripheral bus.
5 * So, we represent and treat them a little differently.
6 *
7 * We still have a notion of a driver for a system device, because we still
8 * want to perform basic operations on these devices.
9 *
10 * We also support auxiliary drivers binding to devices of a certain class.
11 *
12 * This allows configurable drivers to register themselves for devices of
13 * a certain type. And, it allows class definitions to reside in generic
14 * code while arch-specific code can register specific drivers.
15 *
16 * Auxiliary drivers registered with a NULL cls are registered as drivers
17 * for all system devices, and get notification calls for each device.
18 */
19
20
21#ifndef _SYSDEV_H_
22#define _SYSDEV_H_
23
24#include <linux/kobject.h>
25#include <linux/pm.h>
26
27
28struct sys_device;
29struct sysdev_class_attribute;
30
31struct sysdev_class {
32 const char *name;
33 struct list_head drivers;
34 struct sysdev_class_attribute **attrs;
35 struct kset kset;
36};
37
38struct sysdev_class_attribute {
39 struct attribute attr;
40 ssize_t (*show)(struct sysdev_class *, struct sysdev_class_attribute *,
41 char *);
42 ssize_t (*store)(struct sysdev_class *, struct sysdev_class_attribute *,
43 const char *, size_t);
44};
45
46#define _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \
47{ \
48 .attr = {.name = __stringify(_name), .mode = _mode }, \
49 .show = _show, \
50 .store = _store, \
51}
52
53#define SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \
54 struct sysdev_class_attribute attr_##_name = \
55 _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store)
56
57
58extern int sysdev_class_register(struct sysdev_class *);
59extern void sysdev_class_unregister(struct sysdev_class *);
60
61extern int sysdev_class_create_file(struct sysdev_class *,
62 struct sysdev_class_attribute *);
63extern void sysdev_class_remove_file(struct sysdev_class *,
64 struct sysdev_class_attribute *);
65/**
66 * Auxiliary system device drivers.
67 */
68
69struct sysdev_driver {
70 struct list_head entry;
71 int (*add)(struct sys_device *);
72 int (*remove)(struct sys_device *);
73};
74
75
76extern int sysdev_driver_register(struct sysdev_class *, struct sysdev_driver *);
77extern void sysdev_driver_unregister(struct sysdev_class *, struct sysdev_driver *);
78
79
80/**
81 * sys_devices can be simplified a lot from regular devices, because they're
82 * simply not as versatile.
83 */
84
85struct sys_device {
86 u32 id;
87 struct sysdev_class * cls;
88 struct kobject kobj;
89};
90
91extern int sysdev_register(struct sys_device *);
92extern void sysdev_unregister(struct sys_device *);
93
94
95struct sysdev_attribute {
96 struct attribute attr;
97 ssize_t (*show)(struct sys_device *, struct sysdev_attribute *, char *);
98 ssize_t (*store)(struct sys_device *, struct sysdev_attribute *,
99 const char *, size_t);
100};
101
102
103#define _SYSDEV_ATTR(_name, _mode, _show, _store) \
104{ \
105 .attr = { .name = __stringify(_name), .mode = _mode }, \
106 .show = _show, \
107 .store = _store, \
108}
109
110#define SYSDEV_ATTR(_name, _mode, _show, _store) \
111 struct sysdev_attribute attr_##_name = \
112 _SYSDEV_ATTR(_name, _mode, _show, _store);
113
114extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *);
115extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *);
116
117/* Create/remove NULL terminated attribute list */
118static inline int
119sysdev_create_files(struct sys_device *d, struct sysdev_attribute **a)
120{
121 return sysfs_create_files(&d->kobj, (const struct attribute **)a);
122}
123
124static inline void
125sysdev_remove_files(struct sys_device *d, struct sysdev_attribute **a)
126{
127 return sysfs_remove_files(&d->kobj, (const struct attribute **)a);
128}
129
130struct sysdev_ext_attribute {
131 struct sysdev_attribute attr;
132 void *var;
133};
134
135/*
136 * Support for simple variable sysdev attributes.
137 * The pointer to the variable is stored in a sysdev_ext_attribute
138 */
139
140/* Add more types as needed */
141
142extern ssize_t sysdev_show_ulong(struct sys_device *, struct sysdev_attribute *,
143 char *);
144extern ssize_t sysdev_store_ulong(struct sys_device *,
145 struct sysdev_attribute *, const char *, size_t);
146extern ssize_t sysdev_show_int(struct sys_device *, struct sysdev_attribute *,
147 char *);
148extern ssize_t sysdev_store_int(struct sys_device *,
149 struct sysdev_attribute *, const char *, size_t);
150
151#define _SYSDEV_ULONG_ATTR(_name, _mode, _var) \
152 { _SYSDEV_ATTR(_name, _mode, sysdev_show_ulong, sysdev_store_ulong), \
153 &(_var) }
154#define SYSDEV_ULONG_ATTR(_name, _mode, _var) \
155 struct sysdev_ext_attribute attr_##_name = \
156 _SYSDEV_ULONG_ATTR(_name, _mode, _var);
157#define _SYSDEV_INT_ATTR(_name, _mode, _var) \
158 { _SYSDEV_ATTR(_name, _mode, sysdev_show_int, sysdev_store_int), \
159 &(_var) }
160#define SYSDEV_INT_ATTR(_name, _mode, _var) \
161 struct sysdev_ext_attribute attr_##_name = \
162 _SYSDEV_INT_ATTR(_name, _mode, _var);
163
164#endif /* _SYSDEV_H_ */
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index dac0859e6440..0010009b2f00 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -25,7 +25,7 @@ enum kobj_ns_type;
25 25
26struct attribute { 26struct attribute {
27 const char *name; 27 const char *name;
28 mode_t mode; 28 umode_t mode;
29#ifdef CONFIG_DEBUG_LOCK_ALLOC 29#ifdef CONFIG_DEBUG_LOCK_ALLOC
30 struct lock_class_key *key; 30 struct lock_class_key *key;
31 struct lock_class_key skey; 31 struct lock_class_key skey;
@@ -55,7 +55,7 @@ do { \
55 55
56struct attribute_group { 56struct attribute_group {
57 const char *name; 57 const char *name;
58 mode_t (*is_visible)(struct kobject *, 58 umode_t (*is_visible)(struct kobject *,
59 struct attribute *, int); 59 struct attribute *, int);
60 struct attribute **attrs; 60 struct attribute **attrs;
61}; 61};
@@ -133,7 +133,7 @@ int __must_check sysfs_create_file(struct kobject *kobj,
133int __must_check sysfs_create_files(struct kobject *kobj, 133int __must_check sysfs_create_files(struct kobject *kobj,
134 const struct attribute **attr); 134 const struct attribute **attr);
135int __must_check sysfs_chmod_file(struct kobject *kobj, 135int __must_check sysfs_chmod_file(struct kobject *kobj,
136 const struct attribute *attr, mode_t mode); 136 const struct attribute *attr, umode_t mode);
137void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); 137void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr);
138void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); 138void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);
139 139
@@ -221,7 +221,7 @@ static inline int sysfs_create_files(struct kobject *kobj,
221} 221}
222 222
223static inline int sysfs_chmod_file(struct kobject *kobj, 223static inline int sysfs_chmod_file(struct kobject *kobj,
224 const struct attribute *attr, mode_t mode) 224 const struct attribute *attr, umode_t mode)
225{ 225{
226 return 0; 226 return 0;
227} 227}
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 7f59ee946983..3c7ffdb40dc6 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -238,6 +238,11 @@ struct tcp_sack_block {
238 u32 end_seq; 238 u32 end_seq;
239}; 239};
240 240
241/*These are used to set the sack_ok field in struct tcp_options_received */
242#define TCP_SACK_SEEN (1 << 0) /*1 = peer is SACK capable, */
243#define TCP_FACK_ENABLED (1 << 1) /*1 = FACK is enabled locally*/
244#define TCP_DSACK_SEEN (1 << 2) /*1 = DSACK was received from peer*/
245
241struct tcp_options_received { 246struct tcp_options_received {
242/* PAWS/RTTM data */ 247/* PAWS/RTTM data */
243 long ts_recent_stamp;/* Time we stored ts_recent (for aging) */ 248 long ts_recent_stamp;/* Time we stored ts_recent (for aging) */
@@ -407,7 +412,8 @@ struct tcp_sock {
407 412
408 struct tcp_sack_block recv_sack_cache[4]; 413 struct tcp_sack_block recv_sack_cache[4];
409 414
410 struct sk_buff *highest_sack; /* highest skb with SACK received 415 struct sk_buff *highest_sack; /* skb just after the highest
416 * skb with SACKed bit set
411 * (validity guaranteed only if 417 * (validity guaranteed only if
412 * sacked_out > 0) 418 * sacked_out > 0)
413 */ 419 */
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 47b4a27e6e97..796f1ff0388c 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -152,9 +152,9 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
152void thermal_cooling_device_unregister(struct thermal_cooling_device *); 152void thermal_cooling_device_unregister(struct thermal_cooling_device *);
153 153
154#ifdef CONFIG_NET 154#ifdef CONFIG_NET
155extern int generate_netlink_event(u32 orig, enum events event); 155extern int thermal_generate_netlink_event(u32 orig, enum events event);
156#else 156#else
157static inline int generate_netlink_event(u32 orig, enum events event) 157static inline int thermal_generate_netlink_event(u32 orig, enum events event)
158{ 158{
159 return 0; 159 return 0;
160} 160}
diff --git a/include/linux/tick.h b/include/linux/tick.h
index b232ccc0ee29..ab8be90b5cc9 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -7,6 +7,7 @@
7#define _LINUX_TICK_H 7#define _LINUX_TICK_H
8 8
9#include <linux/clockchips.h> 9#include <linux/clockchips.h>
10#include <linux/irqflags.h>
10 11
11#ifdef CONFIG_GENERIC_CLOCKEVENTS 12#ifdef CONFIG_GENERIC_CLOCKEVENTS
12 13
@@ -121,14 +122,16 @@ static inline int tick_oneshot_mode_active(void) { return 0; }
121#endif /* !CONFIG_GENERIC_CLOCKEVENTS */ 122#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
122 123
123# ifdef CONFIG_NO_HZ 124# ifdef CONFIG_NO_HZ
124extern void tick_nohz_stop_sched_tick(int inidle); 125extern void tick_nohz_idle_enter(void);
125extern void tick_nohz_restart_sched_tick(void); 126extern void tick_nohz_idle_exit(void);
127extern void tick_nohz_irq_exit(void);
126extern ktime_t tick_nohz_get_sleep_length(void); 128extern ktime_t tick_nohz_get_sleep_length(void);
127extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); 129extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
128extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time); 130extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);
129# else 131# else
130static inline void tick_nohz_stop_sched_tick(int inidle) { } 132static inline void tick_nohz_idle_enter(void) { }
131static inline void tick_nohz_restart_sched_tick(void) { } 133static inline void tick_nohz_idle_exit(void) { }
134
132static inline ktime_t tick_nohz_get_sleep_length(void) 135static inline ktime_t tick_nohz_get_sleep_length(void)
133{ 136{
134 ktime_t len = { .tv64 = NSEC_PER_SEC/HZ }; 137 ktime_t len = { .tv64 = NSEC_PER_SEC/HZ };
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index ecdaeb98b293..5cf685086dd3 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -312,7 +312,6 @@ struct tty_driver {
312 */ 312 */
313 struct tty_struct **ttys; 313 struct tty_struct **ttys;
314 struct ktermios **termios; 314 struct ktermios **termios;
315 struct ktermios **termios_locked;
316 void *driver_state; 315 void *driver_state;
317 316
318 /* 317 /*
diff --git a/include/linux/types.h b/include/linux/types.h
index 57a97234bec1..e5fa50345516 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -24,6 +24,7 @@ typedef __kernel_fd_set fd_set;
24typedef __kernel_dev_t dev_t; 24typedef __kernel_dev_t dev_t;
25typedef __kernel_ino_t ino_t; 25typedef __kernel_ino_t ino_t;
26typedef __kernel_mode_t mode_t; 26typedef __kernel_mode_t mode_t;
27typedef unsigned short umode_t;
27typedef __kernel_nlink_t nlink_t; 28typedef __kernel_nlink_t nlink_t;
28typedef __kernel_off_t off_t; 29typedef __kernel_off_t off_t;
29typedef __kernel_pid_t pid_t; 30typedef __kernel_pid_t pid_t;
@@ -188,7 +189,7 @@ typedef __u32 __bitwise __wsum;
188 * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid 189 * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid
189 * common 32/64-bit compat problems. 190 * common 32/64-bit compat problems.
190 * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other 191 * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other
191 * architectures) and to 8-byte boundaries on 64-bit architetures. The new 192 * architectures) and to 8-byte boundaries on 64-bit architectures. The new
192 * aligned_64 type enforces 8-byte alignment so that structs containing 193 * aligned_64 type enforces 8-byte alignment so that structs containing
193 * aligned_64 values have the same alignment on 32-bit and 64-bit architectures. 194 * aligned_64 values have the same alignment on 32-bit and 64-bit architectures.
194 * No conversions are necessary between 32-bit user-space and a 64-bit kernel. 195 * No conversions are necessary between 32-bit user-space and a 64-bit kernel.
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h
index 5c75153f9441..d21b33c4c6ca 100644
--- a/include/linux/ucb1400.h
+++ b/include/linux/ucb1400.h
@@ -96,13 +96,11 @@ struct ucb1400_gpio {
96 96
97struct ucb1400_ts { 97struct ucb1400_ts {
98 struct input_dev *ts_idev; 98 struct input_dev *ts_idev;
99 struct task_struct *ts_task;
100 int id; 99 int id;
101 wait_queue_head_t ts_wait;
102 unsigned int ts_restart:1;
103 int irq; 100 int irq;
104 unsigned int irq_pending; /* not bit field shared */
105 struct snd_ac97 *ac97; 101 struct snd_ac97 *ac97;
102 wait_queue_head_t ts_wait;
103 bool stopped;
106}; 104};
107 105
108struct ucb1400 { 106struct ucb1400 {
diff --git a/include/linux/unix_diag.h b/include/linux/unix_diag.h
new file mode 100644
index 000000000000..b1d2bf16b33c
--- /dev/null
+++ b/include/linux/unix_diag.h
@@ -0,0 +1,54 @@
1#ifndef __UNIX_DIAG_H__
2#define __UNIX_DIAG_H__
3
4#include <linux/types.h>
5
6struct unix_diag_req {
7 __u8 sdiag_family;
8 __u8 sdiag_protocol;
9 __u16 pad;
10 __u32 udiag_states;
11 __u32 udiag_ino;
12 __u32 udiag_show;
13 __u32 udiag_cookie[2];
14};
15
16#define UDIAG_SHOW_NAME 0x00000001 /* show name (not path) */
17#define UDIAG_SHOW_VFS 0x00000002 /* show VFS inode info */
18#define UDIAG_SHOW_PEER 0x00000004 /* show peer socket info */
19#define UDIAG_SHOW_ICONS 0x00000008 /* show pending connections */
20#define UDIAG_SHOW_RQLEN 0x00000010 /* show skb receive queue len */
21#define UDIAG_SHOW_MEMINFO 0x00000020 /* show memory info of a socket */
22
23struct unix_diag_msg {
24 __u8 udiag_family;
25 __u8 udiag_type;
26 __u8 udiag_state;
27 __u8 pad;
28
29 __u32 udiag_ino;
30 __u32 udiag_cookie[2];
31};
32
33enum {
34 UNIX_DIAG_NAME,
35 UNIX_DIAG_VFS,
36 UNIX_DIAG_PEER,
37 UNIX_DIAG_ICONS,
38 UNIX_DIAG_RQLEN,
39 UNIX_DIAG_MEMINFO,
40
41 UNIX_DIAG_MAX,
42};
43
44struct unix_diag_vfs {
45 __u32 udiag_vfs_ino;
46 __u32 udiag_vfs_dev;
47};
48
49struct unix_diag_rqlen {
50 __u32 udiag_rqueue;
51 __u32 udiag_wqueue;
52};
53
54#endif
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d3d0c1374334..69d845739bc2 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -935,7 +935,7 @@ extern struct bus_type usb_bus_type;
935 */ 935 */
936struct usb_class_driver { 936struct usb_class_driver {
937 char *name; 937 char *name;
938 char *(*devnode)(struct device *dev, mode_t *mode); 938 char *(*devnode)(struct device *dev, umode_t *mode);
939 const struct file_operations *fops; 939 const struct file_operations *fops;
940 int minor_base; 940 int minor_base;
941}; 941};
@@ -953,6 +953,18 @@ extern int usb_register_driver(struct usb_driver *, struct module *,
953 953
954extern void usb_deregister(struct usb_driver *); 954extern void usb_deregister(struct usb_driver *);
955 955
956/**
957 * module_usb_driver() - Helper macro for registering a USB driver
958 * @__usb_driver: usb_driver struct
959 *
960 * Helper macro for USB drivers which do not do anything special in module
961 * init/exit. This eliminates a lot of boilerplate. Each module may only
962 * use this macro once, and calling it replaces module_init() and module_exit()
963 */
964#define module_usb_driver(__usb_driver) \
965 module_driver(__usb_driver, usb_register, \
966 usb_deregister)
967
956extern int usb_register_device_driver(struct usb_device_driver *, 968extern int usb_register_device_driver(struct usb_device_driver *,
957 struct module *); 969 struct module *);
958extern void usb_deregister_device_driver(struct usb_device_driver *); 970extern void usb_deregister_device_driver(struct usb_device_driver *);
@@ -1061,6 +1073,7 @@ typedef void (*usb_complete_t)(struct urb *);
1061 * which the host controller driver should use in preference to the 1073 * which the host controller driver should use in preference to the
1062 * transfer_buffer. 1074 * transfer_buffer.
1063 * @sg: scatter gather buffer list 1075 * @sg: scatter gather buffer list
1076 * @num_mapped_sgs: (internal) number of mapped sg entries
1064 * @num_sgs: number of entries in the sg list 1077 * @num_sgs: number of entries in the sg list
1065 * @transfer_buffer_length: How big is transfer_buffer. The transfer may 1078 * @transfer_buffer_length: How big is transfer_buffer. The transfer may
1066 * be broken up into chunks according to the current maximum packet 1079 * be broken up into chunks according to the current maximum packet
@@ -1221,6 +1234,7 @@ struct urb {
1221 void *transfer_buffer; /* (in) associated data buffer */ 1234 void *transfer_buffer; /* (in) associated data buffer */
1222 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ 1235 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */
1223 struct scatterlist *sg; /* (in) scatter gather buffer list */ 1236 struct scatterlist *sg; /* (in) scatter gather buffer list */
1237 int num_mapped_sgs; /* (internal) mapped sg entries */
1224 int num_sgs; /* (in) number of entries in the sg list */ 1238 int num_sgs; /* (in) number of entries in the sg list */
1225 u32 transfer_buffer_length; /* (in) data buffer length */ 1239 u32 transfer_buffer_length; /* (in) data buffer length */
1226 u32 actual_length; /* (return) actual transfer length */ 1240 u32 actual_length; /* (return) actual transfer length */
@@ -1598,6 +1612,19 @@ usb_maxpacket(struct usb_device *udev, int pipe, int is_out)
1598 1612
1599/* ----------------------------------------------------------------------- */ 1613/* ----------------------------------------------------------------------- */
1600 1614
1615/* translate USB error codes to codes user space understands */
1616static inline int usb_translate_errors(int error_code)
1617{
1618 switch (error_code) {
1619 case 0:
1620 case -ENOMEM:
1621 case -ENODEV:
1622 return error_code;
1623 default:
1624 return -EIO;
1625 }
1626}
1627
1601/* Events from the usb core */ 1628/* Events from the usb core */
1602#define USB_DEVICE_ADD 0x0001 1629#define USB_DEVICE_ADD 0x0001
1603#define USB_DEVICE_REMOVE 0x0002 1630#define USB_DEVICE_REMOVE 0x0002
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
index 4ebaf0824179..0b83acd3360a 100644
--- a/include/linux/usb/ch11.h
+++ b/include/linux/usb/ch11.h
@@ -26,7 +26,6 @@
26#define HUB_RESET_TT 9 26#define HUB_RESET_TT 9
27#define HUB_GET_TT_STATE 10 27#define HUB_GET_TT_STATE 10
28#define HUB_STOP_TT 11 28#define HUB_STOP_TT 11
29#define HUB_SET_DEPTH 12
30 29
31/* 30/*
32 * Hub class additional requests defined by USB 3.0 spec 31 * Hub class additional requests defined by USB 3.0 spec
@@ -62,12 +61,6 @@
62#define USB_PORT_FEAT_TEST 21 61#define USB_PORT_FEAT_TEST 21
63#define USB_PORT_FEAT_INDICATOR 22 62#define USB_PORT_FEAT_INDICATOR 22
64#define USB_PORT_FEAT_C_PORT_L1 23 63#define USB_PORT_FEAT_C_PORT_L1 23
65#define USB_PORT_FEAT_C_PORT_LINK_STATE 25
66#define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26
67#define USB_PORT_FEAT_PORT_REMOTE_WAKE_MASK 27
68#define USB_PORT_FEAT_BH_PORT_RESET 28
69#define USB_PORT_FEAT_C_BH_PORT_RESET 29
70#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
71 64
72/* 65/*
73 * Port feature selectors added by USB 3.0 spec. 66 * Port feature selectors added by USB 3.0 spec.
@@ -76,8 +69,8 @@
76#define USB_PORT_FEAT_LINK_STATE 5 69#define USB_PORT_FEAT_LINK_STATE 5
77#define USB_PORT_FEAT_U1_TIMEOUT 23 70#define USB_PORT_FEAT_U1_TIMEOUT 23
78#define USB_PORT_FEAT_U2_TIMEOUT 24 71#define USB_PORT_FEAT_U2_TIMEOUT 24
79#define USB_PORT_FEAT_C_LINK_STATE 25 72#define USB_PORT_FEAT_C_PORT_LINK_STATE 25
80#define USB_PORT_FEAT_C_CONFIG_ERR 26 73#define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26
81#define USB_PORT_FEAT_REMOTE_WAKE_MASK 27 74#define USB_PORT_FEAT_REMOTE_WAKE_MASK 27
82#define USB_PORT_FEAT_BH_PORT_RESET 28 75#define USB_PORT_FEAT_BH_PORT_RESET 28
83#define USB_PORT_FEAT_C_BH_PORT_RESET 29 76#define USB_PORT_FEAT_C_BH_PORT_RESET 29
@@ -165,11 +158,20 @@ struct usb_port_status {
165 * wHubCharacteristics (masks) 158 * wHubCharacteristics (masks)
166 * See USB 2.0 spec Table 11-13, offset 3 159 * See USB 2.0 spec Table 11-13, offset 3
167 */ 160 */
168#define HUB_CHAR_LPSM 0x0003 /* D1 .. D0 */ 161#define HUB_CHAR_LPSM 0x0003 /* Logical Power Switching Mode mask */
169#define HUB_CHAR_COMPOUND 0x0004 /* D2 */ 162#define HUB_CHAR_COMMON_LPSM 0x0000 /* All ports power control at once */
170#define HUB_CHAR_OCPM 0x0018 /* D4 .. D3 */ 163#define HUB_CHAR_INDV_PORT_LPSM 0x0001 /* per-port power control */
171#define HUB_CHAR_TTTT 0x0060 /* D6 .. D5 */ 164#define HUB_CHAR_NO_LPSM 0x0002 /* no power switching */
172#define HUB_CHAR_PORTIND 0x0080 /* D7 */ 165
166#define HUB_CHAR_COMPOUND 0x0004 /* hub is part of a compound device */
167
168#define HUB_CHAR_OCPM 0x0018 /* Over-Current Protection Mode mask */
169#define HUB_CHAR_COMMON_OCPM 0x0000 /* All ports Over-Current reporting */
170#define HUB_CHAR_INDV_PORT_OCPM 0x0008 /* per-port Over-current reporting */
171#define HUB_CHAR_NO_OCPM 0x0010 /* No Over-current Protection support */
172
173#define HUB_CHAR_TTTT 0x0060 /* TT Think Time mask */
174#define HUB_CHAR_PORTIND 0x0080 /* per-port indicators (LEDs) */
173 175
174struct usb_hub_status { 176struct usb_hub_status {
175 __le16 wHubStatus; 177 __le16 wHubStatus;
@@ -198,6 +200,17 @@ struct usb_hub_status {
198#define USB_DT_HUB_NONVAR_SIZE 7 200#define USB_DT_HUB_NONVAR_SIZE 7
199#define USB_DT_SS_HUB_SIZE 12 201#define USB_DT_SS_HUB_SIZE 12
200 202
203/*
204 * Hub Device descriptor
205 * USB Hub class device protocols
206 */
207
208#define USB_HUB_PR_FS 0 /* Full speed hub */
209#define USB_HUB_PR_HS_NO_TT 0 /* Hi-speed hub without TT */
210#define USB_HUB_PR_HS_SINGLE_TT 1 /* Hi-speed hub with single TT */
211#define USB_HUB_PR_HS_MULTI_TT 2 /* Hi-speed hub with multiple TT */
212#define USB_HUB_PR_SS 3 /* Super speed hub */
213
201struct usb_hub_descriptor { 214struct usb_hub_descriptor {
202 __u8 bDescLength; 215 __u8 bDescLength;
203 __u8 bDescriptorType; 216 __u8 bDescriptorType;
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index d5da6c68c250..3b6f628880f8 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -589,7 +589,7 @@ static inline int usb_endpoint_is_isoc_out(
589 */ 589 */
590static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd) 590static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd)
591{ 591{
592 return le16_to_cpu(epd->wMaxPacketSize); 592 return __le16_to_cpu(epd->wMaxPacketSize);
593} 593}
594 594
595/*-------------------------------------------------------------------------*/ 595/*-------------------------------------------------------------------------*/
@@ -605,8 +605,26 @@ struct usb_ss_ep_comp_descriptor {
605} __attribute__ ((packed)); 605} __attribute__ ((packed));
606 606
607#define USB_DT_SS_EP_COMP_SIZE 6 607#define USB_DT_SS_EP_COMP_SIZE 6
608
608/* Bits 4:0 of bmAttributes if this is a bulk endpoint */ 609/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
609#define USB_SS_MAX_STREAMS(p) (1 << ((p) & 0x1f)) 610static inline int
611usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp)
612{
613 int max_streams;
614
615 if (!comp)
616 return 0;
617
618 max_streams = comp->bmAttributes & 0x1f;
619
620 if (!max_streams)
621 return 0;
622
623 max_streams = 1 << max_streams;
624
625 return max_streams;
626}
627
610/* Bits 1:0 of bmAttributes if this is an isoc endpoint */ 628/* Bits 1:0 of bmAttributes if this is an isoc endpoint */
611#define USB_SS_MULT(p) (1 + ((p) & 0x3)) 629#define USB_SS_MULT(p) (1 + ((p) & 0x3))
612 630
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 1d3a67523ffc..da653b5c7134 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -20,6 +20,7 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/scatterlist.h>
23#include <linux/types.h> 24#include <linux/types.h>
24#include <linux/usb/ch9.h> 25#include <linux/usb/ch9.h>
25 26
@@ -32,6 +33,9 @@ struct usb_ep;
32 * @dma: DMA address corresponding to 'buf'. If you don't set this 33 * @dma: DMA address corresponding to 'buf'. If you don't set this
33 * field, and the usb controller needs one, it is responsible 34 * field, and the usb controller needs one, it is responsible
34 * for mapping and unmapping the buffer. 35 * for mapping and unmapping the buffer.
36 * @sg: a scatterlist for SG-capable controllers.
37 * @num_sgs: number of SG entries
38 * @num_mapped_sgs: number of SG entries mapped to DMA (internal)
35 * @length: Length of that data 39 * @length: Length of that data
36 * @stream_id: The stream id, when USB3.0 bulk streams are being used 40 * @stream_id: The stream id, when USB3.0 bulk streams are being used
37 * @no_interrupt: If true, hints that no completion irq is needed. 41 * @no_interrupt: If true, hints that no completion irq is needed.
@@ -88,6 +92,10 @@ struct usb_request {
88 unsigned length; 92 unsigned length;
89 dma_addr_t dma; 93 dma_addr_t dma;
90 94
95 struct scatterlist *sg;
96 unsigned num_sgs;
97 unsigned num_mapped_sgs;
98
91 unsigned stream_id:16; 99 unsigned stream_id:16;
92 unsigned no_interrupt:1; 100 unsigned no_interrupt:1;
93 unsigned zero:1; 101 unsigned zero:1;
@@ -164,7 +172,7 @@ struct usb_ep {
164 unsigned maxpacket:16; 172 unsigned maxpacket:16;
165 unsigned max_streams:16; 173 unsigned max_streams:16;
166 unsigned mult:2; 174 unsigned mult:2;
167 unsigned maxburst:4; 175 unsigned maxburst:5;
168 u8 address; 176 u8 address;
169 const struct usb_endpoint_descriptor *desc; 177 const struct usb_endpoint_descriptor *desc;
170 const struct usb_ss_ep_comp_descriptor *comp_desc; 178 const struct usb_ss_ep_comp_descriptor *comp_desc;
@@ -477,8 +485,9 @@ struct usb_gadget_ops {
477 * driver setup() requests 485 * driver setup() requests
478 * @ep_list: List of other endpoints supported by the device. 486 * @ep_list: List of other endpoints supported by the device.
479 * @speed: Speed of current connection to USB host. 487 * @speed: Speed of current connection to USB host.
480 * @is_dualspeed: True if the controller supports both high and full speed 488 * @max_speed: Maximal speed the UDC can handle. UDC must support this
481 * operation. If it does, the gadget driver must also support both. 489 * and all slower speeds.
490 * @sg_supported: true if we can handle scatter-gather
482 * @is_otg: True if the USB device port uses a Mini-AB jack, so that the 491 * @is_otg: True if the USB device port uses a Mini-AB jack, so that the
483 * gadget driver must provide a USB OTG descriptor. 492 * gadget driver must provide a USB OTG descriptor.
484 * @is_a_peripheral: False unless is_otg, the "A" end of a USB cable 493 * @is_a_peripheral: False unless is_otg, the "A" end of a USB cable
@@ -518,7 +527,8 @@ struct usb_gadget {
518 struct usb_ep *ep0; 527 struct usb_ep *ep0;
519 struct list_head ep_list; /* of usb_ep */ 528 struct list_head ep_list; /* of usb_ep */
520 enum usb_device_speed speed; 529 enum usb_device_speed speed;
521 unsigned is_dualspeed:1; 530 enum usb_device_speed max_speed;
531 unsigned sg_supported:1;
522 unsigned is_otg:1; 532 unsigned is_otg:1;
523 unsigned is_a_peripheral:1; 533 unsigned is_a_peripheral:1;
524 unsigned b_hnp_enable:1; 534 unsigned b_hnp_enable:1;
@@ -549,7 +559,7 @@ static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev)
549static inline int gadget_is_dualspeed(struct usb_gadget *g) 559static inline int gadget_is_dualspeed(struct usb_gadget *g)
550{ 560{
551#ifdef CONFIG_USB_GADGET_DUALSPEED 561#ifdef CONFIG_USB_GADGET_DUALSPEED
552 /* runtime test would check "g->is_dualspeed" ... that might be 562 /* runtime test would check "g->max_speed" ... that might be
553 * useful to work around hardware bugs, but is mostly pointless 563 * useful to work around hardware bugs, but is mostly pointless
554 */ 564 */
555 return 1; 565 return 1;
@@ -567,7 +577,7 @@ static inline int gadget_is_superspeed(struct usb_gadget *g)
567{ 577{
568#ifdef CONFIG_USB_GADGET_SUPERSPEED 578#ifdef CONFIG_USB_GADGET_SUPERSPEED
569 /* 579 /*
570 * runtime test would check "g->is_superspeed" ... that might be 580 * runtime test would check "g->max_speed" ... that might be
571 * useful to work around hardware bugs, but is mostly pointless 581 * useful to work around hardware bugs, but is mostly pointless
572 */ 582 */
573 return 1; 583 return 1;
@@ -760,7 +770,7 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
760/** 770/**
761 * struct usb_gadget_driver - driver for usb 'slave' devices 771 * struct usb_gadget_driver - driver for usb 'slave' devices
762 * @function: String describing the gadget's function 772 * @function: String describing the gadget's function
763 * @speed: Highest speed the driver handles. 773 * @max_speed: Highest speed the driver handles.
764 * @setup: Invoked for ep0 control requests that aren't handled by 774 * @setup: Invoked for ep0 control requests that aren't handled by
765 * the hardware level driver. Most calls must be handled by 775 * the hardware level driver. Most calls must be handled by
766 * the gadget driver, including descriptor and configuration 776 * the gadget driver, including descriptor and configuration
@@ -824,7 +834,7 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
824 */ 834 */
825struct usb_gadget_driver { 835struct usb_gadget_driver {
826 char *function; 836 char *function;
827 enum usb_device_speed speed; 837 enum usb_device_speed max_speed;
828 void (*unbind)(struct usb_gadget *); 838 void (*unbind)(struct usb_gadget *);
829 int (*setup)(struct usb_gadget *, 839 int (*setup)(struct usb_gadget *,
830 const struct usb_ctrlrequest *); 840 const struct usb_ctrlrequest *);
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 03354d557b79..b2f62f3a32af 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -99,7 +99,6 @@ struct usb_hcd {
99 */ 99 */
100 unsigned long flags; 100 unsigned long flags;
101#define HCD_FLAG_HW_ACCESSIBLE 0 /* at full power */ 101#define HCD_FLAG_HW_ACCESSIBLE 0 /* at full power */
102#define HCD_FLAG_SAW_IRQ 1
103#define HCD_FLAG_POLL_RH 2 /* poll for rh status? */ 102#define HCD_FLAG_POLL_RH 2 /* poll for rh status? */
104#define HCD_FLAG_POLL_PENDING 3 /* status has changed? */ 103#define HCD_FLAG_POLL_PENDING 3 /* status has changed? */
105#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */ 104#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */
@@ -110,7 +109,6 @@ struct usb_hcd {
110 * be slightly faster than test_bit(). 109 * be slightly faster than test_bit().
111 */ 110 */
112#define HCD_HW_ACCESSIBLE(hcd) ((hcd)->flags & (1U << HCD_FLAG_HW_ACCESSIBLE)) 111#define HCD_HW_ACCESSIBLE(hcd) ((hcd)->flags & (1U << HCD_FLAG_HW_ACCESSIBLE))
113#define HCD_SAW_IRQ(hcd) ((hcd)->flags & (1U << HCD_FLAG_SAW_IRQ))
114#define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH)) 112#define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH))
115#define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING)) 113#define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING))
116#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING)) 114#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING))
diff --git a/include/linux/usb/langwell_otg.h b/include/linux/usb/langwell_otg.h
deleted file mode 100644
index 51f17b16d312..000000000000
--- a/include/linux/usb/langwell_otg.h
+++ /dev/null
@@ -1,139 +0,0 @@
1/*
2 * Intel Langwell USB OTG transceiver driver
3 * Copyright (C) 2008 - 2010, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19
20#ifndef __LANGWELL_OTG_H
21#define __LANGWELL_OTG_H
22
23#include <linux/usb/intel_mid_otg.h>
24
25#define CI_USBCMD 0x30
26# define USBCMD_RST BIT(1)
27# define USBCMD_RS BIT(0)
28#define CI_USBSTS 0x34
29# define USBSTS_SLI BIT(8)
30# define USBSTS_URI BIT(6)
31# define USBSTS_PCI BIT(2)
32#define CI_PORTSC1 0x74
33# define PORTSC_PP BIT(12)
34# define PORTSC_LS (BIT(11) | BIT(10))
35# define PORTSC_SUSP BIT(7)
36# define PORTSC_CCS BIT(0)
37#define CI_HOSTPC1 0xb4
38# define HOSTPC1_PHCD BIT(22)
39#define CI_OTGSC 0xf4
40# define OTGSC_DPIE BIT(30)
41# define OTGSC_1MSE BIT(29)
42# define OTGSC_BSEIE BIT(28)
43# define OTGSC_BSVIE BIT(27)
44# define OTGSC_ASVIE BIT(26)
45# define OTGSC_AVVIE BIT(25)
46# define OTGSC_IDIE BIT(24)
47# define OTGSC_DPIS BIT(22)
48# define OTGSC_1MSS BIT(21)
49# define OTGSC_BSEIS BIT(20)
50# define OTGSC_BSVIS BIT(19)
51# define OTGSC_ASVIS BIT(18)
52# define OTGSC_AVVIS BIT(17)
53# define OTGSC_IDIS BIT(16)
54# define OTGSC_DPS BIT(14)
55# define OTGSC_1MST BIT(13)
56# define OTGSC_BSE BIT(12)
57# define OTGSC_BSV BIT(11)
58# define OTGSC_ASV BIT(10)
59# define OTGSC_AVV BIT(9)
60# define OTGSC_ID BIT(8)
61# define OTGSC_HABA BIT(7)
62# define OTGSC_HADP BIT(6)
63# define OTGSC_IDPU BIT(5)
64# define OTGSC_DP BIT(4)
65# define OTGSC_OT BIT(3)
66# define OTGSC_HAAR BIT(2)
67# define OTGSC_VC BIT(1)
68# define OTGSC_VD BIT(0)
69# define OTGSC_INTEN_MASK (0x7f << 24)
70# define OTGSC_INT_MASK (0x5f << 24)
71# define OTGSC_INTSTS_MASK (0x7f << 16)
72#define CI_USBMODE 0xf8
73# define USBMODE_CM (BIT(1) | BIT(0))
74# define USBMODE_IDLE 0
75# define USBMODE_DEVICE 0x2
76# define USBMODE_HOST 0x3
77#define USBCFG_ADDR 0xff10801c
78#define USBCFG_LEN 4
79# define USBCFG_VBUSVAL BIT(14)
80# define USBCFG_AVALID BIT(13)
81# define USBCFG_BVALID BIT(12)
82# define USBCFG_SESEND BIT(11)
83
84#define INTR_DUMMY_MASK (USBSTS_SLI | USBSTS_URI | USBSTS_PCI)
85
86enum langwell_otg_timer_type {
87 TA_WAIT_VRISE_TMR,
88 TA_WAIT_BCON_TMR,
89 TA_AIDL_BDIS_TMR,
90 TB_ASE0_BRST_TMR,
91 TB_SE0_SRP_TMR,
92 TB_SRP_INIT_TMR,
93 TB_SRP_FAIL_TMR,
94 TB_BUS_SUSPEND_TMR
95};
96
97#define TA_WAIT_VRISE 100
98#define TA_WAIT_BCON 30000
99#define TA_AIDL_BDIS 15000
100#define TB_ASE0_BRST 5000
101#define TB_SE0_SRP 2
102#define TB_SRP_INIT 100
103#define TB_SRP_FAIL 5500
104#define TB_BUS_SUSPEND 500
105
106struct langwell_otg_timer {
107 unsigned long expires; /* Number of count increase to timeout */
108 unsigned long count; /* Tick counter */
109 void (*function)(unsigned long); /* Timeout function */
110 unsigned long data; /* Data passed to function */
111 struct list_head list;
112};
113
114struct langwell_otg {
115 struct intel_mid_otg_xceiv iotg;
116 struct device *dev;
117
118 void __iomem *usbcfg; /* SCCBUSB config Reg */
119
120 unsigned region;
121 unsigned cfg_region;
122
123 struct work_struct work;
124 struct workqueue_struct *qwork;
125 struct timer_list hsm_timer;
126
127 spinlock_t lock;
128 spinlock_t wq_lock;
129
130 struct notifier_block iotg_notifier;
131};
132
133static inline
134struct langwell_otg *mid_xceiv_to_lnw(struct intel_mid_otg_xceiv *iotg)
135{
136 return container_of(iotg, struct langwell_otg, iotg);
137}
138
139#endif /* __LANGWELL_OTG_H__ */
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index e5a40c318548..0d3f98879256 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -67,6 +67,14 @@ struct renesas_usbhs_platform_callback {
67 /* 67 /*
68 * option: 68 * option:
69 * 69 *
70 * for board specific clock control
71 */
72 void (*power_ctrl)(struct platform_device *pdev,
73 void __iomem *base, int enable);
74
75 /*
76 * option:
77 *
70 * Phy reset for platform 78 * Phy reset for platform
71 */ 79 */
72 void (*phy_reset)(struct platform_device *pdev); 80 void (*phy_reset)(struct platform_device *pdev);
@@ -118,7 +126,7 @@ struct renesas_usbhs_driver_param {
118 * 126 *
119 * delay time from notify_hotplug callback 127 * delay time from notify_hotplug callback
120 */ 128 */
121 int detection_delay; 129 int detection_delay; /* msec */
122 130
123 /* 131 /*
124 * option: 132 * option:
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index b29f70b2ecae..4267a9c717ba 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -58,11 +58,13 @@ enum port_dev_state {
58 * @read_urb: pointer to the bulk in struct urb for this port. 58 * @read_urb: pointer to the bulk in struct urb for this port.
59 * @bulk_in_endpointAddress: endpoint address for the bulk in pipe for this 59 * @bulk_in_endpointAddress: endpoint address for the bulk in pipe for this
60 * port. 60 * port.
61 * @bulk_in_buffers: pointers to the bulk in buffers for this port
62 * @read_urbs: pointers to the bulk in urbs for this port
63 * @read_urbs_free: status bitmap the for bulk in urbs
61 * @bulk_out_buffer: pointer to the bulk out buffer for this port. 64 * @bulk_out_buffer: pointer to the bulk out buffer for this port.
62 * @bulk_out_size: the size of the bulk_out_buffer, in bytes. 65 * @bulk_out_size: the size of the bulk_out_buffer, in bytes.
63 * @write_urb: pointer to the bulk out struct urb for this port. 66 * @write_urb: pointer to the bulk out struct urb for this port.
64 * @write_fifo: kfifo used to buffer outgoing data 67 * @write_fifo: kfifo used to buffer outgoing data
65 * @write_urb_busy: port`s writing status
66 * @bulk_out_buffers: pointers to the bulk out buffers for this port 68 * @bulk_out_buffers: pointers to the bulk out buffers for this port
67 * @write_urbs: pointers to the bulk out urbs for this port 69 * @write_urbs: pointers to the bulk out urbs for this port
68 * @write_urbs_free: status bitmap the for bulk out urbs 70 * @write_urbs_free: status bitmap the for bulk out urbs
@@ -99,11 +101,14 @@ struct usb_serial_port {
99 struct urb *read_urb; 101 struct urb *read_urb;
100 __u8 bulk_in_endpointAddress; 102 __u8 bulk_in_endpointAddress;
101 103
104 unsigned char *bulk_in_buffers[2];
105 struct urb *read_urbs[2];
106 unsigned long read_urbs_free;
107
102 unsigned char *bulk_out_buffer; 108 unsigned char *bulk_out_buffer;
103 int bulk_out_size; 109 int bulk_out_size;
104 struct urb *write_urb; 110 struct urb *write_urb;
105 struct kfifo write_fifo; 111 struct kfifo write_fifo;
106 int write_urb_busy;
107 112
108 unsigned char *bulk_out_buffers[2]; 113 unsigned char *bulk_out_buffers[2];
109 struct urb *write_urbs[2]; 114 struct urb *write_urbs[2];
@@ -340,7 +345,7 @@ extern void usb_serial_generic_disconnect(struct usb_serial *serial);
340extern void usb_serial_generic_release(struct usb_serial *serial); 345extern void usb_serial_generic_release(struct usb_serial *serial);
341extern int usb_serial_generic_register(int debug); 346extern int usb_serial_generic_register(int debug);
342extern void usb_serial_generic_deregister(void); 347extern void usb_serial_generic_deregister(void);
343extern int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, 348extern int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port,
344 gfp_t mem_flags); 349 gfp_t mem_flags);
345extern void usb_serial_generic_process_read_urb(struct urb *urb); 350extern void usb_serial_generic_process_read_urb(struct urb *urb);
346extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, 351extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port,
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 012a29604522..c9c9a4680cc5 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -235,16 +235,25 @@ struct v4l2_fract {
235 __u32 denominator; 235 __u32 denominator;
236}; 236};
237 237
238/* 238/**
239 * D R I V E R C A P A B I L I T I E S 239 * struct v4l2_capability - Describes V4L2 device caps returned by VIDIOC_QUERYCAP
240 */ 240 *
241 * @driver: name of the driver module (e.g. "bttv")
242 * @card: name of the card (e.g. "Hauppauge WinTV")
243 * @bus_info: name of the bus (e.g. "PCI:" + pci_name(pci_dev) )
244 * @version: KERNEL_VERSION
245 * @capabilities: capabilities of the physical device as a whole
246 * @device_caps: capabilities accessed via this particular device (node)
247 * @reserved: reserved fields for future extensions
248 */
241struct v4l2_capability { 249struct v4l2_capability {
242 __u8 driver[16]; /* i.e. "bttv" */ 250 __u8 driver[16];
243 __u8 card[32]; /* i.e. "Hauppauge WinTV" */ 251 __u8 card[32];
244 __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */ 252 __u8 bus_info[32];
245 __u32 version; /* should use KERNEL_VERSION() */ 253 __u32 version;
246 __u32 capabilities; /* Device capabilities */ 254 __u32 capabilities;
247 __u32 reserved[4]; 255 __u32 device_caps;
256 __u32 reserved[3];
248}; 257};
249 258
250/* Values for 'capabilities' field */ 259/* Values for 'capabilities' field */
@@ -274,6 +283,8 @@ struct v4l2_capability {
274#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ 283#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */
275#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ 284#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */
276 285
286#define V4L2_CAP_DEVICE_CAPS 0x80000000 /* sets device capabilities field */
287
277/* 288/*
278 * V I D E O I M A G E F O R M A T 289 * V I D E O I M A G E F O R M A T
279 */ 290 */
@@ -343,6 +354,8 @@ struct v4l2_pix_format {
343#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */ 354#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
344#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */ 355#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
345#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */ 356#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
357#define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */
358#define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */
346 359
347/* two non contiguous planes - one Y, one Cr + Cb interleaved */ 360/* two non contiguous planes - one Y, one Cr + Cb interleaved */
348#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */ 361#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
@@ -749,20 +762,20 @@ struct v4l2_crop {
749 762
750/* Selection targets */ 763/* Selection targets */
751 764
752/* current cropping area */ 765/* Current cropping area */
753#define V4L2_SEL_TGT_CROP_ACTIVE 0 766#define V4L2_SEL_TGT_CROP_ACTIVE 0x0000
754/* default cropping area */ 767/* Default cropping area */
755#define V4L2_SEL_TGT_CROP_DEFAULT 1 768#define V4L2_SEL_TGT_CROP_DEFAULT 0x0001
756/* cropping bounds */ 769/* Cropping bounds */
757#define V4L2_SEL_TGT_CROP_BOUNDS 2 770#define V4L2_SEL_TGT_CROP_BOUNDS 0x0002
758/* current composing area */ 771/* Current composing area */
759#define V4L2_SEL_TGT_COMPOSE_ACTIVE 256 772#define V4L2_SEL_TGT_COMPOSE_ACTIVE 0x0100
760/* default composing area */ 773/* Default composing area */
761#define V4L2_SEL_TGT_COMPOSE_DEFAULT 257 774#define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101
762/* composing bounds */ 775/* Composing bounds */
763#define V4L2_SEL_TGT_COMPOSE_BOUNDS 258 776#define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102
764/* current composing area plus all padding pixels */ 777/* Current composing area plus all padding pixels */
765#define V4L2_SEL_TGT_COMPOSE_PADDED 259 778#define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103
766 779
767/** 780/**
768 * struct v4l2_selection - selection info 781 * struct v4l2_selection - selection info
@@ -772,7 +785,7 @@ struct v4l2_crop {
772 * @r: coordinates of selection window 785 * @r: coordinates of selection window
773 * @reserved: for future use, rounds structure size to 64 bytes, set to zero 786 * @reserved: for future use, rounds structure size to 64 bytes, set to zero
774 * 787 *
775 * Hardware may use multiple helper window to process a video stream. 788 * Hardware may use multiple helper windows to process a video stream.
776 * The structure is used to exchange this selection areas between 789 * The structure is used to exchange this selection areas between
777 * an application and a driver. 790 * an application and a driver.
778 */ 791 */
@@ -1123,6 +1136,7 @@ struct v4l2_ext_controls {
1123#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ 1136#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
1124#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ 1137#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
1125#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */ 1138#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */
1139#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */
1126 1140
1127#define V4L2_CTRL_ID_MASK (0x0fffffff) 1141#define V4L2_CTRL_ID_MASK (0x0fffffff)
1128#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 1142#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
@@ -1394,6 +1408,16 @@ enum v4l2_mpeg_audio_ac3_bitrate {
1394 V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, 1408 V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17,
1395 V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, 1409 V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
1396}; 1410};
1411#define V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK (V4L2_CID_MPEG_BASE+112)
1412enum v4l2_mpeg_audio_dec_playback {
1413 V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO = 0,
1414 V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO = 1,
1415 V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT = 2,
1416 V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT = 3,
1417 V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO = 4,
1418 V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO = 5,
1419};
1420#define V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (V4L2_CID_MPEG_BASE+113)
1397 1421
1398/* MPEG video controls specific to multiplexed streams */ 1422/* MPEG video controls specific to multiplexed streams */
1399#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) 1423#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
@@ -1444,6 +1468,9 @@ enum v4l2_mpeg_video_multi_slice_mode {
1444 V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2, 1468 V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2,
1445}; 1469};
1446#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222) 1470#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222)
1471#define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223)
1472#define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224)
1473
1447#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300) 1474#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300)
1448#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301) 1475#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)
1449#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302) 1476#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302)
@@ -1732,6 +1759,29 @@ enum v4l2_flash_strobe_source {
1732#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11) 1759#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11)
1733#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12) 1760#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12)
1734 1761
1762/* JPEG-class control IDs defined by V4L2 */
1763#define V4L2_CID_JPEG_CLASS_BASE (V4L2_CTRL_CLASS_JPEG | 0x900)
1764#define V4L2_CID_JPEG_CLASS (V4L2_CTRL_CLASS_JPEG | 1)
1765
1766#define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1)
1767enum v4l2_jpeg_chroma_subsampling {
1768 V4L2_JPEG_CHROMA_SUBSAMPLING_444 = 0,
1769 V4L2_JPEG_CHROMA_SUBSAMPLING_422 = 1,
1770 V4L2_JPEG_CHROMA_SUBSAMPLING_420 = 2,
1771 V4L2_JPEG_CHROMA_SUBSAMPLING_411 = 3,
1772 V4L2_JPEG_CHROMA_SUBSAMPLING_410 = 4,
1773 V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY = 5,
1774};
1775#define V4L2_CID_JPEG_RESTART_INTERVAL (V4L2_CID_JPEG_CLASS_BASE + 2)
1776#define V4L2_CID_JPEG_COMPRESSION_QUALITY (V4L2_CID_JPEG_CLASS_BASE + 3)
1777
1778#define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4)
1779#define V4L2_JPEG_ACTIVE_MARKER_APP0 (1 << 0)
1780#define V4L2_JPEG_ACTIVE_MARKER_APP1 (1 << 1)
1781#define V4L2_JPEG_ACTIVE_MARKER_COM (1 << 16)
1782#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17)
1783#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18)
1784
1735/* 1785/*
1736 * T U N I N G 1786 * T U N I N G
1737 */ 1787 */
@@ -1895,6 +1945,54 @@ struct v4l2_encoder_cmd {
1895 }; 1945 };
1896}; 1946};
1897 1947
1948/* Decoder commands */
1949#define V4L2_DEC_CMD_START (0)
1950#define V4L2_DEC_CMD_STOP (1)
1951#define V4L2_DEC_CMD_PAUSE (2)
1952#define V4L2_DEC_CMD_RESUME (3)
1953
1954/* Flags for V4L2_DEC_CMD_START */
1955#define V4L2_DEC_CMD_START_MUTE_AUDIO (1 << 0)
1956
1957/* Flags for V4L2_DEC_CMD_PAUSE */
1958#define V4L2_DEC_CMD_PAUSE_TO_BLACK (1 << 0)
1959
1960/* Flags for V4L2_DEC_CMD_STOP */
1961#define V4L2_DEC_CMD_STOP_TO_BLACK (1 << 0)
1962#define V4L2_DEC_CMD_STOP_IMMEDIATELY (1 << 1)
1963
1964/* Play format requirements (returned by the driver): */
1965
1966/* The decoder has no special format requirements */
1967#define V4L2_DEC_START_FMT_NONE (0)
1968/* The decoder requires full GOPs */
1969#define V4L2_DEC_START_FMT_GOP (1)
1970
1971/* The structure must be zeroed before use by the application
1972 This ensures it can be extended safely in the future. */
1973struct v4l2_decoder_cmd {
1974 __u32 cmd;
1975 __u32 flags;
1976 union {
1977 struct {
1978 __u64 pts;
1979 } stop;
1980
1981 struct {
1982 /* 0 or 1000 specifies normal speed,
1983 1 specifies forward single stepping,
1984 -1 specifies backward single stepping,
1985 >1: playback at speed/1000 of the normal speed,
1986 <-1: reverse playback at (-speed/1000) of the normal speed. */
1987 __s32 speed;
1988 __u32 format;
1989 } start;
1990
1991 struct {
1992 __u32 data[16];
1993 } raw;
1994 };
1995};
1898#endif 1996#endif
1899 1997
1900 1998
@@ -2305,6 +2403,11 @@ struct v4l2_create_buffers {
2305#define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection) 2403#define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection)
2306#define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection) 2404#define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection)
2307 2405
2406/* Experimental, these two ioctls may change over the next couple of kernel
2407 versions. */
2408#define VIDIOC_DECODER_CMD _IOWR('V', 96, struct v4l2_decoder_cmd)
2409#define VIDIOC_TRY_DECODER_CMD _IOWR('V', 97, struct v4l2_decoder_cmd)
2410
2308/* Reminder: when adding new ioctls please add support for them to 2411/* Reminder: when adding new ioctls please add support for them to
2309 drivers/media/video/v4l2-compat-ioctl32.c as well! */ 2412 drivers/media/video/v4l2-compat-ioctl32.c as well! */
2310 2413
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 4c069d8bd740..d0018d27c281 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -25,70 +25,18 @@ struct virtqueue {
25 void *priv; 25 void *priv;
26}; 26};
27 27
28/** 28int virtqueue_add_buf(struct virtqueue *vq,
29 * operations for virtqueue 29 struct scatterlist sg[],
30 * virtqueue_add_buf: expose buffer to other end 30 unsigned int out_num,
31 * vq: the struct virtqueue we're talking about. 31 unsigned int in_num,
32 * sg: the description of the buffer(s). 32 void *data,
33 * out_num: the number of sg readable by other side 33 gfp_t gfp);
34 * in_num: the number of sg which are writable (after readable ones)
35 * data: the token identifying the buffer.
36 * gfp: how to do memory allocations (if necessary).
37 * Returns remaining capacity of queue (sg segments) or a negative error.
38 * virtqueue_kick: update after add_buf
39 * vq: the struct virtqueue
40 * After one or more add_buf calls, invoke this to kick the other side.
41 * virtqueue_get_buf: get the next used buffer
42 * vq: the struct virtqueue we're talking about.
43 * len: the length written into the buffer
44 * Returns NULL or the "data" token handed to add_buf.
45 * virtqueue_disable_cb: disable callbacks
46 * vq: the struct virtqueue we're talking about.
47 * Note that this is not necessarily synchronous, hence unreliable and only
48 * useful as an optimization.
49 * virtqueue_enable_cb: restart callbacks after disable_cb.
50 * vq: the struct virtqueue we're talking about.
51 * This re-enables callbacks; it returns "false" if there are pending
52 * buffers in the queue, to detect a possible race between the driver
53 * checking for more work, and enabling callbacks.
54 * virtqueue_enable_cb_delayed: restart callbacks after disable_cb.
55 * vq: the struct virtqueue we're talking about.
56 * This re-enables callbacks but hints to the other side to delay
57 * interrupts until most of the available buffers have been processed;
58 * it returns "false" if there are many pending buffers in the queue,
59 * to detect a possible race between the driver checking for more work,
60 * and enabling callbacks.
61 * virtqueue_detach_unused_buf: detach first unused buffer
62 * vq: the struct virtqueue we're talking about.
63 * Returns NULL or the "data" token handed to add_buf
64 * virtqueue_get_vring_size: return the size of the virtqueue's vring
65 * vq: the struct virtqueue containing the vring of interest.
66 * Returns the size of the vring.
67 *
68 * Locking rules are straightforward: the driver is responsible for
69 * locking. No two operations may be invoked simultaneously, with the exception
70 * of virtqueue_disable_cb.
71 *
72 * All operations can be called in any context.
73 */
74 34
75int virtqueue_add_buf_gfp(struct virtqueue *vq, 35void virtqueue_kick(struct virtqueue *vq);
76 struct scatterlist sg[],
77 unsigned int out_num,
78 unsigned int in_num,
79 void *data,
80 gfp_t gfp);
81 36
82static inline int virtqueue_add_buf(struct virtqueue *vq, 37bool virtqueue_kick_prepare(struct virtqueue *vq);
83 struct scatterlist sg[],
84 unsigned int out_num,
85 unsigned int in_num,
86 void *data)
87{
88 return virtqueue_add_buf_gfp(vq, sg, out_num, in_num, data, GFP_ATOMIC);
89}
90 38
91void virtqueue_kick(struct virtqueue *vq); 39void virtqueue_notify(struct virtqueue *vq);
92 40
93void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len); 41void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len);
94 42
@@ -146,6 +94,11 @@ struct virtio_driver {
146 int (*probe)(struct virtio_device *dev); 94 int (*probe)(struct virtio_device *dev);
147 void (*remove)(struct virtio_device *dev); 95 void (*remove)(struct virtio_device *dev);
148 void (*config_changed)(struct virtio_device *dev); 96 void (*config_changed)(struct virtio_device *dev);
97#ifdef CONFIG_PM
98 int (*freeze)(struct virtio_device *dev);
99 int (*thaw)(struct virtio_device *dev);
100 int (*restore)(struct virtio_device *dev);
101#endif
149}; 102};
150 103
151int register_virtio_driver(struct virtio_driver *drv); 104int register_virtio_driver(struct virtio_driver *drv);
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index e9e72bda1b72..5206d6541da5 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -102,6 +102,10 @@
102 * vdev: the virtio_device 102 * vdev: the virtio_device
103 * This gives the final feature bits for the device: it can change 103 * This gives the final feature bits for the device: it can change
104 * the dev->feature bits if it wants. 104 * the dev->feature bits if it wants.
105 * @bus_name: return the bus name associated with the device
106 * vdev: the virtio_device
107 * This returns a pointer to the bus name a la pci_name from which
108 * the caller can then copy.
105 */ 109 */
106typedef void vq_callback_t(struct virtqueue *); 110typedef void vq_callback_t(struct virtqueue *);
107struct virtio_config_ops { 111struct virtio_config_ops {
@@ -119,6 +123,7 @@ struct virtio_config_ops {
119 void (*del_vqs)(struct virtio_device *); 123 void (*del_vqs)(struct virtio_device *);
120 u32 (*get_features)(struct virtio_device *vdev); 124 u32 (*get_features)(struct virtio_device *vdev);
121 void (*finalize_features)(struct virtio_device *vdev); 125 void (*finalize_features)(struct virtio_device *vdev);
126 const char *(*bus_name)(struct virtio_device *vdev);
122}; 127};
123 128
124/* If driver didn't advertise the feature, it will never appear. */ 129/* If driver didn't advertise the feature, it will never appear. */
@@ -184,5 +189,14 @@ struct virtqueue *virtio_find_single_vq(struct virtio_device *vdev,
184 return ERR_PTR(err); 189 return ERR_PTR(err);
185 return vq; 190 return vq;
186} 191}
192
193static inline
194const char *virtio_bus_name(struct virtio_device *vdev)
195{
196 if (!vdev->config->bus_name)
197 return "virtio";
198 return vdev->config->bus_name(vdev);
199}
200
187#endif /* __KERNEL__ */ 201#endif /* __KERNEL__ */
188#endif /* _LINUX_VIRTIO_CONFIG_H */ 202#endif /* _LINUX_VIRTIO_CONFIG_H */
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 36be0f6e18a9..e338730c2660 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -168,6 +168,7 @@ struct virtqueue;
168struct virtqueue *vring_new_virtqueue(unsigned int num, 168struct virtqueue *vring_new_virtqueue(unsigned int num,
169 unsigned int vring_align, 169 unsigned int vring_align,
170 struct virtio_device *vdev, 170 struct virtio_device *vdev,
171 bool weak_barriers,
171 void *pages, 172 void *pages,
172 void (*notify)(struct virtqueue *vq), 173 void (*notify)(struct virtqueue *vq),
173 void (*callback)(struct virtqueue *vq), 174 void (*callback)(struct virtqueue *vq),
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 4bde182fcf93..dcdfc2bda922 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -131,6 +131,7 @@ extern long vwrite(char *buf, char *addr, unsigned long count);
131 */ 131 */
132extern rwlock_t vmlist_lock; 132extern rwlock_t vmlist_lock;
133extern struct vm_struct *vmlist; 133extern struct vm_struct *vmlist;
134extern __init void vm_area_add_early(struct vm_struct *vm);
134extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); 135extern __init void vm_area_register_early(struct vm_struct *vm, size_t align);
135 136
136#ifdef CONFIG_SMP 137#ifdef CONFIG_SMP
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 3efc9f3f43a0..a9ce45e8501c 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -77,13 +77,13 @@ struct task_struct;
77#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \ 77#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \
78 { .flags = word, .bit_nr = bit, } 78 { .flags = word, .bit_nr = bit, }
79 79
80extern void __init_waitqueue_head(wait_queue_head_t *q, struct lock_class_key *); 80extern void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct lock_class_key *);
81 81
82#define init_waitqueue_head(q) \ 82#define init_waitqueue_head(q) \
83 do { \ 83 do { \
84 static struct lock_class_key __key; \ 84 static struct lock_class_key __key; \
85 \ 85 \
86 __init_waitqueue_head((q), &__key); \ 86 __init_waitqueue_head((q), #q, &__key); \
87 } while (0) 87 } while (0)
88 88
89#ifdef CONFIG_LOCKDEP 89#ifdef CONFIG_LOCKDEP
diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h
index e0aa39612eba..3157cc1fada6 100644
--- a/include/linux/wanrouter.h
+++ b/include/linux/wanrouter.h
@@ -309,7 +309,7 @@ typedef struct wandev_conf
309#define WANOPT_EVEN 2 309#define WANOPT_EVEN 2
310 310
311/* CHDLC Protocol Options */ 311/* CHDLC Protocol Options */
312/* DF Commmented out for now. 312/* DF Commented out for now.
313 313
314#define WANOPT_CHDLC_NO_DCD IGNORE_DCD_FOR_LINK_STAT 314#define WANOPT_CHDLC_NO_DCD IGNORE_DCD_FOR_LINK_STAT
315#define WANOPT_CHDLC_NO_CTS IGNORE_CTS_FOR_LINK_STAT 315#define WANOPT_CHDLC_NO_CTS IGNORE_CTS_FOR_LINK_STAT
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 111843f88b2a..43ba5b3ce2a3 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -53,11 +53,7 @@ struct watchdog_info {
53 53
54#ifdef __KERNEL__ 54#ifdef __KERNEL__
55 55
56#ifdef CONFIG_WATCHDOG_NOWAYOUT 56#include <linux/bitops.h>
57#define WATCHDOG_NOWAYOUT 1
58#else
59#define WATCHDOG_NOWAYOUT 0
60#endif
61 57
62struct watchdog_ops; 58struct watchdog_ops;
63struct watchdog_device; 59struct watchdog_device;
@@ -122,6 +118,21 @@ struct watchdog_device {
122#define WDOG_NO_WAY_OUT 3 /* Is 'nowayout' feature set ? */ 118#define WDOG_NO_WAY_OUT 3 /* Is 'nowayout' feature set ? */
123}; 119};
124 120
121#ifdef CONFIG_WATCHDOG_NOWAYOUT
122#define WATCHDOG_NOWAYOUT 1
123#define WATCHDOG_NOWAYOUT_INIT_STATUS (1 << WDOG_NO_WAY_OUT)
124#else
125#define WATCHDOG_NOWAYOUT 0
126#define WATCHDOG_NOWAYOUT_INIT_STATUS 0
127#endif
128
129/* Use the following function to set the nowayout feature */
130static inline void watchdog_set_nowayout(struct watchdog_device *wdd, int nowayout)
131{
132 if (nowayout)
133 set_bit(WDOG_NO_WAY_OUT, &wdd->status);
134}
135
125/* Use the following functions to manipulate watchdog driver specific data */ 136/* Use the following functions to manipulate watchdog driver specific data */
126static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data) 137static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data)
127{ 138{
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 4b697395326e..0d6373195d32 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -54,6 +54,9 @@ struct wl12xx_platform_data {
54 int board_ref_clock; 54 int board_ref_clock;
55 int board_tcxo_clock; 55 int board_tcxo_clock;
56 unsigned long platform_quirks; 56 unsigned long platform_quirks;
57 bool pwr_in_suspend;
58
59 struct wl1271_if_operations *ops;
57}; 60};
58 61
59/* Platform does not support level trigger interrupts */ 62/* Platform does not support level trigger interrupts */
@@ -73,6 +76,6 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
73 76
74#endif 77#endif
75 78
76const struct wl12xx_platform_data *wl12xx_get_platform_data(void); 79struct wl12xx_platform_data *wl12xx_get_platform_data(void);
77 80
78#endif 81#endif
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 0d556deb497b..af155450cabb 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -289,40 +289,62 @@ enum {
289 * 289 *
290 * system_freezable_wq is equivalent to system_wq except that it's 290 * system_freezable_wq is equivalent to system_wq except that it's
291 * freezable. 291 * freezable.
292 *
293 * system_nrt_freezable_wq is equivalent to system_nrt_wq except that
294 * it's freezable.
292 */ 295 */
293extern struct workqueue_struct *system_wq; 296extern struct workqueue_struct *system_wq;
294extern struct workqueue_struct *system_long_wq; 297extern struct workqueue_struct *system_long_wq;
295extern struct workqueue_struct *system_nrt_wq; 298extern struct workqueue_struct *system_nrt_wq;
296extern struct workqueue_struct *system_unbound_wq; 299extern struct workqueue_struct *system_unbound_wq;
297extern struct workqueue_struct *system_freezable_wq; 300extern struct workqueue_struct *system_freezable_wq;
301extern struct workqueue_struct *system_nrt_freezable_wq;
298 302
299extern struct workqueue_struct * 303extern struct workqueue_struct *
300__alloc_workqueue_key(const char *name, unsigned int flags, int max_active, 304__alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
301 struct lock_class_key *key, const char *lock_name); 305 struct lock_class_key *key, const char *lock_name, ...) __printf(1, 6);
302 306
307/**
308 * alloc_workqueue - allocate a workqueue
309 * @fmt: printf format for the name of the workqueue
310 * @flags: WQ_* flags
311 * @max_active: max in-flight work items, 0 for default
312 * @args: args for @fmt
313 *
314 * Allocate a workqueue with the specified parameters. For detailed
315 * information on WQ_* flags, please refer to Documentation/workqueue.txt.
316 *
317 * The __lock_name macro dance is to guarantee that single lock_class_key
318 * doesn't end up with different namesm, which isn't allowed by lockdep.
319 *
320 * RETURNS:
321 * Pointer to the allocated workqueue on success, %NULL on failure.
322 */
303#ifdef CONFIG_LOCKDEP 323#ifdef CONFIG_LOCKDEP
304#define alloc_workqueue(name, flags, max_active) \ 324#define alloc_workqueue(fmt, flags, max_active, args...) \
305({ \ 325({ \
306 static struct lock_class_key __key; \ 326 static struct lock_class_key __key; \
307 const char *__lock_name; \ 327 const char *__lock_name; \
308 \ 328 \
309 if (__builtin_constant_p(name)) \ 329 if (__builtin_constant_p(fmt)) \
310 __lock_name = (name); \ 330 __lock_name = (fmt); \
311 else \ 331 else \
312 __lock_name = #name; \ 332 __lock_name = #fmt; \
313 \ 333 \
314 __alloc_workqueue_key((name), (flags), (max_active), \ 334 __alloc_workqueue_key((fmt), (flags), (max_active), \
315 &__key, __lock_name); \ 335 &__key, __lock_name, ##args); \
316}) 336})
317#else 337#else
318#define alloc_workqueue(name, flags, max_active) \ 338#define alloc_workqueue(fmt, flags, max_active, args...) \
319 __alloc_workqueue_key((name), (flags), (max_active), NULL, NULL) 339 __alloc_workqueue_key((fmt), (flags), (max_active), \
340 NULL, NULL, ##args)
320#endif 341#endif
321 342
322/** 343/**
323 * alloc_ordered_workqueue - allocate an ordered workqueue 344 * alloc_ordered_workqueue - allocate an ordered workqueue
324 * @name: name of the workqueue 345 * @fmt: printf format for the name of the workqueue
325 * @flags: WQ_* flags (only WQ_FREEZABLE and WQ_MEM_RECLAIM are meaningful) 346 * @flags: WQ_* flags (only WQ_FREEZABLE and WQ_MEM_RECLAIM are meaningful)
347 * @args: args for @fmt
326 * 348 *
327 * Allocate an ordered workqueue. An ordered workqueue executes at 349 * Allocate an ordered workqueue. An ordered workqueue executes at
328 * most one work item at any given time in the queued order. They are 350 * most one work item at any given time in the queued order. They are
@@ -331,11 +353,8 @@ __alloc_workqueue_key(const char *name, unsigned int flags, int max_active,
331 * RETURNS: 353 * RETURNS:
332 * Pointer to the allocated workqueue on success, %NULL on failure. 354 * Pointer to the allocated workqueue on success, %NULL on failure.
333 */ 355 */
334static inline struct workqueue_struct * 356#define alloc_ordered_workqueue(fmt, flags, args...) \
335alloc_ordered_workqueue(const char *name, unsigned int flags) 357 alloc_workqueue(fmt, WQ_UNBOUND | (flags), 1, ##args)
336{
337 return alloc_workqueue(name, WQ_UNBOUND | flags, 1);
338}
339 358
340#define create_workqueue(name) \ 359#define create_workqueue(name) \
341 alloc_workqueue((name), WQ_MEM_RECLAIM, 1) 360 alloc_workqueue((name), WQ_MEM_RECLAIM, 1)
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index a378c295851f..995b8bf630ac 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -7,6 +7,8 @@
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/fs.h> 8#include <linux/fs.h>
9 9
10DECLARE_PER_CPU(int, dirty_throttle_leaks);
11
10/* 12/*
11 * The 1/4 region under the global dirty thresh is for smooth dirty throttling: 13 * The 1/4 region under the global dirty thresh is for smooth dirty throttling:
12 * 14 *
@@ -23,11 +25,6 @@
23#define DIRTY_SCOPE 8 25#define DIRTY_SCOPE 8
24#define DIRTY_FULL_SCOPE (DIRTY_SCOPE / 2) 26#define DIRTY_FULL_SCOPE (DIRTY_SCOPE / 2)
25 27
26/*
27 * 4MB minimal write chunk size
28 */
29#define MIN_WRITEBACK_PAGES (4096UL >> (PAGE_CACHE_SHIFT - 10))
30
31struct backing_dev_info; 28struct backing_dev_info;
32 29
33/* 30/*
@@ -124,6 +121,7 @@ void laptop_mode_timer_fn(unsigned long data);
124static inline void laptop_sync_completion(void) { } 121static inline void laptop_sync_completion(void) { }
125#endif 122#endif
126void throttle_vm_writeout(gfp_t gfp_mask); 123void throttle_vm_writeout(gfp_t gfp_mask);
124bool zone_dirty_ok(struct zone *zone);
127 125
128extern unsigned long global_dirty_limit; 126extern unsigned long global_dirty_limit;
129 127
@@ -138,8 +136,6 @@ extern int vm_highmem_is_dirtyable;
138extern int block_dump; 136extern int block_dump;
139extern int laptop_mode; 137extern int laptop_mode;
140 138
141extern unsigned long determine_dirtyable_memory(void);
142
143extern int dirty_background_ratio_handler(struct ctl_table *table, int write, 139extern int dirty_background_ratio_handler(struct ctl_table *table, int write,
144 void __user *buffer, size_t *lenp, 140 void __user *buffer, size_t *lenp,
145 loff_t *ppos); 141 loff_t *ppos);
@@ -195,6 +191,8 @@ void writeback_set_ratelimit(void);
195void tag_pages_for_writeback(struct address_space *mapping, 191void tag_pages_for_writeback(struct address_space *mapping,
196 pgoff_t start, pgoff_t end); 192 pgoff_t start, pgoff_t end);
197 193
194void account_page_redirty(struct page *page);
195
198/* pdflush.c */ 196/* pdflush.c */
199extern int nr_pdflush_threads; /* Global so it can be exported to sysctl 197extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
200 read-only. */ 198 read-only. */
diff --git a/include/linux/zorro_ids.h b/include/linux/zorro_ids.h
index 7e749088910d..74bc53bcfdcf 100644
--- a/include/linux/zorro_ids.h
+++ b/include/linux/zorro_ids.h
@@ -360,8 +360,8 @@
360#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM ZORRO_ID(VILLAGE_TRONIC, 0x0B, 0) 360#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM ZORRO_ID(VILLAGE_TRONIC, 0x0B, 0)
361#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_REG ZORRO_ID(VILLAGE_TRONIC, 0x0C, 0) 361#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_REG ZORRO_ID(VILLAGE_TRONIC, 0x0C, 0)
362#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_SEGMENTED_MODE ZORRO_ID(VILLAGE_TRONIC, 0x0D, 0) 362#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_SEGMENTED_MODE ZORRO_ID(VILLAGE_TRONIC, 0x0D, 0)
363#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_MEM1 ZORRO_ID(VILLAGE_TRONIC, 0x15, 0) 363#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_RAM1 ZORRO_ID(VILLAGE_TRONIC, 0x15, 0)
364#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_MEM2 ZORRO_ID(VILLAGE_TRONIC, 0x16, 0) 364#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_RAM2 ZORRO_ID(VILLAGE_TRONIC, 0x16, 0)
365#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_REG ZORRO_ID(VILLAGE_TRONIC, 0x17, 0) 365#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_REG ZORRO_ID(VILLAGE_TRONIC, 0x17, 0)
366#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z3 ZORRO_ID(VILLAGE_TRONIC, 0x18, 0) 366#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z3 ZORRO_ID(VILLAGE_TRONIC, 0x18, 0)
367#define ZORRO_PROD_VILLAGE_TRONIC_ARIADNE ZORRO_ID(VILLAGE_TRONIC, 0xC9, 0) 367#define ZORRO_PROD_VILLAGE_TRONIC_ARIADNE ZORRO_ID(VILLAGE_TRONIC, 0xC9, 0)