···11-What: /sys/bus/usb/drivers/usbtmc/devices/*/interface_capabilities22-What: /sys/bus/usb/drivers/usbtmc/devices/*/device_capabilities11+What: /sys/bus/usb/drivers/usbtmc/*/interface_capabilities22+What: /sys/bus/usb/drivers/usbtmc/*/device_capabilities33Date: August 200844Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org>55Description:···1212 The files are read only.131314141515-What: /sys/bus/usb/drivers/usbtmc/devices/*/usb488_interface_capabilities1616-What: /sys/bus/usb/drivers/usbtmc/devices/*/usb488_device_capabilities1515+What: /sys/bus/usb/drivers/usbtmc/*/usb488_interface_capabilities1616+What: /sys/bus/usb/drivers/usbtmc/*/usb488_device_capabilities1717Date: August 20081818Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1919Description:···2727 The files are read only.282829293030-What: /sys/bus/usb/drivers/usbtmc/devices/*/TermChar3030+What: /sys/bus/usb/drivers/usbtmc/*/TermChar3131Date: August 20083232Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org>3333Description:···4040 sent to the device or not.414142424343-What: /sys/bus/usb/drivers/usbtmc/devices/*/TermCharEnabled4343+What: /sys/bus/usb/drivers/usbtmc/*/TermCharEnabled4444Date: August 20084545Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org>4646Description:···5151 published by the USB-IF.525253535454-What: /sys/bus/usb/drivers/usbtmc/devices/*/auto_abort5454+What: /sys/bus/usb/drivers/usbtmc/*/auto_abort5555Date: August 20085656Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org>5757Description:
+18
Documentation/ABI/testing/sysfs-block-rssd
···11+What: /sys/block/rssd*/registers22+Date: March 201233+KernelVersion: 3.344+Contact: Asai Thambi S P <asamymuthupa@micron.com>55+Description: This is a read-only file. Dumps below driver information and66+ hardware registers.77+ - S ACTive88+ - Command Issue99+ - Allocated1010+ - Completed1111+ - PORT IRQ STAT1212+ - HOST IRQ STAT1313+1414+What: /sys/block/rssd*/status1515+Date: April 20121616+KernelVersion: 3.41717+Contact: Asai Thambi S P <asamymuthupa@micron.com>1818+Description: This is a read-only file. Indicates the status of the device.
···11+What: /sys/block/<device>/iosched/target_latency22+Date: March 201233+contact: Tao Ma <boyu.mt@taobao.com>44+Description:55+ The /sys/block/<device>/iosched/target_latency only exists66+ when the user sets cfq to /sys/block/<device>/scheduler.77+ It contains an estimated latency time for the cfq. cfq will88+ use it to calculate the time slice used for every task.
+2-3
Documentation/cgroups/memory.txt
···34343535Features:3636 - accounting anonymous pages, file caches, swap caches usage and limiting them.3737- - private LRU and reclaim routine. (system's global LRU and private LRU3838- work independently from each other)3737+ - pages are linked to per-memcg LRU exclusively, and there is no global LRU.3938 - optionally, memory+swap usage can be accounted and limited.4039 - hierarchical accounting4140 - soft limit···1531542.2.1 Accounting details154155155156All mapped anon pages (RSS) and cache pages (Page Cache) are accounted.156156-Some pages which are never reclaimable and will not be on the global LRU157157+Some pages which are never reclaimable and will not be on the LRU157158are not accounted. We just account pages under usual VM management.158159159160RSS pages are accounted at page_fault unless they've already been accounted
+9
Documentation/feature-removal-schedule.txt
···534534535535----------------------------536536537537+What: setitimer accepts user NULL pointer (value)538538+When: 3.6539539+Why: setitimer is not returning -EFAULT if user pointer is NULL. This540540+ violates the spec.541541+Who: Sasikantha Babu <sasikanth.v19@gmail.com>542542+543543+----------------------------544544+537545What: KVM debugfs statistics538546When: 2013539547Why: KVM tracepoints provide mostly equivalent information in a much more540548 flexible fashion.549549+
···168168they will get a -EPERM error. Thus you can be sure that when169169usb_kill_urb() returns, the URB is totally idle.170170171171+There is a lifetime issue to consider. An URB may complete at any172172+time, and the completion handler may free the URB. If this happens173173+while usb_unlink_urb or usb_kill_urb is running, it will cause a174174+memory-access violation. The driver is responsible for avoiding this,175175+which often means some sort of lock will be needed to prevent the URB176176+from being deallocated while it is still in use.177177+178178+On the other hand, since usb_unlink_urb may end up calling the179179+completion handler, the handler must not take any lock that is held180180+when usb_unlink_urb is invoked. The general solution to this problem181181+is to increment the URB's reference count while holding the lock, then182182+drop the lock and call usb_unlink_urb or usb_kill_urb, and then183183+decrement the URB's reference count. You increment the reference184184+count by calling185185+186186+ struct urb *usb_get_urb(struct urb *urb)187187+188188+(ignore the return value; it is the same as the argument) and189189+decrement the reference count by calling usb_free_urb. Of course,190190+none of this is necessary if there's no danger of the URB being freed191191+by the completion handler.192192+1711931721941.7. What about the completion handler?173195
+3-3
Documentation/usb/usbmon.txt
···183183d5ea89a0 3575914555 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <184184d5ea89a0 3575914560 C Ci:1:001:0 0 4 = 01050000185185186186-An output bulk transfer to send a SCSI command 0x5E in a 31-byte Bulk wrapper187187-to a storage device at address 5:186186+An output bulk transfer to send a SCSI command 0x28 (READ_10) in a 31-byte187187+Bulk wrapper to a storage device at address 5:188188189189-dd65f0e8 4128379752 S Bo:1:005:2 -115 31 = 55534243 5e000000 00000000 00000600 00000000 00000000 00000000 000000189189+dd65f0e8 4128379752 S Bo:1:005:2 -115 31 = 55534243 ad000000 00800000 80010a28 20000000 20000040 00000000 000000190190dd65f0e8 4128379808 C Bo:1:005:2 0 31 >191191192192* Raw binary format and API
+15-10
MAINTAINERS
···15211521M: Johan Hedberg <johan.hedberg@gmail.com>15221522L: linux-bluetooth@vger.kernel.org15231523W: http://www.bluez.org/15241524-T: git git://git.kernel.org/pub/scm/linux/kernel/git/padovan/bluetooth.git15251525-T: git git://git.kernel.org/pub/scm/linux/kernel/git/jh/bluetooth.git15241524+T: git git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git15251525+T: git git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git15261526S: Maintained15271527F: drivers/bluetooth/15281528···15321532M: Johan Hedberg <johan.hedberg@gmail.com>15331533L: linux-bluetooth@vger.kernel.org15341534W: http://www.bluez.org/15351535-T: git git://git.kernel.org/pub/scm/linux/kernel/git/padovan/bluetooth.git15361536-T: git git://git.kernel.org/pub/scm/linux/kernel/git/jh/bluetooth.git15351535+T: git git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git15361536+T: git git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git15371537S: Maintained15381538F: net/bluetooth/15391539F: include/net/bluetooth/···23212321F: drivers/acpi/dock.c2322232223232323DOCUMENTATION23242324-M: Randy Dunlap <rdunlap@xenotime.net>23242324+M: Rob Landley <rob@landley.net>23252325L: linux-doc@vger.kernel.org23262326-T: quilt http://xenotime.net/kernel-doc-patches/current/23262326+T: TBD23272327S: Maintained23282328F: Documentation/23292329···45334533F: drivers/net/ethernet/myricom/myri10ge/4534453445354535NATSEMI ETHERNET DRIVER (DP8381x)45364536-M: Tim Hockin <thockin@hockin.org>45374537-S: Maintained45364536+S: Orphan45384537F: drivers/net/ethernet/natsemi/natsemi.c4539453845404539NATIVE INSTRUMENTS USB SOUND INTERFACE DRIVER···48024803F: arch/arm/mach-omap2/clockdomain44xx.c4803480448044805OMAP AUDIO SUPPORT48064806+M: Peter Ujfalusi <peter.ujfalusi@ti.com>48054807M: Jarkko Nikula <jarkko.nikula@bitmer.com>48064808L: alsa-devel@alsa-project.org (subscribers-only)48074809L: linux-omap@vger.kernel.org···51165116F: drivers/i2c/busses/i2c-pca-*51175117F: include/linux/i2c-algo-pca.h51185118F: include/linux/i2c-pca-platform.h51195119+51205120+PCDP - PRIMARY CONSOLE AND DEBUG PORT51215121+M: Khalid Aziz <khalid.aziz@hp.com>51225122+S: Maintained51235123+F: drivers/firmware/pcdp.*5119512451205125PCI ERROR RECOVERY51215126M: Linas Vepstas <linasvepstas@gmail.com>···64716466F: drivers/staging/olpc_dcon/6472646764736468STAGING - OZMO DEVICES USB OVER WIFI DRIVER64696469+M: Rupesh Gujare <rgujare@ozmodevices.com>64746470M: Chris Kelly <ckelly@ozmodevices.com>64756471S: Maintained64766472F: drivers/staging/ozwpan/···7467746174687462WOLFSON MICROELECTRONICS DRIVERS74697463M: Mark Brown <broonie@opensource.wolfsonmicro.com>74707470-M: Ian Lartey <ian@opensource.wolfsonmicro.com>74717471-M: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>74647464+L: patches@opensource.wolfsonmicro.com74727465T: git git://opensource.wolfsonmicro.com/linux-2.6-asoc74737466T: git git://opensource.wolfsonmicro.com/linux-2.6-audioplus74747467W: http://opensource.wolfsonmicro.com/content/linux-drivers-wolfson-devices
···11-#ifndef _ALPHA_ATOMIC_H11+#ifndef _ALPHA_CMPXCHG_H22#error Do not include xchg.h directly!33#else44/*55 * xchg/xchg_local and cmpxchg/cmpxchg_local share the same code66 * except that local version do not have the expensive memory barrier.77- * So this file is included twice from asm/system.h.77+ * So this file is included twice from asm/cmpxchg.h.88 */991010/*
+2
arch/arm/boot/compressed/atags_to_fdt.c
···7777 } else if (atag->hdr.tag == ATAG_MEM) {7878 if (memcount >= sizeof(mem_reg_property)/4)7979 continue;8080+ if (!atag->u.mem.size)8181+ continue;8082 mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.start);8183 mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.size);8284 } else if (atag->hdr.tag == ATAG_INITRD2) {
···427427428428/*429429 * Handle each interrupt in a single VIC. Returns non-zero if we've430430- * handled at least one interrupt. This does a single read of the431431- * status register and handles all interrupts in order from LSB first.430430+ * handled at least one interrupt. This reads the status register431431+ * before handling each interrupt, which is necessary given that432432+ * handle_IRQ may briefly re-enable interrupts for soft IRQ handling.432433 */433434static int handle_one_vic(struct vic_device *vic, struct pt_regs *regs)434435{435436 u32 stat, irq;436437 int handled = 0;437438438438- stat = readl_relaxed(vic->base + VIC_IRQ_STATUS);439439- while (stat) {439439+ while ((stat = readl_relaxed(vic->base + VIC_IRQ_STATUS))) {440440 irq = ffs(stat) - 1;441441 handle_IRQ(irq_find_mapping(vic->domain, irq), regs);442442- stat &= ~(1 << irq);443442 handled = 1;444443 }445444
···523523 */524524 size -= start & ~PAGE_MASK;525525 bank->start = PAGE_ALIGN(start);526526- bank->size = size & PAGE_MASK;526526+527527+#ifndef CONFIG_LPAE528528+ if (bank->start + size < bank->start) {529529+ printk(KERN_CRIT "Truncating memory at 0x%08llx to fit in "530530+ "32-bit physical address space\n", (long long)start);531531+ /*532532+ * To ensure bank->start + bank->size is representable in533533+ * 32 bits, we use ULONG_MAX as the upper limit rather than 4GB.534534+ * This means we lose a page after masking.535535+ */536536+ size = ULONG_MAX - bank->start;537537+ }538538+#endif539539+540540+ bank->size = size & PAGE_MASK;527541528542 /*529543 * Check whether this memory region has non-zero size or
+5-1
arch/arm/kernel/smp_twd.c
···118118 * The twd clock events must be reprogrammed to account for the new119119 * frequency. The timer is local to a cpu, so cross-call to the120120 * changing cpu.121121+ *122122+ * Only wait for it to finish, if the cpu is active to avoid123123+ * deadlock when cpu1 is spinning on while(!cpu_active(cpu1)) during124124+ * booting of that cpu.121125 */122126 if (state == CPUFREQ_POSTCHANGE || state == CPUFREQ_RESUMECHANGE)123127 smp_call_function_single(freqs->cpu, twd_update_frequency,124124- NULL, 1);128128+ NULL, cpu_active(freqs->cpu));125129126130 return NOTIFY_OK;127131}
+2
arch/arm/mach-exynos/Kconfig
···368368369369config MACH_EXYNOS4_DT370370 bool "Samsung Exynos4 Machine using device tree"371371+ depends on ARCH_EXYNOS4371372 select CPU_EXYNOS4210372373 select USE_OF373374 select ARM_AMBA···381380382381config MACH_EXYNOS5_DT383382 bool "SAMSUNG EXYNOS5 Machine using device tree"383383+ depends on ARCH_EXYNOS5384384 select SOC_EXYNOS5250385385 select USE_OF386386 select ARM_AMBA
···121121 * and unknown state. This function should be called early to122122 * wait on the ARM9.123123 */124124-void __init proc_comm_boot_wait(void)124124+void __devinit proc_comm_boot_wait(void)125125{126126 void __iomem *base = MSM_SHARED_RAM_BASE;127127
-80
arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
···165165166166 return 0;167167}168168-169169-#ifdef CONFIG_CPU_FREQ170170-/*171171- * Walk PRCM rate table and fillout cpufreq freq_table172172- * XXX This should be replaced by an OPP layer in the near future173173- */174174-static struct cpufreq_frequency_table *freq_table;175175-176176-void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table)177177-{178178- const struct prcm_config *prcm;179179- int i = 0;180180- int tbl_sz = 0;181181-182182- if (!cpu_is_omap24xx())183183- return;184184-185185- for (prcm = rate_table; prcm->mpu_speed; prcm++) {186186- if (!(prcm->flags & cpu_mask))187187- continue;188188- if (prcm->xtal_speed != sclk->rate)189189- continue;190190-191191- /* don't put bypass rates in table */192192- if (prcm->dpll_speed == prcm->xtal_speed)193193- continue;194194-195195- tbl_sz++;196196- }197197-198198- /*199199- * XXX Ensure that we're doing what CPUFreq expects for this error200200- * case and the following one201201- */202202- if (tbl_sz == 0) {203203- pr_warning("%s: no matching entries in rate_table\n",204204- __func__);205205- return;206206- }207207-208208- /* Include the CPUFREQ_TABLE_END terminator entry */209209- tbl_sz++;210210-211211- freq_table = kzalloc(sizeof(struct cpufreq_frequency_table) * tbl_sz,212212- GFP_ATOMIC);213213- if (!freq_table) {214214- pr_err("%s: could not kzalloc frequency table\n", __func__);215215- return;216216- }217217-218218- for (prcm = rate_table; prcm->mpu_speed; prcm++) {219219- if (!(prcm->flags & cpu_mask))220220- continue;221221- if (prcm->xtal_speed != sclk->rate)222222- continue;223223-224224- /* don't put bypass rates in table */225225- if (prcm->dpll_speed == prcm->xtal_speed)226226- continue;227227-228228- freq_table[i].index = i;229229- freq_table[i].frequency = prcm->mpu_speed / 1000;230230- i++;231231- }232232-233233- freq_table[i].index = i;234234- freq_table[i].frequency = CPUFREQ_TABLE_END;235235-236236- *table = &freq_table[0];237237-}238238-239239-void omap2_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table)240240-{241241- if (!cpu_is_omap24xx())242242- return;243243-244244- kfree(freq_table);245245-}246246-247247-#endif
-5
arch/arm/mach-omap2/clock.c
···536536 .clk_set_rate = omap2_clk_set_rate,537537 .clk_set_parent = omap2_clk_set_parent,538538 .clk_disable_unused = omap2_clk_disable_unused,539539-#ifdef CONFIG_CPU_FREQ540540- /* These will be removed when the OPP code is integrated */541541- .clk_init_cpufreq_table = omap2_clk_init_cpufreq_table,542542- .clk_exit_cpufreq_table = omap2_clk_exit_cpufreq_table,543543-#endif544539};545540
···723723 bool "Select the High exception vector"724724 help725725 Say Y here to select high exception vector(0xFFFF0000~).726726- The exception vector can be vary depending on the platform726726+ The exception vector can vary depending on the platform727727 design in nommu mode. If your platform needs to select728728 high exception vector, say Y.729729 Otherwise or if you are unsure, say N, and the low exception
+1-1
arch/arm/mm/fault.c
···320320 */321321322322 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr);323323- if (flags & FAULT_FLAG_ALLOW_RETRY) {323323+ if (!(fault & VM_FAULT_ERROR) && flags & FAULT_FLAG_ALLOW_RETRY) {324324 if (fault & VM_FAULT_MAJOR) {325325 tsk->maj_flt++;326326 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
···302302config SAMSUNG_PM_DEBUG303303 bool "S3C2410 PM Suspend debug"304304 depends on PM305305+ select DEBUG_LL305306 help306307 Say Y here if you want verbose debugging from the PM Suspend and307308 Resume code. See <file:Documentation/arm/Samsung-S3C24XX/Suspend.txt>
-4
arch/c6x/include/asm/irq.h
···4242/* This number is used when no interrupt has been assigned */4343#define NO_IRQ 044444545-struct irq_data;4646-extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d);4747-extern irq_hw_number_t virq_to_hw(unsigned int virq);4848-4945extern void __init init_pic_c64xplus(void);50465147extern void init_IRQ(void);
···1818#else1919# include <asm/gcc_intrin.h>2020#endif2121+#include <asm/cmpxchg.h>21222223#define ia64_native_get_psr_i() (ia64_native_getreg(_IA64_REG_PSR) & IA64_PSR_I)2324···8180})82818382#define ia64_fetch_and_add(i,v) (ia64_fetchadd(i, v, rel) + (i)) /* return new value */8484-8585-/*8686- * This function doesn't exist, so you'll get a linker error if8787- * something tries to do an invalid xchg().8888- */8989-extern void ia64_xchg_called_with_bad_pointer (void);9090-9191-#define __xchg(x,ptr,size) \9292-({ \9393- unsigned long __xchg_result; \9494- \9595- switch (size) { \9696- case 1: \9797- __xchg_result = ia64_xchg1((__u8 *)ptr, x); \9898- break; \9999- \100100- case 2: \101101- __xchg_result = ia64_xchg2((__u16 *)ptr, x); \102102- break; \103103- \104104- case 4: \105105- __xchg_result = ia64_xchg4((__u32 *)ptr, x); \106106- break; \107107- \108108- case 8: \109109- __xchg_result = ia64_xchg8((__u64 *)ptr, x); \110110- break; \111111- default: \112112- ia64_xchg_called_with_bad_pointer(); \113113- } \114114- __xchg_result; \115115-})116116-117117-#define xchg(ptr,x) \118118- ((__typeof__(*(ptr))) __xchg ((unsigned long) (x), (ptr), sizeof(*(ptr))))119119-120120-/*121121- * Atomic compare and exchange. Compare OLD with MEM, if identical,122122- * store NEW in MEM. Return the initial value in MEM. Success is123123- * indicated by comparing RETURN with OLD.124124- */125125-126126-#define __HAVE_ARCH_CMPXCHG 1127127-128128-/*129129- * This function doesn't exist, so you'll get a linker error130130- * if something tries to do an invalid cmpxchg().131131- */132132-extern long ia64_cmpxchg_called_with_bad_pointer (void);133133-134134-#define ia64_cmpxchg(sem,ptr,old,new,size) \135135-({ \136136- __u64 _o_, _r_; \137137- \138138- switch (size) { \139139- case 1: _o_ = (__u8 ) (long) (old); break; \140140- case 2: _o_ = (__u16) (long) (old); break; \141141- case 4: _o_ = (__u32) (long) (old); break; \142142- case 8: _o_ = (__u64) (long) (old); break; \143143- default: break; \144144- } \145145- switch (size) { \146146- case 1: \147147- _r_ = ia64_cmpxchg1_##sem((__u8 *) ptr, new, _o_); \148148- break; \149149- \150150- case 2: \151151- _r_ = ia64_cmpxchg2_##sem((__u16 *) ptr, new, _o_); \152152- break; \153153- \154154- case 4: \155155- _r_ = ia64_cmpxchg4_##sem((__u32 *) ptr, new, _o_); \156156- break; \157157- \158158- case 8: \159159- _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_); \160160- break; \161161- \162162- default: \163163- _r_ = ia64_cmpxchg_called_with_bad_pointer(); \164164- break; \165165- } \166166- (__typeof__(old)) _r_; \167167-})168168-169169-#define cmpxchg_acq(ptr, o, n) \170170- ia64_cmpxchg(acq, (ptr), (o), (n), sizeof(*(ptr)))171171-#define cmpxchg_rel(ptr, o, n) \172172- ia64_cmpxchg(rel, (ptr), (o), (n), sizeof(*(ptr)))173173-174174-/* for compatibility with other platforms: */175175-#define cmpxchg(ptr, o, n) cmpxchg_acq((ptr), (o), (n))176176-#define cmpxchg64(ptr, o, n) cmpxchg_acq((ptr), (o), (n))177177-178178-#define cmpxchg_local cmpxchg179179-#define cmpxchg64_local cmpxchg64180180-181181-#ifdef CONFIG_IA64_DEBUG_CMPXCHG182182-# define CMPXCHG_BUGCHECK_DECL int _cmpxchg_bugcheck_count = 128;183183-# define CMPXCHG_BUGCHECK(v) \184184- do { \185185- if (_cmpxchg_bugcheck_count-- <= 0) { \186186- void *ip; \187187- extern int printk(const char *fmt, ...); \188188- ip = (void *) ia64_getreg(_IA64_REG_IP); \189189- printk("CMPXCHG_BUGCHECK: stuck at %p on word %p\n", ip, (v)); \190190- break; \191191- } \192192- } while (0)193193-#else /* !CONFIG_IA64_DEBUG_CMPXCHG */194194-# define CMPXCHG_BUGCHECK_DECL195195-# define CMPXCHG_BUGCHECK(v)196196-#endif /* !CONFIG_IA64_DEBUG_CMPXCHG */1978319884#endif19985
-2
arch/powerpc/include/asm/irq.h
···3333/* Same thing, used by the generic IRQ code */3434#define NR_IRQS_LEGACY NUM_ISA_INTERRUPTS35353636-struct irq_data;3737-extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d);3836extern irq_hw_number_t virq_to_hw(unsigned int virq);39374038/**
+21-18
arch/powerpc/kernel/entry_32.S
···206206 andi. r10,r10,MSR_EE /* Did EE change? */207207 beq 1f208208209209- /* Save handler and return address into the 2 unused words210210- * of the STACK_FRAME_OVERHEAD (sneak sneak sneak). Everything211211- * else can be recovered from the pt_regs except r3 which for212212- * normal interrupts has been set to pt_regs and for syscalls213213- * is an argument, so we temporarily use ORIG_GPR3 to save it214214- */215215- stw r9,8(r1)216216- stw r11,12(r1)217217- stw r3,ORIG_GPR3(r1)218209 /*219210 * The trace_hardirqs_off will use CALLER_ADDR0 and CALLER_ADDR1.220211 * If from user mode there is only one stack frame on the stack, and221212 * accessing CALLER_ADDR1 will cause oops. So we need create a dummy222213 * stack frame to make trace_hardirqs_off happy.214214+ *215215+ * This is handy because we also need to save a bunch of GPRs,216216+ * r3 can be different from GPR3(r1) at this point, r9 and r11217217+ * contains the old MSR and handler address respectively,218218+ * r4 & r5 can contain page fault arguments that need to be passed219219+ * along as well. r12, CCR, CTR, XER etc... are left clobbered as220220+ * they aren't useful past this point (aren't syscall arguments),221221+ * the rest is restored from the exception frame.223222 */223223+ stwu r1,-32(r1)224224+ stw r9,8(r1)225225+ stw r11,12(r1)226226+ stw r3,16(r1)227227+ stw r4,20(r1)228228+ stw r5,24(r1)224229 andi. r12,r12,MSR_PR225225- beq 11f226226- stwu r1,-16(r1)230230+ b 11f227231 bl trace_hardirqs_off228228- addi r1,r1,16229232 b 12f230230-23123311:232234 bl trace_hardirqs_off23323512:236236+ lwz r5,24(r1)237237+ lwz r4,20(r1)238238+ lwz r3,16(r1)239239+ lwz r11,12(r1)240240+ lwz r9,8(r1)241241+ addi r1,r1,32234242 lwz r0,GPR0(r1)235235- lwz r3,ORIG_GPR3(r1)236236- lwz r4,GPR4(r1)237237- lwz r5,GPR5(r1)238243 lwz r6,GPR6(r1)239244 lwz r7,GPR7(r1)240245 lwz r8,GPR8(r1)241241- lwz r9,8(r1)242242- lwz r11,12(r1)2432461: mtctr r11244247 mtlr r9245248 bctr /* jump to handler */
···9090 select HAVE_KERNEL_XZ9191 select HAVE_ARCH_MUTEX_CPU_RELAX9292 select HAVE_ARCH_JUMP_LABEL if !MARCH_G59393- select HAVE_RCU_TABLE_FREE if SMP9493 select ARCH_SAVE_PAGE_KEYS if HIBERNATION9594 select HAVE_MEMBLOCK9695 select HAVE_MEMBLOCK_NODE_MAP
+18-19
arch/s390/defconfig
···11CONFIG_EXPERIMENTAL=y22CONFIG_SYSVIPC=y33CONFIG_POSIX_MQUEUE=y44+CONFIG_FHANDLE=y55+CONFIG_TASKSTATS=y66+CONFIG_TASK_DELAY_ACCT=y77+CONFIG_TASK_XACCT=y88+CONFIG_TASK_IO_ACCOUNTING=y49CONFIG_AUDIT=y55-CONFIG_RCU_TRACE=y610CONFIG_IKCONFIG=y711CONFIG_IKCONFIG_PROC=y812CONFIG_CGROUPS=y···1814CONFIG_CGROUP_SCHED=y1915CONFIG_RT_GROUP_SCHED=y2016CONFIG_BLK_CGROUP=y1717+CONFIG_NAMESPACES=y2118CONFIG_BLK_DEV_INITRD=y2222-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set1919+CONFIG_RD_BZIP2=y2020+CONFIG_RD_LZMA=y2121+CONFIG_RD_XZ=y2222+CONFIG_RD_LZO=y2323+CONFIG_EXPERT=y2324# CONFIG_COMPAT_BRK is not set2424-CONFIG_SLAB=y2525CONFIG_PROFILING=y2626CONFIG_OPROFILE=y2727CONFIG_KPROBES=y2828CONFIG_MODULES=y2929CONFIG_MODULE_UNLOAD=y3030CONFIG_MODVERSIONS=y3131+CONFIG_PARTITION_ADVANCED=y3232+CONFIG_IBM_PARTITION=y3133CONFIG_DEFAULT_DEADLINE=y3234CONFIG_NO_HZ=y3335CONFIG_HIGH_RES_TIMERS=y···4434CONFIG_BINFMT_MISC=m4535CONFIG_CMM=m4636CONFIG_HZ_100=y4747-CONFIG_KEXEC=y4848-CONFIG_PM=y3737+CONFIG_CRASH_DUMP=y4938CONFIG_HIBERNATION=y5039CONFIG_PACKET=y5140CONFIG_UNIX=y5241CONFIG_NET_KEY=y5353-CONFIG_AFIUCV=m5442CONFIG_INET=y5543CONFIG_IP_MULTICAST=y5644# CONFIG_INET_LRO is not set5745CONFIG_IPV6=y5858-CONFIG_NET_SCTPPROBE=m5946CONFIG_L2TP=m6047CONFIG_L2TP_DEBUGFS=m6148CONFIG_VLAN_8021Q=y···9184CONFIG_SCSI_LOGGING=y9285CONFIG_SCSI_SCAN_ASYNC=y9386CONFIG_ZFCP=y9494-CONFIG_ZFCP_DIF=y9587CONFIG_NETDEVICES=y9696-CONFIG_DUMMY=m9788CONFIG_BONDING=m8989+CONFIG_DUMMY=m9890CONFIG_EQUALIZER=m9991CONFIG_TUN=m100100-CONFIG_NET_ETHERNET=y10192CONFIG_VIRTIO_NET=y10293CONFIG_RAW_DRIVER=m9494+CONFIG_VIRTIO_BALLOON=y10395CONFIG_EXT2_FS=y10496CONFIG_EXT3_FS=y10597# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set···109103CONFIG_TMPFS=y110104CONFIG_TMPFS_POSIX_ACL=y111105# CONFIG_NETWORK_FILESYSTEMS is not set112112-CONFIG_PARTITION_ADVANCED=y113113-CONFIG_IBM_PARTITION=y114114-CONFIG_DLM=m115106CONFIG_MAGIC_SYSRQ=y116116-CONFIG_DEBUG_KERNEL=y117107CONFIG_TIMER_STATS=y118108CONFIG_PROVE_LOCKING=y119109CONFIG_PROVE_RCU=y120110CONFIG_LOCK_STAT=y121111CONFIG_DEBUG_LOCKDEP=y122122-CONFIG_DEBUG_SPINLOCK_SLEEP=y123112CONFIG_DEBUG_LIST=y124113CONFIG_DEBUG_NOTIFIERS=y125125-# CONFIG_RCU_CPU_STALL_DETECTOR is not set114114+CONFIG_RCU_TRACE=y126115CONFIG_KPROBES_SANITY_TEST=y127116CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y128117CONFIG_CPU_NOTIFIER_ERROR_INJECT=m129118CONFIG_LATENCYTOP=y130130-CONFIG_SYSCTL_SYSCALL_CHECK=y131119CONFIG_DEBUG_PAGEALLOC=y132132-# CONFIG_FTRACE is not set120120+CONFIG_BLK_DEV_IO_TRACE=y133121# CONFIG_STRICT_DEVMEM is not set134122CONFIG_CRYPTO_NULL=m135123CONFIG_CRYPTO_CRYPTD=m···173173CONFIG_CRYPTO_DES_S390=m174174CONFIG_CRYPTO_AES_S390=m175175CONFIG_CRC7=m176176-CONFIG_VIRTIO_BALLOON=y
···118118 "a" (__do_softirq)119119 : "0", "1", "2", "3", "4", "5", "14",120120 "cc", "memory" );121121- } else121121+ } else {122122 /* We are already on the async stack. */123123 __do_softirq();124124+ }124125 }125126126127 local_irq_restore(flags);···193192 int index = ext_hash(code);194193195194 spin_lock_irqsave(&ext_int_hash_lock, flags);196196- list_for_each_entry_rcu(p, &ext_int_hash[index], entry)195195+ list_for_each_entry_rcu(p, &ext_int_hash[index], entry) {197196 if (p->code == code && p->handler == handler) {198197 list_del_rcu(&p->entry);199198 kfree_rcu(p, rcu);200199 }200200+ }201201 spin_unlock_irqrestore(&ext_int_hash_lock, flags);202202 return 0;203203}···213211214212 old_regs = set_irq_regs(regs);215213 irq_enter();216216- if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator)214214+ if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) {217215 /* Serve timer interrupts first. */218216 clock_comparator_work();217217+ }219218 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++;220219 if (ext_code.code != 0x1004)221220 __get_cpu_var(s390_idle).nohz_delay = 1;
+2-2
arch/s390/kernel/perf_cpum_cf.c
···178178 err = lcctl(cpuhw->state);179179 if (err) {180180 pr_err("Enabling the performance measuring unit "181181- "failed with rc=%lx\n", err);181181+ "failed with rc=%x\n", err);182182 return;183183 }184184···203203 err = lcctl(inactive);204204 if (err) {205205 pr_err("Disabling the performance measuring unit "206206- "failed with rc=%lx\n", err);206206+ "failed with rc=%x\n", err);207207 return;208208 }209209
+18-9
arch/s390/mm/maccess.c
···6161 return copied < 0 ? -EFAULT : 0;6262}63636464-/*6565- * Copy memory in real mode (kernel to kernel)6666- */6767-int memcpy_real(void *dest, void *src, size_t count)6464+static int __memcpy_real(void *dest, void *src, size_t count)6865{6966 register unsigned long _dest asm("2") = (unsigned long) dest;7067 register unsigned long _len1 asm("3") = (unsigned long) count;7168 register unsigned long _src asm("4") = (unsigned long) src;7269 register unsigned long _len2 asm("5") = (unsigned long) count;7373- unsigned long flags;7470 int rc = -EFAULT;75717676- if (!count)7777- return 0;7878- flags = __arch_local_irq_stnsm(0xf8UL);7972 asm volatile (8073 "0: mvcle %1,%2,0x0\n"8174 "1: jo 0b\n"···7986 "+d" (_len2), "=m" (*((long *) dest))8087 : "m" (*((long *) src))8188 : "cc", "memory");8282- arch_local_irq_restore(flags);8989+ return rc;9090+}9191+9292+/*9393+ * Copy memory in real mode (kernel to kernel)9494+ */9595+int memcpy_real(void *dest, void *src, size_t count)9696+{9797+ unsigned long flags;9898+ int rc;9999+100100+ if (!count)101101+ return 0;102102+ local_irq_save(flags);103103+ __arch_local_irq_stnsm(0xfbUL);104104+ rc = __memcpy_real(dest, src, count);105105+ local_irq_restore(flags);83106 return rc;84107}85108
+60-3
arch/s390/mm/pgtable.c
···678678 }679679}680680681681-#ifdef CONFIG_HAVE_RCU_TABLE_FREE682682-683681static void __page_table_free_rcu(void *table, unsigned bit)684682{685683 struct page *page;···731733 free_pages((unsigned long) table, ALLOC_ORDER);732734}733735734734-#endif736736+static void tlb_remove_table_smp_sync(void *arg)737737+{738738+ /* Simply deliver the interrupt */739739+}740740+741741+static void tlb_remove_table_one(void *table)742742+{743743+ /*744744+ * This isn't an RCU grace period and hence the page-tables cannot be745745+ * assumed to be actually RCU-freed.746746+ *747747+ * It is however sufficient for software page-table walkers that rely748748+ * on IRQ disabling. See the comment near struct mmu_table_batch.749749+ */750750+ smp_call_function(tlb_remove_table_smp_sync, NULL, 1);751751+ __tlb_remove_table(table);752752+}753753+754754+static void tlb_remove_table_rcu(struct rcu_head *head)755755+{756756+ struct mmu_table_batch *batch;757757+ int i;758758+759759+ batch = container_of(head, struct mmu_table_batch, rcu);760760+761761+ for (i = 0; i < batch->nr; i++)762762+ __tlb_remove_table(batch->tables[i]);763763+764764+ free_page((unsigned long)batch);765765+}766766+767767+void tlb_table_flush(struct mmu_gather *tlb)768768+{769769+ struct mmu_table_batch **batch = &tlb->batch;770770+771771+ if (*batch) {772772+ __tlb_flush_mm(tlb->mm);773773+ call_rcu_sched(&(*batch)->rcu, tlb_remove_table_rcu);774774+ *batch = NULL;775775+ }776776+}777777+778778+void tlb_remove_table(struct mmu_gather *tlb, void *table)779779+{780780+ struct mmu_table_batch **batch = &tlb->batch;781781+782782+ if (*batch == NULL) {783783+ *batch = (struct mmu_table_batch *)784784+ __get_free_page(GFP_NOWAIT | __GFP_NOWARN);785785+ if (*batch == NULL) {786786+ __tlb_flush_mm(tlb->mm);787787+ tlb_remove_table_one(table);788788+ return;789789+ }790790+ (*batch)->nr = 0;791791+ }792792+ (*batch)->tables[(*batch)->nr++] = table;793793+ if ((*batch)->nr == MAX_TABLE_BATCH)794794+ tlb_table_flush(tlb);795795+}735796736797/*737798 * switch on pgstes for its userspace process (for kvm)
···45454646void __devinit pcibios_fixup_bus(struct pci_bus *pbus)4747{4848- struct leon_pci_info *info = pbus->sysdata;4948 struct pci_dev *dev;5049 int i, has_io, has_mem;5150 u16 cmd;···109110{110111 return pci_enable_resources(dev, mask);111112}112112-113113-struct device_node *pci_device_to_OF_node(struct pci_dev *pdev)114114-{115115- /*116116- * Currently the OpenBoot nodes are not connected with the PCI device,117117- * this is because the LEON PROM does not create PCI nodes. Eventually118118- * this will change and the same approach as pcic.c can be used to119119- * match PROM nodes with pci devices.120120- */121121- return NULL;122122-}123123-EXPORT_SYMBOL(pci_device_to_OF_node);124113125114void __devinit pcibios_update_irq(struct pci_dev *dev, int irq)126115{
···225225 unsigned long g2;226226 int from_user = !(regs->psr & PSR_PS);227227 int fault, code;228228+ unsigned int flags = (FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |229229+ (write ? FAULT_FLAG_WRITE : 0));228230229231 if(text_fault)230232 address = regs->pc;···253251254252 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);255253254254+retry:256255 down_read(&mm->mmap_sem);257256258257 /*···292289 * make sure we exit gracefully rather than endlessly redo293290 * the fault.294291 */295295- fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0);292292+ fault = handle_mm_fault(mm, vma, address, flags);293293+294294+ if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))295295+ return;296296+296297 if (unlikely(fault & VM_FAULT_ERROR)) {297298 if (fault & VM_FAULT_OOM)298299 goto out_of_memory;···304297 goto do_sigbus;305298 BUG();306299 }307307- if (fault & VM_FAULT_MAJOR) {308308- current->maj_flt++;309309- perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, address);310310- } else {311311- current->min_flt++;312312- perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, address);300300+301301+ if (flags & FAULT_FLAG_ALLOW_RETRY) {302302+ if (fault & VM_FAULT_MAJOR) {303303+ current->maj_flt++;304304+ perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ,305305+ 1, regs, address);306306+ } else {307307+ current->min_flt++;308308+ perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN,309309+ 1, regs, address);310310+ }311311+ if (fault & VM_FAULT_RETRY) {312312+ flags &= ~FAULT_FLAG_ALLOW_RETRY;313313+314314+ /* No need to up_read(&mm->mmap_sem) as we would315315+ * have already released it in __lock_page_or_retry316316+ * in mm/filemap.c.317317+ */318318+319319+ goto retry;320320+ }313321 }322322+314323 up_read(&mm->mmap_sem);315324 return;316325
+30-7
arch/sparc/mm/fault_64.c
···279279 unsigned int insn = 0;280280 int si_code, fault_code, fault;281281 unsigned long address, mm_rss;282282+ unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;282283283284 fault_code = get_thread_fault_code();284285···334333 insn = get_fault_insn(regs, insn);335334 goto handle_kernel_fault;336335 }336336+337337+retry:337338 down_read(&mm->mmap_sem);338339 }339340···426423 goto bad_area;427424 }428425429429- fault = handle_mm_fault(mm, vma, address, (fault_code & FAULT_CODE_WRITE) ? FAULT_FLAG_WRITE : 0);426426+ flags |= ((fault_code & FAULT_CODE_WRITE) ? FAULT_FLAG_WRITE : 0);427427+ fault = handle_mm_fault(mm, vma, address, flags);428428+429429+ if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))430430+ return;431431+430432 if (unlikely(fault & VM_FAULT_ERROR)) {431433 if (fault & VM_FAULT_OOM)432434 goto out_of_memory;···439431 goto do_sigbus;440432 BUG();441433 }442442- if (fault & VM_FAULT_MAJOR) {443443- current->maj_flt++;444444- perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, address);445445- } else {446446- current->min_flt++;447447- perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, address);434434+435435+ if (flags & FAULT_FLAG_ALLOW_RETRY) {436436+ if (fault & VM_FAULT_MAJOR) {437437+ current->maj_flt++;438438+ perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ,439439+ 1, regs, address);440440+ } else {441441+ current->min_flt++;442442+ perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN,443443+ 1, regs, address);444444+ }445445+ if (fault & VM_FAULT_RETRY) {446446+ flags &= ~FAULT_FLAG_ALLOW_RETRY;447447+448448+ /* No need to up_read(&mm->mmap_sem) as we would449449+ * have already released it in __lock_page_or_retry450450+ * in mm/filemap.c.451451+ */452452+453453+ goto retry;454454+ }448455 }449456 up_read(&mm->mmap_sem);450457
+1-3
arch/tile/kernel/proc.c
···146146 },147147 {}148148};149149-#endif150149151150static struct ctl_path tile_path[] = {152151 { .procname = "tile" },···154155155156static int __init proc_sys_tile_init(void)156157{157157-#ifndef __tilegx__ /* FIXME: GX: no support for unaligned access yet */158158 register_sysctl_paths(tile_path, unaligned_table);159159-#endif160159 return 0;161160}162161163162arch_initcall(proc_sys_tile_init);163163+#endif
+2
arch/tile/kernel/smpboot.c
···196196 /* This must be done before setting cpu_online_mask */197197 wmb();198198199199+ notify_cpu_starting(smp_processor_id());200200+199201 /*200202 * We need to hold call_lock, so there is no inconsistency201203 * between the time smp_call_function() determines number of
-35
arch/um/drivers/cow.h
···3344#include <asm/types.h>5566-#if defined(__KERNEL__)77-88-# include <asm/byteorder.h>99-1010-# if defined(__BIG_ENDIAN)1111-# define ntohll(x) (x)1212-# define htonll(x) (x)1313-# elif defined(__LITTLE_ENDIAN)1414-# define ntohll(x) be64_to_cpu(x)1515-# define htonll(x) cpu_to_be64(x)1616-# else1717-# error "Could not determine byte order"1818-# endif1919-2020-#else2121-/* For the definition of ntohl, htonl and __BYTE_ORDER */2222-#include <endian.h>2323-#include <netinet/in.h>2424-#if defined(__BYTE_ORDER)2525-2626-# if __BYTE_ORDER == __BIG_ENDIAN2727-# define ntohll(x) (x)2828-# define htonll(x) (x)2929-# elif __BYTE_ORDER == __LITTLE_ENDIAN3030-# define ntohll(x) bswap_64(x)3131-# define htonll(x) bswap_64(x)3232-# else3333-# error "Could not determine byte order: __BYTE_ORDER uncorrectly defined"3434-# endif3535-3636-#else /* ! defined(__BYTE_ORDER) */3737-# error "Could not determine byte order: __BYTE_ORDER not defined"3838-#endif3939-#endif /* ! defined(__KERNEL__) */4040-416extern int init_cow_file(int fd, char *cow_file, char *backing_file,427 int sectorsize, int alignment, int *bitmap_offset_out,438 unsigned long *bitmap_len_out, int *data_offset_out);
+21-22
arch/um/drivers/cow_user.c
···88 * that.99 */1010#include <unistd.h>1111-#include <byteswap.h>1211#include <errno.h>1312#include <string.h>1413#include <arpa/inet.h>1515-#include <asm/types.h>1414+#include <endian.h>1615#include "cow.h"1716#include "cow_sys.h"1817···213214 "header\n");214215 goto out;215216 }216216- header->magic = htonl(COW_MAGIC);217217- header->version = htonl(COW_VERSION);217217+ header->magic = htobe32(COW_MAGIC);218218+ header->version = htobe32(COW_VERSION);218219219220 err = -EINVAL;220221 if (strlen(backing_file) > sizeof(header->backing_file) - 1) {···245246 goto out_free;246247 }247248248248- header->mtime = htonl(modtime);249249- header->size = htonll(*size);250250- header->sectorsize = htonl(sectorsize);251251- header->alignment = htonl(alignment);249249+ header->mtime = htobe32(modtime);250250+ header->size = htobe64(*size);251251+ header->sectorsize = htobe32(sectorsize);252252+ header->alignment = htobe32(alignment);252253 header->cow_format = COW_BITMAP;253254254255 err = cow_write_file(fd, header, sizeof(*header));···300301 magic = header->v1.magic;301302 if (magic == COW_MAGIC)302303 version = header->v1.version;303303- else if (magic == ntohl(COW_MAGIC))304304- version = ntohl(header->v1.version);304304+ else if (magic == be32toh(COW_MAGIC))305305+ version = be32toh(header->v1.version);305306 /* No error printed because the non-COW case comes through here */306307 else goto out;307308···326327 "header\n");327328 goto out;328329 }329329- *mtime_out = ntohl(header->v2.mtime);330330- *size_out = ntohll(header->v2.size);331331- *sectorsize_out = ntohl(header->v2.sectorsize);330330+ *mtime_out = be32toh(header->v2.mtime);331331+ *size_out = be64toh(header->v2.size);332332+ *sectorsize_out = be32toh(header->v2.sectorsize);332333 *bitmap_offset_out = sizeof(header->v2);333334 *align_out = *sectorsize_out;334335 file = header->v2.backing_file;···340341 "header\n");341342 goto out;342343 }343343- *mtime_out = ntohl(header->v3.mtime);344344- *size_out = ntohll(header->v3.size);345345- *sectorsize_out = ntohl(header->v3.sectorsize);346346- *align_out = ntohl(header->v3.alignment);344344+ *mtime_out = be32toh(header->v3.mtime);345345+ *size_out = be64toh(header->v3.size);346346+ *sectorsize_out = be32toh(header->v3.sectorsize);347347+ *align_out = be32toh(header->v3.alignment);347348 if (*align_out == 0) {348349 cow_printf("read_cow_header - invalid COW header, "349350 "align == 0\n");···365366 * this was used until Dec2005 - 64bits are needed to represent366367 * 2038+. I.e. we can safely do this truncating cast.367368 *368368- * Additionally, we must use ntohl() instead of ntohll(), since369369+ * Additionally, we must use be32toh() instead of be64toh(), since369370 * the program used to use the former (tested - I got mtime370371 * mismatch "0 vs whatever").371372 *372373 * Ever heard about bug-to-bug-compatibility ? ;-) */373373- *mtime_out = (time32_t) ntohl(header->v3_b.mtime);374374+ *mtime_out = (time32_t) be32toh(header->v3_b.mtime);374375375375- *size_out = ntohll(header->v3_b.size);376376- *sectorsize_out = ntohl(header->v3_b.sectorsize);377377- *align_out = ntohl(header->v3_b.alignment);376376+ *size_out = be64toh(header->v3_b.size);377377+ *sectorsize_out = be32toh(header->v3_b.sectorsize);378378+ *align_out = be32toh(header->v3_b.alignment);378379 if (*align_out == 0) {379380 cow_printf("read_cow_header - invalid COW header, "380381 "align == 0\n");
···14141515export LDFLAGS16161717+LDS_EXTRA := -Ui3861818+export LDS_EXTRA1919+1720# First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y.1821include $(srctree)/arch/x86/Makefile_32.cpu1922
···557557558558extern unsigned long559559copy_from_user_nmi(void *to, const void __user *from, unsigned long n);560560+extern __must_check long561561+strncpy_from_user(char *dst, const char __user *src, long count);560562561563/*562564 * movsl can be slow when source and dest are not both 8-byte aligned
-5
arch/x86/include/asm/uaccess_32.h
···213213 return n;214214}215215216216-long __must_check strncpy_from_user(char *dst, const char __user *src,217217- long count);218218-long __must_check __strncpy_from_user(char *dst,219219- const char __user *src, long count);220220-221216/**222217 * strlen_user: - Get the size of a string in user space.223218 * @str: The string to measure.
-4
arch/x86/include/asm/uaccess_64.h
···208208 }209209}210210211211-__must_check long212212-strncpy_from_user(char *dst, const char __user *src, long count);213213-__must_check long214214-__strncpy_from_user(char *dst, const char __user *src, long count);215211__must_check long strnlen_user(const char __user *str, long n);216212__must_check long __strnlen_user(const char __user *str, long n);217213__must_check long strlen_user(const char __user *str);
+3-3
arch/x86/kernel/vsyscall_64.c
···216216 current_thread_info()->sig_on_uaccess_error = 1;217217218218 /*219219- * 0 is a valid user pointer (in the access_ok sense) on 32-bit and219219+ * NULL is a valid user pointer (in the access_ok sense) on 32-bit and220220 * 64-bit, so we don't need to special-case it here. For all the221221- * vsyscalls, 0 means "don't write anything" not "write it at221221+ * vsyscalls, NULL means "don't write anything" not "write it at222222 * address 0".223223 */224224 ret = -EFAULT;···247247248248 ret = sys_getcpu((unsigned __user *)regs->di,249249 (unsigned __user *)regs->si,250250- 0);250250+ NULL);251251 break;252252 }253253
···22172217 msr = find_msr_entry(vmx, msr_index);22182218 if (msr) {22192219 msr->data = data;22202220- if (msr - vmx->guest_msrs < vmx->save_nmsrs)22202220+ if (msr - vmx->guest_msrs < vmx->save_nmsrs) {22212221+ preempt_disable();22212222 kvm_set_shared_msr(msr->index, msr->data,22222223 msr->mask);22242224+ preempt_enable();22252225+ }22232226 break;22242227 }22252228 ret = kvm_set_msr_common(vcpu, msr_index, data);
+36-17
arch/x86/lib/insn.c
···379379 return;380380}381381382382-/* Decode moffset16/32/64 */383383-static void __get_moffset(struct insn *insn)382382+/* Decode moffset16/32/64. Return 0 if failed */383383+static int __get_moffset(struct insn *insn)384384{385385 switch (insn->addr_bytes) {386386 case 2:···397397 insn->moffset2.value = get_next(int, insn);398398 insn->moffset2.nbytes = 4;399399 break;400400+ default: /* opnd_bytes must be modified manually */401401+ goto err_out;400402 }401403 insn->moffset1.got = insn->moffset2.got = 1;402404405405+ return 1;406406+403407err_out:404404- return;408408+ return 0;405409}406410407407-/* Decode imm v32(Iz) */408408-static void __get_immv32(struct insn *insn)411411+/* Decode imm v32(Iz). Return 0 if failed */412412+static int __get_immv32(struct insn *insn)409413{410414 switch (insn->opnd_bytes) {411415 case 2:···421417 insn->immediate.value = get_next(int, insn);422418 insn->immediate.nbytes = 4;423419 break;420420+ default: /* opnd_bytes must be modified manually */421421+ goto err_out;424422 }425423424424+ return 1;425425+426426err_out:427427- return;427427+ return 0;428428}429429430430-/* Decode imm v64(Iv/Ov) */431431-static void __get_immv(struct insn *insn)430430+/* Decode imm v64(Iv/Ov), Return 0 if failed */431431+static int __get_immv(struct insn *insn)432432{433433 switch (insn->opnd_bytes) {434434 case 2:···449441 insn->immediate2.value = get_next(int, insn);450442 insn->immediate2.nbytes = 4;451443 break;444444+ default: /* opnd_bytes must be modified manually */445445+ goto err_out;452446 }453447 insn->immediate1.got = insn->immediate2.got = 1;454448449449+ return 1;455450err_out:456456- return;451451+ return 0;457452}458453459454/* Decode ptr16:16/32(Ap) */460460-static void __get_immptr(struct insn *insn)455455+static int __get_immptr(struct insn *insn)461456{462457 switch (insn->opnd_bytes) {463458 case 2:···473462 break;474463 case 8:475464 /* ptr16:64 is not exist (no segment) */476476- return;465465+ return 0;466466+ default: /* opnd_bytes must be modified manually */467467+ goto err_out;477468 }478469 insn->immediate2.value = get_next(unsigned short, insn);479470 insn->immediate2.nbytes = 2;480471 insn->immediate1.got = insn->immediate2.got = 1;481472473473+ return 1;482474err_out:483483- return;475475+ return 0;484476}485477486478/**···503489 insn_get_displacement(insn);504490505491 if (inat_has_moffset(insn->attr)) {506506- __get_moffset(insn);492492+ if (!__get_moffset(insn))493493+ goto err_out;507494 goto done;508495 }509496···532517 insn->immediate2.nbytes = 4;533518 break;534519 case INAT_IMM_PTR:535535- __get_immptr(insn);520520+ if (!__get_immptr(insn))521521+ goto err_out;536522 break;537523 case INAT_IMM_VWORD32:538538- __get_immv32(insn);524524+ if (!__get_immv32(insn))525525+ goto err_out;539526 break;540527 case INAT_IMM_VWORD:541541- __get_immv(insn);528528+ if (!__get_immv(insn))529529+ goto err_out;542530 break;543531 default:544544- break;532532+ /* Here, insn must have an immediate, but failed */533533+ goto err_out;545534 }546535 if (inat_has_second_immediate(insn->attr)) {547536 insn->immediate2.value = get_next(char, insn);
+103
arch/x86/lib/usercopy.c
···77#include <linux/highmem.h>88#include <linux/module.h>991010+#include <asm/word-at-a-time.h>1111+1012/*1113 * best effort, GUP based copy_from_user() that is NMI-safe1214 */···4341 return len;4442}4543EXPORT_SYMBOL_GPL(copy_from_user_nmi);4444+4545+static inline unsigned long count_bytes(unsigned long mask)4646+{4747+ mask = (mask - 1) & ~mask;4848+ mask >>= 7;4949+ return count_masked_bytes(mask);5050+}5151+5252+/*5353+ * Do a strncpy, return length of string without final '\0'.5454+ * 'count' is the user-supplied count (return 'count' if we5555+ * hit it), 'max' is the address space maximum (and we return5656+ * -EFAULT if we hit it).5757+ */5858+static inline long do_strncpy_from_user(char *dst, const char __user *src, long count, unsigned long max)5959+{6060+ long res = 0;6161+6262+ /*6363+ * Truncate 'max' to the user-specified limit, so that6464+ * we only have one limit we need to check in the loop6565+ */6666+ if (max > count)6767+ max = count;6868+6969+ while (max >= sizeof(unsigned long)) {7070+ unsigned long c;7171+7272+ /* Fall back to byte-at-a-time if we get a page fault */7373+ if (unlikely(__get_user(c,(unsigned long __user *)(src+res))))7474+ break;7575+ /* This can write a few bytes past the NUL character, but that's ok */7676+ *(unsigned long *)(dst+res) = c;7777+ c = has_zero(c);7878+ if (c)7979+ return res + count_bytes(c);8080+ res += sizeof(unsigned long);8181+ max -= sizeof(unsigned long);8282+ }8383+8484+ while (max) {8585+ char c;8686+8787+ if (unlikely(__get_user(c,src+res)))8888+ return -EFAULT;8989+ dst[res] = c;9090+ if (!c)9191+ return res;9292+ res++;9393+ max--;9494+ }9595+9696+ /*9797+ * Uhhuh. We hit 'max'. But was that the user-specified maximum9898+ * too? If so, that's ok - we got as much as the user asked for.9999+ */100100+ if (res >= count)101101+ return res;102102+103103+ /*104104+ * Nope: we hit the address space limit, and we still had more105105+ * characters the caller would have wanted. That's an EFAULT.106106+ */107107+ return -EFAULT;108108+}109109+110110+/**111111+ * strncpy_from_user: - Copy a NUL terminated string from userspace.112112+ * @dst: Destination address, in kernel space. This buffer must be at113113+ * least @count bytes long.114114+ * @src: Source address, in user space.115115+ * @count: Maximum number of bytes to copy, including the trailing NUL.116116+ *117117+ * Copies a NUL-terminated string from userspace to kernel space.118118+ *119119+ * On success, returns the length of the string (not including the trailing120120+ * NUL).121121+ *122122+ * If access to userspace fails, returns -EFAULT (some data may have been123123+ * copied).124124+ *125125+ * If @count is smaller than the length of the string, copies @count bytes126126+ * and returns @count.127127+ */128128+long129129+strncpy_from_user(char *dst, const char __user *src, long count)130130+{131131+ unsigned long max_addr, src_addr;132132+133133+ if (unlikely(count <= 0))134134+ return 0;135135+136136+ max_addr = current_thread_info()->addr_limit.seg;137137+ src_addr = (unsigned long)src;138138+ if (likely(src_addr < max_addr)) {139139+ unsigned long max = max_addr - src_addr;140140+ return do_strncpy_from_user(dst, src, count, max);141141+ }142142+ return -EFAULT;143143+}144144+EXPORT_SYMBOL(strncpy_from_user);
-87
arch/x86/lib/usercopy_32.c
···3333 __movsl_is_ok((unsigned long)(a1), (unsigned long)(a2), (n))34343535/*3636- * Copy a null terminated string from userspace.3737- */3838-3939-#define __do_strncpy_from_user(dst, src, count, res) \4040-do { \4141- int __d0, __d1, __d2; \4242- might_fault(); \4343- __asm__ __volatile__( \4444- " testl %1,%1\n" \4545- " jz 2f\n" \4646- "0: lodsb\n" \4747- " stosb\n" \4848- " testb %%al,%%al\n" \4949- " jz 1f\n" \5050- " decl %1\n" \5151- " jnz 0b\n" \5252- "1: subl %1,%0\n" \5353- "2:\n" \5454- ".section .fixup,\"ax\"\n" \5555- "3: movl %5,%0\n" \5656- " jmp 2b\n" \5757- ".previous\n" \5858- _ASM_EXTABLE(0b,3b) \5959- : "=&d"(res), "=&c"(count), "=&a" (__d0), "=&S" (__d1), \6060- "=&D" (__d2) \6161- : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \6262- : "memory"); \6363-} while (0)6464-6565-/**6666- * __strncpy_from_user: - Copy a NUL terminated string from userspace, with less checking.6767- * @dst: Destination address, in kernel space. This buffer must be at6868- * least @count bytes long.6969- * @src: Source address, in user space.7070- * @count: Maximum number of bytes to copy, including the trailing NUL.7171- *7272- * Copies a NUL-terminated string from userspace to kernel space.7373- * Caller must check the specified block with access_ok() before calling7474- * this function.7575- *7676- * On success, returns the length of the string (not including the trailing7777- * NUL).7878- *7979- * If access to userspace fails, returns -EFAULT (some data may have been8080- * copied).8181- *8282- * If @count is smaller than the length of the string, copies @count bytes8383- * and returns @count.8484- */8585-long8686-__strncpy_from_user(char *dst, const char __user *src, long count)8787-{8888- long res;8989- __do_strncpy_from_user(dst, src, count, res);9090- return res;9191-}9292-EXPORT_SYMBOL(__strncpy_from_user);9393-9494-/**9595- * strncpy_from_user: - Copy a NUL terminated string from userspace.9696- * @dst: Destination address, in kernel space. This buffer must be at9797- * least @count bytes long.9898- * @src: Source address, in user space.9999- * @count: Maximum number of bytes to copy, including the trailing NUL.100100- *101101- * Copies a NUL-terminated string from userspace to kernel space.102102- *103103- * On success, returns the length of the string (not including the trailing104104- * NUL).105105- *106106- * If access to userspace fails, returns -EFAULT (some data may have been107107- * copied).108108- *109109- * If @count is smaller than the length of the string, copies @count bytes110110- * and returns @count.111111- */112112-long113113-strncpy_from_user(char *dst, const char __user *src, long count)114114-{115115- long res = -EFAULT;116116- if (access_ok(VERIFY_READ, src, 1))117117- __do_strncpy_from_user(dst, src, count, res);118118- return res;119119-}120120-EXPORT_SYMBOL(strncpy_from_user);121121-122122-/*12336 * Zero Userspace12437 */12538
···11+#ifndef _ASM_UM_BARRIER_H_22+#define _ASM_UM_BARRIER_H_33+44+#include <asm/asm.h>55+#include <asm/segment.h>66+#include <asm/cpufeature.h>77+#include <asm/cmpxchg.h>88+#include <asm/nops.h>99+1010+#include <linux/kernel.h>1111+#include <linux/irqflags.h>1212+1313+/*1414+ * Force strict CPU ordering.1515+ * And yes, this is required on UP too when we're talking1616+ * to devices.1717+ */1818+#ifdef CONFIG_X86_321919+2020+#define mb() alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2)2121+#define rmb() alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2)2222+#define wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM)2323+2424+#else /* CONFIG_X86_32 */2525+2626+#define mb() asm volatile("mfence" : : : "memory")2727+#define rmb() asm volatile("lfence" : : : "memory")2828+#define wmb() asm volatile("sfence" : : : "memory")2929+3030+#endif /* CONFIG_X86_32 */3131+3232+#define read_barrier_depends() do { } while (0)3333+3434+#ifdef CONFIG_SMP3535+3636+#define smp_mb() mb()3737+#ifdef CONFIG_X86_PPRO_FENCE3838+#define smp_rmb() rmb()3939+#else /* CONFIG_X86_PPRO_FENCE */4040+#define smp_rmb() barrier()4141+#endif /* CONFIG_X86_PPRO_FENCE */4242+4343+#ifdef CONFIG_X86_OOSTORE4444+#define smp_wmb() wmb()4545+#else /* CONFIG_X86_OOSTORE */4646+#define smp_wmb() barrier()4747+#endif /* CONFIG_X86_OOSTORE */4848+4949+#define smp_read_barrier_depends() read_barrier_depends()5050+#define set_mb(var, value) do { (void)xchg(&var, value); } while (0)5151+5252+#else /* CONFIG_SMP */5353+5454+#define smp_mb() barrier()5555+#define smp_rmb() barrier()5656+#define smp_wmb() barrier()5757+#define smp_read_barrier_depends() do { } while (0)5858+#define set_mb(var, value) do { var = value; barrier(); } while (0)5959+6060+#endif /* CONFIG_SMP */6161+6262+/*6363+ * Stop RDTSC speculation. This is needed when you need to use RDTSC6464+ * (or get_cycles or vread that possibly accesses the TSC) in a defined6565+ * code region.6666+ *6767+ * (Could use an alternative three way for this if there was one.)6868+ */6969+static inline void rdtsc_barrier(void)7070+{7171+ alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC);7272+ alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);7373+}7474+7575+#endif
-135
arch/x86/um/asm/system.h
···11-#ifndef _ASM_X86_SYSTEM_H_22-#define _ASM_X86_SYSTEM_H_33-44-#include <asm/asm.h>55-#include <asm/segment.h>66-#include <asm/cpufeature.h>77-#include <asm/cmpxchg.h>88-#include <asm/nops.h>99-1010-#include <linux/kernel.h>1111-#include <linux/irqflags.h>1212-1313-/* entries in ARCH_DLINFO: */1414-#ifdef CONFIG_IA32_EMULATION1515-# define AT_VECTOR_SIZE_ARCH 21616-#else1717-# define AT_VECTOR_SIZE_ARCH 11818-#endif1919-2020-extern unsigned long arch_align_stack(unsigned long sp);2121-2222-void default_idle(void);2323-2424-/*2525- * Force strict CPU ordering.2626- * And yes, this is required on UP too when we're talking2727- * to devices.2828- */2929-#ifdef CONFIG_X86_323030-/*3131- * Some non-Intel clones support out of order store. wmb() ceases to be a3232- * nop for these.3333- */3434-#define mb() alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2)3535-#define rmb() alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2)3636-#define wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM)3737-#else3838-#define mb() asm volatile("mfence":::"memory")3939-#define rmb() asm volatile("lfence":::"memory")4040-#define wmb() asm volatile("sfence" ::: "memory")4141-#endif4242-4343-/**4444- * read_barrier_depends - Flush all pending reads that subsequents reads4545- * depend on.4646- *4747- * No data-dependent reads from memory-like regions are ever reordered4848- * over this barrier. All reads preceding this primitive are guaranteed4949- * to access memory (but not necessarily other CPUs' caches) before any5050- * reads following this primitive that depend on the data return by5151- * any of the preceding reads. This primitive is much lighter weight than5252- * rmb() on most CPUs, and is never heavier weight than is5353- * rmb().5454- *5555- * These ordering constraints are respected by both the local CPU5656- * and the compiler.5757- *5858- * Ordering is not guaranteed by anything other than these primitives,5959- * not even by data dependencies. See the documentation for6060- * memory_barrier() for examples and URLs to more information.6161- *6262- * For example, the following code would force ordering (the initial6363- * value of "a" is zero, "b" is one, and "p" is "&a"):6464- *6565- * <programlisting>6666- * CPU 0 CPU 16767- *6868- * b = 2;6969- * memory_barrier();7070- * p = &b; q = p;7171- * read_barrier_depends();7272- * d = *q;7373- * </programlisting>7474- *7575- * because the read of "*q" depends on the read of "p" and these7676- * two reads are separated by a read_barrier_depends(). However,7777- * the following code, with the same initial values for "a" and "b":7878- *7979- * <programlisting>8080- * CPU 0 CPU 18181- *8282- * a = 2;8383- * memory_barrier();8484- * b = 3; y = b;8585- * read_barrier_depends();8686- * x = a;8787- * </programlisting>8888- *8989- * does not enforce ordering, since there is no data dependency between9090- * the read of "a" and the read of "b". Therefore, on some CPUs, such9191- * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb()9292- * in cases like this where there are no data dependencies.9393- **/9494-9595-#define read_barrier_depends() do { } while (0)9696-9797-#ifdef CONFIG_SMP9898-#define smp_mb() mb()9999-#ifdef CONFIG_X86_PPRO_FENCE100100-# define smp_rmb() rmb()101101-#else102102-# define smp_rmb() barrier()103103-#endif104104-#ifdef CONFIG_X86_OOSTORE105105-# define smp_wmb() wmb()106106-#else107107-# define smp_wmb() barrier()108108-#endif109109-#define smp_read_barrier_depends() read_barrier_depends()110110-#define set_mb(var, value) do { (void)xchg(&var, value); } while (0)111111-#else112112-#define smp_mb() barrier()113113-#define smp_rmb() barrier()114114-#define smp_wmb() barrier()115115-#define smp_read_barrier_depends() do { } while (0)116116-#define set_mb(var, value) do { var = value; barrier(); } while (0)117117-#endif118118-119119-/*120120- * Stop RDTSC speculation. This is needed when you need to use RDTSC121121- * (or get_cycles or vread that possibly accesses the TSC) in a defined122122- * code region.123123- *124124- * (Could use an alternative three way for this if there was one.)125125- */126126-static inline void rdtsc_barrier(void)127127-{128128- alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC);129129- alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);130130-}131131-132132-extern void *_switch_to(void *prev, void *next, void *last);133133-#define switch_to(prev, next, last) prev = _switch_to(prev, next, last)134134-135135-#endif
+3-2
block/blk-core.c
···483483 if (!q)484484 return NULL;485485486486- q->id = ida_simple_get(&blk_queue_ida, 0, 0, GFP_KERNEL);486486+ q->id = ida_simple_get(&blk_queue_ida, 0, 0, gfp_mask);487487 if (q->id < 0)488488 goto fail_q;489489···12771277 list_for_each_entry_reverse(rq, &plug->list, queuelist) {12781278 int el_ret;1279127912801280- (*request_count)++;12801280+ if (rq->q == q)12811281+ (*request_count)++;1281128212821283 if (rq->q != q || !blk_rq_merge_ok(rq, bio))12831284 continue;
···247247/*248248 * Hooks to provide runtime PM of the pclk (bus clock). It is safe to249249 * enable/disable the bus clock at runtime PM suspend/resume as this250250- * does not result in loss of context. However, disabling vcore power251251- * would do, so we leave that to the driver.250250+ * does not result in loss of context.252251 */253252static int amba_pm_runtime_suspend(struct device *dev)254253{···353354 clk_put(pclk);354355}355356356356-static int amba_get_enable_vcore(struct amba_device *pcdev)357357-{358358- struct regulator *vcore = regulator_get(&pcdev->dev, "vcore");359359- int ret;360360-361361- pcdev->vcore = vcore;362362-363363- if (IS_ERR(vcore)) {364364- /* It is OK not to supply a vcore regulator */365365- if (PTR_ERR(vcore) == -ENODEV)366366- return 0;367367- return PTR_ERR(vcore);368368- }369369-370370- ret = regulator_enable(vcore);371371- if (ret) {372372- regulator_put(vcore);373373- pcdev->vcore = ERR_PTR(-ENODEV);374374- }375375-376376- return ret;377377-}378378-379379-static void amba_put_disable_vcore(struct amba_device *pcdev)380380-{381381- struct regulator *vcore = pcdev->vcore;382382-383383- if (!IS_ERR(vcore)) {384384- regulator_disable(vcore);385385- regulator_put(vcore);386386- }387387-}388388-389357/*390358 * These are the device model conversion veneers; they convert the391359 * device model structures to our more specific structures.···365399 int ret;366400367401 do {368368- ret = amba_get_enable_vcore(pcdev);369369- if (ret)370370- break;371371-372402 ret = amba_get_enable_pclk(pcdev);373403 if (ret)374404 break;···382420 pm_runtime_put_noidle(dev);383421384422 amba_put_disable_pclk(pcdev);385385- amba_put_disable_vcore(pcdev);386423 } while (0);387424388425 return ret;···403442 pm_runtime_put_noidle(dev);404443405444 amba_put_disable_pclk(pcdev);406406- amba_put_disable_vcore(pcdev);407445408446 return ret;409447}
+2
drivers/ata/ata_piix.c
···329329 { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },330330 /* SATA Controller IDE (Lynx Point) */331331 { 0x8086, 0x8c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },332332+ /* SATA Controller IDE (DH89xxCC) */333333+ { 0x8086, 0x2326, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },332334 { } /* terminate list */333335};334336
+2-2
drivers/ata/libata-core.c
···9595static void ata_dev_xfermask(struct ata_device *dev);9696static unsigned long ata_dev_blacklisted(const struct ata_device *dev);97979898-unsigned int ata_print_id = 1;9898+atomic_t ata_print_id = ATOMIC_INIT(1);9999100100struct ata_force_param {101101 const char *name;···6029602960306030 /* give ports names and add SCSI hosts */60316031 for (i = 0; i < host->n_ports; i++)60326032- host->ports[i]->print_id = ata_print_id++;60326032+ host->ports[i]->print_id = atomic_inc_return(&ata_print_id);603360336034603460356035 /* Create associated sysfs transport objects */
···5353 ATA_DNXFER_QUIET = (1 << 31),5454};55555656-extern unsigned int ata_print_id;5656+extern atomic_t ata_print_id;5757extern int atapi_passthru16;5858extern int libata_fua;5959extern int libata_noacpi;
+2-1
drivers/ata/sata_mv.c
···40254025 struct ata_host *host;40264026 struct mv_host_priv *hpriv;40274027 struct resource *res;40284028- int n_ports, rc;40284028+ int n_ports = 0;40294029+ int rc;4029403040304031 ata_print_version_once(&pdev->dev, DRV_VERSION);40314032
···866866 sh->can_queue = cciss_tape_cmds;867867 sh->sg_tablesize = h->maxsgentries;868868 sh->max_cmd_len = MAX_COMMAND_SIZE;869869+ sh->max_sectors = h->cciss_max_sectors;869870870871 ((struct cciss_scsi_adapter_data_t *) 871872 h->scsi_ctlr)->scsi_host = sh;···14111410 /* track how many SG entries we are using */14121411 if (request_nsgs > h->maxSG)14131412 h->maxSG = request_nsgs;14141414- c->Header.SGTotal = (__u8) request_nsgs + chained;14131413+ c->Header.SGTotal = (u16) request_nsgs + chained;14151414 if (request_nsgs > h->max_cmd_sgentries)14161415 c->Header.SGList = h->max_cmd_sgentries;14171416 else
+1-1
drivers/block/mtip32xx/Kconfig
···4455config BLK_DEV_PCIESSD_MTIP32XX66 tristate "Block Device Driver for Micron PCIe SSDs"77- depends on HOTPLUG_PCI_PCIE77+ depends on PCI88 help99 This enables the block driver for Micron PCIe SSDs.
+664-196
drivers/block/mtip32xx/mtip32xx.c
···3636#include <linux/idr.h>3737#include <linux/kthread.h>3838#include <../drivers/ata/ahci.h>3939+#include <linux/export.h>3940#include "mtip32xx.h"40414142#define HW_CMD_SLOT_SZ (MTIP_MAX_COMMAND_SLOTS * 32)···4544#define HW_PORT_PRIV_DMA_SZ \4645 (HW_CMD_SLOT_SZ + HW_CMD_TBL_AR_SZ + AHCI_RX_FIS_SZ)47464747+#define HOST_CAP_NZDMA (1 << 19)4848#define HOST_HSORG 0xFC4949#define HSORG_DISABLE_SLOTGRP_INTR (1<<24)5050#define HSORG_DISABLE_SLOTGRP_PXIS (1<<16)···141139 int group = 0, commandslot = 0, commandindex = 0;142140 struct mtip_cmd *command;143141 struct mtip_port *port = dd->port;142142+ static int in_progress;143143+144144+ if (in_progress)145145+ return;146146+147147+ in_progress = 1;144148145149 for (group = 0; group < 4; group++) {146150 for (commandslot = 0; commandslot < 32; commandslot++) {···173165174166 up(&port->cmd_slot);175167176176- atomic_set(&dd->drv_cleanup_done, true);168168+ set_bit(MTIP_DDF_CLEANUP_BIT, &dd->dd_flag);169169+ in_progress = 0;177170}178171179172/*···271262 && time_before(jiffies, timeout))272263 mdelay(1);273264265265+ if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag))266266+ return -1;267267+274268 if (readl(dd->mmio + HOST_CTL) & HOST_RESET)275269 return -1;276270···306294 port->cmd_issue[MTIP_TAG_INDEX(tag)]);307295308296 spin_unlock_irqrestore(&port->cmd_issue_lock, flags);297297+298298+ /* Set the command's timeout value.*/299299+ port->commands[tag].comp_time = jiffies + msecs_to_jiffies(300300+ MTIP_NCQ_COMMAND_TIMEOUT_MS);309301}310302311303/*···436420 writel(0xFFFFFFFF, port->completed[i]);437421438422 /* Clear any pending interrupts for this port */439439- writel(readl(port->mmio + PORT_IRQ_STAT), port->mmio + PORT_IRQ_STAT);423423+ writel(readl(port->dd->mmio + PORT_IRQ_STAT),424424+ port->dd->mmio + PORT_IRQ_STAT);425425+426426+ /* Clear any pending interrupts on the HBA. */427427+ writel(readl(port->dd->mmio + HOST_IRQ_STAT),428428+ port->dd->mmio + HOST_IRQ_STAT);440429441430 /* Enable port interrupts */442431 writel(DEF_PORT_IRQ, port->mmio + PORT_IRQ_MASK);···467446 while ((readl(port->mmio + PORT_CMD) & PORT_CMD_LIST_ON)468447 && time_before(jiffies, timeout))469448 ;449449+450450+ if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &port->dd->dd_flag))451451+ return;470452471453 /*472454 * Chip quirk: escalate to hba reset if···499475 while (time_before(jiffies, timeout))500476 ;501477478478+ if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &port->dd->dd_flag))479479+ return;480480+502481 /* Clear PxSCTL.DET */503482 writel(readl(port->mmio + PORT_SCR_CTL) & ~1,504483 port->mmio + PORT_SCR_CTL);···513486 && time_before(jiffies, timeout))514487 ;515488489489+ if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &port->dd->dd_flag))490490+ return;491491+516492 if ((readl(port->mmio + PORT_SCR_STAT) & 0x01) == 0)517493 dev_warn(&port->dd->pdev->dev,518494 "COM reset failed\n");519495520520- /* Clear SError, the PxSERR.DIAG.x should be set so clear it */521521- writel(readl(port->mmio + PORT_SCR_ERR), port->mmio + PORT_SCR_ERR);496496+ mtip_init_port(port);497497+ mtip_start_port(port);522498523523- /* Enable the DMA engine */524524- mtip_enable_engine(port, 1);499499+}500500+501501+/*502502+ * Helper function for tag logging503503+ */504504+static void print_tags(struct driver_data *dd,505505+ char *msg,506506+ unsigned long *tagbits,507507+ int cnt)508508+{509509+ unsigned char tagmap[128];510510+ int group, tagmap_len = 0;511511+512512+ memset(tagmap, 0, sizeof(tagmap));513513+ for (group = SLOTBITS_IN_LONGS; group > 0; group--)514514+ tagmap_len = sprintf(tagmap + tagmap_len, "%016lX ",515515+ tagbits[group-1]);516516+ dev_warn(&dd->pdev->dev,517517+ "%d command(s) %s: tagmap [%s]", cnt, msg, tagmap);525518}526519527520/*···561514 int tag, cmdto_cnt = 0;562515 unsigned int bit, group;563516 unsigned int num_command_slots = port->dd->slot_groups * 32;517517+ unsigned long to, tagaccum[SLOTBITS_IN_LONGS];564518565519 if (unlikely(!port))566520 return;567521568568- if (atomic_read(&port->dd->resumeflag) == true) {522522+ if (test_bit(MTIP_DDF_RESUME_BIT, &port->dd->dd_flag)) {569523 mod_timer(&port->cmd_timer,570524 jiffies + msecs_to_jiffies(30000));571525 return;572526 }527527+ /* clear the tag accumulator */528528+ memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long));573529574530 for (tag = 0; tag < num_command_slots; tag++) {575531 /*···590540 command = &port->commands[tag];591541 fis = (struct host_to_dev_fis *) command->command;592542593593- dev_warn(&port->dd->pdev->dev,594594- "Timeout for command tag %d\n", tag);595595-543543+ set_bit(tag, tagaccum);596544 cmdto_cnt++;597545 if (cmdto_cnt == 1)598598- set_bit(MTIP_FLAG_EH_ACTIVE_BIT, &port->flags);546546+ set_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags);599547600548 /*601549 * Clear the completed bit. This should prevent···626578 }627579 }628580629629- if (cmdto_cnt) {630630- dev_warn(&port->dd->pdev->dev,631631- "%d commands timed out: restarting port",632632- cmdto_cnt);581581+ if (cmdto_cnt && !test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags)) {582582+ print_tags(port->dd, "timed out", tagaccum, cmdto_cnt);583583+633584 mtip_restart_port(port);634634- clear_bit(MTIP_FLAG_EH_ACTIVE_BIT, &port->flags);585585+ clear_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags);635586 wake_up_interruptible(&port->svc_wait);587587+ }588588+589589+ if (port->ic_pause_timer) {590590+ to = port->ic_pause_timer + msecs_to_jiffies(1000);591591+ if (time_after(jiffies, to)) {592592+ if (!test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags)) {593593+ port->ic_pause_timer = 0;594594+ clear_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags);595595+ clear_bit(MTIP_PF_DM_ACTIVE_BIT, &port->flags);596596+ clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags);597597+ wake_up_interruptible(&port->svc_wait);598598+ }599599+600600+601601+ }636602 }637603638604 /* Restart the timer */···743681 complete(waiting);744682}745683746746-/*747747- * Helper function for tag logging748748- */749749-static void print_tags(struct driver_data *dd,750750- char *msg,751751- unsigned long *tagbits)684684+static void mtip_null_completion(struct mtip_port *port,685685+ int tag,686686+ void *data,687687+ int status)752688{753753- unsigned int tag, count = 0;754754-755755- for (tag = 0; tag < (dd->slot_groups) * 32; tag++) {756756- if (test_bit(tag, tagbits))757757- count++;758758- }759759- if (count)760760- dev_info(&dd->pdev->dev, "%s [%i tags]\n", msg, count);689689+ return;761690}762691692692+static int mtip_read_log_page(struct mtip_port *port, u8 page, u16 *buffer,693693+ dma_addr_t buffer_dma, unsigned int sectors);694694+static int mtip_get_smart_attr(struct mtip_port *port, unsigned int id,695695+ struct smart_attr *attrib);763696/*764697 * Handle an error.765698 *···765708 */766709static void mtip_handle_tfe(struct driver_data *dd)767710{768768- int group, tag, bit, reissue;711711+ int group, tag, bit, reissue, rv;769712 struct mtip_port *port;770770- struct mtip_cmd *command;713713+ struct mtip_cmd *cmd;771714 u32 completed;772715 struct host_to_dev_fis *fis;773716 unsigned long tagaccum[SLOTBITS_IN_LONGS];717717+ unsigned int cmd_cnt = 0;718718+ unsigned char *buf;719719+ char *fail_reason = NULL;720720+ int fail_all_ncq_write = 0, fail_all_ncq_cmds = 0;774721775722 dev_warn(&dd->pdev->dev, "Taskfile error\n");776723···783722 /* Stop the timer to prevent command timeouts. */784723 del_timer(&port->cmd_timer);785724725725+ /* clear the tag accumulator */726726+ memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long));727727+786728 /* Set eh_active */787787- set_bit(MTIP_FLAG_EH_ACTIVE_BIT, &port->flags);729729+ set_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags);788730789731 /* Loop through all the groups */790732 for (group = 0; group < dd->slot_groups; group++) {···795731796732 /* clear completed status register in the hardware.*/797733 writel(completed, port->completed[group]);798798-799799- /* clear the tag accumulator */800800- memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long));801734802735 /* Process successfully completed commands */803736 for (bit = 0; bit < 32 && completed; bit++) {···806745 if (tag == MTIP_TAG_INTERNAL)807746 continue;808747809809- command = &port->commands[tag];810810- if (likely(command->comp_func)) {748748+ cmd = &port->commands[tag];749749+ if (likely(cmd->comp_func)) {811750 set_bit(tag, tagaccum);812812- atomic_set(&port->commands[tag].active, 0);813813- command->comp_func(port,751751+ cmd_cnt++;752752+ atomic_set(&cmd->active, 0);753753+ cmd->comp_func(port,814754 tag,815815- command->comp_data,755755+ cmd->comp_data,816756 0);817757 } else {818758 dev_err(&port->dd->pdev->dev,···827765 }828766 }829767 }830830- print_tags(dd, "TFE tags completed:", tagaccum);768768+769769+ print_tags(dd, "completed (TFE)", tagaccum, cmd_cnt);831770832771 /* Restart the port */833772 mdelay(20);834773 mtip_restart_port(port);774774+775775+ /* Trying to determine the cause of the error */776776+ rv = mtip_read_log_page(dd->port, ATA_LOG_SATA_NCQ,777777+ dd->port->log_buf,778778+ dd->port->log_buf_dma, 1);779779+ if (rv) {780780+ dev_warn(&dd->pdev->dev,781781+ "Error in READ LOG EXT (10h) command\n");782782+ /* non-critical error, don't fail the load */783783+ } else {784784+ buf = (unsigned char *)dd->port->log_buf;785785+ if (buf[259] & 0x1) {786786+ dev_info(&dd->pdev->dev,787787+ "Write protect bit is set.\n");788788+ set_bit(MTIP_DDF_WRITE_PROTECT_BIT, &dd->dd_flag);789789+ fail_all_ncq_write = 1;790790+ fail_reason = "write protect";791791+ }792792+ if (buf[288] == 0xF7) {793793+ dev_info(&dd->pdev->dev,794794+ "Exceeded Tmax, drive in thermal shutdown.\n");795795+ set_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag);796796+ fail_all_ncq_cmds = 1;797797+ fail_reason = "thermal shutdown";798798+ }799799+ if (buf[288] == 0xBF) {800800+ dev_info(&dd->pdev->dev,801801+ "Drive indicates rebuild has failed.\n");802802+ fail_all_ncq_cmds = 1;803803+ fail_reason = "rebuild failed";804804+ }805805+ }835806836807 /* clear the tag accumulator */837808 memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long));···874779 for (bit = 0; bit < 32; bit++) {875780 reissue = 1;876781 tag = (group << 5) + bit;782782+ cmd = &port->commands[tag];877783878784 /* If the active bit is set re-issue the command */879879- if (atomic_read(&port->commands[tag].active) == 0)785785+ if (atomic_read(&cmd->active) == 0)880786 continue;881787882882- fis = (struct host_to_dev_fis *)883883- port->commands[tag].command;788788+ fis = (struct host_to_dev_fis *)cmd->command;884789885790 /* Should re-issue? */886791 if (tag == MTIP_TAG_INTERNAL ||887792 fis->command == ATA_CMD_SET_FEATURES)888793 reissue = 0;794794+ else {795795+ if (fail_all_ncq_cmds ||796796+ (fail_all_ncq_write &&797797+ fis->command == ATA_CMD_FPDMA_WRITE)) {798798+ dev_warn(&dd->pdev->dev,799799+ " Fail: %s w/tag %d [%s].\n",800800+ fis->command == ATA_CMD_FPDMA_WRITE ?801801+ "write" : "read",802802+ tag,803803+ fail_reason != NULL ?804804+ fail_reason : "unknown");805805+ atomic_set(&cmd->active, 0);806806+ if (cmd->comp_func) {807807+ cmd->comp_func(port, tag,808808+ cmd->comp_data,809809+ -ENODATA);810810+ }811811+ continue;812812+ }813813+ }889814890815 /*891816 * First check if this command has892817 * exceeded its retries.893818 */894894- if (reissue &&895895- (port->commands[tag].retries-- > 0)) {819819+ if (reissue && (cmd->retries-- > 0)) {896820897821 set_bit(tag, tagaccum);898822899899- /* Update the timeout value. */900900- port->commands[tag].comp_time =901901- jiffies + msecs_to_jiffies(902902- MTIP_NCQ_COMMAND_TIMEOUT_MS);903823 /* Re-issue the command. */904824 mtip_issue_ncq_command(port, tag);905825···924814 /* Retire a command that will not be reissued */925815 dev_warn(&port->dd->pdev->dev,926816 "retiring tag %d\n", tag);927927- atomic_set(&port->commands[tag].active, 0);817817+ atomic_set(&cmd->active, 0);928818929929- if (port->commands[tag].comp_func)930930- port->commands[tag].comp_func(819819+ if (cmd->comp_func)820820+ cmd->comp_func(931821 port,932822 tag,933933- port->commands[tag].comp_data,823823+ cmd->comp_data,934824 PORT_IRQ_TF_ERR);935825 else936826 dev_warn(&port->dd->pdev->dev,···938828 tag);939829 }940830 }941941- print_tags(dd, "TFE tags reissued:", tagaccum);831831+ print_tags(dd, "reissued (TFE)", tagaccum, cmd_cnt);942832943833 /* clear eh_active */944944- clear_bit(MTIP_FLAG_EH_ACTIVE_BIT, &port->flags);834834+ clear_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags);945835 wake_up_interruptible(&port->svc_wait);946836947837 mod_timer(&port->cmd_timer,···1009899 struct mtip_port *port = dd->port;1010900 struct mtip_cmd *cmd = &port->commands[MTIP_TAG_INTERNAL];101190110121012- if (test_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags) &&902902+ if (test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags) &&1013903 (cmd != NULL) && !(readl(port->cmd_issue[MTIP_TAG_INTERNAL])1014904 & (1 << MTIP_TAG_INTERNAL))) {1015905 if (cmd->comp_func) {···1020910 return;1021911 }1022912 }10231023-10241024- dev_warn(&dd->pdev->dev, "IRQ status 0x%x ignored.\n", port_stat);10259131026914 return;1027915}···1076968 /* don't proceed further */1077969 return IRQ_HANDLED;1078970 }971971+ if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT,972972+ &dd->dd_flag))973973+ return rv;10799741080975 mtip_process_errors(dd, port_stat & PORT_IRQ_ERR);1081976 }···11261015 port->cmd_issue[MTIP_TAG_INDEX(tag)]);11271016}1128101710181018+static bool mtip_pause_ncq(struct mtip_port *port,10191019+ struct host_to_dev_fis *fis)10201020+{10211021+ struct host_to_dev_fis *reply;10221022+ unsigned long task_file_data;10231023+10241024+ reply = port->rxfis + RX_FIS_D2H_REG;10251025+ task_file_data = readl(port->mmio+PORT_TFDATA);10261026+10271027+ if ((task_file_data & 1) || (fis->command == ATA_CMD_SEC_ERASE_UNIT))10281028+ return false;10291029+10301030+ if (fis->command == ATA_CMD_SEC_ERASE_PREP) {10311031+ set_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags);10321032+ port->ic_pause_timer = jiffies;10331033+ return true;10341034+ } else if ((fis->command == ATA_CMD_DOWNLOAD_MICRO) &&10351035+ (fis->features == 0x03)) {10361036+ set_bit(MTIP_PF_DM_ACTIVE_BIT, &port->flags);10371037+ port->ic_pause_timer = jiffies;10381038+ return true;10391039+ } else if ((fis->command == ATA_CMD_SEC_ERASE_UNIT) ||10401040+ ((fis->command == 0xFC) &&10411041+ (fis->features == 0x27 || fis->features == 0x72 ||10421042+ fis->features == 0x62 || fis->features == 0x26))) {10431043+ /* Com reset after secure erase or lowlevel format */10441044+ mtip_restart_port(port);10451045+ return false;10461046+ }10471047+10481048+ return false;10491049+}10501050+11291051/*11301052 * Wait for port to quiesce11311053 *···1177103311781034 to = jiffies + msecs_to_jiffies(timeout);11791035 do {11801180- if (test_bit(MTIP_FLAG_SVC_THD_ACTIVE_BIT, &port->flags) &&11811181- test_bit(MTIP_FLAG_ISSUE_CMDS_BIT, &port->flags)) {10361036+ if (test_bit(MTIP_PF_SVC_THD_ACTIVE_BIT, &port->flags) &&10371037+ test_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags)) {11821038 msleep(20);11831039 continue; /* svc thd is actively issuing commands */11841040 }10411041+ if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &port->dd->dd_flag))10421042+ return -EFAULT;11851043 /*11861044 * Ignore s_active bit 0 of array element 0.11871045 * This bit will always be set···12201074 * -EAGAIN Time out waiting for command to complete.12211075 */12221076static int mtip_exec_internal_command(struct mtip_port *port,12231223- void *fis,10771077+ struct host_to_dev_fis *fis,12241078 int fis_len,12251079 dma_addr_t buffer,12261080 int buf_len,···12301084{12311085 struct mtip_cmd_sg *command_sg;12321086 DECLARE_COMPLETION_ONSTACK(wait);12331233- int rv = 0;10871087+ int rv = 0, ready2go = 1;12341088 struct mtip_cmd *int_cmd = &port->commands[MTIP_TAG_INTERNAL];10891089+ unsigned long to;1235109012361091 /* Make sure the buffer is 8 byte aligned. This is asic specific. */12371092 if (buffer & 0x00000007) {···12411094 return -EFAULT;12421095 }1243109612441244- /* Only one internal command should be running at a time */12451245- if (test_and_set_bit(MTIP_TAG_INTERNAL, port->allocated)) {10971097+ to = jiffies + msecs_to_jiffies(timeout);10981098+ do {10991099+ ready2go = !test_and_set_bit(MTIP_TAG_INTERNAL,11001100+ port->allocated);11011101+ if (ready2go)11021102+ break;11031103+ mdelay(100);11041104+ } while (time_before(jiffies, to));11051105+ if (!ready2go) {12461106 dev_warn(&port->dd->pdev->dev,12471247- "Internal command already active\n");11071107+ "Internal cmd active. new cmd [%02X]\n", fis->command);12481108 return -EBUSY;12491109 }12501250- set_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags);11101110+ set_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags);11111111+ port->ic_pause_timer = 0;11121112+11131113+ if (fis->command == ATA_CMD_SEC_ERASE_UNIT)11141114+ clear_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags);11151115+ else if (fis->command == ATA_CMD_DOWNLOAD_MICRO)11161116+ clear_bit(MTIP_PF_DM_ACTIVE_BIT, &port->flags);1251111712521118 if (atomic == GFP_KERNEL) {12531253- /* wait for io to complete if non atomic */12541254- if (mtip_quiesce_io(port, 5000) < 0) {12551255- dev_warn(&port->dd->pdev->dev,12561256- "Failed to quiesce IO\n");12571257- release_slot(port, MTIP_TAG_INTERNAL);12581258- clear_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags);12591259- wake_up_interruptible(&port->svc_wait);12601260- return -EBUSY;11191119+ if (fis->command != ATA_CMD_STANDBYNOW1) {11201120+ /* wait for io to complete if non atomic */11211121+ if (mtip_quiesce_io(port, 5000) < 0) {11221122+ dev_warn(&port->dd->pdev->dev,11231123+ "Failed to quiesce IO\n");11241124+ release_slot(port, MTIP_TAG_INTERNAL);11251125+ clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags);11261126+ wake_up_interruptible(&port->svc_wait);11271127+ return -EBUSY;11281128+ }12611129 }1262113012631131 /* Set the completion function and data for the command. */···12821120 } else {12831121 /* Clear completion - we're going to poll */12841122 int_cmd->comp_data = NULL;12851285- int_cmd->comp_func = NULL;11231123+ int_cmd->comp_func = mtip_null_completion;12861124 }1287112512881126 /* Copy the command to the command table */···13211159 "Internal command did not complete [%d] "13221160 "within timeout of %lu ms\n",13231161 atomic, timeout);11621162+ if (mtip_check_surprise_removal(port->dd->pdev) ||11631163+ test_bit(MTIP_DDF_REMOVE_PENDING_BIT,11641164+ &port->dd->dd_flag)) {11651165+ rv = -ENXIO;11661166+ goto exec_ic_exit;11671167+ }13241168 rv = -EAGAIN;13251169 }13261170···13341166 & (1 << MTIP_TAG_INTERNAL)) {13351167 dev_warn(&port->dd->pdev->dev,13361168 "Retiring internal command but CI is 1.\n");11691169+ if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT,11701170+ &port->dd->dd_flag)) {11711171+ hba_reset_nosleep(port->dd);11721172+ rv = -ENXIO;11731173+ } else {11741174+ mtip_restart_port(port);11751175+ rv = -EAGAIN;11761176+ }11771177+ goto exec_ic_exit;13371178 }1338117913391180 } else {13401181 /* Spin for <timeout> checking if command still outstanding */13411182 timeout = jiffies + msecs_to_jiffies(timeout);13421342-13431343- while ((readl(13441344- port->cmd_issue[MTIP_TAG_INTERNAL])13451345- & (1 << MTIP_TAG_INTERNAL))13461346- && time_before(jiffies, timeout))13471347- ;11831183+ while ((readl(port->cmd_issue[MTIP_TAG_INTERNAL])11841184+ & (1 << MTIP_TAG_INTERNAL))11851185+ && time_before(jiffies, timeout)) {11861186+ if (mtip_check_surprise_removal(port->dd->pdev)) {11871187+ rv = -ENXIO;11881188+ goto exec_ic_exit;11891189+ }11901190+ if ((fis->command != ATA_CMD_STANDBYNOW1) &&11911191+ test_bit(MTIP_DDF_REMOVE_PENDING_BIT,11921192+ &port->dd->dd_flag)) {11931193+ rv = -ENXIO;11941194+ goto exec_ic_exit;11951195+ }11961196+ }1348119713491198 if (readl(port->cmd_issue[MTIP_TAG_INTERNAL])13501199 & (1 << MTIP_TAG_INTERNAL)) {13511200 dev_err(&port->dd->pdev->dev,13521352- "Internal command did not complete [%d]\n",13531353- atomic);12011201+ "Internal command did not complete [atomic]\n");13541202 rv = -EAGAIN;12031203+ if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT,12041204+ &port->dd->dd_flag)) {12051205+ hba_reset_nosleep(port->dd);12061206+ rv = -ENXIO;12071207+ } else {12081208+ mtip_restart_port(port);12091209+ rv = -EAGAIN;12101210+ }13551211 }13561212 }13571357-12131213+exec_ic_exit:13581214 /* Clear the allocated and active bits for the internal command. */13591215 atomic_set(&int_cmd->active, 0);13601216 release_slot(port, MTIP_TAG_INTERNAL);13611361- clear_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags);12171217+ if (rv >= 0 && mtip_pause_ncq(port, fis)) {12181218+ /* NCQ paused */12191219+ return rv;12201220+ }12211221+ clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags);13621222 wake_up_interruptible(&port->svc_wait);1363122313641224 return rv;···14351239{14361240 int rv = 0;14371241 struct host_to_dev_fis fis;12421242+12431243+ if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &port->dd->dd_flag))12441244+ return -EFAULT;1438124514391246 /* Build the FIS. */14401247 memset(&fis, 0, sizeof(struct host_to_dev_fis));···15121313{15131314 int rv;15141315 struct host_to_dev_fis fis;13161316+ unsigned long start;1515131715161318 /* Build the FIS. */15171319 memset(&fis, 0, sizeof(struct host_to_dev_fis));···15201320 fis.opts = 1 << 7;15211321 fis.command = ATA_CMD_STANDBYNOW1;1522132215231523- /* Execute the command. Use a 15-second timeout for large drives. */13231323+ start = jiffies;15241324 rv = mtip_exec_internal_command(port,15251325 &fis,15261326 5,15271327 0,15281328 0,15291329 0,15301530- GFP_KERNEL,13301330+ GFP_ATOMIC,15311331 15000);13321332+ dbg_printk(MTIP_DRV_NAME "Time taken to complete standby cmd: %d ms\n",13331333+ jiffies_to_msecs(jiffies - start));13341334+ if (rv)13351335+ dev_warn(&port->dd->pdev->dev,13361336+ "STANDBY IMMEDIATE command failed.\n");13371337+13381338+ return rv;13391339+}13401340+13411341+/*13421342+ * Issue a READ LOG EXT command to the device.13431343+ *13441344+ * @port pointer to the port structure.13451345+ * @page page number to fetch13461346+ * @buffer pointer to buffer13471347+ * @buffer_dma dma address corresponding to @buffer13481348+ * @sectors page length to fetch, in sectors13491349+ *13501350+ * return value13511351+ * @rv return value from mtip_exec_internal_command()13521352+ */13531353+static int mtip_read_log_page(struct mtip_port *port, u8 page, u16 *buffer,13541354+ dma_addr_t buffer_dma, unsigned int sectors)13551355+{13561356+ struct host_to_dev_fis fis;13571357+13581358+ memset(&fis, 0, sizeof(struct host_to_dev_fis));13591359+ fis.type = 0x27;13601360+ fis.opts = 1 << 7;13611361+ fis.command = ATA_CMD_READ_LOG_EXT;13621362+ fis.sect_count = sectors & 0xFF;13631363+ fis.sect_cnt_ex = (sectors >> 8) & 0xFF;13641364+ fis.lba_low = page;13651365+ fis.lba_mid = 0;13661366+ fis.device = ATA_DEVICE_OBS;13671367+13681368+ memset(buffer, 0, sectors * ATA_SECT_SIZE);13691369+13701370+ return mtip_exec_internal_command(port,13711371+ &fis,13721372+ 5,13731373+ buffer_dma,13741374+ sectors * ATA_SECT_SIZE,13751375+ 0,13761376+ GFP_ATOMIC,13771377+ MTIP_INTERNAL_COMMAND_TIMEOUT_MS);13781378+}13791379+13801380+/*13811381+ * Issue a SMART READ DATA command to the device.13821382+ *13831383+ * @port pointer to the port structure.13841384+ * @buffer pointer to buffer13851385+ * @buffer_dma dma address corresponding to @buffer13861386+ *13871387+ * return value13881388+ * @rv return value from mtip_exec_internal_command()13891389+ */13901390+static int mtip_get_smart_data(struct mtip_port *port, u8 *buffer,13911391+ dma_addr_t buffer_dma)13921392+{13931393+ struct host_to_dev_fis fis;13941394+13951395+ memset(&fis, 0, sizeof(struct host_to_dev_fis));13961396+ fis.type = 0x27;13971397+ fis.opts = 1 << 7;13981398+ fis.command = ATA_CMD_SMART;13991399+ fis.features = 0xD0;14001400+ fis.sect_count = 1;14011401+ fis.lba_mid = 0x4F;14021402+ fis.lba_hi = 0xC2;14031403+ fis.device = ATA_DEVICE_OBS;14041404+14051405+ return mtip_exec_internal_command(port,14061406+ &fis,14071407+ 5,14081408+ buffer_dma,14091409+ ATA_SECT_SIZE,14101410+ 0,14111411+ GFP_ATOMIC,14121412+ 15000);14131413+}14141414+14151415+/*14161416+ * Get the value of a smart attribute14171417+ *14181418+ * @port pointer to the port structure14191419+ * @id attribute number14201420+ * @attrib pointer to return attrib information corresponding to @id14211421+ *14221422+ * return value14231423+ * -EINVAL NULL buffer passed or unsupported attribute @id.14241424+ * -EPERM Identify data not valid, SMART not supported or not enabled14251425+ */14261426+static int mtip_get_smart_attr(struct mtip_port *port, unsigned int id,14271427+ struct smart_attr *attrib)14281428+{14291429+ int rv, i;14301430+ struct smart_attr *pattr;14311431+14321432+ if (!attrib)14331433+ return -EINVAL;14341434+14351435+ if (!port->identify_valid) {14361436+ dev_warn(&port->dd->pdev->dev, "IDENTIFY DATA not valid\n");14371437+ return -EPERM;14381438+ }14391439+ if (!(port->identify[82] & 0x1)) {14401440+ dev_warn(&port->dd->pdev->dev, "SMART not supported\n");14411441+ return -EPERM;14421442+ }14431443+ if (!(port->identify[85] & 0x1)) {14441444+ dev_warn(&port->dd->pdev->dev, "SMART not enabled\n");14451445+ return -EPERM;14461446+ }14471447+14481448+ memset(port->smart_buf, 0, ATA_SECT_SIZE);14491449+ rv = mtip_get_smart_data(port, port->smart_buf, port->smart_buf_dma);14501450+ if (rv) {14511451+ dev_warn(&port->dd->pdev->dev, "Failed to ge SMART data\n");14521452+ return rv;14531453+ }14541454+14551455+ pattr = (struct smart_attr *)(port->smart_buf + 2);14561456+ for (i = 0; i < 29; i++, pattr++)14571457+ if (pattr->attr_id == id) {14581458+ memcpy(attrib, pattr, sizeof(struct smart_attr));14591459+ break;14601460+ }14611461+14621462+ if (i == 29) {14631463+ dev_warn(&port->dd->pdev->dev,14641464+ "Query for invalid SMART attribute ID\n");14651465+ rv = -EINVAL;14661466+ }1532146715331468 return rv;15341469}···18391504 fis.cyl_hi = command[5];18401505 fis.device = command[6] & ~0x10; /* Clear the dev bit*/1841150618421842-18431843- dbg_printk(MTIP_DRV_NAME "%s: User Command: cmd %x, feat %x, "18441844- "nsect %x, sect %x, lcyl %x, "18451845- "hcyl %x, sel %x\n",15071507+ dbg_printk(MTIP_DRV_NAME " %s: User Command: cmd %x, feat %x, nsect %x, sect %x, lcyl %x, hcyl %x, sel %x\n",18461508 __func__,18471509 command[0],18481510 command[1],···18661534 command[4] = reply->cyl_low;18671535 command[5] = reply->cyl_hi;1868153618691869- dbg_printk(MTIP_DRV_NAME "%s: Completion Status: stat %x, "18701870- "err %x , cyl_lo %x cyl_hi %x\n",15371537+ dbg_printk(MTIP_DRV_NAME " %s: Completion Status: stat %x, err %x , cyl_lo %x cyl_hi %x\n",18711538 __func__,18721539 command[0],18731540 command[1],···19091578 }1910157919111580 dbg_printk(MTIP_DRV_NAME19121912- "%s: User Command: cmd %x, sect %x, "15811581+ " %s: User Command: cmd %x, sect %x, "19131582 "feat %x, sectcnt %x\n",19141583 __func__,19151584 command[0],···19381607 command[2] = command[3];1939160819401609 dbg_printk(MTIP_DRV_NAME19411941- "%s: Completion Status: stat %x, "16101610+ " %s: Completion Status: stat %x, "19421611 "err %x, cmd %x\n",19431612 __func__,19441613 command[0],···21411810 }2142181121431812 dbg_printk(MTIP_DRV_NAME21442144- "taskfile: cmd %x, feat %x, nsect %x,"18131813+ " %s: cmd %x, feat %x, nsect %x,"21451814 " sect/lbal %x, lcyl/lbam %x, hcyl/lbah %x,"21461815 " head/dev %x\n",18161816+ __func__,21471817 fis.command,21481818 fis.features,21491819 fis.sect_count,···2155182321561824 switch (fis.command) {21571825 case ATA_CMD_DOWNLOAD_MICRO:21582158- /* Change timeout for Download Microcode to 60 seconds.*/21592159- timeout = 60000;18261826+ /* Change timeout for Download Microcode to 2 minutes */18271827+ timeout = 120000;21601828 break;21611829 case ATA_CMD_SEC_ERASE_UNIT:21621830 /* Change timeout for Security Erase Unit to 4 minutes.*/···21721840 timeout = 10000;21731841 break;21741842 case ATA_CMD_SMART:21752175- /* Change timeout for vendor unique command to 10 secs */21762176- timeout = 10000;18431843+ /* Change timeout for vendor unique command to 15 secs */18441844+ timeout = 15000;21771845 break;21781846 default:21791847 timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS;···22351903 req_task->hob_ports[1] = reply->features_ex;22361904 req_task->hob_ports[2] = reply->sect_cnt_ex;22371905 }22382238-22392239- /* Com rest after secure erase or lowlevel format */22402240- if (((fis.command == ATA_CMD_SEC_ERASE_UNIT) ||22412241- ((fis.command == 0xFC) &&22422242- (fis.features == 0x27 || fis.features == 0x72 ||22432243- fis.features == 0x62 || fis.features == 0x26))) &&22442244- !(reply->command & 1)) {22452245- mtip_restart_port(dd->port);22462246- }22472247-22481906 dbg_printk(MTIP_DRV_NAME22492249- "%s: Completion: stat %x,"19071907+ " %s: Completion: stat %x,"22501908 "err %x, sect_cnt %x, lbalo %x,"22511909 "lbamid %x, lbahi %x, dev %x\n",22521910 __func__,···24022080 struct host_to_dev_fis *fis;24032081 struct mtip_port *port = dd->port;24042082 struct mtip_cmd *command = &port->commands[tag];20832083+ int dma_dir = (dir == READ) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;2405208424062085 /* Map the scatter list for DMA access */24072407- if (dir == READ)24082408- nents = dma_map_sg(&dd->pdev->dev, command->sg,24092409- nents, DMA_FROM_DEVICE);24102410- else24112411- nents = dma_map_sg(&dd->pdev->dev, command->sg,24122412- nents, DMA_TO_DEVICE);20862086+ nents = dma_map_sg(&dd->pdev->dev, command->sg, nents, dma_dir);2413208724142088 command->scatter_ents = nents;24152089···24452127 */24462128 command->comp_data = dd;24472129 command->comp_func = mtip_async_complete;24482448- command->direction = (dir == READ ? DMA_FROM_DEVICE : DMA_TO_DEVICE);21302130+ command->direction = dma_dir;2449213124502132 /*24512133 * Set the completion function and data for the command passed···24582140 * To prevent this command from being issued24592141 * if an internal command is in progress or error handling is active.24602142 */24612461- if (unlikely(test_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags) ||24622462- test_bit(MTIP_FLAG_EH_ACTIVE_BIT, &port->flags))) {21432143+ if (port->flags & MTIP_PF_PAUSE_IO) {24632144 set_bit(tag, port->cmds_to_issue);24642464- set_bit(MTIP_FLAG_ISSUE_CMDS_BIT, &port->flags);21452145+ set_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags);24652146 return;24662147 }2467214824682149 /* Issue the command to the hardware */24692150 mtip_issue_ncq_command(port, tag);2470215124712471- /* Set the command's timeout value.*/24722472- port->commands[tag].comp_time = jiffies + msecs_to_jiffies(24732473- MTIP_NCQ_COMMAND_TIMEOUT_MS);21522152+ return;24742153}2475215424762155/*···25062191 down(&dd->port->cmd_slot);25072192 *tag = get_slot(dd->port);2508219321942194+ if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag))) {21952195+ up(&dd->port->cmd_slot);21962196+ return NULL;21972197+ }25092198 if (unlikely(*tag < 0))25102199 return NULL;25112200···25262207 * return value25272208 * The size, in bytes, of the data copied into buf.25282209 */25292529-static ssize_t hw_show_registers(struct device *dev,22102210+static ssize_t mtip_hw_show_registers(struct device *dev,25302211 struct device_attribute *attr,25312212 char *buf)25322213{···25352216 int size = 0;25362217 int n;2537221825382538- size += sprintf(&buf[size], "%s:\ns_active:\n", __func__);22192219+ size += sprintf(&buf[size], "S ACTive:\n");2539222025402221 for (n = 0; n < dd->slot_groups; n++)25412222 size += sprintf(&buf[size], "0x%08x\n",···25592240 group_allocated);25602241 }2561224225622562- size += sprintf(&buf[size], "completed:\n");22432243+ size += sprintf(&buf[size], "Completed:\n");2563224425642245 for (n = 0; n < dd->slot_groups; n++)25652246 size += sprintf(&buf[size], "0x%08x\n",25662247 readl(dd->port->completed[n]));2567224825682568- size += sprintf(&buf[size], "PORT_IRQ_STAT 0x%08x\n",22492249+ size += sprintf(&buf[size], "PORT IRQ STAT : 0x%08x\n",25692250 readl(dd->port->mmio + PORT_IRQ_STAT));25702570- size += sprintf(&buf[size], "HOST_IRQ_STAT 0x%08x\n",22512251+ size += sprintf(&buf[size], "HOST IRQ STAT : 0x%08x\n",25712252 readl(dd->mmio + HOST_IRQ_STAT));2572225325732254 return size;25742255}25752575-static DEVICE_ATTR(registers, S_IRUGO, hw_show_registers, NULL);22562256+22572257+static ssize_t mtip_hw_show_status(struct device *dev,22582258+ struct device_attribute *attr,22592259+ char *buf)22602260+{22612261+ struct driver_data *dd = dev_to_disk(dev)->private_data;22622262+ int size = 0;22632263+22642264+ if (test_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag))22652265+ size += sprintf(buf, "%s", "thermal_shutdown\n");22662266+ else if (test_bit(MTIP_DDF_WRITE_PROTECT_BIT, &dd->dd_flag))22672267+ size += sprintf(buf, "%s", "write_protect\n");22682268+ else22692269+ size += sprintf(buf, "%s", "online\n");22702270+22712271+ return size;22722272+}22732273+22742274+static DEVICE_ATTR(registers, S_IRUGO, mtip_hw_show_registers, NULL);22752275+static DEVICE_ATTR(status, S_IRUGO, mtip_hw_show_status, NULL);2576227625772277/*25782278 * Create the sysfs related attributes.···2610227226112273 if (sysfs_create_file(kobj, &dev_attr_registers.attr))26122274 dev_warn(&dd->pdev->dev,26132613- "Error creating registers sysfs entry\n");22752275+ "Error creating 'registers' sysfs entry\n");22762276+ if (sysfs_create_file(kobj, &dev_attr_status.attr))22772277+ dev_warn(&dd->pdev->dev,22782278+ "Error creating 'status' sysfs entry\n");26142279 return 0;26152280}26162281···26332292 return -EINVAL;2634229326352294 sysfs_remove_file(kobj, &dev_attr_registers.attr);22952295+ sysfs_remove_file(kobj, &dev_attr_status.attr);2636229626372297 return 0;26382298}···27262384 "FTL rebuild in progress. Polling for completion.\n");2727238527282386 start = jiffies;27292729- dd->ftlrebuildflag = 1;27302387 timeout = jiffies + msecs_to_jiffies(MTIP_FTL_REBUILD_TIMEOUT_MS);2731238827322389 do {23902390+ if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT,23912391+ &dd->dd_flag)))23922392+ return -EFAULT;27332393 if (mtip_check_surprise_removal(dd->pdev))27342394 return -EFAULT;27352395···27522408 dev_warn(&dd->pdev->dev,27532409 "FTL rebuild complete (%d secs).\n",27542410 jiffies_to_msecs(jiffies - start) / 1000);27552755- dd->ftlrebuildflag = 0;27562411 mtip_block_initialize(dd);27572757- break;24122412+ return 0;27582413 }27592414 ssleep(10);27602415 } while (time_before(jiffies, timeout));2761241627622417 /* Check for timeout */27632763- if (dd->ftlrebuildflag) {27642764- dev_err(&dd->pdev->dev,24182418+ dev_err(&dd->pdev->dev,27652419 "Timed out waiting for FTL rebuild to complete (%d secs).\n",27662420 jiffies_to_msecs(jiffies - start) / 1000);27672767- return -EFAULT;27682768- }27692769-27702770- return 0;24212421+ return -EFAULT;27712422}2772242327732424/*···27872448 * is in progress nor error handling is active27882449 */27892450 wait_event_interruptible(port->svc_wait, (port->flags) &&27902790- !test_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags) &&27912791- !test_bit(MTIP_FLAG_EH_ACTIVE_BIT, &port->flags));24512451+ !(port->flags & MTIP_PF_PAUSE_IO));2792245227932453 if (kthread_should_stop())27942454 break;2795245527962796- set_bit(MTIP_FLAG_SVC_THD_ACTIVE_BIT, &port->flags);27972797- if (test_bit(MTIP_FLAG_ISSUE_CMDS_BIT, &port->flags)) {24562456+ if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT,24572457+ &dd->dd_flag)))24582458+ break;24592459+24602460+ set_bit(MTIP_PF_SVC_THD_ACTIVE_BIT, &port->flags);24612461+ if (test_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags)) {27982462 slot = 1;27992463 /* used to restrict the loop to one iteration */28002464 slot_start = num_cmd_slots;···28222480 /* Issue the command to the hardware */28232481 mtip_issue_ncq_command(port, slot);2824248228252825- /* Set the command's timeout value.*/28262826- port->commands[slot].comp_time = jiffies +28272827- msecs_to_jiffies(MTIP_NCQ_COMMAND_TIMEOUT_MS);28282828-28292483 clear_bit(slot, port->cmds_to_issue);28302484 }2831248528322832- clear_bit(MTIP_FLAG_ISSUE_CMDS_BIT, &port->flags);28332833- } else if (test_bit(MTIP_FLAG_REBUILD_BIT, &port->flags)) {28342834- mtip_ftl_rebuild_poll(dd);28352835- clear_bit(MTIP_FLAG_REBUILD_BIT, &port->flags);24862486+ clear_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags);24872487+ } else if (test_bit(MTIP_PF_REBUILD_BIT, &port->flags)) {24882488+ if (!mtip_ftl_rebuild_poll(dd))24892489+ set_bit(MTIP_DDF_REBUILD_FAILED_BIT,24902490+ &dd->dd_flag);24912491+ clear_bit(MTIP_PF_REBUILD_BIT, &port->flags);28362492 }28372837- clear_bit(MTIP_FLAG_SVC_THD_ACTIVE_BIT, &port->flags);24932493+ clear_bit(MTIP_PF_SVC_THD_ACTIVE_BIT, &port->flags);2838249428392839- if (test_bit(MTIP_FLAG_SVC_THD_SHOULD_STOP_BIT, &port->flags))24952495+ if (test_bit(MTIP_PF_SVC_THD_STOP_BIT, &port->flags))28402496 break;28412497 }28422498 return 0;···28532513 int i;28542514 int rv;28552515 unsigned int num_command_slots;25162516+ unsigned long timeout, timetaken;25172517+ unsigned char *buf;25182518+ struct smart_attr attr242;2856251928572520 dd->mmio = pcim_iomap_table(dd->pdev)[MTIP_ABAR];28582521···28902547 /* Allocate memory for the command list. */28912548 dd->port->command_list =28922549 dmam_alloc_coherent(&dd->pdev->dev,28932893- HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 2),25502550+ HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 4),28942551 &dd->port->command_list_dma,28952552 GFP_KERNEL);28962553 if (!dd->port->command_list) {···29032560 /* Clear the memory we have allocated. */29042561 memset(dd->port->command_list,29052562 0,29062906- HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 2));25632563+ HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 4));2907256429082565 /* Setup the addresse of the RX FIS. */29092566 dd->port->rxfis = dd->port->command_list + HW_CMD_SLOT_SZ;···29192576 dd->port->identify_dma = dd->port->command_tbl_dma +29202577 HW_CMD_TBL_AR_SZ;2921257829222922- /* Setup the address of the sector buffer. */25792579+ /* Setup the address of the sector buffer - for some non-ncq cmds */29232580 dd->port->sector_buffer = (void *) dd->port->identify + ATA_SECT_SIZE;29242581 dd->port->sector_buffer_dma = dd->port->identify_dma + ATA_SECT_SIZE;25822582+25832583+ /* Setup the address of the log buf - for read log command */25842584+ dd->port->log_buf = (void *)dd->port->sector_buffer + ATA_SECT_SIZE;25852585+ dd->port->log_buf_dma = dd->port->sector_buffer_dma + ATA_SECT_SIZE;25862586+25872587+ /* Setup the address of the smart buf - for smart read data command */25882588+ dd->port->smart_buf = (void *)dd->port->log_buf + ATA_SECT_SIZE;25892589+ dd->port->smart_buf_dma = dd->port->log_buf_dma + ATA_SECT_SIZE;25902590+2925259129262592 /* Point the command headers at the command tables. */29272593 for (i = 0; i < num_command_slots; i++) {···29752623 dd->port->mmio + i*0x80 + PORT_SDBV;29762624 }2977262529782978- /* Reset the HBA. */29792979- if (mtip_hba_reset(dd) < 0) {29802980- dev_err(&dd->pdev->dev,29812981- "Card did not reset within timeout\n");29822982- rv = -EIO;26262626+ timetaken = jiffies;26272627+ timeout = jiffies + msecs_to_jiffies(30000);26282628+ while (((readl(dd->port->mmio + PORT_SCR_STAT) & 0x0F) != 0x03) &&26292629+ time_before(jiffies, timeout)) {26302630+ mdelay(100);26312631+ }26322632+ if (unlikely(mtip_check_surprise_removal(dd->pdev))) {26332633+ timetaken = jiffies - timetaken;26342634+ dev_warn(&dd->pdev->dev,26352635+ "Surprise removal detected at %u ms\n",26362636+ jiffies_to_msecs(timetaken));26372637+ rv = -ENODEV;26382638+ goto out2 ;26392639+ }26402640+ if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag))) {26412641+ timetaken = jiffies - timetaken;26422642+ dev_warn(&dd->pdev->dev,26432643+ "Removal detected at %u ms\n",26442644+ jiffies_to_msecs(timetaken));26452645+ rv = -EFAULT;29832646 goto out2;26472647+ }26482648+26492649+ /* Conditionally reset the HBA. */26502650+ if (!(readl(dd->mmio + HOST_CAP) & HOST_CAP_NZDMA)) {26512651+ if (mtip_hba_reset(dd) < 0) {26522652+ dev_err(&dd->pdev->dev,26532653+ "Card did not reset within timeout\n");26542654+ rv = -EIO;26552655+ goto out2;26562656+ }26572657+ } else {26582658+ /* Clear any pending interrupts on the HBA */26592659+ writel(readl(dd->mmio + HOST_IRQ_STAT),26602660+ dd->mmio + HOST_IRQ_STAT);29842661 }2985266229862663 mtip_init_port(dd->port);···30412660 mod_timer(&dd->port->cmd_timer,30422661 jiffies + msecs_to_jiffies(MTIP_TIMEOUT_CHECK_PERIOD));3043266226632663+26642664+ if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag)) {26652665+ rv = -EFAULT;26662666+ goto out3;26672667+ }26682668+30442669 if (mtip_get_identify(dd->port, NULL) < 0) {30452670 rv = -EFAULT;30462671 goto out3;···3054266730552668 if (*(dd->port->identify + MTIP_FTL_REBUILD_OFFSET) ==30562669 MTIP_FTL_REBUILD_MAGIC) {30573057- set_bit(MTIP_FLAG_REBUILD_BIT, &dd->port->flags);26702670+ set_bit(MTIP_PF_REBUILD_BIT, &dd->port->flags);30582671 return MTIP_FTL_REBUILD_MAGIC;30592672 }30602673 mtip_dump_identify(dd->port);26742674+26752675+ /* check write protect, over temp and rebuild statuses */26762676+ rv = mtip_read_log_page(dd->port, ATA_LOG_SATA_NCQ,26772677+ dd->port->log_buf,26782678+ dd->port->log_buf_dma, 1);26792679+ if (rv) {26802680+ dev_warn(&dd->pdev->dev,26812681+ "Error in READ LOG EXT (10h) command\n");26822682+ /* non-critical error, don't fail the load */26832683+ } else {26842684+ buf = (unsigned char *)dd->port->log_buf;26852685+ if (buf[259] & 0x1) {26862686+ dev_info(&dd->pdev->dev,26872687+ "Write protect bit is set.\n");26882688+ set_bit(MTIP_DDF_WRITE_PROTECT_BIT, &dd->dd_flag);26892689+ }26902690+ if (buf[288] == 0xF7) {26912691+ dev_info(&dd->pdev->dev,26922692+ "Exceeded Tmax, drive in thermal shutdown.\n");26932693+ set_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag);26942694+ }26952695+ if (buf[288] == 0xBF) {26962696+ dev_info(&dd->pdev->dev,26972697+ "Drive indicates rebuild has failed.\n");26982698+ /* TODO */26992699+ }27002700+ }27012701+27022702+ /* get write protect progess */27032703+ memset(&attr242, 0, sizeof(struct smart_attr));27042704+ if (mtip_get_smart_attr(dd->port, 242, &attr242))27052705+ dev_warn(&dd->pdev->dev,27062706+ "Unable to check write protect progress\n");27072707+ else27082708+ dev_info(&dd->pdev->dev,27092709+ "Write protect progress: %d%% (%d blocks)\n",27102710+ attr242.cur, attr242.data);30612711 return rv;3062271230632713out3:···3112268831132689 /* Free the command/command header memory. */31142690 dmam_free_coherent(&dd->pdev->dev,31153115- HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 2),26912691+ HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 4),31162692 dd->port->command_list,31172693 dd->port->command_list_dma);31182694out1:···31362712 * Send standby immediate (E0h) to the drive so that it31372713 * saves its state.31382714 */31393139- if (atomic_read(&dd->drv_cleanup_done) != true) {27152715+ if (!test_bit(MTIP_DDF_CLEANUP_BIT, &dd->dd_flag)) {3140271631413141- mtip_standby_immediate(dd->port);27172717+ if (!test_bit(MTIP_PF_REBUILD_BIT, &dd->port->flags))27182718+ if (mtip_standby_immediate(dd->port))27192719+ dev_warn(&dd->pdev->dev,27202720+ "STANDBY IMMEDIATE failed\n");3142272131432722 /* de-initialize the port. */31442723 mtip_deinit_port(dd->port);···3161273431622735 /* Free the command/command header memory. */31632736 dmam_free_coherent(&dd->pdev->dev,31643164- HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 2),27372737+ HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 4),31652738 dd->port->command_list,31662739 dd->port->command_list_dma);31672740 /* Free the memory allocated for the for structure. */···33192892 if (!dd)33202893 return -ENOTTY;3321289428952895+ if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag)))28962896+ return -ENOTTY;28972897+33222898 switch (cmd) {33232899 case BLKFLSBUF:33242900 return -ENOTTY;···33552925 return -EACCES;3356292633572927 if (!dd)29282928+ return -ENOTTY;29292929+29302930+ if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag)))33582931 return -ENOTTY;3359293233602933 switch (cmd) {···34823049 int nents = 0;34833050 int tag = 0;3484305130523052+ if (unlikely(dd->dd_flag & MTIP_DDF_STOP_IO)) {30533053+ if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT,30543054+ &dd->dd_flag))) {30553055+ bio_endio(bio, -ENXIO);30563056+ return;30573057+ }30583058+ if (unlikely(test_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag))) {30593059+ bio_endio(bio, -ENODATA);30603060+ return;30613061+ }30623062+ if (unlikely(test_bit(MTIP_DDF_WRITE_PROTECT_BIT,30633063+ &dd->dd_flag) &&30643064+ bio_data_dir(bio))) {30653065+ bio_endio(bio, -ENODATA);30663066+ return;30673067+ }30683068+ }30693069+34853070 if (unlikely(!bio_has_data(bio))) {34863071 blk_queue_flush(queue, 0);34873072 bio_endio(bio, 0);···3512306135133062 if (unlikely((bio)->bi_vcnt > MTIP_MAX_SG)) {35143063 dev_warn(&dd->pdev->dev,35153515- "Maximum number of SGL entries exceeded");30643064+ "Maximum number of SGL entries exceeded\n");35163065 bio_io_error(bio);35173066 mtip_hw_release_scatterlist(dd, tag);35183067 return;···36613210 kobject_put(kobj);36623211 }3663321236643664- if (dd->mtip_svc_handler)32133213+ if (dd->mtip_svc_handler) {32143214+ set_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag);36653215 return rv; /* service thread created for handling rebuild */32163216+ }3666321736673218start_service_thread:36683219 sprintf(thd_name, "mtip_svc_thd_%02d", index);···36733220 dd, thd_name);3674322136753222 if (IS_ERR(dd->mtip_svc_handler)) {36763676- printk(KERN_ERR "mtip32xx: service thread failed to start\n");32233223+ dev_err(&dd->pdev->dev, "service thread failed to start\n");36773224 dd->mtip_svc_handler = NULL;36783225 rv = -EFAULT;36793226 goto kthread_run_error;36803227 }32283228+32293229+ if (wait_for_rebuild == MTIP_FTL_REBUILD_MAGIC)32303230+ rv = wait_for_rebuild;3681323136823232 return rv;36833233···37223266 struct kobject *kobj;3723326737243268 if (dd->mtip_svc_handler) {37253725- set_bit(MTIP_FLAG_SVC_THD_SHOULD_STOP_BIT, &dd->port->flags);32693269+ set_bit(MTIP_PF_SVC_THD_STOP_BIT, &dd->port->flags);37263270 wake_up_interruptible(&dd->port->svc_wait);37273271 kthread_stop(dd->mtip_svc_handler);37283272 }3729327337303730- /* Clean up the sysfs attributes managed by the protocol layer. */37313731- kobj = kobject_get(&disk_to_dev(dd->disk)->kobj);37323732- if (kobj) {37333733- mtip_hw_sysfs_exit(dd, kobj);37343734- kobject_put(kobj);32743274+ /* Clean up the sysfs attributes, if created */32753275+ if (test_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag)) {32763276+ kobj = kobject_get(&disk_to_dev(dd->disk)->kobj);32773277+ if (kobj) {32783278+ mtip_hw_sysfs_exit(dd, kobj);32793279+ kobject_put(kobj);32803280+ }37353281 }3736328237373283 /*···37413283 * from /dev37423284 */37433285 del_gendisk(dd->disk);32863286+32873287+ spin_lock(&rssd_index_lock);32883288+ ida_remove(&rssd_index_ida, dd->index);32893289+ spin_unlock(&rssd_index_lock);32903290+37443291 blk_cleanup_queue(dd->queue);37453292 dd->disk = NULL;37463293 dd->queue = NULL;···3775331237763313 /* Delete our gendisk structure, and cleanup the blk queue. */37773314 del_gendisk(dd->disk);33153315+33163316+ spin_lock(&rssd_index_lock);33173317+ ida_remove(&rssd_index_ida, dd->index);33183318+ spin_unlock(&rssd_index_lock);33193319+37783320 blk_cleanup_queue(dd->queue);37793321 dd->disk = NULL;37803322 dd->queue = NULL;···38263358 "Unable to allocate memory for driver data\n");38273359 return -ENOMEM;38283360 }38293829-38303830- /* Set the atomic variable as 1 in case of SRSI */38313831- atomic_set(&dd->drv_cleanup_done, true);38323832-38333833- atomic_set(&dd->resumeflag, false);3834336138353362 /* Attach the private data to this PCI device. */38363363 pci_set_drvdata(pdev, dd);···38833420 * instance number.38843421 */38853422 instance++;38863886-34233423+ if (rv != MTIP_FTL_REBUILD_MAGIC)34243424+ set_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag);38873425 goto done;3888342638893427block_initialize_err:···38983434 pci_set_drvdata(pdev, NULL);38993435 return rv;39003436done:39013901- /* Set the atomic variable as 0 in case of SRSI */39023902- atomic_set(&dd->drv_cleanup_done, true);39033903-39043437 return rv;39053438}39063439···39133452 struct driver_data *dd = pci_get_drvdata(pdev);39143453 int counter = 0;3915345434553455+ set_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag);34563456+39163457 if (mtip_check_surprise_removal(pdev)) {39173917- while (atomic_read(&dd->drv_cleanup_done) == false) {34583458+ while (!test_bit(MTIP_DDF_CLEANUP_BIT, &dd->dd_flag)) {39183459 counter++;39193460 msleep(20);39203461 if (counter == 10) {···39263463 }39273464 }39283465 }39293929- /* Set the atomic variable as 1 in case of SRSI */39303930- atomic_set(&dd->drv_cleanup_done, true);3931346639323467 /* Clean up the block layer. */39333468 mtip_block_remove(dd);···39543493 return -EFAULT;39553494 }3956349539573957- atomic_set(&dd->resumeflag, true);34963496+ set_bit(MTIP_DDF_RESUME_BIT, &dd->dd_flag);3958349739593498 /* Disable ports & interrupts then send standby immediate */39603499 rv = mtip_block_suspend(dd);···40203559 dev_err(&pdev->dev, "Unable to resume\n");4021356040223561err:40234023- atomic_set(&dd->resumeflag, false);35623562+ clear_bit(MTIP_DDF_RESUME_BIT, &dd->dd_flag);4024356340253564 return rv;40263565}···40693608 */40703609static int __init mtip_init(void)40713610{36113611+ int error;36123612+40723613 printk(KERN_INFO MTIP_DRV_NAME " Version " MTIP_DRV_VERSION "\n");4073361440743615 /* Allocate a major block device number to use with this driver. */40754075- mtip_major = register_blkdev(0, MTIP_DRV_NAME);40764076- if (mtip_major < 0) {36163616+ error = register_blkdev(0, MTIP_DRV_NAME);36173617+ if (error <= 0) {40773618 printk(KERN_ERR "Unable to register block device (%d)\n",40784078- mtip_major);36193619+ error);40793620 return -EBUSY;40803621 }36223622+ mtip_major = error;4081362340823624 /* Register our PCI operations. */40834083- return pci_register_driver(&mtip_pci_driver);36253625+ error = pci_register_driver(&mtip_pci_driver);36263626+ if (error)36273627+ unregister_blkdev(mtip_major, MTIP_DRV_NAME);36283628+36293629+ return error;40843630}4085363140863632/*
+45-13
drivers/block/mtip32xx/mtip32xx.h
···3434/* offset of Device Control register in PCIe extended capabilites space */3535#define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x4836363737-/* # of times to retry timed out IOs */3838-#define MTIP_MAX_RETRIES 53737+/* # of times to retry timed out/failed IOs */3838+#define MTIP_MAX_RETRIES 239394040/* Various timeout values in ms */4141#define MTIP_NCQ_COMMAND_TIMEOUT_MS 5000···114114#define __force_bit2int (unsigned int __force)115115116116/* below are bit numbers in 'flags' defined in mtip_port */117117-#define MTIP_FLAG_IC_ACTIVE_BIT 0118118-#define MTIP_FLAG_EH_ACTIVE_BIT 1119119-#define MTIP_FLAG_SVC_THD_ACTIVE_BIT 2120120-#define MTIP_FLAG_ISSUE_CMDS_BIT 4121121-#define MTIP_FLAG_REBUILD_BIT 5122122-#define MTIP_FLAG_SVC_THD_SHOULD_STOP_BIT 8117117+#define MTIP_PF_IC_ACTIVE_BIT 0 /* pio/ioctl */118118+#define MTIP_PF_EH_ACTIVE_BIT 1 /* error handling */119119+#define MTIP_PF_SE_ACTIVE_BIT 2 /* secure erase */120120+#define MTIP_PF_DM_ACTIVE_BIT 3 /* download microcde */121121+#define MTIP_PF_PAUSE_IO ((1 << MTIP_PF_IC_ACTIVE_BIT) | \122122+ (1 << MTIP_PF_EH_ACTIVE_BIT) | \123123+ (1 << MTIP_PF_SE_ACTIVE_BIT) | \124124+ (1 << MTIP_PF_DM_ACTIVE_BIT))125125+126126+#define MTIP_PF_SVC_THD_ACTIVE_BIT 4127127+#define MTIP_PF_ISSUE_CMDS_BIT 5128128+#define MTIP_PF_REBUILD_BIT 6129129+#define MTIP_PF_SVC_THD_STOP_BIT 8130130+131131+/* below are bit numbers in 'dd_flag' defined in driver_data */132132+#define MTIP_DDF_REMOVE_PENDING_BIT 1133133+#define MTIP_DDF_OVER_TEMP_BIT 2134134+#define MTIP_DDF_WRITE_PROTECT_BIT 3135135+#define MTIP_DDF_STOP_IO ((1 << MTIP_DDF_REMOVE_PENDING_BIT) | \136136+ (1 << MTIP_DDF_OVER_TEMP_BIT) | \137137+ (1 << MTIP_DDF_WRITE_PROTECT_BIT))138138+139139+#define MTIP_DDF_CLEANUP_BIT 5140140+#define MTIP_DDF_RESUME_BIT 6141141+#define MTIP_DDF_INIT_DONE_BIT 7142142+#define MTIP_DDF_REBUILD_FAILED_BIT 8143143+144144+__packed struct smart_attr{145145+ u8 attr_id;146146+ u16 flags;147147+ u8 cur;148148+ u8 worst;149149+ u32 data;150150+ u8 res[3];151151+};123152124153/* Register Frame Information Structure (FIS), host to device. */125154struct host_to_dev_fis {···374345 * when the command slot and all associated data structures375346 * are no longer needed.376347 */348348+ u16 *log_buf;349349+ dma_addr_t log_buf_dma;350350+351351+ u8 *smart_buf;352352+ dma_addr_t smart_buf_dma;353353+377354 unsigned long allocated[SLOTBITS_IN_LONGS];378355 /*379356 * used to queue commands when an internal command is in progress···403368 * Timer used to complete commands that have been active for too long.404369 */405370 struct timer_list cmd_timer;371371+ unsigned long ic_pause_timer;406372 /*407373 * Semaphore used to block threads if there are no408374 * command slots available.···440404441405 unsigned slot_groups; /* number of slot groups the product supports */442406443443- atomic_t drv_cleanup_done; /* Atomic variable for SRSI */444444-445407 unsigned long index; /* Index to determine the disk name */446408447447- unsigned int ftlrebuildflag; /* FTL rebuild flag */448448-449449- atomic_t resumeflag; /* Atomic variable to track suspend/resume */409409+ unsigned long dd_flag; /* NOTE: use atomic bit operations on this */450410451411 struct task_struct *mtip_svc_handler; /* task_struct of svc thd */452412};
+30-12
drivers/block/virtio_blk.c
···351351 cap_str_10, cap_str_2);352352353353 set_capacity(vblk->disk, capacity);354354+ revalidate_disk(vblk->disk);354355done:355356 mutex_unlock(&vblk->config_lock);356357}···373372 err = PTR_ERR(vblk->vq);374373375374 return err;375375+}376376+377377+/*378378+ * Legacy naming scheme used for virtio devices. We are stuck with it for379379+ * virtio blk but don't ever use it for any new driver.380380+ */381381+static int virtblk_name_format(char *prefix, int index, char *buf, int buflen)382382+{383383+ const int base = 'z' - 'a' + 1;384384+ char *begin = buf + strlen(prefix);385385+ char *end = buf + buflen;386386+ char *p;387387+ int unit;388388+389389+ p = end - 1;390390+ *p = '\0';391391+ unit = base;392392+ do {393393+ if (p == begin)394394+ return -EINVAL;395395+ *--p = 'a' + (index % unit);396396+ index = (index / unit) - 1;397397+ } while (index >= 0);398398+399399+ memmove(begin, p, end - p);400400+ memcpy(buf, prefix, strlen(prefix));401401+402402+ return 0;376403}377404378405static int __devinit virtblk_probe(struct virtio_device *vdev)···471442472443 q->queuedata = vblk;473444474474- if (index < 26) {475475- sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26);476476- } else if (index < (26 + 1) * 26) {477477- sprintf(vblk->disk->disk_name, "vd%c%c",478478- 'a' + index / 26 - 1, 'a' + index % 26);479479- } else {480480- const unsigned int m1 = (index / 26 - 1) / 26 - 1;481481- const unsigned int m2 = (index / 26 - 1) % 26;482482- const unsigned int m3 = index % 26;483483- sprintf(vblk->disk->disk_name, "vd%c%c%c",484484- 'a' + m1, 'a' + m2, 'a' + m3);485485- }445445+ virtblk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN);486446487447 vblk->disk->major = major;488448 vblk->disk->first_minor = index_to_minor(index);
+13-37
drivers/block/xen-blkback/blkback.c
···321321static void xen_blkbk_unmap(struct pending_req *req)322322{323323 struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST];324324+ struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST];324325 unsigned int i, invcount = 0;325326 grant_handle_t handle;326327 int ret;···333332 gnttab_set_unmap_op(&unmap[invcount], vaddr(req, i),334333 GNTMAP_host_map, handle);335334 pending_handle(req, i) = BLKBACK_INVALID_HANDLE;335335+ pages[invcount] = virt_to_page(vaddr(req, i));336336 invcount++;337337 }338338339339- ret = HYPERVISOR_grant_table_op(340340- GNTTABOP_unmap_grant_ref, unmap, invcount);339339+ ret = gnttab_unmap_refs(unmap, pages, invcount, false);341340 BUG_ON(ret);342342- /*343343- * Note, we use invcount, so nr->pages, so we can't index344344- * using vaddr(req, i).345345- */346346- for (i = 0; i < invcount; i++) {347347- ret = m2p_remove_override(348348- virt_to_page(unmap[i].host_addr), false);349349- if (ret) {350350- pr_alert(DRV_PFX "Failed to remove M2P override for %lx\n",351351- (unsigned long)unmap[i].host_addr);352352- continue;353353- }354354- }355341}356342357343static int xen_blkbk_map(struct blkif_request *req,···366378 pending_req->blkif->domid);367379 }368380369369- ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, map, nseg);381381+ ret = gnttab_map_refs(map, NULL, &blkbk->pending_page(pending_req, 0), nseg);370382 BUG_ON(ret);371383372384 /*···386398 if (ret)387399 continue;388400389389- ret = m2p_add_override(PFN_DOWN(map[i].dev_bus_addr),390390- blkbk->pending_page(pending_req, i), NULL);391391- if (ret) {392392- pr_alert(DRV_PFX "Failed to install M2P override for %lx (ret: %d)\n",393393- (unsigned long)map[i].dev_bus_addr, ret);394394- /* We could switch over to GNTTABOP_copy */395395- continue;396396- }397397-398401 seg[i].buf = map[i].dev_bus_addr |399402 (req->u.rw.seg[i].first_sect << 9);400403 }···398419 int err = 0;399420 int status = BLKIF_RSP_OKAY;400421 struct block_device *bdev = blkif->vbd.bdev;422422+ unsigned long secure;401423402424 blkif->st_ds_req++;403425404426 xen_blkif_get(blkif);405405- if (blkif->blk_backend_type == BLKIF_BACKEND_PHY ||406406- blkif->blk_backend_type == BLKIF_BACKEND_FILE) {407407- unsigned long secure = (blkif->vbd.discard_secure &&408408- (req->u.discard.flag & BLKIF_DISCARD_SECURE)) ?409409- BLKDEV_DISCARD_SECURE : 0;410410- err = blkdev_issue_discard(bdev,411411- req->u.discard.sector_number,412412- req->u.discard.nr_sectors,413413- GFP_KERNEL, secure);414414- } else415415- err = -EOPNOTSUPP;427427+ secure = (blkif->vbd.discard_secure &&428428+ (req->u.discard.flag & BLKIF_DISCARD_SECURE)) ?429429+ BLKDEV_DISCARD_SECURE : 0;430430+431431+ err = blkdev_issue_discard(bdev, req->u.discard.sector_number,432432+ req->u.discard.nr_sectors,433433+ GFP_KERNEL, secure);416434417435 if (err == -EOPNOTSUPP) {418436 pr_debug(DRV_PFX "discard op failed, not supported\n");···806830 int i, mmap_pages;807831 int rc = 0;808832809809- if (!xen_pv_domain())833833+ if (!xen_domain())810834 return -ENODEV;811835812836 blkbk = kzalloc(sizeof(struct xen_blkbk), GFP_KERNEL);
-6
drivers/block/xen-blkback/common.h
···146146 BLKIF_PROTOCOL_X86_64 = 3,147147};148148149149-enum blkif_backend_type {150150- BLKIF_BACKEND_PHY = 1,151151- BLKIF_BACKEND_FILE = 2,152152-};153153-154149struct xen_vbd {155150 /* What the domain refers to this vbd as. */156151 blkif_vdev_t handle;···172177 unsigned int irq;173178 /* Comms information. */174179 enum blkif_protocol blk_protocol;175175- enum blkif_backend_type blk_backend_type;176180 union blkif_back_rings blk_rings;177181 void *blk_ring;178182 /* The VBD attached to this interface. */
···430430431431config GPIO_SODAVILLE432432 bool "Intel Sodaville GPIO support"433433- depends on X86 && PCI && OF && BROKEN433433+ depends on X86 && PCI && OF434434 select GPIO_GENERIC435435 select GENERIC_IRQ_CHIP436436 help
+1-1
drivers/gpio/gpio-adp5588.c
···252252 if (ret < 0)253253 memset(dev->irq_stat, 0, ARRAY_SIZE(dev->irq_stat));254254255255- for (bank = 0; bank <= ADP5588_BANK(ADP5588_MAXGPIO);255255+ for (bank = 0, bit = 0; bank <= ADP5588_BANK(ADP5588_MAXGPIO);256256 bank++, bit = 0) {257257 pending = dev->irq_stat[bank] & dev->irq_mask[bank];258258
···3434static int lowlevel_buffer_allocate(struct drm_device *dev,3535 unsigned int flags, struct exynos_drm_gem_buf *buf)3636{3737- dma_addr_t start_addr, end_addr;3737+ dma_addr_t start_addr;3838 unsigned int npages, page_size, i = 0;3939 struct scatterlist *sgl;4040 int ret = 0;41414242 DRM_DEBUG_KMS("%s\n", __FILE__);43434444- if (flags & EXYNOS_BO_NONCONTIG) {4444+ if (IS_NONCONTIG_BUFFER(flags)) {4545 DRM_DEBUG_KMS("not support allocation type.\n");4646 return -EINVAL;4747 }···5252 }53535454 if (buf->size >= SZ_1M) {5555- npages = (buf->size >> SECTION_SHIFT) + 1;5555+ npages = buf->size >> SECTION_SHIFT;5656 page_size = SECTION_SIZE;5757 } else if (buf->size >= SZ_64K) {5858- npages = (buf->size >> 16) + 1;5858+ npages = buf->size >> 16;5959 page_size = SZ_64K;6060 } else {6161- npages = (buf->size >> PAGE_SHIFT) + 1;6161+ npages = buf->size >> PAGE_SHIFT;6262 page_size = PAGE_SIZE;6363 }6464···7676 return -ENOMEM;7777 }78787979- buf->kvaddr = dma_alloc_writecombine(dev->dev, buf->size,8080- &buf->dma_addr, GFP_KERNEL);8181- if (!buf->kvaddr) {8282- DRM_ERROR("failed to allocate buffer.\n");8383- ret = -ENOMEM;8484- goto err1;8585- }8686-8787- start_addr = buf->dma_addr;8888- end_addr = buf->dma_addr + buf->size;8989-9090- buf->pages = kzalloc(sizeof(struct page) * npages, GFP_KERNEL);9191- if (!buf->pages) {9292- DRM_ERROR("failed to allocate pages.\n");9393- ret = -ENOMEM;9494- goto err2;9595- }9696-9797- start_addr = buf->dma_addr;9898- end_addr = buf->dma_addr + buf->size;7979+ buf->kvaddr = dma_alloc_writecombine(dev->dev, buf->size,8080+ &buf->dma_addr, GFP_KERNEL);8181+ if (!buf->kvaddr) {8282+ DRM_ERROR("failed to allocate buffer.\n");8383+ ret = -ENOMEM;8484+ goto err1;8585+ }998610087 buf->pages = kzalloc(sizeof(struct page) * npages, GFP_KERNEL);10188 if (!buf->pages) {···92105 }9310694107 sgl = buf->sgt->sgl;108108+ start_addr = buf->dma_addr;9510996110 while (i < npages) {97111 buf->pages[i] = phys_to_page(start_addr);98112 sg_set_page(sgl, buf->pages[i], page_size, 0);99113 sg_dma_address(sgl) = start_addr;100114 start_addr += page_size;101101- if (end_addr - start_addr < page_size)102102- break;103115 sgl = sg_next(sgl);104116 i++;105117 }106106-107107- buf->pages[i] = phys_to_page(start_addr);108108-109109- sgl = sg_next(sgl);110110- sg_set_page(sgl, buf->pages[i+1], end_addr - start_addr, 0);111118112119 DRM_DEBUG_KMS("vaddr(0x%lx), dma_addr(0x%lx), size(0x%lx)\n",113120 (unsigned long)buf->kvaddr,···131150 * non-continuous memory would be released by exynos132151 * gem framework.133152 */134134- if (flags & EXYNOS_BO_NONCONTIG) {153153+ if (IS_NONCONTIG_BUFFER(flags)) {135154 DRM_DEBUG_KMS("not support allocation type.\n");136155 return;137156 }
+8-6
drivers/gpu/drm/exynos/exynos_drm_core.c
···5454 *5555 * P.S. note that this driver is considered for modularization.5656 */5757- ret = subdrv->probe(dev, subdrv->manager.dev);5757+ ret = subdrv->probe(dev, subdrv->dev);5858 if (ret)5959 return ret;6060 }61616262- if (subdrv->is_local)6262+ if (!subdrv->manager)6363 return 0;64646565+ subdrv->manager->dev = subdrv->dev;6666+6567 /* create and initialize a encoder for this sub driver. */6666- encoder = exynos_drm_encoder_create(dev, &subdrv->manager,6868+ encoder = exynos_drm_encoder_create(dev, subdrv->manager,6769 (1 << MAX_CRTC) - 1);6870 if (!encoder) {6971 DRM_ERROR("failed to create encoder\n");···188186189187 list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) {190188 if (subdrv->open) {191191- ret = subdrv->open(dev, subdrv->manager.dev, file);189189+ ret = subdrv->open(dev, subdrv->dev, file);192190 if (ret)193191 goto err;194192 }···199197err:200198 list_for_each_entry_reverse(subdrv, &subdrv->list, list) {201199 if (subdrv->close)202202- subdrv->close(dev, subdrv->manager.dev, file);200200+ subdrv->close(dev, subdrv->dev, file);203201 }204202 return ret;205203}···211209212210 list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) {213211 if (subdrv->close)214214- subdrv->close(dev, subdrv->manager.dev, file);212212+ subdrv->close(dev, subdrv->dev, file);215213 }216214}217215EXPORT_SYMBOL_GPL(exynos_drm_subdrv_close);
+5-5
drivers/gpu/drm/exynos/exynos_drm_drv.h
···225225 * Exynos drm sub driver structure.226226 *227227 * @list: sub driver has its own list object to register to exynos drm driver.228228+ * @dev: pointer to device object for subdrv device driver.228229 * @drm_dev: pointer to drm_device and this pointer would be set229230 * when sub driver calls exynos_drm_subdrv_register().230230- * @is_local: appear encoder and connector disrelated device.231231+ * @manager: subdrv has its own manager to control a hardware appropriately232232+ * and we can access a hardware drawing on this manager.231233 * @probe: this callback would be called by exynos drm driver after232234 * subdrv is registered to it.233235 * @remove: this callback is used to release resources created234236 * by probe callback.235237 * @open: this would be called with drm device file open.236238 * @close: this would be called with drm device file close.237237- * @manager: subdrv has its own manager to control a hardware appropriately238238- * and we can access a hardware drawing on this manager.239239 * @encoder: encoder object owned by this sub driver.240240 * @connector: connector object owned by this sub driver.241241 */242242struct exynos_drm_subdrv {243243 struct list_head list;244244+ struct device *dev;244245 struct drm_device *drm_dev;245245- bool is_local;246246+ struct exynos_drm_manager *manager;246247247248 int (*probe)(struct drm_device *drm_dev, struct device *dev);248249 void (*remove)(struct drm_device *dev);···252251 void (*close)(struct drm_device *drm_dev, struct device *dev,253252 struct drm_file *file);254253255255- struct exynos_drm_manager manager;256254 struct drm_encoder *encoder;257255 struct drm_connector *connector;258256};
···22452245}2246224622472247static int22482248+intel_finish_fb(struct drm_framebuffer *old_fb)22492249+{22502250+ struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj;22512251+ struct drm_i915_private *dev_priv = obj->base.dev->dev_private;22522252+ bool was_interruptible = dev_priv->mm.interruptible;22532253+ int ret;22542254+22552255+ wait_event(dev_priv->pending_flip_queue,22562256+ atomic_read(&dev_priv->mm.wedged) ||22572257+ atomic_read(&obj->pending_flip) == 0);22582258+22592259+ /* Big Hammer, we also need to ensure that any pending22602260+ * MI_WAIT_FOR_EVENT inside a user batch buffer on the22612261+ * current scanout is retired before unpinning the old22622262+ * framebuffer.22632263+ *22642264+ * This should only fail upon a hung GPU, in which case we22652265+ * can safely continue.22662266+ */22672267+ dev_priv->mm.interruptible = false;22682268+ ret = i915_gem_object_finish_gpu(obj);22692269+ dev_priv->mm.interruptible = was_interruptible;22702270+22712271+ return ret;22722272+}22732273+22742274+static int22482275intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,22492276 struct drm_framebuffer *old_fb)22502277{···23092282 return ret;23102283 }2311228423122312- if (old_fb) {23132313- struct drm_i915_private *dev_priv = dev->dev_private;23142314- struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj;23152315-23162316- wait_event(dev_priv->pending_flip_queue,23172317- atomic_read(&dev_priv->mm.wedged) ||23182318- atomic_read(&obj->pending_flip) == 0);23192319-23202320- /* Big Hammer, we also need to ensure that any pending23212321- * MI_WAIT_FOR_EVENT inside a user batch buffer on the23222322- * current scanout is retired before unpinning the old23232323- * framebuffer.23242324- *23252325- * This should only fail upon a hung GPU, in which case we23262326- * can safely continue.23272327- */23282328- ret = i915_gem_object_finish_gpu(obj);23292329- (void) ret;23302330- }22852285+ if (old_fb)22862286+ intel_finish_fb(old_fb);2331228723322288 ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y,23332289 LEAVE_ATOMIC_MODE_SET);···33813371 struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;33823372 struct drm_device *dev = crtc->dev;3383337333743374+ /* Flush any pending WAITs before we disable the pipe. Note that33753375+ * we need to drop the struct_mutex in order to acquire it again33763376+ * during the lowlevel dpms routines around a couple of the33773377+ * operations. It does not look trivial nor desirable to move33783378+ * that locking higher. So instead we leave a window for the33793379+ * submission of further commands on the fb before we can actually33803380+ * disable it. This race with userspace exists anyway, and we can33813381+ * only rely on the pipe being disabled by userspace after it33823382+ * receives the hotplug notification and has flushed any pending33833383+ * batches.33843384+ */33853385+ if (crtc->fb) {33863386+ mutex_lock(&dev->struct_mutex);33873387+ intel_finish_fb(crtc->fb);33883388+ mutex_unlock(&dev->struct_mutex);33893389+ }33903390+33843391 crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF);33853392 assert_plane_disabled(dev->dev_private, to_intel_crtc(crtc)->plane);33863393 assert_pipe_disabled(dev->dev_private, to_intel_crtc(crtc)->pipe);···34783451 return false;34793452 }3480345334813481- /* All interlaced capable intel hw wants timings in frames. */34823482- drm_mode_set_crtcinfo(adjusted_mode, 0);34543454+ /* All interlaced capable intel hw wants timings in frames. Note though34553455+ * that intel_lvds_mode_fixup does some funny tricks with the crtc34563456+ * timings, so we need to be careful not to clobber these.*/34573457+ if (!(adjusted_mode->private_flags & INTEL_MODE_CRTC_TIMINGS_SET))34583458+ drm_mode_set_crtcinfo(adjusted_mode, 0);3483345934843460 return true;34853461}···74687438 OUT_RING(fb->pitches[0] | obj->tiling_mode);74697439 OUT_RING(obj->gtt_offset);7470744074717471- pf = I915_READ(PF_CTL(intel_crtc->pipe)) & PF_ENABLE;74417441+ /* Contrary to the suggestions in the documentation,74427442+ * "Enable Panel Fitter" does not seem to be required when page74437443+ * flipping with a non-native mode, and worse causes a normal74447444+ * modeset to fail.74457445+ * pf = I915_READ(PF_CTL(intel_crtc->pipe)) & PF_ENABLE;74467446+ */74477447+ pf = 0;74727448 pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff;74737449 OUT_RING(pf | pipesrc);74747450 ADVANCE_LP_RING();···85648528 I915_WRITE(WM3_LP_ILK, 0);85658529 I915_WRITE(WM2_LP_ILK, 0);85668530 I915_WRITE(WM1_LP_ILK, 0);85318531+85328532+ I915_WRITE(GEN6_UCGCTL1,85338533+ I915_READ(GEN6_UCGCTL1) |85348534+ GEN6_BLBUNIT_CLOCK_GATE_DISABLE);8567853585688536 /* According to the BSpec vol1g, bit 12 (RCPBUNIT) clock85698537 * gating disable must be set. Failure to set it results in
+35-14
drivers/gpu/drm/i915/intel_dp.c
···219219 return (max_link_clock * max_lanes * 8) / 10;220220}221221222222+static bool223223+intel_dp_adjust_dithering(struct intel_dp *intel_dp,224224+ struct drm_display_mode *mode,225225+ struct drm_display_mode *adjusted_mode)226226+{227227+ int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp));228228+ int max_lanes = intel_dp_max_lane_count(intel_dp);229229+ int max_rate, mode_rate;230230+231231+ mode_rate = intel_dp_link_required(mode->clock, 24);232232+ max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);233233+234234+ if (mode_rate > max_rate) {235235+ mode_rate = intel_dp_link_required(mode->clock, 18);236236+ if (mode_rate > max_rate)237237+ return false;238238+239239+ if (adjusted_mode)240240+ adjusted_mode->private_flags241241+ |= INTEL_MODE_DP_FORCE_6BPC;242242+243243+ return true;244244+ }245245+246246+ return true;247247+}248248+222249static int223250intel_dp_mode_valid(struct drm_connector *connector,224251 struct drm_display_mode *mode)225252{226253 struct intel_dp *intel_dp = intel_attached_dp(connector);227227- int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp));228228- int max_lanes = intel_dp_max_lane_count(intel_dp);229229- int max_rate, mode_rate;230254231255 if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) {232256 if (mode->hdisplay > intel_dp->panel_fixed_mode->hdisplay)···260236 return MODE_PANEL;261237 }262238263263- mode_rate = intel_dp_link_required(mode->clock, 24);264264- max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);265265-266266- if (mode_rate > max_rate) {267267- mode_rate = intel_dp_link_required(mode->clock, 18);268268- if (mode_rate > max_rate)269269- return MODE_CLOCK_HIGH;270270- else271271- mode->private_flags |= INTEL_MODE_DP_FORCE_6BPC;272272- }239239+ if (!intel_dp_adjust_dithering(intel_dp, mode, NULL))240240+ return MODE_CLOCK_HIGH;273241274242 if (mode->clock < 10000)275243 return MODE_CLOCK_LOW;···688672 int lane_count, clock;689673 int max_lane_count = intel_dp_max_lane_count(intel_dp);690674 int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0;691691- int bpp = mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24;675675+ int bpp;692676 static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 };693677694678 if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) {···701685 */702686 mode->clock = intel_dp->panel_fixed_mode->clock;703687 }688688+689689+ if (!intel_dp_adjust_dithering(intel_dp, mode, adjusted_mode))690690+ return false;691691+692692+ bpp = adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24;704693705694 for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) {706695 for (clock = 0; clock <= max_clock; clock++) {
+4
drivers/gpu/drm/i915/intel_drv.h
···105105#define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0)106106#define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT)107107#define INTEL_MODE_DP_FORCE_6BPC (0x10)108108+/* This flag must be set by the encoder's mode_fixup if it changes the crtc109109+ * timings in the mode to prevent the crtc fixup from overwriting them.110110+ * Currently only lvds needs that. */111111+#define INTEL_MODE_CRTC_TIMINGS_SET (0x20)108112109113static inline void110114intel_mode_set_pixel_multiplier(struct drm_display_mode *mode,
+4
drivers/gpu/drm/i915/intel_fb.c
···279279 struct drm_mode_config *config = &dev->mode_config;280280 struct drm_plane *plane;281281282282+ mutex_lock(&dev->mode_config.mutex);283283+282284 ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper);283285 if (ret)284286 DRM_DEBUG("failed to restore crtc mode\n");···288286 /* Be sure to shut off any planes that may be active */289287 list_for_each_entry(plane, &config->plane_list, head)290288 plane->funcs->disable_plane(plane);289289+290290+ mutex_unlock(&dev->mode_config.mutex);291291}
+1-1
drivers/gpu/drm/i915/intel_i2c.c
···390390 bus->has_gpio = intel_gpio_setup(bus, i);391391392392 /* XXX force bit banging until GMBUS is fully debugged */393393- if (bus->has_gpio && IS_GEN2(dev))393393+ if (bus->has_gpio)394394 bus->force_bit = true;395395 }396396
···4747 adjusted_mode->vtotal = fixed_mode->vtotal;48484949 adjusted_mode->clock = fixed_mode->clock;5050-5151- drm_mode_set_crtcinfo(adjusted_mode, 0);5250}53515452/* adjusted_mode has been preset to be the panel's fixed mode */
+1-1
drivers/gpu/drm/i915/intel_ringbuffer.c
···10381038 * of the buffer.10391039 */10401040 ring->effective_size = ring->size;10411041- if (IS_I830(ring->dev))10411041+ if (IS_I830(ring->dev) || IS_845G(ring->dev))10421042 ring->effective_size -= 128;1043104310441044 return 0;
-1
drivers/gpu/drm/i915/intel_sprite.c
···9595 /* must disable */9696 sprctl |= SPRITE_TRICKLE_FEED_DISABLE;9797 sprctl |= SPRITE_ENABLE;9898- sprctl |= SPRITE_DEST_KEY;999810099 /* Sizes are 0 based */101100 src_w--;
···230230 if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev))231231 return;232232233233+ /* some R4xx chips have the wrong frev */234234+ if (rdev->family <= CHIP_RV410)235235+ frev = 1;236236+233237 switch (frev) {234238 case 1:235239 switch (crev) {
+1-1
drivers/gpu/drm/radeon/r100.c
···25532553 * or the chip could hang on a subsequent access25542554 */25552555 if (rdev->pll_errata & CHIP_ERRATA_PLL_DELAY) {25562556- udelay(5000);25562556+ mdelay(5);25572557 }2558255825592559 /* This function is required to workaround a hardware bug in some (all?)
···970970971971 encoder = obj_to_encoder(obj);972972973973- if (encoder->encoder_type != DRM_MODE_ENCODER_DAC ||973973+ if (encoder->encoder_type != DRM_MODE_ENCODER_DAC &&974974 encoder->encoder_type != DRM_MODE_ENCODER_TVDAC)975975 continue;976976···10001000 * cases the DVI port is actually a virtual KVM port connected to the service10011001 * processor.10021002 */10031003+out:10031004 if ((!rdev->is_atom_bios) &&10041005 (ret == connector_status_disconnected) &&10051006 rdev->mode_info.bios_hardcoded_edid_size) {···10081007 ret = connector_status_connected;10091008 }1010100910111011-out:10121010 /* updated in get modes as well since we need to know if it's analog or digital */10131011 radeon_connector_update_scratch_regs(connector, ret);10141012 return ret;
+4
drivers/gpu/drm/radeon/radeon_i2c.c
···900900 struct radeon_i2c_chan *i2c;901901 int ret;902902903903+ /* don't add the mm_i2c bus unless hw_i2c is enabled */904904+ if (rec->mm_i2c && (radeon_hw_i2c == 0))905905+ return NULL;906906+903907 i2c = kzalloc(sizeof(struct radeon_i2c_chan), GFP_KERNEL);904908 if (i2c == NULL)905909 return NULL;
+6
drivers/gpu/drm/radeon/radeon_irq_kms.c
···147147 (rdev->pdev->subsystem_device == 0x01fd))148148 return true;149149150150+ /* RV515 seems to have MSI issues where it loses151151+ * MSI rearms occasionally. This leads to lockups and freezes.152152+ * disable it by default.153153+ */154154+ if (rdev->family == CHIP_RV515)155155+ return false;150156 if (rdev->flags & RADEON_IS_IGP) {151157 /* APUs work fine with MSIs */152158 if (rdev->family >= CHIP_PALM)
···179179{180180 struct ib_port_attr attr;181181 char *speed = "";182182- int rate = -1; /* in deci-Gb/sec */182182+ int rate; /* in deci-Gb/sec */183183 ssize_t ret;184184185185 ret = ib_query_port(p->ibdev, p->port_num, &attr);···187187 return ret;188188189189 switch (attr.active_speed) {190190- case IB_SPEED_SDR:191191- rate = 25;192192- break;193190 case IB_SPEED_DDR:194191 speed = " DDR";195192 rate = 50;···206209 case IB_SPEED_EDR:207210 speed = " EDR";208211 rate = 250;212212+ break;213213+ case IB_SPEED_SDR:214214+ default: /* default to SDR for invalid rates */215215+ rate = 25;209216 break;210217 }211218
+5
drivers/infiniband/hw/mlx4/main.c
···253253 if (out_mad->data[15] & 0x1)254254 props->active_speed = IB_SPEED_FDR10;255255 }256256+257257+ /* Avoid wrong speed value returned by FW if the IB link is down. */258258+ if (props->state == IB_PORT_DOWN)259259+ props->active_speed = IB_SPEED_SDR;260260+256261out:257262 kfree(in_mad);258263 kfree(out_mad);
···486486 unsigned char *packet = psmouse->packet;487487488488 input_report_key(dev, BTN_LEFT, packet[0] & 0x01);489489- input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);490489 input_mt_report_pointer_emulation(dev, true);491490 input_sync(dev);492491}···966967 if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width))967968 return -1;968969970970+ __set_bit(INPUT_PROP_POINTER, dev->propbit);969971 __set_bit(EV_KEY, dev->evbit);970972 __set_bit(EV_ABS, dev->evbit);971973 __clear_bit(EV_REL, dev->evbit);···10171017 */10181018 psmouse_warn(psmouse, "couldn't query resolution data.\n");10191019 }10201020-10201020+ /* v4 is clickpad, with only one button. */10211021+ __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);10221022+ __clear_bit(BTN_RIGHT, dev->keybit);10211023 __set_bit(BTN_TOOL_QUADTAP, dev->keybit);10221024 /* For X to recognize me as touchpad. */10231025 input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0);···12471245 */12481246static int elantech_reconnect(struct psmouse *psmouse)12491247{12481248+ psmouse_reset(psmouse);12491249+12501250 if (elantech_detect(psmouse, 0))12511251 return -1;12521252···13271323 psmouse->private = etd = kzalloc(sizeof(struct elantech_data), GFP_KERNEL);13281324 if (!etd)13291325 return -ENOMEM;13261326+13271327+ psmouse_reset(psmouse);1330132813311329 etd->parity[0] = 1;13321330 for (i = 1; i < 256; i++)
+1-1
drivers/input/mouse/gpio_mouse.c
···1212#include <linux/module.h>1313#include <linux/platform_device.h>1414#include <linux/input-polldev.h>1515+#include <linux/gpio.h>1516#include <linux/gpio_mouse.h>16171717-#include <asm/gpio.h>18181919/*2020 * Timer function which is run every scan_ms ms when the device is opened.
+8
drivers/input/mouse/sentelic.c
···741741 }742742 } else {743743 /* SFAC packet */744744+ if ((packet[0] & (FSP_PB0_LBTN|FSP_PB0_PHY_BTN)) ==745745+ FSP_PB0_LBTN) {746746+ /* On-pad click in SFAC mode should be handled747747+ * by userspace. On-pad clicks in MFMC mode748748+ * are real clickpad clicks, and not ignored.749749+ */750750+ packet[0] &= ~FSP_PB0_LBTN;751751+ }744752745753 /* no multi-finger information */746754 ad->last_mt_fgr = 0;
···176176 struct cardstate *cs = tty->driver_data;177177178178 if (!cs) { /* happens if we didn't find cs in open */179179- printk(KERN_DEBUG "%s: no cardstate\n", __func__);179179+ gig_dbg(DEBUG_IF, "%s: no cardstate", __func__);180180 return;181181 }182182
···17121712 struct r1conf *conf = mddev->private;17131713 int primary;17141714 int i;17151715+ int vcnt;1715171617161717 for (primary = 0; primary < conf->raid_disks * 2; primary++)17171718 if (r1_bio->bios[primary]->bi_end_io == end_sync_read &&···17221721 break;17231722 }17241723 r1_bio->read_disk = primary;17241724+ vcnt = (r1_bio->sectors + PAGE_SIZE / 512 - 1) >> (PAGE_SHIFT - 9);17251725 for (i = 0; i < conf->raid_disks * 2; i++) {17261726 int j;17271727- int vcnt = r1_bio->sectors >> (PAGE_SHIFT- 9);17281727 struct bio *pbio = r1_bio->bios[primary];17291728 struct bio *sbio = r1_bio->bios[i];17301729 int size;
+2-2
drivers/md/raid10.c
···17881788 struct r10conf *conf = mddev->private;17891789 int i, first;17901790 struct bio *tbio, *fbio;17911791+ int vcnt;1791179217921793 atomic_set(&r10_bio->remaining, 1);17931794···18031802 first = i;18041803 fbio = r10_bio->devs[i].bio;1805180418051805+ vcnt = (r10_bio->sectors + (PAGE_SIZE >> 9) - 1) >> (PAGE_SHIFT - 9);18061806 /* now find blocks with errors */18071807 for (i=0 ; i < conf->copies ; i++) {18081808 int j, d;18091809- int vcnt = r10_bio->sectors >> (PAGE_SHIFT-9);1810180918111810 tbio = r10_bio->devs[i].bio;18121811···18721871 */18731872 for (i = 0; i < conf->copies; i++) {18741873 int j, d;18751875- int vcnt = r10_bio->sectors >> (PAGE_SHIFT-9);1876187418771875 tbio = r10_bio->devs[i].repl_bio;18781876 if (!tbio || !tbio->bi_end_io)
+11-1
drivers/media/dvb/dvb-core/dvb_frontend.c
···143143static void dvb_frontend_wakeup(struct dvb_frontend *fe);144144static int dtv_get_frontend(struct dvb_frontend *fe,145145 struct dvb_frontend_parameters *p_out);146146+static int dtv_property_legacy_params_sync(struct dvb_frontend *fe,147147+ struct dvb_frontend_parameters *p);146148147149static bool has_get_frontend(struct dvb_frontend *fe)148150{149149- return fe->ops.get_frontend;151151+ return fe->ops.get_frontend != NULL;150152}151153152154/*···699697 fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN;700698 fepriv->delay = HZ / 2;701699 }700700+ dtv_property_legacy_params_sync(fe, &fepriv->parameters_out);702701 fe->ops.read_status(fe, &s);703702 if (s != fepriv->status) {704703 dvb_frontend_add_event(fe, s); /* update event list */···1834183118351832 if (dvb_frontend_check_parameters(fe) < 0)18361833 return -EINVAL;18341834+18351835+ /*18361836+ * Initialize output parameters to match the values given by18371837+ * the user. FE_SET_FRONTEND triggers an initial frontend event18381838+ * with status = 0, which copies output parameters to userspace.18391839+ */18401840+ dtv_property_legacy_params_sync(fe, &fepriv->parameters_out);1837184118381842 /*18391843 * Be sure that the bandwidth will be filled for all
+40-14
drivers/media/dvb/dvb-usb/it913x.c
···238238239239static u32 it913x_query(struct usb_device *udev, u8 pro)240240{241241- int ret;241241+ int ret, i;242242 u8 data[4];243243- ret = it913x_io(udev, READ_LONG, pro, CMD_DEMOD_READ,244244- 0x1222, 0, &data[0], 3);243243+ u8 ver;245244246246- it913x_config.chip_ver = data[0];245245+ for (i = 0; i < 5; i++) {246246+ ret = it913x_io(udev, READ_LONG, pro, CMD_DEMOD_READ,247247+ 0x1222, 0, &data[0], 3);248248+ ver = data[0];249249+ if (ver > 0 && ver < 3)250250+ break;251251+ msleep(100);252252+ }253253+254254+ if (ver < 1 || ver > 2) {255255+ info("Failed to identify chip version applying 1");256256+ it913x_config.chip_ver = 0x1;257257+ it913x_config.chip_type = 0x9135;258258+ return 0;259259+ }260260+261261+ it913x_config.chip_ver = ver;247262 it913x_config.chip_type = (u16)(data[2] << 8) + data[1];248263249264 info("Chip Version=%02x Chip Type=%04x", it913x_config.chip_ver,···675660 if ((packet_size > min_pkt) || (i == fw->size)) {676661 fw_data = (u8 *)(fw->data + pos);677662 pos += packet_size;678678- if (packet_size > 0)679679- ret |= it913x_io(udev, WRITE_DATA,663663+ if (packet_size > 0) {664664+ ret = it913x_io(udev, WRITE_DATA,680665 DEV_0, CMD_SCATTER_WRITE, 0,681666 0, fw_data, packet_size);667667+ if (ret < 0)668668+ break;669669+ }682670 udelay(1000);683671 }684672 }685673 i++;686674 }687675688688- ret |= it913x_io(udev, WRITE_CMD, DEV_0, CMD_BOOT, 0, 0, NULL, 0);689689-690690- msleep(100);691691-692676 if (ret < 0)693693- info("FRM Firmware Download Failed (%04x)" , ret);677677+ info("FRM Firmware Download Failed (%d)" , ret);694678 else695679 info("FRM Firmware Download Completed - Resetting Device");696680697697- ret |= it913x_return_status(udev);681681+ msleep(30);682682+683683+ ret = it913x_io(udev, WRITE_CMD, DEV_0, CMD_BOOT, 0, 0, NULL, 0);684684+ if (ret < 0)685685+ info("FRM Device not responding to reboot");686686+687687+ ret = it913x_return_status(udev);688688+ if (ret == 0) {689689+ info("FRM Failed to reboot device");690690+ return -ENODEV;691691+ }698692699693 msleep(30);700694701701- ret |= it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_400);695695+ ret = it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_400);696696+697697+ msleep(30);702698703699 /* Tuner function */704700 if (it913x_config.dual_mode)···927901928902MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>");929903MODULE_DESCRIPTION("it913x USB 2 Driver");930930-MODULE_VERSION("1.27");904904+MODULE_VERSION("1.28");931905MODULE_LICENSE("GPL");
···6767#define QOS_QUEUE_NUM 46868#define RTL_MAC80211_NUM_QUEUE 56969#define REALTEK_USB_VENQT_MAX_BUF_SIZE 2547070-7070+#define RTL_USB_MAX_RX_COUNT 1007171#define QBSS_LOAD_SIZE 57272#define MAX_WMMELE_LENGTH 647373···16281628 and was used to indicate status of16291629 interface or hardware */16301630 unsigned long status;16311631+16321632+ /* data buffer pointer for USB reads */16331633+ __le32 *usb_data;16341634+ int usb_data_index;1631163516321636 /*This must be the last item so16331637 that it points to the data allocated
+1-1
drivers/of/gpio.c
···140140 if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells))141141 return -EINVAL;142142143143- if (gpiospec->args[0] > gc->ngpio)143143+ if (gpiospec->args[0] >= gc->ngpio)144144 return -EINVAL;145145146146 if (flags)
+49-22
drivers/pci/pci.c
···967967 return 0;968968}969969970970+static void pci_restore_config_dword(struct pci_dev *pdev, int offset,971971+ u32 saved_val, int retry)972972+{973973+ u32 val;974974+975975+ pci_read_config_dword(pdev, offset, &val);976976+ if (val == saved_val)977977+ return;978978+979979+ for (;;) {980980+ dev_dbg(&pdev->dev, "restoring config space at offset "981981+ "%#x (was %#x, writing %#x)\n", offset, val, saved_val);982982+ pci_write_config_dword(pdev, offset, saved_val);983983+ if (retry-- <= 0)984984+ return;985985+986986+ pci_read_config_dword(pdev, offset, &val);987987+ if (val == saved_val)988988+ return;989989+990990+ mdelay(1);991991+ }992992+}993993+994994+static void pci_restore_config_space_range(struct pci_dev *pdev,995995+ int start, int end, int retry)996996+{997997+ int index;998998+999999+ for (index = end; index >= start; index--)10001000+ pci_restore_config_dword(pdev, 4 * index,10011001+ pdev->saved_config_space[index],10021002+ retry);10031003+}10041004+10051005+static void pci_restore_config_space(struct pci_dev *pdev)10061006+{10071007+ if (pdev->hdr_type == PCI_HEADER_TYPE_NORMAL) {10081008+ pci_restore_config_space_range(pdev, 10, 15, 0);10091009+ /* Restore BARs before the command register. */10101010+ pci_restore_config_space_range(pdev, 4, 9, 10);10111011+ pci_restore_config_space_range(pdev, 0, 3, 0);10121012+ } else {10131013+ pci_restore_config_space_range(pdev, 0, 15, 0);10141014+ }10151015+}10161016+9701017/** 9711018 * pci_restore_state - Restore the saved state of a PCI device9721019 * @dev: - PCI device that we're dealing with9731020 */9741021void pci_restore_state(struct pci_dev *dev)9751022{976976- int i;977977- u32 val;978978- int tries;979979-9801023 if (!dev->state_saved)9811024 return;9821025···1027984 pci_restore_pcie_state(dev);1028985 pci_restore_ats_state(dev);102998610301030- /*10311031- * The Base Address register should be programmed before the command10321032- * register(s)10331033- */10341034- for (i = 15; i >= 0; i--) {10351035- pci_read_config_dword(dev, i * 4, &val);10361036- tries = 10; 10371037- while (tries && val != dev->saved_config_space[i]) {10381038- dev_dbg(&dev->dev, "restoring config "10391039- "space at offset %#x (was %#x, writing %#x)\n",10401040- i, val, (int)dev->saved_config_space[i]);10411041- pci_write_config_dword(dev,i * 4,10421042- dev->saved_config_space[i]);10431043- pci_read_config_dword(dev, i * 4, &val);10441044- mdelay(10);10451045- tries--;10461046- }10471047- }987987+ pci_restore_config_space(dev);988988+1048989 pci_restore_pcix_state(dev);1049990 pci_restore_msi_state(dev);1050991 pci_restore_iov_state(dev);
···521521/* Called when we have found a new HMC5843. */522522static void hmc5843_init_client(struct i2c_client *client)523523{524524- struct hmc5843_data *data = i2c_get_clientdata(client);524524+ struct iio_dev *indio_dev = i2c_get_clientdata(client);525525+ struct hmc5843_data *data = iio_priv(indio_dev);526526+525527 hmc5843_set_meas_conf(client, data->meas_conf);526528 hmc5843_set_rate(client, data->rate);527529 hmc5843_configure(client, data->operating_mode);
···803803static int pdev_probe(struct platform_device *device)804804{805805 DBG("%s", device->name);806806- if (platform_driver_register(&omap_dmm_driver))807807- dev_err(&device->dev, "DMM registration failed\n");808808-809806 return drm_platform_init(&omap_drm_driver, device);810807}811808···830833static int __init omap_drm_init(void)831834{832835 DBG("init");836836+ if (platform_driver_register(&omap_dmm_driver)) {837837+ /* we can continue on without DMM.. so not fatal */838838+ dev_err(NULL, "DMM registration failed\n");839839+ }833840 return platform_driver_register(&pdev);834841}835842
+3-1
drivers/staging/ozwpan/TODO
···88 - code review by USB developer community.99 - testing with as many devices as possible.10101111-Please send any patches for this driver to Chris Kelly <ckelly@ozmodevices.com>1111+Please send any patches for this driver to1212+Rupesh Gujare <rgujare@ozmodevices.com>1313+Chris Kelly <ckelly@ozmodevices.com>1214and Greg Kroah-Hartman <gregkh@linuxfoundation.org>.
+1-5
drivers/staging/ramster/Kconfig
···11-# Dependency on CONFIG_BROKEN is because there is a commit dependency22-# on a cleancache naming change to be submitted by Konrad Wilk33-# a39c00ded70339603ffe1b0ffdf3ade85bcf009a "Merge branch 'stable/cleancache.v13'44-# into linux-next. Once this commit is present, BROKEN can be removed51config RAMSTER62 bool "Cross-machine RAM capacity sharing, aka peer-to-peer tmem"77- depends on (CLEANCACHE || FRONTSWAP) && CONFIGFS_FS=y && !ZCACHE && !XVMALLOC && !HIGHMEM && BROKEN33+ depends on (CLEANCACHE || FRONTSWAP) && CONFIGFS_FS=y && !ZCACHE && !XVMALLOC && !HIGHMEM84 select LZO_COMPRESS95 select LZO_DECOMPRESS106 default n
+2-1
drivers/staging/rts_pstor/ms.c
···3498349834993499 log_blk++;3500350035013501- for (seg_no = 0; seg_no < sizeof(ms_start_idx)/2; seg_no++) {35013501+ for (seg_no = 0; seg_no < ARRAY_SIZE(ms_start_idx) - 1;35023502+ seg_no++) {35023503 if (log_blk < ms_start_idx[seg_no+1])35033504 break;35043505 }
+5
drivers/staging/rts_pstor/rtsx.c
···1000100010011001 rtsx_init_chip(dev->chip);1002100210031003+ /* set the supported max_lun and max_id for the scsi host10041004+ * NOTE: the minimal value of max_id is 1 */10051005+ host->max_id = 1;10061006+ host->max_lun = dev->chip->max_lun;10071007+10031008 /* Start up our control thread */10041009 th = kthread_run(rtsx_control_thread, dev, CR_DRIVER_NAME);10051010 if (IS_ERR(th)) {
+6-5
drivers/staging/rts_pstor/rtsx_transport.c
···335335 int sg_cnt, i, resid;336336 int err = 0;337337 long timeleft;338338+ struct scatterlist *sg_ptr;338339 u32 val = TRIG_DMA;339340340341 if ((sg == NULL) || (num_sg <= 0) || !offset || !index)···372371 sg_cnt = dma_map_sg(&(rtsx->pci->dev), sg, num_sg, dma_dir);373372374373 resid = size;375375-374374+ sg_ptr = sg;376375 chip->sgi = 0;377376 /* Usually the next entry will be @sg@ + 1, but if this sg element378377 * is part of a chained scatterlist, it could jump to the start of···380379 * the proper sg381380 */382381 for (i = 0; i < *index; i++)383383- sg = sg_next(sg);382382+ sg_ptr = sg_next(sg_ptr);384383 for (i = *index; i < sg_cnt; i++) {385384 dma_addr_t addr;386385 unsigned int len;387386 u8 option;388387389389- addr = sg_dma_address(sg);390390- len = sg_dma_len(sg);388388+ addr = sg_dma_address(sg_ptr);389389+ len = sg_dma_len(sg_ptr);391390392391 RTSX_DEBUGP("DMA addr: 0x%x, Len: 0x%x\n",393392 (unsigned int)addr, len);···416415 if (!resid)417416 break;418417419419- sg = sg_next(sg);418418+ sg_ptr = sg_next(sg_ptr);420419 }421420422421 RTSX_DEBUGP("SG table count = %d\n", chip->sgi);
···3535static int vector_num;3636static int level[PIO2_CARDS_MAX];3737static int level_num;3838-static const char *variant[PIO2_CARDS_MAX];3838+static char *variant[PIO2_CARDS_MAX];3939static int variant_num;40404141-static int loopback;4141+static bool loopback;42424343static int pio2_match(struct vme_dev *);4444static int __devinit pio2_probe(struct vme_dev *);
···15721572 do {15731573 struct uart_8250_port *up;15741574 struct uart_port *port;15751575- bool skip;1576157515771576 up = list_entry(l, struct uart_8250_port, list);15781577 port = &up->port;15791579- skip = pass_counter && up->port.flags & UPF_IIR_ONCE;1580157815811581- if (!skip && port->handle_irq(port)) {15791579+ if (port->handle_irq(port)) {15821580 handled = 1;15831581 end = NULL;15841582 } else if (end == NULL)···20352037 spin_unlock_irqrestore(&port->lock, flags);2036203820372039 /*20382038- * If the interrupt is not reasserted, setup a timer to20392039- * kick the UART on a regular basis.20402040+ * If the interrupt is not reasserted, or we otherwise20412041+ * don't trust the iir, setup a timer to kick the UART20422042+ * on a regular basis.20402043 */20412041- if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) {20442044+ if ((!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) ||20452045+ up->port.flags & UPF_BUG_THRE) {20422046 up->bugs |= UART_BUG_THRE;20432047 pr_debug("ttyS%d - using backup timer\n",20442048 serial_index(port));
···1041104110421042config SERIAL_OMAP_CONSOLE10431043 bool "Console on OMAP serial port"10441044- depends on SERIAL_OMAP10441044+ depends on SERIAL_OMAP=y10451045 select SERIAL_CORE_CONSOLE10461046 help10471047 Select this option if you would like to use omap serial port as
+2-2
drivers/tty/serial/altera_uart.c
···556556 res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);557557 if (res_mem)558558 port->mapbase = res_mem->start;559559- else if (platp->mapbase)559559+ else if (platp)560560 port->mapbase = platp->mapbase;561561 else562562 return -EINVAL;···564564 res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);565565 if (res_irq)566566 port->irq = res_irq->start;567567- else if (platp->irq)567567+ else if (platp)568568 port->irq = platp->irq;569569570570 /* Check platform data first so we can override device node data */
+4-4
drivers/tty/serial/amba-pl011.c
···19461946 goto unmap;19471947 }1948194819491949- /* Ensure interrupts from this UART are masked and cleared */19501950- writew(0, uap->port.membase + UART011_IMSC);19511951- writew(0xffff, uap->port.membase + UART011_ICR);19521952-19531949 uap->vendor = vendor;19541950 uap->lcrh_rx = vendor->lcrh_rx;19551951 uap->lcrh_tx = vendor->lcrh_tx;···19621966 uap->port.flags = UPF_BOOT_AUTOCONF;19631967 uap->port.line = i;19641968 pl011_dma_probe(uap);19691969+19701970+ /* Ensure interrupts from this UART are masked and cleared */19711971+ writew(0, uap->port.membase + UART011_IMSC);19721972+ writew(0xffff, uap->port.membase + UART011_ICR);1965197319661974 snprintf(uap->type, sizeof(uap->type), "PL011 rev%u", amba_rev(dev));19671975
···22# USB device configuration33#4455-menuconfig USB_SUPPORT66- bool "USB support"77- depends on HAS_IOMEM88- default y99- ---help---1010- This option adds core support for Universal Serial Bus (USB).1111- You will also need drivers from the following menu to make use of it.1212-135# many non-PCI SOC chips embed OHCI146config USB_ARCH_HAS_OHCI157 boolean···5462config USB_ARCH_HAS_XHCI5563 boolean5664 default PCI6565+6666+menuconfig USB_SUPPORT6767+ bool "USB support"6868+ depends on HAS_IOMEM6969+ default y7070+ ---help---7171+ This option adds core support for Universal Serial Bus (USB).7272+ You will also need drivers from the following menu to make use of it.57735874if USB_SUPPORT5975
+7-2
drivers/usb/core/driver.c
···11891189 if (status == 0) {11901190 status = usb_suspend_device(udev, msg);1191119111921192- /* Again, ignore errors during system sleep transitions */11931193- if (!PMSG_IS_AUTO(msg))11921192+ /*11931193+ * Ignore errors from non-root-hub devices during11941194+ * system sleep transitions. For the most part,11951195+ * these devices should go to low power anyway when11961196+ * the entire bus is suspended.11971197+ */11981198+ if (udev->parent && !PMSG_IS_AUTO(msg))11941199 status = 0;11951200 }11961201
+12
drivers/usb/core/hcd.c
···19781978 if (status == 0) {19791979 usb_set_device_state(rhdev, USB_STATE_SUSPENDED);19801980 hcd->state = HC_STATE_SUSPENDED;19811981+19821982+ /* Did we race with a root-hub wakeup event? */19831983+ if (rhdev->do_remote_wakeup) {19841984+ char buffer[6];19851985+19861986+ status = hcd->driver->hub_status_data(hcd, buffer);19871987+ if (status != 0) {19881988+ dev_dbg(&rhdev->dev, "suspend raced with wakeup event\n");19891989+ hcd_bus_resume(rhdev, PMSG_AUTO_RESUME);19901990+ status = -EBUSY;19911991+ }19921992+ }19811993 } else {19821994 spin_lock_irq(&hcd_root_hub_lock);19831995 if (!HCD_DEAD(hcd)) {
+16
drivers/usb/core/hub.c
···31633163 if (retval)31643164 goto fail;3165316531663166+ /*31673167+ * Some superspeed devices have finished the link training process31683168+ * and attached to a superspeed hub port, but the device descriptor31693169+ * got from those devices show they aren't superspeed devices. Warm31703170+ * reset the port attached by the devices can fix them.31713171+ */31723172+ if ((udev->speed == USB_SPEED_SUPER) &&31733173+ (le16_to_cpu(udev->descriptor.bcdUSB) < 0x0300)) {31743174+ dev_err(&udev->dev, "got a wrong device descriptor, "31753175+ "warm reset device\n");31763176+ hub_port_reset(hub, port1, udev,31773177+ HUB_BH_RESET_TIME, true);31783178+ retval = -EINVAL;31793179+ goto fail;31803180+ }31813181+31663182 if (udev->descriptor.bMaxPacketSize0 == 0xff ||31673183 udev->speed == USB_SPEED_SUPER)31683184 i = 512;
+6-5
drivers/usb/core/message.c
···308308 retval = usb_unlink_urb(io->urbs [i]);309309 if (retval != -EINPROGRESS &&310310 retval != -ENODEV &&311311- retval != -EBUSY)311311+ retval != -EBUSY &&312312+ retval != -EIDRM)312313 dev_err(&io->dev->dev,313314 "%s, unlink --> %d\n",314315 __func__, retval);···318317 }319318 spin_lock(&io->lock);320319 }321321- urb->dev = NULL;322320323321 /* on the last completion, signal usb_sg_wait() */324322 io->bytes += urb->actual_length;···524524 case -ENXIO: /* hc didn't queue this one */525525 case -EAGAIN:526526 case -ENOMEM:527527- io->urbs[i]->dev = NULL;528527 retval = 0;529528 yield();530529 break;···541542542543 /* fail any uncompleted urbs */543544 default:544544- io->urbs[i]->dev = NULL;545545 io->urbs[i]->status = retval;546546 dev_dbg(&io->dev->dev, "%s, submit --> %d\n",547547 __func__, retval);···591593 if (!io->urbs [i]->dev)592594 continue;593595 retval = usb_unlink_urb(io->urbs [i]);594594- if (retval != -EINPROGRESS && retval != -EBUSY)596596+ if (retval != -EINPROGRESS597597+ && retval != -ENODEV598598+ && retval != -EBUSY599599+ && retval != -EIDRM)595600 dev_warn(&io->dev->dev, "%s, unlink --> %d\n",596601 __func__, retval);597602 }
+12
drivers/usb/core/urb.c
···539539 * never submitted, or it was unlinked before, or the hardware is already540540 * finished with it), even if the completion handler has not yet run.541541 *542542+ * The URB must not be deallocated while this routine is running. In543543+ * particular, when a driver calls this routine, it must insure that the544544+ * completion handler cannot deallocate the URB.545545+ *542546 * Unlinking and Endpoint Queues:543547 *544548 * [The behaviors and guarantees described below do not apply to virtual···607603 * with error -EPERM. Thus even if the URB's completion handler always608604 * tries to resubmit, it will not succeed and the URB will become idle.609605 *606606+ * The URB must not be deallocated while this routine is running. In607607+ * particular, when a driver calls this routine, it must insure that the608608+ * completion handler cannot deallocate the URB.609609+ *610610 * This routine may not be used in an interrupt context (such as a bottom611611 * half or a completion handler), or when holding a spinlock, or in other612612 * situations where the caller can't schedule().···647639 * After and while the routine runs, attempts to resubmit the URB will fail648640 * with error -EPERM. Thus even if the URB's completion handler always649641 * tries to resubmit, it will not succeed and the URB will become idle.642642+ *643643+ * The URB must not be deallocated while this routine is running. In644644+ * particular, when a driver calls this routine, it must insure that the645645+ * completion handler cannot deallocate the URB.650646 *651647 * This routine may not be used in an interrupt context (such as a bottom652648 * half or a completion handler), or when holding a spinlock, or in other
···117117 the change-suspend feature turned on */118118 unsigned long suspended_ports; /* which ports are119119 suspended */120120+ unsigned long resuming_ports; /* which ports have121121+ started to resume */120122121123 /* per-HC memory pools (could be per-bus, but ...) */122124 struct dma_pool *qh_pool; /* qh per active urb */
+7-3
drivers/usb/host/pci-quirks.c
···825825 }826826 }827827828828- /* Disable any BIOS SMIs */829829- writel(XHCI_LEGACY_DISABLE_SMI,830830- base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET);828828+ val = readl(base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET);829829+ /* Mask off (turn off) any enabled SMIs */830830+ val &= XHCI_LEGACY_DISABLE_SMI;831831+ /* Mask all SMI events bits, RW1C */832832+ val |= XHCI_LEGACY_SMI_EVENTS;833833+ /* Disable any BIOS SMIs and clear all SMI events*/834834+ writel(val, base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET);831835832836 if (usb_is_intel_switchable_xhci(pdev))833837 usb_enable_xhci_ports(pdev);
+3-2
drivers/usb/host/uhci-hub.c
···196196 status = get_hub_status_data(uhci, buf);197197198198 switch (uhci->rh_state) {199199- case UHCI_RH_SUSPENDING:200199 case UHCI_RH_SUSPENDED:201200 /* if port change, ask to be resumed */202202- if (status || uhci->resuming_ports)201201+ if (status || uhci->resuming_ports) {202202+ status = 1;203203 usb_hcd_resume_root_hub(hcd);204204+ }204205 break;205206206207 case UHCI_RH_AUTO_STOPPED:
···6262/* USB Legacy Support Control and Status Register - section 7.1.2 */6363/* Add this offset, plus the value of xECP in HCCPARAMS to the base address */6464#define XHCI_LEGACY_CONTROL_OFFSET (0x04)6565-/* bits 1:2, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */6666-#define XHCI_LEGACY_DISABLE_SMI ((0x3 << 1) + (0xff << 5) + (0x7 << 17))6565+/* bits 1:3, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */6666+#define XHCI_LEGACY_DISABLE_SMI ((0x7 << 1) + (0xff << 5) + (0x7 << 17))6767+#define XHCI_LEGACY_SMI_EVENTS (0x7 << 29)67686869/* USB 2.0 xHCI 0.96 L1C capability - section 7.2.2.1.3.2 */6970#define XHCI_L1C (1 << 16)
+2-7
drivers/usb/host/xhci-mem.c
···17961796 int i;1797179717981798 /* Free the Event Ring Segment Table and the actual Event Ring */17991799- if (xhci->ir_set) {18001800- xhci_writel(xhci, 0, &xhci->ir_set->erst_size);18011801- xhci_write_64(xhci, 0, &xhci->ir_set->erst_base);18021802- xhci_write_64(xhci, 0, &xhci->ir_set->erst_dequeue);18031803- }18041799 size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries);18051800 if (xhci->erst.entries)18061801 dma_free_coherent(&pdev->dev, size,···18071812 xhci->event_ring = NULL;18081813 xhci_dbg(xhci, "Freed event ring\n");1809181418101810- xhci_write_64(xhci, 0, &xhci->op_regs->cmd_ring);18111815 if (xhci->cmd_ring)18121816 xhci_ring_free(xhci, xhci->cmd_ring);18131817 xhci->cmd_ring = NULL;···18351841 xhci->medium_streams_pool = NULL;18361842 xhci_dbg(xhci, "Freed medium stream array pool\n");1837184318381838- xhci_write_64(xhci, 0, &xhci->op_regs->dcbaa_ptr);18391844 if (xhci->dcbaa)18401845 dma_free_coherent(&pdev->dev, sizeof(*xhci->dcbaa),18411846 xhci->dcbaa, xhci->dcbaa->dma);···2452245924532460fail:24542461 xhci_warn(xhci, "Couldn't initialize memory\n");24622462+ xhci_halt(xhci);24632463+ xhci_reset(xhci);24552464 xhci_mem_cleanup(xhci);24562465 return -ENOMEM;24572466}
+3-1
drivers/usb/host/xhci-pci.c
···9595 xhci->quirks |= XHCI_RESET_ON_RESUME;9696 xhci_dbg(xhci, "QUIRK: Resetting on resume\n");9797 }9898+ if (pdev->vendor == PCI_VENDOR_ID_VIA)9999+ xhci->quirks |= XHCI_RESET_ON_RESUME;98100}99101100102/* called during probe() after chip reset completes */···328326 return pci_register_driver(&xhci_pci_driver);329327}330328331331-void __exit xhci_unregister_pci(void)329329+void xhci_unregister_pci(void)332330{333331 pci_unregister_driver(&xhci_pci_driver);334332}
···205205#define CMD_PM_INDEX (1 << 11)206206/* bits 12:31 are reserved (and should be preserved on writes). */207207208208+/* IMAN - Interrupt Management Register */209209+#define IMAN_IP (1 << 1)210210+#define IMAN_IE (1 << 0)211211+208212/* USBSTS - USB status - status bitmasks */209213/* HC not running - set to 1 when run/stop bit is cleared. */210214#define STS_HALT XHCI_STS_HALT
-5
drivers/usb/serial/bus.c
···6060 retval = -ENODEV;6161 goto exit;6262 }6363- if (port->dev_state != PORT_REGISTERING)6464- goto exit;65636664 driver = port->serial->type;6765 if (driver->port_probe) {···9597 port = to_usb_serial_port(dev);9698 if (!port)9799 return -ENODEV;9898-9999- if (port->dev_state != PORT_UNREGISTERING)100100- return retval;101100102101 device_remove_file(&port->dev, &dev_attr_port_number);103102
+20-16
drivers/usb/serial/ftdi_sio.c
···7575 unsigned long last_dtr_rts; /* saved modem control outputs */7676 struct async_icount icount;7777 wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */7878- char prev_status, diff_status; /* Used for TIOCMIWAIT */7878+ char prev_status; /* Used for TIOCMIWAIT */7979+ bool dev_gone; /* Used to abort TIOCMIWAIT */7980 char transmit_empty; /* If transmitter is empty or not */8081 struct usb_serial_port *port;8182 __u16 interface; /* FT2232C, FT2232H or FT4232H port interface···16821681 init_waitqueue_head(&priv->delta_msr_wait);1683168216841683 priv->flags = ASYNC_LOW_LATENCY;16841684+ priv->dev_gone = false;1685168516861686 if (quirk && quirk->port_probe)16871687 quirk->port_probe(priv);···1841183918421840 dbg("%s", __func__);1843184118421842+ priv->dev_gone = true;18431843+ wake_up_interruptible_all(&priv->delta_msr_wait);18441844+18441845 remove_sysfs_attrs(port);1845184618461847 kref_put(&priv->kref, ftdi_sio_priv_release);···19871982 N.B. packet may be processed more than once, but differences19881983 are only processed once. */19891984 status = packet[0] & FTDI_STATUS_B0_MASK;19901990- if (status & FTDI_RS0_CTS)19911991- priv->icount.cts++;19921992- if (status & FTDI_RS0_DSR)19931993- priv->icount.dsr++;19941994- if (status & FTDI_RS0_RI)19951995- priv->icount.rng++;19961996- if (status & FTDI_RS0_RLSD)19971997- priv->icount.dcd++;19981985 if (status != priv->prev_status) {19991999- priv->diff_status |= status ^ priv->prev_status;20002000- wake_up_interruptible(&priv->delta_msr_wait);19861986+ char diff_status = status ^ priv->prev_status;19871987+19881988+ if (diff_status & FTDI_RS0_CTS)19891989+ priv->icount.cts++;19901990+ if (diff_status & FTDI_RS0_DSR)19911991+ priv->icount.dsr++;19921992+ if (diff_status & FTDI_RS0_RI)19931993+ priv->icount.rng++;19941994+ if (diff_status & FTDI_RS0_RLSD)19951995+ priv->icount.dcd++;19961996+19971997+ wake_up_interruptible_all(&priv->delta_msr_wait);20011998 priv->prev_status = status;20021999 }20032000···24022395 */24032396 case TIOCMIWAIT:24042397 cprev = priv->icount;24052405- while (1) {23982398+ while (!priv->dev_gone) {24062399 interruptible_sleep_on(&priv->delta_msr_wait);24072400 /* see if a signal did it */24082401 if (signal_pending(current))24092402 return -ERESTARTSYS;24102403 cnow = priv->icount;24112411- if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&24122412- cnow.dcd == cprev.dcd && cnow.cts == cprev.cts)24132413- return -EIO; /* no change => error */24142404 if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||24152405 ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||24162406 ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||···24162412 }24172413 cprev = cnow;24182414 }24192419- /* not reached */24152415+ return -EIO;24202416 break;24212417 case TIOCSERGETLSR:24222418 return get_lsr_info(port, (struct serial_struct __user *)arg);
···420420 control = priv->line_control;421421 if ((cflag & CBAUD) == B0)422422 priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS);423423- else423423+ else if ((old_termios->c_cflag & CBAUD) == B0)424424 priv->line_control |= (CONTROL_DTR | CONTROL_RTS);425425 if (control != priv->line_control) {426426 control = priv->line_control;
+1
drivers/usb/serial/sierra.c
···289289 { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */290290 { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */291291 { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */292292+ { USB_DEVICE(0x1199, 0x68A2) }, /* Sierra Wireless MC7710 */292293 /* Sierra Wireless C885 */293294 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)},294295 /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */
+10-21
drivers/usb/serial/usb-serial.c
···10591059 serial->attached = 1;10601060 }1061106110621062+ /* Avoid race with tty_open and serial_install by setting the10631063+ * disconnected flag and not clearing it until all ports have been10641064+ * registered.10651065+ */10661066+ serial->disconnected = 1;10671067+10621068 if (get_free_serial(serial, num_ports, &minor) == NULL) {10631069 dev_err(&interface->dev, "No more free serial devices\n");10641070 goto probe_error;···10761070 port = serial->port[i];10771071 dev_set_name(&port->dev, "ttyUSB%d", port->number);10781072 dbg ("%s - registering %s", __func__, dev_name(&port->dev));10791079- port->dev_state = PORT_REGISTERING;10801073 device_enable_async_suspend(&port->dev);1081107410821075 retval = device_add(&port->dev);10831083- if (retval) {10761076+ if (retval)10841077 dev_err(&port->dev, "Error registering port device, "10851078 "continuing\n");10861086- port->dev_state = PORT_UNREGISTERED;10871087- } else {10881088- port->dev_state = PORT_REGISTERED;10891089- }10901079 }10801080+10811081+ serial->disconnected = 0;1091108210921083 usb_serial_console_init(debug, minor);10931084···11271124 }11281125 kill_traffic(port);11291126 cancel_work_sync(&port->work);11301130- if (port->dev_state == PORT_REGISTERED) {11311131-11321132- /* Make sure the port is bound so that the11331133- * driver's port_remove method is called.11341134- */11351135- if (!port->dev.driver) {11361136- int rc;11371137-11381138- port->dev.driver =11391139- &serial->type->driver;11401140- rc = device_bind_driver(&port->dev);11411141- }11421142- port->dev_state = PORT_UNREGISTERING;11271127+ if (device_is_registered(&port->dev))11431128 device_del(&port->dev);11441144- port->dev_state = PORT_UNREGISTERED;11451145- }11461129 }11471130 }11481131 serial->type->disconnect(serial);
+30
drivers/usb/storage/usb.c
···132132#undef COMPLIANT_DEV133133#undef USUAL_DEV134134135135+#ifdef CONFIG_LOCKDEP136136+137137+static struct lock_class_key us_interface_key[USB_MAXINTERFACES];138138+139139+static void us_set_lock_class(struct mutex *mutex,140140+ struct usb_interface *intf)141141+{142142+ struct usb_device *udev = interface_to_usbdev(intf);143143+ struct usb_host_config *config = udev->actconfig;144144+ int i;145145+146146+ for (i = 0; i < config->desc.bNumInterfaces; i++) {147147+ if (config->interface[i] == intf)148148+ break;149149+ }150150+151151+ BUG_ON(i == config->desc.bNumInterfaces);152152+153153+ lockdep_set_class(mutex, &us_interface_key[i]);154154+}155155+156156+#else157157+158158+static void us_set_lock_class(struct mutex *mutex,159159+ struct usb_interface *intf)160160+{161161+}162162+163163+#endif135164136165#ifdef CONFIG_PM /* Minimal support for suspend and resume */137166···924895 *pus = us = host_to_us(host);925896 memset(us, 0, sizeof(struct us_data));926897 mutex_init(&(us->dev_mutex));898898+ us_set_lock_class(&us->dev_mutex, intf);927899 init_completion(&us->cmnd_ready);928900 init_completion(&(us->notify));929901 init_waitqueue_head(&us->delay_wait);
+1-1
drivers/vhost/test.c
···155155156156 vhost_test_stop(n, &private);157157 vhost_test_flush(n);158158- vhost_dev_cleanup(&n->dev);158158+ vhost_dev_cleanup(&n->dev, false);159159 /* We do an extra flush before freeing memory,160160 * since jobs can re-queue themselves. */161161 vhost_test_flush(n);
+3-2
drivers/video/au1100fb.c
···499499 au1100fb_fix.mmio_start = regs_res->start;500500 au1100fb_fix.mmio_len = resource_size(regs_res);501501502502- if (!devm_request_mem_region(au1100fb_fix.mmio_start,502502+ if (!devm_request_mem_region(&dev->dev,503503+ au1100fb_fix.mmio_start,503504 au1100fb_fix.mmio_len,504505 DRIVER_NAME)) {505506 print_err("fail to lock memory region at 0x%08lx",···517516 fbdev->fb_len = fbdev->panel->xres * fbdev->panel->yres *518517 (fbdev->panel->bpp >> 3) * AU1100FB_NBR_VIDEO_BUFFERS;519518520520- fbdev->fb_mem = dmam_alloc_coherent(&dev->dev, &dev->dev,519519+ fbdev->fb_mem = dmam_alloc_coherent(&dev->dev,521520 PAGE_ALIGN(fbdev->fb_len),522521 &fbdev->fb_phys, GFP_KERNEL);523522 if (!fbdev->fb_mem) {
+1-1
drivers/video/au1200fb.c
···17241724 /* Allocate the framebuffer to the maximum screen size */17251725 fbdev->fb_len = (win->w[plane].xres * win->w[plane].yres * bpp) / 8;1726172617271727- fbdev->fb_mem = dmam_alloc_noncoherent(&dev->dev, &dev->dev,17271727+ fbdev->fb_mem = dmam_alloc_noncoherent(&dev->dev,17281728 PAGE_ALIGN(fbdev->fb_len),17291729 &fbdev->fb_phys, GFP_KERNEL);17301730 if (!fbdev->fb_mem) {
···420420 mddi_set_auto_hibernate(&mddi->client_data, 1);421421}422422423423-static int __init mddi_get_client_caps(struct mddi_info *mddi)423423+static int __devinit mddi_get_client_caps(struct mddi_info *mddi)424424{425425 int i, j;426426···622622623623static struct mddi_info mddi_info[2];624624625625-static int __init mddi_clk_setup(struct platform_device *pdev,626626- struct mddi_info *mddi,627627- unsigned long clk_rate)625625+static int __devinit mddi_clk_setup(struct platform_device *pdev,626626+ struct mddi_info *mddi,627627+ unsigned long clk_rate)628628{629629 int ret;630630
+9-2
drivers/video/uvesafb.c
···815815 par->pmi_setpal = pmi_setpal;816816 par->ypan = ypan;817817818818- if (par->pmi_setpal || par->ypan)819819- uvesafb_vbe_getpmi(task, par);818818+ if (par->pmi_setpal || par->ypan) {819819+ if (__supported_pte_mask & _PAGE_NX) {820820+ par->pmi_setpal = par->ypan = 0;821821+ printk(KERN_WARNING "uvesafb: NX protection is actively."822822+ "We have better not to use the PMI.\n");823823+ } else {824824+ uvesafb_vbe_getpmi(task, par);825825+ }826826+ }820827#else821828 /* The protected mode interface is not available on non-x86. */822829 par->pmi_setpal = par->ypan = 0;
+46-12
drivers/virtio/virtio_balloon.c
···2828#include <linux/slab.h>2929#include <linux/module.h>30303131+/*3232+ * Balloon device works in 4K page units. So each page is pointed to by3333+ * multiple balloon pages. All memory counters in this driver are in balloon3434+ * page units.3535+ */3636+#define VIRTIO_BALLOON_PAGES_PER_PAGE (PAGE_SIZE >> VIRTIO_BALLOON_PFN_SHIFT)3737+3138struct virtio_balloon3239{3340 struct virtio_device *vdev;···4942 /* Waiting for host to ack the pages we released. */5043 struct completion acked;51445252- /* The pages we've told the Host we're not using. */4545+ /* Number of balloon pages we've told the Host we're not using. */5346 unsigned int num_pages;4747+ /*4848+ * The pages we've told the Host we're not using.4949+ * Each page on this list adds VIRTIO_BALLOON_PAGES_PER_PAGE5050+ * to num_pages above.5151+ */5452 struct list_head pages;55535654 /* The array of pfns we tell the Host about. */···78667967 BUILD_BUG_ON(PAGE_SHIFT < VIRTIO_BALLOON_PFN_SHIFT);8068 /* Convert pfn from Linux page size to balloon page size. */8181- return pfn >> (PAGE_SHIFT - VIRTIO_BALLOON_PFN_SHIFT);6969+ return pfn * VIRTIO_BALLOON_PAGES_PER_PAGE;7070+}7171+7272+static struct page *balloon_pfn_to_page(u32 pfn)7373+{7474+ BUG_ON(pfn % VIRTIO_BALLOON_PAGES_PER_PAGE);7575+ return pfn_to_page(pfn / VIRTIO_BALLOON_PAGES_PER_PAGE);8276}83778478static void balloon_ack(struct virtqueue *vq)···11496 wait_for_completion(&vb->acked);11597}116989999+static void set_page_pfns(u32 pfns[], struct page *page)100100+{101101+ unsigned int i;102102+103103+ /* Set balloon pfns pointing at this page.104104+ * Note that the first pfn points at start of the page. */105105+ for (i = 0; i < VIRTIO_BALLOON_PAGES_PER_PAGE; i++)106106+ pfns[i] = page_to_balloon_pfn(page) + i;107107+}108108+117109static void fill_balloon(struct virtio_balloon *vb, size_t num)118110{119111 /* We can only do one array worth at a time. */120112 num = min(num, ARRAY_SIZE(vb->pfns));121113122122- for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) {114114+ for (vb->num_pfns = 0; vb->num_pfns < num;115115+ vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE) {123116 struct page *page = alloc_page(GFP_HIGHUSER | __GFP_NORETRY |124117 __GFP_NOMEMALLOC | __GFP_NOWARN);125118 if (!page) {···142113 msleep(200);143114 break;144115 }145145- vb->pfns[vb->num_pfns] = page_to_balloon_pfn(page);116116+ set_page_pfns(vb->pfns + vb->num_pfns, page);117117+ vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE;146118 totalram_pages--;147147- vb->num_pages++;148119 list_add(&page->lru, &vb->pages);149120 }150121···159130{160131 unsigned int i;161132162162- for (i = 0; i < num; i++) {163163- __free_page(pfn_to_page(pfns[i]));133133+ /* Find pfns pointing at start of each page, get pages and free them. */134134+ for (i = 0; i < num; i += VIRTIO_BALLOON_PAGES_PER_PAGE) {135135+ __free_page(balloon_pfn_to_page(pfns[i]));164136 totalram_pages++;165137 }166138}···173143 /* We can only do one array worth at a time. */174144 num = min(num, ARRAY_SIZE(vb->pfns));175145176176- for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) {146146+ for (vb->num_pfns = 0; vb->num_pfns < num;147147+ vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE) {177148 page = list_first_entry(&vb->pages, struct page, lru);178149 list_del(&page->lru);179179- vb->pfns[vb->num_pfns] = page_to_balloon_pfn(page);180180- vb->num_pages--;150150+ set_page_pfns(vb->pfns + vb->num_pfns, page);151151+ vb->num_pages -= VIRTIO_BALLOON_PAGES_PER_PAGE;181152 }182153183154 /*···265234266235static inline s64 towards_target(struct virtio_balloon *vb)267236{268268- u32 v;237237+ __le32 v;238238+ s64 target;239239+269240 vb->vdev->config->get(vb->vdev,270241 offsetof(struct virtio_balloon_config, num_pages),271242 &v, sizeof(v));272272- return (s64)v - vb->num_pages;243243+ target = le32_to_cpu(v);244244+ return target - vb->num_pages;273245}274246275247static void update_balloon_size(struct virtio_balloon *vb)
···529529 * allocate blocks for the tree root we can't do the fast caching since530530 * we likely hold important locks.531531 */532532- if (trans && (!trans->transaction->in_commit) &&533533- (root && root != root->fs_info->tree_root) &&534534- btrfs_test_opt(root, SPACE_CACHE)) {532532+ if (fs_info->mount_opt & BTRFS_MOUNT_SPACE_CACHE) {535533 ret = load_free_space_cache(fs_info, cache);536534537535 spin_lock(&cache->lock);···31503152/*31513153 * returns target flags in extended format or 0 if restripe for this31523154 * chunk_type is not in progress31553155+ *31563156+ * should be called with either volume_mutex or balance_lock held31533157 */31543158static u64 get_restripe_target(struct btrfs_fs_info *fs_info, u64 flags)31553159{31563160 struct btrfs_balance_control *bctl = fs_info->balance_ctl;31573161 u64 target = 0;31583158-31593159- BUG_ON(!mutex_is_locked(&fs_info->volume_mutex) &&31603160- !spin_is_locked(&fs_info->balance_lock));3161316231623163 if (!bctl)31633164 return 0;···42024205 num_bytes += div64_u64(data_used + meta_used, 50);4203420642044207 if (num_bytes * 3 > meta_used)42054205- num_bytes = div64_u64(meta_used, 3) * 2;42084208+ num_bytes = div64_u64(meta_used, 3);4206420942074210 return ALIGN(num_bytes, fs_info->extent_root->leafsize << 10);42084211}
+5-1
fs/btrfs/extent_io.c
···19371937 struct btrfs_mapping_tree *map_tree = &root->fs_info->mapping_tree;19381938 u64 start = eb->start;19391939 unsigned long i, num_pages = num_extent_pages(eb->start, eb->len);19401940- int ret;19401940+ int ret = 0;1941194119421942 for (i = 0; i < num_pages; i++) {19431943 struct page *p = extent_buffer_page(eb, i);···21802180 }2181218121822182 bio = bio_alloc(GFP_NOFS, 1);21832183+ if (!bio) {21842184+ free_io_failure(inode, failrec, 0);21852185+ return -EIO;21862186+ }21832187 bio->bi_private = state;21842188 bio->bi_end_io = failed_bio->bi_end_io;21852189 bio->bi_sector = failrec->logical >> 9;
+2-7
fs/btrfs/free-space-cache.c
···748748 u64 used = btrfs_block_group_used(&block_group->item);749749750750 /*751751- * If we're unmounting then just return, since this does a search on the752752- * normal root and not the commit root and we could deadlock.753753- */754754- if (btrfs_fs_closing(fs_info))755755- return 0;756756-757757- /*758751 * If this block group has been marked to be cleared for one reason or759752 * another then we can't trust the on disk cache, so just return.760753 */···761768 path = btrfs_alloc_path();762769 if (!path)763770 return 0;771771+ path->search_commit_root = 1;772772+ path->skip_locking = 1;764773765774 inode = lookup_free_space_inode(root, block_group, path);766775 if (IS_ERR(inode)) {
···38333833 int sub_stripes = 0;38343834 u64 stripes_per_dev = 0;38353835 u32 remaining_stripes = 0;38363836+ u32 last_stripe = 0;3836383738373838 if (map->type &38383839 (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID10)) {···38473846 stripe_nr_orig,38483847 factor,38493848 &remaining_stripes);38493849+ div_u64_rem(stripe_nr_end - 1, factor, &last_stripe);38503850+ last_stripe *= sub_stripes;38503851 }3851385238523853 for (i = 0; i < num_stripes; i++) {···38613858 BTRFS_BLOCK_GROUP_RAID10)) {38623859 bbio->stripes[i].length = stripes_per_dev *38633860 map->stripe_len;38613861+38643862 if (i / sub_stripes < remaining_stripes)38653863 bbio->stripes[i].length +=38663864 map->stripe_len;38653865+38663866+ /*38673867+ * Special for the first stripe and38683868+ * the last stripe:38693869+ *38703870+ * |-------|...|-------|38713871+ * |----------|38723872+ * off end_off38733873+ */38673874 if (i < sub_stripes)38683875 bbio->stripes[i].length -=38693876 stripe_offset;38703870- if ((i / sub_stripes + 1) %38713871- sub_stripes == remaining_stripes)38773877+38783878+ if (stripe_index >= last_stripe &&38793879+ stripe_index <= (last_stripe +38803880+ sub_stripes - 1))38723881 bbio->stripes[i].length -=38733882 stripe_end_offset;38833883+38743884 if (i == sub_stripes - 1)38753885 stripe_offset = 0;38763886 } else
+20-62
fs/cifs/connect.c
···109109110110 /* Options which could be blank */111111 Opt_blank_pass,112112+ Opt_blank_user,113113+ Opt_blank_ip,112114113115 Opt_err114116};···185183 { Opt_wsize, "wsize=%s" },186184 { Opt_actimeo, "actimeo=%s" },187185186186+ { Opt_blank_user, "user=" },187187+ { Opt_blank_user, "username=" },188188 { Opt_user, "user=%s" },189189 { Opt_user, "username=%s" },190190 { Opt_blank_pass, "pass=" },191191 { Opt_pass, "pass=%s" },192192 { Opt_pass, "password=%s" },193193+ { Opt_blank_ip, "ip=" },194194+ { Opt_blank_ip, "addr=" },193195 { Opt_ip, "ip=%s" },194196 { Opt_ip, "addr=%s" },195197 { Opt_unc, "unc=%s" },···11231117 string = match_strdup(args);11241118 if (string == NULL)11251119 return -ENOMEM;11261126- rc = kstrtoul(string, 10, option);11201120+ rc = kstrtoul(string, 0, option);11271121 kfree(string);1128112211291123 return rc;···1540153415411535 /* String Arguments */1542153615371537+ case Opt_blank_user:15381538+ /* null user, ie. anonymous authentication */15391539+ vol->nullauth = 1;15401540+ vol->username = NULL;15411541+ break;15431542 case Opt_user:15441543 string = match_strdup(args);15451544 if (string == NULL)15461545 goto out_nomem;1547154615481548- if (!*string) {15491549- /* null user, ie. anonymous authentication */15501550- vol->nullauth = 1;15511551- } else if (strnlen(string, MAX_USERNAME_SIZE) >15471547+ if (strnlen(string, MAX_USERNAME_SIZE) >15521548 MAX_USERNAME_SIZE) {15531549 printk(KERN_WARNING "CIFS: username too long\n");15541550 goto cifs_parse_mount_err;···16191611 }16201612 vol->password[j] = '\0';16211613 break;16141614+ case Opt_blank_ip:16151615+ vol->UNCip = NULL;16161616+ break;16221617 case Opt_ip:16231618 string = match_strdup(args);16241619 if (string == NULL)16251620 goto out_nomem;1626162116271627- if (!*string) {16281628- vol->UNCip = NULL;16291629- } else if (strnlen(string, INET6_ADDRSTRLEN) >16221622+ if (strnlen(string, INET6_ADDRSTRLEN) >16301623 INET6_ADDRSTRLEN) {16311624 printk(KERN_WARNING "CIFS: ip address "16321625 "too long\n");···16441635 string = match_strdup(args);16451636 if (string == NULL)16461637 goto out_nomem;16471647-16481648- if (!*string) {16491649- printk(KERN_WARNING "CIFS: invalid path to "16501650- "network resource\n");16511651- goto cifs_parse_mount_err;16521652- }1653163816541639 temp_len = strnlen(string, 300);16551640 if (temp_len == 300) {···16731670 if (string == NULL)16741671 goto out_nomem;1675167216761676- if (!*string) {16771677- printk(KERN_WARNING "CIFS: invalid domain"16781678- " name\n");16791679- goto cifs_parse_mount_err;16801680- } else if (strnlen(string, 256) == 256) {16731673+ if (strnlen(string, 256) == 256) {16811674 printk(KERN_WARNING "CIFS: domain name too"16821675 " long\n");16831676 goto cifs_parse_mount_err;···16921693 if (string == NULL)16931694 goto out_nomem;1694169516951695- if (!*string) {16961696- printk(KERN_WARNING "CIFS: srcaddr value not"16971697- " specified\n");16981698- goto cifs_parse_mount_err;16991699- } else if (!cifs_convert_address(16961696+ if (!cifs_convert_address(17001697 (struct sockaddr *)&vol->srcaddr,17011698 string, strlen(string))) {17021699 printk(KERN_WARNING "CIFS: Could not parse"···17051710 if (string == NULL)17061711 goto out_nomem;1707171217081708- if (!*string) {17091709- printk(KERN_WARNING "CIFS: Invalid path"17101710- " prefix\n");17111711- goto cifs_parse_mount_err;17121712- }17131713 temp_len = strnlen(string, 1024);17141714 if (string[0] != '/')17151715 temp_len++; /* missing leading slash */···17321742 if (string == NULL)17331743 goto out_nomem;1734174417351735- if (!*string) {17361736- printk(KERN_WARNING "CIFS: Invalid iocharset"17371737- " specified\n");17381738- goto cifs_parse_mount_err;17391739- } else if (strnlen(string, 1024) >= 65) {17451745+ if (strnlen(string, 1024) >= 65) {17401746 printk(KERN_WARNING "CIFS: iocharset name "17411747 "too long.\n");17421748 goto cifs_parse_mount_err;···17571771 if (string == NULL)17581772 goto out_nomem;1759177317601760- if (!*string) {17611761- printk(KERN_WARNING "CIFS: No socket option"17621762- " specified\n");17631763- goto cifs_parse_mount_err;17641764- }17651774 if (strnicmp(string, "TCP_NODELAY", 11) == 0)17661775 vol->sockopt_tcp_nodelay = 1;17671776 break;···17641783 string = match_strdup(args);17651784 if (string == NULL)17661785 goto out_nomem;17671767-17681768- if (!*string) {17691769- printk(KERN_WARNING "CIFS: Invalid (empty)"17701770- " netbiosname\n");17711771- break;17721772- }1773178617741787 memset(vol->source_rfc1001_name, 0x20,17751788 RFC1001_NAME_LEN);···17921817 if (string == NULL)17931818 goto out_nomem;1794181917951795- if (!*string) {17961796- printk(KERN_WARNING "CIFS: Empty server"17971797- " netbiosname specified\n");17981798- break;17991799- }18001820 /* last byte, type, is 0x20 for servr type */18011821 memset(vol->target_rfc1001_name, 0x20,18021822 RFC1001_NAME_LEN_WITH_NULL);···18181848 if (string == NULL)18191849 goto out_nomem;1820185018211821- if (!*string) {18221822- cERROR(1, "no protocol version specified"18231823- " after vers= mount option");18241824- goto cifs_parse_mount_err;18251825- }18261826-18271851 if (strnicmp(string, "cifs", 4) == 0 ||18281852 strnicmp(string, "1", 1) == 0) {18291853 /* This is the default */···18311867 string = match_strdup(args);18321868 if (string == NULL)18331869 goto out_nomem;18341834-18351835- if (!*string) {18361836- printk(KERN_WARNING "CIFS: no security flavor"18371837- " specified\n");18381838- break;18391839- }1840187018411871 if (cifs_parse_security_flavors(string, vol) != 0)18421872 goto cifs_parse_mount_err;
-3
fs/ext4/ext4.h
···12031203 unsigned long s_ext_blocks;12041204 unsigned long s_ext_extents;12051205#endif12061206- /* ext4 extent cache stats */12071207- unsigned long extent_cache_hits;12081208- unsigned long extent_cache_misses;1209120612101207 /* for buddy allocator */12111208 struct ext4_group_info ***s_group_info;
+1-5
fs/ext4/extents.c
···20662066 ret = 1;20672067 }20682068errout:20692069- if (!ret)20702070- sbi->extent_cache_misses++;20712071- else20722072- sbi->extent_cache_hits++;20732069 trace_ext4_ext_in_cache(inode, block, ret);20742070 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);20752071 return ret;···28782882 if (err)28792883 goto fix_extent_len;28802884 /* update the extent length and mark as initialized */28812881- ex->ee_len = cpu_to_le32(ee_len);28852885+ ex->ee_len = cpu_to_le16(ee_len);28822886 ext4_ext_try_to_merge(inode, path, ex);28832887 err = ext4_ext_dirty(handle, inode, path + depth);28842888 goto out;
+15-33
fs/ext4/super.c
···13051305 ext4_msg(sb, KERN_ERR,13061306 "Cannot change journaled "13071307 "quota options when quota turned on");13081308- return 0;13081308+ return -1;13091309 }13101310 qname = match_strdup(args);13111311 if (!qname) {13121312 ext4_msg(sb, KERN_ERR,13131313 "Not enough memory for storing quotafile name");13141314- return 0;13141314+ return -1;13151315 }13161316 if (sbi->s_qf_names[qtype] &&13171317 strcmp(sbi->s_qf_names[qtype], qname)) {13181318 ext4_msg(sb, KERN_ERR,13191319 "%s quota file already specified", QTYPE2NAME(qtype));13201320 kfree(qname);13211321- return 0;13211321+ return -1;13221322 }13231323 sbi->s_qf_names[qtype] = qname;13241324 if (strchr(sbi->s_qf_names[qtype], '/')) {···13261326 "quotafile must be on filesystem root");13271327 kfree(sbi->s_qf_names[qtype]);13281328 sbi->s_qf_names[qtype] = NULL;13291329- return 0;13291329+ return -1;13301330 }13311331 set_opt(sb, QUOTA);13321332 return 1;···13411341 sbi->s_qf_names[qtype]) {13421342 ext4_msg(sb, KERN_ERR, "Cannot change journaled quota options"13431343 " when quota turned on");13441344- return 0;13441344+ return -1;13451345 }13461346 /*13471347 * The space will be released later when all options are confirmed···14501450 const struct mount_opts *m;14511451 int arg = 0;1452145214531453+#ifdef CONFIG_QUOTA14541454+ if (token == Opt_usrjquota)14551455+ return set_qf_name(sb, USRQUOTA, &args[0]);14561456+ else if (token == Opt_grpjquota)14571457+ return set_qf_name(sb, GRPQUOTA, &args[0]);14581458+ else if (token == Opt_offusrjquota)14591459+ return clear_qf_name(sb, USRQUOTA);14601460+ else if (token == Opt_offgrpjquota)14611461+ return clear_qf_name(sb, GRPQUOTA);14621462+#endif14531463 if (args->from && match_int(args, &arg))14541464 return -1;14551465 switch (token) {···15591549 sbi->s_mount_opt |= m->mount_opt;15601550 }15611551#ifdef CONFIG_QUOTA15621562- } else if (token == Opt_usrjquota) {15631563- if (!set_qf_name(sb, USRQUOTA, &args[0]))15641564- return -1;15651565- } else if (token == Opt_grpjquota) {15661566- if (!set_qf_name(sb, GRPQUOTA, &args[0]))15671567- return -1;15681568- } else if (token == Opt_offusrjquota) {15691569- if (!clear_qf_name(sb, USRQUOTA))15701570- return -1;15711571- } else if (token == Opt_offgrpjquota) {15721572- if (!clear_qf_name(sb, GRPQUOTA))15731573- return -1;15741552 } else if (m->flags & MOPT_QFMT) {15751553 if (sb_any_quota_loaded(sb) &&15761554 sbi->s_jquota_fmt != m->mount_opt) {···23642366 EXT4_SB(sb)->s_sectors_written_start) >> 1)));23652367}2366236823672367-static ssize_t extent_cache_hits_show(struct ext4_attr *a,23682368- struct ext4_sb_info *sbi, char *buf)23692369-{23702370- return snprintf(buf, PAGE_SIZE, "%lu\n", sbi->extent_cache_hits);23712371-}23722372-23732373-static ssize_t extent_cache_misses_show(struct ext4_attr *a,23742374- struct ext4_sb_info *sbi, char *buf)23752375-{23762376- return snprintf(buf, PAGE_SIZE, "%lu\n", sbi->extent_cache_misses);23772377-}23782378-23792369static ssize_t inode_readahead_blks_store(struct ext4_attr *a,23802370 struct ext4_sb_info *sbi,23812371 const char *buf, size_t count)···24212435EXT4_RO_ATTR(delayed_allocation_blocks);24222436EXT4_RO_ATTR(session_write_kbytes);24232437EXT4_RO_ATTR(lifetime_write_kbytes);24242424-EXT4_RO_ATTR(extent_cache_hits);24252425-EXT4_RO_ATTR(extent_cache_misses);24262438EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, sbi_ui_show,24272439 inode_readahead_blks_store, s_inode_readahead_blks);24282440EXT4_RW_ATTR_SBI_UI(inode_goal, s_inode_goal);···24362452 ATTR_LIST(delayed_allocation_blocks),24372453 ATTR_LIST(session_write_kbytes),24382454 ATTR_LIST(lifetime_write_kbytes),24392439- ATTR_LIST(extent_cache_hits),24402440- ATTR_LIST(extent_cache_misses),24412455 ATTR_LIST(inode_readahead_blks),24422456 ATTR_LIST(inode_goal),24432457 ATTR_LIST(mb_stats),
+15-10
fs/fuse/dir.c
···387387 if (fc->no_create)388388 return -ENOSYS;389389390390- if (flags & O_DIRECT)391391- return -EINVAL;392392-393390 forget = fuse_alloc_forget();394391 if (!forget)395392 return -ENOMEM;···641644 fuse_put_request(fc, req);642645 if (!err) {643646 struct inode *inode = entry->d_inode;647647+ struct fuse_inode *fi = get_fuse_inode(inode);644648645645- /*646646- * Set nlink to zero so the inode can be cleared, if the inode647647- * does have more links this will be discovered at the next648648- * lookup/getattr.649649- */650650- clear_nlink(inode);649649+ spin_lock(&fc->lock);650650+ fi->attr_version = ++fc->attr_version;651651+ drop_nlink(inode);652652+ spin_unlock(&fc->lock);651653 fuse_invalidate_attr(inode);652654 fuse_invalidate_attr(dir);653655 fuse_invalidate_entry_cache(entry);···758762 will reflect changes in the backing inode (link count,759763 etc.)760764 */761761- if (!err || err == -EINTR)765765+ if (!err) {766766+ struct fuse_inode *fi = get_fuse_inode(inode);767767+768768+ spin_lock(&fc->lock);769769+ fi->attr_version = ++fc->attr_version;770770+ inc_nlink(inode);771771+ spin_unlock(&fc->lock);762772 fuse_invalidate_attr(inode);773773+ } else if (err == -EINTR) {774774+ fuse_invalidate_attr(inode);775775+ }763776 return err;764777}765778
···724724 int metadata;725725 unsigned int revokes = 0;726726 int x;727727- int error = 0;727727+ int error;728728+729729+ error = gfs2_rindex_update(sdp);730730+ if (error)731731+ return error;728732729733 if (!*top)730734 sm->sm_first = 0;
+4
fs/gfs2/dir.c
···18441844 unsigned int x, size = len * sizeof(u64);18451845 int error;1846184618471847+ error = gfs2_rindex_update(sdp);18481848+ if (error)18491849+ return error;18501850+18471851 memset(&rlist, 0, sizeof(struct gfs2_rgrp_list));1848185218491853 ht = kzalloc(size, GFP_NOFS);
···729729 else730730 parent_sd = &sysfs_root;731731732732+ if (!parent_sd)733733+ return -ENOENT;734734+732735 if (sysfs_ns_type(parent_sd))733736 ns = kobj->ktype->namespace(kobj);734737 type = sysfs_read_ns_type(kobj);···881878882879 dup_name = sd->s_name;883880 sd->s_name = new_name;884884- sd->s_hash = sysfs_name_hash(sd->s_ns, sd->s_name);885881 }886882887883 /* Move to the appropriate place in the appropriate directories rbtree. */···888886 sysfs_get(new_parent_sd);889887 sysfs_put(sd->s_parent);890888 sd->s_ns = new_ns;889889+ sd->s_hash = sysfs_name_hash(sd->s_ns, sd->s_name);891890 sd->s_parent = new_parent_sd;892891 sysfs_link_sibling(sd);893892
+5-1
fs/sysfs/group.c
···6767 /* Updates may happen before the object has been instantiated */6868 if (unlikely(update && !kobj->sd))6969 return -EINVAL;7070-7070+ if (!grp->attrs) {7171+ WARN(1, "sysfs: attrs not set by subsystem for group: %s/%s\n",7272+ kobj->name, grp->name ? "" : grp->name);7373+ return -EINVAL;7474+ }7175 if (grp->name) {7276 error = sysfs_create_subdir(kobj, grp->name, &sd);7377 if (error)
···4242/* Number of irqs reserved for a legacy isa controller */4343#define NUM_ISA_INTERRUPTS 1644444545-/* This type is the placeholder for a hardware interrupt number. It has to4646- * be big enough to enclose whatever representation is used by a given4747- * platform.4848- */4949-typedef unsigned long irq_hw_number_t;5050-5145/**5246 * struct irq_domain_ops - Methods for irq_domain objects5347 * @match: Match an interrupt controller device node to a host, returns···98104 unsigned int size;99105 unsigned int *revmap;100106 } linear;107107+ struct {108108+ unsigned int max_irq;109109+ } nomap;101110 struct radix_tree_root tree;102111 } revmap_data;103112 const struct irq_domain_ops *ops;···123126 const struct irq_domain_ops *ops,124127 void *host_data);125128struct irq_domain *irq_domain_add_nomap(struct device_node *of_node,129129+ unsigned int max_irq,126130 const struct irq_domain_ops *ops,127131 void *host_data);128132struct irq_domain *irq_domain_add_tree(struct device_node *of_node,···132134133135extern struct irq_domain *irq_find_host(struct device_node *node);134136extern void irq_set_default_host(struct irq_domain *host);135135-extern void irq_set_virq_count(unsigned int count);136137137138static inline struct irq_domain *irq_domain_add_legacy_isa(138139 struct device_node *of_node,···143146}144147extern struct irq_domain *irq_find_host(struct device_node *node);145148extern void irq_set_default_host(struct irq_domain *host);146146-extern void irq_set_virq_count(unsigned int count);147149148150149151extern unsigned int irq_create_mapping(struct irq_domain *host,
+18-4
include/linux/kconfig.h
···44#include <generated/autoconf.h>5566/*77- * Helper macros to use CONFIG_ options in C expressions. Note that77+ * Helper macros to use CONFIG_ options in C/CPP expressions. Note that88 * these only work with boolean and tristate options.99 */1010+1111+/*1212+ * Getting something that works in C and CPP for an arg that may or may1313+ * not be defined is tricky. Here, if we have "#define CONFIG_BOOGER 1"1414+ * we match on the placeholder define, insert the "0," for arg1 and generate1515+ * the triplet (0, 1, 0). Then the last step cherry picks the 2nd arg (a one).1616+ * When CONFIG_BOOGER is not defined, we generate a (... 1, 0) pair, and when1717+ * the last step cherry picks the 2nd arg, we get a zero.1818+ */1919+#define __ARG_PLACEHOLDER_1 0,2020+#define config_enabled(cfg) _config_enabled(cfg)2121+#define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value)2222+#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0)2323+#define ___config_enabled(__ignored, val, ...) val10241125/*1226 * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',···2814 *2915 */3016#define IS_ENABLED(option) \3131- (__enabled_ ## option || __enabled_ ## option ## _MODULE)1717+ (config_enabled(option) || config_enabled(option##_MODULE))32183319/*3420 * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 03521 * otherwise. For boolean options, this is equivalent to3622 * IS_ENABLED(CONFIG_FOO).3723 */3838-#define IS_BUILTIN(option) __enabled_ ## option2424+#define IS_BUILTIN(option) config_enabled(option)39254026/*4127 * IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 04228 * otherwise.4329 */4444-#define IS_MODULE(option) __enabled_ ## option ## _MODULE3030+#define IS_MODULE(option) config_enabled(option##_MODULE)45314632#endif /* __LINUX_KCONFIG_H */
···287287 struct xt_table *table);288288289289/* Check for an extension */290290-extern int ip6t_ext_hdr(u8 nexthdr);290290+static inline int291291+ip6t_ext_hdr(u8 nexthdr)292292+{ return (nexthdr == IPPROTO_HOPOPTS) ||293293+ (nexthdr == IPPROTO_ROUTING) ||294294+ (nexthdr == IPPROTO_FRAGMENT) ||295295+ (nexthdr == IPPROTO_ESP) ||296296+ (nexthdr == IPPROTO_AH) ||297297+ (nexthdr == IPPROTO_NONE) ||298298+ (nexthdr == IPPROTO_DSTOPTS);299299+}300300+291301/* find specified header and get offset to it */292302extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,293303 int target, unsigned short *fragoff);
+1-1
include/linux/serial_core.h
···357357#define UPF_CONS_FLOW ((__force upf_t) (1 << 23))358358#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24))359359#define UPF_EXAR_EFR ((__force upf_t) (1 << 25))360360-#define UPF_IIR_ONCE ((__force upf_t) (1 << 26))360360+#define UPF_BUG_THRE ((__force upf_t) (1 << 26))361361/* The exact UART type is known and should not be probed. */362362#define UPF_FIXED_TYPE ((__force upf_t) (1 << 27))363363#define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28))
+13
include/linux/skbuff.h
···481481 union {482482 __u32 mark;483483 __u32 dropcount;484484+ __u32 avail_size;484485 };485486486487 sk_buff_data_t transport_header;···13641363static inline int skb_tailroom(const struct sk_buff *skb)13651364{13661365 return skb_is_nonlinear(skb) ? 0 : skb->end - skb->tail;13661366+}13671367+13681368+/**13691369+ * skb_availroom - bytes at buffer end13701370+ * @skb: buffer to check13711371+ *13721372+ * Return the number of bytes of free space at the tail of an sk_buff13731373+ * allocated by sk_stream_alloc()13741374+ */13751375+static inline int skb_availroom(const struct sk_buff *skb)13761376+{13771377+ return skb_is_nonlinear(skb) ? 0 : skb->avail_size - skb->len;13671378}1368137913691380/**
···210210211211typedef phys_addr_t resource_size_t;212212213213+/*214214+ * This type is the placeholder for a hardware interrupt number. It has to be215215+ * big enough to enclose whatever representation is used by a given platform.216216+ */217217+typedef unsigned long irq_hw_number_t;218218+213219typedef struct {214220 int counter;215221} atomic_t;
···325325326326/* --- */327327328328+/* sound printk debug levels */329329+enum {330330+ SND_PR_ALWAYS,331331+ SND_PR_DEBUG,332332+ SND_PR_VERBOSE,333333+};334334+328335#if defined(CONFIG_SND_DEBUG) || defined(CONFIG_SND_VERBOSE_PRINTK)329336__printf(4, 5)330337void __snd_printk(unsigned int level, const char *file, int line,···361354 */362355#define snd_printd(fmt, args...) \363356 __snd_printk(1, __FILE__, __LINE__, fmt, ##args)357357+#define _snd_printd(level, fmt, args...) \358358+ __snd_printk(level, __FILE__, __LINE__, fmt, ##args)364359365360/**366361 * snd_BUG - give a BUG warning message and stack trace···392383#else /* !CONFIG_SND_DEBUG */393384394385#define snd_printd(fmt, args...) do { } while (0)386386+#define _snd_printd(level, fmt, args...) do { } while (0)395387#define snd_BUG() do { } while (0)396388static inline int __snd_bug_on(int cond)397389{
+2
kernel/cred.c
···386386 struct cred *new;387387 int ret;388388389389+ p->replacement_session_keyring = NULL;390390+389391 if (390392#ifdef CONFIG_KEYS391393 !p->cred->thread_keyring &&
+1-1
kernel/irq/Kconfig
···6262 help6363 This option will show the mapping relationship between hardware irq6464 numbers and Linux irq numbers. The mapping is exposed via debugfs6565- in the file "virq_mapping".6565+ in the file "irq_domain_mapping".66666767 If you don't know what this means you don't need it.6868
+17-30
kernel/irq/irqdomain.c
···2323static DEFINE_MUTEX(irq_domain_mutex);24242525static DEFINE_MUTEX(revmap_trees_mutex);2626-static unsigned int irq_virq_count = NR_IRQS;2726static struct irq_domain *irq_default_domain;28272928/**···183184}184185185186struct irq_domain *irq_domain_add_nomap(struct device_node *of_node,187187+ unsigned int max_irq,186188 const struct irq_domain_ops *ops,187189 void *host_data)188190{189191 struct irq_domain *domain = irq_domain_alloc(of_node,190192 IRQ_DOMAIN_MAP_NOMAP, ops, host_data);191191- if (domain)193193+ if (domain) {194194+ domain->revmap_data.nomap.max_irq = max_irq ? max_irq : ~0;192195 irq_domain_add(domain);196196+ }193197 return domain;194198}195199···264262 irq_default_domain = domain;265263}266264267267-/**268268- * irq_set_virq_count() - Set the maximum number of linux irqs269269- * @count: number of linux irqs, capped with NR_IRQS270270- *271271- * This is mainly for use by platforms like iSeries who want to program272272- * the virtual irq number in the controller to avoid the reverse mapping273273- */274274-void irq_set_virq_count(unsigned int count)275275-{276276- pr_debug("irq: Trying to set virq count to %d\n", count);277277-278278- BUG_ON(count < NUM_ISA_INTERRUPTS);279279- if (count < NR_IRQS)280280- irq_virq_count = count;281281-}282282-283265static int irq_setup_virq(struct irq_domain *domain, unsigned int virq,284266 irq_hw_number_t hwirq)285267{···306320 pr_debug("irq: create_direct virq allocation failed\n");307321 return 0;308322 }309309- if (virq >= irq_virq_count) {323323+ if (virq >= domain->revmap_data.nomap.max_irq) {310324 pr_err("ERROR: no free irqs available below %i maximum\n",311311- irq_virq_count);325325+ domain->revmap_data.nomap.max_irq);312326 irq_free_desc(virq);313327 return 0;314328 }315315-316329 pr_debug("irq: create_direct obtained virq %d\n", virq);317330318331 if (irq_setup_virq(domain, virq, virq)) {···335350unsigned int irq_create_mapping(struct irq_domain *domain,336351 irq_hw_number_t hwirq)337352{338338- unsigned int virq, hint;353353+ unsigned int hint;354354+ int virq;339355340356 pr_debug("irq: irq_create_mapping(0x%p, 0x%lx)\n", domain, hwirq);341357···363377 return irq_domain_legacy_revmap(domain, hwirq);364378365379 /* Allocate a virtual interrupt number */366366- hint = hwirq % irq_virq_count;380380+ hint = hwirq % nr_irqs;367381 if (hint == 0)368382 hint++;369383 virq = irq_alloc_desc_from(hint, 0);370370- if (!virq)384384+ if (virq <= 0)371385 virq = irq_alloc_desc_from(1, 0);372372- if (!virq) {386386+ if (virq <= 0) {373387 pr_debug("irq: -> virq allocation failed\n");374388 return 0;375389 }···501515 irq_hw_number_t hwirq)502516{503517 unsigned int i;504504- unsigned int hint = hwirq % irq_virq_count;518518+ unsigned int hint = hwirq % nr_irqs;505519506520 /* Look for default domain if nececssary */507521 if (domain == NULL)···522536 if (data && (data->domain == domain) && (data->hwirq == hwirq))523537 return i;524538 i++;525525- if (i >= irq_virq_count)539539+ if (i >= nr_irqs)526540 i = 1;527541 } while(i != hint);528542 return 0;···628642 void *data;629643 int i;630644631631- seq_printf(m, "%-5s %-7s %-15s %-18s %s\n", "virq", "hwirq",632632- "chip name", "chip data", "domain name");645645+ seq_printf(m, "%-5s %-7s %-15s %-*s %s\n", "irq", "hwirq",646646+ "chip name", (int)(2 * sizeof(void *) + 2), "chip data",647647+ "domain name");633648634649 for (i = 1; i < nr_irqs; i++) {635650 desc = irq_to_desc(i);···653666 seq_printf(m, "%-15s ", p);654667655668 data = irq_desc_get_chip_data(desc);656656- seq_printf(m, "0x%16p ", data);669669+ seq_printf(m, data ? "0x%p " : " %p ", data);657670658671 if (desc->irq_data.domain && desc->irq_data.domain->of_node)659672 p = desc->irq_data.domain->of_node->full_name;
···284284 if (value) {285285 if(copy_from_user(&set_buffer, value, sizeof(set_buffer)))286286 return -EFAULT;287287- } else288288- memset((char *) &set_buffer, 0, sizeof(set_buffer));287287+ } else {288288+ memset(&set_buffer, 0, sizeof(set_buffer));289289+ printk_once(KERN_WARNING "%s calls setitimer() with new_value NULL pointer."290290+ " Misfeature support will be removed\n",291291+ current->comm);292292+ }289293290294 error = do_setitimer(which, &set_buffer, ovalue ? &get_buffer : NULL);291295 if (error || !ovalue)
+1-1
kernel/panic.c
···9797 /*9898 * Avoid nested stack-dumping if a panic occurs during oops processing9999 */100100- if (!oops_in_progress)100100+ if (!test_taint(TAINT_DIE) && oops_in_progress <= 1)101101 dump_stack();102102#endif103103
+4
kernel/time/Kconfig
···11#22# Timer subsystem related configuration options33#44+55+# Core internal switch. Selected by NO_HZ / HIGH_RES_TIMERS. This is66+# only related to the tick functionality. Oneshot clockevent devices77+# are supported independ of this.48config TICK_ONESHOT59 bool610
+3-1
kernel/time/tick-broadcast.c
···575575 unsigned long flags;576576577577 raw_spin_lock_irqsave(&tick_broadcast_lock, flags);578578+579579+ tick_broadcast_device.mode = TICKDEV_MODE_ONESHOT;580580+578581 if (cpumask_empty(tick_get_broadcast_mask()))579582 goto end;580583581581- tick_broadcast_device.mode = TICKDEV_MODE_ONESHOT;582584 bc = tick_broadcast_device.evtdev;583585 if (bc)584586 tick_broadcast_setup_oneshot(bc);
+2-2
kernel/time/tick-sched.c
···534534 hrtimer_get_expires(&ts->sched_timer), 0))535535 break;536536 }537537- /* Update jiffies and reread time */538538- tick_do_update_jiffies64(now);537537+ /* Reread time and update jiffies */539538 now = ktime_get();539539+ tick_do_update_jiffies64(now);540540 }541541}542542
+7-7
lib/kobject.c
···192192193193 /* be noisy on error issues */194194 if (error == -EEXIST)195195- printk(KERN_ERR "%s failed for %s with "196196- "-EEXIST, don't try to register things with "197197- "the same name in the same directory.\n",198198- __func__, kobject_name(kobj));195195+ WARN(1, "%s failed for %s with "196196+ "-EEXIST, don't try to register things with "197197+ "the same name in the same directory.\n",198198+ __func__, kobject_name(kobj));199199 else200200- printk(KERN_ERR "%s failed for %s (%d)\n",201201- __func__, kobject_name(kobj), error);202202- dump_stack();200200+ WARN(1, "%s failed for %s (error: %d parent: %s)\n",201201+ __func__, kobject_name(kobj), error,202202+ parent ? kobject_name(parent) : "'none'");203203 } else204204 kobj->state_in_sysfs = 1;205205
+3-2
lib/mpi/mpi-bit.c
···177177 */178178int mpi_lshift_limbs(MPI a, unsigned int count)179179{180180- mpi_ptr_t ap = a->d;181181- int n = a->nlimbs;180180+ const int n = a->nlimbs;181181+ mpi_ptr_t ap;182182 int i;183183184184 if (!count || !n)···187187 if (RESIZE_IF_NEEDED(a, n + count) < 0)188188 return -ENOMEM;189189190190+ ap = a->d;190191 for (i = n - 1; i >= 0; i--)191192 ap[i + count] = ap[i];192193 for (i = 0; i < count; i++)
···21652165 if (action == CPU_ONLINE)21662166 return NOTIFY_OK;2167216721682168- if ((action != CPU_DEAD) || action != CPU_DEAD_FROZEN)21682168+ if (action != CPU_DEAD && action != CPU_DEAD_FROZEN)21692169 return NOTIFY_OK;2170217021712171 for_each_mem_cgroup(iter)···33923392 * the newpage may be on LRU(or pagevec for LRU) already. We lock33933393 * LRU while we overwrite pc->mem_cgroup.33943394 */33953395+ pc = lookup_page_cgroup(newpage);33953396 __mem_cgroup_commit_charge(memcg, newpage, 1, pc, type, true);33963397}33973398···37643763 goto try_to_free;37653764 cond_resched();37663765 /* "ret" should also be checked to ensure all lists are empty. */37673767- } while (memcg->res.usage > 0 || ret);37663766+ } while (res_counter_read_u64(&memcg->res, RES_USAGE) > 0 || ret);37683767out:37693768 css_put(&memcg->css);37703769 return ret;···37793778 lru_add_drain_all();37803779 /* try to free all pages in this cgroup */37813780 shrink = 1;37823782- while (nr_retries && memcg->res.usage > 0) {37813781+ while (nr_retries && res_counter_read_u64(&memcg->res, RES_USAGE) > 0) {37833782 int progress;3784378337853784 if (signal_pending(current)) {
+1-6
mm/vmscan.c
···21072107 * with multiple processes reclaiming pages, the total21082108 * freeing target can get unreasonably large.21092109 */21102110- if (nr_reclaimed >= nr_to_reclaim)21112111- nr_to_reclaim = 0;21122112- else21132113- nr_to_reclaim -= nr_reclaimed;21142114-21152115- if (!nr_to_reclaim && priority < DEF_PRIORITY)21102110+ if (nr_reclaimed >= nr_to_reclaim && priority < DEF_PRIORITY)21162111 break;21172112 }21182113 blk_finish_plug(&plug);
+7
net/bluetooth/hci_core.c
···665665666666 hci_req_lock(hdev);667667668668+ if (test_bit(HCI_UNREGISTER, &hdev->dev_flags)) {669669+ ret = -ENODEV;670670+ goto done;671671+ }672672+668673 if (hdev->rfkill && rfkill_blocked(hdev->rfkill)) {669674 ret = -ERFKILL;670675 goto done;···18531848 int i;1854184918551850 BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);18511851+18521852+ set_bit(HCI_UNREGISTER, &hdev->dev_flags);1856185318571854 write_lock(&hci_dev_list_lock);18581855 list_del(&hdev->list);
···952952 goto adjust_others;953953 }954954955955- data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask);955955+ data = kmalloc(size + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),956956+ gfp_mask);956957 if (!data)957958 goto nodata;959959+ size = SKB_WITH_OVERHEAD(ksize(data));958960959961 /* Copy only real data... and, alas, header. This should be960962 * optimized for the cases when header is void.
···701701 skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp);702702 if (skb) {703703 if (sk_wmem_schedule(sk, skb->truesize)) {704704+ skb_reserve(skb, sk->sk_prot->max_header);704705 /*705706 * Make sure that we have exactly size bytes706707 * available to the caller, no more, no less.707708 */708708- skb_reserve(skb, skb_tailroom(skb) - size);709709+ skb->avail_size = size;709710 return skb;710711 }711712 __kfree_skb(skb);···996995 copy = seglen;997996998997 /* Where to copy to? */999999- if (skb_tailroom(skb) > 0) {998998+ if (skb_availroom(skb) > 0) {1000999 /* We have some space in skb head. Superb! */10011001- if (copy > skb_tailroom(skb))10021002- copy = skb_tailroom(skb);10001000+ copy = min_t(int, copy, skb_availroom(skb));10031001 err = skb_add_data_nocache(sk, skb, from, copy);10041002 if (err)10051003 goto do_fault;···14521452 if ((available < target) &&14531453 (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) &&14541454 !sysctl_tcp_low_latency &&14551455- dma_find_channel(DMA_MEMCPY)) {14551455+ net_dma_find_channel()) {14561456 preempt_enable_no_resched();14571457 tp->ucopy.pinned_list =14581458 dma_pin_iovec_pages(msg->msg_iov, len);···16671667 if (!(flags & MSG_TRUNC)) {16681668#ifdef CONFIG_NET_DMA16691669 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)16701670- tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY);16701670+ tp->ucopy.dma_chan = net_dma_find_channel();1671167116721672 if (tp->ucopy.dma_chan) {16731673 tp->ucopy.dma_cookie = dma_skb_copy_datagram_iovec(···3302330233033303 tcp_init_mem(&init_net);33043304 /* Set per-socket limits to no more than 1/128 the pressure threshold */33053305- limit = nr_free_buffer_pages() << (PAGE_SHIFT - 10);33063306- limit = max(limit, 128UL);33053305+ limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7);33073306 max_share = min(4UL*1024*1024, limit);3308330733093308 sysctl_tcp_wmem[0] = SK_MEM_QUANTUM;
+6-3
net/ipv4/tcp_input.c
···474474 if (!win_dep) {475475 m -= (new_sample >> 3);476476 new_sample += m;477477- } else if (m < new_sample)478478- new_sample = m << 3;477477+ } else {478478+ m <<= 3;479479+ if (m < new_sample)480480+ new_sample = m;481481+ }479482 } else {480483 /* No previous measure. */481484 new_sample = m << 3;···52285225 return 0;5229522652305227 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)52315231- tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY);52285228+ tp->ucopy.dma_chan = net_dma_find_channel();5232522952335230 if (tp->ucopy.dma_chan && skb_csum_unnecessary(skb)) {52345231
+1-1
net/ipv4/tcp_ipv4.c
···17301730#ifdef CONFIG_NET_DMA17311731 struct tcp_sock *tp = tcp_sk(sk);17321732 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)17331733- tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY);17331733+ tp->ucopy.dma_chan = net_dma_find_channel();17341734 if (tp->ucopy.dma_chan)17351735 ret = tcp_v4_do_rcv(sk, skb);17361736 else
+1-1
net/ipv4/tcp_output.c
···20602060 /* Punt if not enough space exists in the first SKB for20612061 * the data in the second20622062 */20632063- if (skb->len > skb_tailroom(to))20632063+ if (skb->len > skb_availroom(to))20642064 break;2065206520662066 if (after(TCP_SKB_CB(skb)->end_seq, tcp_wnd_end(tp)))
-14
net/ipv6/netfilter/ip6_tables.c
···78787979 Hence the start of any table is given by get_table() below. */80808181-/* Check for an extension */8282-int8383-ip6t_ext_hdr(u8 nexthdr)8484-{8585- return (nexthdr == IPPROTO_HOPOPTS) ||8686- (nexthdr == IPPROTO_ROUTING) ||8787- (nexthdr == IPPROTO_FRAGMENT) ||8888- (nexthdr == IPPROTO_ESP) ||8989- (nexthdr == IPPROTO_AH) ||9090- (nexthdr == IPPROTO_NONE) ||9191- (nexthdr == IPPROTO_DSTOPTS);9292-}9393-9481/* Returns whether matches rule or not. */9582/* Performance critical - called for every packet */9683static inline bool···23532366EXPORT_SYMBOL(ip6t_register_table);23542367EXPORT_SYMBOL(ip6t_unregister_table);23552368EXPORT_SYMBOL(ip6t_do_table);23562356-EXPORT_SYMBOL(ip6t_ext_hdr);23572369EXPORT_SYMBOL(ipv6_find_hdr);2358237023592371module_init(ip6_tables_init);
+1-1
net/ipv6/tcp_ipv6.c
···16451645#ifdef CONFIG_NET_DMA16461646 struct tcp_sock *tp = tcp_sk(sk);16471647 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)16481648- tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY);16481648+ tp->ucopy.dma_chan = net_dma_find_channel();16491649 if (tp->ucopy.dma_chan)16501650 ret = tcp_v6_do_rcv(sk, skb);16511651 else
···584584 * Let's try to use the data from the packet.585585 */586586 sender->td_end = end;587587- win <<= sender->td_scale;588588- sender->td_maxwin = (win == 0 ? 1 : win);587587+ swin = win << sender->td_scale;588588+ sender->td_maxwin = (swin == 0 ? 1 : swin);589589 sender->td_maxend = end + sender->td_maxwin;590590 /*591591 * We haven't seen traffic in the other direction yet
···18691869 "No space is necessary after a cast\n" . $hereprev);18701870 }1871187118721872- if ($rawline =~ /^\+[ \t]*\/\*[ \t]*$/ &&18731873- $prevrawline =~ /^\+[ \t]*$/) {18741874- CHK("BLOCK_COMMENT_STYLE",18751875- "Don't begin block comments with only a /* line, use /* comment...\n" . $hereprev);18761876- }18771877-18781872# check for spaces at the beginning of a line.18791873# Exceptions:18801874# 1) within comments
+2-36
scripts/kconfig/confdata.c
···540540};541541542542/*543543- * Generate the __enabled_CONFIG_* and __enabled_CONFIG_*_MODULE macros for544544- * use by the IS_{ENABLED,BUILTIN,MODULE} macros. The _MODULE variant is545545- * generated even for booleans so that the IS_ENABLED() macro works.546546- */547547-static void548548-header_print__enabled_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)549549-{550550-551551- switch (sym->type) {552552- case S_BOOLEAN:553553- case S_TRISTATE: {554554- fprintf(fp, "#define __enabled_" CONFIG_ "%s %d\n",555555- sym->name, (*value == 'y'));556556- fprintf(fp, "#define __enabled_" CONFIG_ "%s_MODULE %d\n",557557- sym->name, (*value == 'm'));558558- break;559559- }560560- default:561561- break;562562- }563563-}564564-565565-static struct conf_printer header__enabled_printer_cb =566566-{567567- .print_symbol = header_print__enabled_symbol,568568- .print_comment = header_print_comment,569569-};570570-571571-/*572543 * Tristate printer573544 *574545 * This printer is used when generating the `include/config/tristate.conf' file.···920949 conf_write_heading(out_h, &header_printer_cb, NULL);921950922951 for_all_symbols(i, sym) {923923- if (!sym->name)924924- continue;925925-926952 sym_calc_value(sym);927927-928928- conf_write_symbol(out_h, sym, &header__enabled_printer_cb, NULL);929929-930930- if (!(sym->flags & SYMBOL_WRITE))953953+ if (!(sym->flags & SYMBOL_WRITE) || !sym->name)931954 continue;932955956956+ /* write symbol to auto.conf, tristate and header files */933957 conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1);934958935959 conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1);
+5-2
scripts/mod/modpost.c
···132132 /* strip trailing .o */133133 s = strrchr(p, '.');134134 if (s != NULL)135135- if (strcmp(s, ".o") == 0)135135+ if (strcmp(s, ".o") == 0) {136136 *s = '\0';137137+ mod->is_dot_o = 1;138138+ }137139138140 /* add to list */139141 mod->name = p;···589587 unsigned int crc;590588 enum export export;591589592592- if (!is_vmlinux(mod->name) && strncmp(symname, "__ksymtab", 9) == 0)590590+ if ((!is_vmlinux(mod->name) || mod->is_dot_o) &&591591+ strncmp(symname, "__ksymtab", 9) == 0)593592 export = export_from_secname(info, get_secindex(info, sym));594593 else595594 export = export_from_sec(info, get_secindex(info, sym));
···2929#include <linux/securebits.h>3030#include <linux/user_namespace.h>3131#include <linux/binfmts.h>3232+#include <linux/personality.h>32333334/*3435 * If a non-root user executes a setuid-root binary in···505504 effective = true;506505 }507506skip:507507+508508+ /* if we have fs caps, clear dangerous personality flags */509509+ if (!cap_issubset(new->cap_permitted, old->cap_permitted))510510+ bprm->per_clear |= PER_CLEAR_ON_SETID;511511+508512509513 /* Don't let someone trace a set[ug]id/setpcap binary with the revised510514 * credentials unless they have the appropriate permit
···11/******************************************************************************2233 AudioScience HPI driver44- Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>44+ Copyright (C) 1997-2012 AudioScience Inc. <support@audioscience.com>5566 This program is free software; you can redistribute it and/or modify77 it under the terms of version 2 of the GNU General Public License as···4242If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and4343HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle.4444*/4545-int hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,4545+u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,4646 /**< memory handle */4747 u32 size, /**< Size in bytes to allocate */4848 struct pci_dev *p_os_reference
+5-5
sound/pci/asihpi/hpios.c
···11/******************************************************************************2233 AudioScience HPI driver44- Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>44+ Copyright (C) 1997-2012 AudioScience Inc. <support@audioscience.com>5566 This program is free software; you can redistribute it and/or modify77 it under the terms of version 2 of the GNU General Public License as···39394040}41414242-/** Allocated an area of locked memory for bus master DMA operations.4242+/** Allocate an area of locked memory for bus master DMA operations.43434444-On error, return -ENOMEM, and *pMemArea.size = 04444+If allocation fails, return 1, and *pMemArea.size = 04545*/4646-int hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,4646+u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,4747 struct pci_dev *pdev)4848{4949 /*?? any benefit in using managed dmam_alloc_coherent? */···6262 HPI_DEBUG_LOG(WARNING,6363 "failed to allocate %d bytes locked memory\n", size);6464 p_mem_area->size = 0;6565- return -ENOMEM;6565+ return 1;6666 }6767}6868
+3
sound/pci/hda/hda_codec.h
···851851 unsigned int pin_amp_workaround:1; /* pin out-amp takes index852852 * (e.g. Conexant codecs)853853 */854854+ unsigned int single_adc_amp:1; /* adc in-amp takes no index855855+ * (e.g. CX20549 codec)856856+ */854857 unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */855858 unsigned int pins_shutup:1; /* pins are shut up */856859 unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */
+3-3
sound/pci/hda/hda_eld.c
···418418 else419419 buf2[0] = '\0';420420421421- printk(KERN_INFO "HDMI: supports coding type %s:"421421+ _snd_printd(SND_PR_VERBOSE, "HDMI: supports coding type %s:"422422 " channels = %d, rates =%s%s\n",423423 cea_audio_coding_type_names[a->format],424424 a->channels,···442442{443443 int i;444444445445- printk(KERN_INFO "HDMI: detected monitor %s at connection type %s\n",445445+ _snd_printd(SND_PR_VERBOSE, "HDMI: detected monitor %s at connection type %s\n",446446 e->monitor_name,447447 eld_connection_type_names[e->conn_type]);448448449449 if (e->spk_alloc) {450450 char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE];451451 snd_print_channel_allocation(e->spk_alloc, buf, sizeof(buf));452452- printk(KERN_INFO "HDMI: available speakers:%s\n", buf);452452+ _snd_printd(SND_PR_VERBOSE, "HDMI: available speakers:%s\n", buf);453453 }454454455455 for (i = 0; i < e->sad_count; i++)
···143143}144144145145/*146146- * using codec assist to small pop, hp_powerup or lineout_powerup147147- * should stay setting until vag_powerup is fully ramped down,148148- * vag fully ramped down require 400ms.146146+ * As manual described, ADC/DAC only works when VAG powerup,147147+ * So enabled VAG before ADC/DAC up.148148+ * In power down case, we need wait 400ms when vag fully ramped down.149149 */150150-static int small_pop_event(struct snd_soc_dapm_widget *w,150150+static int power_vag_event(struct snd_soc_dapm_widget *w,151151 struct snd_kcontrol *kcontrol, int event)152152{153153 switch (event) {···156156 SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP);157157 break;158158159159- case SND_SOC_DAPM_PRE_PMD:159159+ case SND_SOC_DAPM_POST_PMD:160160 snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER,161161 SGTL5000_VAG_POWERUP, 0);162162 msleep(400);···201201 mic_bias_event,202202 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),203203204204- SND_SOC_DAPM_PGA_E("HP", SGTL5000_CHIP_ANA_POWER, 4, 0, NULL, 0,205205- small_pop_event,206206- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),207207- SND_SOC_DAPM_PGA_E("LO", SGTL5000_CHIP_ANA_POWER, 0, 0, NULL, 0,208208- small_pop_event,209209- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),204204+ SND_SOC_DAPM_PGA("HP", SGTL5000_CHIP_ANA_POWER, 4, 0, NULL, 0),205205+ SND_SOC_DAPM_PGA("LO", SGTL5000_CHIP_ANA_POWER, 0, 0, NULL, 0),210206211207 SND_SOC_DAPM_MUX("Capture Mux", SND_SOC_NOPM, 0, 0, &adc_mux),212208 SND_SOC_DAPM_MUX("Headphone Mux", SND_SOC_NOPM, 0, 0, &dac_mux),···217221 0, SGTL5000_CHIP_DIG_POWER,218222 1, 0),219223220220- SND_SOC_DAPM_ADC("ADC", "Capture", SGTL5000_CHIP_ANA_POWER, 1, 0),224224+ SND_SOC_DAPM_SUPPLY("VAG_POWER", SGTL5000_CHIP_ANA_POWER, 7, 0,225225+ power_vag_event,226226+ SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),221227228228+ SND_SOC_DAPM_ADC("ADC", "Capture", SGTL5000_CHIP_ANA_POWER, 1, 0),222229 SND_SOC_DAPM_DAC("DAC", "Playback", SGTL5000_CHIP_ANA_POWER, 3, 0),223230};224231···230231 {"Capture Mux", "LINE_IN", "LINE_IN"}, /* line_in --> adc_mux */231232 {"Capture Mux", "MIC_IN", "MIC_IN"}, /* mic_in --> adc_mux */232233234234+ {"ADC", NULL, "VAG_POWER"},233235 {"ADC", NULL, "Capture Mux"}, /* adc_mux --> adc */234236 {"AIFOUT", NULL, "ADC"}, /* adc --> i2s_out */235237238238+ {"DAC", NULL, "VAG_POWER"},236239 {"DAC", NULL, "AIFIN"}, /* i2s-->dac,skip audio mux */237240 {"Headphone Mux", "DAC", "DAC"}, /* dac --> hp_mux */238241 {"LO", NULL, "DAC"}, /* dac --> line_out */
+4-1
sound/soc/imx/imx-audmux.c
···7373 if (!buf)7474 return -ENOMEM;75757676+ if (!audmux_base)7777+ return -ENOSYS;7878+7679 if (audmux_clk)7780 clk_prepare_enable(audmux_clk);7881···155152 return;156153 }157154158158- for (i = 1; i < 8; i++) {155155+ for (i = 0; i < MX31_AUDMUX_PORT6_SSI_PINS_6 + 1; i++) {159156 snprintf(buf, sizeof(buf), "ssi%d", i);160157 if (!debugfs_create_file(buf, 0444, audmux_debugfs_root,161158 (void *)i, &audmux_debugfs_fops))
···256256 if (!cmp) {257257 he->period += period;258258 ++he->nr_events;259259+260260+ /* If the map of an existing hist_entry has261261+ * become out-of-date due to an exec() or262262+ * similar, update it. Otherwise we will263263+ * mis-adjust symbol addresses when computing264264+ * the history counter to increment.265265+ */266266+ if (he->ms.map != entry->ms.map) {267267+ he->ms.map = entry->ms.map;268268+ if (he->ms.map)269269+ he->ms.map->referenced = true;270270+ }259271 goto out;260272 }261273