From patchwork Wed Sep 20 19:10:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13393263 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9BD6AC04FED for ; Wed, 20 Sep 2023 19:12:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bl0WBvyahnXObEtE5Kkg4As4/t5DvK8cCSXIRhXifCI=; b=LXn1QV+Ts7xena RnD4xpzyAHOuvxaVOFXLJO+/HAaJMLeygfxoOThu7r9hVfSBkUsUfXXSeZbOgwliUqfsNMBirHkJp K9Cp7QQLokS4ppSVi5UaLvYfvREiBXoQUrcPWzywnDND0eDWc7SBSdnReloO5iMQErhU1qFWX708b OIBQMbu+n/EwT0Ue9OAq7cDxng/WfvsPHN/65OQhGZSKcWuje5ZZuP0GadLnJ++KuT9En4ybWEjp8 dlKoc/EbFRxTHbXxOb3EE7g8p/3w/lZAZ10wnNJC4EgCq/t6G8dix83ADwusUmjBfasBzVkQh8nBr j9Z5FjwW0TyMqVTET4cg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qj2ci-003xcU-0r; Wed, 20 Sep 2023 19:12:32 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qj2cM-003xHh-1Z for linux-arm-kernel@lists.infradead.org; Wed, 20 Sep 2023 19:12:12 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-503056c8195so384094e87.1 for ; Wed, 20 Sep 2023 12:12:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695237126; x=1695841926; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AS2hrfFTOSsFmGDoeV3Bz2HwRNoskotCiooG8ue6RgE=; b=bV4koZX3Ed+abKx5hC1qKlfJ3p31LUiD6iZYU7Gpi2Ul2Z7wMDUCXsIFtdUCanYqJ6 wlv36WFr8cz8iPdB4dfa8SVxZzP0c3bIuThdFkhEUqiuV76Zy15ygJja8Cxnc5kmkD8X zB5xlEjdb/8/Tuo/Fzs0nCXVRv0A+KN+dOSHDMHKfxIbazrbRs72RsrIdp06ofg2WfmR ExWRnK93bHxIM8ezv6QSauH8oKYaVIxwuMl7aQvqGf+PCA8xzs6/qbcJ+KyDuWEfj/ZU Z2qrvZxD3i/uBMdHYdAfW7mEg0mw+nbAC69H5rvSMM6XGi7msCsuTlMqV+NkoYWB5Ocr FyhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695237126; x=1695841926; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AS2hrfFTOSsFmGDoeV3Bz2HwRNoskotCiooG8ue6RgE=; b=gikDkkQ9XIL5Dk0Lk1YQVUKh7pwpYRGDFmSvMa68QjzGx4rI/xs/65/xoCApIAuQb8 hlgxnwDU1gzOCcwANPbc02SvEx9pcGV9aItoQY9LJf2rYvU3X39uzv3XKwrkq5Bay22A Acf0cuYynM03FRisJW789adsPQ+upk4XMaXzjbg7poEEtlU4B8KBH0OSqIhAUcY3aARy TU5nNHhK7SEVAbH8jNijnDWU4Ds4DWOSnNtnFKy3RobzP9DCSPH+dCmgdbf4/Yi32yY+ nrLYXsMOOvm163h7KQ996SSuVDy+KdTwV7lDsC6yc773+aM56KOCCxhixOBXLA1PoRZS 5lZQ== X-Gm-Message-State: AOJu0YxbW00TvCCI0JzUgsfs2DZxsa7Yt4FQC3r9qPT6k+a/oOyfnPyf rAMq013gWu4Hv7VF3VN/Uh8= X-Google-Smtp-Source: AGHT+IHtZRlHJF1UKfZZ9A2WRkhKJlTB+mjHNA6pQTzuDm8U/J3P8nZXdhnOAe2qvMxWX86rO6G3ZQ== X-Received: by 2002:a19:9158:0:b0:503:17c0:5374 with SMTP id y24-20020a199158000000b0050317c05374mr2574701lfj.65.1695237126561; Wed, 20 Sep 2023 12:12:06 -0700 (PDT) Received: from localhost ([85.26.234.43]) by smtp.gmail.com with ESMTPSA id t9-20020a19ad09000000b005032ebff21asm852742lfc.279.2023.09.20.12.12.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 12:12:06 -0700 (PDT) From: Serge Semin To: Michal Simek , Alexander Stein , Borislav Petkov , Tony Luck , James Morse , Mauro Carvalho Chehab , Robert Richter , Lei Wang , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Egor Martovetsky Cc: Serge Semin , Punnaiah Choudary Kalluri , Dinh Nguyen , Arnd Bergmann , Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH v4 15/20] EDAC/mc: Re-use generic unique MC index allocation procedure Date: Wed, 20 Sep 2023 22:10:39 +0300 Message-ID: <20230920191059.28395-16-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230920191059.28395-1-fancer.lancer@gmail.com> References: <20230920191059.28395-1-fancer.lancer@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230920_121210_547826_269E7378 X-CRM114-Status: GOOD ( 16.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The EDAC drivers locally maintaining a statically defined memory-controllers counter don't care much about the MC index assigned as long as it's unique so the EDAC core perceives it. Convert these drivers to be using the generic MC index allocation procedure recently added to the EDAC core. Signed-off-by: Serge Semin --- Changelog v4: - Initial patch introduction. --- drivers/edac/dmc520_edac.c | 4 +--- drivers/edac/pasemi_edac.c | 5 +---- drivers/edac/ppc4xx_edac.c | 5 +---- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/edac/dmc520_edac.c b/drivers/edac/dmc520_edac.c index 1fa5ca57e9ec..abd73ed0ad89 100644 --- a/drivers/edac/dmc520_edac.c +++ b/drivers/edac/dmc520_edac.c @@ -173,8 +173,6 @@ struct dmc520_edac { int masks[NUMBER_OF_IRQS]; }; -static int dmc520_mc_idx; - static u32 dmc520_read_reg(struct dmc520_edac *pvt, u32 offset) { return readl(pvt->reg_base + offset); @@ -517,7 +515,7 @@ static int dmc520_edac_probe(struct platform_device *pdev) layers[0].size = dmc520_get_rank_count(reg_base); layers[0].is_virt_csrow = true; - mci = edac_mc_alloc(dmc520_mc_idx++, ARRAY_SIZE(layers), layers, sizeof(*pvt)); + mci = edac_mc_alloc(EDAC_AUTO_MC_NUM, ARRAY_SIZE(layers), layers, sizeof(*pvt)); if (!mci) { edac_printk(KERN_ERR, EDAC_MOD_NAME, "Failed to allocate memory for mc instance\n"); diff --git a/drivers/edac/pasemi_edac.c b/drivers/edac/pasemi_edac.c index 1a1c3296ccc8..afebfbda1ea0 100644 --- a/drivers/edac/pasemi_edac.c +++ b/drivers/edac/pasemi_edac.c @@ -57,8 +57,6 @@ #define PASEMI_EDAC_ERROR_GRAIN 64 static int last_page_in_mmc; -static int system_mmc_id; - static u32 pasemi_edac_get_error_info(struct mem_ctl_info *mci) { @@ -203,8 +201,7 @@ static int pasemi_edac_probe(struct pci_dev *pdev, layers[1].type = EDAC_MC_LAYER_CHANNEL; layers[1].size = PASEMI_EDAC_NR_CHANS; layers[1].is_virt_csrow = false; - mci = edac_mc_alloc(system_mmc_id++, ARRAY_SIZE(layers), layers, - 0); + mci = edac_mc_alloc(EDAC_AUTO_MC_NUM, ARRAY_SIZE(layers), layers, 0); if (mci == NULL) return -ENOMEM; diff --git a/drivers/edac/ppc4xx_edac.c b/drivers/edac/ppc4xx_edac.c index 046969b4e82e..2b3d66bd0c28 100644 --- a/drivers/edac/ppc4xx_edac.c +++ b/drivers/edac/ppc4xx_edac.c @@ -1214,7 +1214,6 @@ static int ppc4xx_edac_probe(struct platform_device *op) const struct device_node *np = op->dev.of_node; struct mem_ctl_info *mci = NULL; struct edac_mc_layer layers[2]; - static int ppc4xx_edac_instance; /* * At this point, we only support the controller realized on @@ -1265,7 +1264,7 @@ static int ppc4xx_edac_probe(struct platform_device *op) layers[1].type = EDAC_MC_LAYER_CHANNEL; layers[1].size = ppc4xx_edac_nr_chans; layers[1].is_virt_csrow = false; - mci = edac_mc_alloc(ppc4xx_edac_instance, ARRAY_SIZE(layers), layers, + mci = edac_mc_alloc(EDAC_AUTO_MC_NUM, ARRAY_SIZE(layers), layers, sizeof(struct ppc4xx_edac_pdata)); if (mci == NULL) { ppc4xx_edac_printk(KERN_ERR, "%pOF: " @@ -1303,8 +1302,6 @@ static int ppc4xx_edac_probe(struct platform_device *op) goto fail1; } - ppc4xx_edac_instance++; - return 0; fail1: