| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * File attributes for Mediated devices |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. |
|---|
| 5 | 6 | * Author: Neo Jia <cjia@nvidia.com> |
|---|
| 6 | 7 | * 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. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | |
|---|
| 13 | 10 | #include <linux/sysfs.h> |
|---|
| .. | .. |
|---|
| 55 | 52 | const char *buf, size_t count) |
|---|
| 56 | 53 | { |
|---|
| 57 | 54 | char *str; |
|---|
| 58 | | - uuid_le uuid; |
|---|
| 55 | + guid_t uuid; |
|---|
| 59 | 56 | int ret; |
|---|
| 60 | 57 | |
|---|
| 61 | 58 | if ((count < UUID_STRING_LEN) || (count > UUID_STRING_LEN + 1)) |
|---|
| .. | .. |
|---|
| 65 | 62 | if (!str) |
|---|
| 66 | 63 | return -ENOMEM; |
|---|
| 67 | 64 | |
|---|
| 68 | | - ret = uuid_le_to_bin(str, &uuid); |
|---|
| 65 | + ret = guid_parse(str, &uuid); |
|---|
| 69 | 66 | kfree(str); |
|---|
| 70 | 67 | if (ret) |
|---|
| 71 | 68 | return ret; |
|---|
| 72 | 69 | |
|---|
| 73 | | - ret = mdev_device_create(kobj, dev, uuid); |
|---|
| 70 | + ret = mdev_device_create(kobj, dev, &uuid); |
|---|
| 74 | 71 | if (ret) |
|---|
| 75 | 72 | return ret; |
|---|
| 76 | 73 | |
|---|
| 77 | 74 | return count; |
|---|
| 78 | 75 | } |
|---|
| 79 | 76 | |
|---|
| 80 | | -MDEV_TYPE_ATTR_WO(create); |
|---|
| 77 | +static MDEV_TYPE_ATTR_WO(create); |
|---|
| 81 | 78 | |
|---|
| 82 | 79 | static void mdev_type_release(struct kobject *kobj) |
|---|
| 83 | 80 | { |
|---|
| .. | .. |
|---|
| 92 | 89 | .release = mdev_type_release, |
|---|
| 93 | 90 | }; |
|---|
| 94 | 91 | |
|---|
| 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) |
|---|
| 97 | 94 | { |
|---|
| 98 | 95 | struct mdev_type *type; |
|---|
| 99 | 96 | int ret; |
|---|
| .. | .. |
|---|
| 236 | 233 | if (val && device_remove_file_self(dev, attr)) { |
|---|
| 237 | 234 | int ret; |
|---|
| 238 | 235 | |
|---|
| 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) |
|---|
| 242 | 238 | return ret; |
|---|
| 243 | | - } |
|---|
| 244 | 239 | } |
|---|
| 245 | 240 | |
|---|
| 246 | 241 | return count; |
|---|