]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: io unmap functions want __iomem
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 1 Sep 2017 17:12:52 +0000 (20:12 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 4 Sep 2017 16:31:55 +0000 (19:31 +0300)
Don't cast away the __iomem from the io_mapping functions so that
sparse won't be so unhappy when we pass the pointer to the unmap
functions. Instead let's move the cast to where we actually use the
pointer.

Fixes the following sparse warnings:
i915_gem.c:1022:33: warning: incorrect type in argument 1 (different address spaces)
i915_gem.c:1022:33:    expected void [noderef] <asn:2>*vaddr
i915_gem.c:1022:33:    got void *[assigned] vaddr
i915_gem.c:1027:34: warning: incorrect type in argument 1 (different address spaces)
i915_gem.c:1027:34:    expected void [noderef] <asn:2>*vaddr
i915_gem.c:1027:34:    got void *[assigned] vaddr
i915_gem.c:1199:33: warning: incorrect type in argument 1 (different address spaces)
i915_gem.c:1199:33:    expected void [noderef] <asn:2>*vaddr
i915_gem.c:1199:33:    got void *[assigned] vaddr
i915_gem.c:1204:34: warning: incorrect type in argument 1 (different address spaces)
i915_gem.c:1204:34:    expected void [noderef] <asn:2>*vaddr
i915_gem.c:1204:34:    got void *[assigned] vaddr

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170901171252.31025-2-ville.syrjala@linux.intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/i915_gem.c

index 945c4650c249f9d93a2ca78f5b7a2f132222f175..72008e4c8c8ff82b432607b0afee4222dabc85f1 100644 (file)
@@ -1013,17 +1013,20 @@ gtt_user_read(struct io_mapping *mapping,
              loff_t base, int offset,
              char __user *user_data, int length)
 {
-       void *vaddr;
+       void __iomem *vaddr;
        unsigned long unwritten;
 
        /* We can use the cpu mem copy function because this is X86. */
-       vaddr = (void __force *)io_mapping_map_atomic_wc(mapping, base);
-       unwritten = __copy_to_user_inatomic(user_data, vaddr + offset, length);
+       vaddr = io_mapping_map_atomic_wc(mapping, base);
+       unwritten = __copy_to_user_inatomic(user_data,
+                                           (void __force *)vaddr + offset,
+                                           length);
        io_mapping_unmap_atomic(vaddr);
        if (unwritten) {
-               vaddr = (void __force *)
-                       io_mapping_map_wc(mapping, base, PAGE_SIZE);
-               unwritten = copy_to_user(user_data, vaddr + offset, length);
+               vaddr = io_mapping_map_wc(mapping, base, PAGE_SIZE);
+               unwritten = copy_to_user(user_data,
+                                        (void __force *)vaddr + offset,
+                                        length);
                io_mapping_unmap(vaddr);
        }
        return unwritten;
@@ -1189,18 +1192,18 @@ ggtt_write(struct io_mapping *mapping,
           loff_t base, int offset,
           char __user *user_data, int length)
 {
-       void *vaddr;
+       void __iomem *vaddr;
        unsigned long unwritten;
 
        /* We can use the cpu mem copy function because this is X86. */
-       vaddr = (void __force *)io_mapping_map_atomic_wc(mapping, base);
-       unwritten = __copy_from_user_inatomic_nocache(vaddr + offset,
+       vaddr = io_mapping_map_atomic_wc(mapping, base);
+       unwritten = __copy_from_user_inatomic_nocache((void __force *)vaddr + offset,
                                                      user_data, length);
        io_mapping_unmap_atomic(vaddr);
        if (unwritten) {
-               vaddr = (void __force *)
-                       io_mapping_map_wc(mapping, base, PAGE_SIZE);
-               unwritten = copy_from_user(vaddr + offset, user_data, length);
+               vaddr = io_mapping_map_wc(mapping, base, PAGE_SIZE);
+               unwritten = copy_from_user((void __force *)vaddr + offset,
+                                          user_data, length);
                io_mapping_unmap(vaddr);
        }