[libcamera-devel] [PATCH v2 3/6] include: android: Add SPDX tags

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Aug 7 11:07:46 CEST 2019


Hi Jacopo,

Thank you for the patch.

On Tue, Aug 06, 2019 at 09:55:15PM +0200, Jacopo Mondi wrote:
> Add SPDX indentifier to Apache-2.0 licensed android headers.
> 
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> ---
>  .../libhardware/include/hardware/camera3.h    |  1 +
>  .../include/hardware/camera_common.h          |  1 +
>  .../libhardware/include/hardware/fb.h         |  1 +
>  .../libhardware/include/hardware/gralloc.h    | 61 ++++++++++---------
>  .../libhardware/include/hardware/hardware.h   |  1 +
>  .../android/metadata/camera_metadata_hidden.h |  1 +
>  .../android/metadata/system/camera_metadata.h |  1 +
>  .../metadata/system/camera_metadata_tags.h    |  3 +-
>  .../metadata/system/camera_vendor_tags.h      |  1 +
>  .../android/system/core/include/android/log.h |  1 +
>  .../system/core/include/cutils/compiler.h     |  1 +
>  .../core/include/cutils/native_handle.h       | 17 +++---
>  .../system/core/include/system/camera.h       |  1 +
>  .../system/core/include/system/graphics.h     |  1 +
>  .../system/core/include/system/window.h       |  1 +
>  15 files changed, 54 insertions(+), 39 deletions(-)
> 
> diff --git a/include/android/hardware/libhardware/include/hardware/camera3.h b/include/android/hardware/libhardware/include/hardware/camera3.h
> index 49664dc3ceb6..d89bc9304b00 100644
> --- a/include/android/hardware/libhardware/include/hardware/camera3.h
> +++ b/include/android/hardware/libhardware/include/hardware/camera3.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: Apache-2.0 */
>  /*
>   * Copyright (C) 2013 The Android Open Source Project
>   *
> diff --git a/include/android/hardware/libhardware/include/hardware/camera_common.h b/include/android/hardware/libhardware/include/hardware/camera_common.h
> index 7658dd4062f3..26df06987030 100644
> --- a/include/android/hardware/libhardware/include/hardware/camera_common.h
> +++ b/include/android/hardware/libhardware/include/hardware/camera_common.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: Apache-2.0 */
>  /*
>   * Copyright (C) 2012 The Android Open Source Project
>   *
> diff --git a/include/android/hardware/libhardware/include/hardware/fb.h b/include/android/hardware/libhardware/include/hardware/fb.h
> index 9df94165b9b1..9ea9a6e60f05 100644
> --- a/include/android/hardware/libhardware/include/hardware/fb.h
> +++ b/include/android/hardware/libhardware/include/hardware/fb.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: Apache-2.0 */
>  /*
>   * Copyright (C) 2008 The Android Open Source Project
>   *
> diff --git a/include/android/hardware/libhardware/include/hardware/gralloc.h b/include/android/hardware/libhardware/include/hardware/gralloc.h
> index ef86f9039395..9d14104b4842 100644
> --- a/include/android/hardware/libhardware/include/hardware/gralloc.h
> +++ b/include/android/hardware/libhardware/include/hardware/gralloc.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: Apache-2.0 */
>  /*
>   * Copyright (C) 2008 The Android Open Source Project
>   *
> @@ -154,20 +155,20 @@ enum {
>   */
>  typedef struct gralloc_module_t {
>      struct hw_module_t common;
> -    
> +

With all the unrelated changes dropped,

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

>      /*
>       * (*registerBuffer)() must be called before a buffer_handle_t that has not
>       * been created with (*alloc_device_t::alloc)() can be used.
> -     * 
> +     *
>       * This is intended to be used with buffer_handle_t's that have been
>       * received in this process through IPC.
> -     * 
> +     *
>       * This function checks that the handle is indeed a valid one and prepares
>       * it for use with (*lock)() and (*unlock)().
> -     * 
> -     * It is not necessary to call (*registerBuffer)() on a handle created 
> +     *
> +     * It is not necessary to call (*registerBuffer)() on a handle created
>       * with (*alloc_device_t::alloc)().
> -     * 
> +     *
>       * returns an error if this buffer_handle_t is not valid.
>       */
>      int (*registerBuffer)(struct gralloc_module_t const* module,
> @@ -177,25 +178,25 @@ typedef struct gralloc_module_t {
>       * (*unregisterBuffer)() is called once this handle is no longer needed in
>       * this process. After this call, it is an error to call (*lock)(),
>       * (*unlock)(), or (*registerBuffer)().
> -     * 
> +     *
>       * This function doesn't close or free the handle itself; this is done
>       * by other means, usually through libcutils's native_handle_close() and
> -     * native_handle_free(). 
> -     * 
> +     * native_handle_free().
> +     *
>       * It is an error to call (*unregisterBuffer)() on a buffer that wasn't
>       * explicitly registered first.
>       */
>      int (*unregisterBuffer)(struct gralloc_module_t const* module,
>              buffer_handle_t handle);
> -    
> +
>      /*
> -     * The (*lock)() method is called before a buffer is accessed for the 
> +     * The (*lock)() method is called before a buffer is accessed for the
>       * specified usage. This call may block, for instance if the h/w needs
>       * to finish rendering or if CPU caches need to be synchronized.
> -     * 
> -     * The caller promises to modify only pixels in the area specified 
> +     *
> +     * The caller promises to modify only pixels in the area specified
>       * by (l,t,w,h).
> -     * 
> +     *
>       * The content of the buffer outside of the specified area is NOT modified
>       * by this call.
>       *
> @@ -208,9 +209,9 @@ typedef struct gralloc_module_t {
>       *
>       * THREADING CONSIDERATIONS:
>       *
> -     * It is legal for several different threads to lock a buffer from 
> +     * It is legal for several different threads to lock a buffer from
>       * read access, none of the threads are blocked.
> -     * 
> +     *
>       * However, locking a buffer simultaneously for write or read/write is
>       * undefined, but:
>       * - shall not result in termination of the process
> @@ -219,21 +220,21 @@ typedef struct gralloc_module_t {
>       * into an indeterminate state.
>       *
>       * If the buffer was created with a usage mask incompatible with the
> -     * requested usage flags here, -EINVAL is returned. 
> -     * 
> +     * requested usage flags here, -EINVAL is returned.
> +     *
>       */
> -    
> +
>      int (*lock)(struct gralloc_module_t const* module,
>              buffer_handle_t handle, int usage,
>              int l, int t, int w, int h,
>              void** vaddr);
>  
> -    
> +
>      /*
>       * The (*unlock)() method must be called after all changes to the buffer
>       * are completed.
>       */
> -    
> +
>      int (*unlock)(struct gralloc_module_t const* module,
>              buffer_handle_t handle);
>  
> @@ -326,32 +327,32 @@ typedef struct gralloc_module_t {
>  typedef struct alloc_device_t {
>      struct hw_device_t common;
>  
> -    /* 
> +    /*
>       * (*alloc)() Allocates a buffer in graphic memory with the requested
>       * parameters and returns a buffer_handle_t and the stride in pixels to
>       * allow the implementation to satisfy hardware constraints on the width
> -     * of a pixmap (eg: it may have to be multiple of 8 pixels). 
> +     * of a pixmap (eg: it may have to be multiple of 8 pixels).
>       * The CALLER TAKES OWNERSHIP of the buffer_handle_t.
>       *
>       * If format is HAL_PIXEL_FORMAT_YCbCr_420_888, the returned stride must be
>       * 0, since the actual strides are available from the android_ycbcr
>       * structure.
> -     * 
> +     *
>       * Returns 0 on success or -errno on error.
>       */
> -    
> +
>      int (*alloc)(struct alloc_device_t* dev,
>              int w, int h, int format, int usage,
>              buffer_handle_t* handle, int* stride);
>  
>      /*
> -     * (*free)() Frees a previously allocated buffer. 
> +     * (*free)() Frees a previously allocated buffer.
>       * Behavior is undefined if the buffer is still mapped in any process,
>       * but shall not result in termination of the program or security breaches
>       * (allowing a process to get access to another process' buffers).
>       * THIS FUNCTION TAKES OWNERSHIP of the buffer_handle_t which becomes
> -     * invalid after the call. 
> -     * 
> +     * invalid after the call.
> +     *
>       * Returns 0 on success or -errno on error.
>       */
>      int (*free)(struct alloc_device_t* dev,
> @@ -369,9 +370,9 @@ typedef struct alloc_device_t {
>  
>  /** convenience API for opening and closing a supported device */
>  
> -static inline int gralloc_open(const struct hw_module_t* module, 
> +static inline int gralloc_open(const struct hw_module_t* module,
>          struct alloc_device_t** device) {
> -    return module->methods->open(module, 
> +    return module->methods->open(module,
>              GRALLOC_HARDWARE_GPU0, (struct hw_device_t**)device);
>  }
>  
> diff --git a/include/android/hardware/libhardware/include/hardware/hardware.h b/include/android/hardware/libhardware/include/hardware/hardware.h
> index 74f57aa4c28f..10b73df7150a 100644
> --- a/include/android/hardware/libhardware/include/hardware/hardware.h
> +++ b/include/android/hardware/libhardware/include/hardware/hardware.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: Apache-2.0 */
>  /*
>   * Copyright (C) 2008 The Android Open Source Project
>   *
> diff --git a/include/android/metadata/camera_metadata_hidden.h b/include/android/metadata/camera_metadata_hidden.h
> index 31f1ad19e868..91b11e43463d 100644
> --- a/include/android/metadata/camera_metadata_hidden.h
> +++ b/include/android/metadata/camera_metadata_hidden.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: Apache-2.0 */
>  /*
>   * Copyright 2014 The Android Open Source Project
>   *
> diff --git a/include/android/metadata/system/camera_metadata.h b/include/android/metadata/system/camera_metadata.h
> index 46e7ac000298..1672b09ee947 100644
> --- a/include/android/metadata/system/camera_metadata.h
> +++ b/include/android/metadata/system/camera_metadata.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: Apache-2.0 */
>  /*
>   * Copyright (C) 2012 The Android Open Source Project
>   *
> diff --git a/include/android/metadata/system/camera_metadata_tags.h b/include/android/metadata/system/camera_metadata_tags.h
> index adf18b8f4c2f..5b1d93e80191 100644
> --- a/include/android/metadata/system/camera_metadata_tags.h
> +++ b/include/android/metadata/system/camera_metadata_tags.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: Apache-2.0 */
>  /*
>   * Copyright (C) 2012 The Android Open Source Project
>   *
> @@ -375,7 +376,7 @@ typedef enum camera_metadata_tag {
>      ANDROID_STATISTICS_OIS_Y_SHIFTS,                  // float[]      | ndk_public   | HIDL v3.3
>      ANDROID_STATISTICS_END,
>  
> -    ANDROID_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES = 
> +    ANDROID_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES =
>                                                        // byte[]       | public       | HIDL v3.2
>              ANDROID_STATISTICS_INFO_START,
>      ANDROID_STATISTICS_INFO_HISTOGRAM_BUCKET_COUNT,   // int32        | system       | HIDL v3.2
> diff --git a/include/android/metadata/system/camera_vendor_tags.h b/include/android/metadata/system/camera_vendor_tags.h
> index 0bb542608c91..167ff7393a2c 100644
> --- a/include/android/metadata/system/camera_vendor_tags.h
> +++ b/include/android/metadata/system/camera_vendor_tags.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: Apache-2.0 */
>  /*
>   * Copyright 2014 The Android Open Source Project
>   *
> diff --git a/include/android/system/core/include/android/log.h b/include/android/system/core/include/android/log.h
> index 1c171b7bf2b5..dbad9dd18a2e 100644
> --- a/include/android/system/core/include/android/log.h
> +++ b/include/android/system/core/include/android/log.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: Apache-2.0 */
>  /*
>   * Copyright (C) 2009 The Android Open Source Project
>   *
> diff --git a/include/android/system/core/include/cutils/compiler.h b/include/android/system/core/include/cutils/compiler.h
> index 70f884a1e701..efd1b1c36fa5 100644
> --- a/include/android/system/core/include/cutils/compiler.h
> +++ b/include/android/system/core/include/cutils/compiler.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: Apache-2.0 */
>  /*
>   * Copyright (C) 2009 The Android Open Source Project
>   *
> diff --git a/include/android/system/core/include/cutils/native_handle.h b/include/android/system/core/include/cutils/native_handle.h
> index 268c5d3f51b7..ebedc105c596 100644
> --- a/include/android/system/core/include/cutils/native_handle.h
> +++ b/include/android/system/core/include/cutils/native_handle.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: Apache-2.0 */
>  /*
>   * Copyright (C) 2009 The Android Open Source Project
>   *
> @@ -31,33 +32,33 @@ typedef struct native_handle
>  
>  /*
>   * native_handle_close
> - * 
> + *
>   * closes the file descriptors contained in this native_handle_t
> - * 
> + *
>   * return 0 on success, or a negative error code on failure
> - * 
> + *
>   */
>  int native_handle_close(const native_handle_t* h);
>  
>  
>  /*
>   * native_handle_create
> - * 
> + *
>   * creates a native_handle_t and initializes it. must be destroyed with
>   * native_handle_delete().
> - * 
> + *
>   */
>  native_handle_t* native_handle_create(int numFds, int numInts);
>  
>  /*
>   * native_handle_delete
> - * 
> + *
>   * frees a native_handle_t allocated with native_handle_create().
>   * This ONLY frees the memory allocated for the native_handle_t, but doesn't
>   * close the file descriptors; which can be achieved with native_handle_close().
> - * 
> + *
>   * return 0 on success, or a negative error code on failure
> - * 
> + *
>   */
>  int native_handle_delete(native_handle_t* h);
>  
> diff --git a/include/android/system/core/include/system/camera.h b/include/android/system/core/include/system/camera.h
> index 5d0873ac42a6..a1b68d054d93 100644
> --- a/include/android/system/core/include/system/camera.h
> +++ b/include/android/system/core/include/system/camera.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: Apache-2.0 */
>  /*
>   * Copyright (C) 2011 The Android Open Source Project
>   *
> diff --git a/include/android/system/core/include/system/graphics.h b/include/android/system/core/include/system/graphics.h
> index afd9f7bdb32f..909ffe68e78b 100644
> --- a/include/android/system/core/include/system/graphics.h
> +++ b/include/android/system/core/include/system/graphics.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: Apache-2.0 */
>  /*
>   * Copyright (C) 2011 The Android Open Source Project
>   *
> diff --git a/include/android/system/core/include/system/window.h b/include/android/system/core/include/system/window.h
> index 508ce00bacec..2c9d6063fdb5 100644
> --- a/include/android/system/core/include/system/window.h
> +++ b/include/android/system/core/include/system/window.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: Apache-2.0 */
>  /*
>   * Copyright (C) 2011 The Android Open Source Project
>   *

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list