wilink_platform_data.c 741 B

123456789101112131415161718192021222324252627282930313233343536
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * This file is part of wl12xx
  4. *
  5. * Copyright (C) 2010-2011 Texas Instruments, Inc.
  6. */
  7. #include <linux/module.h>
  8. #include <linux/err.h>
  9. #include <linux/wl12xx.h>
  10. static struct wl1251_platform_data *wl1251_platform_data;
  11. int __init wl1251_set_platform_data(const struct wl1251_platform_data *data)
  12. {
  13. if (wl1251_platform_data)
  14. return -EBUSY;
  15. if (!data)
  16. return -EINVAL;
  17. wl1251_platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
  18. if (!wl1251_platform_data)
  19. return -ENOMEM;
  20. return 0;
  21. }
  22. struct wl1251_platform_data *wl1251_get_platform_data(void)
  23. {
  24. if (!wl1251_platform_data)
  25. return ERR_PTR(-ENODEV);
  26. return wl1251_platform_data;
  27. }
  28. EXPORT_SYMBOL(wl1251_get_platform_data);