Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp543198iog; Thu, 30 Jun 2022 05:54:01 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tjn/NjIWkwlNOAT2lhA/K4fZXgHQ9kFwSidlaDl4DJmzghMJQJAbf0koRAqS7PxgmB4Q6K X-Received: by 2002:aa7:dac2:0:b0:435:76a2:4ebe with SMTP id x2-20020aa7dac2000000b0043576a24ebemr11357461eds.196.1656593640842; Thu, 30 Jun 2022 05:54:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656593640; cv=none; d=google.com; s=arc-20160816; b=xajIIDF1iiei3I5mGSUWOoMyWhyoLeEpUeOpt5WonoPtWRrE3LDYOxRt1V5p6Btcjm MDbCHAILdmD+THL3B2f5d8EQRFAs+ejlg4/gQmbMD3s2/WEn82pkRnug8MJYAIL/JmZx 2M/QskzfnAleJ2NxuOOy9gTLiOEDxWyDxG2Rs9YvqTY36shq+C7pdk/e51Q1hbM2slwk 6XzoSErIyiRL20AXwaeMUI4l1rs6Jtp2nvNcNDgEjzIgVfHel/TslgXKxLGt1LTwGme9 HwdTuXhvhUAFdwiRdn+Zv0ey9z4F3bEyly5qyLixLlbwW6CDLHOx1siP+Uyd9CrYP3RI 0B0w== 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=SwiP+hf2YNC8Lbe3gvH/02qMr4vvCVdAX/mAw68bS3Q=; b=kHpeRNgsqDJ5bA7mpZyLP7obzVjBGxxnRdRsmD9xgxaZlwQcNsTqQ/vJWXjcMVcsrJ 3ckLfZdjnME7BV6d0vJei2m5mvi/w4Y3Lb+diW9+HYrJD/QmVK93K0gzKIeeUuPt0S88 6+pIzXtLXBd0U4tctUwInAU1Y7zg1DJBHUHSLgHZ4BivwgYwnj0x0Giyo1pb+Csnz5PE yPv8HTmMm7sur7LDoWAfEoTkR3/5YvdwcffVGQt6Vi4h2afJNGzuLbJEiBm/S61N29Rn dqmmPdJ3vo8K/W2cCSM8ekVMmV2ztV3g62n6l7ytJsykofYt8KNRgmLqW411ecyqnleR LJ7w== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb37-20020a1709071ca500b00727c6da657asi6121234ejc.596.2022.06.30.05.53.35; Thu, 30 Jun 2022 05:54:00 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233783AbiF3MsT (ORCPT + 99 others); Thu, 30 Jun 2022 08:48:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230288AbiF3MsS (ORCPT ); Thu, 30 Jun 2022 08:48:18 -0400 Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99ED8BC1D; Thu, 30 Jun 2022 05:48:14 -0700 (PDT) Received: by mail-yb1-f177.google.com with SMTP id o19so26993857ybg.2; Thu, 30 Jun 2022 05:48:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SwiP+hf2YNC8Lbe3gvH/02qMr4vvCVdAX/mAw68bS3Q=; b=5Mu5tKayaoCPxNCDIOf8k4X/TaA1Dj67t6we7+D0A/n+HwjoshPiJXCI1VrPIYVu5J 2KlDGSYLQqbQzVoh/GCZWFEeyftn84f1WH7cdGgvE7H2/yqeF7+JsIXYTcuWU+O+CFEj nHF6+A+B6QpFVcg/Q/GpDDl31cRPtgJltK+CsW8+XbJhXPGsr89D9sPtGQoiZyr+yL0b Hh8QS9PczaHCtTyVBKg5Z7tfNLXDPUAt6DXX/IzVHF3Y5ZLM1ZcnLjTEILz8tBGRdsH0 QXk5xgYNSNelBOoNKnMMGqjJrcYGEc2FyYlS1sk8QyCSLWwzkV6O66WsTk/sVRKECZXZ WZpA== X-Gm-Message-State: AJIora8y8pkN6Wssp/5cJIGA6n8VCECc3iXHXTAPIQtJzYUEJhUV+iJs a6BcMxxPB1cEhNwpInBLKJODYApLG19azq90Lz0= X-Received: by 2002:a25:664f:0:b0:66c:d0f4:36cc with SMTP id z15-20020a25664f000000b0066cd0f436ccmr8951994ybm.482.1656593293788; Thu, 30 Jun 2022 05:48:13 -0700 (PDT) MIME-Version: 1.0 References: <12026357.O9o76ZdvQC@kreacher> <2657553.mvXUDI8C0e@kreacher> In-Reply-To: <2657553.mvXUDI8C0e@kreacher> From: "Rafael J. Wysocki" Date: Thu, 30 Jun 2022 14:48:02 +0200 Message-ID: Subject: Re: [PATCH v2] hisi_lpc: Use acpi_dev_for_each_child() To: "Rafael J. Wysocki" Cc: Linux ACPI , LKML , Andy Shevchenko , John Garry , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 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. > 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); > } > > /* > > >