From patchwork Thu Sep 15 10:45:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 76263 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp2366846qgf; Thu, 15 Sep 2016 03:43:43 -0700 (PDT) X-Received: by 10.66.120.143 with SMTP id lc15mr13196177pab.139.1473936222998; Thu, 15 Sep 2016 03:43:42 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a14si38786204pfc.101.2016.09.15.03.43.42; Thu, 15 Sep 2016 03:43:42 -0700 (PDT) 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=pass header.i=@linaro.org; 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=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933961AbcIOKne (ORCPT + 27 others); Thu, 15 Sep 2016 06:43:34 -0400 Received: from mail-qk0-f177.google.com ([209.85.220.177]:34375 "EHLO mail-qk0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764569AbcIOKn1 (ORCPT ); Thu, 15 Sep 2016 06:43:27 -0400 Received: by mail-qk0-f177.google.com with SMTP id h8so42679079qka.1 for ; Thu, 15 Sep 2016 03:43:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=P5iqTCcK1+/UvDOw8w377k+SJfh6eUnhEuv6j6+Bq+I=; b=QITwSVtLK5MP85UH+xzmZ5RVNFppNqUMPABLetW9MFekhPI+duXvrGIs4R8J+dEeoI OIjkPDdAZg9dO8zGCVQkg/g7v4vkRnnXZB1T4KQ2WpY9/5jlQuOGHCFoqIXFazmwna9s afjnIOnrJrR+0GWXYlJtgDkbV1dqzcqFYuUuY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=P5iqTCcK1+/UvDOw8w377k+SJfh6eUnhEuv6j6+Bq+I=; b=Jclh+F4eugPfV/MYn++oHpkeyL8jt0aos4JlfS8dnPvVpZjQUQJhceDSi6zYT4lHGS V8j6/dlkGNd6maoqwj62EyPI1XkeNf7u91xdeN0dBfYojQcVNo2o4AHWNd78jkIT1yog YnjZTTYrYQmYyFTrVIuXhPGN026I0ol2/VH6xHL7U6PGkEbvDjK0mX6C6sFoHYnRymSi +eIl/3SJGgSENd+pXGAMA7Ef/FIKzrpPSTxS+ifwGQc6zGvk9gdrJ+XA9OvNOA/1KbKS J6gm9nec2vX8osATmqbGufJSxILqzpJVE4Xtb8DtSWGg6+fnYqODl5Jvw8KCTEOeuaMO wX9g== X-Gm-Message-State: AE9vXwPMZ1ld99jB738Rg3eKYMQcrEn7Guk5T6yx50h4TMgW2tIe63gLhk/7mQy+KOgShMGu X-Received: by 10.194.68.99 with SMTP id v3mr7972506wjt.49.1473936206319; Thu, 15 Sep 2016 03:43:26 -0700 (PDT) Received: from dell.home (host31-51-85-248.range31-51.btcentralplus.com. [31.51.85.248]) by smtp.gmail.com with ESMTPSA id e2sm2861231wjn.11.2016.09.15.03.43.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Sep 2016 03:43:25 -0700 (PDT) From: Lee Jones To: linus.walleij@linaro.org, tony@atomide.com, linux-omap@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/7] mfd: ab8500-debugfs: Prevent initialised field from being over-written Date: Thu, 15 Sep 2016 11:45:16 +0100 Message-Id: <20160915104521.14286-3-lee.jones@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160915104521.14286-1-lee.jones@linaro.org> References: <20160915104521.14286-1-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Due to the lack of parity in the way array fields have been named/ numbered, a mistake was made where more debug fields were declared than actually existed. In doing so, 2 fields were added, which although unclear, were already declared in the array. The result was that the latter declarations trashed the former ones. This patch places the array back in the correct order and removes the offending NULL entries. While we're at it, let's ensure this doesn't happen again by naming each field properly and add a new *_LAST define to describe how many fields there should be. Signed-off-by: Lee Jones --- drivers/mfd/ab8500-debugfs.c | 50 ++++++++++++++++----------------------- include/linux/mfd/abx500/ab8500.h | 2 ++ 2 files changed, 23 insertions(+), 29 deletions(-) -- 2.9.3 diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c index 0aecd7b..6c913c4 100644 --- a/drivers/mfd/ab8500-debugfs.c +++ b/drivers/mfd/ab8500-debugfs.c @@ -153,14 +153,14 @@ static struct hwreg_cfg hwreg_cfg = { #define AB8500_NAME_STRING "ab8500" #define AB8500_ADC_NAME_STRING "gpadc" -#define AB8500_NUM_BANKS 24 +#define AB8500_NUM_BANKS AB8500_DEBUG_FIELD_LAST #define AB8500_REV_REG 0x80 static struct ab8500_prcmu_ranges *debug_ranges; static struct ab8500_prcmu_ranges ab8500_debug_ranges[AB8500_NUM_BANKS] = { - [0x0] = { + [AB8500_M_FSM_RANK] = { .num_ranges = 0, .range = NULL, }, @@ -315,7 +315,7 @@ static struct ab8500_prcmu_ranges ab8500_debug_ranges[AB8500_NUM_BANKS] = { }, }, }, - [0x9] = { + [AB8500_RESERVED] = { .num_ranges = 0, .range = NULL, }, @@ -386,24 +386,6 @@ static struct ab8500_prcmu_ranges ab8500_debug_ranges[AB8500_NUM_BANKS] = { }, }, }, - [AB8500_DEVELOPMENT] = { - .num_ranges = 1, - .range = (struct ab8500_reg_range[]) { - { - .first = 0x00, - .last = 0x00, - }, - }, - }, - [AB8500_DEBUG] = { - .num_ranges = 1, - .range = (struct ab8500_reg_range[]) { - { - .first = 0x05, - .last = 0x07, - }, - }, - }, [AB8500_AUDIO] = { .num_ranges = 1, .range = (struct ab8500_reg_range[]) { @@ -463,19 +445,29 @@ static struct ab8500_prcmu_ranges ab8500_debug_ranges[AB8500_NUM_BANKS] = { }, }, }, - [0x11] = { - .num_ranges = 0, - .range = NULL, + [AB8500_DEVELOPMENT] = { + .num_ranges = 1, + .range = (struct ab8500_reg_range[]) { + { + .first = 0x00, + .last = 0x00, + }, + }, }, - [0x12] = { - .num_ranges = 0, - .range = NULL, + [AB8500_DEBUG] = { + .num_ranges = 1, + .range = (struct ab8500_reg_range[]) { + { + .first = 0x05, + .last = 0x07, + }, + }, }, - [0x13] = { + [AB8500_PROD_TEST] = { .num_ranges = 0, .range = NULL, }, - [0x14] = { + [AB8500_STE_TEST] = { .num_ranges = 0, .range = NULL, }, diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h index 9475fee..d33c245 100644 --- a/include/linux/mfd/abx500/ab8500.h +++ b/include/linux/mfd/abx500/ab8500.h @@ -63,6 +63,8 @@ enum ab8500_version { #define AB8500_STE_TEST 0x14 #define AB8500_OTP_EMUL 0x15 +#define AB8500_DEBUG_FIELD_LAST 0x16 + /* * Interrupts * Values used to index into array ab8500_irq_regoffset[] defined in