[PATCH] staging: iio: Add #include guards to header files

Daniel Baluta daniel.baluta at gmail.com
Thu Sep 25 16:11:15 EEST 2014


On Thu, Sep 25, 2014 at 4:03 PM, Roberta Dobrescu
<roberta.dobrescu at gmail.com> wrote:
> This patch adds #include guards in order to make the header files idempotent.
>
> Signed-off-by: Roberta Dobrescu <roberta.dobrescu at gmail.com>
> ---
>  drivers/staging/iio/iio_dummy_evgen.h  | 5 +++++
>  drivers/staging/iio/iio_simple_dummy.h | 4 ++++
>  drivers/staging/iio/ring_hw.h          | 5 +++++
>  3 files changed, 14 insertions(+)
>
> diff --git a/drivers/staging/iio/iio_dummy_evgen.h b/drivers/staging/iio/iio_dummy_evgen.h
> index d8845e2..81d8962 100644
> --- a/drivers/staging/iio/iio_dummy_evgen.h
> +++ b/drivers/staging/iio/iio_dummy_evgen.h
> @@ -1,2 +1,7 @@
> +#ifndef _IIO_DUMMY_EVGEN_H_
> +#define _IIO_DUMMY_EVGEN_H_
> +
>  int iio_dummy_evgen_get_irq(void);
>  int iio_dummy_evgen_release_irq(int irq);
> +
> +#endif

This should be:

#endif /* _IIO_DUMMY_EVGEN_H_ */

> diff --git a/drivers/staging/iio/iio_simple_dummy.h b/drivers/staging/iio/iio_simple_dummy.h
> index b126196..3027aed 100644
> --- a/drivers/staging/iio/iio_simple_dummy.h
> +++ b/drivers/staging/iio/iio_simple_dummy.h
> @@ -8,6 +8,8 @@
>   * Join together the various functionality of iio_simple_dummy driver
>   */
>
> +#ifndef _IIO_SIMPLE_DUMMY_H_
> +#define _IIO_SIMPLE_DUMMY_H_
new line here
>  #include <linux/kernel.h>
>
>  struct iio_dummy_accel_calibscale;
> @@ -117,4 +119,6 @@ static inline int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev,
>  static inline
>  void iio_simple_dummy_unconfigure_buffer(struct iio_dev *indio_dev)
>  {};
> +

I agree with this :)

>  #endif /* CONFIG_IIO_SIMPLE_DUMMY_BUFFER */
> +#endif /* _IIO_SIMPLE_DUMMY_H_ */
> diff --git a/drivers/staging/iio/ring_hw.h b/drivers/staging/iio/ring_hw.h
> index 39c14a7..f98f90f 100644
> --- a/drivers/staging/iio/ring_hw.h
> +++ b/drivers/staging/iio/ring_hw.h
> @@ -9,6 +9,9 @@
>   *
>   */
>
> +#ifndef _RING_HW_H_
> +#define _RING_HW_H_
> +
>  /**
>   * struct iio_hw_ring_buffer- hardware ring buffer
>   * @buf:       generic ring buffer elements
> @@ -20,3 +23,5 @@ struct iio_hw_buffer {
>  };
>
>  #define iio_to_hw_buf(r) container_of(r, struct iio_hw_buffer, buf)
> +
> +#endif
This should be:

#endif /* _RING_HW_H_ */


More information about the firefly mailing list