All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Gene Chen <gene.chen.richtek@gmail.com>
Cc: Gene Chen <gene_chen@richtek.com>,
	linux-kernel@vger.kernel.org, cy_huang@richtek.com,
	benjamin.chao@mediatek.com, linux-mediatek@lists.infradead.org,
	Matthias Brugger <matthias.bgg@gmail.com>,
	linux-arm-kernel@lists.infradead.org, shufan_lee@richtek.com
Subject: Re: [PATCH v4 9/9] mfd: mt6360: Merge different sub-devices I2C read/write
Date: Tue, 8 Sep 2020 12:48:19 +0100	[thread overview]
Message-ID: <20200908114819.GO4400@dell> (raw)
In-Reply-To: <CAE+NS37uFoDhWyGkw0WTu+tR+_85EwzYRqecNMG6nK6b2J=9jg@mail.gmail.com>

On Tue, 01 Sep 2020, Gene Chen wrote:

> Lee Jones <lee.jones@linaro.org> 於 2020年8月28日 週五 下午6:40寫道:
> >
> > On Mon, 17 Aug 2020, Gene Chen wrote:
> >
> > > From: Gene Chen <gene_chen@richtek.com>
> > >
> > > Remove unuse register definition.
> >
> > This should be in a separate patch.
> >
> > > Merge different sub-devices I2C read/write functions into one Regmap,
> > > because PMIC and LDO part need CRC bits for access protection.
> > >
> > > Signed-off-by: Gene Chen <gene_chen@richtek.com>
> > > ---
> > >  drivers/mfd/Kconfig        |   1 +
> > >  drivers/mfd/mt6360-core.c  | 260 +++++++++++++++++++++++++++++++++++++++------
> > >  include/linux/mfd/mt6360.h | 240 -----------------------------------------
> > >  3 files changed, 226 insertions(+), 275 deletions(-)
> > >  delete mode 100644 include/linux/mfd/mt6360.h
> > >
> > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> > > index a37d7d1..0684ddc 100644
> > > --- a/drivers/mfd/Kconfig
> > > +++ b/drivers/mfd/Kconfig
> > > @@ -913,6 +913,7 @@ config MFD_MT6360
> > >       select MFD_CORE
> > >       select REGMAP_I2C
> > >       select REGMAP_IRQ
> > > +     select CRC8
> > >       depends on I2C
> > >       help
> > >         Say Y here to enable MT6360 PMU/PMIC/LDO functional support.
> > > diff --git a/drivers/mfd/mt6360-core.c b/drivers/mfd/mt6360-core.c
> > > index 677c974..e995220 100644
> > > --- a/drivers/mfd/mt6360-core.c
> > > +++ b/drivers/mfd/mt6360-core.c
> > > @@ -14,7 +14,53 @@
> > >  #include <linux/regmap.h>
> > >  #include <linux/slab.h>
> > >
> > > -#include <linux/mfd/mt6360.h>
> > > +enum {
> > > +     MT6360_SLAVE_TCPC = 0,
> > > +     MT6360_SLAVE_PMIC,
> > > +     MT6360_SLAVE_LDO,
> > > +     MT6360_SLAVE_PMU,
> > > +     MT6360_SLAVE_MAX,
> > > +};
> > > +
> > > +struct mt6360_ddata {
> > > +     struct i2c_client *i2c[MT6360_SLAVE_MAX];
> > > +     struct device *dev;
> > > +     struct regmap *regmap;
> > > +     struct regmap_irq_chip_data *irq_data;
> > > +     unsigned int chip_rev;
> > > +     u8 crc8_tbl[CRC8_TABLE_SIZE];
> > > +};
> >
> > This is not a new structure, right?  Where was this before?  Surely it
> > should be removed from wherever it was in the same patch that places
> > it here?
> >
> 
> No, it is merge from header file to source code for unuse in other sub-module.

So where did it come from and why don't I see the removal in this
patch?

[...]

> > > -static const unsigned short mt6360_slave_addr[MT6360_SLAVE_MAX] = {
> > > -     MT6360_PMU_SLAVEID,
> > > +static const u16 mt6360_slave_addrs[MT6360_SLAVE_MAX] = {
> >
> > Why are you changing the data type?
> >
> 
> Easy to read.
> I think it's the same?

It's an unrelated change and should not be in this patch.

Please separate patches into functional changes.

> > > +     MT6360_TCPC_SLAVEID,
> > >       MT6360_PMIC_SLAVEID,
> > >       MT6360_LDO_SLAVEID,
> > > -     MT6360_TCPC_SLAVEID,
> > > +     MT6360_PMU_SLAVEID,
> > > +};

[...]

> > >  static int mt6360_probe(struct i2c_client *client)
> > > @@ -329,9 +521,23 @@ static int mt6360_probe(struct i2c_client *client)
> > >               return -ENOMEM;
> > >
> > >       ddata->dev = &client->dev;
> > > -     i2c_set_clientdata(client, ddata);
> > >
> > > -     ddata->regmap = devm_regmap_init_i2c(client, &mt6360_pmu_regmap_config);
> > > +     for (i = 0; i < MT6360_SLAVE_MAX - 1; i++) {
> > > +             ddata->i2c[i] = devm_i2c_new_dummy_device(&client->dev,
> > > +                                                       client->adapter,
> > > +                                                       mt6360_slave_addrs[i]);
> > > +             if (IS_ERR(ddata->i2c[i])) {
> > > +                     dev_err(&client->dev,
> > > +                             "Failed to get new dummy I2C device for address 0x%x",
> > > +                             mt6360_slave_addrs[i]);
> > > +                     return PTR_ERR(ddata->i2c[i]);
> >
> > Do you have to free the new devices you just allocated?
> >
> 
> Usually no need to free devm_i2c_new_dummy_device,
> Should I use kfree(ddata->i2c[i]);?

You tell me.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Lee Jones <lee.jones@linaro.org>
To: Gene Chen <gene.chen.richtek@gmail.com>
Cc: Gene Chen <gene_chen@richtek.com>,
	linux-kernel@vger.kernel.org, cy_huang@richtek.com,
	benjamin.chao@mediatek.com, linux-mediatek@lists.infradead.org,
	Matthias Brugger <matthias.bgg@gmail.com>,
	linux-arm-kernel@lists.infradead.org, shufan_lee@richtek.com
Subject: Re: [PATCH v4 9/9] mfd: mt6360: Merge different sub-devices I2C read/write
Date: Tue, 8 Sep 2020 12:48:19 +0100	[thread overview]
Message-ID: <20200908114819.GO4400@dell> (raw)
In-Reply-To: <CAE+NS37uFoDhWyGkw0WTu+tR+_85EwzYRqecNMG6nK6b2J=9jg@mail.gmail.com>

On Tue, 01 Sep 2020, Gene Chen wrote:

> Lee Jones <lee.jones@linaro.org> 於 2020年8月28日 週五 下午6:40寫道:
> >
> > On Mon, 17 Aug 2020, Gene Chen wrote:
> >
> > > From: Gene Chen <gene_chen@richtek.com>
> > >
> > > Remove unuse register definition.
> >
> > This should be in a separate patch.
> >
> > > Merge different sub-devices I2C read/write functions into one Regmap,
> > > because PMIC and LDO part need CRC bits for access protection.
> > >
> > > Signed-off-by: Gene Chen <gene_chen@richtek.com>
> > > ---
> > >  drivers/mfd/Kconfig        |   1 +
> > >  drivers/mfd/mt6360-core.c  | 260 +++++++++++++++++++++++++++++++++++++++------
> > >  include/linux/mfd/mt6360.h | 240 -----------------------------------------
> > >  3 files changed, 226 insertions(+), 275 deletions(-)
> > >  delete mode 100644 include/linux/mfd/mt6360.h
> > >
> > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> > > index a37d7d1..0684ddc 100644
> > > --- a/drivers/mfd/Kconfig
> > > +++ b/drivers/mfd/Kconfig
> > > @@ -913,6 +913,7 @@ config MFD_MT6360
> > >       select MFD_CORE
> > >       select REGMAP_I2C
> > >       select REGMAP_IRQ
> > > +     select CRC8
> > >       depends on I2C
> > >       help
> > >         Say Y here to enable MT6360 PMU/PMIC/LDO functional support.
> > > diff --git a/drivers/mfd/mt6360-core.c b/drivers/mfd/mt6360-core.c
> > > index 677c974..e995220 100644
> > > --- a/drivers/mfd/mt6360-core.c
> > > +++ b/drivers/mfd/mt6360-core.c
> > > @@ -14,7 +14,53 @@
> > >  #include <linux/regmap.h>
> > >  #include <linux/slab.h>
> > >
> > > -#include <linux/mfd/mt6360.h>
> > > +enum {
> > > +     MT6360_SLAVE_TCPC = 0,
> > > +     MT6360_SLAVE_PMIC,
> > > +     MT6360_SLAVE_LDO,
> > > +     MT6360_SLAVE_PMU,
> > > +     MT6360_SLAVE_MAX,
> > > +};
> > > +
> > > +struct mt6360_ddata {
> > > +     struct i2c_client *i2c[MT6360_SLAVE_MAX];
> > > +     struct device *dev;
> > > +     struct regmap *regmap;
> > > +     struct regmap_irq_chip_data *irq_data;
> > > +     unsigned int chip_rev;
> > > +     u8 crc8_tbl[CRC8_TABLE_SIZE];
> > > +};
> >
> > This is not a new structure, right?  Where was this before?  Surely it
> > should be removed from wherever it was in the same patch that places
> > it here?
> >
> 
> No, it is merge from header file to source code for unuse in other sub-module.

So where did it come from and why don't I see the removal in this
patch?

[...]

> > > -static const unsigned short mt6360_slave_addr[MT6360_SLAVE_MAX] = {
> > > -     MT6360_PMU_SLAVEID,
> > > +static const u16 mt6360_slave_addrs[MT6360_SLAVE_MAX] = {
> >
> > Why are you changing the data type?
> >
> 
> Easy to read.
> I think it's the same?

It's an unrelated change and should not be in this patch.

Please separate patches into functional changes.

> > > +     MT6360_TCPC_SLAVEID,
> > >       MT6360_PMIC_SLAVEID,
> > >       MT6360_LDO_SLAVEID,
> > > -     MT6360_TCPC_SLAVEID,
> > > +     MT6360_PMU_SLAVEID,
> > > +};

[...]

> > >  static int mt6360_probe(struct i2c_client *client)
> > > @@ -329,9 +521,23 @@ static int mt6360_probe(struct i2c_client *client)
> > >               return -ENOMEM;
> > >
> > >       ddata->dev = &client->dev;
> > > -     i2c_set_clientdata(client, ddata);
> > >
> > > -     ddata->regmap = devm_regmap_init_i2c(client, &mt6360_pmu_regmap_config);
> > > +     for (i = 0; i < MT6360_SLAVE_MAX - 1; i++) {
> > > +             ddata->i2c[i] = devm_i2c_new_dummy_device(&client->dev,
> > > +                                                       client->adapter,
> > > +                                                       mt6360_slave_addrs[i]);
> > > +             if (IS_ERR(ddata->i2c[i])) {
> > > +                     dev_err(&client->dev,
> > > +                             "Failed to get new dummy I2C device for address 0x%x",
> > > +                             mt6360_slave_addrs[i]);
> > > +                     return PTR_ERR(ddata->i2c[i]);
> >
> > Do you have to free the new devices you just allocated?
> >
> 
> Usually no need to free devm_i2c_new_dummy_device,
> Should I use kfree(ddata->i2c[i]);?

You tell me.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Lee Jones <lee.jones@linaro.org>
To: Gene Chen <gene.chen.richtek@gmail.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	Gene Chen <gene_chen@richtek.com>,
	benjamin.chao@mediatek.com, shufan_lee@richtek.com,
	cy_huang@richtek.com
Subject: Re: [PATCH v4 9/9] mfd: mt6360: Merge different sub-devices I2C read/write
Date: Tue, 8 Sep 2020 12:48:19 +0100	[thread overview]
Message-ID: <20200908114819.GO4400@dell> (raw)
In-Reply-To: <CAE+NS37uFoDhWyGkw0WTu+tR+_85EwzYRqecNMG6nK6b2J=9jg@mail.gmail.com>

On Tue, 01 Sep 2020, Gene Chen wrote:

> Lee Jones <lee.jones@linaro.org> 於 2020年8月28日 週五 下午6:40寫道:
> >
> > On Mon, 17 Aug 2020, Gene Chen wrote:
> >
> > > From: Gene Chen <gene_chen@richtek.com>
> > >
> > > Remove unuse register definition.
> >
> > This should be in a separate patch.
> >
> > > Merge different sub-devices I2C read/write functions into one Regmap,
> > > because PMIC and LDO part need CRC bits for access protection.
> > >
> > > Signed-off-by: Gene Chen <gene_chen@richtek.com>
> > > ---
> > >  drivers/mfd/Kconfig        |   1 +
> > >  drivers/mfd/mt6360-core.c  | 260 +++++++++++++++++++++++++++++++++++++++------
> > >  include/linux/mfd/mt6360.h | 240 -----------------------------------------
> > >  3 files changed, 226 insertions(+), 275 deletions(-)
> > >  delete mode 100644 include/linux/mfd/mt6360.h
> > >
> > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> > > index a37d7d1..0684ddc 100644
> > > --- a/drivers/mfd/Kconfig
> > > +++ b/drivers/mfd/Kconfig
> > > @@ -913,6 +913,7 @@ config MFD_MT6360
> > >       select MFD_CORE
> > >       select REGMAP_I2C
> > >       select REGMAP_IRQ
> > > +     select CRC8
> > >       depends on I2C
> > >       help
> > >         Say Y here to enable MT6360 PMU/PMIC/LDO functional support.
> > > diff --git a/drivers/mfd/mt6360-core.c b/drivers/mfd/mt6360-core.c
> > > index 677c974..e995220 100644
> > > --- a/drivers/mfd/mt6360-core.c
> > > +++ b/drivers/mfd/mt6360-core.c
> > > @@ -14,7 +14,53 @@
> > >  #include <linux/regmap.h>
> > >  #include <linux/slab.h>
> > >
> > > -#include <linux/mfd/mt6360.h>
> > > +enum {
> > > +     MT6360_SLAVE_TCPC = 0,
> > > +     MT6360_SLAVE_PMIC,
> > > +     MT6360_SLAVE_LDO,
> > > +     MT6360_SLAVE_PMU,
> > > +     MT6360_SLAVE_MAX,
> > > +};
> > > +
> > > +struct mt6360_ddata {
> > > +     struct i2c_client *i2c[MT6360_SLAVE_MAX];
> > > +     struct device *dev;
> > > +     struct regmap *regmap;
> > > +     struct regmap_irq_chip_data *irq_data;
> > > +     unsigned int chip_rev;
> > > +     u8 crc8_tbl[CRC8_TABLE_SIZE];
> > > +};
> >
> > This is not a new structure, right?  Where was this before?  Surely it
> > should be removed from wherever it was in the same patch that places
> > it here?
> >
> 
> No, it is merge from header file to source code for unuse in other sub-module.

So where did it come from and why don't I see the removal in this
patch?

[...]

> > > -static const unsigned short mt6360_slave_addr[MT6360_SLAVE_MAX] = {
> > > -     MT6360_PMU_SLAVEID,
> > > +static const u16 mt6360_slave_addrs[MT6360_SLAVE_MAX] = {
> >
> > Why are you changing the data type?
> >
> 
> Easy to read.
> I think it's the same?

It's an unrelated change and should not be in this patch.

Please separate patches into functional changes.

> > > +     MT6360_TCPC_SLAVEID,
> > >       MT6360_PMIC_SLAVEID,
> > >       MT6360_LDO_SLAVEID,
> > > -     MT6360_TCPC_SLAVEID,
> > > +     MT6360_PMU_SLAVEID,
> > > +};

[...]

> > >  static int mt6360_probe(struct i2c_client *client)
> > > @@ -329,9 +521,23 @@ static int mt6360_probe(struct i2c_client *client)
> > >               return -ENOMEM;
> > >
> > >       ddata->dev = &client->dev;
> > > -     i2c_set_clientdata(client, ddata);
> > >
> > > -     ddata->regmap = devm_regmap_init_i2c(client, &mt6360_pmu_regmap_config);
> > > +     for (i = 0; i < MT6360_SLAVE_MAX - 1; i++) {
> > > +             ddata->i2c[i] = devm_i2c_new_dummy_device(&client->dev,
> > > +                                                       client->adapter,
> > > +                                                       mt6360_slave_addrs[i]);
> > > +             if (IS_ERR(ddata->i2c[i])) {
> > > +                     dev_err(&client->dev,
> > > +                             "Failed to get new dummy I2C device for address 0x%x",
> > > +                             mt6360_slave_addrs[i]);
> > > +                     return PTR_ERR(ddata->i2c[i]);
> >
> > Do you have to free the new devices you just allocated?
> >
> 
> Usually no need to free devm_i2c_new_dummy_device,
> Should I use kfree(ddata->i2c[i]);?

You tell me.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2020-09-08 11:48 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-17 10:47 [PATCH v4 0/9] mfd: mt6360: Merge different sub-devices I2C read/write Gene Chen
2020-08-17 10:47 ` Gene Chen
2020-08-17 10:47 ` Gene Chen
2020-08-17 10:47 ` [PATCH v4 1/9] mfd: mt6360: Rearrange include file Gene Chen
2020-08-17 10:47   ` Gene Chen
2020-08-17 10:47   ` Gene Chen
2020-08-28 10:12   ` Lee Jones
2020-08-28 10:12     ` Lee Jones
2020-08-28 10:12     ` Lee Jones
2020-08-17 10:47 ` [PATCH v4 2/9] mfd: mt6360: Remove redundant brackets around raw numbers Gene Chen
2020-08-17 10:47   ` Gene Chen
2020-08-17 10:47   ` Gene Chen
2020-08-17 10:47 ` [PATCH v4 3/9] mfd: mt6360: Indicate sub-dev compatible name by using "-" Gene Chen
2020-08-17 10:47   ` Gene Chen
2020-08-17 10:47   ` Gene Chen
2020-08-17 10:47 ` [PATCH v4 4/9] mfd: mt6360: Combine mt6360 pmic/ldo resources into mt6360 regulator resources Gene Chen
2020-08-17 10:47   ` Gene Chen
2020-08-17 10:47   ` Gene Chen
2020-08-17 10:47 ` [PATCH v4 5/9] mfd: mt6360: Rename mt6360_pmu_data by mt6360_ddata Gene Chen
2020-08-17 10:47   ` Gene Chen
2020-08-17 10:47   ` Gene Chen
2020-08-17 10:47 ` [PATCH v4 6/9] mfd: mt6360: Rename mt6360_pmu by mt6360 Gene Chen
2020-08-17 10:47   ` Gene Chen
2020-08-17 10:47   ` Gene Chen
2020-08-17 10:47 ` [PATCH v4 7/9] mfd: mt6360: Remove handle_post_irq callback function Gene Chen
2020-08-17 10:47   ` Gene Chen
2020-08-17 10:47   ` Gene Chen
2020-08-17 10:47 ` [PATCH v4 8/9] mfd: mt6360: Fix flow which is used to check ic exist Gene Chen
2020-08-17 10:47   ` Gene Chen
2020-08-17 10:47   ` Gene Chen
2020-08-28 10:13   ` Lee Jones
2020-08-28 10:13     ` Lee Jones
2020-08-28 10:13     ` Lee Jones
2020-08-17 10:47 ` [PATCH v4 9/9] mfd: mt6360: Merge different sub-devices I2C read/write Gene Chen
2020-08-17 10:47   ` Gene Chen
2020-08-17 10:47   ` Gene Chen
2020-08-28 10:40   ` Lee Jones
2020-08-28 10:40     ` Lee Jones
2020-08-28 10:40     ` Lee Jones
2020-09-01 12:17     ` Gene Chen
2020-09-01 12:17       ` Gene Chen
2020-09-01 12:17       ` Gene Chen
2020-09-08 11:48       ` Lee Jones [this message]
2020-09-08 11:48         ` Lee Jones
2020-09-08 11:48         ` Lee Jones
2020-09-08 23:09         ` Gene Chen
2020-09-08 23:09           ` Gene Chen
2020-09-08 23:09           ` Gene Chen
2020-09-09  7:36           ` Lee Jones
2020-09-09  7:36             ` Lee Jones
2020-09-09  7:36             ` Lee Jones

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=20200908114819.GO4400@dell \
    --to=lee.jones@linaro.org \
    --cc=benjamin.chao@mediatek.com \
    --cc=cy_huang@richtek.com \
    --cc=gene.chen.richtek@gmail.com \
    --cc=gene_chen@richtek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=shufan_lee@richtek.com \
    /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.