From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Jeff Garzik <jeff@garzik.org>
Cc: "Kristian Høgsberg" <krh@redhat.com>,
linux-kernel@vger.kernel.org,
"Stefan Richter" <stefanr@s5r6.in-berlin.de>
Subject: Re: [PATCH 2/3] Import fw-ohci driver.
Date: Tue, 05 Dec 2006 17:09:07 +1100 [thread overview]
Message-ID: <1165298947.29784.64.camel@localhost.localdomain> (raw)
In-Reply-To: <45750A89.7000802@garzik.org>
> > +struct descriptor {
> > + u32 req_count:16;
> > +
> > + u32 wait:2;
> > + u32 branch:2;
> > + u32 irq:2;
> > + u32 yy:1;
> > + u32 ping:1;
> > +
> > + u32 key:3;
> > + u32 status:1;
> > + u32 command:4;
> > +
> > + u32 data_address;
> > + u32 branch_address;
> > +
> > + u32 res_count:16;
> > + u32 transfer_status:16;
> > +} __attribute__ ((aligned(16)));
>
> you probably want __le32 annotations for sparse, right?
More than that... he wants no bitfields ! Right now, this code is broken
on some endians (I suspect big, dunno on what Kristian tested).
>
> And for the last two fields, I bet that using the normal 'u16' type
> (__le16?) would generate much better code than a bitfield:16 ever would.
Bah, it's endian broken anyway due to bitfield (ab)use.
> enum {
> constant1 = 1234,
> constant2 = 5678,
> };
>
> for constants. These actually have some type information attached by
> the compiler, and they show up as symbols in the debugger since they are
> not stripped out by the C pre-processor.
Note that while this is true for small constants, beware of the fact
that this is highly unrecommended for anything that doesn't fit in a
signed int. gcc has some dodgy extensions allowing non-int enums but you
don't want to go near them. Read a recent discussion with Linus & Viro
(a few days ago iirc) on lkml about it.
Since some of his constants have values up to 0x80000000, I'm not 100%
confident enum is the way to go, but if you are careful with sign, it
could still be.
> > +static void ar_context_run(struct ar_context *ctx)
> > +{
> > + reg_write(ctx->ohci, ctx->command_ptr, ctx->descriptor_bus | 1);
> > + reg_write(ctx->ohci, ctx->control_set, CONTEXT_RUN);
>
> PCI posting?
In that specific case (kicking the context), it doesn't matter much.
It's not a bug per-se not to do it, though you might get better
performances by making sure it's kicked right away.
Ben.
next prev parent reply other threads:[~2006-12-05 6:09 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-05 5:22 [PATCH 0/3] New firewire stack Kristian Høgsberg
2006-12-05 5:22 ` [PATCH 2/3] Import fw-ohci driver Kristian Høgsberg
2006-12-05 5:54 ` Pete Zaitcev
2006-12-05 5:58 ` Jeff Garzik
2006-12-05 6:09 ` Benjamin Herrenschmidt [this message]
2006-12-09 2:08 ` Kristian Høgsberg
2006-12-09 7:31 ` Stefan Richter
2006-12-10 21:47 ` Kristian Høgsberg
2006-12-10 22:59 ` Stefan Richter
2006-12-10 23:00 ` alignment and packing of struct types (was Re: [PATCH 2/3] Import fw-ohci driver.) Stefan Richter
2006-12-05 5:22 ` [PATCH 3/3] Import fw-sbp2 driver Kristian Høgsberg
2006-12-05 6:07 ` Jeff Garzik
2006-12-05 18:18 ` Stefan Richter
2006-12-14 20:48 ` Kristian Høgsberg
2006-12-14 21:40 ` Stefan Richter
2006-12-15 15:08 ` Kristian Høgsberg
2006-12-15 18:27 ` Stefan Richter
2006-12-05 5:42 ` [PATCH 0/3] New firewire stack Benjamin Herrenschmidt
2006-12-05 6:20 ` Kristian Høgsberg
2006-12-05 16:28 ` Ray Lee
2006-12-05 23:24 ` Kristian Høgsberg
2006-12-05 7:05 ` David Miller
2006-12-05 16:42 ` Kristian Høgsberg
2006-12-05 18:49 ` Stefan Richter
2006-12-05 21:41 ` Benjamin Herrenschmidt
2006-12-05 23:15 ` Stefan Richter
2006-12-05 8:46 ` Marcel Holtmann
2006-12-05 15:13 ` Kristian Høgsberg
2006-12-05 15:30 ` Marcel Holtmann
2006-12-06 16:21 ` Geert Uytterhoeven
2006-12-06 16:32 ` Stefan Richter
2006-12-05 16:05 ` Erik Mouw
2006-07-12 14:56 ` Pavel Machek
2006-12-08 15:09 ` Stefan Richter
2006-12-09 19:44 ` Kristian Høgsberg
2006-12-10 12:57 ` Stefan Richter
2006-12-10 22:17 ` Kristian Høgsberg
2006-12-10 23:21 ` Stefan Richter
2006-12-09 21:51 ` Benjamin Herrenschmidt
2006-12-09 22:51 ` Stefan Richter
2006-12-05 16:53 ` Marcel Holtmann
2006-12-05 23:27 ` Kristian Høgsberg
2006-12-05 18:49 ` Alexey Dobriyan
2006-12-05 19:53 ` Stefan Richter
2006-12-05 23:21 ` Kristian Høgsberg
2006-12-06 5:35 ` Ben Collins
2006-12-06 8:56 ` Stefan Richter
2006-12-06 11:40 ` Alexander Neundorf
2006-12-06 12:38 ` Stefan Richter
2006-12-06 21:21 ` Kristian Høgsberg
2006-12-06 14:49 ` Ben Collins
2006-12-07 0:31 ` Kristian Høgsberg
2006-12-06 8:36 ` Stefan Richter
2006-12-06 22:27 ` Kristian Høgsberg
2006-12-06 23:55 ` Stefan Richter
2006-12-05 23:23 ` Olaf Hering
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=1165298947.29784.64.camel@localhost.localdomain \
--to=benh@kernel.crashing.org \
--cc=jeff@garzik.org \
--cc=krh@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stefanr@s5r6.in-berlin.de \
/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