From: Jonathan Cameron <jic23@kernel.org>
To: Irina Tirdea <irina.tirdea@intel.com>, linux-iio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald <pmeerw@pmeerw.net>,
Markus Pargmann <mpa@pengutronix.de>
Subject: Re: [PATCH v3 1/1] iio: accel: bmc150: use common definition for regmap conf
Date: Sun, 3 Apr 2016 11:25:13 +0100 [thread overview]
Message-ID: <5700EF89.7030507@kernel.org> (raw)
In-Reply-To: <1459254081-8546-1-git-send-email-irina.tirdea@intel.com>
On 29/03/16 13:21, Irina Tirdea wrote:
> bmc150_i2c_regmap_conf is defined three times (in bmc150-accel-core.c,
> bmc150-accel-i2c.c and and bmc150-accel-spi.c), although the
> definition is the same.
>
> Use one common definition for bmc150_i2c_regmap_conf in all
> included files.
>
> Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Applied to the togreg branch of iio.git
Thanks,
Jonathan
> ---
>
> Changes from v2:
> - fix spi build errors
>
> Changes from v1:
> - instead of removing the unused definition from the core,
> share it between the i2c and spi files
> - renamed the subject line from "iio: accel: bmc150: remove
> unused definition" to better reflect the new change
>
> drivers/iio/accel/bmc150-accel-core.c | 3 ++-
> drivers/iio/accel/bmc150-accel-i2c.c | 7 +------
> drivers/iio/accel/bmc150-accel-spi.c | 8 +-------
> drivers/iio/accel/bmc150-accel.h | 1 +
> 4 files changed, 5 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c
> index f3d096f..e631ee9 100644
> --- a/drivers/iio/accel/bmc150-accel-core.c
> +++ b/drivers/iio/accel/bmc150-accel-core.c
> @@ -246,11 +246,12 @@ static const struct {
> {500000, BMC150_ACCEL_SLEEP_500_MS},
> {1000000, BMC150_ACCEL_SLEEP_1_SEC} };
>
> -static const struct regmap_config bmc150_i2c_regmap_conf = {
> +const struct regmap_config bmc150_regmap_conf = {
> .reg_bits = 8,
> .val_bits = 8,
> .max_register = 0x3f,
> };
> +EXPORT_SYMBOL_GPL(bmc150_regmap_conf);
>
> static int bmc150_accel_set_mode(struct bmc150_accel_data *data,
> enum bmc150_power_modes mode,
> diff --git a/drivers/iio/accel/bmc150-accel-i2c.c b/drivers/iio/accel/bmc150-accel-i2c.c
> index b41404b..8ca8041 100644
> --- a/drivers/iio/accel/bmc150-accel-i2c.c
> +++ b/drivers/iio/accel/bmc150-accel-i2c.c
> @@ -28,11 +28,6 @@
>
> #include "bmc150-accel.h"
>
> -static const struct regmap_config bmc150_i2c_regmap_conf = {
> - .reg_bits = 8,
> - .val_bits = 8,
> -};
> -
> static int bmc150_accel_probe(struct i2c_client *client,
> const struct i2c_device_id *id)
> {
> @@ -43,7 +38,7 @@ static int bmc150_accel_probe(struct i2c_client *client,
> i2c_check_functionality(client->adapter,
> I2C_FUNC_SMBUS_READ_I2C_BLOCK);
>
> - regmap = devm_regmap_init_i2c(client, &bmc150_i2c_regmap_conf);
> + regmap = devm_regmap_init_i2c(client, &bmc150_regmap_conf);
> if (IS_ERR(regmap)) {
> dev_err(&client->dev, "Failed to initialize i2c regmap\n");
> return PTR_ERR(regmap);
> diff --git a/drivers/iio/accel/bmc150-accel-spi.c b/drivers/iio/accel/bmc150-accel-spi.c
> index 16b66f2..006794a7 100644
> --- a/drivers/iio/accel/bmc150-accel-spi.c
> +++ b/drivers/iio/accel/bmc150-accel-spi.c
> @@ -25,18 +25,12 @@
>
> #include "bmc150-accel.h"
>
> -static const struct regmap_config bmc150_spi_regmap_conf = {
> - .reg_bits = 8,
> - .val_bits = 8,
> - .max_register = 0x3f,
> -};
> -
> static int bmc150_accel_probe(struct spi_device *spi)
> {
> struct regmap *regmap;
> const struct spi_device_id *id = spi_get_device_id(spi);
>
> - regmap = devm_regmap_init_spi(spi, &bmc150_spi_regmap_conf);
> + regmap = devm_regmap_init_spi(spi, &bmc150_regmap_conf);
> if (IS_ERR(regmap)) {
> dev_err(&spi->dev, "Failed to initialize spi regmap\n");
> return PTR_ERR(regmap);
> diff --git a/drivers/iio/accel/bmc150-accel.h b/drivers/iio/accel/bmc150-accel.h
> index ba03359..38a8b11 100644
> --- a/drivers/iio/accel/bmc150-accel.h
> +++ b/drivers/iio/accel/bmc150-accel.h
> @@ -16,5 +16,6 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
> const char *name, bool block_supported);
> int bmc150_accel_core_remove(struct device *dev);
> extern const struct dev_pm_ops bmc150_accel_pm_ops;
> +extern const struct regmap_config bmc150_regmap_conf;
>
> #endif /* _BMC150_ACCEL_H_ */
>
prev parent reply other threads:[~2016-04-03 10:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-29 12:21 [PATCH v3 1/1] iio: accel: bmc150: use common definition for regmap conf Irina Tirdea
2016-04-03 10:25 ` Jonathan Cameron [this message]
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=5700EF89.7030507@kernel.org \
--to=jic23@kernel.org \
--cc=irina.tirdea@intel.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpa@pengutronix.de \
--cc=pmeerw@pmeerw.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.