Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751501AbdGYJKS (ORCPT ); Tue, 25 Jul 2017 05:10:18 -0400 Received: from mail-wr0-f172.google.com ([209.85.128.172]:36107 "EHLO mail-wr0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750803AbdGYJKP (ORCPT ); Tue, 25 Jul 2017 05:10:15 -0400 Date: Tue, 25 Jul 2017 10:10:12 +0100 From: Lee Jones To: "Mani, Rajmohan" Cc: "linux-kernel@vger.kernel.org" , "linux-gpio@vger.kernel.org" , "linux-acpi@vger.kernel.org" , Linus Walleij , Alexandre Courbot , "Rafael J. Wysocki" , Len Brown , "sakari.ailus@linux.intel.com" , Andy Shevchenko Subject: Re: [PATCH v4 1/3] mfd: Add new mfd device TPS68470 Message-ID: <20170725091012.3hpxihekht2j35xb@dell> References: <1500506426-3047-1-git-send-email-rajmohan.mani@intel.com> <1500506426-3047-2-git-send-email-rajmohan.mani@intel.com> <20170720090300.ayx5pz5l4yntefpt@dell> <6F87890CF0F5204F892DEA1EF0D77A59725DD60A@FMSMSX114.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6F87890CF0F5204F892DEA1EF0D77A59725DD60A@FMSMSX114.amr.corp.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2772 Lines: 100 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 > > > --- > > > 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. > > > + 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. > > > + 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. [...] -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog