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: 9712507 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 8A01760362 for ; Thu, 4 May 2017 18:46:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89729286BD for ; Thu, 4 May 2017 18:46:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E0FF286C0; Thu, 4 May 2017 18:46:04 +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 362FC286B5 for ; Thu, 4 May 2017 18:46:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1737E6E5B1; Thu, 4 May 2017 18:45:59 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qt0-f170.google.com (mail-qt0-f170.google.com [209.85.216.170]) by gabe.freedesktop.org (Postfix) with ESMTPS id B182C6E5AF for ; Thu, 4 May 2017 18:45:57 +0000 (UTC) Received: by mail-qt0-f170.google.com with SMTP id j29so17618139qtj.1 for ; Thu, 04 May 2017 11:45:57 -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=LlUsCcgMjCa3xng3pMjSus3v0ds/Tu06Ox+raspAtyQkdbDSz9uCXE0TB1WnR52M4k nr2bzspwR5XhxAHLlY0B7Og+lVWL9a20ZQJuuncsissAylrucaI9ussOFLzgpxOOB1CV xv2ahrvOVCCviegsyFNiB7yE4UtQMA34HF1h43wpqTHHnuKpe4xVC3pGtxihZwWRcSQv 7CwEvDdVSxtq6kELtEg15ij4wJdspxumJEW3jTabXlCtbVO79qLKDxjHNbiim5u84YlE 50FzADMYpaH9xp3jGbTSRypHxX7BmmbfwaJ1azVG53GBaVAoEpql+Msv8ebof2Ra50nS 4jpA== X-Gm-Message-State: AN3rC/4un61cczRuktxeBJRQonhRwIplnxCP30auMzCFfOCr3WFI2RgJ E9HvAM3wTZwg50/y 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 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, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laura Abbott , Sumit Semwal Subject: [Intel-gfx] [PATCHv4 1/3] drm/vgem: Add a dummy platform device X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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); }