From 627a933da5462b3471a1b3901d6f050a12fa81b7 Mon Sep 17 00:00:00 2001 From: Shashank Singh Date: Tue, 11 Jun 2019 17:26:07 +0530 Subject: [PATCH] gpu: nvgpu: Unify posix sort unit with qnx -Unify sort function with qnx as qsort is posix compliant. -Update yaml accordingly. Jira NVGPU-3625 Change-Id: I982570bccb3bc8720596bfacf48eb17a0fca2ddf Signed-off-by: Shashank Singh Reviewed-on: https://git-master.nvidia.com/r/2134355 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Vaibhav Kachore Reviewed-by: mobile promotions Tested-by: mobile promotions --- arch/nvgpu-posix.yaml | 7 ++++++- drivers/gpu/nvgpu/include/nvgpu/posix/sort.h | 4 ++-- drivers/gpu/nvgpu/include/nvgpu/sort.h | 6 ++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/arch/nvgpu-posix.yaml b/arch/nvgpu-posix.yaml index ed26d7a00..31e5a7ecf 100644 --- a/arch/nvgpu-posix.yaml +++ b/arch/nvgpu-posix.yaml @@ -48,10 +48,15 @@ headers: include/nvgpu/posix/posix-fault-injection.h, include/nvgpu/posix/probe.h, include/nvgpu/posix/soc_fuse.h, - include/nvgpu/posix/sort.h, include/nvgpu/posix/vm.h, include/nvgpu/posix/posix_vidmem.h ] +sort: + safe: yes + owner: Ajesh K + sources: [ include/nvgpu/posix/sort.h ] + deps: + bug: safe: yes owner: Ajesh K diff --git a/drivers/gpu/nvgpu/include/nvgpu/posix/sort.h b/drivers/gpu/nvgpu/include/nvgpu/posix/sort.h index 6572c75eb..60a5058fb 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/posix/sort.h +++ b/drivers/gpu/nvgpu/include/nvgpu/posix/sort.h @@ -23,13 +23,13 @@ #ifndef NVGPU_POSIX_SORT_H #define NVGPU_POSIX_SORT_H -#include +#include static void sort(void *base, size_t num, size_t size, int (*cmp)(const void *a, const void *b), void (*swap)(void *a, void *b, int n)) { - nvgpu_posix_bug("sort() not implemented yet!"); + qsort(base, num, size, cmp); } #endif /* NVGPU_POSIX_SORT_H */ diff --git a/drivers/gpu/nvgpu/include/nvgpu/sort.h b/drivers/gpu/nvgpu/include/nvgpu/sort.h index 80bae4b55..2ad62fd75 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/sort.h +++ b/drivers/gpu/nvgpu/include/nvgpu/sort.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -24,10 +24,8 @@ #ifdef __KERNEL__ #include -#elif defined(__NVGPU_POSIX__) -#include #else -#include +#include #endif #endif /* NVGPU_SORT_H */