public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: alexandre.belloni@free-electrons.com (Alexandre Belloni)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/3] rtc: Add Realtek RTD1295
Date: Mon, 28 Aug 2017 17:50:52 +0200	[thread overview]
Message-ID: <20170828155052.thythswlgcsfusay@piout.net> (raw)
In-Reply-To: <d20fbc21-bd8f-c191-ed51-03487868e7b0@suse.de>

Hi,

On 27/08/2017 at 13:30:59 +0200, Andreas F?rber wrote:
> Well, I found your rtc_year_days rather confusing and had to play with
> the arguments until I got it working as expected, so I wanted an inline
> function (or macro) as abstraction from my three callers.
> 
> Sadly the naming is rather confusing as I am looking for the number of
> days 365..366, whereas your rtc_year_days is meant to return 0..365 and
> I would just like to extract the 12th array element but need to counter
> the -1 subtraction. rtc_year_days(31, 11, year) + 1 is not intuitive
> either - reads like November (and ranges are not documented).
> 
> What about exporting a convenient rtc_days_in_year(year) from rtc-lib.c
> accessing the table directly without rtc_year_days detour? Alternatively
> an inline function in rtc.h to the same effect without the array?
> 

This could have been done but what you did in your v3 is fine too. It
will always be time to move that to the core later.

> Also despite is_leap_year() returning a bool || expression you keep
> using it as array index or integer to add. That assumes true == 1,
> whereas to my knowledge only false is guaranteed to be 0 and any
> non-zero value means true. So I'd expect the code to be like this:

sizeof(bool) (actually _Bool) is 1 so it can only be 0 or 1.


-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  parent reply	other threads:[~2017-08-28 15:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-27  0:33 [PATCH v2 0/3] arm64: Realtek RTD1295 RTC Andreas Färber
2017-08-27  0:33 ` [PATCH v2 1/3] dt-bindings: rtc: Add Realtek RTD1295 Andreas Färber
2017-08-27  0:33 ` [PATCH v2 2/3] " Andreas Färber
2017-08-27  2:05   ` Andrew Lunn
2017-08-27  2:30     ` Andreas Färber
2017-08-27  3:27       ` Andrew Lunn
2017-08-27 10:21         ` Andreas Färber
2017-08-27  8:27       ` Alexandre Belloni
2017-08-27 10:28         ` Andreas Färber
2017-08-27  9:13   ` Alexandre Belloni
2017-08-27 11:30     ` Andreas Färber
2017-08-27 13:37       ` Andrew Lunn
2017-08-27 19:26         ` Alexandre Belloni
2017-08-28 15:50       ` Alexandre Belloni [this message]
2017-08-27  0:33 ` [PATCH v2 3/3] arm64: dts: realtek: Add RTD1295 RTC node Andreas Färber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170828155052.thythswlgcsfusay@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox