diff mbox

[i-g-t] lib/igt_gt: Define HANG_ALLOW_* as bit flags

Message ID 20170208020011.15782-1-michel.thierry@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michel Thierry Feb. 8, 2017, 2 a.m. UTC
As that is what they are meant to be. It will prevent any confusion if we
have to add other flags in the future.

Signed-off-by: Michel Thierry <michel.thierry@intel.com>
---
 lib/igt_gt.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Joonas Lahtinen Feb. 8, 2017, 12:42 p.m. UTC | #1
On ti, 2017-02-07 at 18:00 -0800, Michel Thierry wrote:
> As that is what they are meant to be. It will prevent any confusion if we
> have to add other flags in the future.
> 
> Signed-off-by: Michel Thierry <michel.thierry@intel.com>

<SNIP>

> -#define HANG_ALLOW_BAN 1
> -#define HANG_ALLOW_CAPTURE 2
> +#define HANG_ALLOW_BAN		(1<<0)
> +#define HANG_ALLOW_CAPTURE	(1<<1)

Make them BIT(0) and BIT(1), and this is;

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
Chris Wilson Feb. 8, 2017, 12:49 p.m. UTC | #2
On Wed, Feb 08, 2017 at 02:42:03PM +0200, Joonas Lahtinen wrote:
> On ti, 2017-02-07 at 18:00 -0800, Michel Thierry wrote:
> > As that is what they are meant to be. It will prevent any confusion if we
> > have to add other flags in the future.
> > 
> > Signed-off-by: Michel Thierry <michel.thierry@intel.com>
> 
> <SNIP>
> 
> > -#define HANG_ALLOW_BAN 1
> > -#define HANG_ALLOW_CAPTURE 2
> > +#define HANG_ALLOW_BAN		(1<<0)
> > +#define HANG_ALLOW_CAPTURE	(1<<1)
> 
> Make them BIT(0) and BIT(1), and this is;

This is igt and BIT() is already a hodge-podge of different macros.
-Chris
Michel Thierry Feb. 8, 2017, 6:25 p.m. UTC | #3
On 08/02/17 04:49, Chris Wilson wrote:
> On Wed, Feb 08, 2017 at 02:42:03PM +0200, Joonas Lahtinen wrote:
>> On ti, 2017-02-07 at 18:00 -0800, Michel Thierry wrote:
>>> As that is what they are meant to be. It will prevent any confusion if we
>>> have to add other flags in the future.
>>>
>>> Signed-off-by: Michel Thierry <michel.thierry@intel.com>
>>
>> <SNIP>
>>
>>> -#define HANG_ALLOW_BAN 1
>>> -#define HANG_ALLOW_CAPTURE 2
>>> +#define HANG_ALLOW_BAN		(1<<0)
>>> +#define HANG_ALLOW_CAPTURE	(1<<1)
>>
>> Make them BIT(0) and BIT(1), and this is;
>
> This is igt and BIT() is already a hodge-podge of different macros.

I see at least 3 different BIT macros already (Chris added the one we 
want in lib/intel_device_info.c)

I can volunteer to move it to one of the header files, replace all the 
1<<x with BIT and rename the ones in igt_draw/intel_audio_dump... thoughts?

-Michel
Chris Wilson Feb. 8, 2017, 6:39 p.m. UTC | #4
On Wed, Feb 08, 2017 at 10:25:19AM -0800, Michel Thierry wrote:
> 
> 
> On 08/02/17 04:49, Chris Wilson wrote:
> >On Wed, Feb 08, 2017 at 02:42:03PM +0200, Joonas Lahtinen wrote:
> >>On ti, 2017-02-07 at 18:00 -0800, Michel Thierry wrote:
> >>>As that is what they are meant to be. It will prevent any confusion if we
> >>>have to add other flags in the future.
> >>>
> >>>Signed-off-by: Michel Thierry <michel.thierry@intel.com>
> >>
> >><SNIP>
> >>
> >>>-#define HANG_ALLOW_BAN 1
> >>>-#define HANG_ALLOW_CAPTURE 2
> >>>+#define HANG_ALLOW_BAN		(1<<0)
> >>>+#define HANG_ALLOW_CAPTURE	(1<<1)
> >>
> >>Make them BIT(0) and BIT(1), and this is;
> >
> >This is igt and BIT() is already a hodge-podge of different macros.
> 
> I see at least 3 different BIT macros already (Chris added the one
> we want in lib/intel_device_info.c)
> 
> I can volunteer to move it to one of the header files, replace all
> the 1<<x with BIT and rename the ones in
> igt_draw/intel_audio_dump... thoughts?

BIT(), test_bit, set_bit, clear_bit...

If you are willing to write them, please do! Make us feel at home :)
-Chris
diff mbox

Patch

diff --git a/lib/igt_gt.h b/lib/igt_gt.h
index e44b6db1..d83e23a1 100644
--- a/lib/igt_gt.h
+++ b/lib/igt_gt.h
@@ -45,8 +45,8 @@  igt_hang_t igt_hang_ctx(int fd,
 			int ring,
 			unsigned flags,
 			uint64_t *offset);
-#define HANG_ALLOW_BAN 1
-#define HANG_ALLOW_CAPTURE 2
+#define HANG_ALLOW_BAN		(1<<0)
+#define HANG_ALLOW_CAPTURE	(1<<1)
 
 igt_hang_t igt_hang_ring(int fd, int ring);
 void igt_post_hang_ring(int fd, igt_hang_t arg);