Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6330273imu; Sun, 2 Dec 2018 15:36:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/WRSH8tXvNHPAWZuCGhfpM4vNIS3hZYUUrX0cGOJcYCyLYFez8zcGTlk14gRbcfqMrL2PiF X-Received: by 2002:a62:fc86:: with SMTP id e128mr14362117pfh.54.1543793769102; Sun, 02 Dec 2018 15:36:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543793769; cv=none; d=google.com; s=arc-20160816; b=xuvqaQKEj0OQc4b4BgffTbXYyoGt3QjScwPqNitDNi3ICyKxmRRp29/D53Abi8a/+f h9kYi4PiJAjkAirlFr4d1rdiJXjMNCDtpCeUeq6pfcvsrZBGSo7gvDhV/1D3Y0RJ8yxK ahRU82jQPOlVK9AVcZ8D6uGyvh2Umwj09dyxGkeRSzvvBTHBR+o8VK9mp/rneCJIFS// vMNZXGBAb0j6Et2TkQNTsp2d0nE+nuLK3ziZWLIdmDXYGNNhSYL2yufNo4bom3TglX8J e5cgNw9vbCgqkiPlvMtAJ0/8n20/oRhOKi9eILrXT7zLMAFcirMtU+r9T7Po5vp6QB5B 5wmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=857NZeX2H0wECMiHmbeIWgKFFcnwaFUidcy8qiTUNIo=; b=iQmZIO73WPeAPhEb/mbum6li41lg9HNnL3XI/sClB7P3LbLLNgLt7BJWkw2gYP/ePy 627zx6RqiBI69ZSQu/nA7CciNHK93cU0R/AQrhC2D5UKmvMJuIS76tT3aaSSa13ywvrn tz6q/7uKoGQZG0zqeflDY46HZaioGASaqvr4f+0QpOPaH8HwJDe0nIFeGFtFeS44ftD9 TlbN30+n1ehmatkAkIxDIFEby3FxpdvGN1O8UlbmXQ56XTrVB8FdoVnhdCgocHEKd62Y AJMs7LD68US+PxrPdiPgxCx7JNMNKMF+25+9zkoIjuKdPGpgFIOXfvnF1MD/BAmc0EDT mXUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@infradead.org header.s=bombadil.20170209 header.b=WHvpqN98; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p32si10366903pgm.413.2018.12.02.15.35.54; Sun, 02 Dec 2018 15:36:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@infradead.org header.s=bombadil.20170209 header.b=WHvpqN98; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725829AbeLBXfU (ORCPT + 99 others); Sun, 2 Dec 2018 18:35:20 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:36908 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725786AbeLBXfU (ORCPT ); Sun, 2 Dec 2018 18:35:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=0kH665vhbUf2eI9G20oKpGZ49nFsld92hekZ4ynOsw8=; b=WHvpqN98tUZtK89Zu/93Yr5F/ omOuwCxdZDDzr7zf8zVtueZIdvKVTZhtlUZGFYk0XtTI4T+lb3d8G3hGPTNIB6uOXQP6uC/3a14r2 J97HNNmp5ZkIgCqKRMPsZDwne6+shve7PGghAOTlBrSJX4ZNmRITChGMjOU3tAM3u4YGNcwWHtfLj a34xi2JS1pnigGioOA5D9SC7R6e+pcOGr+++SxI3NgPKeOVo/eiVA0kq/Vii6rAQifSuMRGXI5+Dx aTUsmQ2PsQDXth+ashoFrP58FMl9KyvbiUL57CUIP6I6SwhM1RWqvbdUvwgFH0HxGXPR+AwDPlrbe /4LJ7Qy7g==; Received: from dvhart by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTbGN-0004uO-CA; Sun, 02 Dec 2018 23:34:59 +0000 Date: Sun, 2 Dec 2018 15:34:58 -0800 From: Darren Hart To: Lubomir Rintel Cc: Mark Brown , Geert Uytterhoeven , Andy Shevchenko , Greg Kroah-Hartman , James Cameron , Sebastian Reichel , Rob Herring , Mark Rutland , Eric Miao , Haojian Zhuang , Daniel Mack , Robert Jarzmik , linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, platform-driver-x86@vger.kernel.org, devel@driverdev.osuosl.org, linux-pm@vger.kernel.org Subject: Re: [PATCH v2 17/17] power: supply: olpc_battery: Add OLPC XO 1.75 support Message-ID: <20181202233458.GE23087@wrath> References: <20181116162403.49854-1-lkundrak@v3.sk> <20181116162403.49854-18-lkundrak@v3.sk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181116162403.49854-18-lkundrak@v3.sk> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 16, 2018 at 05:24:03PM +0100, Lubomir Rintel wrote: > The battery and the protocol are essentially the same as OLPC XO 1.5, > but the responses from the EC are LSB first. > > Signed-off-by: Lubomir Rintel > Acked-by: Pavel Machek > > --- > Changes since v1: > - s/s16 ecword_to_cpu/u16 ecword_to_cpu/ > - s/u16 ec_byte/u16 ec_word/ > > drivers/power/supply/olpc_battery.c | 23 ++++++++++++++++++----- > 1 file changed, 18 insertions(+), 5 deletions(-) > > diff --git a/drivers/power/supply/olpc_battery.c b/drivers/power/supply/olpc_battery.c ... > @@ -626,6 +635,10 @@ static int olpc_battery_probe(struct platform_device *pdev) > if (ecver > 0x44) { > /* XO 1 or 1.5 with a new EC firmware. */ > data->new_proto = 1; > + } else if (of_find_compatible_node(NULL, NULL, "olpc,xo1.75-ec")) { This if/else blocks concerns me a bit, but I might just be missing some context. This tests both ecver as well as the OF compatible string, is this reliable? Do we know that for all xo1.75-ec compatible nodes the ecver will be <= 0x44? Or, is ecver undefined? If the latter, then perhaps this test should be performed first? if (of_find_compatible_node....x01.75-ec...) ... else if (ecver > 0x44) ... else ... And what happens when ecver == 0x44? We test for > and < but not ==, <=, or >= in this block > + /* XO 1.75 */ > + data->new_proto = 1; > + data->little_endian = 1; > } else if (ecver < 0x44) { > /* > * We've seen a number of EC protocol changes; this driver > -- > 2.19.1 > > -- Darren Hart VMware Open Source Technology Center