From patchwork Wed Mar 9 08:54:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 63708 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2526565lbc; Wed, 9 Mar 2016 00:54:17 -0800 (PST) X-Received: by 10.98.80.150 with SMTP id g22mr48754675pfj.132.1457513657360; Wed, 09 Mar 2016 00:54:17 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64si11060450pfi.163.2016.03.09.00.54.17; Wed, 09 Mar 2016 00:54:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752798AbcCIIyP (ORCPT + 4 others); Wed, 9 Mar 2016 03:54:15 -0500 Received: from mail-wm0-f43.google.com ([74.125.82.43]:37853 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752425AbcCIIyP (ORCPT ); Wed, 9 Mar 2016 03:54:15 -0500 Received: by mail-wm0-f43.google.com with SMTP id p65so61000095wmp.0 for ; Wed, 09 Mar 2016 00:54:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=tmQFbfb6sGWpTuSqZ4tKm/5VDNYtnHtPNteXZ3XKhF0=; b=SrF+EfC2cPTDvD62nblR3C9HZtN14PzzaeeZn1oi47qD2fPbxJN+UpPWuJqvHsXi1D Kh7AfjjOmK/fhf/v/6e07fqdWMpcuO+bnEExahunJmf+3XrsLZghYhcHdY6Jzsw/AHYJ lvx4HnI+GihZ+8YwQIfYMgwomMqsTr+IziQXE= 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; bh=tmQFbfb6sGWpTuSqZ4tKm/5VDNYtnHtPNteXZ3XKhF0=; b=VIbZIlllgLVjKA+HkS32UeKaGjJLqBJDoUQn8tSR7FffHS3BQyc97USieHiCkfO1CN 5hrcPgYDrWF4MrCPFMpjT86MzChYhJ+aSZRtE6mlli1OGuHcsSGSbYHmRh/ospGMHLGT lFW7CydiWQbOCf+ZT/TtiA7+8O/8DNvbUnewLsZ2ESjwGAK4xgaBzSQeN1oUuWwSLrTC LGUcRfhOPY0DH0XioPOfusatDW1lh4sA8SeURUUn2QWAlQ+JEGC5/cby0yMtd4Q4x5Gj NFxscEuomubgzQ7qRvaHPqTManMV8XCXyPvSa0//8CzEcuOfxggHU7rHjzFzUrD886EL P3tg== X-Gm-Message-State: AD7BkJJkj+TAhS4kK/EVuAheyjCeTTxK3Pt/I2uMiuUeafUYkmWEj7jxintHZ7sNAW2l8SDy X-Received: by 10.28.170.137 with SMTP id t131mr25128135wme.32.1457513653571; Wed, 09 Mar 2016 00:54:13 -0800 (PST) Received: from lmenx321.st.com. ([80.12.42.141]) by smtp.gmail.com with ESMTPSA id i1sm6780212wjs.45.2016.03.09.00.54.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 Mar 2016 00:54:12 -0800 (PST) From: Benjamin Gaignard To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, sumit.semwal@linaro.org, john.stultz@linaro.org Cc: Benjamin Gaignard Subject: [PATCH] dmabuf: allow exporter to define customs ioctls Date: Wed, 9 Mar 2016 09:54:02 +0100 Message-Id: <1457513642-10859-1-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org In addition of the already existing operations allow exporter to use it own custom ioctls. Signed-off-by: Benjamin Gaignard --- drivers/dma-buf/dma-buf.c | 3 +++ include/linux/dma-buf.h | 5 +++++ 2 files changed, 8 insertions(+) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 9810d1d..6abd129 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -291,6 +291,9 @@ static long dma_buf_ioctl(struct file *file, return 0; default: + if (dmabuf->ops->ioctl) + return dmabuf->ops->ioctl(dmabuf, cmd, arg); + return -ENOTTY; } } diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index 532108e..b6f9837 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h @@ -70,6 +70,9 @@ struct dma_buf_attachment; * @vmap: [optional] creates a virtual mapping for the buffer into kernel * address space. Same restrictions as for vmap and friends apply. * @vunmap: [optional] unmaps a vmap from the buffer + * @ioctl: [optional] ioctls supported by the exporter. + * It is up to the exporter to do the proper copy_{from/to}_user + * calls. Should return -EINVAL in case of error. */ struct dma_buf_ops { int (*attach)(struct dma_buf *, struct device *, @@ -104,6 +107,8 @@ struct dma_buf_ops { void *(*vmap)(struct dma_buf *); void (*vunmap)(struct dma_buf *, void *vaddr); + + int (*ioctl)(struct dma_buf *, unsigned int cmd, unsigned long arg); }; /**