From nobody Sat Jul 25 00:52:28 2026 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39E2D44A739 for ; Tue, 21 Jul 2026 09:56:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784627817; cv=none; b=Qau9Kph8jm3g0ATBT/bZFrvI4PoCiUVf8ZEQ3N0vce5UNE3ckBUqhPSEMikVqfBV4j5wmM0uz2VmEK+uzYIW60w20mVtBNMRpLvq0Dnp0UX6VNt3liOeXEv/uO/TzPYJtQUhOxuYavwOE59GxgUVr9Law78oblm6y4042QFhz0k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784627817; c=relaxed/simple; bh=tikWYDEQLVc5waY2/78bTj9CLn2yecpBpXsk/U5GP90=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=eOzcVJDok3sUG/r5mlT1JbOZtr7IkSUJVd+av91hJsc98BhSnDpqKSS2PhAC5UNXSNXM1UucFUiNt3mpCAcoLZrRHESuj9Fl6kNKmJSUlfo8gwEg3VFBNXFUpYCyE6wSsDd7Y04urJn83sppVn33CVSeDOSIBpnT9Bc+51eQOCU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=pQJxuUM6; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pQJxuUM6" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-2cf50c6f235so31220035ad.0 for ; Tue, 21 Jul 2026 02:56:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784627814; x=1785232614; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=b4FztRgbbuu/DGlKT6aKIPa27gZ9w0psRj4kEpq+JGc=; b=pQJxuUM6JCcA38h3IKGJrRdbLZjDnsOzqJn+qXUWJwkYny2Hmpu9wQUmJ5tWV2Dx3p 1Y6cFMFJpIYs0WTGnWlmGIWHIuj8Ug7kArFdJuzH6S+4vI/ElpeJLmL95Ag4aKXbPd2T MGe0YuXfgdTvf9Ww6nXTbXwuClxBMaUaro0dycVMqlruyIFHY6RAe1CrWf+UrfkADnNq CdwUcdO7yot8BW6uXRWw2w2ifFAFwy2UoNOoU2Tp1PiuGbMNfgxiRr/cOGat3/RlIpHD QK4cUE40QCyoiQPq2+86NcHbgMMYq40qdUPqmOGkWszqHlvP+yktgQeckTieMSjyopY/ 0eew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784627814; x=1785232614; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=b4FztRgbbuu/DGlKT6aKIPa27gZ9w0psRj4kEpq+JGc=; b=FeUFrYgrdKd8qdsDmWLu+nDxNaUUjQ7yNJSVQEsUdFVXwmvujPe+ZOIZTJIlXIaGIy ZZQALFcHxiSBtUMMEAUkIMiPxG2rb4txNNmG5TyS+NHDIfk1QUpuv/o2LnS6xou19ylY Wzxul05DIq5l345tmPUAdnf71BuI5BiMwfFUQUo6kP9gYVKa2HBYkACEbEkCgTNlObY6 UIXYfVM7ptHDlTeKCZuR8tNoLAg2phlkFlHRa+ssNSpgNoR8rMoQh+kQ87mqnPxI/EQ7 3YBhqfAQftJ3FsPYXtBsPRIqHU20zEZcEhgfyAp9EpV/WGvimo6XrOIlsrOssaXyFV+w 0UeA== X-Forwarded-Encrypted: i=1; AHgh+RpLso3Ovm/XMfOO7gVtmxvXGCGNNUhOYb80wlu/bxH/dIPaq2suZUIn7ti1pRJmYlBDbqu8EIpgK1Jl70Q=@vger.kernel.org X-Gm-Message-State: AOJu0YwBLhCFjiOjdEBi/JawKPziUYKbIwhcH3Avq67rjUObvidI5DA5 K9lmYu6cJoQYp8IHaZfU9h4YlkiyQH4gILAAkykHS9bLYGUvb9v7gbXS X-Gm-Gg: AR+sD11QDecxTYKKuYlg1PxQvb4p/jZbWkYHRLo9JmChwdhroIu2VfsM7rDSqh8cPbE zmE/C+gPpvNZPFNqJYItTmDOnpfkfLy7aofarkvdcsVQ7UjOE8lzqSdIt5gRT2hZupKjCh0v0Fd ru1APHlckJeSkhJVG1aDBRd32RTcgOEXXtJfdRe3OC/5aS6C4jJ5CpqxF/f+e5uMaOegAjL4wBp lugF8BC1/9HE5vgSgscJueqg+gMYFh1mmfa6zzI46TpvckxhWhR8HHRuJo8nosOfLG0c6txALrx 7kLs1aM1NIiMJ9fHAVrhLXlPf1//26bDAsS3sZ6OAanA2Xzyxu9Mdengxk/iSJVdfYiPyh5nsQw dRa0qBFgHWFAuQdkHUlEWTMXuelvCOleJadH70JRsaBICv3kXdrVqu6Bvo4CCdB7C1s5riJa5LG u0ONJA1kFzWS+lkjn+o7wwCUb5gtS4uLMTKSMw X-Received: by 2002:a17:902:ce0d:b0:2cc:9a86:9c42 with SMTP id d9443c01a7336-2cf349eb316mr181225525ad.45.1784627814521; Tue, 21 Jul 2026 02:56:54 -0700 (PDT) Received: from localhost.localdomain ([125.20.165.194]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3142a20b1f3sm44496508eec.26.2026.07.21.02.56.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Jul 2026 02:56:53 -0700 (PDT) From: Aayush7352 To: linux-staging@lists.linux.dev Cc: Marc Dietrich , Greg Kroah-Hartman , linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, Dan Carpenter , Aayush Dixit Subject: [PATCH] staging: nvec: fix power-off path to not depend on workqueue Date: Tue, 21 Jul 2026 15:26:46 +0530 Message-ID: <20260721095646.80663-1-aayushdixit924@gmail.com> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Aayush Dixit nvec_power_off() uses nvec_write_async() which queues work via schedule_work(). During system shutdown or reboot, workqueues may be frozen, so the AP_PWR_DOWN message never reaches the embedded controller and the system hangs instead of powering off. Fix by calling nvec_request_master() directly after queuing the power-off messages, processing the TX queue synchronously in the power-off context. Also add a NULL guard for nvec_power_handle. This addresses the TODO item "add atomic ops in order to fix shutoff/reboot problems" in drivers/staging/nvec/TODO. Signed-off-by: Aayush Dixit --- This patch has not been tested. Compile-tested and checkpatch-clean only. drivers/staging/nvec/nvec.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index 88c416ee0..938ea8f34 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -774,10 +774,23 @@ static void nvec_disable_i2c_slave(struct nvec_chip *= nvec) =20 static void nvec_power_off(void) { + struct nvec_chip *nvec =3D nvec_power_handle; char ap_pwr_down[] =3D { NVEC_SLEEP, AP_PWR_DOWN }; =20 - nvec_toggle_global_events(nvec_power_handle, false); - nvec_write_async(nvec_power_handle, ap_pwr_down, 2); + if (!nvec) + return; + + nvec_toggle_global_events(nvec, false); + nvec_write_async(nvec, ap_pwr_down, 2); + + /* + * Process the TX queue directly instead of relying on the + * workqueue. Workqueues may be frozen during the power-off + * sequence, so schedule_work() from nvec_write_async() may + * not execute, leaving the AP_PWR_DOWN message unsent and + * the system unable to power off. + */ + nvec_request_master(&nvec->tx_work); } =20 static int tegra_nvec_probe(struct platform_device *pdev) --=20 2.55.0