Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2728902pxb; Tue, 12 Oct 2021 12:14:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrmdm9C08EPf1yAhF60n6dqOmEZDMDaVkU4fkA0q9uJbjyXPLEP3gDCPU18ygFbDuvtrwE X-Received: by 2002:a17:902:7d89:b0:13c:a5e1:f0f1 with SMTP id a9-20020a1709027d8900b0013ca5e1f0f1mr31870478plm.24.1634066054731; Tue, 12 Oct 2021 12:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634066054; cv=none; d=google.com; s=arc-20160816; b=j9RCKahxgI+wH1ynQlHX7ysxbbyW3jnzld/uo7LFrjWCuRT2bfR2hpeYjD+75UWCwl XdSOivXDTJpgqaslxZJtS22k6S4zH2rb3GYkl6fuXc95KrY5pMCx/aRO8WDSGIzNoeRw +kEefDWwo7GcItQNzXxpTWz00YPubznoIT5HI7gpbwapbnll3SnET5Nq73sHMLLEe9/4 8OHuv0UVUJ7o0pcz5LqLxGWg4+OmKw2gaANq3eTWD9g7ZU2cgFDQPdNcQfWksYXntE51 jeX2D22vrt39/JjeHKhKYw2nQimpEBwl3yVLcZFAPg+0p81Cw1GR656nNrFC/EDGgQS3 lFAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=UsdaTdlqInk/Db+RELmJSVFeuk7KGQ8SYughWLnehY8=; b=gEMbgkBnqweyIeFsbvlnbyjYO/z82tVoonJak1n6Vo6V7CXHeHJS/z6ghZnof1YSY2 t8fn/VR8qPzhu4iKqMR2+YLwlBT/y8gKPYQ/CPHkxkVQyg5Tnmmhycwt61G/LYNILm6k f9ny0fbTxKigXAjgmALF9lTgHw+hN87FRsbmHA8QJ4f1tJyvfmxphcReJODcylncwKMp +dC6x2dbEdiouk9A3nVmZb4vTcLm7VKFwOUBw7kARcT+UffqP5mQHaLHMWAV2DDKHI88 nLomHgo2Mh2CKjThAi4IiFckkV8gGTMzOccjUChsKWZvBCDy3J5wqGUjhmx0q0KkBVL2 X5Bw== 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 h3si15614175plo.223.2021.10.12.12.14.01; Tue, 12 Oct 2021 12:14:14 -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 S233033AbhJLTNb (ORCPT + 99 others); Tue, 12 Oct 2021 15:13:31 -0400 Received: from mail-ot1-f47.google.com ([209.85.210.47]:39539 "EHLO mail-ot1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231886AbhJLTN2 (ORCPT ); Tue, 12 Oct 2021 15:13:28 -0400 Received: by mail-ot1-f47.google.com with SMTP id k2-20020a056830168200b0054e523d242aso618389otr.6; Tue, 12 Oct 2021 12:11:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UsdaTdlqInk/Db+RELmJSVFeuk7KGQ8SYughWLnehY8=; b=zeF1M07uZ8koHB8p8h4k4Af9rpsS7JfPitcYjb4dJizDs9kwcfTb6SIg1cjkj8xeoo Cm/UONhKNolje1c0RBuxt6ATGTqlN6fGSyX6pMURacipxG5coD/I2i2j48Drho/ITQ/M geJrpgW8zQLyjF6f8le34r0FJ85p6ffUtJ6OgMw0J0tYwD3FmStWzPV2kU5gcMX2ed2Z uJ8Wg7Mv2MbUmtgrVZ6EZGcNgPV+qFQAMgRN/4Vt6EB7CrXdCSetvpZdPUVyz/q5sV3k pJtta2ZEF8Kxb/x6J/MfsnF3CU3Ui6H+rfD9JyPWAYJ8Z16tOqhO22fbsVaWa0bH1JGZ EOog== X-Gm-Message-State: AOAM530fRqCRX744roWP+N2vwVYC5wujpE0+4HpyyHDN/vebkZUAX+ed 0+8fs1PkZwOVGes5jnN1QLKpsj5PBtHbtINluxw= X-Received: by 2002:a05:6830:1af0:: with SMTP id c16mr14677399otd.16.1634065886475; Tue, 12 Oct 2021 12:11:26 -0700 (PDT) MIME-Version: 1.0 References: <4369779.LvFx2qVVIh@kreacher> <3089655.5fSG56mABF@kreacher> In-Reply-To: From: "Rafael J. Wysocki" Date: Tue, 12 Oct 2021 21:11:15 +0200 Message-ID: Subject: Re: [PATCH v1 5/7] surface: surface3_power: Use ACPI_COMPANION() directly To: Maximilian Luz Cc: "Rafael J. Wysocki" , Linux ACPI , LKML , Hans de Goede , Mark Gross , Platform Driver Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 12, 2021 at 8:21 PM Maximilian Luz wrote: > > On 10/12/21 19:46, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > > > The ACPI_HANDLE() macro is a wrapper arond the ACPI_COMPANION() > > macro and the ACPI handle produced by the former comes from the > > ACPI device object produced by the latter, so it is way more > > straightforward to evaluate the latter directly instead of passing > > the handle produced by the former to acpi_bus_get_device(). > > > > Modify mshw0011_notify() accordingly (no intentional functional > > impact). > > > > Signed-off-by: Rafael J. Wysocki > > Looks mostly good to me, small comment/question inline. > > > --- > > drivers/platform/surface/surface3_power.c | 9 ++++----- > > 1 file changed, 4 insertions(+), 5 deletions(-) > > > > Index: linux-pm/drivers/platform/surface/surface3_power.c > > =================================================================== > > --- linux-pm.orig/drivers/platform/surface/surface3_power.c > > +++ linux-pm/drivers/platform/surface/surface3_power.c > > @@ -160,15 +160,14 @@ mshw0011_notify(struct mshw0011_data *cd > > { > > union acpi_object *obj; > > struct acpi_device *adev; > > - acpi_handle handle; > > unsigned int i; > > > > - handle = ACPI_HANDLE(&cdata->adp1->dev); > > - if (!handle || acpi_bus_get_device(handle, &adev)) > > + adev = ACPI_COMPANION(&cdata->adp1->dev); > > + if (!adev) > > return -ENODEV; > > Do we need to get the ACPI device (adev) here? To me it looks like only > its handle is actually used so why not keep ACPI_HANDLE() and remove the > acpi_bus_get_device() call instead? It actually doesn't really matter, but you're right, acpi_bus_get_device() is simply redundant here, so ACPI_HANDLE() is sufficient. I'll send a v2 of this one. > > > > - obj = acpi_evaluate_dsm_typed(handle, &mshw0011_guid, arg1, arg2, NULL, > > - ACPI_TYPE_BUFFER); > > + obj = acpi_evaluate_dsm_typed(adev->handle, &mshw0011_guid, arg1, arg2, > > + NULL, ACPI_TYPE_BUFFER); > > if (!obj) { > > dev_err(&cdata->adp1->dev, "device _DSM execution failed\n"); > > return -ENODEV; > > > > > > > > Regards, > Max