From patchwork Tue May 2 17:02:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9708389 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9EA1E60349 for ; Tue, 2 May 2017 17:02:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C55D28346 for ; Tue, 2 May 2017 17:02:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F8BC284DA; Tue, 2 May 2017 17:02:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4A50628346 for ; Tue, 2 May 2017 17:02:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F3EE46E153; Tue, 2 May 2017 17:02:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk0-f180.google.com (mail-qk0-f180.google.com [209.85.220.180]) by gabe.freedesktop.org (Postfix) with ESMTPS id D9EB06E14A for ; Tue, 2 May 2017 17:02:31 +0000 (UTC) Received: by mail-qk0-f180.google.com with SMTP id r189so22370416qkf.1 for ; Tue, 02 May 2017 10:02:31 -0700 (PDT) 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; bh=+mZ0/1KEtw9wesRy+ileT/CBHGtE2GST3Qw/DC13+aM=; b=kCg3XRvSSAwyFFdYz8sVi1XRgCzdRA9T9myqrfQ8A4rofwMMzlfMESOuYc031raymW +/lNcMUr+Th0tcvRW4Tn+hQiVNry+qKmkNP3DQVP+qgkPeSwsRbqbuYzPixaF+GJcmfg P+hiWAh+nWEoHz6dAds0KGZXvooOyZz+q1mP5NrmgyldyWl5ZvktJ0JGZ0HFOAcZH3gC JI26DkFva0Bo6iIx4cZaJAgQBz1EvF1XmxVAoq8TtURTYLYYFN+TIhfGWMhBAzATJhrO tpA8kKzOMSjIVFTcgxGa3Ak6onV5dM2+g5f85+tvxRJIy3x5WcI/CDUSs1o8HbbBSc1Z oyCg== X-Gm-Message-State: AN3rC/4QIgxX8whg+V5cNdRMqxYpg5X0y8879WXRMByGuTqdgpX8/K2D 0bgNZ7ipGwFOHo9I X-Received: by 10.55.6.137 with SMTP id 131mr2015539qkg.191.1493744550625; Tue, 02 May 2017 10:02:30 -0700 (PDT) Received: from labbott-redhat-machine.redhat.com ([2601:602:9802:a8dc::7f81]) by smtp.gmail.com with ESMTPSA id i16sm14182600qta.61.2017.05.02.10.02.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 May 2017 10:02:28 -0700 (PDT) From: Laura Abbott To: Daniel Vetter , Chris Wilson , Sean Paul Subject: [PATCHv3 1/3] drm/vgem: Add a dummy platform device Date: Tue, 2 May 2017 10:02:06 -0700 Message-Id: <1493744528-25768-2-git-send-email-labbott@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493744528-25768-1-git-send-email-labbott@redhat.com> References: <1493744528-25768-1-git-send-email-labbott@redhat.com> Cc: intel-gfx@lists.freedesktop.org, Joonas Lahtinen , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The vgem driver is currently registered independent of any actual device. Some usage of the dmabuf APIs require an actual device structure to do anything. Register a dummy platform device for use with dmabuf. Cc: intel-gfx@lists.freedesktop.org Reviewed-by: Chris Wilson Signed-off-by: Laura Abbott --- v3: No changes --- drivers/gpu/drm/vgem/vgem_drv.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c index 9fee38a..727eed2 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.c +++ b/drivers/gpu/drm/vgem/vgem_drv.c @@ -335,11 +335,20 @@ static int __init vgem_init(void) int ret; vgem_device = drm_dev_alloc(&vgem_driver, NULL); - if (IS_ERR(vgem_device)) { - ret = PTR_ERR(vgem_device); + if (IS_ERR(vgem_device)) + return PTR_ERR(vgem_device); + + vgem_device->platformdev = platform_device_register_simple("vgem", + -1, NULL, 0); + + if (!vgem_device->platformdev) { + ret = -ENODEV; goto out; } + dma_coerce_mask_and_coherent(&vgem_device->platformdev->dev, + DMA_BIT_MASK(64)); + ret = drm_dev_register(vgem_device, 0); if (ret) goto out_unref; @@ -347,13 +356,15 @@ static int __init vgem_init(void) return 0; out_unref: - drm_dev_unref(vgem_device); + platform_device_unregister(vgem_device->platformdev); out: + drm_dev_unref(vgem_device); return ret; } static void __exit vgem_exit(void) { + platform_device_unregister(vgem_device->platformdev); drm_dev_unregister(vgem_device); drm_dev_unref(vgem_device); }