Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp992878ybt; Sun, 14 Jun 2020 06:52:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3JwmweJIE7sdmEaQTjuJwd3WThv0TYwYDq52jdT7BNzTKXoOH+DDb5fU2OOCOhefvu1bT X-Received: by 2002:a17:906:f53:: with SMTP id h19mr7026328ejj.491.1592142752793; Sun, 14 Jun 2020 06:52:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592142752; cv=none; d=google.com; s=arc-20160816; b=CFrpUDe60JAf1Zzuprk1WWqqUcWMJGs6N5EDLDC4xs7dprOthOZ7CRa4uP+yTSZTTT IiXZNELlXP0XwswMahuaqU0co5z7Vq2oWJG03wZgojM6CEhjoLLcihrSUQR3BpQhxV3G mao3PzWrvN2O8pi2uLidwrf726ep8xI+LEkSKt1KWF3+OGC39FzS4YLXBi+UaO1s2EKl uuX1XOCj5tcdwii1QmU9QpiS16lhQUlyd6ERv3kuWCO6Y3SONyMXxd6ZtegOc4Mf0R+4 NB+hB/FF1vkC+uzIiCyxb2hhDxJV782Cb1I1/ZQbe0a8ABgtjSzfS5S3vzNZodszWH/G egaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=RuiMPD/925GRUxPIwh/HAFgyStseOa7F2neLPlWYn2M=; b=m60lKN3xjy3LHLZXB+7dVkewlNy7KiHOnEf620GcYSZQL/gIC0RZdBad9ZHD58DOf6 eqRlKcrh5smXvuCBa8MYc4Int7q/TeuVKYvBY8Q04OklMjOBSo756PlNqWsiM1RZg3km LbJaERwKv1DWFl2tBKWZEWnukzD9wJuTtL8msQ9xkHl+YkBsjtowFa/KtFOzwmYBwlXq f839ejtV8ImIgfz+HVJJZbzUzI3UkCmloaaDewYMSUOPhmsJjOJc3GqzE+e/i/tqdYoD Rjg2Aihs5HBFClD6Tnm9FCIFtMXEfw66BEef2MxJOL0hxOfA8F72HNDI/FS90AfPU+Rq LooA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fi8si7153166ejb.641.2020.06.14.06.52.10; Sun, 14 Jun 2020 06:52:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727822AbgFNNuY (ORCPT + 99 others); Sun, 14 Jun 2020 09:50:24 -0400 Received: from mail-oo1-f53.google.com ([209.85.161.53]:43150 "EHLO mail-oo1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727044AbgFNNuY (ORCPT ); Sun, 14 Jun 2020 09:50:24 -0400 Received: by mail-oo1-f53.google.com with SMTP id i4so113298ooj.10; Sun, 14 Jun 2020 06:50:23 -0700 (PDT) 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; bh=RuiMPD/925GRUxPIwh/HAFgyStseOa7F2neLPlWYn2M=; b=XhMDUcz/HYfUzDKB2ncaGtD6418+PLhlwYfgSS7RBe/u2hOS/f5H/GDY24me0JE6a3 Ai2tTl6aq4OCs54d0bTiVVM6qof/DzlunQrp4pZUF9ykRKBNiddZ6xhtzlg1uZQ0NEJl yuTQ+qHO0t9XPSPiCxmUBCgbkk3w2vC/YOx5nIKmMXiSK29Iv7PG/9DAPixbkzFs64L6 9ey+iIqCoQL7uwkdOOgHOEE2yrHsJDn99CdO7isPj8UW82gIy4CD0rTg0pe9KG9vs18C CFwzPoIzw5S10qUcMpQmiY/4R2O7FQ7/dPe/lhIkHF8ocuFNXaPIzrLjXPsUzXK0OeGy hD1Q== X-Gm-Message-State: AOAM5323FMl+VDkO5AE1YGMGOpnLa9bdynFGbwxSRCDry+ni9R/p6FXI 92XqBOl7xbe4ym7/L22Ypn2tLbHm7yw5xvGs8XVMZdy1 X-Received: by 2002:a4a:5744:: with SMTP id u65mr17737133ooa.1.1592142623019; Sun, 14 Jun 2020 06:50:23 -0700 (PDT) MIME-Version: 1.0 References: <20200614090751.GA2878@kunai> In-Reply-To: <20200614090751.GA2878@kunai> From: "Rafael J. Wysocki" Date: Sun, 14 Jun 2020 15:50:11 +0200 Message-ID: Subject: Re: RFC: a failing pm_runtime_get increases the refcnt? To: Wolfram Sang Cc: Linux PM , "Rafael J. Wysocki" , Linux-Renesas , Linux Kernel Mailing List , linux-i2c Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 14, 2020 at 11:08 AM Wolfram Sang wrote: > > Hi Linux-PM, > > both in the I2C subsystem and also for Renesas drivers I maintain, I am > starting to get boilerplate patches doing some pm_runtime_put_* variant > because a failing pm_runtime_get is supposed to increase the ref > counters? Really? Yes. Really. pm_runtime_get*() have been doing this forever, because the majority of their users do something like pm_runtime_get*() ... pm_runtime_put*() without checking the return values and they don't need to worry about the refcounts, which wouldn't be possible otherwise. > This feels wrong and unintuitive to me. I expect there > has been a discussion around it but I couldn't find it. I wonder why we > don't fix the code where the incremented refcount is expected for some > reason. > > Can I have some pointers please? The behavior is actually documented in Documentation/power/runtime_pm.rst and I'm working on kerneldoc comments for runtime PM functions in general to make it a bit more clear. Cheers!