1 /* 2 * Mediated device interal definitions 3 * 4 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 5 * Author: Neo Jia <cjia@nvidia.com> 6 * 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 */ 12 13 #ifndef MDEV_PRIVATE_H 14 #define MDEV_PRIVATE_H 15 16 int mdev_bus_register(void); 17 void mdev_bus_unregister(void); 18 19 struct mdev_type { 20 struct kobject kobj; 21 struct kobject *devices_kobj; 22 struct parent_device *parent; 23 struct list_head next; 24 struct attribute_group *group; 25 }; 26 27 #define to_mdev_type_attr(_attr) \ 28 container_of(_attr, struct mdev_type_attribute, attr) 29 #define to_mdev_type(_kobj) \ 30 container_of(_kobj, struct mdev_type, kobj) 31 32 int parent_create_sysfs_files(struct parent_device *parent); 33 void parent_remove_sysfs_files(struct parent_device *parent); 34 35 int mdev_create_sysfs_files(struct device *dev, struct mdev_type *type); 36 void mdev_remove_sysfs_files(struct device *dev, struct mdev_type *type); 37 38 int mdev_device_create(struct kobject *kobj, struct device *dev, uuid_le uuid); 39 int mdev_device_remove(struct device *dev, bool force_remove); 40 41 #endif /* MDEV_PRIVATE_H */ 42