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: 11836 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 3496823E42 for ; Fri, 28 Sep 2012 07:29:52 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id D3CD4A18C66 for ; Fri, 28 Sep 2012 07:29:51 +0000 (UTC) Received: by ieje10 with SMTP id e10so6254867iej.11 for ; Fri, 28 Sep 2012 00:29:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :dkim-signature:sender:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=eUNRI0Z2roWu4GKwN+UAMILAh26ckT4K8S3QNRwca3E=; b=XrvTkwdZDTBkdFbrO1FtuQS3LCtXkK9VqWtwggGowMFo/oXchtuqFdCasLldH2LuMU trd7hgYB+Odxv0xyMBKQExyFdLPIQSRfShSpRZjSp0vdYEe2WQ7/4AanTzz7aMV3OHIu mF9wGeYN5Cmy9iQd17Mn1/g2cun5U49Gz6WP3VdP7rsQ+l0wP/l4/iIMtCEDtEung3GG wupV2OHXKkMYaxWRpMYMgkPVk+hMIvb80+LmaDvtoZdZlh1piNg2l0gkh8Lp5GZNwxuV XYeBUEv39qhlJCOkkpEAqjVOruK6xWk5SXnM84Vm1M9NOY417FlYh2z0aJKGofVgYA4k GZTg== Received: by 10.50.194.136 with SMTP id hw8mr332287igc.28.1348817391227; Fri, 28 Sep 2012 00:29:51 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp456705igc; Fri, 28 Sep 2012 00:29:50 -0700 (PDT) Received: by 10.60.31.102 with SMTP id z6mr5101614oeh.42.1348817390754; Fri, 28 Sep 2012 00:29:50 -0700 (PDT) Received: from mail-oa0-f50.google.com (mail-oa0-f50.google.com [209.85.219.50]) by mx.google.com with ESMTPS id ym2si9075442obb.195.2012.09.28.00.29.50 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 28 Sep 2012 00:29:50 -0700 (PDT) Received-SPF: pass (google.com: domain of robdclark@gmail.com designates 209.85.219.50 as permitted sender) client-ip=209.85.219.50; Authentication-Results: mx.google.com; spf=pass (google.com: domain of robdclark@gmail.com designates 209.85.219.50 as permitted sender) smtp.mail=robdclark@gmail.com; dkim=pass header.i=@gmail.com Received: by oagn16 with SMTP id n16so3281851oag.37 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) Sender: Rob Clark From: Rob Clark To: dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org Cc: patches@linaro.org, daniel.vetter@ffwll.ch, sumit.semwal@linaro.org, maarten.lankhorst@canonical.com, Rob Clark 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 X-Gm-Message-State: ALoCoQnU3MkQBBj+ocaPbr8swB8FyzP12+bX9gvo190Y4W/6Vv/h0tWkTcMzKGgvhKFLsDnCUjCx 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;