mca-driver.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* -*- mode: c; c-basic-offset: 8 -*- */
  2. /*
  3. * MCA driver support functions for sysfs.
  4. *
  5. * (C) 2002 James Bottomley <James.Bottomley@HansenPartnership.com>
  6. *
  7. **-----------------------------------------------------------------------------
  8. **
  9. ** This program is free software; you can redistribute it and/or modify
  10. ** it under the terms of the GNU General Public License as published by
  11. ** the Free Software Foundation; either version 2 of the License, or
  12. ** (at your option) any later version.
  13. **
  14. ** This program is distributed in the hope that it will be useful,
  15. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ** GNU General Public License for more details.
  18. **
  19. ** You should have received a copy of the GNU General Public License
  20. ** along with this program; if not, write to the Free Software
  21. ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. **
  23. **-----------------------------------------------------------------------------
  24. */
  25. #include <linux/device.h>
  26. #include <linux/mca.h>
  27. #include <linux/module.h>
  28. int mca_register_driver(struct mca_driver *mca_drv)
  29. {
  30. int r;
  31. if (MCA_bus) {
  32. mca_drv->driver.bus = &mca_bus_type;
  33. if ((r = driver_register(&mca_drv->driver)) < 0)
  34. return r;
  35. mca_drv->integrated_id = 0;
  36. }
  37. return 0;
  38. }
  39. EXPORT_SYMBOL(mca_register_driver);
  40. int mca_register_driver_integrated(struct mca_driver *mca_driver,
  41. int integrated_id)
  42. {
  43. int r = mca_register_driver(mca_driver);
  44. if (!r)
  45. mca_driver->integrated_id = integrated_id;
  46. return r;
  47. }
  48. EXPORT_SYMBOL(mca_register_driver_integrated);
  49. void mca_unregister_driver(struct mca_driver *mca_drv)
  50. {
  51. if (MCA_bus)
  52. driver_unregister(&mca_drv->driver);
  53. }
  54. EXPORT_SYMBOL(mca_unregister_driver);