Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1726508lqb; Sun, 26 May 2024 14:40:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVlHwvA+r6BrK4j/evYlRzP9ncvPddvwPf2audwOnXst0fr/Zcc8T2kM2riqUwHenC8hAAjF91vd5kLy1PdNqUsWPtj0GKnTKjMcUvBsQ== X-Google-Smtp-Source: AGHT+IHbX+nA5sOSBPCS59txjEbSq+klCbbwyEFLPb+QLQgkRZRTzZzMJp0vPh+DdfYIj0WhA4OY X-Received: by 2002:a05:6a20:9155:b0:1b1:e35f:3efc with SMTP id adf61e73a8af0-1b212d4aed7mr8780530637.29.1716759638934; Sun, 26 May 2024 14:40:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716759638; cv=pass; d=google.com; s=arc-20160816; b=gh/a6uPyxFmdz789qXLoXzYat9Ukdki7dlBIV1JHrHeZg/ffnHpOtKLG6OYFqfRxiw 9nFDCxCF8W72E4Uoo3xdV3TrklTvZzmNtK24RrznQwJGcdapbQICQBqQlvKMXwiAimA+ qL3qiGJTkEf8LW4XPRmQ2xd2snBNY+p6lEMLc5OCcXONp+PhKcGQT/guVKgBYgHMrdVL hTU/4n2wRthRHk6rJNB60WSKB+lPrjv1CR+F7akGpt2N4eX9l+gj/d4mMxDkghjrAYse gX4QGrwpA7RH3IKcKdSLPq/8v3WKbm8wsLkPtvW2SEVw9mYbyhwQAy36Qytg2EYE6DrT Igag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :from:dkim-signature; bh=qRhsjmr+BGNPugj+44pbnTND+KmSZhBNMPBlFLfEYXE=; fh=SXswZtumwGfRnMx++cf2lkzClUJJLicNungqbk5AoiI=; b=xNUj/ESVATcnOkapSyMV9qcvAuxjMI1SuIEHNIMuKoRraA4n2izzj5SfkNAgWrQa8K cLnPy46Nja9UhxNLIvUVyFUXULsdv80sIuxknREjaSBDl9WlKVD/48wv2Se4qOvBWJFA kbUi3aC6HjHWngDVVGKp83t3L+8P8NG3PJuuB+MnB55SWahWs3yrYZMeCRxCSCc+m0u8 Kv8aPKWaX/S2h5zFAkA7usvEGSfMjl2Lq91iPNQOZ5kRygYsI2jVUAyrLziVjrXHfOdo jth69fdEobl12uMOsM4rLURJ+RZw+9LlBml2maFczzWjvAOUyWLW6XkXflRdWaKXQMKp Wt+Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=uPCdcLmE; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net dmarc=pass fromdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-189881-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189881-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=weissschuh.net Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bf5fccebc8si4921104a91.65.2024.05.26.14.40.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 14:40:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189881-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=uPCdcLmE; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net dmarc=pass fromdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-189881-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189881-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=weissschuh.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 834E7B2104F for ; Sun, 26 May 2024 21:40:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD4E013A25E; Sun, 26 May 2024 21:40:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="uPCdcLmE" Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D64101EB3F; Sun, 26 May 2024 21:40:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716759623; cv=none; b=MBdU1JOGAIdN2FVENIpeJKEMDy0ocpNt7pX1MMPQRRhXGRrTXoneqksPje1HLiXK52eCddWeZbxKeiuCaCNMn4GnqS47urPmn9TueDaLFMr3+AZzrHLlI0JKNJU6RMftPVr2Kteo0Jcf2aRM/Xspg1c8yrWRqP7ocsbmN/ALvN8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716759623; c=relaxed/simple; bh=EQmU3js+i7J6XMtR1sPBepkOKA2uG18sojoN3Bu3988=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=Wq3DHIV/XcmyjH0lQQS95y1p67vrdxPAEVmYczDsSeSVLvmJi1QND80bgp55MPKt+BVJu4Woe+75QkzzqEK4yYEANrUC9vY3bP2iiWOY9dhucdLJ56ehgHd0X66m023L5hz7D0xgRQnXFs4KLzQnKJRwirJtXkWeoQJVkMu9cWA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=uPCdcLmE; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1716759617; bh=EQmU3js+i7J6XMtR1sPBepkOKA2uG18sojoN3Bu3988=; h=From:Date:Subject:To:Cc:From; b=uPCdcLmERA64szIvlxaC24kOOSCTJL5W3sFcOEGDWtp41hfHsxnCjePoKUQGD8FkY cOkyuVcJ8VpNz4vibF3nRIv8HMDTCA9uh4Fhi30bsNgQFezDvi3GIphMGLmhrPFccS nu531i26iBay9aX8LMkN/oMu/yCQSSfkRHlKXWkQ= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 26 May 2024 23:40:01 +0200 Subject: [PATCH] ACPI: AC: Properly notify powermanagement core about changes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240526-acpi-ac-changed-v1-1-f4b5997753bb@weissschuh.net> X-B4-Tracking: v=1; b=H4sIADCsU2YC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIxMDUyMz3cTkgkwgoQuRTdFNNLBINrM0MUxMNTVUAuoqKEpNy6wAmxgdW1s LAOi3GvxhAAAA To: "Rafael J. Wysocki" , Len Brown , Sebastian Reichel Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Rajas Paranjpe , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716759616; l=2189; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=EQmU3js+i7J6XMtR1sPBepkOKA2uG18sojoN3Bu3988=; b=j+GJCEXFVOvovJMdyQteps+Udm76p3T99Fm1QXOnLD7X1riMBs6SJH1l7KvCDX7QxLAIDjRtZ P6KCe0/kr+aAxkMNg3A5UGDV3056MpnEv+H/aXH/MS8qO809EDsziUX X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The powermanagement core does various actions when a powersupply changes. It calls into notifiers, LED triggers, other power supplies and emits an uevent. To make sure that all these actions happen properly call power_supply_changed(). Reported-by: Rajas Paranjpe Closes: https://github.com/MrChromebox/firmware/issues/420#issuecomment-2132251318 Signed-off-by: Thomas Weißschuh --- drivers/acpi/ac.c | 4 ++-- drivers/acpi/sbs.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 2d4a35e6dd18..09a87fa222c7 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c @@ -145,7 +145,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) dev_name(&adev->dev), event, (u32) ac->state); acpi_notifier_call_chain(adev, event, (u32) ac->state); - kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE); + power_supply_changed(ac->charger); } } @@ -268,7 +268,7 @@ static int acpi_ac_resume(struct device *dev) if (acpi_ac_get_state(ac)) return 0; if (old_state != ac->state) - kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE); + power_supply_changed(ac->charger); return 0; } diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 94e3c000df2e..dc8164b182dc 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c @@ -610,7 +610,7 @@ static void acpi_sbs_callback(void *context) if (sbs->charger_exists) { acpi_ac_get_present(sbs); if (sbs->charger_present != saved_charger_state) - kobject_uevent(&sbs->charger->dev.kobj, KOBJ_CHANGE); + power_supply_changed(sbs->charger); } if (sbs->manager_present) { @@ -622,7 +622,7 @@ static void acpi_sbs_callback(void *context) acpi_battery_read(bat); if (saved_battery_state == bat->present) continue; - kobject_uevent(&bat->bat->dev.kobj, KOBJ_CHANGE); + power_supply_changed(bat->bat); } } } --- base-commit: 6fbf71854e2ddea7c99397772fbbb3783bfe15b5 change-id: 20240526-acpi-ac-changed-a08c6941ae51 Best regards, -- Thomas Weißschuh