Linux-libre 5.3-gnu
[librecmc/linux-libre.git] / drivers / net / wireless / ti / wilink_platform_data.c
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
8 #include <linux/module.h>
9 #include <linux/err.h>
10 #include <linux/wl12xx.h>
11
12 static struct wl1251_platform_data *wl1251_platform_data;
13
14 int __init wl1251_set_platform_data(const struct wl1251_platform_data *data)
15 {
16         if (wl1251_platform_data)
17                 return -EBUSY;
18         if (!data)
19                 return -EINVAL;
20
21         wl1251_platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
22         if (!wl1251_platform_data)
23                 return -ENOMEM;
24
25         return 0;
26 }
27
28 struct wl1251_platform_data *wl1251_get_platform_data(void)
29 {
30         if (!wl1251_platform_data)
31                 return ERR_PTR(-ENODEV);
32
33         return wl1251_platform_data;
34 }
35 EXPORT_SYMBOL(wl1251_get_platform_data);