From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752945AbcFBIMA (ORCPT ); Thu, 2 Jun 2016 04:12:00 -0400 Received: from canardo.mork.no ([148.122.252.1]:44236 "EHLO canardo.mork.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751833AbcFBIL2 convert rfc822-to-8bit (ORCPT ); Thu, 2 Jun 2016 04:11:28 -0400 From: =?utf-8?Q?Bj=C3=B8rn_Mork?= To: Cc: , , , , , , Subject: Re: [PATCH] r8152: Add support for setting MAC to system's Auxiliary MAC address Organization: m References: <1464817844-27206-1-git-send-email-mario_limonciello@dell.com> <20160601230535.GA29279@kroah.com> Date: Thu, 02 Jun 2016 10:11:10 +0200 In-Reply-To: (Mario Limonciello's message of "Thu, 2 Jun 2016 02:53:06 +0000") Message-ID: <8760tsypr5.fsf@nemi.mork.no> User-Agent: Gnus/5.130015 (Ma Gnus v0.15) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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