From patchwork Tue Nov 15 23:12:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13044281 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 5F0A0C433FE for ; Tue, 15 Nov 2022 23:14:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:Cc:To: From:Date: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=y7yKb12hCkdXCwOkD2st2LKF6e6D0Z5fpamytEMHMCw=; b=jA8ZSl6ypSGn7g bgZ7ONoh54Uub0Ygs3EycWTEdxOMExsaZ33jpJWxNF3aQXyhxCW92DBbmlPN1eZZ8MERgF/Ypji84 TVvivX5a3K7XxshJdGsgwE/UwihCGWwp0BiUTYAdumce8CwaI0qlo7dw2sUQ+J2g3nnV56F98MISv EkDKa1NMTiJ+jmQspZ1D1NFegm2RJ3Aim6ZmJFQarpIO0/NCpsLL+5k1t4trTvqZGMvKA4BOukVo5 IxTyIKqRr8tnWd5W0GnP77q8w2NGqlm+A0ulNJ/WiyPUhcH7UxL4OSwUTDQDXotcbmQyZlPBbzdYU HluzzZEioJZITFnvK/Jw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ov56o-00Fa4i-3J; Tue, 15 Nov 2022 23:12:50 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ov56k-00Fa4A-W6 for linux-arm-kernel@lists.infradead.org; Tue, 15 Nov 2022 23:12:48 +0000 Received: by mail-pj1-x102e.google.com with SMTP id b1-20020a17090a7ac100b00213fde52d49so614500pjl.3 for ; Tue, 15 Nov 2022 15:12:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=uUrJd0ClH04zE7+FZG1iIcCrqg/chKo2CqMXeBC8xoA=; b=i+IoW6ryNF6E4I6qeDPuLgcJfpSq0zi2D3p+Hnv+sQV3oJTr8uc/R3IW7WC1Rs3o5j WcwZAx+NRW+4JWbYwV9KIhwfmRMOlLsMX7c4ZGRDGENMBfhsOMRHTnVcz/TgphjCF5il Xr8klWNHfFFFhLyvgSOnD3TOp/9Z3CyYIX2k8uVSfdIKvmVSrlIOojolq1ochmMLvqbC ZGllTLaYPa4BpyWPD2D8XMzN3yFlyK5AH29yMy3WN1o0m/JGS682yPme9C0/zlYKzjy7 gCXHDcd2HPUdho5WQNidB7g6l4uNyepJXNwHc6lLqXrJ5UljhFhEdjZILg53birjyGFQ ol/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uUrJd0ClH04zE7+FZG1iIcCrqg/chKo2CqMXeBC8xoA=; b=tC27hWndn6H6ryUeZJS9otcfuLsn438lYdSkJDQ+xsa8l4bmMZnie/m8FKYtg0xbaC lGlTWrFS7KxvSfwjk38ABVowPUmhpY7U++jBn7Yx3zgA0sfXLS4bWy9uUb+QWh5nDZWg GtS8Vk6mCK92cCAspwP7sgR9w7UO6hHVy01H8/EW2w+BrCCQxP/RfSUyfef3m22apwOY colicT3SH+K27GJq5wn1slx219yDcW4NkKs705v0Dq5upXc2appZhS29vDLw0ytq1Ukj 2hGkfHLH/1oZmeiMPryo83hrRVvS+zm8xSGDXaDpJPtAIBBoItKoCx1swKg44750nxkL ZyNA== X-Gm-Message-State: ANoB5pmbMlO2Zk+SIquhsHUYjb2fzdpCHXf6KN/blgMwGN51lfATQCHn mkaBoRaMQSsQITjXXPUm2H8= X-Google-Smtp-Source: AA0mqf530va7GXwyAwZ4xfIPh6VmEBLttOHSILPNRav7Sbl6Ds91ZfVwXnno+LL4ZpnVkM+K5MqpBg== X-Received: by 2002:a17:902:a70e:b0:185:3659:1ce9 with SMTP id w14-20020a170902a70e00b0018536591ce9mr6056420plq.26.1668553965143; Tue, 15 Nov 2022 15:12:45 -0800 (PST) Received: from google.com ([2620:15c:9d:2:2d36:e9a0:170b:669f]) by smtp.gmail.com with ESMTPSA id v7-20020a17090a458700b001fd6066284dsm107286pjg.6.2022.11.15.15.12.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 15:12:44 -0800 (PST) Date: Tue, 15 Nov 2022 15:12:41 -0800 From: Dmitry Torokhov To: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] ARM: mvebu: switch to using gpiod API in pm-board code Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221115_151247_055698_0D992DA4 X-CRM114-Status: GOOD ( 15.33 ) 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 switches PM code to use the newer gpiod API instead of legacy gpio API that we want to retire. Signed-off-by: Dmitry Torokhov Reviewed-by: Andrew Lunn --- arch/arm/mach-mvebu/pm-board.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/arch/arm/mach-mvebu/pm-board.c b/arch/arm/mach-mvebu/pm-board.c index 7fa1806acd65..beec22e17e89 100644 --- a/arch/arm/mach-mvebu/pm-board.c +++ b/arch/arm/mach-mvebu/pm-board.c @@ -8,19 +8,19 @@ */ #include -#include +#include +#include #include #include #include #include -#include #include #include "common.h" #define ARMADA_PIC_NR_GPIOS 3 static void __iomem *gpio_ctrl; -static int pic_gpios[ARMADA_PIC_NR_GPIOS]; +static struct gpio_desc *pic_gpios[ARMADA_PIC_NR_GPIOS]; static int pic_raw_gpios[ARMADA_PIC_NR_GPIOS]; static void mvebu_armada_pm_enter(void __iomem *sdram_reg, u32 srcmd) @@ -90,27 +90,17 @@ static int __init mvebu_armada_pm_init(void) char *name; struct of_phandle_args args; - pic_gpios[i] = of_get_named_gpio(np, "ctrl-gpios", i); - if (pic_gpios[i] < 0) { - ret = -ENODEV; - goto out; - } - name = kasprintf(GFP_KERNEL, "pic-pin%d", i); if (!name) { ret = -ENOMEM; goto out; } - ret = gpio_request(pic_gpios[i], name); - if (ret < 0) { - kfree(name); - goto out; - } - - ret = gpio_direction_output(pic_gpios[i], 0); - if (ret < 0) { - gpio_free(pic_gpios[i]); + pic_gpios[i] = fwnode_gpiod_get_index(of_fwnode_handle(np), + "ctrl", i, GPIOD_OUT_HIGH, + name); + ret = PTR_ERR_OR_ZERO(pic_gpios[i]); + if (ret) { kfree(name); goto out; } @@ -118,7 +108,7 @@ static int __init mvebu_armada_pm_init(void) ret = of_parse_phandle_with_fixed_args(np, "ctrl-gpios", 2, i, &args); if (ret < 0) { - gpio_free(pic_gpios[i]); + gpiod_put(pic_gpios[i]); kfree(name); goto out; }