Re: [PATCHv2 2/2] PCAP regulator driver (for 2.6.32)

Daniel Ribeiro
2009-06-27T02:15:07Z

[-- Attachment #1: Type: text/plain, Size: 942 bytes --]

Em Sáb, 2009-06-27 às 02:04 +0100, Mark Brown escreveu:
> > + if (vreg->n_voltages == 1)
> > + return -EINVAL;
>
> It'd be a little more friendly to check if the supported voltage is in
> the requested range. However, that'd only be an issue if constraints
> allowed voltage changes which is obviously broken so a comment to that
> effect would be enough. I wouldn't have mentioned it but...

Ok, I will add a comment.

> > + ezx_pcap_read(pcap, vreg->reg, &tmp);
> > + tmp |= (1 << vreg->en);
> > + ezx_pcap_write(pcap, vreg->reg, tmp);
>
> This read/modify/write cycle is racy; the individual regulator is locked
> by the core but this register is shared between all regulators on the
> chip so if two are being updated at once things will go wrong. Most of
> the MFDs have a set_bits() function that does an atomic read/modify/write
> cycle for cases like this.

Good point, thanks! :)

--
Daniel Ribeiro

[-- Attachment #2: Esta é uma parte de mensagem assinada digitalmente --]
[-- Type: application/pgp-signature, Size: 197 bytes --]