lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171108062738.cml7qaek324rvc4e@piout.net>
Date:   Wed, 8 Nov 2017 07:27:38 +0100
From:   Alexandre Belloni <alexandre.belloni@...e-electrons.com>
To:     Keerthy <j-keerthy@...com>
Cc:     Sekhar Nori <nsekhar@...com>, linux-rtc@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Linux OMAP List <linux-omap@...r.kernel.org>
Subject: Re: [PATCH] rtc: omap: Support scratch registers

Hi,

On 08/11/2017 at 11:30:45 +0530, Keerthy wrote:
> >>> +static int omap_rtc_scratch_read(void *priv, unsigned int offset, void *_val,
> >>> +				 size_t bytes)
> >>> +{
> >>> +	struct omap_rtc	*rtc = priv;
> >>> +	u32 *val = _val;
> >>> +	int i;
> >>> +
> >>> +	for (i = 0; i < bytes / 4; i++)
> >>> +		val[i] = rtc_readl(rtc,
> >>> +				   OMAP_RTC_SCRATCH0_REG + offset + (i * 4));
> 
> Can the offset be the Scratch register number instead of bytes offset?
> More intuitive to me.
> 
> So that one can request using offset as 0, 1, 2 instead of 0, 4, 8?
> 

Well, the offset is coming from the nvmem core, itself getting it from
the Linux file API (and it is in bytes). However, you have the guarantee
that it will be aligned on a word, see:
http://elixir.free-electrons.com/linux/latest/source/drivers/nvmem/core.c#L88

> The above can be:
> rtc_readl(rtc, OMAP_RTC_SCRATCH0_REG + (offset + i) * 4), val[i]);
> 
> 

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ