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

From: Daniel Ribeiro
Date: Fri Jun 26 2009 - 22:15:18 EST


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: signature.asc
Description: Esta =?ISO-8859-1?Q?=E9?= uma parte de mensagemassinada digitalmente