Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fbdev: Rename pagelist to pagereflist for deferred I/O

Rename various instances of pagelist to pagereflist. The list now
stores pageref structures, so the new name is more appropriate.

In their write-back helpers, several fbdev drivers refer to the
pageref list in struct fb_deferred_io instead of using the one
supplied as argument to the function. Convert them over to the
supplied one. It's the same instance, so no change of behavior
occurs.

v4:
* fix commit message (Javier)

Suggested-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220429100834.18898-5-tzimmermann@suse.de

+53 -70
+3 -4
drivers/gpu/drm/drm_fb_helper.c
··· 708 708 /** 709 709 * drm_fb_helper_deferred_io() - fbdev deferred_io callback function 710 710 * @info: fb_info struct pointer 711 - * @pagelist: list of mmap framebuffer pages that have to be flushed 711 + * @pagereflist: list of mmap framebuffer pages that have to be flushed 712 712 * 713 713 * This function is used as the &fb_deferred_io.deferred_io 714 714 * callback function for flushing the fbdev mmap writes. 715 715 */ 716 - void drm_fb_helper_deferred_io(struct fb_info *info, 717 - struct list_head *pagelist) 716 + void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagereflist) 718 717 { 719 718 unsigned long start, end, min, max; 720 719 struct fb_deferred_io_pageref *pageref; ··· 721 722 722 723 min = ULONG_MAX; 723 724 max = 0; 724 - list_for_each_entry(pageref, pagelist, list) { 725 + list_for_each_entry(pageref, pagereflist, list) { 725 726 start = pageref->offset; 726 727 end = start + PAGE_SIZE; 727 728 min = min(min, start);
+2 -3
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
··· 316 316 return 0; 317 317 } 318 318 319 - static void vmw_deferred_io(struct fb_info *info, 320 - struct list_head *pagelist) 319 + static void vmw_deferred_io(struct fb_info *info, struct list_head *pagereflist) 321 320 { 322 321 struct vmw_fb_par *par = info->par; 323 322 unsigned long start, end, min, max; ··· 326 327 327 328 min = ULONG_MAX; 328 329 max = 0; 329 - list_for_each_entry(pageref, pagelist, list) { 330 + list_for_each_entry(pageref, pagereflist, list) { 330 331 struct page *page = pageref->page; 331 332 start = page->index << PAGE_SHIFT; 332 333 end = start + PAGE_SIZE - 1;
+1 -1
drivers/hid/hid-picolcd_fb.c
··· 433 433 434 434 435 435 /* Callback from deferred IO workqueue */ 436 - static void picolcd_fb_deferred_io(struct fb_info *info, struct list_head *pagelist) 436 + static void picolcd_fb_deferred_io(struct fb_info *info, struct list_head *pagereflist) 437 437 { 438 438 picolcd_fb_update(info); 439 439 }
+5 -5
drivers/staging/fbtft/fbtft-core.c
··· 322 322 schedule_delayed_work(&info->deferred_work, fbdefio->delay); 323 323 } 324 324 325 - static void fbtft_deferred_io(struct fb_info *info, struct list_head *pagelist) 325 + static void fbtft_deferred_io(struct fb_info *info, struct list_head *pagereflist) 326 326 { 327 327 struct fbtft_par *par = info->par; 328 328 unsigned int dirty_lines_start, dirty_lines_end; ··· 340 340 spin_unlock(&par->dirty_lock); 341 341 342 342 /* Mark display lines as dirty */ 343 - list_for_each_entry(pageref, pagelist, list) { 343 + list_for_each_entry(pageref, pagereflist, list) { 344 344 struct page *page = pageref->page; 345 345 count++; 346 346 index = page->index << PAGE_SHIFT; ··· 655 655 fbops->fb_blank = fbtft_fb_blank; 656 656 fbops->fb_mmap = fb_deferred_io_mmap; 657 657 658 - fbdefio->delay = HZ / fps; 659 - fbdefio->sort_pagelist = true; 660 - fbdefio->deferred_io = fbtft_deferred_io; 658 + fbdefio->delay = HZ / fps; 659 + fbdefio->sort_pagereflist = true; 660 + fbdefio->deferred_io = fbtft_deferred_io; 661 661 fb_deferred_io_init(info); 662 662 663 663 snprintf(info->fix.id, sizeof(info->fix.id), "%s", dev->driver->name);
+5 -7
drivers/video/fbdev/broadsheetfb.c
··· 929 929 } 930 930 931 931 /* this is called back from the deferred io workqueue */ 932 - static void broadsheetfb_dpy_deferred_io(struct fb_info *info, 933 - struct list_head *pagelist) 932 + static void broadsheetfb_dpy_deferred_io(struct fb_info *info, struct list_head *pagereflist) 934 933 { 935 934 u16 y1 = 0, h = 0; 936 935 int prev_index = -1; 937 936 struct fb_deferred_io_pageref *pageref; 938 - struct fb_deferred_io *fbdefio = info->fbdefio; 939 937 int h_inc; 940 938 u16 yres = info->var.yres; 941 939 u16 xres = info->var.xres; ··· 942 944 h_inc = DIV_ROUND_UP(PAGE_SIZE , xres); 943 945 944 946 /* walk the written page list and swizzle the data */ 945 - list_for_each_entry(pageref, &fbdefio->pagelist, list) { 947 + list_for_each_entry(pageref, pagereflist, list) { 946 948 struct page *cur = pageref->page; 947 949 if (prev_index < 0) { 948 950 /* just starting so assign first page */ ··· 1058 1060 }; 1059 1061 1060 1062 static struct fb_deferred_io broadsheetfb_defio = { 1061 - .delay = HZ/4, 1062 - .sort_pagelist = true, 1063 - .deferred_io = broadsheetfb_dpy_deferred_io, 1063 + .delay = HZ/4, 1064 + .sort_pagereflist = true, 1065 + .deferred_io = broadsheetfb_dpy_deferred_io, 1064 1066 }; 1065 1067 1066 1068 static int broadsheetfb_probe(struct platform_device *dev)
+9 -9
drivers/video/fbdev/core/fb_defio.c
··· 41 41 struct page *page) 42 42 { 43 43 struct fb_deferred_io *fbdefio = info->fbdefio; 44 - struct list_head *pos = &fbdefio->pagelist; 44 + struct list_head *pos = &fbdefio->pagereflist; 45 45 unsigned long pgoff = offset >> PAGE_SHIFT; 46 46 struct fb_deferred_io_pageref *pageref, *cur; 47 47 ··· 63 63 pageref->page = page; 64 64 pageref->offset = pgoff << PAGE_SHIFT; 65 65 66 - if (unlikely(fbdefio->sort_pagelist)) { 66 + if (unlikely(fbdefio->sort_pagereflist)) { 67 67 /* 68 68 * We loop through the list of pagerefs before adding in 69 69 * order to keep the pagerefs sorted. This has significant ··· 71 71 * pages. If possible, drivers should try to work with 72 72 * unsorted page lists instead. 73 73 */ 74 - list_for_each_entry(cur, &info->fbdefio->pagelist, list) { 74 + list_for_each_entry(cur, &fbdefio->pagereflist, list) { 75 75 if (cur->offset > pageref->offset) 76 76 break; 77 77 } ··· 158 158 mutex_lock(&fbdefio->lock); 159 159 160 160 /* first write in this cycle, notify the driver */ 161 - if (fbdefio->first_io && list_empty(&fbdefio->pagelist)) 161 + if (fbdefio->first_io && list_empty(&fbdefio->pagereflist)) 162 162 fbdefio->first_io(info); 163 163 164 164 pageref = fb_deferred_io_pageref_get(info, offset, page); ··· 249 249 250 250 /* here we mkclean the pages, then do all deferred IO */ 251 251 mutex_lock(&fbdefio->lock); 252 - list_for_each_entry(pageref, &fbdefio->pagelist, list) { 252 + list_for_each_entry(pageref, &fbdefio->pagereflist, list) { 253 253 struct page *cur = pageref->page; 254 254 lock_page(cur); 255 255 page_mkclean(cur); 256 256 unlock_page(cur); 257 257 } 258 258 259 - /* driver's callback with pagelist */ 260 - fbdefio->deferred_io(info, &fbdefio->pagelist); 259 + /* driver's callback with pagereflist */ 260 + fbdefio->deferred_io(info, &fbdefio->pagereflist); 261 261 262 262 /* clear the list */ 263 - list_for_each_entry_safe(pageref, next, &fbdefio->pagelist, list) 263 + list_for_each_entry_safe(pageref, next, &fbdefio->pagereflist, list) 264 264 fb_deferred_io_pageref_put(pageref, info); 265 265 266 266 mutex_unlock(&fbdefio->lock); ··· 280 280 281 281 mutex_init(&fbdefio->lock); 282 282 INIT_DELAYED_WORK(&info->deferred_work, fb_deferred_io_work); 283 - INIT_LIST_HEAD(&fbdefio->pagelist); 283 + INIT_LIST_HEAD(&fbdefio->pagereflist); 284 284 if (fbdefio->delay == 0) /* set a default of 1 s */ 285 285 fbdefio->delay = HZ; 286 286
+1 -2
drivers/video/fbdev/hecubafb.c
··· 115 115 } 116 116 117 117 /* this is called back from the deferred io workqueue */ 118 - static void hecubafb_dpy_deferred_io(struct fb_info *info, 119 - struct list_head *pagelist) 118 + static void hecubafb_dpy_deferred_io(struct fb_info *info, struct list_head *pagereflist) 120 119 { 121 120 hecubafb_dpy_update(info->par); 122 121 }
+2 -3
drivers/video/fbdev/hyperv_fb.c
··· 420 420 } 421 421 422 422 /* Deferred IO callback */ 423 - static void synthvid_deferred_io(struct fb_info *p, 424 - struct list_head *pagelist) 423 + static void synthvid_deferred_io(struct fb_info *p, struct list_head *pagereflist) 425 424 { 426 425 struct hvfb_par *par = p->par; 427 426 struct fb_deferred_io_pageref *pageref; ··· 436 437 * in synthvid_update function by clamping the y2 437 438 * value to yres. 438 439 */ 439 - list_for_each_entry(pageref, pagelist, list) { 440 + list_for_each_entry(pageref, pagereflist, list) { 440 441 struct page *page = pageref->page; 441 442 start = page->index << PAGE_SHIFT; 442 443 end = start + PAGE_SIZE - 1;
+5 -7
drivers/video/fbdev/metronomefb.c
··· 465 465 } 466 466 467 467 /* this is called back from the deferred io workqueue */ 468 - static void metronomefb_dpy_deferred_io(struct fb_info *info, 469 - struct list_head *pagelist) 468 + static void metronomefb_dpy_deferred_io(struct fb_info *info, struct list_head *pagereflist) 470 469 { 471 470 u16 cksum; 472 471 struct fb_deferred_io_pageref *pageref; 473 - struct fb_deferred_io *fbdefio = info->fbdefio; 474 472 struct metronomefb_par *par = info->par; 475 473 476 474 /* walk the written page list and swizzle the data */ 477 - list_for_each_entry(pageref, &fbdefio->pagelist, list) { 475 + list_for_each_entry(pageref, pagereflist, list) { 478 476 struct page *cur = pageref->page; 479 477 cksum = metronomefb_dpy_update_page(par, 480 478 (cur->index << PAGE_SHIFT)); ··· 567 569 }; 568 570 569 571 static struct fb_deferred_io metronomefb_defio = { 570 - .delay = HZ, 571 - .sort_pagelist = true, 572 - .deferred_io = metronomefb_dpy_deferred_io, 572 + .delay = HZ, 573 + .sort_pagereflist = true, 574 + .deferred_io = metronomefb_dpy_deferred_io, 573 575 }; 574 576 575 577 static int metronomefb_probe(struct platform_device *dev)
+7 -9
drivers/video/fbdev/sh_mobile_lcdcfb.c
··· 435 435 .read_data = lcdc_sys_read_data, 436 436 }; 437 437 438 - static int sh_mobile_lcdc_sginit(struct fb_info *info, 439 - struct list_head *pagelist) 438 + static int sh_mobile_lcdc_sginit(struct fb_info *info, struct list_head *pagereflist) 440 439 { 441 440 struct sh_mobile_lcdc_chan *ch = info->par; 442 441 unsigned int nr_pages_max = ch->fb_size >> PAGE_SHIFT; ··· 444 445 445 446 sg_init_table(ch->sglist, nr_pages_max); 446 447 447 - list_for_each_entry(pageref, pagelist, list) { 448 + list_for_each_entry(pageref, pagereflist, list) { 448 449 struct page *page = pageref->page; 449 450 sg_set_page(&ch->sglist[nr_pages++], page, PAGE_SIZE, 0); 450 451 } ··· 452 453 return nr_pages; 453 454 } 454 455 455 - static void sh_mobile_lcdc_deferred_io(struct fb_info *info, 456 - struct list_head *pagelist) 456 + static void sh_mobile_lcdc_deferred_io(struct fb_info *info, struct list_head *pagereflist) 457 457 { 458 458 struct sh_mobile_lcdc_chan *ch = info->par; 459 459 const struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg->panel_cfg; ··· 461 463 sh_mobile_lcdc_clk_on(ch->lcdc); 462 464 463 465 /* 464 - * It's possible to get here without anything on the pagelist via 466 + * It's possible to get here without anything on the pagereflist via 465 467 * sh_mobile_lcdc_deferred_io_touch() or via a userspace fsync() 466 468 * invocation. In the former case, the acceleration routines are 467 469 * stepped in to when using the framebuffer console causing the ··· 471 473 * acceleration routines have their own methods for writing in 472 474 * that still need to be updated. 473 475 * 474 - * The fsync() and empty pagelist case could be optimized for, 476 + * The fsync() and empty pagereflist case could be optimized for, 475 477 * but we don't bother, as any application exhibiting such 476 478 * behaviour is fundamentally broken anyways. 477 479 */ 478 - if (!list_empty(pagelist)) { 479 - unsigned int nr_pages = sh_mobile_lcdc_sginit(info, pagelist); 480 + if (!list_empty(pagereflist)) { 481 + unsigned int nr_pages = sh_mobile_lcdc_sginit(info, pagereflist); 480 482 481 483 /* trigger panel update */ 482 484 dma_map_sg(ch->lcdc->dev, ch->sglist, nr_pages, DMA_TO_DEVICE);
+3 -5
drivers/video/fbdev/smscufx.c
··· 955 955 * Touching ANY framebuffer memory that triggers a page fault 956 956 * in fb_defio will cause a deadlock, when it also tries to 957 957 * grab the same mutex. */ 958 - static void ufx_dpy_deferred_io(struct fb_info *info, 959 - struct list_head *pagelist) 958 + static void ufx_dpy_deferred_io(struct fb_info *info, struct list_head *pagereflist) 960 959 { 961 - struct fb_deferred_io_pageref *pageref; 962 - struct fb_deferred_io *fbdefio = info->fbdefio; 963 960 struct ufx_data *dev = info->par; 961 + struct fb_deferred_io_pageref *pageref; 964 962 965 963 if (!fb_defio) 966 964 return; ··· 967 969 return; 968 970 969 971 /* walk the written page list and render each to device */ 970 - list_for_each_entry(pageref, &fbdefio->pagelist, list) { 972 + list_for_each_entry(pageref, pagereflist, list) { 971 973 /* create a rectangle of full screen width that encloses the 972 974 * entire dirty framebuffer page */ 973 975 struct page *cur = pageref->page;
+1 -2
drivers/video/fbdev/ssd1307fb.c
··· 371 371 .fb_mmap = fb_deferred_io_mmap, 372 372 }; 373 373 374 - static void ssd1307fb_deferred_io(struct fb_info *info, 375 - struct list_head *pagelist) 374 + static void ssd1307fb_deferred_io(struct fb_info *info, struct list_head *pagereflist) 376 375 { 377 376 ssd1307fb_update_display(info->par); 378 377 }
+3 -5
drivers/video/fbdev/udlfb.c
··· 781 781 * in fb_defio will cause a deadlock, when it also tries to 782 782 * grab the same mutex. 783 783 */ 784 - static void dlfb_dpy_deferred_io(struct fb_info *info, 785 - struct list_head *pagelist) 784 + static void dlfb_dpy_deferred_io(struct fb_info *info, struct list_head *pagereflist) 786 785 { 787 786 struct fb_deferred_io_pageref *pageref; 788 - struct fb_deferred_io *fbdefio = info->fbdefio; 789 787 struct dlfb_data *dlfb = info->par; 790 788 struct urb *urb; 791 789 char *cmd; ··· 809 811 cmd = urb->transfer_buffer; 810 812 811 813 /* walk the written page list and render each to device */ 812 - list_for_each_entry(pageref, &fbdefio->pagelist, list) { 814 + list_for_each_entry(pageref, pagereflist, list) { 813 815 struct page *cur = pageref->page; 814 816 815 817 if (dlfb_render_hline(dlfb, &urb, (char *) info->fix.smem_start, ··· 982 984 983 985 if (fbdefio) { 984 986 fbdefio->delay = DL_DEFIO_WRITE_DELAY; 985 - fbdefio->sort_pagelist = true; 987 + fbdefio->sort_pagereflist = true; 986 988 fbdefio->deferred_io = dlfb_dpy_deferred_io; 987 989 } 988 990
+2 -3
drivers/video/fbdev/xen-fbfront.c
··· 181 181 xenfb_do_update(info, x1, y1, x2 - x1 + 1, y2 - y1 + 1); 182 182 } 183 183 184 - static void xenfb_deferred_io(struct fb_info *fb_info, 185 - struct list_head *pagelist) 184 + static void xenfb_deferred_io(struct fb_info *fb_info, struct list_head *pagereflist) 186 185 { 187 186 struct xenfb_info *info = fb_info->par; 188 187 struct fb_deferred_io_pageref *pageref; ··· 190 191 191 192 miny = INT_MAX; 192 193 maxy = 0; 193 - list_for_each_entry(pageref, pagelist, list) { 194 + list_for_each_entry(pageref, pagereflist, list) { 194 195 struct page *page = pageref->page; 195 196 beg = page->index << PAGE_SHIFT; 196 197 end = beg + PAGE_SIZE - 1;
+1 -2
include/drm/drm_fb_helper.h
··· 229 229 struct drm_fb_helper *fb_helper, 230 230 struct drm_fb_helper_surface_size *sizes); 231 231 232 - void drm_fb_helper_deferred_io(struct fb_info *info, 233 - struct list_head *pagelist); 232 + void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagereflist); 234 233 235 234 ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf, 236 235 size_t count, loff_t *ppos);
+3 -3
include/linux/fb.h
··· 211 211 struct fb_deferred_io { 212 212 /* delay between mkwrite and deferred handler */ 213 213 unsigned long delay; 214 - bool sort_pagelist; /* sort pagelist by offset */ 215 - struct mutex lock; /* mutex that protects the page list */ 216 - struct list_head pagelist; /* list of touched pages */ 214 + bool sort_pagereflist; /* sort pagelist by offset */ 215 + struct mutex lock; /* mutex that protects the pageref list */ 216 + struct list_head pagereflist; /* list of pagerefs for touched pages */ 217 217 /* callback */ 218 218 void (*first_io)(struct fb_info *info); 219 219 void (*deferred_io)(struct fb_info *info, struct list_head *pagelist);