From patchwork Fri Dec 13 08:16:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 22319 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 63DB2202E2 for ; Fri, 13 Dec 2013 08:16:56 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id m1sf5916672oag.5 for ; Fri, 13 Dec 2013 00:16:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=BJH2DBVDT5caxm0OeYogtlnsokZSoBa1SWO65LZnwqM=; b=bT3oIdC0vM6VlDhNKReQHLeIrG4InwLS1lwVA+bF5Fb4ngeXO8VkpwerXsuI3XmoKL RZIxsAKLL8ZDV6uaGOZHMGgZ5Oy8Pl/bYezbxVdN4IzlsxYAb/Je6jigBp3blvVp0at1 w5SBzDLql4RuEipz79IoXVQ9N7an+Ct2YnEe95JLAldbHb2zDV+tAUvJH8G6nR7rks+X iHZkM3WEXU4k5xsZ1HdLtQE7iNwO1iGQ4eBKkFHUAfZVlMi5IZaKHUB9UHZSslUcAHn7 S6QgR9JnoUsFELIDO+0RA72FAZ70e9vaUhg2+6k5jgzA9ir+hHHUsp5apvuCfcLa9bLc TYZg== X-Gm-Message-State: ALoCoQnLRgXb0rnv2DrtP8MmIJbkzJlJ8g3Hhf5Ru3ynFDO8lHWjKiluTLjO3QmvnexS+UN8FV+e X-Received: by 10.182.60.37 with SMTP id e5mr407185obr.30.1386922615514; Fri, 13 Dec 2013 00:16:55 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.94.41 with SMTP id cz9ls915592qeb.57.gmail; Fri, 13 Dec 2013 00:16:55 -0800 (PST) X-Received: by 10.58.50.194 with SMTP id e2mr614241veo.54.1386922615370; Fri, 13 Dec 2013 00:16:55 -0800 (PST) Received: from mail-vb0-f45.google.com (mail-vb0-f45.google.com [209.85.212.45]) by mx.google.com with ESMTPS id n7si465284vca.28.2013.12.13.00.16.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 00:16:55 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.45 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.45; Received: by mail-vb0-f45.google.com with SMTP id i12so1060010vbh.4 for ; Fri, 13 Dec 2013 00:16:55 -0800 (PST) X-Received: by 10.52.26.77 with SMTP id j13mr493796vdg.33.1386922615140; Fri, 13 Dec 2013 00:16:55 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp18586vcz; Fri, 13 Dec 2013 00:16:54 -0800 (PST) X-Received: by 10.152.21.3 with SMTP id r3mr726910lae.15.1386922614160; Fri, 13 Dec 2013 00:16:54 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com [209.85.215.46]) by mx.google.com with ESMTPS id yf5si452064lab.62.2013.12.13.00.16.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 00:16:54 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.46 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id eh20so1107623lab.5 for ; Fri, 13 Dec 2013 00:16:53 -0800 (PST) X-Received: by 10.152.4.74 with SMTP id i10mr728066lai.58.1386922613516; Fri, 13 Dec 2013 00:16:53 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id sd11sm2542247lab.2.2013.12.13.00.16.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Dec 2013 00:16:52 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org Cc: Linus Walleij Subject: [PATCH] ARM: integrator: use managed resources for the IM-PD1 Date: Fri, 13 Dec 2013 09:16:45 +0100 Message-Id: <1386922605-29700-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.3.1 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.45 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Switch the IM-PD1 driver to use managed resources and cut down on boilerplate. Signed-off-by: Linus Walleij --- arch/arm/mach-integrator/impd1.c | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c index 9f82f9dcbb98..aeeae0d79a18 100644 --- a/arch/arm/mach-integrator/impd1.c +++ b/arch/arm/mach-integrator/impd1.c @@ -307,25 +307,23 @@ static struct impd1_device impd1_devs[] = { static int impd1_probe(struct lm_device *dev) { struct impd1_module *impd1; - int i, ret; + int i; if (dev->id != module_id) return -EINVAL; - if (!request_mem_region(dev->resource.start, SZ_4K, "LM registers")) + if (!devm_request_mem_region(&dev->dev, dev->resource.start, + SZ_4K, "LM registers")) return -EBUSY; - impd1 = kzalloc(sizeof(struct impd1_module), GFP_KERNEL); - if (!impd1) { - ret = -ENOMEM; - goto release_lm; - } + impd1 = devm_kzalloc(&dev->dev, sizeof(struct impd1_module), + GFP_KERNEL); + if (!impd1) + return -ENOMEM; - impd1->base = ioremap(dev->resource.start, SZ_4K); - if (!impd1->base) { - ret = -ENOMEM; - goto free_impd1; - } + impd1->base = devm_ioremap(&dev->dev, dev->resource.start, SZ_4K); + if (!impd1->base) + return -ENOMEM; lm_set_drvdata(dev, impd1); @@ -353,14 +351,6 @@ static int impd1_probe(struct lm_device *dev) } return 0; - - free_impd1: - if (impd1 && impd1->base) - iounmap(impd1->base); - kfree(impd1); - release_lm: - release_mem_region(dev->resource.start, SZ_4K); - return ret; } static int impd1_remove_one(struct device *dev, void *data) @@ -371,16 +361,10 @@ static int impd1_remove_one(struct device *dev, void *data) static void impd1_remove(struct lm_device *dev) { - struct impd1_module *impd1 = lm_get_drvdata(dev); - device_for_each_child(&dev->dev, NULL, impd1_remove_one); integrator_impd1_clk_exit(dev->id); lm_set_drvdata(dev, NULL); - - iounmap(impd1->base); - kfree(impd1); - release_mem_region(dev->resource.start, SZ_4K); } static struct lm_driver impd1_driver = {