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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20100823164340.562f466f.akpm@linux-foundation.org>
Date:	Mon, 23 Aug 2010 16:43:40 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	hvaibhav@...com
Cc:	linux-kernel@...r.kernel.org, byron.bbradley@...il.com,
	linux-omap@...r.kernel.org, felipe.balbi@...ia.com
Subject: Re: [PATCH-V2 3/3] RTC:s35390a: Add update_irq (per Min interrupt)
 support

On Sat, 21 Aug 2010 18:00:29 +0530
hvaibhav@...com wrote:

> +static int s35390a_update_irq_enable(struct i2c_client *client,
> +						unsigned enabled)
> +{
> +	struct s35390a *s35390a = i2c_get_clientdata(client);
> +	char buf[1];
> +
> +	if (s35390a_get_reg(s35390a, S35390A_CMD_STATUS2, buf, sizeof(buf)) < 0)
> +		return -EIO;
> +
> +	/* This chip returns the bits of each byte in reverse order */
> +	buf[0] = bitrev8(buf[0]);
> +
> +	buf[0] &= ~S35390A_INT1_MODE_MASK;
> +	if (enabled)
> +		buf[0] |= S35390A_INT1_MODE_PMIN_STDY;
> +	else
> +		buf[0] |= S35390A_INT1_MODE_NOINTR;
> +
> +	/* This chip expects the bits of each byte in reverse order */
> +	buf[0] = bitrev8(buf[0]);

grumble.  We bit-reverse it, fiddle a couple of bits and then
bit-reverse it again.  Lazy.

Why not leave it bit-reversed and just bit-reverse the constants? 
Extra marks are awarded for coming up with a compile-time bitrev8() ;)

> +	return s35390a_set_reg(s35390a, S35390A_CMD_STATUS2, buf, sizeof(buf));
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ