All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: Antti Palosaari <crope@iki.fi>
Cc: Jiri Slaby <jslaby@suse.cz>,
	linux-kernel@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@redhat.com>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH 1/4] media: dvb/af9015, implement eeprom hashing
Date: Sun, 24 Jan 2010 17:35:04 +0100	[thread overview]
Message-ID: <4B5C76B8.4090700@gmail.com> (raw)
In-Reply-To: <4B5C7258.1010605@iki.fi>

On 01/24/2010 05:16 PM, Antti Palosaari wrote:
>> +    af9015_config.eeprom_sum = 0;
>> +    for (reg = 0; reg<  eeprom_size / sizeof(u32); reg++) {
>> +        af9015_config.eeprom_sum *= GOLDEN_RATIO_PRIME_32;
>> +        af9015_config.eeprom_sum += le32_to_cpu(((u32 *)eeprom)[reg]);
>> +    }
>> +
>> +    deb_info("%s: eeprom sum=%.8x\n", __func__,
>> af9015_config.eeprom_sum);
> 
> Does this sum contain all 256 bytes from EEPROM? 256/4 is 64.

Yes it does. It is computed as a hashed sum of 32-bit numbers (4 bytes)
-- speed (does not matter) and larger space of hashes. Hence the
division by 4. The cast does the trick: ((u32 *)eeprom)[reg] -- reg
index is on a 4-byte basis.

regards,
-- 
js

  reply	other threads:[~2010-01-24 16:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-13 20:00 [PATCH 1/1] media: dvb-usb/af9015, add IR support for digivox mini II Jiri Slaby
2010-01-14 19:09 ` Antti Palosaari
2010-01-22 15:10   ` [PATCH 1/4] media: dvb/af9015, implement eeprom hashing Jiri Slaby
2010-01-24 16:16     ` Antti Palosaari
2010-01-24 16:35       ` Jiri Slaby [this message]
2010-01-24 23:52         ` Antti Palosaari
2010-01-22 15:10   ` [PATCH 2/4] media: dvb/af9015, factor out remote setting Jiri Slaby
2010-01-24 23:53     ` Antti Palosaari
2010-01-22 15:10   ` [PATCH 3/4] media: dvb/af9015, refactor " Jiri Slaby
2010-01-24 23:54     ` Antti Palosaari
2010-01-22 15:10   ` [PATCH 4/4] media: dvb/af9015, add hashes support Jiri Slaby
2010-01-24 23:55     ` Antti Palosaari
2010-01-22 15:11   ` [PATCH 1/1] media: dvb-usb/af9015, add IR support for digivox mini II Jiri Slaby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B5C76B8.4090700@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=crope@iki.fi \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.