linux-stable/drivers
Rafael J. Wysocki 4a9af6cac0 ACPI: EC: Rework flushing of EC work while suspended to idle
The flushing of pending work in the EC driver uses drain_workqueue()
to flush the event handling work that can requeue itself via
advance_transaction(), but this is problematic, because that
work may also be requeued from the query workqueue.

Namely, if an EC transaction is carried out during the execution of
a query handler, it involves calling advance_transaction() which
may queue up the event handling work again.  This causes the kernel
to complain about attempts to add a work item to the EC event
workqueue while it is being drained and worst-case it may cause a
valid event to be skipped.

To avoid this problem, introduce two new counters, events_in_progress
and queries_in_progress, incremented when a work item is queued on
the event workqueue or the query workqueue, respectively, and
decremented at the end of the corresponding work function, and make
acpi_ec_dispatch_gpe() the workqueues in a loop until the both of
these counters are zero (or system wakeup is pending) instead of
calling acpi_ec_flush_work().

At the same time, change __acpi_ec_flush_work() to call
flush_workqueue() instead of drain_workqueue() to flush the event
workqueue.

While at it, use the observation that the work item queued in
acpi_ec_query() cannot be pending at that time, because it is used
only once, to simplify the code in there.

Additionally, clean up a comment in acpi_ec_query() and adjust white
space in acpi_ec_event_processor().

Fixes: f0ac20c3f6 ("ACPI: EC: Fix flushing of pending work")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2021-12-01 20:17:32 +01:00
..
accessibility
acpi ACPI: EC: Rework flushing of EC work while suspended to idle 2021-12-01 20:17:32 +01:00
amba
android binder: fix test regression due to sender_euid change 2021-11-17 16:08:52 +01:00
ata ata: libata-sata: Declare ata_ncq_sdev_attrs static 2021-11-18 14:34:25 +09:00
atm
auxdisplay
base arch_topology: Fix missing clear cluster_cpumask in remove_cpu_topology() 2021-11-11 13:09:33 +01:00
bcma pci-v5.16-changes 2021-11-06 14:36:12 -07:00
block vhost,virtio,vdpa: bugfixes 2021-11-28 11:58:52 -08:00
bluetooth TTY / Serial driver update for 5.16-rc1 2021-11-04 09:09:37 -07:00
bus - Config updates for BMIPS platform 2021-11-13 09:11:33 -08:00
cdrom
char Char/Misc driver update for 5.16-rc1 2021-11-04 08:21:47 -07:00
clk Devicetree fixes for v5.16, take 1: 2021-11-14 11:11:51 -08:00
clocksource
comedi
connector
counter
cpufreq cpufreq: intel_pstate: ITMT support for overclocked system 2021-11-23 14:11:18 +01:00
cpuidle ARM: SoC drivers for 5.16 2021-11-03 17:00:52 -07:00
crypto pci-v5.16-changes 2021-11-06 14:36:12 -07:00
cxl cxl for v5.16 2021-11-08 11:49:48 -08:00
dax
dca
devfreq Merge branches 'pm-opp' and 'pm-cpufreq' 2021-11-10 14:06:51 +01:00
dio
dma dmaengine updates for v5.16-rc1 2021-11-10 11:47:55 -08:00
dma-buf drm next/fixes for 5.16-rc1 2021-11-12 12:11:07 -08:00
edac
eisa
extcon
firewire SCSI misc on 20211105 2021-11-05 08:42:02 -07:00
firmware firmware: smccc: Fix check for ARCH_SOC_ID not implemented 2021-11-22 11:42:59 +01:00
fpga
fsi
gnss
gpio gpio: rockchip: needs GENERIC_IRQ_CHIP to fix build errors 2021-11-16 09:41:44 +01:00
gpu xen: branch for v5.16-rc3 2021-11-26 09:54:13 -08:00
greybus
hid HID: multitouch: Fix Iiyama ProLite T1931SAW (0eef:0001 again!) 2021-11-19 16:00:21 +01:00
hsi HSI changes for the 5.16 series 2021-11-04 13:56:55 -07:00
hv Drivers: hv: balloon: Use VMBUS_RING_SIZE() wrapper for dm_ring_size 2021-11-15 12:35:56 +00:00
hwmon Merge branch 'akpm' (patches from Andrew) 2021-11-06 14:08:17 -07:00
hwspinlock
hwtracing
i2c i2c: virtio: disable timeout handling 2021-11-23 10:55:48 +01:00
i3c
idle
iio chrome platform changes for 5.16 2021-11-10 11:36:43 -08:00
infiniband RDMA/nldev: Check stat attribute before accessing it 2021-11-17 16:45:16 -04:00
input xen: add "not_essential" flag to struct xenbus_driver 2021-11-23 13:41:29 -06:00
interconnect
iommu iommu/vt-d: Fix unmap_pages support 2021-11-26 22:54:47 +01:00
ipack
irqchip irqchip/sifive-plic: Fixup EOI failed when masked 2021-11-12 16:09:51 +00:00
isdn
leds
macintosh Merge branch 'akpm' (patches from Andrew) 2021-11-06 14:08:17 -07:00
mailbox
mcb
md for-5.16/drivers-2021-11-09 2021-11-09 11:24:08 -08:00
media media fixes for v5.16-rc3 2021-11-22 14:58:57 -08:00
memory memory: mtk-smi: Fix a null dereference for the ostd 2021-11-25 14:46:00 +01:00
memstick
message pci-v5.16-changes 2021-11-06 14:36:12 -07:00
mfd chrome platform changes for 5.16 2021-11-10 11:36:43 -08:00
misc More ACPI updates for 5.16-rc1 2021-11-10 11:52:40 -08:00
mmc mmc: spi: Add device-tree SPI IDs 2021-11-23 12:32:28 +01:00
most
mtd for-5.16/drivers-2021-11-09 2021-11-09 11:24:08 -08:00
mux
net vhost,virtio,vdpa: bugfixes 2021-11-28 11:58:52 -08:00
nfc nfc: virtual_ncidev: change default device permissions 2021-11-26 11:14:31 -08:00
ntb
nubus
nvdimm libnvdimm for v5.16 2021-11-10 10:56:02 -08:00
nvme nvmet: use IOCB_NOWAIT only if the filesystem supports it 2021-11-25 15:02:40 +01:00
nvmem
of Devicetree fixes for v5.16, take 1: 2021-11-14 11:11:51 -08:00
opp
parisc
parport
pci A set of fixes for the interrupt subsystem: 2021-11-14 10:38:27 -08:00
pcmcia
perf ACPI updates for 5.16-rc1 2021-11-02 15:58:39 -07:00
phy Char/Misc driver update for 5.16-rc1 2021-11-04 08:21:47 -07:00
pinctrl pinctrl: qcom: sm8350: Correct UFS and SDC offsets 2021-11-16 02:19:15 +01:00
platform Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid 2021-11-24 09:44:13 -08:00
pnp
power
powercap powercap: DTPM: Fix suspend failure and kernel warning 2021-11-10 21:18:14 +01:00
pps
ps3
ptp ptp: ocp: Fix a couple NULL vs IS_ERR() checks 2021-11-18 12:12:55 +00:00
pwm pwm: vt8500: Rename pwm_busy_wait() to make it obviously driver-specific 2021-11-05 11:57:13 +01:00
rapidio rapidio: avoid bogus __alloc_size warning 2021-11-06 13:30:33 -07:00
ras
regulator - Remove Drivers 2021-11-08 12:07:52 -08:00
remoteproc
reset ARM: SoC drivers for 5.16 2021-11-03 17:00:52 -07:00
rpmsg remoteproc updates for v5.16 2021-11-10 09:07:26 -08:00
rtc RTC for 5.16 2021-11-12 11:44:31 -08:00
s390 s390: replace snprintf in show functions with sysfs_emit 2021-11-16 12:29:19 +01:00
sbus
scsi vhost,virtio,vdpa: bugfixes 2021-11-28 11:58:52 -08:00
sh
siox
slimbus
soc Merge branch 'exit-cleanups-for-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2021-11-10 16:15:54 -08:00
soundwire
spi spi: Fixes for v5.16 2021-11-18 14:35:41 -08:00
spmi
ssb
staging staging: rtl8192e: Fix use after free in _rtl92e_pci_disconnect() 2021-11-17 14:08:57 +01:00
target scsi: target: configfs: Delete unnecessary checks for NULL 2021-11-18 23:07:02 -05:00
tc
tee optee: fix kfree NULL pointer 2021-11-16 14:41:23 +01:00
thermal Merge branch 'thermal-int340x' 2021-11-18 20:40:28 +01:00
thunderbolt
tty xen: flag hvc_xen to be not essential for system boot 2021-11-23 13:42:08 -06:00
uio
usb USB-serial fixes for 5.16-rc3 2021-11-25 13:27:40 +01:00
vdpa vdpa_sim: avoid putting an uninitialized iova_domain 2021-11-24 19:00:29 -05:00
vfio
vhost vhost-vdpa: clean irqs before reseting vdpa device 2021-11-24 19:00:28 -05:00
video xen: branch for v5.16-rc3 2021-11-26 09:54:13 -08:00
virt
virtio Revert "virtio_ring: validate used buffer length" 2021-11-24 18:47:27 -05:00
visorbus
vlynq
vme
w1
watchdog linux-watchdog 5.16-rc1 tag 2021-11-10 09:41:22 -08:00
xen xen: detect uninitialized xenbus in xenbus_init 2021-11-24 08:55:15 -06:00
zorro
Kconfig
Makefile