From patchwork Tue Oct 19 18:05:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 12570889 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE062C433EF for ; Tue, 19 Oct 2021 18:07:37 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 7DE8A61057 for ; Tue, 19 Oct 2021 18:07:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7DE8A61057 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=usp.br Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject: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=hSFtCrEU8wrK7JLOA35LzKP3ZSbIhlpnMAACG0yFXFw=; b=ND35gChtKUREQt ac7anT8o7gJJsrpeahUdvJPzs/UfAb6Lzh7KR2emezpRSvYiVhAV/Nq0AYrJyMoOiqYz4mvW9unMG txMfwqEDsuqtB+dzNuW8NgwgiF4ZGVECGQdohwiHd7Zt/OnZEHiAuKhDHdAwex4wAQzK5AMc0N6DR 27IEqKPENtZcHNL2H/PKR/GGPGJMI6wYIo0UfxXSQ+aIRTxcWNmO11XDlRflEZMl0cJhmFk9XOA6f mv9Rui4328nCRLOe8pa3ZcNoL+g05BZehL4imtau64eN74H+j5+e2W988HX3Rb27vzBc1TvWOOUqg a32FTVMawZj2NShKpOyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mctUh-002M8b-9a; Tue, 19 Oct 2021 18:05:48 +0000 Received: from mail-ua1-x932.google.com ([2607:f8b0:4864:20::932]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mctUS-002M5F-IJ for linux-arm-kernel@lists.infradead.org; Tue, 19 Oct 2021 18:05:34 +0000 Received: by mail-ua1-x932.google.com with SMTP id i22so1585132ual.10 for ; Tue, 19 Oct 2021 11:05:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=usp.br; s=usp-google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding; bh=LZblGBEcV+z39zPvty7ihBI2lmiyKfXO/4oZiKDvD8w=; b=gp0TVVXFFXog++jexI6vf7H1kvoZqWtsZmSA4mni1+cC2qXCqxFV3vJQblzZD2+T7a 54NPECLaj/CSKgQd72a1OGsel5GycK2NTFxbk25CJFWCmBME4ISIGuewTcTkYGvRwb7x y4ZHPNVKvPJNw9hfx7wRRmKykA6WmTjueg15qL54ExyftJW+sUk87g/gQBekd9Sn9ujK BqPvFXLiZ3wDVgzjiKUIQL+HgolSrfG8NqvfLOG86Rab/6EQ7cr9B5BZFBNt/Jsp/VV0 2DiJEhAaYqvm9nvY1itt63w3UMO/kgcbMntWWgR8f1gVm2qZj3orS3qbo67SK/K62wyG uhRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding; bh=LZblGBEcV+z39zPvty7ihBI2lmiyKfXO/4oZiKDvD8w=; b=3oPilS10W+tzwQ4iYqgNeRf+py9Lcg8/tXF7pcUx6oG/ViflL+wAOiOfNuwsxz/+C+ lhHV3a4GD/BjxRz1Vy8vX1YK6YNjlEIN8fdvWwAazZsJ3p6U6JIrESn5oOesPf9DYvLu rDtwN/HK3IOucyG2HhGm5m9ZzT+59rPKaMFbDy2hry6vTDDLFOZEozCG4jTlozHFdbF3 1qtgn1hLhsOHL+b2mZqDZyin5g0FtrPqrjAqY8BFJkP386CLSKPd6KEljLrL2OLtbDsL 2UtyuuGRqjOCGjXvcKwNDQtni78jr2lWBnyuwM1vEpdjR4mPap3Tx8sXmDAwgMGpf+Ay iVtg== X-Gm-Message-State: AOAM533IDXSjrd/oOhukmEPEKmoV06EhRZHX+7wsEefFLhMoDaH6L6CS kpa939ymNWsFh5ke5thBMoOuuA== X-Google-Smtp-Source: ABdhPJyWRGxvI6n597Rj04qC2bD57q/4dCu6jcpuTCHt/0/QzTwvtQ3yQNIzN+7g6PfIW3DK3rUE/w== X-Received: by 2002:ab0:684f:: with SMTP id a15mr1675535uas.142.1634666729645; Tue, 19 Oct 2021 11:05:29 -0700 (PDT) Received: from fedora ([187.64.134.142]) by smtp.gmail.com with ESMTPSA id u7sm11325989uaa.14.2021.10.19.11.05.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Oct 2021 11:05:29 -0700 (PDT) Date: Tue, 19 Oct 2021 15:05:24 -0300 From: =?iso-8859-1?q?Ma=EDra?= Canal To: broonie@kernel.org, radu_nicolae.pirea@upb.ro Subject: [PATCH] spi-at91-usart: replacing legacy gpio interface for gpiod 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-20211019_110532_660439_5725BA63 X-CRM114-Status: GOOD ( 14.85 ) 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: , Cc: alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org, ludovic.desroches@microchip.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Removing dependency of linux/of_gpio.h and replacing it for linux/gpio/consumer.h Signed-off-by: MaĆ­ra Canal --- drivers/spi/spi-at91-usart.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/drivers/spi/spi-at91-usart.c b/drivers/spi/spi-at91-usart.c index 8c8352625d23..9cd738682aab 100644 --- a/drivers/spi/spi-at91-usart.c +++ b/drivers/spi/spi-at91-usart.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include @@ -482,29 +482,12 @@ static void at91_usart_spi_init(struct at91_usart_spi *aus) static int at91_usart_gpio_setup(struct platform_device *pdev) { - struct device_node *np = pdev->dev.parent->of_node; - int i; - int ret; - int nb; - - if (!np) - return -EINVAL; - - nb = of_gpio_named_count(np, "cs-gpios"); - for (i = 0; i < nb; i++) { - int cs_gpio = of_get_named_gpio(np, "cs-gpios", i); + struct gpio_descs *cs_gpios; - if (cs_gpio < 0) - return cs_gpio; + cs_gpios = devm_gpiod_get_array_optional(&pdev->dev, "cs", GPIOD_OUT_LOW); - if (gpio_is_valid(cs_gpio)) { - ret = devm_gpio_request_one(&pdev->dev, cs_gpio, - GPIOF_DIR_OUT, - dev_name(&pdev->dev)); - if (ret) - return ret; - } - } + if (IS_ERR(cs_gpios)) + return PTR_ERR(cs_gpios); return 0; }