From patchwork Wed Jan 22 13:31:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 23520 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D0138218CB for ; Wed, 22 Jan 2014 13:31:31 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id h16sf1369672oag.8 for ; Wed, 22 Jan 2014 05:31:31 -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:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=AefLM22LS6Ledsgkio1Z9UCE0Sf9tdquDUwEYjQmGyM=; b=JP95OiEkOIIUrL9aVph2If8JZG+31F8ytbQ0May1pl8KjKma5a4D+qYpUVNINYJKwx OnnKCcoiWOV0ybgyetJ+m2Y7UmQLbvgLKj/wztmun61p4xTzZQzy4FroCA7POlkhnbAJ nc83TBdmoaS1ERm8I0fM2oeTj0WYUipQoNR1/e96emKiphOct9+Z0iAjIWGcktCnnn0I coy6fGAd2MOk96cFAJpf/TriiXB3egvcOmoKD33zC1glk5/Atp3ezrM1RYCr2QEWl/C7 rBm7qsynmBO9b2RccImwkCK1I309T98LR+Zf2f45mMJpGpGcQn1G4KvPoMpsL3sXBfu6 tgow== X-Gm-Message-State: ALoCoQldi3AlZHmwSkuc9Np8EO52utlhIp84Cnxc1oYAJHuBSsdXYCHexf+4AROrc7spvguiIrHe X-Received: by 10.182.158.4 with SMTP id wq4mr579251obb.18.1390397490955; Wed, 22 Jan 2014 05:31:30 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.85.129 with SMTP id h1ls60377qez.15.gmail; Wed, 22 Jan 2014 05:31:30 -0800 (PST) X-Received: by 10.220.191.134 with SMTP id dm6mr954742vcb.16.1390397490833; Wed, 22 Jan 2014 05:31:30 -0800 (PST) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id n10si4549360vcf.3.2014.01.22.05.31.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 05:31:30 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id oy12so221320veb.14 for ; Wed, 22 Jan 2014 05:31:30 -0800 (PST) X-Received: by 10.220.247.68 with SMTP id mb4mr92658vcb.37.1390397490771; Wed, 22 Jan 2014 05:31:30 -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 u4csp184737vcz; Wed, 22 Jan 2014 05:31:30 -0800 (PST) X-Received: by 10.194.63.134 with SMTP id g6mr1821525wjs.46.1390397489717; Wed, 22 Jan 2014 05:31:29 -0800 (PST) Received: from mail-wg0-f46.google.com (mail-wg0-f46.google.com [74.125.82.46]) by mx.google.com with ESMTPS id y6si6819087wia.57.2014.01.22.05.31.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 05:31:29 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.46 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=74.125.82.46; Received: by mail-wg0-f46.google.com with SMTP id x12so311428wgg.13 for ; Wed, 22 Jan 2014 05:31:29 -0800 (PST) X-Received: by 10.180.11.36 with SMTP id n4mr3319631wib.4.1390397489301; Wed, 22 Jan 2014 05:31:29 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id po3sm14898693wjc.3.2014.01.22.05.31.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Jan 2014 05:31:28 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org Cc: Linus Walleij Subject: [PATCH 3/5] ARM: integrator: use managed resources for the IM-PD1 Date: Wed, 22 Jan 2014 14:31:09 +0100 Message-Id: <1390397471-6802-4-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1390397471-6802-1-git-send-email-linus.walleij@linaro.org> References: <1390397471-6802-1-git-send-email-linus.walleij@linaro.org> 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.128.169 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 = {