···649649650650N: Mauro Carvalho Chehab651651E: m.chehab@samsung.org652652+E: mchehab@osg.samsung.com652653E: mchehab@infradead.org653654D: Media subsystem (V4L/DVB) drivers and core654655D: EDAC drivers and EDAC 3.0 core rework
+29-29
Documentation/ABI/testing/configfs-usb-gadget-uvc
···11What: /config/usb-gadget/gadget/functions/uvc.name22Date: Dec 201433-KernelVersion: 3.2033+KernelVersion: 4.044Description: UVC function directory5566 streaming_maxburst - 0..15 (ss only)···991010What: /config/usb-gadget/gadget/functions/uvc.name/control1111Date: Dec 20141212-KernelVersion: 3.201212+KernelVersion: 4.01313Description: Control descriptors14141515What: /config/usb-gadget/gadget/functions/uvc.name/control/class1616Date: Dec 20141717-KernelVersion: 3.201717+KernelVersion: 4.01818Description: Class descriptors19192020What: /config/usb-gadget/gadget/functions/uvc.name/control/class/ss2121Date: Dec 20142222-KernelVersion: 3.202222+KernelVersion: 4.02323Description: Super speed control class descriptors24242525What: /config/usb-gadget/gadget/functions/uvc.name/control/class/fs2626Date: Dec 20142727-KernelVersion: 3.202727+KernelVersion: 4.02828Description: Full speed control class descriptors29293030What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal3131Date: Dec 20143232-KernelVersion: 3.203232+KernelVersion: 4.03333Description: Terminal descriptors34343535What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/output3636Date: Dec 20143737-KernelVersion: 3.203737+KernelVersion: 4.03838Description: Output terminal descriptors39394040What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/output/default4141Date: Dec 20144242-KernelVersion: 3.204242+KernelVersion: 4.04343Description: Default output terminal descriptors44444545 All attributes read only:···53535454What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera5555Date: Dec 20145656-KernelVersion: 3.205656+KernelVersion: 4.05757Description: Camera terminal descriptors58585959What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera/default6060Date: Dec 20146161-KernelVersion: 3.206161+KernelVersion: 4.06262Description: Default camera terminal descriptors63636464 All attributes read only:···75757676What: /config/usb-gadget/gadget/functions/uvc.name/control/processing7777Date: Dec 20147878-KernelVersion: 3.207878+KernelVersion: 4.07979Description: Processing unit descriptors80808181What: /config/usb-gadget/gadget/functions/uvc.name/control/processing/default8282Date: Dec 20148383-KernelVersion: 3.208383+KernelVersion: 4.08484Description: Default processing unit descriptors85858686 All attributes read only:···94949595What: /config/usb-gadget/gadget/functions/uvc.name/control/header9696Date: Dec 20149797-KernelVersion: 3.209797+KernelVersion: 4.09898Description: Control header descriptors9999100100What: /config/usb-gadget/gadget/functions/uvc.name/control/header/name101101Date: Dec 2014102102-KernelVersion: 3.20102102+KernelVersion: 4.0103103Description: Specific control header descriptors104104105105dwClockFrequency106106bcdUVC107107What: /config/usb-gadget/gadget/functions/uvc.name/streaming108108Date: Dec 2014109109-KernelVersion: 3.20109109+KernelVersion: 4.0110110Description: Streaming descriptors111111112112What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class113113Date: Dec 2014114114-KernelVersion: 3.20114114+KernelVersion: 4.0115115Description: Streaming class descriptors116116117117What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/ss118118Date: Dec 2014119119-KernelVersion: 3.20119119+KernelVersion: 4.0120120Description: Super speed streaming class descriptors121121122122What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/hs123123Date: Dec 2014124124-KernelVersion: 3.20124124+KernelVersion: 4.0125125Description: High speed streaming class descriptors126126127127What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/fs128128Date: Dec 2014129129-KernelVersion: 3.20129129+KernelVersion: 4.0130130Description: Full speed streaming class descriptors131131132132What: /config/usb-gadget/gadget/functions/uvc.name/streaming/color_matching133133Date: Dec 2014134134-KernelVersion: 3.20134134+KernelVersion: 4.0135135Description: Color matching descriptors136136137137What: /config/usb-gadget/gadget/functions/uvc.name/streaming/color_matching/default138138Date: Dec 2014139139-KernelVersion: 3.20139139+KernelVersion: 4.0140140Description: Default color matching descriptors141141142142 All attributes read only:···150150151151What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg152152Date: Dec 2014153153-KernelVersion: 3.20153153+KernelVersion: 4.0154154Description: MJPEG format descriptors155155156156What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name157157Date: Dec 2014158158-KernelVersion: 3.20158158+KernelVersion: 4.0159159Description: Specific MJPEG format descriptors160160161161 All attributes read only,···174174175175What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name/name176176Date: Dec 2014177177-KernelVersion: 3.20177177+KernelVersion: 4.0178178Description: Specific MJPEG frame descriptors179179180180 dwFrameInterval - indicates how frame interval can be···196196197197What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed198198Date: Dec 2014199199-KernelVersion: 3.20199199+KernelVersion: 4.0200200Description: Uncompressed format descriptors201201202202What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name203203Date: Dec 2014204204-KernelVersion: 3.20204204+KernelVersion: 4.0205205Description: Specific uncompressed format descriptors206206207207 bmaControls - this format's data for bmaControls in···221221222222What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name/name223223Date: Dec 2014224224-KernelVersion: 3.20224224+KernelVersion: 4.0225225Description: Specific uncompressed frame descriptors226226227227 dwFrameInterval - indicates how frame interval can be···243243244244What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header245245Date: Dec 2014246246-KernelVersion: 3.20246246+KernelVersion: 4.0247247Description: Streaming header descriptors248248249249What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header/name250250Date: Dec 2014251251-KernelVersion: 3.20251251+KernelVersion: 4.0252252Description: Specific streaming header descriptors253253254254 All attributes read only:
···11-What /sys/bus/iio/devices/iio:deviceX/in_proximity_raw11+What /sys/bus/iio/devices/iio:deviceX/in_proximity_input22Date: March 201433KernelVersion: 3.1544Contact: Matt Ranostay <mranostay@gmail.com>
···4444- our-claim-gpio: The GPIO that we use to claim the bus.4545- their-claim-gpios: The GPIOs that the other sides use to claim the bus.4646 Note that some implementations may only support a single other master.4747-- Standard I2C mux properties. See mux.txt in this directory.4848-- Single I2C child bus node at reg 0. See mux.txt in this directory.4747+- Standard I2C mux properties. See i2c-mux.txt in this directory.4848+- Single I2C child bus node at reg 0. See i2c-mux.txt in this directory.49495050Optional properties:5151- slew-delay-us: microseconds to wait for a GPIO to go high. Default is 10 us.
···2727- i2c-bus-name: The name of this bus. Also needed as pinctrl-name for the I2C2828 parents.29293030-Furthermore, I2C mux properties and child nodes. See mux.txt in this directory.3030+Furthermore, I2C mux properties and child nodes. See i2c-mux.txt in this3131+directory.31323233Example:3334
···2222- i2c-parent: The phandle of the I2C bus that this multiplexer's master-side2323 port is connected to.2424- mux-gpios: list of gpios used to control the muxer2525-* Standard I2C mux properties. See mux.txt in this directory.2626-* I2C child bus nodes. See mux.txt in this directory.2525+* Standard I2C mux properties. See i2c-mux.txt in this directory.2626+* I2C child bus nodes. See i2c-mux.txt in this directory.27272828Optional properties:2929- idle-state: value to set the muxer to when idle. When no value is···3333be numbered based on their order in the device tree.34343535Whenever an access is made to a device on a child bus, the value set3636-in the revelant node's reg property will be output using the list of3636+in the relevant node's reg property will be output using the list of3737GPIOs, the first in the list holding the least-significant value.38383939If an idle state is defined, using the idle-state (optional) property,
···2828* Standard pinctrl properties that specify the pin mux state for each child2929 bus. See ../pinctrl/pinctrl-bindings.txt.30303131-* Standard I2C mux properties. See mux.txt in this directory.3131+* Standard I2C mux properties. See i2c-mux.txt in this directory.32323333-* I2C child bus nodes. See mux.txt in this directory.3333+* I2C child bus nodes. See i2c-mux.txt in this directory.34343535For each named state defined in the pinctrl-names property, an I2C child bus3636will be created. I2C child bus numbers are assigned based on the index into
···77- compatible: i2c-mux-reg88- i2c-parent: The phandle of the I2C bus that this multiplexer's master-side99 port is connected to.1010-* Standard I2C mux properties. See mux.txt in this directory.1111-* I2C child bus nodes. See mux.txt in this directory.1010+* Standard I2C mux properties. See i2c-mux.txt in this directory.1111+* I2C child bus nodes. See i2c-mux.txt in this directory.12121313Optional properties:1414- reg: this pair of <offset size> specifies the register to control the mux.···2424 given, it defaults to the last value used.25252626Whenever an access is made to a device on a child bus, the value set2727-in the revelant node's reg property will be output to the register.2727+in the relevant node's reg property will be output to the register.28282929If an idle state is defined, using the idle-state (optional) property,3030whenever an access is not being made to a device on a child bus, the
···1313 initialization. This is an array of 28 values(u8).14141515 - marvell,wakeup-pin: It represents wakeup pin number of the bluetooth chip.1616- firmware will use the pin to wakeup host system.1616+ firmware will use the pin to wakeup host system (u16).1717 - marvell,wakeup-gap-ms: wakeup gap represents wakeup latency of the host1818 platform. The value will be configured to firmware. This1919- is needed to work chip's sleep feature as expected.1919+ is needed to work chip's sleep feature as expected (u16).2020 - interrupt-parent: phandle of the parent interrupt controller2121 - interrupts : interrupt pin number to the cpu. Driver will request an irq based2222 on this interrupt number. During system suspend, the irq will be···5050 0x37 0x01 0x1c 0x00 0xff 0xff 0xff 0xff 0x01 0x7f 0x04 0x025151 0x00 0x00 0xba 0xce 0xc0 0xc6 0x2d 0x00 0x00 0x00 0x00 0x005252 0x00 0x00 0xf0 0x00>;5353- marvell,wakeup-pin = <0x0d>;5454- marvell,wakeup-gap-ms = <0x64>;5353+ marvell,wakeup-pin = /bits/ 16 <0x0d>;5454+ marvell,wakeup-gap-ms = /bits/ 16 <0x64>;5555 };5656};
···7474however, it is better to use the API function led_blink_set(), as it7575will check and implement software fallback if necessary.76767777-To turn off blinking again, use the API function led_brightness_set()7878-as that will not just set the LED brightness but also stop any software7777+To turn off blinking, use the API function led_brightness_set()7878+with brightness value LED_OFF, which should stop any software7979timers that may have been required for blinking.80808181The blink_set() function should choose a user friendly blinking value
···606606 file which provides platform-specific implementations of some607607 functions in <linux/hash.h> or fs/namei.c.608608609609+config ISA_BUS_API610610+ def_bool ISA611611+609612#610613# ABI hall of shame611614#
···109109 * Since no set_type() method is provided by OMAP irq chip,110110 * switch to edge triggered interrupt type manually.111111 */112112- offset = IRQ_ILR0_REG_OFFSET + INT_DEFERRED_FIQ * 0x4;112112+ offset = IRQ_ILR0_REG_OFFSET +113113+ ((INT_DEFERRED_FIQ - NR_IRQS_LEGACY) & 0x1f) * 0x4;113114 val = omap_readl(DEFERRED_FIQ_IH_BASE + offset) & ~(1 << 1);114115 omap_writel(val, DEFERRED_FIQ_IH_BASE + offset);115116···150149 /*151150 * Redirect GPIO interrupts to FIQ152151 */153153- offset = IRQ_ILR0_REG_OFFSET + INT_GPIO_BANK1 * 0x4;152152+ offset = IRQ_ILR0_REG_OFFSET + (INT_GPIO_BANK1 - NR_IRQS_LEGACY) * 0x4;154153 val = omap_readl(OMAP_IH1_BASE + offset) | 1;155154 omap_writel(val, OMAP_IH1_BASE + offset);156155}
+2
arch/arm/mach-omap1/include/mach/ams-delta-fiq.h
···1414#ifndef __AMS_DELTA_FIQ_H1515#define __AMS_DELTA_FIQ_H16161717+#include <mach/irqs.h>1818+1719/*1820 * Interrupt number used for passing control from FIQ to IRQ.1921 * IRQ12, described as reserved, has been selected.
+12
arch/arm/mach-omap2/Kconfig
···1717 select PM_OPP if PM1818 select PM if CPU_IDLE1919 select SOC_HAS_OMAP2_SDRC2020+ select ARM_ERRATA_43097320212122config ARCH_OMAP42223 bool "TI OMAP4"···3736 select PM if CPU_IDLE3837 select ARM_ERRATA_7543223938 select ARM_ERRATA_7754203939+ select OMAP_INTERCONNECT40404141config SOC_OMAP54242 bool "TI OMAP5"···6967 select HAVE_ARM_SCU7068 select GENERIC_CLOCKEVENTS_BROADCAST7169 select HAVE_ARM_TWD7070+ select ARM_ERRATA_7543227171+ select ARM_ERRATA_77542072727373config SOC_DRA7XX7474 bool "TI DRA7XX"···243239endmenu244240245241endif242242+243243+config OMAP5_ERRATA_801819244244+ bool "Errata 801819: An eviction from L1 data cache might stall indefinitely"245245+ depends on SOC_OMAP5 || SOC_DRA7XX246246+ help247247+ A livelock can occur in the L2 cache arbitration that might prevent248248+ a snoop from completing. Under certain conditions this can cause the249249+ system to deadlock.246250247251endmenu
···5050 return scu_base;5151}52525353+#ifdef CONFIG_OMAP5_ERRATA_8018195454+void omap5_erratum_workaround_801819(void)5555+{5656+ u32 acr, revidr;5757+ u32 acr_mask;5858+5959+ /* REVIDR[3] indicates erratum fix available on silicon */6060+ asm volatile ("mrc p15, 0, %0, c0, c0, 6" : "=r" (revidr));6161+ if (revidr & (0x1 << 3))6262+ return;6363+6464+ asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr));6565+ /*6666+ * BIT(27) - Disables streaming. All write-allocate lines allocate in6767+ * the L1 or L2 cache.6868+ * BIT(25) - Disables streaming. All write-allocate lines allocate in6969+ * the L1 cache.7070+ */7171+ acr_mask = (0x3 << 25) | (0x3 << 27);7272+ /* do we already have it done.. if yes, skip expensive smc */7373+ if ((acr & acr_mask) == acr_mask)7474+ return;7575+7676+ acr |= acr_mask;7777+ omap_smc1(OMAP5_DRA7_MON_SET_ACR_INDEX, acr);7878+7979+ pr_debug("%s: ARM erratum workaround 801819 applied on CPU%d\n",8080+ __func__, smp_processor_id());8181+}8282+#else8383+static inline void omap5_erratum_workaround_801819(void) { }8484+#endif8585+5386static void omap4_secondary_init(unsigned int cpu)5487{5588 /*···9764 omap_secure_dispatcher(OMAP4_PPA_CPU_ACTRL_SMP_INDEX,9865 4, 0, 0, 0, 0, 0);9966100100- /*101101- * Configure the CNTFRQ register for the secondary cpu's which102102- * indicates the frequency of the cpu local timers.103103- */104104- if (soc_is_omap54xx() || soc_is_dra7xx())6767+ if (soc_is_omap54xx() || soc_is_dra7xx()) {6868+ /*6969+ * Configure the CNTFRQ register for the secondary cpu's which7070+ * indicates the frequency of the cpu local timers.7171+ */10572 set_cntfreq();7373+ /* Configure ACR to disable streaming WA for 801819 */7474+ omap5_erratum_workaround_801819();7575+ }1067610777 /*10878 * Synchronise with the boot thread.···254218255219 if (cpu_is_omap446x())256220 startup_addr = omap4460_secondary_startup;221221+ if (soc_is_dra74x() || soc_is_omap54xx())222222+ omap5_erratum_workaround_801819();257223258224 /*259225 * Write the address of secondary startup routine into the
+5-4
arch/arm/mach-omap2/powerdomain.c
···186186 trace_state = (PWRDM_TRACE_STATES_FLAG |187187 ((next & OMAP_POWERSTATE_MASK) << 8) |188188 ((prev & OMAP_POWERSTATE_MASK) << 0));189189- trace_power_domain_target(pwrdm->name, trace_state,190190- smp_processor_id());189189+ trace_power_domain_target_rcuidle(pwrdm->name,190190+ trace_state,191191+ smp_processor_id());191192 }192193 break;193194 default:···524523525524 if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst) {526525 /* Trace the pwrdm desired target state */527527- trace_power_domain_target(pwrdm->name, pwrst,528528- smp_processor_id());526526+ trace_power_domain_target_rcuidle(pwrdm->name, pwrst,527527+ smp_processor_id());529528 /* Program the pwrdm desired target state */530529 ret = arch_pwrdm->pwrdm_set_next_pwrst(pwrdm, pwrst);531530 }
···3838#endif /* !__ASSEMBLY__ */39394040/*4141- * gdb is expecting the following registers layout.4141+ * gdb remote procotol (well most versions of it) expects the following4242+ * register layout.4243 *4344 * General purpose regs:4445 * r0-r30: 64 bit4546 * sp,pc : 64 bit4646- * pstate : 64 bit4747- * Total: 344747+ * pstate : 32 bit4848+ * Total: 33 + 14849 * FPU regs:4950 * f0-f31: 128 bit5050- * Total: 325151- * Extra regs5251 * fpsr & fpcr: 32 bit5353- * Total: 25252+ * Total: 32 + 25453 *5454+ * To expand a little on the "most versions of it"... when the gdb remote5555+ * protocol for AArch64 was developed it depended on a statement in the5656+ * Architecture Reference Manual that claimed "SPSR_ELx is a 32-bit register".5757+ * and, as a result, allocated only 32-bits for the PSTATE in the remote5858+ * protocol. In fact this statement is still present in ARM DDI 0487A.i.5959+ *6060+ * Unfortunately "is a 32-bit register" has a very special meaning for6161+ * system registers. It means that "the upper bits, bits[63:32], are6262+ * RES0.". RES0 is heavily used in the ARM architecture documents as a6363+ * way to leave space for future architecture changes. So to translate a6464+ * little for people who don't spend their spare time reading ARM architecture6565+ * manuals, what "is a 32-bit register" actually means in this context is6666+ * "is a 64-bit register but one with no meaning allocated to any of the6767+ * upper 32-bits... *yet*".6868+ *6969+ * Perhaps then we should not be surprised that this has led to some7070+ * confusion. Specifically a patch, influenced by the above translation,7171+ * that extended PSTATE to 64-bit was accepted into gdb-7.7 but the patch7272+ * was reverted in gdb-7.8.1 and all later releases, when this was7373+ * discovered to be an undocumented protocol change.7474+ *7575+ * So... it is *not* wrong for us to only allocate 32-bits to PSTATE7676+ * here even though the kernel itself allocates 64-bits for the same7777+ * state. That is because this bit of code tells the kernel how the gdb7878+ * remote protocol (well most versions of it) describes the register state.7979+ *8080+ * Note that if you are using one of the versions of gdb that supports8181+ * the gdb-7.7 version of the protocol you cannot use kgdb directly8282+ * without providing a custom register description (gdb can load new8383+ * protocol descriptions at runtime).5584 */56855757-#define _GP_REGS 348686+#define _GP_REGS 335887#define _FP_REGS 325959-#define _EXTRA_REGS 28888+#define _EXTRA_REGS 36089/*6190 * general purpose registers size in bytes.6291 * pstate is only 4 bytes. subtract 4 bytes
+37-5
arch/arm64/include/asm/spinlock.h
···3030{3131 unsigned int tmp;3232 arch_spinlock_t lockval;3333+ u32 owner;3434+3535+ /*3636+ * Ensure prior spin_lock operations to other locks have completed3737+ * on this CPU before we test whether "lock" is locked.3838+ */3939+ smp_mb();4040+ owner = READ_ONCE(lock->owner) << 16;33413442 asm volatile(3543" sevl\n"3644"1: wfe\n"3745"2: ldaxr %w0, %2\n"4646+ /* Is the lock free? */3847" eor %w1, %w0, %w0, ror #16\n"3939-" cbnz %w1, 1b\n"4848+" cbz %w1, 3f\n"4949+ /* Lock taken -- has there been a subsequent unlock->lock transition? */5050+" eor %w1, %w3, %w0, lsl #16\n"5151+" cbz %w1, 1b\n"5252+ /*5353+ * The owner has been updated, so there was an unlock->lock5454+ * transition that we missed. That means we can rely on the5555+ * store-release of the unlock operation paired with the5656+ * load-acquire of the lock operation to publish any of our5757+ * previous stores to the new lock owner and therefore don't5858+ * need to bother with the writeback below.5959+ */6060+" b 4f\n"6161+"3:\n"6262+ /*6363+ * Serialise against any concurrent lockers by writing back the6464+ * unlocked lock value6565+ */4066 ARM64_LSE_ATOMIC_INSN(4167 /* LL/SC */4268" stxr %w1, %w0, %2\n"4343-" cbnz %w1, 2b\n", /* Serialise against any concurrent lockers */4444- /* LSE atomics */4569" nop\n"4646-" nop\n")7070+" nop\n",7171+ /* LSE atomics */7272+" mov %w1, %w0\n"7373+" cas %w0, %w0, %2\n"7474+" eor %w1, %w1, %w0\n")7575+ /* Somebody else wrote to the lock, GOTO 10 and reload the value */7676+" cbnz %w1, 2b\n"7777+"4:"4778 : "=&r" (lockval), "=&r" (tmp), "+Q" (*lock)4848- :7979+ : "r" (owner)4980 : "memory");5081}5182···179148180149static inline int arch_spin_is_locked(arch_spinlock_t *lock)181150{151151+ smp_mb(); /* See arch_spin_unlock_wait */182152 return !arch_spin_value_unlocked(READ_ONCE(*lock));183153}184154
+13-1
arch/arm64/kernel/kgdb.c
···5858 { "x30", 8, offsetof(struct pt_regs, regs[30])},5959 { "sp", 8, offsetof(struct pt_regs, sp)},6060 { "pc", 8, offsetof(struct pt_regs, pc)},6161- { "pstate", 8, offsetof(struct pt_regs, pstate)},6161+ /*6262+ * struct pt_regs thinks PSTATE is 64-bits wide but gdb remote6363+ * protocol disagrees. Therefore we must extract only the lower6464+ * 32-bits. Look for the big comment in asm/kgdb.h for more6565+ * detail.6666+ */6767+ { "pstate", 4, offsetof(struct pt_regs, pstate)6868+#ifdef CONFIG_CPU_BIG_ENDIAN6969+ + 47070+#endif7171+ },6272 { "v0", 16, -1 },6373 { "v1", 16, -1 },6474 { "v2", 16, -1 },···138128 memset((char *)gdb_regs, 0, NUMREGBYTES);139129 thread_regs = task_pt_regs(task);140130 memcpy((void *)gdb_regs, (void *)thread_regs->regs, GP_REG_BYTES);131131+ /* Special case for PSTATE (check comments in asm/kgdb.h for details) */132132+ dbg_get_reg(33, gdb_regs + GP_REG_BYTES, thread_regs);141133}142134143135void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)
+13-13
arch/arm64/kernel/traps.c
···64646565 /*6666 * We need to switch to kernel mode so that we can use __get_user6767- * to safely read from kernel space. Note that we now dump the6868- * code first, just in case the backtrace kills us.6767+ * to safely read from kernel space.6968 */7069 fs = get_fs();7170 set_fs(KERNEL_DS);···110111 print_ip_sym(where);111112}112113113113-static void dump_instr(const char *lvl, struct pt_regs *regs)114114+static void __dump_instr(const char *lvl, struct pt_regs *regs)114115{115116 unsigned long addr = instruction_pointer(regs);116116- mm_segment_t fs;117117 char str[sizeof("00000000 ") * 5 + 2 + 1], *p = str;118118 int i;119119-120120- /*121121- * We need to switch to kernel mode so that we can use __get_user122122- * to safely read from kernel space. Note that we now dump the123123- * code first, just in case the backtrace kills us.124124- */125125- fs = get_fs();126126- set_fs(KERNEL_DS);127119128120 for (i = -4; i < 1; i++) {129121 unsigned int val, bad;···129139 }130140 }131141 printk("%sCode: %s\n", lvl, str);142142+}132143133133- set_fs(fs);144144+static void dump_instr(const char *lvl, struct pt_regs *regs)145145+{146146+ if (!user_mode(regs)) {147147+ mm_segment_t fs = get_fs();148148+ set_fs(KERNEL_DS);149149+ __dump_instr(lvl, regs);150150+ set_fs(fs);151151+ } else {152152+ __dump_instr(lvl, regs);153153+ }134154}135155136156static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
+1-1
arch/arm64/mm/fault.c
···441441 return 1;442442}443443444444-static struct fault_info {444444+static const struct fault_info {445445 int (*fn)(unsigned long addr, unsigned int esr, struct pt_regs *regs);446446 int sig;447447 int code;
···16361636 if (index < 0) {16371637 vcpu->arch.host_cp0_entryhi = (va & VPN2_MASK);16381638 vcpu->arch.host_cp0_badvaddr = va;16391639+ vcpu->arch.pc = curr_pc;16391640 er = kvm_mips_emulate_tlbmiss_ld(cause, NULL, run,16401641 vcpu);16411642 preempt_enable();···16481647 * invalid exception to the guest16491648 */16501649 if (!TLB_IS_VALID(*tlb, va)) {16501650+ vcpu->arch.host_cp0_badvaddr = va;16511651+ vcpu->arch.pc = curr_pc;16511652 er = kvm_mips_emulate_tlbinv_ld(cause, NULL,16521653 run, vcpu);16531654 preempt_enable();···16691666 cache, op, base, arch->gprs[base], offset);16701667 er = EMULATE_FAIL;16711668 preempt_enable();16721672- goto dont_update_pc;16691669+ goto done;1673167016741671 }16751672···16971694 kvm_err("NO-OP CACHE (cache: %#x, op: %#x, base[%d]: %#lx, offset: %#x\n",16981695 cache, op, base, arch->gprs[base], offset);16991696 er = EMULATE_FAIL;17001700- preempt_enable();17011701- goto dont_update_pc;17021697 }1703169817041699 preempt_enable();17001700+done:17011701+ /* Rollback PC only if emulation was unsuccessful */17021702+ if (er == EMULATE_FAIL)17031703+ vcpu->arch.pc = curr_pc;1705170417061705dont_update_pc:17071707- /* Rollback PC */17081708- vcpu->arch.pc = curr_pc;17091709-done:17061706+ /*17071707+ * This is for exceptions whose emulation updates the PC, so do not17081708+ * overwrite the PC under any circumstances17091709+ */17101710+17101711 return er;17111712}17121713
+1
arch/mips/kvm/interrupt.h
···2828#define MIPS_EXC_MAX 122929/* XXXSL More to follow */30303131+extern char __kvm_mips_vcpu_run_end[];3132extern char mips32_exception[], mips32_exceptionEnd[];3233extern char mips32_GuestException[], mips32_GuestExceptionEnd[];3334
+1
arch/mips/kvm/locore.S
···202202203203 /* Jump to guest */204204 eret205205+EXPORT(__kvm_mips_vcpu_run_end)205206206207VECTOR(MIPSX(exception), unknown)207208/* Find out what mode we came from and jump to the proper handler. */
+10-1
arch/mips/kvm/mips.c
···315315 memcpy(gebase + offset, mips32_GuestException,316316 mips32_GuestExceptionEnd - mips32_GuestException);317317318318+#ifdef MODULE319319+ offset += mips32_GuestExceptionEnd - mips32_GuestException;320320+ memcpy(gebase + offset, (char *)__kvm_mips_vcpu_run,321321+ __kvm_mips_vcpu_run_end - (char *)__kvm_mips_vcpu_run);322322+ vcpu->arch.vcpu_run = gebase + offset;323323+#else324324+ vcpu->arch.vcpu_run = __kvm_mips_vcpu_run;325325+#endif326326+318327 /* Invalidate the icache for these ranges */319328 local_flush_icache_range((unsigned long)gebase,320329 (unsigned long)gebase + ALIGN(size, PAGE_SIZE));···413404 /* Disable hardware page table walking while in guest */414405 htw_stop();415406416416- r = __kvm_mips_vcpu_run(run, vcpu);407407+ r = vcpu->arch.vcpu_run(run, vcpu);417408418409 /* Re-enable HTW before enabling interrupts */419410 htw_start();
···2439243924402440source "drivers/pci/Kconfig"2441244124422442+config ISA_BUS24432443+ bool "ISA-style bus support on modern systems" if EXPERT24442444+ select ISA_BUS_API24452445+ help24462446+ Enables ISA-style drivers on modern systems. This is necessary to24472447+ support PC/104 devices on X86_64 platforms.24482448+24492449+ If unsure, say N.24502450+24422451# x86_64 have no ISA slots, but can have ISA-style DMA.24432452config ISA_DMA_API24442453 bool "ISA-style DMA support" if (X86_64 && EXPERT)
···238238239239/* enable / disable AVIC */240240static int avic;241241+#ifdef CONFIG_X86_LOCAL_APIC241242module_param(avic, int, S_IRUGO);243243+#endif242244243245static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0);244246static void svm_flush_tlb(struct kvm_vcpu *vcpu);···983981 } else984982 kvm_disable_tdp();985983986986- if (avic && (!npt_enabled || !boot_cpu_has(X86_FEATURE_AVIC)))987987- avic = false;988988-989989- if (avic)990990- pr_info("AVIC enabled\n");984984+ if (avic) {985985+ if (!npt_enabled ||986986+ !boot_cpu_has(X86_FEATURE_AVIC) ||987987+ !IS_ENABLED(CONFIG_X86_LOCAL_APIC))988988+ avic = false;989989+ else990990+ pr_info("AVIC enabled\n");991991+ }991992992993 return 0;993994···13291324static void avic_set_running(struct kvm_vcpu *vcpu, bool is_run)13301325{13311326 u64 entry;13321332- int h_physical_id = __default_cpu_present_to_apicid(vcpu->cpu);13271327+ int h_physical_id = kvm_cpu_get_apicid(vcpu->cpu);13331328 struct vcpu_svm *svm = to_svm(vcpu);1334132913351330 if (!kvm_vcpu_apicv_active(vcpu))···13541349{13551350 u64 entry;13561351 /* ID = 0xff (broadcast), ID > 0xff (reserved) */13571357- int h_physical_id = __default_cpu_present_to_apicid(cpu);13521352+ int h_physical_id = kvm_cpu_get_apicid(cpu);13581353 struct vcpu_svm *svm = to_svm(vcpu);1359135413601355 if (!kvm_vcpu_apicv_active(vcpu))···4241423642424237 if (avic_vcpu_is_running(vcpu))42434238 wrmsrl(SVM_AVIC_DOORBELL,42444244- __default_cpu_present_to_apicid(vcpu->cpu));42394239+ kvm_cpu_get_apicid(vcpu->cpu));42454240 else42464241 kvm_vcpu_wake_up(vcpu);42474242}
+10-5
arch/x86/kvm/vmx.c
···20722072 unsigned int dest;2073207320742074 if (!kvm_arch_has_assigned_device(vcpu->kvm) ||20752075- !irq_remapping_cap(IRQ_POSTING_CAP))20752075+ !irq_remapping_cap(IRQ_POSTING_CAP) ||20762076+ !kvm_vcpu_apicv_active(vcpu))20762077 return;2077207820782079 do {···21812180 struct pi_desc *pi_desc = vcpu_to_pi_desc(vcpu);2182218121832182 if (!kvm_arch_has_assigned_device(vcpu->kvm) ||21842184- !irq_remapping_cap(IRQ_POSTING_CAP))21832183+ !irq_remapping_cap(IRQ_POSTING_CAP) ||21842184+ !kvm_vcpu_apicv_active(vcpu))21852185 return;2186218621872187 /* Set SN when the vCPU is preempted */···1071610714 struct pi_desc *pi_desc = vcpu_to_pi_desc(vcpu);10717107151071810716 if (!kvm_arch_has_assigned_device(vcpu->kvm) ||1071910719- !irq_remapping_cap(IRQ_POSTING_CAP))1071710717+ !irq_remapping_cap(IRQ_POSTING_CAP) ||1071810718+ !kvm_vcpu_apicv_active(vcpu))1072010719 return 0;10721107201072210721 vcpu->pre_pcpu = vcpu->cpu;···1078310780 unsigned long flags;10784107811078510782 if (!kvm_arch_has_assigned_device(vcpu->kvm) ||1078610786- !irq_remapping_cap(IRQ_POSTING_CAP))1078310783+ !irq_remapping_cap(IRQ_POSTING_CAP) ||1078410784+ !kvm_vcpu_apicv_active(vcpu))1078710785 return;10788107861078910787 do {···1083710833 int idx, ret = -EINVAL;10838108341083910835 if (!kvm_arch_has_assigned_device(kvm) ||1084010840- !irq_remapping_cap(IRQ_POSTING_CAP))1083610836+ !irq_remapping_cap(IRQ_POSTING_CAP) ||1083710837+ !kvm_vcpu_apicv_active(kvm->vcpus[0]))1084110838 return 0;10842108391084310840 idx = srcu_read_lock(&kvm->irq_srcu);
+9-3
block/blk-lib.c
···113113 ret = submit_bio_wait(type, bio);114114 if (ret == -EOPNOTSUPP)115115 ret = 0;116116+ bio_put(bio);116117 }117118 blk_finish_plug(&plug);118119···166165 }167166 }168167169169- if (bio)168168+ if (bio) {170169 ret = submit_bio_wait(REQ_WRITE | REQ_WRITE_SAME, bio);170170+ bio_put(bio);171171+ }171172 return ret != -EOPNOTSUPP ? ret : 0;172173}173174EXPORT_SYMBOL(blkdev_issue_write_same);···209206 }210207 }211208212212- if (bio)213213- return submit_bio_wait(WRITE, bio);209209+ if (bio) {210210+ ret = submit_bio_wait(WRITE, bio);211211+ bio_put(bio);212212+ return ret;213213+ }214214 return 0;215215}216216
+8-9
block/blk-mq.c
···1262126212631263 blk_queue_split(q, &bio, q->bio_split);1264126412651265- if (!is_flush_fua && !blk_queue_nomerges(q)) {12661266- if (blk_attempt_plug_merge(q, bio, &request_count,12671267- &same_queue_rq))12681268- return BLK_QC_T_NONE;12691269- } else12701270- request_count = blk_plug_queued_count(q);12651265+ if (!is_flush_fua && !blk_queue_nomerges(q) &&12661266+ blk_attempt_plug_merge(q, bio, &request_count, &same_queue_rq))12671267+ return BLK_QC_T_NONE;1271126812721269 rq = blk_mq_map_request(q, bio, &data);12731270 if (unlikely(!rq))···1355135813561359 blk_queue_split(q, &bio, q->bio_split);1357136013581358- if (!is_flush_fua && !blk_queue_nomerges(q) &&13591359- blk_attempt_plug_merge(q, bio, &request_count, NULL))13601360- return BLK_QC_T_NONE;13611361+ if (!is_flush_fua && !blk_queue_nomerges(q)) {13621362+ if (blk_attempt_plug_merge(q, bio, &request_count, NULL))13631363+ return BLK_QC_T_NONE;13641364+ } else13651365+ request_count = blk_plug_queued_count(q);1361136613621367 rq = blk_mq_map_request(q, bio, &data);13631368 if (unlikely(!rq))
+8-136
drivers/acpi/acpica/hwregs.c
···306306acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)307307{308308 u64 address;309309- u8 access_width;310310- u32 bit_width;311311- u8 bit_offset;312312- u64 value64;313313- u32 new_value32, old_value32;314314- u8 index;315309 acpi_status status;316310317311 ACPI_FUNCTION_NAME(hw_write);···317323 return (status);318324 }319325320320- /* Convert access_width into number of bits based */321321-322322- access_width = acpi_hw_get_access_bit_width(reg, 32);323323- bit_width = reg->bit_offset + reg->bit_width;324324- bit_offset = reg->bit_offset;325325-326326 /*327327 * Two address spaces supported: Memory or IO. PCI_Config is328328 * not supported here because the GAS structure is insufficient329329 */330330- index = 0;331331- while (bit_width) {332332- /*333333- * Use offset style bit reads because "Index * AccessWidth" is334334- * ensured to be less than 32-bits by acpi_hw_validate_register().335335- */336336- new_value32 = ACPI_GET_BITS(&value, index * access_width,337337- ACPI_MASK_BITS_ABOVE_32338338- (access_width));330330+ if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {331331+ status = acpi_os_write_memory((acpi_physical_address)332332+ address, (u64)value,333333+ reg->bit_width);334334+ } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */339335340340- if (bit_offset >= access_width) {341341- bit_offset -= access_width;342342- } else {343343- /*344344- * Use offset style bit masks because access_width is ensured345345- * to be less than 32-bits by acpi_hw_validate_register() and346346- * bit_offset/bit_width is less than access_width here.347347- */348348- if (bit_offset) {349349- new_value32 &= ACPI_MASK_BITS_BELOW(bit_offset);350350- }351351- if (bit_width < access_width) {352352- new_value32 &= ACPI_MASK_BITS_ABOVE(bit_width);353353- }354354-355355- if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {356356- if (bit_offset || bit_width < access_width) {357357- /*358358- * Read old values in order not to modify the bits that359359- * are beyond the register bit_width/bit_offset setting.360360- */361361- status =362362- acpi_os_read_memory((acpi_physical_address)363363- address +364364- index *365365- ACPI_DIV_8366366- (access_width),367367- &value64,368368- access_width);369369- old_value32 = (u32)value64;370370-371371- /*372372- * Use offset style bit masks because access_width is373373- * ensured to be less than 32-bits by374374- * acpi_hw_validate_register() and bit_offset/bit_width is375375- * less than access_width here.376376- */377377- if (bit_offset) {378378- old_value32 &=379379- ACPI_MASK_BITS_ABOVE380380- (bit_offset);381381- bit_offset = 0;382382- }383383- if (bit_width < access_width) {384384- old_value32 &=385385- ACPI_MASK_BITS_BELOW386386- (bit_width);387387- }388388-389389- new_value32 |= old_value32;390390- }391391-392392- value64 = (u64)new_value32;393393- status =394394- acpi_os_write_memory((acpi_physical_address)395395- address +396396- index *397397- ACPI_DIV_8398398- (access_width),399399- value64, access_width);400400- } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */401401-402402- if (bit_offset || bit_width < access_width) {403403- /*404404- * Read old values in order not to modify the bits that405405- * are beyond the register bit_width/bit_offset setting.406406- */407407- status =408408- acpi_hw_read_port((acpi_io_address)409409- address +410410- index *411411- ACPI_DIV_8412412- (access_width),413413- &old_value32,414414- access_width);415415-416416- /*417417- * Use offset style bit masks because access_width is418418- * ensured to be less than 32-bits by419419- * acpi_hw_validate_register() and bit_offset/bit_width is420420- * less than access_width here.421421- */422422- if (bit_offset) {423423- old_value32 &=424424- ACPI_MASK_BITS_ABOVE425425- (bit_offset);426426- bit_offset = 0;427427- }428428- if (bit_width < access_width) {429429- old_value32 &=430430- ACPI_MASK_BITS_BELOW431431- (bit_width);432432- }433433-434434- new_value32 |= old_value32;435435- }436436-437437- status = acpi_hw_write_port((acpi_io_address)438438- address +439439- index *440440- ACPI_DIV_8441441- (access_width),442442- new_value32,443443- access_width);444444- }445445- }446446-447447- /*448448- * Index * access_width is ensured to be less than 32-bits by449449- * acpi_hw_validate_register().450450- */451451- bit_width -=452452- bit_width > access_width ? access_width : bit_width;453453- index++;336336+ status = acpi_hw_write_port((acpi_io_address)337337+ address, value, reg->bit_width);454338 }455339456340 ACPI_DEBUG_PRINT((ACPI_DB_IO,457341 "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",458458- value, access_width, ACPI_FORMAT_UINT64(address),342342+ value, reg->bit_width, ACPI_FORMAT_UINT64(address),459343 acpi_ut_get_region_name(reg->space_id)));460344461345 return (status);
···211211 }212212213213 /* Mark opp-table as multiple CPUs are sharing it now */214214- opp_table->shared_opp = true;214214+ opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED;215215 }216216unlock:217217 mutex_unlock(&opp_table_lock);···227227 *228228 * This updates the @cpumask with CPUs that are sharing OPPs with @cpu_dev.229229 *230230- * Returns -ENODEV if OPP table isn't already present.230230+ * Returns -ENODEV if OPP table isn't already present and -EINVAL if the OPP231231+ * table's status is access-unknown.231232 *232233 * Locking: The internal opp_table and opp structures are RCU protected.233234 * Hence this function internally uses RCU updater strategy with mutex locks···250249 goto unlock;251250 }252251252252+ if (opp_table->shared_opp == OPP_TABLE_ACCESS_UNKNOWN) {253253+ ret = -EINVAL;254254+ goto unlock;255255+ }256256+253257 cpumask_clear(cpumask);254258255255- if (opp_table->shared_opp) {259259+ if (opp_table->shared_opp == OPP_TABLE_ACCESS_SHARED) {256260 list_for_each_entry(opp_dev, &opp_table->dev_list, node)257261 cpumask_set_cpu(opp_dev->dev->id, cpumask);258262 } else {
+8-2
drivers/base/power/opp/of.c
···3434 * But the OPPs will be considered as shared only if the3535 * OPP table contains a "opp-shared" property.3636 */3737- return opp_table->shared_opp ? opp_table : NULL;3737+ if (opp_table->shared_opp == OPP_TABLE_ACCESS_SHARED)3838+ return opp_table;3939+4040+ return NULL;3841 }3942 }4043···356353 }357354358355 opp_table->np = opp_np;359359- opp_table->shared_opp = of_property_read_bool(opp_np, "opp-shared");356356+ if (of_property_read_bool(opp_np, "opp-shared"))357357+ opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED;358358+ else359359+ opp_table->shared_opp = OPP_TABLE_ACCESS_EXCLUSIVE;360360361361 mutex_unlock(&opp_table_lock);362362
+7-1
drivers/base/power/opp/opp.h
···119119#endif120120};121121122122+enum opp_table_access {123123+ OPP_TABLE_ACCESS_UNKNOWN = 0,124124+ OPP_TABLE_ACCESS_EXCLUSIVE = 1,125125+ OPP_TABLE_ACCESS_SHARED = 2,126126+};127127+122128/**123129 * struct opp_table - Device opp structure124130 * @node: table node - contains the devices with OPPs that···172166 /* For backward compatibility with v1 bindings */173167 unsigned int voltage_tolerance_v1;174168175175- bool shared_opp;169169+ enum opp_table_access shared_opp;176170 struct dev_pm_opp *suspend_opp;177171178172 unsigned int *supported_hw;
···874874 const struct blk_mq_queue_data *qd)875875{876876 unsigned long flags;877877- struct blkfront_ring_info *rinfo = (struct blkfront_ring_info *)hctx->driver_data;877877+ int qid = hctx->queue_num;878878+ struct blkfront_info *info = hctx->queue->queuedata;879879+ struct blkfront_ring_info *rinfo = NULL;878880881881+ BUG_ON(info->nr_rings <= qid);882882+ rinfo = &info->rinfo[qid];879883 blk_mq_start_request(qd->rq);880884 spin_lock_irqsave(&rinfo->ring_lock, flags);881885 if (RING_FULL(&rinfo->ring))···905901 return BLK_MQ_RQ_QUEUE_BUSY;906902}907903908908-static int blk_mq_init_hctx(struct blk_mq_hw_ctx *hctx, void *data,909909- unsigned int index)910910-{911911- struct blkfront_info *info = (struct blkfront_info *)data;912912-913913- BUG_ON(info->nr_rings <= index);914914- hctx->driver_data = &info->rinfo[index];915915- return 0;916916-}917917-918904static struct blk_mq_ops blkfront_mq_ops = {919905 .queue_rq = blkif_queue_rq,920906 .map_queue = blk_mq_map_queue,921921- .init_hctx = blk_mq_init_hctx,922907};923908924909static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size,···943950 return PTR_ERR(rq);944951 }945952953953+ rq->queuedata = info;946954 queue_flag_set_unlocked(QUEUE_FLAG_VIRT, rq);947955948956 if (info->feature_discard) {···21432149 return err;2144215021452151 err = talk_to_blkback(dev, info);21522152+ if (!err)21532153+ blk_mq_update_nr_hw_queues(&info->tag_set, info->nr_rings);2146215421472155 /*21482156 * We have to wait for the backend to switch to···24812485 break;2482248624832487 case XenbusStateConnected:24842484- if (dev->state != XenbusStateInitialised) {24882488+ /*24892489+ * talk_to_blkback sets state to XenbusStateInitialised24902490+ * and blkfront_connect sets it to XenbusStateConnected24912491+ * (if connection went OK).24922492+ *24932493+ * If the backend (or toolstack) decides to poke at backend24942494+ * state (and re-trigger the watch by setting the state repeatedly24952495+ * to XenbusStateConnected (4)) we need to deal with this.24962496+ * This is allowed as this is used to communicate to the guest24972497+ * that the size of disk has changed!24982498+ */24992499+ if ((dev->state != XenbusStateInitialised) &&25002500+ (dev->state != XenbusStateConnected)) {24852501 if (talk_to_blkback(dev, info))24862502 break;24872503 }25042504+24882505 blkfront_connect(info);24892506 break;24902507
+6-2
drivers/char/ipmi/ipmi_msghandler.c
···38203820 while (!list_empty(&intf->waiting_rcv_msgs)) {38213821 smi_msg = list_entry(intf->waiting_rcv_msgs.next,38223822 struct ipmi_smi_msg, link);38233823+ list_del(&smi_msg->link);38233824 if (!run_to_completion)38243825 spin_unlock_irqrestore(&intf->waiting_rcv_msgs_lock,38253826 flags);···38303829 if (rv > 0) {38313830 /*38323831 * To preserve message order, quit if we38333833- * can't handle a message.38323832+ * can't handle a message. Add the message38333833+ * back at the head, this is safe because this38343834+ * tasklet is the only thing that pulls the38353835+ * messages.38343836 */38373837+ list_add(&smi_msg->link, &intf->waiting_rcv_msgs);38353838 break;38363839 } else {38373837- list_del(&smi_msg->link);38383840 if (rv == 0)38393841 /* Message handled */38403842 ipmi_free_smi_msg(smi_msg);
+2-20
drivers/cpufreq/intel_pstate.c
···372372 return acpi_ppc;373373}374374375375-/*376376- * The max target pstate ratio is a 8 bit value in both PLATFORM_INFO MSR and377377- * in TURBO_RATIO_LIMIT MSR, which pstate driver stores in max_pstate and378378- * max_turbo_pstate fields. The PERF_CTL MSR contains 16 bit value for P state379379- * ratio, out of it only high 8 bits are used. For example 0x1700 is setting380380- * target ratio 0x17. The _PSS control value stores in a format which can be381381- * directly written to PERF_CTL MSR. But in intel_pstate driver this shift382382- * occurs during write to PERF_CTL (E.g. for cores core_set_pstate()).383383- * This function converts the _PSS control value to intel pstate driver format384384- * for comparison and assignment.385385- */386386-static int convert_to_native_pstate_format(struct cpudata *cpu, int index)387387-{388388- return cpu->acpi_perf_data.states[index].control >> 8;389389-}390390-391375static void intel_pstate_init_acpi_perf_limits(struct cpufreq_policy *policy)392376{393377 struct cpudata *cpu;394394- int turbo_pss_ctl;395378 int ret;396379 int i;397380···424441 * max frequency, which will cause a reduced performance as425442 * this driver uses real max turbo frequency as the max426443 * frequency. So correct this frequency in _PSS table to427427- * correct max turbo frequency based on the turbo ratio.444444+ * correct max turbo frequency based on the turbo state.428445 * Also need to convert to MHz as _PSS freq is in MHz.429446 */430430- turbo_pss_ctl = convert_to_native_pstate_format(cpu, 0);431431- if (turbo_pss_ctl > cpu->pstate.max_pstate)447447+ if (!limits->turbo_disabled)432448 cpu->acpi_perf_data.states[0].core_frequency =433449 policy->cpuinfo.max_freq / 1000;434450 cpu->valid_pss_table = true;
+57-25
drivers/dma/at_xdmac.c
···242242 u32 mbr_dus; /* Destination Microblock Stride Register */243243};244244245245-245245+/* 64-bit alignment needed to update CNDA and CUBC registers in an atomic way. */246246struct at_xdmac_desc {247247 struct at_xdmac_lld lld;248248 enum dma_transfer_direction direction;···253253 unsigned int xfer_size;254254 struct list_head descs_list;255255 struct list_head xfer_node;256256-};256256+} __aligned(sizeof(u64));257257258258static inline void __iomem *at_xdmac_chan_reg_base(struct at_xdmac *atxdmac, unsigned int chan_nb)259259{···14001400 u32 cur_nda, check_nda, cur_ubc, mask, value;14011401 u8 dwidth = 0;14021402 unsigned long flags;14031403+ bool initd;1403140414041405 ret = dma_cookie_status(chan, cookie, txstate);14051406 if (ret == DMA_COMPLETE)···14251424 residue = desc->xfer_size;14261425 /*14271426 * Flush FIFO: only relevant when the transfer is source peripheral14281428- * synchronized.14271427+ * synchronized. Flush is needed before reading CUBC because data in14281428+ * the FIFO are not reported by CUBC. Reporting a residue of the14291429+ * transfer length while we have data in FIFO can cause issue.14301430+ * Usecase: atmel USART has a timeout which means I have received14311431+ * characters but there is no more character received for a while. On14321432+ * timeout, it requests the residue. If the data are in the DMA FIFO,14331433+ * we will return a residue of the transfer length. It means no data14341434+ * received. If an application is waiting for these data, it will hang14351435+ * since we won't have another USART timeout without receiving new14361436+ * data.14291437 */14301438 mask = AT_XDMAC_CC_TYPE | AT_XDMAC_CC_DSYNC;14311439 value = AT_XDMAC_CC_TYPE_PER_TRAN | AT_XDMAC_CC_DSYNC_PER2MEM;···14451435 }1446143614471437 /*14481448- * When processing the residue, we need to read two registers but we14491449- * can't do it in an atomic way. AT_XDMAC_CNDA is used to find where14501450- * we stand in the descriptor list and AT_XDMAC_CUBC is used14511451- * to know how many data are remaining for the current descriptor.14521452- * Since the dma channel is not paused to not loose data, between the14531453- * AT_XDMAC_CNDA and AT_XDMAC_CUBC read, we may have change of14541454- * descriptor.14551455- * For that reason, after reading AT_XDMAC_CUBC, we check if we are14561456- * still using the same descriptor by reading a second time14571457- * AT_XDMAC_CNDA. If AT_XDMAC_CNDA has changed, it means we have to14581458- * read again AT_XDMAC_CUBC.14381438+ * The easiest way to compute the residue should be to pause the DMA14391439+ * but doing this can lead to miss some data as some devices don't14401440+ * have FIFO.14411441+ * We need to read several registers because:14421442+ * - DMA is running therefore a descriptor change is possible while14431443+ * reading these registers14441444+ * - When the block transfer is done, the value of the CUBC register14451445+ * is set to its initial value until the fetch of the next descriptor.14461446+ * This value will corrupt the residue calculation so we have to skip14471447+ * it.14481448+ *14491449+ * INITD -------- ------------14501450+ * |____________________|14511451+ * _______________________ _______________14521452+ * NDA @desc2 \/ @desc314531453+ * _______________________/\_______________14541454+ * __________ ___________ _______________14551455+ * CUBC 0 \/ MAX desc1 \/ MAX desc214561456+ * __________/\___________/\_______________14571457+ *14581458+ * Since descriptors are aligned on 64 bits, we can assume that14591459+ * the update of NDA and CUBC is atomic.14591460 * Memory barriers are used to ensure the read order of the registers.14601460- * A max number of retries is set because unlikely it can never ends if14611461- * we are transferring a lot of data with small buffers.14611461+ * A max number of retries is set because unlikely it could never ends.14621462 */14631463- cur_nda = at_xdmac_chan_read(atchan, AT_XDMAC_CNDA) & 0xfffffffc;14641464- rmb();14651465- cur_ubc = at_xdmac_chan_read(atchan, AT_XDMAC_CUBC);14661463 for (retry = 0; retry < AT_XDMAC_RESIDUE_MAX_RETRIES; retry++) {14671467- rmb();14681464 check_nda = at_xdmac_chan_read(atchan, AT_XDMAC_CNDA) & 0xfffffffc;14691469-14701470- if (likely(cur_nda == check_nda))14711471- break;14721472-14731473- cur_nda = check_nda;14651465+ rmb();14661466+ initd = !!(at_xdmac_chan_read(atchan, AT_XDMAC_CC) & AT_XDMAC_CC_INITD);14741467 rmb();14751468 cur_ubc = at_xdmac_chan_read(atchan, AT_XDMAC_CUBC);14691469+ rmb();14701470+ cur_nda = at_xdmac_chan_read(atchan, AT_XDMAC_CNDA) & 0xfffffffc;14711471+ rmb();14721472+14731473+ if ((check_nda == cur_nda) && initd)14741474+ break;14761475 }1477147614781477 if (unlikely(retry >= AT_XDMAC_RESIDUE_MAX_RETRIES)) {14791478 ret = DMA_ERROR;14801479 goto spin_unlock;14801480+ }14811481+14821482+ /*14831483+ * Flush FIFO: only relevant when the transfer is source peripheral14841484+ * synchronized. Another flush is needed here because CUBC is updated14851485+ * when the controller sends the data write command. It can lead to14861486+ * report data that are not written in the memory or the device. The14871487+ * FIFO flush ensures that data are really written.14881488+ */14891489+ if ((desc->lld.mbr_cfg & mask) == value) {14901490+ at_xdmac_write(atxdmac, AT_XDMAC_GSWF, atchan->mask);14911491+ while (!(at_xdmac_chan_read(atchan, AT_XDMAC_CIS) & AT_XDMAC_CIS_FIS))14921492+ cpu_relax();14811493 }1482149414831495 /*
···33333434menuconfig GPIOLIB3535 bool "GPIO Support"3636+ select ANON_INODES3637 help3738 This enables GPIO support through the generic GPIO library.3839 You only need to enable this, if you also want to enable···531530532531config GPIO_104_DIO_48E533532 tristate "ACCES 104-DIO-48E GPIO support"534534- depends on ISA533533+ depends on ISA_BUS_API535534 select GPIOLIB_IRQCHIP536535 help537536 Enables GPIO support for the ACCES 104-DIO-48E series (104-DIO-48E,···541540542541config GPIO_104_IDIO_16543542 tristate "ACCES 104-IDIO-16 GPIO support"544544- depends on ISA543543+ depends on ISA_BUS_API545544 select GPIOLIB_IRQCHIP546545 help547546 Enables GPIO support for the ACCES 104-IDIO-16 family (104-IDIO-16,···552551553552config GPIO_104_IDI_48554553 tristate "ACCES 104-IDI-48 GPIO support"555555- depends on ISA554554+ depends on ISA_BUS_API556555 select GPIOLIB_IRQCHIP557556 help558557 Enables GPIO support for the ACCES 104-IDI-48 family (104-IDI-48A,···628627629628config GPIO_WS16C48630629 tristate "WinSystems WS16C48 GPIO support"631631- depends on ISA630630+ depends on ISA_BUS_API632631 select GPIOLIB_IRQCHIP633632 help634633 Enables GPIO support for the WinSystems WS16C48. The base port
···547547 /* disable interrupts and clear status */548548 for (i = 0; i < kona_gpio->num_bank; i++) {549549 /* Unlock the entire bank first */550550- bcm_kona_gpio_write_lock_regs(kona_gpio, i, UNLOCK_CODE);550550+ bcm_kona_gpio_write_lock_regs(reg_base, i, UNLOCK_CODE);551551 writel(0xffffffff, reg_base + GPIO_INT_MASK(i));552552 writel(0xffffffff, reg_base + GPIO_INT_STATUS(i));553553 /* Now re-lock the bank */554554- bcm_kona_gpio_write_lock_regs(kona_gpio, i, LOCK_CODE);554554+ bcm_kona_gpio_write_lock_regs(reg_base, i, LOCK_CODE);555555 }556556}557557
+7
drivers/gpio/gpio-zynq.c
···709709 dev_err(&pdev->dev, "input clock not found.\n");710710 return PTR_ERR(gpio->clk);711711 }712712+ ret = clk_prepare_enable(gpio->clk);713713+ if (ret) {714714+ dev_err(&pdev->dev, "Unable to enable clock.\n");715715+ return ret;716716+ }712717718718+ pm_runtime_set_active(&pdev->dev);713719 pm_runtime_enable(&pdev->dev);714720 ret = pm_runtime_get_sync(&pdev->dev);715721 if (ret < 0)···753747 pm_runtime_put(&pdev->dev);754748err_pm_dis:755749 pm_runtime_disable(&pdev->dev);750750+ clk_disable_unprepare(gpio->clk);756751757752 return ret;758753}
···449449{450450 struct gpio_device *gdev = dev_get_drvdata(dev);451451452452- cdev_del(&gdev->chrdev);453452 list_del(&gdev->list);454453 ida_simple_remove(&gpio_ida, gdev->id);455454 kfree(gdev->label);···481482482483 /* From this point, the .release() function cleans up gpio_device */483484 gdev->dev.release = gpiodevice_release;484484- get_device(&gdev->dev);485485 pr_debug("%s: registered GPIOs %d to %d on device: %s (%s)\n",486486 __func__, gdev->base, gdev->base + gdev->ngpio - 1,487487 dev_name(&gdev->dev), gdev->chip->label ? : "generic");···768770 * be removed, else it will be dangling until the last user is769771 * gone.770772 */773773+ cdev_del(&gdev->chrdev);774774+ device_del(&gdev->dev);771775 put_device(&gdev->dev);772776}773777EXPORT_SYMBOL_GPL(gpiochip_remove);···869869870870 spin_lock_irqsave(&gpio_lock, flags);871871 list_for_each_entry(gdev, &gpio_devices, list)872872- if (match(gdev->chip, data))872872+ if (gdev->chip && match(gdev->chip, data))873873 break;874874875875 /* No match? */
···13851385 return 0;13861386}1387138713881388+static bool amdgpu_device_is_virtual(void)13891389+{13901390+#ifdef CONFIG_X8613911391+ return boot_cpu_has(X86_FEATURE_HYPERVISOR);13921392+#else13931393+ return false;13941394+#endif13951395+}13961396+13881397/**13891398 * amdgpu_device_init - initialize the driver13901399 *···15281519 adev->virtualization.supports_sr_iov =15291520 amdgpu_atombios_has_gpu_virtualization_table(adev);1530152115221522+ /* Check if we are executing in a virtualized environment */15231523+ adev->virtualization.is_virtual = amdgpu_device_is_virtual();15241524+ adev->virtualization.caps = amdgpu_asic_get_virtual_caps(adev);15251525+15311526 /* Post card if necessary */15321532- if (!amdgpu_card_posted(adev)) {15271527+ if (!amdgpu_card_posted(adev) ||15281528+ (adev->virtualization.is_virtual &&15291529+ !adev->virtualization.caps & AMDGPU_VIRT_CAPS_SRIOV_EN)) {15331530 if (!adev->bios) {15341531 dev_err(adev->dev, "Card not posted and no BIOS - ignoring\n");15351532 return -EINVAL;
+2-7
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
···122122 bool skip_preamble, need_ctx_switch;123123 unsigned patch_offset = ~0;124124 struct amdgpu_vm *vm;125125- int vmid = 0, old_vmid = ring->vmid;126125 struct fence *hwf;127126 uint64_t ctx;128127···135136 if (job) {136137 vm = job->vm;137138 ctx = job->ctx;138138- vmid = job->vm_id;139139 } else {140140 vm = NULL;141141 ctx = 0;142142- vmid = 0;143142 }144143145144 if (!ring->ready) {···163166 r = amdgpu_vm_flush(ring, job->vm_id, job->vm_pd_addr,164167 job->gds_base, job->gds_size,165168 job->gws_base, job->gws_size,166166- job->oa_base, job->oa_size,167167- (ring->current_ctx == ctx) && (old_vmid != vmid));169169+ job->oa_base, job->oa_size);168170 if (r) {169171 amdgpu_ring_undo(ring);170172 return r;···180184 need_ctx_switch = ring->current_ctx != ctx;181185 for (i = 0; i < num_ibs; ++i) {182186 ib = &ibs[i];187187+183188 /* drop preamble IBs if we don't have a context switch */184189 if ((ib->flags & AMDGPU_IB_FLAG_PREAMBLE) && skip_preamble)185190 continue;···188191 amdgpu_ring_emit_ib(ring, ib, job ? job->vm_id : 0,189192 need_ctx_switch);190193 need_ctx_switch = false;191191- ring->vmid = vmid;192194 }193195194196 if (ring->funcs->emit_hdp_invalidate)···198202 dev_err(adev->dev, "failed to emit fence (%d)\n", r);199203 if (job && job->vm_id)200204 amdgpu_vm_reset_id(adev, job->vm_id);201201- ring->vmid = old_vmid;202205 amdgpu_ring_undo(ring);203206 return r;204207 }
···962962 return true;963963}964964965965+static u32 cik_get_virtual_caps(struct amdgpu_device *adev)966966+{967967+ /* CIK does not support SR-IOV */968968+ return 0;969969+}970970+965971static const struct amdgpu_allowed_register_entry cik_allowed_read_registers[] = {966972 {mmGRBM_STATUS, false},967973 {mmGB_ADDR_CONFIG, false},···20132007 .get_xclk = &cik_get_xclk,20142008 .set_uvd_clocks = &cik_set_uvd_clocks,20152009 .set_vce_clocks = &cik_set_vce_clocks,20102010+ .get_virtual_caps = &cik_get_virtual_caps,20162011 /* these should be moved to their own ip modules */20172012 .get_gpu_clock_counter = &gfx_v7_0_get_gpu_clock_counter,20182013 .wait_for_mc_idle = &gmc_v7_0_mc_wait_for_idle,
+1-1
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
···48334833 case 2:48344834 for (i = 0; i < adev->gfx.num_compute_rings; i++) {48354835 ring = &adev->gfx.compute_ring[i];48364836- if ((ring->me == me_id) & (ring->pipe == pipe_id))48364836+ if ((ring->me == me_id) && (ring->pipe == pipe_id))48374837 amdgpu_fence_process(ring);48384838 }48394839 break;
+15
drivers/gpu/drm/amd/amdgpu/vi.c
···421421 return true;422422}423423424424+static u32 vi_get_virtual_caps(struct amdgpu_device *adev)425425+{426426+ u32 caps = 0;427427+ u32 reg = RREG32(mmBIF_IOV_FUNC_IDENTIFIER);428428+429429+ if (REG_GET_FIELD(reg, BIF_IOV_FUNC_IDENTIFIER, IOV_ENABLE))430430+ caps |= AMDGPU_VIRT_CAPS_SRIOV_EN;431431+432432+ if (REG_GET_FIELD(reg, BIF_IOV_FUNC_IDENTIFIER, FUNC_IDENTIFIER))433433+ caps |= AMDGPU_VIRT_CAPS_IS_VF;434434+435435+ return caps;436436+}437437+424438static const struct amdgpu_allowed_register_entry tonga_allowed_read_registers[] = {425439 {mmGB_MACROTILE_MODE7, true},426440};···11321118 .get_xclk = &vi_get_xclk,11331119 .set_uvd_clocks = &vi_set_uvd_clocks,11341120 .set_vce_clocks = &vi_set_vce_clocks,11211121+ .get_virtual_caps = &vi_get_virtual_caps,11351122 /* these should be moved to their own ip modules */11361123 .get_gpu_clock_counter = &gfx_v8_0_get_gpu_clock_counter,11371124 .wait_for_mc_idle = &gmc_v8_0_mc_wait_for_idle,
+51-35
drivers/gpu/drm/amd/amdkfd/kfd_process.c
···242242 pqm_uninit(&p->pqm);243243244244 /* Iterate over all process device data structure and check245245- * if we should reset all wavefronts */246246- list_for_each_entry(pdd, &p->per_device_data, per_device_list)245245+ * if we should delete debug managers and reset all wavefronts246246+ */247247+ list_for_each_entry(pdd, &p->per_device_data, per_device_list) {248248+ if ((pdd->dev->dbgmgr) &&249249+ (pdd->dev->dbgmgr->pasid == p->pasid))250250+ kfd_dbgmgr_destroy(pdd->dev->dbgmgr);251251+247252 if (pdd->reset_wavefronts) {248253 pr_warn("amdkfd: Resetting all wave fronts\n");249254 dbgdev_wave_reset_wavefronts(pdd->dev, p);250255 pdd->reset_wavefronts = false;251256 }257257+ }252258253259 mutex_unlock(&p->mutex);254260···410404411405 idx = srcu_read_lock(&kfd_processes_srcu);412406407407+ /*408408+ * Look for the process that matches the pasid. If there is no such409409+ * process, we either released it in amdkfd's own notifier, or there410410+ * is a bug. Unfortunately, there is no way to tell...411411+ */413412 hash_for_each_rcu(kfd_processes_table, i, p, kfd_processes)414414- if (p->pasid == pasid)415415- break;413413+ if (p->pasid == pasid) {414414+415415+ srcu_read_unlock(&kfd_processes_srcu, idx);416416+417417+ pr_debug("Unbinding process %d from IOMMU\n", pasid);418418+419419+ mutex_lock(&p->mutex);420420+421421+ if ((dev->dbgmgr) && (dev->dbgmgr->pasid == p->pasid))422422+ kfd_dbgmgr_destroy(dev->dbgmgr);423423+424424+ pqm_uninit(&p->pqm);425425+426426+ pdd = kfd_get_process_device_data(dev, p);427427+428428+ if (!pdd) {429429+ mutex_unlock(&p->mutex);430430+ return;431431+ }432432+433433+ if (pdd->reset_wavefronts) {434434+ dbgdev_wave_reset_wavefronts(pdd->dev, p);435435+ pdd->reset_wavefronts = false;436436+ }437437+438438+ /*439439+ * Just mark pdd as unbound, because we still need it440440+ * to call amd_iommu_unbind_pasid() in when the441441+ * process exits.442442+ * We don't call amd_iommu_unbind_pasid() here443443+ * because the IOMMU called us.444444+ */445445+ pdd->bound = false;446446+447447+ mutex_unlock(&p->mutex);448448+449449+ return;450450+ }416451417452 srcu_read_unlock(&kfd_processes_srcu, idx);418418-419419- BUG_ON(p->pasid != pasid);420420-421421- mutex_lock(&p->mutex);422422-423423- if ((dev->dbgmgr) && (dev->dbgmgr->pasid == p->pasid))424424- kfd_dbgmgr_destroy(dev->dbgmgr);425425-426426- pqm_uninit(&p->pqm);427427-428428- pdd = kfd_get_process_device_data(dev, p);429429-430430- if (!pdd) {431431- mutex_unlock(&p->mutex);432432- return;433433- }434434-435435- if (pdd->reset_wavefronts) {436436- dbgdev_wave_reset_wavefronts(pdd->dev, p);437437- pdd->reset_wavefronts = false;438438- }439439-440440- /*441441- * Just mark pdd as unbound, because we still need it to call442442- * amd_iommu_unbind_pasid() in when the process exits.443443- * We don't call amd_iommu_unbind_pasid() here444444- * because the IOMMU called us.445445- */446446- pdd->bound = false;447447-448448- mutex_unlock(&p->mutex);449453}450454451455struct kfd_process_device *kfd_get_first_process_device_data(struct kfd_process *p)
+1-1
drivers/gpu/drm/amd/amdkfd/kfd_topology.c
···666666 dev->node_props.simd_count);667667668668 if (dev->mem_bank_count < dev->node_props.mem_banks_count) {669669- pr_warn("kfd: mem_banks_count truncated from %d to %d\n",669669+ pr_info_once("kfd: mem_banks_count truncated from %d to %d\n",670670 dev->node_props.mem_banks_count,671671 dev->mem_bank_count);672672 sysfs_show_32bit_prop(buffer, "mem_banks_count",
···34813481bool intel_bios_is_valid_vbt(const void *buf, size_t size);34823482bool intel_bios_is_tv_present(struct drm_i915_private *dev_priv);34833483bool intel_bios_is_lvds_present(struct drm_i915_private *dev_priv, u8 *i2c_pin);34843484+bool intel_bios_is_port_present(struct drm_i915_private *dev_priv, enum port port);34843485bool intel_bios_is_port_edp(struct drm_i915_private *dev_priv, enum port port);34853486bool intel_bios_is_port_dp_dual_mode(struct drm_i915_private *dev_priv, enum port port);34863487bool intel_bios_is_dsi_present(struct drm_i915_private *dev_priv, enum port *port);
+45-1
drivers/gpu/drm/i915/intel_bios.c
···139139 else140140 panel_fixed_mode->flags |= DRM_MODE_FLAG_NVSYNC;141141142142+ panel_fixed_mode->width_mm = (dvo_timing->himage_hi << 8) |143143+ dvo_timing->himage_lo;144144+ panel_fixed_mode->height_mm = (dvo_timing->vimage_hi << 8) |145145+ dvo_timing->vimage_lo;146146+142147 /* Some VBTs have bogus h/vtotal values */143148 if (panel_fixed_mode->hsync_end > panel_fixed_mode->htotal)144149 panel_fixed_mode->htotal = panel_fixed_mode->hsync_end + 1;···11921187 }11931188 if (bdb->version < 106) {11941189 expected_size = 22;11951195- } else if (bdb->version < 109) {11901190+ } else if (bdb->version < 111) {11961191 expected_size = 27;11971192 } else if (bdb->version < 195) {11981193 BUILD_BUG_ON(sizeof(struct old_child_dev_config) != 33);···15441539 * the OpRegion then they have validated the LVDS's existence.15451540 */15461541 if (dev_priv->opregion.vbt)15421542+ return true;15431543+ }15441544+15451545+ return false;15461546+}15471547+15481548+/**15491549+ * intel_bios_is_port_present - is the specified digital port present15501550+ * @dev_priv: i915 device instance15511551+ * @port: port to check15521552+ *15531553+ * Return true if the device in %port is present.15541554+ */15551555+bool intel_bios_is_port_present(struct drm_i915_private *dev_priv, enum port port)15561556+{15571557+ static const struct {15581558+ u16 dp, hdmi;15591559+ } port_mapping[] = {15601560+ [PORT_B] = { DVO_PORT_DPB, DVO_PORT_HDMIB, },15611561+ [PORT_C] = { DVO_PORT_DPC, DVO_PORT_HDMIC, },15621562+ [PORT_D] = { DVO_PORT_DPD, DVO_PORT_HDMID, },15631563+ [PORT_E] = { DVO_PORT_DPE, DVO_PORT_HDMIE, },15641564+ };15651565+ int i;15661566+15671567+ /* FIXME maybe deal with port A as well? */15681568+ if (WARN_ON(port == PORT_A) || port >= ARRAY_SIZE(port_mapping))15691569+ return false;15701570+15711571+ if (!dev_priv->vbt.child_dev_num)15721572+ return false;15731573+15741574+ for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {15751575+ const union child_device_config *p_child =15761576+ &dev_priv->vbt.child_dev[i];15771577+ if ((p_child->common.dvo_port == port_mapping[port].dp ||15781578+ p_child->common.dvo_port == port_mapping[port].hdmi) &&15791579+ (p_child->common.device_type & (DEVICE_TYPE_TMDS_DVI_SIGNALING |15801580+ DEVICE_TYPE_DISPLAYPORT_OUTPUT)))15471581 return true;15481582 }15491583
+60-28
drivers/gpu/drm/i915/intel_display.c
···82758275{82768276 struct drm_i915_private *dev_priv = dev->dev_private;82778277 struct intel_encoder *encoder;82788278+ int i;82788279 u32 val, final;82798280 bool has_lvds = false;82808281 bool has_cpu_edp = false;82818282 bool has_panel = false;82828283 bool has_ck505 = false;82838284 bool can_ssc = false;82858285+ bool using_ssc_source = false;8284828682858287 /* We need to take the global config into account */82868288 for_each_intel_encoder(dev, encoder) {···83098307 can_ssc = true;83108308 }8311830983128312- DRM_DEBUG_KMS("has_panel %d has_lvds %d has_ck505 %d\n",83138313- has_panel, has_lvds, has_ck505);83108310+ /* Check if any DPLLs are using the SSC source */83118311+ for (i = 0; i < dev_priv->num_shared_dpll; i++) {83128312+ u32 temp = I915_READ(PCH_DPLL(i));83138313+83148314+ if (!(temp & DPLL_VCO_ENABLE))83158315+ continue;83168316+83178317+ if ((temp & PLL_REF_INPUT_MASK) ==83188318+ PLLB_REF_INPUT_SPREADSPECTRUMIN) {83198319+ using_ssc_source = true;83208320+ break;83218321+ }83228322+ }83238323+83248324+ DRM_DEBUG_KMS("has_panel %d has_lvds %d has_ck505 %d using_ssc_source %d\n",83258325+ has_panel, has_lvds, has_ck505, using_ssc_source);8314832683158327 /* Ironlake: try to setup display ref clock before DPLL83168328 * enabling. This is only under driver's control after···83618345 final |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD;83628346 } else83638347 final |= DREF_CPU_SOURCE_OUTPUT_DISABLE;83648364- } else {83658365- final |= DREF_SSC_SOURCE_DISABLE;83668366- final |= DREF_CPU_SOURCE_OUTPUT_DISABLE;83488348+ } else if (using_ssc_source) {83498349+ final |= DREF_SSC_SOURCE_ENABLE;83508350+ final |= DREF_SSC1_ENABLE;83678351 }8368835283698353 if (final == val)···84098393 POSTING_READ(PCH_DREF_CONTROL);84108394 udelay(200);84118395 } else {84128412- DRM_DEBUG_KMS("Disabling SSC entirely\n");83968396+ DRM_DEBUG_KMS("Disabling CPU source output\n");8413839784148398 val &= ~DREF_CPU_SOURCE_OUTPUT_MASK;84158399···84208404 POSTING_READ(PCH_DREF_CONTROL);84218405 udelay(200);8422840684238423- /* Turn off the SSC source */84248424- val &= ~DREF_SSC_SOURCE_MASK;84258425- val |= DREF_SSC_SOURCE_DISABLE;84078407+ if (!using_ssc_source) {84088408+ DRM_DEBUG_KMS("Disabling SSC source\n");8426840984278427- /* Turn off SSC1 */84288428- val &= ~DREF_SSC1_ENABLE;84108410+ /* Turn off the SSC source */84118411+ val &= ~DREF_SSC_SOURCE_MASK;84128412+ val |= DREF_SSC_SOURCE_DISABLE;8429841384308430- I915_WRITE(PCH_DREF_CONTROL, val);84318431- POSTING_READ(PCH_DREF_CONTROL);84328432- udelay(200);84148414+ /* Turn off SSC1 */84158415+ val &= ~DREF_SSC1_ENABLE;84168416+84178417+ I915_WRITE(PCH_DREF_CONTROL, val);84188418+ POSTING_READ(PCH_DREF_CONTROL);84198419+ udelay(200);84208420+ }84338421 }8434842284358423 BUG_ON(val != final);···1457414554 if (I915_READ(PCH_DP_D) & DP_DETECTED)1457514555 intel_dp_init(dev, PCH_DP_D, PORT_D);1457614556 } else if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) {1455714557+ bool has_edp, has_port;1455814558+1457714559 /*1457814560 * The DP_DETECTED bit is the latched state of the DDC1457914561 * SDA pin at boot. However since eDP doesn't require DDC···1458414562 * Thus we can't rely on the DP_DETECTED bit alone to detect1458514563 * eDP ports. Consult the VBT as well as DP_DETECTED to1458614564 * detect eDP ports.1456514565+ *1456614566+ * Sadly the straps seem to be missing sometimes even for HDMI1456714567+ * ports (eg. on Voyo V3 - CHT x7-Z8700), so check both strap1456814568+ * and VBT for the presence of the port. Additionally we can't1456914569+ * trust the port type the VBT declares as we've seen at least1457014570+ * HDMI ports that the VBT claim are DP or eDP.1458714571 */1458814588- if (I915_READ(VLV_HDMIB) & SDVO_DETECTED &&1458914589- !intel_dp_is_edp(dev, PORT_B))1457214572+ has_edp = intel_dp_is_edp(dev, PORT_B);1457314573+ has_port = intel_bios_is_port_present(dev_priv, PORT_B);1457414574+ if (I915_READ(VLV_DP_B) & DP_DETECTED || has_port)1457514575+ has_edp &= intel_dp_init(dev, VLV_DP_B, PORT_B);1457614576+ if ((I915_READ(VLV_HDMIB) & SDVO_DETECTED || has_port) && !has_edp)1459014577 intel_hdmi_init(dev, VLV_HDMIB, PORT_B);1459114591- if (I915_READ(VLV_DP_B) & DP_DETECTED ||1459214592- intel_dp_is_edp(dev, PORT_B))1459314593- intel_dp_init(dev, VLV_DP_B, PORT_B);14594145781459514595- if (I915_READ(VLV_HDMIC) & SDVO_DETECTED &&1459614596- !intel_dp_is_edp(dev, PORT_C))1457914579+ has_edp = intel_dp_is_edp(dev, PORT_C);1458014580+ has_port = intel_bios_is_port_present(dev_priv, PORT_C);1458114581+ if (I915_READ(VLV_DP_C) & DP_DETECTED || has_port)1458214582+ has_edp &= intel_dp_init(dev, VLV_DP_C, PORT_C);1458314583+ if ((I915_READ(VLV_HDMIC) & SDVO_DETECTED || has_port) && !has_edp)1459714584 intel_hdmi_init(dev, VLV_HDMIC, PORT_C);1459814598- if (I915_READ(VLV_DP_C) & DP_DETECTED ||1459914599- intel_dp_is_edp(dev, PORT_C))1460014600- intel_dp_init(dev, VLV_DP_C, PORT_C);14601145851460214586 if (IS_CHERRYVIEW(dev)) {1460314603- /* eDP not supported on port D, so don't check VBT */1460414604- if (I915_READ(CHV_HDMID) & SDVO_DETECTED)1460514605- intel_hdmi_init(dev, CHV_HDMID, PORT_D);1460614606- if (I915_READ(CHV_DP_D) & DP_DETECTED)1458714587+ /*1458814588+ * eDP not supported on port D,1458914589+ * so no need to worry about it1459014590+ */1459114591+ has_port = intel_bios_is_port_present(dev_priv, PORT_D);1459214592+ if (I915_READ(CHV_DP_D) & DP_DETECTED || has_port)1460714593 intel_dp_init(dev, CHV_DP_D, PORT_D);1459414594+ if (I915_READ(CHV_HDMID) & SDVO_DETECTED || has_port)1459514595+ intel_hdmi_init(dev, CHV_HDMID, PORT_D);1460814596 }14609145971461014598 intel_dsi_init(dev);
···21422142 enum port port = intel_dig_port->port;21432143 uint8_t alternate_ddc_pin;2144214421452145+ DRM_DEBUG_KMS("Adding HDMI connector on port %c\n",21462146+ port_name(port));21472147+21452148 if (WARN(intel_dig_port->max_lanes < 4,21462149 "Not enough lanes (%d) for HDMI on port %c\n",21472150 intel_dig_port->max_lanes, port_name(port)))
···276276 struct pwr_rail_t *r = &stbl.rail[i];277277 struct nvkm_iccsense_rail *rail;278278 struct nvkm_iccsense_sensor *sensor;279279+ int (*read)(struct nvkm_iccsense *,280280+ struct nvkm_iccsense_rail *);279281280282 if (!r->mode || r->resistor_mohm == 0)281283 continue;···286284 if (!sensor)287285 continue;288286289289- rail = kmalloc(sizeof(*rail), GFP_KERNEL);290290- if (!rail)291291- return -ENOMEM;292292-293287 switch (sensor->type) {294288 case NVBIOS_EXTDEV_INA209:295289 if (r->rail != 0)296290 continue;297297- rail->read = nvkm_iccsense_ina209_read;291291+ read = nvkm_iccsense_ina209_read;298292 break;299293 case NVBIOS_EXTDEV_INA219:300294 if (r->rail != 0)301295 continue;302302- rail->read = nvkm_iccsense_ina219_read;296296+ read = nvkm_iccsense_ina219_read;303297 break;304298 case NVBIOS_EXTDEV_INA3221:305299 if (r->rail >= 3)306300 continue;307307- rail->read = nvkm_iccsense_ina3221_read;301301+ read = nvkm_iccsense_ina3221_read;308302 break;309303 default:310304 continue;311305 }312306307307+ rail = kmalloc(sizeof(*rail), GFP_KERNEL);308308+ if (!rail)309309+ return -ENOMEM;313310 sensor->rail_mask |= 1 << r->rail;311311+ rail->read = read;314312 rail->sensor = sensor;315313 rail->idx = r->rail;316314 rail->mohm = r->resistor_mohm;
+3-2
drivers/gpu/drm/radeon/atombios_crtc.c
···589589 if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE61(rdev) || ASIC_IS_DCE8(rdev))590590 radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV;591591 /* use frac fb div on RS780/RS880 */592592- if ((rdev->family == CHIP_RS780) || (rdev->family == CHIP_RS880))592592+ if (((rdev->family == CHIP_RS780) || (rdev->family == CHIP_RS880))593593+ && !radeon_crtc->ss_enabled)593594 radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV;594595 if (ASIC_IS_DCE32(rdev) && mode->clock > 165000)595596 radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV;···627626 if (radeon_crtc->ss.refdiv) {628627 radeon_crtc->pll_flags |= RADEON_PLL_USE_REF_DIV;629628 radeon_crtc->pll_reference_div = radeon_crtc->ss.refdiv;630630- if (ASIC_IS_AVIVO(rdev))629629+ if (rdev->family >= CHIP_RV770)631630 radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV;632631 }633632 }
+22-1
drivers/gpu/drm/radeon/radeon_device.c
···630630/*631631 * GPU helpers function.632632 */633633+634634+/**635635+ * radeon_device_is_virtual - check if we are running is a virtual environment636636+ *637637+ * Check if the asic has been passed through to a VM (all asics).638638+ * Used at driver startup.639639+ * Returns true if virtual or false if not.640640+ */641641+static bool radeon_device_is_virtual(void)642642+{643643+#ifdef CONFIG_X86644644+ return boot_cpu_has(X86_FEATURE_HYPERVISOR);645645+#else646646+ return false;647647+#endif648648+}649649+633650/**634651 * radeon_card_posted - check if the hw has already been initialized635652 *···659642bool radeon_card_posted(struct radeon_device *rdev)660643{661644 uint32_t reg;645645+646646+ /* for pass through, always force asic_init */647647+ if (radeon_device_is_virtual())648648+ return false;662649663650 /* required for EFI mode on macbook2,1 which uses an r5xx asic */664651 if (efi_enabled(EFI_BOOT) &&···16521631 radeon_agp_suspend(rdev);1653163216541633 pci_save_state(dev->pdev);16551655- if (freeze && rdev->family >= CHIP_R600) {16341634+ if (freeze && rdev->family >= CHIP_CEDAR) {16561635 rdev->asic->asic_reset(rdev, true);16571636 pci_restore_state(dev->pdev);16581637 } else if (suspend) {
···300300 if (local_read(&drvdata->mode) == CS_MODE_SYSFS) {301301 /*302302 * The trace run will continue with the same allocated trace303303- * buffer. As such zero-out the buffer so that we don't end304304- * up with stale data.305305- *306306- * Since the tracer is still enabled drvdata::buf307307- * can't be NULL.303303+ * buffer. The trace buffer is cleared in tmc_etr_enable_hw(),304304+ * so we don't have to explicitly clear it. Also, since the305305+ * tracer is still enabled drvdata::buf can't be NULL.308306 */309309- memset(drvdata->buf, 0, drvdata->size);310307 tmc_etr_enable_hw(drvdata);311308 } else {312309 /*···312315 */313316 vaddr = drvdata->vaddr;314317 paddr = drvdata->paddr;315315- drvdata->buf = NULL;318318+ drvdata->buf = drvdata->vaddr = NULL;316319 }317320318321 drvdata->reading = false;
+9-6
drivers/hwtracing/coresight/coresight.c
···385385 int i;386386 bool found = false;387387 struct coresight_node *node;388388- struct coresight_connection *conn;389388390389 /* An activated sink has been found. Enqueue the element */391390 if ((csdev->type == CORESIGHT_DEV_TYPE_SINK ||···393394394395 /* Not a sink - recursively explore each port found on this element */395396 for (i = 0; i < csdev->nr_outport; i++) {396396- conn = &csdev->conns[i];397397- if (_coresight_build_path(conn->child_dev, path) == 0) {397397+ struct coresight_device *child_dev = csdev->conns[i].child_dev;398398+399399+ if (child_dev && _coresight_build_path(child_dev, path) == 0) {398400 found = true;399401 break;400402 }···425425struct list_head *coresight_build_path(struct coresight_device *csdev)426426{427427 struct list_head *path;428428+ int rc;428429429430 path = kzalloc(sizeof(struct list_head), GFP_KERNEL);430431 if (!path)···433432434433 INIT_LIST_HEAD(path);435434436436- if (_coresight_build_path(csdev, path)) {435435+ rc = _coresight_build_path(csdev, path);436436+ if (rc) {437437 kfree(path);438438- path = NULL;438438+ return ERR_PTR(rc);439439 }440440441441 return path;···509507 goto out;510508511509 path = coresight_build_path(csdev);512512- if (!path) {510510+ if (IS_ERR(path)) {513511 pr_err("building path(s) failed\n");512512+ ret = PTR_ERR(path);514513 goto out;515514 }516515
+96-3
drivers/i2c/busses/i2c-i801.c
···245245 struct platform_device *mux_pdev;246246#endif247247 struct platform_device *tco_pdev;248248+249249+ /*250250+ * If set to true the host controller registers are reserved for251251+ * ACPI AML use. Protected by acpi_lock.252252+ */253253+ bool acpi_reserved;254254+ struct mutex acpi_lock;248255};249256250257#define FEATURE_SMBUS_PEC (1 << 0)···725718 int ret = 0, xact = 0;726719 struct i801_priv *priv = i2c_get_adapdata(adap);727720721721+ mutex_lock(&priv->acpi_lock);722722+ if (priv->acpi_reserved) {723723+ mutex_unlock(&priv->acpi_lock);724724+ return -EBUSY;725725+ }726726+728727 pm_runtime_get_sync(&priv->pci_dev->dev);729728730729 hwpec = (priv->features & FEATURE_SMBUS_PEC) && (flags & I2C_CLIENT_PEC)···833820out:834821 pm_runtime_mark_last_busy(&priv->pci_dev->dev);835822 pm_runtime_put_autosuspend(&priv->pci_dev->dev);823823+ mutex_unlock(&priv->acpi_lock);836824 return ret;837825}838826···12711257 priv->tco_pdev = pdev;12721258}1273125912601260+#ifdef CONFIG_ACPI12611261+static acpi_status12621262+i801_acpi_io_handler(u32 function, acpi_physical_address address, u32 bits,12631263+ u64 *value, void *handler_context, void *region_context)12641264+{12651265+ struct i801_priv *priv = handler_context;12661266+ struct pci_dev *pdev = priv->pci_dev;12671267+ acpi_status status;12681268+12691269+ /*12701270+ * Once BIOS AML code touches the OpRegion we warn and inhibit any12711271+ * further access from the driver itself. This device is now owned12721272+ * by the system firmware.12731273+ */12741274+ mutex_lock(&priv->acpi_lock);12751275+12761276+ if (!priv->acpi_reserved) {12771277+ priv->acpi_reserved = true;12781278+12791279+ dev_warn(&pdev->dev, "BIOS is accessing SMBus registers\n");12801280+ dev_warn(&pdev->dev, "Driver SMBus register access inhibited\n");12811281+12821282+ /*12831283+ * BIOS is accessing the host controller so prevent it from12841284+ * suspending automatically from now on.12851285+ */12861286+ pm_runtime_get_sync(&pdev->dev);12871287+ }12881288+12891289+ if ((function & ACPI_IO_MASK) == ACPI_READ)12901290+ status = acpi_os_read_port(address, (u32 *)value, bits);12911291+ else12921292+ status = acpi_os_write_port(address, (u32)*value, bits);12931293+12941294+ mutex_unlock(&priv->acpi_lock);12951295+12961296+ return status;12971297+}12981298+12991299+static int i801_acpi_probe(struct i801_priv *priv)13001300+{13011301+ struct acpi_device *adev;13021302+ acpi_status status;13031303+13041304+ adev = ACPI_COMPANION(&priv->pci_dev->dev);13051305+ if (adev) {13061306+ status = acpi_install_address_space_handler(adev->handle,13071307+ ACPI_ADR_SPACE_SYSTEM_IO, i801_acpi_io_handler,13081308+ NULL, priv);13091309+ if (ACPI_SUCCESS(status))13101310+ return 0;13111311+ }13121312+13131313+ return acpi_check_resource_conflict(&priv->pci_dev->resource[SMBBAR]);13141314+}13151315+13161316+static void i801_acpi_remove(struct i801_priv *priv)13171317+{13181318+ struct acpi_device *adev;13191319+13201320+ adev = ACPI_COMPANION(&priv->pci_dev->dev);13211321+ if (!adev)13221322+ return;13231323+13241324+ acpi_remove_address_space_handler(adev->handle,13251325+ ACPI_ADR_SPACE_SYSTEM_IO, i801_acpi_io_handler);13261326+13271327+ mutex_lock(&priv->acpi_lock);13281328+ if (priv->acpi_reserved)13291329+ pm_runtime_put(&priv->pci_dev->dev);13301330+ mutex_unlock(&priv->acpi_lock);13311331+}13321332+#else13331333+static inline int i801_acpi_probe(struct i801_priv *priv) { return 0; }13341334+static inline void i801_acpi_remove(struct i801_priv *priv) { }13351335+#endif13361336+12741337static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)12751338{12761339 unsigned char temp;···13651274 priv->adapter.dev.parent = &dev->dev;13661275 ACPI_COMPANION_SET(&priv->adapter.dev, ACPI_COMPANION(&dev->dev));13671276 priv->adapter.retries = 3;12771277+ mutex_init(&priv->acpi_lock);1368127813691279 priv->pci_dev = dev;13701280 switch (dev->device) {···14281336 return -ENODEV;14291337 }1430133814311431- err = acpi_check_resource_conflict(&dev->resource[SMBBAR]);14321432- if (err) {13391339+ if (i801_acpi_probe(priv))14331340 return -ENODEV;14341434- }1435134114361342 err = pcim_iomap_regions(dev, 1 << SMBBAR,14371343 dev_driver_string(&dev->dev));···14381348 "Failed to request SMBus region 0x%lx-0x%Lx\n",14391349 priv->smba,14401350 (unsigned long long)pci_resource_end(dev, SMBBAR));13511351+ i801_acpi_remove(priv);14411352 return err;14421353 }14431354···15031412 err = i2c_add_adapter(&priv->adapter);15041413 if (err) {15051414 dev_err(&dev->dev, "Failed to add SMBus adapter\n");14151415+ i801_acpi_remove(priv);15061416 return err;15071417 }15081418···1530143815311439 i801_del_mux(priv);15321440 i2c_del_adapter(&priv->adapter);14411441+ i801_acpi_remove(priv);15331442 pci_write_config_byte(dev, SMBHSTCFG, priv->original_hstcfg);1534144315351444 platform_device_unregister(priv->tco_pdev);
+10-7
drivers/i2c/busses/i2c-octeon.c
···934934 return result;935935936936 for (i = 0; i < length; i++) {937937- /* for the last byte TWSI_CTL_AAK must not be set */938938- if (i + 1 == length)937937+ /*938938+ * For the last byte to receive TWSI_CTL_AAK must not be set.939939+ *940940+ * A special case is I2C_M_RECV_LEN where we don't know the941941+ * additional length yet. If recv_len is set we assume we're942942+ * not reading the final byte and therefore need to set943943+ * TWSI_CTL_AAK.944944+ */945945+ if ((i + 1 == length) && !(recv_len && i == 0))939946 final_read = true;940947941948 /* clear iflg to allow next event */···957950958951 data[i] = octeon_i2c_data_read(i2c);959952 if (recv_len && i == 0) {960960- if (data[i] > I2C_SMBUS_BLOCK_MAX + 1) {961961- dev_err(i2c->dev,962962- "%s: read len > I2C_SMBUS_BLOCK_MAX %d\n",963963- __func__, data[i]);953953+ if (data[i] > I2C_SMBUS_BLOCK_MAX + 1)964954 return -EPROTO;965965- }966955 length += data[i];967956 }968957
···5757 struct iio_poll_func *pf = p;5858 struct iio_dev *indio_dev = pf->indio_dev;5959 struct st_sensor_data *sdata = iio_priv(indio_dev);6060+ s64 timestamp;60616161- /* If we have a status register, check if this IRQ came from us */6262- if (sdata->sensor_settings->drdy_irq.addr_stat_drdy) {6363- u8 status;6464-6565- len = sdata->tf->read_byte(&sdata->tb, sdata->dev,6666- sdata->sensor_settings->drdy_irq.addr_stat_drdy,6767- &status);6868- if (len < 0)6969- dev_err(sdata->dev, "could not read channel status\n");7070-7171- /*7272- * If this was not caused by any channels on this sensor,7373- * return IRQ_NONE7474- */7575- if (!(status & (u8)indio_dev->active_scan_mask[0]))7676- return IRQ_NONE;7777- }6262+ /* If we do timetamping here, do it before reading the values */6363+ if (sdata->hw_irq_trigger)6464+ timestamp = sdata->hw_timestamp;6565+ else6666+ timestamp = iio_get_time_ns();78677968 len = st_sensors_get_buffer_element(indio_dev, sdata->buffer_data);8069 if (len < 0)8170 goto st_sensors_get_buffer_element_error;82718372 iio_push_to_buffers_with_timestamp(indio_dev, sdata->buffer_data,8484- pf->timestamp);7373+ timestamp);85748675st_sensors_get_buffer_element_error:8776 iio_trigger_notify_done(indio_dev->trig);
+8
drivers/iio/common/st_sensors/st_sensors_core.c
···363363 if (err < 0)364364 return err;365365366366+ /* Disable DRDY, this might be still be enabled after reboot. */367367+ err = st_sensors_set_dataready_irq(indio_dev, false);368368+ if (err < 0)369369+ return err;370370+366371 if (sdata->current_fullscale) {367372 err = st_sensors_set_fullscale(indio_dev,368373 sdata->current_fullscale->num);···428423 drdy_mask = sdata->sensor_settings->drdy_irq.mask_int1;429424 else430425 drdy_mask = sdata->sensor_settings->drdy_irq.mask_int2;426426+427427+ /* Flag to the poll function that the hardware trigger is in use */428428+ sdata->hw_irq_trigger = enable;431429432430 /* Enable/Disable the interrupt generator for data ready. */433431 err = st_sensors_write_data_with_mask(indio_dev,
···1717#include <linux/iio/common/st_sensors.h>1818#include "st_sensors_core.h"19192020+/**2121+ * st_sensors_irq_handler() - top half of the IRQ-based triggers2222+ * @irq: irq number2323+ * @p: private handler data2424+ */2525+irqreturn_t st_sensors_irq_handler(int irq, void *p)2626+{2727+ struct iio_trigger *trig = p;2828+ struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig);2929+ struct st_sensor_data *sdata = iio_priv(indio_dev);3030+3131+ /* Get the time stamp as close in time as possible */3232+ sdata->hw_timestamp = iio_get_time_ns();3333+ return IRQ_WAKE_THREAD;3434+}3535+3636+/**3737+ * st_sensors_irq_thread() - bottom half of the IRQ-based triggers3838+ * @irq: irq number3939+ * @p: private handler data4040+ */4141+irqreturn_t st_sensors_irq_thread(int irq, void *p)4242+{4343+ struct iio_trigger *trig = p;4444+ struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig);4545+ struct st_sensor_data *sdata = iio_priv(indio_dev);4646+ int ret;4747+4848+ /*4949+ * If this trigger is backed by a hardware interrupt and we have a5050+ * status register, check if this IRQ came from us5151+ */5252+ if (sdata->sensor_settings->drdy_irq.addr_stat_drdy) {5353+ u8 status;5454+5555+ ret = sdata->tf->read_byte(&sdata->tb, sdata->dev,5656+ sdata->sensor_settings->drdy_irq.addr_stat_drdy,5757+ &status);5858+ if (ret < 0) {5959+ dev_err(sdata->dev, "could not read channel status\n");6060+ goto out_poll;6161+ }6262+ /*6363+ * the lower bits of .active_scan_mask[0] is directly mapped6464+ * to the channels on the sensor: either bit 0 for6565+ * one-dimensional sensors, or e.g. x,y,z for accelerometers,6666+ * gyroscopes or magnetometers. No sensor use more than 36767+ * channels, so cut the other status bits here.6868+ */6969+ status &= 0x07;7070+7171+ /*7272+ * If this was not caused by any channels on this sensor,7373+ * return IRQ_NONE7474+ */7575+ if (!indio_dev->active_scan_mask)7676+ return IRQ_NONE;7777+ if (!(status & (u8)indio_dev->active_scan_mask[0]))7878+ return IRQ_NONE;7979+ }8080+8181+out_poll:8282+ /* It's our IRQ: proceed to handle the register polling */8383+ iio_trigger_poll_chained(p);8484+ return IRQ_HANDLED;8585+}8686+2087int st_sensors_allocate_trigger(struct iio_dev *indio_dev,2188 const struct iio_trigger_ops *trigger_ops)2289{···9629 dev_err(&indio_dev->dev, "failed to allocate iio trigger.\n");9730 return -ENOMEM;9831 }3232+3333+ iio_trigger_set_drvdata(sdata->trig, indio_dev);3434+ sdata->trig->ops = trigger_ops;3535+ sdata->trig->dev.parent = sdata->dev;993610037 irq = sdata->get_irq_data_ready(indio_dev);10138 irq_trig = irqd_get_trigger_type(irq_get_irq_data(irq));···14877 sdata->sensor_settings->drdy_irq.addr_stat_drdy)14978 irq_trig |= IRQF_SHARED;15079151151- err = request_threaded_irq(irq,152152- iio_trigger_generic_data_rdy_poll,153153- NULL,8080+ /* Let's create an interrupt thread masking the hard IRQ here */8181+ irq_trig |= IRQF_ONESHOT;8282+8383+ err = request_threaded_irq(sdata->get_irq_data_ready(indio_dev),8484+ st_sensors_irq_handler,8585+ st_sensors_irq_thread,15486 irq_trig,15587 sdata->trig->name,15688 sdata->trig);···16187 dev_err(&indio_dev->dev, "failed to request trigger IRQ.\n");16288 goto iio_trigger_free;16389 }164164-165165- iio_trigger_set_drvdata(sdata->trig, indio_dev);166166- sdata->trig->ops = trigger_ops;167167- sdata->trig->dev.parent = sdata->dev;1689016991 err = iio_trigger_register(sdata->trig);17092 if (err < 0) {···188118 iio_trigger_free(sdata->trig);189119}190120EXPORT_SYMBOL(st_sensors_deallocate_trigger);121121+122122+int st_sensors_validate_device(struct iio_trigger *trig,123123+ struct iio_dev *indio_dev)124124+{125125+ struct iio_dev *indio = iio_trigger_get_drvdata(trig);126126+127127+ if (indio != indio_dev)128128+ return -EINVAL;129129+130130+ return 0;131131+}132132+EXPORT_SYMBOL(st_sensors_validate_device);191133192134MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");193135MODULE_DESCRIPTION("STMicroelectronics ST-sensors trigger");
+1-1
drivers/iio/dac/Kconfig
···247247248248config STX104249249 tristate "Apex Embedded Systems STX104 DAC driver"250250- depends on X86 && ISA250250+ depends on X86 && ISA_BUS_API251251 help252252 Say yes here to build support for the 2-channel DAC on the Apex253253 Embedded Systems STX104 integrated analog PC/104 card. The base port
+1-1
drivers/iio/dac/ad5592r-base.c
···525525526526 device_for_each_child_node(st->dev, child) {527527 ret = fwnode_property_read_u32(child, "reg", ®);528528- if (ret || reg > ARRAY_SIZE(st->channel_modes))528528+ if (ret || reg >= ARRAY_SIZE(st->channel_modes))529529 continue;530530531531 ret = fwnode_property_read_u32(child, "adi,mode", &tmp);
···32223222 }32233223 }3224322432253225- iommu_flush_write_buffer(iommu);32263226- iommu_set_root_entry(iommu);32273227- iommu->flush.flush_context(iommu, 0, 0, 0, DMA_CCMD_GLOBAL_INVL);32283228- iommu->flush.flush_iotlb(iommu, 0, 0, 0, DMA_TLB_GLOBAL_FLUSH);32293229-32303225 if (!ecap_pass_through(iommu->ecap))32313226 hw_pass_through = 0;32323227#ifdef CONFIG_INTEL_IOMMU_SVM32333228 if (pasid_enabled(iommu))32343229 intel_svm_alloc_pasid_tables(iommu);32353230#endif32313231+ }32323232+32333233+ /*32343234+ * Now that qi is enabled on all iommus, set the root entry and flush32353235+ * caches. This is required on some Intel X58 chipsets, otherwise the32363236+ * flush_context function will loop forever and the boot hangs.32373237+ */32383238+ for_each_active_iommu(iommu, drhd) {32393239+ iommu_flush_write_buffer(iommu);32403240+ iommu_set_root_entry(iommu);32413241+ iommu->flush.flush_context(iommu, 0, 0, 0, DMA_CCMD_GLOBAL_INVL);32423242+ iommu->flush.flush_iotlb(iommu, 0, 0, 0, DMA_TLB_GLOBAL_FLUSH);32363243 }3237324432383245 if (iommu_pass_through)
+1-1
drivers/iommu/rockchip-iommu.c
···815815 dte_addr = virt_to_phys(rk_domain->dt);816816 for (i = 0; i < iommu->num_mmu; i++) {817817 rk_iommu_write(iommu->bases[i], RK_MMU_DTE_ADDR, dte_addr);818818- rk_iommu_command(iommu->bases[i], RK_MMU_CMD_ZAP_CACHE);818818+ rk_iommu_base_command(iommu->bases[i], RK_MMU_CMD_ZAP_CACHE);819819 rk_iommu_write(iommu->bases[i], RK_MMU_INT_MASK, RK_MMU_IRQ_MASK);820820 }821821
+6-3
drivers/leds/led-core.c
···53535454 if (!led_cdev->blink_delay_on || !led_cdev->blink_delay_off) {5555 led_set_brightness_nosleep(led_cdev, LED_OFF);5656+ led_cdev->flags &= ~LED_BLINK_SW;5657 return;5758 }58595960 if (led_cdev->flags & LED_BLINK_ONESHOT_STOP) {6060- led_cdev->flags &= ~LED_BLINK_ONESHOT_STOP;6161+ led_cdev->flags &= ~(LED_BLINK_ONESHOT_STOP | LED_BLINK_SW);6162 return;6263 }6364···152151 return;153152 }154153154154+ led_cdev->flags |= LED_BLINK_SW;155155 mod_timer(&led_cdev->blink_timer, jiffies + 1);156156}157157···221219 del_timer_sync(&led_cdev->blink_timer);222220 led_cdev->blink_delay_on = 0;223221 led_cdev->blink_delay_off = 0;222222+ led_cdev->flags &= ~LED_BLINK_SW;224223}225224EXPORT_SYMBOL_GPL(led_stop_software_blink);226225···229226 enum led_brightness brightness)230227{231228 /*232232- * In case blinking is on delay brightness setting229229+ * If software blink is active, delay brightness setting233230 * until the next timer tick.234231 */235235- if (led_cdev->blink_delay_on || led_cdev->blink_delay_off) {232232+ if (led_cdev->flags & LED_BLINK_SW) {236233 /*237234 * If we need to disable soft blinking delegate this to the238235 * work queue task to avoid problems in case we are called
+31
drivers/leds/trigger/ledtrig-heartbeat.c
···1919#include <linux/sched.h>2020#include <linux/leds.h>2121#include <linux/reboot.h>2222+#include <linux/suspend.h>2223#include "../leds.h"23242425static int panic_heartbeats;···155154 .deactivate = heartbeat_trig_deactivate,156155};157156157157+static int heartbeat_pm_notifier(struct notifier_block *nb,158158+ unsigned long pm_event, void *unused)159159+{160160+ int rc;161161+162162+ switch (pm_event) {163163+ case PM_SUSPEND_PREPARE:164164+ case PM_HIBERNATION_PREPARE:165165+ case PM_RESTORE_PREPARE:166166+ led_trigger_unregister(&heartbeat_led_trigger);167167+ break;168168+ case PM_POST_SUSPEND:169169+ case PM_POST_HIBERNATION:170170+ case PM_POST_RESTORE:171171+ rc = led_trigger_register(&heartbeat_led_trigger);172172+ if (rc)173173+ pr_err("could not re-register heartbeat trigger\n");174174+ break;175175+ default:176176+ break;177177+ }178178+ return NOTIFY_DONE;179179+}180180+158181static int heartbeat_reboot_notifier(struct notifier_block *nb,159182 unsigned long code, void *unused)160183{···192167 panic_heartbeats = 1;193168 return NOTIFY_DONE;194169}170170+171171+static struct notifier_block heartbeat_pm_nb = {172172+ .notifier_call = heartbeat_pm_notifier,173173+};195174196175static struct notifier_block heartbeat_reboot_nb = {197176 .notifier_call = heartbeat_reboot_notifier,···213184 atomic_notifier_chain_register(&panic_notifier_list,214185 &heartbeat_panic_nb);215186 register_reboot_notifier(&heartbeat_reboot_nb);187187+ register_pm_notifier(&heartbeat_pm_nb);216188 }217189 return rc;218190}219191220192static void __exit heartbeat_trig_exit(void)221193{194194+ unregister_pm_notifier(&heartbeat_pm_nb);222195 unregister_reboot_notifier(&heartbeat_reboot_nb);223196 atomic_notifier_chain_unregister(&panic_notifier_list,224197 &heartbeat_panic_nb);
···730730 /* synchronized under device mutex */731731 if (waitqueue_active(&cl->wait)) {732732 cl_dbg(dev, cl, "Waking up ctrl write clients!\n");733733- wake_up_interruptible(&cl->wait);733733+ wake_up(&cl->wait);734734 }735735}736736
+9-2
drivers/mtd/ubi/build.c
···11471147 */11481148static struct mtd_info * __init open_mtd_by_chdev(const char *mtd_dev)11491149{11501150- struct kstat stat;11511150 int err, minor;11511151+ struct path path;11521152+ struct kstat stat;1152115311531154 /* Probably this is an MTD character device node path */11541154- err = vfs_stat(mtd_dev, &stat);11551155+ err = kern_path(mtd_dev, LOOKUP_FOLLOW, &path);11561156+ if (err)11571157+ return ERR_PTR(err);11581158+11591159+ err = vfs_getattr(&path, &stat);11601160+ path_put(&path);11551161 if (err)11561162 return ERR_PTR(err);11571163···11661160 return ERR_PTR(-EINVAL);1167116111681162 minor = MINOR(stat.rdev);11631163+11691164 if (minor & 1)11701165 /*11711166 * Just do not think the "/dev/mtdrX" devices support is need,
···395395 struct device_node **nodepp)396396{397397 struct device_node *root;398398- int offset = 0, depth = 0;398398+ int offset = 0, depth = 0, initial_depth = 0;399399#define FDT_MAX_DEPTH 64400400 unsigned int fpsizes[FDT_MAX_DEPTH];401401 struct device_node *nps[FDT_MAX_DEPTH];···405405 if (nodepp)406406 *nodepp = NULL;407407408408+ /*409409+ * We're unflattening device sub-tree if @dad is valid. There are410410+ * possibly multiple nodes in the first level of depth. We need411411+ * set @depth to 1 to make fdt_next_node() happy as it bails412412+ * immediately when negative @depth is found. Otherwise, the device413413+ * nodes except the first one won't be unflattened successfully.414414+ */415415+ if (dad)416416+ depth = initial_depth = 1;417417+408418 root = dad;409419 fpsizes[depth] = dad ? strlen(of_node_full_name(dad)) : 0;410420 nps[depth] = dad;421421+411422 for (offset = 0;412412- offset >= 0 && depth >= 0;423423+ offset >= 0 && depth >= initial_depth;413424 offset = fdt_next_node(blob, offset, &depth)) {414425 if (WARN_ON_ONCE(depth >= FDT_MAX_DEPTH))415426 continue;
+10-9
drivers/of/irq.c
···386386EXPORT_SYMBOL_GPL(of_irq_to_resource);387387388388/**389389- * of_irq_get - Decode a node's IRQ and return it as a Linux irq number389389+ * of_irq_get - Decode a node's IRQ and return it as a Linux IRQ number390390 * @dev: pointer to device tree node391391- * @index: zero-based index of the irq391391+ * @index: zero-based index of the IRQ392392 *393393- * Returns Linux irq number on success, or -EPROBE_DEFER if the irq domain394394- * is not yet created.395395- *393393+ * Returns Linux IRQ number on success, or 0 on the IRQ mapping failure, or394394+ * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case395395+ * of any other failure.396396 */397397int of_irq_get(struct device_node *dev, int index)398398{···413413EXPORT_SYMBOL_GPL(of_irq_get);414414415415/**416416- * of_irq_get_byname - Decode a node's IRQ and return it as a Linux irq number416416+ * of_irq_get_byname - Decode a node's IRQ and return it as a Linux IRQ number417417 * @dev: pointer to device tree node418418- * @name: irq name418418+ * @name: IRQ name419419 *420420- * Returns Linux irq number on success, or -EPROBE_DEFER if the irq domain421421- * is not yet created, or error code in case of any other failure.420420+ * Returns Linux IRQ number on success, or 0 on the IRQ mapping failure, or421421+ * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case422422+ * of any other failure.422423 */423424int of_irq_get_byname(struct device_node *dev, const char *name)424425{
+9-2
drivers/of/of_reserved_mem.c
···127127 }128128129129 /* Need adjust the alignment to satisfy the CMA requirement */130130- if (IS_ENABLED(CONFIG_CMA) && of_flat_dt_is_compatible(node, "shared-dma-pool"))131131- align = max(align, (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order));130130+ if (IS_ENABLED(CONFIG_CMA)131131+ && of_flat_dt_is_compatible(node, "shared-dma-pool")132132+ && of_get_flat_dt_prop(node, "reusable", NULL)133133+ && !of_get_flat_dt_prop(node, "no-map", NULL)) {134134+ unsigned long order =135135+ max_t(unsigned long, MAX_ORDER - 1, pageblock_order);136136+137137+ align = max(align, (phys_addr_t)PAGE_SIZE << order);138138+ }132139133140 prop = of_get_flat_dt_prop(node, "alloc-ranges", &len);134141 if (prop) {
···233233 struct exynos_mipi_video_phy *state)234234{235235 u32 val;236236+ int ret;236237237237- regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val);238238+ ret = regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val);239239+ if (ret)240240+ return 0;241241+238242 return val & data->resetn_val;239243}240244
+11-4
drivers/phy/phy-ti-pipe3.c
···293293 ret = ti_pipe3_dpll_wait_lock(phy);294294 }295295296296- /* Program the DPLL only if not locked */296296+ /* SATA has issues if re-programmed when locked */297297 val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS);298298- if (!(val & PLL_LOCK))299299- if (ti_pipe3_dpll_program(phy))300300- return -EINVAL;298298+ if ((val & PLL_LOCK) && of_device_is_compatible(phy->dev->of_node,299299+ "ti,phy-pipe3-sata"))300300+ return ret;301301+302302+ /* Program the DPLL */303303+ ret = ti_pipe3_dpll_program(phy);304304+ if (ret) {305305+ ti_pipe3_disable_clocks(phy);306306+ return -EINVAL;307307+ }301308302309 return ret;303310}
+10-4
drivers/phy/phy-twl4030-usb.c
···463463 twl4030_usb_set_mode(twl, twl->usb_mode);464464 if (twl->usb_mode == T2_USB_MODE_ULPI)465465 twl4030_i2c_access(twl, 0);466466- schedule_delayed_work(&twl->id_workaround_work, 0);466466+ twl->linkstat = MUSB_UNKNOWN;467467+ schedule_delayed_work(&twl->id_workaround_work, HZ);467468468469 return 0;469470}···538537 struct twl4030_usb *twl = _twl;539538 enum musb_vbus_id_status status;540539 bool status_changed = false;540540+ int err;541541542542 status = twl4030_usb_linkstat(twl);543543···569567 pm_runtime_mark_last_busy(twl->dev);570568 pm_runtime_put_autosuspend(twl->dev);571569 }572572- musb_mailbox(status);570570+ err = musb_mailbox(status);571571+ if (err)572572+ twl->linkstat = MUSB_UNKNOWN;573573 }574574575575 /* don't schedule during sleep - irq works right then */···599595 struct twl4030_usb *twl = phy_get_drvdata(phy);600596601597 pm_runtime_get_sync(twl->dev);602602- schedule_delayed_work(&twl->id_workaround_work, 0);598598+ twl->linkstat = MUSB_UNKNOWN;599599+ schedule_delayed_work(&twl->id_workaround_work, HZ);603600 pm_runtime_mark_last_busy(twl->dev);604601 pm_runtime_put_autosuspend(twl->dev);605602···768763 if (cable_present(twl->linkstat))769764 pm_runtime_put_noidle(twl->dev);770765 pm_runtime_mark_last_busy(twl->dev);771771- pm_runtime_put_sync_suspend(twl->dev);766766+ pm_runtime_dont_use_autosuspend(&pdev->dev);767767+ pm_runtime_put_sync(twl->dev);772768 pm_runtime_disable(twl->dev);773769774770 /* autogate 60MHz ULPI clock,
+4-6
drivers/platform/x86/Kconfig
···103103104104config DELL_LAPTOP105105 tristate "Dell Laptop Extras"106106- depends on X86107106 depends on DELL_SMBIOS108107 depends on DMI109108 depends on BACKLIGHT_CLASS_DEVICE···504505505506config SENSORS_HDAPS506507 tristate "Thinkpad Hard Drive Active Protection System (hdaps)"507507- depends on INPUT && X86508508+ depends on INPUT508509 select INPUT_POLLDEV509510 default n510511 help···748749749750config ACPI_CMPC750751 tristate "CMPC Laptop Extras"751751- depends on X86 && ACPI752752+ depends on ACPI752753 depends on RFKILL || RFKILL=n753754 select INPUT754755 select BACKLIGHT_CLASS_DEVICE···847848848849config INTEL_PMC_CORE849850 bool "Intel PMC Core driver"850850- depends on X86 && PCI851851+ depends on PCI851852 ---help---852853 The Intel Platform Controller Hub for Intel Core SoCs provides access853854 to Power Management Controller registers via a PCI interface. This···859860860861config IBM_RTL861862 tristate "Device driver to enable PRTL support"862862- depends on X86 && PCI863863+ depends on PCI863864 ---help---864865 Enable support for IBM Premium Real Time Mode (PRTM).865866 This module will allow you the enter and exit PRTM in the BIOS via···893894894895config SAMSUNG_LAPTOP895896 tristate "Samsung Laptop driver"896896- depends on X86897897 depends on RFKILL || RFKILL = n898898 depends on ACPI_VIDEO || ACPI_VIDEO = n899899 depends on BACKLIGHT_CLASS_DEVICE
···9494 int ramp_delay)9595{9696 struct tps51632_chip *tps = rdev_get_drvdata(rdev);9797- int bit = ramp_delay/6000;9797+ int bit;9898 int ret;9999100100- if (bit)101101- bit--;100100+ if (ramp_delay == 0)101101+ bit = 0;102102+ else103103+ bit = DIV_ROUND_UP(ramp_delay, 6000) - 1;104104+102105 ret = regmap_write(tps->regmap, TPS51632_SLEW_REGS, BIT(bit));103106 if (ret < 0)104107 dev_err(tps->dev, "SLEW reg write failed, err %d\n", ret);
···151151 return blocks << (ilog2(sdev->sector_size) - 9);152152}153153154154+static inline unsigned int logical_to_bytes(struct scsi_device *sdev, sector_t blocks)155155+{156156+ return blocks * sdev->sector_size;157157+}158158+154159/*155160 * A DIF-capable target device can be formatted with different156161 * protection schemes. Currently 0 through 3 are defined:
···6464 DWC2_TRACE_SCHEDULER_VB(pr_fmt("%s: SCH: " fmt), \6565 dev_name(hsotg->dev), ##__VA_ARGS__)66666767+#ifdef CONFIG_MIPS6868+/*6969+ * There are some MIPS machines that can run in either big-endian7070+ * or little-endian mode and that use the dwc2 register without7171+ * a byteswap in both ways.7272+ * Unlike other architectures, MIPS apparently does not require a7373+ * barrier before the __raw_writel() to synchronize with DMA but does7474+ * require the barrier after the __raw_writel() to serialize a set of7575+ * writes. This set of operations was added specifically for MIPS and7676+ * should only be used there.7777+ */6778static inline u32 dwc2_readl(const void __iomem *addr)6879{6980 u32 value = __raw_readl(addr);···10190 pr_info("INFO:: wrote %08x to %p\n", value, addr);10291#endif10392}9393+#else9494+/* Normal architectures just use readl/write */9595+static inline u32 dwc2_readl(const void __iomem *addr)9696+{9797+ return readl(addr);9898+}9999+100100+static inline void dwc2_writel(u32 value, void __iomem *addr)101101+{102102+ writel(value, addr);103103+104104+#ifdef DWC2_LOG_WRITES105105+ pr_info("info:: wrote %08x to %p\n", value, addr);106106+#endif107107+}108108+#endif104109105110/* Maximum number of Endpoints/HostChannels */106111#define MAX_EPS_CHANNELS 16
+20-4
drivers/usb/dwc2/gadget.c
···10181018 return 1;10191019}1020102010211021-static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value);10211021+static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value, bool now);1022102210231023/**10241024 * get_ep_head - return the first request on the endpoint···10941094 case USB_ENDPOINT_HALT:10951095 halted = ep->halted;1096109610971097- dwc2_hsotg_ep_sethalt(&ep->ep, set);10971097+ dwc2_hsotg_ep_sethalt(&ep->ep, set, true);1098109810991099 ret = dwc2_hsotg_send_reply(hsotg, ep0, NULL, 0);11001100 if (ret) {···29482948 * dwc2_hsotg_ep_sethalt - set halt on a given endpoint29492949 * @ep: The endpoint to set halt.29502950 * @value: Set or unset the halt.29512951+ * @now: If true, stall the endpoint now. Otherwise return -EAGAIN if29522952+ * the endpoint is busy processing requests.29532953+ *29542954+ * We need to stall the endpoint immediately if request comes from set_feature29552955+ * protocol command handler.29512956 */29522952-static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value)29572957+static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value, bool now)29532958{29542959 struct dwc2_hsotg_ep *hs_ep = our_ep(ep);29552960 struct dwc2_hsotg *hs = hs_ep->parent;···29722967 dev_warn(hs->dev,29732968 "%s: can't clear halt on ep0\n", __func__);29742969 return 0;29702970+ }29712971+29722972+ if (hs_ep->isochronous) {29732973+ dev_err(hs->dev, "%s is Isochronous Endpoint\n", ep->name);29742974+ return -EINVAL;29752975+ }29762976+29772977+ if (!now && value && !list_empty(&hs_ep->queue)) {29782978+ dev_dbg(hs->dev, "%s request is pending, cannot halt\n",29792979+ ep->name);29802980+ return -EAGAIN;29752981 }2976298229772983 if (hs_ep->dir_in) {···30363020 int ret = 0;3037302130383022 spin_lock_irqsave(&hs->lock, flags);30393039- ret = dwc2_hsotg_ep_sethalt(ep, value);30233023+ ret = dwc2_hsotg_ep_sethalt(ep, value, false);30403024 spin_unlock_irqrestore(&hs->lock, flags);3041302530423026 return ret;
···128128129129 platform_set_drvdata(pdev, exynos);130130131131- ret = dwc3_exynos_register_phys(exynos);132132- if (ret) {133133- dev_err(dev, "couldn't register PHYs\n");134134- return ret;135135- }136136-137131 exynos->dev = dev;138132139133 exynos->clk = devm_clk_get(dev, "usbdrd30");···177183 goto err3;178184 }179185186186+ ret = dwc3_exynos_register_phys(exynos);187187+ if (ret) {188188+ dev_err(dev, "couldn't register PHYs\n");189189+ goto err4;190190+ }191191+180192 if (node) {181193 ret = of_platform_populate(node, NULL, NULL, dev);182194 if (ret) {183195 dev_err(dev, "failed to add dwc3 core\n");184184- goto err4;196196+ goto err5;185197 }186198 } else {187199 dev_err(dev, "no device node, failed to add dwc3 core\n");188200 ret = -ENODEV;189189- goto err4;201201+ goto err5;190202 }191203192204 return 0;193205206206+err5:207207+ platform_device_unregister(exynos->usb2_phy);208208+ platform_device_unregister(exynos->usb3_phy);194209err4:195210 regulator_disable(exynos->vdd10);196211err3:
+8-2
drivers/usb/dwc3/dwc3-st.c
···129129 switch (dwc3_data->dr_mode) {130130 case USB_DR_MODE_PERIPHERAL:131131132132- val &= ~(USB3_FORCE_VBUSVALID | USB3_DELAY_VBUSVALID132132+ val &= ~(USB3_DELAY_VBUSVALID133133 | USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3)134134 | USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2135135 | USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2);136136137137- val |= USB3_DEVICE_NOT_HOST;137137+ /*138138+ * USB3_PORT2_FORCE_VBUSVALID When '1' and when139139+ * USB3_PORT2_DEVICE_NOT_HOST = 1, forces VBUSVLDEXT2 input140140+ * of the pico PHY to 1.141141+ */142142+143143+ val |= USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID;138144 break;139145140146 case USB_DR_MODE_HOST:
+24-6
drivers/usb/dwc3/gadget.c
···347347 return ret;348348}349349350350+static int dwc3_send_clear_stall_ep_cmd(struct dwc3_ep *dep)351351+{352352+ struct dwc3 *dwc = dep->dwc;353353+ struct dwc3_gadget_ep_cmd_params params;354354+ u32 cmd = DWC3_DEPCMD_CLEARSTALL;355355+356356+ /*357357+ * As of core revision 2.60a the recommended programming model358358+ * is to set the ClearPendIN bit when issuing a Clear Stall EP359359+ * command for IN endpoints. This is to prevent an issue where360360+ * some (non-compliant) hosts may not send ACK TPs for pending361361+ * IN transfers due to a mishandled error condition. Synopsys362362+ * STAR 9000614252.363363+ */364364+ if (dep->direction && (dwc->revision >= DWC3_REVISION_260A))365365+ cmd |= DWC3_DEPCMD_CLEARPENDIN;366366+367367+ memset(¶ms, 0, sizeof(params));368368+369369+ return dwc3_send_gadget_ep_cmd(dwc, dep->number, cmd, ¶ms);370370+}371371+350372static dma_addr_t dwc3_trb_dma_offset(struct dwc3_ep *dep,351373 struct dwc3_trb *trb)352374{···13361314 else13371315 dep->flags |= DWC3_EP_STALL;13381316 } else {13391339- ret = dwc3_send_gadget_ep_cmd(dwc, dep->number,13401340- DWC3_DEPCMD_CLEARSTALL, ¶ms);13171317+ ret = dwc3_send_clear_stall_ep_cmd(dep);13411318 if (ret)13421319 dev_err(dwc->dev, "failed to clear STALL on %s\n",13431320 dep->name);···2268224722692248 for (epnum = 1; epnum < DWC3_ENDPOINTS_NUM; epnum++) {22702249 struct dwc3_ep *dep;22712271- struct dwc3_gadget_ep_cmd_params params;22722250 int ret;2273225122742252 dep = dwc->eps[epnum];···2279225922802260 dep->flags &= ~DWC3_EP_STALL;2281226122822282- memset(¶ms, 0, sizeof(params));22832283- ret = dwc3_send_gadget_ep_cmd(dwc, dep->number,22842284- DWC3_DEPCMD_CLEARSTALL, ¶ms);22622262+ ret = dwc3_send_clear_stall_ep_cmd(dep);22852263 WARN_ON_ONCE(ret);22862264 }22872265}
···8383 * USB 2.0 devices need to expose both high speed and full speed8484 * descriptors, unless they only run at full speed.8585 *8686- * That means alternate endpoint descriptors (bigger packets)8787- * and a "device qualifier" ... plus more construction options8888- * for the configuration descriptor.8686+ * That means alternate endpoint descriptors (bigger packets).8987 */9088struct usb_endpoint_descriptor fsg_hs_bulk_in_desc = {9189 .bLength = USB_DT_ENDPOINT_SIZE,
+13-4
drivers/usb/gadget/legacy/inode.c
···938938 struct usb_ep *ep = dev->gadget->ep0;939939 struct usb_request *req = dev->req;940940941941- if ((retval = setup_req (ep, req, 0)) == 0)942942- retval = usb_ep_queue (ep, req, GFP_ATOMIC);941941+ if ((retval = setup_req (ep, req, 0)) == 0) {942942+ spin_unlock_irq (&dev->lock);943943+ retval = usb_ep_queue (ep, req, GFP_KERNEL);944944+ spin_lock_irq (&dev->lock);945945+ }943946 dev->state = STATE_DEV_CONNECTED;944947945948 /* assume that was SET_CONFIGURATION */···14601457 w_length);14611458 if (value < 0)14621459 break;14601460+14611461+ spin_unlock (&dev->lock);14631462 value = usb_ep_queue (gadget->ep0, dev->req,14641464- GFP_ATOMIC);14631463+ GFP_KERNEL);14641464+ spin_lock (&dev->lock);14651465 if (value < 0) {14661466 clean_req (gadget->ep0, dev->req);14671467 break;···14871481 if (value >= 0 && dev->state != STATE_DEV_SETUP) {14881482 req->length = value;14891483 req->zero = value < w_length;14901490- value = usb_ep_queue (gadget->ep0, req, GFP_ATOMIC);14841484+14851485+ spin_unlock (&dev->lock);14861486+ value = usb_ep_queue (gadget->ep0, req, GFP_KERNEL);14911487 if (value < 0) {14921488 DBG (dev, "ep_queue --> %d\n", value);14931489 req->status = 0;14941490 }14911491+ return value;14951492 }1496149314971494 /* device stalls when value < 0 */
+8-4
drivers/usb/gadget/udc/udc-core.c
···603603 }604604 }605605606606- list_add_tail(&driver->pending, &gadget_driver_pending_list);607607- pr_info("udc-core: couldn't find an available UDC - added [%s] to list of pending drivers\n",608608- driver->function);606606+ if (!driver->match_existing_only) {607607+ list_add_tail(&driver->pending, &gadget_driver_pending_list);608608+ pr_info("udc-core: couldn't find an available UDC - added [%s] to list of pending drivers\n",609609+ driver->function);610610+ ret = 0;611611+ }612612+609613 mutex_unlock(&udc_lock);610610- return 0;614614+ return ret;611615found:612616 ret = udc_bind_to_driver(udc, driver);613617 mutex_unlock(&udc_lock);
+9
drivers/usb/host/ehci-hcd.c
···368368{369369 struct ehci_hcd *ehci = hcd_to_ehci(hcd);370370371371+ /**372372+ * Protect the system from crashing at system shutdown in cases where373373+ * usb host is not added yet from OTG controller driver.374374+ * As ehci_setup() not done yet, so stop accessing registers or375375+ * variables initialized in ehci_setup()376376+ */377377+ if (!ehci->sbrn)378378+ return;379379+371380 spin_lock_irq(&ehci->lock);372381 ehci->shutdown = true;373382 ehci->rh_state = EHCI_RH_STOPPING;
+11-3
drivers/usb/host/ehci-hub.c
···872872) {873873 struct ehci_hcd *ehci = hcd_to_ehci (hcd);874874 int ports = HCS_N_PORTS (ehci->hcs_params);875875- u32 __iomem *status_reg = &ehci->regs->port_status[876876- (wIndex & 0xff) - 1];877877- u32 __iomem *hostpc_reg = &ehci->regs->hostpc[(wIndex & 0xff) - 1];875875+ u32 __iomem *status_reg, *hostpc_reg;878876 u32 temp, temp1, status;879877 unsigned long flags;880878 int retval = 0;881879 unsigned selector;880880+881881+ /*882882+ * Avoid underflow while calculating (wIndex & 0xff) - 1.883883+ * The compiler might deduce that wIndex can never be 0 and then884884+ * optimize away the tests for !wIndex below.885885+ */886886+ temp = wIndex & 0xff;887887+ temp -= (temp > 0);888888+ status_reg = &ehci->regs->port_status[temp];889889+ hostpc_reg = &ehci->regs->hostpc[temp];882890883891 /*884892 * FIXME: support SetPortFeatures USB_PORT_FEAT_INDICATOR.
+12-2
drivers/usb/host/ehci-msm.c
···179179static int ehci_msm_pm_suspend(struct device *dev)180180{181181 struct usb_hcd *hcd = dev_get_drvdata(dev);182182+ struct ehci_hcd *ehci = hcd_to_ehci(hcd);182183 bool do_wakeup = device_may_wakeup(dev);183184184185 dev_dbg(dev, "ehci-msm PM suspend\n");185186186186- return ehci_suspend(hcd, do_wakeup);187187+ /* Only call ehci_suspend if ehci_setup has been done */188188+ if (ehci->sbrn)189189+ return ehci_suspend(hcd, do_wakeup);190190+191191+ return 0;187192}188193189194static int ehci_msm_pm_resume(struct device *dev)190195{191196 struct usb_hcd *hcd = dev_get_drvdata(dev);197197+ struct ehci_hcd *ehci = hcd_to_ehci(hcd);192198193199 dev_dbg(dev, "ehci-msm PM resume\n");194194- ehci_resume(hcd, false);200200+201201+ /* Only call ehci_resume if ehci_setup has been done */202202+ if (ehci->sbrn)203203+ ehci_resume(hcd, false);195204196205 return 0;197206}207207+198208#else199209#define ehci_msm_pm_suspend NULL200210#define ehci_msm_pm_resume NULL
+13-3
drivers/usb/host/ehci-tegra.c
···8181 struct usb_hcd *hcd = platform_get_drvdata(pdev);8282 struct tegra_ehci_hcd *tegra =8383 (struct tegra_ehci_hcd *)hcd_to_ehci(hcd)->priv;8484+ bool has_utmi_pad_registers = false;84858586 phy_np = of_parse_phandle(pdev->dev.of_node, "nvidia,phy", 0);8687 if (!phy_np)8788 return -ENOENT;88899090+ if (of_property_read_bool(phy_np, "nvidia,has-utmi-pad-registers"))9191+ has_utmi_pad_registers = true;9292+8993 if (!usb1_reset_attempted) {9094 struct reset_control *usb1_reset;91959292- usb1_reset = of_reset_control_get(phy_np, "usb");9696+ if (!has_utmi_pad_registers)9797+ usb1_reset = of_reset_control_get(phy_np, "utmi-pads");9898+ else9999+ usb1_reset = tegra->rst;100100+93101 if (IS_ERR(usb1_reset)) {94102 dev_warn(&pdev->dev,95103 "can't get utmi-pads reset from the PHY\n");···10799 reset_control_assert(usb1_reset);108100 udelay(1);109101 reset_control_deassert(usb1_reset);102102+103103+ if (!has_utmi_pad_registers)104104+ reset_control_put(usb1_reset);110105 }111106112112- reset_control_put(usb1_reset);113107 usb1_reset_attempted = true;114108 }115109116116- if (!of_property_read_bool(phy_np, "nvidia,has-utmi-pad-registers")) {110110+ if (!has_utmi_pad_registers) {117111 reset_control_assert(tegra->rst);118112 udelay(1);119113 reset_control_deassert(tegra->rst);
+2-1
drivers/usb/host/ohci-q.c
···183183{184184 int branch;185185186186- ed->state = ED_OPER;187186 ed->ed_prev = NULL;188187 ed->ed_next = NULL;189188 ed->hwNextED = 0;···258259 /* the HC may not see the schedule updates yet, but if it does259260 * then they'll be properly ordered.260261 */262262+263263+ ed->state = ED_OPER;261264 return 0;262265}263266
+5
drivers/usb/host/xhci-pci.c
···3737/* Device for a quirk */3838#define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b733939#define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x10004040+#define PCI_DEVICE_ID_FRESCO_LOGIC_FL1009 0x10094041#define PCI_DEVICE_ID_FRESCO_LOGIC_FL1400 0x140041424243#define PCI_VENDOR_ID_ETRON 0x1b6f···114113 pdev->revision);115114 xhci->quirks |= XHCI_TRUST_TX_LENGTH;116115 }116116+117117+ if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC &&118118+ pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1009)119119+ xhci->quirks |= XHCI_BROKEN_STREAMS;117120118121 if (pdev->vendor == PCI_VENDOR_ID_NEC)119122 xhci->quirks |= XHCI_NEC_HOST;
+3
drivers/usb/host/xhci-plat.c
···196196 ret = clk_prepare_enable(clk);197197 if (ret)198198 goto put_hcd;199199+ } else if (PTR_ERR(clk) == -EPROBE_DEFER) {200200+ ret = -EPROBE_DEFER;201201+ goto put_hcd;199202 }200203201204 xhci = hcd_to_xhci(hcd);
+24-6
drivers/usb/host/xhci-ring.c
···290290291291 temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);292292 xhci->cmd_ring_state = CMD_RING_STATE_ABORTED;293293+294294+ /*295295+ * Writing the CMD_RING_ABORT bit should cause a cmd completion event,296296+ * however on some host hw the CMD_RING_RUNNING bit is correctly cleared297297+ * but the completion event in never sent. Use the cmd timeout timer to298298+ * handle those cases. Use twice the time to cover the bit polling retry299299+ */300300+ mod_timer(&xhci->cmd_timer, jiffies + (2 * XHCI_CMD_DEFAULT_TIMEOUT));293301 xhci_write_64(xhci, temp_64 | CMD_RING_ABORT,294302 &xhci->op_regs->cmd_ring);295303···322314323315 xhci_err(xhci, "Stopped the command ring failed, "324316 "maybe the host is dead\n");317317+ del_timer(&xhci->cmd_timer);325318 xhci->xhc_state |= XHCI_STATE_DYING;326319 xhci_quiesce(xhci);327320 xhci_halt(xhci);···12551246 int ret;12561247 unsigned long flags;12571248 u64 hw_ring_state;12581258- struct xhci_command *cur_cmd = NULL;12491249+ bool second_timeout = false;12591250 xhci = (struct xhci_hcd *) data;1260125112611252 /* mark this command to be cancelled */12621253 spin_lock_irqsave(&xhci->lock, flags);12631254 if (xhci->current_cmd) {12641264- cur_cmd = xhci->current_cmd;12651265- cur_cmd->status = COMP_CMD_ABORT;12551255+ if (xhci->current_cmd->status == COMP_CMD_ABORT)12561256+ second_timeout = true;12571257+ xhci->current_cmd->status = COMP_CMD_ABORT;12661258 }12671267-1268125912691260 /* Make sure command ring is running before aborting it */12701261 hw_ring_state = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);12711262 if ((xhci->cmd_ring_state & CMD_RING_STATE_RUNNING) &&12721263 (hw_ring_state & CMD_RING_RUNNING)) {12731273-12741264 spin_unlock_irqrestore(&xhci->lock, flags);12751265 xhci_dbg(xhci, "Command timeout\n");12761266 ret = xhci_abort_cmd_ring(xhci);···12811273 }12821274 return;12831275 }12761276+12771277+ /* command ring failed to restart, or host removed. Bail out */12781278+ if (second_timeout || xhci->xhc_state & XHCI_STATE_REMOVING) {12791279+ spin_unlock_irqrestore(&xhci->lock, flags);12801280+ xhci_dbg(xhci, "command timed out twice, ring start fail?\n");12811281+ xhci_cleanup_command_queue(xhci);12821282+ return;12831283+ }12841284+12841285 /* command timeout on stopped ring, ring can't be aborted */12851286 xhci_dbg(xhci, "Command timeout on stopped ring\n");12861287 xhci_handle_stopped_cmd_ring(xhci, xhci->current_cmd);···27382721 writel(irq_pending, &xhci->ir_set->irq_pending);27392722 }2740272327412741- if (xhci->xhc_state & XHCI_STATE_DYING) {27242724+ if (xhci->xhc_state & XHCI_STATE_DYING ||27252725+ xhci->xhc_state & XHCI_STATE_HALTED) {27422726 xhci_dbg(xhci, "xHCI dying, ignoring interrupt. "27432727 "Shouldn't IRQs be disabled?\n");27442728 /* Clear the event handler busy flag (RW1C);
+16-13
drivers/usb/host/xhci.c
···685685 u32 temp;686686 struct xhci_hcd *xhci = hcd_to_xhci(hcd);687687688688- if (xhci->xhc_state & XHCI_STATE_HALTED)689689- return;690690-691688 mutex_lock(&xhci->mutex);692692- spin_lock_irq(&xhci->lock);693693- xhci->xhc_state |= XHCI_STATE_HALTED;694694- xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;695689696696- /* Make sure the xHC is halted for a USB3 roothub697697- * (xhci_stop() could be called as part of failed init).698698- */699699- xhci_halt(xhci);700700- xhci_reset(xhci);701701- spin_unlock_irq(&xhci->lock);690690+ if (!(xhci->xhc_state & XHCI_STATE_HALTED)) {691691+ spin_lock_irq(&xhci->lock);692692+693693+ xhci->xhc_state |= XHCI_STATE_HALTED;694694+ xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;695695+ xhci_halt(xhci);696696+ xhci_reset(xhci);697697+698698+ spin_unlock_irq(&xhci->lock);699699+ }700700+701701+ if (!usb_hcd_is_primary_hcd(hcd)) {702702+ mutex_unlock(&xhci->mutex);703703+ return;704704+ }702705703706 xhci_cleanup_msix(xhci);704707···48894886 xhci->hcc_params2 = readl(&xhci->cap_regs->hcc_params2);48904887 xhci_print_registers(xhci);4891488848924892- xhci->quirks = quirks;48894889+ xhci->quirks |= quirks;4893489048944891 get_quirks(dev, xhci);48954892
+37-48
drivers/usb/musb/musb_core.c
···10901090 musb_platform_try_idle(musb, 0);10911091}1092109210931093-static void musb_shutdown(struct platform_device *pdev)10941094-{10951095- struct musb *musb = dev_to_musb(&pdev->dev);10961096- unsigned long flags;10971097-10981098- pm_runtime_get_sync(musb->controller);10991099-11001100- musb_host_cleanup(musb);11011101- musb_gadget_cleanup(musb);11021102-11031103- spin_lock_irqsave(&musb->lock, flags);11041104- musb_platform_disable(musb);11051105- musb_generic_disable(musb);11061106- spin_unlock_irqrestore(&musb->lock, flags);11071107-11081108- musb_writeb(musb->mregs, MUSB_DEVCTL, 0);11091109- musb_platform_exit(musb);11101110-11111111- pm_runtime_put(musb->controller);11121112- /* FIXME power down */11131113-}11141114-11151115-11161093/*-------------------------------------------------------------------------*/1117109411181095/*···16791702#define use_dma 016801703#endif1681170416821682-static void (*musb_phy_callback)(enum musb_vbus_id_status status);17051705+static int (*musb_phy_callback)(enum musb_vbus_id_status status);1683170616841707/*16851708 * musb_mailbox - optional phy notifier function···16881711 * Optionally gets called from the USB PHY. Note that the USB PHY must be16891712 * disabled at the point the phy_callback is registered or unregistered.16901713 */16911691-void musb_mailbox(enum musb_vbus_id_status status)17141714+int musb_mailbox(enum musb_vbus_id_status status)16921715{16931716 if (musb_phy_callback)16941694- musb_phy_callback(status);17171717+ return musb_phy_callback(status);1695171817191719+ return -ENODEV;16961720};16971721EXPORT_SYMBOL_GPL(musb_mailbox);16981722···20062028 musb_readl = musb_default_readl;20072029 musb_writel = musb_default_writel;2008203020092009- /* We need musb_read/write functions initialized for PM */20102010- pm_runtime_use_autosuspend(musb->controller);20112011- pm_runtime_set_autosuspend_delay(musb->controller, 200);20122012- pm_runtime_enable(musb->controller);20132013-20142031 /* The musb_platform_init() call:20152032 * - adjusts musb->mregs20162033 * - sets the musb->isr···21072134 if (musb->ops->phy_callback)21082135 musb_phy_callback = musb->ops->phy_callback;2109213621372137+ /*21382138+ * We need musb_read/write functions initialized for PM.21392139+ * Note that at least 2430 glue needs autosuspend delay21402140+ * somewhere above 300 ms for the hardware to idle properly21412141+ * after disconnecting the cable in host mode. Let's use21422142+ * 500 ms for some margin.21432143+ */21442144+ pm_runtime_use_autosuspend(musb->controller);21452145+ pm_runtime_set_autosuspend_delay(musb->controller, 500);21462146+ pm_runtime_enable(musb->controller);21102147 pm_runtime_get_sync(musb->controller);2111214821122149 status = usb_phy_init(musb->xceiv);···22202237 if (status)22212238 goto fail5;2222223922232223- pm_runtime_put(musb->controller);22242224-22252225- /*22262226- * For why this is currently needed, see commit 3e43a072563722272227- * ("usb: musb: core: add pm_runtime_irq_safe()")22282228- */22292229- pm_runtime_irq_safe(musb->controller);22402240+ pm_runtime_mark_last_busy(musb->controller);22412241+ pm_runtime_put_autosuspend(musb->controller);2230224222312243 return 0;22322244···22432265 usb_phy_shutdown(musb->xceiv);2244226622452267err_usb_phy_init:22682268+ pm_runtime_dont_use_autosuspend(musb->controller);22462269 pm_runtime_put_sync(musb->controller);22702270+ pm_runtime_disable(musb->controller);2247227122482272fail2:22492273 if (musb->irq_wake)···22532273 musb_platform_exit(musb);2254227422552275fail1:22562256- pm_runtime_disable(musb->controller);22572276 dev_err(musb->controller,22582277 "musb_init_controller failed with status %d\n", status);22592278···22912312{22922313 struct device *dev = &pdev->dev;22932314 struct musb *musb = dev_to_musb(dev);23152315+ unsigned long flags;2294231622952317 /* this gets called on rmmod.22962318 * - Host mode: host may still be active···22992319 * - OTG mode: both roles are deactivated (or never-activated)23002320 */23012321 musb_exit_debugfs(musb);23022302- musb_shutdown(pdev);23032303- musb_phy_callback = NULL;23042304-23052305- if (musb->dma_controller)23062306- musb_dma_controller_destroy(musb->dma_controller);23072307-23082308- usb_phy_shutdown(musb->xceiv);2309232223102323 cancel_work_sync(&musb->irq_work);23112324 cancel_delayed_work_sync(&musb->finish_resume_work);23122325 cancel_delayed_work_sync(&musb->deassert_reset_work);23262326+ pm_runtime_get_sync(musb->controller);23272327+ musb_host_cleanup(musb);23282328+ musb_gadget_cleanup(musb);23292329+ spin_lock_irqsave(&musb->lock, flags);23302330+ musb_platform_disable(musb);23312331+ musb_generic_disable(musb);23322332+ spin_unlock_irqrestore(&musb->lock, flags);23332333+ musb_writeb(musb->mregs, MUSB_DEVCTL, 0);23342334+ pm_runtime_dont_use_autosuspend(musb->controller);23352335+ pm_runtime_put_sync(musb->controller);23362336+ pm_runtime_disable(musb->controller);23372337+ musb_platform_exit(musb);23382338+ musb_phy_callback = NULL;23392339+ if (musb->dma_controller)23402340+ musb_dma_controller_destroy(musb->dma_controller);23412341+ usb_phy_shutdown(musb->xceiv);23132342 musb_free(musb);23142343 device_init_wakeup(dev, 0);23152344 return 0;···24182429 musb_writew(musb_base, MUSB_INTRTXE, musb->intrtxe);24192430 musb_writew(musb_base, MUSB_INTRRXE, musb->intrrxe);24202431 musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe);24212421- musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl);24322432+ if (musb->context.devctl & MUSB_DEVCTL_SESSION)24332433+ musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl);2422243424232435 for (i = 0; i < musb->config->num_eps; ++i) {24242436 struct musb_hw_ep *hw_ep;···26022612 },26032613 .probe = musb_probe,26042614 .remove = musb_remove,26052605- .shutdown = musb_shutdown,26062615};2607261626082617module_platform_driver(musb_driver);
···746746747747config EBC_C384_WDT748748 tristate "WinSystems EBC-C384 Watchdog Timer"749749- depends on X86 && ISA749749+ depends on X86 && ISA_BUS_API750750 select WATCHDOG_CORE751751 help752752 Enables watchdog timer support for the watchdog timer on the
+1-1
fs/btrfs/check-integrity.c
···26452645 * This algorithm is recursive because the amount of used stack space26462646 * is very small and the max recursion depth is limited.26472647 */26482648- indent_add = sprintf(buf, "%c-%llu(%s/%llu/%d)",26482648+ indent_add = sprintf(buf, "%c-%llu(%s/%llu/%u)",26492649 btrfsic_get_block_type(state, block),26502650 block->logical_bytenr, block->dev_state->name,26512651 block->dev_bytenr, block->mirror_num);
···10981098 struct inode *btree_inode = root->fs_info->btree_inode;1099109911001100 buf = btrfs_find_create_tree_block(root, bytenr);11011101- if (!buf)11011101+ if (IS_ERR(buf))11021102 return;11031103 read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree,11041104 buf, 0, WAIT_NONE, btree_get_extent, 0);···11141114 int ret;1115111511161116 buf = btrfs_find_create_tree_block(root, bytenr);11171117- if (!buf)11171117+ if (IS_ERR(buf))11181118 return 0;1119111911201120 set_bit(EXTENT_BUFFER_READAHEAD, &buf->bflags);···11721172 int ret;1173117311741174 buf = btrfs_find_create_tree_block(root, bytenr);11751175- if (!buf)11761176- return ERR_PTR(-ENOMEM);11751175+ if (IS_ERR(buf))11761176+ return buf;1177117711781178 ret = btree_read_extent_buffer_pages(root, buf, 0, parent_transid);11791179 if (ret) {···1804180418051805 /* Make the cleaner go to sleep early. */18061806 if (btrfs_need_cleaner_sleep(root))18071807+ goto sleep;18081808+18091809+ /*18101810+ * Do not do anything if we might cause open_ctree() to block18111811+ * before we have finished mounting the filesystem.18121812+ */18131813+ if (!root->fs_info->open)18071814 goto sleep;1808181518091816 if (!mutex_trylock(&root->fs_info->cleaner_mutex))···25272520 int num_backups_tried = 0;25282521 int backup_index = 0;25292522 int max_active;25302530- bool cleaner_mutex_locked = false;2531252325322524 tree_root = fs_info->tree_root = btrfs_alloc_root(fs_info, GFP_KERNEL);25332525 chunk_root = fs_info->chunk_root = btrfs_alloc_root(fs_info, GFP_KERNEL);···30052999 goto fail_sysfs;30063000 }3007300130083008- /*30093009- * Hold the cleaner_mutex thread here so that we don't block30103010- * for a long time on btrfs_recover_relocation. cleaner_kthread30113011- * will wait for us to finish mounting the filesystem.30123012- */30133013- mutex_lock(&fs_info->cleaner_mutex);30143014- cleaner_mutex_locked = true;30153002 fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root,30163003 "btrfs-cleaner");30173004 if (IS_ERR(fs_info->cleaner_kthread))···30643065 ret = btrfs_cleanup_fs_roots(fs_info);30653066 if (ret)30663067 goto fail_qgroup;30673067- /* We locked cleaner_mutex before creating cleaner_kthread. */30683068+30693069+ mutex_lock(&fs_info->cleaner_mutex);30683070 ret = btrfs_recover_relocation(tree_root);30713071+ mutex_unlock(&fs_info->cleaner_mutex);30693072 if (ret < 0) {30703073 btrfs_warn(fs_info, "failed to recover relocation: %d",30713074 ret);···30753074 goto fail_qgroup;30763075 }30773076 }30783078- mutex_unlock(&fs_info->cleaner_mutex);30793079- cleaner_mutex_locked = false;3080307730813078 location.objectid = BTRFS_FS_TREE_OBJECTID;30823079 location.type = BTRFS_ROOT_ITEM_KEY;···31883189 filemap_write_and_wait(fs_info->btree_inode->i_mapping);3189319031903191fail_sysfs:31913191- if (cleaner_mutex_locked) {31923192- mutex_unlock(&fs_info->cleaner_mutex);31933193- cleaner_mutex_locked = false;31943194- }31953192 btrfs_sysfs_remove_mounted(fs_info);3196319331973194fail_fsdev_sysfs:···41344139 ret = -EINVAL;41354140 }41364141 if (!is_power_of_2(btrfs_super_stripesize(sb)) ||41374137- btrfs_super_stripesize(sb) != sectorsize) {41424142+ ((btrfs_super_stripesize(sb) != sectorsize) &&41434143+ (btrfs_super_stripesize(sb) != 4096))) {41384144 btrfs_err(fs_info, "invalid stripesize %u",41394145 btrfs_super_stripesize(sb));41404146 ret = -EINVAL;
+7-5
fs/btrfs/extent-tree.c
···80168016 struct extent_buffer *buf;8017801780188018 buf = btrfs_find_create_tree_block(root, bytenr);80198019- if (!buf)80208020- return ERR_PTR(-ENOMEM);80198019+ if (IS_ERR(buf))80208020+ return buf;80218021+80218022 btrfs_set_header_generation(buf, trans->transid);80228023 btrfs_set_buffer_lockdep_class(root->root_key.objectid, buf, level);80238024 btrfs_tree_lock(buf);···80458044 set_extent_dirty(&trans->transaction->dirty_pages, buf->start,80468045 buf->start + buf->len - 1, GFP_NOFS);80478046 }80488048- trans->blocks_used++;80478047+ trans->dirty = true;80498048 /* this returns a buffer locked for blocking */80508049 return buf;80518050}···86608659 next = btrfs_find_tree_block(root->fs_info, bytenr);86618660 if (!next) {86628661 next = btrfs_find_create_tree_block(root, bytenr);86638663- if (!next)86648664- return -ENOMEM;86628662+ if (IS_ERR(next))86638663+ return PTR_ERR(next);86648664+86658665 btrfs_set_buffer_lockdep_class(root->root_key.objectid, next,86668666 level - 1);86678667 reada = 1;
+12-3
fs/btrfs/extent_io.c
···48924892 int uptodate = 1;48934893 int ret;4894489448954895+ if (!IS_ALIGNED(start, fs_info->tree_root->sectorsize)) {48964896+ btrfs_err(fs_info, "bad tree block start %llu", start);48974897+ return ERR_PTR(-EINVAL);48984898+ }48994899+48954900 eb = find_extent_buffer(fs_info, start);48964901 if (eb)48974902 return eb;4898490348994904 eb = __alloc_extent_buffer(fs_info, start, len);49004905 if (!eb)49014901- return NULL;49064906+ return ERR_PTR(-ENOMEM);4902490749034908 for (i = 0; i < num_pages; i++, index++) {49044909 p = find_or_create_page(mapping, index, GFP_NOFS|__GFP_NOFAIL);49054905- if (!p)49104910+ if (!p) {49114911+ exists = ERR_PTR(-ENOMEM);49064912 goto free_eb;49134913+ }4907491449084915 spin_lock(&mapping->private_lock);49094916 if (PagePrivate(p)) {···49554948 set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);49564949again:49574950 ret = radix_tree_preload(GFP_NOFS);49584958- if (ret)49514951+ if (ret) {49524952+ exists = ERR_PTR(ret);49594953 goto free_eb;49544954+ }4960495549614956 spin_lock(&fs_info->buffer_lock);49624957 ret = radix_tree_insert(&fs_info->buffer_radix,
+10-1
fs/btrfs/inode.c
···32713271 /* grab metadata reservation from transaction handle */32723272 if (reserve) {32733273 ret = btrfs_orphan_reserve_metadata(trans, inode);32743274- BUG_ON(ret); /* -ENOSPC in reservation; Logic error? JDM */32743274+ ASSERT(!ret);32753275+ if (ret) {32763276+ atomic_dec(&root->orphan_inodes);32773277+ clear_bit(BTRFS_INODE_ORPHAN_META_RESERVED,32783278+ &BTRFS_I(inode)->runtime_flags);32793279+ if (insert)32803280+ clear_bit(BTRFS_INODE_HAS_ORPHAN_ITEM,32813281+ &BTRFS_I(inode)->runtime_flags);32823282+ return ret;32833283+ }32753284 }3276328532773286 /* insert an orphan item to track this unlinked/truncated file */
+3-1
fs/btrfs/super.c
···235235 trans->aborted = errno;236236 /* Nothing used. The other threads that have joined this237237 * transaction may be able to continue. */238238- if (!trans->blocks_used && list_empty(&trans->new_bgs)) {238238+ if (!trans->dirty && list_empty(&trans->new_bgs)) {239239 const char *errstr;240240241241 errstr = btrfs_decode_error(errno);···18071807 }18081808 }18091809 sb->s_flags &= ~MS_RDONLY;18101810+18111811+ fs_info->open = 1;18101812 }18111813out:18121814 wake_up_process(fs_info->transaction_kthread);
+1-6
fs/btrfs/transaction.c
···13111311 return ret;13121312}1313131313141314-/* Bisesctability fixup, remove in 4.8 */13151315-#ifndef btrfs_std_error13161316-#define btrfs_std_error btrfs_handle_fs_error13171317-#endif13181318-13191314/*13201315 * Do all special snapshot related qgroup dirty hack.13211316 *···13801385 switch_commit_roots(trans->transaction, fs_info);13811386 ret = btrfs_write_and_wait_transaction(trans, src);13821387 if (ret)13831383- btrfs_std_error(fs_info, ret,13881388+ btrfs_handle_fs_error(fs_info, ret,13841389 "Error while writing out transaction for qgroup");1385139013861391out:
+1-1
fs/btrfs/transaction.h
···110110 u64 chunk_bytes_reserved;111111 unsigned long use_count;112112 unsigned long blocks_reserved;113113- unsigned long blocks_used;114113 unsigned long delayed_ref_updates;115114 struct btrfs_transaction *transaction;116115 struct btrfs_block_rsv *block_rsv;···120121 bool can_flush_pending_bgs;121122 bool reloc_reserved;122123 bool sync;124124+ bool dirty;123125 unsigned int type;124126 /*125127 * this root is only needed to validate that the root passed to
+2-2
fs/btrfs/tree-log.c
···24222422 root_owner = btrfs_header_owner(parent);2423242324242424 next = btrfs_find_create_tree_block(root, bytenr);24252425- if (!next)24262426- return -ENOMEM;24252425+ if (IS_ERR(next))24262426+ return PTR_ERR(next);2427242724282428 if (*level == 1) {24292429 ret = wc->process_func(root, next, wc, ptr_gen);
+2-2
fs/btrfs/volumes.c
···66076607 * overallocate but we can keep it as-is, only the first page is used.66086608 */66096609 sb = btrfs_find_create_tree_block(root, BTRFS_SUPER_INFO_OFFSET);66106610- if (!sb)66116611- return -ENOMEM;66106610+ if (IS_ERR(sb))66116611+ return PTR_ERR(sb);66126612 set_extent_buffer_uptodate(sb);66136613 btrfs_set_buffer_lockdep_class(root->root_key.objectid, sb, 0);66146614 /*
+4-3
fs/debugfs/file.c
···127127 r = real_fops->open(inode, filp);128128129129out:130130- fops_put(real_fops);131130 debugfs_use_file_finish(srcu_idx);132131 return r;133132}···261262262263 if (real_fops->open) {263264 r = real_fops->open(inode, filp);264264-265265- if (filp->f_op != proxy_fops) {265265+ if (r) {266266+ replace_fops(filp, d_inode(dentry)->i_fop);267267+ goto free_proxy;268268+ } else if (filp->f_op != proxy_fops) {266269 /* No protection against file removal anymore. */267270 WARN(1, "debugfs file owner replaced proxy fops: %pd",268271 dentry);
+1-1
fs/nfsd/blocklayout.c
···290290 return error;291291}292292293293-#define NFSD_MDS_PR_KEY 0x0100000000000000293293+#define NFSD_MDS_PR_KEY 0x0100000000000000ULL294294295295/*296296 * We use the client ID as a unique key for the reservations.
···13931393 unsigned long safe_mask = 0;13941394 unsigned int commit_max_age = (unsigned int)-1;13951395 struct reiserfs_journal *journal = SB_JOURNAL(s);13961396- char *new_opts = kstrdup(arg, GFP_KERNEL);13961396+ char *new_opts;13971397 int err;13981398 char *qf_names[REISERFS_MAXQUOTAS];13991399 unsigned int qfmt = 0;14001400#ifdef CONFIG_QUOTA14011401 int i;14021402#endif14031403+14041404+ new_opts = kstrdup(arg, GFP_KERNEL);14051405+ if (arg && !new_opts)14061406+ return -ENOMEM;1403140714041408 sync_filesystem(s);14051409 reiserfs_write_lock(s);···15501546 }1551154715521548out_ok_unlocked:15531553- replace_mount_options(s, new_opts);15491549+ if (new_opts)15501550+ replace_mount_options(s, new_opts);15541551 return 0;1555155215561553out_err_unlock:
+9-4
fs/udf/partition.c
···295295 map = &UDF_SB(sb)->s_partmaps[partition];296296 /* map to sparable/physical partition desc */297297 phyblock = udf_get_pblock(sb, eloc.logicalBlockNum,298298- map->s_partition_num, ext_offset + offset);298298+ map->s_type_specific.s_metadata.s_phys_partition_ref,299299+ ext_offset + offset);299300 }300301301302 brelse(epos.bh);···318317 mdata = &map->s_type_specific.s_metadata;319318 inode = mdata->s_metadata_fe ? : mdata->s_mirror_fe;320319321321- /* We shouldn't mount such media... */322322- BUG_ON(!inode);320320+ if (!inode)321321+ return 0xFFFFFFFF;322322+323323 retblk = udf_try_read_meta(inode, block, partition, offset);324324 if (retblk == 0xFFFFFFFF && mdata->s_metadata_fe) {325325 udf_warn(sb, "error reading from METADATA, trying to read from MIRROR\n");326326 if (!(mdata->s_flags & MF_MIRROR_FE_LOADED)) {327327 mdata->s_mirror_fe = udf_find_metadata_inode_efe(sb,328328- mdata->s_mirror_file_loc, map->s_partition_num);328328+ mdata->s_mirror_file_loc,329329+ mdata->s_phys_partition_ref);330330+ if (IS_ERR(mdata->s_mirror_fe))331331+ mdata->s_mirror_fe = NULL;329332 mdata->s_flags |= MF_MIRROR_FE_LOADED;330333 }331334
+12-10
fs/udf/super.c
···951951}952952953953struct inode *udf_find_metadata_inode_efe(struct super_block *sb,954954- u32 meta_file_loc, u32 partition_num)954954+ u32 meta_file_loc, u32 partition_ref)955955{956956 struct kernel_lb_addr addr;957957 struct inode *metadata_fe;958958959959 addr.logicalBlockNum = meta_file_loc;960960- addr.partitionReferenceNum = partition_num;960960+ addr.partitionReferenceNum = partition_ref;961961962962 metadata_fe = udf_iget_special(sb, &addr);963963···974974 return metadata_fe;975975}976976977977-static int udf_load_metadata_files(struct super_block *sb, int partition)977977+static int udf_load_metadata_files(struct super_block *sb, int partition,978978+ int type1_index)978979{979980 struct udf_sb_info *sbi = UDF_SB(sb);980981 struct udf_part_map *map;···985984986985 map = &sbi->s_partmaps[partition];987986 mdata = &map->s_type_specific.s_metadata;987987+ mdata->s_phys_partition_ref = type1_index;988988989989 /* metadata address */990990 udf_debug("Metadata file location: block = %d part = %d\n",991991- mdata->s_meta_file_loc, map->s_partition_num);991991+ mdata->s_meta_file_loc, mdata->s_phys_partition_ref);992992993993 fe = udf_find_metadata_inode_efe(sb, mdata->s_meta_file_loc,994994- map->s_partition_num);994994+ mdata->s_phys_partition_ref);995995 if (IS_ERR(fe)) {996996 /* mirror file entry */997997 udf_debug("Mirror metadata file location: block = %d part = %d\n",998998- mdata->s_mirror_file_loc, map->s_partition_num);998998+ mdata->s_mirror_file_loc, mdata->s_phys_partition_ref);99999910001000 fe = udf_find_metadata_inode_efe(sb, mdata->s_mirror_file_loc,10011001- map->s_partition_num);10011001+ mdata->s_phys_partition_ref);1002100210031003 if (IS_ERR(fe)) {10041004 udf_err(sb, "Both metadata and mirror metadata inode efe can not found\n");···10171015 */10181016 if (mdata->s_bitmap_file_loc != 0xFFFFFFFF) {10191017 addr.logicalBlockNum = mdata->s_bitmap_file_loc;10201020- addr.partitionReferenceNum = map->s_partition_num;10181018+ addr.partitionReferenceNum = mdata->s_phys_partition_ref;1021101910221020 udf_debug("Bitmap file location: block = %d part = %d\n",10231021 addr.logicalBlockNum, addr.partitionReferenceNum);···12851283 p = (struct partitionDesc *)bh->b_data;12861284 partitionNumber = le16_to_cpu(p->partitionNumber);1287128512881288- /* First scan for TYPE1, SPARABLE and METADATA partitions */12861286+ /* First scan for TYPE1 and SPARABLE partitions */12891287 for (i = 0; i < sbi->s_partitions; i++) {12901288 map = &sbi->s_partmaps[i];12911289 udf_debug("Searching map: (%d == %d)\n",···13351333 goto out_bh;1336133413371335 if (map->s_partition_type == UDF_METADATA_MAP25) {13381338- ret = udf_load_metadata_files(sb, i);13361336+ ret = udf_load_metadata_files(sb, i, type1_idx);13391337 if (ret < 0) {13401338 udf_err(sb, "error loading MetaData partition map %d\n",13411339 i);
+5
fs/udf/udf_sb.h
···6161 __u32 s_bitmap_file_loc;6262 __u32 s_alloc_unit_size;6363 __u16 s_align_unit_size;6464+ /*6565+ * Partition Reference Number of the associated physical / sparable6666+ * partition6767+ */6868+ __u16 s_phys_partition_ref;6469 int s_flags;6570 struct inode *s_metadata_fe;6671 struct inode *s_mirror_fe;
+12
include/linux/dcache.h
···575575 return inode;576576}577577578578+/**579579+ * d_real_inode - Return the real inode580580+ * @dentry: The dentry to query581581+ *582582+ * If dentry is on an union/overlay, then return the underlying, real inode.583583+ * Otherwise return d_inode().584584+ */585585+static inline struct inode *d_real_inode(struct dentry *dentry)586586+{587587+ return d_backing_inode(d_real(dentry));588588+}589589+578590579591#endif /* __LINUX_DCACHE_H */
+8-1
include/linux/iio/common/st_sensors.h
···223223 * @get_irq_data_ready: Function to get the IRQ used for data ready signal.224224 * @tf: Transfer function structure used by I/O operations.225225 * @tb: Transfer buffers and mutex used by I/O operations.226226+ * @hw_irq_trigger: if we're using the hardware interrupt on the sensor.227227+ * @hw_timestamp: Latest timestamp from the interrupt handler, when in use.226228 */227229struct st_sensor_data {228230 struct device *dev;···249247250248 const struct st_sensor_transfer_function *tf;251249 struct st_sensor_transfer_buffer tb;250250+251251+ bool hw_irq_trigger;252252+ s64 hw_timestamp;252253};253254254255#ifdef CONFIG_IIO_BUFFER···265260 const struct iio_trigger_ops *trigger_ops);266261267262void st_sensors_deallocate_trigger(struct iio_dev *indio_dev);268268-263263+int st_sensors_validate_device(struct iio_trigger *trig,264264+ struct iio_dev *indio_dev);269265#else270266static inline int st_sensors_allocate_trigger(struct iio_dev *indio_dev,271267 const struct iio_trigger_ops *trigger_ops)···277271{278272 return;279273}274274+#define st_sensors_validate_device NULL280275#endif281276282277int st_sensors_init_sensor(struct iio_dev *indio_dev,
···4242#define LED_UNREGISTERING (1 << 1)4343 /* Upper 16 bits reflect control information */4444#define LED_CORE_SUSPENDRESUME (1 << 16)4545-#define LED_BLINK_ONESHOT (1 << 17)4646-#define LED_BLINK_ONESHOT_STOP (1 << 18)4747-#define LED_BLINK_INVERT (1 << 19)4848-#define LED_BLINK_BRIGHTNESS_CHANGE (1 << 20)4949-#define LED_BLINK_DISABLE (1 << 21)5050-#define LED_SYSFS_DISABLE (1 << 22)5151-#define LED_DEV_CAP_FLASH (1 << 23)5252-#define LED_HW_PLUGGABLE (1 << 24)5353-#define LED_PANIC_INDICATOR (1 << 25)4545+#define LED_BLINK_SW (1 << 17)4646+#define LED_BLINK_ONESHOT (1 << 18)4747+#define LED_BLINK_ONESHOT_STOP (1 << 19)4848+#define LED_BLINK_INVERT (1 << 20)4949+#define LED_BLINK_BRIGHTNESS_CHANGE (1 << 21)5050+#define LED_BLINK_DISABLE (1 << 22)5151+#define LED_SYSFS_DISABLE (1 << 23)5252+#define LED_DEV_CAP_FLASH (1 << 24)5353+#define LED_HW_PLUGGABLE (1 << 25)5454+#define LED_PANIC_INDICATOR (1 << 26)54555556 /* Set LED brightness level5657 * Must not sleep. Use brightness_set_blocking for drivers···7372 * and if both are zero then a sensible default should be chosen.7473 * The call should adjust the timings in that case and if it can't7574 * match the values specified exactly.7676- * Deactivate blinking again when the brightness is set to a fixed7777- * value via the brightness_set() callback.7575+ * Deactivate blinking again when the brightness is set to LED_OFF7676+ * via the brightness_set() callback.7877 */7978 int (*blink_set)(struct led_classdev *led_cdev,8079 unsigned long *delay_on,
+1-1
include/linux/of.h
···614614 return NULL;615615}616616617617-static inline int of_parse_phandle_with_args(struct device_node *np,617617+static inline int of_parse_phandle_with_args(const struct device_node *np,618618 const char *list_name,619619 const char *cells_name,620620 int index,
···335335 * @get_trend: a pointer to a function that reads the sensor temperature trend.336336 * @set_emul_temp: a pointer to a function that sets sensor emulated337337 * temperature.338338+ * @set_trip_temp: a pointer to a function that sets the trip temperature on339339+ * hardware.338340 */339341struct thermal_zone_of_device_ops {340342 int (*get_temp)(void *, int *);
+3
include/linux/usb/gadget.h
···10341034 * @udc_name: A name of UDC this driver should be bound to. If udc_name is NULL,10351035 * this driver will be bound to any available UDC.10361036 * @pending: UDC core private data used for deferred probe of this driver.10371037+ * @match_existing_only: If udc is not found, return an error and don't add this10381038+ * gadget driver to list of pending driver10371039 *10381040 * Devices are disabled till a gadget driver successfully bind()s, which10391041 * means the driver will handle setup() requests needed to enumerate (and···1099109711001098 char *udc_name;11011099 struct list_head pending;11001100+ unsigned match_existing_only:1;11021101};1103110211041103
···264264265265static int __init kcov_init(void)266266{267267- if (!debugfs_create_file("kcov", 0600, NULL, NULL, &kcov_fops)) {267267+ /*268268+ * The kcov debugfs file won't ever get removed and thus,269269+ * there is no need to protect it against removal races. The270270+ * use of debugfs_create_file_unsafe() is actually safe here.271271+ */272272+ if (!debugfs_create_file_unsafe("kcov", 0600, NULL, NULL, &kcov_fops)) {268273 pr_err("failed to create kcov in debugfs\n");269274 return -ENOMEM;270275 }
+12-9
mm/page-writeback.c
···373373 struct dirty_throttle_control *gdtc = mdtc_gdtc(dtc);374374 unsigned long bytes = vm_dirty_bytes;375375 unsigned long bg_bytes = dirty_background_bytes;376376- unsigned long ratio = vm_dirty_ratio;377377- unsigned long bg_ratio = dirty_background_ratio;376376+ /* convert ratios to per-PAGE_SIZE for higher precision */377377+ unsigned long ratio = (vm_dirty_ratio * PAGE_SIZE) / 100;378378+ unsigned long bg_ratio = (dirty_background_ratio * PAGE_SIZE) / 100;378379 unsigned long thresh;379380 unsigned long bg_thresh;380381 struct task_struct *tsk;···387386 /*388387 * The byte settings can't be applied directly to memcg389388 * domains. Convert them to ratios by scaling against390390- * globally available memory.389389+ * globally available memory. As the ratios are in390390+ * per-PAGE_SIZE, they can be obtained by dividing bytes by391391+ * number of pages.391392 */392393 if (bytes)393393- ratio = min(DIV_ROUND_UP(bytes, PAGE_SIZE) * 100 /394394- global_avail, 100UL);394394+ ratio = min(DIV_ROUND_UP(bytes, global_avail),395395+ PAGE_SIZE);395396 if (bg_bytes)396396- bg_ratio = min(DIV_ROUND_UP(bg_bytes, PAGE_SIZE) * 100 /397397- global_avail, 100UL);397397+ bg_ratio = min(DIV_ROUND_UP(bg_bytes, global_avail),398398+ PAGE_SIZE);398399 bytes = bg_bytes = 0;399400 }400401401402 if (bytes)402403 thresh = DIV_ROUND_UP(bytes, PAGE_SIZE);403404 else404404- thresh = (ratio * available_memory) / 100;405405+ thresh = (ratio * available_memory) / PAGE_SIZE;405406406407 if (bg_bytes)407408 bg_thresh = DIV_ROUND_UP(bg_bytes, PAGE_SIZE);408409 else409409- bg_thresh = (bg_ratio * available_memory) / 100;410410+ bg_thresh = (bg_ratio * available_memory) / PAGE_SIZE;410411411412 if (bg_thresh >= thresh)412413 bg_thresh = thresh / 2;
+44-29
mm/percpu.c
···112112 int map_used; /* # of map entries used before the sentry */113113 int map_alloc; /* # of map entries allocated */114114 int *map; /* allocation map */115115- struct work_struct map_extend_work;/* async ->map[] extension */115115+ struct list_head map_extend_list;/* on pcpu_map_extend_chunks */116116117117 void *data; /* chunk data */118118 int first_free; /* no free below this */···162162static int pcpu_reserved_chunk_limit;163163164164static DEFINE_SPINLOCK(pcpu_lock); /* all internal data structures */165165-static DEFINE_MUTEX(pcpu_alloc_mutex); /* chunk create/destroy, [de]pop */165165+static DEFINE_MUTEX(pcpu_alloc_mutex); /* chunk create/destroy, [de]pop, map ext */166166167167static struct list_head *pcpu_slot __read_mostly; /* chunk list slots */168168+169169+/* chunks which need their map areas extended, protected by pcpu_lock */170170+static LIST_HEAD(pcpu_map_extend_chunks);168171169172/*170173 * The number of empty populated pages, protected by pcpu_lock. The···398395{399396 int margin, new_alloc;400397398398+ lockdep_assert_held(&pcpu_lock);399399+401400 if (is_atomic) {402401 margin = 3;403402404403 if (chunk->map_alloc <405405- chunk->map_used + PCPU_ATOMIC_MAP_MARGIN_LOW &&406406- pcpu_async_enabled)407407- schedule_work(&chunk->map_extend_work);404404+ chunk->map_used + PCPU_ATOMIC_MAP_MARGIN_LOW) {405405+ if (list_empty(&chunk->map_extend_list)) {406406+ list_add_tail(&chunk->map_extend_list,407407+ &pcpu_map_extend_chunks);408408+ pcpu_schedule_balance_work();409409+ }410410+ }408411 } else {409412 margin = PCPU_ATOMIC_MAP_MARGIN_HIGH;410413 }···444435 size_t old_size = 0, new_size = new_alloc * sizeof(new[0]);445436 unsigned long flags;446437438438+ lockdep_assert_held(&pcpu_alloc_mutex);439439+447440 new = pcpu_mem_zalloc(new_size);448441 if (!new)449442 return -ENOMEM;···476465 pcpu_mem_free(new);477466478467 return 0;479479-}480480-481481-static void pcpu_map_extend_workfn(struct work_struct *work)482482-{483483- struct pcpu_chunk *chunk = container_of(work, struct pcpu_chunk,484484- map_extend_work);485485- int new_alloc;486486-487487- spin_lock_irq(&pcpu_lock);488488- new_alloc = pcpu_need_to_extend(chunk, false);489489- spin_unlock_irq(&pcpu_lock);490490-491491- if (new_alloc)492492- pcpu_extend_area_map(chunk, new_alloc);493468}494469495470/**···737740 chunk->map_used = 1;738741739742 INIT_LIST_HEAD(&chunk->list);740740- INIT_WORK(&chunk->map_extend_work, pcpu_map_extend_workfn);743743+ INIT_LIST_HEAD(&chunk->map_extend_list);741744 chunk->free_size = pcpu_unit_size;742745 chunk->contig_hint = pcpu_unit_size;743746···892895 return NULL;893896 }894897898898+ if (!is_atomic)899899+ mutex_lock(&pcpu_alloc_mutex);900900+895901 spin_lock_irqsave(&pcpu_lock, flags);896902897903 /* serve reserved allocations from the reserved chunk if available */···967967 if (is_atomic)968968 goto fail;969969970970- mutex_lock(&pcpu_alloc_mutex);971971-972970 if (list_empty(&pcpu_slot[pcpu_nr_slots - 1])) {973971 chunk = pcpu_create_chunk();974972 if (!chunk) {975975- mutex_unlock(&pcpu_alloc_mutex);976973 err = "failed to allocate new chunk";977974 goto fail;978975 }···980983 spin_lock_irqsave(&pcpu_lock, flags);981984 }982985983983- mutex_unlock(&pcpu_alloc_mutex);984986 goto restart;985987986988area_found:···988992 /* populate if not all pages are already there */989993 if (!is_atomic) {990994 int page_start, page_end, rs, re;991991-992992- mutex_lock(&pcpu_alloc_mutex);993995994996 page_start = PFN_DOWN(off);995997 page_end = PFN_UP(off + size);···999100510001006 spin_lock_irqsave(&pcpu_lock, flags);10011007 if (ret) {10021002- mutex_unlock(&pcpu_alloc_mutex);10031008 pcpu_free_area(chunk, off, &occ_pages);10041009 err = "failed to populate";10051010 goto fail_unlock;···10381045 /* see the flag handling in pcpu_blance_workfn() */10391046 pcpu_atomic_alloc_failed = true;10401047 pcpu_schedule_balance_work();10481048+ } else {10491049+ mutex_unlock(&pcpu_alloc_mutex);10411050 }10421051 return NULL;10431052}···11241129 if (chunk == list_first_entry(free_head, struct pcpu_chunk, list))11251130 continue;1126113111321132+ list_del_init(&chunk->map_extend_list);11271133 list_move(&chunk->list, &to_free);11281134 }11291135···11411145 }11421146 pcpu_destroy_chunk(chunk);11431147 }11481148+11491149+ /* service chunks which requested async area map extension */11501150+ do {11511151+ int new_alloc = 0;11521152+11531153+ spin_lock_irq(&pcpu_lock);11541154+11551155+ chunk = list_first_entry_or_null(&pcpu_map_extend_chunks,11561156+ struct pcpu_chunk, map_extend_list);11571157+ if (chunk) {11581158+ list_del_init(&chunk->map_extend_list);11591159+ new_alloc = pcpu_need_to_extend(chunk, false);11601160+ }11611161+11621162+ spin_unlock_irq(&pcpu_lock);11631163+11641164+ if (new_alloc)11651165+ pcpu_extend_area_map(chunk, new_alloc);11661166+ } while (chunk);1144116711451168 /*11461169 * Ensure there are certain number of free populated pages for···16591644 */16601645 schunk = memblock_virt_alloc(pcpu_chunk_struct_size, 0);16611646 INIT_LIST_HEAD(&schunk->list);16621662- INIT_WORK(&schunk->map_extend_work, pcpu_map_extend_workfn);16471647+ INIT_LIST_HEAD(&schunk->map_extend_list);16631648 schunk->base_addr = base_addr;16641649 schunk->map = smap;16651650 schunk->map_alloc = ARRAY_SIZE(smap);···16881673 if (dyn_size) {16891674 dchunk = memblock_virt_alloc(pcpu_chunk_struct_size, 0);16901675 INIT_LIST_HEAD(&dchunk->list);16911691- INIT_WORK(&dchunk->map_extend_work, pcpu_map_extend_workfn);16761676+ INIT_LIST_HEAD(&dchunk->map_extend_list);16921677 dchunk->base_addr = base_addr;16931678 dchunk->map = dmap;16941679 dchunk->map_alloc = ARRAY_SIZE(dmap);
+25-6
net/sunrpc/clnt.c
···446446 return ERR_PTR(err);447447}448448449449-struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args,449449+static struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args,450450 struct rpc_xprt *xprt)451451{452452 struct rpc_clnt *clnt = NULL;453453 struct rpc_xprt_switch *xps;454454455455- xps = xprt_switch_alloc(xprt, GFP_KERNEL);456456- if (xps == NULL)457457- return ERR_PTR(-ENOMEM);458458-455455+ if (args->bc_xprt && args->bc_xprt->xpt_bc_xps) {456456+ WARN_ON(args->protocol != XPRT_TRANSPORT_BC_TCP);457457+ xps = args->bc_xprt->xpt_bc_xps;458458+ xprt_switch_get(xps);459459+ } else {460460+ xps = xprt_switch_alloc(xprt, GFP_KERNEL);461461+ if (xps == NULL) {462462+ xprt_put(xprt);463463+ return ERR_PTR(-ENOMEM);464464+ }465465+ if (xprt->bc_xprt) {466466+ xprt_switch_get(xps);467467+ xprt->bc_xprt->xpt_bc_xps = xps;468468+ }469469+ }459470 clnt = rpc_new_client(args, xps, xprt, NULL);460471 if (IS_ERR(clnt))461472 return clnt;···494483495484 return clnt;496485}497497-EXPORT_SYMBOL_GPL(rpc_create_xprt);498486499487/**500488 * rpc_create - create an RPC client and transport with one call···518508 .bc_xprt = args->bc_xprt,519509 };520510 char servername[48];511511+512512+ if (args->bc_xprt) {513513+ WARN_ON(args->protocol != XPRT_TRANSPORT_BC_TCP);514514+ xprt = args->bc_xprt->xpt_bc_xprt;515515+ if (xprt) {516516+ xprt_get(xprt);517517+ return rpc_create_xprt(args, xprt);518518+ }519519+ }521520522521 if (args->flags & RPC_CLNT_CREATE_INFINITE_SLOTS)523522 xprtargs.flags |= XPRT_CREATE_INFINITE_SLOTS;
+2
net/sunrpc/svc_xprt.c
···136136 /* See comment on corresponding get in xs_setup_bc_tcp(): */137137 if (xprt->xpt_bc_xprt)138138 xprt_put(xprt->xpt_bc_xprt);139139+ if (xprt->xpt_bc_xps)140140+ xprt_switch_put(xprt->xpt_bc_xps);139141 xprt->xpt_ops->xpo_free(xprt);140142 module_put(owner);141143}
···597597598598 mutex_unlock(&key_construction_mutex);599599600600- if (keyring)600600+ if (keyring && link_ret == 0)601601 __key_link_end(keyring, &key->index_key, edit);602602603603 /* wake up anyone waiting for a key to be constructed */
···11Partial implementation of various ring layouts, useful to tune virtio design.22Uses shared memory heavily.33+44+Typical use:55+66+# sh run-on-all.sh perf stat -r 10 --log-fd 1 -- ./ring
+69
tools/virtio/ringtest/noring.c
···11+#define _GNU_SOURCE22+#include "main.h"33+#include <assert.h>44+55+/* stub implementation: useful for measuring overhead */66+void alloc_ring(void)77+{88+}99+1010+/* guest side */1111+int add_inbuf(unsigned len, void *buf, void *datap)1212+{1313+ return 0;1414+}1515+1616+/*1717+ * skb_array API provides no way for producer to find out whether a given1818+ * buffer was consumed. Our tests merely require that a successful get_buf1919+ * implies that add_inbuf succeed in the past, and that add_inbuf will succeed,2020+ * fake it accordingly.2121+ */2222+void *get_buf(unsigned *lenp, void **bufp)2323+{2424+ return "Buffer";2525+}2626+2727+void poll_used(void)2828+{2929+}3030+3131+void disable_call()3232+{3333+ assert(0);3434+}3535+3636+bool enable_call()3737+{3838+ assert(0);3939+}4040+4141+void kick_available(void)4242+{4343+ assert(0);4444+}4545+4646+/* host side */4747+void disable_kick()4848+{4949+ assert(0);5050+}5151+5252+bool enable_kick()5353+{5454+ assert(0);5555+}5656+5757+void poll_avail(void)5858+{5959+}6060+6161+bool use_buf(unsigned *lenp, void **bufp)6262+{6363+ return true;6464+}6565+6666+void call_used(void)6767+{6868+ assert(0);6969+}
+2-2
tools/virtio/ringtest/run-on-all.sh
···33#use last CPU for host. Why not the first?44#many devices tend to use cpu0 by default so55#it tends to be busier66-HOST_AFFINITY=$(cd /dev/cpu; ls|grep -v '[a-z]'|sort -n|tail -1)66+HOST_AFFINITY=$(lscpu -p=cpu | tail -1)7788#run command on all cpus99-for cpu in $(cd /dev/cpu; ls|grep -v '[a-z]'|sort -n);99+for cpu in $(seq 0 $HOST_AFFINITY)1010do1111 #Don't run guest and host on same CPU1212 #It actually works ok if using signalling
+1-1
virt/kvm/kvm_main.c
···29412941 if (copy_from_user(&routing, argp, sizeof(routing)))29422942 goto out;29432943 r = -EINVAL;29442944- if (routing.nr >= KVM_MAX_IRQ_ROUTES)29442944+ if (routing.nr > KVM_MAX_IRQ_ROUTES)29452945 goto out;29462946 if (routing.flags)29472947 goto out;