Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp582540iog; Wed, 29 Jun 2022 06:20:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vptcWiyTARMiehyWa6MNroYrXDRakVwa9qkQIk8IISH+dBatJQXyS7eF226hCrIvkLx6H0 X-Received: by 2002:a05:6402:528d:b0:435:89c6:e16b with SMTP id en13-20020a056402528d00b0043589c6e16bmr4278936edb.292.1656508856743; Wed, 29 Jun 2022 06:20:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656508856; cv=none; d=google.com; s=arc-20160816; b=z20fQCM6y3QpvI3Gu9oCrHQZ958ysZqSxzzgmrbXPORraRxyZV+3MwWjegscWLSLhk W3zx9qgu8GJsKuU4ovmiaJjBaWrjLcyo0B+8BUsVpt6/WgjEBM6wZimy+D+RTEWLlSJ8 lxl5IyMPV5f2a8okC7LDSEdaj7ZyYi4mmRHzBwOBtZVpsu+v1yvvbtGEfHoPt0URhVRV TGcxUHhBDVhZxtYffnXQwG6B1VeiBgua9Mr+gJoJ6GQwmsaWrSzJRoLsktItRZ7UTvzH KFDLy/5N32VLp5XXg4BcJZN+gQDZQzQGmCU0JuDDZ5fRyd/XZjueqB9DiUwZluRk650e UnHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=GgzmplnDQM6gR0qHyhjTZCluzxLn83wPsNS1ln0TIJ0=; b=h0DxDV8A82NN8hNdqpXmxTf5tKegiEYbA1y0TPmTZYoY35rxV9DIptu0fGxhNJGrv9 GL93vi0gFz2af8zr+4BuTWHx7yZ/hagz1tLAYdZlo/Z2knUy/0DICNHxv3B2dP5/GFxL p5qvfBXgSyODyI1ayxeE9zl1E7xZH8SVFd2FseUvNBK5I1tgH6LB5Y6V+4suQsMYWH+u TaE8YskgR9MlY69H5n57gM0fTvTBKqnNV5q1b+G6X8oY2Rrgi1Op8bxa3H/pS2srY50z 2Rbao3Z/wzJSDDhcHgjPVsFEF7MqLpCqumHOo+POmhZTVdDS+/CJBrEgWyrjpUv4sqM9 RPHA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs43-20020a1709072d2b00b007262b99fc7esi11490348ejc.682.2022.06.29.06.20.28; Wed, 29 Jun 2022 06:20:56 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233190AbiF2MzW (ORCPT + 99 others); Wed, 29 Jun 2022 08:55:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232912AbiF2MzQ (ORCPT ); Wed, 29 Jun 2022 08:55:16 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 524FB2CCA4; Wed, 29 Jun 2022 05:55:14 -0700 (PDT) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.0.0) id 68f160c69678c1a0; Wed, 29 Jun 2022 14:55:12 +0200 Received: from kreacher.localnet (unknown [213.134.175.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 02DCA66C9F4; Wed, 29 Jun 2022 14:55:11 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Andy Shevchenko , john.garry@huawei.com, Greg Kroah-Hartman Subject: [PATCH] hisi_lpc: Use acpi_dev_for_each_child() Date: Wed, 29 Jun 2022 14:55:11 +0200 Message-ID: <12026357.O9o76ZdvQC@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.175.150 X-CLIENT-HOSTNAME: 213.134.175.150 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedrudegledgheejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepffffffekgfehheffleetieevfeefvefhleetjedvvdeijeejledvieehueevueffnecukfhppedvudefrddufeegrddujeehrdduhedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvddufedrudefgedrudejhedrudehtddphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohephedprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegrnhgurhhihidrshhhvghvtghhvghnkhhosehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohepjhhohhhnrdhgrghrrhihsehhuhgrfigvihdr tghomhdprhgtphhtthhopehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 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 --- 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; 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); } /*