From: Michael Straube <straube.linux@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Joe Perches <joe@perches.com>,
Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH v3 4/4] staging: rtl8723bs: use mac_pton() in rtw_macaddr_cfg()
Date: Tue, 26 Jun 2018 22:48:19 +0200 [thread overview]
Message-ID: <40882fdb-bac1-9aad-1560-60e59cfa09f5@gmail.com> (raw)
In-Reply-To: <CAHp75Ve8JTY7KiQcRnD+DV-oEWnqFgA9uu2Ufz22zaOvf_xiGw@mail.gmail.com>
On 06/26/18 19:34, Andy Shevchenko wrote:
> On Tue, Jun 26, 2018 at 11:14 AM, Michael Straube
> <straube.linux@gmail.com> wrote:
>> Use the mac_pton() helper to convert the mac address string.
>>
>> The functions key_char2num() and key_2char2num() are not used
>> anywhere else and can be removed.
>>
>> This also has the benefit of validating the input since mac_pton()
>> returns false if the string is not valid.
>>
>
> FWIW,
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>
Thanks.
>> Signed-off-by: Michael Straube <straube.linux@gmail.com>
>> ---
>> .../staging/rtl8723bs/core/rtw_ieee80211.c | 30 +++----------------
>> .../staging/rtl8723bs/os_dep/ioctl_linux.c | 3 --
>> 2 files changed, 4 insertions(+), 29 deletions(-)
>>
>> diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
>> index 8af4a89e632f..8e0025e1ff14 100644
>> --- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
>> +++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
>> @@ -1137,25 +1137,6 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
>>
>> }
>>
>> -static u8 key_char2num(u8 ch);
>> -static u8 key_char2num(u8 ch)
>> -{
>> - if ((ch >= '0') && (ch <= '9'))
>> - return ch - '0';
>> - else if ((ch >= 'a') && (ch <= 'f'))
>> - return ch - 'a' + 10;
>> - else if ((ch >= 'A') && (ch <= 'F'))
>> - return ch - 'A' + 10;
>> - else
>> - return 0xff;
>> -}
>> -
>> -u8 key_2char2num(u8 hch, u8 lch);
>> -u8 key_2char2num(u8 hch, u8 lch)
>> -{
>> - return ((key_char2num(hch) << 4) | key_char2num(lch));
>> -}
>> -
>> void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
>> {
>> u8 mac[ETH_ALEN];
>> @@ -1166,14 +1147,11 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
>> if (!mac_addr)
>> return;
>>
>> - if (rtw_initmac) { /* Users specify the mac address */
>> - int jj, kk;
>> -
>> - for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) {
>> - mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk + 1]);
>> - }
>> + if (rtw_initmac && mac_pton(rtw_initmac, mac)) {
>> + /* Users specify the mac address */
>> ether_addr_copy(mac_addr, mac);
>> - } else{ /* Use the mac address stored in the Efuse */
>> + } else {
>> + /* Use the mac address stored in the Efuse */
>> ether_addr_copy(mac, mac_addr);
>> }
>>
>> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
>> index 39502156f652..4eb51f45b387 100644
>> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
>> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
>> @@ -32,9 +32,6 @@
>> #define WEXT_CSCAN_HOME_DWELL_SECTION 'H'
>> #define WEXT_CSCAN_TYPE_SECTION 'T'
>>
>> -
>> -extern u8 key_2char2num(u8 hch, u8 lch);
>> -
>> static u32 rtw_rates[] = {1000000, 2000000, 5500000, 11000000,
>> 6000000, 9000000, 12000000, 18000000, 24000000, 36000000, 48000000, 54000000};
>>
>> --
>> 2.18.0
>>
>
>
>
prev parent reply other threads:[~2018-06-26 20:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-26 8:14 [PATCH v3 1/4] staging: rtl8723bs: fix comparsion to NULL - coding style Michael Straube
2018-06-26 8:14 ` [PATCH v3 2/4] staging: rtl8723bs: refactor rtw_macaddr_cfg() Michael Straube
2018-06-26 17:29 ` Andy Shevchenko
2018-06-26 19:19 ` Michael Straube
2018-06-26 8:14 ` [PATCH v3 3/4] staging: rtl8723bs: use ether_addr_copy() in rtw_macaddr_cfg() Michael Straube
2018-06-26 17:32 ` Andy Shevchenko
2018-06-26 19:44 ` Michael Straube
2018-06-26 20:17 ` Joe Perches
2018-06-26 20:32 ` Michael Straube
2018-06-26 21:36 ` Joe Perches
2018-06-27 8:33 ` Dan Carpenter
2018-06-27 12:56 ` Michael Straube
2018-06-27 13:11 ` Dan Carpenter
2018-06-27 16:14 ` Andy Shevchenko
2018-06-27 16:42 ` Joe Perches
2018-06-27 18:35 ` Dan Carpenter
2018-06-26 8:14 ` [PATCH v3 4/4] staging: rtl8723bs: use mac_pton() " Michael Straube
2018-06-26 17:34 ` Andy Shevchenko
2018-06-26 20:48 ` Michael Straube [this message]
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=40882fdb-bac1-9aad-1560-60e59cfa09f5@gmail.com \
--to=straube.linux@gmail.com \
--cc=andy.shevchenko@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®