Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1337556pxk; Thu, 10 Sep 2020 12:53:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDrQLYPmFctRmZqV+FtdzOMd8gY6mA93hNlvhuc8JwCOEetEaenETYIxLjzkvOirmn8A5A X-Received: by 2002:aa7:c347:: with SMTP id j7mr11568670edr.185.1599767623814; Thu, 10 Sep 2020 12:53:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599767623; cv=none; d=google.com; s=arc-20160816; b=aBh+VDOv3Rhvm9VxvhegAMuaOdTRQf+FW6wF8KwdoQa3PDdbgTt4KTahSjLrr3QDaK Kcgg0/DBWW43/B/K8SeSXWzMPWgmqlSqaCqJgtdlq1FtX39zw27kDlYgFPnK+MSsTGf/ 47uvnZt0EwBKyY1RX945ODembsLOnfydAiTlRzGarCIalQROyPUYcubrLb25JOm74aif UMbzur7t3vKKRCQFGqYjT1hw6d29xECCl/sgPFeEivAYqOtKxn5PhcqDzlFRZuaQhTxM vpoe9VlXTIoqErGZFP3bphzMbWayzj+OPScm+phwEtTEZMqb4nAFjb/NSs9D3O2mMlbv mSKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=pmp1KFkI5izvxvzFO7J555tiLFvrYGcpaG3yEtTAXfk=; b=RLazOrN+KDLiZOfKi5uJ5aJGEN5gyfT+iejQP9AHl6FMfUj1o0Lm9R4fED9njyoZ8l CNIRG/1YMJdEXYYZwrkpB6ZH75nenQ02aHoV5t3yvqrcERxuoGaSEEtUIw8PpklqBIQU OXFxOe5JhBJ2hw42C+FuyXkt4hDMBBtuOyLLCQI9PTy9XcXC8j0Ve7RisS9I5hi9YUTJ C/Jq10mqeCAFUQXDAmM7qaRghCr5QrmMdqYN/TyeKeAC1OTmKZKNlCprNkFGYmNY6Cqt +W2VjCnv42PJzWDUN4A+ad5oRA6B0u/jTYgKS1/Xjyt4pFiamTVgGwDdkva/J4H/rqT3 ft6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=jM1asNJt; 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 b29si4157213ejl.385.2020.09.10.12.53.21; Thu, 10 Sep 2020 12:53:43 -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; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=jM1asNJt; 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 S1726970AbgIJTuk (ORCPT + 99 others); Thu, 10 Sep 2020 15:50:40 -0400 Received: from mout.gmx.net ([212.227.15.19]:44107 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726769AbgIJTs6 (ORCPT ); Thu, 10 Sep 2020 15:48:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1599767332; bh=S5yPB053GMXMHY3i5MJ4KAmLRKTmf2lq+7D4srpxwxA=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:References:In-Reply-To; b=jM1asNJt/ix2ZlIOnXfAE6sccIIMgf8FxojhOifClk+HKpCj9HgRFuUXrsm1ManNZ RZFdeuO858ImmrQfexQpRKbRsIqrX4fDwdLlj/fdrAIp21A4ZbyGMb4sm92sgupfUT woI+Yij2bBzD59wPPu1fmCTwJ4Yv0I+TcK9Zd3OI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from longitude ([5.146.195.151]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M5wLZ-1k9buV46Xb-007YSO; Thu, 10 Sep 2020 21:42:25 +0200 Date: Thu, 10 Sep 2020 21:42:20 +0200 From: Jonathan =?utf-8?Q?Neusch=C3=A4fer?= To: Andy Shevchenko Cc: Jonathan =?utf-8?Q?Neusch=C3=A4fer?= , "linux-kernel@vger.kernel.org" , Lee Jones , Rob Herring , Thierry Reding , Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , Alessandro Zummo , Alexandre Belloni , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Sam Ravnborg , Linus Walleij , Heiko Stuebner , Stephan Gerhold , Lubomir Rintel , Mark Brown , allen , Mauro Carvalho Chehab , "David S. Miller" , "devicetree@vger.kernel.org" , "linux-pwm@vger.kernel.org" , "linux-rtc@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Heiko Stuebner , Josua Mayer , Andreas Kemnade , Arnd Bergmann , Daniel Palmer Subject: Re: [PATCH v2 08/10] rtc: New driver for RTC in Netronix embedded controller Message-ID: <20200910194220.GE3306@latitude> References: <20200905133230.1014581-1-j.neuschaefer@gmx.net> <20200905144503.1067124-1-j.neuschaefer@gmx.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="M/SuVGWktc5uNpra" Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:I+JHLMuApGMJsrLC1+HTMJo4e+AdFLZlrfPoEwt9cZhavkBEALt KEuqmQh83PWYEOPX4hpSBy14KsqEc22Bv6M6KBWlWjugfK8dQ3fqoEsSgzpUTPBP3klCStn DLchNVAcurXMi7f7tztEYTNgRxekTEMRiFgRLqlbVmP7sBQsU9ROBaYKU6iBVigHi6IRHCM nxMX7UNeDkSoMvWURjeOg== X-Spam-Flag: N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R01F6CDv8WesD2pb2SwV5Usa8/MQ/sR9IdGJ/NmpzxZpSDpAZA6pTF+QkiShkQ1 8tFc1WSulCH4YD+ItoIZgNYwdZ8mj/wqnTCxMJXTn1x8dNpOcbVZHHp0HnSOl0o8G64N5hSRs 1K/EzKoTeY4Uplxz8QiGVu4aygQpaY+BhZ/FsGXWLupwubeizQTUZI7W9C/87aOPuZzYEgn4D X3RQBD2lrmt0ItZvvbqDI9XqQKjYEkN+Fyd37vA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --M/SuVGWktc5uNpra Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 05, 2020 at 08:56:35PM +0300, Andy Shevchenko wrote: > On Saturday, September 5, 2020, Jonathan Neusch=C3=A4fer > wrote: [...] > > +#include >=20 >=20 > No user for this. Perhaps you meant mod_devicetable.h? Yes > > +/* Convert an 8-bit value into the correct format for writing into a > > register */ > > +#define u8_to_reg(x) (((x) & 0xff) << 8) >=20 >=20 > This needs more explanation. Does register be16? Yes, the registers are treated as be16 in the base driver. I wrote a slightly longer explanation in response to your other review. > > +static int ntxec_set_time(struct device *dev, struct rtc_time *tm) > > +{ > > + struct ntxec_rtc *rtc =3D dev_get_drvdata(dev); > > + int res =3D 0; > > + > > + res |=3D regmap_write(rtc->ec->regmap, NTXEC_REG_WRITE_YEAR, > > u8_to_reg(tm->tm_year - 100)); > > + res |=3D regmap_write(rtc->ec->regmap, NTXEC_REG_WRITE_MONTH, > > u8_to_reg(tm->tm_mon + 1)); > > + res |=3D regmap_write(rtc->ec->regmap, NTXEC_REG_WRITE_DAY, > > u8_to_reg(tm->tm_mday)); > > + res |=3D regmap_write(rtc->ec->regmap, NTXEC_REG_WRITE_HOUR, > > u8_to_reg(tm->tm_hour)); > > + res |=3D regmap_write(rtc->ec->regmap, NTXEC_REG_WRITE_MINUTE, > > u8_to_reg(tm->tm_min)); > > + res |=3D regmap_write(rtc->ec->regmap, NTXEC_REG_WRITE_SECOND, > > u8_to_reg(tm->tm_sec)); > > + > > + return (res < 0) ? -EIO : 0; >=20 >=20 > Hmm... (I stumbled over res |=3D parts) I'll convert it to the (more verbose but also more correct) pattern of returning each error early. > > +static const struct of_device_id ntxec_rtc_of_match[] =3D { > > + { .compatible =3D "netronix,ntxec-rtc" }, > > + { }, >=20 >=20 > No need for comma in terminator line. Okay Thanks, Jonathan Neusch=C3=A4fer --M/SuVGWktc5uNpra Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEvHAHGBBjQPVy+qvDCDBEmo7zX9sFAl9agZQACgkQCDBEmo7z X9t7Vg//TklGb5L5lL/xuITfZUbaWRE0NO9ebO0gQJ0jIXLZw0XMii5+QFlgjmn/ 53tgs2wghDAcz4Es/t9azuuiTLkt76nIZU2uYGX17ULQ9RK3bEA3Wz8N+7VY3QXM txcZ4McFlMCmWAhclQDnK3VVywI3Nu0iF6CNnWQY1xRH4KmjyIAbXkalDiYI3y3s VRcdUjBTaOEQSnNoQFSew2DN1yl+OpN5z7XONYznBWMpnMAzB5+QL/IHrIYjvVZt 3lnu2beHd4eUGHH6RsyqyRGJHM59uUckMynmEdXjuoktOdLJte3pXdce4EE7HF6k LJCMrRcZP7XKe+AP4DQaFD3fr9ZHU6z6yqtgePzGh6aAtgjjnC16Y4mgEK0Lvvb8 5Z1PU9e39G1WqsSnacmdRPBgxTT8hbogcnroW4GKfE3VW2ph1CE4CDCc1cBYzu93 NhtNw6fTa9gXJXETC5zEH+Xf/Yf9K5cCwsuvzVGnBJbw57530eMuzV4/PjwOlayM fDa4BM+N9Lf/EIfzupT5CTcTFvUmz5Ao4aM1XQOFTtdtEjKdqZV1O2Y1tH7+Zfj3 TDG1itKF2vm9iToGWEr4wMoe/X75/uf7YV7kGhN8kv3kIPBpeeygOyP96dJo1Gk5 gQ2N3HBm2oesXQSvoEhMmCuUSLHkuL5sB7Zz1NRMN7XomQ+7rEA= =9c8/ -----END PGP SIGNATURE----- --M/SuVGWktc5uNpra--