diff mbox

[RFC,05/15] nl80211: call periodic_start and periodic_stop

Message ID 1288612336-2830-6-git-send-email-luciano.coelho@nokia.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Luciano Coelho Nov. 1, 2010, 11:52 a.m. UTC
None
diff mbox

Patch

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 0884464..fd50186 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3014,6 +3014,11 @@  static int nl80211_start_periodic(struct sk_buff *skb,
 	if (err)
 		goto out_rtnl;
 
+	if (!rdev->ops->periodic_start) {
+		err = -EOPNOTSUPP;
+		goto out;
+	}
+
 	if (!netif_running(dev)) {
 		err = -ENETDOWN;
 		goto out;
@@ -3035,14 +3040,15 @@  static int nl80211_start_periodic(struct sk_buff *skb,
 
 	rdev->periodic_req = request;
 
-	/* add actual calls here */
-
-	if (!err) {
-		nl80211_send_periodic(rdev, dev,
-				      NL80211_CMD_START_PERIODIC_SCAN);
-		dev_hold(dev);
+	err = rdev->ops->periodic_start(&rdev->wiphy, dev, request);
+	if (err) {
+		kfree(request);
+		rdev->periodic_req = NULL;
+		goto out;
 	}
 
+	nl80211_send_periodic(rdev, dev,
+			      NL80211_CMD_START_PERIODIC_SCAN);
 out:
 	cfg80211_unlock_rdev(rdev);
 	dev_put(dev);
@@ -3067,20 +3073,24 @@  static int nl80211_stop_periodic(struct sk_buff *skb,
 	if (err)
 		goto out_rtnl;
 
+	if (!rdev->ops->periodic_stop) {
+		err = -EOPNOTSUPP;
+		goto out;
+	}
+
 	if (!netif_running(dev)) {
 		err = -ENETDOWN;
 		goto out;
 	}
 
 	if (rdev->periodic_req) {
-		/* add actual calls here */
+		err = rdev->ops->periodic_stop(&rdev->wiphy, dev,
+					       rdev->periodic_req);
 	}
 
-	if (!err) {
+	if (!err)
 		nl80211_send_periodic(rdev, dev,
 				      NL80211_CMD_STOP_PERIODIC_SCAN);
-		dev_hold(dev);
-	}
 
 	/*
 	 * FIXME: Can this stay here? How will the auto-complete and other