fw-path-provider.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Firmware patch provider class and helpers.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License,
  7. * or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #include "hw/fw-path-provider.h"
  18. char *fw_path_provider_get_dev_path(FWPathProvider *p, BusState *bus,
  19. DeviceState *dev)
  20. {
  21. FWPathProviderClass *k = FW_PATH_PROVIDER_GET_CLASS(p);
  22. return k->get_dev_path(p, bus, dev);
  23. }
  24. char *fw_path_provider_try_get_dev_path(Object *o, BusState *bus,
  25. DeviceState *dev)
  26. {
  27. FWPathProvider *p = (FWPathProvider *)
  28. object_dynamic_cast(o, TYPE_FW_PATH_PROVIDER);
  29. if (p) {
  30. return fw_path_provider_get_dev_path(p, bus, dev);
  31. }
  32. return NULL;
  33. }
  34. static const TypeInfo fw_path_provider_info = {
  35. .name = TYPE_FW_PATH_PROVIDER,
  36. .parent = TYPE_INTERFACE,
  37. .class_size = sizeof(FWPathProviderClass),
  38. };
  39. static void fw_path_provider_register_types(void)
  40. {
  41. type_register_static(&fw_path_provider_info);
  42. }
  43. type_init(fw_path_provider_register_types)