From 16b7d0418a171df01b7a02f7b03f598b0452cb7d Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Tue, 23 Nov 2021 21:10:03 +0000 Subject: [PATCH] video: tegra: nvdla: Don't use nvhost print macros The NVDLA driver uses the nvhost_err() and nvhost_dbg_fn() macros which simply call dev_err() and dev_info(), respectively. When compiling the NVDLA driver against an upstream Linux kernel, nvhost_err() and nvhost_dbg_fn() are not found and compilation fails. Fix this by replacing nvhost_err() with either dev_err() or pr_err() and replace nvhost_dbg_fn() with nvdla_dbg_fn(). JIRA LS-410 Change-Id: Ib89a187f330a4a80bd0b0329171a02f6336565ff Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2643161 Reviewed-by: Arvind M Reviewed-by: svc_kernel_abi Reviewed-by: Amit Sharma (SW-TEGRA) Reviewed-by: Praveen K Reviewed-by: Bharat Nihalani Reviewed-by: mobile promotions Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/video/tegra/host/nvdla/dla_queue.c | 29 +++++++++---------- drivers/video/tegra/host/nvdla/nvdla_buffer.c | 7 ++--- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/video/tegra/host/nvdla/dla_queue.c b/drivers/video/tegra/host/nvdla/dla_queue.c index b9216349..8e6c5857 100644 --- a/drivers/video/tegra/host/nvdla/dla_queue.c +++ b/drivers/video/tegra/host/nvdla/dla_queue.c @@ -29,7 +29,7 @@ #include "nvhost_channel.h" #include "nvhost_job.h" #include "dla_queue.h" -#include "dev.h" +#include "nvdla_debug.h" #define CMDBUF_SIZE 4096 @@ -77,8 +77,8 @@ static int nvdla_queue_task_pool_alloc(struct platform_device *pdev, size_t kmem_pool_size = num_tasks * queue->task_kmem_size; task_pool->kmem_addr = vzalloc(kmem_pool_size); if (!task_pool->kmem_addr) { - nvhost_err(&pdev->dev, - "failed to allocate task_pool->kmem_addr"); + dev_err(&pdev->dev, + "failed to allocate task_pool->kmem_addr\n"); err = -ENOMEM; goto err_alloc_task_kmem; } @@ -91,7 +91,7 @@ static int nvdla_queue_task_pool_alloc(struct platform_device *pdev, 0); if (task_pool->va == NULL) { - nvhost_err(&pdev->dev, "failed to allocate task_pool->va"); + dev_err(&pdev->dev, "failed to allocate task_pool->va\n"); err = -ENOMEM; goto err_alloc_task_pool; } @@ -175,14 +175,14 @@ struct nvdla_queue_pool *nvdla_queue_init(struct platform_device *pdev, pool = kzalloc(sizeof(struct nvdla_queue_pool), GFP_KERNEL); if (pool == NULL) { - nvhost_err(&pdev->dev, "failed to allocate queue pool"); + dev_err(&pdev->dev, "failed to allocate queue pool\n"); err = -ENOMEM; goto fail_alloc_pool; } queues = kcalloc(num_queues, sizeof(struct nvdla_queue), GFP_KERNEL); if (queues == NULL) { - nvhost_err(&pdev->dev, "failed to allocate queues"); + dev_err(&pdev->dev, "failed to allocate queues\n"); err = -ENOMEM; goto fail_alloc_queues; } @@ -190,7 +190,7 @@ struct nvdla_queue_pool *nvdla_queue_init(struct platform_device *pdev, task_pool = kcalloc(num_queues, sizeof(struct nvdla_queue_task_pool), GFP_KERNEL); if (task_pool == NULL) { - nvhost_err(&pdev->dev, "failed to allocate task_pool"); + dev_err(&pdev->dev, "failed to allocate task_pool\n"); err = -ENOMEM; goto fail_alloc_task_pool; } @@ -257,7 +257,7 @@ static void nvdla_queue_release(struct kref *ref) kref); struct nvdla_queue_pool *pool = queue->pool; - nvhost_dbg_fn(""); + nvdla_dbg_fn(pool->pdev, "%s\n", __func__); if (queue->use_channel) nvhost_putchannel(queue->channel, 1); @@ -277,13 +277,13 @@ static void nvdla_queue_release(struct kref *ref) void nvdla_queue_put(struct nvdla_queue *queue) { - nvhost_dbg_fn(""); + nvdla_dbg_fn(queue->pool->pdev, "%s\n", __func__); kref_put(&queue->kref, nvdla_queue_release); } void nvdla_queue_get(struct nvdla_queue *queue) { - nvhost_dbg_fn(""); + nvdla_dbg_fn(queue->pool->pdev, "%s\n", __func__); kref_get(&queue->kref); } @@ -448,7 +448,7 @@ int nvdla_queue_submit_to_host1x(struct nvdla_queue *queue, /* Allocate memory for the task and task command buffer */ task = kzalloc(sizeof(*task), GFP_KERNEL); if (task == NULL) { - nvhost_err(&client_pdev->dev, "failed to allocate task"); + dev_err(&client_pdev->dev, "failed to allocate task\n"); goto err_alloc_task; } @@ -457,7 +457,7 @@ int nvdla_queue_submit_to_host1x(struct nvdla_queue *queue, &task->dma_addr, GFP_KERNEL); if (task->cpu_addr == NULL) { - nvhost_err(&client_pdev->dev, "failed to allocate task"); + dev_err(&client_pdev->dev, "failed to allocate task\n"); err = -ENOMEM; goto err_alloc_cmdbuf; } @@ -512,9 +512,8 @@ int nvdla_queue_submit_to_host1x(struct nvdla_queue *queue, job->sp->fence, queue_task_update, task); if (err < 0) { - nvhost_err(&client_pdev->dev, - "failed to register notifier err=%d", - err); + dev_err(&client_pdev->dev, "failed to register notifier err=%d", + err); goto err_register_notifier; } diff --git a/drivers/video/tegra/host/nvdla/nvdla_buffer.c b/drivers/video/tegra/host/nvdla/nvdla_buffer.c index 2d7b16c3..133dbf7e 100644 --- a/drivers/video/tegra/host/nvdla/nvdla_buffer.c +++ b/drivers/video/tegra/host/nvdla/nvdla_buffer.c @@ -1,7 +1,7 @@ /* * NVHOST buffer management for T194 * - * Copyright (c) 2016-2020, NVIDIA Corporation. All rights reserved. + * Copyright (c) 2016-2021, NVIDIA Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -23,7 +23,6 @@ #include #include -#include "dev.h" #include "nvdla_buffer.h" /** @@ -198,7 +197,7 @@ static void nvdla_free_buffers(struct kref *kref) static void nvdla_buffer_unmap(struct nvdla_buffers *nvdla_buffers, struct nvdla_vm_buffer *vm) { - nvhost_dbg_fn(""); + pr_debug("%s\n", __func__); if ((vm->user_map_count != 0) || (vm->submit_map_count != 0)) return; @@ -307,7 +306,7 @@ int nvdla_buffer_pin(struct nvdla_buffers *nvdla_buffers, vm = kzalloc(sizeof(struct nvdla_vm_buffer), GFP_KERNEL); if (!vm) { - nvhost_err(NULL, "could not allocate vm_buffer"); + pr_err("%s: could not allocate vm_buffer\n", __func__); goto unpin; }