Linux Samsung SOC development
 help / color / mirror / Atom feed
From: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
To: Inki Dae <inki.dae@samsung.com>, Emil Velikov <emil.l.velikov@gmail.com>
Cc: "moderated list:ARM/S5P EXYNOS AR..."
	<linux-samsung-soc@vger.kernel.org>,
	gustavo.padovan@collabora.co.uk,
	ML dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 10/14] exynos/fimg2d: remove default case from g2d_get_blend_op()
Date: Wed, 02 Sep 2015 21:35:49 +0200	[thread overview]
Message-ID: <55E74F95.5050105@math.uni-bielefeld.de> (raw)
In-Reply-To: <55E4F3BA.4010709@samsung.com>

Hello Inki,


Inki Dae wrote:
> On 2015년 09월 01일 03:53, Emil Velikov wrote:
>> On 31 August 2015 at 14:25, Inki Dae <inki.dae@samsung.com> wrote:
>>> On 2015년 08월 24일 23:14, Tobias Jakobi wrote:
>>>> We now validate the blending mode via g2d_validate_mode()
>>>> prior to feeding it to g2d_get_blend_op().
>>>>
>>>> Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
>>>> ---
>>>>  exynos/exynos_fimg2d.c | 5 -----
>>>>  1 file changed, 5 deletions(-)
>>>>
>>>> diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
>>>> index 4274a94..d708e91 100644
>>>> --- a/exynos/exynos_fimg2d.c
>>>> +++ b/exynos/exynos_fimg2d.c
>>>> @@ -91,11 +91,6 @@ static unsigned int g2d_get_blend_op(enum e_g2d_op op)
>>>>               SET_BF(val, G2D_COEFF_MODE_SRC_ALPHA, 0, 0, 0,
>>>>                               G2D_COEFF_MODE_SRC_ALPHA, 1, 0, 0);
>>>>               break;
>>>> -     default:
>>>> -             fprintf(stderr, "Not support operation(%d).\n", op);
>>>> -             SET_BF(val, G2D_COEFF_MODE_ONE, 0, 0, 0, G2D_COEFF_MODE_ZERO,
>>>> -                             0, 0, 0);
>>>> -             break;
>>>
>>> With this, how about changing above switch and case statement to if
>>> statement?
>>>
>> Out of curiosity: why is if/else statement preferred - won't it make
>> things longer/harder to read (there are 11 cases here) ?
> 
> Just looks strange to me switch and case statement has no default
> statement. This is just my opinion and trivial.
I would like to keep the switch statement here. As Emil has pointed out
the big advantage of switch is that the compiler can warn us if we're
not dealing with a value of an enum. I think that's definitely a feature
which we want here.

I would suggest instead this: I add a short comment to the switch making
clear why we don't have a default case here and that a user of
g2d_get_blend_op() should first validate any data passed to it.

With best wishes,
Tobias


> 
> Thanks,
> Inki Dae
> 
>>
>> Cheers,
>> Emil
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2015-09-02 19:35 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-24 14:13 [PATCH 00/14] drm/exynos: rewrite fimg2d error handling Tobias Jakobi
2015-08-24 14:13 ` [PATCH 01/14] exynos/fimg2d: fix empty buffer handling in g2d_flush() Tobias Jakobi
2015-08-24 14:13 ` [PATCH 02/14] exynos/fimg2d: simplify base address submission in g2d_scale_and_blend() Tobias Jakobi
2015-08-24 14:13 ` [PATCH 03/14] exynos/fimg2d: add g2d_check_space() Tobias Jakobi
2015-08-24 14:13 ` [PATCH 04/14] exynos/fimg2d: check buffer space in g2d_solid_fill() Tobias Jakobi
2015-08-31 13:01   ` Inki Dae
2015-08-31 19:27     ` Tobias Jakobi
2015-08-31 19:57       ` Emil Velikov
2015-09-01  0:41         ` Inki Dae
2015-08-24 14:14 ` [PATCH 05/14] exynos/fimg2d: check buffer space in g2d_copy() Tobias Jakobi
2015-08-31 13:06   ` Inki Dae
2015-08-24 14:14 ` [PATCH 06/14] exynos/fimg2d: check buffer space in g2d_copy_with_scale() Tobias Jakobi
2015-08-24 14:14 ` [PATCH 07/14] exynos/fimg2d: add g2d_validate_xyz() functions Tobias Jakobi
2015-08-31 13:18   ` Inki Dae
2015-08-31 18:45     ` Emil Velikov
2015-08-31 19:31       ` Tobias Jakobi
2015-08-24 14:14 ` [PATCH 08/14] exynos/fimg2d: check buffer space in g2d_blend() Tobias Jakobi
2015-08-31 13:19   ` Inki Dae
2015-08-24 14:14 ` [PATCH 09/14] exynos/fimg2d: check buffer space in g2d_scale_and_blend() Tobias Jakobi
2015-08-31 13:20   ` Inki Dae
2015-08-24 14:14 ` [PATCH 10/14] exynos/fimg2d: remove default case from g2d_get_blend_op() Tobias Jakobi
2015-08-31 13:25   ` Inki Dae
2015-08-31 18:53     ` Emil Velikov
2015-09-01  0:39       ` Inki Dae
2015-09-02 19:35         ` Tobias Jakobi [this message]
2015-08-24 14:14 ` [PATCH 11/14] exynos/fimg2d: remove superfluous initialization of g2d_point_val Tobias Jakobi
2015-08-24 14:14 ` [PATCH 12/14] exynos/fimg2d: make g2d_add_cmd() less heavy Tobias Jakobi
2015-08-24 14:14 ` [PATCH 13/14] exynos/fimg2d: add message prefix Tobias Jakobi
2015-08-27 17:21 ` [PATCH 00/14] drm/exynos: rewrite fimg2d error handling Emil Velikov
2015-08-27 20:46   ` Tobias Jakobi
2015-09-01  0:47     ` Inki Dae

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=55E74F95.5050105@math.uni-bielefeld.de \
    --to=tjakobi@math.uni-bielefeld.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=inki.dae@samsung.com \
    --cc=linux-samsung-soc@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox