Received: by 10.223.185.116 with SMTP id b49csp6230710wrg; Thu, 8 Mar 2018 04:07:24 -0800 (PST) X-Google-Smtp-Source: AG47ELvZ0MMerD7puQUuONoRGbYs2yWwYBWJWKkySzyj+rA0yQMc4FG9ZPZCD5UkLoqm94KIiGFU X-Received: by 10.101.64.67 with SMTP id h3mr20409561pgp.200.1520510844279; Thu, 08 Mar 2018 04:07:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520510844; cv=none; d=google.com; s=arc-20160816; b=SCcdvkz/6r0bs6njC5Nys5RvwmOpuAu9ptev8NAVosFfJ7gWBURbZOpLymD1OhWbKf Y0tga7ByKPDZKmTnJqAh6lcPsb6KqkEr4Tr2udTjcrVi06hffWugiZOglh9tA1DgZIEv CDoE8tZQ5ItCN3wIOhgszqigmOM7S6lg+mkmJgIcrjq4Jq42xDUi2EcahVD6OE0Ryuwy 4iiARZFQQT8RNxRO5rTWyXZ63GOzski5tUHp6Ezl+NtVn8PKgB7OTNZ7pxXEK4kXFmoz VMQVeq8FUt4aCiT6PTNVS5XlJZbGx8mf+TFAofZt4Pfubxgpk1YWQKUr77Zt7AaTxGtF b4nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=iLU8B1xeXPOoDXic9cKuSfbQRJRF3cbvFSnEjECTTcE=; b=cSwkFOFPK7X6eHz/TK+UoSbc2q3kWOGro6OSPhvdkCxblKTUbC0oChiHKm0QidjhV7 oj/A2VMeWEzJlqfkCtx9TmXQ5MFTjUAZe6qrvMEYsHRQVP1JO5AEfVxH/JKRkPGoViSK 0zFGPxmBP1rxXkYF7RY4Ox+iiwJtTtNtfSoh318ot8jBXrzkp26BaxW86q2NqqMxioTZ mYdBdCHh1t0lyn5RzOMwlVA05QvtD42d0HJAbAvumocFsor1IM35ZoR4k79PpEdfhxrR NlT2xs23cKHjV1M7jZxCZUdMrQD2vsUBMGb6OkKCyCd9wuQK1eu87kEzzrIiqTKClfiP LcBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k136si10707364pga.630.2018.03.08.04.07.09; Thu, 08 Mar 2018 04:07:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755732AbeCHMFx (ORCPT + 99 others); Thu, 8 Mar 2018 07:05:53 -0500 Received: from mail.bootlin.com ([62.4.15.54]:46811 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750705AbeCHMFv (ORCPT ); Thu, 8 Mar 2018 07:05:51 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 51F1720755; Thu, 8 Mar 2018 13:05:48 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (unknown [37.71.171.242]) by mail.bootlin.com (Postfix) with ESMTPSA id EDDA92073C; Thu, 8 Mar 2018 13:05:47 +0100 (CET) Date: Thu, 8 Mar 2018 13:05:49 +0100 From: Alexandre Belloni To: Denis OSTERLAND Cc: "linux-kernel@vger.kernel.org" , "mgr@pengutronix.de" , "m.grzeschik@pengutronix.de" , "devicetree@vger.kernel.org" , "a.zummo@towertech.it" , "linux@roeck-us.net" , "jdelvare@suse.com" , "linux-rtc@vger.kernel.org" , "kernel@pengutronix.de" Subject: Re: [PATCH v3 3/4] rtc: isl1208: add support for isl1219 with tamper detection Message-ID: <20180308120549.GG20370@piout.net> References: <1520246373-19023-1-git-send-email-Denis.Osterland@diehl.com> <1520246373-19023-4-git-send-email-Denis.Osterland@diehl.com> <20180306204255.GI3035@piout.net> <1520410754.5976.27.camel@diehl.com> <20180307104714.GL3035@piout.net> <1520509988.5415.17.camel@diehl.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1520509988.5415.17.camel@diehl.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/03/2018 at 11:53:09 +0000, Denis OSTERLAND wrote: > Am Mittwoch, den 07.03.2018, 11:47 +0100 schrieb Alexandre Belloni: > > > > > + > > > > > + tv64.tv_sec = rtc_tm_to_time64(&tm); > > > > Why not using an unsigned long long directly here? time64_t is not the > > > > correct type. > > > Do you mean timespec64 is not the correct type here? > > > Then yes, sould be time64_t. > > > If you mean time64_t is not the correct type here, > > > then can you give me some detail why there is no rtc_tm_to_u64, > > > or something like that? > > The rtc subsystem forbids negative times, the proper type should be > > unsigned. > I will add rtc_vaild_tm check. > > Which sequence for time conversion would you expect? > > time64_t secs = rtc_tm_to_time64(&tm); > BUG_ON(secs < 0); > return sprintf(buf, "%llu\n", (unsigned long long)secs); > > or > > return sprintf(buf, "%llu\n", (unsigned long long)rtc_tm_to_time64(&tm)); rtc_vaild_tm will already return EINVAL in case of negative time so this is the one you should use. -- Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com