1180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho/* 2180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho * This file is part of wl12xx 3180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho * 4180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho * Copyright (C) 2010-2011 Texas Instruments, Inc. 5180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho * 6180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho * This program is free software; you can redistribute it and/or 7180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho * modify it under the terms of the GNU General Public License 8180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho * version 2 as published by the Free Software Foundation. 9180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho * 10180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho * This program is distributed in the hope that it will be useful, but 11180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho * WITHOUT ANY WARRANTY; without even the implied warranty of 12180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho * General Public License for more details. 14180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho * 15180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho * You should have received a copy of the GNU General Public License 16180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho * along with this program; if not, write to the Free Software 17180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho * 02110-1301 USA 19180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho * 20180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho */ 21180d9fc3348e049f447969a9891ad166021f00caLuciano Coelho 2261ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen#include <linux/module.h> 2361ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen#include <linux/err.h> 2461ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen#include <linux/wl12xx.h> 2561ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen 26a390e85cfe91c346ff4745bcd45ad0a7e7101aa2Felipe Balbistatic struct wl12xx_platform_data *platform_data; 2761ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen 2861ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohenint __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data) 2961ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen{ 3061ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen if (platform_data) 3161ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen return -EBUSY; 3261ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen if (!data) 3361ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen return -EINVAL; 3461ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen 3561ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL); 3661ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen if (!platform_data) 3761ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen return -ENOMEM; 3861ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen 3961ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen return 0; 4061ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen} 4161ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen 42a390e85cfe91c346ff4745bcd45ad0a7e7101aa2Felipe Balbistruct wl12xx_platform_data *wl12xx_get_platform_data(void) 4361ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen{ 4461ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen if (!platform_data) 4561ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen return ERR_PTR(-ENODEV); 4661ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen 4761ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen return platform_data; 4861ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-Cohen} 4961ee7007a5d61aa066076da578e8e8084e122d7dOhad Ben-CohenEXPORT_SYMBOL(wl12xx_get_platform_data); 50