platform.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (C) 2009 Lemote Inc.
  3. * Author: Wu Zhangjin, wuzhangjin@gmail.com
  4. * Xiang Yu, xiangy@lemote.com
  5. * Chen Huacai, chenhc@lemote.com
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2 of the License, or (at your
  10. * option) any later version.
  11. */
  12. #include <linux/err.h>
  13. #include <linux/slab.h>
  14. #include <linux/platform_device.h>
  15. #include <asm/bootinfo.h>
  16. #include <boot_param.h>
  17. #include <loongson_hwmon.h>
  18. #include <workarounds.h>
  19. static int __init loongson3_platform_init(void)
  20. {
  21. int i;
  22. struct platform_device *pdev;
  23. if (loongson_sysconf.ecname[0] != '\0')
  24. platform_device_register_simple(loongson_sysconf.ecname, -1, NULL, 0);
  25. for (i = 0; i < loongson_sysconf.nr_sensors; i++) {
  26. if (loongson_sysconf.sensors[i].type > SENSOR_FAN)
  27. continue;
  28. pdev = kzalloc(sizeof(struct platform_device), GFP_KERNEL);
  29. pdev->name = loongson_sysconf.sensors[i].name;
  30. pdev->id = loongson_sysconf.sensors[i].id;
  31. pdev->dev.platform_data = &loongson_sysconf.sensors[i];
  32. platform_device_register(pdev);
  33. }
  34. return 0;
  35. }
  36. arch_initcall(loongson3_platform_init);