From patchwork Thu Feb 22 18:13:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 204951 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp124749dyb; Thu, 22 Feb 2024 10:20:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCULLRD+jQDhB7O+VPpGAIL5oKgzqJepY4lnMJloZ9pepgWOLY5p1O3BxuiIjfe3fK3TvUKGG9X8EmWhr0o2TiLXN9oeAA== X-Google-Smtp-Source: AGHT+IH+oqlgQp2flLhKy+QDm6Ih5U5BQwjekmKaqSP/I93NmY++ogMh85yR1+xGaS1gpkCIVBmC X-Received: by 2002:a05:6a00:9a8:b0:6e4:890a:7af with SMTP id u40-20020a056a0009a800b006e4890a07afmr8305318pfg.26.1708626046281; Thu, 22 Feb 2024 10:20:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708626046; cv=pass; d=google.com; s=arc-20160816; b=Cm3ZryGAIOYWvvl+bTk6hI2GqdHQbmFEYoa5euRA+R93K3rWV4/zpGUFWG9D0DmyoU dB0QFAm4rOJdI3USF3L2PYYAZaWB8M1BTFbcNybLlwHMqD7QbbU544CT+n64dtI6O0it 05fwF3T/MSSnWKC5ddqBL6XPdWKgPonrdHSfzJnQucex4FywEstVUGoMctppEJTwJUtL DCBC7NN8bV/PXeV3/E0f7Cbc3qdr0jvv3IVDyS0uvFejm8RMrS4tTjSEzU8C2XrWOvt0 63o3TgQ6wmAHfMMpqJs+cNKd2oSK1BUuRHi3pxDsrs6jG+tlmn3kD1sriVUZJBAwLRVn 18rw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=0nAXuUIOjmGqCty40Smyp4CQdr7UcxvXuJwOvkK+QNc=; fh=dz9cC33cOVUgogPKWTdogQZJs805gxCXirw3UQwnscM=; b=Zc1MwaBfq1YhbV2iOyUl8SV0O/zAZdlQQ8SQ+WjlqXcRxXaWorJjVPyudPDLZ7mgW2 pJ24Mr0tC81u9wNMk/b7jTf/rUMe230YkfV5D4+fFHYhzGnc07hmRCuOWNmbNb28jc4x 15goWqT1q/MIeZGKGLq6ikCg/ldQb9AcoLDuT19dG8BFmHyUnjsUAHF6SASZGhfsY0Kt M+o9nx0+yRcIM+I9sSkpPhvIKSvzkgeEwX9GbBGViboJ8OlV4f087M7xPVVMtHKYY8wr GtqNUkPgyLH5W7qgHXyxSLg6g+lPcwj0LPMuxXJ16zlCOdPE23S5dLkxRZWCB7OW8L8+ gAgA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FeJ911FL; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-77078-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77078-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d24-20020aa78158000000b006dfde776206si10379721pfn.75.2024.02.22.10.20.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 10:20:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77078-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FeJ911FL; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-77078-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77078-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 015282814D6 for ; Thu, 22 Feb 2024 18:20:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A8E2F548F4; Thu, 22 Feb 2024 18:14:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FeJ911FL" Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98A4E15F311; Thu, 22 Feb 2024 18:14:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708625691; cv=none; b=m7n5PviT5Uzpw/s4swrmiOHWgkrmc/ll0vlUCQtGzQrXirQxyOGYl45bJ2pz5hIYcXVF8OLpm1cy4TR0MqjeqZCWtpPsXLuN4td0leQeonZEXUO22GHIKu7JUZ2yEXiscQCiSiIeerohE4BvGriS0DTDNmLlK/GqpuNB7DgYr6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708625691; c=relaxed/simple; bh=mt9UynXI2+qgvIzJYiFKClBsAzOssYbzQ3BkuR7uDn8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=R/pSpWm9DofNp+raKfTcfK4kqqT/GQRoanwzTfSr0XcOoj4/2TBGYBLc/TtbXgoq0aqaGbVYN+Qxtm36ZKJ4sykCjGcf/fI/IM/UitEN9+1bdwKMdYw4VP7/Ca/7RVTuFwmhR4uAEw7ABFmwlewR+mnfKLja6Wbj8XHpzXuNa+o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FeJ911FL; arc=none smtp.client-ip=209.85.208.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2d1094b5568so924631fa.1; Thu, 22 Feb 2024 10:14:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708625688; x=1709230488; darn=vger.kernel.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=0nAXuUIOjmGqCty40Smyp4CQdr7UcxvXuJwOvkK+QNc=; b=FeJ911FLahQ/GPLrLjq5p6B7fWPlUXj1O9cNttv0L9ZFQ1Ez++LuSfYROZEytQypnt MlUZDUg/UF9c5nCvTPI8VBpPHdPftPiR/NS6+NbDedKmNkWC5ofjdUQ88I8qydVRF3LU 3rUo1ml7L2xlLITADhzAmsBVJGz3pZWw7T6hRE2rqlmi7ha8KAt5q4VOM71sP1k2y8p+ muOBAHdFlMgDvSpqVqJRwEaPDDBXN08TgaAj5GIZXzNVD8g0nELAchMld3Ghz7QzDmjX hv0TUiwSyxSGa0NhBnsy38NeQ15e/AqFwea9Ye4l8fQkwywXzdCWSLhoyoRNmbT0Yajh AANQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708625688; x=1709230488; 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=0nAXuUIOjmGqCty40Smyp4CQdr7UcxvXuJwOvkK+QNc=; b=gGrKt1cB+2tK//OvJLo/ptmR1OyknWlYXmqIQMponhci/hYjr3NvtU6YPkj7l1b0JR 14Xf9aoBPU0BNhSvjpLzPB7fNRzYsEAMHg0ORqxR0gcRF8f5AqMMdrbSeKGGSiL+m7UQ xb50e7FRnY5ZzISB6GqRWu6F7TwzpZe2CVv1Oj/+Y6Cn3K8u6TW3jAtyk0a74TjJLlpm VEIr9r52I+661QSVWH/AQElyXBM54nm9p6Op8YNtoDLOtY9TrcE77R7OGAPi/QWpXwxy fXovJpXa9eF3PWHBr8v+sNoFLEc0IU2cDsWOKH70g6jHafBOVH1Jn1DuEYNXWiLM6A37 iVfQ== X-Forwarded-Encrypted: i=1; AJvYcCU9bltpQjaTpqLNyq228ghYWHTNvXNRpGRENhzcVrUqOLZD/hWUZa0HAWAHICwQ5FHIfBbpiOfEB/7bjfW68RKEjyiLpQwnU3Newbszg45aa1axT+jcdIciVPIe33apakxJXDtCm47aGg== X-Gm-Message-State: AOJu0YyOfDcm62MnermVRliMABrgMoN+DEshUIg4WhlSPurQo+xq8cDv UyUvXcqUwisEG55YdJ+V0JGt9u6nGIcpCV9M45jVGDH+aMd7EcuA X-Received: by 2002:a2e:a272:0:b0:2d2:4388:63fc with SMTP id k18-20020a2ea272000000b002d2438863fcmr6085862ljm.44.1708625687765; Thu, 22 Feb 2024 10:14:47 -0800 (PST) Received: from localhost ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id bd7-20020a05651c168700b002d24c720b16sm969025ljb.101.2024.02.22.10.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 10:14:47 -0800 (PST) From: Serge Semin To: Michal Simek , Alexander Stein , Borislav Petkov , Tony Luck , James Morse , Mauro Carvalho Chehab , Robert Richter , Lei Wang , Egor Martovetsky , Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Aneesh Kumar K.V" , "Naveen N. Rao" 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 v5 15/20] EDAC/mc: Re-use generic unique MC index allocation procedure Date: Thu, 22 Feb 2024 21:13:00 +0300 Message-ID: <20240222181324.28242-16-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240222181324.28242-1-fancer.lancer@gmail.com> References: <20240222181324.28242-1-fancer.lancer@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791624264761443984 X-GMAIL-MSGID: 1791624264761443984 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 4e30b989a1a4..93734a97a67b 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 1eea3341a916..06d267d40a6a 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: