From patchwork Thu May 4 18:45:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9712505 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 DC7C460362 for ; Thu, 4 May 2017 18:46:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD32F286BC for ; Thu, 4 May 2017 18:46:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2503286C2; Thu, 4 May 2017 18:46:02 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham 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 7A338286C6 for ; Thu, 4 May 2017 18:46:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 07A936E5AC; Thu, 4 May 2017 18:45:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt0-f175.google.com (mail-qt0-f175.google.com [209.85.216.175]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6CAC16E5AC for ; Thu, 4 May 2017 18:45:56 +0000 (UTC) Received: by mail-qt0-f175.google.com with SMTP id m36so17610551qtb.0 for ; Thu, 04 May 2017 11:45:56 -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=fPqdA+l2+PrsJu7VGbHZVHQSpoLykYNJWvW6DiVPQZo=; b=T7xrC/r0zpMJhxs11mz7qo1RDHiAtGjtCzbDUDWbhsfzpwnIH9/3MYjjJCItuurQ/7 nRiEKxzhWUNNOGMvFEArfIGiceXnvQfR/jqEMq6goKFbzr99sYXbKbgvawtBkakafmDL KDdk0Vuz2ZOmhjHc+s7INrghC2mc0hh6HFubGCuy2WkELk48TUrQc8gG7KVRHW3MmWiK D9vJzyJUG5B38M4ddaNMyLqLW6BYLlvCFlXY2DBI3z2/9pizHB0wZgw0FPdg85V3s8iY hm3wlnGuya3xpxYhFU/vflWbfgKh3VW7Ve6p92xmlbONvQGifjuFtJITqRKLDwf5j0Fr DHAA== X-Gm-Message-State: AN3rC/4Ahx9Q5qeEo1I/dyXLDCdGVY7aaKOFz1CMSEGXuOYfomWlHde8 QBGbOX8UC9QJXEe/ X-Received: by 10.237.44.99 with SMTP id f90mr38278335qtd.24.1493923555540; Thu, 04 May 2017 11:45:55 -0700 (PDT) Received: from labbott-redhat-machine.redhat.com ([2601:602:9802:a8dc::7f81]) by smtp.gmail.com with ESMTPSA id g3sm1943961qte.66.2017.05.04.11.45.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 May 2017 11:45:54 -0700 (PDT) From: Laura Abbott To: Daniel Vetter , Chris Wilson , Sean Paul Subject: [PATCHv4 1/3] drm/vgem: Add a dummy platform device Date: Thu, 4 May 2017 11:45:46 -0700 Message-Id: <1493923548-20878-2-git-send-email-labbott@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493923548-20878-1-git-send-email-labbott@redhat.com> References: <1493923548-20878-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. Reviewed-by: Chris Wilson Signed-off-by: Laura Abbott --- v4: Switch from the now removed platformdev to a static platform device. --- drivers/gpu/drm/vgem/vgem_drv.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c index 9fee38a..d1d98af 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.c +++ b/drivers/gpu/drm/vgem/vgem_drv.c @@ -42,6 +42,8 @@ #define DRIVER_MAJOR 1 #define DRIVER_MINOR 0 +static struct platform_device *vgem_platform; + static void vgem_gem_free_object(struct drm_gem_object *obj) { struct drm_vgem_gem_object *vgem_obj = to_vgem_bo(obj); @@ -335,11 +337,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_platform = platform_device_register_simple("vgem", + -1, NULL, 0); + + if (!vgem_platform) { + ret = -ENODEV; goto out; } + dma_coerce_mask_and_coherent(&vgem_platform->dev, + DMA_BIT_MASK(64)); + ret = drm_dev_register(vgem_device, 0); if (ret) goto out_unref; @@ -347,13 +358,15 @@ static int __init vgem_init(void) return 0; out_unref: - drm_dev_unref(vgem_device); + platform_device_unregister(vgem_platform); out: + drm_dev_unref(vgem_device); return ret; } static void __exit vgem_exit(void) { + platform_device_unregister(vgem_platform); drm_dev_unregister(vgem_device); drm_dev_unref(vgem_device); }