[alsa-devel] [PATCH v4 08/14] ASoC: SOF: Add DSP HW abstraction operations

Takashi Iwai tiwai at suse.de
Thu Feb 14 14:21:58 CET 2019


On Wed, 13 Feb 2019 23:07:28 +0100,
Pierre-Louis Bossart wrote:
> +int snd_sof_pci_update_bits_unlocked(struct snd_sof_dev *sdev, u32 offset,
> +				     u32 mask, u32 value)
> +{
> +	struct pci_dev *pci = to_pci_dev(sdev->dev);
> +	unsigned int old, new;
> +	u32 ret = ~0; /* explicit init to remove uninitialized use warnings */
> +
> +	pci_read_config_dword(pci, offset, &ret);
> +	old = ret;
> +	dev_dbg(sdev->dev, "Debug PCIR: %8.8x at  %8.8x\n", old & mask, offset);
> +
> +	new = (old & (~mask)) | (value & mask);
> +
> +	if (old == new)
> +		return false;
> +
> +	pci_write_config_dword(pci, offset, new);
> +	dev_dbg(sdev->dev, "Debug PCIW: %8.8x at  %8.8x\n", value,
> +		offset);
> +
> +	return true;
> +}
> +EXPORT_SYMBOL(snd_sof_pci_update_bits_unlocked);

Better to change the return type to bool to make clearer.


thanks,

Takashi


More information about the Alsa-devel mailing list