From patchwork Tue Aug 20 19:02:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13770545 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 55B79C3DA4A for ; Tue, 20 Aug 2024 19:03:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To: Content-Transfer-Encoding:Content-Type:MIME-Version:Message-Id:Date:Subject: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=A3q0QmZjXATABQCpiFauAPddapHrIJAKoBzSHmYfFnM=; b=Fq3IqZTaaNrA8V fZWHcJG2S/Z/CsCQlSQvtybvGLginSBCxqeUPONM+y4laQw9DRLe39y4Nu7lcoIkKUSZYQPxkeMR1 p0BUS0iHDUkF6B1VqMyUsM9ilavnymhJMBfNdKNYQ9MCWbNehk7xsOqqKM9K5xEE17IEUVlk/2m9Y ncCxuA2yAAsvDEmHVYDerSPN3cdxeSMyXtdvl0Hk1WULsSWGD4feXJFFLueBIi72Dh6nZe1sEgZy+ bj8l/7Qg7YlLToJjfvE7WdfygguH/efhLSeufixVRotohpjbLGGVssLqGW7cXi563qyHqMVCKR4EA lAWZsg2P5DGRmogrR7fg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgU8U-00000006PCO-45W9; Tue, 20 Aug 2024 19:03:18 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgU7n-00000006P1n-1BBj for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2024 19:02:36 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4281ca54fd3so47385565e9.2 for ; Tue, 20 Aug 2024 12:02:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724180553; x=1724785353; darn=lists.infradead.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=A3q0QmZjXATABQCpiFauAPddapHrIJAKoBzSHmYfFnM=; b=CIR0/sMPtLRxhkyPtyxUGf6oFUE4MDdegzI6JP4mlump9qOpIjR7Q0ACPR+LshlnB7 CONoyRLK/64HVgrN8yUf53jNymzBjQ18Y3rET/1bu1nn335ujiWkvaDMa9vByculnee3 tux4qSsYtiS/w2uQie0MNgmjfIT9hGQ5y8wiPgZeY8zQH9WwsfQL2bky+g70705yZn0x rtZZzH3dyaKqP9BBSZJG77wu5fRnrn1LB76ObWtd/bYq12RJ49b4UrFFzAIR7v5AUeAE aocCxK5+YQN1vGMflIyWhcm/N1IKJeZUJZaS7LMlRtjeNFpU4mnv3XbiHG0zKg6CGtA7 9XyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724180553; x=1724785353; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=A3q0QmZjXATABQCpiFauAPddapHrIJAKoBzSHmYfFnM=; b=cO2lkKXji2q0j1A+iPREzwHfyHRKumj+c7/TB1gQLysH5Vtt68dzskKgjkILCEyFFl qmP6tpc8vAMxfhVy2G5CvGFbfMGvQZOrcQ0qVSpRQCVMBNtyBGi/UPUn8ezRWtKobUdL 2SENqKFvSAVbb5f7vtHHkhnuiiAHsqwPn8+6i3DFH3HtQ4bCquecsqAwGsVhg5ldMQCZ Rjovb9vcO1ZDzs2Sb+2lEwowDUDBueT77GUI70CMoYasppsJO2/yCIiQm+vVlFTXxPb1 sY9rCQki/Wiv3LsgqKaKhYynfJNfKmiXScbKyR6b9VzJUAdcHo9DGXzSvXq37J7hvRiA VNfg== X-Forwarded-Encrypted: i=1; AJvYcCU5nBngffEJH8MGv0NsSKvGRDQniult4bGCkPxk7WvI0quEQ/XVkEw3R8qZu2hkQyofdY0eIeRvghK1q54jKEy0@lists.infradead.org X-Gm-Message-State: AOJu0YxeWkb1mwlBXJ7ihjyoc6MrdTyJ1BEpBQlxCelNsIkC0P5ecqt8 E7BiMJ9HfNOegOV6VfY79eecYiTi9sm0JLFQgP8NRmL9bTKs5VDc X-Google-Smtp-Source: AGHT+IG4q8fUhcsVqTdr2NMP7R1QVeLtXLBHIx2DA5voz9952t/GK1TXQt4v/b247do24i7TpJIkvA== X-Received: by 2002:a05:600c:34c5:b0:426:60b8:d8ba with SMTP id 5b1f17b1804b1-42abd24578amr2080735e9.28.1724180552559; Tue, 20 Aug 2024 12:02:32 -0700 (PDT) Received: from [127.0.1.1] (84-115-213-37.cable.dynamic.surfer.at. [84.115.213.37]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-371898497ffsm13685375f8f.27.2024.08.20.12.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 12:02:32 -0700 (PDT) From: Javier Carrasco Subject: [PATCH v3 0/2] use device_for_each_child_node_scoped to access device child nodes Date: Tue, 20 Aug 2024 21:02:25 +0200 Message-Id: <20240820-device_child_node_access-v3-0-1ee09bdedb9e@gmail.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAEHoxGYC/33NwQ6CMAyA4VchOzuzDbahJ9/DGDK7DpYAM5shG sK7O/DCRY9/036dScLoMZFzMZOIk08+jDnKQ0GgM2OL1NvcRDBRMS0ktXkJsIHO97YZg8XGAGB KtKqELMsTZ0Y5ks8fEZ1/bfT1lrvz6Rnie/s08XX6RWvGf6MTp4xa64zgd3TKiUs7GN8fIQxkR Sexh+o/kMiQAy01gFZKsj20LMsHJzHXSwkBAAA= To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Michael Hennerich , Lars-Peter Clausen , Jonathan Cameron , Anand Ashok Dumbre , Michal Simek , Sakari Ailus , Pavel Machek , Lee Jones Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-leds@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1724180551; l=2203; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=6GZ6ktaBDlFlf5xXqnMkB8d+NP0luaR3DCxSIB4FI7c=; b=Qpdn3Bzh98qlDzUycuq/wUsMzo820/JbaAFsA/3fKYUZGkvqWixj2+h/ZSIJNcNOLkr53+22e Lv7Ufadm3YIA2UzK47RtOYw1lCDc0eCZ15BViPuso1BoPF/zbwhdqry X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240820_120235_375033_D45E606B X-CRM114-Status: GOOD ( 12.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This series removes accesses to the device `fwnode` to iterate over its own child nodes. Using the `device_for_each_child_node` macro provides direct access to the device child nodes, and given that in all cases they are only required within the loop, the scoped variant of the macro can be used. It has been stated in previous discussions [1] that `device_for_each_*` should be used to access device child nodes, removing the need to access its internal fwnode, and restricting `fwnode_for_each_*` to traversing subnodes when required. Note that `device_for_each_*` implies availability, which means that after this conversion, unavailable nodes will not be accessible within the loop. The affected drivers does not seem to have any reason to iterate over unavailable nodes, though. But if someone has a case where the affected drivers might require accessing unavailable nodes, please let me know. Link: https://lore.kernel.org/linux-hwmon/cffb5885-3cbc-480c-ab6d-4a442d1afb8a@gmail.com/ [1] Signed-off-by: Javier Carrasco --- Changes in v3: - leds-as3645a: swap the parameters in as3645a_parse_node() to have dev at the beginning. - Rebase onto next-20240820, drop upstreamed patches (changes for coresight-cti-platform). - Link to v2: https://lore.kernel.org/r/20240808-device_child_node_access-v2-0-fc757cc76650@gmail.com Changes in v2: - Rebase onto next-20240808, drop upstreamed patches (changes for ad7768-1) - xilinx-ams.c: drop fwnode_device_is_available(child) (implicit in the loop). - Link to v1: https://lore.kernel.org/r/20240801-device_child_node_access-v1-0-ddfa21bef6f2@gmail.com --- Javier Carrasco (2): iio: adc: xilinx-ams: use device_* to iterate over device child nodes leds: as3645a: use device_* to iterate over device child nodes drivers/iio/adc/xilinx-ams.c | 15 +++++---------- drivers/leds/flash/leds-as3645a.c | 8 +++----- 2 files changed, 8 insertions(+), 15 deletions(-) --- base-commit: bb1b0acdcd66e0d8eedee3570d249e076b89ab32 change-id: 20240725-device_child_node_access-442533910a6f Best regards,