From: Sam Ravnborg <sam@ravnborg.org>
To: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Richard Henderson <rth@twiddle.net>,
Jay Estabrook <jay.estabrook@hp.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALPHA: support graphics on non-zero PCI domains (take 2)
Date: Sun, 15 Apr 2007 11:01:15 +0200 [thread overview]
Message-ID: <20070415090115.GA18103@uranus.ravnborg.org> (raw)
In-Reply-To: <20070415111937.A12310@jurassic.park.msu.ru>
> +#ifdef CONFIG_VGA_HOSE
> /*
> - * Adjust the addr.
> + * Adjust the address and hose, if necessary.
> */
> -#ifdef CONFIG_VGA_HOSE
> - if (pci_vga_hose && __titan_is_mem_vga(addr)) {
> + if (pci_vga_hose && __is_mem_vga(addr)) {
> h = pci_vga_hose->index;
This code snippet is used in two places.
A better approach would be to define a small inline function
that is empty in the NON HOSe case to avod the ifdefs in the
code logic.
> +tsunami_ioremap(unsigned long addr, unsigned long size)
> +{
> + FIXUP_MEMADDR_VGA(addr);
> + return (void __iomem *)(addr + TSUNAMI_MEM_BIAS);
> +}
> +
> +#ifndef CONFIG_ALPHA_GENERIC
> +EXPORT_SYMBOL(tsunami_ioportmap);
> +EXPORT_SYMBOL(tsunami_ioremap);
> +#endif
It looks strange that the function is always defined but conditionally exported.
Also usual style is to place EXPORT right after closing brace of function -
(with no empty lines in-between).
> +
> +static void __init
> +tsunami_init_vga_hose(void)
> +{
> +#ifdef CONFIG_VGA_HOSE
> + u64 *pu64 = (u64 *)((u64)hwrpb + hwrpb->ctbt_offset);
> +
> + if (pu64[7] == 3) { /* TERM_TYPE == graphics */
> + struct pci_controller *hose;
> + int h = (pu64[30] >> 24) & 0xff; /* console hose # */
> +
> + /*
> + * Our hose numbering does NOT match the console's, so find
> + * the right one...
> + */
> + for (hose = hose_head; hose; hose = hose->next) {
> + if (hose->index == h) break;
> + }
> +
> + if (hose) {
> + printk("Console graphics on hose %d\n", h);
> + pci_vga_hose = hose;
> + }
> + }
> +#endif /* CONFIG_VGA_HOSE */
> +}
Again - avoid ifdef in code.
Surround whole function with ifdef and then provide an empty inline for the NON hose case.
> +/* console.c */
> +#ifdef CONFIG_VGA_HOSE
> +extern void locate_and_init_vga(void *(*)(void *, void *));
> +#else
> +#define locate_and_init_vga() do { } while (0)
> +#endif
static inline would give you a limited type check of arguments.
>
> +config VGA_HOSE
> + bool "VGA on arbitrary hose"
> + depends on ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL || ALPHA_TSUNAMI
> + default y
Please always include help entry for visible symbols.
You have it mostly written up in the changelog so it should be trivial to add.
Sam
next prev parent reply other threads:[~2007-04-15 9:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-15 7:19 [PATCH] ALPHA: support graphics on non-zero PCI domains (take 2) Ivan Kokshaysky
2007-04-15 9:01 ` Sam Ravnborg [this message]
2007-04-15 11:22 ` Ivan Kokshaysky
2007-04-15 12:30 ` Sam Ravnborg
2007-04-15 21:26 ` Jay Estabrook
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=20070415090115.GA18103@uranus.ravnborg.org \
--to=sam@ravnborg.org \
--cc=akpm@linux-foundation.org \
--cc=ink@jurassic.park.msu.ru \
--cc=jay.estabrook@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rth@twiddle.net \
/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