linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	airlied@gmail.com, daniel@ffwll.ch, javierm@redhat.com,
	deller@gmx.de, geert@linux-m68k.org, sudipm.mukherjee@gmail.com,
	teddy.wang@siliconmotion.com
Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH v2 08/19] fbdev/metronomefb: Use struct fb_info.screen_buffer
Date: Fri, 28 Apr 2023 14:24:41 +0200	[thread overview]
Message-ID: <20230428122452.4856-9-tzimmermann@suse.de> (raw)
In-Reply-To: <20230428122452.4856-1-tzimmermann@suse.de>

Use info->screen_buffer when reading and writing framebuffers in
system memory. It's the correct pointer for this address space.

The struct fb_info has a union to store the framebuffer memory. This can
either be info->screen_base if the framebuffer is stored in I/O memory,
or info->screen_buffer if the framebuffer is stored in system memory.

As the driver operates on the latter address space, it is wrong to use
.screen_base and .screen_buffer must be used instead. This also gets
rid of casting needed due to not using the correct data type.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/video/fbdev/metronomefb.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/video/fbdev/metronomefb.c b/drivers/video/fbdev/metronomefb.c
index 9fd4bb85d735..afa9b41f5a87 100644
--- a/drivers/video/fbdev/metronomefb.c
+++ b/drivers/video/fbdev/metronomefb.c
@@ -438,7 +438,7 @@ static void metronomefb_dpy_update(struct metronomefb_par *par)
 {
 	int fbsize;
 	u16 cksum;
-	unsigned char *buf = (unsigned char __force *)par->info->screen_base;
+	unsigned char *buf = par->info->screen_buffer;
 
 	fbsize = par->info->fix.smem_len;
 	/* copy from vm to metromem */
@@ -453,7 +453,7 @@ static u16 metronomefb_dpy_update_page(struct metronomefb_par *par, int index)
 {
 	int i;
 	u16 csum = 0;
-	u16 *buf = (u16 __force *)(par->info->screen_base + index);
+	u16 *buf = (u16 *)(par->info->screen_buffer + index);
 	u16 *img = (u16 *)(par->metromem_img + index);
 
 	/* swizzle from vm to metromem and recalc cksum at the same time*/
@@ -543,7 +543,7 @@ static ssize_t metronomefb_write(struct fb_info *info, const char __user *buf,
 		count = total_size - p;
 	}
 
-	dst = (void __force *)(info->screen_base + p);
+	dst = info->screen_buffer + p;
 
 	if (copy_from_user(dst, buf, count))
 		err = -EFAULT;
@@ -599,7 +599,7 @@ static int metronomefb_probe(struct platform_device *dev)
 		goto err;
 
 	/* we have two blocks of memory.
-	info->screen_base which is vm, and is the fb used by apps.
+	info->screen_buffer which is vm, and is the fb used by apps.
 	par->metromem which is physically contiguous memory and
 	contains the display controller commands, waveform,
 	processed image data and padding. this is the data pulled
@@ -634,7 +634,7 @@ static int metronomefb_probe(struct platform_device *dev)
 	if (!videomemory)
 		goto err_fb_rel;
 
-	info->screen_base = (char __force __iomem *)videomemory;
+	info->screen_buffer = videomemory;
 	info->fbops = &metronomefb_ops;
 
 	metronomefb_fix.line_length = fw;
@@ -756,7 +756,7 @@ static int metronomefb_remove(struct platform_device *dev)
 		fb_dealloc_cmap(&info->cmap);
 		par->board->cleanup(par);
 		vfree(par->csum_table);
-		vfree((void __force *)info->screen_base);
+		vfree(info->screen_buffer);
 		module_put(par->board->owner);
 		dev_dbg(&dev->dev, "calling release\n");
 		framebuffer_release(info);
-- 
2.40.0


  parent reply	other threads:[~2023-04-28 12:25 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-28 12:24 [PATCH v2 00/19] drm,fbdev: Use fbdev's I/O helpers Thomas Zimmermann
2023-04-28 12:24 ` [PATCH v2 01/19] auxdisplay/cfag12864bfb: Use struct fb_info.screen_buffer Thomas Zimmermann
2023-04-28 13:33   ` Javier Martinez Canillas
2023-04-28 12:24 ` [PATCH v2 02/19] auxdisplay/ht16k33: " Thomas Zimmermann
2023-04-28 13:34   ` Javier Martinez Canillas
2023-04-28 12:24 ` [PATCH v2 03/19] hid/hid-picolcd_fb: " Thomas Zimmermann
2023-04-28 13:34   ` Javier Martinez Canillas
2023-04-28 12:24 ` [PATCH v2 04/19] fbdev/arcfb: " Thomas Zimmermann
2023-04-28 13:35   ` Javier Martinez Canillas
2023-04-28 12:24 ` [PATCH v2 05/19] fbdev/au1200fb: " Thomas Zimmermann
2023-04-28 14:27   ` Javier Martinez Canillas
2023-04-28 12:24 ` [PATCH v2 06/19] fbdev/broadsheetfb: " Thomas Zimmermann
2023-04-28 14:31   ` Javier Martinez Canillas
2023-04-28 12:24 ` [PATCH v2 07/19] fbdev/hecubafb: " Thomas Zimmermann
2023-04-28 14:32   ` Javier Martinez Canillas
2023-04-28 12:24 ` Thomas Zimmermann [this message]
2023-04-28 14:36   ` [PATCH v2 08/19] fbdev/metronomefb: " Javier Martinez Canillas
2023-04-28 12:24 ` [PATCH v2 09/19] fbdev/ps3fb: " Thomas Zimmermann
2023-04-28 14:55   ` Javier Martinez Canillas
2023-04-28 12:24 ` [PATCH v2 10/19] fbdev/smscufx: " Thomas Zimmermann
2023-04-28 15:08   ` Javier Martinez Canillas
2023-04-28 12:24 ` [PATCH v2 11/19] fbdev/udlfb: " Thomas Zimmermann
2023-04-28 15:12   ` Javier Martinez Canillas
2023-04-28 12:24 ` [PATCH v2 12/19] fbdev/vfb: " Thomas Zimmermann
2023-04-28 15:12   ` Javier Martinez Canillas
2023-04-28 12:24 ` [PATCH v2 13/19] fbdev/xen-fbfront: " Thomas Zimmermann
2023-04-28 15:13   ` Javier Martinez Canillas
2023-04-28 12:24 ` [PATCH v2 14/19] fbdev: Return number of bytes read or written Thomas Zimmermann
2023-04-28 12:24 ` [PATCH v2 15/19] fbdev: Use screen_buffer in fb_sys_{read,write}() Thomas Zimmermann
2023-04-28 12:24 ` [PATCH v2 16/19] fbdev: Don't re-validate info->state in fb_ops implementations Thomas Zimmermann
2023-04-28 12:24 ` [PATCH v2 17/19] fbdev: Validate info->screen_{base,buffer} " Thomas Zimmermann
2023-05-03  9:51   ` Geert Uytterhoeven
2023-05-03 14:30     ` Thomas Zimmermann
2023-05-03 15:02       ` Geert Uytterhoeven
2023-05-03 18:21         ` Thomas Zimmermann
2023-04-28 12:24 ` [PATCH v2 18/19] fbdev: Move I/O read and write code into helper functions Thomas Zimmermann
2023-04-30 18:14   ` Sam Ravnborg
2023-05-02 16:42     ` Thomas Zimmermann
2023-04-28 12:24 ` [PATCH v2 19/19] drm/fb-helper: Use fb_{cfb,sys}_{read, write}() Thomas Zimmermann
2023-04-30 18:15   ` Sam Ravnborg

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=20230428122452.4856-9-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=geert@linux-m68k.org \
    --cc=javierm@redhat.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=sudipm.mukherjee@gmail.com \
    --cc=teddy.wang@siliconmotion.com \
    /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).