From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (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 386C53191DC for ; Thu, 25 Sep 2025 18:36:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758825379; cv=none; b=Jp1KPJLiVFT7dvvNEXXYMOfUUXgaNCvljDgXi9JzvOaIC25TPLnUr3j2E9WyafsAWeQR3w/8qA/u2df0NU7+6rcvMULw+9EpHmWYyqfcPypcSQjgf1dIZbgDJVe6HEFu6+vos2uMQqv9QE1CQom4U0JtlddFCGd53NB5+P/UsgI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758825379; c=relaxed/simple; bh=yTNcLmgvEDy9EISXeXBi6gHdiwI9LV3MmdEt8b5e8bU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=adJgauskNvY7FdCdedEPeM26yrsh2xAyihHgfmdKbCQkLmlnXP2keZnW4cN5IL7kAhB2yORjV70sC6hjUUHp0sWhOO5eeBn5oF8NxPoOcl5GywT5b4D0umH8d+gnKrzjWrxkIn/3GzKo+qIUBHpMzX165ysmy/IOP0m/Gm/Cq/k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=SWw4JtDb; arc=none smtp.client-ip=209.85.216.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="SWw4JtDb" Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-33226dc4fc9so1553721a91.1 for ; Thu, 25 Sep 2025 11:36:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1758825377; x=1759430177; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=bv1I4Ic9wC08aXBbFZJljZdZZSbHg/OBO6m8rXTaTQA=; b=SWw4JtDbnI5I5wPq+33qixxb/11l6orQ0QZL5Sp5ZzVpec00eZJtfXey5rHg7D8fxI wI5TPYyWlO9L0BRvmSh8QDDi7hbC0sLvdHBXkeouPjDKiq/yemCq7m+mHl3d02ei20z8 AgtMaWkOpXWvW0nD9NkSNwscGHy2JUaWz6FWY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758825377; x=1759430177; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bv1I4Ic9wC08aXBbFZJljZdZZSbHg/OBO6m8rXTaTQA=; b=hW55jmbswSUaDdOpCAm38vAt9HaytNzkBeW+sc/5QpD4M+dBuE3eOFSXTRZpA5xjFq 12SOthDqZytSmnak41ziMfaT3wqkgvaBlGoZsYiZl+Uw7B9Jmz1FzivZw5fMVIdhL/ZQ G59lfb8bnKSvw7VFxWc3d37BC7hZOtYRcZ3DO+3rx6ogmSBGk3xE3a5Vf8n9DcX22PdM gbcXw2msGx83vEwUJ/Y8DgHJND5JJMiFp5qF+p5EwC2jkhqscaCegiPRZdQUV11rznG0 4JsmdX4fSMzRqcpn9aC6SkSsJj3fG2/eP8OYvOP/sA0h5Gb3QDZQ0f6w8CIdKFbf/km1 Gx/g== X-Forwarded-Encrypted: i=1; AJvYcCUh+7WFTwUpohl9bIhJdh/7sAZCV31KpQ0JN51+UWNrx2S9ub1qCydNQyAboKdLH2GCo03punbyYTu+4gA=@vger.kernel.org X-Gm-Message-State: AOJu0YyOxvKU2TkyI+RJfWgUqCd1bXoX76F0Bmj6hsVBDovaEskBKDeg lWzWix/g0WXTxkY6qQn1Bw0SGZz1PSUWTijxWM5oldaxgFQ7tUsI+Zx2DF6l3I/aag== X-Gm-Gg: ASbGnctQV1tusVs3zNUoL9SQE/QnBxToZNRJ6uqFrSaRsH+tgJPUgVI1LTvtdQliYbi wbUaA5/SHUIK+RiTEp5M8eEH2AtrEjGMS4eLpYF4lujMGgPA9rHsAWEH8kMZcCgM5sG03O6Rz9c eskFc2cz/fuWdkVbyFeP2jkUWdOqCIISIhx9ONJml0PLKSMFzNm+lr3SFf2rAAWoP8cMV3p/D0C h+ZANcGtbJH4IaX0LF0vcai1U1FssDS+5W6qIOHrE7sCjAQNxPUC/UMBTKS1zREmP6FoS+4uXsM xd6h7DlP4oKgObpD/F35CRV+Vnxac5TPO5cjCqDpRcL4lothIOMDTYrAm+cOWQLkdbtJ8dIz5Kg 2ST1PTZkuTUF2Apee0Nh1DFcS4D6sXPAWEC2KcgyARct2jdrH0m7aiITiNh1O X-Google-Smtp-Source: AGHT+IF4Y09r+bkOF6lRkbwV+GQ7Ev0ePJgiaG1Uy2xMtT1jRRDOL9DCdlnx7ksb5G87YR8/J7GrzQ== X-Received: by 2002:a17:90b:3884:b0:32e:9a24:2dd4 with SMTP id 98e67ed59e1d1-3342a257202mr4886405a91.14.1758825377384; Thu, 25 Sep 2025 11:36:17 -0700 (PDT) Received: from localhost ([2a00:79e0:2e7c:8:ef44:9df6:231a:cd29]) by smtp.gmail.com with UTF8SMTPSA id 41be03b00d2f7-b57c55a0ef3sm2756772a12.37.2025.09.25.11.36.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Sep 2025 11:36:16 -0700 (PDT) Date: Thu, 25 Sep 2025 11:36:15 -0700 From: Brian Norris To: "Rafael J. Wysocki" Cc: Pavel Machek , "Rafael J . Wysocki" , kunit-dev@googlegroups.com, Len Brown , Sakari Ailus , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] PM: runtime: Add basic kunit tests for API contracts Message-ID: References: <20250829003319.2785282-1-briannorris@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Sep 24, 2025 at 07:34:31PM +0200, Rafael J. Wysocki wrote: > On Wed, Sep 24, 2025 at 7:32 PM Rafael J. Wysocki wrote: > > On Tue, Sep 23, 2025 at 11:51 PM Brian Norris wrote: > > > On Fri, Sep 19, 2025 at 06:58:50PM +0200, Rafael J. Wysocki wrote: > > > > Yeah, so I'd prefer to change this particular thing entirely, > > > > especially in the face of > > > > > > > > https://lore.kernel.org/linux-pm/5049058.31r3eYUQgx@rafael.j.wysocki/ > > > > > > > > which quite obviously doesn't take the return value of > > > > pm_runtime_put() and pm_runtime_put_sutosuspend() into account. > > > > > > > > I would like these two functions to be void. > > > > > > Sure, I think inspecting put() return codes is generally a bad idea. > > > 'void' would be cool with me, although maybe a bit impractical now, > > > considering how many users look at the current return code. > > > > For pm_runtime_put() it's not that bad. I have ~20 patches changing > > all of the code looking at its return value to stop doing that. > > > > Interestingly enough, there's only one piece of that code (USB core) > > doing anything remotely useful with that return value. Everything > > else is just garbage IMV. > > > > > So at a minimum, I'd separate "make 'em void" from my "document and test the > > > API" work. > > > > But you can just skip them. > > > > > Really, I'm mostly looking at this area because I have to support driver > > > developers trying to learn how to use the runtime PM API, and they > > > wonder about the return codes. So if they exist, I'd at least like them > > > to make sense. > > > > Sure. > > > > That said, as far as pm_runtime_put() and pm_runtime_put_autosuspend() > > are concerned, you may as well just say "discard their return values, > > you don't want to have to deal with them, and never ever pass them > > verbatim to the callers of your code". Sounds reasonable. I'll drop any unit test expectations for pm_runtime_put() and pm_runtime_put_autosuspend() return codes. But I'll leave pm_runtime_put_sync(). > > > Anyway, for the particulars of this test: I can try to adapt the comment > > > language a bit. But are you suggesting I shouldn't even try patch 2, > > > which fixes the pm_runtime_put() return codes? > > > > Not really. > > > > > > Of course, there are existing users that check their return values, > > > > but I'm not sure how much of a real advantage from doing that is. > > > > Well, see above. :-) > > > > > At least some of those users appear to not exactly know what they are > > > doing. > > > > Almost none of them do nonsense. > > s/none/all/ (sorry) Ha, thanks for the clarification :) Brian