[Cbe-oss-dev] [PATCH] cell: abstract spu management routines

Michael Ellerman michael at ellerman.id.au
Wed Nov 8 17:06:49 EST 2006


On Tue, 2006-11-07 at 22:03 -0800, Geoff Levand wrote:
> Michael Ellerman wrote:
> > On Tue, 2006-11-07 at 21:24 -0800, Geoff Levand wrote:
> >> Michael Ellerman wrote:
> >> >> +static struct platform_data *platform_data(struct spu *spu)
> >> >> +{
> >> >> +	BUG_ON(!spu->platform_data);
> >> >> +	return (struct platform_data*)spu->platform_data;
> >> >> +}
> >> > 
> >> > I don't see the point of this, why not just grab platform data directly?
> >> 
> >> Well, first, it does a check, and second, you can't just grab platform_data,
> >> you need to always do the cast also. So then, is something like
> >> '((struct platform_data*)spu->platform_data)->' preferred over
> >> 'platform_data(spu)->'?
> > 
> > Yeah OK I missed the cast, I guess it's worth it then. In that case can
> > you change the names? Having the struct, the member and the accessor all
> > named the same is a bit confusing.
> > 
> > The BUG() is pretty superfluous, you're just preempting the NULL deref
> > by 1 instruction.
> 
> OK, I'll do the name changes as Ben suggested.

Cool, heh sorry to double-team you, I hadn't read Ben's mail :)

> Actually, that BUG check was just a stale leftover from when I was getting things working :)

No worries.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20061108/11145f74/attachment.pgp>


More information about the Linuxppc-dev mailing list