From 9ca395a36577a330ea0b5f93ffd435de2e71f9e0 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Thu, 6 Apr 2017 12:27:24 -0700 Subject: gpu: nvgpu: Move linux specific header files Move the Linux specific header files to include/nvgpu/linux/ to keep the header files more organized. Having tons of Linux specific stuff pollute the top level include seems like a bad idea. Change-Id: I4913429c79d49f91c521021e5c0a613db453006a Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1464074 Reviewed-by: svccoveritychecker Reviewed-by: Konsta Holtta GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/include/nvgpu/kmem.h | 2 +- drivers/gpu/nvgpu/include/nvgpu/kmem_linux.h | 123 --------------------------- drivers/gpu/nvgpu/include/nvgpu/linux/kmem.h | 123 +++++++++++++++++++++++++++ drivers/gpu/nvgpu/include/nvgpu/linux/lock.h | 81 ++++++++++++++++++ drivers/gpu/nvgpu/include/nvgpu/lock.h | 2 +- drivers/gpu/nvgpu/include/nvgpu/lock_linux.h | 81 ------------------ 6 files changed, 206 insertions(+), 206 deletions(-) delete mode 100644 drivers/gpu/nvgpu/include/nvgpu/kmem_linux.h create mode 100644 drivers/gpu/nvgpu/include/nvgpu/linux/kmem.h create mode 100644 drivers/gpu/nvgpu/include/nvgpu/linux/lock.h delete mode 100644 drivers/gpu/nvgpu/include/nvgpu/lock_linux.h (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/include/nvgpu/kmem.h b/drivers/gpu/nvgpu/include/nvgpu/kmem.h index 3159da8b..cfbc0da5 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/kmem.h +++ b/drivers/gpu/nvgpu/include/nvgpu/kmem.h @@ -34,7 +34,7 @@ struct gk20a; * cross OS way of defining the necessary types used by these APIs. Eventually * we will need a include to handle this. */ -#include +#include /** * DOC: Kmem cache support diff --git a/drivers/gpu/nvgpu/include/nvgpu/kmem_linux.h b/drivers/gpu/nvgpu/include/nvgpu/kmem_linux.h deleted file mode 100644 index dbafc0ce..00000000 --- a/drivers/gpu/nvgpu/include/nvgpu/kmem_linux.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2017, 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, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef __NVGPU_KMEM_LINUX_H__ -#define __NVGPU_KMEM_LINUX_H__ - -#include -#include -#include - -#include - -struct gk20a; -struct device; - -#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE -void *__nvgpu_track_vmalloc(struct gk20a *g, unsigned long size, - unsigned long ip); -void *__nvgpu_track_vzalloc(struct gk20a *g, unsigned long size, - unsigned long ip); -void *__nvgpu_track_kmalloc(struct gk20a *g, size_t size, unsigned long ip); -void *__nvgpu_track_kzalloc(struct gk20a *g, size_t size, unsigned long ip); -void *__nvgpu_track_kcalloc(struct gk20a *g, size_t n, size_t size, - unsigned long ip); -void __nvgpu_track_vfree(struct gk20a *g, void *addr); -void __nvgpu_track_kfree(struct gk20a *g, void *addr); - -void nvgpu_kmem_debugfs_init(struct device *dev); -#else -static inline void nvgpu_kmem_debugfs_init(struct device *dev) -{ -} -#endif - -/** - * DOC: Linux pass through kmem implementation. - * - * These are the Linux implementations of the various kmem functions defined by - * nvgpu. This should not be included directly - instead include . - */ - -static inline void *__nvgpu_kmalloc(struct gk20a *g, size_t size, - unsigned long ip) -{ -#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE - return __nvgpu_track_vmalloc(g, size, ip); -#else - return kmalloc(size, GFP_KERNEL); -#endif -} - -static inline void *__nvgpu_kzalloc(struct gk20a *g, size_t size, - unsigned long ip) -{ -#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE - return __nvgpu_track_kzalloc(g, size, ip); -#else - return kzalloc(size, GFP_KERNEL); -#endif -} - -static inline void *__nvgpu_kcalloc(struct gk20a *g, size_t n, size_t size, - unsigned long ip) -{ -#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE - return __nvgpu_track_kcalloc(g, n, size, ip); -#else - return kcalloc(n, size, GFP_KERNEL); -#endif -} - -static inline void *__nvgpu_vmalloc(struct gk20a *g, unsigned long size, - unsigned long ip) -{ -#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE - return __nvgpu_track_vmalloc(g, size, ip); -#else - return vmalloc(size); -#endif -} - -static inline void *__nvgpu_vzalloc(struct gk20a *g, unsigned long size, - unsigned long ip) -{ -#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE - return __nvgpu_track_vzalloc(g, size, ip); -#else - return vzalloc(size); -#endif -} - -static inline void __nvgpu_kfree(struct gk20a *g, void *addr) -{ -#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE - __nvgpu_track_kfree(g, addr); -#else - kfree(addr); -#endif -} - -static inline void __nvgpu_vfree(struct gk20a *g, void *addr) -{ -#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE - __nvgpu_track_vfree(g, addr); -#else - vfree(addr); -#endif -} - -#endif diff --git a/drivers/gpu/nvgpu/include/nvgpu/linux/kmem.h b/drivers/gpu/nvgpu/include/nvgpu/linux/kmem.h new file mode 100644 index 00000000..dbafc0ce --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/linux/kmem.h @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2017, 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, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __NVGPU_KMEM_LINUX_H__ +#define __NVGPU_KMEM_LINUX_H__ + +#include +#include +#include + +#include + +struct gk20a; +struct device; + +#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE +void *__nvgpu_track_vmalloc(struct gk20a *g, unsigned long size, + unsigned long ip); +void *__nvgpu_track_vzalloc(struct gk20a *g, unsigned long size, + unsigned long ip); +void *__nvgpu_track_kmalloc(struct gk20a *g, size_t size, unsigned long ip); +void *__nvgpu_track_kzalloc(struct gk20a *g, size_t size, unsigned long ip); +void *__nvgpu_track_kcalloc(struct gk20a *g, size_t n, size_t size, + unsigned long ip); +void __nvgpu_track_vfree(struct gk20a *g, void *addr); +void __nvgpu_track_kfree(struct gk20a *g, void *addr); + +void nvgpu_kmem_debugfs_init(struct device *dev); +#else +static inline void nvgpu_kmem_debugfs_init(struct device *dev) +{ +} +#endif + +/** + * DOC: Linux pass through kmem implementation. + * + * These are the Linux implementations of the various kmem functions defined by + * nvgpu. This should not be included directly - instead include . + */ + +static inline void *__nvgpu_kmalloc(struct gk20a *g, size_t size, + unsigned long ip) +{ +#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE + return __nvgpu_track_vmalloc(g, size, ip); +#else + return kmalloc(size, GFP_KERNEL); +#endif +} + +static inline void *__nvgpu_kzalloc(struct gk20a *g, size_t size, + unsigned long ip) +{ +#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE + return __nvgpu_track_kzalloc(g, size, ip); +#else + return kzalloc(size, GFP_KERNEL); +#endif +} + +static inline void *__nvgpu_kcalloc(struct gk20a *g, size_t n, size_t size, + unsigned long ip) +{ +#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE + return __nvgpu_track_kcalloc(g, n, size, ip); +#else + return kcalloc(n, size, GFP_KERNEL); +#endif +} + +static inline void *__nvgpu_vmalloc(struct gk20a *g, unsigned long size, + unsigned long ip) +{ +#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE + return __nvgpu_track_vmalloc(g, size, ip); +#else + return vmalloc(size); +#endif +} + +static inline void *__nvgpu_vzalloc(struct gk20a *g, unsigned long size, + unsigned long ip) +{ +#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE + return __nvgpu_track_vzalloc(g, size, ip); +#else + return vzalloc(size); +#endif +} + +static inline void __nvgpu_kfree(struct gk20a *g, void *addr) +{ +#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE + __nvgpu_track_kfree(g, addr); +#else + kfree(addr); +#endif +} + +static inline void __nvgpu_vfree(struct gk20a *g, void *addr) +{ +#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE + __nvgpu_track_vfree(g, addr); +#else + vfree(addr); +#endif +} + +#endif diff --git a/drivers/gpu/nvgpu/include/nvgpu/linux/lock.h b/drivers/gpu/nvgpu/include/nvgpu/linux/lock.h new file mode 100644 index 00000000..fbf26e9d --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/linux/lock.h @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2017, 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, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef NVGPU_LOCK_LINUX_H +#define NVGPU_LOCK_LINUX_H + +#include +#include + +struct nvgpu_mutex { + struct mutex mutex; +}; +struct nvgpu_spinlock { + spinlock_t spinlock; +}; +struct nvgpu_raw_spinlock { + raw_spinlock_t spinlock; +}; + +static inline int nvgpu_mutex_init(struct nvgpu_mutex *mutex) +{ + mutex_init(&mutex->mutex); + return 0; +}; +static inline void nvgpu_mutex_acquire(struct nvgpu_mutex *mutex) +{ + mutex_lock(&mutex->mutex); +}; +static inline void nvgpu_mutex_release(struct nvgpu_mutex *mutex) +{ + mutex_unlock(&mutex->mutex); +}; +static inline int nvgpu_mutex_tryacquire(struct nvgpu_mutex *mutex) +{ + return mutex_trylock(&mutex->mutex); +}; +static inline void nvgpu_mutex_destroy(struct nvgpu_mutex *mutex) +{ + mutex_destroy(&mutex->mutex); +}; + +static inline void nvgpu_spinlock_init(struct nvgpu_spinlock *spinlock) +{ + spin_lock_init(&spinlock->spinlock); +}; +static inline void nvgpu_spinlock_acquire(struct nvgpu_spinlock *spinlock) +{ + spin_lock(&spinlock->spinlock); +}; +static inline void nvgpu_spinlock_release(struct nvgpu_spinlock *spinlock) +{ + spin_unlock(&spinlock->spinlock); +}; + +static inline void nvgpu_raw_spinlock_init(struct nvgpu_raw_spinlock *spinlock) +{ + raw_spin_lock_init(&spinlock->spinlock); +}; +static inline void nvgpu_raw_spinlock_acquire(struct nvgpu_raw_spinlock *spinlock) +{ + raw_spin_lock(&spinlock->spinlock); +}; +static inline void nvgpu_raw_spinlock_release(struct nvgpu_raw_spinlock *spinlock) +{ + raw_spin_unlock(&spinlock->spinlock); +}; + +#endif /* NVGPU_LOCK_LINUX_H */ diff --git a/drivers/gpu/nvgpu/include/nvgpu/lock.h b/drivers/gpu/nvgpu/include/nvgpu/lock.h index ad070380..e9d7e81e 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/lock.h +++ b/drivers/gpu/nvgpu/include/nvgpu/lock.h @@ -17,7 +17,7 @@ #ifndef NVGPU_LOCK_H #define NVGPU_LOCK_H -#include +#include /* * struct nvgpu_mutex diff --git a/drivers/gpu/nvgpu/include/nvgpu/lock_linux.h b/drivers/gpu/nvgpu/include/nvgpu/lock_linux.h deleted file mode 100644 index fbf26e9d..00000000 --- a/drivers/gpu/nvgpu/include/nvgpu/lock_linux.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2017, 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, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef NVGPU_LOCK_LINUX_H -#define NVGPU_LOCK_LINUX_H - -#include -#include - -struct nvgpu_mutex { - struct mutex mutex; -}; -struct nvgpu_spinlock { - spinlock_t spinlock; -}; -struct nvgpu_raw_spinlock { - raw_spinlock_t spinlock; -}; - -static inline int nvgpu_mutex_init(struct nvgpu_mutex *mutex) -{ - mutex_init(&mutex->mutex); - return 0; -}; -static inline void nvgpu_mutex_acquire(struct nvgpu_mutex *mutex) -{ - mutex_lock(&mutex->mutex); -}; -static inline void nvgpu_mutex_release(struct nvgpu_mutex *mutex) -{ - mutex_unlock(&mutex->mutex); -}; -static inline int nvgpu_mutex_tryacquire(struct nvgpu_mutex *mutex) -{ - return mutex_trylock(&mutex->mutex); -}; -static inline void nvgpu_mutex_destroy(struct nvgpu_mutex *mutex) -{ - mutex_destroy(&mutex->mutex); -}; - -static inline void nvgpu_spinlock_init(struct nvgpu_spinlock *spinlock) -{ - spin_lock_init(&spinlock->spinlock); -}; -static inline void nvgpu_spinlock_acquire(struct nvgpu_spinlock *spinlock) -{ - spin_lock(&spinlock->spinlock); -}; -static inline void nvgpu_spinlock_release(struct nvgpu_spinlock *spinlock) -{ - spin_unlock(&spinlock->spinlock); -}; - -static inline void nvgpu_raw_spinlock_init(struct nvgpu_raw_spinlock *spinlock) -{ - raw_spin_lock_init(&spinlock->spinlock); -}; -static inline void nvgpu_raw_spinlock_acquire(struct nvgpu_raw_spinlock *spinlock) -{ - raw_spin_lock(&spinlock->spinlock); -}; -static inline void nvgpu_raw_spinlock_release(struct nvgpu_raw_spinlock *spinlock) -{ - raw_spin_unlock(&spinlock->spinlock); -}; - -#endif /* NVGPU_LOCK_LINUX_H */ -- cgit v1.2.2