Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp631779iog; Wed, 29 Jun 2022 07:13:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uhYvL3pbDLr9VWWMvfW60xDBka8Ra9j0T+o+hP9MVq16kU88oysrE2I/a7GYEJysaOjb01 X-Received: by 2002:a65:53c8:0:b0:40d:77fc:5f05 with SMTP id z8-20020a6553c8000000b0040d77fc5f05mr3049738pgr.263.1656512038733; Wed, 29 Jun 2022 07:13:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656512038; cv=none; d=google.com; s=arc-20160816; b=WNrRGmTirIwpKav4uzMr3cSAk1PpqqY5f23hl1Vd6v4UtVS65Xe1yLlWjPLjqs+jT+ /gX1dEY/++Vb8l9G81XIurxd8tYdopXBQT9TizmIralDUgCdMJhqfSsUwFhGWL9KII6j xImV29MOvUxvuU8+2fMieGQyrs5doosYgRbijh6PEui1P9S+XNPx9ES3ZRvEufn0bcxl 94lYgg2IkkVTA2Oq05h6lxEzGK/aEPDpLDfOKTaRXYzzbL84M7zjkediYB0u6/xbqBxx cz4BJMFhyfLjLnw0/SXs3YPBCwzY5ypxqePUbrCRUZg/OX/6fElrejK/Q0p2Wi7P/Q2X mM2A== 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=8h544jZ63kfquSMQqf0U0mzVKJpiK6BpVCtTLqg6bmE=; b=IbYR31rLeXIHAy/J1kZ9wBWANXtPWuSbcxad+6rY8613Y8hJl95IWMTNY3zshs9aC2 k6EyoE3hIUh0XUdQVEV0GzOQ23RILxxXmEKOL2ulQsDqd54rxSBGEgQi0qZ6PE4WsO/g 3/0C4JUGie0el1BkLMq+YnwNRHKWKZsAfUO3HA1VNNvDzhk8blz88AfUtfvuwuSu6IKL A9JdGgTdP3rTvG/XT1W//XchTkwHU/QXa7VspLy4+Kwc4A17WX4GznJuNWZ/nPpH/IlV zqRGd3Jx2tlxJHgW1nqE9PywObB+Cdc175B5m+EkK2ws6SD1w0k88w7uItwO9Ur4cv/6 yVew== 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 ls8-20020a17090b350800b001ec73deb914si4165297pjb.111.2022.06.29.07.13.40; Wed, 29 Jun 2022 07:13:58 -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 S232085AbiF2Nd7 (ORCPT + 99 others); Wed, 29 Jun 2022 09:33:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231658AbiF2Nd5 (ORCPT ); Wed, 29 Jun 2022 09:33:57 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70F0F63C5; Wed, 29 Jun 2022 06:33:56 -0700 (PDT) Received: from fraeml745-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LY2Pq2q0Cz687SB; Wed, 29 Jun 2022 21:29:51 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml745-chm.china.huawei.com (10.206.15.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 29 Jun 2022 15:33:54 +0200 Received: from [10.195.245.77] (10.195.245.77) 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; Wed, 29 Jun 2022 14:33:52 +0100 Message-ID: Date: Wed, 29 Jun 2022 14:33:54 +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] hisi_lpc: Use acpi_dev_for_each_child() To: "Rafael J. Wysocki" , Linux ACPI CC: LKML , Andy Shevchenko , Greg Kroah-Hartman References: <12026357.O9o76ZdvQC@kreacher> From: John Garry In-Reply-To: <12026357.O9o76ZdvQC@kreacher> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.195.245.77] X-ClientProxiedBy: lhreml751-chm.china.huawei.com (10.201.108.201) 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 29/06/2022 13:55, 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). > > Signed-off-by: Rafael J. Wysocki Hi Rafael, > --- > drivers/bus/hisi_lpc.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 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,11 @@ 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; > I got this warn: drivers/bus/hisi_lpc.c: In function ‘hisi_lpc_acpi_remove’: drivers/bus/hisi_lpc.c:489:22: warning: unused variable ‘child’ [-Wunused-variable] 489 | struct acpi_device *child; | ^~~~~ CC drivers/bus/brcmstb_gisb. With that fixed: Acked-by: John Garry Can you route this through one of your trees? > 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); > } > > /* > > > BTW, I don't know why I ever added a remove method for this driver instead of just setting suppress_bind_attrs.... Thanks, John