0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <linux/device.h>
0011 #include <linux/iommu.h>
0012 #include <linux/mdev.h>
0013
0014 #include "mdev_private.h"
0015
0016 static int mdev_probe(struct device *dev)
0017 {
0018 struct mdev_driver *drv =
0019 container_of(dev->driver, struct mdev_driver, driver);
0020
0021 if (!drv->probe)
0022 return 0;
0023 return drv->probe(to_mdev_device(dev));
0024 }
0025
0026 static void mdev_remove(struct device *dev)
0027 {
0028 struct mdev_driver *drv =
0029 container_of(dev->driver, struct mdev_driver, driver);
0030
0031 if (drv->remove)
0032 drv->remove(to_mdev_device(dev));
0033 }
0034
0035 static int mdev_match(struct device *dev, struct device_driver *drv)
0036 {
0037
0038
0039
0040
0041 return 0;
0042 }
0043
0044 struct bus_type mdev_bus_type = {
0045 .name = "mdev",
0046 .probe = mdev_probe,
0047 .remove = mdev_remove,
0048 .match = mdev_match,
0049 };
0050 EXPORT_SYMBOL_GPL(mdev_bus_type);
0051
0052
0053
0054
0055
0056
0057
0058 int mdev_register_driver(struct mdev_driver *drv)
0059 {
0060
0061 drv->driver.bus = &mdev_bus_type;
0062
0063
0064 return driver_register(&drv->driver);
0065 }
0066 EXPORT_SYMBOL(mdev_register_driver);
0067
0068
0069
0070
0071
0072 void mdev_unregister_driver(struct mdev_driver *drv)
0073 {
0074 driver_unregister(&drv->driver);
0075 }
0076 EXPORT_SYMBOL(mdev_unregister_driver);