From patchwork Fri Sep 28 07:29:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 1518001 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 6A2C8DF283 for ; Fri, 28 Sep 2012 09:37:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 62315A0A1E for ; Fri, 28 Sep 2012 02:37:06 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-oa0-f49.google.com (mail-oa0-f49.google.com [209.85.219.49]) by gabe.freedesktop.org (Postfix) with ESMTP id B81549EAF2 for ; Fri, 28 Sep 2012 00:29:50 -0700 (PDT) Received: by oagl10 with SMTP id l10so2864358oag.36 for ; Fri, 28 Sep 2012 00:29:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=eUNRI0Z2roWu4GKwN+UAMILAh26ckT4K8S3QNRwca3E=; b=Z3HQ4moN1qpsuBkKRq3y15tJCr6tFdHprNJw+aI2Ctxy3nC2815pJNav72yawLHcy1 QkpheczeDa+JWkYGgP0JHtufD5uexrRcl+ssFiWZrHDUP6TrcW+KQQkaLuGDfzoITOMY T9L0FKJnFYcx0ROztO1vHh80bdbVjKl5+phempvEWgDcfQ91UyIo/f5zLOaGdcmrhhn2 0BLmxGEsKGwGy07YioCe2FF9cM19z4HSrWOZV/yA/ri8pJi6N4DFGAwSTA2/BUm33Vx1 BA9pWhgHgGSq8rpaDy+pW209HoOO1IWRkHh7w05mEdNW6ECkO7bwfmrZaBli9EVyoHnh Zj8A== Received: by 10.60.170.241 with SMTP id ap17mr5341998oec.4.1348817390314; Fri, 28 Sep 2012 00:29:50 -0700 (PDT) Received: from localhost (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id th3sm7804592obb.6.2012.09.28.00.29.48 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 28 Sep 2012 00:29:49 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org Subject: [PATCH] dma-buf: might_sleep() in dma_buf_unmap_attachment() Date: Fri, 28 Sep 2012 09:29:43 +0200 Message-Id: <1348817383-30286-1-git-send-email-rob.clark@linaro.org> X-Mailer: git-send-email 1.7.9.5 Cc: daniel.vetter@ffwll.ch, Rob Clark , sumit.semwal@linaro.org, patches@linaro.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: Rob Clark We never really clarified if unmap could be done in atomic context. But since mapping might require sleeping, this implies mutex in use to synchronize mapping/unmapping, so unmap could sleep as well. Add a might_sleep() to clarify this. Signed-off-by: Rob Clark Acked-by: Daniel Vetter Reviewed-by: Maarten Lankhorst --- drivers/base/dma-buf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c index c30f3e1..877eacb 100644 --- a/drivers/base/dma-buf.c +++ b/drivers/base/dma-buf.c @@ -298,6 +298,8 @@ void dma_buf_unmap_attachment(struct dma_buf_attachment *attach, struct sg_table *sg_table, enum dma_data_direction direction) { + might_sleep(); + if (WARN_ON(!attach || !attach->dmabuf || !sg_table)) return;