2002-03-23 15:41:56

by Boris Bezlaj

[permalink] [raw]
Subject: mdacon.c minor cleanups

Hi

Im resending mdacon.c patch if anyone is interested including it..

Its just a small cleanup(a part of kernel-janitor TODO).
Added module description, module_init/exit(), printk() parameters,...
Tested on 2.4.x, but not on 2.5(patches/compiles fine..)

Flames/improvements welcome..

Boris B.


--- drivers/video/mdacon.c.orig Fri Sep 14 01:04:43 2001
+++ drivers/video/mdacon.c Thu Feb 14 18:07:20 2002
@@ -78,7 +78,7 @@
static int mda_first_vc = 13;
static int mda_last_vc = 16;

-static struct vc_data *mda_display_fg = NULL;
+static struct vc_data *mda_display_fg;

MODULE_PARM(mda_first_vc, "1-255i");
MODULE_PARM(mda_last_vc, "1-255i");
@@ -338,7 +338,7 @@
mda_type_name = "MDA";

if (! mda_detect()) {
- printk("mdacon: MDA card not detected.\n");
+ printk(KERN_WARNING __FILE__ ": MDA card not detected.\n");
return NULL;
}

@@ -349,7 +349,7 @@
/* cursor looks ugly during boot-up, so turn it off */
mda_set_cursor(mda_vram_len - 1);

- printk("mdacon: %s with %ldK of memory detected.\n",
+ printk(KERN_INFO __FILE__ ": %s with %ldK of memory detected.\n",
mda_type_name, mda_vram_len/1024);

return "MDA-2";
@@ -605,28 +605,23 @@
con_invert_region: mdacon_invert_region,
};

-void __init mda_console_init(void)
+int __init mda_console_init(void)
{
if (mda_first_vc > mda_last_vc)
- return;
+ return -EINVAL;

take_over_console(&mda_con, mda_first_vc-1, mda_last_vc-1, 0);
-}
-
-#ifdef MODULE
-
-MODULE_LICENSE("GPL");
-
-int init_module(void)
-{
- mda_console_init();
-
return 0;
}

-void cleanup_module(void)
+void __exit mda_console_exit(void)
{
give_up_console(&mda_con);
}

+#ifdef MODULE
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("MDA console driver. Default console allocation: vc/13 - vc/16");
+module_init(mda_console_init);
+module_exit(mda_console_exit);
#endif


2002-03-24 05:39:00

by Keith Owens

[permalink] [raw]
Subject: Re: mdacon.c minor cleanups

On Sat, 23 Mar 2002 16:42:20 +0100,
Boris Bezlaj <[email protected]> wrote:
>+#ifdef MODULE
>+MODULE_LICENSE("GPL");
>+MODULE_DESCRIPTION("MDA console driver. Default console allocation: vc/13 - vc/16");
>+module_init(mda_console_init);
>+module_exit(mda_console_exit);
> #endif

Do not wrap #ifdef MODULE around those lines. All the module_* macros
behave correctly when the code is built in, module_init even changes
its behaviour for built in code.

2002-03-24 18:43:21

by Dave Jones

[permalink] [raw]
Subject: Re: mdacon.c minor cleanups

On Sat, Mar 23, 2002 at 04:42:20PM +0100, Boris Bezlaj wrote:

> if (! mda_detect()) {
> - printk("mdacon: MDA card not detected.\n");
> + printk(KERN_WARNING __FILE__ ": MDA card not detected.\n");
> return NULL;

Does __FILE__ suffer the same 'deprecated' warning that newer gcc 3's
spit out for __FUNCTION__ ? If so, it'd be better to do this properly
than to add more bits that will just create another janitor item for
someone else later..

--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs

2002-03-24 19:00:44

by Daniel Jacobowitz

[permalink] [raw]
Subject: Re: mdacon.c minor cleanups

On Sun, Mar 24, 2002 at 07:42:54PM +0100, Dave Jones wrote:
> On Sat, Mar 23, 2002 at 04:42:20PM +0100, Boris Bezlaj wrote:
>
> > if (! mda_detect()) {
> > - printk("mdacon: MDA card not detected.\n");
> > + printk(KERN_WARNING __FILE__ ": MDA card not detected.\n");
> > return NULL;
>
> Does __FILE__ suffer the same 'deprecated' warning that newer gcc 3's
> spit out for __FUNCTION__ ? If so, it'd be better to do this properly
> than to add more bits that will just create another janitor item for
> someone else later..

No, it shouldn't.

--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer

2002-03-25 08:04:50

by Zwane Mwaikambo

[permalink] [raw]
Subject: Re: mdacon.c minor cleanups

The mdacon probe code doesn't seem to work well, if i have it compiled in
it *always* detects an MDA card, even if there isn't one actually in the
box. I can provide the dmesg if anyone's interested.

Zwane


2002-03-25 15:51:45

by Boris Bezlaj

[permalink] [raw]
Subject: Re: mdacon.c minor cleanups

On Mon, Mar 25, 2002 at 09:53:24AM +0200, Zwane Mwaikambo wrote:
> The mdacon probe code doesn't seem to work well, if i have it compiled in
> it *always* detects an MDA card, even if there isn't one actually in the
> box. I can provide the dmesg if anyone's interested.
>
> Zwane
>

I will look into it, however i must admit i never tried to load the driver without the mda card in the box.

Can you tell me, what type of "card" is found?
Kernel version?

Boris

2002-03-25 16:16:49

by Zwane Mwaikambo

[permalink] [raw]
Subject: Re: mdacon.c minor cleanups

On Mon, 25 Mar 2002, Boris wrote:

> I will look into it, however i must admit i never tried to load the driver without the mda card in the box.
>
> Can you tell me, what type of "card" is found?
> Kernel version?

Its a hercules monochrome with 64k iirc

Zwane

--
rants : http://function.linuxpower.ca


2002-03-27 09:17:04

by Matan Ziv-Av

[permalink] [raw]
Subject: Re: mdacon.c minor cleanups

On Mon, 25 Mar 2002, Zwane Mwaikambo wrote:

> The mdacon probe code doesn't seem to work well, if i have it compiled in
> it *always* detects an MDA card, even if there isn't one actually in the
> box. I can provide the dmesg if anyone's interested.

The mdacon.c in 2.4.18 does not actually test for an MDA card, it only
test for ram where the MDA vram is. The problem is that almost any vga
card maps ram to that address.
There is a test, but it is somewhat wrong (it changes registers, but
does not save and restore the original values) and is commented out. If
you fix this and uncomment the test, it works in some cases (this was
discussed under the subject "MDA video detection request" on July 2000).


--
Matan Ziv-Av. [email protected]





2002-03-27 09:47:35

by Zwane Mwaikambo

[permalink] [raw]
Subject: Re: mdacon.c minor cleanups

On Wed, 27 Mar 2002, Matan wrote:

> The mdacon.c in 2.4.18 does not actually test for an MDA card, it only
> test for ram where the MDA vram is. The problem is that almost any vga
> card maps ram to that address.
> There is a test, but it is somewhat wrong (it changes registers, but
> does not save and restore the original values) and is commented out. If
> you fix this and uncomment the test, it works in some cases (this was
> discussed under the subject "MDA video detection request" on July 2000).

Aah, thanks for clearing that up.

Zwane

--
http://function.linuxpower.ca


2002-03-27 17:56:21

by Boris Bezlaj

[permalink] [raw]
Subject: Re: mdacon.c minor cleanups

On Wed, Mar 27, 2002 at 11:17:39AM +0200, Matan wrote:
>
> The mdacon.c in 2.4.18 does not actually test for an MDA card, it only
> test for ram where the MDA vram is. The problem is that almost any vga
> card maps ram to that address.
> There is a test, but it is somewhat wrong (it changes registers, but
> does not save and restore the original values) and is commented out. If
> you fix this and uncomment the test, it works in some cases (this was
> discussed under the subject "MDA video detection request" on July 2000).
>
I am trying to add proper mda detection to the driver..
Current detection code is strange indeed.

Where are those messages archived somewhere ? I could find little info on mda cards so far..

Boris