Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757170AbaF3Tx0 (ORCPT ); Mon, 30 Jun 2014 15:53:26 -0400 Received: from mail-oa0-f48.google.com ([209.85.219.48]:48548 "EHLO mail-oa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756947AbaF3TxZ (ORCPT ); Mon, 30 Jun 2014 15:53:25 -0400 MIME-Version: 1.0 In-Reply-To: <1404157796-13613-2-git-send-email-marek@goldelico.com> References: <1404157796-13613-1-git-send-email-marek@goldelico.com> <1404157796-13613-2-git-send-email-marek@goldelico.com> Date: Mon, 30 Jun 2014 21:53:24 +0200 Message-ID: Subject: Re: [PATCH 2/2] bq27000: report missing device better. From: Belisko Marek To: Dmitry Eremin-Solenikov , David Woodhouse , Sebastian Reichel Cc: "Dr. H. Nikolaus Schaller" , Marek Belisko , NeilBrown , LKML Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CCing lkml On Mon, Jun 30, 2014 at 9:49 PM, Marek Belisko wrote: > One an hdq buss, a missing device reads as 0xff, not -1. > So do a translation to allow detecting of a missing bus. > > Signed-off-by: NeilBrown > --- > drivers/power/bq27x00_battery.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c > index 27bac1d..aa80efc 100644 > --- a/drivers/power/bq27x00_battery.c > +++ b/drivers/power/bq27x00_battery.c > @@ -420,6 +420,9 @@ static void bq27x00_update(struct bq27x00_device_info *di) > int flags_changed; > > cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, !is_bq27500); > + if ((cache.flags & 0xff) == 0xff) > + /* read error */ > + cache.flags = -1; > if (cache.flags >= 0) { > if (!is_bq27500 && !is_bq27425 > && (cache.flags & BQ27000_FLAG_CI)) { > -- > 1.9.1 > -- as simple and primitive as possible ------------------------------------------------- Marek Belisko - OPEN-NANDRA Freelance Developer Ruska Nova Ves 219 | Presov, 08005 Slovak Republic Tel: +421 915 052 184 skype: marekwhite twitter: #opennandra web: http://open-nandra.com -- 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/