···1212Required subnode-properties:1313 - label: Descriptive name of the key.1414 - linux,code: Keycode to emit.1515- - channel: Channel this key is attached to, mut be 0 or 1.1515+ - channel: Channel this key is attached to, must be 0 or 1.1616 - voltage: Voltage in µV at lradc input when this key is pressed.17171818Example:
···66as RedBoot.7788The partition table should be a subnode of the mtd node and should be named99-'partitions'. Partitions are defined in subnodes of the partitions node.99+'partitions'. This node should have the following property:1010+- compatible : (required) must be "fixed-partitions"1111+Partitions are then defined in subnodes of the partitions node.10121113For backwards compatibility partitions as direct subnodes of the mtd device are1214supported. This use is discouraged.···38363937flash@0 {4038 partitions {3939+ compatible = "fixed-partitions";4140 #address-cells = <1>;4241 #size-cells = <1>;4342···56535754flash@1 {5855 partitions {5656+ compatible = "fixed-partitions";5957 #address-cells = <1>;6058 #size-cells = <2>;6159···70667167flash@2 {7268 partitions {6969+ compatible = "fixed-partitions";7370 #address-cells = <2>;7471 #size-cells = <2>;7572
+3-3
Documentation/devicetree/bindings/net/cpsw.txt
···40404141Slave Properties:4242Required properties:4343-- phy_id : Specifies slave phy id4443- phy-mode : See ethernet.txt file in the same directory45444645Optional properties:4746- dual_emac_res_vlan : Specifies VID to be used to segregate the ports4847- mac-address : See ethernet.txt file in the same directory4848+- phy_id : Specifies slave phy id4949- phy-handle : See ethernet.txt file in the same directory50505151Slave sub-nodes:5252- fixed-link : See fixed-link.txt file in the same directory5353- Either the properties phy_id and phy-mode,5454- or the sub-node fixed-link can be specified5353+ Either the property phy_id, or the sub-node5454+ fixed-link can be specified55555656Note: "ti,hwmods" field is used to fetch the base address and irq5757resources from TI, omap hwmod data base during device registration.
+8
MAINTAINERS
···84038403S: Maintained84048404F: drivers/pinctrl/samsung/8405840584068406+PIN CONTROLLER - SINGLE84078407+M: Tony Lindgren <tony@atomide.com>84088408+M: Haojian Zhuang <haojian.zhuang@linaro.org>84098409+L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)84108410+L: linux-omap@vger.kernel.org84118411+S: Maintained84128412+F: drivers/pinctrl/pinctrl-single.c84138413+84068414PIN CONTROLLER - ST SPEAR84078415M: Viresh Kumar <vireshk@kernel.org>84088416L: spear-devel@list.st.com
···445445 However some customers have peripherals mapped at this addr, so446446 Linux needs to be scooted a bit.447447 If you don't know what the above means, leave this setting alone.448448+ This needs to match memory start address specified in Device Tree448449449450config HIGHMEM450451 bool "High Memory Support"
+1-1
arch/arc/Makefile
···8181LIBGCC := $(shell $(CC) $(cflags-y) --print-libgcc-file-name)82828383# Modules with short calls might break for calls into builtin-kernel8484-KBUILD_CFLAGS_MODULE += -mlong-calls8484+KBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode85858686# Finally dump eveything into kernel build system8787KBUILD_CFLAGS += $(cflags-y)
···17171818 memory {1919 device_type = "memory";2020- reg = <0x0 0x80000000 0x0 0x40000000 /* 1 GB low mem */2020+ /* CONFIG_LINUX_LINK_BASE needs to match low mem start */2121+ reg = <0x0 0x80000000 0x0 0x20000000 /* 512 MB low mem */2122 0x1 0x00000000 0x0 0x40000000>; /* 1 GB highmem */2223 };2324
-2
arch/arc/include/asm/cache.h
···6262#define ARC_REG_IC_IVIC 0x106363#define ARC_REG_IC_CTRL 0x116464#define ARC_REG_IC_IVIL 0x196565-#if defined(CONFIG_ARC_MMU_V3) || defined(CONFIG_ARC_MMU_V4)6665#define ARC_REG_IC_PTAG 0x1E6767-#endif6866#define ARC_REG_IC_PTAG_HI 0x1F69677068/* Bit val in IC_CTRL */
+2-2
arch/arc/include/asm/mach_desc.h
···2323 * @dt_compat: Array of device tree 'compatible' strings2424 * (XXX: although only 1st entry is looked at)2525 * @init_early: Very early callback [called from setup_arch()]2626- * @init_cpu_smp: for each CPU as it is coming up (SMP as well as UP)2626+ * @init_per_cpu: for each CPU as it is coming up (SMP as well as UP)2727 * [(M):init_IRQ(), (o):start_kernel_secondary()]2828 * @init_machine: arch initcall level callback (e.g. populate static2929 * platform devices or parse Devicetree)···3535 const char **dt_compat;3636 void (*init_early)(void);3737#ifdef CONFIG_SMP3838- void (*init_cpu_smp)(unsigned int);3838+ void (*init_per_cpu)(unsigned int);3939#endif4040 void (*init_machine)(void);4141 void (*init_late)(void);
+2-2
arch/arc/include/asm/smp.h
···4848 * @init_early_smp: A SMP specific h/w block can init itself4949 * Could be common across platforms so not covered by5050 * mach_desc->init_early()5151- * @init_irq_cpu: Called for each core so SMP h/w block driver can do5151+ * @init_per_cpu: Called for each core so SMP h/w block driver can do5252 * any needed setup per cpu (e.g. IPI request)5353 * @cpu_kick: For Master to kickstart a cpu (optionally at a PC)5454 * @ipi_send: To send IPI to a @cpu···5757struct plat_smp_ops {5858 const char *info;5959 void (*init_early_smp)(void);6060- void (*init_irq_cpu)(int cpu);6060+ void (*init_per_cpu)(int cpu);6161 void (*cpu_kick)(int cpu, unsigned long pc);6262 void (*ipi_send)(int cpu);6363 void (*ipi_clear)(int irq);
···106106static int arcv2_irq_map(struct irq_domain *d, unsigned int irq,107107 irq_hw_number_t hw)108108{109109- if (irq == TIMER0_IRQ || irq == IPI_IRQ)109109+ /*110110+ * core intc IRQs [16, 23]:111111+ * Statically assigned always private-per-core (Timers, WDT, IPI, PCT)112112+ */113113+ if (hw < 24) {114114+ /*115115+ * A subsequent request_percpu_irq() fails if percpu_devid is116116+ * not set. That in turns sets NOAUTOEN, meaning each core needs117117+ * to call enable_percpu_irq()118118+ */119119+ irq_set_percpu_devid(irq);110120 irq_set_chip_and_handler(irq, &arcv2_irq_chip, handle_percpu_irq);111111- else121121+ } else {112122 irq_set_chip_and_handler(irq, &arcv2_irq_chip, handle_level_irq);123123+ }113124114125 return 0;115126}
+24-9
arch/arc/kernel/irq.c
···29293030#ifdef CONFIG_SMP3131 /* a SMP H/w block could do IPI IRQ request here */3232- if (plat_smp_ops.init_irq_cpu)3333- plat_smp_ops.init_irq_cpu(smp_processor_id());3232+ if (plat_smp_ops.init_per_cpu)3333+ plat_smp_ops.init_per_cpu(smp_processor_id());34343535- if (machine_desc->init_cpu_smp)3636- machine_desc->init_cpu_smp(smp_processor_id());3535+ if (machine_desc->init_per_cpu)3636+ machine_desc->init_per_cpu(smp_processor_id());3737#endif3838}3939···5151 set_irq_regs(old_regs);5252}53535454+/*5555+ * API called for requesting percpu interrupts - called by each CPU5656+ * - For boot CPU, actually request the IRQ with genirq core + enables5757+ * - For subsequent callers only enable called locally5858+ *5959+ * Relies on being called by boot cpu first (i.e. request called ahead) of6060+ * any enable as expected by genirq. Hence Suitable only for TIMER, IPI6161+ * which are guaranteed to be setup on boot core first.6262+ * Late probed peripherals such as perf can't use this as there no guarantee6363+ * of being called on boot CPU first.6464+ */6565+5466void arc_request_percpu_irq(int irq, int cpu,5567 irqreturn_t (*isr)(int irq, void *dev),5668 const char *irq_nm,···7260 if (!cpu) {7361 int rc;74626363+#ifdef CONFIG_ISA_ARCOMPACT7564 /*7676- * These 2 calls are essential to making percpu IRQ APIs work7777- * Ideally these details could be hidden in irq chip map function7878- * but the issue is IPIs IRQs being static (non-DT) and platform7979- * specific, so we can't identify them there.6565+ * A subsequent request_percpu_irq() fails if percpu_devid is6666+ * not set. That in turns sets NOAUTOEN, meaning each core needs6767+ * to call enable_percpu_irq()6868+ *6969+ * For ARCv2, this is done in irq map function since we know7070+ * which irqs are strictly per cpu8071 */8172 irq_set_percpu_devid(irq);8282- irq_modify_status(irq, IRQ_NOAUTOEN, 0); /* @irq, @clr, @set */7373+#endif83748475 rc = request_percpu_irq(irq, isr, irq_nm, percpu_dev);8576 if (rc)
···428428429429#endif /* CONFIG_ISA_ARCV2 */430430431431-void arc_cpu_pmu_irq_init(void)431431+static void arc_cpu_pmu_irq_init(void *data)432432{433433- struct arc_pmu_cpu *pmu_cpu = this_cpu_ptr(&arc_pmu_cpu);433433+ int irq = *(int *)data;434434435435- arc_request_percpu_irq(arc_pmu->irq, smp_processor_id(), arc_pmu_intr,436436- "ARC perf counters", pmu_cpu);435435+ enable_percpu_irq(irq, IRQ_TYPE_NONE);437436438437 /* Clear all pending interrupt flags */439438 write_aux_reg(ARC_REG_PCT_INT_ACT, 0xffffffff);···514515515516 if (has_interrupts) {516517 int irq = platform_get_irq(pdev, 0);517517- unsigned long flags;518518519519 if (irq < 0) {520520 pr_err("Cannot get IRQ number for the platform\n");···522524523525 arc_pmu->irq = irq;524526525525- /*526526- * arc_cpu_pmu_irq_init() needs to be called on all cores for527527- * their respective local PMU.528528- * However we use opencoded on_each_cpu() to ensure it is called529529- * on core0 first, so that arc_request_percpu_irq() sets up530530- * AUTOEN etc. Otherwise enable_percpu_irq() fails to enable531531- * perf IRQ on non master cores.532532- * see arc_request_percpu_irq()533533- */534534- preempt_disable();535535- local_irq_save(flags);536536- arc_cpu_pmu_irq_init();537537- local_irq_restore(flags);538538- smp_call_function((smp_call_func_t)arc_cpu_pmu_irq_init, 0, 1);539539- preempt_enable();527527+ /* intc map function ensures irq_set_percpu_devid() called */528528+ request_percpu_irq(irq, arc_pmu_intr, "ARC perf counters",529529+ this_cpu_ptr(&arc_pmu_cpu));540530541541- /* Clean all pending interrupt flags */542542- write_aux_reg(ARC_REG_PCT_INT_ACT, 0xffffffff);531531+ on_each_cpu(arc_cpu_pmu_irq_init, &irq, 1);532532+543533 } else544534 arc_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;545535
···132132 pr_info("## CPU%u LIVE ##: Executing Code...\n", cpu);133133134134 /* Some SMP H/w setup - for each cpu */135135- if (plat_smp_ops.init_irq_cpu)136136- plat_smp_ops.init_irq_cpu(cpu);135135+ if (plat_smp_ops.init_per_cpu)136136+ plat_smp_ops.init_per_cpu(cpu);137137138138- if (machine_desc->init_cpu_smp)139139- machine_desc->init_cpu_smp(cpu);138138+ if (machine_desc->init_per_cpu)139139+ machine_desc->init_per_cpu(cpu);140140141141 arc_local_timer_setup();142142
+34-23
arch/arc/kernel/unwind.c
···170170171171static unsigned long read_pointer(const u8 **pLoc,172172 const void *end, signed ptrType);173173+static void init_unwind_hdr(struct unwind_table *table,174174+ void *(*alloc) (unsigned long));175175+176176+/*177177+ * wrappers for header alloc (vs. calling one vs. other at call site)178178+ * to elide section mismatches warnings179179+ */180180+static void *__init unw_hdr_alloc_early(unsigned long sz)181181+{182182+ return __alloc_bootmem_nopanic(sz, sizeof(unsigned int),183183+ MAX_DMA_ADDRESS);184184+}185185+186186+static void *unw_hdr_alloc(unsigned long sz)187187+{188188+ return kmalloc(sz, GFP_KERNEL);189189+}173190174191static void init_unwind_table(struct unwind_table *table, const char *name,175192 const void *core_start, unsigned long core_size,···226209 __start_unwind, __end_unwind - __start_unwind,227210 NULL, 0);228211 /*__start_unwind_hdr, __end_unwind_hdr - __start_unwind_hdr);*/212212+213213+ init_unwind_hdr(&root_table, unw_hdr_alloc_early);229214}230215231216static const u32 bad_cie, not_fde;···260241 e2->fde = v;261242}262243263263-static void __init setup_unwind_table(struct unwind_table *table,264264- void *(*alloc) (unsigned long))244244+static void init_unwind_hdr(struct unwind_table *table,245245+ void *(*alloc) (unsigned long))265246{266247 const u8 *ptr;267248 unsigned long tableSize = table->size, hdrSize;···296277 if (cie == ¬_fde)297278 continue;298279 if (cie == NULL || cie == &bad_cie)299299- return;280280+ goto ret_err;300281 ptrType = fde_pointer_type(cie);301282 if (ptrType < 0)302302- return;283283+ goto ret_err;303284304285 ptr = (const u8 *)(fde + 2);305286 if (!read_pointer(&ptr, (const u8 *)(fde + 1) + *fde,···315296 }316297317298 if (tableSize || !n)318318- return;299299+ goto ret_err;319300320301 hdrSize = 4 + sizeof(unsigned long) + sizeof(unsigned int)321302 + 2 * n * sizeof(unsigned long);303303+322304 header = alloc(hdrSize);323305 if (!header)324324- return;306306+ goto ret_err;307307+325308 header->version = 1;326309 header->eh_frame_ptr_enc = DW_EH_PE_abs | DW_EH_PE_native;327310 header->fde_count_enc = DW_EH_PE_abs | DW_EH_PE_data4;···361340 table->hdrsz = hdrSize;362341 smp_wmb();363342 table->header = (const void *)header;364364-}343343+ return;365344366366-static void *__init balloc(unsigned long sz)367367-{368368- return __alloc_bootmem_nopanic(sz,369369- sizeof(unsigned int),370370- __pa(MAX_DMA_ADDRESS));371371-}372372-373373-void __init arc_unwind_setup(void)374374-{375375- setup_unwind_table(&root_table, balloc);345345+ret_err:346346+ panic("Attention !!! Dwarf FDE parsing errors\n");;376347}377348378349#ifdef CONFIG_MODULES···389376 module->module_init, module->init_size,390377 table_start, table_size,391378 NULL, 0);379379+380380+ init_unwind_hdr(table, unw_hdr_alloc);392381393382#ifdef UNWIND_DEBUG394383 unw_debug("Table added for [%s] %lx %lx\n",···454439 info.init_only = init_only;455440456441 unlink_table(&info); /* XXX: SMP */442442+ kfree(table->header);457443 kfree(table);458444}459445···603587{604588 const u8 *ptr = (const u8 *)(cie + 2);605589 unsigned version = *ptr;606606-607607- if (version != 1)608608- return -1; /* unsupported */609590610591 if (*++ptr) {611592 const char *aug;···10151002 ptr = (const u8 *)(cie + 2);10161003 end = (const u8 *)(cie + 1) + *cie;10171004 frame->call_frame = 1;10181018- if ((state.version = *ptr) != 1)10191019- cie = NULL; /* unsupported version */10201020- else if (*++ptr) {10051005+ if (*++ptr) {10211006 /* check if augmentation size is first (thus present) */10221007 if (*ptr == 'z') {10231008 while (++ptr < end && *ptr) {
+2-2
arch/arc/mm/highmem.c
···111111}112112EXPORT_SYMBOL(__kunmap_atomic);113113114114-noinline pte_t *alloc_kmap_pgtable(unsigned long kvaddr)114114+static noinline pte_t * __init alloc_kmap_pgtable(unsigned long kvaddr)115115{116116 pgd_t *pgd_k;117117 pud_t *pud_k;···127127 return pte_k;128128}129129130130-void kmap_init(void)130130+void __init kmap_init(void)131131{132132 /* Due to recursive include hell, we can't do this in processor.h */133133 BUILD_BUG_ON(PAGE_OFFSET < (VMALLOC_END + FIXMAP_SIZE + PKMAP_SIZE));
+3-1
arch/arc/mm/init.c
···5151 int in_use = 0;52525353 if (!low_mem_sz) {5454- BUG_ON(base != low_mem_start);5454+ if (base != low_mem_start)5555+ panic("CONFIG_LINUX_LINK_BASE != DT memory { }");5656+5557 low_mem_sz = size;5658 in_use = 1;5759 } else {
···221221static int rt288x_pci_probe(struct platform_device *pdev)222222{223223 void __iomem *io_map_base;224224- int i;225224226225 rt2880_pci_base = ioremap_nocache(RT2880_PCI_BASE, PAGE_SIZE);227226
-1
arch/mips/pmcs-msp71xx/msp_setup.c
···3939void msp7120_reset(void)4040{4141 void *start, *end, *iptr;4242- register int i;43424443 /* Diasble all interrupts */4544 local_irq_disable();
+1-1
arch/mips/sni/reset.c
···2626/* XXX This ends up at the ARC firmware prompt ... */2727void sni_machine_restart(char *command)2828{2929- int i, j;2929+ int i;30303131 /* This does a normal via the keyboard controller like a PC.3232 We can do that easier ... */
···435435 regs->gr[28]);436436}437437438438+/*439439+ * Check how the syscall number gets loaded into %r20 within440440+ * the delay branch in userspace and adjust as needed.441441+ */442442+443443+static void check_syscallno_in_delay_branch(struct pt_regs *regs)444444+{445445+ u32 opcode, source_reg;446446+ u32 __user *uaddr;447447+ int err;448448+449449+ /* Usually we don't have to restore %r20 (the system call number)450450+ * because it gets loaded in the delay slot of the branch external451451+ * instruction via the ldi instruction.452452+ * In some cases a register-to-register copy instruction might have453453+ * been used instead, in which case we need to copy the syscall454454+ * number into the source register before returning to userspace.455455+ */456456+457457+ /* A syscall is just a branch, so all we have to do is fiddle the458458+ * return pointer so that the ble instruction gets executed again.459459+ */460460+ regs->gr[31] -= 8; /* delayed branching */461461+462462+ /* Get assembler opcode of code in delay branch */463463+ uaddr = (unsigned int *) ((regs->gr[31] & ~3) + 4);464464+ err = get_user(opcode, uaddr);465465+ if (err)466466+ return;467467+468468+ /* Check if delay branch uses "ldi int,%r20" */469469+ if ((opcode & 0xffff0000) == 0x34140000)470470+ return; /* everything ok, just return */471471+472472+ /* Check if delay branch uses "nop" */473473+ if (opcode == INSN_NOP)474474+ return;475475+476476+ /* Check if delay branch uses "copy %rX,%r20" */477477+ if ((opcode & 0xffe0ffff) == 0x08000254) {478478+ source_reg = (opcode >> 16) & 31;479479+ regs->gr[source_reg] = regs->gr[20];480480+ return;481481+ }482482+483483+ pr_warn("syscall restart: %s (pid %d): unexpected opcode 0x%08x\n",484484+ current->comm, task_pid_nr(current), opcode);485485+}486486+438487static inline void439488syscall_restart(struct pt_regs *regs, struct k_sigaction *ka)440489{···506457 }507458 /* fallthrough */508459 case -ERESTARTNOINTR:509509- /* A syscall is just a branch, so all510510- * we have to do is fiddle the return pointer.511511- */512512- regs->gr[31] -= 8; /* delayed branching */460460+ check_syscallno_in_delay_branch(regs);513461 break;514462 }515463}···556510 }557511 case -ERESTARTNOHAND:558512 case -ERESTARTSYS:559559- case -ERESTARTNOINTR: {560560- /* Hooray for delayed branching. We don't561561- * have to restore %r20 (the system call562562- * number) because it gets loaded in the delay563563- * slot of the branch external instruction.564564- */565565- regs->gr[31] -= 8;513513+ case -ERESTARTNOINTR:514514+ check_syscallno_in_delay_branch(regs);566515 return;567567- }568516 default:569517 break;570518 }
···224224225225static void kvmppc_set_msr_hv(struct kvm_vcpu *vcpu, u64 msr)226226{227227+ /*228228+ * Check for illegal transactional state bit combination229229+ * and if we find it, force the TS field to a safe state.230230+ */231231+ if ((msr & MSR_TS_MASK) == MSR_TS_MASK)232232+ msr &= ~MSR_TS_MASK;227233 vcpu->arch.shregs.msr = msr;228234 kvmppc_end_cede(vcpu);229235}
+13-1
arch/powerpc/platforms/powernv/opal-irqchip.c
···8383 set_bit(d->hwirq, &opal_event_irqchip.mask);84848585 opal_poll_events(&events);8686- opal_handle_events(be64_to_cpu(events));8686+ last_outstanding_events = be64_to_cpu(events);8787+8888+ /*8989+ * We can't just handle the events now with opal_handle_events().9090+ * If we did we would deadlock when opal_event_unmask() is called from9191+ * handle_level_irq() with the irq descriptor lock held, because9292+ * calling opal_handle_events() would call generic_handle_irq() and9393+ * then handle_level_irq() which would try to take the descriptor lock9494+ * again. Instead queue the events for later.9595+ */9696+ if (last_outstanding_events & opal_event_irqchip.mask)9797+ /* Need to retrigger the interrupt */9898+ irq_work_queue(&opal_event_irq_work);8799}8810089101static int opal_event_set_type(struct irq_data *d, unsigned int flow_type)
···19201920 }19211921 if (separator)19221922 ptr += sprintf(ptr, "%c", separator);19231923+ /*19241924+ * Use four '%' characters below because of the19251925+ * following two conversions:19261926+ *19271927+ * 1) sprintf: %%%%r -> %%r19281928+ * 2) printk : %%r -> %r19291929+ */19231930 if (operand->flags & OPERAND_GPR)19241924- ptr += sprintf(ptr, "%%r%i", value);19311931+ ptr += sprintf(ptr, "%%%%r%i", value);19251932 else if (operand->flags & OPERAND_FPR)19261926- ptr += sprintf(ptr, "%%f%i", value);19331933+ ptr += sprintf(ptr, "%%%%f%i", value);19271934 else if (operand->flags & OPERAND_AR)19281928- ptr += sprintf(ptr, "%%a%i", value);19351935+ ptr += sprintf(ptr, "%%%%a%i", value);19291936 else if (operand->flags & OPERAND_CR)19301930- ptr += sprintf(ptr, "%%c%i", value);19371937+ ptr += sprintf(ptr, "%%%%c%i", value);19311938 else if (operand->flags & OPERAND_VR)19321932- ptr += sprintf(ptr, "%%v%i", value);19391939+ ptr += sprintf(ptr, "%%%%v%i", value);19331940 else if (operand->flags & OPERAND_PCREL)19341941 ptr += sprintf(ptr, "%lx", (signed int) value19351942 + addr);
+1
arch/sparc/include/asm/elf_64.h
···9595 * really available. So we simply advertise only "crypto" support.9696 */9797#define HWCAP_SPARC_CRYPTO 0x04000000 /* CRYPTO insns available */9898+#define HWCAP_SPARC_ADI 0x08000000 /* ADI available */989999100#define CORE_DUMP_USE_REGSET100101
···7373 andn %l1, %l4, %l17474 srl %l4, 20, %l47575 ba,pt %xcc, rtrap_no_irq_enable7676- wrpr %l4, %pil7676+ nop7777+ /* Do not actually set the %pil here. We will do that7878+ * below after we clear PSTATE_IE in the %pstate register.7979+ * If we re-enable interrupts here, we can recurse down8080+ * the hardirq stack potentially endlessly, causing a8181+ * stack overflow.8282+ */77837884 .align 647985 .globl rtrap_irq, rtrap, irqsz_patchme, rtrap_xcall
+5-4
arch/sparc/kernel/setup_64.c
···380380 */381381 "mul32", "div32", "fsmuld", "v8plus", "popc", "vis", "vis2",382382 "ASIBlkInit", "fmaf", "vis3", "hpc", "random", "trans", "fjfmau",383383- "ima", "cspare", "pause", "cbcond",383383+ "ima", "cspare", "pause", "cbcond", NULL /*reserved for crypto */,384384+ "adp",384385};385386386387static const char *crypto_hwcaps[] = {···397396 seq_puts(m, "cpucaps\t\t: ");398397 for (i = 0; i < ARRAY_SIZE(hwcaps); i++) {399398 unsigned long bit = 1UL << i;400400- if (caps & bit) {399399+ if (hwcaps[i] && (caps & bit)) {401400 seq_printf(m, "%s%s",402401 printed ? "," : "", hwcaps[i]);403402 printed++;···451450452451 for (i = 0; i < ARRAY_SIZE(hwcaps); i++) {453452 unsigned long bit = 1UL << i;454454- if (caps & bit)453453+ if (hwcaps[i] && (caps & bit))455454 report_one_hwcap(&printed, hwcaps[i]);456455 }457456 if (caps & HWCAP_SPARC_CRYPTO)···486485 for (i = 0; i < ARRAY_SIZE(hwcaps); i++) {487486 unsigned long bit = 1UL << i;488487489489- if (!strcmp(prop, hwcaps[i])) {488488+ if (hwcaps[i] && !strcmp(prop, hwcaps[i])) {490489 caps |= bit;491490 break;492491 }
···120120 return mtrr_state->deftype & IA32_MTRR_DEF_TYPE_TYPE_MASK;121121}122122123123-static u8 mtrr_disabled_type(void)123123+static u8 mtrr_disabled_type(struct kvm_vcpu *vcpu)124124{125125 /*126126 * Intel SDM 11.11.2.2: all MTRRs are disabled when127127 * IA32_MTRR_DEF_TYPE.E bit is cleared, and the UC128128 * memory type is applied to all of physical memory.129129+ *130130+ * However, virtual machines can be run with CPUID such that131131+ * there are no MTRRs. In that case, the firmware will never132132+ * enable MTRRs and it is obviously undesirable to run the133133+ * guest entirely with UC memory and we use WB.129134 */130130- return MTRR_TYPE_UNCACHABLE;135135+ if (guest_cpuid_has_mtrr(vcpu))136136+ return MTRR_TYPE_UNCACHABLE;137137+ else138138+ return MTRR_TYPE_WRBACK;131139}132140133141/*···275267276268 for (seg = 0; seg < seg_num; seg++) {277269 mtrr_seg = &fixed_seg_table[seg];278278- if (mtrr_seg->start >= addr && addr < mtrr_seg->end)270270+ if (mtrr_seg->start <= addr && addr < mtrr_seg->end)279271 return seg;280272 }281273···308300 *start = range->base & PAGE_MASK;309301310302 mask = range->mask & PAGE_MASK;311311- mask |= ~0ULL << boot_cpu_data.x86_phys_bits;312303313304 /* This cannot overflow because writing to the reserved bits of314305 * variable MTRRs causes a #GP.···363356 if (var_mtrr_range_is_valid(cur))364357 list_del(&mtrr_state->var_ranges[index].node);365358359359+ /* Extend the mask with all 1 bits to the left, since those360360+ * bits must implicitly be 0. The bits are then cleared361361+ * when reading them.362362+ */366363 if (!is_mtrr_mask)367364 cur->base = data;368365 else369369- cur->mask = data;366366+ cur->mask = data | (-1LL << cpuid_maxphyaddr(vcpu));370367371368 /* add it to the list if it's enabled. */372369 if (var_mtrr_range_is_valid(cur)) {···437426 *pdata = vcpu->arch.mtrr_state.var_ranges[index].base;438427 else439428 *pdata = vcpu->arch.mtrr_state.var_ranges[index].mask;429429+430430+ *pdata &= (1ULL << cpuid_maxphyaddr(vcpu)) - 1;440431 }441432442433 return 0;···683670 }684671685672 if (iter.mtrr_disabled)686686- return mtrr_disabled_type();673673+ return mtrr_disabled_type(vcpu);687674688675 /* not contained in any MTRRs. */689676 if (type == -1)
···28032803 msr_info->data = vcpu->arch.ia32_xss;28042804 break;28052805 case MSR_TSC_AUX:28062806- if (!guest_cpuid_has_rdtscp(vcpu))28062806+ if (!guest_cpuid_has_rdtscp(vcpu) && !msr_info->host_initiated)28072807 return 1;28082808 /* Otherwise falls through */28092809 default:···29092909 clear_atomic_switch_msr(vmx, MSR_IA32_XSS);29102910 break;29112911 case MSR_TSC_AUX:29122912- if (!guest_cpuid_has_rdtscp(vcpu))29122912+ if (!guest_cpuid_has_rdtscp(vcpu) && !msr_info->host_initiated)29132913 return 1;29142914 /* Check reserved bit, higher 32 bits should be zero */29152915 if ((data >> 32) != 0)···80428042 u32 exit_reason = vmx->exit_reason;80438043 u32 vectoring_info = vmx->idt_vectoring_info;8044804480458045+ trace_kvm_exit(exit_reason, vcpu, KVM_ISA_VMX);80468046+80458047 /*80468048 * Flush logged GPAs PML buffer, this will make dirty_bitmap more80478049 * updated. Another good is, in kvm_vm_ioctl_get_dirty_log, before···86708668 vmx->loaded_vmcs->launched = 1;8671866986728670 vmx->exit_reason = vmcs_read32(VM_EXIT_REASON);86738673- trace_kvm_exit(vmx->exit_reason, vcpu, KVM_ISA_VMX);8674867186758672 /*86768673 * the KVM_REQ_EVENT optimization bit is only on for one entry, and if
+8-4
arch/x86/kvm/x86.c
···3572357235733573static int kvm_vm_ioctl_set_pit(struct kvm *kvm, struct kvm_pit_state *ps)35743574{35753575+ int i;35753576 mutex_lock(&kvm->arch.vpit->pit_state.lock);35763577 memcpy(&kvm->arch.vpit->pit_state, ps, sizeof(struct kvm_pit_state));35773577- kvm_pit_load_count(kvm, 0, ps->channels[0].count, 0);35783578+ for (i = 0; i < 3; i++)35793579+ kvm_pit_load_count(kvm, i, ps->channels[i].count, 0);35783580 mutex_unlock(&kvm->arch.vpit->pit_state.lock);35793581 return 0;35803582}···35953593static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps)35963594{35973595 int start = 0;35963596+ int i;35983597 u32 prev_legacy, cur_legacy;35993598 mutex_lock(&kvm->arch.vpit->pit_state.lock);36003599 prev_legacy = kvm->arch.vpit->pit_state.flags & KVM_PIT_FLAGS_HPET_LEGACY;···36053602 memcpy(&kvm->arch.vpit->pit_state.channels, &ps->channels,36063603 sizeof(kvm->arch.vpit->pit_state.channels));36073604 kvm->arch.vpit->pit_state.flags = ps->flags;36083608- kvm_pit_load_count(kvm, 0, kvm->arch.vpit->pit_state.channels[0].count, start);36053605+ for (i = 0; i < 3; i++)36063606+ kvm_pit_load_count(kvm, i, kvm->arch.vpit->pit_state.channels[i].count, start);36093607 mutex_unlock(&kvm->arch.vpit->pit_state.lock);36103608 return 0;36113609}···65196515 if (req_immediate_exit)65206516 smp_send_reschedule(vcpu->cpu);6521651765186518+ trace_kvm_entry(vcpu->vcpu_id);65196519+ wait_lapic_expire(vcpu);65226520 __kvm_guest_enter();6523652165246522 if (unlikely(vcpu->arch.switch_db_regs)) {···65336527 vcpu->arch.switch_db_regs &= ~KVM_DEBUGREG_RELOAD;65346528 }6535652965366536- trace_kvm_entry(vcpu->vcpu_id);65376537- wait_lapic_expire(vcpu);65386530 kvm_x86_ops->run(vcpu);6539653165406532 /*
···24952495{24962496 x86_init.paging.pagetable_init = xen_pagetable_init;2497249724982498- /* Optimization - we can use the HVM one but it has no idea which24992499- * VCPUs are descheduled - which means that it will needlessly IPI25002500- * them. Xen knows so let it do the job.25012501- */25022502- if (xen_feature(XENFEAT_auto_translated_physmap)) {25032503- pv_mmu_ops.flush_tlb_others = xen_flush_tlb_others;24982498+ if (xen_feature(XENFEAT_auto_translated_physmap))25042499 return;25052505- }25002500+25062501 pv_mmu_ops = xen_mmu_ops;2507250225082503 memset(dummy_mapping, 0xff, PAGE_SIZE);
+11-10
arch/x86/xen/suspend.c
···11#include <linux/types.h>22#include <linux/tick.h>3344+#include <xen/xen.h>45#include <xen/interface/xen.h>56#include <xen/grant_table.h>67#include <xen/events.h>···69687069void xen_arch_pre_suspend(void)7170{7272- int cpu;7373-7474- for_each_online_cpu(cpu)7575- xen_pmu_finish(cpu);7676-7771 if (xen_pv_domain())7872 xen_pv_pre_suspend();7973}80748175void xen_arch_post_suspend(int cancelled)8276{8383- int cpu;8484-8577 if (xen_pv_domain())8678 xen_pv_post_suspend(cancelled);8779 else8880 xen_hvm_post_suspend(cancelled);8989-9090- for_each_online_cpu(cpu)9191- xen_pmu_init(cpu);9281}93829483static void xen_vcpu_notify_restore(void *data)···9710698107void xen_arch_resume(void)99108{109109+ int cpu;110110+100111 on_each_cpu(xen_vcpu_notify_restore, NULL, 1);112112+113113+ for_each_online_cpu(cpu)114114+ xen_pmu_init(cpu);101115}102116103117void xen_arch_suspend(void)104118{119119+ int cpu;120120+121121+ for_each_online_cpu(cpu)122122+ xen_pmu_finish(cpu);123123+105124 on_each_cpu(xen_vcpu_notify_suspend, NULL, 1);106125}
+18-2
block/blk-core.c
···207207EXPORT_SYMBOL(blk_delay_queue);208208209209/**210210+ * blk_start_queue_async - asynchronously restart a previously stopped queue211211+ * @q: The &struct request_queue in question212212+ *213213+ * Description:214214+ * blk_start_queue_async() will clear the stop flag on the queue, and215215+ * ensure that the request_fn for the queue is run from an async216216+ * context.217217+ **/218218+void blk_start_queue_async(struct request_queue *q)219219+{220220+ queue_flag_clear(QUEUE_FLAG_STOPPED, q);221221+ blk_run_queue_async(q);222222+}223223+EXPORT_SYMBOL(blk_start_queue_async);224224+225225+/**210226 * blk_start_queue - restart a previously stopped queue211227 * @q: The &struct request_queue in question212228 *···17051689 struct request *req;17061690 unsigned int request_count = 0;1707169117081708- blk_queue_split(q, &bio, q->bio_split);17091709-17101692 /*17111693 * low level driver can indicate that it wants pages above a17121694 * certain limit bounced to low memory (ie for highmem, or even17131695 * ISA dma in theory)17141696 */17151697 blk_queue_bounce(q, &bio);16981698+16991699+ blk_queue_split(q, &bio, q->bio_split);1716170017171701 if (bio_integrity_enabled(bio) && bio_integrity_prep(bio)) {17181702 bio->bi_error = -EIO;
+1-1
block/blk-merge.c
···8181 struct bio *new = NULL;82828383 bio_for_each_segment(bv, bio, iter) {8484- if (sectors + (bv.bv_len >> 9) > queue_max_sectors(q))8484+ if (sectors + (bv.bv_len >> 9) > blk_max_size_offset(q, bio->bi_iter.bi_sector))8585 goto split;86868787 /*
···408408 struct blkif_x86_32_request *src)409409{410410 int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST, j;411411- dst->operation = src->operation;412412- switch (src->operation) {411411+ dst->operation = READ_ONCE(src->operation);412412+ switch (dst->operation) {413413 case BLKIF_OP_READ:414414 case BLKIF_OP_WRITE:415415 case BLKIF_OP_WRITE_BARRIER:···456456 struct blkif_x86_64_request *src)457457{458458 int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST, j;459459- dst->operation = src->operation;460460- switch (src->operation) {459459+ dst->operation = READ_ONCE(src->operation);460460+ switch (dst->operation) {461461 case BLKIF_OP_READ:462462 case BLKIF_OP_WRITE:463463 case BLKIF_OP_WRITE_BARRIER:
···226226227227config ARM_TEGRA124_CPUFREQ228228 tristate "Tegra124 CPUFreq support"229229- depends on ARCH_TEGRA && CPUFREQ_DT229229+ depends on ARCH_TEGRA && CPUFREQ_DT && REGULATOR230230 default y231231 help232232 This adds the CPUFreq driver support for Tegra124 SOCs.
···141141 unsigned long pinmask = bgc->pin2mask(bgc, gpio);142142143143 if (bgc->dir & pinmask)144144- return bgc->read_reg(bgc->reg_set) & pinmask;144144+ return !!(bgc->read_reg(bgc->reg_set) & pinmask);145145 else146146- return bgc->read_reg(bgc->reg_dat) & pinmask;146146+ return !!(bgc->read_reg(bgc->reg_dat) & pinmask);147147}148148149149static int bgpio_get(struct gpio_chip *gc, unsigned int gpio)
+7-1
drivers/gpio/gpiolib.c
···12791279 chip = desc->chip;12801280 offset = gpio_chip_hwgpio(desc);12811281 value = chip->get ? chip->get(chip, offset) : -EIO;12821282- value = value < 0 ? value : !!value;12821282+ /*12831283+ * FIXME: fix all drivers to clamp to [0,1] or return negative,12841284+ * then change this to:12851285+ * value = value < 0 ? value : !!value;12861286+ * so we can properly propagate error codes.12871287+ */12881288+ value = !!value;12831289 trace_gpio_value(desc_to_gpio(desc), 1, value);12841290 return value;12851291}
···127127 return 0;128128}129129130130+static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p,131131+ struct drm_amdgpu_cs_chunk_fence *fence_data)132132+{133133+ struct drm_gem_object *gobj;134134+ uint32_t handle;135135+136136+ handle = fence_data->handle;137137+ gobj = drm_gem_object_lookup(p->adev->ddev, p->filp,138138+ fence_data->handle);139139+ if (gobj == NULL)140140+ return -EINVAL;141141+142142+ p->uf.bo = amdgpu_bo_ref(gem_to_amdgpu_bo(gobj));143143+ p->uf.offset = fence_data->offset;144144+145145+ if (amdgpu_ttm_tt_has_userptr(p->uf.bo->tbo.ttm)) {146146+ drm_gem_object_unreference_unlocked(gobj);147147+ return -EINVAL;148148+ }149149+150150+ p->uf_entry.robj = amdgpu_bo_ref(p->uf.bo);151151+ p->uf_entry.prefered_domains = AMDGPU_GEM_DOMAIN_GTT;152152+ p->uf_entry.allowed_domains = AMDGPU_GEM_DOMAIN_GTT;153153+ p->uf_entry.priority = 0;154154+ p->uf_entry.tv.bo = &p->uf_entry.robj->tbo;155155+ p->uf_entry.tv.shared = true;156156+157157+ drm_gem_object_unreference_unlocked(gobj);158158+ return 0;159159+}160160+130161int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)131162{132163 union drm_amdgpu_cs *cs = data;···238207239208 case AMDGPU_CHUNK_ID_FENCE:240209 size = sizeof(struct drm_amdgpu_cs_chunk_fence);241241- if (p->chunks[i].length_dw * sizeof(uint32_t) >= size) {242242- uint32_t handle;243243- struct drm_gem_object *gobj;244244- struct drm_amdgpu_cs_chunk_fence *fence_data;245245-246246- fence_data = (void *)p->chunks[i].kdata;247247- handle = fence_data->handle;248248- gobj = drm_gem_object_lookup(p->adev->ddev,249249- p->filp, handle);250250- if (gobj == NULL) {251251- ret = -EINVAL;252252- goto free_partial_kdata;253253- }254254-255255- p->uf.bo = gem_to_amdgpu_bo(gobj);256256- amdgpu_bo_ref(p->uf.bo);257257- drm_gem_object_unreference_unlocked(gobj);258258- p->uf.offset = fence_data->offset;259259- } else {210210+ if (p->chunks[i].length_dw * sizeof(uint32_t) < size) {260211 ret = -EINVAL;261212 goto free_partial_kdata;262213 }214214+215215+ ret = amdgpu_cs_user_fence_chunk(p, (void *)p->chunks[i].kdata);216216+ if (ret)217217+ goto free_partial_kdata;218218+263219 break;264220265221 case AMDGPU_CHUNK_ID_DEPENDENCIES:···409391 p->vm_bos = amdgpu_vm_get_bos(p->adev, &fpriv->vm,410392 &p->validated);411393394394+ if (p->uf.bo)395395+ list_add(&p->uf_entry.tv.head, &p->validated);396396+412397 if (need_mmap_lock)413398 down_read(¤t->mm->mmap_sem);414399···509488 for (i = 0; i < parser->num_ibs; i++)510489 amdgpu_ib_free(parser->adev, &parser->ibs[i]);511490 kfree(parser->ibs);512512- if (parser->uf.bo)513513- amdgpu_bo_unref(&parser->uf.bo);491491+ amdgpu_bo_unref(&parser->uf.bo);492492+ amdgpu_bo_unref(&parser->uf_entry.robj);514493}515494516495static int amdgpu_bo_vm_update_pte(struct amdgpu_cs_parser *p,
+3
drivers/gpu/drm/exynos/exynos_drm_crtc.c
···5555{5656 struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);57575858+ if (!state->enable)5959+ return 0;6060+5861 if (exynos_crtc->ops->atomic_check)5962 return exynos_crtc->ops->atomic_check(exynos_crtc, state);6063
+20-8
drivers/gpu/drm/i915/i915_drv.h
···21932193 struct drm_i915_private *i915;21942194 struct intel_engine_cs *ring;2195219521962196- /** GEM sequence number associated with this request. */21972197- uint32_t seqno;21962196+ /** GEM sequence number associated with the previous request,21972197+ * when the HWS breadcrumb is equal to this the GPU is processing21982198+ * this request.21992199+ */22002200+ u32 previous_seqno;22012201+22022202+ /** GEM sequence number associated with this request,22032203+ * when the HWS breadcrumb is equal or greater than this the GPU22042204+ * has finished processing this request.22052205+ */22062206+ u32 seqno;2198220721992208 /** Position in the ringbuffer of the start of the request */22002209 u32 head;···2848283928492840int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level,28502841 u32 flags);28422842+void __i915_vma_set_map_and_fenceable(struct i915_vma *vma);28512843int __must_check i915_vma_unbind(struct i915_vma *vma);28522844/*28532845 * BEWARE: Do not use the function below unless you can _absolutely_···29202910 return (int32_t)(seq1 - seq2) >= 0;29212911}2922291229132913+static inline bool i915_gem_request_started(struct drm_i915_gem_request *req,29142914+ bool lazy_coherency)29152915+{29162916+ u32 seqno = req->ring->get_seqno(req->ring, lazy_coherency);29172917+ return i915_seqno_passed(seqno, req->previous_seqno);29182918+}29192919+29232920static inline bool i915_gem_request_completed(struct drm_i915_gem_request *req,29242921 bool lazy_coherency)29252922{29262926- u32 seqno;29272927-29282928- BUG_ON(req == NULL);29292929-29302930- seqno = req->ring->get_seqno(req->ring, lazy_coherency);29312931-29232923+ u32 seqno = req->ring->get_seqno(req->ring, lazy_coherency);29322924 return i915_seqno_passed(seqno, req->seqno);29332925}29342926
+84-27
drivers/gpu/drm/i915/i915_gem.c
···11461146 return test_bit(ring->id, &dev_priv->gpu_error.missed_irq_rings);11471147}1148114811491149-static int __i915_spin_request(struct drm_i915_gem_request *req)11491149+static unsigned long local_clock_us(unsigned *cpu)11501150+{11511151+ unsigned long t;11521152+11531153+ /* Cheaply and approximately convert from nanoseconds to microseconds.11541154+ * The result and subsequent calculations are also defined in the same11551155+ * approximate microseconds units. The principal source of timing11561156+ * error here is from the simple truncation.11571157+ *11581158+ * Note that local_clock() is only defined wrt to the current CPU;11591159+ * the comparisons are no longer valid if we switch CPUs. Instead of11601160+ * blocking preemption for the entire busywait, we can detect the CPU11611161+ * switch and use that as indicator of system load and a reason to11621162+ * stop busywaiting, see busywait_stop().11631163+ */11641164+ *cpu = get_cpu();11651165+ t = local_clock() >> 10;11661166+ put_cpu();11671167+11681168+ return t;11691169+}11701170+11711171+static bool busywait_stop(unsigned long timeout, unsigned cpu)11721172+{11731173+ unsigned this_cpu;11741174+11751175+ if (time_after(local_clock_us(&this_cpu), timeout))11761176+ return true;11771177+11781178+ return this_cpu != cpu;11791179+}11801180+11811181+static int __i915_spin_request(struct drm_i915_gem_request *req, int state)11501182{11511183 unsigned long timeout;11841184+ unsigned cpu;1152118511531153- if (i915_gem_request_get_ring(req)->irq_refcount)11861186+ /* When waiting for high frequency requests, e.g. during synchronous11871187+ * rendering split between the CPU and GPU, the finite amount of time11881188+ * required to set up the irq and wait upon it limits the response11891189+ * rate. By busywaiting on the request completion for a short while we11901190+ * can service the high frequency waits as quick as possible. However,11911191+ * if it is a slow request, we want to sleep as quickly as possible.11921192+ * The tradeoff between waiting and sleeping is roughly the time it11931193+ * takes to sleep on a request, on the order of a microsecond.11941194+ */11951195+11961196+ if (req->ring->irq_refcount)11541197 return -EBUSY;1155119811561156- timeout = jiffies + 1;11991199+ /* Only spin if we know the GPU is processing this request */12001200+ if (!i915_gem_request_started(req, true))12011201+ return -EAGAIN;12021202+12031203+ timeout = local_clock_us(&cpu) + 5;11571204 while (!need_resched()) {11581205 if (i915_gem_request_completed(req, true))11591206 return 0;1160120711611161- if (time_after_eq(jiffies, timeout))12081208+ if (signal_pending_state(state, current))12091209+ break;12101210+12111211+ if (busywait_stop(timeout, cpu))11621212 break;1163121311641214 cpu_relax_lowlatency();11651215 }12161216+11661217 if (i915_gem_request_completed(req, false))11671218 return 0;11681219···12481197 struct drm_i915_private *dev_priv = dev->dev_private;12491198 const bool irq_test_in_progress =12501199 ACCESS_ONCE(dev_priv->gpu_error.test_irq_rings) & intel_ring_flag(ring);12001200+ int state = interruptible ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE;12511201 DEFINE_WAIT(wait);12521202 unsigned long timeout_expire;12531203 s64 before, now;···12811229 before = ktime_get_raw_ns();1282123012831231 /* Optimistic spin for the next jiffie before touching IRQs */12841284- ret = __i915_spin_request(req);12321232+ ret = __i915_spin_request(req, state);12851233 if (ret == 0)12861234 goto out;12871235···12931241 for (;;) {12941242 struct timer_list timer;1295124312961296- prepare_to_wait(&ring->irq_queue, &wait,12971297- interruptible ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);12441244+ prepare_to_wait(&ring->irq_queue, &wait, state);1298124512991246 /* We need to check whether any gpu reset happened in between13001247 * the caller grabbing the seqno and now ... */···13111260 break;13121261 }1313126213141314- if (interruptible && signal_pending(current)) {12631263+ if (signal_pending_state(state, current)) {13151264 ret = -ERESTARTSYS;13161265 break;13171266 }···26052554 request->batch_obj = obj;2606255526072556 request->emitted_jiffies = jiffies;25572557+ request->previous_seqno = ring->last_submitted_seqno;26082558 ring->last_submitted_seqno = request->seqno;26092559 list_add_tail(&request->list, &ring->request_list);26102560···41324080 return false;41334081}4134408240834083+void __i915_vma_set_map_and_fenceable(struct i915_vma *vma)40844084+{40854085+ struct drm_i915_gem_object *obj = vma->obj;40864086+ bool mappable, fenceable;40874087+ u32 fence_size, fence_alignment;40884088+40894089+ fence_size = i915_gem_get_gtt_size(obj->base.dev,40904090+ obj->base.size,40914091+ obj->tiling_mode);40924092+ fence_alignment = i915_gem_get_gtt_alignment(obj->base.dev,40934093+ obj->base.size,40944094+ obj->tiling_mode,40954095+ true);40964096+40974097+ fenceable = (vma->node.size == fence_size &&40984098+ (vma->node.start & (fence_alignment - 1)) == 0);40994099+41004100+ mappable = (vma->node.start + fence_size <=41014101+ to_i915(obj->base.dev)->gtt.mappable_end);41024102+41034103+ obj->map_and_fenceable = mappable && fenceable;41044104+}41054105+41354106static int41364107i915_gem_object_do_pin(struct drm_i915_gem_object *obj,41374108 struct i915_address_space *vm,···4222414742234148 if (ggtt_view && ggtt_view->type == I915_GGTT_VIEW_NORMAL &&42244149 (bound ^ vma->bound) & GLOBAL_BIND) {42254225- bool mappable, fenceable;42264226- u32 fence_size, fence_alignment;42274227-42284228- fence_size = i915_gem_get_gtt_size(obj->base.dev,42294229- obj->base.size,42304230- obj->tiling_mode);42314231- fence_alignment = i915_gem_get_gtt_alignment(obj->base.dev,42324232- obj->base.size,42334233- obj->tiling_mode,42344234- true);42354235-42364236- fenceable = (vma->node.size == fence_size &&42374237- (vma->node.start & (fence_alignment - 1)) == 0);42384238-42394239- mappable = (vma->node.start + fence_size <=42404240- dev_priv->gtt.mappable_end);42414241-42424242- obj->map_and_fenceable = mappable && fenceable;42434243-41504150+ __i915_vma_set_map_and_fenceable(vma);42444151 WARN_ON(flags & PIN_MAPPABLE && !obj->map_and_fenceable);42454152 }42464153
···116116static void ironlake_pfit_disable(struct intel_crtc *crtc, bool force);117117static void ironlake_pfit_enable(struct intel_crtc *crtc);118118static void intel_modeset_setup_hw_state(struct drm_device *dev);119119+static void intel_pre_disable_primary(struct drm_crtc *crtc);119120120121typedef struct {121122 int min, max;···26082607 struct drm_i915_gem_object *obj;26092608 struct drm_plane *primary = intel_crtc->base.primary;26102609 struct drm_plane_state *plane_state = primary->state;26102610+ struct drm_crtc_state *crtc_state = intel_crtc->base.state;26112611+ struct intel_plane *intel_plane = to_intel_plane(primary);26112612 struct drm_framebuffer *fb;2612261326132614 if (!plane_config->fb)···26452642 goto valid_fb;26462643 }26472644 }26452645+26462646+ /*26472647+ * We've failed to reconstruct the BIOS FB. Current display state26482648+ * indicates that the primary plane is visible, but has a NULL FB,26492649+ * which will lead to problems later if we don't fix it up. The26502650+ * simplest solution is to just disable the primary plane now and26512651+ * pretend the BIOS never had it enabled.26522652+ */26532653+ to_intel_plane_state(plane_state)->visible = false;26542654+ crtc_state->plane_mask &= ~(1 << drm_plane_index(primary));26552655+ intel_pre_disable_primary(&intel_crtc->base);26562656+ intel_plane->disable_plane(primary, &intel_crtc->base);2648265726492658 return;26502659···99259910 return true;99269911}9927991299289928-static void i845_update_cursor(struct drm_crtc *crtc, u32 base)99139913+static void i845_update_cursor(struct drm_crtc *crtc, u32 base, bool on)99299914{99309915 struct drm_device *dev = crtc->dev;99319916 struct drm_i915_private *dev_priv = dev->dev_private;99329917 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);99339918 uint32_t cntl = 0, size = 0;9934991999359935- if (base) {99209920+ if (on) {99369921 unsigned int width = intel_crtc->base.cursor->state->crtc_w;99379922 unsigned int height = intel_crtc->base.cursor->state->crtc_h;99389923 unsigned int stride = roundup_pow_of_two(width) * 4;···99879972 }99889973}9989997499909990-static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)99759975+static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base, bool on)99919976{99929977 struct drm_device *dev = crtc->dev;99939978 struct drm_i915_private *dev_priv = dev->dev_private;99949979 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);99959980 int pipe = intel_crtc->pipe;99969996- uint32_t cntl;99819981+ uint32_t cntl = 0;9997998299989998- cntl = 0;99999999- if (base) {99839983+ if (on) {100009984 cntl = MCURSOR_GAMMA_ENABLE;100019985 switch (intel_crtc->base.cursor->state->crtc_w) {100029986 case 64:···1004610032 int y = cursor_state->crtc_y;1004710033 u32 base = 0, pos = 0;10048100341004910049- if (on)1005010050- base = intel_crtc->cursor_addr;1003510035+ base = intel_crtc->cursor_addr;10051100361005210037 if (x >= intel_crtc->config->pipe_src_w)1005310053- base = 0;1003810038+ on = false;10054100391005510040 if (y >= intel_crtc->config->pipe_src_h)1005610056- base = 0;1004110041+ on = false;10057100421005810043 if (x < 0) {1005910044 if (x + cursor_state->crtc_w <= 0)1006010060- base = 0;1004510045+ on = false;10061100461006210047 pos |= CURSOR_POS_SIGN << CURSOR_X_SHIFT;1006310048 x = -x;···10065100521006610053 if (y < 0) {1006710054 if (y + cursor_state->crtc_h <= 0)1006810068- base = 0;1005510055+ on = false;10069100561007010057 pos |= CURSOR_POS_SIGN << CURSOR_Y_SHIFT;1007110058 y = -y;1007210059 }1007310060 pos |= y << CURSOR_Y_SHIFT;1007410074-1007510075- if (base == 0 && intel_crtc->cursor_base == 0)1007610076- return;10077100611007810062 I915_WRITE(CURPOS(pipe), pos);1007910063···1008210072 }10083100731008410074 if (IS_845G(dev) || IS_I865G(dev))1008510085- i845_update_cursor(crtc, base);1007510075+ i845_update_cursor(crtc, base, on);1008610076 else1008710087- i9xx_update_cursor(crtc, base);1007710077+ i9xx_update_cursor(crtc, base, on);1008810078}10089100791009010080static bool cursor_size_ok(struct drm_device *dev,···1372813718 struct drm_crtc *crtc = crtc_state->base.crtc;1372913719 struct drm_framebuffer *fb = state->base.fb;1373013720 struct drm_i915_gem_object *obj = intel_fb_obj(fb);1372113721+ enum pipe pipe = to_intel_plane(plane)->pipe;1373113722 unsigned stride;1373213723 int ret;1373313724···1376213751 return -EINVAL;1376313752 }13764137531375413754+ /*1375513755+ * There's something wrong with the cursor on CHV pipe C.1375613756+ * If it straddles the left edge of the screen then1375713757+ * moving it away from the edge or disabling it often1375813758+ * results in a pipe underrun, and often that can lead to1375913759+ * dead pipe (constant underrun reported, and it scans1376013760+ * out just a solid color). To recover from that, the1376113761+ * display power well must be turned off and on again.1376213762+ * Refuse the put the cursor into that compromised position.1376313763+ */1376413764+ if (IS_CHERRYVIEW(plane->dev) && pipe == PIPE_C &&1376513765+ state->visible && state->base.crtc_x < 0) {1376613766+ DRM_DEBUG_KMS("CHV cursor C not allowed to straddle the left screen edge\n");1376713767+ return -EINVAL;1376813768+ }1376913769+1376513770 return 0;1376613771}1376713772···1380113774 crtc = crtc ? crtc : plane->crtc;1380213775 intel_crtc = to_intel_crtc(crtc);13803137761380413804- if (intel_crtc->cursor_bo == obj)1380513805- goto update;1380613806-1380713777 if (!obj)1380813778 addr = 0;1380913779 else if (!INTEL_INFO(dev)->cursor_needs_physical)···1380913785 addr = obj->phys_handle->busaddr;13810137861381113787 intel_crtc->cursor_addr = addr;1381213812- intel_crtc->cursor_bo = obj;13813137881381413814-update:1381513789 if (crtc->state->active)1381613790 intel_crtc_update_cursor(crtc, state->visible);1381713791}
-1
drivers/gpu/drm/i915/intel_drv.h
···550550 int adjusted_x;551551 int adjusted_y;552552553553- struct drm_i915_gem_object *cursor_bo;554553 uint32_t cursor_addr;555554 uint32_t cursor_cntl;556555 uint32_t cursor_size;
+4-3
drivers/gpu/drm/i915/intel_hdmi.c
···13741374 struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);13751375 struct drm_i915_private *dev_priv = to_i915(connector->dev);13761376 bool live_status = false;13771377- unsigned int retry = 3;13771377+ unsigned int try;1378137813791379 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",13801380 connector->base.id, connector->name);1381138113821382 intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);1383138313841384- while (!live_status && --retry) {13841384+ for (try = 0; !live_status && try < 4; try++) {13851385+ if (try)13861386+ msleep(10);13851387 live_status = intel_digital_port_connected(dev_priv,13861388 hdmi_to_dig_port(intel_hdmi));13871387- mdelay(10);13881389 }1389139013901391 if (!live_status)
+1
drivers/gpu/drm/nouveau/nvkm/subdev/bios/fan.c
···8383 fan->type = NVBIOS_THERM_FAN_UNK;8484 }85858686+ fan->fan_mode = NVBIOS_THERM_FAN_LINEAR;8687 fan->min_duty = nvbios_rd08(bios, data + 0x02);8788 fan->max_duty = nvbios_rd08(bios, data + 0x03);8889
+1
drivers/hwmon/Kconfig
···12171217config SENSORS_SHT1512181218 tristate "Sensiron humidity and temperature sensors. SHT15 and compat."12191219 depends on GPIOLIB || COMPILE_TEST12201220+ select BITREVERSE12201221 help12211222 If you say yes here you get support for the Sensiron SHT10, SHT11,12221223 SHT15, SHT71, SHT75 humidity and temperature sensors.
+15-1
drivers/hwmon/tmp102.c
···5858 u16 config_orig;5959 unsigned long last_update;6060 int temp[3];6161+ bool first_time;6162};62636364/* convert left adjusted 13-bit TMP102 register value to milliCelsius */···9493 tmp102->temp[i] = tmp102_reg_to_mC(status);9594 }9695 tmp102->last_update = jiffies;9696+ tmp102->first_time = false;9797 }9898 mutex_unlock(&tmp102->lock);9999 return tmp102;···103101static int tmp102_read_temp(void *dev, int *temp)104102{105103 struct tmp102 *tmp102 = tmp102_update_device(dev);104104+105105+ /* Is it too early even to return a conversion? */106106+ if (tmp102->first_time) {107107+ dev_dbg(dev, "%s: Conversion not ready yet..\n", __func__);108108+ return -EAGAIN;109109+ }106110107111 *temp = tmp102->temp[0];108112···121113{122114 struct sensor_device_attribute *sda = to_sensor_dev_attr(attr);123115 struct tmp102 *tmp102 = tmp102_update_device(dev);116116+117117+ /* Is it too early even to return a read? */118118+ if (tmp102->first_time)119119+ return -EAGAIN;124120125121 return sprintf(buf, "%d\n", tmp102->temp[sda->index]);126122}···219207 status = -ENODEV;220208 goto fail_restore_config;221209 }222222- tmp102->last_update = jiffies - HZ;210210+ tmp102->last_update = jiffies;211211+ /* Mark that we are not ready with data until conversion is complete */212212+ tmp102->first_time = true;223213 mutex_init(&tmp102->lock);224214225215 hwmon_dev = hwmon_device_register_with_groups(dev, client->name,
+9-2
drivers/i2c/busses/i2c-davinci.c
···202202 * d is always 6 on Keystone I2C controller203203 */204204205205- /* get minimum of 7 MHz clock, but max of 12 MHz */206206- psc = (input_clock / 7000000) - 1;205205+ /*206206+ * Both Davinci and current Keystone User Guides recommend a value207207+ * between 7MHz and 12MHz. In reality 7MHz module clock doesn't208208+ * always produce enough margin between SDA and SCL transitions.209209+ * Measurements show that the higher the module clock is, the210210+ * bigger is the margin, providing more reliable communication.211211+ * So we better target for 12MHz.212212+ */213213+ psc = (input_clock / 12000000) - 1;207214 if ((input_clock / (psc + 1)) > 12000000)208215 psc++; /* better to run under spec than over */209216 d = (psc >= 2) ? 5 : 7 - psc;
+6
drivers/i2c/busses/i2c-designware-core.c
···813813tx_aborted:814814 if ((stat & (DW_IC_INTR_TX_ABRT | DW_IC_INTR_STOP_DET)) || dev->msg_err)815815 complete(&dev->cmd_complete);816816+ else if (unlikely(dev->accessor_flags & ACCESS_INTR_MASK)) {817817+ /* workaround to trigger pending interrupt */818818+ stat = dw_readl(dev, DW_IC_INTR_MASK);819819+ i2c_dw_disable_int(dev);820820+ dw_writel(dev, stat, DW_IC_INTR_MASK);821821+ }816822817823 return IRQ_HANDLED;818824}
···171171 int status;172172 u8 speed;173173174174- status = ocrdma_mbx_get_link_speed(dev, &speed);174174+ status = ocrdma_mbx_get_link_speed(dev, &speed, NULL);175175 if (status)176176 speed = OCRDMA_PHYS_LINK_SPEED_ZERO;177177
···18191819 input_set_abs_params(inputdev, ABS_TILT_Y, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0);18201820 input_set_abs_params(inputdev, ABS_WHEEL, AIPTEK_WHEEL_MIN, AIPTEK_WHEEL_MAX - 1, 0, 0);1821182118221822+ /* Verify that a device really has an endpoint */18231823+ if (intf->altsetting[0].desc.bNumEndpoints < 1) {18241824+ dev_err(&intf->dev,18251825+ "interface has %d endpoints, but must have minimum 1\n",18261826+ intf->altsetting[0].desc.bNumEndpoints);18271827+ err = -EINVAL;18281828+ goto fail3;18291829+ }18221830 endpoint = &intf->altsetting[0].endpoint[0].desc;1823183118241832 /* Go set up our URB, which is called when the tablet receives···18691861 if (i == ARRAY_SIZE(speeds)) {18701862 dev_info(&intf->dev,18711863 "Aiptek tried all speeds, no sane response\n");18641864+ err = -EINVAL;18721865 goto fail3;18731866 }18741867
···805805{806806 int i;807807808808- for (i = 0; i < IVTV_CARD_MAX_VIDEO_INPUTS - 1; i++)808808+ for (i = 0; i < IVTV_CARD_MAX_VIDEO_INPUTS; i++)809809 if (itv->card->video_inputs[i].video_type == 0)810810 break;811811 itv->nof_inputs = i;812812- for (i = 0; i < IVTV_CARD_MAX_AUDIO_INPUTS - 1; i++)812812+ for (i = 0; i < IVTV_CARD_MAX_AUDIO_INPUTS; i++)813813 if (itv->card->audio_inputs[i].audio_type == 0)814814 break;815815 itv->nof_audio_inputs = i;
+1-1
drivers/media/usb/airspy/airspy.c
···134134 int urbs_submitted;135135136136 /* USB control message buffer */137137- #define BUF_SIZE 24137137+ #define BUF_SIZE 128138138 u8 buf[BUF_SIZE];139139140140 /* Current configuration */
+12-1
drivers/media/usb/hackrf/hackrf.c
···2424#include <media/videobuf2-v4l2.h>2525#include <media/videobuf2-vmalloc.h>26262727+/*2828+ * Used Avago MGA-81563 RF amplifier could be destroyed pretty easily with too2929+ * strong signal or transmitting to bad antenna.3030+ * Set RF gain control to 'grabbed' state by default for sure.3131+ */3232+static bool hackrf_enable_rf_gain_ctrl;3333+module_param_named(enable_rf_gain_ctrl, hackrf_enable_rf_gain_ctrl, bool, 0644);3434+MODULE_PARM_DESC(enable_rf_gain_ctrl, "enable RX/TX RF amplifier control (warn: could damage amplifier)");3535+2736/* HackRF USB API commands (from HackRF Library) */2837enum {2938 CMD_SET_TRANSCEIVER_MODE = 0x01,···14601451 dev_err(dev->dev, "Could not initialize controls\n");14611452 goto err_v4l2_ctrl_handler_free_rx;14621453 }14541454+ v4l2_ctrl_grab(dev->rx_rf_gain, !hackrf_enable_rf_gain_ctrl);14631455 v4l2_ctrl_handler_setup(&dev->rx_ctrl_handler);1464145614651457 /* Register controls for transmitter */···14811471 dev_err(dev->dev, "Could not initialize controls\n");14821472 goto err_v4l2_ctrl_handler_free_tx;14831473 }14741474+ v4l2_ctrl_grab(dev->tx_rf_gain, !hackrf_enable_rf_gain_ctrl);14841475 v4l2_ctrl_handler_setup(&dev->tx_ctrl_handler);1485147614861477 /* Register the v4l2_device structure */···15411530err_kfree:15421531 kfree(dev);15431532err:15441544- dev_dbg(dev->dev, "failed=%d\n", ret);15331533+ dev_dbg(&intf->dev, "failed=%d\n", ret);15451534 return ret;15461535}15471536
···46464747 ofpart_node = of_get_child_by_name(mtd_node, "partitions");4848 if (!ofpart_node) {4949- pr_warn("%s: 'partitions' subnode not found on %s. Trying to parse direct subnodes as partitions.\n",5050- master->name, mtd_node->full_name);4949+ /*5050+ * We might get here even when ofpart isn't used at all (e.g.,5151+ * when using another parser), so don't be louder than5252+ * KERN_DEBUG5353+ */5454+ pr_debug("%s: 'partitions' subnode not found on %s. Trying to parse direct subnodes as partitions.\n",5555+ master->name, mtd_node->full_name);5156 ofpart_node = mtd_node;5257 dedicated = false;5858+ } else if (!of_device_is_compatible(ofpart_node, "fixed-partitions")) {5959+ /* The 'partitions' subnode might be used by another parser */6060+ return 0;5361 }54625563 /* First count the subnodes */
···603603 return 0;604604}605605606606+static int __erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk);606607/**607608 * do_sync_erase - run the erase worker synchronously.608609 * @ubi: UBI device description object···616615static int do_sync_erase(struct ubi_device *ubi, struct ubi_wl_entry *e,617616 int vol_id, int lnum, int torture)618617{619619- struct ubi_work *wl_wrk;618618+ struct ubi_work wl_wrk;620619621620 dbg_wl("sync erase of PEB %i", e->pnum);622621623623- wl_wrk = kmalloc(sizeof(struct ubi_work), GFP_NOFS);624624- if (!wl_wrk)625625- return -ENOMEM;622622+ wl_wrk.e = e;623623+ wl_wrk.vol_id = vol_id;624624+ wl_wrk.lnum = lnum;625625+ wl_wrk.torture = torture;626626627627- wl_wrk->e = e;628628- wl_wrk->vol_id = vol_id;629629- wl_wrk->lnum = lnum;630630- wl_wrk->torture = torture;631631-632632- return erase_worker(ubi, wl_wrk, 0);627627+ return __erase_worker(ubi, &wl_wrk);633628}634629635630/**···10111014}1012101510131016/**10141014- * erase_worker - physical eraseblock erase worker function.10171017+ * __erase_worker - physical eraseblock erase worker function.10151018 * @ubi: UBI device description object10161019 * @wl_wrk: the work object10171020 * @shutdown: non-zero if the worker has to free memory and exit···10221025 * needed. Returns zero in case of success and a negative error code in case of10231026 * failure.10241027 */10251025-static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,10261026- int shutdown)10281028+static int __erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk)10271029{10281030 struct ubi_wl_entry *e = wl_wrk->e;10291031 int pnum = e->pnum;···10301034 int lnum = wl_wrk->lnum;10311035 int err, available_consumed = 0;1032103610331033- if (shutdown) {10341034- dbg_wl("cancel erasure of PEB %d EC %d", pnum, e->ec);10351035- kfree(wl_wrk);10361036- wl_entry_destroy(ubi, e);10371037- return 0;10381038- }10391039-10401037 dbg_wl("erase PEB %d EC %d LEB %d:%d",10411038 pnum, e->ec, wl_wrk->vol_id, wl_wrk->lnum);1042103910431040 err = sync_erase(ubi, e, wl_wrk->torture);10441041 if (!err) {10451045- /* Fine, we've erased it successfully */10461046- kfree(wl_wrk);10471047-10481042 spin_lock(&ubi->wl_lock);10491043 wl_tree_add(e, &ubi->free);10501044 ubi->free_count++;···10521066 }1053106710541068 ubi_err(ubi, "failed to erase PEB %d, error %d", pnum, err);10551055- kfree(wl_wrk);1056106910571070 if (err == -EINTR || err == -ENOMEM || err == -EAGAIN ||10581071 err == -EBUSY) {···10601075 /* Re-schedule the LEB for erasure */10611076 err1 = schedule_erase(ubi, e, vol_id, lnum, 0);10621077 if (err1) {10781078+ wl_entry_destroy(ubi, e);10631079 err = err1;10641080 goto out_ro;10651081 }···11341148 }11351149 ubi_ro_mode(ubi);11361150 return err;11511151+}11521152+11531153+static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,11541154+ int shutdown)11551155+{11561156+ int ret;11571157+11581158+ if (shutdown) {11591159+ struct ubi_wl_entry *e = wl_wrk->e;11601160+11611161+ dbg_wl("cancel erasure of PEB %d EC %d", e->pnum, e->ec);11621162+ kfree(wl_wrk);11631163+ wl_entry_destroy(ubi, e);11641164+ return 0;11651165+ }11661166+11671167+ ret = __erase_worker(ubi, wl_wrk);11681168+ kfree(wl_wrk);11691169+ return ret;11371170}1138117111391172/**
+13-9
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
···33703370 return rc;33713371}3372337233733373-#if (MAX_SKB_FRAGS >= MAX_FETCH_BD - 3)33733373+/* VXLAN: 4 = 1 (for linear data BD) + 3 (2 for PBD and last BD) */33743374+#define BNX2X_NUM_VXLAN_TSO_WIN_SUB_BDS 433753375+33763376+/* Regular: 3 = 1 (for linear data BD) + 2 (for PBD and last BD) */33773377+#define BNX2X_NUM_TSO_WIN_SUB_BDS 333783378+33793379+#if (MAX_SKB_FRAGS >= MAX_FETCH_BD - BDS_PER_TX_PKT)33743380/* check if packet requires linearization (packet is too fragmented)33753381 no need to check fragmentation if page size > 8K (there will be no33763382 violation to FW restrictions) */33773383static int bnx2x_pkt_req_lin(struct bnx2x *bp, struct sk_buff *skb,33783384 u32 xmit_type)33793385{33803380- int to_copy = 0;33813381- int hlen = 0;33823382- int first_bd_sz = 0;33863386+ int first_bd_sz = 0, num_tso_win_sub = BNX2X_NUM_TSO_WIN_SUB_BDS;33873387+ int to_copy = 0, hlen = 0;3383338833843384- /* 3 = 1 (for linear data BD) + 2 (for PBD and last BD) */33853385- if (skb_shinfo(skb)->nr_frags >= (MAX_FETCH_BD - 3)) {33893389+ if (xmit_type & XMIT_GSO_ENC)33903390+ num_tso_win_sub = BNX2X_NUM_VXLAN_TSO_WIN_SUB_BDS;3386339133923392+ if (skb_shinfo(skb)->nr_frags >= (MAX_FETCH_BD - num_tso_win_sub)) {33873393 if (xmit_type & XMIT_GSO) {33883394 unsigned short lso_mss = skb_shinfo(skb)->gso_size;33893389- /* Check if LSO packet needs to be copied:33903390- 3 = 1 (for headers BD) + 2 (for PBD and last BD) */33913391- int wnd_size = MAX_FETCH_BD - 3;33953395+ int wnd_size = MAX_FETCH_BD - num_tso_win_sub;33923396 /* Number of windows to check */33933397 int num_wnds = skb_shinfo(skb)->nr_frags - wnd_size;33943398 int wnd_idx = 0;
-2
drivers/net/ethernet/emulex/benet/be.h
···845845/*846846 * internal function to open-close roce device during ifup-ifdown.847847 */848848-void be_roce_dev_open(struct be_adapter *);849849-void be_roce_dev_close(struct be_adapter *);850848void be_roce_dev_shutdown(struct be_adapter *);851849852850#endif /* BE_H */
+3-5
drivers/net/ethernet/emulex/benet/be_main.c
···3297329732983298 return 0;32993299err_msix:33003300- for (i--, eqo = &adapter->eq_obj[i]; i >= 0; i--, eqo--)33003300+ for (i--; i >= 0; i--) {33013301+ eqo = &adapter->eq_obj[i];33013302 free_irq(be_msix_vec_get(adapter, eqo), eqo);33033303+ }33023304 dev_warn(&adapter->pdev->dev, "MSIX Request IRQ failed - err %d\n",33033305 status);33043306 be_msix_disable(adapter);···34313429 return 0;3432343034333431 be_disable_if_filters(adapter);34343434-34353435- be_roce_dev_close(adapter);3436343234373433 if (adapter->flags & BE_FLAGS_NAPI_ENABLED) {34383434 for_all_evt_queues(adapter, eqo, i) {···35993599 be_link_status_update(adapter, link_status);3600360036013601 netif_tx_start_all_queues(netdev);36023602- be_roce_dev_open(adapter);36033603-36043602#ifdef CONFIG_BE2NET_VXLAN36053603 if (skyhawk_chip(adapter))36063604 vxlan_get_rx_port(netdev);
···242242 unsigned long flags;243243 u64 ns, zero = 0;244244245245+ /* mlx4_en_init_timestamp is called for each netdev.246246+ * mdev->ptp_clock is common for all ports, skip initialization if247247+ * was done for other port.248248+ */249249+ if (mdev->ptp_clock)250250+ return;251251+245252 rwlock_init(&mdev->clock_lock);246253247254 memset(&mdev->cycles, 0, sizeof(mdev->cycles));
-7
drivers/net/ethernet/mellanox/mlx4/en_main.c
···232232 if (mdev->pndev[i])233233 mlx4_en_destroy_netdev(mdev->pndev[i]);234234235235- if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)236236- mlx4_en_remove_timestamp(mdev);237237-238235 flush_workqueue(mdev->workqueue);239236 destroy_workqueue(mdev->workqueue);240237 (void) mlx4_mr_free(dev, &mdev->mr);···316319 mdev->port_cnt = 0;317320 mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_ETH)318321 mdev->port_cnt++;319319-320320- /* Initialize time stamp mechanism */321321- if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)322322- mlx4_en_init_timestamp(mdev);323322324323 /* Set default number of RX rings*/325324 mlx4_en_set_num_rx_rings(mdev);
+8-2
drivers/net/ethernet/mellanox/mlx4/en_netdev.c
···20352035 /* flush any pending task for this netdev */20362036 flush_workqueue(mdev->workqueue);2037203720382038+ if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)20392039+ mlx4_en_remove_timestamp(mdev);20402040+20382041 /* Detach the netdev so tasks would not attempt to access it */20392042 mutex_lock(&mdev->state_lock);20402043 mdev->pndev[priv->port] = NULL;···30213018 }30223019 queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY);3023302030213021+ /* Initialize time stamp mechanism */30243022 if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)30253025- queue_delayed_work(mdev->workqueue, &priv->service_task,30263026- SERVICE_TASK_DELAY);30233023+ mlx4_en_init_timestamp(mdev);30243024+30253025+ queue_delayed_work(mdev->workqueue, &priv->service_task,30263026+ SERVICE_TASK_DELAY);3027302730283028 mlx4_en_set_stats_bitmap(mdev->dev, &priv->stats_bitmap,30293029 mdev->profile.prof[priv->port].rx_ppp,
···252252 state = QLCRDX(ahw, QLC_83XX_VNIC_STATE);253253 }254254255255- if (!idc->vnic_wait_limit) {255255+ if (state != QLCNIC_DEV_NPAR_OPER) {256256 dev_err(&adapter->pdev->dev,257257 "vNIC mode not operational, state check timed out.\n");258258 return -EIO;
+14-11
drivers/net/ethernet/renesas/sh_eth.c
···11421142 int tx_ringsize = sizeof(*txdesc) * mdp->num_tx_ring;11431143 int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN + 32 - 1;11441144 dma_addr_t dma_addr;11451145+ u32 buf_len;1145114611461147 mdp->cur_rx = 0;11471148 mdp->cur_tx = 0;···11631162 /* RX descriptor */11641163 rxdesc = &mdp->rx_ring[i];11651164 /* The size of the buffer is a multiple of 32 bytes. */11661166- rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 32);11671167- dma_addr = dma_map_single(&ndev->dev, skb->data,11681168- rxdesc->buffer_length,11651165+ buf_len = ALIGN(mdp->rx_buf_sz, 32);11661166+ rxdesc->len = cpu_to_edmac(mdp, buf_len << 16);11671167+ dma_addr = dma_map_single(&ndev->dev, skb->data, buf_len,11691168 DMA_FROM_DEVICE);11701169 if (dma_mapping_error(&ndev->dev, dma_addr)) {11711170 kfree_skb(skb);···11961195 mdp->tx_skbuff[i] = NULL;11971196 txdesc = &mdp->tx_ring[i];11981197 txdesc->status = cpu_to_edmac(mdp, TD_TFP);11991199- txdesc->buffer_length = 0;11981198+ txdesc->len = cpu_to_edmac(mdp, 0);12001199 if (i == 0) {12011200 /* Tx descriptor address set */12021201 sh_eth_write(ndev, mdp->tx_desc_dma, TDLAR);···14051404 if (mdp->tx_skbuff[entry]) {14061405 dma_unmap_single(&ndev->dev,14071406 edmac_to_cpu(mdp, txdesc->addr),14081408- txdesc->buffer_length, DMA_TO_DEVICE);14071407+ edmac_to_cpu(mdp, txdesc->len) >> 16,14081408+ DMA_TO_DEVICE);14091409 dev_kfree_skb_irq(mdp->tx_skbuff[entry]);14101410 mdp->tx_skbuff[entry] = NULL;14111411 free_num++;···14161414 txdesc->status |= cpu_to_edmac(mdp, TD_TDLE);1417141514181416 ndev->stats.tx_packets++;14191419- ndev->stats.tx_bytes += txdesc->buffer_length;14171417+ ndev->stats.tx_bytes += edmac_to_cpu(mdp, txdesc->len) >> 16;14201418 }14211419 return free_num;14221420}···14351433 u32 desc_status;14361434 int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN + 32 - 1;14371435 dma_addr_t dma_addr;14361436+ u32 buf_len;1438143714391438 boguscnt = min(boguscnt, *quota);14401439 limit = boguscnt;···14441441 /* RACT bit must be checked before all the following reads */14451442 dma_rmb();14461443 desc_status = edmac_to_cpu(mdp, rxdesc->status);14471447- pkt_len = rxdesc->frame_length;14441444+ pkt_len = edmac_to_cpu(mdp, rxdesc->len) & RD_RFL;1448144514491446 if (--boguscnt < 0)14501447 break;···15101507 entry = mdp->dirty_rx % mdp->num_rx_ring;15111508 rxdesc = &mdp->rx_ring[entry];15121509 /* The size of the buffer is 32 byte boundary. */15131513- rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 32);15101510+ buf_len = ALIGN(mdp->rx_buf_sz, 32);15111511+ rxdesc->len = cpu_to_edmac(mdp, buf_len << 16);1514151215151513 if (mdp->rx_skbuff[entry] == NULL) {15161514 skb = netdev_alloc_skb(ndev, skbuff_size);···15191515 break; /* Better luck next round. */15201516 sh_eth_set_receive_align(skb);15211517 dma_addr = dma_map_single(&ndev->dev, skb->data,15221522- rxdesc->buffer_length,15231523- DMA_FROM_DEVICE);15181518+ buf_len, DMA_FROM_DEVICE);15241519 if (dma_mapping_error(&ndev->dev, dma_addr)) {15251520 kfree_skb(skb);15261521 break;···23852382 return NETDEV_TX_OK;23862383 }23872384 txdesc->addr = cpu_to_edmac(mdp, dma_addr);23882388- txdesc->buffer_length = skb->len;23852385+ txdesc->len = cpu_to_edmac(mdp, skb->len << 16);2389238623902387 dma_wmb(); /* TACT bit must be set after all the above writes */23912388 if (entry >= mdp->num_tx_ring - 1)
···20262026 for_each_child_of_node(node, slave_node) {20272027 struct cpsw_slave_data *slave_data = data->slave_data + i;20282028 const void *mac_addr = NULL;20292029- u32 phyid;20302029 int lenp;20312030 const __be32 *parp;20322032- struct device_node *mdio_node;20332033- struct platform_device *mdio;2034203120352032 /* This is no slave child node, continue */20362033 if (strcmp(slave_node->name, "slave"))20372034 continue;2038203520392036 priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0);20372037+ parp = of_get_property(slave_node, "phy_id", &lenp);20402038 if (of_phy_is_fixed_link(slave_node)) {20412041- struct phy_device *pd;20392039+ struct device_node *phy_node;20402040+ struct phy_device *phy_dev;2042204120422042+ /* In the case of a fixed PHY, the DT node associated20432043+ * to the PHY is the Ethernet MAC DT node.20442044+ */20432045 ret = of_phy_register_fixed_link(slave_node);20442046 if (ret)20452047 return ret;20462046- pd = of_phy_find_device(slave_node);20472047- if (!pd)20482048+ phy_node = of_node_get(slave_node);20492049+ phy_dev = of_phy_find_device(phy_node);20502050+ if (!phy_dev)20482051 return -ENODEV;20492052 snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),20502050- PHY_ID_FMT, pd->bus->id, pd->phy_id);20532053+ PHY_ID_FMT, phy_dev->bus->id, phy_dev->addr);20542054+ } else if (parp) {20552055+ u32 phyid;20562056+ struct device_node *mdio_node;20572057+ struct platform_device *mdio;20582058+20592059+ if (lenp != (sizeof(__be32) * 2)) {20602060+ dev_err(&pdev->dev, "Invalid slave[%d] phy_id property\n", i);20612061+ goto no_phy_slave;20622062+ }20632063+ mdio_node = of_find_node_by_phandle(be32_to_cpup(parp));20642064+ phyid = be32_to_cpup(parp+1);20652065+ mdio = of_find_device_by_node(mdio_node);20662066+ of_node_put(mdio_node);20672067+ if (!mdio) {20682068+ dev_err(&pdev->dev, "Missing mdio platform device\n");20692069+ return -EINVAL;20702070+ }20712071+ snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),20722072+ PHY_ID_FMT, mdio->name, phyid);20732073+ } else {20742074+ dev_err(&pdev->dev, "No slave[%d] phy_id or fixed-link property\n", i);20512075 goto no_phy_slave;20522076 }20532053- parp = of_get_property(slave_node, "phy_id", &lenp);20542054- if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) {20552055- dev_err(&pdev->dev, "Missing slave[%d] phy_id property\n", i);20562056- goto no_phy_slave;20572057- }20582058- mdio_node = of_find_node_by_phandle(be32_to_cpup(parp));20592059- phyid = be32_to_cpup(parp+1);20602060- mdio = of_find_device_by_node(mdio_node);20612061- of_node_put(mdio_node);20622062- if (!mdio) {20632063- dev_err(&pdev->dev, "Missing mdio platform device\n");20642064- return -EINVAL;20652065- }20662066- snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),20672067- PHY_ID_FMT, mdio->name, phyid);20682077 slave_data->phy_if = of_get_phy_mode(slave_node);20692078 if (slave_data->phy_if < 0) {20702079 dev_err(&pdev->dev, "Missing or malformed slave[%d] phy-mode property\n",···24272418 ndev->irq = platform_get_irq(pdev, 1);24282419 if (ndev->irq < 0) {24292420 dev_err(priv->dev, "error getting irq resource\n");24302430- ret = -ENOENT;24212421+ ret = ndev->irq;24312422 goto clean_ale_ret;24322423 }24332424···2448243924492440 /* RX IRQ */24502441 irq = platform_get_irq(pdev, 1);24512451- if (irq < 0)24422442+ if (irq < 0) {24432443+ ret = irq;24522444 goto clean_ale_ret;24452445+ }2453244624542447 priv->irqs_table[0] = irq;24552448 ret = devm_request_irq(&pdev->dev, irq, cpsw_rx_interrupt,···2463245224642453 /* TX IRQ */24652454 irq = platform_get_irq(pdev, 2);24662466- if (irq < 0)24552455+ if (irq < 0) {24562456+ ret = irq;24672457 goto clean_ale_ret;24582458+ }2468245924692460 priv->irqs_table[1] = irq;24702461 ret = devm_request_irq(&pdev->dev, irq, cpsw_tx_interrupt,
+9-1
drivers/net/geneve.c
···12231223 struct geneve_net *gn = net_generic(net, geneve_net_id);12241224 struct geneve_dev *t, *geneve = netdev_priv(dev);12251225 bool tun_collect_md, tun_on_same_port;12261226- int err;12261226+ int err, encap_len;1227122712281228 if (!remote)12291229 return -EINVAL;···12551255 &tun_on_same_port, &tun_collect_md);12561256 if (t)12571257 return -EBUSY;12581258+12591259+ /* make enough headroom for basic scenario */12601260+ encap_len = GENEVE_BASE_HLEN + ETH_HLEN;12611261+ if (remote->sa.sa_family == AF_INET)12621262+ encap_len += sizeof(struct iphdr);12631263+ else12641264+ encap_len += sizeof(struct ipv6hdr);12651265+ dev->needed_headroom = encap_len + ETH_HLEN;1258126612591267 if (metadata) {12601268 if (tun_on_same_port)
+4-4
drivers/net/hamradio/6pack.c
···683683 if (!atomic_dec_and_test(&sp->refcnt))684684 down(&sp->dead_sem);685685686686- unregister_netdev(sp->dev);687687-688688- del_timer(&sp->tx_t);689689- del_timer(&sp->resync_t);686686+ del_timer_sync(&sp->tx_t);687687+ del_timer_sync(&sp->resync_t);690688691689 /* Free all 6pack frame buffers. */692690 kfree(sp->rbuff);693691 kfree(sp->xbuff);692692+693693+ unregister_netdev(sp->dev);694694}695695696696/* Perform I/O control on an active 6pack channel. */
+2-2
drivers/net/hamradio/mkiss.c
···798798 if (!atomic_dec_and_test(&ax->refcnt))799799 down(&ax->dead_sem);800800801801- unregister_netdev(ax->dev);802802-803801 /* Free all AX25 frame buffers. */804802 kfree(ax->rbuff);805803 kfree(ax->xbuff);806804807805 ax->tty = NULL;806806+807807+ unregister_netdev(ax->dev);808808}809809810810/* Perform I/O control on an active ax25 channel. */
···12221222 mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) {12231223 u8 sta_id = mvmvif->ap_sta_id;1224122412251225- sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id],12261226- lockdep_is_held(&mvm->mutex));12251225+ sta = rcu_dereference_check(mvm->fw_id_to_mac_id[sta_id],12261226+ lockdep_is_held(&mvm->mutex));12271227 /*12281228 * It is possible that the 'sta' parameter is NULL,12291229 * for example when a GTK is removed - the sta_id will then···15901590 u16 *phase1key)15911591{15921592 struct iwl_mvm_sta *mvm_sta;15931593- u8 sta_id = iwl_mvm_get_key_sta_id(mvm, vif, sta);15931593+ u8 sta_id;15941594 bool mcast = !(keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE);1595159515961596- if (WARN_ON_ONCE(sta_id == IWL_MVM_STATION_COUNT))15971597- return;15981598-15991596 rcu_read_lock();15971597+15981598+ sta_id = iwl_mvm_get_key_sta_id(mvm, vif, sta);15991599+ if (WARN_ON_ONCE(sta_id == IWL_MVM_STATION_COUNT))16001600+ goto unlock;1600160116011602 if (!sta) {16021603 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);···16101609 mvm_sta = iwl_mvm_sta_from_mac80211(sta);16111610 iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, mcast,16121611 iv32, phase1key, CMD_ASYNC, keyconf->hw_key_idx);16121612+16131613+ unlock:16131614 rcu_read_unlock();16141615}16151616
+15-19
drivers/net/xen-netback/netback.c
···258258 struct netrx_pending_operations *npo)259259{260260 struct xenvif_rx_meta *meta;261261- struct xen_netif_rx_request *req;261261+ struct xen_netif_rx_request req;262262263263- req = RING_GET_REQUEST(&queue->rx, queue->rx.req_cons++);263263+ RING_COPY_REQUEST(&queue->rx, queue->rx.req_cons++, &req);264264265265 meta = npo->meta + npo->meta_prod++;266266 meta->gso_type = XEN_NETIF_GSO_TYPE_NONE;267267 meta->gso_size = 0;268268 meta->size = 0;269269- meta->id = req->id;269269+ meta->id = req.id;270270271271 npo->copy_off = 0;272272- npo->copy_gref = req->gref;272272+ npo->copy_gref = req.gref;273273274274 return meta;275275}···424424 struct xenvif *vif = netdev_priv(skb->dev);425425 int nr_frags = skb_shinfo(skb)->nr_frags;426426 int i;427427- struct xen_netif_rx_request *req;427427+ struct xen_netif_rx_request req;428428 struct xenvif_rx_meta *meta;429429 unsigned char *data;430430 int head = 1;···443443444444 /* Set up a GSO prefix descriptor, if necessary */445445 if ((1 << gso_type) & vif->gso_prefix_mask) {446446- req = RING_GET_REQUEST(&queue->rx, queue->rx.req_cons++);446446+ RING_COPY_REQUEST(&queue->rx, queue->rx.req_cons++, &req);447447 meta = npo->meta + npo->meta_prod++;448448 meta->gso_type = gso_type;449449 meta->gso_size = skb_shinfo(skb)->gso_size;450450 meta->size = 0;451451- meta->id = req->id;451451+ meta->id = req.id;452452 }453453454454- req = RING_GET_REQUEST(&queue->rx, queue->rx.req_cons++);454454+ RING_COPY_REQUEST(&queue->rx, queue->rx.req_cons++, &req);455455 meta = npo->meta + npo->meta_prod++;456456457457 if ((1 << gso_type) & vif->gso_mask) {···463463 }464464465465 meta->size = 0;466466- meta->id = req->id;466466+ meta->id = req.id;467467 npo->copy_off = 0;468468- npo->copy_gref = req->gref;468468+ npo->copy_gref = req.gref;469469470470 data = skb->data;471471 while (data < skb_tail_pointer(skb)) {···679679 * Allow a burst big enough to transmit a jumbo packet of up to 128kB.680680 * Otherwise the interface can seize up due to insufficient credit.681681 */682682- max_burst = RING_GET_REQUEST(&queue->tx, queue->tx.req_cons)->size;683683- max_burst = min(max_burst, 131072UL);684684- max_burst = max(max_burst, queue->credit_bytes);682682+ max_burst = max(131072UL, queue->credit_bytes);685683686684 /* Take care that adding a new chunk of credit doesn't wrap to zero. */687685 max_credit = queue->remaining_credit + queue->credit_bytes;···709711 spin_unlock_irqrestore(&queue->response_lock, flags);710712 if (cons == end)711713 break;712712- txp = RING_GET_REQUEST(&queue->tx, cons++);714714+ RING_COPY_REQUEST(&queue->tx, cons++, txp);713715 } while (1);714716 queue->tx.req_cons = cons;715717}···776778 if (drop_err)777779 txp = &dropped_tx;778780779779- memcpy(txp, RING_GET_REQUEST(&queue->tx, cons + slots),780780- sizeof(*txp));781781+ RING_COPY_REQUEST(&queue->tx, cons + slots, txp);781782782783 /* If the guest submitted a frame >= 64 KiB then783784 * first->size overflowed and following slots will···11091112 return -EBADR;11101113 }1111111411121112- memcpy(&extra, RING_GET_REQUEST(&queue->tx, cons),11131113- sizeof(extra));11151115+ RING_COPY_REQUEST(&queue->tx, cons, &extra);11141116 if (unlikely(!extra.type ||11151117 extra.type >= XEN_NETIF_EXTRA_TYPE_MAX)) {11161118 queue->tx.req_cons = ++cons;···1318132213191323 idx = queue->tx.req_cons;13201324 rmb(); /* Ensure that we see the request before we copy it. */13211321- memcpy(&txreq, RING_GET_REQUEST(&queue->tx, idx), sizeof(txreq));13251325+ RING_COPY_REQUEST(&queue->tx, idx, &txreq);1322132613231327 /* Credit-based scheduling. */13241328 if (txreq.size > queue->remaining_credit &&
+19-1
drivers/nvme/host/pci.c
···25402540{25412541 bool kill = nvme_io_incapable(ns->dev) && !blk_queue_dying(ns->queue);2542254225432543- if (kill)25432543+ if (kill) {25442544 blk_set_queue_dying(ns->queue);25452545+25462546+ /*25472547+ * The controller was shutdown first if we got here through25482548+ * device removal. The shutdown may requeue outstanding25492549+ * requests. These need to be aborted immediately so25502550+ * del_gendisk doesn't block indefinitely for their completion.25512551+ */25522552+ blk_mq_abort_requeue_list(ns->queue);25532553+ }25452554 if (ns->disk->flags & GENHD_FL_UP)25462555 del_gendisk(ns->disk);25472556 if (kill || !blk_queue_dying(ns->queue)) {···29862977{29872978 struct nvme_ns *ns, *next;2988297929802980+ if (nvme_io_incapable(dev)) {29812981+ /*29822982+ * If the device is not capable of IO (surprise hot-removal,29832983+ * for example), we need to quiesce prior to deleting the29842984+ * namespaces. This will end outstanding requests and prevent29852985+ * attempts to sync dirty data.29862986+ */29872987+ nvme_dev_shutdown(dev);29882988+ }29892989 list_for_each_entry_safe(ns, next, &dev->namespaces, list)29902990 nvme_ns_remove(ns);29912991}
···233233 tristate "Allwinner sun9i SoC USB PHY driver"234234 depends on ARCH_SUNXI && HAS_IOMEM && OF235235 depends on RESET_CONTROLLER236236+ depends on USB_COMMON236237 select GENERIC_PHY237238 help238239 Enable this to support the transceiver that is part of Allwinner
+12-4
drivers/phy/phy-bcm-cygnus-pcie.c
···128128 struct phy_provider *provider;129129 struct resource *res;130130 unsigned cnt = 0;131131+ int ret;131132132133 if (of_get_child_count(node) == 0) {133134 dev_err(dev, "PHY no child node\n");···155154 if (of_property_read_u32(child, "reg", &id)) {156155 dev_err(dev, "missing reg property for %s\n",157156 child->name);158158- return -EINVAL;157157+ ret = -EINVAL;158158+ goto put_child;159159 }160160161161 if (id >= MAX_NUM_PHYS) {162162 dev_err(dev, "invalid PHY id: %u\n", id);163163- return -EINVAL;163163+ ret = -EINVAL;164164+ goto put_child;164165 }165166166167 if (core->phys[id].phy) {167168 dev_err(dev, "duplicated PHY id: %u\n", id);168168- return -EINVAL;169169+ ret = -EINVAL;170170+ goto put_child;169171 }170172171173 p = &core->phys[id];172174 p->phy = devm_phy_create(dev, child, &cygnus_pcie_phy_ops);173175 if (IS_ERR(p->phy)) {174176 dev_err(dev, "failed to create PHY\n");175175- return PTR_ERR(p->phy);177177+ ret = PTR_ERR(p->phy);178178+ goto put_child;176179 }177180178181 p->core = core;···196191 dev_dbg(dev, "registered %u PCIe PHY(s)\n", cnt);197192198193 return 0;194194+put_child:195195+ of_node_put(child);196196+ return ret;199197}200198201199static const struct of_device_id cygnus_pcie_phy_match_table[] = {
+14-6
drivers/phy/phy-berlin-sata.c
···195195 struct phy_provider *phy_provider;196196 struct phy_berlin_priv *priv;197197 struct resource *res;198198- int i = 0;198198+ int ret, i = 0;199199 u32 phy_id;200200201201 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);···237237 if (of_property_read_u32(child, "reg", &phy_id)) {238238 dev_err(dev, "missing reg property in node %s\n",239239 child->name);240240- return -EINVAL;240240+ ret = -EINVAL;241241+ goto put_child;241242 }242243243244 if (phy_id >= ARRAY_SIZE(phy_berlin_power_down_bits)) {244245 dev_err(dev, "invalid reg in node %s\n", child->name);245245- return -EINVAL;246246+ ret = -EINVAL;247247+ goto put_child;246248 }247249248250 phy_desc = devm_kzalloc(dev, sizeof(*phy_desc), GFP_KERNEL);249249- if (!phy_desc)250250- return -ENOMEM;251251+ if (!phy_desc) {252252+ ret = -ENOMEM;253253+ goto put_child;254254+ }251255252256 phy = devm_phy_create(dev, NULL, &phy_berlin_sata_ops);253257 if (IS_ERR(phy)) {254258 dev_err(dev, "failed to create PHY %d\n", phy_id);255255- return PTR_ERR(phy);259259+ ret = PTR_ERR(phy);260260+ goto put_child;256261 }257262258263 phy_desc->phy = phy;···274269 phy_provider =275270 devm_of_phy_provider_register(dev, phy_berlin_sata_phy_xlate);276271 return PTR_ERR_OR_ZERO(phy_provider);272272+put_child:273273+ of_node_put(child);274274+ return ret;277275}278276279277static const struct of_device_id phy_berlin_sata_of_match[] = {
+12-5
drivers/phy/phy-brcmstb-sata.c
···140140 struct brcm_sata_phy *priv;141141 struct resource *res;142142 struct phy_provider *provider;143143- int count = 0;143143+ int ret, count = 0;144144145145 if (of_get_child_count(dn) == 0)146146 return -ENODEV;···163163 if (of_property_read_u32(child, "reg", &id)) {164164 dev_err(dev, "missing reg property in node %s\n",165165 child->name);166166- return -EINVAL;166166+ ret = -EINVAL;167167+ goto put_child;167168 }168169169170 if (id >= MAX_PORTS) {170171 dev_err(dev, "invalid reg: %u\n", id);171171- return -EINVAL;172172+ ret = -EINVAL;173173+ goto put_child;172174 }173175 if (priv->phys[id].phy) {174176 dev_err(dev, "already registered port %u\n", id);175175- return -EINVAL;177177+ ret = -EINVAL;178178+ goto put_child;176179 }177180178181 port = &priv->phys[id];···185182 port->ssc_en = of_property_read_bool(child, "brcm,enable-ssc");186183 if (IS_ERR(port->phy)) {187184 dev_err(dev, "failed to create PHY\n");188188- return PTR_ERR(port->phy);185185+ ret = PTR_ERR(port->phy);186186+ goto put_child;189187 }190188191189 phy_set_drvdata(port->phy, port);···202198 dev_info(dev, "registered %d port(s)\n", count);203199204200 return 0;201201+put_child:202202+ of_node_put(child);203203+ return ret;205204}206205207206static struct platform_driver brcm_sata_phy_driver = {
+15-6
drivers/phy/phy-core.c
···636636 * @np: node containing the phy637637 * @index: index of the phy638638 *639639- * Gets the phy using _of_phy_get(), and associates a device with it using640640- * devres. On driver detach, release function is invoked on the devres data,639639+ * Gets the phy using _of_phy_get(), then gets a refcount to it,640640+ * and associates a device with it using devres. On driver detach,641641+ * release function is invoked on the devres data,641642 * then, devres data is freed.642643 *643644 */···652651 return ERR_PTR(-ENOMEM);653652654653 phy = _of_phy_get(np, index);655655- if (!IS_ERR(phy)) {656656- *ptr = phy;657657- devres_add(dev, ptr);658658- } else {654654+ if (IS_ERR(phy)) {659655 devres_free(ptr);656656+ return phy;660657 }658658+659659+ if (!try_module_get(phy->ops->owner)) {660660+ devres_free(ptr);661661+ return ERR_PTR(-EPROBE_DEFER);662662+ }663663+664664+ get_device(&phy->dev);665665+666666+ *ptr = phy;667667+ devres_add(dev, ptr);661668662669 return phy;663670}
+11-5
drivers/phy/phy-miphy28lp.c
···1226122612271227 miphy_phy = devm_kzalloc(&pdev->dev, sizeof(*miphy_phy),12281228 GFP_KERNEL);12291229- if (!miphy_phy)12301230- return -ENOMEM;12291229+ if (!miphy_phy) {12301230+ ret = -ENOMEM;12311231+ goto put_child;12321232+ }1231123312321234 miphy_dev->phys[port] = miphy_phy;1233123512341236 phy = devm_phy_create(&pdev->dev, child, &miphy28lp_ops);12351237 if (IS_ERR(phy)) {12361238 dev_err(&pdev->dev, "failed to create PHY\n");12371237- return PTR_ERR(phy);12391239+ ret = PTR_ERR(phy);12401240+ goto put_child;12381241 }1239124212401243 miphy_dev->phys[port]->phy = phy;···1245124212461243 ret = miphy28lp_of_probe(child, miphy_phy);12471244 if (ret)12481248- return ret;12451245+ goto put_child;1249124612501247 ret = miphy28lp_probe_resets(child, miphy_dev->phys[port]);12511248 if (ret)12521252- return ret;12491249+ goto put_child;1253125012541251 phy_set_drvdata(phy, miphy_dev->phys[port]);12551252 port++;···1258125512591256 provider = devm_of_phy_provider_register(&pdev->dev, miphy28lp_xlate);12601257 return PTR_ERR_OR_ZERO(provider);12581258+put_child:12591259+ of_node_put(child);12601260+ return ret;12611261}1262126212631263static const struct of_device_id miphy28lp_of_match[] = {
+11-5
drivers/phy/phy-miphy365x.c
···566566567567 miphy_phy = devm_kzalloc(&pdev->dev, sizeof(*miphy_phy),568568 GFP_KERNEL);569569- if (!miphy_phy)570570- return -ENOMEM;569569+ if (!miphy_phy) {570570+ ret = -ENOMEM;571571+ goto put_child;572572+ }571573572574 miphy_dev->phys[port] = miphy_phy;573575574576 phy = devm_phy_create(&pdev->dev, child, &miphy365x_ops);575577 if (IS_ERR(phy)) {576578 dev_err(&pdev->dev, "failed to create PHY\n");577577- return PTR_ERR(phy);579579+ ret = PTR_ERR(phy);580580+ goto put_child;578581 }579582580583 miphy_dev->phys[port]->phy = phy;581584582585 ret = miphy365x_of_probe(child, miphy_phy);583586 if (ret)584584- return ret;587587+ goto put_child;585588586589 phy_set_drvdata(phy, miphy_dev->phys[port]);587590···594591 &miphy_phy->ctrlreg);595592 if (ret) {596593 dev_err(&pdev->dev, "No sysconfig offset found\n");597597- return ret;594594+ goto put_child;598595 }599596 }600597601598 provider = devm_of_phy_provider_register(&pdev->dev, miphy365x_xlate);602599 return PTR_ERR_OR_ZERO(provider);600600+put_child:601601+ of_node_put(child);602602+ return ret;603603}604604605605static const struct of_device_id miphy365x_of_match[] = {
···5555 * ACPI).5656 * @ie_offset: Register offset of GPI_IE from @regs.5757 * @pin_base: Starting pin of pins in this community5858+ * @gpp_size: Maximum number of pads in each group, such as PADCFGLOCK,5959+ * HOSTSW_OWN, GPI_IS, GPI_IE, etc.5860 * @npins: Number of pins in this community5961 * @regs: Community specific common registers (reserved for core driver)6062 * @pad_regs: Community specific pad registers (reserved for core driver)···7068 unsigned hostown_offset;7169 unsigned ie_offset;7270 unsigned pin_base;7171+ unsigned gpp_size;7372 size_t npins;7473 void __iomem *regs;7574 void __iomem *pad_regs;
···5656 int irq;5757};58585959+/*6060+ * The Rockchip calendar used by the RK808 counts November with 31 days. We use6161+ * these translation functions to convert its dates to/from the Gregorian6262+ * calendar used by the rest of the world. We arbitrarily define Jan 1st, 20166363+ * as the day when both calendars were in sync, and treat all other dates6464+ * relative to that.6565+ * NOTE: Other system software (e.g. firmware) that reads the same hardware must6666+ * implement this exact same conversion algorithm, with the same anchor date.6767+ */6868+static time64_t nov2dec_transitions(struct rtc_time *tm)6969+{7070+ return (tm->tm_year + 1900) - 2016 + (tm->tm_mon + 1 > 11 ? 1 : 0);7171+}7272+7373+static void rockchip_to_gregorian(struct rtc_time *tm)7474+{7575+ /* If it's Nov 31st, rtc_tm_to_time64() will count that like Dec 1st */7676+ time64_t time = rtc_tm_to_time64(tm);7777+ rtc_time64_to_tm(time + nov2dec_transitions(tm) * 86400, tm);7878+}7979+8080+static void gregorian_to_rockchip(struct rtc_time *tm)8181+{8282+ time64_t extra_days = nov2dec_transitions(tm);8383+ time64_t time = rtc_tm_to_time64(tm);8484+ rtc_time64_to_tm(time - extra_days * 86400, tm);8585+8686+ /* Compensate if we went back over Nov 31st (will work up to 2381) */8787+ if (nov2dec_transitions(tm) < extra_days) {8888+ if (tm->tm_mon + 1 == 11)8989+ tm->tm_mday++; /* This may result in 31! */9090+ else9191+ rtc_time64_to_tm(time - (extra_days - 1) * 86400, tm);9292+ }9393+}9494+5995/* Read current time and date in RTC */6096static int rk808_rtc_readtime(struct device *dev, struct rtc_time *tm)6197{···137101 tm->tm_mon = (bcd2bin(rtc_data[4] & MONTHS_REG_MSK)) - 1;138102 tm->tm_year = (bcd2bin(rtc_data[5] & YEARS_REG_MSK)) + 100;139103 tm->tm_wday = bcd2bin(rtc_data[6] & WEEKS_REG_MSK);104104+ rockchip_to_gregorian(tm);140105 dev_dbg(dev, "RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n",141106 1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday,142142- tm->tm_wday, tm->tm_hour , tm->tm_min, tm->tm_sec);107107+ tm->tm_wday, tm->tm_hour, tm->tm_min, tm->tm_sec);143108144109 return ret;145110}···153116 u8 rtc_data[NUM_TIME_REGS];154117 int ret;155118119119+ dev_dbg(dev, "set RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n",120120+ 1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday,121121+ tm->tm_wday, tm->tm_hour, tm->tm_min, tm->tm_sec);122122+ gregorian_to_rockchip(tm);156123 rtc_data[0] = bin2bcd(tm->tm_sec);157124 rtc_data[1] = bin2bcd(tm->tm_min);158125 rtc_data[2] = bin2bcd(tm->tm_hour);···164123 rtc_data[4] = bin2bcd(tm->tm_mon + 1);165124 rtc_data[5] = bin2bcd(tm->tm_year - 100);166125 rtc_data[6] = bin2bcd(tm->tm_wday);167167- dev_dbg(dev, "set RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n",168168- 1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday,169169- tm->tm_wday, tm->tm_hour , tm->tm_min, tm->tm_sec);170126171127 /* Stop RTC while updating the RTC registers */172128 ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,···208170 alrm->time.tm_mday = bcd2bin(alrm_data[3] & DAYS_REG_MSK);209171 alrm->time.tm_mon = (bcd2bin(alrm_data[4] & MONTHS_REG_MSK)) - 1;210172 alrm->time.tm_year = (bcd2bin(alrm_data[5] & YEARS_REG_MSK)) + 100;173173+ rockchip_to_gregorian(&alrm->time);211174212175 ret = regmap_read(rk808->regmap, RK808_RTC_INT_REG, &int_reg);213176 if (ret) {···266227 alrm->time.tm_mday, alrm->time.tm_wday, alrm->time.tm_hour,267228 alrm->time.tm_min, alrm->time.tm_sec);268229230230+ gregorian_to_rockchip(&alrm->time);269231 alrm_data[0] = bin2bcd(alrm->time.tm_sec);270232 alrm_data[1] = bin2bcd(alrm->time.tm_min);271233 alrm_data[2] = bin2bcd(alrm->time.tm_hour);
+3-1
drivers/s390/crypto/ap_bus.c
···599599 status = ap_sm_recv(ap_dev);600600 switch (status.response_code) {601601 case AP_RESPONSE_NORMAL:602602- if (ap_dev->queue_count > 0)602602+ if (ap_dev->queue_count > 0) {603603+ ap_dev->state = AP_STATE_WORKING;603604 return AP_WAIT_AGAIN;605605+ }604606 ap_dev->state = AP_STATE_IDLE;605607 return AP_WAIT_NONE;606608 case AP_RESPONSE_NO_PENDING_REPLY:
+39-27
drivers/s390/virtio/virtio_ccw.c
···984984 return vq;985985}986986987987-static void virtio_ccw_int_handler(struct ccw_device *cdev,988988- unsigned long intparm,989989- struct irb *irb)987987+static void virtio_ccw_check_activity(struct virtio_ccw_device *vcdev,988988+ __u32 activity)990989{991991- __u32 activity = intparm & VIRTIO_CCW_INTPARM_MASK;992992- struct virtio_ccw_device *vcdev = dev_get_drvdata(&cdev->dev);993993- int i;994994- struct virtqueue *vq;995995-996996- if (!vcdev)997997- return;998998- /* Check if it's a notification from the host. */999999- if ((intparm == 0) &&10001000- (scsw_stctl(&irb->scsw) ==10011001- (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND))) {10021002- /* OK */10031003- }10041004- if (irb_is_error(irb)) {10051005- /* Command reject? */10061006- if ((scsw_dstat(&irb->scsw) & DEV_STAT_UNIT_CHECK) &&10071007- (irb->ecw[0] & SNS0_CMD_REJECT))10081008- vcdev->err = -EOPNOTSUPP;10091009- else10101010- /* Map everything else to -EIO. */10111011- vcdev->err = -EIO;10121012- }1013990 if (vcdev->curr_io & activity) {1014991 switch (activity) {1015992 case VIRTIO_CCW_DOING_READ_FEAT:···10061029 break;10071030 default:10081031 /* don't know what to do... */10091009- dev_warn(&cdev->dev, "Suspicious activity '%08x'\n",10101010- activity);10321032+ dev_warn(&vcdev->cdev->dev,10331033+ "Suspicious activity '%08x'\n", activity);10111034 WARN_ON(1);10121035 break;10131036 }10141037 }10381038+}10391039+10401040+static void virtio_ccw_int_handler(struct ccw_device *cdev,10411041+ unsigned long intparm,10421042+ struct irb *irb)10431043+{10441044+ __u32 activity = intparm & VIRTIO_CCW_INTPARM_MASK;10451045+ struct virtio_ccw_device *vcdev = dev_get_drvdata(&cdev->dev);10461046+ int i;10471047+ struct virtqueue *vq;10481048+10491049+ if (!vcdev)10501050+ return;10511051+ if (IS_ERR(irb)) {10521052+ vcdev->err = PTR_ERR(irb);10531053+ virtio_ccw_check_activity(vcdev, activity);10541054+ /* Don't poke around indicators, something's wrong. */10551055+ return;10561056+ }10571057+ /* Check if it's a notification from the host. */10581058+ if ((intparm == 0) &&10591059+ (scsw_stctl(&irb->scsw) ==10601060+ (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND))) {10611061+ /* OK */10621062+ }10631063+ if (irb_is_error(irb)) {10641064+ /* Command reject? */10651065+ if ((scsw_dstat(&irb->scsw) & DEV_STAT_UNIT_CHECK) &&10661066+ (irb->ecw[0] & SNS0_CMD_REJECT))10671067+ vcdev->err = -EOPNOTSUPP;10681068+ else10691069+ /* Map everything else to -EIO. */10701070+ vcdev->err = -EIO;10711071+ }10721072+ virtio_ccw_check_activity(vcdev, activity);10151073 for_each_set_bit(i, &vcdev->indicators,10161074 sizeof(vcdev->indicators) * BITS_PER_BYTE) {10171075 /* The bit clear must happen before the vring kick. */
+10-10
drivers/scsi/scsi_pm.c
···219219 struct scsi_device *sdev = to_scsi_device(dev);220220 int err = 0;221221222222- if (pm && pm->runtime_suspend) {223223- err = blk_pre_runtime_suspend(sdev->request_queue);224224- if (err)225225- return err;222222+ err = blk_pre_runtime_suspend(sdev->request_queue);223223+ if (err)224224+ return err;225225+ if (pm && pm->runtime_suspend)226226 err = pm->runtime_suspend(dev);227227- blk_post_runtime_suspend(sdev->request_queue, err);228228- }227227+ blk_post_runtime_suspend(sdev->request_queue, err);228228+229229 return err;230230}231231···248248 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;249249 int err = 0;250250251251- if (pm && pm->runtime_resume) {252252- blk_pre_runtime_resume(sdev->request_queue);251251+ blk_pre_runtime_resume(sdev->request_queue);252252+ if (pm && pm->runtime_resume)253253 err = pm->runtime_resume(dev);254254- blk_post_runtime_resume(sdev->request_queue, err);255255- }254254+ blk_post_runtime_resume(sdev->request_queue, err);255255+256256 return err;257257}258258
+28-2
drivers/scsi/ses.c
···8484static int ses_recv_diag(struct scsi_device *sdev, int page_code,8585 void *buf, int bufflen)8686{8787+ int ret;8788 unsigned char cmd[] = {8889 RECEIVE_DIAGNOSTIC,8990 1, /* Set PCV bit */···9392 bufflen & 0xff,9493 09594 };9595+ unsigned char recv_page_code;96969797- return scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen,9797+ ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen,9898 NULL, SES_TIMEOUT, SES_RETRIES, NULL);9999+ if (unlikely(!ret))100100+ return ret;101101+102102+ recv_page_code = ((unsigned char *)buf)[0];103103+104104+ if (likely(recv_page_code == page_code))105105+ return ret;106106+107107+ /* successful diagnostic but wrong page code. This happens to some108108+ * USB devices, just print a message and pretend there was an error */109109+110110+ sdev_printk(KERN_ERR, sdev,111111+ "Wrong diagnostic page; asked for %d got %u\n",112112+ page_code, recv_page_code);113113+114114+ return -EINVAL;99115}100116101117static int ses_send_diag(struct scsi_device *sdev, int page_code,···559541 if (desc_ptr)560542 desc_ptr += len;561543562562- if (addl_desc_ptr)544544+ if (addl_desc_ptr &&545545+ /* only find additional descriptions for specific devices */546546+ (type_ptr[0] == ENCLOSURE_COMPONENT_DEVICE ||547547+ type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE ||548548+ type_ptr[0] == ENCLOSURE_COMPONENT_SAS_EXPANDER ||549549+ /* these elements are optional */550550+ type_ptr[0] == ENCLOSURE_COMPONENT_SCSI_TARGET_PORT ||551551+ type_ptr[0] == ENCLOSURE_COMPONENT_SCSI_INITIATOR_PORT ||552552+ type_ptr[0] == ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS))563553 addl_desc_ptr += addl_desc_ptr[1] + 2;564554565555 }
···10351035 unsigned delay;1036103610371037 /* Continue a partial initialization */10381038- if (type == HUB_INIT2)10391039- goto init2;10401040- if (type == HUB_INIT3)10381038+ if (type == HUB_INIT2 || type == HUB_INIT3) {10391039+ device_lock(hub->intfdev);10401040+10411041+ /* Was the hub disconnected while we were waiting? */10421042+ if (hub->disconnected) {10431043+ device_unlock(hub->intfdev);10441044+ kref_put(&hub->kref, hub_release);10451045+ return;10461046+ }10471047+ if (type == HUB_INIT2)10481048+ goto init2;10411049 goto init3;10501050+ }10511051+ kref_get(&hub->kref);1042105210431053 /* The superspeed hub except for root hub has to use Hub Depth10441054 * value as an offset into the route string to locate the bits···12461236 queue_delayed_work(system_power_efficient_wq,12471237 &hub->init_work,12481238 msecs_to_jiffies(delay));12391239+ device_unlock(hub->intfdev);12491240 return; /* Continues at init3: below */12501241 } else {12511242 msleep(delay);···12681257 /* Allow autosuspend if it was suppressed */12691258 if (type <= HUB_INIT3)12701259 usb_autopm_put_interface_async(to_usb_interface(hub->intfdev));12601260+12611261+ if (type == HUB_INIT2 || type == HUB_INIT3)12621262+ device_unlock(hub->intfdev);12631263+12641264+ kref_put(&hub->kref, hub_release);12711265}1272126612731267/* Implement the continuations for the delays above */
+2-1
drivers/usb/serial/ipaq.c
···531531 * through. Since this has a reasonably high failure rate, we retry532532 * several times.533533 */534534- while (retries--) {534534+ while (retries) {535535+ retries--;535536 result = usb_control_msg(serial->dev,536537 usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,537538 0x1, 0, NULL, 0, 100);
+18-5
drivers/xen/events/events_fifo.c
···281281282282static void consume_one_event(unsigned cpu,283283 struct evtchn_fifo_control_block *control_block,284284- unsigned priority, unsigned long *ready)284284+ unsigned priority, unsigned long *ready,285285+ bool drop)285286{286287 struct evtchn_fifo_queue *q = &per_cpu(cpu_queue, cpu);287288 uint32_t head;···314313 if (head == 0)315314 clear_bit(priority, ready);316315317317- if (evtchn_fifo_is_pending(port) && !evtchn_fifo_is_masked(port))318318- handle_irq_for_port(port);316316+ if (evtchn_fifo_is_pending(port) && !evtchn_fifo_is_masked(port)) {317317+ if (unlikely(drop))318318+ pr_warn("Dropping pending event for port %u\n", port);319319+ else320320+ handle_irq_for_port(port);321321+ }319322320323 q->head[priority] = head;321324}322325323323-static void evtchn_fifo_handle_events(unsigned cpu)326326+static void __evtchn_fifo_handle_events(unsigned cpu, bool drop)324327{325328 struct evtchn_fifo_control_block *control_block;326329 unsigned long ready;···336331337332 while (ready) {338333 q = find_first_bit(&ready, EVTCHN_FIFO_MAX_QUEUES);339339- consume_one_event(cpu, control_block, q, &ready);334334+ consume_one_event(cpu, control_block, q, &ready, drop);340335 ready |= xchg(&control_block->ready, 0);341336 }337337+}338338+339339+static void evtchn_fifo_handle_events(unsigned cpu)340340+{341341+ __evtchn_fifo_handle_events(cpu, false);342342}343343344344static void evtchn_fifo_resume(void)···429419 case CPU_UP_PREPARE:430420 if (!per_cpu(cpu_control_block, cpu))431421 ret = evtchn_fifo_alloc_control_block(cpu);422422+ break;423423+ case CPU_DEAD:424424+ __evtchn_fifo_handle_events(cpu, true);432425 break;433426 default:434427 break;
···1048010480 * until transaction commit to do the actual discard.1048110481 */1048210482 if (trimming) {1048310483- WARN_ON(!list_empty(&block_group->bg_list));1048410484- spin_lock(&trans->transaction->deleted_bgs_lock);1048310483+ spin_lock(&fs_info->unused_bgs_lock);1048410484+ /*1048510485+ * A concurrent scrub might have added us to the list1048610486+ * fs_info->unused_bgs, so use a list_move operation1048710487+ * to add the block group to the deleted_bgs list.1048810488+ */1048510489 list_move(&block_group->bg_list,1048610490 &trans->transaction->deleted_bgs);1048710487- spin_unlock(&trans->transaction->deleted_bgs_lock);1049110491+ spin_unlock(&fs_info->unused_bgs_lock);1048810492 btrfs_get_block_group(block_group);1048910493 }1049010494end_trans:
+14-4
fs/btrfs/file.c
···12911291 * on error we return an unlocked page and the error value12921292 * on success we return a locked page and 012931293 */12941294-static int prepare_uptodate_page(struct page *page, u64 pos,12941294+static int prepare_uptodate_page(struct inode *inode,12951295+ struct page *page, u64 pos,12951296 bool force_uptodate)12961297{12971298 int ret = 0;···13061305 if (!PageUptodate(page)) {13071306 unlock_page(page);13081307 return -EIO;13081308+ }13091309+ if (page->mapping != inode->i_mapping) {13101310+ unlock_page(page);13111311+ return -EAGAIN;13091312 }13101313 }13111314 return 0;···13291324 int faili;1330132513311326 for (i = 0; i < num_pages; i++) {13271327+again:13321328 pages[i] = find_or_create_page(inode->i_mapping, index + i,13331329 mask | __GFP_WRITE);13341330 if (!pages[i]) {···13391333 }1340133413411335 if (i == 0)13421342- err = prepare_uptodate_page(pages[i], pos,13361336+ err = prepare_uptodate_page(inode, pages[i], pos,13431337 force_uptodate);13441344- if (i == num_pages - 1)13451345- err = prepare_uptodate_page(pages[i],13381338+ if (!err && i == num_pages - 1)13391339+ err = prepare_uptodate_page(inode, pages[i],13461340 pos + write_bytes, false);13471341 if (err) {13481342 page_cache_release(pages[i]);13431343+ if (err == -EAGAIN) {13441344+ err = 0;13451345+ goto again;13461346+ }13491347 faili = i - 1;13501348 goto fail;13511349 }
+6-4
fs/btrfs/free-space-cache.c
···891891 spin_unlock(&block_group->lock);892892 ret = 0;893893894894- btrfs_warn(fs_info, "failed to load free space cache for block group %llu, rebuild it now",894894+ btrfs_warn(fs_info, "failed to load free space cache for block group %llu, rebuilding it now",895895 block_group->key.objectid);896896 }897897···29722972 u64 cont1_bytes, u64 min_bytes)29732973{29742974 struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl;29752975- struct btrfs_free_space *entry;29752975+ struct btrfs_free_space *entry = NULL;29762976 int ret = -ENOSPC;29772977 u64 bitmap_offset = offset_to_bitmap(ctl, offset);29782978···29832983 * The bitmap that covers offset won't be in the list unless offset29842984 * is just its start offset.29852985 */29862986- entry = list_first_entry(bitmaps, struct btrfs_free_space, list);29872987- if (entry->offset != bitmap_offset) {29862986+ if (!list_empty(bitmaps))29872987+ entry = list_first_entry(bitmaps, struct btrfs_free_space, list);29882988+29892989+ if (!entry || entry->offset != bitmap_offset) {29882990 entry = tree_search_offset(ctl, bitmap_offset, 1, 0);29892991 if (entry && list_empty(&entry->list))29902992 list_add(&entry->list, bitmaps);
···2929/* A few generic types ... taken from ses-2 */3030enum enclosure_component_type {3131 ENCLOSURE_COMPONENT_DEVICE = 0x01,3232+ ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS = 0x07,3333+ ENCLOSURE_COMPONENT_SCSI_TARGET_PORT = 0x14,3434+ ENCLOSURE_COMPONENT_SCSI_INITIATOR_PORT = 0x15,3235 ENCLOSURE_COMPONENT_ARRAY_DEVICE = 0x17,3636+ ENCLOSURE_COMPONENT_SAS_EXPANDER = 0x18,3337};34383539/* ses-2 common element status */
···176176#define sub_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, -(__d))177177178178#ifdef CONFIG_SMP179179-void __mod_zone_page_state(struct zone *, enum zone_stat_item item, int);179179+void __mod_zone_page_state(struct zone *, enum zone_stat_item item, long);180180void __inc_zone_page_state(struct page *, enum zone_stat_item);181181void __dec_zone_page_state(struct page *, enum zone_stat_item);182182183183-void mod_zone_page_state(struct zone *, enum zone_stat_item, int);183183+void mod_zone_page_state(struct zone *, enum zone_stat_item, long);184184void inc_zone_page_state(struct page *, enum zone_stat_item);185185void dec_zone_page_state(struct page *, enum zone_stat_item);186186···205205 * The functions directly modify the zone and global counters.206206 */207207static inline void __mod_zone_page_state(struct zone *zone,208208- enum zone_stat_item item, int delta)208208+ enum zone_stat_item item, long delta)209209{210210 zone_page_state_add(delta, zone, item);211211}
+14
include/xen/interface/io/ring.h
···181181#define RING_GET_REQUEST(_r, _idx) \182182 (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].req))183183184184+/*185185+ * Get a local copy of a request.186186+ *187187+ * Use this in preference to RING_GET_REQUEST() so all processing is188188+ * done on a local copy that cannot be modified by the other end.189189+ *190190+ * Note that https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145 may cause this191191+ * to be ineffective where _req is a struct which consists of only bitfields.192192+ */193193+#define RING_COPY_REQUEST(_r, _idx, _req) do { \194194+ /* Use volatile to force the copy into _req. */ \195195+ *(_req) = *(volatile typeof(_req))RING_GET_REQUEST(_r, _idx); \196196+} while (0)197197+184198#define RING_GET_RESPONSE(_r, _idx) \185199 (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].rsp))186200
···903903 if (prev && reclaim->generation != iter->generation)904904 goto out_unlock;905905906906- do {906906+ while (1) {907907 pos = READ_ONCE(iter->position);908908+ if (!pos || css_tryget(&pos->css))909909+ break;908910 /*909909- * A racing update may change the position and910910- * put the last reference, hence css_tryget(),911911- * or retry to see the updated position.911911+ * css reference reached zero, so iter->position will912912+ * be cleared by ->css_released. However, we should not913913+ * rely on this happening soon, because ->css_released914914+ * is called from a work queue, and by busy-waiting we915915+ * might block it. So we clear iter->position right916916+ * away.912917 */913913- } while (pos && !css_tryget(&pos->css));918918+ (void)cmpxchg(&iter->position, pos, NULL);919919+ }914920 }915921916922 if (pos)···962956 }963957964958 if (reclaim) {965965- if (cmpxchg(&iter->position, pos, memcg) == pos) {966966- if (memcg)967967- css_get(&memcg->css);968968- if (pos)969969- css_put(&pos->css);970970- }971971-972959 /*973973- * pairs with css_tryget when dereferencing iter->position974974- * above.960960+ * The position could have already been updated by a competing961961+ * thread, so check that the value hasn't changed since we read962962+ * it to avoid reclaiming from the same cgroup twice.975963 */964964+ (void)cmpxchg(&iter->position, pos, memcg);965965+976966 if (pos)977967 css_put(&pos->css);978968···999997 root = root_mem_cgroup;1000998 if (prev && prev != root)1001999 css_put(&prev->css);10001000+}10011001+10021002+static void invalidate_reclaim_iterators(struct mem_cgroup *dead_memcg)10031003+{10041004+ struct mem_cgroup *memcg = dead_memcg;10051005+ struct mem_cgroup_reclaim_iter *iter;10061006+ struct mem_cgroup_per_zone *mz;10071007+ int nid, zid;10081008+ int i;10091009+10101010+ while ((memcg = parent_mem_cgroup(memcg))) {10111011+ for_each_node(nid) {10121012+ for (zid = 0; zid < MAX_NR_ZONES; zid++) {10131013+ mz = &memcg->nodeinfo[nid]->zoneinfo[zid];10141014+ for (i = 0; i <= DEF_PRIORITY; i++) {10151015+ iter = &mz->iter[i];10161016+ cmpxchg(&iter->position,10171017+ dead_memcg, NULL);10181018+ }10191019+ }10201020+ }10211021+ }10021022}1003102310041024/*···43484324 wb_memcg_offline(memcg);43494325}4350432643274327+static void mem_cgroup_css_released(struct cgroup_subsys_state *css)43284328+{43294329+ struct mem_cgroup *memcg = mem_cgroup_from_css(css);43304330+43314331+ invalidate_reclaim_iterators(memcg);43324332+}43334333+43514334static void mem_cgroup_css_free(struct cgroup_subsys_state *css)43524335{43534336 struct mem_cgroup *memcg = mem_cgroup_from_css(css);···52165185 .css_alloc = mem_cgroup_css_alloc,52175186 .css_online = mem_cgroup_css_online,52185187 .css_offline = mem_cgroup_css_offline,51885188+ .css_released = mem_cgroup_css_released,52195189 .css_free = mem_cgroup_css_free,52205190 .css_reset = mem_cgroup_css_reset,52215191 .can_attach = mem_cgroup_can_attach,
+19-12
mm/memory_hotplug.c
···13751375 */13761376int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn)13771377{13781378- unsigned long pfn;13781378+ unsigned long pfn, sec_end_pfn;13791379 struct zone *zone = NULL;13801380 struct page *page;13811381 int i;13821382- for (pfn = start_pfn;13821382+ for (pfn = start_pfn, sec_end_pfn = SECTION_ALIGN_UP(start_pfn);13831383 pfn < end_pfn;13841384- pfn += MAX_ORDER_NR_PAGES) {13851385- i = 0;13861386- /* This is just a CONFIG_HOLES_IN_ZONE check.*/13871387- while ((i < MAX_ORDER_NR_PAGES) && !pfn_valid_within(pfn + i))13881388- i++;13891389- if (i == MAX_ORDER_NR_PAGES)13841384+ pfn = sec_end_pfn + 1, sec_end_pfn += PAGES_PER_SECTION) {13851385+ /* Make sure the memory section is present first */13861386+ if (!present_section_nr(pfn_to_section_nr(pfn)))13901387 continue;13911391- page = pfn_to_page(pfn + i);13921392- if (zone && page_zone(page) != zone)13931393- return 0;13941394- zone = page_zone(page);13881388+ for (; pfn < sec_end_pfn && pfn < end_pfn;13891389+ pfn += MAX_ORDER_NR_PAGES) {13901390+ i = 0;13911391+ /* This is just a CONFIG_HOLES_IN_ZONE check.*/13921392+ while ((i < MAX_ORDER_NR_PAGES) &&13931393+ !pfn_valid_within(pfn + i))13941394+ i++;13951395+ if (i == MAX_ORDER_NR_PAGES)13961396+ continue;13971397+ page = pfn_to_page(pfn + i);13981398+ if (zone && page_zone(page) != zone)13991399+ return 0;14001400+ zone = page_zone(page);14011401+ }13951402 }13961403 return 1;13971404}
+5-5
mm/vmstat.c
···219219 * particular counter cannot be updated from interrupt context.220220 */221221void __mod_zone_page_state(struct zone *zone, enum zone_stat_item item,222222- int delta)222222+ long delta)223223{224224 struct per_cpu_pageset __percpu *pcp = zone->pageset;225225 s8 __percpu *p = pcp->vm_stat_diff + item;···318318 * 1 Overstepping half of threshold319319 * -1 Overstepping minus half of threshold320320*/321321-static inline void mod_state(struct zone *zone,322322- enum zone_stat_item item, int delta, int overstep_mode)321321+static inline void mod_state(struct zone *zone, enum zone_stat_item item,322322+ long delta, int overstep_mode)323323{324324 struct per_cpu_pageset __percpu *pcp = zone->pageset;325325 s8 __percpu *p = pcp->vm_stat_diff + item;···357357}358358359359void mod_zone_page_state(struct zone *zone, enum zone_stat_item item,360360- int delta)360360+ long delta)361361{362362 mod_state(zone, item, delta, 0);363363}···384384 * Use interrupt disable to serialize counter updates385385 */386386void mod_zone_page_state(struct zone *zone, enum zone_stat_item item,387387- int delta)387387+ long delta)388388{389389 unsigned long flags;390390
+3-3
mm/zswap.c
···541541 return last;542542}543543544544+/* type and compressor must be null-terminated */544545static struct zswap_pool *zswap_pool_find_get(char *type, char *compressor)545546{546547 struct zswap_pool *pool;···549548 assert_spin_locked(&zswap_pools_lock);550549551550 list_for_each_entry_rcu(pool, &zswap_pools, list) {552552- if (strncmp(pool->tfm_name, compressor, sizeof(pool->tfm_name)))551551+ if (strcmp(pool->tfm_name, compressor))553552 continue;554554- if (strncmp(zpool_get_type(pool->zpool), type,555555- sizeof(zswap_zpool_type)))553553+ if (strcmp(zpool_get_type(pool->zpool), type))556554 continue;557555 /* if we can't get it, it's about to be destroyed */558556 if (!zswap_pool_get(pool))
···366366 goto nla_put_failure;367367368368 switch (priv->key) {369369+ case NFT_CT_L3PROTOCOL:369370 case NFT_CT_PROTOCOL:370371 case NFT_CT_SRC:371372 case NFT_CT_DST:
+4-2
net/openvswitch/conntrack.c
···683683 OVS_NLERR(log, "Failed to allocate conntrack template");684684 return -ENOMEM;685685 }686686+687687+ __set_bit(IPS_CONFIRMED_BIT, &ct_info.ct->status);688688+ nf_conntrack_get(&ct_info.ct->ct_general);689689+686690 if (helper) {687691 err = ovs_ct_add_helper(&ct_info, helper, key, log);688692 if (err)···698694 if (err)699695 goto err_free_ct;700696701701- __set_bit(IPS_CONFIRMED_BIT, &ct_info.ct->status);702702- nf_conntrack_get(&ct_info.ct->ct_general);703697 return 0;704698err_free_ct:705699 __ovs_ct_free_action(&ct_info);
···4829482948304830 retval = SCTP_DISPOSITION_CONSUME;4831483148324832- sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));48324832+ if (abort)48334833+ sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));4833483448344835 /* Even if we can't send the ABORT due to low memory delete the48354836 * TCB. This is a departure from our typical NOMEM handling.···49674966 SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT));49684967 retval = SCTP_DISPOSITION_CONSUME;4969496849704970- sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));49694969+ if (abort)49704970+ sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));4971497149724972 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,49734973 SCTP_STATE(SCTP_STATE_CLOSED));
+9-5
net/sctp/socket.c
···13011301 int addrs_size,13021302 sctp_assoc_t *assoc_id)13031303{13041304- int err = 0;13051304 struct sockaddr *kaddrs;13051305+ gfp_t gfp = GFP_KERNEL;13061306+ int err = 0;1306130713071308 pr_debug("%s: sk:%p addrs:%p addrs_size:%d\n",13081309 __func__, sk, addrs, addrs_size);···13161315 return -EFAULT;1317131613181317 /* Alloc space for the address array in kernel memory. */13191319- kaddrs = kmalloc(addrs_size, GFP_KERNEL);13181318+ if (sk->sk_socket->file)13191319+ gfp = GFP_USER | __GFP_NOWARN;13201320+ kaddrs = kmalloc(addrs_size, gfp);13201321 if (unlikely(!kaddrs))13211322 return -ENOMEM;13221323···15161513 struct sctp_chunk *chunk;1517151415181515 chunk = sctp_make_abort_user(asoc, NULL, 0);15191519- if (chunk)15201520- sctp_primitive_ABORT(net, asoc, chunk);15161516+ sctp_primitive_ABORT(net, asoc, chunk);15211517 } else15221518 sctp_primitive_SHUTDOWN(net, asoc, NULL);15231519 }···5775577357765774 len = sizeof(struct sctp_assoc_ids) + sizeof(sctp_assoc_t) * num;5777577557785778- ids = kmalloc(len, GFP_KERNEL);57765776+ ids = kmalloc(len, GFP_USER | __GFP_NOWARN);57795777 if (unlikely(!ids))57805778 return -ENOMEM;57815779···7201719972027200 if (newsk->sk_flags & SK_FLAGS_TIMESTAMP)72037201 net_enable_timestamp();72027202+72037203+ security_sk_clone(sk, newsk);72047204}7205720572067206static inline void sctp_copy_descendant(struct sock *sk_to,
···2826282628272827int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)28282828{28292829- struct net *net;28302829 int err = 0;28312830 if (unlikely(afinfo == NULL))28322831 return -EINVAL;···28552856 rcu_assign_pointer(xfrm_policy_afinfo[afinfo->family], afinfo);28562857 }28572858 spin_unlock(&xfrm_policy_afinfo_lock);28582858-28592859- rtnl_lock();28602860- for_each_net(net) {28612861- struct dst_ops *xfrm_dst_ops;28622862-28632863- switch (afinfo->family) {28642864- case AF_INET:28652865- xfrm_dst_ops = &net->xfrm.xfrm4_dst_ops;28662866- break;28672867-#if IS_ENABLED(CONFIG_IPV6)28682868- case AF_INET6:28692869- xfrm_dst_ops = &net->xfrm.xfrm6_dst_ops;28702870- break;28712871-#endif28722872- default:28732873- BUG();28742874- }28752875- *xfrm_dst_ops = *afinfo->dst_ops;28762876- }28772877- rtnl_unlock();2878285928792860 return err;28802861}···28902911 return err;28912912}28922913EXPORT_SYMBOL(xfrm_policy_unregister_afinfo);28932893-28942894-static void __net_init xfrm_dst_ops_init(struct net *net)28952895-{28962896- struct xfrm_policy_afinfo *afinfo;28972897-28982898- rcu_read_lock();28992899- afinfo = rcu_dereference(xfrm_policy_afinfo[AF_INET]);29002900- if (afinfo)29012901- net->xfrm.xfrm4_dst_ops = *afinfo->dst_ops;29022902-#if IS_ENABLED(CONFIG_IPV6)29032903- afinfo = rcu_dereference(xfrm_policy_afinfo[AF_INET6]);29042904- if (afinfo)29052905- net->xfrm.xfrm6_dst_ops = *afinfo->dst_ops;29062906-#endif29072907- rcu_read_unlock();29082908-}2909291429102915static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void *ptr)29112916{···30393076 rv = xfrm_policy_init(net);30403077 if (rv < 0)30413078 goto out_policy;30423042- xfrm_dst_ops_init(net);30433079 rv = xfrm_sysctl_init(net);30443080 if (rv < 0)30453081 goto out_sysctl;
+113-24
scripts/recordmcount.c
···48484949static int fd_map; /* File descriptor for file being modified. */5050static int mmap_failed; /* Boolean flag. */5151-static void *ehdr_curr; /* current ElfXX_Ehdr * for resource cleanup */5251static char gpfx; /* prefix for global symbol name (sometimes '_') */5352static struct stat sb; /* Remember .st_size, etc. */5453static jmp_buf jmpenv; /* setjmp/longjmp per-file error escape */5554static const char *altmcount; /* alternate mcount symbol name */5655static int warn_on_notrace_sect; /* warn when section has mcount not being recorded */5656+static void *file_map; /* pointer of the mapped file */5757+static void *file_end; /* pointer to the end of the mapped file */5858+static int file_updated; /* flag to state file was changed */5959+static void *file_ptr; /* current file pointer location */6060+static void *file_append; /* added to the end of the file */6161+static size_t file_append_size; /* how much is added to end of file */57625863/* setjmp() return values */5964enum {···7267cleanup(void)7368{7469 if (!mmap_failed)7575- munmap(ehdr_curr, sb.st_size);7070+ munmap(file_map, sb.st_size);7671 else7777- free(ehdr_curr);7878- close(fd_map);7272+ free(file_map);7373+ file_map = NULL;7474+ free(file_append);7575+ file_append = NULL;7676+ file_append_size = 0;7777+ file_updated = 0;7978}80798180static void __attribute__((noreturn))···10192static off_t10293ulseek(int const fd, off_t const offset, int const whence)10394{104104- off_t const w = lseek(fd, offset, whence);105105- if (w == (off_t)-1) {106106- perror("lseek");9595+ switch (whence) {9696+ case SEEK_SET:9797+ file_ptr = file_map + offset;9898+ break;9999+ case SEEK_CUR:100100+ file_ptr += offset;101101+ break;102102+ case SEEK_END:103103+ file_ptr = file_map + (sb.st_size - offset);104104+ break;105105+ }106106+ if (file_ptr < file_map) {107107+ fprintf(stderr, "lseek: seek before file\n");107108 fail_file();108109 }109109- return w;110110+ return file_ptr - file_map;110111}111112112113static size_t···133114static size_t134115uwrite(int const fd, void const *const buf, size_t const count)135116{136136- size_t const n = write(fd, buf, count);137137- if (n != count) {138138- perror("write");139139- fail_file();117117+ size_t cnt = count;118118+ off_t idx = 0;119119+120120+ file_updated = 1;121121+122122+ if (file_ptr + count >= file_end) {123123+ off_t aoffset = (file_ptr + count) - file_end;124124+125125+ if (aoffset > file_append_size) {126126+ file_append = realloc(file_append, aoffset);127127+ file_append_size = aoffset;128128+ }129129+ if (!file_append) {130130+ perror("write");131131+ fail_file();132132+ }133133+ if (file_ptr < file_end) {134134+ cnt = file_end - file_ptr;135135+ } else {136136+ cnt = 0;137137+ idx = aoffset - count;138138+ }140139 }141141- return n;140140+141141+ if (cnt)142142+ memcpy(file_ptr, buf, cnt);143143+144144+ if (cnt < count)145145+ memcpy(file_append + idx, buf + cnt, count - cnt);146146+147147+ file_ptr += count;148148+ return count;142149}143150144151static void *···237192 */238193static void *mmap_file(char const *fname)239194{240240- void *addr;241241-242242- fd_map = open(fname, O_RDWR);195195+ fd_map = open(fname, O_RDONLY);243196 if (fd_map < 0 || fstat(fd_map, &sb) < 0) {244197 perror(fname);245198 fail_file();···246203 fprintf(stderr, "not a regular file: %s\n", fname);247204 fail_file();248205 }249249- addr = mmap(0, sb.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE,250250- fd_map, 0);206206+ file_map = mmap(0, sb.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE,207207+ fd_map, 0);251208 mmap_failed = 0;252252- if (addr == MAP_FAILED) {209209+ if (file_map == MAP_FAILED) {253210 mmap_failed = 1;254254- addr = umalloc(sb.st_size);255255- uread(fd_map, addr, sb.st_size);211211+ file_map = umalloc(sb.st_size);212212+ uread(fd_map, file_map, sb.st_size);256213 }257257- return addr;214214+ close(fd_map);215215+216216+ file_end = file_map + sb.st_size;217217+218218+ return file_map;219219+}220220+221221+static void write_file(const char *fname)222222+{223223+ char tmp_file[strlen(fname) + 4];224224+ size_t n;225225+226226+ if (!file_updated)227227+ return;228228+229229+ sprintf(tmp_file, "%s.rc", fname);230230+231231+ /*232232+ * After reading the entire file into memory, delete it233233+ * and write it back, to prevent weird side effects of modifying234234+ * an object file in place.235235+ */236236+ fd_map = open(tmp_file, O_WRONLY | O_TRUNC | O_CREAT, sb.st_mode);237237+ if (fd_map < 0) {238238+ perror(fname);239239+ fail_file();240240+ }241241+ n = write(fd_map, file_map, sb.st_size);242242+ if (n != sb.st_size) {243243+ perror("write");244244+ fail_file();245245+ }246246+ if (file_append_size) {247247+ n = write(fd_map, file_append, file_append_size);248248+ if (n != file_append_size) {249249+ perror("write");250250+ fail_file();251251+ }252252+ }253253+ close(fd_map);254254+ if (rename(tmp_file, fname) < 0) {255255+ perror(fname);256256+ fail_file();257257+ }258258}259259260260/* w8rev, w8nat, ...: Handle endianness. */···404318 Elf32_Ehdr *const ehdr = mmap_file(fname);405319 unsigned int reltype = 0;406320407407- ehdr_curr = ehdr;408321 w = w4nat;409322 w2 = w2nat;410323 w8 = w8nat;···526441 }527442 } /* end switch */528443444444+ write_file(fname);529445 cleanup();530446}531447···579493 case SJ_SETJMP: /* normal sequence */580494 /* Avoid problems if early cleanup() */581495 fd_map = -1;582582- ehdr_curr = NULL;583496 mmap_failed = 1;497497+ file_map = NULL;498498+ file_ptr = NULL;499499+ file_updated = 0;584500 do_file(file);585501 break;586502 case SJ_FAIL: /* error in do_file or below */503503+ sprintf("%s: failed\n", file);587504 ++n_error;588505 break;589506 case SJ_SUCCEED: /* premature success */
+9-9
security/keys/keyctl.c
···751751752752 /* the key is probably readable - now try to read it */753753can_read_key:754754- ret = key_validate(key);755755- if (ret == 0) {756756- ret = -EOPNOTSUPP;757757- if (key->type->read) {758758- /* read the data with the semaphore held (since we759759- * might sleep) */760760- down_read(&key->sem);754754+ ret = -EOPNOTSUPP;755755+ if (key->type->read) {756756+ /* Read the data with the semaphore held (since we might sleep)757757+ * to protect against the key being updated or revoked.758758+ */759759+ down_read(&key->sem);760760+ ret = key_validate(key);761761+ if (ret == 0)761762 ret = key->type->read(key, buffer, buflen);762762- up_read(&key->sem);763763- }763763+ up_read(&key->sem);764764 }765765766766error2:
+34
sound/pci/hda/hda_intel.c
···954954}955955#endif /* CONFIG_PM_SLEEP || SUPPORT_VGA_SWITCHEROO */956956957957+#ifdef CONFIG_PM_SLEEP958958+/* put codec down to D3 at hibernation for Intel SKL+;959959+ * otherwise BIOS may still access the codec and screw up the driver960960+ */961961+#define IS_SKL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa170)962962+#define IS_SKL_LP(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9d70)963963+#define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)964964+#define IS_SKL_PLUS(pci) (IS_SKL(pci) || IS_SKL_LP(pci) || IS_BXT(pci))965965+966966+static int azx_freeze_noirq(struct device *dev)967967+{968968+ struct pci_dev *pci = to_pci_dev(dev);969969+970970+ if (IS_SKL_PLUS(pci))971971+ pci_set_power_state(pci, PCI_D3hot);972972+973973+ return 0;974974+}975975+976976+static int azx_thaw_noirq(struct device *dev)977977+{978978+ struct pci_dev *pci = to_pci_dev(dev);979979+980980+ if (IS_SKL_PLUS(pci))981981+ pci_set_power_state(pci, PCI_D0);982982+983983+ return 0;984984+}985985+#endif /* CONFIG_PM_SLEEP */986986+957987#ifdef CONFIG_PM958988static int azx_runtime_suspend(struct device *dev)959989{···1093106310941064static const struct dev_pm_ops azx_pm = {10951065 SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume)10661066+#ifdef CONFIG_PM_SLEEP10671067+ .freeze_noirq = azx_freeze_noirq,10681068+ .thaw_noirq = azx_thaw_noirq,10691069+#endif10961070 SET_RUNTIME_PM_OPS(azx_runtime_suspend, azx_runtime_resume, azx_runtime_idle)10971071};10981072
···223223224224 /* wait for XDATA to be cleared */225225 cnt = 0;226226- while (!(mcasp_get_reg(mcasp, DAVINCI_MCASP_TXSTAT_REG) &227227- ~XRDATA) && (cnt < 100000))226226+ while ((mcasp_get_reg(mcasp, DAVINCI_MCASP_TXSTAT_REG) & XRDATA) &&227227+ (cnt < 100000))228228 cnt++;229229230230 /* Release TX state machine */
+18
sound/soc/fsl/fsl_sai.c
···505505 FSL_SAI_CSR_FR, FSL_SAI_CSR_FR);506506 regmap_update_bits(sai->regmap, FSL_SAI_RCSR,507507 FSL_SAI_CSR_FR, FSL_SAI_CSR_FR);508508+509509+ /*510510+ * For sai master mode, after several open/close sai,511511+ * there will be no frame clock, and can't recover512512+ * anymore. Add software reset to fix this issue.513513+ * This is a hardware bug, and will be fix in the514514+ * next sai version.515515+ */516516+ if (!sai->is_slave_mode) {517517+ /* Software Reset for both Tx and Rx */518518+ regmap_write(sai->regmap,519519+ FSL_SAI_TCSR, FSL_SAI_CSR_SR);520520+ regmap_write(sai->regmap,521521+ FSL_SAI_RCSR, FSL_SAI_CSR_SR);522522+ /* Clear SR bit to finish the reset */523523+ regmap_write(sai->regmap, FSL_SAI_TCSR, 0);524524+ regmap_write(sai->regmap, FSL_SAI_RCSR, 0);525525+ }508526 }509527 break;510528 default:
+4-2
sound/soc/rockchip/rockchip_spdif.c
···152152 case SNDRV_PCM_TRIGGER_RESUME:153153 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:154154 ret = regmap_update_bits(spdif->regmap, SPDIF_DMACR,155155- SPDIF_DMACR_TDE_ENABLE,156156- SPDIF_DMACR_TDE_ENABLE);155155+ SPDIF_DMACR_TDE_ENABLE |156156+ SPDIF_DMACR_TDL_MASK,157157+ SPDIF_DMACR_TDE_ENABLE |158158+ SPDIF_DMACR_TDL(16));157159158160 if (ret != 0)159161 return ret;
···13541354 }13551355 }1356135613571357+ snd_usb_mixer_fu_apply_quirk(state->mixer, cval, unitid, kctl);13581358+13571359 range = (cval->max - cval->min) / cval->res;13581360 /*13591361 * Are there devices with volume range more than 255? I use a bit more