diff mbox series

[v2,2/3] checkpatch: generalize xen handle matching in the list of types

Message ID 20180510091518.28199-3-paul.durrant@citrix.com
State New
Headers show
Series xen-hvm: use new resource mapping API | expand

Commit Message

Paul Durrant May 10, 2018, 9:15 a.m. UTC
All the xen stable APIs define handle types of the form:

<name of API>_handle

and some define additional handle types of the form:

<name of API>_<purpose of handle>_handle

Examples of these are xenforeignmemory_handle and
xenforeignmemory_resource_handle.

Both of these types will be misparsed by checkpatch if they appear as the
first token in a line since, as types defined by an external library, they
do not conform to the QEMU CODING_STYLE, which suggests CamelCase.

A previous patch (5ac067a24a8) added xendevicemodel_handle to the list
of types. This patch changes that to xen\w+_handle such that it will
match all Xen stable API handles of the forms detailed above.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
---
Cc: Eric Blake <eblake@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Daniel P. Berrange <berrange@redhat.com>

v2:
 - New in this version
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Blake May 10, 2018, 1:26 p.m. UTC | #1
On 05/10/2018 04:15 AM, Paul Durrant wrote:
> All the xen stable APIs define handle types of the form:
> 
> <name of API>_handle
> 
> and some define additional handle types of the form:
> 
> <name of API>_<purpose of handle>_handle

Maybe worth mentioning that <name of API> always has a 'xen' prefix, 
and/or spelling it:

xen<name of object>_handle
xen<name of object>_<purpose>_handle

> 
> Examples of these are xenforeignmemory_handle and
> xenforeignmemory_resource_handle.
> 
> Both of these types will be misparsed by checkpatch if they appear as the
> first token in a line since, as types defined by an external library, they
> do not conform to the QEMU CODING_STYLE, which suggests CamelCase.
> 
> A previous patch (5ac067a24a8) added xendevicemodel_handle to the list
> of types. This patch changes that to xen\w+_handle such that it will
> match all Xen stable API handles of the forms detailed above.

Nice use of a regex.

> 
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> ---
> Cc: Eric Blake <eblake@redhat.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Daniel P. Berrange <berrange@redhat.com>
> 
> v2:
>   - New in this version

Reviewed-by: Eric Blake <eblake@redhat.com>

> ---
>   scripts/checkpatch.pl | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 5b8735defb..98ed799f29 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -266,7 +266,7 @@ our @typeList = (
>   	qr{target_(?:u)?long},
>   	qr{hwaddr},
>   	qr{xml${Ident}},
> -	qr{xendevicemodel_handle},
> +	qr{xen\w+_handle},
>   );
>   
>   # This can be modified by sub possible.  Since it can be empty, be careful
>
diff mbox series

Patch

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5b8735defb..98ed799f29 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -266,7 +266,7 @@  our @typeList = (
 	qr{target_(?:u)?long},
 	qr{hwaddr},
 	qr{xml${Ident}},
-	qr{xendevicemodel_handle},
+	qr{xen\w+_handle},
 );
 
 # This can be modified by sub possible.  Since it can be empty, be careful