[Prism54-devel] Suggested Prism54 changes/cleanup
Margit Schubert-While
margitsw@t-online.de
Sat, 21 Feb 2004 18:05:27 +0100
--=====================_27081741==_.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed
Suggested code changes/cleanup.
(Luis, sent to you as attachment)
Fix compile warning
Correct multi-line printk's
Move prism54_get_card_model and clean ip.
diff -Naur prism54-cvs-latest/ksrc/isl_ioctl.c prism54-msw/ksrc/isl_ioctl.c
--- prism54-cvs-latest/ksrc/isl_ioctl.c 2004-02-20 05:20:48.000000000 +0100
+++ prism54-msw/ksrc/isl_ioctl.c 2004-02-21 17:35:32.000000000 +0100
@@ -93,8 +93,8 @@
/* For now, just catch early the Repeater and Secondary modes here */
if (iw_mode == IW_MODE_REPEAT || iw_mode == IW_MODE_SECOND) {
- printk(KERN_DEBUG "%s(): Sorry, Repeater mode and Secondary
mode \
- are not yet supported by this driver.\n",
+ printk(KERN_DEBUG "%s(): Sorry, Repeater mode and Secondary
mode "
+ "are not yet supported by this driver.\n",
__FUNCTION__);
return -EINVAL;
}
@@ -171,8 +171,8 @@
* mib values depending on what the wireless mode given is. No need
* for it save old values */
if (init_mode > IW_MODE_MONITOR || init_mode < IW_MODE_AUTO) {
- printk(KERN_DEBUG "%s(): You passed a non-valid init_mode. \
- Using default mode\n", __FUNCTION__);
+ printk(KERN_DEBUG "%s(): You passed a non-valid init_mode. "
+ "Using default mode\n", __FUNCTION__);
init_mode = CARD_DEFAULT_IW_MODE;
}
/* This sets all of the mode-dependent values */
diff -Naur prism54-cvs-latest/ksrc/islpci_dev.c prism54-msw/ksrc/islpci_dev.c
--- prism54-cvs-latest/ksrc/islpci_dev.c 2004-02-16
22:01:35.000000000 +0100
+++ prism54-msw/ksrc/islpci_dev.c 2004-02-21 17:19:55.000000000 +0100
@@ -781,56 +781,3 @@
priv = 0;
return NULL;
}
-
-inline int
-prism54_get_card_model(struct net_device *ndev, char **modelp)
-{
- islpci_private *priv;
- priv = ndev->priv;
- switch (priv->pdev->subsystem_device) {
- case PCIDEVICE_ISL3877:
- *modelp = "PRISM Indigo";
- break;
- case PCIDEVICE_3COM6001:
- *modelp = "3COM 3CRWE154G72";
- break;
- case 0x3202UL:
- *modelp = "D-Link DWL-g650 A1";
- break;
- case 0xd019UL:
- *modelp = "WN-G54/CB";
- break;
- case 0x4800UL:
- *modelp = "Netgear WG511";
- break;
- case 0x2802UL:
- *modelp = "SMC2802W";
- break;
- case 0xee03UL:
- *modelp = "SMC2802W V2";
- break;
- case 0x2835UL:
- *modelp = "SMC2835W";
- break;
- /* Let's leave this one out for now since it seems bogus/wrong
- * Even if the manufacturer did use 0x0000UL it may not be
correct
- * by their part, therefore deserving no name ;) */
- /* case 0x0000UL:
- * return "SparkLAN WL-850F";
- * break;*/
-
- /* We have two reported for the one bellow :( */
- case 0x0014UL:
- *modelp = "XG-600";
- break;
- case 0x0020UL:
- *modelp = "XG-900/GW-DS54G";
- break;
- case PCIDEVICE_ISL3890:
- *modelp = "PRISM Duette/GT";
- break;
- default:
- *modelp = "PRISM Duette/GT";
- }
- return 0;
-}
diff -Naur prism54-cvs-latest/ksrc/islpci_dev.h prism54-msw/ksrc/islpci_dev.h
--- prism54-cvs-latest/ksrc/islpci_dev.h 2004-02-20
04:41:00.000000000 +0100
+++ prism54-msw/ksrc/islpci_dev.h 2004-02-21 17:19:14.000000000 +0100
@@ -275,5 +275,4 @@
int islpci_alloc_memory(islpci_private *);
int islpci_free_memory(islpci_private *);
struct net_device *islpci_setup(struct pci_dev *);
-inline int prism54_get_card_model(struct net_device *, char **);
#endif /* _ISLPCI_DEV_H */
diff -Naur prism54-cvs-latest/ksrc/islpci_hotplug.c
prism54-msw/ksrc/islpci_hotplug.c
--- prism54-cvs-latest/ksrc/islpci_hotplug.c 2004-01-30
07:14:13.000000000 +0100
+++ prism54-msw/ksrc/islpci_hotplug.c 2004-02-21 18:01:54.000000000 +0100
@@ -127,6 +127,66 @@
/* .enable_wake ; we don't support this yet */
};
+static void
+prism54_get_card_model(struct net_device *ndev)
+{
+ islpci_private *priv;
+ char *modelp;
+
+ priv = ndev->priv;
+ switch (priv->pdev->subsystem_device) {
+ case PCIDEVICE_ISL3877:
+ modelp = "PRISM Indigo";
+ break;
+ case PCIDEVICE_3COM6001:
+ modelp = "3COM 3CRWE154G72";
+ break;
+ case 0x3202UL:
+ modelp = "D-Link DWL-g650 A1";
+ break;
+ case 0xd019UL:
+ modelp = "WN-G54/CB";
+ break;
+ case 0x4800UL:
+ modelp = "Netgear WG511";
+ break;
+ case 0x2802UL:
+ modelp = "SMC2802W";
+ break;
+ case 0xee03UL:
+ modelp = "SMC2802W V2";
+ break;
+ case 0x2835UL:
+ modelp = "SMC2835W";
+ break;
+ /* Let's leave this one out for now since it seems bogus/wrong
+ * Even if the manufacturer did use 0x0000UL it may not be correct
+ * by their part, therefore deserving no name ;) */
+ /* case 0x0000UL:
+ * modelp = "SparkLAN WL-850F";
+ * break;*/
+
+ /* We have two reported for the one below :( */
+ case 0x0014UL:
+ modelp = "XG-600";
+ break;
+ case 0x0020UL:
+ modelp = "XG-900/GW-DS54G";
+ break;
+/* Default it */
+/*
+ case PCIDEVICE_ISL3890:
+ modelp = "PRISM Duette/GT";
+ break;
+*/
+ default:
+ modelp = "PRISM Duette/GT";
+ }
+ printk(KERN_DEBUG "%s: %s driver detected card model: %s\n",
+ ndev->name, DRV_NAME, modelp);
+ return;
+}
+
/******************************************************************************
Module initialization functions
******************************************************************************/
@@ -139,8 +199,6 @@
u32 mem_addr;
islpci_private *priv;
int rvalue;
- char *model;
- char **modelp;
/* TRACE(DRV_NAME); */
@@ -151,9 +209,6 @@
return -ENODEV;
}
- model = "PRISM Duette/GT"; /* Default */
- modelp = &model;
-
/* check whether the latency timer is set correctly */
pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &latency_tmr);
#if VERBOSE > SHOW_ERROR_MESSAGES
@@ -234,16 +289,8 @@
/* firmware upload is triggered in islpci_open */
- /* Perty card model discovery output */
- if (prism54_get_card_model(ndev, modelp)) {
- printk(KERN_DEBUG "%s: Unable to determine specific card
model\n",
- ndev->name);
- }
- else {
- model = *modelp;
- printk(KERN_DEBUG "%s: %s driver detected card model: %s\n",
- ndev->name, DRV_NAME, model);
- }
+ /* Pretty card model discovery output */
+ prism54_get_card_model(ndev);
return 0;
diff -Naur prism54-cvs-latest/ksrc/oid_mgt.c prism54-msw/ksrc/oid_mgt.c
--- prism54-cvs-latest/ksrc/oid_mgt.c 2004-02-02 18:12:28.000000000 +0100
+++ prism54-msw/ksrc/oid_mgt.c 2004-02-21 17:39:07.000000000 +0100
@@ -384,8 +384,8 @@
if (reslen > isl_oid[n].size)
printk(KERN_DEBUG
- "mgt_get_request(0x%x): received data length was
bigger \
- than expected (%d > %d). Memory is probably
corrupted... ",
+ "mgt_get_request(0x%x): received data length was
bigger "
+ "than expected (%d > %d). Memory is probably
corrupted... ",
oid, reslen, isl_oid[n].size);
return ret;
@@ -485,8 +485,8 @@
if (rvalue) {
/* some request have failed. The device might be in an
incoherent state. We should reset it ! */
- printk(KERN_DEBUG "%s: mgt_commit has failed. Restart the \
- device \n", priv->ndev->name);
+ printk(KERN_DEBUG "%s: mgt_commit has failed. Restart the "
+ "device \n", priv->ndev->name);
}
/* update the MAC addr. As it's not cached, no lock will be
acquired by
Margit
--=====================_27081741==_.ALT
Content-Type: text/html; charset="us-ascii"
<html>
<font size=3>Suggested code changes/cleanup.<br>
(Luis, sent to you as attachment)<br>
Fix compile warning<br>
Correct multi-line printk's<br>
Move prism54_get_card_model and clean ip.<br><br>
diff -Naur prism54-cvs-latest/ksrc/isl_ioctl.c
prism54-msw/ksrc/isl_ioctl.c<br>
--- prism54-cvs-latest/ksrc/isl_ioctl.c 2004-02-20 05:20:48.000000000
+0100<br>
+++
prism54-msw/ksrc/isl_ioctl.c
2004-02-21 17:35:32.000000000 +0100<br>
@@ -93,8 +93,8 @@<br>
<br>
/* For now, just catch early
the Repeater and Secondary modes here */<br>
if (iw_mode == IW_MODE_REPEAT
|| iw_mode == IW_MODE_SECOND) {<br>
-
printk(KERN_DEBUG "%s(): Sorry, Repeater mode and Secondary mode
\<br>
-
are not yet supported by this driver.\n",<br>
+
printk(KERN_DEBUG "%s(): Sorry, Repeater mode and Secondary mode
"<br>
+
"are not yet supported by this driver.\n",<br>
__FUNCTION__);<br>
return -EINVAL;<br>
}<br>
@@ -171,8 +171,8 @@<br>
* mib values depending
on what the wireless mode given is. No need<br>
* for it save old values
*/<br>
if (init_mode >
IW_MODE_MONITOR || init_mode < IW_MODE_AUTO) {<br>
-
printk(KERN_DEBUG "%s(): You passed a non-valid init_mode. \<br>
-
Using default mode\n", __FUNCTION__);<br>
+
printk(KERN_DEBUG "%s(): You passed a non-valid init_mode.
"<br>
+
"Using default mode\n", __FUNCTION__);<br>
init_mode = CARD_DEFAULT_IW_MODE;<br>
}<br>
/* This sets all of the
mode-dependent values */<br>
diff -Naur prism54-cvs-latest/ksrc/islpci_dev.c
prism54-msw/ksrc/islpci_dev.c<br>
---
prism54-cvs-latest/ksrc/islpci_dev.c
2004-02-16 22:01:35.000000000 +0100<br>
+++ prism54-msw/ksrc/islpci_dev.c
2004-02-21 17:19:55.000000000 +0100<br>
@@ -781,56 +781,3 @@<br>
priv = 0;<br>
return NULL;<br>
}<br>
-<br>
-inline int<br>
-prism54_get_card_model(struct net_device *ndev, char **modelp)<br>
-{<br>
- islpci_private *priv;<br>
- priv = ndev->priv;<br>
- switch
(priv->pdev->subsystem_device) {<br>
- case PCIDEVICE_ISL3877:<br>
-
*modelp = "PRISM Indigo";<br>
-
break;<br>
- case PCIDEVICE_3COM6001:<br>
-
*modelp = "3COM 3CRWE154G72";<br>
-
break;<br>
- case 0x3202UL:<br>
-
*modelp = "D-Link DWL-g650 A1";<br>
-
break;<br>
- case 0xd019UL:<br>
-
*modelp = "WN-G54/CB";<br>
-
break;<br>
- case 0x4800UL:<br>
-
*modelp = "Netgear WG511";<br>
-
break;<br>
- case 0x2802UL:<br>
-
*modelp = "SMC2802W";<br>
-
break;<br>
- case 0xee03UL:<br>
-
*modelp = "SMC2802W V2";<br>
-
break;<br>
- case 0x2835UL:<br>
-
*modelp = "SMC2835W";<br>
-
break;<br>
-
/* Let's leave this one out for now since it seems bogus/wrong <br>
-
* Even if the manufacturer did use 0x0000UL it may not be correct<br>
-
* by their part, therefore deserving no name ;) */<br>
-
/* case 0x0000UL: <br>
-
*
return "SparkLAN WL-850F";<br>
-
*
break;*/<br>
-<br>
-
/* We have two reported for the one bellow :( */<br>
- case 0x0014UL:<br>
-
*modelp = "XG-600";<br>
-
break;<br>
- case 0x0020UL:<br>
-
*modelp = "XG-900/GW-DS54G";<br>
-
break;<br>
- case PCIDEVICE_ISL3890:<br>
-
*modelp = "PRISM Duette/GT";<br>
-
break;<br>
- default:<br>
-
*modelp = "PRISM Duette/GT";<br>
- }<br>
- return 0;<br>
-}<br>
diff -Naur prism54-cvs-latest/ksrc/islpci_dev.h
prism54-msw/ksrc/islpci_dev.h<br>
---
prism54-cvs-latest/ksrc/islpci_dev.h
2004-02-20 04:41:00.000000000 +0100<br>
+++ prism54-msw/ksrc/islpci_dev.h
2004-02-21 17:19:14.000000000 +0100<br>
@@ -275,5 +275,4 @@<br>
int islpci_alloc_memory(islpci_private *);<br>
int islpci_free_memory(islpci_private *);<br>
struct net_device *islpci_setup(struct pci_dev *);<br>
-inline int prism54_get_card_model(struct net_device *, char **);<br>
#endif
/* _ISLPCI_DEV_H */<br>
diff -Naur prism54-cvs-latest/ksrc/islpci_hotplug.c
prism54-msw/ksrc/islpci_hotplug.c<br>
--- prism54-cvs-latest/ksrc/islpci_hotplug.c 2004-01-30
07:14:13.000000000 +0100<br>
+++ prism54-msw/ksrc/islpci_hotplug.c 2004-02-21
18:01:54.000000000 +0100<br>
@@ -127,6 +127,66 @@<br>
/* .enable_wake ; we don't
support this yet */<br>
};<br>
<br>
+static void<br>
+prism54_get_card_model(struct net_device *ndev)<br>
+{<br>
+ islpci_private *priv;<br>
+
char
*modelp;<br>
+<br>
+ priv = ndev->priv;<br>
+ switch
(priv->pdev->subsystem_device) {<br>
+ case PCIDEVICE_ISL3877:<br>
+
modelp = "PRISM Indigo";<br>
+
break;<br>
+ case PCIDEVICE_3COM6001:<br>
+
modelp = "3COM 3CRWE154G72";<br>
+
break;<br>
+ case 0x3202UL:<br>
+
modelp = "D-Link DWL-g650 A1";<br>
+
break;<br>
+ case 0xd019UL:<br>
+
modelp = "WN-G54/CB";<br>
+
break;<br>
+ case 0x4800UL:<br>
+
modelp = "Netgear WG511";<br>
+
break;<br>
+ case 0x2802UL:<br>
+
modelp = "SMC2802W";<br>
+
break;<br>
+ case 0xee03UL:<br>
+
modelp = "SMC2802W V2";<br>
+
break;<br>
+ case 0x2835UL:<br>
+
modelp = "SMC2835W";<br>
+
break;<br>
+ /* Let's leave this one out for now
since it seems bogus/wrong <br>
+ * Even if the manufacturer
did use 0x0000UL it may not be correct<br>
+ * by their part, therefore
deserving no name ;) */<br>
+ /*
case 0x0000UL: <br>
+
*
modelp = "SparkLAN WL-850F";<br>
+
*
break;*/<br>
+<br>
+ /* We have two reported for the one
below :( */<br>
+ case 0x0014UL:<br>
+
modelp = "XG-600";<br>
+
break;<br>
+ case 0x0020UL:<br>
+
modelp = "XG-900/GW-DS54G";<br>
+
break;<br>
+/* Default it */<br>
+/*<br>
+ case PCIDEVICE_ISL3890:<br>
+
modelp = "PRISM Duette/GT";<br>
+
break;<br>
+*/<br>
+ default:<br>
+
modelp = "PRISM Duette/GT";<br>
+ }<br>
+ printk(KERN_DEBUG "%s: %s
driver detected card model: %s\n",<br>
+
ndev->name, DRV_NAME, modelp);<br>
+ return;<br>
+}<br>
+<br>
/******************************************************************************<br>
Module initialization functions<br>
******************************************************************************/<br>
@@ -139,8 +199,6 @@<br>
u32 mem_addr;<br>
islpci_private *priv;<br>
int rvalue;<br>
- char *model;<br>
- char **modelp;<br>
<br>
/* TRACE(DRV_NAME); */<br>
<br>
@@ -151,9 +209,6 @@<br>
return -ENODEV;<br>
}<br>
<br>
- model = "PRISM
Duette/GT"; /* Default */<br>
- modelp = &model;<br>
-<br>
/* check whether the latency
timer is set correctly */<br>
pci_read_config_byte(pdev,
PCI_LATENCY_TIMER, &latency_tmr);<br>
#if VERBOSE > SHOW_ERROR_MESSAGES<br>
@@ -234,16 +289,8 @@<br>
<br>
/* firmware upload is
triggered in islpci_open */<br>
<br>
- /* Perty card model discovery
output */<br>
- if (prism54_get_card_model(ndev,
modelp)) {<br>
-
printk(KERN_DEBUG "%s: Unable to determine specific card
model\n",<br>
-
ndev->name);<br>
- }<br>
- else {<br>
-
model = *modelp;<br>
-
printk(KERN_DEBUG "%s: %s driver detected card model:
%s\n",<br>
-
ndev->name, DRV_NAME, model);<br>
- }<br>
+ /* Pretty card model discovery
output */<br>
+ prism54_get_card_model(ndev);<br>
<br>
return 0;<br>
<br>
diff -Naur prism54-cvs-latest/ksrc/oid_mgt.c
prism54-msw/ksrc/oid_mgt.c<br>
--- prism54-cvs-latest/ksrc/oid_mgt.c 2004-02-02
18:12:28.000000000 +0100<br>
+++ prism54-msw/ksrc/oid_mgt.c 2004-02-21 17:39:07.000000000
+0100<br>
@@ -384,8 +384,8 @@<br>
<br>
if (reslen >
isl_oid[n].size)<br>
printk(KERN_DEBUG<br>
-
"mgt_get_request(0x%x): received data length was bigger \<br>
-
than expected (%d > %d). Memory is probably corrupted... ",<br>
+
"mgt_get_request(0x%x): received data length was bigger "<br>
+
"than expected (%d > %d). Memory is probably corrupted...
",<br>
oid, reslen, isl_oid[n].size);<br>
<br>
return ret;<br>
@@ -485,8 +485,8 @@<br>
if (rvalue) {<br>
/* some request have failed. The device might be in an<br>
incoherent state. We should reset it ! */<br>
-
printk(KERN_DEBUG "%s: mgt_commit has failed. Restart the \<br>
-
device \n", priv->ndev->name);<br>
+
printk(KERN_DEBUG "%s: mgt_commit has failed. Restart the
"<br>
+
"device \n", priv->ndev->name);<br>
}<br>
<br>
/* update the MAC addr. As
it's not cached, no lock will be acquired by<br><br>
<br>
Margit</font></html>
--=====================_27081741==_.ALT--