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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120911084727.GN19396@mwanda>
Date:	Tue, 11 Sep 2012 11:47:27 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Samuel Iglesias Gonsálvez 
	<siglesias@...lia.com>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	devel@...verdev.osuosl.org,
	Jens Taprogge <jens.taprogge@...rogge.org>,
	linux-kernel@...r.kernel.org,
	industrypack-devel@...ts.sourceforge.net
Subject: Re: [PATCH 04/20] Staging: ipack: Obtain supported speeds from ID
 ROM.

On Mon, Sep 10, 2012 at 10:51:42AM +0200, Samuel Iglesias Gonsálvez wrote:
> From: Jens Taprogge <jens.taprogge@...rogge.org>
> 
> Signed-off-by: Jens Taprogge <jens.taprogge@...rogge.org>
> Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@...lia.com>
> ---
>  drivers/staging/ipack/ipack.c |    6 ++++++
>  drivers/staging/ipack/ipack.h |    2 ++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/staging/ipack/ipack.c b/drivers/staging/ipack/ipack.c
> index b3736c0..521ff55 100644
> --- a/drivers/staging/ipack/ipack.c
> +++ b/drivers/staging/ipack/ipack.c
> @@ -261,15 +261,21 @@ static void ipack_parse_id1(struct ipack_device *dev)
>  
>  	dev->id_vendor = id[4];
>  	dev->id_device = id[5];
> +	dev->speed_8mhz = 1;
> +	dev->speed_32mhz = (id[7] == 'H');
>  }
>  
>  static void ipack_parse_id2(struct ipack_device *dev)
>  {
>  	__be16 *id = (__be16 *) dev->id;
> +	u16 flags;
>  
>  	dev->id_vendor = ((be16_to_cpu(id[3]) & 0xff) << 16)
>  			 + be16_to_cpu(id[4]);
>  	dev->id_device = be16_to_cpu(id[5]);
> +	flags = be16_to_cpu(id[10]);
> +	dev->speed_8mhz = ((flags & 2) != 0);
> +	dev->speed_32mhz = ((flags & 4) != 0);

I really dislike "!= 0" double negatives.  I would prefer this:

	dev->speed_8mhz = !!(flags & 2);
	dev->speed_32mhz = !!(flags & 4);

For me the !! is idiomatic and means turn this into a bool.  I don't
know if maybe I'm the only person who feels this way.

regards,
dan carpenter

--
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