Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1586750pxb; Mon, 11 Oct 2021 08:59:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaWp3ddnklJEmVqReHw4sFqdXNCA4ubcjjFUDdY67S2eW8zLs6YwyosbLh87JZrBw38i+z X-Received: by 2002:a63:7542:: with SMTP id f2mr18598778pgn.64.1633967999526; Mon, 11 Oct 2021 08:59:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633967999; cv=none; d=google.com; s=arc-20160816; b=0rSglLlnr87ubBpnibUe2uaKjuZ6I5BqWAp5UobbWAjObVRX7hKRW1UkkkGjcvwGUJ l0bMybMVobaThFZtHKwv2MallJlHHpRPozK68AVlzFAPxEpZnuN8ozMj/mffFOvII7Kv a2hdgHxBm1bV4iDOpQAlinEpu1dfgl6+1FJsZILAA5jj7gscYcaG4H2dTb26mU8MRP9c YtvzwTCciZPTi4/ivN794SUhF930ZeczrZjN7VBXHBi3GcX43udYcRRsGE4FkGp199gL xOOGNY/iYvJdDBOK2J1DmaDhOFetYCzI91n7r80T0E43UfAbS8DIEkxp9pCgHs+Zos5h HzTg== 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=s0QgoZLrZdwzT6dMWMPI4eitszZCnV0C56hkn5HmEUo=; b=XDjiC36hXJK62ZLwNa1TaXBhDtPTQTjHvS41nkTPH8cablvxgJqPVLMl+0is3BUzGE G2fIbMN135k24yF/kiVtJyDTgZ2sxjoUzgaH4IDtzypS+gJBmO/5RLcMCQLOE4ZBJhcb ypM0Fr0/iMb37xQ4kJgn2wo5WOXBN0uufMauUOR5IcnWmIXMfN/P67EFIltbI/K/BHVw aORKxQUOLsU39wGgO+irAUcHRDzm0tuD1N22aSSKUJfal42v8Iv+867XPy+I7M/rU39L nRk+ZMVI8q95+61RezjTgnDuRHjptDHJY4BoRATwdkkQv4Y1HddphzOIJPdivhGzsm/v CQWQ== 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 j1si10491982plr.187.2021.10.11.08.59.46; Mon, 11 Oct 2021 08:59:59 -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 S240523AbhJKP65 (ORCPT + 99 others); Mon, 11 Oct 2021 11:58:57 -0400 Received: from hostingweb31-40.netsons.net ([89.40.174.40]:52626 "EHLO hostingweb31-40.netsons.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234847AbhJKP6s (ORCPT ); Mon, 11 Oct 2021 11:58:48 -0400 Received: from [77.244.183.192] (port=63592 helo=melee.dev.aim) by hostingweb31.netsons.net with esmtpa (Exim 4.94.2) (envelope-from ) id 1mZxfP-00DXft-0P; Mon, 11 Oct 2021 17:56:43 +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 Subject: [PATCH 4/8] rtc: max77686: remove useless variable Date: Mon, 11 Oct 2021 17:56:11 +0200 Message-Id: <20211011155615.257529-5-luca@lucaceresoli.net> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211011155615.257529-1-luca@lucaceresoli.net> References: <20211011155615.257529-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 rtc_24hr_mode is set to 1 in max77686_rtc_probe()->max77686_rtc_init_reg() before being read and is never set back to 0 again. As such, it is de facto a constant. Remove the variable and the unreachable code. Signed-off-by: Luca Ceresoli --- drivers/rtc/rtc-max77686.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c index 7e765207f28e..9901c596998a 100644 --- a/drivers/rtc/rtc-max77686.c +++ b/drivers/rtc/rtc-max77686.c @@ -99,7 +99,6 @@ struct max77686_rtc_info { int rtc_irq; int virq; - int rtc_24hr_mode; }; enum MAX77686_RTC_OP { @@ -278,13 +277,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 +655,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