Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

2010-09-15 Thread Tony Lindgren
* Vitaly Wool  [100915 01:18]:
> 2010/9/15 Ohad Ben-Cohen :
> >> Sorry for pushing at this, but why would you mark data that's meant to
> >> be used after init phase as __initdata?
> >
> > I can remove the first copying as well if Russell is ok with it.
> 
> I personally think it's not worth it. This copying basically happens
> only once and this point is s irrelevant. My position therefore
> is: let's get the current implementation in, and if Michal is
> uncomfortable with that, he can come up with the patch. Let's
> concentrate on the real problems.

This becomes an issue when compiling in support for multiple
boards.. All the data that's not in use for the booted board
should be __initdata.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

2010-09-15 Thread Michał Mirosław
W dniu 15 września 2010 10:25 użytkownik Russell King - ARM Linux
 napisał:
> On Mon, Sep 06, 2010 at 09:42:41PM +0200, Michał Mirosław wrote:
>> W dniu 6 września 2010 14:07 użytkownik Russell King - ARM Linux
>>  napisał:
>> > On Sat, Sep 04, 2010 at 02:23:19PM +0200, Michał Mirosław wrote:
>> >> 2010/9/1 Ohad Ben-Cohen :
>> >> > Add a simple mechanism to pass platform data to the
>> >> > SDIO instances of wl12xx.
>> [cut patch]
>> >> Why do you need all that copying? Isn't the data constant?
>> > The first copy is to allow platforms to have their data marked with
>> > __initdata.  The second copy probably isn't necessary, but avoids
>> > problems where the driver may decide to modify the platform data.
>> Sorry for pushing at this, but why would you mark data that's meant to
>> be used after init phase as __initdata?
> Because you may have many instances of the data (due to multiple platform
> support), and only need one of them at run-time.

Ah. That makes sense.

Thanks,
Michał Mirosław
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

2010-09-15 Thread Vitaly Wool
2010/9/15 Ohad Ben-Cohen :
>> Sorry for pushing at this, but why would you mark data that's meant to
>> be used after init phase as __initdata?
>
> I can remove the first copying as well if Russell is ok with it.

I personally think it's not worth it. This copying basically happens
only once and this point is s irrelevant. My position therefore
is: let's get the current implementation in, and if Michal is
uncomfortable with that, he can come up with the patch. Let's
concentrate on the real problems.

Thanks,
   Vitaly
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

2010-09-15 Thread Russell King - ARM Linux
On Mon, Sep 06, 2010 at 09:42:41PM +0200, Michał Mirosław wrote:
> W dniu 6 września 2010 14:07 użytkownik Russell King - ARM Linux
>  napisał:
> > On Sat, Sep 04, 2010 at 02:23:19PM +0200, Michał Mirosław wrote:
> >> 2010/9/1 Ohad Ben-Cohen :
> >> > Add a simple mechanism to pass platform data to the
> >> > SDIO instances of wl12xx.
> [cut patch]
> >> Why do you need all that copying? Isn't the data constant?
> >
> > The first copy is to allow platforms to have their data marked with
> > __initdata.  The second copy probably isn't necessary, but avoids
> > problems where the driver may decide to modify the platform data.
> 
> Sorry for pushing at this, but why would you mark data that's meant to
> be used after init phase as __initdata?

Because you may have many instances of the data (due to multiple platform
support), and only need one of them at run-time.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

2010-09-15 Thread Ohad Ben-Cohen
2010/9/6 Michał Mirosław :
> W dniu 6 września 2010 14:07 użytkownik Russell King - ARM Linux
>  napisał:
>> On Sat, Sep 04, 2010 at 02:23:19PM +0200, Michał Mirosław wrote:
>>> 2010/9/1 Ohad Ben-Cohen :
>>> > Add a simple mechanism to pass platform data to the
>>> > SDIO instances of wl12xx.
> [cut patch]
>>> Why do you need all that copying? Isn't the data constant?
>>
>> The first copy is to allow platforms to have their data marked with
>> __initdata.  The second copy probably isn't necessary, but avoids
>> problems where the driver may decide to modify the platform data.
>
> Sorry for pushing at this, but why would you mark data that's meant to
> be used after init phase as __initdata?

I can remove the first copying as well if Russell is ok with it.

Both ways work for us.

>
> Best Regards,
> Michał Mirosław
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

2010-09-06 Thread Michał Mirosław
W dniu 6 września 2010 14:07 użytkownik Russell King - ARM Linux
 napisał:
> On Sat, Sep 04, 2010 at 02:23:19PM +0200, Michał Mirosław wrote:
>> 2010/9/1 Ohad Ben-Cohen :
>> > Add a simple mechanism to pass platform data to the
>> > SDIO instances of wl12xx.
[cut patch]
>> Why do you need all that copying? Isn't the data constant?
>
> The first copy is to allow platforms to have their data marked with
> __initdata.  The second copy probably isn't necessary, but avoids
> problems where the driver may decide to modify the platform data.

Sorry for pushing at this, but why would you mark data that's meant to
be used after init phase as __initdata?

Best Regards,
Michał Mirosław
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

2010-09-06 Thread Ohad Ben-Cohen
2010/9/6 Russell King - ARM Linux :
> We could instead make wl12xx_get_platform_data() return a const pointer
> to its own internal storage instead, or ERR pointers for the various
> failure cases.

Sounds good:

diff --git a/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
new file mode 100644
index 000..973b110
--- /dev/null
+++ b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
@@ -0,0 +1,28 @@
+#include 
+#include 
+#include 
+
+static const struct wl12xx_platform_data *platform_data;
+
+int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
+{
+   if (platform_data)
+   return -EBUSY;
+   if (!data)
+   return -EINVAL;
+
+   platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
+   if (!platform_data)
+   return -ENOMEM;
+
+   return 0;
+}
+
+const struct wl12xx_platform_data *wl12xx_get_platform_data(void)
+{
+   if (!platform_data)
+   return ERR_PTR(-ENODEV);
+
+   return platform_data;
+}
+EXPORT_SYMBOL(wl12xx_get_platform_data);


I'll wait a few days to see if there's any other comment, and then
post v6 with this change.

>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

2010-09-06 Thread Russell King - ARM Linux
On Sat, Sep 04, 2010 at 02:23:19PM +0200, Michał Mirosław wrote:
> 2010/9/1 Ohad Ben-Cohen :
> > Add a simple mechanism to pass platform data to the
> > SDIO instances of wl12xx.
> >
> > This way there is no confusion over who owns the 'embedded data',
> > typechecking is preserved, and no possibility for the wrong driver to
> > pick up the data.
> >
> > Originally proposed by Russell King.
> >
> > Signed-off-by: Ohad Ben-Cohen 
> > ---
> >  drivers/net/wireless/Makefile                      |    2 +
> >  drivers/net/wireless/wl12xx/Kconfig                |    5 ++-
> >  drivers/net/wireless/wl12xx/wl12xx_platform_data.c |   31 
> > 
> >  include/linux/wl12xx.h                             |    3 ++
> >  4 files changed, 40 insertions(+), 1 deletions(-)
> >  create mode 100644 drivers/net/wireless/wl12xx/wl12xx_platform_data.c
> >
> > diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
> > index 5d4ce4d..85af697 100644
> > --- a/drivers/net/wireless/Makefile
> > +++ b/drivers/net/wireless/Makefile
> > @@ -50,5 +50,7 @@ obj-$(CONFIG_ATH_COMMON)      += ath/
> >  obj-$(CONFIG_MAC80211_HWSIM)   += mac80211_hwsim.o
> >
> >  obj-$(CONFIG_WL12XX)   += wl12xx/
> > +# small builtin driver bit
> > +obj-$(CONFIG_WL12XX_PLATFORM_DATA)     += wl12xx/wl12xx_platform_data.o
> >
> >  obj-$(CONFIG_IWM)      += iwmc3200wifi/
> > diff --git a/drivers/net/wireless/wl12xx/Kconfig 
> > b/drivers/net/wireless/wl12xx/Kconfig
> > index 2f98058..4a8bb25 100644
> > --- a/drivers/net/wireless/wl12xx/Kconfig
> > +++ b/drivers/net/wireless/wl12xx/Kconfig
> > @@ -74,4 +74,7 @@ config WL1271_SDIO
> >          If you choose to build a module, it'll be called
> >          wl1271_sdio. Say N if unsure.
> >
> > -
> > +config WL12XX_PLATFORM_DATA
> > +       bool
> > +       depends on WL1271_SDIO != n
> > +       default y
> > diff --git a/drivers/net/wireless/wl12xx/wl12xx_platform_data.c 
> > b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
> > new file mode 100644
> > index 000..e00973b
> > --- /dev/null
> > +++ b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
> > @@ -0,0 +1,31 @@
> > +#include 
> > +#include 
> > +
> > +static struct wl12xx_platform_data *platform_data;
> > +
> > +int __init wl12xx_set_platform_data(const struct wl12xx_platform_data 
> > *data)
> > +{
> > +       if (platform_data)
> > +               return -EBUSY;
> > +       if (!data)
> > +               return -EINVAL;
> > +
> > +       platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
> > +       if (!platform_data)
> > +               return -ENOMEM;
> > +
> > +       return 0;
> > +}
> > +
> > +int wl12xx_get_platform_data(struct wl12xx_platform_data *data)
> > +{
> > +       if (!platform_data)
> > +               return -ENODEV;
> > +       if (!data)
> > +               return -EINVAL;
> > +
> > +       memcpy(data, platform_data, sizeof(*data));
> > +
> > +       return 0;
> > +}
> > +EXPORT_SYMBOL(wl12xx_get_platform_data);
> > diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
> > index 137ac89..3e33ae1 100644
> > --- a/include/linux/wl12xx.h
> > +++ b/include/linux/wl12xx.h
> > @@ -31,4 +31,7 @@ struct wl12xx_platform_data {
> >        bool use_eeprom;
> >  };
> >
> > +int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
> > +int wl12xx_get_platform_data(struct wl12xx_platform_data *data);
> > +
> >  #endif
> 
> Why do you need all that copying? Isn't the data constant?

The first copy is to allow platforms to have their data marked with
__initdata.  The second copy probably isn't necessary, but avoids
problems where the driver may decide to modify the platform data.

We could instead make wl12xx_get_platform_data() return a const pointer
to its own internal storage instead, or ERR pointers for the various
failure cases.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

2010-09-06 Thread Ohad Ben-Cohen
2010/9/4 Michał Mirosław :
> 2010/9/1 Ohad Ben-Cohen :
>> Add a simple mechanism to pass platform data to the
>> SDIO instances of wl12xx.
>>
>> This way there is no confusion over who owns the 'embedded data',
>> typechecking is preserved, and no possibility for the wrong driver to
>> pick up the data.
>>
>> Originally proposed by Russell King.
>>
>> Signed-off-by: Ohad Ben-Cohen 
>> ---
>>  drivers/net/wireless/Makefile                      |    2 +
>>  drivers/net/wireless/wl12xx/Kconfig                |    5 ++-
>>  drivers/net/wireless/wl12xx/wl12xx_platform_data.c |   31 
>> 
>>  include/linux/wl12xx.h                             |    3 ++
>>  4 files changed, 40 insertions(+), 1 deletions(-)
>>  create mode 100644 drivers/net/wireless/wl12xx/wl12xx_platform_data.c
>>
>> diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
>> index 5d4ce4d..85af697 100644
>> --- a/drivers/net/wireless/Makefile
>> +++ b/drivers/net/wireless/Makefile
>> @@ -50,5 +50,7 @@ obj-$(CONFIG_ATH_COMMON)      += ath/
>>  obj-$(CONFIG_MAC80211_HWSIM)   += mac80211_hwsim.o
>>
>>  obj-$(CONFIG_WL12XX)   += wl12xx/
>> +# small builtin driver bit
>> +obj-$(CONFIG_WL12XX_PLATFORM_DATA)     += wl12xx/wl12xx_platform_data.o
>>
>>  obj-$(CONFIG_IWM)      += iwmc3200wifi/
>> diff --git a/drivers/net/wireless/wl12xx/Kconfig 
>> b/drivers/net/wireless/wl12xx/Kconfig
>> index 2f98058..4a8bb25 100644
>> --- a/drivers/net/wireless/wl12xx/Kconfig
>> +++ b/drivers/net/wireless/wl12xx/Kconfig
>> @@ -74,4 +74,7 @@ config WL1271_SDIO
>>          If you choose to build a module, it'll be called
>>          wl1271_sdio. Say N if unsure.
>>
>> -
>> +config WL12XX_PLATFORM_DATA
>> +       bool
>> +       depends on WL1271_SDIO != n
>> +       default y
>> diff --git a/drivers/net/wireless/wl12xx/wl12xx_platform_data.c 
>> b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
>> new file mode 100644
>> index 000..e00973b
>> --- /dev/null
>> +++ b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
>> @@ -0,0 +1,31 @@
>> +#include 
>> +#include 
>> +
>> +static struct wl12xx_platform_data *platform_data;
>> +
>> +int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
>> +{
>> +       if (platform_data)
>> +               return -EBUSY;
>> +       if (!data)
>> +               return -EINVAL;
>> +
>> +       platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
>> +       if (!platform_data)
>> +               return -ENOMEM;
>> +
>> +       return 0;
>> +}
>> +
>> +int wl12xx_get_platform_data(struct wl12xx_platform_data *data)
>> +{
>> +       if (!platform_data)
>> +               return -ENODEV;
>> +       if (!data)
>> +               return -EINVAL;
>> +
>> +       memcpy(data, platform_data, sizeof(*data));
>> +
>> +       return 0;
>> +}
>> +EXPORT_SYMBOL(wl12xx_get_platform_data);
>> diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
>> index 137ac89..3e33ae1 100644
>> --- a/include/linux/wl12xx.h
>> +++ b/include/linux/wl12xx.h
>> @@ -31,4 +31,7 @@ struct wl12xx_platform_data {
>>        bool use_eeprom;
>>  };
>>
>> +int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
>> +int wl12xx_get_platform_data(struct wl12xx_platform_data *data);
>> +
>>  #endif
>
> Why do you need all that copying? Isn't the data constant?

That was the original proposal from Russell;

AFAICT it's very similar to how platform device resources are handled
- it allows marking the original definition of the data as __initdata
(need to add that) thus freeing up its space after the initialization
phase completes. Later, in some scenarios, it might also allow to free
up the copied data (not done now, but the copying happen only once in
the lifetime of the driver so I'm fine with it).

>
> Best Regards,
> Michał Mirosław
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

2010-09-04 Thread Michał Mirosław
2010/9/1 Ohad Ben-Cohen :
> Add a simple mechanism to pass platform data to the
> SDIO instances of wl12xx.
>
> This way there is no confusion over who owns the 'embedded data',
> typechecking is preserved, and no possibility for the wrong driver to
> pick up the data.
>
> Originally proposed by Russell King.
>
> Signed-off-by: Ohad Ben-Cohen 
> ---
>  drivers/net/wireless/Makefile                      |    2 +
>  drivers/net/wireless/wl12xx/Kconfig                |    5 ++-
>  drivers/net/wireless/wl12xx/wl12xx_platform_data.c |   31 
> 
>  include/linux/wl12xx.h                             |    3 ++
>  4 files changed, 40 insertions(+), 1 deletions(-)
>  create mode 100644 drivers/net/wireless/wl12xx/wl12xx_platform_data.c
>
> diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
> index 5d4ce4d..85af697 100644
> --- a/drivers/net/wireless/Makefile
> +++ b/drivers/net/wireless/Makefile
> @@ -50,5 +50,7 @@ obj-$(CONFIG_ATH_COMMON)      += ath/
>  obj-$(CONFIG_MAC80211_HWSIM)   += mac80211_hwsim.o
>
>  obj-$(CONFIG_WL12XX)   += wl12xx/
> +# small builtin driver bit
> +obj-$(CONFIG_WL12XX_PLATFORM_DATA)     += wl12xx/wl12xx_platform_data.o
>
>  obj-$(CONFIG_IWM)      += iwmc3200wifi/
> diff --git a/drivers/net/wireless/wl12xx/Kconfig 
> b/drivers/net/wireless/wl12xx/Kconfig
> index 2f98058..4a8bb25 100644
> --- a/drivers/net/wireless/wl12xx/Kconfig
> +++ b/drivers/net/wireless/wl12xx/Kconfig
> @@ -74,4 +74,7 @@ config WL1271_SDIO
>          If you choose to build a module, it'll be called
>          wl1271_sdio. Say N if unsure.
>
> -
> +config WL12XX_PLATFORM_DATA
> +       bool
> +       depends on WL1271_SDIO != n
> +       default y
> diff --git a/drivers/net/wireless/wl12xx/wl12xx_platform_data.c 
> b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
> new file mode 100644
> index 000..e00973b
> --- /dev/null
> +++ b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
> @@ -0,0 +1,31 @@
> +#include 
> +#include 
> +
> +static struct wl12xx_platform_data *platform_data;
> +
> +int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
> +{
> +       if (platform_data)
> +               return -EBUSY;
> +       if (!data)
> +               return -EINVAL;
> +
> +       platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
> +       if (!platform_data)
> +               return -ENOMEM;
> +
> +       return 0;
> +}
> +
> +int wl12xx_get_platform_data(struct wl12xx_platform_data *data)
> +{
> +       if (!platform_data)
> +               return -ENODEV;
> +       if (!data)
> +               return -EINVAL;
> +
> +       memcpy(data, platform_data, sizeof(*data));
> +
> +       return 0;
> +}
> +EXPORT_SYMBOL(wl12xx_get_platform_data);
> diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
> index 137ac89..3e33ae1 100644
> --- a/include/linux/wl12xx.h
> +++ b/include/linux/wl12xx.h
> @@ -31,4 +31,7 @@ struct wl12xx_platform_data {
>        bool use_eeprom;
>  };
>
> +int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
> +int wl12xx_get_platform_data(struct wl12xx_platform_data *data);
> +
>  #endif

Why do you need all that copying? Isn't the data constant?

Best Regards,
Michał Mirosław
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 3/7] wireless: wl12xx: add platform data passing support

2010-09-01 Thread Ohad Ben-Cohen
Add a simple mechanism to pass platform data to the
SDIO instances of wl12xx.

This way there is no confusion over who owns the 'embedded data',
typechecking is preserved, and no possibility for the wrong driver to
pick up the data.

Originally proposed by Russell King.

Signed-off-by: Ohad Ben-Cohen 
---
 drivers/net/wireless/Makefile  |2 +
 drivers/net/wireless/wl12xx/Kconfig|5 ++-
 drivers/net/wireless/wl12xx/wl12xx_platform_data.c |   31 
 include/linux/wl12xx.h |3 ++
 4 files changed, 40 insertions(+), 1 deletions(-)
 create mode 100644 drivers/net/wireless/wl12xx/wl12xx_platform_data.c

diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
index 5d4ce4d..85af697 100644
--- a/drivers/net/wireless/Makefile
+++ b/drivers/net/wireless/Makefile
@@ -50,5 +50,7 @@ obj-$(CONFIG_ATH_COMMON)  += ath/
 obj-$(CONFIG_MAC80211_HWSIM)   += mac80211_hwsim.o
 
 obj-$(CONFIG_WL12XX)   += wl12xx/
+# small builtin driver bit
+obj-$(CONFIG_WL12XX_PLATFORM_DATA) += wl12xx/wl12xx_platform_data.o
 
 obj-$(CONFIG_IWM)  += iwmc3200wifi/
diff --git a/drivers/net/wireless/wl12xx/Kconfig 
b/drivers/net/wireless/wl12xx/Kconfig
index 2f98058..4a8bb25 100644
--- a/drivers/net/wireless/wl12xx/Kconfig
+++ b/drivers/net/wireless/wl12xx/Kconfig
@@ -74,4 +74,7 @@ config WL1271_SDIO
  If you choose to build a module, it'll be called
  wl1271_sdio. Say N if unsure.
 
-
+config WL12XX_PLATFORM_DATA
+   bool
+   depends on WL1271_SDIO != n
+   default y
diff --git a/drivers/net/wireless/wl12xx/wl12xx_platform_data.c 
b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
new file mode 100644
index 000..e00973b
--- /dev/null
+++ b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
@@ -0,0 +1,31 @@
+#include 
+#include 
+
+static struct wl12xx_platform_data *platform_data;
+
+int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
+{
+   if (platform_data)
+   return -EBUSY;
+   if (!data)
+   return -EINVAL;
+
+   platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
+   if (!platform_data)
+   return -ENOMEM;
+
+   return 0;
+}
+
+int wl12xx_get_platform_data(struct wl12xx_platform_data *data)
+{
+   if (!platform_data)
+   return -ENODEV;
+   if (!data)
+   return -EINVAL;
+
+   memcpy(data, platform_data, sizeof(*data));
+
+   return 0;
+}
+EXPORT_SYMBOL(wl12xx_get_platform_data);
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 137ac89..3e33ae1 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -31,4 +31,7 @@ struct wl12xx_platform_data {
bool use_eeprom;
 };
 
+int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
+int wl12xx_get_platform_data(struct wl12xx_platform_data *data);
+
 #endif
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html