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: 13567860 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 26B13C48BF8 for ; Thu, 22 Feb 2024 18:18:08 +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=Ywn4c1jAL8Pp1EkIADDYj3y0stXSvyp2NGmSy5lKzzk=; b=lCGCImXantYoV7 4iGeA2r4CYwRlEHB89lwA281bLKWQ/x2fG/UJf1HPrv6uukSPk7l5aLbyICv5nmKQ0E4HZUElYNjb xd+kcpUxVI8yFk4k0cyVk4LTI+pdJDtN/vmeiGFvLnBMeJYMWhnPN7cxkP4pCicMAt0kS4bLIAt2l 8iG3FYmXnRPCuKpa2CAb28TUq9YaI8mVj4paqrZTIgMg2iueO9JAQi3sWHFNBbBF70Q1a3kOQD8cC zXpr7+hgqLh5OYNrtmVGyJGFFZ6NIfKDH85BAAUomGXfIFvfI95WAUxWafkdEB9tpELcEpyEoSPM2 xto2fSd859i5sLex/dMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdDdp-00000005yI7-1Fym; Thu, 22 Feb 2024 18:17:53 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdDaz-00000005xBU-3ebr for linux-arm-kernel@lists.infradead.org; Thu, 22 Feb 2024 18:15:04 +0000 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2d0cdbd67f0so844081fa.3 for ; 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=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=0nAXuUIOjmGqCty40Smyp4CQdr7UcxvXuJwOvkK+QNc=; b=LjW9v/RRRWwEEq9RB1cw3yZbNSboXMwFd2HavFxKELTKNkQUwlVq8f2Jk2bCNoMwCy F7z/qHN3p8HUS59+yDmgBQn1yUt5m6j7ansUsQyZJvl5DA2CWnEqBc8R7TRfgy2dXzX5 2xH9838sVvOQ/4eZ81BdSGQi8od2Dh2Nbz8ifvVf8TmdaIUarwrVRBqlRjBMJT7pT8Ow 0GHWp1Q5EM8S5ST+j+8z/BzwH45xxJMjfYL/rtOojf22I7e04QlD8hhQvf2Uidi2WmYc CpfVKJEe+PTdv/sqHb4aY1PRqoZDVkWHks1HaDewpH3h101Q9a53rokfKSbwoqo1WLQY ZhyA== 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=fqV9YF6KI17XvvYSuF9PDuwATLze/I9p5voGjr8P1haHimQGh13L0JlaGzcG0QQngr KG0cB28vIlvmVGHlUn8XrdPNaMYKUZLLSt7CaZQKLFjznANVnWnGAu5EVQb1l2d+om/p kaN/C8ae4O85RM6Z4JDvDjXoExbDlsB4TZbZCwvqI0chaEBSWryhOWw8FL/8wGLUTwAa Ls5CgMB2BjTp9WL0KlSXO7AVxSe30FPC1p7M5vwj29CKFuaeHem3IDd3ZCRHofAEfyk4 QyEXcKx/sKad7s/In34YgMjKkXg8K52zikCydYFvq8jHQiQrWD8Wa1ef/MpOqoLmEicL hMkQ== X-Forwarded-Encrypted: i=1; AJvYcCXEDy+Tda++5ueMS4H0rqZ+cU1C3vbCFial1c6nKZVcGRc9I1HP7rrh2Aq/+J9pOoq8c4Iv/+qrfP8mBOR5hHDqiQKneSdTI5zxGo7WOnG9tcqwsPc= X-Gm-Message-State: AOJu0YwbxLbDeJ6xLTjddlS1bM/52PT0Aruqq6Y4qKYvBod/IoMiTQbG 3TDZrgCiQvrPN65xojNsgwYLyKdBXxwt3+h3D/xUcqEACm/24yMq X-Google-Smtp-Source: AGHT+IHuWrnLpg4juM7jhgCVO9zVn6Qc74sw3WuVEmtL6YWr4BWGK20vM8RFfEGoQoVZiRd12s1KiA== 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240222_101458_414654_3C16E798 X-CRM114-Status: GOOD ( 16.13 ) 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 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: