Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp3567574ybx; Fri, 8 Nov 2019 23:34:26 -0800 (PST) X-Google-Smtp-Source: APXvYqxqY/7swOh+R+3mcyf1R9cMERi+BHr2/e12aQ/XOuEJl1Rb0dwG3+mXYWaWrnUTSI9ZGxu1 X-Received: by 2002:aa7:c65a:: with SMTP id z26mr14997487edr.261.1573284866307; Fri, 08 Nov 2019 23:34:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573284866; cv=none; d=google.com; s=arc-20160816; b=P2T7+Nm2WgUaOrRQPE1+Y/JlQzRFglTdHKqLi2SlyGXqz88e7kz7NX05Xqo+puYynZ 6xiIlmNnV3en+5TXJXoVbE8friEMATx3RN1jNpY8MMNrYfYZ4p43hyyKPrFBe5alJkmY RzFoqXcZJv69lBMGouPuvzP9k3S12GHk67KZy4i4Yc8CUmdwIqB/sZnycoqI8vMNoeZB ZoPkSYvqUOpG09WbFAxVW6Gwly4mmUW1U7Yj3YFXPSjZWcJZrVF32zQx2dHFURZyf3Ns At6LyulM9jMqeg0y11q7sIte+goepv/7a5kgnDFdMUCr9BmCy7M2Pki6IYx81l8xnf9M KS0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=8bLSNTzjuoFMu9WIRlNvvg4bEXkKwAKKUJYThERo2nk=; b=N24SEe1awO8C/McxQuz5HxPDLC6ANMKVNkvNRudGqHgjYiK9Ndtolu+AaJoYVhG6pX Zim8BCAOTYqg4efpIyksgBxMzTMMUibDoeasbM5RLzTSdfI4rxU0Qt0dp4Z45LFZF3xe 4mdimFiVvmvPSLgXO5oUrQHWcx4v7nMWoLC+T4M4rW//11KRLJNG2UR4aGVqQ1EpHfdY xSbYQtJNKwS4/gJdAvm9C/VyPvbl8zB1CaolCBViuBhbJ+19XU58EWKeM4jFcwvM761G zcX/14hJjqfM03rJe3Og507mjNd2Byf5b+h9O3kH94BKgut/IAKXKxJ6AJGfGoQZgLrK lfPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=NCVtnpyp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k21si5206536ejc.148.2019.11.08.23.34.03; Fri, 08 Nov 2019 23:34:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=NCVtnpyp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726383AbfKIHcX (ORCPT + 99 others); Sat, 9 Nov 2019 02:32:23 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:46254 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726143AbfKIHcX (ORCPT ); Sat, 9 Nov 2019 02:32:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=8bLSNTzjuoFMu9WIRlNvvg4bEXkKwAKKUJYThERo2nk=; b=NCVtnpypExj6Vw0e5yFRpscjL JmEt7MHE5MyUS9rd1dDlByoboMDDSIP/gzqnrPxPF9h1A01Ja/KEkK8tVaV1hvJ4yVq7bdTbY9bBS D9CZUJUixc9E2o+TCvych9E1tiKy8WM3ukvvYPxO9d/qqjax+WvKKb7o7O6YeAZZY9fOGc3qUiQlq XGIFFyUH7+0oPeAVe9gSj1+MqqX0bBNeOLGkESQYV40re95O9jUnYpOmTwlAXFnUR1kYNZ9GDknmd 04UQhGqgkR2evJeWJw6ZPL/lKCQHssnhFDisIoQ9vMlQWEzK9A48WcerYj03KOiUMkfDQGQKJd0zS V3DrA9S/g==; Received: from [80.156.29.194] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iTLEE-0007oD-4z; Sat, 09 Nov 2019 07:32:14 +0000 Date: Sat, 9 Nov 2019 08:32:10 +0100 From: Mauro Carvalho Chehab To: Robert Richter Cc: Borislav Petkov , Tony Luck , James Morse , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 20/20] EDAC, mc: Create new function edac_inc_csrow() Message-ID: <20191109083210.69d36aa5@kernel.org> In-Reply-To: <20191106093239.25517-21-rrichter@marvell.com> References: <20191106093239.25517-1-rrichter@marvell.com> <20191106093239.25517-21-rrichter@marvell.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, 6 Nov 2019 09:33:46 +0000 Robert Richter escreveu: > Have a separate function to count errors in csrow/channel. This better > separates code and reduces the indentation level. No functional > changes. > > Signed-off-by: Robert Richter Reviewed-by: Mauro Carvalho Chehab > --- > drivers/edac/edac_mc.c | 40 +++++++++++++++++++++++++--------------- > 1 file changed, 25 insertions(+), 15 deletions(-) > > diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c > index 93eac968678e..34b740036ffc 100644 > --- a/drivers/edac/edac_mc.c > +++ b/drivers/edac/edac_mc.c > @@ -1045,6 +1045,26 @@ static struct mem_ctl_info *error_desc_to_mci(struct edac_raw_error_desc *e) > return container_of(e, struct mem_ctl_info, error_desc); > } > > +static void edac_inc_csrow(struct edac_raw_error_desc *e, int row, int chan) > +{ > + struct mem_ctl_info *mci = error_desc_to_mci(e); > + u16 count = e->error_count; > + enum hw_event_mc_err_type type = e->type; > + > + if (row < 0) > + return; > + > + edac_dbg(4, "csrow/channel to increment: (%d,%d)\n", row, chan); > + > + if (type == HW_EVENT_ERR_CORRECTED) { > + mci->csrows[row]->ce_count += count; > + if (chan >= 0) > + mci->csrows[row]->channels[chan]->ce_count += count; > + } else { > + mci->csrows[row]->ue_count += count; > + } > +} > + > void edac_raw_mc_handle_error(struct edac_raw_error_desc *e, > struct dimm_info *dimm) > { > @@ -1214,22 +1234,12 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, > chan = -2; > } > > - if (any_memory) { > + if (any_memory) > strcpy(e->label, "any memory"); > - } else { > - edac_dbg(4, "csrow/channel to increment: (%d,%d)\n", row, chan); > - if (p == e->label) > - strcpy(e->label, "unknown memory"); > - if (type == HW_EVENT_ERR_CORRECTED) { > - if (row >= 0) { > - mci->csrows[row]->ce_count += error_count; > - if (chan >= 0) > - mci->csrows[row]->channels[chan]->ce_count += error_count; > - } > - } else > - if (row >= 0) > - mci->csrows[row]->ue_count += error_count; > - } > + else if (!*e->label) > + strcpy(e->label, "unknown memory"); > + > + edac_inc_csrow(e, row, chan); > > /* Fill the RAM location data */ > p = e->location; Cheers, Mauro