Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4570269rwl; Tue, 28 Mar 2023 08:31:24 -0700 (PDT) X-Google-Smtp-Source: AKy350bDebCjf9nQL1ms/y3n0qLE5TiMGV16A4PPnDMNgzotUjOPLrY/N2ReLbYIhbCiW28N0cGr X-Received: by 2002:a17:906:7243:b0:8f3:dc49:d8eb with SMTP id n3-20020a170906724300b008f3dc49d8ebmr17032296ejk.71.1680017484283; Tue, 28 Mar 2023 08:31:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680017484; cv=none; d=google.com; s=arc-20160816; b=yb22SNA0XSKTTdTS5bbAOwQAM+eUHCtDSIcNggCIP+zoh+fNZ+Je4SW5xI68wbVBKT j/AiQPz4L2dyl+f9ut9Qo8ibTGFO+k2IQpg2r7vkyfU16yHBnVTKBs3uMQMfdZy/W7+o ruMYUvxnLnZfnm3Zy+HBIw4/Lj1xohJi8crAR62ekIkmhP/7D2I/lAIn03GX6dYn3oHa V4BHoFvFeojB4Q1wm9mic3+SxcmR29w6SgOo60FtArmCTkG6PW/5I3lFH8LjzhUkkiLZ D8XwQHvfNk+5XydKsDoKmJjkDRZz7ShOjH6rcXpJZeshK1AZ5SR6i8QgVEhUcb/nYIpZ x95A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=NbTGN4AmHnIHsx21UwKF1mcC0glvE7lkzW1Nfz99yWw=; b=Zr2NsXTdouxlwhzjKupsou3mONeSIAO683zsqizkNCyWlGfd4ASIfnm9eNe1pGeuLd r4tKHY85Yil6sxR71Nrj4DsBDNis/VejWrXorkJXTeDT1c8ARWLsOI1qxo6do2wmELYT 5KuDKsGQQnPMD5ZWHYrqKrc+zKPWgK58GD867TitZYz9flZZ511MlG54SkwUZTw5hF2M Lbf2cONemyfxN3Kc6ykzxvCF521qHXkyzSk74LIE8Sf9sb5eEnZr0+O/TOfqW16qQIS6 uWN815DW10kfckvqAMK7TOPpr4h4ZjR84o2UIVd3gXRvBc233wcXcaLfFk8ZM5qblTYF W0Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MHUZOeLX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p9-20020a1709061b4900b0092fe3fdc1fdsi28944922ejg.605.2023.03.28.08.30.56; Tue, 28 Mar 2023 08:31:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MHUZOeLX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232963AbjC1P1B (ORCPT + 99 others); Tue, 28 Mar 2023 11:27:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232711AbjC1P0g (ORCPT ); Tue, 28 Mar 2023 11:26:36 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A73FE10252 for ; Tue, 28 Mar 2023 08:25:33 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id v1so12654867wrv.1 for ; Tue, 28 Mar 2023 08:25:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680017116; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=NbTGN4AmHnIHsx21UwKF1mcC0glvE7lkzW1Nfz99yWw=; b=MHUZOeLXGOV7LXvnYEiNrrODlRDpNM21xPxy5cKPf2PteIGaDuQKEWCwHxrWHxOGz2 Bmb02PWAcdS1KBv2nygk5V1+U/rxsiGSN44rAxmRs9+RxGHdsqQ4P9akZHkp6fFaYO6K 3zoZ/MYIiLRXrxp+HpgItn9LkMR8JW6RiA9wJdYtKUBib7LrxflKfkI0HZpVyDcyoGg+ iO4zzn0bc/In/hxDslvhQGbL5FY45rGz5ttEVV5Qh2LQe2dmENUFFQdsQ6CRPfRswswH paVcEf0TA55Iv/VBabedNkB26OmwSUEOijustAQtvTYAYPtj9HQOecZyuvQjMZdMV7ms AmpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680017116; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NbTGN4AmHnIHsx21UwKF1mcC0glvE7lkzW1Nfz99yWw=; b=4hqkjCv3LeOEWeZ33NdkvWhcSyzuQQYysl3yT3EsDjwLU0MllXfCO8KyXKNMw5qECX +6pvj25K0d/m9dUT5M19dgEftosb59YPQLxG4p7I2/DLR8dJuHSwBpf2AeXNM0DyGw6n 13ECxDfhvWP2avM1q+lsXFbWj3BI/bdcNj3BSIsdZXuXtunD1HqD5BVzaIw9EeA2m2ko 4VpE8XZUa63B5emj8mxt3piIFpUfXVzGLj5aqCwjLiM/NIvX9CBMH8WVwBTzCSVHTJxw dfsSGogh4oSRlMBa6L8mAY34G+fxx/6lGQ1yZh3mtl+iV1Us1balVi8SvCwGzxVBzQPI 9kWA== X-Gm-Message-State: AAQBX9cpRsPHNi/hM43teTs9ztcqztSxRzvfIbqGrZbrkZ7ZvOLaXYOi huCDEc8nHz06qgE30qreI9yAsg== X-Received: by 2002:a5d:6645:0:b0:2d1:481d:5863 with SMTP id f5-20020a5d6645000000b002d1481d5863mr11107093wrw.11.1680017116682; Tue, 28 Mar 2023 08:25:16 -0700 (PDT) Received: from [192.168.2.107] ([79.115.63.91]) by smtp.gmail.com with ESMTPSA id e11-20020a5d65cb000000b002c55de1c72bsm27838248wrw.62.2023.03.28.08.25.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Mar 2023 08:25:16 -0700 (PDT) Message-ID: Date: Tue, 28 Mar 2023 16:25:15 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH -next] spi: xilinx: Use devm_platform_get_and_ioremap_resource() Content-Language: en-US To: Yang Li , broonie@kernel.org Cc: michal.simek@xilinx.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20230328061524.77529-1-yang.lee@linux.alibaba.com> From: Tudor Ambarus In-Reply-To: <20230328061524.77529-1-yang.lee@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/28/23 07:15, Yang Li wrote: > According to commit 890cc39a8799 ("drivers: provide > devm_platform_get_and_ioremap_resource()"), convert > platform_get_resource(), devm_ioremap_resource() to a single > call to devm_platform_get_and_ioremap_resource(), as this is exactly > what this function does. > > Signed-off-by: Yang Li > --- > drivers/spi/spi-xilinx.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c > index 5dd3d1901412..8e6e3876aa9a 100644 > --- a/drivers/spi/spi-xilinx.c > +++ b/drivers/spi/spi-xilinx.c > @@ -440,8 +440,7 @@ static int xilinx_spi_probe(struct platform_device *pdev) > xspi->bitbang.txrx_bufs = xilinx_spi_txrx_bufs; > init_completion(&xspi->done); > > - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > - xspi->regs = devm_ioremap_resource(&pdev->dev, res); > + xspi->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); > if (IS_ERR(xspi->regs)) > return PTR_ERR(xspi->regs); > So we keep the local var res just to print its value? Wouldn't have been better to have something like: diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c index 1411548f4255..693be1eacaca 100644 --- a/drivers/spi/spi-xilinx.c +++ b/drivers/spi/spi-xilinx.c @@ -391,7 +391,6 @@ static int xilinx_spi_probe(struct platform_device *pdev) { struct xilinx_spi *xspi; struct xspi_platform_data *pdata; - struct resource *res; int ret, num_cs = 0, bits_per_word; struct spi_master *master; bool force_irq = false; @@ -440,8 +439,7 @@ static int xilinx_spi_probe(struct platform_device *pdev) xspi->bitbang.txrx_bufs = xilinx_spi_txrx_bufs; init_completion(&xspi->done); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - xspi->regs = devm_ioremap_resource(&pdev->dev, res); + xspi->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(xspi->regs)) return PTR_ERR(xspi->regs); @@ -493,7 +491,7 @@ static int xilinx_spi_probe(struct platform_device *pdev) return ret; } - dev_info(&pdev->dev, "at %pR, irq=%d\n", res, xspi->irq); + dev_info(&pdev->dev, "irq=%d\n", xspi->irq); if (pdata) { for (i = 0; i < pdata->num_devices; i++) --- I would get rid of printing xspi->irq too, as I don't see any benefit in printing it, but that would be for another patch, as it is a different logical change.