Received: by 10.223.185.116 with SMTP id b49csp8315620wrg; Thu, 1 Mar 2018 22:46:28 -0800 (PST) X-Google-Smtp-Source: AG47ELueffNMYRa6Zv6OTifflWrjLLnkcNTABu8RoERwTlOtszf+e9ohcIp4blFHae1T9+sy3Uv7 X-Received: by 10.98.80.15 with SMTP id e15mr4599811pfb.90.1519973188420; Thu, 01 Mar 2018 22:46:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519973188; cv=none; d=google.com; s=arc-20160816; b=qDxCzV8qvgUHsNO3TIt48RfAjQ9Tb79/XOC83ekdOkoMEDkJxwQlRnhOuRXhcCMLoI RjESw3tCMna22Egci8i00OKQ/9LZp/QLBtVT0KpUNRISCkDSyUPyo6FOoaejMb1s+CYh MrTIQOojy1ib8L5y40wjeKMyyaqchz4tTPkUdst4tCV5TvP8xs2+SW5f/+GdzJYTnUIl K0HZhN3hc7lILxI8M77mv77zZ8QDBVPjK0xPsaX1UCYNhNBGGmuEoFe2HTiWLK0kJn49 BMfG6O4uNCEW2kjnIt2Ibfh2RuZuvTI0IPgAuQeOsAwOiMPyU8cutB/SaWUdIGyZucos Blvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=DyFe2sukaoddhFImNvyOG9CSsf/X31riqQI0WUmsgXA=; b=AcxzWpcIVnHq5ey31L9jqIzzFqu1w7eGDDSwmeTFwgzhwlJmSo+zYuN0e3rnXUhsSo s9Sa5LSJSq+NIRE4tIospybGWaJlEV3YrQemaNDGGzlpqsL8TyJBPkGOi1Xi+L91x5mD 1ZcibrEKAxOeFwm/oHhE3/4S3s8a/Nrb4v3rhwE37s0ZmL//1J9znagoCC+3KslYpxbM pIAl3x6WmBIqYFIQqPk4/xtpTPqM18d8R37gpt943mzEXVr8VKyEhfQwWTvMJ4fOuQ60 BUeVFmnMvgLrGtlHVpKrVXtWHQNAsM8QFOzLQ5hawcrbpKWpTPfl5RcpWiBu6H6VOCLV w6Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Z+qTDSZn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z3si3614759pgs.71.2018.03.01.22.46.13; Thu, 01 Mar 2018 22:46:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Z+qTDSZn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1164719AbeCBGfQ (ORCPT + 99 others); Fri, 2 Mar 2018 01:35:16 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34384 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933010AbeCBGfO (ORCPT ); Fri, 2 Mar 2018 01:35:14 -0500 Received: by mail-pf0-f194.google.com with SMTP id j20so3586654pfi.1; Thu, 01 Mar 2018 22:35:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=DyFe2sukaoddhFImNvyOG9CSsf/X31riqQI0WUmsgXA=; b=Z+qTDSZn6hG1jDQizxGzKJLvUiXLYuI6+Vs8uvK5varkyQ2voTI1z6vHtbUvQg+dcD QzhqSK+lIrotKM+nTOw+IA4Eqw69jALSTOrK2Wmanu7I4LR6i0T3KbEFeawPdgAwkzQC J0BoZ3wMFm1daqz3shB/UOLZEuXc1KsCSHjEAmQWT73vLKUHPoCmQv3QVRAhoUayt9j6 sSPb9NQ+0YVD+ko/Aq7Zo/haMsWCH0iz1gBEF5cHgyCkFcebnDojGNIsYe6fX7C0qQwf 6gms8x74Li9WyqkXnLFA4MuxDTmDEU8OhJj2ZbkOiCkO96N2CupXAZRXwcL8ZSujqxst zX/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=DyFe2sukaoddhFImNvyOG9CSsf/X31riqQI0WUmsgXA=; b=UDrnYrJPft67bdp2jFfPlGuXWs+w5Cgpl5dkcCo6EqcQ43JBDyw4wfpa7jStOP9SGK HuUApOgYNXiC8IYrFUljRkwqG1RPuhYHb6C3sY1YGZculMDBQFWJIJFEkTdRI0iSQcu6 F3u2Q2/LXtxDSgQM6BReFDowxf917DTvZYV4shK5JfNKmiQf84k3iAytsXmHU7e1Y2Fx R2moyFHmcPFNBaoO9/lfjprV3meT5raxX4Yzk5GjV3Isj8L0+ovczK3VtcBj+olPn5BU tXpM37WzuXSC3vlYCcg31u5SD9SVjfvoKG4cQLB/dkXHKhzgqlo8MA20/ey2qwJxEo9L vK7w== X-Gm-Message-State: APf1xPDkeUADvlZAEKgkUUS3usjiJssxNFQLVuY74MjX04a6rIPUdH3C koLB/HaxhF6NFsYeIsFrCnk= X-Received: by 10.101.80.68 with SMTP id k4mr3675224pgo.81.1519972513702; Thu, 01 Mar 2018 22:35:13 -0800 (PST) Received: from linux-uc2j.site ([124.11.22.254]) by smtp.gmail.com with ESMTPSA id 73sm7682544pfz.165.2018.03.01.22.35.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Mar 2018 22:35:12 -0800 (PST) From: "Lee, Chun-Yi" X-Google-Original-From: "Lee, Chun-Yi" To: "Rafael J . Wysocki" Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Lee, Chun-Yi" , Michal Hocko , Len Brown Subject: [PATCH] ACPI / scan: Send the change uevent with offine environmental data Date: Fri, 2 Mar 2018 14:35:08 +0800 Message-Id: <20180302063508.15818-1-jlee@suse.com> X-Mailer: git-send-email 2.10.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In current design of ACPI container offline, Kernel emits KOBJ_CHANGE uevent to user space to indidate that the ejection of the container was triggered by platform. (caa73ea15 patch) A pure KOBJ_CHANGE uevent is not enough for user space to identify the purpose. For example, a "udevadm trigger" command can also be used to emit change event to all udev rules. A udev rule can not identify that the event is from kernel for offline or from udevadm for other purpose. Then the offline action in udev rule may also be triggered by udevadm tool. So, similar to the change uevent of dock, kernel sends the KOBJ_CHANGE uevent with a offline environmental data to indicate purpose. It's useful by udev rule for using ENV{EVENT} filter. Cc: Michal Hocko Cc: "Rafael J. Wysocki" Cc: Len Brown Signed-off-by: "Lee, Chun-Yi" --- drivers/acpi/scan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 8e63d93..f6dca9b 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -116,6 +116,7 @@ bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent) { struct acpi_device_physical_node *pn; bool offline = true; + static const char *envp[] = { "EVENT=offline", NULL }; /* * acpi_container_offline() calls this for all of the container's @@ -126,7 +127,7 @@ bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent) list_for_each_entry(pn, &adev->physical_node_list, node) if (device_supports_offline(pn->dev) && !pn->dev->offline) { if (uevent) - kobject_uevent(&pn->dev->kobj, KOBJ_CHANGE); + kobject_uevent_env(&pn->dev->kobj, KOBJ_CHANGE, envp); offline = false; break; -- 2.10.2