summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPritesh Raithatha <praithatha@nvidia.com>2017-04-24 05:06:37 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-05-21 03:02:26 -0400
commitdffc917c67b5973fdcf93348b75488cb256f07cb (patch)
tree184543906827160fb474cb85581a1f32a202b25c
parent0c67d7d220b8c62a5be184004249fe8e0d3a1735 (diff)
tegra: fd: Add wrapper for __alloc_fd
Modules like nvgpu and nvmap should to be able to allocate all open fds and for this they need to call __alloc_fd() rather than alloc_fd. However, as __alloc_fd is not exported to modules, a wrapper is being created and exported to the respective modules. bug 200290850 Change-Id: Id245040842f71aadfc484711a23e8ce9dbfa872f Signed-off-by: Pritesh Raithatha <praithatha@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1701552 GVS: Gerrit_Virtual_Submit Reviewed-by: Sachin Nikam <snikam@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--NVIDIA-REVIEWERS1
-rw-r--r--drivers/platform/tegra/mc/Makefile2
-rw-r--r--drivers/platform/tegra/mc/tegra_fd.c25
-rw-r--r--include/linux/platform/tegra/tegra_fd.h23
4 files changed, 50 insertions, 1 deletions
diff --git a/NVIDIA-REVIEWERS b/NVIDIA-REVIEWERS
index 98b120eb8..eb92a6133 100644
--- a/NVIDIA-REVIEWERS
+++ b/NVIDIA-REVIEWERS
@@ -203,7 +203,6 @@ F: drivers/platform/tegra/iomap_t18x.h
203F: drivers/platform/tegra/mc/* 203F: drivers/platform/tegra/mc/*
204F: drivers/iommu/ 204F: drivers/iommu/
205F: drivers/video/tegra/nvmap/ 205F: drivers/video/tegra/nvmap/
206F: drivers/platform/tegra/mc/
207F: drivers/char/hmm_dmirror.h 206F: drivers/char/hmm_dmirror.h
208F: drivers/char/hmm_dmirror.c 207F: drivers/char/hmm_dmirror.c
209F: include/dt-bindings/memory/ 208F: include/dt-bindings/memory/
diff --git a/drivers/platform/tegra/mc/Makefile b/drivers/platform/tegra/mc/Makefile
index 84aa938c1..cef249be3 100644
--- a/drivers/platform/tegra/mc/Makefile
+++ b/drivers/platform/tegra/mc/Makefile
@@ -30,6 +30,8 @@ obj-y += tegra18_emc.o
30obj-y += tegra18x_la.o 30obj-y += tegra18x_la.o
31obj-y += tegra186-mc-sid.o 31obj-y += tegra186-mc-sid.o
32 32
33obj-y += tegra_fd.o
34
33ifdef CONFIG_ARCH_TEGRA_19x_SOC 35ifdef CONFIG_ARCH_TEGRA_19x_SOC
34 36
35ccflags-y += -Werror 37ccflags-y += -Werror
diff --git a/drivers/platform/tegra/mc/tegra_fd.c b/drivers/platform/tegra/mc/tegra_fd.c
new file mode 100644
index 000000000..fbc019f92
--- /dev/null
+++ b/drivers/platform/tegra/mc/tegra_fd.c
@@ -0,0 +1,25 @@
1/*
2 * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 */
13
14#include <linux/fdtable.h>
15#include <linux/fs.h>
16
17#include <linux/platform/tegra/tegra_fd.h>
18
19/* allocates a free fd within [start, sysctl_nr_open) range */
20int tegra_alloc_fd(struct files_struct *files, unsigned int start,
21 unsigned int flags)
22{
23 return __alloc_fd(files, start, sysctl_nr_open, flags);
24}
25EXPORT_SYMBOL_GPL(tegra_alloc_fd);
diff --git a/include/linux/platform/tegra/tegra_fd.h b/include/linux/platform/tegra/tegra_fd.h
new file mode 100644
index 000000000..c30daa03c
--- /dev/null
+++ b/include/linux/platform/tegra/tegra_fd.h
@@ -0,0 +1,23 @@
1/*
2 * Copyright (C) 2017-2018, NVIDIA Corporation. All rights reserved.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 */
14
15#include <linux/fdtable.h>
16
17#ifndef __TEGRA_FD_H
18#define __TEGRA_FD_H
19
20int tegra_alloc_fd(struct files_struct *files, unsigned int start,
21 unsigned int flags);
22
23#endif