Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp543316pxb; Tue, 19 Oct 2021 08:06:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkoxWOW63aRrBDymplVeZHTMsHZeyfCmuEngcym2EbCgAa//2NoAfBzsXLS0t1LyDFs3Ja X-Received: by 2002:a17:906:c317:: with SMTP id s23mr38677212ejz.127.1634655961606; Tue, 19 Oct 2021 08:06:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634655961; cv=none; d=google.com; s=arc-20160816; b=ojLaDAaV+LFmmnAlIt9GmJ8QJ2Rkfi3RUN0mbsSuxyNQfdeocBc2Ipfl+fb0ammE+I QruxUe+x5H/rSwhAXXvtBqhJ7WLDFBy9+6TRcRcdcOWyxJzNM/BD2W6v1T4EdhZlEhs9 te/a6KtRQq3lFCUCSj7uOoNqsnpHAjKRg0awuSa+64uuutdoHOWw75mla6RiE2HovVFL +ND8FavrSlXYGt0p1RPUmI1fgVEsDeXzEra4e+bivBD72iy7avACOndD4jwkdwAgJErm dyue7AkO+riqAAI3rQ6A5BHz4zO0o3ejxOAp/NGlkov8LPbcT4PMj3tEDHL/LCOySUQ+ SAlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=c9FVBAMFfQzb1NNoRXViROAHe2Rli8lyTRP8LLMJCuQ=; b=DXks8f1Y+M8qbgIfpI6iaSeThLXk0d7CzrFJGVEFdhSw4BpusyZt+jVrvkrcbApUgG 25zMekoKGiUES1oHG1Q/tjaAWk2RNsJLFZpY8rXhiV9HAxbXVK+q6vL+eHdndAizfz2E 1xQEg7olgHqmbBWNYvei51tZW+4M3DW3xUjT1H1L5ii/6nZFtKNOF3eo0BWWhuba2gwB F99TkfeOQcDFLff9z/L6iZ731++GSJwXv7TZMeswIXD3qj+R7zuA3w9a8gjIzlmx9fQO LLkXWOef54OlOSChb6LbVWl0X1K8x1Ikt1cudnd91lgHpiGTqcVbapYH6puc7v+Fl2ei uCyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gz15si27238001ejc.141.2021.10.19.08.05.24; Tue, 19 Oct 2021 08:06:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232752AbhJSPCR (ORCPT + 99 others); Tue, 19 Oct 2021 11:02:17 -0400 Received: from hostingweb31-40.netsons.net ([89.40.174.40]:49015 "EHLO hostingweb31-40.netsons.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232631AbhJSPCK (ORCPT ); Tue, 19 Oct 2021 11:02:10 -0400 Received: from [77.244.183.192] (port=62116 helo=melee.fritz.box) by hostingweb31.netsons.net with esmtpa (Exim 4.94.2) (envelope-from ) id 1mcqap-00D5qd-Mb; Tue, 19 Oct 2021 16:59:55 +0200 From: Luca Ceresoli To: linux-kernel@vger.kernel.org Cc: Luca Ceresoli , Lee Jones , Rob Herring , Alessandro Zummo , Alexandre Belloni , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Wim Van Sebroeck , Guenter Roeck , devicetree@vger.kernel.org, linux-rtc@vger.kernel.org, linux-watchdog@vger.kernel.org, Chiwoong Byun , Laxman Dewangan , Randy Dunlap Subject: [PATCH v2 4/9] rtc: max77686: remove unused code to read in 12-hour mode Date: Tue, 19 Oct 2021 16:59:14 +0200 Message-Id: <20211019145919.7327-5-luca@lucaceresoli.net> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019145919.7327-1-luca@lucaceresoli.net> References: <20211019145919.7327-1-luca@lucaceresoli.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - hostingweb31.netsons.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lucaceresoli.net X-Get-Message-Sender-Via: hostingweb31.netsons.net: authenticated_id: luca+lucaceresoli.net/only user confirmed/virtual account not confirmed X-Authenticated-Sender: hostingweb31.netsons.net: luca@lucaceresoli.net X-Source: X-Source-Args: X-Source-Dir: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The MAX77714 RTC chip is explicitly set to 24-hour mode in max77686_rtc_probe() -> max77686_rtc_init_reg() and never changed back to 12-hour mode. Accordingly info->rtc_24hr_mode is set to 1 in the same place and never modified later, so it is de facto a constant. Yet there is code to read 12-hour time, which is unreachable. Remove the unused variable, the unreachable code to manage 12-hour mode and the defines that become unused due to the above changes. Signed-off-by: Luca Ceresoli Reviewed-by: Krzysztof Kozlowski --- Changes in v2: - remove the now-unused defines too (Alexandre Belloni) - improve the commit message --- drivers/rtc/rtc-max77686.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c index 7e765207f28e..5c64d08c0732 100644 --- a/drivers/rtc/rtc-max77686.c +++ b/drivers/rtc/rtc-max77686.c @@ -34,9 +34,6 @@ #define RTC_UDR_MASK BIT(RTC_UDR_SHIFT) #define RTC_RBUDR_SHIFT 4 #define RTC_RBUDR_MASK BIT(RTC_RBUDR_SHIFT) -/* RTC Hour register */ -#define HOUR_PM_SHIFT 6 -#define HOUR_PM_MASK BIT(HOUR_PM_SHIFT) /* RTC Alarm Enable */ #define ALARM_ENABLE_SHIFT 7 #define ALARM_ENABLE_MASK BIT(ALARM_ENABLE_SHIFT) @@ -99,7 +96,6 @@ struct max77686_rtc_info { int rtc_irq; int virq; - int rtc_24hr_mode; }; enum MAX77686_RTC_OP { @@ -278,13 +274,7 @@ static void max77686_rtc_data_to_tm(u8 *data, struct rtc_time *tm, tm->tm_sec = data[RTC_SEC] & mask; tm->tm_min = data[RTC_MIN] & mask; - if (info->rtc_24hr_mode) { - tm->tm_hour = data[RTC_HOUR] & 0x1f; - } else { - tm->tm_hour = data[RTC_HOUR] & 0x0f; - if (data[RTC_HOUR] & HOUR_PM_MASK) - tm->tm_hour += 12; - } + tm->tm_hour = data[RTC_HOUR] & 0x1f; /* Only a single bit is set in data[], so fls() would be equivalent */ tm->tm_wday = ffs(data[RTC_WEEKDAY] & mask) - 1; @@ -662,8 +652,6 @@ static int max77686_rtc_init_reg(struct max77686_rtc_info *info) data[0] = (1 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT); data[1] = (0 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT); - info->rtc_24hr_mode = 1; - ret = regmap_bulk_write(info->rtc_regmap, info->drv_data->map[REG_RTC_CONTROLM], data, ARRAY_SIZE(data)); -- 2.25.1