From patchwork Mon Jul 22 13:44:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11052413 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6709613A4 for ; Mon, 22 Jul 2019 13:44:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56C1927F7F for ; Mon, 22 Jul 2019 13:44:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4080A284FC; Mon, 22 Jul 2019 13:44:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9866027F7F for ; Mon, 22 Jul 2019 13:44:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730753AbfGVNov (ORCPT ); Mon, 22 Jul 2019 09:44:51 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:55857 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730711AbfGVNou (ORCPT ); Mon, 22 Jul 2019 09:44:50 -0400 Received: by mail-wm1-f68.google.com with SMTP id a15so35231945wmj.5 for ; Mon, 22 Jul 2019 06:44:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jWheGXALa3QU6XJ4okjj1TMSdfEv0wcU+XMDpAi/P/4=; b=rVd3UGYLpnpiE7d7YNlI3ET5cbhQAhoqJOLIqM567rXb8R0JuSNY+GZ12K9dSNKFZ4 dl5s5Jx5CpB5SVRzWyOMoTxhRuQ486dDy+IOe5n7GRP60Z/QxdFNnFTZq+X2qWesd+tQ 68xC09YKoAIjDOa30G0pN5Wdl1aYP05UC/xJr1YOuir73Ug3MH+21e4Wuc8zXvn+LPoN MPGKQJSOoUPFhnonqd1vSWZtmNxpr0QdnqfZT/PRoV9YpazFmIObAyyTcj1GgdAHJdQM gmp068N6OqASdUbiM9rb03eyh0yElND1TFAVSEnQXvniCrOLzl+Y0bTbvr7Jjx6wbIoz HI6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jWheGXALa3QU6XJ4okjj1TMSdfEv0wcU+XMDpAi/P/4=; b=MO+pDj5K8RKNaB56Wqf5VqB2YFodBjQJeUIQ3c8xx0dpK+xeeQW9ixRc4TLZDovb/d AEFz7DWNPhP68bRrpLHlo39nlT+wvOqFyw+WXc9ZUohaoLoTLVrrhmNdijG8eY7xgTSn MFrLIpPVrBdy5ooxXLOMTcT2i2wLvXWNfZEibwJt1f+x7AzBLBD2+j54LBU1ZH2MyMl5 ghIYiSK1jc6t76czdPjdusdaSVnxCcTaemCBOKgMLHg7vH9Z6s1rZ5oZ5TRoo8DCo644 WIPX2pfc+tueY9UjWrawRbbR07mCqGA5109YGOMCdpw5A1r5A9qFa/yxK6881MJRw9+M tOOA== X-Gm-Message-State: APjAAAXl5R08n2qi5dW9VTkoJh8Vo71OcOa8GkYK+CDhIOAbhiYdhxnJ AoynnpTD/O6IP8Yq7P/LaoY= X-Google-Smtp-Source: APXvYqxCpsWqQ4zm4VmmUJy0WYCbbplgVH9qEJJDDHs04LIzglwRSQkeaNmUKXyrghagMF9BDt0qtA== X-Received: by 2002:a1c:b604:: with SMTP id g4mr65271331wmf.111.1563803088790; Mon, 22 Jul 2019 06:44:48 -0700 (PDT) Received: from localhost.localdomain (amontpellier-652-1-281-69.w109-210.abo.wanadoo.fr. [109.210.96.69]) by smtp.gmail.com with ESMTPSA id p6sm40652484wrq.97.2019.07.22.06.44.47 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 22 Jul 2019 06:44:48 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Bartlomiej Zolnierkiewicz , David Lechner , Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 9/9] fbdev: da8xx: use resource management for dma Date: Mon, 22 Jul 2019 15:44:23 +0200 Message-Id: <20190722134423.26555-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190722134423.26555-1-brgl@bgdev.pl> References: <20190722134423.26555-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Use managed variants of dma alloc functions in the da8xx fbdev driver. Signed-off-by: Bartosz Golaszewski Acked-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/da8xx-fb.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c index d14ea6f91371..2d3dcc52fcf3 100644 --- a/drivers/video/fbdev/da8xx-fb.c +++ b/drivers/video/fbdev/da8xx-fb.c @@ -1087,10 +1087,6 @@ static int fb_remove(struct platform_device *dev) unregister_framebuffer(info); fb_dealloc_cmap(&info->cmap); - dma_free_coherent(par->dev, PALETTE_SIZE, par->v_palette_base, - par->p_palette_base); - dma_free_coherent(par->dev, par->vram_size, par->vram_virt, - par->vram_phys); pm_runtime_put_sync(&dev->dev); pm_runtime_disable(&dev->dev); framebuffer_release(info); @@ -1427,10 +1423,10 @@ static int fb_probe(struct platform_device *device) par->vram_size = roundup(par->vram_size/8, ulcm); par->vram_size = par->vram_size * LCD_NUM_BUFFERS; - par->vram_virt = dma_alloc_coherent(par->dev, - par->vram_size, - &par->vram_phys, - GFP_KERNEL | GFP_DMA); + par->vram_virt = dmam_alloc_coherent(par->dev, + par->vram_size, + &par->vram_phys, + GFP_KERNEL | GFP_DMA); if (!par->vram_virt) { dev_err(&device->dev, "GLCD: kmalloc for frame buffer failed\n"); @@ -1448,20 +1444,20 @@ static int fb_probe(struct platform_device *device) da8xx_fb_fix.line_length - 1; /* allocate palette buffer */ - par->v_palette_base = dma_alloc_coherent(par->dev, PALETTE_SIZE, - &par->p_palette_base, - GFP_KERNEL | GFP_DMA); + par->v_palette_base = dmam_alloc_coherent(par->dev, PALETTE_SIZE, + &par->p_palette_base, + GFP_KERNEL | GFP_DMA); if (!par->v_palette_base) { dev_err(&device->dev, "GLCD: kmalloc for palette buffer failed\n"); ret = -EINVAL; - goto err_release_fb_mem; + goto err_release_fb; } par->irq = platform_get_irq(device, 0); if (par->irq < 0) { ret = -ENOENT; - goto err_release_pl_mem; + goto err_release_fb; } da8xx_fb_var.grayscale = @@ -1479,7 +1475,7 @@ static int fb_probe(struct platform_device *device) ret = fb_alloc_cmap(&da8xx_fb_info->cmap, PALETTE_SIZE, 0); if (ret) - goto err_release_pl_mem; + goto err_release_fb; da8xx_fb_info->cmap.len = par->palette_sz; /* initialize var_screeninfo */ @@ -1533,14 +1529,6 @@ static int fb_probe(struct platform_device *device) err_dealloc_cmap: fb_dealloc_cmap(&da8xx_fb_info->cmap); -err_release_pl_mem: - dma_free_coherent(par->dev, PALETTE_SIZE, par->v_palette_base, - par->p_palette_base); - -err_release_fb_mem: - dma_free_coherent(par->dev, par->vram_size, par->vram_virt, - par->vram_phys); - err_release_fb: framebuffer_release(da8xx_fb_info);