From: "Christian König" <christian.koenig@amd.com>
To: Paul Bolle <pebolle@tiscali.nl>,
Alex Deucher <alexander.deucher@amd.com>,
David Airlie <airlied@linux.ie>
Cc: Thierry Reding <thierry.reding@gmail.com>,
Ilia Mirkin <imirkin@alum.mit.edu>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] drm/radeon: silence GCC warning on 32 bit
Date: Tue, 4 Mar 2014 12:42:13 +0100 [thread overview]
Message-ID: <5315BC15.2050003@amd.com> (raw)
In-Reply-To: <1393925688.3038.22.camel@x220>
Am 04.03.2014 10:34, schrieb Paul Bolle:
> Building radeon_ttm.o on 32 bit x86 triggers a warning:
> In file included from include/asm-generic/bug.h:13:0,
> from [...]/arch/x86/include/asm/bug.h:38,
> from include/linux/bug.h:4,
> from include/drm/drm_mm.h:39,
> from include/drm/drm_vma_manager.h:26,
> from include/drm/ttm/ttm_bo_api.h:35,
> from drivers/gpu/drm/radeon/radeon_ttm.c:32:
> drivers/gpu/drm/radeon/radeon_ttm.c: In function 'radeon_ttm_gtt_read':
> include/linux/kernel.h:712:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
> (void) (&_min1 == &_min2); \
> ^
> drivers/gpu/drm/radeon/radeon_ttm.c:938:22: note: in expansion of macro 'min'
> ssize_t cur_size = min(size, PAGE_SIZE - off);
> ^
>
> Silence this warning by using min_t(). Since cur_size will never be
> negative and its upper bound is PAGE_SIZE, we can change its type to
> size_t and use min_t(size_t, [...]) here.
>
> Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
> v2: use min_t() as Ilia suggested, and convert cur_size to size_t, as
> Thierry suggested.
>
> Still compile tested only (on 32 and 64 bit x86).
>
> drivers/gpu/drm/radeon/radeon_ttm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
> index 77f5b0c..1ce6ba6 100644
> --- a/drivers/gpu/drm/radeon/radeon_ttm.c
> +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
> @@ -935,7 +935,7 @@ static ssize_t radeon_ttm_gtt_read(struct file *f, char __user *buf,
> while (size) {
> loff_t p = *pos / PAGE_SIZE;
> unsigned off = *pos & ~PAGE_MASK;
> - ssize_t cur_size = min(size, PAGE_SIZE - off);
> + size_t cur_size = min_t(size_t, size, PAGE_SIZE - off);
> struct page *page;
> void *ptr;
>
WARNING: multiple messages have this Message-ID (diff)
From: "Christian König" <christian.koenig@amd.com>
To: Paul Bolle <pebolle@tiscali.nl>,
Alex Deucher <alexander.deucher@amd.com>,
David Airlie <airlied@linux.ie>
Cc: Thierry Reding <thierry.reding@gmail.com>,
Ilia Mirkin <imirkin@alum.mit.edu>,
<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] drm/radeon: silence GCC warning on 32 bit
Date: Tue, 4 Mar 2014 12:42:13 +0100 [thread overview]
Message-ID: <5315BC15.2050003@amd.com> (raw)
In-Reply-To: <1393925688.3038.22.camel@x220>
Am 04.03.2014 10:34, schrieb Paul Bolle:
> Building radeon_ttm.o on 32 bit x86 triggers a warning:
> In file included from include/asm-generic/bug.h:13:0,
> from [...]/arch/x86/include/asm/bug.h:38,
> from include/linux/bug.h:4,
> from include/drm/drm_mm.h:39,
> from include/drm/drm_vma_manager.h:26,
> from include/drm/ttm/ttm_bo_api.h:35,
> from drivers/gpu/drm/radeon/radeon_ttm.c:32:
> drivers/gpu/drm/radeon/radeon_ttm.c: In function 'radeon_ttm_gtt_read':
> include/linux/kernel.h:712:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
> (void) (&_min1 == &_min2); \
> ^
> drivers/gpu/drm/radeon/radeon_ttm.c:938:22: note: in expansion of macro 'min'
> ssize_t cur_size = min(size, PAGE_SIZE - off);
> ^
>
> Silence this warning by using min_t(). Since cur_size will never be
> negative and its upper bound is PAGE_SIZE, we can change its type to
> size_t and use min_t(size_t, [...]) here.
>
> Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
> v2: use min_t() as Ilia suggested, and convert cur_size to size_t, as
> Thierry suggested.
>
> Still compile tested only (on 32 and 64 bit x86).
>
> drivers/gpu/drm/radeon/radeon_ttm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
> index 77f5b0c..1ce6ba6 100644
> --- a/drivers/gpu/drm/radeon/radeon_ttm.c
> +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
> @@ -935,7 +935,7 @@ static ssize_t radeon_ttm_gtt_read(struct file *f, char __user *buf,
> while (size) {
> loff_t p = *pos / PAGE_SIZE;
> unsigned off = *pos & ~PAGE_MASK;
> - ssize_t cur_size = min(size, PAGE_SIZE - off);
> + size_t cur_size = min_t(size_t, size, PAGE_SIZE - off);
> struct page *page;
> void *ptr;
>
next prev parent reply other threads:[~2014-03-04 11:42 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-30 2:49 [git pull] drm next tree Dave Airlie
2014-01-30 2:49 ` Dave Airlie
2014-01-30 4:54 ` Linus Torvalds
2014-01-30 4:54 ` Linus Torvalds
2014-01-30 12:33 ` Paul Bolle
2014-01-30 12:33 ` Paul Bolle
2014-02-20 21:02 ` [PATCH] drm/radeon: silence GCC warning on 32 bit Paul Bolle
2014-02-20 21:07 ` Ilia Mirkin
2014-02-20 21:07 ` Ilia Mirkin
2014-02-20 21:24 ` Paul Bolle
2014-02-21 8:20 ` Thierry Reding
2014-02-21 8:20 ` Thierry Reding
2014-03-04 9:34 ` [PATCH v2] " Paul Bolle
2014-03-04 9:34 ` Paul Bolle
2014-03-04 11:42 ` Christian König [this message]
2014-03-04 11:42 ` Christian König
2014-03-04 14:52 ` Alex Deucher
2014-03-04 14:52 ` Alex Deucher
2014-01-30 15:55 ` [git pull] drm next tree Jiri Kosina
2014-02-07 10:08 ` Jiri Kosina
2014-02-07 10:08 ` Jiri Kosina
2014-02-07 11:10 ` Jani Nikula
2014-02-07 13:40 ` Jiri Kosina
2014-02-07 13:40 ` Jiri Kosina
2014-02-07 14:05 ` Daniel Vetter
2014-02-07 14:05 ` Daniel Vetter
2014-02-07 14:15 ` Jiri Kosina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5315BC15.2050003@amd.com \
--to=christian.koenig@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=imirkin@alum.mit.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=pebolle@tiscali.nl \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.