* [U-Boot] [PATCH] video: ipu_disp: squash clang warning
@ 2014-06-16 19:41 Jeroen Hofstee
2014-06-16 19:52 ` Troy Kisky
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Jeroen Hofstee @ 2014-06-16 19:41 UTC (permalink / raw)
To: u-boot
Since &rgb2ycbcr_coeff and friends are declared const, but
assigned to a void pointer, clang will warn that the const
is implicity casted away. Add const to indicate the pointer
points to const data to get rid of these warnings.
Cc: Stefano Babic <sbabic@denx.de>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
---
drivers/video/ipu_disp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/ipu_disp.c b/drivers/video/ipu_disp.c
index cefd2dc..31b5a10 100644
--- a/drivers/video/ipu_disp.c
+++ b/drivers/video/ipu_disp.c
@@ -33,7 +33,7 @@ enum csc_type_t {
struct dp_csc_param_t {
int mode;
- void *coeff;
+ void * const coeff;
};
#define SYNC_WAVE 0
--
1.8.3.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH] video: ipu_disp: squash clang warning
2014-06-16 19:41 [U-Boot] [PATCH] video: ipu_disp: squash clang warning Jeroen Hofstee
@ 2014-06-16 19:52 ` Troy Kisky
2014-06-16 20:03 ` Jeroen Hofstee
2014-06-16 20:37 ` Jeroen Hofstee
2014-06-17 17:16 ` Jeroen Hofstee
2014-06-17 17:20 ` [U-Boot] [[PATCH v2]] " Jeroen Hofstee
2 siblings, 2 replies; 8+ messages in thread
From: Troy Kisky @ 2014-06-16 19:52 UTC (permalink / raw)
To: u-boot
On 6/16/2014 12:41 PM, Jeroen Hofstee wrote:
> Since &rgb2ycbcr_coeff and friends are declared const, but
> assigned to a void pointer, clang will warn that the const
> is implicity casted away. Add const to indicate the pointer
> points to const data to get rid of these warnings.
>
> Cc: Stefano Babic <sbabic@denx.de>
> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
> ---
> drivers/video/ipu_disp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/video/ipu_disp.c b/drivers/video/ipu_disp.c
> index cefd2dc..31b5a10 100644
> --- a/drivers/video/ipu_disp.c
> +++ b/drivers/video/ipu_disp.c
> @@ -33,7 +33,7 @@ enum csc_type_t {
>
> struct dp_csc_param_t {
> int mode;
> - void *coeff;
> + void * const coeff;
> };
>
> #define SYNC_WAVE 0
>
Doesn't this says the pointer is constant, not that it points to constant data?
So, commit log needs updated or
const void *coeff;
Troy
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH] video: ipu_disp: squash clang warning
2014-06-16 19:52 ` Troy Kisky
@ 2014-06-16 20:03 ` Jeroen Hofstee
2014-06-16 20:37 ` Jeroen Hofstee
1 sibling, 0 replies; 8+ messages in thread
From: Jeroen Hofstee @ 2014-06-16 20:03 UTC (permalink / raw)
To: u-boot
Hello Troy,
On ma, 2014-06-16 at 12:52 -0700, Troy Kisky wrote:
> On 6/16/2014 12:41 PM, Jeroen Hofstee wrote:
> > Since &rgb2ycbcr_coeff and friends are declared const, but
> > assigned to a void pointer, clang will warn that the const
> > is implicity casted away. Add const to indicate the pointer
> > points to const data to get rid of these warnings.
> >
> > Cc: Stefano Babic <sbabic@denx.de>
> > Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
> > ---
> > drivers/video/ipu_disp.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/video/ipu_disp.c b/drivers/video/ipu_disp.c
> > index cefd2dc..31b5a10 100644
> > --- a/drivers/video/ipu_disp.c
> > +++ b/drivers/video/ipu_disp.c
> > @@ -33,7 +33,7 @@ enum csc_type_t {
> >
> > struct dp_csc_param_t {
> > int mode;
> > - void *coeff;
> > + void * const coeff;
> > };
> >
> > #define SYNC_WAVE 0
> >
>
> Doesn't this says the pointer is constant, not that it points to constant data?
> So, commit log needs updated or
> const void *coeff;
yup, it does. Thanks. The patch should be updated actually.
Regards,
Jeroen
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH] video: ipu_disp: squash clang warning
2014-06-16 19:52 ` Troy Kisky
2014-06-16 20:03 ` Jeroen Hofstee
@ 2014-06-16 20:37 ` Jeroen Hofstee
2014-06-16 21:50 ` Troy Kisky
1 sibling, 1 reply; 8+ messages in thread
From: Jeroen Hofstee @ 2014-06-16 20:37 UTC (permalink / raw)
To: u-boot
On ma, 2014-06-16 at 12:52 -0700, Troy Kisky wrote:
> On 6/16/2014 12:41 PM, Jeroen Hofstee wrote:
> > Since &rgb2ycbcr_coeff and friends are declared const, but
> > assigned to a void pointer, clang will warn that the const
> > is implicity casted away. Add const to indicate the pointer
> > points to const data to get rid of these warnings.
> >
> > Cc: Stefano Babic <sbabic@denx.de>
> > Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
> > ---
> > drivers/video/ipu_disp.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/video/ipu_disp.c b/drivers/video/ipu_disp.c
> > index cefd2dc..31b5a10 100644
> > --- a/drivers/video/ipu_disp.c
> > +++ b/drivers/video/ipu_disp.c
> > @@ -33,7 +33,7 @@ enum csc_type_t {
> >
> > struct dp_csc_param_t {
> > int mode;
> > - void *coeff;
> > + void * const coeff;
> > };
> >
> > #define SYNC_WAVE 0
> >
>
> Doesn't this says the pointer is constant, not that it points to constant data?
> So, commit log needs updated or
> const void *coeff;
The reason I wrongly changed it from void const * to void * const was to
circumvent gcc complaining with:
drivers/video/ipu_disp.c: In function ?ipu_dp_csc_setup?:
drivers/video/ipu_disp.c:393:8: warning: assignment discards ?const?
qualifier from pointer target type [enabled by default]
This can be solved with:
@@ -390,7 +390,7 @@ void ipu_dp_csc_setup(int dp, struct dp_csc_param_t
dp_csc_param,
__raw_writel(reg, DP_COM_CONF());
}
- coeff = dp_csc_param.coeff;
+ coeff = (const int (*)[5][3]) dp_csc_param.coeff;
if (coeff) {
__raw_writel(mask_a((*coeff)[0][0]) |
But I am not too happy with that. Happen to know a better way?
Regards,
Jeroen
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH] video: ipu_disp: squash clang warning
2014-06-16 20:37 ` Jeroen Hofstee
@ 2014-06-16 21:50 ` Troy Kisky
0 siblings, 0 replies; 8+ messages in thread
From: Troy Kisky @ 2014-06-16 21:50 UTC (permalink / raw)
To: u-boot
On 6/16/2014 1:37 PM, Jeroen Hofstee wrote:
> On ma, 2014-06-16 at 12:52 -0700, Troy Kisky wrote:
>> On 6/16/2014 12:41 PM, Jeroen Hofstee wrote:
>>> Since &rgb2ycbcr_coeff and friends are declared const, but
>>> assigned to a void pointer, clang will warn that the const
>>> is implicity casted away. Add const to indicate the pointer
>>> points to const data to get rid of these warnings.
>>>
>>> Cc: Stefano Babic <sbabic@denx.de>
>>> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
>>> ---
>>> drivers/video/ipu_disp.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/video/ipu_disp.c b/drivers/video/ipu_disp.c
>>> index cefd2dc..31b5a10 100644
>>> --- a/drivers/video/ipu_disp.c
>>> +++ b/drivers/video/ipu_disp.c
>>> @@ -33,7 +33,7 @@ enum csc_type_t {
>>>
>>> struct dp_csc_param_t {
>>> int mode;
>>> - void *coeff;
>>> + void * const coeff;
>>> };
>>>
>>> #define SYNC_WAVE 0
>>>
>>
>> Doesn't this says the pointer is constant, not that it points to constant data?
>> So, commit log needs updated or
>> const void *coeff;
>
> The reason I wrongly changed it from void const * to void * const was to
> circumvent gcc complaining with:
>
> drivers/video/ipu_disp.c: In function ?ipu_dp_csc_setup?:
> drivers/video/ipu_disp.c:393:8: warning: assignment discards ?const?
> qualifier from pointer target type [enabled by default]
>
> This can be solved with:
>
> @@ -390,7 +390,7 @@ void ipu_dp_csc_setup(int dp, struct dp_csc_param_t
> dp_csc_param,
> __raw_writel(reg, DP_COM_CONF());
> }
> - coeff = dp_csc_param.coeff;
> + coeff = (const int (*)[5][3]) dp_csc_param.coeff;
>
> if (coeff) {
> __raw_writel(mask_a((*coeff)[0][0]) |
>
>
> But I am not too happy with that. Happen to know a better way?
>
> Regards,
> Jeroen
>
I don't know why it gets that warning. The following doesn't.
diff --git a/drivers/video/ipu_disp.c b/drivers/video/ipu_disp.c
index cefd2dc..209374f 100644
--- a/drivers/video/ipu_disp.c
+++ b/drivers/video/ipu_disp.c
@@ -31,9 +31,11 @@ enum csc_type_t {
CSC_NUM
};
+typedef int coeff_t[5][3];
+
struct dp_csc_param_t {
int mode;
- void *coeff;
+ const coeff_t *coeff;
};
#define SYNC_WAVE 0
@@ -381,7 +383,7 @@ void ipu_dp_csc_setup(int dp, struct dp_csc_param_t dp_csc_param,
unsigned char srm_mode_update)
{
u32 reg;
- const int (*coeff)[5][3];
+ const coeff_t *coeff;
if (dp_csc_param.mode >= 0) {
reg = __raw_readl(DP_COM_CONF());
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH] video: ipu_disp: squash clang warning
2014-06-16 19:41 [U-Boot] [PATCH] video: ipu_disp: squash clang warning Jeroen Hofstee
2014-06-16 19:52 ` Troy Kisky
@ 2014-06-17 17:16 ` Jeroen Hofstee
2014-06-17 17:20 ` [U-Boot] [[PATCH v2]] " Jeroen Hofstee
2 siblings, 0 replies; 8+ messages in thread
From: Jeroen Hofstee @ 2014-06-17 17:16 UTC (permalink / raw)
To: u-boot
Since rgb2ycbcr_coeff and friends are declared const, but assigned
to a void pointer, clang will warn that the const is implicity casted
away. If the pointer is changed to void const * gcc will warn when it
is implicitly casted to a const int array. Just add a correctly
typed pointer instead to prevent these casts and hence the warnings.
Cc: Troy Kisky <troy.kisky@boundarydevices.com>
Cc: Stefano Babic <sbabic@denx.de>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
---
changes since v1:
Do actually fix the warning. As pointed out by Troy Kisky
the patch was doing something different then the commit
message said.
---
drivers/video/ipu_disp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/ipu_disp.c b/drivers/video/ipu_disp.c
index cefd2dc..d5e857c 100644
--- a/drivers/video/ipu_disp.c
+++ b/drivers/video/ipu_disp.c
@@ -33,7 +33,7 @@ enum csc_type_t {
struct dp_csc_param_t {
int mode;
- void *coeff;
+ const int (*coeff)[5][3];
};
#define SYNC_WAVE 0
--
1.8.3.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [[PATCH v2]] video: ipu_disp: squash clang warning
2014-06-16 19:41 [U-Boot] [PATCH] video: ipu_disp: squash clang warning Jeroen Hofstee
2014-06-16 19:52 ` Troy Kisky
2014-06-17 17:16 ` Jeroen Hofstee
@ 2014-06-17 17:20 ` Jeroen Hofstee
2014-08-11 15:54 ` Anatolij Gustschin
2 siblings, 1 reply; 8+ messages in thread
From: Jeroen Hofstee @ 2014-06-17 17:20 UTC (permalink / raw)
To: u-boot
Since rgb2ycbcr_coeff and friends are declared const, but assigned
to a void pointer, clang will warn that the const is implicity casted
away. If the pointer is changed to void const * gcc will warn when it
is implicitly casted to a const int array. Just add a correctly
typed pointer instead to prevent these casts and hence the warnings.
Cc: Troy Kisky <troy.kisky@boundarydevices.com>
Cc: Stefano Babic <sbabic@denx.de>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
---
changes since v1:
Do actually fix the warning. As pointed out by Troy Kisky
the patch was doing something different then the commit
message said.
... and prefix subject with v2
---
drivers/video/ipu_disp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/ipu_disp.c b/drivers/video/ipu_disp.c
index cefd2dc..d5e857c 100644
--- a/drivers/video/ipu_disp.c
+++ b/drivers/video/ipu_disp.c
@@ -33,7 +33,7 @@ enum csc_type_t {
struct dp_csc_param_t {
int mode;
- void *coeff;
+ const int (*coeff)[5][3];
};
#define SYNC_WAVE 0
--
1.8.3.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [[PATCH v2]] video: ipu_disp: squash clang warning
2014-06-17 17:20 ` [U-Boot] [[PATCH v2]] " Jeroen Hofstee
@ 2014-08-11 15:54 ` Anatolij Gustschin
0 siblings, 0 replies; 8+ messages in thread
From: Anatolij Gustschin @ 2014-08-11 15:54 UTC (permalink / raw)
To: u-boot
Hi,
On Tue, 17 Jun 2014 19:20:27 +0200
Jeroen Hofstee <jeroen@myspectrum.nl> wrote:
> Since rgb2ycbcr_coeff and friends are declared const, but assigned
> to a void pointer, clang will warn that the const is implicity casted
> away. If the pointer is changed to void const * gcc will warn when it
> is implicitly casted to a const int array. Just add a correctly
> typed pointer instead to prevent these casts and hence the warnings.
>
> Cc: Troy Kisky <troy.kisky@boundarydevices.com>
> Cc: Stefano Babic <sbabic@denx.de>
> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
>
> ---
> changes since v1:
> Do actually fix the warning. As pointed out by Troy Kisky
> the patch was doing something different then the commit
> message said.
>
> ... and prefix subject with v2
> ---
> drivers/video/ipu_disp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
applied to u-boot-video/master. Thanks!
Anatolij
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-08-11 15:54 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-16 19:41 [U-Boot] [PATCH] video: ipu_disp: squash clang warning Jeroen Hofstee
2014-06-16 19:52 ` Troy Kisky
2014-06-16 20:03 ` Jeroen Hofstee
2014-06-16 20:37 ` Jeroen Hofstee
2014-06-16 21:50 ` Troy Kisky
2014-06-17 17:16 ` Jeroen Hofstee
2014-06-17 17:20 ` [U-Boot] [[PATCH v2]] " Jeroen Hofstee
2014-08-11 15:54 ` Anatolij Gustschin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox