Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2167785pxb; Sun, 17 Oct 2021 07:33:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUpOWQLJaWDDJ8xo8SJ6z80VHzMuPEfdGqnHLnOaFSnJx4FDqCHWc0xJE/Pp2pSCNw8xq+ X-Received: by 2002:a05:6a00:b8f:b0:44c:6220:3396 with SMTP id g15-20020a056a000b8f00b0044c62203396mr23267192pfj.58.1634481232215; Sun, 17 Oct 2021 07:33:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634481232; cv=none; d=google.com; s=arc-20160816; b=QuIN7xOKOKzbFwohDyfZMmjoIIQVuwX+ZqO2yoClcEncEVNzpvQ1NQD7qTUTokNqc1 KY19Fh4tqSgWGVNOL5sptrSyPYit4JoGxB4JYDMriylqN5RXU/Aaagr52nqRwJShNVFx loTPd81Wl1X1bSvk1po94HrkzTzbCPyIjGQfoIPUrRHf/E2lc9j1gpNtwAYQsT1xcgUU CHsKRXE5vITfdJhp5gafH/PtATY6CaBtUprMcM62sne9edRmWZJVE27Y2TWNymiDipsN 023edIAPmr/JZafyQ07mXUK4y9uxvJGXp5echj073eSQoQeKON4+2T4BAYwWceY7TGh8 1kJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=ARNS13bWtQ9sLYHXK/5tl3gIdBlusuMjkqYq22zB4ys=; b=O1PGKr1ANQL4FFLDrClw0vppSQXFKokU8mt63HPaqvgl7V+ObrDZoaPaC3nVKiIjc1 gf8641BMoKKlPaQhoJNENyf1A1WQbVTl6jxOuc4fQMYAVgvki6YWWT7xvBocETfFzReT DwP0DMVD5DP8Uvt7vtkWCcOlik8SUUJ4EXKsKDmEXluMo4YkXYidlCVof+ujwgwJQwQM O6M7iAIab7qFcCy+23jH61OsPu8e+lwwmPYzbBue3g/LgfSo6dJ1uw6/XbGOvvsap9kF Lr8q/ro1PgPuuG5/iMUh2eqHUBDJJHpCmEVVhEKTO2Ut3v4YmifFnGVLsloKf4bwboWL 3dqw== 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 25si7036844pgo.604.2021.10.17.07.33.40; Sun, 17 Oct 2021 07:33:52 -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 S237875AbhJORfV (ORCPT + 99 others); Fri, 15 Oct 2021 13:35:21 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:35925 "EHLO relay1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232596AbhJORfU (ORCPT ); Fri, 15 Oct 2021 13:35:20 -0400 Received: (Authenticated sender: alexandre.belloni@bootlin.com) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id A7080240008; Fri, 15 Oct 2021 17:33:10 +0000 (UTC) Date: Fri, 15 Oct 2021 19:33:10 +0200 From: Alexandre Belloni To: Luca Ceresoli Cc: linux-kernel@vger.kernel.org, Lee Jones , Rob Herring , Alessandro Zummo , 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: Re: [PATCH 4/8] rtc: max77686: remove useless variable Message-ID: References: <20211011155615.257529-1-luca@lucaceresoli.net> <20211011155615.257529-5-luca@lucaceresoli.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211011155615.257529-5-luca@lucaceresoli.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/10/2021 17:56:11+0200, Luca Ceresoli wrote: >> 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) So I guess HOUR_PM_SHIFT and HOUR_PM_MASK can also be removed > - 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 > -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com