dt-bindings: mtd: ingenic: Use standard ecc-engine property
[linux/fpc-iii.git] / drivers / gpu / drm / amd / amdkfd / kfd_module.c
blob932007eb9168e73322b56cc3c4d42227e64d2082
1 /*
2 * Copyright 2014 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
23 #include <linux/sched.h>
24 #include <linux/device.h>
25 #include "kfd_priv.h"
26 #include "amdgpu_amdkfd.h"
28 static int kfd_init(void)
30 int err;
32 /* Verify module parameters */
33 if ((sched_policy < KFD_SCHED_POLICY_HWS) ||
34 (sched_policy > KFD_SCHED_POLICY_NO_HWS)) {
35 pr_err("sched_policy has invalid value\n");
36 return -EINVAL;
39 /* Verify module parameters */
40 if ((max_num_of_queues_per_device < 1) ||
41 (max_num_of_queues_per_device >
42 KFD_MAX_NUM_OF_QUEUES_PER_DEVICE)) {
43 pr_err("max_num_of_queues_per_device must be between 1 to KFD_MAX_NUM_OF_QUEUES_PER_DEVICE\n");
44 return -EINVAL;
47 err = kfd_chardev_init();
48 if (err < 0)
49 goto err_ioctl;
51 err = kfd_topology_init();
52 if (err < 0)
53 goto err_topology;
55 err = kfd_process_create_wq();
56 if (err < 0)
57 goto err_create_wq;
59 kfd_debugfs_init();
61 return 0;
63 err_create_wq:
64 kfd_topology_shutdown();
65 err_topology:
66 kfd_chardev_exit();
67 err_ioctl:
68 return err;
71 static void kfd_exit(void)
73 kfd_debugfs_fini();
74 kfd_process_destroy_wq();
75 kfd_topology_shutdown();
76 kfd_chardev_exit();
79 int kgd2kfd_init()
81 return kfd_init();
84 void kgd2kfd_exit(void)
86 kfd_exit();