From patchwork Mon Sep 30 14:48:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13816576 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 5FAB1CE8355 for ; Mon, 30 Sep 2024 14:51:53 +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:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HfRPqMQ2YRL7cytKg67BDcrJy4YgVjPhIG+hcafClNU=; b=oKrCkYA6WXQdkvtkcV0bAbugAT lO9KlnsP1E6NaJc15eYsfTyYFiKMuTZ8RLQZuZCv/ruozmSs03FuOrdC25iJg5Slrc6sgWptmIcY+ UM+h96g8ELfge01pCdhtd2jiD6qyi4mz3DTV8sDimvEpaqW/GvelPTd6/kSTaGkiDlbitEoyZuYok fL/i7G9UN57Ow89vAgIKpyr32MYJVZsp3hSaR7rho5KwEQJv8f7UXwzEFxalvCS1RCDJXXCaoa4YB ak6s8PXPxwRJwL15TRl+541e0mM9QuS4erf1oJZEM7UhMbPih0Rmc1qCIg2tWiLfFltR05jyKm8er YeJ96eUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svHkW-0000000HZEA-0VUr; Mon, 30 Sep 2024 14:51:44 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svHh9-0000000HYQK-2AC0 for linux-arm-kernel@lists.infradead.org; Mon, 30 Sep 2024 14:48:16 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-37cc5fb1e45so2964996f8f.2 for ; Mon, 30 Sep 2024 07:48:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1727707693; x=1728312493; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HfRPqMQ2YRL7cytKg67BDcrJy4YgVjPhIG+hcafClNU=; b=qwjUsTFMrtsq8U6guCUYBMRL/P/elj6RDwgbBHvicbL9ZGpsMs34my+RMw3ytyr9sR lIYSLc/IGX0xS8HDGqSHzXvyYEMD+yfgJr0PlH2xlo/zrbMO06VUUVTcIeThJh2B63y/ pH33JD1dbBjsya0VCdb3JtDJ91635AOBvJOGYtB4ssB2iPKbxYrRVSiihhHSKaD3Idj6 69BT984Rsxfh5XUqInD1iJsGsUM6KcfbBtPqq3yHmeNcBNgJUUeoJBn8WJjipIg4+B3K lxzEMu/khiSqbuycD7jZ6Bga+HBZH0ITU225jXvo0Felb13oCPG11skRQxVm35jrbAUD LLEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727707693; x=1728312493; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HfRPqMQ2YRL7cytKg67BDcrJy4YgVjPhIG+hcafClNU=; b=rmKtKMKdkGxPhffGdwKYExbHkoIIN22kU7cVD30gDKJ9XoxVJUN88k2hsgSNdEOl/E kNfH/RzXavFKP2FUIgVIZbKmnzCia7l09XkF522DNamVIjWWTvQh3tdadF/+PrP3oTB8 EkijEAvZuaQpnUJz6xcOBWPsTSpoNzYRjVHbcig65Msgnnky3T6+sz17adbA1hQUrIOQ TbWe4QY23h5yIyx948zVOabzPDU2N7XzXkOZCNkOdlq/O2ofku/TqVz698prnGs3IXOF /uQZB4nSvB6m7FT8Bozwlcgjln/mzSfN+bV0bCfSzNT4tmtTg7vUMk8ooNLuy8sWh+Ng HDAA== X-Forwarded-Encrypted: i=1; AJvYcCVokbbL584IJzB7e/aKjeEwYAGIieZLXharp1G+F1hOy8eT6rfxUXJvv1CG+rPM7lcNM/rDT/Vbf6AzXpYcdJZ9@lists.infradead.org X-Gm-Message-State: AOJu0YxQffk3RVWWVwGQ1YkmuJ0Wwp9TTzAAXX62lHcfmi6vZNvQidwZ o5Xn44pxBYTyOV/jyGmFE59DdLVmYctdT7z7zE/I3a7XQ0i5cuuv4e0bA7b3UzE= X-Google-Smtp-Source: AGHT+IFS82UmXpIStxa6SqM6CC7PH3OIn3uYOLSrafHNIkj5K/JZaHIK6K+sosLECIqdEFs+/WLaOw== X-Received: by 2002:a5d:644c:0:b0:37c:c4b4:339e with SMTP id ffacd0b85a97d-37cd5acba99mr8323137f8f.25.1727707693439; Mon, 30 Sep 2024 07:48:13 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:8791:e3e5:a9ca:31a6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37cd566a41fsm9241505f8f.45.2024.09.30.07.48.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 07:48:12 -0700 (PDT) From: Bartosz Golaszewski To: Linus Walleij , Shubhrajyoti Datta , Srinivas Neeli , Michal Simek Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [PATCH 3/3] gpio: xilinx: use generic device properties Date: Mon, 30 Sep 2024 16:48:04 +0200 Message-ID: <20240930144804.75068-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240930144804.75068-1-brgl@bgdev.pl> References: <20240930144804.75068-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240930_074815_591040_EC50C544 X-CRM114-Status: GOOD ( 17.39 ) 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 From: Bartosz Golaszewski OF-specific routines should not be used unless necessary. Generic device properties are preferred so switch to using them in the driver code. Signed-off-by: Bartosz Golaszewski Acked-by: Michal Simek Reviewed-by: Linus Walleij --- drivers/gpio/gpio-xilinx.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c index d99824d42c77..41c552a58059 100644 --- a/drivers/gpio/gpio-xilinx.c +++ b/drivers/gpio/gpio-xilinx.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -564,7 +563,6 @@ static int xgpio_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct xgpio_instance *chip; int status = 0; - struct device_node *np = dev->of_node; u32 is_dual = 0; u32 width[2]; u32 state[2]; @@ -579,7 +577,7 @@ static int xgpio_probe(struct platform_device *pdev) platform_set_drvdata(pdev, chip); /* First, check if the device is dual-channel */ - of_property_read_u32(np, "xlnx,is-dual", &is_dual); + device_property_read_u32(dev, "xlnx,is-dual", &is_dual); /* Setup defaults */ memset32(width, 0, ARRAY_SIZE(width)); @@ -587,14 +585,14 @@ static int xgpio_probe(struct platform_device *pdev) memset32(dir, 0xFFFFFFFF, ARRAY_SIZE(dir)); /* Update GPIO state shadow register with default value */ - of_property_read_u32(np, "xlnx,dout-default", &state[0]); - of_property_read_u32(np, "xlnx,dout-default-2", &state[1]); + device_property_read_u32(dev, "xlnx,dout-default", &state[0]); + device_property_read_u32(dev, "xlnx,dout-default-2", &state[1]); bitmap_from_arr32(chip->state, state, 64); /* Update GPIO direction shadow register with default value */ - of_property_read_u32(np, "xlnx,tri-default", &dir[0]); - of_property_read_u32(np, "xlnx,tri-default-2", &dir[1]); + device_property_read_u32(dev, "xlnx,tri-default", &dir[0]); + device_property_read_u32(dev, "xlnx,tri-default-2", &dir[1]); bitmap_from_arr32(chip->dir, dir, 64); @@ -602,13 +600,13 @@ static int xgpio_probe(struct platform_device *pdev) * Check device node and parent device node for device width * and assume default width of 32 */ - if (of_property_read_u32(np, "xlnx,gpio-width", &width[0])) + if (device_property_read_u32(dev, "xlnx,gpio-width", &width[0])) width[0] = 32; if (width[0] > 32) return -EINVAL; - if (is_dual && of_property_read_u32(np, "xlnx,gpio2-width", &width[1])) + if (is_dual && device_property_read_u32(dev, "xlnx,gpio2-width", &width[1])) width[1] = 32; if (width[1] > 32)