···4664665.3 swappiness467467468468Similar to /proc/sys/vm/swappiness, but affecting a hierarchy of groups only.469469+Please note that unlike the global swappiness, memcg knob set to 0470470+really prevents from any swapping even if there is a swap storage471471+available. This might lead to memcg OOM killer if there are no file472472+pages to reclaim.469473470474Following cgroups' swappiness can't be changed.471475- root cgroup (uses /proc/sys/vm/swappiness).
+12-4
Documentation/filesystems/proc.txt
···3333 2 Modifying System Parameters34343535 3 Per-Process Parameters3636- 3.1 /proc/<pid>/oom_score_adj - Adjust the oom-killer3636+ 3.1 /proc/<pid>/oom_adj & /proc/<pid>/oom_score_adj - Adjust the oom-killer3737 score3838 3.2 /proc/<pid>/oom_score - Display current oom-killer score3939 3.3 /proc/<pid>/io - Display the IO accounting fields···13201320CHAPTER 3: PER-PROCESS PARAMETERS13211321------------------------------------------------------------------------------1322132213231323-3.1 /proc/<pid>/oom_score_adj- Adjust the oom-killer score13231323+3.1 /proc/<pid>/oom_adj & /proc/<pid>/oom_score_adj- Adjust the oom-killer score13241324--------------------------------------------------------------------------------1325132513261326-This file can be used to adjust the badness heuristic used to select which13261326+These file can be used to adjust the badness heuristic used to select which13271327process gets killed in out of memory conditions.1328132813291329The badness heuristic assigns a value to each candidate task ranging from 0···13611361equivalent to discounting 50% of the task's allowed memory from being considered13621362as scoring against the task.1363136313641364+For backwards compatibility with previous kernels, /proc/<pid>/oom_adj may also13651365+be used to tune the badness score. Its acceptable values range from -1613661366+(OOM_ADJUST_MIN) to +15 (OOM_ADJUST_MAX) and a special value of -1713671367+(OOM_DISABLE) to disable oom killing entirely for that task. Its value is13681368+scaled linearly with /proc/<pid>/oom_score_adj.13691369+13641370The value of /proc/<pid>/oom_score_adj may be reduced no lower than the last13651371value set by a CAP_SYS_RESOURCE process. To reduce the value any lower13661372requires CAP_SYS_RESOURCE.···13811375-------------------------------------------------------------1382137613831377This file can be used to check the current score used by the oom-killer is for13841384-any given <pid>.13781378+any given <pid>. Use it together with /proc/<pid>/oom_score_adj to tune which13791379+process should be killed in an out-of-memory situation.13801380+13851381138613823.3 /proc/<pid>/io - Display the IO accounting fields13871383-------------------------------------------------------
+1-1
Documentation/networking/netdev-features.txt
···164164This requests that the NIC receive all possible frames, including errored165165frames (such as bad FCS, etc). This can be helpful when sniffing a link with166166bad packets on it. Some NICs may receive more packets if also put into normal167167-PROMISC mdoe.167167+PROMISC mode.
···10101111extern void sched_clock_postinit(void);1212extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);1313-extern void setup_sched_clock_needs_suspend(u32 (*read)(void), int bits,1414- unsigned long rate);15131614#endif
+6-6
arch/arm/include/asm/vfpmacros.h
···2727#if __LINUX_ARM_ARCH__ <= 62828 ldr \tmp, =elf_hwcap @ may not have MVFR regs2929 ldr \tmp, [\tmp, #0]3030- tst \tmp, #HWCAP_VFPv3D163131- ldceql p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}3232- addne \base, \base, #32*4 @ step over unused register space3030+ tst \tmp, #HWCAP_VFPD323131+ ldcnel p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}3232+ addeq \base, \base, #32*4 @ step over unused register space3333#else3434 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 03535 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field···5151#if __LINUX_ARM_ARCH__ <= 65252 ldr \tmp, =elf_hwcap @ may not have MVFR regs5353 ldr \tmp, [\tmp, #0]5454- tst \tmp, #HWCAP_VFPv3D165555- stceql p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}5656- addne \base, \base, #32*4 @ step over unused register space5454+ tst \tmp, #HWCAP_VFPD325555+ stcnel p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}5656+ addeq \base, \base, #32*4 @ step over unused register space5757#else5858 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 05959 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
···107107 update_sched_clock();108108}109109110110-void __init setup_sched_clock_needs_suspend(u32 (*read)(void), int bits,111111- unsigned long rate)112112-{113113- setup_sched_clock(read, bits, rate);114114- cd.needs_suspend = true;115115-}116116-117110void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate)118111{119112 unsigned long r, w;···182189static int sched_clock_suspend(void)183190{184191 sched_clock_poll(sched_clock_timer.data);185185- if (cd.needs_suspend)186186- cd.suspended = true;192192+ cd.suspended = true;187193 return 0;188194}189195190196static void sched_clock_resume(void)191197{192192- if (cd.needs_suspend) {193193- cd.epoch_cyc = read_sched_clock();194194- cd.epoch_cyc_copy = cd.epoch_cyc;195195- cd.suspended = false;196196- }198198+ cd.epoch_cyc = read_sched_clock();199199+ cd.epoch_cyc_copy = cd.epoch_cyc;200200+ cd.suspended = false;197201}198202199203static struct syscore_ops sched_clock_ops = {
+1-1
arch/arm/mach-at91/at91rm9200_devices.c
···68686969 /* Enable overcurrent notification */7070 for (i = 0; i < data->ports; i++) {7171- if (data->overcurrent_pin[i])7171+ if (gpio_is_valid(data->overcurrent_pin[i]))7272 at91_set_gpio_input(data->overcurrent_pin[i], 1);7373 }7474
+1-1
arch/arm/mach-at91/at91sam9260_devices.c
···72727373 /* Enable overcurrent notification */7474 for (i = 0; i < data->ports; i++) {7575- if (data->overcurrent_pin[i])7575+ if (gpio_is_valid(data->overcurrent_pin[i]))7676 at91_set_gpio_input(data->overcurrent_pin[i], 1);7777 }7878
+1-1
arch/arm/mach-at91/at91sam9261_devices.c
···72727373 /* Enable overcurrent notification */7474 for (i = 0; i < data->ports; i++) {7575- if (data->overcurrent_pin[i])7575+ if (gpio_is_valid(data->overcurrent_pin[i]))7676 at91_set_gpio_input(data->overcurrent_pin[i], 1);7777 }7878
+1-1
arch/arm/mach-at91/at91sam9263_devices.c
···78787979 /* Enable overcurrent notification */8080 for (i = 0; i < data->ports; i++) {8181- if (data->overcurrent_pin[i])8181+ if (gpio_is_valid(data->overcurrent_pin[i]))8282 at91_set_gpio_input(data->overcurrent_pin[i], 1);8383 }8484
···1919#include <linux/of.h>2020#include <linux/pinctrl/machine.h>2121#include <linux/platform_data/omap4-keypad.h>2222+#include <linux/platform_data/omap_ocp2scp.h>22232324#include <asm/mach-types.h>2425#include <asm/mach/map.h>···614613static inline void omap_init_vout(void) {}615614#endif616615616616+#if defined(CONFIG_OMAP_OCP2SCP) || defined(CONFIG_OMAP_OCP2SCP_MODULE)617617+static int count_ocp2scp_devices(struct omap_ocp2scp_dev *ocp2scp_dev)618618+{619619+ int cnt = 0;620620+621621+ while (ocp2scp_dev->drv_name != NULL) {622622+ cnt++;623623+ ocp2scp_dev++;624624+ }625625+626626+ return cnt;627627+}628628+629629+static void omap_init_ocp2scp(void)630630+{631631+ struct omap_hwmod *oh;632632+ struct platform_device *pdev;633633+ int bus_id = -1, dev_cnt = 0, i;634634+ struct omap_ocp2scp_dev *ocp2scp_dev;635635+ const char *oh_name, *name;636636+ struct omap_ocp2scp_platform_data *pdata;637637+638638+ if (!cpu_is_omap44xx())639639+ return;640640+641641+ oh_name = "ocp2scp_usb_phy";642642+ name = "omap-ocp2scp";643643+644644+ oh = omap_hwmod_lookup(oh_name);645645+ if (!oh) {646646+ pr_err("%s: could not find omap_hwmod for %s\n", __func__,647647+ oh_name);648648+ return;649649+ }650650+651651+ pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);652652+ if (!pdata) {653653+ pr_err("%s: No memory for ocp2scp pdata\n", __func__);654654+ return;655655+ }656656+657657+ ocp2scp_dev = oh->dev_attr;658658+ dev_cnt = count_ocp2scp_devices(ocp2scp_dev);659659+660660+ if (!dev_cnt) {661661+ pr_err("%s: No devices connected to ocp2scp\n", __func__);662662+ kfree(pdata);663663+ return;664664+ }665665+666666+ pdata->devices = kzalloc(sizeof(struct omap_ocp2scp_dev *)667667+ * dev_cnt, GFP_KERNEL);668668+ if (!pdata->devices) {669669+ pr_err("%s: No memory for ocp2scp pdata devices\n", __func__);670670+ kfree(pdata);671671+ return;672672+ }673673+674674+ for (i = 0; i < dev_cnt; i++, ocp2scp_dev++)675675+ pdata->devices[i] = ocp2scp_dev;676676+677677+ pdata->dev_cnt = dev_cnt;678678+679679+ pdev = omap_device_build(name, bus_id, oh, pdata, sizeof(*pdata), NULL,680680+ 0, false);681681+ if (IS_ERR(pdev)) {682682+ pr_err("Could not build omap_device for %s %s\n",683683+ name, oh_name);684684+ kfree(pdata->devices);685685+ kfree(pdata);686686+ return;687687+ }688688+}689689+#else690690+static inline void omap_init_ocp2scp(void) { }691691+#endif692692+617693/*-------------------------------------------------------------------------*/618694619695static int __init omap2_init_devices(void)···718640 omap_init_sham();719641 omap_init_aes();720642 omap_init_vout();643643+ omap_init_ocp2scp();721644722645 return 0;723646}
+49-14
arch/arm/mach-omap2/omap_hwmod.c
···422422}423423424424/**425425+ * _wait_softreset_complete - wait for an OCP softreset to complete426426+ * @oh: struct omap_hwmod * to wait on427427+ *428428+ * Wait until the IP block represented by @oh reports that its OCP429429+ * softreset is complete. This can be triggered by software (see430430+ * _ocp_softreset()) or by hardware upon returning from off-mode (one431431+ * example is HSMMC). Waits for up to MAX_MODULE_SOFTRESET_WAIT432432+ * microseconds. Returns the number of microseconds waited.433433+ */434434+static int _wait_softreset_complete(struct omap_hwmod *oh)435435+{436436+ struct omap_hwmod_class_sysconfig *sysc;437437+ u32 softrst_mask;438438+ int c = 0;439439+440440+ sysc = oh->class->sysc;441441+442442+ if (sysc->sysc_flags & SYSS_HAS_RESET_STATUS)443443+ omap_test_timeout((omap_hwmod_read(oh, sysc->syss_offs)444444+ & SYSS_RESETDONE_MASK),445445+ MAX_MODULE_SOFTRESET_WAIT, c);446446+ else if (sysc->sysc_flags & SYSC_HAS_RESET_STATUS) {447447+ softrst_mask = (0x1 << sysc->sysc_fields->srst_shift);448448+ omap_test_timeout(!(omap_hwmod_read(oh, sysc->sysc_offs)449449+ & softrst_mask),450450+ MAX_MODULE_SOFTRESET_WAIT, c);451451+ }452452+453453+ return c;454454+}455455+456456+/**425457 * _set_dmadisable: set OCP_SYSCONFIG.DMADISABLE bit in @v426458 * @oh: struct omap_hwmod *427459 *···13141282 if (!oh->class->sysc)13151283 return;1316128412851285+ /*12861286+ * Wait until reset has completed, this is needed as the IP12871287+ * block is reset automatically by hardware in some cases12881288+ * (off-mode for example), and the drivers require the12891289+ * IP to be ready when they access it12901290+ */12911291+ if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET)12921292+ _enable_optional_clocks(oh);12931293+ _wait_softreset_complete(oh);12941294+ if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET)12951295+ _disable_optional_clocks(oh);12961296+13171297 v = oh->_sysc_cache;13181298 sf = oh->class->sysc->sysc_flags;13191299···18481804 */18491805static int _ocp_softreset(struct omap_hwmod *oh)18501806{18511851- u32 v, softrst_mask;18071807+ u32 v;18521808 int c = 0;18531809 int ret = 0;18541810···18781834 if (oh->class->sysc->srst_udelay)18791835 udelay(oh->class->sysc->srst_udelay);1880183618811881- if (oh->class->sysc->sysc_flags & SYSS_HAS_RESET_STATUS)18821882- omap_test_timeout((omap_hwmod_read(oh,18831883- oh->class->sysc->syss_offs)18841884- & SYSS_RESETDONE_MASK),18851885- MAX_MODULE_SOFTRESET_WAIT, c);18861886- else if (oh->class->sysc->sysc_flags & SYSC_HAS_RESET_STATUS) {18871887- softrst_mask = (0x1 << oh->class->sysc->sysc_fields->srst_shift);18881888- omap_test_timeout(!(omap_hwmod_read(oh,18891889- oh->class->sysc->sysc_offs)18901890- & softrst_mask),18911891- MAX_MODULE_SOFTRESET_WAIT, c);18921892- }18931893-18371837+ c = _wait_softreset_complete(oh);18941838 if (c == MAX_MODULE_SOFTRESET_WAIT)18951839 pr_warning("omap_hwmod: %s: softreset failed (waited %d usec)\n",18961840 oh->name, MAX_MODULE_SOFTRESET_WAIT);···2383235123842352 if (oh->_state != _HWMOD_STATE_INITIALIZED)23852353 return -EINVAL;23542354+23552355+ if (oh->flags & HWMOD_EXT_OPT_MAIN_CLK)23562356+ return -EPERM;2386235723872358 if (oh->rst_lines_cnt == 0) {23882359 r = _enable(oh);
+36
arch/arm/mach-omap2/omap_hwmod_44xx_data.c
···2121#include <linux/io.h>2222#include <linux/platform_data/gpio-omap.h>2323#include <linux/power/smartreflex.h>2424+#include <linux/platform_data/omap_ocp2scp.h>24252526#include <plat/omap_hwmod.h>2627#include <plat/i2c.h>···21262125 .name = "mcpdm",21272126 .class = &omap44xx_mcpdm_hwmod_class,21282127 .clkdm_name = "abe_clkdm",21282128+ /*21292129+ * It's suspected that the McPDM requires an off-chip main21302130+ * functional clock, controlled via I2C. This IP block is21312131+ * currently reset very early during boot, before I2C is21322132+ * available, so it doesn't seem that we have any choice in21332133+ * the kernel other than to avoid resetting it.21342134+ */21352135+ .flags = HWMOD_EXT_OPT_MAIN_CLK,21292136 .mpu_irqs = omap44xx_mcpdm_irqs,21302137 .sdma_reqs = omap44xx_mcpdm_sdma_reqs,21312138 .main_clk = "mcpdm_fck",···26902681 .sysc = &omap44xx_ocp2scp_sysc,26912682};2692268326842684+/* ocp2scp dev_attr */26852685+static struct resource omap44xx_usb_phy_and_pll_addrs[] = {26862686+ {26872687+ .name = "usb_phy",26882688+ .start = 0x4a0ad080,26892689+ .end = 0x4a0ae000,26902690+ .flags = IORESOURCE_MEM,26912691+ },26922692+ {26932693+ /* XXX: Remove this once control module driver is in place */26942694+ .name = "ctrl_dev",26952695+ .start = 0x4a002300,26962696+ .end = 0x4a002303,26972697+ .flags = IORESOURCE_MEM,26982698+ },26992699+ { }27002700+};27012701+27022702+static struct omap_ocp2scp_dev ocp2scp_dev_attr[] = {27032703+ {27042704+ .drv_name = "omap-usb2",27052705+ .res = omap44xx_usb_phy_and_pll_addrs,27062706+ },27072707+ { }27082708+};27092709+26932710/* ocp2scp_usb_phy */26942711static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {26952712 .name = "ocp2scp_usb_phy",···27292694 .modulemode = MODULEMODE_HWCTRL,27302695 },27312696 },26972697+ .dev_attr = ocp2scp_dev_attr,27322698};2733269927342700/*
···264264265265 if (initialized) {266266 if (voltdm->pmic->i2c_high_speed != i2c_high_speed)267267- pr_warn("%s: I2C config for vdd_%s does not match other channels (%u).",267267+ pr_warn("%s: I2C config for vdd_%s does not match other channels (%u).\n",268268 __func__, voltdm->name, i2c_high_speed);269269 return;270270 }
···8686 gpio_set_value(SPITZ_GPIO_LED_GREEN, on);8787}88888989-static unsigned long gpio18_config[] = {9090- GPIO18_RDY,9191- GPIO18_GPIO,9292-};8989+static unsigned long gpio18_config = GPIO18_GPIO;93909491static void spitz_presuspend(void)9592{···109112 PGSR3 &= ~SPITZ_GPIO_G3_STROBE_BIT;110113 PGSR2 |= GPIO_bit(SPITZ_GPIO_KEY_STROBE0);111114112112- pxa2xx_mfp_config(&gpio18_config[0], 1);115115+ pxa2xx_mfp_config(&gpio18_config, 1);113116 gpio_request_one(18, GPIOF_OUT_INIT_HIGH, "Unknown");114117 gpio_free(18);115118···128131129132static void spitz_postsuspend(void)130133{131131- pxa2xx_mfp_config(&gpio18_config[1], 1);132134}133135134136static int spitz_should_wakeup(unsigned int resume_on_alarm)
+1-1
arch/arm/mm/alignment.c
···745745static int746746do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)747747{748748- union offset_union offset;748748+ union offset_union uninitialized_var(offset);749749 unsigned long instr = 0, instrptr;750750 int (*handler)(unsigned long addr, unsigned long instr, struct pt_regs *regs);751751 unsigned int type;
+6
arch/arm/plat-omap/include/plat/omap_hwmod.h
···443443 * in order to complete the reset. Optional clocks will be disabled444444 * again after the reset.445445 * HWMOD_16BIT_REG: Module has 16bit registers446446+ * HWMOD_EXT_OPT_MAIN_CLK: The only main functional clock source for447447+ * this IP block comes from an off-chip source and is not always448448+ * enabled. This prevents the hwmod code from being able to449449+ * enable and reset the IP block early. XXX Eventually it should450450+ * be possible to query the clock framework for this information.446451 */447452#define HWMOD_SWSUP_SIDLE (1 << 0)448453#define HWMOD_SWSUP_MSTANDBY (1 << 1)···458453#define HWMOD_NO_IDLEST (1 << 6)459454#define HWMOD_CONTROL_OPT_CLKS_IN_RESET (1 << 7)460455#define HWMOD_16BIT_REG (1 << 8)456456+#define HWMOD_EXT_OPT_MAIN_CLK (1 << 9)461457462458/*463459 * omap_hwmod._int_flags definitions
···701701 elf_hwcap |= HWCAP_VFPv3;702702703703 /*704704- * Check for VFPv3 D16. CPUs in this configuration705705- * only have 16 x 64bit registers.704704+ * Check for VFPv3 D16 and VFPv4 D16. CPUs in705705+ * this configuration only have 16 x 64bit706706+ * registers.706707 */707708 if (((fmrx(MVFR0) & MVFR0_A_SIMD_MASK)) == 1)708708- elf_hwcap |= HWCAP_VFPv3D16;709709+ elf_hwcap |= HWCAP_VFPv3D16; /* also v4-D16 */710710+ else711711+ elf_hwcap |= HWCAP_VFPD32;709712 }710713#endif711714 /*
+11
arch/arm/xen/enlighten.c
···166166 *pages = NULL;167167}168168EXPORT_SYMBOL_GPL(free_xenballooned_pages);169169+170170+/* In the hypervisor.S file. */171171+EXPORT_SYMBOL_GPL(HYPERVISOR_event_channel_op);172172+EXPORT_SYMBOL_GPL(HYPERVISOR_grant_table_op);173173+EXPORT_SYMBOL_GPL(HYPERVISOR_xen_version);174174+EXPORT_SYMBOL_GPL(HYPERVISOR_console_io);175175+EXPORT_SYMBOL_GPL(HYPERVISOR_sched_op);176176+EXPORT_SYMBOL_GPL(HYPERVISOR_hvm_op);177177+EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op);178178+EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op);179179+EXPORT_SYMBOL_GPL(privcmd_call);
···2525#include <asm/user.h>26262727typedef unsigned long elf_greg_t;2828-typedef unsigned long elf_freg_t[3];29283029#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))3130typedef elf_greg_t elf_gregset_t[ELF_NGREG];3232-3333-typedef struct user_fp elf_fpregset_t;3131+typedef struct user_fpsimd_state elf_fpregset_t;34323533#define EM_AARCH64 1833634···8486#define R_AARCH64_MOVW_PREL_G2 2918587#define R_AARCH64_MOVW_PREL_G2_NC 2928688#define R_AARCH64_MOVW_PREL_G3 2938787-88898990/*9091 * These are used to set parameters in the core dumps.
+2-3
arch/arm64/include/asm/fpsimd.h
···2525 * - FPSR and FPCR2626 * - 32 128-bit data registers2727 *2828- * Note that user_fp forms a prefix of this structure, which is relied2929- * upon in the ptrace FP/SIMD accessors. struct user_fpsimd_state must3030- * form a prefix of struct fpsimd_state.2828+ * Note that user_fpsimd forms a prefix of this structure, which is2929+ * relied upon in the ptrace FP/SIMD accessors.3130 */3231struct fpsimd_state {3332 union {
···1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.1515 */1616#ifdef CONFIG_COMPAT1717-#define __ARCH_WANT_COMPAT_IPC_PARSE_VERSION1817#define __ARCH_WANT_COMPAT_STAT641918#define __ARCH_WANT_SYS_GETHOSTNAME2019#define __ARCH_WANT_SYS_PAUSE
+2-8
arch/arm64/kernel/perf_event.c
···613613 ARMV8_PMUV3_PERFCTR_BUS_ACCESS = 0x19,614614 ARMV8_PMUV3_PERFCTR_MEM_ERROR = 0x1A,615615 ARMV8_PMUV3_PERFCTR_BUS_CYCLES = 0x1D,616616-617617- /*618618- * This isn't an architected event.619619- * We detect this event number and use the cycle counter instead.620620- */621621- ARMV8_PMUV3_PERFCTR_CPU_CYCLES = 0xFF,622616};623617624618/* PMUv3 HW events mapping. */625619static const unsigned armv8_pmuv3_perf_map[PERF_COUNT_HW_MAX] = {626626- [PERF_COUNT_HW_CPU_CYCLES] = ARMV8_PMUV3_PERFCTR_CPU_CYCLES,620620+ [PERF_COUNT_HW_CPU_CYCLES] = ARMV8_PMUV3_PERFCTR_CLOCK_CYCLES,627621 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV8_PMUV3_PERFCTR_INSTR_EXECUTED,628622 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV8_PMUV3_PERFCTR_L1_DCACHE_ACCESS,629623 [PERF_COUNT_HW_CACHE_MISSES] = ARMV8_PMUV3_PERFCTR_L1_DCACHE_REFILL,···11001106 unsigned long evtype = event->config_base & ARMV8_EVTYPE_EVENT;1101110711021108 /* Always place a cycle counter into the cycle counter. */11031103- if (evtype == ARMV8_PMUV3_PERFCTR_CPU_CYCLES) {11091109+ if (evtype == ARMV8_PMUV3_PERFCTR_CLOCK_CYCLES) {11041110 if (test_and_set_bit(ARMV8_IDX_CYCLE_COUNTER, cpuc->used_mask))11051111 return -EAGAIN;11061112
-18
arch/arm64/kernel/process.c
···310310}311311312312/*313313- * Fill in the task's elfregs structure for a core dump.314314- */315315-int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs)316316-{317317- elf_core_copy_regs(elfregs, task_pt_regs(t));318318- return 1;319319-}320320-321321-/*322322- * fill in the fpe structure for a core dump...323323- */324324-int dump_fpu (struct pt_regs *regs, struct user_fp *fp)325325-{326326- return 0;327327-}328328-EXPORT_SYMBOL(dump_fpu);329329-330330-/*331313 * Shuffle the argument into the correct register before calling the332314 * thread function. x1 is the thread argument, x2 is the pointer to333315 * the thread function, and x3 points to the exit function.
+1-2
arch/arm64/kernel/smp.c
···211211 * before we continue.212212 */213213 set_cpu_online(cpu, true);214214- while (!cpu_active(cpu))215215- cpu_relax();214214+ complete(&cpu_running);216215217216 /*218217 * OK, it's off to the idle thread for us
+1-1
arch/arm64/mm/init.c
···8080#ifdef CONFIG_ZONE_DMA328181 /* 4GB maximum for 32-bit only capable devices */8282 max_dma32 = min(max, MAX_DMA32_PFN);8383- zone_size[ZONE_DMA32] = max_dma32 - min;8383+ zone_size[ZONE_DMA32] = max(min, max_dma32) - min;8484#endif8585 zone_size[ZONE_NORMAL] = max - max_dma32;8686
+2-1
arch/h8300/include/asm/cache.h
···22#define __ARCH_H8300_CACHE_H3344/* bytes per L1 cache line */55-#define L1_CACHE_BYTES 455+#define L1_CACHE_SHIFT 266+#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)6778/* m68k-elf-gcc 2.95.2 doesn't like these */89
···1414#endif15151616#include <linux/compiler.h>1717-#include <linux/irqflags.h>1817#include <linux/types.h>1918#include <asm/barrier.h>2019#include <asm/byteorder.h> /* sigh ... */···4344#define smp_mb__before_clear_bit() smp_mb__before_llsc()4445#define smp_mb__after_clear_bit() smp_llsc_mb()45464747+4848+/*4949+ * These are the "slower" versions of the functions and are in bitops.c.5050+ * These functions call raw_local_irq_{save,restore}().5151+ */5252+void __mips_set_bit(unsigned long nr, volatile unsigned long *addr);5353+void __mips_clear_bit(unsigned long nr, volatile unsigned long *addr);5454+void __mips_change_bit(unsigned long nr, volatile unsigned long *addr);5555+int __mips_test_and_set_bit(unsigned long nr,5656+ volatile unsigned long *addr);5757+int __mips_test_and_set_bit_lock(unsigned long nr,5858+ volatile unsigned long *addr);5959+int __mips_test_and_clear_bit(unsigned long nr,6060+ volatile unsigned long *addr);6161+int __mips_test_and_change_bit(unsigned long nr,6262+ volatile unsigned long *addr);6363+6464+4665/*4766 * set_bit - Atomically set a bit in memory4867 * @nr: the bit to set···7457static inline void set_bit(unsigned long nr, volatile unsigned long *addr)7558{7659 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);7777- unsigned short bit = nr & SZLONG_MASK;6060+ int bit = nr & SZLONG_MASK;7861 unsigned long temp;79628063 if (kernel_uses_llsc && R10000_LLSC_WAR) {···10992 : "=&r" (temp), "+m" (*m)11093 : "ir" (1UL << bit));11194 } while (unlikely(!temp));112112- } else {113113- volatile unsigned long *a = addr;114114- unsigned long mask;115115- unsigned long flags;116116-117117- a += nr >> SZLONG_LOG;118118- mask = 1UL << bit;119119- raw_local_irq_save(flags);120120- *a |= mask;121121- raw_local_irq_restore(flags);122122- }9595+ } else9696+ __mips_set_bit(nr, addr);12397}1249812599/*···126118static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)127119{128120 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);129129- unsigned short bit = nr & SZLONG_MASK;121121+ int bit = nr & SZLONG_MASK;130122 unsigned long temp;131123132124 if (kernel_uses_llsc && R10000_LLSC_WAR) {···161153 : "=&r" (temp), "+m" (*m)162154 : "ir" (~(1UL << bit)));163155 } while (unlikely(!temp));164164- } else {165165- volatile unsigned long *a = addr;166166- unsigned long mask;167167- unsigned long flags;168168-169169- a += nr >> SZLONG_LOG;170170- mask = 1UL << bit;171171- raw_local_irq_save(flags);172172- *a &= ~mask;173173- raw_local_irq_restore(flags);174174- }156156+ } else157157+ __mips_clear_bit(nr, addr);175158}176159177160/*···190191 */191192static inline void change_bit(unsigned long nr, volatile unsigned long *addr)192193{193193- unsigned short bit = nr & SZLONG_MASK;194194+ int bit = nr & SZLONG_MASK;194195195196 if (kernel_uses_llsc && R10000_LLSC_WAR) {196197 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);···219220 : "=&r" (temp), "+m" (*m)220221 : "ir" (1UL << bit));221222 } while (unlikely(!temp));222222- } else {223223- volatile unsigned long *a = addr;224224- unsigned long mask;225225- unsigned long flags;226226-227227- a += nr >> SZLONG_LOG;228228- mask = 1UL << bit;229229- raw_local_irq_save(flags);230230- *a ^= mask;231231- raw_local_irq_restore(flags);232232- }223223+ } else224224+ __mips_change_bit(nr, addr);233225}234226235227/*···234244static inline int test_and_set_bit(unsigned long nr,235245 volatile unsigned long *addr)236246{237237- unsigned short bit = nr & SZLONG_MASK;247247+ int bit = nr & SZLONG_MASK;238248 unsigned long res;239249240250 smp_mb__before_llsc();···271281 } while (unlikely(!res));272282273283 res = temp & (1UL << bit);274274- } else {275275- volatile unsigned long *a = addr;276276- unsigned long mask;277277- unsigned long flags;278278-279279- a += nr >> SZLONG_LOG;280280- mask = 1UL << bit;281281- raw_local_irq_save(flags);282282- res = (mask & *a);283283- *a |= mask;284284- raw_local_irq_restore(flags);285285- }284284+ } else285285+ res = __mips_test_and_set_bit(nr, addr);286286287287 smp_llsc_mb();288288···290310static inline int test_and_set_bit_lock(unsigned long nr,291311 volatile unsigned long *addr)292312{293293- unsigned short bit = nr & SZLONG_MASK;313313+ int bit = nr & SZLONG_MASK;294314 unsigned long res;295315296316 if (kernel_uses_llsc && R10000_LLSC_WAR) {···325345 } while (unlikely(!res));326346327347 res = temp & (1UL << bit);328328- } else {329329- volatile unsigned long *a = addr;330330- unsigned long mask;331331- unsigned long flags;332332-333333- a += nr >> SZLONG_LOG;334334- mask = 1UL << bit;335335- raw_local_irq_save(flags);336336- res = (mask & *a);337337- *a |= mask;338338- raw_local_irq_restore(flags);339339- }348348+ } else349349+ res = __mips_test_and_set_bit_lock(nr, addr);340350341351 smp_llsc_mb();342352···343373static inline int test_and_clear_bit(unsigned long nr,344374 volatile unsigned long *addr)345375{346346- unsigned short bit = nr & SZLONG_MASK;376376+ int bit = nr & SZLONG_MASK;347377 unsigned long res;348378349379 smp_mb__before_llsc();···398428 } while (unlikely(!res));399429400430 res = temp & (1UL << bit);401401- } else {402402- volatile unsigned long *a = addr;403403- unsigned long mask;404404- unsigned long flags;405405-406406- a += nr >> SZLONG_LOG;407407- mask = 1UL << bit;408408- raw_local_irq_save(flags);409409- res = (mask & *a);410410- *a &= ~mask;411411- raw_local_irq_restore(flags);412412- }431431+ } else432432+ res = __mips_test_and_clear_bit(nr, addr);413433414434 smp_llsc_mb();415435···417457static inline int test_and_change_bit(unsigned long nr,418458 volatile unsigned long *addr)419459{420420- unsigned short bit = nr & SZLONG_MASK;460460+ int bit = nr & SZLONG_MASK;421461 unsigned long res;422462423463 smp_mb__before_llsc();···454494 } while (unlikely(!res));455495456496 res = temp & (1UL << bit);457457- } else {458458- volatile unsigned long *a = addr;459459- unsigned long mask;460460- unsigned long flags;461461-462462- a += nr >> SZLONG_LOG;463463- mask = 1UL << bit;464464- raw_local_irq_save(flags);465465- res = (mask & *a);466466- *a ^= mask;467467- raw_local_irq_restore(flags);468468- }497497+ } else498498+ res = __mips_test_and_change_bit(nr, addr);469499470500 smp_llsc_mb();471501
···11+/*22+ * This file is subject to the terms and conditions of the GNU General Public33+ * License. See the file "COPYING" in the main directory of this archive44+ * for more details.55+ *66+ * Copyright (c) 1994-1997, 99, 2000, 06, 07 Ralf Baechle (ralf@linux-mips.org)77+ * Copyright (c) 1999, 2000 Silicon Graphics, Inc.88+ */99+#include <linux/bitops.h>1010+#include <linux/irqflags.h>1111+#include <linux/export.h>1212+1313+1414+/**1515+ * __mips_set_bit - Atomically set a bit in memory. This is called by1616+ * set_bit() if it cannot find a faster solution.1717+ * @nr: the bit to set1818+ * @addr: the address to start counting from1919+ */2020+void __mips_set_bit(unsigned long nr, volatile unsigned long *addr)2121+{2222+ volatile unsigned long *a = addr;2323+ unsigned bit = nr & SZLONG_MASK;2424+ unsigned long mask;2525+ unsigned long flags;2626+2727+ a += nr >> SZLONG_LOG;2828+ mask = 1UL << bit;2929+ raw_local_irq_save(flags);3030+ *a |= mask;3131+ raw_local_irq_restore(flags);3232+}3333+EXPORT_SYMBOL(__mips_set_bit);3434+3535+3636+/**3737+ * __mips_clear_bit - Clears a bit in memory. This is called by clear_bit() if3838+ * it cannot find a faster solution.3939+ * @nr: Bit to clear4040+ * @addr: Address to start counting from4141+ */4242+void __mips_clear_bit(unsigned long nr, volatile unsigned long *addr)4343+{4444+ volatile unsigned long *a = addr;4545+ unsigned bit = nr & SZLONG_MASK;4646+ unsigned long mask;4747+ unsigned long flags;4848+4949+ a += nr >> SZLONG_LOG;5050+ mask = 1UL << bit;5151+ raw_local_irq_save(flags);5252+ *a &= ~mask;5353+ raw_local_irq_restore(flags);5454+}5555+EXPORT_SYMBOL(__mips_clear_bit);5656+5757+5858+/**5959+ * __mips_change_bit - Toggle a bit in memory. This is called by change_bit()6060+ * if it cannot find a faster solution.6161+ * @nr: Bit to change6262+ * @addr: Address to start counting from6363+ */6464+void __mips_change_bit(unsigned long nr, volatile unsigned long *addr)6565+{6666+ volatile unsigned long *a = addr;6767+ unsigned bit = nr & SZLONG_MASK;6868+ unsigned long mask;6969+ unsigned long flags;7070+7171+ a += nr >> SZLONG_LOG;7272+ mask = 1UL << bit;7373+ raw_local_irq_save(flags);7474+ *a ^= mask;7575+ raw_local_irq_restore(flags);7676+}7777+EXPORT_SYMBOL(__mips_change_bit);7878+7979+8080+/**8181+ * __mips_test_and_set_bit - Set a bit and return its old value. This is8282+ * called by test_and_set_bit() if it cannot find a faster solution.8383+ * @nr: Bit to set8484+ * @addr: Address to count from8585+ */8686+int __mips_test_and_set_bit(unsigned long nr,8787+ volatile unsigned long *addr)8888+{8989+ volatile unsigned long *a = addr;9090+ unsigned bit = nr & SZLONG_MASK;9191+ unsigned long mask;9292+ unsigned long flags;9393+ unsigned long res;9494+9595+ a += nr >> SZLONG_LOG;9696+ mask = 1UL << bit;9797+ raw_local_irq_save(flags);9898+ res = (mask & *a);9999+ *a |= mask;100100+ raw_local_irq_restore(flags);101101+ return res;102102+}103103+EXPORT_SYMBOL(__mips_test_and_set_bit);104104+105105+106106+/**107107+ * __mips_test_and_set_bit_lock - Set a bit and return its old value. This is108108+ * called by test_and_set_bit_lock() if it cannot find a faster solution.109109+ * @nr: Bit to set110110+ * @addr: Address to count from111111+ */112112+int __mips_test_and_set_bit_lock(unsigned long nr,113113+ volatile unsigned long *addr)114114+{115115+ volatile unsigned long *a = addr;116116+ unsigned bit = nr & SZLONG_MASK;117117+ unsigned long mask;118118+ unsigned long flags;119119+ unsigned long res;120120+121121+ a += nr >> SZLONG_LOG;122122+ mask = 1UL << bit;123123+ raw_local_irq_save(flags);124124+ res = (mask & *a);125125+ *a |= mask;126126+ raw_local_irq_restore(flags);127127+ return res;128128+}129129+EXPORT_SYMBOL(__mips_test_and_set_bit_lock);130130+131131+132132+/**133133+ * __mips_test_and_clear_bit - Clear a bit and return its old value. This is134134+ * called by test_and_clear_bit() if it cannot find a faster solution.135135+ * @nr: Bit to clear136136+ * @addr: Address to count from137137+ */138138+int __mips_test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)139139+{140140+ volatile unsigned long *a = addr;141141+ unsigned bit = nr & SZLONG_MASK;142142+ unsigned long mask;143143+ unsigned long flags;144144+ unsigned long res;145145+146146+ a += nr >> SZLONG_LOG;147147+ mask = 1UL << bit;148148+ raw_local_irq_save(flags);149149+ res = (mask & *a);150150+ *a &= ~mask;151151+ raw_local_irq_restore(flags);152152+ return res;153153+}154154+EXPORT_SYMBOL(__mips_test_and_clear_bit);155155+156156+157157+/**158158+ * __mips_test_and_change_bit - Change a bit and return its old value. This is159159+ * called by test_and_change_bit() if it cannot find a faster solution.160160+ * @nr: Bit to change161161+ * @addr: Address to count from162162+ */163163+int __mips_test_and_change_bit(unsigned long nr, volatile unsigned long *addr)164164+{165165+ volatile unsigned long *a = addr;166166+ unsigned bit = nr & SZLONG_MASK;167167+ unsigned long mask;168168+ unsigned long flags;169169+ unsigned long res;170170+171171+ a += nr >> SZLONG_LOG;172172+ mask = 1UL << bit;173173+ raw_local_irq_save(flags);174174+ res = (mask & *a);175175+ *a ^= mask;176176+ raw_local_irq_restore(flags);177177+ return res;178178+}179179+EXPORT_SYMBOL(__mips_test_and_change_bit);
+176
arch/mips/lib/mips-atomic.c
···11+/*22+ * This file is subject to the terms and conditions of the GNU General Public33+ * License. See the file "COPYING" in the main directory of this archive44+ * for more details.55+ *66+ * Copyright (C) 1994, 95, 96, 97, 98, 99, 2003 by Ralf Baechle77+ * Copyright (C) 1996 by Paul M. Antoine88+ * Copyright (C) 1999 Silicon Graphics99+ * Copyright (C) 2000 MIPS Technologies, Inc.1010+ */1111+#include <asm/irqflags.h>1212+#include <asm/hazards.h>1313+#include <linux/compiler.h>1414+#include <linux/preempt.h>1515+#include <linux/export.h>1616+1717+#if !defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_MIPS_MT_SMTC)1818+1919+/*2020+ * For cli() we have to insert nops to make sure that the new value2121+ * has actually arrived in the status register before the end of this2222+ * macro.2323+ * R4000/R4400 need three nops, the R4600 two nops and the R10000 needs2424+ * no nops at all.2525+ */2626+/*2727+ * For TX49, operating only IE bit is not enough.2828+ *2929+ * If mfc0 $12 follows store and the mfc0 is last instruction of a3030+ * page and fetching the next instruction causes TLB miss, the result3131+ * of the mfc0 might wrongly contain EXL bit.3232+ *3333+ * ERT-TX49H2-027, ERT-TX49H3-012, ERT-TX49HL3-006, ERT-TX49H4-0083434+ *3535+ * Workaround: mask EXL bit of the result or place a nop before mfc0.3636+ */3737+__asm__(3838+ " .macro arch_local_irq_disable\n"3939+ " .set push \n"4040+ " .set noat \n"4141+#ifdef CONFIG_MIPS_MT_SMTC4242+ " mfc0 $1, $2, 1 \n"4343+ " ori $1, 0x400 \n"4444+ " .set noreorder \n"4545+ " mtc0 $1, $2, 1 \n"4646+#elif defined(CONFIG_CPU_MIPSR2)4747+ /* see irqflags.h for inline function */4848+#else4949+ " mfc0 $1,$12 \n"5050+ " ori $1,0x1f \n"5151+ " xori $1,0x1f \n"5252+ " .set noreorder \n"5353+ " mtc0 $1,$12 \n"5454+#endif5555+ " irq_disable_hazard \n"5656+ " .set pop \n"5757+ " .endm \n");5858+5959+void arch_local_irq_disable(void)6060+{6161+ preempt_disable();6262+ __asm__ __volatile__(6363+ "arch_local_irq_disable"6464+ : /* no outputs */6565+ : /* no inputs */6666+ : "memory");6767+ preempt_enable();6868+}6969+EXPORT_SYMBOL(arch_local_irq_disable);7070+7171+7272+__asm__(7373+ " .macro arch_local_irq_save result \n"7474+ " .set push \n"7575+ " .set reorder \n"7676+ " .set noat \n"7777+#ifdef CONFIG_MIPS_MT_SMTC7878+ " mfc0 \\result, $2, 1 \n"7979+ " ori $1, \\result, 0x400 \n"8080+ " .set noreorder \n"8181+ " mtc0 $1, $2, 1 \n"8282+ " andi \\result, \\result, 0x400 \n"8383+#elif defined(CONFIG_CPU_MIPSR2)8484+ /* see irqflags.h for inline function */8585+#else8686+ " mfc0 \\result, $12 \n"8787+ " ori $1, \\result, 0x1f \n"8888+ " xori $1, 0x1f \n"8989+ " .set noreorder \n"9090+ " mtc0 $1, $12 \n"9191+#endif9292+ " irq_disable_hazard \n"9393+ " .set pop \n"9494+ " .endm \n");9595+9696+unsigned long arch_local_irq_save(void)9797+{9898+ unsigned long flags;9999+ preempt_disable();100100+ asm volatile("arch_local_irq_save\t%0"101101+ : "=r" (flags)102102+ : /* no inputs */103103+ : "memory");104104+ preempt_enable();105105+ return flags;106106+}107107+EXPORT_SYMBOL(arch_local_irq_save);108108+109109+110110+__asm__(111111+ " .macro arch_local_irq_restore flags \n"112112+ " .set push \n"113113+ " .set noreorder \n"114114+ " .set noat \n"115115+#ifdef CONFIG_MIPS_MT_SMTC116116+ "mfc0 $1, $2, 1 \n"117117+ "andi \\flags, 0x400 \n"118118+ "ori $1, 0x400 \n"119119+ "xori $1, 0x400 \n"120120+ "or \\flags, $1 \n"121121+ "mtc0 \\flags, $2, 1 \n"122122+#elif defined(CONFIG_CPU_MIPSR2) && defined(CONFIG_IRQ_CPU)123123+ /* see irqflags.h for inline function */124124+#elif defined(CONFIG_CPU_MIPSR2)125125+ /* see irqflags.h for inline function */126126+#else127127+ " mfc0 $1, $12 \n"128128+ " andi \\flags, 1 \n"129129+ " ori $1, 0x1f \n"130130+ " xori $1, 0x1f \n"131131+ " or \\flags, $1 \n"132132+ " mtc0 \\flags, $12 \n"133133+#endif134134+ " irq_disable_hazard \n"135135+ " .set pop \n"136136+ " .endm \n");137137+138138+void arch_local_irq_restore(unsigned long flags)139139+{140140+ unsigned long __tmp1;141141+142142+#ifdef CONFIG_MIPS_MT_SMTC143143+ /*144144+ * SMTC kernel needs to do a software replay of queued145145+ * IPIs, at the cost of branch and call overhead on each146146+ * local_irq_restore()147147+ */148148+ if (unlikely(!(flags & 0x0400)))149149+ smtc_ipi_replay();150150+#endif151151+ preempt_disable();152152+ __asm__ __volatile__(153153+ "arch_local_irq_restore\t%0"154154+ : "=r" (__tmp1)155155+ : "0" (flags)156156+ : "memory");157157+ preempt_enable();158158+}159159+EXPORT_SYMBOL(arch_local_irq_restore);160160+161161+162162+void __arch_local_irq_restore(unsigned long flags)163163+{164164+ unsigned long __tmp1;165165+166166+ preempt_disable();167167+ __asm__ __volatile__(168168+ "arch_local_irq_restore\t%0"169169+ : "=r" (__tmp1)170170+ : "0" (flags)171171+ : "memory");172172+ preempt_enable();173173+}174174+EXPORT_SYMBOL(__arch_local_irq_restore);175175+176176+#endif /* !defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_MIPS_MT_SMTC) */
···527527MODULE_DESCRIPTION("DES & Triple DES EDE Cipher Algorithms, sparc64 des opcode accelerated");528528529529MODULE_ALIAS("des");530530+531531+#include "crop_devid.c"
···11/* atomic.h: Thankfully the V9 is at least reasonable for this22 * stuff.33 *44- * Copyright (C) 1996, 1997, 2000 David S. Miller (davem@redhat.com)44+ * Copyright (C) 1996, 1997, 2000, 2012 David S. Miller (davem@redhat.com)55 */6677#ifndef __ARCH_SPARC64_ATOMIC__···105105}106106107107#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)108108+109109+extern long atomic64_dec_if_positive(atomic64_t *v);108110109111/* Atomic operations are already serializing */110112#define smp_mb__before_atomic_dec() barrier()
+59-10
arch/sparc/include/asm/backoff.h
···11#ifndef _SPARC64_BACKOFF_H22#define _SPARC64_BACKOFF_H3344+/* The macros in this file implement an exponential backoff facility55+ * for atomic operations.66+ *77+ * When multiple threads compete on an atomic operation, it is88+ * possible for one thread to be continually denied a successful99+ * completion of the compare-and-swap instruction. Heavily1010+ * threaded cpu implementations like Niagara can compound this1111+ * problem even further.1212+ *1313+ * When an atomic operation fails and needs to be retried, we spin a1414+ * certain number of times. At each subsequent failure of the same1515+ * operation we double the spin count, realizing an exponential1616+ * backoff.1717+ *1818+ * When we spin, we try to use an operation that will cause the1919+ * current cpu strand to block, and therefore make the core fully2020+ * available to any other other runnable strands. There are two2121+ * options, based upon cpu capabilities.2222+ *2323+ * On all cpus prior to SPARC-T4 we do three dummy reads of the2424+ * condition code register. Each read blocks the strand for something2525+ * between 40 and 50 cpu cycles.2626+ *2727+ * For SPARC-T4 and later we have a special "pause" instruction2828+ * available. This is implemented using writes to register %asr27.2929+ * The cpu will block the number of cycles written into the register,3030+ * unless a disrupting trap happens first. SPARC-T4 specifically3131+ * implements pause with a granularity of 8 cycles. Each strand has3232+ * an internal pause counter which decrements every 8 cycles. So the3333+ * chip shifts the %asr27 value down by 3 bits, and writes the result3434+ * into the pause counter. If a value smaller than 8 is written, the3535+ * chip blocks for 1 cycle.3636+ *3737+ * To achieve the same amount of backoff as the three %ccr reads give3838+ * on earlier chips, we shift the backoff value up by 7 bits. (Three3939+ * %ccr reads block for about 128 cycles, 1 << 7 == 128) We write the4040+ * whole amount we want to block into the pause register, rather than4141+ * loop writing 128 each time.4242+ */4343+444#define BACKOFF_LIMIT (4 * 1024)545646#ifdef CONFIG_SMP···5111#define BACKOFF_LABEL(spin_label, continue_label) \5212 spin_label53135454-#define BACKOFF_SPIN(reg, tmp, label) \5555- mov reg, tmp; \5656-88: brnz,pt tmp, 88b; \5757- sub tmp, 1, tmp; \5858- set BACKOFF_LIMIT, tmp; \5959- cmp reg, tmp; \6060- bg,pn %xcc, label; \6161- nop; \6262- ba,pt %xcc, label; \6363- sllx reg, 1, reg;1414+#define BACKOFF_SPIN(reg, tmp, label) \1515+ mov reg, tmp; \1616+88: rd %ccr, %g0; \1717+ rd %ccr, %g0; \1818+ rd %ccr, %g0; \1919+ .section .pause_3insn_patch,"ax";\2020+ .word 88b; \2121+ sllx tmp, 7, tmp; \2222+ wr tmp, 0, %asr27; \2323+ clr tmp; \2424+ .previous; \2525+ brnz,pt tmp, 88b; \2626+ sub tmp, 1, tmp; \2727+ set BACKOFF_LIMIT, tmp; \2828+ cmp reg, tmp; \2929+ bg,pn %xcc, label; \3030+ nop; \3131+ ba,pt %xcc, label; \3232+ sllx reg, 1, reg;64336534#else6635
+3-2
arch/sparc/include/asm/compat.h
···232232 struct pt_regs *regs = current_thread_info()->kregs;233233 unsigned long usp = regs->u_regs[UREG_I6];234234235235- if (!(test_thread_flag(TIF_32BIT)))235235+ if (test_thread_64bit_stack(usp))236236 usp += STACK_BIAS;237237- else237237+238238+ if (test_thread_flag(TIF_32BIT))238239 usp &= 0xffffffffUL;239240240241 usp -= len;
+16-1
arch/sparc/include/asm/processor_64.h
···196196#define KSTK_EIP(tsk) (task_pt_regs(tsk)->tpc)197197#define KSTK_ESP(tsk) (task_pt_regs(tsk)->u_regs[UREG_FP])198198199199-#define cpu_relax() barrier()199199+/* Please see the commentary in asm/backoff.h for a description of200200+ * what these instructions are doing and how they have been choosen.201201+ * To make a long story short, we are trying to yield the current cpu202202+ * strand during busy loops.203203+ */204204+#define cpu_relax() asm volatile("\n99:\n\t" \205205+ "rd %%ccr, %%g0\n\t" \206206+ "rd %%ccr, %%g0\n\t" \207207+ "rd %%ccr, %%g0\n\t" \208208+ ".section .pause_3insn_patch,\"ax\"\n\t"\209209+ ".word 99b\n\t" \210210+ "wr %%g0, 128, %%asr27\n\t" \211211+ "nop\n\t" \212212+ "nop\n\t" \213213+ ".previous" \214214+ ::: "memory")200215201216/* Prefetch support. This is tuned for UltraSPARC-III and later.202217 * UltraSPARC-I will treat these as nops, and UltraSPARC-II has
+5
arch/sparc/include/asm/prom.h
···6363extern void irq_trans_init(struct device_node *dp);6464extern char *build_path_component(struct device_node *dp);65656666+/* SPARC has a local implementation */6767+extern int of_address_to_resource(struct device_node *dev, int index,6868+ struct resource *r);6969+#define of_address_to_resource of_address_to_resource7070+6671#endif /* __KERNEL__ */6772#endif /* _SPARC_PROM_H */
···5656static void leon_handle_ext_irq(unsigned int irq, struct irq_desc *desc)5757{5858 unsigned int eirq;5959+ struct irq_bucket *p;5960 int cpu = sparc_leon3_cpuid();60616162 eirq = leon_eirq_get(cpu);6262- if ((eirq & 0x10) && irq_map[eirq]->irq) /* bit4 tells if IRQ happened */6363- generic_handle_irq(irq_map[eirq]->irq);6363+ p = irq_map[eirq];6464+ if ((eirq & 0x10) && p && p->irq) /* bit4 tells if IRQ happened */6565+ generic_handle_irq(p->irq);6466}65676668/* The extended IRQ controller has been found, this function registers it */
+16-6
arch/sparc/kernel/perf_event.c
···1762176217631763 ufp = regs->u_regs[UREG_I6] & 0xffffffffUL;17641764 do {17651765- struct sparc_stackf32 *usf, sf;17661765 unsigned long pc;1767176617681768- usf = (struct sparc_stackf32 *) ufp;17691769- if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))17701770- break;17671767+ if (thread32_stack_is_64bit(ufp)) {17681768+ struct sparc_stackf *usf, sf;1771176917721772- pc = sf.callers_pc;17731773- ufp = (unsigned long)sf.fp;17701770+ ufp += STACK_BIAS;17711771+ usf = (struct sparc_stackf *) ufp;17721772+ if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))17731773+ break;17741774+ pc = sf.callers_pc & 0xffffffff;17751775+ ufp = ((unsigned long) sf.fp) & 0xffffffff;17761776+ } else {17771777+ struct sparc_stackf32 *usf, sf;17781778+ usf = (struct sparc_stackf32 *) ufp;17791779+ if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))17801780+ break;17811781+ pc = sf.callers_pc;17821782+ ufp = (unsigned long)sf.fp;17831783+ }17741784 perf_callchain_store(entry, pc);17751785 } while (entry->nr < PERF_MAX_STACK_DEPTH);17761786}
+23-19
arch/sparc/kernel/process_64.c
···452452/* It's a bit more tricky when 64-bit tasks are involved... */453453static unsigned long clone_stackframe(unsigned long csp, unsigned long psp)454454{455455+ bool stack_64bit = test_thread_64bit_stack(psp);455456 unsigned long fp, distance, rval;456457457457- if (!(test_thread_flag(TIF_32BIT))) {458458+ if (stack_64bit) {458459 csp += STACK_BIAS;459460 psp += STACK_BIAS;460461 __get_user(fp, &(((struct reg_window __user *)psp)->ins[6]));461462 fp += STACK_BIAS;463463+ if (test_thread_flag(TIF_32BIT))464464+ fp &= 0xffffffff;462465 } else463466 __get_user(fp, &(((struct reg_window32 __user *)psp)->ins[6]));464467···475472 rval = (csp - distance);476473 if (copy_in_user((void __user *) rval, (void __user *) psp, distance))477474 rval = 0;478478- else if (test_thread_flag(TIF_32BIT)) {475475+ else if (!stack_64bit) {479476 if (put_user(((u32)csp),480477 &(((struct reg_window32 __user *)rval)->ins[6])))481478 rval = 0;···510507511508 flush_user_windows();512509 if ((window = get_thread_wsaved()) != 0) {513513- int winsize = sizeof(struct reg_window);514514- int bias = 0;515515-516516- if (test_thread_flag(TIF_32BIT))517517- winsize = sizeof(struct reg_window32);518518- else519519- bias = STACK_BIAS;520520-521510 window -= 1;522511 do {523523- unsigned long sp = (t->rwbuf_stkptrs[window] + bias);524512 struct reg_window *rwin = &t->reg_window[window];513513+ int winsize = sizeof(struct reg_window);514514+ unsigned long sp;515515+516516+ sp = t->rwbuf_stkptrs[window];517517+518518+ if (test_thread_64bit_stack(sp))519519+ sp += STACK_BIAS;520520+ else521521+ winsize = sizeof(struct reg_window32);525522526523 if (!copy_to_user((char __user *)sp, rwin, winsize)) {527524 shift_window_buffer(window, get_thread_wsaved() - 1, t);···547544{548545 struct thread_info *t = current_thread_info();549546 unsigned long window;550550- int winsize = sizeof(struct reg_window);551551- int bias = 0;552552-553553- if (test_thread_flag(TIF_32BIT))554554- winsize = sizeof(struct reg_window32);555555- else556556- bias = STACK_BIAS;557547558548 flush_user_windows();559549 window = get_thread_wsaved();···554558 if (likely(window != 0)) {555559 window -= 1;556560 do {557557- unsigned long sp = (t->rwbuf_stkptrs[window] + bias);558561 struct reg_window *rwin = &t->reg_window[window];562562+ int winsize = sizeof(struct reg_window);563563+ unsigned long sp;564564+565565+ sp = t->rwbuf_stkptrs[window];566566+567567+ if (test_thread_64bit_stack(sp))568568+ sp += STACK_BIAS;569569+ else570570+ winsize = sizeof(struct reg_window32);559571560572 if (unlikely(sp & 0x7UL))561573 stack_unaligned(sp);
+2-2
arch/sparc/kernel/ptrace_64.c
···151151{152152 unsigned long rw_addr = regs->u_regs[UREG_I6];153153154154- if (test_tsk_thread_flag(current, TIF_32BIT)) {154154+ if (!test_thread_64bit_stack(rw_addr)) {155155 struct reg_window32 win32;156156 int i;157157···176176{177177 unsigned long rw_addr = regs->u_regs[UREG_I6];178178179179- if (test_tsk_thread_flag(current, TIF_32BIT)) {179179+ if (!test_thread_64bit_stack(rw_addr)) {180180 struct reg_window32 win32;181181 int i;182182
+21
arch/sparc/kernel/setup_64.c
···316316 }317317}318318319319+static void __init pause_patch(void)320320+{321321+ struct pause_patch_entry *p;322322+323323+ p = &__pause_3insn_patch;324324+ while (p < &__pause_3insn_patch_end) {325325+ unsigned long i, addr = p->addr;326326+327327+ for (i = 0; i < 3; i++) {328328+ *(unsigned int *) (addr + (i * 4)) = p->insns[i];329329+ wmb();330330+ __asm__ __volatile__("flush %0"331331+ : : "r" (addr + (i * 4)));332332+ }333333+334334+ p++;335335+ }336336+}337337+319338#ifdef CONFIG_SMP320339void __init boot_cpu_id_too_large(int cpu)321340{···547528548529 if (sparc64_elf_hwcap & AV_SPARC_POPC)549530 popc_patch();531531+ if (sparc64_elf_hwcap & AV_SPARC_PAUSE)532532+ pause_patch();550533}551534552535void __init setup_arch(char **cmdline_p)
+5
arch/sparc/kernel/sys_sparc_64.c
···751751 : "cc");752752 return __res;753753}754754+755755+asmlinkage long sys_kern_features(void)756756+{757757+ return KERN_FEATURE_MIXED_MODE_STACK;758758+}
···11/* atomic.S: These things are too big to do inline.22 *33- * Copyright (C) 1999, 2007 David S. Miller (davem@davemloft.net)33+ * Copyright (C) 1999, 2007 2012 David S. Miller (davem@davemloft.net)44 */5566#include <linux/linkage.h>···117117 sub %g1, %o0, %o01181182: BACKOFF_SPIN(%o2, %o3, 1b)119119ENDPROC(atomic64_sub_ret)120120+121121+ENTRY(atomic64_dec_if_positive) /* %o0 = atomic_ptr */122122+ BACKOFF_SETUP(%o2)123123+1: ldx [%o0], %g1124124+ brlez,pn %g1, 3f125125+ sub %g1, 1, %g7126126+ casx [%o0], %g1, %g7127127+ cmp %g1, %g7128128+ bne,pn %xcc, BACKOFF_LABEL(2f, 1b)129129+ nop130130+3: retl131131+ sub %g1, 1, %o0132132+2: BACKOFF_SPIN(%o2, %o3, 1b)133133+ENDPROC(atomic64_dec_if_positive)
+1
arch/sparc/lib/ksyms.c
···116116EXPORT_SYMBOL(atomic64_add_ret);117117EXPORT_SYMBOL(atomic64_sub);118118EXPORT_SYMBOL(atomic64_sub_ret);119119+EXPORT_SYMBOL(atomic64_dec_if_positive);119120120121/* Atomic bit operations. */121122EXPORT_SYMBOL(test_and_set_bit);
···3030extern void kernel_thread_helper(void);31313232extern void __init early_signal_init(void);3333+3434+extern asmlinkage void __backtrace(void);3535+extern asmlinkage void c_backtrace(unsigned long fp, int pmode);3636+3737+extern void __show_regs(struct pt_regs *);3838+3339#endif
-63
arch/unicore32/kernel/sys.c
···4242 parent_tid, child_tid);4343}44444545-/* sys_execve() executes a new program.4646- * This is called indirectly via a small wrapper4747- */4848-asmlinkage long __sys_execve(const char __user *filename,4949- const char __user *const __user *argv,5050- const char __user *const __user *envp,5151- struct pt_regs *regs)5252-{5353- int error;5454- struct filename *fn;5555-5656- fn = getname(filename);5757- error = PTR_ERR(fn);5858- if (IS_ERR(fn))5959- goto out;6060- error = do_execve(fn->name, argv, envp, regs);6161- putname(fn);6262-out:6363- return error;6464-}6565-6666-int kernel_execve(const char *filename,6767- const char *const argv[],6868- const char *const envp[])6969-{7070- struct pt_regs regs;7171- int ret;7272-7373- memset(®s, 0, sizeof(struct pt_regs));7474- ret = do_execve(filename,7575- (const char __user *const __user *)argv,7676- (const char __user *const __user *)envp, ®s);7777- if (ret < 0)7878- goto out;7979-8080- /*8181- * Save argc to the register structure for userspace.8282- */8383- regs.UCreg_00 = ret;8484-8585- /*8686- * We were successful. We won't be returning to our caller, but8787- * instead to user space by manipulating the kernel stack.8888- */8989- asm("add r0, %0, %1\n\t"9090- "mov r1, %2\n\t"9191- "mov r2, %3\n\t"9292- "mov r22, #0\n\t" /* not a syscall */9393- "mov r23, %0\n\t" /* thread structure */9494- "b.l memmove\n\t" /* copy regs to top of stack */9595- "mov sp, r0\n\t" /* reposition stack pointer */9696- "b ret_to_user"9797- :9898- : "r" (current_thread_info()),9999- "Ir" (THREAD_START_SP - sizeof(regs)),100100- "r" (®s),101101- "Ir" (sizeof(regs))102102- : "r0", "r1", "r2", "r3", "ip", "lr", "memory");103103-104104- out:105105- return ret;106106-}107107-10845/* Note: used by the compat code even in 64-bit Linux. */10946SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,11047 unsigned long, prot, unsigned long, flags,
+27-10
arch/unicore32/mm/fault.c
···168168}169169170170static int __do_pf(struct mm_struct *mm, unsigned long addr, unsigned int fsr,171171- struct task_struct *tsk)171171+ unsigned int flags, struct task_struct *tsk)172172{173173 struct vm_area_struct *vma;174174 int fault;···194194 * If for any reason at all we couldn't handle the fault, make195195 * sure we exit gracefully rather than endlessly redo the fault.196196 */197197- fault = handle_mm_fault(mm, vma, addr & PAGE_MASK,198198- (!(fsr ^ 0x12)) ? FAULT_FLAG_WRITE : 0);199199- if (unlikely(fault & VM_FAULT_ERROR))200200- return fault;201201- if (fault & VM_FAULT_MAJOR)202202- tsk->maj_flt++;203203- else204204- tsk->min_flt++;197197+ fault = handle_mm_fault(mm, vma, addr & PAGE_MASK, flags);205198 return fault;206199207200check_stack:···209216 struct task_struct *tsk;210217 struct mm_struct *mm;211218 int fault, sig, code;219219+ unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |220220+ ((!(fsr ^ 0x12)) ? FAULT_FLAG_WRITE : 0);212221213222 tsk = current;214223 mm = tsk->mm;···231236 if (!user_mode(regs)232237 && !search_exception_tables(regs->UCreg_pc))233238 goto no_context;239239+retry:234240 down_read(&mm->mmap_sem);235241 } else {236242 /*···247251#endif248252 }249253250250- fault = __do_pf(mm, addr, fsr, tsk);254254+ fault = __do_pf(mm, addr, fsr, flags, tsk);255255+256256+ /* If we need to retry but a fatal signal is pending, handle the257257+ * signal first. We do not need to release the mmap_sem because258258+ * it would already be released in __lock_page_or_retry in259259+ * mm/filemap.c. */260260+ if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))261261+ return 0;262262+263263+ if (!(fault & VM_FAULT_ERROR) && (flags & FAULT_FLAG_ALLOW_RETRY)) {264264+ if (fault & VM_FAULT_MAJOR)265265+ tsk->maj_flt++;266266+ else267267+ tsk->min_flt++;268268+ if (fault & VM_FAULT_RETRY) {269269+ /* Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk270270+ * of starvation. */271271+ flags &= ~FAULT_FLAG_ALLOW_RETRY;272272+ goto retry;273273+ }274274+ }275275+251276 up_read(&mm->mmap_sem);252277253278 /*
···137137 struct crypto_async_request *req, *backlog;138138139139 cpu_queue = container_of(work, struct cryptd_cpu_queue, work);140140- /* Only handle one request at a time to avoid hogging crypto141141- * workqueue. preempt_disable/enable is used to prevent142142- * being preempted by cryptd_enqueue_request() */140140+ /*141141+ * Only handle one request at a time to avoid hogging crypto workqueue.142142+ * preempt_disable/enable is used to prevent being preempted by143143+ * cryptd_enqueue_request(). local_bh_disable/enable is used to prevent144144+ * cryptd_enqueue_request() being accessed from software interrupts.145145+ */146146+ local_bh_disable();143147 preempt_disable();144148 backlog = crypto_get_backlog(&cpu_queue->queue);145149 req = crypto_dequeue_request(&cpu_queue->queue);146150 preempt_enable();151151+ local_bh_enable();147152148153 if (!req)149154 return;
+7-4
drivers/acpi/video.c
···13451345acpi_video_bus_get_devices(struct acpi_video_bus *video,13461346 struct acpi_device *device)13471347{13481348- int status;13481348+ int status = 0;13491349 struct acpi_device *dev;1350135013511351- status = acpi_video_device_enumerate(video);13521352- if (status)13531353- return status;13511351+ /*13521352+ * There are systems where video module known to work fine regardless13531353+ * of broken _DOD and ignoring returned value here doesn't cause13541354+ * any issues later.13551355+ */13561356+ acpi_video_device_enumerate(video);1354135713551358 list_for_each_entry(dev, &device->children, node) {13561359
+7
drivers/base/platform.c
···8383 */8484int platform_get_irq(struct platform_device *dev, unsigned int num)8585{8686+#ifdef CONFIG_SPARC8787+ /* sparc does not have irqs represented as IORESOURCE_IRQ resources */8888+ if (!dev || num >= dev->archdata.num_irqs)8989+ return -ENXIO;9090+ return dev->archdata.irqs[num];9191+#else8692 struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);87938894 return r ? r->start : -ENXIO;9595+#endif8996}9097EXPORT_SYMBOL_GPL(platform_get_irq);9198
···4343 * @manager: specific encoder has its own manager to control a hardware4444 * appropriately and we can access a hardware drawing on this manager.4545 * @dpms: store the encoder dpms value.4646+ * @updated: indicate whether overlay data updating is needed or not.4647 */4748struct exynos_drm_encoder {4849 struct drm_crtc *old_crtc;4950 struct drm_encoder drm_encoder;5051 struct exynos_drm_manager *manager;5151- int dpms;5252+ int dpms;5353+ bool updated;5254};53555456static void exynos_drm_connector_power(struct drm_encoder *encoder, int mode)···8785 switch (mode) {8886 case DRM_MODE_DPMS_ON:8987 if (manager_ops && manager_ops->apply)9090- manager_ops->apply(manager->dev);8888+ if (!exynos_encoder->updated)8989+ manager_ops->apply(manager->dev);9090+9191 exynos_drm_connector_power(encoder, mode);9292 exynos_encoder->dpms = mode;9393 break;···9894 case DRM_MODE_DPMS_OFF:9995 exynos_drm_connector_power(encoder, mode);10096 exynos_encoder->dpms = mode;9797+ exynos_encoder->updated = false;10198 break;10299 default:103100 DRM_ERROR("unspecified mode %d\n", mode);···210205211206static void exynos_drm_encoder_commit(struct drm_encoder *encoder)212207{213213- struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder);208208+ struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);209209+ struct exynos_drm_manager *manager = exynos_encoder->manager;214210 struct exynos_drm_manager_ops *manager_ops = manager->ops;215211216212 DRM_DEBUG_KMS("%s\n", __FILE__);217213218214 if (manager_ops && manager_ops->commit)219215 manager_ops->commit(manager->dev);216216+217217+ /*218218+ * this will avoid one issue that overlay data is updated to219219+ * real hardware two times.220220+ * And this variable will be used to check if the data was221221+ * already updated or not by exynos_drm_encoder_dpms function.222222+ */223223+ exynos_encoder->updated = true;220224}221225222226static void exynos_drm_encoder_disable(struct drm_encoder *encoder)···413399414400 if (manager_ops && manager_ops->dpms)415401 manager_ops->dpms(manager->dev, mode);416416-417417- /*418418- * set current mode to new one so that data aren't updated into419419- * registers by drm_helper_connector_dpms two times.420420- *421421- * in case that drm_crtc_helper_set_mode() is called,422422- * overlay_ops->commit() and manager_ops->commit() callbacks423423- * can be called two times, first at drm_crtc_helper_set_mode()424424- * and second at drm_helper_connector_dpms().425425- * so with this setting, when drm_helper_connector_dpms() is called426426- * encoder->funcs->dpms() will be ignored.427427- */428428- exynos_encoder->dpms = mode;429402430403 /*431404 * if this condition is ok then it means that the crtc is already
···15051505 goto put_gmch;15061506 }1507150715081508- i915_kick_out_firmware_fb(dev_priv);15081508+ if (drm_core_check_feature(dev, DRIVER_MODESET))15091509+ i915_kick_out_firmware_fb(dev_priv);1509151015101511 pci_set_master(dev->pdev);15111512
+2-2
drivers/gpu/drm/i915/intel_crt.c
···143143 int old_dpms;144144145145 /* PCH platforms and VLV only support on/off. */146146- if (INTEL_INFO(dev)->gen < 5 && mode != DRM_MODE_DPMS_ON)146146+ if (INTEL_INFO(dev)->gen >= 5 && mode != DRM_MODE_DPMS_ON)147147 mode = DRM_MODE_DPMS_OFF;148148149149 if (mode == connector->dpms)···729729730730 crt->base.type = INTEL_OUTPUT_ANALOG;731731 crt->base.cloneable = true;732732- if (IS_HASWELL(dev))732732+ if (IS_HASWELL(dev) || IS_I830(dev))733733 crt->base.crtc_mask = (1 << 0);734734 else735735 crt->base.crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
+11
drivers/gpu/drm/i915/intel_display.c
···38413841 }38423842 }3843384338443844+ if (intel_encoder->type == INTEL_OUTPUT_EDP) {38453845+ /* Use VBT settings if we have an eDP panel */38463846+ unsigned int edp_bpc = dev_priv->edp.bpp / 3;38473847+38483848+ if (edp_bpc < display_bpc) {38493849+ DRM_DEBUG_KMS("clamping display bpc (was %d) to eDP (%d)\n", display_bpc, edp_bpc);38503850+ display_bpc = edp_bpc;38513851+ }38523852+ continue;38533853+ }38543854+38443855 /*38453856 * HDMI is either 12 or 8, so if the display lets 10bpc sneak38463857 * through, clamp it down. (Note: >12bpc will be caught below.)
+11-3
drivers/gpu/drm/i915/intel_overlay.c
···341341 intel_ring_emit(ring, flip_addr);342342 intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);343343 /* turn overlay off */344344- intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_OFF);345345- intel_ring_emit(ring, flip_addr);346346- intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);344344+ if (IS_I830(dev)) {345345+ /* Workaround: Don't disable the overlay fully, since otherwise346346+ * it dies on the next OVERLAY_ON cmd. */347347+ intel_ring_emit(ring, MI_NOOP);348348+ intel_ring_emit(ring, MI_NOOP);349349+ intel_ring_emit(ring, MI_NOOP);350350+ } else {351351+ intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_OFF);352352+ intel_ring_emit(ring, flip_addr);353353+ intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);354354+ }347355 intel_ring_advance(ring);348356349357 return intel_overlay_do_wait_request(overlay, intel_overlay_off_tail);
+1-1
drivers/gpu/drm/i915/intel_panel.c
···435435 props.type = BACKLIGHT_RAW;436436 props.max_brightness = _intel_panel_get_max_backlight(dev);437437 if (props.max_brightness == 0) {438438- DRM_ERROR("Failed to get maximum backlight value\n");438438+ DRM_DEBUG_DRIVER("Failed to get maximum backlight value\n");439439 return -ENODEV;440440 }441441 dev_priv->backlight =
+61-23
drivers/gpu/drm/i915/intel_sdvo.c
···894894}895895#endif896896897897+static bool intel_sdvo_write_infoframe(struct intel_sdvo *intel_sdvo,898898+ unsigned if_index, uint8_t tx_rate,899899+ uint8_t *data, unsigned length)900900+{901901+ uint8_t set_buf_index[2] = { if_index, 0 };902902+ uint8_t hbuf_size, tmp[8];903903+ int i;904904+905905+ if (!intel_sdvo_set_value(intel_sdvo,906906+ SDVO_CMD_SET_HBUF_INDEX,907907+ set_buf_index, 2))908908+ return false;909909+910910+ if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HBUF_INFO,911911+ &hbuf_size, 1))912912+ return false;913913+914914+ /* Buffer size is 0 based, hooray! */915915+ hbuf_size++;916916+917917+ DRM_DEBUG_KMS("writing sdvo hbuf: %i, hbuf_size %i, hbuf_size: %i\n",918918+ if_index, length, hbuf_size);919919+920920+ for (i = 0; i < hbuf_size; i += 8) {921921+ memset(tmp, 0, 8);922922+ if (i < length)923923+ memcpy(tmp, data + i, min_t(unsigned, 8, length - i));924924+925925+ if (!intel_sdvo_set_value(intel_sdvo,926926+ SDVO_CMD_SET_HBUF_DATA,927927+ tmp, 8))928928+ return false;929929+ }930930+931931+ return intel_sdvo_set_value(intel_sdvo,932932+ SDVO_CMD_SET_HBUF_TXRATE,933933+ &tx_rate, 1);934934+}935935+897936static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo)898937{899938 struct dip_infoframe avi_if = {···940901 .ver = DIP_VERSION_AVI,941902 .len = DIP_LEN_AVI,942903 };943943- uint8_t tx_rate = SDVO_HBUF_TX_VSYNC;944944- uint8_t set_buf_index[2] = { 1, 0 };945904 uint8_t sdvo_data[4 + sizeof(avi_if.body.avi)];946946- uint64_t *data = (uint64_t *)sdvo_data;947947- unsigned i;948905949906 intel_dip_infoframe_csum(&avi_if);950907···950915 sdvo_data[3] = avi_if.checksum;951916 memcpy(&sdvo_data[4], &avi_if.body, sizeof(avi_if.body.avi));952917953953- if (!intel_sdvo_set_value(intel_sdvo,954954- SDVO_CMD_SET_HBUF_INDEX,955955- set_buf_index, 2))956956- return false;957957-958958- for (i = 0; i < sizeof(sdvo_data); i += 8) {959959- if (!intel_sdvo_set_value(intel_sdvo,960960- SDVO_CMD_SET_HBUF_DATA,961961- data, 8))962962- return false;963963- data++;964964- }965965-966966- return intel_sdvo_set_value(intel_sdvo,967967- SDVO_CMD_SET_HBUF_TXRATE,968968- &tx_rate, 1);918918+ return intel_sdvo_write_infoframe(intel_sdvo, SDVO_HBUF_INDEX_AVI_IF,919919+ SDVO_HBUF_TX_VSYNC,920920+ sdvo_data, sizeof(sdvo_data));969921}970922971923static bool intel_sdvo_set_tv_format(struct intel_sdvo *intel_sdvo)···23822360 return true;23832361}2384236223632363+static void intel_sdvo_output_cleanup(struct intel_sdvo *intel_sdvo)23642364+{23652365+ struct drm_device *dev = intel_sdvo->base.base.dev;23662366+ struct drm_connector *connector, *tmp;23672367+23682368+ list_for_each_entry_safe(connector, tmp,23692369+ &dev->mode_config.connector_list, head) {23702370+ if (intel_attached_encoder(connector) == &intel_sdvo->base)23712371+ intel_sdvo_destroy(connector);23722372+ }23732373+}23742374+23852375static bool intel_sdvo_tv_create_property(struct intel_sdvo *intel_sdvo,23862376 struct intel_sdvo_connector *intel_sdvo_connector,23872377 int type)···27172683 intel_sdvo->caps.output_flags) != true) {27182684 DRM_DEBUG_KMS("SDVO output failed to setup on %s\n",27192685 SDVO_NAME(intel_sdvo));27202720- goto err;26862686+ /* Output_setup can leave behind connectors! */26872687+ goto err_output;27212688 }2722268927232690 /* Only enable the hotplug irq if we need it, to work around noisy···2731269627322697 /* Set the input timing to the screen. Assume always input 0. */27332698 if (!intel_sdvo_set_target_input(intel_sdvo))27342734- goto err;26992699+ goto err_output;2735270027362701 if (!intel_sdvo_get_input_pixel_clock_range(intel_sdvo,27372702 &intel_sdvo->pixel_clock_min,27382703 &intel_sdvo->pixel_clock_max))27392739- goto err;27042704+ goto err_output;2740270527412706 DRM_DEBUG_KMS("%s device VID/DID: %02X:%02X.%02X, "27422707 "clock range %dMHz - %dMHz, "···27552720 intel_sdvo->caps.output_flags &27562721 (SDVO_OUTPUT_TMDS1 | SDVO_OUTPUT_RGB1) ? 'Y' : 'N');27572722 return true;27232723+27242724+err_output:27252725+ intel_sdvo_output_cleanup(intel_sdvo);2758272627592727err:27602728 drm_encoder_cleanup(&intel_encoder->base);
···355355 * valid - it's not (rh#613284)356356 */357357 if (nv_encoder->dcb->lvdsconf.use_acpi_for_edid) {358358- if (!(nv_connector->edid = nouveau_acpi_edid(dev, connector))) {358358+ if ((nv_connector->edid = nouveau_acpi_edid(dev, connector))) {359359 status = connector_status_connected;360360 goto out;361361 }
+31-23
drivers/gpu/drm/radeon/atombios_crtc.c
···16961696 return ATOM_PPLL2;16971697 DRM_ERROR("unable to allocate a PPLL\n");16981698 return ATOM_PPLL_INVALID;16991699- } else {17001700- if (ASIC_IS_AVIVO(rdev)) {17011701- /* in DP mode, the DP ref clock can come from either PPLL17021702- * depending on the asic:17031703- * DCE3: PPLL1 or PPLL217041704- */17051705- if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(radeon_crtc->encoder))) {17061706- /* use the same PPLL for all DP monitors */17071707- pll = radeon_get_shared_dp_ppll(crtc);17081708- if (pll != ATOM_PPLL_INVALID)17091709- return pll;17101710- } else {17111711- /* use the same PPLL for all monitors with the same clock */17121712- pll = radeon_get_shared_nondp_ppll(crtc);17131713- if (pll != ATOM_PPLL_INVALID)17141714- return pll;17151715- }17161716- /* all other cases */17171717- pll_in_use = radeon_get_pll_use_mask(crtc);16991699+ } else if (ASIC_IS_AVIVO(rdev)) {17001700+ /* in DP mode, the DP ref clock can come from either PPLL17011701+ * depending on the asic:17021702+ * DCE3: PPLL1 or PPLL217031703+ */17041704+ if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(radeon_crtc->encoder))) {17051705+ /* use the same PPLL for all DP monitors */17061706+ pll = radeon_get_shared_dp_ppll(crtc);17071707+ if (pll != ATOM_PPLL_INVALID)17081708+ return pll;17091709+ } else {17101710+ /* use the same PPLL for all monitors with the same clock */17111711+ pll = radeon_get_shared_nondp_ppll(crtc);17121712+ if (pll != ATOM_PPLL_INVALID)17131713+ return pll;17141714+ }17151715+ /* all other cases */17161716+ pll_in_use = radeon_get_pll_use_mask(crtc);17171717+ /* the order shouldn't matter here, but we probably17181718+ * need this until we have atomic modeset17191719+ */17201720+ if (rdev->flags & RADEON_IS_IGP) {17181721 if (!(pll_in_use & (1 << ATOM_PPLL1)))17191722 return ATOM_PPLL1;17201723 if (!(pll_in_use & (1 << ATOM_PPLL2)))17211724 return ATOM_PPLL2;17221722- DRM_ERROR("unable to allocate a PPLL\n");17231723- return ATOM_PPLL_INVALID;17241725 } else {17251725- /* on pre-R5xx asics, the crtc to pll mapping is hardcoded */17261726- return radeon_crtc->crtc_id;17261726+ if (!(pll_in_use & (1 << ATOM_PPLL2)))17271727+ return ATOM_PPLL2;17281728+ if (!(pll_in_use & (1 << ATOM_PPLL1)))17291729+ return ATOM_PPLL1;17271730 }17311731+ DRM_ERROR("unable to allocate a PPLL\n");17321732+ return ATOM_PPLL_INVALID;17331733+ } else {17341734+ /* on pre-R5xx asics, the crtc to pll mapping is hardcoded */17351735+ return radeon_crtc->crtc_id;17281736 }17291737}17301738
+1-1
drivers/gpu/drm/radeon/atombios_encoders.c
···16251625 atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_SETUP, 0, 0);16261626 atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0);16271627 /* some early dce3.2 boards have a bug in their transmitter control table */16281628- if ((rdev->family != CHIP_RV710) || (rdev->family != CHIP_RV730))16281628+ if ((rdev->family != CHIP_RV710) && (rdev->family != CHIP_RV730))16291629 atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0);16301630 }16311631 if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(encoder)) && connector) {
+1-1
drivers/gpu/drm/radeon/evergreen.c
···13721372 WREG32(BIF_FB_EN, FB_READ_EN | FB_WRITE_EN);1373137313741374 for (i = 0; i < rdev->num_crtc; i++) {13751375- if (save->crtc_enabled) {13751375+ if (save->crtc_enabled[i]) {13761376 if (ASIC_IS_DCE6(rdev)) {13771377 tmp = RREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i]);13781378 tmp |= EVERGREEN_CRTC_BLANK_DATA_EN;
···352352}353353354354/**355355- * radeon_atpx_switchto - switch to the requested GPU355355+ * radeon_atpx_power_state - power down/up the requested GPU356356 *357357- * @id: GPU to switch to357357+ * @id: GPU to power down/up358358 * @state: requested power state (0 = off, 1 = on)359359 *360360 * Execute the necessary ATPX function to power down/up the discrete GPU
+21-7
drivers/gpu/drm/radeon/radeon_connectors.c
···941941 struct drm_mode_object *obj;942942 int i;943943 enum drm_connector_status ret = connector_status_disconnected;944944- bool dret = false;944944+ bool dret = false, broken_edid = false;945945946946 if (!force && radeon_check_hpd_status_unchanged(connector))947947 return connector->status;···965965 ret = connector_status_disconnected;966966 DRM_ERROR("%s: detected RS690 floating bus bug, stopping ddc detect\n", drm_get_connector_name(connector));967967 radeon_connector->ddc_bus = NULL;968968+ } else {969969+ ret = connector_status_connected;970970+ broken_edid = true; /* defer use_digital to later */968971 }969972 } else {970973 radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL);···1050104710511048 encoder_funcs = encoder->helper_private;10521049 if (encoder_funcs->detect) {10531053- if (ret != connector_status_connected) {10541054- ret = encoder_funcs->detect(encoder, connector);10551055- if (ret == connector_status_connected) {10561056- radeon_connector->use_digital = false;10501050+ if (!broken_edid) {10511051+ if (ret != connector_status_connected) {10521052+ /* deal with analog monitors without DDC */10531053+ ret = encoder_funcs->detect(encoder, connector);10541054+ if (ret == connector_status_connected) {10551055+ radeon_connector->use_digital = false;10561056+ }10571057+ if (ret != connector_status_disconnected)10581058+ radeon_connector->detected_by_load = true;10571059 }10581058- if (ret != connector_status_disconnected)10591059- radeon_connector->detected_by_load = true;10601060+ } else {10611061+ enum drm_connector_status lret;10621062+ /* assume digital unless load detected otherwise */10631063+ radeon_connector->use_digital = true;10641064+ lret = encoder_funcs->detect(encoder, connector);10651065+ DRM_DEBUG_KMS("load_detect %x returned: %x\n",encoder->encoder_type,lret);10661066+ if (lret == connector_status_connected)10671067+ radeon_connector->use_digital = false;10601068 }10611069 break;10621070 }
+13-2
drivers/gpu/drm/radeon/radeon_legacy_crtc.c
···295295 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);296296 struct drm_device *dev = crtc->dev;297297 struct radeon_device *rdev = dev->dev_private;298298+ uint32_t crtc_ext_cntl = 0;298299 uint32_t mask;299300300301 if (radeon_crtc->crtc_id)···308307 RADEON_CRTC_VSYNC_DIS |309308 RADEON_CRTC_HSYNC_DIS);310309310310+ /*311311+ * On all dual CRTC GPUs this bit controls the CRTC of the primary DAC.312312+ * Therefore it is set in the DAC DMPS function.313313+ * This is different for GPU's with a single CRTC but a primary and a314314+ * TV DAC: here it controls the single CRTC no matter where it is315315+ * routed. Therefore we set it here.316316+ */317317+ if (rdev->flags & RADEON_SINGLE_CRTC)318318+ crtc_ext_cntl = RADEON_CRTC_CRT_ON;319319+311320 switch (mode) {312321 case DRM_MODE_DPMS_ON:313322 radeon_crtc->enabled = true;···328317 else {329318 WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_EN, ~(RADEON_CRTC_EN |330319 RADEON_CRTC_DISP_REQ_EN_B));331331- WREG32_P(RADEON_CRTC_EXT_CNTL, 0, ~mask);320320+ WREG32_P(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl, ~(mask | crtc_ext_cntl));332321 }333322 drm_vblank_post_modeset(dev, radeon_crtc->crtc_id);334323 radeon_crtc_load_lut(crtc);···342331 else {343332 WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_DISP_REQ_EN_B, ~(RADEON_CRTC_EN |344333 RADEON_CRTC_DISP_REQ_EN_B));345345- WREG32_P(RADEON_CRTC_EXT_CNTL, mask, ~mask);334334+ WREG32_P(RADEON_CRTC_EXT_CNTL, mask, ~(mask | crtc_ext_cntl));346335 }347336 radeon_crtc->enabled = false;348337 /* adjust pm to dpms changes AFTER disabling crtcs */
···24742474 /* check config regs */24752475 switch (reg) {24762476 case GRBM_GFX_INDEX:24772477+ case CP_STRMOUT_CNTL:24772478 case VGT_VTX_VECT_EJECT_REG:24782479 case VGT_CACHE_INVALIDATION:24792480 case VGT_ESGS_RING_SIZE:
···749749 /* clear the pages coming from the pool if requested */750750 if (flags & TTM_PAGE_FLAG_ZERO_ALLOC) {751751 list_for_each_entry(p, &plist, lru) {752752- clear_page(page_address(p));752752+ if (PageHighMem(p))753753+ clear_highpage(p);754754+ else755755+ clear_page(page_address(p));753756 }754757 }755758
···10981098 struct drm_device *dev = pci_get_drvdata(pdev);10991099 struct vmw_private *dev_priv = vmw_priv(dev);1100110011011101+ mutex_lock(&dev_priv->hw_mutex);11021102+ vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2);11031103+ (void) vmw_read(dev_priv, SVGA_REG_ID);11041104+ mutex_unlock(&dev_priv->hw_mutex);11051105+11011106 /**11021107 * Reclaim 3d reference held by fbdev and potentially11031108 * start fifo.
+2
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
···110110 memcpy_fromio(bounce, &fifo_mem[SVGA_FIFO_3D_CAPS], size);111111112112 ret = copy_to_user(buffer, bounce, size);113113+ if (ret)114114+ ret = -EFAULT;113115 vfree(bounce);114116115117 if (unlikely(ret != 0))
···4242static struct class *hidraw_class;4343static struct hidraw *hidraw_table[HIDRAW_MAX_DEVICES];4444static DEFINE_MUTEX(minors_lock);4545-static void drop_ref(struct hidraw *hid, int exists_bit);46454746static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)4847{···113114 __u8 *buf;114115 int ret = 0;115116116116- if (!hidraw_table[minor] || !hidraw_table[minor]->exist) {117117+ if (!hidraw_table[minor]) {117118 ret = -ENODEV;118119 goto out;119120 }···261262 }262263263264 mutex_lock(&minors_lock);264264- if (!hidraw_table[minor] || !hidraw_table[minor]->exist) {265265+ if (!hidraw_table[minor]) {265266 err = -ENODEV;266267 goto out_unlock;267268 }···298299static int hidraw_release(struct inode * inode, struct file * file)299300{300301 unsigned int minor = iminor(inode);302302+ struct hidraw *dev;301303 struct hidraw_list *list = file->private_data;304304+ int ret;305305+ int i;302306303303- drop_ref(hidraw_table[minor], 0);307307+ mutex_lock(&minors_lock);308308+ if (!hidraw_table[minor]) {309309+ ret = -ENODEV;310310+ goto unlock;311311+ }312312+304313 list_del(&list->node);314314+ dev = hidraw_table[minor];315315+ if (!--dev->open) {316316+ if (list->hidraw->exist) {317317+ hid_hw_power(dev->hid, PM_HINT_NORMAL);318318+ hid_hw_close(dev->hid);319319+ } else {320320+ kfree(list->hidraw);321321+ }322322+ }323323+324324+ for (i = 0; i < HIDRAW_BUFFER_SIZE; ++i)325325+ kfree(list->buffer[i].value);305326 kfree(list);306306- return 0;327327+ ret = 0;328328+unlock:329329+ mutex_unlock(&minors_lock);330330+331331+ return ret;307332}308333309334static long hidraw_ioctl(struct file *file, unsigned int cmd,···529506void hidraw_disconnect(struct hid_device *hid)530507{531508 struct hidraw *hidraw = hid->hidraw;532532- drop_ref(hidraw, 1);509509+510510+ mutex_lock(&minors_lock);511511+ hidraw->exist = 0;512512+513513+ device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));514514+515515+ hidraw_table[hidraw->minor] = NULL;516516+517517+ if (hidraw->open) {518518+ hid_hw_close(hid);519519+ wake_up_interruptible(&hidraw->wait);520520+ } else {521521+ kfree(hidraw);522522+ }523523+ mutex_unlock(&minors_lock);533524}534525EXPORT_SYMBOL_GPL(hidraw_disconnect);535526···591554 class_destroy(hidraw_class);592555 unregister_chrdev_region(dev_id, HIDRAW_MAX_DEVICES);593556594594-}595595-596596-static void drop_ref(struct hidraw *hidraw, int exists_bit)597597-{598598- mutex_lock(&minors_lock);599599- if (exists_bit) {600600- hid_hw_close(hidraw->hid);601601- hidraw->exist = 0;602602- if (hidraw->open)603603- wake_up_interruptible(&hidraw->wait);604604- } else {605605- --hidraw->open;606606- }607607-608608- if (!hidraw->open && !hidraw->exist) {609609- device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));610610- hidraw_table[hidraw->minor] = NULL;611611- kfree(hidraw);612612- }613613- mutex_unlock(&minors_lock);614557}
+1-1
drivers/hwmon/asb100.c
···3232 * ASB100-A supports pwm1, while plain ASB100 does not. There is no known3333 * way for the driver to tell which one is there.3434 *3535- * Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA3535+ * Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA3636 * asb100 7 3 1 4 0x31 0x0694 yes no3737 */3838
+1
drivers/hwmon/w83627ehf.c
···20832083 mutex_init(&data->lock);20842084 mutex_init(&data->update_lock);20852085 data->name = w83627ehf_device_names[sio_data->kind];20862086+ data->bank = 0xff; /* Force initial bank selection */20862087 platform_set_drvdata(pdev, data);2087208820882089 /* 627EHG and 627EHF have 10 voltage inputs; 627DHG and 667HG have 9 */
···11961196 return ERR_PTR(-ENODEV);11971197 }1198119811991199- if (pci_resource_len(pdev, bar) != 0x100) {11991199+ if (pci_resource_len(pdev, bar) < 0x100) {12001200 dev_err(&pdev->dev, "Invalid iomem size. You may "12011201 "experience problems.\n");12021202 }
+7
drivers/mmc/host/sdhci-pltfm.c
···150150 goto err_remap;151151 }152152153153+ /*154154+ * Some platforms need to probe the controller to be able to155155+ * determine which caps should be used.156156+ */157157+ if (host->ops && host->ops->platform_init)158158+ host->ops->platform_init(host);159159+153160 platform_set_drvdata(pdev, host);154161155162 return host;
+16-14
drivers/mmc/host/sdhci-s3c.c
···211211 if (ourhost->cur_clk != best_src) {212212 struct clk *clk = ourhost->clk_bus[best_src];213213214214- clk_enable(clk);215215- clk_disable(ourhost->clk_bus[ourhost->cur_clk]);214214+ clk_prepare_enable(clk);215215+ clk_disable_unprepare(ourhost->clk_bus[ourhost->cur_clk]);216216217217 /* turn clock off to card before changing clock source */218218 writew(0, host->ioaddr + SDHCI_CLOCK_CONTROL);···607607 }608608609609 /* enable the local io clock and keep it running for the moment. */610610- clk_enable(sc->clk_io);610610+ clk_prepare_enable(sc->clk_io);611611612612 for (clks = 0, ptr = 0; ptr < MAX_BUS_CLK; ptr++) {613613 struct clk *clk;···638638 }639639640640#ifndef CONFIG_PM_RUNTIME641641- clk_enable(sc->clk_bus[sc->cur_clk]);641641+ clk_prepare_enable(sc->clk_bus[sc->cur_clk]);642642#endif643643644644 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);···747747 sdhci_s3c_setup_card_detect_gpio(sc);748748749749#ifdef CONFIG_PM_RUNTIME750750- clk_disable(sc->clk_io);750750+ if (pdata->cd_type != S3C_SDHCI_CD_INTERNAL)751751+ clk_disable_unprepare(sc->clk_io);751752#endif752753 return 0;753754754755 err_req_regs:755756#ifndef CONFIG_PM_RUNTIME756756- clk_disable(sc->clk_bus[sc->cur_clk]);757757+ clk_disable_unprepare(sc->clk_bus[sc->cur_clk]);757758#endif758759 for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {759760 if (sc->clk_bus[ptr]) {···763762 }764763765764 err_no_busclks:766766- clk_disable(sc->clk_io);765765+ clk_disable_unprepare(sc->clk_io);767766 clk_put(sc->clk_io);768767769768 err_io_clk:···795794 gpio_free(sc->ext_cd_gpio);796795797796#ifdef CONFIG_PM_RUNTIME798798- clk_enable(sc->clk_io);797797+ if (pdata->cd_type != S3C_SDHCI_CD_INTERNAL)798798+ clk_prepare_enable(sc->clk_io);799799#endif800800 sdhci_remove_host(host, 1);801801···804802 pm_runtime_disable(&pdev->dev);805803806804#ifndef CONFIG_PM_RUNTIME807807- clk_disable(sc->clk_bus[sc->cur_clk]);805805+ clk_disable_unprepare(sc->clk_bus[sc->cur_clk]);808806#endif809807 for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {810808 if (sc->clk_bus[ptr]) {811809 clk_put(sc->clk_bus[ptr]);812810 }813811 }814814- clk_disable(sc->clk_io);812812+ clk_disable_unprepare(sc->clk_io);815813 clk_put(sc->clk_io);816814817815 if (pdev->dev.of_node) {···851849852850 ret = sdhci_runtime_suspend_host(host);853851854854- clk_disable(ourhost->clk_bus[ourhost->cur_clk]);855855- clk_disable(busclk);852852+ clk_disable_unprepare(ourhost->clk_bus[ourhost->cur_clk]);853853+ clk_disable_unprepare(busclk);856854 return ret;857855}858856···863861 struct clk *busclk = ourhost->clk_io;864862 int ret;865863866866- clk_enable(busclk);867867- clk_enable(ourhost->clk_bus[ourhost->cur_clk]);864864+ clk_prepare_enable(busclk);865865+ clk_prepare_enable(ourhost->clk_bus[ourhost->cur_clk]);868866 ret = sdhci_runtime_resume_host(host);869867 return ret;870868}
+27-15
drivers/mmc/host/sdhci.c
···13151315 */13161316 if ((host->flags & SDHCI_NEEDS_RETUNING) &&13171317 !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ))) {13181318- /* eMMC uses cmd21 while sd and sdio use cmd19 */13191319- tuning_opcode = mmc->card->type == MMC_TYPE_MMC ?13201320- MMC_SEND_TUNING_BLOCK_HS200 :13211321- MMC_SEND_TUNING_BLOCK;13221322- spin_unlock_irqrestore(&host->lock, flags);13231323- sdhci_execute_tuning(mmc, tuning_opcode);13241324- spin_lock_irqsave(&host->lock, flags);13181318+ if (mmc->card) {13191319+ /* eMMC uses cmd21 but sd and sdio use cmd19 */13201320+ tuning_opcode =13211321+ mmc->card->type == MMC_TYPE_MMC ?13221322+ MMC_SEND_TUNING_BLOCK_HS200 :13231323+ MMC_SEND_TUNING_BLOCK;13241324+ spin_unlock_irqrestore(&host->lock, flags);13251325+ sdhci_execute_tuning(mmc, tuning_opcode);13261326+ spin_lock_irqsave(&host->lock, flags);1325132713261326- /* Restore original mmc_request structure */13271327- host->mrq = mrq;13281328+ /* Restore original mmc_request structure */13291329+ host->mrq = mrq;13301330+ }13281331 }1329133213301333 if (mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23))···28402837 if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA))28412838 mmc->caps |= MMC_CAP_4_BIT_DATA;2842283928402840+ if (host->quirks2 & SDHCI_QUIRK2_HOST_NO_CMD23)28412841+ mmc->caps &= ~MMC_CAP_CMD23;28422842+28432843 if (caps[0] & SDHCI_CAN_DO_HISPD)28442844 mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;28452845···2852284628532847 /* If vqmmc regulator and no 1.8V signalling, then there's no UHS */28542848 host->vqmmc = regulator_get(mmc_dev(mmc), "vqmmc");28552855- if (IS_ERR(host->vqmmc)) {28562856- pr_info("%s: no vqmmc regulator found\n", mmc_hostname(mmc));28572857- host->vqmmc = NULL;28492849+ if (IS_ERR_OR_NULL(host->vqmmc)) {28502850+ if (PTR_ERR(host->vqmmc) < 0) {28512851+ pr_info("%s: no vqmmc regulator found\n",28522852+ mmc_hostname(mmc));28532853+ host->vqmmc = NULL;28542854+ }28582855 }28592856 else if (regulator_is_supported_voltage(host->vqmmc, 1800000, 1800000))28602857 regulator_enable(host->vqmmc);···29132904 ocr_avail = 0;2914290529152906 host->vmmc = regulator_get(mmc_dev(mmc), "vmmc");29162916- if (IS_ERR(host->vmmc)) {29172917- pr_info("%s: no vmmc regulator found\n", mmc_hostname(mmc));29182918- host->vmmc = NULL;29072907+ if (IS_ERR_OR_NULL(host->vmmc)) {29082908+ if (PTR_ERR(host->vmmc) < 0) {29092909+ pr_info("%s: no vmmc regulator found\n",29102910+ mmc_hostname(mmc));29112911+ host->vmmc = NULL;29122912+ }29192913 } else29202914 regulator_enable(host->vmmc);29212915
···54595459 rc = request_irq(dev->irq, netdev_intr, IRQF_SHARED, dev->name, dev);54605460 if (rc)54615461 return rc;54625462- tasklet_enable(&hw_priv->rx_tasklet);54635463- tasklet_enable(&hw_priv->tx_tasklet);54625462+ tasklet_init(&hw_priv->rx_tasklet, rx_proc_task,54635463+ (unsigned long) hw_priv);54645464+ tasklet_init(&hw_priv->tx_tasklet, tx_proc_task,54655465+ (unsigned long) hw_priv);5464546654655467 hw->promiscuous = 0;54665468 hw->all_multi = 0;···7034703270357033 spin_lock_init(&hw_priv->hwlock);70367034 mutex_init(&hw_priv->lock);70377037-70387038- /* tasklet is enabled. */70397039- tasklet_init(&hw_priv->rx_tasklet, rx_proc_task,70407040- (unsigned long) hw_priv);70417041- tasklet_init(&hw_priv->tx_tasklet, tx_proc_task,70427042- (unsigned long) hw_priv);70437043-70447044- /* tasklet_enable will decrement the atomic counter. */70457045- tasklet_disable(&hw_priv->rx_tasklet);70467046- tasklet_disable(&hw_priv->tx_tasklet);7047703570487036 for (i = 0; i < TOTAL_PORT_NUM; i++)70497037 init_waitqueue_head(&hw_priv->counter[i].counter);
+15-2
drivers/net/ethernet/smsc/smsc911x.c
···21102110static int __devinit smsc911x_init(struct net_device *dev)21112111{21122112 struct smsc911x_data *pdata = netdev_priv(dev);21132113- unsigned int byte_test;21132113+ unsigned int byte_test, mask;21142114 unsigned int to = 100;2115211521162116 SMSC_TRACE(pdata, probe, "Driver Parameters:");···21302130 /*21312131 * poll the READY bit in PMT_CTRL. Any other access to the device is21322132 * forbidden while this bit isn't set. Try for 100ms21332133+ *21342134+ * Note that this test is done before the WORD_SWAP register is21352135+ * programmed. So in some configurations the READY bit is at 16 before21362136+ * WORD_SWAP is written to. This issue is worked around by waiting21372137+ * until either bit 0 or bit 16 gets set in PMT_CTRL.21382138+ *21392139+ * SMSC has confirmed that checking bit 16 (marked as reserved in21402140+ * the datasheet) is fine since these bits "will either never be set21412141+ * or can only go high after READY does (so also indicate the device21422142+ * is ready)".21332143 */21342134- while (!(smsc911x_reg_read(pdata, PMT_CTRL) & PMT_CTRL_READY_) && --to)21442144+21452145+ mask = PMT_CTRL_READY_ | swahw32(PMT_CTRL_READY_);21462146+ while (!(smsc911x_reg_read(pdata, PMT_CTRL) & mask) && --to)21352147 udelay(1000);21482148+21362149 if (to == 0) {21372150 pr_err("Device not READY in 100ms aborting\n");21382151 return -ENODEV;
···321321 dma_map_page(trans->dev, page, 0,322322 PAGE_SIZE << trans_pcie->rx_page_order,323323 DMA_FROM_DEVICE);324324+ if (dma_mapping_error(trans->dev, rxb->page_dma)) {325325+ rxb->page = NULL;326326+ spin_lock_irqsave(&rxq->lock, flags);327327+ list_add(&rxb->list, &rxq->rx_used);328328+ spin_unlock_irqrestore(&rxq->lock, flags);329329+ __free_pages(page, trans_pcie->rx_page_order);330330+ return;331331+ }324332 /* dma address must be no more than 36 bits */325333 BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36));326334 /* and also 256 byte aligned! */···497489 dma_map_page(trans->dev, rxb->page, 0,498490 PAGE_SIZE << trans_pcie->rx_page_order,499491 DMA_FROM_DEVICE);500500- list_add_tail(&rxb->list, &rxq->rx_free);501501- rxq->free_count++;492492+ if (dma_mapping_error(trans->dev, rxb->page_dma)) {493493+ /*494494+ * free the page(s) as well to not break495495+ * the invariant that the items on the used496496+ * list have no page(s)497497+ */498498+ __free_pages(rxb->page, trans_pcie->rx_page_order);499499+ rxb->page = NULL;500500+ list_add_tail(&rxb->list, &rxq->rx_used);501501+ } else {502502+ list_add_tail(&rxb->list, &rxq->rx_free);503503+ rxq->free_count++;504504+ }502505 } else503506 list_add_tail(&rxb->list, &rxq->rx_used);504507 spin_unlock_irqrestore(&rxq->lock, flags);
-3
drivers/pci/bus.c
···320320 } else321321 next = dev->bus_list.next;322322323323- /* Run device routines with the device locked */324324- device_lock(&dev->dev);325323 retval = cb(dev, userdata);326326- device_unlock(&dev->dev);327324 if (retval)328325 break;329326 }
+2-10
drivers/pci/pci-driver.c
···398398 struct pci_dev *pci_dev = to_pci_dev(dev);399399 struct pci_driver *drv = pci_dev->driver;400400401401+ pm_runtime_resume(dev);402402+401403 if (drv && drv->shutdown)402404 drv->shutdown(pci_dev);403405 pci_msi_shutdown(pci_dev);···410408 * continue to do DMA411409 */412410 pci_disable_device(pci_dev);413413-414414- /*415415- * Devices may be enabled to wake up by runtime PM, but they need not416416- * be supposed to wake up the system from its "power off" state (e.g.417417- * ACPI S5). Therefore disable wakeup for all devices that aren't418418- * supposed to wake up the system at this point. The state argument419419- * will be ignored by pci_enable_wake().420420- */421421- if (!device_may_wakeup(dev))422422- pci_enable_wake(pci_dev, PCI_UNKNOWN, false);423411}424412425413#ifdef CONFIG_PM
-34
drivers/pci/pci-sysfs.c
···458458}459459struct device_attribute vga_attr = __ATTR_RO(boot_vga);460460461461-static void462462-pci_config_pm_runtime_get(struct pci_dev *pdev)463463-{464464- struct device *dev = &pdev->dev;465465- struct device *parent = dev->parent;466466-467467- if (parent)468468- pm_runtime_get_sync(parent);469469- pm_runtime_get_noresume(dev);470470- /*471471- * pdev->current_state is set to PCI_D3cold during suspending,472472- * so wait until suspending completes473473- */474474- pm_runtime_barrier(dev);475475- /*476476- * Only need to resume devices in D3cold, because config477477- * registers are still accessible for devices suspended but478478- * not in D3cold.479479- */480480- if (pdev->current_state == PCI_D3cold)481481- pm_runtime_resume(dev);482482-}483483-484484-static void485485-pci_config_pm_runtime_put(struct pci_dev *pdev)486486-{487487- struct device *dev = &pdev->dev;488488- struct device *parent = dev->parent;489489-490490- pm_runtime_put(dev);491491- if (parent)492492- pm_runtime_put_sync(parent);493493-}494494-495461static ssize_t496462pci_read_config(struct file *filp, struct kobject *kobj,497463 struct bin_attribute *bin_attr,
+32
drivers/pci/pci.c
···18581858}18591859EXPORT_SYMBOL_GPL(pci_dev_run_wake);1860186018611861+void pci_config_pm_runtime_get(struct pci_dev *pdev)18621862+{18631863+ struct device *dev = &pdev->dev;18641864+ struct device *parent = dev->parent;18651865+18661866+ if (parent)18671867+ pm_runtime_get_sync(parent);18681868+ pm_runtime_get_noresume(dev);18691869+ /*18701870+ * pdev->current_state is set to PCI_D3cold during suspending,18711871+ * so wait until suspending completes18721872+ */18731873+ pm_runtime_barrier(dev);18741874+ /*18751875+ * Only need to resume devices in D3cold, because config18761876+ * registers are still accessible for devices suspended but18771877+ * not in D3cold.18781878+ */18791879+ if (pdev->current_state == PCI_D3cold)18801880+ pm_runtime_resume(dev);18811881+}18821882+18831883+void pci_config_pm_runtime_put(struct pci_dev *pdev)18841884+{18851885+ struct device *dev = &pdev->dev;18861886+ struct device *parent = dev->parent;18871887+18881888+ pm_runtime_put(dev);18891889+ if (parent)18901890+ pm_runtime_put_sync(parent);18911891+}18921892+18611893/**18621894 * pci_pm_init - Initialize PM functions of given PCI device18631895 * @dev: PCI device to handle.
···401401/**402402 * rio_map_inb_region -- Map inbound memory region.403403 * @mport: Master port.404404- * @lstart: physical address of memory region to be mapped404404+ * @local: physical address of memory region to be mapped405405 * @rbase: RIO base address assigned to this window406406 * @size: Size of the memory region407407 * @rflags: Flags for mapping.
+20-13
drivers/regulator/core.c
···13811381}13821382EXPORT_SYMBOL_GPL(regulator_get_exclusive);1383138313841384-/**13851385- * regulator_put - "free" the regulator source13861386- * @regulator: regulator source13871387- *13881388- * Note: drivers must ensure that all regulator_enable calls made on this13891389- * regulator source are balanced by regulator_disable calls prior to calling13901390- * this function.13911391- */13921392-void regulator_put(struct regulator *regulator)13841384+/* Locks held by regulator_put() */13851385+static void _regulator_put(struct regulator *regulator)13931386{13941387 struct regulator_dev *rdev;1395138813961389 if (regulator == NULL || IS_ERR(regulator))13971390 return;1398139113991399- mutex_lock(®ulator_list_mutex);14001392 rdev = regulator->rdev;1401139314021394 debugfs_remove_recursive(regulator->debugfs);···14041412 rdev->exclusive = 0;1405141314061414 module_put(rdev->owner);14151415+}14161416+14171417+/**14181418+ * regulator_put - "free" the regulator source14191419+ * @regulator: regulator source14201420+ *14211421+ * Note: drivers must ensure that all regulator_enable calls made on this14221422+ * regulator source are balanced by regulator_disable calls prior to calling14231423+ * this function.14241424+ */14251425+void regulator_put(struct regulator *regulator)14261426+{14271427+ mutex_lock(®ulator_list_mutex);14281428+ _regulator_put(regulator);14071429 mutex_unlock(®ulator_list_mutex);14081430}14091431EXPORT_SYMBOL_GPL(regulator_put);···19801974 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {19811975 ret = regulator_get_voltage(regulator);19821976 if (ret >= 0)19831983- return (min_uV >= ret && ret <= max_uV);19771977+ return (min_uV <= ret && ret <= max_uV);19841978 else19851979 return ret;19861980 }···33713365 if (ret != 0) {33723366 rdev_err(rdev, "Failed to request enable GPIO%d: %d\n",33733367 config->ena_gpio, ret);33743374- goto clean;33683368+ goto wash;33753369 }3376337033773371 rdev->ena_gpio = config->ena_gpio;···3451344534523446scrub:34533447 if (rdev->supply)34543454- regulator_put(rdev->supply);34483448+ _regulator_put(rdev->supply);34553449 if (rdev->ena_gpio)34563450 gpio_free(rdev->ena_gpio);34573451 kfree(rdev->constraints);34523452+wash:34583453 device_unregister(&rdev->dev);34593454 /* device core frees rdev */34603455 rdev = ERR_PTR(ret);
+5-7
drivers/s390/char/con3215.c
···4444#define RAW3215_NR_CCWS 34545#define RAW3215_TIMEOUT HZ/10 /* time for delayed output */46464747-#define RAW3215_FIXED 1 /* 3215 console device is not be freed */4847#define RAW3215_WORKING 4 /* set if a request is being worked on */4948#define RAW3215_THROTTLED 8 /* set if reading is disabled */5049#define RAW3215_STOPPED 16 /* set if writing is disabled */···338339 struct tty_struct *tty;339340340341 tty = tty_port_tty_get(&raw->port);341341- tty_wakeup(tty);342342- tty_kref_put(tty);342342+ if (tty) {343343+ tty_wakeup(tty);344344+ tty_kref_put(tty);345345+ }343346}344347345348/*···630629 DECLARE_WAITQUEUE(wait, current);631630 unsigned long flags;632631633633- if (!(raw->port.flags & ASYNC_INITIALIZED) ||634634- (raw->flags & RAW3215_FIXED))632632+ if (!(raw->port.flags & ASYNC_INITIALIZED))635633 return;636634 /* Wait for outstanding requests, then free irq */637635 spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);···925925 raw->cdev = cdev;926926 dev_set_drvdata(&cdev->dev, raw);927927 cdev->handler = raw3215_irq;928928-929929- raw->flags |= RAW3215_FIXED;930928931929 /* Request the console irq */932930 if (raw3215_startup(raw) != 0) {
···21512151irqreturn_t usb_hcd_irq (int irq, void *__hcd)21522152{21532153 struct usb_hcd *hcd = __hcd;21542154+ unsigned long flags;21542155 irqreturn_t rc;21562156+21572157+ /* IRQF_DISABLED doesn't work correctly with shared IRQs21582158+ * when the first handler doesn't use it. So let's just21592159+ * assume it's never used.21602160+ */21612161+ local_irq_save(flags);2155216221562163 if (unlikely(HCD_DEAD(hcd) || !HCD_HW_ACCESSIBLE(hcd)))21572164 rc = IRQ_NONE;···21672160 else21682161 rc = IRQ_HANDLED;2169216221632163+ local_irq_restore(flags);21702164 return rc;21712165}21722166EXPORT_SYMBOL_GPL(usb_hcd_irq);···23552347 int retval;2356234823572349 if (hcd->driver->irq) {23502350+23512351+ /* IRQF_DISABLED doesn't work as advertised when used together23522352+ * with IRQF_SHARED. As usb_hcd_irq() will always disable23532353+ * interrupts we can remove it here.23542354+ */23552355+ if (irqflags & IRQF_SHARED)23562356+ irqflags &= ~IRQF_DISABLED;23572357+23582358 snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d",23592359 hcd->driver->description, hcd->self.busnum);23602360 retval = request_irq(irqnum, &usb_hcd_irq, irqflags,
···707707 fifo_count = musb_readw(epio, MUSB_RXCOUNT);708708709709 /*710710- * use mode 1 only if we expect data of at least ep packet_sz711711- * and have not yet received a short packet710710+ * Enable Mode 1 on RX transfers only when short_not_ok flag711711+ * is set. Currently short_not_ok flag is set only from712712+ * file_storage and f_mass_storage drivers712713 */713713- if ((request->length - request->actual >= musb_ep->packet_sz) &&714714- (fifo_count >= musb_ep->packet_sz))714714+715715+ if (request->short_not_ok && fifo_count == musb_ep->packet_sz)715716 use_mode_1 = 1;716717 else717718 use_mode_1 = 0;···727726728727 c = musb->dma_controller;729728 channel = musb_ep->dma;729729+730730+ /* We use DMA Req mode 0 in rx_csr, and DMA controller operates in731731+ * mode 0 only. So we do not get endpoint interrupts due to DMA732732+ * completion. We only get interrupts from DMA controller.733733+ *734734+ * We could operate in DMA mode 1 if we knew the size of the tranfer735735+ * in advance. For mass storage class, request->length = what the host736736+ * sends, so that'd work. But for pretty much everything else,737737+ * request->length is routinely more than what the host sends. For738738+ * most these gadgets, end of is signified either by a short packet,739739+ * or filling the last byte of the buffer. (Sending extra data in740740+ * that last pckate should trigger an overflow fault.) But in mode 1,741741+ * we don't get DMA completion interrupt for short packets.742742+ *743743+ * Theoretically, we could enable DMAReq irq (MUSB_RXCSR_DMAMODE = 1),744744+ * to get endpoint interrupt on every DMA req, but that didn't seem745745+ * to work reliably.746746+ *747747+ * REVISIT an updated g_file_storage can set req->short_not_ok, which748748+ * then becomes usable as a runtime "use mode 1" hint...749749+ */730750731751 /* Experimental: Mode1 works with mass storage use cases */732752 if (use_mode_1) {
+1-1
drivers/usb/musb/ux500.c
···6565 struct platform_device *musb;6666 struct ux500_glue *glue;6767 struct clk *clk;6868-6868+ int musbid;6969 int ret = -ENOMEM;70707171 glue = kzalloc(sizeof(*glue), GFP_KERNEL);
+2-2
drivers/usb/otg/Kconfig
···58585959config TWL4030_USB6060 tristate "TWL4030 USB Transceiver Driver"6161- depends on TWL4030_CORE && REGULATOR_TWL40306161+ depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS6262 select USB_OTG_UTILS6363 help6464 Enable this to support the USB OTG transceiver on TWL4030···68686969config TWL6030_USB7070 tristate "TWL6030 USB Transceiver Driver"7171- depends on TWL4030_CORE && OMAP_USB27171+ depends on TWL4030_CORE && OMAP_USB2 && USB_MUSB_OMAP2PLUS7272 select USB_OTG_UTILS7373 help7474 Enable this to support the USB OTG transceiver on TWL6030
+1-2
drivers/usb/serial/keyspan.c
···24302430static int keyspan_port_probe(struct usb_serial_port *port)24312431{24322432 struct usb_serial *serial = port->serial;24332433- struct keyspan_port_private *s_priv;24332433+ struct keyspan_serial_private *s_priv;24342434 struct keyspan_port_private *p_priv;24352435 const struct keyspan_device_details *d_details;24362436 struct callbacks *cback;···24452445 if (!p_priv)24462446 return -ENOMEM;2447244724482448- s_priv = usb_get_serial_data(port->serial);24492448 p_priv->device_details = d_details;2450244924512450 /* Setup values for the various callback routines */
···455455 struct usb_serial *serial = port->serial;456456 struct urb *urb;457457458458- if (endpoint == -1)459459- return NULL; /* endpoint not needed */460460-461458 urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */462459 if (urb == NULL) {463460 dev_dbg(&serial->interface->dev,···486489 init_usb_anchor(&portdata->delayed);487490488491 for (i = 0; i < N_IN_URB; i++) {492492+ if (!port->bulk_in_size)493493+ break;494494+489495 buffer = (u8 *)__get_free_page(GFP_KERNEL);490496 if (!buffer)491497 goto bail_out_error;···502502 }503503504504 for (i = 0; i < N_OUT_URB; i++) {505505- if (port->bulk_out_endpointAddress == -1)506506- continue;505505+ if (!port->bulk_out_size)506506+ break;507507508508 buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL);509509 if (!buffer)
+3-1
drivers/virtio/virtio.c
···225225226226void unregister_virtio_device(struct virtio_device *dev)227227{228228+ int index = dev->index; /* save for after device release */229229+228230 device_unregister(&dev->dev);229229- ida_simple_remove(&virtio_index_ida, dev->index);231231+ ida_simple_remove(&virtio_index_ida, index);230232}231233EXPORT_SYMBOL_GPL(unregister_virtio_device);232234
···398398 * in network traffic in the other paths.399399 */400400 if (!(oflags & O_CREAT)) {401401- struct dentry *res = cifs_lookup(inode, direntry, 0);401401+ struct dentry *res;402402+403403+ /*404404+ * Check for hashed negative dentry. We have already revalidated405405+ * the dentry and it is fine. No need to perform another lookup.406406+ */407407+ if (!d_unhashed(direntry))408408+ return -ENOENT;409409+410410+ res = cifs_lookup(inode, direntry, 0);402411 if (IS_ERR(res))403412 return PTR_ERR(res);404413
+3-35
fs/eventpoll.c
···346346/* Tells if the epoll_ctl(2) operation needs an event copy from userspace */347347static inline int ep_op_has_event(int op)348348{349349- return op == EPOLL_CTL_ADD || op == EPOLL_CTL_MOD;349349+ return op != EPOLL_CTL_DEL;350350}351351352352/* Initialize the poll safe wake up structure */···674674 atomic_long_dec(&ep->user->epoll_watches);675675676676 return 0;677677-}678678-679679-/*680680- * Disables a "struct epitem" in the eventpoll set. Returns -EBUSY if the item681681- * had no event flags set, indicating that another thread may be currently682682- * handling that item's events (in the case that EPOLLONESHOT was being683683- * used). Otherwise a zero result indicates that the item has been disabled684684- * from receiving events. A disabled item may be re-enabled via685685- * EPOLL_CTL_MOD. Must be called with "mtx" held.686686- */687687-static int ep_disable(struct eventpoll *ep, struct epitem *epi)688688-{689689- int result = 0;690690- unsigned long flags;691691-692692- spin_lock_irqsave(&ep->lock, flags);693693- if (epi->event.events & ~EP_PRIVATE_BITS) {694694- if (ep_is_linked(&epi->rdllink))695695- list_del_init(&epi->rdllink);696696- /* Ensure ep_poll_callback will not add epi back onto ready697697- list: */698698- epi->event.events &= EP_PRIVATE_BITS;699699- }700700- else701701- result = -EBUSY;702702- spin_unlock_irqrestore(&ep->lock, flags);703703-704704- return result;705677}706678707679static void ep_free(struct eventpoll *ep)···10191047 rb_link_node(&epi->rbn, parent, p);10201048 rb_insert_color(&epi->rbn, &ep->rbr);10211049}10501050+10511051+1022105210231053#define PATH_ARR_SIZE 510241054/*···17851811 epds.events |= POLLERR | POLLHUP;17861812 error = ep_modify(ep, epi, &epds);17871813 } else17881788- error = -ENOENT;17891789- break;17901790- case EPOLL_CTL_DISABLE:17911791- if (epi)17921792- error = ep_disable(ep, epi);17931793- else17941814 error = -ENOENT;17951815 break;17961816 }
···181181 else182182 msg.rpc_proc = &mnt_clnt->cl_procinfo[MOUNTPROC_MNT];183183184184- status = rpc_call_sync(mnt_clnt, &msg, 0);184184+ status = rpc_call_sync(mnt_clnt, &msg, RPC_TASK_SOFT|RPC_TASK_TIMEOUT);185185 rpc_shutdown_client(mnt_clnt);186186187187 if (status < 0)
+14-5
fs/nfs/namespace.c
···3333 * @dentry - pointer to dentry3434 * @buffer - result buffer3535 * @buflen - length of buffer3636+ * @flags - options (see below)3637 *3738 * Helper function for constructing the server pathname3839 * by arbitrary hashed dentry.···4140 * This is mainly for use in figuring out the path on the4241 * server side when automounting on top of an existing partition4342 * and in generating /proc/mounts and friends.4343+ *4444+ * Supported flags:4545+ * NFS_PATH_CANONICAL: ensure there is exactly one slash after4646+ * the original device (export) name4747+ * (if unset, the original name is returned verbatim)4448 */4545-char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen)4949+char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen,5050+ unsigned flags)4651{4752 char *end;4853 int namelen;···8174 rcu_read_unlock();8275 goto rename_retry;8376 }8484- if (*end != '/') {7777+ if ((flags & NFS_PATH_CANONICAL) && *end != '/') {8578 if (--buflen < 0) {8679 spin_unlock(&dentry->d_lock);8780 rcu_read_unlock();···9891 return end;9992 }10093 namelen = strlen(base);101101- /* Strip off excess slashes in base string */102102- while (namelen > 0 && base[namelen - 1] == '/')103103- namelen--;9494+ if (flags & NFS_PATH_CANONICAL) {9595+ /* Strip off excess slashes in base string */9696+ while (namelen > 0 && base[namelen - 1] == '/')9797+ namelen--;9898+ }10499 buflen -= namelen;105100 if (buflen < 0) {106101 spin_unlock(&dentry->d_lock);
···161161162162 while (s < e) {163163 unsigned long flags;164164+ u64 id;164165165166 if (c > psinfo->bufsize)166167 c = psinfo->bufsize;···173172 spin_lock_irqsave(&psinfo->buf_lock, flags);174173 }175174 memcpy(psinfo->buf, s, c);176176- psinfo->write(PSTORE_TYPE_CONSOLE, 0, NULL, 0, c, psinfo);175175+ psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, c, psinfo);177176 spin_unlock_irqrestore(&psinfo->buf_lock, flags);178177 s += c;179178 c = e - s;
+10-2
fs/ubifs/find.c
···681681 if (!lprops) {682682 lprops = ubifs_fast_find_freeable(c);683683 if (!lprops) {684684- ubifs_assert(c->freeable_cnt == 0);685685- if (c->lst.empty_lebs - c->lst.taken_empty_lebs > 0) {684684+ /*685685+ * The first condition means the following: go scan the686686+ * LPT if there are uncategorized lprops, which means687687+ * there may be freeable LEBs there (UBIFS does not688688+ * store the information about freeable LEBs in the689689+ * master node).690690+ */691691+ if (c->in_a_category_cnt != c->main_lebs ||692692+ c->lst.empty_lebs - c->lst.taken_empty_lebs > 0) {693693+ ubifs_assert(c->freeable_cnt == 0);686694 lprops = scan_for_leb_for_idx(c);687695 if (IS_ERR(lprops)) {688696 err = PTR_ERR(lprops);
···11831183 * @freeable_list: list of freeable non-index LEBs (free + dirty == @leb_size)11841184 * @frdi_idx_list: list of freeable index LEBs (free + dirty == @leb_size)11851185 * @freeable_cnt: number of freeable LEBs in @freeable_list11861186+ * @in_a_category_cnt: count of lprops which are in a certain category, which11871187+ * basically meants that they were loaded from the flash11861188 *11871189 * @ltab_lnum: LEB number of LPT's own lprops table11881190 * @ltab_offs: offset of LPT's own lprops table···14141412 struct list_head freeable_list;14151413 struct list_head frdi_idx_list;14161414 int freeable_cnt;14151415+ int in_a_category_cnt;1417141614181417 int ltab_lnum;14191418 int ltab_offs;
+2-41
fs/xfs/xfs_alloc.c
···18661866 /*18671867 * Initialize the args structure.18681868 */18691869+ memset(&targs, 0, sizeof(targs));18691870 targs.tp = tp;18701871 targs.mp = mp;18711872 targs.agbp = agbp;···22082207 * group or loop over the allocation groups to find the result.22092208 */22102209int /* error */22112211-__xfs_alloc_vextent(22102210+xfs_alloc_vextent(22122211 xfs_alloc_arg_t *args) /* allocation argument structure */22132212{22142213 xfs_agblock_t agsize; /* allocation group size */···24162415error0:24172416 xfs_perag_put(args->pag);24182417 return error;24192419-}24202420-24212421-static void24222422-xfs_alloc_vextent_worker(24232423- struct work_struct *work)24242424-{24252425- struct xfs_alloc_arg *args = container_of(work,24262426- struct xfs_alloc_arg, work);24272427- unsigned long pflags;24282428-24292429- /* we are in a transaction context here */24302430- current_set_flags_nested(&pflags, PF_FSTRANS);24312431-24322432- args->result = __xfs_alloc_vextent(args);24332433- complete(args->done);24342434-24352435- current_restore_flags_nested(&pflags, PF_FSTRANS);24362436-}24372437-24382438-/*24392439- * Data allocation requests often come in with little stack to work on. Push24402440- * them off to a worker thread so there is lots of stack to use. Metadata24412441- * requests, OTOH, are generally from low stack usage paths, so avoid the24422442- * context switch overhead here.24432443- */24442444-int24452445-xfs_alloc_vextent(24462446- struct xfs_alloc_arg *args)24472447-{24482448- DECLARE_COMPLETION_ONSTACK(done);24492449-24502450- if (!args->userdata)24512451- return __xfs_alloc_vextent(args);24522452-24532453-24542454- args->done = &done;24552455- INIT_WORK_ONSTACK(&args->work, xfs_alloc_vextent_worker);24562456- queue_work(xfs_alloc_wq, &args->work);24572457- wait_for_completion(&done);24582458- return args->result;24592418}2460241924612420/*
-3
fs/xfs/xfs_alloc.h
···120120 char isfl; /* set if is freelist blocks - !acctg */121121 char userdata; /* set if this is user data */122122 xfs_fsblock_t firstblock; /* io first block allocated */123123- struct completion *done;124124- struct work_struct work;125125- int result;126123} xfs_alloc_arg_t;127124128125/*
···24372437 * Normal allocation, done through xfs_alloc_vextent.24382438 */24392439 tryagain = isaligned = 0;24402440+ memset(&args, 0, sizeof(args));24402441 args.tp = ap->tp;24412442 args.mp = mp;24422443 args.fsbno = ap->blkno;···30833082 * Convert to a btree with two levels, one record in root.30843083 */30853084 XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_BTREE);30853085+ memset(&args, 0, sizeof(args));30863086 args.tp = tp;30873087 args.mp = mp;30883088 args.firstblock = *firstblock;···32393237 xfs_buf_t *bp; /* buffer for extent block */32403238 xfs_bmbt_rec_host_t *ep;/* extent record pointer */3241323932403240+ memset(&args, 0, sizeof(args));32423241 args.tp = tp;32433242 args.mp = ip->i_mount;32443243 args.firstblock = *firstblock;···461946164620461746214618STATIC int46224622-xfs_bmapi_allocate(46234623- struct xfs_bmalloca *bma,46244624- int flags)46194619+__xfs_bmapi_allocate(46204620+ struct xfs_bmalloca *bma)46254621{46264622 struct xfs_mount *mp = bma->ip->i_mount;46274627- int whichfork = (flags & XFS_BMAPI_ATTRFORK) ?46234623+ int whichfork = (bma->flags & XFS_BMAPI_ATTRFORK) ?46284624 XFS_ATTR_FORK : XFS_DATA_FORK;46294625 struct xfs_ifork *ifp = XFS_IFORK_PTR(bma->ip, whichfork);46304626 int tmp_logflags = 0;···46564654 * Indicate if this is the first user data in the file, or just any46574655 * user data.46584656 */46594659- if (!(flags & XFS_BMAPI_METADATA)) {46574657+ if (!(bma->flags & XFS_BMAPI_METADATA)) {46604658 bma->userdata = (bma->offset == 0) ?46614659 XFS_ALLOC_INITIAL_USER_DATA : XFS_ALLOC_USERDATA;46624660 }4663466146644664- bma->minlen = (flags & XFS_BMAPI_CONTIG) ? bma->length : 1;46624662+ bma->minlen = (bma->flags & XFS_BMAPI_CONTIG) ? bma->length : 1;4665466346664664 /*46674665 * Only want to do the alignment at the eof if it is userdata and46684666 * allocation length is larger than a stripe unit.46694667 */46704668 if (mp->m_dalign && bma->length >= mp->m_dalign &&46714671- !(flags & XFS_BMAPI_METADATA) && whichfork == XFS_DATA_FORK) {46694669+ !(bma->flags & XFS_BMAPI_METADATA) && whichfork == XFS_DATA_FORK) {46724670 error = xfs_bmap_isaeof(bma, whichfork);46734671 if (error)46744672 return error;46754673 }46744674+46754675+ if (bma->flags & XFS_BMAPI_STACK_SWITCH)46764676+ bma->stack_switch = 1;4676467746774678 error = xfs_bmap_alloc(bma);46784679 if (error)···47114706 * A wasdelay extent has been initialized, so shouldn't be flagged47124707 * as unwritten.47134708 */47144714- if (!bma->wasdel && (flags & XFS_BMAPI_PREALLOC) &&47094709+ if (!bma->wasdel && (bma->flags & XFS_BMAPI_PREALLOC) &&47154710 xfs_sb_version_hasextflgbit(&mp->m_sb))47164711 bma->got.br_state = XFS_EXT_UNWRITTEN;47174712···47374732 ASSERT(bma->got.br_state == XFS_EXT_NORM ||47384733 bma->got.br_state == XFS_EXT_UNWRITTEN);47394734 return 0;47354735+}47364736+47374737+static void47384738+xfs_bmapi_allocate_worker(47394739+ struct work_struct *work)47404740+{47414741+ struct xfs_bmalloca *args = container_of(work,47424742+ struct xfs_bmalloca, work);47434743+ unsigned long pflags;47444744+47454745+ /* we are in a transaction context here */47464746+ current_set_flags_nested(&pflags, PF_FSTRANS);47474747+47484748+ args->result = __xfs_bmapi_allocate(args);47494749+ complete(args->done);47504750+47514751+ current_restore_flags_nested(&pflags, PF_FSTRANS);47524752+}47534753+47544754+/*47554755+ * Some allocation requests often come in with little stack to work on. Push47564756+ * them off to a worker thread so there is lots of stack to use. Otherwise just47574757+ * call directly to avoid the context switch overhead here.47584758+ */47594759+int47604760+xfs_bmapi_allocate(47614761+ struct xfs_bmalloca *args)47624762+{47634763+ DECLARE_COMPLETION_ONSTACK(done);47644764+47654765+ if (!args->stack_switch)47664766+ return __xfs_bmapi_allocate(args);47674767+47684768+47694769+ args->done = &done;47704770+ INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker);47714771+ queue_work(xfs_alloc_wq, &args->work);47724772+ wait_for_completion(&done);47734773+ return args->result;47404774}4741477547424776STATIC int···49634919 bma.conv = !!(flags & XFS_BMAPI_CONVERT);49644920 bma.wasdel = wasdelay;49654921 bma.offset = bno;49224922+ bma.flags = flags;4966492349674924 /*49684925 * There's a 32/64 bit type mismatch between the···4979493449804935 ASSERT(len > 0);49814936 ASSERT(bma.length > 0);49824982- error = xfs_bmapi_allocate(&bma, flags);49374937+ error = xfs_bmapi_allocate(&bma);49834938 if (error)49844939 goto error0;49854940 if (bma.blkno == NULLFSBLOCK)
+8-1
fs/xfs/xfs_bmap.h
···7777 * from written to unwritten, otherwise convert from unwritten to written.7878 */7979#define XFS_BMAPI_CONVERT 0x0408080+#define XFS_BMAPI_STACK_SWITCH 0x08080818182#define XFS_BMAPI_FLAGS \8283 { XFS_BMAPI_ENTIRE, "ENTIRE" }, \···8685 { XFS_BMAPI_PREALLOC, "PREALLOC" }, \8786 { XFS_BMAPI_IGSTATE, "IGSTATE" }, \8887 { XFS_BMAPI_CONTIG, "CONTIG" }, \8989- { XFS_BMAPI_CONVERT, "CONVERT" }8888+ { XFS_BMAPI_CONVERT, "CONVERT" }, \8989+ { XFS_BMAPI_STACK_SWITCH, "STACK_SWITCH" }909091919292static inline int xfs_bmapi_aflag(int w)···135133 char userdata;/* set if is user data */136134 char aeof; /* allocated space at eof */137135 char conv; /* overwriting unwritten extents */136136+ char stack_switch;137137+ int flags;138138+ struct completion *done;139139+ struct work_struct work;140140+ int result;138141} xfs_bmalloca_t;139142140143/*
+18
fs/xfs/xfs_buf_item.c
···526526 }527527 xfs_buf_relse(bp);528528 } else if (freed && remove) {529529+ /*530530+ * There are currently two references to the buffer - the active531531+ * LRU reference and the buf log item. What we are about to do532532+ * here - simulate a failed IO completion - requires 3533533+ * references.534534+ *535535+ * The LRU reference is removed by the xfs_buf_stale() call. The536536+ * buf item reference is removed by the xfs_buf_iodone()537537+ * callback that is run by xfs_buf_do_callbacks() during ioend538538+ * processing (via the bp->b_iodone callback), and then finally539539+ * the ioend processing will drop the IO reference if the buffer540540+ * is marked XBF_ASYNC.541541+ *542542+ * Hence we need to take an additional reference here so that IO543543+ * completion processing doesn't free the buffer prematurely.544544+ */529545 xfs_buf_lock(bp);546546+ xfs_buf_hold(bp);547547+ bp->b_flags |= XBF_ASYNC;530548 xfs_buf_ioerror(bp, EIO);531549 XFS_BUF_UNDONE(bp);532550 xfs_buf_stale(bp);
+19-2
fs/xfs/xfs_fsops.c
···399399400400 /* update secondary superblocks. */401401 for (agno = 1; agno < nagcount; agno++) {402402- error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp,402402+ error = 0;403403+ /*404404+ * new secondary superblocks need to be zeroed, not read from405405+ * disk as the contents of the new area we are growing into is406406+ * completely unknown.407407+ */408408+ if (agno < oagcount) {409409+ error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp,403410 XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)),404411 XFS_FSS_TO_BB(mp, 1), 0, &bp);412412+ } else {413413+ bp = xfs_trans_get_buf(NULL, mp->m_ddev_targp,414414+ XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)),415415+ XFS_FSS_TO_BB(mp, 1), 0);416416+ if (bp)417417+ xfs_buf_zero(bp, 0, BBTOB(bp->b_length));418418+ else419419+ error = ENOMEM;420420+ }421421+405422 if (error) {406423 xfs_warn(mp,407424 "error %d reading secondary superblock for ag %d",···440423 break; /* no point in continuing */441424 }442425 }443443- return 0;426426+ return error;444427445428 error0:446429 xfs_trans_cancel(tp, XFS_TRANS_ABORT);
···15091509 * to mark all the active inodes on the buffer stale.15101510 */15111511 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, blkno,15121512- mp->m_bsize * blks_per_cluster, 0);15121512+ mp->m_bsize * blks_per_cluster,15131513+ XBF_UNMAPPED);1513151415141515 if (!bp)15151516 return ENOMEM;
+1-1
fs/xfs/xfs_ioctl.c
···7070 int hsize;7171 xfs_handle_t handle;7272 struct inode *inode;7373- struct fd f;7373+ struct fd f = {0};7474 struct path path;7575 int error;7676 struct xfs_inode *ip;
+3-1
fs/xfs/xfs_iomap.c
···584584 * pointer that the caller gave to us.585585 */586586 error = xfs_bmapi_write(tp, ip, map_start_fsb,587587- count_fsb, 0, &first_block, 1,587587+ count_fsb,588588+ XFS_BMAPI_STACK_SWITCH,589589+ &first_block, 1,588590 imap, &nimaps, &free_list);589591 if (error)590592 goto trans_cancel;
+16-3
fs/xfs/xfs_log.c
···238723872388238823892389 /*23902390- * update the last_sync_lsn before we drop the23902390+ * Completion of a iclog IO does not imply that23912391+ * a transaction has completed, as transactions23922392+ * can be large enough to span many iclogs. We23932393+ * cannot change the tail of the log half way23942394+ * through a transaction as this may be the only23952395+ * transaction in the log and moving th etail to23962396+ * point to the middle of it will prevent23972397+ * recovery from finding the start of the23982398+ * transaction. Hence we should only update the23992399+ * last_sync_lsn if this iclog contains24002400+ * transaction completion callbacks on it.24012401+ *24022402+ * We have to do this before we drop the23912403 * icloglock to ensure we are the only one that23922404 * can update it.23932405 */23942406 ASSERT(XFS_LSN_CMP(atomic64_read(&log->l_last_sync_lsn),23952407 be64_to_cpu(iclog->ic_header.h_lsn)) <= 0);23962396- atomic64_set(&log->l_last_sync_lsn,23972397- be64_to_cpu(iclog->ic_header.h_lsn));24082408+ if (iclog->ic_callback)24092409+ atomic64_set(&log->l_last_sync_lsn,24102410+ be64_to_cpu(iclog->ic_header.h_lsn));2398241123992412 } else24002413 ioerrors++;
+1-1
fs/xfs/xfs_log_recover.c
···35413541 * - order is important.35423542 */35433543 error = xlog_bread_offset(log, 0,35443544- bblks - split_bblks, hbp,35443544+ bblks - split_bblks, dbp,35453545 offset + BBTOB(split_bblks));35463546 if (error)35473547 goto bread_err2;
+2-2
include/linux/clk-provider.h
···335335struct clk_hw *__clk_get_hw(struct clk *clk);336336u8 __clk_get_num_parents(struct clk *clk);337337struct clk *__clk_get_parent(struct clk *clk);338338-inline int __clk_get_enable_count(struct clk *clk);339339-inline int __clk_get_prepare_count(struct clk *clk);338338+int __clk_get_enable_count(struct clk *clk);339339+int __clk_get_prepare_count(struct clk *clk);340340unsigned long __clk_get_rate(struct clk *clk);341341unsigned long __clk_get_flags(struct clk *clk);342342int __clk_is_enabled(struct clk *clk);
···11+/*22+ * omap_ocp2scp.h -- ocp2scp header file33+ *44+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com55+ * This program is free software; you can redistribute it and/or modify66+ * it under the terms of the GNU General Public License as published by77+ * the Free Software Foundation; either version 2 of the License, or88+ * (at your option) any later version.99+ *1010+ * Author: Kishon Vijay Abraham I <kishon@ti.com>1111+ *1212+ * This program is distributed in the hope that it will be useful,1313+ * but WITHOUT ANY WARRANTY; without even the implied warranty of1414+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1515+ * GNU General Public License for more details.1616+ *1717+ */1818+1919+#ifndef __DRIVERS_OMAP_OCP2SCP_H2020+#define __DRIVERS_OMAP_OCP2SCP_H2121+2222+struct omap_ocp2scp_dev {2323+ const char *drv_name;2424+ struct resource *res;2525+};2626+2727+struct omap_ocp2scp_platform_data {2828+ int dev_cnt;2929+ struct omap_ocp2scp_dev **devices;3030+};3131+#endif /* __DRIVERS_OMAP_OCP2SCP_H */
+2
include/linux/rio.h
···275275 * struct rio_net - RIO network info276276 * @node: Node in global list of RIO networks277277 * @devices: List of devices in this network278278+ * @switches: List of switches in this netowrk278279 * @mports: List of master ports accessing this network279280 * @hport: Default port for accessing this network280281 * @id: RIO network ID282282+ * @destid_table: destID allocation table281283 */282284struct rio_net {283285 struct list_head node; /* node in list of networks */
-1
include/uapi/linux/eventpoll.h
···2525#define EPOLL_CTL_ADD 12626#define EPOLL_CTL_DEL 22727#define EPOLL_CTL_MOD 32828-#define EPOLL_CTL_DISABLE 429283029/*3130 * Request the handling of system wakeup events so as to prevent system suspends
+9
include/uapi/linux/oom.h
···88#define OOM_SCORE_ADJ_MIN (-1000)99#define OOM_SCORE_ADJ_MAX 100010101111+/*1212+ * /proc/<pid>/oom_adj set to -17 protects from the oom killer for legacy1313+ * purposes.1414+ */1515+#define OOM_DISABLE (-17)1616+/* inclusive */1717+#define OOM_ADJUST_MIN (-16)1818+#define OOM_ADJUST_MAX 151919+1120#endif /* _UAPI__INCLUDE_LINUX_OOM_H */
···716716 struct futex_pi_state **ps,717717 struct task_struct *task, int set_waiters)718718{719719- int lock_taken, ret, ownerdied = 0;719719+ int lock_taken, ret, force_take = 0;720720 u32 uval, newval, curval, vpid = task_pid_vnr(task);721721722722retry:···755755 newval = curval | FUTEX_WAITERS;756756757757 /*758758- * There are two cases, where a futex might have no owner (the759759- * owner TID is 0): OWNER_DIED. We take over the futex in this760760- * case. We also do an unconditional take over, when the owner761761- * of the futex died.762762- *763763- * This is safe as we are protected by the hash bucket lock !758758+ * Should we force take the futex? See below.764759 */765765- if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {766766- /* Keep the OWNER_DIED bit */760760+ if (unlikely(force_take)) {761761+ /*762762+ * Keep the OWNER_DIED and the WAITERS bit and set the763763+ * new TID value.764764+ */767765 newval = (curval & ~FUTEX_TID_MASK) | vpid;768768- ownerdied = 0;766766+ force_take = 0;769767 lock_taken = 1;770768 }771769···773775 goto retry;774776775777 /*776776- * We took the lock due to owner died take over.778778+ * We took the lock due to forced take over.777779 */778780 if (unlikely(lock_taken))779781 return 1;···788790 switch (ret) {789791 case -ESRCH:790792 /*791791- * No owner found for this futex. Check if the792792- * OWNER_DIED bit is set to figure out whether793793- * this is a robust futex or not.793793+ * We failed to find an owner for this794794+ * futex. So we have no pi_state to block795795+ * on. This can happen in two cases:796796+ *797797+ * 1) The owner died798798+ * 2) A stale FUTEX_WAITERS bit799799+ *800800+ * Re-read the futex value.794801 */795802 if (get_futex_value_locked(&curval, uaddr))796803 return -EFAULT;797804798805 /*799799- * We simply start over in case of a robust800800- * futex. The code above will take the futex801801- * and return happy.806806+ * If the owner died or we have a stale807807+ * WAITERS bit the owner TID in the user space808808+ * futex is 0.802809 */803803- if (curval & FUTEX_OWNER_DIED) {804804- ownerdied = 1;810810+ if (!(curval & FUTEX_TID_MASK)) {811811+ force_take = 1;805812 goto retry;806813 }807814 default:
+16-11
kernel/module.c
···22932293 src = (void *)info->hdr + symsect->sh_offset;22942294 nsrc = symsect->sh_size / sizeof(*src);2295229522962296+ /* strtab always starts with a nul, so offset 0 is the empty string. */22972297+ strtab_size = 1;22982298+22962299 /* Compute total space required for the core symbols' strtab. */22972297- for (ndst = i = strtab_size = 1; i < nsrc; ++i, ++src)22982298- if (is_core_symbol(src, info->sechdrs, info->hdr->e_shnum)) {22992299- strtab_size += strlen(&info->strtab[src->st_name]) + 1;23002300+ for (ndst = i = 0; i < nsrc; i++) {23012301+ if (i == 0 ||23022302+ is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum)) {23032303+ strtab_size += strlen(&info->strtab[src[i].st_name])+1;23002304 ndst++;23012305 }23062306+ }2302230723032308 /* Append room for core symbols at end of core part. */23042309 info->symoffs = ALIGN(mod->core_size, symsect->sh_addralign ?: 1);···23372332 mod->core_symtab = dst = mod->module_core + info->symoffs;23382333 mod->core_strtab = s = mod->module_core + info->stroffs;23392334 src = mod->symtab;23402340- *dst = *src;23412335 *s++ = 0;23422342- for (ndst = i = 1; i < mod->num_symtab; ++i, ++src) {23432343- if (!is_core_symbol(src, info->sechdrs, info->hdr->e_shnum))23442344- continue;23452345-23462346- dst[ndst] = *src;23472347- dst[ndst++].st_name = s - mod->core_strtab;23482348- s += strlcpy(s, &mod->strtab[src->st_name], KSYM_NAME_LEN) + 1;23362336+ for (ndst = i = 0; i < mod->num_symtab; i++) {23372337+ if (i == 0 ||23382338+ is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum)) {23392339+ dst[ndst] = src[i];23402340+ dst[ndst++].st_name = s - mod->core_strtab;23412341+ s += strlcpy(s, &mod->strtab[src[i].st_name],23422342+ KSYM_NAME_LEN) + 1;23432343+ }23492344 }23502345 mod->core_num_syms = ndst;23512346}
···9898{9999 unsigned long addr = (unsigned long)vaddr;100100101101- if (addr >= PKMAP_ADDR(0) && addr <= PKMAP_ADDR(LAST_PKMAP)) {101101+ if (addr >= PKMAP_ADDR(0) && addr < PKMAP_ADDR(LAST_PKMAP)) {102102 int i = (addr - PKMAP_ADDR(0)) >> PAGE_SHIFT;103103 return pte_page(pkmap_page_table[i]);104104 }
+50-17
mm/memcontrol.c
···10551055 struct mem_cgroup *memcg)10561056{10571057 struct mem_cgroup_per_zone *mz;10581058+ struct lruvec *lruvec;1058105910591059- if (mem_cgroup_disabled())10601060- return &zone->lruvec;10601060+ if (mem_cgroup_disabled()) {10611061+ lruvec = &zone->lruvec;10621062+ goto out;10631063+ }1061106410621065 mz = mem_cgroup_zoneinfo(memcg, zone_to_nid(zone), zone_idx(zone));10631063- return &mz->lruvec;10661066+ lruvec = &mz->lruvec;10671067+out:10681068+ /*10691069+ * Since a node can be onlined after the mem_cgroup was created,10701070+ * we have to be prepared to initialize lruvec->zone here;10711071+ * and if offlined then reonlined, we need to reinitialize it.10721072+ */10731073+ if (unlikely(lruvec->zone != zone))10741074+ lruvec->zone = zone;10751075+ return lruvec;10641076}1065107710661078/*···10991087 struct mem_cgroup_per_zone *mz;11001088 struct mem_cgroup *memcg;11011089 struct page_cgroup *pc;10901090+ struct lruvec *lruvec;1102109111031103- if (mem_cgroup_disabled())11041104- return &zone->lruvec;10921092+ if (mem_cgroup_disabled()) {10931093+ lruvec = &zone->lruvec;10941094+ goto out;10951095+ }1105109611061097 pc = lookup_page_cgroup(page);11071098 memcg = pc->mem_cgroup;···11221107 pc->mem_cgroup = memcg = root_mem_cgroup;1123110811241109 mz = page_cgroup_zoneinfo(memcg, page);11251125- return &mz->lruvec;11101110+ lruvec = &mz->lruvec;11111111+out:11121112+ /*11131113+ * Since a node can be onlined after the mem_cgroup was created,11141114+ * we have to be prepared to initialize lruvec->zone here;11151115+ * and if offlined then reonlined, we need to reinitialize it.11161116+ */11171117+ if (unlikely(lruvec->zone != zone))11181118+ lruvec->zone = zone;11191119+ return lruvec;11261120}1127112111281122/**···14761452static u64 mem_cgroup_get_limit(struct mem_cgroup *memcg)14771453{14781454 u64 limit;14791479- u64 memsw;1480145514811456 limit = res_counter_read_u64(&memcg->res, RES_LIMIT);14821482- limit += total_swap_pages << PAGE_SHIFT;1483145714841484- memsw = res_counter_read_u64(&memcg->memsw, RES_LIMIT);14851458 /*14861486- * If memsw is finite and limits the amount of swap space available14871487- * to this memcg, return that limit.14591459+ * Do not consider swap space if we cannot swap due to swappiness14881460 */14891489- return min(limit, memsw);14611461+ if (mem_cgroup_swappiness(memcg)) {14621462+ u64 memsw;14631463+14641464+ limit += total_swap_pages << PAGE_SHIFT;14651465+ memsw = res_counter_read_u64(&memcg->memsw, RES_LIMIT);14661466+14671467+ /*14681468+ * If memsw is finite and limits the amount of swap space14691469+ * available to this memcg, return that limit.14701470+ */14711471+ limit = min(limit, memsw);14721472+ }14731473+14741474+ return limit;14901475}1491147614921477void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,···37213688static bool mem_cgroup_force_empty_list(struct mem_cgroup *memcg,37223689 int node, int zid, enum lru_list lru)37233690{37243724- struct mem_cgroup_per_zone *mz;36913691+ struct lruvec *lruvec;37253692 unsigned long flags, loop;37263693 struct list_head *list;37273694 struct page *busy;37283695 struct zone *zone;3729369637303697 zone = &NODE_DATA(node)->node_zones[zid];37313731- mz = mem_cgroup_zoneinfo(memcg, node, zid);37323732- list = &mz->lruvec.lists[lru];36983698+ lruvec = mem_cgroup_zone_lruvec(zone, memcg);36993699+ list = &lruvec->lists[lru];3733370037343734- loop = mz->lru_size[lru];37013701+ loop = mem_cgroup_get_lru_size(lruvec, lru);37353702 /* give some margin against EBUSY etc...*/37363703 loop += 256;37373704 busy = NULL;···4769473647704737 for (zone = 0; zone < MAX_NR_ZONES; zone++) {47714738 mz = &pn->zoneinfo[zone];47724772- lruvec_init(&mz->lruvec, &NODE_DATA(node)->node_zones[zone]);47394739+ lruvec_init(&mz->lruvec);47734740 mz->usage_in_excess = 0;47744741 mz->on_tree = false;47754742 mz->memcg = memcg;
+4-6
mm/memory.c
···25272527 int ret = 0;25282528 int page_mkwrite = 0;25292529 struct page *dirty_page = NULL;25302530- unsigned long mmun_start; /* For mmu_notifiers */25312531- unsigned long mmun_end; /* For mmu_notifiers */25322532- bool mmun_called = false; /* For mmu_notifiers */25302530+ unsigned long mmun_start = 0; /* For mmu_notifiers */25312531+ unsigned long mmun_end = 0; /* For mmu_notifiers */2533253225342533 old_page = vm_normal_page(vma, address, orig_pte);25352534 if (!old_page) {···27072708 goto oom_free_new;2708270927092710 mmun_start = address & PAGE_MASK;27102710- mmun_end = (address & PAGE_MASK) + PAGE_SIZE;27112711- mmun_called = true;27112711+ mmun_end = mmun_start + PAGE_SIZE;27122712 mmu_notifier_invalidate_range_start(mm, mmun_start, mmun_end);2713271327142714 /*···27762778 page_cache_release(new_page);27772779unlock:27782780 pte_unmap_unlock(page_table, ptl);27792779- if (mmun_called)27812781+ if (mmun_end > mmun_start)27802782 mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);27812783 if (old_page) {27822784 /*
-7
mm/memory_hotplug.c
···106106void __ref put_page_bootmem(struct page *page)107107{108108 unsigned long type;109109- struct zone *zone;110109111110 type = (unsigned long) page->lru.next;112111 BUG_ON(type < MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE ||···116117 set_page_private(page, 0);117118 INIT_LIST_HEAD(&page->lru);118119 __free_pages_bootmem(page, 0);119119-120120- zone = page_zone(page);121121- zone_span_writelock(zone);122122- zone->present_pages++;123123- zone_span_writeunlock(zone);124124- totalram_pages++;125120 }126121127122}
···45054505 zone->zone_pgdat = pgdat;4506450645074507 zone_pcp_init(zone);45084508- lruvec_init(&zone->lruvec, zone);45084508+ lruvec_init(&zone->lruvec);45094509 if (!size)45104510 continue;45114511···60976097 page->mapping, page->index);60986098 dump_page_flags(page->flags);60996099 mem_cgroup_print_bad_page(page);61006100-}61016101-61026102-/* reset zone->present_pages */61036103-void reset_zone_present_pages(void)61046104-{61056105- struct zone *z;61066106- int i, nid;61076107-61086108- for_each_node_state(nid, N_HIGH_MEMORY) {61096109- for (i = 0; i < MAX_NR_ZONES; i++) {61106110- z = NODE_DATA(nid)->node_zones + i;61116111- z->present_pages = 0;61126112- }61136113- }61146114-}61156115-61166116-/* calculate zone's present pages in buddy system */61176117-void fixup_zone_present_pages(int nid, unsigned long start_pfn,61186118- unsigned long end_pfn)61196119-{61206120- struct zone *z;61216121- unsigned long zone_start_pfn, zone_end_pfn;61226122- int i;61236123-61246124- for (i = 0; i < MAX_NR_ZONES; i++) {61256125- z = NODE_DATA(nid)->node_zones + i;61266126- zone_start_pfn = z->zone_start_pfn;61276127- zone_end_pfn = zone_start_pfn + z->spanned_pages;61286128-61296129- /* if the two regions intersect */61306130- if (!(zone_start_pfn >= end_pfn || zone_end_pfn <= start_pfn))61316131- z->present_pages += min(end_pfn, zone_end_pfn) -61326132- max(start_pfn, zone_start_pfn);61336133- }61346100}
+15-3
mm/shmem.c
···643643 kfree(info->symlink);644644645645 simple_xattrs_free(&info->xattrs);646646- BUG_ON(inode->i_blocks);646646+ WARN_ON(inode->i_blocks);647647 shmem_free_inode(inode->i_sb);648648 clear_inode(inode);649649}···11451145 if (!error) {11461146 error = shmem_add_to_page_cache(page, mapping, index,11471147 gfp, swp_to_radix_entry(swap));11481148- /* We already confirmed swap, and make no allocation */11491149- VM_BUG_ON(error);11481148+ /*11491149+ * We already confirmed swap under page lock, and make11501150+ * no memory allocation here, so usually no possibility11511151+ * of error; but free_swap_and_cache() only trylocks a11521152+ * page, so it is just possible that the entry has been11531153+ * truncated or holepunched since swap was confirmed.11541154+ * shmem_undo_range() will have done some of the11551155+ * unaccounting, now delete_from_swap_cache() will do11561156+ * the rest (including mem_cgroup_uncharge_swapcache).11571157+ * Reset swap.val? No, leave it so "failed" goes back to11581158+ * "repeat": reading a hole and writing should succeed.11591159+ */11601160+ if (error)11611161+ delete_from_swap_cache(page);11501162 }11511163 if (error)11521164 goto failed;
···17601760 return false;17611761}1762176217631763-#ifdef CONFIG_COMPACTION17641764-/*17651765- * If compaction is deferred for sc->order then scale the number of pages17661766- * reclaimed based on the number of consecutive allocation failures17671767- */17681768-static unsigned long scale_for_compaction(unsigned long pages_for_compaction,17691769- struct lruvec *lruvec, struct scan_control *sc)17701770-{17711771- struct zone *zone = lruvec_zone(lruvec);17721772-17731773- if (zone->compact_order_failed <= sc->order)17741774- pages_for_compaction <<= zone->compact_defer_shift;17751775- return pages_for_compaction;17761776-}17771777-#else17781778-static unsigned long scale_for_compaction(unsigned long pages_for_compaction,17791779- struct lruvec *lruvec, struct scan_control *sc)17801780-{17811781- return pages_for_compaction;17821782-}17831783-#endif17841784-17851763/*17861764 * Reclaim/compaction is used for high-order allocation requests. It reclaims17871765 * order-0 pages before compacting the zone. should_continue_reclaim() returns···18071829 * inactive lists are large enough, continue reclaiming18081830 */18091831 pages_for_compaction = (2UL << sc->order);18101810-18111811- pages_for_compaction = scale_for_compaction(pages_for_compaction,18121812- lruvec, sc);18131832 inactive_lru_pages = get_lru_size(lruvec, LRU_INACTIVE_FILE);18141833 if (nr_swap_pages > 0)18151834 inactive_lru_pages += get_lru_size(lruvec, LRU_INACTIVE_ANON);···29923017 &balanced_classzone_idx);29933018 }29943019 }30203020+30213021+ current->reclaim_state = NULL;29953022 return 0;29963023}29973024
+6-6
net/batman-adv/soft-interface.c
···347347348348 soft_iface->last_rx = jiffies;349349350350+ /* Let the bridge loop avoidance check the packet. If will351351+ * not handle it, we can safely push it up.352352+ */353353+ if (batadv_bla_rx(bat_priv, skb, vid, is_bcast))354354+ goto out;355355+350356 if (orig_node)351357 batadv_tt_add_temporary_global_entry(bat_priv, orig_node,352358 ethhdr->h_source);353359354360 if (batadv_is_ap_isolated(bat_priv, ethhdr->h_source, ethhdr->h_dest))355361 goto dropped;356356-357357- /* Let the bridge loop avoidance check the packet. If will358358- * not handle it, we can safely push it up.359359- */360360- if (batadv_bla_rx(bat_priv, skb, vid, is_bcast))361361- goto out;362362363363 netif_rx(skb);364364 goto out;
+14-1
net/batman-adv/translation-table.c
···861861 */862862 common->flags &= ~BATADV_TT_CLIENT_TEMP;863863864864+ /* the change can carry possible "attribute" flags like the865865+ * TT_CLIENT_WIFI, therefore they have to be copied in the866866+ * client entry867867+ */868868+ tt_global_entry->common.flags |= flags;869869+864870 /* If there is the BATADV_TT_CLIENT_ROAM flag set, there is only865871 * one originator left in the list and we previously received a866872 * delete + roaming change for this originator.···1580157415811575 memcpy(tt_change->addr, tt_common_entry->addr,15821576 ETH_ALEN);15831583- tt_change->flags = BATADV_NO_FLAGS;15771577+ tt_change->flags = tt_common_entry->flags;1584157815851579 tt_count++;15861580 tt_change++;···25502544 const unsigned char *addr)25512545{25522546 bool ret = false;25472547+25482548+ /* if the originator is a backbone node (meaning it belongs to the same25492549+ * LAN of this node) the temporary client must not be added because to25502550+ * reach such destination the node must use the LAN instead of the mesh25512551+ */25522552+ if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig))25532553+ goto out;2553255425542555 if (!batadv_tt_global_add(bat_priv, orig_node, addr,25552556 BATADV_TT_CLIENT_TEMP,
···457457 struct inet_sock *inet = inet_sk(sk);458458 int val = 0, err;459459460460- if (((1<<optname) & ((1<<IP_PKTINFO) | (1<<IP_RECVTTL) |461461- (1<<IP_RECVOPTS) | (1<<IP_RECVTOS) |462462- (1<<IP_RETOPTS) | (1<<IP_TOS) |463463- (1<<IP_TTL) | (1<<IP_HDRINCL) |464464- (1<<IP_MTU_DISCOVER) | (1<<IP_RECVERR) |465465- (1<<IP_ROUTER_ALERT) | (1<<IP_FREEBIND) |466466- (1<<IP_PASSSEC) | (1<<IP_TRANSPARENT) |467467- (1<<IP_MINTTL) | (1<<IP_NODEFRAG))) ||468468- optname == IP_UNICAST_IF ||469469- optname == IP_MULTICAST_TTL ||470470- optname == IP_MULTICAST_ALL ||471471- optname == IP_MULTICAST_LOOP ||472472- optname == IP_RECVORIGDSTADDR) {460460+ switch (optname) {461461+ case IP_PKTINFO:462462+ case IP_RECVTTL:463463+ case IP_RECVOPTS:464464+ case IP_RECVTOS:465465+ case IP_RETOPTS:466466+ case IP_TOS:467467+ case IP_TTL:468468+ case IP_HDRINCL:469469+ case IP_MTU_DISCOVER:470470+ case IP_RECVERR:471471+ case IP_ROUTER_ALERT:472472+ case IP_FREEBIND:473473+ case IP_PASSSEC:474474+ case IP_TRANSPARENT:475475+ case IP_MINTTL:476476+ case IP_NODEFRAG:477477+ case IP_UNICAST_IF:478478+ case IP_MULTICAST_TTL:479479+ case IP_MULTICAST_ALL:480480+ case IP_MULTICAST_LOOP:481481+ case IP_RECVORIGDSTADDR:473482 if (optlen >= sizeof(int)) {474483 if (get_user(val, (int __user *) optval))475484 return -EFAULT;
···12131213wait_for_sndbuf:12141214 set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);12151215wait_for_memory:12161216- if (copied && likely(!tp->repair))12161216+ if (copied)12171217 tcp_push(sk, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH);1218121812191219 if ((err = sk_stream_wait_memory(sk, &timeo)) != 0)···12241224 }1225122512261226out:12271227- if (copied && likely(!tp->repair))12271227+ if (copied)12281228 tcp_push(sk, flags, mss_now, tp->nonagle);12291229 release_sock(sk);12301230 return copied + copied_syn;
+10-5
net/ipv4/tcp_input.c
···53205320 goto discard;53215321 }5322532253235323- /* ts_recent update must be made after we are sure that the packet53245324- * is in window.53255325- */53265326- tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);53275327-53285323 /* step 3: check security and precedence [ignored] */5329532453305325 /* step 4: Check for a SYN···55535558step5:55545559 if (th->ack && tcp_ack(sk, skb, FLAG_SLOWPATH) < 0)55555560 goto discard;55615561+55625562+ /* ts_recent update must be made after we are sure that the packet55635563+ * is in window.55645564+ */55655565+ tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);5556556655575567 tcp_rcv_rtt_measure_ts(sk, skb);55585568···61366136 }61376137 } else61386138 goto discard;61396139+61406140+ /* ts_recent update must be made after we are sure that the packet61416141+ * is in window.61426142+ */61436143+ tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);6139614461406145 /* step 6: check the URG bit */61416146 tcp_urg(sk, skb, th);
···19861986 tso_segs = tcp_init_tso_segs(sk, skb, mss_now);19871987 BUG_ON(!tso_segs);1988198819891989+ if (unlikely(tp->repair) && tp->repair_queue == TCP_SEND_QUEUE)19901990+ goto repair; /* Skip network transmission */19911991+19891992 cwnd_quota = tcp_cwnd_test(tp, skb);19901993 if (!cwnd_quota)19911994 break;···20292026 if (unlikely(tcp_transmit_skb(sk, skb, 1, gfp)))20302027 break;2031202820292029+repair:20322030 /* Advance the send_head. This one is sent out.20332031 * This call will increment packets_out.20342032 */
+1
net/ipv6/ipv6_sockglue.c
···827827 if (val < 0 || val > 255)828828 goto e_inval;829829 np->min_hopcount = val;830830+ retv = 0;830831 break;831832 case IPV6_DONTFRAG:832833 np->dontfrag = valbool;
···11+#ifndef LIST_H22+#define LIST_H33+44+/*55+ * Copied from include/linux/...66+ */77+88+#undef offsetof99+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)1010+1111+/**1212+ * container_of - cast a member of a structure out to the containing structure1313+ * @ptr: the pointer to the member.1414+ * @type: the type of the container struct this is embedded in.1515+ * @member: the name of the member within the struct.1616+ *1717+ */1818+#define container_of(ptr, type, member) ({ \1919+ const typeof( ((type *)0)->member ) *__mptr = (ptr); \2020+ (type *)( (char *)__mptr - offsetof(type,member) );})2121+2222+2323+struct list_head {2424+ struct list_head *next, *prev;2525+};2626+2727+2828+#define LIST_HEAD_INIT(name) { &(name), &(name) }2929+3030+#define LIST_HEAD(name) \3131+ struct list_head name = LIST_HEAD_INIT(name)3232+3333+/**3434+ * list_entry - get the struct for this entry3535+ * @ptr: the &struct list_head pointer.3636+ * @type: the type of the struct this is embedded in.3737+ * @member: the name of the list_struct within the struct.3838+ */3939+#define list_entry(ptr, type, member) \4040+ container_of(ptr, type, member)4141+4242+/**4343+ * list_for_each_entry - iterate over list of given type4444+ * @pos: the type * to use as a loop cursor.4545+ * @head: the head for your list.4646+ * @member: the name of the list_struct within the struct.4747+ */4848+#define list_for_each_entry(pos, head, member) \4949+ for (pos = list_entry((head)->next, typeof(*pos), member); \5050+ &pos->member != (head); \5151+ pos = list_entry(pos->member.next, typeof(*pos), member))5252+5353+/**5454+ * list_empty - tests whether a list is empty5555+ * @head: the list to test.5656+ */5757+static inline int list_empty(const struct list_head *head)5858+{5959+ return head->next == head;6060+}6161+6262+/*6363+ * Insert a new entry between two known consecutive entries.6464+ *6565+ * This is only for internal list manipulation where we know6666+ * the prev/next entries already!6767+ */6868+static inline void __list_add(struct list_head *_new,6969+ struct list_head *prev,7070+ struct list_head *next)7171+{7272+ next->prev = _new;7373+ _new->next = next;7474+ _new->prev = prev;7575+ prev->next = _new;7676+}7777+7878+/**7979+ * list_add_tail - add a new entry8080+ * @new: new entry to be added8181+ * @head: list head to add it before8282+ *8383+ * Insert a new entry before the specified head.8484+ * This is useful for implementing queues.8585+ */8686+static inline void list_add_tail(struct list_head *_new, struct list_head *head)8787+{8888+ __list_add(_new, head->prev, head);8989+}9090+9191+#endif
+2-2
scripts/kconfig/lkc_proto.h
···2121P(menu_get_parent_menu,struct menu *,(struct menu *menu));2222P(menu_has_help,bool,(struct menu *menu));2323P(menu_get_help,const char *,(struct menu *menu));2424-P(get_symbol_str, void, (struct gstr *r, struct symbol *sym, struct jk_head2424+P(get_symbol_str, void, (struct gstr *r, struct symbol *sym, struct list_head2525 *head));2626-P(get_relations_str, struct gstr, (struct symbol **sym_arr, struct jk_head2626+P(get_relations_str, struct gstr, (struct symbol **sym_arr, struct list_head2727 *head));2828P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help));2929
+3-3
scripts/kconfig/mconf.c
···312312313313314314struct search_data {315315- struct jk_head *head;315315+ struct list_head *head;316316 struct menu **targets;317317 int *keys;318318};···323323 struct jump_key *pos;324324 int k = 0;325325326326- CIRCLEQ_FOREACH(pos, data->head, entries) {326326+ list_for_each_entry(pos, data->head, entries) {327327 if (pos->offset >= start && pos->offset < end) {328328 char header[4];329329···375375376376 sym_arr = sym_re_search(dialog_input);377377 do {378378- struct jk_head head = CIRCLEQ_HEAD_INITIALIZER(head);378378+ LIST_HEAD(head);379379 struct menu *targets[JUMP_NB];380380 int keys[JUMP_NB + 1], i;381381 struct search_data data = {
+8-6
scripts/kconfig/menu.c
···508508}509509510510static void get_prompt_str(struct gstr *r, struct property *prop,511511- struct jk_head *head)511511+ struct list_head *head)512512{513513 int i, j;514514 struct menu *submenu[8], *menu, *location = NULL;···544544 } else545545 jump->target = location;546546547547- if (CIRCLEQ_EMPTY(head))547547+ if (list_empty(head))548548 jump->index = 0;549549 else550550- jump->index = CIRCLEQ_LAST(head)->index + 1;550550+ jump->index = list_entry(head->prev, struct jump_key,551551+ entries)->index + 1;551552552552- CIRCLEQ_INSERT_TAIL(head, jump, entries);553553+ list_add_tail(&jump->entries, head);553554 }554555555556 if (i > 0) {···574573/*575574 * head is optional and may be NULL576575 */577577-void get_symbol_str(struct gstr *r, struct symbol *sym, struct jk_head *head)576576+void get_symbol_str(struct gstr *r, struct symbol *sym,577577+ struct list_head *head)578578{579579 bool hit;580580 struct property *prop;···614612 str_append(r, "\n\n");615613}616614617617-struct gstr get_relations_str(struct symbol **sym_arr, struct jk_head *head)615615+struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head)618616{619617 struct symbol *sym;620618 struct gstr res = str_new();
+13-5
security/device_cgroup.c
···164164 struct dev_exception_item *ex, *tmp;165165166166 list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) {167167- list_del(&ex->list);168168- kfree(ex);167167+ list_del_rcu(&ex->list);168168+ kfree_rcu(ex, rcu);169169 }170170}171171···298298 struct dev_exception_item *ex;299299 bool match = false;300300301301- list_for_each_entry(ex, &dev_cgroup->exceptions, list) {301301+ list_for_each_entry_rcu(ex, &dev_cgroup->exceptions, list) {302302 if ((refex->type & DEV_BLOCK) && !(ex->type & DEV_BLOCK))303303 continue;304304 if ((refex->type & DEV_CHAR) && !(ex->type & DEV_CHAR))···352352 */353353static inline int may_allow_all(struct dev_cgroup *parent)354354{355355+ if (!parent)356356+ return 1;355357 return parent->behavior == DEVCG_DEFAULT_ALLOW;356358}357359···378376 int count, rc;379377 struct dev_exception_item ex;380378 struct cgroup *p = devcgroup->css.cgroup;381381- struct dev_cgroup *parent = cgroup_to_devcgroup(p->parent);379379+ struct dev_cgroup *parent = NULL;382380383381 if (!capable(CAP_SYS_ADMIN))384382 return -EPERM;383383+384384+ if (p->parent)385385+ parent = cgroup_to_devcgroup(p->parent);385386386387 memset(&ex, 0, sizeof(ex));387388 b = buffer;···396391 if (!may_allow_all(parent))397392 return -EPERM;398393 dev_exception_clean(devcgroup);394394+ devcgroup->behavior = DEVCG_DEFAULT_ALLOW;395395+ if (!parent)396396+ break;397397+399398 rc = dev_exceptions_copy(&devcgroup->exceptions,400399 &parent->exceptions);401400 if (rc)402401 return rc;403403- devcgroup->behavior = DEVCG_DEFAULT_ALLOW;404402 break;405403 case DEVCG_DENY:406404 dev_exception_clean(devcgroup);
···782782 wm8978->mclk_idx = -1;783783 f_sel = wm8978->f_mclk;784784 } else {785785- if (!wm8978->f_pllout) {785785+ if (!wm8978->f_opclk) {786786 /* We only enter here, if OPCLK is not used */787787 int ret = wm8978_configure_pll(codec);788788 if (ret < 0)
+1-1
sound/soc/codecs/wm8994.c
···37223722 } while (count--);3723372337243724 if (count == 0)37253725- dev_warn(codec->dev, "No impedence range reported for jack\n");37253725+ dev_warn(codec->dev, "No impedance range reported for jack\n");3726372637273727#ifndef CONFIG_SND_SOC_WM8994_MODULE37283728 trace_snd_soc_jack_irq(dev_name(codec->dev));
+13-4
sound/soc/mxs/mxs-saif.c
···523523524524 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {525525 /*526526- * write a data to saif data register to trigger527527- * the transfer526526+ * write data to saif data register to trigger527527+ * the transfer.528528+ * For 24-bit format the 32-bit FIFO register stores529529+ * only one channel, so we need to write twice.530530+ * This is also safe for the other non 24-bit formats.528531 */532532+ __raw_writel(0, saif->base + SAIF_DATA);529533 __raw_writel(0, saif->base + SAIF_DATA);530534 } else {531535 /*532532- * read a data from saif data register to trigger533533- * the receive536536+ * read data from saif data register to trigger537537+ * the receive.538538+ * For 24-bit format the 32-bit FIFO register stores539539+ * only one channel, so we need to read twice.540540+ * This is also safe for the other non 24-bit formats.534541 */542542+ __raw_readl(saif->base + SAIF_DATA);535543 __raw_readl(saif->base + SAIF_DATA);536544 }537545···820812MODULE_AUTHOR("Freescale Semiconductor, Inc.");821813MODULE_DESCRIPTION("MXS ASoC SAIF driver");822814MODULE_LICENSE("GPL");815815+MODULE_ALIAS("platform:mxs-saif");
+2
sound/soc/samsung/Kconfig
···207207 select SND_SOC_WM5102208208 select SND_SOC_WM5110209209 select SND_SOC_WM9081210210+ select SND_SOC_WM0010211211+ select SND_SOC_WM1250_EV1210212211213config SND_SOC_LOWLAND212214 tristate "Audio support for Wolfson Lowland"
···35353636#define EP_FLAG_ACTIVATED 03737#define EP_FLAG_RUNNING 13838+#define EP_FLAG_STOPPING 238393940/*4041 * snd_usb_endpoint is a model that abstracts everything related to an···503502 if (alive)504503 snd_printk(KERN_ERR "timeout: still %d active urbs on EP #%x\n",505504 alive, ep->ep_num);505505+ clear_bit(EP_FLAG_STOPPING, &ep->flags);506506507507 return 0;508508+}509509+510510+/* sync the pending stop operation;511511+ * this function itself doesn't trigger the stop operation512512+ */513513+void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep)514514+{515515+ if (ep && test_bit(EP_FLAG_STOPPING, &ep->flags))516516+ wait_clear_urbs(ep);508517}509518510519/*···929918930919 if (wait)931920 wait_clear_urbs(ep);921921+ else922922+ set_bit(EP_FLAG_STOPPING, &ep->flags);932923 }933924}934925
+1
sound/usb/endpoint.h
···1919int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, int can_sleep);2020void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep,2121 int force, int can_sleep, int wait);2222+void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep);2223int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep);2324int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep);2425void snd_usb_endpoint_free(struct list_head *head);
+3
sound/usb/pcm.c
···568568 goto unlock;569569 }570570571571+ snd_usb_endpoint_sync_pending_stop(subs->sync_endpoint);572572+ snd_usb_endpoint_sync_pending_stop(subs->data_endpoint);573573+571574 ret = set_format(subs, subs->cur_audiofmt);572575 if (ret < 0)573576 goto unlock;
···11-TARGETS = breakpoints kcmp mqueue vm cpu-hotplug memory-hotplug epoll11+TARGETS = breakpoints kcmp mqueue vm cpu-hotplug memory-hotplug2233all:44 for TARGET in $(TARGETS); do \
···11-/*22- * tools/testing/selftests/epoll/test_epoll.c33- *44- * Copyright 2012 Adobe Systems Incorporated55- *66- * This program is free software; you can redistribute it and/or modify77- * it under the terms of the GNU General Public License as published by88- * the Free Software Foundation; either version 2 of the License, or99- * (at your option) any later version.1010- *1111- * Paton J. Lewis <palewis@adobe.com>1212- *1313- */1414-1515-#include <errno.h>1616-#include <fcntl.h>1717-#include <pthread.h>1818-#include <stdio.h>1919-#include <stdlib.h>2020-#include <unistd.h>2121-#include <sys/epoll.h>2222-#include <sys/socket.h>2323-2424-/*2525- * A pointer to an epoll_item_private structure will be stored in the epoll2626- * item's event structure so that we can get access to the epoll_item_private2727- * data after calling epoll_wait:2828- */2929-struct epoll_item_private {3030- int index; /* Position of this struct within the epoll_items array. */3131- int fd;3232- uint32_t events;3333- pthread_mutex_t mutex; /* Guards the following variables... */3434- int stop;3535- int status; /* Stores any error encountered while handling item. */3636- /* The following variable allows us to test whether we have encountered3737- a problem while attempting to cancel and delete the associated3838- event. When the test program exits, 'deleted' should be exactly3939- one. If it is greater than one, then the failed test reflects a real4040- world situation where we would have tried to access the epoll item's4141- private data after deleting it: */4242- int deleted;4343-};4444-4545-struct epoll_item_private *epoll_items;4646-4747-/*4848- * Delete the specified item from the epoll set. In a real-world secneario this4949- * is where we would free the associated data structure, but in this testing5050- * environment we retain the structure so that we can test for double-deletion:5151- */5252-void delete_item(int index)5353-{5454- __sync_fetch_and_add(&epoll_items[index].deleted, 1);5555-}5656-5757-/*5858- * A pointer to a read_thread_data structure will be passed as the argument to5959- * each read thread:6060- */6161-struct read_thread_data {6262- int stop;6363- int status; /* Indicates any error encountered by the read thread. */6464- int epoll_set;6565-};6666-6767-/*6868- * The function executed by the read threads:6969- */7070-void *read_thread_function(void *function_data)7171-{7272- struct read_thread_data *thread_data =7373- (struct read_thread_data *)function_data;7474- struct epoll_event event_data;7575- struct epoll_item_private *item_data;7676- char socket_data;7777-7878- /* Handle events until we encounter an error or this thread's 'stop'7979- condition is set: */8080- while (1) {8181- int result = epoll_wait(thread_data->epoll_set,8282- &event_data,8383- 1, /* Number of desired events */8484- 1000); /* Timeout in ms */8585- if (result < 0) {8686- /* Breakpoints signal all threads. Ignore that while8787- debugging: */8888- if (errno == EINTR)8989- continue;9090- thread_data->status = errno;9191- return 0;9292- } else if (thread_data->stop)9393- return 0;9494- else if (result == 0) /* Timeout */9595- continue;9696-9797- /* We need the mutex here because checking for the stop9898- condition and re-enabling the epoll item need to be done9999- together as one atomic operation when EPOLL_CTL_DISABLE is100100- available: */101101- item_data = (struct epoll_item_private *)event_data.data.ptr;102102- pthread_mutex_lock(&item_data->mutex);103103-104104- /* Remove the item from the epoll set if we want to stop105105- handling that event: */106106- if (item_data->stop)107107- delete_item(item_data->index);108108- else {109109- /* Clear the data that was written to the other end of110110- our non-blocking socket: */111111- do {112112- if (read(item_data->fd, &socket_data, 1) < 1) {113113- if ((errno == EAGAIN) ||114114- (errno == EWOULDBLOCK))115115- break;116116- else117117- goto error_unlock;118118- }119119- } while (item_data->events & EPOLLET);120120-121121- /* The item was one-shot, so re-enable it: */122122- event_data.events = item_data->events;123123- if (epoll_ctl(thread_data->epoll_set,124124- EPOLL_CTL_MOD,125125- item_data->fd,126126- &event_data) < 0)127127- goto error_unlock;128128- }129129-130130- pthread_mutex_unlock(&item_data->mutex);131131- }132132-133133-error_unlock:134134- thread_data->status = item_data->status = errno;135135- pthread_mutex_unlock(&item_data->mutex);136136- return 0;137137-}138138-139139-/*140140- * A pointer to a write_thread_data structure will be passed as the argument to141141- * the write thread:142142- */143143-struct write_thread_data {144144- int stop;145145- int status; /* Indicates any error encountered by the write thread. */146146- int n_fds;147147- int *fds;148148-};149149-150150-/*151151- * The function executed by the write thread. It writes a single byte to each152152- * socket in turn until the stop condition for this thread is set. If writing to153153- * a socket would block (i.e. errno was EAGAIN), we leave that socket alone for154154- * the moment and just move on to the next socket in the list. We don't care155155- * about the order in which we deliver events to the epoll set. In fact we don't156156- * care about the data we're writing to the pipes at all; we just want to157157- * trigger epoll events:158158- */159159-void *write_thread_function(void *function_data)160160-{161161- const char data = 'X';162162- int index;163163- struct write_thread_data *thread_data =164164- (struct write_thread_data *)function_data;165165- while (!thread_data->stop)166166- for (index = 0;167167- !thread_data->stop && (index < thread_data->n_fds);168168- ++index)169169- if ((write(thread_data->fds[index], &data, 1) < 1) &&170170- (errno != EAGAIN) &&171171- (errno != EWOULDBLOCK)) {172172- thread_data->status = errno;173173- return;174174- }175175-}176176-177177-/*178178- * Arguments are currently ignored:179179- */180180-int main(int argc, char **argv)181181-{182182- const int n_read_threads = 100;183183- const int n_epoll_items = 500;184184- int index;185185- int epoll_set = epoll_create1(0);186186- struct write_thread_data write_thread_data = {187187- 0, 0, n_epoll_items, malloc(n_epoll_items * sizeof(int))188188- };189189- struct read_thread_data *read_thread_data =190190- malloc(n_read_threads * sizeof(struct read_thread_data));191191- pthread_t *read_threads = malloc(n_read_threads * sizeof(pthread_t));192192- pthread_t write_thread;193193-194194- printf("-----------------\n");195195- printf("Runing test_epoll\n");196196- printf("-----------------\n");197197-198198- epoll_items = malloc(n_epoll_items * sizeof(struct epoll_item_private));199199-200200- if (epoll_set < 0 || epoll_items == 0 || write_thread_data.fds == 0 ||201201- read_thread_data == 0 || read_threads == 0)202202- goto error;203203-204204- if (sysconf(_SC_NPROCESSORS_ONLN) < 2) {205205- printf("Error: please run this test on a multi-core system.\n");206206- goto error;207207- }208208-209209- /* Create the socket pairs and epoll items: */210210- for (index = 0; index < n_epoll_items; ++index) {211211- int socket_pair[2];212212- struct epoll_event event_data;213213- if (socketpair(AF_UNIX,214214- SOCK_STREAM | SOCK_NONBLOCK,215215- 0,216216- socket_pair) < 0)217217- goto error;218218- write_thread_data.fds[index] = socket_pair[0];219219- epoll_items[index].index = index;220220- epoll_items[index].fd = socket_pair[1];221221- if (pthread_mutex_init(&epoll_items[index].mutex, NULL) != 0)222222- goto error;223223- /* We always use EPOLLONESHOT because this test is currently224224- structured to demonstrate the need for EPOLL_CTL_DISABLE,225225- which only produces useful information in the EPOLLONESHOT226226- case (without EPOLLONESHOT, calling epoll_ctl with227227- EPOLL_CTL_DISABLE will never return EBUSY). If support for228228- testing events without EPOLLONESHOT is desired, it should229229- probably be implemented in a separate unit test. */230230- epoll_items[index].events = EPOLLIN | EPOLLONESHOT;231231- if (index < n_epoll_items / 2)232232- epoll_items[index].events |= EPOLLET;233233- epoll_items[index].stop = 0;234234- epoll_items[index].status = 0;235235- epoll_items[index].deleted = 0;236236- event_data.events = epoll_items[index].events;237237- event_data.data.ptr = &epoll_items[index];238238- if (epoll_ctl(epoll_set,239239- EPOLL_CTL_ADD,240240- epoll_items[index].fd,241241- &event_data) < 0)242242- goto error;243243- }244244-245245- /* Create and start the read threads: */246246- for (index = 0; index < n_read_threads; ++index) {247247- read_thread_data[index].stop = 0;248248- read_thread_data[index].status = 0;249249- read_thread_data[index].epoll_set = epoll_set;250250- if (pthread_create(&read_threads[index],251251- NULL,252252- read_thread_function,253253- &read_thread_data[index]) != 0)254254- goto error;255255- }256256-257257- if (pthread_create(&write_thread,258258- NULL,259259- write_thread_function,260260- &write_thread_data) != 0)261261- goto error;262262-263263- /* Cancel all event pollers: */264264-#ifdef EPOLL_CTL_DISABLE265265- for (index = 0; index < n_epoll_items; ++index) {266266- pthread_mutex_lock(&epoll_items[index].mutex);267267- ++epoll_items[index].stop;268268- if (epoll_ctl(epoll_set,269269- EPOLL_CTL_DISABLE,270270- epoll_items[index].fd,271271- NULL) == 0)272272- delete_item(index);273273- else if (errno != EBUSY) {274274- pthread_mutex_unlock(&epoll_items[index].mutex);275275- goto error;276276- }277277- /* EBUSY means events were being handled; allow the other thread278278- to delete the item. */279279- pthread_mutex_unlock(&epoll_items[index].mutex);280280- }281281-#else282282- for (index = 0; index < n_epoll_items; ++index) {283283- pthread_mutex_lock(&epoll_items[index].mutex);284284- ++epoll_items[index].stop;285285- pthread_mutex_unlock(&epoll_items[index].mutex);286286- /* Wait in case a thread running read_thread_function is287287- currently executing code between epoll_wait and288288- pthread_mutex_lock with this item. Note that a longer delay289289- would make double-deletion less likely (at the expense of290290- performance), but there is no guarantee that any delay would291291- ever be sufficient. Note also that we delete all event292292- pollers at once for testing purposes, but in a real-world293293- environment we are likely to want to be able to cancel event294294- pollers at arbitrary times. Therefore we can't improve this295295- situation by just splitting this loop into two loops296296- (i.e. signal 'stop' for all items, sleep, and then delete all297297- items). We also can't fix the problem via EPOLL_CTL_DEL298298- because that command can't prevent the case where some other299299- thread is executing read_thread_function within the region300300- mentioned above: */301301- usleep(1);302302- pthread_mutex_lock(&epoll_items[index].mutex);303303- if (!epoll_items[index].deleted)304304- delete_item(index);305305- pthread_mutex_unlock(&epoll_items[index].mutex);306306- }307307-#endif308308-309309- /* Shut down the read threads: */310310- for (index = 0; index < n_read_threads; ++index)311311- __sync_fetch_and_add(&read_thread_data[index].stop, 1);312312- for (index = 0; index < n_read_threads; ++index) {313313- if (pthread_join(read_threads[index], NULL) != 0)314314- goto error;315315- if (read_thread_data[index].status)316316- goto error;317317- }318318-319319- /* Shut down the write thread: */320320- __sync_fetch_and_add(&write_thread_data.stop, 1);321321- if ((pthread_join(write_thread, NULL) != 0) || write_thread_data.status)322322- goto error;323323-324324- /* Check for final error conditions: */325325- for (index = 0; index < n_epoll_items; ++index) {326326- if (epoll_items[index].status != 0)327327- goto error;328328- if (pthread_mutex_destroy(&epoll_items[index].mutex) < 0)329329- goto error;330330- }331331- for (index = 0; index < n_epoll_items; ++index)332332- if (epoll_items[index].deleted != 1) {333333- printf("Error: item data deleted %1d times.\n",334334- epoll_items[index].deleted);335335- goto error;336336- }337337-338338- printf("[PASS]\n");339339- return 0;340340-341341- error:342342- printf("[FAIL]\n");343343- return errno;344344-}