···11+* EETI eGalax Multiple Touch Controller22+33+Required properties:44+- compatible: must be "eeti,egalax_ts"55+- reg: i2c slave address66+- interrupt-parent: the phandle for the interrupt controller77+- interrupts: touch controller interrupt88+- wakeup-gpios: the gpio pin to be used for waking up the controller99+ as well as uased as irq pin1010+1111+Example:1212+1313+ egalax_ts@04 {1414+ compatible = "eeti,egalax_ts";1515+ reg = <0x04>;1616+ interrupt-parent = <&gpio1>;1717+ interrupts = <9 2>;1818+ wakeup-gpios = <&gpio1 9 0>;1919+ };
+1-1
Documentation/hwmon/fam15h_power
···1010 BIOS and Kernel Developer's Guide (BKDG) For AMD Family 15h Processors1111 (not yet published)12121313-Author: Andreas Herrmann <andreas.herrmann3@amd.com>1313+Author: Andreas Herrmann <herrmann.der.user@googlemail.com>14141515Description1616-----------
+3-2
MAINTAINERS
···503503F: include/linux/altera_jtaguart.h504504505505AMD FAM15H PROCESSOR POWER MONITORING DRIVER506506-M: Andreas Herrmann <andreas.herrmann3@amd.com>506506+M: Andreas Herrmann <herrmann.der.user@googlemail.com>507507L: lm-sensors@lm-sensors.org508508S: Maintained509509F: Documentation/hwmon/fam15h_power···25072507M: Seung-Woo Kim <sw0312.kim@samsung.com>25082508M: Kyungmin Park <kyungmin.park@samsung.com>25092509L: dri-devel@lists.freedesktop.org25102510+T: git git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git25102511S: Supported25112512F: drivers/gpu/drm/exynos25122513F: include/drm/exynos*···56485647F: drivers/pinctrl/spear/5649564856505649PKTCDVD DRIVER56515651-M: Peter Osterlund <petero2@telia.com>56505650+M: Jiri Kosina <jkosina@suse.cz>56525651S: Maintained56535652F: drivers/block/pktcdvd.c56545653F: include/linux/pktcdvd.h
···10101111extern void sched_clock_postinit(void);1212extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);1313-extern void setup_sched_clock_needs_suspend(u32 (*read)(void), int bits,1414- unsigned long rate);15131614#endif
+6-6
arch/arm/include/asm/vfpmacros.h
···2727#if __LINUX_ARM_ARCH__ <= 62828 ldr \tmp, =elf_hwcap @ may not have MVFR regs2929 ldr \tmp, [\tmp, #0]3030- tst \tmp, #HWCAP_VFPv3D163131- ldceql p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}3232- addne \base, \base, #32*4 @ step over unused register space3030+ tst \tmp, #HWCAP_VFPD323131+ ldcnel p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}3232+ addeq \base, \base, #32*4 @ step over unused register space3333#else3434 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 03535 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field···5151#if __LINUX_ARM_ARCH__ <= 65252 ldr \tmp, =elf_hwcap @ may not have MVFR regs5353 ldr \tmp, [\tmp, #0]5454- tst \tmp, #HWCAP_VFPv3D165555- stceql p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}5656- addne \base, \base, #32*4 @ step over unused register space5454+ tst \tmp, #HWCAP_VFPD325555+ stcnel p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}5656+ addeq \base, \base, #32*4 @ step over unused register space5757#else5858 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 05959 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
···107107 update_sched_clock();108108}109109110110-void __init setup_sched_clock_needs_suspend(u32 (*read)(void), int bits,111111- unsigned long rate)112112-{113113- setup_sched_clock(read, bits, rate);114114- cd.needs_suspend = true;115115-}116116-117110void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate)118111{119112 unsigned long r, w;···182189static int sched_clock_suspend(void)183190{184191 sched_clock_poll(sched_clock_timer.data);185185- if (cd.needs_suspend)186186- cd.suspended = true;192192+ cd.suspended = true;187193 return 0;188194}189195190196static void sched_clock_resume(void)191197{192192- if (cd.needs_suspend) {193193- cd.epoch_cyc = read_sched_clock();194194- cd.epoch_cyc_copy = cd.epoch_cyc;195195- cd.suspended = false;196196- }198198+ cd.epoch_cyc = read_sched_clock();199199+ cd.epoch_cyc_copy = cd.epoch_cyc;200200+ cd.suspended = false;197201}198202199203static struct syscore_ops sched_clock_ops = {
+1-1
arch/arm/mm/alignment.c
···745745static int746746do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)747747{748748- union offset_union offset;748748+ union offset_union uninitialized_var(offset);749749 unsigned long instr = 0, instrptr;750750 int (*handler)(unsigned long addr, unsigned long instr, struct pt_regs *regs);751751 unsigned int type;
+6-3
arch/arm/vfp/vfpmodule.c
···701701 elf_hwcap |= HWCAP_VFPv3;702702703703 /*704704- * Check for VFPv3 D16. CPUs in this configuration705705- * only have 16 x 64bit registers.704704+ * Check for VFPv3 D16 and VFPv4 D16. CPUs in705705+ * this configuration only have 16 x 64bit706706+ * registers.706707 */707708 if (((fmrx(MVFR0) & MVFR0_A_SIMD_MASK)) == 1)708708- elf_hwcap |= HWCAP_VFPv3D16;709709+ elf_hwcap |= HWCAP_VFPv3D16; /* also v4-D16 */710710+ else711711+ elf_hwcap |= HWCAP_VFPD32;709712 }710713#endif711714 /*
+11
arch/arm/xen/enlighten.c
···166166 *pages = NULL;167167}168168EXPORT_SYMBOL_GPL(free_xenballooned_pages);169169+170170+/* In the hypervisor.S file. */171171+EXPORT_SYMBOL_GPL(HYPERVISOR_event_channel_op);172172+EXPORT_SYMBOL_GPL(HYPERVISOR_grant_table_op);173173+EXPORT_SYMBOL_GPL(HYPERVISOR_xen_version);174174+EXPORT_SYMBOL_GPL(HYPERVISOR_console_io);175175+EXPORT_SYMBOL_GPL(HYPERVISOR_sched_op);176176+EXPORT_SYMBOL_GPL(HYPERVISOR_hvm_op);177177+EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op);178178+EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op);179179+EXPORT_SYMBOL_GPL(privcmd_call);
···2525#include <asm/user.h>26262727typedef unsigned long elf_greg_t;2828-typedef unsigned long elf_freg_t[3];29283029#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))3130typedef elf_greg_t elf_gregset_t[ELF_NGREG];3232-3333-typedef struct user_fp elf_fpregset_t;3131+typedef struct user_fpsimd_state elf_fpregset_t;34323533#define EM_AARCH64 1833634···8486#define R_AARCH64_MOVW_PREL_G2 2918587#define R_AARCH64_MOVW_PREL_G2_NC 2928688#define R_AARCH64_MOVW_PREL_G3 2938787-88898990/*9091 * These are used to set parameters in the core dumps.
+2-3
arch/arm64/include/asm/fpsimd.h
···2525 * - FPSR and FPCR2626 * - 32 128-bit data registers2727 *2828- * Note that user_fp forms a prefix of this structure, which is relied2929- * upon in the ptrace FP/SIMD accessors. struct user_fpsimd_state must3030- * form a prefix of struct fpsimd_state.2828+ * Note that user_fpsimd forms a prefix of this structure, which is2929+ * relied upon in the ptrace FP/SIMD accessors.3130 */3231struct fpsimd_state {3332 union {
···1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.1515 */1616#ifdef CONFIG_COMPAT1717-#define __ARCH_WANT_COMPAT_IPC_PARSE_VERSION1817#define __ARCH_WANT_COMPAT_STAT641918#define __ARCH_WANT_SYS_GETHOSTNAME2019#define __ARCH_WANT_SYS_PAUSE
+2-8
arch/arm64/kernel/perf_event.c
···613613 ARMV8_PMUV3_PERFCTR_BUS_ACCESS = 0x19,614614 ARMV8_PMUV3_PERFCTR_MEM_ERROR = 0x1A,615615 ARMV8_PMUV3_PERFCTR_BUS_CYCLES = 0x1D,616616-617617- /*618618- * This isn't an architected event.619619- * We detect this event number and use the cycle counter instead.620620- */621621- ARMV8_PMUV3_PERFCTR_CPU_CYCLES = 0xFF,622616};623617624618/* PMUv3 HW events mapping. */625619static const unsigned armv8_pmuv3_perf_map[PERF_COUNT_HW_MAX] = {626626- [PERF_COUNT_HW_CPU_CYCLES] = ARMV8_PMUV3_PERFCTR_CPU_CYCLES,620620+ [PERF_COUNT_HW_CPU_CYCLES] = ARMV8_PMUV3_PERFCTR_CLOCK_CYCLES,627621 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV8_PMUV3_PERFCTR_INSTR_EXECUTED,628622 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV8_PMUV3_PERFCTR_L1_DCACHE_ACCESS,629623 [PERF_COUNT_HW_CACHE_MISSES] = ARMV8_PMUV3_PERFCTR_L1_DCACHE_REFILL,···11001106 unsigned long evtype = event->config_base & ARMV8_EVTYPE_EVENT;1101110711021108 /* Always place a cycle counter into the cycle counter. */11031103- if (evtype == ARMV8_PMUV3_PERFCTR_CPU_CYCLES) {11091109+ if (evtype == ARMV8_PMUV3_PERFCTR_CLOCK_CYCLES) {11041110 if (test_and_set_bit(ARMV8_IDX_CYCLE_COUNTER, cpuc->used_mask))11051111 return -EAGAIN;11061112
-18
arch/arm64/kernel/process.c
···310310}311311312312/*313313- * Fill in the task's elfregs structure for a core dump.314314- */315315-int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs)316316-{317317- elf_core_copy_regs(elfregs, task_pt_regs(t));318318- return 1;319319-}320320-321321-/*322322- * fill in the fpe structure for a core dump...323323- */324324-int dump_fpu (struct pt_regs *regs, struct user_fp *fp)325325-{326326- return 0;327327-}328328-EXPORT_SYMBOL(dump_fpu);329329-330330-/*331313 * Shuffle the argument into the correct register before calling the332314 * thread function. x1 is the thread argument, x2 is the pointer to333315 * the thread function, and x3 points to the exit function.
+1-2
arch/arm64/kernel/smp.c
···211211 * before we continue.212212 */213213 set_cpu_online(cpu, true);214214- while (!cpu_active(cpu))215215- cpu_relax();214214+ complete(&cpu_running);216215217216 /*218217 * OK, it's off to the idle thread for us
+1-1
arch/arm64/mm/init.c
···8080#ifdef CONFIG_ZONE_DMA328181 /* 4GB maximum for 32-bit only capable devices */8282 max_dma32 = min(max, MAX_DMA32_PFN);8383- zone_size[ZONE_DMA32] = max_dma32 - min;8383+ zone_size[ZONE_DMA32] = max(min, max_dma32) - min;8484#endif8585 zone_size[ZONE_NORMAL] = max - max_dma32;8686
···869869 call schedule_tail870870 calll.p @(gr21,gr0)871871 or gr20,gr20,gr8872872- bra sys_exit873873-874874- .globl ret_from_kernel_execve875875-ret_from_kernel_execve:876876- ori gr28,0,sp877872 bra __syscall_exit878873879874###################################################################################################···10751080 subicc gr5,#0,gr0,icc010761081 beq icc0,#0,__entry_return_direct1077108210781078-__entry_preempt_need_resched:10791079- ldi @(gr15,#TI_FLAGS),gr410801080- andicc gr4,#_TIF_NEED_RESCHED,gr0,icc010811081- beq icc0,#1,__entry_return_direct10821082-10831083- setlos #PREEMPT_ACTIVE,gr510841084- sti gr5,@(gr15,#TI_FLAGS)10851085-10861086- andi gr23,#~PSR_PIL,gr2310871087- movgs gr23,psr10881088-10891089- call schedule10901090- sti gr0,@(gr15,#TI_PRE_COUNT)10911091-10921092- movsg psr,gr2310931093- ori gr23,#PSR_PIL_14,gr2310941094- movgs gr23,psr10951095- bra __entry_preempt_need_resched10961096-#else10971097- bra __entry_return_direct10831083+ subcc gr0,gr0,gr0,icc2 /* set Z and clear C */10841084+ call preempt_schedule_irq10981085#endif10861086+ bra __entry_return_direct109910871100108811011089###############################################################################
+3-2
arch/frv/kernel/process.c
···181181 childregs = (struct pt_regs *)182182 (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE);183183184184+ /* set up the userspace frame (the only place that the USP is stored) */185185+ *childregs = *__kernel_frame0_ptr;186186+184187 p->set_child_tid = p->clear_child_tid = NULL;185188186189 p->thread.frame = childregs;···194191 p->thread.frame0 = childregs;195192196193 if (unlikely(!regs)) {197197- memset(childregs, 0, sizeof(struct pt_regs));198194 childregs->gr9 = usp; /* function */199195 childregs->gr8 = arg;200200- childregs->psr = PSR_S;201196 p->thread.pc = (unsigned long) ret_from_kernel_thread;202197 save_user_regs(p->thread.user);203198 return 0;
···527527MODULE_DESCRIPTION("DES & Triple DES EDE Cipher Algorithms, sparc64 des opcode accelerated");528528529529MODULE_ALIAS("des");530530+531531+#include "crop_devid.c"
···11/* atomic.h: Thankfully the V9 is at least reasonable for this22 * stuff.33 *44- * Copyright (C) 1996, 1997, 2000 David S. Miller (davem@redhat.com)44+ * Copyright (C) 1996, 1997, 2000, 2012 David S. Miller (davem@redhat.com)55 */6677#ifndef __ARCH_SPARC64_ATOMIC__···105105}106106107107#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)108108+109109+extern long atomic64_dec_if_positive(atomic64_t *v);108110109111/* Atomic operations are already serializing */110112#define smp_mb__before_atomic_dec() barrier()
+59-10
arch/sparc/include/asm/backoff.h
···11#ifndef _SPARC64_BACKOFF_H22#define _SPARC64_BACKOFF_H3344+/* The macros in this file implement an exponential backoff facility55+ * for atomic operations.66+ *77+ * When multiple threads compete on an atomic operation, it is88+ * possible for one thread to be continually denied a successful99+ * completion of the compare-and-swap instruction. Heavily1010+ * threaded cpu implementations like Niagara can compound this1111+ * problem even further.1212+ *1313+ * When an atomic operation fails and needs to be retried, we spin a1414+ * certain number of times. At each subsequent failure of the same1515+ * operation we double the spin count, realizing an exponential1616+ * backoff.1717+ *1818+ * When we spin, we try to use an operation that will cause the1919+ * current cpu strand to block, and therefore make the core fully2020+ * available to any other other runnable strands. There are two2121+ * options, based upon cpu capabilities.2222+ *2323+ * On all cpus prior to SPARC-T4 we do three dummy reads of the2424+ * condition code register. Each read blocks the strand for something2525+ * between 40 and 50 cpu cycles.2626+ *2727+ * For SPARC-T4 and later we have a special "pause" instruction2828+ * available. This is implemented using writes to register %asr27.2929+ * The cpu will block the number of cycles written into the register,3030+ * unless a disrupting trap happens first. SPARC-T4 specifically3131+ * implements pause with a granularity of 8 cycles. Each strand has3232+ * an internal pause counter which decrements every 8 cycles. So the3333+ * chip shifts the %asr27 value down by 3 bits, and writes the result3434+ * into the pause counter. If a value smaller than 8 is written, the3535+ * chip blocks for 1 cycle.3636+ *3737+ * To achieve the same amount of backoff as the three %ccr reads give3838+ * on earlier chips, we shift the backoff value up by 7 bits. (Three3939+ * %ccr reads block for about 128 cycles, 1 << 7 == 128) We write the4040+ * whole amount we want to block into the pause register, rather than4141+ * loop writing 128 each time.4242+ */4343+444#define BACKOFF_LIMIT (4 * 1024)545646#ifdef CONFIG_SMP···5111#define BACKOFF_LABEL(spin_label, continue_label) \5212 spin_label53135454-#define BACKOFF_SPIN(reg, tmp, label) \5555- mov reg, tmp; \5656-88: brnz,pt tmp, 88b; \5757- sub tmp, 1, tmp; \5858- set BACKOFF_LIMIT, tmp; \5959- cmp reg, tmp; \6060- bg,pn %xcc, label; \6161- nop; \6262- ba,pt %xcc, label; \6363- sllx reg, 1, reg;1414+#define BACKOFF_SPIN(reg, tmp, label) \1515+ mov reg, tmp; \1616+88: rd %ccr, %g0; \1717+ rd %ccr, %g0; \1818+ rd %ccr, %g0; \1919+ .section .pause_3insn_patch,"ax";\2020+ .word 88b; \2121+ sllx tmp, 7, tmp; \2222+ wr tmp, 0, %asr27; \2323+ clr tmp; \2424+ .previous; \2525+ brnz,pt tmp, 88b; \2626+ sub tmp, 1, tmp; \2727+ set BACKOFF_LIMIT, tmp; \2828+ cmp reg, tmp; \2929+ bg,pn %xcc, label; \3030+ nop; \3131+ ba,pt %xcc, label; \3232+ sllx reg, 1, reg;64336534#else6635
+3-2
arch/sparc/include/asm/compat.h
···232232 struct pt_regs *regs = current_thread_info()->kregs;233233 unsigned long usp = regs->u_regs[UREG_I6];234234235235- if (!(test_thread_flag(TIF_32BIT)))235235+ if (test_thread_64bit_stack(usp))236236 usp += STACK_BIAS;237237- else237237+238238+ if (test_thread_flag(TIF_32BIT))238239 usp &= 0xffffffffUL;239240240241 usp -= len;
+16-1
arch/sparc/include/asm/processor_64.h
···196196#define KSTK_EIP(tsk) (task_pt_regs(tsk)->tpc)197197#define KSTK_ESP(tsk) (task_pt_regs(tsk)->u_regs[UREG_FP])198198199199-#define cpu_relax() barrier()199199+/* Please see the commentary in asm/backoff.h for a description of200200+ * what these instructions are doing and how they have been choosen.201201+ * To make a long story short, we are trying to yield the current cpu202202+ * strand during busy loops.203203+ */204204+#define cpu_relax() asm volatile("\n99:\n\t" \205205+ "rd %%ccr, %%g0\n\t" \206206+ "rd %%ccr, %%g0\n\t" \207207+ "rd %%ccr, %%g0\n\t" \208208+ ".section .pause_3insn_patch,\"ax\"\n\t"\209209+ ".word 99b\n\t" \210210+ "wr %%g0, 128, %%asr27\n\t" \211211+ "nop\n\t" \212212+ "nop\n\t" \213213+ ".previous" \214214+ ::: "memory")200215201216/* Prefetch support. This is tuned for UltraSPARC-III and later.202217 * UltraSPARC-I will treat these as nops, and UltraSPARC-II has
+5
arch/sparc/include/asm/prom.h
···6363extern void irq_trans_init(struct device_node *dp);6464extern char *build_path_component(struct device_node *dp);65656666+/* SPARC has a local implementation */6767+extern int of_address_to_resource(struct device_node *dev, int index,6868+ struct resource *r);6969+#define of_address_to_resource of_address_to_resource7070+6671#endif /* __KERNEL__ */6772#endif /* _SPARC_PROM_H */
···5656static void leon_handle_ext_irq(unsigned int irq, struct irq_desc *desc)5757{5858 unsigned int eirq;5959+ struct irq_bucket *p;5960 int cpu = sparc_leon3_cpuid();60616162 eirq = leon_eirq_get(cpu);6262- if ((eirq & 0x10) && irq_map[eirq]->irq) /* bit4 tells if IRQ happened */6363- generic_handle_irq(irq_map[eirq]->irq);6363+ p = irq_map[eirq];6464+ if ((eirq & 0x10) && p && p->irq) /* bit4 tells if IRQ happened */6565+ generic_handle_irq(p->irq);6466}65676668/* The extended IRQ controller has been found, this function registers it */
+16-6
arch/sparc/kernel/perf_event.c
···1762176217631763 ufp = regs->u_regs[UREG_I6] & 0xffffffffUL;17641764 do {17651765- struct sparc_stackf32 *usf, sf;17661765 unsigned long pc;1767176617681768- usf = (struct sparc_stackf32 *) ufp;17691769- if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))17701770- break;17671767+ if (thread32_stack_is_64bit(ufp)) {17681768+ struct sparc_stackf *usf, sf;1771176917721772- pc = sf.callers_pc;17731773- ufp = (unsigned long)sf.fp;17701770+ ufp += STACK_BIAS;17711771+ usf = (struct sparc_stackf *) ufp;17721772+ if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))17731773+ break;17741774+ pc = sf.callers_pc & 0xffffffff;17751775+ ufp = ((unsigned long) sf.fp) & 0xffffffff;17761776+ } else {17771777+ struct sparc_stackf32 *usf, sf;17781778+ usf = (struct sparc_stackf32 *) ufp;17791779+ if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))17801780+ break;17811781+ pc = sf.callers_pc;17821782+ ufp = (unsigned long)sf.fp;17831783+ }17741784 perf_callchain_store(entry, pc);17751785 } while (entry->nr < PERF_MAX_STACK_DEPTH);17761786}
+23-19
arch/sparc/kernel/process_64.c
···452452/* It's a bit more tricky when 64-bit tasks are involved... */453453static unsigned long clone_stackframe(unsigned long csp, unsigned long psp)454454{455455+ bool stack_64bit = test_thread_64bit_stack(psp);455456 unsigned long fp, distance, rval;456457457457- if (!(test_thread_flag(TIF_32BIT))) {458458+ if (stack_64bit) {458459 csp += STACK_BIAS;459460 psp += STACK_BIAS;460461 __get_user(fp, &(((struct reg_window __user *)psp)->ins[6]));461462 fp += STACK_BIAS;463463+ if (test_thread_flag(TIF_32BIT))464464+ fp &= 0xffffffff;462465 } else463466 __get_user(fp, &(((struct reg_window32 __user *)psp)->ins[6]));464467···475472 rval = (csp - distance);476473 if (copy_in_user((void __user *) rval, (void __user *) psp, distance))477474 rval = 0;478478- else if (test_thread_flag(TIF_32BIT)) {475475+ else if (!stack_64bit) {479476 if (put_user(((u32)csp),480477 &(((struct reg_window32 __user *)rval)->ins[6])))481478 rval = 0;···510507511508 flush_user_windows();512509 if ((window = get_thread_wsaved()) != 0) {513513- int winsize = sizeof(struct reg_window);514514- int bias = 0;515515-516516- if (test_thread_flag(TIF_32BIT))517517- winsize = sizeof(struct reg_window32);518518- else519519- bias = STACK_BIAS;520520-521510 window -= 1;522511 do {523523- unsigned long sp = (t->rwbuf_stkptrs[window] + bias);524512 struct reg_window *rwin = &t->reg_window[window];513513+ int winsize = sizeof(struct reg_window);514514+ unsigned long sp;515515+516516+ sp = t->rwbuf_stkptrs[window];517517+518518+ if (test_thread_64bit_stack(sp))519519+ sp += STACK_BIAS;520520+ else521521+ winsize = sizeof(struct reg_window32);525522526523 if (!copy_to_user((char __user *)sp, rwin, winsize)) {527524 shift_window_buffer(window, get_thread_wsaved() - 1, t);···547544{548545 struct thread_info *t = current_thread_info();549546 unsigned long window;550550- int winsize = sizeof(struct reg_window);551551- int bias = 0;552552-553553- if (test_thread_flag(TIF_32BIT))554554- winsize = sizeof(struct reg_window32);555555- else556556- bias = STACK_BIAS;557547558548 flush_user_windows();559549 window = get_thread_wsaved();···554558 if (likely(window != 0)) {555559 window -= 1;556560 do {557557- unsigned long sp = (t->rwbuf_stkptrs[window] + bias);558561 struct reg_window *rwin = &t->reg_window[window];562562+ int winsize = sizeof(struct reg_window);563563+ unsigned long sp;564564+565565+ sp = t->rwbuf_stkptrs[window];566566+567567+ if (test_thread_64bit_stack(sp))568568+ sp += STACK_BIAS;569569+ else570570+ winsize = sizeof(struct reg_window32);559571560572 if (unlikely(sp & 0x7UL))561573 stack_unaligned(sp);
+2-2
arch/sparc/kernel/ptrace_64.c
···151151{152152 unsigned long rw_addr = regs->u_regs[UREG_I6];153153154154- if (test_tsk_thread_flag(current, TIF_32BIT)) {154154+ if (!test_thread_64bit_stack(rw_addr)) {155155 struct reg_window32 win32;156156 int i;157157···176176{177177 unsigned long rw_addr = regs->u_regs[UREG_I6];178178179179- if (test_tsk_thread_flag(current, TIF_32BIT)) {179179+ if (!test_thread_64bit_stack(rw_addr)) {180180 struct reg_window32 win32;181181 int i;182182
+21
arch/sparc/kernel/setup_64.c
···316316 }317317}318318319319+static void __init pause_patch(void)320320+{321321+ struct pause_patch_entry *p;322322+323323+ p = &__pause_3insn_patch;324324+ while (p < &__pause_3insn_patch_end) {325325+ unsigned long i, addr = p->addr;326326+327327+ for (i = 0; i < 3; i++) {328328+ *(unsigned int *) (addr + (i * 4)) = p->insns[i];329329+ wmb();330330+ __asm__ __volatile__("flush %0"331331+ : : "r" (addr + (i * 4)));332332+ }333333+334334+ p++;335335+ }336336+}337337+319338#ifdef CONFIG_SMP320339void __init boot_cpu_id_too_large(int cpu)321340{···547528548529 if (sparc64_elf_hwcap & AV_SPARC_POPC)549530 popc_patch();531531+ if (sparc64_elf_hwcap & AV_SPARC_PAUSE)532532+ pause_patch();550533}551534552535void __init setup_arch(char **cmdline_p)
+5
arch/sparc/kernel/sys_sparc_64.c
···751751 : "cc");752752 return __res;753753}754754+755755+asmlinkage long sys_kern_features(void)756756+{757757+ return KERN_FEATURE_MIXED_MODE_STACK;758758+}
···11/* atomic.S: These things are too big to do inline.22 *33- * Copyright (C) 1999, 2007 David S. Miller (davem@davemloft.net)33+ * Copyright (C) 1999, 2007 2012 David S. Miller (davem@davemloft.net)44 */5566#include <linux/linkage.h>···117117 sub %g1, %o0, %o01181182: BACKOFF_SPIN(%o2, %o3, 1b)119119ENDPROC(atomic64_sub_ret)120120+121121+ENTRY(atomic64_dec_if_positive) /* %o0 = atomic_ptr */122122+ BACKOFF_SETUP(%o2)123123+1: ldx [%o0], %g1124124+ brlez,pn %g1, 3f125125+ sub %g1, 1, %g7126126+ casx [%o0], %g1, %g7127127+ cmp %g1, %g7128128+ bne,pn %xcc, BACKOFF_LABEL(2f, 1b)129129+ nop130130+3: retl131131+ sub %g1, 1, %o0132132+2: BACKOFF_SPIN(%o2, %o3, 1b)133133+ENDPROC(atomic64_dec_if_positive)
+1
arch/sparc/lib/ksyms.c
···116116EXPORT_SYMBOL(atomic64_add_ret);117117EXPORT_SYMBOL(atomic64_sub);118118EXPORT_SYMBOL(atomic64_sub_ret);119119+EXPORT_SYMBOL(atomic64_dec_if_positive);119120120121/* Atomic bit operations. */121122EXPORT_SYMBOL(test_and_set_bit);
···152152153153/* Clearing a0 terminates the backtrace. */154154#define start_thread(regs, new_pc, new_sp) \155155+ memset(regs, 0, sizeof(*regs)); \155156 regs->pc = new_pc; \156157 regs->ps = USER_PS_VALUE; \157158 regs->areg[1] = new_sp; \···168167169168/* Free all resources held by a thread. */170169#define release_thread(thread) do { } while(0)171171-172172-/* Create a kernel thread without removing it from tasklists */173173-extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);174170175171/* Copy and release all segment info associated with a VM */176172#define copy_segments(p, mm) do { } while(0)
+1-1
arch/xtensa/include/asm/syscall.h
···10101111struct pt_regs;1212struct sigaction;1313-asmlinkage long xtensa_execve(char*, char**, char**, struct pt_regs*);1313+asmlinkage long sys_execve(char*, char**, char**, struct pt_regs*);1414asmlinkage long xtensa_clone(unsigned long, unsigned long, struct pt_regs*);1515asmlinkage long xtensa_ptrace(long, long, long, long);1616asmlinkage long xtensa_sigreturn(struct pt_regs*);
+5-10
arch/xtensa/include/asm/unistd.h
···11-/*22- * include/asm-xtensa/unistd.h33- *44- * This file is subject to the terms and conditions of the GNU General Public55- * License. See the file "COPYING" in the main directory of this archive66- * for more details.77- *88- * Copyright (C) 2001 - 2005 Tensilica Inc.99- */11+#ifndef _XTENSA_UNISTD_H22+#define _XTENSA_UNISTD_H10344+#define __ARCH_WANT_SYS_EXECVE115#include <uapi/asm/unistd.h>1212-136147/*158 * "Conditional" syscalls···3037#define __IGNORE_mmap /* use mmap2 */3138#define __IGNORE_vfork /* use clone */3239#define __IGNORE_fadvise64 /* use fadvise64_64 */4040+4141+#endif /* _XTENSA_UNISTD_H */
+4-12
arch/xtensa/include/uapi/asm/unistd.h
···11-/*22- * include/asm-xtensa/unistd.h33- *44- * This file is subject to the terms and conditions of the GNU General Public55- * License. See the file "COPYING" in the main directory of this archive66- * for more details.77- *88- * Copyright (C) 2001 - 2012 Tensilica Inc.99- */1010-1111-#ifndef _UAPI_XTENSA_UNISTD_H11+#if !defined(_UAPI_XTENSA_UNISTD_H) || defined(__SYSCALL)122#define _UAPI_XTENSA_UNISTD_H133144#ifndef __SYSCALL···262272#define __NR_clone 116263273__SYSCALL(116, xtensa_clone, 5)264274#define __NR_execve 117265265-__SYSCALL(117, xtensa_execve, 3)275275+__SYSCALL(117, sys_execve, 3)266276#define __NR_exit 118267277__SYSCALL(118, sys_exit, 1)268278#define __NR_exit_group 119···748758#define SYS_XTENSA_ATOMIC_CMP_SWP 4 /* compare and swap */749759750760#define SYS_XTENSA_COUNT 5 /* count */761761+762762+#undef __SYSCALL751763752764#endif /* _UAPI_XTENSA_UNISTD_H */
+13-44
arch/xtensa/kernel/entry.S
···183318331834183418351835/*18361836- * Create a kernel thread18371837- *18381838- * int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)18391839- * a2 a2 a3 a418401840- */18411841-18421842-ENTRY(kernel_thread)18431843- entry a1, 1618441844-18451845- mov a5, a2 # preserve fn over syscall18461846- mov a7, a3 # preserve args over syscall18471847-18481848- movi a3, _CLONE_VM | _CLONE_UNTRACED18491849- movi a2, __NR_clone18501850- or a6, a4, a3 # arg0: flags18511851- mov a3, a1 # arg1: sp18521852- syscall18531853-18541854- beq a3, a1, 1f # branch if parent18551855- mov a6, a7 # args18561856- callx4 a5 # fn(args)18571857-18581858- movi a2, __NR_exit18591859- syscall # return value of fn(args) still in a618601860-18611861-1: retw18621862-18631863-/*18641864- * Do a system call from kernel instead of calling sys_execve, so we end up18651865- * with proper pt_regs.18661866- *18671867- * int kernel_execve(const char *fname, char *const argv[], charg *const envp[])18681868- * a2 a2 a3 a418691869- */18701870-18711871-ENTRY(kernel_execve)18721872- entry a1, 1618731873- mov a6, a2 # arg0 is in a618741874- movi a2, __NR_execve18751875- syscall18761876-18771877- retw18781878-18791879-/*18801836 * Task switch.18811837 *18821838 * struct task* _switch_to (struct task* prev, struct task* next)···1914195819151959 j common_exception_return1916196019611961+/*19621962+ * Kernel thread creation helper19631963+ * On entry, set up by copy_thread: a2 = thread_fn, a3 = thread_fn arg19641964+ * left from _switch_to: a6 = prev19651965+ */19661966+ENTRY(ret_from_kernel_thread)19671967+19681968+ call4 schedule_tail19691969+ mov a6, a319701970+ callx4 a219711971+ j common_exception_return19721972+19731973+ENDPROC(ret_from_kernel_thread)
+71-57
arch/xtensa/kernel/process.c
···4545#include <asm/regs.h>46464747extern void ret_from_fork(void);4848+extern void ret_from_kernel_thread(void);48494950struct task_struct *current_set[NR_CPUS] = {&init_task, };5051···159158/*160159 * Copy thread.161160 *161161+ * There are two modes in which this function is called:162162+ * 1) Userspace thread creation,163163+ * regs != NULL, usp_thread_fn is userspace stack pointer.164164+ * It is expected to copy parent regs (in case CLONE_VM is not set165165+ * in the clone_flags) and set up passed usp in the childregs.166166+ * 2) Kernel thread creation,167167+ * regs == NULL, usp_thread_fn is the function to run in the new thread168168+ * and thread_fn_arg is its parameter.169169+ * childregs are not used for the kernel threads.170170+ *162171 * The stack layout for the new thread looks like this:163172 *164164- * +------------------------+ <- sp in childregs (= tos)173173+ * +------------------------+165174 * | childregs |166175 * +------------------------+ <- thread.sp = sp in dummy-frame167176 * | dummy-frame | (saved in dummy-frame spill-area)168177 * +------------------------+169178 *170170- * We create a dummy frame to return to ret_from_fork:171171- * a0 points to ret_from_fork (simulating a call4)179179+ * We create a dummy frame to return to either ret_from_fork or180180+ * ret_from_kernel_thread:181181+ * a0 points to ret_from_fork/ret_from_kernel_thread (simulating a call4)172182 * sp points to itself (thread.sp)173173- * a2, a3 are unused.183183+ * a2, a3 are unused for userspace threads,184184+ * a2 points to thread_fn, a3 holds thread_fn arg for kernel threads.174185 *175186 * Note: This is a pristine frame, so we don't need any spill region on top of176187 * childregs.···198185 * involved. Much simpler to just not copy those live frames across.199186 */200187201201-int copy_thread(unsigned long clone_flags, unsigned long usp,202202- unsigned long unused,203203- struct task_struct * p, struct pt_regs * regs)188188+int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn,189189+ unsigned long thread_fn_arg,190190+ struct task_struct *p, struct pt_regs *unused)204191{205205- struct pt_regs *childregs;206206- unsigned long tos;207207- int user_mode = user_mode(regs);192192+ struct pt_regs *childregs = task_pt_regs(p);208193209194#if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS)210195 struct thread_info *ti;211196#endif212197213213- /* Set up new TSS. */214214- tos = (unsigned long)task_stack_page(p) + THREAD_SIZE;215215- if (user_mode)216216- childregs = (struct pt_regs*)(tos - PT_USER_SIZE);217217- else218218- childregs = (struct pt_regs*)tos - 1;219219-220220- /* This does not copy all the regs. In a bout of brilliance or madness,221221- ARs beyond a0-a15 exist past the end of the struct. */222222- *childregs = *regs;223223-224198 /* Create a call4 dummy-frame: a0 = 0, a1 = childregs. */225199 *((int*)childregs - 3) = (unsigned long)childregs;226200 *((int*)childregs - 4) = 0;227201228228- childregs->areg[2] = 0;229229- p->set_child_tid = p->clear_child_tid = NULL;230230- p->thread.ra = MAKE_RA_FOR_CALL((unsigned long)ret_from_fork, 0x1);231202 p->thread.sp = (unsigned long)childregs;232203233233- if (user_mode(regs)) {204204+ if (!(p->flags & PF_KTHREAD)) {205205+ struct pt_regs *regs = current_pt_regs();206206+ unsigned long usp = usp_thread_fn ?207207+ usp_thread_fn : regs->areg[1];234208209209+ p->thread.ra = MAKE_RA_FOR_CALL(210210+ (unsigned long)ret_from_fork, 0x1);211211+212212+ /* This does not copy all the regs.213213+ * In a bout of brilliance or madness,214214+ * ARs beyond a0-a15 exist past the end of the struct.215215+ */216216+ *childregs = *regs;235217 childregs->areg[1] = usp;218218+ childregs->areg[2] = 0;219219+220220+ /* When sharing memory with the parent thread, the child221221+ usually starts on a pristine stack, so we have to reset222222+ windowbase, windowstart and wmask.223223+ (Note that such a new thread is required to always create224224+ an initial call4 frame)225225+ The exception is vfork, where the new thread continues to226226+ run on the parent's stack until it calls execve. This could227227+ be a call8 or call12, which requires a legal stack frame228228+ of the previous caller for the overflow handlers to work.229229+ (Note that it's always legal to overflow live registers).230230+ In this case, ensure to spill at least the stack pointer231231+ of that frame. */232232+236233 if (clone_flags & CLONE_VM) {237237- childregs->wmask = 1; /* can't share live windows */234234+ /* check that caller window is live and same stack */235235+ int len = childregs->wmask & ~0xf;236236+ if (regs->areg[1] == usp && len != 0) {237237+ int callinc = (regs->areg[0] >> 30) & 3;238238+ int caller_ars = XCHAL_NUM_AREGS - callinc * 4;239239+ put_user(regs->areg[caller_ars+1],240240+ (unsigned __user*)(usp - 12));241241+ }242242+ childregs->wmask = 1;243243+ childregs->windowstart = 1;244244+ childregs->windowbase = 0;238245 } else {239246 int len = childregs->wmask & ~0xf;240247 memcpy(&childregs->areg[XCHAL_NUM_AREGS - len/4],···263230// FIXME: we need to set THREADPTR in thread_info...264231 if (clone_flags & CLONE_SETTLS)265232 childregs->areg[2] = childregs->areg[6];266266-267233 } else {268268- /* In kernel space, we start a new thread with a new stack. */269269- childregs->wmask = 1;270270- childregs->areg[1] = tos;234234+ p->thread.ra = MAKE_RA_FOR_CALL(235235+ (unsigned long)ret_from_kernel_thread, 1);236236+237237+ /* pass parameters to ret_from_kernel_thread:238238+ * a2 = thread_fn, a3 = thread_fn arg239239+ */240240+ *((int *)childregs - 1) = thread_fn_arg;241241+ *((int *)childregs - 2) = usp_thread_fn;242242+243243+ /* Childregs are only used when we're going to userspace244244+ * in which case start_thread will set them up.245245+ */271246 }272247273248#if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS)···371330 void __user *child_tid, long a5,372331 struct pt_regs *regs)373332{374374- if (!newsp)375375- newsp = regs->areg[1];376333 return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid);377334}378378-379379-/*380380- * xtensa_execve() executes a new program.381381- */382382-383383-asmlinkage384384-long xtensa_execve(const char __user *name,385385- const char __user *const __user *argv,386386- const char __user *const __user *envp,387387- long a3, long a4, long a5,388388- struct pt_regs *regs)389389-{390390- long error;391391- struct filename *filename;392392-393393- filename = getname(name);394394- error = PTR_ERR(filename);395395- if (IS_ERR(filename))396396- goto out;397397- error = do_execve(filename->name, argv, envp, regs);398398- putname(filename);399399-out:400400- return error;401401-}402402-
+3-4
arch/xtensa/kernel/syscall.c
···3232syscall_t sys_call_table[__NR_syscall_count] /* FIXME __cacheline_aligned */= {3333 [0 ... __NR_syscall_count - 1] = (syscall_t)&sys_ni_syscall,34343535-#undef __SYSCALL3635#define __SYSCALL(nr,symbol,nargs) [ nr ] = (syscall_t)symbol,3737-#undef __KERNEL_SYSCALLS__3838-#include <asm/unistd.h>3636+#include <uapi/asm/unistd.h>3937};40384139asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg)···4749 return (long)ret;4850}49515050-asmlinkage long xtensa_fadvise64_64(int fd, int advice, unsigned long long offset, unsigned long long len)5252+asmlinkage long xtensa_fadvise64_64(int fd, int advice,5353+ unsigned long long offset, unsigned long long len)5154{5255 return sys_fadvise64_64(fd, offset, len, advice);5356}
···89899090config BLK_DEV_THROTTLING9191 bool "Block layer bio throttling support"9292- depends on BLK_CGROUP=y && EXPERIMENTAL9292+ depends on BLK_CGROUP=y9393 default n9494 ---help---9595 Block layer bio throttling support. It can be used to limit
+10
block/blk-cgroup.c
···285285 blkg_destroy(blkg);286286 spin_unlock(&blkcg->lock);287287 }288288+289289+ /*290290+ * root blkg is destroyed. Just clear the pointer since291291+ * root_rl does not take reference on root blkg.292292+ */293293+ q->root_blkg = NULL;294294+ q->root_rl.blkg = NULL;288295}289296290297static void blkg_rcu_free(struct rcu_head *rcu_head)···333326 */334327 if (rl == &q->root_rl) {335328 ent = &q->blkg_list;329329+ /* There are no more block groups, hence no request lists */330330+ if (list_empty(ent))331331+ return NULL;336332 } else {337333 blkg = container_of(rl, struct blkcg_gq, rl);338334 ent = &blkg->q_node;
···137137 struct crypto_async_request *req, *backlog;138138139139 cpu_queue = container_of(work, struct cryptd_cpu_queue, work);140140- /* Only handle one request at a time to avoid hogging crypto141141- * workqueue. preempt_disable/enable is used to prevent142142- * being preempted by cryptd_enqueue_request() */140140+ /*141141+ * Only handle one request at a time to avoid hogging crypto workqueue.142142+ * preempt_disable/enable is used to prevent being preempted by143143+ * cryptd_enqueue_request(). local_bh_disable/enable is used to prevent144144+ * cryptd_enqueue_request() being accessed from software interrupts.145145+ */146146+ local_bh_disable();143147 preempt_disable();144148 backlog = crypto_get_backlog(&cpu_queue->queue);145149 req = crypto_dequeue_request(&cpu_queue->queue);146150 preempt_enable();151151+ local_bh_enable();147152148153 if (!req)149154 return;
+7-4
drivers/acpi/video.c
···13451345acpi_video_bus_get_devices(struct acpi_video_bus *video,13461346 struct acpi_device *device)13471347{13481348- int status;13481348+ int status = 0;13491349 struct acpi_device *dev;1350135013511351- status = acpi_video_device_enumerate(video);13521352- if (status)13531353- return status;13511351+ /*13521352+ * There are systems where video module known to work fine regardless13531353+ * of broken _DOD and ignoring returned value here doesn't cause13541354+ * any issues later.13551355+ */13561356+ acpi_video_device_enumerate(video);1354135713551358 list_for_each_entry(dev, &device->children, node) {13561359
+7
drivers/base/platform.c
···8383 */8484int platform_get_irq(struct platform_device *dev, unsigned int num)8585{8686+#ifdef CONFIG_SPARC8787+ /* sparc does not have irqs represented as IORESOURCE_IRQ resources */8888+ if (!dev || num >= dev->archdata.num_irqs)8989+ return -ENXIO;9090+ return dev->archdata.irqs[num];9191+#else8692 struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);87938894 return r ? r->start : -ENXIO;9595+#endif8996}9097EXPORT_SYMBOL_GPL(platform_get_irq);9198
+8-7
drivers/block/Kconfig
···131131config BLK_CPQ_CISS_DA132132 tristate "Compaq Smart Array 5xxx support"133133 depends on PCI134134+ select CHECK_SIGNATURE134135 help135136 This is the driver for Compaq Smart Array 5xxx controllers.136137 Everyone using these boards should say Y here.···167166 module will be called DAC960.168167169168config BLK_DEV_UMEM170170- tristate "Micro Memory MM5415 Battery Backed RAM support (EXPERIMENTAL)"171171- depends on PCI && EXPERIMENTAL169169+ tristate "Micro Memory MM5415 Battery Backed RAM support"170170+ depends on PCI172171 ---help---173172 Saying Y here will include support for the MM5415 family of174173 battery backed (Non-volatile) RAM cards.···431430 a disc is opened for writing.432431433432config CDROM_PKTCDVD_WCACHE434434- bool "Enable write caching (EXPERIMENTAL)"435435- depends on CDROM_PKTCDVD && EXPERIMENTAL433433+ bool "Enable write caching"434434+ depends on CDROM_PKTCDVD436435 help437436 If enabled, write caching will be set for the CD-R/W device. For now438437 this option is dangerous unless the CD-RW media is known good, as we···509508510509511510config VIRTIO_BLK512512- tristate "Virtio block driver (EXPERIMENTAL)"513513- depends on EXPERIMENTAL && VIRTIO511511+ tristate "Virtio block driver"512512+ depends on VIRTIO514513 ---help---515514 This is the virtual block driver for virtio. It can be used with516515 lguest or QEMU based VMMs (like KVM or Xen). Say Y or M.···529528530529config BLK_DEV_RBD531530 tristate "Rados block device (RBD)"532532- depends on INET && EXPERIMENTAL && BLOCK531531+ depends on INET && BLOCK533532 select CEPH_LIB534533 select LIBCRC32C535534 select CRYPTO_AES
-1
drivers/block/cciss.c
···52055205 return;52065206 }52075207 /* write all data in the battery backed cache to disk */52085208- memset(flush_buf, 0, 4);52095208 return_code = sendcmd_withirq(h, CCISS_CACHE_FLUSH, flush_buf,52105209 4, 0, CTLR_LUNID, TYPE_CMD);52115210 kfree(flush_buf);
+48-42
drivers/block/floppy.c
···4109410941104110static struct platform_device floppy_device[N_DRIVE];4111411141124112+static bool floppy_available(int drive)41134113+{41144114+ if (!(allowed_drive_mask & (1 << drive)))41154115+ return false;41164116+ if (fdc_state[FDC(drive)].version == FDC_NONE)41174117+ return false;41184118+ return true;41194119+}41204120+41124121static struct kobject *floppy_find(dev_t dev, int *part, void *data)41134122{41144123 int drive = (*part & 3) | ((*part & 0x80) >> 5);41154115- if (drive >= N_DRIVE ||41164116- !(allowed_drive_mask & (1 << drive)) ||41174117- fdc_state[FDC(drive)].version == FDC_NONE)41244124+ if (drive >= N_DRIVE || !floppy_available(drive))41184125 return NULL;41194126 if (((*part >> 2) & 0x1f) >= ARRAY_SIZE(floppy_type))41204127 return NULL;···4131412441324125static int __init do_floppy_init(void)41334126{41344134- int i, unit, drive;41354135- int err, dr;41274127+ int i, unit, drive, err;4136412841374129 set_debugt();41384130 interruptjiffies = resultjiffies = jiffies;···4143413741444138 raw_cmd = NULL;4145413941464146- for (dr = 0; dr < N_DRIVE; dr++) {41474147- disks[dr] = alloc_disk(1);41484148- if (!disks[dr]) {41404140+ floppy_wq = alloc_ordered_workqueue("floppy", 0);41414141+ if (!floppy_wq)41424142+ return -ENOMEM;41434143+41444144+ for (drive = 0; drive < N_DRIVE; drive++) {41454145+ disks[drive] = alloc_disk(1);41464146+ if (!disks[drive]) {41494147 err = -ENOMEM;41504148 goto out_put_disk;41514149 }4152415041534153- floppy_wq = alloc_ordered_workqueue("floppy", 0);41544154- if (!floppy_wq) {41514151+ disks[drive]->queue = blk_init_queue(do_fd_request, &floppy_lock);41524152+ if (!disks[drive]->queue) {41554153 err = -ENOMEM;41564154 goto out_put_disk;41574155 }4158415641594159- disks[dr]->queue = blk_init_queue(do_fd_request, &floppy_lock);41604160- if (!disks[dr]->queue) {41614161- err = -ENOMEM;41624162- goto out_destroy_workq;41634163- }41574157+ blk_queue_max_hw_sectors(disks[drive]->queue, 64);41584158+ disks[drive]->major = FLOPPY_MAJOR;41594159+ disks[drive]->first_minor = TOMINOR(drive);41604160+ disks[drive]->fops = &floppy_fops;41614161+ sprintf(disks[drive]->disk_name, "fd%d", drive);4164416241654165- blk_queue_max_hw_sectors(disks[dr]->queue, 64);41664166- disks[dr]->major = FLOPPY_MAJOR;41674167- disks[dr]->first_minor = TOMINOR(dr);41684168- disks[dr]->fops = &floppy_fops;41694169- sprintf(disks[dr]->disk_name, "fd%d", dr);41704170-41714171- init_timer(&motor_off_timer[dr]);41724172- motor_off_timer[dr].data = dr;41734173- motor_off_timer[dr].function = motor_off_callback;41634163+ init_timer(&motor_off_timer[drive]);41644164+ motor_off_timer[drive].data = drive;41654165+ motor_off_timer[drive].function = motor_off_callback;41744166 }4175416741764168 err = register_blkdev(FLOPPY_MAJOR, "fd");···42864282 }4287428342884284 for (drive = 0; drive < N_DRIVE; drive++) {42894289- if (!(allowed_drive_mask & (1 << drive)))42904290- continue;42914291- if (fdc_state[FDC(drive)].version == FDC_NONE)42854285+ if (!floppy_available(drive))42924286 continue;4293428742944288 floppy_device[drive].name = floppy_device_name;···4295429342964294 err = platform_device_register(&floppy_device[drive]);42974295 if (err)42984298- goto out_release_dma;42964296+ goto out_remove_drives;4299429743004298 err = device_create_file(&floppy_device[drive].dev,43014299 &dev_attr_cmos);···4313431143144312out_unreg_platform_dev:43154313 platform_device_unregister(&floppy_device[drive]);43144314+out_remove_drives:43154315+ while (drive--) {43164316+ if (floppy_available(drive)) {43174317+ del_gendisk(disks[drive]);43184318+ device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos);43194319+ platform_device_unregister(&floppy_device[drive]);43204320+ }43214321+ }43164322out_release_dma:43174323 if (atomic_read(&usage_count))43184324 floppy_release_irq_and_dma();43194325out_unreg_region:43204326 blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256);43214327 platform_driver_unregister(&floppy_driver);43224322-out_destroy_workq:43234323- destroy_workqueue(floppy_wq);43244328out_unreg_blkdev:43254329 unregister_blkdev(FLOPPY_MAJOR, "fd");43264330out_put_disk:43274327- while (dr--) {43284328- del_timer_sync(&motor_off_timer[dr]);43294329- if (disks[dr]->queue) {43304330- blk_cleanup_queue(disks[dr]->queue);43314331- /*43324332- * put_disk() is not paired with add_disk() and43334333- * will put queue reference one extra time. fix it.43344334- */43354335- disks[dr]->queue = NULL;43314331+ for (drive = 0; drive < N_DRIVE; drive++) {43324332+ if (!disks[drive])43334333+ break;43344334+ if (disks[drive]->queue) {43354335+ del_timer_sync(&motor_off_timer[drive]);43364336+ blk_cleanup_queue(disks[drive]->queue);43374337+ disks[drive]->queue = NULL;43364338 }43374337- put_disk(disks[dr]);43394339+ put_disk(disks[drive]);43384340 }43414341+ destroy_workqueue(floppy_wq);43394342 return err;43404343}43414344···45584551 for (drive = 0; drive < N_DRIVE; drive++) {45594552 del_timer_sync(&motor_off_timer[drive]);4560455345614561- if ((allowed_drive_mask & (1 << drive)) &&45624562- fdc_state[FDC(drive)].version != FDC_NONE) {45544554+ if (floppy_available(drive)) {45634555 del_gendisk(disks[drive]);45644556 device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos);45654557 platform_device_unregister(&floppy_device[drive]);
+15-2
drivers/block/loop.c
···976976 if (lo->lo_state != Lo_bound)977977 return -ENXIO;978978979979- if (lo->lo_refcnt > 1) /* we needed one fd for the ioctl */980980- return -EBUSY;979979+ /*980980+ * If we've explicitly asked to tear down the loop device,981981+ * and it has an elevated reference count, set it for auto-teardown when982982+ * the last reference goes away. This stops $!~#$@ udev from983983+ * preventing teardown because it decided that it needs to run blkid on984984+ * the loopback device whenever they appear. xfstests is notorious for985985+ * failing tests because blkid via udev races with a losetup986986+ * <dev>/do something like mkfs/losetup -d <dev> causing the losetup -d987987+ * command to fail with EBUSY.988988+ */989989+ if (lo->lo_refcnt > 1) {990990+ lo->lo_flags |= LO_FLAGS_AUTOCLEAR;991991+ mutex_unlock(&lo->lo_ctl_mutex);992992+ return 0;993993+ }981994982995 if (filp == NULL)983996 return -EINVAL;
+15-4
drivers/block/mtip32xx/mtip32xx.c
···20352035 }20362036 return rv;20372037}20382038-20392039-static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout)20382038+static void mtip_set_timeout(struct driver_data *dd,20392039+ struct host_to_dev_fis *fis,20402040+ unsigned int *timeout, u8 erasemode)20402041{20412042 switch (fis->command) {20422043 case ATA_CMD_DOWNLOAD_MICRO:···20452044 break;20462045 case ATA_CMD_SEC_ERASE_UNIT:20472046 case 0xFC:20482048- *timeout = 240000; /* 4 minutes */20472047+ if (erasemode)20482048+ *timeout = ((*(dd->port->identify + 90) * 2) * 60000);20492049+ else20502050+ *timeout = ((*(dd->port->identify + 89) * 2) * 60000);20492051 break;20502052 case ATA_CMD_STANDBYNOW1:20512053 *timeout = 120000; /* 2 minutes */···20912087 unsigned int transfer_size;20922088 unsigned long task_file_data;20932089 int intotal = outtotal + req_task->out_size;20902090+ int erasemode = 0;2094209120952092 taskout = req_task->out_size;20962093 taskin = req_task->in_size;···22172212 fis.lba_hi,22182213 fis.device);2219221422202220- mtip_set_timeout(&fis, &timeout);22152215+ /* check for erase mode support during secure erase.*/22162216+ if ((fis.command == ATA_CMD_SEC_ERASE_UNIT)22172217+ && (outbuf[0] & MTIP_SEC_ERASE_MODE)) {22182218+ erasemode = 1;22192219+ }22202220+22212221+ mtip_set_timeout(dd, &fis, &timeout, erasemode);2221222222222223 /* Determine the correct transfer size.*/22232224 if (force_single_sector)
+3
drivers/block/mtip32xx/mtip32xx.h
···3333/* offset of Device Control register in PCIe extended capabilites space */3434#define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x4835353636+/* check for erase mode support during secure erase */3737+#define MTIP_SEC_ERASE_MODE 0x33838+3639/* # of times to retry timed out/failed IOs */3740#define MTIP_MAX_RETRIES 23841
···55 * http://www.gnu.org/licenses/gpl.html66 *77 * Maintainer:88- * Andreas Herrmann <andreas.herrmann3@amd.com>88+ * Andreas Herrmann <herrmann.der.user@googlemail.com>99 *1010 * Based on the powernow-k7.c module written by Dave Jones.1111 * (C) 2003 Dave Jones on behalf of SuSE Labs
+1-1
drivers/gpio/Kconfig
···47474848config OF_GPIO4949 def_bool y5050- depends on OF && !SPARC5050+ depends on OF51515252config DEBUG_GPIO5353 bool "Debug GPIO calls"
···244244 if (ret)245245 return ret;246246247247+ mvebu_gpio_set(chip, pin, value);248248+247249 spin_lock_irqsave(&mvchip->lock, flags);248250 u = readl_relaxed(mvebu_gpioreg_io_conf(mvchip));249251 u &= ~(1 << pin);···646644 ct->handler = handle_edge_irq;647645 ct->chip.name = mvchip->chip.label;648646649649- irq_setup_generic_chip(gc, IRQ_MSK(ngpios), IRQ_GC_INIT_MASK_CACHE,647647+ irq_setup_generic_chip(gc, IRQ_MSK(ngpios), 0,650648 IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE);651649652650 /* Setup irq domain on top of the generic chip. */
+35
drivers/gpio/gpio-omap.c
···251251 }252252}253253254254+/**255255+ * _clear_gpio_debounce - clear debounce settings for a gpio256256+ * @bank: the gpio bank we're acting upon257257+ * @gpio: the gpio number on this @gpio258258+ *259259+ * If a gpio is using debounce, then clear the debounce enable bit and if260260+ * this is the only gpio in this bank using debounce, then clear the debounce261261+ * time too. The debounce clock will also be disabled when calling this function262262+ * if this is the only gpio in the bank using debounce.263263+ */264264+static void _clear_gpio_debounce(struct gpio_bank *bank, unsigned gpio)265265+{266266+ u32 gpio_bit = GPIO_BIT(bank, gpio);267267+268268+ if (!bank->dbck_flag)269269+ return;270270+271271+ if (!(bank->dbck_enable_mask & gpio_bit))272272+ return;273273+274274+ bank->dbck_enable_mask &= ~gpio_bit;275275+ bank->context.debounce_en &= ~gpio_bit;276276+ __raw_writel(bank->context.debounce_en,277277+ bank->base + bank->regs->debounce_en);278278+279279+ if (!bank->dbck_enable_mask) {280280+ bank->context.debounce = 0;281281+ __raw_writel(bank->context.debounce, bank->base +282282+ bank->regs->debounce);283283+ clk_disable(bank->dbck);284284+ bank->dbck_enabled = false;285285+ }286286+}287287+254288static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio,255289 unsigned trigger)256290{···573539 _set_gpio_irqenable(bank, gpio, 0);574540 _clear_gpio_irqstatus(bank, gpio);575541 _set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), IRQ_TYPE_NONE);542542+ _clear_gpio_debounce(bank, gpio);576543}577544578545/* Use disable_irq_wake() and enable_irq_wake() functions from drivers */
···4343 * @manager: specific encoder has its own manager to control a hardware4444 * appropriately and we can access a hardware drawing on this manager.4545 * @dpms: store the encoder dpms value.4646+ * @updated: indicate whether overlay data updating is needed or not.4647 */4748struct exynos_drm_encoder {4849 struct drm_crtc *old_crtc;4950 struct drm_encoder drm_encoder;5051 struct exynos_drm_manager *manager;5151- int dpms;5252+ int dpms;5353+ bool updated;5254};53555456static void exynos_drm_connector_power(struct drm_encoder *encoder, int mode)···8785 switch (mode) {8886 case DRM_MODE_DPMS_ON:8987 if (manager_ops && manager_ops->apply)9090- manager_ops->apply(manager->dev);8888+ if (!exynos_encoder->updated)8989+ manager_ops->apply(manager->dev);9090+9191 exynos_drm_connector_power(encoder, mode);9292 exynos_encoder->dpms = mode;9393 break;···9894 case DRM_MODE_DPMS_OFF:9995 exynos_drm_connector_power(encoder, mode);10096 exynos_encoder->dpms = mode;9797+ exynos_encoder->updated = false;10198 break;10299 default:103100 DRM_ERROR("unspecified mode %d\n", mode);···210205211206static void exynos_drm_encoder_commit(struct drm_encoder *encoder)212207{213213- struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder);208208+ struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);209209+ struct exynos_drm_manager *manager = exynos_encoder->manager;214210 struct exynos_drm_manager_ops *manager_ops = manager->ops;215211216212 DRM_DEBUG_KMS("%s\n", __FILE__);217213218214 if (manager_ops && manager_ops->commit)219215 manager_ops->commit(manager->dev);216216+217217+ /*218218+ * this will avoid one issue that overlay data is updated to219219+ * real hardware two times.220220+ * And this variable will be used to check if the data was221221+ * already updated or not by exynos_drm_encoder_dpms function.222222+ */223223+ exynos_encoder->updated = true;220224}221225222226static void exynos_drm_encoder_disable(struct drm_encoder *encoder)···413399414400 if (manager_ops && manager_ops->dpms)415401 manager_ops->dpms(manager->dev, mode);416416-417417- /*418418- * set current mode to new one so that data aren't updated into419419- * registers by drm_helper_connector_dpms two times.420420- *421421- * in case that drm_crtc_helper_set_mode() is called,422422- * overlay_ops->commit() and manager_ops->commit() callbacks423423- * can be called two times, first at drm_crtc_helper_set_mode()424424- * and second at drm_helper_connector_dpms().425425- * so with this setting, when drm_helper_connector_dpms() is called426426- * encoder->funcs->dpms() will be ignored.427427- */428428- exynos_encoder->dpms = mode;429402430403 /*431404 * if this condition is ok then it means that the crtc is already
···341341 intel_ring_emit(ring, flip_addr);342342 intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);343343 /* turn overlay off */344344- intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_OFF);345345- intel_ring_emit(ring, flip_addr);346346- intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);344344+ if (IS_I830(dev)) {345345+ /* Workaround: Don't disable the overlay fully, since otherwise346346+ * it dies on the next OVERLAY_ON cmd. */347347+ intel_ring_emit(ring, MI_NOOP);348348+ intel_ring_emit(ring, MI_NOOP);349349+ intel_ring_emit(ring, MI_NOOP);350350+ } else {351351+ intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_OFF);352352+ intel_ring_emit(ring, flip_addr);353353+ intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);354354+ }347355 intel_ring_advance(ring);348356349357 return intel_overlay_do_wait_request(overlay, intel_overlay_off_tail);
+1-1
drivers/gpu/drm/i915/intel_panel.c
···435435 props.type = BACKLIGHT_RAW;436436 props.max_brightness = _intel_panel_get_max_backlight(dev);437437 if (props.max_brightness == 0) {438438- DRM_ERROR("Failed to get maximum backlight value\n");438438+ DRM_DEBUG_DRIVER("Failed to get maximum backlight value\n");439439 return -ENODEV;440440 }441441 dev_priv->backlight =
+42-20
drivers/gpu/drm/i915/intel_sdvo.c
···894894}895895#endif896896897897+static bool intel_sdvo_write_infoframe(struct intel_sdvo *intel_sdvo,898898+ unsigned if_index, uint8_t tx_rate,899899+ uint8_t *data, unsigned length)900900+{901901+ uint8_t set_buf_index[2] = { if_index, 0 };902902+ uint8_t hbuf_size, tmp[8];903903+ int i;904904+905905+ if (!intel_sdvo_set_value(intel_sdvo,906906+ SDVO_CMD_SET_HBUF_INDEX,907907+ set_buf_index, 2))908908+ return false;909909+910910+ if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HBUF_INFO,911911+ &hbuf_size, 1))912912+ return false;913913+914914+ /* Buffer size is 0 based, hooray! */915915+ hbuf_size++;916916+917917+ DRM_DEBUG_KMS("writing sdvo hbuf: %i, hbuf_size %i, hbuf_size: %i\n",918918+ if_index, length, hbuf_size);919919+920920+ for (i = 0; i < hbuf_size; i += 8) {921921+ memset(tmp, 0, 8);922922+ if (i < length)923923+ memcpy(tmp, data + i, min_t(unsigned, 8, length - i));924924+925925+ if (!intel_sdvo_set_value(intel_sdvo,926926+ SDVO_CMD_SET_HBUF_DATA,927927+ tmp, 8))928928+ return false;929929+ }930930+931931+ return intel_sdvo_set_value(intel_sdvo,932932+ SDVO_CMD_SET_HBUF_TXRATE,933933+ &tx_rate, 1);934934+}935935+897936static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo)898937{899938 struct dip_infoframe avi_if = {···940901 .ver = DIP_VERSION_AVI,941902 .len = DIP_LEN_AVI,942903 };943943- uint8_t tx_rate = SDVO_HBUF_TX_VSYNC;944944- uint8_t set_buf_index[2] = { 1, 0 };945904 uint8_t sdvo_data[4 + sizeof(avi_if.body.avi)];946946- uint64_t *data = (uint64_t *)sdvo_data;947947- unsigned i;948905949906 intel_dip_infoframe_csum(&avi_if);950907···950915 sdvo_data[3] = avi_if.checksum;951916 memcpy(&sdvo_data[4], &avi_if.body, sizeof(avi_if.body.avi));952917953953- if (!intel_sdvo_set_value(intel_sdvo,954954- SDVO_CMD_SET_HBUF_INDEX,955955- set_buf_index, 2))956956- return false;957957-958958- for (i = 0; i < sizeof(sdvo_data); i += 8) {959959- if (!intel_sdvo_set_value(intel_sdvo,960960- SDVO_CMD_SET_HBUF_DATA,961961- data, 8))962962- return false;963963- data++;964964- }965965-966966- return intel_sdvo_set_value(intel_sdvo,967967- SDVO_CMD_SET_HBUF_TXRATE,968968- &tx_rate, 1);918918+ return intel_sdvo_write_infoframe(intel_sdvo, SDVO_HBUF_INDEX_AVI_IF,919919+ SDVO_HBUF_TX_VSYNC,920920+ sdvo_data, sizeof(sdvo_data));969921}970922971923static bool intel_sdvo_set_tv_format(struct intel_sdvo *intel_sdvo)
···61616262 nv_subdev(pmc)->intr(nv_subdev(pmc));63636464- if (device->card_type >= NV_D0) {6565- if (nv_rd32(device, 0x000100) & 0x04000000)6666- nvd0_display_intr(dev);6767- } else6868- if (device->card_type >= NV_50) {6969- if (nv_rd32(device, 0x000100) & 0x04000000)7070- nv50_display_intr(dev);6464+ if (dev->mode_config.num_crtc) {6565+ if (device->card_type >= NV_D0) {6666+ if (nv_rd32(device, 0x000100) & 0x04000000)6767+ nvd0_display_intr(dev);6868+ } else6969+ if (device->card_type >= NV_50) {7070+ if (nv_rd32(device, 0x000100) & 0x04000000)7171+ nv50_display_intr(dev);7272+ }7173 }72747375 return IRQ_HANDLED;
+8-8
drivers/gpu/drm/nouveau/nv04_dac.c
···220220 NVWriteVgaCrtc(dev, 0, NV_CIO_CR_MODE_INDEX, saved_cr_mode);221221222222 if (blue == 0x18) {223223- NV_INFO(drm, "Load detected on head A\n");223223+ NV_DEBUG(drm, "Load detected on head A\n");224224 return connector_status_connected;225225 }226226···338338339339 if (nv17_dac_sample_load(encoder) &340340 NV_PRAMDAC_TEST_CONTROL_SENSEB_ALLHI) {341341- NV_INFO(drm, "Load detected on output %c\n",342342- '@' + ffs(dcb->or));341341+ NV_DEBUG(drm, "Load detected on output %c\n",342342+ '@' + ffs(dcb->or));343343 return connector_status_connected;344344 } else {345345 return connector_status_disconnected;···413413414414 helper->dpms(encoder, DRM_MODE_DPMS_ON);415415416416- NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n",417417- drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base),418418- nv_crtc->index, '@' + ffs(nv_encoder->dcb->or));416416+ NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n",417417+ drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base),418418+ nv_crtc->index, '@' + ffs(nv_encoder->dcb->or));419419}420420421421void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable)···461461 return;462462 nv_encoder->last_dpms = mode;463463464464- NV_INFO(drm, "Setting dpms mode %d on vga encoder (output %d)\n",465465- mode, nv_encoder->dcb->index);464464+ NV_DEBUG(drm, "Setting dpms mode %d on vga encoder (output %d)\n",465465+ mode, nv_encoder->dcb->index);466466467467 nv04_dac_update_dacclk(encoder, mode == DRM_MODE_DPMS_ON);468468}
+7-7
drivers/gpu/drm/nouveau/nv04_dfp.c
···476476477477 helper->dpms(encoder, DRM_MODE_DPMS_ON);478478479479- NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n",480480- drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base),481481- nv_crtc->index, '@' + ffs(nv_encoder->dcb->or));479479+ NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n",480480+ drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base),481481+ nv_crtc->index, '@' + ffs(nv_encoder->dcb->or));482482}483483484484static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode)···520520 return;521521 nv_encoder->last_dpms = mode;522522523523- NV_INFO(drm, "Setting dpms mode %d on lvds encoder (output %d)\n",524524- mode, nv_encoder->dcb->index);523523+ NV_DEBUG(drm, "Setting dpms mode %d on lvds encoder (output %d)\n",524524+ mode, nv_encoder->dcb->index);525525526526 if (was_powersaving && is_powersaving_dpms(mode))527527 return;···565565 return;566566 nv_encoder->last_dpms = mode;567567568568- NV_INFO(drm, "Setting dpms mode %d on tmds encoder (output %d)\n",569569- mode, nv_encoder->dcb->index);568568+ NV_DEBUG(drm, "Setting dpms mode %d on tmds encoder (output %d)\n",569569+ mode, nv_encoder->dcb->index);570570571571 nv04_dfp_update_backlight(encoder, mode);572572 nv04_dfp_update_fp_control(encoder, mode);
+4-5
drivers/gpu/drm/nouveau/nv04_tv.c
···7575 struct nv04_mode_state *state = &nv04_display(dev)->mode_reg;7676 uint8_t crtc1A;77777878- NV_INFO(drm, "Setting dpms mode %d on TV encoder (output %d)\n",7979- mode, nv_encoder->dcb->index);7878+ NV_DEBUG(drm, "Setting dpms mode %d on TV encoder (output %d)\n",7979+ mode, nv_encoder->dcb->index);80808181 state->pllsel &= ~(PLLSEL_TV_CRTC1_MASK | PLLSEL_TV_CRTC2_MASK);8282···167167168168 helper->dpms(encoder, DRM_MODE_DPMS_ON);169169170170- NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n",171171- drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), nv_crtc->index,172172- '@' + ffs(nv_encoder->dcb->or));170170+ NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n",171171+ drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), nv_crtc->index, '@' + ffs(nv_encoder->dcb->or));173172}174173175174static void nv04_tv_destroy(struct drm_encoder *encoder)
+31-23
drivers/gpu/drm/radeon/atombios_crtc.c
···16961696 return ATOM_PPLL2;16971697 DRM_ERROR("unable to allocate a PPLL\n");16981698 return ATOM_PPLL_INVALID;16991699- } else {17001700- if (ASIC_IS_AVIVO(rdev)) {17011701- /* in DP mode, the DP ref clock can come from either PPLL17021702- * depending on the asic:17031703- * DCE3: PPLL1 or PPLL217041704- */17051705- if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(radeon_crtc->encoder))) {17061706- /* use the same PPLL for all DP monitors */17071707- pll = radeon_get_shared_dp_ppll(crtc);17081708- if (pll != ATOM_PPLL_INVALID)17091709- return pll;17101710- } else {17111711- /* use the same PPLL for all monitors with the same clock */17121712- pll = radeon_get_shared_nondp_ppll(crtc);17131713- if (pll != ATOM_PPLL_INVALID)17141714- return pll;17151715- }17161716- /* all other cases */17171717- pll_in_use = radeon_get_pll_use_mask(crtc);16991699+ } else if (ASIC_IS_AVIVO(rdev)) {17001700+ /* in DP mode, the DP ref clock can come from either PPLL17011701+ * depending on the asic:17021702+ * DCE3: PPLL1 or PPLL217031703+ */17041704+ if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(radeon_crtc->encoder))) {17051705+ /* use the same PPLL for all DP monitors */17061706+ pll = radeon_get_shared_dp_ppll(crtc);17071707+ if (pll != ATOM_PPLL_INVALID)17081708+ return pll;17091709+ } else {17101710+ /* use the same PPLL for all monitors with the same clock */17111711+ pll = radeon_get_shared_nondp_ppll(crtc);17121712+ if (pll != ATOM_PPLL_INVALID)17131713+ return pll;17141714+ }17151715+ /* all other cases */17161716+ pll_in_use = radeon_get_pll_use_mask(crtc);17171717+ /* the order shouldn't matter here, but we probably17181718+ * need this until we have atomic modeset17191719+ */17201720+ if (rdev->flags & RADEON_IS_IGP) {17181721 if (!(pll_in_use & (1 << ATOM_PPLL1)))17191722 return ATOM_PPLL1;17201723 if (!(pll_in_use & (1 << ATOM_PPLL2)))17211724 return ATOM_PPLL2;17221722- DRM_ERROR("unable to allocate a PPLL\n");17231723- return ATOM_PPLL_INVALID;17241725 } else {17251725- /* on pre-R5xx asics, the crtc to pll mapping is hardcoded */17261726- return radeon_crtc->crtc_id;17261726+ if (!(pll_in_use & (1 << ATOM_PPLL2)))17271727+ return ATOM_PPLL2;17281728+ if (!(pll_in_use & (1 << ATOM_PPLL1)))17291729+ return ATOM_PPLL1;17271730 }17311731+ DRM_ERROR("unable to allocate a PPLL\n");17321732+ return ATOM_PPLL_INVALID;17331733+ } else {17341734+ /* on pre-R5xx asics, the crtc to pll mapping is hardcoded */17351735+ return radeon_crtc->crtc_id;17281736 }17291737}17301738
+1-1
drivers/gpu/drm/radeon/evergreen.c
···13721372 WREG32(BIF_FB_EN, FB_READ_EN | FB_WRITE_EN);1373137313741374 for (i = 0; i < rdev->num_crtc; i++) {13751375- if (save->crtc_enabled) {13751375+ if (save->crtc_enabled[i]) {13761376 if (ASIC_IS_DCE6(rdev)) {13771377 tmp = RREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i]);13781378 tmp |= EVERGREEN_CRTC_BLANK_DATA_EN;
···352352}353353354354/**355355- * radeon_atpx_switchto - switch to the requested GPU355355+ * radeon_atpx_power_state - power down/up the requested GPU356356 *357357- * @id: GPU to switch to357357+ * @id: GPU to power down/up358358 * @state: requested power state (0 = off, 1 = on)359359 *360360 * Execute the necessary ATPX function to power down/up the discrete GPU
+21-7
drivers/gpu/drm/radeon/radeon_connectors.c
···941941 struct drm_mode_object *obj;942942 int i;943943 enum drm_connector_status ret = connector_status_disconnected;944944- bool dret = false;944944+ bool dret = false, broken_edid = false;945945946946 if (!force && radeon_check_hpd_status_unchanged(connector))947947 return connector->status;···965965 ret = connector_status_disconnected;966966 DRM_ERROR("%s: detected RS690 floating bus bug, stopping ddc detect\n", drm_get_connector_name(connector));967967 radeon_connector->ddc_bus = NULL;968968+ } else {969969+ ret = connector_status_connected;970970+ broken_edid = true; /* defer use_digital to later */968971 }969972 } else {970973 radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL);···1050104710511048 encoder_funcs = encoder->helper_private;10521049 if (encoder_funcs->detect) {10531053- if (ret != connector_status_connected) {10541054- ret = encoder_funcs->detect(encoder, connector);10551055- if (ret == connector_status_connected) {10561056- radeon_connector->use_digital = false;10501050+ if (!broken_edid) {10511051+ if (ret != connector_status_connected) {10521052+ /* deal with analog monitors without DDC */10531053+ ret = encoder_funcs->detect(encoder, connector);10541054+ if (ret == connector_status_connected) {10551055+ radeon_connector->use_digital = false;10561056+ }10571057+ if (ret != connector_status_disconnected)10581058+ radeon_connector->detected_by_load = true;10571059 }10581058- if (ret != connector_status_disconnected)10591059- radeon_connector->detected_by_load = true;10601060+ } else {10611061+ enum drm_connector_status lret;10621062+ /* assume digital unless load detected otherwise */10631063+ radeon_connector->use_digital = true;10641064+ lret = encoder_funcs->detect(encoder, connector);10651065+ DRM_DEBUG_KMS("load_detect %x returned: %x\n",encoder->encoder_type,lret);10661066+ if (lret == connector_status_connected)10671067+ radeon_connector->use_digital = false;10601068 }10611069 break;10621070 }
+13-2
drivers/gpu/drm/radeon/radeon_legacy_crtc.c
···295295 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);296296 struct drm_device *dev = crtc->dev;297297 struct radeon_device *rdev = dev->dev_private;298298+ uint32_t crtc_ext_cntl = 0;298299 uint32_t mask;299300300301 if (radeon_crtc->crtc_id)···308307 RADEON_CRTC_VSYNC_DIS |309308 RADEON_CRTC_HSYNC_DIS);310309310310+ /*311311+ * On all dual CRTC GPUs this bit controls the CRTC of the primary DAC.312312+ * Therefore it is set in the DAC DMPS function.313313+ * This is different for GPU's with a single CRTC but a primary and a314314+ * TV DAC: here it controls the single CRTC no matter where it is315315+ * routed. Therefore we set it here.316316+ */317317+ if (rdev->flags & RADEON_SINGLE_CRTC)318318+ crtc_ext_cntl = RADEON_CRTC_CRT_ON;319319+311320 switch (mode) {312321 case DRM_MODE_DPMS_ON:313322 radeon_crtc->enabled = true;···328317 else {329318 WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_EN, ~(RADEON_CRTC_EN |330319 RADEON_CRTC_DISP_REQ_EN_B));331331- WREG32_P(RADEON_CRTC_EXT_CNTL, 0, ~mask);320320+ WREG32_P(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl, ~(mask | crtc_ext_cntl));332321 }333322 drm_vblank_post_modeset(dev, radeon_crtc->crtc_id);334323 radeon_crtc_load_lut(crtc);···342331 else {343332 WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_DISP_REQ_EN_B, ~(RADEON_CRTC_EN |344333 RADEON_CRTC_DISP_REQ_EN_B));345345- WREG32_P(RADEON_CRTC_EXT_CNTL, mask, ~mask);334334+ WREG32_P(RADEON_CRTC_EXT_CNTL, mask, ~(mask | crtc_ext_cntl));346335 }347336 radeon_crtc->enabled = false;348337 /* adjust pm to dpms changes AFTER disabling crtcs */
···24742474 /* check config regs */24752475 switch (reg) {24762476 case GRBM_GFX_INDEX:24772477+ case CP_STRMOUT_CNTL:24772478 case VGT_VTX_VECT_EJECT_REG:24782479 case VGT_CACHE_INVALIDATION:24792480 case VGT_ESGS_RING_SIZE:
···2828#define MS_RDESC 0x082929#define MS_NOGET 0x103030#define MS_DUPLICATE_USAGES 0x203131+#define MS_RDESC_3K 0x4031323232-/*3333- * Microsoft Wireless Desktop Receiver (Model 1028) has3434- * 'Usage Min/Max' where it ought to have 'Physical Min/Max'3535- */3633static __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc,3734 unsigned int *rsize)3835{3936 unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);40373838+ /*3939+ * Microsoft Wireless Desktop Receiver (Model 1028) has4040+ * 'Usage Min/Max' where it ought to have 'Physical Min/Max'4141+ */4142 if ((quirks & MS_RDESC) && *rsize == 571 && rdesc[557] == 0x19 &&4243 rdesc[559] == 0x29) {4344 hid_info(hdev, "fixing up Microsoft Wireless Receiver Model 1028 report descriptor\n");4445 rdesc[557] = 0x35;4546 rdesc[559] = 0x45;4747+ }4848+ /* the same as above (s/usage/physical/) */4949+ if ((quirks & MS_RDESC_3K) && *rsize == 106 &&5050+ !memcmp((char []){ 0x19, 0x00, 0x29, 0xff },5151+ &rdesc[94], 4)) {5252+ rdesc[94] = 0x35;5353+ rdesc[96] = 0x45;4654 }4755 return rdesc;4856}···200192 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB),201193 .driver_data = MS_PRESENTER },202194 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K),203203- .driver_data = MS_ERGONOMY },195195+ .driver_data = MS_ERGONOMY | MS_RDESC_3K },204196 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0),205197 .driver_data = MS_NOGET },206198 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500),
+2-3
drivers/hid/hid-multitouch.c
···210210 },211211 { .name = MT_CLS_GENERALTOUCH_PWT_TENFINGERS,212212 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |213213- MT_QUIRK_SLOT_IS_CONTACTNUMBER,214214- .maxcontacts = 10213213+ MT_QUIRK_SLOT_IS_CONTACTNUMBER215214 },216215217216 { .name = MT_CLS_FLATFROG,···420421 * contact max are global to the report */421422 td->last_field_index = field->index;422423 return -1;423423- }424424 case HID_DG_TOUCH:425425 /* Legacy devices use TIPSWITCH and not TOUCH.426426 * Let's just ignore this field. */427427 return -1;428428+ }428429 /* let hid-input decide for the others */429430 return 0;430431
+43-26
drivers/hid/hidraw.c
···4242static struct class *hidraw_class;4343static struct hidraw *hidraw_table[HIDRAW_MAX_DEVICES];4444static DEFINE_MUTEX(minors_lock);4545-static void drop_ref(struct hidraw *hid, int exists_bit);46454746static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)4847{···113114 __u8 *buf;114115 int ret = 0;115116116116- if (!hidraw_table[minor] || !hidraw_table[minor]->exist) {117117+ if (!hidraw_table[minor]) {117118 ret = -ENODEV;118119 goto out;119120 }···261262 }262263263264 mutex_lock(&minors_lock);264264- if (!hidraw_table[minor] || !hidraw_table[minor]->exist) {265265+ if (!hidraw_table[minor]) {265266 err = -ENODEV;266267 goto out_unlock;267268 }···298299static int hidraw_release(struct inode * inode, struct file * file)299300{300301 unsigned int minor = iminor(inode);302302+ struct hidraw *dev;301303 struct hidraw_list *list = file->private_data;304304+ int ret;305305+ int i;302306303303- drop_ref(hidraw_table[minor], 0);307307+ mutex_lock(&minors_lock);308308+ if (!hidraw_table[minor]) {309309+ ret = -ENODEV;310310+ goto unlock;311311+ }312312+304313 list_del(&list->node);314314+ dev = hidraw_table[minor];315315+ if (!--dev->open) {316316+ if (list->hidraw->exist) {317317+ hid_hw_power(dev->hid, PM_HINT_NORMAL);318318+ hid_hw_close(dev->hid);319319+ } else {320320+ kfree(list->hidraw);321321+ }322322+ }323323+324324+ for (i = 0; i < HIDRAW_BUFFER_SIZE; ++i)325325+ kfree(list->buffer[i].value);305326 kfree(list);306306- return 0;327327+ ret = 0;328328+unlock:329329+ mutex_unlock(&minors_lock);330330+331331+ return ret;307332}308333309334static long hidraw_ioctl(struct file *file, unsigned int cmd,···529506void hidraw_disconnect(struct hid_device *hid)530507{531508 struct hidraw *hidraw = hid->hidraw;532532- drop_ref(hidraw, 1);509509+510510+ mutex_lock(&minors_lock);511511+ hidraw->exist = 0;512512+513513+ device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));514514+515515+ hidraw_table[hidraw->minor] = NULL;516516+517517+ if (hidraw->open) {518518+ hid_hw_close(hid);519519+ wake_up_interruptible(&hidraw->wait);520520+ } else {521521+ kfree(hidraw);522522+ }523523+ mutex_unlock(&minors_lock);533524}534525EXPORT_SYMBOL_GPL(hidraw_disconnect);535526···591554 class_destroy(hidraw_class);592555 unregister_chrdev_region(dev_id, HIDRAW_MAX_DEVICES);593556594594-}595595-596596-static void drop_ref(struct hidraw *hidraw, int exists_bit)597597-{598598- mutex_lock(&minors_lock);599599- if (exists_bit) {600600- hid_hw_close(hidraw->hid);601601- hidraw->exist = 0;602602- if (hidraw->open)603603- wake_up_interruptible(&hidraw->wait);604604- } else {605605- --hidraw->open;606606- }607607-608608- if (!hidraw->open && !hidraw->exist) {609609- device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));610610- hidraw_table[hidraw->minor] = NULL;611611- kfree(hidraw);612612- }613613- mutex_unlock(&minors_lock);614557}
+1-1
drivers/hwmon/asb100.c
···3232 * ASB100-A supports pwm1, while plain ASB100 does not. There is no known3333 * way for the driver to tell which one is there.3434 *3535- * Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA3535+ * Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA3636 * asb100 7 3 1 4 0x31 0x0694 yes no3737 */3838
+2-2
drivers/hwmon/fam15h_power.c
···22 * fam15h_power.c - AMD Family 15h processor power monitoring33 *44 * Copyright (c) 2011 Advanced Micro Devices, Inc.55- * Author: Andreas Herrmann <andreas.herrmann3@amd.com>55+ * Author: Andreas Herrmann <herrmann.der.user@googlemail.com>66 *77 *88 * This driver is free software; you can redistribute it and/or···2828#include <asm/processor.h>29293030MODULE_DESCRIPTION("AMD Family 15h CPU processor power monitor");3131-MODULE_AUTHOR("Andreas Herrmann <andreas.herrmann3@amd.com>");3131+MODULE_AUTHOR("Andreas Herrmann <herrmann.der.user@googlemail.com>");3232MODULE_LICENSE("GPL");33333434/* D18F3 */
···20832083 mutex_init(&data->lock);20842084 mutex_init(&data->update_lock);20852085 data->name = w83627ehf_device_names[sio_data->kind];20862086+ data->bank = 0xff; /* Force initial bank selection */20862087 platform_set_drvdata(pdev, data);2087208820882089 /* 627EHG and 627EHF have 10 voltage inputs; 627DHG and 667HG have 9 */
···8181 tristate "Intel 82801 (ICH/PCH)"8282 depends on PCI8383 select CHECK_SIGNATURE if X86 && DMI8484- select GPIOLIB if I2C_MUX8584 help8685 If you say yes to this option, support will be included for the Intel8786 801 family of mainboard I2C interfaces. Specifically, the following
···22 i2c-stub.c - I2C/SMBus chip emulator3344 Copyright (c) 2004 Mark M. Hoffman <mhoffman@lightlink.com>55- Copyright (C) 2007 Jean Delvare <khali@linux-fr.org>55+ Copyright (C) 2007, 2012 Jean Delvare <khali@linux-fr.org>6677 This program is free software; you can redistribute it and/or modify88 it under the terms of the GNU General Public License as published by···5151static struct stub_chip *stub_chips;52525353/* Return negative errno on error. */5454-static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags,5555- char read_write, u8 command, int size, union i2c_smbus_data * data)5454+static s32 stub_xfer(struct i2c_adapter *adap, u16 addr, unsigned short flags,5555+ char read_write, u8 command, int size, union i2c_smbus_data *data)5656{5757 s32 ret;5858 int i, len;···7878 case I2C_SMBUS_BYTE:7979 if (read_write == I2C_SMBUS_WRITE) {8080 chip->pointer = command;8181- dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, "8282- "wrote 0x%02x.\n",8383- addr, command);8181+ dev_dbg(&adap->dev,8282+ "smbus byte - addr 0x%02x, wrote 0x%02x.\n",8383+ addr, command);8484 } else {8585 data->byte = chip->words[chip->pointer++] & 0xff;8686- dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, "8787- "read 0x%02x.\n",8888- addr, data->byte);8686+ dev_dbg(&adap->dev,8787+ "smbus byte - addr 0x%02x, read 0x%02x.\n",8888+ addr, data->byte);8989 }90909191 ret = 0;···9595 if (read_write == I2C_SMBUS_WRITE) {9696 chip->words[command] &= 0xff00;9797 chip->words[command] |= data->byte;9898- dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, "9999- "wrote 0x%02x at 0x%02x.\n",100100- addr, data->byte, command);9898+ dev_dbg(&adap->dev,9999+ "smbus byte data - addr 0x%02x, wrote 0x%02x at 0x%02x.\n",100100+ addr, data->byte, command);101101 } else {102102 data->byte = chip->words[command] & 0xff;103103- dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, "104104- "read 0x%02x at 0x%02x.\n",105105- addr, data->byte, command);103103+ dev_dbg(&adap->dev,104104+ "smbus byte data - addr 0x%02x, read 0x%02x at 0x%02x.\n",105105+ addr, data->byte, command);106106 }107107 chip->pointer = command + 1;108108···112112 case I2C_SMBUS_WORD_DATA:113113 if (read_write == I2C_SMBUS_WRITE) {114114 chip->words[command] = data->word;115115- dev_dbg(&adap->dev, "smbus word data - addr 0x%02x, "116116- "wrote 0x%04x at 0x%02x.\n",117117- addr, data->word, command);115115+ dev_dbg(&adap->dev,116116+ "smbus word data - addr 0x%02x, wrote 0x%04x at 0x%02x.\n",117117+ addr, data->word, command);118118 } else {119119 data->word = chip->words[command];120120- dev_dbg(&adap->dev, "smbus word data - addr 0x%02x, "121121- "read 0x%04x at 0x%02x.\n",122122- addr, data->word, command);120120+ dev_dbg(&adap->dev,121121+ "smbus word data - addr 0x%02x, read 0x%04x at 0x%02x.\n",122122+ addr, data->word, command);123123 }124124125125 ret = 0;···132132 chip->words[command + i] &= 0xff00;133133 chip->words[command + i] |= data->block[1 + i];134134 }135135- dev_dbg(&adap->dev, "i2c block data - addr 0x%02x, "136136- "wrote %d bytes at 0x%02x.\n",137137- addr, len, command);135135+ dev_dbg(&adap->dev,136136+ "i2c block data - addr 0x%02x, wrote %d bytes at 0x%02x.\n",137137+ addr, len, command);138138 } else {139139 for (i = 0; i < len; i++) {140140 data->block[1 + i] =141141 chip->words[command + i] & 0xff;142142 }143143- dev_dbg(&adap->dev, "i2c block data - addr 0x%02x, "144144- "read %d bytes at 0x%02x.\n",145145- addr, len, command);143143+ dev_dbg(&adap->dev,144144+ "i2c block data - addr 0x%02x, read %d bytes at 0x%02x.\n",145145+ addr, len, command);146146 }147147148148 ret = 0;···179179 int i, ret;180180181181 if (!chip_addr[0]) {182182- printk(KERN_ERR "i2c-stub: Please specify a chip address\n");182182+ pr_err("i2c-stub: Please specify a chip address\n");183183 return -ENODEV;184184 }185185186186 for (i = 0; i < MAX_CHIPS && chip_addr[i]; i++) {187187 if (chip_addr[i] < 0x03 || chip_addr[i] > 0x77) {188188- printk(KERN_ERR "i2c-stub: Invalid chip address "189189- "0x%02x\n", chip_addr[i]);188188+ pr_err("i2c-stub: Invalid chip address 0x%02x\n",189189+ chip_addr[i]);190190 return -EINVAL;191191 }192192193193- printk(KERN_INFO "i2c-stub: Virtual chip at 0x%02x\n",194194- chip_addr[i]);193193+ pr_info("i2c-stub: Virtual chip at 0x%02x\n", chip_addr[i]);195194 }196195197196 /* Allocate memory for all chips at once */198197 stub_chips = kzalloc(i * sizeof(struct stub_chip), GFP_KERNEL);199198 if (!stub_chips) {200200- printk(KERN_ERR "i2c-stub: Out of memory\n");199199+ pr_err("i2c-stub: Out of memory\n");201200 return -ENOMEM;202201 }203202···218219219220module_init(i2c_stub_init);220221module_exit(i2c_stub_exit);221221-
+1-1
drivers/i2c/busses/i2c-tegra.c
···742742 }743743744744 ret = devm_request_irq(&pdev->dev, i2c_dev->irq,745745- tegra_i2c_isr, 0, pdev->name, i2c_dev);745745+ tegra_i2c_isr, 0, dev_name(&pdev->dev), i2c_dev);746746 if (ret) {747747 dev_err(&pdev->dev, "Failed to request irq %i\n", i2c_dev->irq);748748 return ret;
+1
drivers/input/keyboard/Kconfig
···335335config KEYBOARD_LPC32XX336336 tristate "LPC32XX matrix key scanner support"337337 depends on ARCH_LPC32XX && OF338338+ select INPUT_MATRIXKMAP338339 help339340 Say Y here if you want to use NXP LPC32XX SoC key scanner interface,340341 connected to a key matrix.
+3
drivers/input/keyboard/pxa27x_keypad.c
···368368 unsigned int mask = 0, direct_key_num = 0;369369 unsigned long kpc = 0;370370371371+ /* clear pending interrupt bit */372372+ keypad_readl(KPC);373373+371374 /* enable matrix keys with automatic scan */372375 if (pdata->matrix_key_rows && pdata->matrix_key_cols) {373376 kpc |= KPC_ASACT | KPC_MIE | KPC_ME | KPC_MS_ALL;
+4-1
drivers/input/misc/xen-kbdfront.c
···311311 case XenbusStateReconfiguring:312312 case XenbusStateReconfigured:313313 case XenbusStateUnknown:314314- case XenbusStateClosed:315314 break;316315317316 case XenbusStateInitWait:···349350350351 break;351352353353+ case XenbusStateClosed:354354+ if (dev->state == XenbusStateClosed)355355+ break;356356+ /* Missed the backend's CLOSING state -- fallthrough */352357 case XenbusStateClosing:353358 xenbus_frontend_closed(dev);354359 break;
···239239240240config TOUCHSCREEN_EGALAX241241 tristate "EETI eGalax multi-touch panel support"242242- depends on I2C242242+ depends on I2C && OF243243 help244244 Say Y here to enable support for I2C connected EETI245245 eGalax multi-touch panels.
+21-2
drivers/input/touchscreen/egalax_ts.c
···2828#include <linux/slab.h>2929#include <linux/bitops.h>3030#include <linux/input/mt.h>3131+#include <linux/of_gpio.h>31323233/*3334 * Mouse Mode: some panel may configure the controller to mouse mode,···123122/* wake up controller by an falling edge of interrupt gpio. */124123static int egalax_wake_up_device(struct i2c_client *client)125124{126126- int gpio = irq_to_gpio(client->irq);125125+ struct device_node *np = client->dev.of_node;126126+ int gpio;127127 int ret;128128+129129+ if (!np)130130+ return -ENODEV;131131+132132+ gpio = of_get_named_gpio(np, "wakeup-gpios", 0);133133+ if (!gpio_is_valid(gpio))134134+ return -ENODEV;128135129136 ret = gpio_request(gpio, "egalax_irq");130137 if (ret < 0) {···190181 ts->input_dev = input_dev;191182192183 /* controller may be in sleep, wake it up. */193193- egalax_wake_up_device(client);184184+ error = egalax_wake_up_device(client);185185+ if (error) {186186+ dev_err(&client->dev, "Failed to wake up the controller\n");187187+ goto err_free_dev;188188+ }194189195190 ret = egalax_firmware_version(client);196191 if (ret < 0) {···287274288275static SIMPLE_DEV_PM_OPS(egalax_ts_pm_ops, egalax_ts_suspend, egalax_ts_resume);289276277277+static struct of_device_id egalax_ts_dt_ids[] = {278278+ { .compatible = "eeti,egalax_ts" },279279+ { /* sentinel */ }280280+};281281+290282static struct i2c_driver egalax_ts_driver = {291283 .driver = {292284 .name = "egalax_ts",293285 .owner = THIS_MODULE,294286 .pm = &egalax_ts_pm_ops,287287+ .of_match_table = of_match_ptr(egalax_ts_dt_ids),295288 },296289 .id_table = egalax_ts_id,297290 .probe = egalax_ts_probe,
···4455menuconfig ISDN66 bool "ISDN support"77- depends on NET77+ depends on NET && NETDEVICES88 depends on !S390 && !UML99 ---help---1010 ISDN ("Integrated Services Digital Network", called RNIS in France)
+1-1
drivers/isdn/i4l/Kconfig
···6677config ISDN_PPP88 bool "Support synchronous PPP"99- depends on INET && NETDEVICES99+ depends on INET1010 select SLHC1111 help1212 Over digital connections such as ISDN, there is no need to
-4
drivers/isdn/i4l/isdn_common.c
···13121312 } else13131313 return -EINVAL;13141314 break;13151315-#ifdef CONFIG_NETDEVICES13161315 case IIOCNETGPN:13171316 /* Get peer phone number of a connected13181317 * isdn network interface */···13211322 return isdn_net_getpeer(&phone, argp);13221323 } else13231324 return -EINVAL;13241324-#endif13251325 default:13261326 return -EINVAL;13271327 }···13501352 case IIOCNETLCR:13511353 printk(KERN_INFO "INFO: ISDN_ABC_LCR_SUPPORT not enabled\n");13521354 return -ENODEV;13531353-#ifdef CONFIG_NETDEVICES13541355 case IIOCNETAIF:13551356 /* Add a network-interface */13561357 if (arg) {···14881491 return -EFAULT;14891492 return isdn_net_force_hangup(name);14901493 break;14911491-#endif /* CONFIG_NETDEVICES */14921494 case IIOCSETVER:14931495 dev->net_verbose = arg;14941496 printk(KERN_INFO "isdn: Verbose-Level is %d\n", dev->net_verbose);
···27102710 || disk_idx < 0)27112711 continue;27122712 if (test_bit(Replacement, &rdev->flags))27132713- disk = conf->mirrors + conf->raid_disks + disk_idx;27132713+ disk = conf->mirrors + mddev->raid_disks + disk_idx;27142714 else27152715 disk = conf->mirrors + disk_idx;27162716
+9-6
drivers/md/raid10.c
···17831783 clear_bit(Unmerged, &rdev->flags);17841784 }17851785 md_integrity_add_rdev(rdev, mddev);17861786- if (blk_queue_discard(bdev_get_queue(rdev->bdev)))17861786+ if (mddev->queue && blk_queue_discard(bdev_get_queue(rdev->bdev)))17871787 queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);1788178817891789 print_conf(conf);···36133613 discard_supported = true;36143614 }3615361536163616- if (discard_supported)36173617- queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);36183618- else36193619- queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);36203620-36163616+ if (mddev->queue) {36173617+ if (discard_supported)36183618+ queue_flag_set_unlocked(QUEUE_FLAG_DISCARD,36193619+ mddev->queue);36203620+ else36213621+ queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD,36223622+ mddev->queue);36233623+ }36213624 /* need to check that every block has at least one working mirror */36223625 if (!enough(conf, -1)) {36233626 printk(KERN_ERR "md/raid10:%s: not enough operational mirrors.\n",
···11961196 return ERR_PTR(-ENODEV);11971197 }1198119811991199- if (pci_resource_len(pdev, bar) != 0x100) {11991199+ if (pci_resource_len(pdev, bar) < 0x100) {12001200 dev_err(&pdev->dev, "Invalid iomem size. You may "12011201 "experience problems.\n");12021202 }
+7
drivers/mmc/host/sdhci-pltfm.c
···150150 goto err_remap;151151 }152152153153+ /*154154+ * Some platforms need to probe the controller to be able to155155+ * determine which caps should be used.156156+ */157157+ if (host->ops && host->ops->platform_init)158158+ host->ops->platform_init(host);159159+153160 platform_set_drvdata(pdev, host);154161155162 return host;
+16-14
drivers/mmc/host/sdhci-s3c.c
···211211 if (ourhost->cur_clk != best_src) {212212 struct clk *clk = ourhost->clk_bus[best_src];213213214214- clk_enable(clk);215215- clk_disable(ourhost->clk_bus[ourhost->cur_clk]);214214+ clk_prepare_enable(clk);215215+ clk_disable_unprepare(ourhost->clk_bus[ourhost->cur_clk]);216216217217 /* turn clock off to card before changing clock source */218218 writew(0, host->ioaddr + SDHCI_CLOCK_CONTROL);···607607 }608608609609 /* enable the local io clock and keep it running for the moment. */610610- clk_enable(sc->clk_io);610610+ clk_prepare_enable(sc->clk_io);611611612612 for (clks = 0, ptr = 0; ptr < MAX_BUS_CLK; ptr++) {613613 struct clk *clk;···638638 }639639640640#ifndef CONFIG_PM_RUNTIME641641- clk_enable(sc->clk_bus[sc->cur_clk]);641641+ clk_prepare_enable(sc->clk_bus[sc->cur_clk]);642642#endif643643644644 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);···747747 sdhci_s3c_setup_card_detect_gpio(sc);748748749749#ifdef CONFIG_PM_RUNTIME750750- clk_disable(sc->clk_io);750750+ if (pdata->cd_type != S3C_SDHCI_CD_INTERNAL)751751+ clk_disable_unprepare(sc->clk_io);751752#endif752753 return 0;753754754755 err_req_regs:755756#ifndef CONFIG_PM_RUNTIME756756- clk_disable(sc->clk_bus[sc->cur_clk]);757757+ clk_disable_unprepare(sc->clk_bus[sc->cur_clk]);757758#endif758759 for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {759760 if (sc->clk_bus[ptr]) {···763762 }764763765764 err_no_busclks:766766- clk_disable(sc->clk_io);765765+ clk_disable_unprepare(sc->clk_io);767766 clk_put(sc->clk_io);768767769768 err_io_clk:···795794 gpio_free(sc->ext_cd_gpio);796795797796#ifdef CONFIG_PM_RUNTIME798798- clk_enable(sc->clk_io);797797+ if (pdata->cd_type != S3C_SDHCI_CD_INTERNAL)798798+ clk_prepare_enable(sc->clk_io);799799#endif800800 sdhci_remove_host(host, 1);801801···804802 pm_runtime_disable(&pdev->dev);805803806804#ifndef CONFIG_PM_RUNTIME807807- clk_disable(sc->clk_bus[sc->cur_clk]);805805+ clk_disable_unprepare(sc->clk_bus[sc->cur_clk]);808806#endif809807 for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {810808 if (sc->clk_bus[ptr]) {811809 clk_put(sc->clk_bus[ptr]);812810 }813811 }814814- clk_disable(sc->clk_io);812812+ clk_disable_unprepare(sc->clk_io);815813 clk_put(sc->clk_io);816814817815 if (pdev->dev.of_node) {···851849852850 ret = sdhci_runtime_suspend_host(host);853851854854- clk_disable(ourhost->clk_bus[ourhost->cur_clk]);855855- clk_disable(busclk);852852+ clk_disable_unprepare(ourhost->clk_bus[ourhost->cur_clk]);853853+ clk_disable_unprepare(busclk);856854 return ret;857855}858856···863861 struct clk *busclk = ourhost->clk_io;864862 int ret;865863866866- clk_enable(busclk);867867- clk_enable(ourhost->clk_bus[ourhost->cur_clk]);864864+ clk_prepare_enable(busclk);865865+ clk_prepare_enable(ourhost->clk_bus[ourhost->cur_clk]);868866 ret = sdhci_runtime_resume_host(host);869867 return ret;870868}
+27-15
drivers/mmc/host/sdhci.c
···13151315 */13161316 if ((host->flags & SDHCI_NEEDS_RETUNING) &&13171317 !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ))) {13181318- /* eMMC uses cmd21 while sd and sdio use cmd19 */13191319- tuning_opcode = mmc->card->type == MMC_TYPE_MMC ?13201320- MMC_SEND_TUNING_BLOCK_HS200 :13211321- MMC_SEND_TUNING_BLOCK;13221322- spin_unlock_irqrestore(&host->lock, flags);13231323- sdhci_execute_tuning(mmc, tuning_opcode);13241324- spin_lock_irqsave(&host->lock, flags);13181318+ if (mmc->card) {13191319+ /* eMMC uses cmd21 but sd and sdio use cmd19 */13201320+ tuning_opcode =13211321+ mmc->card->type == MMC_TYPE_MMC ?13221322+ MMC_SEND_TUNING_BLOCK_HS200 :13231323+ MMC_SEND_TUNING_BLOCK;13241324+ spin_unlock_irqrestore(&host->lock, flags);13251325+ sdhci_execute_tuning(mmc, tuning_opcode);13261326+ spin_lock_irqsave(&host->lock, flags);1325132713261326- /* Restore original mmc_request structure */13271327- host->mrq = mrq;13281328+ /* Restore original mmc_request structure */13291329+ host->mrq = mrq;13301330+ }13281331 }1329133213301333 if (mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23))···28402837 if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA))28412838 mmc->caps |= MMC_CAP_4_BIT_DATA;2842283928402840+ if (host->quirks2 & SDHCI_QUIRK2_HOST_NO_CMD23)28412841+ mmc->caps &= ~MMC_CAP_CMD23;28422842+28432843 if (caps[0] & SDHCI_CAN_DO_HISPD)28442844 mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;28452845···2852284628532847 /* If vqmmc regulator and no 1.8V signalling, then there's no UHS */28542848 host->vqmmc = regulator_get(mmc_dev(mmc), "vqmmc");28552855- if (IS_ERR(host->vqmmc)) {28562856- pr_info("%s: no vqmmc regulator found\n", mmc_hostname(mmc));28572857- host->vqmmc = NULL;28492849+ if (IS_ERR_OR_NULL(host->vqmmc)) {28502850+ if (PTR_ERR(host->vqmmc) < 0) {28512851+ pr_info("%s: no vqmmc regulator found\n",28522852+ mmc_hostname(mmc));28532853+ host->vqmmc = NULL;28542854+ }28582855 }28592856 else if (regulator_is_supported_voltage(host->vqmmc, 1800000, 1800000))28602857 regulator_enable(host->vqmmc);···29132904 ocr_avail = 0;2914290529152906 host->vmmc = regulator_get(mmc_dev(mmc), "vmmc");29162916- if (IS_ERR(host->vmmc)) {29172917- pr_info("%s: no vmmc regulator found\n", mmc_hostname(mmc));29182918- host->vmmc = NULL;29072907+ if (IS_ERR_OR_NULL(host->vmmc)) {29082908+ if (PTR_ERR(host->vmmc) < 0) {29092909+ pr_info("%s: no vmmc regulator found\n",29102910+ mmc_hostname(mmc));29112911+ host->vmmc = NULL;29122912+ }29192913 } else29202914 regulator_enable(host->vmmc);29212915
···10601060 goto out;10611061 }1062106210631063- sscanf(buf, "%16s", ifname); /* IFNAMSIZ */10631063+ sscanf(buf, "%15s", ifname); /* IFNAMSIZ */1064106410651065 /* check to see if we are clearing primary */10661066 if (!strlen(ifname) || buf[0] == '\n') {···12371237 goto out;12381238 }1239123912401240- sscanf(buf, "%16s", ifname); /* IFNAMSIZ */12401240+ sscanf(buf, "%15s", ifname); /* IFNAMSIZ */1241124112421242 /* check to see if we are clearing active */12431243 if (!strlen(ifname) || buf[0] == '\n') {
···17021702 SHMEM_EEE_ADV_STATUS_SHIFT);17031703 if ((advertised != (eee_cfg & SHMEM_EEE_ADV_STATUS_MASK))) {17041704 DP(BNX2X_MSG_ETHTOOL,17051705- "Direct manipulation of EEE advertisment is not supported\n");17051705+ "Direct manipulation of EEE advertisement is not supported\n");17061706 return -EINVAL;17071707 }17081708
···6794679467956795 bnx2x_init_block(bp, BLOCK_DORQ, init_phase);6796679667976797+ bnx2x_init_block(bp, BLOCK_BRB1, init_phase);67986798+67976799 if (CHIP_IS_E1(bp) || CHIP_IS_E1H(bp)) {67986798- bnx2x_init_block(bp, BLOCK_BRB1, init_phase);6799680068006801 if (IS_MF(bp))68016802 low = ((bp->flags & ONE_PORT_FLAG) ? 160 : 246);···1190311902 /* disable FCOE L2 queue for E1x */1190411903 if (CHIP_IS_E1x(bp))1190511904 bp->flags |= NO_FCOE_FLAG;1190611906-1190511905+ /* disable FCOE for 57840 device, until FW supports it */1190611906+ switch (ent->driver_data) {1190711907+ case BCM57840_O:1190811908+ case BCM57840_4_10:1190911909+ case BCM57840_2_20:1191011910+ case BCM57840_MFO:1191111911+ case BCM57840_MF:1191211912+ bp->flags |= NO_FCOE_FLAG;1191311913+ }1190711914#endif11908119151190911916
-10
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
···34163416 finicsum, cfcsum);3417341734183418 /*34193419- * If we're a pure NIC driver then disable all offloading facilities.34203420- * This will allow the firmware to optimize aspects of the hardware34213421- * configuration which will result in improved performance.34223422- */34233423- caps_cmd.ofldcaps = 0;34243424- caps_cmd.iscsicaps = 0;34253425- caps_cmd.rdmacaps = 0;34263426- caps_cmd.fcoecaps = 0;34273427-34283428- /*34293419 * And now tell the firmware to use the configuration we just loaded.34303420 */34313421 caps_cmd.op_to_write =
···359359void usbnet_defer_kevent (struct usbnet *dev, int work)360360{361361 set_bit (work, &dev->flags);362362- if (!schedule_work (&dev->kevent))363363- netdev_err(dev->net, "kevent %d may have been dropped\n", work);364364- else362362+ if (!schedule_work (&dev->kevent)) {363363+ if (net_ratelimit())364364+ netdev_err(dev->net, "kevent %d may have been dropped\n", work);365365+ } else {365366 netdev_dbg(dev->net, "kevent %d scheduled\n", work);367367+ }366368}367369EXPORT_SYMBOL_GPL(usbnet_defer_kevent);368370
···320320 } else321321 next = dev->bus_list.next;322322323323- /* Run device routines with the device locked */324324- device_lock(&dev->dev);325323 retval = cb(dev, userdata);326326- device_unlock(&dev->dev);327324 if (retval)328325 break;329326 }
+2-10
drivers/pci/pci-driver.c
···398398 struct pci_dev *pci_dev = to_pci_dev(dev);399399 struct pci_driver *drv = pci_dev->driver;400400401401+ pm_runtime_resume(dev);402402+401403 if (drv && drv->shutdown)402404 drv->shutdown(pci_dev);403405 pci_msi_shutdown(pci_dev);···410408 * continue to do DMA411409 */412410 pci_disable_device(pci_dev);413413-414414- /*415415- * Devices may be enabled to wake up by runtime PM, but they need not416416- * be supposed to wake up the system from its "power off" state (e.g.417417- * ACPI S5). Therefore disable wakeup for all devices that aren't418418- * supposed to wake up the system at this point. The state argument419419- * will be ignored by pci_enable_wake().420420- */421421- if (!device_may_wakeup(dev))422422- pci_enable_wake(pci_dev, PCI_UNKNOWN, false);423411}424412425413#ifdef CONFIG_PM
-34
drivers/pci/pci-sysfs.c
···458458}459459struct device_attribute vga_attr = __ATTR_RO(boot_vga);460460461461-static void462462-pci_config_pm_runtime_get(struct pci_dev *pdev)463463-{464464- struct device *dev = &pdev->dev;465465- struct device *parent = dev->parent;466466-467467- if (parent)468468- pm_runtime_get_sync(parent);469469- pm_runtime_get_noresume(dev);470470- /*471471- * pdev->current_state is set to PCI_D3cold during suspending,472472- * so wait until suspending completes473473- */474474- pm_runtime_barrier(dev);475475- /*476476- * Only need to resume devices in D3cold, because config477477- * registers are still accessible for devices suspended but478478- * not in D3cold.479479- */480480- if (pdev->current_state == PCI_D3cold)481481- pm_runtime_resume(dev);482482-}483483-484484-static void485485-pci_config_pm_runtime_put(struct pci_dev *pdev)486486-{487487- struct device *dev = &pdev->dev;488488- struct device *parent = dev->parent;489489-490490- pm_runtime_put(dev);491491- if (parent)492492- pm_runtime_put_sync(parent);493493-}494494-495461static ssize_t496462pci_read_config(struct file *filp, struct kobject *kobj,497463 struct bin_attribute *bin_attr,
+32
drivers/pci/pci.c
···18581858}18591859EXPORT_SYMBOL_GPL(pci_dev_run_wake);1860186018611861+void pci_config_pm_runtime_get(struct pci_dev *pdev)18621862+{18631863+ struct device *dev = &pdev->dev;18641864+ struct device *parent = dev->parent;18651865+18661866+ if (parent)18671867+ pm_runtime_get_sync(parent);18681868+ pm_runtime_get_noresume(dev);18691869+ /*18701870+ * pdev->current_state is set to PCI_D3cold during suspending,18711871+ * so wait until suspending completes18721872+ */18731873+ pm_runtime_barrier(dev);18741874+ /*18751875+ * Only need to resume devices in D3cold, because config18761876+ * registers are still accessible for devices suspended but18771877+ * not in D3cold.18781878+ */18791879+ if (pdev->current_state == PCI_D3cold)18801880+ pm_runtime_resume(dev);18811881+}18821882+18831883+void pci_config_pm_runtime_put(struct pci_dev *pdev)18841884+{18851885+ struct device *dev = &pdev->dev;18861886+ struct device *parent = dev->parent;18871887+18881888+ pm_runtime_put(dev);18891889+ if (parent)18901890+ pm_runtime_put_sync(parent);18911891+}18921892+18611893/**18621894 * pci_pm_init - Initialize PM functions of given PCI device18631895 * @dev: PCI device to handle.
···237237 struct tcm_qla2xxx_tpg, se_tpg);238238 struct tcm_qla2xxx_lport *lport = tpg->lport;239239240240- return &lport->lport_name[0];240240+ return lport->lport_naa_name;241241}242242243243static char *tcm_qla2xxx_npiv_get_fabric_wwn(struct se_portal_group *se_tpg)···14571457 return 0;14581458}1459145914601460+static void tcm_qla2xxx_update_sess(struct qla_tgt_sess *sess, port_id_t s_id,14611461+ uint16_t loop_id, bool conf_compl_supported)14621462+{14631463+ struct qla_tgt *tgt = sess->tgt;14641464+ struct qla_hw_data *ha = tgt->ha;14651465+ struct tcm_qla2xxx_lport *lport = ha->tgt.target_lport_ptr;14661466+ struct se_node_acl *se_nacl = sess->se_sess->se_node_acl;14671467+ struct tcm_qla2xxx_nacl *nacl = container_of(se_nacl,14681468+ struct tcm_qla2xxx_nacl, se_node_acl);14691469+ u32 key;14701470+14711471+14721472+ if (sess->loop_id != loop_id || sess->s_id.b24 != s_id.b24)14731473+ pr_info("Updating session %p from port %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x loop_id %d -> %d s_id %x:%x:%x -> %x:%x:%x\n",14741474+ sess,14751475+ sess->port_name[0], sess->port_name[1],14761476+ sess->port_name[2], sess->port_name[3],14771477+ sess->port_name[4], sess->port_name[5],14781478+ sess->port_name[6], sess->port_name[7],14791479+ sess->loop_id, loop_id,14801480+ sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa,14811481+ s_id.b.domain, s_id.b.area, s_id.b.al_pa);14821482+14831483+ if (sess->loop_id != loop_id) {14841484+ /*14851485+ * Because we can shuffle loop IDs around and we14861486+ * update different sessions non-atomically, we might14871487+ * have overwritten this session's old loop ID14881488+ * already, and we might end up overwriting some other14891489+ * session that will be updated later. So we have to14901490+ * be extra careful and we can't warn about those things...14911491+ */14921492+ if (lport->lport_loopid_map[sess->loop_id].se_nacl == se_nacl)14931493+ lport->lport_loopid_map[sess->loop_id].se_nacl = NULL;14941494+14951495+ lport->lport_loopid_map[loop_id].se_nacl = se_nacl;14961496+14971497+ sess->loop_id = loop_id;14981498+ }14991499+15001500+ if (sess->s_id.b24 != s_id.b24) {15011501+ key = (((u32) sess->s_id.b.domain << 16) |15021502+ ((u32) sess->s_id.b.area << 8) |15031503+ ((u32) sess->s_id.b.al_pa));15041504+15051505+ if (btree_lookup32(&lport->lport_fcport_map, key))15061506+ WARN(btree_remove32(&lport->lport_fcport_map, key) != se_nacl,15071507+ "Found wrong se_nacl when updating s_id %x:%x:%x\n",15081508+ sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa);15091509+ else15101510+ WARN(1, "No lport_fcport_map entry for s_id %x:%x:%x\n",15111511+ sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa);15121512+15131513+ key = (((u32) s_id.b.domain << 16) |15141514+ ((u32) s_id.b.area << 8) |15151515+ ((u32) s_id.b.al_pa));15161516+15171517+ if (btree_lookup32(&lport->lport_fcport_map, key)) {15181518+ WARN(1, "Already have lport_fcport_map entry for s_id %x:%x:%x\n",15191519+ s_id.b.domain, s_id.b.area, s_id.b.al_pa);15201520+ btree_update32(&lport->lport_fcport_map, key, se_nacl);15211521+ } else {15221522+ btree_insert32(&lport->lport_fcport_map, key, se_nacl, GFP_ATOMIC);15231523+ }15241524+15251525+ sess->s_id = s_id;15261526+ nacl->nport_id = key;15271527+ }15281528+15291529+ sess->conf_compl_supported = conf_compl_supported;15301530+}15311531+14601532/*14611533 * Calls into tcm_qla2xxx used by qla2xxx LLD I/O path.14621534 */···15391467 .free_cmd = tcm_qla2xxx_free_cmd,15401468 .free_mcmd = tcm_qla2xxx_free_mcmd,15411469 .free_session = tcm_qla2xxx_free_session,14701470+ .update_sess = tcm_qla2xxx_update_sess,15421471 .check_initiator_node_acl = tcm_qla2xxx_check_initiator_node_acl,15431472 .find_sess_by_s_id = tcm_qla2xxx_find_sess_by_s_id,15441473 .find_sess_by_loop_id = tcm_qla2xxx_find_sess_by_loop_id,···16071534 lport->lport_wwpn = wwpn;16081535 tcm_qla2xxx_format_wwn(&lport->lport_name[0], TCM_QLA2XXX_NAMELEN,16091536 wwpn);15371537+ sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) wwpn);1610153816111539 ret = tcm_qla2xxx_init_lport(lport);16121540 if (ret != 0)···16751601 lport->lport_npiv_wwnn = npiv_wwnn;16761602 tcm_qla2xxx_npiv_format_wwn(&lport->lport_npiv_name[0],16771603 TCM_QLA2XXX_NAMELEN, npiv_wwpn, npiv_wwnn);16041604+ sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) npiv_wwpn);1678160516791606/* FIXME: tcm_qla2xxx_npiv_make_lport */16801607 ret = -ENOSYS;
+2
drivers/scsi/qla2xxx/tcm_qla2xxx.h
···6161 u64 lport_npiv_wwnn;6262 /* ASCII formatted WWPN for FC Target Lport */6363 char lport_name[TCM_QLA2XXX_NAMELEN];6464+ /* ASCII formatted naa WWPN for VPD page 83 etc */6565+ char lport_naa_name[TCM_QLA2XXX_NAMELEN];6466 /* ASCII formatted WWPN+WWNN for NPIV FC Target Lport */6567 char lport_npiv_name[TCM_QLA2XXX_NPIV_NAMELEN];6668 /* map for fc_port pointers in 24-bit FC Port ID space */
+1-12
drivers/scsi/qlogicpti.c
···12941294static const struct of_device_id qpti_match[];12951295static int __devinit qpti_sbus_probe(struct platform_device *op)12961296{12971297- const struct of_device_id *match;12981298- struct scsi_host_template *tpnt;12991297 struct device_node *dp = op->dev.of_node;13001298 struct Scsi_Host *host;13011299 struct qlogicpti *qpti;13021300 static int nqptis;13031301 const char *fcode;13041304-13051305- match = of_match_device(qpti_match, &op->dev);13061306- if (!match)13071307- return -EINVAL;13081308- tpnt = match->data;1309130213101303 /* Sometimes Antares cards come up not completely13111304 * setup, and we get a report of a zero IRQ.···13061313 if (op->archdata.irqs[0] == 0)13071314 return -ENODEV;1308131513091309- host = scsi_host_alloc(tpnt, sizeof(struct qlogicpti));13161316+ host = scsi_host_alloc(&qpti_template, sizeof(struct qlogicpti));13101317 if (!host)13111318 return -ENOMEM;13121319···14381445static const struct of_device_id qpti_match[] = {14391446 {14401447 .name = "ptisp",14411441- .data = &qpti_template,14421448 },14431449 {14441450 .name = "PTI,ptisp",14451445- .data = &qpti_template,14461451 },14471452 {14481453 .name = "QLGC,isp",14491449- .data = &qpti_template,14501454 },14511455 {14521456 .name = "SUNW,isp",14531453- .data = &qpti_template,14541457 },14551458 {},14561459};
···486486};487487488488struct iscsi_conn {489489+ wait_queue_head_t queues_wq;489490 /* Authentication Successful for this connection */490491 u8 auth_complete;491492 /* State connection is currently in */
+1
drivers/target/iscsi/iscsi_target_login.c
···41414242static int iscsi_login_init_conn(struct iscsi_conn *conn)4343{4444+ init_waitqueue_head(&conn->queues_wq);4445 INIT_LIST_HEAD(&conn->conn_list);4546 INIT_LIST_HEAD(&conn->conn_cmd_list);4647 INIT_LIST_HEAD(&conn->immed_queue_list);
···850850851851static u32 se_dev_align_max_sectors(u32 max_sectors, u32 block_size)852852{853853- u32 tmp, aligned_max_sectors;853853+ u32 aligned_max_sectors;854854+ u32 alignment;854855 /*855856 * Limit max_sectors to a PAGE_SIZE aligned value for modern856857 * transport_allocate_data_tasks() operation.857858 */858858- tmp = rounddown((max_sectors * block_size), PAGE_SIZE);859859- aligned_max_sectors = (tmp / block_size);860860- if (max_sectors != aligned_max_sectors) {861861- printk(KERN_INFO "Rounding down aligned max_sectors from %u"862862- " to %u\n", max_sectors, aligned_max_sectors);863863- return aligned_max_sectors;864864- }859859+ alignment = max(1ul, PAGE_SIZE / block_size);860860+ aligned_max_sectors = rounddown(max_sectors, alignment);865861866866- return max_sectors;862862+ if (max_sectors != aligned_max_sectors)863863+ pr_info("Rounding down aligned max_sectors from %u to %u\n",864864+ max_sectors, aligned_max_sectors);865865+866866+ return aligned_max_sectors;867867}868868869869void se_dev_set_default_attribs(
+18
drivers/target/target_core_sbc.c
···135135 return 0;136136}137137138138+static int sbc_emulate_noop(struct se_cmd *cmd)139139+{140140+ target_complete_cmd(cmd, GOOD);141141+ return 0;142142+}143143+138144static inline u32 sbc_get_size(struct se_cmd *cmd, u32 sectors)139145{140146 return cmd->se_dev->se_sub_dev->se_dev_attrib.block_size * sectors;···536530 case VERIFY:537531 size = 0;538532 cmd->execute_cmd = sbc_emulate_verify;533533+ break;534534+ case REZERO_UNIT:535535+ case SEEK_6:536536+ case SEEK_10:537537+ /*538538+ * There are still clients out there which use these old SCSI-2539539+ * commands. This mainly happens when running VMs with legacy540540+ * guest systems, connected via SCSI command pass-through to541541+ * iSCSI targets. Make them happy and return status GOOD.542542+ */543543+ size = 0;544544+ cmd->execute_cmd = sbc_emulate_noop;539545 break;540546 default:541547 ret = spc_parse_cdb(cmd, &size);
+2
drivers/target/target_core_spc.c
···605605 unsigned char buf[SE_INQUIRY_BUF];606606 int p, ret;607607608608+ memset(buf, 0, SE_INQUIRY_BUF);609609+608610 if (dev == tpg->tpg_virt_lun0.lun_se_dev)609611 buf[0] = 0x3f; /* Not connected */610612 else
···641641 case XenbusStateReconfiguring:642642 case XenbusStateReconfigured:643643 case XenbusStateUnknown:644644- case XenbusStateClosed:645644 break;646645647646 case XenbusStateInitWait:···669670 info->feature_resize = val;670671 break;671672673673+ case XenbusStateClosed:674674+ if (dev->state == XenbusStateClosed)675675+ break;676676+ /* Missed the backend's CLOSING state -- fallthrough */672677 case XenbusStateClosing:673678 xenbus_frontend_closed(dev);674679 break;
+3-1
drivers/virtio/virtio.c
···225225226226void unregister_virtio_device(struct virtio_device *dev)227227{228228+ int index = dev->index; /* save for after device release */229229+228230 device_unregister(&dev->dev);229229- ida_simple_remove(&virtio_index_ida, dev->index);231231+ ida_simple_remove(&virtio_index_ida, index);230232}231233EXPORT_SYMBOL_GPL(unregister_virtio_device);232234
···398398 * in network traffic in the other paths.399399 */400400 if (!(oflags & O_CREAT)) {401401- struct dentry *res = cifs_lookup(inode, direntry, 0);401401+ struct dentry *res;402402+403403+ /*404404+ * Check for hashed negative dentry. We have already revalidated405405+ * the dentry and it is fine. No need to perform another lookup.406406+ */407407+ if (!d_unhashed(direntry))408408+ return -ENOENT;409409+410410+ res = cifs_lookup(inode, direntry, 0);402411 if (IS_ERR(res))403412 return PTR_ERR(res);404413
+3-35
fs/eventpoll.c
···346346/* Tells if the epoll_ctl(2) operation needs an event copy from userspace */347347static inline int ep_op_has_event(int op)348348{349349- return op == EPOLL_CTL_ADD || op == EPOLL_CTL_MOD;349349+ return op != EPOLL_CTL_DEL;350350}351351352352/* Initialize the poll safe wake up structure */···674674 atomic_long_dec(&ep->user->epoll_watches);675675676676 return 0;677677-}678678-679679-/*680680- * Disables a "struct epitem" in the eventpoll set. Returns -EBUSY if the item681681- * had no event flags set, indicating that another thread may be currently682682- * handling that item's events (in the case that EPOLLONESHOT was being683683- * used). Otherwise a zero result indicates that the item has been disabled684684- * from receiving events. A disabled item may be re-enabled via685685- * EPOLL_CTL_MOD. Must be called with "mtx" held.686686- */687687-static int ep_disable(struct eventpoll *ep, struct epitem *epi)688688-{689689- int result = 0;690690- unsigned long flags;691691-692692- spin_lock_irqsave(&ep->lock, flags);693693- if (epi->event.events & ~EP_PRIVATE_BITS) {694694- if (ep_is_linked(&epi->rdllink))695695- list_del_init(&epi->rdllink);696696- /* Ensure ep_poll_callback will not add epi back onto ready697697- list: */698698- epi->event.events &= EP_PRIVATE_BITS;699699- }700700- else701701- result = -EBUSY;702702- spin_unlock_irqrestore(&ep->lock, flags);703703-704704- return result;705677}706678707679static void ep_free(struct eventpoll *ep)···10191047 rb_link_node(&epi->rbn, parent, p);10201048 rb_insert_color(&epi->rbn, &ep->rbr);10211049}10501050+10511051+1022105210231053#define PATH_ARR_SIZE 510241054/*···17851811 epds.events |= POLLERR | POLLHUP;17861812 error = ep_modify(ep, epi, &epds);17871813 } else17881788- error = -ENOENT;17891789- break;17901790- case EPOLL_CTL_DISABLE:17911791- if (epi)17921792- error = ep_disable(ep, epi);17931793- else17941814 error = -ENOENT;17951815 break;17961816 }
+9-10
fs/ext4/ialloc.c
···725725 "inode=%lu", ino + 1);726726 continue;727727 }728728+ BUFFER_TRACE(inode_bitmap_bh, "get_write_access");729729+ err = ext4_journal_get_write_access(handle, inode_bitmap_bh);730730+ if (err)731731+ goto fail;728732 ext4_lock_group(sb, group);729733 ret2 = ext4_test_and_set_bit(ino, inode_bitmap_bh->b_data);730734 ext4_unlock_group(sb, group);···742738 goto out;743739744740got:741741+ BUFFER_TRACE(inode_bitmap_bh, "call ext4_handle_dirty_metadata");742742+ err = ext4_handle_dirty_metadata(handle, NULL, inode_bitmap_bh);743743+ if (err)744744+ goto fail;745745+745746 /* We may have to initialize the block bitmap if it isn't already */746747 if (ext4_has_group_desc_csum(sb) &&747748 gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {···779770 if (err)780771 goto fail;781772 }782782-783783- BUFFER_TRACE(inode_bitmap_bh, "get_write_access");784784- err = ext4_journal_get_write_access(handle, inode_bitmap_bh);785785- if (err)786786- goto fail;787773788774 BUFFER_TRACE(group_desc_bh, "get_write_access");789775 err = ext4_journal_get_write_access(handle, group_desc_bh);···826822 ext4_group_desc_csum_set(sb, group, gdp);827823 }828824 ext4_unlock_group(sb, group);829829-830830- BUFFER_TRACE(inode_bitmap_bh, "call ext4_handle_dirty_metadata");831831- err = ext4_handle_dirty_metadata(handle, NULL, inode_bitmap_bh);832832- if (err)833833- goto fail;834825835826 BUFFER_TRACE(group_desc_bh, "call ext4_handle_dirty_metadata");836827 err = ext4_handle_dirty_metadata(handle, NULL, group_desc_bh);
···181181 else182182 msg.rpc_proc = &mnt_clnt->cl_procinfo[MOUNTPROC_MNT];183183184184- status = rpc_call_sync(mnt_clnt, &msg, 0);184184+ status = rpc_call_sync(mnt_clnt, &msg, RPC_TASK_SOFT|RPC_TASK_TIMEOUT);185185 rpc_shutdown_client(mnt_clnt);186186187187 if (status < 0)
+14-5
fs/nfs/namespace.c
···3333 * @dentry - pointer to dentry3434 * @buffer - result buffer3535 * @buflen - length of buffer3636+ * @flags - options (see below)3637 *3738 * Helper function for constructing the server pathname3839 * by arbitrary hashed dentry.···4140 * This is mainly for use in figuring out the path on the4241 * server side when automounting on top of an existing partition4342 * and in generating /proc/mounts and friends.4343+ *4444+ * Supported flags:4545+ * NFS_PATH_CANONICAL: ensure there is exactly one slash after4646+ * the original device (export) name4747+ * (if unset, the original name is returned verbatim)4448 */4545-char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen)4949+char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen,5050+ unsigned flags)4651{4752 char *end;4853 int namelen;···8174 rcu_read_unlock();8275 goto rename_retry;8376 }8484- if (*end != '/') {7777+ if ((flags & NFS_PATH_CANONICAL) && *end != '/') {8578 if (--buflen < 0) {8679 spin_unlock(&dentry->d_lock);8780 rcu_read_unlock();···9891 return end;9992 }10093 namelen = strlen(base);101101- /* Strip off excess slashes in base string */102102- while (namelen > 0 && base[namelen - 1] == '/')103103- namelen--;9494+ if (flags & NFS_PATH_CANONICAL) {9595+ /* Strip off excess slashes in base string */9696+ while (namelen > 0 && base[namelen - 1] == '/')9797+ namelen--;9898+ }10499 buflen -= namelen;105100 if (buflen < 0) {106101 spin_unlock(&dentry->d_lock);
···2121 if ((old->path.mnt == new->path.mnt) &&2222 (old->path.dentry == new->path.dentry))2323 return true;2424+ break;2425 case (FSNOTIFY_EVENT_NONE):2526 return true;2627 default:
+2-41
fs/xfs/xfs_alloc.c
···18661866 /*18671867 * Initialize the args structure.18681868 */18691869+ memset(&targs, 0, sizeof(targs));18691870 targs.tp = tp;18701871 targs.mp = mp;18711872 targs.agbp = agbp;···22082207 * group or loop over the allocation groups to find the result.22092208 */22102209int /* error */22112211-__xfs_alloc_vextent(22102210+xfs_alloc_vextent(22122211 xfs_alloc_arg_t *args) /* allocation argument structure */22132212{22142213 xfs_agblock_t agsize; /* allocation group size */···24162415error0:24172416 xfs_perag_put(args->pag);24182417 return error;24192419-}24202420-24212421-static void24222422-xfs_alloc_vextent_worker(24232423- struct work_struct *work)24242424-{24252425- struct xfs_alloc_arg *args = container_of(work,24262426- struct xfs_alloc_arg, work);24272427- unsigned long pflags;24282428-24292429- /* we are in a transaction context here */24302430- current_set_flags_nested(&pflags, PF_FSTRANS);24312431-24322432- args->result = __xfs_alloc_vextent(args);24332433- complete(args->done);24342434-24352435- current_restore_flags_nested(&pflags, PF_FSTRANS);24362436-}24372437-24382438-/*24392439- * Data allocation requests often come in with little stack to work on. Push24402440- * them off to a worker thread so there is lots of stack to use. Metadata24412441- * requests, OTOH, are generally from low stack usage paths, so avoid the24422442- * context switch overhead here.24432443- */24442444-int24452445-xfs_alloc_vextent(24462446- struct xfs_alloc_arg *args)24472447-{24482448- DECLARE_COMPLETION_ONSTACK(done);24492449-24502450- if (!args->userdata)24512451- return __xfs_alloc_vextent(args);24522452-24532453-24542454- args->done = &done;24552455- INIT_WORK_ONSTACK(&args->work, xfs_alloc_vextent_worker);24562456- queue_work(xfs_alloc_wq, &args->work);24572457- wait_for_completion(&done);24582458- return args->result;24592418}2460241924612420/*
-3
fs/xfs/xfs_alloc.h
···120120 char isfl; /* set if is freelist blocks - !acctg */121121 char userdata; /* set if this is user data */122122 xfs_fsblock_t firstblock; /* io first block allocated */123123- struct completion *done;124124- struct work_struct work;125125- int result;126123} xfs_alloc_arg_t;127124128125/*
···24372437 * Normal allocation, done through xfs_alloc_vextent.24382438 */24392439 tryagain = isaligned = 0;24402440+ memset(&args, 0, sizeof(args));24402441 args.tp = ap->tp;24412442 args.mp = mp;24422443 args.fsbno = ap->blkno;···30833082 * Convert to a btree with two levels, one record in root.30843083 */30853084 XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_BTREE);30853085+ memset(&args, 0, sizeof(args));30863086 args.tp = tp;30873087 args.mp = mp;30883088 args.firstblock = *firstblock;···32393237 xfs_buf_t *bp; /* buffer for extent block */32403238 xfs_bmbt_rec_host_t *ep;/* extent record pointer */3241323932403240+ memset(&args, 0, sizeof(args));32423241 args.tp = tp;32433242 args.mp = ip->i_mount;32443243 args.firstblock = *firstblock;···461946164620461746214618STATIC int46224622-xfs_bmapi_allocate(46234623- struct xfs_bmalloca *bma,46244624- int flags)46194619+__xfs_bmapi_allocate(46204620+ struct xfs_bmalloca *bma)46254621{46264622 struct xfs_mount *mp = bma->ip->i_mount;46274627- int whichfork = (flags & XFS_BMAPI_ATTRFORK) ?46234623+ int whichfork = (bma->flags & XFS_BMAPI_ATTRFORK) ?46284624 XFS_ATTR_FORK : XFS_DATA_FORK;46294625 struct xfs_ifork *ifp = XFS_IFORK_PTR(bma->ip, whichfork);46304626 int tmp_logflags = 0;···46564654 * Indicate if this is the first user data in the file, or just any46574655 * user data.46584656 */46594659- if (!(flags & XFS_BMAPI_METADATA)) {46574657+ if (!(bma->flags & XFS_BMAPI_METADATA)) {46604658 bma->userdata = (bma->offset == 0) ?46614659 XFS_ALLOC_INITIAL_USER_DATA : XFS_ALLOC_USERDATA;46624660 }4663466146644664- bma->minlen = (flags & XFS_BMAPI_CONTIG) ? bma->length : 1;46624662+ bma->minlen = (bma->flags & XFS_BMAPI_CONTIG) ? bma->length : 1;4665466346664664 /*46674665 * Only want to do the alignment at the eof if it is userdata and46684666 * allocation length is larger than a stripe unit.46694667 */46704668 if (mp->m_dalign && bma->length >= mp->m_dalign &&46714671- !(flags & XFS_BMAPI_METADATA) && whichfork == XFS_DATA_FORK) {46694669+ !(bma->flags & XFS_BMAPI_METADATA) && whichfork == XFS_DATA_FORK) {46724670 error = xfs_bmap_isaeof(bma, whichfork);46734671 if (error)46744672 return error;46754673 }46744674+46754675+ if (bma->flags & XFS_BMAPI_STACK_SWITCH)46764676+ bma->stack_switch = 1;4676467746774678 error = xfs_bmap_alloc(bma);46784679 if (error)···47114706 * A wasdelay extent has been initialized, so shouldn't be flagged47124707 * as unwritten.47134708 */47144714- if (!bma->wasdel && (flags & XFS_BMAPI_PREALLOC) &&47094709+ if (!bma->wasdel && (bma->flags & XFS_BMAPI_PREALLOC) &&47154710 xfs_sb_version_hasextflgbit(&mp->m_sb))47164711 bma->got.br_state = XFS_EXT_UNWRITTEN;47174712···47374732 ASSERT(bma->got.br_state == XFS_EXT_NORM ||47384733 bma->got.br_state == XFS_EXT_UNWRITTEN);47394734 return 0;47354735+}47364736+47374737+static void47384738+xfs_bmapi_allocate_worker(47394739+ struct work_struct *work)47404740+{47414741+ struct xfs_bmalloca *args = container_of(work,47424742+ struct xfs_bmalloca, work);47434743+ unsigned long pflags;47444744+47454745+ /* we are in a transaction context here */47464746+ current_set_flags_nested(&pflags, PF_FSTRANS);47474747+47484748+ args->result = __xfs_bmapi_allocate(args);47494749+ complete(args->done);47504750+47514751+ current_restore_flags_nested(&pflags, PF_FSTRANS);47524752+}47534753+47544754+/*47554755+ * Some allocation requests often come in with little stack to work on. Push47564756+ * them off to a worker thread so there is lots of stack to use. Otherwise just47574757+ * call directly to avoid the context switch overhead here.47584758+ */47594759+int47604760+xfs_bmapi_allocate(47614761+ struct xfs_bmalloca *args)47624762+{47634763+ DECLARE_COMPLETION_ONSTACK(done);47644764+47654765+ if (!args->stack_switch)47664766+ return __xfs_bmapi_allocate(args);47674767+47684768+47694769+ args->done = &done;47704770+ INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker);47714771+ queue_work(xfs_alloc_wq, &args->work);47724772+ wait_for_completion(&done);47734773+ return args->result;47404774}4741477547424776STATIC int···49634919 bma.conv = !!(flags & XFS_BMAPI_CONVERT);49644920 bma.wasdel = wasdelay;49654921 bma.offset = bno;49224922+ bma.flags = flags;4966492349674924 /*49684925 * There's a 32/64 bit type mismatch between the···4979493449804935 ASSERT(len > 0);49814936 ASSERT(bma.length > 0);49824982- error = xfs_bmapi_allocate(&bma, flags);49374937+ error = xfs_bmapi_allocate(&bma);49834938 if (error)49844939 goto error0;49854940 if (bma.blkno == NULLFSBLOCK)
+8-1
fs/xfs/xfs_bmap.h
···7777 * from written to unwritten, otherwise convert from unwritten to written.7878 */7979#define XFS_BMAPI_CONVERT 0x0408080+#define XFS_BMAPI_STACK_SWITCH 0x08080818182#define XFS_BMAPI_FLAGS \8283 { XFS_BMAPI_ENTIRE, "ENTIRE" }, \···8685 { XFS_BMAPI_PREALLOC, "PREALLOC" }, \8786 { XFS_BMAPI_IGSTATE, "IGSTATE" }, \8887 { XFS_BMAPI_CONTIG, "CONTIG" }, \8989- { XFS_BMAPI_CONVERT, "CONVERT" }8888+ { XFS_BMAPI_CONVERT, "CONVERT" }, \8989+ { XFS_BMAPI_STACK_SWITCH, "STACK_SWITCH" }909091919292static inline int xfs_bmapi_aflag(int w)···135133 char userdata;/* set if is user data */136134 char aeof; /* allocated space at eof */137135 char conv; /* overwriting unwritten extents */136136+ char stack_switch;137137+ int flags;138138+ struct completion *done;139139+ struct work_struct work;140140+ int result;138141} xfs_bmalloca_t;139142140143/*
+18
fs/xfs/xfs_buf_item.c
···526526 }527527 xfs_buf_relse(bp);528528 } else if (freed && remove) {529529+ /*530530+ * There are currently two references to the buffer - the active531531+ * LRU reference and the buf log item. What we are about to do532532+ * here - simulate a failed IO completion - requires 3533533+ * references.534534+ *535535+ * The LRU reference is removed by the xfs_buf_stale() call. The536536+ * buf item reference is removed by the xfs_buf_iodone()537537+ * callback that is run by xfs_buf_do_callbacks() during ioend538538+ * processing (via the bp->b_iodone callback), and then finally539539+ * the ioend processing will drop the IO reference if the buffer540540+ * is marked XBF_ASYNC.541541+ *542542+ * Hence we need to take an additional reference here so that IO543543+ * completion processing doesn't free the buffer prematurely.544544+ */529545 xfs_buf_lock(bp);546546+ xfs_buf_hold(bp);547547+ bp->b_flags |= XBF_ASYNC;530548 xfs_buf_ioerror(bp, EIO);531549 XFS_BUF_UNDONE(bp);532550 xfs_buf_stale(bp);
+19-2
fs/xfs/xfs_fsops.c
···399399400400 /* update secondary superblocks. */401401 for (agno = 1; agno < nagcount; agno++) {402402- error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp,402402+ error = 0;403403+ /*404404+ * new secondary superblocks need to be zeroed, not read from405405+ * disk as the contents of the new area we are growing into is406406+ * completely unknown.407407+ */408408+ if (agno < oagcount) {409409+ error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp,403410 XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)),404411 XFS_FSS_TO_BB(mp, 1), 0, &bp);412412+ } else {413413+ bp = xfs_trans_get_buf(NULL, mp->m_ddev_targp,414414+ XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)),415415+ XFS_FSS_TO_BB(mp, 1), 0);416416+ if (bp)417417+ xfs_buf_zero(bp, 0, BBTOB(bp->b_length));418418+ else419419+ error = ENOMEM;420420+ }421421+405422 if (error) {406423 xfs_warn(mp,407424 "error %d reading secondary superblock for ag %d",···440423 break; /* no point in continuing */441424 }442425 }443443- return 0;426426+ return error;444427445428 error0:446429 xfs_trans_cancel(tp, XFS_TRANS_ABORT);
···15091509 * to mark all the active inodes on the buffer stale.15101510 */15111511 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, blkno,15121512- mp->m_bsize * blks_per_cluster, 0);15121512+ mp->m_bsize * blks_per_cluster,15131513+ XBF_UNMAPPED);1513151415141515 if (!bp)15151516 return ENOMEM;
+1-1
fs/xfs/xfs_ioctl.c
···7070 int hsize;7171 xfs_handle_t handle;7272 struct inode *inode;7373- struct fd f;7373+ struct fd f = {0};7474 struct path path;7575 int error;7676 struct xfs_inode *ip;
+3-1
fs/xfs/xfs_iomap.c
···584584 * pointer that the caller gave to us.585585 */586586 error = xfs_bmapi_write(tp, ip, map_start_fsb,587587- count_fsb, 0, &first_block, 1,587587+ count_fsb,588588+ XFS_BMAPI_STACK_SWITCH,589589+ &first_block, 1,588590 imap, &nimaps, &free_list);589591 if (error)590592 goto trans_cancel;
+16-3
fs/xfs/xfs_log.c
···238723872388238823892389 /*23902390- * update the last_sync_lsn before we drop the23902390+ * Completion of a iclog IO does not imply that23912391+ * a transaction has completed, as transactions23922392+ * can be large enough to span many iclogs. We23932393+ * cannot change the tail of the log half way23942394+ * through a transaction as this may be the only23952395+ * transaction in the log and moving th etail to23962396+ * point to the middle of it will prevent23972397+ * recovery from finding the start of the23982398+ * transaction. Hence we should only update the23992399+ * last_sync_lsn if this iclog contains24002400+ * transaction completion callbacks on it.24012401+ *24022402+ * We have to do this before we drop the23912403 * icloglock to ensure we are the only one that23922404 * can update it.23932405 */23942406 ASSERT(XFS_LSN_CMP(atomic64_read(&log->l_last_sync_lsn),23952407 be64_to_cpu(iclog->ic_header.h_lsn)) <= 0);23962396- atomic64_set(&log->l_last_sync_lsn,23972397- be64_to_cpu(iclog->ic_header.h_lsn));24082408+ if (iclog->ic_callback)24092409+ atomic64_set(&log->l_last_sync_lsn,24102410+ be64_to_cpu(iclog->ic_header.h_lsn));2398241123992412 } else24002413 ioerrors++;
+1-1
fs/xfs/xfs_log_recover.c
···35413541 * - order is important.35423542 */35433543 error = xlog_bread_offset(log, 0,35443544- bblks - split_bblks, hbp,35443544+ bblks - split_bblks, dbp,35453545 offset + BBTOB(split_bblks));35463546 if (error)35473547 goto bread_err2;
+192
include/linux/hashtable.h
···11+/*22+ * Statically sized hash table implementation33+ * (C) 2012 Sasha Levin <levinsasha928@gmail.com>44+ */55+66+#ifndef _LINUX_HASHTABLE_H77+#define _LINUX_HASHTABLE_H88+99+#include <linux/list.h>1010+#include <linux/types.h>1111+#include <linux/kernel.h>1212+#include <linux/hash.h>1313+#include <linux/rculist.h>1414+1515+#define DEFINE_HASHTABLE(name, bits) \1616+ struct hlist_head name[1 << (bits)] = \1717+ { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT }1818+1919+#define DECLARE_HASHTABLE(name, bits) \2020+ struct hlist_head name[1 << (bits)]2121+2222+#define HASH_SIZE(name) (ARRAY_SIZE(name))2323+#define HASH_BITS(name) ilog2(HASH_SIZE(name))2424+2525+/* Use hash_32 when possible to allow for fast 32bit hashing in 64bit kernels. */2626+#define hash_min(val, bits) \2727+ (sizeof(val) <= 4 ? hash_32(val, bits) : hash_long(val, bits))2828+2929+static inline void __hash_init(struct hlist_head *ht, unsigned int sz)3030+{3131+ unsigned int i;3232+3333+ for (i = 0; i < sz; i++)3434+ INIT_HLIST_HEAD(&ht[i]);3535+}3636+3737+/**3838+ * hash_init - initialize a hash table3939+ * @hashtable: hashtable to be initialized4040+ *4141+ * Calculates the size of the hashtable from the given parameter, otherwise4242+ * same as hash_init_size.4343+ *4444+ * This has to be a macro since HASH_BITS() will not work on pointers since4545+ * it calculates the size during preprocessing.4646+ */4747+#define hash_init(hashtable) __hash_init(hashtable, HASH_SIZE(hashtable))4848+4949+/**5050+ * hash_add - add an object to a hashtable5151+ * @hashtable: hashtable to add to5252+ * @node: the &struct hlist_node of the object to be added5353+ * @key: the key of the object to be added5454+ */5555+#define hash_add(hashtable, node, key) \5656+ hlist_add_head(node, &hashtable[hash_min(key, HASH_BITS(hashtable))])5757+5858+/**5959+ * hash_add_rcu - add an object to a rcu enabled hashtable6060+ * @hashtable: hashtable to add to6161+ * @node: the &struct hlist_node of the object to be added6262+ * @key: the key of the object to be added6363+ */6464+#define hash_add_rcu(hashtable, node, key) \6565+ hlist_add_head_rcu(node, &hashtable[hash_min(key, HASH_BITS(hashtable))])6666+6767+/**6868+ * hash_hashed - check whether an object is in any hashtable6969+ * @node: the &struct hlist_node of the object to be checked7070+ */7171+static inline bool hash_hashed(struct hlist_node *node)7272+{7373+ return !hlist_unhashed(node);7474+}7575+7676+static inline bool __hash_empty(struct hlist_head *ht, unsigned int sz)7777+{7878+ unsigned int i;7979+8080+ for (i = 0; i < sz; i++)8181+ if (!hlist_empty(&ht[i]))8282+ return false;8383+8484+ return true;8585+}8686+8787+/**8888+ * hash_empty - check whether a hashtable is empty8989+ * @hashtable: hashtable to check9090+ *9191+ * This has to be a macro since HASH_BITS() will not work on pointers since9292+ * it calculates the size during preprocessing.9393+ */9494+#define hash_empty(hashtable) __hash_empty(hashtable, HASH_SIZE(hashtable))9595+9696+/**9797+ * hash_del - remove an object from a hashtable9898+ * @node: &struct hlist_node of the object to remove9999+ */100100+static inline void hash_del(struct hlist_node *node)101101+{102102+ hlist_del_init(node);103103+}104104+105105+/**106106+ * hash_del_rcu - remove an object from a rcu enabled hashtable107107+ * @node: &struct hlist_node of the object to remove108108+ */109109+static inline void hash_del_rcu(struct hlist_node *node)110110+{111111+ hlist_del_init_rcu(node);112112+}113113+114114+/**115115+ * hash_for_each - iterate over a hashtable116116+ * @name: hashtable to iterate117117+ * @bkt: integer to use as bucket loop cursor118118+ * @node: the &struct list_head to use as a loop cursor for each entry119119+ * @obj: the type * to use as a loop cursor for each entry120120+ * @member: the name of the hlist_node within the struct121121+ */122122+#define hash_for_each(name, bkt, node, obj, member) \123123+ for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\124124+ hlist_for_each_entry(obj, node, &name[bkt], member)125125+126126+/**127127+ * hash_for_each_rcu - iterate over a rcu enabled hashtable128128+ * @name: hashtable to iterate129129+ * @bkt: integer to use as bucket loop cursor130130+ * @node: the &struct list_head to use as a loop cursor for each entry131131+ * @obj: the type * to use as a loop cursor for each entry132132+ * @member: the name of the hlist_node within the struct133133+ */134134+#define hash_for_each_rcu(name, bkt, node, obj, member) \135135+ for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\136136+ hlist_for_each_entry_rcu(obj, node, &name[bkt], member)137137+138138+/**139139+ * hash_for_each_safe - iterate over a hashtable safe against removal of140140+ * hash entry141141+ * @name: hashtable to iterate142142+ * @bkt: integer to use as bucket loop cursor143143+ * @node: the &struct list_head to use as a loop cursor for each entry144144+ * @tmp: a &struct used for temporary storage145145+ * @obj: the type * to use as a loop cursor for each entry146146+ * @member: the name of the hlist_node within the struct147147+ */148148+#define hash_for_each_safe(name, bkt, node, tmp, obj, member) \149149+ for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\150150+ hlist_for_each_entry_safe(obj, node, tmp, &name[bkt], member)151151+152152+/**153153+ * hash_for_each_possible - iterate over all possible objects hashing to the154154+ * same bucket155155+ * @name: hashtable to iterate156156+ * @obj: the type * to use as a loop cursor for each entry157157+ * @node: the &struct list_head to use as a loop cursor for each entry158158+ * @member: the name of the hlist_node within the struct159159+ * @key: the key of the objects to iterate over160160+ */161161+#define hash_for_each_possible(name, obj, node, member, key) \162162+ hlist_for_each_entry(obj, node, &name[hash_min(key, HASH_BITS(name))], member)163163+164164+/**165165+ * hash_for_each_possible_rcu - iterate over all possible objects hashing to the166166+ * same bucket in an rcu enabled hashtable167167+ * in a rcu enabled hashtable168168+ * @name: hashtable to iterate169169+ * @obj: the type * to use as a loop cursor for each entry170170+ * @node: the &struct list_head to use as a loop cursor for each entry171171+ * @member: the name of the hlist_node within the struct172172+ * @key: the key of the objects to iterate over173173+ */174174+#define hash_for_each_possible_rcu(name, obj, node, member, key) \175175+ hlist_for_each_entry_rcu(obj, node, &name[hash_min(key, HASH_BITS(name))], member)176176+177177+/**178178+ * hash_for_each_possible_safe - iterate over all possible objects hashing to the179179+ * same bucket safe against removals180180+ * @name: hashtable to iterate181181+ * @obj: the type * to use as a loop cursor for each entry182182+ * @node: the &struct list_head to use as a loop cursor for each entry183183+ * @tmp: a &struct used for temporary storage184184+ * @member: the name of the hlist_node within the struct185185+ * @key: the key of the objects to iterate over186186+ */187187+#define hash_for_each_possible_safe(name, obj, node, tmp, member, key) \188188+ hlist_for_each_entry_safe(obj, node, tmp, \189189+ &name[hash_min(key, HASH_BITS(name))], member)190190+191191+192192+#endif
+2-13
include/linux/kvm_host.h
···4242 */4343#define KVM_MEMSLOT_INVALID (1UL << 16)44444545-/*4646- * If we support unaligned MMIO, at most one fragment will be split into two:4747- */4848-#ifdef KVM_UNALIGNED_MMIO4949-# define KVM_EXTRA_MMIO_FRAGMENTS 15050-#else5151-# define KVM_EXTRA_MMIO_FRAGMENTS 05252-#endif5353-5454-#define KVM_USER_MMIO_SIZE 85555-5656-#define KVM_MAX_MMIO_FRAGMENTS \5757- (KVM_MMIO_SIZE / KVM_USER_MMIO_SIZE + KVM_EXTRA_MMIO_FRAGMENTS)4545+/* Two fragments for cross MMIO pages. */4646+#define KVM_MAX_MMIO_FRAGMENTS 258475948/*6049 * For the normal pfn, the highest 12 bits should be zero,
···5454 * clock operations5555 *5656 * @adjfreq: Adjusts the frequency of the hardware clock.5757- * parameter delta: Desired period change in parts per billion.5757+ * parameter delta: Desired frequency offset from nominal frequency5858+ * in parts per billion5859 *5960 * @adjtime: Shifts the time of the hardware clock.6061 * parameter delta: Desired change in nanoseconds.
···1111 (for example /usr/src/linux/COPYING); if not, write to the Free1212 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 1313*/1414-1514#ifndef _MD_U_H1615#define _MD_U_H17161818-/*1919- * Different major versions are not compatible.2020- * Different minor versions are only downward compatible.2121- * Different patchlevel versions are downward and upward compatible.2222- */2323-#define MD_MAJOR_VERSION 02424-#define MD_MINOR_VERSION 902525-/*2626- * MD_PATCHLEVEL_VERSION indicates kernel functionality.2727- * >=1 means different superblock formats are selectable using SET_ARRAY_INFO2828- * and major_version/minor_version accordingly2929- * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT3030- * in the super status byte3131- * >=3 means that bitmap superblock version 4 is supported, which uses3232- * little-ending representation rather than host-endian3333- */3434-#define MD_PATCHLEVEL_VERSION 31717+#include <uapi/linux/raid/md_u.h>35183636-/* ioctls */3737-3838-/* status */3939-#define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t)4040-#define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t)4141-#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)4242-#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13)4343-#define RAID_AUTORUN _IO (MD_MAJOR, 0x14)4444-#define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)4545-4646-/* configuration */4747-#define CLEAR_ARRAY _IO (MD_MAJOR, 0x20)4848-#define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)4949-#define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22)5050-#define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t)5151-#define SET_DISK_INFO _IO (MD_MAJOR, 0x24)5252-#define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25)5353-#define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26)5454-#define PROTECT_ARRAY _IO (MD_MAJOR, 0x27)5555-#define HOT_ADD_DISK _IO (MD_MAJOR, 0x28)5656-#define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29)5757-#define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a)5858-#define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int)5959-6060-/* usage */6161-#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t)6262-/* 0x31 was START_ARRAY */6363-#define STOP_ARRAY _IO (MD_MAJOR, 0x32)6464-#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33)6565-#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34)6666-6767-/* 63 partitions with the alternate major number (mdp) */6868-#define MdpMinorShift 66969-#ifdef __KERNEL__7019extern int mdp_major;7171-#endif7272-7373-typedef struct mdu_version_s {7474- int major;7575- int minor;7676- int patchlevel;7777-} mdu_version_t;7878-7979-typedef struct mdu_array_info_s {8080- /*8181- * Generic constant information8282- */8383- int major_version;8484- int minor_version;8585- int patch_version;8686- int ctime;8787- int level;8888- int size;8989- int nr_disks;9090- int raid_disks;9191- int md_minor;9292- int not_persistent;9393-9494- /*9595- * Generic state information9696- */9797- int utime; /* 0 Superblock update time */9898- int state; /* 1 State bits (clean, ...) */9999- int active_disks; /* 2 Number of currently active disks */100100- int working_disks; /* 3 Number of working disks */101101- int failed_disks; /* 4 Number of failed disks */102102- int spare_disks; /* 5 Number of spare disks */103103-104104- /*105105- * Personality information106106- */107107- int layout; /* 0 the array's physical layout */108108- int chunk_size; /* 1 chunk size in bytes */109109-110110-} mdu_array_info_t;111111-112112-/* non-obvious values for 'level' */113113-#define LEVEL_MULTIPATH (-4)114114-#define LEVEL_LINEAR (-1)115115-#define LEVEL_FAULTY (-5)116116-117117-/* we need a value for 'no level specified' and 0118118- * means 'raid0', so we need something else. This is119119- * for internal use only120120- */121121-#define LEVEL_NONE (-1000000)122122-123123-typedef struct mdu_disk_info_s {124124- /*125125- * configuration/status of one particular disk126126- */127127- int number;128128- int major;129129- int minor;130130- int raid_disk;131131- int state;132132-133133-} mdu_disk_info_t;134134-135135-typedef struct mdu_start_info_s {136136- /*137137- * configuration/status of one particular disk138138- */139139- int major;140140- int minor;141141- int raid_disk;142142- int state;143143-144144-} mdu_start_info_t;145145-146146-typedef struct mdu_bitmap_file_s147147-{148148- char pathname[4096];149149-} mdu_bitmap_file_t;150150-151151-typedef struct mdu_param_s152152-{153153- int personality; /* 1,2,3,4 */154154- int chunk_size; /* in bytes */155155- int max_fault; /* unused for now */156156-} mdu_param_t;157157-15820#endif 159159-
+9
include/net/cfg80211.h
···26522652unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);2653265326542654/**26552655+ * ieee80211_get_mesh_hdrlen - get mesh extension header length26562656+ * @meshhdr: the mesh extension header, only the flags field26572657+ * (first byte) will be accessed26582658+ * Returns the length of the extension header, which is always at26592659+ * least 6 bytes and at most 18 if address 5 and 6 are present.26602660+ */26612661+unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);26622662+26632663+/**26552664 * DOC: Data path helpers26562665 *26572666 * In addition to generic utilities, cfg80211 also offers
+3
include/sound/core.h
···132132 int shutdown; /* this card is going down */133133 int free_on_last_close; /* free in context of file_release */134134 wait_queue_head_t shutdown_sleep;135135+ atomic_t refcount; /* refcount for disconnection */135136 struct device *dev; /* device assigned to this card */136137 struct device *card_dev; /* cardX object for sysfs */137138···190189 const struct file_operations *f_ops; /* file operations */191190 void *private_data; /* private data for f_ops->open */192191 struct device *dev; /* device for sysfs */192192+ struct snd_card *card_ptr; /* assigned card instance */193193};194194195195/* return a device pointer linked to each sound device as a parent */···297295int snd_component_add(struct snd_card *card, const char *component);298296int snd_card_file_add(struct snd_card *card, struct file *file);299297int snd_card_file_remove(struct snd_card *card, struct file *file);298298+void snd_card_unref(struct snd_card *card);300299301300#define snd_card_set_dev(card, devptr) ((card)->dev = (devptr))302301
···2525#define EPOLL_CTL_ADD 12626#define EPOLL_CTL_DEL 22727#define EPOLL_CTL_MOD 32828-#define EPOLL_CTL_DISABLE 429283029/*3130 * Request the handling of system wakeup events so as to prevent system suspends
···11+/*22+ md_u.h : user <=> kernel API between Linux raidtools and RAID drivers33+ Copyright (C) 1998 Ingo Molnar44+55+ This program is free software; you can redistribute it and/or modify66+ it under the terms of the GNU General Public License as published by77+ the Free Software Foundation; either version 2, or (at your option)88+ any later version.99+1010+ You should have received a copy of the GNU General Public License1111+ (for example /usr/src/linux/COPYING); if not, write to the Free1212+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 1313+*/1414+1515+#ifndef _UAPI_MD_U_H1616+#define _UAPI_MD_U_H1717+1818+/*1919+ * Different major versions are not compatible.2020+ * Different minor versions are only downward compatible.2121+ * Different patchlevel versions are downward and upward compatible.2222+ */2323+#define MD_MAJOR_VERSION 02424+#define MD_MINOR_VERSION 902525+/*2626+ * MD_PATCHLEVEL_VERSION indicates kernel functionality.2727+ * >=1 means different superblock formats are selectable using SET_ARRAY_INFO2828+ * and major_version/minor_version accordingly2929+ * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT3030+ * in the super status byte3131+ * >=3 means that bitmap superblock version 4 is supported, which uses3232+ * little-ending representation rather than host-endian3333+ */3434+#define MD_PATCHLEVEL_VERSION 33535+3636+/* ioctls */3737+3838+/* status */3939+#define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t)4040+#define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t)4141+#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)4242+#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13)4343+#define RAID_AUTORUN _IO (MD_MAJOR, 0x14)4444+#define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)4545+4646+/* configuration */4747+#define CLEAR_ARRAY _IO (MD_MAJOR, 0x20)4848+#define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)4949+#define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22)5050+#define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t)5151+#define SET_DISK_INFO _IO (MD_MAJOR, 0x24)5252+#define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25)5353+#define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26)5454+#define PROTECT_ARRAY _IO (MD_MAJOR, 0x27)5555+#define HOT_ADD_DISK _IO (MD_MAJOR, 0x28)5656+#define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29)5757+#define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a)5858+#define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int)5959+6060+/* usage */6161+#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t)6262+/* 0x31 was START_ARRAY */6363+#define STOP_ARRAY _IO (MD_MAJOR, 0x32)6464+#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33)6565+#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34)6666+6767+/* 63 partitions with the alternate major number (mdp) */6868+#define MdpMinorShift 66969+7070+typedef struct mdu_version_s {7171+ int major;7272+ int minor;7373+ int patchlevel;7474+} mdu_version_t;7575+7676+typedef struct mdu_array_info_s {7777+ /*7878+ * Generic constant information7979+ */8080+ int major_version;8181+ int minor_version;8282+ int patch_version;8383+ int ctime;8484+ int level;8585+ int size;8686+ int nr_disks;8787+ int raid_disks;8888+ int md_minor;8989+ int not_persistent;9090+9191+ /*9292+ * Generic state information9393+ */9494+ int utime; /* 0 Superblock update time */9595+ int state; /* 1 State bits (clean, ...) */9696+ int active_disks; /* 2 Number of currently active disks */9797+ int working_disks; /* 3 Number of working disks */9898+ int failed_disks; /* 4 Number of failed disks */9999+ int spare_disks; /* 5 Number of spare disks */100100+101101+ /*102102+ * Personality information103103+ */104104+ int layout; /* 0 the array's physical layout */105105+ int chunk_size; /* 1 chunk size in bytes */106106+107107+} mdu_array_info_t;108108+109109+/* non-obvious values for 'level' */110110+#define LEVEL_MULTIPATH (-4)111111+#define LEVEL_LINEAR (-1)112112+#define LEVEL_FAULTY (-5)113113+114114+/* we need a value for 'no level specified' and 0115115+ * means 'raid0', so we need something else. This is116116+ * for internal use only117117+ */118118+#define LEVEL_NONE (-1000000)119119+120120+typedef struct mdu_disk_info_s {121121+ /*122122+ * configuration/status of one particular disk123123+ */124124+ int number;125125+ int major;126126+ int minor;127127+ int raid_disk;128128+ int state;129129+130130+} mdu_disk_info_t;131131+132132+typedef struct mdu_start_info_s {133133+ /*134134+ * configuration/status of one particular disk135135+ */136136+ int major;137137+ int minor;138138+ int raid_disk;139139+ int state;140140+141141+} mdu_start_info_t;142142+143143+typedef struct mdu_bitmap_file_s144144+{145145+ char pathname[4096];146146+} mdu_bitmap_file_t;147147+148148+typedef struct mdu_param_s149149+{150150+ int personality; /* 1,2,3,4 */151151+ int chunk_size; /* in bytes */152152+ int max_fault; /* unused for now */153153+} mdu_param_t;154154+155155+#endif /* _UAPI_MD_U_H */
···186186187187 if (!nf_inet_addr_cmp(&ct->tuplehash[dir].tuple.src.u3,188188 &ct->tuplehash[!dir].tuple.dst.u3) ||189189- (ct->tuplehash[dir].tuple.src.u.all !=189189+ (ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMPV6 &&190190+ ct->tuplehash[dir].tuple.src.u.all !=190191 ct->tuplehash[!dir].tuple.dst.u.all))191192 if (nf_xfrm_me_harder(skb, AF_INET6) < 0)192193 ret = NF_DROP;···223222 }224223#ifdef CONFIG_XFRM225224 else if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) &&225225+ ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMPV6 &&226226 ct->tuplehash[dir].tuple.dst.u.all !=227227 ct->tuplehash[!dir].tuple.src.u.all)228228 if (nf_xfrm_me_harder(skb, AF_INET6))
+2-2
net/ipv6/netfilter/nf_conntrack_reasm.c
···8585 { }8686};87878888-static int __net_init nf_ct_frag6_sysctl_register(struct net *net)8888+static int nf_ct_frag6_sysctl_register(struct net *net)8989{9090 struct ctl_table *table;9191 struct ctl_table_header *hdr;···127127}128128129129#else130130-static int __net_init nf_ct_frag6_sysctl_register(struct net *net)130130+static int nf_ct_frag6_sysctl_register(struct net *net)131131{132132 return 0;133133}
···531531532532 if (ieee80211_is_action(hdr->frame_control)) {533533 u8 category;534534+535535+ /* make sure category field is present */536536+ if (rx->skb->len < IEEE80211_MIN_ACTION_SIZE)537537+ return RX_DROP_MONITOR;538538+534539 mgmt = (struct ieee80211_mgmt *)hdr;535540 category = mgmt->u.action.category;536541 if (category != WLAN_CATEGORY_MESH_ACTION &&···888883 */889884 if (rx->sta && rx->sdata->vif.type == NL80211_IFTYPE_STATION &&890885 ieee80211_is_data_present(hdr->frame_control)) {891891- u16 ethertype;892892- u8 *payload;886886+ unsigned int hdrlen;887887+ __be16 ethertype;893888894894- payload = rx->skb->data +895895- ieee80211_hdrlen(hdr->frame_control);896896- ethertype = (payload[6] << 8) | payload[7];897897- if (cpu_to_be16(ethertype) ==898898- rx->sdata->control_port_protocol)889889+ hdrlen = ieee80211_hdrlen(hdr->frame_control);890890+891891+ if (rx->skb->len < hdrlen + 8)892892+ return RX_DROP_MONITOR;893893+894894+ skb_copy_bits(rx->skb, hdrlen + 6, ðertype, 2);895895+ if (ethertype == rx->sdata->control_port_protocol)899896 return RX_CONTINUE;900897 }901898···1469146214701463 hdr = (struct ieee80211_hdr *)rx->skb->data;14711464 fc = hdr->frame_control;14651465+14661466+ if (ieee80211_is_ctl(fc))14671467+ return RX_CONTINUE;14681468+14721469 sc = le16_to_cpu(hdr->seq_ctrl);14731470 frag = sc & IEEE80211_SCTL_FRAG;1474147114751472 if (likely((!ieee80211_has_morefrags(fc) && frag == 0) ||14761476- (rx->skb)->len < 24 ||14771473 is_multicast_ether_addr(hdr->addr1))) {14781474 /* not fragmented */14791475 goto out;···1899188919001890 hdr = (struct ieee80211_hdr *) skb->data;19011891 hdrlen = ieee80211_hdrlen(hdr->frame_control);18921892+18931893+ /* make sure fixed part of mesh header is there, also checks skb len */18941894+ if (!pskb_may_pull(rx->skb, hdrlen + 6))18951895+ return RX_DROP_MONITOR;18961896+18971897+ mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen);18981898+18991899+ /* make sure full mesh header is there, also checks skb len */19001900+ if (!pskb_may_pull(rx->skb,19011901+ hdrlen + ieee80211_get_mesh_hdrlen(mesh_hdr)))19021902+ return RX_DROP_MONITOR;19031903+19041904+ /* reload pointers */19051905+ hdr = (struct ieee80211_hdr *) skb->data;19021906 mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen);1903190719041908 /* frame is in RMC, don't forward */···19211897 mesh_rmc_check(hdr->addr3, mesh_hdr, rx->sdata))19221898 return RX_DROP_MONITOR;1923189919241924- if (!ieee80211_is_data(hdr->frame_control))19001900+ if (!ieee80211_is_data(hdr->frame_control) ||19011901+ !(status->rx_flags & IEEE80211_RX_RA_MATCH))19251902 return RX_CONTINUE;1926190319271904 if (!mesh_hdr->ttl)···19361911 if (is_multicast_ether_addr(hdr->addr1)) {19371912 mpp_addr = hdr->addr3;19381913 proxied_addr = mesh_hdr->eaddr1;19391939- } else {19141914+ } else if (mesh_hdr->flags & MESH_FLAGS_AE_A5_A6) {19151915+ /* has_a4 already checked in ieee80211_rx_mesh_check */19401916 mpp_addr = hdr->addr4;19411917 proxied_addr = mesh_hdr->eaddr2;19181918+ } else {19191919+ return RX_DROP_MONITOR;19421920 }1943192119441922 rcu_read_lock();···19691941 }19701942 skb_set_queue_mapping(skb, q);1971194319721972- if (!(status->rx_flags & IEEE80211_RX_RA_MATCH))19731973- goto out;19741974-19751944 if (!--mesh_hdr->ttl) {19761945 IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl);19771977- return RX_DROP_MONITOR;19461946+ goto out;19781947 }1979194819801949 if (!ifmsh->mshcfg.dot11MeshForwarding)···23782353 }23792354 break;23802355 case WLAN_CATEGORY_SELF_PROTECTED:23562356+ if (len < (IEEE80211_MIN_ACTION_SIZE +23572357+ sizeof(mgmt->u.action.u.self_prot.action_code)))23582358+ break;23592359+23812360 switch (mgmt->u.action.u.self_prot.action_code) {23822361 case WLAN_SP_MESH_PEERING_OPEN:23832362 case WLAN_SP_MESH_PEERING_CLOSE:···24002371 }24012372 break;24022373 case WLAN_CATEGORY_MESH_ACTION:23742374+ if (len < (IEEE80211_MIN_ACTION_SIZE +23752375+ sizeof(mgmt->u.action.u.mesh_action.action_code)))23762376+ break;23772377+24032378 if (!ieee80211_vif_is_mesh(&sdata->vif))24042379 break;24052380 if (mesh_action_is_path_sel(mgmt) &&···29462913 if (ieee80211_is_data(fc) || ieee80211_is_mgmt(fc))29472914 local->dot11ReceivedFragmentCount++;2948291529492949- if (ieee80211_is_mgmt(fc))29502950- err = skb_linearize(skb);29512951- else29162916+ if (ieee80211_is_mgmt(fc)) {29172917+ /* drop frame if too short for header */29182918+ if (skb->len < ieee80211_hdrlen(fc))29192919+ err = -ENOBUFS;29202920+ else29212921+ err = skb_linearize(skb);29222922+ } else {29522923 err = !pskb_may_pull(skb, ieee80211_hdrlen(fc));29242924+ }2953292529542926 if (err) {29552927 dev_kfree_skb(skb);
+35-7
net/mac80211/util.c
···643643 break;644644 }645645646646- if (id != WLAN_EID_VENDOR_SPECIFIC &&647647- id != WLAN_EID_QUIET &&648648- test_bit(id, seen_elems)) {649649- elems->parse_error = true;650650- left -= elen;651651- pos += elen;652652- continue;646646+ switch (id) {647647+ case WLAN_EID_SSID:648648+ case WLAN_EID_SUPP_RATES:649649+ case WLAN_EID_FH_PARAMS:650650+ case WLAN_EID_DS_PARAMS:651651+ case WLAN_EID_CF_PARAMS:652652+ case WLAN_EID_TIM:653653+ case WLAN_EID_IBSS_PARAMS:654654+ case WLAN_EID_CHALLENGE:655655+ case WLAN_EID_RSN:656656+ case WLAN_EID_ERP_INFO:657657+ case WLAN_EID_EXT_SUPP_RATES:658658+ case WLAN_EID_HT_CAPABILITY:659659+ case WLAN_EID_HT_OPERATION:660660+ case WLAN_EID_VHT_CAPABILITY:661661+ case WLAN_EID_VHT_OPERATION:662662+ case WLAN_EID_MESH_ID:663663+ case WLAN_EID_MESH_CONFIG:664664+ case WLAN_EID_PEER_MGMT:665665+ case WLAN_EID_PREQ:666666+ case WLAN_EID_PREP:667667+ case WLAN_EID_PERR:668668+ case WLAN_EID_RANN:669669+ case WLAN_EID_CHANNEL_SWITCH:670670+ case WLAN_EID_EXT_CHANSWITCH_ANN:671671+ case WLAN_EID_COUNTRY:672672+ case WLAN_EID_PWR_CONSTRAINT:673673+ case WLAN_EID_TIMEOUT_INTERVAL:674674+ if (test_bit(id, seen_elems)) {675675+ elems->parse_error = true;676676+ left -= elen;677677+ pos += elen;678678+ continue;679679+ }680680+ break;653681 }654682655683 if (calc_crc && id < 64 && (filter & (1ULL << id)))
+2-1
net/netfilter/nf_conntrack_h323_main.c
···753753 flowi4_to_flowi(&fl1), false)) {754754 if (!afinfo->route(&init_net, (struct dst_entry **)&rt2,755755 flowi4_to_flowi(&fl2), false)) {756756- if (rt1->rt_gateway == rt2->rt_gateway &&756756+ if (rt_nexthop(rt1, fl1.daddr) ==757757+ rt_nexthop(rt2, fl2.daddr) &&757758 rt1->dst.dev == rt2->dst.dev)758759 ret = 1;759760 dst_release(&rt2->dst);
+79-30
net/sched/sch_qfq.c
···8484 * grp->index is the index of the group; and grp->slot_shift8585 * is the shift for the corresponding (scaled) sigma_i.8686 */8787-#define QFQ_MAX_INDEX 198888-#define QFQ_MAX_WSHIFT 168787+#define QFQ_MAX_INDEX 248888+#define QFQ_MAX_WSHIFT 1289899090#define QFQ_MAX_WEIGHT (1<<QFQ_MAX_WSHIFT)9191-#define QFQ_MAX_WSUM (2*QFQ_MAX_WEIGHT)9191+#define QFQ_MAX_WSUM (16*QFQ_MAX_WEIGHT)92929393#define FRAC_BITS 30 /* fixed point arithmetic */9494#define ONE_FP (1UL << FRAC_BITS)9595#define IWSUM (ONE_FP/QFQ_MAX_WSUM)96969797-#define QFQ_MTU_SHIFT 119797+#define QFQ_MTU_SHIFT 16 /* to support TSO/GSO */9898#define QFQ_MIN_SLOT_SHIFT (FRAC_BITS + QFQ_MTU_SHIFT - QFQ_MAX_INDEX)9999+#define QFQ_MIN_LMAX 256 /* min possible lmax for a class */99100100101/*101102 * Possible group states. These values are used as indexes for the bitmaps···232231 q->wsum += delta_w;233232}234233234234+static void qfq_update_reactivate_class(struct qfq_sched *q,235235+ struct qfq_class *cl,236236+ u32 inv_w, u32 lmax, int delta_w)237237+{238238+ bool need_reactivation = false;239239+ int i = qfq_calc_index(inv_w, lmax);240240+241241+ if (&q->groups[i] != cl->grp && cl->qdisc->q.qlen > 0) {242242+ /*243243+ * shift cl->F back, to not charge the244244+ * class for the not-yet-served head245245+ * packet246246+ */247247+ cl->F = cl->S;248248+ /* remove class from its slot in the old group */249249+ qfq_deactivate_class(q, cl);250250+ need_reactivation = true;251251+ }252252+253253+ qfq_update_class_params(q, cl, lmax, inv_w, delta_w);254254+255255+ if (need_reactivation) /* activate in new group */256256+ qfq_activate_class(q, cl, qdisc_peek_len(cl->qdisc));257257+}258258+259259+235260static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,236261 struct nlattr **tca, unsigned long *arg)237262{···265238 struct qfq_class *cl = (struct qfq_class *)*arg;266239 struct nlattr *tb[TCA_QFQ_MAX + 1];267240 u32 weight, lmax, inv_w;268268- int i, err;241241+ int err;269242 int delta_w;270243271244 if (tca[TCA_OPTIONS] == NULL) {···297270298271 if (tb[TCA_QFQ_LMAX]) {299272 lmax = nla_get_u32(tb[TCA_QFQ_LMAX]);300300- if (!lmax || lmax > (1UL << QFQ_MTU_SHIFT)) {273273+ if (lmax < QFQ_MIN_LMAX || lmax > (1UL << QFQ_MTU_SHIFT)) {301274 pr_notice("qfq: invalid max length %u\n", lmax);302275 return -EINVAL;303276 }304277 } else305305- lmax = 1UL << QFQ_MTU_SHIFT;278278+ lmax = psched_mtu(qdisc_dev(sch));306279307280 if (cl != NULL) {308308- bool need_reactivation = false;309309-310281 if (tca[TCA_RATE]) {311282 err = gen_replace_estimator(&cl->bstats, &cl->rate_est,312283 qdisc_root_sleeping_lock(sch),···316291 if (lmax == cl->lmax && inv_w == cl->inv_w)317292 return 0; /* nothing to update */318293319319- i = qfq_calc_index(inv_w, lmax);320294 sch_tree_lock(sch);321321- if (&q->groups[i] != cl->grp && cl->qdisc->q.qlen > 0) {322322- /*323323- * shift cl->F back, to not charge the324324- * class for the not-yet-served head325325- * packet326326- */327327- cl->F = cl->S;328328- /* remove class from its slot in the old group */329329- qfq_deactivate_class(q, cl);330330- need_reactivation = true;331331- }332332-333333- qfq_update_class_params(q, cl, lmax, inv_w, delta_w);334334-335335- if (need_reactivation) /* activate in new group */336336- qfq_activate_class(q, cl, qdisc_peek_len(cl->qdisc));295295+ qfq_update_reactivate_class(q, cl, inv_w, lmax, delta_w);337296 sch_tree_unlock(sch);338297339298 return 0;···672663673664674665/*675675- * XXX we should make sure that slot becomes less than 32.676676- * This is guaranteed by the input values.677677- * roundedS is always cl->S rounded on grp->slot_shift bits.666666+ * If the weight and lmax (max_pkt_size) of the classes do not change,667667+ * then QFQ guarantees that the slot index is never higher than668668+ * 2 + ((1<<QFQ_MTU_SHIFT)/QFQ_MIN_LMAX) * (QFQ_MAX_WEIGHT/QFQ_MAX_WSUM).669669+ *670670+ * With the current values of the above constants, the index is671671+ * then guaranteed to never be higher than 2 + 256 * (1 / 16) = 18.672672+ *673673+ * When the weight of a class is increased or the lmax of the class is674674+ * decreased, a new class with smaller slot size may happen to be675675+ * activated. The activation of this class should be properly delayed676676+ * to when the service of the class has finished in the ideal system677677+ * tracked by QFQ. If the activation of the class is not delayed to678678+ * this reference time instant, then this class may be unjustly served679679+ * before other classes waiting for service. This may cause680680+ * (unfrequently) the above bound to the slot index to be violated for681681+ * some of these unlucky classes.682682+ *683683+ * Instead of delaying the activation of the new class, which is quite684684+ * complex, the following inaccurate but simple solution is used: if685685+ * the slot index is higher than QFQ_MAX_SLOTS-2, then the timestamps686686+ * of the class are shifted backward so as to let the slot index687687+ * become equal to QFQ_MAX_SLOTS-2. This threshold is used because, if688688+ * the slot index is above it, then the data structure implementing689689+ * the bucket list either gets immediately corrupted or may get690690+ * corrupted on a possible next packet arrival that causes the start691691+ * time of the group to be shifted backward.678692 */679693static void qfq_slot_insert(struct qfq_group *grp, struct qfq_class *cl,680694 u64 roundedS)681695{682696 u64 slot = (roundedS - grp->S) >> grp->slot_shift;683683- unsigned int i = (grp->front + slot) % QFQ_MAX_SLOTS;697697+ unsigned int i; /* slot index in the bucket list */698698+699699+ if (unlikely(slot > QFQ_MAX_SLOTS - 2)) {700700+ u64 deltaS = roundedS - grp->S -701701+ ((u64)(QFQ_MAX_SLOTS - 2)<<grp->slot_shift);702702+ cl->S -= deltaS;703703+ cl->F -= deltaS;704704+ slot = QFQ_MAX_SLOTS - 2;705705+ }706706+707707+ i = (grp->front + slot) % QFQ_MAX_SLOTS;684708685709 hlist_add_head(&cl->next, &grp->slots[i]);686710 __set_bit(slot, &grp->full_slots);···933891 return err;934892 }935893 pr_debug("qfq_enqueue: cl = %x\n", cl->common.classid);894894+895895+ if (unlikely(cl->lmax < qdisc_pkt_len(skb))) {896896+ pr_debug("qfq: increasing maxpkt from %u to %u for class %u",897897+ cl->lmax, qdisc_pkt_len(skb), cl->common.classid);898898+ qfq_update_reactivate_class(q, cl, cl->inv_w,899899+ qdisc_pkt_len(skb), 0);900900+ }936901937902 err = qdisc_enqueue(skb, cl->qdisc);938903 if (unlikely(err != NET_XMIT_SUCCESS)) {
+1-1
net/sctp/socket.c
···974974 void *addr_buf;975975 struct sctp_af *af;976976977977- SCTP_DEBUG_PRINTK("sctp_setsocktopt_bindx: sk %p addrs %p"977977+ SCTP_DEBUG_PRINTK("sctp_setsockopt_bindx: sk %p addrs %p"978978 " addrs_size %d opt %d\n", sk, addrs, addrs_size, op);979979980980 if (unlikely(addrs_size <= 0))
···369369 return usecs;370370}371371372372+static void snd_pcm_set_state(struct snd_pcm_substream *substream, int state)373373+{374374+ snd_pcm_stream_lock_irq(substream);375375+ if (substream->runtime->status->state != SNDRV_PCM_STATE_DISCONNECTED)376376+ substream->runtime->status->state = state;377377+ snd_pcm_stream_unlock_irq(substream);378378+}379379+372380static int snd_pcm_hw_params(struct snd_pcm_substream *substream,373381 struct snd_pcm_hw_params *params)374382{···460452 runtime->boundary *= 2;461453462454 snd_pcm_timer_resolution_change(substream);463463- runtime->status->state = SNDRV_PCM_STATE_SETUP;455455+ snd_pcm_set_state(substream, SNDRV_PCM_STATE_SETUP);464456465457 if (pm_qos_request_active(&substream->latency_pm_qos_req))466458 pm_qos_remove_request(&substream->latency_pm_qos_req);···472464 /* hardware might be unusable from this time,473465 so we force application to retry to set474466 the correct hardware parameter settings */475475- runtime->status->state = SNDRV_PCM_STATE_OPEN;467467+ snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN);476468 if (substream->ops->hw_free != NULL)477469 substream->ops->hw_free(substream);478470 return err;···520512 return -EBADFD;521513 if (substream->ops->hw_free)522514 result = substream->ops->hw_free(substream);523523- runtime->status->state = SNDRV_PCM_STATE_OPEN;515515+ snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN);524516 pm_qos_remove_request(&substream->latency_pm_qos_req);525517 return result;526518}···13281320{13291321 struct snd_pcm_runtime *runtime = substream->runtime;13301322 runtime->control->appl_ptr = runtime->status->hw_ptr;13311331- runtime->status->state = SNDRV_PCM_STATE_PREPARED;13231323+ snd_pcm_set_state(substream, SNDRV_PCM_STATE_PREPARED);13321324}1333132513341326static struct action_ops snd_pcm_action_prepare = {···15181510 down_read(&snd_pcm_link_rwsem);15191511 snd_pcm_stream_lock_irq(substream);15201512 remove_wait_queue(&to_check->sleep, &wait);15131513+ if (card->shutdown) {15141514+ result = -ENODEV;15151515+ break;15161516+ }15211517 if (tout == 0) {15221518 if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED)15231519 result = -ESTRPIPE;···16461634 write_unlock_irq(&snd_pcm_link_rwlock);16471635 up_write(&snd_pcm_link_rwsem);16481636 _nolock:16371637+ snd_card_unref(substream1->pcm->card);16491638 fput_light(file, fput_needed);16501639 if (res < 0)16511640 kfree(group);···21212108 return err;21222109 pcm = snd_lookup_minor_data(iminor(inode),21232110 SNDRV_DEVICE_TYPE_PCM_PLAYBACK);21242124- return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK);21112111+ err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK);21122112+ if (pcm)21132113+ snd_card_unref(pcm->card);21142114+ return err;21252115}2126211621272117static int snd_pcm_capture_open(struct inode *inode, struct file *file)···21352119 return err;21362120 pcm = snd_lookup_minor_data(iminor(inode),21372121 SNDRV_DEVICE_TYPE_PCM_CAPTURE);21382138- return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE);21222122+ err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE);21232123+ if (pcm)21242124+ snd_card_unref(pcm->card);21252125+ return err;21392126}2140212721412128static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream)···21752156 mutex_unlock(&pcm->open_mutex);21762157 schedule();21772158 mutex_lock(&pcm->open_mutex);21592159+ if (pcm->card->shutdown) {21602160+ err = -ENODEV;21612161+ break;21622162+ }21782163 if (signal_pending(current)) {21792164 err = -ERESTARTSYS;21802165 break;
+25-1
sound/core/rawmidi.c
···379379 if (rmidi == NULL)380380 return -ENODEV;381381382382- if (!try_module_get(rmidi->card->module))382382+ if (!try_module_get(rmidi->card->module)) {383383+ snd_card_unref(rmidi->card);383384 return -ENXIO;385385+ }384386385387 mutex_lock(&rmidi->open_mutex);386388 card = rmidi->card;···424422 mutex_unlock(&rmidi->open_mutex);425423 schedule();426424 mutex_lock(&rmidi->open_mutex);425425+ if (rmidi->card->shutdown) {426426+ err = -ENODEV;427427+ break;428428+ }427429 if (signal_pending(current)) {428430 err = -ERESTARTSYS;429431 break;···446440#endif447441 file->private_data = rawmidi_file;448442 mutex_unlock(&rmidi->open_mutex);443443+ snd_card_unref(rmidi->card);449444 return 0;450445451446 __error:···454447 __error_card:455448 mutex_unlock(&rmidi->open_mutex);456449 module_put(rmidi->card->module);450450+ snd_card_unref(rmidi->card);457451 return err;458452}459453···999991 spin_unlock_irq(&runtime->lock);1000992 schedule();1001993 remove_wait_queue(&runtime->sleep, &wait);994994+ if (rfile->rmidi->card->shutdown)995995+ return -ENODEV;1002996 if (signal_pending(current))1003997 return result > 0 ? result : -ERESTARTSYS;1004998 if (!runtime->avail)···12441234 spin_unlock_irq(&runtime->lock);12451235 timeout = schedule_timeout(30 * HZ);12461236 remove_wait_queue(&runtime->sleep, &wait);12371237+ if (rfile->rmidi->card->shutdown)12381238+ return -ENODEV;12471239 if (signal_pending(current))12481240 return result > 0 ? result : -ERESTARTSYS;12491241 if (!runtime->avail && !timeout)···16211609static int snd_rawmidi_dev_disconnect(struct snd_device *device)16221610{16231611 struct snd_rawmidi *rmidi = device->device_data;16121612+ int dir;1624161316251614 mutex_lock(®ister_mutex);16151615+ mutex_lock(&rmidi->open_mutex);16161616+ wake_up(&rmidi->open_wait);16261617 list_del_init(&rmidi->list);16181618+ for (dir = 0; dir < 2; dir++) {16191619+ struct snd_rawmidi_substream *s;16201620+ list_for_each_entry(s, &rmidi->streams[dir].substreams, list) {16211621+ if (s->runtime)16221622+ wake_up(&s->runtime->sleep);16231623+ }16241624+ }16251625+16271626#ifdef CONFIG_SND_OSSEMUL16281627 if (rmidi->ossreg) {16291628 if ((int)rmidi->device == midi_map[rmidi->card->number]) {···16491626 }16501627#endif /* CONFIG_SND_OSSEMUL */16511628 snd_unregister_device(SNDRV_DEVICE_TYPE_RAWMIDI, rmidi->card, rmidi->device);16291629+ mutex_unlock(&rmidi->open_mutex);16521630 mutex_unlock(®ister_mutex);16531631 return 0;16541632}
+9-2
sound/core/sound.c
···9898 *9999 * Checks that a minor device with the specified type is registered, and returns100100 * its user data pointer.101101+ *102102+ * This function increments the reference counter of the card instance103103+ * if an associated instance with the given minor number and type is found.104104+ * The caller must call snd_card_unref() appropriately later.101105 */102106void *snd_lookup_minor_data(unsigned int minor, int type)103107{···112108 return NULL;113109 mutex_lock(&sound_mutex);114110 mreg = snd_minors[minor];115115- if (mreg && mreg->type == type)111111+ if (mreg && mreg->type == type) {116112 private_data = mreg->private_data;117117- else113113+ if (private_data && mreg->card_ptr)114114+ atomic_inc(&mreg->card_ptr->refcount);115115+ } else118116 private_data = NULL;119117 mutex_unlock(&sound_mutex);120118 return private_data;···281275 preg->device = dev;282276 preg->f_ops = f_ops;283277 preg->private_data = private_data;278278+ preg->card_ptr = card;284279 mutex_lock(&sound_mutex);285280#ifdef CONFIG_SND_DYNAMIC_MINORS286281 minor = snd_find_free_minor(type);
+8-2
sound/core/sound_oss.c
···4040static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS];4141static DEFINE_MUTEX(sound_oss_mutex);42424343+/* NOTE: This function increments the refcount of the associated card like4444+ * snd_lookup_minor_data(); the caller must call snd_card_unref() appropriately4545+ */4346void *snd_lookup_oss_minor_data(unsigned int minor, int type)4447{4548 struct snd_minor *mreg;···5249 return NULL;5350 mutex_lock(&sound_oss_mutex);5451 mreg = snd_oss_minors[minor];5555- if (mreg && mreg->type == type)5252+ if (mreg && mreg->type == type) {5653 private_data = mreg->private_data;5757- else5454+ if (private_data && mreg->card_ptr)5555+ atomic_inc(&mreg->card_ptr->refcount);5656+ } else5857 private_data = NULL;5958 mutex_unlock(&sound_oss_mutex);6059 return private_data;···128123 preg->device = dev;129124 preg->f_ops = f_ops;130125 preg->private_data = private_data;126126+ preg->card_ptr = card;131127 mutex_lock(&sound_oss_mutex);132128 snd_oss_minors[minor] = preg;133129 minor_unit = SNDRV_MINOR_OSS_DEVICE(minor);
···37223722 } while (count--);3723372337243724 if (count == 0)37253725- dev_warn(codec->dev, "No impedence range reported for jack\n");37253725+ dev_warn(codec->dev, "No impedance range reported for jack\n");3726372637273727#ifndef CONFIG_SND_SOC_WM8994_MODULE37283728 trace_snd_soc_jack_irq(dev_name(codec->dev));
+2-2
sound/soc/omap/omap-dmic.c
···464464465465 mutex_init(&dmic->mutex);466466467467- dmic->fclk = clk_get(dmic->dev, "dmic_fck");467467+ dmic->fclk = clk_get(dmic->dev, "fck");468468 if (IS_ERR(dmic->fclk)) {469469- dev_err(dmic->dev, "cant get dmic_fck\n");469469+ dev_err(dmic->dev, "cant get fck\n");470470 return -ENODEV;471471 }472472
···126126 struct snd_usb_endpoint *sync_endpoint;127127 unsigned long flags;128128 bool need_setup_ep; /* (re)configure EP at prepare? */129129+ unsigned int speed; /* USB_SPEED_XXX */129130130131 u64 formats; /* format bitmasks (all or'ed) */131132 unsigned int num_formats; /* number of supported audio formats (list) */
+13
sound/usb/endpoint.c
···35353636#define EP_FLAG_ACTIVATED 03737#define EP_FLAG_RUNNING 13838+#define EP_FLAG_STOPPING 238393940/*4041 * snd_usb_endpoint is a model that abstracts everything related to an···503502 if (alive)504503 snd_printk(KERN_ERR "timeout: still %d active urbs on EP #%x\n",505504 alive, ep->ep_num);505505+ clear_bit(EP_FLAG_STOPPING, &ep->flags);506506507507 return 0;508508+}509509+510510+/* sync the pending stop operation;511511+ * this function itself doesn't trigger the stop operation512512+ */513513+void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep)514514+{515515+ if (ep && test_bit(EP_FLAG_STOPPING, &ep->flags))516516+ wait_clear_urbs(ep);508517}509518510519/*···929918930919 if (wait)931920 wait_clear_urbs(ep);921921+ else922922+ set_bit(EP_FLAG_STOPPING, &ep->flags);932923 }933924}934925
+1
sound/usb/endpoint.h
···1919int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, int can_sleep);2020void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep,2121 int force, int can_sleep, int wait);2222+void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep);2223int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep);2324int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep);2425void snd_usb_endpoint_free(struct list_head *head);
+43-22
sound/usb/mixer.c
···287287 unsigned char buf[2];288288 int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1;289289 int timeout = 10;290290- int err;290290+ int idx = 0, err;291291292292 err = snd_usb_autoresume(cval->mixer->chip);293293 if (err < 0)294294 return -EIO;295295+ down_read(&chip->shutdown_rwsem);295296 while (timeout-- > 0) {297297+ if (chip->shutdown)298298+ break;299299+ idx = snd_usb_ctrl_intf(chip) | (cval->id << 8);296300 if (snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), request,297301 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,298298- validx, snd_usb_ctrl_intf(chip) | (cval->id << 8),299299- buf, val_len) >= val_len) {302302+ validx, idx, buf, val_len) >= val_len) {300303 *value_ret = convert_signed_value(cval, snd_usb_combine_bytes(buf, val_len));301301- snd_usb_autosuspend(cval->mixer->chip);302302- return 0;304304+ err = 0;305305+ goto out;303306 }304307 }305305- snd_usb_autosuspend(cval->mixer->chip);306308 snd_printdd(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",307307- request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type);308308- return -EINVAL;309309+ request, validx, idx, cval->val_type);310310+ err = -EINVAL;311311+312312+ out:313313+ up_read(&chip->shutdown_rwsem);314314+ snd_usb_autosuspend(cval->mixer->chip);315315+ return err;309316}310317311318static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret)···320313 struct snd_usb_audio *chip = cval->mixer->chip;321314 unsigned char buf[2 + 3*sizeof(__u16)]; /* enough space for one range */322315 unsigned char *val;323323- int ret, size;316316+ int idx = 0, ret, size;324317 __u8 bRequest;325318326319 if (request == UAC_GET_CUR) {···337330 if (ret)338331 goto error;339332340340- ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest,333333+ down_read(&chip->shutdown_rwsem);334334+ if (chip->shutdown)335335+ ret = -ENODEV;336336+ else {337337+ idx = snd_usb_ctrl_intf(chip) | (cval->id << 8);338338+ ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest,341339 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,342342- validx, snd_usb_ctrl_intf(chip) | (cval->id << 8),343343- buf, size);340340+ validx, idx, buf, size);341341+ }342342+ up_read(&chip->shutdown_rwsem);344343 snd_usb_autosuspend(chip);345344346345 if (ret < 0) {347346error:348347 snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",349349- request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type);348348+ request, validx, idx, cval->val_type);350349 return ret;351350 }352351···430417{431418 struct snd_usb_audio *chip = cval->mixer->chip;432419 unsigned char buf[2];433433- int val_len, err, timeout = 10;420420+ int idx = 0, val_len, err, timeout = 10;434421435422 if (cval->mixer->protocol == UAC_VERSION_1) {436423 val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1;···453440 err = snd_usb_autoresume(chip);454441 if (err < 0)455442 return -EIO;456456- while (timeout-- > 0)443443+ down_read(&chip->shutdown_rwsem);444444+ while (timeout-- > 0) {445445+ if (chip->shutdown)446446+ break;447447+ idx = snd_usb_ctrl_intf(chip) | (cval->id << 8);457448 if (snd_usb_ctl_msg(chip->dev,458449 usb_sndctrlpipe(chip->dev, 0), request,459450 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,460460- validx, snd_usb_ctrl_intf(chip) | (cval->id << 8),461461- buf, val_len) >= 0) {462462- snd_usb_autosuspend(chip);463463- return 0;451451+ validx, idx, buf, val_len) >= 0) {452452+ err = 0;453453+ goto out;464454 }465465- snd_usb_autosuspend(chip);455455+ }466456 snd_printdd(KERN_ERR "cannot set ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, data = %#x/%#x\n",467467- request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type, buf[0], buf[1]);468468- return -EINVAL;457457+ request, validx, idx, cval->val_type, buf[0], buf[1]);458458+ err = -EINVAL;459459+460460+ out:461461+ up_read(&chip->shutdown_rwsem);462462+ snd_usb_autosuspend(chip);463463+ return err;469464}470465471466static int set_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int value)
···3737 struct usb_interface *pm_intf;3838 u32 usb_id;3939 struct mutex mutex;4040- struct mutex shutdown_mutex;4040+ struct rw_semaphore shutdown_rwsem;4141 unsigned int shutdown:1;4242 unsigned int probing:1;4343 unsigned int autosuspended:1;
+1-1
tools/testing/selftests/Makefile
···11-TARGETS = breakpoints kcmp mqueue vm cpu-hotplug memory-hotplug epoll11+TARGETS = breakpoints kcmp mqueue vm cpu-hotplug memory-hotplug2233all:44 for TARGET in $(TARGETS); do \
···11-/*22- * tools/testing/selftests/epoll/test_epoll.c33- *44- * Copyright 2012 Adobe Systems Incorporated55- *66- * This program is free software; you can redistribute it and/or modify77- * it under the terms of the GNU General Public License as published by88- * the Free Software Foundation; either version 2 of the License, or99- * (at your option) any later version.1010- *1111- * Paton J. Lewis <palewis@adobe.com>1212- *1313- */1414-1515-#include <errno.h>1616-#include <fcntl.h>1717-#include <pthread.h>1818-#include <stdio.h>1919-#include <stdlib.h>2020-#include <unistd.h>2121-#include <sys/epoll.h>2222-#include <sys/socket.h>2323-2424-/*2525- * A pointer to an epoll_item_private structure will be stored in the epoll2626- * item's event structure so that we can get access to the epoll_item_private2727- * data after calling epoll_wait:2828- */2929-struct epoll_item_private {3030- int index; /* Position of this struct within the epoll_items array. */3131- int fd;3232- uint32_t events;3333- pthread_mutex_t mutex; /* Guards the following variables... */3434- int stop;3535- int status; /* Stores any error encountered while handling item. */3636- /* The following variable allows us to test whether we have encountered3737- a problem while attempting to cancel and delete the associated3838- event. When the test program exits, 'deleted' should be exactly3939- one. If it is greater than one, then the failed test reflects a real4040- world situation where we would have tried to access the epoll item's4141- private data after deleting it: */4242- int deleted;4343-};4444-4545-struct epoll_item_private *epoll_items;4646-4747-/*4848- * Delete the specified item from the epoll set. In a real-world secneario this4949- * is where we would free the associated data structure, but in this testing5050- * environment we retain the structure so that we can test for double-deletion:5151- */5252-void delete_item(int index)5353-{5454- __sync_fetch_and_add(&epoll_items[index].deleted, 1);5555-}5656-5757-/*5858- * A pointer to a read_thread_data structure will be passed as the argument to5959- * each read thread:6060- */6161-struct read_thread_data {6262- int stop;6363- int status; /* Indicates any error encountered by the read thread. */6464- int epoll_set;6565-};6666-6767-/*6868- * The function executed by the read threads:6969- */7070-void *read_thread_function(void *function_data)7171-{7272- struct read_thread_data *thread_data =7373- (struct read_thread_data *)function_data;7474- struct epoll_event event_data;7575- struct epoll_item_private *item_data;7676- char socket_data;7777-7878- /* Handle events until we encounter an error or this thread's 'stop'7979- condition is set: */8080- while (1) {8181- int result = epoll_wait(thread_data->epoll_set,8282- &event_data,8383- 1, /* Number of desired events */8484- 1000); /* Timeout in ms */8585- if (result < 0) {8686- /* Breakpoints signal all threads. Ignore that while8787- debugging: */8888- if (errno == EINTR)8989- continue;9090- thread_data->status = errno;9191- return 0;9292- } else if (thread_data->stop)9393- return 0;9494- else if (result == 0) /* Timeout */9595- continue;9696-9797- /* We need the mutex here because checking for the stop9898- condition and re-enabling the epoll item need to be done9999- together as one atomic operation when EPOLL_CTL_DISABLE is100100- available: */101101- item_data = (struct epoll_item_private *)event_data.data.ptr;102102- pthread_mutex_lock(&item_data->mutex);103103-104104- /* Remove the item from the epoll set if we want to stop105105- handling that event: */106106- if (item_data->stop)107107- delete_item(item_data->index);108108- else {109109- /* Clear the data that was written to the other end of110110- our non-blocking socket: */111111- do {112112- if (read(item_data->fd, &socket_data, 1) < 1) {113113- if ((errno == EAGAIN) ||114114- (errno == EWOULDBLOCK))115115- break;116116- else117117- goto error_unlock;118118- }119119- } while (item_data->events & EPOLLET);120120-121121- /* The item was one-shot, so re-enable it: */122122- event_data.events = item_data->events;123123- if (epoll_ctl(thread_data->epoll_set,124124- EPOLL_CTL_MOD,125125- item_data->fd,126126- &event_data) < 0)127127- goto error_unlock;128128- }129129-130130- pthread_mutex_unlock(&item_data->mutex);131131- }132132-133133-error_unlock:134134- thread_data->status = item_data->status = errno;135135- pthread_mutex_unlock(&item_data->mutex);136136- return 0;137137-}138138-139139-/*140140- * A pointer to a write_thread_data structure will be passed as the argument to141141- * the write thread:142142- */143143-struct write_thread_data {144144- int stop;145145- int status; /* Indicates any error encountered by the write thread. */146146- int n_fds;147147- int *fds;148148-};149149-150150-/*151151- * The function executed by the write thread. It writes a single byte to each152152- * socket in turn until the stop condition for this thread is set. If writing to153153- * a socket would block (i.e. errno was EAGAIN), we leave that socket alone for154154- * the moment and just move on to the next socket in the list. We don't care155155- * about the order in which we deliver events to the epoll set. In fact we don't156156- * care about the data we're writing to the pipes at all; we just want to157157- * trigger epoll events:158158- */159159-void *write_thread_function(void *function_data)160160-{161161- const char data = 'X';162162- int index;163163- struct write_thread_data *thread_data =164164- (struct write_thread_data *)function_data;165165- while (!thread_data->stop)166166- for (index = 0;167167- !thread_data->stop && (index < thread_data->n_fds);168168- ++index)169169- if ((write(thread_data->fds[index], &data, 1) < 1) &&170170- (errno != EAGAIN) &&171171- (errno != EWOULDBLOCK)) {172172- thread_data->status = errno;173173- return;174174- }175175-}176176-177177-/*178178- * Arguments are currently ignored:179179- */180180-int main(int argc, char **argv)181181-{182182- const int n_read_threads = 100;183183- const int n_epoll_items = 500;184184- int index;185185- int epoll_set = epoll_create1(0);186186- struct write_thread_data write_thread_data = {187187- 0, 0, n_epoll_items, malloc(n_epoll_items * sizeof(int))188188- };189189- struct read_thread_data *read_thread_data =190190- malloc(n_read_threads * sizeof(struct read_thread_data));191191- pthread_t *read_threads = malloc(n_read_threads * sizeof(pthread_t));192192- pthread_t write_thread;193193-194194- printf("-----------------\n");195195- printf("Runing test_epoll\n");196196- printf("-----------------\n");197197-198198- epoll_items = malloc(n_epoll_items * sizeof(struct epoll_item_private));199199-200200- if (epoll_set < 0 || epoll_items == 0 || write_thread_data.fds == 0 ||201201- read_thread_data == 0 || read_threads == 0)202202- goto error;203203-204204- if (sysconf(_SC_NPROCESSORS_ONLN) < 2) {205205- printf("Error: please run this test on a multi-core system.\n");206206- goto error;207207- }208208-209209- /* Create the socket pairs and epoll items: */210210- for (index = 0; index < n_epoll_items; ++index) {211211- int socket_pair[2];212212- struct epoll_event event_data;213213- if (socketpair(AF_UNIX,214214- SOCK_STREAM | SOCK_NONBLOCK,215215- 0,216216- socket_pair) < 0)217217- goto error;218218- write_thread_data.fds[index] = socket_pair[0];219219- epoll_items[index].index = index;220220- epoll_items[index].fd = socket_pair[1];221221- if (pthread_mutex_init(&epoll_items[index].mutex, NULL) != 0)222222- goto error;223223- /* We always use EPOLLONESHOT because this test is currently224224- structured to demonstrate the need for EPOLL_CTL_DISABLE,225225- which only produces useful information in the EPOLLONESHOT226226- case (without EPOLLONESHOT, calling epoll_ctl with227227- EPOLL_CTL_DISABLE will never return EBUSY). If support for228228- testing events without EPOLLONESHOT is desired, it should229229- probably be implemented in a separate unit test. */230230- epoll_items[index].events = EPOLLIN | EPOLLONESHOT;231231- if (index < n_epoll_items / 2)232232- epoll_items[index].events |= EPOLLET;233233- epoll_items[index].stop = 0;234234- epoll_items[index].status = 0;235235- epoll_items[index].deleted = 0;236236- event_data.events = epoll_items[index].events;237237- event_data.data.ptr = &epoll_items[index];238238- if (epoll_ctl(epoll_set,239239- EPOLL_CTL_ADD,240240- epoll_items[index].fd,241241- &event_data) < 0)242242- goto error;243243- }244244-245245- /* Create and start the read threads: */246246- for (index = 0; index < n_read_threads; ++index) {247247- read_thread_data[index].stop = 0;248248- read_thread_data[index].status = 0;249249- read_thread_data[index].epoll_set = epoll_set;250250- if (pthread_create(&read_threads[index],251251- NULL,252252- read_thread_function,253253- &read_thread_data[index]) != 0)254254- goto error;255255- }256256-257257- if (pthread_create(&write_thread,258258- NULL,259259- write_thread_function,260260- &write_thread_data) != 0)261261- goto error;262262-263263- /* Cancel all event pollers: */264264-#ifdef EPOLL_CTL_DISABLE265265- for (index = 0; index < n_epoll_items; ++index) {266266- pthread_mutex_lock(&epoll_items[index].mutex);267267- ++epoll_items[index].stop;268268- if (epoll_ctl(epoll_set,269269- EPOLL_CTL_DISABLE,270270- epoll_items[index].fd,271271- NULL) == 0)272272- delete_item(index);273273- else if (errno != EBUSY) {274274- pthread_mutex_unlock(&epoll_items[index].mutex);275275- goto error;276276- }277277- /* EBUSY means events were being handled; allow the other thread278278- to delete the item. */279279- pthread_mutex_unlock(&epoll_items[index].mutex);280280- }281281-#else282282- for (index = 0; index < n_epoll_items; ++index) {283283- pthread_mutex_lock(&epoll_items[index].mutex);284284- ++epoll_items[index].stop;285285- pthread_mutex_unlock(&epoll_items[index].mutex);286286- /* Wait in case a thread running read_thread_function is287287- currently executing code between epoll_wait and288288- pthread_mutex_lock with this item. Note that a longer delay289289- would make double-deletion less likely (at the expense of290290- performance), but there is no guarantee that any delay would291291- ever be sufficient. Note also that we delete all event292292- pollers at once for testing purposes, but in a real-world293293- environment we are likely to want to be able to cancel event294294- pollers at arbitrary times. Therefore we can't improve this295295- situation by just splitting this loop into two loops296296- (i.e. signal 'stop' for all items, sleep, and then delete all297297- items). We also can't fix the problem via EPOLL_CTL_DEL298298- because that command can't prevent the case where some other299299- thread is executing read_thread_function within the region300300- mentioned above: */301301- usleep(1);302302- pthread_mutex_lock(&epoll_items[index].mutex);303303- if (!epoll_items[index].deleted)304304- delete_item(index);305305- pthread_mutex_unlock(&epoll_items[index].mutex);306306- }307307-#endif308308-309309- /* Shut down the read threads: */310310- for (index = 0; index < n_read_threads; ++index)311311- __sync_fetch_and_add(&read_thread_data[index].stop, 1);312312- for (index = 0; index < n_read_threads; ++index) {313313- if (pthread_join(read_threads[index], NULL) != 0)314314- goto error;315315- if (read_thread_data[index].status)316316- goto error;317317- }318318-319319- /* Shut down the write thread: */320320- __sync_fetch_and_add(&write_thread_data.stop, 1);321321- if ((pthread_join(write_thread, NULL) != 0) || write_thread_data.status)322322- goto error;323323-324324- /* Check for final error conditions: */325325- for (index = 0; index < n_epoll_items; ++index) {326326- if (epoll_items[index].status != 0)327327- goto error;328328- if (pthread_mutex_destroy(&epoll_items[index].mutex) < 0)329329- goto error;330330- }331331- for (index = 0; index < n_epoll_items; ++index)332332- if (epoll_items[index].deleted != 1) {333333- printf("Error: item data deleted %1d times.\n",334334- epoll_items[index].deleted);335335- goto error;336336- }337337-338338- printf("[PASS]\n");339339- return 0;340340-341341- error:342342- printf("[FAIL]\n");343343- return errno;344344-}