There are new types and helpers that are supposed to be used in new code. As a preparation to get rid of legacy types and API functions do the conversion here.
Unified · Split
| @@ -60,9 +60,9 @@ struct mdev_device *mdev_from_dev(struct device *dev) · 59 unmodified lines | ||
| 60 | 60 | } |
| 61 | 61 | EXPORT_SYMBOL(mdev_from_dev); |
| 62 | 62 | |
| 63 | −uuid_le mdev_uuid(struct mdev_device *mdev) | |
| 63 | +const guid_t *mdev_uuid(struct mdev_device *mdev) | |
| 64 | 64 | { |
| 65 | − return mdev->uuid; | |
| 65 | + return &mdev->uuid; | |
| 66 | 66 | } |
| 67 | 67 | EXPORT_SYMBOL(mdev_uuid); |
| 68 | 68 | |
| @@ -88,8 +88,7 @@ static void mdev_release_parent(struct kref *kref) · 19 unmodified lines | ||
| 88 | 88 | put_device(dev); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | −static | |
| 92 | −inline struct mdev_parent *mdev_get_parent(struct mdev_parent *parent) | |
| 91 | +static inline struct mdev_parent *mdev_get_parent(struct mdev_parent *parent) | |
| 93 | 92 | { |
| 94 | 93 | if (parent) |
| 95 | 94 | kref_get(&parent->ref); |
| @@ -276,7 +275,8 @@ static void mdev_device_release(struct device *dev) · 180 unmodified lines | ||
| 276 | 275 | kfree(mdev); |
| 277 | 276 | } |
| 278 | 277 | |
| 279 | −int mdev_device_create(struct kobject *kobj, struct device *dev, uuid_le uuid) | |
| 278 | +int mdev_device_create(struct kobject *kobj, | |
| 279 | + struct device *dev, const guid_t *uuid) | |
| 280 | 280 | { |
| 281 | 281 | int ret; |
| 282 | 282 | struct mdev_device *mdev, *tmp; |
| @@ -291,7 +291,7 @@ int mdev_device_create(struct kobject *kobj, struct device *dev, uuid_le uuid) · 8 unmodified lines | ||
| 291 | 291 | |
| 292 | 292 | /* Check for duplicate */ |
| 293 | 293 | list_for_each_entry(tmp, &mdev_list, next) { |
| 294 | − if (!uuid_le_cmp(tmp->uuid, uuid)) { | |
| 294 | + if (guid_equal(&tmp->uuid, uuid)) { | |
| 295 | 295 | mutex_unlock(&mdev_list_lock); |
| 296 | 296 | ret = -EEXIST; |
| 297 | 297 | goto mdev_fail; |
| @@ -305,7 +305,7 @@ int mdev_device_create(struct kobject *kobj, struct device *dev, uuid_le uuid) · 7 unmodified lines | ||
| 305 | 305 | goto mdev_fail; |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | − memcpy(&mdev->uuid, &uuid, sizeof(uuid_le)); | |
| 308 | + guid_copy(&mdev->uuid, uuid); | |
| 309 | 309 | list_add(&mdev->next, &mdev_list); |
| 310 | 310 | mutex_unlock(&mdev_list_lock); |
| 311 | 311 | |
| @@ -315,7 +315,7 @@ int mdev_device_create(struct kobject *kobj, struct device *dev, uuid_le uuid) · 3 unmodified lines | ||
| 315 | 315 | mdev->dev.parent = dev; |
| 316 | 316 | mdev->dev.bus = &mdev_bus_type; |
| 317 | 317 | mdev->dev.release = mdev_device_release; |
| 318 | − dev_set_name(&mdev->dev, "%pUl", uuid.b); | |
| 318 | + dev_set_name(&mdev->dev, "%pUl", uuid); | |
| 319 | 319 | |
| 320 | 320 | ret = device_register(&mdev->dev); |
| 321 | 321 | if (ret) { |
| @@ -28,7 +28,7 @@ struct mdev_parent { · 27 unmodified lines | ||
| 28 | 28 | struct mdev_device { |
| 29 | 29 | struct device dev; |
| 30 | 30 | struct mdev_parent *parent; |
| 31 | − uuid_le uuid; | |
| 31 | + guid_t uuid; | |
| 32 | 32 | void *driver_data; |
| 33 | 33 | struct kref ref; |
| 34 | 34 | struct list_head next; |
| @@ -58,7 +58,8 @@ void parent_remove_sysfs_files(struct mdev_parent *parent); · 23 unmodified lines | ||
| 58 | 58 | int mdev_create_sysfs_files(struct device *dev, struct mdev_type *type); |
| 59 | 59 | void mdev_remove_sysfs_files(struct device *dev, struct mdev_type *type); |
| 60 | 60 | |
| 61 | −int mdev_device_create(struct kobject *kobj, struct device *dev, uuid_le uuid); | |
| 61 | +int mdev_device_create(struct kobject *kobj, | |
| 62 | + struct device *dev, const guid_t *uuid); | |
| 62 | 63 | int mdev_device_remove(struct device *dev, bool force_remove); |
| 63 | 64 | |
| 64 | 65 | #endif /* MDEV_PRIVATE_H */ |
| @@ -55,7 +55,7 @@ static ssize_t create_store(struct kobject *kobj, struct device *dev, · 54 unmodified lines | ||
| 55 | 55 | const char *buf, size_t count) |
| 56 | 56 | { |
| 57 | 57 | char *str; |
| 58 | − uuid_le uuid; | |
| 58 | + guid_t uuid; | |
| 59 | 59 | int ret; |
| 60 | 60 | |
| 61 | 61 | if ((count < UUID_STRING_LEN) || (count > UUID_STRING_LEN + 1)) |
| @@ -65,12 +65,12 @@ static ssize_t create_store(struct kobject *kobj, struct device *dev, · 3 unmodified lines | ||
| 65 | 65 | if (!str) |
| 66 | 66 | return -ENOMEM; |
| 67 | 67 | |
| 68 | − ret = uuid_le_to_bin(str, &uuid); | |
| 68 | + ret = guid_parse(str, &uuid); | |
| 69 | 69 | kfree(str); |
| 70 | 70 | if (ret) |
| 71 | 71 | return ret; |
| 72 | 72 | |
| 73 | − ret = mdev_device_create(kobj, dev, uuid); | |
| 73 | + ret = mdev_device_create(kobj, dev, &uuid); | |
| 74 | 74 | if (ret) |
| 75 | 75 | return ret; |
| 76 | 76 | |
| @@ -120,7 +120,7 @@ struct mdev_driver { · 119 unmodified lines | ||
| 120 | 120 | |
| 121 | 121 | extern void *mdev_get_drvdata(struct mdev_device *mdev); |
| 122 | 122 | extern void mdev_set_drvdata(struct mdev_device *mdev, void *data); |
| 123 | −extern uuid_le mdev_uuid(struct mdev_device *mdev); | |
| 123 | +extern const guid_t *mdev_uuid(struct mdev_device *mdev); | |
| 124 | 124 | |
| 125 | 125 | extern struct bus_type mdev_bus_type; |
| 126 | 126 | |
| @@ -156,15 +156,15 @@ static const struct file_operations vd_fops = { · 155 unmodified lines | ||
| 156 | 156 | |
| 157 | 157 | /* function prototypes */ |
| 158 | 158 | |
| 159 | −static int mtty_trigger_interrupt(uuid_le uuid); | |
| 159 | +static int mtty_trigger_interrupt(const guid_t *uuid); | |
| 160 | 160 | |
| 161 | 161 | /* Helper functions */ |
| 162 | −static struct mdev_state *find_mdev_state_by_uuid(uuid_le uuid) | |
| 162 | +static struct mdev_state *find_mdev_state_by_uuid(const guid_t *uuid) | |
| 163 | 163 | { |
| 164 | 164 | struct mdev_state *mds; |
| 165 | 165 | |
| 166 | 166 | list_for_each_entry(mds, &mdev_devices_list, next) { |
| 167 | − if (uuid_le_cmp(mdev_uuid(mds->mdev), uuid) == 0) | |
| 167 | + if (guid_equal(mdev_uuid(mds->mdev), uuid)) | |
| 168 | 168 | return mds; |
| 169 | 169 | } |
| 170 | 170 | |
| @@ -1032,7 +1032,7 @@ static int mtty_set_irqs(struct mdev_device *mdev, uint32_t flags, · 861 unmodified lines | ||
| 1032 | 1032 | return ret; |
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | −static int mtty_trigger_interrupt(uuid_le uuid) | |
| 1035 | +static int mtty_trigger_interrupt(const guid_t *uuid) | |
| 1036 | 1036 | { |
| 1037 | 1037 | int ret = -1; |
| 1038 | 1038 | struct mdev_state *mdev_state; |