* [PATCH] mfd: da9052: Avoid setting read_flag_mask for da9052-i2c driver
@ 2014-08-16 13:23 Axel Lin
2014-08-28 11:20 ` Lee Jones
2014-09-04 8:40 ` Lee Jones
0 siblings, 2 replies; 5+ messages in thread
From: Axel Lin @ 2014-08-16 13:23 UTC (permalink / raw)
To: Lee Jones, Samuel Ortiz
Cc: Opensource [Steve Twiss], Opensource [Adam Thomson],
Support Opensource, linux-kernel@vger.kernel.org
Current code init regmap with &da9052_regmap_config for both da9052-spi and
da9052-i2c drivers. da9052-spi sets the read_flag_mask.
The same setting may be applied for da9052-i2c if da9052-spi driver is loaded
first because they actually use the same regmap_config setting.
Fix this issue by using a local variable for regmap_config in da9052-spi driver,
so the settings in spi driver won't impact the settings in i2c driver.
Also makes da9052_regmap_config const to avoid similar issue.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
Hi Adam and Steve,
Any chance to test this patch?
Thanks,
Axel
drivers/mfd/da9052-core.c | 2 +-
drivers/mfd/da9052-spi.c | 7 ++++---
include/linux/mfd/da9052/da9052.h | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
index e8af816..52a0c2f 100644
--- a/drivers/mfd/da9052-core.c
+++ b/drivers/mfd/da9052-core.c
@@ -522,7 +522,7 @@ static const struct mfd_cell da9052_subdev_info[] = {
},
};
-struct regmap_config da9052_regmap_config = {
+const struct regmap_config da9052_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
diff --git a/drivers/mfd/da9052-spi.c b/drivers/mfd/da9052-spi.c
index 17666b4..45ae0b7 100644
--- a/drivers/mfd/da9052-spi.c
+++ b/drivers/mfd/da9052-spi.c
@@ -23,6 +23,7 @@
static int da9052_spi_probe(struct spi_device *spi)
{
+ struct regmap_config config;
int ret;
const struct spi_device_id *id = spi_get_device_id(spi);
struct da9052 *da9052;
@@ -40,10 +41,10 @@ static int da9052_spi_probe(struct spi_device *spi)
spi_set_drvdata(spi, da9052);
- da9052_regmap_config.read_flag_mask = 1;
- da9052_regmap_config.write_flag_mask = 0;
+ config = da9052_regmap_config;
+ config.read_flag_mask = 1;
- da9052->regmap = devm_regmap_init_spi(spi, &da9052_regmap_config);
+ da9052->regmap = devm_regmap_init_spi(spi, &config);
if (IS_ERR(da9052->regmap)) {
ret = PTR_ERR(da9052->regmap);
dev_err(&spi->dev, "Failed to allocate register map: %d\n",
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index bba65f5..c18a4c1 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -211,7 +211,7 @@ static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg,
int da9052_device_init(struct da9052 *da9052, u8 chip_id);
void da9052_device_exit(struct da9052 *da9052);
-extern struct regmap_config da9052_regmap_config;
+extern const struct regmap_config da9052_regmap_config;
int da9052_irq_init(struct da9052 *da9052);
int da9052_irq_exit(struct da9052 *da9052);
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mfd: da9052: Avoid setting read_flag_mask for da9052-i2c driver
2014-08-16 13:23 [PATCH] mfd: da9052: Avoid setting read_flag_mask for da9052-i2c driver Axel Lin
@ 2014-08-28 11:20 ` Lee Jones
2014-08-28 13:38 ` Opensource [Adam Thomson]
2014-09-04 8:40 ` Lee Jones
1 sibling, 1 reply; 5+ messages in thread
From: Lee Jones @ 2014-08-28 11:20 UTC (permalink / raw)
To: Axel Lin
Cc: Samuel Ortiz, Opensource [Steve Twiss], Opensource [Adam Thomson],
Support Opensource, linux-kernel@vger.kernel.org
Steve, Adam,
> Current code init regmap with &da9052_regmap_config for both da9052-spi and
> da9052-i2c drivers. da9052-spi sets the read_flag_mask.
> The same setting may be applied for da9052-i2c if da9052-spi driver is loaded
> first because they actually use the same regmap_config setting.
> Fix this issue by using a local variable for regmap_config in da9052-spi driver,
> so the settings in spi driver won't impact the settings in i2c driver.
> Also makes da9052_regmap_config const to avoid similar issue.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> Hi Adam and Steve,
> Any chance to test this patch?
** Look here **
> Thanks,
> Axel
> drivers/mfd/da9052-core.c | 2 +-
> drivers/mfd/da9052-spi.c | 7 ++++---
> include/linux/mfd/da9052/da9052.h | 2 +-
> 3 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
> index e8af816..52a0c2f 100644
> --- a/drivers/mfd/da9052-core.c
> +++ b/drivers/mfd/da9052-core.c
> @@ -522,7 +522,7 @@ static const struct mfd_cell da9052_subdev_info[] = {
> },
> };
>
> -struct regmap_config da9052_regmap_config = {
> +const struct regmap_config da9052_regmap_config = {
> .reg_bits = 8,
> .val_bits = 8,
>
> diff --git a/drivers/mfd/da9052-spi.c b/drivers/mfd/da9052-spi.c
> index 17666b4..45ae0b7 100644
> --- a/drivers/mfd/da9052-spi.c
> +++ b/drivers/mfd/da9052-spi.c
> @@ -23,6 +23,7 @@
>
> static int da9052_spi_probe(struct spi_device *spi)
> {
> + struct regmap_config config;
> int ret;
> const struct spi_device_id *id = spi_get_device_id(spi);
> struct da9052 *da9052;
> @@ -40,10 +41,10 @@ static int da9052_spi_probe(struct spi_device *spi)
>
> spi_set_drvdata(spi, da9052);
>
> - da9052_regmap_config.read_flag_mask = 1;
> - da9052_regmap_config.write_flag_mask = 0;
> + config = da9052_regmap_config;
> + config.read_flag_mask = 1;
>
> - da9052->regmap = devm_regmap_init_spi(spi, &da9052_regmap_config);
> + da9052->regmap = devm_regmap_init_spi(spi, &config);
> if (IS_ERR(da9052->regmap)) {
> ret = PTR_ERR(da9052->regmap);
> dev_err(&spi->dev, "Failed to allocate register map: %d\n",
> diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
> index bba65f5..c18a4c1 100644
> --- a/include/linux/mfd/da9052/da9052.h
> +++ b/include/linux/mfd/da9052/da9052.h
> @@ -211,7 +211,7 @@ static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg,
> int da9052_device_init(struct da9052 *da9052, u8 chip_id);
> void da9052_device_exit(struct da9052 *da9052);
>
> -extern struct regmap_config da9052_regmap_config;
> +extern const struct regmap_config da9052_regmap_config;
>
> int da9052_irq_init(struct da9052 *da9052);
> int da9052_irq_exit(struct da9052 *da9052);
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] mfd: da9052: Avoid setting read_flag_mask for da9052-i2c driver
2014-08-28 11:20 ` Lee Jones
@ 2014-08-28 13:38 ` Opensource [Adam Thomson]
2014-09-03 10:50 ` Opensource [Adam Thomson]
0 siblings, 1 reply; 5+ messages in thread
From: Opensource [Adam Thomson] @ 2014-08-28 13:38 UTC (permalink / raw)
To: Lee Jones, Axel Lin
Cc: Samuel Ortiz, Opensource [Steve Twiss], Opensource [Adam Thomson],
Support Opensource, linux-kernel@vger.kernel.org
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1019 bytes --]
On August 28, 2014 12:21, Lee Jones wrote:
> Steve, Adam,
>
> > Current code init regmap with &da9052_regmap_config for both da9052-spi and
> > da9052-i2c drivers. da9052-spi sets the read_flag_mask.
> > The same setting may be applied for da9052-i2c if da9052-spi driver is loaded
> > first because they actually use the same regmap_config setting.
> > Fix this issue by using a local variable for regmap_config in da9052-spi driver,
> > so the settings in spi driver won't impact the settings in i2c driver.
> > Also makes da9052_regmap_config const to avoid similar issue.
> >
> > Signed-off-by: Axel Lin <axel.lin@ingics.com>
> > ---
> > Hi Adam and Steve,
> > Any chance to test this patch?
>
> ** Look here **
Lee, Axel,
This was on my to-do list but hadn't yet responded. Will try and find some time
in the next week to see if we can verify this.
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] mfd: da9052: Avoid setting read_flag_mask for da9052-i2c driver
2014-08-28 13:38 ` Opensource [Adam Thomson]
@ 2014-09-03 10:50 ` Opensource [Adam Thomson]
0 siblings, 0 replies; 5+ messages in thread
From: Opensource [Adam Thomson] @ 2014-09-03 10:50 UTC (permalink / raw)
To: Opensource [Adam Thomson], Lee Jones, Axel Lin
Cc: Samuel Ortiz, Opensource [Steve Twiss], Support Opensource,
linux-kernel@vger.kernel.org
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1524 bytes --]
On August 28, 2014 14:38, Adam Thomson wrote:
> On August 28, 2014 12:21, Lee Jones wrote:
>
> > Steve, Adam,
> >
> > > Current code init regmap with &da9052_regmap_config for both da9052-spi and
> > > da9052-i2c drivers. da9052-spi sets the read_flag_mask.
> > > The same setting may be applied for da9052-i2c if da9052-spi driver is loaded
> > > first because they actually use the same regmap_config setting.
> > > Fix this issue by using a local variable for regmap_config in da9052-spi driver,
> > > so the settings in spi driver won't impact the settings in i2c driver.
> > > Also makes da9052_regmap_config const to avoid similar issue.
> > >
> > > Signed-off-by: Axel Lin <axel.lin@ingics.com>
> > > ---
> > > Hi Adam and Steve,
> > > Any chance to test this patch?
> >
> > ** Look here **
>
> Lee, Axel,
>
> This was on my to-do list but hadn't yet responded. Will try and find some time
> in the next week to see if we can verify this.
Hi Axel, Lee,
I don't think I'm going to have time to test this soon. In terms of the change it looks fine to me, although I don't think you can run both SPI and I2C at the same time for this driver (I tried a quick test to instantiate both and saw issues with regulator initialisation for the second instance). Anyway, here's my ack for the change.
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mfd: da9052: Avoid setting read_flag_mask for da9052-i2c driver
2014-08-16 13:23 [PATCH] mfd: da9052: Avoid setting read_flag_mask for da9052-i2c driver Axel Lin
2014-08-28 11:20 ` Lee Jones
@ 2014-09-04 8:40 ` Lee Jones
1 sibling, 0 replies; 5+ messages in thread
From: Lee Jones @ 2014-09-04 8:40 UTC (permalink / raw)
To: Axel Lin
Cc: Samuel Ortiz, Opensource [Steve Twiss], Opensource [Adam Thomson],
Support Opensource, linux-kernel@vger.kernel.org
On Sat, 16 Aug 2014, Axel Lin wrote:
> Current code init regmap with &da9052_regmap_config for both da9052-spi and
> da9052-i2c drivers. da9052-spi sets the read_flag_mask.
> The same setting may be applied for da9052-i2c if da9052-spi driver is loaded
> first because they actually use the same regmap_config setting.
> Fix this issue by using a local variable for regmap_config in da9052-spi driver,
> so the settings in spi driver won't impact the settings in i2c driver.
> Also makes da9052_regmap_config const to avoid similar issue.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> Hi Adam and Steve,
Applied with Adam's Ack.
> Any chance to test this patch?
>
> Thanks,
> Axel
> drivers/mfd/da9052-core.c | 2 +-
> drivers/mfd/da9052-spi.c | 7 ++++---
> include/linux/mfd/da9052/da9052.h | 2 +-
> 3 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
> index e8af816..52a0c2f 100644
> --- a/drivers/mfd/da9052-core.c
> +++ b/drivers/mfd/da9052-core.c
> @@ -522,7 +522,7 @@ static const struct mfd_cell da9052_subdev_info[] = {
> },
> };
>
> -struct regmap_config da9052_regmap_config = {
> +const struct regmap_config da9052_regmap_config = {
> .reg_bits = 8,
> .val_bits = 8,
>
> diff --git a/drivers/mfd/da9052-spi.c b/drivers/mfd/da9052-spi.c
> index 17666b4..45ae0b7 100644
> --- a/drivers/mfd/da9052-spi.c
> +++ b/drivers/mfd/da9052-spi.c
> @@ -23,6 +23,7 @@
>
> static int da9052_spi_probe(struct spi_device *spi)
> {
> + struct regmap_config config;
> int ret;
> const struct spi_device_id *id = spi_get_device_id(spi);
> struct da9052 *da9052;
> @@ -40,10 +41,10 @@ static int da9052_spi_probe(struct spi_device *spi)
>
> spi_set_drvdata(spi, da9052);
>
> - da9052_regmap_config.read_flag_mask = 1;
> - da9052_regmap_config.write_flag_mask = 0;
> + config = da9052_regmap_config;
> + config.read_flag_mask = 1;
>
> - da9052->regmap = devm_regmap_init_spi(spi, &da9052_regmap_config);
> + da9052->regmap = devm_regmap_init_spi(spi, &config);
> if (IS_ERR(da9052->regmap)) {
> ret = PTR_ERR(da9052->regmap);
> dev_err(&spi->dev, "Failed to allocate register map: %d\n",
> diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
> index bba65f5..c18a4c1 100644
> --- a/include/linux/mfd/da9052/da9052.h
> +++ b/include/linux/mfd/da9052/da9052.h
> @@ -211,7 +211,7 @@ static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg,
> int da9052_device_init(struct da9052 *da9052, u8 chip_id);
> void da9052_device_exit(struct da9052 *da9052);
>
> -extern struct regmap_config da9052_regmap_config;
> +extern const struct regmap_config da9052_regmap_config;
>
> int da9052_irq_init(struct da9052 *da9052);
> int da9052_irq_exit(struct da9052 *da9052);
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-09-04 8:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-16 13:23 [PATCH] mfd: da9052: Avoid setting read_flag_mask for da9052-i2c driver Axel Lin
2014-08-28 11:20 ` Lee Jones
2014-08-28 13:38 ` Opensource [Adam Thomson]
2014-09-03 10:50 ` Opensource [Adam Thomson]
2014-09-04 8:40 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox