Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1848771pxb; Mon, 8 Mar 2021 07:49:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJynrg9uZPghYFrzlzV8MLF3vhWb97x7gqjre0qQUJ6WY7VG37YKOpKxvTqvgHmgBQGkAfwg X-Received: by 2002:a17:906:388d:: with SMTP id q13mr15896025ejd.34.1615218552567; Mon, 08 Mar 2021 07:49:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615218552; cv=none; d=google.com; s=arc-20160816; b=STaYBHAvDqMt0ZH0pBrcAj2ZJGqb/zAds1ltKNMucQotz7H2pMMtpRgJK9A5Z+QDYf GQyyWA5XAh9MMcIPYfUQRCnE5fjCgVJKJ3wdagN6wJIQXja6mJOmS2qOivknMjeblejM 4Cbq+notZhgZMoPg5XYARXhkHVAbYSYyutCSAyLNlQ6m52zDyEKq2t8UD/6tfTsPAQgE OkkkQghFsdb8MvxJtZJW9ELwOLZHZx+wqdQUrTSqKEGZUBXO6YX/NLEN6PBS1UplEv/T CRh0sCKbv2JAcqGiXta5MAqJyrOYxtzxnEuJ7ZLlI+SkvHpNTIP30Bxf2WLNaTAfHeDC tZuA== 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=mbsT3/Ouni6Vb8m0SK7QpZ24XnBIwdODUDVR1OBNjiQ=; b=g9lafI42UQwtP9CMGQsKZ0jWTHdam107rbkxG5oIqD29/s0B5PvrKWLh5QPVwGskoP dByFHDWNi4ryUX0JEnmDW564loNCqfSWixK5+UkSHlmrWCNExC46SFE+KvnPWRqlL7C8 QQ+UdT4IcpVwu4mDlusYrFJNNCG1dVIhMz0zqvsqIHjGpAkZrqVd4KUejXm5gi1ZEpDT rYkeIocplhCTVojqZpxy/l1IhuL6Ra5axb9Ka2IBdhkHe+OUwT2q1sZmMLLx/HqCisqm mUqWA1CcW92V5gl6iDp+VlctxfumDXy8L40cuMgHCnEsbTZJTIPwx4Uj9JGa9fq4gMjS TSjg== 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 cf2si7330368ejb.332.2021.03.08.07.48.48; Mon, 08 Mar 2021 07:49:12 -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 S230039AbhCHPpY (ORCPT + 99 others); Mon, 8 Mar 2021 10:45:24 -0500 Received: from mail-ot1-f46.google.com ([209.85.210.46]:43707 "EHLO mail-ot1-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229829AbhCHPpX (ORCPT ); Mon, 8 Mar 2021 10:45:23 -0500 Received: by mail-ot1-f46.google.com with SMTP id v12so9572523ott.10; Mon, 08 Mar 2021 07:45:22 -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=mbsT3/Ouni6Vb8m0SK7QpZ24XnBIwdODUDVR1OBNjiQ=; b=U+ZWC1eKnbbsrZdMotLrIujg6APWVI89ngEuYnHIIkNokj+upzR2POx/LY1jlJyvb9 aVFUzVXGnOwIOvG0I7DG49gElIhRAWMGx9PO7yligRjIOENkTJdWkovypGGKBuMYzmdC ZZlUQLazT5HLT0SdHjDVzn788RIGIz4yPB2NnU4jPyyba6PGbvoTdpqPwvzBCiZq+Phy yZYmoiyNHy1Hqb5sP6SRvmfOPW5fTv7uFlUKWxlqRil4JwcSUz69jM7ZSC5q3+NCENio Ex/X5obHfGhIIWYZ9eIqENaqewcuDB8DXkiIm9vdpuVIhlnFEkEpKMtbrvo1U8cXQ/Co cixQ== X-Gm-Message-State: AOAM532grdNzwD+nperLfnMN8xtQx1qdMX/rGo5oJDlh77KM/VjO4pxH HyvkmQBdMY89i8LJUyfW3mripsKOpzluGaei4ac5Z/yk49E= X-Received: by 2002:a05:6830:1e03:: with SMTP id s3mr9783834otr.321.1615218322615; Mon, 08 Mar 2021 07:45:22 -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 16:45:07 +0100 Message-ID: Subject: Re: [PATCH v3 1/6] ACPI: scan: Extend acpi_walk_dep_device_list() To: Andy Shevchenko Cc: "Rafael J. Wysocki" , Daniel Scally , 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 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);