Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932498AbbESJOv (ORCPT ); Tue, 19 May 2015 05:14:51 -0400 Received: from mga11.intel.com ([192.55.52.93]:36074 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932454AbbESJOr (ORCPT ); Tue, 19 May 2015 05:14:47 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,457,1427785200"; d="scan'208";a="712333281" Date: Tue, 19 May 2015 12:14:42 +0300 From: Laurentiu Palcu To: Krzysztof Kozlowski Cc: Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: Re: [PATCH 2/2] power_supply: Add support for TI BQ25890 charger chip Message-ID: <20150519091442.GF14396@lpalcu-linux> References: <1431698778-29462-1-git-send-email-laurentiu.palcu@intel.com> <1431698778-29462-3-git-send-email-laurentiu.palcu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1182 Lines: 35 Hi Krzysztof, On Tue, May 19, 2015 at 05:40:25PM +0900, Krzysztof Kozlowski wrote: > > + > > +static int bq25890_chip_reset(struct bq25890_device *bq) > > +{ > > + int ret; > > + > > + ret = bq25890_field_write(bq, F_REG_RST, 1); > > + if (ret < 0) > > + return ret; > > + > > + do { > > + ret = bq25890_field_read(bq, F_REG_RST); > > + if (ret < 0) > > + return ret; > > + > > + usleep_range(5, 10); > > + } while (ret == 1); > > Is it possible to loop here indefinetely? According to specifications, this field is "Reset to 0 after register reset is completed", so I'm trusting the chip will behave as advertised! :) We could implement a safety mechanism to avoid looping in case the chip misbehaves but I don't think it's worth it. What do you think? I'll address the other comments in v2. Thanks for reviewing, laurentiu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/