123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- #include <linux/init.h>
- #include <linux/module.h>
- #include <linux/tc.h>
- int tc_register_driver(struct tc_driver *tdrv)
- {
- return driver_register(&tdrv->driver);
- }
- EXPORT_SYMBOL(tc_register_driver);
- void tc_unregister_driver(struct tc_driver *tdrv)
- {
- driver_unregister(&tdrv->driver);
- }
- EXPORT_SYMBOL(tc_unregister_driver);
- const struct tc_device_id *tc_match_device(struct tc_driver *tdrv,
- struct tc_dev *tdev)
- {
- const struct tc_device_id *id = tdrv->id_table;
- if (id) {
- while (id->name[0] || id->vendor[0]) {
- if (strcmp(tdev->name, id->name) == 0 &&
- strcmp(tdev->vendor, id->vendor) == 0)
- return id;
- id++;
- }
- }
- return NULL;
- }
- EXPORT_SYMBOL(tc_match_device);
- static int tc_bus_match(struct device *dev, struct device_driver *drv)
- {
- struct tc_dev *tdev = to_tc_dev(dev);
- struct tc_driver *tdrv = to_tc_driver(drv);
- const struct tc_device_id *id;
- id = tc_match_device(tdrv, tdev);
- if (id)
- return 1;
- return 0;
- }
- struct bus_type tc_bus_type = {
- .name = "tc",
- .match = tc_bus_match,
- };
- EXPORT_SYMBOL(tc_bus_type);
- static int __init tc_driver_init(void)
- {
- return bus_register(&tc_bus_type);
- }
- postcore_initcall(tc_driver_init);
|