All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bjørn Mork" <bjorn@mork.no>
To: <Mario_Limonciello@Dell.com>
Cc: <gregkh@linuxfoundation.org>, <hayeswang@realtek.com>,
	<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
	<linux-usb@vger.kernel.org>, <pali.rohar@gmail.com>,
	<anthony.wong@canonical.com>
Subject: Re: [PATCH] r8152: Add support for setting MAC to system's Auxiliary MAC address
Date: Thu, 02 Jun 2016 10:11:10 +0200	[thread overview]
Message-ID: <8760tsypr5.fsf@nemi.mork.no> (raw)
In-Reply-To: <cfff846f3ca34b6a889f07f971b27271@ausx13mpc124.AMER.DELL.COM> (Mario Limonciello's message of "Thu, 2 Jun 2016 02:53:06 +0000")

<Mario_Limonciello@Dell.com> writes:

>> > +static u8 amac_ascii_to_hex(int c)
>> > +{
>> > +	if (c <= 0x39)
>> > +		return (u8)(c - 0x30);
>> > +	else if (c <= 0x46)
>> > +		return (u8)(c - 0x37);
>> > +	return (u8)(c - 0x57);
>> > +}
>> 
>
> Sorry forgot to address this.  
>
>> We really don't have such a function somewhere in the kernel already?
>
> There is a function in acpi/acpica/uthex.c that does this, but it doesn't seem to be used by anything outside of acpica so far.  Would it be OK style wise to 
> #include " ../../acpi/acpica/acutils.h" from r8152.c?  

Makes me wonder where you looked....  You have hex_to_bin() and
hex2bin() in include/linux/kernel.h

You could look at usbnet_get_ethernet_addr() for an example of how to do
this properly.  It's pretty close to this driver in the tree, and should
be a natural starting point before reinventing the wheel...



Bjørn

  reply	other threads:[~2016-06-02  8:12 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-01 21:50 [PATCH] r8152: Add support for setting MAC to system's Auxiliary MAC address Mario Limonciello
2016-06-01 22:27 ` Andrew Lunn
2016-06-01 22:31   ` Mario_Limonciello
2016-06-01 23:06     ` Greg KH
2016-06-02  1:54       ` Mario_Limonciello
2016-06-01 23:05 ` Greg KH
2016-06-02  2:10   ` Mario_Limonciello
2016-06-02 15:22     ` Greg KH
2016-06-02 15:46       ` Mario_Limonciello
2016-06-02 15:46         ` Mario_Limonciello-DYMqY+WieiM
2016-06-02 16:09         ` Greg KH
2016-06-02 16:58           ` Mario_Limonciello
2016-06-03  9:23             ` Hayes Wang
2016-06-03 14:52               ` Mario_Limonciello
2016-06-03 14:52                 ` Mario_Limonciello-DYMqY+WieiM
2016-06-02 18:04         ` Bjørn Mork
2016-06-02 18:28           ` Mario_Limonciello
2016-06-02 19:03             ` Pali Rohár
2016-06-02 19:18               ` Mario_Limonciello
2016-06-02 18:44           ` Pali Rohár
2016-06-02  2:53   ` Mario_Limonciello
2016-06-02  8:11     ` Bjørn Mork [this message]
2016-06-02 14:29       ` Mario_Limonciello
2016-06-02  7:27   ` Bjørn Mork
2016-06-02  6:10 ` Hayes Wang
2016-06-02  7:46 ` Pali Rohár
2016-06-02 14:45   ` Mario_Limonciello
2016-06-02 15:01     ` Andrew Lunn
2016-06-02 15:07       ` Mario_Limonciello

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=8760tsypr5.fsf@nemi.mork.no \
    --to=bjorn@mork.no \
    --cc=Mario_Limonciello@Dell.com \
    --cc=anthony.wong@canonical.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hayeswang@realtek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pali.rohar@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.