Commit 946651cb authored by Luciano Coelho's avatar Luciano Coelho Committed by John W. Linville

wl1251: split wl251 platform data to a separate structure

Move the wl1251 part of the wl12xx platform data structure into a new
structure specifically for wl1251.  Change the platform data built-in
block and board files accordingly.
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
Acked-by: default avatarTony Lindgren <tony@atomide.com>
Reviewed-by: default avatarFelipe Balbi <balbi@ti.com>
Reviewed-by: default avatarSebastian Reichel <sre@debian.org>
Reviewed-by: default avatarPavel Machek <pavel@ucw.cz>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent ef1b4141
...@@ -536,7 +536,7 @@ static struct spi_board_info omap3pandora_spi_board_info[] __initdata = { ...@@ -536,7 +536,7 @@ static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {
static void __init pandora_wl1251_init(void) static void __init pandora_wl1251_init(void)
{ {
struct wl12xx_platform_data pandora_wl1251_pdata; struct wl1251_platform_data pandora_wl1251_pdata;
int ret; int ret;
memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata)); memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata));
...@@ -550,7 +550,7 @@ static void __init pandora_wl1251_init(void) ...@@ -550,7 +550,7 @@ static void __init pandora_wl1251_init(void)
goto fail_irq; goto fail_irq;
pandora_wl1251_pdata.use_eeprom = true; pandora_wl1251_pdata.use_eeprom = true;
ret = wl12xx_set_platform_data(&pandora_wl1251_pdata); ret = wl1251_set_platform_data(&pandora_wl1251_pdata);
if (ret < 0) if (ret < 0)
goto fail_irq; goto fail_irq;
......
...@@ -84,7 +84,7 @@ enum { ...@@ -84,7 +84,7 @@ enum {
RX51_SPI_MIPID, /* LCD panel */ RX51_SPI_MIPID, /* LCD panel */
}; };
static struct wl12xx_platform_data wl1251_pdata; static struct wl1251_platform_data wl1251_pdata;
static struct tsc2005_platform_data tsc2005_pdata; static struct tsc2005_platform_data tsc2005_pdata;
#if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE) #if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE)
......
...@@ -23,17 +23,17 @@ ...@@ -23,17 +23,17 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/wl12xx.h> #include <linux/wl12xx.h>
static struct wl12xx_platform_data *platform_data; static struct wl12xx_platform_data *wl12xx_platform_data;
int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data) int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
{ {
if (platform_data) if (wl12xx_platform_data)
return -EBUSY; return -EBUSY;
if (!data) if (!data)
return -EINVAL; return -EINVAL;
platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL); wl12xx_platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
if (!platform_data) if (!wl12xx_platform_data)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
...@@ -41,9 +41,34 @@ int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data) ...@@ -41,9 +41,34 @@ int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
struct wl12xx_platform_data *wl12xx_get_platform_data(void) struct wl12xx_platform_data *wl12xx_get_platform_data(void)
{ {
if (!platform_data) if (!wl12xx_platform_data)
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
return platform_data; return wl12xx_platform_data;
} }
EXPORT_SYMBOL(wl12xx_get_platform_data); EXPORT_SYMBOL(wl12xx_get_platform_data);
static struct wl1251_platform_data *wl1251_platform_data;
int __init wl1251_set_platform_data(const struct wl1251_platform_data *data)
{
if (wl1251_platform_data)
return -EBUSY;
if (!data)
return -EINVAL;
wl1251_platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
if (!wl1251_platform_data)
return -ENOMEM;
return 0;
}
struct wl1251_platform_data *wl1251_get_platform_data(void)
{
if (!wl1251_platform_data)
return ERR_PTR(-ENODEV);
return wl1251_platform_data;
}
EXPORT_SYMBOL(wl1251_get_platform_data);
...@@ -227,7 +227,7 @@ static int wl1251_sdio_probe(struct sdio_func *func, ...@@ -227,7 +227,7 @@ static int wl1251_sdio_probe(struct sdio_func *func,
struct wl1251 *wl; struct wl1251 *wl;
struct ieee80211_hw *hw; struct ieee80211_hw *hw;
struct wl1251_sdio *wl_sdio; struct wl1251_sdio *wl_sdio;
const struct wl12xx_platform_data *wl12xx_board_data; const struct wl1251_platform_data *wl1251_board_data;
hw = wl1251_alloc_hw(); hw = wl1251_alloc_hw();
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -254,11 +254,11 @@ static int wl1251_sdio_probe(struct sdio_func *func, ...@@ -254,11 +254,11 @@ static int wl1251_sdio_probe(struct sdio_func *func,
wl->if_priv = wl_sdio; wl->if_priv = wl_sdio;
wl->if_ops = &wl1251_sdio_ops; wl->if_ops = &wl1251_sdio_ops;
wl12xx_board_data = wl12xx_get_platform_data(); wl1251_board_data = wl1251_get_platform_data();
if (!IS_ERR(wl12xx_board_data)) { if (!IS_ERR(wl1251_board_data)) {
wl->set_power = wl12xx_board_data->set_power; wl->set_power = wl1251_board_data->set_power;
wl->irq = wl12xx_board_data->irq; wl->irq = wl1251_board_data->irq;
wl->use_eeprom = wl12xx_board_data->use_eeprom; wl->use_eeprom = wl1251_board_data->use_eeprom;
} }
if (wl->irq) { if (wl->irq) {
......
...@@ -238,7 +238,7 @@ static const struct wl1251_if_operations wl1251_spi_ops = { ...@@ -238,7 +238,7 @@ static const struct wl1251_if_operations wl1251_spi_ops = {
static int wl1251_spi_probe(struct spi_device *spi) static int wl1251_spi_probe(struct spi_device *spi)
{ {
struct wl12xx_platform_data *pdata; struct wl1251_platform_data *pdata;
struct ieee80211_hw *hw; struct ieee80211_hw *hw;
struct wl1251 *wl; struct wl1251 *wl;
int ret; int ret;
......
...@@ -48,11 +48,15 @@ enum { ...@@ -48,11 +48,15 @@ enum {
WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */ WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */
}; };
struct wl12xx_platform_data { struct wl1251_platform_data {
void (*set_power)(bool enable); void (*set_power)(bool enable);
/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
int irq; int irq;
bool use_eeprom; bool use_eeprom;
};
struct wl12xx_platform_data {
int irq;
int board_ref_clock; int board_ref_clock;
int board_tcxo_clock; int board_tcxo_clock;
unsigned long platform_quirks; unsigned long platform_quirks;
...@@ -68,6 +72,10 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data); ...@@ -68,6 +72,10 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
struct wl12xx_platform_data *wl12xx_get_platform_data(void); struct wl12xx_platform_data *wl12xx_get_platform_data(void);
int wl1251_set_platform_data(const struct wl1251_platform_data *data);
struct wl1251_platform_data *wl1251_get_platform_data(void);
#else #else
static inline static inline
...@@ -82,6 +90,18 @@ struct wl12xx_platform_data *wl12xx_get_platform_data(void) ...@@ -82,6 +90,18 @@ struct wl12xx_platform_data *wl12xx_get_platform_data(void)
return ERR_PTR(-ENODATA); return ERR_PTR(-ENODATA);
} }
static inline
int wl1251_set_platform_data(const struct wl1251_platform_data *data)
{
return -ENOSYS;
}
static inline
struct wl1251_platform_data *wl1251_get_platform_data(void)
{
return ERR_PTR(-ENODATA);
}
#endif #endif
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment