Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1062726pxm; Wed, 23 Feb 2022 17:08:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJydXiTbXAg8SeKKtTsRQwTDzQEICpWmD/qbZhY8ab2hOcC+kPuucNsJ03MFGaIeIlw8ePYk X-Received: by 2002:a63:4b07:0:b0:373:e921:ca4e with SMTP id y7-20020a634b07000000b00373e921ca4emr394728pga.58.1645664916749; Wed, 23 Feb 2022 17:08:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645664916; cv=none; d=google.com; s=arc-20160816; b=qdV23UGbKnO5kQW8XesJOqmdPv2H+YCrq1Q/wyZFfsmTbcTzmbbBzYP2bj1y0KuRtC E7brIQhgEnPWgy8+KNvrteQDf/dbE1aGj8n2IRTdAl/GjUV8glRHD+Rf/VjSTDFPLgCb N4Fzw7BNPxZGVm/rByROjuGmB3JjpdjMatTGltRbKJEIBpGajbnO1y8Ox0IC/xX7WFSI p+5+dPrY1zV3y8Mk7Vowtg8NFbhG6ksAd+5fCxgTtsXEdpt6a+/2QLLCp4xG+/3FTtjT AjAG5QecimIuBbaoTn+svOUXoejTcSfsEX+kJf8Wc+x3flr1rw5xnQOv6yQ/Z+xeZwEW LL8A== 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=qU8YwFzSYn7Lp+TDV/Y7nVJDyY1fi45BkT5LQ+L1/r8=; b=LkW/2ULHsLdiBI/YYp5XGwhwVul+Omot8eeWGXK4UKljVczHwF/UM4r30Uji0fn4kG 7Hh4X2NIzU/+eKPtwEcHlWPZAGwM47eR884whCplocl5J2+X01t8MpKecp9IOWX035i/ VOpGFitodBRceHWw75c+ls8ORKK9ThjQOUzpJ3UyJzRKw+v7nWHgOC/NmnYD07eosIVM yLAGKWfAxkeCNMiB/MLrkXb+mLUqc31n8jjQFqab4aHr31CapQD3E2BxOlcsKDKCnG/n ca0kSvST5W9TaMUJ/0CPWTzPk2ePxIAmhNfwoBO7cYvSMTH/fmrWXXQmpubY+jT+wTVV f/HA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id r10si1125066pgb.354.2022.02.23.17.08.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 17:08:36 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D9243F543B; Wed, 23 Feb 2022 16:56:48 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243678AbiBWR76 (ORCPT + 99 others); Wed, 23 Feb 2022 12:59:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243660AbiBWR7y (ORCPT ); Wed, 23 Feb 2022 12:59:54 -0500 Received: from hostingweb31-40.netsons.net (hostingweb31-40.netsons.net [89.40.174.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94D5B3DA7E; Wed, 23 Feb 2022 09:59:26 -0800 (PST) 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 1nMvv9-00039p-6u; Wed, 23 Feb 2022 18:59:23 +0100 From: Luca Ceresoli To: linux-kernel@vger.kernel.org Cc: Luca Ceresoli , Lee Jones , Rob Herring , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Alessandro Zummo , Alexandre Belloni , Wim Van Sebroeck , Guenter Roeck , devicetree@vger.kernel.org, linux-rtc@vger.kernel.org, linux-watchdog@vger.kernel.org Subject: [PATCH v6 3/8] rtc: max77686: remove unused code to read in 12-hour mode Date: Wed, 23 Feb 2022 18:59:03 +0100 Message-Id: <20220223175908.191618-4-luca@lucaceresoli.net> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220223175908.191618-1-luca@lucaceresoli.net> References: <20220223175908.191618-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: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 Acked-by: Alexandre Belloni --- Changes in v6: none Changes in v5: none Changes in v4: none Changes in v3: none 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