From patchwork Fri Aug 3 15:40:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Cassou X-Patchwork-Id: 1271471 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 62DFB3FCFC for ; Fri, 3 Aug 2012 15:40:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753475Ab2HCPk1 (ORCPT ); Fri, 3 Aug 2012 11:40:27 -0400 Received: from mail1-relais-roc.national.inria.fr ([192.134.164.82]:32801 "EHLO mail1-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753334Ab2HCPk0 (ORCPT ); Fri, 3 Aug 2012 11:40:26 -0400 X-IronPort-AV: E=Sophos;i="4.77,706,1336341600"; d="scan'208";a="169023105" Received: from tytso.inria.fr (HELO localhost.localdomain) ([128.93.60.73]) by mail1-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 03 Aug 2012 17:40:24 +0200 From: Damien Cassou To: Christopher Hoover Cc: kernel-janitors@vger.kernel.org, Florian Tobias Schandinat , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] drivers/video/epson1355fb.c: use devm_ functions Date: Fri, 3 Aug 2012 17:40:10 +0200 Message-Id: <1344008414-2894-2-git-send-email-damien.cassou@lifl.fr> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1344008414-2894-1-git-send-email-damien.cassou@lifl.fr> References: <1344008414-2894-1-git-send-email-damien.cassou@lifl.fr> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org From: Damien Cassou The various devm_ functions allocate memory that is released when a driver detaches. This patch uses these functions for data that is allocated in the probe function of a platform device and is only freed in the remove function. Signed-off-by: Damien Cassou --- drivers/video/epson1355fb.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/video/epson1355fb.c b/drivers/video/epson1355fb.c index 68b9b51..246da1e 100644 --- a/drivers/video/epson1355fb.c +++ b/drivers/video/epson1355fb.c @@ -592,12 +592,8 @@ static int epson1355fb_remove(struct platform_device *dev) if (info) { fb_dealloc_cmap(&info->cmap); - if (info->screen_base) - iounmap(info->screen_base); framebuffer_release(info); } - release_mem_region(EPSON1355FB_FB_PHYS, EPSON1355FB_FB_LEN); - release_mem_region(EPSON1355FB_REGS_PHYS, EPSON1355FB_REGS_LEN); return 0; } @@ -608,15 +604,18 @@ static int __devinit epson1355fb_probe(struct platform_device *dev) u8 revision; int rc = 0; - if (!request_mem_region(EPSON1355FB_REGS_PHYS, EPSON1355FB_REGS_LEN, "S1D13505 registers")) { + if (!devm_request_mem_region(&dev->dev, EPSON1355FB_REGS_PHYS, + EPSON1355FB_REGS_LEN, + "S1D13505 registers")) { printk(KERN_ERR "epson1355fb: unable to reserve " "registers at 0x%0x\n", EPSON1355FB_REGS_PHYS); rc = -EBUSY; goto bail; } - if (!request_mem_region(EPSON1355FB_FB_PHYS, EPSON1355FB_FB_LEN, - "S1D13505 framebuffer")) { + if (!devm_request_mem_region(&dev->dev, EPSON1355FB_FB_PHYS, + EPSON1355FB_FB_LEN, + "S1D13505 framebuffer")) { printk(KERN_ERR "epson1355fb: unable to reserve " "framebuffer at 0x%0x\n", EPSON1355FB_FB_PHYS); rc = -EBUSY; @@ -638,7 +637,8 @@ static int __devinit epson1355fb_probe(struct platform_device *dev) } info->pseudo_palette = default_par->pseudo_palette; - info->screen_base = ioremap(EPSON1355FB_FB_PHYS, EPSON1355FB_FB_LEN); + info->screen_base = devm_ioremap(&dev->dev, EPSON1355FB_FB_PHYS, + EPSON1355FB_FB_LEN); if (!info->screen_base) { printk(KERN_ERR "epson1355fb: unable to map framebuffer\n"); rc = -ENOMEM;