From: Joe Perches <joe@perches.com>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: linux-wireless@vger.kernel.org,
"John W. Linville" <linville@tuxdriver.com>,
b43-dev@lists.infradead.org
Subject: [PATCH V2] b43: be more user friendly with PHY info
Date: Wed, 25 Jul 2012 08:48:45 -0700 [thread overview]
Message-ID: <1343231325.1693.13.camel@joe2Laptop> (raw)
In-Reply-To: <CACna6rwDo=oW42mEwHXT0M5c56tWWtBqqb+Wv+L0iKzSasux8A@mail.gmail.com>
On Wed, 2012-07-25 at 16:22 +0200, Rafa? Mi?ecki wrote:
> 2012/7/25 Joe Perches <joe@perches.com>:
> > On Wed, 2012-07-25 at 16:47 +0200, Rafa? Mi?ecki wrote:
> >> use PHY names instead of magic numbers.
> > []
> >> diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
> > []
> >> @@ -4277,6 +4277,37 @@ out:
> > []
> >> +static char *b43_phy_name(struct b43_wldev *dev, u8 phy_type)
> >> +{
> >> + switch (phy_type) {
> >> + case B43_PHYTYPE_A:
> >> + return "A";
> > []
> >> + }
> >> +
> >> + b43err(dev->wl, "Unknown PHY Type: %d\n", phy_type);
> >> + return "UNKNOWN";
> >
> > In general, it's a bad idea to emit error messages
> > in a generic call like this.
>
> This function is not supposed to be called anywhere else, it's only
> for a single user-friendly message.
>
>
> >> @@ -4337,13 +4368,12 @@ 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 %s, Revision %u)\n",
> >> + analog_type, b43_phy_name(dev, phy_type), phy_rev);
> >
> > The extra message doesn't add much useful info
> > and can also cause errors in continued messages.
>
> By "extra message" do you mean the one from b43_phy_name? I wanted to
> print PHY type as digit somewhere (in case it is not recognized). I
> can't use simple
> return ("UNKNOWN %d", phy_type);
> , such a solution would require allocating memory for string and
> freeing it. It would complicate the function.
>
> Do you have any suggestion for better handling this?
>
Change the UNSUPPORTED PHY message to
"...Type: %d:(%s)...",
..., phy_type, b43_phy_name(dev, phy_type), ...
next prev parent reply other threads:[~2012-07-25 15:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-25 14:47 [PATCH V2] b43: be more user friendly with PHY info Rafał Miłecki
2012-07-25 14:10 ` Joe Perches
2012-07-25 14:22 ` Rafał Miłecki
2012-07-25 15:48 ` Joe Perches [this message]
2012-07-25 15:55 ` 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=1343231325.1693.13.camel@joe2Laptop \
--to=joe@perches.com \
--cc=b43-dev@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=zajec5@gmail.com \
/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