From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753415AbcBBNhb (ORCPT ); Tue, 2 Feb 2016 08:37:31 -0500 Received: from vms173023pub.verizon.net ([206.46.173.23]:50221 "EHLO vms173023pub.verizon.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750932AbcBBNha (ORCPT ); Tue, 2 Feb 2016 08:37:30 -0500 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=MtGvkDue c=1 sm=1 tr=0 a=bXmWQgKa9n63w7XTPFb8JQ==:117 a=IkcTkHD0fZMA:10 a=xqWC_Br6kY4A:10 a=jFJIQSaiL_oA:10 a=N54-gffFAAAA:8 a=fk1lIlRQAAAA:8 a=VwQbUJbxAAAA:8 a=LJiAWpNQy--0xii8_cIA:9 a=ohJFZkiTkvCz7Ws4:21 a=52tF6z9fNZsLrp09:21 a=QEXdDO2ut3YA:10 Reply-to: minyard@acm.org Subject: Re: [PATCH 2/4] dmi: Add a DMI firmware node and handling References: <1454107394-8914-1-git-send-email-minyard@acm.org> <1454107394-8914-3-git-send-email-minyard@acm.org> <1454318722.4754.17.camel@chaos.site> To: Jean Delvare Cc: openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org, Andy Lutomirski , Corey Minyard From: Corey Minyard Message-id: <56B0B101.9030701@acm.org> Date: Tue, 02 Feb 2016 07:37:05 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-version: 1.0 In-reply-to: <1454318722.4754.17.camel@chaos.site> Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/01/2016 03:25 AM, Jean Delvare wrote: > Hi Corey, > > I won't comment on the IPMI side of this as this isn't my area. However > I have a comment on the DMI part: > > Le Friday 29 January 2016 à 16:43 -0600, minyard@acm.org a écrit : >> From: Corey Minyard >> >> This is so that an IPMI platform device can be created from a >> DMI firmware entry. >> >> Signed-off-by: Corey Minyard >> Cc: Jean Delvare >> Cc: Andy Lutomirski >> --- >> drivers/firmware/dmi_scan.c | 34 ++++++++++++++++++++++++---------- >> include/linux/dmi.h | 24 ++++++++++++++++++++++++ >> include/linux/fwnode.h | 1 + >> 3 files changed, 49 insertions(+), 10 deletions(-) >> >> diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c >> index da471b2..13d9bca 100644 >> --- a/drivers/firmware/dmi_scan.c >> +++ b/drivers/firmware/dmi_scan.c >> @@ -41,6 +41,16 @@ static struct dmi_memdev_info { >> } *dmi_memdev; >> static int dmi_memdev_nr; >> >> +static void *dmi_zalloc(unsigned len) >> +{ >> + void *ret = dmi_alloc(len); >> + >> + if (ret) >> + memset(ret, 0, len); >> + >> + return ret; >> +} >> + >> static const char * __init dmi_string_nosave(const struct dmi_header *dm, u8 s) >> { >> const u8 *bp = ((u8 *) dm) + dm->length; >> @@ -242,6 +252,12 @@ static void __init dmi_save_type(const struct dmi_header *dm, int slot, >> (...) >> @@ -250,15 +266,14 @@ static void __init dmi_save_one_device(int type, const char *name) >> if (dmi_find_device(type, name, NULL)) >> return; >> >> - dev = dmi_alloc(sizeof(*dev) + strlen(name) + 1); >> + dev = dmi_zalloc(sizeof(*dev) + strlen(name) + 1); >> if (!dev) >> return; >> >> dev->type = type; >> strcpy((char *)(dev + 1), name); >> dev->name = (char *)(dev + 1); >> - dev->device_data = NULL; > This change seems rather unrelated, and I'm not sure what purpose it > serves. On ia64 and arm64 it is clearly redundant as dmi_alloc calls > kzalloc directly. On x86_64, extend_brk is called instead (don't ask me > why, I have no clue) but looking at the code I see that it does > memset(ret, 0, size) as well so memory is also zeroed there. Which makes > dmi_alloc the same as dmi_zalloc on all 3 architectures. > > So please revert this change. This will make your patch easier to > review, too. > Ok. I had assumed extend_break wasn't zeroing since there were all the NULL assignments, I should have looked. I was thinking about this, and the fwnode could just be added to the IPMI device. I'm not sure if you would prefer that over adding it to dmi_device. The fwnode is in acpi_device, and I was modelling these changes after that, but maybe that's not required here. Thanks, -corey