From patchwork Tue Oct 25 09:02:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10626 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp892591wru; Tue, 25 Oct 2022 02:09:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Kkj1wdoxpOh/PQv3fTanwV4v78Q6s9mVzt5xPk3PFTeXK+9l574/WRfXbeVNNk6WIL+Tm X-Received: by 2002:a17:907:8a23:b0:78d:b042:eece with SMTP id sc35-20020a1709078a2300b0078db042eecemr30251928ejc.494.1666688983710; Tue, 25 Oct 2022 02:09:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666688983; cv=none; d=google.com; s=arc-20160816; b=thfty4gtlnRJxffp10ZLHYJjoPGsBGkjJMTu1n8IjSldf6r+mFOi6K0AtkmnhQvXR6 Nh9vUoxVlSAGDHxsVlu8eiVXLP3UNLkqusZT/d/rh8aDWmzr9quIpAwBL/LePGc5Fi6Z 6N8wCHINzzN/v1gOIezzFKJtPdNlQd+wF9XbfDFSXCoQkSArhewcFjbtkg6R2A2AhQne uOpA+bNaj+akmLrVWlboZyBASUlgO5Sj4wDWd1hEOG5mFDU7Tfi6E4fBiwkGbPYw1C2o FN9UI7t6mJj3SNKUwQUZfB3oB+Vmj+ZVOTFBczHB/wV4asVZ97JXD+xFPDDZRk82VJpI t9rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xSyTj/U5Zh6C/3tFvm6nT0ee0pCWWeOmlnwXd7Ki+ZY=; b=ZSz26dexrCYnS1IpcSLMJpAVIQ4HAqyprx0Yq5KtnxPVuyXAEIqfLgm2MrHcpuMwfS JYEMDj/Fyg4nadBUcXVYN/oOs5SP9Gkpt2f1MycIrL0CImTM6gElWH2NeOi7Iu1V3S1O /NF0rOvZ/6yMTj7E0tOJdAg3FlHe96C3cLHLRkfT7FA+lZxe0Kd2c2S9AzHzmSmPI47d SsRtVOBAh5IZClvAXauwDtNpZk9Ihg8/kj+6/NOI3+HyhhPHbHquLdi3eIV117oF27eV VjWbk0eJqVHtOjQys2ki5ufmFWLPPQWliP5bhd+FyCrZpJusgqe+i6aVFtjfAhT90BWu 0QTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=aqBq5wAG; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v20-20020a1709061dd400b0078d550c0272si1513742ejh.269.2022.10.25.02.09.17; Tue, 25 Oct 2022 02:09:43 -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=@microchip.com header.s=mchp header.b=aqBq5wAG; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232127AbiJYJHm (ORCPT + 99 others); Tue, 25 Oct 2022 05:07:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232067AbiJYJGV (ORCPT ); Tue, 25 Oct 2022 05:06:21 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 121FC15B11D; Tue, 25 Oct 2022 02:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1666688663; x=1698224663; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9UoQovfFmM0YtiY/nUWq4KqxPZWJf5964xit0q5oTQo=; b=aqBq5wAGq3txlWqV1tc7y5LnLXJSNZJ/UdUdXnvANGXp209L0ZlxSRCb wMbuvhk3Pavso7npkYLoubQGG6RPPP9P58hjkF8Co+bSd/wyab1A1DLi6 ZH0+Ae1/ByW3MxAo2fLk++OD+KTrq3L+FZRIJmHTIscg2VG3FwYKMnj1b VURYikp/0sbNW8fGg7F8fIdBZXcHz2xXEIGPoUU6xnq5z1e1kjcPRrERp SIVbQgUOT3ZzNOuJhBv5Wwk+0ra8bEfEr8NmOyIcVDjuLkqNxDMK63dgD z2toYtmjcJk0DDqvJVmRGM4n+ho5r/ET3LxavP5pyXRS4+oJbHmOD0atQ g==; X-IronPort-AV: E=Sophos;i="5.95,211,1661842800"; d="scan'208";a="180386462" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 25 Oct 2022 02:04:22 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 25 Oct 2022 02:04:20 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Tue, 25 Oct 2022 02:04:18 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 23/32] dmaengine: at_hdmac: Use devm_platform_ioremap_resource Date: Tue, 25 Oct 2022 12:02:57 +0300 Message-ID: <20221025090306.297886-24-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221025090306.297886-1-tudor.ambarus@microchip.com> References: <20221025090306.297886-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747650068061085067?= X-GMAIL-MSGID: =?utf-8?q?1747650068061085067?= Use devm_platform_ioremap_resource() helper for cleanner code and easier resource management. Signed-off-by: Tudor Ambarus --- drivers/dma/at_hdmac.c | 37 ++++++------------------------------- 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index f3fbb0aa8b24..10c250618a33 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -1765,9 +1765,7 @@ static void at_dma_off(struct at_dma *atdma) static int __init at_dma_probe(struct platform_device *pdev) { - struct resource *io; struct at_dma *atdma; - size_t size; int irq; int err; int i; @@ -1793,9 +1791,9 @@ static int __init at_dma_probe(struct platform_device *pdev) if (!atdma) return -ENOMEM; - io = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!io) - return -EINVAL; + atdma->regs = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(atdma->regs)) + return PTR_ERR(atdma->regs); irq = platform_get_irq(pdev, 0); if (irq < 0) @@ -1805,21 +1803,10 @@ static int __init at_dma_probe(struct platform_device *pdev) atdma->dma_common.cap_mask = plat_dat->cap_mask; atdma->all_chan_mask = (1 << plat_dat->nr_channels) - 1; - size = resource_size(io); - if (!request_mem_region(io->start, size, pdev->dev.driver->name)) - return -EBUSY; - - atdma->regs = ioremap(io->start, size); - if (!atdma->regs) { - err = -ENOMEM; - goto err_release_r; - } - atdma->clk = clk_get(&pdev->dev, "dma_clk"); - if (IS_ERR(atdma->clk)) { - err = PTR_ERR(atdma->clk); - goto err_clk; - } + if (IS_ERR(atdma->clk)) + return PTR_ERR(atdma->clk); + err = clk_prepare_enable(atdma->clk); if (err) goto err_clk_prepare; @@ -1957,11 +1944,6 @@ static int __init at_dma_probe(struct platform_device *pdev) clk_disable_unprepare(atdma->clk); err_clk_prepare: clk_put(atdma->clk); -err_clk: - iounmap(atdma->regs); - atdma->regs = NULL; -err_release_r: - release_mem_region(io->start, size); return err; } @@ -1969,7 +1951,6 @@ static int at_dma_remove(struct platform_device *pdev) { struct at_dma *atdma = platform_get_drvdata(pdev); struct dma_chan *chan, *_chan; - struct resource *io; at_dma_off(atdma); if (pdev->dev.of_node) @@ -1994,12 +1975,6 @@ static int at_dma_remove(struct platform_device *pdev) clk_disable_unprepare(atdma->clk); clk_put(atdma->clk); - iounmap(atdma->regs); - atdma->regs = NULL; - - io = platform_get_resource(pdev, IORESOURCE_MEM, 0); - release_mem_region(io->start, resource_size(io)); - return 0; }