Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp730805lqb; Fri, 15 Mar 2024 05:11:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUU0dZ6hacJLpz4iPBpCC7/q8MRVh1spaf390PhgsHVCYkSn41bpbIfwd2ZjN9m6GaGpXM5UPOY2RkQ5bK2XdqV1H+hILrs7+VMlcruxg== X-Google-Smtp-Source: AGHT+IFNjRL7fONVoKi38f9ELJe7Zq5LFupTtZlkOAWKFGSBEAcLreFoj5DkVqOl4XObsBs1L0BV X-Received: by 2002:a05:6359:4c23:b0:176:40d5:2bd5 with SMTP id kj35-20020a0563594c2300b0017640d52bd5mr5798095rwc.6.1710504693631; Fri, 15 Mar 2024 05:11:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710504693; cv=pass; d=google.com; s=arc-20160816; b=srs7U/dj42LNowJcHtQFwVoFXQR0lZKN8oYEDUTD63/LKrVRA1lwDiQz7I+Scs+e0J 6uqvSnbjNFVyTzeW6RqqsHcW56sVJ7v42ec69C3ovX7uGkyxwmG3CmmYS+vt5tbVLyou TQ4uZiY1tPg0ZRcsUkQZE16Vi4tp9wPTouRDW9ID+y5nsMyxXxPDfVdjkXZVTMdLrZbI suYDMN544JHQTGUunfnT/63XF1vCrC+ak250sF1UqXFIU8lUdjGauLpaYoGE+Uc2IGkf izH2OEZaNq+TOYX0uzW3uHUkivz/upX0EMyoBees6ctkAnvCpOFJli/BwYKJMZ2zwPWN 6FYg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=Wfc9oP0R64W5zCTmqNzrzXKvNhkgw76Rey6GJ7FbITw=; fh=K/nMoYTmcEkLGjcDY+godIuHvJ0zPwH0rrMELLLPCFg=; b=p4ZmJbhKkA5WzI8laCPSrz1qpr1YFBU2rWy43n4W+0lXTTiqKwTqq7xzc361LzIcBX e8Jct0TXPo3Q1BdNNeUNQpNI2XzAYN+DTb0OC45/PIHOzEJxJgY+t3+oo+jx8euti+2O jbJ/ImhMO416kkBQHx3Q3DDzXjtq4lEMiBCsKSfTp8GssVGC3HabZ4w1/ZKfFqY2IF0T ffRULtvrZbTfWqO9zDYe85MLK+/cRGJpZAq6g23tBmwBwquNNMKmJmr1ne9eZ+k+mGcw DGOHqYG8mw0kZ/QSS72AqQY5TgXE/EVuNaWffoin0pkDkH7GhTNtBPCSglHyUJim28bm OgDg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-104381-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104381-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 145-20020a630097000000b005dc8719cdfasi2527166pga.298.2024.03.15.05.11.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 05:11:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-104381-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-104381-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104381-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3288928398B for ; Fri, 15 Mar 2024 12:11:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 119831C2A0; Fri, 15 Mar 2024 12:11:27 +0000 (UTC) Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B3F11AAD0; Fri, 15 Mar 2024 12:11:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710504686; cv=none; b=kKWu0YNQ05XDGvRXFMg658h8ozR9nm0n9Kh3G5uo0cU+nEN07/vCi12kP9fStgTsZ+2Prh6OH38B7Fd0XSqlgEODjrRMhQsy+7odN/ZVSQ5ABONXf1SAZqZ64s8Q+nHyHuiSDBhusKbotrbMZgE6K1s5bTzwrWxKU+qCeOxpgCI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710504686; c=relaxed/simple; bh=Wfc9oP0R64W5zCTmqNzrzXKvNhkgw76Rey6GJ7FbITw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Z+A/sMp41eRdl8utARqahH2opp0TA6vkcmYEQpltyQ2ND5J83d5LKqoaO4/STJlPdq9sYuBIwb7Q5Y+/DX4jtTuR4IzndlUHkJLCHLf3+VJkX+je96UNAgRnYwalzjajlPnTgjwx6BddenQ0/39k8bgszUZIUB9ITgm4V0sPdGE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-6e677ec9508so105979a34.1; Fri, 15 Mar 2024 05:11:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710504684; x=1711109484; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Wfc9oP0R64W5zCTmqNzrzXKvNhkgw76Rey6GJ7FbITw=; b=Ro/K4vJNUP9A9LcaioIl9wSHgdwSHq9Ma9vrLza1vQc1JDr4TLEa5IPdohwaQRYjCO 5ATqpu1tLXdMgLzbxIE8fLtmDEI4ZGLKG3stcDzQ8Ns9hmnggEMNW0Ksvzv+p8SnBrQu SK0+Zg5LV8YWCUfEllWa4EYqw9iEBd2tz/RQcJPMPmzry7Iws7yFpJ31I3ohUPGvfmhs l7IdIYvC2kRQTJXFjy10HCM9+rRN2sZcCL0kaFN/IzfY7WmdaZo7aW/6wGfkoT2IUvlR e9zhUkFy2sHmSgHeB+giF2ZL4x3Hs0+/85BU+ROw+F06UvgejLbrzFPdhUWHeK8h0OSj PgwQ== X-Forwarded-Encrypted: i=1; AJvYcCWSHWTY8CbTEFyHqvu/KAAAOLewiNrXlfGtibOoeTkpXzex2PMq01/zWxbEHclTOyyjd+kp+5IUaGKy03K6mjr0ydQKtDkkvxOp3YHBQw5UazY5G9kkJi58ktoVHODdq931P6rzisE= X-Gm-Message-State: AOJu0Yxyl5rR9AkYZd+u+BP3HamnPEdYDL6PqA9CQ74sHMUAZr0JZ76s VyV9sth+yP2n2r6r1ThhOweHoVCCvg3n7pZGPD2mmkOWz7AiwaOyjbnu7lWGef6/MNh/LReho+s xG/ccQtRkzkOfvufOqWRDvd1P/9c= X-Received: by 2002:a05:6871:b28:b0:222:8a9d:d935 with SMTP id fq40-20020a0568710b2800b002228a9dd935mr1213647oab.3.1710504683918; Fri, 15 Mar 2024 05:11:23 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240314075429.1164810-1-d-gole@ti.com> <20240314151846.u3r3eaklrl3hf7pi@dhruva> <20240315051828.su2qx57ecyhv3up3@dhruva> In-Reply-To: <20240315051828.su2qx57ecyhv3up3@dhruva> From: "Rafael J. Wysocki" Date: Fri, 15 Mar 2024 13:11:11 +0100 Message-ID: Subject: Re: [PATCH] PM: wakeup: Add a missing return case in init_wakeup To: Dhruva Gole Cc: "Rafael J. Wysocki" , Tony Lindgren , theo.lebrun@bootlin.com, Sibi Sankar , Viresh Kumar , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Ulf Hansson Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Mar 15, 2024 at 6:18=E2=80=AFAM Dhruva Gole wrote: > > On Mar 14, 2024 at 16:29:36 +0100, Rafael J. Wysocki wrote: > > On Thu, Mar 14, 2024 at 4:18=E2=80=AFPM Dhruva Gole wro= te: > > > > > > Hi, > > > > > > On Mar 14, 2024 at 15:01:36 +0100, Rafael J. Wysocki wrote: > > > > On Thu, Mar 14, 2024 at 8:55=E2=80=AFAM Dhruva Gole = wrote: > > > > > > > > > > The device_wakeup_disable call can return an error if no dev exis= ts > > > > > however this was being ignored. Catch this return value and propa= gate it > > > > > onward in device_init_wakeup. > > > > > > > > Why does this matter to the callers of device_init_wakeup()? > > > > > > If atall !dev->power.can_wakeup then the caller should know something= is > > > funny right? > > > > What would the caller do with this information? > > > > They attempted to disable wakeup on a device that doesn't exist or is > > not wake-capable, and so what? > > Using drivers/char/hw_random/xgene-rng.c as an example, we can atleast > print a warning or something to make the user aware of an unclean state. > > Is the argument here that if the caller can't do anything meaningful > then what's the point of returning any error? > > If so, then my preference would be just to propagate as much information > upward from the stack whether the caller can make use of that error and > in what way is upto the caller, if nothing else then even a warn or > error print is still useful piece of information. I'm not making a general argument, just talking about this particular case. The only error code returned by device_wakeup_disable() is -EINVAL and it is returned when nothing had to be done because it was not applicable to the argument passed by the caller. Quite frankly, I don't see why any caller of device_init_wakeup() passing false as its second argument would be interested in handling that error. > However if it's useless to return anything from device_wakeup_disable > then we might as well make that function a void or something and avoid > any confusion as to if there's any point in returning error at that > point. That would work for me.