mdev_driver.c (2815fe149ffa8e1a022b2830ab62999135c00a4e) mdev_driver.c (290aac5df88a83e264b3a73ec146e5e5b3c45793)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * MDEV driver
4 *
5 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
6 * Author: Neo Jia <cjia@nvidia.com>
7 * Kirti Wankhede <kwankhede@nvidia.com>
8 */

--- 41 unchanged lines hidden (view full) ---

50/**
51 * mdev_register_driver - register a new MDEV driver
52 * @drv: the driver to register
53 *
54 * Returns a negative value on error, otherwise 0.
55 **/
56int mdev_register_driver(struct mdev_driver *drv)
57{
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * MDEV driver
4 *
5 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
6 * Author: Neo Jia <cjia@nvidia.com>
7 * Kirti Wankhede <kwankhede@nvidia.com>
8 */

--- 41 unchanged lines hidden (view full) ---

50/**
51 * mdev_register_driver - register a new MDEV driver
52 * @drv: the driver to register
53 *
54 * Returns a negative value on error, otherwise 0.
55 **/
56int mdev_register_driver(struct mdev_driver *drv)
57{
58 if (!drv->types_attrs)
58 if (!drv->types_attrs || !drv->device_api)
59 return -EINVAL;
59 return -EINVAL;
60
61 /* initialize common driver fields */
60 drv->driver.bus = &mdev_bus_type;
61 return driver_register(&drv->driver);
62}
63EXPORT_SYMBOL(mdev_register_driver);
64
65/*
66 * mdev_unregister_driver - unregister MDEV driver
67 * @drv: the driver to unregister
68 */
69void mdev_unregister_driver(struct mdev_driver *drv)
70{
71 driver_unregister(&drv->driver);
72}
73EXPORT_SYMBOL(mdev_unregister_driver);
62 drv->driver.bus = &mdev_bus_type;
63 return driver_register(&drv->driver);
64}
65EXPORT_SYMBOL(mdev_register_driver);
66
67/*
68 * mdev_unregister_driver - unregister MDEV driver
69 * @drv: the driver to unregister
70 */
71void mdev_unregister_driver(struct mdev_driver *drv)
72{
73 driver_unregister(&drv->driver);
74}
75EXPORT_SYMBOL(mdev_unregister_driver);