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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA18BC433EF for ; Thu, 30 Jun 2022 13:37:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234067AbiF3NhS (ORCPT ); Thu, 30 Jun 2022 09:37:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232771AbiF3NhQ (ORCPT ); Thu, 30 Jun 2022 09:37:16 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BEBD29826; Thu, 30 Jun 2022 06:37:15 -0700 (PDT) Received: from fraeml741-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LYfVw1j3Xz687ZT; Thu, 30 Jun 2022 21:36:24 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml741-chm.china.huawei.com (10.206.15.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 30 Jun 2022 15:37:12 +0200 Received: from [10.126.174.156] (10.126.174.156) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 30 Jun 2022 14:37:12 +0100 Message-ID: <7aad2916-1774-76c5-339a-bbcac4655642@huawei.com> Date: Thu, 30 Jun 2022 14:37:14 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH v2] hisi_lpc: Use acpi_dev_for_each_child() To: "Rafael J. Wysocki" , "Rafael J. Wysocki" CC: Linux ACPI , LKML , Andy Shevchenko , Greg Kroah-Hartman References: <12026357.O9o76ZdvQC@kreacher> <2657553.mvXUDI8C0e@kreacher> From: John Garry In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.126.174.156] X-ClientProxiedBy: lhreml727-chm.china.huawei.com (10.201.108.78) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/06/2022 13:48, Rafael J. Wysocki wrote: > On Wed, Jun 29, 2022 at 3:47 PM Rafael J. Wysocki wrote: >> >> From: Rafael J. Wysocki >> >> Instead of walking the list of children of an ACPI device directly, >> use acpi_dev_for_each_child() to carry out an action for all of >> the given ACPI device's children. >> >> This will help to eliminate the children list head from struct >> acpi_device as it is redundant and it is used in questionable ways >> in some places (in particular, locking is needed for walking the >> list pointed to it safely, but it is often missing). > > I've overlooked another usage of the children list in hisi_lpc, in > hisi_lpc_acpi_probe(), and eliminating that one is a bit more > complicated. > > So please scratch this one and I will send a v3 when 0-day tells me > that it builds. Hi Rafael, If it makes things simpler then I can just fix the driver so that we can't unload it. Let me know if that suits better. Cheers > >> Signed-off-by: Rafael J. Wysocki >> Acked-by: John Garry >> --- >> >> -> v2: >> * Drop unused local variable (John). >> * Add ACK from John. >> >> --- >> drivers/bus/hisi_lpc.c | 14 ++++++++------ >> 1 file changed, 8 insertions(+), 6 deletions(-) >> >> Index: linux-pm/drivers/bus/hisi_lpc.c >> =================================================================== >> --- linux-pm.orig/drivers/bus/hisi_lpc.c >> +++ linux-pm/drivers/bus/hisi_lpc.c >> @@ -471,6 +471,12 @@ static int hisi_lpc_acpi_remove_subdev(s >> return 0; >> } >> >> +static int hisi_lpc_acpi_clear_enumerated(struct acpi_device *adev, void *not_used) >> +{ >> + acpi_device_clear_enumerated(adev); >> + return 0; >> +} >> + >> struct hisi_lpc_acpi_cell { >> const char *hid; >> const char *name; >> @@ -480,13 +486,9 @@ struct hisi_lpc_acpi_cell { >> >> static void hisi_lpc_acpi_remove(struct device *hostdev) >> { >> - struct acpi_device *adev = ACPI_COMPANION(hostdev); >> - struct acpi_device *child; >> - >> device_for_each_child(hostdev, NULL, hisi_lpc_acpi_remove_subdev); >> - >> - list_for_each_entry(child, &adev->children, node) >> - acpi_device_clear_enumerated(child); >> + acpi_dev_for_each_child(ACPI_COMPANION(hostdev), >> + hisi_lpc_acpi_clear_enumerated, NULL); >> } >> >> /* >> >> >> > .