Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp535653pxb; Sat, 11 Sep 2021 12:50:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwj0oeLyS4oDVkPqVbXvXHwK7kp8/sUbKrMlA2R2dCDTSH56s/JYNe1MTMhwDuz6LZZpOWL X-Received: by 2002:a17:906:1454:: with SMTP id q20mr4444337ejc.446.1631389827821; Sat, 11 Sep 2021 12:50:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631389827; cv=none; d=google.com; s=arc-20160816; b=X1oqaOL46K2pxPbRrl/ib+JeSwiEx9Uwg4Z4wUV4nU2KGpqVhjTv8TAakqkHcVmGvH mmny5hz9XQricM6H03OVx80Liy/oe3+kQeBVSlc1qovMkAxTGrkO8Za58iYKVzLiQbZe OBULOpzWQNSwefJEOdfz4bP0F1Xm9xg/jWpKApuKQteCck1DpaE/NcnfhJUd+2VwZuQD 0Wych4YRDbGnpBwQP1jmOoZnOH82/wO9qRSAKZldgE/V/55U4NuLPPvECNbEKDvu0ZnP GTDcORfcV8g6QvfCsdQRvLXTRF0mwE7KlFqtc4bhA8ZiLCI/SnmwahRtH6MbxGxNLepC 5IYw== 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=9rCdpyAtt74CrG+k1DG15C3hjAMIQ19vR0Vy17Qt8r8=; b=zaTaZw954uUg3C+h4/AAQJ3aRiU00x4smq5V+eLBRsCcV+kN3B80Rc2E/W8brzso4j ZBOzm+bZSl/Gv1fqwKzh4te0GGTEHhCItZnFVz8m1ZBPuxubDwEtiV5YYDjx5CNcHCmQ InOq7Bk3LQwSbP8VvuuziRf5mjpkPWNA9fwlOivLKu1mEjywnuzxVVS77AE6Zi86xpnP b2gSCVJmgIk1dHBG2vAFvBmgJ1F41GGpCMtqaocbOEHBI49CfOq9dArQYEt5ChWAYPIb tNesCeBm4DkKA+6Hkd9h9JrEyKWF1PinMmBNzw9k17vcojfbOrey8ahnkoohq0lKKDJe 0TdQ== 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 gv15si2612820ejc.761.2021.09.11.12.50.02; Sat, 11 Sep 2021 12:50:27 -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 S233683AbhIKTr4 (ORCPT + 99 others); Sat, 11 Sep 2021 15:47:56 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:41815 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230347AbhIKTrz (ORCPT ); Sat, 11 Sep 2021 15:47:55 -0400 Received: (Authenticated sender: alexandre.belloni@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 3549A40002; Sat, 11 Sep 2021 19:46:41 +0000 (UTC) Date: Sat, 11 Sep 2021 21:46:40 +0200 From: Alexandre Belloni To: Linus Torvalds Cc: linux-rtc@vger.kernel.org, Linux Kernel Mailing List Subject: Re: [GIT PULL] RTC changes for 5.15 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/09/2021 10:05:02-0700, Linus Torvalds wrote: > On Sat, Sep 11, 2021 at 8:59 AM Alexandre Belloni > wrote: > > > > The broken down time conversion is similar to what is done > > in the time subsystem since v5.14. > > By "similar" you mean "identical", no? > > Why is the rtc subsystem not just using the generic time64_to_tm()? > > Yes, yes, I realize that due to historical mistakes, there's a > duplicate 'struct rtc_time' struct, but it turns out that that is > _identical_ to 'struct tm' except it also has a 'int tm_isdst' at the > end. > > So you could literally make a union of the two, pass the 'struct tm' > part down to the generic code, and just do > > rtc_tm->tm_isdst = 0; > > at the end. > > Rather than have a duplicate copy of that admittedly clever Neri and > Schneider algorithm. > > Hmm? > Yes, most of it is historical, I did have a look at removing the copy but at the time, rtc_time64_to_tm was slightly more efficient because it knew the time was positive. The other issue is that struct rtc_time is exposed to userspace while the kernel struct tm is not and this would tie both struct and if you look close enough, struct tm has long tm_year and struct rtc_time has int tm_year which on 32-bit ARM has a different size. I've been reluctant to change struct tm because I didn't take the time to check the impact on all the users (IIRC, mainly in filesystems). -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com