From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2040C433E2 for ; Tue, 26 May 2020 15:28:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BDFFA20787 for ; Tue, 26 May 2020 15:28:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728799AbgEZP2r (ORCPT ); Tue, 26 May 2020 11:28:47 -0400 Received: from netrider.rowland.org ([192.131.102.5]:35995 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1728166AbgEZP2q (ORCPT ); Tue, 26 May 2020 11:28:46 -0400 Received: (qmail 7552 invoked by uid 1000); 26 May 2020 11:28:44 -0400 Date: Tue, 26 May 2020 11:28:44 -0400 From: Alan Stern To: "Rafael J. Wysocki" Cc: Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Greg Kroah-Hartman , Dan Carpenter , "Rafael J. Wysocki" , Len Brown , Kevin Hilman , Ulf Hansson , Pavel Machek , Johan Hovold , Alex Elder , Bjorn Helgaas , "James E.J. Bottomley" , "Martin K. Petersen" , Felipe Balbi , Julian Wiedmann , Karsten Graul , Ursula Braun , Jakub Kicinski , Bjorn Andersson , John Stultz , "David S. Miller" , greybus-dev@lists.linaro.org, netdev , ACPI Devel Maling List , Linux PCI , Linux PM , linux-s390@vger.kernel.org, "open list:TARGET SUBSYSTEM" , "open list:ULTRA-WIDEBAND \(UWB\) SUBSYSTEM:" Subject: Re: [PATCH 8/8] net/iucv: Use the new device_to_pm() helper to access struct dev_pm_ops Message-ID: <20200526152844.GA5809@rowland.harvard.edu> References: <20200525182608.1823735-1-kw@linux.com> <20200525182608.1823735-9-kw@linux.com> <20200526063521.GC2578492@kroah.com> <20200526150744.GC75990@rocinante> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, May 26, 2020 at 05:19:07PM +0200, Rafael J. Wysocki wrote: > On Tue, May 26, 2020 at 5:07 PM Krzysztof WilczyƄski wrote: > > > > Hello Greg, > > > > [...] > > > It's "interesting" how using your new helper doesn't actually make the > > > code smaller. Perhaps it isn't a good helper function? > > > > The idea for the helper was inspired by the comment Dan made to Bjorn > > about Bjorn's change, as per: > > > > https://lore.kernel.org/driverdev-devel/20191016135002.GA24678@kadam/ > > > > It looked like a good idea to try to reduce the following: > > > > dev->driver && dev->driver->pm && dev->driver->pm->prepare > > > > Into something more succinct. Albeit, given the feedback from yourself > > and Rafael, I gather that this helper is not really a good addition. > > IMO it could be used for reducing code duplication like you did in the > PCI code, but not necessarily in the other places where the code in > question is not exactly duplicated. The code could be a little more succinct, although it wouldn't fit every usage. For example, #define pm_do_callback(dev, method) \ (dev->driver && dev->driver->pm && dev->driver->pm->callback ? \ dev->driver->pm->callback(dev) : 0) Then the usage is something like: ret = pm_do_callback(dev, prepare); Would this be an overall improvement? Alan Stern