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

Configure Feed

Select the types of activity you want to include in your feed.

fbdev: defio: Move variable state into struct fb_deferred_io_state

Move variable fields from struct fb_deferred_io into struct
fb_deferred_io_state. These fields are internal to the defio code
and should not be exposed to drivers. At some later point, struct
fb_defered_io might become const in all defio code.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Helge Deller <deller@gmx.de>

authored by

Thomas Zimmermann and committed by
Helge Deller
648bfb62 d460a54f

+22 -18
+22 -15
drivers/video/fbdev/core/fb_defio.c
··· 25 25 #include <linux/rmap.h> 26 26 #include <linux/pagemap.h> 27 27 28 + struct address_space; 29 + 28 30 /* 29 31 * struct fb_deferred_io_state 30 32 */ ··· 34 32 struct fb_deferred_io_state { 35 33 struct kref ref; 36 34 35 + int open_count; /* number of opened files; protected by fb_info lock */ 36 + struct address_space *mapping; /* page cache object for fb device */ 37 + 37 38 struct mutex lock; /* mutex that protects the pageref list */ 38 39 /* fields protected by lock */ 39 40 struct fb_info *info; 41 + struct list_head pagereflist; /* list of pagerefs for touched pages */ 40 42 }; 41 43 42 44 static struct fb_deferred_io_state *fb_deferred_io_state_alloc(void) ··· 54 48 kref_init(&fbdefio_state->ref); 55 49 mutex_init(&fbdefio_state->lock); 56 50 51 + INIT_LIST_HEAD(&fbdefio_state->pagereflist); 52 + 57 53 return fbdefio_state; 58 54 } 59 55 60 56 static void fb_deferred_io_state_release(struct fb_deferred_io_state *fbdefio_state) 61 57 { 58 + WARN_ON(!list_empty(&fbdefio_state->pagereflist)); 62 59 mutex_destroy(&fbdefio_state->lock); 63 60 64 61 kfree(fbdefio_state); ··· 156 147 struct page *page) 157 148 { 158 149 struct fb_deferred_io *fbdefio = info->fbdefio; 159 - struct list_head *pos = &fbdefio->pagereflist; 150 + struct fb_deferred_io_state *fbdefio_state = info->fbdefio_state; 151 + struct list_head *pos = &fbdefio_state->pagereflist; 160 152 struct fb_deferred_io_pageref *pageref, *cur; 161 153 162 154 pageref = fb_deferred_io_pageref_lookup(info, offset, page); ··· 181 171 * pages. If possible, drivers should try to work with 182 172 * unsorted page lists instead. 183 173 */ 184 - list_for_each_entry(cur, &fbdefio->pagereflist, list) { 174 + list_for_each_entry(cur, &fbdefio_state->pagereflist, list) { 185 175 if (cur->offset > pageref->offset) 186 176 break; 187 177 } ··· 232 222 if (!vmf->vma->vm_file) 233 223 fb_err(info, "no mapping available\n"); 234 224 235 - BUG_ON(!info->fbdefio->mapping); 225 + fb_WARN_ON_ONCE(info, !fbdefio_state->mapping); 236 226 237 227 mutex_unlock(&fbdefio_state->lock); 238 228 ··· 374 364 /* here we wrprotect the page's mappings, then do all deferred IO. */ 375 365 mutex_lock(&fbdefio_state->lock); 376 366 #ifdef CONFIG_MMU 377 - list_for_each_entry(pageref, &fbdefio->pagereflist, list) { 367 + list_for_each_entry(pageref, &fbdefio_state->pagereflist, list) { 378 368 struct page *page = pageref->page; 379 369 pgoff_t pgoff = pageref->offset >> PAGE_SHIFT; 380 370 381 - mapping_wrprotect_range(fbdefio->mapping, pgoff, 371 + mapping_wrprotect_range(fbdefio_state->mapping, pgoff, 382 372 page_to_pfn(page), 1); 383 373 } 384 374 #endif 385 375 386 376 /* driver's callback with pagereflist */ 387 - fbdefio->deferred_io(info, &fbdefio->pagereflist); 377 + fbdefio->deferred_io(info, &fbdefio_state->pagereflist); 388 378 389 379 /* clear the list */ 390 - list_for_each_entry_safe(pageref, next, &fbdefio->pagereflist, list) 380 + list_for_each_entry_safe(pageref, next, &fbdefio_state->pagereflist, list) 391 381 fb_deferred_io_pageref_put(pageref, info); 392 382 393 383 mutex_unlock(&fbdefio_state->lock); ··· 412 402 fbdefio_state->info = info; 413 403 414 404 INIT_DELAYED_WORK(&info->deferred_work, fb_deferred_io_work); 415 - INIT_LIST_HEAD(&fbdefio->pagereflist); 416 405 if (fbdefio->delay == 0) /* set a default of 1 s */ 417 406 fbdefio->delay = HZ; 418 407 ··· 440 431 struct inode *inode, 441 432 struct file *file) 442 433 { 443 - struct fb_deferred_io *fbdefio = info->fbdefio; 434 + struct fb_deferred_io_state *fbdefio_state = info->fbdefio_state; 444 435 445 - fbdefio->mapping = file->f_mapping; 436 + fbdefio_state->mapping = file->f_mapping; 446 437 file->f_mapping->a_ops = &fb_deferred_io_aops; 447 - fbdefio->open_count++; 438 + fbdefio_state->open_count++; 448 439 } 449 440 EXPORT_SYMBOL_GPL(fb_deferred_io_open); 450 441 ··· 455 446 456 447 void fb_deferred_io_release(struct fb_info *info) 457 448 { 458 - struct fb_deferred_io *fbdefio = info->fbdefio; 449 + struct fb_deferred_io_state *fbdefio_state = info->fbdefio_state; 459 450 460 - if (!--fbdefio->open_count) 451 + if (!--fbdefio_state->open_count) 461 452 fb_deferred_io_lastclose(info); 462 453 } 463 454 EXPORT_SYMBOL_GPL(fb_deferred_io_release); 464 455 465 456 void fb_deferred_io_cleanup(struct fb_info *info) 466 457 { 467 - struct fb_deferred_io *fbdefio = info->fbdefio; 468 458 struct fb_deferred_io_state *fbdefio_state = info->fbdefio_state; 469 459 470 460 fb_deferred_io_lastclose(info); ··· 477 469 fb_deferred_io_state_put(fbdefio_state); 478 470 479 471 kvfree(info->pagerefs); 480 - fbdefio->mapping = NULL; 481 472 } 482 473 EXPORT_SYMBOL_GPL(fb_deferred_io_cleanup);
-3
include/linux/fb.h
··· 217 217 /* delay between mkwrite and deferred handler */ 218 218 unsigned long delay; 219 219 bool sort_pagereflist; /* sort pagelist by offset */ 220 - int open_count; /* number of opened files; protected by fb_info lock */ 221 - struct list_head pagereflist; /* list of pagerefs for touched pages */ 222 - struct address_space *mapping; /* page cache object for fb device */ 223 220 /* callback */ 224 221 struct page *(*get_page)(struct fb_info *info, unsigned long offset); 225 222 void (*deferred_io)(struct fb_info *info, struct list_head *pagelist);