From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Jonathan Cameron <jic23@cam.ac.uk>, linux-iio@vger.kernel.org
Subject: Re: [PATCH 16/18] staging:iio:dac:ad5504: Move private structs and defines from header to C file
Date: Mon, 21 May 2012 17:42:34 +0100 [thread overview]
Message-ID: <4FBA707A.4040006@kernel.org> (raw)
In-Reply-To: <1337600587-19848-16-git-send-email-lars@metafoo.de>
On 05/21/2012 12:43 PM, Lars-Peter Clausen wrote:
> The header for this driver contains some private structs and defines, which do
> not have to be shared between multiple source files, as well as the platform
> data struct for this driver, which has to be shared with other source files.
> Since there is no need to expose those private structs and defines move them to
> the source file.
Sensible. Minor suggestion inline.
>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
> drivers/staging/iio/dac/ad5504.c | 45 ++++++++++++++++++++++++++++++++++++++
> drivers/staging/iio/dac/ad5504.h | 45 --------------------------------------
> 2 files changed, 45 insertions(+), 45 deletions(-)
>
> diff --git a/drivers/staging/iio/dac/ad5504.c b/drivers/staging/iio/dac/ad5504.c
> index cd754d2..012c187 100644
> --- a/drivers/staging/iio/dac/ad5504.c
> +++ b/drivers/staging/iio/dac/ad5504.c
> @@ -22,6 +22,51 @@
>
> #include "ad5504.h"
>
> +#define AD5505_BITS 12
> +#define AD5504_RES_MASK ((1 << (AD5505_BITS)) - 1)
> +
> +#define AD5504_CMD_READ (1 << 15)
> +#define AD5504_CMD_WRITE (0 << 15)
> +#define AD5504_ADDR(addr) ((addr) << 12)
> +
> +/* Registers */
> +#define AD5504_ADDR_NOOP 0
> +#define AD5504_ADDR_DAC(x) ((x) + 1)
> +#define AD5504_ADDR_ALL_DAC 5
> +#define AD5504_ADDR_CTRL 7
> +
> +/* Control Register */
> +#define AD5504_DAC_PWR(ch) ((ch) << 2)
> +#define AD5504_DAC_PWRDWN_MODE(mode) ((mode) << 6)
> +#define AD5504_DAC_PWRDN_20K 0
> +#define AD5504_DAC_PWRDN_3STATE 1
> +
> +/**
> + * struct ad5446_state - driver instance specific data
> + * @us: spi_device
> + * @reg: supply regulator
> + * @vref_mv: actual reference voltage used
> + * @pwr_down_mask power down mask
> + * @pwr_down_mode current power down mode
> + */
If we are being fussy, isn't convention no blank line here?
> +
> +struct ad5504_state {
> + struct spi_device *spi;
> + struct regulator *reg;
> + unsigned short vref_mv;
> + unsigned pwr_down_mask;
> + unsigned pwr_down_mode;
> +};
> +
> +/**
> + * ad5504_supported_device_ids:
> + */
> +
> +enum ad5504_supported_device_ids {
> + ID_AD5504,
> + ID_AD5501,
> +};
> +
> static int ad5504_spi_write(struct spi_device *spi, u8 addr, u16 val)
> {
> u16 tmp = cpu_to_be16(AD5504_CMD_WRITE |
> diff --git a/drivers/staging/iio/dac/ad5504.h b/drivers/staging/iio/dac/ad5504.h
> index afe0952..d4980bf 100644
> --- a/drivers/staging/iio/dac/ad5504.h
> +++ b/drivers/staging/iio/dac/ad5504.h
> @@ -9,25 +9,6 @@
> #ifndef SPI_AD5504_H_
> #define SPI_AD5504_H_
>
> -#define AD5505_BITS 12
> -#define AD5504_RES_MASK ((1 << (AD5505_BITS)) - 1)
> -
> -#define AD5504_CMD_READ (1 << 15)
> -#define AD5504_CMD_WRITE (0 << 15)
> -#define AD5504_ADDR(addr) ((addr) << 12)
> -
> -/* Registers */
> -#define AD5504_ADDR_NOOP 0
> -#define AD5504_ADDR_DAC(x) ((x) + 1)
> -#define AD5504_ADDR_ALL_DAC 5
> -#define AD5504_ADDR_CTRL 7
> -
> -/* Control Register */
> -#define AD5504_DAC_PWR(ch) ((ch) << 2)
> -#define AD5504_DAC_PWRDWN_MODE(mode) ((mode) << 6)
> -#define AD5504_DAC_PWRDN_20K 0
> -#define AD5504_DAC_PWRDN_3STATE 1
> -
> /*
> * TODO: struct ad5504_platform_data needs to go into include/linux/iio
> */
> @@ -36,30 +17,4 @@ struct ad5504_platform_data {
> u16 vref_mv;
> };
>
> -/**
> - * struct ad5446_state - driver instance specific data
> - * @us: spi_device
> - * @reg: supply regulator
> - * @vref_mv: actual reference voltage used
> - * @pwr_down_mask power down mask
> - * @pwr_down_mode current power down mode
> - */
> -
> -struct ad5504_state {
> - struct spi_device *spi;
> - struct regulator *reg;
> - unsigned short vref_mv;
> - unsigned pwr_down_mask;
> - unsigned pwr_down_mode;
> -};
> -
> -/**
> - * ad5504_supported_device_ids:
> - */
> -
> -enum ad5504_supported_device_ids {
> - ID_AD5504,
> - ID_AD5501,
> -};
> -
> #endif /* SPI_AD5504_H_ */
next prev parent reply other threads:[~2012-05-21 16:42 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-21 11:42 [PATCH 01/18] iio: Add helper functions for enum style channel attributes Lars-Peter Clausen
2012-05-21 11:42 ` [PATCH 02/18] staging:iio:dac:ad5064: Use iio_enum for powerdown modes Lars-Peter Clausen
2012-05-21 11:42 ` [PATCH 03/18] staging:iio:dac:ad5446: " Lars-Peter Clausen
2012-05-21 11:42 ` [PATCH 04/18] staging:iio:dac:ad5380: Convert to extended channel attributes Lars-Peter Clausen
2012-05-21 11:42 ` [PATCH 05/18] staging:iio:dac:ad5504: " Lars-Peter Clausen
2012-05-21 11:42 ` [PATCH 06/18] staging:iio:dac:ad5624r: " Lars-Peter Clausen
2012-05-21 11:42 ` [PATCH 07/18] staging:iio:dac:ad5686: " Lars-Peter Clausen
2012-05-21 11:42 ` [PATCH 08/18] staging:iio:dac:ad5791: " Lars-Peter Clausen
2012-05-21 11:42 ` [PATCH 09/18] staging:iio:dac: Remove unused dac.h includes Lars-Peter Clausen
2012-05-21 11:42 ` [PATCH 10/18] staging:iio:dac:max517: Convert to channel spec Lars-Peter Clausen
2012-05-25 16:27 ` Lars-Peter Clausen
2012-05-25 19:51 ` Roland Stigge
2012-05-21 11:43 ` [PATCH 11/18] staging:iio:dac: Remove dac.h Lars-Peter Clausen
2012-05-21 11:43 ` [PATCH 12/18] staging:iio:dac:ad5504: Use strtobool for boolean values Lars-Peter Clausen
2012-05-21 11:43 ` [PATCH 13/18] staging:iio:dac:ad5624r: " Lars-Peter Clausen
2012-05-21 11:43 ` [PATCH 14/18] staging:iio:dac:ad5791: " Lars-Peter Clausen
2012-05-21 11:43 ` [PATCH 15/18] staging:iio:dac:ad5504: Check if IRQ was requested before freeing it Lars-Peter Clausen
2012-05-21 11:43 ` [PATCH 16/18] staging:iio:dac:ad5504: Move private structs and defines from header to C file Lars-Peter Clausen
2012-05-21 16:42 ` Jonathan Cameron [this message]
2012-05-21 11:43 ` [PATCH 17/18] staging:iio:dac:ad5791: " Lars-Peter Clausen
2012-05-21 16:43 ` Jonathan Cameron
2012-05-21 11:43 ` [PATCH 18/18] staging:iio: Move DAC drivers out of staging Lars-Peter Clausen
2012-05-21 16:51 ` Jonathan Cameron
2012-05-21 16:40 ` [PATCH 01/18] iio: Add helper functions for enum style channel attributes Jonathan Cameron
-- strict thread matches above, loose matches on Subject: below --
2012-06-04 9:36 Lars-Peter Clausen
2012-06-04 9:36 ` [PATCH 16/18] staging:iio:dac:ad5504: Move private structs and defines from header to C file Lars-Peter Clausen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FBA707A.4040006@kernel.org \
--to=jic23@kernel.org \
--cc=jic23@cam.ac.uk \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).