2009-06-19 20:31:41

by Krzysztof Halasa

[permalink] [raw]
Subject: Trivial fixes for drivers/gpu/drm/i915/

size_t is (some sort of) int on x86-32 and long on x86-64, eliminate
compiler warnings by casting to long.

Signed-off-by: Krzysztof Halasa <[email protected]>

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 39f5c65..d5044db 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1007,8 +1007,8 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,

mutex_lock(&dev->struct_mutex);
#if WATCH_BUF
- DRM_INFO("set_domain_ioctl %p(%d), %08x %08x\n",
- obj, obj->size, read_domains, write_domain);
+ DRM_INFO("set_domain_ioctl %p(%ld), %08x %08x\n",
+ obj, (long)obj->size, read_domains, write_domain);
#endif
if (read_domains & I915_GEM_DOMAIN_GTT) {
ret = i915_gem_object_set_to_gtt_domain(obj, write_domain != 0);
@@ -1051,8 +1051,8 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
}

#if WATCH_BUF
- DRM_INFO("%s: sw_finish %d (%p %d)\n",
- __func__, args->handle, obj, obj->size);
+ DRM_INFO("%s: sw_finish %d (%p %ld)\n",
+ __func__, args->handle, obj, (long)obj->size);
#endif
obj_priv = obj->driver_private;

@@ -2377,8 +2377,8 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
}

#if WATCH_BUF
- DRM_INFO("Binding object of size %d at 0x%08x\n",
- obj->size, obj_priv->gtt_offset);
+ DRM_INFO("Binding object of size %ld at 0x%08x\n",
+ (long)obj->size, obj_priv->gtt_offset);
#endif
ret = i915_gem_object_get_pages(obj);
if (ret) {
diff --git a/drivers/gpu/drm/i915/i915_gem_debug.c b/drivers/gpu/drm/i915/i915_gem_debug.c
index 8d0b943..88e9c3f 100644
--- a/drivers/gpu/drm/i915/i915_gem_debug.c
+++ b/drivers/gpu/drm/i915/i915_gem_debug.c
@@ -143,9 +143,9 @@ i915_gem_object_check_coherency(struct drm_gem_object *obj, int handle)
uint32_t *backing_map = NULL;
int bad_count = 0;

- DRM_INFO("%s: checking coherency of object %p@0x%08x (%d, %dkb):\n",
+ DRM_INFO("%s: checking coherency of object %p@0x%08x (%d, %ldkb):\n",
__func__, obj, obj_priv->gtt_offset, handle,
- obj->size / 1024);
+ (long)(obj->size / 1024));

gtt_mapping = ioremap(dev->agp->base + obj_priv->gtt_offset,
obj->size);

--
Krzysztof Halasa


2009-06-19 20:35:36

by Marcel Holtmann

[permalink] [raw]
Subject: Re: Trivial fixes for drivers/gpu/drm/i915/

Hi Krzysztof,

> size_t is (some sort of) int on x86-32 and long on x86-64, eliminate
> compiler warnings by casting to long.

just using %zd or %zu would do the same trick and avoid stupid casts.

Regards

Marcel

2009-06-19 21:23:20

by Randy Dunlap

[permalink] [raw]
Subject: Re: Trivial fixes for drivers/gpu/drm/i915/

Marcel Holtmann wrote:
> Hi Krzysztof,
>
>> size_t is (some sort of) int on x86-32 and long on x86-64, eliminate
>> compiler warnings by casting to long.
>
> just using %zd or %zu would do the same trick and avoid stupid casts.

I.e., using %zd or %zu is the preferred fix.

--
~Randy
LPC 2009, Sept. 23-25, Portland, Oregon
http://linuxplumbersconf.org/2009/

2009-06-19 22:22:30

by Krzysztof Halasa

[permalink] [raw]
Subject: Re: Trivial fixes for drivers/gpu/drm/i915/

Randy Dunlap <[email protected]> writes:

> I.e., using %zd or %zu is the preferred fix.

Good to know, thanks.
--
Krzysztof Halasa

2009-06-19 22:38:32

by Krzysztof Halasa

[permalink] [raw]
Subject: Re: Trivial fixes for drivers/gpu/drm/i915/ (#1 V2)

size_t is (some sort of) int on x86-32 and long on x86-64, correct
format specifiers.

Signed-off-by: Krzysztof Halasa <[email protected]>

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 39f5c65..cdaa8b6 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1007,7 +1007,7 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,

mutex_lock(&dev->struct_mutex);
#if WATCH_BUF
- DRM_INFO("set_domain_ioctl %p(%d), %08x %08x\n",
+ DRM_INFO("set_domain_ioctl %p(%zd), %08x %08x\n",
obj, obj->size, read_domains, write_domain);
#endif
if (read_domains & I915_GEM_DOMAIN_GTT) {
@@ -1051,7 +1051,7 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
}

#if WATCH_BUF
- DRM_INFO("%s: sw_finish %d (%p %d)\n",
+ DRM_INFO("%s: sw_finish %d (%p %zd)\n",
__func__, args->handle, obj, obj->size);
#endif
obj_priv = obj->driver_private;
@@ -2377,7 +2377,7 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
}

#if WATCH_BUF
- DRM_INFO("Binding object of size %d at 0x%08x\n",
+ DRM_INFO("Binding object of size %zd at 0x%08x\n",
obj->size, obj_priv->gtt_offset);
#endif
ret = i915_gem_object_get_pages(obj);
diff --git a/drivers/gpu/drm/i915/i915_gem_debug.c b/drivers/gpu/drm/i915/i915_gem_debug.c
index 8d0b943..e602614 100644
--- a/drivers/gpu/drm/i915/i915_gem_debug.c
+++ b/drivers/gpu/drm/i915/i915_gem_debug.c
@@ -143,7 +143,7 @@ i915_gem_object_check_coherency(struct drm_gem_object *obj, int handle)
uint32_t *backing_map = NULL;
int bad_count = 0;

- DRM_INFO("%s: checking coherency of object %p@0x%08x (%d, %dkb):\n",
+ DRM_INFO("%s: checking coherency of object %p@0x%08x (%d, %zdkb):\n",
__func__, obj, obj_priv->gtt_offset, handle,
obj->size / 1024);


--
Krzysztof Halasa