Search Linux Wireless

Re: [PATCH 12/12] staging: brcm80211: cleaned up softmac srom macro

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

 



On Fri, 2011-09-02 at 16:00 +0200, Roland Vossen wrote:
> Substituted macro.
[]
> diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c
[]
> @@ -792,6 +780,14 @@ static const struct brcms_sromvar perpath_pci_sromvars[] = {
>  
>  static u8 srom_crc8_table[CRC8_TABLE_SIZE];
>  
> +static u8 *srom_window_address(struct si_pub *sih, void *curmap)
> +{
> +	return sih->ccrev > 31 ?
> +	       (((sih->cccaps & CC_CAP_SROM) == 0) ? NULL :
> +	       ((u8 *)curmap + PCI_16KB0_CCREGS_OFFSET + CC_SROM_OTP)) :
> +	       ((u8 *)curmap + PCI_BAR0_SPROM_OFFSET);
> +}

Please try to make code more readable when
converting to functions too.

Maybe:

static u16 *srom_window_address(struct si_pub *sih, u8 *curmap)
{
	if (sih->ccrev < 32)
		return (u16 *)(curmap + PCI_BAR0_SPROM_OFFSET);
	if (sih->cccaps & CC_CAP_SROM)
		return (u16 *)(curmap + PCI_16KB0_CCREGS_OFFSET + CC_SROM_OTP);

	return NULL;
}
> @@ -1147,7 +1143,7 @@ static int initvars_srom_pci(struct si_pub *sih, void *curmap, char **vars,
>  	if (!srom)
>  		return -ENOMEM;
>  
> -	sromwindow = (u16 *) SROM_OFFSET(sih);
> +	sromwindow = (u16 *) srom_window_address(sih, curmap);

	sromwindow = srom_window_address(sih, curmap)


--
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 Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux