From patchwork Mon Nov 7 21:16:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 9416091 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 70B5D60585 for ; Mon, 7 Nov 2016 21:16:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D0C51FF13 for ; Mon, 7 Nov 2016 21:16:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1053028BE9; Mon, 7 Nov 2016 21:16:42 +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=-1.4 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=no 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 571C028BE5 for ; Mon, 7 Nov 2016 21:16:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A6EE989FEA; Mon, 7 Nov 2016 21:16:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-it0-x243.google.com (mail-it0-x243.google.com [IPv6:2607:f8b0:4001:c0b::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8AEDF897E3; Mon, 7 Nov 2016 21:16:36 +0000 (UTC) Received: by mail-it0-x243.google.com with SMTP id e187so11807134itc.0; Mon, 07 Nov 2016 13:16:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0qolbO3LyJIiM3iQiyO4//ZGAwn70JUMwUd/ZxqqYIs=; b=VW/LCrjD58qxhRoTwhtCo/pFY2PoV9rlyXumGNIGH8CyQb59hchk6EMrrwKAtwQKBO ucpQoKJ+hJjGqx0rSUjTVKDcirczzN+/Ej5t92b8sC0edm4zTtpG7fYY+wJHoPIcDFp5 S3FwVqoAw7nu3aHpCHuEvK7pNPF4S+ZiVHBM2i0FYtUJQlx0GBVCIRSlTPGntaxV4jiM ImZurh9enaZQEcJsgOqrKBJnv4o70J/dKpMWYhUMN2UBzd1Z8suKw6TMf07lmGSR8HQO 4iFRnA8+j6BJZE+sUDd7pMZ8P1GaJtRMTgbW7nDWlxm7P92LXSvk3qZr0woQRF0V2IYs 4jlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0qolbO3LyJIiM3iQiyO4//ZGAwn70JUMwUd/ZxqqYIs=; b=IVQ3iOOpRP9xUheZPvc+mv/qDmVA6JWz6YWnYf34zSRmMrXAltoX6Q/P+KHFtLdhPr U4lX8i9GnSpFm6jv53AVolS4oEPLsyiTEBTLFAYWxVK9XvFF1eHlY+pnMcPNV0vxCi1f iRPZrTzgoURlG5bE2+V2F4cKYJ5AFgA2+8ikKh8l+TMBpM0ah95Z8YbyVFv0aT9zcjht N4zywcqrmRwoCs2Sp3dxEkjke9hPl8BExR00u28vtLXp90hVS2X58SJgrNhC71izKmGe ka4jUO+wsv/Qpwr2gdXb7YtaHvgLnnVpDkvo4KpTDRg+c43wz1fbJsuBXcVtPMDGi5FR Y6fg== X-Gm-Message-State: ABUngvcx4+KVW6D9PU7wJyISgLsnfZUyE8gjhR0LSg39WC/rMz7eSt1G9aBk2cLQ/X/6HA== X-Received: by 10.36.65.39 with SMTP id x39mr6105853ita.103.1478553395869; Mon, 07 Nov 2016 13:16:35 -0800 (PST) Received: from cm.amd.com ([165.204.55.251]) by smtp.gmail.com with ESMTPSA id 22sm9687772iog.28.2016.11.07.13.16.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Nov 2016 13:16:35 -0800 (PST) From: Alex Deucher X-Google-Original-From: Alex Deucher To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH 1/4] dma-buf/fence: make timeout handling in fence_default_wait consistent (v2) Date: Mon, 7 Nov 2016 16:16:13 -0500 Message-Id: <1478553376-18575-1-git-send-email-alexander.deucher@amd.com> X-Mailer: git-send-email 2.5.5 MIME-Version: 1.0 Cc: Alex Deucher 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Kernel functions taking a timeout usually return 1 on success even when they get a zero timeout. v2: agd: rebase on drm-next Reviewed-by: Alex Deucher Signen-off-by: Christian König Reviewed-by: Chunming Zhou Signed-off-by: Alex Deucher --- These are the same patches Christian sent out previously, just rebased on the fence naming changes in drm-next. drivers/dma-buf/dma-fence.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c index 0c3141e7..6c3f6b4 100644 --- a/drivers/dma-buf/dma-fence.c +++ b/drivers/dma-buf/dma-fence.c @@ -339,18 +339,20 @@ dma_fence_default_wait_cb(struct dma_fence *fence, struct dma_fence_cb *cb) * @timeout: [in] timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT * * Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or the - * remaining timeout in jiffies on success. + * remaining timeout in jiffies on success. If timeout is zero the value one is + * returned if the fence is already signaled for consistency with other + * functions taking a jiffies timeout. */ signed long dma_fence_default_wait(struct dma_fence *fence, bool intr, signed long timeout) { struct default_wait_cb cb; unsigned long flags; - signed long ret = timeout; + signed long ret = timeout ? timeout : 1; bool was_set; if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) - return timeout; + return ret; spin_lock_irqsave(fence->lock, flags);