/* SPDX-License-Identifier: GPL-2.0-only */ /* * Mediated device definition * * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. * Author: Neo Jia <[email protected]> * Kirti Wankhede <[email protected]> */ #ifndef MDEV_H #define MDEV_H #include <linux/device.h> #include <linux/uuid.h> struct mdev_type; struct mdev_device { … }; struct mdev_type { … }; /* embedded into the struct device that the mdev devices hang off */ struct mdev_parent { … }; static inline struct mdev_device *to_mdev_device(struct device *dev) { … } /** * struct mdev_driver - Mediated device driver * @device_api: string to return for the device_api sysfs * @max_instances: maximum number of instances supported (optional) * @probe: called when new device created * @remove: called when device removed * @get_available: Return the max number of instances that can be created * @show_description: Print a description of the mtype * @driver: device driver structure **/ struct mdev_driver { … }; int mdev_register_parent(struct mdev_parent *parent, struct device *dev, struct mdev_driver *mdev_driver, struct mdev_type **types, unsigned int nr_types); void mdev_unregister_parent(struct mdev_parent *parent); int mdev_register_driver(struct mdev_driver *drv); void mdev_unregister_driver(struct mdev_driver *drv); static inline struct device *mdev_dev(struct mdev_device *mdev) { … } #endif /* MDEV_H */