Search Linux Wireless

Re: [rt2x00-users] [PATCH 4/5] rt2x00: rt2800lib: introduce rt2800_eeprom_word_index helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 26, 2013 at 07:55:17PM +0200, Gabor Juhos wrote:
> Instead of assign the offset value to the
> enum directly use a new helper function to
> convert a rt2800_eeprom_word enum into an
> index of the rt2x00_dev->eeprom array.
> 
> The patch does not change the existing
> behaviour, but makes it possible to add
> support for three-chain devices which are
> using a different EEPROM layout.
> 
> Signed-off-by: Gabor Juhos <juhosg@xxxxxxxxxxx>

Acked-by: Stanislaw Gruszka <stf_xl@xxxxx>

I have two nit-picks, but they can be fixed later on top of your current
patches.

> +	if (WARN_ON(word >= EEPROM_WORD_COUNT)) {
> +		rt2x00_warn(rt2x00dev, "invalid EEPROM word %d\n", word);
> +		return 0;
> +	}

Since we take "enum rt2800_eeprom_word" as word argument, it can not
have different values than already listed, so this warning is not needed.

> +	map = rt2800_eeprom_map;
> +	index = map[word];
> +
> +	if (WARN_ON(word != EEPROM_CHIP_ID && index == 0)) {
> +		/* Index 0 is valid only for EEPROM_CHIP_ID.
> +		 * Otherwise it means that the offset of the
> +		 * given word is not initialized in the map,
> +		 * or that the field is not usable on the
> +		 * actual chipset.
> +		 */
> +		rt2x00_warn(rt2x00dev, "invalid access of EEPROM word %d\n",
> +			    word);

I prefer not to use WARN_ON() and rt2x00_warn() together, please use just
one of them, i.e:

WARN_ONCE(word != EEPROM_CHIP_ID && index == 0,
	  "invalid access of EEPROM word %d\n", word);

Stanislaw
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux