linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: Geoff Levand <geoffrey.levand@am.sony.com>
Cc: linuxppc-dev@ozlabs.org, cbe-oss-dev@ozlabs.org,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [Cbe-oss-dev] [PATCH] cell: abstract spu management routines
Date: Wed, 08 Nov 2006 17:28:09 +1100	[thread overview]
Message-ID: <1162967289.32720.6.camel@localhost.localdomain> (raw)
In-Reply-To: <45516A0C.5050607@am.sony.com>

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

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)->'?

Stephen points out that you shouldn't do the cast at all (inside the
function), it's implied by the return type. And by casting explicitly
you create the potential for the return type and the cast to get out of
sync.

At some point we'll actually read the rest of the patch ;)

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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2006-11-08  6:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-08  4:49 [PATCH] cell: abstract spu management routines Geoff Levand
2006-11-08  5:01 ` [Cbe-oss-dev] " Michael Ellerman
2006-11-08  5:24   ` Geoff Levand
2006-11-08  5:54     ` Michael Ellerman
2006-11-08  6:03       ` Geoff Levand
2006-11-08  6:06         ` Michael Ellerman
2006-11-08  6:28         ` Stephen Rothwell
2006-11-08  6:28     ` Michael Ellerman [this message]
2006-11-08  5:35   ` Benjamin Herrenschmidt
2006-11-08  5:31 ` Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1162967289.32720.6.camel@localhost.localdomain \
    --to=michael@ellerman.id.au \
    --cc=arnd@arndb.de \
    --cc=cbe-oss-dev@ozlabs.org \
    --cc=geoffrey.levand@am.sony.com \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).