Skip to contentSkip to conversation

p54: Fix compilation for d80211 hwmode API change

PATCH In review Michael Buesch 2 participants 3 messages Dec 15, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 p54: Fix compilation for d80211 hwmode API change

This fixes compilation for the d80211 hwmode API change.

drivers/net/wireless/d80211/p54/prism54.h +1 -1
Index: jbenc-dscape/drivers/net/wireless/d80211/p54/prism54.h
===================================================================
@@ -64,7 +64,7 @@ struct p54_common {
 	/* FIXME: this channels/modes/rates stuff sucks */
 	struct ieee80211_channel channels[14];
 	struct ieee80211_rate rates[12];
-	struct ieee80211_hw_modes modes[2];
+	struct ieee80211_hw_mode modes[2];
 };
 
 int p54_rx(struct ieee80211_hw *dev, struct sk_buff *skb);
drivers/net/wireless/d80211/p54/prism54common.c +0 -3
Index: jbenc-dscape/drivers/net/wireless/d80211/p54/prism54common.c
===================================================================
@@ -742,9 +742,6 @@ struct ieee80211_hw *p54_init_common(siz
 	dev->channel_change_time = 1000;	/* TODO: find actual value */
 	dev->maxssi = 100; // just to avoid dividing by zero
 
-	dev->num_modes = 2;
-	dev->modes = priv->modes;
-
 	dev->queues = 1;
 	dev->extra_tx_headroom = sizeof(struct p54_control_hdr) + 4 +
 				 sizeof(struct p54_tx_control_allocdata);
drivers/net/wireless/d80211/p54/prism54pci.c +12 -1
Index: jbenc-dscape/drivers/net/wireless/d80211/p54/prism54pci.c
===================================================================
@@ -505,7 +505,7 @@ static int __devinit p54p_probe(struct p
 	struct p54p_priv *priv;
 	struct ieee80211_hw *dev;
 	unsigned long mem_addr, mem_len;
-	int err;
+	int i, err;
 
 	err = pci_enable_device(pdev);
 	if (err) {
@@ -596,12 +596,23 @@ static int __devinit p54p_probe(struct p
 		       pci_name(pdev));
 		goto err_free_desc;
 	}
+	for (i = 0; i < 2; i++) {
+		err = ieee80211_register_hwmode(dev, &priv->common.modes[i]);
+		if (err) {
+			printk(KERN_ERR "%s (prism54pci): Cannot register hwmode\n",
+				pci_name(pdev));
+			goto err_unreg_hw;
+		}
+	}
 
 	printk(KERN_INFO "wiphy%d: hwaddr " MAC_FMT ", isl38%02x\n",
 	       dev->index, MAC_ARG(dev->perm_addr), priv->common.version);
 
 	return 0;
 
+ err_unreg_hw:
+	ieee80211_unregister_hw(dev);
+
  err_free_desc:
 	p54_free_common(dev);
 	pci_free_consistent(pdev, sizeof(*priv->ring_control),
drivers/net/wireless/d80211/p54/prism54usb.c +10 -0
Index: jbenc-dscape/drivers/net/wireless/d80211/p54/prism54usb.c
===================================================================
@@ -893,12 +893,22 @@ static int __devinit p54u_probe(struct u
 		printk(KERN_ERR "prism54usb: Cannot register netdevice\n");
 		goto err_free_dev;
 	}
+	for (i = 0; i < 2; i++) {
+		err = ieee80211_register_hwmode(dev, &priv->common.modes[i]);
+		if (err) {
+			printk(KERN_ERR "prism54usb: Cannot register hwmode\n");
+			goto err_unreg_hw;
+		}
+	}
 
 	printk(KERN_INFO "wiphy%d: hwaddr " MAC_FMT ", isl38%02x\n",
 	       dev->index, MAC_ARG(dev->perm_addr), priv->common.version);
 
 	return 0;
 
+ err_unreg_hw:
+	ieee80211_unregister_hw(dev);
+
  err_free_dev:
 	ieee80211_free_hw(dev);
 	usb_set_intfdata(intf, NULL);
Signature · 1 line
Greetings Michael.
#1 lore raw
Quoted 4 lines · Michael Buesch

This fixes compilation for the d80211 hwmode API change.

We can't specify modes before device registration now? There would be less duplicated code here if we could.

-Michael Wu

#2 lore raw
Quoted 7 lines · Michael Wu
Quoted 4 lines · Michael Buesch

This fixes compilation for the d80211 hwmode API change.

We can't specify modes before device registration now? There would be less duplicated code here if we could.

Well, actually, rt2x00 driver called update_hw before register_hw (which is not required, but it did it). So I think we can also call register_hwmode before register_hw now, as register_hwmode basically does nothing more than update_hw.

So, I think it should also work, if you call register_hwmode before register_hw. Jiri?

Signature · 1 line
Greetings Michael.