Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1922552pxb; Mon, 8 Mar 2021 09:28:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJzTsIFyaj+Xg74j0t8HOyfDh7KWPNpZ40F6ygW5JPe8IBmAeTh+Tp9PtmYmKNaZ0NXlFxmq X-Received: by 2002:a17:906:3d62:: with SMTP id r2mr14321171ejf.488.1615224490966; Mon, 08 Mar 2021 09:28:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615224490; cv=none; d=google.com; s=arc-20160816; b=Y848EoV5NYGsNrzL75A5fuJbGtdAhqCeCiXqO+yyaN07xF4aVk5t3AnC+zZjA0otbm TpnEh4B3aV/TLAwDdF/5c523+t/yV+k7peNCA9+60k2dr6potUT0/yrwfZlLkgntP4wm U89xLofq3Z0WgwjqFHLk6wvAe9dpPugYjVIenu85RC3ymn3t5Q5g1RcOSrhHbuJHLR6q 4gD7DVh5/84fY4rLXI6o94fh4iV5ucJG0ZsJcpV8uUCR9QoOffpDbJSMIUBnEtT0vUPZ YOOD1FE4pO6yBSMdP3f3qLAE8I8/sHbsXYBfdl05DHFUpfnXvTpxhuEpCAVqWZSUTs/W AkUQ== 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=46Dl+/n5MDXaPsg8pK7iPxr6SdZP0DYwFyO9StPfVU0=; b=SWW6xrXoY5vB6Y6AbbxgkW4m98jWXhS03eWpPTEq4erMGrrX/F3DfVuUs96sYhRdGb QfPnwDSHHToCQFOThRKBLdoeetUPaetc86R2tYoDlXoiGVT7xjNO2J1sTeMYitryYcU3 JLmPAVhU/xRfXEKf2bhBXTFluFt1b4Ef/jKlDSH8rIIUwLei4EX8s93VTXkkhtWHsEcq XbqSrGmPKw+pxOSqISyu6Nmge5pSQHZCiIOncJjeCUcqPy0tHC1TGdhRmNyrcYOeHJW0 QuBzJ8XQpTUJw/TEceZlpvevdzb5T8pWi3rF7WBelEoIXNGKDT5FQXYEk/8hwKBbXl3I mkJA== 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 g11si7429127ejd.733.2021.03.08.09.27.46; Mon, 08 Mar 2021 09:28:10 -0800 (PST) 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 S229730AbhCHRY3 (ORCPT + 99 others); Mon, 8 Mar 2021 12:24:29 -0500 Received: from mail-oi1-f178.google.com ([209.85.167.178]:44926 "EHLO mail-oi1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231220AbhCHRYD (ORCPT ); Mon, 8 Mar 2021 12:24:03 -0500 Received: by mail-oi1-f178.google.com with SMTP id w195so5124555oif.11; Mon, 08 Mar 2021 09:24:03 -0800 (PST) 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=46Dl+/n5MDXaPsg8pK7iPxr6SdZP0DYwFyO9StPfVU0=; b=BVwUHNbpB1GDF/DPzuq7HfbJGHAhmy5UfUbOmsLkZID6pvX98UnbCr+Km0WlyHEzNM njyjuhDUJCMqdmnYUgfhtr454v/c1AY4oVGfBPyNFBtDiYblWqESmGWGCJoTmqwZ9sqB +EG85f0m+03vBRHBLJ0ZOrWKhCQdYd94vMdP7hZlvMhQ7zrEgw8i3AYUzgz46pyEFajw U76PVM9/x8Xo8/10+gfL0i0+i313LZpxZS9AaUdb7AYfq3jqHch+pOpcqGjUBlIOrN0R w59hCiWTeJ7j+Oz3BxxKu3B0a0to8+NvorQKvJwgCsvbSOD6NHCwBqGO0m4ulsROiXJm ZE5g== X-Gm-Message-State: AOAM530CJCcR3vtx1oWe3BIybAEjMqyNNtWgE2r+5X60FfMJmFGDB/si 5Jz82lLGBEBt8d0Kg7Qe9PGFrzxwerNy+P69m+w= X-Received: by 2002:aca:3d85:: with SMTP id k127mr18673488oia.157.1615224242728; Mon, 08 Mar 2021 09:24:02 -0800 (PST) MIME-Version: 1.0 References: <20210222130735.1313443-1-djrscally@gmail.com> <20210222130735.1313443-2-djrscally@gmail.com> <615bad5e-6e68-43c9-dd0b-f26d2832d52f@gmail.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Mon, 8 Mar 2021 18:23:51 +0100 Message-ID: Subject: Re: [PATCH v3 1/6] ACPI: scan: Extend acpi_walk_dep_device_list() To: Daniel Scally Cc: Andy Shevchenko , Tomasz Figa , Sakari Ailus , Rajmohan Mani , "Rafael J. Wysocki" , Len Brown , Mika Westerberg , Linus Walleij , Bartosz Golaszewski , Wolfram Sang , Lee Jones , Kieran Bingham , Laurent Pinchart , Hans de Goede , Mark Gross , Maximilian Luz , Robert Moore , Erik Kaneda , me@fabwu.ch, Linux Kernel Mailing List , ACPI Devel Maling List , "open list:GPIO SUBSYSTEM" , linux-i2c , Platform Driver , "open list:ACPI COMPONENT ARCHITECTURE (ACPICA)" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 8, 2021 at 4:45 PM Rafael J. Wysocki wrote: > > On Mon, Mar 8, 2021 at 2:57 PM Andy Shevchenko > wrote: > > > > On Mon, Mar 08, 2021 at 02:36:27PM +0100, Rafael J. Wysocki wrote: > > > On Sun, Mar 7, 2021 at 9:39 PM Andy Shevchenko > > > wrote: > > > > On Sun, Mar 7, 2021 at 3:36 PM Daniel Scally wrote: > > > > > On 22/02/2021 13:34, Andy Shevchenko wrote: > > > > > > On Mon, Feb 22, 2021 at 3:12 PM Daniel Scally wrote: > > > > > >> The acpi_walk_dep_device_list() is not as generalisable as its name > > > > > >> implies, serving only to decrement the dependency count for each > > > > > >> dependent device of the input. Extend the function to instead accept > > > > > >> a callback which can be applied to all the dependencies in acpi_dep_list. > > > > > >> Replace all existing calls to the function with calls to a wrapper, passing > > > > > >> a callback that applies the same dependency reduction. > > > > > > The code looks okay to me, if it was the initial idea, feel free to add > > > > > > Reviewed-by: Andy Shevchenko > > > > ... > > > > > > > >> +void acpi_dev_flag_dependency_met(acpi_handle handle) > > > > > > > > Since it's acpi_dev_* namespace, perhaps it should take struct acpi_device here? > > > > > > > > > > I can do this, but I avoided it because in most of the uses in the > > > > > kernel currently there's no struct acpi_device, they're just passing > > > > > ACPI_HANDLE(dev) instead, so I'd need to get the adev with > > > > > ACPI_COMPANION() in each place. It didn't seem worth it... > > > > > > It may not even be possible sometimes, because that function may be > > > called before creating all of the struct acpi_device objects (like in > > > the case of deferred enumeration). > > > > > > > > but happy to > > > > > do it if you'd prefer it that way? > > > > > > > > I see, let Rafael decide then. I'm not pushing here. > > > > > > Well, it's a matter of correctness. > > > > Looking at your above comment it is indeed. Thanks for clarification! > > Well, actually, the struct device for the object passed to this > function should be there already, because otherwise it wouldn't make > sense to update the list. So my comment above is not really > applicable to this particular device and the function could take a > struct acpi_device pointer argument. Sorry for the confusion. > > > But should we have acpi_dev_*() namespace for this function if it takes handle? > > It takes a device object handle. > > Anyway, as per the above, it can take a struct acpi_device pointer > argument in which case the "acpi_dev_" prefix should be fine. > > > For time being nothing better than following comes to my mind: > > > > __acpi_dev_flag_dependency_met() => __acpi_flag_device_dependency_met() > > acpi_dev_flag_dependency_met() => acpi_flag_device_dependency_met() > > The above said, the name is somewhat confusing overall IMV. > > Something like acpi_dev_clear_dependencies() might be better. > > So lets make it something like > > void acpi_dev_clear_dependencies(struct acpi_device *supplier); To be precise, there are two functions in the patch, acpi_dev_flag_dependency_met() which invokes acpi_walk_dep_device_list() and __acpi_dev_flag_dependency_met() invoked by the latter as a callback. Above I was talking about the first one. The callback should still take a struct acpi_dep_data pointer argument and I would call it acpi_scan_clear_dep() or similar.