Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp967925pxb; Fri, 22 Apr 2022 15:33:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwK8LeDk3zen68YohD768yQUnZRUMl1LRXBYgF6a7UdP+2YdQ04oZSp96q6KfxtXAJ9lM43 X-Received: by 2002:a05:6a00:2402:b0:4e1:3df2:5373 with SMTP id z2-20020a056a00240200b004e13df25373mr7209257pfh.40.1650666807570; Fri, 22 Apr 2022 15:33:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650666807; cv=none; d=google.com; s=arc-20160816; b=mZNQsJvlX4aMtoVOSbiC96fDCBpFX+NBlsVJ4eEHZVsAfjB95emisYWB/0EqtQHv17 UQvQeH1wHKTelaBmOtHZu4uDAxz8A+4BV1pkR7zhA8rpMH8tW8Y+CbXZTKkNadC+30Rc EhKR+FHeL1xMaPdXxegZMN8q3GvnBGxmcbac2ceN59v7zzsIwGcnL5hCX4Oy8ClPBcUW 8cBTYYU4pKqgQTQCzVkHvcIeIB6giYs/43HE7SolbkUWsqXhu7P54DqUAy5AGjLtenEx WiWMdqMCL3V5L8RHWedpqeGrBCJDsxPGkmVxJRADwuy1oqn8gIkwUwQH1q/AvLIZMMfV AI+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=mo2gwYWJ7v3j2YMx6bxMzq/oePOXwNlGXJmLNbBcYNw=; b=o3UIR2XLvnnEef5dsmITHE4axY4RZl4wqwO8Ps7G+xgp13vLS8Xk8CEk4unoBrpMI5 4zENYkcpRPsv3cLNYkDHplBTwAlbEsm4nyA2DR4kwj1lo0dG1IkI7AWOhyjmrl/sigic EsHDesVN12LdG0oBio3yOqb2fcX2pJuirxdK4z3UiZhj7kp0dvlocuVynOFa+TXcYixt xu92GZn8KUkJrricAJ8rnnFBPfvY/DXa8yxK+emGrAlnFXmnax+xSIfi8HAw/7GvrrXL 7URXUtqAnzpBzcXKFkjyuwjFeBckrl4MSNmUXMZ+TE8OsNMp4dY+baS+LefHg0eUJtiA b6Hg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b6-20020a056a000a8600b0050aaef181a2si9968690pfl.2.2022.04.22.15.33.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 15:33:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B76962DCF0F; Fri, 22 Apr 2022 13:47:24 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447246AbiDVMAW (ORCPT + 99 others); Fri, 22 Apr 2022 08:00:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447214AbiDVMAV (ORCPT ); Fri, 22 Apr 2022 08:00:21 -0400 Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBF7154FB5; Fri, 22 Apr 2022 04:57:28 -0700 (PDT) Received: by mail-yb1-f175.google.com with SMTP id x9so6947421ybe.11; Fri, 22 Apr 2022 04:57:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mo2gwYWJ7v3j2YMx6bxMzq/oePOXwNlGXJmLNbBcYNw=; b=SPO+V7r6R/A+hJFfGn+eHiAq018UQgd9LrDiLxOPcg7r75J3PkVoN1f6NZUmKgZ1/0 Z1hii1ChUnKDQ7ujmbWSmQWVauk7knxbX6SUeY+RxbeaX/c9I5RVEcLK1kJfnkoLvSJn Q9slWt+QAh1iV1aW0ZNXI5V9BWJJAL2W46bGoTDtCaIl+1MmubLIRhA/nRgtAVd1Yijy +uNy5sfZWzr7IlfCk6RiYBYI1vYr8hAD5RFTmyCeaWBzSVkGvfIm8WInc3Q4ypnxXReP F/Lvi+n3j1yx6FOOUERBYriB7ESSH8Vm3OFYL1y+8x478q6j7tNIMoHWLnqDuYt6nFzx XubA== X-Gm-Message-State: AOAM533FUBZvtTuNUYD6tSb/zdMTNp4l/IXzWITVzcCG6zpuZZnE0YuU 0AV/bkHjGT0BuYdg4lW76IKAfG/nlUmMSQ6KyLE= X-Received: by 2002:a25:3cc3:0:b0:63e:6ee9:4840 with SMTP id j186-20020a253cc3000000b0063e6ee94840mr4222715yba.153.1650628648089; Fri, 22 Apr 2022 04:57:28 -0700 (PDT) MIME-Version: 1.0 References: <1650395470-31333-1-git-send-email-quic_c_sanm@quicinc.com> <1650395470-31333-3-git-send-email-quic_c_sanm@quicinc.com> In-Reply-To: <1650395470-31333-3-git-send-email-quic_c_sanm@quicinc.com> From: "Rafael J. Wysocki" Date: Fri, 22 Apr 2022 13:57:17 +0200 Message-ID: Subject: Re: [PATCH v14 2/7] PM / wakeup: Add device_children_wakeup_capable() To: Sandeep Maheswaram Cc: Rob Herring , Andy Gross , Bjorn Andersson , Greg Kroah-Hartman , Felipe Balbi , Stephen Boyd , Doug Anderson , Matthias Kaehlcke , Mathias Nyman , Krzysztof Kozlowski , "Rafael J . Wysocki" , Len Brown , Pavel Machek , Linux PM , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , linux-arm-msm , "open list:ULTRA-WIDEBAND (UWB) SUBSYSTEM:" , Linux Kernel Mailing List , quic_pkondeti@quicinc.com, quic_ppratap@quicinc.com, quic_kriskura@quicinc.com, quic_vpulyala@quicinc.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 19, 2022 at 9:11 PM Sandeep Maheswaram wrote: > > From: Matthias Kaehlcke > > Add device_children_wakeup_capable() which checks whether the device itself > or one if its descendants is wakeup capable. device_wakeup_path() exists for a very similar purpose. Is it not usable for whatever you need the new function introduced here? > Suggested-by: Felipe Balbi > Signed-off-by: Sandeep Maheswaram > Signed-off-by: Matthias Kaehlcke > --- > drivers/base/power/wakeup.c | 18 ++++++++++++++++++ > include/linux/pm_wakeup.h | 7 +++++++ > 2 files changed, 25 insertions(+) > > diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c > index a57d469..1900637 100644 > --- a/drivers/base/power/wakeup.c > +++ b/drivers/base/power/wakeup.c > @@ -541,6 +541,24 @@ int device_set_wakeup_enable(struct device *dev, bool enable) > } > EXPORT_SYMBOL_GPL(device_set_wakeup_enable); > > +static int __device_children_wakeup_capable(struct device *dev, void *dummy) > +{ > + return device_may_wakeup(dev) || > + device_for_each_child(dev, NULL, __device_children_wakeup_capable); > +} > + > +/** > + * device_children_wakeup_capable - Check whether a device or one of its descendants is > + * wakeup capable. > + * @dev: Device to handle. > + */ > +bool device_children_wakeup_capable(struct device *dev) > +{ > + return __device_children_wakeup_capable(dev, NULL); > +} > +EXPORT_SYMBOL_GPL(device_children_wakeup_capable); > + > + > /** > * wakeup_source_not_registered - validate the given wakeup source. > * @ws: Wakeup source to be validated. > diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h > index 196a157..9a3005b 100644 > --- a/include/linux/pm_wakeup.h > +++ b/include/linux/pm_wakeup.h > @@ -109,6 +109,7 @@ extern struct wakeup_source *wakeup_sources_walk_next(struct wakeup_source *ws); > extern int device_wakeup_enable(struct device *dev); > extern int device_wakeup_disable(struct device *dev); > extern void device_set_wakeup_capable(struct device *dev, bool capable); > +extern bool device_children_wakeup_capable(struct device *dev); > extern int device_init_wakeup(struct device *dev, bool val); > extern int device_set_wakeup_enable(struct device *dev, bool enable); > extern void __pm_stay_awake(struct wakeup_source *ws); > @@ -186,6 +187,12 @@ static inline bool device_wakeup_path(struct device *dev) > > static inline void device_set_wakeup_path(struct device *dev) {} > > +static inline bool device_children_wakeup_capable(struct device *dev) > +{ > + return false; > +} > + > + > static inline void __pm_stay_awake(struct wakeup_source *ws) {} > > static inline void pm_stay_awake(struct device *dev) {} > -- > 2.7.4 >