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] [day] [month] [year] [list]
Date:	Sun, 17 Aug 2014 09:13:41 -0500
From:	Mark Brown <broonie@...nel.org>
To:	Chris Zhong <zyw@...k-chips.com>
Cc:	robh+dt@...nel.org, pawel.moll@....com, mark.rutland@....com,
	ijc+devicetree@...lion.org.uk, galak@...eaurora.org,
	sameo@...ux.intel.com, lee.jones@...aro.org, lgirdwood@...il.com,
	a.zummo@...ertech.it, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, rtc-linux@...glegroups.com,
	grant.likely@...aro.org, hl@...k-chips.com,
	huangtao@...k-chips.com, cf@...k-chips.com,
	zhangqing@...k-chips.com, xxx@...k-chips.com,
	dianders@...omium.org, heiko@...ech.de, olof@...om.net,
	sonnyrao@...omium.org, dtor@...omium.org,
	javier.martinez@...labora.co.uk, kever.yang@...k-chips.com
Subject: Re: [PATCH 2/4] MFD: RK808: Add new mfd device for RK808

On Sun, Aug 17, 2014 at 09:58:25AM +0800, Chris Zhong wrote:

> +static void rk808_device_shutdown(void)
> +{
> +	int ret;
> +	struct rk808 *rk808 = g_rk808;
> +
> +	if (!rk808) {
> +		dev_err(rk808->dev, "%s have no g_rk808\n", __func__);
> +		return;
> +	}

This is a bit dodgy but I can't think of a better way of doing it :/

> +
> +	ret = regmap_update_bits(rk808->regmap,
> +				 RK808_INT_STS_MSK_REG1,
> +				 (0x3 << 5), (0x3 << 5));
> +	/* close rtc int when power off */
> +	ret = regmap_update_bits(rk808->regmap,
> +				 RK808_RTC_INT_REG,
> +				 (0x3 << 2), 0);
> +	/* close rtc int when power off */
> +	ret = regmap_update_bits(rk808->regmap,
> +				 RK808_DEVCTRL_REG,
> +				 (0x1 << 3), (0x1 << 3));
> +	if (ret < 0)
> +		dev_err(rk808->dev, "rk808 power off error!\n");

Defines for these bits would be good, though if this turns off the RTC
alarm then it might be better not to do it - one thing people do with
RTC alarms is use them to wake the system up from deep sleep.

> +	while (1)
> +		wfi();
> +}

Just let the kernel shut down by itself - or is that last write a system
power off request?

> +	ret = regmap_read(rk808->regmap, 0x2f, &val);
> +	if (ret < 0) {
> +		dev_err(rk808->dev, "The device is not rk808 %d\n", ret);
> +		return ret;
> +	}

That error message is misleading - an error from regmap_read() means
that I/O failed, usually "device is not rk808" would mean that you'd
read back and ID register on the device and it didn't match what was
expected.

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists