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: 9708387 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 9AC2A60349 for ; Tue, 2 May 2017 17:02:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A6622029C for ; Tue, 2 May 2017 17:02:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F032204C2; Tue, 2 May 2017 17:02:36 +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 1C9B72029C for ; Tue, 2 May 2017 17:02:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5F1106E048; Tue, 2 May 2017 17:02:33 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qk0-f176.google.com (mail-qk0-f176.google.com [209.85.220.176]) by gabe.freedesktop.org (Postfix) with ESMTPS id D59ED6E048 for ; Tue, 2 May 2017 17:02:31 +0000 (UTC) Received: by mail-qk0-f176.google.com with SMTP id r189so22370399qkf.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=VSn5KUsBM6mjJkhCshInLBkTN3NrjK+GDSeC0Ap8NV1E4cImYVhAOoiNRFjH2ZXhsF B69JjzUXXpO2IJQypg+txsjQsP0e14Kzna6HL7bq2pgjm/1alFZeuE16OdtPZjfCc+hd 2DKixeP3vRF/mM5zB7y1f+F8GV2YeB6PGB/MZsG2CNooiDV09OMGVL0zR/ioS2BF4XmH ZuIsqoG4gB1Tl0I6BWfwNZgtTL5qH8jqjovtbFribt2a4+Ea08OWbTRJW8JYPLy2TeAW Ns671wr77MQHrkRH4xktsxcqsGApARuaV9cImkwAfzapT+oisfrTiu/caI1ozdo+Z+cO v9Cw== X-Gm-Message-State: AN3rC/4nMJiYE1d8flZrb0Wi/W5yooyUe9QvKzXm2eF4eLCarXdyD/vq vGDcoQnmSk0Tg7jf 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 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, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laura Abbott , Sumit Semwal Subject: [Intel-gfx] [PATCHv3 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. 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); }