linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Krzysztof Helt" <krzysztof.h1@wp.pl>
To: linux-fbdev-devel <linux-fbdev-devel@lists.sourceforge.net>
Cc: Ben Dooks <ben-linux@fluff.org>,
	Arnaud Patard <arnaud.patard@rtp-net.org>
Subject: [PATCH] s3c2410fb: remove fb_info pointer from s3c2410fb_info
Date: Sat, 04 Aug 2007 13:46:44 +0200	[thread overview]
Message-ID: <46b4672403046@wp.pl> (raw)

[-- Attachment #1: Type: text/plain, Size: 6052 bytes --]

From: Krzysztof Helt <krzysztof.h1@wp.pl>

This patch removes redundant fb field from
the s3c2410fb_info structure. This breaks circular
reference fb_info -> s3c2410fb_info -> fb_info again.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>

---

This patch requires s3c2410fb-cleanup patch I posted earlier.

diff -urp linux-2.6.23.old/drivers/video/s3c2410fb.c linux-
2.6.23/drivers/video/s3c2410fb.c
--- linux-2.6.23.old/drivers/video/s3c2410fb.c	2007-08-03 
07:30:31.000000000 +0200
+++ linux-2.6.23/drivers/video/s3c2410fb.c	2007-08-03 
07:27:48.000000000 +0200
@@ -119,15 +119,14 @@ static int debug	= 0;
  *
  * initialise lcd controller address pointers
  */
-static void s3c2410fb_set_lcdaddr(struct s3c2410fb_info *fbi)
+static void s3c2410fb_set_lcdaddr(struct fb_info *info)
 {
-	struct fb_var_screeninfo *var = &fbi->fb->var;
 	unsigned long saddr1, saddr2, saddr3;
-	int line_length = var->xres * var->bits_per_pixel;
+	int line_length = info->var.xres * info-
>var.bits_per_pixel;
 
-	saddr1  = fbi->fb->fix.smem_start >> 1;
-	saddr2  = fbi->fb->fix.smem_start;
-	saddr2 += (line_length * var->yres) / 8;
+	saddr1  = info->fix.smem_start >> 1;
+	saddr2  = info->fix.smem_start;
+	saddr2 += (line_length * info->var.yres) / 8;
 	saddr2 >>= 1;
 
 	saddr3 = S3C2410_OFFSIZE(0) |
@@ -275,9 +274,10 @@ static int s3c2410fb_check_var(struct fb
  * activate (set) the controller from the given framebuffer
  * information
  */
-static void s3c2410fb_activate_var(struct s3c2410fb_info *fbi,
+static void s3c2410fb_activate_var(struct fb_info *info,
 				   struct fb_var_screeninfo *var)
 {
+	struct s3c2410fb_info *fbi = info->par;
 	int hs;
 
 	fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_MODEMASK;
@@ -418,7 +418,7 @@ static void s3c2410fb_activate_var(struc
 	writel(fbi->regs.lcdcon5, S3C2410_LCDCON5);
 
 	/* set lcd address pointers */
-	s3c2410fb_set_lcdaddr(fbi);
+	s3c2410fb_set_lcdaddr(info);
 
 	writel(fbi->regs.lcdcon1, S3C2410_LCDCON1);
 }
@@ -430,7 +430,6 @@ static void s3c2410fb_activate_var(struc
  */
 static int s3c2410fb_set_par(struct fb_info *info)
 {
-	struct s3c2410fb_info *fbi = info->par;
 	struct fb_var_screeninfo *var = &info->var;
 
 	switch (var->bits_per_pixel) {
@@ -449,7 +448,7 @@ static int s3c2410fb_set_par(struct fb_i
 
 	/* activate this new configuration */
 
-	s3c2410fb_activate_var(fbi, var);
+	s3c2410fb_activate_var(info, var);
 	return 0;
 }
 
@@ -615,15 +614,17 @@ static struct fb_ops s3c2410fb_ops = {
  *	cache.  Once this area is remapped, all virtual memory
  *	access to the video memory should occur at the new 
region.
  */
-static int __init s3c2410fb_map_video_memory(struct 
s3c2410fb_info *fbi)
+static int __init s3c2410fb_map_video_memory(struct fb_info 
*info)
 {
+	struct s3c2410fb_info *fbi = info->par;
+
 	dprintk("map_video_memory(fbi=%p)\n", fbi);
 
-	fbi->map_size = PAGE_ALIGN(fbi->fb->fix.smem_len + 
PAGE_SIZE);
+	fbi->map_size = PAGE_ALIGN(info->fix.smem_len + 
PAGE_SIZE);
 	fbi->map_cpu  = dma_alloc_writecombine(fbi->dev, fbi-
>map_size,
 					       &fbi->map_dma, 
GFP_KERNEL);
 
-	fbi->map_size = fbi->fb->fix.smem_len;
+	fbi->map_size = info->fix.smem_len;
 
 	if (fbi->map_cpu) {
 		/* prevent initial garbage on screen */
@@ -632,11 +633,11 @@ static int __init s3c2410fb_map_video_me
 		memset(fbi->map_cpu, 0xf0, fbi->map_size);
 
 		fbi->screen_dma		= fbi->map_dma;
-		fbi->fb->screen_base	= fbi->map_cpu;
-		fbi->fb->fix.smem_start  = fbi->screen_dma;
+		info->screen_base	= fbi->map_cpu;
+		info->fix.smem_start	= fbi->screen_dma;
 
 		dprintk("map_video_memory: dma=%08x cpu=%p 
size=%08x\n",
-			fbi->map_dma, fbi->map_cpu, fbi->fb-
>fix.smem_len);
+			fbi->map_dma, fbi->map_cpu, info-
>fix.smem_len);
 	}
 
 	return fbi->map_cpu ? 0 : -ENOMEM;
@@ -660,8 +661,9 @@ static inline void modify_gpio(void __io
 /*
  * s3c2410fb_init_registers - Initialise all LCD-related 
registers
  */
-static int s3c2410fb_init_registers(struct s3c2410fb_info *fbi)
+static int s3c2410fb_init_registers(struct fb_info *info)
 {
+	struct s3c2410fb_info *fbi = info->par;
 	unsigned long flags;
 	void __iomem *regs = fbi->io;
 
@@ -684,7 +686,7 @@ static int s3c2410fb_init_registers(stru
 	writel(fbi->regs.lcdcon4, regs + S3C2410_LCDCON4);
 	writel(fbi->regs.lcdcon5, regs + S3C2410_LCDCON5);
 
-	s3c2410fb_set_lcdaddr(fbi);
+	s3c2410fb_set_lcdaddr(info);
 
 	dprintk("LPCSEL    = 0x%08lx\n", mach_info->lpcsel);
 	writel(mach_info->lpcsel, regs + S3C2410_LPCSEL);
@@ -777,7 +779,6 @@ static int __init s3c2410fb_probe(struct
 		return -ENOMEM;
 
 	info = fbinfo->par;
-	info->fb = fbinfo;
 	info->dev = &pdev->dev;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -890,7 +891,7 @@ static int __init s3c2410fb_probe(struct
 	msleep(1);
 
 	/* Initialize video memory */
-	ret = s3c2410fb_map_video_memory(info);
+	ret = s3c2410fb_map_video_memory(fbinfo);
 	if (ret) {
 		printk(KERN_ERR "Failed to allocate video RAM:
 %d\n", ret);
 		ret = -ENOMEM;
@@ -899,7 +900,7 @@ static int __init s3c2410fb_probe(struct
 
 	dprintk("got video memory\n");
 
-	s3c2410fb_init_registers(info);
+	s3c2410fb_init_registers(fbinfo);
 
 	s3c2410fb_check_var(&fbinfo->var, fbinfo);
 
diff -urp linux-2.6.23.old/drivers/video/s3c2410fb.h linux-
2.6.23/drivers/video/s3c2410fb.h
--- linux-2.6.23.old/drivers/video/s3c2410fb.h	2007-08-02 
10:21:08.000000000 +0200
+++ linux-2.6.23/drivers/video/s3c2410fb.h	2007-08-03 
07:16:50.000000000 +0200
@@ -26,7 +26,6 @@
 #define __S3C2410FB_H
 
 struct s3c2410fb_info {
-	struct fb_info		*fb;
 	struct device		*dev;
 	struct clk		*clk;
 


----------------------------------------------------
Jedni przybyli na Ziemię, by nas zniszczyć. Inni - by nas chronić.
"Transformers" - pełen akcji film Stevena Spielberga
i Michaela Baya w kinach od 17 sierpnia.
http://klik.wp.pl/?adr=http%3A%2F%2Fadv.reklama.wp.pl%2Fas%2Ftransformers.html&sid=1247

[-- Attachment #2: s3c2410fb-remove-fb-field.diff --]
[-- Type: application/octet-stream, Size: 5536 bytes --]

From: Krzysztof Helt <krzysztof.h1@wp.pl>

This patch removes redundant fb field from
the s3c2410fb_info structure. This breaks circular
reference fb_info -> s3c2410fb_info -> fb_info again.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>

---

This patch requires s3c2410fb-cleanup patch I posted earlier.

diff -urp linux-2.6.23.old/drivers/video/s3c2410fb.c linux-2.6.23/drivers/video/s3c2410fb.c
--- linux-2.6.23.old/drivers/video/s3c2410fb.c	2007-08-03 07:30:31.000000000 +0200
+++ linux-2.6.23/drivers/video/s3c2410fb.c	2007-08-03 07:27:48.000000000 +0200
@@ -119,15 +119,14 @@ static int debug	= 0;
  *
  * initialise lcd controller address pointers
  */
-static void s3c2410fb_set_lcdaddr(struct s3c2410fb_info *fbi)
+static void s3c2410fb_set_lcdaddr(struct fb_info *info)
 {
-	struct fb_var_screeninfo *var = &fbi->fb->var;
 	unsigned long saddr1, saddr2, saddr3;
-	int line_length = var->xres * var->bits_per_pixel;
+	int line_length = info->var.xres * info->var.bits_per_pixel;
 
-	saddr1  = fbi->fb->fix.smem_start >> 1;
-	saddr2  = fbi->fb->fix.smem_start;
-	saddr2 += (line_length * var->yres) / 8;
+	saddr1  = info->fix.smem_start >> 1;
+	saddr2  = info->fix.smem_start;
+	saddr2 += (line_length * info->var.yres) / 8;
 	saddr2 >>= 1;
 
 	saddr3 = S3C2410_OFFSIZE(0) |
@@ -275,9 +274,10 @@ static int s3c2410fb_check_var(struct fb
  * activate (set) the controller from the given framebuffer
  * information
  */
-static void s3c2410fb_activate_var(struct s3c2410fb_info *fbi,
+static void s3c2410fb_activate_var(struct fb_info *info,
 				   struct fb_var_screeninfo *var)
 {
+	struct s3c2410fb_info *fbi = info->par;
 	int hs;
 
 	fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_MODEMASK;
@@ -418,7 +418,7 @@ static void s3c2410fb_activate_var(struc
 	writel(fbi->regs.lcdcon5, S3C2410_LCDCON5);
 
 	/* set lcd address pointers */
-	s3c2410fb_set_lcdaddr(fbi);
+	s3c2410fb_set_lcdaddr(info);
 
 	writel(fbi->regs.lcdcon1, S3C2410_LCDCON1);
 }
@@ -430,7 +430,6 @@ static void s3c2410fb_activate_var(struc
  */
 static int s3c2410fb_set_par(struct fb_info *info)
 {
-	struct s3c2410fb_info *fbi = info->par;
 	struct fb_var_screeninfo *var = &info->var;
 
 	switch (var->bits_per_pixel) {
@@ -449,7 +448,7 @@ static int s3c2410fb_set_par(struct fb_i
 
 	/* activate this new configuration */
 
-	s3c2410fb_activate_var(fbi, var);
+	s3c2410fb_activate_var(info, var);
 	return 0;
 }
 
@@ -615,15 +614,17 @@ static struct fb_ops s3c2410fb_ops = {
  *	cache.  Once this area is remapped, all virtual memory
  *	access to the video memory should occur at the new region.
  */
-static int __init s3c2410fb_map_video_memory(struct s3c2410fb_info *fbi)
+static int __init s3c2410fb_map_video_memory(struct fb_info *info)
 {
+	struct s3c2410fb_info *fbi = info->par;
+
 	dprintk("map_video_memory(fbi=%p)\n", fbi);
 
-	fbi->map_size = PAGE_ALIGN(fbi->fb->fix.smem_len + PAGE_SIZE);
+	fbi->map_size = PAGE_ALIGN(info->fix.smem_len + PAGE_SIZE);
 	fbi->map_cpu  = dma_alloc_writecombine(fbi->dev, fbi->map_size,
 					       &fbi->map_dma, GFP_KERNEL);
 
-	fbi->map_size = fbi->fb->fix.smem_len;
+	fbi->map_size = info->fix.smem_len;
 
 	if (fbi->map_cpu) {
 		/* prevent initial garbage on screen */
@@ -632,11 +633,11 @@ static int __init s3c2410fb_map_video_me
 		memset(fbi->map_cpu, 0xf0, fbi->map_size);
 
 		fbi->screen_dma		= fbi->map_dma;
-		fbi->fb->screen_base	= fbi->map_cpu;
-		fbi->fb->fix.smem_start  = fbi->screen_dma;
+		info->screen_base	= fbi->map_cpu;
+		info->fix.smem_start	= fbi->screen_dma;
 
 		dprintk("map_video_memory: dma=%08x cpu=%p size=%08x\n",
-			fbi->map_dma, fbi->map_cpu, fbi->fb->fix.smem_len);
+			fbi->map_dma, fbi->map_cpu, info->fix.smem_len);
 	}
 
 	return fbi->map_cpu ? 0 : -ENOMEM;
@@ -660,8 +661,9 @@ static inline void modify_gpio(void __io
 /*
  * s3c2410fb_init_registers - Initialise all LCD-related registers
  */
-static int s3c2410fb_init_registers(struct s3c2410fb_info *fbi)
+static int s3c2410fb_init_registers(struct fb_info *info)
 {
+	struct s3c2410fb_info *fbi = info->par;
 	unsigned long flags;
 	void __iomem *regs = fbi->io;
 
@@ -684,7 +686,7 @@ static int s3c2410fb_init_registers(stru
 	writel(fbi->regs.lcdcon4, regs + S3C2410_LCDCON4);
 	writel(fbi->regs.lcdcon5, regs + S3C2410_LCDCON5);
 
-	s3c2410fb_set_lcdaddr(fbi);
+	s3c2410fb_set_lcdaddr(info);
 
 	dprintk("LPCSEL    = 0x%08lx\n", mach_info->lpcsel);
 	writel(mach_info->lpcsel, regs + S3C2410_LPCSEL);
@@ -777,7 +779,6 @@ static int __init s3c2410fb_probe(struct
 		return -ENOMEM;
 
 	info = fbinfo->par;
-	info->fb = fbinfo;
 	info->dev = &pdev->dev;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -890,7 +891,7 @@ static int __init s3c2410fb_probe(struct
 	msleep(1);
 
 	/* Initialize video memory */
-	ret = s3c2410fb_map_video_memory(info);
+	ret = s3c2410fb_map_video_memory(fbinfo);
 	if (ret) {
 		printk(KERN_ERR "Failed to allocate video RAM: %d\n", ret);
 		ret = -ENOMEM;
@@ -899,7 +900,7 @@ static int __init s3c2410fb_probe(struct
 
 	dprintk("got video memory\n");
 
-	s3c2410fb_init_registers(info);
+	s3c2410fb_init_registers(fbinfo);
 
 	s3c2410fb_check_var(&fbinfo->var, fbinfo);
 
diff -urp linux-2.6.23.old/drivers/video/s3c2410fb.h linux-2.6.23/drivers/video/s3c2410fb.h
--- linux-2.6.23.old/drivers/video/s3c2410fb.h	2007-08-02 10:21:08.000000000 +0200
+++ linux-2.6.23/drivers/video/s3c2410fb.h	2007-08-03 07:16:50.000000000 +0200
@@ -26,7 +26,6 @@
 #define __S3C2410FB_H
 
 struct s3c2410fb_info {
-	struct fb_info		*fb;
 	struct device		*dev;
 	struct clk		*clk;
 

[-- Attachment #3: Type: text/plain, Size: 315 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

[-- Attachment #4: Type: text/plain, Size: 182 bytes --]

_______________________________________________
Linux-fbdev-devel mailing list
Linux-fbdev-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel

                 reply	other threads:[~2007-08-04 11:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=46b4672403046@wp.pl \
    --to=krzysztof.h1@wp.pl \
    --cc=arnaud.patard@rtp-net.org \
    --cc=ben-linux@fluff.org \
    --cc=linux-fbdev-devel@lists.sourceforge.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;
as well as URLs for NNTP newsgroup(s).