mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 02:22:34 +03:00
gpu: nvgpu: remove usage of __must_check
Remove the usage of __must_check compiler directive. Also rename __user as nvgpu_user and make the required changes for linux and posix builds. Jira NVGPU-4903 Change-Id: If4a18761cca84eb12e0babc0d528666673fca9e8 Signed-off-by: ajesh <akv@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2283404 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2019, NVIDIA CORPORATION. All Rights Reserved.
|
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Linux elements and units in nvgpu.
|
# Linux elements and units in nvgpu.
|
||||||
#
|
#
|
||||||
@@ -232,6 +232,7 @@ headers:
|
|||||||
include/nvgpu/linux/sim_pci.h,
|
include/nvgpu/linux/sim_pci.h,
|
||||||
include/nvgpu/linux/thread.h,
|
include/nvgpu/linux/thread.h,
|
||||||
include/nvgpu/linux/log.h,
|
include/nvgpu/linux/log.h,
|
||||||
|
include/nvgpu/linux/utils.h,
|
||||||
include/nvgpu/linux/vm.h ]
|
include/nvgpu/linux/vm.h ]
|
||||||
|
|
||||||
# An extra unit to lump all the unclassified Linux files.
|
# An extra unit to lump all the unclassified Linux files.
|
||||||
|
|||||||
@@ -831,7 +831,7 @@ static void gk20a_free_cb(struct nvgpu_ref *refcount)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct gk20a * __must_check nvgpu_get(struct gk20a *g)
|
struct gk20a *nvgpu_get(struct gk20a *g)
|
||||||
{
|
{
|
||||||
int success;
|
int success;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
*
|
*
|
||||||
* Nvgpu Channel Synchronization Abstraction (Semaphore)
|
* Nvgpu Channel Synchronization Abstraction (Semaphore)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -37,7 +37,7 @@ struct nvgpu_channel_sync_semaphore;
|
|||||||
* Converts a valid struct nvgpu_channel_sync ptr to
|
* Converts a valid struct nvgpu_channel_sync ptr to
|
||||||
* struct nvgpu_channel_sync_semaphore ptr else return NULL.
|
* struct nvgpu_channel_sync_semaphore ptr else return NULL.
|
||||||
*/
|
*/
|
||||||
struct nvgpu_channel_sync_semaphore * __must_check
|
struct nvgpu_channel_sync_semaphore *
|
||||||
nvgpu_channel_sync_to_semaphore(struct nvgpu_channel_sync *sync);
|
nvgpu_channel_sync_to_semaphore(struct nvgpu_channel_sync *sync);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ struct railgate_stats {
|
|||||||
#define MAX_TPC_PG_CONFIGS 9
|
#define MAX_TPC_PG_CONFIGS 9
|
||||||
|
|
||||||
struct nvgpu_gpfifo_userdata {
|
struct nvgpu_gpfifo_userdata {
|
||||||
struct nvgpu_gpfifo_entry __user *entries;
|
struct nvgpu_gpfifo_entry nvgpu_user *entries;
|
||||||
struct _resmgr_context *context;
|
struct _resmgr_context *context;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -99,7 +99,7 @@ static inline int nvgpu_ref_put_return(struct nvgpu_ref *ref,
|
|||||||
* @ref: the nvgpu_ref object
|
* @ref: the nvgpu_ref object
|
||||||
* Return non-zero if the increment succeeds, Otherwise return 0.
|
* Return non-zero if the increment succeeds, Otherwise return 0.
|
||||||
*/
|
*/
|
||||||
static inline int __must_check nvgpu_ref_get_unless_zero(struct nvgpu_ref *ref)
|
static inline int nvgpu_ref_get_unless_zero(struct nvgpu_ref *ref)
|
||||||
{
|
{
|
||||||
return nvgpu_atomic_add_unless(&ref->refcount, 1, 0);
|
return nvgpu_atomic_add_unless(&ref->refcount, 1, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
25
drivers/gpu/nvgpu/include/nvgpu/linux/utils.h
Normal file
25
drivers/gpu/nvgpu/include/nvgpu/linux/utils.h
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __NVGPU_UTILS_LINUX_H__
|
||||||
|
#define __NVGPU_UTILS_LINUX_H__
|
||||||
|
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
|
||||||
|
/** User memory macro. */
|
||||||
|
#define nvgpu_user __user
|
||||||
|
|
||||||
|
#endif /* __NVGPU_UTILS_LINUX_H__ */
|
||||||
@@ -466,20 +466,8 @@ static inline unsigned int nvgpu_posix_hweight64(uint64_t x)
|
|||||||
/** Hamming weight of 64 bit input value. */
|
/** Hamming weight of 64 bit input value. */
|
||||||
#define hweight_long nvgpu_posix_hweight64
|
#define hweight_long nvgpu_posix_hweight64
|
||||||
|
|
||||||
/*
|
/** Dummy macro to match kernel names. */
|
||||||
* Better suited under a compiler.h type header file, but for now these can live
|
#define nvgpu_user
|
||||||
* here.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Compiler extension directive to ensure that a return value is checked. */
|
|
||||||
#define __must_check __attribute__((warn_unused_result))
|
|
||||||
|
|
||||||
#ifndef __user
|
|
||||||
/** Defined to match kernel macro names. */
|
|
||||||
#define __user
|
|
||||||
#else
|
|
||||||
#error "__user already defined !!"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Defined to match kernel macro names. */
|
/** Defined to match kernel macro names. */
|
||||||
#define unlikely(x) (x)
|
#define unlikely(x) (x)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
#include <nvgpu/static_analysis.h>
|
#include <nvgpu/static_analysis.h>
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
#include <linux/kernel.h>
|
#include <nvgpu/linux/utils.h>
|
||||||
#else
|
#else
|
||||||
#include <nvgpu/posix/utils.h>
|
#include <nvgpu/posix/utils.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -29,7 +29,7 @@ int nvgpu_init_gpu_characteristics(struct gk20a *g)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct gk20a * __must_check nvgpu_get(struct gk20a *g)
|
struct gk20a *nvgpu_get(struct gk20a *g)
|
||||||
{
|
{
|
||||||
BUG();
|
BUG();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* NVGPU Public Interface Header
|
* NVGPU Public Interface Header
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011-2019, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2011-2020, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#if !defined(__KERNEL__)
|
#if !defined(__KERNEL__)
|
||||||
#define __user
|
#define __user
|
||||||
|
#define nvgpu_user
|
||||||
|
|
||||||
/* Some userspace builds have __packed defined already */
|
/* Some userspace builds have __packed defined already */
|
||||||
#if !defined(__packed)
|
#if !defined(__packed)
|
||||||
|
|||||||
Reference in New Issue
Block a user