Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp645846iog; Thu, 30 Jun 2022 07:35:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ugpdjT0lxBCEE9SbBBmzXc4iygyTOHH1q+AvXRMMeAAJVNPJg3FLSt1pgdRw9mtWJHaOi9 X-Received: by 2002:a17:906:6545:b0:722:7c99:1ad7 with SMTP id u5-20020a170906654500b007227c991ad7mr9238120ejn.325.1656599750557; Thu, 30 Jun 2022 07:35:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656599750; cv=none; d=google.com; s=arc-20160816; b=oOX+glqKkVRygUs9DWTh3Y12lI5c8OYDPaXRm4Uy+wKv3XQRc9jvztGGyVzb1p7Ukr y95vchVceDVz8XHuwDVgGIZDFJUbjPUZVINxn4sJtD6oeQ8JlZLy3iFt0oD7ssT1BAj9 5SDXJVzzEUOGqM7nIIKmFy2I97zHYyLKjdlKARnxlYDzWFYU+w+lAMaVUgZjAhhQA5m5 P2qO4KxIYX4SUJ3+qlO8AimO1+6QFld6+lXxaJ2WAyHkbWn1ECdWUbcO7BXemhntn2/+ AUgYwDUkQgnH0jRiRrxlBrkXekMLwpDmiX1lrBoMrBv8SMM0+bAEkeUT9DFz82y5WWIK 2F9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=8I+4+qmVqgVRPDoxa4KD6waDr3F+VXjmxkmvCTaG2Ts=; b=umZyR5J/sWT5S7xgu3VB82HOubWXY3bBkt4CfUixnCGbA8rNw73Bqepu5egyYmveK3 cfswV52EbWP8jVOqqeLDsMDuAcJU0aQbPuPmMyfdLvASW9a5G23hbyXtRy2zC4zQOPwL ivZFPknZ1G48RJSWJve9HKWXBwPwvric/0eKjz7hPdvXJPLIk4DK9PHTjZyeOcrIV2QX heGHUS6rax5XJeo5ozthxtGc8X47cauFr3WTbjsbgA5dC9eHl37Qe9cRoo3KwvysTMug i1ZO5Rd2FQqNbrvPHnVl8mtebHUL50TD0ikWSSJXKXUGoL/TFRt2t7Rm2Lpl71DhjG9U v09w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt15-20020a1709072d8f00b00722efd22affsi7058645ejc.751.2022.06.30.07.35.25; Thu, 30 Jun 2022 07:35:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234003AbiF3NhR (ORCPT + 99 others); Thu, 30 Jun 2022 09:37:17 -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 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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); >> } >> >> /* >> >> >> > .