From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Keith Mannthey <kmannth@us.ibm.com>
Cc: lkml <linux-kernel@vger.kernel.org>, John Stultz <johnstul@us.ibm.com>
Subject: Re: [RFC][Patch] IBM Real-Time "SMI Free" mode driver
Date: Wed, 11 Feb 2009 10:02:49 +0000 [thread overview]
Message-ID: <20090211100249.1ce0a170@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <1234312633.15410.546.camel@keith-laptop>
> + if (readb(rtl+RTL_STATE) != value) {
> + if (value == 1)
> + writeb(1, (rtl+RTL_CMD));
> + else
> + writeb(2, (rtl+RTL_CMD));
writeb( 1 + value , ... ) ??
> + rtl = ioremap(table_addr, RTL_TABLE_SIZE);
> +
> + if (!rtl) {
> + ret = -ENOMEM;
> + goto err_out;
Would it be better to eliminate all the ioremap special test casing and
just remap it once at load time, or at least use a single function so the
tests/printks don't all get duplicated ? That would also eliminate the
fact you can get multiple mappings of the same thing if there are
multiple parallel users.
I note also there is no locking versus multiple accessors - eg when
writing the RTL_CMD registers
> + /*get the address for the RTL table from the EBDA */
> + ebda_addr = *(unsigned short *)phys_to_virt(0x40E);
> + ebda_addr <<= 4;
> + ebda_size = 64*1024;
> +
> + data = ioremap(ebda_addr, ebda_size);
Careful - it is perfectly valid for a BIOS EBDA table to be zero
indicating no EBDA is present, and at this point you've not checked if
the driver is being loaded on a relevant IBM platform.
> + unsigned int *tmp = (unsigned int *) data++;
Use u32 - it makea it obvious what is going on here.
> +/*needed to decode CmdPortAddress and CmdPortValue*/
> +#define bios_to_value(rtl, offset) (u32)((readb(rtl+(offset+1)) << 8) + \
> + readb(rtl+offset))
What is wrong with readw() ?
Alan
next prev parent reply other threads:[~2009-02-11 10:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-11 0:37 Keith Mannthey
2009-02-11 10:02 ` Alan Cox [this message]
2009-02-11 10:05 ` Alan Cox
2009-02-11 12:18 ` Michal Schmidt
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=20090211100249.1ce0a170@lxorguk.ukuu.org.uk \
--to=alan@lxorguk.ukuu.org.uk \
--cc=johnstul@us.ibm.com \
--cc=kmannth@us.ibm.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®