From: Oleksij Rempel <bug-track@fisher-privat.net>
To: b43-dev@lists.infradead.org
Subject: [PATCH V3] b43: be more user friendly with PHY info
Date: Thu, 26 Jul 2012 09:32:20 +0200 [thread overview]
Message-ID: <5010F284.1040808@fisher-privat.net> (raw)
In-Reply-To: <CACna6ry-god2wr60t0c9WvaOBA_X=DK7j5xDU7r7R6mUFYKV3Q@mail.gmail.com>
Am 26.07.2012 08:50, schrieb Rafa? Mi?ecki:
> 2012/7/26 Oleksij Rempel <bug-track@fisher-privat.net>:
>> Am 26.07.2012 08:10, schrieb Rafa? Mi?ecki:
>>> 2012/7/26 G?bor Stefanik <netrolller.3d@gmail.com>:
>>>> On Thu, Jul 26, 2012 at 8:16 AM, Rafa? Mi?ecki <zajec5@gmail.com> wrote:
>>>>> 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 <zajec5@gmail.com>
>>>>> ---
>>>>> 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(-)
>>>>>
>>>>> diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
>>>>> index 7c899fc..b0c7f47 100644
>>>>> --- a/drivers/net/wireless/b43/b43.h
>>>>> +++ b/drivers/net/wireless/b43/b43.h
>>>>> @@ -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
>>>>> diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
>>>>> index b80352b..a8f812b 100644
>>>>> --- a/drivers/net/wireless/b43/main.c
>>>>> +++ b/drivers/net/wireless/b43/main.c
>>>>> @@ -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";
>>>>
>>>> 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?
>>>
>>
>> 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, ...);
--
Regards,
Oleksij
next prev parent reply other threads:[~2012-07-26 7:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-26 6:16 [PATCH V3] b43: be more user friendly with PHY info Rafał Miłecki
2012-07-26 6:01 ` Gábor Stefanik
2012-07-26 6:10 ` Rafał Miłecki
2012-07-26 6:22 ` Oleksij Rempel
2012-07-26 6:50 ` Rafał Miłecki
2012-07-26 7:32 ` Oleksij Rempel [this message]
2012-07-26 7:37 ` Rafał Miłecki
2012-07-26 7:37 ` Rafał Miłecki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5010F284.1040808@fisher-privat.net \
--to=bug-track@fisher-privat.net \
--cc=b43-dev@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox