[RFC PATCH linux v6 2/9] hwmon: Add core On-Chip Controller support for POWER CPUs

Andrew Jeffery andrew at aj.id.au
Tue Dec 13 12:30:10 AEDT 2016


On Mon, 2016-12-12 at 16:32 +1030, Andrew Jeffery wrote:
> > > +   /* read remaining data */
> > > +   for (i = 8; i < num_bytes + 8; i += 8)
> > +             driver->bus_ops.getscom(driver->bus, OCB_DATA, occ_data, i);
> 
> This interface needs work. I'd much rather we could write:
> 
>     occ_data[i] = driver->bus_ops.getscom(driver->bus, OCB_DATA);
> 
> Looking at patch 4/9 I can't see any reason why we'd need such an
> unusual interface.

Actually, I take that back slightly. Ultimately I'd like to get away
from passing i as a parameter. So instead we could continue to use the
return value for errors, and pass a pointer to the memory getscom()
should modify:

    rc = driver->bus_ops.getscom(driver->bus, OCB_DATA, (u64 *)&occ_data[i]);

The value in (u64 *)&occ_data[i] is only valid if the call is success etc.

Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20161213/b168addd/attachment.sig>


More information about the openbmc mailing list