b43: be more user friendly with PHY info
PATCH v3 1/1 b43: be more user friendly with PHY info
First of all, use PHY names instead of magic numbers. It should make configuring kernel easier in case of not enabled PHY type support. Secondly, always print info about PHY. This is really basic info about hardware and quite important for the support level.
---
V2: add new PHYTYPEs
V3: don't printk error in b43_phy_name, just return "UNKNOWN". We still
can know PHY type thanks to change in caller, which prints both:
%d and %s. Thanks Joe!
--- drivers/net/wireless/b43/b43.h | 2 ++ drivers/net/wireless/b43/main.c | 39 ++++++++++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 5 deletions(-)
drivers/net/wireless/b43/b43.h +2 -0
@@ -415,6 +415,8 @@ enum {#define B43_PHYTYPE_HT 0x07#define B43_PHYTYPE_LCN 0x08#define B43_PHYTYPE_LCNXN 0x09 +#define B43_PHYTYPE_LCN40 0x0a +#define B43_PHYTYPE_AC 0x0b/* PHYRegisters */ #define B43_PHY_ILT_A_CTRL 0x0072
drivers/net/wireless/b43/main.c +34 -5
@@ -4277,6 +4277,35 @@ out:return err; } +static char *b43_phy_name (struct b43_wldev *dev,u8 phy_type) +{ +switch (phy_type) { +case B43_PHYTYPE_A : +return "A" ; +case B43_PHYTYPE_B : +return "B" ; +case B43_PHYTYPE_G : +return "G" ; +case B43_PHYTYPE_N : +return "N" ; +case B43_PHYTYPE_LP : +return "LP" ; +case B43_PHYTYPE_SSLPN : +return "SSLPN" ; +case B43_PHYTYPE_HT : +return "HT" ; +case B43_PHYTYPE_LCN : +return "LCN" ; +case B43_PHYTYPE_LCNXN : +return "LCNXN" ; +case B43_PHYTYPE_LCN40 : +return "LCN40" ; +case B43_PHYTYPE_AC : +return "AC" ; + } +return "UNKNOWN" ; +} +/* Get PHY and RADIO versioning numbers */ static int b43_phy_versioning (struct b43_wldev *dev) {
@@ -4337,13 +4366,13 @@ static int b43_phy_versioning(struct b43_wldev *dev) unsupported =1 ; }if (unsupported) { -b43err (dev->wl,"FOUND UNSUPPORTED PHY " -"(Analog %u, Type %u, Revision %u)\n" , - analog_type, phy_type, phy_rev); +b43err (dev->wl,"FOUND UNSUPPORTED PHY (Analog %u, Type %d (%s), Revision %u)\n" , + analog_type, phy_type,b43_phy_name (dev, phy_type), + phy_rev);return -EOPNOTSUPP ; } -b43dbg (dev->wl,"Found PHY: Analog %u, Type %u, Revision %u\n" , - analog_type, phy_type, phy_rev); +b43info (dev->wl,"Found PHY: Analog %u, Type %d (%s), Revision %u\n" , + analog_type, phy_type,b43_phy_name (dev, phy_type), phy_rev);/* Get RADIO versioning */ if (dev->dev->core_rev >=24 ) {
Signature · 1 line
1.7.7
PATCH v3 1/1 b43: be more user friendly with PHY info
Quoted 54 lines · Rafa? Mi?ecki
First of all, use PHY names instead of magic numbers. It should make configuring kernel easier in case of not enabled PHY type support. Secondly, always print info about PHY. This is really basic info about hardware and quite important for the support level.
Signed-off-by Rafa? Mi?ecki <[email protected]>---
V2: add new PHYTYPEs
V3: don't printk error inb43_phy_name, just return "UNKNOWN". We still
can know PHY type thanks to change in caller, which prints both:
%d and %s. Thanks Joe!--- drivers/net/wireless/b43/b43.h | 2 ++ drivers/net/wireless/b43/main.c | 39 ++++++++++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 5 deletions(-)drivers/net/wireless/b43/b43.h +2
-0@@ -415,6 +415,8 @@ enum {#define B43_PHYTYPE_HT 0x07#define B43_PHYTYPE_LCN 0x08#define B43_PHYTYPE_LCNXN 0x09 +#define B43_PHYTYPE_LCN40 0x0a +#define B43_PHYTYPE_AC 0x0b/* PHYRegisters */ #define B43_PHY_ILT_A_CTRL 0x0072drivers/net/wireless/b43/main.c +17
-0@@ -4277,6 +4277,35 @@ out:return err; } +static char *b43_phy_name (struct b43_wldev *dev,u8 phy_type) +{ +switch (phy_type) { +case B43_PHYTYPE_A : +return "A" ; +case B43_PHYTYPE_B : +return "B" ; +case B43_PHYTYPE_G : +return "G" ; +case B43_PHYTYPE_N : +return "N" ; +case B43_PHYTYPE_LP : +return "LP" ; +case B43_PHYTYPE_SSLPN : +return "SSLPN" ; +case B43_PHYTYPE_HT : +return "HT" ;
drivers/net/wireless/b43/main.c out: · line 4306
Quoted 10 lines
drivers/net/wireless/b43/main.c +10
-0+case B43_PHYTYPE_LCN : +return "LCN" ; +case B43_PHYTYPE_LCNXN : +return "LCNXN" ; +case B43_PHYTYPE_LCN40 : +return "LCN40" ; +case B43_PHYTYPE_AC : +return "AC" ; + } +return "UNKNOWN" ;
How about putting the PHY type ID into the string in the Unknown case? Or will it be printed somewhere else?
Quoted 31 lines
drivers/net/wireless/b43/main.c +7
-6+} +/* Get PHY and RADIO versioning numbers */ static int b43_phy_versioning (struct b43_wldev *dev) {@@ -4337,13 +4366,13 @@ static int b43_phy_versioning(struct b43_wldev *dev) unsupported =1 ; }if (unsupported) { -b43err (dev->wl,"FOUND UNSUPPORTED PHY " -"(Analog %u, Type %u, Revision %u)\n" , - analog_type, phy_type, phy_rev); +b43err (dev->wl,"FOUND UNSUPPORTED PHY (Analog %u, Type %d (%s), Revision %u)\n" , + analog_type, phy_type,b43_phy_name (dev, phy_type), + phy_rev);return -EOPNOTSUPP ; } -b43dbg (dev->wl,"Found PHY: Analog %u, Type %u, Revision %u\n" , - analog_type, phy_type, phy_rev); +b43info (dev->wl,"Found PHY: Analog %u, Type %d (%s), Revision %u\n" , + analog_type, phy_type,b43_phy_name (dev, phy_type), phy_rev);/* Get RADIO versioning */ if (dev->dev->core_rev >=24 ) { --1.7.7
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
PATCH v3 1/1 b43: be more user friendly with PHY info
2012/7/26 G?bor Stefanik <[email protected]>:
Quoted 60 lines · Rafa? Mi?ecki
Quoted 59 lines
First of all, use PHY names instead of magic numbers. It should make configuring kernel easier in case of not enabled PHY type support. Secondly, always print info about PHY. This is really basic info about hardware and quite important for the support level.
Signed-off-by Rafa? Mi?ecki <[email protected]>---
V2: add new PHYTYPEs
V3: don't printk error inb43_phy_name, just return "UNKNOWN". We still
can know PHY type thanks to change in caller, which prints both:
%d and %s. Thanks Joe!--- drivers/net/wireless/b43/b43.h | 2 ++ drivers/net/wireless/b43/main.c | 39 ++++++++++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 5 deletions(-)drivers/net/wireless/b43/b43.h +2
-0@@ -415,6 +415,8 @@ enum {#define B43_PHYTYPE_HT 0x07#define B43_PHYTYPE_LCN 0x08#define B43_PHYTYPE_LCNXN 0x09 +#define B43_PHYTYPE_LCN40 0x0a +#define B43_PHYTYPE_AC 0x0b/* PHYRegisters */ #define B43_PHY_ILT_A_CTRL 0x0072drivers/net/wireless/b43/main.c +22
-0@@ -4277,6 +4277,35 @@ out:return err; } +static char *b43_phy_name (struct b43_wldev *dev,u8 phy_type) +{ +switch (phy_type) { +case B43_PHYTYPE_A : +return "A" ; +case B43_PHYTYPE_B : +return "B" ; +case B43_PHYTYPE_G : +return "G" ; +case B43_PHYTYPE_N : +return "N" ; +case B43_PHYTYPE_LP : +return "LP" ; +case B43_PHYTYPE_SSLPN : +return "SSLPN" ; +case B43_PHYTYPE_HT : +return "HT" ; +case B43_PHYTYPE_LCN : +return "LCN" ; +case B43_PHYTYPE_LCNXN : +return "LCNXN" ; +case B43_PHYTYPE_LCN40 :
Quoted 8 lines
drivers/net/wireless/b43/main.c out: · line 4306
Quoted 5 lines
drivers/net/wireless/b43/main.c +5
-0+return "LCN40" ; +case B43_PHYTYPE_AC : +return "AC" ; + } +return "UNKNOWN" ;How about putting the PHY type ID into the string in the Unknown case? Or will it be printed somewhere else?
Hm, maybe I don't see something obvious. How would you do that? Using which function?
Signature · 1 line
Rafa?
PATCH v3 1/1 b43: be more user friendly with PHY info
Am 26.07.2012 08:10, schrieb Rafa? Mi?ecki:
Quoted 70 lines
2012/7/26 G?bor Stefanik <[email protected]>:
Quoted 60 lines · Rafa? Mi?ecki
Quoted 59 lines
First of all, use PHY names instead of magic numbers. It should make configuring kernel easier in case of not enabled PHY type support. Secondly, always print info about PHY. This is really basic info about hardware and quite important for the support level.
Signed-off-by Rafa? Mi?ecki <[email protected]>---
V2: add new PHYTYPEs
V3: don't printk error inb43_phy_name, just return "UNKNOWN". We still
can know PHY type thanks to change in caller, which prints both:
%d and %s. Thanks Joe!--- drivers/net/wireless/b43/b43.h | 2 ++ drivers/net/wireless/b43/main.c | 39 ++++++++++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 5 deletions(-)drivers/net/wireless/b43/b43.h +2
-0@@ -415,6 +415,8 @@ enum {#define B43_PHYTYPE_HT 0x07#define B43_PHYTYPE_LCN 0x08#define B43_PHYTYPE_LCNXN 0x09 +#define B43_PHYTYPE_LCN40 0x0a +#define B43_PHYTYPE_AC 0x0b/* PHYRegisters */ #define B43_PHY_ILT_A_CTRL 0x0072drivers/net/wireless/b43/main.c +22
-0@@ -4277,6 +4277,35 @@ out:return err; } +static char *b43_phy_name (struct b43_wldev *dev,u8 phy_type) +{ +switch (phy_type) { +case B43_PHYTYPE_A : +return "A" ; +case B43_PHYTYPE_B : +return "B" ; +case B43_PHYTYPE_G : +return "G" ; +case B43_PHYTYPE_N : +return "N" ; +case B43_PHYTYPE_LP : +return "LP" ; +case B43_PHYTYPE_SSLPN : +return "SSLPN" ; +case B43_PHYTYPE_HT : +return "HT" ; +case B43_PHYTYPE_LCN : +return "LCN" ; +case B43_PHYTYPE_LCNXN : +return "LCNXN" ; +case B43_PHYTYPE_LCN40 :Quoted 8 lines
drivers/net/wireless/b43/main.c out: · line 4306
Quoted 5 lines
drivers/net/wireless/b43/main.c +5
-0+return "LCN40" ; +case B43_PHYTYPE_AC : +return "AC" ; + } +return "UNKNOWN" ;How about putting the PHY type ID into the string in the Unknown case? Or will it be printed somewhere else?
Quoted 3 lines
Hm, maybe I don't see something obvious. How would you do that? Using which function?
No need to, it is done here:
b43info(dev->wl, "Found PHY: Analog %u, Type %d (%s), Revision %u\n",
analog_type, phy_type, b43_phy_name(dev, phy_type), phy_rev);
Signature · 2 lines
Regards, Oleksij
PATCH v3 1/1 b43: be more user friendly with PHY info
2012/7/26 Oleksij Rempel <[email protected]>:
Quoted 71 lines
Am 26.07.2012 08:10, schrieb Rafa? Mi?ecki:
Quoted 70 lines
2012/7/26 G?bor Stefanik <[email protected]>:
Quoted 68 lines · Rafa? Mi?ecki
Quoted 54 lines
First of all, use PHY names instead of magic numbers. It should make configuring kernel easier in case of not enabled PHY type support. Secondly, always print info about PHY. This is really basic info about hardware and quite important for the support level.
Signed-off-by Rafa? Mi?ecki <[email protected]>---
V2: add new PHYTYPEs
V3: don't printk error inb43_phy_name, just return "UNKNOWN". We still
can know PHY type thanks to change in caller, which prints both:
%d and %s. Thanks Joe!--- drivers/net/wireless/b43/b43.h | 2 ++ drivers/net/wireless/b43/main.c | 39 ++++++++++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 5 deletions(-)drivers/net/wireless/b43/b43.h +2
-0@@ -415,6 +415,8 @@ enum {#define B43_PHYTYPE_HT 0x07#define B43_PHYTYPE_LCN 0x08#define B43_PHYTYPE_LCNXN 0x09 +#define B43_PHYTYPE_LCN40 0x0a +#define B43_PHYTYPE_AC 0x0b/* PHYRegisters */ #define B43_PHY_ILT_A_CTRL 0x0072drivers/net/wireless/b43/main.c +17
-0@@ -4277,6 +4277,35 @@ out:return err; } +static char *b43_phy_name (struct b43_wldev *dev,u8 phy_type) +{ +switch (phy_type) { +case B43_PHYTYPE_A : +return "A" ; +case B43_PHYTYPE_B : +return "B" ; +case B43_PHYTYPE_G : +return "G" ; +case B43_PHYTYPE_N : +return "N" ; +case B43_PHYTYPE_LP : +return "LP" ; +case B43_PHYTYPE_SSLPN : +return "SSLPN" ; +case B43_PHYTYPE_HT : +return "HT" ;drivers/net/wireless/b43/main.c out: · line 4306
Quoted 10 lines
drivers/net/wireless/b43/main.c +10
-0+case B43_PHYTYPE_LCN : +return "LCN" ; +case B43_PHYTYPE_LCNXN : +return "LCNXN" ; +case B43_PHYTYPE_LCN40 : +return "LCN40" ; +case B43_PHYTYPE_AC : +return "AC" ; + } +return "UNKNOWN" ;How about putting the PHY type ID into the string in the Unknown case? Or will it be printed somewhere else?
Quoted 7 lines
Quoted 3 lines
Hm, maybe I don't see something obvious. How would you do that? Using which function?
No need to, it is done here:
b43info(dev->wl, "Found PHY: Analog %u, Type %d (%s), Revision %u\n",analog_type, phy_type, b43_phy_name(dev, phy_type), phy_rev);
Still, at least for my curiosity, is there a way to achieve what Gabor suggested? Can we return dynamically-filled string in a function?
Signature · 1 line
Rafa?
PATCH v3 1/1 b43: be more user friendly with PHY info
Am 26.07.2012 08:50, schrieb Rafa? Mi?ecki:
Quoted 76 lines
2012/7/26 Oleksij Rempel <[email protected]>:
Quoted 75 lines
Am 26.07.2012 08:10, schrieb Rafa? Mi?ecki:
Quoted 73 lines
2012/7/26 G?bor Stefanik <[email protected]>:
Quoted 60 lines · Rafa? Mi?ecki
Quoted 59 lines
First of all, use PHY names instead of magic numbers. It should make configuring kernel easier in case of not enabled PHY type support. Secondly, always print info about PHY. This is really basic info about hardware and quite important for the support level.
Signed-off-by Rafa? Mi?ecki <[email protected]>---
V2: add new PHYTYPEs
V3: don't printk error inb43_phy_name, just return "UNKNOWN". We still
can know PHY type thanks to change in caller, which prints both:
%d and %s. Thanks Joe!--- drivers/net/wireless/b43/b43.h | 2 ++ drivers/net/wireless/b43/main.c | 39 ++++++++++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 5 deletions(-)drivers/net/wireless/b43/b43.h +2
-0@@ -415,6 +415,8 @@ enum {#define B43_PHYTYPE_HT 0x07#define B43_PHYTYPE_LCN 0x08#define B43_PHYTYPE_LCNXN 0x09 +#define B43_PHYTYPE_LCN40 0x0a +#define B43_PHYTYPE_AC 0x0b/* PHYRegisters */ #define B43_PHY_ILT_A_CTRL 0x0072drivers/net/wireless/b43/main.c +22
-0@@ -4277,6 +4277,35 @@ out:return err; } +static char *b43_phy_name (struct b43_wldev *dev,u8 phy_type) +{ +switch (phy_type) { +case B43_PHYTYPE_A : +return "A" ; +case B43_PHYTYPE_B : +return "B" ; +case B43_PHYTYPE_G : +return "G" ; +case B43_PHYTYPE_N : +return "N" ; +case B43_PHYTYPE_LP : +return "LP" ; +case B43_PHYTYPE_SSLPN : +return "SSLPN" ; +case B43_PHYTYPE_HT : +return "HT" ; +case B43_PHYTYPE_LCN : +return "LCN" ; +case B43_PHYTYPE_LCNXN : +return "LCNXN" ; +case B43_PHYTYPE_LCN40 :Quoted 8 lines
drivers/net/wireless/b43/main.c out: · line 4306
Quoted 5 lines
drivers/net/wireless/b43/main.c +5
-0+return "LCN40" ; +case B43_PHYTYPE_AC : +return "AC" ; + } +return "UNKNOWN" ;How about putting the PHY type ID into the string in the Unknown case? Or will it be printed somewhere else?
Hm, maybe I don't see something obvious. How would you do that? Using which function?
Quoted 7 lines
Quoted 3 lines
No need to, it is done here:
b43info(dev->wl, "Found PHY: Analog %u, Type %d (%s), Revision %u\n",analog_type, phy_type, b43_phy_name(dev, phy_type), phy_rev);Still, at least for my curiosity, is there a way to achieve what Gabor suggested? Can we return dynamically-filled string in a function?
int sprintf(char *str, const char *format, ...);
int snprintf(char *str, size_t size, const char *format, ...);
Signature · 2 lines
Regards, Oleksij
PATCH v3 1/1 b43: be more user friendly with PHY info
2012/7/26 Oleksij Rempel <[email protected]>:
Quoted 81 lines
Am 26.07.2012 08:50, schrieb Rafa? Mi?ecki:
Quoted 80 lines
2012/7/26 Oleksij Rempel <[email protected]>:
Quoted 78 lines
Am 26.07.2012 08:10, schrieb Rafa? Mi?ecki:
Quoted 70 lines
2012/7/26 G?bor Stefanik <[email protected]>:
Quoted 60 lines · Rafa? Mi?ecki
Quoted 59 lines
First of all, use PHY names instead of magic numbers. It should make configuring kernel easier in case of not enabled PHY type support. Secondly, always print info about PHY. This is really basic info about hardware and quite important for the support level.
Signed-off-by Rafa? Mi?ecki <[email protected]>---
V2: add new PHYTYPEs
V3: don't printk error inb43_phy_name, just return "UNKNOWN". We still
can know PHY type thanks to change in caller, which prints both:
%d and %s. Thanks Joe!--- drivers/net/wireless/b43/b43.h | 2 ++ drivers/net/wireless/b43/main.c | 39 ++++++++++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 5 deletions(-)drivers/net/wireless/b43/b43.h +2
-0@@ -415,6 +415,8 @@ enum {#define B43_PHYTYPE_HT 0x07#define B43_PHYTYPE_LCN 0x08#define B43_PHYTYPE_LCNXN 0x09 +#define B43_PHYTYPE_LCN40 0x0a +#define B43_PHYTYPE_AC 0x0b/* PHYRegisters */ #define B43_PHY_ILT_A_CTRL 0x0072drivers/net/wireless/b43/main.c +22
-0@@ -4277,6 +4277,35 @@ out:return err; } +static char *b43_phy_name (struct b43_wldev *dev,u8 phy_type) +{ +switch (phy_type) { +case B43_PHYTYPE_A : +return "A" ; +case B43_PHYTYPE_B : +return "B" ; +case B43_PHYTYPE_G : +return "G" ; +case B43_PHYTYPE_N : +return "N" ; +case B43_PHYTYPE_LP : +return "LP" ; +case B43_PHYTYPE_SSLPN : +return "SSLPN" ; +case B43_PHYTYPE_HT : +return "HT" ; +case B43_PHYTYPE_LCN : +return "LCN" ; +case B43_PHYTYPE_LCNXN : +return "LCNXN" ; +case B43_PHYTYPE_LCN40 :Quoted 8 lines
drivers/net/wireless/b43/main.c out: · line 4306
Quoted 5 lines
drivers/net/wireless/b43/main.c +5
-0+return "LCN40" ; +case B43_PHYTYPE_AC : +return "AC" ; + } +return "UNKNOWN" ;How about putting the PHY type ID into the string in the Unknown case? Or will it be printed somewhere else?
Quoted 3 lines
Hm, maybe I don't see something obvious. How would you do that? Using which function?
No need to, it is done here:
b43info(dev->wl, "Found PHY: Analog %u, Type %d (%s), Revision %u\n",analog_type, phy_type, b43_phy_name(dev, phy_type), phy_rev);
Quoted 6 lines
Quoted 3 lines
Still, at least for my curiosity, is there a way to achieve what Gabor suggested? Can we return dynamically-filled string in a function?
int
sprintf(char *str, const char *format, ...);
intsnprintf(char *str, size_t size, const char *format, ...);
Yeah, but I can't use sprintf on locally-declared (inside function) char array. Well, I can, but I can't result such an array.
So the solution is to declare char array in called, and pass that array (and it's size) to the b43_phy_name.
Well, I really prefer Joe's solution implemented in V3 :)
Signature · 1 line
Rafa?
PATCH v3 1/1 b43: be more user friendly with PHY info
2012/7/26 Rafa? Mi?ecki <[email protected]>:
Quoted 2 lines
Yeah, but I can't use sprintf on locally-declared (inside function) char array. Well, I can, but I can't result such an array.
s/result/return/
Quoted 2 lines
So the solution is to declare char array in called, and pass that array (and it's size) to the
b43_phy_name.
s/called/caller/
Signature · 1 line
Rafa?