hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/vfio/mdev/mdev_sysfs.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * File attributes for Mediated devices
34 *
45 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
56 * Author: Neo Jia <cjia@nvidia.com>
67 * Kirti Wankhede <kwankhede@nvidia.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
118 */
129
1310 #include <linux/sysfs.h>
....@@ -55,7 +52,7 @@
5552 const char *buf, size_t count)
5653 {
5754 char *str;
58
- uuid_le uuid;
55
+ guid_t uuid;
5956 int ret;
6057
6158 if ((count < UUID_STRING_LEN) || (count > UUID_STRING_LEN + 1))
....@@ -65,19 +62,19 @@
6562 if (!str)
6663 return -ENOMEM;
6764
68
- ret = uuid_le_to_bin(str, &uuid);
65
+ ret = guid_parse(str, &uuid);
6966 kfree(str);
7067 if (ret)
7168 return ret;
7269
73
- ret = mdev_device_create(kobj, dev, uuid);
70
+ ret = mdev_device_create(kobj, dev, &uuid);
7471 if (ret)
7572 return ret;
7673
7774 return count;
7875 }
7976
80
-MDEV_TYPE_ATTR_WO(create);
77
+static MDEV_TYPE_ATTR_WO(create);
8178
8279 static void mdev_type_release(struct kobject *kobj)
8380 {
....@@ -92,8 +89,8 @@
9289 .release = mdev_type_release,
9390 };
9491
95
-struct mdev_type *add_mdev_supported_type(struct mdev_parent *parent,
96
- struct attribute_group *group)
92
+static struct mdev_type *add_mdev_supported_type(struct mdev_parent *parent,
93
+ struct attribute_group *group)
9794 {
9895 struct mdev_type *type;
9996 int ret;
....@@ -236,11 +233,9 @@
236233 if (val && device_remove_file_self(dev, attr)) {
237234 int ret;
238235
239
- ret = mdev_device_remove(dev, false);
240
- if (ret) {
241
- device_create_file(dev, attr);
236
+ ret = mdev_device_remove(dev);
237
+ if (ret)
242238 return ret;
243
- }
244239 }
245240
246241 return count;