From: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
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 <abhishekpandit@chromium.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
linux-kernel@vger.kernel.org, Len Brown <len.brown@intel.com>,
Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v4 0/1] power: Emit change uevent when updating sysfs
Date: Tue, 7 Jul 2020 09:24:16 -0700 [thread overview]
Message-ID: <20200707162417.3514284-1-abhishekpandit@chromium.org> (raw)
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)
Series-version 4 update:
Tested again on device and verified it's working as expected:
KERNEL[52.678174] remove /devices/pci0000:00/0000:00:15.0/usb1/1-3/1-3:1.0/bluetooth/hci0/rfkill2 (rfkill)
KERNEL[52.678211] remove /devices/pci0000:00/0000:00:15.0/usb1/1-3/1-3:1.0/bluetooth/hci0 (bluetooth)
KERNEL[52.678251] remove /devices/pci0000:00/0000:00:15.0/usb1/1-3/1-3:1.0 (usb)
KERNEL[52.679721] remove /devices/pci0000:00/0000:00:15.0/usb1/1-3/1-3:1.1 (usb)
KERNEL[52.679772] change /devices/pci0000:00/0000:00:15.0/usb1/1-3 (usb)
KERNEL[56.022259] change /devices/pci0000:00/0000:00:15.0/usb1/1-3 (usb)
KERNEL[56.022306] add /devices/pci0000:00/0000:00:15.0/usb1/1-3/1-3:1.0 (usb)
KERNEL[56.022488] add /devices/pci0000:00/0000:00:15.0/usb1/1-3/1-3:1.0/bluetooth/hci0 (bluetooth)
KERNEL[56.022531] add /devices/pci0000:00/0000:00:15.0/usb1/1-3/1-3:1.0/bluetooth/hci0/rfkill3 (rfkill)
KERNEL[56.023392] add /devices/pci0000:00/0000:00:15.0/usb1/1-3/1-3:1.1 (usb)
Thanks
Abhishek
Changes in v4:
- Fix warning where returning from void and tested on device
Changes in v3:
- Simplified error handling
Changes in v2:
- Add newline at end of bt_dev_err
Abhishek Pandit-Subedi (1):
power: Emit changed uevent on wakeup_sysfs_add/remove
drivers/base/power/sysfs.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
--
2.27.0.212.ge8ba1cc988-goog
next reply other threads:[~2020-07-07 16:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-07 16:24 Abhishek Pandit-Subedi [this message]
2020-07-07 16:24 ` [PATCH v4 1/1] power: Emit changed uevent on wakeup_sysfs_add/remove Abhishek Pandit-Subedi
2020-07-07 16:26 ` Abhishek Pandit-Subedi
2020-07-07 16:28 ` Rafael J. Wysocki
2020-07-07 16:47 ` Abhishek Pandit-Subedi
2020-07-07 17:16 ` Rafael J. Wysocki
2020-07-07 17:18 ` Abhishek Pandit-Subedi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200707162417.3514284-1-abhishekpandit@chromium.org \
--to=abhishekpandit@chromium.org \
--cc=chromeos-bluetooth-upstreaming@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=len.brown@intel.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rafael.j.wysocki@intel.com \
--cc=rjw@rjwysocki.net \
--cc=swboyd@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.