From patchwork Tue Feb 9 19:48:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 379383 Delivered-To: patches@linaro.org Received: by 2002:a17:906:48d2:0:0:0:0 with SMTP id d18csp695474ejt; Tue, 9 Feb 2021 11:48:25 -0800 (PST) X-Received: by 2002:a17:903:8b:b029:e2:d409:cba2 with SMTP id o11-20020a170903008bb02900e2d409cba2mr11507130pld.79.1612900105535; Tue, 09 Feb 2021 11:48:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612900105; cv=none; d=google.com; s=arc-20160816; b=UxdMtecM9wQBwKcgOzYqfMdcRR9oCZWnQlSkto2n1gShaB7NdR80ApHNFTjvGZ/nB3 zknfdsw92MNpB1OyCKzlDNct7DERsykhWYAnJy9aTe20F5zukRiI0n+VyLDyIPYtP4sV pBOVTz8YW/t4NVRItRtn8L+rhTQ5euPgj8P/2iDMkS/zB4NfICMOxvnGGVwNeQygN0hK W5nGD1oiTaFjPiIIwN84JF4KZjv5yFlkB/sCPnLSYmJQA28qQdNRAtl7uDsnjbjb95Vp qBLXLvJIE6L3rnl6Iyu4Y1g2bfsBvDI45YJvi7SwiRtct7jrxVWJTNbBkmJWu7rZ3Jar /XuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=afF2pHGG502t/84V5YNHmCiVWiQMRNdlEkUy2NZuKx8=; b=XZAyHmHyRoNnXw8sGaYR/sekh5cNsCLhTfIcYA9frfmhoVzoqHWz19wSiyuXAWxlpE /2tyH5bTV5NY97K6qA1K5erFFRC1rl2xYbcEfK9JwZqnkNessytDgWkDiL2AcQi7bvR/ sUc6PgWzBu/lWQUVx9+8pOoZ/YB794SCny0GG4kVWxRrW3K3EBMmFWxFzSwt/M6iaqOf XkJup5pQybHUxyZC2/aTAZ/GNgjXXrLOQEDFW9kEwalCssgJgnj3F4kaKpLo0FBEqVKb w53YBYWfatbwqkLgfY/0rgVfzsucY6PgtLXT6oNYdvrRJp1XyJWEQ8zbu1kkce0tH5BJ WnCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yRaJ+PJ+; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id jz15sor1968959pjb.7.2021.02.09.11.48.25 for (Google Transport Security); Tue, 09 Feb 2021 11:48:25 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yRaJ+PJ+; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=afF2pHGG502t/84V5YNHmCiVWiQMRNdlEkUy2NZuKx8=; b=yRaJ+PJ+E44+mqB5LJcQUiR6volXPqvWk7B54rrcPwNuggp7DXthL43qFxwiJaIthR HStcVglg8xIqrW9BKyqY4zPS+KQ0Ooh89+0ENhwQP/mK/2f/dJkzbd0fjdZhCmnkeTXo zrtDpP/gAUVndHlTx7IIiuhwXwmlOFXBS7Bp/wO0+I2Qwc/ntb7r3kP5blH+FynCJPxW v/M0ClZzR6U0x6nA2IolnjcozeqdJh+39gOMTpMFIaVj+ga+r7/IJCccxiPETvn5thso CvDoN0CfebHTczcBATJwgu0i8jhadc+FJUgjcdcpw6+/P9dFdvZFH4xBDmtKhcs++J9/ i/Sg== 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:mime-version :content-transfer-encoding; bh=afF2pHGG502t/84V5YNHmCiVWiQMRNdlEkUy2NZuKx8=; b=IFuJ+m9Z4MRGVDZisS4fmSVKfbivHIm3NIivWHxSFPeSWgZOrnopEa+bPhlZVvXZWc Sc7CWcoeJpKs7Js/7v5ji+x1x+1MQXLkAycT0EzP49BQSK21GSL5DOL8ja9PpLghv/Sh G5xWBckRx8/VdfKQvqfpquzokXvWImCqWQvQ5qPd45+ewEzULaf/LhQ1BvLyMFHwaMKd V4iPuCvpeofMstByLjYSGSRvIB2zYT9yHSYQR808iyPF0LZkFJDpZRigeNM4ZtWp9wL8 P5oJxo8rSFTkJz0+j8isMRd1woLy+ijTHVjQO4/bw9sVa6T3AHP0BC8huoeWzPnAauC8 H6cA== X-Gm-Message-State: AOAM532li3bSpmWkZ6uBJzhZxFCVjfTbW31Hoqs5oe07+5QvL7VLYF7g U7BLDeS7d45EJlRAP8X1TrUATFQ8Q0iLXXA7 X-Google-Smtp-Source: ABdhPJykD/cVLPq3p06Nm/JMKvPVGXYlG9cVWzIEFPq4tJeqUZX+9Dn/vzf27apxe3n4hL48CaR0Sw== X-Received: by 2002:a17:90a:4588:: with SMTP id v8mr5562008pjg.58.1612900105090; Tue, 09 Feb 2021 11:48:25 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j17sm22365836pfh.183.2021.02.09.11.48.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Feb 2021 11:48:24 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Daniel Vetter , Sumit Semwal , Liam Mark , Chris Goldsworthy , Laura Abbott , Brian Starkey , Hridya Valsaraju , Suren Baghdasaryan , Sandeep Patil , Daniel Mentz , =?utf-8?q?=C3=98rjan_Eide?= , Robin Murphy , Ezequiel Garcia , Simon Ser , James Jones , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 1/2] dma-buf: dma-heap: Provide accessor to get heap name Date: Tue, 9 Feb 2021 19:48:17 +0000 Message-Id: <20210209194818.2459062-1-john.stultz@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 It can be useful to access the name for the heap, so provide an accessor to do so. Cc: Daniel Vetter Cc: Sumit Semwal Cc: Liam Mark Cc: Chris Goldsworthy Cc: Laura Abbott Cc: Brian Starkey Cc: Hridya Valsaraju Cc: Suren Baghdasaryan Cc: Sandeep Patil Cc: Daniel Mentz Cc: Ørjan Eide Cc: Robin Murphy Cc: Ezequiel Garcia Cc: Simon Ser Cc: James Jones Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Signed-off-by: John Stultz --- v2: * Make sure to use "const char *" as Reported-by: kernel test robot --- drivers/dma-buf/dma-heap.c | 12 ++++++++++++ include/linux/dma-heap.h | 9 +++++++++ 2 files changed, 21 insertions(+) -- 2.25.1 diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c index afd22c9dbdcf..70e410c64c1c 100644 --- a/drivers/dma-buf/dma-heap.c +++ b/drivers/dma-buf/dma-heap.c @@ -190,6 +190,18 @@ void *dma_heap_get_drvdata(struct dma_heap *heap) return heap->priv; } +/** + * dma_heap_get_name() - get heap name + * @heap: DMA-Heap to retrieve private data for + * + * Returns: + * The char* for the heap name. + */ +const char *dma_heap_get_name(struct dma_heap *heap) +{ + return heap->name; +} + struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info) { struct dma_heap *heap, *h, *err_ret; diff --git a/include/linux/dma-heap.h b/include/linux/dma-heap.h index 454e354d1ffb..83b8cfb2d760 100644 --- a/include/linux/dma-heap.h +++ b/include/linux/dma-heap.h @@ -50,6 +50,15 @@ struct dma_heap_export_info { */ void *dma_heap_get_drvdata(struct dma_heap *heap); +/** + * dma_heap_get_name() - get heap name + * @heap: DMA-Heap to retrieve private data for + * + * Returns: + * The char* for the heap name. + */ +const char *dma_heap_get_name(struct dma_heap *heap); + /** * dma_heap_add - adds a heap to dmabuf heaps * @exp_info: information needed to register this heap From patchwork Tue Feb 9 19:48:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 379384 Delivered-To: patches@linaro.org Received: by 2002:a17:906:48d2:0:0:0:0 with SMTP id d18csp695497ejt; Tue, 9 Feb 2021 11:48:27 -0800 (PST) X-Received: by 2002:a17:90a:5318:: with SMTP id x24mr5747789pjh.226.1612900107281; Tue, 09 Feb 2021 11:48:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612900107; cv=none; d=google.com; s=arc-20160816; b=aJqZ4MwDMHtezFFRV/N7HuNX+/iTjDmOoKZ0MBaC7d/Bp3OLx9HbgLW3wPCXgGzr3C aUnLEgmN1GIIDB22/qIFGQdw/3q9XzWr0146p6cflbVtDghe25amsML2OhKVrHnsTWx7 Acempf3fBwAyTRXekhTqLCg0fma8RVfme3xOmaRNTYJu6aJUyVwF31vRheM29nIVczO4 O3SFVUdp5Abka3aDLszIMA8hKpuDkIf+MNbU/1WjPRqvvG9QPVqm6TWN+A9t/D6QBmk8 1r3b8zJ0JN2HXKg494pX0Qi5WQLbo5zUSiOFNi+T8blpu7s2FZ3WqRBRYFKNRHxVQD3u Omjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=ysXoxmHGWekWNyITP0f9QwT2Iyo77pJXB4WoqmtP4Co=; b=H7J+Cz+dbtplOZThGGb9grUjHzmKlMcQbzanI/ZRdqvodUn7loKVWCX8oAASCvuBB4 xH4MeV/mPBzStduIEW9LA+t06pOrdaezNFWe0yKfy7WvYnVr0R+NyBsfTp4hwFRh6jzH 51lstgIWRq6rkA6AQYE0S8U1tFncgnP3mnH5gWZSwu480MlGCNwjfiAXsiH1Rmhm3sgm onKL93DIs6fe5qLR/qxUviMFxDgwNT3PJVn8X8uT8nLx5GrijMQi2xjFsDcIDcFONf2Q H/nddERfOiCzMPJyFExhKj1L1oaIE+0uoNiIP0SkfLe0V3/DZeI+8fLtXYoFXFVTHHUp /qxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AsJEwfac; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id e29sor10960226pfj.55.2021.02.09.11.48.27 for (Google Transport Security); Tue, 09 Feb 2021 11:48:27 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AsJEwfac; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ysXoxmHGWekWNyITP0f9QwT2Iyo77pJXB4WoqmtP4Co=; b=AsJEwfacT50dzlHJesYHyvPMmGevTS+ag8BhYTlHlCJ+z3e0U27w5lWhFvWXNw7K8p zjYspoGmCqgQYQJwbFzTIIhNSHhbb5GUcYIAxQIAz1PYnBg+ZXtkZlhyChFBnWXgJxXH 688qnGvDFa3ydexIBy6mU/hvuFDcrqljXxSyISZMOdRAlYG+dSio7eFkfQVYl34a2I+a yXJsmt1Esb3/IQ5Fl7WoidYkFMmEZNI7ozgOogtAlXgZ4bTjmV51W7t0QlKszQ2Sm3CS s3aT36pWaoZpeWiP7FYlxNQ/p8szINRxpSNZ045YUXExUAc6iM6vk99/GBEjfjkV1t1P 9Pag== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=ysXoxmHGWekWNyITP0f9QwT2Iyo77pJXB4WoqmtP4Co=; b=s1PMMrADxyNBrOoSu2wqYrCM45h0HnyLtj35cW0Ooms1/+eRBc9LnSv6KMqn0OJhRT O4VhxZi7Ieck27xBJgX0abuQMXHaVscYua6XeeIb06yRCV9+ziBrd/3GHe+Ks2qphe5+ 8NnvdEpxF0t3QGD0QRRDggXzlzSOtbb7Kan2C4/O1oZqPL/hsB2AGD7KtxTplY6A0GX+ 4i+lY2BxUIhawMYuTe7dS0n8GpeS8SNe6yNF2EC4Y9XqmM6gRBOe8n7MdMiuIfVolRjp IGdr4PLZcDPUQWqBlEOAbjiQ1k30RAWaQRJoeYjQuAVS4bD8o3MMe0Ln+ojs+Ian4P9T IkUA== X-Gm-Message-State: AOAM532ETmV1h4v1yKUN5AO7V6ubzmXQbwvGvr+N86zLs8qxLeVRwjZT 9z4vigfPB7oGDmIR6COcK7c0uJ5U X-Google-Smtp-Source: ABdhPJzbnY58mnNBjT7Di/zQColXsY24/57OAsMRe1ZHW4yoCGkME/b6oR4C3hpIJMQURcXm2cyODA== X-Received: by 2002:a62:5ec5:0:b029:1ae:6847:fa02 with SMTP id s188-20020a625ec50000b02901ae6847fa02mr24453587pfb.61.1612900106860; Tue, 09 Feb 2021 11:48:26 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j17sm22365836pfh.183.2021.02.09.11.48.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Feb 2021 11:48:26 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Daniel Vetter , Sumit Semwal , Liam Mark , Chris Goldsworthy , Laura Abbott , Brian Starkey , Hridya Valsaraju , Suren Baghdasaryan , Sandeep Patil , Daniel Mentz , =?utf-8?q?=C3=98rjan_Eide?= , Robin Murphy , Ezequiel Garcia , Simon Ser , James Jones , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 2/2] dma-buf: heaps: Fix the name used when exporting dmabufs to be the actual heap name Date: Tue, 9 Feb 2021 19:48:18 +0000 Message-Id: <20210209194818.2459062-2-john.stultz@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210209194818.2459062-1-john.stultz@linaro.org> References: <20210209194818.2459062-1-john.stultz@linaro.org> MIME-Version: 1.0 By default dma_buf_export() sets the exporter name to be KBUILD_MODNAME. Unfortunately this may not be identical to the string used as the heap name (ie: "system" vs "system_heap"). This can cause some minor confusion with tooling, and there is the future potential where multiple heap types may be exported by the same module (but would all have the same name). So to avoid all this, set the exporter exp_name to the heap name. Cc: Daniel Vetter Cc: Sumit Semwal Cc: Liam Mark Cc: Chris Goldsworthy Cc: Laura Abbott Cc: Brian Starkey Cc: Hridya Valsaraju Cc: Suren Baghdasaryan Cc: Sandeep Patil Cc: Daniel Mentz Cc: Ørjan Eide Cc: Robin Murphy Cc: Ezequiel Garcia Cc: Simon Ser Cc: James Jones Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Signed-off-by: John Stultz --- drivers/dma-buf/heaps/cma_heap.c | 1 + drivers/dma-buf/heaps/system_heap.c | 1 + 2 files changed, 2 insertions(+) -- 2.25.1 diff --git a/drivers/dma-buf/heaps/cma_heap.c b/drivers/dma-buf/heaps/cma_heap.c index 364fc2f3e499..62465d61ccc7 100644 --- a/drivers/dma-buf/heaps/cma_heap.c +++ b/drivers/dma-buf/heaps/cma_heap.c @@ -339,6 +339,7 @@ static int cma_heap_allocate(struct dma_heap *heap, buffer->pagecount = pagecount; /* create the dmabuf */ + exp_info.exp_name = dma_heap_get_name(heap); exp_info.ops = &cma_heap_buf_ops; exp_info.size = buffer->len; exp_info.flags = fd_flags; diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c index 17e0e9a68baf..2d4afc79c700 100644 --- a/drivers/dma-buf/heaps/system_heap.c +++ b/drivers/dma-buf/heaps/system_heap.c @@ -388,6 +388,7 @@ static int system_heap_allocate(struct dma_heap *heap, } /* create the dmabuf */ + exp_info.exp_name = dma_heap_get_name(heap); exp_info.ops = &system_heap_buf_ops; exp_info.size = buffer->len; exp_info.flags = fd_flags;