From patchwork Tue Jul 21 13:50:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 6836401 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DF699C05AC for ; Tue, 21 Jul 2015 13:57:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01D97206A0 for ; Tue, 21 Jul 2015 13:57:27 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 16B4320670 for ; Tue, 21 Jul 2015 13:57:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZHY12-0008Bc-RB; Tue, 21 Jul 2015 13:55:28 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZHXyC-0004qK-Bd for linux-arm-kernel@bombadil.infradead.org; Tue, 21 Jul 2015 13:52:32 +0000 Received: from mail-wi0-x22d.google.com ([2a00:1450:400c:c05::22d]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZHXyA-00074R-72 for linux-arm-kernel@lists.infradead.org; Tue, 21 Jul 2015 13:52:30 +0000 Received: by wicmv11 with SMTP id mv11so42324503wic.0 for ; Tue, 21 Jul 2015 06:52:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=XRS7LWL3mHicyLIM9b4RtCXCUA6wPchQF7Sxf6WcT7k=; b=hc0pQcy1XwB5G/jgy9NMeDCwiUvQddJqiXny88q7468HLgkJ8pmf14Ahk81s16bsQR 3xgLt/RDkSV//O1C0bcsr69G8UKRnQxMPLqcbSrdif8M3vQJ8WXRwGdeWnTgQOmr0yEx KKGNvI+rMZv752VZ1CHPpcoekv7ZnIydrnU2y1IJ9NGVUhB7H7wYmVM1jzCmuaI0xdkY laaJQnXVjSs/GtqPlVtzgfw9R5lKD2Be74QHYu7K9J/BKlb/6n45UDdDYeV5o1Ekdqb0 wdgWAjr4YvrVq1cc68ftoPsF9hCYLQwvEFBFX+n8FBEQixk5ykIGZB+XAa4cEo5LSPXb u63A== X-Received: by 10.194.85.116 with SMTP id g20mr66177384wjz.154.1437486727373; Tue, 21 Jul 2015 06:52:07 -0700 (PDT) Received: from cizrna.lan ([109.72.12.178]) by smtp.gmail.com with ESMTPSA id pf4sm37172056wjb.23.2015.07.21.06.52.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Jul 2015 06:52:06 -0700 (PDT) From: Tomeu Vizoso To: linux-kernel@vger.kernel.org Subject: [RFC PATCH 13/16] tegra-sor: Use devm_resource Date: Tue, 21 Jul 2015 15:50:55 +0200 Message-Id: <1437486658-28365-14-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1437486658-28365-1-git-send-email-tomeu.vizoso@collabora.com> References: <1437486658-28365-1-git-send-email-tomeu.vizoso@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150721_145230_287379_78AD6665 X-CRM114-Status: GOOD ( 15.99 ) X-Spam-Score: -2.4 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Tomeu Vizoso , Stephen Warren , "Rafael J. Wysocki" , Mark Brown , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Tomeu Vizoso --- drivers/gpu/drm/tegra/sor.c | 60 ++++++++++++--------------------------------- 1 file changed, 15 insertions(+), 45 deletions(-) diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index 7591d8901f9a..ec540ecda601 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -1579,55 +1579,13 @@ static const struct host1x_client_ops sor_client_ops = { static int tegra_sor_probe(struct platform_device *pdev) { - struct device_node *np; struct tegra_sor *sor; - struct resource *regs; int err; - sor = devm_kzalloc(&pdev->dev, sizeof(*sor), GFP_KERNEL); - if (!sor) - return -ENOMEM; + sor = platform_get_drvdata(pdev); sor->output.dev = sor->dev = &pdev->dev; - np = of_parse_phandle(pdev->dev.of_node, "nvidia,dpaux", 0); - if (np) { - sor->dpaux = tegra_dpaux_find_by_of_node(np); - of_node_put(np); - - if (!sor->dpaux) - return -EPROBE_DEFER; - } - - err = tegra_output_probe(&sor->output); - if (err < 0) - return err; - - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); - sor->regs = devm_ioremap_resource(&pdev->dev, regs); - if (IS_ERR(sor->regs)) - return PTR_ERR(sor->regs); - - sor->rst = devm_reset_control_get(&pdev->dev, "sor"); - if (IS_ERR(sor->rst)) - return PTR_ERR(sor->rst); - - sor->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(sor->clk)) - return PTR_ERR(sor->clk); - - sor->clk_parent = devm_clk_get(&pdev->dev, "parent"); - if (IS_ERR(sor->clk_parent)) - return PTR_ERR(sor->clk_parent); - - sor->clk_safe = devm_clk_get(&pdev->dev, "safe"); - if (IS_ERR(sor->clk_safe)) - return PTR_ERR(sor->clk_safe); - - sor->clk_dp = devm_clk_get(&pdev->dev, "dp"); - if (IS_ERR(sor->clk_dp)) - return PTR_ERR(sor->clk_dp); - INIT_LIST_HEAD(&sor->client.list); sor->client.ops = &sor_client_ops; sor->client.dev = &pdev->dev; @@ -1641,8 +1599,6 @@ static int tegra_sor_probe(struct platform_device *pdev) return err; } - platform_set_drvdata(pdev, sor); - return 0; } @@ -1669,10 +1625,24 @@ static const struct of_device_id tegra_sor_of_match[] = { }; MODULE_DEVICE_TABLE(of, tegra_sor_of_match); +static const struct devm_resource tegra_sor_resources[] = { + DEVM_ALLOC(tegra_sor), + DEVM_TEGRA_DPAUX(tegra_sor, dpaux, "nvidia,dpaux"), + DEVM_TEGRA_OUTPUT(tegra_sor, output), + DEVM_IOMAP(tegra_sor, regs, 0, 0), + DEVM_RESET(tegra_sor, rst, "sor"), + DEVM_CLOCK(tegra_sor, clk, NULL), + DEVM_CLOCK(tegra_sor, clk_parent, "parent"), + DEVM_CLOCK(tegra_sor, clk_safe, "safe"), + DEVM_CLOCK(tegra_sor, clk_dp, "dp"), + {}, +}; + struct platform_driver tegra_sor_driver = { .driver = { .name = "tegra-sor", .of_match_table = tegra_sor_of_match, + .resources = tegra_sor_resources, }, .probe = tegra_sor_probe, .remove = tegra_sor_remove,