From: Linus Torvalds <torvalds@osdl.org>
To: Pavel Machek <pavel@suse.cz>
Cc: Paul Mackerras <paulus@samba.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Linux Kernel list <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@osdl.org>,
David Brownell <david-b@pacbell.net>,
Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Subject: Re: Totally broken PCI PM calls
Date: Sun, 24 Oct 2004 14:18:53 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.58.0410241415360.13209@ppc970.osdl.org> (raw)
In-Reply-To: <20041024205841.GH28314@elf.ucw.cz>
On Sun, 24 Oct 2004, Pavel Machek wrote:
>
> Ok, after -Wbitwise for sparse, strict typechecking seems to
> work. Unfortunately, it produces a *lot* of noise, for code such as
>
> static ssize_t disk_show(struct subsystem * subsys, char * buf)
> {
> return sprintf(buf, "%s\n", pm_disk_modes[pm_disk_mode]);
> }
>
> ...where pm_disk_mode is __bitwise. That is not really what we
> want. Would it be possible to get something similar to __bitwise where
> arithmetic is still okay to do?
I'll try to get to it - I've spent the last two days on sparse making sure
that I can do flow-control checking (things like "a function that gets a
spinlock needs to release it"), and it will take a while before I get out
of it.
But yes, I think it makes sense to have a "unique type" thing that allows
arithmetic. And I think it makes sense to have another unique type that
disallows _all_ operations (ie truly opaque cookies, where the only valid
op is to compare it with another cookie).
Maybe Al is interested..
Linus
---
> With __bitwise, I'd need to do:
>
> @@ -292,15 +297,15 @@
> int i;
> int len;
> char *p;
> - u32 mode = 0;
> + suspend_disk_method_t mode = 0;
>
> p = memchr(buf, '\n', n);
> len = p ? p - buf : n;
>
> down(&pm_sem);
> - for (i = PM_DISK_FIRMWARE; i < PM_DISK_MAX; i++) {
> + for (i = (int __force) PM_DISK_FIRMWARE; i < (int __force) PM_DISK_MAX; i++) {
> if (!strncmp(buf, pm_disk_modes[i], len)) {
> - mode = i;
> + mode = (suspend_disk_method_t __force) i;
> break;
> }
> }
>
>
> ...thats ugly.
>
> Pavel
> --
> People were complaining that M$ turns users into beta-testers...
> ...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
>
next prev parent reply other threads:[~2004-10-24 21:19 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-11 0:45 Totally broken PCI PM calls Benjamin Herrenschmidt
2004-10-11 2:41 ` Linus Torvalds
2004-10-11 3:42 ` Paul Mackerras
2004-10-11 4:04 ` Linus Torvalds
2004-10-11 4:24 ` Paul Mackerras
2004-10-11 9:57 ` Pavel Machek
2004-10-11 14:42 ` Linus Torvalds
2004-10-11 14:56 ` suspend-to-RAM [was Re: Totally broken PCI PM calls] Pavel Machek
2004-10-11 15:30 ` Linus Torvalds
2004-10-11 17:39 ` Olivier Galibert
2004-10-11 18:21 ` Pavel Machek
2004-10-11 15:53 ` Brice Goglin
2004-10-11 16:17 ` Pavel Machek
2004-10-11 17:09 ` Brice Goglin
2004-10-11 18:23 ` Pavel Machek
2004-10-11 18:40 ` Brice Goglin
2004-10-11 16:47 ` Totally broken PCI PM calls David Brownell
2004-10-11 22:28 ` Benjamin Herrenschmidt
2004-10-11 22:58 ` Dmitry Torokhov
2004-10-11 23:08 ` Benjamin Herrenschmidt
2004-10-12 3:00 ` David Brownell
2004-10-12 4:09 ` Dmitry Torokhov
2004-10-12 16:56 ` David Brownell
2004-10-12 9:27 ` Russell King
2004-10-12 11:24 ` Benjamin Herrenschmidt
2004-10-11 4:25 ` Linus Torvalds
2004-10-11 10:18 ` Pavel Machek
2004-10-11 10:54 ` Benjamin Herrenschmidt
2004-10-11 16:01 ` Linus Torvalds
2004-10-15 13:59 ` Pavel Machek
2004-10-15 15:56 ` Linus Torvalds
2004-10-24 20:58 ` Pavel Machek
2004-10-24 21:18 ` Linus Torvalds [this message]
2004-10-11 16:36 ` David Brownell
2004-10-11 21:17 ` Nigel Cunningham
2004-10-11 21:37 ` David Brownell
2004-10-11 22:12 ` Stefan Seyfried
2004-10-12 2:59 ` David Brownell
2004-10-12 8:54 ` Pavel Machek
2004-10-12 10:32 ` Stefan Seyfried
2004-10-12 18:28 ` David Brownell
2004-10-12 20:28 ` Stefan Seyfried
2004-10-13 13:34 ` David Brownell
2004-10-12 1:24 ` Nigel Cunningham
2004-10-12 8:53 ` Pavel Machek
2004-10-12 18:52 ` David Brownell
2004-10-12 19:50 ` Pavel Machek
2004-10-12 22:13 ` Benjamin Herrenschmidt
2004-10-12 22:35 ` David Brownell
2004-10-11 22:26 ` Benjamin Herrenschmidt
2004-10-11 3:45 ` Benjamin Herrenschmidt
2004-10-11 4:08 ` Linus Torvalds
2004-10-11 4:23 ` Benjamin Herrenschmidt
2004-10-11 4:32 ` Linus Torvalds
2004-10-11 4:55 ` Benjamin Herrenschmidt
2004-10-11 16:15 ` David Brownell
2004-10-11 22:22 ` Benjamin Herrenschmidt
2004-10-12 2:46 ` David Brownell
2004-10-12 4:02 ` Benjamin Herrenschmidt
2004-10-12 10:49 ` Nigel Cunningham
2004-10-12 11:27 ` Benjamin Herrenschmidt
2004-10-12 11:38 ` Nigel Cunningham
2004-10-12 11:51 ` Pavel Machek
2004-10-11 10:08 ` Pavel Machek
2004-10-11 9:51 ` Pavel Machek
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=Pine.LNX.4.58.0410241415360.13209@ppc970.osdl.org \
--to=torvalds@osdl.org \
--cc=akpm@osdl.org \
--cc=benh@kernel.crashing.org \
--cc=david-b@pacbell.net \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
--cc=pavel@suse.cz \
--cc=viro@parcelfarce.linux.theplanet.co.uk \
/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).