Thread (4 messages) 4 messages, 2 authors, 2017-02-21

Re: [rtc-linux] [PATCH] rtc: pcf2127: bulk read only date and time registers.

From: Alexandre Belloni <hidden>
Date: 2017-02-21 12:30:42

On 14/02/2017 at 21:23:19 +0100, Sean Nyekj=C3=A6r wrote:
quoted
quoted
-	ret =3D regmap_bulk_read(pcf2127->regmap, PCF2127_REG_CTRL1, buf,
-				sizeof(buf));
+	ret =3D
+	    regmap_bulk_read(pcf2127->regmap, PCF2127_REG_CTRL1 + 3, (buf +=
 3),
quoted
quoted
+			     7);
This is weirdly indented/wrapped. Also, you can probably make buf a
char[7] and continue using sizeof() or even better, ARRAY_SIZE()
I'm fixing the indentation for v2 :-)
I agree this is not the prettiest but i actually thinks its best to keep =
the
buf[10],
then all the existing defines for registeres will continue to work.
Thats why i did this uglyness.
I could do an timebuf[7], read the time into that and replace the registe=
r
defines,
with array numbers but it will create a lot more diff linies :-S
What do you think ?
Then, what about:
 regmap_bulk_read(pcf2127->regmap, PCF2127_REG_SC, (buf + PCF2127_REG_SC), =
sizeof(buf) - PCF2127_REG_SC);


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

--=20
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---=20
You received this message because you are subscribed to the Google Groups "=
rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help