From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01AA2C352A2 for ; Fri, 7 Feb 2020 07:46:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C5BA821741 for ; Fri, 7 Feb 2020 07:46:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ax75Urtc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726843AbgBGHqr (ORCPT ); Fri, 7 Feb 2020 02:46:47 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:27454 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726130AbgBGHqq (ORCPT ); Fri, 7 Feb 2020 02:46:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581061605; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=SUzQd6LFEwB3hirjXChHgZ4lmXv/SBqu0oNtoi7asxQ=; b=ax75UrtcEnxvYpsjZevD7Y3ggegCKZYH9UxOBrYm/INNfh6dKtWPcBwpCVQvqoE4AvvYFl eyHXNLytFJ/pBdS+vuI7e7pB4DJcorcJIX15sNdUzjxGsNlat00q4THbxQIQ0u0YqpC+rX DBEV9YHbI1Tfk9Xd1XIU6rve84GdNf4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-109-Ase0DdZMOJG3dMa_il8VyA-1; Fri, 07 Feb 2020 02:46:43 -0500 X-MC-Unique: Ase0DdZMOJG3dMa_il8VyA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E6D64DB60; Fri, 7 Feb 2020 07:46:41 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-112.ams2.redhat.com [10.36.116.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16B4B60C05; Fri, 7 Feb 2020 07:46:39 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6C06431F39; Fri, 7 Feb 2020 08:46:38 +0100 (CET) From: Gerd Hoffmann To: dri-devel@lists.freedesktop.org Cc: gurchetansingh@chromium.org, olvaffe@gmail.com, Gerd Hoffmann , David Airlie , Daniel Vetter , virtualization@lists.linux-foundation.org (open list:VIRTIO GPU DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 1/4] drm/virtio: simplify virtio_gpu_alloc_cmd Date: Fri, 7 Feb 2020 08:46:35 +0100 Message-Id: <20200207074638.26386-2-kraxel@redhat.com> In-Reply-To: <20200207074638.26386-1-kraxel@redhat.com> References: <20200207074638.26386-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Just call virtio_gpu_alloc_cmd_resp with some fixed args instead of duplicating most of the function body. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_vq.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c index 41e475fbd67b..df499fb64ac7 100644 --- a/drivers/gpu/drm/virtio/virtgpu_vq.c +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c @@ -120,23 +120,6 @@ virtio_gpu_vbuf_ctrl_hdr(struct virtio_gpu_vbuffer *vbuf) return (struct virtio_gpu_ctrl_hdr *)vbuf->buf; } -static void *virtio_gpu_alloc_cmd(struct virtio_gpu_device *vgdev, - struct virtio_gpu_vbuffer **vbuffer_p, - int size) -{ - struct virtio_gpu_vbuffer *vbuf; - - vbuf = virtio_gpu_get_vbuf(vgdev, size, - sizeof(struct virtio_gpu_ctrl_hdr), - NULL, NULL); - if (IS_ERR(vbuf)) { - *vbuffer_p = NULL; - return ERR_CAST(vbuf); - } - *vbuffer_p = vbuf; - return vbuf->buf; -} - static struct virtio_gpu_update_cursor* virtio_gpu_alloc_cursor(struct virtio_gpu_device *vgdev, struct virtio_gpu_vbuffer **vbuffer_p) @@ -172,6 +155,15 @@ static void *virtio_gpu_alloc_cmd_resp(struct virtio_gpu_device *vgdev, return (struct virtio_gpu_command *)vbuf->buf; } +static void *virtio_gpu_alloc_cmd(struct virtio_gpu_device *vgdev, + struct virtio_gpu_vbuffer **vbuffer_p, + int size) +{ + return virtio_gpu_alloc_cmd_resp(vgdev, NULL, vbuffer_p, size, + sizeof(struct virtio_gpu_ctrl_hdr), + NULL); +} + static void free_vbuf(struct virtio_gpu_device *vgdev, struct virtio_gpu_vbuffer *vbuf) { -- 2.18.1