Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1578274

Re: [PATCH v3 2/3] nvmem: sunxi-sid: add support for H3's SID controller

From Maxime Ripard <maxime.ripard@free-electrons.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 2/3] nvmem: sunxi-sid: add support for H3's SID controller
Date 2017-02-10 09:30 +0100
Message-ID <t9eKB-WF-17@gated-at.bofh.it> (permalink)
References (1 earlier) <t7Nt7-30a-3@gated-at.bofh.it> <t7Nt7-30a-1@gated-at.bofh.it> <t8ag2-Zm-13@gated-at.bofh.it> <t8ag2-Zm-11@gated-at.bofh.it> <t9eKC-WF-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Tue, Feb 07, 2017 at 09:36:35PM +0800, Icenowy Zheng wrote:
> >>  >>  @@ -51,7 +64,8 @@ static u8 sunxi_sid_read_byte(const struct sunxi_sid *sid,
> >>  >>   {
> >>  >>           u32 sid_key;
> >>  >>
> >>  >>  - sid_key = ioread32be(sid->base + round_down(offset, 4));
> >>  >>  + sid_key = ioread32be(sid->base + sid->value_offset +
> >>  >>  + round_down(offset, 4));
> >>  >
> >>  > This would probably be more logical to have this in sunxi_sid_read.
> >>
> >>  But it's here which really access the memory...
> >
> > This function is made to read a single register. What you want is to
> > offset all reads, and all the reads are made in sunxi_sid_read.
> 
> I think the semantic of this function is to read out one byte from SID,
> not read out a single register from SID; the parameter passed into it is
> also a const struct *sunxi_sid, so I think make the offset here is right.

You need to offset *all* register reads, it makes much more sense to
do that offset in the function that reads all the registers, and not
just one.

Maxime

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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH v3 2/3] nvmem: sunxi-sid: add support for H3's SID  controller Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-02-06 10:10 +0100
  Re: [PATCH v3 2/3] nvmem: sunxi-sid: add support for H3's SID  controller Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-02-07 10:30 +0100
    Re: [PATCH v3 2/3] nvmem: sunxi-sid: add support for H3's SID  controller Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-02-10 09:30 +0100

csiph-web