Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1695951

RE: [PATCH v4 1/3] mfd: Add new mfd device TPS68470

From "Mani, Rajmohan" <rajmohan.mani@intel.com>
Newsgroups linux.kernel
Subject RE: [PATCH v4 1/3] mfd: Add new mfd device TPS68470
Date 2017-07-25 19:10 +0200
Message-ID <u7bvj-5B8-3@gated-at.bofh.it> (permalink)
References <u56zL-7bx-5@gated-at.bofh.it> <u56zL-7bx-13@gated-at.bofh.it> <u5fD5-5dz-35@gated-at.bofh.it> <u5usq-6hA-3@gated-at.bofh.it> <u74av-VK-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Lee,

> Subject: Re: [PATCH v4 1/3] mfd: Add new mfd device TPS68470
> 
> On Fri, 21 Jul 2017, Mani, Rajmohan wrote:
> > > On Wed, 19 Jul 2017, Rajmohan Mani wrote:
> > >
> > > > The TPS68470 device is an advanced power management unit that
> > > > powers
> > > a
> > > > Compact Camera Module (CCM), generates clocks for image sensors,
> > > > drives a dual LED for Flash and incorporates two LED drivers for
> > > > general purpose indicators.
> > > >
> > > > This patch adds support for TPS68470 mfd device.
> > > >
> > > > Signed-off-by: Rajmohan Mani <rajmohan.mani@intel.com>
> > > > ---
> > > >  drivers/mfd/Kconfig          |  18 +++++++
> > > >  drivers/mfd/Makefile         |   1 +
> > > >  drivers/mfd/tps68470.c       | 110
> > > +++++++++++++++++++++++++++++++++++++++++++
> > > >  include/linux/mfd/tps68470.h |  97
> > > > ++++++++++++++++++++++++++++++++++++++
> > > >  4 files changed, 226 insertions(+)  create mode 100644
> > > > drivers/mfd/tps68470.c  create mode 100644
> > > > include/linux/mfd/tps68470.h
> 
> [...]
> 
> > > > +static const struct regmap_config tps68470_regmap_config = {
> > > > +	.reg_bits = 8,
> > > > +	.val_bits = 8,
> > > > +	.max_register = TPS68470_REG_MAX, };
> > > > +
> > > > +static int tps68470_chip_init(struct device *dev, struct regmap
> > > > +*regmap) {
> > > > +	unsigned int version;
> > > > +	int ret;
> > > > +
> > > > +	/* Force software reset */
> > > > +	ret = regmap_write(regmap, TPS68470_REG_RESET,
> > > TPS68470_REG_RESET_MASK);
> > > > +	if (ret < 0)
> > >
> > > Will 'if (!ret)' do?
> > >
> >
> > We intend to check error conditions and bail out. So, if (ret < 0) works for
> this.
> 
> Yes, 'if (!ret)' does that too.
> 

regmap_write() and regmap_read() functions return 0 on success. Hence we can not use 'if (!ret)' here, since we check for error conditions.

> > > > +		return ret;
> > > > +
> > > > +	ret = regmap_read(regmap, TPS68470_REG_REVID, &version);
> > > > +	if (ret < 0) {
> > >
> > > Same
> > >
> >
> > We intend to check error conditions and bail out. So, if (ret < 0) works for
> this.
> 
> As above.
> 

Same as above

> > > > +		dev_err(dev, "Failed to read revision register: %d\n", ret);
> > > > +		return ret;
> > > > +	}
> > > > +
> > > > +	dev_info(dev, "TPS68470 REVID: 0x%x\n", version);
> > > > +
> > > > +	return 0;
> > > > +}
> > > > +
> > > > +static int tps68470_probe(struct i2c_client *client) {
> > > > +	struct device *dev = &client->dev;
> > > > +	struct regmap *regmap;
> > > > +	int ret;
> > > > +
> > > > +	regmap = devm_regmap_init_i2c(client, &tps68470_regmap_config);
> > > > +	if (IS_ERR(regmap)) {
> > > > +		dev_err(dev, "devm_regmap_init_i2c Error %ld\n",
> > > > +			PTR_ERR(regmap));
> > > > +		return PTR_ERR(regmap);
> > > > +	}
> > > > +
> > > > +	i2c_set_clientdata(client, regmap);
> > > > +
> > > > +	ret = tps68470_chip_init(dev, regmap);
> > > > +	if (ret < 0) {
> > >
> > > Same
> > >
> >
> > We intend to check error conditions and bail out. So, if (ret < 0) works for
> this.
> 
> As above.
> 

Same as above

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 0/3] TPS68470 PMIC drivers Rajmohan Mani <rajmohan.mani@intel.com> - 2017-07-20 01:30 +0200
  [PATCH v4 1/3] mfd: Add new mfd device TPS68470 Rajmohan Mani <rajmohan.mani@intel.com> - 2017-07-20 01:30 +0200
    Re: [PATCH v4 1/3] mfd: Add new mfd device TPS68470 Lee Jones <lee.jones@linaro.org> - 2017-07-20 11:10 +0200
      RE: [PATCH v4 1/3] mfd: Add new mfd device TPS68470 "Mani, Rajmohan" <rajmohan.mani@intel.com> - 2017-07-21 03:00 +0200
        Re: [PATCH v4 1/3] mfd: Add new mfd device TPS68470 Lee Jones <lee.jones@linaro.org> - 2017-07-25 11:20 +0200
          Re: [PATCH v4 1/3] mfd: Add new mfd device TPS68470 Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-25 12:30 +0200
            Re: [PATCH v4 1/3] mfd: Add new mfd device TPS68470 Lee Jones <lee.jones@linaro.org> - 2017-07-26 10:30 +0200
              Re: [PATCH v4 1/3] mfd: Add new mfd device TPS68470 Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-26 12:30 +0200
                RE: [PATCH v4 1/3] mfd: Add new mfd device TPS68470 "Mani, Rajmohan" <rajmohan.mani@intel.com> - 2017-07-28 02:40 +0200
                Re: [PATCH v4 1/3] mfd: Add new mfd device TPS68470 Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-28 11:20 +0200
                RE: [PATCH v4 1/3] mfd: Add new mfd device TPS68470 "Mani, Rajmohan" <rajmohan.mani@intel.com> - 2017-07-29 01:50 +0200
          RE: [PATCH v4 1/3] mfd: Add new mfd device TPS68470 "Mani, Rajmohan" <rajmohan.mani@intel.com> - 2017-07-25 19:10 +0200
            Re: [PATCH v4 1/3] mfd: Add new mfd device TPS68470 Lee Jones <lee.jones@linaro.org> - 2017-07-26 10:30 +0200
              RE: [PATCH v4 1/3] mfd: Add new mfd device TPS68470 "Mani, Rajmohan" <rajmohan.mani@intel.com> - 2017-07-29 01:50 +0200
      RE: [PATCH v4 1/3] mfd: Add new mfd device TPS68470 "Mani, Rajmohan" <rajmohan.mani@intel.com> - 2017-07-21 14:30 +0200

csiph-web