/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to driver/umem.c

  • Committer: Suren A. Chilingaryan
  • Date: 2016-03-02 18:37:30 UTC
  • Revision ID: csa@suren.me-20160302183730-nlrgi7h3yuizcizc
Restructure driver headers

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#include <linux/pagemap.h>
19
19
#include <linux/sched.h>
20
20
 
21
 
#include "config.h"                     /* compile-time configuration */
22
 
#include "compat.h"                     /* compatibility definitions for older linux */
23
 
#include "pciDriver.h"                  /* external interface for the driver */
24
 
#include "common.h"             /* internal definitions for all parts */
25
 
#include "umem.h"               /* prototypes for kernel memory */
26
 
#include "sysfs.h"              /* prototypes for sysfs */
 
21
#include "base.h"
27
22
 
28
23
/**
29
24
 *
109
104
    /* Lock the pages, then populate the SG list with the pages */
110
105
    /* page0 is different */
111
106
    if ( !PageReserved(pages[0]) )
112
 
        compat_lock_page(pages[0]);
 
107
        __set_page_locked(pages[0]);
113
108
 
114
109
    offset = (umem_handle->vma & ~PAGE_MASK);
115
110
    length = (umem_handle->size > (PAGE_SIZE-offset) ? (PAGE_SIZE-offset) : umem_handle->size);
120
115
    for(i=1; i<nr_pages; i++) {
121
116
        /* Lock page first */
122
117
        if ( !PageReserved(pages[i]) )
123
 
            compat_lock_page(pages[i]);
 
118
            __set_page_locked(pages[i]);
124
119
 
125
120
        /* Populate the list */
126
121
        sg_set_page(&sg[i], pages[i], ((count > PAGE_SIZE) ? PAGE_SIZE : count), 0);
169
164
    if (nr_pages > 0) {
170
165
        for(i=0; i<nr_pages; i++) {
171
166
            if (PageLocked(pages[i]))
172
 
                compat_unlock_page(pages[i]);
 
167
                __clear_page_locked(pages[i]);
173
168
            if (!PageReserved(pages[i]))
174
169
                set_page_dirty(pages[i]);
175
170
            page_cache_release(pages[i]);
201
196
            /* Mark pages as Dirty and unlock it */
202
197
            if ( !PageReserved( umem_entry->pages[i] )) {
203
198
                SetPageDirty( umem_entry->pages[i] );
204
 
                compat_unlock_page(umem_entry->pages[i]);
 
199
                __clear_page_locked(umem_entry->pages[i]);
205
200
            }
206
201
            /* and release it from the cache */
207
202
            page_cache_release( umem_entry->pages[i] );