lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3163997.44csPzL39Z@kreacher>
Date:   Tue, 23 Nov 2021 19:40:50 +0100
From:   "Rafael J. Wysocki" <rjw@...ysocki.net>
To:     Linux ACPI <linux-acpi@...r.kernel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Linux PM <linux-pm@...r.kernel.org>
Subject: [PATCH 06/10] ACPI: EC: Simplify locking in acpi_ec_event_handler()

From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>

Because acpi_ec_event_handler() is a work function, it always
runs in process context with interrupts enabled, so it can use
spin_lock_irq() and spin_unlock_irq() for the locking.

Make it do so and adjust white space around those calls.

No expected functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
---
 drivers/acpi/ec.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Index: linux-pm/drivers/acpi/ec.c
===================================================================
--- linux-pm.orig/drivers/acpi/ec.c
+++ linux-pm/drivers/acpi/ec.c
@@ -1217,18 +1217,18 @@ err_exit:
 
 static void acpi_ec_event_handler(struct work_struct *work)
 {
-	unsigned long flags;
 	struct acpi_ec *ec = container_of(work, struct acpi_ec, work);
 
 	ec_dbg_evt("Event started");
 
-	spin_lock_irqsave(&ec->lock, flags);
+	spin_lock_irq(&ec->lock);
+
 	while (ec->nr_pending_queries) {
-		spin_unlock_irqrestore(&ec->lock, flags);
+		spin_unlock_irq(&ec->lock);
 
 		acpi_ec_query(ec);
 
-		spin_lock_irqsave(&ec->lock, flags);
+		spin_lock_irq(&ec->lock);
 		ec->nr_pending_queries--;
 	}
 
@@ -1241,23 +1241,23 @@ static void acpi_ec_event_handler(struct
 	    ec_event_clearing == ACPI_EC_EVT_TIMING_QUERY)
 		acpi_ec_complete_query(ec);
 
-	spin_unlock_irqrestore(&ec->lock, flags);
+	spin_unlock_irq(&ec->lock);
 
 	ec_dbg_evt("Event stopped");
 
 	if (ec_event_clearing == ACPI_EC_EVT_TIMING_EVENT && ec_guard(ec)) {
-		spin_lock_irqsave(&ec->lock, flags);
+		spin_lock_irq(&ec->lock);
 
 		/* Take care of SCI_EVT unless someone else is doing that. */
 		if (!ec->curr)
 			advance_transaction(ec, false);
 
-		spin_unlock_irqrestore(&ec->lock, flags);
+		spin_unlock_irq(&ec->lock);
 	}
 
-	spin_lock_irqsave(&ec->lock, flags);
+	spin_lock_irq(&ec->lock);
 	ec->events_in_progress--;
-	spin_unlock_irqrestore(&ec->lock, flags);
+	spin_unlock_irq(&ec->lock);
 }
 
 static void acpi_ec_handle_interrupt(struct acpi_ec *ec)



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ