Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 122492
b: refs/heads/master
c: 02e37ba
h: refs/heads/master
v: v3
  • Loading branch information
Christian Lamparter authored and John W. Linville committed Dec 5, 2008
1 parent 24bcfd8 commit 8a7dfb5
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 48 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b2023ddcfa6b79f26ef459867324f3d32b91aa07
refs/heads/master: 02e37ba1298359baa123cf71ffa03d92abd259b2
59 changes: 30 additions & 29 deletions trunk/drivers/net/wireless/p54/p54common.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,21 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw)
priv->fw_interface = be32_to_cpup((__be32 *)
bootrec->data);
switch (priv->fw_interface) {
case FW_FMAC:
printk(KERN_INFO "p54: FreeMAC firmware\n");
break;
case FW_LM20:
printk(KERN_INFO "p54: LM20 firmware\n");
break;
case FW_LM86:
printk(KERN_INFO "p54: LM86 firmware\n");
break;
case FW_LM87:
printk(KERN_INFO "p54: LM87 firmware\n");
case FW_LM20:
case FW_LM87: {
char *iftype = (char *)bootrec->data;
printk(KERN_INFO "%s: p54 detected a LM%c%c "
"firmware\n",
wiphy_name(dev->wiphy),
iftype[2], iftype[3]);
break;
}
case FW_FMAC:
default:
printk(KERN_INFO "p54: unknown firmware\n");
break;
printk(KERN_ERR "%s: unsupported firmware\n",
wiphy_name(dev->wiphy));
return -ENODEV;
}
break;
case BR_CODE_COMPONENT_VERSION:
Expand Down Expand Up @@ -216,13 +216,15 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw)
}

if (fw_version)
printk(KERN_INFO "p54: FW rev %s - Softmac protocol %x.%x\n",
fw_version, priv->fw_var >> 8, priv->fw_var & 0xff);
printk(KERN_INFO "%s: FW rev %s - Softmac protocol %x.%x\n",
wiphy_name(dev->wiphy), fw_version,
priv->fw_var >> 8, priv->fw_var & 0xff);

if (priv->fw_var < 0x500)
printk(KERN_INFO "p54: you are using an obsolete firmware. "
printk(KERN_INFO "%s: you are using an obsolete firmware. "
"visit http://wireless.kernel.org/en/users/Drivers/p54 "
"and grab one for \"kernel >= 2.6.28\"!\n");
"and grab one for \"kernel >= 2.6.28\"!\n",
wiphy_name(dev->wiphy));

if (priv->fw_var >= 0x300) {
/* Firmware supports QoS, use it! */
Expand Down Expand Up @@ -399,8 +401,9 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
err = p54_convert_rev1(dev, curve_data);
break;
default:
printk(KERN_ERR "p54: unknown curve data "
printk(KERN_ERR "%s: unknown curve data "
"revision %d\n",
wiphy_name(dev->wiphy),
curve_data->cal_method_rev);
err = -ENODEV;
break;
Expand Down Expand Up @@ -460,7 +463,8 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
case PDR_PER_CHANNEL_BASEBAND_REGISTERS:
break;
default:
printk(KERN_INFO "p54: unknown eeprom code : 0x%x\n",
printk(KERN_INFO "%s: unknown eeprom code : 0x%x\n",
wiphy_name(dev->wiphy),
le16_to_cpu(entry->code));
break;
}
Expand All @@ -470,7 +474,8 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)

if (!synth || !priv->iq_autocal || !priv->output_limit ||
!priv->curve_data) {
printk(KERN_ERR "p54: not all required entries found in eeprom!\n");
printk(KERN_ERR "%s: not all required entries found in eeprom!\n",
wiphy_name(dev->wiphy));
err = -EINVAL;
goto err;
}
Expand Down Expand Up @@ -515,7 +520,8 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
priv->curve_data = NULL;
}

printk(KERN_ERR "p54: eeprom parse failed!\n");
printk(KERN_ERR "%s: eeprom parse failed!\n",
wiphy_name(dev->wiphy));
return err;
}

Expand Down Expand Up @@ -1573,28 +1579,23 @@ static int p54_beacon_tim(struct sk_buff *skb)
struct ieee80211_mgmt *mgmt = (void *)skb->data;
u8 *pos, *end;

if (skb->len <= sizeof(mgmt)) {
printk(KERN_ERR "p54: beacon is too short!\n");
if (skb->len <= sizeof(mgmt))
return -EINVAL;
}

pos = (u8 *)mgmt->u.beacon.variable;
end = skb->data + skb->len;
while (pos < end) {
if (pos + 2 + pos[1] > end) {
printk(KERN_ERR "p54: parsing beacon failed\n");
if (pos + 2 + pos[1] > end)
return -EINVAL;
}

if (pos[0] == WLAN_EID_TIM) {
u8 dtim_len = pos[1];
u8 dtim_period = pos[3];
u8 *next = pos + 2 + dtim_len;

if (dtim_len < 3) {
printk(KERN_ERR "p54: invalid dtim len!\n");
if (dtim_len < 3)
return -EINVAL;
}

memmove(pos, next, end - next);

if (dtim_len > 3)
Expand Down
43 changes: 25 additions & 18 deletions trunk/drivers/net/wireless/p54/p54usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,21 +405,23 @@ static int p54u_upload_firmware_3887(struct ieee80211_hw *dev)

tmp = buf = kmalloc(P54U_FW_BLOCK, GFP_KERNEL);
if (!buf) {
printk(KERN_ERR "p54usb: cannot allocate firmware upload buffer!\n");
dev_err(&priv->udev->dev, "(p54usb) cannot allocate firmware"
"upload buffer!\n");
err = -ENOMEM;
goto err_bufalloc;
}

memcpy(buf, start_string, 4);
err = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, 4);
if (err) {
printk(KERN_ERR "p54usb: reset failed! (%d)\n", err);
dev_err(&priv->udev->dev, "(p54usb) reset failed! (%d)\n", err);
goto err_reset;
}

err = request_firmware(&fw_entry, "isl3887usb", &priv->udev->dev);
if (err) {
printk(KERN_ERR "p54usb: cannot find firmware (isl3887usb)\n");
dev_err(&priv->udev->dev, "p54usb: cannot find firmware "
"(isl3887usb)\n");
err = request_firmware(&fw_entry, "isl3887usb_bare",
&priv->udev->dev);
if (err)
Expand Down Expand Up @@ -474,7 +476,8 @@ static int p54u_upload_firmware_3887(struct ieee80211_hw *dev)

err = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, block_size);
if (err) {
printk(KERN_ERR "p54usb: firmware upload failed!\n");
dev_err(&priv->udev->dev, "(p54usb) firmware "
"upload failed!\n");
goto err_upload_failed;
}

Expand All @@ -485,36 +488,37 @@ static int p54u_upload_firmware_3887(struct ieee80211_hw *dev)
*((__le32 *)buf) = cpu_to_le32(~crc32_le(~0, fw_entry->data, fw_entry->size));
err = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, sizeof(u32));
if (err) {
printk(KERN_ERR "p54usb: firmware upload failed!\n");
dev_err(&priv->udev->dev, "(p54usb) firmware upload failed!\n");
goto err_upload_failed;
}

timeout = jiffies + msecs_to_jiffies(1000);
while (!(err = usb_bulk_msg(priv->udev,
usb_rcvbulkpipe(priv->udev, P54U_PIPE_DATA), buf, 128, &alen, 1000))) {
if (alen > 2 && !memcmp(buf, "OK", 2))
break;

if (alen > 5 && !memcmp(buf, "ERROR", 5)) {
printk(KERN_INFO "p54usb: firmware upload failed!\n");
err = -EINVAL;
break;
}

if (time_after(jiffies, timeout)) {
printk(KERN_ERR "p54usb: firmware boot timed out!\n");
dev_err(&priv->udev->dev, "(p54usb) firmware boot "
"timed out!\n");
err = -ETIMEDOUT;
break;
}
}
if (err)
if (err) {
dev_err(&priv->udev->dev, "(p54usb) firmware upload failed!\n");
goto err_upload_failed;
}

buf[0] = 'g';
buf[1] = '\r';
err = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, 2);
if (err) {
printk(KERN_ERR "p54usb: firmware boot failed!\n");
dev_err(&priv->udev->dev, "(p54usb) firmware boot failed!\n");
goto err_upload_failed;
}

Expand Down Expand Up @@ -554,13 +558,15 @@ static int p54u_upload_firmware_net2280(struct ieee80211_hw *dev)

buf = kmalloc(512, GFP_KERNEL);
if (!buf) {
printk(KERN_ERR "p54usb: firmware buffer alloc failed!\n");
dev_err(&priv->udev->dev, "(p54usb) firmware buffer "
"alloc failed!\n");
return -ENOMEM;
}

err = request_firmware(&fw_entry, "isl3886usb", &priv->udev->dev);
if (err) {
printk(KERN_ERR "p54usb: cannot find firmware (isl3886usb)\n");
dev_err(&priv->udev->dev, "(p54usb) cannot find firmware "
"(isl3886usb)\n");
err = request_firmware(&fw_entry, "isl3890usb",
&priv->udev->dev);
if (err) {
Expand Down Expand Up @@ -685,8 +691,8 @@ static int p54u_upload_firmware_net2280(struct ieee80211_hw *dev)

err = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, block_len);
if (err) {
printk(KERN_ERR "p54usb: firmware block upload "
"failed\n");
dev_err(&priv->udev->dev, "(p54usb) firmware block "
"upload failed\n");
goto fail;
}

Expand Down Expand Up @@ -719,8 +725,8 @@ static int p54u_upload_firmware_net2280(struct ieee80211_hw *dev)
0x002C | (unsigned long)&devreg->direct_mem_win);
if (!(reg & cpu_to_le32(ISL38XX_DMA_STATUS_DONE)) ||
!(reg & cpu_to_le32(ISL38XX_DMA_STATUS_READY))) {
printk(KERN_ERR "p54usb: firmware DMA transfer "
"failed\n");
dev_err(&priv->udev->dev, "(p54usb) firmware DMA "
"transfer failed\n");
goto fail;
}

Expand Down Expand Up @@ -825,8 +831,9 @@ static int __devinit p54u_probe(struct usb_interface *intf,
unsigned int i, recognized_pipes;

dev = p54_init_common(sizeof(*priv));

if (!dev) {
printk(KERN_ERR "p54usb: ieee80211 alloc failed\n");
dev_err(&udev->dev, "(p54usb) ieee80211 alloc failed\n");
return -ENOMEM;
}

Expand Down Expand Up @@ -887,7 +894,7 @@ static int __devinit p54u_probe(struct usb_interface *intf,

err = ieee80211_register_hw(dev);
if (err) {
printk(KERN_ERR "p54usb: Cannot register netdevice\n");
dev_err(&udev->dev, "(p54usb) Cannot register netdevice\n");
goto err_free_dev;
}

Expand Down

0 comments on commit 8a7dfb5

Please sign in to comment.