aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-04-19 21:32:26 -0400
committerDave Airlie <airlied@redhat.com>2015-04-19 23:05:20 -0400
commit2c33ce009ca2389dbf0535d0672214d09738e35e (patch)
tree6186a6458c3c160385d794a23eaf07c786a9e61b /include/linux
parentcec32a47010647e8b0603726ebb75b990a4057a4 (diff)
parent09d51602cf84a1264946711dd4ea0dddbac599a1 (diff)
Merge Linus master into drm-next
The merge is clean, but the arm build fails afterwards, due to API changes in the regulator tree. I've included the patch into the merge to fix the build. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/a.out.h67
-rw-r--r--include/linux/acpi.h15
-rw-r--r--include/linux/aio.h70
-rw-r--r--include/linux/ata.h29
-rw-r--r--include/linux/bcm47xx_nvram.h34
-rw-r--r--include/linux/bcma/bcma.h21
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h11
-rw-r--r--include/linux/bcma/bcma_driver_gmac_cmn.h6
-rw-r--r--include/linux/bcma/bcma_driver_mips.h15
-rw-r--r--include/linux/bcma/bcma_driver_pci.h12
-rw-r--r--include/linux/bcma/bcma_driver_pcie2.h4
-rw-r--r--include/linux/bitmap.h16
-rw-r--r--include/linux/bitops.h4
-rw-r--r--include/linux/blk-mq.h9
-rw-r--r--include/linux/blk_types.h4
-rw-r--r--include/linux/bpf.h63
-rw-r--r--include/linux/brcmphy.h2
-rw-r--r--include/linux/can/dev.h2
-rw-r--r--include/linux/can/led.h6
-rw-r--r--include/linux/can/skb.h7
-rw-r--r--include/linux/capability.h29
-rw-r--r--include/linux/cleancache.h13
-rw-r--r--include/linux/clockchips.h154
-rw-r--r--include/linux/clocksource.h25
-rw-r--r--include/linux/cma.h12
-rw-r--r--include/linux/compaction.h1
-rw-r--r--include/linux/compiler.h16
-rw-r--r--include/linux/context_tracking.h15
-rw-r--r--include/linux/context_tracking_state.h9
-rw-r--r--include/linux/cpu.h20
-rw-r--r--include/linux/cpuidle.h1
-rw-r--r--include/linux/cred.h23
-rw-r--r--include/linux/crypto.h6
-rw-r--r--include/linux/dcache.h59
-rw-r--r--include/linux/dccp.h4
-rw-r--r--include/linux/devfreq-event.h2
-rw-r--r--include/linux/device-mapper.h5
-rw-r--r--include/linux/device.h23
-rw-r--r--include/linux/dma-mapping.h4
-rw-r--r--include/linux/dmapool.h2
-rw-r--r--include/linux/efi.h1
-rw-r--r--include/linux/elf-randomize.h22
-rw-r--r--include/linux/etherdevice.h1
-rw-r--r--include/linux/f2fs_fs.h3
-rw-r--r--include/linux/filter.h7
-rw-r--r--include/linux/fs.h88
-rw-r--r--include/linux/fs_pin.h2
-rw-r--r--include/linux/ftrace_event.h18
-rw-r--r--include/linux/fwnode.h27
-rw-r--r--include/linux/gfp.h16
-rw-r--r--include/linux/gpio/consumer.h77
-rw-r--r--include/linux/gpio/driver.h48
-rw-r--r--include/linux/hardirq.h2
-rw-r--r--include/linux/hid-sensor-hub.h55
-rw-r--r--include/linux/hid-sensor-ids.h2
-rw-r--r--include/linux/hid.h8
-rw-r--r--include/linux/hsi/hsi.h6
-rw-r--r--include/linux/hugetlb.h20
-rw-r--r--include/linux/hw_random.h4
-rw-r--r--include/linux/i2c.h59
-rw-r--r--include/linux/ieee802154.h14
-rw-r--r--include/linux/if_bridge.h1
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/if_pppox.h2
-rw-r--r--include/linux/if_vlan.h67
-rw-r--r--include/linux/iio/buffer.h8
-rw-r--r--include/linux/iio/dac/max517.h2
-rw-r--r--include/linux/iio/events.h30
-rw-r--r--include/linux/iio/iio.h13
-rw-r--r--include/linux/iio/types.h78
-rw-r--r--include/linux/inet_diag.h43
-rw-r--r--include/linux/init.h38
-rw-r--r--include/linux/intel_mid_dma.h76
-rw-r--r--include/linux/interrupt.h18
-rw-r--r--include/linux/io.h8
-rw-r--r--include/linux/iommu-common.h51
-rw-r--r--include/linux/ioport.h8
-rw-r--r--include/linux/ipv6.h4
-rw-r--r--include/linux/irq.h7
-rw-r--r--include/linux/irq_work.h3
-rw-r--r--include/linux/irqchip/arm-gic.h7
-rw-r--r--include/linux/irqchip/irq-crossbar.h11
-rw-r--r--include/linux/irqchip/mips-gic.h9
-rw-r--r--include/linux/irqflags.h43
-rw-r--r--include/linux/jhash.h17
-rw-r--r--include/linux/jump_label.h21
-rw-r--r--include/linux/kasan.h2
-rw-r--r--include/linux/kconfig.h15
-rw-r--r--include/linux/kernel.h12
-rw-r--r--include/linux/ksm.h17
-rw-r--r--include/linux/kvm_host.h35
-rw-r--r--include/linux/led-class-flash.h19
-rw-r--r--include/linux/leds.h5
-rw-r--r--include/linux/libata.h3
-rw-r--r--include/linux/livepatch.h8
-rw-r--r--include/linux/lockdep.h7
-rw-r--r--include/linux/memblock.h8
-rw-r--r--include/linux/memory_hotplug.h6
-rw-r--r--include/linux/mempool.h5
-rw-r--r--include/linux/mfd/abx500/ux500_chargalg.h11
-rw-r--r--include/linux/mfd/arizona/core.h1
-rw-r--r--include/linux/mfd/arizona/gpio.h96
-rw-r--r--include/linux/mfd/arizona/pdata.h24
-rw-r--r--include/linux/mfd/max77693-private.h5
-rw-r--r--include/linux/mfd/max77693.h25
-rw-r--r--include/linux/mfd/max77843-private.h454
-rw-r--r--include/linux/mfd/menelaus.h7
-rw-r--r--include/linux/mfd/mt6397/core.h64
-rw-r--r--include/linux/mfd/mt6397/registers.h362
-rw-r--r--include/linux/mfd/palmas.h1
-rw-r--r--include/linux/mfd/rk808.h3
-rw-r--r--include/linux/mfd/rt5033.h2
-rw-r--r--include/linux/mfd/rtsx_pci.h1116
-rw-r--r--include/linux/mfd/samsung/core.h9
-rw-r--r--include/linux/mfd/samsung/irq.h2
-rw-r--r--include/linux/mfd/samsung/rtc.h2
-rw-r--r--include/linux/mfd/sky81452.h31
-rw-r--r--include/linux/mfd/stw481x.h4
-rw-r--r--include/linux/mfd/syscon/exynos5-pmu.h3
-rw-r--r--include/linux/mfd/tc3589x.h23
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h1
-rw-r--r--include/linux/mfd/wm8350/supply.h6
-rw-r--r--include/linux/migrate.h5
-rw-r--r--include/linux/mlx4/cmd.h26
-rw-r--r--include/linux/mlx4/device.h40
-rw-r--r--include/linux/mlx4/qp.h18
-rw-r--r--include/linux/mlx5/cmd.h2
-rw-r--r--include/linux/mlx5/cq.h7
-rw-r--r--include/linux/mlx5/device.h2
-rw-r--r--include/linux/mlx5/doorbell.h2
-rw-r--r--include/linux/mlx5/driver.h16
-rw-r--r--include/linux/mlx5/mlx5_ifc.h2
-rw-r--r--include/linux/mlx5/qp.h2
-rw-r--r--include/linux/mlx5/srq.h2
-rw-r--r--include/linux/mm.h104
-rw-r--r--include/linux/mm_types.h4
-rw-r--r--include/linux/mmc/core.h4
-rw-r--r--include/linux/mmc/dw_mmc.h6
-rw-r--r--include/linux/mmc/host.h6
-rw-r--r--include/linux/mmc/sdhci-spear.h34
-rw-r--r--include/linux/mmc/sdhci.h218
-rw-r--r--include/linux/mmc/sdio_ids.h2
-rw-r--r--include/linux/mmzone.h15
-rw-r--r--include/linux/mod_devicetable.h8
-rw-r--r--include/linux/module.h2
-rw-r--r--include/linux/mount.h3
-rw-r--r--include/linux/nbd.h46
-rw-r--r--include/linux/net.h12
-rw-r--r--include/linux/netdevice.h142
-rw-r--r--include/linux/netfilter.h103
-rw-r--r--include/linux/netfilter/ipset/ip_set.h5
-rw-r--r--include/linux/netfilter_arp/arp_tables.h3
-rw-r--r--include/linux/netfilter_bridge.h100
-rw-r--r--include/linux/netfilter_bridge/ebtables.h3
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h3
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h3
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/nfs_fs.h5
-rw-r--r--include/linux/nmi.h21
-rw-r--r--include/linux/nvme.h5
-rw-r--r--include/linux/of.h38
-rw-r--r--include/linux/of_device.h3
-rw-r--r--include/linux/of_iommu.h6
-rw-r--r--include/linux/of_mdio.h7
-rw-r--r--include/linux/of_net.h8
-rw-r--r--include/linux/of_pci.h3
-rw-r--r--include/linux/oom.h3
-rw-r--r--include/linux/page-flags.h105
-rw-r--r--include/linux/pci-acpi.h5
-rw-r--r--include/linux/pci-aspm.h4
-rw-r--r--include/linux/pci.h19
-rw-r--r--include/linux/pci_ids.h2
-rw-r--r--include/linux/perf_event.h121
-rw-r--r--include/linux/personality.h40
-rw-r--r--include/linux/phy_fixed.h9
-rw-r--r--include/linux/platform_data/hsmmc-omap.h6
-rw-r--r--include/linux/platform_data/i2c-davinci.h1
-rw-r--r--include/linux/platform_data/nxp-nci.h27
-rw-r--r--include/linux/platform_data/sky81452-backlight.h46
-rw-r--r--include/linux/platform_data/st33zp24.h (renamed from include/linux/platform_data/tpm_stm_st33.h)21
-rw-r--r--include/linux/platform_device.h2
-rw-r--r--include/linux/pm-trace.h (renamed from include/linux/resume-trace.h)9
-rw-r--r--include/linux/pm.h8
-rw-r--r--include/linux/pm_domain.h6
-rw-r--r--include/linux/pnp.h12
-rw-r--r--include/linux/power/charger-manager.h3
-rw-r--r--include/linux/power/max17042_battery.h9
-rw-r--r--include/linux/power_supply.h78
-rw-r--r--include/linux/printk.h5
-rw-r--r--include/linux/property.h44
-rw-r--r--include/linux/pstore.h1
-rw-r--r--include/linux/ptp_clock_kernel.h12
-rw-r--r--include/linux/quota.h90
-rw-r--r--include/linux/quotaops.h14
-rw-r--r--include/linux/rcupdate.h40
-rw-r--r--include/linux/reboot.h3
-rw-r--r--include/linux/regulator/act8865.h14
-rw-r--r--include/linux/regulator/consumer.h23
-rw-r--r--include/linux/regulator/driver.h4
-rw-r--r--include/linux/rhashtable.h527
-rw-r--r--include/linux/rmap.h8
-rw-r--r--include/linux/rtc.h1
-rw-r--r--include/linux/rtnetlink.h15
-rw-r--r--include/linux/sched.h37
-rw-r--r--include/linux/security.h15
-rw-r--r--include/linux/seqlock.h6
-rw-r--r--include/linux/skbuff.h13
-rw-r--r--include/linux/slab.h2
-rw-r--r--include/linux/smpboot.h1
-rw-r--r--include/linux/sock_diag.h4
-rw-r--r--include/linux/socket.h8
-rw-r--r--include/linux/spi/at86rf230.h1
-rw-r--r--include/linux/spi/cc2520.h1
-rw-r--r--include/linux/spi/spi.h8
-rw-r--r--include/linux/srcu.h2
-rw-r--r--include/linux/stacktrace.h2
-rw-r--r--include/linux/stddef.h9
-rw-r--r--include/linux/stmmac.h2
-rw-r--r--include/linux/string_helpers.h10
-rw-r--r--include/linux/swap.h2
-rw-r--r--include/linux/sysctl.h3
-rw-r--r--include/linux/sysfs.h15
-rw-r--r--include/linux/tcp.h5
-rw-r--r--include/linux/tick.h190
-rw-r--r--include/linux/timekeeper_internal.h16
-rw-r--r--include/linux/timekeeping.h18
-rw-r--r--include/linux/tracefs.h45
-rw-r--r--include/linux/tracepoint.h8
-rw-r--r--include/linux/types.h6
-rw-r--r--include/linux/udp.h2
-rw-r--r--include/linux/uidgid.h12
-rw-r--r--include/linux/uio.h23
-rw-r--r--include/linux/usb.h26
-rw-r--r--include/linux/usb/chipidea.h2
-rw-r--r--include/linux/usb/composite.h3
-rw-r--r--include/linux/usb/gadget.h9
-rw-r--r--include/linux/usb/msm_hsusb.h4
-rw-r--r--include/linux/usb/otg-fsm.h2
-rw-r--r--include/linux/usb/renesas_usbhs.h2
-rw-r--r--include/linux/util_macros.h40
-rw-r--r--include/linux/uwb/umc.h2
-rw-r--r--include/linux/vfio.h38
-rw-r--r--include/linux/vgaarb.h5
-rw-r--r--include/linux/vme.h1
-rw-r--r--include/linux/watchdog.h8
-rw-r--r--include/linux/workqueue.h1
-rw-r--r--include/linux/zsmalloc.h1
247 files changed, 4667 insertions, 2588 deletions
diff --git a/include/linux/a.out.h b/include/linux/a.out.h
index 220f14338895..ee884168989f 100644
--- a/include/linux/a.out.h
+++ b/include/linux/a.out.h
@@ -4,44 +4,6 @@
4#include <uapi/linux/a.out.h> 4#include <uapi/linux/a.out.h>
5 5
6#ifndef __ASSEMBLY__ 6#ifndef __ASSEMBLY__
7#if defined (M_OLDSUN2)
8#else
9#endif
10#if defined (M_68010)
11#else
12#endif
13#if defined (M_68020)
14#else
15#endif
16#if defined (M_SPARC)
17#else
18#endif
19#if !defined (N_MAGIC)
20#endif
21#if !defined (N_BADMAG)
22#endif
23#if !defined (N_TXTOFF)
24#endif
25#if !defined (N_DATOFF)
26#endif
27#if !defined (N_TRELOFF)
28#endif
29#if !defined (N_DRELOFF)
30#endif
31#if !defined (N_SYMOFF)
32#endif
33#if !defined (N_STROFF)
34#endif
35#if !defined (N_TXTADDR)
36#endif
37#if defined(vax) || defined(hp300) || defined(pyr)
38#endif
39#ifdef sony
40#endif /* Sony. */
41#ifdef is68k
42#endif
43#if defined(m68k) && defined(PORTAR)
44#endif
45#ifdef linux 7#ifdef linux
46#include <asm/page.h> 8#include <asm/page.h>
47#if defined(__i386__) || defined(__mc68000__) 9#if defined(__i386__) || defined(__mc68000__)
@@ -51,34 +13,5 @@
51#endif 13#endif
52#endif 14#endif
53#endif 15#endif
54#ifndef N_DATADDR
55#endif
56#if !defined (N_BSSADDR)
57#endif
58#if !defined (N_NLIST_DECLARED)
59#endif /* no N_NLIST_DECLARED. */
60#if !defined (N_UNDF)
61#endif
62#if !defined (N_ABS)
63#endif
64#if !defined (N_TEXT)
65#endif
66#if !defined (N_DATA)
67#endif
68#if !defined (N_BSS)
69#endif
70#if !defined (N_FN)
71#endif
72#if !defined (N_EXT)
73#endif
74#if !defined (N_TYPE)
75#endif
76#if !defined (N_STAB)
77#endif
78#if !defined (N_RELOCATION_INFO_DECLARED)
79#ifdef NS32K
80#else
81#endif
82#endif /* no N_RELOCATION_INFO_DECLARED. */
83#endif /*__ASSEMBLY__ */ 16#endif /*__ASSEMBLY__ */
84#endif /* __A_OUT_GNU_H__ */ 17#endif /* __A_OUT_GNU_H__ */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 24c7aa8b1d20..dd12127f171c 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -53,10 +53,16 @@ static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
53 return adev ? adev->handle : NULL; 53 return adev ? adev->handle : NULL;
54} 54}
55 55
56#define ACPI_COMPANION(dev) ((dev)->acpi_node.companion) 56#define ACPI_COMPANION(dev) acpi_node((dev)->fwnode)
57#define ACPI_COMPANION_SET(dev, adev) ACPI_COMPANION(dev) = (adev) 57#define ACPI_COMPANION_SET(dev, adev) set_primary_fwnode(dev, (adev) ? \
58 acpi_fwnode_handle(adev) : NULL)
58#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev)) 59#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev))
59 60
61static inline bool has_acpi_companion(struct device *dev)
62{
63 return is_acpi_node(dev->fwnode);
64}
65
60static inline void acpi_preset_companion(struct device *dev, 66static inline void acpi_preset_companion(struct device *dev,
61 struct acpi_device *parent, u64 addr) 67 struct acpi_device *parent, u64 addr)
62{ 68{
@@ -471,6 +477,11 @@ static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev)
471 return NULL; 477 return NULL;
472} 478}
473 479
480static inline bool has_acpi_companion(struct device *dev)
481{
482 return false;
483}
484
474static inline const char *acpi_dev_name(struct acpi_device *adev) 485static inline const char *acpi_dev_name(struct acpi_device *adev)
475{ 486{
476 return NULL; 487 return NULL;
diff --git a/include/linux/aio.h b/include/linux/aio.h
index d9c92daa3944..9eb42dbc5582 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -1,86 +1,23 @@
1#ifndef __LINUX__AIO_H 1#ifndef __LINUX__AIO_H
2#define __LINUX__AIO_H 2#define __LINUX__AIO_H
3 3
4#include <linux/list.h>
5#include <linux/workqueue.h>
6#include <linux/aio_abi.h> 4#include <linux/aio_abi.h>
7#include <linux/uio.h>
8#include <linux/rcupdate.h>
9
10#include <linux/atomic.h>
11 5
12struct kioctx; 6struct kioctx;
13struct kiocb; 7struct kiocb;
8struct mm_struct;
14 9
15#define KIOCB_KEY 0 10#define KIOCB_KEY 0
16 11
17/*
18 * We use ki_cancel == KIOCB_CANCELLED to indicate that a kiocb has been either
19 * cancelled or completed (this makes a certain amount of sense because
20 * successful cancellation - io_cancel() - does deliver the completion to
21 * userspace).
22 *
23 * And since most things don't implement kiocb cancellation and we'd really like
24 * kiocb completion to be lockless when possible, we use ki_cancel to
25 * synchronize cancellation and completion - we only set it to KIOCB_CANCELLED
26 * with xchg() or cmpxchg(), see batch_complete_aio() and kiocb_cancel().
27 */
28#define KIOCB_CANCELLED ((void *) (~0ULL))
29
30typedef int (kiocb_cancel_fn)(struct kiocb *); 12typedef int (kiocb_cancel_fn)(struct kiocb *);
31 13
32struct kiocb {
33 struct file *ki_filp;
34 struct kioctx *ki_ctx; /* NULL for sync ops */
35 kiocb_cancel_fn *ki_cancel;
36 void *private;
37
38 union {
39 void __user *user;
40 struct task_struct *tsk;
41 } ki_obj;
42
43 __u64 ki_user_data; /* user's data for completion */
44 loff_t ki_pos;
45 size_t ki_nbytes; /* copy of iocb->aio_nbytes */
46
47 struct list_head ki_list; /* the aio core uses this
48 * for cancellation */
49
50 /*
51 * If the aio_resfd field of the userspace iocb is not zero,
52 * this is the underlying eventfd context to deliver events to.
53 */
54 struct eventfd_ctx *ki_eventfd;
55};
56
57static inline bool is_sync_kiocb(struct kiocb *kiocb)
58{
59 return kiocb->ki_ctx == NULL;
60}
61
62static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
63{
64 *kiocb = (struct kiocb) {
65 .ki_ctx = NULL,
66 .ki_filp = filp,
67 .ki_obj.tsk = current,
68 };
69}
70
71/* prototypes */ 14/* prototypes */
72#ifdef CONFIG_AIO 15#ifdef CONFIG_AIO
73extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb);
74extern void aio_complete(struct kiocb *iocb, long res, long res2);
75struct mm_struct;
76extern void exit_aio(struct mm_struct *mm); 16extern void exit_aio(struct mm_struct *mm);
77extern long do_io_submit(aio_context_t ctx_id, long nr, 17extern long do_io_submit(aio_context_t ctx_id, long nr,
78 struct iocb __user *__user *iocbpp, bool compat); 18 struct iocb __user *__user *iocbpp, bool compat);
79void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel); 19void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel);
80#else 20#else
81static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; }
82static inline void aio_complete(struct kiocb *iocb, long res, long res2) { }
83struct mm_struct;
84static inline void exit_aio(struct mm_struct *mm) { } 21static inline void exit_aio(struct mm_struct *mm) { }
85static inline long do_io_submit(aio_context_t ctx_id, long nr, 22static inline long do_io_submit(aio_context_t ctx_id, long nr,
86 struct iocb __user * __user *iocbpp, 23 struct iocb __user * __user *iocbpp,
@@ -89,11 +26,6 @@ static inline void kiocb_set_cancel_fn(struct kiocb *req,
89 kiocb_cancel_fn *cancel) { } 26 kiocb_cancel_fn *cancel) { }
90#endif /* CONFIG_AIO */ 27#endif /* CONFIG_AIO */
91 28
92static inline struct kiocb *list_kiocb(struct list_head *h)
93{
94 return list_entry(h, struct kiocb, ki_list);
95}
96
97/* for sysctl: */ 29/* for sysctl: */
98extern unsigned long aio_nr; 30extern unsigned long aio_nr;
99extern unsigned long aio_max_nr; 31extern unsigned long aio_max_nr;
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 1648026e06b4..b666b773e111 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -94,6 +94,8 @@ enum {
94 ATA_ID_SECTOR_SIZE = 106, 94 ATA_ID_SECTOR_SIZE = 106,
95 ATA_ID_WWN = 108, 95 ATA_ID_WWN = 108,
96 ATA_ID_LOGICAL_SECTOR_SIZE = 117, /* and 118 */ 96 ATA_ID_LOGICAL_SECTOR_SIZE = 117, /* and 118 */
97 ATA_ID_COMMAND_SET_3 = 119,
98 ATA_ID_COMMAND_SET_4 = 120,
97 ATA_ID_LAST_LUN = 126, 99 ATA_ID_LAST_LUN = 126,
98 ATA_ID_DLF = 128, 100 ATA_ID_DLF = 128,
99 ATA_ID_CSFO = 129, 101 ATA_ID_CSFO = 129,
@@ -177,7 +179,7 @@ enum {
177 ATA_DSC = (1 << 4), /* drive seek complete */ 179 ATA_DSC = (1 << 4), /* drive seek complete */
178 ATA_DRQ = (1 << 3), /* data request i/o */ 180 ATA_DRQ = (1 << 3), /* data request i/o */
179 ATA_CORR = (1 << 2), /* corrected data error */ 181 ATA_CORR = (1 << 2), /* corrected data error */
180 ATA_IDX = (1 << 1), /* index */ 182 ATA_SENSE = (1 << 1), /* sense code available */
181 ATA_ERR = (1 << 0), /* have an error */ 183 ATA_ERR = (1 << 0), /* have an error */
182 ATA_SRST = (1 << 2), /* software reset */ 184 ATA_SRST = (1 << 2), /* software reset */
183 ATA_ICRC = (1 << 7), /* interface CRC error */ 185 ATA_ICRC = (1 << 7), /* interface CRC error */
@@ -382,6 +384,8 @@ enum {
382 SATA_SSP = 0x06, /* Software Settings Preservation */ 384 SATA_SSP = 0x06, /* Software Settings Preservation */
383 SATA_DEVSLP = 0x09, /* Device Sleep */ 385 SATA_DEVSLP = 0x09, /* Device Sleep */
384 386
387 SETFEATURE_SENSE_DATA = 0xC3, /* Sense Data Reporting feature */
388
385 /* feature values for SET_MAX */ 389 /* feature values for SET_MAX */
386 ATA_SET_MAX_ADDR = 0x00, 390 ATA_SET_MAX_ADDR = 0x00,
387 ATA_SET_MAX_PASSWD = 0x01, 391 ATA_SET_MAX_PASSWD = 0x01,
@@ -525,6 +529,8 @@ struct ata_bmdma_prd {
525#define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20) 529#define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20)
526#define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4)) 530#define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4))
527#define ata_id_has_devslp(id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8)) 531#define ata_id_has_devslp(id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8))
532#define ata_id_has_ncq_autosense(id) \
533 ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7))
528 534
529static inline bool ata_id_has_hipm(const u16 *id) 535static inline bool ata_id_has_hipm(const u16 *id)
530{ 536{
@@ -696,6 +702,27 @@ static inline bool ata_id_wcache_enabled(const u16 *id)
696 return id[ATA_ID_CFS_ENABLE_1] & (1 << 5); 702 return id[ATA_ID_CFS_ENABLE_1] & (1 << 5);
697} 703}
698 704
705static inline bool ata_id_has_read_log_dma_ext(const u16 *id)
706{
707 if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15)))
708 return false;
709 return id[ATA_ID_COMMAND_SET_3] & (1 << 3);
710}
711
712static inline bool ata_id_has_sense_reporting(const u16 *id)
713{
714 if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15)))
715 return false;
716 return id[ATA_ID_COMMAND_SET_3] & (1 << 6);
717}
718
719static inline bool ata_id_sense_reporting_enabled(const u16 *id)
720{
721 if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15)))
722 return false;
723 return id[ATA_ID_COMMAND_SET_4] & (1 << 6);
724}
725
699/** 726/**
700 * ata_id_major_version - get ATA level of drive 727 * ata_id_major_version - get ATA level of drive
701 * @id: Identify data 728 * @id: Identify data
diff --git a/include/linux/bcm47xx_nvram.h b/include/linux/bcm47xx_nvram.h
new file mode 100644
index 000000000000..b12b07e75929
--- /dev/null
+++ b/include/linux/bcm47xx_nvram.h
@@ -0,0 +1,34 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
6 */
7
8#ifndef __BCM47XX_NVRAM_H
9#define __BCM47XX_NVRAM_H
10
11#include <linux/types.h>
12#include <linux/kernel.h>
13
14#ifdef CONFIG_BCM47XX
15int bcm47xx_nvram_init_from_mem(u32 base, u32 lim);
16int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len);
17int bcm47xx_nvram_gpio_pin(const char *name);
18#else
19static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)
20{
21 return -ENOTSUPP;
22};
23static inline int bcm47xx_nvram_getenv(const char *name, char *val,
24 size_t val_len)
25{
26 return -ENOTSUPP;
27};
28static inline int bcm47xx_nvram_gpio_pin(const char *name)
29{
30 return -ENOTSUPP;
31};
32#endif
33
34#endif /* __BCM47XX_NVRAM_H */
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 994739da827f..e34f906647d3 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -434,6 +434,27 @@ static inline struct bcma_device *bcma_find_core(struct bcma_bus *bus,
434 return bcma_find_core_unit(bus, coreid, 0); 434 return bcma_find_core_unit(bus, coreid, 0);
435} 435}
436 436
437#ifdef CONFIG_BCMA_HOST_PCI
438extern void bcma_host_pci_up(struct bcma_bus *bus);
439extern void bcma_host_pci_down(struct bcma_bus *bus);
440extern int bcma_host_pci_irq_ctl(struct bcma_bus *bus,
441 struct bcma_device *core, bool enable);
442#else
443static inline void bcma_host_pci_up(struct bcma_bus *bus)
444{
445}
446static inline void bcma_host_pci_down(struct bcma_bus *bus)
447{
448}
449static inline int bcma_host_pci_irq_ctl(struct bcma_bus *bus,
450 struct bcma_device *core, bool enable)
451{
452 if (bus->hosttype == BCMA_HOSTTYPE_PCI)
453 return -ENOTSUPP;
454 return 0;
455}
456#endif
457
437extern bool bcma_core_is_enabled(struct bcma_device *core); 458extern bool bcma_core_is_enabled(struct bcma_device *core);
438extern void bcma_core_disable(struct bcma_device *core, u32 flags); 459extern void bcma_core_disable(struct bcma_device *core, u32 flags);
439extern int bcma_core_enable(struct bcma_device *core, u32 flags); 460extern int bcma_core_enable(struct bcma_device *core, u32 flags);
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index db6fa217f98b..6cceedf65ca2 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -663,14 +663,6 @@ struct bcma_drv_cc_b {
663#define bcma_cc_maskset32(cc, offset, mask, set) \ 663#define bcma_cc_maskset32(cc, offset, mask, set) \
664 bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set)) 664 bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set))
665 665
666extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
667extern void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc);
668
669extern void bcma_chipco_suspend(struct bcma_drv_cc *cc);
670extern void bcma_chipco_resume(struct bcma_drv_cc *cc);
671
672void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
673
674extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks); 666extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks);
675 667
676extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc); 668extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc);
@@ -690,9 +682,6 @@ u32 bcma_chipco_gpio_pullup(struct bcma_drv_cc *cc, u32 mask, u32 value);
690u32 bcma_chipco_gpio_pulldown(struct bcma_drv_cc *cc, u32 mask, u32 value); 682u32 bcma_chipco_gpio_pulldown(struct bcma_drv_cc *cc, u32 mask, u32 value);
691 683
692/* PMU support */ 684/* PMU support */
693extern void bcma_pmu_init(struct bcma_drv_cc *cc);
694extern void bcma_pmu_early_init(struct bcma_drv_cc *cc);
695
696extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset, 685extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset,
697 u32 value); 686 u32 value);
698extern void bcma_chipco_pll_maskset(struct bcma_drv_cc *cc, u32 offset, 687extern void bcma_chipco_pll_maskset(struct bcma_drv_cc *cc, u32 offset,
diff --git a/include/linux/bcma/bcma_driver_gmac_cmn.h b/include/linux/bcma/bcma_driver_gmac_cmn.h
index 4dd1f33e36a2..4354d4ea6713 100644
--- a/include/linux/bcma/bcma_driver_gmac_cmn.h
+++ b/include/linux/bcma/bcma_driver_gmac_cmn.h
@@ -91,10 +91,4 @@ struct bcma_drv_gmac_cmn {
91#define gmac_cmn_write16(gc, offset, val) bcma_write16((gc)->core, offset, val) 91#define gmac_cmn_write16(gc, offset, val) bcma_write16((gc)->core, offset, val)
92#define gmac_cmn_write32(gc, offset, val) bcma_write32((gc)->core, offset, val) 92#define gmac_cmn_write32(gc, offset, val) bcma_write32((gc)->core, offset, val)
93 93
94#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN
95extern void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc);
96#else
97static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) { }
98#endif
99
100#endif /* LINUX_BCMA_DRIVER_GMAC_CMN_H_ */ 94#endif /* LINUX_BCMA_DRIVER_GMAC_CMN_H_ */
diff --git a/include/linux/bcma/bcma_driver_mips.h b/include/linux/bcma/bcma_driver_mips.h
index 0b3b32aeeb8a..8eea7f9e33b4 100644
--- a/include/linux/bcma/bcma_driver_mips.h
+++ b/include/linux/bcma/bcma_driver_mips.h
@@ -39,21 +39,6 @@ struct bcma_drv_mips {
39 u8 early_setup_done:1; 39 u8 early_setup_done:1;
40}; 40};
41 41
42#ifdef CONFIG_BCMA_DRIVER_MIPS
43extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
44extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
45
46extern unsigned int bcma_core_mips_irq(struct bcma_device *dev);
47#else
48static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
49static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { }
50
51static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev)
52{
53 return 0;
54}
55#endif
56
57extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore); 42extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore);
58 43
59#endif /* LINUX_BCMA_DRIVER_MIPS_H_ */ 44#endif /* LINUX_BCMA_DRIVER_MIPS_H_ */
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index 3f809ae372c4..5ba6918ca20b 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -238,13 +238,13 @@ struct bcma_drv_pci {
238#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val) 238#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val)
239#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) 239#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
240 240
241extern void bcma_core_pci_early_init(struct bcma_drv_pci *pc); 241#ifdef CONFIG_BCMA_DRIVER_PCI
242extern void bcma_core_pci_init(struct bcma_drv_pci *pc);
243extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
244 struct bcma_device *core, bool enable);
245extern void bcma_core_pci_up(struct bcma_bus *bus);
246extern void bcma_core_pci_down(struct bcma_bus *bus);
247extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up); 242extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up);
243#else
244static inline void bcma_core_pci_power_save(struct bcma_bus *bus, bool up)
245{
246}
247#endif
248 248
249extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); 249extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
250extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); 250extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev);
diff --git a/include/linux/bcma/bcma_driver_pcie2.h b/include/linux/bcma/bcma_driver_pcie2.h
index 5988b05781c3..31e6d17ab798 100644
--- a/include/linux/bcma/bcma_driver_pcie2.h
+++ b/include/linux/bcma/bcma_driver_pcie2.h
@@ -143,6 +143,8 @@
143 143
144struct bcma_drv_pcie2 { 144struct bcma_drv_pcie2 {
145 struct bcma_device *core; 145 struct bcma_device *core;
146
147 u16 reqsize;
146}; 148};
147 149
148#define pcie2_read16(pcie2, offset) bcma_read16((pcie2)->core, offset) 150#define pcie2_read16(pcie2, offset) bcma_read16((pcie2)->core, offset)
@@ -153,6 +155,4 @@ struct bcma_drv_pcie2 {
153#define pcie2_set32(pcie2, offset, set) bcma_set32((pcie2)->core, offset, set) 155#define pcie2_set32(pcie2, offset, set) bcma_set32((pcie2)->core, offset, set)
154#define pcie2_mask32(pcie2, offset, mask) bcma_mask32((pcie2)->core, offset, mask) 156#define pcie2_mask32(pcie2, offset, mask) bcma_mask32((pcie2)->core, offset, mask)
155 157
156void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2);
157
158#endif /* LINUX_BCMA_DRIVER_PCIE2_H_ */ 158#endif /* LINUX_BCMA_DRIVER_PCIE2_H_ */
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index dbfbf4990005..ea17cca9e685 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -172,12 +172,8 @@ extern unsigned int bitmap_ord_to_pos(const unsigned long *bitmap, unsigned int
172extern int bitmap_print_to_pagebuf(bool list, char *buf, 172extern int bitmap_print_to_pagebuf(bool list, char *buf,
173 const unsigned long *maskp, int nmaskbits); 173 const unsigned long *maskp, int nmaskbits);
174 174
175#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) % BITS_PER_LONG)) 175#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1)))
176#define BITMAP_LAST_WORD_MASK(nbits) \ 176#define BITMAP_LAST_WORD_MASK(nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1)))
177( \
178 ((nbits) % BITS_PER_LONG) ? \
179 (1UL<<((nbits) % BITS_PER_LONG))-1 : ~0UL \
180)
181 177
182#define small_const_nbits(nbits) \ 178#define small_const_nbits(nbits) \
183 (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG) 179 (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
@@ -287,16 +283,16 @@ static inline int bitmap_empty(const unsigned long *src, unsigned nbits)
287{ 283{
288 if (small_const_nbits(nbits)) 284 if (small_const_nbits(nbits))
289 return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); 285 return ! (*src & BITMAP_LAST_WORD_MASK(nbits));
290 else 286
291 return __bitmap_empty(src, nbits); 287 return find_first_bit(src, nbits) == nbits;
292} 288}
293 289
294static inline int bitmap_full(const unsigned long *src, unsigned int nbits) 290static inline int bitmap_full(const unsigned long *src, unsigned int nbits)
295{ 291{
296 if (small_const_nbits(nbits)) 292 if (small_const_nbits(nbits))
297 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); 293 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits));
298 else 294
299 return __bitmap_full(src, nbits); 295 return find_first_zero_bit(src, nbits) == nbits;
300} 296}
301 297
302static inline int bitmap_weight(const unsigned long *src, unsigned int nbits) 298static inline int bitmap_weight(const unsigned long *src, unsigned int nbits)
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 5d858e02997f..297f5bda4fdf 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -218,9 +218,9 @@ static inline unsigned long __ffs64(u64 word)
218/** 218/**
219 * find_last_bit - find the last set bit in a memory region 219 * find_last_bit - find the last set bit in a memory region
220 * @addr: The address to start the search at 220 * @addr: The address to start the search at
221 * @size: The maximum size to search 221 * @size: The number of bits to search
222 * 222 *
223 * Returns the bit number of the first set bit, or size. 223 * Returns the bit number of the last set bit, or size.
224 */ 224 */
225extern unsigned long find_last_bit(const unsigned long *addr, 225extern unsigned long find_last_bit(const unsigned long *addr,
226 unsigned long size); 226 unsigned long size);
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 7aec86127335..2056a99b92f8 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -13,7 +13,7 @@ struct blk_mq_cpu_notifier {
13}; 13};
14 14
15struct blk_mq_ctxmap { 15struct blk_mq_ctxmap {
16 unsigned int map_size; 16 unsigned int size;
17 unsigned int bits_per_word; 17 unsigned int bits_per_word;
18 struct blk_align_bitmap *map; 18 struct blk_align_bitmap *map;
19}; 19};
@@ -164,6 +164,8 @@ enum {
164 << BLK_MQ_F_ALLOC_POLICY_START_BIT) 164 << BLK_MQ_F_ALLOC_POLICY_START_BIT)
165 165
166struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *); 166struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *);
167struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
168 struct request_queue *q);
167void blk_mq_finish_init(struct request_queue *q); 169void blk_mq_finish_init(struct request_queue *q);
168int blk_mq_register_disk(struct gendisk *); 170int blk_mq_register_disk(struct gendisk *);
169void blk_mq_unregister_disk(struct gendisk *); 171void blk_mq_unregister_disk(struct gendisk *);
@@ -218,6 +220,7 @@ void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx);
218void blk_mq_stop_hw_queues(struct request_queue *q); 220void blk_mq_stop_hw_queues(struct request_queue *q);
219void blk_mq_start_hw_queues(struct request_queue *q); 221void blk_mq_start_hw_queues(struct request_queue *q);
220void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async); 222void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async);
223void blk_mq_run_hw_queues(struct request_queue *q, bool async);
221void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs); 224void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs);
222void blk_mq_tag_busy_iter(struct blk_mq_hw_ctx *hctx, busy_iter_fn *fn, 225void blk_mq_tag_busy_iter(struct blk_mq_hw_ctx *hctx, busy_iter_fn *fn,
223 void *priv); 226 void *priv);
@@ -227,7 +230,7 @@ void blk_mq_freeze_queue_start(struct request_queue *q);
227 230
228/* 231/*
229 * Driver command data is immediately after the request. So subtract request 232 * Driver command data is immediately after the request. So subtract request
230 * size to get back to the original request. 233 * size to get back to the original request, add request size to get the PDU.
231 */ 234 */
232static inline struct request *blk_mq_rq_from_pdu(void *pdu) 235static inline struct request *blk_mq_rq_from_pdu(void *pdu)
233{ 236{
@@ -235,7 +238,7 @@ static inline struct request *blk_mq_rq_from_pdu(void *pdu)
235} 238}
236static inline void *blk_mq_rq_to_pdu(struct request *rq) 239static inline void *blk_mq_rq_to_pdu(struct request *rq)
237{ 240{
238 return (void *) rq + sizeof(*rq); 241 return rq + 1;
239} 242}
240 243
241#define queue_for_each_hw_ctx(q, hctx, i) \ 244#define queue_for_each_hw_ctx(q, hctx, i) \
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index c294e3e25e37..a1b25e35ea5f 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -181,7 +181,9 @@ enum rq_flag_bits {
181 __REQ_ELVPRIV, /* elevator private data attached */ 181 __REQ_ELVPRIV, /* elevator private data attached */
182 __REQ_FAILED, /* set if the request failed */ 182 __REQ_FAILED, /* set if the request failed */
183 __REQ_QUIET, /* don't worry about errors */ 183 __REQ_QUIET, /* don't worry about errors */
184 __REQ_PREEMPT, /* set for "ide_preempt" requests */ 184 __REQ_PREEMPT, /* set for "ide_preempt" requests and also
185 for requests for which the SCSI "quiesce"
186 state must be ignored. */
185 __REQ_ALLOCED, /* request came from our alloc pool */ 187 __REQ_ALLOCED, /* request came from our alloc pool */
186 __REQ_COPY_USER, /* contains copies of user pages */ 188 __REQ_COPY_USER, /* contains copies of user pages */
187 __REQ_FLUSH_SEQ, /* request for flush sequence */ 189 __REQ_FLUSH_SEQ, /* request for flush sequence */
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index bbfceb756452..d5cda067115a 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -32,23 +32,19 @@ struct bpf_map {
32 u32 key_size; 32 u32 key_size;
33 u32 value_size; 33 u32 value_size;
34 u32 max_entries; 34 u32 max_entries;
35 struct bpf_map_ops *ops; 35 const struct bpf_map_ops *ops;
36 struct work_struct work; 36 struct work_struct work;
37}; 37};
38 38
39struct bpf_map_type_list { 39struct bpf_map_type_list {
40 struct list_head list_node; 40 struct list_head list_node;
41 struct bpf_map_ops *ops; 41 const struct bpf_map_ops *ops;
42 enum bpf_map_type type; 42 enum bpf_map_type type;
43}; 43};
44 44
45void bpf_register_map_type(struct bpf_map_type_list *tl);
46void bpf_map_put(struct bpf_map *map);
47struct bpf_map *bpf_map_get(struct fd f);
48
49/* function argument constraints */ 45/* function argument constraints */
50enum bpf_arg_type { 46enum bpf_arg_type {
51 ARG_ANYTHING = 0, /* any argument is ok */ 47 ARG_DONTCARE = 0, /* unused argument in helper function */
52 48
53 /* the following constraints used to prototype 49 /* the following constraints used to prototype
54 * bpf_map_lookup/update/delete_elem() functions 50 * bpf_map_lookup/update/delete_elem() functions
@@ -62,6 +58,9 @@ enum bpf_arg_type {
62 */ 58 */
63 ARG_PTR_TO_STACK, /* any pointer to eBPF program stack */ 59 ARG_PTR_TO_STACK, /* any pointer to eBPF program stack */
64 ARG_CONST_STACK_SIZE, /* number of bytes accessed from stack */ 60 ARG_CONST_STACK_SIZE, /* number of bytes accessed from stack */
61
62 ARG_PTR_TO_CTX, /* pointer to context */
63 ARG_ANYTHING, /* any (initialized) argument is ok */
65}; 64};
66 65
67/* type of values returned from helper functions */ 66/* type of values returned from helper functions */
@@ -105,41 +104,61 @@ struct bpf_verifier_ops {
105 * with 'type' (read or write) is allowed 104 * with 'type' (read or write) is allowed
106 */ 105 */
107 bool (*is_valid_access)(int off, int size, enum bpf_access_type type); 106 bool (*is_valid_access)(int off, int size, enum bpf_access_type type);
107
108 u32 (*convert_ctx_access)(int dst_reg, int src_reg, int ctx_off,
109 struct bpf_insn *insn);
108}; 110};
109 111
110struct bpf_prog_type_list { 112struct bpf_prog_type_list {
111 struct list_head list_node; 113 struct list_head list_node;
112 struct bpf_verifier_ops *ops; 114 const struct bpf_verifier_ops *ops;
113 enum bpf_prog_type type; 115 enum bpf_prog_type type;
114}; 116};
115 117
116void bpf_register_prog_type(struct bpf_prog_type_list *tl);
117
118struct bpf_prog; 118struct bpf_prog;
119 119
120struct bpf_prog_aux { 120struct bpf_prog_aux {
121 atomic_t refcnt; 121 atomic_t refcnt;
122 bool is_gpl_compatible;
123 enum bpf_prog_type prog_type;
124 struct bpf_verifier_ops *ops;
125 struct bpf_map **used_maps;
126 u32 used_map_cnt; 122 u32 used_map_cnt;
123 const struct bpf_verifier_ops *ops;
124 struct bpf_map **used_maps;
127 struct bpf_prog *prog; 125 struct bpf_prog *prog;
128 struct work_struct work; 126 struct work_struct work;
129}; 127};
130 128
131#ifdef CONFIG_BPF_SYSCALL 129#ifdef CONFIG_BPF_SYSCALL
132void bpf_prog_put(struct bpf_prog *prog); 130void bpf_register_prog_type(struct bpf_prog_type_list *tl);
133#else 131void bpf_register_map_type(struct bpf_map_type_list *tl);
134static inline void bpf_prog_put(struct bpf_prog *prog) {} 132
135#endif
136struct bpf_prog *bpf_prog_get(u32 ufd); 133struct bpf_prog *bpf_prog_get(u32 ufd);
134void bpf_prog_put(struct bpf_prog *prog);
135
136struct bpf_map *bpf_map_get(struct fd f);
137void bpf_map_put(struct bpf_map *map);
138
137/* verify correctness of eBPF program */ 139/* verify correctness of eBPF program */
138int bpf_check(struct bpf_prog *fp, union bpf_attr *attr); 140int bpf_check(struct bpf_prog **fp, union bpf_attr *attr);
141#else
142static inline void bpf_register_prog_type(struct bpf_prog_type_list *tl)
143{
144}
145
146static inline struct bpf_prog *bpf_prog_get(u32 ufd)
147{
148 return ERR_PTR(-EOPNOTSUPP);
149}
150
151static inline void bpf_prog_put(struct bpf_prog *prog)
152{
153}
154#endif /* CONFIG_BPF_SYSCALL */
139 155
140/* verifier prototypes for helper functions called from eBPF programs */ 156/* verifier prototypes for helper functions called from eBPF programs */
141extern struct bpf_func_proto bpf_map_lookup_elem_proto; 157extern const struct bpf_func_proto bpf_map_lookup_elem_proto;
142extern struct bpf_func_proto bpf_map_update_elem_proto; 158extern const struct bpf_func_proto bpf_map_update_elem_proto;
143extern struct bpf_func_proto bpf_map_delete_elem_proto; 159extern const struct bpf_func_proto bpf_map_delete_elem_proto;
160
161extern const struct bpf_func_proto bpf_get_prandom_u32_proto;
162extern const struct bpf_func_proto bpf_get_smp_processor_id_proto;
144 163
145#endif /* _LINUX_BPF_H */ 164#endif /* _LINUX_BPF_H */
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 7ccd928cc1f2..ae2982c0f7a6 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -11,6 +11,7 @@
11#define PHY_ID_BCM5421 0x002060e0 11#define PHY_ID_BCM5421 0x002060e0
12#define PHY_ID_BCM5464 0x002060b0 12#define PHY_ID_BCM5464 0x002060b0
13#define PHY_ID_BCM5461 0x002060c0 13#define PHY_ID_BCM5461 0x002060c0
14#define PHY_ID_BCM54616S 0x03625d10
14#define PHY_ID_BCM57780 0x03625d90 15#define PHY_ID_BCM57780 0x03625d90
15 16
16#define PHY_ID_BCM7250 0xae025280 17#define PHY_ID_BCM7250 0xae025280
@@ -19,6 +20,7 @@
19#define PHY_ID_BCM7425 0x03625e60 20#define PHY_ID_BCM7425 0x03625e60
20#define PHY_ID_BCM7429 0x600d8730 21#define PHY_ID_BCM7429 0x600d8730
21#define PHY_ID_BCM7439 0x600d8480 22#define PHY_ID_BCM7439 0x600d8480
23#define PHY_ID_BCM7439_2 0xae025080
22#define PHY_ID_BCM7445 0x600d8510 24#define PHY_ID_BCM7445 0x600d8510
23 25
24#define PHY_BCM_OUI_MASK 0xfffffc00 26#define PHY_BCM_OUI_MASK 0xfffffc00
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index c05ff0f9f9a5..c3a9c8fc60fa 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -61,6 +61,8 @@ struct can_priv {
61 char tx_led_trig_name[CAN_LED_NAME_SZ]; 61 char tx_led_trig_name[CAN_LED_NAME_SZ];
62 struct led_trigger *rx_led_trig; 62 struct led_trigger *rx_led_trig;
63 char rx_led_trig_name[CAN_LED_NAME_SZ]; 63 char rx_led_trig_name[CAN_LED_NAME_SZ];
64 struct led_trigger *rxtx_led_trig;
65 char rxtx_led_trig_name[CAN_LED_NAME_SZ];
64#endif 66#endif
65}; 67};
66 68
diff --git a/include/linux/can/led.h b/include/linux/can/led.h
index e0475c5cbb92..146de4506d21 100644
--- a/include/linux/can/led.h
+++ b/include/linux/can/led.h
@@ -21,8 +21,10 @@ enum can_led_event {
21 21
22#ifdef CONFIG_CAN_LEDS 22#ifdef CONFIG_CAN_LEDS
23 23
24/* keep space for interface name + "-tx"/"-rx" suffix and null terminator */ 24/* keep space for interface name + "-tx"/"-rx"/"-rxtx"
25#define CAN_LED_NAME_SZ (IFNAMSIZ + 4) 25 * suffix and null terminator
26 */
27#define CAN_LED_NAME_SZ (IFNAMSIZ + 6)
26 28
27void can_led_event(struct net_device *netdev, enum can_led_event event); 29void can_led_event(struct net_device *netdev, enum can_led_event event);
28void devm_can_led_init(struct net_device *netdev); 30void devm_can_led_init(struct net_device *netdev);
diff --git a/include/linux/can/skb.h b/include/linux/can/skb.h
index cc00d15c6107..b6a52a4b457a 100644
--- a/include/linux/can/skb.h
+++ b/include/linux/can/skb.h
@@ -44,16 +44,11 @@ static inline void can_skb_reserve(struct sk_buff *skb)
44 skb_reserve(skb, sizeof(struct can_skb_priv)); 44 skb_reserve(skb, sizeof(struct can_skb_priv));
45} 45}
46 46
47static inline void can_skb_destructor(struct sk_buff *skb)
48{
49 sock_put(skb->sk);
50}
51
52static inline void can_skb_set_owner(struct sk_buff *skb, struct sock *sk) 47static inline void can_skb_set_owner(struct sk_buff *skb, struct sock *sk)
53{ 48{
54 if (sk) { 49 if (sk) {
55 sock_hold(sk); 50 sock_hold(sk);
56 skb->destructor = can_skb_destructor; 51 skb->destructor = sock_efree;
57 skb->sk = sk; 52 skb->sk = sk;
58 } 53 }
59} 54}
diff --git a/include/linux/capability.h b/include/linux/capability.h
index aa93e5ef594c..af9f0b9e80e6 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -205,6 +205,7 @@ static inline kernel_cap_t cap_raise_nfsd_set(const kernel_cap_t a,
205 cap_intersect(permitted, __cap_nfsd_set)); 205 cap_intersect(permitted, __cap_nfsd_set));
206} 206}
207 207
208#ifdef CONFIG_MULTIUSER
208extern bool has_capability(struct task_struct *t, int cap); 209extern bool has_capability(struct task_struct *t, int cap);
209extern bool has_ns_capability(struct task_struct *t, 210extern bool has_ns_capability(struct task_struct *t,
210 struct user_namespace *ns, int cap); 211 struct user_namespace *ns, int cap);
@@ -213,6 +214,34 @@ extern bool has_ns_capability_noaudit(struct task_struct *t,
213 struct user_namespace *ns, int cap); 214 struct user_namespace *ns, int cap);
214extern bool capable(int cap); 215extern bool capable(int cap);
215extern bool ns_capable(struct user_namespace *ns, int cap); 216extern bool ns_capable(struct user_namespace *ns, int cap);
217#else
218static inline bool has_capability(struct task_struct *t, int cap)
219{
220 return true;
221}
222static inline bool has_ns_capability(struct task_struct *t,
223 struct user_namespace *ns, int cap)
224{
225 return true;
226}
227static inline bool has_capability_noaudit(struct task_struct *t, int cap)
228{
229 return true;
230}
231static inline bool has_ns_capability_noaudit(struct task_struct *t,
232 struct user_namespace *ns, int cap)
233{
234 return true;
235}
236static inline bool capable(int cap)
237{
238 return true;
239}
240static inline bool ns_capable(struct user_namespace *ns, int cap)
241{
242 return true;
243}
244#endif /* CONFIG_MULTIUSER */
216extern bool capable_wrt_inode_uidgid(const struct inode *inode, int cap); 245extern bool capable_wrt_inode_uidgid(const struct inode *inode, int cap);
217extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap); 246extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap);
218 247
diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h
index 4ce9056b31a8..bda5ec0b4b4d 100644
--- a/include/linux/cleancache.h
+++ b/include/linux/cleancache.h
@@ -5,6 +5,10 @@
5#include <linux/exportfs.h> 5#include <linux/exportfs.h>
6#include <linux/mm.h> 6#include <linux/mm.h>
7 7
8#define CLEANCACHE_NO_POOL -1
9#define CLEANCACHE_NO_BACKEND -2
10#define CLEANCACHE_NO_BACKEND_SHARED -3
11
8#define CLEANCACHE_KEY_MAX 6 12#define CLEANCACHE_KEY_MAX 6
9 13
10/* 14/*
@@ -33,10 +37,9 @@ struct cleancache_ops {
33 void (*invalidate_fs)(int); 37 void (*invalidate_fs)(int);
34}; 38};
35 39
36extern struct cleancache_ops * 40extern int cleancache_register_ops(struct cleancache_ops *ops);
37 cleancache_register_ops(struct cleancache_ops *ops);
38extern void __cleancache_init_fs(struct super_block *); 41extern void __cleancache_init_fs(struct super_block *);
39extern void __cleancache_init_shared_fs(char *, struct super_block *); 42extern void __cleancache_init_shared_fs(struct super_block *);
40extern int __cleancache_get_page(struct page *); 43extern int __cleancache_get_page(struct page *);
41extern void __cleancache_put_page(struct page *); 44extern void __cleancache_put_page(struct page *);
42extern void __cleancache_invalidate_page(struct address_space *, struct page *); 45extern void __cleancache_invalidate_page(struct address_space *, struct page *);
@@ -78,10 +81,10 @@ static inline void cleancache_init_fs(struct super_block *sb)
78 __cleancache_init_fs(sb); 81 __cleancache_init_fs(sb);
79} 82}
80 83
81static inline void cleancache_init_shared_fs(char *uuid, struct super_block *sb) 84static inline void cleancache_init_shared_fs(struct super_block *sb)
82{ 85{
83 if (cleancache_enabled) 86 if (cleancache_enabled)
84 __cleancache_init_shared_fs(uuid, sb); 87 __cleancache_init_shared_fs(sb);
85} 88}
86 89
87static inline int cleancache_get_page(struct page *page) 90static inline int cleancache_get_page(struct page *page)
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 2e4cb67f6e56..96c280b2c263 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -8,33 +8,19 @@
8#ifndef _LINUX_CLOCKCHIPS_H 8#ifndef _LINUX_CLOCKCHIPS_H
9#define _LINUX_CLOCKCHIPS_H 9#define _LINUX_CLOCKCHIPS_H
10 10
11/* Clock event notification values */ 11#ifdef CONFIG_GENERIC_CLOCKEVENTS
12enum clock_event_nofitiers {
13 CLOCK_EVT_NOTIFY_ADD,
14 CLOCK_EVT_NOTIFY_BROADCAST_ON,
15 CLOCK_EVT_NOTIFY_BROADCAST_OFF,
16 CLOCK_EVT_NOTIFY_BROADCAST_FORCE,
17 CLOCK_EVT_NOTIFY_BROADCAST_ENTER,
18 CLOCK_EVT_NOTIFY_BROADCAST_EXIT,
19 CLOCK_EVT_NOTIFY_SUSPEND,
20 CLOCK_EVT_NOTIFY_RESUME,
21 CLOCK_EVT_NOTIFY_CPU_DYING,
22 CLOCK_EVT_NOTIFY_CPU_DEAD,
23};
24
25#ifdef CONFIG_GENERIC_CLOCKEVENTS_BUILD
26 12
27#include <linux/clocksource.h> 13# include <linux/clocksource.h>
28#include <linux/cpumask.h> 14# include <linux/cpumask.h>
29#include <linux/ktime.h> 15# include <linux/ktime.h>
30#include <linux/notifier.h> 16# include <linux/notifier.h>
31 17
32struct clock_event_device; 18struct clock_event_device;
33struct module; 19struct module;
34 20
35/* Clock event mode commands */ 21/* Clock event mode commands for legacy ->set_mode(): OBSOLETE */
36enum clock_event_mode { 22enum clock_event_mode {
37 CLOCK_EVT_MODE_UNUSED = 0, 23 CLOCK_EVT_MODE_UNUSED,
38 CLOCK_EVT_MODE_SHUTDOWN, 24 CLOCK_EVT_MODE_SHUTDOWN,
39 CLOCK_EVT_MODE_PERIODIC, 25 CLOCK_EVT_MODE_PERIODIC,
40 CLOCK_EVT_MODE_ONESHOT, 26 CLOCK_EVT_MODE_ONESHOT,
@@ -42,30 +28,49 @@ enum clock_event_mode {
42}; 28};
43 29
44/* 30/*
31 * Possible states of a clock event device.
32 *
33 * DETACHED: Device is not used by clockevents core. Initial state or can be
34 * reached from SHUTDOWN.
35 * SHUTDOWN: Device is powered-off. Can be reached from PERIODIC or ONESHOT.
36 * PERIODIC: Device is programmed to generate events periodically. Can be
37 * reached from DETACHED or SHUTDOWN.
38 * ONESHOT: Device is programmed to generate event only once. Can be reached
39 * from DETACHED or SHUTDOWN.
40 */
41enum clock_event_state {
42 CLOCK_EVT_STATE_DETACHED,
43 CLOCK_EVT_STATE_SHUTDOWN,
44 CLOCK_EVT_STATE_PERIODIC,
45 CLOCK_EVT_STATE_ONESHOT,
46};
47
48/*
45 * Clock event features 49 * Clock event features
46 */ 50 */
47#define CLOCK_EVT_FEAT_PERIODIC 0x000001 51# define CLOCK_EVT_FEAT_PERIODIC 0x000001
48#define CLOCK_EVT_FEAT_ONESHOT 0x000002 52# define CLOCK_EVT_FEAT_ONESHOT 0x000002
49#define CLOCK_EVT_FEAT_KTIME 0x000004 53# define CLOCK_EVT_FEAT_KTIME 0x000004
54
50/* 55/*
51 * x86(64) specific misfeatures: 56 * x86(64) specific (mis)features:
52 * 57 *
53 * - Clockevent source stops in C3 State and needs broadcast support. 58 * - Clockevent source stops in C3 State and needs broadcast support.
54 * - Local APIC timer is used as a dummy device. 59 * - Local APIC timer is used as a dummy device.
55 */ 60 */
56#define CLOCK_EVT_FEAT_C3STOP 0x000008 61# define CLOCK_EVT_FEAT_C3STOP 0x000008
57#define CLOCK_EVT_FEAT_DUMMY 0x000010 62# define CLOCK_EVT_FEAT_DUMMY 0x000010
58 63
59/* 64/*
60 * Core shall set the interrupt affinity dynamically in broadcast mode 65 * Core shall set the interrupt affinity dynamically in broadcast mode
61 */ 66 */
62#define CLOCK_EVT_FEAT_DYNIRQ 0x000020 67# define CLOCK_EVT_FEAT_DYNIRQ 0x000020
63#define CLOCK_EVT_FEAT_PERCPU 0x000040 68# define CLOCK_EVT_FEAT_PERCPU 0x000040
64 69
65/* 70/*
66 * Clockevent device is based on a hrtimer for broadcast 71 * Clockevent device is based on a hrtimer for broadcast
67 */ 72 */
68#define CLOCK_EVT_FEAT_HRTIMER 0x000080 73# define CLOCK_EVT_FEAT_HRTIMER 0x000080
69 74
70/** 75/**
71 * struct clock_event_device - clock event device descriptor 76 * struct clock_event_device - clock event device descriptor
@@ -78,10 +83,15 @@ enum clock_event_mode {
78 * @min_delta_ns: minimum delta value in ns 83 * @min_delta_ns: minimum delta value in ns
79 * @mult: nanosecond to cycles multiplier 84 * @mult: nanosecond to cycles multiplier
80 * @shift: nanoseconds to cycles divisor (power of two) 85 * @shift: nanoseconds to cycles divisor (power of two)
81 * @mode: operating mode assigned by the management code 86 * @mode: operating mode, relevant only to ->set_mode(), OBSOLETE
87 * @state: current state of the device, assigned by the core code
82 * @features: features 88 * @features: features
83 * @retries: number of forced programming retries 89 * @retries: number of forced programming retries
84 * @set_mode: set mode function 90 * @set_mode: legacy set mode function, only for modes <= CLOCK_EVT_MODE_RESUME.
91 * @set_state_periodic: switch state to periodic, if !set_mode
92 * @set_state_oneshot: switch state to oneshot, if !set_mode
93 * @set_state_shutdown: switch state to shutdown, if !set_mode
94 * @tick_resume: resume clkevt device, if !set_mode
85 * @broadcast: function to broadcast events 95 * @broadcast: function to broadcast events
86 * @min_delta_ticks: minimum delta value in ticks stored for reconfiguration 96 * @min_delta_ticks: minimum delta value in ticks stored for reconfiguration
87 * @max_delta_ticks: maximum delta value in ticks stored for reconfiguration 97 * @max_delta_ticks: maximum delta value in ticks stored for reconfiguration
@@ -95,22 +105,31 @@ enum clock_event_mode {
95 */ 105 */
96struct clock_event_device { 106struct clock_event_device {
97 void (*event_handler)(struct clock_event_device *); 107 void (*event_handler)(struct clock_event_device *);
98 int (*set_next_event)(unsigned long evt, 108 int (*set_next_event)(unsigned long evt, struct clock_event_device *);
99 struct clock_event_device *); 109 int (*set_next_ktime)(ktime_t expires, struct clock_event_device *);
100 int (*set_next_ktime)(ktime_t expires,
101 struct clock_event_device *);
102 ktime_t next_event; 110 ktime_t next_event;
103 u64 max_delta_ns; 111 u64 max_delta_ns;
104 u64 min_delta_ns; 112 u64 min_delta_ns;
105 u32 mult; 113 u32 mult;
106 u32 shift; 114 u32 shift;
107 enum clock_event_mode mode; 115 enum clock_event_mode mode;
116 enum clock_event_state state;
108 unsigned int features; 117 unsigned int features;
109 unsigned long retries; 118 unsigned long retries;
110 119
120 /*
121 * State transition callback(s): Only one of the two groups should be
122 * defined:
123 * - set_mode(), only for modes <= CLOCK_EVT_MODE_RESUME.
124 * - set_state_{shutdown|periodic|oneshot}(), tick_resume().
125 */
126 void (*set_mode)(enum clock_event_mode mode, struct clock_event_device *);
127 int (*set_state_periodic)(struct clock_event_device *);
128 int (*set_state_oneshot)(struct clock_event_device *);
129 int (*set_state_shutdown)(struct clock_event_device *);
130 int (*tick_resume)(struct clock_event_device *);
131
111 void (*broadcast)(const struct cpumask *mask); 132 void (*broadcast)(const struct cpumask *mask);
112 void (*set_mode)(enum clock_event_mode mode,
113 struct clock_event_device *);
114 void (*suspend)(struct clock_event_device *); 133 void (*suspend)(struct clock_event_device *);
115 void (*resume)(struct clock_event_device *); 134 void (*resume)(struct clock_event_device *);
116 unsigned long min_delta_ticks; 135 unsigned long min_delta_ticks;
@@ -136,18 +155,18 @@ struct clock_event_device {
136 * 155 *
137 * factor = (clock_ticks << shift) / nanoseconds 156 * factor = (clock_ticks << shift) / nanoseconds
138 */ 157 */
139static inline unsigned long div_sc(unsigned long ticks, unsigned long nsec, 158static inline unsigned long
140 int shift) 159div_sc(unsigned long ticks, unsigned long nsec, int shift)
141{ 160{
142 uint64_t tmp = ((uint64_t)ticks) << shift; 161 u64 tmp = ((u64)ticks) << shift;
143 162
144 do_div(tmp, nsec); 163 do_div(tmp, nsec);
164
145 return (unsigned long) tmp; 165 return (unsigned long) tmp;
146} 166}
147 167
148/* Clock event layer functions */ 168/* Clock event layer functions */
149extern u64 clockevent_delta2ns(unsigned long latch, 169extern u64 clockevent_delta2ns(unsigned long latch, struct clock_event_device *evt);
150 struct clock_event_device *evt);
151extern void clockevents_register_device(struct clock_event_device *dev); 170extern void clockevents_register_device(struct clock_event_device *dev);
152extern int clockevents_unbind_device(struct clock_event_device *ced, int cpu); 171extern int clockevents_unbind_device(struct clock_event_device *ced, int cpu);
153 172
@@ -158,57 +177,42 @@ extern void clockevents_config_and_register(struct clock_event_device *dev,
158 177
159extern int clockevents_update_freq(struct clock_event_device *ce, u32 freq); 178extern int clockevents_update_freq(struct clock_event_device *ce, u32 freq);
160 179
161extern void clockevents_exchange_device(struct clock_event_device *old,
162 struct clock_event_device *new);
163extern void clockevents_set_mode(struct clock_event_device *dev,
164 enum clock_event_mode mode);
165extern int clockevents_program_event(struct clock_event_device *dev,
166 ktime_t expires, bool force);
167
168extern void clockevents_handle_noop(struct clock_event_device *dev);
169
170static inline void 180static inline void
171clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 minsec) 181clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 minsec)
172{ 182{
173 return clocks_calc_mult_shift(&ce->mult, &ce->shift, NSEC_PER_SEC, 183 return clocks_calc_mult_shift(&ce->mult, &ce->shift, NSEC_PER_SEC, freq, minsec);
174 freq, minsec);
175} 184}
176 185
177extern void clockevents_suspend(void); 186extern void clockevents_suspend(void);
178extern void clockevents_resume(void); 187extern void clockevents_resume(void);
179 188
180#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST 189# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
181#ifdef CONFIG_ARCH_HAS_TICK_BROADCAST 190# ifdef CONFIG_ARCH_HAS_TICK_BROADCAST
182extern void tick_broadcast(const struct cpumask *mask); 191extern void tick_broadcast(const struct cpumask *mask);
183#else 192# else
184#define tick_broadcast NULL 193# define tick_broadcast NULL
185#endif 194# endif
186extern int tick_receive_broadcast(void); 195extern int tick_receive_broadcast(void);
187#endif 196# endif
188 197
189#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT) 198# if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT)
190extern void tick_setup_hrtimer_broadcast(void); 199extern void tick_setup_hrtimer_broadcast(void);
191extern int tick_check_broadcast_expired(void); 200extern int tick_check_broadcast_expired(void);
192#else 201# else
193static inline int tick_check_broadcast_expired(void) { return 0; } 202static inline int tick_check_broadcast_expired(void) { return 0; }
194static inline void tick_setup_hrtimer_broadcast(void) {}; 203static inline void tick_setup_hrtimer_broadcast(void) { }
195#endif 204# endif
196 205
197#ifdef CONFIG_GENERIC_CLOCKEVENTS
198extern int clockevents_notify(unsigned long reason, void *arg); 206extern int clockevents_notify(unsigned long reason, void *arg);
199#else
200static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; }
201#endif
202
203#else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */
204 207
205static inline void clockevents_suspend(void) {} 208#else /* !CONFIG_GENERIC_CLOCKEVENTS: */
206static inline void clockevents_resume(void) {}
207 209
210static inline void clockevents_suspend(void) { }
211static inline void clockevents_resume(void) { }
208static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; } 212static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; }
209static inline int tick_check_broadcast_expired(void) { return 0; } 213static inline int tick_check_broadcast_expired(void) { return 0; }
210static inline void tick_setup_hrtimer_broadcast(void) {}; 214static inline void tick_setup_hrtimer_broadcast(void) { }
211 215
212#endif 216#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
213 217
214#endif 218#endif /* _LINUX_CLOCKCHIPS_H */
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 9c78d15d33e4..135509821c39 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -56,6 +56,7 @@ struct module;
56 * @shift: cycle to nanosecond divisor (power of two) 56 * @shift: cycle to nanosecond divisor (power of two)
57 * @max_idle_ns: max idle time permitted by the clocksource (nsecs) 57 * @max_idle_ns: max idle time permitted by the clocksource (nsecs)
58 * @maxadj: maximum adjustment value to mult (~11%) 58 * @maxadj: maximum adjustment value to mult (~11%)
59 * @max_cycles: maximum safe cycle value which won't overflow on multiplication
59 * @flags: flags describing special properties 60 * @flags: flags describing special properties
60 * @archdata: arch-specific data 61 * @archdata: arch-specific data
61 * @suspend: suspend function for the clocksource, if necessary 62 * @suspend: suspend function for the clocksource, if necessary
@@ -76,7 +77,7 @@ struct clocksource {
76#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA 77#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA
77 struct arch_clocksource_data archdata; 78 struct arch_clocksource_data archdata;
78#endif 79#endif
79 80 u64 max_cycles;
80 const char *name; 81 const char *name;
81 struct list_head list; 82 struct list_head list;
82 int rating; 83 int rating;
@@ -178,7 +179,6 @@ static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 mult, u32 shift)
178} 179}
179 180
180 181
181extern int clocksource_register(struct clocksource*);
182extern int clocksource_unregister(struct clocksource*); 182extern int clocksource_unregister(struct clocksource*);
183extern void clocksource_touch_watchdog(void); 183extern void clocksource_touch_watchdog(void);
184extern struct clocksource* clocksource_get_next(void); 184extern struct clocksource* clocksource_get_next(void);
@@ -189,7 +189,7 @@ extern struct clocksource * __init clocksource_default_clock(void);
189extern void clocksource_mark_unstable(struct clocksource *cs); 189extern void clocksource_mark_unstable(struct clocksource *cs);
190 190
191extern u64 191extern u64
192clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask); 192clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask, u64 *max_cycles);
193extern void 193extern void
194clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec); 194clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec);
195 195
@@ -200,7 +200,16 @@ clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec);
200extern int 200extern int
201__clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq); 201__clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq);
202extern void 202extern void
203__clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq); 203__clocksource_update_freq_scale(struct clocksource *cs, u32 scale, u32 freq);
204
205/*
206 * Don't call this unless you are a default clocksource
207 * (AKA: jiffies) and absolutely have to.
208 */
209static inline int __clocksource_register(struct clocksource *cs)
210{
211 return __clocksource_register_scale(cs, 1, 0);
212}
204 213
205static inline int clocksource_register_hz(struct clocksource *cs, u32 hz) 214static inline int clocksource_register_hz(struct clocksource *cs, u32 hz)
206{ 215{
@@ -212,14 +221,14 @@ static inline int clocksource_register_khz(struct clocksource *cs, u32 khz)
212 return __clocksource_register_scale(cs, 1000, khz); 221 return __clocksource_register_scale(cs, 1000, khz);
213} 222}
214 223
215static inline void __clocksource_updatefreq_hz(struct clocksource *cs, u32 hz) 224static inline void __clocksource_update_freq_hz(struct clocksource *cs, u32 hz)
216{ 225{
217 __clocksource_updatefreq_scale(cs, 1, hz); 226 __clocksource_update_freq_scale(cs, 1, hz);
218} 227}
219 228
220static inline void __clocksource_updatefreq_khz(struct clocksource *cs, u32 khz) 229static inline void __clocksource_update_freq_khz(struct clocksource *cs, u32 khz)
221{ 230{
222 __clocksource_updatefreq_scale(cs, 1000, khz); 231 __clocksource_update_freq_scale(cs, 1000, khz);
223} 232}
224 233
225 234
diff --git a/include/linux/cma.h b/include/linux/cma.h
index 9384ba66e975..f7ef093ec49a 100644
--- a/include/linux/cma.h
+++ b/include/linux/cma.h
@@ -16,16 +16,16 @@
16struct cma; 16struct cma;
17 17
18extern unsigned long totalcma_pages; 18extern unsigned long totalcma_pages;
19extern phys_addr_t cma_get_base(struct cma *cma); 19extern phys_addr_t cma_get_base(const struct cma *cma);
20extern unsigned long cma_get_size(struct cma *cma); 20extern unsigned long cma_get_size(const struct cma *cma);
21 21
22extern int __init cma_declare_contiguous(phys_addr_t base, 22extern int __init cma_declare_contiguous(phys_addr_t base,
23 phys_addr_t size, phys_addr_t limit, 23 phys_addr_t size, phys_addr_t limit,
24 phys_addr_t alignment, unsigned int order_per_bit, 24 phys_addr_t alignment, unsigned int order_per_bit,
25 bool fixed, struct cma **res_cma); 25 bool fixed, struct cma **res_cma);
26extern int cma_init_reserved_mem(phys_addr_t base, 26extern int cma_init_reserved_mem(phys_addr_t base, phys_addr_t size,
27 phys_addr_t size, int order_per_bit, 27 unsigned int order_per_bit,
28 struct cma **res_cma); 28 struct cma **res_cma);
29extern struct page *cma_alloc(struct cma *cma, int count, unsigned int align); 29extern struct page *cma_alloc(struct cma *cma, unsigned int count, unsigned int align);
30extern bool cma_release(struct cma *cma, struct page *pages, int count); 30extern bool cma_release(struct cma *cma, const struct page *pages, unsigned int count);
31#endif 31#endif
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index a014559e4a49..aa8f61cf3a19 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -34,6 +34,7 @@ extern int sysctl_compaction_handler(struct ctl_table *table, int write,
34extern int sysctl_extfrag_threshold; 34extern int sysctl_extfrag_threshold;
35extern int sysctl_extfrag_handler(struct ctl_table *table, int write, 35extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
36 void __user *buffer, size_t *length, loff_t *ppos); 36 void __user *buffer, size_t *length, loff_t *ppos);
37extern int sysctl_compact_unevictable_allowed;
37 38
38extern int fragmentation_index(struct zone *zone, unsigned int order); 39extern int fragmentation_index(struct zone *zone, unsigned int order);
39extern unsigned long try_to_compact_pages(gfp_t gfp_mask, unsigned int order, 40extern unsigned long try_to_compact_pages(gfp_t gfp_mask, unsigned int order,
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 1b45e4a0519b..0e41ca0e5927 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -192,29 +192,16 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
192 192
193#include <uapi/linux/types.h> 193#include <uapi/linux/types.h>
194 194
195static __always_inline void data_access_exceeds_word_size(void)
196#ifdef __compiletime_warning
197__compiletime_warning("data access exceeds word size and won't be atomic")
198#endif
199;
200
201static __always_inline void data_access_exceeds_word_size(void)
202{
203}
204
205static __always_inline void __read_once_size(const volatile void *p, void *res, int size) 195static __always_inline void __read_once_size(const volatile void *p, void *res, int size)
206{ 196{
207 switch (size) { 197 switch (size) {
208 case 1: *(__u8 *)res = *(volatile __u8 *)p; break; 198 case 1: *(__u8 *)res = *(volatile __u8 *)p; break;
209 case 2: *(__u16 *)res = *(volatile __u16 *)p; break; 199 case 2: *(__u16 *)res = *(volatile __u16 *)p; break;
210 case 4: *(__u32 *)res = *(volatile __u32 *)p; break; 200 case 4: *(__u32 *)res = *(volatile __u32 *)p; break;
211#ifdef CONFIG_64BIT
212 case 8: *(__u64 *)res = *(volatile __u64 *)p; break; 201 case 8: *(__u64 *)res = *(volatile __u64 *)p; break;
213#endif
214 default: 202 default:
215 barrier(); 203 barrier();
216 __builtin_memcpy((void *)res, (const void *)p, size); 204 __builtin_memcpy((void *)res, (const void *)p, size);
217 data_access_exceeds_word_size();
218 barrier(); 205 barrier();
219 } 206 }
220} 207}
@@ -225,13 +212,10 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
225 case 1: *(volatile __u8 *)p = *(__u8 *)res; break; 212 case 1: *(volatile __u8 *)p = *(__u8 *)res; break;
226 case 2: *(volatile __u16 *)p = *(__u16 *)res; break; 213 case 2: *(volatile __u16 *)p = *(__u16 *)res; break;
227 case 4: *(volatile __u32 *)p = *(__u32 *)res; break; 214 case 4: *(volatile __u32 *)p = *(__u32 *)res; break;
228#ifdef CONFIG_64BIT
229 case 8: *(volatile __u64 *)p = *(__u64 *)res; break; 215 case 8: *(volatile __u64 *)p = *(__u64 *)res; break;
230#endif
231 default: 216 default:
232 barrier(); 217 barrier();
233 __builtin_memcpy((void *)p, (const void *)res, size); 218 __builtin_memcpy((void *)p, (const void *)res, size);
234 data_access_exceeds_word_size();
235 barrier(); 219 barrier();
236 } 220 }
237} 221}
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index 37b81bd51ec0..2821838256b4 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -10,6 +10,8 @@
10#ifdef CONFIG_CONTEXT_TRACKING 10#ifdef CONFIG_CONTEXT_TRACKING
11extern void context_tracking_cpu_set(int cpu); 11extern void context_tracking_cpu_set(int cpu);
12 12
13extern void context_tracking_enter(enum ctx_state state);
14extern void context_tracking_exit(enum ctx_state state);
13extern void context_tracking_user_enter(void); 15extern void context_tracking_user_enter(void);
14extern void context_tracking_user_exit(void); 16extern void context_tracking_user_exit(void);
15extern void __context_tracking_task_switch(struct task_struct *prev, 17extern void __context_tracking_task_switch(struct task_struct *prev,
@@ -35,7 +37,8 @@ static inline enum ctx_state exception_enter(void)
35 return 0; 37 return 0;
36 38
37 prev_ctx = this_cpu_read(context_tracking.state); 39 prev_ctx = this_cpu_read(context_tracking.state);
38 context_tracking_user_exit(); 40 if (prev_ctx != CONTEXT_KERNEL)
41 context_tracking_exit(prev_ctx);
39 42
40 return prev_ctx; 43 return prev_ctx;
41} 44}
@@ -43,8 +46,8 @@ static inline enum ctx_state exception_enter(void)
43static inline void exception_exit(enum ctx_state prev_ctx) 46static inline void exception_exit(enum ctx_state prev_ctx)
44{ 47{
45 if (context_tracking_is_enabled()) { 48 if (context_tracking_is_enabled()) {
46 if (prev_ctx == IN_USER) 49 if (prev_ctx != CONTEXT_KERNEL)
47 context_tracking_user_enter(); 50 context_tracking_enter(prev_ctx);
48 } 51 }
49} 52}
50 53
@@ -78,10 +81,16 @@ static inline void guest_enter(void)
78 vtime_guest_enter(current); 81 vtime_guest_enter(current);
79 else 82 else
80 current->flags |= PF_VCPU; 83 current->flags |= PF_VCPU;
84
85 if (context_tracking_is_enabled())
86 context_tracking_enter(CONTEXT_GUEST);
81} 87}
82 88
83static inline void guest_exit(void) 89static inline void guest_exit(void)
84{ 90{
91 if (context_tracking_is_enabled())
92 context_tracking_exit(CONTEXT_GUEST);
93
85 if (vtime_accounting_enabled()) 94 if (vtime_accounting_enabled())
86 vtime_guest_exit(current); 95 vtime_guest_exit(current);
87 else 96 else
diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h
index 97a81225d037..6b7b96a32b75 100644
--- a/include/linux/context_tracking_state.h
+++ b/include/linux/context_tracking_state.h
@@ -13,8 +13,9 @@ struct context_tracking {
13 */ 13 */
14 bool active; 14 bool active;
15 enum ctx_state { 15 enum ctx_state {
16 IN_KERNEL = 0, 16 CONTEXT_KERNEL = 0,
17 IN_USER, 17 CONTEXT_USER,
18 CONTEXT_GUEST,
18 } state; 19 } state;
19}; 20};
20 21
@@ -34,11 +35,13 @@ static inline bool context_tracking_cpu_is_enabled(void)
34 35
35static inline bool context_tracking_in_user(void) 36static inline bool context_tracking_in_user(void)
36{ 37{
37 return __this_cpu_read(context_tracking.state) == IN_USER; 38 return __this_cpu_read(context_tracking.state) == CONTEXT_USER;
38} 39}
39#else 40#else
40static inline bool context_tracking_in_user(void) { return false; } 41static inline bool context_tracking_in_user(void) { return false; }
41static inline bool context_tracking_active(void) { return false; } 42static inline bool context_tracking_active(void) { return false; }
43static inline bool context_tracking_is_enabled(void) { return false; }
44static inline bool context_tracking_cpu_is_enabled(void) { return false; }
42#endif /* CONFIG_CONTEXT_TRACKING */ 45#endif /* CONFIG_CONTEXT_TRACKING */
43 46
44#endif 47#endif
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 4260e8594bd7..c0fb6b1b4712 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -73,6 +73,7 @@ enum {
73 /* migration should happen before other stuff but after perf */ 73 /* migration should happen before other stuff but after perf */
74 CPU_PRI_PERF = 20, 74 CPU_PRI_PERF = 20,
75 CPU_PRI_MIGRATION = 10, 75 CPU_PRI_MIGRATION = 10,
76 CPU_PRI_SMPBOOT = 9,
76 /* bring up workqueues before normal notifiers and down after */ 77 /* bring up workqueues before normal notifiers and down after */
77 CPU_PRI_WORKQUEUE_UP = 5, 78 CPU_PRI_WORKQUEUE_UP = 5,
78 CPU_PRI_WORKQUEUE_DOWN = -5, 79 CPU_PRI_WORKQUEUE_DOWN = -5,
@@ -95,6 +96,10 @@ enum {
95 * Called on the new cpu, just before 96 * Called on the new cpu, just before
96 * enabling interrupts. Must not sleep, 97 * enabling interrupts. Must not sleep,
97 * must not fail */ 98 * must not fail */
99#define CPU_DYING_IDLE 0x000B /* CPU (unsigned)v dying, reached
100 * idle loop. */
101#define CPU_BROKEN 0x000C /* CPU (unsigned)v did not die properly,
102 * perhaps due to preemption. */
98 103
99/* Used for CPU hotplug events occurring while tasks are frozen due to a suspend 104/* Used for CPU hotplug events occurring while tasks are frozen due to a suspend
100 * operation in progress 105 * operation in progress
@@ -161,6 +166,7 @@ static inline void __unregister_cpu_notifier(struct notifier_block *nb)
161} 166}
162#endif 167#endif
163 168
169void smpboot_thread_init(void);
164int cpu_up(unsigned int cpu); 170int cpu_up(unsigned int cpu);
165void notify_cpu_starting(unsigned int cpu); 171void notify_cpu_starting(unsigned int cpu);
166extern void cpu_maps_update_begin(void); 172extern void cpu_maps_update_begin(void);
@@ -208,6 +214,10 @@ static inline void cpu_notifier_register_done(void)
208{ 214{
209} 215}
210 216
217static inline void smpboot_thread_init(void)
218{
219}
220
211#endif /* CONFIG_SMP */ 221#endif /* CONFIG_SMP */
212extern struct bus_type cpu_subsys; 222extern struct bus_type cpu_subsys;
213 223
@@ -271,4 +281,14 @@ void arch_cpu_idle_enter(void);
271void arch_cpu_idle_exit(void); 281void arch_cpu_idle_exit(void);
272void arch_cpu_idle_dead(void); 282void arch_cpu_idle_dead(void);
273 283
284DECLARE_PER_CPU(bool, cpu_dead_idle);
285
286int cpu_report_state(int cpu);
287int cpu_check_up_prepare(int cpu);
288void cpu_set_state_online(int cpu);
289#ifdef CONFIG_HOTPLUG_CPU
290bool cpu_wait_death(unsigned int cpu, int seconds);
291bool cpu_report_death(void);
292#endif /* #ifdef CONFIG_HOTPLUG_CPU */
293
274#endif /* _LINUX_CPU_H_ */ 294#endif /* _LINUX_CPU_H_ */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 306178d7309f..9c5e89254796 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -77,7 +77,6 @@ struct cpuidle_device {
77 unsigned int cpu; 77 unsigned int cpu;
78 78
79 int last_residency; 79 int last_residency;
80 int state_count;
81 struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX]; 80 struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX];
82 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; 81 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
83 struct cpuidle_driver_kobj *kobj_driver; 82 struct cpuidle_driver_kobj *kobj_driver;
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 2fb2ca2127ed..8b6c083e68a7 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -62,9 +62,27 @@ do { \
62 groups_free(group_info); \ 62 groups_free(group_info); \
63} while (0) 63} while (0)
64 64
65extern struct group_info *groups_alloc(int);
66extern struct group_info init_groups; 65extern struct group_info init_groups;
66#ifdef CONFIG_MULTIUSER
67extern struct group_info *groups_alloc(int);
67extern void groups_free(struct group_info *); 68extern void groups_free(struct group_info *);
69
70extern int in_group_p(kgid_t);
71extern int in_egroup_p(kgid_t);
72#else
73static inline void groups_free(struct group_info *group_info)
74{
75}
76
77static inline int in_group_p(kgid_t grp)
78{
79 return 1;
80}
81static inline int in_egroup_p(kgid_t grp)
82{
83 return 1;
84}
85#endif
68extern int set_current_groups(struct group_info *); 86extern int set_current_groups(struct group_info *);
69extern void set_groups(struct cred *, struct group_info *); 87extern void set_groups(struct cred *, struct group_info *);
70extern int groups_search(const struct group_info *, kgid_t); 88extern int groups_search(const struct group_info *, kgid_t);
@@ -74,9 +92,6 @@ extern bool may_setgroups(void);
74#define GROUP_AT(gi, i) \ 92#define GROUP_AT(gi, i) \
75 ((gi)->blocks[(i) / NGROUPS_PER_BLOCK][(i) % NGROUPS_PER_BLOCK]) 93 ((gi)->blocks[(i) / NGROUPS_PER_BLOCK][(i) % NGROUPS_PER_BLOCK])
76 94
77extern int in_group_p(kgid_t);
78extern int in_egroup_p(kgid_t);
79
80/* 95/*
81 * The security context of a task 96 * The security context of a task
82 * 97 *
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index fb5ef16d6a12..10df5d2d093a 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -95,6 +95,12 @@
95#define CRYPTO_ALG_KERN_DRIVER_ONLY 0x00001000 95#define CRYPTO_ALG_KERN_DRIVER_ONLY 0x00001000
96 96
97/* 97/*
98 * Mark a cipher as a service implementation only usable by another
99 * cipher and never by a normal user of the kernel crypto API
100 */
101#define CRYPTO_ALG_INTERNAL 0x00002000
102
103/*
98 * Transform masks and values (for crt_flags). 104 * Transform masks and values (for crt_flags).
99 */ 105 */
100#define CRYPTO_TFM_REQ_MASK 0x000fff00 106#define CRYPTO_TFM_REQ_MASK 0x000fff00
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index d8358799c594..df334cbacc6d 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -404,26 +404,11 @@ static inline bool d_mountpoint(const struct dentry *dentry)
404/* 404/*
405 * Directory cache entry type accessor functions. 405 * Directory cache entry type accessor functions.
406 */ 406 */
407static inline void __d_set_type(struct dentry *dentry, unsigned type)
408{
409 dentry->d_flags = (dentry->d_flags & ~DCACHE_ENTRY_TYPE) | type;
410}
411
412static inline void __d_clear_type(struct dentry *dentry)
413{
414 __d_set_type(dentry, DCACHE_MISS_TYPE);
415}
416
417static inline void d_set_type(struct dentry *dentry, unsigned type)
418{
419 spin_lock(&dentry->d_lock);
420 __d_set_type(dentry, type);
421 spin_unlock(&dentry->d_lock);
422}
423
424static inline unsigned __d_entry_type(const struct dentry *dentry) 407static inline unsigned __d_entry_type(const struct dentry *dentry)
425{ 408{
426 return dentry->d_flags & DCACHE_ENTRY_TYPE; 409 unsigned type = READ_ONCE(dentry->d_flags);
410 smp_rmb();
411 return type & DCACHE_ENTRY_TYPE;
427} 412}
428 413
429static inline bool d_is_miss(const struct dentry *dentry) 414static inline bool d_is_miss(const struct dentry *dentry)
@@ -482,6 +467,44 @@ static inline bool d_is_positive(const struct dentry *dentry)
482 return !d_is_negative(dentry); 467 return !d_is_negative(dentry);
483} 468}
484 469
470/**
471 * d_really_is_negative - Determine if a dentry is really negative (ignoring fallthroughs)
472 * @dentry: The dentry in question
473 *
474 * Returns true if the dentry represents either an absent name or a name that
475 * doesn't map to an inode (ie. ->d_inode is NULL). The dentry could represent
476 * a true miss, a whiteout that isn't represented by a 0,0 chardev or a
477 * fallthrough marker in an opaque directory.
478 *
479 * Note! (1) This should be used *only* by a filesystem to examine its own
480 * dentries. It should not be used to look at some other filesystem's
481 * dentries. (2) It should also be used in combination with d_inode() to get
482 * the inode. (3) The dentry may have something attached to ->d_lower and the
483 * type field of the flags may be set to something other than miss or whiteout.
484 */
485static inline bool d_really_is_negative(const struct dentry *dentry)
486{
487 return dentry->d_inode == NULL;
488}
489
490/**
491 * d_really_is_positive - Determine if a dentry is really positive (ignoring fallthroughs)
492 * @dentry: The dentry in question
493 *
494 * Returns true if the dentry represents a name that maps to an inode
495 * (ie. ->d_inode is not NULL). The dentry might still represent a whiteout if
496 * that is represented on medium as a 0,0 chardev.
497 *
498 * Note! (1) This should be used *only* by a filesystem to examine its own
499 * dentries. It should not be used to look at some other filesystem's
500 * dentries. (2) It should also be used in combination with d_inode() to get
501 * the inode.
502 */
503static inline bool d_really_is_positive(const struct dentry *dentry)
504{
505 return dentry->d_inode != NULL;
506}
507
485extern void d_set_fallthru(struct dentry *dentry); 508extern void d_set_fallthru(struct dentry *dentry);
486 509
487static inline bool d_is_fallthru(const struct dentry *dentry) 510static inline bool d_is_fallthru(const struct dentry *dentry)
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 439ff698000a..221025423e6c 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -43,6 +43,7 @@ enum dccp_state {
43 DCCP_CLOSING = TCP_CLOSING, 43 DCCP_CLOSING = TCP_CLOSING,
44 DCCP_TIME_WAIT = TCP_TIME_WAIT, 44 DCCP_TIME_WAIT = TCP_TIME_WAIT,
45 DCCP_CLOSED = TCP_CLOSE, 45 DCCP_CLOSED = TCP_CLOSE,
46 DCCP_NEW_SYN_RECV = TCP_NEW_SYN_RECV,
46 DCCP_PARTOPEN = TCP_MAX_STATES, 47 DCCP_PARTOPEN = TCP_MAX_STATES,
47 DCCP_PASSIVE_CLOSEREQ, /* clients receiving CloseReq */ 48 DCCP_PASSIVE_CLOSEREQ, /* clients receiving CloseReq */
48 DCCP_MAX_STATES 49 DCCP_MAX_STATES
@@ -57,6 +58,7 @@ enum {
57 DCCPF_CLOSING = TCPF_CLOSING, 58 DCCPF_CLOSING = TCPF_CLOSING,
58 DCCPF_TIME_WAIT = TCPF_TIME_WAIT, 59 DCCPF_TIME_WAIT = TCPF_TIME_WAIT,
59 DCCPF_CLOSED = TCPF_CLOSE, 60 DCCPF_CLOSED = TCPF_CLOSE,
61 DCCPF_NEW_SYN_RECV = TCPF_NEW_SYN_RECV,
60 DCCPF_PARTOPEN = (1 << DCCP_PARTOPEN), 62 DCCPF_PARTOPEN = (1 << DCCP_PARTOPEN),
61}; 63};
62 64
@@ -317,6 +319,6 @@ static inline const char *dccp_role(const struct sock *sk)
317 return NULL; 319 return NULL;
318} 320}
319 321
320extern void dccp_syn_ack_timeout(struct sock *sk, struct request_sock *req); 322extern void dccp_syn_ack_timeout(const struct request_sock *req);
321 323
322#endif /* _LINUX_DCCP_H */ 324#endif /* _LINUX_DCCP_H */
diff --git a/include/linux/devfreq-event.h b/include/linux/devfreq-event.h
index 602fbbfcfeed..0a83a1e648b0 100644
--- a/include/linux/devfreq-event.h
+++ b/include/linux/devfreq-event.h
@@ -91,7 +91,7 @@ struct devfreq_event_desc {
91 const char *name; 91 const char *name;
92 void *driver_data; 92 void *driver_data;
93 93
94 struct devfreq_event_ops *ops; 94 const struct devfreq_event_ops *ops;
95}; 95};
96 96
97#if defined(CONFIG_PM_DEVFREQ_EVENT) 97#if defined(CONFIG_PM_DEVFREQ_EVENT)
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index fd23978d93fe..51cc1deb7af3 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -605,9 +605,4 @@ static inline unsigned long to_bytes(sector_t n)
605 return (n << SECTOR_SHIFT); 605 return (n << SECTOR_SHIFT);
606} 606}
607 607
608/*-----------------------------------------------------------------
609 * Helper for block layer and dm core operations
610 *---------------------------------------------------------------*/
611int dm_underlying_device_busy(struct request_queue *q);
612
613#endif /* _LINUX_DEVICE_MAPPER_H */ 608#endif /* _LINUX_DEVICE_MAPPER_H */
diff --git a/include/linux/device.h b/include/linux/device.h
index 0eb8ee2dc6d1..6558af90c8fe 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -38,6 +38,7 @@ struct class;
38struct subsys_private; 38struct subsys_private;
39struct bus_type; 39struct bus_type;
40struct device_node; 40struct device_node;
41struct fwnode_handle;
41struct iommu_ops; 42struct iommu_ops;
42struct iommu_group; 43struct iommu_group;
43 44
@@ -650,14 +651,6 @@ struct device_dma_parameters {
650 unsigned long segment_boundary_mask; 651 unsigned long segment_boundary_mask;
651}; 652};
652 653
653struct acpi_device;
654
655struct acpi_dev_node {
656#ifdef CONFIG_ACPI
657 struct acpi_device *companion;
658#endif
659};
660
661/** 654/**
662 * struct device - The basic device structure 655 * struct device - The basic device structure
663 * @parent: The device's "parent" device, the device to which it is attached. 656 * @parent: The device's "parent" device, the device to which it is attached.
@@ -703,7 +696,7 @@ struct acpi_dev_node {
703 * @cma_area: Contiguous memory area for dma allocations 696 * @cma_area: Contiguous memory area for dma allocations
704 * @archdata: For arch-specific additions. 697 * @archdata: For arch-specific additions.
705 * @of_node: Associated device tree node. 698 * @of_node: Associated device tree node.
706 * @acpi_node: Associated ACPI device node. 699 * @fwnode: Associated device node supplied by platform firmware.
707 * @devt: For creating the sysfs "dev". 700 * @devt: For creating the sysfs "dev".
708 * @id: device instance 701 * @id: device instance
709 * @devres_lock: Spinlock to protect the resource of the device. 702 * @devres_lock: Spinlock to protect the resource of the device.
@@ -779,7 +772,7 @@ struct device {
779 struct dev_archdata archdata; 772 struct dev_archdata archdata;
780 773
781 struct device_node *of_node; /* associated device tree node */ 774 struct device_node *of_node; /* associated device tree node */
782 struct acpi_dev_node acpi_node; /* associated ACPI device node */ 775 struct fwnode_handle *fwnode; /* firmware device node */
783 776
784 dev_t devt; /* dev_t, creates the sysfs "dev" */ 777 dev_t devt; /* dev_t, creates the sysfs "dev" */
785 u32 id; /* device instance */ 778 u32 id; /* device instance */
@@ -916,6 +909,13 @@ static inline void device_lock_assert(struct device *dev)
916 lockdep_assert_held(&dev->mutex); 909 lockdep_assert_held(&dev->mutex);
917} 910}
918 911
912static inline struct device_node *dev_of_node(struct device *dev)
913{
914 if (!IS_ENABLED(CONFIG_OF))
915 return NULL;
916 return dev->of_node;
917}
918
919void driver_init(void); 919void driver_init(void);
920 920
921/* 921/*
@@ -947,6 +947,9 @@ extern void unlock_device_hotplug(void);
947extern int lock_device_hotplug_sysfs(void); 947extern int lock_device_hotplug_sysfs(void);
948extern int device_offline(struct device *dev); 948extern int device_offline(struct device *dev);
949extern int device_online(struct device *dev); 949extern int device_online(struct device *dev);
950extern void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
951extern void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
952
950/* 953/*
951 * Root device objects for grouping under /sys/devices 954 * Root device objects for grouping under /sys/devices
952 */ 955 */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index c3007cb4bfa6..ac07ff090919 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -34,6 +34,10 @@ struct dma_map_ops {
34 void (*unmap_page)(struct device *dev, dma_addr_t dma_handle, 34 void (*unmap_page)(struct device *dev, dma_addr_t dma_handle,
35 size_t size, enum dma_data_direction dir, 35 size_t size, enum dma_data_direction dir,
36 struct dma_attrs *attrs); 36 struct dma_attrs *attrs);
37 /*
38 * map_sg returns 0 on error and a value > 0 on success.
39 * It should never return a value < 0.
40 */
37 int (*map_sg)(struct device *dev, struct scatterlist *sg, 41 int (*map_sg)(struct device *dev, struct scatterlist *sg,
38 int nents, enum dma_data_direction dir, 42 int nents, enum dma_data_direction dir,
39 struct dma_attrs *attrs); 43 struct dma_attrs *attrs);
diff --git a/include/linux/dmapool.h b/include/linux/dmapool.h
index 022e34fcbd1b..52456aa566a0 100644
--- a/include/linux/dmapool.h
+++ b/include/linux/dmapool.h
@@ -14,6 +14,8 @@
14#include <asm/io.h> 14#include <asm/io.h>
15#include <asm/scatterlist.h> 15#include <asm/scatterlist.h>
16 16
17struct device;
18
17struct dma_pool *dma_pool_create(const char *name, struct device *dev, 19struct dma_pool *dma_pool_create(const char *name, struct device *dev,
18 size_t size, size_t align, size_t allocation); 20 size_t size, size_t align, size_t allocation);
19 21
diff --git a/include/linux/efi.h b/include/linux/efi.h
index cf7e431cbc73..af5be0368dec 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -942,6 +942,7 @@ extern int __init efi_setup_pcdp_console(char *);
942#define EFI_64BIT 5 /* Is the firmware 64-bit? */ 942#define EFI_64BIT 5 /* Is the firmware 64-bit? */
943#define EFI_PARAVIRT 6 /* Access is via a paravirt interface */ 943#define EFI_PARAVIRT 6 /* Access is via a paravirt interface */
944#define EFI_ARCH_1 7 /* First arch-specific bit */ 944#define EFI_ARCH_1 7 /* First arch-specific bit */
945#define EFI_DBG 8 /* Print additional debug info at runtime */
945 946
946#ifdef CONFIG_EFI 947#ifdef CONFIG_EFI
947/* 948/*
diff --git a/include/linux/elf-randomize.h b/include/linux/elf-randomize.h
new file mode 100644
index 000000000000..b5f0bda9472e
--- /dev/null
+++ b/include/linux/elf-randomize.h
@@ -0,0 +1,22 @@
1#ifndef _ELF_RANDOMIZE_H
2#define _ELF_RANDOMIZE_H
3
4struct mm_struct;
5
6#ifndef CONFIG_ARCH_HAS_ELF_RANDOMIZE
7static inline unsigned long arch_mmap_rnd(void) { return 0; }
8# if defined(arch_randomize_brk) && defined(CONFIG_COMPAT_BRK)
9# define compat_brk_randomized
10# endif
11# ifndef arch_randomize_brk
12# define arch_randomize_brk(mm) (mm->brk)
13# endif
14#else
15extern unsigned long arch_mmap_rnd(void);
16extern unsigned long arch_randomize_brk(struct mm_struct *mm);
17# ifdef CONFIG_COMPAT_BRK
18# define compat_brk_randomized
19# endif
20#endif
21
22#endif
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 1d869d185a0d..606563ef8a72 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -35,7 +35,6 @@ extern const struct header_ops eth_header_ops;
35 35
36int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, 36int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
37 const void *daddr, const void *saddr, unsigned len); 37 const void *daddr, const void *saddr, unsigned len);
38int eth_rebuild_header(struct sk_buff *skb);
39int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); 38int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
40int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, 39int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh,
41 __be16 type); 40 __be16 type);
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index a23556c32703..591f8c3ef410 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -153,7 +153,7 @@ struct f2fs_orphan_block {
153 */ 153 */
154struct f2fs_extent { 154struct f2fs_extent {
155 __le32 fofs; /* start file offset of the extent */ 155 __le32 fofs; /* start file offset of the extent */
156 __le32 blk_addr; /* start block address of the extent */ 156 __le32 blk; /* start block address of the extent */
157 __le32 len; /* lengh of the extent */ 157 __le32 len; /* lengh of the extent */
158} __packed; 158} __packed;
159 159
@@ -178,6 +178,7 @@ struct f2fs_extent {
178#define F2FS_INLINE_DATA 0x02 /* file inline data flag */ 178#define F2FS_INLINE_DATA 0x02 /* file inline data flag */
179#define F2FS_INLINE_DENTRY 0x04 /* file inline dentry flag */ 179#define F2FS_INLINE_DENTRY 0x04 /* file inline dentry flag */
180#define F2FS_DATA_EXIST 0x08 /* file inline data exist flag */ 180#define F2FS_DATA_EXIST 0x08 /* file inline data exist flag */
181#define F2FS_INLINE_DOTS 0x10 /* file having implicit dot dentries */
181 182
182#define MAX_INLINE_DATA (sizeof(__le32) * (DEF_ADDRS_PER_INODE - \ 183#define MAX_INLINE_DATA (sizeof(__le32) * (DEF_ADDRS_PER_INODE - \
183 F2FS_INLINE_XATTR_ADDRS - 1)) 184 F2FS_INLINE_XATTR_ADDRS - 1))
diff --git a/include/linux/filter.h b/include/linux/filter.h
index caac2087a4d5..fa11b3a367be 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -145,8 +145,6 @@ struct bpf_prog_aux;
145 .off = 0, \ 145 .off = 0, \
146 .imm = ((__u64) (IMM)) >> 32 }) 146 .imm = ((__u64) (IMM)) >> 32 })
147 147
148#define BPF_PSEUDO_MAP_FD 1
149
150/* pseudo BPF_LD_IMM64 insn used to refer to process-local map_fd */ 148/* pseudo BPF_LD_IMM64 insn used to refer to process-local map_fd */
151#define BPF_LD_MAP_FD(DST, MAP_FD) \ 149#define BPF_LD_MAP_FD(DST, MAP_FD) \
152 BPF_LD_IMM64_RAW(DST, BPF_PSEUDO_MAP_FD, MAP_FD) 150 BPF_LD_IMM64_RAW(DST, BPF_PSEUDO_MAP_FD, MAP_FD)
@@ -310,9 +308,11 @@ struct bpf_binary_header {
310struct bpf_prog { 308struct bpf_prog {
311 u16 pages; /* Number of allocated pages */ 309 u16 pages; /* Number of allocated pages */
312 bool jited; /* Is our filter JIT'ed? */ 310 bool jited; /* Is our filter JIT'ed? */
311 bool gpl_compatible; /* Is our filter GPL compatible? */
313 u32 len; /* Number of filter blocks */ 312 u32 len; /* Number of filter blocks */
314 struct sock_fprog_kern *orig_prog; /* Original BPF program */ 313 enum bpf_prog_type type; /* Type of BPF program */
315 struct bpf_prog_aux *aux; /* Auxiliary fields */ 314 struct bpf_prog_aux *aux; /* Auxiliary fields */
315 struct sock_fprog_kern *orig_prog; /* Original BPF program */
316 unsigned int (*bpf_func)(const struct sk_buff *skb, 316 unsigned int (*bpf_func)(const struct sk_buff *skb,
317 const struct bpf_insn *filter); 317 const struct bpf_insn *filter);
318 /* Instructions for interpreter */ 318 /* Instructions for interpreter */
@@ -454,6 +454,7 @@ static inline u16 bpf_anc_helper(const struct sock_filter *ftest)
454 BPF_ANCILLARY(VLAN_TAG_PRESENT); 454 BPF_ANCILLARY(VLAN_TAG_PRESENT);
455 BPF_ANCILLARY(PAY_OFFSET); 455 BPF_ANCILLARY(PAY_OFFSET);
456 BPF_ANCILLARY(RANDOM); 456 BPF_ANCILLARY(RANDOM);
457 BPF_ANCILLARY(VLAN_TPID);
457 } 458 }
458 /* Fallthrough. */ 459 /* Fallthrough. */
459 default: 460 default:
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f4131e8ead74..c7496f263860 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -314,6 +314,33 @@ struct page;
314struct address_space; 314struct address_space;
315struct writeback_control; 315struct writeback_control;
316 316
317#define IOCB_EVENTFD (1 << 0)
318#define IOCB_APPEND (1 << 1)
319#define IOCB_DIRECT (1 << 2)
320
321struct kiocb {
322 struct file *ki_filp;
323 loff_t ki_pos;
324 void (*ki_complete)(struct kiocb *iocb, long ret, long ret2);
325 void *private;
326 int ki_flags;
327};
328
329static inline bool is_sync_kiocb(struct kiocb *kiocb)
330{
331 return kiocb->ki_complete == NULL;
332}
333
334static inline int iocb_flags(struct file *file);
335
336static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
337{
338 *kiocb = (struct kiocb) {
339 .ki_filp = filp,
340 .ki_flags = iocb_flags(filp),
341 };
342}
343
317/* 344/*
318 * "descriptor" for what we're up to with a read. 345 * "descriptor" for what we're up to with a read.
319 * This allows us to use the same read code yet 346 * This allows us to use the same read code yet
@@ -361,7 +388,7 @@ struct address_space_operations {
361 void (*invalidatepage) (struct page *, unsigned int, unsigned int); 388 void (*invalidatepage) (struct page *, unsigned int, unsigned int);
362 int (*releasepage) (struct page *, gfp_t); 389 int (*releasepage) (struct page *, gfp_t);
363 void (*freepage)(struct page *); 390 void (*freepage)(struct page *);
364 ssize_t (*direct_IO)(int, struct kiocb *, struct iov_iter *iter, loff_t offset); 391 ssize_t (*direct_IO)(struct kiocb *, struct iov_iter *iter, loff_t offset);
365 /* 392 /*
366 * migrate the contents of a page to the specified target. If 393 * migrate the contents of a page to the specified target. If
367 * migrate_mode is MIGRATE_ASYNC, it must not block. 394 * migrate_mode is MIGRATE_ASYNC, it must not block.
@@ -848,6 +875,7 @@ static inline struct file *get_file(struct file *f)
848 atomic_long_inc(&f->f_count); 875 atomic_long_inc(&f->f_count);
849 return f; 876 return f;
850} 877}
878#define get_file_rcu(x) atomic_long_inc_not_zero(&(x)->f_count)
851#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) 879#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)
852#define file_count(x) atomic_long_read(&(x)->f_count) 880#define file_count(x) atomic_long_read(&(x)->f_count)
853 881
@@ -893,8 +921,8 @@ struct file_lock_operations {
893struct lock_manager_operations { 921struct lock_manager_operations {
894 int (*lm_compare_owner)(struct file_lock *, struct file_lock *); 922 int (*lm_compare_owner)(struct file_lock *, struct file_lock *);
895 unsigned long (*lm_owner_key)(struct file_lock *); 923 unsigned long (*lm_owner_key)(struct file_lock *);
896 void (*lm_get_owner)(struct file_lock *, struct file_lock *); 924 fl_owner_t (*lm_get_owner)(fl_owner_t);
897 void (*lm_put_owner)(struct file_lock *); 925 void (*lm_put_owner)(fl_owner_t);
898 void (*lm_notify)(struct file_lock *); /* unblock callback */ 926 void (*lm_notify)(struct file_lock *); /* unblock callback */
899 int (*lm_grant)(struct file_lock *, int); 927 int (*lm_grant)(struct file_lock *, int);
900 bool (*lm_break)(struct file_lock *); 928 bool (*lm_break)(struct file_lock *);
@@ -1019,6 +1047,9 @@ extern void lease_get_mtime(struct inode *, struct timespec *time);
1019extern int generic_setlease(struct file *, long, struct file_lock **, void **priv); 1047extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
1020extern int vfs_setlease(struct file *, long, struct file_lock **, void **); 1048extern int vfs_setlease(struct file *, long, struct file_lock **, void **);
1021extern int lease_modify(struct file_lock *, int, struct list_head *); 1049extern int lease_modify(struct file_lock *, int, struct list_head *);
1050struct files_struct;
1051extern void show_fd_locks(struct seq_file *f,
1052 struct file *filp, struct files_struct *files);
1022#else /* !CONFIG_FILE_LOCKING */ 1053#else /* !CONFIG_FILE_LOCKING */
1023static inline int fcntl_getlk(struct file *file, unsigned int cmd, 1054static inline int fcntl_getlk(struct file *file, unsigned int cmd,
1024 struct flock __user *user) 1055 struct flock __user *user)
@@ -1155,6 +1186,10 @@ static inline int lease_modify(struct file_lock *fl, int arg,
1155{ 1186{
1156 return -EINVAL; 1187 return -EINVAL;
1157} 1188}
1189
1190struct files_struct;
1191static inline void show_fd_locks(struct seq_file *f,
1192 struct file *filp, struct files_struct *files) {}
1158#endif /* !CONFIG_FILE_LOCKING */ 1193#endif /* !CONFIG_FILE_LOCKING */
1159 1194
1160 1195
@@ -1540,8 +1575,6 @@ struct file_operations {
1540 loff_t (*llseek) (struct file *, loff_t, int); 1575 loff_t (*llseek) (struct file *, loff_t, int);
1541 ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); 1576 ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
1542 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); 1577 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
1543 ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1544 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1545 ssize_t (*read_iter) (struct kiocb *, struct iov_iter *); 1578 ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
1546 ssize_t (*write_iter) (struct kiocb *, struct iov_iter *); 1579 ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
1547 int (*iterate) (struct file *, struct dir_context *); 1580 int (*iterate) (struct file *, struct dir_context *);
@@ -1549,7 +1582,7 @@ struct file_operations {
1549 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 1582 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
1550 long (*compat_ioctl) (struct file *, unsigned int, unsigned long); 1583 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
1551 int (*mmap) (struct file *, struct vm_area_struct *); 1584 int (*mmap) (struct file *, struct vm_area_struct *);
1552 void (*mremap)(struct file *, struct vm_area_struct *); 1585 int (*mremap)(struct file *, struct vm_area_struct *);
1553 int (*open) (struct inode *, struct file *); 1586 int (*open) (struct inode *, struct file *);
1554 int (*flush) (struct file *, fl_owner_t id); 1587 int (*flush) (struct file *, fl_owner_t id);
1555 int (*release) (struct inode *, struct file *); 1588 int (*release) (struct inode *, struct file *);
@@ -1617,6 +1650,7 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
1617 struct iovec **ret_pointer); 1650 struct iovec **ret_pointer);
1618 1651
1619extern ssize_t __vfs_read(struct file *, char __user *, size_t, loff_t *); 1652extern ssize_t __vfs_read(struct file *, char __user *, size_t, loff_t *);
1653extern ssize_t __vfs_write(struct file *, const char __user *, size_t, loff_t *);
1620extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *); 1654extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
1621extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *); 1655extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *);
1622extern ssize_t vfs_readv(struct file *, const struct iovec __user *, 1656extern ssize_t vfs_readv(struct file *, const struct iovec __user *,
@@ -2145,7 +2179,7 @@ struct filename {
2145 const __user char *uptr; /* original userland pointer */ 2179 const __user char *uptr; /* original userland pointer */
2146 struct audit_names *aname; 2180 struct audit_names *aname;
2147 int refcnt; 2181 int refcnt;
2148 bool separate; /* should "name" be freed? */ 2182 const char iname[];
2149}; 2183};
2150 2184
2151extern long vfs_truncate(struct path *, loff_t); 2185extern long vfs_truncate(struct path *, loff_t);
@@ -2545,16 +2579,12 @@ extern int sb_min_blocksize(struct super_block *, int);
2545 2579
2546extern int generic_file_mmap(struct file *, struct vm_area_struct *); 2580extern int generic_file_mmap(struct file *, struct vm_area_struct *);
2547extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); 2581extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
2548int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); 2582extern ssize_t generic_write_checks(struct kiocb *, struct iov_iter *);
2549extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *); 2583extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *);
2550extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *); 2584extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *);
2551extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *); 2585extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *);
2552extern ssize_t generic_file_direct_write(struct kiocb *, struct iov_iter *, loff_t); 2586extern ssize_t generic_file_direct_write(struct kiocb *, struct iov_iter *, loff_t);
2553extern ssize_t generic_perform_write(struct file *, struct iov_iter *, loff_t); 2587extern ssize_t generic_perform_write(struct file *, struct iov_iter *, loff_t);
2554extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos);
2555extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
2556extern ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos);
2557extern ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
2558 2588
2559ssize_t vfs_iter_read(struct file *file, struct iov_iter *iter, loff_t *ppos); 2589ssize_t vfs_iter_read(struct file *file, struct iov_iter *iter, loff_t *ppos);
2560ssize_t vfs_iter_write(struct file *file, struct iov_iter *iter, loff_t *ppos); 2590ssize_t vfs_iter_write(struct file *file, struct iov_iter *iter, loff_t *ppos);
@@ -2592,12 +2622,13 @@ extern loff_t fixed_size_llseek(struct file *file, loff_t offset,
2592extern int generic_file_open(struct inode * inode, struct file * filp); 2622extern int generic_file_open(struct inode * inode, struct file * filp);
2593extern int nonseekable_open(struct inode * inode, struct file * filp); 2623extern int nonseekable_open(struct inode * inode, struct file * filp);
2594 2624
2595ssize_t dax_do_io(int rw, struct kiocb *, struct inode *, struct iov_iter *, 2625ssize_t dax_do_io(struct kiocb *, struct inode *, struct iov_iter *, loff_t,
2596 loff_t, get_block_t, dio_iodone_t, int flags); 2626 get_block_t, dio_iodone_t, int flags);
2597int dax_clear_blocks(struct inode *, sector_t block, long size); 2627int dax_clear_blocks(struct inode *, sector_t block, long size);
2598int dax_zero_page_range(struct inode *, loff_t from, unsigned len, get_block_t); 2628int dax_zero_page_range(struct inode *, loff_t from, unsigned len, get_block_t);
2599int dax_truncate_page(struct inode *, loff_t from, get_block_t); 2629int dax_truncate_page(struct inode *, loff_t from, get_block_t);
2600int dax_fault(struct vm_area_struct *, struct vm_fault *, get_block_t); 2630int dax_fault(struct vm_area_struct *, struct vm_fault *, get_block_t);
2631int dax_pfn_mkwrite(struct vm_area_struct *, struct vm_fault *);
2601#define dax_mkwrite(vma, vmf, gb) dax_fault(vma, vmf, gb) 2632#define dax_mkwrite(vma, vmf, gb) dax_fault(vma, vmf, gb)
2602 2633
2603#ifdef CONFIG_BLOCK 2634#ifdef CONFIG_BLOCK
@@ -2617,16 +2648,18 @@ enum {
2617 2648
2618void dio_end_io(struct bio *bio, int error); 2649void dio_end_io(struct bio *bio, int error);
2619 2650
2620ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, 2651ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
2621 struct block_device *bdev, struct iov_iter *iter, loff_t offset, 2652 struct block_device *bdev, struct iov_iter *iter,
2622 get_block_t get_block, dio_iodone_t end_io, 2653 loff_t offset, get_block_t get_block,
2623 dio_submit_t submit_io, int flags); 2654 dio_iodone_t end_io, dio_submit_t submit_io,
2655 int flags);
2624 2656
2625static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 2657static inline ssize_t blockdev_direct_IO(struct kiocb *iocb,
2626 struct inode *inode, struct iov_iter *iter, loff_t offset, 2658 struct inode *inode,
2627 get_block_t get_block) 2659 struct iov_iter *iter, loff_t offset,
2660 get_block_t get_block)
2628{ 2661{
2629 return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iter, 2662 return __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev, iter,
2630 offset, get_block, NULL, NULL, 2663 offset, get_block, NULL, NULL,
2631 DIO_LOCKING | DIO_SKIP_HOLES); 2664 DIO_LOCKING | DIO_SKIP_HOLES);
2632} 2665}
@@ -2662,7 +2695,6 @@ void inode_sub_bytes(struct inode *inode, loff_t bytes);
2662loff_t inode_get_bytes(struct inode *inode); 2695loff_t inode_get_bytes(struct inode *inode);
2663void inode_set_bytes(struct inode *inode, loff_t bytes); 2696void inode_set_bytes(struct inode *inode, loff_t bytes);
2664 2697
2665extern int vfs_readdir(struct file *, filldir_t, void *);
2666extern int iterate_dir(struct file *, struct dir_context *); 2698extern int iterate_dir(struct file *, struct dir_context *);
2667 2699
2668extern int vfs_stat(const char __user *, struct kstat *); 2700extern int vfs_stat(const char __user *, struct kstat *);
@@ -2760,6 +2792,16 @@ static inline bool io_is_direct(struct file *filp)
2760 return (filp->f_flags & O_DIRECT) || IS_DAX(file_inode(filp)); 2792 return (filp->f_flags & O_DIRECT) || IS_DAX(file_inode(filp));
2761} 2793}
2762 2794
2795static inline int iocb_flags(struct file *file)
2796{
2797 int res = 0;
2798 if (file->f_flags & O_APPEND)
2799 res |= IOCB_APPEND;
2800 if (io_is_direct(file))
2801 res |= IOCB_DIRECT;
2802 return res;
2803}
2804
2763static inline ino_t parent_ino(struct dentry *dentry) 2805static inline ino_t parent_ino(struct dentry *dentry)
2764{ 2806{
2765 ino_t res; 2807 ino_t res;
diff --git a/include/linux/fs_pin.h b/include/linux/fs_pin.h
index 9dc4e0384bfb..3886b3bffd7f 100644
--- a/include/linux/fs_pin.h
+++ b/include/linux/fs_pin.h
@@ -13,6 +13,8 @@ struct vfsmount;
13static inline void init_fs_pin(struct fs_pin *p, void (*kill)(struct fs_pin *)) 13static inline void init_fs_pin(struct fs_pin *p, void (*kill)(struct fs_pin *))
14{ 14{
15 init_waitqueue_head(&p->wait); 15 init_waitqueue_head(&p->wait);
16 INIT_HLIST_NODE(&p->s_list);
17 INIT_HLIST_NODE(&p->m_list);
16 p->kill = kill; 18 p->kill = kill;
17} 19}
18 20
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index c674ee8f7fca..46e83c2156c6 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -13,6 +13,7 @@ struct trace_array;
13struct trace_buffer; 13struct trace_buffer;
14struct tracer; 14struct tracer;
15struct dentry; 15struct dentry;
16struct bpf_prog;
16 17
17struct trace_print_flags { 18struct trace_print_flags {
18 unsigned long mask; 19 unsigned long mask;
@@ -202,7 +203,7 @@ enum trace_reg {
202struct ftrace_event_call; 203struct ftrace_event_call;
203 204
204struct ftrace_event_class { 205struct ftrace_event_class {
205 char *system; 206 const char *system;
206 void *probe; 207 void *probe;
207#ifdef CONFIG_PERF_EVENTS 208#ifdef CONFIG_PERF_EVENTS
208 void *perf_probe; 209 void *perf_probe;
@@ -252,6 +253,7 @@ enum {
252 TRACE_EVENT_FL_WAS_ENABLED_BIT, 253 TRACE_EVENT_FL_WAS_ENABLED_BIT,
253 TRACE_EVENT_FL_USE_CALL_FILTER_BIT, 254 TRACE_EVENT_FL_USE_CALL_FILTER_BIT,
254 TRACE_EVENT_FL_TRACEPOINT_BIT, 255 TRACE_EVENT_FL_TRACEPOINT_BIT,
256 TRACE_EVENT_FL_KPROBE_BIT,
255}; 257};
256 258
257/* 259/*
@@ -265,6 +267,7 @@ enum {
265 * it is best to clear the buffers that used it). 267 * it is best to clear the buffers that used it).
266 * USE_CALL_FILTER - For ftrace internal events, don't use file filter 268 * USE_CALL_FILTER - For ftrace internal events, don't use file filter
267 * TRACEPOINT - Event is a tracepoint 269 * TRACEPOINT - Event is a tracepoint
270 * KPROBE - Event is a kprobe
268 */ 271 */
269enum { 272enum {
270 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), 273 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
@@ -274,6 +277,7 @@ enum {
274 TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT), 277 TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT),
275 TRACE_EVENT_FL_USE_CALL_FILTER = (1 << TRACE_EVENT_FL_USE_CALL_FILTER_BIT), 278 TRACE_EVENT_FL_USE_CALL_FILTER = (1 << TRACE_EVENT_FL_USE_CALL_FILTER_BIT),
276 TRACE_EVENT_FL_TRACEPOINT = (1 << TRACE_EVENT_FL_TRACEPOINT_BIT), 279 TRACE_EVENT_FL_TRACEPOINT = (1 << TRACE_EVENT_FL_TRACEPOINT_BIT),
280 TRACE_EVENT_FL_KPROBE = (1 << TRACE_EVENT_FL_KPROBE_BIT),
277}; 281};
278 282
279struct ftrace_event_call { 283struct ftrace_event_call {
@@ -285,7 +289,7 @@ struct ftrace_event_call {
285 struct tracepoint *tp; 289 struct tracepoint *tp;
286 }; 290 };
287 struct trace_event event; 291 struct trace_event event;
288 const char *print_fmt; 292 char *print_fmt;
289 struct event_filter *filter; 293 struct event_filter *filter;
290 void *mod; 294 void *mod;
291 void *data; 295 void *data;
@@ -303,6 +307,7 @@ struct ftrace_event_call {
303#ifdef CONFIG_PERF_EVENTS 307#ifdef CONFIG_PERF_EVENTS
304 int perf_refcount; 308 int perf_refcount;
305 struct hlist_head __percpu *perf_events; 309 struct hlist_head __percpu *perf_events;
310 struct bpf_prog *prog;
306 311
307 int (*perf_perm)(struct ftrace_event_call *, 312 int (*perf_perm)(struct ftrace_event_call *,
308 struct perf_event *); 313 struct perf_event *);
@@ -548,6 +553,15 @@ event_trigger_unlock_commit_regs(struct ftrace_event_file *file,
548 event_triggers_post_call(file, tt); 553 event_triggers_post_call(file, tt);
549} 554}
550 555
556#ifdef CONFIG_BPF_SYSCALL
557unsigned int trace_call_bpf(struct bpf_prog *prog, void *ctx);
558#else
559static inline unsigned int trace_call_bpf(struct bpf_prog *prog, void *ctx)
560{
561 return 1;
562}
563#endif
564
551enum { 565enum {
552 FILTER_OTHER = 0, 566 FILTER_OTHER = 0,
553 FILTER_STATIC_STRING, 567 FILTER_STATIC_STRING,
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
new file mode 100644
index 000000000000..0408545bce42
--- /dev/null
+++ b/include/linux/fwnode.h
@@ -0,0 +1,27 @@
1/*
2 * fwnode.h - Firmware device node object handle type definition.
3 *
4 * Copyright (C) 2015, Intel Corporation
5 * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _LINUX_FWNODE_H_
13#define _LINUX_FWNODE_H_
14
15enum fwnode_type {
16 FWNODE_INVALID = 0,
17 FWNODE_OF,
18 FWNODE_ACPI,
19 FWNODE_PDATA,
20};
21
22struct fwnode_handle {
23 enum fwnode_type type;
24 struct fwnode_handle *secondary;
25};
26
27#endif
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 51bd1e72a917..97a9373e61e8 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -57,8 +57,10 @@ struct vm_area_struct;
57 * _might_ fail. This depends upon the particular VM implementation. 57 * _might_ fail. This depends upon the particular VM implementation.
58 * 58 *
59 * __GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller 59 * __GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller
60 * cannot handle allocation failures. This modifier is deprecated and no new 60 * cannot handle allocation failures. New users should be evaluated carefully
61 * users should be added. 61 * (and the flag should be used only when there is no reasonable failure policy)
62 * but it is definitely preferable to use the flag rather than opencode endless
63 * loop around allocator.
62 * 64 *
63 * __GFP_NORETRY: The VM implementation must not retry indefinitely. 65 * __GFP_NORETRY: The VM implementation must not retry indefinitely.
64 * 66 *
@@ -117,16 +119,6 @@ struct vm_area_struct;
117 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \ 119 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \
118 __GFP_NO_KSWAPD) 120 __GFP_NO_KSWAPD)
119 121
120/*
121 * GFP_THISNODE does not perform any reclaim, you most likely want to
122 * use __GFP_THISNODE to allocate from a given node without fallback!
123 */
124#ifdef CONFIG_NUMA
125#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
126#else
127#define GFP_THISNODE ((__force gfp_t)0)
128#endif
129
130/* This mask makes up all the page movable related flags */ 122/* This mask makes up all the page movable related flags */
131#define GFP_MOVABLE_MASK (__GFP_RECLAIMABLE|__GFP_MOVABLE) 123#define GFP_MOVABLE_MASK (__GFP_RECLAIMABLE|__GFP_MOVABLE)
132 124
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 45afc2dee560..3a7c9ffd5ab9 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -16,6 +16,15 @@ struct device;
16 */ 16 */
17struct gpio_desc; 17struct gpio_desc;
18 18
19/**
20 * Struct containing an array of descriptors that can be obtained using
21 * gpiod_get_array().
22 */
23struct gpio_descs {
24 unsigned int ndescs;
25 struct gpio_desc *desc[];
26};
27
19#define GPIOD_FLAGS_BIT_DIR_SET BIT(0) 28#define GPIOD_FLAGS_BIT_DIR_SET BIT(0)
20#define GPIOD_FLAGS_BIT_DIR_OUT BIT(1) 29#define GPIOD_FLAGS_BIT_DIR_OUT BIT(1)
21#define GPIOD_FLAGS_BIT_DIR_VAL BIT(2) 30#define GPIOD_FLAGS_BIT_DIR_VAL BIT(2)
@@ -34,6 +43,9 @@ enum gpiod_flags {
34 43
35#ifdef CONFIG_GPIOLIB 44#ifdef CONFIG_GPIOLIB
36 45
46/* Return the number of GPIOs associated with a device / function */
47int gpiod_count(struct device *dev, const char *con_id);
48
37/* Acquire and dispose GPIOs */ 49/* Acquire and dispose GPIOs */
38struct gpio_desc *__must_check __gpiod_get(struct device *dev, 50struct gpio_desc *__must_check __gpiod_get(struct device *dev,
39 const char *con_id, 51 const char *con_id,
@@ -49,7 +61,14 @@ struct gpio_desc *__must_check __gpiod_get_index_optional(struct device *dev,
49 const char *con_id, 61 const char *con_id,
50 unsigned int index, 62 unsigned int index,
51 enum gpiod_flags flags); 63 enum gpiod_flags flags);
64struct gpio_descs *__must_check gpiod_get_array(struct device *dev,
65 const char *con_id,
66 enum gpiod_flags flags);
67struct gpio_descs *__must_check gpiod_get_array_optional(struct device *dev,
68 const char *con_id,
69 enum gpiod_flags flags);
52void gpiod_put(struct gpio_desc *desc); 70void gpiod_put(struct gpio_desc *desc);
71void gpiod_put_array(struct gpio_descs *descs);
53 72
54struct gpio_desc *__must_check __devm_gpiod_get(struct device *dev, 73struct gpio_desc *__must_check __devm_gpiod_get(struct device *dev,
55 const char *con_id, 74 const char *con_id,
@@ -64,7 +83,14 @@ struct gpio_desc *__must_check __devm_gpiod_get_optional(struct device *dev,
64struct gpio_desc *__must_check 83struct gpio_desc *__must_check
65__devm_gpiod_get_index_optional(struct device *dev, const char *con_id, 84__devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
66 unsigned int index, enum gpiod_flags flags); 85 unsigned int index, enum gpiod_flags flags);
86struct gpio_descs *__must_check devm_gpiod_get_array(struct device *dev,
87 const char *con_id,
88 enum gpiod_flags flags);
89struct gpio_descs *__must_check
90devm_gpiod_get_array_optional(struct device *dev, const char *con_id,
91 enum gpiod_flags flags);
67void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); 92void devm_gpiod_put(struct device *dev, struct gpio_desc *desc);
93void devm_gpiod_put_array(struct device *dev, struct gpio_descs *descs);
68 94
69int gpiod_get_direction(struct gpio_desc *desc); 95int gpiod_get_direction(struct gpio_desc *desc);
70int gpiod_direction_input(struct gpio_desc *desc); 96int gpiod_direction_input(struct gpio_desc *desc);
@@ -110,9 +136,15 @@ struct fwnode_handle;
110struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, 136struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
111 const char *propname); 137 const char *propname);
112struct gpio_desc *devm_get_gpiod_from_child(struct device *dev, 138struct gpio_desc *devm_get_gpiod_from_child(struct device *dev,
139 const char *con_id,
113 struct fwnode_handle *child); 140 struct fwnode_handle *child);
114#else /* CONFIG_GPIOLIB */ 141#else /* CONFIG_GPIOLIB */
115 142
143static inline int gpiod_count(struct device *dev, const char *con_id)
144{
145 return 0;
146}
147
116static inline struct gpio_desc *__must_check __gpiod_get(struct device *dev, 148static inline struct gpio_desc *__must_check __gpiod_get(struct device *dev,
117 const char *con_id, 149 const char *con_id,
118 enum gpiod_flags flags) 150 enum gpiod_flags flags)
@@ -142,6 +174,20 @@ __gpiod_get_index_optional(struct device *dev, const char *con_id,
142 return ERR_PTR(-ENOSYS); 174 return ERR_PTR(-ENOSYS);
143} 175}
144 176
177static inline struct gpio_descs *__must_check
178gpiod_get_array(struct device *dev, const char *con_id,
179 enum gpiod_flags flags)
180{
181 return ERR_PTR(-ENOSYS);
182}
183
184static inline struct gpio_descs *__must_check
185gpiod_get_array_optional(struct device *dev, const char *con_id,
186 enum gpiod_flags flags)
187{
188 return ERR_PTR(-ENOSYS);
189}
190
145static inline void gpiod_put(struct gpio_desc *desc) 191static inline void gpiod_put(struct gpio_desc *desc)
146{ 192{
147 might_sleep(); 193 might_sleep();
@@ -150,6 +196,14 @@ static inline void gpiod_put(struct gpio_desc *desc)
150 WARN_ON(1); 196 WARN_ON(1);
151} 197}
152 198
199static inline void gpiod_put_array(struct gpio_descs *descs)
200{
201 might_sleep();
202
203 /* GPIO can never have been requested */
204 WARN_ON(1);
205}
206
153static inline struct gpio_desc *__must_check 207static inline struct gpio_desc *__must_check
154__devm_gpiod_get(struct device *dev, 208__devm_gpiod_get(struct device *dev,
155 const char *con_id, 209 const char *con_id,
@@ -181,6 +235,20 @@ __devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
181 return ERR_PTR(-ENOSYS); 235 return ERR_PTR(-ENOSYS);
182} 236}
183 237
238static inline struct gpio_descs *__must_check
239devm_gpiod_get_array(struct device *dev, const char *con_id,
240 enum gpiod_flags flags)
241{
242 return ERR_PTR(-ENOSYS);
243}
244
245static inline struct gpio_descs *__must_check
246devm_gpiod_get_array_optional(struct device *dev, const char *con_id,
247 enum gpiod_flags flags)
248{
249 return ERR_PTR(-ENOSYS);
250}
251
184static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc) 252static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc)
185{ 253{
186 might_sleep(); 254 might_sleep();
@@ -189,6 +257,15 @@ static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc)
189 WARN_ON(1); 257 WARN_ON(1);
190} 258}
191 259
260static inline void devm_gpiod_put_array(struct device *dev,
261 struct gpio_descs *descs)
262{
263 might_sleep();
264
265 /* GPIO can never have been requested */
266 WARN_ON(1);
267}
268
192 269
193static inline int gpiod_get_direction(const struct gpio_desc *desc) 270static inline int gpiod_get_direction(const struct gpio_desc *desc)
194{ 271{
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index c497c62889d1..f1b36593ec9f 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -6,6 +6,7 @@
6#include <linux/irq.h> 6#include <linux/irq.h>
7#include <linux/irqchip/chained_irq.h> 7#include <linux/irqchip/chained_irq.h>
8#include <linux/irqdomain.h> 8#include <linux/irqdomain.h>
9#include <linux/pinctrl/pinctrl.h>
9 10
10struct device; 11struct device;
11struct gpio_desc; 12struct gpio_desc;
@@ -173,6 +174,53 @@ int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
173 174
174#endif /* CONFIG_GPIOLIB_IRQCHIP */ 175#endif /* CONFIG_GPIOLIB_IRQCHIP */
175 176
177#ifdef CONFIG_PINCTRL
178
179/**
180 * struct gpio_pin_range - pin range controlled by a gpio chip
181 * @head: list for maintaining set of pin ranges, used internally
182 * @pctldev: pinctrl device which handles corresponding pins
183 * @range: actual range of pins controlled by a gpio controller
184 */
185
186struct gpio_pin_range {
187 struct list_head node;
188 struct pinctrl_dev *pctldev;
189 struct pinctrl_gpio_range range;
190};
191
192int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
193 unsigned int gpio_offset, unsigned int pin_offset,
194 unsigned int npins);
195int gpiochip_add_pingroup_range(struct gpio_chip *chip,
196 struct pinctrl_dev *pctldev,
197 unsigned int gpio_offset, const char *pin_group);
198void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
199
200#else
201
202static inline int
203gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
204 unsigned int gpio_offset, unsigned int pin_offset,
205 unsigned int npins)
206{
207 return 0;
208}
209static inline int
210gpiochip_add_pingroup_range(struct gpio_chip *chip,
211 struct pinctrl_dev *pctldev,
212 unsigned int gpio_offset, const char *pin_group)
213{
214 return 0;
215}
216
217static inline void
218gpiochip_remove_pin_ranges(struct gpio_chip *chip)
219{
220}
221
222#endif /* CONFIG_PINCTRL */
223
176struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip, u16 hwnum, 224struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip, u16 hwnum,
177 const char *label); 225 const char *label);
178void gpiochip_free_own_desc(struct gpio_desc *desc); 226void gpiochip_free_own_desc(struct gpio_desc *desc);
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index cba442ec3c66..f4af03404b97 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -9,7 +9,7 @@
9 9
10 10
11extern void synchronize_irq(unsigned int irq); 11extern void synchronize_irq(unsigned int irq);
12extern void synchronize_hardirq(unsigned int irq); 12extern bool synchronize_hardirq(unsigned int irq);
13 13
14#if defined(CONFIG_TINY_RCU) 14#if defined(CONFIG_TINY_RCU)
15 15
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index 4173a8fdad9e..0408421d885f 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -49,19 +49,43 @@ struct hid_sensor_hub_attribute_info {
49}; 49};
50 50
51/** 51/**
52 * struct sensor_hub_pending - Synchronous read pending information
53 * @status: Pending status true/false.
54 * @ready: Completion synchronization data.
55 * @usage_id: Usage id for physical device, E.g. Gyro usage id.
56 * @attr_usage_id: Usage Id of a field, E.g. X-AXIS for a gyro.
57 * @raw_size: Response size for a read request.
58 * @raw_data: Place holder for received response.
59 */
60struct sensor_hub_pending {
61 bool status;
62 struct completion ready;
63 u32 usage_id;
64 u32 attr_usage_id;
65 int raw_size;
66 u8 *raw_data;
67};
68
69/**
52 * struct hid_sensor_hub_device - Stores the hub instance data 70 * struct hid_sensor_hub_device - Stores the hub instance data
53 * @hdev: Stores the hid instance. 71 * @hdev: Stores the hid instance.
54 * @vendor_id: Vendor id of hub device. 72 * @vendor_id: Vendor id of hub device.
55 * @product_id: Product id of hub device. 73 * @product_id: Product id of hub device.
74 * @usage: Usage id for this hub device instance.
56 * @start_collection_index: Starting index for a phy type collection 75 * @start_collection_index: Starting index for a phy type collection
57 * @end_collection_index: Last index for a phy type collection 76 * @end_collection_index: Last index for a phy type collection
77 * @mutex: synchronizing mutex.
78 * @pending: Holds information of pending sync read request.
58 */ 79 */
59struct hid_sensor_hub_device { 80struct hid_sensor_hub_device {
60 struct hid_device *hdev; 81 struct hid_device *hdev;
61 u32 vendor_id; 82 u32 vendor_id;
62 u32 product_id; 83 u32 product_id;
84 u32 usage;
63 int start_collection_index; 85 int start_collection_index;
64 int end_collection_index; 86 int end_collection_index;
87 struct mutex mutex;
88 struct sensor_hub_pending pending;
65}; 89};
66 90
67/** 91/**
@@ -152,40 +176,51 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
152* @usage_id: Attribute usage id of parent physical device as per spec 176* @usage_id: Attribute usage id of parent physical device as per spec
153* @attr_usage_id: Attribute usage id as per spec 177* @attr_usage_id: Attribute usage id as per spec
154* @report_id: Report id to look for 178* @report_id: Report id to look for
179* @flag: Synchronous or asynchronous read
155* 180*
156* Issues a synchronous read request for an input attribute. Returns 181* Issues a synchronous or asynchronous read request for an input attribute.
157* data upto 32 bits. Since client can get events, so this call should 182* Returns data upto 32 bits.
158* not be used for data paths, this will impact performance.
159*/ 183*/
160 184
185enum sensor_hub_read_flags {
186 SENSOR_HUB_SYNC,
187 SENSOR_HUB_ASYNC,
188};
189
161int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev, 190int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
162 u32 usage_id, 191 u32 usage_id,
163 u32 attr_usage_id, u32 report_id); 192 u32 attr_usage_id, u32 report_id,
193 enum sensor_hub_read_flags flag
194);
195
164/** 196/**
165* sensor_hub_set_feature() - Feature set request 197* sensor_hub_set_feature() - Feature set request
166* @hsdev: Hub device instance. 198* @hsdev: Hub device instance.
167* @report_id: Report id to look for 199* @report_id: Report id to look for
168* @field_index: Field index inside a report 200* @field_index: Field index inside a report
169* @value: Value to set 201* @buffer_size: size of the buffer
202* @buffer: buffer to use in the feature set
170* 203*
171* Used to set a field in feature report. For example this can set polling 204* Used to set a field in feature report. For example this can set polling
172* interval, sensitivity, activate/deactivate state. 205* interval, sensitivity, activate/deactivate state.
173*/ 206*/
174int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, 207int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
175 u32 field_index, s32 value); 208 u32 field_index, int buffer_size, void *buffer);
176 209
177/** 210/**
178* sensor_hub_get_feature() - Feature get request 211* sensor_hub_get_feature() - Feature get request
179* @hsdev: Hub device instance. 212* @hsdev: Hub device instance.
180* @report_id: Report id to look for 213* @report_id: Report id to look for
181* @field_index: Field index inside a report 214* @field_index: Field index inside a report
182* @value: Place holder for return value 215* @buffer_size: size of the buffer
216* @buffer: buffer to copy output
183* 217*
184* Used to get a field in feature report. For example this can get polling 218* Used to get a field in feature report. For example this can get polling
185* interval, sensitivity, activate/deactivate state. 219* interval, sensitivity, activate/deactivate state. On success it returns
220* number of bytes copied to buffer. On failure, it returns value < 0.
186*/ 221*/
187int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, 222int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
188 u32 field_index, s32 *value); 223 u32 field_index, int buffer_size, void *buffer);
189 224
190/* hid-sensor-attributes */ 225/* hid-sensor-attributes */
191 226
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index 109f0e633e01..f2ee90aed0c2 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -21,6 +21,8 @@
21 21
22#define HID_MAX_PHY_DEVICES 0xFF 22#define HID_MAX_PHY_DEVICES 0xFF
23 23
24#define HID_USAGE_SENSOR_COLLECTION 0x200001
25
24/* Accel 3D (200073) */ 26/* Accel 3D (200073) */
25#define HID_USAGE_SENSOR_ACCEL_3D 0x200073 27#define HID_USAGE_SENSOR_ACCEL_3D 0x200073
26#define HID_USAGE_SENSOR_DATA_ACCELERATION 0x200452 28#define HID_USAGE_SENSOR_DATA_ACCELERATION 0x200452
diff --git a/include/linux/hid.h b/include/linux/hid.h
index efc7787a41a8..176b43670e5d 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -159,6 +159,7 @@ struct hid_item {
159#define HID_UP_LED 0x00080000 159#define HID_UP_LED 0x00080000
160#define HID_UP_BUTTON 0x00090000 160#define HID_UP_BUTTON 0x00090000
161#define HID_UP_ORDINAL 0x000a0000 161#define HID_UP_ORDINAL 0x000a0000
162#define HID_UP_TELEPHONY 0x000b0000
162#define HID_UP_CONSUMER 0x000c0000 163#define HID_UP_CONSUMER 0x000c0000
163#define HID_UP_DIGITIZER 0x000d0000 164#define HID_UP_DIGITIZER 0x000d0000
164#define HID_UP_PID 0x000f0000 165#define HID_UP_PID 0x000f0000
@@ -269,6 +270,7 @@ struct hid_item {
269#define HID_DG_DEVICEINDEX 0x000d0053 270#define HID_DG_DEVICEINDEX 0x000d0053
270#define HID_DG_CONTACTCOUNT 0x000d0054 271#define HID_DG_CONTACTCOUNT 0x000d0054
271#define HID_DG_CONTACTMAX 0x000d0055 272#define HID_DG_CONTACTMAX 0x000d0055
273#define HID_DG_BUTTONTYPE 0x000d0059
272#define HID_DG_BARRELSWITCH2 0x000d005a 274#define HID_DG_BARRELSWITCH2 0x000d005a
273#define HID_DG_TOOLSERIALNUMBER 0x000d005b 275#define HID_DG_TOOLSERIALNUMBER 0x000d005b
274 276
@@ -514,10 +516,10 @@ struct hid_device { /* device report descriptor */
514#ifdef CONFIG_HID_BATTERY_STRENGTH 516#ifdef CONFIG_HID_BATTERY_STRENGTH
515 /* 517 /*
516 * Power supply information for HID devices which report 518 * Power supply information for HID devices which report
517 * battery strength. power_supply is registered iff 519 * battery strength. power_supply was successfully registered if
518 * battery.name is non-NULL. 520 * battery is non-NULL.
519 */ 521 */
520 struct power_supply battery; 522 struct power_supply *battery;
521 __s32 battery_min; 523 __s32 battery_min;
522 __s32 battery_max; 524 __s32 battery_max;
523 __s32 battery_report_type; 525 __s32 battery_report_type;
diff --git a/include/linux/hsi/hsi.h b/include/linux/hsi/hsi.h
index 3ec06300d535..5dd60c2e120f 100644
--- a/include/linux/hsi/hsi.h
+++ b/include/linux/hsi/hsi.h
@@ -135,9 +135,9 @@ static inline int hsi_register_board_info(struct hsi_board_info const *info,
135 * @device: Driver model representation of the device 135 * @device: Driver model representation of the device
136 * @tx_cfg: HSI TX configuration 136 * @tx_cfg: HSI TX configuration
137 * @rx_cfg: HSI RX configuration 137 * @rx_cfg: HSI RX configuration
138 * e_handler: Callback for handling port events (RX Wake High/Low) 138 * @e_handler: Callback for handling port events (RX Wake High/Low)
139 * pclaimed: Keeps tracks if the clients claimed its associated HSI port 139 * @pclaimed: Keeps tracks if the clients claimed its associated HSI port
140 * nb: Notifier block for port events 140 * @nb: Notifier block for port events
141 */ 141 */
142struct hsi_client { 142struct hsi_client {
143 struct device device; 143 struct device device;
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 7b5785032049..205026175c42 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -22,7 +22,13 @@ struct mmu_gather;
22struct hugepage_subpool { 22struct hugepage_subpool {
23 spinlock_t lock; 23 spinlock_t lock;
24 long count; 24 long count;
25 long max_hpages, used_hpages; 25 long max_hpages; /* Maximum huge pages or -1 if no maximum. */
26 long used_hpages; /* Used count against maximum, includes */
27 /* both alloced and reserved pages. */
28 struct hstate *hstate;
29 long min_hpages; /* Minimum huge pages or -1 if no minimum. */
30 long rsv_hpages; /* Pages reserved against global pool to */
31 /* sasitfy minimum size. */
26}; 32};
27 33
28struct resv_map { 34struct resv_map {
@@ -38,11 +44,10 @@ extern int hugetlb_max_hstate __read_mostly;
38#define for_each_hstate(h) \ 44#define for_each_hstate(h) \
39 for ((h) = hstates; (h) < &hstates[hugetlb_max_hstate]; (h)++) 45 for ((h) = hstates; (h) < &hstates[hugetlb_max_hstate]; (h)++)
40 46
41struct hugepage_subpool *hugepage_new_subpool(long nr_blocks); 47struct hugepage_subpool *hugepage_new_subpool(struct hstate *h, long max_hpages,
48 long min_hpages);
42void hugepage_put_subpool(struct hugepage_subpool *spool); 49void hugepage_put_subpool(struct hugepage_subpool *spool);
43 50
44int PageHuge(struct page *page);
45
46void reset_vma_resv_huge_pages(struct vm_area_struct *vma); 51void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
47int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); 52int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
48int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); 53int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
@@ -79,7 +84,6 @@ void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
79int dequeue_hwpoisoned_huge_page(struct page *page); 84int dequeue_hwpoisoned_huge_page(struct page *page);
80bool isolate_huge_page(struct page *page, struct list_head *list); 85bool isolate_huge_page(struct page *page, struct list_head *list);
81void putback_active_hugepage(struct page *page); 86void putback_active_hugepage(struct page *page);
82bool is_hugepage_active(struct page *page);
83void free_huge_page(struct page *page); 87void free_huge_page(struct page *page);
84 88
85#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE 89#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
@@ -109,11 +113,6 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
109 113
110#else /* !CONFIG_HUGETLB_PAGE */ 114#else /* !CONFIG_HUGETLB_PAGE */
111 115
112static inline int PageHuge(struct page *page)
113{
114 return 0;
115}
116
117static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma) 116static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma)
118{ 117{
119} 118}
@@ -152,7 +151,6 @@ static inline bool isolate_huge_page(struct page *page, struct list_head *list)
152 return false; 151 return false;
153} 152}
154#define putback_active_hugepage(p) do {} while (0) 153#define putback_active_hugepage(p) do {} while (0)
155#define is_hugepage_active(x) false
156 154
157static inline unsigned long hugetlb_change_protection(struct vm_area_struct *vma, 155static inline unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
158 unsigned long address, unsigned long end, pgprot_t newprot) 156 unsigned long address, unsigned long end, pgprot_t newprot)
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
index eb7b414d232b..4f7d8f4b1e9a 100644
--- a/include/linux/hw_random.h
+++ b/include/linux/hw_random.h
@@ -50,10 +50,14 @@ struct hwrng {
50 struct completion cleanup_done; 50 struct completion cleanup_done;
51}; 51};
52 52
53struct device;
54
53/** Register a new Hardware Random Number Generator driver. */ 55/** Register a new Hardware Random Number Generator driver. */
54extern int hwrng_register(struct hwrng *rng); 56extern int hwrng_register(struct hwrng *rng);
57extern int devm_hwrng_register(struct device *dev, struct hwrng *rng);
55/** Unregister a Hardware Random Number Generator driver. */ 58/** Unregister a Hardware Random Number Generator driver. */
56extern void hwrng_unregister(struct hwrng *rng); 59extern void hwrng_unregister(struct hwrng *rng);
60extern void devm_hwrng_unregister(struct device *dve, struct hwrng *rng);
57/** Feed random bits into the pool. */ 61/** Feed random bits into the pool. */
58extern void add_hwgenerator_randomness(const char *buffer, size_t count, size_t entropy); 62extern void add_hwgenerator_randomness(const char *buffer, size_t count, size_t entropy);
59 63
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index f17da50402a4..e83a738a3b87 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -253,10 +253,10 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data)
253 253
254#if IS_ENABLED(CONFIG_I2C_SLAVE) 254#if IS_ENABLED(CONFIG_I2C_SLAVE)
255enum i2c_slave_event { 255enum i2c_slave_event {
256 I2C_SLAVE_REQ_READ_START, 256 I2C_SLAVE_READ_REQUESTED,
257 I2C_SLAVE_REQ_READ_END, 257 I2C_SLAVE_WRITE_REQUESTED,
258 I2C_SLAVE_REQ_WRITE_START, 258 I2C_SLAVE_READ_PROCESSED,
259 I2C_SLAVE_REQ_WRITE_END, 259 I2C_SLAVE_WRITE_RECEIVED,
260 I2C_SLAVE_STOP, 260 I2C_SLAVE_STOP,
261}; 261};
262 262
@@ -278,7 +278,7 @@ static inline int i2c_slave_event(struct i2c_client *client,
278 * @platform_data: stored in i2c_client.dev.platform_data 278 * @platform_data: stored in i2c_client.dev.platform_data
279 * @archdata: copied into i2c_client.dev.archdata 279 * @archdata: copied into i2c_client.dev.archdata
280 * @of_node: pointer to OpenFirmware device node 280 * @of_node: pointer to OpenFirmware device node
281 * @acpi_node: ACPI device node 281 * @fwnode: device node supplied by the platform firmware
282 * @irq: stored in i2c_client.irq 282 * @irq: stored in i2c_client.irq
283 * 283 *
284 * I2C doesn't actually support hardware probing, although controllers and 284 * I2C doesn't actually support hardware probing, although controllers and
@@ -299,7 +299,7 @@ struct i2c_board_info {
299 void *platform_data; 299 void *platform_data;
300 struct dev_archdata *archdata; 300 struct dev_archdata *archdata;
301 struct device_node *of_node; 301 struct device_node *of_node;
302 struct acpi_dev_node acpi_node; 302 struct fwnode_handle *fwnode;
303 int irq; 303 int irq;
304}; 304};
305 305
@@ -435,8 +435,8 @@ struct i2c_bus_recovery_info {
435 void (*set_scl)(struct i2c_adapter *, int val); 435 void (*set_scl)(struct i2c_adapter *, int val);
436 int (*get_sda)(struct i2c_adapter *); 436 int (*get_sda)(struct i2c_adapter *);
437 437
438 void (*prepare_recovery)(struct i2c_bus_recovery_info *bri); 438 void (*prepare_recovery)(struct i2c_adapter *);
439 void (*unprepare_recovery)(struct i2c_bus_recovery_info *bri); 439 void (*unprepare_recovery)(struct i2c_adapter *);
440 440
441 /* gpio recovery */ 441 /* gpio recovery */
442 int scl_gpio; 442 int scl_gpio;
@@ -449,6 +449,48 @@ int i2c_recover_bus(struct i2c_adapter *adap);
449int i2c_generic_gpio_recovery(struct i2c_adapter *adap); 449int i2c_generic_gpio_recovery(struct i2c_adapter *adap);
450int i2c_generic_scl_recovery(struct i2c_adapter *adap); 450int i2c_generic_scl_recovery(struct i2c_adapter *adap);
451 451
452/**
453 * struct i2c_adapter_quirks - describe flaws of an i2c adapter
454 * @flags: see I2C_AQ_* for possible flags and read below
455 * @max_num_msgs: maximum number of messages per transfer
456 * @max_write_len: maximum length of a write message
457 * @max_read_len: maximum length of a read message
458 * @max_comb_1st_msg_len: maximum length of the first msg in a combined message
459 * @max_comb_2nd_msg_len: maximum length of the second msg in a combined message
460 *
461 * Note about combined messages: Some I2C controllers can only send one message
462 * per transfer, plus something called combined message or write-then-read.
463 * This is (usually) a small write message followed by a read message and
464 * barely enough to access register based devices like EEPROMs. There is a flag
465 * to support this mode. It implies max_num_msg = 2 and does the length checks
466 * with max_comb_*_len because combined message mode usually has its own
467 * limitations. Because of HW implementations, some controllers can actually do
468 * write-then-anything or other variants. To support that, write-then-read has
469 * been broken out into smaller bits like write-first and read-second which can
470 * be combined as needed.
471 */
472
473struct i2c_adapter_quirks {
474 u64 flags;
475 int max_num_msgs;
476 u16 max_write_len;
477 u16 max_read_len;
478 u16 max_comb_1st_msg_len;
479 u16 max_comb_2nd_msg_len;
480};
481
482/* enforce max_num_msgs = 2 and use max_comb_*_len for length checks */
483#define I2C_AQ_COMB BIT(0)
484/* first combined message must be write */
485#define I2C_AQ_COMB_WRITE_FIRST BIT(1)
486/* second combined message must be read */
487#define I2C_AQ_COMB_READ_SECOND BIT(2)
488/* both combined messages must have the same target address */
489#define I2C_AQ_COMB_SAME_ADDR BIT(3)
490/* convenience macro for typical write-then read case */
491#define I2C_AQ_COMB_WRITE_THEN_READ (I2C_AQ_COMB | I2C_AQ_COMB_WRITE_FIRST | \
492 I2C_AQ_COMB_READ_SECOND | I2C_AQ_COMB_SAME_ADDR)
493
452/* 494/*
453 * i2c_adapter is the structure used to identify a physical i2c bus along 495 * i2c_adapter is the structure used to identify a physical i2c bus along
454 * with the access algorithms necessary to access it. 496 * with the access algorithms necessary to access it.
@@ -474,6 +516,7 @@ struct i2c_adapter {
474 struct list_head userspace_clients; 516 struct list_head userspace_clients;
475 517
476 struct i2c_bus_recovery_info *bus_recovery_info; 518 struct i2c_bus_recovery_info *bus_recovery_info;
519 const struct i2c_adapter_quirks *quirks;
477}; 520};
478#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) 521#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
479 522
diff --git a/include/linux/ieee802154.h b/include/linux/ieee802154.h
index 6e82d888287c..8872ca103d06 100644
--- a/include/linux/ieee802154.h
+++ b/include/linux/ieee802154.h
@@ -28,7 +28,9 @@
28#include <asm/byteorder.h> 28#include <asm/byteorder.h>
29 29
30#define IEEE802154_MTU 127 30#define IEEE802154_MTU 127
31#define IEEE802154_MIN_PSDU_LEN 5 31#define IEEE802154_ACK_PSDU_LEN 5
32#define IEEE802154_MIN_PSDU_LEN 9
33#define IEEE802154_FCS_LEN 2
32 34
33#define IEEE802154_PAN_ID_BROADCAST 0xffff 35#define IEEE802154_PAN_ID_BROADCAST 0xffff
34#define IEEE802154_ADDR_SHORT_BROADCAST 0xffff 36#define IEEE802154_ADDR_SHORT_BROADCAST 0xffff
@@ -38,6 +40,7 @@
38 40
39#define IEEE802154_LIFS_PERIOD 40 41#define IEEE802154_LIFS_PERIOD 40
40#define IEEE802154_SIFS_PERIOD 12 42#define IEEE802154_SIFS_PERIOD 12
43#define IEEE802154_MAX_SIFS_FRAME_SIZE 18
41 44
42#define IEEE802154_MAX_CHANNEL 26 45#define IEEE802154_MAX_CHANNEL 26
43#define IEEE802154_MAX_PAGE 31 46#define IEEE802154_MAX_PAGE 31
@@ -204,11 +207,18 @@ enum {
204 207
205/** 208/**
206 * ieee802154_is_valid_psdu_len - check if psdu len is valid 209 * ieee802154_is_valid_psdu_len - check if psdu len is valid
210 * available lengths:
211 * 0-4 Reserved
212 * 5 MPDU (Acknowledgment)
213 * 6-8 Reserved
214 * 9-127 MPDU
215 *
207 * @len: psdu len with (MHR + payload + MFR) 216 * @len: psdu len with (MHR + payload + MFR)
208 */ 217 */
209static inline bool ieee802154_is_valid_psdu_len(const u8 len) 218static inline bool ieee802154_is_valid_psdu_len(const u8 len)
210{ 219{
211 return (len >= IEEE802154_MIN_PSDU_LEN && len <= IEEE802154_MTU); 220 return (len == IEEE802154_ACK_PSDU_LEN ||
221 (len >= IEEE802154_MIN_PSDU_LEN && len <= IEEE802154_MTU));
212} 222}
213 223
214/** 224/**
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index a57bca2ea97e..dad8b00beed2 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -44,6 +44,7 @@ struct br_ip_list {
44#define BR_PROMISC BIT(7) 44#define BR_PROMISC BIT(7)
45#define BR_PROXYARP BIT(8) 45#define BR_PROXYARP BIT(8)
46#define BR_LEARNING_SYNC BIT(9) 46#define BR_LEARNING_SYNC BIT(9)
47#define BR_PROXYARP_WIFI BIT(10)
47 48
48extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); 49extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
49 50
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 119130e9298b..da4929927f69 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -14,5 +14,6 @@ struct ifla_vf_info {
14 __u32 linkstate; 14 __u32 linkstate;
15 __u32 min_tx_rate; 15 __u32 min_tx_rate;
16 __u32 max_tx_rate; 16 __u32 max_tx_rate;
17 __u32 rss_query_en;
17}; 18};
18#endif /* _LINUX_IF_LINK_H */ 19#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index aff7ad8a4ea3..66a7d7600f43 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -19,6 +19,7 @@
19#include <linux/netdevice.h> 19#include <linux/netdevice.h>
20#include <linux/ppp_channel.h> 20#include <linux/ppp_channel.h>
21#include <linux/skbuff.h> 21#include <linux/skbuff.h>
22#include <linux/workqueue.h>
22#include <uapi/linux/if_pppox.h> 23#include <uapi/linux/if_pppox.h>
23 24
24static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb) 25static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb)
@@ -32,6 +33,7 @@ struct pppoe_opt {
32 struct pppoe_addr pa; /* what this socket is bound to*/ 33 struct pppoe_addr pa; /* what this socket is bound to*/
33 struct sockaddr_pppox relay; /* what socket data will be 34 struct sockaddr_pppox relay; /* what socket data will be
34 relayed to (PPPoE relaying) */ 35 relayed to (PPPoE relaying) */
36 struct work_struct padt_work;/* Work item for handling PADT */
35}; 37};
36 38
37struct pptp_opt { 39struct pptp_opt {
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index b11b28a30b9e..920e4457ce6e 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -561,4 +561,71 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
561 skb->protocol = htons(ETH_P_802_2); 561 skb->protocol = htons(ETH_P_802_2);
562} 562}
563 563
564/**
565 * skb_vlan_tagged - check if skb is vlan tagged.
566 * @skb: skbuff to query
567 *
568 * Returns true if the skb is tagged, regardless of whether it is hardware
569 * accelerated or not.
570 */
571static inline bool skb_vlan_tagged(const struct sk_buff *skb)
572{
573 if (!skb_vlan_tag_present(skb) &&
574 likely(skb->protocol != htons(ETH_P_8021Q) &&
575 skb->protocol != htons(ETH_P_8021AD)))
576 return false;
577
578 return true;
579}
580
581/**
582 * skb_vlan_tagged_multi - check if skb is vlan tagged with multiple headers.
583 * @skb: skbuff to query
584 *
585 * Returns true if the skb is tagged with multiple vlan headers, regardless
586 * of whether it is hardware accelerated or not.
587 */
588static inline bool skb_vlan_tagged_multi(const struct sk_buff *skb)
589{
590 __be16 protocol = skb->protocol;
591
592 if (!skb_vlan_tag_present(skb)) {
593 struct vlan_ethhdr *veh;
594
595 if (likely(protocol != htons(ETH_P_8021Q) &&
596 protocol != htons(ETH_P_8021AD)))
597 return false;
598
599 veh = (struct vlan_ethhdr *)skb->data;
600 protocol = veh->h_vlan_encapsulated_proto;
601 }
602
603 if (protocol != htons(ETH_P_8021Q) && protocol != htons(ETH_P_8021AD))
604 return false;
605
606 return true;
607}
608
609/**
610 * vlan_features_check - drop unsafe features for skb with multiple tags.
611 * @skb: skbuff to query
612 * @features: features to be checked
613 *
614 * Returns features without unsafe ones if the skb has multiple tags.
615 */
616static inline netdev_features_t vlan_features_check(const struct sk_buff *skb,
617 netdev_features_t features)
618{
619 if (skb_vlan_tagged_multi(skb))
620 features = netdev_intersect_features(features,
621 NETIF_F_SG |
622 NETIF_F_HIGHDMA |
623 NETIF_F_FRAGLIST |
624 NETIF_F_GEN_CSUM |
625 NETIF_F_HW_VLAN_CTAG_TX |
626 NETIF_F_HW_VLAN_STAG_TX);
627
628 return features;
629}
630
564#endif /* !(_LINUX_IF_VLAN_H_) */ 631#endif /* !(_LINUX_IF_VLAN_H_) */
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index b65850a41127..eb8622b78ec9 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -21,8 +21,8 @@ struct iio_buffer;
21 * struct iio_buffer_access_funcs - access functions for buffers. 21 * struct iio_buffer_access_funcs - access functions for buffers.
22 * @store_to: actually store stuff to the buffer 22 * @store_to: actually store stuff to the buffer
23 * @read_first_n: try to get a specified number of bytes (must exist) 23 * @read_first_n: try to get a specified number of bytes (must exist)
24 * @data_available: indicates whether data for reading from the buffer is 24 * @data_available: indicates how much data is available for reading from
25 * available. 25 * the buffer.
26 * @request_update: if a parameter change has been marked, update underlying 26 * @request_update: if a parameter change has been marked, update underlying
27 * storage. 27 * storage.
28 * @set_bytes_per_datum:set number of bytes per datum 28 * @set_bytes_per_datum:set number of bytes per datum
@@ -43,7 +43,7 @@ struct iio_buffer_access_funcs {
43 int (*read_first_n)(struct iio_buffer *buffer, 43 int (*read_first_n)(struct iio_buffer *buffer,
44 size_t n, 44 size_t n,
45 char __user *buf); 45 char __user *buf);
46 bool (*data_available)(struct iio_buffer *buffer); 46 size_t (*data_available)(struct iio_buffer *buffer);
47 47
48 int (*request_update)(struct iio_buffer *buffer); 48 int (*request_update)(struct iio_buffer *buffer);
49 49
@@ -72,6 +72,7 @@ struct iio_buffer_access_funcs {
72 * @demux_bounce: [INTERN] buffer for doing gather from incoming scan. 72 * @demux_bounce: [INTERN] buffer for doing gather from incoming scan.
73 * @buffer_list: [INTERN] entry in the devices list of current buffers. 73 * @buffer_list: [INTERN] entry in the devices list of current buffers.
74 * @ref: [INTERN] reference count of the buffer. 74 * @ref: [INTERN] reference count of the buffer.
75 * @watermark: [INTERN] number of datums to wait for poll/read.
75 */ 76 */
76struct iio_buffer { 77struct iio_buffer {
77 int length; 78 int length;
@@ -90,6 +91,7 @@ struct iio_buffer {
90 void *demux_bounce; 91 void *demux_bounce;
91 struct list_head buffer_list; 92 struct list_head buffer_list;
92 struct kref ref; 93 struct kref ref;
94 unsigned int watermark;
93}; 95};
94 96
95/** 97/**
diff --git a/include/linux/iio/dac/max517.h b/include/linux/iio/dac/max517.h
index f6d1d252f08d..7668716cd73c 100644
--- a/include/linux/iio/dac/max517.h
+++ b/include/linux/iio/dac/max517.h
@@ -9,7 +9,7 @@
9#define IIO_DAC_MAX517_H_ 9#define IIO_DAC_MAX517_H_
10 10
11struct max517_platform_data { 11struct max517_platform_data {
12 u16 vref_mv[2]; 12 u16 vref_mv[8];
13}; 13};
14 14
15#endif /* IIO_DAC_MAX517_H_ */ 15#endif /* IIO_DAC_MAX517_H_ */
diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h
index 03fa332ad2a8..8ad87d1c5340 100644
--- a/include/linux/iio/events.h
+++ b/include/linux/iio/events.h
@@ -9,22 +9,8 @@
9#ifndef _IIO_EVENTS_H_ 9#ifndef _IIO_EVENTS_H_
10#define _IIO_EVENTS_H_ 10#define _IIO_EVENTS_H_
11 11
12#include <linux/ioctl.h>
13#include <linux/types.h>
14#include <linux/iio/types.h> 12#include <linux/iio/types.h>
15 13#include <uapi/linux/iio/events.h>
16/**
17 * struct iio_event_data - The actual event being pushed to userspace
18 * @id: event identifier
19 * @timestamp: best estimate of time of event occurrence (often from
20 * the interrupt handler)
21 */
22struct iio_event_data {
23 __u64 id;
24 __s64 timestamp;
25};
26
27#define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int)
28 14
29/** 15/**
30 * IIO_EVENT_CODE() - create event identifier 16 * IIO_EVENT_CODE() - create event identifier
@@ -70,18 +56,4 @@ struct iio_event_data {
70#define IIO_UNMOD_EVENT_CODE(chan_type, number, type, direction) \ 56#define IIO_UNMOD_EVENT_CODE(chan_type, number, type, direction) \
71 IIO_EVENT_CODE(chan_type, 0, 0, direction, type, number, 0, 0) 57 IIO_EVENT_CODE(chan_type, 0, 0, direction, type, number, 0, 0)
72 58
73#define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF)
74
75#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0x7F)
76
77#define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF)
78
79/* Event code number extraction depends on which type of event we have.
80 * Perhaps review this function in the future*/
81#define IIO_EVENT_CODE_EXTRACT_CHAN(mask) ((__s16)(mask & 0xFFFF))
82#define IIO_EVENT_CODE_EXTRACT_CHAN2(mask) ((__s16)(((mask) >> 16) & 0xFFFF))
83
84#define IIO_EVENT_CODE_EXTRACT_MODIFIER(mask) ((mask >> 40) & 0xFF)
85#define IIO_EVENT_CODE_EXTRACT_DIFF(mask) (((mask) >> 55) & 0x1)
86
87#endif 59#endif
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 80d855061064..d86b753e9b30 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -338,6 +338,16 @@ struct iio_dev;
338 * provide a custom of_xlate function that reads the 338 * provide a custom of_xlate function that reads the
339 * *args* and returns the appropriate index in registered 339 * *args* and returns the appropriate index in registered
340 * IIO channels array. 340 * IIO channels array.
341 * @hwfifo_set_watermark: function pointer to set the current hardware
342 * fifo watermark level; see hwfifo_* entries in
343 * Documentation/ABI/testing/sysfs-bus-iio for details on
344 * how the hardware fifo operates
345 * @hwfifo_flush_to_buffer: function pointer to flush the samples stored
346 * in the hardware fifo to the device buffer. The driver
347 * should not flush more than count samples. The function
348 * must return the number of samples flushed, 0 if no
349 * samples were flushed or a negative integer if no samples
350 * were flushed and there was an error.
341 **/ 351 **/
342struct iio_info { 352struct iio_info {
343 struct module *driver_module; 353 struct module *driver_module;
@@ -399,6 +409,9 @@ struct iio_info {
399 unsigned *readval); 409 unsigned *readval);
400 int (*of_xlate)(struct iio_dev *indio_dev, 410 int (*of_xlate)(struct iio_dev *indio_dev,
401 const struct of_phandle_args *iiospec); 411 const struct of_phandle_args *iiospec);
412 int (*hwfifo_set_watermark)(struct iio_dev *indio_dev, unsigned val);
413 int (*hwfifo_flush_to_buffer)(struct iio_dev *indio_dev,
414 unsigned count);
402}; 415};
403 416
404/** 417/**
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 580ed5bdb3fa..942b6de68e2f 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -10,76 +10,7 @@
10#ifndef _IIO_TYPES_H_ 10#ifndef _IIO_TYPES_H_
11#define _IIO_TYPES_H_ 11#define _IIO_TYPES_H_
12 12
13enum iio_chan_type { 13#include <uapi/linux/iio/types.h>
14 IIO_VOLTAGE,
15 IIO_CURRENT,
16 IIO_POWER,
17 IIO_ACCEL,
18 IIO_ANGL_VEL,
19 IIO_MAGN,
20 IIO_LIGHT,
21 IIO_INTENSITY,
22 IIO_PROXIMITY,
23 IIO_TEMP,
24 IIO_INCLI,
25 IIO_ROT,
26 IIO_ANGL,
27 IIO_TIMESTAMP,
28 IIO_CAPACITANCE,
29 IIO_ALTVOLTAGE,
30 IIO_CCT,
31 IIO_PRESSURE,
32 IIO_HUMIDITYRELATIVE,
33 IIO_ACTIVITY,
34 IIO_STEPS,
35 IIO_ENERGY,
36 IIO_DISTANCE,
37 IIO_VELOCITY,
38};
39
40enum iio_modifier {
41 IIO_NO_MOD,
42 IIO_MOD_X,
43 IIO_MOD_Y,
44 IIO_MOD_Z,
45 IIO_MOD_X_AND_Y,
46 IIO_MOD_X_AND_Z,
47 IIO_MOD_Y_AND_Z,
48 IIO_MOD_X_AND_Y_AND_Z,
49 IIO_MOD_X_OR_Y,
50 IIO_MOD_X_OR_Z,
51 IIO_MOD_Y_OR_Z,
52 IIO_MOD_X_OR_Y_OR_Z,
53 IIO_MOD_LIGHT_BOTH,
54 IIO_MOD_LIGHT_IR,
55 IIO_MOD_ROOT_SUM_SQUARED_X_Y,
56 IIO_MOD_SUM_SQUARED_X_Y_Z,
57 IIO_MOD_LIGHT_CLEAR,
58 IIO_MOD_LIGHT_RED,
59 IIO_MOD_LIGHT_GREEN,
60 IIO_MOD_LIGHT_BLUE,
61 IIO_MOD_QUATERNION,
62 IIO_MOD_TEMP_AMBIENT,
63 IIO_MOD_TEMP_OBJECT,
64 IIO_MOD_NORTH_MAGN,
65 IIO_MOD_NORTH_TRUE,
66 IIO_MOD_NORTH_MAGN_TILT_COMP,
67 IIO_MOD_NORTH_TRUE_TILT_COMP,
68 IIO_MOD_RUNNING,
69 IIO_MOD_JOGGING,
70 IIO_MOD_WALKING,
71 IIO_MOD_STILL,
72 IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z,
73};
74
75enum iio_event_type {
76 IIO_EV_TYPE_THRESH,
77 IIO_EV_TYPE_MAG,
78 IIO_EV_TYPE_ROC,
79 IIO_EV_TYPE_THRESH_ADAPTIVE,
80 IIO_EV_TYPE_MAG_ADAPTIVE,
81 IIO_EV_TYPE_CHANGE,
82};
83 14
84enum iio_event_info { 15enum iio_event_info {
85 IIO_EV_INFO_ENABLE, 16 IIO_EV_INFO_ENABLE,
@@ -88,13 +19,6 @@ enum iio_event_info {
88 IIO_EV_INFO_PERIOD, 19 IIO_EV_INFO_PERIOD,
89}; 20};
90 21
91enum iio_event_direction {
92 IIO_EV_DIR_EITHER,
93 IIO_EV_DIR_RISING,
94 IIO_EV_DIR_FALLING,
95 IIO_EV_DIR_NONE,
96};
97
98#define IIO_VAL_INT 1 22#define IIO_VAL_INT 1
99#define IIO_VAL_INT_PLUS_MICRO 2 23#define IIO_VAL_INT_PLUS_MICRO 2
100#define IIO_VAL_INT_PLUS_NANO 3 24#define IIO_VAL_INT_PLUS_NANO 3
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index 46da02410a09..ac48b10c9395 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -11,33 +11,34 @@ struct sk_buff;
11struct netlink_callback; 11struct netlink_callback;
12 12
13struct inet_diag_handler { 13struct inet_diag_handler {
14 void (*dump)(struct sk_buff *skb, 14 void (*dump)(struct sk_buff *skb,
15 struct netlink_callback *cb, 15 struct netlink_callback *cb,
16 struct inet_diag_req_v2 *r, 16 const struct inet_diag_req_v2 *r,
17 struct nlattr *bc); 17 struct nlattr *bc);
18 18
19 int (*dump_one)(struct sk_buff *in_skb, 19 int (*dump_one)(struct sk_buff *in_skb,
20 const struct nlmsghdr *nlh, 20 const struct nlmsghdr *nlh,
21 struct inet_diag_req_v2 *req); 21 const struct inet_diag_req_v2 *req);
22 22
23 void (*idiag_get_info)(struct sock *sk, 23 void (*idiag_get_info)(struct sock *sk,
24 struct inet_diag_msg *r, 24 struct inet_diag_msg *r,
25 void *info); 25 void *info);
26 __u16 idiag_type; 26 __u16 idiag_type;
27}; 27};
28 28
29struct inet_connection_sock; 29struct inet_connection_sock;
30int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, 30int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
31 struct sk_buff *skb, struct inet_diag_req_v2 *req, 31 struct sk_buff *skb, const struct inet_diag_req_v2 *req,
32 struct user_namespace *user_ns, 32 struct user_namespace *user_ns,
33 u32 pid, u32 seq, u16 nlmsg_flags, 33 u32 pid, u32 seq, u16 nlmsg_flags,
34 const struct nlmsghdr *unlh); 34 const struct nlmsghdr *unlh);
35void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb, 35void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb,
36 struct netlink_callback *cb, struct inet_diag_req_v2 *r, 36 struct netlink_callback *cb,
37 struct nlattr *bc); 37 const struct inet_diag_req_v2 *r,
38 struct nlattr *bc);
38int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, 39int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
39 struct sk_buff *in_skb, const struct nlmsghdr *nlh, 40 struct sk_buff *in_skb, const struct nlmsghdr *nlh,
40 struct inet_diag_req_v2 *req); 41 const struct inet_diag_req_v2 *req);
41 42
42int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk); 43int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk);
43 44
diff --git a/include/linux/init.h b/include/linux/init.h
index 2df8e8dd10a4..21b6d768edd7 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -253,21 +253,41 @@ struct obs_kernel_param {
253 * obs_kernel_param "array" too far apart in .init.setup. 253 * obs_kernel_param "array" too far apart in .init.setup.
254 */ 254 */
255#define __setup_param(str, unique_id, fn, early) \ 255#define __setup_param(str, unique_id, fn, early) \
256 static const char __setup_str_##unique_id[] __initconst \ 256 static const char __setup_str_##unique_id[] __initconst \
257 __aligned(1) = str; \ 257 __aligned(1) = str; \
258 static struct obs_kernel_param __setup_##unique_id \ 258 static struct obs_kernel_param __setup_##unique_id \
259 __used __section(.init.setup) \ 259 __used __section(.init.setup) \
260 __attribute__((aligned((sizeof(long))))) \ 260 __attribute__((aligned((sizeof(long))))) \
261 = { __setup_str_##unique_id, fn, early } 261 = { __setup_str_##unique_id, fn, early }
262 262
263#define __setup(str, fn) \ 263#define __setup(str, fn) \
264 __setup_param(str, fn, fn, 0) 264 __setup_param(str, fn, fn, 0)
265 265
266/* NOTE: fn is as per module_param, not __setup! Emits warning if fn 266/*
267 * returns non-zero. */ 267 * NOTE: fn is as per module_param, not __setup!
268#define early_param(str, fn) \ 268 * Emits warning if fn returns non-zero.
269 */
270#define early_param(str, fn) \
269 __setup_param(str, fn, fn, 1) 271 __setup_param(str, fn, fn, 1)
270 272
273#define early_param_on_off(str_on, str_off, var, config) \
274 \
275 int var = IS_ENABLED(config); \
276 \
277 static int __init parse_##var##_on(char *arg) \
278 { \
279 var = 1; \
280 return 0; \
281 } \
282 __setup_param(str_on, parse_##var##_on, parse_##var##_on, 1); \
283 \
284 static int __init parse_##var##_off(char *arg) \
285 { \
286 var = 0; \
287 return 0; \
288 } \
289 __setup_param(str_off, parse_##var##_off, parse_##var##_off, 1)
290
271/* Relies on boot_command_line being set */ 291/* Relies on boot_command_line being set */
272void __init parse_early_param(void); 292void __init parse_early_param(void);
273void __init parse_early_options(char *cmdline); 293void __init parse_early_options(char *cmdline);
diff --git a/include/linux/intel_mid_dma.h b/include/linux/intel_mid_dma.h
deleted file mode 100644
index 10496bd24c5c..000000000000
--- a/include/linux/intel_mid_dma.h
+++ /dev/null
@@ -1,76 +0,0 @@
1/*
2 * intel_mid_dma.h - Intel MID DMA Drivers
3 *
4 * Copyright (C) 2008-10 Intel Corp
5 * Author: Vinod Koul <vinod.koul@intel.com>
6 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20 *
21 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 *
23 *
24 */
25#ifndef __INTEL_MID_DMA_H__
26#define __INTEL_MID_DMA_H__
27
28#include <linux/dmaengine.h>
29
30#define DMA_PREP_CIRCULAR_LIST (1 << 10)
31
32/*DMA mode configurations*/
33enum intel_mid_dma_mode {
34 LNW_DMA_PER_TO_MEM = 0, /*periphral to memory configuration*/
35 LNW_DMA_MEM_TO_PER, /*memory to periphral configuration*/
36 LNW_DMA_MEM_TO_MEM, /*mem to mem confg (testing only)*/
37};
38
39/*DMA handshaking*/
40enum intel_mid_dma_hs_mode {
41 LNW_DMA_HW_HS = 0, /*HW Handshaking only*/
42 LNW_DMA_SW_HS = 1, /*SW Handshaking not recommended*/
43};
44
45/*Burst size configuration*/
46enum intel_mid_dma_msize {
47 LNW_DMA_MSIZE_1 = 0x0,
48 LNW_DMA_MSIZE_4 = 0x1,
49 LNW_DMA_MSIZE_8 = 0x2,
50 LNW_DMA_MSIZE_16 = 0x3,
51 LNW_DMA_MSIZE_32 = 0x4,
52 LNW_DMA_MSIZE_64 = 0x5,
53};
54
55/**
56 * struct intel_mid_dma_slave - DMA slave structure
57 *
58 * @dirn: DMA trf direction
59 * @src_width: tx register width
60 * @dst_width: rx register width
61 * @hs_mode: HW/SW handshaking mode
62 * @cfg_mode: DMA data transfer mode (per-per/mem-per/mem-mem)
63 * @src_msize: Source DMA burst size
64 * @dst_msize: Dst DMA burst size
65 * @per_addr: Periphral address
66 * @device_instance: DMA peripheral device instance, we can have multiple
67 * peripheral device connected to single DMAC
68 */
69struct intel_mid_dma_slave {
70 enum intel_mid_dma_hs_mode hs_mode; /*handshaking*/
71 enum intel_mid_dma_mode cfg_mode; /*mode configuration*/
72 unsigned int device_instance; /*0, 1 for periphral instance*/
73 struct dma_slave_config dma_slave;
74};
75
76#endif /*__INTEL_MID_DMA_H__*/
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 2e88580194f0..950ae4501826 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -39,8 +39,6 @@
39 * These flags used only by the kernel as part of the 39 * These flags used only by the kernel as part of the
40 * irq handling routines. 40 * irq handling routines.
41 * 41 *
42 * IRQF_DISABLED - keep irqs disabled when calling the action handler.
43 * DEPRECATED. This flag is a NOOP and scheduled to be removed
44 * IRQF_SHARED - allow sharing the irq among several devices 42 * IRQF_SHARED - allow sharing the irq among several devices
45 * IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur 43 * IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur
46 * IRQF_TIMER - Flag to mark this interrupt as timer interrupt 44 * IRQF_TIMER - Flag to mark this interrupt as timer interrupt
@@ -64,7 +62,6 @@
64 * wakeup devices users need to implement wakeup detection in 62 * wakeup devices users need to implement wakeup detection in
65 * their interrupt handlers. 63 * their interrupt handlers.
66 */ 64 */
67#define IRQF_DISABLED 0x00000020
68#define IRQF_SHARED 0x00000080 65#define IRQF_SHARED 0x00000080
69#define IRQF_PROBE_SHARED 0x00000100 66#define IRQF_PROBE_SHARED 0x00000100
70#define __IRQF_TIMER 0x00000200 67#define __IRQF_TIMER 0x00000200
@@ -191,6 +188,7 @@ extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id);
191#endif 188#endif
192 189
193extern void disable_irq_nosync(unsigned int irq); 190extern void disable_irq_nosync(unsigned int irq);
191extern bool disable_hardirq(unsigned int irq);
194extern void disable_irq(unsigned int irq); 192extern void disable_irq(unsigned int irq);
195extern void disable_percpu_irq(unsigned int irq); 193extern void disable_percpu_irq(unsigned int irq);
196extern void enable_irq(unsigned int irq); 194extern void enable_irq(unsigned int irq);
@@ -363,6 +361,20 @@ static inline int disable_irq_wake(unsigned int irq)
363 return irq_set_irq_wake(irq, 0); 361 return irq_set_irq_wake(irq, 0);
364} 362}
365 363
364/*
365 * irq_get_irqchip_state/irq_set_irqchip_state specific flags
366 */
367enum irqchip_irq_state {
368 IRQCHIP_STATE_PENDING, /* Is interrupt pending? */
369 IRQCHIP_STATE_ACTIVE, /* Is interrupt in progress? */
370 IRQCHIP_STATE_MASKED, /* Is interrupt masked? */
371 IRQCHIP_STATE_LINE_LEVEL, /* Is IRQ line high? */
372};
373
374extern int irq_get_irqchip_state(unsigned int irq, enum irqchip_irq_state which,
375 bool *state);
376extern int irq_set_irqchip_state(unsigned int irq, enum irqchip_irq_state which,
377 bool state);
366 378
367#ifdef CONFIG_IRQ_FORCED_THREADING 379#ifdef CONFIG_IRQ_FORCED_THREADING
368extern bool force_irqthreads; 380extern bool force_irqthreads;
diff --git a/include/linux/io.h b/include/linux/io.h
index fa02e55e5a2e..4cc299c598e0 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -38,6 +38,14 @@ static inline int ioremap_page_range(unsigned long addr, unsigned long end,
38} 38}
39#endif 39#endif
40 40
41#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
42void __init ioremap_huge_init(void);
43int arch_ioremap_pud_supported(void);
44int arch_ioremap_pmd_supported(void);
45#else
46static inline void ioremap_huge_init(void) { }
47#endif
48
41/* 49/*
42 * Managed iomap interface 50 * Managed iomap interface
43 */ 51 */
diff --git a/include/linux/iommu-common.h b/include/linux/iommu-common.h
new file mode 100644
index 000000000000..bbced83b32ee
--- /dev/null
+++ b/include/linux/iommu-common.h
@@ -0,0 +1,51 @@
1#ifndef _LINUX_IOMMU_COMMON_H
2#define _LINUX_IOMMU_COMMON_H
3
4#include <linux/spinlock_types.h>
5#include <linux/device.h>
6#include <asm/page.h>
7
8#define IOMMU_POOL_HASHBITS 4
9#define IOMMU_NR_POOLS (1 << IOMMU_POOL_HASHBITS)
10
11struct iommu_pool {
12 unsigned long start;
13 unsigned long end;
14 unsigned long hint;
15 spinlock_t lock;
16};
17
18struct iommu_map_table {
19 unsigned long table_map_base;
20 unsigned long table_shift;
21 unsigned long nr_pools;
22 void (*lazy_flush)(struct iommu_map_table *);
23 unsigned long poolsize;
24 struct iommu_pool pools[IOMMU_NR_POOLS];
25 u32 flags;
26#define IOMMU_HAS_LARGE_POOL 0x00000001
27#define IOMMU_NO_SPAN_BOUND 0x00000002
28#define IOMMU_NEED_FLUSH 0x00000004
29 struct iommu_pool large_pool;
30 unsigned long *map;
31};
32
33extern void iommu_tbl_pool_init(struct iommu_map_table *iommu,
34 unsigned long num_entries,
35 u32 table_shift,
36 void (*lazy_flush)(struct iommu_map_table *),
37 bool large_pool, u32 npools,
38 bool skip_span_boundary_check);
39
40extern unsigned long iommu_tbl_range_alloc(struct device *dev,
41 struct iommu_map_table *iommu,
42 unsigned long npages,
43 unsigned long *handle,
44 unsigned long mask,
45 unsigned int align_order);
46
47extern void iommu_tbl_range_free(struct iommu_map_table *iommu,
48 u64 dma_addr, unsigned long npages,
49 unsigned long entry);
50
51#endif
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 2c5250222278..388e3ae94f7a 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -196,10 +196,8 @@ extern struct resource * __request_region(struct resource *,
196 196
197/* Compatibility cruft */ 197/* Compatibility cruft */
198#define release_region(start,n) __release_region(&ioport_resource, (start), (n)) 198#define release_region(start,n) __release_region(&ioport_resource, (start), (n))
199#define check_mem_region(start,n) __check_region(&iomem_resource, (start), (n))
200#define release_mem_region(start,n) __release_region(&iomem_resource, (start), (n)) 199#define release_mem_region(start,n) __release_region(&iomem_resource, (start), (n))
201 200
202extern int __check_region(struct resource *, resource_size_t, resource_size_t);
203extern void __release_region(struct resource *, resource_size_t, 201extern void __release_region(struct resource *, resource_size_t,
204 resource_size_t); 202 resource_size_t);
205#ifdef CONFIG_MEMORY_HOTREMOVE 203#ifdef CONFIG_MEMORY_HOTREMOVE
@@ -207,12 +205,6 @@ extern int release_mem_region_adjustable(struct resource *, resource_size_t,
207 resource_size_t); 205 resource_size_t);
208#endif 206#endif
209 207
210static inline int __deprecated check_region(resource_size_t s,
211 resource_size_t n)
212{
213 return __check_region(&ioport_resource, s, n);
214}
215
216/* Wrappers for managed devices */ 208/* Wrappers for managed devices */
217struct device; 209struct device;
218 210
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 4d5169f5d7d1..82806c60aa42 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -53,6 +53,10 @@ struct ipv6_devconf {
53 __s32 ndisc_notify; 53 __s32 ndisc_notify;
54 __s32 suppress_frag_ndisc; 54 __s32 suppress_frag_ndisc;
55 __s32 accept_ra_mtu; 55 __s32 accept_ra_mtu;
56 struct ipv6_stable_secret {
57 bool initialized;
58 struct in6_addr secret;
59 } stable_secret;
56 void *sysctl; 60 void *sysctl;
57}; 61};
58 62
diff --git a/include/linux/irq.h b/include/linux/irq.h
index d09ec7a1243e..62c6901cab55 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -30,6 +30,7 @@
30struct seq_file; 30struct seq_file;
31struct module; 31struct module;
32struct msi_msg; 32struct msi_msg;
33enum irqchip_irq_state;
33 34
34/* 35/*
35 * IRQ line status. 36 * IRQ line status.
@@ -324,6 +325,8 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
324 * irq_request_resources 325 * irq_request_resources
325 * @irq_compose_msi_msg: optional to compose message content for MSI 326 * @irq_compose_msi_msg: optional to compose message content for MSI
326 * @irq_write_msi_msg: optional to write message content for MSI 327 * @irq_write_msi_msg: optional to write message content for MSI
328 * @irq_get_irqchip_state: return the internal state of an interrupt
329 * @irq_set_irqchip_state: set the internal state of a interrupt
327 * @flags: chip specific flags 330 * @flags: chip specific flags
328 */ 331 */
329struct irq_chip { 332struct irq_chip {
@@ -363,6 +366,9 @@ struct irq_chip {
363 void (*irq_compose_msi_msg)(struct irq_data *data, struct msi_msg *msg); 366 void (*irq_compose_msi_msg)(struct irq_data *data, struct msi_msg *msg);
364 void (*irq_write_msi_msg)(struct irq_data *data, struct msi_msg *msg); 367 void (*irq_write_msi_msg)(struct irq_data *data, struct msi_msg *msg);
365 368
369 int (*irq_get_irqchip_state)(struct irq_data *data, enum irqchip_irq_state which, bool *state);
370 int (*irq_set_irqchip_state)(struct irq_data *data, enum irqchip_irq_state which, bool state);
371
366 unsigned long flags; 372 unsigned long flags;
367}; 373};
368 374
@@ -460,6 +466,7 @@ extern void irq_chip_eoi_parent(struct irq_data *data);
460extern int irq_chip_set_affinity_parent(struct irq_data *data, 466extern int irq_chip_set_affinity_parent(struct irq_data *data,
461 const struct cpumask *dest, 467 const struct cpumask *dest,
462 bool force); 468 bool force);
469extern int irq_chip_set_wake_parent(struct irq_data *data, unsigned int on);
463#endif 470#endif
464 471
465/* Handling of unhandled and spurious interrupts: */ 472/* Handling of unhandled and spurious interrupts: */
diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h
index bf3fe719c7ce..47b9ebd4a74f 100644
--- a/include/linux/irq_work.h
+++ b/include/linux/irq_work.h
@@ -38,16 +38,17 @@ bool irq_work_queue(struct irq_work *work);
38bool irq_work_queue_on(struct irq_work *work, int cpu); 38bool irq_work_queue_on(struct irq_work *work, int cpu);
39#endif 39#endif
40 40
41void irq_work_run(void);
42void irq_work_tick(void); 41void irq_work_tick(void);
43void irq_work_sync(struct irq_work *work); 42void irq_work_sync(struct irq_work *work);
44 43
45#ifdef CONFIG_IRQ_WORK 44#ifdef CONFIG_IRQ_WORK
46#include <asm/irq_work.h> 45#include <asm/irq_work.h>
47 46
47void irq_work_run(void);
48bool irq_work_needs_cpu(void); 48bool irq_work_needs_cpu(void);
49#else 49#else
50static inline bool irq_work_needs_cpu(void) { return false; } 50static inline bool irq_work_needs_cpu(void) { return false; }
51static inline void irq_work_run(void) { }
51#endif 52#endif
52 53
53#endif /* _LINUX_IRQ_WORK_H */ 54#endif /* _LINUX_IRQ_WORK_H */
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index 71d706d5f169..36ec4ae74634 100644
--- a/include/linux/irqchip/arm-gic.h
+++ b/include/linux/irqchip/arm-gic.h
@@ -97,6 +97,7 @@ struct device_node;
97 97
98extern struct irq_chip gic_arch_extn; 98extern struct irq_chip gic_arch_extn;
99 99
100void gic_set_irqchip_flags(unsigned long flags);
100void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *, 101void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *,
101 u32 offset, struct device_node *); 102 u32 offset, struct device_node *);
102void gic_cascade_irq(unsigned int gic_nr, unsigned int irq); 103void gic_cascade_irq(unsigned int gic_nr, unsigned int irq);
@@ -115,11 +116,5 @@ int gic_get_cpu_id(unsigned int cpu);
115void gic_migrate_target(unsigned int new_cpu_id); 116void gic_migrate_target(unsigned int new_cpu_id);
116unsigned long gic_get_sgir_physaddr(void); 117unsigned long gic_get_sgir_physaddr(void);
117 118
118extern const struct irq_domain_ops *gic_routable_irq_domain_ops;
119static inline void __init register_routable_domain_ops
120 (const struct irq_domain_ops *ops)
121{
122 gic_routable_irq_domain_ops = ops;
123}
124#endif /* __ASSEMBLY */ 119#endif /* __ASSEMBLY */
125#endif 120#endif
diff --git a/include/linux/irqchip/irq-crossbar.h b/include/linux/irqchip/irq-crossbar.h
deleted file mode 100644
index e5537b81df8d..000000000000
--- a/include/linux/irqchip/irq-crossbar.h
+++ /dev/null
@@ -1,11 +0,0 @@
1/*
2 * drivers/irqchip/irq-crossbar.h
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.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 */
11int irqcrossbar_init(void);
diff --git a/include/linux/irqchip/mips-gic.h b/include/linux/irqchip/mips-gic.h
index e6a6aac451db..9b1ad3734911 100644
--- a/include/linux/irqchip/mips-gic.h
+++ b/include/linux/irqchip/mips-gic.h
@@ -165,6 +165,8 @@
165#define GIC_VPE_PEND_SWINT0_MSK (MSK(1) << GIC_VPE_PEND_SWINT0_SHF) 165#define GIC_VPE_PEND_SWINT0_MSK (MSK(1) << GIC_VPE_PEND_SWINT0_SHF)
166#define GIC_VPE_PEND_SWINT1_SHF 5 166#define GIC_VPE_PEND_SWINT1_SHF 5
167#define GIC_VPE_PEND_SWINT1_MSK (MSK(1) << GIC_VPE_PEND_SWINT1_SHF) 167#define GIC_VPE_PEND_SWINT1_MSK (MSK(1) << GIC_VPE_PEND_SWINT1_SHF)
168#define GIC_VPE_PEND_FDC_SHF 6
169#define GIC_VPE_PEND_FDC_MSK (MSK(1) << GIC_VPE_PEND_FDC_SHF)
168 170
169/* GIC_VPE_RMASK Masks */ 171/* GIC_VPE_RMASK Masks */
170#define GIC_VPE_RMASK_WD_SHF 0 172#define GIC_VPE_RMASK_WD_SHF 0
@@ -179,6 +181,8 @@
179#define GIC_VPE_RMASK_SWINT0_MSK (MSK(1) << GIC_VPE_RMASK_SWINT0_SHF) 181#define GIC_VPE_RMASK_SWINT0_MSK (MSK(1) << GIC_VPE_RMASK_SWINT0_SHF)
180#define GIC_VPE_RMASK_SWINT1_SHF 5 182#define GIC_VPE_RMASK_SWINT1_SHF 5
181#define GIC_VPE_RMASK_SWINT1_MSK (MSK(1) << GIC_VPE_RMASK_SWINT1_SHF) 183#define GIC_VPE_RMASK_SWINT1_MSK (MSK(1) << GIC_VPE_RMASK_SWINT1_SHF)
184#define GIC_VPE_RMASK_FDC_SHF 6
185#define GIC_VPE_RMASK_FDC_MSK (MSK(1) << GIC_VPE_RMASK_FDC_SHF)
182 186
183/* GIC_VPE_SMASK Masks */ 187/* GIC_VPE_SMASK Masks */
184#define GIC_VPE_SMASK_WD_SHF 0 188#define GIC_VPE_SMASK_WD_SHF 0
@@ -193,6 +197,8 @@
193#define GIC_VPE_SMASK_SWINT0_MSK (MSK(1) << GIC_VPE_SMASK_SWINT0_SHF) 197#define GIC_VPE_SMASK_SWINT0_MSK (MSK(1) << GIC_VPE_SMASK_SWINT0_SHF)
194#define GIC_VPE_SMASK_SWINT1_SHF 5 198#define GIC_VPE_SMASK_SWINT1_SHF 5
195#define GIC_VPE_SMASK_SWINT1_MSK (MSK(1) << GIC_VPE_SMASK_SWINT1_SHF) 199#define GIC_VPE_SMASK_SWINT1_MSK (MSK(1) << GIC_VPE_SMASK_SWINT1_SHF)
200#define GIC_VPE_SMASK_FDC_SHF 6
201#define GIC_VPE_SMASK_FDC_MSK (MSK(1) << GIC_VPE_SMASK_FDC_SHF)
196 202
197/* GIC nomenclature for Core Interrupt Pins. */ 203/* GIC nomenclature for Core Interrupt Pins. */
198#define GIC_CPU_INT0 0 /* Core Interrupt 2 */ 204#define GIC_CPU_INT0 0 /* Core Interrupt 2 */
@@ -240,9 +246,12 @@ extern unsigned int gic_get_count_width(void);
240extern cycle_t gic_read_compare(void); 246extern cycle_t gic_read_compare(void);
241extern void gic_write_compare(cycle_t cnt); 247extern void gic_write_compare(cycle_t cnt);
242extern void gic_write_cpu_compare(cycle_t cnt, int cpu); 248extern void gic_write_cpu_compare(cycle_t cnt, int cpu);
249extern void gic_start_count(void);
250extern void gic_stop_count(void);
243extern void gic_send_ipi(unsigned int intr); 251extern void gic_send_ipi(unsigned int intr);
244extern unsigned int plat_ipi_call_int_xlate(unsigned int); 252extern unsigned int plat_ipi_call_int_xlate(unsigned int);
245extern unsigned int plat_ipi_resched_int_xlate(unsigned int); 253extern unsigned int plat_ipi_resched_int_xlate(unsigned int);
246extern int gic_get_c0_compare_int(void); 254extern int gic_get_c0_compare_int(void);
247extern int gic_get_c0_perfcount_int(void); 255extern int gic_get_c0_perfcount_int(void);
256extern int gic_get_c0_fdc_int(void);
248#endif /* __LINUX_IRQCHIP_MIPS_GIC_H */ 257#endif /* __LINUX_IRQCHIP_MIPS_GIC_H */
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
index d176d658fe25..5dd1272d1ab2 100644
--- a/include/linux/irqflags.h
+++ b/include/linux/irqflags.h
@@ -85,7 +85,7 @@
85 * The local_irq_*() APIs are equal to the raw_local_irq*() 85 * The local_irq_*() APIs are equal to the raw_local_irq*()
86 * if !TRACE_IRQFLAGS. 86 * if !TRACE_IRQFLAGS.
87 */ 87 */
88#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT 88#ifdef CONFIG_TRACE_IRQFLAGS
89#define local_irq_enable() \ 89#define local_irq_enable() \
90 do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0) 90 do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0)
91#define local_irq_disable() \ 91#define local_irq_disable() \
@@ -107,22 +107,6 @@
107 raw_local_irq_restore(flags); \ 107 raw_local_irq_restore(flags); \
108 } \ 108 } \
109 } while (0) 109 } while (0)
110#define local_save_flags(flags) \
111 do { \
112 raw_local_save_flags(flags); \
113 } while (0)
114
115#define irqs_disabled_flags(flags) \
116 ({ \
117 raw_irqs_disabled_flags(flags); \
118 })
119
120#define irqs_disabled() \
121 ({ \
122 unsigned long _flags; \
123 raw_local_save_flags(_flags); \
124 raw_irqs_disabled_flags(_flags); \
125 })
126 110
127#define safe_halt() \ 111#define safe_halt() \
128 do { \ 112 do { \
@@ -131,7 +115,7 @@
131 } while (0) 115 } while (0)
132 116
133 117
134#else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */ 118#else /* !CONFIG_TRACE_IRQFLAGS */
135 119
136#define local_irq_enable() do { raw_local_irq_enable(); } while (0) 120#define local_irq_enable() do { raw_local_irq_enable(); } while (0)
137#define local_irq_disable() do { raw_local_irq_disable(); } while (0) 121#define local_irq_disable() do { raw_local_irq_disable(); } while (0)
@@ -140,11 +124,28 @@
140 raw_local_irq_save(flags); \ 124 raw_local_irq_save(flags); \
141 } while (0) 125 } while (0)
142#define local_irq_restore(flags) do { raw_local_irq_restore(flags); } while (0) 126#define local_irq_restore(flags) do { raw_local_irq_restore(flags); } while (0)
143#define local_save_flags(flags) do { raw_local_save_flags(flags); } while (0)
144#define irqs_disabled() (raw_irqs_disabled())
145#define irqs_disabled_flags(flags) (raw_irqs_disabled_flags(flags))
146#define safe_halt() do { raw_safe_halt(); } while (0) 127#define safe_halt() do { raw_safe_halt(); } while (0)
147 128
129#endif /* CONFIG_TRACE_IRQFLAGS */
130
131#define local_save_flags(flags) raw_local_save_flags(flags)
132
133/*
134 * Some architectures don't define arch_irqs_disabled(), so even if either
135 * definition would be fine we need to use different ones for the time being
136 * to avoid build issues.
137 */
138#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
139#define irqs_disabled() \
140 ({ \
141 unsigned long _flags; \
142 raw_local_save_flags(_flags); \
143 raw_irqs_disabled_flags(_flags); \
144 })
145#else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */
146#define irqs_disabled() raw_irqs_disabled()
148#endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */ 147#endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */
149 148
149#define irqs_disabled_flags(flags) raw_irqs_disabled_flags(flags)
150
150#endif 151#endif
diff --git a/include/linux/jhash.h b/include/linux/jhash.h
index 47cb09edec1a..348c6f47e4cc 100644
--- a/include/linux/jhash.h
+++ b/include/linux/jhash.h
@@ -145,11 +145,11 @@ static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
145} 145}
146 146
147 147
148/* jhash_3words - hash exactly 3, 2 or 1 word(s) */ 148/* __jhash_nwords - hash exactly 3, 2 or 1 word(s) */
149static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval) 149static inline u32 __jhash_nwords(u32 a, u32 b, u32 c, u32 initval)
150{ 150{
151 a += JHASH_INITVAL; 151 a += initval;
152 b += JHASH_INITVAL; 152 b += initval;
153 c += initval; 153 c += initval;
154 154
155 __jhash_final(a, b, c); 155 __jhash_final(a, b, c);
@@ -157,14 +157,19 @@ static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval)
157 return c; 157 return c;
158} 158}
159 159
160static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval)
161{
162 return __jhash_nwords(a, b, c, initval + JHASH_INITVAL + (3 << 2));
163}
164
160static inline u32 jhash_2words(u32 a, u32 b, u32 initval) 165static inline u32 jhash_2words(u32 a, u32 b, u32 initval)
161{ 166{
162 return jhash_3words(a, b, 0, initval); 167 return __jhash_nwords(a, b, 0, initval + JHASH_INITVAL + (2 << 2));
163} 168}
164 169
165static inline u32 jhash_1word(u32 a, u32 initval) 170static inline u32 jhash_1word(u32 a, u32 initval)
166{ 171{
167 return jhash_3words(a, 0, 0, initval); 172 return __jhash_nwords(a, 0, 0, initval + JHASH_INITVAL + (1 << 2));
168} 173}
169 174
170#endif /* _LINUX_JHASH_H */ 175#endif /* _LINUX_JHASH_H */
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 98f923b6a0ea..f4de473f226b 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -45,6 +45,12 @@
45 * same as using STATIC_KEY_INIT_FALSE. 45 * same as using STATIC_KEY_INIT_FALSE.
46 */ 46 */
47 47
48#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
49# define HAVE_JUMP_LABEL
50#endif
51
52#ifndef __ASSEMBLY__
53
48#include <linux/types.h> 54#include <linux/types.h>
49#include <linux/compiler.h> 55#include <linux/compiler.h>
50#include <linux/bug.h> 56#include <linux/bug.h>
@@ -55,7 +61,7 @@ extern bool static_key_initialized;
55 "%s used before call to jump_label_init", \ 61 "%s used before call to jump_label_init", \
56 __func__) 62 __func__)
57 63
58#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) 64#ifdef HAVE_JUMP_LABEL
59 65
60struct static_key { 66struct static_key {
61 atomic_t enabled; 67 atomic_t enabled;
@@ -66,13 +72,18 @@ struct static_key {
66#endif 72#endif
67}; 73};
68 74
69# include <asm/jump_label.h>
70# define HAVE_JUMP_LABEL
71#else 75#else
72struct static_key { 76struct static_key {
73 atomic_t enabled; 77 atomic_t enabled;
74}; 78};
75#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */ 79#endif /* HAVE_JUMP_LABEL */
80#endif /* __ASSEMBLY__ */
81
82#ifdef HAVE_JUMP_LABEL
83#include <asm/jump_label.h>
84#endif
85
86#ifndef __ASSEMBLY__
76 87
77enum jump_label_type { 88enum jump_label_type {
78 JUMP_LABEL_DISABLE = 0, 89 JUMP_LABEL_DISABLE = 0,
@@ -203,3 +214,5 @@ static inline bool static_key_enabled(struct static_key *key)
203} 214}
204 215
205#endif /* _LINUX_JUMP_LABEL_H */ 216#endif /* _LINUX_JUMP_LABEL_H */
217
218#endif /* __ASSEMBLY__ */
diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index 5bb074431eb0..5486d777b706 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -44,6 +44,7 @@ void kasan_poison_object_data(struct kmem_cache *cache, void *object);
44 44
45void kasan_kmalloc_large(const void *ptr, size_t size); 45void kasan_kmalloc_large(const void *ptr, size_t size);
46void kasan_kfree_large(const void *ptr); 46void kasan_kfree_large(const void *ptr);
47void kasan_kfree(void *ptr);
47void kasan_kmalloc(struct kmem_cache *s, const void *object, size_t size); 48void kasan_kmalloc(struct kmem_cache *s, const void *object, size_t size);
48void kasan_krealloc(const void *object, size_t new_size); 49void kasan_krealloc(const void *object, size_t new_size);
49 50
@@ -71,6 +72,7 @@ static inline void kasan_poison_object_data(struct kmem_cache *cache,
71 72
72static inline void kasan_kmalloc_large(void *ptr, size_t size) {} 73static inline void kasan_kmalloc_large(void *ptr, size_t size) {}
73static inline void kasan_kfree_large(const void *ptr) {} 74static inline void kasan_kfree_large(const void *ptr) {}
75static inline void kasan_kfree(void *ptr) {}
74static inline void kasan_kmalloc(struct kmem_cache *s, const void *object, 76static inline void kasan_kmalloc(struct kmem_cache *s, const void *object,
75 size_t size) {} 77 size_t size) {}
76static inline void kasan_krealloc(const void *object, size_t new_size) {} 78static inline void kasan_krealloc(const void *object, size_t new_size) {}
diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
index be342b94c640..63ca8dacec59 100644
--- a/include/linux/kconfig.h
+++ b/include/linux/kconfig.h
@@ -23,14 +23,6 @@
23#define ___config_enabled(__ignored, val, ...) val 23#define ___config_enabled(__ignored, val, ...) val
24 24
25/* 25/*
26 * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',
27 * 0 otherwise.
28 *
29 */
30#define IS_ENABLED(option) \
31 (config_enabled(option) || config_enabled(option##_MODULE))
32
33/*
34 * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0 26 * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0
35 * otherwise. For boolean options, this is equivalent to 27 * otherwise. For boolean options, this is equivalent to
36 * IS_ENABLED(CONFIG_FOO). 28 * IS_ENABLED(CONFIG_FOO).
@@ -43,4 +35,11 @@
43 */ 35 */
44#define IS_MODULE(option) config_enabled(option##_MODULE) 36#define IS_MODULE(option) config_enabled(option##_MODULE)
45 37
38/*
39 * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',
40 * 0 otherwise.
41 */
42#define IS_ENABLED(option) \
43 (IS_BUILTIN(option) || IS_MODULE(option))
44
46#endif /* __LINUX_KCONFIG_H */ 45#endif /* __LINUX_KCONFIG_H */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index d6d630d31ef3..3a5b48e52a9e 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -103,6 +103,18 @@
103 (((__x) - ((__d) / 2)) / (__d)); \ 103 (((__x) - ((__d) / 2)) / (__d)); \
104} \ 104} \
105) 105)
106/*
107 * Same as above but for u64 dividends. divisor must be a 32-bit
108 * number.
109 */
110#define DIV_ROUND_CLOSEST_ULL(x, divisor)( \
111{ \
112 typeof(divisor) __d = divisor; \
113 unsigned long long _tmp = (x) + (__d) / 2; \
114 do_div(_tmp, __d); \
115 _tmp; \
116} \
117)
106 118
107/* 119/*
108 * Multiplies an integer by a fraction, while avoiding unnecessary 120 * Multiplies an integer by a fraction, while avoiding unnecessary
diff --git a/include/linux/ksm.h b/include/linux/ksm.h
index 3be6bb18562d..7ae216a39c9e 100644
--- a/include/linux/ksm.h
+++ b/include/linux/ksm.h
@@ -35,18 +35,6 @@ static inline void ksm_exit(struct mm_struct *mm)
35 __ksm_exit(mm); 35 __ksm_exit(mm);
36} 36}
37 37
38/*
39 * A KSM page is one of those write-protected "shared pages" or "merged pages"
40 * which KSM maps into multiple mms, wherever identical anonymous page content
41 * is found in VM_MERGEABLE vmas. It's a PageAnon page, pointing not to any
42 * anon_vma, but to that page's node of the stable tree.
43 */
44static inline int PageKsm(struct page *page)
45{
46 return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) ==
47 (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM);
48}
49
50static inline struct stable_node *page_stable_node(struct page *page) 38static inline struct stable_node *page_stable_node(struct page *page)
51{ 39{
52 return PageKsm(page) ? page_rmapping(page) : NULL; 40 return PageKsm(page) ? page_rmapping(page) : NULL;
@@ -87,11 +75,6 @@ static inline void ksm_exit(struct mm_struct *mm)
87{ 75{
88} 76}
89 77
90static inline int PageKsm(struct page *page)
91{
92 return 0;
93}
94
95#ifdef CONFIG_MMU 78#ifdef CONFIG_MMU
96static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start, 79static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
97 unsigned long end, int advice, unsigned long *vm_flags) 80 unsigned long end, int advice, unsigned long *vm_flags)
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index d12b2104d19b..ad45054309a0 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -165,12 +165,12 @@ enum kvm_bus {
165 KVM_NR_BUSES 165 KVM_NR_BUSES
166}; 166};
167 167
168int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, 168int kvm_io_bus_write(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, gpa_t addr,
169 int len, const void *val); 169 int len, const void *val);
170int kvm_io_bus_write_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, 170int kvm_io_bus_write_cookie(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx,
171 int len, const void *val, long cookie); 171 gpa_t addr, int len, const void *val, long cookie);
172int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, int len, 172int kvm_io_bus_read(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, gpa_t addr,
173 void *val); 173 int len, void *val);
174int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, 174int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
175 int len, struct kvm_io_device *dev); 175 int len, struct kvm_io_device *dev);
176int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, 176int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
@@ -658,7 +658,6 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
658int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu); 658int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu);
659 659
660void *kvm_kvzalloc(unsigned long size); 660void *kvm_kvzalloc(unsigned long size);
661void kvm_kvfree(const void *addr);
662 661
663#ifndef __KVM_HAVE_ARCH_VM_ALLOC 662#ifndef __KVM_HAVE_ARCH_VM_ALLOC
664static inline struct kvm *kvm_arch_alloc_vm(void) 663static inline struct kvm *kvm_arch_alloc_vm(void)
@@ -700,6 +699,20 @@ static inline wait_queue_head_t *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu)
700#endif 699#endif
701} 700}
702 701
702#ifdef __KVM_HAVE_ARCH_INTC_INITIALIZED
703/*
704 * returns true if the virtual interrupt controller is initialized and
705 * ready to accept virtual IRQ. On some architectures the virtual interrupt
706 * controller is dynamically instantiated and this is not always true.
707 */
708bool kvm_arch_intc_initialized(struct kvm *kvm);
709#else
710static inline bool kvm_arch_intc_initialized(struct kvm *kvm)
711{
712 return true;
713}
714#endif
715
703int kvm_arch_init_vm(struct kvm *kvm, unsigned long type); 716int kvm_arch_init_vm(struct kvm *kvm, unsigned long type);
704void kvm_arch_destroy_vm(struct kvm *kvm); 717void kvm_arch_destroy_vm(struct kvm *kvm);
705void kvm_arch_sync_events(struct kvm *kvm); 718void kvm_arch_sync_events(struct kvm *kvm);
@@ -766,7 +779,8 @@ static inline void kvm_guest_enter(void)
766 * one time slice). Lets treat guest mode as quiescent state, just like 779 * one time slice). Lets treat guest mode as quiescent state, just like
767 * we do with user-mode execution. 780 * we do with user-mode execution.
768 */ 781 */
769 rcu_virt_note_context_switch(smp_processor_id()); 782 if (!context_tracking_cpu_is_enabled())
783 rcu_virt_note_context_switch(smp_processor_id());
770} 784}
771 785
772static inline void kvm_guest_exit(void) 786static inline void kvm_guest_exit(void)
@@ -969,11 +983,16 @@ static inline int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
969#endif /* CONFIG_HAVE_KVM_EVENTFD */ 983#endif /* CONFIG_HAVE_KVM_EVENTFD */
970 984
971#ifdef CONFIG_KVM_APIC_ARCHITECTURE 985#ifdef CONFIG_KVM_APIC_ARCHITECTURE
972static inline bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu) 986static inline bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu)
973{ 987{
974 return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id; 988 return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id;
975} 989}
976 990
991static inline bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu)
992{
993 return (vcpu->arch.apic_base & MSR_IA32_APICBASE_BSP) != 0;
994}
995
977bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu); 996bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu);
978 997
979#else 998#else
diff --git a/include/linux/led-class-flash.h b/include/linux/led-class-flash.h
index 5ba2facd7a51..e97966d1fb8d 100644
--- a/include/linux/led-class-flash.h
+++ b/include/linux/led-class-flash.h
@@ -13,7 +13,6 @@
13#define __LINUX_FLASH_LEDS_H_INCLUDED 13#define __LINUX_FLASH_LEDS_H_INCLUDED
14 14
15#include <linux/leds.h> 15#include <linux/leds.h>
16#include <uapi/linux/v4l2-controls.h>
17 16
18struct device_node; 17struct device_node;
19struct led_classdev_flash; 18struct led_classdev_flash;
@@ -33,7 +32,7 @@ struct led_classdev_flash;
33#define LED_FAULT_LED_OVER_TEMPERATURE (1 << 8) 32#define LED_FAULT_LED_OVER_TEMPERATURE (1 << 8)
34#define LED_NUM_FLASH_FAULTS 9 33#define LED_NUM_FLASH_FAULTS 9
35 34
36#define LED_FLASH_MAX_SYSFS_GROUPS 7 35#define LED_FLASH_SYSFS_GROUPS_SIZE 5
37 36
38struct led_flash_ops { 37struct led_flash_ops {
39 /* set flash brightness */ 38 /* set flash brightness */
@@ -81,21 +80,7 @@ struct led_classdev_flash {
81 struct led_flash_setting timeout; 80 struct led_flash_setting timeout;
82 81
83 /* LED Flash class sysfs groups */ 82 /* LED Flash class sysfs groups */
84 const struct attribute_group *sysfs_groups[LED_FLASH_MAX_SYSFS_GROUPS]; 83 const struct attribute_group *sysfs_groups[LED_FLASH_SYSFS_GROUPS_SIZE];
85
86 /* LEDs available for flash strobe synchronization */
87 struct led_classdev_flash **sync_leds;
88
89 /* Number of LEDs available for flash strobe synchronization */
90 int num_sync_leds;
91
92 /*
93 * The identifier of the sub-led to synchronize the flash strobe with.
94 * Identifiers start from 1, which reflects the first element from the
95 * sync_leds array. 0 means that the flash strobe should not be
96 * synchronized.
97 */
98 u32 sync_led_id;
99}; 84};
100 85
101static inline struct led_classdev_flash *lcdev_to_flcdev( 86static inline struct led_classdev_flash *lcdev_to_flcdev(
diff --git a/include/linux/leds.h b/include/linux/leds.h
index f70f84f35674..9a2b000094cf 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -47,7 +47,6 @@ struct led_classdev {
47#define SET_BRIGHTNESS_ASYNC (1 << 21) 47#define SET_BRIGHTNESS_ASYNC (1 << 21)
48#define SET_BRIGHTNESS_SYNC (1 << 22) 48#define SET_BRIGHTNESS_SYNC (1 << 22)
49#define LED_DEV_CAP_FLASH (1 << 23) 49#define LED_DEV_CAP_FLASH (1 << 23)
50#define LED_DEV_CAP_SYNC_STROBE (1 << 24)
51 50
52 /* Set LED brightness level */ 51 /* Set LED brightness level */
53 /* Must not sleep, use a workqueue if needed */ 52 /* Must not sleep, use a workqueue if needed */
@@ -105,7 +104,11 @@ struct led_classdev {
105 104
106extern int led_classdev_register(struct device *parent, 105extern int led_classdev_register(struct device *parent,
107 struct led_classdev *led_cdev); 106 struct led_classdev *led_cdev);
107extern int devm_led_classdev_register(struct device *parent,
108 struct led_classdev *led_cdev);
108extern void led_classdev_unregister(struct led_classdev *led_cdev); 109extern void led_classdev_unregister(struct led_classdev *led_cdev);
110extern void devm_led_classdev_unregister(struct device *parent,
111 struct led_classdev *led_cdev);
109extern void led_classdev_suspend(struct led_classdev *led_cdev); 112extern void led_classdev_suspend(struct led_classdev *led_cdev);
110extern void led_classdev_resume(struct led_classdev *led_cdev); 113extern void led_classdev_resume(struct led_classdev *led_cdev);
111 114
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 6b08cc106c21..8dad4a307bb8 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -231,8 +231,7 @@ enum {
231 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity 231 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity
232 * led */ 232 * led */
233 ATA_FLAG_NO_DIPM = (1 << 23), /* host not happy with DIPM */ 233 ATA_FLAG_NO_DIPM = (1 << 23), /* host not happy with DIPM */
234 ATA_FLAG_LOWTAG = (1 << 24), /* host wants lowest available tag */ 234 ATA_FLAG_SAS_HOST = (1 << 24), /* SAS host */
235 ATA_FLAG_SAS_HOST = (1 << 25), /* SAS host */
236 235
237 /* bits 24:31 of ap->flags are reserved for LLD specific flags */ 236 /* bits 24:31 of ap->flags are reserved for LLD specific flags */
238 237
diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h
index 95023fd8b00d..ee6dbb39a809 100644
--- a/include/linux/livepatch.h
+++ b/include/linux/livepatch.h
@@ -123,10 +123,10 @@ struct klp_patch {
123 enum klp_state state; 123 enum klp_state state;
124}; 124};
125 125
126extern int klp_register_patch(struct klp_patch *); 126int klp_register_patch(struct klp_patch *);
127extern int klp_unregister_patch(struct klp_patch *); 127int klp_unregister_patch(struct klp_patch *);
128extern int klp_enable_patch(struct klp_patch *); 128int klp_enable_patch(struct klp_patch *);
129extern int klp_disable_patch(struct klp_patch *); 129int klp_disable_patch(struct klp_patch *);
130 130
131#endif /* CONFIG_LIVEPATCH */ 131#endif /* CONFIG_LIVEPATCH */
132 132
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 74ab23176e9b..066ba4157541 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -531,8 +531,13 @@ do { \
531# define might_lock_read(lock) do { } while (0) 531# define might_lock_read(lock) do { } while (0)
532#endif 532#endif
533 533
534#ifdef CONFIG_PROVE_RCU 534#ifdef CONFIG_LOCKDEP
535void lockdep_rcu_suspicious(const char *file, const int line, const char *s); 535void lockdep_rcu_suspicious(const char *file, const int line, const char *s);
536#else
537static inline void
538lockdep_rcu_suspicious(const char *file, const int line, const char *s)
539{
540}
536#endif 541#endif
537 542
538#endif /* __LINUX_LOCKDEP_H */ 543#endif /* __LINUX_LOCKDEP_H */
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index e8cc45307f8f..9497ec7c77ea 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -365,6 +365,14 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo
365#define __initdata_memblock 365#define __initdata_memblock
366#endif 366#endif
367 367
368#ifdef CONFIG_MEMTEST
369extern void early_memtest(phys_addr_t start, phys_addr_t end);
370#else
371static inline void early_memtest(phys_addr_t start, phys_addr_t end)
372{
373}
374#endif
375
368#else 376#else
369static inline phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align) 377static inline phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align)
370{ 378{
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 8f1a41951df9..6ffa0ac7f7d6 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -192,6 +192,9 @@ extern void get_page_bootmem(unsigned long ingo, struct page *page,
192void get_online_mems(void); 192void get_online_mems(void);
193void put_online_mems(void); 193void put_online_mems(void);
194 194
195void mem_hotplug_begin(void);
196void mem_hotplug_done(void);
197
195#else /* ! CONFIG_MEMORY_HOTPLUG */ 198#else /* ! CONFIG_MEMORY_HOTPLUG */
196/* 199/*
197 * Stub functions for when hotplug is off 200 * Stub functions for when hotplug is off
@@ -231,6 +234,9 @@ static inline int try_online_node(int nid)
231static inline void get_online_mems(void) {} 234static inline void get_online_mems(void) {}
232static inline void put_online_mems(void) {} 235static inline void put_online_mems(void) {}
233 236
237static inline void mem_hotplug_begin(void) {}
238static inline void mem_hotplug_done(void) {}
239
234#endif /* ! CONFIG_MEMORY_HOTPLUG */ 240#endif /* ! CONFIG_MEMORY_HOTPLUG */
235 241
236#ifdef CONFIG_MEMORY_HOTREMOVE 242#ifdef CONFIG_MEMORY_HOTREMOVE
diff --git a/include/linux/mempool.h b/include/linux/mempool.h
index 39ed62ab5b8a..69b6951e8fd2 100644
--- a/include/linux/mempool.h
+++ b/include/linux/mempool.h
@@ -29,14 +29,15 @@ extern mempool_t *mempool_create_node(int min_nr, mempool_alloc_t *alloc_fn,
29 mempool_free_t *free_fn, void *pool_data, 29 mempool_free_t *free_fn, void *pool_data,
30 gfp_t gfp_mask, int nid); 30 gfp_t gfp_mask, int nid);
31 31
32extern int mempool_resize(mempool_t *pool, int new_min_nr, gfp_t gfp_mask); 32extern int mempool_resize(mempool_t *pool, int new_min_nr);
33extern void mempool_destroy(mempool_t *pool); 33extern void mempool_destroy(mempool_t *pool);
34extern void * mempool_alloc(mempool_t *pool, gfp_t gfp_mask); 34extern void * mempool_alloc(mempool_t *pool, gfp_t gfp_mask);
35extern void mempool_free(void *element, mempool_t *pool); 35extern void mempool_free(void *element, mempool_t *pool);
36 36
37/* 37/*
38 * A mempool_alloc_t and mempool_free_t that get the memory from 38 * A mempool_alloc_t and mempool_free_t that get the memory from
39 * a slab that is passed in through pool_data. 39 * a slab cache that is passed in through pool_data.
40 * Note: the slab cache may not have a ctor function.
40 */ 41 */
41void *mempool_alloc_slab(gfp_t gfp_mask, void *pool_data); 42void *mempool_alloc_slab(gfp_t gfp_mask, void *pool_data);
42void mempool_free_slab(void *element, void *pool_data); 43void mempool_free_slab(void *element, void *pool_data);
diff --git a/include/linux/mfd/abx500/ux500_chargalg.h b/include/linux/mfd/abx500/ux500_chargalg.h
index 234c99143bf7..67703f23e7ba 100644
--- a/include/linux/mfd/abx500/ux500_chargalg.h
+++ b/include/linux/mfd/abx500/ux500_chargalg.h
@@ -9,8 +9,13 @@
9 9
10#include <linux/power_supply.h> 10#include <linux/power_supply.h>
11 11
12#define psy_to_ux500_charger(x) container_of((x), \ 12/*
13 struct ux500_charger, psy) 13 * Valid only for supplies of type:
14 * - POWER_SUPPLY_TYPE_MAINS,
15 * - POWER_SUPPLY_TYPE_USB,
16 * because only them store as drv_data pointer to struct ux500_charger.
17 */
18#define psy_to_ux500_charger(x) power_supply_get_drvdata(psy)
14 19
15/* Forward declaration */ 20/* Forward declaration */
16struct ux500_charger; 21struct ux500_charger;
@@ -35,7 +40,7 @@ struct ux500_charger_ops {
35 * @power_path USB power path support 40 * @power_path USB power path support
36 */ 41 */
37struct ux500_charger { 42struct ux500_charger {
38 struct power_supply psy; 43 struct power_supply *psy;
39 struct ux500_charger_ops ops; 44 struct ux500_charger_ops ops;
40 int max_out_volt; 45 int max_out_volt;
41 int max_out_curr; 46 int max_out_curr;
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index 910e3aa1e965..f97010576f56 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -24,6 +24,7 @@ enum arizona_type {
24 WM5102 = 1, 24 WM5102 = 1,
25 WM5110 = 2, 25 WM5110 = 2,
26 WM8997 = 3, 26 WM8997 = 3,
27 WM8280 = 4,
27}; 28};
28 29
29#define ARIZONA_IRQ_GP1 0 30#define ARIZONA_IRQ_GP1 0
diff --git a/include/linux/mfd/arizona/gpio.h b/include/linux/mfd/arizona/gpio.h
deleted file mode 100644
index d2146bb74f89..000000000000
--- a/include/linux/mfd/arizona/gpio.h
+++ /dev/null
@@ -1,96 +0,0 @@
1/*
2 * GPIO configuration for Arizona devices
3 *
4 * Copyright 2013 Wolfson Microelectronics. PLC.
5 *
6 * Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.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 version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef _ARIZONA_GPIO_H
14#define _ARIZONA_GPIO_H
15
16#define ARIZONA_GP_FN_TXLRCLK 0x00
17#define ARIZONA_GP_FN_GPIO 0x01
18#define ARIZONA_GP_FN_IRQ1 0x02
19#define ARIZONA_GP_FN_IRQ2 0x03
20#define ARIZONA_GP_FN_OPCLK 0x04
21#define ARIZONA_GP_FN_FLL1_OUT 0x05
22#define ARIZONA_GP_FN_FLL2_OUT 0x06
23#define ARIZONA_GP_FN_PWM1 0x08
24#define ARIZONA_GP_FN_PWM2 0x09
25#define ARIZONA_GP_FN_SYSCLK_UNDERCLOCKED 0x0A
26#define ARIZONA_GP_FN_ASYNCCLK_UNDERCLOCKED 0x0B
27#define ARIZONA_GP_FN_FLL1_LOCK 0x0C
28#define ARIZONA_GP_FN_FLL2_LOCK 0x0D
29#define ARIZONA_GP_FN_FLL1_CLOCK_OK 0x0F
30#define ARIZONA_GP_FN_FLL2_CLOCK_OK 0x10
31#define ARIZONA_GP_FN_HEADPHONE_DET 0x12
32#define ARIZONA_GP_FN_MIC_DET 0x13
33#define ARIZONA_GP_FN_WSEQ_STATUS 0x15
34#define ARIZONA_GP_FN_CIF_ADDRESS_ERROR 0x16
35#define ARIZONA_GP_FN_ASRC1_LOCK 0x1A
36#define ARIZONA_GP_FN_ASRC2_LOCK 0x1B
37#define ARIZONA_GP_FN_ASRC_CONFIG_ERROR 0x1C
38#define ARIZONA_GP_FN_DRC1_SIGNAL_DETECT 0x1D
39#define ARIZONA_GP_FN_DRC1_ANTICLIP 0x1E
40#define ARIZONA_GP_FN_DRC1_DECAY 0x1F
41#define ARIZONA_GP_FN_DRC1_NOISE 0x20
42#define ARIZONA_GP_FN_DRC1_QUICK_RELEASE 0x21
43#define ARIZONA_GP_FN_DRC2_SIGNAL_DETECT 0x22
44#define ARIZONA_GP_FN_DRC2_ANTICLIP 0x23
45#define ARIZONA_GP_FN_DRC2_DECAY 0x24
46#define ARIZONA_GP_FN_DRC2_NOISE 0x25
47#define ARIZONA_GP_FN_DRC2_QUICK_RELEASE 0x26
48#define ARIZONA_GP_FN_MIXER_DROPPED_SAMPLE 0x27
49#define ARIZONA_GP_FN_AIF1_CONFIG_ERROR 0x28
50#define ARIZONA_GP_FN_AIF2_CONFIG_ERROR 0x29
51#define ARIZONA_GP_FN_AIF3_CONFIG_ERROR 0x2A
52#define ARIZONA_GP_FN_SPK_TEMP_SHUTDOWN 0x2B
53#define ARIZONA_GP_FN_SPK_TEMP_WARNING 0x2C
54#define ARIZONA_GP_FN_UNDERCLOCKED 0x2D
55#define ARIZONA_GP_FN_OVERCLOCKED 0x2E
56#define ARIZONA_GP_FN_DSP_IRQ1 0x35
57#define ARIZONA_GP_FN_DSP_IRQ2 0x36
58#define ARIZONA_GP_FN_ASYNC_OPCLK 0x3D
59#define ARIZONA_GP_FN_BOOT_DONE 0x44
60#define ARIZONA_GP_FN_DSP1_RAM_READY 0x45
61#define ARIZONA_GP_FN_SYSCLK_ENA_STATUS 0x4B
62#define ARIZONA_GP_FN_ASYNCCLK_ENA_STATUS 0x4C
63
64#define ARIZONA_GPN_DIR 0x8000 /* GPN_DIR */
65#define ARIZONA_GPN_DIR_MASK 0x8000 /* GPN_DIR */
66#define ARIZONA_GPN_DIR_SHIFT 15 /* GPN_DIR */
67#define ARIZONA_GPN_DIR_WIDTH 1 /* GPN_DIR */
68#define ARIZONA_GPN_PU 0x4000 /* GPN_PU */
69#define ARIZONA_GPN_PU_MASK 0x4000 /* GPN_PU */
70#define ARIZONA_GPN_PU_SHIFT 14 /* GPN_PU */
71#define ARIZONA_GPN_PU_WIDTH 1 /* GPN_PU */
72#define ARIZONA_GPN_PD 0x2000 /* GPN_PD */
73#define ARIZONA_GPN_PD_MASK 0x2000 /* GPN_PD */
74#define ARIZONA_GPN_PD_SHIFT 13 /* GPN_PD */
75#define ARIZONA_GPN_PD_WIDTH 1 /* GPN_PD */
76#define ARIZONA_GPN_LVL 0x0800 /* GPN_LVL */
77#define ARIZONA_GPN_LVL_MASK 0x0800 /* GPN_LVL */
78#define ARIZONA_GPN_LVL_SHIFT 11 /* GPN_LVL */
79#define ARIZONA_GPN_LVL_WIDTH 1 /* GPN_LVL */
80#define ARIZONA_GPN_POL 0x0400 /* GPN_POL */
81#define ARIZONA_GPN_POL_MASK 0x0400 /* GPN_POL */
82#define ARIZONA_GPN_POL_SHIFT 10 /* GPN_POL */
83#define ARIZONA_GPN_POL_WIDTH 1 /* GPN_POL */
84#define ARIZONA_GPN_OP_CFG 0x0200 /* GPN_OP_CFG */
85#define ARIZONA_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */
86#define ARIZONA_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */
87#define ARIZONA_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */
88#define ARIZONA_GPN_DB 0x0100 /* GPN_DB */
89#define ARIZONA_GPN_DB_MASK 0x0100 /* GPN_DB */
90#define ARIZONA_GPN_DB_SHIFT 8 /* GPN_DB */
91#define ARIZONA_GPN_DB_WIDTH 1 /* GPN_DB */
92#define ARIZONA_GPN_FN_MASK 0x007F /* GPN_DB */
93#define ARIZONA_GPN_FN_SHIFT 0 /* GPN_DB */
94#define ARIZONA_GPN_FN_WIDTH 7 /* GPN_DB */
95
96#endif
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 4578c72c9b86..1789cb0f4f17 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -11,31 +11,26 @@
11#ifndef _ARIZONA_PDATA_H 11#ifndef _ARIZONA_PDATA_H
12#define _ARIZONA_PDATA_H 12#define _ARIZONA_PDATA_H
13 13
14#define ARIZONA_GPN_DIR 0x8000 /* GPN_DIR */ 14#include <dt-bindings/mfd/arizona.h>
15
15#define ARIZONA_GPN_DIR_MASK 0x8000 /* GPN_DIR */ 16#define ARIZONA_GPN_DIR_MASK 0x8000 /* GPN_DIR */
16#define ARIZONA_GPN_DIR_SHIFT 15 /* GPN_DIR */ 17#define ARIZONA_GPN_DIR_SHIFT 15 /* GPN_DIR */
17#define ARIZONA_GPN_DIR_WIDTH 1 /* GPN_DIR */ 18#define ARIZONA_GPN_DIR_WIDTH 1 /* GPN_DIR */
18#define ARIZONA_GPN_PU 0x4000 /* GPN_PU */
19#define ARIZONA_GPN_PU_MASK 0x4000 /* GPN_PU */ 19#define ARIZONA_GPN_PU_MASK 0x4000 /* GPN_PU */
20#define ARIZONA_GPN_PU_SHIFT 14 /* GPN_PU */ 20#define ARIZONA_GPN_PU_SHIFT 14 /* GPN_PU */
21#define ARIZONA_GPN_PU_WIDTH 1 /* GPN_PU */ 21#define ARIZONA_GPN_PU_WIDTH 1 /* GPN_PU */
22#define ARIZONA_GPN_PD 0x2000 /* GPN_PD */
23#define ARIZONA_GPN_PD_MASK 0x2000 /* GPN_PD */ 22#define ARIZONA_GPN_PD_MASK 0x2000 /* GPN_PD */
24#define ARIZONA_GPN_PD_SHIFT 13 /* GPN_PD */ 23#define ARIZONA_GPN_PD_SHIFT 13 /* GPN_PD */
25#define ARIZONA_GPN_PD_WIDTH 1 /* GPN_PD */ 24#define ARIZONA_GPN_PD_WIDTH 1 /* GPN_PD */
26#define ARIZONA_GPN_LVL 0x0800 /* GPN_LVL */
27#define ARIZONA_GPN_LVL_MASK 0x0800 /* GPN_LVL */ 25#define ARIZONA_GPN_LVL_MASK 0x0800 /* GPN_LVL */
28#define ARIZONA_GPN_LVL_SHIFT 11 /* GPN_LVL */ 26#define ARIZONA_GPN_LVL_SHIFT 11 /* GPN_LVL */
29#define ARIZONA_GPN_LVL_WIDTH 1 /* GPN_LVL */ 27#define ARIZONA_GPN_LVL_WIDTH 1 /* GPN_LVL */
30#define ARIZONA_GPN_POL 0x0400 /* GPN_POL */
31#define ARIZONA_GPN_POL_MASK 0x0400 /* GPN_POL */ 28#define ARIZONA_GPN_POL_MASK 0x0400 /* GPN_POL */
32#define ARIZONA_GPN_POL_SHIFT 10 /* GPN_POL */ 29#define ARIZONA_GPN_POL_SHIFT 10 /* GPN_POL */
33#define ARIZONA_GPN_POL_WIDTH 1 /* GPN_POL */ 30#define ARIZONA_GPN_POL_WIDTH 1 /* GPN_POL */
34#define ARIZONA_GPN_OP_CFG 0x0200 /* GPN_OP_CFG */
35#define ARIZONA_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */ 31#define ARIZONA_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */
36#define ARIZONA_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */ 32#define ARIZONA_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */
37#define ARIZONA_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */ 33#define ARIZONA_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */
38#define ARIZONA_GPN_DB 0x0100 /* GPN_DB */
39#define ARIZONA_GPN_DB_MASK 0x0100 /* GPN_DB */ 34#define ARIZONA_GPN_DB_MASK 0x0100 /* GPN_DB */
40#define ARIZONA_GPN_DB_SHIFT 8 /* GPN_DB */ 35#define ARIZONA_GPN_DB_SHIFT 8 /* GPN_DB */
41#define ARIZONA_GPN_DB_WIDTH 1 /* GPN_DB */ 36#define ARIZONA_GPN_DB_WIDTH 1 /* GPN_DB */
@@ -45,23 +40,10 @@
45 40
46#define ARIZONA_MAX_GPIO 5 41#define ARIZONA_MAX_GPIO 5
47 42
48#define ARIZONA_32KZ_MCLK1 1
49#define ARIZONA_32KZ_MCLK2 2
50#define ARIZONA_32KZ_NONE 3
51
52#define ARIZONA_MAX_INPUT 4 43#define ARIZONA_MAX_INPUT 4
53 44
54#define ARIZONA_DMIC_MICVDD 0
55#define ARIZONA_DMIC_MICBIAS1 1
56#define ARIZONA_DMIC_MICBIAS2 2
57#define ARIZONA_DMIC_MICBIAS3 3
58
59#define ARIZONA_MAX_MICBIAS 3 45#define ARIZONA_MAX_MICBIAS 3
60 46
61#define ARIZONA_INMODE_DIFF 0
62#define ARIZONA_INMODE_SE 1
63#define ARIZONA_INMODE_DMIC 2
64
65#define ARIZONA_MAX_OUTPUT 6 47#define ARIZONA_MAX_OUTPUT 6
66 48
67#define ARIZONA_MAX_AIF 3 49#define ARIZONA_MAX_AIF 3
@@ -112,7 +94,7 @@ struct arizona_pdata {
112 int gpio_base; 94 int gpio_base;
113 95
114 /** Pin state for GPIO pins */ 96 /** Pin state for GPIO pins */
115 int gpio_defaults[ARIZONA_MAX_GPIO]; 97 unsigned int gpio_defaults[ARIZONA_MAX_GPIO];
116 98
117 /** 99 /**
118 * Maximum number of channels clocks will be generated for, 100 * Maximum number of channels clocks will be generated for,
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index 955dd990beaf..51633ea6f910 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -87,6 +87,7 @@ enum max77693_pmic_reg {
87/* MAX77693 ITORCH register */ 87/* MAX77693 ITORCH register */
88#define TORCH_IOUT1_SHIFT 0 88#define TORCH_IOUT1_SHIFT 0
89#define TORCH_IOUT2_SHIFT 4 89#define TORCH_IOUT2_SHIFT 4
90#define TORCH_IOUT_MASK(x) (0xf << (x))
90#define TORCH_IOUT_MIN 15625 91#define TORCH_IOUT_MIN 15625
91#define TORCH_IOUT_MAX 250000 92#define TORCH_IOUT_MAX 250000
92#define TORCH_IOUT_STEP 15625 93#define TORCH_IOUT_STEP 15625
@@ -113,8 +114,8 @@ enum max77693_pmic_reg {
113#define FLASH_EN_FLASH 0x1 114#define FLASH_EN_FLASH 0x1
114#define FLASH_EN_TORCH 0x2 115#define FLASH_EN_TORCH 0x2
115#define FLASH_EN_ON 0x3 116#define FLASH_EN_ON 0x3
116#define FLASH_EN_SHIFT(x) (6 - ((x) - 1) * 2) 117#define FLASH_EN_SHIFT(x) (6 - (x) * 2)
117#define TORCH_EN_SHIFT(x) (2 - ((x) - 1) * 2) 118#define TORCH_EN_SHIFT(x) (2 - (x) * 2)
118 119
119/* MAX77693 MAX_FLASH1 register */ 120/* MAX77693 MAX_FLASH1 register */
120#define MAX_FLASH1_MAX_FL_EN 0x80 121#define MAX_FLASH1_MAX_FL_EN 0x80
diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
index f0b6585cd874..d450f687301b 100644
--- a/include/linux/mfd/max77693.h
+++ b/include/linux/mfd/max77693.h
@@ -30,7 +30,7 @@
30#ifndef __LINUX_MFD_MAX77693_H 30#ifndef __LINUX_MFD_MAX77693_H
31#define __LINUX_MFD_MAX77693_H 31#define __LINUX_MFD_MAX77693_H
32 32
33/* MAX77686 regulator IDs */ 33/* MAX77693 regulator IDs */
34enum max77693_regulators { 34enum max77693_regulators {
35 MAX77693_ESAFEOUT1 = 0, 35 MAX77693_ESAFEOUT1 = 0,
36 MAX77693_ESAFEOUT2, 36 MAX77693_ESAFEOUT2,
@@ -38,12 +38,6 @@ enum max77693_regulators {
38 MAX77693_REG_MAX, 38 MAX77693_REG_MAX,
39}; 39};
40 40
41struct max77693_regulator_data {
42 int id;
43 struct regulator_init_data *initdata;
44 struct device_node *of_node;
45};
46
47struct max77693_reg_data { 41struct max77693_reg_data {
48 u8 addr; 42 u8 addr;
49 u8 data; 43 u8 data;
@@ -87,26 +81,9 @@ enum max77693_led_boost_mode {
87 MAX77693_LED_BOOST_FIXED, 81 MAX77693_LED_BOOST_FIXED,
88}; 82};
89 83
90struct max77693_led_platform_data {
91 u32 fleds[2];
92 u32 iout_torch[2];
93 u32 iout_flash[2];
94 u32 trigger[2];
95 u32 trigger_type[2];
96 u32 num_leds;
97 u32 boost_mode;
98 u32 flash_timeout;
99 u32 boost_vout;
100 u32 low_vsys;
101};
102
103/* MAX77693 */ 84/* MAX77693 */
104 85
105struct max77693_platform_data { 86struct max77693_platform_data {
106 /* regulator data */
107 struct max77693_regulator_data *regulators;
108 int num_regulators;
109
110 /* muic data */ 87 /* muic data */
111 struct max77693_muic_platform_data *muic_data; 88 struct max77693_muic_platform_data *muic_data;
112 struct max77693_led_platform_data *led_data; 89 struct max77693_led_platform_data *led_data;
diff --git a/include/linux/mfd/max77843-private.h b/include/linux/mfd/max77843-private.h
new file mode 100644
index 000000000000..7178ace8379e
--- /dev/null
+++ b/include/linux/mfd/max77843-private.h
@@ -0,0 +1,454 @@
1/*
2 * Common variables for the Maxim MAX77843 driver
3 *
4 * Copyright (C) 2015 Samsung Electronics
5 * Author: Jaewon Kim <jaewon02.kim@samsung.com>
6 * Author: Beomho Seo <beomho.seo@samsung.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#ifndef __MAX77843_PRIVATE_H_
15#define __MAX77843_PRIVATE_H_
16
17#include <linux/i2c.h>
18#include <linux/regmap.h>
19
20#define I2C_ADDR_TOPSYS (0xCC >> 1)
21#define I2C_ADDR_CHG (0xD2 >> 1)
22#define I2C_ADDR_FG (0x6C >> 1)
23#define I2C_ADDR_MUIC (0x4A >> 1)
24
25/* Topsys, Haptic and LED registers */
26enum max77843_sys_reg {
27 MAX77843_SYS_REG_PMICID = 0x00,
28 MAX77843_SYS_REG_PMICREV = 0x01,
29 MAX77843_SYS_REG_MAINCTRL1 = 0x02,
30 MAX77843_SYS_REG_INTSRC = 0x22,
31 MAX77843_SYS_REG_INTSRCMASK = 0x23,
32 MAX77843_SYS_REG_SYSINTSRC = 0x24,
33 MAX77843_SYS_REG_SYSINTMASK = 0x26,
34 MAX77843_SYS_REG_TOPSYS_STAT = 0x28,
35 MAX77843_SYS_REG_SAFEOUTCTRL = 0xC6,
36
37 MAX77843_SYS_REG_END,
38};
39
40enum max77843_haptic_reg {
41 MAX77843_HAP_REG_MCONFIG = 0x10,
42
43 MAX77843_HAP_REG_END,
44};
45
46enum max77843_led_reg {
47 MAX77843_LED_REG_LEDEN = 0x30,
48 MAX77843_LED_REG_LED0BRT = 0x31,
49 MAX77843_LED_REG_LED1BRT = 0x32,
50 MAX77843_LED_REG_LED2BRT = 0x33,
51 MAX77843_LED_REG_LED3BRT = 0x34,
52 MAX77843_LED_REG_LEDBLNK = 0x38,
53 MAX77843_LED_REG_LEDRAMP = 0x36,
54
55 MAX77843_LED_REG_END,
56};
57
58/* Charger registers */
59enum max77843_charger_reg {
60 MAX77843_CHG_REG_CHG_INT = 0xB0,
61 MAX77843_CHG_REG_CHG_INT_MASK = 0xB1,
62 MAX77843_CHG_REG_CHG_INT_OK = 0xB2,
63 MAX77843_CHG_REG_CHG_DTLS_00 = 0xB3,
64 MAX77843_CHG_REG_CHG_DTLS_01 = 0xB4,
65 MAX77843_CHG_REG_CHG_DTLS_02 = 0xB5,
66 MAX77843_CHG_REG_CHG_CNFG_00 = 0xB7,
67 MAX77843_CHG_REG_CHG_CNFG_01 = 0xB8,
68 MAX77843_CHG_REG_CHG_CNFG_02 = 0xB9,
69 MAX77843_CHG_REG_CHG_CNFG_03 = 0xBA,
70 MAX77843_CHG_REG_CHG_CNFG_04 = 0xBB,
71 MAX77843_CHG_REG_CHG_CNFG_06 = 0xBD,
72 MAX77843_CHG_REG_CHG_CNFG_07 = 0xBE,
73 MAX77843_CHG_REG_CHG_CNFG_09 = 0xC0,
74 MAX77843_CHG_REG_CHG_CNFG_10 = 0xC1,
75 MAX77843_CHG_REG_CHG_CNFG_11 = 0xC2,
76 MAX77843_CHG_REG_CHG_CNFG_12 = 0xC3,
77
78 MAX77843_CHG_REG_END,
79};
80
81/* Fuel gauge registers */
82enum max77843_fuelgauge {
83 MAX77843_FG_REG_STATUS = 0x00,
84 MAX77843_FG_REG_VALRT_TH = 0x01,
85 MAX77843_FG_REG_TALRT_TH = 0x02,
86 MAX77843_FG_REG_SALRT_TH = 0x03,
87 MAX77843_FG_RATE_AT_RATE = 0x04,
88 MAX77843_FG_REG_REMCAP_REP = 0x05,
89 MAX77843_FG_REG_SOCREP = 0x06,
90 MAX77843_FG_REG_AGE = 0x07,
91 MAX77843_FG_REG_TEMP = 0x08,
92 MAX77843_FG_REG_VCELL = 0x09,
93 MAX77843_FG_REG_CURRENT = 0x0A,
94 MAX77843_FG_REG_AVG_CURRENT = 0x0B,
95 MAX77843_FG_REG_SOCMIX = 0x0D,
96 MAX77843_FG_REG_SOCAV = 0x0E,
97 MAX77843_FG_REG_REMCAP_MIX = 0x0F,
98 MAX77843_FG_REG_FULLCAP = 0x10,
99 MAX77843_FG_REG_AVG_TEMP = 0x16,
100 MAX77843_FG_REG_CYCLES = 0x17,
101 MAX77843_FG_REG_AVG_VCELL = 0x19,
102 MAX77843_FG_REG_CONFIG = 0x1D,
103 MAX77843_FG_REG_REMCAP_AV = 0x1F,
104 MAX77843_FG_REG_FULLCAP_NOM = 0x23,
105 MAX77843_FG_REG_MISCCFG = 0x2B,
106 MAX77843_FG_REG_RCOMP = 0x38,
107 MAX77843_FG_REG_FSTAT = 0x3D,
108 MAX77843_FG_REG_DQACC = 0x45,
109 MAX77843_FG_REG_DPACC = 0x46,
110 MAX77843_FG_REG_OCV = 0xEE,
111 MAX77843_FG_REG_VFOCV = 0xFB,
112 MAX77843_FG_SOCVF = 0xFF,
113
114 MAX77843_FG_END,
115};
116
117/* MUIC registers */
118enum max77843_muic_reg {
119 MAX77843_MUIC_REG_ID = 0x00,
120 MAX77843_MUIC_REG_INT1 = 0x01,
121 MAX77843_MUIC_REG_INT2 = 0x02,
122 MAX77843_MUIC_REG_INT3 = 0x03,
123 MAX77843_MUIC_REG_STATUS1 = 0x04,
124 MAX77843_MUIC_REG_STATUS2 = 0x05,
125 MAX77843_MUIC_REG_STATUS3 = 0x06,
126 MAX77843_MUIC_REG_INTMASK1 = 0x07,
127 MAX77843_MUIC_REG_INTMASK2 = 0x08,
128 MAX77843_MUIC_REG_INTMASK3 = 0x09,
129 MAX77843_MUIC_REG_CDETCTRL1 = 0x0A,
130 MAX77843_MUIC_REG_CDETCTRL2 = 0x0B,
131 MAX77843_MUIC_REG_CONTROL1 = 0x0C,
132 MAX77843_MUIC_REG_CONTROL2 = 0x0D,
133 MAX77843_MUIC_REG_CONTROL3 = 0x0E,
134 MAX77843_MUIC_REG_CONTROL4 = 0x16,
135 MAX77843_MUIC_REG_HVCONTROL1 = 0x17,
136 MAX77843_MUIC_REG_HVCONTROL2 = 0x18,
137
138 MAX77843_MUIC_REG_END,
139};
140
141enum max77843_irq {
142 /* Topsys: SYSTEM */
143 MAX77843_SYS_IRQ_SYSINTSRC_SYSUVLO_INT,
144 MAX77843_SYS_IRQ_SYSINTSRC_SYSOVLO_INT,
145 MAX77843_SYS_IRQ_SYSINTSRC_TSHDN_INT,
146 MAX77843_SYS_IRQ_SYSINTSRC_TM_INT,
147
148 /* Charger: CHG_INT */
149 MAX77843_CHG_IRQ_CHG_INT_BYP_I,
150 MAX77843_CHG_IRQ_CHG_INT_BATP_I,
151 MAX77843_CHG_IRQ_CHG_INT_BAT_I,
152 MAX77843_CHG_IRQ_CHG_INT_CHG_I,
153 MAX77843_CHG_IRQ_CHG_INT_WCIN_I,
154 MAX77843_CHG_IRQ_CHG_INT_CHGIN_I,
155 MAX77843_CHG_IRQ_CHG_INT_AICL_I,
156
157 MAX77843_IRQ_NUM,
158};
159
160enum max77843_irq_muic {
161 /* MUIC: INT1 */
162 MAX77843_MUIC_IRQ_INT1_ADC,
163 MAX77843_MUIC_IRQ_INT1_ADCERROR,
164 MAX77843_MUIC_IRQ_INT1_ADC1K,
165
166 /* MUIC: INT2 */
167 MAX77843_MUIC_IRQ_INT2_CHGTYP,
168 MAX77843_MUIC_IRQ_INT2_CHGDETRUN,
169 MAX77843_MUIC_IRQ_INT2_DCDTMR,
170 MAX77843_MUIC_IRQ_INT2_DXOVP,
171 MAX77843_MUIC_IRQ_INT2_VBVOLT,
172
173 /* MUIC: INT3 */
174 MAX77843_MUIC_IRQ_INT3_VBADC,
175 MAX77843_MUIC_IRQ_INT3_VDNMON,
176 MAX77843_MUIC_IRQ_INT3_DNRES,
177 MAX77843_MUIC_IRQ_INT3_MPNACK,
178 MAX77843_MUIC_IRQ_INT3_MRXBUFOW,
179 MAX77843_MUIC_IRQ_INT3_MRXTRF,
180 MAX77843_MUIC_IRQ_INT3_MRXPERR,
181 MAX77843_MUIC_IRQ_INT3_MRXRDY,
182
183 MAX77843_MUIC_IRQ_NUM,
184};
185
186/* MAX77843 interrupts */
187#define MAX77843_SYS_IRQ_SYSUVLO_INT BIT(0)
188#define MAX77843_SYS_IRQ_SYSOVLO_INT BIT(1)
189#define MAX77843_SYS_IRQ_TSHDN_INT BIT(2)
190#define MAX77843_SYS_IRQ_TM_INT BIT(3)
191
192/* MAX77843 MAINCTRL1 register */
193#define MAINCTRL1_BIASEN_SHIFT 7
194#define MAX77843_MAINCTRL1_BIASEN_MASK BIT(MAINCTRL1_BIASEN_SHIFT)
195
196/* MAX77843 MCONFIG register */
197#define MCONFIG_MODE_SHIFT 7
198#define MCONFIG_MEN_SHIFT 6
199#define MCONFIG_PDIV_SHIFT 0
200
201#define MAX77843_MCONFIG_MODE_MASK BIT(MCONFIG_MODE_SHIFT)
202#define MAX77843_MCONFIG_MEN_MASK BIT(MCONFIG_MEN_SHIFT)
203#define MAX77843_MCONFIG_PDIV_MASK (0x3 << MCONFIG_PDIV_SHIFT)
204
205/* Max77843 charger insterrupts */
206#define MAX77843_CHG_BYP_I BIT(0)
207#define MAX77843_CHG_BATP_I BIT(2)
208#define MAX77843_CHG_BAT_I BIT(3)
209#define MAX77843_CHG_CHG_I BIT(4)
210#define MAX77843_CHG_WCIN_I BIT(5)
211#define MAX77843_CHG_CHGIN_I BIT(6)
212#define MAX77843_CHG_AICL_I BIT(7)
213
214/* MAX77843 CHG_INT_OK register */
215#define MAX77843_CHG_BYP_OK BIT(0)
216#define MAX77843_CHG_BATP_OK BIT(2)
217#define MAX77843_CHG_BAT_OK BIT(3)
218#define MAX77843_CHG_CHG_OK BIT(4)
219#define MAX77843_CHG_WCIN_OK BIT(5)
220#define MAX77843_CHG_CHGIN_OK BIT(6)
221#define MAX77843_CHG_AICL_OK BIT(7)
222
223/* MAX77843 CHG_DETAILS_00 register */
224#define MAX77843_CHG_BAT_DTLS BIT(0)
225
226/* MAX77843 CHG_DETAILS_01 register */
227#define MAX77843_CHG_DTLS_MASK 0x0f
228#define MAX77843_CHG_PQ_MODE 0x00
229#define MAX77843_CHG_CC_MODE 0x01
230#define MAX77843_CHG_CV_MODE 0x02
231#define MAX77843_CHG_TO_MODE 0x03
232#define MAX77843_CHG_DO_MODE 0x04
233#define MAX77843_CHG_HT_MODE 0x05
234#define MAX77843_CHG_TF_MODE 0x06
235#define MAX77843_CHG_TS_MODE 0x07
236#define MAX77843_CHG_OFF_MODE 0x08
237
238#define MAX77843_CHG_BAT_DTLS_MASK 0xf0
239#define MAX77843_CHG_NO_BAT (0x00 << 4)
240#define MAX77843_CHG_LOW_VOLT_BAT (0x01 << 4)
241#define MAX77843_CHG_LONG_BAT_TIME (0x02 << 4)
242#define MAX77843_CHG_OK_BAT (0x03 << 4)
243#define MAX77843_CHG_OK_LOW_VOLT_BAT (0x04 << 4)
244#define MAX77843_CHG_OVER_VOLT_BAT (0x05 << 4)
245#define MAX77843_CHG_OVER_CURRENT_BAT (0x06 << 4)
246
247/* MAX77843 CHG_CNFG_00 register */
248#define MAX77843_CHG_DISABLE 0x00
249#define MAX77843_CHG_ENABLE 0x05
250#define MAX77843_CHG_MASK 0x01
251#define MAX77843_CHG_BUCK_MASK 0x04
252
253/* MAX77843 CHG_CNFG_01 register */
254#define MAX77843_CHG_RESTART_THRESHOLD_100 0x00
255#define MAX77843_CHG_RESTART_THRESHOLD_150 0x10
256#define MAX77843_CHG_RESTART_THRESHOLD_200 0x20
257#define MAX77843_CHG_RESTART_THRESHOLD_DISABLE 0x30
258
259/* MAX77843 CHG_CNFG_02 register */
260#define MAX77843_CHG_FAST_CHG_CURRENT_MIN 100000
261#define MAX77843_CHG_FAST_CHG_CURRENT_MAX 3150000
262#define MAX77843_CHG_FAST_CHG_CURRENT_STEP 50000
263#define MAX77843_CHG_FAST_CHG_CURRENT_MASK 0x3f
264#define MAX77843_CHG_OTG_ILIMIT_500 (0x00 << 6)
265#define MAX77843_CHG_OTG_ILIMIT_900 (0x01 << 6)
266#define MAX77843_CHG_OTG_ILIMIT_1200 (0x02 << 6)
267#define MAX77843_CHG_OTG_ILIMIT_1500 (0x03 << 6)
268#define MAX77843_CHG_OTG_ILIMIT_MASK 0xc0
269
270/* MAX77843 CHG_CNFG_03 register */
271#define MAX77843_CHG_TOP_OFF_CURRENT_MIN 125000
272#define MAX77843_CHG_TOP_OFF_CURRENT_MAX 650000
273#define MAX77843_CHG_TOP_OFF_CURRENT_STEP 75000
274#define MAX77843_CHG_TOP_OFF_CURRENT_MASK 0x07
275
276/* MAX77843 CHG_CNFG_06 register */
277#define MAX77843_CHG_WRITE_CAP_BLOCK 0x10
278#define MAX77843_CHG_WRITE_CAP_UNBLOCK 0x0C
279
280/* MAX77843_CHG_CNFG_09_register */
281#define MAX77843_CHG_INPUT_CURRENT_LIMIT_MIN 100000
282#define MAX77843_CHG_INPUT_CURRENT_LIMIT_MAX 4000000
283#define MAX77843_CHG_INPUT_CURRENT_LIMIT_REF 3367000
284#define MAX77843_CHG_INPUT_CURRENT_LIMIT_STEP 33000
285
286#define MAX77843_MUIC_ADC BIT(0)
287#define MAX77843_MUIC_ADCERROR BIT(2)
288#define MAX77843_MUIC_ADC1K BIT(3)
289
290#define MAX77843_MUIC_CHGTYP BIT(0)
291#define MAX77843_MUIC_CHGDETRUN BIT(1)
292#define MAX77843_MUIC_DCDTMR BIT(2)
293#define MAX77843_MUIC_DXOVP BIT(3)
294#define MAX77843_MUIC_VBVOLT BIT(4)
295
296#define MAX77843_MUIC_VBADC BIT(0)
297#define MAX77843_MUIC_VDNMON BIT(1)
298#define MAX77843_MUIC_DNRES BIT(2)
299#define MAX77843_MUIC_MPNACK BIT(3)
300#define MAX77843_MUIC_MRXBUFOW BIT(4)
301#define MAX77843_MUIC_MRXTRF BIT(5)
302#define MAX77843_MUIC_MRXPERR BIT(6)
303#define MAX77843_MUIC_MRXRDY BIT(7)
304
305/* MAX77843 INTSRCMASK register */
306#define MAX77843_INTSRCMASK_CHGR 0
307#define MAX77843_INTSRCMASK_SYS 1
308#define MAX77843_INTSRCMASK_FG 2
309#define MAX77843_INTSRCMASK_MUIC 3
310
311#define MAX77843_INTSRCMASK_CHGR_MASK BIT(MAX77843_INTSRCMASK_CHGR)
312#define MAX77843_INTSRCMASK_SYS_MASK BIT(MAX77843_INTSRCMASK_SYS)
313#define MAX77843_INTSRCMASK_FG_MASK BIT(MAX77843_INTSRCMASK_FG)
314#define MAX77843_INTSRCMASK_MUIC_MASK BIT(MAX77843_INTSRCMASK_MUIC)
315
316#define MAX77843_INTSRC_MASK_MASK \
317 (MAX77843_INTSRCMASK_MUIC_MASK | MAX77843_INTSRCMASK_FG_MASK | \
318 MAX77843_INTSRCMASK_SYS_MASK | MAX77843_INTSRCMASK_CHGR_MASK)
319
320/* MAX77843 STATUS register*/
321#define STATUS1_ADC_SHIFT 0
322#define STATUS1_ADCERROR_SHIFT 6
323#define STATUS1_ADC1K_SHIFT 7
324#define STATUS2_CHGTYP_SHIFT 0
325#define STATUS2_CHGDETRUN_SHIFT 3
326#define STATUS2_DCDTMR_SHIFT 4
327#define STATUS2_DXOVP_SHIFT 5
328#define STATUS2_VBVOLT_SHIFT 6
329#define STATUS3_VBADC_SHIFT 0
330#define STATUS3_VDNMON_SHIFT 4
331#define STATUS3_DNRES_SHIFT 5
332#define STATUS3_MPNACK_SHIFT 6
333
334#define MAX77843_MUIC_STATUS1_ADC_MASK (0x1f << STATUS1_ADC_SHIFT)
335#define MAX77843_MUIC_STATUS1_ADCERROR_MASK BIT(STATUS1_ADCERROR_SHIFT)
336#define MAX77843_MUIC_STATUS1_ADC1K_MASK BIT(STATUS1_ADC1K_SHIFT)
337#define MAX77843_MUIC_STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT)
338#define MAX77843_MUIC_STATUS2_CHGDETRUN_MASK BIT(STATUS2_CHGDETRUN_SHIFT)
339#define MAX77843_MUIC_STATUS2_DCDTMR_MASK BIT(STATUS2_DCDTMR_SHIFT)
340#define MAX77843_MUIC_STATUS2_DXOVP_MASK BIT(STATUS2_DXOVP_SHIFT)
341#define MAX77843_MUIC_STATUS2_VBVOLT_MASK BIT(STATUS2_VBVOLT_SHIFT)
342#define MAX77843_MUIC_STATUS3_VBADC_MASK (0xf << STATUS3_VBADC_SHIFT)
343#define MAX77843_MUIC_STATUS3_VDNMON_MASK BIT(STATUS3_VDNMON_SHIFT)
344#define MAX77843_MUIC_STATUS3_DNRES_MASK BIT(STATUS3_DNRES_SHIFT)
345#define MAX77843_MUIC_STATUS3_MPNACK_MASK BIT(STATUS3_MPNACK_SHIFT)
346
347/* MAX77843 CONTROL register */
348#define CONTROL1_COMP1SW_SHIFT 0
349#define CONTROL1_COMP2SW_SHIFT 3
350#define CONTROL1_IDBEN_SHIFT 7
351#define CONTROL2_LOWPWR_SHIFT 0
352#define CONTROL2_ADCEN_SHIFT 1
353#define CONTROL2_CPEN_SHIFT 2
354#define CONTROL2_ACC_DET_SHIFT 5
355#define CONTROL2_USBCPINT_SHIFT 6
356#define CONTROL2_RCPS_SHIFT 7
357#define CONTROL3_JIGSET_SHIFT 0
358#define CONTROL4_ADCDBSET_SHIFT 0
359#define CONTROL4_USBAUTO_SHIFT 4
360#define CONTROL4_FCTAUTO_SHIFT 5
361#define CONTROL4_ADCMODE_SHIFT 6
362
363#define MAX77843_MUIC_CONTROL1_COMP1SW_MASK (0x7 << CONTROL1_COMP1SW_SHIFT)
364#define MAX77843_MUIC_CONTROL1_COMP2SW_MASK (0x7 << CONTROL1_COMP2SW_SHIFT)
365#define MAX77843_MUIC_CONTROL1_IDBEN_MASK BIT(CONTROL1_IDBEN_SHIFT)
366#define MAX77843_MUIC_CONTROL2_LOWPWR_MASK BIT(CONTROL2_LOWPWR_SHIFT)
367#define MAX77843_MUIC_CONTROL2_ADCEN_MASK BIT(CONTROL2_ADCEN_SHIFT)
368#define MAX77843_MUIC_CONTROL2_CPEN_MASK BIT(CONTROL2_CPEN_SHIFT)
369#define MAX77843_MUIC_CONTROL2_ACC_DET_MASK BIT(CONTROL2_ACC_DET_SHIFT)
370#define MAX77843_MUIC_CONTROL2_USBCPINT_MASK BIT(CONTROL2_USBCPINT_SHIFT)
371#define MAX77843_MUIC_CONTROL2_RCPS_MASK BIT(CONTROL2_RCPS_SHIFT)
372#define MAX77843_MUIC_CONTROL3_JIGSET_MASK (0x3 << CONTROL3_JIGSET_SHIFT)
373#define MAX77843_MUIC_CONTROL4_ADCDBSET_MASK (0x3 << CONTROL4_ADCDBSET_SHIFT)
374#define MAX77843_MUIC_CONTROL4_USBAUTO_MASK BIT(CONTROL4_USBAUTO_SHIFT)
375#define MAX77843_MUIC_CONTROL4_FCTAUTO_MASK BIT(CONTROL4_FCTAUTO_SHIFT)
376#define MAX77843_MUIC_CONTROL4_ADCMODE_MASK (0x3 << CONTROL4_ADCMODE_SHIFT)
377
378/* MAX77843 switch port */
379#define COM_OPEN 0
380#define COM_USB 1
381#define COM_AUDIO 2
382#define COM_UART 3
383#define COM_AUX_USB 4
384#define COM_AUX_UART 5
385
386#define CONTROL1_COM_SW \
387 ((MAX77843_MUIC_CONTROL1_COMP1SW_MASK | \
388 MAX77843_MUIC_CONTROL1_COMP2SW_MASK))
389
390#define CONTROL1_SW_OPEN \
391 ((COM_OPEN << CONTROL1_COMP1SW_SHIFT | \
392 COM_OPEN << CONTROL1_COMP2SW_SHIFT))
393#define CONTROL1_SW_USB \
394 ((COM_USB << CONTROL1_COMP1SW_SHIFT | \
395 COM_USB << CONTROL1_COMP2SW_SHIFT))
396#define CONTROL1_SW_AUDIO \
397 ((COM_AUDIO << CONTROL1_COMP1SW_SHIFT | \
398 COM_AUDIO << CONTROL1_COMP2SW_SHIFT))
399#define CONTROL1_SW_UART \
400 ((COM_UART << CONTROL1_COMP1SW_SHIFT | \
401 COM_UART << CONTROL1_COMP2SW_SHIFT))
402#define CONTROL1_SW_AUX_USB \
403 ((COM_AUX_USB << CONTROL1_COMP1SW_SHIFT | \
404 COM_AUX_USB << CONTROL1_COMP2SW_SHIFT))
405#define CONTROL1_SW_AUX_UART \
406 ((COM_AUX_UART << CONTROL1_COMP1SW_SHIFT | \
407 COM_AUX_UART << CONTROL1_COMP2SW_SHIFT))
408
409#define MAX77843_DISABLE 0
410#define MAX77843_ENABLE 1
411
412#define CONTROL4_AUTO_DISABLE \
413 ((MAX77843_DISABLE << CONTROL4_USBAUTO_SHIFT) | \
414 (MAX77843_DISABLE << CONTROL4_FCTAUTO_SHIFT))
415#define CONTROL4_AUTO_ENABLE \
416 ((MAX77843_ENABLE << CONTROL4_USBAUTO_SHIFT) | \
417 (MAX77843_ENABLE << CONTROL4_FCTAUTO_SHIFT))
418
419/* MAX77843 SAFEOUT LDO Control register */
420#define SAFEOUTCTRL_SAFEOUT1_SHIFT 0
421#define SAFEOUTCTRL_SAFEOUT2_SHIFT 2
422#define SAFEOUTCTRL_ENSAFEOUT1_SHIFT 6
423#define SAFEOUTCTRL_ENSAFEOUT2_SHIFT 7
424
425#define MAX77843_REG_SAFEOUTCTRL_ENSAFEOUT1 \
426 BIT(SAFEOUTCTRL_ENSAFEOUT1_SHIFT)
427#define MAX77843_REG_SAFEOUTCTRL_ENSAFEOUT2 \
428 BIT(SAFEOUTCTRL_ENSAFEOUT2_SHIFT)
429#define MAX77843_REG_SAFEOUTCTRL_SAFEOUT1_MASK \
430 (0x3 << SAFEOUTCTRL_SAFEOUT1_SHIFT)
431#define MAX77843_REG_SAFEOUTCTRL_SAFEOUT2_MASK \
432 (0x3 << SAFEOUTCTRL_SAFEOUT2_SHIFT)
433
434struct max77843 {
435 struct device *dev;
436
437 struct i2c_client *i2c;
438 struct i2c_client *i2c_chg;
439 struct i2c_client *i2c_fuel;
440 struct i2c_client *i2c_muic;
441
442 struct regmap *regmap;
443 struct regmap *regmap_chg;
444 struct regmap *regmap_fuel;
445 struct regmap *regmap_muic;
446
447 struct regmap_irq_chip_data *irq_data;
448 struct regmap_irq_chip_data *irq_data_chg;
449 struct regmap_irq_chip_data *irq_data_fuel;
450 struct regmap_irq_chip_data *irq_data_muic;
451
452 int irq;
453};
454#endif /* __MAX77843_H__ */
diff --git a/include/linux/mfd/menelaus.h b/include/linux/mfd/menelaus.h
index f097e89134cb..9e85ac06da89 100644
--- a/include/linux/mfd/menelaus.h
+++ b/include/linux/mfd/menelaus.h
@@ -24,7 +24,6 @@ extern int menelaus_set_vaux(unsigned int mV);
24extern int menelaus_set_vdcdc(int dcdc, unsigned int mV); 24extern int menelaus_set_vdcdc(int dcdc, unsigned int mV);
25extern int menelaus_set_slot_sel(int enable); 25extern int menelaus_set_slot_sel(int enable);
26extern int menelaus_get_slot_pin_states(void); 26extern int menelaus_get_slot_pin_states(void);
27extern int menelaus_set_vcore_sw(unsigned int mV);
28extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV); 27extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV);
29 28
30#define EN_VPLL_SLEEP (1 << 7) 29#define EN_VPLL_SLEEP (1 << 7)
@@ -38,10 +37,4 @@ extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV);
38 37
39extern int menelaus_set_regulator_sleep(int enable, u32 val); 38extern int menelaus_set_regulator_sleep(int enable, u32 val);
40 39
41#if defined(CONFIG_ARCH_OMAP2) && defined(CONFIG_MENELAUS)
42#define omap_has_menelaus() 1
43#else
44#define omap_has_menelaus() 0
45#endif
46
47#endif 40#endif
diff --git a/include/linux/mfd/mt6397/core.h b/include/linux/mfd/mt6397/core.h
new file mode 100644
index 000000000000..cf5265b0d1c1
--- /dev/null
+++ b/include/linux/mfd/mt6397/core.h
@@ -0,0 +1,64 @@
1/*
2 * Copyright (c) 2014 MediaTek Inc.
3 * Author: Flora Fu, MediaTek
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 version 2 as
7 * published by the Free Software Foundation.
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
15#ifndef __MFD_MT6397_CORE_H__
16#define __MFD_MT6397_CORE_H__
17
18enum mt6397_irq_numbers {
19 MT6397_IRQ_SPKL_AB = 0,
20 MT6397_IRQ_SPKR_AB,
21 MT6397_IRQ_SPKL,
22 MT6397_IRQ_SPKR,
23 MT6397_IRQ_BAT_L,
24 MT6397_IRQ_BAT_H,
25 MT6397_IRQ_FG_BAT_L,
26 MT6397_IRQ_FG_BAT_H,
27 MT6397_IRQ_WATCHDOG,
28 MT6397_IRQ_PWRKEY,
29 MT6397_IRQ_THR_L,
30 MT6397_IRQ_THR_H,
31 MT6397_IRQ_VBATON_UNDET,
32 MT6397_IRQ_BVALID_DET,
33 MT6397_IRQ_CHRDET,
34 MT6397_IRQ_OV,
35 MT6397_IRQ_LDO,
36 MT6397_IRQ_HOMEKEY,
37 MT6397_IRQ_ACCDET,
38 MT6397_IRQ_AUDIO,
39 MT6397_IRQ_RTC,
40 MT6397_IRQ_PWRKEY_RSTB,
41 MT6397_IRQ_HDMI_SIFM,
42 MT6397_IRQ_HDMI_CEC,
43 MT6397_IRQ_VCA15,
44 MT6397_IRQ_VSRMCA15,
45 MT6397_IRQ_VCORE,
46 MT6397_IRQ_VGPU,
47 MT6397_IRQ_VIO18,
48 MT6397_IRQ_VPCA7,
49 MT6397_IRQ_VSRMCA7,
50 MT6397_IRQ_VDRM,
51 MT6397_IRQ_NR,
52};
53
54struct mt6397_chip {
55 struct device *dev;
56 struct regmap *regmap;
57 int irq;
58 struct irq_domain *irq_domain;
59 struct mutex irqlock;
60 u16 irq_masks_cur[2];
61 u16 irq_masks_cache[2];
62};
63
64#endif /* __MFD_MT6397_CORE_H__ */
diff --git a/include/linux/mfd/mt6397/registers.h b/include/linux/mfd/mt6397/registers.h
new file mode 100644
index 000000000000..f23a0a60a877
--- /dev/null
+++ b/include/linux/mfd/mt6397/registers.h
@@ -0,0 +1,362 @@
1/*
2 * Copyright (c) 2014 MediaTek Inc.
3 * Author: Flora Fu, MediaTek
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 version 2 as
7 * published by the Free Software Foundation.
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
15#ifndef __MFD_MT6397_REGISTERS_H__
16#define __MFD_MT6397_REGISTERS_H__
17
18/* PMIC Registers */
19#define MT6397_CID 0x0100
20#define MT6397_TOP_CKPDN 0x0102
21#define MT6397_TOP_CKPDN_SET 0x0104
22#define MT6397_TOP_CKPDN_CLR 0x0106
23#define MT6397_TOP_CKPDN2 0x0108
24#define MT6397_TOP_CKPDN2_SET 0x010A
25#define MT6397_TOP_CKPDN2_CLR 0x010C
26#define MT6397_TOP_GPIO_CKPDN 0x010E
27#define MT6397_TOP_RST_CON 0x0114
28#define MT6397_WRP_CKPDN 0x011A
29#define MT6397_WRP_RST_CON 0x0120
30#define MT6397_TOP_RST_MISC 0x0126
31#define MT6397_TOP_CKCON1 0x0128
32#define MT6397_TOP_CKCON2 0x012A
33#define MT6397_TOP_CKTST1 0x012C
34#define MT6397_TOP_CKTST2 0x012E
35#define MT6397_OC_DEG_EN 0x0130
36#define MT6397_OC_CTL0 0x0132
37#define MT6397_OC_CTL1 0x0134
38#define MT6397_OC_CTL2 0x0136
39#define MT6397_INT_RSV 0x0138
40#define MT6397_TEST_CON0 0x013A
41#define MT6397_TEST_CON1 0x013C
42#define MT6397_STATUS0 0x013E
43#define MT6397_STATUS1 0x0140
44#define MT6397_PGSTATUS 0x0142
45#define MT6397_CHRSTATUS 0x0144
46#define MT6397_OCSTATUS0 0x0146
47#define MT6397_OCSTATUS1 0x0148
48#define MT6397_OCSTATUS2 0x014A
49#define MT6397_HDMI_PAD_IE 0x014C
50#define MT6397_TEST_OUT_L 0x014E
51#define MT6397_TEST_OUT_H 0x0150
52#define MT6397_TDSEL_CON 0x0152
53#define MT6397_RDSEL_CON 0x0154
54#define MT6397_GPIO_SMT_CON0 0x0156
55#define MT6397_GPIO_SMT_CON1 0x0158
56#define MT6397_GPIO_SMT_CON2 0x015A
57#define MT6397_GPIO_SMT_CON3 0x015C
58#define MT6397_DRV_CON0 0x015E
59#define MT6397_DRV_CON1 0x0160
60#define MT6397_DRV_CON2 0x0162
61#define MT6397_DRV_CON3 0x0164
62#define MT6397_DRV_CON4 0x0166
63#define MT6397_DRV_CON5 0x0168
64#define MT6397_DRV_CON6 0x016A
65#define MT6397_DRV_CON7 0x016C
66#define MT6397_DRV_CON8 0x016E
67#define MT6397_DRV_CON9 0x0170
68#define MT6397_DRV_CON10 0x0172
69#define MT6397_DRV_CON11 0x0174
70#define MT6397_DRV_CON12 0x0176
71#define MT6397_INT_CON0 0x0178
72#define MT6397_INT_CON1 0x017E
73#define MT6397_INT_STATUS0 0x0184
74#define MT6397_INT_STATUS1 0x0186
75#define MT6397_FQMTR_CON0 0x0188
76#define MT6397_FQMTR_CON1 0x018A
77#define MT6397_FQMTR_CON2 0x018C
78#define MT6397_EFUSE_DOUT_0_15 0x01C4
79#define MT6397_EFUSE_DOUT_16_31 0x01C6
80#define MT6397_EFUSE_DOUT_32_47 0x01C8
81#define MT6397_EFUSE_DOUT_48_63 0x01CA
82#define MT6397_SPI_CON 0x01CC
83#define MT6397_TOP_CKPDN3 0x01CE
84#define MT6397_TOP_CKCON3 0x01D4
85#define MT6397_EFUSE_DOUT_64_79 0x01D6
86#define MT6397_EFUSE_DOUT_80_95 0x01D8
87#define MT6397_EFUSE_DOUT_96_111 0x01DA
88#define MT6397_EFUSE_DOUT_112_127 0x01DC
89#define MT6397_EFUSE_DOUT_128_143 0x01DE
90#define MT6397_EFUSE_DOUT_144_159 0x01E0
91#define MT6397_EFUSE_DOUT_160_175 0x01E2
92#define MT6397_EFUSE_DOUT_176_191 0x01E4
93#define MT6397_EFUSE_DOUT_192_207 0x01E6
94#define MT6397_EFUSE_DOUT_208_223 0x01E8
95#define MT6397_EFUSE_DOUT_224_239 0x01EA
96#define MT6397_EFUSE_DOUT_240_255 0x01EC
97#define MT6397_EFUSE_DOUT_256_271 0x01EE
98#define MT6397_EFUSE_DOUT_272_287 0x01F0
99#define MT6397_EFUSE_DOUT_288_300 0x01F2
100#define MT6397_EFUSE_DOUT_304_319 0x01F4
101#define MT6397_BUCK_CON0 0x0200
102#define MT6397_BUCK_CON1 0x0202
103#define MT6397_BUCK_CON2 0x0204
104#define MT6397_BUCK_CON3 0x0206
105#define MT6397_BUCK_CON4 0x0208
106#define MT6397_BUCK_CON5 0x020A
107#define MT6397_BUCK_CON6 0x020C
108#define MT6397_BUCK_CON7 0x020E
109#define MT6397_BUCK_CON8 0x0210
110#define MT6397_BUCK_CON9 0x0212
111#define MT6397_VCA15_CON0 0x0214
112#define MT6397_VCA15_CON1 0x0216
113#define MT6397_VCA15_CON2 0x0218
114#define MT6397_VCA15_CON3 0x021A
115#define MT6397_VCA15_CON4 0x021C
116#define MT6397_VCA15_CON5 0x021E
117#define MT6397_VCA15_CON6 0x0220
118#define MT6397_VCA15_CON7 0x0222
119#define MT6397_VCA15_CON8 0x0224
120#define MT6397_VCA15_CON9 0x0226
121#define MT6397_VCA15_CON10 0x0228
122#define MT6397_VCA15_CON11 0x022A
123#define MT6397_VCA15_CON12 0x022C
124#define MT6397_VCA15_CON13 0x022E
125#define MT6397_VCA15_CON14 0x0230
126#define MT6397_VCA15_CON15 0x0232
127#define MT6397_VCA15_CON16 0x0234
128#define MT6397_VCA15_CON17 0x0236
129#define MT6397_VCA15_CON18 0x0238
130#define MT6397_VSRMCA15_CON0 0x023A
131#define MT6397_VSRMCA15_CON1 0x023C
132#define MT6397_VSRMCA15_CON2 0x023E
133#define MT6397_VSRMCA15_CON3 0x0240
134#define MT6397_VSRMCA15_CON4 0x0242
135#define MT6397_VSRMCA15_CON5 0x0244
136#define MT6397_VSRMCA15_CON6 0x0246
137#define MT6397_VSRMCA15_CON7 0x0248
138#define MT6397_VSRMCA15_CON8 0x024A
139#define MT6397_VSRMCA15_CON9 0x024C
140#define MT6397_VSRMCA15_CON10 0x024E
141#define MT6397_VSRMCA15_CON11 0x0250
142#define MT6397_VSRMCA15_CON12 0x0252
143#define MT6397_VSRMCA15_CON13 0x0254
144#define MT6397_VSRMCA15_CON14 0x0256
145#define MT6397_VSRMCA15_CON15 0x0258
146#define MT6397_VSRMCA15_CON16 0x025A
147#define MT6397_VSRMCA15_CON17 0x025C
148#define MT6397_VSRMCA15_CON18 0x025E
149#define MT6397_VSRMCA15_CON19 0x0260
150#define MT6397_VSRMCA15_CON20 0x0262
151#define MT6397_VSRMCA15_CON21 0x0264
152#define MT6397_VCORE_CON0 0x0266
153#define MT6397_VCORE_CON1 0x0268
154#define MT6397_VCORE_CON2 0x026A
155#define MT6397_VCORE_CON3 0x026C
156#define MT6397_VCORE_CON4 0x026E
157#define MT6397_VCORE_CON5 0x0270
158#define MT6397_VCORE_CON6 0x0272
159#define MT6397_VCORE_CON7 0x0274
160#define MT6397_VCORE_CON8 0x0276
161#define MT6397_VCORE_CON9 0x0278
162#define MT6397_VCORE_CON10 0x027A
163#define MT6397_VCORE_CON11 0x027C
164#define MT6397_VCORE_CON12 0x027E
165#define MT6397_VCORE_CON13 0x0280
166#define MT6397_VCORE_CON14 0x0282
167#define MT6397_VCORE_CON15 0x0284
168#define MT6397_VCORE_CON16 0x0286
169#define MT6397_VCORE_CON17 0x0288
170#define MT6397_VCORE_CON18 0x028A
171#define MT6397_VGPU_CON0 0x028C
172#define MT6397_VGPU_CON1 0x028E
173#define MT6397_VGPU_CON2 0x0290
174#define MT6397_VGPU_CON3 0x0292
175#define MT6397_VGPU_CON4 0x0294
176#define MT6397_VGPU_CON5 0x0296
177#define MT6397_VGPU_CON6 0x0298
178#define MT6397_VGPU_CON7 0x029A
179#define MT6397_VGPU_CON8 0x029C
180#define MT6397_VGPU_CON9 0x029E
181#define MT6397_VGPU_CON10 0x02A0
182#define MT6397_VGPU_CON11 0x02A2
183#define MT6397_VGPU_CON12 0x02A4
184#define MT6397_VGPU_CON13 0x02A6
185#define MT6397_VGPU_CON14 0x02A8
186#define MT6397_VGPU_CON15 0x02AA
187#define MT6397_VGPU_CON16 0x02AC
188#define MT6397_VGPU_CON17 0x02AE
189#define MT6397_VGPU_CON18 0x02B0
190#define MT6397_VIO18_CON0 0x0300
191#define MT6397_VIO18_CON1 0x0302
192#define MT6397_VIO18_CON2 0x0304
193#define MT6397_VIO18_CON3 0x0306
194#define MT6397_VIO18_CON4 0x0308
195#define MT6397_VIO18_CON5 0x030A
196#define MT6397_VIO18_CON6 0x030C
197#define MT6397_VIO18_CON7 0x030E
198#define MT6397_VIO18_CON8 0x0310
199#define MT6397_VIO18_CON9 0x0312
200#define MT6397_VIO18_CON10 0x0314
201#define MT6397_VIO18_CON11 0x0316
202#define MT6397_VIO18_CON12 0x0318
203#define MT6397_VIO18_CON13 0x031A
204#define MT6397_VIO18_CON14 0x031C
205#define MT6397_VIO18_CON15 0x031E
206#define MT6397_VIO18_CON16 0x0320
207#define MT6397_VIO18_CON17 0x0322
208#define MT6397_VIO18_CON18 0x0324
209#define MT6397_VPCA7_CON0 0x0326
210#define MT6397_VPCA7_CON1 0x0328
211#define MT6397_VPCA7_CON2 0x032A
212#define MT6397_VPCA7_CON3 0x032C
213#define MT6397_VPCA7_CON4 0x032E
214#define MT6397_VPCA7_CON5 0x0330
215#define MT6397_VPCA7_CON6 0x0332
216#define MT6397_VPCA7_CON7 0x0334
217#define MT6397_VPCA7_CON8 0x0336
218#define MT6397_VPCA7_CON9 0x0338
219#define MT6397_VPCA7_CON10 0x033A
220#define MT6397_VPCA7_CON11 0x033C
221#define MT6397_VPCA7_CON12 0x033E
222#define MT6397_VPCA7_CON13 0x0340
223#define MT6397_VPCA7_CON14 0x0342
224#define MT6397_VPCA7_CON15 0x0344
225#define MT6397_VPCA7_CON16 0x0346
226#define MT6397_VPCA7_CON17 0x0348
227#define MT6397_VPCA7_CON18 0x034A
228#define MT6397_VSRMCA7_CON0 0x034C
229#define MT6397_VSRMCA7_CON1 0x034E
230#define MT6397_VSRMCA7_CON2 0x0350
231#define MT6397_VSRMCA7_CON3 0x0352
232#define MT6397_VSRMCA7_CON4 0x0354
233#define MT6397_VSRMCA7_CON5 0x0356
234#define MT6397_VSRMCA7_CON6 0x0358
235#define MT6397_VSRMCA7_CON7 0x035A
236#define MT6397_VSRMCA7_CON8 0x035C
237#define MT6397_VSRMCA7_CON9 0x035E
238#define MT6397_VSRMCA7_CON10 0x0360
239#define MT6397_VSRMCA7_CON11 0x0362
240#define MT6397_VSRMCA7_CON12 0x0364
241#define MT6397_VSRMCA7_CON13 0x0366
242#define MT6397_VSRMCA7_CON14 0x0368
243#define MT6397_VSRMCA7_CON15 0x036A
244#define MT6397_VSRMCA7_CON16 0x036C
245#define MT6397_VSRMCA7_CON17 0x036E
246#define MT6397_VSRMCA7_CON18 0x0370
247#define MT6397_VSRMCA7_CON19 0x0372
248#define MT6397_VSRMCA7_CON20 0x0374
249#define MT6397_VSRMCA7_CON21 0x0376
250#define MT6397_VDRM_CON0 0x0378
251#define MT6397_VDRM_CON1 0x037A
252#define MT6397_VDRM_CON2 0x037C
253#define MT6397_VDRM_CON3 0x037E
254#define MT6397_VDRM_CON4 0x0380
255#define MT6397_VDRM_CON5 0x0382
256#define MT6397_VDRM_CON6 0x0384
257#define MT6397_VDRM_CON7 0x0386
258#define MT6397_VDRM_CON8 0x0388
259#define MT6397_VDRM_CON9 0x038A
260#define MT6397_VDRM_CON10 0x038C
261#define MT6397_VDRM_CON11 0x038E
262#define MT6397_VDRM_CON12 0x0390
263#define MT6397_VDRM_CON13 0x0392
264#define MT6397_VDRM_CON14 0x0394
265#define MT6397_VDRM_CON15 0x0396
266#define MT6397_VDRM_CON16 0x0398
267#define MT6397_VDRM_CON17 0x039A
268#define MT6397_VDRM_CON18 0x039C
269#define MT6397_BUCK_K_CON0 0x039E
270#define MT6397_BUCK_K_CON1 0x03A0
271#define MT6397_ANALDO_CON0 0x0400
272#define MT6397_ANALDO_CON1 0x0402
273#define MT6397_ANALDO_CON2 0x0404
274#define MT6397_ANALDO_CON3 0x0406
275#define MT6397_ANALDO_CON4 0x0408
276#define MT6397_ANALDO_CON5 0x040A
277#define MT6397_ANALDO_CON6 0x040C
278#define MT6397_ANALDO_CON7 0x040E
279#define MT6397_DIGLDO_CON0 0x0410
280#define MT6397_DIGLDO_CON1 0x0412
281#define MT6397_DIGLDO_CON2 0x0414
282#define MT6397_DIGLDO_CON3 0x0416
283#define MT6397_DIGLDO_CON4 0x0418
284#define MT6397_DIGLDO_CON5 0x041A
285#define MT6397_DIGLDO_CON6 0x041C
286#define MT6397_DIGLDO_CON7 0x041E
287#define MT6397_DIGLDO_CON8 0x0420
288#define MT6397_DIGLDO_CON9 0x0422
289#define MT6397_DIGLDO_CON10 0x0424
290#define MT6397_DIGLDO_CON11 0x0426
291#define MT6397_DIGLDO_CON12 0x0428
292#define MT6397_DIGLDO_CON13 0x042A
293#define MT6397_DIGLDO_CON14 0x042C
294#define MT6397_DIGLDO_CON15 0x042E
295#define MT6397_DIGLDO_CON16 0x0430
296#define MT6397_DIGLDO_CON17 0x0432
297#define MT6397_DIGLDO_CON18 0x0434
298#define MT6397_DIGLDO_CON19 0x0436
299#define MT6397_DIGLDO_CON20 0x0438
300#define MT6397_DIGLDO_CON21 0x043A
301#define MT6397_DIGLDO_CON22 0x043C
302#define MT6397_DIGLDO_CON23 0x043E
303#define MT6397_DIGLDO_CON24 0x0440
304#define MT6397_DIGLDO_CON25 0x0442
305#define MT6397_DIGLDO_CON26 0x0444
306#define MT6397_DIGLDO_CON27 0x0446
307#define MT6397_DIGLDO_CON28 0x0448
308#define MT6397_DIGLDO_CON29 0x044A
309#define MT6397_DIGLDO_CON30 0x044C
310#define MT6397_DIGLDO_CON31 0x044E
311#define MT6397_DIGLDO_CON32 0x0450
312#define MT6397_DIGLDO_CON33 0x045A
313#define MT6397_SPK_CON0 0x0600
314#define MT6397_SPK_CON1 0x0602
315#define MT6397_SPK_CON2 0x0604
316#define MT6397_SPK_CON3 0x0606
317#define MT6397_SPK_CON4 0x0608
318#define MT6397_SPK_CON5 0x060A
319#define MT6397_SPK_CON6 0x060C
320#define MT6397_SPK_CON7 0x060E
321#define MT6397_SPK_CON8 0x0610
322#define MT6397_SPK_CON9 0x0612
323#define MT6397_SPK_CON10 0x0614
324#define MT6397_SPK_CON11 0x0616
325#define MT6397_AUDDAC_CON0 0x0700
326#define MT6397_AUDBUF_CFG0 0x0702
327#define MT6397_AUDBUF_CFG1 0x0704
328#define MT6397_AUDBUF_CFG2 0x0706
329#define MT6397_AUDBUF_CFG3 0x0708
330#define MT6397_AUDBUF_CFG4 0x070A
331#define MT6397_IBIASDIST_CFG0 0x070C
332#define MT6397_AUDACCDEPOP_CFG0 0x070E
333#define MT6397_AUD_IV_CFG0 0x0710
334#define MT6397_AUDCLKGEN_CFG0 0x0712
335#define MT6397_AUDLDO_CFG0 0x0714
336#define MT6397_AUDLDO_CFG1 0x0716
337#define MT6397_AUDNVREGGLB_CFG0 0x0718
338#define MT6397_AUD_NCP0 0x071A
339#define MT6397_AUDPREAMP_CON0 0x071C
340#define MT6397_AUDADC_CON0 0x071E
341#define MT6397_AUDADC_CON1 0x0720
342#define MT6397_AUDADC_CON2 0x0722
343#define MT6397_AUDADC_CON3 0x0724
344#define MT6397_AUDADC_CON4 0x0726
345#define MT6397_AUDADC_CON5 0x0728
346#define MT6397_AUDADC_CON6 0x072A
347#define MT6397_AUDDIGMI_CON0 0x072C
348#define MT6397_AUDLSBUF_CON0 0x072E
349#define MT6397_AUDLSBUF_CON1 0x0730
350#define MT6397_AUDENCSPARE_CON0 0x0732
351#define MT6397_AUDENCCLKSQ_CON0 0x0734
352#define MT6397_AUDPREAMPGAIN_CON0 0x0736
353#define MT6397_ZCD_CON0 0x0738
354#define MT6397_ZCD_CON1 0x073A
355#define MT6397_ZCD_CON2 0x073C
356#define MT6397_ZCD_CON3 0x073E
357#define MT6397_ZCD_CON4 0x0740
358#define MT6397_ZCD_CON5 0x0742
359#define MT6397_NCP_CLKDIV_CON0 0x0744
360#define MT6397_NCP_CLKDIV_CON1 0x0746
361
362#endif /* __MFD_MT6397_REGISTERS_H__ */
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index ee7b1ce7a6f8..bb270bd03eed 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -117,6 +117,7 @@ struct palmas_pmic_driver_data {
117 int ldo_begin; 117 int ldo_begin;
118 int ldo_end; 118 int ldo_end;
119 int max_reg; 119 int max_reg;
120 bool has_regen3;
120 struct palmas_regs_info *palmas_regs_info; 121 struct palmas_regs_info *palmas_regs_info;
121 struct of_regulator_match *palmas_matches; 122 struct of_regulator_match *palmas_matches;
122 struct palmas_sleep_requestor_info *sleep_req_info; 123 struct palmas_sleep_requestor_info *sleep_req_info;
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
index fb09312d854b..441b6ee72691 100644
--- a/include/linux/mfd/rk808.h
+++ b/include/linux/mfd/rk808.h
@@ -156,6 +156,9 @@ enum rk808_reg {
156#define BUCK2_RATE_MASK (3 << 3) 156#define BUCK2_RATE_MASK (3 << 3)
157#define MASK_ALL 0xff 157#define MASK_ALL 0xff
158 158
159#define BUCK_UV_ACT_MASK 0x0f
160#define BUCK_UV_ACT_DISABLE 0
161
159#define SWITCH2_EN BIT(6) 162#define SWITCH2_EN BIT(6)
160#define SWITCH1_EN BIT(5) 163#define SWITCH1_EN BIT(5)
161#define DEV_OFF_RST BIT(3) 164#define DEV_OFF_RST BIT(3)
diff --git a/include/linux/mfd/rt5033.h b/include/linux/mfd/rt5033.h
index 010cff49a98e..6cff5cf458d2 100644
--- a/include/linux/mfd/rt5033.h
+++ b/include/linux/mfd/rt5033.h
@@ -39,7 +39,7 @@ struct rt5033_battery {
39 struct i2c_client *client; 39 struct i2c_client *client;
40 struct rt5033_dev *rt5033; 40 struct rt5033_dev *rt5033;
41 struct regmap *regmap; 41 struct regmap *regmap;
42 struct power_supply psy; 42 struct power_supply *psy;
43}; 43};
44 44
45/* RT5033 charger platform data */ 45/* RT5033 charger platform data */
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 0c12628e91c6..ff843e7ca23d 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -28,74 +28,72 @@
28 28
29#define MAX_RW_REG_CNT 1024 29#define MAX_RW_REG_CNT 1024
30 30
31/* PCI Operation Register Address */
32#define RTSX_HCBAR 0x00 31#define RTSX_HCBAR 0x00
33#define RTSX_HCBCTLR 0x04 32#define RTSX_HCBCTLR 0x04
33#define STOP_CMD (0x01 << 28)
34#define READ_REG_CMD 0
35#define WRITE_REG_CMD 1
36#define CHECK_REG_CMD 2
37
34#define RTSX_HDBAR 0x08 38#define RTSX_HDBAR 0x08
39#define SG_INT 0x04
40#define SG_END 0x02
41#define SG_VALID 0x01
42#define SG_NO_OP 0x00
43#define SG_TRANS_DATA (0x02 << 4)
44#define SG_LINK_DESC (0x03 << 4)
35#define RTSX_HDBCTLR 0x0C 45#define RTSX_HDBCTLR 0x0C
46#define SDMA_MODE 0x00
47#define ADMA_MODE (0x02 << 26)
48#define STOP_DMA (0x01 << 28)
49#define TRIG_DMA (0x01 << 31)
50
36#define RTSX_HAIMR 0x10 51#define RTSX_HAIMR 0x10
37#define RTSX_BIPR 0x14 52#define HAIMR_TRANS_START (0x01 << 31)
38#define RTSX_BIER 0x18 53#define HAIMR_READ 0x00
54#define HAIMR_WRITE (0x01 << 30)
55#define HAIMR_READ_START (HAIMR_TRANS_START | HAIMR_READ)
56#define HAIMR_WRITE_START (HAIMR_TRANS_START | HAIMR_WRITE)
57#define HAIMR_TRANS_END (HAIMR_TRANS_START)
39 58
40/* Host command buffer control register */ 59#define RTSX_BIPR 0x14
41#define STOP_CMD (0x01 << 28) 60#define CMD_DONE_INT (1 << 31)
42 61#define DATA_DONE_INT (1 << 30)
43/* Host data buffer control register */ 62#define TRANS_OK_INT (1 << 29)
44#define SDMA_MODE 0x00 63#define TRANS_FAIL_INT (1 << 28)
45#define ADMA_MODE (0x02 << 26) 64#define XD_INT (1 << 27)
46#define STOP_DMA (0x01 << 28) 65#define MS_INT (1 << 26)
47#define TRIG_DMA (0x01 << 31) 66#define SD_INT (1 << 25)
48 67#define GPIO0_INT (1 << 24)
49/* Host access internal memory register */ 68#define OC_INT (1 << 23)
50#define HAIMR_TRANS_START (0x01 << 31) 69#define SD_WRITE_PROTECT (1 << 19)
51#define HAIMR_READ 0x00 70#define XD_EXIST (1 << 18)
52#define HAIMR_WRITE (0x01 << 30) 71#define MS_EXIST (1 << 17)
53#define HAIMR_READ_START (HAIMR_TRANS_START | HAIMR_READ) 72#define SD_EXIST (1 << 16)
54#define HAIMR_WRITE_START (HAIMR_TRANS_START | HAIMR_WRITE) 73#define DELINK_INT GPIO0_INT
55#define HAIMR_TRANS_END (HAIMR_TRANS_START) 74#define MS_OC_INT (1 << 23)
56 75#define SD_OC_INT (1 << 22)
57/* Bus interrupt pending register */
58#define CMD_DONE_INT (1 << 31)
59#define DATA_DONE_INT (1 << 30)
60#define TRANS_OK_INT (1 << 29)
61#define TRANS_FAIL_INT (1 << 28)
62#define XD_INT (1 << 27)
63#define MS_INT (1 << 26)
64#define SD_INT (1 << 25)
65#define GPIO0_INT (1 << 24)
66#define OC_INT (1 << 23)
67#define SD_WRITE_PROTECT (1 << 19)
68#define XD_EXIST (1 << 18)
69#define MS_EXIST (1 << 17)
70#define SD_EXIST (1 << 16)
71#define DELINK_INT GPIO0_INT
72#define MS_OC_INT (1 << 23)
73#define SD_OC_INT (1 << 22)
74 76
75#define CARD_INT (XD_INT | MS_INT | SD_INT) 77#define CARD_INT (XD_INT | MS_INT | SD_INT)
76#define NEED_COMPLETE_INT (DATA_DONE_INT | TRANS_OK_INT | TRANS_FAIL_INT) 78#define NEED_COMPLETE_INT (DATA_DONE_INT | TRANS_OK_INT | TRANS_FAIL_INT)
77#define RTSX_INT (CMD_DONE_INT | NEED_COMPLETE_INT | \ 79#define RTSX_INT (CMD_DONE_INT | NEED_COMPLETE_INT | \
78 CARD_INT | GPIO0_INT | OC_INT) 80 CARD_INT | GPIO0_INT | OC_INT)
79
80#define CARD_EXIST (XD_EXIST | MS_EXIST | SD_EXIST) 81#define CARD_EXIST (XD_EXIST | MS_EXIST | SD_EXIST)
81 82
82/* Bus interrupt enable register */ 83#define RTSX_BIER 0x18
83#define CMD_DONE_INT_EN (1 << 31) 84#define CMD_DONE_INT_EN (1 << 31)
84#define DATA_DONE_INT_EN (1 << 30) 85#define DATA_DONE_INT_EN (1 << 30)
85#define TRANS_OK_INT_EN (1 << 29) 86#define TRANS_OK_INT_EN (1 << 29)
86#define TRANS_FAIL_INT_EN (1 << 28) 87#define TRANS_FAIL_INT_EN (1 << 28)
87#define XD_INT_EN (1 << 27) 88#define XD_INT_EN (1 << 27)
88#define MS_INT_EN (1 << 26) 89#define MS_INT_EN (1 << 26)
89#define SD_INT_EN (1 << 25) 90#define SD_INT_EN (1 << 25)
90#define GPIO0_INT_EN (1 << 24) 91#define GPIO0_INT_EN (1 << 24)
91#define OC_INT_EN (1 << 23) 92#define OC_INT_EN (1 << 23)
92#define DELINK_INT_EN GPIO0_INT_EN 93#define DELINK_INT_EN GPIO0_INT_EN
93#define MS_OC_INT_EN (1 << 23) 94#define MS_OC_INT_EN (1 << 23)
94#define SD_OC_INT_EN (1 << 22) 95#define SD_OC_INT_EN (1 << 22)
95 96
96#define READ_REG_CMD 0
97#define WRITE_REG_CMD 1
98#define CHECK_REG_CMD 2
99 97
100/* 98/*
101 * macros for easy use 99 * macros for easy use
@@ -125,423 +123,68 @@
125#define rtsx_pci_write_config_dword(pcr, where, val) \ 123#define rtsx_pci_write_config_dword(pcr, where, val) \
126 pci_write_config_dword((pcr)->pci, where, val) 124 pci_write_config_dword((pcr)->pci, where, val)
127 125
128#define STATE_TRANS_NONE 0 126#define STATE_TRANS_NONE 0
129#define STATE_TRANS_CMD 1 127#define STATE_TRANS_CMD 1
130#define STATE_TRANS_BUF 2 128#define STATE_TRANS_BUF 2
131#define STATE_TRANS_SG 3 129#define STATE_TRANS_SG 3
132
133#define TRANS_NOT_READY 0
134#define TRANS_RESULT_OK 1
135#define TRANS_RESULT_FAIL 2
136#define TRANS_NO_DEVICE 3
137
138#define RTSX_RESV_BUF_LEN 4096
139#define HOST_CMDS_BUF_LEN 1024
140#define HOST_SG_TBL_BUF_LEN (RTSX_RESV_BUF_LEN - HOST_CMDS_BUF_LEN)
141#define HOST_SG_TBL_ITEMS (HOST_SG_TBL_BUF_LEN / 8)
142#define MAX_SG_ITEM_LEN 0x80000
143
144#define HOST_TO_DEVICE 0
145#define DEVICE_TO_HOST 1
146
147#define RTSX_PHASE_MAX 32
148#define RX_TUNING_CNT 3
149
150/* SG descriptor */
151#define SG_INT 0x04
152#define SG_END 0x02
153#define SG_VALID 0x01
154
155#define SG_NO_OP 0x00
156#define SG_TRANS_DATA (0x02 << 4)
157#define SG_LINK_DESC (0x03 << 4)
158
159/* Output voltage */
160#define OUTPUT_3V3 0
161#define OUTPUT_1V8 1
162
163/* Card Clock Enable Register */
164#define SD_CLK_EN 0x04
165#define MS_CLK_EN 0x08
166
167/* Card Select Register */
168#define SD_MOD_SEL 2
169#define MS_MOD_SEL 3
170
171/* Card Output Enable Register */
172#define SD_OUTPUT_EN 0x04
173#define MS_OUTPUT_EN 0x08
174
175/* CARD_SHARE_MODE */
176#define CARD_SHARE_MASK 0x0F
177#define CARD_SHARE_MULTI_LUN 0x00
178#define CARD_SHARE_NORMAL 0x00
179#define CARD_SHARE_48_SD 0x04
180#define CARD_SHARE_48_MS 0x08
181/* CARD_SHARE_MODE for barossa */
182#define CARD_SHARE_BAROSSA_SD 0x01
183#define CARD_SHARE_BAROSSA_MS 0x02
184
185/* CARD_DRIVE_SEL */
186#define MS_DRIVE_8mA (0x01 << 6)
187#define MMC_DRIVE_8mA (0x01 << 4)
188#define XD_DRIVE_8mA (0x01 << 2)
189#define GPIO_DRIVE_8mA 0x01
190#define RTS5209_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | MMC_DRIVE_8mA |\
191 XD_DRIVE_8mA | GPIO_DRIVE_8mA)
192#define RTL8411_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | MMC_DRIVE_8mA |\
193 XD_DRIVE_8mA)
194#define RTSX_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | GPIO_DRIVE_8mA)
195 130
196/* SD30_DRIVE_SEL */ 131#define TRANS_NOT_READY 0
197#define DRIVER_TYPE_A 0x05 132#define TRANS_RESULT_OK 1
198#define DRIVER_TYPE_B 0x03 133#define TRANS_RESULT_FAIL 2
199#define DRIVER_TYPE_C 0x02 134#define TRANS_NO_DEVICE 3
200#define DRIVER_TYPE_D 0x01
201#define CFG_DRIVER_TYPE_A 0x02
202#define CFG_DRIVER_TYPE_B 0x03
203#define CFG_DRIVER_TYPE_C 0x01
204#define CFG_DRIVER_TYPE_D 0x00
205
206/* FPDCTL */
207#define SSC_POWER_DOWN 0x01
208#define SD_OC_POWER_DOWN 0x02
209#define ALL_POWER_DOWN 0x07
210#define OC_POWER_DOWN 0x06
211
212/* CLK_CTL */
213#define CHANGE_CLK 0x01
214
215/* LDO_CTL */
216#define BPP_ASIC_1V7 0x00
217#define BPP_ASIC_1V8 0x01
218#define BPP_ASIC_1V9 0x02
219#define BPP_ASIC_2V0 0x03
220#define BPP_ASIC_2V7 0x04
221#define BPP_ASIC_2V8 0x05
222#define BPP_ASIC_3V2 0x06
223#define BPP_ASIC_3V3 0x07
224#define BPP_REG_TUNED18 0x07
225#define BPP_TUNED18_SHIFT_8402 5
226#define BPP_TUNED18_SHIFT_8411 4
227#define BPP_PAD_MASK 0x04
228#define BPP_PAD_3V3 0x04
229#define BPP_PAD_1V8 0x00
230#define BPP_LDO_POWB 0x03
231#define BPP_LDO_ON 0x00
232#define BPP_LDO_SUSPEND 0x02
233#define BPP_LDO_OFF 0x03
234
235/* CD_PAD_CTL */
236#define CD_DISABLE_MASK 0x07
237#define MS_CD_DISABLE 0x04
238#define SD_CD_DISABLE 0x02
239#define XD_CD_DISABLE 0x01
240#define CD_DISABLE 0x07
241#define CD_ENABLE 0x00
242#define MS_CD_EN_ONLY 0x03
243#define SD_CD_EN_ONLY 0x05
244#define XD_CD_EN_ONLY 0x06
245#define FORCE_CD_LOW_MASK 0x38
246#define FORCE_CD_XD_LOW 0x08
247#define FORCE_CD_SD_LOW 0x10
248#define FORCE_CD_MS_LOW 0x20
249#define CD_AUTO_DISABLE 0x40
250
251/* SD_STAT1 */
252#define SD_CRC7_ERR 0x80
253#define SD_CRC16_ERR 0x40
254#define SD_CRC_WRITE_ERR 0x20
255#define SD_CRC_WRITE_ERR_MASK 0x1C
256#define GET_CRC_TIME_OUT 0x02
257#define SD_TUNING_COMPARE_ERR 0x01
258
259/* SD_STAT2 */
260#define SD_RSP_80CLK_TIMEOUT 0x01
261
262/* SD_BUS_STAT */
263#define SD_CLK_TOGGLE_EN 0x80
264#define SD_CLK_FORCE_STOP 0x40
265#define SD_DAT3_STATUS 0x10
266#define SD_DAT2_STATUS 0x08
267#define SD_DAT1_STATUS 0x04
268#define SD_DAT0_STATUS 0x02
269#define SD_CMD_STATUS 0x01
270
271/* SD_PAD_CTL */
272#define SD_IO_USING_1V8 0x80
273#define SD_IO_USING_3V3 0x7F
274#define TYPE_A_DRIVING 0x00
275#define TYPE_B_DRIVING 0x01
276#define TYPE_C_DRIVING 0x02
277#define TYPE_D_DRIVING 0x03
278
279/* SD_SAMPLE_POINT_CTL */
280#define DDR_FIX_RX_DAT 0x00
281#define DDR_VAR_RX_DAT 0x80
282#define DDR_FIX_RX_DAT_EDGE 0x00
283#define DDR_FIX_RX_DAT_14_DELAY 0x40
284#define DDR_FIX_RX_CMD 0x00
285#define DDR_VAR_RX_CMD 0x20
286#define DDR_FIX_RX_CMD_POS_EDGE 0x00
287#define DDR_FIX_RX_CMD_14_DELAY 0x10
288#define SD20_RX_POS_EDGE 0x00
289#define SD20_RX_14_DELAY 0x08
290#define SD20_RX_SEL_MASK 0x08
291 135
292/* SD_PUSH_POINT_CTL */ 136#define RTSX_RESV_BUF_LEN 4096
293#define DDR_FIX_TX_CMD_DAT 0x00 137#define HOST_CMDS_BUF_LEN 1024
294#define DDR_VAR_TX_CMD_DAT 0x80 138#define HOST_SG_TBL_BUF_LEN (RTSX_RESV_BUF_LEN - HOST_CMDS_BUF_LEN)
295#define DDR_FIX_TX_DAT_14_TSU 0x00 139#define HOST_SG_TBL_ITEMS (HOST_SG_TBL_BUF_LEN / 8)
296#define DDR_FIX_TX_DAT_12_TSU 0x40 140#define MAX_SG_ITEM_LEN 0x80000
297#define DDR_FIX_TX_CMD_NEG_EDGE 0x00 141#define HOST_TO_DEVICE 0
298#define DDR_FIX_TX_CMD_14_AHEAD 0x20 142#define DEVICE_TO_HOST 1
299#define SD20_TX_NEG_EDGE 0x00
300#define SD20_TX_14_AHEAD 0x10
301#define SD20_TX_SEL_MASK 0x10
302#define DDR_VAR_SDCLK_POL_SWAP 0x01
303
304/* SD_TRANSFER */
305#define SD_TRANSFER_START 0x80
306#define SD_TRANSFER_END 0x40
307#define SD_STAT_IDLE 0x20
308#define SD_TRANSFER_ERR 0x10
309/* SD Transfer Mode definition */
310#define SD_TM_NORMAL_WRITE 0x00
311#define SD_TM_AUTO_WRITE_3 0x01
312#define SD_TM_AUTO_WRITE_4 0x02
313#define SD_TM_AUTO_READ_3 0x05
314#define SD_TM_AUTO_READ_4 0x06
315#define SD_TM_CMD_RSP 0x08
316#define SD_TM_AUTO_WRITE_1 0x09
317#define SD_TM_AUTO_WRITE_2 0x0A
318#define SD_TM_NORMAL_READ 0x0C
319#define SD_TM_AUTO_READ_1 0x0D
320#define SD_TM_AUTO_READ_2 0x0E
321#define SD_TM_AUTO_TUNING 0x0F
322
323/* SD_VPTX_CTL / SD_VPRX_CTL */
324#define PHASE_CHANGE 0x80
325#define PHASE_NOT_RESET 0x40
326
327/* SD_DCMPS_TX_CTL / SD_DCMPS_RX_CTL */
328#define DCMPS_CHANGE 0x80
329#define DCMPS_CHANGE_DONE 0x40
330#define DCMPS_ERROR 0x20
331#define DCMPS_CURRENT_PHASE 0x1F
332
333/* SD Configure 1 Register */
334#define SD_CLK_DIVIDE_0 0x00
335#define SD_CLK_DIVIDE_256 0xC0
336#define SD_CLK_DIVIDE_128 0x80
337#define SD_BUS_WIDTH_1BIT 0x00
338#define SD_BUS_WIDTH_4BIT 0x01
339#define SD_BUS_WIDTH_8BIT 0x02
340#define SD_ASYNC_FIFO_NOT_RST 0x10
341#define SD_20_MODE 0x00
342#define SD_DDR_MODE 0x04
343#define SD_30_MODE 0x08
344
345#define SD_CLK_DIVIDE_MASK 0xC0
346
347/* SD_CMD_STATE */
348#define SD_CMD_IDLE 0x80
349
350/* SD_DATA_STATE */
351#define SD_DATA_IDLE 0x80
352
353/* DCM_DRP_CTL */
354#define DCM_RESET 0x08
355#define DCM_LOCKED 0x04
356#define DCM_208M 0x00
357#define DCM_TX 0x01
358#define DCM_RX 0x02
359
360/* DCM_DRP_TRIG */
361#define DRP_START 0x80
362#define DRP_DONE 0x40
363
364/* DCM_DRP_CFG */
365#define DRP_WRITE 0x80
366#define DRP_READ 0x00
367#define DCM_WRITE_ADDRESS_50 0x50
368#define DCM_WRITE_ADDRESS_51 0x51
369#define DCM_READ_ADDRESS_00 0x00
370#define DCM_READ_ADDRESS_51 0x51
371
372/* IRQSTAT0 */
373#define DMA_DONE_INT 0x80
374#define SUSPEND_INT 0x40
375#define LINK_RDY_INT 0x20
376#define LINK_DOWN_INT 0x10
377
378/* DMACTL */
379#define DMA_RST 0x80
380#define DMA_BUSY 0x04
381#define DMA_DIR_TO_CARD 0x00
382#define DMA_DIR_FROM_CARD 0x02
383#define DMA_EN 0x01
384#define DMA_128 (0 << 4)
385#define DMA_256 (1 << 4)
386#define DMA_512 (2 << 4)
387#define DMA_1024 (3 << 4)
388#define DMA_PACK_SIZE_MASK 0x30
389
390/* SSC_CTL1 */
391#define SSC_RSTB 0x80
392#define SSC_8X_EN 0x40
393#define SSC_FIX_FRAC 0x20
394#define SSC_SEL_1M 0x00
395#define SSC_SEL_2M 0x08
396#define SSC_SEL_4M 0x10
397#define SSC_SEL_8M 0x18
398
399/* SSC_CTL2 */
400#define SSC_DEPTH_MASK 0x07
401#define SSC_DEPTH_DISALBE 0x00
402#define SSC_DEPTH_4M 0x01
403#define SSC_DEPTH_2M 0x02
404#define SSC_DEPTH_1M 0x03
405#define SSC_DEPTH_500K 0x04
406#define SSC_DEPTH_250K 0x05
407
408/* System Clock Control Register */
409#define CLK_LOW_FREQ 0x01
410
411/* System Clock Divider Register */
412#define CLK_DIV_1 0x01
413#define CLK_DIV_2 0x02
414#define CLK_DIV_4 0x03
415#define CLK_DIV_8 0x04
416
417/* MS_CFG */
418#define SAMPLE_TIME_RISING 0x00
419#define SAMPLE_TIME_FALLING 0x80
420#define PUSH_TIME_DEFAULT 0x00
421#define PUSH_TIME_ODD 0x40
422#define NO_EXTEND_TOGGLE 0x00
423#define EXTEND_TOGGLE_CHK 0x20
424#define MS_BUS_WIDTH_1 0x00
425#define MS_BUS_WIDTH_4 0x10
426#define MS_BUS_WIDTH_8 0x18
427#define MS_2K_SECTOR_MODE 0x04
428#define MS_512_SECTOR_MODE 0x00
429#define MS_TOGGLE_TIMEOUT_EN 0x00
430#define MS_TOGGLE_TIMEOUT_DISEN 0x01
431#define MS_NO_CHECK_INT 0x02
432 143
433/* MS_TRANS_CFG */ 144#define OUTPUT_3V3 0
434#define WAIT_INT 0x80 145#define OUTPUT_1V8 1
435#define NO_WAIT_INT 0x00 146
436#define NO_AUTO_READ_INT_REG 0x00 147#define RTSX_PHASE_MAX 32
437#define AUTO_READ_INT_REG 0x40 148#define RX_TUNING_CNT 3
438#define MS_CRC16_ERR 0x20
439#define MS_RDY_TIMEOUT 0x10
440#define MS_INT_CMDNK 0x08
441#define MS_INT_BREQ 0x04
442#define MS_INT_ERR 0x02
443#define MS_INT_CED 0x01
444
445/* MS_TRANSFER */
446#define MS_TRANSFER_START 0x80
447#define MS_TRANSFER_END 0x40
448#define MS_TRANSFER_ERR 0x20
449#define MS_BS_STATE 0x10
450#define MS_TM_READ_BYTES 0x00
451#define MS_TM_NORMAL_READ 0x01
452#define MS_TM_WRITE_BYTES 0x04
453#define MS_TM_NORMAL_WRITE 0x05
454#define MS_TM_AUTO_READ 0x08
455#define MS_TM_AUTO_WRITE 0x0C
456
457/* SD Configure 2 Register */
458#define SD_CALCULATE_CRC7 0x00
459#define SD_NO_CALCULATE_CRC7 0x80
460#define SD_CHECK_CRC16 0x00
461#define SD_NO_CHECK_CRC16 0x40
462#define SD_NO_CHECK_WAIT_CRC_TO 0x20
463#define SD_WAIT_BUSY_END 0x08
464#define SD_NO_WAIT_BUSY_END 0x00
465#define SD_CHECK_CRC7 0x00
466#define SD_NO_CHECK_CRC7 0x04
467#define SD_RSP_LEN_0 0x00
468#define SD_RSP_LEN_6 0x01
469#define SD_RSP_LEN_17 0x02
470/* SD/MMC Response Type Definition */
471#define SD_RSP_TYPE_R0 0x04
472#define SD_RSP_TYPE_R1 0x01
473#define SD_RSP_TYPE_R1b 0x09
474#define SD_RSP_TYPE_R2 0x02
475#define SD_RSP_TYPE_R3 0x05
476#define SD_RSP_TYPE_R4 0x05
477#define SD_RSP_TYPE_R5 0x01
478#define SD_RSP_TYPE_R6 0x01
479#define SD_RSP_TYPE_R7 0x01
480
481/* SD_CONFIGURE3 */
482#define SD_RSP_80CLK_TIMEOUT_EN 0x01
483
484/* Card Transfer Reset Register */
485#define SPI_STOP 0x01
486#define XD_STOP 0x02
487#define SD_STOP 0x04
488#define MS_STOP 0x08
489#define SPI_CLR_ERR 0x10
490#define XD_CLR_ERR 0x20
491#define SD_CLR_ERR 0x40
492#define MS_CLR_ERR 0x80
493
494/* Card Data Source Register */
495#define PINGPONG_BUFFER 0x01
496#define RING_BUFFER 0x00
497
498/* Card Power Control Register */
499#define PMOS_STRG_MASK 0x10
500#define PMOS_STRG_800mA 0x10
501#define PMOS_STRG_400mA 0x00
502#define SD_POWER_OFF 0x03
503#define SD_PARTIAL_POWER_ON 0x01
504#define SD_POWER_ON 0x00
505#define SD_POWER_MASK 0x03
506#define MS_POWER_OFF 0x0C
507#define MS_PARTIAL_POWER_ON 0x04
508#define MS_POWER_ON 0x00
509#define MS_POWER_MASK 0x0C
510#define BPP_POWER_OFF 0x0F
511#define BPP_POWER_5_PERCENT_ON 0x0E
512#define BPP_POWER_10_PERCENT_ON 0x0C
513#define BPP_POWER_15_PERCENT_ON 0x08
514#define BPP_POWER_ON 0x00
515#define BPP_POWER_MASK 0x0F
516#define SD_VCC_PARTIAL_POWER_ON 0x02
517#define SD_VCC_POWER_ON 0x00
518
519/* PWR_GATE_CTRL */
520#define PWR_GATE_EN 0x01
521#define LDO3318_PWR_MASK 0x06
522#define LDO_ON 0x00
523#define LDO_SUSPEND 0x04
524#define LDO_OFF 0x06
525
526/* CARD_CLK_SOURCE */
527#define CRC_FIX_CLK (0x00 << 0)
528#define CRC_VAR_CLK0 (0x01 << 0)
529#define CRC_VAR_CLK1 (0x02 << 0)
530#define SD30_FIX_CLK (0x00 << 2)
531#define SD30_VAR_CLK0 (0x01 << 2)
532#define SD30_VAR_CLK1 (0x02 << 2)
533#define SAMPLE_FIX_CLK (0x00 << 4)
534#define SAMPLE_VAR_CLK0 (0x01 << 4)
535#define SAMPLE_VAR_CLK1 (0x02 << 4)
536
537/* HOST_SLEEP_STATE */
538#define HOST_ENTER_S1 1
539#define HOST_ENTER_S3 2
540 149
541#define MS_CFG 0xFD40 150#define MS_CFG 0xFD40
151#define SAMPLE_TIME_RISING 0x00
152#define SAMPLE_TIME_FALLING 0x80
153#define PUSH_TIME_DEFAULT 0x00
154#define PUSH_TIME_ODD 0x40
155#define NO_EXTEND_TOGGLE 0x00
156#define EXTEND_TOGGLE_CHK 0x20
157#define MS_BUS_WIDTH_1 0x00
158#define MS_BUS_WIDTH_4 0x10
159#define MS_BUS_WIDTH_8 0x18
160#define MS_2K_SECTOR_MODE 0x04
161#define MS_512_SECTOR_MODE 0x00
162#define MS_TOGGLE_TIMEOUT_EN 0x00
163#define MS_TOGGLE_TIMEOUT_DISEN 0x01
164#define MS_NO_CHECK_INT 0x02
542#define MS_TPC 0xFD41 165#define MS_TPC 0xFD41
543#define MS_TRANS_CFG 0xFD42 166#define MS_TRANS_CFG 0xFD42
167#define WAIT_INT 0x80
168#define NO_WAIT_INT 0x00
169#define NO_AUTO_READ_INT_REG 0x00
170#define AUTO_READ_INT_REG 0x40
171#define MS_CRC16_ERR 0x20
172#define MS_RDY_TIMEOUT 0x10
173#define MS_INT_CMDNK 0x08
174#define MS_INT_BREQ 0x04
175#define MS_INT_ERR 0x02
176#define MS_INT_CED 0x01
544#define MS_TRANSFER 0xFD43 177#define MS_TRANSFER 0xFD43
178#define MS_TRANSFER_START 0x80
179#define MS_TRANSFER_END 0x40
180#define MS_TRANSFER_ERR 0x20
181#define MS_BS_STATE 0x10
182#define MS_TM_READ_BYTES 0x00
183#define MS_TM_NORMAL_READ 0x01
184#define MS_TM_WRITE_BYTES 0x04
185#define MS_TM_NORMAL_WRITE 0x05
186#define MS_TM_AUTO_READ 0x08
187#define MS_TM_AUTO_WRITE 0x0C
545#define MS_INT_REG 0xFD44 188#define MS_INT_REG 0xFD44
546#define MS_BYTE_CNT 0xFD45 189#define MS_BYTE_CNT 0xFD45
547#define MS_SECTOR_CNT_L 0xFD46 190#define MS_SECTOR_CNT_L 0xFD46
@@ -549,14 +192,90 @@
549#define MS_DBUS_H 0xFD48 192#define MS_DBUS_H 0xFD48
550 193
551#define SD_CFG1 0xFDA0 194#define SD_CFG1 0xFDA0
195#define SD_CLK_DIVIDE_0 0x00
196#define SD_CLK_DIVIDE_256 0xC0
197#define SD_CLK_DIVIDE_128 0x80
198#define SD_BUS_WIDTH_1BIT 0x00
199#define SD_BUS_WIDTH_4BIT 0x01
200#define SD_BUS_WIDTH_8BIT 0x02
201#define SD_ASYNC_FIFO_NOT_RST 0x10
202#define SD_20_MODE 0x00
203#define SD_DDR_MODE 0x04
204#define SD_30_MODE 0x08
205#define SD_CLK_DIVIDE_MASK 0xC0
552#define SD_CFG2 0xFDA1 206#define SD_CFG2 0xFDA1
207#define SD_CALCULATE_CRC7 0x00
208#define SD_NO_CALCULATE_CRC7 0x80
209#define SD_CHECK_CRC16 0x00
210#define SD_NO_CHECK_CRC16 0x40
211#define SD_NO_CHECK_WAIT_CRC_TO 0x20
212#define SD_WAIT_BUSY_END 0x08
213#define SD_NO_WAIT_BUSY_END 0x00
214#define SD_CHECK_CRC7 0x00
215#define SD_NO_CHECK_CRC7 0x04
216#define SD_RSP_LEN_0 0x00
217#define SD_RSP_LEN_6 0x01
218#define SD_RSP_LEN_17 0x02
219#define SD_RSP_TYPE_R0 0x04
220#define SD_RSP_TYPE_R1 0x01
221#define SD_RSP_TYPE_R1b 0x09
222#define SD_RSP_TYPE_R2 0x02
223#define SD_RSP_TYPE_R3 0x05
224#define SD_RSP_TYPE_R4 0x05
225#define SD_RSP_TYPE_R5 0x01
226#define SD_RSP_TYPE_R6 0x01
227#define SD_RSP_TYPE_R7 0x01
553#define SD_CFG3 0xFDA2 228#define SD_CFG3 0xFDA2
229#define SD_RSP_80CLK_TIMEOUT_EN 0x01
230
554#define SD_STAT1 0xFDA3 231#define SD_STAT1 0xFDA3
232#define SD_CRC7_ERR 0x80
233#define SD_CRC16_ERR 0x40
234#define SD_CRC_WRITE_ERR 0x20
235#define SD_CRC_WRITE_ERR_MASK 0x1C
236#define GET_CRC_TIME_OUT 0x02
237#define SD_TUNING_COMPARE_ERR 0x01
555#define SD_STAT2 0xFDA4 238#define SD_STAT2 0xFDA4
239#define SD_RSP_80CLK_TIMEOUT 0x01
240
556#define SD_BUS_STAT 0xFDA5 241#define SD_BUS_STAT 0xFDA5
242#define SD_CLK_TOGGLE_EN 0x80
243#define SD_CLK_FORCE_STOP 0x40
244#define SD_DAT3_STATUS 0x10
245#define SD_DAT2_STATUS 0x08
246#define SD_DAT1_STATUS 0x04
247#define SD_DAT0_STATUS 0x02
248#define SD_CMD_STATUS 0x01
557#define SD_PAD_CTL 0xFDA6 249#define SD_PAD_CTL 0xFDA6
250#define SD_IO_USING_1V8 0x80
251#define SD_IO_USING_3V3 0x7F
252#define TYPE_A_DRIVING 0x00
253#define TYPE_B_DRIVING 0x01
254#define TYPE_C_DRIVING 0x02
255#define TYPE_D_DRIVING 0x03
558#define SD_SAMPLE_POINT_CTL 0xFDA7 256#define SD_SAMPLE_POINT_CTL 0xFDA7
257#define DDR_FIX_RX_DAT 0x00
258#define DDR_VAR_RX_DAT 0x80
259#define DDR_FIX_RX_DAT_EDGE 0x00
260#define DDR_FIX_RX_DAT_14_DELAY 0x40
261#define DDR_FIX_RX_CMD 0x00
262#define DDR_VAR_RX_CMD 0x20
263#define DDR_FIX_RX_CMD_POS_EDGE 0x00
264#define DDR_FIX_RX_CMD_14_DELAY 0x10
265#define SD20_RX_POS_EDGE 0x00
266#define SD20_RX_14_DELAY 0x08
267#define SD20_RX_SEL_MASK 0x08
559#define SD_PUSH_POINT_CTL 0xFDA8 268#define SD_PUSH_POINT_CTL 0xFDA8
269#define DDR_FIX_TX_CMD_DAT 0x00
270#define DDR_VAR_TX_CMD_DAT 0x80
271#define DDR_FIX_TX_DAT_14_TSU 0x00
272#define DDR_FIX_TX_DAT_12_TSU 0x40
273#define DDR_FIX_TX_CMD_NEG_EDGE 0x00
274#define DDR_FIX_TX_CMD_14_AHEAD 0x20
275#define SD20_TX_NEG_EDGE 0x00
276#define SD20_TX_14_AHEAD 0x10
277#define SD20_TX_SEL_MASK 0x10
278#define DDR_VAR_SDCLK_POL_SWAP 0x01
560#define SD_CMD0 0xFDA9 279#define SD_CMD0 0xFDA9
561#define SD_CMD_START 0x40 280#define SD_CMD_START 0x40
562#define SD_CMD1 0xFDAA 281#define SD_CMD1 0xFDAA
@@ -569,60 +288,203 @@
569#define SD_BLOCK_CNT_L 0xFDB1 288#define SD_BLOCK_CNT_L 0xFDB1
570#define SD_BLOCK_CNT_H 0xFDB2 289#define SD_BLOCK_CNT_H 0xFDB2
571#define SD_TRANSFER 0xFDB3 290#define SD_TRANSFER 0xFDB3
291#define SD_TRANSFER_START 0x80
292#define SD_TRANSFER_END 0x40
293#define SD_STAT_IDLE 0x20
294#define SD_TRANSFER_ERR 0x10
295#define SD_TM_NORMAL_WRITE 0x00
296#define SD_TM_AUTO_WRITE_3 0x01
297#define SD_TM_AUTO_WRITE_4 0x02
298#define SD_TM_AUTO_READ_3 0x05
299#define SD_TM_AUTO_READ_4 0x06
300#define SD_TM_CMD_RSP 0x08
301#define SD_TM_AUTO_WRITE_1 0x09
302#define SD_TM_AUTO_WRITE_2 0x0A
303#define SD_TM_NORMAL_READ 0x0C
304#define SD_TM_AUTO_READ_1 0x0D
305#define SD_TM_AUTO_READ_2 0x0E
306#define SD_TM_AUTO_TUNING 0x0F
572#define SD_CMD_STATE 0xFDB5 307#define SD_CMD_STATE 0xFDB5
308#define SD_CMD_IDLE 0x80
309
573#define SD_DATA_STATE 0xFDB6 310#define SD_DATA_STATE 0xFDB6
311#define SD_DATA_IDLE 0x80
574 312
575#define SRCTL 0xFC13 313#define SRCTL 0xFC13
576 314
577#define DCM_DRP_CTL 0xFC23 315#define DCM_DRP_CTL 0xFC23
578#define DCM_DRP_TRIG 0xFC24 316#define DCM_RESET 0x08
579#define DCM_DRP_CFG 0xFC25 317#define DCM_LOCKED 0x04
580#define DCM_DRP_WR_DATA_L 0xFC26 318#define DCM_208M 0x00
581#define DCM_DRP_WR_DATA_H 0xFC27 319#define DCM_TX 0x01
582#define DCM_DRP_RD_DATA_L 0xFC28 320#define DCM_RX 0x02
583#define DCM_DRP_RD_DATA_H 0xFC29 321#define DCM_DRP_TRIG 0xFC24
322#define DRP_START 0x80
323#define DRP_DONE 0x40
324#define DCM_DRP_CFG 0xFC25
325#define DRP_WRITE 0x80
326#define DRP_READ 0x00
327#define DCM_WRITE_ADDRESS_50 0x50
328#define DCM_WRITE_ADDRESS_51 0x51
329#define DCM_READ_ADDRESS_00 0x00
330#define DCM_READ_ADDRESS_51 0x51
331#define DCM_DRP_WR_DATA_L 0xFC26
332#define DCM_DRP_WR_DATA_H 0xFC27
333#define DCM_DRP_RD_DATA_L 0xFC28
334#define DCM_DRP_RD_DATA_H 0xFC29
584#define SD_VPCLK0_CTL 0xFC2A 335#define SD_VPCLK0_CTL 0xFC2A
585#define SD_VPCLK1_CTL 0xFC2B 336#define SD_VPCLK1_CTL 0xFC2B
586#define SD_DCMPS0_CTL 0xFC2C 337#define SD_DCMPS0_CTL 0xFC2C
587#define SD_DCMPS1_CTL 0xFC2D 338#define SD_DCMPS1_CTL 0xFC2D
588#define SD_VPTX_CTL SD_VPCLK0_CTL 339#define SD_VPTX_CTL SD_VPCLK0_CTL
589#define SD_VPRX_CTL SD_VPCLK1_CTL 340#define SD_VPRX_CTL SD_VPCLK1_CTL
341#define PHASE_CHANGE 0x80
342#define PHASE_NOT_RESET 0x40
590#define SD_DCMPS_TX_CTL SD_DCMPS0_CTL 343#define SD_DCMPS_TX_CTL SD_DCMPS0_CTL
591#define SD_DCMPS_RX_CTL SD_DCMPS1_CTL 344#define SD_DCMPS_RX_CTL SD_DCMPS1_CTL
345#define DCMPS_CHANGE 0x80
346#define DCMPS_CHANGE_DONE 0x40
347#define DCMPS_ERROR 0x20
348#define DCMPS_CURRENT_PHASE 0x1F
592#define CARD_CLK_SOURCE 0xFC2E 349#define CARD_CLK_SOURCE 0xFC2E
593 350#define CRC_FIX_CLK (0x00 << 0)
351#define CRC_VAR_CLK0 (0x01 << 0)
352#define CRC_VAR_CLK1 (0x02 << 0)
353#define SD30_FIX_CLK (0x00 << 2)
354#define SD30_VAR_CLK0 (0x01 << 2)
355#define SD30_VAR_CLK1 (0x02 << 2)
356#define SAMPLE_FIX_CLK (0x00 << 4)
357#define SAMPLE_VAR_CLK0 (0x01 << 4)
358#define SAMPLE_VAR_CLK1 (0x02 << 4)
594#define CARD_PWR_CTL 0xFD50 359#define CARD_PWR_CTL 0xFD50
360#define PMOS_STRG_MASK 0x10
361#define PMOS_STRG_800mA 0x10
362#define PMOS_STRG_400mA 0x00
363#define SD_POWER_OFF 0x03
364#define SD_PARTIAL_POWER_ON 0x01
365#define SD_POWER_ON 0x00
366#define SD_POWER_MASK 0x03
367#define MS_POWER_OFF 0x0C
368#define MS_PARTIAL_POWER_ON 0x04
369#define MS_POWER_ON 0x00
370#define MS_POWER_MASK 0x0C
371#define BPP_POWER_OFF 0x0F
372#define BPP_POWER_5_PERCENT_ON 0x0E
373#define BPP_POWER_10_PERCENT_ON 0x0C
374#define BPP_POWER_15_PERCENT_ON 0x08
375#define BPP_POWER_ON 0x00
376#define BPP_POWER_MASK 0x0F
377#define SD_VCC_PARTIAL_POWER_ON 0x02
378#define SD_VCC_POWER_ON 0x00
595#define CARD_CLK_SWITCH 0xFD51 379#define CARD_CLK_SWITCH 0xFD51
596#define RTL8411B_PACKAGE_MODE 0xFD51 380#define RTL8411B_PACKAGE_MODE 0xFD51
597#define CARD_SHARE_MODE 0xFD52 381#define CARD_SHARE_MODE 0xFD52
382#define CARD_SHARE_MASK 0x0F
383#define CARD_SHARE_MULTI_LUN 0x00
384#define CARD_SHARE_NORMAL 0x00
385#define CARD_SHARE_48_SD 0x04
386#define CARD_SHARE_48_MS 0x08
387#define CARD_SHARE_BAROSSA_SD 0x01
388#define CARD_SHARE_BAROSSA_MS 0x02
598#define CARD_DRIVE_SEL 0xFD53 389#define CARD_DRIVE_SEL 0xFD53
390#define MS_DRIVE_8mA (0x01 << 6)
391#define MMC_DRIVE_8mA (0x01 << 4)
392#define XD_DRIVE_8mA (0x01 << 2)
393#define GPIO_DRIVE_8mA 0x01
394#define RTS5209_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | MMC_DRIVE_8mA |\
395 XD_DRIVE_8mA | GPIO_DRIVE_8mA)
396#define RTL8411_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | MMC_DRIVE_8mA |\
397 XD_DRIVE_8mA)
398#define RTSX_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | GPIO_DRIVE_8mA)
399
599#define CARD_STOP 0xFD54 400#define CARD_STOP 0xFD54
401#define SPI_STOP 0x01
402#define XD_STOP 0x02
403#define SD_STOP 0x04
404#define MS_STOP 0x08
405#define SPI_CLR_ERR 0x10
406#define XD_CLR_ERR 0x20
407#define SD_CLR_ERR 0x40
408#define MS_CLR_ERR 0x80
600#define CARD_OE 0xFD55 409#define CARD_OE 0xFD55
410#define SD_OUTPUT_EN 0x04
411#define MS_OUTPUT_EN 0x08
601#define CARD_AUTO_BLINK 0xFD56 412#define CARD_AUTO_BLINK 0xFD56
602#define CARD_GPIO_DIR 0xFD57 413#define CARD_GPIO_DIR 0xFD57
603#define CARD_GPIO 0xFD58 414#define CARD_GPIO 0xFD58
604#define CARD_DATA_SOURCE 0xFD5B 415#define CARD_DATA_SOURCE 0xFD5B
416#define PINGPONG_BUFFER 0x01
417#define RING_BUFFER 0x00
605#define SD30_CLK_DRIVE_SEL 0xFD5A 418#define SD30_CLK_DRIVE_SEL 0xFD5A
419#define DRIVER_TYPE_A 0x05
420#define DRIVER_TYPE_B 0x03
421#define DRIVER_TYPE_C 0x02
422#define DRIVER_TYPE_D 0x01
606#define CARD_SELECT 0xFD5C 423#define CARD_SELECT 0xFD5C
424#define SD_MOD_SEL 2
425#define MS_MOD_SEL 3
607#define SD30_DRIVE_SEL 0xFD5E 426#define SD30_DRIVE_SEL 0xFD5E
427#define CFG_DRIVER_TYPE_A 0x02
428#define CFG_DRIVER_TYPE_B 0x03
429#define CFG_DRIVER_TYPE_C 0x01
430#define CFG_DRIVER_TYPE_D 0x00
608#define SD30_CMD_DRIVE_SEL 0xFD5E 431#define SD30_CMD_DRIVE_SEL 0xFD5E
609#define SD30_DAT_DRIVE_SEL 0xFD5F 432#define SD30_DAT_DRIVE_SEL 0xFD5F
610#define CARD_CLK_EN 0xFD69 433#define CARD_CLK_EN 0xFD69
434#define SD_CLK_EN 0x04
435#define MS_CLK_EN 0x08
611#define SDIO_CTRL 0xFD6B 436#define SDIO_CTRL 0xFD6B
612#define CD_PAD_CTL 0xFD73 437#define CD_PAD_CTL 0xFD73
613 438#define CD_DISABLE_MASK 0x07
439#define MS_CD_DISABLE 0x04
440#define SD_CD_DISABLE 0x02
441#define XD_CD_DISABLE 0x01
442#define CD_DISABLE 0x07
443#define CD_ENABLE 0x00
444#define MS_CD_EN_ONLY 0x03
445#define SD_CD_EN_ONLY 0x05
446#define XD_CD_EN_ONLY 0x06
447#define FORCE_CD_LOW_MASK 0x38
448#define FORCE_CD_XD_LOW 0x08
449#define FORCE_CD_SD_LOW 0x10
450#define FORCE_CD_MS_LOW 0x20
451#define CD_AUTO_DISABLE 0x40
614#define FPDCTL 0xFC00 452#define FPDCTL 0xFC00
453#define SSC_POWER_DOWN 0x01
454#define SD_OC_POWER_DOWN 0x02
455#define ALL_POWER_DOWN 0x07
456#define OC_POWER_DOWN 0x06
615#define PDINFO 0xFC01 457#define PDINFO 0xFC01
616 458
617#define CLK_CTL 0xFC02 459#define CLK_CTL 0xFC02
460#define CHANGE_CLK 0x01
461#define CLK_LOW_FREQ 0x01
462
618#define CLK_DIV 0xFC03 463#define CLK_DIV 0xFC03
464#define CLK_DIV_1 0x01
465#define CLK_DIV_2 0x02
466#define CLK_DIV_4 0x03
467#define CLK_DIV_8 0x04
619#define CLK_SEL 0xFC04 468#define CLK_SEL 0xFC04
620 469
621#define SSC_DIV_N_0 0xFC0F 470#define SSC_DIV_N_0 0xFC0F
622#define SSC_DIV_N_1 0xFC10 471#define SSC_DIV_N_1 0xFC10
623#define SSC_CTL1 0xFC11 472#define SSC_CTL1 0xFC11
473#define SSC_RSTB 0x80
474#define SSC_8X_EN 0x40
475#define SSC_FIX_FRAC 0x20
476#define SSC_SEL_1M 0x00
477#define SSC_SEL_2M 0x08
478#define SSC_SEL_4M 0x10
479#define SSC_SEL_8M 0x18
624#define SSC_CTL2 0xFC12 480#define SSC_CTL2 0xFC12
625 481#define SSC_DEPTH_MASK 0x07
482#define SSC_DEPTH_DISALBE 0x00
483#define SSC_DEPTH_4M 0x01
484#define SSC_DEPTH_2M 0x02
485#define SSC_DEPTH_1M 0x03
486#define SSC_DEPTH_500K 0x04
487#define SSC_DEPTH_250K 0x05
626#define RCCTL 0xFC14 488#define RCCTL 0xFC14
627 489
628#define FPGA_PULL_CTL 0xFC1D 490#define FPGA_PULL_CTL 0xFC1D
@@ -630,6 +492,24 @@
630#define GPIO_CTL 0xFC1F 492#define GPIO_CTL 0xFC1F
631 493
632#define LDO_CTL 0xFC1E 494#define LDO_CTL 0xFC1E
495#define BPP_ASIC_1V7 0x00
496#define BPP_ASIC_1V8 0x01
497#define BPP_ASIC_1V9 0x02
498#define BPP_ASIC_2V0 0x03
499#define BPP_ASIC_2V7 0x04
500#define BPP_ASIC_2V8 0x05
501#define BPP_ASIC_3V2 0x06
502#define BPP_ASIC_3V3 0x07
503#define BPP_REG_TUNED18 0x07
504#define BPP_TUNED18_SHIFT_8402 5
505#define BPP_TUNED18_SHIFT_8411 4
506#define BPP_PAD_MASK 0x04
507#define BPP_PAD_3V3 0x04
508#define BPP_PAD_1V8 0x00
509#define BPP_LDO_POWB 0x03
510#define BPP_LDO_ON 0x00
511#define BPP_LDO_SUSPEND 0x02
512#define BPP_LDO_OFF 0x03
633#define SYS_VER 0xFC32 513#define SYS_VER 0xFC32
634 514
635#define CARD_PULL_CTL1 0xFD60 515#define CARD_PULL_CTL1 0xFD60
@@ -642,6 +522,10 @@
642/* PCI Express Related Registers */ 522/* PCI Express Related Registers */
643#define IRQEN0 0xFE20 523#define IRQEN0 0xFE20
644#define IRQSTAT0 0xFE21 524#define IRQSTAT0 0xFE21
525#define DMA_DONE_INT 0x80
526#define SUSPEND_INT 0x40
527#define LINK_RDY_INT 0x20
528#define LINK_DOWN_INT 0x10
645#define IRQEN1 0xFE22 529#define IRQEN1 0xFE22
646#define IRQSTAT1 0xFE23 530#define IRQSTAT1 0xFE23
647#define TLPRIEN 0xFE24 531#define TLPRIEN 0xFE24
@@ -653,6 +537,16 @@
653#define DMATC2 0xFE2A 537#define DMATC2 0xFE2A
654#define DMATC3 0xFE2B 538#define DMATC3 0xFE2B
655#define DMACTL 0xFE2C 539#define DMACTL 0xFE2C
540#define DMA_RST 0x80
541#define DMA_BUSY 0x04
542#define DMA_DIR_TO_CARD 0x00
543#define DMA_DIR_FROM_CARD 0x02
544#define DMA_EN 0x01
545#define DMA_128 (0 << 4)
546#define DMA_256 (1 << 4)
547#define DMA_512 (2 << 4)
548#define DMA_1024 (3 << 4)
549#define DMA_PACK_SIZE_MASK 0x30
656#define BCTL 0xFE2D 550#define BCTL 0xFE2D
657#define RBBC0 0xFE2E 551#define RBBC0 0xFE2E
658#define RBBC1 0xFE2F 552#define RBBC1 0xFE2F
@@ -678,14 +572,21 @@
678#define MSGTXDATA2 0xFE46 572#define MSGTXDATA2 0xFE46
679#define MSGTXDATA3 0xFE47 573#define MSGTXDATA3 0xFE47
680#define MSGTXCTL 0xFE48 574#define MSGTXCTL 0xFE48
681#define PETXCFG 0xFE49
682#define LTR_CTL 0xFE4A 575#define LTR_CTL 0xFE4A
683#define OBFF_CFG 0xFE4C 576#define OBFF_CFG 0xFE4C
684 577
685#define CDRESUMECTL 0xFE52 578#define CDRESUMECTL 0xFE52
686#define WAKE_SEL_CTL 0xFE54 579#define WAKE_SEL_CTL 0xFE54
580#define PCLK_CTL 0xFE55
581#define PCLK_MODE_SEL 0x20
687#define PME_FORCE_CTL 0xFE56 582#define PME_FORCE_CTL 0xFE56
583
688#define ASPM_FORCE_CTL 0xFE57 584#define ASPM_FORCE_CTL 0xFE57
585#define FORCE_ASPM_CTL0 0x10
586#define FORCE_ASPM_VAL_MASK 0x03
587#define FORCE_ASPM_L1_EN 0x02
588#define FORCE_ASPM_L0_EN 0x01
589#define FORCE_ASPM_NO_ASPM 0x00
689#define PM_CLK_FORCE_CTL 0xFE58 590#define PM_CLK_FORCE_CTL 0xFE58
690#define FUNC_FORCE_CTL 0xFE59 591#define FUNC_FORCE_CTL 0xFE59
691#define PERST_GLITCH_WIDTH 0xFE5C 592#define PERST_GLITCH_WIDTH 0xFE5C
@@ -693,19 +594,36 @@
693#define RESET_LOAD_REG 0xFE5E 594#define RESET_LOAD_REG 0xFE5E
694#define EFUSE_CONTENT 0xFE5F 595#define EFUSE_CONTENT 0xFE5F
695#define HOST_SLEEP_STATE 0xFE60 596#define HOST_SLEEP_STATE 0xFE60
696#define SDIO_CFG 0xFE70 597#define HOST_ENTER_S1 1
598#define HOST_ENTER_S3 2
697 599
600#define SDIO_CFG 0xFE70
601#define PM_EVENT_DEBUG 0xFE71
602#define PME_DEBUG_0 0x08
698#define NFTS_TX_CTRL 0xFE72 603#define NFTS_TX_CTRL 0xFE72
699 604
700#define PWR_GATE_CTRL 0xFE75 605#define PWR_GATE_CTRL 0xFE75
606#define PWR_GATE_EN 0x01
607#define LDO3318_PWR_MASK 0x06
608#define LDO_ON 0x00
609#define LDO_SUSPEND 0x04
610#define LDO_OFF 0x06
701#define PWD_SUSPEND_EN 0xFE76 611#define PWD_SUSPEND_EN 0xFE76
702#define LDO_PWR_SEL 0xFE78 612#define LDO_PWR_SEL 0xFE78
703 613
614#define L1SUB_CONFIG1 0xFE8D
615#define L1SUB_CONFIG2 0xFE8E
616#define L1SUB_AUTO_CFG 0x02
617#define L1SUB_CONFIG3 0xFE8F
618
704#define DUMMY_REG_RESET_0 0xFE90 619#define DUMMY_REG_RESET_0 0xFE90
705 620
706#define AUTOLOAD_CFG_BASE 0xFF00 621#define AUTOLOAD_CFG_BASE 0xFF00
622#define PETXCFG 0xFF03
707 623
708#define PM_CTRL1 0xFF44 624#define PM_CTRL1 0xFF44
625#define CD_RESUME_EN_MASK 0xF0
626
709#define PM_CTRL2 0xFF45 627#define PM_CTRL2 0xFF45
710#define PM_CTRL3 0xFF46 628#define PM_CTRL3 0xFF46
711#define SDIO_SEND_PME_EN 0x80 629#define SDIO_SEND_PME_EN 0x80
@@ -726,18 +644,125 @@
726#define IMAGE_FLAG_ADDR0 0xCE80 644#define IMAGE_FLAG_ADDR0 0xCE80
727#define IMAGE_FLAG_ADDR1 0xCE81 645#define IMAGE_FLAG_ADDR1 0xCE81
728 646
647#define RREF_CFG 0xFF6C
648#define RREF_VBGSEL_MASK 0x38
649#define RREF_VBGSEL_1V25 0x28
650
651#define OOBS_CONFIG 0xFF6E
652#define OOBS_AUTOK_DIS 0x80
653#define OOBS_VAL_MASK 0x1F
654
655#define LDO_DV18_CFG 0xFF70
656#define LDO_DV18_SR_MASK 0xC0
657#define LDO_DV18_SR_DF 0x40
658
659#define LDO_CONFIG2 0xFF71
660#define LDO_D3318_MASK 0x07
661#define LDO_D3318_33V 0x07
662#define LDO_D3318_18V 0x02
663
664#define LDO_VCC_CFG0 0xFF72
665#define LDO_VCC_LMTVTH_MASK 0x30
666#define LDO_VCC_LMTVTH_2A 0x10
667
668#define LDO_VCC_CFG1 0xFF73
669#define LDO_VCC_REF_TUNE_MASK 0x30
670#define LDO_VCC_REF_1V2 0x20
671#define LDO_VCC_TUNE_MASK 0x07
672#define LDO_VCC_1V8 0x04
673#define LDO_VCC_3V3 0x07
674#define LDO_VCC_LMT_EN 0x08
675
676#define LDO_VIO_CFG 0xFF75
677#define LDO_VIO_SR_MASK 0xC0
678#define LDO_VIO_SR_DF 0x40
679#define LDO_VIO_REF_TUNE_MASK 0x30
680#define LDO_VIO_REF_1V2 0x20
681#define LDO_VIO_TUNE_MASK 0x07
682#define LDO_VIO_1V7 0x03
683#define LDO_VIO_1V8 0x04
684#define LDO_VIO_3V3 0x07
685
686#define LDO_DV12S_CFG 0xFF76
687#define LDO_REF12_TUNE_MASK 0x18
688#define LDO_REF12_TUNE_DF 0x10
689#define LDO_D12_TUNE_MASK 0x07
690#define LDO_D12_TUNE_DF 0x04
691
692#define LDO_AV12S_CFG 0xFF77
693#define LDO_AV12S_TUNE_MASK 0x07
694#define LDO_AV12S_TUNE_DF 0x04
695
696#define SD40_LDO_CTL1 0xFE7D
697#define SD40_VIO_TUNE_MASK 0x70
698#define SD40_VIO_TUNE_1V7 0x30
699#define SD_VIO_LDO_1V8 0x40
700#define SD_VIO_LDO_3V3 0x70
701
729/* Phy register */ 702/* Phy register */
730#define PHY_PCR 0x00 703#define PHY_PCR 0x00
704#define PHY_PCR_FORCE_CODE 0xB000
705#define PHY_PCR_OOBS_CALI_50 0x0800
706#define PHY_PCR_OOBS_VCM_08 0x0200
707#define PHY_PCR_OOBS_SEN_90 0x0040
708#define PHY_PCR_RSSI_EN 0x0002
709#define PHY_PCR_RX10K 0x0001
710
731#define PHY_RCR0 0x01 711#define PHY_RCR0 0x01
732#define PHY_RCR1 0x02 712#define PHY_RCR1 0x02
713#define PHY_RCR1_ADP_TIME_4 0x0400
714#define PHY_RCR1_VCO_COARSE 0x001F
715#define PHY_SSCCR2 0x02
716#define PHY_SSCCR2_PLL_NCODE 0x0A00
717#define PHY_SSCCR2_TIME0 0x001C
718#define PHY_SSCCR2_TIME2_WIDTH 0x0003
719
733#define PHY_RCR2 0x03 720#define PHY_RCR2 0x03
721#define PHY_RCR2_EMPHASE_EN 0x8000
722#define PHY_RCR2_NADJR 0x4000
723#define PHY_RCR2_CDR_SR_2 0x0100
724#define PHY_RCR2_FREQSEL_12 0x0040
725#define PHY_RCR2_CDR_SC_12P 0x0010
726#define PHY_RCR2_CALIB_LATE 0x0002
727#define PHY_SSCCR3 0x03
728#define PHY_SSCCR3_STEP_IN 0x2740
729#define PHY_SSCCR3_CHECK_DELAY 0x0008
730#define _PHY_ANA03 0x03
731#define _PHY_ANA03_TIMER_MAX 0x2700
732#define _PHY_ANA03_OOBS_DEB_EN 0x0040
733#define _PHY_CMU_DEBUG_EN 0x0008
734
734#define PHY_RTCR 0x04 735#define PHY_RTCR 0x04
735#define PHY_RDR 0x05 736#define PHY_RDR 0x05
737#define PHY_RDR_RXDSEL_1_9 0x4000
738#define PHY_SSC_AUTO_PWD 0x0600
736#define PHY_TCR0 0x06 739#define PHY_TCR0 0x06
737#define PHY_TCR1 0x07 740#define PHY_TCR1 0x07
738#define PHY_TUNE 0x08 741#define PHY_TUNE 0x08
742#define PHY_TUNE_TUNEREF_1_0 0x4000
743#define PHY_TUNE_VBGSEL_1252 0x0C00
744#define PHY_TUNE_SDBUS_33 0x0200
745#define PHY_TUNE_TUNED18 0x01C0
746#define PHY_TUNE_TUNED12 0X0020
747#define PHY_TUNE_TUNEA12 0x0004
748#define PHY_TUNE_VOLTAGE_MASK 0xFC3F
749#define PHY_TUNE_VOLTAGE_3V3 0x03C0
750#define PHY_TUNE_D18_1V8 0x0100
751#define PHY_TUNE_D18_1V7 0x0080
752#define PHY_ANA08 0x08
753#define PHY_ANA08_RX_EQ_DCGAIN 0x5000
754#define PHY_ANA08_SEL_RX_EN 0x0400
755#define PHY_ANA08_RX_EQ_VAL 0x03C0
756#define PHY_ANA08_SCP 0x0020
757#define PHY_ANA08_SEL_IPI 0x0004
758
739#define PHY_IMR 0x09 759#define PHY_IMR 0x09
740#define PHY_BPCR 0x0A 760#define PHY_BPCR 0x0A
761#define PHY_BPCR_IBRXSEL 0x0400
762#define PHY_BPCR_IBTXSEL 0x0100
763#define PHY_BPCR_IB_FILTER 0x0080
764#define PHY_BPCR_CMIRROR_EN 0x0040
765
741#define PHY_BIST 0x0B 766#define PHY_BIST 0x0B
742#define PHY_RAW_L 0x0C 767#define PHY_RAW_L 0x0C
743#define PHY_RAW_H 0x0D 768#define PHY_RAW_H 0x0D
@@ -745,6 +770,7 @@
745#define PHY_HOST_CLK_CTRL 0x0F 770#define PHY_HOST_CLK_CTRL 0x0F
746#define PHY_DMR 0x10 771#define PHY_DMR 0x10
747#define PHY_BACR 0x11 772#define PHY_BACR 0x11
773#define PHY_BACR_BASIC_MASK 0xFFF3
748#define PHY_IER 0x12 774#define PHY_IER 0x12
749#define PHY_BCSR 0x13 775#define PHY_BCSR 0x13
750#define PHY_BPR 0x14 776#define PHY_BPR 0x14
@@ -752,80 +778,70 @@
752#define PHY_BPNR 0x16 778#define PHY_BPNR 0x16
753#define PHY_BRNR2 0x17 779#define PHY_BRNR2 0x17
754#define PHY_BENR 0x18 780#define PHY_BENR 0x18
755#define PHY_REG_REV 0x19 781#define PHY_REV 0x19
782#define PHY_REV_RESV 0xE000
783#define PHY_REV_RXIDLE_LATCHED 0x1000
784#define PHY_REV_P1_EN 0x0800
785#define PHY_REV_RXIDLE_EN 0x0400
786#define PHY_REV_CLKREQ_TX_EN 0x0200
787#define PHY_REV_CLKREQ_RX_EN 0x0100
788#define PHY_REV_CLKREQ_DT_1_0 0x0040
789#define PHY_REV_STOP_CLKRD 0x0020
790#define PHY_REV_RX_PWST 0x0008
791#define PHY_REV_STOP_CLKWR 0x0004
792#define _PHY_REV0 0x19
793#define _PHY_REV0_FILTER_OUT 0x3800
794#define _PHY_REV0_CDR_BYPASS_PFD 0x0100
795#define _PHY_REV0_CDR_RX_IDLE_BYPASS 0x0002
796
756#define PHY_FLD0 0x1A 797#define PHY_FLD0 0x1A
798#define PHY_ANA1A 0x1A
799#define PHY_ANA1A_TXR_LOOPBACK 0x2000
800#define PHY_ANA1A_RXT_BIST 0x0500
801#define PHY_ANA1A_TXR_BIST 0x0040
802#define PHY_ANA1A_REV 0x0006
757#define PHY_FLD1 0x1B 803#define PHY_FLD1 0x1B
758#define PHY_FLD2 0x1C 804#define PHY_FLD2 0x1C
759#define PHY_FLD3 0x1D 805#define PHY_FLD3 0x1D
806#define PHY_FLD3_TIMER_4 0x0800
807#define PHY_FLD3_TIMER_6 0x0020
808#define PHY_FLD3_RXDELINK 0x0004
809#define PHY_ANA1D 0x1D
810#define PHY_ANA1D_DEBUG_ADDR 0x0004
811#define _PHY_FLD0 0x1D
812#define _PHY_FLD0_CLK_REQ_20C 0x8000
813#define _PHY_FLD0_RX_IDLE_EN 0x1000
814#define _PHY_FLD0_BIT_ERR_RSTN 0x0800
815#define _PHY_FLD0_BER_COUNT 0x01E0
816#define _PHY_FLD0_BER_TIMER 0x001E
817#define _PHY_FLD0_CHECK_EN 0x0001
818
760#define PHY_FLD4 0x1E 819#define PHY_FLD4 0x1E
820#define PHY_FLD4_FLDEN_SEL 0x4000
821#define PHY_FLD4_REQ_REF 0x2000
822#define PHY_FLD4_RXAMP_OFF 0x1000
823#define PHY_FLD4_REQ_ADDA 0x0800
824#define PHY_FLD4_BER_COUNT 0x00E0
825#define PHY_FLD4_BER_TIMER 0x000A
826#define PHY_FLD4_BER_CHK_EN 0x0001
827#define PHY_DIG1E 0x1E
828#define PHY_DIG1E_REV 0x4000
829#define PHY_DIG1E_D0_X_D1 0x1000
830#define PHY_DIG1E_RX_ON_HOST 0x0800
831#define PHY_DIG1E_RCLK_REF_HOST 0x0400
832#define PHY_DIG1E_RCLK_TX_EN_KEEP 0x0040
833#define PHY_DIG1E_RCLK_TX_TERM_KEEP 0x0020
834#define PHY_DIG1E_RCLK_RX_EIDLE_ON 0x0010
835#define PHY_DIG1E_TX_TERM_KEEP 0x0008
836#define PHY_DIG1E_RX_TERM_KEEP 0x0004
837#define PHY_DIG1E_TX_EN_KEEP 0x0002
838#define PHY_DIG1E_RX_EN_KEEP 0x0001
761#define PHY_DUM_REG 0x1F 839#define PHY_DUM_REG 0x1F
762 840
763#define LCTLR 0x80
764#define LCTLR_EXT_SYNC 0x80
765#define LCTLR_COMMON_CLOCK_CFG 0x40
766#define LCTLR_RETRAIN_LINK 0x20
767#define LCTLR_LINK_DISABLE 0x10
768#define LCTLR_RCB 0x08
769#define LCTLR_RESERVED 0x04
770#define LCTLR_ASPM_CTL_MASK 0x03
771
772#define PCR_SETTING_REG1 0x724 841#define PCR_SETTING_REG1 0x724
773#define PCR_SETTING_REG2 0x814 842#define PCR_SETTING_REG2 0x814
774#define PCR_SETTING_REG3 0x747 843#define PCR_SETTING_REG3 0x747
775 844
776/* Phy bits */
777#define PHY_PCR_FORCE_CODE 0xB000
778#define PHY_PCR_OOBS_CALI_50 0x0800
779#define PHY_PCR_OOBS_VCM_08 0x0200
780#define PHY_PCR_OOBS_SEN_90 0x0040
781#define PHY_PCR_RSSI_EN 0x0002
782
783#define PHY_RCR1_ADP_TIME 0x0100
784#define PHY_RCR1_VCO_COARSE 0x001F
785
786#define PHY_RCR2_EMPHASE_EN 0x8000
787#define PHY_RCR2_NADJR 0x4000
788#define PHY_RCR2_CDR_CP_10 0x0400
789#define PHY_RCR2_CDR_SR_2 0x0100
790#define PHY_RCR2_FREQSEL_12 0x0040
791#define PHY_RCR2_CPADJEN 0x0020
792#define PHY_RCR2_CDR_SC_8 0x0008
793#define PHY_RCR2_CALIB_LATE 0x0002
794
795#define PHY_RDR_RXDSEL_1_9 0x4000
796
797#define PHY_TUNE_TUNEREF_1_0 0x4000
798#define PHY_TUNE_VBGSEL_1252 0x0C00
799#define PHY_TUNE_SDBUS_33 0x0200
800#define PHY_TUNE_TUNED18 0x01C0
801#define PHY_TUNE_TUNED12 0X0020
802
803#define PHY_BPCR_IBRXSEL 0x0400
804#define PHY_BPCR_IBTXSEL 0x0100
805#define PHY_BPCR_IB_FILTER 0x0080
806#define PHY_BPCR_CMIRROR_EN 0x0040
807
808#define PHY_REG_REV_RESV 0xE000
809#define PHY_REG_REV_RXIDLE_LATCHED 0x1000
810#define PHY_REG_REV_P1_EN 0x0800
811#define PHY_REG_REV_RXIDLE_EN 0x0400
812#define PHY_REG_REV_CLKREQ_DLY_TIMER_1_0 0x0040
813#define PHY_REG_REV_STOP_CLKRD 0x0020
814#define PHY_REG_REV_RX_PWST 0x0008
815#define PHY_REG_REV_STOP_CLKWR 0x0004
816
817#define PHY_FLD3_TIMER_4 0x7800
818#define PHY_FLD3_TIMER_6 0x00E0
819#define PHY_FLD3_RXDELINK 0x0004
820
821#define PHY_FLD4_FLDEN_SEL 0x4000
822#define PHY_FLD4_REQ_REF 0x2000
823#define PHY_FLD4_RXAMP_OFF 0x1000
824#define PHY_FLD4_REQ_ADDA 0x0800
825#define PHY_FLD4_BER_COUNT 0x00E0
826#define PHY_FLD4_BER_TIMER 0x000A
827#define PHY_FLD4_BER_CHK_EN 0x0001
828
829#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0) 845#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0)
830 846
831struct rtsx_pcr; 847struct rtsx_pcr;
@@ -835,6 +851,8 @@ struct pcr_handle {
835}; 851};
836 852
837struct pcr_ops { 853struct pcr_ops {
854 int (*write_phy)(struct rtsx_pcr *pcr, u8 addr, u16 val);
855 int (*read_phy)(struct rtsx_pcr *pcr, u8 addr, u16 *val);
838 int (*extra_init_hw)(struct rtsx_pcr *pcr); 856 int (*extra_init_hw)(struct rtsx_pcr *pcr);
839 int (*optimize_phy)(struct rtsx_pcr *pcr); 857 int (*optimize_phy)(struct rtsx_pcr *pcr);
840 int (*turn_on_led)(struct rtsx_pcr *pcr); 858 int (*turn_on_led)(struct rtsx_pcr *pcr);
@@ -856,6 +874,7 @@ enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN};
856struct rtsx_pcr { 874struct rtsx_pcr {
857 struct pci_dev *pci; 875 struct pci_dev *pci;
858 unsigned int id; 876 unsigned int id;
877 int pcie_cap;
859 878
860 /* pci resources */ 879 /* pci resources */
861 unsigned long addr; 880 unsigned long addr;
@@ -928,6 +947,8 @@ struct rtsx_pcr {
928 const struct pcr_ops *ops; 947 const struct pcr_ops *ops;
929 enum PDEV_STAT state; 948 enum PDEV_STAT state;
930 949
950 u16 reg_pm_ctrl3;
951
931 int num_slots; 952 int num_slots;
932 struct rtsx_slot *slots; 953 struct rtsx_slot *slots;
933}; 954};
@@ -935,6 +956,10 @@ struct rtsx_pcr {
935#define CHK_PCI_PID(pcr, pid) ((pcr)->pci->device == (pid)) 956#define CHK_PCI_PID(pcr, pid) ((pcr)->pci->device == (pid))
936#define PCI_VID(pcr) ((pcr)->pci->vendor) 957#define PCI_VID(pcr) ((pcr)->pci->vendor)
937#define PCI_PID(pcr) ((pcr)->pci->device) 958#define PCI_PID(pcr) ((pcr)->pci->device)
959#define is_version(pcr, pid, ver) \
960 (CHK_PCI_PID(pcr, pid) && (pcr)->ic_version == (ver))
961#define pcr_dbg(pcr, fmt, arg...) \
962 dev_dbg(&(pcr)->pci->dev, fmt, ##arg)
938 963
939#define SDR104_PHASE(val) ((val) & 0xFF) 964#define SDR104_PHASE(val) ((val) & 0xFF)
940#define SDR50_PHASE(val) (((val) >> 8) & 0xFF) 965#define SDR50_PHASE(val) (((val) >> 8) & 0xFF)
@@ -1004,4 +1029,17 @@ static inline void rtsx_pci_write_be32(struct rtsx_pcr *pcr, u16 reg, u32 val)
1004 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 3, 0xFF, val); 1029 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 3, 0xFF, val);
1005} 1030}
1006 1031
1032static inline int rtsx_pci_update_phy(struct rtsx_pcr *pcr, u8 addr,
1033 u16 mask, u16 append)
1034{
1035 int err;
1036 u16 val;
1037
1038 err = rtsx_pci_read_phy_register(pcr, addr, &val);
1039 if (err < 0)
1040 return err;
1041
1042 return rtsx_pci_write_phy_register(pcr, addr, (val & mask) | append);
1043}
1044
1007#endif 1045#endif
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 3fdb7cfbffb3..75115384f3fc 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -58,13 +58,7 @@ enum sec_device_type {
58 * @irq_base: Base IRQ number for device, required for IRQs 58 * @irq_base: Base IRQ number for device, required for IRQs
59 * @irq: Generic IRQ number for device 59 * @irq: Generic IRQ number for device
60 * @irq_data: Runtime data structure for IRQ controller 60 * @irq_data: Runtime data structure for IRQ controller
61 * @ono: Power onoff IRQ number for s5m87xx
62 * @wakeup: Whether or not this is a wakeup device 61 * @wakeup: Whether or not this is a wakeup device
63 * @wtsr_smpl: Whether or not to enable in RTC driver the Watchdog
64 * Timer Software Reset (registers set to default value
65 * after PWRHOLD falling) and Sudden Momentary Power Loss
66 * (PMIC will enter power on sequence after short drop in
67 * VBATT voltage).
68 */ 62 */
69struct sec_pmic_dev { 63struct sec_pmic_dev {
70 struct device *dev; 64 struct device *dev;
@@ -77,9 +71,7 @@ struct sec_pmic_dev {
77 int irq; 71 int irq;
78 struct regmap_irq_chip_data *irq_data; 72 struct regmap_irq_chip_data *irq_data;
79 73
80 int ono;
81 bool wakeup; 74 bool wakeup;
82 bool wtsr_smpl;
83}; 75};
84 76
85int sec_irq_init(struct sec_pmic_dev *sec_pmic); 77int sec_irq_init(struct sec_pmic_dev *sec_pmic);
@@ -95,7 +87,6 @@ struct sec_platform_data {
95 int irq_base; 87 int irq_base;
96 int (*cfg_pmic_irq)(void); 88 int (*cfg_pmic_irq)(void);
97 89
98 int ono;
99 bool wakeup; 90 bool wakeup;
100 bool buck_voltage_lock; 91 bool buck_voltage_lock;
101 92
diff --git a/include/linux/mfd/samsung/irq.h b/include/linux/mfd/samsung/irq.h
index f35af7361b60..667aa40486dd 100644
--- a/include/linux/mfd/samsung/irq.h
+++ b/include/linux/mfd/samsung/irq.h
@@ -74,8 +74,8 @@ enum s2mps11_irq {
74 S2MPS11_IRQ_MRB, 74 S2MPS11_IRQ_MRB,
75 75
76 S2MPS11_IRQ_RTC60S, 76 S2MPS11_IRQ_RTC60S,
77 S2MPS11_IRQ_RTCA0,
78 S2MPS11_IRQ_RTCA1, 77 S2MPS11_IRQ_RTCA1,
78 S2MPS11_IRQ_RTCA0,
79 S2MPS11_IRQ_SMPL, 79 S2MPS11_IRQ_SMPL,
80 S2MPS11_IRQ_RTC1S, 80 S2MPS11_IRQ_RTC1S,
81 S2MPS11_IRQ_WTSR, 81 S2MPS11_IRQ_WTSR,
diff --git a/include/linux/mfd/samsung/rtc.h b/include/linux/mfd/samsung/rtc.h
index b6401e7661c7..29c30ac36020 100644
--- a/include/linux/mfd/samsung/rtc.h
+++ b/include/linux/mfd/samsung/rtc.h
@@ -105,6 +105,8 @@ enum s2mps_rtc_reg {
105#define S5M_RTC_UDR_MASK (1 << S5M_RTC_UDR_SHIFT) 105#define S5M_RTC_UDR_MASK (1 << S5M_RTC_UDR_SHIFT)
106#define S2MPS_RTC_WUDR_SHIFT 4 106#define S2MPS_RTC_WUDR_SHIFT 4
107#define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT) 107#define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT)
108#define S2MPS13_RTC_AUDR_SHIFT 1
109#define S2MPS13_RTC_AUDR_MASK (1 << S2MPS13_RTC_AUDR_SHIFT)
108#define S2MPS_RTC_RUDR_SHIFT 0 110#define S2MPS_RTC_RUDR_SHIFT 0
109#define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT) 111#define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT)
110#define RTC_TCON_SHIFT 1 112#define RTC_TCON_SHIFT 1
diff --git a/include/linux/mfd/sky81452.h b/include/linux/mfd/sky81452.h
new file mode 100644
index 000000000000..b0925fa3e9ef
--- /dev/null
+++ b/include/linux/mfd/sky81452.h
@@ -0,0 +1,31 @@
1/*
2 * sky81452.h SKY81452 MFD driver
3 *
4 * Copyright 2014 Skyworks Solutions Inc.
5 * Author : Gyungoh Yoo <jack.yoo@skyworksinc.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 version 2
9 * as published by the Free Software Foundation.
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, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef _SKY81452_H
21#define _SKY81452_H
22
23#include <linux/platform_data/sky81452-backlight.h>
24#include <linux/regulator/machine.h>
25
26struct sky81452_platform_data {
27 struct sky81452_bl_platform_data *bl_pdata;
28 struct regulator_init_data *regulator_init_data;
29};
30
31#endif
diff --git a/include/linux/mfd/stw481x.h b/include/linux/mfd/stw481x.h
index eda121556e5d..833074b766bd 100644
--- a/include/linux/mfd/stw481x.h
+++ b/include/linux/mfd/stw481x.h
@@ -41,15 +41,11 @@
41 41
42/** 42/**
43 * struct stw481x - state holder for the Stw481x drivers 43 * struct stw481x - state holder for the Stw481x drivers
44 * @mutex: mutex to serialize I2C accesses
45 * @i2c_client: corresponding I2C client 44 * @i2c_client: corresponding I2C client
46 * @regulator: regulator device for regulator children
47 * @map: regmap handle to access device registers 45 * @map: regmap handle to access device registers
48 */ 46 */
49struct stw481x { 47struct stw481x {
50 struct mutex lock;
51 struct i2c_client *client; 48 struct i2c_client *client;
52 struct regulator_dev *vmmc_regulator;
53 struct regmap *map; 49 struct regmap *map;
54}; 50};
55 51
diff --git a/include/linux/mfd/syscon/exynos5-pmu.h b/include/linux/mfd/syscon/exynos5-pmu.h
index 00ef24bf6ede..9352adc95de6 100644
--- a/include/linux/mfd/syscon/exynos5-pmu.h
+++ b/include/linux/mfd/syscon/exynos5-pmu.h
@@ -36,6 +36,9 @@
36#define EXYNOS5420_MTCADC_PHY_CONTROL (0x724) 36#define EXYNOS5420_MTCADC_PHY_CONTROL (0x724)
37#define EXYNOS5420_DPTX_PHY_CONTROL (0x728) 37#define EXYNOS5420_DPTX_PHY_CONTROL (0x728)
38 38
39/* Exynos5433 specific register definitions */
40#define EXYNOS5433_USBHOST30_PHY_CONTROL (0x728)
41
39#define EXYNOS5_PHY_ENABLE BIT(0) 42#define EXYNOS5_PHY_ENABLE BIT(0)
40 43
41#define EXYNOS5_MIPI_PHY_S_RESETN BIT(1) 44#define EXYNOS5_MIPI_PHY_S_RESETN BIT(1)
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
index c203c9c56776..468c31a27fcf 100644
--- a/include/linux/mfd/tc3589x.h
+++ b/include/linux/mfd/tc3589x.h
@@ -140,36 +140,13 @@ extern int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val);
140#define TC_KPD_DEBOUNCE_PERIOD 0xA3 140#define TC_KPD_DEBOUNCE_PERIOD 0xA3
141#define TC_KPD_SETTLE_TIME 0xA3 141#define TC_KPD_SETTLE_TIME 0xA3
142 142
143/**
144 * struct tc35893_platform_data - data structure for platform specific data
145 * @keymap_data: matrix scan code table for keycodes
146 * @krow: mask for available rows, value is 0xFF
147 * @kcol: mask for available columns, value is 0xFF
148 * @debounce_period: platform specific debounce time
149 * @settle_time: platform specific settle down time
150 * @irqtype: type of interrupt, falling or rising edge
151 * @enable_wakeup: specifies if keypad event can wake up system from sleep
152 * @no_autorepeat: flag for auto repetition
153 */
154struct tc3589x_keypad_platform_data {
155 const struct matrix_keymap_data *keymap_data;
156 u8 krow;
157 u8 kcol;
158 u8 debounce_period;
159 u8 settle_time;
160 unsigned long irqtype;
161 bool enable_wakeup;
162 bool no_autorepeat;
163};
164 143
165/** 144/**
166 * struct tc3589x_platform_data - TC3589x platform data 145 * struct tc3589x_platform_data - TC3589x platform data
167 * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*) 146 * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
168 * @keypad: keypad-specific platform data
169 */ 147 */
170struct tc3589x_platform_data { 148struct tc3589x_platform_data {
171 unsigned int block; 149 unsigned int block;
172 const struct tc3589x_keypad_platform_data *keypad;
173}; 150};
174 151
175#endif 152#endif
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index 3f4e994ace2b..1fd50dcfe47c 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -128,6 +128,7 @@
128 128
129/* Sequencer Status */ 129/* Sequencer Status */
130#define SEQ_STATUS BIT(5) 130#define SEQ_STATUS BIT(5)
131#define CHARGE_STEP 0x11
131 132
132#define ADC_CLK 3000000 133#define ADC_CLK 3000000
133#define TOTAL_STEPS 16 134#define TOTAL_STEPS 16
diff --git a/include/linux/mfd/wm8350/supply.h b/include/linux/mfd/wm8350/supply.h
index 2b9479310bbd..8dc93673e34a 100644
--- a/include/linux/mfd/wm8350/supply.h
+++ b/include/linux/mfd/wm8350/supply.h
@@ -123,9 +123,9 @@ struct wm8350_charger_policy {
123 123
124struct wm8350_power { 124struct wm8350_power {
125 struct platform_device *pdev; 125 struct platform_device *pdev;
126 struct power_supply battery; 126 struct power_supply *battery;
127 struct power_supply usb; 127 struct power_supply *usb;
128 struct power_supply ac; 128 struct power_supply *ac;
129 struct wm8350_charger_policy *policy; 129 struct wm8350_charger_policy *policy;
130 130
131 int rev_g_coeff; 131 int rev_g_coeff;
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 78baed5f2952..cac1c0904d5f 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -69,7 +69,6 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
69extern bool pmd_trans_migrating(pmd_t pmd); 69extern bool pmd_trans_migrating(pmd_t pmd);
70extern int migrate_misplaced_page(struct page *page, 70extern int migrate_misplaced_page(struct page *page,
71 struct vm_area_struct *vma, int node); 71 struct vm_area_struct *vma, int node);
72extern bool migrate_ratelimited(int node);
73#else 72#else
74static inline bool pmd_trans_migrating(pmd_t pmd) 73static inline bool pmd_trans_migrating(pmd_t pmd)
75{ 74{
@@ -80,10 +79,6 @@ static inline int migrate_misplaced_page(struct page *page,
80{ 79{
81 return -EAGAIN; /* can't migrate now */ 80 return -EAGAIN; /* can't migrate now */
82} 81}
83static inline bool migrate_ratelimited(int node)
84{
85 return false;
86}
87#endif /* CONFIG_NUMA_BALANCING */ 82#endif /* CONFIG_NUMA_BALANCING */
88 83
89#if defined(CONFIG_NUMA_BALANCING) && defined(CONFIG_TRANSPARENT_HUGEPAGE) 84#if defined(CONFIG_NUMA_BALANCING) && defined(CONFIG_TRANSPARENT_HUGEPAGE)
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index 7b6d4e9ff603..f62e7cf227c6 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -68,6 +68,8 @@ enum {
68 MLX4_CMD_UNMAP_ICM_AUX = 0xffb, 68 MLX4_CMD_UNMAP_ICM_AUX = 0xffb,
69 MLX4_CMD_SET_ICM_SIZE = 0xffd, 69 MLX4_CMD_SET_ICM_SIZE = 0xffd,
70 MLX4_CMD_ACCESS_REG = 0x3b, 70 MLX4_CMD_ACCESS_REG = 0x3b,
71 MLX4_CMD_ALLOCATE_VPP = 0x80,
72 MLX4_CMD_SET_VPORT_QOS = 0x81,
71 73
72 /*master notify fw on finish for slave's flr*/ 74 /*master notify fw on finish for slave's flr*/
73 MLX4_CMD_INFORM_FLR_DONE = 0x5b, 75 MLX4_CMD_INFORM_FLR_DONE = 0x5b,
@@ -163,6 +165,9 @@ enum {
163 MLX4_QP_FLOW_STEERING_ATTACH = 0x65, 165 MLX4_QP_FLOW_STEERING_ATTACH = 0x65,
164 MLX4_QP_FLOW_STEERING_DETACH = 0x66, 166 MLX4_QP_FLOW_STEERING_DETACH = 0x66,
165 MLX4_FLOW_STEERING_IB_UC_QP_RANGE = 0x64, 167 MLX4_FLOW_STEERING_IB_UC_QP_RANGE = 0x64,
168
169 /* Update and read QCN parameters */
170 MLX4_CMD_CONGESTION_CTRL_OPCODE = 0x68,
166}; 171};
167 172
168enum { 173enum {
@@ -183,7 +188,14 @@ enum {
183}; 188};
184 189
185enum { 190enum {
186 /* set port opcode modifiers */ 191 /* Set port opcode modifiers */
192 MLX4_SET_PORT_IB_OPCODE = 0x0,
193 MLX4_SET_PORT_ETH_OPCODE = 0x1,
194 MLX4_SET_PORT_BEACON_OPCODE = 0x4,
195};
196
197enum {
198 /* Set port Ethernet input modifiers */
187 MLX4_SET_PORT_GENERAL = 0x0, 199 MLX4_SET_PORT_GENERAL = 0x0,
188 MLX4_SET_PORT_RQP_CALC = 0x1, 200 MLX4_SET_PORT_RQP_CALC = 0x1,
189 MLX4_SET_PORT_MAC_TABLE = 0x2, 201 MLX4_SET_PORT_MAC_TABLE = 0x2,
@@ -233,6 +245,16 @@ struct mlx4_config_dev_params {
233 u8 rx_csum_flags_port_2; 245 u8 rx_csum_flags_port_2;
234}; 246};
235 247
248enum mlx4_en_congestion_control_algorithm {
249 MLX4_CTRL_ALGO_802_1_QAU_REACTION_POINT = 0,
250};
251
252enum mlx4_en_congestion_control_opmod {
253 MLX4_CONGESTION_CONTROL_GET_PARAMS,
254 MLX4_CONGESTION_CONTROL_GET_STATISTICS,
255 MLX4_CONGESTION_CONTROL_SET_PARAMS = 4,
256};
257
236struct mlx4_dev; 258struct mlx4_dev;
237 259
238struct mlx4_cmd_mailbox { 260struct mlx4_cmd_mailbox {
@@ -281,6 +303,8 @@ void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbo
281u32 mlx4_comm_get_version(void); 303u32 mlx4_comm_get_version(void);
282int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac); 304int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac);
283int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos); 305int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos);
306int mlx4_set_vf_rate(struct mlx4_dev *dev, int port, int vf, int min_tx_rate,
307 int max_tx_rate);
284int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting); 308int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting);
285int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf); 309int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf);
286int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state); 310int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state);
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index e4ebff7e9d02..f9ce34bec45b 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -49,8 +49,6 @@
49#define MSIX_LEGACY_SZ 4 49#define MSIX_LEGACY_SZ 4
50#define MIN_MSIX_P_PORT 5 50#define MIN_MSIX_P_PORT 5
51 51
52#define MLX4_NUM_UP 8
53#define MLX4_NUM_TC 8
54#define MLX4_MAX_100M_UNITS_VAL 255 /* 52#define MLX4_MAX_100M_UNITS_VAL 255 /*
55 * work around: can't set values 53 * work around: can't set values
56 * greater then this value when 54 * greater then this value when
@@ -174,6 +172,7 @@ enum {
174 MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41, 172 MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41,
175 MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42, 173 MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42,
176 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48, 174 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48,
175 MLX4_DEV_CAP_FLAG_RSS_IP_FRAG = 1LL << 52,
177 MLX4_DEV_CAP_FLAG_SET_ETH_SCHED = 1LL << 53, 176 MLX4_DEV_CAP_FLAG_SET_ETH_SCHED = 1LL << 53,
178 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55, 177 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55,
179 MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59, 178 MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59,
@@ -203,7 +202,14 @@ enum {
203 MLX4_DEV_CAP_FLAG2_80_VFS = 1LL << 18, 202 MLX4_DEV_CAP_FLAG2_80_VFS = 1LL << 18,
204 MLX4_DEV_CAP_FLAG2_FS_A0 = 1LL << 19, 203 MLX4_DEV_CAP_FLAG2_FS_A0 = 1LL << 19,
205 MLX4_DEV_CAP_FLAG2_RECOVERABLE_ERROR_EVENT = 1LL << 20, 204 MLX4_DEV_CAP_FLAG2_RECOVERABLE_ERROR_EVENT = 1LL << 20,
206 MLX4_DEV_CAP_FLAG2_PORT_REMAP = 1LL << 21 205 MLX4_DEV_CAP_FLAG2_PORT_REMAP = 1LL << 21,
206 MLX4_DEV_CAP_FLAG2_QCN = 1LL << 22,
207 MLX4_DEV_CAP_FLAG2_QP_RATE_LIMIT = 1LL << 23,
208 MLX4_DEV_CAP_FLAG2_FLOWSTATS_EN = 1LL << 24,
209 MLX4_DEV_CAP_FLAG2_QOS_VPP = 1LL << 25,
210 MLX4_DEV_CAP_FLAG2_ETS_CFG = 1LL << 26,
211 MLX4_DEV_CAP_FLAG2_PORT_BEACON = 1LL << 27,
212 MLX4_DEV_CAP_FLAG2_IGNORE_FCS = 1LL << 28,
207}; 213};
208 214
209enum { 215enum {
@@ -449,6 +455,21 @@ enum mlx4_module_id {
449 MLX4_MODULE_ID_QSFP28 = 0x11, 455 MLX4_MODULE_ID_QSFP28 = 0x11,
450}; 456};
451 457
458enum { /* rl */
459 MLX4_QP_RATE_LIMIT_NONE = 0,
460 MLX4_QP_RATE_LIMIT_KBS = 1,
461 MLX4_QP_RATE_LIMIT_MBS = 2,
462 MLX4_QP_RATE_LIMIT_GBS = 3
463};
464
465struct mlx4_rate_limit_caps {
466 u16 num_rates; /* Number of different rates */
467 u8 min_unit;
468 u16 min_val;
469 u8 max_unit;
470 u16 max_val;
471};
472
452static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) 473static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
453{ 474{
454 return (major << 32) | (minor << 16) | subminor; 475 return (major << 32) | (minor << 16) | subminor;
@@ -564,6 +585,7 @@ struct mlx4_caps {
564 u32 dmfs_high_rate_qpn_base; 585 u32 dmfs_high_rate_qpn_base;
565 u32 dmfs_high_rate_qpn_range; 586 u32 dmfs_high_rate_qpn_range;
566 u32 vf_caps; 587 u32 vf_caps;
588 struct mlx4_rate_limit_caps rl_caps;
567}; 589};
568 590
569struct mlx4_buf_list { 591struct mlx4_buf_list {
@@ -982,6 +1004,11 @@ static inline int mlx4_is_slave(struct mlx4_dev *dev)
982 return dev->flags & MLX4_FLAG_SLAVE; 1004 return dev->flags & MLX4_FLAG_SLAVE;
983} 1005}
984 1006
1007static inline int mlx4_is_eth(struct mlx4_dev *dev, int port)
1008{
1009 return dev->caps.port_type[port] == MLX4_PORT_TYPE_IB ? 0 : 1;
1010}
1011
985int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, 1012int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
986 struct mlx4_buf *buf, gfp_t gfp); 1013 struct mlx4_buf *buf, gfp_t gfp);
987void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); 1014void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf);
@@ -1282,14 +1309,13 @@ int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac);
1282void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac); 1309void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac);
1283int mlx4_get_base_qpn(struct mlx4_dev *dev, u8 port); 1310int mlx4_get_base_qpn(struct mlx4_dev *dev, u8 port);
1284int __mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac); 1311int __mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac);
1285void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap);
1286int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu, 1312int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu,
1287 u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx); 1313 u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx);
1288int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn, 1314int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn,
1289 u8 promisc); 1315 u8 promisc);
1290int mlx4_SET_PORT_PRIO2TC(struct mlx4_dev *dev, u8 port, u8 *prio2tc); 1316int mlx4_SET_PORT_BEACON(struct mlx4_dev *dev, u8 port, u16 time);
1291int mlx4_SET_PORT_SCHEDULER(struct mlx4_dev *dev, u8 port, u8 *tc_tx_bw, 1317int mlx4_SET_PORT_fcs_check(struct mlx4_dev *dev, u8 port,
1292 u8 *pg, u16 *ratelimit); 1318 u8 ignore_fcs_value);
1293int mlx4_SET_PORT_VXLAN(struct mlx4_dev *dev, u8 port, u8 steering, int enable); 1319int mlx4_SET_PORT_VXLAN(struct mlx4_dev *dev, u8 port, u8 steering, int enable);
1294int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx); 1320int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx);
1295int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 1321int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 551f85456c11..6fed539e5456 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -207,14 +207,17 @@ struct mlx4_qp_context {
207 __be32 msn; 207 __be32 msn;
208 __be16 rq_wqe_counter; 208 __be16 rq_wqe_counter;
209 __be16 sq_wqe_counter; 209 __be16 sq_wqe_counter;
210 u32 reserved3[2]; 210 u32 reserved3;
211 __be16 rate_limit_params;
212 u8 reserved4;
213 u8 qos_vport;
211 __be32 param3; 214 __be32 param3;
212 __be32 nummmcpeers_basemkey; 215 __be32 nummmcpeers_basemkey;
213 u8 log_page_size; 216 u8 log_page_size;
214 u8 reserved4[2]; 217 u8 reserved5[2];
215 u8 mtt_base_addr_h; 218 u8 mtt_base_addr_h;
216 __be32 mtt_base_addr_l; 219 __be32 mtt_base_addr_l;
217 u32 reserved5[10]; 220 u32 reserved6[10];
218}; 221};
219 222
220struct mlx4_update_qp_context { 223struct mlx4_update_qp_context {
@@ -229,6 +232,8 @@ struct mlx4_update_qp_context {
229enum { 232enum {
230 MLX4_UPD_QP_MASK_PM_STATE = 32, 233 MLX4_UPD_QP_MASK_PM_STATE = 32,
231 MLX4_UPD_QP_MASK_VSD = 33, 234 MLX4_UPD_QP_MASK_VSD = 33,
235 MLX4_UPD_QP_MASK_QOS_VPP = 34,
236 MLX4_UPD_QP_MASK_RATE_LIMIT = 35,
232}; 237};
233 238
234enum { 239enum {
@@ -428,7 +433,9 @@ struct mlx4_wqe_inline_seg {
428enum mlx4_update_qp_attr { 433enum mlx4_update_qp_attr {
429 MLX4_UPDATE_QP_SMAC = 1 << 0, 434 MLX4_UPDATE_QP_SMAC = 1 << 0,
430 MLX4_UPDATE_QP_VSD = 1 << 1, 435 MLX4_UPDATE_QP_VSD = 1 << 1,
431 MLX4_UPDATE_QP_SUPPORTED_ATTRS = (1 << 2) - 1 436 MLX4_UPDATE_QP_RATE_LIMIT = 1 << 2,
437 MLX4_UPDATE_QP_QOS_VPORT = 1 << 3,
438 MLX4_UPDATE_QP_SUPPORTED_ATTRS = (1 << 4) - 1
432}; 439};
433 440
434enum mlx4_update_qp_params_flags { 441enum mlx4_update_qp_params_flags {
@@ -437,7 +444,10 @@ enum mlx4_update_qp_params_flags {
437 444
438struct mlx4_update_qp_params { 445struct mlx4_update_qp_params {
439 u8 smac_index; 446 u8 smac_index;
447 u8 qos_vport;
440 u32 flags; 448 u32 flags;
449 u16 rate_unit;
450 u16 rate_val;
441}; 451};
442 452
443int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn, 453int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn,
diff --git a/include/linux/mlx5/cmd.h b/include/linux/mlx5/cmd.h
index 2826a4b6071e..68cd08f02c2f 100644
--- a/include/linux/mlx5/cmd.h
+++ b/include/linux/mlx5/cmd.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h
index f6b17ac601bd..2695ced222df 100644
--- a/include/linux/mlx5/cq.h
+++ b/include/linux/mlx5/cq.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
@@ -137,14 +137,15 @@ enum {
137 137
138static inline void mlx5_cq_arm(struct mlx5_core_cq *cq, u32 cmd, 138static inline void mlx5_cq_arm(struct mlx5_core_cq *cq, u32 cmd,
139 void __iomem *uar_page, 139 void __iomem *uar_page,
140 spinlock_t *doorbell_lock) 140 spinlock_t *doorbell_lock,
141 u32 cons_index)
141{ 142{
142 __be32 doorbell[2]; 143 __be32 doorbell[2];
143 u32 sn; 144 u32 sn;
144 u32 ci; 145 u32 ci;
145 146
146 sn = cq->arm_sn & 3; 147 sn = cq->arm_sn & 3;
147 ci = cq->cons_index & 0xffffff; 148 ci = cons_index & 0xffffff;
148 149
149 *cq->arm_db = cpu_to_be32(sn << 28 | cmd | ci); 150 *cq->arm_db = cpu_to_be32(sn << 28 | cmd | ci);
150 151
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 4e5bd813bb9a..abf65c790421 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/linux/mlx5/doorbell.h b/include/linux/mlx5/doorbell.h
index 163a818411e7..afc78a3f4462 100644
--- a/include/linux/mlx5/doorbell.h
+++ b/include/linux/mlx5/doorbell.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 166d9315fe4b..9a90e7523dc2 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
@@ -232,6 +232,9 @@ struct mlx5_cmd_stats {
232}; 232};
233 233
234struct mlx5_cmd { 234struct mlx5_cmd {
235 void *cmd_alloc_buf;
236 dma_addr_t alloc_dma;
237 int alloc_size;
235 void *cmd_buf; 238 void *cmd_buf;
236 dma_addr_t dma; 239 dma_addr_t dma;
237 u16 cmdif_rev; 240 u16 cmdif_rev;
@@ -407,7 +410,7 @@ struct mlx5_core_srq {
407struct mlx5_eq_table { 410struct mlx5_eq_table {
408 void __iomem *update_ci; 411 void __iomem *update_ci;
409 void __iomem *update_arm_ci; 412 void __iomem *update_arm_ci;
410 struct list_head *comp_eq_head; 413 struct list_head comp_eqs_list;
411 struct mlx5_eq pages_eq; 414 struct mlx5_eq pages_eq;
412 struct mlx5_eq async_eq; 415 struct mlx5_eq async_eq;
413 struct mlx5_eq cmd_eq; 416 struct mlx5_eq cmd_eq;
@@ -722,6 +725,7 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,
722int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq); 725int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
723int mlx5_start_eqs(struct mlx5_core_dev *dev); 726int mlx5_start_eqs(struct mlx5_core_dev *dev);
724int mlx5_stop_eqs(struct mlx5_core_dev *dev); 727int mlx5_stop_eqs(struct mlx5_core_dev *dev);
728int mlx5_vector2eqn(struct mlx5_core_dev *dev, int vector, int *eqn, int *irqn);
725int mlx5_core_attach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn); 729int mlx5_core_attach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn);
726int mlx5_core_detach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn); 730int mlx5_core_detach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn);
727 731
@@ -777,14 +781,22 @@ enum {
777 MAX_MR_CACHE_ENTRIES = 16, 781 MAX_MR_CACHE_ENTRIES = 16,
778}; 782};
779 783
784enum {
785 MLX5_INTERFACE_PROTOCOL_IB = 0,
786 MLX5_INTERFACE_PROTOCOL_ETH = 1,
787};
788
780struct mlx5_interface { 789struct mlx5_interface {
781 void * (*add)(struct mlx5_core_dev *dev); 790 void * (*add)(struct mlx5_core_dev *dev);
782 void (*remove)(struct mlx5_core_dev *dev, void *context); 791 void (*remove)(struct mlx5_core_dev *dev, void *context);
783 void (*event)(struct mlx5_core_dev *dev, void *context, 792 void (*event)(struct mlx5_core_dev *dev, void *context,
784 enum mlx5_dev_event event, unsigned long param); 793 enum mlx5_dev_event event, unsigned long param);
794 void * (*get_dev)(void *context);
795 int protocol;
785 struct list_head list; 796 struct list_head list;
786}; 797};
787 798
799void *mlx5_get_protocol_dev(struct mlx5_core_dev *mdev, int protocol);
788int mlx5_register_interface(struct mlx5_interface *intf); 800int mlx5_register_interface(struct mlx5_interface *intf);
789void mlx5_unregister_interface(struct mlx5_interface *intf); 801void mlx5_unregister_interface(struct mlx5_interface *intf);
790 802
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 5f48b8f592c5..cb3ad17edd1f 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2014, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
index 61f7a342d1bf..310b5f7fd6ae 100644
--- a/include/linux/mlx5/qp.h
+++ b/include/linux/mlx5/qp.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/linux/mlx5/srq.h b/include/linux/mlx5/srq.h
index e1a363a33663..f43ed054a3e0 100644
--- a/include/linux/mlx5/srq.h
+++ b/include/linux/mlx5/srq.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 47a93928b90f..8b086070c3a5 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -251,6 +251,9 @@ struct vm_operations_struct {
251 * writable, if an error is returned it will cause a SIGBUS */ 251 * writable, if an error is returned it will cause a SIGBUS */
252 int (*page_mkwrite)(struct vm_area_struct *vma, struct vm_fault *vmf); 252 int (*page_mkwrite)(struct vm_area_struct *vma, struct vm_fault *vmf);
253 253
254 /* same as page_mkwrite when using VM_PFNMAP|VM_MIXEDMAP */
255 int (*pfn_mkwrite)(struct vm_area_struct *vma, struct vm_fault *vmf);
256
254 /* called by access_process_vm when get_user_pages() fails, typically 257 /* called by access_process_vm when get_user_pages() fails, typically
255 * for use by special VMAs that can switch between memory and hardware 258 * for use by special VMAs that can switch between memory and hardware
256 */ 259 */
@@ -494,18 +497,9 @@ static inline int page_count(struct page *page)
494 return atomic_read(&compound_head(page)->_count); 497 return atomic_read(&compound_head(page)->_count);
495} 498}
496 499
497#ifdef CONFIG_HUGETLB_PAGE
498extern int PageHeadHuge(struct page *page_head);
499#else /* CONFIG_HUGETLB_PAGE */
500static inline int PageHeadHuge(struct page *page_head)
501{
502 return 0;
503}
504#endif /* CONFIG_HUGETLB_PAGE */
505
506static inline bool __compound_tail_refcounted(struct page *page) 500static inline bool __compound_tail_refcounted(struct page *page)
507{ 501{
508 return !PageSlab(page) && !PageHeadHuge(page); 502 return PageAnon(page) && !PageSlab(page) && !PageHeadHuge(page);
509} 503}
510 504
511/* 505/*
@@ -571,53 +565,6 @@ static inline void init_page_count(struct page *page)
571 atomic_set(&page->_count, 1); 565 atomic_set(&page->_count, 1);
572} 566}
573 567
574/*
575 * PageBuddy() indicate that the page is free and in the buddy system
576 * (see mm/page_alloc.c).
577 *
578 * PAGE_BUDDY_MAPCOUNT_VALUE must be <= -2 but better not too close to
579 * -2 so that an underflow of the page_mapcount() won't be mistaken
580 * for a genuine PAGE_BUDDY_MAPCOUNT_VALUE. -128 can be created very
581 * efficiently by most CPU architectures.
582 */
583#define PAGE_BUDDY_MAPCOUNT_VALUE (-128)
584
585static inline int PageBuddy(struct page *page)
586{
587 return atomic_read(&page->_mapcount) == PAGE_BUDDY_MAPCOUNT_VALUE;
588}
589
590static inline void __SetPageBuddy(struct page *page)
591{
592 VM_BUG_ON_PAGE(atomic_read(&page->_mapcount) != -1, page);
593 atomic_set(&page->_mapcount, PAGE_BUDDY_MAPCOUNT_VALUE);
594}
595
596static inline void __ClearPageBuddy(struct page *page)
597{
598 VM_BUG_ON_PAGE(!PageBuddy(page), page);
599 atomic_set(&page->_mapcount, -1);
600}
601
602#define PAGE_BALLOON_MAPCOUNT_VALUE (-256)
603
604static inline int PageBalloon(struct page *page)
605{
606 return atomic_read(&page->_mapcount) == PAGE_BALLOON_MAPCOUNT_VALUE;
607}
608
609static inline void __SetPageBalloon(struct page *page)
610{
611 VM_BUG_ON_PAGE(atomic_read(&page->_mapcount) != -1, page);
612 atomic_set(&page->_mapcount, PAGE_BALLOON_MAPCOUNT_VALUE);
613}
614
615static inline void __ClearPageBalloon(struct page *page)
616{
617 VM_BUG_ON_PAGE(!PageBalloon(page), page);
618 atomic_set(&page->_mapcount, -1);
619}
620
621void put_page(struct page *page); 568void put_page(struct page *page);
622void put_pages_list(struct list_head *pages); 569void put_pages_list(struct list_head *pages);
623 570
@@ -1006,34 +953,10 @@ void page_address_init(void);
1006#define page_address_init() do { } while(0) 953#define page_address_init() do { } while(0)
1007#endif 954#endif
1008 955
1009/* 956extern void *page_rmapping(struct page *page);
1010 * On an anonymous page mapped into a user virtual memory area, 957extern struct anon_vma *page_anon_vma(struct page *page);
1011 * page->mapping points to its anon_vma, not to a struct address_space;
1012 * with the PAGE_MAPPING_ANON bit set to distinguish it. See rmap.h.
1013 *
1014 * On an anonymous page in a VM_MERGEABLE area, if CONFIG_KSM is enabled,
1015 * the PAGE_MAPPING_KSM bit may be set along with the PAGE_MAPPING_ANON bit;
1016 * and then page->mapping points, not to an anon_vma, but to a private
1017 * structure which KSM associates with that merged page. See ksm.h.
1018 *
1019 * PAGE_MAPPING_KSM without PAGE_MAPPING_ANON is currently never used.
1020 *
1021 * Please note that, confusingly, "page_mapping" refers to the inode
1022 * address_space which maps the page from disk; whereas "page_mapped"
1023 * refers to user virtual address space into which the page is mapped.
1024 */
1025#define PAGE_MAPPING_ANON 1
1026#define PAGE_MAPPING_KSM 2
1027#define PAGE_MAPPING_FLAGS (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM)
1028
1029extern struct address_space *page_mapping(struct page *page); 958extern struct address_space *page_mapping(struct page *page);
1030 959
1031/* Neutral page->mapping pointer to address_space or anon_vma or other */
1032static inline void *page_rmapping(struct page *page)
1033{
1034 return (void *)((unsigned long)page->mapping & ~PAGE_MAPPING_FLAGS);
1035}
1036
1037extern struct address_space *__page_file_mapping(struct page *); 960extern struct address_space *__page_file_mapping(struct page *);
1038 961
1039static inline 962static inline
@@ -1045,11 +968,6 @@ struct address_space *page_file_mapping(struct page *page)
1045 return page->mapping; 968 return page->mapping;
1046} 969}
1047 970
1048static inline int PageAnon(struct page *page)
1049{
1050 return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0;
1051}
1052
1053/* 971/*
1054 * Return the pagecache index of the passed page. Regular pagecache pages 972 * Return the pagecache index of the passed page. Regular pagecache pages
1055 * use ->index whereas swapcache pages use ->private 973 * use ->index whereas swapcache pages use ->private
@@ -1294,9 +1212,11 @@ int __set_page_dirty_no_writeback(struct page *page);
1294int redirty_page_for_writepage(struct writeback_control *wbc, 1212int redirty_page_for_writepage(struct writeback_control *wbc,
1295 struct page *page); 1213 struct page *page);
1296void account_page_dirtied(struct page *page, struct address_space *mapping); 1214void account_page_dirtied(struct page *page, struct address_space *mapping);
1215void account_page_cleaned(struct page *page, struct address_space *mapping);
1297int set_page_dirty(struct page *page); 1216int set_page_dirty(struct page *page);
1298int set_page_dirty_lock(struct page *page); 1217int set_page_dirty_lock(struct page *page);
1299int clear_page_dirty_for_io(struct page *page); 1218int clear_page_dirty_for_io(struct page *page);
1219
1300int get_cmdline(struct task_struct *task, char *buffer, int buflen); 1220int get_cmdline(struct task_struct *task, char *buffer, int buflen);
1301 1221
1302/* Is the vma a continuation of the stack vma above it? */ 1222/* Is the vma a continuation of the stack vma above it? */
@@ -1973,10 +1893,10 @@ extern unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info);
1973static inline unsigned long 1893static inline unsigned long
1974vm_unmapped_area(struct vm_unmapped_area_info *info) 1894vm_unmapped_area(struct vm_unmapped_area_info *info)
1975{ 1895{
1976 if (!(info->flags & VM_UNMAPPED_AREA_TOPDOWN)) 1896 if (info->flags & VM_UNMAPPED_AREA_TOPDOWN)
1977 return unmapped_area(info);
1978 else
1979 return unmapped_area_topdown(info); 1897 return unmapped_area_topdown(info);
1898 else
1899 return unmapped_area(info);
1980} 1900}
1981 1901
1982/* truncate.c */ 1902/* truncate.c */
@@ -2109,7 +2029,7 @@ static inline struct page *follow_page(struct vm_area_struct *vma,
2109#define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */ 2029#define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */
2110#define FOLL_NOWAIT 0x20 /* if a disk transfer is needed, start the IO 2030#define FOLL_NOWAIT 0x20 /* if a disk transfer is needed, start the IO
2111 * and return without waiting upon it */ 2031 * and return without waiting upon it */
2112#define FOLL_MLOCK 0x40 /* mark page as mlocked */ 2032#define FOLL_POPULATE 0x40 /* fault in page */
2113#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */ 2033#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */
2114#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */ 2034#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */
2115#define FOLL_NUMA 0x200 /* force NUMA hinting page fault */ 2035#define FOLL_NUMA 0x200 /* force NUMA hinting page fault */
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 199a03aab8dc..8d37e26a1007 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -364,7 +364,9 @@ struct mm_struct {
364 atomic_t mm_users; /* How many users with user space? */ 364 atomic_t mm_users; /* How many users with user space? */
365 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ 365 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */
366 atomic_long_t nr_ptes; /* PTE page table pages */ 366 atomic_long_t nr_ptes; /* PTE page table pages */
367#if CONFIG_PGTABLE_LEVELS > 2
367 atomic_long_t nr_pmds; /* PMD page table pages */ 368 atomic_long_t nr_pmds; /* PMD page table pages */
369#endif
368 int map_count; /* number of VMAs */ 370 int map_count; /* number of VMAs */
369 371
370 spinlock_t page_table_lock; /* Protects page tables and some counters */ 372 spinlock_t page_table_lock; /* Protects page tables and some counters */
@@ -427,7 +429,7 @@ struct mm_struct {
427#endif 429#endif
428 430
429 /* store ref to file /proc/<pid>/exe symlink points to */ 431 /* store ref to file /proc/<pid>/exe symlink points to */
430 struct file *exe_file; 432 struct file __rcu *exe_file;
431#ifdef CONFIG_MMU_NOTIFIER 433#ifdef CONFIG_MMU_NOTIFIER
432 struct mmu_notifier_mm *mmu_notifier_mm; 434 struct mmu_notifier_mm *mmu_notifier_mm;
433#endif 435#endif
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 160448f920ac..de722d4e9d61 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -79,7 +79,7 @@ struct mmc_command {
79#define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_MASK) 79#define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_MASK)
80 80
81 unsigned int retries; /* max number of retries */ 81 unsigned int retries; /* max number of retries */
82 unsigned int error; /* command error */ 82 int error; /* command error */
83 83
84/* 84/*
85 * Standard errno values are used for errors, but some have specific 85 * Standard errno values are used for errors, but some have specific
@@ -108,7 +108,7 @@ struct mmc_data {
108 unsigned int timeout_clks; /* data timeout (in clocks) */ 108 unsigned int timeout_clks; /* data timeout (in clocks) */
109 unsigned int blksz; /* data block size */ 109 unsigned int blksz; /* data block size */
110 unsigned int blocks; /* number of blocks */ 110 unsigned int blocks; /* number of blocks */
111 unsigned int error; /* data error */ 111 int error; /* data error */
112 unsigned int flags; 112 unsigned int flags;
113 113
114#define MMC_DATA_WRITE (1 << 8) 114#define MMC_DATA_WRITE (1 << 8)
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 471fb3116dbe..12111993a317 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -44,6 +44,7 @@ struct mmc_data;
44 * struct dw_mci - MMC controller state shared between all slots 44 * struct dw_mci - MMC controller state shared between all slots
45 * @lock: Spinlock protecting the queue and associated data. 45 * @lock: Spinlock protecting the queue and associated data.
46 * @regs: Pointer to MMIO registers. 46 * @regs: Pointer to MMIO registers.
47 * @fifo_reg: Pointer to MMIO registers for data FIFO
47 * @sg: Scatterlist entry currently being processed by PIO code, if any. 48 * @sg: Scatterlist entry currently being processed by PIO code, if any.
48 * @sg_miter: PIO mapping scatterlist iterator. 49 * @sg_miter: PIO mapping scatterlist iterator.
49 * @cur_slot: The slot which is currently using the controller. 50 * @cur_slot: The slot which is currently using the controller.
@@ -79,7 +80,6 @@ struct mmc_data;
79 * @current_speed: Configured rate of the controller. 80 * @current_speed: Configured rate of the controller.
80 * @num_slots: Number of slots available. 81 * @num_slots: Number of slots available.
81 * @verid: Denote Version ID. 82 * @verid: Denote Version ID.
82 * @data_offset: Set the offset of DATA register according to VERID.
83 * @dev: Device associated with the MMC controller. 83 * @dev: Device associated with the MMC controller.
84 * @pdata: Platform data associated with the MMC controller. 84 * @pdata: Platform data associated with the MMC controller.
85 * @drv_data: Driver specific data for identified variant of the controller 85 * @drv_data: Driver specific data for identified variant of the controller
@@ -132,6 +132,7 @@ struct dw_mci {
132 spinlock_t lock; 132 spinlock_t lock;
133 spinlock_t irq_lock; 133 spinlock_t irq_lock;
134 void __iomem *regs; 134 void __iomem *regs;
135 void __iomem *fifo_reg;
135 136
136 struct scatterlist *sg; 137 struct scatterlist *sg;
137 struct sg_mapping_iter sg_miter; 138 struct sg_mapping_iter sg_miter;
@@ -172,7 +173,6 @@ struct dw_mci {
172 u32 num_slots; 173 u32 num_slots;
173 u32 fifoth_val; 174 u32 fifoth_val;
174 u16 verid; 175 u16 verid;
175 u16 data_offset;
176 struct device *dev; 176 struct device *dev;
177 struct dw_mci_board *pdata; 177 struct dw_mci_board *pdata;
178 const struct dw_mci_drv_data *drv_data; 178 const struct dw_mci_drv_data *drv_data;
@@ -202,6 +202,8 @@ struct dw_mci {
202 int irq; 202 int irq;
203 203
204 int sdio_id0; 204 int sdio_id0;
205
206 struct timer_list cmd11_timer;
205}; 207};
206 208
207/* DMA ops for Internal/External DMAC interface */ 209/* DMA ops for Internal/External DMAC interface */
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 0c8cbe5d1550..b5bedaec6223 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -80,12 +80,6 @@ struct mmc_ios {
80 80
81struct mmc_host_ops { 81struct mmc_host_ops {
82 /* 82 /*
83 * 'enable' is called when the host is claimed and 'disable' is called
84 * when the host is released. 'enable' and 'disable' are deprecated.
85 */
86 int (*enable)(struct mmc_host *host);
87 int (*disable)(struct mmc_host *host);
88 /*
89 * It is optional for the host to implement pre_req and post_req in 83 * It is optional for the host to implement pre_req and post_req in
90 * order to support double buffering of requests (prepare one 84 * order to support double buffering of requests (prepare one
91 * request while another request is active). 85 * request while another request is active).
diff --git a/include/linux/mmc/sdhci-spear.h b/include/linux/mmc/sdhci-spear.h
deleted file mode 100644
index 8cc095a76cf8..000000000000
--- a/include/linux/mmc/sdhci-spear.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * include/linux/mmc/sdhci-spear.h
3 *
4 * SDHCI declarations specific to ST SPEAr platform
5 *
6 * Copyright (C) 2010 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef LINUX_MMC_SDHCI_SPEAR_H
15#define LINUX_MMC_SDHCI_SPEAR_H
16
17#include <linux/platform_device.h>
18/*
19 * struct sdhci_plat_data: spear sdhci platform data structure
20 *
21 * card_int_gpio: gpio pin used for card detection
22 */
23struct sdhci_plat_data {
24 int card_int_gpio;
25};
26
27/* This function is used to set platform_data field of pdev->dev */
28static inline void
29sdhci_set_plat_data(struct platform_device *pdev, struct sdhci_plat_data *data)
30{
31 pdev->dev.platform_data = data;
32}
33
34#endif /* LINUX_MMC_SDHCI_SPEAR_H */
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
deleted file mode 100644
index c3e3db196738..000000000000
--- a/include/linux/mmc/sdhci.h
+++ /dev/null
@@ -1,218 +0,0 @@
1/*
2 * linux/include/linux/mmc/sdhci.h - Secure Digital Host Controller Interface
3 *
4 * Copyright (C) 2005-2008 Pierre Ossman, All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 */
11#ifndef LINUX_MMC_SDHCI_H
12#define LINUX_MMC_SDHCI_H
13
14#include <linux/scatterlist.h>
15#include <linux/compiler.h>
16#include <linux/types.h>
17#include <linux/io.h>
18#include <linux/mmc/host.h>
19
20struct sdhci_host_next {
21 unsigned int sg_count;
22 s32 cookie;
23};
24
25struct sdhci_host {
26 /* Data set by hardware interface driver */
27 const char *hw_name; /* Hardware bus name */
28
29 unsigned int quirks; /* Deviations from spec. */
30
31/* Controller doesn't honor resets unless we touch the clock register */
32#define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1<<0)
33/* Controller has bad caps bits, but really supports DMA */
34#define SDHCI_QUIRK_FORCE_DMA (1<<1)
35/* Controller doesn't like to be reset when there is no card inserted. */
36#define SDHCI_QUIRK_NO_CARD_NO_RESET (1<<2)
37/* Controller doesn't like clearing the power reg before a change */
38#define SDHCI_QUIRK_SINGLE_POWER_WRITE (1<<3)
39/* Controller has flaky internal state so reset it on each ios change */
40#define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS (1<<4)
41/* Controller has an unusable DMA engine */
42#define SDHCI_QUIRK_BROKEN_DMA (1<<5)
43/* Controller has an unusable ADMA engine */
44#define SDHCI_QUIRK_BROKEN_ADMA (1<<6)
45/* Controller can only DMA from 32-bit aligned addresses */
46#define SDHCI_QUIRK_32BIT_DMA_ADDR (1<<7)
47/* Controller can only DMA chunk sizes that are a multiple of 32 bits */
48#define SDHCI_QUIRK_32BIT_DMA_SIZE (1<<8)
49/* Controller can only ADMA chunks that are a multiple of 32 bits */
50#define SDHCI_QUIRK_32BIT_ADMA_SIZE (1<<9)
51/* Controller needs to be reset after each request to stay stable */
52#define SDHCI_QUIRK_RESET_AFTER_REQUEST (1<<10)
53/* Controller needs voltage and power writes to happen separately */
54#define SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER (1<<11)
55/* Controller provides an incorrect timeout value for transfers */
56#define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<12)
57/* Controller has an issue with buffer bits for small transfers */
58#define SDHCI_QUIRK_BROKEN_SMALL_PIO (1<<13)
59/* Controller does not provide transfer-complete interrupt when not busy */
60#define SDHCI_QUIRK_NO_BUSY_IRQ (1<<14)
61/* Controller has unreliable card detection */
62#define SDHCI_QUIRK_BROKEN_CARD_DETECTION (1<<15)
63/* Controller reports inverted write-protect state */
64#define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1<<16)
65/* Controller does not like fast PIO transfers */
66#define SDHCI_QUIRK_PIO_NEEDS_DELAY (1<<18)
67/* Controller has to be forced to use block size of 2048 bytes */
68#define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1<<20)
69/* Controller cannot do multi-block transfers */
70#define SDHCI_QUIRK_NO_MULTIBLOCK (1<<21)
71/* Controller can only handle 1-bit data transfers */
72#define SDHCI_QUIRK_FORCE_1_BIT_DATA (1<<22)
73/* Controller needs 10ms delay between applying power and clock */
74#define SDHCI_QUIRK_DELAY_AFTER_POWER (1<<23)
75/* Controller uses SDCLK instead of TMCLK for data timeouts */
76#define SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK (1<<24)
77/* Controller reports wrong base clock capability */
78#define SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN (1<<25)
79/* Controller cannot support End Attribute in NOP ADMA descriptor */
80#define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC (1<<26)
81/* Controller is missing device caps. Use caps provided by host */
82#define SDHCI_QUIRK_MISSING_CAPS (1<<27)
83/* Controller uses Auto CMD12 command to stop the transfer */
84#define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 (1<<28)
85/* Controller doesn't have HISPD bit field in HI-SPEED SD card */
86#define SDHCI_QUIRK_NO_HISPD_BIT (1<<29)
87/* Controller treats ADMA descriptors with length 0000h incorrectly */
88#define SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC (1<<30)
89/* The read-only detection via SDHCI_PRESENT_STATE register is unstable */
90#define SDHCI_QUIRK_UNSTABLE_RO_DETECT (1<<31)
91
92 unsigned int quirks2; /* More deviations from spec. */
93
94#define SDHCI_QUIRK2_HOST_OFF_CARD_ON (1<<0)
95#define SDHCI_QUIRK2_HOST_NO_CMD23 (1<<1)
96/* The system physically doesn't support 1.8v, even if the host does */
97#define SDHCI_QUIRK2_NO_1_8_V (1<<2)
98#define SDHCI_QUIRK2_PRESET_VALUE_BROKEN (1<<3)
99#define SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON (1<<4)
100/* Controller has a non-standard host control register */
101#define SDHCI_QUIRK2_BROKEN_HOST_CONTROL (1<<5)
102/* Controller does not support HS200 */
103#define SDHCI_QUIRK2_BROKEN_HS200 (1<<6)
104/* Controller does not support DDR50 */
105#define SDHCI_QUIRK2_BROKEN_DDR50 (1<<7)
106/* Stop command (CMD12) can set Transfer Complete when not using MMC_RSP_BUSY */
107#define SDHCI_QUIRK2_STOP_WITH_TC (1<<8)
108/* Controller does not support 64-bit DMA */
109#define SDHCI_QUIRK2_BROKEN_64_BIT_DMA (1<<9)
110/* need clear transfer mode register before send cmd */
111#define SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD (1<<10)
112/* Capability register bit-63 indicates HS400 support */
113#define SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400 (1<<11)
114/* forced tuned clock */
115#define SDHCI_QUIRK2_TUNING_WORK_AROUND (1<<12)
116/* disable the block count for single block transactions */
117#define SDHCI_QUIRK2_SUPPORT_SINGLE (1<<13)
118
119 int irq; /* Device IRQ */
120 void __iomem *ioaddr; /* Mapped address */
121
122 const struct sdhci_ops *ops; /* Low level hw interface */
123
124 /* Internal data */
125 struct mmc_host *mmc; /* MMC structure */
126 u64 dma_mask; /* custom DMA mask */
127
128#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
129 struct led_classdev led; /* LED control */
130 char led_name[32];
131#endif
132
133 spinlock_t lock; /* Mutex */
134
135 int flags; /* Host attributes */
136#define SDHCI_USE_SDMA (1<<0) /* Host is SDMA capable */
137#define SDHCI_USE_ADMA (1<<1) /* Host is ADMA capable */
138#define SDHCI_REQ_USE_DMA (1<<2) /* Use DMA for this req. */
139#define SDHCI_DEVICE_DEAD (1<<3) /* Device unresponsive */
140#define SDHCI_SDR50_NEEDS_TUNING (1<<4) /* SDR50 needs tuning */
141#define SDHCI_NEEDS_RETUNING (1<<5) /* Host needs retuning */
142#define SDHCI_AUTO_CMD12 (1<<6) /* Auto CMD12 support */
143#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */
144#define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */
145#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */
146#define SDHCI_SDR104_NEEDS_TUNING (1<<10) /* SDR104/HS200 needs tuning */
147#define SDHCI_USING_RETUNING_TIMER (1<<11) /* Host is using a retuning timer for the card */
148#define SDHCI_USE_64_BIT_DMA (1<<12) /* Use 64-bit DMA */
149#define SDHCI_HS400_TUNING (1<<13) /* Tuning for HS400 */
150
151 unsigned int version; /* SDHCI spec. version */
152
153 unsigned int max_clk; /* Max possible freq (MHz) */
154 unsigned int timeout_clk; /* Timeout freq (KHz) */
155 unsigned int clk_mul; /* Clock Muliplier value */
156
157 unsigned int clock; /* Current clock (MHz) */
158 u8 pwr; /* Current voltage */
159
160 bool runtime_suspended; /* Host is runtime suspended */
161 bool bus_on; /* Bus power prevents runtime suspend */
162 bool preset_enabled; /* Preset is enabled */
163
164 struct mmc_request *mrq; /* Current request */
165 struct mmc_command *cmd; /* Current command */
166 struct mmc_data *data; /* Current data request */
167 unsigned int data_early:1; /* Data finished before cmd */
168 unsigned int busy_handle:1; /* Handling the order of Busy-end */
169
170 struct sg_mapping_iter sg_miter; /* SG state for PIO */
171 unsigned int blocks; /* remaining PIO blocks */
172
173 int sg_count; /* Mapped sg entries */
174
175 void *adma_table; /* ADMA descriptor table */
176 void *align_buffer; /* Bounce buffer */
177
178 size_t adma_table_sz; /* ADMA descriptor table size */
179 size_t align_buffer_sz; /* Bounce buffer size */
180
181 dma_addr_t adma_addr; /* Mapped ADMA descr. table */
182 dma_addr_t align_addr; /* Mapped bounce buffer */
183
184 unsigned int desc_sz; /* ADMA descriptor size */
185 unsigned int align_sz; /* ADMA alignment */
186 unsigned int align_mask; /* ADMA alignment mask */
187
188 struct tasklet_struct finish_tasklet; /* Tasklet structures */
189
190 struct timer_list timer; /* Timer for timeouts */
191
192 u32 caps; /* Alternative CAPABILITY_0 */
193 u32 caps1; /* Alternative CAPABILITY_1 */
194
195 unsigned int ocr_avail_sdio; /* OCR bit masks */
196 unsigned int ocr_avail_sd;
197 unsigned int ocr_avail_mmc;
198 u32 ocr_mask; /* available voltages */
199
200 unsigned timing; /* Current timing */
201
202 u32 thread_isr;
203
204 /* cached registers */
205 u32 ier;
206
207 wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */
208 unsigned int tuning_done; /* Condition flag set when CMD19 succeeds */
209
210 unsigned int tuning_count; /* Timer count for re-tuning */
211 unsigned int tuning_mode; /* Re-tuning mode supported by host */
212#define SDHCI_TUNING_MODE_1 0
213 struct timer_list tuning_timer; /* Timer for tuning */
214
215 struct sdhci_host_next next_data;
216 unsigned long private[0] ____cacheline_aligned;
217};
218#endif /* LINUX_MMC_SDHCI_H */
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index 996807963716..83430f2ea757 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -33,6 +33,8 @@
33#define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d 33#define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
34#define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335 34#define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
35#define SDIO_DEVICE_ID_BROADCOM_43362 0xa962 35#define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
36#define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6
37#define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
36#define SDIO_DEVICE_ID_BROADCOM_4354 0x4354 38#define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
37 39
38#define SDIO_VENDOR_ID_INTEL 0x0089 40#define SDIO_VENDOR_ID_INTEL 0x0089
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index f279d9c158cd..54d74f6eb233 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -474,16 +474,15 @@ struct zone {
474 unsigned long wait_table_bits; 474 unsigned long wait_table_bits;
475 475
476 ZONE_PADDING(_pad1_) 476 ZONE_PADDING(_pad1_)
477
478 /* Write-intensive fields used from the page allocator */
479 spinlock_t lock;
480
481 /* free areas of different sizes */ 477 /* free areas of different sizes */
482 struct free_area free_area[MAX_ORDER]; 478 struct free_area free_area[MAX_ORDER];
483 479
484 /* zone flags, see below */ 480 /* zone flags, see below */
485 unsigned long flags; 481 unsigned long flags;
486 482
483 /* Write-intensive fields used from the page allocator */
484 spinlock_t lock;
485
487 ZONE_PADDING(_pad2_) 486 ZONE_PADDING(_pad2_)
488 487
489 /* Write-intensive fields used by page reclaim */ 488 /* Write-intensive fields used by page reclaim */
@@ -843,16 +842,16 @@ static inline int populated_zone(struct zone *zone)
843 842
844extern int movable_zone; 843extern int movable_zone;
845 844
845#ifdef CONFIG_HIGHMEM
846static inline int zone_movable_is_highmem(void) 846static inline int zone_movable_is_highmem(void)
847{ 847{
848#if defined(CONFIG_HIGHMEM) && defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) 848#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
849 return movable_zone == ZONE_HIGHMEM; 849 return movable_zone == ZONE_HIGHMEM;
850#elif defined(CONFIG_HIGHMEM)
851 return (ZONE_MOVABLE - 1) == ZONE_HIGHMEM;
852#else 850#else
853 return 0; 851 return (ZONE_MOVABLE - 1) == ZONE_HIGHMEM;
854#endif 852#endif
855} 853}
854#endif
856 855
857static inline int is_highmem_idx(enum zone_type idx) 856static inline int is_highmem_idx(enum zone_type idx)
858{ 857{
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index e530533b94be..3bfd56778c29 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -546,6 +546,14 @@ struct amba_id {
546 void *data; 546 void *data;
547}; 547};
548 548
549/**
550 * struct mips_cdmm_device_id - identifies devices in MIPS CDMM bus
551 * @type: Device type identifier.
552 */
553struct mips_cdmm_device_id {
554 __u8 type;
555};
556
549/* 557/*
550 * Match x86 CPUs for CPU specific drivers. 558 * Match x86 CPUs for CPU specific drivers.
551 * See documentation of "x86_match_cpu" for details. 559 * See documentation of "x86_match_cpu" for details.
diff --git a/include/linux/module.h b/include/linux/module.h
index b03485bcb82a..c883b86ea964 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -338,6 +338,8 @@ struct module {
338#ifdef CONFIG_EVENT_TRACING 338#ifdef CONFIG_EVENT_TRACING
339 struct ftrace_event_call **trace_events; 339 struct ftrace_event_call **trace_events;
340 unsigned int num_trace_events; 340 unsigned int num_trace_events;
341 struct trace_enum_map **trace_enums;
342 unsigned int num_trace_enums;
341#endif 343#endif
342#ifdef CONFIG_FTRACE_MCOUNT_RECORD 344#ifdef CONFIG_FTRACE_MCOUNT_RECORD
343 unsigned int num_ftrace_callsites; 345 unsigned int num_ftrace_callsites;
diff --git a/include/linux/mount.h b/include/linux/mount.h
index c2c561dc0114..f822c3c11377 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -61,6 +61,7 @@ struct mnt_namespace;
61#define MNT_DOOMED 0x1000000 61#define MNT_DOOMED 0x1000000
62#define MNT_SYNC_UMOUNT 0x2000000 62#define MNT_SYNC_UMOUNT 0x2000000
63#define MNT_MARKED 0x4000000 63#define MNT_MARKED 0x4000000
64#define MNT_UMOUNT 0x8000000
64 65
65struct vfsmount { 66struct vfsmount {
66 struct dentry *mnt_root; /* root of the mounted tree */ 67 struct dentry *mnt_root; /* root of the mounted tree */
@@ -92,6 +93,6 @@ extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
92extern void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list); 93extern void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list);
93extern void mark_mounts_for_expiry(struct list_head *mounts); 94extern void mark_mounts_for_expiry(struct list_head *mounts);
94 95
95extern dev_t name_to_dev_t(char *name); 96extern dev_t name_to_dev_t(const char *name);
96 97
97#endif /* _LINUX_MOUNT_H */ 98#endif /* _LINUX_MOUNT_H */
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
deleted file mode 100644
index f62f78aef4ac..000000000000
--- a/include/linux/nbd.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * 1999 Copyright (C) Pavel Machek, pavel@ucw.cz. This code is GPL.
3 * 1999/11/04 Copyright (C) 1999 VMware, Inc. (Regis "HPReg" Duchesne)
4 * Made nbd_end_request() use the io_request_lock
5 * 2001 Copyright (C) Steven Whitehouse
6 * New nbd_end_request() for compatibility with new linux block
7 * layer code.
8 * 2003/06/24 Louis D. Langholtz <ldl@aros.net>
9 * Removed unneeded blksize_bits field from nbd_device struct.
10 * Cleanup PARANOIA usage & code.
11 * 2004/02/19 Paul Clements
12 * Removed PARANOIA, plus various cleanup and comments
13 */
14#ifndef LINUX_NBD_H
15#define LINUX_NBD_H
16
17
18#include <linux/wait.h>
19#include <linux/mutex.h>
20#include <uapi/linux/nbd.h>
21
22struct request;
23
24struct nbd_device {
25 int flags;
26 int harderror; /* Code of hard error */
27 struct socket * sock; /* If == NULL, device is not ready, yet */
28 int magic;
29
30 spinlock_t queue_lock;
31 struct list_head queue_head; /* Requests waiting result */
32 struct request *active_req;
33 wait_queue_head_t active_wq;
34 struct list_head waiting_queue; /* Requests to be sent */
35 wait_queue_head_t waiting_wq;
36
37 struct mutex tx_lock;
38 struct gendisk *disk;
39 int blksize;
40 u64 bytesize;
41 pid_t pid; /* pid of nbd-client, if attached */
42 int xmit_timeout;
43 int disconnect; /* a disconnect has been requested by user */
44};
45
46#endif
diff --git a/include/linux/net.h b/include/linux/net.h
index 17d83393afcc..738ea48be889 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -120,7 +120,6 @@ struct socket {
120 120
121struct vm_area_struct; 121struct vm_area_struct;
122struct page; 122struct page;
123struct kiocb;
124struct sockaddr; 123struct sockaddr;
125struct msghdr; 124struct msghdr;
126struct module; 125struct module;
@@ -162,8 +161,8 @@ struct proto_ops {
162 int (*compat_getsockopt)(struct socket *sock, int level, 161 int (*compat_getsockopt)(struct socket *sock, int level,
163 int optname, char __user *optval, int __user *optlen); 162 int optname, char __user *optval, int __user *optlen);
164#endif 163#endif
165 int (*sendmsg) (struct kiocb *iocb, struct socket *sock, 164 int (*sendmsg) (struct socket *sock, struct msghdr *m,
166 struct msghdr *m, size_t total_len); 165 size_t total_len);
167 /* Notes for implementing recvmsg: 166 /* Notes for implementing recvmsg:
168 * =============================== 167 * ===============================
169 * msg->msg_namelen should get updated by the recvmsg handlers 168 * msg->msg_namelen should get updated by the recvmsg handlers
@@ -172,9 +171,8 @@ struct proto_ops {
172 * handlers can assume that msg.msg_name is either NULL or has 171 * handlers can assume that msg.msg_name is either NULL or has
173 * a minimum size of sizeof(struct sockaddr_storage). 172 * a minimum size of sizeof(struct sockaddr_storage).
174 */ 173 */
175 int (*recvmsg) (struct kiocb *iocb, struct socket *sock, 174 int (*recvmsg) (struct socket *sock, struct msghdr *m,
176 struct msghdr *m, size_t total_len, 175 size_t total_len, int flags);
177 int flags);
178 int (*mmap) (struct file *file, struct socket *sock, 176 int (*mmap) (struct file *file, struct socket *sock,
179 struct vm_area_struct * vma); 177 struct vm_area_struct * vma);
180 ssize_t (*sendpage) (struct socket *sock, struct page *page, 178 ssize_t (*sendpage) (struct socket *sock, struct page *page,
@@ -213,7 +211,7 @@ int sock_create(int family, int type, int proto, struct socket **res);
213int sock_create_kern(int family, int type, int proto, struct socket **res); 211int sock_create_kern(int family, int type, int proto, struct socket **res);
214int sock_create_lite(int family, int type, int proto, struct socket **res); 212int sock_create_lite(int family, int type, int proto, struct socket **res);
215void sock_release(struct socket *sock); 213void sock_release(struct socket *sock);
216int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t len); 214int sock_sendmsg(struct socket *sock, struct msghdr *msg);
217int sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, 215int sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
218 int flags); 216 int flags);
219struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname); 217struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 278738873703..bcbde799ec69 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -261,7 +261,6 @@ struct header_ops {
261 unsigned short type, const void *daddr, 261 unsigned short type, const void *daddr,
262 const void *saddr, unsigned int len); 262 const void *saddr, unsigned int len);
263 int (*parse)(const struct sk_buff *skb, unsigned char *haddr); 263 int (*parse)(const struct sk_buff *skb, unsigned char *haddr);
264 int (*rebuild)(struct sk_buff *skb);
265 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type); 264 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
266 void (*cache_update)(struct hh_cache *hh, 265 void (*cache_update)(struct hh_cache *hh,
267 const struct net_device *dev, 266 const struct net_device *dev,
@@ -588,6 +587,7 @@ struct netdev_queue {
588#ifdef CONFIG_BQL 587#ifdef CONFIG_BQL
589 struct dql dql; 588 struct dql dql;
590#endif 589#endif
590 unsigned long tx_maxrate;
591} ____cacheline_aligned_in_smp; 591} ____cacheline_aligned_in_smp;
592 592
593static inline int netdev_queue_numa_node_read(const struct netdev_queue *q) 593static inline int netdev_queue_numa_node_read(const struct netdev_queue *q)
@@ -795,7 +795,10 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
795 * netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, 795 * netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb,
796 * struct net_device *dev); 796 * struct net_device *dev);
797 * Called when a packet needs to be transmitted. 797 * Called when a packet needs to be transmitted.
798 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY. 798 * Returns NETDEV_TX_OK. Can return NETDEV_TX_BUSY, but you should stop
799 * the queue before that can happen; it's for obsolete devices and weird
800 * corner cases, but the stack really does a non-trivial amount
801 * of useless work if you return NETDEV_TX_BUSY.
799 * (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX) 802 * (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX)
800 * Required can not be NULL. 803 * Required can not be NULL.
801 * 804 *
@@ -875,6 +878,11 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
875 * int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state); 878 * int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state);
876 * int (*ndo_set_vf_port)(struct net_device *dev, int vf, 879 * int (*ndo_set_vf_port)(struct net_device *dev, int vf,
877 * struct nlattr *port[]); 880 * struct nlattr *port[]);
881 *
882 * Enable or disable the VF ability to query its RSS Redirection Table and
883 * Hash Key. This is needed since on some devices VF share this information
884 * with PF and querying it may adduce a theoretical security risk.
885 * int (*ndo_set_vf_rss_query_en)(struct net_device *dev, int vf, bool setting);
878 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); 886 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
879 * int (*ndo_setup_tc)(struct net_device *dev, u8 tc) 887 * int (*ndo_setup_tc)(struct net_device *dev, u8 tc)
880 * Called to setup 'tc' number of traffic classes in the net device. This 888 * Called to setup 'tc' number of traffic classes in the net device. This
@@ -1026,15 +1034,12 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
1026 * be otherwise expressed by feature flags. The check is called with 1034 * be otherwise expressed by feature flags. The check is called with
1027 * the set of features that the stack has calculated and it returns 1035 * the set of features that the stack has calculated and it returns
1028 * those the driver believes to be appropriate. 1036 * those the driver believes to be appropriate.
1029 * 1037 * int (*ndo_set_tx_maxrate)(struct net_device *dev,
1030 * int (*ndo_switch_parent_id_get)(struct net_device *dev, 1038 * int queue_index, u32 maxrate);
1031 * struct netdev_phys_item_id *psid); 1039 * Called when a user wants to set a max-rate limitation of specific
1032 * Called to get an ID of the switch chip this port is part of. 1040 * TX queue.
1033 * If driver implements this, it indicates that it represents a port 1041 * int (*ndo_get_iflink)(const struct net_device *dev);
1034 * of a switch chip. 1042 * Called to get the iflink value of this device.
1035 * int (*ndo_switch_port_stp_update)(struct net_device *dev, u8 state);
1036 * Called to notify switch device port of bridge port STP
1037 * state change.
1038 */ 1043 */
1039struct net_device_ops { 1044struct net_device_ops {
1040 int (*ndo_init)(struct net_device *dev); 1045 int (*ndo_init)(struct net_device *dev);
@@ -1099,6 +1104,9 @@ struct net_device_ops {
1099 struct nlattr *port[]); 1104 struct nlattr *port[]);
1100 int (*ndo_get_vf_port)(struct net_device *dev, 1105 int (*ndo_get_vf_port)(struct net_device *dev,
1101 int vf, struct sk_buff *skb); 1106 int vf, struct sk_buff *skb);
1107 int (*ndo_set_vf_rss_query_en)(
1108 struct net_device *dev,
1109 int vf, bool setting);
1102 int (*ndo_setup_tc)(struct net_device *dev, u8 tc); 1110 int (*ndo_setup_tc)(struct net_device *dev, u8 tc);
1103#if IS_ENABLED(CONFIG_FCOE) 1111#if IS_ENABLED(CONFIG_FCOE)
1104 int (*ndo_fcoe_enable)(struct net_device *dev); 1112 int (*ndo_fcoe_enable)(struct net_device *dev);
@@ -1172,6 +1180,8 @@ struct net_device_ops {
1172 bool new_carrier); 1180 bool new_carrier);
1173 int (*ndo_get_phys_port_id)(struct net_device *dev, 1181 int (*ndo_get_phys_port_id)(struct net_device *dev,
1174 struct netdev_phys_item_id *ppid); 1182 struct netdev_phys_item_id *ppid);
1183 int (*ndo_get_phys_port_name)(struct net_device *dev,
1184 char *name, size_t len);
1175 void (*ndo_add_vxlan_port)(struct net_device *dev, 1185 void (*ndo_add_vxlan_port)(struct net_device *dev,
1176 sa_family_t sa_family, 1186 sa_family_t sa_family,
1177 __be16 port); 1187 __be16 port);
@@ -1191,12 +1201,10 @@ struct net_device_ops {
1191 netdev_features_t (*ndo_features_check) (struct sk_buff *skb, 1201 netdev_features_t (*ndo_features_check) (struct sk_buff *skb,
1192 struct net_device *dev, 1202 struct net_device *dev,
1193 netdev_features_t features); 1203 netdev_features_t features);
1194#ifdef CONFIG_NET_SWITCHDEV 1204 int (*ndo_set_tx_maxrate)(struct net_device *dev,
1195 int (*ndo_switch_parent_id_get)(struct net_device *dev, 1205 int queue_index,
1196 struct netdev_phys_item_id *psid); 1206 u32 maxrate);
1197 int (*ndo_switch_port_stp_update)(struct net_device *dev, 1207 int (*ndo_get_iflink)(const struct net_device *dev);
1198 u8 state);
1199#endif
1200}; 1208};
1201 1209
1202/** 1210/**
@@ -1305,6 +1313,8 @@ enum netdev_priv_flags {
1305 * @base_addr: Device I/O address 1313 * @base_addr: Device I/O address
1306 * @irq: Device IRQ number 1314 * @irq: Device IRQ number
1307 * 1315 *
1316 * @carrier_changes: Stats to monitor carrier on<->off transitions
1317 *
1308 * @state: Generic network queuing layer state, see netdev_state_t 1318 * @state: Generic network queuing layer state, see netdev_state_t
1309 * @dev_list: The global list of network devices 1319 * @dev_list: The global list of network devices
1310 * @napi_list: List entry, that is used for polling napi devices 1320 * @napi_list: List entry, that is used for polling napi devices
@@ -1328,7 +1338,7 @@ enum netdev_priv_flags {
1328 * @mpls_features: Mask of features inheritable by MPLS 1338 * @mpls_features: Mask of features inheritable by MPLS
1329 * 1339 *
1330 * @ifindex: interface index 1340 * @ifindex: interface index
1331 * @iflink: unique device identifier 1341 * @group: The group, that the device belongs to
1332 * 1342 *
1333 * @stats: Statistics struct, which was left as a legacy, use 1343 * @stats: Statistics struct, which was left as a legacy, use
1334 * rtnl_link_stats64 instead 1344 * rtnl_link_stats64 instead
@@ -1338,8 +1348,6 @@ enum netdev_priv_flags {
1338 * @tx_dropped: Dropped packets by core network, 1348 * @tx_dropped: Dropped packets by core network,
1339 * do not use this in drivers 1349 * do not use this in drivers
1340 * 1350 *
1341 * @carrier_changes: Stats to monitor carrier on<->off transitions
1342 *
1343 * @wireless_handlers: List of functions to handle Wireless Extensions, 1351 * @wireless_handlers: List of functions to handle Wireless Extensions,
1344 * instead of ioctl, 1352 * instead of ioctl,
1345 * see <net/iw_handler.h> for details. 1353 * see <net/iw_handler.h> for details.
@@ -1348,8 +1356,7 @@ enum netdev_priv_flags {
1348 * @netdev_ops: Includes several pointers to callbacks, 1356 * @netdev_ops: Includes several pointers to callbacks,
1349 * if one wants to override the ndo_*() functions 1357 * if one wants to override the ndo_*() functions
1350 * @ethtool_ops: Management operations 1358 * @ethtool_ops: Management operations
1351 * @fwd_ops: Management operations 1359 * @header_ops: Includes callbacks for creating,parsing,caching,etc
1352 * @header_ops: Includes callbacks for creating,parsing,rebuilding,etc
1353 * of Layer 2 headers. 1360 * of Layer 2 headers.
1354 * 1361 *
1355 * @flags: Interface flags (a la BSD) 1362 * @flags: Interface flags (a la BSD)
@@ -1383,14 +1390,14 @@ enum netdev_priv_flags {
1383 * @dev_port: Used to differentiate devices that share 1390 * @dev_port: Used to differentiate devices that share
1384 * the same function 1391 * the same function
1385 * @addr_list_lock: XXX: need comments on this one 1392 * @addr_list_lock: XXX: need comments on this one
1386 * @uc: unicast mac addresses
1387 * @mc: multicast mac addresses
1388 * @dev_addrs: list of device hw addresses
1389 * @queues_kset: Group of all Kobjects in the Tx and RX queues
1390 * @uc_promisc: Counter, that indicates, that promiscuous mode 1393 * @uc_promisc: Counter, that indicates, that promiscuous mode
1391 * has been enabled due to the need to listen to 1394 * has been enabled due to the need to listen to
1392 * additional unicast addresses in a device that 1395 * additional unicast addresses in a device that
1393 * does not implement ndo_set_rx_mode() 1396 * does not implement ndo_set_rx_mode()
1397 * @uc: unicast mac addresses
1398 * @mc: multicast mac addresses
1399 * @dev_addrs: list of device hw addresses
1400 * @queues_kset: Group of all Kobjects in the Tx and RX queues
1394 * @promiscuity: Number of times, the NIC is told to work in 1401 * @promiscuity: Number of times, the NIC is told to work in
1395 * Promiscuous mode, if it becomes 0 the NIC will 1402 * Promiscuous mode, if it becomes 0 the NIC will
1396 * exit from working in Promiscuous mode 1403 * exit from working in Promiscuous mode
@@ -1420,6 +1427,12 @@ enum netdev_priv_flags {
1420 * @ingress_queue: XXX: need comments on this one 1427 * @ingress_queue: XXX: need comments on this one
1421 * @broadcast: hw bcast address 1428 * @broadcast: hw bcast address
1422 * 1429 *
1430 * @rx_cpu_rmap: CPU reverse-mapping for RX completion interrupts,
1431 * indexed by RX queue number. Assigned by driver.
1432 * This must only be set if the ndo_rx_flow_steer
1433 * operation is defined
1434 * @index_hlist: Device index hash chain
1435 *
1423 * @_tx: Array of TX queues 1436 * @_tx: Array of TX queues
1424 * @num_tx_queues: Number of TX queues allocated at alloc_netdev_mq() time 1437 * @num_tx_queues: Number of TX queues allocated at alloc_netdev_mq() time
1425 * @real_num_tx_queues: Number of TX queues currently active in device 1438 * @real_num_tx_queues: Number of TX queues currently active in device
@@ -1429,11 +1442,6 @@ enum netdev_priv_flags {
1429 * 1442 *
1430 * @xps_maps: XXX: need comments on this one 1443 * @xps_maps: XXX: need comments on this one
1431 * 1444 *
1432 * @rx_cpu_rmap: CPU reverse-mapping for RX completion interrupts,
1433 * indexed by RX queue number. Assigned by driver.
1434 * This must only be set if the ndo_rx_flow_steer
1435 * operation is defined
1436 *
1437 * @trans_start: Time (in jiffies) of last Tx 1445 * @trans_start: Time (in jiffies) of last Tx
1438 * @watchdog_timeo: Represents the timeout that is used by 1446 * @watchdog_timeo: Represents the timeout that is used by
1439 * the watchdog ( see dev_watchdog() ) 1447 * the watchdog ( see dev_watchdog() )
@@ -1441,7 +1449,6 @@ enum netdev_priv_flags {
1441 * 1449 *
1442 * @pcpu_refcnt: Number of references to this device 1450 * @pcpu_refcnt: Number of references to this device
1443 * @todo_list: Delayed register/unregister 1451 * @todo_list: Delayed register/unregister
1444 * @index_hlist: Device index hash chain
1445 * @link_watch_list: XXX: need comments on this one 1452 * @link_watch_list: XXX: need comments on this one
1446 * 1453 *
1447 * @reg_state: Register/unregister state machine 1454 * @reg_state: Register/unregister state machine
@@ -1489,7 +1496,6 @@ enum netdev_priv_flags {
1489 * 1496 *
1490 * @qdisc_tx_busylock: XXX: need comments on this one 1497 * @qdisc_tx_busylock: XXX: need comments on this one
1491 * 1498 *
1492 * @group: The group, that the device belongs to
1493 * @pm_qos_req: Power Management QoS object 1499 * @pm_qos_req: Power Management QoS object
1494 * 1500 *
1495 * FIXME: cleanup struct net_device such that network protocol info 1501 * FIXME: cleanup struct net_device such that network protocol info
@@ -1509,6 +1515,8 @@ struct net_device {
1509 unsigned long base_addr; 1515 unsigned long base_addr;
1510 int irq; 1516 int irq;
1511 1517
1518 atomic_t carrier_changes;
1519
1512 /* 1520 /*
1513 * Some hardware also needs these fields (state,dev_list, 1521 * Some hardware also needs these fields (state,dev_list,
1514 * napi_list,unreg_list,close_list) but they are not 1522 * napi_list,unreg_list,close_list) but they are not
@@ -1542,22 +1550,22 @@ struct net_device {
1542 netdev_features_t mpls_features; 1550 netdev_features_t mpls_features;
1543 1551
1544 int ifindex; 1552 int ifindex;
1545 int iflink; 1553 int group;
1546 1554
1547 struct net_device_stats stats; 1555 struct net_device_stats stats;
1548 1556
1549 atomic_long_t rx_dropped; 1557 atomic_long_t rx_dropped;
1550 atomic_long_t tx_dropped; 1558 atomic_long_t tx_dropped;
1551 1559
1552 atomic_t carrier_changes;
1553
1554#ifdef CONFIG_WIRELESS_EXT 1560#ifdef CONFIG_WIRELESS_EXT
1555 const struct iw_handler_def * wireless_handlers; 1561 const struct iw_handler_def * wireless_handlers;
1556 struct iw_public_data * wireless_data; 1562 struct iw_public_data * wireless_data;
1557#endif 1563#endif
1558 const struct net_device_ops *netdev_ops; 1564 const struct net_device_ops *netdev_ops;
1559 const struct ethtool_ops *ethtool_ops; 1565 const struct ethtool_ops *ethtool_ops;
1560 const struct forwarding_accel_ops *fwd_ops; 1566#ifdef CONFIG_NET_SWITCHDEV
1567 const struct swdev_ops *swdev_ops;
1568#endif
1561 1569
1562 const struct header_ops *header_ops; 1570 const struct header_ops *header_ops;
1563 1571
@@ -1588,6 +1596,8 @@ struct net_device {
1588 unsigned short dev_id; 1596 unsigned short dev_id;
1589 unsigned short dev_port; 1597 unsigned short dev_port;
1590 spinlock_t addr_list_lock; 1598 spinlock_t addr_list_lock;
1599 unsigned char name_assign_type;
1600 bool uc_promisc;
1591 struct netdev_hw_addr_list uc; 1601 struct netdev_hw_addr_list uc;
1592 struct netdev_hw_addr_list mc; 1602 struct netdev_hw_addr_list mc;
1593 struct netdev_hw_addr_list dev_addrs; 1603 struct netdev_hw_addr_list dev_addrs;
@@ -1595,10 +1605,6 @@ struct net_device {
1595#ifdef CONFIG_SYSFS 1605#ifdef CONFIG_SYSFS
1596 struct kset *queues_kset; 1606 struct kset *queues_kset;
1597#endif 1607#endif
1598
1599 unsigned char name_assign_type;
1600
1601 bool uc_promisc;
1602 unsigned int promiscuity; 1608 unsigned int promiscuity;
1603 unsigned int allmulti; 1609 unsigned int allmulti;
1604 1610
@@ -1645,7 +1651,10 @@ struct net_device {
1645 1651
1646 struct netdev_queue __rcu *ingress_queue; 1652 struct netdev_queue __rcu *ingress_queue;
1647 unsigned char broadcast[MAX_ADDR_LEN]; 1653 unsigned char broadcast[MAX_ADDR_LEN];
1648 1654#ifdef CONFIG_RFS_ACCEL
1655 struct cpu_rmap *rx_cpu_rmap;
1656#endif
1657 struct hlist_node index_hlist;
1649 1658
1650/* 1659/*
1651 * Cache lines mostly used on transmit path 1660 * Cache lines mostly used on transmit path
@@ -1656,13 +1665,11 @@ struct net_device {
1656 struct Qdisc *qdisc; 1665 struct Qdisc *qdisc;
1657 unsigned long tx_queue_len; 1666 unsigned long tx_queue_len;
1658 spinlock_t tx_global_lock; 1667 spinlock_t tx_global_lock;
1668 int watchdog_timeo;
1659 1669
1660#ifdef CONFIG_XPS 1670#ifdef CONFIG_XPS
1661 struct xps_dev_maps __rcu *xps_maps; 1671 struct xps_dev_maps __rcu *xps_maps;
1662#endif 1672#endif
1663#ifdef CONFIG_RFS_ACCEL
1664 struct cpu_rmap *rx_cpu_rmap;
1665#endif
1666 1673
1667 /* These may be needed for future network-power-down code. */ 1674 /* These may be needed for future network-power-down code. */
1668 1675
@@ -1672,13 +1679,11 @@ struct net_device {
1672 */ 1679 */
1673 unsigned long trans_start; 1680 unsigned long trans_start;
1674 1681
1675 int watchdog_timeo;
1676 struct timer_list watchdog_timer; 1682 struct timer_list watchdog_timer;
1677 1683
1678 int __percpu *pcpu_refcnt; 1684 int __percpu *pcpu_refcnt;
1679 struct list_head todo_list; 1685 struct list_head todo_list;
1680 1686
1681 struct hlist_node index_hlist;
1682 struct list_head link_watch_list; 1687 struct list_head link_watch_list;
1683 1688
1684 enum { NETREG_UNINITIALIZED=0, 1689 enum { NETREG_UNINITIALIZED=0,
@@ -1702,9 +1707,7 @@ struct net_device {
1702 struct netpoll_info __rcu *npinfo; 1707 struct netpoll_info __rcu *npinfo;
1703#endif 1708#endif
1704 1709
1705#ifdef CONFIG_NET_NS 1710 possible_net_t nd_net;
1706 struct net *nd_net;
1707#endif
1708 1711
1709 /* mid-layer private */ 1712 /* mid-layer private */
1710 union { 1713 union {
@@ -1745,8 +1748,6 @@ struct net_device {
1745#endif 1748#endif
1746 struct phy_device *phydev; 1749 struct phy_device *phydev;
1747 struct lock_class_key *qdisc_tx_busylock; 1750 struct lock_class_key *qdisc_tx_busylock;
1748 int group;
1749 struct pm_qos_request pm_qos_req;
1750}; 1751};
1751#define to_net_dev(d) container_of(d, struct net_device, dev) 1752#define to_net_dev(d) container_of(d, struct net_device, dev)
1752 1753
@@ -1844,10 +1845,7 @@ struct net *dev_net(const struct net_device *dev)
1844static inline 1845static inline
1845void dev_net_set(struct net_device *dev, struct net *net) 1846void dev_net_set(struct net_device *dev, struct net *net)
1846{ 1847{
1847#ifdef CONFIG_NET_NS 1848 write_pnet(&dev->nd_net, net);
1848 release_net(dev->nd_net);
1849 dev->nd_net = hold_net(net);
1850#endif
1851} 1849}
1852 1850
1853static inline bool netdev_uses_dsa(struct net_device *dev) 1851static inline bool netdev_uses_dsa(struct net_device *dev)
@@ -2159,6 +2157,7 @@ void __dev_remove_pack(struct packet_type *pt);
2159void dev_add_offload(struct packet_offload *po); 2157void dev_add_offload(struct packet_offload *po);
2160void dev_remove_offload(struct packet_offload *po); 2158void dev_remove_offload(struct packet_offload *po);
2161 2159
2160int dev_get_iflink(const struct net_device *dev);
2162struct net_device *__dev_get_by_flags(struct net *net, unsigned short flags, 2161struct net_device *__dev_get_by_flags(struct net *net, unsigned short flags,
2163 unsigned short mask); 2162 unsigned short mask);
2164struct net_device *dev_get_by_name(struct net *net, const char *name); 2163struct net_device *dev_get_by_name(struct net *net, const char *name);
@@ -2167,9 +2166,14 @@ struct net_device *__dev_get_by_name(struct net *net, const char *name);
2167int dev_alloc_name(struct net_device *dev, const char *name); 2166int dev_alloc_name(struct net_device *dev, const char *name);
2168int dev_open(struct net_device *dev); 2167int dev_open(struct net_device *dev);
2169int dev_close(struct net_device *dev); 2168int dev_close(struct net_device *dev);
2169int dev_close_many(struct list_head *head, bool unlink);
2170void dev_disable_lro(struct net_device *dev); 2170void dev_disable_lro(struct net_device *dev);
2171int dev_loopback_xmit(struct sk_buff *newskb); 2171int dev_loopback_xmit(struct sock *sk, struct sk_buff *newskb);
2172int dev_queue_xmit(struct sk_buff *skb); 2172int dev_queue_xmit_sk(struct sock *sk, struct sk_buff *skb);
2173static inline int dev_queue_xmit(struct sk_buff *skb)
2174{
2175 return dev_queue_xmit_sk(skb->sk, skb);
2176}
2173int dev_queue_xmit_accel(struct sk_buff *skb, void *accel_priv); 2177int dev_queue_xmit_accel(struct sk_buff *skb, void *accel_priv);
2174int register_netdevice(struct net_device *dev); 2178int register_netdevice(struct net_device *dev);
2175void unregister_netdevice_queue(struct net_device *dev, struct list_head *head); 2179void unregister_netdevice_queue(struct net_device *dev, struct list_head *head);
@@ -2409,15 +2413,6 @@ static inline int dev_parse_header(const struct sk_buff *skb,
2409 return dev->header_ops->parse(skb, haddr); 2413 return dev->header_ops->parse(skb, haddr);
2410} 2414}
2411 2415
2412static inline int dev_rebuild_header(struct sk_buff *skb)
2413{
2414 const struct net_device *dev = skb->dev;
2415
2416 if (!dev->header_ops || !dev->header_ops->rebuild)
2417 return 0;
2418 return dev->header_ops->rebuild(skb);
2419}
2420
2421typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); 2416typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len);
2422int register_gifconf(unsigned int family, gifconf_func_t *gifconf); 2417int register_gifconf(unsigned int family, gifconf_func_t *gifconf);
2423static inline int unregister_gifconf(unsigned int family) 2418static inline int unregister_gifconf(unsigned int family)
@@ -2939,7 +2934,11 @@ static inline void dev_consume_skb_any(struct sk_buff *skb)
2939 2934
2940int netif_rx(struct sk_buff *skb); 2935int netif_rx(struct sk_buff *skb);
2941int netif_rx_ni(struct sk_buff *skb); 2936int netif_rx_ni(struct sk_buff *skb);
2942int netif_receive_skb(struct sk_buff *skb); 2937int netif_receive_skb_sk(struct sock *sk, struct sk_buff *skb);
2938static inline int netif_receive_skb(struct sk_buff *skb)
2939{
2940 return netif_receive_skb_sk(skb->sk, skb);
2941}
2943gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb); 2942gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);
2944void napi_gro_flush(struct napi_struct *napi, bool flush_old); 2943void napi_gro_flush(struct napi_struct *napi, bool flush_old);
2945struct sk_buff *napi_get_frags(struct napi_struct *napi); 2944struct sk_buff *napi_get_frags(struct napi_struct *napi);
@@ -2975,6 +2974,8 @@ int dev_set_mac_address(struct net_device *, struct sockaddr *);
2975int dev_change_carrier(struct net_device *, bool new_carrier); 2974int dev_change_carrier(struct net_device *, bool new_carrier);
2976int dev_get_phys_port_id(struct net_device *dev, 2975int dev_get_phys_port_id(struct net_device *dev,
2977 struct netdev_phys_item_id *ppid); 2976 struct netdev_phys_item_id *ppid);
2977int dev_get_phys_port_name(struct net_device *dev,
2978 char *name, size_t len);
2978struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev); 2979struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev);
2979struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, 2980struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2980 struct netdev_queue *txq, int *ret); 2981 struct netdev_queue *txq, int *ret);
@@ -3679,6 +3680,9 @@ void netdev_change_features(struct net_device *dev);
3679void netif_stacked_transfer_operstate(const struct net_device *rootdev, 3680void netif_stacked_transfer_operstate(const struct net_device *rootdev,
3680 struct net_device *dev); 3681 struct net_device *dev);
3681 3682
3683netdev_features_t passthru_features_check(struct sk_buff *skb,
3684 struct net_device *dev,
3685 netdev_features_t features);
3682netdev_features_t netif_skb_features(struct sk_buff *skb); 3686netdev_features_t netif_skb_features(struct sk_buff *skb);
3683 3687
3684static inline bool net_gso_ok(netdev_features_t features, int gso_type) 3688static inline bool net_gso_ok(netdev_features_t features, int gso_type)
@@ -3709,7 +3713,7 @@ static inline bool skb_gso_ok(struct sk_buff *skb, netdev_features_t features)
3709 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); 3713 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
3710} 3714}
3711 3715
3712static inline bool netif_needs_gso(struct net_device *dev, struct sk_buff *skb, 3716static inline bool netif_needs_gso(struct sk_buff *skb,
3713 netdev_features_t features) 3717 netdev_features_t features)
3714{ 3718{
3715 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || 3719 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) ||
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 2517ece98820..63560d0a8dfe 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -44,11 +44,39 @@ int netfilter_init(void);
44struct sk_buff; 44struct sk_buff;
45 45
46struct nf_hook_ops; 46struct nf_hook_ops;
47
48struct sock;
49
50struct nf_hook_state {
51 unsigned int hook;
52 int thresh;
53 u_int8_t pf;
54 struct net_device *in;
55 struct net_device *out;
56 struct sock *sk;
57 int (*okfn)(struct sock *, struct sk_buff *);
58};
59
60static inline void nf_hook_state_init(struct nf_hook_state *p,
61 unsigned int hook,
62 int thresh, u_int8_t pf,
63 struct net_device *indev,
64 struct net_device *outdev,
65 struct sock *sk,
66 int (*okfn)(struct sock *, struct sk_buff *))
67{
68 p->hook = hook;
69 p->thresh = thresh;
70 p->pf = pf;
71 p->in = indev;
72 p->out = outdev;
73 p->sk = sk;
74 p->okfn = okfn;
75}
76
47typedef unsigned int nf_hookfn(const struct nf_hook_ops *ops, 77typedef unsigned int nf_hookfn(const struct nf_hook_ops *ops,
48 struct sk_buff *skb, 78 struct sk_buff *skb,
49 const struct net_device *in, 79 const struct nf_hook_state *state);
50 const struct net_device *out,
51 int (*okfn)(struct sk_buff *));
52 80
53struct nf_hook_ops { 81struct nf_hook_ops {
54 struct list_head list; 82 struct list_head list;
@@ -118,9 +146,7 @@ static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
118} 146}
119#endif 147#endif
120 148
121int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb, 149int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state);
122 struct net_device *indev, struct net_device *outdev,
123 int (*okfn)(struct sk_buff *), int thresh);
124 150
125/** 151/**
126 * nf_hook_thresh - call a netfilter hook 152 * nf_hook_thresh - call a netfilter hook
@@ -130,21 +156,29 @@ int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
130 * value indicates the packet has been consumed by the hook. 156 * value indicates the packet has been consumed by the hook.
131 */ 157 */
132static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook, 158static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
159 struct sock *sk,
133 struct sk_buff *skb, 160 struct sk_buff *skb,
134 struct net_device *indev, 161 struct net_device *indev,
135 struct net_device *outdev, 162 struct net_device *outdev,
136 int (*okfn)(struct sk_buff *), int thresh) 163 int (*okfn)(struct sock *, struct sk_buff *),
164 int thresh)
137{ 165{
138 if (nf_hooks_active(pf, hook)) 166 if (nf_hooks_active(pf, hook)) {
139 return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh); 167 struct nf_hook_state state;
168
169 nf_hook_state_init(&state, hook, thresh, pf,
170 indev, outdev, sk, okfn);
171 return nf_hook_slow(skb, &state);
172 }
140 return 1; 173 return 1;
141} 174}
142 175
143static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, 176static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sock *sk,
144 struct net_device *indev, struct net_device *outdev, 177 struct sk_buff *skb, struct net_device *indev,
145 int (*okfn)(struct sk_buff *)) 178 struct net_device *outdev,
179 int (*okfn)(struct sock *, struct sk_buff *))
146{ 180{
147 return nf_hook_thresh(pf, hook, skb, indev, outdev, okfn, INT_MIN); 181 return nf_hook_thresh(pf, hook, sk, skb, indev, outdev, okfn, INT_MIN);
148} 182}
149 183
150/* Activate hook; either okfn or kfree_skb called, unless a hook 184/* Activate hook; either okfn or kfree_skb called, unless a hook
@@ -165,35 +199,36 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
165*/ 199*/
166 200
167static inline int 201static inline int
168NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sk_buff *skb, 202NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sock *sk,
169 struct net_device *in, struct net_device *out, 203 struct sk_buff *skb, struct net_device *in,
170 int (*okfn)(struct sk_buff *), int thresh) 204 struct net_device *out,
205 int (*okfn)(struct sock *, struct sk_buff *), int thresh)
171{ 206{
172 int ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, thresh); 207 int ret = nf_hook_thresh(pf, hook, sk, skb, in, out, okfn, thresh);
173 if (ret == 1) 208 if (ret == 1)
174 ret = okfn(skb); 209 ret = okfn(sk, skb);
175 return ret; 210 return ret;
176} 211}
177 212
178static inline int 213static inline int
179NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sk_buff *skb, 214NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sock *sk,
180 struct net_device *in, struct net_device *out, 215 struct sk_buff *skb, struct net_device *in, struct net_device *out,
181 int (*okfn)(struct sk_buff *), bool cond) 216 int (*okfn)(struct sock *, struct sk_buff *), bool cond)
182{ 217{
183 int ret; 218 int ret;
184 219
185 if (!cond || 220 if (!cond ||
186 ((ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, INT_MIN)) == 1)) 221 ((ret = nf_hook_thresh(pf, hook, sk, skb, in, out, okfn, INT_MIN)) == 1))
187 ret = okfn(skb); 222 ret = okfn(sk, skb);
188 return ret; 223 return ret;
189} 224}
190 225
191static inline int 226static inline int
192NF_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb, 227NF_HOOK(uint8_t pf, unsigned int hook, struct sock *sk, struct sk_buff *skb,
193 struct net_device *in, struct net_device *out, 228 struct net_device *in, struct net_device *out,
194 int (*okfn)(struct sk_buff *)) 229 int (*okfn)(struct sock *, struct sk_buff *))
195{ 230{
196 return NF_HOOK_THRESH(pf, hook, skb, in, out, okfn, INT_MIN); 231 return NF_HOOK_THRESH(pf, hook, sk, skb, in, out, okfn, INT_MIN);
197} 232}
198 233
199/* Call setsockopt() */ 234/* Call setsockopt() */
@@ -293,19 +328,21 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
293} 328}
294 329
295#else /* !CONFIG_NETFILTER */ 330#else /* !CONFIG_NETFILTER */
296#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) 331#define NF_HOOK(pf, hook, sk, skb, indev, outdev, okfn) (okfn)(sk, skb)
297#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb) 332#define NF_HOOK_COND(pf, hook, sk, skb, indev, outdev, okfn, cond) (okfn)(sk, skb)
298static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook, 333static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
334 struct sock *sk,
299 struct sk_buff *skb, 335 struct sk_buff *skb,
300 struct net_device *indev, 336 struct net_device *indev,
301 struct net_device *outdev, 337 struct net_device *outdev,
302 int (*okfn)(struct sk_buff *), int thresh) 338 int (*okfn)(struct sock *sk, struct sk_buff *), int thresh)
303{ 339{
304 return okfn(skb); 340 return okfn(sk, skb);
305} 341}
306static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, 342static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sock *sk,
307 struct net_device *indev, struct net_device *outdev, 343 struct sk_buff *skb, struct net_device *indev,
308 int (*okfn)(struct sk_buff *)) 344 struct net_device *outdev,
345 int (*okfn)(struct sock *, struct sk_buff *))
309{ 346{
310 return 1; 347 return 1;
311} 348}
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index f1606fa6132d..34b172301558 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -483,7 +483,7 @@ static inline int nla_put_ipaddr4(struct sk_buff *skb, int type, __be32 ipaddr)
483 483
484 if (!__nested) 484 if (!__nested)
485 return -EMSGSIZE; 485 return -EMSGSIZE;
486 ret = nla_put_net32(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr); 486 ret = nla_put_in_addr(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr);
487 if (!ret) 487 if (!ret)
488 ipset_nest_end(skb, __nested); 488 ipset_nest_end(skb, __nested);
489 return ret; 489 return ret;
@@ -497,8 +497,7 @@ static inline int nla_put_ipaddr6(struct sk_buff *skb, int type,
497 497
498 if (!__nested) 498 if (!__nested)
499 return -EMSGSIZE; 499 return -EMSGSIZE;
500 ret = nla_put(skb, IPSET_ATTR_IPADDR_IPV6, 500 ret = nla_put_in6_addr(skb, IPSET_ATTR_IPADDR_IPV6, ipaddrptr);
501 sizeof(struct in6_addr), ipaddrptr);
502 if (!ret) 501 if (!ret)
503 ipset_nest_end(skb, __nested); 502 ipset_nest_end(skb, __nested);
504 return ret; 503 return ret;
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index cfb7191e6efa..c22a7fb8d0df 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -54,8 +54,7 @@ extern struct xt_table *arpt_register_table(struct net *net,
54extern void arpt_unregister_table(struct xt_table *table); 54extern void arpt_unregister_table(struct xt_table *table);
55extern unsigned int arpt_do_table(struct sk_buff *skb, 55extern unsigned int arpt_do_table(struct sk_buff *skb,
56 unsigned int hook, 56 unsigned int hook,
57 const struct net_device *in, 57 const struct nf_hook_state *state,
58 const struct net_device *out,
59 struct xt_table *table); 58 struct xt_table *table);
60 59
61#ifdef CONFIG_COMPAT 60#ifdef CONFIG_COMPAT
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index c755e4971fa3..ab8f76dba668 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -2,7 +2,7 @@
2#define __LINUX_BRIDGE_NETFILTER_H 2#define __LINUX_BRIDGE_NETFILTER_H
3 3
4#include <uapi/linux/netfilter_bridge.h> 4#include <uapi/linux/netfilter_bridge.h>
5 5#include <linux/skbuff.h>
6 6
7enum nf_br_hook_priorities { 7enum nf_br_hook_priorities {
8 NF_BR_PRI_FIRST = INT_MIN, 8 NF_BR_PRI_FIRST = INT_MIN,
@@ -17,110 +17,48 @@ enum nf_br_hook_priorities {
17 17
18#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) 18#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
19 19
20#define BRNF_PKT_TYPE 0x01
21#define BRNF_BRIDGED_DNAT 0x02 20#define BRNF_BRIDGED_DNAT 0x02
22#define BRNF_BRIDGED 0x04
23#define BRNF_NF_BRIDGE_PREROUTING 0x08 21#define BRNF_NF_BRIDGE_PREROUTING 0x08
24#define BRNF_8021Q 0x10
25#define BRNF_PPPoE 0x20
26 22
27static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb) 23static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
28{ 24{
29 switch (skb->protocol) { 25 if (skb->nf_bridge->orig_proto == BRNF_PROTO_PPPOE)
30 case __cpu_to_be16(ETH_P_8021Q):
31 return VLAN_HLEN;
32 case __cpu_to_be16(ETH_P_PPP_SES):
33 return PPPOE_SES_HLEN; 26 return PPPOE_SES_HLEN;
34 default: 27 return 0;
35 return 0;
36 }
37} 28}
38 29
39static inline void nf_bridge_update_protocol(struct sk_buff *skb) 30int br_handle_frame_finish(struct sock *sk, struct sk_buff *skb);
40{
41 if (skb->nf_bridge->mask & BRNF_8021Q)
42 skb->protocol = htons(ETH_P_8021Q);
43 else if (skb->nf_bridge->mask & BRNF_PPPoE)
44 skb->protocol = htons(ETH_P_PPP_SES);
45}
46 31
47/* Fill in the header for fragmented IP packets handled by 32static inline void br_drop_fake_rtable(struct sk_buff *skb)
48 * the IPv4 connection tracking code.
49 *
50 * Only used in br_forward.c
51 */
52static inline int nf_bridge_copy_header(struct sk_buff *skb)
53{ 33{
54 int err; 34 struct dst_entry *dst = skb_dst(skb);
55 unsigned int header_size;
56
57 nf_bridge_update_protocol(skb);
58 header_size = ETH_HLEN + nf_bridge_encap_header_len(skb);
59 err = skb_cow_head(skb, header_size);
60 if (err)
61 return err;
62 35
63 skb_copy_to_linear_data_offset(skb, -header_size, 36 if (dst && (dst->flags & DST_FAKE_RTABLE))
64 skb->nf_bridge->data, header_size); 37 skb_dst_drop(skb);
65 __skb_push(skb, nf_bridge_encap_header_len(skb));
66 return 0;
67} 38}
68 39
69static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb) 40static inline int nf_bridge_get_physinif(const struct sk_buff *skb)
70{ 41{
71 if (skb->nf_bridge && 42 return skb->nf_bridge ? skb->nf_bridge->physindev->ifindex : 0;
72 skb->nf_bridge->mask & (BRNF_BRIDGED | BRNF_BRIDGED_DNAT))
73 return nf_bridge_copy_header(skb);
74 return 0;
75} 43}
76 44
77static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb) 45static inline int nf_bridge_get_physoutif(const struct sk_buff *skb)
78{ 46{
79 if (unlikely(skb->nf_bridge->mask & BRNF_PPPoE)) 47 return skb->nf_bridge ? skb->nf_bridge->physoutdev->ifindex : 0;
80 return PPPOE_SES_HLEN;
81 return 0;
82} 48}
83 49
84int br_handle_frame_finish(struct sk_buff *skb); 50static inline struct net_device *
85/* Only used in br_device.c */ 51nf_bridge_get_physindev(const struct sk_buff *skb)
86static inline int br_nf_pre_routing_finish_bridge_slow(struct sk_buff *skb)
87{ 52{
88 struct nf_bridge_info *nf_bridge = skb->nf_bridge; 53 return skb->nf_bridge ? skb->nf_bridge->physindev : NULL;
89
90 skb_pull(skb, ETH_HLEN);
91 nf_bridge->mask ^= BRNF_BRIDGED_DNAT;
92 skb_copy_to_linear_data_offset(skb, -(ETH_HLEN-ETH_ALEN),
93 skb->nf_bridge->data, ETH_HLEN-ETH_ALEN);
94 skb->dev = nf_bridge->physindev;
95 return br_handle_frame_finish(skb);
96} 54}
97 55
98/* This is called by the IP fragmenting code and it ensures there is 56static inline struct net_device *
99 * enough room for the encapsulating header (if there is one). */ 57nf_bridge_get_physoutdev(const struct sk_buff *skb)
100static inline unsigned int nf_bridge_pad(const struct sk_buff *skb)
101{ 58{
102 if (skb->nf_bridge) 59 return skb->nf_bridge ? skb->nf_bridge->physoutdev : NULL;
103 return nf_bridge_encap_header_len(skb);
104 return 0;
105} 60}
106
107struct bridge_skb_cb {
108 union {
109 __be32 ipv4;
110 } daddr;
111};
112
113static inline void br_drop_fake_rtable(struct sk_buff *skb)
114{
115 struct dst_entry *dst = skb_dst(skb);
116
117 if (dst && (dst->flags & DST_FAKE_RTABLE))
118 skb_dst_drop(skb);
119}
120
121#else 61#else
122#define nf_bridge_maybe_copy_header(skb) (0)
123#define nf_bridge_pad(skb) (0)
124#define br_drop_fake_rtable(skb) do { } while (0) 62#define br_drop_fake_rtable(skb) do { } while (0)
125#endif /* CONFIG_BRIDGE_NETFILTER */ 63#endif /* CONFIG_BRIDGE_NETFILTER */
126 64
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index 34e7a2b7f867..f1bd3962e6b6 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -12,9 +12,10 @@
12#ifndef __LINUX_BRIDGE_EFF_H 12#ifndef __LINUX_BRIDGE_EFF_H
13#define __LINUX_BRIDGE_EFF_H 13#define __LINUX_BRIDGE_EFF_H
14 14
15#include <linux/if.h>
16#include <linux/if_ether.h>
15#include <uapi/linux/netfilter_bridge/ebtables.h> 17#include <uapi/linux/netfilter_bridge/ebtables.h>
16 18
17
18/* return values for match() functions */ 19/* return values for match() functions */
19#define EBT_MATCH 0 20#define EBT_MATCH 0
20#define EBT_NOMATCH 1 21#define EBT_NOMATCH 1
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 901e84db847d..4073510da485 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -65,8 +65,7 @@ struct ipt_error {
65extern void *ipt_alloc_initial_table(const struct xt_table *); 65extern void *ipt_alloc_initial_table(const struct xt_table *);
66extern unsigned int ipt_do_table(struct sk_buff *skb, 66extern unsigned int ipt_do_table(struct sk_buff *skb,
67 unsigned int hook, 67 unsigned int hook,
68 const struct net_device *in, 68 const struct nf_hook_state *state,
69 const struct net_device *out,
70 struct xt_table *table); 69 struct xt_table *table);
71 70
72#ifdef CONFIG_COMPAT 71#ifdef CONFIG_COMPAT
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 610208b18c05..b40d2b635778 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -31,8 +31,7 @@ extern struct xt_table *ip6t_register_table(struct net *net,
31extern void ip6t_unregister_table(struct net *net, struct xt_table *table); 31extern void ip6t_unregister_table(struct net *net, struct xt_table *table);
32extern unsigned int ip6t_do_table(struct sk_buff *skb, 32extern unsigned int ip6t_do_table(struct sk_buff *skb,
33 unsigned int hook, 33 unsigned int hook,
34 const struct net_device *in, 34 const struct nf_hook_state *state,
35 const struct net_device *out,
36 struct xt_table *table); 35 struct xt_table *table);
37 36
38/* Check for an extension */ 37/* Check for an extension */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 02fc86d2348e..6835c1279df7 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -134,7 +134,7 @@ struct netlink_callback {
134 134
135struct netlink_notify { 135struct netlink_notify {
136 struct net *net; 136 struct net *net;
137 int portid; 137 u32 portid;
138 int protocol; 138 int protocol;
139}; 139};
140 140
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index b01ccf371fdc..410abd172feb 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -447,13 +447,12 @@ static inline struct rpc_cred *nfs_file_cred(struct file *file)
447/* 447/*
448 * linux/fs/nfs/direct.c 448 * linux/fs/nfs/direct.c
449 */ 449 */
450extern ssize_t nfs_direct_IO(int, struct kiocb *, struct iov_iter *, loff_t); 450extern ssize_t nfs_direct_IO(struct kiocb *, struct iov_iter *, loff_t);
451extern ssize_t nfs_file_direct_read(struct kiocb *iocb, 451extern ssize_t nfs_file_direct_read(struct kiocb *iocb,
452 struct iov_iter *iter, 452 struct iov_iter *iter,
453 loff_t pos); 453 loff_t pos);
454extern ssize_t nfs_file_direct_write(struct kiocb *iocb, 454extern ssize_t nfs_file_direct_write(struct kiocb *iocb,
455 struct iov_iter *iter, 455 struct iov_iter *iter);
456 loff_t pos);
457 456
458/* 457/*
459 * linux/fs/nfs/dir.c 458 * linux/fs/nfs/dir.c
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 9b2022ab4d85..3d46fb4708e0 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -25,16 +25,11 @@ static inline void touch_nmi_watchdog(void)
25#endif 25#endif
26 26
27#if defined(CONFIG_HARDLOCKUP_DETECTOR) 27#if defined(CONFIG_HARDLOCKUP_DETECTOR)
28extern void watchdog_enable_hardlockup_detector(bool val); 28extern void hardlockup_detector_disable(void);
29extern bool watchdog_hardlockup_detector_is_enabled(void);
30#else 29#else
31static inline void watchdog_enable_hardlockup_detector(bool val) 30static inline void hardlockup_detector_disable(void)
32{ 31{
33} 32}
34static inline bool watchdog_hardlockup_detector_is_enabled(void)
35{
36 return true;
37}
38#endif 33#endif
39 34
40/* 35/*
@@ -68,12 +63,20 @@ static inline bool trigger_allbutself_cpu_backtrace(void)
68#ifdef CONFIG_LOCKUP_DETECTOR 63#ifdef CONFIG_LOCKUP_DETECTOR
69int hw_nmi_is_cpu_stuck(struct pt_regs *); 64int hw_nmi_is_cpu_stuck(struct pt_regs *);
70u64 hw_nmi_get_sample_period(int watchdog_thresh); 65u64 hw_nmi_get_sample_period(int watchdog_thresh);
66extern int nmi_watchdog_enabled;
67extern int soft_watchdog_enabled;
71extern int watchdog_user_enabled; 68extern int watchdog_user_enabled;
72extern int watchdog_thresh; 69extern int watchdog_thresh;
73extern int sysctl_softlockup_all_cpu_backtrace; 70extern int sysctl_softlockup_all_cpu_backtrace;
74struct ctl_table; 71struct ctl_table;
75extern int proc_dowatchdog(struct ctl_table *, int , 72extern int proc_watchdog(struct ctl_table *, int ,
76 void __user *, size_t *, loff_t *); 73 void __user *, size_t *, loff_t *);
74extern int proc_nmi_watchdog(struct ctl_table *, int ,
75 void __user *, size_t *, loff_t *);
76extern int proc_soft_watchdog(struct ctl_table *, int ,
77 void __user *, size_t *, loff_t *);
78extern int proc_watchdog_thresh(struct ctl_table *, int ,
79 void __user *, size_t *, loff_t *);
77#endif 80#endif
78 81
79#ifdef CONFIG_HAVE_ACPI_APEI_NMI 82#ifdef CONFIG_HAVE_ACPI_APEI_NMI
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 0adad4a5419b..8dbd05e70f09 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -117,8 +117,9 @@ struct nvme_ns {
117 117
118 unsigned ns_id; 118 unsigned ns_id;
119 int lba_shift; 119 int lba_shift;
120 int ms; 120 u16 ms;
121 int pi_type; 121 bool ext;
122 u8 pi_type;
122 u64 mode_select_num_blocks; 123 u64 mode_select_num_blocks;
123 u32 mode_select_block_len; 124 u32 mode_select_block_len;
124}; 125};
diff --git a/include/linux/of.h b/include/linux/of.h
index dfde07e77a63..5f124f685e07 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -332,6 +332,7 @@ extern int of_count_phandle_with_args(const struct device_node *np,
332 332
333extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); 333extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
334extern int of_alias_get_id(struct device_node *np, const char *stem); 334extern int of_alias_get_id(struct device_node *np, const char *stem);
335extern int of_alias_get_highest_id(const char *stem);
335 336
336extern int of_machine_is_compatible(const char *compat); 337extern int of_machine_is_compatible(const char *compat);
337 338
@@ -594,6 +595,11 @@ static inline int of_alias_get_id(struct device_node *np, const char *stem)
594 return -ENOSYS; 595 return -ENOSYS;
595} 596}
596 597
598static inline int of_alias_get_highest_id(const char *stem)
599{
600 return -ENOSYS;
601}
602
597static inline int of_machine_is_compatible(const char *compat) 603static inline int of_machine_is_compatible(const char *compat)
598{ 604{
599 return 0; 605 return 0;
@@ -616,6 +622,38 @@ static inline const char *of_prop_next_string(struct property *prop,
616 return NULL; 622 return NULL;
617} 623}
618 624
625static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
626{
627 return 0;
628}
629
630static inline int of_node_test_and_set_flag(struct device_node *n,
631 unsigned long flag)
632{
633 return 0;
634}
635
636static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
637{
638}
639
640static inline void of_node_clear_flag(struct device_node *n, unsigned long flag)
641{
642}
643
644static inline int of_property_check_flag(struct property *p, unsigned long flag)
645{
646 return 0;
647}
648
649static inline void of_property_set_flag(struct property *p, unsigned long flag)
650{
651}
652
653static inline void of_property_clear_flag(struct property *p, unsigned long flag)
654{
655}
656
619#define of_match_ptr(_ptr) NULL 657#define of_match_ptr(_ptr) NULL
620#define of_match_node(_matches, _node) NULL 658#define of_match_node(_matches, _node) NULL
621#endif /* CONFIG_OF */ 659#endif /* CONFIG_OF */
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index ef370210ffb2..22801b10cef5 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -53,6 +53,7 @@ static inline struct device_node *of_cpu_device_node_get(int cpu)
53 return of_node_get(cpu_dev->of_node); 53 return of_node_get(cpu_dev->of_node);
54} 54}
55 55
56void of_dma_configure(struct device *dev, struct device_node *np);
56#else /* CONFIG_OF */ 57#else /* CONFIG_OF */
57 58
58static inline int of_driver_match_device(struct device *dev, 59static inline int of_driver_match_device(struct device *dev,
@@ -90,6 +91,8 @@ static inline struct device_node *of_cpu_device_node_get(int cpu)
90{ 91{
91 return NULL; 92 return NULL;
92} 93}
94static inline void of_dma_configure(struct device *dev, struct device_node *np)
95{}
93#endif /* CONFIG_OF */ 96#endif /* CONFIG_OF */
94 97
95#endif /* _LINUX_OF_DEVICE_H */ 98#endif /* _LINUX_OF_DEVICE_H */
diff --git a/include/linux/of_iommu.h b/include/linux/of_iommu.h
index 16c75547d725..ffbe4707d4aa 100644
--- a/include/linux/of_iommu.h
+++ b/include/linux/of_iommu.h
@@ -12,7 +12,8 @@ extern int of_get_dma_window(struct device_node *dn, const char *prefix,
12 size_t *size); 12 size_t *size);
13 13
14extern void of_iommu_init(void); 14extern void of_iommu_init(void);
15extern struct iommu_ops *of_iommu_configure(struct device *dev); 15extern struct iommu_ops *of_iommu_configure(struct device *dev,
16 struct device_node *master_np);
16 17
17#else 18#else
18 19
@@ -24,7 +25,8 @@ static inline int of_get_dma_window(struct device_node *dn, const char *prefix,
24} 25}
25 26
26static inline void of_iommu_init(void) { } 27static inline void of_iommu_init(void) { }
27static inline struct iommu_ops *of_iommu_configure(struct device *dev) 28static inline struct iommu_ops *of_iommu_configure(struct device *dev,
29 struct device_node *master_np)
28{ 30{
29 return NULL; 31 return NULL;
30} 32}
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index d449018d0726..8f2237eb3485 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -24,6 +24,7 @@ struct phy_device *of_phy_attach(struct net_device *dev,
24 phy_interface_t iface); 24 phy_interface_t iface);
25 25
26extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); 26extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
27extern int of_mdio_parse_addr(struct device *dev, const struct device_node *np);
27 28
28#else /* CONFIG_OF */ 29#else /* CONFIG_OF */
29static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) 30static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
@@ -60,6 +61,12 @@ static inline struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np)
60{ 61{
61 return NULL; 62 return NULL;
62} 63}
64
65static inline int of_mdio_parse_addr(struct device *dev,
66 const struct device_node *np)
67{
68 return -ENOSYS;
69}
63#endif /* CONFIG_OF */ 70#endif /* CONFIG_OF */
64 71
65#if defined(CONFIG_OF) && defined(CONFIG_FIXED_PHY) 72#if defined(CONFIG_OF) && defined(CONFIG_FIXED_PHY)
diff --git a/include/linux/of_net.h b/include/linux/of_net.h
index 34597c8c1a4c..9cd72aab76fe 100644
--- a/include/linux/of_net.h
+++ b/include/linux/of_net.h
@@ -9,8 +9,11 @@
9 9
10#ifdef CONFIG_OF_NET 10#ifdef CONFIG_OF_NET
11#include <linux/of.h> 11#include <linux/of.h>
12
13struct net_device;
12extern int of_get_phy_mode(struct device_node *np); 14extern int of_get_phy_mode(struct device_node *np);
13extern const void *of_get_mac_address(struct device_node *np); 15extern const void *of_get_mac_address(struct device_node *np);
16extern struct net_device *of_find_net_device_by_node(struct device_node *np);
14#else 17#else
15static inline int of_get_phy_mode(struct device_node *np) 18static inline int of_get_phy_mode(struct device_node *np)
16{ 19{
@@ -21,6 +24,11 @@ static inline const void *of_get_mac_address(struct device_node *np)
21{ 24{
22 return NULL; 25 return NULL;
23} 26}
27
28static inline struct net_device *of_find_net_device_by_node(struct device_node *np)
29{
30 return NULL;
31}
24#endif 32#endif
25 33
26#endif /* __LINUX_OF_NET_H */ 34#endif /* __LINUX_OF_NET_H */
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index ce0e5abeb454..29fd3fe1c035 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -16,6 +16,7 @@ int of_pci_get_devfn(struct device_node *np);
16int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin); 16int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin);
17int of_pci_parse_bus_range(struct device_node *node, struct resource *res); 17int of_pci_parse_bus_range(struct device_node *node, struct resource *res);
18int of_get_pci_domain_nr(struct device_node *node); 18int of_get_pci_domain_nr(struct device_node *node);
19void of_pci_dma_configure(struct pci_dev *pci_dev);
19#else 20#else
20static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) 21static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq)
21{ 22{
@@ -50,6 +51,8 @@ of_get_pci_domain_nr(struct device_node *node)
50{ 51{
51 return -1; 52 return -1;
52} 53}
54
55static inline void of_pci_dma_configure(struct pci_dev *pci_dev) { }
53#endif 56#endif
54 57
55#if defined(CONFIG_OF_ADDRESS) 58#if defined(CONFIG_OF_ADDRESS)
diff --git a/include/linux/oom.h b/include/linux/oom.h
index d5771bed59c9..44b2f6f7bbd8 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -66,7 +66,8 @@ extern bool oom_zonelist_trylock(struct zonelist *zonelist, gfp_t gfp_flags);
66extern void oom_zonelist_unlock(struct zonelist *zonelist, gfp_t gfp_flags); 66extern void oom_zonelist_unlock(struct zonelist *zonelist, gfp_t gfp_flags);
67 67
68extern void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask, 68extern void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask,
69 int order, const nodemask_t *nodemask); 69 int order, const nodemask_t *nodemask,
70 struct mem_cgroup *memcg);
70 71
71extern enum oom_scan_t oom_scan_process_thread(struct task_struct *task, 72extern enum oom_scan_t oom_scan_process_thread(struct task_struct *task,
72 unsigned long totalpages, const nodemask_t *nodemask, 73 unsigned long totalpages, const nodemask_t *nodemask,
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 5ed7bdaf22d5..f34e040b34e9 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -289,6 +289,47 @@ PAGEFLAG_FALSE(HWPoison)
289#define __PG_HWPOISON 0 289#define __PG_HWPOISON 0
290#endif 290#endif
291 291
292/*
293 * On an anonymous page mapped into a user virtual memory area,
294 * page->mapping points to its anon_vma, not to a struct address_space;
295 * with the PAGE_MAPPING_ANON bit set to distinguish it. See rmap.h.
296 *
297 * On an anonymous page in a VM_MERGEABLE area, if CONFIG_KSM is enabled,
298 * the PAGE_MAPPING_KSM bit may be set along with the PAGE_MAPPING_ANON bit;
299 * and then page->mapping points, not to an anon_vma, but to a private
300 * structure which KSM associates with that merged page. See ksm.h.
301 *
302 * PAGE_MAPPING_KSM without PAGE_MAPPING_ANON is currently never used.
303 *
304 * Please note that, confusingly, "page_mapping" refers to the inode
305 * address_space which maps the page from disk; whereas "page_mapped"
306 * refers to user virtual address space into which the page is mapped.
307 */
308#define PAGE_MAPPING_ANON 1
309#define PAGE_MAPPING_KSM 2
310#define PAGE_MAPPING_FLAGS (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM)
311
312static inline int PageAnon(struct page *page)
313{
314 return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0;
315}
316
317#ifdef CONFIG_KSM
318/*
319 * A KSM page is one of those write-protected "shared pages" or "merged pages"
320 * which KSM maps into multiple mms, wherever identical anonymous page content
321 * is found in VM_MERGEABLE vmas. It's a PageAnon page, pointing not to any
322 * anon_vma, but to that page's node of the stable tree.
323 */
324static inline int PageKsm(struct page *page)
325{
326 return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) ==
327 (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM);
328}
329#else
330TESTPAGEFLAG_FALSE(Ksm)
331#endif
332
292u64 stable_page_flags(struct page *page); 333u64 stable_page_flags(struct page *page);
293 334
294static inline int PageUptodate(struct page *page) 335static inline int PageUptodate(struct page *page)
@@ -328,8 +369,6 @@ static inline void SetPageUptodate(struct page *page)
328 369
329CLEARPAGEFLAG(Uptodate, uptodate) 370CLEARPAGEFLAG(Uptodate, uptodate)
330 371
331extern void cancel_dirty_page(struct page *page, unsigned int account_size);
332
333int test_clear_page_writeback(struct page *page); 372int test_clear_page_writeback(struct page *page);
334int __test_set_page_writeback(struct page *page, bool keep_write); 373int __test_set_page_writeback(struct page *page, bool keep_write);
335 374
@@ -428,6 +467,21 @@ static inline void ClearPageCompound(struct page *page)
428 467
429#endif /* !PAGEFLAGS_EXTENDED */ 468#endif /* !PAGEFLAGS_EXTENDED */
430 469
470#ifdef CONFIG_HUGETLB_PAGE
471int PageHuge(struct page *page);
472int PageHeadHuge(struct page *page);
473bool page_huge_active(struct page *page);
474#else
475TESTPAGEFLAG_FALSE(Huge)
476TESTPAGEFLAG_FALSE(HeadHuge)
477
478static inline bool page_huge_active(struct page *page)
479{
480 return 0;
481}
482#endif
483
484
431#ifdef CONFIG_TRANSPARENT_HUGEPAGE 485#ifdef CONFIG_TRANSPARENT_HUGEPAGE
432/* 486/*
433 * PageHuge() only returns true for hugetlbfs pages, but not for 487 * PageHuge() only returns true for hugetlbfs pages, but not for
@@ -482,6 +536,53 @@ static inline int PageTransTail(struct page *page)
482#endif 536#endif
483 537
484/* 538/*
539 * PageBuddy() indicate that the page is free and in the buddy system
540 * (see mm/page_alloc.c).
541 *
542 * PAGE_BUDDY_MAPCOUNT_VALUE must be <= -2 but better not too close to
543 * -2 so that an underflow of the page_mapcount() won't be mistaken
544 * for a genuine PAGE_BUDDY_MAPCOUNT_VALUE. -128 can be created very
545 * efficiently by most CPU architectures.
546 */
547#define PAGE_BUDDY_MAPCOUNT_VALUE (-128)
548
549static inline int PageBuddy(struct page *page)
550{
551 return atomic_read(&page->_mapcount) == PAGE_BUDDY_MAPCOUNT_VALUE;
552}
553
554static inline void __SetPageBuddy(struct page *page)
555{
556 VM_BUG_ON_PAGE(atomic_read(&page->_mapcount) != -1, page);
557 atomic_set(&page->_mapcount, PAGE_BUDDY_MAPCOUNT_VALUE);
558}
559
560static inline void __ClearPageBuddy(struct page *page)
561{
562 VM_BUG_ON_PAGE(!PageBuddy(page), page);
563 atomic_set(&page->_mapcount, -1);
564}
565
566#define PAGE_BALLOON_MAPCOUNT_VALUE (-256)
567
568static inline int PageBalloon(struct page *page)
569{
570 return atomic_read(&page->_mapcount) == PAGE_BALLOON_MAPCOUNT_VALUE;
571}
572
573static inline void __SetPageBalloon(struct page *page)
574{
575 VM_BUG_ON_PAGE(atomic_read(&page->_mapcount) != -1, page);
576 atomic_set(&page->_mapcount, PAGE_BALLOON_MAPCOUNT_VALUE);
577}
578
579static inline void __ClearPageBalloon(struct page *page)
580{
581 VM_BUG_ON_PAGE(!PageBalloon(page), page);
582 atomic_set(&page->_mapcount, -1);
583}
584
585/*
485 * If network-based swap is enabled, sl*b must keep track of whether pages 586 * If network-based swap is enabled, sl*b must keep track of whether pages
486 * were allocated from pfmemalloc reserves. 587 * were allocated from pfmemalloc reserves.
487 */ 588 */
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 24c7728ca681..a965efa52152 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -77,6 +77,11 @@ static inline void acpiphp_remove_slots(struct pci_bus *bus) { }
77static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { } 77static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { }
78#endif 78#endif
79 79
80extern const u8 pci_acpi_dsm_uuid[];
81#define DEVICE_LABEL_DSM 0x07
82#define RESET_DELAY_DSM 0x08
83#define FUNCTION_DELAY_DSM 0x09
84
80#else /* CONFIG_ACPI */ 85#else /* CONFIG_ACPI */
81static inline void acpi_pci_add_bus(struct pci_bus *bus) { } 86static inline void acpi_pci_add_bus(struct pci_bus *bus) { }
82static inline void acpi_pci_remove_bus(struct pci_bus *bus) { } 87static inline void acpi_pci_remove_bus(struct pci_bus *bus) { }
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
index 8af4610c2e41..207c561fb40e 100644
--- a/include/linux/pci-aspm.h
+++ b/include/linux/pci-aspm.h
@@ -29,7 +29,6 @@ void pcie_aspm_pm_state_change(struct pci_dev *pdev);
29void pcie_aspm_powersave_config_link(struct pci_dev *pdev); 29void pcie_aspm_powersave_config_link(struct pci_dev *pdev);
30void pci_disable_link_state(struct pci_dev *pdev, int state); 30void pci_disable_link_state(struct pci_dev *pdev, int state);
31void pci_disable_link_state_locked(struct pci_dev *pdev, int state); 31void pci_disable_link_state_locked(struct pci_dev *pdev, int state);
32void pcie_clear_aspm(struct pci_bus *bus);
33void pcie_no_aspm(void); 32void pcie_no_aspm(void);
34#else 33#else
35static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) 34static inline void pcie_aspm_init_link_state(struct pci_dev *pdev)
@@ -47,9 +46,6 @@ 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) 46static inline void pci_disable_link_state(struct pci_dev *pdev, int state)
48{ 47{
49} 48}
50static inline void pcie_clear_aspm(struct pci_bus *bus)
51{
52}
53static inline void pcie_no_aspm(void) 49static inline void pcie_no_aspm(void)
54{ 50{
55} 51}
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 211e9da8a7d7..353db8dc4c6e 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -406,6 +406,7 @@ struct pci_host_bridge {
406 struct list_head windows; /* resource_entry */ 406 struct list_head windows; /* resource_entry */
407 void (*release_fn)(struct pci_host_bridge *); 407 void (*release_fn)(struct pci_host_bridge *);
408 void *release_data; 408 void *release_data;
409 unsigned int ignore_reset_delay:1; /* for entire hierarchy */
409}; 410};
410 411
411#define to_pci_host_bridge(n) container_of(n, struct pci_host_bridge, dev) 412#define to_pci_host_bridge(n) container_of(n, struct pci_host_bridge, dev)
@@ -510,6 +511,9 @@ static inline struct pci_dev *pci_upstream_bridge(struct pci_dev *dev)
510 return dev->bus->self; 511 return dev->bus->self;
511} 512}
512 513
514struct device *pci_get_host_bridge_device(struct pci_dev *dev);
515void pci_put_host_bridge_device(struct device *dev);
516
513#ifdef CONFIG_PCI_MSI 517#ifdef CONFIG_PCI_MSI
514static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) 518static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev)
515{ 519{
@@ -1174,6 +1178,7 @@ unsigned char pci_bus_max_busnr(struct pci_bus *bus);
1174void pci_setup_bridge(struct pci_bus *bus); 1178void pci_setup_bridge(struct pci_bus *bus);
1175resource_size_t pcibios_window_alignment(struct pci_bus *bus, 1179resource_size_t pcibios_window_alignment(struct pci_bus *bus,
1176 unsigned long type); 1180 unsigned long type);
1181resource_size_t pcibios_iov_resource_alignment(struct pci_dev *dev, int resno);
1177 1182
1178#define PCI_VGA_STATE_CHANGE_BRIDGE (1 << 0) 1183#define PCI_VGA_STATE_CHANGE_BRIDGE (1 << 0)
1179#define PCI_VGA_STATE_CHANGE_DECODES (1 << 1) 1184#define PCI_VGA_STATE_CHANGE_DECODES (1 << 1)
@@ -1669,13 +1674,25 @@ int pci_ext_cfg_avail(void);
1669void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); 1674void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
1670 1675
1671#ifdef CONFIG_PCI_IOV 1676#ifdef CONFIG_PCI_IOV
1677int pci_iov_virtfn_bus(struct pci_dev *dev, int id);
1678int pci_iov_virtfn_devfn(struct pci_dev *dev, int id);
1679
1672int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); 1680int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
1673void pci_disable_sriov(struct pci_dev *dev); 1681void pci_disable_sriov(struct pci_dev *dev);
1674int pci_num_vf(struct pci_dev *dev); 1682int pci_num_vf(struct pci_dev *dev);
1675int pci_vfs_assigned(struct pci_dev *dev); 1683int pci_vfs_assigned(struct pci_dev *dev);
1676int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); 1684int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
1677int pci_sriov_get_totalvfs(struct pci_dev *dev); 1685int pci_sriov_get_totalvfs(struct pci_dev *dev);
1686resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno);
1678#else 1687#else
1688static inline int pci_iov_virtfn_bus(struct pci_dev *dev, int id)
1689{
1690 return -ENOSYS;
1691}
1692static inline int pci_iov_virtfn_devfn(struct pci_dev *dev, int id)
1693{
1694 return -ENOSYS;
1695}
1679static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) 1696static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
1680{ return -ENODEV; } 1697{ return -ENODEV; }
1681static inline void pci_disable_sriov(struct pci_dev *dev) { } 1698static inline void pci_disable_sriov(struct pci_dev *dev) { }
@@ -1686,6 +1703,8 @@ static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs)
1686{ return 0; } 1703{ return 0; }
1687static inline int pci_sriov_get_totalvfs(struct pci_dev *dev) 1704static inline int pci_sriov_get_totalvfs(struct pci_dev *dev)
1688{ return 0; } 1705{ return 0; }
1706static inline resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno)
1707{ return 0; }
1689#endif 1708#endif
1690 1709
1691#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) 1710#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE)
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index e63c02a93f6b..38cff8f6716d 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2315,6 +2315,8 @@
2315#define PCI_VENDOR_ID_CENATEK 0x16CA 2315#define PCI_VENDOR_ID_CENATEK 0x16CA
2316#define PCI_DEVICE_ID_CENATEK_IDE 0x0001 2316#define PCI_DEVICE_ID_CENATEK_IDE 0x0001
2317 2317
2318#define PCI_VENDOR_ID_SYNOPSYS 0x16c3
2319
2318#define PCI_VENDOR_ID_VITESSE 0x1725 2320#define PCI_VENDOR_ID_VITESSE 0x1725
2319#define PCI_DEVICE_ID_VITESSE_VSC7174 0x7174 2321#define PCI_DEVICE_ID_VITESSE_VSC7174 0x7174
2320 2322
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 2b621982938d..61992cf2e977 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -53,6 +53,7 @@ struct perf_guest_info_callbacks {
53#include <linux/sysfs.h> 53#include <linux/sysfs.h>
54#include <linux/perf_regs.h> 54#include <linux/perf_regs.h>
55#include <linux/workqueue.h> 55#include <linux/workqueue.h>
56#include <linux/cgroup.h>
56#include <asm/local.h> 57#include <asm/local.h>
57 58
58struct perf_callchain_entry { 59struct perf_callchain_entry {
@@ -118,10 +119,19 @@ struct hw_perf_event {
118 struct hrtimer hrtimer; 119 struct hrtimer hrtimer;
119 }; 120 };
120 struct { /* tracepoint */ 121 struct { /* tracepoint */
121 struct task_struct *tp_target;
122 /* for tp_event->class */ 122 /* for tp_event->class */
123 struct list_head tp_list; 123 struct list_head tp_list;
124 }; 124 };
125 struct { /* intel_cqm */
126 int cqm_state;
127 int cqm_rmid;
128 struct list_head cqm_events_entry;
129 struct list_head cqm_groups_entry;
130 struct list_head cqm_group_entry;
131 };
132 struct { /* itrace */
133 int itrace_started;
134 };
125#ifdef CONFIG_HAVE_HW_BREAKPOINT 135#ifdef CONFIG_HAVE_HW_BREAKPOINT
126 struct { /* breakpoint */ 136 struct { /* breakpoint */
127 /* 137 /*
@@ -129,12 +139,12 @@ struct hw_perf_event {
129 * problem hw_breakpoint has with context 139 * problem hw_breakpoint has with context
130 * creation and event initalization. 140 * creation and event initalization.
131 */ 141 */
132 struct task_struct *bp_target;
133 struct arch_hw_breakpoint info; 142 struct arch_hw_breakpoint info;
134 struct list_head bp_list; 143 struct list_head bp_list;
135 }; 144 };
136#endif 145#endif
137 }; 146 };
147 struct task_struct *target;
138 int state; 148 int state;
139 local64_t prev_count; 149 local64_t prev_count;
140 u64 sample_period; 150 u64 sample_period;
@@ -166,6 +176,11 @@ struct perf_event;
166 * pmu::capabilities flags 176 * pmu::capabilities flags
167 */ 177 */
168#define PERF_PMU_CAP_NO_INTERRUPT 0x01 178#define PERF_PMU_CAP_NO_INTERRUPT 0x01
179#define PERF_PMU_CAP_NO_NMI 0x02
180#define PERF_PMU_CAP_AUX_NO_SG 0x04
181#define PERF_PMU_CAP_AUX_SW_DOUBLEBUF 0x08
182#define PERF_PMU_CAP_EXCLUSIVE 0x10
183#define PERF_PMU_CAP_ITRACE 0x20
169 184
170/** 185/**
171 * struct pmu - generic performance monitoring unit 186 * struct pmu - generic performance monitoring unit
@@ -186,6 +201,7 @@ struct pmu {
186 201
187 int * __percpu pmu_disable_count; 202 int * __percpu pmu_disable_count;
188 struct perf_cpu_context * __percpu pmu_cpu_context; 203 struct perf_cpu_context * __percpu pmu_cpu_context;
204 atomic_t exclusive_cnt; /* < 0: cpu; > 0: tsk */
189 int task_ctx_nr; 205 int task_ctx_nr;
190 int hrtimer_interval_ms; 206 int hrtimer_interval_ms;
191 207
@@ -262,9 +278,32 @@ struct pmu {
262 int (*event_idx) (struct perf_event *event); /*optional */ 278 int (*event_idx) (struct perf_event *event); /*optional */
263 279
264 /* 280 /*
265 * flush branch stack on context-switches (needed in cpu-wide mode) 281 * context-switches callback
282 */
283 void (*sched_task) (struct perf_event_context *ctx,
284 bool sched_in);
285 /*
286 * PMU specific data size
287 */
288 size_t task_ctx_size;
289
290
291 /*
292 * Return the count value for a counter.
293 */
294 u64 (*count) (struct perf_event *event); /*optional*/
295
296 /*
297 * Set up pmu-private data structures for an AUX area
266 */ 298 */
267 void (*flush_branch_stack) (void); 299 void *(*setup_aux) (int cpu, void **pages,
300 int nr_pages, bool overwrite);
301 /* optional */
302
303 /*
304 * Free pmu-private AUX data structures
305 */
306 void (*free_aux) (void *aux); /* optional */
268}; 307};
269 308
270/** 309/**
@@ -300,6 +339,7 @@ struct swevent_hlist {
300#define PERF_ATTACH_CONTEXT 0x01 339#define PERF_ATTACH_CONTEXT 0x01
301#define PERF_ATTACH_GROUP 0x02 340#define PERF_ATTACH_GROUP 0x02
302#define PERF_ATTACH_TASK 0x04 341#define PERF_ATTACH_TASK 0x04
342#define PERF_ATTACH_TASK_DATA 0x08
303 343
304struct perf_cgroup; 344struct perf_cgroup;
305struct ring_buffer; 345struct ring_buffer;
@@ -438,6 +478,7 @@ struct perf_event {
438 struct pid_namespace *ns; 478 struct pid_namespace *ns;
439 u64 id; 479 u64 id;
440 480
481 u64 (*clock)(void);
441 perf_overflow_handler_t overflow_handler; 482 perf_overflow_handler_t overflow_handler;
442 void *overflow_handler_context; 483 void *overflow_handler_context;
443 484
@@ -504,7 +545,7 @@ struct perf_event_context {
504 u64 generation; 545 u64 generation;
505 int pin_count; 546 int pin_count;
506 int nr_cgroups; /* cgroup evts */ 547 int nr_cgroups; /* cgroup evts */
507 int nr_branch_stack; /* branch_stack evt */ 548 void *task_ctx_data; /* pmu specific data */
508 struct rcu_head rcu_head; 549 struct rcu_head rcu_head;
509 550
510 struct delayed_work orphans_remove; 551 struct delayed_work orphans_remove;
@@ -536,12 +577,52 @@ struct perf_output_handle {
536 struct ring_buffer *rb; 577 struct ring_buffer *rb;
537 unsigned long wakeup; 578 unsigned long wakeup;
538 unsigned long size; 579 unsigned long size;
539 void *addr; 580 union {
581 void *addr;
582 unsigned long head;
583 };
540 int page; 584 int page;
541}; 585};
542 586
587#ifdef CONFIG_CGROUP_PERF
588
589/*
590 * perf_cgroup_info keeps track of time_enabled for a cgroup.
591 * This is a per-cpu dynamically allocated data structure.
592 */
593struct perf_cgroup_info {
594 u64 time;
595 u64 timestamp;
596};
597
598struct perf_cgroup {
599 struct cgroup_subsys_state css;
600 struct perf_cgroup_info __percpu *info;
601};
602
603/*
604 * Must ensure cgroup is pinned (css_get) before calling
605 * this function. In other words, we cannot call this function
606 * if there is no cgroup event for the current CPU context.
607 */
608static inline struct perf_cgroup *
609perf_cgroup_from_task(struct task_struct *task)
610{
611 return container_of(task_css(task, perf_event_cgrp_id),
612 struct perf_cgroup, css);
613}
614#endif /* CONFIG_CGROUP_PERF */
615
543#ifdef CONFIG_PERF_EVENTS 616#ifdef CONFIG_PERF_EVENTS
544 617
618extern void *perf_aux_output_begin(struct perf_output_handle *handle,
619 struct perf_event *event);
620extern void perf_aux_output_end(struct perf_output_handle *handle,
621 unsigned long size, bool truncated);
622extern int perf_aux_output_skip(struct perf_output_handle *handle,
623 unsigned long size);
624extern void *perf_get_aux(struct perf_output_handle *handle);
625
545extern int perf_pmu_register(struct pmu *pmu, const char *name, int type); 626extern int perf_pmu_register(struct pmu *pmu, const char *name, int type);
546extern void perf_pmu_unregister(struct pmu *pmu); 627extern void perf_pmu_unregister(struct pmu *pmu);
547 628
@@ -558,6 +639,8 @@ extern void perf_event_delayed_put(struct task_struct *task);
558extern void perf_event_print_debug(void); 639extern void perf_event_print_debug(void);
559extern void perf_pmu_disable(struct pmu *pmu); 640extern void perf_pmu_disable(struct pmu *pmu);
560extern void perf_pmu_enable(struct pmu *pmu); 641extern void perf_pmu_enable(struct pmu *pmu);
642extern void perf_sched_cb_dec(struct pmu *pmu);
643extern void perf_sched_cb_inc(struct pmu *pmu);
561extern int perf_event_task_disable(void); 644extern int perf_event_task_disable(void);
562extern int perf_event_task_enable(void); 645extern int perf_event_task_enable(void);
563extern int perf_event_refresh(struct perf_event *event, int refresh); 646extern int perf_event_refresh(struct perf_event *event, int refresh);
@@ -731,6 +814,11 @@ static inline void perf_event_task_sched_out(struct task_struct *prev,
731 __perf_event_task_sched_out(prev, next); 814 __perf_event_task_sched_out(prev, next);
732} 815}
733 816
817static inline u64 __perf_event_count(struct perf_event *event)
818{
819 return local64_read(&event->count) + atomic64_read(&event->child_count);
820}
821
734extern void perf_event_mmap(struct vm_area_struct *vma); 822extern void perf_event_mmap(struct vm_area_struct *vma);
735extern struct perf_guest_info_callbacks *perf_guest_cbs; 823extern struct perf_guest_info_callbacks *perf_guest_cbs;
736extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks); 824extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
@@ -800,6 +888,16 @@ static inline bool has_branch_stack(struct perf_event *event)
800 return event->attr.sample_type & PERF_SAMPLE_BRANCH_STACK; 888 return event->attr.sample_type & PERF_SAMPLE_BRANCH_STACK;
801} 889}
802 890
891static inline bool needs_branch_stack(struct perf_event *event)
892{
893 return event->attr.branch_sample_type != 0;
894}
895
896static inline bool has_aux(struct perf_event *event)
897{
898 return event->pmu->setup_aux;
899}
900
803extern int perf_output_begin(struct perf_output_handle *handle, 901extern int perf_output_begin(struct perf_output_handle *handle,
804 struct perf_event *event, unsigned int size); 902 struct perf_event *event, unsigned int size);
805extern void perf_output_end(struct perf_output_handle *handle); 903extern void perf_output_end(struct perf_output_handle *handle);
@@ -815,6 +913,17 @@ extern void perf_event_disable(struct perf_event *event);
815extern int __perf_event_disable(void *info); 913extern int __perf_event_disable(void *info);
816extern void perf_event_task_tick(void); 914extern void perf_event_task_tick(void);
817#else /* !CONFIG_PERF_EVENTS: */ 915#else /* !CONFIG_PERF_EVENTS: */
916static inline void *
917perf_aux_output_begin(struct perf_output_handle *handle,
918 struct perf_event *event) { return NULL; }
919static inline void
920perf_aux_output_end(struct perf_output_handle *handle, unsigned long size,
921 bool truncated) { }
922static inline int
923perf_aux_output_skip(struct perf_output_handle *handle,
924 unsigned long size) { return -EINVAL; }
925static inline void *
926perf_get_aux(struct perf_output_handle *handle) { return NULL; }
818static inline void 927static inline void
819perf_event_task_sched_in(struct task_struct *prev, 928perf_event_task_sched_in(struct task_struct *prev,
820 struct task_struct *task) { } 929 struct task_struct *task) { }
diff --git a/include/linux/personality.h b/include/linux/personality.h
index 646c0a7d50fa..aeb7892b2468 100644
--- a/include/linux/personality.h
+++ b/include/linux/personality.h
@@ -3,52 +3,14 @@
3 3
4#include <uapi/linux/personality.h> 4#include <uapi/linux/personality.h>
5 5
6
7/*
8 * Handling of different ABIs (personalities).
9 */
10
11struct exec_domain;
12struct pt_regs;
13
14extern int register_exec_domain(struct exec_domain *);
15extern int unregister_exec_domain(struct exec_domain *);
16extern int __set_personality(unsigned int);
17
18
19/*
20 * Description of an execution domain.
21 *
22 * The first two members are refernced from assembly source
23 * and should stay where they are unless explicitly needed.
24 */
25typedef void (*handler_t)(int, struct pt_regs *);
26
27struct exec_domain {
28 const char *name; /* name of the execdomain */
29 handler_t handler; /* handler for syscalls */
30 unsigned char pers_low; /* lowest personality */
31 unsigned char pers_high; /* highest personality */
32 unsigned long *signal_map; /* signal mapping */
33 unsigned long *signal_invmap; /* reverse signal mapping */
34 struct map_segment *err_map; /* error mapping */
35 struct map_segment *socktype_map; /* socket type mapping */
36 struct map_segment *sockopt_map; /* socket option mapping */
37 struct map_segment *af_map; /* address family mapping */
38 struct module *module; /* module context of the ed. */
39 struct exec_domain *next; /* linked list (internal) */
40};
41
42/* 6/*
43 * Return the base personality without flags. 7 * Return the base personality without flags.
44 */ 8 */
45#define personality(pers) (pers & PER_MASK) 9#define personality(pers) (pers & PER_MASK)
46 10
47
48/* 11/*
49 * Change personality of the currently running process. 12 * Change personality of the currently running process.
50 */ 13 */
51#define set_personality(pers) \ 14#define set_personality(pers) (current->personality = (pers))
52 ((current->personality == (pers)) ? 0 : __set_personality(pers))
53 15
54#endif /* _LINUX_PERSONALITY_H */ 16#endif /* _LINUX_PERSONALITY_H */
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
index 7e75bfe37cc7..fe5732d53eda 100644
--- a/include/linux/phy_fixed.h
+++ b/include/linux/phy_fixed.h
@@ -21,6 +21,9 @@ extern void fixed_phy_del(int phy_addr);
21extern int fixed_phy_set_link_update(struct phy_device *phydev, 21extern int fixed_phy_set_link_update(struct phy_device *phydev,
22 int (*link_update)(struct net_device *, 22 int (*link_update)(struct net_device *,
23 struct fixed_phy_status *)); 23 struct fixed_phy_status *));
24extern int fixed_phy_update_state(struct phy_device *phydev,
25 const struct fixed_phy_status *status,
26 const struct fixed_phy_status *changed);
24#else 27#else
25static inline int fixed_phy_add(unsigned int irq, int phy_id, 28static inline int fixed_phy_add(unsigned int irq, int phy_id,
26 struct fixed_phy_status *status) 29 struct fixed_phy_status *status)
@@ -43,6 +46,12 @@ static inline int fixed_phy_set_link_update(struct phy_device *phydev,
43{ 46{
44 return -ENODEV; 47 return -ENODEV;
45} 48}
49static inline int fixed_phy_update_state(struct phy_device *phydev,
50 const struct fixed_phy_status *status,
51 const struct fixed_phy_status *changed)
52{
53 return -ENODEV;
54}
46#endif /* CONFIG_FIXED_PHY */ 55#endif /* CONFIG_FIXED_PHY */
47 56
48#endif /* __PHY_FIXED_H */ 57#endif /* __PHY_FIXED_H */
diff --git a/include/linux/platform_data/hsmmc-omap.h b/include/linux/platform_data/hsmmc-omap.h
index 67bbcf0785f6..8e981be2e2c2 100644
--- a/include/linux/platform_data/hsmmc-omap.h
+++ b/include/linux/platform_data/hsmmc-omap.h
@@ -55,9 +55,6 @@ struct omap_hsmmc_platform_data {
55 u32 caps; /* Used for the MMC driver on 2430 and later */ 55 u32 caps; /* Used for the MMC driver on 2430 and later */
56 u32 pm_caps; /* PM capabilities of the mmc */ 56 u32 pm_caps; /* PM capabilities of the mmc */
57 57
58 /* switch pin can be for card detect (default) or card cover */
59 unsigned cover:1;
60
61 /* use the internal clock */ 58 /* use the internal clock */
62 unsigned internal_clock:1; 59 unsigned internal_clock:1;
63 60
@@ -73,7 +70,8 @@ struct omap_hsmmc_platform_data {
73#define HSMMC_HAS_HSPE_SUPPORT (1 << 2) 70#define HSMMC_HAS_HSPE_SUPPORT (1 << 2)
74 unsigned features; 71 unsigned features;
75 72
76 int switch_pin; /* gpio (card detect) */ 73 int gpio_cd; /* gpio (card detect) */
74 int gpio_cod; /* gpio (cover detect) */
77 int gpio_wp; /* gpio (write protect) */ 75 int gpio_wp; /* gpio (write protect) */
78 76
79 int (*set_power)(struct device *dev, int power_on, int vdd); 77 int (*set_power)(struct device *dev, int power_on, int vdd);
diff --git a/include/linux/platform_data/i2c-davinci.h b/include/linux/platform_data/i2c-davinci.h
index 2312d197dfb7..89fd34727a24 100644
--- a/include/linux/platform_data/i2c-davinci.h
+++ b/include/linux/platform_data/i2c-davinci.h
@@ -18,6 +18,7 @@ struct davinci_i2c_platform_data {
18 unsigned int bus_delay; /* post-transaction delay (usec) */ 18 unsigned int bus_delay; /* post-transaction delay (usec) */
19 unsigned int sda_pin; /* GPIO pin ID to use for SDA */ 19 unsigned int sda_pin; /* GPIO pin ID to use for SDA */
20 unsigned int scl_pin; /* GPIO pin ID to use for SCL */ 20 unsigned int scl_pin; /* GPIO pin ID to use for SCL */
21 bool has_pfunc; /*chip has a ICPFUNC register */
21}; 22};
22 23
23/* for board setup code */ 24/* for board setup code */
diff --git a/include/linux/platform_data/nxp-nci.h b/include/linux/platform_data/nxp-nci.h
new file mode 100644
index 000000000000..d6ed28679bb2
--- /dev/null
+++ b/include/linux/platform_data/nxp-nci.h
@@ -0,0 +1,27 @@
1/*
2 * Generic platform data for the NXP NCI NFC chips.
3 *
4 * Copyright (C) 2014 NXP Semiconductors All rights reserved.
5 *
6 * Authors: Clément Perrochaud <clement.perrochaud@nxp.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope 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
18#ifndef _NXP_NCI_H_
19#define _NXP_NCI_H_
20
21struct nxp_nci_nfc_platform_data {
22 unsigned int gpio_en;
23 unsigned int gpio_fw;
24 unsigned int irq;
25};
26
27#endif /* _NXP_NCI_H_ */
diff --git a/include/linux/platform_data/sky81452-backlight.h b/include/linux/platform_data/sky81452-backlight.h
new file mode 100644
index 000000000000..1231e9bb00f1
--- /dev/null
+++ b/include/linux/platform_data/sky81452-backlight.h
@@ -0,0 +1,46 @@
1/*
2 * sky81452.h SKY81452 backlight driver
3 *
4 * Copyright 2014 Skyworks Solutions Inc.
5 * Author : Gyungoh Yoo <jack.yoo@skyworksinc.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 version 2
9 * as published by the Free Software Foundation.
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, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef _SKY81452_BACKLIGHT_H
21#define _SKY81452_BACKLIGHT_H
22
23/**
24 * struct sky81452_platform_data
25 * @name: backlight driver name.
26 If it is not defined, default name is lcd-backlight.
27 * @gpio_enable:GPIO number which control EN pin
28 * @enable: Enable mask for current sink channel 1, 2, 3, 4, 5 and 6.
29 * @ignore_pwm: true if DPWMI should be ignored.
30 * @dpwm_mode: true is DPWM dimming mode, otherwise Analog dimming mode.
31 * @phase_shift:true is phase shift mode.
32 * @short_detecion_threshold: It should be one of 4, 5, 6 and 7V.
33 * @boost_current_limit: It should be one of 2300, 2750mA.
34 */
35struct sky81452_bl_platform_data {
36 const char *name;
37 int gpio_enable;
38 unsigned int enable;
39 bool ignore_pwm;
40 bool dpwm_mode;
41 bool phase_shift;
42 unsigned int short_detection_threshold;
43 unsigned int boost_current_limit;
44};
45
46#endif
diff --git a/include/linux/platform_data/tpm_stm_st33.h b/include/linux/platform_data/st33zp24.h
index ff75310c0f47..817dfdb37885 100644
--- a/include/linux/platform_data/tpm_stm_st33.h
+++ b/include/linux/platform_data/st33zp24.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * STMicroelectronics TPM I2C Linux driver for TPM ST33ZP24 2 * STMicroelectronics TPM Linux driver for TPM 1.2 ST33ZP24
3 * Copyright (C) 2009, 2010 STMicroelectronics 3 * Copyright (C) 2009 - 2015 STMicroelectronics
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 6 * it under the terms of the GNU General Public License as published by
@@ -14,20 +14,9 @@
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see <http://www.gnu.org/licenses/>. 16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 *
18 * STMicroelectronics version 1.2.0, Copyright (C) 2010
19 * STMicroelectronics comes with ABSOLUTELY NO WARRANTY.
20 * This is free software, and you are welcome to redistribute it
21 * under certain conditions.
22 *
23 * @Author: Christophe RICARD tpmsupport@st.com
24 *
25 * @File: stm_st33_tpm.h
26 *
27 * @Date: 09/15/2010
28 */ 17 */
29#ifndef __STM_ST33_TPM_H__ 18#ifndef __ST33ZP24_H__
30#define __STM_ST33_TPM_H__ 19#define __ST33ZP24_H__
31 20
32#define TPM_ST33_I2C "st33zp24-i2c" 21#define TPM_ST33_I2C "st33zp24-i2c"
33#define TPM_ST33_SPI "st33zp24-spi" 22#define TPM_ST33_SPI "st33zp24-spi"
@@ -36,4 +25,4 @@ struct st33zp24_platform_data {
36 int io_lpcpd; 25 int io_lpcpd;
37}; 26};
38 27
39#endif /* __STM_ST33_TPM_H__ */ 28#endif /* __ST33ZP24_H__ */
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index ae4882ca4a64..58f1e75ba105 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -59,7 +59,7 @@ extern int platform_add_devices(struct platform_device **, int);
59 59
60struct platform_device_info { 60struct platform_device_info {
61 struct device *parent; 61 struct device *parent;
62 struct acpi_dev_node acpi_node; 62 struct fwnode_handle *fwnode;
63 63
64 const char *name; 64 const char *name;
65 int id; 65 int id;
diff --git a/include/linux/resume-trace.h b/include/linux/pm-trace.h
index f31db2368782..ecbde7a5548e 100644
--- a/include/linux/resume-trace.h
+++ b/include/linux/pm-trace.h
@@ -1,8 +1,8 @@
1#ifndef RESUME_TRACE_H 1#ifndef PM_TRACE_H
2#define RESUME_TRACE_H 2#define PM_TRACE_H
3 3
4#ifdef CONFIG_PM_TRACE 4#ifdef CONFIG_PM_TRACE
5#include <asm/resume-trace.h> 5#include <asm/pm-trace.h>
6#include <linux/types.h> 6#include <linux/types.h>
7 7
8extern int pm_trace_enabled; 8extern int pm_trace_enabled;
@@ -14,7 +14,7 @@ static inline int pm_trace_is_enabled(void)
14 14
15struct device; 15struct device;
16extern void set_trace_device(struct device *); 16extern void set_trace_device(struct device *);
17extern void generate_resume_trace(const void *tracedata, unsigned int user); 17extern void generate_pm_trace(const void *tracedata, unsigned int user);
18extern int show_trace_dev_match(char *buf, size_t size); 18extern int show_trace_dev_match(char *buf, size_t size);
19 19
20#define TRACE_DEVICE(dev) do { \ 20#define TRACE_DEVICE(dev) do { \
@@ -28,6 +28,7 @@ static inline int pm_trace_is_enabled(void) { return 0; }
28 28
29#define TRACE_DEVICE(dev) do { } while (0) 29#define TRACE_DEVICE(dev) do { } while (0)
30#define TRACE_RESUME(dev) do { } while (0) 30#define TRACE_RESUME(dev) do { } while (0)
31#define TRACE_SUSPEND(dev) do { } while (0)
31 32
32#endif 33#endif
33 34
diff --git a/include/linux/pm.h b/include/linux/pm.h
index e2f1be6dd9dd..2d29c64f8fb1 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -603,10 +603,18 @@ extern void dev_pm_put_subsys_data(struct device *dev);
603 * Power domains provide callbacks that are executed during system suspend, 603 * Power domains provide callbacks that are executed during system suspend,
604 * hibernation, system resume and during runtime PM transitions along with 604 * hibernation, system resume and during runtime PM transitions along with
605 * subsystem-level and driver-level callbacks. 605 * subsystem-level and driver-level callbacks.
606 *
607 * @detach: Called when removing a device from the domain.
608 * @activate: Called before executing probe routines for bus types and drivers.
609 * @sync: Called after successful driver probe.
610 * @dismiss: Called after unsuccessful driver probe and after driver removal.
606 */ 611 */
607struct dev_pm_domain { 612struct dev_pm_domain {
608 struct dev_pm_ops ops; 613 struct dev_pm_ops ops;
609 void (*detach)(struct device *dev, bool power_off); 614 void (*detach)(struct device *dev, bool power_off);
615 int (*activate)(struct device *dev);
616 void (*sync)(struct device *dev);
617 void (*dismiss)(struct device *dev);
610}; 618};
611 619
612/* 620/*
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 080e778118ba..681ccb053f72 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -127,7 +127,7 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
127 return to_gpd_data(dev->power.subsys_data->domain_data); 127 return to_gpd_data(dev->power.subsys_data->domain_data);
128} 128}
129 129
130extern struct generic_pm_domain *dev_to_genpd(struct device *dev); 130extern struct generic_pm_domain *pm_genpd_lookup_dev(struct device *dev);
131extern int __pm_genpd_add_device(struct generic_pm_domain *genpd, 131extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
132 struct device *dev, 132 struct device *dev,
133 struct gpd_timing_data *td); 133 struct gpd_timing_data *td);
@@ -163,9 +163,9 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
163{ 163{
164 return ERR_PTR(-ENOSYS); 164 return ERR_PTR(-ENOSYS);
165} 165}
166static inline struct generic_pm_domain *dev_to_genpd(struct device *dev) 166static inline struct generic_pm_domain *pm_genpd_lookup_dev(struct device *dev)
167{ 167{
168 return ERR_PTR(-ENOSYS); 168 return NULL;
169} 169}
170static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd, 170static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd,
171 struct device *dev, 171 struct device *dev,
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 6512e9cbc6d5..5df733b8f704 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -510,4 +510,16 @@ static inline void pnp_unregister_driver(struct pnp_driver *drv) { }
510 510
511#endif /* CONFIG_PNP */ 511#endif /* CONFIG_PNP */
512 512
513/**
514 * module_pnp_driver() - Helper macro for registering a PnP driver
515 * @__pnp_driver: pnp_driver struct
516 *
517 * Helper macro for PnP drivers which do not do anything special in module
518 * init/exit. This eliminates a lot of boilerplate. Each module may only
519 * use this macro once, and calling it replaces module_init() and module_exit()
520 */
521#define module_pnp_driver(__pnp_driver) \
522 module_driver(__pnp_driver, pnp_register_driver, \
523 pnp_unregister_driver)
524
513#endif /* _LINUX_PNP_H */ 525#endif /* _LINUX_PNP_H */
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h
index 416ebeb6ee1e..eadf28cb2fc9 100644
--- a/include/linux/power/charger-manager.h
+++ b/include/linux/power/charger-manager.h
@@ -242,7 +242,8 @@ struct charger_manager {
242 int emergency_stop; 242 int emergency_stop;
243 243
244 char psy_name_buf[PSY_NAME_MAX + 1]; 244 char psy_name_buf[PSY_NAME_MAX + 1];
245 struct power_supply charger_psy; 245 struct power_supply_desc charger_psy_desc;
246 struct power_supply *charger_psy;
246 247
247 u64 charging_start_time; 248 u64 charging_start_time;
248 u64 charging_end_time; 249 u64 charging_end_time;
diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h
index 89dd84f47c6e..cf112b4075c8 100644
--- a/include/linux/power/max17042_battery.h
+++ b/include/linux/power/max17042_battery.h
@@ -126,7 +126,14 @@ enum max17047_register {
126 MAX17047_QRTbl30 = 0x42, 126 MAX17047_QRTbl30 = 0x42,
127}; 127};
128 128
129enum max170xx_chip_type {MAX17042, MAX17047}; 129enum max170xx_chip_type {
130 MAXIM_DEVICE_TYPE_UNKNOWN = 0,
131 MAXIM_DEVICE_TYPE_MAX17042,
132 MAXIM_DEVICE_TYPE_MAX17047,
133 MAXIM_DEVICE_TYPE_MAX17050,
134
135 MAXIM_DEVICE_TYPE_NUM
136};
130 137
131/* 138/*
132 * used for setting a register to a desired value 139 * used for setting a register to a desired value
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 096dbced02ac..75a1dd8dc56e 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -13,6 +13,7 @@
13#ifndef __LINUX_POWER_SUPPLY_H__ 13#ifndef __LINUX_POWER_SUPPLY_H__
14#define __LINUX_POWER_SUPPLY_H__ 14#define __LINUX_POWER_SUPPLY_H__
15 15
16#include <linux/device.h>
16#include <linux/workqueue.h> 17#include <linux/workqueue.h>
17#include <linux/leds.h> 18#include <linux/leds.h>
18#include <linux/spinlock.h> 19#include <linux/spinlock.h>
@@ -173,22 +174,32 @@ union power_supply_propval {
173 const char *strval; 174 const char *strval;
174}; 175};
175 176
176struct device;
177struct device_node; 177struct device_node;
178struct power_supply;
178 179
179struct power_supply { 180/* Run-time specific power supply configuration */
180 const char *name; 181struct power_supply_config {
181 enum power_supply_type type; 182 struct device_node *of_node;
182 enum power_supply_property *properties; 183 /* Driver private data */
183 size_t num_properties; 184 void *drv_data;
184 185
185 char **supplied_to; 186 char **supplied_to;
186 size_t num_supplicants; 187 size_t num_supplicants;
188};
187 189
188 char **supplied_from; 190/* Description of power supply */
189 size_t num_supplies; 191struct power_supply_desc {
190 struct device_node *of_node; 192 const char *name;
193 enum power_supply_type type;
194 enum power_supply_property *properties;
195 size_t num_properties;
191 196
197 /*
198 * Functions for drivers implementing power supply class.
199 * These shouldn't be called directly by other drivers for accessing
200 * this power supply. Instead use power_supply_*() functions (for
201 * example power_supply_get_property()).
202 */
192 int (*get_property)(struct power_supply *psy, 203 int (*get_property)(struct power_supply *psy,
193 enum power_supply_property psp, 204 enum power_supply_property psp,
194 union power_supply_propval *val); 205 union power_supply_propval *val);
@@ -208,12 +219,27 @@ struct power_supply {
208 bool no_thermal; 219 bool no_thermal;
209 /* For APM emulation, think legacy userspace. */ 220 /* For APM emulation, think legacy userspace. */
210 int use_for_apm; 221 int use_for_apm;
222};
223
224struct power_supply {
225 const struct power_supply_desc *desc;
226
227 char **supplied_to;
228 size_t num_supplicants;
229
230 char **supplied_from;
231 size_t num_supplies;
232 struct device_node *of_node;
233
234 /* Driver private data */
235 void *drv_data;
211 236
212 /* private */ 237 /* private */
213 struct device *dev; 238 struct device dev;
214 struct work_struct changed_work; 239 struct work_struct changed_work;
215 spinlock_t changed_lock; 240 spinlock_t changed_lock;
216 bool changed; 241 bool changed;
242 atomic_t use_cnt;
217#ifdef CONFIG_THERMAL 243#ifdef CONFIG_THERMAL
218 struct thermal_zone_device *tzd; 244 struct thermal_zone_device *tzd;
219 struct thermal_cooling_device *tcd; 245 struct thermal_cooling_device *tcd;
@@ -256,6 +282,7 @@ extern struct atomic_notifier_head power_supply_notifier;
256extern int power_supply_reg_notifier(struct notifier_block *nb); 282extern int power_supply_reg_notifier(struct notifier_block *nb);
257extern void power_supply_unreg_notifier(struct notifier_block *nb); 283extern void power_supply_unreg_notifier(struct notifier_block *nb);
258extern struct power_supply *power_supply_get_by_name(const char *name); 284extern struct power_supply *power_supply_get_by_name(const char *name);
285extern void power_supply_put(struct power_supply *psy);
259#ifdef CONFIG_OF 286#ifdef CONFIG_OF
260extern struct power_supply *power_supply_get_by_phandle(struct device_node *np, 287extern struct power_supply *power_supply_get_by_phandle(struct device_node *np,
261 const char *property); 288 const char *property);
@@ -274,13 +301,36 @@ extern int power_supply_is_system_supplied(void);
274static inline int power_supply_is_system_supplied(void) { return -ENOSYS; } 301static inline int power_supply_is_system_supplied(void) { return -ENOSYS; }
275#endif 302#endif
276 303
277extern int power_supply_register(struct device *parent, 304extern int power_supply_get_property(struct power_supply *psy,
278 struct power_supply *psy); 305 enum power_supply_property psp,
279extern int power_supply_register_no_ws(struct device *parent, 306 union power_supply_propval *val);
280 struct power_supply *psy); 307extern int power_supply_set_property(struct power_supply *psy,
308 enum power_supply_property psp,
309 const union power_supply_propval *val);
310extern int power_supply_property_is_writeable(struct power_supply *psy,
311 enum power_supply_property psp);
312extern void power_supply_external_power_changed(struct power_supply *psy);
313
314extern struct power_supply *__must_check
315power_supply_register(struct device *parent,
316 const struct power_supply_desc *desc,
317 const struct power_supply_config *cfg);
318extern struct power_supply *__must_check
319power_supply_register_no_ws(struct device *parent,
320 const struct power_supply_desc *desc,
321 const struct power_supply_config *cfg);
322extern struct power_supply *__must_check
323devm_power_supply_register(struct device *parent,
324 const struct power_supply_desc *desc,
325 const struct power_supply_config *cfg);
326extern struct power_supply *__must_check
327devm_power_supply_register_no_ws(struct device *parent,
328 const struct power_supply_desc *desc,
329 const struct power_supply_config *cfg);
281extern void power_supply_unregister(struct power_supply *psy); 330extern void power_supply_unregister(struct power_supply *psy);
282extern int power_supply_powers(struct power_supply *psy, struct device *dev); 331extern int power_supply_powers(struct power_supply *psy, struct device *dev);
283 332
333extern void *power_supply_get_drvdata(struct power_supply *psy);
284/* For APM emulation, think legacy userspace. */ 334/* For APM emulation, think legacy userspace. */
285extern struct class *power_supply_class; 335extern struct class *power_supply_class;
286 336
diff --git a/include/linux/printk.h b/include/linux/printk.h
index baa3f97d8ce8..9b30871c9149 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -255,6 +255,11 @@ extern asmlinkage void dump_stack(void) __cold;
255 printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) 255 printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
256#define pr_info(fmt, ...) \ 256#define pr_info(fmt, ...) \
257 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 257 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
258/*
259 * Like KERN_CONT, pr_cont() should only be used when continuing
260 * a line with no newline ('\n') enclosed. Otherwise it defaults
261 * back to KERN_DEFAULT.
262 */
258#define pr_cont(fmt, ...) \ 263#define pr_cont(fmt, ...) \
259 printk(KERN_CONT fmt, ##__VA_ARGS__) 264 printk(KERN_CONT fmt, ##__VA_ARGS__)
260 265
diff --git a/include/linux/property.h b/include/linux/property.h
index a6a3d98bd7e9..de8bdf417a35 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -13,6 +13,7 @@
13#ifndef _LINUX_PROPERTY_H_ 13#ifndef _LINUX_PROPERTY_H_
14#define _LINUX_PROPERTY_H_ 14#define _LINUX_PROPERTY_H_
15 15
16#include <linux/fwnode.h>
16#include <linux/types.h> 17#include <linux/types.h>
17 18
18struct device; 19struct device;
@@ -40,16 +41,6 @@ int device_property_read_string_array(struct device *dev, const char *propname,
40int device_property_read_string(struct device *dev, const char *propname, 41int device_property_read_string(struct device *dev, const char *propname,
41 const char **val); 42 const char **val);
42 43
43enum fwnode_type {
44 FWNODE_INVALID = 0,
45 FWNODE_OF,
46 FWNODE_ACPI,
47};
48
49struct fwnode_handle {
50 enum fwnode_type type;
51};
52
53bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname); 44bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname);
54int fwnode_property_read_u8_array(struct fwnode_handle *fwnode, 45int fwnode_property_read_u8_array(struct fwnode_handle *fwnode,
55 const char *propname, u8 *val, 46 const char *propname, u8 *val,
@@ -140,4 +131,37 @@ static inline int fwnode_property_read_u64(struct fwnode_handle *fwnode,
140 return fwnode_property_read_u64_array(fwnode, propname, val, 1); 131 return fwnode_property_read_u64_array(fwnode, propname, val, 1);
141} 132}
142 133
134/**
135 * struct property_entry - "Built-in" device property representation.
136 * @name: Name of the property.
137 * @type: Type of the property.
138 * @nval: Number of items of type @type making up the value.
139 * @value: Value of the property (an array of @nval items of type @type).
140 */
141struct property_entry {
142 const char *name;
143 enum dev_prop_type type;
144 size_t nval;
145 union {
146 void *raw_data;
147 u8 *u8_data;
148 u16 *u16_data;
149 u32 *u32_data;
150 u64 *u64_data;
151 const char **str;
152 } value;
153};
154
155/**
156 * struct property_set - Collection of "built-in" device properties.
157 * @fwnode: Handle to be pointed to by the fwnode field of struct device.
158 * @properties: Array of properties terminated with a null entry.
159 */
160struct property_set {
161 struct fwnode_handle fwnode;
162 struct property_entry *properties;
163};
164
165void device_add_property_set(struct device *dev, struct property_set *pset);
166
143#endif /* _LINUX_PROPERTY_H_ */ 167#endif /* _LINUX_PROPERTY_H_ */
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 8884f6e507f7..8e7a25b068b0 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -40,6 +40,7 @@ enum pstore_type_id {
40 PSTORE_TYPE_PPC_OF = 5, 40 PSTORE_TYPE_PPC_OF = 5,
41 PSTORE_TYPE_PPC_COMMON = 6, 41 PSTORE_TYPE_PPC_COMMON = 6,
42 PSTORE_TYPE_PMSG = 7, 42 PSTORE_TYPE_PMSG = 7,
43 PSTORE_TYPE_PPC_OPAL = 8,
43 PSTORE_TYPE_UNKNOWN = 255 44 PSTORE_TYPE_UNKNOWN = 255
44}; 45};
45 46
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index 0d8ff3fb84ba..b8b73066d137 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -64,11 +64,11 @@ struct ptp_clock_request {
64 * @adjtime: Shifts the time of the hardware clock. 64 * @adjtime: Shifts the time of the hardware clock.
65 * parameter delta: Desired change in nanoseconds. 65 * parameter delta: Desired change in nanoseconds.
66 * 66 *
67 * @gettime: Reads the current time from the hardware clock. 67 * @gettime64: Reads the current time from the hardware clock.
68 * parameter ts: Holds the result. 68 * parameter ts: Holds the result.
69 * 69 *
70 * @settime: Set the current time on the hardware clock. 70 * @settime64: Set the current time on the hardware clock.
71 * parameter ts: Time value to set. 71 * parameter ts: Time value to set.
72 * 72 *
73 * @enable: Request driver to enable or disable an ancillary feature. 73 * @enable: Request driver to enable or disable an ancillary feature.
74 * parameter request: Desired resource to enable or disable. 74 * parameter request: Desired resource to enable or disable.
@@ -104,8 +104,8 @@ struct ptp_clock_info {
104 struct ptp_pin_desc *pin_config; 104 struct ptp_pin_desc *pin_config;
105 int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta); 105 int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta);
106 int (*adjtime)(struct ptp_clock_info *ptp, s64 delta); 106 int (*adjtime)(struct ptp_clock_info *ptp, s64 delta);
107 int (*gettime)(struct ptp_clock_info *ptp, struct timespec *ts); 107 int (*gettime64)(struct ptp_clock_info *ptp, struct timespec64 *ts);
108 int (*settime)(struct ptp_clock_info *ptp, const struct timespec *ts); 108 int (*settime64)(struct ptp_clock_info *p, const struct timespec64 *ts);
109 int (*enable)(struct ptp_clock_info *ptp, 109 int (*enable)(struct ptp_clock_info *ptp,
110 struct ptp_clock_request *request, int on); 110 struct ptp_clock_request *request, int on);
111 int (*verify)(struct ptp_clock_info *ptp, unsigned int pin, 111 int (*verify)(struct ptp_clock_info *ptp, unsigned int pin,
diff --git a/include/linux/quota.h b/include/linux/quota.h
index d534e8ed308a..b2505acfd3c0 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -50,6 +50,7 @@
50 50
51#undef USRQUOTA 51#undef USRQUOTA
52#undef GRPQUOTA 52#undef GRPQUOTA
53#undef PRJQUOTA
53enum quota_type { 54enum quota_type {
54 USRQUOTA = 0, /* element used for user quotas */ 55 USRQUOTA = 0, /* element used for user quotas */
55 GRPQUOTA = 1, /* element used for group quotas */ 56 GRPQUOTA = 1, /* element used for group quotas */
@@ -319,6 +320,7 @@ struct dquot_operations {
319 /* get reserved quota for delayed alloc, value returned is managed by 320 /* get reserved quota for delayed alloc, value returned is managed by
320 * quota code only */ 321 * quota code only */
321 qsize_t *(*get_reserved_space) (struct inode *); 322 qsize_t *(*get_reserved_space) (struct inode *);
323 int (*get_projid) (struct inode *, kprojid_t *);/* Get project ID */
322}; 324};
323 325
324struct path; 326struct path;
@@ -344,7 +346,10 @@ struct qc_dqblk {
344 int d_rt_spc_warns; /* # warnings issued wrt RT space */ 346 int d_rt_spc_warns; /* # warnings issued wrt RT space */
345}; 347};
346 348
347/* Field specifiers for ->set_dqblk() in struct qc_dqblk */ 349/*
350 * Field specifiers for ->set_dqblk() in struct qc_dqblk and also for
351 * ->set_info() in struct qc_info
352 */
348#define QC_INO_SOFT (1<<0) 353#define QC_INO_SOFT (1<<0)
349#define QC_INO_HARD (1<<1) 354#define QC_INO_HARD (1<<1)
350#define QC_SPC_SOFT (1<<2) 355#define QC_SPC_SOFT (1<<2)
@@ -365,6 +370,51 @@ struct qc_dqblk {
365#define QC_INO_COUNT (1<<13) 370#define QC_INO_COUNT (1<<13)
366#define QC_RT_SPACE (1<<14) 371#define QC_RT_SPACE (1<<14)
367#define QC_ACCT_MASK (QC_SPACE | QC_INO_COUNT | QC_RT_SPACE) 372#define QC_ACCT_MASK (QC_SPACE | QC_INO_COUNT | QC_RT_SPACE)
373#define QC_FLAGS (1<<15)
374
375#define QCI_SYSFILE (1 << 0) /* Quota file is hidden from userspace */
376#define QCI_ROOT_SQUASH (1 << 1) /* Root squash turned on */
377#define QCI_ACCT_ENABLED (1 << 2) /* Quota accounting enabled */
378#define QCI_LIMITS_ENFORCED (1 << 3) /* Quota limits enforced */
379
380/* Structures for communicating via ->get_state */
381struct qc_type_state {
382 unsigned int flags; /* Flags QCI_* */
383 unsigned int spc_timelimit; /* Time after which space softlimit is
384 * enforced */
385 unsigned int ino_timelimit; /* Ditto for inode softlimit */
386 unsigned int rt_spc_timelimit; /* Ditto for real-time space */
387 unsigned int spc_warnlimit; /* Limit for number of space warnings */
388 unsigned int ino_warnlimit; /* Ditto for inodes */
389 unsigned int rt_spc_warnlimit; /* Ditto for real-time space */
390 unsigned long long ino; /* Inode number of quota file */
391 blkcnt_t blocks; /* Number of 512-byte blocks in the file */
392 blkcnt_t nextents; /* Number of extents in the file */
393};
394
395struct qc_state {
396 unsigned int s_incoredqs; /* Number of dquots in core */
397 /*
398 * Per quota type information. The array should really have
399 * max(MAXQUOTAS, XQM_MAXQUOTAS) entries. BUILD_BUG_ON in
400 * quota_getinfo() makes sure XQM_MAXQUOTAS is large enough. Once VFS
401 * supports project quotas, this can be changed to MAXQUOTAS
402 */
403 struct qc_type_state s_state[XQM_MAXQUOTAS];
404};
405
406/* Structure for communicating via ->set_info */
407struct qc_info {
408 int i_fieldmask; /* mask of fields to change in ->set_info() */
409 unsigned int i_flags; /* Flags QCI_* */
410 unsigned int i_spc_timelimit; /* Time after which space softlimit is
411 * enforced */
412 unsigned int i_ino_timelimit; /* Ditto for inode softlimit */
413 unsigned int i_rt_spc_timelimit;/* Ditto for real-time space */
414 unsigned int i_spc_warnlimit; /* Limit for number of space warnings */
415 unsigned int i_ino_warnlimit; /* Limit for number of inode warnings */
416 unsigned int i_rt_spc_warnlimit; /* Ditto for real-time space */
417};
368 418
369/* Operations handling requests from userspace */ 419/* Operations handling requests from userspace */
370struct quotactl_ops { 420struct quotactl_ops {
@@ -373,12 +423,10 @@ struct quotactl_ops {
373 int (*quota_enable)(struct super_block *, unsigned int); 423 int (*quota_enable)(struct super_block *, unsigned int);
374 int (*quota_disable)(struct super_block *, unsigned int); 424 int (*quota_disable)(struct super_block *, unsigned int);
375 int (*quota_sync)(struct super_block *, int); 425 int (*quota_sync)(struct super_block *, int);
376 int (*get_info)(struct super_block *, int, struct if_dqinfo *); 426 int (*set_info)(struct super_block *, int, struct qc_info *);
377 int (*set_info)(struct super_block *, int, struct if_dqinfo *);
378 int (*get_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *); 427 int (*get_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *);
379 int (*set_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *); 428 int (*set_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *);
380 int (*get_xstate)(struct super_block *, struct fs_quota_stat *); 429 int (*get_state)(struct super_block *, struct qc_state *);
381 int (*get_xstatev)(struct super_block *, struct fs_quota_statv *);
382 int (*rm_xquota)(struct super_block *, unsigned int); 430 int (*rm_xquota)(struct super_block *, unsigned int);
383}; 431};
384 432
@@ -389,7 +437,19 @@ struct quota_format_type {
389 struct quota_format_type *qf_next; 437 struct quota_format_type *qf_next;
390}; 438};
391 439
392/* Quota state flags - they actually come in two flavors - for users and groups */ 440/**
441 * Quota state flags - they actually come in two flavors - for users and groups.
442 *
443 * Actual typed flags layout:
444 * USRQUOTA GRPQUOTA
445 * DQUOT_USAGE_ENABLED 0x0001 0x0002
446 * DQUOT_LIMITS_ENABLED 0x0004 0x0008
447 * DQUOT_SUSPENDED 0x0010 0x0020
448 *
449 * Following bits are used for non-typed flags:
450 * DQUOT_QUOTA_SYS_FILE 0x0040
451 * DQUOT_NEGATIVE_USAGE 0x0080
452 */
393enum { 453enum {
394 _DQUOT_USAGE_ENABLED = 0, /* Track disk usage for users */ 454 _DQUOT_USAGE_ENABLED = 0, /* Track disk usage for users */
395 _DQUOT_LIMITS_ENABLED, /* Enforce quota limits for users */ 455 _DQUOT_LIMITS_ENABLED, /* Enforce quota limits for users */
@@ -398,9 +458,9 @@ enum {
398 * memory to turn them on */ 458 * memory to turn them on */
399 _DQUOT_STATE_FLAGS 459 _DQUOT_STATE_FLAGS
400}; 460};
401#define DQUOT_USAGE_ENABLED (1 << _DQUOT_USAGE_ENABLED) 461#define DQUOT_USAGE_ENABLED (1 << _DQUOT_USAGE_ENABLED * MAXQUOTAS)
402#define DQUOT_LIMITS_ENABLED (1 << _DQUOT_LIMITS_ENABLED) 462#define DQUOT_LIMITS_ENABLED (1 << _DQUOT_LIMITS_ENABLED * MAXQUOTAS)
403#define DQUOT_SUSPENDED (1 << _DQUOT_SUSPENDED) 463#define DQUOT_SUSPENDED (1 << _DQUOT_SUSPENDED * MAXQUOTAS)
404#define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \ 464#define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \
405 DQUOT_SUSPENDED) 465 DQUOT_SUSPENDED)
406/* Other quota flags */ 466/* Other quota flags */
@@ -414,15 +474,21 @@ enum {
414 */ 474 */
415#define DQUOT_NEGATIVE_USAGE (1 << (DQUOT_STATE_LAST + 1)) 475#define DQUOT_NEGATIVE_USAGE (1 << (DQUOT_STATE_LAST + 1))
416 /* Allow negative quota usage */ 476 /* Allow negative quota usage */
417
418static inline unsigned int dquot_state_flag(unsigned int flags, int type) 477static inline unsigned int dquot_state_flag(unsigned int flags, int type)
419{ 478{
420 return flags << _DQUOT_STATE_FLAGS * type; 479 return flags << type;
421} 480}
422 481
423static inline unsigned int dquot_generic_flag(unsigned int flags, int type) 482static inline unsigned int dquot_generic_flag(unsigned int flags, int type)
424{ 483{
425 return (flags >> _DQUOT_STATE_FLAGS * type) & DQUOT_STATE_FLAGS; 484 return (flags >> type) & DQUOT_STATE_FLAGS;
485}
486
487/* Bitmap of quota types where flag is set in flags */
488static __always_inline unsigned dquot_state_types(unsigned flags, unsigned flag)
489{
490 BUILD_BUG_ON_NOT_POWER_OF_2(flag);
491 return (flags / flag) & ((1 << MAXQUOTAS) - 1);
426} 492}
427 493
428#ifdef CONFIG_QUOTA_NETLINK_INTERFACE 494#ifdef CONFIG_QUOTA_NETLINK_INTERFACE
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index df73258cca47..77ca6601ff25 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -95,8 +95,8 @@ int dquot_quota_on_mount(struct super_block *sb, char *qf_name,
95int dquot_quota_off(struct super_block *sb, int type); 95int dquot_quota_off(struct super_block *sb, int type);
96int dquot_writeback_dquots(struct super_block *sb, int type); 96int dquot_writeback_dquots(struct super_block *sb, int type);
97int dquot_quota_sync(struct super_block *sb, int type); 97int dquot_quota_sync(struct super_block *sb, int type);
98int dquot_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 98int dquot_get_state(struct super_block *sb, struct qc_state *state);
99int dquot_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 99int dquot_set_dqinfo(struct super_block *sb, int type, struct qc_info *ii);
100int dquot_get_dqblk(struct super_block *sb, struct kqid id, 100int dquot_get_dqblk(struct super_block *sb, struct kqid id,
101 struct qc_dqblk *di); 101 struct qc_dqblk *di);
102int dquot_set_dqblk(struct super_block *sb, struct kqid id, 102int dquot_set_dqblk(struct super_block *sb, struct kqid id,
@@ -134,10 +134,7 @@ static inline bool sb_has_quota_suspended(struct super_block *sb, int type)
134 134
135static inline unsigned sb_any_quota_suspended(struct super_block *sb) 135static inline unsigned sb_any_quota_suspended(struct super_block *sb)
136{ 136{
137 unsigned type, tmsk = 0; 137 return dquot_state_types(sb_dqopt(sb)->flags, DQUOT_SUSPENDED);
138 for (type = 0; type < MAXQUOTAS; type++)
139 tmsk |= sb_has_quota_suspended(sb, type) << type;
140 return tmsk;
141} 138}
142 139
143/* Does kernel know about any quota information for given sb + type? */ 140/* Does kernel know about any quota information for given sb + type? */
@@ -149,10 +146,7 @@ static inline bool sb_has_quota_loaded(struct super_block *sb, int type)
149 146
150static inline unsigned sb_any_quota_loaded(struct super_block *sb) 147static inline unsigned sb_any_quota_loaded(struct super_block *sb)
151{ 148{
152 unsigned type, tmsk = 0; 149 return dquot_state_types(sb_dqopt(sb)->flags, DQUOT_USAGE_ENABLED);
153 for (type = 0; type < MAXQUOTAS; type++)
154 tmsk |= sb_has_quota_loaded(sb, type) << type;
155 return tmsk;
156} 150}
157 151
158static inline bool sb_has_quota_active(struct super_block *sb, int type) 152static inline bool sb_has_quota_active(struct super_block *sb, int type)
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 78097491cd99..573a5afd5ed8 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -48,6 +48,26 @@
48 48
49extern int rcu_expedited; /* for sysctl */ 49extern int rcu_expedited; /* for sysctl */
50 50
51#ifdef CONFIG_TINY_RCU
52/* Tiny RCU doesn't expedite, as its purpose in life is instead to be tiny. */
53static inline bool rcu_gp_is_expedited(void) /* Internal RCU use. */
54{
55 return false;
56}
57
58static inline void rcu_expedite_gp(void)
59{
60}
61
62static inline void rcu_unexpedite_gp(void)
63{
64}
65#else /* #ifdef CONFIG_TINY_RCU */
66bool rcu_gp_is_expedited(void); /* Internal RCU use. */
67void rcu_expedite_gp(void);
68void rcu_unexpedite_gp(void);
69#endif /* #else #ifdef CONFIG_TINY_RCU */
70
51enum rcutorture_type { 71enum rcutorture_type {
52 RCU_FLAVOR, 72 RCU_FLAVOR,
53 RCU_BH_FLAVOR, 73 RCU_BH_FLAVOR,
@@ -195,6 +215,15 @@ void call_rcu_sched(struct rcu_head *head,
195 215
196void synchronize_sched(void); 216void synchronize_sched(void);
197 217
218/*
219 * Structure allowing asynchronous waiting on RCU.
220 */
221struct rcu_synchronize {
222 struct rcu_head head;
223 struct completion completion;
224};
225void wakeme_after_rcu(struct rcu_head *head);
226
198/** 227/**
199 * call_rcu_tasks() - Queue an RCU for invocation task-based grace period 228 * call_rcu_tasks() - Queue an RCU for invocation task-based grace period
200 * @head: structure to be used for queueing the RCU updates. 229 * @head: structure to be used for queueing the RCU updates.
@@ -258,6 +287,7 @@ static inline int rcu_preempt_depth(void)
258 287
259/* Internal to kernel */ 288/* Internal to kernel */
260void rcu_init(void); 289void rcu_init(void);
290void rcu_end_inkernel_boot(void);
261void rcu_sched_qs(void); 291void rcu_sched_qs(void);
262void rcu_bh_qs(void); 292void rcu_bh_qs(void);
263void rcu_check_callbacks(int user); 293void rcu_check_callbacks(int user);
@@ -266,6 +296,8 @@ void rcu_idle_enter(void);
266void rcu_idle_exit(void); 296void rcu_idle_exit(void);
267void rcu_irq_enter(void); 297void rcu_irq_enter(void);
268void rcu_irq_exit(void); 298void rcu_irq_exit(void);
299int rcu_cpu_notify(struct notifier_block *self,
300 unsigned long action, void *hcpu);
269 301
270#ifdef CONFIG_RCU_STALL_COMMON 302#ifdef CONFIG_RCU_STALL_COMMON
271void rcu_sysrq_start(void); 303void rcu_sysrq_start(void);
@@ -720,7 +752,7 @@ static inline void rcu_preempt_sleep_check(void)
720 * annotated as __rcu. 752 * annotated as __rcu.
721 */ 753 */
722#define rcu_dereference_check(p, c) \ 754#define rcu_dereference_check(p, c) \
723 __rcu_dereference_check((p), rcu_read_lock_held() || (c), __rcu) 755 __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
724 756
725/** 757/**
726 * rcu_dereference_bh_check() - rcu_dereference_bh with debug checking 758 * rcu_dereference_bh_check() - rcu_dereference_bh with debug checking
@@ -730,7 +762,7 @@ static inline void rcu_preempt_sleep_check(void)
730 * This is the RCU-bh counterpart to rcu_dereference_check(). 762 * This is the RCU-bh counterpart to rcu_dereference_check().
731 */ 763 */
732#define rcu_dereference_bh_check(p, c) \ 764#define rcu_dereference_bh_check(p, c) \
733 __rcu_dereference_check((p), rcu_read_lock_bh_held() || (c), __rcu) 765 __rcu_dereference_check((p), (c) || rcu_read_lock_bh_held(), __rcu)
734 766
735/** 767/**
736 * rcu_dereference_sched_check() - rcu_dereference_sched with debug checking 768 * rcu_dereference_sched_check() - rcu_dereference_sched with debug checking
@@ -740,7 +772,7 @@ static inline void rcu_preempt_sleep_check(void)
740 * This is the RCU-sched counterpart to rcu_dereference_check(). 772 * This is the RCU-sched counterpart to rcu_dereference_check().
741 */ 773 */
742#define rcu_dereference_sched_check(p, c) \ 774#define rcu_dereference_sched_check(p, c) \
743 __rcu_dereference_check((p), rcu_read_lock_sched_held() || (c), \ 775 __rcu_dereference_check((p), (c) || rcu_read_lock_sched_held(), \
744 __rcu) 776 __rcu)
745 777
746#define rcu_dereference_raw(p) rcu_dereference_check(p, 1) /*@@@ needed? @@@*/ 778#define rcu_dereference_raw(p) rcu_dereference_check(p, 1) /*@@@ needed? @@@*/
@@ -933,9 +965,9 @@ static inline void rcu_read_unlock(void)
933{ 965{
934 rcu_lockdep_assert(rcu_is_watching(), 966 rcu_lockdep_assert(rcu_is_watching(),
935 "rcu_read_unlock() used illegally while idle"); 967 "rcu_read_unlock() used illegally while idle");
936 rcu_lock_release(&rcu_lock_map);
937 __release(RCU); 968 __release(RCU);
938 __rcu_read_unlock(); 969 __rcu_read_unlock();
970 rcu_lock_release(&rcu_lock_map); /* Keep acq info for rls diags. */
939} 971}
940 972
941/** 973/**
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 67fc8fcdc4b0..a7ff409f386d 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -70,7 +70,8 @@ void ctrl_alt_del(void);
70#define POWEROFF_CMD_PATH_LEN 256 70#define POWEROFF_CMD_PATH_LEN 256
71extern char poweroff_cmd[POWEROFF_CMD_PATH_LEN]; 71extern char poweroff_cmd[POWEROFF_CMD_PATH_LEN];
72 72
73extern int orderly_poweroff(bool force); 73extern void orderly_poweroff(bool force);
74extern void orderly_reboot(void);
74 75
75/* 76/*
76 * Emergency restart, callable from an interrupt handler. 77 * Emergency restart, callable from an interrupt handler.
diff --git a/include/linux/regulator/act8865.h b/include/linux/regulator/act8865.h
index b6c4909b33af..15fa8f2d35c9 100644
--- a/include/linux/regulator/act8865.h
+++ b/include/linux/regulator/act8865.h
@@ -19,6 +19,19 @@
19#include <linux/regulator/machine.h> 19#include <linux/regulator/machine.h>
20 20
21enum { 21enum {
22 ACT8600_ID_DCDC1,
23 ACT8600_ID_DCDC2,
24 ACT8600_ID_DCDC3,
25 ACT8600_ID_SUDCDC4,
26 ACT8600_ID_LDO5,
27 ACT8600_ID_LDO6,
28 ACT8600_ID_LDO7,
29 ACT8600_ID_LDO8,
30 ACT8600_ID_LDO9,
31 ACT8600_ID_LDO10,
32};
33
34enum {
22 ACT8865_ID_DCDC1, 35 ACT8865_ID_DCDC1,
23 ACT8865_ID_DCDC2, 36 ACT8865_ID_DCDC2,
24 ACT8865_ID_DCDC3, 37 ACT8865_ID_DCDC3,
@@ -46,6 +59,7 @@ enum {
46}; 59};
47 60
48enum { 61enum {
62 ACT8600,
49 ACT8865, 63 ACT8865,
50 ACT8846, 64 ACT8846,
51}; 65};
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index d17e1ff7ad01..f8a689ed62a5 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -114,7 +114,7 @@ struct regmap;
114#define REGULATOR_EVENT_OVER_TEMP 0x10 114#define REGULATOR_EVENT_OVER_TEMP 0x10
115#define REGULATOR_EVENT_FORCE_DISABLE 0x20 115#define REGULATOR_EVENT_FORCE_DISABLE 0x20
116#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40 116#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40
117#define REGULATOR_EVENT_DISABLE 0x80 117#define REGULATOR_EVENT_DISABLE 0x80
118#define REGULATOR_EVENT_PRE_VOLTAGE_CHANGE 0x100 118#define REGULATOR_EVENT_PRE_VOLTAGE_CHANGE 0x100
119#define REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE 0x200 119#define REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE 0x200
120#define REGULATOR_EVENT_PRE_DISABLE 0x400 120#define REGULATOR_EVENT_PRE_DISABLE 0x400
@@ -238,7 +238,7 @@ int regulator_get_current_limit(struct regulator *regulator);
238 238
239int regulator_set_mode(struct regulator *regulator, unsigned int mode); 239int regulator_set_mode(struct regulator *regulator, unsigned int mode);
240unsigned int regulator_get_mode(struct regulator *regulator); 240unsigned int regulator_get_mode(struct regulator *regulator);
241int regulator_set_optimum_mode(struct regulator *regulator, int load_uA); 241int regulator_set_load(struct regulator *regulator, int load_uA);
242 242
243int regulator_allow_bypass(struct regulator *regulator, bool allow); 243int regulator_allow_bypass(struct regulator *regulator, bool allow);
244 244
@@ -252,8 +252,12 @@ int regulator_list_hardware_vsel(struct regulator *regulator,
252/* regulator notifier block */ 252/* regulator notifier block */
253int regulator_register_notifier(struct regulator *regulator, 253int regulator_register_notifier(struct regulator *regulator,
254 struct notifier_block *nb); 254 struct notifier_block *nb);
255int devm_regulator_register_notifier(struct regulator *regulator,
256 struct notifier_block *nb);
255int regulator_unregister_notifier(struct regulator *regulator, 257int regulator_unregister_notifier(struct regulator *regulator,
256 struct notifier_block *nb); 258 struct notifier_block *nb);
259void devm_regulator_unregister_notifier(struct regulator *regulator,
260 struct notifier_block *nb);
257 261
258/* driver data - core doesn't touch */ 262/* driver data - core doesn't touch */
259void *regulator_get_drvdata(struct regulator *regulator); 263void *regulator_get_drvdata(struct regulator *regulator);
@@ -479,8 +483,7 @@ static inline unsigned int regulator_get_mode(struct regulator *regulator)
479 return REGULATOR_MODE_NORMAL; 483 return REGULATOR_MODE_NORMAL;
480} 484}
481 485
482static inline int regulator_set_optimum_mode(struct regulator *regulator, 486static inline int regulator_set_load(struct regulator *regulator, int load_uA)
483 int load_uA)
484{ 487{
485 return REGULATOR_MODE_NORMAL; 488 return REGULATOR_MODE_NORMAL;
486} 489}
@@ -515,12 +518,24 @@ static inline int regulator_register_notifier(struct regulator *regulator,
515 return 0; 518 return 0;
516} 519}
517 520
521static inline int devm_regulator_register_notifier(struct regulator *regulator,
522 struct notifier_block *nb)
523{
524 return 0;
525}
526
518static inline int regulator_unregister_notifier(struct regulator *regulator, 527static inline int regulator_unregister_notifier(struct regulator *regulator,
519 struct notifier_block *nb) 528 struct notifier_block *nb)
520{ 529{
521 return 0; 530 return 0;
522} 531}
523 532
533static inline int devm_regulator_unregister_notifier(struct regulator *regulator,
534 struct notifier_block *nb)
535{
536 return 0;
537}
538
524static inline void *regulator_get_drvdata(struct regulator *regulator) 539static inline void *regulator_get_drvdata(struct regulator *regulator)
525{ 540{
526 return NULL; 541 return NULL;
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 045f709cb89b..fffa688ac3a7 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -98,6 +98,7 @@ struct regulator_linear_range {
98 * REGULATOR_STATUS value (or negative errno) 98 * REGULATOR_STATUS value (or negative errno)
99 * @get_optimum_mode: Get the most efficient operating mode for the regulator 99 * @get_optimum_mode: Get the most efficient operating mode for the regulator
100 * when running with the specified parameters. 100 * when running with the specified parameters.
101 * @set_load: Set the load for the regulator.
101 * 102 *
102 * @set_bypass: Set the regulator in bypass mode. 103 * @set_bypass: Set the regulator in bypass mode.
103 * @get_bypass: Get the regulator bypass mode state. 104 * @get_bypass: Get the regulator bypass mode state.
@@ -167,6 +168,8 @@ struct regulator_ops {
167 /* get most efficient regulator operating mode for load */ 168 /* get most efficient regulator operating mode for load */
168 unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV, 169 unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV,
169 int output_uV, int load_uA); 170 int output_uV, int load_uA);
171 /* set the load on the regulator */
172 int (*set_load)(struct regulator_dev *, int load_uA);
170 173
171 /* control and report on bypass mode */ 174 /* control and report on bypass mode */
172 int (*set_bypass)(struct regulator_dev *dev, bool enable); 175 int (*set_bypass)(struct regulator_dev *dev, bool enable);
@@ -367,6 +370,7 @@ struct regulator_dev {
367 struct device dev; 370 struct device dev;
368 struct regulation_constraints *constraints; 371 struct regulation_constraints *constraints;
369 struct regulator *supply; /* for tree */ 372 struct regulator *supply; /* for tree */
373 const char *supply_name;
370 struct regmap *regmap; 374 struct regmap *regmap;
371 375
372 struct delayed_work disable_work; 376 struct delayed_work disable_work;
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index d438eeb08bff..e23d242d1230 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -1,14 +1,13 @@
1/* 1/*
2 * Resizable, Scalable, Concurrent Hash Table 2 * Resizable, Scalable, Concurrent Hash Table
3 * 3 *
4 * Copyright (c) 2014 Thomas Graf <tgraf@suug.ch> 4 * Copyright (c) 2015 Herbert Xu <herbert@gondor.apana.org.au>
5 * Copyright (c) 2014-2015 Thomas Graf <tgraf@suug.ch>
5 * Copyright (c) 2008-2014 Patrick McHardy <kaber@trash.net> 6 * Copyright (c) 2008-2014 Patrick McHardy <kaber@trash.net>
6 * 7 *
7 * Based on the following paper by Josh Triplett, Paul E. McKenney
8 * and Jonathan Walpole:
9 * https://www.usenix.org/legacy/event/atc11/tech/final_files/Triplett.pdf
10 *
11 * Code partially derived from nft_hash 8 * Code partially derived from nft_hash
9 * Rewritten with rehash code from br_multicast plus single list
10 * pointer as suggested by Josh Triplett
12 * 11 *
13 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as 13 * it under the terms of the GNU General Public License version 2 as
@@ -19,9 +18,12 @@
19#define _LINUX_RHASHTABLE_H 18#define _LINUX_RHASHTABLE_H
20 19
21#include <linux/compiler.h> 20#include <linux/compiler.h>
21#include <linux/errno.h>
22#include <linux/jhash.h>
22#include <linux/list_nulls.h> 23#include <linux/list_nulls.h>
23#include <linux/workqueue.h> 24#include <linux/workqueue.h>
24#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/rcupdate.h>
25 27
26/* 28/*
27 * The end of the chain is marked with a special nulls marks which has 29 * The end of the chain is marked with a special nulls marks which has
@@ -42,6 +44,9 @@
42#define RHT_HASH_BITS 27 44#define RHT_HASH_BITS 27
43#define RHT_BASE_SHIFT RHT_HASH_BITS 45#define RHT_BASE_SHIFT RHT_HASH_BITS
44 46
47/* Base bits plus 1 bit for nulls marker */
48#define RHT_HASH_RESERVED_SPACE (RHT_BASE_BITS + 1)
49
45struct rhash_head { 50struct rhash_head {
46 struct rhash_head __rcu *next; 51 struct rhash_head __rcu *next;
47}; 52};
@@ -49,20 +54,43 @@ struct rhash_head {
49/** 54/**
50 * struct bucket_table - Table of hash buckets 55 * struct bucket_table - Table of hash buckets
51 * @size: Number of hash buckets 56 * @size: Number of hash buckets
57 * @rehash: Current bucket being rehashed
58 * @hash_rnd: Random seed to fold into hash
52 * @locks_mask: Mask to apply before accessing locks[] 59 * @locks_mask: Mask to apply before accessing locks[]
53 * @locks: Array of spinlocks protecting individual buckets 60 * @locks: Array of spinlocks protecting individual buckets
61 * @walkers: List of active walkers
62 * @rcu: RCU structure for freeing the table
63 * @future_tbl: Table under construction during rehashing
54 * @buckets: size * hash buckets 64 * @buckets: size * hash buckets
55 */ 65 */
56struct bucket_table { 66struct bucket_table {
57 size_t size; 67 unsigned int size;
68 unsigned int rehash;
69 u32 hash_rnd;
58 unsigned int locks_mask; 70 unsigned int locks_mask;
59 spinlock_t *locks; 71 spinlock_t *locks;
72 struct list_head walkers;
73 struct rcu_head rcu;
74
75 struct bucket_table __rcu *future_tbl;
60 76
61 struct rhash_head __rcu *buckets[] ____cacheline_aligned_in_smp; 77 struct rhash_head __rcu *buckets[] ____cacheline_aligned_in_smp;
62}; 78};
63 79
80/**
81 * struct rhashtable_compare_arg - Key for the function rhashtable_compare
82 * @ht: Hash table
83 * @key: Key to compare against
84 */
85struct rhashtable_compare_arg {
86 struct rhashtable *ht;
87 const void *key;
88};
89
64typedef u32 (*rht_hashfn_t)(const void *data, u32 len, u32 seed); 90typedef u32 (*rht_hashfn_t)(const void *data, u32 len, u32 seed);
65typedef u32 (*rht_obj_hashfn_t)(const void *data, u32 seed); 91typedef u32 (*rht_obj_hashfn_t)(const void *data, u32 len, u32 seed);
92typedef int (*rht_obj_cmpfn_t)(struct rhashtable_compare_arg *arg,
93 const void *obj);
66 94
67struct rhashtable; 95struct rhashtable;
68 96
@@ -72,60 +100,62 @@ struct rhashtable;
72 * @key_len: Length of key 100 * @key_len: Length of key
73 * @key_offset: Offset of key in struct to be hashed 101 * @key_offset: Offset of key in struct to be hashed
74 * @head_offset: Offset of rhash_head in struct to be hashed 102 * @head_offset: Offset of rhash_head in struct to be hashed
75 * @hash_rnd: Seed to use while hashing 103 * @max_size: Maximum size while expanding
76 * @max_shift: Maximum number of shifts while expanding 104 * @min_size: Minimum size while shrinking
77 * @min_shift: Minimum number of shifts while shrinking
78 * @nulls_base: Base value to generate nulls marker 105 * @nulls_base: Base value to generate nulls marker
106 * @insecure_elasticity: Set to true to disable chain length checks
107 * @automatic_shrinking: Enable automatic shrinking of tables
79 * @locks_mul: Number of bucket locks to allocate per cpu (default: 128) 108 * @locks_mul: Number of bucket locks to allocate per cpu (default: 128)
80 * @hashfn: Function to hash key 109 * @hashfn: Hash function (default: jhash2 if !(key_len % 4), or jhash)
81 * @obj_hashfn: Function to hash object 110 * @obj_hashfn: Function to hash object
111 * @obj_cmpfn: Function to compare key with object
82 */ 112 */
83struct rhashtable_params { 113struct rhashtable_params {
84 size_t nelem_hint; 114 size_t nelem_hint;
85 size_t key_len; 115 size_t key_len;
86 size_t key_offset; 116 size_t key_offset;
87 size_t head_offset; 117 size_t head_offset;
88 u32 hash_rnd; 118 unsigned int max_size;
89 size_t max_shift; 119 unsigned int min_size;
90 size_t min_shift;
91 u32 nulls_base; 120 u32 nulls_base;
121 bool insecure_elasticity;
122 bool automatic_shrinking;
92 size_t locks_mul; 123 size_t locks_mul;
93 rht_hashfn_t hashfn; 124 rht_hashfn_t hashfn;
94 rht_obj_hashfn_t obj_hashfn; 125 rht_obj_hashfn_t obj_hashfn;
126 rht_obj_cmpfn_t obj_cmpfn;
95}; 127};
96 128
97/** 129/**
98 * struct rhashtable - Hash table handle 130 * struct rhashtable - Hash table handle
99 * @tbl: Bucket table 131 * @tbl: Bucket table
100 * @future_tbl: Table under construction during expansion/shrinking
101 * @nelems: Number of elements in table 132 * @nelems: Number of elements in table
102 * @shift: Current size (1 << shift) 133 * @key_len: Key length for hashfn
134 * @elasticity: Maximum chain length before rehash
103 * @p: Configuration parameters 135 * @p: Configuration parameters
104 * @run_work: Deferred worker to expand/shrink asynchronously 136 * @run_work: Deferred worker to expand/shrink asynchronously
105 * @mutex: Mutex to protect current/future table swapping 137 * @mutex: Mutex to protect current/future table swapping
106 * @walkers: List of active walkers 138 * @lock: Spin lock to protect walker list
107 * @being_destroyed: True if table is set up for destruction
108 */ 139 */
109struct rhashtable { 140struct rhashtable {
110 struct bucket_table __rcu *tbl; 141 struct bucket_table __rcu *tbl;
111 struct bucket_table __rcu *future_tbl;
112 atomic_t nelems; 142 atomic_t nelems;
113 atomic_t shift; 143 unsigned int key_len;
144 unsigned int elasticity;
114 struct rhashtable_params p; 145 struct rhashtable_params p;
115 struct work_struct run_work; 146 struct work_struct run_work;
116 struct mutex mutex; 147 struct mutex mutex;
117 struct list_head walkers; 148 spinlock_t lock;
118 bool being_destroyed;
119}; 149};
120 150
121/** 151/**
122 * struct rhashtable_walker - Hash table walker 152 * struct rhashtable_walker - Hash table walker
123 * @list: List entry on list of walkers 153 * @list: List entry on list of walkers
124 * @resize: Resize event occured 154 * @tbl: The table that we were walking over
125 */ 155 */
126struct rhashtable_walker { 156struct rhashtable_walker {
127 struct list_head list; 157 struct list_head list;
128 bool resize; 158 struct bucket_table *tbl;
129}; 159};
130 160
131/** 161/**
@@ -162,6 +192,118 @@ static inline unsigned long rht_get_nulls_value(const struct rhash_head *ptr)
162 return ((unsigned long) ptr) >> 1; 192 return ((unsigned long) ptr) >> 1;
163} 193}
164 194
195static inline void *rht_obj(const struct rhashtable *ht,
196 const struct rhash_head *he)
197{
198 return (char *)he - ht->p.head_offset;
199}
200
201static inline unsigned int rht_bucket_index(const struct bucket_table *tbl,
202 unsigned int hash)
203{
204 return (hash >> RHT_HASH_RESERVED_SPACE) & (tbl->size - 1);
205}
206
207static inline unsigned int rht_key_hashfn(
208 struct rhashtable *ht, const struct bucket_table *tbl,
209 const void *key, const struct rhashtable_params params)
210{
211 unsigned int hash;
212
213 /* params must be equal to ht->p if it isn't constant. */
214 if (!__builtin_constant_p(params.key_len))
215 hash = ht->p.hashfn(key, ht->key_len, tbl->hash_rnd);
216 else if (params.key_len) {
217 unsigned int key_len = params.key_len;
218
219 if (params.hashfn)
220 hash = params.hashfn(key, key_len, tbl->hash_rnd);
221 else if (key_len & (sizeof(u32) - 1))
222 hash = jhash(key, key_len, tbl->hash_rnd);
223 else
224 hash = jhash2(key, key_len / sizeof(u32),
225 tbl->hash_rnd);
226 } else {
227 unsigned int key_len = ht->p.key_len;
228
229 if (params.hashfn)
230 hash = params.hashfn(key, key_len, tbl->hash_rnd);
231 else
232 hash = jhash(key, key_len, tbl->hash_rnd);
233 }
234
235 return rht_bucket_index(tbl, hash);
236}
237
238static inline unsigned int rht_head_hashfn(
239 struct rhashtable *ht, const struct bucket_table *tbl,
240 const struct rhash_head *he, const struct rhashtable_params params)
241{
242 const char *ptr = rht_obj(ht, he);
243
244 return likely(params.obj_hashfn) ?
245 rht_bucket_index(tbl, params.obj_hashfn(ptr, params.key_len ?:
246 ht->p.key_len,
247 tbl->hash_rnd)) :
248 rht_key_hashfn(ht, tbl, ptr + params.key_offset, params);
249}
250
251/**
252 * rht_grow_above_75 - returns true if nelems > 0.75 * table-size
253 * @ht: hash table
254 * @tbl: current table
255 */
256static inline bool rht_grow_above_75(const struct rhashtable *ht,
257 const struct bucket_table *tbl)
258{
259 /* Expand table when exceeding 75% load */
260 return atomic_read(&ht->nelems) > (tbl->size / 4 * 3) &&
261 (!ht->p.max_size || tbl->size < ht->p.max_size);
262}
263
264/**
265 * rht_shrink_below_30 - returns true if nelems < 0.3 * table-size
266 * @ht: hash table
267 * @tbl: current table
268 */
269static inline bool rht_shrink_below_30(const struct rhashtable *ht,
270 const struct bucket_table *tbl)
271{
272 /* Shrink table beneath 30% load */
273 return atomic_read(&ht->nelems) < (tbl->size * 3 / 10) &&
274 tbl->size > ht->p.min_size;
275}
276
277/**
278 * rht_grow_above_100 - returns true if nelems > table-size
279 * @ht: hash table
280 * @tbl: current table
281 */
282static inline bool rht_grow_above_100(const struct rhashtable *ht,
283 const struct bucket_table *tbl)
284{
285 return atomic_read(&ht->nelems) > tbl->size;
286}
287
288/* The bucket lock is selected based on the hash and protects mutations
289 * on a group of hash buckets.
290 *
291 * A maximum of tbl->size/2 bucket locks is allocated. This ensures that
292 * a single lock always covers both buckets which may both contains
293 * entries which link to the same bucket of the old table during resizing.
294 * This allows to simplify the locking as locking the bucket in both
295 * tables during resize always guarantee protection.
296 *
297 * IMPORTANT: When holding the bucket lock of both the old and new table
298 * during expansions and shrinking, the old bucket lock must always be
299 * acquired first.
300 */
301static inline spinlock_t *rht_bucket_lock(const struct bucket_table *tbl,
302 unsigned int hash)
303{
304 return &tbl->locks[hash & tbl->locks_mask];
305}
306
165#ifdef CONFIG_PROVE_LOCKING 307#ifdef CONFIG_PROVE_LOCKING
166int lockdep_rht_mutex_is_held(struct rhashtable *ht); 308int lockdep_rht_mutex_is_held(struct rhashtable *ht);
167int lockdep_rht_bucket_is_held(const struct bucket_table *tbl, u32 hash); 309int lockdep_rht_bucket_is_held(const struct bucket_table *tbl, u32 hash);
@@ -178,23 +320,13 @@ static inline int lockdep_rht_bucket_is_held(const struct bucket_table *tbl,
178} 320}
179#endif /* CONFIG_PROVE_LOCKING */ 321#endif /* CONFIG_PROVE_LOCKING */
180 322
181int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params); 323int rhashtable_init(struct rhashtable *ht,
182 324 const struct rhashtable_params *params);
183void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node);
184bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node);
185
186int rhashtable_expand(struct rhashtable *ht);
187int rhashtable_shrink(struct rhashtable *ht);
188 325
189void *rhashtable_lookup(struct rhashtable *ht, const void *key); 326int rhashtable_insert_slow(struct rhashtable *ht, const void *key,
190void *rhashtable_lookup_compare(struct rhashtable *ht, const void *key, 327 struct rhash_head *obj,
191 bool (*compare)(void *, void *), void *arg); 328 struct bucket_table *old_tbl);
192 329int rhashtable_insert_rehash(struct rhashtable *ht);
193bool rhashtable_lookup_insert(struct rhashtable *ht, struct rhash_head *obj);
194bool rhashtable_lookup_compare_insert(struct rhashtable *ht,
195 struct rhash_head *obj,
196 bool (*compare)(void *, void *),
197 void *arg);
198 330
199int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter); 331int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter);
200void rhashtable_walk_exit(struct rhashtable_iter *iter); 332void rhashtable_walk_exit(struct rhashtable_iter *iter);
@@ -202,6 +334,9 @@ int rhashtable_walk_start(struct rhashtable_iter *iter) __acquires(RCU);
202void *rhashtable_walk_next(struct rhashtable_iter *iter); 334void *rhashtable_walk_next(struct rhashtable_iter *iter);
203void rhashtable_walk_stop(struct rhashtable_iter *iter) __releases(RCU); 335void rhashtable_walk_stop(struct rhashtable_iter *iter) __releases(RCU);
204 336
337void rhashtable_free_and_destroy(struct rhashtable *ht,
338 void (*free_fn)(void *ptr, void *arg),
339 void *arg);
205void rhashtable_destroy(struct rhashtable *ht); 340void rhashtable_destroy(struct rhashtable *ht);
206 341
207#define rht_dereference(p, ht) \ 342#define rht_dereference(p, ht) \
@@ -352,4 +487,316 @@ void rhashtable_destroy(struct rhashtable *ht);
352 rht_for_each_entry_rcu_continue(tpos, pos, (tbl)->buckets[hash],\ 487 rht_for_each_entry_rcu_continue(tpos, pos, (tbl)->buckets[hash],\
353 tbl, hash, member) 488 tbl, hash, member)
354 489
490static inline int rhashtable_compare(struct rhashtable_compare_arg *arg,
491 const void *obj)
492{
493 struct rhashtable *ht = arg->ht;
494 const char *ptr = obj;
495
496 return memcmp(ptr + ht->p.key_offset, arg->key, ht->p.key_len);
497}
498
499/**
500 * rhashtable_lookup_fast - search hash table, inlined version
501 * @ht: hash table
502 * @key: the pointer to the key
503 * @params: hash table parameters
504 *
505 * Computes the hash value for the key and traverses the bucket chain looking
506 * for a entry with an identical key. The first matching entry is returned.
507 *
508 * Returns the first entry on which the compare function returned true.
509 */
510static inline void *rhashtable_lookup_fast(
511 struct rhashtable *ht, const void *key,
512 const struct rhashtable_params params)
513{
514 struct rhashtable_compare_arg arg = {
515 .ht = ht,
516 .key = key,
517 };
518 const struct bucket_table *tbl;
519 struct rhash_head *he;
520 unsigned int hash;
521
522 rcu_read_lock();
523
524 tbl = rht_dereference_rcu(ht->tbl, ht);
525restart:
526 hash = rht_key_hashfn(ht, tbl, key, params);
527 rht_for_each_rcu(he, tbl, hash) {
528 if (params.obj_cmpfn ?
529 params.obj_cmpfn(&arg, rht_obj(ht, he)) :
530 rhashtable_compare(&arg, rht_obj(ht, he)))
531 continue;
532 rcu_read_unlock();
533 return rht_obj(ht, he);
534 }
535
536 /* Ensure we see any new tables. */
537 smp_rmb();
538
539 tbl = rht_dereference_rcu(tbl->future_tbl, ht);
540 if (unlikely(tbl))
541 goto restart;
542 rcu_read_unlock();
543
544 return NULL;
545}
546
547/* Internal function, please use rhashtable_insert_fast() instead */
548static inline int __rhashtable_insert_fast(
549 struct rhashtable *ht, const void *key, struct rhash_head *obj,
550 const struct rhashtable_params params)
551{
552 struct rhashtable_compare_arg arg = {
553 .ht = ht,
554 .key = key,
555 };
556 struct bucket_table *tbl, *new_tbl;
557 struct rhash_head *head;
558 spinlock_t *lock;
559 unsigned int elasticity;
560 unsigned int hash;
561 int err;
562
563restart:
564 rcu_read_lock();
565
566 tbl = rht_dereference_rcu(ht->tbl, ht);
567
568 /* All insertions must grab the oldest table containing
569 * the hashed bucket that is yet to be rehashed.
570 */
571 for (;;) {
572 hash = rht_head_hashfn(ht, tbl, obj, params);
573 lock = rht_bucket_lock(tbl, hash);
574 spin_lock_bh(lock);
575
576 if (tbl->rehash <= hash)
577 break;
578
579 spin_unlock_bh(lock);
580 tbl = rht_dereference_rcu(tbl->future_tbl, ht);
581 }
582
583 new_tbl = rht_dereference_rcu(tbl->future_tbl, ht);
584 if (unlikely(new_tbl)) {
585 err = rhashtable_insert_slow(ht, key, obj, new_tbl);
586 if (err == -EAGAIN)
587 goto slow_path;
588 goto out;
589 }
590
591 if (unlikely(rht_grow_above_100(ht, tbl))) {
592slow_path:
593 spin_unlock_bh(lock);
594 err = rhashtable_insert_rehash(ht);
595 rcu_read_unlock();
596 if (err)
597 return err;
598
599 goto restart;
600 }
601
602 err = -EEXIST;
603 elasticity = ht->elasticity;
604 rht_for_each(head, tbl, hash) {
605 if (key &&
606 unlikely(!(params.obj_cmpfn ?
607 params.obj_cmpfn(&arg, rht_obj(ht, head)) :
608 rhashtable_compare(&arg, rht_obj(ht, head)))))
609 goto out;
610 if (!--elasticity)
611 goto slow_path;
612 }
613
614 err = 0;
615
616 head = rht_dereference_bucket(tbl->buckets[hash], tbl, hash);
617
618 RCU_INIT_POINTER(obj->next, head);
619
620 rcu_assign_pointer(tbl->buckets[hash], obj);
621
622 atomic_inc(&ht->nelems);
623 if (rht_grow_above_75(ht, tbl))
624 schedule_work(&ht->run_work);
625
626out:
627 spin_unlock_bh(lock);
628 rcu_read_unlock();
629
630 return err;
631}
632
633/**
634 * rhashtable_insert_fast - insert object into hash table
635 * @ht: hash table
636 * @obj: pointer to hash head inside object
637 * @params: hash table parameters
638 *
639 * Will take a per bucket spinlock to protect against mutual mutations
640 * on the same bucket. Multiple insertions may occur in parallel unless
641 * they map to the same bucket lock.
642 *
643 * It is safe to call this function from atomic context.
644 *
645 * Will trigger an automatic deferred table resizing if the size grows
646 * beyond the watermark indicated by grow_decision() which can be passed
647 * to rhashtable_init().
648 */
649static inline int rhashtable_insert_fast(
650 struct rhashtable *ht, struct rhash_head *obj,
651 const struct rhashtable_params params)
652{
653 return __rhashtable_insert_fast(ht, NULL, obj, params);
654}
655
656/**
657 * rhashtable_lookup_insert_fast - lookup and insert object into hash table
658 * @ht: hash table
659 * @obj: pointer to hash head inside object
660 * @params: hash table parameters
661 *
662 * Locks down the bucket chain in both the old and new table if a resize
663 * is in progress to ensure that writers can't remove from the old table
664 * and can't insert to the new table during the atomic operation of search
665 * and insertion. Searches for duplicates in both the old and new table if
666 * a resize is in progress.
667 *
668 * This lookup function may only be used for fixed key hash table (key_len
669 * parameter set). It will BUG() if used inappropriately.
670 *
671 * It is safe to call this function from atomic context.
672 *
673 * Will trigger an automatic deferred table resizing if the size grows
674 * beyond the watermark indicated by grow_decision() which can be passed
675 * to rhashtable_init().
676 */
677static inline int rhashtable_lookup_insert_fast(
678 struct rhashtable *ht, struct rhash_head *obj,
679 const struct rhashtable_params params)
680{
681 const char *key = rht_obj(ht, obj);
682
683 BUG_ON(ht->p.obj_hashfn);
684
685 return __rhashtable_insert_fast(ht, key + ht->p.key_offset, obj,
686 params);
687}
688
689/**
690 * rhashtable_lookup_insert_key - search and insert object to hash table
691 * with explicit key
692 * @ht: hash table
693 * @key: key
694 * @obj: pointer to hash head inside object
695 * @params: hash table parameters
696 *
697 * Locks down the bucket chain in both the old and new table if a resize
698 * is in progress to ensure that writers can't remove from the old table
699 * and can't insert to the new table during the atomic operation of search
700 * and insertion. Searches for duplicates in both the old and new table if
701 * a resize is in progress.
702 *
703 * Lookups may occur in parallel with hashtable mutations and resizing.
704 *
705 * Will trigger an automatic deferred table resizing if the size grows
706 * beyond the watermark indicated by grow_decision() which can be passed
707 * to rhashtable_init().
708 *
709 * Returns zero on success.
710 */
711static inline int rhashtable_lookup_insert_key(
712 struct rhashtable *ht, const void *key, struct rhash_head *obj,
713 const struct rhashtable_params params)
714{
715 BUG_ON(!ht->p.obj_hashfn || !key);
716
717 return __rhashtable_insert_fast(ht, key, obj, params);
718}
719
720/* Internal function, please use rhashtable_remove_fast() instead */
721static inline int __rhashtable_remove_fast(
722 struct rhashtable *ht, struct bucket_table *tbl,
723 struct rhash_head *obj, const struct rhashtable_params params)
724{
725 struct rhash_head __rcu **pprev;
726 struct rhash_head *he;
727 spinlock_t * lock;
728 unsigned int hash;
729 int err = -ENOENT;
730
731 hash = rht_head_hashfn(ht, tbl, obj, params);
732 lock = rht_bucket_lock(tbl, hash);
733
734 spin_lock_bh(lock);
735
736 pprev = &tbl->buckets[hash];
737 rht_for_each(he, tbl, hash) {
738 if (he != obj) {
739 pprev = &he->next;
740 continue;
741 }
742
743 rcu_assign_pointer(*pprev, obj->next);
744 err = 0;
745 break;
746 }
747
748 spin_unlock_bh(lock);
749
750 return err;
751}
752
753/**
754 * rhashtable_remove_fast - remove object from hash table
755 * @ht: hash table
756 * @obj: pointer to hash head inside object
757 * @params: hash table parameters
758 *
759 * Since the hash chain is single linked, the removal operation needs to
760 * walk the bucket chain upon removal. The removal operation is thus
761 * considerable slow if the hash table is not correctly sized.
762 *
763 * Will automatically shrink the table via rhashtable_expand() if the
764 * shrink_decision function specified at rhashtable_init() returns true.
765 *
766 * Returns zero on success, -ENOENT if the entry could not be found.
767 */
768static inline int rhashtable_remove_fast(
769 struct rhashtable *ht, struct rhash_head *obj,
770 const struct rhashtable_params params)
771{
772 struct bucket_table *tbl;
773 int err;
774
775 rcu_read_lock();
776
777 tbl = rht_dereference_rcu(ht->tbl, ht);
778
779 /* Because we have already taken (and released) the bucket
780 * lock in old_tbl, if we find that future_tbl is not yet
781 * visible then that guarantees the entry to still be in
782 * the old tbl if it exists.
783 */
784 while ((err = __rhashtable_remove_fast(ht, tbl, obj, params)) &&
785 (tbl = rht_dereference_rcu(tbl->future_tbl, ht)))
786 ;
787
788 if (err)
789 goto out;
790
791 atomic_dec(&ht->nelems);
792 if (unlikely(ht->p.automatic_shrinking &&
793 rht_shrink_below_30(ht, tbl)))
794 schedule_work(&ht->run_work);
795
796out:
797 rcu_read_unlock();
798
799 return err;
800}
801
355#endif /* _LINUX_RHASHTABLE_H */ 802#endif /* _LINUX_RHASHTABLE_H */
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index c4c559a45dc8..c89c53a113a8 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -105,14 +105,6 @@ static inline void put_anon_vma(struct anon_vma *anon_vma)
105 __put_anon_vma(anon_vma); 105 __put_anon_vma(anon_vma);
106} 106}
107 107
108static inline struct anon_vma *page_anon_vma(struct page *page)
109{
110 if (((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) !=
111 PAGE_MAPPING_ANON)
112 return NULL;
113 return page_rmapping(page);
114}
115
116static inline void vma_lock_anon_vma(struct vm_area_struct *vma) 108static inline void vma_lock_anon_vma(struct vm_area_struct *vma)
117{ 109{
118 struct anon_vma *anon_vma = vma->anon_vma; 110 struct anon_vma *anon_vma = vma->anon_vma;
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index dcad7ee0d746..8dcf6825fa88 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -77,6 +77,7 @@ struct rtc_class_ops {
77 int (*read_alarm)(struct device *, struct rtc_wkalrm *); 77 int (*read_alarm)(struct device *, struct rtc_wkalrm *);
78 int (*set_alarm)(struct device *, struct rtc_wkalrm *); 78 int (*set_alarm)(struct device *, struct rtc_wkalrm *);
79 int (*proc)(struct device *, struct seq_file *); 79 int (*proc)(struct device *, struct seq_file *);
80 int (*set_mmss64)(struct device *, time64_t secs);
80 int (*set_mmss)(struct device *, unsigned long secs); 81 int (*set_mmss)(struct device *, unsigned long secs);
81 int (*read_callback)(struct device *, int data); 82 int (*read_callback)(struct device *, int data);
82 int (*alarm_irq_enable)(struct device *, unsigned int enabled); 83 int (*alarm_irq_enable)(struct device *, unsigned int enabled);
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 5db76a32fcab..2da5d1081ad9 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -77,7 +77,20 @@ static inline struct netdev_queue *dev_ingress_queue(struct net_device *dev)
77 return rtnl_dereference(dev->ingress_queue); 77 return rtnl_dereference(dev->ingress_queue);
78} 78}
79 79
80extern struct netdev_queue *dev_ingress_queue_create(struct net_device *dev); 80struct netdev_queue *dev_ingress_queue_create(struct net_device *dev);
81
82#ifdef CONFIG_NET_CLS_ACT
83void net_inc_ingress_queue(void);
84void net_dec_ingress_queue(void);
85#else
86static inline void net_inc_ingress_queue(void)
87{
88}
89
90static inline void net_dec_ingress_queue(void)
91{
92}
93#endif
81 94
82extern void rtnetlink_init(void); 95extern void rtnetlink_init(void);
83extern void __rtnl_unlock(void); 96extern void __rtnl_unlock(void);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index a419b65770d6..8222ae40ecb0 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -125,7 +125,6 @@ struct sched_attr {
125 u64 sched_period; 125 u64 sched_period;
126}; 126};
127 127
128struct exec_domain;
129struct futex_pi_state; 128struct futex_pi_state;
130struct robust_list_head; 129struct robust_list_head;
131struct bio_list; 130struct bio_list;
@@ -176,6 +175,14 @@ extern void get_iowait_load(unsigned long *nr_waiters, unsigned long *load);
176extern void calc_global_load(unsigned long ticks); 175extern void calc_global_load(unsigned long ticks);
177extern void update_cpu_load_nohz(void); 176extern void update_cpu_load_nohz(void);
178 177
178/* Notifier for when a task gets migrated to a new CPU */
179struct task_migration_notifier {
180 struct task_struct *task;
181 int from_cpu;
182 int to_cpu;
183};
184extern void register_task_migration_notifier(struct notifier_block *n);
185
179extern unsigned long get_parent_ip(unsigned long addr); 186extern unsigned long get_parent_ip(unsigned long addr);
180 187
181extern void dump_cpu_task(int cpu); 188extern void dump_cpu_task(int cpu);
@@ -329,6 +336,8 @@ extern asmlinkage void schedule_tail(struct task_struct *prev);
329extern void init_idle(struct task_struct *idle, int cpu); 336extern void init_idle(struct task_struct *idle, int cpu);
330extern void init_idle_bootup_task(struct task_struct *idle); 337extern void init_idle_bootup_task(struct task_struct *idle);
331 338
339extern cpumask_var_t cpu_isolated_map;
340
332extern int runqueue_is_locked(int cpu); 341extern int runqueue_is_locked(int cpu);
333 342
334#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) 343#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
@@ -1115,15 +1124,28 @@ struct load_weight {
1115}; 1124};
1116 1125
1117struct sched_avg { 1126struct sched_avg {
1127 u64 last_runnable_update;
1128 s64 decay_count;
1129 /*
1130 * utilization_avg_contrib describes the amount of time that a
1131 * sched_entity is running on a CPU. It is based on running_avg_sum
1132 * and is scaled in the range [0..SCHED_LOAD_SCALE].
1133 * load_avg_contrib described the amount of time that a sched_entity
1134 * is runnable on a rq. It is based on both runnable_avg_sum and the
1135 * weight of the task.
1136 */
1137 unsigned long load_avg_contrib, utilization_avg_contrib;
1118 /* 1138 /*
1119 * These sums represent an infinite geometric series and so are bound 1139 * These sums represent an infinite geometric series and so are bound
1120 * above by 1024/(1-y). Thus we only need a u32 to store them for all 1140 * above by 1024/(1-y). Thus we only need a u32 to store them for all
1121 * choices of y < 1-2^(-32)*1024. 1141 * choices of y < 1-2^(-32)*1024.
1142 * running_avg_sum reflects the time that the sched_entity is
1143 * effectively running on the CPU.
1144 * runnable_avg_sum represents the amount of time a sched_entity is on
1145 * a runqueue which includes the running time that is monitored by
1146 * running_avg_sum.
1122 */ 1147 */
1123 u32 runnable_avg_sum, runnable_avg_period; 1148 u32 runnable_avg_sum, avg_period, running_avg_sum;
1124 u64 last_runnable_update;
1125 s64 decay_count;
1126 unsigned long load_avg_contrib;
1127}; 1149};
1128 1150
1129#ifdef CONFIG_SCHEDSTATS 1151#ifdef CONFIG_SCHEDSTATS
@@ -2288,11 +2310,6 @@ extern void set_curr_task(int cpu, struct task_struct *p);
2288 2310
2289void yield(void); 2311void yield(void);
2290 2312
2291/*
2292 * The default (Linux) execution domain.
2293 */
2294extern struct exec_domain default_exec_domain;
2295
2296union thread_union { 2313union thread_union {
2297 struct thread_info thread_info; 2314 struct thread_info thread_info;
2298 unsigned long stack[THREAD_SIZE/sizeof(long)]; 2315 unsigned long stack[THREAD_SIZE/sizeof(long)];
diff --git a/include/linux/security.h b/include/linux/security.h
index a1b7dbd127ff..18264ea9e314 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1556,7 +1556,7 @@ struct security_operations {
1556 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); 1556 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd);
1557 int (*inode_permission) (struct inode *inode, int mask); 1557 int (*inode_permission) (struct inode *inode, int mask);
1558 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); 1558 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr);
1559 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); 1559 int (*inode_getattr) (const struct path *path);
1560 int (*inode_setxattr) (struct dentry *dentry, const char *name, 1560 int (*inode_setxattr) (struct dentry *dentry, const char *name,
1561 const void *value, size_t size, int flags); 1561 const void *value, size_t size, int flags);
1562 void (*inode_post_setxattr) (struct dentry *dentry, const char *name, 1562 void (*inode_post_setxattr) (struct dentry *dentry, const char *name,
@@ -1716,7 +1716,6 @@ struct security_operations {
1716 int (*tun_dev_attach_queue) (void *security); 1716 int (*tun_dev_attach_queue) (void *security);
1717 int (*tun_dev_attach) (struct sock *sk, void *security); 1717 int (*tun_dev_attach) (struct sock *sk, void *security);
1718 int (*tun_dev_open) (void *security); 1718 int (*tun_dev_open) (void *security);
1719 void (*skb_owned_by) (struct sk_buff *skb, struct sock *sk);
1720#endif /* CONFIG_SECURITY_NETWORK */ 1719#endif /* CONFIG_SECURITY_NETWORK */
1721 1720
1722#ifdef CONFIG_SECURITY_NETWORK_XFRM 1721#ifdef CONFIG_SECURITY_NETWORK_XFRM
@@ -1843,7 +1842,7 @@ int security_inode_readlink(struct dentry *dentry);
1843int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); 1842int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
1844int security_inode_permission(struct inode *inode, int mask); 1843int security_inode_permission(struct inode *inode, int mask);
1845int security_inode_setattr(struct dentry *dentry, struct iattr *attr); 1844int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
1846int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); 1845int security_inode_getattr(const struct path *path);
1847int security_inode_setxattr(struct dentry *dentry, const char *name, 1846int security_inode_setxattr(struct dentry *dentry, const char *name,
1848 const void *value, size_t size, int flags); 1847 const void *value, size_t size, int flags);
1849void security_inode_post_setxattr(struct dentry *dentry, const char *name, 1848void security_inode_post_setxattr(struct dentry *dentry, const char *name,
@@ -2259,8 +2258,7 @@ static inline int security_inode_setattr(struct dentry *dentry,
2259 return 0; 2258 return 0;
2260} 2259}
2261 2260
2262static inline int security_inode_getattr(struct vfsmount *mnt, 2261static inline int security_inode_getattr(const struct path *path)
2263 struct dentry *dentry)
2264{ 2262{
2265 return 0; 2263 return 0;
2266} 2264}
@@ -2735,8 +2733,6 @@ int security_tun_dev_attach_queue(void *security);
2735int security_tun_dev_attach(struct sock *sk, void *security); 2733int security_tun_dev_attach(struct sock *sk, void *security);
2736int security_tun_dev_open(void *security); 2734int security_tun_dev_open(void *security);
2737 2735
2738void security_skb_owned_by(struct sk_buff *skb, struct sock *sk);
2739
2740#else /* CONFIG_SECURITY_NETWORK */ 2736#else /* CONFIG_SECURITY_NETWORK */
2741static inline int security_unix_stream_connect(struct sock *sock, 2737static inline int security_unix_stream_connect(struct sock *sock,
2742 struct sock *other, 2738 struct sock *other,
@@ -2928,11 +2924,6 @@ static inline int security_tun_dev_open(void *security)
2928{ 2924{
2929 return 0; 2925 return 0;
2930} 2926}
2931
2932static inline void security_skb_owned_by(struct sk_buff *skb, struct sock *sk)
2933{
2934}
2935
2936#endif /* CONFIG_SECURITY_NETWORK */ 2927#endif /* CONFIG_SECURITY_NETWORK */
2937 2928
2938#ifdef CONFIG_SECURITY_NETWORK_XFRM 2929#ifdef CONFIG_SECURITY_NETWORK_XFRM
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index f5df8f687b4d..5f68d0a391ce 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -108,7 +108,7 @@ static inline unsigned __read_seqcount_begin(const seqcount_t *s)
108 unsigned ret; 108 unsigned ret;
109 109
110repeat: 110repeat:
111 ret = ACCESS_ONCE(s->sequence); 111 ret = READ_ONCE(s->sequence);
112 if (unlikely(ret & 1)) { 112 if (unlikely(ret & 1)) {
113 cpu_relax(); 113 cpu_relax();
114 goto repeat; 114 goto repeat;
@@ -127,7 +127,7 @@ repeat:
127 */ 127 */
128static inline unsigned raw_read_seqcount(const seqcount_t *s) 128static inline unsigned raw_read_seqcount(const seqcount_t *s)
129{ 129{
130 unsigned ret = ACCESS_ONCE(s->sequence); 130 unsigned ret = READ_ONCE(s->sequence);
131 smp_rmb(); 131 smp_rmb();
132 return ret; 132 return ret;
133} 133}
@@ -179,7 +179,7 @@ static inline unsigned read_seqcount_begin(const seqcount_t *s)
179 */ 179 */
180static inline unsigned raw_seqcount_begin(const seqcount_t *s) 180static inline unsigned raw_seqcount_begin(const seqcount_t *s)
181{ 181{
182 unsigned ret = ACCESS_ONCE(s->sequence); 182 unsigned ret = READ_ONCE(s->sequence);
183 smp_rmb(); 183 smp_rmb();
184 return ret & ~1; 184 return ret & ~1;
185} 185}
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index f54d6659713a..0991259643d6 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -166,10 +166,16 @@ struct nf_conntrack {
166#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) 166#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
167struct nf_bridge_info { 167struct nf_bridge_info {
168 atomic_t use; 168 atomic_t use;
169 enum {
170 BRNF_PROTO_UNCHANGED,
171 BRNF_PROTO_8021Q,
172 BRNF_PROTO_PPPOE
173 } orig_proto;
174 bool pkt_otherhost;
169 unsigned int mask; 175 unsigned int mask;
170 struct net_device *physindev; 176 struct net_device *physindev;
171 struct net_device *physoutdev; 177 struct net_device *physoutdev;
172 unsigned long data[32 / sizeof(unsigned long)]; 178 char neigh_header[8];
173}; 179};
174#endif 180#endif
175 181
@@ -492,7 +498,6 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
492 * @napi_id: id of the NAPI struct this skb came from 498 * @napi_id: id of the NAPI struct this skb came from
493 * @secmark: security marking 499 * @secmark: security marking
494 * @mark: Generic packet mark 500 * @mark: Generic packet mark
495 * @dropcount: total number of sk_receive_queue overflows
496 * @vlan_proto: vlan encapsulation protocol 501 * @vlan_proto: vlan encapsulation protocol
497 * @vlan_tci: vlan tag control information 502 * @vlan_tci: vlan tag control information
498 * @inner_protocol: Protocol (encapsulation) 503 * @inner_protocol: Protocol (encapsulation)
@@ -641,7 +646,6 @@ struct sk_buff {
641#endif 646#endif
642 union { 647 union {
643 __u32 mark; 648 __u32 mark;
644 __u32 dropcount;
645 __u32 reserved_tailroom; 649 __u32 reserved_tailroom;
646 }; 650 };
647 651
@@ -870,8 +874,7 @@ unsigned int skb_seq_read(unsigned int consumed, const u8 **data,
870void skb_abort_seq_read(struct skb_seq_state *st); 874void skb_abort_seq_read(struct skb_seq_state *st);
871 875
872unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, 876unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
873 unsigned int to, struct ts_config *config, 877 unsigned int to, struct ts_config *config);
874 struct ts_state *state);
875 878
876/* 879/*
877 * Packet hash types specify the type of hash in skb_set_hash. 880 * Packet hash types specify the type of hash in skb_set_hash.
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 76f1feeabd38..ffd24c830151 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -18,7 +18,7 @@
18 18
19/* 19/*
20 * Flags to pass to kmem_cache_create(). 20 * Flags to pass to kmem_cache_create().
21 * The ones marked DEBUG are only valid if CONFIG_SLAB_DEBUG is set. 21 * The ones marked DEBUG are only valid if CONFIG_DEBUG_SLAB is set.
22 */ 22 */
23#define SLAB_DEBUG_FREE 0x00000100UL /* DEBUG: Perform (expensive) checks on free */ 23#define SLAB_DEBUG_FREE 0x00000100UL /* DEBUG: Perform (expensive) checks on free */
24#define SLAB_RED_ZONE 0x00000400UL /* DEBUG: Red zone objs in a cache */ 24#define SLAB_RED_ZONE 0x00000400UL /* DEBUG: Red zone objs in a cache */
diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h
index 13e929679550..d600afb21926 100644
--- a/include/linux/smpboot.h
+++ b/include/linux/smpboot.h
@@ -47,6 +47,5 @@ struct smp_hotplug_thread {
47 47
48int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread); 48int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread);
49void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread); 49void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread);
50int smpboot_thread_schedule(void);
51 50
52#endif 51#endif
diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h
index 46cca4c06848..083ac388098e 100644
--- a/include/linux/sock_diag.h
+++ b/include/linux/sock_diag.h
@@ -19,8 +19,8 @@ void sock_diag_unregister(const struct sock_diag_handler *h);
19void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh)); 19void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
20void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh)); 20void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
21 21
22int sock_diag_check_cookie(void *sk, __u32 *cookie); 22int sock_diag_check_cookie(struct sock *sk, const __u32 *cookie);
23void sock_diag_save_cookie(void *sk, __u32 *cookie); 23void sock_diag_save_cookie(struct sock *sk, __u32 *cookie);
24 24
25int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr); 25int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr);
26int sock_diag_put_filterinfo(bool may_report_filterinfo, struct sock *sk, 26int sock_diag_put_filterinfo(bool may_report_filterinfo, struct sock *sk,
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 5c19cba34dce..5bf59c8493b7 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -51,6 +51,7 @@ struct msghdr {
51 void *msg_control; /* ancillary data */ 51 void *msg_control; /* ancillary data */
52 __kernel_size_t msg_controllen; /* ancillary data buffer length */ 52 __kernel_size_t msg_controllen; /* ancillary data buffer length */
53 unsigned int msg_flags; /* flags on received message */ 53 unsigned int msg_flags; /* flags on received message */
54 struct kiocb *msg_iocb; /* ptr to iocb for async requests */
54}; 55};
55 56
56struct user_msghdr { 57struct user_msghdr {
@@ -138,6 +139,11 @@ static inline struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr
138 return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg); 139 return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
139} 140}
140 141
142static inline size_t msg_data_left(struct msghdr *msg)
143{
144 return iov_iter_count(&msg->msg_iter);
145}
146
141/* "Socket"-level control message types: */ 147/* "Socket"-level control message types: */
142 148
143#define SCM_RIGHTS 0x01 /* rw: access rights (array of int) */ 149#define SCM_RIGHTS 0x01 /* rw: access rights (array of int) */
@@ -181,6 +187,7 @@ struct ucred {
181#define AF_WANPIPE 25 /* Wanpipe API Sockets */ 187#define AF_WANPIPE 25 /* Wanpipe API Sockets */
182#define AF_LLC 26 /* Linux LLC */ 188#define AF_LLC 26 /* Linux LLC */
183#define AF_IB 27 /* Native InfiniBand address */ 189#define AF_IB 27 /* Native InfiniBand address */
190#define AF_MPLS 28 /* MPLS */
184#define AF_CAN 29 /* Controller Area Network */ 191#define AF_CAN 29 /* Controller Area Network */
185#define AF_TIPC 30 /* TIPC sockets */ 192#define AF_TIPC 30 /* TIPC sockets */
186#define AF_BLUETOOTH 31 /* Bluetooth sockets */ 193#define AF_BLUETOOTH 31 /* Bluetooth sockets */
@@ -226,6 +233,7 @@ struct ucred {
226#define PF_WANPIPE AF_WANPIPE 233#define PF_WANPIPE AF_WANPIPE
227#define PF_LLC AF_LLC 234#define PF_LLC AF_LLC
228#define PF_IB AF_IB 235#define PF_IB AF_IB
236#define PF_MPLS AF_MPLS
229#define PF_CAN AF_CAN 237#define PF_CAN AF_CAN
230#define PF_TIPC AF_TIPC 238#define PF_TIPC AF_TIPC
231#define PF_BLUETOOTH AF_BLUETOOTH 239#define PF_BLUETOOTH AF_BLUETOOTH
diff --git a/include/linux/spi/at86rf230.h b/include/linux/spi/at86rf230.h
index cd519a11c2c6..b63fe6f5fdc8 100644
--- a/include/linux/spi/at86rf230.h
+++ b/include/linux/spi/at86rf230.h
@@ -22,6 +22,7 @@ struct at86rf230_platform_data {
22 int rstn; 22 int rstn;
23 int slp_tr; 23 int slp_tr;
24 int dig2; 24 int dig2;
25 u8 xtal_trim;
25}; 26};
26 27
27#endif 28#endif
diff --git a/include/linux/spi/cc2520.h b/include/linux/spi/cc2520.h
index 85b8ee67e937..e741e8baad92 100644
--- a/include/linux/spi/cc2520.h
+++ b/include/linux/spi/cc2520.h
@@ -21,6 +21,7 @@ struct cc2520_platform_data {
21 int sfd; 21 int sfd;
22 int reset; 22 int reset;
23 int vreg; 23 int vreg;
24 bool amplified;
24}; 25};
25 26
26#endif 27#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 856d34dde79b..d673072346f2 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -162,8 +162,6 @@ struct spi_transfer;
162 * @remove: Unbinds this driver from the spi device 162 * @remove: Unbinds this driver from the spi device
163 * @shutdown: Standard shutdown callback used during system state 163 * @shutdown: Standard shutdown callback used during system state
164 * transitions such as powerdown/halt and kexec 164 * transitions such as powerdown/halt and kexec
165 * @suspend: Standard suspend callback used during system state transitions
166 * @resume: Standard resume callback used during system state transitions
167 * @driver: SPI device drivers should initialize the name and owner 165 * @driver: SPI device drivers should initialize the name and owner
168 * field of this structure. 166 * field of this structure.
169 * 167 *
@@ -184,8 +182,6 @@ struct spi_driver {
184 int (*probe)(struct spi_device *spi); 182 int (*probe)(struct spi_device *spi);
185 int (*remove)(struct spi_device *spi); 183 int (*remove)(struct spi_device *spi);
186 void (*shutdown)(struct spi_device *spi); 184 void (*shutdown)(struct spi_device *spi);
187 int (*suspend)(struct spi_device *spi, pm_message_t mesg);
188 int (*resume)(struct spi_device *spi);
189 struct device_driver driver; 185 struct device_driver driver;
190}; 186};
191 187
@@ -294,6 +290,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
294 * transfer_one_message are mutually exclusive; when both 290 * transfer_one_message are mutually exclusive; when both
295 * are set, the generic subsystem does not call your 291 * are set, the generic subsystem does not call your
296 * transfer_one callback. 292 * transfer_one callback.
293 * @handle_err: the subsystem calls the driver to handle an error that occurs
294 * in the generic implementation of transfer_one_message().
297 * @unprepare_message: undo any work done by prepare_message(). 295 * @unprepare_message: undo any work done by prepare_message().
298 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS 296 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
299 * number. Any individual value may be -ENOENT for CS lines that 297 * number. Any individual value may be -ENOENT for CS lines that
@@ -448,6 +446,8 @@ struct spi_master {
448 void (*set_cs)(struct spi_device *spi, bool enable); 446 void (*set_cs)(struct spi_device *spi, bool enable);
449 int (*transfer_one)(struct spi_master *master, struct spi_device *spi, 447 int (*transfer_one)(struct spi_master *master, struct spi_device *spi,
450 struct spi_transfer *transfer); 448 struct spi_transfer *transfer);
449 void (*handle_err)(struct spi_master *master,
450 struct spi_message *message);
451 451
452 /* gpio chip select */ 452 /* gpio chip select */
453 int *cs_gpios; 453 int *cs_gpios;
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 9cfd9623fb03..bdeb4567b71e 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -182,7 +182,7 @@ static inline int srcu_read_lock_held(struct srcu_struct *sp)
182 * lockdep_is_held() calls. 182 * lockdep_is_held() calls.
183 */ 183 */
184#define srcu_dereference_check(p, sp, c) \ 184#define srcu_dereference_check(p, sp, c) \
185 __rcu_dereference_check((p), srcu_read_lock_held(sp) || (c), __rcu) 185 __rcu_dereference_check((p), (c) || srcu_read_lock_held(sp), __rcu)
186 186
187/** 187/**
188 * srcu_dereference - fetch SRCU-protected pointer for later dereferencing 188 * srcu_dereference - fetch SRCU-protected pointer for later dereferencing
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
index 669045ab73f3..0a34489a46b6 100644
--- a/include/linux/stacktrace.h
+++ b/include/linux/stacktrace.h
@@ -7,8 +7,6 @@ struct task_struct;
7struct pt_regs; 7struct pt_regs;
8 8
9#ifdef CONFIG_STACKTRACE 9#ifdef CONFIG_STACKTRACE
10struct task_struct;
11
12struct stack_trace { 10struct stack_trace {
13 unsigned int nr_entries, max_entries; 11 unsigned int nr_entries, max_entries;
14 unsigned long *entries; 12 unsigned long *entries;
diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index f4aec0e75c3a..076af437284d 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -19,3 +19,12 @@ enum {
19#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 19#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
20#endif 20#endif
21#endif 21#endif
22
23/**
24 * offsetofend(TYPE, MEMBER)
25 *
26 * @TYPE: The type of the structure
27 * @MEMBER: The member within the structure to get the end offset of
28 */
29#define offsetofend(TYPE, MEMBER) \
30 (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER))
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index cd63851b57f2..7f484a239f53 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -114,6 +114,8 @@ struct plat_stmmacenet_data {
114 int maxmtu; 114 int maxmtu;
115 int multicast_filter_bins; 115 int multicast_filter_bins;
116 int unicast_filter_entries; 116 int unicast_filter_entries;
117 int tx_fifo_size;
118 int rx_fifo_size;
117 void (*fix_mac_speed)(void *priv, unsigned int speed); 119 void (*fix_mac_speed)(void *priv, unsigned int speed);
118 void (*bus_setup)(void __iomem *ioaddr); 120 void (*bus_setup)(void __iomem *ioaddr);
119 void *(*setup)(struct platform_device *pdev); 121 void *(*setup)(struct platform_device *pdev);
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index 657571817260..71f711db4500 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -10,7 +10,7 @@ enum string_size_units {
10 STRING_UNITS_2, /* use binary powers of 2^10 */ 10 STRING_UNITS_2, /* use binary powers of 2^10 */
11}; 11};
12 12
13void string_get_size(u64 size, enum string_size_units units, 13void string_get_size(u64 size, u64 blk_size, enum string_size_units units,
14 char *buf, int len); 14 char *buf, int len);
15 15
16#define UNESCAPE_SPACE 0x01 16#define UNESCAPE_SPACE 0x01
@@ -47,22 +47,22 @@ static inline int string_unescape_any_inplace(char *buf)
47#define ESCAPE_ANY_NP (ESCAPE_ANY | ESCAPE_NP) 47#define ESCAPE_ANY_NP (ESCAPE_ANY | ESCAPE_NP)
48#define ESCAPE_HEX 0x20 48#define ESCAPE_HEX 0x20
49 49
50int string_escape_mem(const char *src, size_t isz, char **dst, size_t osz, 50int string_escape_mem(const char *src, size_t isz, char *dst, size_t osz,
51 unsigned int flags, const char *esc); 51 unsigned int flags, const char *esc);
52 52
53static inline int string_escape_mem_any_np(const char *src, size_t isz, 53static inline int string_escape_mem_any_np(const char *src, size_t isz,
54 char **dst, size_t osz, const char *esc) 54 char *dst, size_t osz, const char *esc)
55{ 55{
56 return string_escape_mem(src, isz, dst, osz, ESCAPE_ANY_NP, esc); 56 return string_escape_mem(src, isz, dst, osz, ESCAPE_ANY_NP, esc);
57} 57}
58 58
59static inline int string_escape_str(const char *src, char **dst, size_t sz, 59static inline int string_escape_str(const char *src, char *dst, size_t sz,
60 unsigned int flags, const char *esc) 60 unsigned int flags, const char *esc)
61{ 61{
62 return string_escape_mem(src, strlen(src), dst, sz, flags, esc); 62 return string_escape_mem(src, strlen(src), dst, sz, flags, esc);
63} 63}
64 64
65static inline int string_escape_str_any_np(const char *src, char **dst, 65static inline int string_escape_str_any_np(const char *src, char *dst,
66 size_t sz, const char *esc) 66 size_t sz, const char *esc)
67{ 67{
68 return string_escape_str(src, dst, sz, ESCAPE_ANY_NP, esc); 68 return string_escape_str(src, dst, sz, ESCAPE_ANY_NP, esc);
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 7067eca501e2..cee108cbe2d5 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -307,7 +307,7 @@ extern void lru_add_drain(void);
307extern void lru_add_drain_cpu(int cpu); 307extern void lru_add_drain_cpu(int cpu);
308extern void lru_add_drain_all(void); 308extern void lru_add_drain_all(void);
309extern void rotate_reclaimable_page(struct page *page); 309extern void rotate_reclaimable_page(struct page *page);
310extern void deactivate_page(struct page *page); 310extern void deactivate_file_page(struct page *page);
311extern void swap_setup(void); 311extern void swap_setup(void);
312 312
313extern void add_page_to_unevictable_list(struct page *page); 313extern void add_page_to_unevictable_list(struct page *page);
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index b7361f831226..795d5fea5697 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -212,4 +212,7 @@ static inline void setup_sysctl_set(struct ctl_table_set *p,
212 212
213#endif /* CONFIG_SYSCTL */ 213#endif /* CONFIG_SYSCTL */
214 214
215int sysctl_max_threads(struct ctl_table *table, int write,
216 void __user *buffer, size_t *lenp, loff_t *ppos);
217
215#endif /* _LINUX_SYSCTL_H */ 218#endif /* _LINUX_SYSCTL_H */
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index ddad16148bd6..99382c0df17e 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -57,6 +57,21 @@ do { \
57#define sysfs_attr_init(attr) do {} while (0) 57#define sysfs_attr_init(attr) do {} while (0)
58#endif 58#endif
59 59
60/**
61 * struct attribute_group - data structure used to declare an attribute group.
62 * @name: Optional: Attribute group name
63 * If specified, the attribute group will be created in
64 * a new subdirectory with this name.
65 * @is_visible: Optional: Function to return permissions associated with an
66 * attribute of the group. Will be called repeatedly for each
67 * attribute in the group. Only read/write permissions as well as
68 * SYSFS_PREALLOC are accepted. Must return 0 if an attribute is
69 * not visible. The returned value will replace static permissions
70 * defined in struct attribute or struct bin_attribute.
71 * @attrs: Pointer to NULL terminated list of attributes.
72 * @bin_attrs: Pointer to NULL terminated list of binary attributes.
73 * Either attrs or bin_attrs or both must be provided.
74 */
60struct attribute_group { 75struct attribute_group {
61 const char *name; 76 const char *name;
62 umode_t (*is_visible)(struct kobject *, 77 umode_t (*is_visible)(struct kobject *,
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 1a7adb411647..0caa3a2d4106 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -58,6 +58,7 @@ static inline unsigned int tcp_optlen(const struct sk_buff *skb)
58struct tcp_fastopen_cookie { 58struct tcp_fastopen_cookie {
59 s8 len; 59 s8 len;
60 u8 val[TCP_FASTOPEN_COOKIE_MAX]; 60 u8 val[TCP_FASTOPEN_COOKIE_MAX];
61 bool exp; /* In RFC6994 experimental option format */
61}; 62};
62 63
63/* This defines a selective acknowledgement block. */ 64/* This defines a selective acknowledgement block. */
@@ -111,7 +112,7 @@ struct tcp_request_sock_ops;
111struct tcp_request_sock { 112struct tcp_request_sock {
112 struct inet_request_sock req; 113 struct inet_request_sock req;
113 const struct tcp_request_sock_ops *af_specific; 114 const struct tcp_request_sock_ops *af_specific;
114 struct sock *listener; /* needed for TFO */ 115 bool tfo_listener;
115 u32 rcv_isn; 116 u32 rcv_isn;
116 u32 snt_isn; 117 u32 snt_isn;
117 u32 snt_synack; /* synack sent time */ 118 u32 snt_synack; /* synack sent time */
@@ -188,6 +189,7 @@ struct tcp_sock {
188 u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */ 189 u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */
189 syn_data:1, /* SYN includes data */ 190 syn_data:1, /* SYN includes data */
190 syn_fastopen:1, /* SYN includes Fast Open option */ 191 syn_fastopen:1, /* SYN includes Fast Open option */
192 syn_fastopen_exp:1,/* SYN includes Fast Open exp. option */
191 syn_data_acked:1,/* data in SYN is acked by SYN-ACK */ 193 syn_data_acked:1,/* data in SYN is acked by SYN-ACK */
192 is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */ 194 is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */
193 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */ 195 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */
@@ -236,7 +238,6 @@ struct tcp_sock {
236 u32 lost_out; /* Lost packets */ 238 u32 lost_out; /* Lost packets */
237 u32 sacked_out; /* SACK'd packets */ 239 u32 sacked_out; /* SACK'd packets */
238 u32 fackets_out; /* FACK'd packets */ 240 u32 fackets_out; /* FACK'd packets */
239 u32 tso_deferred;
240 241
241 /* from STCP, retrans queue hinting */ 242 /* from STCP, retrans queue hinting */
242 struct sk_buff* lost_skb_hint; 243 struct sk_buff* lost_skb_hint;
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 9c085dc12ae9..f8492da57ad3 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -1,7 +1,5 @@
1/* linux/include/linux/tick.h 1/*
2 * 2 * Tick related global functions
3 * This file contains the structure definitions for tick related functions
4 *
5 */ 3 */
6#ifndef _LINUX_TICK_H 4#ifndef _LINUX_TICK_H
7#define _LINUX_TICK_H 5#define _LINUX_TICK_H
@@ -9,149 +7,99 @@
9#include <linux/clockchips.h> 7#include <linux/clockchips.h>
10#include <linux/irqflags.h> 8#include <linux/irqflags.h>
11#include <linux/percpu.h> 9#include <linux/percpu.h>
12#include <linux/hrtimer.h>
13#include <linux/context_tracking_state.h> 10#include <linux/context_tracking_state.h>
14#include <linux/cpumask.h> 11#include <linux/cpumask.h>
15#include <linux/sched.h> 12#include <linux/sched.h>
16 13
17#ifdef CONFIG_GENERIC_CLOCKEVENTS 14#ifdef CONFIG_GENERIC_CLOCKEVENTS
18
19enum tick_device_mode {
20 TICKDEV_MODE_PERIODIC,
21 TICKDEV_MODE_ONESHOT,
22};
23
24struct tick_device {
25 struct clock_event_device *evtdev;
26 enum tick_device_mode mode;
27};
28
29enum tick_nohz_mode {
30 NOHZ_MODE_INACTIVE,
31 NOHZ_MODE_LOWRES,
32 NOHZ_MODE_HIGHRES,
33};
34
35/**
36 * struct tick_sched - sched tick emulation and no idle tick control/stats
37 * @sched_timer: hrtimer to schedule the periodic tick in high
38 * resolution mode
39 * @last_tick: Store the last tick expiry time when the tick
40 * timer is modified for nohz sleeps. This is necessary
41 * to resume the tick timer operation in the timeline
42 * when the CPU returns from nohz sleep.
43 * @tick_stopped: Indicator that the idle tick has been stopped
44 * @idle_jiffies: jiffies at the entry to idle for idle time accounting
45 * @idle_calls: Total number of idle calls
46 * @idle_sleeps: Number of idle calls, where the sched tick was stopped
47 * @idle_entrytime: Time when the idle call was entered
48 * @idle_waketime: Time when the idle was interrupted
49 * @idle_exittime: Time when the idle state was left
50 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped
51 * @iowait_sleeptime: Sum of the time slept in idle with sched tick stopped, with IO outstanding
52 * @sleep_length: Duration of the current idle sleep
53 * @do_timer_lst: CPU was the last one doing do_timer before going idle
54 */
55struct tick_sched {
56 struct hrtimer sched_timer;
57 unsigned long check_clocks;
58 enum tick_nohz_mode nohz_mode;
59 ktime_t last_tick;
60 int inidle;
61 int tick_stopped;
62 unsigned long idle_jiffies;
63 unsigned long idle_calls;
64 unsigned long idle_sleeps;
65 int idle_active;
66 ktime_t idle_entrytime;
67 ktime_t idle_waketime;
68 ktime_t idle_exittime;
69 ktime_t idle_sleeptime;
70 ktime_t iowait_sleeptime;
71 ktime_t sleep_length;
72 unsigned long last_jiffies;
73 unsigned long next_jiffies;
74 ktime_t idle_expires;
75 int do_timer_last;
76};
77
78extern void __init tick_init(void); 15extern void __init tick_init(void);
79extern int tick_is_oneshot_available(void);
80extern struct tick_device *tick_get_device(int cpu);
81
82extern void tick_freeze(void); 16extern void tick_freeze(void);
83extern void tick_unfreeze(void); 17extern void tick_unfreeze(void);
18/* Should be core only, but ARM BL switcher requires it */
19extern void tick_suspend_local(void);
20/* Should be core only, but XEN resume magic and ARM BL switcher require it */
21extern void tick_resume_local(void);
22extern void tick_handover_do_timer(void);
23extern void tick_cleanup_dead_cpu(int cpu);
24#else /* CONFIG_GENERIC_CLOCKEVENTS */
25static inline void tick_init(void) { }
26static inline void tick_freeze(void) { }
27static inline void tick_unfreeze(void) { }
28static inline void tick_suspend_local(void) { }
29static inline void tick_resume_local(void) { }
30static inline void tick_handover_do_timer(void) { }
31static inline void tick_cleanup_dead_cpu(int cpu) { }
32#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
84 33
85# ifdef CONFIG_HIGH_RES_TIMERS 34#ifdef CONFIG_TICK_ONESHOT
86extern int tick_init_highres(void);
87extern int tick_program_event(ktime_t expires, int force);
88extern void tick_setup_sched_timer(void);
89# endif
90
91# if defined CONFIG_NO_HZ_COMMON || defined CONFIG_HIGH_RES_TIMERS
92extern void tick_cancel_sched_timer(int cpu);
93# else
94static inline void tick_cancel_sched_timer(int cpu) { }
95# endif
96
97# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
98extern struct tick_device *tick_get_broadcast_device(void);
99extern struct cpumask *tick_get_broadcast_mask(void);
100
101# ifdef CONFIG_TICK_ONESHOT
102extern struct cpumask *tick_get_broadcast_oneshot_mask(void);
103# endif
104
105# endif /* BROADCAST */
106
107# ifdef CONFIG_TICK_ONESHOT
108extern void tick_clock_notify(void);
109extern int tick_check_oneshot_change(int allow_nohz);
110extern struct tick_sched *tick_get_tick_sched(int cpu);
111extern void tick_irq_enter(void); 35extern void tick_irq_enter(void);
112extern int tick_oneshot_mode_active(void);
113# ifndef arch_needs_cpu 36# ifndef arch_needs_cpu
114# define arch_needs_cpu() (0) 37# define arch_needs_cpu() (0)
115# endif 38# endif
116# else 39# else
117static inline void tick_clock_notify(void) { }
118static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
119static inline void tick_irq_enter(void) { } 40static inline void tick_irq_enter(void) { }
120static inline int tick_oneshot_mode_active(void) { return 0; } 41#endif
121# endif
122 42
123#else /* CONFIG_GENERIC_CLOCKEVENTS */ 43#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT)
124static inline void tick_init(void) { } 44extern void hotplug_cpu__broadcast_tick_pull(int dead_cpu);
125static inline void tick_freeze(void) { } 45#else
126static inline void tick_unfreeze(void) { } 46static inline void hotplug_cpu__broadcast_tick_pull(int dead_cpu) { }
127static inline void tick_cancel_sched_timer(int cpu) { } 47#endif
128static inline void tick_clock_notify(void) { }
129static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
130static inline void tick_irq_enter(void) { }
131static inline int tick_oneshot_mode_active(void) { return 0; }
132#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
133 48
134# ifdef CONFIG_NO_HZ_COMMON 49enum tick_broadcast_mode {
135DECLARE_PER_CPU(struct tick_sched, tick_cpu_sched); 50 TICK_BROADCAST_OFF,
51 TICK_BROADCAST_ON,
52 TICK_BROADCAST_FORCE,
53};
54
55enum tick_broadcast_state {
56 TICK_BROADCAST_EXIT,
57 TICK_BROADCAST_ENTER,
58};
59
60#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
61extern void tick_broadcast_control(enum tick_broadcast_mode mode);
62#else
63static inline void tick_broadcast_control(enum tick_broadcast_mode mode) { }
64#endif /* BROADCAST */
65
66#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT)
67extern int tick_broadcast_oneshot_control(enum tick_broadcast_state state);
68#else
69static inline int tick_broadcast_oneshot_control(enum tick_broadcast_state state) { return 0; }
70#endif
136 71
137static inline int tick_nohz_tick_stopped(void) 72static inline void tick_broadcast_enable(void)
73{
74 tick_broadcast_control(TICK_BROADCAST_ON);
75}
76static inline void tick_broadcast_disable(void)
77{
78 tick_broadcast_control(TICK_BROADCAST_OFF);
79}
80static inline void tick_broadcast_force(void)
81{
82 tick_broadcast_control(TICK_BROADCAST_FORCE);
83}
84static inline int tick_broadcast_enter(void)
138{ 85{
139 return __this_cpu_read(tick_cpu_sched.tick_stopped); 86 return tick_broadcast_oneshot_control(TICK_BROADCAST_ENTER);
87}
88static inline void tick_broadcast_exit(void)
89{
90 tick_broadcast_oneshot_control(TICK_BROADCAST_EXIT);
140} 91}
141 92
93#ifdef CONFIG_NO_HZ_COMMON
94extern int tick_nohz_tick_stopped(void);
142extern void tick_nohz_idle_enter(void); 95extern void tick_nohz_idle_enter(void);
143extern void tick_nohz_idle_exit(void); 96extern void tick_nohz_idle_exit(void);
144extern void tick_nohz_irq_exit(void); 97extern void tick_nohz_irq_exit(void);
145extern ktime_t tick_nohz_get_sleep_length(void); 98extern ktime_t tick_nohz_get_sleep_length(void);
146extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); 99extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
147extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time); 100extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);
148 101#else /* !CONFIG_NO_HZ_COMMON */
149# else /* !CONFIG_NO_HZ_COMMON */ 102static inline int tick_nohz_tick_stopped(void) { return 0; }
150static inline int tick_nohz_tick_stopped(void)
151{
152 return 0;
153}
154
155static inline void tick_nohz_idle_enter(void) { } 103static inline void tick_nohz_idle_enter(void) { }
156static inline void tick_nohz_idle_exit(void) { } 104static inline void tick_nohz_idle_exit(void) { }
157 105
@@ -163,7 +111,7 @@ static inline ktime_t tick_nohz_get_sleep_length(void)
163} 111}
164static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; } 112static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }
165static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; } 113static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
166# endif /* !CONFIG_NO_HZ_COMMON */ 114#endif /* !CONFIG_NO_HZ_COMMON */
167 115
168#ifdef CONFIG_NO_HZ_FULL 116#ifdef CONFIG_NO_HZ_FULL
169extern bool tick_nohz_full_running; 117extern bool tick_nohz_full_running;
diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h
index 05af9a334893..fb86963859c7 100644
--- a/include/linux/timekeeper_internal.h
+++ b/include/linux/timekeeper_internal.h
@@ -16,16 +16,16 @@
16 * @read: Read function of @clock 16 * @read: Read function of @clock
17 * @mask: Bitmask for two's complement subtraction of non 64bit clocks 17 * @mask: Bitmask for two's complement subtraction of non 64bit clocks
18 * @cycle_last: @clock cycle value at last update 18 * @cycle_last: @clock cycle value at last update
19 * @mult: NTP adjusted multiplier for scaled math conversion 19 * @mult: (NTP adjusted) multiplier for scaled math conversion
20 * @shift: Shift value for scaled math conversion 20 * @shift: Shift value for scaled math conversion
21 * @xtime_nsec: Shifted (fractional) nano seconds offset for readout 21 * @xtime_nsec: Shifted (fractional) nano seconds offset for readout
22 * @base_mono: ktime_t (nanoseconds) base time for readout 22 * @base: ktime_t (nanoseconds) base time for readout
23 * 23 *
24 * This struct has size 56 byte on 64 bit. Together with a seqcount it 24 * This struct has size 56 byte on 64 bit. Together with a seqcount it
25 * occupies a single 64byte cache line. 25 * occupies a single 64byte cache line.
26 * 26 *
27 * The struct is separate from struct timekeeper as it is also used 27 * The struct is separate from struct timekeeper as it is also used
28 * for a fast NMI safe accessor to clock monotonic. 28 * for a fast NMI safe accessors.
29 */ 29 */
30struct tk_read_base { 30struct tk_read_base {
31 struct clocksource *clock; 31 struct clocksource *clock;
@@ -35,12 +35,13 @@ struct tk_read_base {
35 u32 mult; 35 u32 mult;
36 u32 shift; 36 u32 shift;
37 u64 xtime_nsec; 37 u64 xtime_nsec;
38 ktime_t base_mono; 38 ktime_t base;
39}; 39};
40 40
41/** 41/**
42 * struct timekeeper - Structure holding internal timekeeping values. 42 * struct timekeeper - Structure holding internal timekeeping values.
43 * @tkr: The readout base structure 43 * @tkr_mono: The readout base structure for CLOCK_MONOTONIC
44 * @tkr_raw: The readout base structure for CLOCK_MONOTONIC_RAW
44 * @xtime_sec: Current CLOCK_REALTIME time in seconds 45 * @xtime_sec: Current CLOCK_REALTIME time in seconds
45 * @ktime_sec: Current CLOCK_MONOTONIC time in seconds 46 * @ktime_sec: Current CLOCK_MONOTONIC time in seconds
46 * @wall_to_monotonic: CLOCK_REALTIME to CLOCK_MONOTONIC offset 47 * @wall_to_monotonic: CLOCK_REALTIME to CLOCK_MONOTONIC offset
@@ -48,7 +49,6 @@ struct tk_read_base {
48 * @offs_boot: Offset clock monotonic -> clock boottime 49 * @offs_boot: Offset clock monotonic -> clock boottime
49 * @offs_tai: Offset clock monotonic -> clock tai 50 * @offs_tai: Offset clock monotonic -> clock tai
50 * @tai_offset: The current UTC to TAI offset in seconds 51 * @tai_offset: The current UTC to TAI offset in seconds
51 * @base_raw: Monotonic raw base time in ktime_t format
52 * @raw_time: Monotonic raw base time in timespec64 format 52 * @raw_time: Monotonic raw base time in timespec64 format
53 * @cycle_interval: Number of clock cycles in one NTP interval 53 * @cycle_interval: Number of clock cycles in one NTP interval
54 * @xtime_interval: Number of clock shifted nano seconds in one NTP 54 * @xtime_interval: Number of clock shifted nano seconds in one NTP
@@ -76,7 +76,8 @@ struct tk_read_base {
76 * used instead. 76 * used instead.
77 */ 77 */
78struct timekeeper { 78struct timekeeper {
79 struct tk_read_base tkr; 79 struct tk_read_base tkr_mono;
80 struct tk_read_base tkr_raw;
80 u64 xtime_sec; 81 u64 xtime_sec;
81 unsigned long ktime_sec; 82 unsigned long ktime_sec;
82 struct timespec64 wall_to_monotonic; 83 struct timespec64 wall_to_monotonic;
@@ -84,7 +85,6 @@ struct timekeeper {
84 ktime_t offs_boot; 85 ktime_t offs_boot;
85 ktime_t offs_tai; 86 ktime_t offs_tai;
86 s32 tai_offset; 87 s32 tai_offset;
87 ktime_t base_raw;
88 struct timespec64 raw_time; 88 struct timespec64 raw_time;
89 89
90 /* The following members are for timekeeping internal use */ 90 /* The following members are for timekeeping internal use */
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 3eaae4754275..99176af216af 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -214,12 +214,18 @@ static inline u64 ktime_get_boot_ns(void)
214 return ktime_to_ns(ktime_get_boottime()); 214 return ktime_to_ns(ktime_get_boottime());
215} 215}
216 216
217static inline u64 ktime_get_tai_ns(void)
218{
219 return ktime_to_ns(ktime_get_clocktai());
220}
221
217static inline u64 ktime_get_raw_ns(void) 222static inline u64 ktime_get_raw_ns(void)
218{ 223{
219 return ktime_to_ns(ktime_get_raw()); 224 return ktime_to_ns(ktime_get_raw());
220} 225}
221 226
222extern u64 ktime_get_mono_fast_ns(void); 227extern u64 ktime_get_mono_fast_ns(void);
228extern u64 ktime_get_raw_fast_ns(void);
223 229
224/* 230/*
225 * Timespec interfaces utilizing the ktime based ones 231 * Timespec interfaces utilizing the ktime based ones
@@ -242,6 +248,9 @@ static inline void timekeeping_clocktai(struct timespec *ts)
242/* 248/*
243 * RTC specific 249 * RTC specific
244 */ 250 */
251extern bool timekeeping_rtc_skipsuspend(void);
252extern bool timekeeping_rtc_skipresume(void);
253
245extern void timekeeping_inject_sleeptime64(struct timespec64 *delta); 254extern void timekeeping_inject_sleeptime64(struct timespec64 *delta);
246 255
247/* 256/*
@@ -253,17 +262,14 @@ extern void getnstime_raw_and_real(struct timespec *ts_raw,
253/* 262/*
254 * Persistent clock related interfaces 263 * Persistent clock related interfaces
255 */ 264 */
256extern bool persistent_clock_exist;
257extern int persistent_clock_is_local; 265extern int persistent_clock_is_local;
258 266
259static inline bool has_persistent_clock(void)
260{
261 return persistent_clock_exist;
262}
263
264extern void read_persistent_clock(struct timespec *ts); 267extern void read_persistent_clock(struct timespec *ts);
268extern void read_persistent_clock64(struct timespec64 *ts);
265extern void read_boot_clock(struct timespec *ts); 269extern void read_boot_clock(struct timespec *ts);
270extern void read_boot_clock64(struct timespec64 *ts);
266extern int update_persistent_clock(struct timespec now); 271extern int update_persistent_clock(struct timespec now);
272extern int update_persistent_clock64(struct timespec64 now);
267 273
268 274
269#endif 275#endif
diff --git a/include/linux/tracefs.h b/include/linux/tracefs.h
new file mode 100644
index 000000000000..5b727a17beee
--- /dev/null
+++ b/include/linux/tracefs.h
@@ -0,0 +1,45 @@
1/*
2 * tracefs.h - a pseudo file system for activating tracing
3 *
4 * Based on debugfs by: 2004 Greg Kroah-Hartman <greg@kroah.com>
5 *
6 * Copyright (C) 2014 Red Hat Inc, author: Steven Rostedt <srostedt@redhat.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 License version
10 * 2 as published by the Free Software Foundation.
11 *
12 * tracefs is the file system that is used by the tracing infrastructure.
13 *
14 */
15
16#ifndef _TRACEFS_H_
17#define _TRACEFS_H_
18
19#include <linux/fs.h>
20#include <linux/seq_file.h>
21
22#include <linux/types.h>
23
24struct file_operations;
25
26#ifdef CONFIG_TRACING
27
28struct dentry *tracefs_create_file(const char *name, umode_t mode,
29 struct dentry *parent, void *data,
30 const struct file_operations *fops);
31
32struct dentry *tracefs_create_dir(const char *name, struct dentry *parent);
33
34void tracefs_remove(struct dentry *dentry);
35void tracefs_remove_recursive(struct dentry *dentry);
36
37struct dentry *tracefs_create_instance_dir(const char *name, struct dentry *parent,
38 int (*mkdir)(const char *name),
39 int (*rmdir)(const char *name));
40
41bool tracefs_initialized(void);
42
43#endif /* CONFIG_TRACING */
44
45#endif
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index c72851328ca9..a5f7f3ecafa3 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -36,6 +36,12 @@ struct tracepoint {
36 struct tracepoint_func __rcu *funcs; 36 struct tracepoint_func __rcu *funcs;
37}; 37};
38 38
39struct trace_enum_map {
40 const char *system;
41 const char *enum_string;
42 unsigned long enum_value;
43};
44
39extern int 45extern int
40tracepoint_probe_register(struct tracepoint *tp, void *probe, void *data); 46tracepoint_probe_register(struct tracepoint *tp, void *probe, void *data);
41extern int 47extern int
@@ -87,6 +93,8 @@ extern void syscall_unregfunc(void);
87 93
88#define PARAMS(args...) args 94#define PARAMS(args...) args
89 95
96#define TRACE_DEFINE_ENUM(x)
97
90#endif /* _LINUX_TRACEPOINT_H */ 98#endif /* _LINUX_TRACEPOINT_H */
91 99
92/* 100/*
diff --git a/include/linux/types.h b/include/linux/types.h
index 6747247e3f9f..59698be03490 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -146,12 +146,6 @@ typedef u64 dma_addr_t;
146typedef u32 dma_addr_t; 146typedef u32 dma_addr_t;
147#endif /* dma_addr_t */ 147#endif /* dma_addr_t */
148 148
149#ifdef __CHECKER__
150#else
151#endif
152#ifdef __CHECK_ENDIAN__
153#else
154#endif
155typedef unsigned __bitwise__ gfp_t; 149typedef unsigned __bitwise__ gfp_t;
156typedef unsigned __bitwise__ fmode_t; 150typedef unsigned __bitwise__ fmode_t;
157typedef unsigned __bitwise__ oom_flags_t; 151typedef unsigned __bitwise__ oom_flags_t;
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 247cfdcc4b08..87c094961bd5 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -34,7 +34,7 @@ static inline struct udphdr *inner_udp_hdr(const struct sk_buff *skb)
34 34
35#define UDP_HTABLE_SIZE_MIN (CONFIG_BASE_SMALL ? 128 : 256) 35#define UDP_HTABLE_SIZE_MIN (CONFIG_BASE_SMALL ? 128 : 256)
36 36
37static inline int udp_hashfn(struct net *net, unsigned num, unsigned mask) 37static inline u32 udp_hashfn(const struct net *net, u32 num, u32 mask)
38{ 38{
39 return (num + net_hash_mix(net)) & mask; 39 return (num + net_hash_mix(net)) & mask;
40} 40}
diff --git a/include/linux/uidgid.h b/include/linux/uidgid.h
index 2d1f9b627f91..0ee05da38899 100644
--- a/include/linux/uidgid.h
+++ b/include/linux/uidgid.h
@@ -29,6 +29,7 @@ typedef struct {
29#define KUIDT_INIT(value) (kuid_t){ value } 29#define KUIDT_INIT(value) (kuid_t){ value }
30#define KGIDT_INIT(value) (kgid_t){ value } 30#define KGIDT_INIT(value) (kgid_t){ value }
31 31
32#ifdef CONFIG_MULTIUSER
32static inline uid_t __kuid_val(kuid_t uid) 33static inline uid_t __kuid_val(kuid_t uid)
33{ 34{
34 return uid.val; 35 return uid.val;
@@ -38,6 +39,17 @@ static inline gid_t __kgid_val(kgid_t gid)
38{ 39{
39 return gid.val; 40 return gid.val;
40} 41}
42#else
43static inline uid_t __kuid_val(kuid_t uid)
44{
45 return 0;
46}
47
48static inline gid_t __kgid_val(kgid_t gid)
49{
50 return 0;
51}
52#endif
41 53
42#define GLOBAL_ROOT_UID KUIDT_INIT(0) 54#define GLOBAL_ROOT_UID KUIDT_INIT(0)
43#define GLOBAL_ROOT_GID KGIDT_INIT(0) 55#define GLOBAL_ROOT_GID KGIDT_INIT(0)
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 71880299ed48..8b01e1c3c614 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -76,6 +76,7 @@ size_t iov_iter_copy_from_user_atomic(struct page *page,
76 struct iov_iter *i, unsigned long offset, size_t bytes); 76 struct iov_iter *i, unsigned long offset, size_t bytes);
77void iov_iter_advance(struct iov_iter *i, size_t bytes); 77void iov_iter_advance(struct iov_iter *i, size_t bytes);
78int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); 78int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes);
79int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes);
79size_t iov_iter_single_seg_count(const struct iov_iter *i); 80size_t iov_iter_single_seg_count(const struct iov_iter *i);
80size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, 81size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
81 struct iov_iter *i); 82 struct iov_iter *i);
@@ -111,6 +112,14 @@ static inline bool iter_is_iovec(struct iov_iter *i)
111} 112}
112 113
113/* 114/*
115 * Get one of READ or WRITE out of iter->type without any other flags OR'd in
116 * with it.
117 *
118 * The ?: is just for type safety.
119 */
120#define iov_iter_rw(i) ((0 ? (struct iov_iter *)0 : (i))->type & RW_MASK)
121
122/*
114 * Cap the iov_iter by given limit; note that the second argument is 123 * Cap the iov_iter by given limit; note that the second argument is
115 * *not* the new size - it's upper limit for such. Passing it a value 124 * *not* the new size - it's upper limit for such. Passing it a value
116 * greater than the amount of data in iov_iter is fine - it'll just do 125 * greater than the amount of data in iov_iter is fine - it'll just do
@@ -139,4 +148,18 @@ static inline void iov_iter_reexpand(struct iov_iter *i, size_t count)
139size_t csum_and_copy_to_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i); 148size_t csum_and_copy_to_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i);
140size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i); 149size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i);
141 150
151int import_iovec(int type, const struct iovec __user * uvector,
152 unsigned nr_segs, unsigned fast_segs,
153 struct iovec **iov, struct iov_iter *i);
154
155#ifdef CONFIG_COMPAT
156struct compat_iovec;
157int compat_import_iovec(int type, const struct compat_iovec __user * uvector,
158 unsigned nr_segs, unsigned fast_segs,
159 struct iovec **iov, struct iov_iter *i);
160#endif
161
162int import_single_range(int type, void __user *buf, size_t len,
163 struct iovec *iov, struct iov_iter *i);
164
142#endif 165#endif
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 7ee1b5c3b4cb..447fe29b55b4 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -205,6 +205,32 @@ void usb_put_intf(struct usb_interface *intf);
205#define USB_MAXINTERFACES 32 205#define USB_MAXINTERFACES 32
206#define USB_MAXIADS (USB_MAXINTERFACES/2) 206#define USB_MAXIADS (USB_MAXINTERFACES/2)
207 207
208/*
209 * USB Resume Timer: Every Host controller driver should drive the resume
210 * signalling on the bus for the amount of time defined by this macro.
211 *
212 * That way we will have a 'stable' behavior among all HCDs supported by Linux.
213 *
214 * Note that the USB Specification states we should drive resume for *at least*
215 * 20 ms, but it doesn't give an upper bound. This creates two possible
216 * situations which we want to avoid:
217 *
218 * (a) sometimes an msleep(20) might expire slightly before 20 ms, which causes
219 * us to fail USB Electrical Tests, thus failing Certification
220 *
221 * (b) Some (many) devices actually need more than 20 ms of resume signalling,
222 * and while we can argue that's against the USB Specification, we don't have
223 * control over which devices a certification laboratory will be using for
224 * certification. If CertLab uses a device which was tested against Windows and
225 * that happens to have relaxed resume signalling rules, we might fall into
226 * situations where we fail interoperability and electrical tests.
227 *
228 * In order to avoid both conditions, we're using a 40 ms resume timeout, which
229 * should cope with both LPJ calibration errors and devices not following every
230 * detail of the USB Specification.
231 */
232#define USB_RESUME_TIMEOUT 40 /* ms */
233
208/** 234/**
209 * struct usb_interface_cache - long-term representation of a device interface 235 * struct usb_interface_cache - long-term representation of a device interface
210 * @num_altsetting: number of altsettings defined. 236 * @num_altsetting: number of altsettings defined.
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index 535997a6681b..ab94f78c4dd1 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -19,6 +19,7 @@ struct ci_hdrc_platform_data {
19 enum usb_phy_interface phy_mode; 19 enum usb_phy_interface phy_mode;
20 unsigned long flags; 20 unsigned long flags;
21#define CI_HDRC_REGS_SHARED BIT(0) 21#define CI_HDRC_REGS_SHARED BIT(0)
22#define CI_HDRC_SUPPORTS_RUNTIME_PM BIT(2)
22#define CI_HDRC_DISABLE_STREAMING BIT(3) 23#define CI_HDRC_DISABLE_STREAMING BIT(3)
23 /* 24 /*
24 * Only set it when DCCPARAMS.DC==1 and DCCPARAMS.HC==1, 25 * Only set it when DCCPARAMS.DC==1 and DCCPARAMS.HC==1,
@@ -27,6 +28,7 @@ struct ci_hdrc_platform_data {
27#define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4) 28#define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4)
28#define CI_HDRC_IMX28_WRITE_FIX BIT(5) 29#define CI_HDRC_IMX28_WRITE_FIX BIT(5)
29#define CI_HDRC_FORCE_FULLSPEED BIT(6) 30#define CI_HDRC_FORCE_FULLSPEED BIT(6)
31#define CI_HDRC_TURN_VBUS_EARLY_ON BIT(7)
30 enum usb_dr_mode dr_mode; 32 enum usb_dr_mode dr_mode;
31#define CI_HDRC_CONTROLLER_RESET_EVENT 0 33#define CI_HDRC_CONTROLLER_RESET_EVENT 0
32#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 34#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 3d87defcc527..2511469a9904 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -148,6 +148,7 @@ struct usb_os_desc_table {
148 * @disable: (REQUIRED) Indicates the function should be disabled. Reasons 148 * @disable: (REQUIRED) Indicates the function should be disabled. Reasons
149 * include host resetting or reconfiguring the gadget, and disconnection. 149 * include host resetting or reconfiguring the gadget, and disconnection.
150 * @setup: Used for interface-specific control requests. 150 * @setup: Used for interface-specific control requests.
151 * @req_match: Tests if a given class request can be handled by this function.
151 * @suspend: Notifies functions when the host stops sending USB traffic. 152 * @suspend: Notifies functions when the host stops sending USB traffic.
152 * @resume: Notifies functions when the host restarts USB traffic. 153 * @resume: Notifies functions when the host restarts USB traffic.
153 * @get_status: Returns function status as a reply to 154 * @get_status: Returns function status as a reply to
@@ -213,6 +214,8 @@ struct usb_function {
213 void (*disable)(struct usb_function *); 214 void (*disable)(struct usb_function *);
214 int (*setup)(struct usb_function *, 215 int (*setup)(struct usb_function *,
215 const struct usb_ctrlrequest *); 216 const struct usb_ctrlrequest *);
217 bool (*req_match)(struct usb_function *,
218 const struct usb_ctrlrequest *);
216 void (*suspend)(struct usb_function *); 219 void (*suspend)(struct usb_function *);
217 void (*resume)(struct usb_function *); 220 void (*resume)(struct usb_function *);
218 221
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index e2f00fd8cd47..4f3dfb7d0654 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -190,7 +190,7 @@ struct usb_ep {
190 * @ep:the endpoint being configured 190 * @ep:the endpoint being configured
191 * @maxpacket_limit:value of maximum packet size limit 191 * @maxpacket_limit:value of maximum packet size limit
192 * 192 *
193 * This function shoud be used only in UDC drivers to initialize endpoint 193 * This function should be used only in UDC drivers to initialize endpoint
194 * (usually in probe function). 194 * (usually in probe function).
195 */ 195 */
196static inline void usb_ep_set_maxpacket_limit(struct usb_ep *ep, 196static inline void usb_ep_set_maxpacket_limit(struct usb_ep *ep,
@@ -474,6 +474,7 @@ struct usb_dcd_config_params {
474 474
475struct usb_gadget; 475struct usb_gadget;
476struct usb_gadget_driver; 476struct usb_gadget_driver;
477struct usb_udc;
477 478
478/* the rest of the api to the controller hardware: device operations, 479/* the rest of the api to the controller hardware: device operations,
479 * which don't involve endpoints (or i/o). 480 * which don't involve endpoints (or i/o).
@@ -496,6 +497,7 @@ struct usb_gadget_ops {
496/** 497/**
497 * struct usb_gadget - represents a usb slave device 498 * struct usb_gadget - represents a usb slave device
498 * @work: (internal use) Workqueue to be used for sysfs_notify() 499 * @work: (internal use) Workqueue to be used for sysfs_notify()
500 * @udc: struct usb_udc pointer for this gadget
499 * @ops: Function pointers used to access hardware-specific operations. 501 * @ops: Function pointers used to access hardware-specific operations.
500 * @ep0: Endpoint zero, used when reading or writing responses to 502 * @ep0: Endpoint zero, used when reading or writing responses to
501 * driver setup() requests 503 * driver setup() requests
@@ -545,6 +547,7 @@ struct usb_gadget_ops {
545 */ 547 */
546struct usb_gadget { 548struct usb_gadget {
547 struct work_struct work; 549 struct work_struct work;
550 struct usb_udc *udc;
548 /* readonly to gadget driver */ 551 /* readonly to gadget driver */
549 const struct usb_gadget_ops *ops; 552 const struct usb_gadget_ops *ops;
550 struct usb_ep *ep0; 553 struct usb_ep *ep0;
@@ -1029,6 +1032,10 @@ extern void usb_gadget_udc_reset(struct usb_gadget *gadget,
1029extern void usb_gadget_giveback_request(struct usb_ep *ep, 1032extern void usb_gadget_giveback_request(struct usb_ep *ep,
1030 struct usb_request *req); 1033 struct usb_request *req);
1031 1034
1035/*-------------------------------------------------------------------------*/
1036
1037/* utility to update vbus status for udc core, it may be scheduled */
1038extern void usb_udc_vbus_handler(struct usb_gadget *gadget, bool status);
1032 1039
1033/*-------------------------------------------------------------------------*/ 1040/*-------------------------------------------------------------------------*/
1034 1041
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index b0a39243295a..7dbecf9a4656 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -117,8 +117,6 @@ struct msm_otg_platform_data {
117 enum otg_control_type otg_control; 117 enum otg_control_type otg_control;
118 enum msm_usb_phy_type phy_type; 118 enum msm_usb_phy_type phy_type;
119 void (*setup_gpio)(enum usb_otg_state state); 119 void (*setup_gpio)(enum usb_otg_state state);
120 int (*link_clk_reset)(struct clk *link_clk, bool assert);
121 int (*phy_clk_reset)(struct clk *phy_clk);
122}; 120};
123 121
124/** 122/**
@@ -128,7 +126,6 @@ struct msm_otg_platform_data {
128 * @irq: IRQ number assigned for HSUSB controller. 126 * @irq: IRQ number assigned for HSUSB controller.
129 * @clk: clock struct of usb_hs_clk. 127 * @clk: clock struct of usb_hs_clk.
130 * @pclk: clock struct of usb_hs_pclk. 128 * @pclk: clock struct of usb_hs_pclk.
131 * @phy_reset_clk: clock struct of usb_phy_clk.
132 * @core_clk: clock struct of usb_hs_core_clk. 129 * @core_clk: clock struct of usb_hs_core_clk.
133 * @regs: ioremapped register base address. 130 * @regs: ioremapped register base address.
134 * @inputs: OTG state machine inputs(Id, SessValid etc). 131 * @inputs: OTG state machine inputs(Id, SessValid etc).
@@ -148,7 +145,6 @@ struct msm_otg {
148 int irq; 145 int irq;
149 struct clk *clk; 146 struct clk *clk;
150 struct clk *pclk; 147 struct clk *pclk;
151 struct clk *phy_reset_clk;
152 struct clk *core_clk; 148 struct clk *core_clk;
153 void __iomem *regs; 149 void __iomem *regs;
154#define ID 0 150#define ID 0
diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h
index b6ba1bfb86f2..f728f1854829 100644
--- a/include/linux/usb/otg-fsm.h
+++ b/include/linux/usb/otg-fsm.h
@@ -53,6 +53,8 @@ enum otg_fsm_timer {
53 B_SE0_SRP, 53 B_SE0_SRP,
54 B_SRP_FAIL, 54 B_SRP_FAIL,
55 A_WAIT_ENUM, 55 A_WAIT_ENUM,
56 B_DATA_PLS,
57 B_SSEND_SRP,
56 58
57 NUM_OTG_FSM_TIMERS, 59 NUM_OTG_FSM_TIMERS,
58}; 60};
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index 9fd9e481ea98..f06529c14141 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -165,6 +165,8 @@ struct renesas_usbhs_driver_param {
165 */ 165 */
166 u32 has_otg:1; /* for controlling PWEN/EXTLP */ 166 u32 has_otg:1; /* for controlling PWEN/EXTLP */
167 u32 has_sudmac:1; /* for SUDMAC */ 167 u32 has_sudmac:1; /* for SUDMAC */
168 u32 has_usb_dmac:1; /* for USB-DMAC */
169#define USBHS_USB_DMAC_XFER_SIZE 32 /* hardcode the xfer size */
168}; 170};
169 171
170#define USBHS_TYPE_R8A7790 1 172#define USBHS_TYPE_R8A7790 1
diff --git a/include/linux/util_macros.h b/include/linux/util_macros.h
new file mode 100644
index 000000000000..d5f4fb69dba3
--- /dev/null
+++ b/include/linux/util_macros.h
@@ -0,0 +1,40 @@
1#ifndef _LINUX_HELPER_MACROS_H_
2#define _LINUX_HELPER_MACROS_H_
3
4#define __find_closest(x, a, as, op) \
5({ \
6 typeof(as) __fc_i, __fc_as = (as) - 1; \
7 typeof(x) __fc_x = (x); \
8 typeof(*a) *__fc_a = (a); \
9 for (__fc_i = 0; __fc_i < __fc_as; __fc_i++) { \
10 if (__fc_x op DIV_ROUND_CLOSEST(__fc_a[__fc_i] + \
11 __fc_a[__fc_i + 1], 2)) \
12 break; \
13 } \
14 (__fc_i); \
15})
16
17/**
18 * find_closest - locate the closest element in a sorted array
19 * @x: The reference value.
20 * @a: The array in which to look for the closest element. Must be sorted
21 * in ascending order.
22 * @as: Size of 'a'.
23 *
24 * Returns the index of the element closest to 'x'.
25 */
26#define find_closest(x, a, as) __find_closest(x, a, as, <=)
27
28/**
29 * find_closest_descending - locate the closest element in a sorted array
30 * @x: The reference value.
31 * @a: The array in which to look for the closest element. Must be sorted
32 * in descending order.
33 * @as: Size of 'a'.
34 *
35 * Similar to find_closest() but 'a' is expected to be sorted in descending
36 * order.
37 */
38#define find_closest_descending(x, a, as) __find_closest(x, a, as, >=)
39
40#endif
diff --git a/include/linux/uwb/umc.h b/include/linux/uwb/umc.h
index ba82f03d8287..02112299a1d3 100644
--- a/include/linux/uwb/umc.h
+++ b/include/linux/uwb/umc.h
@@ -87,8 +87,6 @@ struct umc_driver {
87 87
88 int (*probe)(struct umc_dev *); 88 int (*probe)(struct umc_dev *);
89 void (*remove)(struct umc_dev *); 89 void (*remove)(struct umc_dev *);
90 int (*suspend)(struct umc_dev *, pm_message_t state);
91 int (*resume)(struct umc_dev *);
92 int (*pre_reset)(struct umc_dev *); 90 int (*pre_reset)(struct umc_dev *);
93 int (*post_reset)(struct umc_dev *); 91 int (*post_reset)(struct umc_dev *);
94 92
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 2d67b8998fd8..ddb440975382 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -14,6 +14,8 @@
14 14
15#include <linux/iommu.h> 15#include <linux/iommu.h>
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/workqueue.h>
18#include <linux/poll.h>
17#include <uapi/linux/vfio.h> 19#include <uapi/linux/vfio.h>
18 20
19/** 21/**
@@ -78,19 +80,6 @@ extern int vfio_register_iommu_driver(const struct vfio_iommu_driver_ops *ops);
78extern void vfio_unregister_iommu_driver( 80extern void vfio_unregister_iommu_driver(
79 const struct vfio_iommu_driver_ops *ops); 81 const struct vfio_iommu_driver_ops *ops);
80 82
81/**
82 * offsetofend(TYPE, MEMBER)
83 *
84 * @TYPE: The type of the structure
85 * @MEMBER: The member within the structure to get the end offset of
86 *
87 * Simple helper macro for dealing with variable sized structures passed
88 * from user space. This allows us to easily determine if the provided
89 * structure is sized to include various fields.
90 */
91#define offsetofend(TYPE, MEMBER) \
92 (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER))
93
94/* 83/*
95 * External user API 84 * External user API
96 */ 85 */
@@ -123,4 +112,27 @@ static inline long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
123 return -ENOTTY; 112 return -ENOTTY;
124} 113}
125#endif /* CONFIG_EEH */ 114#endif /* CONFIG_EEH */
115
116/*
117 * IRQfd - generic
118 */
119struct virqfd {
120 void *opaque;
121 struct eventfd_ctx *eventfd;
122 int (*handler)(void *, void *);
123 void (*thread)(void *, void *);
124 void *data;
125 struct work_struct inject;
126 wait_queue_t wait;
127 poll_table pt;
128 struct work_struct shutdown;
129 struct virqfd **pvirqfd;
130};
131
132extern int vfio_virqfd_enable(void *opaque,
133 int (*handler)(void *, void *),
134 void (*thread)(void *, void *),
135 void *data, struct virqfd **pvirqfd, int fd);
136extern void vfio_virqfd_disable(struct virqfd **pvirqfd);
137
126#endif /* VFIO_H */ 138#endif /* VFIO_H */
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index c37bd4d06739..8c3b412d84df 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -65,8 +65,13 @@ struct pci_dev;
65 * out of the arbitration process (and can be safe to take 65 * out of the arbitration process (and can be safe to take
66 * interrupts at any time. 66 * interrupts at any time.
67 */ 67 */
68#if defined(CONFIG_VGA_ARB)
68extern void vga_set_legacy_decoding(struct pci_dev *pdev, 69extern void vga_set_legacy_decoding(struct pci_dev *pdev,
69 unsigned int decodes); 70 unsigned int decodes);
71#else
72static inline void vga_set_legacy_decoding(struct pci_dev *pdev,
73 unsigned int decodes) { };
74#endif
70 75
71/** 76/**
72 * vga_get - acquire & locks VGA resources 77 * vga_get - acquire & locks VGA resources
diff --git a/include/linux/vme.h b/include/linux/vme.h
index 8cd6f19ca518..79242e9c06b8 100644
--- a/include/linux/vme.h
+++ b/include/linux/vme.h
@@ -137,6 +137,7 @@ ssize_t vme_master_read(struct vme_resource *, void *, size_t, loff_t);
137ssize_t vme_master_write(struct vme_resource *, void *, size_t, loff_t); 137ssize_t vme_master_write(struct vme_resource *, void *, size_t, loff_t);
138unsigned int vme_master_rmw(struct vme_resource *, unsigned int, unsigned int, 138unsigned int vme_master_rmw(struct vme_resource *, unsigned int, unsigned int,
139 unsigned int, loff_t); 139 unsigned int, loff_t);
140int vme_master_mmap(struct vme_resource *resource, struct vm_area_struct *vma);
140void vme_master_free(struct vme_resource *); 141void vme_master_free(struct vme_resource *);
141 142
142struct vme_resource *vme_dma_request(struct vme_dev *, u32); 143struct vme_resource *vme_dma_request(struct vme_dev *, u32);
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 395b70e0eccf..a746bf5216f8 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -137,4 +137,12 @@ extern int watchdog_init_timeout(struct watchdog_device *wdd,
137extern int watchdog_register_device(struct watchdog_device *); 137extern int watchdog_register_device(struct watchdog_device *);
138extern void watchdog_unregister_device(struct watchdog_device *); 138extern void watchdog_unregister_device(struct watchdog_device *);
139 139
140#ifdef CONFIG_HARDLOCKUP_DETECTOR
141void watchdog_nmi_disable_all(void);
142void watchdog_nmi_enable_all(void);
143#else
144static inline void watchdog_nmi_disable_all(void) {}
145static inline void watchdog_nmi_enable_all(void) {}
146#endif
147
140#endif /* ifndef _LINUX_WATCHDOG_H */ 148#endif /* ifndef _LINUX_WATCHDOG_H */
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index f597846ff605..deee212af8e0 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -454,6 +454,7 @@ extern bool workqueue_congested(int cpu, struct workqueue_struct *wq);
454extern unsigned int work_busy(struct work_struct *work); 454extern unsigned int work_busy(struct work_struct *work);
455extern __printf(1, 2) void set_worker_desc(const char *fmt, ...); 455extern __printf(1, 2) void set_worker_desc(const char *fmt, ...);
456extern void print_worker_info(const char *log_lvl, struct task_struct *task); 456extern void print_worker_info(const char *log_lvl, struct task_struct *task);
457extern void show_workqueue_state(void);
457 458
458/** 459/**
459 * queue_work - queue work on a workqueue 460 * queue_work - queue work on a workqueue
diff --git a/include/linux/zsmalloc.h b/include/linux/zsmalloc.h
index 3283c6a55425..1338190b5478 100644
--- a/include/linux/zsmalloc.h
+++ b/include/linux/zsmalloc.h
@@ -47,5 +47,6 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle,
47void zs_unmap_object(struct zs_pool *pool, unsigned long handle); 47void zs_unmap_object(struct zs_pool *pool, unsigned long handle);
48 48
49unsigned long zs_get_total_pages(struct zs_pool *pool); 49unsigned long zs_get_total_pages(struct zs_pool *pool);
50unsigned long zs_compact(struct zs_pool *pool);
50 51
51#endif 52#endif