Re: [PATCH] fbdev driver for S3 Trio/Virge
From: Ondrej Zajicek
Date: Tue Feb 06 2007 - 16:19:35 EST
On Mon, Feb 05, 2007 at 11:33:12PM +0100, Jiri Slaby wrote:
> Ondrej Zajicek napsal(a):
> >This patch adds driver for S3 Trio / S3 Virge. Driver is tested
> >with most versions of S3 Trio and S3 Virge, on i386.
> >It is tested both as compiled-in and module. It is against
> >linux-2.6.20 .
Thank you for comments. I appreciated them.
> >+#ifdef CONFIG_MTRR
> >+#include <asm/mtrr.h>
> >+#endif
>
> Why ifdef? It's ifdeffed in the header itself.
But this header is only available on some archs, isn't it?
> >+static int s3fb_open(struct fb_info *info, int user)
> >+{
> >+ struct s3fb_info *par = (struct s3fb_info *) info;
> >+ unsigned int count = atomic_read(&(par->ref_count));
> >+
> >+ if (!count) {
>
> bad
>
> >+ memset(&(par->state), 0, sizeof(struct vgastate));
> >+ par->state.flags = VGA_SAVE_MODE | VGA_SAVE_FONTS |
> >VGA_SAVE_CMAP;
> >+ par->state.num_crtc = 0x70;
> >+ par->state.num_seq = 0x20;
> >+ save_vga(&(par->state));
> >+ }
> >+
> >+ atomic_inc(&(par->ref_count));
> >+
> >+ return 0;
> >+}
This pattern is in several fbdev drivers (neofb, i810fb, rivafb, vga16fb).
I understand the problem but i am not sure what is the best solution.
Maybe acquire/release console semaphore before/after s3fb_open?
> >+static int s3fb_release(struct fb_info *info, int user)
> >+{
> >+ struct s3fb_info *par = (struct s3fb_info *) info;
>
> Use container_of for this (and below/above).
Isn't container_of overkill for this case?
> >+struct vga_regset {
> >+ __u8 regnum;
> >+ __u8 lowbit;
> >+ __u8 highbit;
>
> You use no __ variants, why __u8 here?
No reason. I will replace it to u8, which is more appropriate.
--
Ondrej 'SanTiago' Zajicek (email: santiago@xxxxxxx, jabber: santiago@xxxxxxxxxxxxx)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/