linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: michael@ellerman.id.au
Cc: linuxppc-dev@ozlabs.org, Arnd Bergmann <arnd@arndb.de>,
	cbe-oss-dev@ozlabs.org
Subject: Re: [Cbe-oss-dev] [PATCH] cell: abstract spu management routines
Date: Wed, 08 Nov 2006 16:35:03 +1100	[thread overview]
Message-ID: <1162964103.28571.708.camel@localhost.localdomain> (raw)
In-Reply-To: <1162962074.20271.16.camel@localhost.localdomain>


> > +struct platform_data {
> > +	int nid;
> > +	struct device_node *devnode;
> > +	struct spu_priv1 __iomem *priv1;
> > +};
> > +
> > +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?

Because it's a void * in the struct spu. This accessor casts it and BUGS
if it's not set (which is probably unnecessary).

I'd prefer however a different naming:

struct spu_pdata {
	blah
};

static struct spu_pdata *spu_get_pdata(struct spu *spu)

Either that, or you could just do something like that in spu.h :

struct spu_pdata;

struct spu
{
	.../...
	struct spu_pdata *pdata;
	../...
};

And have the various priv1 implementation define their own struct
spu_pdata. A bit sneaky but provides strong typing without needing an
accessor.

Ben.

  parent reply	other threads:[~2006-11-08  5:35 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
2006-11-08  5:35   ` Benjamin Herrenschmidt [this message]
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=1162964103.28571.708.camel@localhost.localdomain \
    --to=benh@kernel.crashing.org \
    --cc=arnd@arndb.de \
    --cc=cbe-oss-dev@ozlabs.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=michael@ellerman.id.au \
    /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).