aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2013-09-04 13:25:44 -0400
committerAlex Williamson <alex.williamson@redhat.com>2013-09-04 13:25:44 -0400
commit3bc4f3993b93dbf1f6402e2034a2e20eb07db807 (patch)
tree592283e59e121b76355836295d6016fe33cfc5d1 /include/linux
parent17638db1b88184d8895f3f4551c936d7480a1d3f (diff)
parentcb3e4330e697dffaf3d9cefebc9c7e7d39c89f2e (diff)
Merge remote branch 'origin/master' into next-merge
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acpi.h7
-rw-r--r--include/linux/ata.h123
-rw-r--r--include/linux/atmel_serial.h2
-rw-r--r--include/linux/cgroup.h303
-rw-r--r--include/linux/context_tracking.h128
-rw-r--r--include/linux/context_tracking_state.h39
-rw-r--r--include/linux/cpu.h5
-rw-r--r--include/linux/cpufreq.h388
-rw-r--r--include/linux/cpuidle.h9
-rw-r--r--include/linux/dcache.h40
-rw-r--r--include/linux/debugfs.h7
-rw-r--r--include/linux/debugobjects.h6
-rw-r--r--include/linux/device.h33
-rw-r--r--include/linux/extcon/of_extcon.h31
-rw-r--r--include/linux/ftrace_event.h46
-rw-r--r--include/linux/hardirq.h117
-rw-r--r--include/linux/hyperv.h31
-rw-r--r--include/linux/iio/common/st_sensors.h14
-rw-r--r--include/linux/iio/iio.h54
-rw-r--r--include/linux/iio/sysfs.h5
-rw-r--r--include/linux/iio/trigger.h3
-rw-r--r--include/linux/inetdevice.h34
-rw-r--r--include/linux/ipv6.h1
-rw-r--r--include/linux/jiffies.h8
-rw-r--r--include/linux/kbd_kern.h3
-rw-r--r--include/linux/kernel.h2
-rw-r--r--include/linux/kobject.h4
-rw-r--r--include/linux/libata.h120
-rw-r--r--include/linux/llist.h23
-rw-r--r--include/linux/lockdep.h92
-rw-r--r--include/linux/lockref.h36
-rw-r--r--include/linux/memcontrol.h2
-rw-r--r--include/linux/memory.h14
-rw-r--r--include/linux/mfd/palmas.h17
-rw-r--r--include/linux/mfd/samsung/s2mps11.h11
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h16
-rw-r--r--include/linux/mfd/tps65217.h19
-rw-r--r--include/linux/mlx5/device.h22
-rw-r--r--include/linux/mlx5/driver.h7
-rw-r--r--include/linux/mm_types.h1
-rw-r--r--include/linux/nodemask.h11
-rw-r--r--include/linux/nsproxy.h6
-rw-r--r--include/linux/of.h14
-rw-r--r--include/linux/of_device.h15
-rw-r--r--include/linux/olpc-ec.h1
-rw-r--r--include/linux/pci-acpi.h10
-rw-r--r--include/linux/pci.h14
-rw-r--r--include/linux/pci_hotplug.h4
-rw-r--r--include/linux/pci_ids.h4
-rw-r--r--include/linux/percpu-defs.h5
-rw-r--r--include/linux/perf_event.h24
-rw-r--r--include/linux/platform_data/at91_adc.h4
-rw-r--r--include/linux/platform_data/efm32-spi.h14
-rw-r--r--include/linux/platform_data/max310x.h9
-rw-r--r--include/linux/platform_data/serial-sccnxp.h3
-rw-r--r--include/linux/platform_data/simplefb.h63
-rw-r--r--include/linux/platform_data/st_sensors_pdata.h24
-rw-r--r--include/linux/platform_data/tegra_usb.h32
-rw-r--r--include/linux/pps_kernel.h2
-rw-r--r--include/linux/preempt_mask.h122
-rw-r--r--include/linux/printk.h2
-rw-r--r--include/linux/pstore.h6
-rw-r--r--include/linux/rculist.h5
-rw-r--r--include/linux/rcupdate.h26
-rw-r--r--include/linux/regmap.h12
-rw-r--r--include/linux/regulator/consumer.h32
-rw-r--r--include/linux/regulator/driver.h25
-rw-r--r--include/linux/regulator/fan53555.h1
-rw-r--r--include/linux/regulator/machine.h1
-rw-r--r--include/linux/regulator/max8660.h2
-rw-r--r--include/linux/regulator/pfuze100.h44
-rw-r--r--include/linux/sched.h9
-rw-r--r--include/linux/spi/spi.h36
-rw-r--r--include/linux/spi/spi_bitbang.h5
-rw-r--r--include/linux/spinlock.h14
-rw-r--r--include/linux/sunrpc/sched.h1
-rw-r--r--include/linux/swapops.h2
-rw-r--r--include/linux/syscalls.h5
-rw-r--r--include/linux/sysfs.h36
-rw-r--r--include/linux/tick.h45
-rw-r--r--include/linux/tty.h66
-rw-r--r--include/linux/tty_flip.h8
-rw-r--r--include/linux/tty_ldisc.h16
-rw-r--r--include/linux/usb.h32
-rw-r--r--include/linux/usb/chipidea.h7
-rw-r--r--include/linux/usb/dwc3-omap.h30
-rw-r--r--include/linux/usb/gadget.h4
-rw-r--r--include/linux/usb/hcd.h19
-rw-r--r--include/linux/usb/of.h10
-rw-r--r--include/linux/usb/phy.h18
-rw-r--r--include/linux/usb/tegra_usb_phy.h40
-rw-r--r--include/linux/usb/usb_phy_gen_xceiv.h (renamed from include/linux/usb/nop-usb-xceiv.h)4
-rw-r--r--include/linux/usb/usbnet.h1
-rw-r--r--include/linux/usb/wusb-wa.h1
-rw-r--r--include/linux/user_namespace.h1
-rw-r--r--include/linux/vmpressure.h6
-rw-r--r--include/linux/vtime.h74
-rw-r--r--include/linux/wait.h57
-rw-r--r--include/linux/workqueue.h7
99 files changed, 1810 insertions, 1104 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 353ba256f368..a5db4aeefa36 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -481,6 +481,13 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
481 481
482acpi_status acpi_os_prepare_sleep(u8 sleep_state, 482acpi_status acpi_os_prepare_sleep(u8 sleep_state,
483 u32 pm1a_control, u32 pm1b_control); 483 u32 pm1a_control, u32 pm1b_control);
484
485void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
486 u32 val_a, u32 val_b));
487
488acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state,
489 u32 val_a, u32 val_b);
490
484#ifdef CONFIG_X86 491#ifdef CONFIG_X86
485void arch_reserve_mem_area(acpi_physical_address addr, size_t size); 492void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
486#else 493#else
diff --git a/include/linux/ata.h b/include/linux/ata.h
index ee0bd9524055..bf4c69ca76df 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -239,6 +239,8 @@ enum {
239 ATA_CMD_WRITE_QUEUED_FUA_EXT = 0x3E, 239 ATA_CMD_WRITE_QUEUED_FUA_EXT = 0x3E,
240 ATA_CMD_FPDMA_READ = 0x60, 240 ATA_CMD_FPDMA_READ = 0x60,
241 ATA_CMD_FPDMA_WRITE = 0x61, 241 ATA_CMD_FPDMA_WRITE = 0x61,
242 ATA_CMD_FPDMA_SEND = 0x64,
243 ATA_CMD_FPDMA_RECV = 0x65,
242 ATA_CMD_PIO_READ = 0x20, 244 ATA_CMD_PIO_READ = 0x20,
243 ATA_CMD_PIO_READ_EXT = 0x24, 245 ATA_CMD_PIO_READ_EXT = 0x24,
244 ATA_CMD_PIO_WRITE = 0x30, 246 ATA_CMD_PIO_WRITE = 0x30,
@@ -293,8 +295,13 @@ enum {
293 /* marked obsolete in the ATA/ATAPI-7 spec */ 295 /* marked obsolete in the ATA/ATAPI-7 spec */
294 ATA_CMD_RESTORE = 0x10, 296 ATA_CMD_RESTORE = 0x10,
295 297
298 /* Subcmds for ATA_CMD_FPDMA_SEND */
299 ATA_SUBCMD_FPDMA_SEND_DSM = 0x00,
300 ATA_SUBCMD_FPDMA_SEND_WR_LOG_DMA_EXT = 0x02,
301
296 /* READ_LOG_EXT pages */ 302 /* READ_LOG_EXT pages */
297 ATA_LOG_SATA_NCQ = 0x10, 303 ATA_LOG_SATA_NCQ = 0x10,
304 ATA_LOG_NCQ_SEND_RECV = 0x13,
298 ATA_LOG_SATA_ID_DEV_DATA = 0x30, 305 ATA_LOG_SATA_ID_DEV_DATA = 0x30,
299 ATA_LOG_SATA_SETTINGS = 0x08, 306 ATA_LOG_SATA_SETTINGS = 0x08,
300 ATA_LOG_DEVSLP_OFFSET = 0x30, 307 ATA_LOG_DEVSLP_OFFSET = 0x30,
@@ -305,6 +312,15 @@ enum {
305 ATA_LOG_DEVSLP_VALID = 0x07, 312 ATA_LOG_DEVSLP_VALID = 0x07,
306 ATA_LOG_DEVSLP_VALID_MASK = 0x80, 313 ATA_LOG_DEVSLP_VALID_MASK = 0x80,
307 314
315 /* NCQ send and receive log */
316 ATA_LOG_NCQ_SEND_RECV_SUBCMDS_OFFSET = 0x00,
317 ATA_LOG_NCQ_SEND_RECV_SUBCMDS_DSM = (1 << 0),
318 ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET = 0x04,
319 ATA_LOG_NCQ_SEND_RECV_DSM_TRIM = (1 << 0),
320 ATA_LOG_NCQ_SEND_RECV_RD_LOG_OFFSET = 0x08,
321 ATA_LOG_NCQ_SEND_RECV_WR_LOG_OFFSET = 0x0C,
322 ATA_LOG_NCQ_SEND_RECV_SIZE = 0x10,
323
308 /* READ/WRITE LONG (obsolete) */ 324 /* READ/WRITE LONG (obsolete) */
309 ATA_CMD_READ_LONG = 0x22, 325 ATA_CMD_READ_LONG = 0x22,
310 ATA_CMD_READ_LONG_ONCE = 0x23, 326 ATA_CMD_READ_LONG_ONCE = 0x23,
@@ -446,22 +462,6 @@ enum {
446 SERR_TRANS_ST_ERROR = (1 << 24), /* Transport state trans. error */ 462 SERR_TRANS_ST_ERROR = (1 << 24), /* Transport state trans. error */
447 SERR_UNRECOG_FIS = (1 << 25), /* Unrecognized FIS */ 463 SERR_UNRECOG_FIS = (1 << 25), /* Unrecognized FIS */
448 SERR_DEV_XCHG = (1 << 26), /* device exchanged */ 464 SERR_DEV_XCHG = (1 << 26), /* device exchanged */
449
450 /* struct ata_taskfile flags */
451 ATA_TFLAG_LBA48 = (1 << 0), /* enable 48-bit LBA and "HOB" */
452 ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */
453 ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */
454 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */
455 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */
456 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */
457 ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */
458
459 /* protocol flags */
460 ATA_PROT_FLAG_PIO = (1 << 0), /* is PIO */
461 ATA_PROT_FLAG_DMA = (1 << 1), /* is DMA */
462 ATA_PROT_FLAG_DATA = ATA_PROT_FLAG_PIO | ATA_PROT_FLAG_DMA,
463 ATA_PROT_FLAG_NCQ = (1 << 2), /* is NCQ */
464 ATA_PROT_FLAG_ATAPI = (1 << 3), /* is ATAPI */
465}; 465};
466 466
467enum ata_tf_protocols { 467enum ata_tf_protocols {
@@ -488,83 +488,6 @@ struct ata_bmdma_prd {
488 __le32 flags_len; 488 __le32 flags_len;
489}; 489};
490 490
491struct ata_taskfile {
492 unsigned long flags; /* ATA_TFLAG_xxx */
493 u8 protocol; /* ATA_PROT_xxx */
494
495 u8 ctl; /* control reg */
496
497 u8 hob_feature; /* additional data */
498 u8 hob_nsect; /* to support LBA48 */
499 u8 hob_lbal;
500 u8 hob_lbam;
501 u8 hob_lbah;
502
503 u8 feature;
504 u8 nsect;
505 u8 lbal;
506 u8 lbam;
507 u8 lbah;
508
509 u8 device;
510
511 u8 command; /* IO operation */
512};
513
514/*
515 * protocol tests
516 */
517static inline unsigned int ata_prot_flags(u8 prot)
518{
519 switch (prot) {
520 case ATA_PROT_NODATA:
521 return 0;
522 case ATA_PROT_PIO:
523 return ATA_PROT_FLAG_PIO;
524 case ATA_PROT_DMA:
525 return ATA_PROT_FLAG_DMA;
526 case ATA_PROT_NCQ:
527 return ATA_PROT_FLAG_DMA | ATA_PROT_FLAG_NCQ;
528 case ATAPI_PROT_NODATA:
529 return ATA_PROT_FLAG_ATAPI;
530 case ATAPI_PROT_PIO:
531 return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_PIO;
532 case ATAPI_PROT_DMA:
533 return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_DMA;
534 }
535 return 0;
536}
537
538static inline int ata_is_atapi(u8 prot)
539{
540 return ata_prot_flags(prot) & ATA_PROT_FLAG_ATAPI;
541}
542
543static inline int ata_is_nodata(u8 prot)
544{
545 return !(ata_prot_flags(prot) & ATA_PROT_FLAG_DATA);
546}
547
548static inline int ata_is_pio(u8 prot)
549{
550 return ata_prot_flags(prot) & ATA_PROT_FLAG_PIO;
551}
552
553static inline int ata_is_dma(u8 prot)
554{
555 return ata_prot_flags(prot) & ATA_PROT_FLAG_DMA;
556}
557
558static inline int ata_is_ncq(u8 prot)
559{
560 return ata_prot_flags(prot) & ATA_PROT_FLAG_NCQ;
561}
562
563static inline int ata_is_data(u8 prot)
564{
565 return ata_prot_flags(prot) & ATA_PROT_FLAG_DATA;
566}
567
568/* 491/*
569 * id tests 492 * id tests
570 */ 493 */
@@ -865,6 +788,11 @@ static inline int ata_id_rotation_rate(const u16 *id)
865 return val; 788 return val;
866} 789}
867 790
791static inline bool ata_id_has_ncq_send_and_recv(const u16 *id)
792{
793 return id[ATA_ID_SATA_CAPABILITY_2] & BIT(6);
794}
795
868static inline bool ata_id_has_trim(const u16 *id) 796static inline bool ata_id_has_trim(const u16 *id)
869{ 797{
870 if (ata_id_major_version(id) >= 7 && 798 if (ata_id_major_version(id) >= 7 &&
@@ -1060,15 +988,6 @@ static inline unsigned ata_set_lba_range_entries(void *_buffer,
1060 return used_bytes; 988 return used_bytes;
1061} 989}
1062 990
1063static inline int is_multi_taskfile(struct ata_taskfile *tf)
1064{
1065 return (tf->command == ATA_CMD_READ_MULTI) ||
1066 (tf->command == ATA_CMD_WRITE_MULTI) ||
1067 (tf->command == ATA_CMD_READ_MULTI_EXT) ||
1068 (tf->command == ATA_CMD_WRITE_MULTI_EXT) ||
1069 (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT);
1070}
1071
1072static inline bool ata_ok(u8 status) 991static inline bool ata_ok(u8 status)
1073{ 992{
1074 return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR)) 993 return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR))
diff --git a/include/linux/atmel_serial.h b/include/linux/atmel_serial.h
index fd6833764d72..be201ca2990c 100644
--- a/include/linux/atmel_serial.h
+++ b/include/linux/atmel_serial.h
@@ -124,4 +124,6 @@
124#define ATMEL_US_NER 0x44 /* Number of Errors Register */ 124#define ATMEL_US_NER 0x44 /* Number of Errors Register */
125#define ATMEL_US_IF 0x4c /* IrDA Filter Register */ 125#define ATMEL_US_IF 0x4c /* IrDA Filter Register */
126 126
127#define ATMEL_US_NAME 0xf0 /* Ip Name */
128
127#endif 129#endif
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index e9ac882868c0..3561d305b1e0 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -66,22 +66,25 @@ enum cgroup_subsys_id {
66 66
67/* Per-subsystem/per-cgroup state maintained by the system. */ 67/* Per-subsystem/per-cgroup state maintained by the system. */
68struct cgroup_subsys_state { 68struct cgroup_subsys_state {
69 /* 69 /* the cgroup that this css is attached to */
70 * The cgroup that this subsystem is attached to. Useful
71 * for subsystems that want to know about the cgroup
72 * hierarchy structure
73 */
74 struct cgroup *cgroup; 70 struct cgroup *cgroup;
75 71
72 /* the cgroup subsystem that this css is attached to */
73 struct cgroup_subsys *ss;
74
76 /* reference count - access via css_[try]get() and css_put() */ 75 /* reference count - access via css_[try]get() and css_put() */
77 struct percpu_ref refcnt; 76 struct percpu_ref refcnt;
78 77
78 /* the parent css */
79 struct cgroup_subsys_state *parent;
80
79 unsigned long flags; 81 unsigned long flags;
80 /* ID for this css, if possible */ 82 /* ID for this css, if possible */
81 struct css_id __rcu *id; 83 struct css_id __rcu *id;
82 84
83 /* Used to put @cgroup->dentry on the last css_put() */ 85 /* percpu_ref killing and RCU release */
84 struct work_struct dput_work; 86 struct rcu_head rcu_head;
87 struct work_struct destroy_work;
85}; 88};
86 89
87/* bits in struct cgroup_subsys_state flags field */ 90/* bits in struct cgroup_subsys_state flags field */
@@ -161,7 +164,16 @@ struct cgroup_name {
161struct cgroup { 164struct cgroup {
162 unsigned long flags; /* "unsigned long" so bitops work */ 165 unsigned long flags; /* "unsigned long" so bitops work */
163 166
164 int id; /* ida allocated in-hierarchy ID */ 167 /*
168 * idr allocated in-hierarchy ID.
169 *
170 * The ID of the root cgroup is always 0, and a new cgroup
171 * will be assigned with a smallest available ID.
172 */
173 int id;
174
175 /* the number of attached css's */
176 int nr_css;
165 177
166 /* 178 /*
167 * We link our 'sibling' struct into our parent's 'children'. 179 * We link our 'sibling' struct into our parent's 'children'.
@@ -196,7 +208,7 @@ struct cgroup {
196 struct cgroup_name __rcu *name; 208 struct cgroup_name __rcu *name;
197 209
198 /* Private pointers for each registered subsystem */ 210 /* Private pointers for each registered subsystem */
199 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 211 struct cgroup_subsys_state __rcu *subsys[CGROUP_SUBSYS_COUNT];
200 212
201 struct cgroupfs_root *root; 213 struct cgroupfs_root *root;
202 214
@@ -220,10 +232,12 @@ struct cgroup {
220 struct list_head pidlists; 232 struct list_head pidlists;
221 struct mutex pidlist_mutex; 233 struct mutex pidlist_mutex;
222 234
235 /* dummy css with NULL ->ss, points back to this cgroup */
236 struct cgroup_subsys_state dummy_css;
237
223 /* For css percpu_ref killing and RCU-protected deletion */ 238 /* For css percpu_ref killing and RCU-protected deletion */
224 struct rcu_head rcu_head; 239 struct rcu_head rcu_head;
225 struct work_struct destroy_work; 240 struct work_struct destroy_work;
226 atomic_t css_kill_cnt;
227 241
228 /* List of events which userspace want to receive */ 242 /* List of events which userspace want to receive */
229 struct list_head event_list; 243 struct list_head event_list;
@@ -322,7 +336,7 @@ struct cgroupfs_root {
322 unsigned long flags; 336 unsigned long flags;
323 337
324 /* IDs for cgroups in this hierarchy */ 338 /* IDs for cgroups in this hierarchy */
325 struct ida cgroup_ida; 339 struct idr cgroup_idr;
326 340
327 /* The path to use for release notifications. */ 341 /* The path to use for release notifications. */
328 char release_agent_path[PATH_MAX]; 342 char release_agent_path[PATH_MAX];
@@ -394,9 +408,10 @@ struct cgroup_map_cb {
394 408
395/* cftype->flags */ 409/* cftype->flags */
396enum { 410enum {
397 CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cg */ 411 CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cgrp */
398 CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cg */ 412 CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */
399 CFTYPE_INSANE = (1 << 2), /* don't create if sane_behavior */ 413 CFTYPE_INSANE = (1 << 2), /* don't create if sane_behavior */
414 CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */
400}; 415};
401 416
402#define MAX_CFTYPE_NAME 64 417#define MAX_CFTYPE_NAME 64
@@ -424,35 +439,41 @@ struct cftype {
424 /* CFTYPE_* flags */ 439 /* CFTYPE_* flags */
425 unsigned int flags; 440 unsigned int flags;
426 441
442 /*
443 * The subsys this file belongs to. Initialized automatically
444 * during registration. NULL for cgroup core files.
445 */
446 struct cgroup_subsys *ss;
447
427 int (*open)(struct inode *inode, struct file *file); 448 int (*open)(struct inode *inode, struct file *file);
428 ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft, 449 ssize_t (*read)(struct cgroup_subsys_state *css, struct cftype *cft,
429 struct file *file, 450 struct file *file,
430 char __user *buf, size_t nbytes, loff_t *ppos); 451 char __user *buf, size_t nbytes, loff_t *ppos);
431 /* 452 /*
432 * read_u64() is a shortcut for the common case of returning a 453 * read_u64() is a shortcut for the common case of returning a
433 * single integer. Use it in place of read() 454 * single integer. Use it in place of read()
434 */ 455 */
435 u64 (*read_u64)(struct cgroup *cgrp, struct cftype *cft); 456 u64 (*read_u64)(struct cgroup_subsys_state *css, struct cftype *cft);
436 /* 457 /*
437 * read_s64() is a signed version of read_u64() 458 * read_s64() is a signed version of read_u64()
438 */ 459 */
439 s64 (*read_s64)(struct cgroup *cgrp, struct cftype *cft); 460 s64 (*read_s64)(struct cgroup_subsys_state *css, struct cftype *cft);
440 /* 461 /*
441 * read_map() is used for defining a map of key/value 462 * read_map() is used for defining a map of key/value
442 * pairs. It should call cb->fill(cb, key, value) for each 463 * pairs. It should call cb->fill(cb, key, value) for each
443 * entry. The key/value pairs (and their ordering) should not 464 * entry. The key/value pairs (and their ordering) should not
444 * change between reboots. 465 * change between reboots.
445 */ 466 */
446 int (*read_map)(struct cgroup *cgrp, struct cftype *cft, 467 int (*read_map)(struct cgroup_subsys_state *css, struct cftype *cft,
447 struct cgroup_map_cb *cb); 468 struct cgroup_map_cb *cb);
448 /* 469 /*
449 * read_seq_string() is used for outputting a simple sequence 470 * read_seq_string() is used for outputting a simple sequence
450 * using seqfile. 471 * using seqfile.
451 */ 472 */
452 int (*read_seq_string)(struct cgroup *cgrp, struct cftype *cft, 473 int (*read_seq_string)(struct cgroup_subsys_state *css,
453 struct seq_file *m); 474 struct cftype *cft, struct seq_file *m);
454 475
455 ssize_t (*write)(struct cgroup *cgrp, struct cftype *cft, 476 ssize_t (*write)(struct cgroup_subsys_state *css, struct cftype *cft,
456 struct file *file, 477 struct file *file,
457 const char __user *buf, size_t nbytes, loff_t *ppos); 478 const char __user *buf, size_t nbytes, loff_t *ppos);
458 479
@@ -461,18 +482,20 @@ struct cftype {
461 * a single integer (as parsed by simple_strtoull) from 482 * a single integer (as parsed by simple_strtoull) from
462 * userspace. Use in place of write(); return 0 or error. 483 * userspace. Use in place of write(); return 0 or error.
463 */ 484 */
464 int (*write_u64)(struct cgroup *cgrp, struct cftype *cft, u64 val); 485 int (*write_u64)(struct cgroup_subsys_state *css, struct cftype *cft,
486 u64 val);
465 /* 487 /*
466 * write_s64() is a signed version of write_u64() 488 * write_s64() is a signed version of write_u64()
467 */ 489 */
468 int (*write_s64)(struct cgroup *cgrp, struct cftype *cft, s64 val); 490 int (*write_s64)(struct cgroup_subsys_state *css, struct cftype *cft,
491 s64 val);
469 492
470 /* 493 /*
471 * write_string() is passed a nul-terminated kernelspace 494 * write_string() is passed a nul-terminated kernelspace
472 * buffer of maximum length determined by max_write_len. 495 * buffer of maximum length determined by max_write_len.
473 * Returns 0 or -ve error code. 496 * Returns 0 or -ve error code.
474 */ 497 */
475 int (*write_string)(struct cgroup *cgrp, struct cftype *cft, 498 int (*write_string)(struct cgroup_subsys_state *css, struct cftype *cft,
476 const char *buffer); 499 const char *buffer);
477 /* 500 /*
478 * trigger() callback can be used to get some kick from the 501 * trigger() callback can be used to get some kick from the
@@ -480,7 +503,7 @@ struct cftype {
480 * at all. The private field can be used to determine the 503 * at all. The private field can be used to determine the
481 * kick type for multiplexing. 504 * kick type for multiplexing.
482 */ 505 */
483 int (*trigger)(struct cgroup *cgrp, unsigned int event); 506 int (*trigger)(struct cgroup_subsys_state *css, unsigned int event);
484 507
485 int (*release)(struct inode *inode, struct file *file); 508 int (*release)(struct inode *inode, struct file *file);
486 509
@@ -490,16 +513,18 @@ struct cftype {
490 * you want to provide this functionality. Use eventfd_signal() 513 * you want to provide this functionality. Use eventfd_signal()
491 * on eventfd to send notification to userspace. 514 * on eventfd to send notification to userspace.
492 */ 515 */
493 int (*register_event)(struct cgroup *cgrp, struct cftype *cft, 516 int (*register_event)(struct cgroup_subsys_state *css,
494 struct eventfd_ctx *eventfd, const char *args); 517 struct cftype *cft, struct eventfd_ctx *eventfd,
518 const char *args);
495 /* 519 /*
496 * unregister_event() callback will be called when userspace 520 * unregister_event() callback will be called when userspace
497 * closes the eventfd or on cgroup removing. 521 * closes the eventfd or on cgroup removing.
498 * This callback must be implemented, if you want provide 522 * This callback must be implemented, if you want provide
499 * notification functionality. 523 * notification functionality.
500 */ 524 */
501 void (*unregister_event)(struct cgroup *cgrp, struct cftype *cft, 525 void (*unregister_event)(struct cgroup_subsys_state *css,
502 struct eventfd_ctx *eventfd); 526 struct cftype *cft,
527 struct eventfd_ctx *eventfd);
503}; 528};
504 529
505/* 530/*
@@ -512,15 +537,6 @@ struct cftype_set {
512 struct cftype *cfts; 537 struct cftype *cfts;
513}; 538};
514 539
515struct cgroup_scanner {
516 struct cgroup *cg;
517 int (*test_task)(struct task_struct *p, struct cgroup_scanner *scan);
518 void (*process_task)(struct task_struct *p,
519 struct cgroup_scanner *scan);
520 struct ptr_heap *heap;
521 void *data;
522};
523
524/* 540/*
525 * See the comment above CGRP_ROOT_SANE_BEHAVIOR for details. This 541 * See the comment above CGRP_ROOT_SANE_BEHAVIOR for details. This
526 * function can be called as long as @cgrp is accessible. 542 * function can be called as long as @cgrp is accessible.
@@ -537,7 +553,7 @@ static inline const char *cgroup_name(const struct cgroup *cgrp)
537} 553}
538 554
539int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); 555int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
540int cgroup_rm_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); 556int cgroup_rm_cftypes(struct cftype *cfts);
541 557
542bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor); 558bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor);
543 559
@@ -553,20 +569,22 @@ int cgroup_task_count(const struct cgroup *cgrp);
553struct cgroup_taskset; 569struct cgroup_taskset;
554struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset); 570struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset);
555struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset); 571struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset);
556struct cgroup *cgroup_taskset_cur_cgroup(struct cgroup_taskset *tset); 572struct cgroup_subsys_state *cgroup_taskset_cur_css(struct cgroup_taskset *tset,
573 int subsys_id);
557int cgroup_taskset_size(struct cgroup_taskset *tset); 574int cgroup_taskset_size(struct cgroup_taskset *tset);
558 575
559/** 576/**
560 * cgroup_taskset_for_each - iterate cgroup_taskset 577 * cgroup_taskset_for_each - iterate cgroup_taskset
561 * @task: the loop cursor 578 * @task: the loop cursor
562 * @skip_cgrp: skip if task's cgroup matches this, %NULL to iterate through all 579 * @skip_css: skip if task's css matches this, %NULL to iterate through all
563 * @tset: taskset to iterate 580 * @tset: taskset to iterate
564 */ 581 */
565#define cgroup_taskset_for_each(task, skip_cgrp, tset) \ 582#define cgroup_taskset_for_each(task, skip_css, tset) \
566 for ((task) = cgroup_taskset_first((tset)); (task); \ 583 for ((task) = cgroup_taskset_first((tset)); (task); \
567 (task) = cgroup_taskset_next((tset))) \ 584 (task) = cgroup_taskset_next((tset))) \
568 if (!(skip_cgrp) || \ 585 if (!(skip_css) || \
569 cgroup_taskset_cur_cgroup((tset)) != (skip_cgrp)) 586 cgroup_taskset_cur_css((tset), \
587 (skip_css)->ss->subsys_id) != (skip_css))
570 588
571/* 589/*
572 * Control Group subsystem type. 590 * Control Group subsystem type.
@@ -574,18 +592,22 @@ int cgroup_taskset_size(struct cgroup_taskset *tset);
574 */ 592 */
575 593
576struct cgroup_subsys { 594struct cgroup_subsys {
577 struct cgroup_subsys_state *(*css_alloc)(struct cgroup *cgrp); 595 struct cgroup_subsys_state *(*css_alloc)(struct cgroup_subsys_state *parent_css);
578 int (*css_online)(struct cgroup *cgrp); 596 int (*css_online)(struct cgroup_subsys_state *css);
579 void (*css_offline)(struct cgroup *cgrp); 597 void (*css_offline)(struct cgroup_subsys_state *css);
580 void (*css_free)(struct cgroup *cgrp); 598 void (*css_free)(struct cgroup_subsys_state *css);
581 599
582 int (*can_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); 600 int (*can_attach)(struct cgroup_subsys_state *css,
583 void (*cancel_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); 601 struct cgroup_taskset *tset);
584 void (*attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); 602 void (*cancel_attach)(struct cgroup_subsys_state *css,
603 struct cgroup_taskset *tset);
604 void (*attach)(struct cgroup_subsys_state *css,
605 struct cgroup_taskset *tset);
585 void (*fork)(struct task_struct *task); 606 void (*fork)(struct task_struct *task);
586 void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp, 607 void (*exit)(struct cgroup_subsys_state *css,
608 struct cgroup_subsys_state *old_css,
587 struct task_struct *task); 609 struct task_struct *task);
588 void (*bind)(struct cgroup *root); 610 void (*bind)(struct cgroup_subsys_state *root_css);
589 611
590 int subsys_id; 612 int subsys_id;
591 int disabled; 613 int disabled;
@@ -641,10 +663,17 @@ struct cgroup_subsys {
641#undef IS_SUBSYS_ENABLED 663#undef IS_SUBSYS_ENABLED
642#undef SUBSYS 664#undef SUBSYS
643 665
644static inline struct cgroup_subsys_state *cgroup_subsys_state( 666/**
645 struct cgroup *cgrp, int subsys_id) 667 * css_parent - find the parent css
668 * @css: the target cgroup_subsys_state
669 *
670 * Return the parent css of @css. This function is guaranteed to return
671 * non-NULL parent as long as @css isn't the root.
672 */
673static inline
674struct cgroup_subsys_state *css_parent(struct cgroup_subsys_state *css)
646{ 675{
647 return cgrp->subsys[subsys_id]; 676 return css->parent;
648} 677}
649 678
650/** 679/**
@@ -672,7 +701,7 @@ extern struct mutex cgroup_mutex;
672#endif 701#endif
673 702
674/** 703/**
675 * task_subsys_state_check - obtain css for (task, subsys) w/ extra access conds 704 * task_css_check - obtain css for (task, subsys) w/ extra access conds
676 * @task: the target task 705 * @task: the target task
677 * @subsys_id: the target subsystem ID 706 * @subsys_id: the target subsystem ID
678 * @__c: extra condition expression to be passed to rcu_dereference_check() 707 * @__c: extra condition expression to be passed to rcu_dereference_check()
@@ -680,7 +709,7 @@ extern struct mutex cgroup_mutex;
680 * Return the cgroup_subsys_state for the (@task, @subsys_id) pair. The 709 * Return the cgroup_subsys_state for the (@task, @subsys_id) pair. The
681 * synchronization rules are the same as task_css_set_check(). 710 * synchronization rules are the same as task_css_set_check().
682 */ 711 */
683#define task_subsys_state_check(task, subsys_id, __c) \ 712#define task_css_check(task, subsys_id, __c) \
684 task_css_set_check((task), (__c))->subsys[(subsys_id)] 713 task_css_set_check((task), (__c))->subsys[(subsys_id)]
685 714
686/** 715/**
@@ -695,87 +724,92 @@ static inline struct css_set *task_css_set(struct task_struct *task)
695} 724}
696 725
697/** 726/**
698 * task_subsys_state - obtain css for (task, subsys) 727 * task_css - obtain css for (task, subsys)
699 * @task: the target task 728 * @task: the target task
700 * @subsys_id: the target subsystem ID 729 * @subsys_id: the target subsystem ID
701 * 730 *
702 * See task_subsys_state_check(). 731 * See task_css_check().
703 */ 732 */
704static inline struct cgroup_subsys_state * 733static inline struct cgroup_subsys_state *task_css(struct task_struct *task,
705task_subsys_state(struct task_struct *task, int subsys_id) 734 int subsys_id)
706{ 735{
707 return task_subsys_state_check(task, subsys_id, false); 736 return task_css_check(task, subsys_id, false);
708} 737}
709 738
710static inline struct cgroup* task_cgroup(struct task_struct *task, 739static inline struct cgroup *task_cgroup(struct task_struct *task,
711 int subsys_id) 740 int subsys_id)
712{ 741{
713 return task_subsys_state(task, subsys_id)->cgroup; 742 return task_css(task, subsys_id)->cgroup;
714} 743}
715 744
716struct cgroup *cgroup_next_sibling(struct cgroup *pos); 745struct cgroup_subsys_state *css_next_child(struct cgroup_subsys_state *pos,
746 struct cgroup_subsys_state *parent);
747
748struct cgroup_subsys_state *css_from_id(int id, struct cgroup_subsys *ss);
717 749
718/** 750/**
719 * cgroup_for_each_child - iterate through children of a cgroup 751 * css_for_each_child - iterate through children of a css
720 * @pos: the cgroup * to use as the loop cursor 752 * @pos: the css * to use as the loop cursor
721 * @cgrp: cgroup whose children to walk 753 * @parent: css whose children to walk
722 * 754 *
723 * Walk @cgrp's children. Must be called under rcu_read_lock(). A child 755 * Walk @parent's children. Must be called under rcu_read_lock(). A child
724 * cgroup which hasn't finished ->css_online() or already has finished 756 * css which hasn't finished ->css_online() or already has finished
725 * ->css_offline() may show up during traversal and it's each subsystem's 757 * ->css_offline() may show up during traversal and it's each subsystem's
726 * responsibility to verify that each @pos is alive. 758 * responsibility to verify that each @pos is alive.
727 * 759 *
728 * If a subsystem synchronizes against the parent in its ->css_online() and 760 * If a subsystem synchronizes against the parent in its ->css_online() and
729 * before starting iterating, a cgroup which finished ->css_online() is 761 * before starting iterating, a css which finished ->css_online() is
730 * guaranteed to be visible in the future iterations. 762 * guaranteed to be visible in the future iterations.
731 * 763 *
732 * It is allowed to temporarily drop RCU read lock during iteration. The 764 * It is allowed to temporarily drop RCU read lock during iteration. The
733 * caller is responsible for ensuring that @pos remains accessible until 765 * caller is responsible for ensuring that @pos remains accessible until
734 * the start of the next iteration by, for example, bumping the css refcnt. 766 * the start of the next iteration by, for example, bumping the css refcnt.
735 */ 767 */
736#define cgroup_for_each_child(pos, cgrp) \ 768#define css_for_each_child(pos, parent) \
737 for ((pos) = list_first_or_null_rcu(&(cgrp)->children, \ 769 for ((pos) = css_next_child(NULL, (parent)); (pos); \
738 struct cgroup, sibling); \ 770 (pos) = css_next_child((pos), (parent)))
739 (pos); (pos) = cgroup_next_sibling((pos))) 771
772struct cgroup_subsys_state *
773css_next_descendant_pre(struct cgroup_subsys_state *pos,
774 struct cgroup_subsys_state *css);
740 775
741struct cgroup *cgroup_next_descendant_pre(struct cgroup *pos, 776struct cgroup_subsys_state *
742 struct cgroup *cgroup); 777css_rightmost_descendant(struct cgroup_subsys_state *pos);
743struct cgroup *cgroup_rightmost_descendant(struct cgroup *pos);
744 778
745/** 779/**
746 * cgroup_for_each_descendant_pre - pre-order walk of a cgroup's descendants 780 * css_for_each_descendant_pre - pre-order walk of a css's descendants
747 * @pos: the cgroup * to use as the loop cursor 781 * @pos: the css * to use as the loop cursor
748 * @cgroup: cgroup whose descendants to walk 782 * @root: css whose descendants to walk
749 * 783 *
750 * Walk @cgroup's descendants. Must be called under rcu_read_lock(). A 784 * Walk @root's descendants. @root is included in the iteration and the
751 * descendant cgroup which hasn't finished ->css_online() or already has 785 * first node to be visited. Must be called under rcu_read_lock(). A
786 * descendant css which hasn't finished ->css_online() or already has
752 * finished ->css_offline() may show up during traversal and it's each 787 * finished ->css_offline() may show up during traversal and it's each
753 * subsystem's responsibility to verify that each @pos is alive. 788 * subsystem's responsibility to verify that each @pos is alive.
754 * 789 *
755 * If a subsystem synchronizes against the parent in its ->css_online() and 790 * If a subsystem synchronizes against the parent in its ->css_online() and
756 * before starting iterating, and synchronizes against @pos on each 791 * before starting iterating, and synchronizes against @pos on each
757 * iteration, any descendant cgroup which finished ->css_online() is 792 * iteration, any descendant css which finished ->css_online() is
758 * guaranteed to be visible in the future iterations. 793 * guaranteed to be visible in the future iterations.
759 * 794 *
760 * In other words, the following guarantees that a descendant can't escape 795 * In other words, the following guarantees that a descendant can't escape
761 * state updates of its ancestors. 796 * state updates of its ancestors.
762 * 797 *
763 * my_online(@cgrp) 798 * my_online(@css)
764 * { 799 * {
765 * Lock @cgrp->parent and @cgrp; 800 * Lock @css's parent and @css;
766 * Inherit state from @cgrp->parent; 801 * Inherit state from the parent;
767 * Unlock both. 802 * Unlock both.
768 * } 803 * }
769 * 804 *
770 * my_update_state(@cgrp) 805 * my_update_state(@css)
771 * { 806 * {
772 * Lock @cgrp; 807 * css_for_each_descendant_pre(@pos, @css) {
773 * Update @cgrp's state;
774 * Unlock @cgrp;
775 *
776 * cgroup_for_each_descendant_pre(@pos, @cgrp) {
777 * Lock @pos; 808 * Lock @pos;
778 * Verify @pos is alive and inherit state from @pos->parent; 809 * if (@pos == @css)
810 * Update @css's state;
811 * else
812 * Verify @pos is alive and inherit state from its parent;
779 * Unlock @pos; 813 * Unlock @pos;
780 * } 814 * }
781 * } 815 * }
@@ -786,8 +820,7 @@ struct cgroup *cgroup_rightmost_descendant(struct cgroup *pos);
786 * visible by walking order and, as long as inheriting operations to the 820 * visible by walking order and, as long as inheriting operations to the
787 * same @pos are atomic to each other, multiple updates racing each other 821 * same @pos are atomic to each other, multiple updates racing each other
788 * still result in the correct state. It's guaranateed that at least one 822 * still result in the correct state. It's guaranateed that at least one
789 * inheritance happens for any cgroup after the latest update to its 823 * inheritance happens for any css after the latest update to its parent.
790 * parent.
791 * 824 *
792 * If checking parent's state requires locking the parent, each inheriting 825 * If checking parent's state requires locking the parent, each inheriting
793 * iteration should lock and unlock both @pos->parent and @pos. 826 * iteration should lock and unlock both @pos->parent and @pos.
@@ -800,52 +833,45 @@ struct cgroup *cgroup_rightmost_descendant(struct cgroup *pos);
800 * caller is responsible for ensuring that @pos remains accessible until 833 * caller is responsible for ensuring that @pos remains accessible until
801 * the start of the next iteration by, for example, bumping the css refcnt. 834 * the start of the next iteration by, for example, bumping the css refcnt.
802 */ 835 */
803#define cgroup_for_each_descendant_pre(pos, cgroup) \ 836#define css_for_each_descendant_pre(pos, css) \
804 for (pos = cgroup_next_descendant_pre(NULL, (cgroup)); (pos); \ 837 for ((pos) = css_next_descendant_pre(NULL, (css)); (pos); \
805 pos = cgroup_next_descendant_pre((pos), (cgroup))) 838 (pos) = css_next_descendant_pre((pos), (css)))
806 839
807struct cgroup *cgroup_next_descendant_post(struct cgroup *pos, 840struct cgroup_subsys_state *
808 struct cgroup *cgroup); 841css_next_descendant_post(struct cgroup_subsys_state *pos,
842 struct cgroup_subsys_state *css);
809 843
810/** 844/**
811 * cgroup_for_each_descendant_post - post-order walk of a cgroup's descendants 845 * css_for_each_descendant_post - post-order walk of a css's descendants
812 * @pos: the cgroup * to use as the loop cursor 846 * @pos: the css * to use as the loop cursor
813 * @cgroup: cgroup whose descendants to walk 847 * @css: css whose descendants to walk
814 * 848 *
815 * Similar to cgroup_for_each_descendant_pre() but performs post-order 849 * Similar to css_for_each_descendant_pre() but performs post-order
816 * traversal instead. Note that the walk visibility guarantee described in 850 * traversal instead. @root is included in the iteration and the last
817 * pre-order walk doesn't apply the same to post-order walks. 851 * node to be visited. Note that the walk visibility guarantee described
852 * in pre-order walk doesn't apply the same to post-order walks.
818 */ 853 */
819#define cgroup_for_each_descendant_post(pos, cgroup) \ 854#define css_for_each_descendant_post(pos, css) \
820 for (pos = cgroup_next_descendant_post(NULL, (cgroup)); (pos); \ 855 for ((pos) = css_next_descendant_post(NULL, (css)); (pos); \
821 pos = cgroup_next_descendant_post((pos), (cgroup))) 856 (pos) = css_next_descendant_post((pos), (css)))
822 857
823/* A cgroup_iter should be treated as an opaque object */ 858/* A css_task_iter should be treated as an opaque object */
824struct cgroup_iter { 859struct css_task_iter {
825 struct list_head *cset_link; 860 struct cgroup_subsys_state *origin_css;
826 struct list_head *task; 861 struct list_head *cset_link;
862 struct list_head *task;
827}; 863};
828 864
829/* 865void css_task_iter_start(struct cgroup_subsys_state *css,
830 * To iterate across the tasks in a cgroup: 866 struct css_task_iter *it);
831 * 867struct task_struct *css_task_iter_next(struct css_task_iter *it);
832 * 1) call cgroup_iter_start to initialize an iterator 868void css_task_iter_end(struct css_task_iter *it);
833 * 869
834 * 2) call cgroup_iter_next() to retrieve member tasks until it 870int css_scan_tasks(struct cgroup_subsys_state *css,
835 * returns NULL or until you want to end the iteration 871 bool (*test)(struct task_struct *, void *),
836 * 872 void (*process)(struct task_struct *, void *),
837 * 3) call cgroup_iter_end() to destroy the iterator. 873 void *data, struct ptr_heap *heap);
838 * 874
839 * Or, call cgroup_scan_tasks() to iterate through every task in a
840 * cgroup - cgroup_scan_tasks() holds the css_set_lock when calling
841 * the test_task() callback, but not while calling the process_task()
842 * callback.
843 */
844void cgroup_iter_start(struct cgroup *cgrp, struct cgroup_iter *it);
845struct task_struct *cgroup_iter_next(struct cgroup *cgrp,
846 struct cgroup_iter *it);
847void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it);
848int cgroup_scan_tasks(struct cgroup_scanner *scan);
849int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); 875int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
850int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from); 876int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
851 877
@@ -878,7 +904,8 @@ bool css_is_ancestor(struct cgroup_subsys_state *cg,
878 904
879/* Get id and depth of css */ 905/* Get id and depth of css */
880unsigned short css_id(struct cgroup_subsys_state *css); 906unsigned short css_id(struct cgroup_subsys_state *css);
881struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id); 907struct cgroup_subsys_state *css_from_dir(struct dentry *dentry,
908 struct cgroup_subsys *ss);
882 909
883#else /* !CONFIG_CGROUPS */ 910#else /* !CONFIG_CGROUPS */
884 911
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index fc09d7b0dacf..158158704c30 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -2,100 +2,110 @@
2#define _LINUX_CONTEXT_TRACKING_H 2#define _LINUX_CONTEXT_TRACKING_H
3 3
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/percpu.h>
6#include <linux/vtime.h> 5#include <linux/vtime.h>
6#include <linux/context_tracking_state.h>
7#include <asm/ptrace.h> 7#include <asm/ptrace.h>
8 8
9struct context_tracking {
10 /*
11 * When active is false, probes are unset in order
12 * to minimize overhead: TIF flags are cleared
13 * and calls to user_enter/exit are ignored. This
14 * may be further optimized using static keys.
15 */
16 bool active;
17 enum ctx_state {
18 IN_KERNEL = 0,
19 IN_USER,
20 } state;
21};
22
23static inline void __guest_enter(void)
24{
25 /*
26 * This is running in ioctl context so we can avoid
27 * the call to vtime_account() with its unnecessary idle check.
28 */
29 vtime_account_system(current);
30 current->flags |= PF_VCPU;
31}
32
33static inline void __guest_exit(void)
34{
35 /*
36 * This is running in ioctl context so we can avoid
37 * the call to vtime_account() with its unnecessary idle check.
38 */
39 vtime_account_system(current);
40 current->flags &= ~PF_VCPU;
41}
42 9
43#ifdef CONFIG_CONTEXT_TRACKING 10#ifdef CONFIG_CONTEXT_TRACKING
44DECLARE_PER_CPU(struct context_tracking, context_tracking); 11extern void context_tracking_cpu_set(int cpu);
45 12
46static inline bool context_tracking_in_user(void) 13extern void context_tracking_user_enter(void);
14extern void context_tracking_user_exit(void);
15extern void __context_tracking_task_switch(struct task_struct *prev,
16 struct task_struct *next);
17
18static inline void user_enter(void)
47{ 19{
48 return __this_cpu_read(context_tracking.state) == IN_USER; 20 if (static_key_false(&context_tracking_enabled))
49} 21 context_tracking_user_enter();
50 22
51static inline bool context_tracking_active(void) 23}
24static inline void user_exit(void)
52{ 25{
53 return __this_cpu_read(context_tracking.active); 26 if (static_key_false(&context_tracking_enabled))
27 context_tracking_user_exit();
54} 28}
55 29
56extern void user_enter(void);
57extern void user_exit(void);
58
59extern void guest_enter(void);
60extern void guest_exit(void);
61
62static inline enum ctx_state exception_enter(void) 30static inline enum ctx_state exception_enter(void)
63{ 31{
64 enum ctx_state prev_ctx; 32 enum ctx_state prev_ctx;
65 33
34 if (!static_key_false(&context_tracking_enabled))
35 return 0;
36
66 prev_ctx = this_cpu_read(context_tracking.state); 37 prev_ctx = this_cpu_read(context_tracking.state);
67 user_exit(); 38 context_tracking_user_exit();
68 39
69 return prev_ctx; 40 return prev_ctx;
70} 41}
71 42
72static inline void exception_exit(enum ctx_state prev_ctx) 43static inline void exception_exit(enum ctx_state prev_ctx)
73{ 44{
74 if (prev_ctx == IN_USER) 45 if (static_key_false(&context_tracking_enabled)) {
75 user_enter(); 46 if (prev_ctx == IN_USER)
47 context_tracking_user_enter();
48 }
76} 49}
77 50
78extern void context_tracking_task_switch(struct task_struct *prev, 51static inline void context_tracking_task_switch(struct task_struct *prev,
79 struct task_struct *next); 52 struct task_struct *next)
53{
54 if (static_key_false(&context_tracking_enabled))
55 __context_tracking_task_switch(prev, next);
56}
80#else 57#else
81static inline bool context_tracking_in_user(void) { return false; }
82static inline void user_enter(void) { } 58static inline void user_enter(void) { }
83static inline void user_exit(void) { } 59static inline void user_exit(void) { }
60static inline enum ctx_state exception_enter(void) { return 0; }
61static inline void exception_exit(enum ctx_state prev_ctx) { }
62static inline void context_tracking_task_switch(struct task_struct *prev,
63 struct task_struct *next) { }
64#endif /* !CONFIG_CONTEXT_TRACKING */
65
66
67#ifdef CONFIG_CONTEXT_TRACKING_FORCE
68extern void context_tracking_init(void);
69#else
70static inline void context_tracking_init(void) { }
71#endif /* CONFIG_CONTEXT_TRACKING_FORCE */
72
84 73
74#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
85static inline void guest_enter(void) 75static inline void guest_enter(void)
86{ 76{
87 __guest_enter(); 77 if (vtime_accounting_enabled())
78 vtime_guest_enter(current);
79 else
80 current->flags |= PF_VCPU;
88} 81}
89 82
90static inline void guest_exit(void) 83static inline void guest_exit(void)
91{ 84{
92 __guest_exit(); 85 if (vtime_accounting_enabled())
86 vtime_guest_exit(current);
87 else
88 current->flags &= ~PF_VCPU;
93} 89}
94 90
95static inline enum ctx_state exception_enter(void) { return 0; } 91#else
96static inline void exception_exit(enum ctx_state prev_ctx) { } 92static inline void guest_enter(void)
97static inline void context_tracking_task_switch(struct task_struct *prev, 93{
98 struct task_struct *next) { } 94 /*
99#endif /* !CONFIG_CONTEXT_TRACKING */ 95 * This is running in ioctl context so its safe
96 * to assume that it's the stime pending cputime
97 * to flush.
98 */
99 vtime_account_system(current);
100 current->flags |= PF_VCPU;
101}
102
103static inline void guest_exit(void)
104{
105 /* Flush the guest cputime we spent on the guest */
106 vtime_account_system(current);
107 current->flags &= ~PF_VCPU;
108}
109#endif /* CONFIG_VIRT_CPU_ACCOUNTING_GEN */
100 110
101#endif 111#endif
diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h
new file mode 100644
index 000000000000..0f1979d0674f
--- /dev/null
+++ b/include/linux/context_tracking_state.h
@@ -0,0 +1,39 @@
1#ifndef _LINUX_CONTEXT_TRACKING_STATE_H
2#define _LINUX_CONTEXT_TRACKING_STATE_H
3
4#include <linux/percpu.h>
5#include <linux/static_key.h>
6
7struct context_tracking {
8 /*
9 * When active is false, probes are unset in order
10 * to minimize overhead: TIF flags are cleared
11 * and calls to user_enter/exit are ignored. This
12 * may be further optimized using static keys.
13 */
14 bool active;
15 enum ctx_state {
16 IN_KERNEL = 0,
17 IN_USER,
18 } state;
19};
20
21#ifdef CONFIG_CONTEXT_TRACKING
22extern struct static_key context_tracking_enabled;
23DECLARE_PER_CPU(struct context_tracking, context_tracking);
24
25static inline bool context_tracking_in_user(void)
26{
27 return __this_cpu_read(context_tracking.state) == IN_USER;
28}
29
30static inline bool context_tracking_active(void)
31{
32 return __this_cpu_read(context_tracking.active);
33}
34#else
35static inline bool context_tracking_in_user(void) { return false; }
36static inline bool context_tracking_active(void) { return false; }
37#endif /* CONFIG_CONTEXT_TRACKING */
38
39#endif
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index ab0eade73039..801ff9e73679 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -28,6 +28,7 @@ struct cpu {
28extern int register_cpu(struct cpu *cpu, int num); 28extern int register_cpu(struct cpu *cpu, int num);
29extern struct device *get_cpu_device(unsigned cpu); 29extern struct device *get_cpu_device(unsigned cpu);
30extern bool cpu_is_hotpluggable(unsigned cpu); 30extern bool cpu_is_hotpluggable(unsigned cpu);
31extern bool arch_match_cpu_phys_id(int cpu, u64 phys_id);
31 32
32extern int cpu_add_dev_attr(struct device_attribute *attr); 33extern int cpu_add_dev_attr(struct device_attribute *attr);
33extern void cpu_remove_dev_attr(struct device_attribute *attr); 34extern void cpu_remove_dev_attr(struct device_attribute *attr);
@@ -172,6 +173,8 @@ extern struct bus_type cpu_subsys;
172#ifdef CONFIG_HOTPLUG_CPU 173#ifdef CONFIG_HOTPLUG_CPU
173/* Stop CPUs going up and down. */ 174/* Stop CPUs going up and down. */
174 175
176extern void cpu_hotplug_begin(void);
177extern void cpu_hotplug_done(void);
175extern void get_online_cpus(void); 178extern void get_online_cpus(void);
176extern void put_online_cpus(void); 179extern void put_online_cpus(void);
177extern void cpu_hotplug_disable(void); 180extern void cpu_hotplug_disable(void);
@@ -197,6 +200,8 @@ static inline void cpu_hotplug_driver_unlock(void)
197 200
198#else /* CONFIG_HOTPLUG_CPU */ 201#else /* CONFIG_HOTPLUG_CPU */
199 202
203static inline void cpu_hotplug_begin(void) {}
204static inline void cpu_hotplug_done(void) {}
200#define get_online_cpus() do { } while (0) 205#define get_online_cpus() do { } while (0)
201#define put_online_cpus() do { } while (0) 206#define put_online_cpus() do { } while (0)
202#define cpu_hotplug_disable() do { } while (0) 207#define cpu_hotplug_disable() do { } while (0)
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 90d5a15120d5..d568f3975eeb 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -11,71 +11,36 @@
11#ifndef _LINUX_CPUFREQ_H 11#ifndef _LINUX_CPUFREQ_H
12#define _LINUX_CPUFREQ_H 12#define _LINUX_CPUFREQ_H
13 13
14#include <asm/cputime.h> 14#include <linux/cpumask.h>
15#include <linux/mutex.h> 15#include <linux/completion.h>
16#include <linux/notifier.h>
17#include <linux/threads.h>
18#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/notifier.h>
19#include <linux/sysfs.h> 18#include <linux/sysfs.h>
20#include <linux/completion.h>
21#include <linux/workqueue.h>
22#include <linux/cpumask.h>
23#include <asm/div64.h>
24
25#define CPUFREQ_NAME_LEN 16
26/* Print length for names. Extra 1 space for accomodating '\n' in prints */
27#define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1)
28 19
29/********************************************************************* 20/*********************************************************************
30 * CPUFREQ NOTIFIER INTERFACE * 21 * CPUFREQ INTERFACE *
31 *********************************************************************/ 22 *********************************************************************/
32 23/*
33#define CPUFREQ_TRANSITION_NOTIFIER (0) 24 * Frequency values here are CPU kHz
34#define CPUFREQ_POLICY_NOTIFIER (1) 25 *
35
36#ifdef CONFIG_CPU_FREQ
37int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
38int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
39extern void disable_cpufreq(void);
40#else /* CONFIG_CPU_FREQ */
41static inline int cpufreq_register_notifier(struct notifier_block *nb,
42 unsigned int list)
43{
44 return 0;
45}
46static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
47 unsigned int list)
48{
49 return 0;
50}
51static inline void disable_cpufreq(void) { }
52#endif /* CONFIG_CPU_FREQ */
53
54/* if (cpufreq_driver->target) exists, the ->governor decides what frequency
55 * within the limits is used. If (cpufreq_driver->setpolicy> exists, these
56 * two generic policies are available:
57 */
58
59#define CPUFREQ_POLICY_POWERSAVE (1)
60#define CPUFREQ_POLICY_PERFORMANCE (2)
61
62/* Frequency values here are CPU kHz so that hardware which doesn't run
63 * with some frequencies can complain without having to guess what per
64 * cent / per mille means.
65 * Maximum transition latency is in nanoseconds - if it's unknown, 26 * Maximum transition latency is in nanoseconds - if it's unknown,
66 * CPUFREQ_ETERNAL shall be used. 27 * CPUFREQ_ETERNAL shall be used.
67 */ 28 */
68 29
30#define CPUFREQ_ETERNAL (-1)
31#define CPUFREQ_NAME_LEN 16
32/* Print length for names. Extra 1 space for accomodating '\n' in prints */
33#define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1)
34
69struct cpufreq_governor; 35struct cpufreq_governor;
70 36
71/* /sys/devices/system/cpu/cpufreq: entry point for global variables */ 37struct cpufreq_freqs {
72extern struct kobject *cpufreq_global_kobject; 38 unsigned int cpu; /* cpu nr */
73int cpufreq_get_global_kobject(void); 39 unsigned int old;
74void cpufreq_put_global_kobject(void); 40 unsigned int new;
75int cpufreq_sysfs_create_file(const struct attribute *attr); 41 u8 flags; /* flags of cpufreq_driver, see below. */
76void cpufreq_sysfs_remove_file(const struct attribute *attr); 42};
77 43
78#define CPUFREQ_ETERNAL (-1)
79struct cpufreq_cpuinfo { 44struct cpufreq_cpuinfo {
80 unsigned int max_freq; 45 unsigned int max_freq;
81 unsigned int min_freq; 46 unsigned int min_freq;
@@ -117,123 +82,103 @@ struct cpufreq_policy {
117 82
118 struct cpufreq_real_policy user_policy; 83 struct cpufreq_real_policy user_policy;
119 84
85 struct list_head policy_list;
120 struct kobject kobj; 86 struct kobject kobj;
121 struct completion kobj_unregister; 87 struct completion kobj_unregister;
122 int transition_ongoing; /* Tracks transition status */ 88 int transition_ongoing; /* Tracks transition status */
123}; 89};
124 90
125#define CPUFREQ_ADJUST (0)
126#define CPUFREQ_INCOMPATIBLE (1)
127#define CPUFREQ_NOTIFY (2)
128#define CPUFREQ_START (3)
129#define CPUFREQ_UPDATE_POLICY_CPU (4)
130
131/* Only for ACPI */ 91/* Only for ACPI */
132#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */ 92#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */
133#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */ 93#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */
134#define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */ 94#define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */
135#define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/ 95#define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/
136 96
97struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
98void cpufreq_cpu_put(struct cpufreq_policy *policy);
99
137static inline bool policy_is_shared(struct cpufreq_policy *policy) 100static inline bool policy_is_shared(struct cpufreq_policy *policy)
138{ 101{
139 return cpumask_weight(policy->cpus) > 1; 102 return cpumask_weight(policy->cpus) > 1;
140} 103}
141 104
142/******************** cpufreq transition notifiers *******************/ 105/* /sys/devices/system/cpu/cpufreq: entry point for global variables */
143 106extern struct kobject *cpufreq_global_kobject;
144#define CPUFREQ_PRECHANGE (0) 107int cpufreq_get_global_kobject(void);
145#define CPUFREQ_POSTCHANGE (1) 108void cpufreq_put_global_kobject(void);
146#define CPUFREQ_RESUMECHANGE (8) 109int cpufreq_sysfs_create_file(const struct attribute *attr);
147#define CPUFREQ_SUSPENDCHANGE (9) 110void cpufreq_sysfs_remove_file(const struct attribute *attr);
148 111
149struct cpufreq_freqs { 112#ifdef CONFIG_CPU_FREQ
150 unsigned int cpu; /* cpu nr */ 113unsigned int cpufreq_get(unsigned int cpu);
151 unsigned int old; 114unsigned int cpufreq_quick_get(unsigned int cpu);
152 unsigned int new; 115unsigned int cpufreq_quick_get_max(unsigned int cpu);
153 u8 flags; /* flags of cpufreq_driver, see below. */ 116void disable_cpufreq(void);
154};
155 117
156/** 118u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy);
157 * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch 119int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
158 * safe) 120int cpufreq_update_policy(unsigned int cpu);
159 * @old: old value 121bool have_governor_per_policy(void);
160 * @div: divisor 122struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);
161 * @mult: multiplier 123#else
162 * 124static inline unsigned int cpufreq_get(unsigned int cpu)
163 *
164 * new = old * mult / div
165 */
166static inline unsigned long cpufreq_scale(unsigned long old, u_int div,
167 u_int mult)
168{ 125{
169#if BITS_PER_LONG == 32 126 return 0;
170 127}
171 u64 result = ((u64) old) * ((u64) mult); 128static inline unsigned int cpufreq_quick_get(unsigned int cpu)
172 do_div(result, div); 129{
173 return (unsigned long) result; 130 return 0;
174 131}
175#elif BITS_PER_LONG == 64 132static inline unsigned int cpufreq_quick_get_max(unsigned int cpu)
176 133{
177 unsigned long result = old * ((u64) mult); 134 return 0;
178 result /= div; 135}
179 return result; 136static inline void disable_cpufreq(void) { }
180
181#endif 137#endif
182};
183 138
184/********************************************************************* 139/*********************************************************************
185 * CPUFREQ GOVERNORS * 140 * CPUFREQ DRIVER INTERFACE *
186 *********************************************************************/ 141 *********************************************************************/
187 142
188#define CPUFREQ_GOV_START 1 143#define CPUFREQ_RELATION_L 0 /* lowest frequency at or above target */
189#define CPUFREQ_GOV_STOP 2 144#define CPUFREQ_RELATION_H 1 /* highest frequency below or at target */
190#define CPUFREQ_GOV_LIMITS 3
191#define CPUFREQ_GOV_POLICY_INIT 4
192#define CPUFREQ_GOV_POLICY_EXIT 5
193 145
194struct cpufreq_governor { 146struct freq_attr {
195 char name[CPUFREQ_NAME_LEN]; 147 struct attribute attr;
196 int initialized; 148 ssize_t (*show)(struct cpufreq_policy *, char *);
197 int (*governor) (struct cpufreq_policy *policy, 149 ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count);
198 unsigned int event);
199 ssize_t (*show_setspeed) (struct cpufreq_policy *policy,
200 char *buf);
201 int (*store_setspeed) (struct cpufreq_policy *policy,
202 unsigned int freq);
203 unsigned int max_transition_latency; /* HW must be able to switch to
204 next freq faster than this value in nano secs or we
205 will fallback to performance governor */
206 struct list_head governor_list;
207 struct module *owner;
208}; 150};
209 151
210/* 152#define cpufreq_freq_attr_ro(_name) \
211 * Pass a target to the cpufreq driver. 153static struct freq_attr _name = \
212 */ 154__ATTR(_name, 0444, show_##_name, NULL)
213extern int cpufreq_driver_target(struct cpufreq_policy *policy,
214 unsigned int target_freq,
215 unsigned int relation);
216extern int __cpufreq_driver_target(struct cpufreq_policy *policy,
217 unsigned int target_freq,
218 unsigned int relation);
219 155
220extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy, 156#define cpufreq_freq_attr_ro_perm(_name, _perm) \
221 unsigned int cpu); 157static struct freq_attr _name = \
158__ATTR(_name, _perm, show_##_name, NULL)
222 159
223int cpufreq_register_governor(struct cpufreq_governor *governor); 160#define cpufreq_freq_attr_rw(_name) \
224void cpufreq_unregister_governor(struct cpufreq_governor *governor); 161static struct freq_attr _name = \
162__ATTR(_name, 0644, show_##_name, store_##_name)
225 163
226/********************************************************************* 164struct global_attr {
227 * CPUFREQ DRIVER INTERFACE * 165 struct attribute attr;
228 *********************************************************************/ 166 ssize_t (*show)(struct kobject *kobj,
167 struct attribute *attr, char *buf);
168 ssize_t (*store)(struct kobject *a, struct attribute *b,
169 const char *c, size_t count);
170};
229 171
230#define CPUFREQ_RELATION_L 0 /* lowest frequency at or above target */ 172#define define_one_global_ro(_name) \
231#define CPUFREQ_RELATION_H 1 /* highest frequency below or at target */ 173static struct global_attr _name = \
174__ATTR(_name, 0444, show_##_name, NULL)
175
176#define define_one_global_rw(_name) \
177static struct global_attr _name = \
178__ATTR(_name, 0644, show_##_name, store_##_name)
232 179
233struct freq_attr;
234 180
235struct cpufreq_driver { 181struct cpufreq_driver {
236 struct module *owner;
237 char name[CPUFREQ_NAME_LEN]; 182 char name[CPUFREQ_NAME_LEN];
238 u8 flags; 183 u8 flags;
239 /* 184 /*
@@ -258,8 +203,6 @@ struct cpufreq_driver {
258 unsigned int (*get) (unsigned int cpu); 203 unsigned int (*get) (unsigned int cpu);
259 204
260 /* optional */ 205 /* optional */
261 unsigned int (*getavg) (struct cpufreq_policy *policy,
262 unsigned int cpu);
263 int (*bios_limit) (int cpu, unsigned int *limit); 206 int (*bios_limit) (int cpu, unsigned int *limit);
264 207
265 int (*exit) (struct cpufreq_policy *policy); 208 int (*exit) (struct cpufreq_policy *policy);
@@ -269,7 +212,6 @@ struct cpufreq_driver {
269}; 212};
270 213
271/* flags */ 214/* flags */
272
273#define CPUFREQ_STICKY 0x01 /* the driver isn't removed even if 215#define CPUFREQ_STICKY 0x01 /* the driver isn't removed even if
274 * all ->init() calls failed */ 216 * all ->init() calls failed */
275#define CPUFREQ_CONST_LOOPS 0x02 /* loops_per_jiffy or other kernel 217#define CPUFREQ_CONST_LOOPS 0x02 /* loops_per_jiffy or other kernel
@@ -281,8 +223,7 @@ struct cpufreq_driver {
281int cpufreq_register_driver(struct cpufreq_driver *driver_data); 223int cpufreq_register_driver(struct cpufreq_driver *driver_data);
282int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); 224int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
283 225
284void cpufreq_notify_transition(struct cpufreq_policy *policy, 226const char *cpufreq_get_current_driver(void);
285 struct cpufreq_freqs *freqs, unsigned int state);
286 227
287static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, 228static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
288 unsigned int min, unsigned int max) 229 unsigned int min, unsigned int max)
@@ -300,87 +241,118 @@ static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
300 return; 241 return;
301} 242}
302 243
303struct freq_attr { 244/*********************************************************************
304 struct attribute attr; 245 * CPUFREQ NOTIFIER INTERFACE *
305 ssize_t (*show)(struct cpufreq_policy *, char *); 246 *********************************************************************/
306 ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count);
307};
308
309#define cpufreq_freq_attr_ro(_name) \
310static struct freq_attr _name = \
311__ATTR(_name, 0444, show_##_name, NULL)
312
313#define cpufreq_freq_attr_ro_perm(_name, _perm) \
314static struct freq_attr _name = \
315__ATTR(_name, _perm, show_##_name, NULL)
316
317#define cpufreq_freq_attr_rw(_name) \
318static struct freq_attr _name = \
319__ATTR(_name, 0644, show_##_name, store_##_name)
320 247
321struct global_attr { 248#define CPUFREQ_TRANSITION_NOTIFIER (0)
322 struct attribute attr; 249#define CPUFREQ_POLICY_NOTIFIER (1)
323 ssize_t (*show)(struct kobject *kobj,
324 struct attribute *attr, char *buf);
325 ssize_t (*store)(struct kobject *a, struct attribute *b,
326 const char *c, size_t count);
327};
328 250
329#define define_one_global_ro(_name) \ 251/* Transition notifiers */
330static struct global_attr _name = \ 252#define CPUFREQ_PRECHANGE (0)
331__ATTR(_name, 0444, show_##_name, NULL) 253#define CPUFREQ_POSTCHANGE (1)
254#define CPUFREQ_RESUMECHANGE (8)
255#define CPUFREQ_SUSPENDCHANGE (9)
332 256
333#define define_one_global_rw(_name) \ 257/* Policy Notifiers */
334static struct global_attr _name = \ 258#define CPUFREQ_ADJUST (0)
335__ATTR(_name, 0644, show_##_name, store_##_name) 259#define CPUFREQ_INCOMPATIBLE (1)
260#define CPUFREQ_NOTIFY (2)
261#define CPUFREQ_START (3)
262#define CPUFREQ_UPDATE_POLICY_CPU (4)
336 263
337struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu); 264#ifdef CONFIG_CPU_FREQ
338void cpufreq_cpu_put(struct cpufreq_policy *data); 265int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
339const char *cpufreq_get_current_driver(void); 266int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
340 267
341/********************************************************************* 268void cpufreq_notify_transition(struct cpufreq_policy *policy,
342 * CPUFREQ 2.6. INTERFACE * 269 struct cpufreq_freqs *freqs, unsigned int state);
343 *********************************************************************/
344u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy);
345int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
346int cpufreq_update_policy(unsigned int cpu);
347bool have_governor_per_policy(void);
348struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);
349 270
350#ifdef CONFIG_CPU_FREQ 271#else /* CONFIG_CPU_FREQ */
351/* 272static inline int cpufreq_register_notifier(struct notifier_block *nb,
352 * query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it 273 unsigned int list)
353 */
354unsigned int cpufreq_get(unsigned int cpu);
355#else
356static inline unsigned int cpufreq_get(unsigned int cpu)
357{ 274{
358 return 0; 275 return 0;
359} 276}
360#endif 277static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
361 278 unsigned int list)
362/*
363 * query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it
364 */
365#ifdef CONFIG_CPU_FREQ
366unsigned int cpufreq_quick_get(unsigned int cpu);
367unsigned int cpufreq_quick_get_max(unsigned int cpu);
368#else
369static inline unsigned int cpufreq_quick_get(unsigned int cpu)
370{ 279{
371 return 0; 280 return 0;
372} 281}
373static inline unsigned int cpufreq_quick_get_max(unsigned int cpu) 282#endif /* !CONFIG_CPU_FREQ */
283
284/**
285 * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch
286 * safe)
287 * @old: old value
288 * @div: divisor
289 * @mult: multiplier
290 *
291 *
292 * new = old * mult / div
293 */
294static inline unsigned long cpufreq_scale(unsigned long old, u_int div,
295 u_int mult)
374{ 296{
375 return 0; 297#if BITS_PER_LONG == 32
376} 298 u64 result = ((u64) old) * ((u64) mult);
299 do_div(result, div);
300 return (unsigned long) result;
301
302#elif BITS_PER_LONG == 64
303 unsigned long result = old * ((u64) mult);
304 result /= div;
305 return result;
377#endif 306#endif
307}
378 308
379/********************************************************************* 309/*********************************************************************
380 * CPUFREQ DEFAULT GOVERNOR * 310 * CPUFREQ GOVERNORS *
381 *********************************************************************/ 311 *********************************************************************/
382 312
383/* 313/*
314 * If (cpufreq_driver->target) exists, the ->governor decides what frequency
315 * within the limits is used. If (cpufreq_driver->setpolicy> exists, these
316 * two generic policies are available:
317 */
318#define CPUFREQ_POLICY_POWERSAVE (1)
319#define CPUFREQ_POLICY_PERFORMANCE (2)
320
321/* Governor Events */
322#define CPUFREQ_GOV_START 1
323#define CPUFREQ_GOV_STOP 2
324#define CPUFREQ_GOV_LIMITS 3
325#define CPUFREQ_GOV_POLICY_INIT 4
326#define CPUFREQ_GOV_POLICY_EXIT 5
327
328struct cpufreq_governor {
329 char name[CPUFREQ_NAME_LEN];
330 int initialized;
331 int (*governor) (struct cpufreq_policy *policy,
332 unsigned int event);
333 ssize_t (*show_setspeed) (struct cpufreq_policy *policy,
334 char *buf);
335 int (*store_setspeed) (struct cpufreq_policy *policy,
336 unsigned int freq);
337 unsigned int max_transition_latency; /* HW must be able to switch to
338 next freq faster than this value in nano secs or we
339 will fallback to performance governor */
340 struct list_head governor_list;
341 struct module *owner;
342};
343
344/* Pass a target to the cpufreq driver */
345int cpufreq_driver_target(struct cpufreq_policy *policy,
346 unsigned int target_freq,
347 unsigned int relation);
348int __cpufreq_driver_target(struct cpufreq_policy *policy,
349 unsigned int target_freq,
350 unsigned int relation);
351int cpufreq_register_governor(struct cpufreq_governor *governor);
352void cpufreq_unregister_governor(struct cpufreq_governor *governor);
353
354/* CPUFREQ DEFAULT GOVERNOR */
355/*
384 * Performance governor is fallback governor if any other gov failed to auto 356 * Performance governor is fallback governor if any other gov failed to auto
385 * load due latency restrictions 357 * load due latency restrictions
386 */ 358 */
@@ -428,18 +400,16 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
428 unsigned int relation, 400 unsigned int relation,
429 unsigned int *index); 401 unsigned int *index);
430 402
431/* the following 3 funtions are for cpufreq core use only */ 403void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy);
404ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf);
405
406/* the following funtion is for cpufreq core use only */
432struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu); 407struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu);
433 408
434/* the following are really really optional */ 409/* the following are really really optional */
435extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; 410extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;
436
437void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, 411void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
438 unsigned int cpu); 412 unsigned int cpu);
439void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy);
440
441void cpufreq_frequency_table_put_attr(unsigned int cpu); 413void cpufreq_frequency_table_put_attr(unsigned int cpu);
442 414
443ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf);
444
445#endif /* _LINUX_CPUFREQ_H */ 415#endif /* _LINUX_CPUFREQ_H */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 0bc4b74668e9..781addc66f03 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -13,8 +13,6 @@
13 13
14#include <linux/percpu.h> 14#include <linux/percpu.h>
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/kobject.h>
17#include <linux/completion.h>
18#include <linux/hrtimer.h> 16#include <linux/hrtimer.h>
19 17
20#define CPUIDLE_STATE_MAX 10 18#define CPUIDLE_STATE_MAX 10
@@ -61,6 +59,10 @@ struct cpuidle_state {
61 59
62#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) 60#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
63 61
62struct cpuidle_device_kobj;
63struct cpuidle_state_kobj;
64struct cpuidle_driver_kobj;
65
64struct cpuidle_device { 66struct cpuidle_device {
65 unsigned int registered:1; 67 unsigned int registered:1;
66 unsigned int enabled:1; 68 unsigned int enabled:1;
@@ -71,9 +73,8 @@ struct cpuidle_device {
71 struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX]; 73 struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX];
72 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; 74 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
73 struct cpuidle_driver_kobj *kobj_driver; 75 struct cpuidle_driver_kobj *kobj_driver;
76 struct cpuidle_device_kobj *kobj_dev;
74 struct list_head device_list; 77 struct list_head device_list;
75 struct kobject kobj;
76 struct completion kobj_unregister;
77 78
78#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED 79#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
79 int safe_state_index; 80 int safe_state_index;
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index b90337c9d468..9169b91ea2d2 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -9,6 +9,7 @@
9#include <linux/seqlock.h> 9#include <linux/seqlock.h>
10#include <linux/cache.h> 10#include <linux/cache.h>
11#include <linux/rcupdate.h> 11#include <linux/rcupdate.h>
12#include <linux/lockref.h>
12 13
13struct nameidata; 14struct nameidata;
14struct path; 15struct path;
@@ -100,6 +101,8 @@ extern unsigned int full_name_hash(const unsigned char *, unsigned int);
100# endif 101# endif
101#endif 102#endif
102 103
104#define d_lock d_lockref.lock
105
103struct dentry { 106struct dentry {
104 /* RCU lookup touched fields */ 107 /* RCU lookup touched fields */
105 unsigned int d_flags; /* protected by d_lock */ 108 unsigned int d_flags; /* protected by d_lock */
@@ -112,8 +115,7 @@ struct dentry {
112 unsigned char d_iname[DNAME_INLINE_LEN]; /* small names */ 115 unsigned char d_iname[DNAME_INLINE_LEN]; /* small names */
113 116
114 /* Ref lookup also touches following */ 117 /* Ref lookup also touches following */
115 unsigned int d_count; /* protected by d_lock */ 118 struct lockref d_lockref; /* per-dentry lock and refcount */
116 spinlock_t d_lock; /* per dentry lock */
117 const struct dentry_operations *d_op; 119 const struct dentry_operations *d_op;
118 struct super_block *d_sb; /* The root of the dentry tree */ 120 struct super_block *d_sb; /* The root of the dentry tree */
119 unsigned long d_time; /* used by d_revalidate */ 121 unsigned long d_time; /* used by d_revalidate */
@@ -302,31 +304,9 @@ extern struct dentry *__d_lookup(const struct dentry *, const struct qstr *);
302extern struct dentry *__d_lookup_rcu(const struct dentry *parent, 304extern struct dentry *__d_lookup_rcu(const struct dentry *parent,
303 const struct qstr *name, unsigned *seq); 305 const struct qstr *name, unsigned *seq);
304 306
305/**
306 * __d_rcu_to_refcount - take a refcount on dentry if sequence check is ok
307 * @dentry: dentry to take a ref on
308 * @seq: seqcount to verify against
309 * Returns: 0 on failure, else 1.
310 *
311 * __d_rcu_to_refcount operates on a dentry,seq pair that was returned
312 * by __d_lookup_rcu, to get a reference on an rcu-walk dentry.
313 */
314static inline int __d_rcu_to_refcount(struct dentry *dentry, unsigned seq)
315{
316 int ret = 0;
317
318 assert_spin_locked(&dentry->d_lock);
319 if (!read_seqcount_retry(&dentry->d_seq, seq)) {
320 ret = 1;
321 dentry->d_count++;
322 }
323
324 return ret;
325}
326
327static inline unsigned d_count(const struct dentry *dentry) 307static inline unsigned d_count(const struct dentry *dentry)
328{ 308{
329 return dentry->d_count; 309 return dentry->d_lockref.count;
330} 310}
331 311
332/* validate "insecure" dentry pointer */ 312/* validate "insecure" dentry pointer */
@@ -336,6 +316,7 @@ extern int d_validate(struct dentry *, struct dentry *);
336 * helper function for dentry_operations.d_dname() members 316 * helper function for dentry_operations.d_dname() members
337 */ 317 */
338extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); 318extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
319extern char *simple_dname(struct dentry *, char *, int);
339 320
340extern char *__d_path(const struct path *, const struct path *, char *, int); 321extern char *__d_path(const struct path *, const struct path *, char *, int);
341extern char *d_absolute_path(const struct path *, char *, int); 322extern char *d_absolute_path(const struct path *, char *, int);
@@ -356,17 +337,14 @@ extern char *dentry_path(struct dentry *, char *, int);
356static inline struct dentry *dget_dlock(struct dentry *dentry) 337static inline struct dentry *dget_dlock(struct dentry *dentry)
357{ 338{
358 if (dentry) 339 if (dentry)
359 dentry->d_count++; 340 dentry->d_lockref.count++;
360 return dentry; 341 return dentry;
361} 342}
362 343
363static inline struct dentry *dget(struct dentry *dentry) 344static inline struct dentry *dget(struct dentry *dentry)
364{ 345{
365 if (dentry) { 346 if (dentry)
366 spin_lock(&dentry->d_lock); 347 lockref_get(&dentry->d_lockref);
367 dget_dlock(dentry);
368 spin_unlock(&dentry->d_lock);
369 }
370 return dentry; 348 return dentry;
371} 349}
372 350
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index d68b4ea7343c..263489d0788d 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -192,6 +192,13 @@ static inline struct dentry *debugfs_create_x32(const char *name, umode_t mode,
192 return ERR_PTR(-ENODEV); 192 return ERR_PTR(-ENODEV);
193} 193}
194 194
195static inline struct dentry *debugfs_create_x64(const char *name, umode_t mode,
196 struct dentry *parent,
197 u64 *value)
198{
199 return ERR_PTR(-ENODEV);
200}
201
195static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mode, 202static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
196 struct dentry *parent, 203 struct dentry *parent,
197 size_t *value) 204 size_t *value)
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h
index 0e5f5785d9f2..98ffcbd4888e 100644
--- a/include/linux/debugobjects.h
+++ b/include/linux/debugobjects.h
@@ -63,7 +63,7 @@ struct debug_obj_descr {
63extern void debug_object_init (void *addr, struct debug_obj_descr *descr); 63extern void debug_object_init (void *addr, struct debug_obj_descr *descr);
64extern void 64extern void
65debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr); 65debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr);
66extern void debug_object_activate (void *addr, struct debug_obj_descr *descr); 66extern int debug_object_activate (void *addr, struct debug_obj_descr *descr);
67extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr); 67extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr);
68extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr); 68extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr);
69extern void debug_object_free (void *addr, struct debug_obj_descr *descr); 69extern void debug_object_free (void *addr, struct debug_obj_descr *descr);
@@ -85,8 +85,8 @@ static inline void
85debug_object_init (void *addr, struct debug_obj_descr *descr) { } 85debug_object_init (void *addr, struct debug_obj_descr *descr) { }
86static inline void 86static inline void
87debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr) { } 87debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr) { }
88static inline void 88static inline int
89debug_object_activate (void *addr, struct debug_obj_descr *descr) { } 89debug_object_activate (void *addr, struct debug_obj_descr *descr) { return 0; }
90static inline void 90static inline void
91debug_object_deactivate(void *addr, struct debug_obj_descr *descr) { } 91debug_object_deactivate(void *addr, struct debug_obj_descr *descr) { }
92static inline void 92static inline void
diff --git a/include/linux/device.h b/include/linux/device.h
index 22b546a58591..f46646e49235 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -66,6 +66,9 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
66 * @bus_attrs: Default attributes of the bus. 66 * @bus_attrs: Default attributes of the bus.
67 * @dev_attrs: Default attributes of the devices on the bus. 67 * @dev_attrs: Default attributes of the devices on the bus.
68 * @drv_attrs: Default attributes of the device drivers on the bus. 68 * @drv_attrs: Default attributes of the device drivers on the bus.
69 * @bus_groups: Default attributes of the bus.
70 * @dev_groups: Default attributes of the devices on the bus.
71 * @drv_groups: Default attributes of the device drivers on the bus.
69 * @match: Called, perhaps multiple times, whenever a new device or driver 72 * @match: Called, perhaps multiple times, whenever a new device or driver
70 * is added for this bus. It should return a nonzero value if the 73 * is added for this bus. It should return a nonzero value if the
71 * given device can be handled by the given driver. 74 * given device can be handled by the given driver.
@@ -103,9 +106,12 @@ struct bus_type {
103 const char *name; 106 const char *name;
104 const char *dev_name; 107 const char *dev_name;
105 struct device *dev_root; 108 struct device *dev_root;
106 struct bus_attribute *bus_attrs; 109 struct bus_attribute *bus_attrs; /* use bus_groups instead */
107 struct device_attribute *dev_attrs; 110 struct device_attribute *dev_attrs; /* use dev_groups instead */
108 struct driver_attribute *drv_attrs; 111 struct driver_attribute *drv_attrs; /* use drv_groups instead */
112 const struct attribute_group **bus_groups;
113 const struct attribute_group **dev_groups;
114 const struct attribute_group **drv_groups;
109 115
110 int (*match)(struct device *dev, struct device_driver *drv); 116 int (*match)(struct device *dev, struct device_driver *drv);
111 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 117 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
@@ -271,6 +277,8 @@ struct driver_attribute {
271 struct driver_attribute driver_attr_##_name = __ATTR_RW(_name) 277 struct driver_attribute driver_attr_##_name = __ATTR_RW(_name)
272#define DRIVER_ATTR_RO(_name) \ 278#define DRIVER_ATTR_RO(_name) \
273 struct driver_attribute driver_attr_##_name = __ATTR_RO(_name) 279 struct driver_attribute driver_attr_##_name = __ATTR_RO(_name)
280#define DRIVER_ATTR_WO(_name) \
281 struct driver_attribute driver_attr_##_name = __ATTR_WO(_name)
274 282
275extern int __must_check driver_create_file(struct device_driver *driver, 283extern int __must_check driver_create_file(struct device_driver *driver,
276 const struct driver_attribute *attr); 284 const struct driver_attribute *attr);
@@ -528,6 +536,8 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
528 struct device_attribute dev_attr_##_name = __ATTR_RW(_name) 536 struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
529#define DEVICE_ATTR_RO(_name) \ 537#define DEVICE_ATTR_RO(_name) \
530 struct device_attribute dev_attr_##_name = __ATTR_RO(_name) 538 struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
539#define DEVICE_ATTR_WO(_name) \
540 struct device_attribute dev_attr_##_name = __ATTR_WO(_name)
531#define DEVICE_ULONG_ATTR(_name, _mode, _var) \ 541#define DEVICE_ULONG_ATTR(_name, _mode, _var) \
532 struct dev_ext_attribute dev_attr_##_name = \ 542 struct dev_ext_attribute dev_attr_##_name = \
533 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } 543 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
@@ -895,6 +905,7 @@ static inline bool device_supports_offline(struct device *dev)
895 905
896extern void lock_device_hotplug(void); 906extern void lock_device_hotplug(void);
897extern void unlock_device_hotplug(void); 907extern void unlock_device_hotplug(void);
908extern int lock_device_hotplug_sysfs(void);
898extern int device_offline(struct device *dev); 909extern int device_offline(struct device *dev);
899extern int device_online(struct device *dev); 910extern int device_online(struct device *dev);
900/* 911/*
@@ -1099,7 +1110,8 @@ do { \
1099 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__) 1110 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)
1100#define dev_info_ratelimited(dev, fmt, ...) \ 1111#define dev_info_ratelimited(dev, fmt, ...) \
1101 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__) 1112 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__)
1102#if defined(CONFIG_DYNAMIC_DEBUG) || defined(DEBUG) 1113#if defined(CONFIG_DYNAMIC_DEBUG)
1114/* descriptor check is first to prevent flooding with "callbacks suppressed" */
1103#define dev_dbg_ratelimited(dev, fmt, ...) \ 1115#define dev_dbg_ratelimited(dev, fmt, ...) \
1104do { \ 1116do { \
1105 static DEFINE_RATELIMIT_STATE(_rs, \ 1117 static DEFINE_RATELIMIT_STATE(_rs, \
@@ -1108,8 +1120,17 @@ do { \
1108 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ 1120 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
1109 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \ 1121 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
1110 __ratelimit(&_rs)) \ 1122 __ratelimit(&_rs)) \
1111 __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ 1123 __dynamic_dev_dbg(&descriptor, dev, fmt, \
1112 ##__VA_ARGS__); \ 1124 ##__VA_ARGS__); \
1125} while (0)
1126#elif defined(DEBUG)
1127#define dev_dbg_ratelimited(dev, fmt, ...) \
1128do { \
1129 static DEFINE_RATELIMIT_STATE(_rs, \
1130 DEFAULT_RATELIMIT_INTERVAL, \
1131 DEFAULT_RATELIMIT_BURST); \
1132 if (__ratelimit(&_rs)) \
1133 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
1113} while (0) 1134} while (0)
1114#else 1135#else
1115#define dev_dbg_ratelimited(dev, fmt, ...) \ 1136#define dev_dbg_ratelimited(dev, fmt, ...) \
diff --git a/include/linux/extcon/of_extcon.h b/include/linux/extcon/of_extcon.h
new file mode 100644
index 000000000000..0ebfeff1b55d
--- /dev/null
+++ b/include/linux/extcon/of_extcon.h
@@ -0,0 +1,31 @@
1/*
2 * OF helpers for External connector (extcon) framework
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc.
5 * Kishon Vijay Abraham I <kishon@ti.com>
6 *
7 * Copyright (C) 2013 Samsung Electronics
8 * Chanwoo Choi <cw00.choi@samsung.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef __LINUX_OF_EXTCON_H
17#define __LINUX_OF_EXTCON_H
18
19#include <linux/err.h>
20
21#if IS_ENABLED(CONFIG_OF_EXTCON)
22extern struct extcon_dev
23 *of_extcon_get_extcon_dev(struct device *dev, int index);
24#else
25static inline struct extcon_dev
26 *of_extcon_get_extcon_dev(struct device *dev, int index)
27{
28 return ERR_PTR(-ENOSYS);
29}
30#endif /* CONFIG_OF_EXTCON */
31#endif /* __LINUX_OF_EXTCON_H */
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 4372658c73ae..5eaa746735ff 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -78,6 +78,11 @@ struct trace_iterator {
78 /* trace_seq for __print_flags() and __print_symbolic() etc. */ 78 /* trace_seq for __print_flags() and __print_symbolic() etc. */
79 struct trace_seq tmp_seq; 79 struct trace_seq tmp_seq;
80 80
81 cpumask_var_t started;
82
83 /* it's true when current open file is snapshot */
84 bool snapshot;
85
81 /* The below is zeroed out in pipe_read */ 86 /* The below is zeroed out in pipe_read */
82 struct trace_seq seq; 87 struct trace_seq seq;
83 struct trace_entry *ent; 88 struct trace_entry *ent;
@@ -90,10 +95,7 @@ struct trace_iterator {
90 loff_t pos; 95 loff_t pos;
91 long idx; 96 long idx;
92 97
93 cpumask_var_t started; 98 /* All new field here will be zeroed out in pipe_read */
94
95 /* it's true when current open file is snapshot */
96 bool snapshot;
97}; 99};
98 100
99enum trace_iter_flags { 101enum trace_iter_flags {
@@ -332,7 +334,7 @@ extern int trace_define_field(struct ftrace_event_call *call, const char *type,
332 const char *name, int offset, int size, 334 const char *name, int offset, int size,
333 int is_signed, int filter_type); 335 int is_signed, int filter_type);
334extern int trace_add_event_call(struct ftrace_event_call *call); 336extern int trace_add_event_call(struct ftrace_event_call *call);
335extern void trace_remove_event_call(struct ftrace_event_call *call); 337extern int trace_remove_event_call(struct ftrace_event_call *call);
336 338
337#define is_signed_type(type) (((type)(-1)) < (type)1) 339#define is_signed_type(type) (((type)(-1)) < (type)1)
338 340
@@ -357,6 +359,40 @@ do { \
357 __trace_printk(ip, fmt, ##args); \ 359 __trace_printk(ip, fmt, ##args); \
358} while (0) 360} while (0)
359 361
362/**
363 * tracepoint_string - register constant persistent string to trace system
364 * @str - a constant persistent string that will be referenced in tracepoints
365 *
366 * If constant strings are being used in tracepoints, it is faster and
367 * more efficient to just save the pointer to the string and reference
368 * that with a printf "%s" instead of saving the string in the ring buffer
369 * and wasting space and time.
370 *
371 * The problem with the above approach is that userspace tools that read
372 * the binary output of the trace buffers do not have access to the string.
373 * Instead they just show the address of the string which is not very
374 * useful to users.
375 *
376 * With tracepoint_string(), the string will be registered to the tracing
377 * system and exported to userspace via the debugfs/tracing/printk_formats
378 * file that maps the string address to the string text. This way userspace
379 * tools that read the binary buffers have a way to map the pointers to
380 * the ASCII strings they represent.
381 *
382 * The @str used must be a constant string and persistent as it would not
383 * make sense to show a string that no longer exists. But it is still fine
384 * to be used with modules, because when modules are unloaded, if they
385 * had tracepoints, the ring buffers are cleared too. As long as the string
386 * does not change during the life of the module, it is fine to use
387 * tracepoint_string() within a module.
388 */
389#define tracepoint_string(str) \
390 ({ \
391 static const char *___tp_str __tracepoint_string = str; \
392 ___tp_str; \
393 })
394#define __tracepoint_string __attribute__((section("__tracepoint_str")))
395
360#ifdef CONFIG_PERF_EVENTS 396#ifdef CONFIG_PERF_EVENTS
361struct perf_event; 397struct perf_event;
362 398
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 05bcc0903766..ccfe17c5c8da 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -1,126 +1,11 @@
1#ifndef LINUX_HARDIRQ_H 1#ifndef LINUX_HARDIRQ_H
2#define LINUX_HARDIRQ_H 2#define LINUX_HARDIRQ_H
3 3
4#include <linux/preempt.h> 4#include <linux/preempt_mask.h>
5#include <linux/lockdep.h> 5#include <linux/lockdep.h>
6#include <linux/ftrace_irq.h> 6#include <linux/ftrace_irq.h>
7#include <linux/vtime.h> 7#include <linux/vtime.h>
8#include <asm/hardirq.h>
9 8
10/*
11 * We put the hardirq and softirq counter into the preemption
12 * counter. The bitmask has the following meaning:
13 *
14 * - bits 0-7 are the preemption count (max preemption depth: 256)
15 * - bits 8-15 are the softirq count (max # of softirqs: 256)
16 *
17 * The hardirq count can in theory reach the same as NR_IRQS.
18 * In reality, the number of nested IRQS is limited to the stack
19 * size as well. For archs with over 1000 IRQS it is not practical
20 * to expect that they will all nest. We give a max of 10 bits for
21 * hardirq nesting. An arch may choose to give less than 10 bits.
22 * m68k expects it to be 8.
23 *
24 * - bits 16-25 are the hardirq count (max # of nested hardirqs: 1024)
25 * - bit 26 is the NMI_MASK
26 * - bit 27 is the PREEMPT_ACTIVE flag
27 *
28 * PREEMPT_MASK: 0x000000ff
29 * SOFTIRQ_MASK: 0x0000ff00
30 * HARDIRQ_MASK: 0x03ff0000
31 * NMI_MASK: 0x04000000
32 */
33#define PREEMPT_BITS 8
34#define SOFTIRQ_BITS 8
35#define NMI_BITS 1
36
37#define MAX_HARDIRQ_BITS 10
38
39#ifndef HARDIRQ_BITS
40# define HARDIRQ_BITS MAX_HARDIRQ_BITS
41#endif
42
43#if HARDIRQ_BITS > MAX_HARDIRQ_BITS
44#error HARDIRQ_BITS too high!
45#endif
46
47#define PREEMPT_SHIFT 0
48#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS)
49#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS)
50#define NMI_SHIFT (HARDIRQ_SHIFT + HARDIRQ_BITS)
51
52#define __IRQ_MASK(x) ((1UL << (x))-1)
53
54#define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT)
55#define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT)
56#define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT)
57#define NMI_MASK (__IRQ_MASK(NMI_BITS) << NMI_SHIFT)
58
59#define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT)
60#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT)
61#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT)
62#define NMI_OFFSET (1UL << NMI_SHIFT)
63
64#define SOFTIRQ_DISABLE_OFFSET (2 * SOFTIRQ_OFFSET)
65
66#ifndef PREEMPT_ACTIVE
67#define PREEMPT_ACTIVE_BITS 1
68#define PREEMPT_ACTIVE_SHIFT (NMI_SHIFT + NMI_BITS)
69#define PREEMPT_ACTIVE (__IRQ_MASK(PREEMPT_ACTIVE_BITS) << PREEMPT_ACTIVE_SHIFT)
70#endif
71
72#if PREEMPT_ACTIVE < (1 << (NMI_SHIFT + NMI_BITS))
73#error PREEMPT_ACTIVE is too low!
74#endif
75
76#define hardirq_count() (preempt_count() & HARDIRQ_MASK)
77#define softirq_count() (preempt_count() & SOFTIRQ_MASK)
78#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK \
79 | NMI_MASK))
80
81/*
82 * Are we doing bottom half or hardware interrupt processing?
83 * Are we in a softirq context? Interrupt context?
84 * in_softirq - Are we currently processing softirq or have bh disabled?
85 * in_serving_softirq - Are we currently processing softirq?
86 */
87#define in_irq() (hardirq_count())
88#define in_softirq() (softirq_count())
89#define in_interrupt() (irq_count())
90#define in_serving_softirq() (softirq_count() & SOFTIRQ_OFFSET)
91
92/*
93 * Are we in NMI context?
94 */
95#define in_nmi() (preempt_count() & NMI_MASK)
96
97#if defined(CONFIG_PREEMPT_COUNT)
98# define PREEMPT_CHECK_OFFSET 1
99#else
100# define PREEMPT_CHECK_OFFSET 0
101#endif
102
103/*
104 * Are we running in atomic context? WARNING: this macro cannot
105 * always detect atomic context; in particular, it cannot know about
106 * held spinlocks in non-preemptible kernels. Thus it should not be
107 * used in the general case to determine whether sleeping is possible.
108 * Do not use in_atomic() in driver code.
109 */
110#define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0)
111
112/*
113 * Check whether we were atomic before we did preempt_disable():
114 * (used by the scheduler, *after* releasing the kernel lock)
115 */
116#define in_atomic_preempt_off() \
117 ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET)
118
119#ifdef CONFIG_PREEMPT_COUNT
120# define preemptible() (preempt_count() == 0 && !irqs_disabled())
121#else
122# define preemptible() 0
123#endif
124 9
125#if defined(CONFIG_SMP) || defined(CONFIG_GENERIC_HARDIRQS) 10#if defined(CONFIG_SMP) || defined(CONFIG_GENERIC_HARDIRQS)
126extern void synchronize_irq(unsigned int irq); 11extern void synchronize_irq(unsigned int irq);
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index fae8bac907ef..a3b8b2e2d244 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -27,6 +27,14 @@
27 27
28#include <linux/types.h> 28#include <linux/types.h>
29 29
30/*
31 * Framework version for util services.
32 */
33
34#define UTIL_FW_MAJOR 3
35#define UTIL_FW_MINOR 0
36#define UTIL_FW_MAJOR_MINOR (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR)
37
30 38
31/* 39/*
32 * Implementation of host controlled snapshot of the guest. 40 * Implementation of host controlled snapshot of the guest.
@@ -455,27 +463,6 @@ hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
455 *read = dsize - *write; 463 *read = dsize - *write;
456} 464}
457 465
458
459/*
460 * We use the same version numbering for all Hyper-V modules.
461 *
462 * Definition of versioning is as follows;
463 *
464 * Major Number Changes for these scenarios;
465 * 1. When a new version of Windows Hyper-V
466 * is released.
467 * 2. A Major change has occurred in the
468 * Linux IC's.
469 * (For example the merge for the first time
470 * into the kernel) Every time the Major Number
471 * changes, the Revision number is reset to 0.
472 * Minor Number Changes when new functionality is added
473 * to the Linux IC's that is not a bug fix.
474 *
475 * 3.1 - Added completed hv_utils driver. Shutdown/Heartbeat/Timesync
476 */
477#define HV_DRV_VERSION "3.1"
478
479/* 466/*
480 * VMBUS version is 32 bit entity broken up into 467 * VMBUS version is 32 bit entity broken up into
481 * two 16 bit quantities: major_number. minor_number. 468 * two 16 bit quantities: major_number. minor_number.
@@ -1494,7 +1481,7 @@ struct hyperv_service_callback {
1494}; 1481};
1495 1482
1496#define MAX_SRV_VER 0x7ffffff 1483#define MAX_SRV_VER 0x7ffffff
1497extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *, 1484extern bool vmbus_prep_negotiate_resp(struct icmsg_hdr *,
1498 struct icmsg_negotiate *, u8 *, int, 1485 struct icmsg_negotiate *, u8 *, int,
1499 int); 1486 int);
1500 1487
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 72b26940730d..e51f65480ea5 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -17,6 +17,8 @@
17#include <linux/iio/trigger.h> 17#include <linux/iio/trigger.h>
18#include <linux/bitops.h> 18#include <linux/bitops.h>
19 19
20#include <linux/platform_data/st_sensors_pdata.h>
21
20#define ST_SENSORS_TX_MAX_LENGTH 2 22#define ST_SENSORS_TX_MAX_LENGTH 2
21#define ST_SENSORS_RX_MAX_LENGTH 6 23#define ST_SENSORS_RX_MAX_LENGTH 6
22 24
@@ -118,14 +120,16 @@ struct st_sensor_bdu {
118/** 120/**
119 * struct st_sensor_data_ready_irq - ST sensor device data-ready interrupt 121 * struct st_sensor_data_ready_irq - ST sensor device data-ready interrupt
120 * @addr: address of the register. 122 * @addr: address of the register.
121 * @mask: mask to write the on/off value. 123 * @mask_int1: mask to enable/disable IRQ on INT1 pin.
124 * @mask_int2: mask to enable/disable IRQ on INT2 pin.
122 * struct ig1 - represents the Interrupt Generator 1 of sensors. 125 * struct ig1 - represents the Interrupt Generator 1 of sensors.
123 * @en_addr: address of the enable ig1 register. 126 * @en_addr: address of the enable ig1 register.
124 * @en_mask: mask to write the on/off value for enable. 127 * @en_mask: mask to write the on/off value for enable.
125 */ 128 */
126struct st_sensor_data_ready_irq { 129struct st_sensor_data_ready_irq {
127 u8 addr; 130 u8 addr;
128 u8 mask; 131 u8 mask_int1;
132 u8 mask_int2;
129 struct { 133 struct {
130 u8 en_addr; 134 u8 en_addr;
131 u8 en_mask; 135 u8 en_mask;
@@ -201,6 +205,7 @@ struct st_sensors {
201 * @buffer_data: Data used by buffer part. 205 * @buffer_data: Data used by buffer part.
202 * @odr: Output data rate of the sensor [Hz]. 206 * @odr: Output data rate of the sensor [Hz].
203 * num_data_channels: Number of data channels used in buffer. 207 * num_data_channels: Number of data channels used in buffer.
208 * @drdy_int_pin: Redirect DRDY on pin 1 (1) or pin 2 (2).
204 * @get_irq_data_ready: Function to get the IRQ used for data ready signal. 209 * @get_irq_data_ready: Function to get the IRQ used for data ready signal.
205 * @tf: Transfer function structure used by I/O operations. 210 * @tf: Transfer function structure used by I/O operations.
206 * @tb: Transfer buffers and mutex used by I/O operations. 211 * @tb: Transfer buffers and mutex used by I/O operations.
@@ -219,6 +224,8 @@ struct st_sensor_data {
219 unsigned int odr; 224 unsigned int odr;
220 unsigned int num_data_channels; 225 unsigned int num_data_channels;
221 226
227 u8 drdy_int_pin;
228
222 unsigned int (*get_irq_data_ready) (struct iio_dev *indio_dev); 229 unsigned int (*get_irq_data_ready) (struct iio_dev *indio_dev);
223 230
224 const struct st_sensor_transfer_function *tf; 231 const struct st_sensor_transfer_function *tf;
@@ -249,7 +256,8 @@ static inline void st_sensors_deallocate_trigger(struct iio_dev *indio_dev)
249} 256}
250#endif 257#endif
251 258
252int st_sensors_init_sensor(struct iio_dev *indio_dev); 259int st_sensors_init_sensor(struct iio_dev *indio_dev,
260 struct st_sensors_platform_data *pdata);
253 261
254int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable); 262int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable);
255 263
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 3d35b7023591..2103cc32a5fb 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -532,6 +532,60 @@ static inline struct iio_dev *iio_priv_to_dev(void *priv)
532void iio_device_free(struct iio_dev *indio_dev); 532void iio_device_free(struct iio_dev *indio_dev);
533 533
534/** 534/**
535 * devm_iio_device_alloc - Resource-managed iio_device_alloc()
536 * @dev: Device to allocate iio_dev for
537 * @sizeof_priv: Space to allocate for private structure.
538 *
539 * Managed iio_device_alloc. iio_dev allocated with this function is
540 * automatically freed on driver detach.
541 *
542 * If an iio_dev allocated with this function needs to be freed separately,
543 * devm_iio_device_free() must be used.
544 *
545 * RETURNS:
546 * Pointer to allocated iio_dev on success, NULL on failure.
547 */
548struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv);
549
550/**
551 * devm_iio_device_free - Resource-managed iio_device_free()
552 * @dev: Device this iio_dev belongs to
553 * @indio_dev: the iio_dev associated with the device
554 *
555 * Free iio_dev allocated with devm_iio_device_alloc().
556 */
557void devm_iio_device_free(struct device *dev, struct iio_dev *indio_dev);
558
559/**
560 * devm_iio_trigger_alloc - Resource-managed iio_trigger_alloc()
561 * @dev: Device to allocate iio_trigger for
562 * @fmt: trigger name format. If it includes format
563 * specifiers, the additional arguments following
564 * format are formatted and inserted in the resulting
565 * string replacing their respective specifiers.
566 *
567 * Managed iio_trigger_alloc. iio_trigger allocated with this function is
568 * automatically freed on driver detach.
569 *
570 * If an iio_trigger allocated with this function needs to be freed separately,
571 * devm_iio_trigger_free() must be used.
572 *
573 * RETURNS:
574 * Pointer to allocated iio_trigger on success, NULL on failure.
575 */
576struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
577 const char *fmt, ...);
578
579/**
580 * devm_iio_trigger_free - Resource-managed iio_trigger_free()
581 * @dev: Device this iio_dev belongs to
582 * @iio_trig: the iio_trigger associated with the device
583 *
584 * Free iio_trigger allocated with devm_iio_trigger_alloc().
585 */
586void devm_iio_trigger_free(struct device *dev, struct iio_trigger *iio_trig);
587
588/**
535 * iio_buffer_enabled() - helper function to test if the buffer is enabled 589 * iio_buffer_enabled() - helper function to test if the buffer is enabled
536 * @indio_dev: IIO device structure for device 590 * @indio_dev: IIO device structure for device
537 **/ 591 **/
diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h
index b7a934b9431b..2958c960003a 100644
--- a/include/linux/iio/sysfs.h
+++ b/include/linux/iio/sysfs.h
@@ -73,11 +73,6 @@ struct iio_const_attr {
73 .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)} 73 .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)}
74 74
75/* Generic attributes of onetype or another */ 75/* Generic attributes of onetype or another */
76/**
77 * IIO_DEV_ATTR_RESET: resets the device
78 **/
79#define IIO_DEV_ATTR_RESET(_store) \
80 IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, _store, 0)
81 76
82/** 77/**
83 * IIO_DEV_ATTR_SAMP_FREQ - sets any internal clock frequency 78 * IIO_DEV_ATTR_SAMP_FREQ - sets any internal clock frequency
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
index 3869c525b052..369cf2cd5144 100644
--- a/include/linux/iio/trigger.h
+++ b/include/linux/iio/trigger.h
@@ -8,6 +8,7 @@
8 */ 8 */
9#include <linux/irq.h> 9#include <linux/irq.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/atomic.h>
11 12
12#ifndef _IIO_TRIGGER_H_ 13#ifndef _IIO_TRIGGER_H_
13#define _IIO_TRIGGER_H_ 14#define _IIO_TRIGGER_H_
@@ -61,7 +62,7 @@ struct iio_trigger {
61 62
62 struct list_head list; 63 struct list_head list;
63 struct list_head alloc_list; 64 struct list_head alloc_list;
64 int use_count; 65 atomic_t use_count;
65 66
66 struct irq_chip subirq_chip; 67 struct irq_chip subirq_chip;
67 int subirq_base; 68 int subirq_base;
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index b99cd23f3474..79640e015a86 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -5,45 +5,13 @@
5 5
6#include <linux/bitmap.h> 6#include <linux/bitmap.h>
7#include <linux/if.h> 7#include <linux/if.h>
8#include <linux/ip.h>
8#include <linux/netdevice.h> 9#include <linux/netdevice.h>
9#include <linux/rcupdate.h> 10#include <linux/rcupdate.h>
10#include <linux/timer.h> 11#include <linux/timer.h>
11#include <linux/sysctl.h> 12#include <linux/sysctl.h>
12#include <linux/rtnetlink.h> 13#include <linux/rtnetlink.h>
13 14
14enum
15{
16 IPV4_DEVCONF_FORWARDING=1,
17 IPV4_DEVCONF_MC_FORWARDING,
18 IPV4_DEVCONF_PROXY_ARP,
19 IPV4_DEVCONF_ACCEPT_REDIRECTS,
20 IPV4_DEVCONF_SECURE_REDIRECTS,
21 IPV4_DEVCONF_SEND_REDIRECTS,
22 IPV4_DEVCONF_SHARED_MEDIA,
23 IPV4_DEVCONF_RP_FILTER,
24 IPV4_DEVCONF_ACCEPT_SOURCE_ROUTE,
25 IPV4_DEVCONF_BOOTP_RELAY,
26 IPV4_DEVCONF_LOG_MARTIANS,
27 IPV4_DEVCONF_TAG,
28 IPV4_DEVCONF_ARPFILTER,
29 IPV4_DEVCONF_MEDIUM_ID,
30 IPV4_DEVCONF_NOXFRM,
31 IPV4_DEVCONF_NOPOLICY,
32 IPV4_DEVCONF_FORCE_IGMP_VERSION,
33 IPV4_DEVCONF_ARP_ANNOUNCE,
34 IPV4_DEVCONF_ARP_IGNORE,
35 IPV4_DEVCONF_PROMOTE_SECONDARIES,
36 IPV4_DEVCONF_ARP_ACCEPT,
37 IPV4_DEVCONF_ARP_NOTIFY,
38 IPV4_DEVCONF_ACCEPT_LOCAL,
39 IPV4_DEVCONF_SRC_VMARK,
40 IPV4_DEVCONF_PROXY_ARP_PVLAN,
41 IPV4_DEVCONF_ROUTE_LOCALNET,
42 __IPV4_DEVCONF_MAX
43};
44
45#define IPV4_DEVCONF_MAX (__IPV4_DEVCONF_MAX - 1)
46
47struct ipv4_devconf { 15struct ipv4_devconf {
48 void *sysctl; 16 void *sysctl;
49 int data[IPV4_DEVCONF_MAX]; 17 int data[IPV4_DEVCONF_MAX];
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 850e95bc766c..b8b7dc755752 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -101,6 +101,7 @@ struct inet6_skb_parm {
101#define IP6SKB_FORWARDED 2 101#define IP6SKB_FORWARDED 2
102#define IP6SKB_REROUTED 4 102#define IP6SKB_REROUTED 4
103#define IP6SKB_ROUTERALERT 8 103#define IP6SKB_ROUTERALERT 8
104#define IP6SKB_FRAGMENTED 16
104}; 105};
105 106
106#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 107#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 97ba4e78a37e..d235e88cfd7c 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -101,13 +101,13 @@ static inline u64 get_jiffies_64(void)
101#define time_after(a,b) \ 101#define time_after(a,b) \
102 (typecheck(unsigned long, a) && \ 102 (typecheck(unsigned long, a) && \
103 typecheck(unsigned long, b) && \ 103 typecheck(unsigned long, b) && \
104 ((long)(b) - (long)(a) < 0)) 104 ((long)((b) - (a)) < 0))
105#define time_before(a,b) time_after(b,a) 105#define time_before(a,b) time_after(b,a)
106 106
107#define time_after_eq(a,b) \ 107#define time_after_eq(a,b) \
108 (typecheck(unsigned long, a) && \ 108 (typecheck(unsigned long, a) && \
109 typecheck(unsigned long, b) && \ 109 typecheck(unsigned long, b) && \
110 ((long)(a) - (long)(b) >= 0)) 110 ((long)((a) - (b)) >= 0))
111#define time_before_eq(a,b) time_after_eq(b,a) 111#define time_before_eq(a,b) time_after_eq(b,a)
112 112
113/* 113/*
@@ -130,13 +130,13 @@ static inline u64 get_jiffies_64(void)
130#define time_after64(a,b) \ 130#define time_after64(a,b) \
131 (typecheck(__u64, a) && \ 131 (typecheck(__u64, a) && \
132 typecheck(__u64, b) && \ 132 typecheck(__u64, b) && \
133 ((__s64)(b) - (__s64)(a) < 0)) 133 ((__s64)((b) - (a)) < 0))
134#define time_before64(a,b) time_after64(b,a) 134#define time_before64(a,b) time_after64(b,a)
135 135
136#define time_after_eq64(a,b) \ 136#define time_after_eq64(a,b) \
137 (typecheck(__u64, a) && \ 137 (typecheck(__u64, a) && \
138 typecheck(__u64, b) && \ 138 typecheck(__u64, b) && \
139 ((__s64)(a) - (__s64)(b) >= 0)) 139 ((__s64)((a) - (b)) >= 0))
140#define time_before_eq64(a,b) time_after_eq64(b,a) 140#define time_before_eq64(a,b) time_after_eq64(b,a)
141 141
142#define time_in_range64(a, b, c) \ 142#define time_in_range64(a, b, c) \
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index b7c8cdc1d422..cbfb171bbcba 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -36,10 +36,9 @@ struct kbd_struct {
36#define VC_CTRLRLOCK KG_CTRLR /* ctrlr lock mode */ 36#define VC_CTRLRLOCK KG_CTRLR /* ctrlr lock mode */
37 unsigned char slockstate; /* for `sticky' Shift, Ctrl, etc. */ 37 unsigned char slockstate; /* for `sticky' Shift, Ctrl, etc. */
38 38
39 unsigned char ledmode:2; /* one 2-bit value */ 39 unsigned char ledmode:1;
40#define LED_SHOW_FLAGS 0 /* traditional state */ 40#define LED_SHOW_FLAGS 0 /* traditional state */
41#define LED_SHOW_IOCTL 1 /* only change leds upon ioctl */ 41#define LED_SHOW_IOCTL 1 /* only change leds upon ioctl */
42#define LED_SHOW_MEM 2 /* `heartbeat': peek into memory */
43 42
44 unsigned char ledflagstate:4; /* flags, not lights */ 43 unsigned char ledflagstate:4; /* flags, not lights */
45 unsigned char default_ledflagstate:4; 44 unsigned char default_ledflagstate:4;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 3bef14c6586b..482ad2d84a32 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -629,7 +629,7 @@ extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode);
629static inline void tracing_start(void) { } 629static inline void tracing_start(void) { }
630static inline void tracing_stop(void) { } 630static inline void tracing_stop(void) { }
631static inline void ftrace_off_permanent(void) { } 631static inline void ftrace_off_permanent(void) { }
632static inline void trace_dump_stack(void) { } 632static inline void trace_dump_stack(int skip) { }
633 633
634static inline void tracing_on(void) { } 634static inline void tracing_on(void) { }
635static inline void tracing_off(void) { } 635static inline void tracing_off(void) { }
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 939b11268c86..de6dcbcc6ef7 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -26,6 +26,7 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/wait.h> 27#include <linux/wait.h>
28#include <linux/atomic.h> 28#include <linux/atomic.h>
29#include <linux/workqueue.h>
29 30
30#define UEVENT_HELPER_PATH_LEN 256 31#define UEVENT_HELPER_PATH_LEN 256
31#define UEVENT_NUM_ENVP 32 /* number of env pointers */ 32#define UEVENT_NUM_ENVP 32 /* number of env pointers */
@@ -65,6 +66,9 @@ struct kobject {
65 struct kobj_type *ktype; 66 struct kobj_type *ktype;
66 struct sysfs_dirent *sd; 67 struct sysfs_dirent *sd;
67 struct kref kref; 68 struct kref kref;
69#ifdef CONFIG_DEBUG_KOBJECT_RELEASE
70 struct delayed_work release;
71#endif
68 unsigned int state_initialized:1; 72 unsigned int state_initialized:1;
69 unsigned int state_in_sysfs:1; 73 unsigned int state_in_sysfs:1;
70 unsigned int state_add_uevent_sent:1; 74 unsigned int state_add_uevent_sent:1;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 4ea55bb45deb..0e23c26485f4 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -138,6 +138,22 @@ enum {
138 ATA_SHT_THIS_ID = -1, 138 ATA_SHT_THIS_ID = -1,
139 ATA_SHT_USE_CLUSTERING = 1, 139 ATA_SHT_USE_CLUSTERING = 1,
140 140
141 /* struct ata_taskfile flags */
142 ATA_TFLAG_LBA48 = (1 << 0), /* enable 48-bit LBA and "HOB" */
143 ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */
144 ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */
145 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */
146 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */
147 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */
148 ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */
149
150 /* protocol flags */
151 ATA_PROT_FLAG_PIO = (1 << 0), /* is PIO */
152 ATA_PROT_FLAG_DMA = (1 << 1), /* is DMA */
153 ATA_PROT_FLAG_DATA = ATA_PROT_FLAG_PIO | ATA_PROT_FLAG_DMA,
154 ATA_PROT_FLAG_NCQ = (1 << 2), /* is NCQ */
155 ATA_PROT_FLAG_ATAPI = (1 << 3), /* is ATAPI */
156
141 /* struct ata_device stuff */ 157 /* struct ata_device stuff */
142 ATA_DFLAG_LBA = (1 << 0), /* device supports LBA */ 158 ATA_DFLAG_LBA = (1 << 0), /* device supports LBA */
143 ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */ 159 ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */
@@ -156,6 +172,7 @@ enum {
156 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ 172 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */
157 ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */ 173 ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */
158 ATA_DFLAG_UNLOCK_HPA = (1 << 18), /* unlock HPA */ 174 ATA_DFLAG_UNLOCK_HPA = (1 << 18), /* unlock HPA */
175 ATA_DFLAG_NCQ_SEND_RECV = (1 << 19), /* device supports NCQ SEND and RECV */
159 ATA_DFLAG_INIT_MASK = (1 << 24) - 1, 176 ATA_DFLAG_INIT_MASK = (1 << 24) - 1,
160 177
161 ATA_DFLAG_DETACH = (1 << 24), 178 ATA_DFLAG_DETACH = (1 << 24),
@@ -207,6 +224,7 @@ enum {
207 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ 224 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */
208 ATA_FLAG_AN = (1 << 18), /* controller supports AN */ 225 ATA_FLAG_AN = (1 << 18), /* controller supports AN */
209 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ 226 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */
227 ATA_FLAG_FPDMA_AUX = (1 << 20), /* controller supports H2DFIS aux field */
210 ATA_FLAG_EM = (1 << 21), /* driver supports enclosure 228 ATA_FLAG_EM = (1 << 21), /* driver supports enclosure
211 * management */ 229 * management */
212 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity 230 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity
@@ -518,6 +536,33 @@ enum sw_activity {
518 BLINK_OFF, 536 BLINK_OFF,
519}; 537};
520 538
539struct ata_taskfile {
540 unsigned long flags; /* ATA_TFLAG_xxx */
541 u8 protocol; /* ATA_PROT_xxx */
542
543 u8 ctl; /* control reg */
544
545 u8 hob_feature; /* additional data */
546 u8 hob_nsect; /* to support LBA48 */
547 u8 hob_lbal;
548 u8 hob_lbam;
549 u8 hob_lbah;
550
551 u8 feature;
552 u8 nsect;
553 u8 lbal;
554 u8 lbam;
555 u8 lbah;
556
557 u8 device;
558
559 u8 command; /* IO operation */
560
561 u32 auxiliary; /* auxiliary field */
562 /* from SATA 3.1 and */
563 /* ATA-8 ACS-3 */
564};
565
521#ifdef CONFIG_ATA_SFF 566#ifdef CONFIG_ATA_SFF
522struct ata_ioports { 567struct ata_ioports {
523 void __iomem *cmd_addr; 568 void __iomem *cmd_addr;
@@ -660,6 +705,9 @@ struct ata_device {
660 /* DEVSLP Timing Variables from Identify Device Data Log */ 705 /* DEVSLP Timing Variables from Identify Device Data Log */
661 u8 devslp_timing[ATA_LOG_DEVSLP_SIZE]; 706 u8 devslp_timing[ATA_LOG_DEVSLP_SIZE];
662 707
708 /* NCQ send and receive log subcommand support */
709 u8 ncq_send_recv_cmds[ATA_LOG_NCQ_SEND_RECV_SIZE];
710
663 /* error history */ 711 /* error history */
664 int spdn_cnt; 712 int spdn_cnt;
665 /* ering is CLEAR_END, read comment above CLEAR_END */ 713 /* ering is CLEAR_END, read comment above CLEAR_END */
@@ -959,6 +1007,69 @@ extern const unsigned long sata_deb_timing_long[];
959extern struct ata_port_operations ata_dummy_port_ops; 1007extern struct ata_port_operations ata_dummy_port_ops;
960extern const struct ata_port_info ata_dummy_port_info; 1008extern const struct ata_port_info ata_dummy_port_info;
961 1009
1010/*
1011 * protocol tests
1012 */
1013static inline unsigned int ata_prot_flags(u8 prot)
1014{
1015 switch (prot) {
1016 case ATA_PROT_NODATA:
1017 return 0;
1018 case ATA_PROT_PIO:
1019 return ATA_PROT_FLAG_PIO;
1020 case ATA_PROT_DMA:
1021 return ATA_PROT_FLAG_DMA;
1022 case ATA_PROT_NCQ:
1023 return ATA_PROT_FLAG_DMA | ATA_PROT_FLAG_NCQ;
1024 case ATAPI_PROT_NODATA:
1025 return ATA_PROT_FLAG_ATAPI;
1026 case ATAPI_PROT_PIO:
1027 return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_PIO;
1028 case ATAPI_PROT_DMA:
1029 return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_DMA;
1030 }
1031 return 0;
1032}
1033
1034static inline int ata_is_atapi(u8 prot)
1035{
1036 return ata_prot_flags(prot) & ATA_PROT_FLAG_ATAPI;
1037}
1038
1039static inline int ata_is_nodata(u8 prot)
1040{
1041 return !(ata_prot_flags(prot) & ATA_PROT_FLAG_DATA);
1042}
1043
1044static inline int ata_is_pio(u8 prot)
1045{
1046 return ata_prot_flags(prot) & ATA_PROT_FLAG_PIO;
1047}
1048
1049static inline int ata_is_dma(u8 prot)
1050{
1051 return ata_prot_flags(prot) & ATA_PROT_FLAG_DMA;
1052}
1053
1054static inline int ata_is_ncq(u8 prot)
1055{
1056 return ata_prot_flags(prot) & ATA_PROT_FLAG_NCQ;
1057}
1058
1059static inline int ata_is_data(u8 prot)
1060{
1061 return ata_prot_flags(prot) & ATA_PROT_FLAG_DATA;
1062}
1063
1064static inline int is_multi_taskfile(struct ata_taskfile *tf)
1065{
1066 return (tf->command == ATA_CMD_READ_MULTI) ||
1067 (tf->command == ATA_CMD_WRITE_MULTI) ||
1068 (tf->command == ATA_CMD_READ_MULTI_EXT) ||
1069 (tf->command == ATA_CMD_WRITE_MULTI_EXT) ||
1070 (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT);
1071}
1072
962static inline const unsigned long * 1073static inline const unsigned long *
963sata_ehc_deb_timing(struct ata_eh_context *ehc) 1074sata_ehc_deb_timing(struct ata_eh_context *ehc)
964{ 1075{
@@ -1142,8 +1253,6 @@ int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm);
1142int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm); 1253int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm);
1143unsigned long ata_acpi_gtm_xfermask(struct ata_device *dev, 1254unsigned long ata_acpi_gtm_xfermask(struct ata_device *dev,
1144 const struct ata_acpi_gtm *gtm); 1255 const struct ata_acpi_gtm *gtm);
1145acpi_handle ata_ap_acpi_handle(struct ata_port *ap);
1146acpi_handle ata_dev_acpi_handle(struct ata_device *dev);
1147int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm); 1256int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm);
1148#else 1257#else
1149static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap) 1258static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
@@ -1497,6 +1606,13 @@ static inline int ata_ncq_enabled(struct ata_device *dev)
1497 ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ; 1606 ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ;
1498} 1607}
1499 1608
1609static inline bool ata_fpdma_dsm_supported(struct ata_device *dev)
1610{
1611 return (dev->flags & ATA_DFLAG_NCQ_SEND_RECV) &&
1612 (dev->ncq_send_recv_cmds[ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET] &
1613 ATA_LOG_NCQ_SEND_RECV_DSM_TRIM);
1614}
1615
1500static inline void ata_qc_set_polling(struct ata_queued_cmd *qc) 1616static inline void ata_qc_set_polling(struct ata_queued_cmd *qc)
1501{ 1617{
1502 qc->tf.ctl |= ATA_NIEN; 1618 qc->tf.ctl |= ATA_NIEN;
diff --git a/include/linux/llist.h b/include/linux/llist.h
index cdaa7f023899..8828a78dec9a 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -125,6 +125,29 @@ static inline void init_llist_head(struct llist_head *list)
125 (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member)) 125 (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member))
126 126
127/** 127/**
128 * llist_for_each_entry_safe - iterate over some deleted entries of lock-less list of given type
129 * safe against removal of list entry
130 * @pos: the type * to use as a loop cursor.
131 * @n: another type * to use as temporary storage
132 * @node: the first entry of deleted list entries.
133 * @member: the name of the llist_node with the struct.
134 *
135 * In general, some entries of the lock-less list can be traversed
136 * safely only after being removed from list, so start with an entry
137 * instead of list head.
138 *
139 * If being used on entries deleted from lock-less list directly, the
140 * traverse order is from the newest to the oldest added entry. If
141 * you want to traverse from the oldest to the newest, you must
142 * reverse the order by yourself before traversing.
143 */
144#define llist_for_each_entry_safe(pos, n, node, member) \
145 for (pos = llist_entry((node), typeof(*pos), member); \
146 &pos->member != NULL && \
147 (n = llist_entry(pos->member.next, typeof(*n), member), true); \
148 pos = n)
149
150/**
128 * llist_empty - tests whether a lock-less list is empty 151 * llist_empty - tests whether a lock-less list is empty
129 * @head: the list to test 152 * @head: the list to test
130 * 153 *
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index f1e877b79ed8..cfc2f119779a 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -365,7 +365,7 @@ extern void lockdep_trace_alloc(gfp_t mask);
365 365
366#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion) 366#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
367 367
368#else /* !LOCKDEP */ 368#else /* !CONFIG_LOCKDEP */
369 369
370static inline void lockdep_off(void) 370static inline void lockdep_off(void)
371{ 371{
@@ -479,82 +479,36 @@ static inline void print_irqtrace_events(struct task_struct *curr)
479 * on the per lock-class debug mode: 479 * on the per lock-class debug mode:
480 */ 480 */
481 481
482#ifdef CONFIG_DEBUG_LOCK_ALLOC 482#ifdef CONFIG_PROVE_LOCKING
483# ifdef CONFIG_PROVE_LOCKING 483 #define lock_acquire_exclusive(l, s, t, n, i) lock_acquire(l, s, t, 0, 2, n, i)
484# define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) 484 #define lock_acquire_shared(l, s, t, n, i) lock_acquire(l, s, t, 1, 2, n, i)
485# define spin_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 2, n, i) 485 #define lock_acquire_shared_recursive(l, s, t, n, i) lock_acquire(l, s, t, 2, 2, n, i)
486# else
487# define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i)
488# define spin_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 1, NULL, i)
489# endif
490# define spin_release(l, n, i) lock_release(l, n, i)
491#else 486#else
492# define spin_acquire(l, s, t, i) do { } while (0) 487 #define lock_acquire_exclusive(l, s, t, n, i) lock_acquire(l, s, t, 0, 1, n, i)
493# define spin_release(l, n, i) do { } while (0) 488 #define lock_acquire_shared(l, s, t, n, i) lock_acquire(l, s, t, 1, 1, n, i)
489 #define lock_acquire_shared_recursive(l, s, t, n, i) lock_acquire(l, s, t, 2, 1, n, i)
494#endif 490#endif
495 491
496#ifdef CONFIG_DEBUG_LOCK_ALLOC 492#define spin_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i)
497# ifdef CONFIG_PROVE_LOCKING 493#define spin_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i)
498# define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) 494#define spin_release(l, n, i) lock_release(l, n, i)
499# define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 2, NULL, i)
500# else
501# define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i)
502# define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 1, NULL, i)
503# endif
504# define rwlock_release(l, n, i) lock_release(l, n, i)
505#else
506# define rwlock_acquire(l, s, t, i) do { } while (0)
507# define rwlock_acquire_read(l, s, t, i) do { } while (0)
508# define rwlock_release(l, n, i) do { } while (0)
509#endif
510 495
511#ifdef CONFIG_DEBUG_LOCK_ALLOC 496#define rwlock_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i)
512# ifdef CONFIG_PROVE_LOCKING 497#define rwlock_acquire_read(l, s, t, i) lock_acquire_shared_recursive(l, s, t, NULL, i)
513# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) 498#define rwlock_release(l, n, i) lock_release(l, n, i)
514# define mutex_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 2, n, i)
515# else
516# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i)
517# define mutex_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 1, n, i)
518# endif
519# define mutex_release(l, n, i) lock_release(l, n, i)
520#else
521# define mutex_acquire(l, s, t, i) do { } while (0)
522# define mutex_acquire_nest(l, s, t, n, i) do { } while (0)
523# define mutex_release(l, n, i) do { } while (0)
524#endif
525 499
526#ifdef CONFIG_DEBUG_LOCK_ALLOC 500#define mutex_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i)
527# ifdef CONFIG_PROVE_LOCKING 501#define mutex_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i)
528# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) 502#define mutex_release(l, n, i) lock_release(l, n, i)
529# define rwsem_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 2, n, i) 503
530# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 2, NULL, i) 504#define rwsem_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i)
531# else 505#define rwsem_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i)
532# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i) 506#define rwsem_acquire_read(l, s, t, i) lock_acquire_shared(l, s, t, NULL, i)
533# define rwsem_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 1, n, i)
534# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 1, NULL, i)
535# endif
536# define rwsem_release(l, n, i) lock_release(l, n, i) 507# define rwsem_release(l, n, i) lock_release(l, n, i)
537#else
538# define rwsem_acquire(l, s, t, i) do { } while (0)
539# define rwsem_acquire_nest(l, s, t, n, i) do { } while (0)
540# define rwsem_acquire_read(l, s, t, i) do { } while (0)
541# define rwsem_release(l, n, i) do { } while (0)
542#endif
543 508
544#ifdef CONFIG_DEBUG_LOCK_ALLOC 509#define lock_map_acquire(l) lock_acquire_exclusive(l, 0, 0, NULL, _THIS_IP_)
545# ifdef CONFIG_PROVE_LOCKING 510#define lock_map_acquire_read(l) lock_acquire_shared_recursive(l, 0, 0, NULL, _THIS_IP_)
546# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 2, NULL, _THIS_IP_)
547# define lock_map_acquire_read(l) lock_acquire(l, 0, 0, 2, 2, NULL, _THIS_IP_)
548# else
549# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 1, NULL, _THIS_IP_)
550# define lock_map_acquire_read(l) lock_acquire(l, 0, 0, 2, 1, NULL, _THIS_IP_)
551# endif
552# define lock_map_release(l) lock_release(l, 1, _THIS_IP_) 511# define lock_map_release(l) lock_release(l, 1, _THIS_IP_)
553#else
554# define lock_map_acquire(l) do { } while (0)
555# define lock_map_acquire_read(l) do { } while (0)
556# define lock_map_release(l) do { } while (0)
557#endif
558 512
559#ifdef CONFIG_PROVE_LOCKING 513#ifdef CONFIG_PROVE_LOCKING
560# define might_lock(lock) \ 514# define might_lock(lock) \
diff --git a/include/linux/lockref.h b/include/linux/lockref.h
new file mode 100644
index 000000000000..ca07b5028b01
--- /dev/null
+++ b/include/linux/lockref.h
@@ -0,0 +1,36 @@
1#ifndef __LINUX_LOCKREF_H
2#define __LINUX_LOCKREF_H
3
4/*
5 * Locked reference counts.
6 *
7 * These are different from just plain atomic refcounts in that they
8 * are atomic with respect to the spinlock that goes with them. In
9 * particular, there can be implementations that don't actually get
10 * the spinlock for the common decrement/increment operations, but they
11 * still have to check that the operation is done semantically as if
12 * the spinlock had been taken (using a cmpxchg operation that covers
13 * both the lock and the count word, or using memory transactions, for
14 * example).
15 */
16
17#include <linux/spinlock.h>
18
19struct lockref {
20 union {
21#ifdef CONFIG_CMPXCHG_LOCKREF
22 aligned_u64 lock_count;
23#endif
24 struct {
25 spinlock_t lock;
26 unsigned int count;
27 };
28 };
29};
30
31extern void lockref_get(struct lockref *);
32extern int lockref_get_not_zero(struct lockref *);
33extern int lockref_get_or_lock(struct lockref *);
34extern int lockref_put_or_lock(struct lockref *);
35
36#endif /* __LINUX_LOCKREF_H */
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 7b4d9d79570b..6c416092e324 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -85,7 +85,7 @@ extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
85extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm); 85extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm);
86 86
87extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg); 87extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg);
88extern struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont); 88extern struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *css);
89 89
90static inline 90static inline
91bool mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *memcg) 91bool mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *memcg)
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 85c31a8e2904..9a6bbf76452d 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -25,16 +25,9 @@
25struct memory_block { 25struct memory_block {
26 unsigned long start_section_nr; 26 unsigned long start_section_nr;
27 unsigned long end_section_nr; 27 unsigned long end_section_nr;
28 unsigned long state; 28 unsigned long state; /* serialized by the dev->lock */
29 int section_count; 29 int section_count; /* serialized by mem_sysfs_mutex */
30 30 int online_type; /* for passing data to online routine */
31 /*
32 * This serializes all state change requests. It isn't
33 * held during creation because the control files are
34 * created long after the critical areas during
35 * initialization.
36 */
37 struct mutex state_mutex;
38 int phys_device; /* to which fru does this belong? */ 31 int phys_device; /* to which fru does this belong? */
39 void *hw; /* optional pointer to fw/hw data */ 32 void *hw; /* optional pointer to fw/hw data */
40 int (*phys_callback)(struct memory_block *); 33 int (*phys_callback)(struct memory_block *);
@@ -125,7 +118,6 @@ extern struct memory_block *find_memory_block_hinted(struct mem_section *,
125 struct memory_block *); 118 struct memory_block *);
126extern struct memory_block *find_memory_block(struct mem_section *); 119extern struct memory_block *find_memory_block(struct mem_section *);
127#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) 120#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
128enum mem_add_context { BOOT, HOTPLUG };
129#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ 121#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
130 122
131#ifdef CONFIG_MEMORY_HOTPLUG 123#ifdef CONFIG_MEMORY_HOTPLUG
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 1a8dd7afe084..e6090d88e91d 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -160,7 +160,8 @@ enum palmas_regulators {
160 PALMAS_REG_SMPS7, 160 PALMAS_REG_SMPS7,
161 PALMAS_REG_SMPS8, 161 PALMAS_REG_SMPS8,
162 PALMAS_REG_SMPS9, 162 PALMAS_REG_SMPS9,
163 PALMAS_REG_SMPS10, 163 PALMAS_REG_SMPS10_OUT2,
164 PALMAS_REG_SMPS10_OUT1,
164 /* LDO regulators */ 165 /* LDO regulators */
165 PALMAS_REG_LDO1, 166 PALMAS_REG_LDO1,
166 PALMAS_REG_LDO2, 167 PALMAS_REG_LDO2,
@@ -355,9 +356,9 @@ struct palmas_pmic {
355 int smps123; 356 int smps123;
356 int smps457; 357 int smps457;
357 358
358 int range[PALMAS_REG_SMPS10]; 359 int range[PALMAS_REG_SMPS10_OUT1];
359 unsigned int ramp_delay[PALMAS_REG_SMPS10]; 360 unsigned int ramp_delay[PALMAS_REG_SMPS10_OUT1];
360 unsigned int current_reg_mode[PALMAS_REG_SMPS10]; 361 unsigned int current_reg_mode[PALMAS_REG_SMPS10_OUT1];
361}; 362};
362 363
363struct palmas_resource { 364struct palmas_resource {
@@ -371,17 +372,15 @@ struct palmas_usb {
371 372
372 struct extcon_dev edev; 373 struct extcon_dev edev;
373 374
374 /* used to set vbus, in atomic path */
375 struct work_struct set_vbus_work;
376
377 int id_otg_irq; 375 int id_otg_irq;
378 int id_irq; 376 int id_irq;
379 int vbus_otg_irq; 377 int vbus_otg_irq;
380 int vbus_irq; 378 int vbus_irq;
381 379
382 int vbus_enable;
383
384 enum palmas_usb_state linkstat; 380 enum palmas_usb_state linkstat;
381 int wakeup;
382 bool enable_vbus_detection;
383 bool enable_id_detection;
385}; 384};
386 385
387#define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator) 386#define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator)
diff --git a/include/linux/mfd/samsung/s2mps11.h b/include/linux/mfd/samsung/s2mps11.h
index 4e94dc65f987..d0d52ea60074 100644
--- a/include/linux/mfd/samsung/s2mps11.h
+++ b/include/linux/mfd/samsung/s2mps11.h
@@ -191,6 +191,17 @@ enum s2mps11_regulators {
191#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1) 191#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1)
192#define S2MPS11_RAMP_DELAY 25000 /* uV/us */ 192#define S2MPS11_RAMP_DELAY 25000 /* uV/us */
193 193
194
195#define S2MPS11_BUCK2_RAMP_SHIFT 6
196#define S2MPS11_BUCK34_RAMP_SHIFT 4
197#define S2MPS11_BUCK5_RAMP_SHIFT 6
198#define S2MPS11_BUCK16_RAMP_SHIFT 4
199#define S2MPS11_BUCK7810_RAMP_SHIFT 2
200#define S2MPS11_BUCK9_RAMP_SHIFT 0
201#define S2MPS11_BUCK2_RAMP_EN_SHIFT 3
202#define S2MPS11_BUCK3_RAMP_EN_SHIFT 2
203#define S2MPS11_BUCK4_RAMP_EN_SHIFT 1
204#define S2MPS11_BUCK6_RAMP_EN_SHIFT 0
194#define S2MPS11_PMIC_EN_SHIFT 6 205#define S2MPS11_PMIC_EN_SHIFT 6
195#define S2MPS11_REGULATOR_MAX (S2MPS11_REG_MAX - 3) 206#define S2MPS11_REGULATOR_MAX (S2MPS11_REG_MAX - 3)
196 207
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index 8d73fe29796a..db1791bb997a 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -113,11 +113,27 @@
113#define CNTRLREG_8WIRE CNTRLREG_AFE_CTRL(3) 113#define CNTRLREG_8WIRE CNTRLREG_AFE_CTRL(3)
114#define CNTRLREG_TSCENB BIT(7) 114#define CNTRLREG_TSCENB BIT(7)
115 115
116/* FIFO READ Register */
117#define FIFOREAD_DATA_MASK (0xfff << 0)
118#define FIFOREAD_CHNLID_MASK (0xf << 16)
119
120/* Sequencer Status */
121#define SEQ_STATUS BIT(5)
122
116#define ADC_CLK 3000000 123#define ADC_CLK 3000000
117#define MAX_CLK_DIV 7 124#define MAX_CLK_DIV 7
118#define TOTAL_STEPS 16 125#define TOTAL_STEPS 16
119#define TOTAL_CHANNELS 8 126#define TOTAL_CHANNELS 8
120 127
128/*
129* ADC runs at 3MHz, and it takes
130* 15 cycles to latch one data output.
131* Hence the idle time for ADC to
132* process one sample data would be
133* around 5 micro seconds.
134*/
135#define IDLE_TIMEOUT 5 /* microsec */
136
121#define TSCADC_CELLS 2 137#define TSCADC_CELLS 2
122 138
123struct ti_tscadc_dev { 139struct ti_tscadc_dev {
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h
index 29eab2bd3dfa..a5a7f0130e96 100644
--- a/include/linux/mfd/tps65217.h
+++ b/include/linux/mfd/tps65217.h
@@ -244,24 +244,6 @@ struct tps65217_board {
244}; 244};
245 245
246/** 246/**
247 * struct tps_info - packages regulator constraints
248 * @name: Voltage regulator name
249 * @min_uV: minimum micro volts
250 * @max_uV: minimum micro volts
251 * @vsel_to_uv: Function pointer to get voltage from selector
252 * @uv_to_vsel: Function pointer to get selector from voltage
253 *
254 * This data is used to check the regualtor voltage limits while setting.
255 */
256struct tps_info {
257 const char *name;
258 int min_uV;
259 int max_uV;
260 int (*vsel_to_uv)(unsigned int vsel);
261 int (*uv_to_vsel)(int uV, unsigned int *vsel);
262};
263
264/**
265 * struct tps65217 - tps65217 sub-driver chip access routines 247 * struct tps65217 - tps65217 sub-driver chip access routines
266 * 248 *
267 * Device data may be used to access the TPS65217 chip 249 * Device data may be used to access the TPS65217 chip
@@ -273,7 +255,6 @@ struct tps65217 {
273 unsigned int id; 255 unsigned int id;
274 struct regulator_desc desc[TPS65217_NUM_REGULATOR]; 256 struct regulator_desc desc[TPS65217_NUM_REGULATOR];
275 struct regulator_dev *rdev[TPS65217_NUM_REGULATOR]; 257 struct regulator_dev *rdev[TPS65217_NUM_REGULATOR];
276 struct tps_info *info[TPS65217_NUM_REGULATOR];
277 struct regmap *regmap; 258 struct regmap *regmap;
278}; 259};
279 260
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 737685e9e852..68029b30c3dc 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -309,21 +309,20 @@ struct mlx5_hca_cap {
309 __be16 max_desc_sz_rq; 309 __be16 max_desc_sz_rq;
310 u8 rsvd21[2]; 310 u8 rsvd21[2];
311 __be16 max_desc_sz_sq_dc; 311 __be16 max_desc_sz_sq_dc;
312 u8 rsvd22[4]; 312 __be32 max_qp_mcg;
313 __be16 max_qp_mcg; 313 u8 rsvd22[3];
314 u8 rsvd23;
315 u8 log_max_mcg; 314 u8 log_max_mcg;
316 u8 rsvd24; 315 u8 rsvd23;
317 u8 log_max_pd; 316 u8 log_max_pd;
318 u8 rsvd25; 317 u8 rsvd24;
319 u8 log_max_xrcd; 318 u8 log_max_xrcd;
320 u8 rsvd26[42]; 319 u8 rsvd25[42];
321 __be16 log_uar_page_sz; 320 __be16 log_uar_page_sz;
322 u8 rsvd27[28]; 321 u8 rsvd26[28];
323 u8 log_msx_atomic_size_qp; 322 u8 log_msx_atomic_size_qp;
324 u8 rsvd28[2]; 323 u8 rsvd27[2];
325 u8 log_msx_atomic_size_dc; 324 u8 log_msx_atomic_size_dc;
326 u8 rsvd29[76]; 325 u8 rsvd28[76];
327}; 326};
328 327
329 328
@@ -472,9 +471,8 @@ struct mlx5_eqe_cmd {
472struct mlx5_eqe_page_req { 471struct mlx5_eqe_page_req {
473 u8 rsvd0[2]; 472 u8 rsvd0[2];
474 __be16 func_id; 473 __be16 func_id;
475 u8 rsvd1[2]; 474 __be32 num_pages;
476 __be16 num_pages; 475 __be32 rsvd1[5];
477 __be32 rsvd2[5];
478}; 476};
479 477
480union ev_data { 478union ev_data {
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 2aa258b0ced1..8888381fc150 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -358,7 +358,7 @@ struct mlx5_caps {
358 u32 reserved_lkey; 358 u32 reserved_lkey;
359 u8 local_ca_ack_delay; 359 u8 local_ca_ack_delay;
360 u8 log_max_mcg; 360 u8 log_max_mcg;
361 u16 max_qp_mcg; 361 u32 max_qp_mcg;
362 int min_page_sz; 362 int min_page_sz;
363}; 363};
364 364
@@ -691,7 +691,7 @@ void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev);
691int mlx5_pagealloc_start(struct mlx5_core_dev *dev); 691int mlx5_pagealloc_start(struct mlx5_core_dev *dev);
692void mlx5_pagealloc_stop(struct mlx5_core_dev *dev); 692void mlx5_pagealloc_stop(struct mlx5_core_dev *dev);
693void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, 693void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id,
694 s16 npages); 694 s32 npages);
695int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot); 695int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot);
696int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev); 696int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev);
697void mlx5_register_debugfs(void); 697void mlx5_register_debugfs(void);
@@ -731,9 +731,6 @@ void mlx5_cq_debugfs_cleanup(struct mlx5_core_dev *dev);
731int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db); 731int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db);
732void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db); 732void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db);
733 733
734typedef void (*health_handler_t)(struct pci_dev *pdev, struct health_buffer __iomem *buf, int size);
735int mlx5_register_health_report_handler(health_handler_t handler);
736void mlx5_unregister_health_report_handler(void);
737const char *mlx5_command_str(int command); 734const char *mlx5_command_str(int command);
738int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev); 735int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev);
739void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev); 736void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index fb425aa16c01..faf4b7c1ad12 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -332,6 +332,7 @@ struct mm_struct {
332 unsigned long pgoff, unsigned long flags); 332 unsigned long pgoff, unsigned long flags);
333#endif 333#endif
334 unsigned long mmap_base; /* base of mmap area */ 334 unsigned long mmap_base; /* base of mmap area */
335 unsigned long mmap_legacy_base; /* base of mmap area in bottom-up allocations */
335 unsigned long task_size; /* size of task vm space */ 336 unsigned long task_size; /* size of task vm space */
336 unsigned long highest_vm_end; /* highest vma end address */ 337 unsigned long highest_vm_end; /* highest vma end address */
337 pgd_t * pgd; 338 pgd_t * pgd;
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 4e2cbfa640b7..58b9a02c38d2 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -98,8 +98,17 @@
98typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t; 98typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t;
99extern nodemask_t _unused_nodemask_arg_; 99extern nodemask_t _unused_nodemask_arg_;
100 100
101/*
102 * The inline keyword gives the compiler room to decide to inline, or
103 * not inline a function as it sees best. However, as these functions
104 * are called in both __init and non-__init functions, if they are not
105 * inlined we will end up with a section mis-match error (of the type of
106 * freeable items not being freed). So we must use __always_inline here
107 * to fix the problem. If other functions in the future also end up in
108 * this situation they will also need to be annotated as __always_inline
109 */
101#define node_set(node, dst) __node_set((node), &(dst)) 110#define node_set(node, dst) __node_set((node), &(dst))
102static inline void __node_set(int node, volatile nodemask_t *dstp) 111static __always_inline void __node_set(int node, volatile nodemask_t *dstp)
103{ 112{
104 set_bit(node, dstp->bits); 113 set_bit(node, dstp->bits);
105} 114}
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index 10e5947491c7..b4ec59d159ac 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -14,6 +14,10 @@ struct fs_struct;
14 * A structure to contain pointers to all per-process 14 * A structure to contain pointers to all per-process
15 * namespaces - fs (mount), uts, network, sysvipc, etc. 15 * namespaces - fs (mount), uts, network, sysvipc, etc.
16 * 16 *
17 * The pid namespace is an exception -- it's accessed using
18 * task_active_pid_ns. The pid namespace here is the
19 * namespace that children will use.
20 *
17 * 'count' is the number of tasks holding a reference. 21 * 'count' is the number of tasks holding a reference.
18 * The count for each namespace, then, will be the number 22 * The count for each namespace, then, will be the number
19 * of nsproxies pointing to it, not the number of tasks. 23 * of nsproxies pointing to it, not the number of tasks.
@@ -27,7 +31,7 @@ struct nsproxy {
27 struct uts_namespace *uts_ns; 31 struct uts_namespace *uts_ns;
28 struct ipc_namespace *ipc_ns; 32 struct ipc_namespace *ipc_ns;
29 struct mnt_namespace *mnt_ns; 33 struct mnt_namespace *mnt_ns;
30 struct pid_namespace *pid_ns; 34 struct pid_namespace *pid_ns_for_children;
31 struct net *net_ns; 35 struct net *net_ns;
32}; 36};
33extern struct nsproxy init_nsproxy; 37extern struct nsproxy init_nsproxy;
diff --git a/include/linux/of.h b/include/linux/of.h
index 1fd08ca23106..3a45c4f593ad 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -266,6 +266,7 @@ extern int of_device_is_available(const struct device_node *device);
266extern const void *of_get_property(const struct device_node *node, 266extern const void *of_get_property(const struct device_node *node,
267 const char *name, 267 const char *name,
268 int *lenp); 268 int *lenp);
269extern struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
269#define for_each_property_of_node(dn, pp) \ 270#define for_each_property_of_node(dn, pp) \
270 for (pp = dn->properties; pp != NULL; pp = pp->next) 271 for (pp = dn->properties; pp != NULL; pp = pp->next)
271 272
@@ -343,6 +344,8 @@ const char *of_prop_next_string(struct property *prop, const char *cur);
343 s; \ 344 s; \
344 s = of_prop_next_string(prop, s)) 345 s = of_prop_next_string(prop, s))
345 346
347int of_device_is_stdout_path(struct device_node *dn);
348
346#else /* CONFIG_OF */ 349#else /* CONFIG_OF */
347 350
348static inline const char* of_node_full_name(struct device_node *np) 351static inline const char* of_node_full_name(struct device_node *np)
@@ -459,6 +462,12 @@ static inline const void *of_get_property(const struct device_node *node,
459 return NULL; 462 return NULL;
460} 463}
461 464
465static inline struct device_node *of_get_cpu_node(int cpu,
466 unsigned int *thread)
467{
468 return NULL;
469}
470
462static inline int of_property_read_u64(const struct device_node *np, 471static inline int of_property_read_u64(const struct device_node *np,
463 const char *propname, u64 *out_value) 472 const char *propname, u64 *out_value)
464{ 473{
@@ -505,6 +514,11 @@ static inline int of_machine_is_compatible(const char *compat)
505 return 0; 514 return 0;
506} 515}
507 516
517static inline int of_device_is_stdout_path(struct device_node *dn)
518{
519 return 0;
520}
521
508#define of_match_ptr(_ptr) NULL 522#define of_match_ptr(_ptr) NULL
509#define of_match_node(_matches, _node) NULL 523#define of_match_node(_matches, _node) NULL
510#define of_property_for_each_u32(np, propname, prop, p, u) \ 524#define of_property_for_each_u32(np, propname, prop, p, u) \
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 9d27475feec1..82ce324fdce7 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_OF_DEVICE_H 1#ifndef _LINUX_OF_DEVICE_H
2#define _LINUX_OF_DEVICE_H 2#define _LINUX_OF_DEVICE_H
3 3
4#include <linux/cpu.h>
4#include <linux/platform_device.h> 5#include <linux/platform_device.h>
5#include <linux/of_platform.h> /* temporary until merge */ 6#include <linux/of_platform.h> /* temporary until merge */
6 7
@@ -43,6 +44,15 @@ static inline void of_device_node_put(struct device *dev)
43 of_node_put(dev->of_node); 44 of_node_put(dev->of_node);
44} 45}
45 46
47static inline struct device_node *of_cpu_device_node_get(int cpu)
48{
49 struct device *cpu_dev;
50 cpu_dev = get_cpu_device(cpu);
51 if (!cpu_dev)
52 return NULL;
53 return of_node_get(cpu_dev->of_node);
54}
55
46#else /* CONFIG_OF */ 56#else /* CONFIG_OF */
47 57
48static inline int of_driver_match_device(struct device *dev, 58static inline int of_driver_match_device(struct device *dev,
@@ -67,6 +77,11 @@ static inline const struct of_device_id *of_match_device(
67{ 77{
68 return NULL; 78 return NULL;
69} 79}
80
81static inline struct device_node *of_cpu_device_node_get(int cpu)
82{
83 return NULL;
84}
70#endif /* CONFIG_OF */ 85#endif /* CONFIG_OF */
71 86
72#endif /* _LINUX_OF_DEVICE_H */ 87#endif /* _LINUX_OF_DEVICE_H */
diff --git a/include/linux/olpc-ec.h b/include/linux/olpc-ec.h
index 5bb6e760aa61..2925df3ce78a 100644
--- a/include/linux/olpc-ec.h
+++ b/include/linux/olpc-ec.h
@@ -6,6 +6,7 @@
6#define EC_WRITE_SCI_MASK 0x1b 6#define EC_WRITE_SCI_MASK 0x1b
7#define EC_WAKE_UP_WLAN 0x24 7#define EC_WAKE_UP_WLAN 0x24
8#define EC_WLAN_LEAVE_RESET 0x25 8#define EC_WLAN_LEAVE_RESET 0x25
9#define EC_DCON_POWER_MODE 0x26
9#define EC_READ_EB_MODE 0x2a 10#define EC_READ_EB_MODE 0x2a
10#define EC_SET_SCI_INHIBIT 0x32 11#define EC_SET_SCI_INHIBIT 0x32
11#define EC_SET_SCI_INHIBIT_RELEASE 0x34 12#define EC_SET_SCI_INHIBIT_RELEASE 0x34
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 170447977278..d006f0ca60f4 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -47,24 +47,22 @@ void acpi_pci_remove_bus(struct pci_bus *bus);
47 47
48#ifdef CONFIG_ACPI_PCI_SLOT 48#ifdef CONFIG_ACPI_PCI_SLOT
49void acpi_pci_slot_init(void); 49void acpi_pci_slot_init(void);
50void acpi_pci_slot_enumerate(struct pci_bus *bus, acpi_handle handle); 50void acpi_pci_slot_enumerate(struct pci_bus *bus);
51void acpi_pci_slot_remove(struct pci_bus *bus); 51void acpi_pci_slot_remove(struct pci_bus *bus);
52#else 52#else
53static inline void acpi_pci_slot_init(void) { } 53static inline void acpi_pci_slot_init(void) { }
54static inline void acpi_pci_slot_enumerate(struct pci_bus *bus, 54static inline void acpi_pci_slot_enumerate(struct pci_bus *bus) { }
55 acpi_handle handle) { }
56static inline void acpi_pci_slot_remove(struct pci_bus *bus) { } 55static inline void acpi_pci_slot_remove(struct pci_bus *bus) { }
57#endif 56#endif
58 57
59#ifdef CONFIG_HOTPLUG_PCI_ACPI 58#ifdef CONFIG_HOTPLUG_PCI_ACPI
60void acpiphp_init(void); 59void acpiphp_init(void);
61void acpiphp_enumerate_slots(struct pci_bus *bus, acpi_handle handle); 60void acpiphp_enumerate_slots(struct pci_bus *bus);
62void acpiphp_remove_slots(struct pci_bus *bus); 61void acpiphp_remove_slots(struct pci_bus *bus);
63void acpiphp_check_host_bridge(acpi_handle handle); 62void acpiphp_check_host_bridge(acpi_handle handle);
64#else 63#else
65static inline void acpiphp_init(void) { } 64static inline void acpiphp_init(void) { }
66static inline void acpiphp_enumerate_slots(struct pci_bus *bus, 65static inline void acpiphp_enumerate_slots(struct pci_bus *bus) { }
67 acpi_handle handle) { }
68static inline void acpiphp_remove_slots(struct pci_bus *bus) { } 66static inline void acpiphp_remove_slots(struct pci_bus *bus) { }
69static inline void acpiphp_check_host_bridge(acpi_handle handle) { } 67static inline void acpiphp_check_host_bridge(acpi_handle handle) { }
70#endif 68#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 0fd1f1582fa1..186540d74f36 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -675,7 +675,7 @@ struct pci_driver {
675/* these external functions are only available when PCI support is enabled */ 675/* these external functions are only available when PCI support is enabled */
676#ifdef CONFIG_PCI 676#ifdef CONFIG_PCI
677 677
678void pcie_bus_configure_settings(struct pci_bus *bus, u8 smpss); 678void pcie_bus_configure_settings(struct pci_bus *bus);
679 679
680enum pcie_bus_config_types { 680enum pcie_bus_config_types {
681 PCIE_BUS_TUNE_OFF, 681 PCIE_BUS_TUNE_OFF,
@@ -914,6 +914,7 @@ bool pci_check_and_unmask_intx(struct pci_dev *dev);
914void pci_msi_off(struct pci_dev *dev); 914void pci_msi_off(struct pci_dev *dev);
915int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size); 915int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size);
916int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask); 916int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask);
917int pci_wait_for_pending_transaction(struct pci_dev *dev);
917int pcix_get_max_mmrbc(struct pci_dev *dev); 918int pcix_get_max_mmrbc(struct pci_dev *dev);
918int pcix_get_mmrbc(struct pci_dev *dev); 919int pcix_get_mmrbc(struct pci_dev *dev);
919int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); 920int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
@@ -924,6 +925,11 @@ int pcie_set_mps(struct pci_dev *dev, int mps);
924int __pci_reset_function(struct pci_dev *dev); 925int __pci_reset_function(struct pci_dev *dev);
925int __pci_reset_function_locked(struct pci_dev *dev); 926int __pci_reset_function_locked(struct pci_dev *dev);
926int pci_reset_function(struct pci_dev *dev); 927int pci_reset_function(struct pci_dev *dev);
928int pci_probe_reset_slot(struct pci_slot *slot);
929int pci_reset_slot(struct pci_slot *slot);
930int pci_probe_reset_bus(struct pci_bus *bus);
931int pci_reset_bus(struct pci_bus *bus);
932void pci_reset_bridge_secondary_bus(struct pci_dev *dev);
927void pci_update_resource(struct pci_dev *dev, int resno); 933void pci_update_resource(struct pci_dev *dev, int resno);
928int __must_check pci_assign_resource(struct pci_dev *dev, int i); 934int __must_check pci_assign_resource(struct pci_dev *dev, int i);
929int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align); 935int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align);
@@ -1003,6 +1009,7 @@ int pci_claim_resource(struct pci_dev *, int);
1003void pci_assign_unassigned_resources(void); 1009void pci_assign_unassigned_resources(void);
1004void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); 1010void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge);
1005void pci_assign_unassigned_bus_resources(struct pci_bus *bus); 1011void pci_assign_unassigned_bus_resources(struct pci_bus *bus);
1012void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus);
1006void pdev_enable_device(struct pci_dev *); 1013void pdev_enable_device(struct pci_dev *);
1007int pci_enable_resources(struct pci_dev *, int mask); 1014int pci_enable_resources(struct pci_dev *, int mask);
1008void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), 1015void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
@@ -1043,7 +1050,6 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
1043 resource_size_t, 1050 resource_size_t,
1044 resource_size_t), 1051 resource_size_t),
1045 void *alignf_data); 1052 void *alignf_data);
1046void pci_enable_bridges(struct pci_bus *bus);
1047 1053
1048/* Proper probing supporting hot-pluggable devices */ 1054/* Proper probing supporting hot-pluggable devices */
1049int __must_check __pci_register_driver(struct pci_driver *, struct module *, 1055int __must_check __pci_register_driver(struct pci_driver *, struct module *,
@@ -1648,6 +1654,10 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev,
1648int pcibios_add_device(struct pci_dev *dev); 1654int pcibios_add_device(struct pci_dev *dev);
1649void pcibios_release_device(struct pci_dev *dev); 1655void pcibios_release_device(struct pci_dev *dev);
1650 1656
1657#ifdef CONFIG_HIBERNATE_CALLBACKS
1658extern struct dev_pm_ops pcibios_pm_ops;
1659#endif
1660
1651#ifdef CONFIG_PCI_MMCONFIG 1661#ifdef CONFIG_PCI_MMCONFIG
1652void __init pci_mmcfg_early_init(void); 1662void __init pci_mmcfg_early_init(void);
1653void __init pci_mmcfg_late_init(void); 1663void __init pci_mmcfg_late_init(void);
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 8db71dcd6337..bd32109e607e 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -63,6 +63,9 @@ enum pcie_link_width {
63 * @get_adapter_status: Called to get see if an adapter is present in the slot or not. 63 * @get_adapter_status: Called to get see if an adapter is present in the slot or not.
64 * If this field is NULL, the value passed in the struct hotplug_slot_info 64 * If this field is NULL, the value passed in the struct hotplug_slot_info
65 * will be used when this value is requested by a user. 65 * will be used when this value is requested by a user.
66 * @reset_slot: Optional interface to allow override of a bus reset for the
67 * slot for cases where a secondary bus reset can result in spurious
68 * hotplug events or where a slot can be reset independent of the bus.
66 * 69 *
67 * The table of function pointers that is passed to the hotplug pci core by a 70 * The table of function pointers that is passed to the hotplug pci core by a
68 * hotplug pci driver. These functions are called by the hotplug pci core when 71 * hotplug pci driver. These functions are called by the hotplug pci core when
@@ -80,6 +83,7 @@ struct hotplug_slot_ops {
80 int (*get_attention_status) (struct hotplug_slot *slot, u8 *value); 83 int (*get_attention_status) (struct hotplug_slot *slot, u8 *value);
81 int (*get_latch_status) (struct hotplug_slot *slot, u8 *value); 84 int (*get_latch_status) (struct hotplug_slot *slot, u8 *value);
82 int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value); 85 int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value);
86 int (*reset_slot) (struct hotplug_slot *slot, int probe);
83}; 87};
84 88
85/** 89/**
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 3bed2e89611b..6dec3d6abe0b 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1311,6 +1311,8 @@
1311#define PCI_DEVICE_ID_IMS_TT128 0x9128 1311#define PCI_DEVICE_ID_IMS_TT128 0x9128
1312#define PCI_DEVICE_ID_IMS_TT3D 0x9135 1312#define PCI_DEVICE_ID_IMS_TT3D 0x9135
1313 1313
1314#define PCI_VENDOR_ID_AMCC 0x10e8
1315
1314#define PCI_VENDOR_ID_INTERG 0x10ea 1316#define PCI_VENDOR_ID_INTERG 0x10ea
1315#define PCI_DEVICE_ID_INTERG_1682 0x1682 1317#define PCI_DEVICE_ID_INTERG_1682 0x1682
1316#define PCI_DEVICE_ID_INTERG_2000 0x2000 1318#define PCI_DEVICE_ID_INTERG_2000 0x2000
@@ -2256,12 +2258,10 @@
2256/* 2258/*
2257 * ADDI-DATA GmbH communication cards <info@addi-data.com> 2259 * ADDI-DATA GmbH communication cards <info@addi-data.com>
2258 */ 2260 */
2259#define PCI_VENDOR_ID_ADDIDATA_OLD 0x10E8
2260#define PCI_VENDOR_ID_ADDIDATA 0x15B8 2261#define PCI_VENDOR_ID_ADDIDATA 0x15B8
2261#define PCI_DEVICE_ID_ADDIDATA_APCI7500 0x7000 2262#define PCI_DEVICE_ID_ADDIDATA_APCI7500 0x7000
2262#define PCI_DEVICE_ID_ADDIDATA_APCI7420 0x7001 2263#define PCI_DEVICE_ID_ADDIDATA_APCI7420 0x7001
2263#define PCI_DEVICE_ID_ADDIDATA_APCI7300 0x7002 2264#define PCI_DEVICE_ID_ADDIDATA_APCI7300 0x7002
2264#define PCI_DEVICE_ID_ADDIDATA_APCI7800 0x818E
2265#define PCI_DEVICE_ID_ADDIDATA_APCI7500_2 0x7009 2265#define PCI_DEVICE_ID_ADDIDATA_APCI7500_2 0x7009
2266#define PCI_DEVICE_ID_ADDIDATA_APCI7420_2 0x700A 2266#define PCI_DEVICE_ID_ADDIDATA_APCI7420_2 0x700A
2267#define PCI_DEVICE_ID_ADDIDATA_APCI7300_2 0x700B 2267#define PCI_DEVICE_ID_ADDIDATA_APCI7300_2 0x700B
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index 27ef6b190ea6..57e890abe1f0 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -22,9 +22,12 @@
22 * Macro which verifies @ptr is a percpu pointer without evaluating 22 * Macro which verifies @ptr is a percpu pointer without evaluating
23 * @ptr. This is to be used in percpu accessors to verify that the 23 * @ptr. This is to be used in percpu accessors to verify that the
24 * input parameter is a percpu pointer. 24 * input parameter is a percpu pointer.
25 *
26 * + 0 is required in order to convert the pointer type from a
27 * potential array type to a pointer to a single item of the array.
25 */ 28 */
26#define __verify_pcpu_ptr(ptr) do { \ 29#define __verify_pcpu_ptr(ptr) do { \
27 const void __percpu *__vpp_verify = (typeof(ptr))NULL; \ 30 const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
28 (void)__vpp_verify; \ 31 (void)__vpp_verify; \
29} while (0) 32} while (0)
30 33
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index c43f6eabad5b..4019d82c3d03 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -64,30 +64,6 @@ struct perf_raw_record {
64}; 64};
65 65
66/* 66/*
67 * single taken branch record layout:
68 *
69 * from: source instruction (may not always be a branch insn)
70 * to: branch target
71 * mispred: branch target was mispredicted
72 * predicted: branch target was predicted
73 *
74 * support for mispred, predicted is optional. In case it
75 * is not supported mispred = predicted = 0.
76 *
77 * in_tx: running in a hardware transaction
78 * abort: aborting a hardware transaction
79 */
80struct perf_branch_entry {
81 __u64 from;
82 __u64 to;
83 __u64 mispred:1, /* target mispredicted */
84 predicted:1,/* target predicted */
85 in_tx:1, /* in transaction */
86 abort:1, /* transaction abort */
87 reserved:60;
88};
89
90/*
91 * branch stack layout: 67 * branch stack layout:
92 * nr: number of taken branches stored in entries[] 68 * nr: number of taken branches stored in entries[]
93 * 69 *
diff --git a/include/linux/platform_data/at91_adc.h b/include/linux/platform_data/at91_adc.h
index e15745b4f3a5..b3ca1e94e0c8 100644
--- a/include/linux/platform_data/at91_adc.h
+++ b/include/linux/platform_data/at91_adc.h
@@ -14,12 +14,16 @@
14 (Interruptions registers mostly) 14 (Interruptions registers mostly)
15 * @status_register: Offset of the Interrupt Status Register 15 * @status_register: Offset of the Interrupt Status Register
16 * @trigger_register: Offset of the Trigger setup register 16 * @trigger_register: Offset of the Trigger setup register
17 * @mr_prescal_mask: Mask of the PRESCAL field in the adc MR register
18 * @mr_startup_mask: Mask of the STARTUP field in the adc MR register
17 */ 19 */
18struct at91_adc_reg_desc { 20struct at91_adc_reg_desc {
19 u8 channel_base; 21 u8 channel_base;
20 u32 drdy_mask; 22 u32 drdy_mask;
21 u8 status_register; 23 u8 status_register;
22 u8 trigger_register; 24 u8 trigger_register;
25 u32 mr_prescal_mask;
26 u32 mr_startup_mask;
23}; 27};
24 28
25/** 29/**
diff --git a/include/linux/platform_data/efm32-spi.h b/include/linux/platform_data/efm32-spi.h
new file mode 100644
index 000000000000..31b19ca1d73a
--- /dev/null
+++ b/include/linux/platform_data/efm32-spi.h
@@ -0,0 +1,14 @@
1#ifndef __LINUX_PLATFORM_DATA_EFM32_SPI_H__
2#define __LINUX_PLATFORM_DATA_EFM32_SPI_H__
3
4#include <linux/types.h>
5
6/**
7 * struct efm32_spi_pdata
8 * @location: pinmux location for the I/O pins (to be written to the ROUTE
9 * register)
10 */
11struct efm32_spi_pdata {
12 u8 location;
13};
14#endif /* ifndef __LINUX_PLATFORM_DATA_EFM32_SPI_H__ */
diff --git a/include/linux/platform_data/max310x.h b/include/linux/platform_data/max310x.h
index 91648bf5fc5c..dd11dcd1a184 100644
--- a/include/linux/platform_data/max310x.h
+++ b/include/linux/platform_data/max310x.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Maxim (Dallas) MAX3107/8 serial driver 2 * Maxim (Dallas) MAX3107/8/9, MAX14830 serial driver
3 * 3 *
4 * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru> 4 * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru>
5 * 5 *
@@ -37,14 +37,13 @@
37 * }; 37 * };
38 */ 38 */
39 39
40#define MAX310X_MAX_UARTS 1 40#define MAX310X_MAX_UARTS 4
41 41
42/* MAX310X platform data structure */ 42/* MAX310X platform data structure */
43struct max310x_pdata { 43struct max310x_pdata {
44 /* Flags global to driver */ 44 /* Flags global to driver */
45 const u8 driver_flags:2; 45 const u8 driver_flags;
46#define MAX310X_EXT_CLK (0x00000001) /* External clock enable */ 46#define MAX310X_EXT_CLK (0x00000001) /* External clock enable */
47#define MAX310X_AUTOSLEEP (0x00000002) /* Enable AutoSleep mode */
48 /* Flags global to UART port */ 47 /* Flags global to UART port */
49 const u8 uart_flags[MAX310X_MAX_UARTS]; 48 const u8 uart_flags[MAX310X_MAX_UARTS];
50#define MAX310X_LOOPBACK (0x00000001) /* Loopback mode enable */ 49#define MAX310X_LOOPBACK (0x00000001) /* Loopback mode enable */
@@ -60,8 +59,6 @@ struct max310x_pdata {
60 void (*init)(void); 59 void (*init)(void);
61 /* Called before finish */ 60 /* Called before finish */
62 void (*exit)(void); 61 void (*exit)(void);
63 /* Suspend callback */
64 void (*suspend)(int do_suspend);
65}; 62};
66 63
67#endif 64#endif
diff --git a/include/linux/platform_data/serial-sccnxp.h b/include/linux/platform_data/serial-sccnxp.h
index bdc510d03245..af0c8c3b89ae 100644
--- a/include/linux/platform_data/serial-sccnxp.h
+++ b/include/linux/platform_data/serial-sccnxp.h
@@ -60,7 +60,6 @@
60 * }; 60 * };
61 * 61 *
62 * static struct sccnxp_pdata sc2892_info = { 62 * static struct sccnxp_pdata sc2892_info = {
63 * .frequency = 3686400,
64 * .mctrl_cfg[0] = MCTRL_SIG(DIR_OP, LINE_OP0), 63 * .mctrl_cfg[0] = MCTRL_SIG(DIR_OP, LINE_OP0),
65 * .mctrl_cfg[1] = MCTRL_SIG(DIR_OP, LINE_OP1), 64 * .mctrl_cfg[1] = MCTRL_SIG(DIR_OP, LINE_OP1),
66 * }; 65 * };
@@ -78,8 +77,6 @@
78 77
79/* SCCNXP platform data structure */ 78/* SCCNXP platform data structure */
80struct sccnxp_pdata { 79struct sccnxp_pdata {
81 /* Frequency (extrenal clock or crystal) */
82 int frequency;
83 /* Shift for A0 line */ 80 /* Shift for A0 line */
84 const u8 reg_shift; 81 const u8 reg_shift;
85 /* Modem control lines configuration */ 82 /* Modem control lines configuration */
diff --git a/include/linux/platform_data/simplefb.h b/include/linux/platform_data/simplefb.h
new file mode 100644
index 000000000000..53774b0cd8e9
--- /dev/null
+++ b/include/linux/platform_data/simplefb.h
@@ -0,0 +1,63 @@
1/*
2 * simplefb.h - Simple Framebuffer Device
3 *
4 * Copyright (C) 2013 David Herrmann <dh.herrmann@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef __PLATFORM_DATA_SIMPLEFB_H__
13#define __PLATFORM_DATA_SIMPLEFB_H__
14
15#include <drm/drm_fourcc.h>
16#include <linux/fb.h>
17#include <linux/kernel.h>
18
19/* format array, use it to initialize a "struct simplefb_format" array */
20#define SIMPLEFB_FORMATS \
21{ \
22 { "r5g6b5", 16, {11, 5}, {5, 6}, {0, 5}, {0, 0}, DRM_FORMAT_RGB565 }, \
23 { "x1r5g5b5", 16, {10, 5}, {5, 5}, {0, 5}, {0, 0}, DRM_FORMAT_XRGB1555 }, \
24 { "a1r5g5b5", 16, {10, 5}, {5, 5}, {0, 5}, {15, 1}, DRM_FORMAT_ARGB1555 }, \
25 { "r8g8b8", 24, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_RGB888 }, \
26 { "x8r8g8b8", 32, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_XRGB8888 }, \
27 { "a8r8g8b8", 32, {16, 8}, {8, 8}, {0, 8}, {24, 8}, DRM_FORMAT_ARGB8888 }, \
28 { "x2r10g10b10", 32, {20, 10}, {10, 10}, {0, 10}, {0, 0}, DRM_FORMAT_XRGB2101010 }, \
29 { "a2r10g10b10", 32, {20, 10}, {10, 10}, {0, 10}, {30, 2}, DRM_FORMAT_ARGB2101010 }, \
30}
31
32/*
33 * Data-Format for Simple-Framebuffers
34 * @name: unique 0-terminated name that can be used to identify the mode
35 * @red,green,blue: Offsets and sizes of the single RGB parts
36 * @transp: Offset and size of the alpha bits. length=0 means no alpha
37 * @fourcc: 32bit DRM four-CC code (see drm_fourcc.h)
38 */
39struct simplefb_format {
40 const char *name;
41 u32 bits_per_pixel;
42 struct fb_bitfield red;
43 struct fb_bitfield green;
44 struct fb_bitfield blue;
45 struct fb_bitfield transp;
46 u32 fourcc;
47};
48
49/*
50 * Simple-Framebuffer description
51 * If the arch-boot code creates simple-framebuffers without DT support, it
52 * can pass the width, height, stride and format via this platform-data object.
53 * The framebuffer location must be given as IORESOURCE_MEM resource.
54 * @format must be a format as described in "struct simplefb_format" above.
55 */
56struct simplefb_platform_data {
57 u32 width;
58 u32 height;
59 u32 stride;
60 const char *format;
61};
62
63#endif /* __PLATFORM_DATA_SIMPLEFB_H__ */
diff --git a/include/linux/platform_data/st_sensors_pdata.h b/include/linux/platform_data/st_sensors_pdata.h
new file mode 100644
index 000000000000..753839187ba0
--- /dev/null
+++ b/include/linux/platform_data/st_sensors_pdata.h
@@ -0,0 +1,24 @@
1/*
2 * STMicroelectronics sensors platform-data driver
3 *
4 * Copyright 2013 STMicroelectronics Inc.
5 *
6 * Denis Ciocca <denis.ciocca@st.com>
7 *
8 * Licensed under the GPL-2.
9 */
10
11#ifndef ST_SENSORS_PDATA_H
12#define ST_SENSORS_PDATA_H
13
14/**
15 * struct st_sensors_platform_data - Platform data for the ST sensors
16 * @drdy_int_pin: Redirect DRDY on pin 1 (1) or pin 2 (2).
17 * Available only for accelerometer and pressure sensors.
18 * Accelerometer DRDY on LSM330 available only on pin 1 (see datasheet).
19 */
20struct st_sensors_platform_data {
21 u8 drdy_int_pin;
22};
23
24#endif /* ST_SENSORS_PDATA_H */
diff --git a/include/linux/platform_data/tegra_usb.h b/include/linux/platform_data/tegra_usb.h
deleted file mode 100644
index 66c673fef408..000000000000
--- a/include/linux/platform_data/tegra_usb.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * Copyright (C) 2010 Google, Inc.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 */
14
15#ifndef _TEGRA_USB_H_
16#define _TEGRA_USB_H_
17
18enum tegra_usb_operating_modes {
19 TEGRA_USB_DEVICE,
20 TEGRA_USB_HOST,
21 TEGRA_USB_OTG,
22};
23
24struct tegra_ehci_platform_data {
25 enum tegra_usb_operating_modes operating_mode;
26 /* power down the phy on bus suspend */
27 int power_down_on_bus_suspend;
28 void *phy_config;
29 int vbus_gpio;
30};
31
32#endif /* _TEGRA_USB_H_ */
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
index 7db3eb93a079..1d2cd21242e8 100644
--- a/include/linux/pps_kernel.h
+++ b/include/linux/pps_kernel.h
@@ -80,7 +80,7 @@ struct pps_device {
80 * Global variables 80 * Global variables
81 */ 81 */
82 82
83extern struct device_attribute pps_attrs[]; 83extern const struct attribute_group *pps_groups[];
84 84
85/* 85/*
86 * Internal functions. 86 * Internal functions.
diff --git a/include/linux/preempt_mask.h b/include/linux/preempt_mask.h
new file mode 100644
index 000000000000..931bc616219f
--- /dev/null
+++ b/include/linux/preempt_mask.h
@@ -0,0 +1,122 @@
1#ifndef LINUX_PREEMPT_MASK_H
2#define LINUX_PREEMPT_MASK_H
3
4#include <linux/preempt.h>
5#include <asm/hardirq.h>
6
7/*
8 * We put the hardirq and softirq counter into the preemption
9 * counter. The bitmask has the following meaning:
10 *
11 * - bits 0-7 are the preemption count (max preemption depth: 256)
12 * - bits 8-15 are the softirq count (max # of softirqs: 256)
13 *
14 * The hardirq count can in theory reach the same as NR_IRQS.
15 * In reality, the number of nested IRQS is limited to the stack
16 * size as well. For archs with over 1000 IRQS it is not practical
17 * to expect that they will all nest. We give a max of 10 bits for
18 * hardirq nesting. An arch may choose to give less than 10 bits.
19 * m68k expects it to be 8.
20 *
21 * - bits 16-25 are the hardirq count (max # of nested hardirqs: 1024)
22 * - bit 26 is the NMI_MASK
23 * - bit 27 is the PREEMPT_ACTIVE flag
24 *
25 * PREEMPT_MASK: 0x000000ff
26 * SOFTIRQ_MASK: 0x0000ff00
27 * HARDIRQ_MASK: 0x03ff0000
28 * NMI_MASK: 0x04000000
29 */
30#define PREEMPT_BITS 8
31#define SOFTIRQ_BITS 8
32#define NMI_BITS 1
33
34#define MAX_HARDIRQ_BITS 10
35
36#ifndef HARDIRQ_BITS
37# define HARDIRQ_BITS MAX_HARDIRQ_BITS
38#endif
39
40#if HARDIRQ_BITS > MAX_HARDIRQ_BITS
41#error HARDIRQ_BITS too high!
42#endif
43
44#define PREEMPT_SHIFT 0
45#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS)
46#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS)
47#define NMI_SHIFT (HARDIRQ_SHIFT + HARDIRQ_BITS)
48
49#define __IRQ_MASK(x) ((1UL << (x))-1)
50
51#define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT)
52#define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT)
53#define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT)
54#define NMI_MASK (__IRQ_MASK(NMI_BITS) << NMI_SHIFT)
55
56#define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT)
57#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT)
58#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT)
59#define NMI_OFFSET (1UL << NMI_SHIFT)
60
61#define SOFTIRQ_DISABLE_OFFSET (2 * SOFTIRQ_OFFSET)
62
63#ifndef PREEMPT_ACTIVE
64#define PREEMPT_ACTIVE_BITS 1
65#define PREEMPT_ACTIVE_SHIFT (NMI_SHIFT + NMI_BITS)
66#define PREEMPT_ACTIVE (__IRQ_MASK(PREEMPT_ACTIVE_BITS) << PREEMPT_ACTIVE_SHIFT)
67#endif
68
69#if PREEMPT_ACTIVE < (1 << (NMI_SHIFT + NMI_BITS))
70#error PREEMPT_ACTIVE is too low!
71#endif
72
73#define hardirq_count() (preempt_count() & HARDIRQ_MASK)
74#define softirq_count() (preempt_count() & SOFTIRQ_MASK)
75#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK \
76 | NMI_MASK))
77
78/*
79 * Are we doing bottom half or hardware interrupt processing?
80 * Are we in a softirq context? Interrupt context?
81 * in_softirq - Are we currently processing softirq or have bh disabled?
82 * in_serving_softirq - Are we currently processing softirq?
83 */
84#define in_irq() (hardirq_count())
85#define in_softirq() (softirq_count())
86#define in_interrupt() (irq_count())
87#define in_serving_softirq() (softirq_count() & SOFTIRQ_OFFSET)
88
89/*
90 * Are we in NMI context?
91 */
92#define in_nmi() (preempt_count() & NMI_MASK)
93
94#if defined(CONFIG_PREEMPT_COUNT)
95# define PREEMPT_CHECK_OFFSET 1
96#else
97# define PREEMPT_CHECK_OFFSET 0
98#endif
99
100/*
101 * Are we running in atomic context? WARNING: this macro cannot
102 * always detect atomic context; in particular, it cannot know about
103 * held spinlocks in non-preemptible kernels. Thus it should not be
104 * used in the general case to determine whether sleeping is possible.
105 * Do not use in_atomic() in driver code.
106 */
107#define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0)
108
109/*
110 * Check whether we were atomic before we did preempt_disable():
111 * (used by the scheduler, *after* releasing the kernel lock)
112 */
113#define in_atomic_preempt_off() \
114 ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET)
115
116#ifdef CONFIG_PREEMPT_COUNT
117# define preemptible() (preempt_count() == 0 && !irqs_disabled())
118#else
119# define preemptible() 0
120#endif
121
122#endif /* LINUX_PREEMPT_MASK_H */
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 22c7052e9372..e6131a782481 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -200,7 +200,7 @@ static inline void show_regs_print_info(const char *log_lvl)
200} 200}
201#endif 201#endif
202 202
203extern void dump_stack(void) __cold; 203extern asmlinkage void dump_stack(void) __cold;
204 204
205#ifndef pr_fmt 205#ifndef pr_fmt
206#define pr_fmt(fmt) fmt 206#define pr_fmt(fmt) fmt
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 4aa80ba830a2..abd437d0a8a7 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -55,14 +55,14 @@ struct pstore_info {
55 int (*close)(struct pstore_info *psi); 55 int (*close)(struct pstore_info *psi);
56 ssize_t (*read)(u64 *id, enum pstore_type_id *type, 56 ssize_t (*read)(u64 *id, enum pstore_type_id *type,
57 int *count, struct timespec *time, char **buf, 57 int *count, struct timespec *time, char **buf,
58 struct pstore_info *psi); 58 bool *compressed, struct pstore_info *psi);
59 int (*write)(enum pstore_type_id type, 59 int (*write)(enum pstore_type_id type,
60 enum kmsg_dump_reason reason, u64 *id, 60 enum kmsg_dump_reason reason, u64 *id,
61 unsigned int part, int count, size_t hsize, 61 unsigned int part, int count, bool compressed,
62 size_t size, struct pstore_info *psi); 62 size_t size, struct pstore_info *psi);
63 int (*write_buf)(enum pstore_type_id type, 63 int (*write_buf)(enum pstore_type_id type,
64 enum kmsg_dump_reason reason, u64 *id, 64 enum kmsg_dump_reason reason, u64 *id,
65 unsigned int part, const char *buf, size_t hsize, 65 unsigned int part, const char *buf, bool compressed,
66 size_t size, struct pstore_info *psi); 66 size_t size, struct pstore_info *psi);
67 int (*erase)(enum pstore_type_id type, u64 id, 67 int (*erase)(enum pstore_type_id type, u64 id,
68 int count, struct timespec time, 68 int count, struct timespec time,
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index f4b1001a4676..4106721c4e5e 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -267,8 +267,9 @@ static inline void list_splice_init_rcu(struct list_head *list,
267 */ 267 */
268#define list_first_or_null_rcu(ptr, type, member) \ 268#define list_first_or_null_rcu(ptr, type, member) \
269 ({struct list_head *__ptr = (ptr); \ 269 ({struct list_head *__ptr = (ptr); \
270 struct list_head __rcu *__next = list_next_rcu(__ptr); \ 270 struct list_head *__next = ACCESS_ONCE(__ptr->next); \
271 likely(__ptr != __next) ? container_of(__next, type, member) : NULL; \ 271 likely(__ptr != __next) ? \
272 list_entry_rcu(__next, type, member) : NULL; \
272 }) 273 })
273 274
274/** 275/**
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 4b14bdc911d7..f1f1bc39346b 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -52,7 +52,7 @@ extern int rcutorture_runnable; /* for sysctl */
52#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 52#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
53extern void rcutorture_record_test_transition(void); 53extern void rcutorture_record_test_transition(void);
54extern void rcutorture_record_progress(unsigned long vernum); 54extern void rcutorture_record_progress(unsigned long vernum);
55extern void do_trace_rcu_torture_read(char *rcutorturename, 55extern void do_trace_rcu_torture_read(const char *rcutorturename,
56 struct rcu_head *rhp, 56 struct rcu_head *rhp,
57 unsigned long secs, 57 unsigned long secs,
58 unsigned long c_old, 58 unsigned long c_old,
@@ -65,7 +65,7 @@ static inline void rcutorture_record_progress(unsigned long vernum)
65{ 65{
66} 66}
67#ifdef CONFIG_RCU_TRACE 67#ifdef CONFIG_RCU_TRACE
68extern void do_trace_rcu_torture_read(char *rcutorturename, 68extern void do_trace_rcu_torture_read(const char *rcutorturename,
69 struct rcu_head *rhp, 69 struct rcu_head *rhp,
70 unsigned long secs, 70 unsigned long secs,
71 unsigned long c_old, 71 unsigned long c_old,
@@ -229,13 +229,9 @@ extern void rcu_irq_exit(void);
229#ifdef CONFIG_RCU_USER_QS 229#ifdef CONFIG_RCU_USER_QS
230extern void rcu_user_enter(void); 230extern void rcu_user_enter(void);
231extern void rcu_user_exit(void); 231extern void rcu_user_exit(void);
232extern void rcu_user_enter_after_irq(void);
233extern void rcu_user_exit_after_irq(void);
234#else 232#else
235static inline void rcu_user_enter(void) { } 233static inline void rcu_user_enter(void) { }
236static inline void rcu_user_exit(void) { } 234static inline void rcu_user_exit(void) { }
237static inline void rcu_user_enter_after_irq(void) { }
238static inline void rcu_user_exit_after_irq(void) { }
239static inline void rcu_user_hooks_switch(struct task_struct *prev, 235static inline void rcu_user_hooks_switch(struct task_struct *prev,
240 struct task_struct *next) { } 236 struct task_struct *next) { }
241#endif /* CONFIG_RCU_USER_QS */ 237#endif /* CONFIG_RCU_USER_QS */
@@ -1015,4 +1011,22 @@ static inline bool rcu_is_nocb_cpu(int cpu) { return false; }
1015#endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */ 1011#endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */
1016 1012
1017 1013
1014/* Only for use by adaptive-ticks code. */
1015#ifdef CONFIG_NO_HZ_FULL_SYSIDLE
1016extern bool rcu_sys_is_idle(void);
1017extern void rcu_sysidle_force_exit(void);
1018#else /* #ifdef CONFIG_NO_HZ_FULL_SYSIDLE */
1019
1020static inline bool rcu_sys_is_idle(void)
1021{
1022 return false;
1023}
1024
1025static inline void rcu_sysidle_force_exit(void)
1026{
1027}
1028
1029#endif /* #else #ifdef CONFIG_NO_HZ_FULL_SYSIDLE */
1030
1031
1018#endif /* __LINUX_RCUPDATE_H */ 1032#endif /* __LINUX_RCUPDATE_H */
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 75981d0b57dc..a10380bfbeac 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -15,6 +15,8 @@
15 15
16#include <linux/list.h> 16#include <linux/list.h>
17#include <linux/rbtree.h> 17#include <linux/rbtree.h>
18#include <linux/err.h>
19#include <linux/bug.h>
18 20
19struct module; 21struct module;
20struct device; 22struct device;
@@ -470,6 +472,9 @@ struct regmap_irq {
470 * @ack_base: Base ack address. If zero then the chip is clear on read. 472 * @ack_base: Base ack address. If zero then the chip is clear on read.
471 * @wake_base: Base address for wake enables. If zero unsupported. 473 * @wake_base: Base address for wake enables. If zero unsupported.
472 * @irq_reg_stride: Stride to use for chips where registers are not contiguous. 474 * @irq_reg_stride: Stride to use for chips where registers are not contiguous.
475 * @init_ack_masked: Ack all masked interrupts once during initalization.
476 * @mask_invert: Inverted mask register: cleared bits are masked out.
477 * @wake_invert: Inverted wake register: cleared bits are wake enabled.
473 * @runtime_pm: Hold a runtime PM lock on the device when accessing it. 478 * @runtime_pm: Hold a runtime PM lock on the device when accessing it.
474 * 479 *
475 * @num_regs: Number of registers in each control bank. 480 * @num_regs: Number of registers in each control bank.
@@ -485,9 +490,10 @@ struct regmap_irq_chip {
485 unsigned int ack_base; 490 unsigned int ack_base;
486 unsigned int wake_base; 491 unsigned int wake_base;
487 unsigned int irq_reg_stride; 492 unsigned int irq_reg_stride;
488 unsigned int mask_invert; 493 bool init_ack_masked:1;
489 unsigned int wake_invert; 494 bool mask_invert:1;
490 bool runtime_pm; 495 bool wake_invert:1;
496 bool runtime_pm:1;
491 497
492 int num_regs; 498 int num_regs;
493 499
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 3a76389c6aaa..27be915caa96 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -137,6 +137,12 @@ struct regulator *__must_check devm_regulator_get(struct device *dev,
137 const char *id); 137 const char *id);
138struct regulator *__must_check regulator_get_exclusive(struct device *dev, 138struct regulator *__must_check regulator_get_exclusive(struct device *dev,
139 const char *id); 139 const char *id);
140struct regulator *__must_check devm_regulator_get_exclusive(struct device *dev,
141 const char *id);
142struct regulator *__must_check regulator_get_optional(struct device *dev,
143 const char *id);
144struct regulator *__must_check devm_regulator_get_optional(struct device *dev,
145 const char *id);
140void regulator_put(struct regulator *regulator); 146void regulator_put(struct regulator *regulator);
141void devm_regulator_put(struct regulator *regulator); 147void devm_regulator_put(struct regulator *regulator);
142 148
@@ -217,6 +223,25 @@ devm_regulator_get(struct device *dev, const char *id)
217 return NULL; 223 return NULL;
218} 224}
219 225
226static inline struct regulator *__must_check
227regulator_get_exclusive(struct device *dev, const char *id)
228{
229 return NULL;
230}
231
232static inline struct regulator *__must_check
233regulator_get_optional(struct device *dev, const char *id)
234{
235 return NULL;
236}
237
238
239static inline struct regulator *__must_check
240devm_regulator_get_optional(struct device *dev, const char *id)
241{
242 return NULL;
243}
244
220static inline void regulator_put(struct regulator *regulator) 245static inline void regulator_put(struct regulator *regulator)
221{ 246{
222} 247}
@@ -369,8 +394,11 @@ static inline int regulator_count_voltages(struct regulator *regulator)
369static inline int regulator_set_voltage_tol(struct regulator *regulator, 394static inline int regulator_set_voltage_tol(struct regulator *regulator,
370 int new_uV, int tol_uV) 395 int new_uV, int tol_uV)
371{ 396{
372 return regulator_set_voltage(regulator, 397 if (regulator_set_voltage(regulator, new_uV, new_uV + tol_uV) == 0)
373 new_uV - tol_uV, new_uV + tol_uV); 398 return 0;
399 else
400 return regulator_set_voltage(regulator,
401 new_uV - tol_uV, new_uV + tol_uV);
374} 402}
375 403
376static inline int regulator_is_supported_voltage_tol(struct regulator *regulator, 404static inline int regulator_is_supported_voltage_tol(struct regulator *regulator,
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 6700cc94bdd1..67e13aa5a478 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -40,6 +40,24 @@ enum regulator_status {
40}; 40};
41 41
42/** 42/**
43 * Specify a range of voltages for regulator_map_linar_range() and
44 * regulator_list_linear_range().
45 *
46 * @min_uV: Lowest voltage in range
47 * @max_uV: Highest voltage in range
48 * @min_sel: Lowest selector for range
49 * @max_sel: Highest selector for range
50 * @uV_step: Step size
51 */
52struct regulator_linear_range {
53 unsigned int min_uV;
54 unsigned int max_uV;
55 unsigned int min_sel;
56 unsigned int max_sel;
57 unsigned int uV_step;
58};
59
60/**
43 * struct regulator_ops - regulator operations. 61 * struct regulator_ops - regulator operations.
44 * 62 *
45 * @enable: Configure the regulator as enabled. 63 * @enable: Configure the regulator as enabled.
@@ -223,6 +241,9 @@ struct regulator_desc {
223 unsigned int linear_min_sel; 241 unsigned int linear_min_sel;
224 unsigned int ramp_delay; 242 unsigned int ramp_delay;
225 243
244 const struct regulator_linear_range *linear_ranges;
245 int n_linear_ranges;
246
226 const unsigned int *volt_table; 247 const unsigned int *volt_table;
227 248
228 unsigned int vsel_reg; 249 unsigned int vsel_reg;
@@ -326,10 +347,14 @@ int regulator_mode_to_status(unsigned int);
326 347
327int regulator_list_voltage_linear(struct regulator_dev *rdev, 348int regulator_list_voltage_linear(struct regulator_dev *rdev,
328 unsigned int selector); 349 unsigned int selector);
350int regulator_list_voltage_linear_range(struct regulator_dev *rdev,
351 unsigned int selector);
329int regulator_list_voltage_table(struct regulator_dev *rdev, 352int regulator_list_voltage_table(struct regulator_dev *rdev,
330 unsigned int selector); 353 unsigned int selector);
331int regulator_map_voltage_linear(struct regulator_dev *rdev, 354int regulator_map_voltage_linear(struct regulator_dev *rdev,
332 int min_uV, int max_uV); 355 int min_uV, int max_uV);
356int regulator_map_voltage_linear_range(struct regulator_dev *rdev,
357 int min_uV, int max_uV);
333int regulator_map_voltage_iterate(struct regulator_dev *rdev, 358int regulator_map_voltage_iterate(struct regulator_dev *rdev,
334 int min_uV, int max_uV); 359 int min_uV, int max_uV);
335int regulator_map_voltage_ascend(struct regulator_dev *rdev, 360int regulator_map_voltage_ascend(struct regulator_dev *rdev,
diff --git a/include/linux/regulator/fan53555.h b/include/linux/regulator/fan53555.h
index 5c45c85d52ca..f13880e84d85 100644
--- a/include/linux/regulator/fan53555.h
+++ b/include/linux/regulator/fan53555.h
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#ifndef __FAN53555_H__ 13#ifndef __FAN53555_H__
14#define __FAN53555_H__
14 15
15/* VSEL ID */ 16/* VSEL ID */
16enum { 17enum {
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 36adbc82de6a..999b20ce06cf 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -134,6 +134,7 @@ struct regulation_constraints {
134 unsigned always_on:1; /* regulator never off when system is on */ 134 unsigned always_on:1; /* regulator never off when system is on */
135 unsigned boot_on:1; /* bootloader/firmware enabled regulator */ 135 unsigned boot_on:1; /* bootloader/firmware enabled regulator */
136 unsigned apply_uV:1; /* apply uV constraint if min == max */ 136 unsigned apply_uV:1; /* apply uV constraint if min == max */
137 unsigned ramp_disable:1; /* disable ramp delay */
137}; 138};
138 139
139/** 140/**
diff --git a/include/linux/regulator/max8660.h b/include/linux/regulator/max8660.h
index 9936763621c7..f8a6a4844864 100644
--- a/include/linux/regulator/max8660.h
+++ b/include/linux/regulator/max8660.h
@@ -39,7 +39,7 @@ enum {
39 */ 39 */
40struct max8660_subdev_data { 40struct max8660_subdev_data {
41 int id; 41 int id;
42 char *name; 42 const char *name;
43 struct regulator_init_data *platform_data; 43 struct regulator_init_data *platform_data;
44}; 44};
45 45
diff --git a/include/linux/regulator/pfuze100.h b/include/linux/regulator/pfuze100.h
new file mode 100644
index 000000000000..65d550bf3954
--- /dev/null
+++ b/include/linux/regulator/pfuze100.h
@@ -0,0 +1,44 @@
1/*
2 * Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18#ifndef __LINUX_REG_PFUZE100_H
19#define __LINUX_REG_PFUZE100_H
20
21#define PFUZE100_SW1AB 0
22#define PFUZE100_SW1C 1
23#define PFUZE100_SW2 2
24#define PFUZE100_SW3A 3
25#define PFUZE100_SW3B 4
26#define PFUZE100_SW4 5
27#define PFUZE100_SWBST 6
28#define PFUZE100_VSNVS 7
29#define PFUZE100_VREFDDR 8
30#define PFUZE100_VGEN1 9
31#define PFUZE100_VGEN2 10
32#define PFUZE100_VGEN3 11
33#define PFUZE100_VGEN4 12
34#define PFUZE100_VGEN5 13
35#define PFUZE100_VGEN6 14
36#define PFUZE100_MAX_REGULATOR 15
37
38struct regulator_init_data;
39
40struct pfuze_regulator_platform_data {
41 struct regulator_init_data *init_data[PFUZE100_MAX_REGULATOR];
42};
43
44#endif /* __LINUX_REG_PFUZE100_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index d722490da030..f79ced719435 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1034,6 +1034,9 @@ struct task_struct {
1034#ifdef CONFIG_SMP 1034#ifdef CONFIG_SMP
1035 struct llist_node wake_entry; 1035 struct llist_node wake_entry;
1036 int on_cpu; 1036 int on_cpu;
1037 struct task_struct *last_wakee;
1038 unsigned long wakee_flips;
1039 unsigned long wakee_flip_decay_ts;
1037#endif 1040#endif
1038 int on_rq; 1041 int on_rq;
1039 1042
@@ -1532,6 +1535,8 @@ static inline pid_t task_pgrp_nr(struct task_struct *tsk)
1532 * Test if a process is not yet dead (at most zombie state) 1535 * Test if a process is not yet dead (at most zombie state)
1533 * If pid_alive fails, then pointers within the task structure 1536 * If pid_alive fails, then pointers within the task structure
1534 * can be stale and must not be dereferenced. 1537 * can be stale and must not be dereferenced.
1538 *
1539 * Return: 1 if the process is alive. 0 otherwise.
1535 */ 1540 */
1536static inline int pid_alive(struct task_struct *p) 1541static inline int pid_alive(struct task_struct *p)
1537{ 1542{
@@ -1543,6 +1548,8 @@ static inline int pid_alive(struct task_struct *p)
1543 * @tsk: Task structure to be checked. 1548 * @tsk: Task structure to be checked.
1544 * 1549 *
1545 * Check if a task structure is the first user space task the kernel created. 1550 * Check if a task structure is the first user space task the kernel created.
1551 *
1552 * Return: 1 if the task structure is init. 0 otherwise.
1546 */ 1553 */
1547static inline int is_global_init(struct task_struct *tsk) 1554static inline int is_global_init(struct task_struct *tsk)
1548{ 1555{
@@ -1894,6 +1901,8 @@ extern struct task_struct *idle_task(int cpu);
1894/** 1901/**
1895 * is_idle_task - is the specified task an idle task? 1902 * is_idle_task - is the specified task an idle task?
1896 * @p: the task in question. 1903 * @p: the task in question.
1904 *
1905 * Return: 1 if @p is an idle task. 0 otherwise.
1897 */ 1906 */
1898static inline bool is_idle_task(const struct task_struct *p) 1907static inline bool is_idle_task(const struct task_struct *p)
1899{ 1908{
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 28e440be1c07..887116dbce2c 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -74,7 +74,7 @@ struct spi_device {
74 struct spi_master *master; 74 struct spi_master *master;
75 u32 max_speed_hz; 75 u32 max_speed_hz;
76 u8 chip_select; 76 u8 chip_select;
77 u8 mode; 77 u16 mode;
78#define SPI_CPHA 0x01 /* clock phase */ 78#define SPI_CPHA 0x01 /* clock phase */
79#define SPI_CPOL 0x02 /* clock polarity */ 79#define SPI_CPOL 0x02 /* clock polarity */
80#define SPI_MODE_0 (0|0) /* (original MicroWire) */ 80#define SPI_MODE_0 (0|0) /* (original MicroWire) */
@@ -87,6 +87,10 @@ struct spi_device {
87#define SPI_LOOP 0x20 /* loopback mode */ 87#define SPI_LOOP 0x20 /* loopback mode */
88#define SPI_NO_CS 0x40 /* 1 dev/bus, no chipselect */ 88#define SPI_NO_CS 0x40 /* 1 dev/bus, no chipselect */
89#define SPI_READY 0x80 /* slave pulls low to pause */ 89#define SPI_READY 0x80 /* slave pulls low to pause */
90#define SPI_TX_DUAL 0x100 /* transmit with 2 wires */
91#define SPI_TX_QUAD 0x200 /* transmit with 4 wires */
92#define SPI_RX_DUAL 0x400 /* receive with 2 wires */
93#define SPI_RX_QUAD 0x800 /* receive with 4 wires */
90 u8 bits_per_word; 94 u8 bits_per_word;
91 int irq; 95 int irq;
92 void *controller_state; 96 void *controller_state;
@@ -233,6 +237,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
233 * suported. If set, the SPI core will reject any transfer with an 237 * suported. If set, the SPI core will reject any transfer with an
234 * unsupported bits_per_word. If not set, this value is simply ignored, 238 * unsupported bits_per_word. If not set, this value is simply ignored,
235 * and it's up to the individual driver to perform any validation. 239 * and it's up to the individual driver to perform any validation.
240 * @min_speed_hz: Lowest supported transfer speed
241 * @max_speed_hz: Highest supported transfer speed
236 * @flags: other constraints relevant to this driver 242 * @flags: other constraints relevant to this driver
237 * @bus_lock_spinlock: spinlock for SPI bus locking 243 * @bus_lock_spinlock: spinlock for SPI bus locking
238 * @bus_lock_mutex: mutex for SPI bus locking 244 * @bus_lock_mutex: mutex for SPI bus locking
@@ -254,6 +260,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
254 * @busy: message pump is busy 260 * @busy: message pump is busy
255 * @running: message pump is running 261 * @running: message pump is running
256 * @rt: whether this queue is set to run as a realtime task 262 * @rt: whether this queue is set to run as a realtime task
263 * @auto_runtime_pm: the core should ensure a runtime PM reference is held
264 * while the hardware is prepared, using the parent
265 * device for the spidev
257 * @prepare_transfer_hardware: a message will soon arrive from the queue 266 * @prepare_transfer_hardware: a message will soon arrive from the queue
258 * so the subsystem requests the driver to prepare the transfer hardware 267 * so the subsystem requests the driver to prepare the transfer hardware
259 * by issuing this call 268 * by issuing this call
@@ -309,9 +318,13 @@ struct spi_master {
309 /* bitmask of supported bits_per_word for transfers */ 318 /* bitmask of supported bits_per_word for transfers */
310 u32 bits_per_word_mask; 319 u32 bits_per_word_mask;
311#define SPI_BPW_MASK(bits) BIT((bits) - 1) 320#define SPI_BPW_MASK(bits) BIT((bits) - 1)
312#define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0UL : (BIT(bits) - 1)) 321#define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0U : (BIT(bits) - 1))
313#define SPI_BPW_RANGE_MASK(min, max) (SPI_BIT_MASK(max) - SPI_BIT_MASK(min - 1)) 322#define SPI_BPW_RANGE_MASK(min, max) (SPI_BIT_MASK(max) - SPI_BIT_MASK(min - 1))
314 323
324 /* limits on transfer speed */
325 u32 min_speed_hz;
326 u32 max_speed_hz;
327
315 /* other constraints relevant to this driver */ 328 /* other constraints relevant to this driver */
316 u16 flags; 329 u16 flags;
317#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */ 330#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */
@@ -374,11 +387,13 @@ struct spi_master {
374 bool busy; 387 bool busy;
375 bool running; 388 bool running;
376 bool rt; 389 bool rt;
390 bool auto_runtime_pm;
377 391
378 int (*prepare_transfer_hardware)(struct spi_master *master); 392 int (*prepare_transfer_hardware)(struct spi_master *master);
379 int (*transfer_one_message)(struct spi_master *master, 393 int (*transfer_one_message)(struct spi_master *master,
380 struct spi_message *mesg); 394 struct spi_message *mesg);
381 int (*unprepare_transfer_hardware)(struct spi_master *master); 395 int (*unprepare_transfer_hardware)(struct spi_master *master);
396
382 /* gpio chip select */ 397 /* gpio chip select */
383 int *cs_gpios; 398 int *cs_gpios;
384}; 399};
@@ -448,6 +463,10 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
448 * @rx_buf: data to be read (dma-safe memory), or NULL 463 * @rx_buf: data to be read (dma-safe memory), or NULL
449 * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped 464 * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped
450 * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped 465 * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped
466 * @tx_nbits: number of bits used for writting. If 0 the default
467 * (SPI_NBITS_SINGLE) is used.
468 * @rx_nbits: number of bits used for reading. If 0 the default
469 * (SPI_NBITS_SINGLE) is used.
451 * @len: size of rx and tx buffers (in bytes) 470 * @len: size of rx and tx buffers (in bytes)
452 * @speed_hz: Select a speed other than the device default for this 471 * @speed_hz: Select a speed other than the device default for this
453 * transfer. If 0 the default (from @spi_device) is used. 472 * transfer. If 0 the default (from @spi_device) is used.
@@ -502,6 +521,11 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
502 * by the results of previous messages and where the whole transaction 521 * by the results of previous messages and where the whole transaction
503 * ends when the chipselect goes intactive. 522 * ends when the chipselect goes intactive.
504 * 523 *
524 * When SPI can transfer in 1x,2x or 4x. It can get this tranfer information
525 * from device through @tx_nbits and @rx_nbits. In Bi-direction, these
526 * two should both be set. User can set transfer mode with SPI_NBITS_SINGLE(1x)
527 * SPI_NBITS_DUAL(2x) and SPI_NBITS_QUAD(4x) to support these three transfer.
528 *
505 * The code that submits an spi_message (and its spi_transfers) 529 * The code that submits an spi_message (and its spi_transfers)
506 * to the lower layers is responsible for managing its memory. 530 * to the lower layers is responsible for managing its memory.
507 * Zero-initialize every field you don't set up explicitly, to 531 * Zero-initialize every field you don't set up explicitly, to
@@ -522,6 +546,11 @@ struct spi_transfer {
522 dma_addr_t rx_dma; 546 dma_addr_t rx_dma;
523 547
524 unsigned cs_change:1; 548 unsigned cs_change:1;
549 u8 tx_nbits;
550 u8 rx_nbits;
551#define SPI_NBITS_SINGLE 0x01 /* 1bit transfer */
552#define SPI_NBITS_DUAL 0x02 /* 2bits transfer */
553#define SPI_NBITS_QUAD 0x04 /* 4bits transfer */
525 u8 bits_per_word; 554 u8 bits_per_word;
526 u16 delay_usecs; 555 u16 delay_usecs;
527 u32 speed_hz; 556 u32 speed_hz;
@@ -578,6 +607,7 @@ struct spi_message {
578 /* completion is reported through a callback */ 607 /* completion is reported through a callback */
579 void (*complete)(void *context); 608 void (*complete)(void *context);
580 void *context; 609 void *context;
610 unsigned frame_length;
581 unsigned actual_length; 611 unsigned actual_length;
582 int status; 612 int status;
583 613
@@ -869,7 +899,7 @@ struct spi_board_info {
869 /* mode becomes spi_device.mode, and is essential for chips 899 /* mode becomes spi_device.mode, and is essential for chips
870 * where the default of SPI_CS_HIGH = 0 is wrong. 900 * where the default of SPI_CS_HIGH = 0 is wrong.
871 */ 901 */
872 u8 mode; 902 u16 mode;
873 903
874 /* ... may need additional spi_device chip config data here. 904 /* ... may need additional spi_device chip config data here.
875 * avoid stuff protocol drivers can set; but include stuff 905 * avoid stuff protocol drivers can set; but include stuff
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
index f987a2bee16a..daebaba886aa 100644
--- a/include/linux/spi/spi_bitbang.h
+++ b/include/linux/spi/spi_bitbang.h
@@ -4,11 +4,7 @@
4#include <linux/workqueue.h> 4#include <linux/workqueue.h>
5 5
6struct spi_bitbang { 6struct spi_bitbang {
7 struct workqueue_struct *workqueue;
8 struct work_struct work;
9
10 spinlock_t lock; 7 spinlock_t lock;
11 struct list_head queue;
12 u8 busy; 8 u8 busy;
13 u8 use_dma; 9 u8 use_dma;
14 u8 flags; /* extra spi->mode support */ 10 u8 flags; /* extra spi->mode support */
@@ -41,7 +37,6 @@ struct spi_bitbang {
41 */ 37 */
42extern int spi_bitbang_setup(struct spi_device *spi); 38extern int spi_bitbang_setup(struct spi_device *spi);
43extern void spi_bitbang_cleanup(struct spi_device *spi); 39extern void spi_bitbang_cleanup(struct spi_device *spi);
44extern int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m);
45extern int spi_bitbang_setup_transfer(struct spi_device *spi, 40extern int spi_bitbang_setup_transfer(struct spi_device *spi,
46 struct spi_transfer *t); 41 struct spi_transfer *t);
47 42
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 7d537ced949a..75f34949d9ab 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -117,9 +117,17 @@ do { \
117#endif /*arch_spin_is_contended*/ 117#endif /*arch_spin_is_contended*/
118#endif 118#endif
119 119
120/* The lock does not imply full memory barrier. */ 120/*
121#ifndef ARCH_HAS_SMP_MB_AFTER_LOCK 121 * Despite its name it doesn't necessarily has to be a full barrier.
122static inline void smp_mb__after_lock(void) { smp_mb(); } 122 * It should only guarantee that a STORE before the critical section
123 * can not be reordered with a LOAD inside this section.
124 * spin_lock() is the one-way barrier, this LOAD can not escape out
125 * of the region. So the default implementation simply ensures that
126 * a STORE can not move into the critical section, smp_wmb() should
127 * serialize it with another STORE done by spin_lock().
128 */
129#ifndef smp_mb__before_spinlock
130#define smp_mb__before_spinlock() smp_wmb()
123#endif 131#endif
124 132
125/** 133/**
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 6d870353674a..1821445708d6 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -121,6 +121,7 @@ struct rpc_task_setup {
121#define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */ 121#define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */
122#define RPC_TASK_SENT 0x0800 /* message was sent */ 122#define RPC_TASK_SENT 0x0800 /* message was sent */
123#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */ 123#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */
124#define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */
124 125
125#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) 126#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)
126#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) 127#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index c5fd30d2a415..8d4fa82bfb91 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -67,6 +67,8 @@ static inline swp_entry_t pte_to_swp_entry(pte_t pte)
67 swp_entry_t arch_entry; 67 swp_entry_t arch_entry;
68 68
69 BUG_ON(pte_file(pte)); 69 BUG_ON(pte_file(pte));
70 if (pte_swp_soft_dirty(pte))
71 pte = pte_swp_clear_soft_dirty(pte);
70 arch_entry = __pte_to_swp_entry(pte); 72 arch_entry = __pte_to_swp_entry(pte);
71 return swp_entry(__swp_type(arch_entry), __swp_offset(arch_entry)); 73 return swp_entry(__swp_type(arch_entry), __swp_offset(arch_entry));
72} 74}
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 4147d700a293..84662ecc7b51 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -802,9 +802,14 @@ asmlinkage long sys_vfork(void);
802asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, int, 802asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, int,
803 int __user *); 803 int __user *);
804#else 804#else
805#ifdef CONFIG_CLONE_BACKWARDS3
806asmlinkage long sys_clone(unsigned long, unsigned long, int, int __user *,
807 int __user *, int);
808#else
805asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, 809asmlinkage long sys_clone(unsigned long, unsigned long, int __user *,
806 int __user *, int); 810 int __user *, int);
807#endif 811#endif
812#endif
808 813
809asmlinkage long sys_execve(const char __user *filename, 814asmlinkage long sys_execve(const char __user *filename,
810 const char __user *const __user *argv, 815 const char __user *const __user *argv,
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 9e8a9b555ad6..11baec7c9b26 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -51,9 +51,9 @@ do { \
51 static struct lock_class_key __key; \ 51 static struct lock_class_key __key; \
52 \ 52 \
53 (attr)->key = &__key; \ 53 (attr)->key = &__key; \
54} while(0) 54} while (0)
55#else 55#else
56#define sysfs_attr_init(attr) do {} while(0) 56#define sysfs_attr_init(attr) do {} while (0)
57#endif 57#endif
58 58
59struct attribute_group { 59struct attribute_group {
@@ -69,7 +69,7 @@ struct attribute_group {
69 * for examples.. 69 * for examples..
70 */ 70 */
71 71
72#define __ATTR(_name,_mode,_show,_store) { \ 72#define __ATTR(_name, _mode, _show, _store) { \
73 .attr = {.name = __stringify(_name), .mode = _mode }, \ 73 .attr = {.name = __stringify(_name), .mode = _mode }, \
74 .show = _show, \ 74 .show = _show, \
75 .store = _store, \ 75 .store = _store, \
@@ -80,6 +80,11 @@ struct attribute_group {
80 .show = _name##_show, \ 80 .show = _name##_show, \
81} 81}
82 82
83#define __ATTR_WO(_name) { \
84 .attr = { .name = __stringify(_name), .mode = S_IWUSR }, \
85 .store = _name##_store, \
86}
87
83#define __ATTR_RW(_name) __ATTR(_name, (S_IWUSR | S_IRUGO), \ 88#define __ATTR_RW(_name) __ATTR(_name, (S_IWUSR | S_IRUGO), \
84 _name##_show, _name##_store) 89 _name##_show, _name##_store)
85 90
@@ -108,8 +113,6 @@ static const struct attribute_group _name##_group = { \
108}; \ 113}; \
109__ATTRIBUTE_GROUPS(_name) 114__ATTRIBUTE_GROUPS(_name)
110 115
111#define attr_name(_attr) (_attr).attr.name
112
113struct file; 116struct file;
114struct vm_area_struct; 117struct vm_area_struct;
115 118
@@ -119,7 +122,7 @@ struct bin_attribute {
119 void *private; 122 void *private;
120 ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *, 123 ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *,
121 char *, loff_t, size_t); 124 char *, loff_t, size_t);
122 ssize_t (*write)(struct file *,struct kobject *, struct bin_attribute *, 125 ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *,
123 char *, loff_t, size_t); 126 char *, loff_t, size_t);
124 int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr, 127 int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr,
125 struct vm_area_struct *vma); 128 struct vm_area_struct *vma);
@@ -153,7 +156,7 @@ struct bin_attribute {
153 156
154#define __BIN_ATTR_RW(_name, _size) __BIN_ATTR(_name, \ 157#define __BIN_ATTR_RW(_name, _size) __BIN_ATTR(_name, \
155 (S_IWUSR | S_IRUGO), _name##_read, \ 158 (S_IWUSR | S_IRUGO), _name##_read, \
156 _name##_write) 159 _name##_write, _size)
157 160
158#define __BIN_ATTR_NULL __ATTR_NULL 161#define __BIN_ATTR_NULL __ATTR_NULL
159 162
@@ -168,8 +171,8 @@ struct bin_attribute bin_attr_##_name = __BIN_ATTR_RO(_name, _size)
168struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size) 171struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size)
169 172
170struct sysfs_ops { 173struct sysfs_ops {
171 ssize_t (*show)(struct kobject *, struct attribute *,char *); 174 ssize_t (*show)(struct kobject *, struct attribute *, char *);
172 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); 175 ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t);
173 const void *(*namespace)(struct kobject *, const struct attribute *); 176 const void *(*namespace)(struct kobject *, const struct attribute *);
174}; 177};
175 178
@@ -215,10 +218,14 @@ void sysfs_delete_link(struct kobject *dir, struct kobject *targ,
215 218
216int __must_check sysfs_create_group(struct kobject *kobj, 219int __must_check sysfs_create_group(struct kobject *kobj,
217 const struct attribute_group *grp); 220 const struct attribute_group *grp);
221int __must_check sysfs_create_groups(struct kobject *kobj,
222 const struct attribute_group **groups);
218int sysfs_update_group(struct kobject *kobj, 223int sysfs_update_group(struct kobject *kobj,
219 const struct attribute_group *grp); 224 const struct attribute_group *grp);
220void sysfs_remove_group(struct kobject *kobj, 225void sysfs_remove_group(struct kobject *kobj,
221 const struct attribute_group *grp); 226 const struct attribute_group *grp);
227void sysfs_remove_groups(struct kobject *kobj,
228 const struct attribute_group **groups);
222int sysfs_add_file_to_group(struct kobject *kobj, 229int sysfs_add_file_to_group(struct kobject *kobj,
223 const struct attribute *attr, const char *group); 230 const struct attribute *attr, const char *group);
224void sysfs_remove_file_from_group(struct kobject *kobj, 231void sysfs_remove_file_from_group(struct kobject *kobj,
@@ -343,6 +350,12 @@ static inline int sysfs_create_group(struct kobject *kobj,
343 return 0; 350 return 0;
344} 351}
345 352
353static inline int sysfs_create_groups(struct kobject *kobj,
354 const struct attribute_group **groups)
355{
356 return 0;
357}
358
346static inline int sysfs_update_group(struct kobject *kobj, 359static inline int sysfs_update_group(struct kobject *kobj,
347 const struct attribute_group *grp) 360 const struct attribute_group *grp)
348{ 361{
@@ -354,6 +367,11 @@ static inline void sysfs_remove_group(struct kobject *kobj,
354{ 367{
355} 368}
356 369
370static inline void sysfs_remove_groups(struct kobject *kobj,
371 const struct attribute_group **groups)
372{
373}
374
357static inline int sysfs_add_file_to_group(struct kobject *kobj, 375static inline int sysfs_add_file_to_group(struct kobject *kobj,
358 const struct attribute *attr, const char *group) 376 const struct attribute *attr, const char *group)
359{ 377{
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 62bd8b72873c..5128d33bbb39 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -10,6 +10,8 @@
10#include <linux/irqflags.h> 10#include <linux/irqflags.h>
11#include <linux/percpu.h> 11#include <linux/percpu.h>
12#include <linux/hrtimer.h> 12#include <linux/hrtimer.h>
13#include <linux/context_tracking_state.h>
14#include <linux/cpumask.h>
13 15
14#ifdef CONFIG_GENERIC_CLOCKEVENTS 16#ifdef CONFIG_GENERIC_CLOCKEVENTS
15 17
@@ -158,20 +160,51 @@ static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
158# endif /* !CONFIG_NO_HZ_COMMON */ 160# endif /* !CONFIG_NO_HZ_COMMON */
159 161
160#ifdef CONFIG_NO_HZ_FULL 162#ifdef CONFIG_NO_HZ_FULL
163extern bool tick_nohz_full_running;
164extern cpumask_var_t tick_nohz_full_mask;
165
166static inline bool tick_nohz_full_enabled(void)
167{
168 if (!static_key_false(&context_tracking_enabled))
169 return false;
170
171 return tick_nohz_full_running;
172}
173
174static inline bool tick_nohz_full_cpu(int cpu)
175{
176 if (!tick_nohz_full_enabled())
177 return false;
178
179 return cpumask_test_cpu(cpu, tick_nohz_full_mask);
180}
181
161extern void tick_nohz_init(void); 182extern void tick_nohz_init(void);
162extern int tick_nohz_full_cpu(int cpu); 183extern void __tick_nohz_full_check(void);
163extern void tick_nohz_full_check(void);
164extern void tick_nohz_full_kick(void); 184extern void tick_nohz_full_kick(void);
165extern void tick_nohz_full_kick_all(void); 185extern void tick_nohz_full_kick_all(void);
166extern void tick_nohz_task_switch(struct task_struct *tsk); 186extern void __tick_nohz_task_switch(struct task_struct *tsk);
167#else 187#else
168static inline void tick_nohz_init(void) { } 188static inline void tick_nohz_init(void) { }
169static inline int tick_nohz_full_cpu(int cpu) { return 0; } 189static inline bool tick_nohz_full_enabled(void) { return false; }
170static inline void tick_nohz_full_check(void) { } 190static inline bool tick_nohz_full_cpu(int cpu) { return false; }
191static inline void __tick_nohz_full_check(void) { }
171static inline void tick_nohz_full_kick(void) { } 192static inline void tick_nohz_full_kick(void) { }
172static inline void tick_nohz_full_kick_all(void) { } 193static inline void tick_nohz_full_kick_all(void) { }
173static inline void tick_nohz_task_switch(struct task_struct *tsk) { } 194static inline void __tick_nohz_task_switch(struct task_struct *tsk) { }
174#endif 195#endif
175 196
197static inline void tick_nohz_full_check(void)
198{
199 if (tick_nohz_full_enabled())
200 __tick_nohz_full_check();
201}
202
203static inline void tick_nohz_task_switch(struct task_struct *tsk)
204{
205 if (tick_nohz_full_enabled())
206 __tick_nohz_task_switch(tsk);
207}
208
176 209
177#endif 210#endif
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 01ac30efd6a6..64f864651d86 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -10,6 +10,8 @@
10#include <linux/mutex.h> 10#include <linux/mutex.h>
11#include <linux/tty_flags.h> 11#include <linux/tty_flags.h>
12#include <uapi/linux/tty.h> 12#include <uapi/linux/tty.h>
13#include <linux/rwsem.h>
14#include <linux/llist.h>
13 15
14 16
15 17
@@ -29,9 +31,10 @@
29#define __DISABLED_CHAR '\0' 31#define __DISABLED_CHAR '\0'
30 32
31struct tty_buffer { 33struct tty_buffer {
32 struct tty_buffer *next; 34 union {
33 char *char_buf_ptr; 35 struct tty_buffer *next;
34 unsigned char *flag_buf_ptr; 36 struct llist_node free;
37 };
35 int used; 38 int used;
36 int size; 39 int size;
37 int commit; 40 int commit;
@@ -40,25 +43,25 @@ struct tty_buffer {
40 unsigned long data[0]; 43 unsigned long data[0];
41}; 44};
42 45
43/* 46static inline unsigned char *char_buf_ptr(struct tty_buffer *b, int ofs)
44 * We default to dicing tty buffer allocations to this many characters 47{
45 * in order to avoid multiple page allocations. We know the size of 48 return ((unsigned char *)b->data) + ofs;
46 * tty_buffer itself but it must also be taken into account that the 49}
47 * the buffer is 256 byte aligned. See tty_buffer_find for the allocation
48 * logic this must match
49 */
50
51#define TTY_BUFFER_PAGE (((PAGE_SIZE - sizeof(struct tty_buffer)) / 2) & ~0xFF)
52 50
51static inline char *flag_buf_ptr(struct tty_buffer *b, int ofs)
52{
53 return (char *)char_buf_ptr(b, ofs) + b->size;
54}
53 55
54struct tty_bufhead { 56struct tty_bufhead {
55 struct work_struct work;
56 spinlock_t lock;
57 struct tty_buffer *head; /* Queue head */ 57 struct tty_buffer *head; /* Queue head */
58 struct work_struct work;
59 struct mutex lock;
60 atomic_t priority;
61 struct tty_buffer sentinel;
62 struct llist_head free; /* Free queue head */
63 atomic_t memory_used; /* In-use buffers excluding free list */
58 struct tty_buffer *tail; /* Active buffer */ 64 struct tty_buffer *tail; /* Active buffer */
59 struct tty_buffer *free; /* Free queue head */
60 int memory_used; /* Buffer space used excluding
61 free queue */
62}; 65};
63/* 66/*
64 * When a break, frame error, or parity error happens, these codes are 67 * When a break, frame error, or parity error happens, these codes are
@@ -199,9 +202,6 @@ struct tty_port {
199 wait_queue_head_t close_wait; /* Close waiters */ 202 wait_queue_head_t close_wait; /* Close waiters */
200 wait_queue_head_t delta_msr_wait; /* Modem status change */ 203 wait_queue_head_t delta_msr_wait; /* Modem status change */
201 unsigned long flags; /* TTY flags ASY_*/ 204 unsigned long flags; /* TTY flags ASY_*/
202 unsigned long iflags; /* TTYP_ internal flags */
203#define TTYP_FLUSHING 1 /* Flushing to ldisc in progress */
204#define TTYP_FLUSHPENDING 2 /* Queued buffer flush pending */
205 unsigned char console:1, /* port is a console */ 205 unsigned char console:1, /* port is a console */
206 low_latency:1; /* direct buffer flush */ 206 low_latency:1; /* direct buffer flush */
207 struct mutex mutex; /* Locking */ 207 struct mutex mutex; /* Locking */
@@ -238,14 +238,16 @@ struct tty_struct {
238 int index; 238 int index;
239 239
240 /* Protects ldisc changes: Lock tty not pty */ 240 /* Protects ldisc changes: Lock tty not pty */
241 struct mutex ldisc_mutex; 241 struct ld_semaphore ldisc_sem;
242 struct tty_ldisc *ldisc; 242 struct tty_ldisc *ldisc;
243 243
244 struct mutex atomic_write_lock; 244 struct mutex atomic_write_lock;
245 struct mutex legacy_mutex; 245 struct mutex legacy_mutex;
246 struct mutex termios_mutex; 246 struct mutex throttle_mutex;
247 struct rw_semaphore termios_rwsem;
248 struct mutex winsize_mutex;
247 spinlock_t ctrl_lock; 249 spinlock_t ctrl_lock;
248 /* Termios values are protected by the termios mutex */ 250 /* Termios values are protected by the termios rwsem */
249 struct ktermios termios, termios_locked; 251 struct ktermios termios, termios_locked;
250 struct termiox *termiox; /* May be NULL for unsupported */ 252 struct termiox *termiox; /* May be NULL for unsupported */
251 char name[64]; 253 char name[64];
@@ -253,7 +255,7 @@ struct tty_struct {
253 struct pid *session; 255 struct pid *session;
254 unsigned long flags; 256 unsigned long flags;
255 int count; 257 int count;
256 struct winsize winsize; /* termios mutex */ 258 struct winsize winsize; /* winsize_mutex */
257 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; 259 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1;
258 unsigned char ctrl_status; /* ctrl_lock */ 260 unsigned char ctrl_status; /* ctrl_lock */
259 unsigned int receive_room; /* Bytes free for queue */ 261 unsigned int receive_room; /* Bytes free for queue */
@@ -303,10 +305,7 @@ struct tty_file_private {
303#define TTY_EXCLUSIVE 3 /* Exclusive open mode */ 305#define TTY_EXCLUSIVE 3 /* Exclusive open mode */
304#define TTY_DEBUG 4 /* Debugging */ 306#define TTY_DEBUG 4 /* Debugging */
305#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */ 307#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */
306#define TTY_PUSH 6 /* n_tty private */
307#define TTY_CLOSING 7 /* ->close() in progress */ 308#define TTY_CLOSING 7 /* ->close() in progress */
308#define TTY_LDISC 9 /* Line discipline attached */
309#define TTY_LDISC_CHANGING 10 /* Line discipline changing */
310#define TTY_LDISC_OPEN 11 /* Line discipline is open */ 309#define TTY_LDISC_OPEN 11 /* Line discipline is open */
311#define TTY_PTY_LOCK 16 /* pty private */ 310#define TTY_PTY_LOCK 16 /* pty private */
312#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ 311#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
@@ -559,6 +558,19 @@ extern void tty_ldisc_init(struct tty_struct *tty);
559extern void tty_ldisc_deinit(struct tty_struct *tty); 558extern void tty_ldisc_deinit(struct tty_struct *tty);
560extern void tty_ldisc_begin(void); 559extern void tty_ldisc_begin(void);
561 560
561static inline int tty_ldisc_receive_buf(struct tty_ldisc *ld, unsigned char *p,
562 char *f, int count)
563{
564 if (ld->ops->receive_buf2)
565 count = ld->ops->receive_buf2(ld->tty, p, f, count);
566 else {
567 count = min_t(int, count, ld->tty->receive_room);
568 if (count)
569 ld->ops->receive_buf(ld->tty, p, f, count);
570 }
571 return count;
572}
573
562 574
563/* n_tty.c */ 575/* n_tty.c */
564extern struct tty_ldisc_ops tty_ldisc_N_TTY; 576extern struct tty_ldisc_ops tty_ldisc_N_TTY;
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index e0f252633b47..21ddd7d9ea1f 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_TTY_FLIP_H 1#ifndef _LINUX_TTY_FLIP_H
2#define _LINUX_TTY_FLIP_H 2#define _LINUX_TTY_FLIP_H
3 3
4extern int tty_buffer_space_avail(struct tty_port *port);
4extern int tty_buffer_request_room(struct tty_port *port, size_t size); 5extern int tty_buffer_request_room(struct tty_port *port, size_t size);
5extern int tty_insert_flip_string_flags(struct tty_port *port, 6extern int tty_insert_flip_string_flags(struct tty_port *port,
6 const unsigned char *chars, const char *flags, size_t size); 7 const unsigned char *chars, const char *flags, size_t size);
@@ -18,8 +19,8 @@ static inline int tty_insert_flip_char(struct tty_port *port,
18{ 19{
19 struct tty_buffer *tb = port->buf.tail; 20 struct tty_buffer *tb = port->buf.tail;
20 if (tb && tb->used < tb->size) { 21 if (tb && tb->used < tb->size) {
21 tb->flag_buf_ptr[tb->used] = flag; 22 *flag_buf_ptr(tb, tb->used) = flag;
22 tb->char_buf_ptr[tb->used++] = ch; 23 *char_buf_ptr(tb, tb->used++) = ch;
23 return 1; 24 return 1;
24 } 25 }
25 return tty_insert_flip_string_flags(port, &ch, &flag, 1); 26 return tty_insert_flip_string_flags(port, &ch, &flag, 1);
@@ -31,4 +32,7 @@ static inline int tty_insert_flip_string(struct tty_port *port,
31 return tty_insert_flip_string_fixed_flag(port, chars, TTY_NORMAL, size); 32 return tty_insert_flip_string_fixed_flag(port, chars, TTY_NORMAL, size);
32} 33}
33 34
35extern void tty_buffer_lock_exclusive(struct tty_port *port);
36extern void tty_buffer_unlock_exclusive(struct tty_port *port);
37
34#endif /* _LINUX_TTY_FLIP_H */ 38#endif /* _LINUX_TTY_FLIP_H */
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index a1b048999821..f15c898ff462 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -109,6 +109,17 @@
109 * 109 *
110 * Tells the discipline that the DCD pin has changed its status. 110 * Tells the discipline that the DCD pin has changed its status.
111 * Used exclusively by the N_PPS (Pulse-Per-Second) line discipline. 111 * Used exclusively by the N_PPS (Pulse-Per-Second) line discipline.
112 *
113 * int (*receive_buf2)(struct tty_struct *, const unsigned char *cp,
114 * char *fp, int count);
115 *
116 * This function is called by the low-level tty driver to send
117 * characters received by the hardware to the line discpline for
118 * processing. <cp> is a pointer to the buffer of input
119 * character received by the device. <fp> is a pointer to a
120 * pointer of flag bytes which indicate whether a character was
121 * received with a parity error, etc.
122 * If assigned, prefer this function for automatic flow control.
112 */ 123 */
113 124
114#include <linux/fs.h> 125#include <linux/fs.h>
@@ -195,6 +206,8 @@ struct tty_ldisc_ops {
195 void (*write_wakeup)(struct tty_struct *); 206 void (*write_wakeup)(struct tty_struct *);
196 void (*dcd_change)(struct tty_struct *, unsigned int); 207 void (*dcd_change)(struct tty_struct *, unsigned int);
197 void (*fasync)(struct tty_struct *tty, int on); 208 void (*fasync)(struct tty_struct *tty, int on);
209 int (*receive_buf2)(struct tty_struct *, const unsigned char *cp,
210 char *fp, int count);
198 211
199 struct module *owner; 212 struct module *owner;
200 213
@@ -203,8 +216,7 @@ struct tty_ldisc_ops {
203 216
204struct tty_ldisc { 217struct tty_ldisc {
205 struct tty_ldisc_ops *ops; 218 struct tty_ldisc_ops *ops;
206 atomic_t users; 219 struct tty_struct *tty;
207 wait_queue_head_t wq_idle;
208}; 220};
209 221
210#define TTY_LDISC_MAGIC 0x5403 222#define TTY_LDISC_MAGIC 0x5403
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 0eec2689b955..001629cd1a97 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -337,6 +337,7 @@ struct usb_bus {
337 * the ep queue on a short transfer 337 * the ep queue on a short transfer
338 * with the URB_SHORT_NOT_OK flag set. 338 * with the URB_SHORT_NOT_OK flag set.
339 */ 339 */
340 unsigned no_sg_constraint:1; /* no sg constraint */
340 unsigned sg_tablesize; /* 0 or largest number of sg list entries */ 341 unsigned sg_tablesize; /* 0 or largest number of sg list entries */
341 342
342 int devnum_next; /* Next open device number in 343 int devnum_next; /* Next open device number in
@@ -684,6 +685,11 @@ static inline bool usb_device_supports_ltm(struct usb_device *udev)
684 return udev->bos->ss_cap->bmAttributes & USB_LTM_SUPPORT; 685 return udev->bos->ss_cap->bmAttributes & USB_LTM_SUPPORT;
685} 686}
686 687
688static inline bool usb_device_no_sg_constraint(struct usb_device *udev)
689{
690 return udev && udev->bus && udev->bus->no_sg_constraint;
691}
692
687 693
688/*-------------------------------------------------------------------------*/ 694/*-------------------------------------------------------------------------*/
689 695
@@ -708,7 +714,10 @@ extern int usb_driver_claim_interface(struct usb_driver *driver,
708 * usb_interface_claimed - returns true iff an interface is claimed 714 * usb_interface_claimed - returns true iff an interface is claimed
709 * @iface: the interface being checked 715 * @iface: the interface being checked
710 * 716 *
711 * Returns true (nonzero) iff the interface is claimed, else false (zero). 717 * Return: %true (nonzero) iff the interface is claimed, else %false
718 * (zero).
719 *
720 * Note:
712 * Callers must own the driver model's usb bus readlock. So driver 721 * Callers must own the driver model's usb bus readlock. So driver
713 * probe() entries don't need extra locking, but other call contexts 722 * probe() entries don't need extra locking, but other call contexts
714 * may need to explicitly claim that lock. 723 * may need to explicitly claim that lock.
@@ -745,8 +754,9 @@ extern struct usb_host_interface *usb_find_alt_setting(
745 * @buf: where to put the string 754 * @buf: where to put the string
746 * @size: how big is "buf"? 755 * @size: how big is "buf"?
747 * 756 *
748 * Returns length of the string (> 0) or negative if size was too small. 757 * Return: Length of the string (> 0) or negative if size was too small.
749 * 758 *
759 * Note:
750 * This identifier is intended to be "stable", reflecting physical paths in 760 * This identifier is intended to be "stable", reflecting physical paths in
751 * hardware such as physical bus addresses for host controllers or ports on 761 * hardware such as physical bus addresses for host controllers or ports on
752 * USB hubs. That makes it stay the same until systems are physically 762 * USB hubs. That makes it stay the same until systems are physically
@@ -1247,7 +1257,9 @@ typedef void (*usb_complete_t)(struct urb *);
1247 * the device driver is saying that it provided this DMA address, 1257 * the device driver is saying that it provided this DMA address,
1248 * which the host controller driver should use in preference to the 1258 * which the host controller driver should use in preference to the
1249 * transfer_buffer. 1259 * transfer_buffer.
1250 * @sg: scatter gather buffer list 1260 * @sg: scatter gather buffer list, the buffer size of each element in
1261 * the list (except the last) must be divisible by the endpoint's
1262 * max packet size if no_sg_constraint isn't set in 'struct usb_bus'
1251 * @num_mapped_sgs: (internal) number of mapped sg entries 1263 * @num_mapped_sgs: (internal) number of mapped sg entries
1252 * @num_sgs: number of entries in the sg list 1264 * @num_sgs: number of entries in the sg list
1253 * @transfer_buffer_length: How big is transfer_buffer. The transfer may 1265 * @transfer_buffer_length: How big is transfer_buffer. The transfer may
@@ -1534,10 +1546,16 @@ static inline void usb_fill_int_urb(struct urb *urb,
1534 urb->transfer_buffer_length = buffer_length; 1546 urb->transfer_buffer_length = buffer_length;
1535 urb->complete = complete_fn; 1547 urb->complete = complete_fn;
1536 urb->context = context; 1548 urb->context = context;
1537 if (dev->speed == USB_SPEED_HIGH || dev->speed == USB_SPEED_SUPER) 1549
1550 if (dev->speed == USB_SPEED_HIGH || dev->speed == USB_SPEED_SUPER) {
1551 /* make sure interval is within allowed range */
1552 interval = clamp(interval, 1, 16);
1553
1538 urb->interval = 1 << (interval - 1); 1554 urb->interval = 1 << (interval - 1);
1539 else 1555 } else {
1540 urb->interval = interval; 1556 urb->interval = interval;
1557 }
1558
1541 urb->start_frame = -1; 1559 urb->start_frame = -1;
1542} 1560}
1543 1561
@@ -1570,7 +1588,7 @@ extern int usb_anchor_empty(struct usb_anchor *anchor);
1570 * usb_urb_dir_in - check if an URB describes an IN transfer 1588 * usb_urb_dir_in - check if an URB describes an IN transfer
1571 * @urb: URB to be checked 1589 * @urb: URB to be checked
1572 * 1590 *
1573 * Returns 1 if @urb describes an IN transfer (device-to-host), 1591 * Return: 1 if @urb describes an IN transfer (device-to-host),
1574 * otherwise 0. 1592 * otherwise 0.
1575 */ 1593 */
1576static inline int usb_urb_dir_in(struct urb *urb) 1594static inline int usb_urb_dir_in(struct urb *urb)
@@ -1582,7 +1600,7 @@ static inline int usb_urb_dir_in(struct urb *urb)
1582 * usb_urb_dir_out - check if an URB describes an OUT transfer 1600 * usb_urb_dir_out - check if an URB describes an OUT transfer
1583 * @urb: URB to be checked 1601 * @urb: URB to be checked
1584 * 1602 *
1585 * Returns 1 if @urb describes an OUT transfer (host-to-device), 1603 * Return: 1 if @urb describes an OUT transfer (host-to-device),
1586 * otherwise 0. 1604 * otherwise 0.
1587 */ 1605 */
1588static inline int usb_urb_dir_out(struct urb *urb) 1606static inline int usb_urb_dir_out(struct urb *urb)
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index 25629948c842..7d399671a566 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -18,12 +18,17 @@ struct ci_hdrc_platform_data {
18 unsigned long flags; 18 unsigned long flags;
19#define CI_HDRC_REGS_SHARED BIT(0) 19#define CI_HDRC_REGS_SHARED BIT(0)
20#define CI_HDRC_REQUIRE_TRANSCEIVER BIT(1) 20#define CI_HDRC_REQUIRE_TRANSCEIVER BIT(1)
21#define CI_HDRC_PULLUP_ON_VBUS BIT(2)
22#define CI_HDRC_DISABLE_STREAMING BIT(3) 21#define CI_HDRC_DISABLE_STREAMING BIT(3)
22 /*
23 * Only set it when DCCPARAMS.DC==1 and DCCPARAMS.HC==1,
24 * but otg is not supported (no register otgsc).
25 */
26#define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4)
23 enum usb_dr_mode dr_mode; 27 enum usb_dr_mode dr_mode;
24#define CI_HDRC_CONTROLLER_RESET_EVENT 0 28#define CI_HDRC_CONTROLLER_RESET_EVENT 0
25#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 29#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
26 void (*notify_event) (struct ci_hdrc *ci, unsigned event); 30 void (*notify_event) (struct ci_hdrc *ci, unsigned event);
31 struct regulator *reg_vbus;
27}; 32};
28 33
29/* Default offset of capability registers */ 34/* Default offset of capability registers */
diff --git a/include/linux/usb/dwc3-omap.h b/include/linux/usb/dwc3-omap.h
deleted file mode 100644
index 5615f4d82724..000000000000
--- a/include/linux/usb/dwc3-omap.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * Copyright (C) 2013 by Texas Instruments
3 *
4 * The Inventra Controller Driver for Linux is free software; you
5 * can redistribute it and/or modify it under the terms of the GNU
6 * General Public License version 2 as published by the Free Software
7 * Foundation.
8 */
9
10#ifndef __DWC3_OMAP_H__
11#define __DWC3_OMAP_H__
12
13enum omap_dwc3_vbus_id_status {
14 OMAP_DWC3_UNKNOWN = 0,
15 OMAP_DWC3_ID_GROUND,
16 OMAP_DWC3_ID_FLOAT,
17 OMAP_DWC3_VBUS_VALID,
18 OMAP_DWC3_VBUS_OFF,
19};
20
21#if (defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_DWC3_MODULE))
22extern int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status);
23#else
24static inline int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
25{
26 return -ENODEV;
27}
28#endif
29
30#endif /* __DWC3_OMAP_H__ */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index f1b0dca60f12..942ef5e053bf 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -22,6 +22,7 @@
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/scatterlist.h> 23#include <linux/scatterlist.h>
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/workqueue.h>
25#include <linux/usb/ch9.h> 26#include <linux/usb/ch9.h>
26 27
27struct usb_ep; 28struct usb_ep;
@@ -475,6 +476,7 @@ struct usb_gadget_ops {
475 476
476/** 477/**
477 * struct usb_gadget - represents a usb slave device 478 * struct usb_gadget - represents a usb slave device
479 * @work: (internal use) Workqueue to be used for sysfs_notify()
478 * @ops: Function pointers used to access hardware-specific operations. 480 * @ops: Function pointers used to access hardware-specific operations.
479 * @ep0: Endpoint zero, used when reading or writing responses to 481 * @ep0: Endpoint zero, used when reading or writing responses to
480 * driver setup() requests 482 * driver setup() requests
@@ -520,6 +522,7 @@ struct usb_gadget_ops {
520 * device is acting as a B-Peripheral (so is_a_peripheral is false). 522 * device is acting as a B-Peripheral (so is_a_peripheral is false).
521 */ 523 */
522struct usb_gadget { 524struct usb_gadget {
525 struct work_struct work;
523 /* readonly to gadget driver */ 526 /* readonly to gadget driver */
524 const struct usb_gadget_ops *ops; 527 const struct usb_gadget_ops *ops;
525 struct usb_ep *ep0; 528 struct usb_ep *ep0;
@@ -538,6 +541,7 @@ struct usb_gadget {
538 unsigned out_epnum; 541 unsigned out_epnum;
539 unsigned in_epnum; 542 unsigned in_epnum;
540}; 543};
544#define work_to_gadget(w) (container_of((w), struct usb_gadget, work))
541 545
542static inline void set_gadget_data(struct usb_gadget *gadget, void *data) 546static inline void set_gadget_data(struct usb_gadget *gadget, void *data)
543 { dev_set_drvdata(&gadget->dev, data); } 547 { dev_set_drvdata(&gadget->dev, data); }
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 1e88377e22f4..75efc45eaa2f 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -22,6 +22,7 @@
22#ifdef __KERNEL__ 22#ifdef __KERNEL__
23 23
24#include <linux/rwsem.h> 24#include <linux/rwsem.h>
25#include <linux/interrupt.h>
25 26
26#define MAX_TOPO_LEVEL 6 27#define MAX_TOPO_LEVEL 6
27 28
@@ -67,6 +68,13 @@
67 68
68/*-------------------------------------------------------------------------*/ 69/*-------------------------------------------------------------------------*/
69 70
71struct giveback_urb_bh {
72 bool running;
73 spinlock_t lock;
74 struct list_head head;
75 struct tasklet_struct bh;
76};
77
70struct usb_hcd { 78struct usb_hcd {
71 79
72 /* 80 /*
@@ -139,6 +147,9 @@ struct usb_hcd {
139 resource_size_t rsrc_len; /* memory/io resource length */ 147 resource_size_t rsrc_len; /* memory/io resource length */
140 unsigned power_budget; /* in mA, 0 = no limit */ 148 unsigned power_budget; /* in mA, 0 = no limit */
141 149
150 struct giveback_urb_bh high_prio_bh;
151 struct giveback_urb_bh low_prio_bh;
152
142 /* bandwidth_mutex should be taken before adding or removing 153 /* bandwidth_mutex should be taken before adding or removing
143 * any new bus bandwidth constraints: 154 * any new bus bandwidth constraints:
144 * 1. Before adding a configuration for a new device. 155 * 1. Before adding a configuration for a new device.
@@ -221,6 +232,7 @@ struct hc_driver {
221#define HCD_USB25 0x0030 /* Wireless USB 1.0 (USB 2.5)*/ 232#define HCD_USB25 0x0030 /* Wireless USB 1.0 (USB 2.5)*/
222#define HCD_USB3 0x0040 /* USB 3.0 */ 233#define HCD_USB3 0x0040 /* USB 3.0 */
223#define HCD_MASK 0x0070 234#define HCD_MASK 0x0070
235#define HCD_BH 0x0100 /* URB complete in BH context */
224 236
225 /* called to init HCD and root hub */ 237 /* called to init HCD and root hub */
226 int (*reset) (struct usb_hcd *hcd); 238 int (*reset) (struct usb_hcd *hcd);
@@ -361,6 +373,11 @@ struct hc_driver {
361 int (*find_raw_port_number)(struct usb_hcd *, int); 373 int (*find_raw_port_number)(struct usb_hcd *, int);
362}; 374};
363 375
376static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd)
377{
378 return hcd->driver->flags & HCD_BH;
379}
380
364extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); 381extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
365extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb, 382extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb,
366 int status); 383 int status);
@@ -411,7 +428,7 @@ extern int usb_hcd_pci_probe(struct pci_dev *dev,
411extern void usb_hcd_pci_remove(struct pci_dev *dev); 428extern void usb_hcd_pci_remove(struct pci_dev *dev);
412extern void usb_hcd_pci_shutdown(struct pci_dev *dev); 429extern void usb_hcd_pci_shutdown(struct pci_dev *dev);
413 430
414#ifdef CONFIG_PM_SLEEP 431#ifdef CONFIG_PM
415extern const struct dev_pm_ops usb_hcd_pci_pm_ops; 432extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
416#endif 433#endif
417#endif /* CONFIG_PCI */ 434#endif /* CONFIG_PCI */
diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
index a0ef405368b8..8c38aa26b3bb 100644
--- a/include/linux/usb/of.h
+++ b/include/linux/usb/of.h
@@ -7,19 +7,27 @@
7#ifndef __LINUX_USB_OF_H 7#ifndef __LINUX_USB_OF_H
8#define __LINUX_USB_OF_H 8#define __LINUX_USB_OF_H
9 9
10#include <linux/usb/ch9.h>
10#include <linux/usb/otg.h> 11#include <linux/usb/otg.h>
11#include <linux/usb/phy.h> 12#include <linux/usb/phy.h>
12 13
13#if IS_ENABLED(CONFIG_OF) 14#if IS_ENABLED(CONFIG_OF)
14enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np); 15enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np);
16enum usb_device_speed of_usb_get_maximum_speed(struct device_node *np);
15#else 17#else
16static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np) 18static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np)
17{ 19{
18 return USB_DR_MODE_UNKNOWN; 20 return USB_DR_MODE_UNKNOWN;
19} 21}
22
23static inline enum usb_device_speed
24of_usb_get_maximum_speed(struct device_node *np)
25{
26 return USB_SPEED_UNKNOWN;
27}
20#endif 28#endif
21 29
22#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_PHY) 30#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT)
23enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np); 31enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np);
24#else 32#else
25static inline enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np) 33static inline enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np)
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index 44036808bf0f..6c0b1c513db7 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -142,7 +142,7 @@ extern void usb_remove_phy(struct usb_phy *);
142/* helpers for direct access thru low-level io interface */ 142/* helpers for direct access thru low-level io interface */
143static inline int usb_phy_io_read(struct usb_phy *x, u32 reg) 143static inline int usb_phy_io_read(struct usb_phy *x, u32 reg)
144{ 144{
145 if (x->io_ops && x->io_ops->read) 145 if (x && x->io_ops && x->io_ops->read)
146 return x->io_ops->read(x, reg); 146 return x->io_ops->read(x, reg);
147 147
148 return -EINVAL; 148 return -EINVAL;
@@ -150,7 +150,7 @@ static inline int usb_phy_io_read(struct usb_phy *x, u32 reg)
150 150
151static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg) 151static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg)
152{ 152{
153 if (x->io_ops && x->io_ops->write) 153 if (x && x->io_ops && x->io_ops->write)
154 return x->io_ops->write(x, val, reg); 154 return x->io_ops->write(x, val, reg);
155 155
156 return -EINVAL; 156 return -EINVAL;
@@ -159,7 +159,7 @@ static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg)
159static inline int 159static inline int
160usb_phy_init(struct usb_phy *x) 160usb_phy_init(struct usb_phy *x)
161{ 161{
162 if (x->init) 162 if (x && x->init)
163 return x->init(x); 163 return x->init(x);
164 164
165 return 0; 165 return 0;
@@ -168,14 +168,14 @@ usb_phy_init(struct usb_phy *x)
168static inline void 168static inline void
169usb_phy_shutdown(struct usb_phy *x) 169usb_phy_shutdown(struct usb_phy *x)
170{ 170{
171 if (x->shutdown) 171 if (x && x->shutdown)
172 x->shutdown(x); 172 x->shutdown(x);
173} 173}
174 174
175static inline int 175static inline int
176usb_phy_vbus_on(struct usb_phy *x) 176usb_phy_vbus_on(struct usb_phy *x)
177{ 177{
178 if (!x->set_vbus) 178 if (!x || !x->set_vbus)
179 return 0; 179 return 0;
180 180
181 return x->set_vbus(x, true); 181 return x->set_vbus(x, true);
@@ -184,7 +184,7 @@ usb_phy_vbus_on(struct usb_phy *x)
184static inline int 184static inline int
185usb_phy_vbus_off(struct usb_phy *x) 185usb_phy_vbus_off(struct usb_phy *x)
186{ 186{
187 if (!x->set_vbus) 187 if (!x || !x->set_vbus)
188 return 0; 188 return 0;
189 189
190 return x->set_vbus(x, false); 190 return x->set_vbus(x, false);
@@ -258,7 +258,7 @@ usb_phy_set_power(struct usb_phy *x, unsigned mA)
258static inline int 258static inline int
259usb_phy_set_suspend(struct usb_phy *x, int suspend) 259usb_phy_set_suspend(struct usb_phy *x, int suspend)
260{ 260{
261 if (x->set_suspend != NULL) 261 if (x && x->set_suspend != NULL)
262 return x->set_suspend(x, suspend); 262 return x->set_suspend(x, suspend);
263 else 263 else
264 return 0; 264 return 0;
@@ -267,7 +267,7 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
267static inline int 267static inline int
268usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed) 268usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed)
269{ 269{
270 if (x->notify_connect) 270 if (x && x->notify_connect)
271 return x->notify_connect(x, speed); 271 return x->notify_connect(x, speed);
272 else 272 else
273 return 0; 273 return 0;
@@ -276,7 +276,7 @@ usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed)
276static inline int 276static inline int
277usb_phy_notify_disconnect(struct usb_phy *x, enum usb_device_speed speed) 277usb_phy_notify_disconnect(struct usb_phy *x, enum usb_device_speed speed)
278{ 278{
279 if (x->notify_disconnect) 279 if (x && x->notify_disconnect)
280 return x->notify_disconnect(x, speed); 280 return x->notify_disconnect(x, speed);
281 else 281 else
282 return 0; 282 return 0;
diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h
index d2ca919a5b73..1de16c324ec8 100644
--- a/include/linux/usb/tegra_usb_phy.h
+++ b/include/linux/usb/tegra_usb_phy.h
@@ -18,19 +18,36 @@
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/usb/otg.h> 19#include <linux/usb/otg.h>
20 20
21/*
22 * utmi_pll_config_in_car_module: true if the UTMI PLL configuration registers
23 * should be set up by clk-tegra, false if by the PHY code
24 * has_hostpc: true if the USB controller has the HOSTPC extension, which
25 * changes the location of the PHCD and PTS fields
26 * requires_usbmode_setup: true if the USBMODE register needs to be set to
27 * enter host mode
28 * requires_extra_tuning_parameters: true if xcvr_hsslew, hssquelch_level
29 * and hsdiscon_level should be set for adequate signal quality
30 */
31
32struct tegra_phy_soc_config {
33 bool utmi_pll_config_in_car_module;
34 bool has_hostpc;
35 bool requires_usbmode_setup;
36 bool requires_extra_tuning_parameters;
37};
38
21struct tegra_utmip_config { 39struct tegra_utmip_config {
22 u8 hssync_start_delay; 40 u8 hssync_start_delay;
23 u8 elastic_limit; 41 u8 elastic_limit;
24 u8 idle_wait_delay; 42 u8 idle_wait_delay;
25 u8 term_range_adj; 43 u8 term_range_adj;
44 bool xcvr_setup_use_fuses;
26 u8 xcvr_setup; 45 u8 xcvr_setup;
27 u8 xcvr_lsfslew; 46 u8 xcvr_lsfslew;
28 u8 xcvr_lsrslew; 47 u8 xcvr_lsrslew;
29}; 48 u8 xcvr_hsslew;
30 49 u8 hssquelch_level;
31struct tegra_ulpi_config { 50 u8 hsdiscon_level;
32 int reset_gpio;
33 const char *clk;
34}; 51};
35 52
36enum tegra_usb_phy_port_speed { 53enum tegra_usb_phy_port_speed {
@@ -39,12 +56,6 @@ enum tegra_usb_phy_port_speed {
39 TEGRA_USB_PHY_PORT_SPEED_HIGH, 56 TEGRA_USB_PHY_PORT_SPEED_HIGH,
40}; 57};
41 58
42enum tegra_usb_phy_mode {
43 TEGRA_USB_PHY_MODE_DEVICE,
44 TEGRA_USB_PHY_MODE_HOST,
45 TEGRA_USB_PHY_MODE_OTG,
46};
47
48struct tegra_xtal_freq; 59struct tegra_xtal_freq;
49 60
50struct tegra_usb_phy { 61struct tegra_usb_phy {
@@ -55,18 +66,17 @@ struct tegra_usb_phy {
55 struct clk *clk; 66 struct clk *clk;
56 struct clk *pll_u; 67 struct clk *pll_u;
57 struct clk *pad_clk; 68 struct clk *pad_clk;
58 enum tegra_usb_phy_mode mode; 69 struct regulator *vbus;
70 enum usb_dr_mode mode;
59 void *config; 71 void *config;
72 const struct tegra_phy_soc_config *soc_config;
60 struct usb_phy *ulpi; 73 struct usb_phy *ulpi;
61 struct usb_phy u_phy; 74 struct usb_phy u_phy;
62 struct device *dev;
63 bool is_legacy_phy; 75 bool is_legacy_phy;
64 bool is_ulpi_phy; 76 bool is_ulpi_phy;
65 int reset_gpio; 77 int reset_gpio;
66}; 78};
67 79
68struct usb_phy *tegra_usb_get_phy(struct device_node *dn);
69
70void tegra_usb_phy_preresume(struct usb_phy *phy); 80void tegra_usb_phy_preresume(struct usb_phy *phy);
71 81
72void tegra_usb_phy_postresume(struct usb_phy *phy); 82void tegra_usb_phy_postresume(struct usb_phy *phy);
diff --git a/include/linux/usb/nop-usb-xceiv.h b/include/linux/usb/usb_phy_gen_xceiv.h
index 148d35171aac..f9a7e7bc925b 100644
--- a/include/linux/usb/nop-usb-xceiv.h
+++ b/include/linux/usb/usb_phy_gen_xceiv.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/usb/otg.h> 4#include <linux/usb/otg.h>
5 5
6struct nop_usb_xceiv_platform_data { 6struct usb_phy_gen_xceiv_platform_data {
7 enum usb_phy_type type; 7 enum usb_phy_type type;
8 unsigned long clk_rate; 8 unsigned long clk_rate;
9 9
@@ -12,7 +12,7 @@ struct nop_usb_xceiv_platform_data {
12 unsigned int needs_reset:1; 12 unsigned int needs_reset:1;
13}; 13};
14 14
15#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) 15#if IS_ENABLED(CONFIG_NOP_USB_XCEIV)
16/* sometimes transceivers are accessed only through e.g. ULPI */ 16/* sometimes transceivers are accessed only through e.g. ULPI */
17extern void usb_nop_xceiv_register(void); 17extern void usb_nop_xceiv_register(void);
18extern void usb_nop_xceiv_unregister(void); 18extern void usb_nop_xceiv_unregister(void);
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index f18d64129f99..2b47e6364e36 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -34,6 +34,7 @@ struct usbnet {
34 struct mutex phy_mutex; 34 struct mutex phy_mutex;
35 unsigned char suspend_count; 35 unsigned char suspend_count;
36 unsigned char pkt_cnt, pkt_err; 36 unsigned char pkt_cnt, pkt_err;
37 unsigned can_dma_sg:1;
37 38
38 /* i/o info: pipes etc */ 39 /* i/o info: pipes etc */
39 unsigned in, out; 40 unsigned in, out;
diff --git a/include/linux/usb/wusb-wa.h b/include/linux/usb/wusb-wa.h
index 6be985b2a434..4ff744e2b678 100644
--- a/include/linux/usb/wusb-wa.h
+++ b/include/linux/usb/wusb-wa.h
@@ -66,6 +66,7 @@ enum {
66 WA_ENABLE = 0x01, 66 WA_ENABLE = 0x01,
67 WA_RESET = 0x02, 67 WA_RESET = 0x02,
68 RPIPE_PAUSE = 0x1, 68 RPIPE_PAUSE = 0x1,
69 RPIPE_STALL = 0x2,
69}; 70};
70 71
71/* Responses from Get Status request ([WUSB] section 8.3.1.6) */ 72/* Responses from Get Status request ([WUSB] section 8.3.1.6) */
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index b6b215f13b45..14105c26a836 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -23,6 +23,7 @@ struct user_namespace {
23 struct uid_gid_map projid_map; 23 struct uid_gid_map projid_map;
24 atomic_t count; 24 atomic_t count;
25 struct user_namespace *parent; 25 struct user_namespace *parent;
26 int level;
26 kuid_t owner; 27 kuid_t owner;
27 kgid_t group; 28 kgid_t group;
28 unsigned int proc_inum; 29 unsigned int proc_inum;
diff --git a/include/linux/vmpressure.h b/include/linux/vmpressure.h
index 7dc17e2456de..3f3788d49362 100644
--- a/include/linux/vmpressure.h
+++ b/include/linux/vmpressure.h
@@ -34,10 +34,12 @@ extern void vmpressure_cleanup(struct vmpressure *vmpr);
34extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg); 34extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg);
35extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr); 35extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr);
36extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css); 36extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css);
37extern int vmpressure_register_event(struct cgroup *cg, struct cftype *cft, 37extern int vmpressure_register_event(struct cgroup_subsys_state *css,
38 struct cftype *cft,
38 struct eventfd_ctx *eventfd, 39 struct eventfd_ctx *eventfd,
39 const char *args); 40 const char *args);
40extern void vmpressure_unregister_event(struct cgroup *cg, struct cftype *cft, 41extern void vmpressure_unregister_event(struct cgroup_subsys_state *css,
42 struct cftype *cft,
41 struct eventfd_ctx *eventfd); 43 struct eventfd_ctx *eventfd);
42#else 44#else
43static inline void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, 45static inline void vmpressure(gfp_t gfp, struct mem_cgroup *memcg,
diff --git a/include/linux/vtime.h b/include/linux/vtime.h
index b1dd2db80076..f5b72b364bda 100644
--- a/include/linux/vtime.h
+++ b/include/linux/vtime.h
@@ -1,18 +1,68 @@
1#ifndef _LINUX_KERNEL_VTIME_H 1#ifndef _LINUX_KERNEL_VTIME_H
2#define _LINUX_KERNEL_VTIME_H 2#define _LINUX_KERNEL_VTIME_H
3 3
4#include <linux/context_tracking_state.h>
5#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
6#include <asm/vtime.h>
7#endif
8
9
4struct task_struct; 10struct task_struct;
5 11
12/*
13 * vtime_accounting_enabled() definitions/declarations
14 */
15#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
16static inline bool vtime_accounting_enabled(void) { return true; }
17#endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
18
19#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
20static inline bool vtime_accounting_enabled(void)
21{
22 if (static_key_false(&context_tracking_enabled)) {
23 if (context_tracking_active())
24 return true;
25 }
26
27 return false;
28}
29#endif /* CONFIG_VIRT_CPU_ACCOUNTING_GEN */
30
31#ifndef CONFIG_VIRT_CPU_ACCOUNTING
32static inline bool vtime_accounting_enabled(void) { return false; }
33#endif /* !CONFIG_VIRT_CPU_ACCOUNTING */
34
35
36/*
37 * Common vtime APIs
38 */
6#ifdef CONFIG_VIRT_CPU_ACCOUNTING 39#ifdef CONFIG_VIRT_CPU_ACCOUNTING
40
41#ifdef __ARCH_HAS_VTIME_TASK_SWITCH
7extern void vtime_task_switch(struct task_struct *prev); 42extern void vtime_task_switch(struct task_struct *prev);
43#else
44extern void vtime_common_task_switch(struct task_struct *prev);
45static inline void vtime_task_switch(struct task_struct *prev)
46{
47 if (vtime_accounting_enabled())
48 vtime_common_task_switch(prev);
49}
50#endif /* __ARCH_HAS_VTIME_TASK_SWITCH */
51
8extern void vtime_account_system(struct task_struct *tsk); 52extern void vtime_account_system(struct task_struct *tsk);
9extern void vtime_account_idle(struct task_struct *tsk); 53extern void vtime_account_idle(struct task_struct *tsk);
10extern void vtime_account_user(struct task_struct *tsk); 54extern void vtime_account_user(struct task_struct *tsk);
11extern void vtime_account_irq_enter(struct task_struct *tsk);
12 55
13#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE 56#ifdef __ARCH_HAS_VTIME_ACCOUNT
14static inline bool vtime_accounting_enabled(void) { return true; } 57extern void vtime_account_irq_enter(struct task_struct *tsk);
15#endif 58#else
59extern void vtime_common_account_irq_enter(struct task_struct *tsk);
60static inline void vtime_account_irq_enter(struct task_struct *tsk)
61{
62 if (vtime_accounting_enabled())
63 vtime_common_account_irq_enter(tsk);
64}
65#endif /* __ARCH_HAS_VTIME_ACCOUNT */
16 66
17#else /* !CONFIG_VIRT_CPU_ACCOUNTING */ 67#else /* !CONFIG_VIRT_CPU_ACCOUNTING */
18 68
@@ -20,14 +70,20 @@ static inline void vtime_task_switch(struct task_struct *prev) { }
20static inline void vtime_account_system(struct task_struct *tsk) { } 70static inline void vtime_account_system(struct task_struct *tsk) { }
21static inline void vtime_account_user(struct task_struct *tsk) { } 71static inline void vtime_account_user(struct task_struct *tsk) { }
22static inline void vtime_account_irq_enter(struct task_struct *tsk) { } 72static inline void vtime_account_irq_enter(struct task_struct *tsk) { }
23static inline bool vtime_accounting_enabled(void) { return false; } 73#endif /* !CONFIG_VIRT_CPU_ACCOUNTING */
24#endif
25 74
26#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN 75#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
27extern void arch_vtime_task_switch(struct task_struct *tsk); 76extern void arch_vtime_task_switch(struct task_struct *tsk);
28extern void vtime_account_irq_exit(struct task_struct *tsk); 77extern void vtime_gen_account_irq_exit(struct task_struct *tsk);
29extern bool vtime_accounting_enabled(void); 78
79static inline void vtime_account_irq_exit(struct task_struct *tsk)
80{
81 if (vtime_accounting_enabled())
82 vtime_gen_account_irq_exit(tsk);
83}
84
30extern void vtime_user_enter(struct task_struct *tsk); 85extern void vtime_user_enter(struct task_struct *tsk);
86
31static inline void vtime_user_exit(struct task_struct *tsk) 87static inline void vtime_user_exit(struct task_struct *tsk)
32{ 88{
33 vtime_account_user(tsk); 89 vtime_account_user(tsk);
@@ -35,7 +91,7 @@ static inline void vtime_user_exit(struct task_struct *tsk)
35extern void vtime_guest_enter(struct task_struct *tsk); 91extern void vtime_guest_enter(struct task_struct *tsk);
36extern void vtime_guest_exit(struct task_struct *tsk); 92extern void vtime_guest_exit(struct task_struct *tsk);
37extern void vtime_init_idle(struct task_struct *tsk, int cpu); 93extern void vtime_init_idle(struct task_struct *tsk, int cpu);
38#else 94#else /* !CONFIG_VIRT_CPU_ACCOUNTING_GEN */
39static inline void vtime_account_irq_exit(struct task_struct *tsk) 95static inline void vtime_account_irq_exit(struct task_struct *tsk)
40{ 96{
41 /* On hard|softirq exit we always account to hard|softirq cputime */ 97 /* On hard|softirq exit we always account to hard|softirq cputime */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index f487a4750b7f..a67fc1635592 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -811,6 +811,63 @@ do { \
811 __ret; \ 811 __ret; \
812}) 812})
813 813
814#define __wait_event_interruptible_lock_irq_timeout(wq, condition, \
815 lock, ret) \
816do { \
817 DEFINE_WAIT(__wait); \
818 \
819 for (;;) { \
820 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
821 if (condition) \
822 break; \
823 if (signal_pending(current)) { \
824 ret = -ERESTARTSYS; \
825 break; \
826 } \
827 spin_unlock_irq(&lock); \
828 ret = schedule_timeout(ret); \
829 spin_lock_irq(&lock); \
830 if (!ret) \
831 break; \
832 } \
833 finish_wait(&wq, &__wait); \
834} while (0)
835
836/**
837 * wait_event_interruptible_lock_irq_timeout - sleep until a condition gets true or a timeout elapses.
838 * The condition is checked under the lock. This is expected
839 * to be called with the lock taken.
840 * @wq: the waitqueue to wait on
841 * @condition: a C expression for the event to wait for
842 * @lock: a locked spinlock_t, which will be released before schedule()
843 * and reacquired afterwards.
844 * @timeout: timeout, in jiffies
845 *
846 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
847 * @condition evaluates to true or signal is received. The @condition is
848 * checked each time the waitqueue @wq is woken up.
849 *
850 * wake_up() has to be called after changing any variable that could
851 * change the result of the wait condition.
852 *
853 * This is supposed to be called while holding the lock. The lock is
854 * dropped before going to sleep and is reacquired afterwards.
855 *
856 * The function returns 0 if the @timeout elapsed, -ERESTARTSYS if it
857 * was interrupted by a signal, and the remaining jiffies otherwise
858 * if the condition evaluated to true before the timeout elapsed.
859 */
860#define wait_event_interruptible_lock_irq_timeout(wq, condition, lock, \
861 timeout) \
862({ \
863 int __ret = timeout; \
864 \
865 if (!(condition)) \
866 __wait_event_interruptible_lock_irq_timeout( \
867 wq, condition, lock, __ret); \
868 __ret; \
869})
870
814 871
815/* 872/*
816 * These are the old interfaces to sleep waiting for an event. 873 * These are the old interfaces to sleep waiting for an event.
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index a0ed78ab54d7..594521ba0d43 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -295,7 +295,12 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
295 * Documentation/workqueue.txt. 295 * Documentation/workqueue.txt.
296 */ 296 */
297enum { 297enum {
298 WQ_NON_REENTRANT = 1 << 0, /* guarantee non-reentrance */ 298 /*
299 * All wqs are now non-reentrant making the following flag
300 * meaningless. Will be removed.
301 */
302 WQ_NON_REENTRANT = 1 << 0, /* DEPRECATED */
303
299 WQ_UNBOUND = 1 << 1, /* not bound to any cpu */ 304 WQ_UNBOUND = 1 << 1, /* not bound to any cpu */
300 WQ_FREEZABLE = 1 << 2, /* freeze during suspend */ 305 WQ_FREEZABLE = 1 << 2, /* freeze during suspend */
301 WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */ 306 WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */