* Re: [PATCH 00/29] wl12xx: start preparing the driver for multi-vif support
From: Luciano Coelho @ 2011-10-06 13:18 UTC (permalink / raw)
To: Eliad Peller; +Cc: linux-wireless
In-Reply-To: <1317808566-18857-1-git-send-email-eliad@wizery.com>
On Wed, 2011-10-05 at 11:55 +0200, Eliad Peller wrote:
> The wl12xx fw currently supports only a single vif at a time.
> Upcoming fw versions are going to support concurrentl vifs.
>
> While mac80211 works well with multiple vifs, the wl12xx
> driver assumes it handles only a single interface.
>
> This is the first patchset in order to make the driver ready
> for multiple vifs support. The main action here is defining
> a new per-interface data struct (wlvif), and moving the
> currently-global fields into it.
>
> (Additional global fields/flags will be addressed by further patchsets)
>
> Note that this patchset only adds functionality - it doesn't
> break compatability with the current fw.
Applied the series. Thanks for the patchbomb! :P
--
Cheers,
Luca.
^ permalink raw reply
* [PATCH 01/15] staging: brcm80211: move driver variable functions to srom.c
From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel
In-Reply-To: <1317820814-7083-1-git-send-email-arend@broadcom.com>
The driver uses variables which are stored in string format. Using
strings as variable identifiers is disliked by the community. The
driver has been cleaned up and the only module providing these
variables is srom.c. The variable retrieval functions have been
moved to srom.c in preparation of a more likable way to store and
lookup these driver variables.
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
drivers/staging/brcm80211/brcmsmac/main.c | 44 -----------------------------
drivers/staging/brcm80211/brcmsmac/srom.c | 44 +++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 9fa8485..100e6ec 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -8881,47 +8881,3 @@ void brcms_c_set_radio_mpc(struct brcms_c_info *wlc, bool mpc)
wlc->mpc = mpc;
brcms_c_radio_mpc_upd(wlc);
}
-
-/*
- * Search the name=value vars for a specific one and return its value.
- * Returns NULL if not found.
- */
-char *getvar(char *vars, const char *name)
-{
- char *s;
- int len;
-
- if (!name)
- return NULL;
-
- len = strlen(name);
- if (len == 0)
- return NULL;
-
- /* first look in vars[] */
- for (s = vars; s && *s;) {
- if ((memcmp(s, name, len) == 0) && (s[len] == '='))
- return &s[len + 1];
-
- while (*s++)
- ;
- }
- /* nothing found */
- return NULL;
-}
-
-/*
- * Search the vars for a specific one and return its value as
- * an integer. Returns 0 if not found.
- */
-int getintvar(char *vars, const char *name)
-{
- char *val;
- unsigned long res;
-
- val = getvar(vars, name);
- if (val && !kstrtoul(val, 0, &res))
- return res;
-
- return 0;
-}
diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c
index 13d17eb..02dbd98 100644
--- a/drivers/staging/brcm80211/brcmsmac/srom.c
+++ b/drivers/staging/brcm80211/brcmsmac/srom.c
@@ -1242,3 +1242,47 @@ int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars,
return -EINVAL;
}
+
+/*
+ * Search the name=value vars for a specific one and return its value.
+ * Returns NULL if not found.
+ */
+char *getvar(char *vars, const char *name)
+{
+ char *s;
+ int len;
+
+ if (!name)
+ return NULL;
+
+ len = strlen(name);
+ if (len == 0)
+ return NULL;
+
+ /* first look in vars[] */
+ for (s = vars; s && *s;) {
+ if ((memcmp(s, name, len) == 0) && (s[len] == '='))
+ return &s[len + 1];
+
+ while (*s++)
+ ;
+ }
+ /* nothing found */
+ return NULL;
+}
+
+/*
+ * Search the vars for a specific one and return its value as
+ * an integer. Returns 0 if not found.
+ */
+int getintvar(char *vars, const char *name)
+{
+ char *val;
+ unsigned long res;
+
+ val = getvar(vars, name);
+ if (val && !kstrtoul(val, 0, &res))
+ return res;
+
+ return 0;
+}
--
1.7.4.1
^ permalink raw reply related
* RE: [PATCH 01/15] staging: brcm80211: move driver variable functions to srom.c
From: Arend Van Spriel @ 2011-10-06 14:15 UTC (permalink / raw)
To: gregkh@suse.de
Cc: devel@linuxdriverproject.org, linux-wireless@vger.kernel.org
In-Reply-To: <1317820814-7083-2-git-send-email-arend@broadcom.com>
> From: Arend van Spriel [mailto:arend@broadcom.com]
> Sent: woensdag 5 oktober 2011 15:20
>
> The driver uses variables which are stored in string format. Using
> strings as variable identifiers is disliked by the community. The
> driver has been cleaned up and the only module providing these
> variables is srom.c. The variable retrieval functions have been
> moved to srom.c in preparation of a more likable way to store and
> lookup these driver variables.
>
> Reported-by: Johannes Berg <johannes@sipsolutions.net>
> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
> Reviewed-by: Alwin Beukers <alwin@broadcom.com>
> Reviewed-by: Roland Vossen <rvossen@broadcom.com>
> Signed-off-by: Arend van Spriel <arend@broadcom.com>
Well, Greg
And there is the original patch coming out of some hole. Please discard this one.
Gr. AvS
^ permalink raw reply
* Re: Carl9170 firmware source code /w kernel.org down
From: Christian Lamparter @ 2011-10-06 14:43 UTC (permalink / raw)
To: tmail133; +Cc: linux-wireless
In-Reply-To: <3b4ddb232a2c884c0d83ee5fe1754932.squirrel@mail.errtech.com>
On Wednesday, October 05, 2011 03:11:08 AM chris wrote:
> How can I get the source code for the Carl9170 firmware
> and drive with kernel.org being down?
Sure, but why the sudden interest?
http://www.sendspace.com/file/cvg2gv [~132 kb]
[This is a snapshot from the latest HEAD, if you
want a specific release just let me know].
> The wiki says:
>
> You can get the firmware source code from
> http://git.kernel.org/?p=linux/kernel/git/chr/carl9170fw.git.
The kernel.org git is still unavailable and will be for
some time:
https://www.linuxfoundation.org/news-media/blogs/browse/2011/08/cracking-kernelorg
Regards,
Chr
^ permalink raw reply
* Re: [PATCH] compat: fix warning in alloc_netdev_mqs
From: Luis R. Rodriguez @ 2011-10-06 15:12 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <1317890726.3945.0.camel@jlt3.sipsolutions.net>
On Thu, Oct 6, 2011 at 1:45 AM, Johannes Berg <johannes@sipsolutions.net> wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> Depending on the arguments to alloc_netdev_mqs(),
> it may give a warning due to the use of max().
> Fix the warning with max_t().
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Thanks, applied and pushed!
Luis
^ permalink raw reply
* Re: [PATCH] compat: make driver-select only select complete lines
From: Luis R. Rodriguez @ 2011-10-06 15:13 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <1317892545.3945.2.camel@jlt3.sipsolutions.net>
On Thu, Oct 6, 2011 at 2:15 AM, Johannes Berg <johannes@sipsolutions.net> wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> Otherwise we end up enabling CONFIG_FOOBAR if
> only CONFIG_FOO is requested.
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Thanks, applied and pushed!
Luis
^ permalink raw reply
* Re: [ath9k-devel] [RFC 5/6] ath9k: enable DFS pulse detection
From: Christian Lamparter @ 2011-10-06 16:49 UTC (permalink / raw)
To: Luis R. Rodriguez; +Cc: kgiori, ath9k-devel, linux-wireless, Zefir Kurtisi
In-Reply-To: <CAB=NE6VC3txpDh4SdDKDxKWKKZVtGQXKVH8opszKDnZeeZTjUQ@mail.gmail.com>
On Thursday, October 06, 2011 12:27:03 AM Luis R. Rodriguez wrote:
> On Tue, Oct 4, 2011 at 6:38 AM, Christian Lamparter
> <chunkeey@googlemail.com> wrote:
> > On Monday, October 03, 2011 09:31:12 PM Luis R. Rodriguez wrote:
> >> On Mon, Oct 3, 2011 at 12:24 PM, Christian Lamparter
> >> <chunkeey@googlemail.com> wrote:
> >> > On Monday, October 03, 2011 08:27:39 PM Luis R. Rodriguez wrote:
> >> >> On Mon, Oct 3, 2011 at 3:29 AM, Zefir Kurtisi <zefir.kurtisi@neratec.com> wrote:
> >> >> >
> >> >> > Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
> >> >> > ---
> >> >> > drivers/net/wireless/ath/ath9k/main.c | 12 ++++++++++++
> >> >> > 1 files changed, 12 insertions(+), 0 deletions(-)
> >> >> >
> >> >> > diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
> >> >> > index e8aeb98..5defebe 100644
> >> >> > --- a/drivers/net/wireless/ath/ath9k/main.c
> >> >> > +++ b/drivers/net/wireless/ath/ath9k/main.c
> >> >> > [...]
> >> >> > +#ifdef CONFIG_ATH9K_DFS
> >> >>
> >> >> Please spare the #ifdef and just call something within dfs.c, then
> >> >> dfs.h would wrap it to nothing if DFS is disabled.
> >> > Why would anyone want to disable DFS driver support?
> >> > I would say: drop the ifdefs altogether since DFS
> >> > is and will be "required".
> >>
> >> Because DFS requires to be properly tested before being enabled.
> > Testing if a driver detects a pulse is "trivial" compared to the
> > stuff mac80211/cfg80211 and hostapd will have to do to make a
> > channel-change as smooth as possible. I think if there's a DFS
> > "OFF" switch, it should be in hostapd and I hope more people
> > agree on this one.
>
> You do have a good point, but I disagree that you do not need to test
> / regress test hardware / driver code for DFS.
Actually, you are sort of contradicting yourself here.
Take a look at your "wireless: add DFS master support" patch
series. I don't see any IFDEFs to select between the old
and the new "way" even though you know full well that there's
some black magic going on.
http://permalink.gmane.org/gmane.linux.kernel.wireless.general/78455
Quote:
"Here's a puzzle though... If we change this series to use the other
pad byte that was available, the first pad byte, instead of the last
one, we loose backward compatibility support and I cannot figure out
why."
[Note: This is just an recent enough example. I do think I could come
up with a better one, e.g.: why didn't athXk have a compile-time
switch to disable ANI when it was introduced because it can(and has?)
caused some regressions as well?]
so, why do you want a useless compile-time for *this option* *now*?
Is this something about politics/laws I don't know about [I'm just
curious, because I don't really buy "testing" here, since Zefir
obviously has a working prototype and Atheros has a working and
certificated codebase as well which he can access and base his
work on. So I don't think its that unstable and needs added
ugliness.]
> This is what I'm talking about. But yes, userspace also submits
> itself to the same criteria.
> >> You may also want to simply disable DFS if you do not want to
> >> deal with the regulatory test implications of having it enabled.
> > AFAIK you can't "simply" disable the DFS requirement: hostapd
> > (hw_features.c), [cfg80211] (checks if tx on secondary channel
> > is possible) and mac80211 (tx.c) all have checks. Indeed, the
> > easiest way is to modify crda's database. So there's no need
> > for an extra compile-time option.
>
> No, DFS is set for certain channels on wireless-regdb/CRDA, I just
> posted DFS master region support for wireless-regdb and CRDA. Apart
> from this we then need driver support. To get DFS you need all of
> these + hostapd part. Each one has its own set of components and does
> deserve its own set of tests and review.
This "deserve its own set of tests and review". Does it translate in:
"ath9k [every driver], mac80211, cfg80211 and hostapd need extra
DFS IFDEFS?". In fact, ifdefs make it harder to do reviews, because
sometimes you just forget the IFDEF/ELSIF/ELSE context of the code.
And regression testing can be done by "git bisect". In fact, isn't
this what git bisect is for?
Regards,
Chr
^ permalink raw reply
* [PATCH] compat-wireless: make patches apply again
From: Hauke Mehrtens @ 2011-10-06 16:53 UTC (permalink / raw)
To: mcgrof, mcgrof; +Cc: linux-wireless, Hauke Mehrtens
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
patches/35-fix-makefile-includes.patch | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/patches/35-fix-makefile-includes.patch b/patches/35-fix-makefile-includes.patch
index 17994b7..c9f8eb1 100644
--- a/patches/35-fix-makefile-includes.patch
+++ b/patches/35-fix-makefile-includes.patch
@@ -20,8 +20,8 @@ path the make process will search in the kernel tree for the headers.
+ccflags-y += -I$(obj)/..
--- a/drivers/staging/brcm80211/brcmfmac/Makefile
+++ b/drivers/staging/brcm80211/brcmfmac/Makefile
-@@ -18,8 +18,8 @@
- ccflags-$(CONFIG_BRCMDBG) += -DSHOW_EVENTS
+@@ -16,8 +16,8 @@
+ # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ccflags-y += \
- -Idrivers/staging/brcm80211/brcmfmac \
@@ -33,10 +33,10 @@ path the make process will search in the kernel tree for the headers.
wl_cfg80211.o \
--- a/drivers/staging/brcm80211/brcmsmac/Makefile
+++ b/drivers/staging/brcm80211/brcmsmac/Makefile
-@@ -16,9 +16,9 @@
- # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+@@ -17,9 +17,9 @@
- ccflags-y := \
+ ccflags-y := \
+ -D__CHECK_ENDIAN__ \
- -Idrivers/staging/brcm80211/brcmsmac \
- -Idrivers/staging/brcm80211/brcmsmac/phy \
- -Idrivers/staging/brcm80211/include
--
1.7.4.1
^ permalink raw reply related
* Re: [PATCH] compat-wireless: make patches apply again
From: Luis R. Rodriguez @ 2011-10-06 17:13 UTC (permalink / raw)
To: Hauke Mehrtens; +Cc: linux-wireless
In-Reply-To: <1317919980-30865-1-git-send-email-hauke@hauke-m.de>
On Thu, Oct 6, 2011 at 9:53 AM, Hauke Mehrtens <hauke@hauke-m.de> wrote:
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Applied, and pushed, thanks!
Luis
^ permalink raw reply
* Re: [PATCH v3] move brcm80211 drivers to mainline
From: Greg KH @ 2011-10-06 18:18 UTC (permalink / raw)
To: John W. Linville
Cc: Arend van Spriel, linux-wireless@vger.kernel.org,
devel@linuxdriverproject.org, Brett Rudley, Franky (Zhenhui) Lin,
Roland Vossen, Alwin Beukers
In-Reply-To: <20111005142402.GC17286@tuxdriver.com>
On Wed, Oct 05, 2011 at 10:24:03AM -0400, John W. Linville wrote:
> On Wed, Oct 05, 2011 at 04:08:47PM +0200, Arend van Spriel wrote:
> > With number of cleanup patch series merged in by Greg KH, I'd like to
> > once again propose moving brcm80211 out of staging and into mainline.
> >
> > I've put together a patch to add a copy of the current sources from
> > staging-next into drivers/net/wireless/brcm80211 of the wireless-next
> > repository.
> >
> > The patch is somewhat large, so I've posted the patch at:
> >
> > http://linuxwireless.org/en/users/Drivers/brcm80211?action=AttachFile&do=view&target=0001-net-wireless-add-brcm80211-drivers-v3.patch
>
> Feel free to complain, but I plan to merge this in time for the merge
> window unless someone identifies a true "showstopper" problem with
> this patch in the next day or so.
I have no objection to this, feel free to add:
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
to the merge patch.
greg k-h
^ permalink raw reply
* Re: [ath9k-devel] [RFC 5/6] ath9k: enable DFS pulse detection
From: Luis R. Rodriguez @ 2011-10-06 18:36 UTC (permalink / raw)
To: Christian Lamparter; +Cc: kgiori, ath9k-devel, linux-wireless, Zefir Kurtisi
In-Reply-To: <201110061849.48838.chunkeey@googlemail.com>
On Thu, Oct 6, 2011 at 9:49 AM, Christian Lamparter
<chunkeey@googlemail.com> wrote:
> On Thursday, October 06, 2011 12:27:03 AM Luis R. Rodriguez wrote:
>> You do have a good point, but I disagree that you do not need to test
>> / regress test hardware / driver code for DFS.
>
> Actually, you are sort of contradicting yourself here.
>
> Take a look at your "wireless: add DFS master support" patch
> series. I don't see any IFDEFs to select between the old
> and the new "way" even though you know full well that there's
> some black magic going on.
Well its true, but the regdb and CRDA stuff is can have the DFS master
region support, its just the mapping, not a technical implementation.
IMHO DFS support should be a kconfig on both the 802.11 stack and
driver part, and the driver part depend on the 802.11 stack option.
> http://permalink.gmane.org/gmane.linux.kernel.wireless.general/78455
> Quote:
> "Here's a puzzle though... If we change this series to use the other
> pad byte that was available, the first pad byte, instead of the last
> one, we loose backward compatibility support and I cannot figure out
> why."
That's an implementation weirdness with python pack on generating the
binary output, not a DFS issue per se.
> [Note: This is just an recent enough example. I do think I could come
> up with a better one, e.g.: why didn't athXk have a compile-time
> switch to disable ANI when it was introduced because it can(and has?)
> caused some regressions as well?]
No ANI is *required*, without it the cards are useless. ANI is also
properly tested and validated by our systems team. Have you tried
disabling ANI? When we introduced a revamp of the new ANI though we
did enable users to use the new ANI for older generation cards, the
module parameter is still there.
DFS is a different beast. Testing DFS cannot be compared to testing
ANI, DFS has a slew of different tests you need to run against, and
then *if* you do want to sell cards in certain geographies with
support for DFS channels you need to get proper regulatory
certification for an intended radiator that supports DFS properly. If
you get this certification technically you cannot even expose a knob
to users to disable DFS when operating on a DFS channel.
> so, why do you want a useless compile-time for *this option* *now*?
What I want to do is enable an option which lets distributors disable
DFS if they don't want to even deal with the question of whether or
not a card had DFS support enabled through driver support.
> Is this something about politics/laws I don't know about [I'm just
> curious, because I don't really buy "testing" here, since Zefir
> obviously has a working prototype
No, we haven't passed certified testing with this code yet.
> and Atheros has a working and certificated codebase as well
Exactly, and that is the code we are enabling Neratec with to be able
to upstream into the kernel for, but the code being referenced uses a
different 802.11 stack, different base driver, etc.
> which he can access and base his work on. So I don't think its that unstable and needs added
> ugliness.]
Its the same with 802.11s, its new code and people may want to disable
this crap to not deal with it in code path or even consider the
support for it.
>> This is what I'm talking about. But yes, userspace also submits
>> itself to the same criteria.
>> >> You may also want to simply disable DFS if you do not want to
>> >> deal with the regulatory test implications of having it enabled.
>> > AFAIK you can't "simply" disable the DFS requirement: hostapd
>> > (hw_features.c), [cfg80211] (checks if tx on secondary channel
>> > is possible) and mac80211 (tx.c) all have checks. Indeed, the
>> > easiest way is to modify crda's database. So there's no need
>> > for an extra compile-time option.
>>
>> No, DFS is set for certain channels on wireless-regdb/CRDA, I just
>> posted DFS master region support for wireless-regdb and CRDA. Apart
>> from this we then need driver support. To get DFS you need all of
>> these + hostapd part. Each one has its own set of components and does
>> deserve its own set of tests and review.
>
> This "deserve its own set of tests and review". Does it translate in:
> "ath9k [every driver], mac80211, cfg80211 and hostapd need extra
> DFS IFDEFS?".
I still have yet to see patches for cfg80211 / mac80211 for DFS. What
I'm saying is we have an kconfig option on the 802.11 stack to allow
us to disable DFS support, and the driver respective component depend
on it.
> In fact, ifdefs make it harder to do reviews, because
> sometimes you just forget the IFDEF/ELSIF/ELSE context of the code.
I hate ifdefs, and if you read my e-mail carefully what I was
suggesting was to do this properly by building all the code if the
kconfig option is enabled therefore eliminating all ifdef junk from
the code and only leaving it for header files.
> And regression testing can be done by "git bisect". In fact, isn't
> this what git bisect is for?
There is a difference between regression testing and finding the
culprit of an issue. git bisect is used to find the culprit of an
issue. However if you want to ensure code does not regress you need to
ensure to run a suite of tests on code after a delta is applied. Only
if you find an issue do you then use git bisect.
I want proper test infrastructure set up before I even consider
enabling any DFS code upstream for ath9k.
Luis
^ permalink raw reply
* Re: [ath9k-devel] [RFC 5/6] ath9k: enable DFS pulse detection
From: Luis R. Rodriguez @ 2011-10-06 18:41 UTC (permalink / raw)
To: Christian Lamparter; +Cc: kgiori, ath9k-devel, linux-wireless, Zefir Kurtisi
In-Reply-To: <CAB=NE6WbMi2GYJyFfvsdH-NSXn8dPBsgxgfdGXO_RHiJxwz2Fw@mail.gmail.com>
On Thu, Oct 6, 2011 at 11:36 AM, Luis R. Rodriguez
<rodrigue@qca.qualcomm.com> wrote:
> On Thu, Oct 6, 2011 at 9:49 AM, Christian Lamparter
> <chunkeey@googlemail.com> wrote:
>> Is this something about politics/laws I don't know about [I'm just
>> curious, because I don't really buy "testing" here, since Zefir
>> obviously has a working prototype
>
> No, we haven't passed certified testing with this code yet.
And to be clear, no there is no political issues here or concerns. The
law however is strict about DFS, extremely strict and I want to make
sure upstream code respect it well and we get the best DFS test
infrastructure out there to test this to ensure we get to the point to
always have DFS properly working upstream.
Luis
^ permalink raw reply
* Compat-wireless release for 2011-10-06 is baked
From: Compat-wireless cronjob account @ 2011-10-06 19:04 UTC (permalink / raw)
To: linux-wireless
>From git://github.com/mcgrof/compat-wireless
2309ddb..e4f1a17 master -> origin/master
>From git://github.com/mcgrof/compat
966e847..b5edac3 master -> origin/master
>From git://github.com/sfrothwell/linux-next
+ a2851f2...98b3e8f akpm-end -> origin/akpm-end (forced update)
a8062e4..538d288 akpm-start -> origin/akpm-start
+ 09d70e2...40a33ae master -> origin/master (forced update)
a8062e4..538d288 stable -> origin/stable
* [new tag] next-20111006 -> next-20111006
>From git://github.com/sfrothwell/linux-next
* [new tag] v3.1-rc9 -> v3.1-rc9
compat-wireless code metrics
811845 - Total upstream lines of code being pulled
2413 - backport code changes
2097 - backport code additions
316 - backport code deletions
8588 - backport from compat module
11001 - total backport code
1.3551 - % of code consists of backport work
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(601) [sender=3.0.7]
^ permalink raw reply
* [PATCH 0/8] wl12xx: forward ported Balbi's bus driver refactor
From: Luciano Coelho @ 2011-10-06 19:10 UTC (permalink / raw)
To: coelho; +Cc: linux-wireless
Hi,
Felipe sent this series of patches a long time ago with very good
suggestion on how to avoid the duplicate code we have in the sdio and
spi drivers.
With this, we create a platform device that is handled by a platform
driver. The bus-specific module, creates a platform device and the
core module implements the driver that supports both platform devices
(namely "wl12xx-sdio" and "wl12xx-spi").
I didn't apply this earlier because I had concerns about the change in
the platform data, but now I'm convinced it's not a real problem. It
may affect compat-wireless, but it's easy to solve.
I have now forward-ported the patches, fixed some bugs, removed some
style changes and moved some other things around. For the changes I
made, see the commit message of each patch. Some changes are not in
the commit message, but are explained in the patch emails, after the
Signed-off-by area.
I'm keeping Felipe as the author, since most of the work is his. I
have just tested and fixed it up.
Cheers,
Luca.
Felipe Balbi (8):
wl12xx: add an sdio glue struct to keep wl and device side-by-side
wl12xx: add an spi glue struct to keep wl and device side-by-side
wl12xx: add a platform device to the sdio module
wl12xx: add a platform device to the spi module
wl12xx: add platform driver to the core module
wl12xx: move common init code from bus modules to main
wl12xx: mark some symbols static
wl12xx: drop unneeded plat_dev
drivers/net/wireless/wl12xx/io.c | 11 +-
drivers/net/wireless/wl12xx/io.h | 23 +--
drivers/net/wireless/wl12xx/main.c | 271 +++++++++++++-------
drivers/net/wireless/wl12xx/sdio.c | 217 +++++++----------
drivers/net/wireless/wl12xx/spi.c | 194 ++++++---------
drivers/net/wireless/wl12xx/wl12xx.h | 18 +-
drivers/net/wireless/wl12xx/wl12xx_platform_data.c | 4 +-
include/linux/wl12xx.h | 5 +-
8 files changed, 370 insertions(+), 373 deletions(-)
^ permalink raw reply
* [PATCH 1/8] wl12xx: add an sdio glue struct to keep wl and device side-by-side
From: Luciano Coelho @ 2011-10-06 19:10 UTC (permalink / raw)
To: coelho; +Cc: linux-wireless
In-Reply-To: <1317928259-26437-1-git-send-email-coelho@ti.com>
From: Felipe Balbi <balbi@ti.com>
In order to fully abstract the bus, we need to save the device
structure *beside* wl1271, instead of inside it.
This will help re-structuring the driver so that we avoid the
duplicated code in the bus modules.
Signed-off-by: Felipe Balbi <balbi@ti.com>
[forward-ported and cleaned up and rephrased commit message]
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
drivers/net/wireless/wl12xx/sdio.c | 59 ++++++++++++++++++++++++++----------
1 files changed, 43 insertions(+), 16 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/sdio.c b/drivers/net/wireless/wl12xx/sdio.c
index 516a898..c3ddaa6 100644
--- a/drivers/net/wireless/wl12xx/sdio.c
+++ b/drivers/net/wireless/wl12xx/sdio.c
@@ -44,6 +44,11 @@
#define SDIO_DEVICE_ID_TI_WL1271 0x4076
#endif
+struct wl12xx_sdio_glue {
+ struct device *dev;
+ struct wl1271 *wl;
+};
+
static const struct sdio_device_id wl1271_devices[] __devinitconst = {
{ SDIO_DEVICE(SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271) },
{}
@@ -57,14 +62,14 @@ static void wl1271_sdio_set_block_size(struct wl1271 *wl, unsigned int blksz)
sdio_release_host(wl->if_priv);
}
-static inline struct sdio_func *wl_to_func(struct wl1271 *wl)
+static inline struct wl12xx_sdio_glue *wl_to_glue(struct wl1271 *wl)
{
return wl->if_priv;
}
static struct device *wl1271_sdio_wl_to_dev(struct wl1271 *wl)
{
- return &(wl_to_func(wl)->dev);
+ return wl_to_glue(wl)->dev;
}
static irqreturn_t wl1271_hardirq(int irq, void *cookie)
@@ -110,7 +115,8 @@ static void wl1271_sdio_raw_read(struct wl1271 *wl, int addr, void *buf,
size_t len, bool fixed)
{
int ret;
- struct sdio_func *func = wl_to_func(wl);
+ struct wl12xx_sdio_glue *glue = wl_to_glue(wl);
+ struct sdio_func *func = dev_to_sdio_func(glue->dev);
if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) {
((u8 *)buf)[0] = sdio_f0_readb(func, addr, &ret);
@@ -135,7 +141,8 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
size_t len, bool fixed)
{
int ret;
- struct sdio_func *func = wl_to_func(wl);
+ struct wl12xx_sdio_glue *glue = wl_to_glue(wl);
+ struct sdio_func *func = dev_to_sdio_func(glue->dev);
if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) {
sdio_f0_writeb(func, ((u8 *)buf)[0], addr, &ret);
@@ -158,8 +165,9 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
static int wl1271_sdio_power_on(struct wl1271 *wl)
{
- struct sdio_func *func = wl_to_func(wl);
int ret;
+ struct wl12xx_sdio_glue *glue = wl_to_glue(wl);
+ struct sdio_func *func = dev_to_sdio_func(glue->dev);
/* If enabled, tell runtime PM not to power off the card */
if (pm_runtime_enabled(&func->dev)) {
@@ -182,8 +190,9 @@ out:
static int wl1271_sdio_power_off(struct wl1271 *wl)
{
- struct sdio_func *func = wl_to_func(wl);
int ret;
+ struct wl12xx_sdio_glue *glue = wl_to_glue(wl);
+ struct sdio_func *func = dev_to_sdio_func(glue->dev);
sdio_disable_func(func);
sdio_release_host(func);
@@ -224,21 +233,34 @@ static int __devinit wl1271_probe(struct sdio_func *func,
struct ieee80211_hw *hw;
const struct wl12xx_platform_data *wlan_data;
struct wl1271 *wl;
+ struct wl12xx_sdio_glue *glue;
unsigned long irqflags;
mmc_pm_flag_t mmcflags;
- int ret;
+ int ret = -ENOMEM;
/* We are only able to handle the wlan function */
if (func->num != 0x02)
return -ENODEV;
+ glue = kzalloc(sizeof(*glue), GFP_KERNEL);
+ if (!glue) {
+ wl1271_error("can't allocate glue");
+ goto out;
+ }
+
hw = wl1271_alloc_hw();
- if (IS_ERR(hw))
- return PTR_ERR(hw);
+ if (IS_ERR(hw)) {
+ wl1271_error("can't allocate hw");
+ ret = PTR_ERR(hw);
+ goto out_free_glue;
+ }
wl = hw->priv;
- wl->if_priv = func;
+ glue->dev = &func->dev;
+ glue->wl = wl;
+
+ wl->if_priv = glue;
wl->if_ops = &sdio_ops;
/* Grab access to FN0 for ELP reg. */
@@ -251,7 +273,7 @@ static int __devinit wl1271_probe(struct sdio_func *func,
if (IS_ERR(wlan_data)) {
ret = PTR_ERR(wlan_data);
wl1271_error("missing wlan platform data: %d", ret);
- goto out_free;
+ goto out_free_hw;
}
wl->irq = wlan_data->irq;
@@ -269,7 +291,7 @@ static int __devinit wl1271_probe(struct sdio_func *func,
DRIVER_NAME, wl);
if (ret < 0) {
wl1271_error("request_irq() failed: %d", ret);
- goto out_free;
+ goto out_free_hw;
}
ret = enable_irq_wake(wl->irq);
@@ -294,25 +316,29 @@ static int __devinit wl1271_probe(struct sdio_func *func,
if (ret)
goto out_irq;
- sdio_set_drvdata(func, wl);
+ sdio_set_drvdata(func, glue);
/* Tell PM core that we don't need the card to be powered now */
pm_runtime_put_noidle(&func->dev);
return 0;
- out_irq:
+out_irq:
free_irq(wl->irq, wl);
- out_free:
+out_free_hw:
wl1271_free_hw(wl);
+out_free_glue:
+ kfree(glue);
+out:
return ret;
}
static void __devexit wl1271_remove(struct sdio_func *func)
{
- struct wl1271 *wl = sdio_get_drvdata(func);
+ struct wl12xx_sdio_glue *glue= sdio_get_drvdata(func);
+ struct wl1271 *wl = glue->wl;
/* Undo decrement done above in wl1271_probe */
pm_runtime_get_noresume(&func->dev);
@@ -324,6 +350,7 @@ static void __devexit wl1271_remove(struct sdio_func *func)
}
free_irq(wl->irq, wl);
wl1271_free_hw(wl);
+ kfree(glue);
}
#ifdef CONFIG_PM
--
1.7.1
^ permalink raw reply related
* [PATCH 2/8] wl12xx: add an spi glue struct to keep wl and device side-by-side
From: Luciano Coelho @ 2011-10-06 19:10 UTC (permalink / raw)
To: coelho; +Cc: linux-wireless
In-Reply-To: <1317928259-26437-1-git-send-email-coelho@ti.com>
From: Felipe Balbi <balbi@ti.com>
In order to fully abstract the bus, we need to save the device
structure *beside* wl1271, instead of inside it.
This will help re-structuring the driver so that we avoid the
duplicated code in the bus modules.
Signed-off-by: Felipe Balbi <balbi@ti.com>
[forward-ported and cleaned up and rephrased commit message]
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
drivers/net/wireless/wl12xx/spi.c | 67 ++++++++++++++++++++++++++-----------
1 files changed, 47 insertions(+), 20 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/spi.c b/drivers/net/wireless/wl12xx/spi.c
index 0f97186..16f0c71 100644
--- a/drivers/net/wireless/wl12xx/spi.c
+++ b/drivers/net/wireless/wl12xx/spi.c
@@ -69,14 +69,19 @@
#define WSPI_MAX_NUM_OF_CHUNKS (WL1271_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE)
-static inline struct spi_device *wl_to_spi(struct wl1271 *wl)
+struct wl12xx_spi_glue {
+ struct device *dev;
+ struct wl1271 *wl;
+};
+
+static inline struct wl12xx_spi_glue *wl_to_glue(struct wl1271 *wl)
{
return wl->if_priv;
}
static struct device *wl1271_spi_wl_to_dev(struct wl1271 *wl)
{
- return &(wl_to_spi(wl)->dev);
+ return wl_to_glue(wl)->dev;
}
static void wl1271_spi_disable_interrupts(struct wl1271 *wl)
@@ -91,6 +96,7 @@ static void wl1271_spi_enable_interrupts(struct wl1271 *wl)
static void wl1271_spi_reset(struct wl1271 *wl)
{
+ struct wl12xx_spi_glue *glue = wl_to_glue(wl);
u8 *cmd;
struct spi_transfer t;
struct spi_message m;
@@ -110,7 +116,7 @@ static void wl1271_spi_reset(struct wl1271 *wl)
t.len = WSPI_INIT_CMD_LEN;
spi_message_add_tail(&t, &m);
- spi_sync(wl_to_spi(wl), &m);
+ spi_sync(to_spi_device(glue->dev), &m);
wl1271_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN);
kfree(cmd);
@@ -118,6 +124,7 @@ static void wl1271_spi_reset(struct wl1271 *wl)
static void wl1271_spi_init(struct wl1271 *wl)
{
+ struct wl12xx_spi_glue *glue = wl_to_glue(wl);
u8 crc[WSPI_INIT_CMD_CRC_LEN], *cmd;
struct spi_transfer t;
struct spi_message m;
@@ -165,7 +172,7 @@ static void wl1271_spi_init(struct wl1271 *wl)
t.len = WSPI_INIT_CMD_LEN;
spi_message_add_tail(&t, &m);
- spi_sync(wl_to_spi(wl), &m);
+ spi_sync(to_spi_device(glue->dev), &m);
wl1271_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN);
kfree(cmd);
}
@@ -174,6 +181,7 @@ static void wl1271_spi_init(struct wl1271 *wl)
static int wl1271_spi_read_busy(struct wl1271 *wl)
{
+ struct wl12xx_spi_glue *glue = wl_to_glue(wl);
struct spi_transfer t[1];
struct spi_message m;
u32 *busy_buf;
@@ -194,7 +202,7 @@ static int wl1271_spi_read_busy(struct wl1271 *wl)
t[0].len = sizeof(u32);
t[0].cs_change = true;
spi_message_add_tail(&t[0], &m);
- spi_sync(wl_to_spi(wl), &m);
+ spi_sync(to_spi_device(glue->dev), &m);
if (*busy_buf & 0x1)
return 0;
@@ -208,6 +216,7 @@ static int wl1271_spi_read_busy(struct wl1271 *wl)
static void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf,
size_t len, bool fixed)
{
+ struct wl12xx_spi_glue *glue = wl_to_glue(wl);
struct spi_transfer t[2];
struct spi_message m;
u32 *busy_buf;
@@ -243,7 +252,7 @@ static void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf,
t[1].cs_change = true;
spi_message_add_tail(&t[1], &m);
- spi_sync(wl_to_spi(wl), &m);
+ spi_sync(to_spi_device(glue->dev), &m);
if (!(busy_buf[WL1271_BUSY_WORD_CNT - 1] & 0x1) &&
wl1271_spi_read_busy(wl)) {
@@ -259,7 +268,7 @@ static void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf,
t[0].cs_change = true;
spi_message_add_tail(&t[0], &m);
- spi_sync(wl_to_spi(wl), &m);
+ spi_sync(to_spi_device(glue->dev), &m);
wl1271_dump(DEBUG_SPI, "spi_read cmd -> ", cmd, sizeof(*cmd));
wl1271_dump(DEBUG_SPI, "spi_read buf <- ", buf, chunk_len);
@@ -274,6 +283,7 @@ static void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf,
static void wl1271_spi_raw_write(struct wl1271 *wl, int addr, void *buf,
size_t len, bool fixed)
{
+ struct wl12xx_spi_glue *glue = wl_to_glue(wl);
struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS];
struct spi_message m;
u32 commands[WSPI_MAX_NUM_OF_CHUNKS];
@@ -318,7 +328,7 @@ static void wl1271_spi_raw_write(struct wl1271 *wl, int addr, void *buf,
cmd++;
}
- spi_sync(wl_to_spi(wl), &m);
+ spi_sync(to_spi_device(glue->dev), &m);
}
static irqreturn_t wl1271_hardirq(int irq, void *cookie)
@@ -362,11 +372,12 @@ static struct wl1271_if_operations spi_ops = {
static int __devinit wl1271_probe(struct spi_device *spi)
{
+ struct wl12xx_spi_glue *glue;
struct wl12xx_platform_data *pdata;
struct ieee80211_hw *hw;
struct wl1271 *wl;
unsigned long irqflags;
- int ret;
+ int ret = -ENOMEM;
pdata = spi->dev.platform_data;
if (!pdata) {
@@ -374,14 +385,25 @@ static int __devinit wl1271_probe(struct spi_device *spi)
return -ENODEV;
}
+ glue = kzalloc(sizeof(*glue), GFP_KERNEL);
+ if (!glue) {
+ wl1271_error("can't allocate glue");
+ goto out;
+ }
+
hw = wl1271_alloc_hw();
- if (IS_ERR(hw))
- return PTR_ERR(hw);
+ if (IS_ERR(hw)) {
+ ret = PTR_ERR(hw);
+ goto out_free_glue;
+ }
wl = hw->priv;
- dev_set_drvdata(&spi->dev, wl);
- wl->if_priv = spi;
+ glue->dev = &spi->dev;
+ glue->wl = wl;
+
+ spi_set_drvdata(spi, glue);
+ wl->if_priv = glue;
wl->if_ops = &spi_ops;
@@ -392,14 +414,14 @@ static int __devinit wl1271_probe(struct spi_device *spi)
ret = spi_setup(spi);
if (ret < 0) {
wl1271_error("spi_setup failed");
- goto out_free;
+ goto out_free_hw;
}
wl->set_power = pdata->set_power;
if (!wl->set_power) {
wl1271_error("set power function missing in platform data");
ret = -ENODEV;
- goto out_free;
+ goto out_free_hw;
}
wl->ref_clock = pdata->board_ref_clock;
@@ -415,7 +437,7 @@ static int __devinit wl1271_probe(struct spi_device *spi)
if (wl->irq < 0) {
wl1271_error("irq missing in platform data");
ret = -ENODEV;
- goto out_free;
+ goto out_free_hw;
}
ret = request_threaded_irq(wl->irq, wl1271_hardirq, wl1271_irq,
@@ -423,7 +445,7 @@ static int __devinit wl1271_probe(struct spi_device *spi)
DRIVER_NAME, wl);
if (ret < 0) {
wl1271_error("request_irq() failed: %d", ret);
- goto out_free;
+ goto out_free_hw;
}
disable_irq(wl->irq);
@@ -438,22 +460,27 @@ static int __devinit wl1271_probe(struct spi_device *spi)
return 0;
- out_irq:
+out_irq:
free_irq(wl->irq, wl);
- out_free:
+out_free_hw:
wl1271_free_hw(wl);
+out_free_glue:
+ kfree(glue);
+out:
return ret;
}
static int __devexit wl1271_remove(struct spi_device *spi)
{
- struct wl1271 *wl = dev_get_drvdata(&spi->dev);
+ struct wl12xx_spi_glue *glue = spi_get_drvdata(spi);
+ struct wl1271 *wl = glue->wl;
wl1271_unregister_hw(wl);
free_irq(wl->irq, wl);
wl1271_free_hw(wl);
+ kfree(glue);
return 0;
}
--
1.7.1
^ permalink raw reply related
* [PATCH 3/8] wl12xx: add a platform device to the sdio module
From: Luciano Coelho @ 2011-10-06 19:10 UTC (permalink / raw)
To: coelho; +Cc: linux-wireless
In-Reply-To: <1317928259-26437-1-git-send-email-coelho@ti.com>
From: Felipe Balbi <balbi@ti.com>
The platform device will be used to match the platform driver that
will be implemented by the core module.
Signed-off-by: Felipe Balbi <balbi@ti.com>
[forward-ported, cleaned-up and rephrased commit message]
[call platform_device_add() instead of platform_device_register()]
[store alloc'ed device platform directly in glue->core]
[fixed the length of memset(res...)]
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
drivers/net/wireless/wl12xx/sdio.c | 44 ++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/sdio.c b/drivers/net/wireless/wl12xx/sdio.c
index c3ddaa6..500704f 100644
--- a/drivers/net/wireless/wl12xx/sdio.c
+++ b/drivers/net/wireless/wl12xx/sdio.c
@@ -24,6 +24,7 @@
#include <linux/irq.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
+#include <linux/platform_device.h>
#include <linux/mmc/sdio_func.h>
#include <linux/mmc/sdio_ids.h>
#include <linux/mmc/card.h>
@@ -47,6 +48,7 @@
struct wl12xx_sdio_glue {
struct device *dev;
struct wl1271 *wl;
+ struct platform_device *core;
};
static const struct sdio_device_id wl1271_devices[] __devinitconst = {
@@ -234,6 +236,7 @@ static int __devinit wl1271_probe(struct sdio_func *func,
const struct wl12xx_platform_data *wlan_data;
struct wl1271 *wl;
struct wl12xx_sdio_glue *glue;
+ struct resource res[1];
unsigned long irqflags;
mmc_pm_flag_t mmcflags;
int ret = -ENOMEM;
@@ -321,8 +324,47 @@ static int __devinit wl1271_probe(struct sdio_func *func,
/* Tell PM core that we don't need the card to be powered now */
pm_runtime_put_noidle(&func->dev);
+ glue->core = platform_device_alloc("wl12xx-sdio", -1);
+ if (!glue->core) {
+ wl1271_error("can't allocate platform_device");
+ ret = -ENOMEM;
+ goto out_unreg_hw;
+ }
+
+ glue->core->dev.parent = &func->dev;
+
+ memset(res, 0x00, sizeof(res));
+
+ res[0].start = wlan_data->irq;
+ res[0].flags = IORESOURCE_IRQ;
+ res[0].name = "irq";
+
+ ret = platform_device_add_resources(glue->core, res, ARRAY_SIZE(res));
+ if (ret) {
+ wl1271_error("can't add resources");
+ goto out_dev_put;
+ }
+
+ ret = platform_device_add_data(glue->core, wlan_data,
+ sizeof(*wlan_data));
+ if (ret) {
+ wl1271_error("can't add platform data");
+ goto out_dev_put;
+ }
+
+ ret = platform_device_add(glue->core);
+ if (ret) {
+ wl1271_error("can't add platform device");
+ goto out_dev_put;
+ }
return 0;
+out_dev_put:
+ platform_device_put(glue->core);
+
+out_unreg_hw:
+ wl1271_unregister_hw(wl);
+
out_irq:
free_irq(wl->irq, wl);
@@ -350,6 +392,8 @@ static void __devexit wl1271_remove(struct sdio_func *func)
}
free_irq(wl->irq, wl);
wl1271_free_hw(wl);
+ platform_device_del(glue->core);
+ platform_device_put(glue->core);
kfree(glue);
}
--
1.7.1
^ permalink raw reply related
* [PATCH 4/8] wl12xx: add a platform device to the spi module
From: Luciano Coelho @ 2011-10-06 19:10 UTC (permalink / raw)
To: coelho; +Cc: linux-wireless
In-Reply-To: <1317928259-26437-1-git-send-email-coelho@ti.com>
From: Felipe Balbi <balbi@ti.com>
The platform device will be used to match the platform driver that
will be implemented by the core module.
Signed-off-by: Felipe Balbi <balbi@ti.com>
[forward-ported, cleaned-up and rephrased commit message]
[call platform_device_add() instead of platform_device_register()]
[store alloc'ed device platform directly in glue->core]
[fixed the length of memset(res...)]
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
drivers/net/wireless/wl12xx/spi.c | 44 +++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/spi.c b/drivers/net/wireless/wl12xx/spi.c
index 16f0c71..e075d69 100644
--- a/drivers/net/wireless/wl12xx/spi.c
+++ b/drivers/net/wireless/wl12xx/spi.c
@@ -27,6 +27,7 @@
#include <linux/crc7.h>
#include <linux/spi/spi.h>
#include <linux/wl12xx.h>
+#include <linux/platform_device.h>
#include <linux/slab.h>
#include "wl12xx.h"
@@ -72,6 +73,7 @@
struct wl12xx_spi_glue {
struct device *dev;
struct wl1271 *wl;
+ struct platform_device *core;
};
static inline struct wl12xx_spi_glue *wl_to_glue(struct wl1271 *wl)
@@ -376,6 +378,7 @@ static int __devinit wl1271_probe(struct spi_device *spi)
struct wl12xx_platform_data *pdata;
struct ieee80211_hw *hw;
struct wl1271 *wl;
+ struct resource res[1];
unsigned long irqflags;
int ret = -ENOMEM;
@@ -458,8 +461,47 @@ static int __devinit wl1271_probe(struct spi_device *spi)
if (ret)
goto out_irq;
+ glue->core = platform_device_alloc("wl12xx-spi", -1);
+ if (!glue->core) {
+ dev_err(&spi->dev, "can't allocate platform_device\n");
+ ret = -ENOMEM;
+ goto out_unreg_hw;
+ }
+
+ glue->core->dev.parent = &spi->dev;
+
+ memset(res, 0x00, sizeof(res));
+
+ res[0].start = spi->irq;
+ res[0].flags = IORESOURCE_IRQ;
+ res[0].name = "irq";
+
+ ret = platform_device_add_resources(glue->core, res, ARRAY_SIZE(res));
+ if (ret) {
+ wl1271_error("can't add resources");
+ goto out_dev_put;
+ }
+
+ ret = platform_device_add_data(glue->core, pdata, sizeof(*pdata));
+ if (ret) {
+ wl1271_error("can't add platform data");
+ goto out_dev_put;
+ }
+
+ ret = platform_device_add(glue->core);
+ if (ret) {
+ wl1271_error("can't register platform device");
+ goto out_dev_put;
+ }
+
return 0;
+out_dev_put:
+ platform_device_put(glue->core);
+
+out_unreg_hw:
+ wl1271_unregister_hw(wl);
+
out_irq:
free_irq(wl->irq, wl);
@@ -480,6 +522,8 @@ static int __devexit wl1271_remove(struct spi_device *spi)
wl1271_unregister_hw(wl);
free_irq(wl->irq, wl);
wl1271_free_hw(wl);
+ platform_device_del(glue->core);
+ platform_device_put(glue->core);
kfree(glue);
return 0;
--
1.7.1
^ permalink raw reply related
* [PATCH 5/8] wl12xx: add platform driver to the core module
From: Luciano Coelho @ 2011-10-06 19:10 UTC (permalink / raw)
To: coelho; +Cc: linux-wireless
In-Reply-To: <1317928259-26437-1-git-send-email-coelho@ti.com>
From: Felipe Balbi <balbi@ti.com>
Nnow that we have a platform_device on both glue layers, add a
platform_driver to the core driver.
It's currently an empty platform_driver but more functionality will be
added on later patches.
Signed-off-by: Felipe Balbi <balbi@ti.com>
[forward-ported, cleaned-up and rephrased commit message]
[added platform_driver.driver initialization]
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
drivers/net/wireless/wl12xx/main.c | 39 ++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 194d7cc..84904bd 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -5041,6 +5041,45 @@ int wl1271_free_hw(struct wl1271 *wl)
}
EXPORT_SYMBOL_GPL(wl1271_free_hw);
+static int __devinit wl12xx_probe(struct platform_device *pdev)
+{
+ return 0;
+}
+
+static int __devexit wl12xx_remove(struct platform_device *pdev)
+{
+ return 0;
+}
+
+static const struct platform_device_id wl12xx_id_table[] __devinitconst = {
+ { "wl12xx-sdio", 0 },
+ { "wl12xx-spi", 0 },
+ { } /* Terminating Entry */
+};
+MODULE_DEVICE_TABLE(platform, wl12xx_id_table);
+
+static struct platform_driver wl12xx_driver = {
+ .probe = wl12xx_probe,
+ .remove = __devexit_p(wl12xx_remove),
+ .id_table = wl12xx_id_table,
+ .driver = {
+ .name = "wl12xx",
+ .owner = THIS_MODULE,
+ }
+};
+
+static int __init wl12xx_init(void)
+{
+ return platform_driver_register(&wl12xx_driver);
+}
+module_init(wl12xx_init);
+
+static void __exit wl12xx_exit(void)
+{
+ platform_driver_unregister(&wl12xx_driver);
+}
+module_exit(wl12xx_exit);
+
u32 wl12xx_debug_level = DEBUG_NONE;
EXPORT_SYMBOL_GPL(wl12xx_debug_level);
module_param_named(debug_level, wl12xx_debug_level, uint, S_IRUSR | S_IWUSR);
--
1.7.1
^ permalink raw reply related
* [PATCH 6/8] wl12xx: move common init code from bus modules to main
From: Luciano Coelho @ 2011-10-06 19:10 UTC (permalink / raw)
To: coelho; +Cc: linux-wireless
In-Reply-To: <1317928259-26437-1-git-send-email-coelho@ti.com>
From: Felipe Balbi <balbi@ti.com>
Move all common parts from sdio.c and spi.c to main.c, since they now
can be handled as part of the platform driver.
Signed-off-by: Felipe Balbi <balbi@ti.com>
[forward-ported, cleaned-up and rephrased commit message]
[added a bunch of fixes and a new pdata element]
[moved some new code into main.c as well]
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
A list of my changes, besides the ones mentioned above:
* added some missing #includes;
* added new code from sdio hardirq to main;
* assign some wl elements directly instead of copying from a local;
* added wl->if_ops assignment, which was missing;
* added a new pdata element to pass info whether power on during
suspend is supported;
* removed one unused label in wl12xx_probe().
drivers/net/wireless/wl12xx/io.c | 11 +-
drivers/net/wireless/wl12xx/io.h | 14 +-
drivers/net/wireless/wl12xx/main.c | 110 ++++++++++++-
drivers/net/wireless/wl12xx/sdio.c | 174 ++++----------------
drivers/net/wireless/wl12xx/spi.c | 161 +++----------------
drivers/net/wireless/wl12xx/wl12xx.h | 17 +-
drivers/net/wireless/wl12xx/wl12xx_platform_data.c | 4 +-
include/linux/wl12xx.h | 5 +-
8 files changed, 184 insertions(+), 312 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/io.c b/drivers/net/wireless/wl12xx/io.c
index c2da66f..1a7df8a 100644
--- a/drivers/net/wireless/wl12xx/io.c
+++ b/drivers/net/wireless/wl12xx/io.c
@@ -24,6 +24,7 @@
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
+#include <linux/interrupt.h>
#include "wl12xx.h"
#include "wl12xx_80211.h"
@@ -46,7 +47,7 @@
bool wl1271_set_block_size(struct wl1271 *wl)
{
if (wl->if_ops->set_block_size) {
- wl->if_ops->set_block_size(wl, WL12XX_BUS_BLOCK_SIZE);
+ wl->if_ops->set_block_size(wl->dev, WL12XX_BUS_BLOCK_SIZE);
return true;
}
@@ -55,12 +56,12 @@ bool wl1271_set_block_size(struct wl1271 *wl)
void wl1271_disable_interrupts(struct wl1271 *wl)
{
- wl->if_ops->disable_irq(wl);
+ disable_irq(wl->irq);
}
void wl1271_enable_interrupts(struct wl1271 *wl)
{
- wl->if_ops->enable_irq(wl);
+ enable_irq(wl->irq);
}
/* Set the SPI partitions to access the chip addresses
@@ -128,13 +129,13 @@ EXPORT_SYMBOL_GPL(wl1271_set_partition);
void wl1271_io_reset(struct wl1271 *wl)
{
if (wl->if_ops->reset)
- wl->if_ops->reset(wl);
+ wl->if_ops->reset(wl->dev);
}
void wl1271_io_init(struct wl1271 *wl)
{
if (wl->if_ops->init)
- wl->if_ops->init(wl);
+ wl->if_ops->init(wl->dev);
}
void wl1271_top_reg_write(struct wl1271 *wl, int addr, u16 val)
diff --git a/drivers/net/wireless/wl12xx/io.h b/drivers/net/wireless/wl12xx/io.h
index e839341..e82dad1 100644
--- a/drivers/net/wireless/wl12xx/io.h
+++ b/drivers/net/wireless/wl12xx/io.h
@@ -51,23 +51,17 @@ void wl1271_enable_interrupts(struct wl1271 *wl);
void wl1271_io_reset(struct wl1271 *wl);
void wl1271_io_init(struct wl1271 *wl);
-static inline struct device *wl1271_wl_to_dev(struct wl1271 *wl)
-{
- return wl->if_ops->dev(wl);
-}
-
-
/* Raw target IO, address is not translated */
static inline void wl1271_raw_write(struct wl1271 *wl, int addr, void *buf,
size_t len, bool fixed)
{
- wl->if_ops->write(wl, addr, buf, len, fixed);
+ wl->if_ops->write(wl->dev, addr, buf, len, fixed);
}
static inline void wl1271_raw_read(struct wl1271 *wl, int addr, void *buf,
size_t len, bool fixed)
{
- wl->if_ops->read(wl, addr, buf, len, fixed);
+ wl->if_ops->read(wl->dev, addr, buf, len, fixed);
}
static inline u32 wl1271_raw_read32(struct wl1271 *wl, int addr)
@@ -155,13 +149,13 @@ static inline void wl1271_write32(struct wl1271 *wl, int addr, u32 val)
static inline void wl1271_power_off(struct wl1271 *wl)
{
- wl->if_ops->power(wl, false);
+ wl->if_ops->power(wl->dev, false);
clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
}
static inline int wl1271_power_on(struct wl1271 *wl)
{
- int ret = wl->if_ops->power(wl, true);
+ int ret = wl->if_ops->power(wl->dev, true);
if (ret == 0)
set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 84904bd..e84948d 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -32,6 +32,7 @@
#include <linux/slab.h>
#include <linux/wl12xx.h>
#include <linux/sched.h>
+#include <linux/interrupt.h>
#include "wl12xx.h"
#include "wl12xx_80211.h"
@@ -1058,7 +1059,7 @@ static int wl1271_fetch_firmware(struct wl1271 *wl)
wl1271_debug(DEBUG_BOOT, "booting firmware %s", fw_name);
- ret = request_firmware(&fw, fw_name, wl1271_wl_to_dev(wl));
+ ret = request_firmware(&fw, fw_name, wl->dev);
if (ret < 0) {
wl1271_error("could not get firmware: %d", ret);
@@ -1096,7 +1097,7 @@ static int wl1271_fetch_nvs(struct wl1271 *wl)
const struct firmware *fw;
int ret;
- ret = request_firmware(&fw, WL12XX_NVS_NAME, wl1271_wl_to_dev(wl));
+ ret = request_firmware(&fw, WL12XX_NVS_NAME, wl->dev);
if (ret < 0) {
wl1271_error("could not get nvs file: %d", ret);
@@ -4807,7 +4808,7 @@ int wl1271_init_ieee80211(struct wl1271 *wl)
wl->hw->wiphy->reg_notifier = wl1271_reg_notify;
- SET_IEEE80211_DEV(wl->hw, wl1271_wl_to_dev(wl));
+ SET_IEEE80211_DEV(wl->hw, wl->dev);
wl->hw->sta_data_size = sizeof(struct wl1271_station);
wl->hw->vif_data_size = sizeof(struct wl12xx_vif);
@@ -5041,13 +5042,116 @@ int wl1271_free_hw(struct wl1271 *wl)
}
EXPORT_SYMBOL_GPL(wl1271_free_hw);
+static irqreturn_t wl12xx_hardirq(int irq, void *cookie)
+{
+ struct wl1271 *wl = cookie;
+ unsigned long flags;
+
+ wl1271_debug(DEBUG_IRQ, "IRQ");
+
+ /* complete the ELP completion */
+ spin_lock_irqsave(&wl->wl_lock, flags);
+ set_bit(WL1271_FLAG_IRQ_RUNNING, &wl->flags);
+ if (wl->elp_compl) {
+ complete(wl->elp_compl);
+ wl->elp_compl = NULL;
+ }
+
+ if (test_bit(WL1271_FLAG_SUSPENDED, &wl->flags)) {
+ /* don't enqueue a work right now. mark it as pending */
+ set_bit(WL1271_FLAG_PENDING_WORK, &wl->flags);
+ wl1271_debug(DEBUG_IRQ, "should not enqueue work");
+ disable_irq_nosync(wl->irq);
+ pm_wakeup_event(wl->dev, 0);
+ spin_unlock_irqrestore(&wl->wl_lock, flags);
+ return IRQ_HANDLED;
+ }
+ spin_unlock_irqrestore(&wl->wl_lock, flags);
+
+ return IRQ_WAKE_THREAD;
+}
+
static int __devinit wl12xx_probe(struct platform_device *pdev)
{
+ struct wl12xx_platform_data *pdata = pdev->dev.platform_data;
+ struct ieee80211_hw *hw;
+ struct wl1271 *wl;
+ unsigned long irqflags;
+ int ret = -ENODEV;
+
+ hw = wl1271_alloc_hw();
+ if (IS_ERR(hw)) {
+ wl1271_error("can't allocate hw");
+ ret = PTR_ERR(hw);
+ goto out;
+ }
+
+ wl = hw->priv;
+ wl->irq = platform_get_irq(pdev, 0);
+ wl->ref_clock = pdata->board_ref_clock;
+ wl->tcxo_clock = pdata->board_tcxo_clock;
+ wl->platform_quirks = pdata->platform_quirks;
+ wl->set_power = pdata->set_power;
+ wl->dev = &pdev->dev;
+ wl->if_ops = pdata->ops;
+
+ platform_set_drvdata(pdev, wl);
+
+ if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ)
+ irqflags = IRQF_TRIGGER_RISING;
+ else
+ irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT;
+
+ ret = request_threaded_irq(wl->irq, wl12xx_hardirq, wl1271_irq,
+ irqflags,
+ pdev->name, wl);
+ if (ret < 0) {
+ wl1271_error("request_irq() failed: %d", ret);
+ goto out_free_hw;
+ }
+
+ ret = enable_irq_wake(wl->irq);
+ if (!ret) {
+ wl->irq_wake_enabled = true;
+ device_init_wakeup(wl->dev, 1);
+ if (pdata->pwr_in_suspend)
+ hw->wiphy->wowlan.flags = WIPHY_WOWLAN_ANY;
+
+ }
+ disable_irq(wl->irq);
+
+ ret = wl1271_init_ieee80211(wl);
+ if (ret)
+ goto out_irq;
+
+ ret = wl1271_register_hw(wl);
+ if (ret)
+ goto out_irq;
+
return 0;
+
+out_irq:
+ free_irq(wl->irq, wl);
+
+out_free_hw:
+ wl1271_free_hw(wl);
+
+out:
+ return ret;
}
static int __devexit wl12xx_remove(struct platform_device *pdev)
{
+ struct wl1271 *wl = platform_get_drvdata(pdev);
+
+ if (wl->irq_wake_enabled) {
+ device_init_wakeup(wl->dev, 0);
+ disable_irq_wake(wl->irq);
+ }
+ wl1271_unregister_hw(wl);
+ free_irq(wl->irq, wl);
+ wl1271_free_hw(wl);
+
return 0;
}
diff --git a/drivers/net/wireless/wl12xx/sdio.c b/drivers/net/wireless/wl12xx/sdio.c
index 500704f..0374bcd 100644
--- a/drivers/net/wireless/wl12xx/sdio.c
+++ b/drivers/net/wireless/wl12xx/sdio.c
@@ -47,7 +47,6 @@
struct wl12xx_sdio_glue {
struct device *dev;
- struct wl1271 *wl;
struct platform_device *core;
};
@@ -57,67 +56,22 @@ static const struct sdio_device_id wl1271_devices[] __devinitconst = {
};
MODULE_DEVICE_TABLE(sdio, wl1271_devices);
-static void wl1271_sdio_set_block_size(struct wl1271 *wl, unsigned int blksz)
+static void wl1271_sdio_set_block_size(struct device *child,
+ unsigned int blksz)
{
- sdio_claim_host(wl->if_priv);
- sdio_set_block_size(wl->if_priv, blksz);
- sdio_release_host(wl->if_priv);
-}
-
-static inline struct wl12xx_sdio_glue *wl_to_glue(struct wl1271 *wl)
-{
- return wl->if_priv;
-}
-
-static struct device *wl1271_sdio_wl_to_dev(struct wl1271 *wl)
-{
- return wl_to_glue(wl)->dev;
-}
-
-static irqreturn_t wl1271_hardirq(int irq, void *cookie)
-{
- struct wl1271 *wl = cookie;
- unsigned long flags;
-
- wl1271_debug(DEBUG_IRQ, "IRQ");
-
- /* complete the ELP completion */
- spin_lock_irqsave(&wl->wl_lock, flags);
- set_bit(WL1271_FLAG_IRQ_RUNNING, &wl->flags);
- if (wl->elp_compl) {
- complete(wl->elp_compl);
- wl->elp_compl = NULL;
- }
-
- if (test_bit(WL1271_FLAG_SUSPENDED, &wl->flags)) {
- /* don't enqueue a work right now. mark it as pending */
- set_bit(WL1271_FLAG_PENDING_WORK, &wl->flags);
- wl1271_debug(DEBUG_IRQ, "should not enqueue work");
- disable_irq_nosync(wl->irq);
- pm_wakeup_event(wl1271_sdio_wl_to_dev(wl), 0);
- spin_unlock_irqrestore(&wl->wl_lock, flags);
- return IRQ_HANDLED;
- }
- spin_unlock_irqrestore(&wl->wl_lock, flags);
-
- return IRQ_WAKE_THREAD;
-}
-
-static void wl1271_sdio_disable_interrupts(struct wl1271 *wl)
-{
- disable_irq(wl->irq);
-}
+ struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent);
+ struct sdio_func *func = dev_to_sdio_func(glue->dev);
-static void wl1271_sdio_enable_interrupts(struct wl1271 *wl)
-{
- enable_irq(wl->irq);
+ sdio_claim_host(func);
+ sdio_set_block_size(func, blksz);
+ sdio_release_host(func);
}
-static void wl1271_sdio_raw_read(struct wl1271 *wl, int addr, void *buf,
+static void wl12xx_sdio_raw_read(struct device *child, int addr, void *buf,
size_t len, bool fixed)
{
int ret;
- struct wl12xx_sdio_glue *glue = wl_to_glue(wl);
+ struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent);
struct sdio_func *func = dev_to_sdio_func(glue->dev);
if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) {
@@ -139,11 +93,11 @@ static void wl1271_sdio_raw_read(struct wl1271 *wl, int addr, void *buf,
wl1271_error("sdio read failed (%d)", ret);
}
-static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
+static void wl12xx_sdio_raw_write(struct device *child, int addr, void *buf,
size_t len, bool fixed)
{
int ret;
- struct wl12xx_sdio_glue *glue = wl_to_glue(wl);
+ struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent);
struct sdio_func *func = dev_to_sdio_func(glue->dev);
if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) {
@@ -165,10 +119,9 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
wl1271_error("sdio write failed (%d)", ret);
}
-static int wl1271_sdio_power_on(struct wl1271 *wl)
+static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue)
{
int ret;
- struct wl12xx_sdio_glue *glue = wl_to_glue(wl);
struct sdio_func *func = dev_to_sdio_func(glue->dev);
/* If enabled, tell runtime PM not to power off the card */
@@ -190,10 +143,9 @@ out:
return ret;
}
-static int wl1271_sdio_power_off(struct wl1271 *wl)
+static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue *glue)
{
int ret;
- struct wl12xx_sdio_glue *glue = wl_to_glue(wl);
struct sdio_func *func = dev_to_sdio_func(glue->dev);
sdio_disable_func(func);
@@ -211,33 +163,29 @@ static int wl1271_sdio_power_off(struct wl1271 *wl)
return ret;
}
-static int wl1271_sdio_set_power(struct wl1271 *wl, bool enable)
+static int wl12xx_sdio_set_power(struct device *child, bool enable)
{
+ struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent);
+
if (enable)
- return wl1271_sdio_power_on(wl);
+ return wl12xx_sdio_power_on(glue);
else
- return wl1271_sdio_power_off(wl);
+ return wl12xx_sdio_power_off(glue);
}
static struct wl1271_if_operations sdio_ops = {
- .read = wl1271_sdio_raw_read,
- .write = wl1271_sdio_raw_write,
- .power = wl1271_sdio_set_power,
- .dev = wl1271_sdio_wl_to_dev,
- .enable_irq = wl1271_sdio_enable_interrupts,
- .disable_irq = wl1271_sdio_disable_interrupts,
+ .read = wl12xx_sdio_raw_read,
+ .write = wl12xx_sdio_raw_write,
+ .power = wl12xx_sdio_set_power,
.set_block_size = wl1271_sdio_set_block_size,
};
static int __devinit wl1271_probe(struct sdio_func *func,
const struct sdio_device_id *id)
{
- struct ieee80211_hw *hw;
- const struct wl12xx_platform_data *wlan_data;
- struct wl1271 *wl;
+ struct wl12xx_platform_data *wlan_data;
struct wl12xx_sdio_glue *glue;
struct resource res[1];
- unsigned long irqflags;
mmc_pm_flag_t mmcflags;
int ret = -ENOMEM;
@@ -251,20 +199,7 @@ static int __devinit wl1271_probe(struct sdio_func *func,
goto out;
}
- hw = wl1271_alloc_hw();
- if (IS_ERR(hw)) {
- wl1271_error("can't allocate hw");
- ret = PTR_ERR(hw);
- goto out_free_glue;
- }
-
- wl = hw->priv;
-
glue->dev = &func->dev;
- glue->wl = wl;
-
- wl->if_priv = glue;
- wl->if_ops = &sdio_ops;
/* Grab access to FN0 for ELP reg. */
func->card->quirks |= MMC_QUIRK_LENIENT_FN0;
@@ -276,48 +211,17 @@ static int __devinit wl1271_probe(struct sdio_func *func,
if (IS_ERR(wlan_data)) {
ret = PTR_ERR(wlan_data);
wl1271_error("missing wlan platform data: %d", ret);
- goto out_free_hw;
- }
-
- wl->irq = wlan_data->irq;
- wl->ref_clock = wlan_data->board_ref_clock;
- wl->tcxo_clock = wlan_data->board_tcxo_clock;
- wl->platform_quirks = wlan_data->platform_quirks;
-
- if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ)
- irqflags = IRQF_TRIGGER_RISING;
- else
- irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT;
-
- ret = request_threaded_irq(wl->irq, wl1271_hardirq, wl1271_irq,
- irqflags,
- DRIVER_NAME, wl);
- if (ret < 0) {
- wl1271_error("request_irq() failed: %d", ret);
- goto out_free_hw;
+ goto out_free_glue;
}
- ret = enable_irq_wake(wl->irq);
- if (!ret) {
- wl->irq_wake_enabled = true;
- device_init_wakeup(wl1271_sdio_wl_to_dev(wl), 1);
+ /* if sdio can keep power while host is suspended, enable wow */
+ mmcflags = sdio_get_host_pm_caps(func);
+ wl1271_debug(DEBUG_SDIO, "sdio PM caps = 0x%x", mmcflags);
- /* if sdio can keep power while host is suspended, enable wow */
- mmcflags = sdio_get_host_pm_caps(func);
- wl1271_debug(DEBUG_SDIO, "sdio PM caps = 0x%x", mmcflags);
+ if (mmcflags & MMC_PM_KEEP_POWER)
+ wlan_data->pwr_in_suspend = true;
- if (mmcflags & MMC_PM_KEEP_POWER)
- hw->wiphy->wowlan.flags = WIPHY_WOWLAN_ANY;
- }
- disable_irq(wl->irq);
-
- ret = wl1271_init_ieee80211(wl);
- if (ret)
- goto out_irq;
-
- ret = wl1271_register_hw(wl);
- if (ret)
- goto out_irq;
+ wlan_data->ops = &sdio_ops;
sdio_set_drvdata(func, glue);
@@ -328,7 +232,7 @@ static int __devinit wl1271_probe(struct sdio_func *func,
if (!glue->core) {
wl1271_error("can't allocate platform_device");
ret = -ENOMEM;
- goto out_unreg_hw;
+ goto out_free_glue;
}
glue->core->dev.parent = &func->dev;
@@ -362,17 +266,9 @@ static int __devinit wl1271_probe(struct sdio_func *func,
out_dev_put:
platform_device_put(glue->core);
-out_unreg_hw:
- wl1271_unregister_hw(wl);
-
-out_irq:
- free_irq(wl->irq, wl);
-
-out_free_hw:
- wl1271_free_hw(wl);
-
out_free_glue:
kfree(glue);
+
out:
return ret;
}
@@ -380,18 +276,10 @@ out:
static void __devexit wl1271_remove(struct sdio_func *func)
{
struct wl12xx_sdio_glue *glue= sdio_get_drvdata(func);
- struct wl1271 *wl = glue->wl;
/* Undo decrement done above in wl1271_probe */
pm_runtime_get_noresume(&func->dev);
- wl1271_unregister_hw(wl);
- if (wl->irq_wake_enabled) {
- device_init_wakeup(wl1271_sdio_wl_to_dev(wl), 0);
- disable_irq_wake(wl->irq);
- }
- free_irq(wl->irq, wl);
- wl1271_free_hw(wl);
platform_device_del(glue->core);
platform_device_put(glue->core);
kfree(glue);
diff --git a/drivers/net/wireless/wl12xx/spi.c b/drivers/net/wireless/wl12xx/spi.c
index e075d69..54ee9c1 100644
--- a/drivers/net/wireless/wl12xx/spi.c
+++ b/drivers/net/wireless/wl12xx/spi.c
@@ -72,33 +72,12 @@
struct wl12xx_spi_glue {
struct device *dev;
- struct wl1271 *wl;
struct platform_device *core;
};
-static inline struct wl12xx_spi_glue *wl_to_glue(struct wl1271 *wl)
+static void wl12xx_spi_reset(struct device *child)
{
- return wl->if_priv;
-}
-
-static struct device *wl1271_spi_wl_to_dev(struct wl1271 *wl)
-{
- return wl_to_glue(wl)->dev;
-}
-
-static void wl1271_spi_disable_interrupts(struct wl1271 *wl)
-{
- disable_irq(wl->irq);
-}
-
-static void wl1271_spi_enable_interrupts(struct wl1271 *wl)
-{
- enable_irq(wl->irq);
-}
-
-static void wl1271_spi_reset(struct wl1271 *wl)
-{
- struct wl12xx_spi_glue *glue = wl_to_glue(wl);
+ struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
u8 *cmd;
struct spi_transfer t;
struct spi_message m;
@@ -124,9 +103,9 @@ static void wl1271_spi_reset(struct wl1271 *wl)
kfree(cmd);
}
-static void wl1271_spi_init(struct wl1271 *wl)
+static void wl12xx_spi_init(struct device *child)
{
- struct wl12xx_spi_glue *glue = wl_to_glue(wl);
+ struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
u8 crc[WSPI_INIT_CMD_CRC_LEN], *cmd;
struct spi_transfer t;
struct spi_message m;
@@ -181,9 +160,10 @@ static void wl1271_spi_init(struct wl1271 *wl)
#define WL1271_BUSY_WORD_TIMEOUT 1000
-static int wl1271_spi_read_busy(struct wl1271 *wl)
+static int wl12xx_spi_read_busy(struct device *child)
{
- struct wl12xx_spi_glue *glue = wl_to_glue(wl);
+ struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
+ struct wl1271 *wl = dev_get_drvdata(child);
struct spi_transfer t[1];
struct spi_message m;
u32 *busy_buf;
@@ -215,10 +195,11 @@ static int wl1271_spi_read_busy(struct wl1271 *wl)
return -ETIMEDOUT;
}
-static void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf,
+static void wl12xx_spi_raw_read(struct device *child, int addr, void *buf,
size_t len, bool fixed)
{
- struct wl12xx_spi_glue *glue = wl_to_glue(wl);
+ struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
+ struct wl1271 *wl = dev_get_drvdata(child);
struct spi_transfer t[2];
struct spi_message m;
u32 *busy_buf;
@@ -257,7 +238,7 @@ static void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf,
spi_sync(to_spi_device(glue->dev), &m);
if (!(busy_buf[WL1271_BUSY_WORD_CNT - 1] & 0x1) &&
- wl1271_spi_read_busy(wl)) {
+ wl12xx_spi_read_busy(child)) {
memset(buf, 0, chunk_len);
return;
}
@@ -282,10 +263,10 @@ static void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf,
}
}
-static void wl1271_spi_raw_write(struct wl1271 *wl, int addr, void *buf,
- size_t len, bool fixed)
+static void wl12xx_spi_raw_write(struct device *child, int addr, void *buf,
+ size_t len, bool fixed)
{
- struct wl12xx_spi_glue *glue = wl_to_glue(wl);
+ struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS];
struct spi_message m;
u32 commands[WSPI_MAX_NUM_OF_CHUNKS];
@@ -333,42 +314,11 @@ static void wl1271_spi_raw_write(struct wl1271 *wl, int addr, void *buf,
spi_sync(to_spi_device(glue->dev), &m);
}
-static irqreturn_t wl1271_hardirq(int irq, void *cookie)
-{
- struct wl1271 *wl = cookie;
- unsigned long flags;
-
- wl1271_debug(DEBUG_IRQ, "IRQ");
-
- /* complete the ELP completion */
- spin_lock_irqsave(&wl->wl_lock, flags);
- set_bit(WL1271_FLAG_IRQ_RUNNING, &wl->flags);
- if (wl->elp_compl) {
- complete(wl->elp_compl);
- wl->elp_compl = NULL;
- }
- spin_unlock_irqrestore(&wl->wl_lock, flags);
-
- return IRQ_WAKE_THREAD;
-}
-
-static int wl1271_spi_set_power(struct wl1271 *wl, bool enable)
-{
- if (wl->set_power)
- wl->set_power(enable);
-
- return 0;
-}
-
static struct wl1271_if_operations spi_ops = {
- .read = wl1271_spi_raw_read,
- .write = wl1271_spi_raw_write,
- .reset = wl1271_spi_reset,
- .init = wl1271_spi_init,
- .power = wl1271_spi_set_power,
- .dev = wl1271_spi_wl_to_dev,
- .enable_irq = wl1271_spi_enable_interrupts,
- .disable_irq = wl1271_spi_disable_interrupts,
+ .read = wl12xx_spi_raw_read,
+ .write = wl12xx_spi_raw_write,
+ .reset = wl12xx_spi_reset,
+ .init = wl12xx_spi_init,
.set_block_size = NULL,
};
@@ -376,10 +326,7 @@ static int __devinit wl1271_probe(struct spi_device *spi)
{
struct wl12xx_spi_glue *glue;
struct wl12xx_platform_data *pdata;
- struct ieee80211_hw *hw;
- struct wl1271 *wl;
struct resource res[1];
- unsigned long irqflags;
int ret = -ENOMEM;
pdata = spi->dev.platform_data;
@@ -388,27 +335,17 @@ static int __devinit wl1271_probe(struct spi_device *spi)
return -ENODEV;
}
+ pdata->ops = &spi_ops;
+
glue = kzalloc(sizeof(*glue), GFP_KERNEL);
if (!glue) {
wl1271_error("can't allocate glue");
goto out;
}
- hw = wl1271_alloc_hw();
- if (IS_ERR(hw)) {
- ret = PTR_ERR(hw);
- goto out_free_glue;
- }
-
- wl = hw->priv;
-
glue->dev = &spi->dev;
- glue->wl = wl;
spi_set_drvdata(spi, glue);
- wl->if_priv = glue;
-
- wl->if_ops = &spi_ops;
/* This is the only SPI value that we need to set here, the rest
* comes from the board-peripherals file */
@@ -417,55 +354,14 @@ static int __devinit wl1271_probe(struct spi_device *spi)
ret = spi_setup(spi);
if (ret < 0) {
wl1271_error("spi_setup failed");
- goto out_free_hw;
- }
-
- wl->set_power = pdata->set_power;
- if (!wl->set_power) {
- wl1271_error("set power function missing in platform data");
- ret = -ENODEV;
- goto out_free_hw;
- }
-
- wl->ref_clock = pdata->board_ref_clock;
- wl->tcxo_clock = pdata->board_tcxo_clock;
- wl->platform_quirks = pdata->platform_quirks;
-
- if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ)
- irqflags = IRQF_TRIGGER_RISING;
- else
- irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT;
-
- wl->irq = spi->irq;
- if (wl->irq < 0) {
- wl1271_error("irq missing in platform data");
- ret = -ENODEV;
- goto out_free_hw;
- }
-
- ret = request_threaded_irq(wl->irq, wl1271_hardirq, wl1271_irq,
- irqflags,
- DRIVER_NAME, wl);
- if (ret < 0) {
- wl1271_error("request_irq() failed: %d", ret);
- goto out_free_hw;
+ goto out_free_glue;
}
- disable_irq(wl->irq);
-
- ret = wl1271_init_ieee80211(wl);
- if (ret)
- goto out_irq;
-
- ret = wl1271_register_hw(wl);
- if (ret)
- goto out_irq;
-
glue->core = platform_device_alloc("wl12xx-spi", -1);
if (!glue->core) {
dev_err(&spi->dev, "can't allocate platform_device\n");
ret = -ENOMEM;
- goto out_unreg_hw;
+ goto out_free_glue;
}
glue->core->dev.parent = &spi->dev;
@@ -499,15 +395,6 @@ static int __devinit wl1271_probe(struct spi_device *spi)
out_dev_put:
platform_device_put(glue->core);
-out_unreg_hw:
- wl1271_unregister_hw(wl);
-
-out_irq:
- free_irq(wl->irq, wl);
-
-out_free_hw:
- wl1271_free_hw(wl);
-
out_free_glue:
kfree(glue);
out:
@@ -517,11 +404,7 @@ out:
static int __devexit wl1271_remove(struct spi_device *spi)
{
struct wl12xx_spi_glue *glue = spi_get_drvdata(spi);
- struct wl1271 *wl = glue->wl;
- wl1271_unregister_hw(wl);
- free_irq(wl->irq, wl);
- wl1271_free_hw(wl);
platform_device_del(glue->core);
platform_device_put(glue->core);
kfree(glue);
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h
index 074de4e..091fdd2 100644
--- a/drivers/net/wireless/wl12xx/wl12xx.h
+++ b/drivers/net/wireless/wl12xx/wl12xx.h
@@ -286,17 +286,14 @@ struct wl1271_scan {
};
struct wl1271_if_operations {
- void (*read)(struct wl1271 *wl, int addr, void *buf, size_t len,
+ void (*read)(struct device *child, int addr, void *buf, size_t len,
bool fixed);
- void (*write)(struct wl1271 *wl, int addr, void *buf, size_t len,
+ void (*write)(struct device *child, int addr, void *buf, size_t len,
bool fixed);
- void (*reset)(struct wl1271 *wl);
- void (*init)(struct wl1271 *wl);
- int (*power)(struct wl1271 *wl, bool enable);
- struct device* (*dev)(struct wl1271 *wl);
- void (*enable_irq)(struct wl1271 *wl);
- void (*disable_irq)(struct wl1271 *wl);
- void (*set_block_size) (struct wl1271 *wl, unsigned int blksz);
+ void (*reset)(struct device *child);
+ void (*init)(struct device *child);
+ int (*power)(struct device *child, bool enable);
+ void (*set_block_size) (struct device *child, unsigned int blksz);
};
#define MAX_NUM_KEYS 14
@@ -357,6 +354,8 @@ struct wl1271 {
struct ieee80211_hw *hw;
bool mac80211_registered;
+ struct device *dev;
+
void *if_priv;
struct wl1271_if_operations *if_ops;
diff --git a/drivers/net/wireless/wl12xx/wl12xx_platform_data.c b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
index 973b110..3c96b33 100644
--- a/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
+++ b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
@@ -2,7 +2,7 @@
#include <linux/err.h>
#include <linux/wl12xx.h>
-static const struct wl12xx_platform_data *platform_data;
+static struct wl12xx_platform_data *platform_data;
int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
{
@@ -18,7 +18,7 @@ int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
return 0;
}
-const struct wl12xx_platform_data *wl12xx_get_platform_data(void)
+struct wl12xx_platform_data *wl12xx_get_platform_data(void)
{
if (!platform_data)
return ERR_PTR(-ENODEV);
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 4b69739..0d63731 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -54,6 +54,9 @@ struct wl12xx_platform_data {
int board_ref_clock;
int board_tcxo_clock;
unsigned long platform_quirks;
+ bool pwr_in_suspend;
+
+ struct wl1271_if_operations *ops;
};
/* Platform does not support level trigger interrupts */
@@ -73,6 +76,6 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
#endif
-const struct wl12xx_platform_data *wl12xx_get_platform_data(void);
+struct wl12xx_platform_data *wl12xx_get_platform_data(void);
#endif
--
1.7.1
^ permalink raw reply related
* [PATCH 7/8] wl12xx: mark some symbols static
From: Luciano Coelho @ 2011-10-06 19:10 UTC (permalink / raw)
To: coelho; +Cc: linux-wireless
In-Reply-To: <1317928259-26437-1-git-send-email-coelho@ti.com>
From: Felipe Balbi <balbi@ti.com>
after re-factoring a bunch of symbols are only
used inside main.c which allows us to mark
them as static.
Signed-off-by: Felipe Balbi <balbi@ti.com>
[forward-ported]
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
drivers/net/wireless/wl12xx/io.h | 9 ++-------
drivers/net/wireless/wl12xx/main.c | 18 ++++++------------
2 files changed, 8 insertions(+), 19 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/io.h b/drivers/net/wireless/wl12xx/io.h
index e82dad1..d398cbc 100644
--- a/drivers/net/wireless/wl12xx/io.h
+++ b/drivers/net/wireless/wl12xx/io.h
@@ -170,15 +170,10 @@ u16 wl1271_top_reg_read(struct wl1271 *wl, int addr);
int wl1271_set_partition(struct wl1271 *wl,
struct wl1271_partition_set *p);
+bool wl1271_set_block_size(struct wl1271 *wl);
+
/* Functions from wl1271_main.c */
-int wl1271_register_hw(struct wl1271 *wl);
-void wl1271_unregister_hw(struct wl1271 *wl);
-int wl1271_init_ieee80211(struct wl1271 *wl);
-struct ieee80211_hw *wl1271_alloc_hw(void);
-int wl1271_free_hw(struct wl1271 *wl);
-irqreturn_t wl1271_irq(int irq, void *data);
-bool wl1271_set_block_size(struct wl1271 *wl);
int wl1271_tx_dummy_packet(struct wl1271 *wl);
#endif
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index e84948d..18f87f0 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -922,7 +922,7 @@ static void wl1271_netstack_work(struct work_struct *work)
#define WL1271_IRQ_MAX_LOOPS 256
-irqreturn_t wl1271_irq(int irq, void *cookie)
+static irqreturn_t wl1271_irq(int irq, void *cookie)
{
int ret;
u32 intr;
@@ -1044,7 +1044,6 @@ out:
return IRQ_HANDLED;
}
-EXPORT_SYMBOL_GPL(wl1271_irq);
static int wl1271_fetch_firmware(struct wl1271 *wl)
{
@@ -4676,7 +4675,7 @@ static struct bin_attribute fwlog_attr = {
.read = wl1271_sysfs_read_fwlog,
};
-int wl1271_register_hw(struct wl1271 *wl)
+static int wl1271_register_hw(struct wl1271 *wl)
{
int ret;
@@ -4717,9 +4716,8 @@ int wl1271_register_hw(struct wl1271 *wl)
return 0;
}
-EXPORT_SYMBOL_GPL(wl1271_register_hw);
-void wl1271_unregister_hw(struct wl1271 *wl)
+static void wl1271_unregister_hw(struct wl1271 *wl)
{
if (wl->state == WL1271_STATE_PLT)
__wl1271_plt_stop(wl);
@@ -4729,9 +4727,8 @@ void wl1271_unregister_hw(struct wl1271 *wl)
wl->mac80211_registered = false;
}
-EXPORT_SYMBOL_GPL(wl1271_unregister_hw);
-int wl1271_init_ieee80211(struct wl1271 *wl)
+static int wl1271_init_ieee80211(struct wl1271 *wl)
{
static const u32 cipher_suites[] = {
WLAN_CIPHER_SUITE_WEP40,
@@ -4817,11 +4814,10 @@ int wl1271_init_ieee80211(struct wl1271 *wl)
return 0;
}
-EXPORT_SYMBOL_GPL(wl1271_init_ieee80211);
#define WL1271_DEFAULT_CHANNEL 0
-struct ieee80211_hw *wl1271_alloc_hw(void)
+static struct ieee80211_hw *wl1271_alloc_hw(void)
{
struct ieee80211_hw *hw;
struct platform_device *plat_dev = NULL;
@@ -5003,9 +4999,8 @@ err_hw_alloc:
return ERR_PTR(ret);
}
-EXPORT_SYMBOL_GPL(wl1271_alloc_hw);
-int wl1271_free_hw(struct wl1271 *wl)
+static int wl1271_free_hw(struct wl1271 *wl)
{
/* Unblock any fwlog readers */
mutex_lock(&wl->mutex);
@@ -5040,7 +5035,6 @@ int wl1271_free_hw(struct wl1271 *wl)
return 0;
}
-EXPORT_SYMBOL_GPL(wl1271_free_hw);
static irqreturn_t wl12xx_hardirq(int irq, void *cookie)
{
--
1.7.1
^ permalink raw reply related
* [PATCH 8/8] wl12xx: drop unneeded plat_dev
From: Luciano Coelho @ 2011-10-06 19:10 UTC (permalink / raw)
To: coelho; +Cc: linux-wireless
In-Reply-To: <1317928259-26437-1-git-send-email-coelho@ti.com>
From: Felipe Balbi <balbi@ti.com>
now that useless plat_dev is unnecessary,
we can remove it.
Signed-off-by: Felipe Balbi <balbi@ti.com>
[forward ported and fixed sysfs file creation]
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
Moved sysfs file creation to the end of the probe function instead of
doing it in the hw_alloc() function. It's too early to do it in
hw_alloc, because we don't have wl->dev at that point yet.
drivers/net/wireless/wl12xx/main.c | 104 ++++++++++------------------------
drivers/net/wireless/wl12xx/wl12xx.h | 1 -
2 files changed, 30 insertions(+), 75 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 18f87f0..63ff36c 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -382,22 +382,6 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl,
bool reset_tx_queues);
static void wl1271_free_ap_keys(struct wl1271 *wl, struct wl12xx_vif *wlvif);
-
-static void wl1271_device_release(struct device *dev)
-{
-
-}
-
-static struct platform_device wl1271_device = {
- .name = "wl1271",
- .id = -1,
-
- /* device model insists to have a release function */
- .dev = {
- .release = wl1271_device_release,
- },
-};
-
static DEFINE_MUTEX(wl_list_mutex);
static LIST_HEAD(wl_list);
@@ -4820,7 +4804,6 @@ static int wl1271_init_ieee80211(struct wl1271 *wl)
static struct ieee80211_hw *wl1271_alloc_hw(void)
{
struct ieee80211_hw *hw;
- struct platform_device *plat_dev = NULL;
struct wl1271 *wl;
int i, j, ret;
unsigned int order;
@@ -4834,20 +4817,12 @@ static struct ieee80211_hw *wl1271_alloc_hw(void)
goto err_hw_alloc;
}
- plat_dev = kmemdup(&wl1271_device, sizeof(wl1271_device), GFP_KERNEL);
- if (!plat_dev) {
- wl1271_error("could not allocate platform_device");
- ret = -ENOMEM;
- goto err_plat_alloc;
- }
-
wl = hw->priv;
memset(wl, 0, sizeof(*wl));
INIT_LIST_HEAD(&wl->list);
wl->hw = hw;
- wl->plat_dev = plat_dev;
for (i = 0; i < NUM_TX_QUEUES; i++)
skb_queue_head_init(&wl->tx_queue[i]);
@@ -4936,49 +4911,8 @@ static struct ieee80211_hw *wl1271_alloc_hw(void)
goto err_dummy_packet;
}
- /* Register platform device */
- ret = platform_device_register(wl->plat_dev);
- if (ret) {
- wl1271_error("couldn't register platform device");
- goto err_fwlog;
- }
- dev_set_drvdata(&wl->plat_dev->dev, wl);
-
- /* Create sysfs file to control bt coex state */
- ret = device_create_file(&wl->plat_dev->dev, &dev_attr_bt_coex_state);
- if (ret < 0) {
- wl1271_error("failed to create sysfs file bt_coex_state");
- goto err_platform;
- }
-
- /* Create sysfs file to get HW PG version */
- ret = device_create_file(&wl->plat_dev->dev, &dev_attr_hw_pg_ver);
- if (ret < 0) {
- wl1271_error("failed to create sysfs file hw_pg_ver");
- goto err_bt_coex_state;
- }
-
- /* Create sysfs file for the FW log */
- ret = device_create_bin_file(&wl->plat_dev->dev, &fwlog_attr);
- if (ret < 0) {
- wl1271_error("failed to create sysfs file fwlog");
- goto err_hw_pg_ver;
- }
-
return hw;
-err_hw_pg_ver:
- device_remove_file(&wl->plat_dev->dev, &dev_attr_hw_pg_ver);
-
-err_bt_coex_state:
- device_remove_file(&wl->plat_dev->dev, &dev_attr_bt_coex_state);
-
-err_platform:
- platform_device_unregister(wl->plat_dev);
-
-err_fwlog:
- free_page((unsigned long)wl->fwlog);
-
err_dummy_packet:
dev_kfree_skb(wl->dummy_packet);
@@ -4990,9 +4924,6 @@ err_wq:
err_hw:
wl1271_debugfs_exit(wl);
- kfree(plat_dev);
-
-err_plat_alloc:
ieee80211_free_hw(hw);
err_hw_alloc:
@@ -5008,17 +4939,15 @@ static int wl1271_free_hw(struct wl1271 *wl)
wake_up_interruptible_all(&wl->fwlog_waitq);
mutex_unlock(&wl->mutex);
- device_remove_bin_file(&wl->plat_dev->dev, &fwlog_attr);
+ device_remove_bin_file(wl->dev, &fwlog_attr);
- device_remove_file(&wl->plat_dev->dev, &dev_attr_hw_pg_ver);
+ device_remove_file(wl->dev, &dev_attr_hw_pg_ver);
- device_remove_file(&wl->plat_dev->dev, &dev_attr_bt_coex_state);
- platform_device_unregister(wl->plat_dev);
+ device_remove_file(wl->dev, &dev_attr_bt_coex_state);
free_page((unsigned long)wl->fwlog);
dev_kfree_skb(wl->dummy_packet);
free_pages((unsigned long)wl->aggr_buf,
get_order(WL1271_AGGR_BUFFER_SIZE));
- kfree(wl->plat_dev);
wl1271_debugfs_exit(wl);
@@ -5122,8 +5051,35 @@ static int __devinit wl12xx_probe(struct platform_device *pdev)
if (ret)
goto out_irq;
+ /* Create sysfs file to control bt coex state */
+ ret = device_create_file(wl->dev, &dev_attr_bt_coex_state);
+ if (ret < 0) {
+ wl1271_error("failed to create sysfs file bt_coex_state");
+ goto out_irq;
+ }
+
+ /* Create sysfs file to get HW PG version */
+ ret = device_create_file(wl->dev, &dev_attr_hw_pg_ver);
+ if (ret < 0) {
+ wl1271_error("failed to create sysfs file hw_pg_ver");
+ goto out_bt_coex_state;
+ }
+
+ /* Create sysfs file for the FW log */
+ ret = device_create_bin_file(wl->dev, &fwlog_attr);
+ if (ret < 0) {
+ wl1271_error("failed to create sysfs file fwlog");
+ goto out_hw_pg_ver;
+ }
+
return 0;
+out_hw_pg_ver:
+ device_remove_file(wl->dev, &dev_attr_hw_pg_ver);
+
+out_bt_coex_state:
+ device_remove_file(wl->dev, &dev_attr_bt_coex_state);
+
out_irq:
free_irq(wl->irq, wl);
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h
index 091fdd2..bd58f50 100644
--- a/drivers/net/wireless/wl12xx/wl12xx.h
+++ b/drivers/net/wireless/wl12xx/wl12xx.h
@@ -350,7 +350,6 @@ struct wl1271_link {
};
struct wl1271 {
- struct platform_device *plat_dev;
struct ieee80211_hw *hw;
bool mac80211_registered;
--
1.7.1
^ permalink raw reply related
* Re: Compat-wireless release for 2011-10-06 is baked
From: Luis R. Rodriguez @ 2011-10-06 19:28 UTC (permalink / raw)
To: linux-wireless
In-Reply-To: <20111006190442.53FBF40650@repository3.orbit-lab.org>
On Thu, Oct 6, 2011 at 12:04 PM, Compat-wireless cronjob account
<compat@orbit-lab.org> wrote:
> From git://github.com/mcgrof/compat-wireless
> 2309ddb..e4f1a17 master -> origin/master
> From git://github.com/mcgrof/compat
> 966e847..b5edac3 master -> origin/master
> From git://github.com/sfrothwell/linux-next
> + a2851f2...98b3e8f akpm-end -> origin/akpm-end (forced update)
> a8062e4..538d288 akpm-start -> origin/akpm-start
> + 09d70e2...40a33ae master -> origin/master (forced update)
> a8062e4..538d288 stable -> origin/stable
> * [new tag] next-20111006 -> next-20111006
> From git://github.com/sfrothwell/linux-next
> * [new tag] v3.1-rc9 -> v3.1-rc9
>
> compat-wireless code metrics
>
> 811845 - Total upstream lines of code being pulled
> 2413 - backport code changes
> 2097 - backport code additions
> 316 - backport code deletions
> 8588 - backport from compat module
> 11001 - total backport code
> 1.3551 - % of code consists of backport work
> Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
> rsync: connection unexpectedly closed (0 bytes received so far) [sender]
> rsync error: unexplained error (code 255) at io.c(601) [sender=3.0.7]
Fixed.
Luis
^ permalink raw reply
* Re: Alfa AWUS036NHR with RTL8188RU chipset
From: Toddy @ 2011-10-06 16:25 UTC (permalink / raw)
To: linux-wireless
In-Reply-To: <loom.20110930T195810-426@post.gmane.org>
Hello,
I also have the AWUS036NHR device and I got it working on Ubuntu 11.04
2.6.38-11-generic x64. The only thing I did is to compile&install
compat-wireless-2.6.39-1 (same as beini!) which can be found here:
http://www.orbit-lab.org/kernel/compat-wireless-2.6-stable/v2.6.39/
There was only one strange thing: In drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
there is no entry for the AWUS036NHR so that no driver is loaded when I plugged
the USB in, but in older versions of compat-wireless (e.g. 2.6.38) there IS one
entry for this device. The entry looks like this:
/* 8188RU in Alfa AWUS036NHR */
{RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817f, rtl92cu_hal_cfg)}
So I patched the file, compiled&installed it and everything worked! Could
someone patch the sources and add this device? Thanks!
Toddy
^ permalink raw reply
* [PATCH] compat-wireless: add struct padding to fix wext issue
From: Johannes Berg @ 2011-10-06 20:05 UTC (permalink / raw)
To: Luis R. Rodriguez; +Cc: Hauke Mehrtens, linux-wireless
From: Johannes Berg <johannes.berg@intel.com>
See description in the patch :-)
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
patches/09-cfg80211-wext-padding.patch | 62 ++++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
create mode 100644 patches/09-cfg80211-wext-padding.patch
diff --git a/patches/09-cfg80211-wext-padding.patch b/patches/09-cfg80211-wext-padding.patch
new file mode 100644
index 0000000..36b4e70
--- /dev/null
+++ b/patches/09-cfg80211-wext-padding.patch
@@ -0,0 +1,62 @@
+This is a tricky one.
+
+Consider a kernel that has this code in net/wireless/wext-core.c:
+
+#ifdef CONFIG_CFG80211_WEXT
+ if (dev->ieee80211_ptr && dev->ieee80211_ptr->wiphy)
+ handlers = dev->ieee80211_ptr->wiphy->wext;
+#endif
+#ifdef CONFIG_WIRELESS_EXT
+ if (dev->wireless_handlers)
+ handlers = dev->wireless_handlers;
+#endif
+
+If a kernel is compiled without CONFIG_WIRELESS_EXT then
+compat-wireless can't do wireless extensions against it.
+However, if the kernel is compiled with CONFIG_CFG80211_WEXT
+then it will try to get the wext handlers from struct wiphy.
+
+Now, struct wiphy in the base kernel and struct wiphy in
+compat-wireless don't match, so the kernel crashes!!
+
+To fix this, add lots of padding to compat-wireless's
+struct wiphy so that the "wext" pointer is guaranteed
+to be NULL.
+
+Make sure the padding is larger than the struct so we
+don't ever run into this again because the wext pointer
+moved due to struct enlargements.
+
+
+--- a/include/net/cfg80211.h 2011-10-04 10:49:07.000000000 +0200
++++ b/include/net/cfg80211.h 2011-10-06 21:50:47.000000000 +0200
+@@ -1904,6 +1904,9 @@ struct wiphy_wowlan_support {
+ struct wiphy {
+ /* assign these fields before you register the wiphy */
+
++#define WIPHY_COMPAT_PAD_SIZE 2048
++ u8 padding[WIPHY_COMPAT_PAD_SIZE];
++
+ /* permanent MAC address(es) */
+ u8 perm_addr[ETH_ALEN];
+ u8 addr_mask[ETH_ALEN];
+--- a/net/wireless/core.c 2011-09-23 10:34:28.000000000 +0200
++++ b/net/wireless/core.c 2011-10-06 21:52:02.000000000 +0200
+@@ -330,6 +330,17 @@ struct wiphy *wiphy_new(const struct cfg
+ struct cfg80211_registered_device *rdev;
+ int alloc_size;
+
++ /*
++ * Make sure the padding is >= the rest of the struct so that we
++ * always keep it large enough to pad out the entire original
++ * kernel's struct. We really only need to make sure it's larger
++ * than the kernel compat is compiled against, but since it'll
++ * only increase in size make sure it's larger than the current
++ * version of it. Subtract since it's included.
++ */
++ BUILD_BUG_ON(WIPHY_COMPAT_PAD_SIZE <
++ sizeof(struct wiphy) - WIPHY_COMPAT_PAD_SIZE);
++
+ WARN_ON(ops->add_key && (!ops->del_key || !ops->set_default_key));
+ WARN_ON(ops->auth && (!ops->assoc || !ops->deauth || !ops->disassoc));
+ WARN_ON(ops->connect && !ops->disconnect);
--
1.7.6.3
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox