lkml.org 
[lkml]   [2020]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 1/6] powerpc/pseries/iommu: Create defines for operations in ibm,ddw-applicable
From
Date


On 02/07/2020 10:36, Leonardo Bras wrote:
> On Thu, 2020-07-02 at 10:21 +1000, Alexey Kardashevskiy wrote:
>>> enum {
>>> DDW_QUERY_PE_DMA_WIN,
>>> DDW_CREATE_PE_DMA_WIN,
>>> DDW_REMOVE_PE_DMA_WIN,
>>>
>>> DDW_APPLICABLE_SIZE
>>> }
>>> IMO, it looks better than all the defines before.
>>>
>>> What do you think?
>>
>> No, not really, these come from a binary interface so the reader of this
>> cares about absolute numbers and rather wants to see them explicitly.
>
> Makes sense to me.
> I am still getting experience on where to use enum vs define. Thanks
> for the tip!
>
> Using something like
> enum {
> DDW_QUERY_PE_DMA_WIN = 0,
> DDW_CREATE_PE_DMA_WIN = 1,
> DDW_REMOVE_PE_DMA_WIN = 2,
>
> DDW_APPLICABLE_SIZE
> };
>
> would be fine too?


This is fine too.


> Or should one stick to #define in this case?

imho a matter of taste but after some grepping it feels like #define is
mostly used which does not mean it is a good idea. Keep it enum and see
if it passed mpe's filter :)



--
Alexey

\
 
 \ /
  Last update: 2020-07-02 02:44    [W:0.072 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site