* [PATCH] staging/wlan-ng: block ioctls until card fully initialised
@ 2009-02-17 12:19 ` Richard Kennedy
2009-02-18 2:21 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Richard Kennedy @ 2009-02-17 12:19 UTC (permalink / raw)
To: Karl Relton, greg; +Cc: lkml, wlan-devel
Add a mutex to block ioctls before the card is fully initialised and
only allow one ioctl at a time.
This stops udev trying to load the firmware before to card is fully up.
patch ported from wlan-ng-devel
Karl Relton <karllinuxtest.relton@ntlworld.com> spotted that this was
missing from the staging version,
http://lists.linux-wlan.com/pipermail/linux-wlan-devel/2009-February/003890.html
Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
---
This has only had basic testing, & I haven't tried loading the firmware
yet.
regards
Richard
diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
index 59e5ad1..f6cc298 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -623,6 +623,7 @@ static int p80211knetdev_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd)
WLAN_LOG_DEBUG(2, "rx'd ioctl, cmd=%d, len=%d\n", cmd, req->len);
+ mutex_lock(&wlandev->ioctl_lock);
#ifdef SIOCETHTOOL
if (cmd == SIOCETHTOOL) {
result = p80211netdev_ethtool(wlandev, (void __user *) ifr->ifr_data);
@@ -662,6 +663,7 @@ static int p80211knetdev_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd)
result = -ENOMEM;
}
bail:
+ mutex_unlock(&wlandev->ioctl_lock);
DBFEXIT;
return result; /* If allocate,copyfrom or copyto fails, return errno */
@@ -823,6 +825,13 @@ int wlan_setup(wlandevice_t *wlandev)
dev->ml_priv = wlandev;
dev->hard_start_xmit = p80211knetdev_hard_start_xmit;
dev->get_stats = p80211knetdev_get_stats;
+
+ mutex_init(&wlandev->ioctl_lock);
+ /* block ioctls until fully initialised. Don't forget to call
+ allow_ioctls at some point!*/
+ mutex_lock(&wlandev->ioctl_lock);
+
+
#ifdef HAVE_PRIVATE_IOCTL
dev->do_ioctl = p80211knetdev_do_ioctl;
#endif
@@ -1207,3 +1216,8 @@ static void p80211knetdev_tx_timeout( netdevice_t *netdev)
DBFEXIT;
}
+
+
+void p80211_allow_ioctls(wlandevice_t *wlandev) {
+ mutex_unlock(&wlandev->ioctl_lock);
+}
diff --git a/drivers/staging/wlan-ng/p80211netdev.h b/drivers/staging/wlan-ng/p80211netdev.h
index 940146f..da49552 100644
--- a/drivers/staging/wlan-ng/p80211netdev.h
+++ b/drivers/staging/wlan-ng/p80211netdev.h
@@ -235,6 +235,8 @@ typedef struct wlandevice
u8 spy_number;
char spy_address[IW_MAX_SPY][ETH_ALEN];
struct iw_quality spy_stat[IW_MAX_SPY];
+
+ struct mutex ioctl_lock;
} wlandevice_t;
/* WEP stuff */
@@ -251,4 +253,7 @@ int unregister_wlandev(wlandevice_t *wlandev);
void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb);
void p80211netdev_hwremoved(wlandevice_t *wlandev);
+void p80211_allow_ioctls(wlandevice_t *wlandev);
+
+
#endif
diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c
index 8f7b1f2..78c7504 100644
--- a/drivers/staging/wlan-ng/prism2usb.c
+++ b/drivers/staging/wlan-ng/prism2usb.c
@@ -149,7 +149,7 @@ static int prism2sta_probe_usb(
done:
DBFEXIT;
-
+ p80211_allow_ioctls(wlandev);
usb_set_intfdata(interface, wlandev);
return result;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] staging/wlan-ng: block ioctls until card fully initialised
2009-02-17 12:19 ` [PATCH] staging/wlan-ng: block ioctls until card fully initialised Richard Kennedy
@ 2009-02-18 2:21 ` Greg KH
2009-02-18 18:14 ` Richard Kennedy
2009-02-20 12:09 ` [PATCH] linux-next/staging/wlan-ng: " Richard Kennedy
0 siblings, 2 replies; 4+ messages in thread
From: Greg KH @ 2009-02-18 2:21 UTC (permalink / raw)
To: Richard Kennedy, Karl Relton; +Cc: lkml, wlan-devel
On Tue, Feb 17, 2009 at 12:19:18PM +0000, Richard Kennedy wrote:
> Add a mutex to block ioctls before the card is fully initialised and
> only allow one ioctl at a time.
> This stops udev trying to load the firmware before to card is fully up.
>
> patch ported from wlan-ng-devel
>
> Karl Relton <karllinuxtest.relton@ntlworld.com> spotted that this was
> missing from the staging version,
> http://lists.linux-wlan.com/pipermail/linux-wlan-devel/2009-February/003890.html
Karl sent me a patch a few days before you that also added this
functionality.
Unfortunatly, both of your patches don't apply to the latest version of
the wlan-ng driver as it has had a lot of work done on it recently.
Could one of you grab the linux-next tree and make a patch up against
the version in it so that I can apply this?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging/wlan-ng: block ioctls until card fully initialised
2009-02-18 2:21 ` Greg KH
@ 2009-02-18 18:14 ` Richard Kennedy
2009-02-20 12:09 ` [PATCH] linux-next/staging/wlan-ng: " Richard Kennedy
1 sibling, 0 replies; 4+ messages in thread
From: Richard Kennedy @ 2009-02-18 18:14 UTC (permalink / raw)
To: Greg KH; +Cc: Karl Relton, lkml, wlan-devel
On Tue, 2009-02-17 at 18:21 -0800, Greg KH wrote:
> On Tue, Feb 17, 2009 at 12:19:18PM +0000, Richard Kennedy wrote:
> > Add a mutex to block ioctls before the card is fully initialised and
> > only allow one ioctl at a time.
> > This stops udev trying to load the firmware before to card is fully up.
> >
> > patch ported from wlan-ng-devel
> >
> > Karl Relton <karllinuxtest.relton@ntlworld.com> spotted that this was
> > missing from the staging version,
> > http://lists.linux-wlan.com/pipermail/linux-wlan-devel/2009-February/003890.html
>
> Karl sent me a patch a few days before you that also added this
> functionality.
>
> Unfortunatly, both of your patches don't apply to the latest version of
> the wlan-ng driver as it has had a lot of work done on it recently.
>
> Could one of you grab the linux-next tree and make a patch up against
> the version in it so that I can apply this?
>
> thanks,
>
> greg k-h
Sorry about that, I'd forgotten that wlan-ng was included in linux-next.
I've updated the patch and am just testing it & will post it shortly.
BTW thanks to Moritz Muehlenhoff for the clean-ups.
regards
Richard
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] linux-next/staging/wlan-ng: block ioctls until card fully initialised
2009-02-18 2:21 ` Greg KH
2009-02-18 18:14 ` Richard Kennedy
@ 2009-02-20 12:09 ` Richard Kennedy
1 sibling, 0 replies; 4+ messages in thread
From: Richard Kennedy @ 2009-02-20 12:09 UTC (permalink / raw)
To: Greg KH; +Cc: Karl Relton, lkml, wlan-devel
Add a mutex to block ioctls before the card is fully initialised and
only allow one ioctl at a time.
This stops udev trying to load the firmware before to card is fully up.
patch ported from wlan-ng-devel
Karl Relton <karllinuxtest.relton@ntlworld.com> spotted that this was
missing from the staging version,
http://lists.linux-wlan.com/pipermail/linux-wlan-devel/2009-February/003890.html
Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
---
Hi Greg,
patch against linux-next-20090219.
booted & working on my laptop.
sorry about the delay, it's taken me a while to get linux-next running
on my laptop.
regards
Richard
diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
index 50fa8d6..b2a606a 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -567,6 +567,8 @@ static int p80211knetdev_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd)
pr_debug("rx'd ioctl, cmd=%d, len=%d\n", cmd, req->len);
+ mutex_lock(&wlandev->ioctl_lock);
+
#ifdef SIOCETHTOOL
if (cmd == SIOCETHTOOL) {
result =
@@ -607,6 +609,8 @@ static int p80211knetdev_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd)
result = -ENOMEM;
}
bail:
+ mutex_unlock(&wlandev->ioctl_lock);
+
return result; /* If allocate,copyfrom or copyto fails, return errno */
}
@@ -758,6 +762,11 @@ int wlan_setup(wlandevice_t *wlandev)
dev->open = p80211knetdev_open;
dev->stop = p80211knetdev_stop;
+ mutex_init(&wlandev->ioctl_lock);
+ /* block ioctls until fully initialised. Don't forget to call
+ allow_ioctls at some point!*/
+ mutex_lock(&wlandev->ioctl_lock);
+
#if (WIRELESS_EXT < 21)
dev->get_wireless_stats = p80211wext_get_wireless_stats;
#endif
@@ -1098,3 +1107,8 @@ static void p80211knetdev_tx_timeout(netdevice_t *netdev)
netif_wake_queue(wlandev->netdev);
}
}
+
+void p80211_allow_ioctls(wlandevice_t *wlandev)
+{
+ mutex_unlock(&wlandev->ioctl_lock);
+}
diff --git a/drivers/staging/wlan-ng/p80211netdev.h b/drivers/staging/wlan-ng/p80211netdev.h
index 42e3b92..b96090d 100644
--- a/drivers/staging/wlan-ng/p80211netdev.h
+++ b/drivers/staging/wlan-ng/p80211netdev.h
@@ -227,6 +227,8 @@ typedef struct wlandevice {
u8 spy_number;
char spy_address[IW_MAX_SPY][ETH_ALEN];
struct iw_quality spy_stat[IW_MAX_SPY];
+
+ struct mutex ioctl_lock;
} wlandevice_t;
/* WEP stuff */
@@ -242,5 +244,5 @@ int register_wlandev(wlandevice_t *wlandev);
int unregister_wlandev(wlandevice_t *wlandev);
void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb);
void p80211netdev_hwremoved(wlandevice_t *wlandev);
-
+void p80211_allow_ioctls(wlandevice_t *wlandev);
#endif
diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c
index 252312e..d8a1298 100644
--- a/drivers/staging/wlan-ng/prism2usb.c
+++ b/drivers/staging/wlan-ng/prism2usb.c
@@ -170,6 +170,7 @@ failed:
wlandev = NULL;
done:
+ p80211_allow_ioctls(wlandev);
usb_set_intfdata(interface, wlandev);
return result;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-02-20 12:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1234213202.6875.70.camel@dellpc>
[not found] ` <20090209211700.GA10742@kroah.com>
[not found] ` <1234478293.17792.1.camel@dellpc>
2009-02-17 12:19 ` [PATCH] staging/wlan-ng: block ioctls until card fully initialised Richard Kennedy
2009-02-18 2:21 ` Greg KH
2009-02-18 18:14 ` Richard Kennedy
2009-02-20 12:09 ` [PATCH] linux-next/staging/wlan-ng: " Richard Kennedy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).