Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1167117ybt; Tue, 7 Jul 2020 09:12:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVw2qhpL/WcZhB+gWQsbDI5sn3W/SZUcTfthwnLielv1+TuBg4hWfjFFAO1wAed6izJWcr X-Received: by 2002:a17:906:1747:: with SMTP id d7mr40039799eje.39.1594138321686; Tue, 07 Jul 2020 09:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594138321; cv=none; d=google.com; s=arc-20160816; b=iRd9Cd/BlH9upz6IeQZ2K/X/A756TY4BIXaLOPW8w7sVQYSbPDAbRkuD6v1ufN4R+T scXHPKpPDq3J96vv+zzCvQsVjloFK3Jcp7jqxSn2QzIvq/Ef/ryLWeNBCDlbahDBdxI6 hn0CfUWMCnbMU7tdng9ja32lkSyxcudxU+fpm3bb1tthvi2UGRTosaLGk7DfX+kmsX2D WvF4y5JcnXEvrzYJdyPNyJny1tCGzo0tcq2ARm1y+nF9cYT3O4nM2sD//KjKS09ySVGl DMM2xd5nO6dGNX+Ac5ArFtd/8yNs7x3sqylc2kq42BYoPQZzhdJ3fwxaUHyxdYUt+UUN 3WUA== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=PdkRv62nUyer3utyHGyA4zyawQ7UJwHUu+IzIsdxXbk=; b=gbxxh6Kzx+RffI/hYOY9NiBcDmV19R5HwplgUjgo8QO5HN7VhIodzZ6ea6uuXFrkFe nuKIVs9L1UTAUppPbvSTYzokIYkN/nSo3x82nxezCd5NrGSfmNfpcheQVXfqoGndvrdi pbZ8WLEKMeH61rbUBtJHW7sKyZPcxz/UOQjnWT40J6oB9Fc/gZiXfHsHfqzWZl6upv1P HchZ4VbYWbg31oMqYbFueTK7aYuPPC6/J2MqkRZU3WGvnsHJ+Sk/cUlx5npMaIiI8rzy oZJZtKFTlOx5U1hGRI8gU3snaaEjNorRjtKi8TaoYepfXHsNzSXVqLv+VkFc4SruEjLO qtZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZIRm1sCw; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-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 l2si15223866ejd.191.2020.07.07.09.11.37; Tue, 07 Jul 2020 09:12:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-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=ZIRm1sCw; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-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 S1728487AbgGGQLS (ORCPT + 99 others); Tue, 7 Jul 2020 12:11:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727079AbgGGQLS (ORCPT ); Tue, 7 Jul 2020 12:11:18 -0400 Received: from mail-vs1-xe44.google.com (mail-vs1-xe44.google.com [IPv6:2607:f8b0:4864:20::e44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1174DC061755 for ; Tue, 7 Jul 2020 09:11:18 -0700 (PDT) Received: by mail-vs1-xe44.google.com with SMTP id 64so16578628vsl.3 for ; Tue, 07 Jul 2020 09:11:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=PdkRv62nUyer3utyHGyA4zyawQ7UJwHUu+IzIsdxXbk=; b=ZIRm1sCwWG3uRuWaf7gqVsqLFlt4i5nQz7D3SKhQhXqifxYIfsrwV7RYthE1frvidf BirGcXuaaJKJ4hYD7MHm32VHftEpvf0G5tFcM7LQkFDNl8cT0WJ0NQdDwx10Ci9aIObS OCMwze0DIhf2sgT7WI1QToBUwX4SISOB1G0+M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=PdkRv62nUyer3utyHGyA4zyawQ7UJwHUu+IzIsdxXbk=; b=Xm0aK3GRpu2wqtcfcvsWBzK0Z+/3FJI9+Nz4LCZtROMTBwZY/+EbF4MYU+QLb76ITX a68+BvPK8DjJ3h69TgPf12aVjaVbe7vazqGK7O64PM9/e1XD2sGyazr/kW8NLJXMny1D hqwp8EK3oXomtFsc+sPBzXkOUQJEApL9gXwFJ/Fr/WKpOEhHAoAbOgwz3GUWW7IxWYoq uHdFijuibkotlEnw9ujnTth1QTIDJQPGM3jS2ZDO5D/bybvmaaHjRlORDQ8CO0LPwcI/ T2gx0kbClRxzCb7l2zxZJ7RBzeLuIZhP7H8KQBzwwKvwNI5gbbYXh8PpTQjG6mwXqqJi hh2g== X-Gm-Message-State: AOAM5312CkE4KK2T5VpBLyTupjpDdTP6Ed9xMP/Z1mZXxVLmFk3kcO3j KgwjVP/UHOpc2L7+2dnsbQfvLkn8/qtnjgq/nD/2xw== X-Received: by 2002:a67:6e05:: with SMTP id j5mr32157567vsc.196.1594138277134; Tue, 07 Jul 2020 09:11:17 -0700 (PDT) MIME-Version: 1.0 References: <20200707154905.2763616-1-abhishekpandit@chromium.org> <20200707084857.v3.1.I51f5a0be89595b73c4dc17e6cf4cc6f26dc7f2fc@changeid> <20200707160045.GA118278@kroah.com> In-Reply-To: <20200707160045.GA118278@kroah.com> From: Abhishek Pandit-Subedi Date: Tue, 7 Jul 2020 09:11:06 -0700 Message-ID: Subject: Re: [PATCH v3 1/1] power: Emit changed uevent on wakeup_sysfs_add/remove To: Greg Kroah-Hartman Cc: Linux PM , Bluez mailing list , ChromeOS Bluetooth Upstreaming , rafael.j.wysocki@intel.com, Stephen Boyd , "Rafael J. Wysocki" , LKML , Len Brown , Pavel Machek Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org I admit I didn't test this but I built it with allmodconfig. Sadly, this only raised a warning instead of an error so I didn't go look through the build logs (ignore the 5.4, the remote here is the linux-pm git repo): /usr/local/google/home/abhishekpandit/chromiumos/src/third_party/kernel/v5.= 4/drivers/base/power/sysfs.c: In function =E2=80=98wakeup_sysfs_remove=E2=80=99: /usr/local/google/home/abhishekpandit/chromiumos/src/third_party/kernel/v5.= 4/drivers/base/power/sysfs.c:754:9: warning: =E2=80=98return=E2=80=99 with a value, in function returning void [-Wreturn-type] 754 | return kobject_uevent(&dev->kobj, KOBJ_CHANGE); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/google/home/abhishekpandit/chromiumos/src/third_party/kernel/v5.= 4/drivers/base/power/sysfs.c:751:6: note: declared here 751 | void wakeup_sysfs_remove(struct device *dev) Will send up another fix. Thanks Abhishek On Tue, Jul 7, 2020 at 9:00 AM Greg Kroah-Hartman wrote: > > On Tue, Jul 07, 2020 at 08:49:05AM -0700, Abhishek Pandit-Subedi wrote: > > Udev rules that depend on the power/wakeup attribute don't get triggere= d > > correctly if device_set_wakeup_capable is called after the device is > > created. This can happen for several reasons (driver sets wakeup after > > device is created, wakeup is changed on parent device, etc) and it seem= s > > reasonable to emit a changed event when adding or removing attributes o= n > > the device. > > > > Signed-off-by: Abhishek Pandit-Subedi > > --- > > > > Changes in v3: > > - Simplified error handling > > > > Changes in v2: > > - Add newline at end of bt_dev_err > > > > drivers/base/power/sysfs.c | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c > > index 24d25cf8ab1487..04c82373c8f240 100644 > > --- a/drivers/base/power/sysfs.c > > +++ b/drivers/base/power/sysfs.c > > @@ -1,6 +1,7 @@ > > // SPDX-License-Identifier: GPL-2.0 > > /* sysfs entries for device PM */ > > #include > > +#include > > #include > > #include > > #include > > @@ -739,12 +740,18 @@ int dpm_sysfs_change_owner(struct device *dev, ku= id_t kuid, kgid_t kgid) > > > > int wakeup_sysfs_add(struct device *dev) > > { > > - return sysfs_merge_group(&dev->kobj, &pm_wakeup_attr_group); > > + int ret =3D sysfs_merge_group(&dev->kobj, &pm_wakeup_attr_group); > > + > > + if (ret) > > + return ret; > > + > > + return kobject_uevent(&dev->kobj, KOBJ_CHANGE); > > } > > > > void wakeup_sysfs_remove(struct device *dev) > > { > > sysfs_unmerge_group(&dev->kobj, &pm_wakeup_attr_group); > > + return kobject_uevent(&dev->kobj, KOBJ_CHANGE); > > Always test build and hopefully actually test, your patches before > sending them out :( >