Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp925406ybt; Wed, 24 Jun 2020 15:01:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyN7GxUap1AreoeNAojymCN6KQQUb7JJcR2aPi6J+ihLoLwFSSEJqNAp1WD9X/xmrj7x508 X-Received: by 2002:a17:906:e25a:: with SMTP id gq26mr7618253ejb.152.1593036096657; Wed, 24 Jun 2020 15:01:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593036096; cv=none; d=google.com; s=arc-20160816; b=IPrLFuxDWxhZ1WggdPJlg2e5abKC4sAKEBzrWYeqcqtLQ0Hk6u8K0WwyA2U20DqFhb oIB3Vm5WH5O6xlQB50xia8tWRfhQXr2Np2EfgPVTBrSQoCOZwf+HGBJW3kwjWjEeTXgm BwLRflSqjchVZvKt2Vm36BMB8CK5sYctzrXmQl1UfhDLbG0O/uIsuRPxmq3mVIU8C6sF eQzrEDaqbjCTmqNHsmTllKLvvYmQUD7eQBCnlotLJPwPldMd6ASQ2GRvzc4vm8jXr2lo b9xsCRpw7rJCjeYQzLHy2IOScZz+86ohs8CNcPpHuz+J7AHLC9ug+E4rLQ2sjjhGda5z yyLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=2MJjDisSYsFLi9xjpuxw/vmSuouvLE6xSiePJnwRksg=; b=IJqdidvw8NDKKwElX8VoWDdSzyQGR2wnF/PkM0JP2YjFSjhT1gQIn8t6Vi8IaRXorG bsGrj1W/mLkdqnOcWCFcfj6cBldGEnymw4OwywDRabrZVVewVUwVLJ1BCcAxAtPS57HT UcJYYfb92zL+J59vdy9p4NB9RIyeLTk+4wBwuSNerBxyo4qy0oinmx/A87PPcZJsOKWS 6iJHlTjM0TgiNYset0xJFPneQFRoIzWTe1t1FN+wWt+Kl5ao1yp4+Ip9/ZO5xr7w2sjn Px5qhy9XT9sbyY6eCg0DN1pkGhOOht/si18ZqlUiH6A8ojPV8tRHfc+dfcPvx6ONkKYi 7+jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nGg2gjeB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cy20si3264757edb.344.2020.06.24.15.01.12; Wed, 24 Jun 2020 15:01:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nGg2gjeB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389395AbgFXVG0 (ORCPT + 99 others); Wed, 24 Jun 2020 17:06:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389106AbgFXVGX (ORCPT ); Wed, 24 Jun 2020 17:06:23 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8F08C0613ED for ; Wed, 24 Jun 2020 14:06:23 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id a127so1775336pfa.12 for ; Wed, 24 Jun 2020 14:06:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2MJjDisSYsFLi9xjpuxw/vmSuouvLE6xSiePJnwRksg=; b=nGg2gjeBPhPwU7thZ1v6JzWty3y8rRAI/iIlXN0JlQmZd1dX6Taavm70RQncr/FVmX IlFoXu2K3JqzWg6Ejw0e4HbVfWsQpgjWv1qYxIw5YiQraZTpAQ58NssIb/+GUnyUzA8L 5Q/WN5nncXm7ARdnvhcEtDn54pJv/0PFKq+IY= 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:mime-version :content-transfer-encoding; bh=2MJjDisSYsFLi9xjpuxw/vmSuouvLE6xSiePJnwRksg=; b=TuwDg40JymGb/o+8PuqLux0XXoSSjWdZR1To8h/N1CnDMvdmtZLnu4fuXdB3Ik5l/s 1ALdM7b7juqI/Y3HHvevMa/chvitkrax4KAjW/oV7kD7autdfGICr4zwDN3MeEMQqNWR 5Us2/R210eKpWS0XKeZuTn/9l3U0Lf8w0G0ku3zV4f1jDpvfG7A4sff2N6F2XU/moE/Q u1hhP4MAp+DZ9vpRbKtxbjdOvb6yVhZDVvRSsqWq/7k2iTh4muUI/Tt6v1qUZ7d8H7aH fxQ2gz5jXqNmSpu6kVil9pQxFzzZWTRduIdgHHrvdLBg60y4hLuUU8SEp+vcwaeVFW5V YCCA== X-Gm-Message-State: AOAM531udlddK7QuMztMBfXMDId//1tc6LtEuDI0XDgPfWOZpxst/tLk FW54wMLx6xbfA022EGUficil3KMuqho= X-Received: by 2002:a62:4d46:: with SMTP id a67mr14170483pfb.290.1593032783177; Wed, 24 Jun 2020 14:06:23 -0700 (PDT) Received: from apsdesk.mtv.corp.google.com ([2620:15c:202:1:e09a:8d06:a338:aafb]) by smtp.gmail.com with ESMTPSA id y9sm442927pfn.84.2020.06.24.14.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 14:06:22 -0700 (PDT) From: Abhishek Pandit-Subedi To: linux-pm@vger.kernel.org Cc: linux-bluetooth@vger.kernel.org, chromeos-bluetooth-upstreaming@chromium.org, rafael.j.wysocki@intel.com, swboyd@chromium.org, Abhishek Pandit-Subedi , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Len Brown , Greg Kroah-Hartman , Pavel Machek Subject: [PATCH 0/1] power: Emit change uevent when updating sysfs Date: Wed, 24 Jun 2020 14:06:15 -0700 Message-Id: <20200624210616.28477-1-abhishekpandit@chromium.org> X-Mailer: git-send-email 2.27.0.111.gc72c7da667-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi linux-pm, ChromeOS has a udev rule to chown the `power/wakeup` attribute so that the power manager can modify it during runtime. (https://source.chromium.org/chromiumos/chromiumos/codesearch/+/master:src/platform2/power_manager/udev/99-powerd-permissions.rules) In our automated tests, we found that the `power/wakeup` attributes weren't being chown-ed for some boards. On investigating, I found that when the drivers probe and call device_set_wakeup_capable, no uevent was being emitted for the newly added power/wakeup attribute. This was manifesting at boot on some boards (Marvell SDIO bluetooth and Broadcom Serial bluetooth drivers) or during usb disconnects during resume (Realtek btusb driver with reset resume quirk). It seems reasonable to me that changes to the attributes of a device should cause a changed uevent so I have added that here. Here's an example of the kernel events after toggling the authorized bit of /sys/bus/usb/devices/1-3/ $ echo 0 > /sys/bus/usb/devices/1-3/authorized KERNEL[27.357994] remove /devices/pci0000:00/0000:00:15.0/usb1/1-3/1-3:1.0/bluetooth/hci0/rfkill1 (rfkill) KERNEL[27.358049] remove /devices/pci0000:00/0000:00:15.0/usb1/1-3/1-3:1.0/bluetooth/hci0 (bluetooth) KERNEL[27.358458] remove /devices/pci0000:00/0000:00:15.0/usb1/1-3/1-3:1.0 (usb) KERNEL[27.358486] remove /devices/pci0000:00/0000:00:15.0/usb1/1-3/1-3:1.1 (usb) KERNEL[27.358529] change /devices/pci0000:00/0000:00:15.0/usb1/1-3 (usb) $ echo 1 > /sys/bus/usb/devices/1-3/authorized KERNEL[36.415749] change /devices/pci0000:00/0000:00:15.0/usb1/1-3 (usb) KERNEL[36.415798] add /devices/pci0000:00/0000:00:15.0/usb1/1-3/1-3:1.0 (usb) KERNEL[36.417414] add /devices/pci0000:00/0000:00:15.0/usb1/1-3/1-3:1.0/bluetooth/hci0 (bluetooth) KERNEL[36.417447] add /devices/pci0000:00/0000:00:15.0/usb1/1-3/1-3:1.0/bluetooth/hci0/rfkill2 (rfkill) KERNEL[36.417481] add /devices/pci0000:00/0000:00:15.0/usb1/1-3/1-3:1.1 (usb) Thanks Abhishek Abhishek Pandit-Subedi (1): power: Emit changed uevent on wakeup_sysfs_add/remove drivers/base/power/sysfs.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) -- 2.27.0.111.gc72c7da667-goog