Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp501378imu; Fri, 16 Nov 2018 05:59:02 -0800 (PST) X-Google-Smtp-Source: AJdET5cRmKqoQPZUzn7GhWQbEh5VOqSrNKJ6R01fB8PltSsEKhAn64NaGPa32DvPV4b6il0tUz8r X-Received: by 2002:a62:43c1:: with SMTP id l62mr11464553pfi.22.1542376742442; Fri, 16 Nov 2018 05:59:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542376742; cv=none; d=google.com; s=arc-20160816; b=H8wVyDO0bkr3qGSwLd3COMaWGfPhCqaX9IQVhFE8B2ObUSSjoIREJL9xuKDMqXTtpF ctg5ZJiUToD3pZ1gNSzATQdBQlNmPXoKv0iQRzTbD4z4utOcpDRdvd9+G3UWbkFb+6NK XN78HVErMpzXKcfNk/mRVPNMDS3P2WB8PtLbXbfDa8KdtSVj9jgTlTVoEN/oHJkN9cl6 RMss8IjP1Hni67Gkuxm4l/8B4j71Zfp/1S6PeiO6kZusaPmsrqx86BpBWbahIRwmmnjc 2kLtZXdu9xQiMOM80p/mt6MC7b+axl1XaMq/d/CEONtYZBQfXqlzu6AtkTeRtqNoHMfD Q/2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=8jGYlVSxPueClcYXJTbQ0gvKhk4i7gRBArO/gO+N3lc=; b=VQcBI9Sp6cDQgO5PcLz//GjUeFiRYIOGDyXUFmGBm5wLn54L+vTRBPlxxkKRqla4Ib ZIBpdUbIK1HhuJJmeW0gJpIlRwHqEFVqsw8wWQPSab+MY6MY8zMXI6S4yf/CClbs7owT utLo+ayh3TGeamEdQlyQ1U2AaNYsPHTZNq/JROqbaZqRcg9IwJis5Z/TroKbnAbXgGjl uO4k4vwQ28RLuYeH9dBSz4qbUKLmf16IOzDP6JRwc6fT2X2an4dxy7lFjXZw9rlEQoWK DoXpd1cRSM0/kfSbfpWe5sh1bCD75H5dLXO+z/mRzeJ6HllJNHYcuq/bSomqbwYNSpaq 0wyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Yd9FH5Gl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 12-v6si9915538pfu.2.2018.11.16.05.58.48; Fri, 16 Nov 2018 05:59:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Yd9FH5Gl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389368AbeKQAJ2 (ORCPT + 99 others); Fri, 16 Nov 2018 19:09:28 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:38333 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727727AbeKQAJ1 (ORCPT ); Fri, 16 Nov 2018 19:09:27 -0500 Received: by mail-wm1-f67.google.com with SMTP id f2-v6so21123344wme.3; Fri, 16 Nov 2018 05:56:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=8jGYlVSxPueClcYXJTbQ0gvKhk4i7gRBArO/gO+N3lc=; b=Yd9FH5GlOIaU37tAKUN9VLAuwMHMLyiIz2XEm0ZnViyXj7Hnd/OHuBB6opNpdASOU7 6NvBz1DWQebBpGmDPTeJClfejyEhvSs3drkFTouv9UFKUfUN8dMxU18hS+I+FZrt+KiF 6AdSYfen6yjykcevlgaUhmTbNT1HWiGTP28JloCiiq3wgglUyU+DuEXg/w9UHyvV1WW6 GJB7LSOzPqCJ+8hqJDdtX5lmnoS9wtnAkJu1VJcUZkAxQIFXxYVYRS3gOojhJFRGzAQR qpLASDFu9M53AEz83Af1Xuc4ker5WbVjqhY6H7l6cZr0c9tZXDmvuGU4ErbfSYNHH139 Ev0A== 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; bh=8jGYlVSxPueClcYXJTbQ0gvKhk4i7gRBArO/gO+N3lc=; b=QyCN/0SkWPwazjqHYc1x0CMo1zjmBKUp2BLp89UJY0pXePpvfnk3vXAOvCrc1rH8pB RoZR62DKbf7z6Y8eAMnHSrRh7xCedmxKek5aig+7YulIdSOIb7sCT8vFhQZtZY0fA1o6 mO9cmtreEvFvOD8agUhsIWAPLtYLfMG0xVYXmDs5NA1z/nzy4yfV0vN0pKzULP0mHzyY 9+mk9PsIDLo0dMmECsuCaV6bGvRwCk+8Xe4IvY6WRezXzvTiQYW0RNDk1SLZL0gDiRQm +0XdBUPM6dMujaA2aLWzo3Zm6sp3RtQk7qe1PECHWudSgfurot5DQWa/yaoGCyC7yqgv JJlA== X-Gm-Message-State: AGRZ1gKhTqU2LIHfZ6BrlsvAV97fAjE+0povKHafDpSDqhYH/U5q0wXC Lle5rKC/JjXRr8u1/5uZnOk= X-Received: by 2002:a1c:9c4:: with SMTP id 187-v6mr8868564wmj.119.1542376615404; Fri, 16 Nov 2018 05:56:55 -0800 (PST) Received: from NewMoon.iit.local ([90.147.180.254]) by smtp.gmail.com with ESMTPSA id j40-v6sm22673692wre.48.2018.11.16.05.56.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 05:56:54 -0800 (PST) From: Andrea Merello To: vkoul@kernel.org, dan.j.williams@intel.com, dmaengine@vger.kernel.org Cc: linux-kernel@vger.kernel.org, radhey.shyam.pandey@xilinx.com, Andrea Merello Subject: [PATCH] dmaengine: fix dmaengine_desc_callback_valid() doesn't check for callback_result Date: Fri, 16 Nov 2018 14:56:28 +0100 Message-Id: <20181116135628.19388-1-andrea.merello@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are two flavors of DMA completion callbacks: callback() and callback_result(); the latter takes an additional parameter that carries result information. Most dmaengine helper functions that work with callbacks take care of both flavors i.e. dmaengine_desc_get_callback_invoke() first checks for callback_result() to be not NULL, and eventually it calls this one; otherwise it goes on checking for callback(). It seems however that dmaengine_desc_callback_valid() does not care about callback_result(), and it returns false in case callback() is NULL but callback_result() is not; unless there is a (hidden to me) reason for doing so then I'd say this is wrong. I've hit this by using a DMA controller driver (xilinx_dma) that doesn't trigger any callback invocation unless dmaengine_desc_callback_valid() returns true, while I had only callback_result() implemented in my client driver (which AFAICT is always fine since dmaengine documentation says that callback() will be deprecated). This patch fixes this by making dmaengine_desc_callback_valid() to return true in the said scenario. Signed-off-by: Andrea Merello --- drivers/dma/dmaengine.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/dmaengine.h b/drivers/dma/dmaengine.h index 501c0b063f85..0ba2c1f3c55d 100644 --- a/drivers/dma/dmaengine.h +++ b/drivers/dma/dmaengine.h @@ -168,7 +168,7 @@ dmaengine_desc_get_callback_invoke(struct dma_async_tx_descriptor *tx, static inline bool dmaengine_desc_callback_valid(struct dmaengine_desc_callback *cb) { - return (cb->callback) ? true : false; + return (cb->callback || cb->callback_result); } #endif -- 2.17.1