* [PATCH] rtl8xxxu: Don't printk raw binary if serial number is not burned in.
@ 2017-09-07 23:51 Adam Borowski
[not found] ` <20170907235103.5359-1-kilobyte-b9QjgO8OEXPVItvQsEIGlw@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Adam Borowski @ 2017-09-07 23:51 UTC (permalink / raw)
To: Jes Sorensen, Kalle Valo, linux-wireless, netdev; +Cc: Adam Borowski
I assume that a blank efuse comes with all ones, thus I did not bother
recognizing other possible junk values. This matches 100% of dongles
I've seen (a single Gembird 8192eu).
Signed-off-by: Adam Borowski <kilobyte@angband.pl>
---
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c
index 80fee699f58a..bdc37e7272ca 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c
@@ -614,7 +614,11 @@ static int rtl8192eu_parse_efuse(struct rtl8xxxu_priv *priv)
dev_info(&priv->udev->dev, "Vendor: %.7s\n", efuse->vendor_name);
dev_info(&priv->udev->dev, "Product: %.11s\n", efuse->device_name);
- dev_info(&priv->udev->dev, "Serial: %.11s\n", efuse->serial);
+ if (strncmp(efuse->serial,
+ "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", 11))
+ dev_info(&priv->udev->dev, "Serial: %.11s\n", efuse->serial);
+ else
+ dev_info(&priv->udev->dev, "Serial not available.\n");
if (rtl8xxxu_debug & RTL8XXXU_DEBUG_EFUSE) {
unsigned char *raw = priv->efuse_wifi.raw;
--
2.14.1
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <20170907235103.5359-1-kilobyte-b9QjgO8OEXPVItvQsEIGlw@public.gmane.org>]
* Re: [PATCH] rtl8xxxu: Don't printk raw binary if serial number is not burned in. [not found] ` <20170907235103.5359-1-kilobyte-b9QjgO8OEXPVItvQsEIGlw@public.gmane.org> @ 2017-09-08 1:27 ` Stefano Brivio 2017-09-08 10:30 ` [PATCH v2] " Adam Borowski 0 siblings, 1 reply; 4+ messages in thread From: Stefano Brivio @ 2017-09-08 1:27 UTC (permalink / raw) To: Adam Borowski Cc: Jes Sorensen, Kalle Valo, linux-wireless-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA On Fri, 8 Sep 2017 01:51:03 +0200 Adam Borowski <kilobyte-b9QjgO8OEXPVItvQsEIGlw@public.gmane.org> wrote: > I assume that a blank efuse comes with all ones, thus I did not bother > recognizing other possible junk values. This matches 100% of dongles > I've seen (a single Gembird 8192eu). > > Signed-off-by: Adam Borowski <kilobyte-b9QjgO8OEXPVItvQsEIGlw@public.gmane.org> > --- > drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c > index 80fee699f58a..bdc37e7272ca 100644 > --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c > +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c > @@ -614,7 +614,11 @@ static int rtl8192eu_parse_efuse(struct rtl8xxxu_priv *priv) > > dev_info(&priv->udev->dev, "Vendor: %.7s\n", efuse->vendor_name); > dev_info(&priv->udev->dev, "Product: %.11s\n", efuse->device_name); > - dev_info(&priv->udev->dev, "Serial: %.11s\n", efuse->serial); > + if (strncmp(efuse->serial, > + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", 11)) You might want to use memchr_inv(): if (memchr_inv(efuse->serial, 0xff, 11)) dev_info(&priv->udev->dev, "Serial: %.11s\n", efuse->serial); ... Mostly cosmetic though. -- Stefano ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] rtl8xxxu: Don't printk raw binary if serial number is not burned in. 2017-09-08 1:27 ` Stefano Brivio @ 2017-09-08 10:30 ` Adam Borowski [not found] ` <20170908103000.6795-1-kilobyte-b9QjgO8OEXPVItvQsEIGlw@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Adam Borowski @ 2017-09-08 10:30 UTC (permalink / raw) To: Jes Sorensen, Kalle Valo, linux-wireless-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA, Stefano Brivio Cc: Adam Borowski I assume that a blank efuse comes with all ones, thus I did not bother recognizing other possible junk values. This matches 100% of dongles I've seen (a single Gembird 8192eu). Signed-off-by: Adam Borowski <kilobyte-b9QjgO8OEXPVItvQsEIGlw@public.gmane.org> --- v2: strncmp("goofy string") -> memchr_inv() Stefano Brivio wrote: > You might want to use memchr_inv(): > > if (memchr_inv(efuse->serial, 0xff, 11)) > dev_info(&priv->udev->dev, "Serial: %.11s\n", efuse->serial); > ... > > Mostly cosmetic though. This looks much better, thanks! drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c index 80fee699f58a..38b2ba1ac6f8 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c @@ -614,7 +614,10 @@ static int rtl8192eu_parse_efuse(struct rtl8xxxu_priv *priv) dev_info(&priv->udev->dev, "Vendor: %.7s\n", efuse->vendor_name); dev_info(&priv->udev->dev, "Product: %.11s\n", efuse->device_name); - dev_info(&priv->udev->dev, "Serial: %.11s\n", efuse->serial); + if (memchr_inv(efuse->serial, 0xff, 11)) + dev_info(&priv->udev->dev, "Serial: %.11s\n", efuse->serial); + else + dev_info(&priv->udev->dev, "Serial not available.\n"); if (rtl8xxxu_debug & RTL8XXXU_DEBUG_EFUSE) { unsigned char *raw = priv->efuse_wifi.raw; -- 2.14.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
[parent not found: <20170908103000.6795-1-kilobyte-b9QjgO8OEXPVItvQsEIGlw@public.gmane.org>]
* Re: [v2] rtl8xxxu: Don't printk raw binary if serial number is not burned in. [not found] ` <20170908103000.6795-1-kilobyte-b9QjgO8OEXPVItvQsEIGlw@public.gmane.org> @ 2017-09-25 8:24 ` Kalle Valo 0 siblings, 0 replies; 4+ messages in thread From: Kalle Valo @ 2017-09-25 8:24 UTC (permalink / raw) To: Adam Borowski Cc: Jes Sorensen, linux-wireless-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA, Stefano Brivio, Adam Borowski Adam Borowski <kilobyte-b9QjgO8OEXPVItvQsEIGlw@public.gmane.org> wrote: > I assume that a blank efuse comes with all ones, thus I did not bother > recognizing other possible junk values. This matches 100% of dongles > I've seen (a single Gembird 8192eu). > > Signed-off-by: Adam Borowski <kilobyte-b9QjgO8OEXPVItvQsEIGlw@public.gmane.org> Patch applied to wireless-drivers-next.git, thanks. e0a576d74782 rtl8xxxu: Don't printk raw binary if serial number is not burned in. -- https://patchwork.kernel.org/patch/9943635/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-09-25 8:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-07 23:51 [PATCH] rtl8xxxu: Don't printk raw binary if serial number is not burned in Adam Borowski
[not found] ` <20170907235103.5359-1-kilobyte-b9QjgO8OEXPVItvQsEIGlw@public.gmane.org>
2017-09-08 1:27 ` Stefano Brivio
2017-09-08 10:30 ` [PATCH v2] " Adam Borowski
[not found] ` <20170908103000.6795-1-kilobyte-b9QjgO8OEXPVItvQsEIGlw@public.gmane.org>
2017-09-25 8:24 ` [v2] " Kalle Valo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).