From patchwork Wed Feb 19 10:21:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11391041 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0BB0C930 for ; Wed, 19 Feb 2020 10:22:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DE97F2464E for ; Wed, 19 Feb 2020 10:22:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="dk2eV2+C" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE97F2464E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5E86F6EB66; Wed, 19 Feb 2020 10:22:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 547BE6EB5A for ; Wed, 19 Feb 2020 10:22:10 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id t23so5867722wmi.1 for ; Wed, 19 Feb 2020 02:22:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fC4celYl+zitDraKVjI6Hb1oSvmWpkdE1ngLFdboeds=; b=dk2eV2+Cl33jPrmRLwkrRSMD7Byaog5qsPf0EaTLO8AXa/+ZfiFwzggB68gk6x8ono VoD3mYOJ+ZV3twKhUfI2NhMgPBox5P/Dw7CjbWaF8e+J0wO4YCtqOY+konadkeIdFD9d cX5IM+ubG+CVEGf+OR5bSo0d3MBedS7qYCl+c= 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=fC4celYl+zitDraKVjI6Hb1oSvmWpkdE1ngLFdboeds=; b=VGDOsLk+Q370E+dZIeOF1w6cKrL1epjgd0UG+YKvDB3zgwvS+uOaKpsYpe17tbJXHg gWlx2KwQT8DYLkuCS0IyGhyRJdNph5t3YWzKOB9e1WXNguHoME9VO1cQlzJ+qIX+5d0Z 490hLBzPe2zSaVwQSVvVcLdyl/O7kGTn9Z0woQ/N+x74LSiyiFIJK9BodLZgga1M9HhS PCs8/06/Oo+VyiiliJKrYJB6L7hjUgSl1oiHPmOclO5lTQICFZq5dUIrV5FumCRZkdAG 7LOO2JJcK37OXLKn75lSNWKDQgEcTvHALZkb8YWF8fasAfXQ3FJmISX0v1i7L0ExUYDH PV0g== X-Gm-Message-State: APjAAAWg2K8NWjGxZfDKAzerSQRRQL9Vf59UGuqcSkXuFWJBtzexUwt6 Vk9fRtSc09cKqrxKSWTLbeUP0FtJd+Y= X-Google-Smtp-Source: APXvYqzN9lvisSX+iRkbvK9qZC3/t2yh9RubvLazZ4qBC28FieWq6vf1iccHAbWVKoFBV3oSDQcmUA== X-Received: by 2002:a05:600c:290e:: with SMTP id i14mr9296665wmd.139.1582107728613; Wed, 19 Feb 2020 02:22:08 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id s23sm2370339wra.15.2020.02.19.02.22.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 02:22:07 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH 31/52] drm/cirrus: Fully embrace devm_ Date: Wed, 19 Feb 2020 11:21:01 +0100 Message-Id: <20200219102122.1607365-32-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200219102122.1607365-1-daniel.vetter@ffwll.ch> References: <20200219102122.1607365-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Intel Graphics Development , virtualization@lists.linux-foundation.org, Gerd Hoffmann , Thomas Zimmermann , Daniel Vetter , Dave Airlie , Emil Velikov Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" With the drm_device lifetime fun cleaned up there's nothing in the way anymore to use devm_ for everything hw releated. Do it, and in the process, throw out the entire onion unwinding. Signed-off-by: Daniel Vetter Cc: Dave Airlie Cc: Gerd Hoffmann Cc: Daniel Vetter Cc: "Noralf Trønnes" Cc: Emil Velikov Cc: Thomas Zimmermann Cc: virtualization@lists.linux-foundation.org Acked-by: Gerd Hoffmann --- drivers/gpu/drm/cirrus/cirrus.c | 44 +++++++++++---------------------- 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/cirrus/cirrus.c b/drivers/gpu/drm/cirrus/cirrus.c index 6ac0286810ec..1b78a2f88f69 100644 --- a/drivers/gpu/drm/cirrus/cirrus.c +++ b/drivers/gpu/drm/cirrus/cirrus.c @@ -558,7 +558,7 @@ static int cirrus_pci_probe(struct pci_dev *pdev, if (ret) return ret; - ret = pci_enable_device(pdev); + ret = pcim_enable_device(pdev); if (ret) return ret; @@ -569,39 +569,38 @@ static int cirrus_pci_probe(struct pci_dev *pdev, ret = -ENOMEM; cirrus = kzalloc(sizeof(*cirrus), GFP_KERNEL); if (cirrus == NULL) - goto err_pci_release; + return ret; dev = &cirrus->dev; - ret = drm_dev_init(dev, &cirrus_driver, &pdev->dev); + ret = devm_drm_dev_init(&pdev->dev, dev, &cirrus_driver); if (ret) { kfree(cirrus); - goto err_pci_release; + return ret; } dev->dev_private = cirrus; drmm_add_final_kfree(dev, cirrus); - ret = -ENOMEM; - cirrus->vram = ioremap(pci_resource_start(pdev, 0), - pci_resource_len(pdev, 0)); + cirrus->vram = devm_ioremap(&pdev->dev, pci_resource_start(pdev, 0), + pci_resource_len(pdev, 0)); if (cirrus->vram == NULL) - goto err_dev_put; + return -ENOMEM; - cirrus->mmio = ioremap(pci_resource_start(pdev, 1), - pci_resource_len(pdev, 1)); + cirrus->mmio = devm_ioremap(&pdev->dev, pci_resource_start(pdev, 1), + pci_resource_len(pdev, 1)); if (cirrus->mmio == NULL) - goto err_unmap_vram; + return -ENOMEM; ret = cirrus_mode_config_init(cirrus); if (ret) - goto err_cleanup; + return ret; ret = cirrus_conn_init(cirrus); if (ret < 0) - goto err_cleanup; + return ret; ret = cirrus_pipe_init(cirrus); if (ret < 0) - goto err_cleanup; + return ret; drm_mode_config_reset(dev); @@ -609,33 +608,18 @@ static int cirrus_pci_probe(struct pci_dev *pdev, pci_set_drvdata(pdev, dev); ret = drm_dev_register(dev, 0); if (ret) - goto err_cleanup; + return ret; drm_fbdev_generic_setup(dev, dev->mode_config.preferred_depth); return 0; - -err_cleanup: - iounmap(cirrus->mmio); -err_unmap_vram: - iounmap(cirrus->vram); -err_dev_put: - drm_dev_put(dev); -err_pci_release: - pci_release_regions(pdev); - return ret; } static void cirrus_pci_remove(struct pci_dev *pdev) { struct drm_device *dev = pci_get_drvdata(pdev); - struct cirrus_device *cirrus = dev->dev_private; drm_dev_unplug(dev); drm_atomic_helper_shutdown(dev); - iounmap(cirrus->mmio); - iounmap(cirrus->vram); - drm_dev_put(dev); - pci_release_regions(pdev); } static const struct pci_device_id pciidlist[] = {