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=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 C9123C433DF for ; Tue, 26 May 2020 08:37:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9FCBE20787 for ; Tue, 26 May 2020 08:37:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590482270; bh=OS4Gv5g4JBD1F6N+LFPnSXYNGjnWhSL9y/zGwBzvIhY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=riHZaGn+D8pYCMvN3T2nGO60DXds3vVzim2N5XUhdFwoCdOWlA7jemqLmMt5TP1Dy Qz4BQi1HpMkrmfv8lsd4DicDvyOnrHV4gBj4Q+cR2f2WTredX6VMEhN8Sb3RdkY3ye ru9qol0L4+I55s0VqUqDhVrPOCzn9lmch4RKoFlk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731443AbgEZIhu convert rfc822-to-8bit (ORCPT ); Tue, 26 May 2020 04:37:50 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:40832 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726926AbgEZIhu (ORCPT ); Tue, 26 May 2020 04:37:50 -0400 Received: by mail-ot1-f66.google.com with SMTP id d26so15621702otc.7; Tue, 26 May 2020 01:37:49 -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:content-transfer-encoding; bh=RHXgtuB1SAqLX2SMugvAUZcluD7absnJHKc68BKyHlE=; b=grQNmI1zEy6kOUUZz44tbb6NYebIAISHtLfet0b4vGMCVvnMvTbW5e77TrO7nj4fLT GogvpCZGKgeLJ6nysmy+WSAb8Zrs3FyDhoRMkgxQZU1yOJXiNfQenT/jvBoqP32AYYEJ Bf981m424nyI+Sv250UGR8ebTASlZMxr3C6Xnyy31Zexgs4lwgmOlu3WmenOkCn4bUss u68GlsRFVaX6OPnQrh839fK4NNIqUYA9fgmLNUW3uxklVZ03mpPGokC0oMD24MDobKUK 8oY79o9WA3UPx94WK0tMFjpxe1irKep2U3n7msCY2yJuY7n/js1HfXOl3m8O0uEYpS9F xB2A== X-Gm-Message-State: AOAM5336/KsSkYIg+O+RdGS2ZYanxKjcW81AIF9xEXnvI9/qW11nD8cA PahwVdEqx+/SMcr2gxORyTl/yiv6PKFsarBBQls= X-Google-Smtp-Source: ABdhPJy0XoZJ2esVX8+4wcFLlF6um9NLvGAJ5fc2t1hUUEHZCOGJRTRLWSbAKm+GZYwEumVFNBb3ARUgbj71FBUSPrI= X-Received: by 2002:a9d:6c0f:: with SMTP id f15mr92375otq.118.1590482268905; Tue, 26 May 2020 01:37:48 -0700 (PDT) MIME-Version: 1.0 References: <20200525182608.1823735-1-kw@linux.com> <20200525182608.1823735-3-kw@linux.com> In-Reply-To: <20200525182608.1823735-3-kw@linux.com> From: "Rafael J. Wysocki" Date: Tue, 26 May 2020 10:37:36 +0200 Message-ID: Subject: Re: [PATCH 2/8] ACPI: PM: Use the new device_to_pm() helper to access struct dev_pm_ops To: =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= Cc: Dan Carpenter , "Rafael J. Wysocki" , Len Brown , Kevin Hilman , Ulf Hansson , Pavel Machek , Greg Kroah-Hartman , 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:" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Mon, May 25, 2020 at 8:26 PM Krzysztof Wilczyński wrote: > > Use the new device_to_pm() helper to access Power Management callbacs > (struct dev_pm_ops) for a particular device (struct device_driver). > > No functional change intended. > > Signed-off-by: Krzysztof Wilczyński > --- > drivers/acpi/device_pm.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c > index 5832bc10aca8..b98a32c48fbe 100644 > --- a/drivers/acpi/device_pm.c > +++ b/drivers/acpi/device_pm.c > @@ -1022,9 +1022,10 @@ static bool acpi_dev_needs_resume(struct device *dev, struct acpi_device *adev) > int acpi_subsys_prepare(struct device *dev) > { > struct acpi_device *adev = ACPI_COMPANION(dev); > + const struct dev_pm_ops *pm = driver_to_pm(dev->driver); I don't really see a reason for this change. What's wrong with the check below? > > - if (dev->driver && dev->driver->pm && dev->driver->pm->prepare) { > - int ret = dev->driver->pm->prepare(dev); > + if (pm && pm->prepare) { > + int ret = pm->prepare(dev); > > if (ret < 0) > return ret; > -- > 2.26.2 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-f66.google.com ([209.85.210.66]:40832 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726926AbgEZIhu (ORCPT ); Tue, 26 May 2020 04:37:50 -0400 MIME-Version: 1.0 References: <20200525182608.1823735-1-kw@linux.com> <20200525182608.1823735-3-kw@linux.com> In-Reply-To: <20200525182608.1823735-3-kw@linux.com> From: "Rafael J. Wysocki" Date: Tue, 26 May 2020 10:37:36 +0200 Message-ID: Subject: Re: [PATCH 2/8] ACPI: PM: Use the new device_to_pm() helper to access struct dev_pm_ops Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-s390-owner@vger.kernel.org List-ID: To: =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= Cc: Dan Carpenter , "Rafael J. Wysocki" , Len Brown , Kevin Hilman , Ulf Hansson , Pavel Machek , Greg Kroah-Hartman , 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:" On Mon, May 25, 2020 at 8:26 PM Krzysztof Wilczyński wrote: > > Use the new device_to_pm() helper to access Power Management callbacs > (struct dev_pm_ops) for a particular device (struct device_driver). > > No functional change intended. > > Signed-off-by: Krzysztof Wilczyński > --- > drivers/acpi/device_pm.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c > index 5832bc10aca8..b98a32c48fbe 100644 > --- a/drivers/acpi/device_pm.c > +++ b/drivers/acpi/device_pm.c > @@ -1022,9 +1022,10 @@ static bool acpi_dev_needs_resume(struct device *dev, struct acpi_device *adev) > int acpi_subsys_prepare(struct device *dev) > { > struct acpi_device *adev = ACPI_COMPANION(dev); > + const struct dev_pm_ops *pm = driver_to_pm(dev->driver); I don't really see a reason for this change. What's wrong with the check below? > > - if (dev->driver && dev->driver->pm && dev->driver->pm->prepare) { > - int ret = dev->driver->pm->prepare(dev); > + if (pm && pm->prepare) { > + int ret = pm->prepare(dev); > > if (ret < 0) > return ret; > -- > 2.26.2 >