参照元†
- レジスタに write アクセスする必要があるかどうか判定する。
- 現在のレジスタの値 old と、書き込む値 val で更新した後の値 new が異なっていれば、write アクセスする必要がある。
- old と new が一致していたら、write アクセスする必要はない。
- struct snd_soc_component *component
- unsigned int reg
- unsigned int mask
- unsigned int value
返り値†
- int
- write する必要があれば 1、必要がなければ 0
/**
* snd_soc_component_test_bits - Test register for change
* @component: component
* @reg: Register to test
* @mask: Mask that specifies which bits to test
* @value: Value to test against
*
* Tests a register with a new value and checks if the new value is
* different from the old value.
*
* Return: 1 for change, otherwise 0.
*/
int snd_soc_component_test_bits(struct snd_soc_component *component,
unsigned int reg, unsigned int mask, unsigned int value)
{
unsigned int old, new;
int ret;
ret = snd_soc_component_read(component, reg, &old);
if (ret < 0)
return ret;
new = (old & ~mask) | value;
return old != new;
}
EXPORT_SYMBOL_GPL(snd_soc_component_test_bits);
- GPL ライセンスのモジュールにのみシンボルを公開する。
コメント†