From patchwork Wed Feb 28 11:28:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 207763 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3284741dyb; Wed, 28 Feb 2024 03:33:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX0e6zTKjox8O4aVPlDPYl19f9A412xFVY6/pMBMt8g5rFOz3g7peJNWm63A5YeK8TGPthFzaob8Y7eqyXxRwb08VN53w== X-Google-Smtp-Source: AGHT+IHZsxAiczULSl203KoQ8EX9PHJ9jhxv2bQ0ITbqIySG0VmxnFkoznIdNMe7g5jyMvU7qNrl X-Received: by 2002:a25:a307:0:b0:dcc:9f62:7520 with SMTP id d7-20020a25a307000000b00dcc9f627520mr2245985ybi.59.1709120009164; Wed, 28 Feb 2024 03:33:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709120009; cv=pass; d=google.com; s=arc-20160816; b=fQIVAY1YQi7cqpjEzhl+hrVtJFRhgdjpoijrp+riocZE+IJv3nZc51buuK1BcTsBjZ A6gLCO3j6/czd7p/15CATlFAbk3ZC/DXYPLpSaJcXkns7VmOQ/HFrkCVqph50hmNkxHZ 9HnhfSpYOqCAr7YIY3nmq4M8nmgzgP8ZdOwdO1Lcc86EhF4RXosP2fnnleWaXCpUALWL Fp40WxD/ShJ9O+b+ssvAnrtceTmhX5KXTrw2++pgIFNiKTMArLd0/ziKUtBqx0DQxtyu gdgzVHlBgwU/r0cySY7UMgbDtebn8lEslIZnDVCWCSeXocti+B69BveSt7lGyZxBPJyD w2iQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=c75kgKOiYHpbQtix7uno8/XdcHRwYzLdGlRcddNvHAw=; fh=FEGj322JUxHP58NgFBs9atrc2KpQCnFuCu2ueZtAhdY=; b=DcfHA/pbmatV9ZOiF7G7EAUGgZsWx5p6r6+v8BoAf7K75PbZwpcvoOsqRHAMnuKUOv asbjSxsQZjVdNHUVL4kCl/rVyuf1xHaLHOkSgOgBmC4vK1wQgCRUIuFBWNQz6ekZpI7r 6cjE0yfakwQJQKHe4hSKnN99qkCAkURUn3VSZO72PUm6t8Pg5pjRSgFTGSL/TuaHrl/O fnz8O9+wWn55RMRcg0h+DyCIIVAIevSukrRSUZ/xz9bBdof+vtT3MrQNbxg/9BIifhOO p/6ae02WANh8hxoKYMoWs1n/FAcSqG7bKuMiFSgrD7uKIDp3GXptUyoZ+CVYtzMeXRZE Kp3A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=dyEF1nRs; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-84891-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84891-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y4-20020ac87084000000b0042e7cdd139esi7352704qto.585.2024.02.28.03.33.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:33:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84891-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=dyEF1nRs; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-84891-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84891-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E0E7D1C222DF for ; Wed, 28 Feb 2024 11:33:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 75A7115A4A3; Wed, 28 Feb 2024 11:28:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="dyEF1nRs" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AA3D1420D0; Wed, 28 Feb 2024 11:28:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709119706; cv=none; b=gkY9Mr4zIO8PJpDOn9FteN9jFI2KHh4IbdgxXGKmn/35vNc1q+toULSIXt7tgPRVKHmfBLUxtc3wXPPRjm0Tc8YFGCKqi+qKHp2mnPwa9vod5UBhiX23NVl7ES6Hrio1UQgAY2yK3E6x1bVFUf5VHgHDvmiramuRlJOOl/xVCcs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709119706; c=relaxed/simple; bh=O3eMSu40fMZuZcdZREanAgltxZLpQq8CYwl9qWdWfIc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LZtdfExljw3shbonCWIFqqqywoSnp9NnQdR49FxNj40hKSgTSSMIrOGkU+cU4RfcAfXRM5IPWy04MDCg2YPtrkv+THe9Smvo5FhMBZcSeUG7AFWwVYQTahNJOh+WgKnrjesOq3VTwdEAsE4FhMdKTXVVLUQXwYKR9SXlSIYQ/xA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=dyEF1nRs; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 4D7B21BF20D; Wed, 28 Feb 2024 11:28:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709119701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c75kgKOiYHpbQtix7uno8/XdcHRwYzLdGlRcddNvHAw=; b=dyEF1nRs6W8USi7Wll44T3bf/F3aSNNi0evKR7LL09TL3L+d7KaIjAwLkPy0b0waIERjWj wt5ZrEPm5Mkg+/F/7u8JdxvE/doQuPzMkjadC6YtE0IgagJzdGKq8Oj8S1HUGwJKZRUpmx ZU/62WVI3i334NRCxpFrCU2lmmSg7JoBTarQI/NgP0M9TEM5CVFRcuzgJaXy8Ol3vFHFfW /7Sa2eChLSNQVk8qbg1J7jipIGn8MThz7Mehs0gqpsv8rJ5agzWrYoS9moaKwORgpojIqT lQcH7sy6eo6xK8RFCBkiQhFPxY0TjEaLZeSBVJ0Tz9RvPDDtSJEGWw+KSXsjCw== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Wed, 28 Feb 2024 12:28:13 +0100 Subject: [PATCH v2 15/30] gpio: nomadik: replace of_find_*() by bus_find_device_by_of_node() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240228-mbly-gpio-v2-15-3ba757474006@bootlin.com> References: <20240228-mbly-gpio-v2-0-3ba757474006@bootlin.com> In-Reply-To: <20240228-mbly-gpio-v2-0-3ba757474006@bootlin.com> To: Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Thomas Bogendoerfer Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, Gregory CLEMENT , Vladimir Kondratiev , Thomas Petazzoni , Tawfik Bayouk , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792142222316353745 X-GMAIL-MSGID: 1792142222316353745 Avoid OF APIs in the GPIO subsystem. Here, replace of_find_device_by_node() call by bus_find_device_by_of_node(). The new helper returns a struct device pointer. Store it in a new local variable and use it down the road. Signed-off-by: Théo Lebrun --- drivers/gpio/gpio-nomadik.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c index 9347c93af62c..f3ef3b4d08eb 100644 --- a/drivers/gpio/gpio-nomadik.c +++ b/drivers/gpio/gpio-nomadik.c @@ -483,17 +483,20 @@ struct nmk_gpio_chip *nmk_gpio_populate_chip(struct device_node *np, { struct nmk_gpio_chip *nmk_chip; struct platform_device *gpio_pdev; + struct device *gpio_dev; struct gpio_chip *chip; struct resource *res; struct clk *clk; void __iomem *base; u32 id; - gpio_pdev = of_find_device_by_node(np); - if (!gpio_pdev) { + gpio_dev = bus_find_device_by_of_node(&platform_bus_type, np); + if (!gpio_dev) { pr_err("populate \"%pOFn\": device not found\n", np); return ERR_PTR(-ENODEV); } + gpio_pdev = to_platform_device(gpio_dev); + if (of_property_read_u32(np, "gpio-bank", &id)) { dev_err(&pdev->dev, "populate: gpio-bank property not found\n"); platform_device_put(gpio_pdev); @@ -519,8 +522,8 @@ struct nmk_gpio_chip *nmk_gpio_populate_chip(struct device_node *np, chip = &nmk_chip->chip; chip->base = id * NMK_GPIO_PER_CHIP; chip->ngpio = NMK_GPIO_PER_CHIP; - chip->label = dev_name(&gpio_pdev->dev); - chip->parent = &gpio_pdev->dev; + chip->label = dev_name(gpio_dev); + chip->parent = gpio_dev; res = platform_get_resource(gpio_pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(&pdev->dev, res); @@ -530,7 +533,7 @@ struct nmk_gpio_chip *nmk_gpio_populate_chip(struct device_node *np, } nmk_chip->addr = base; - clk = clk_get(&gpio_pdev->dev, NULL); + clk = clk_get(gpio_dev, NULL); if (IS_ERR(clk)) { platform_device_put(gpio_pdev); return (void *)clk;