[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <45C9065A.7010102@gmail.com>
Date: Tue, 06 Feb 2007 23:51:06 +0100
From: Jiri Slaby <jirislaby@...il.com>
To: Ondrej Zajicek <santiago@...reenet.org>
Cc: James Simmons <jsimmons@...radead.org>,
Andrew Morton <akpm@...l.org>, linux-kernel@...r.kernel.org,
linux-fbdev-devel@...ts.sourceforge.net
Subject: Re: [PATCH] fbdev driver for S3 Trio/Virge
Ondrej Zajicek napsal(a):
> On Mon, Feb 05, 2007 at 11:33:12PM +0100, Jiri Slaby wrote:
>> Ondrej Zajicek napsal(a):
>>> +#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?
Yup, I stand corrected.
>>> + 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.
Blah. It should be fixed, then.
> Maybe acquire/release console semaphore before/after s3fb_open?
Kick atomic_t-s off and use mutexes to protect simple uint or something like this.
>>> +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?
Hmm, maybe yes. Anyway it's not so clean way to do it.
I can see, they have void *par in fb_info. I would do:
struct s3fb_info {
int chip, rev, mclk_freq;
int mtrr_reg;
struct vgastate state;
atomic_t ref_count;
u32 pseudo_palette[16];
};
I.e. no struct fb_info inside, since you allocate the space twice by
framebuffer_alloc() -- 2*sizeof(struct fb_info) + sizeof(struct s3fb_info) +
padding.
Then normally
framebuffer_alloc(sizeof(struct s3fb_info), NULL);
and happily use
struct s3fb_info *s = info->par;
since par member is set directly to aligned space after fb_info when size is
nonzero inside the framebuffer_alloc().
Is there any problem with this approach?
regards,
--
http://www.fi.muni.cz/~xslaby/ Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8 22A0 32CC 55C3 39D4 7A7E
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists