Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp424542pxf; Wed, 31 Mar 2021 06:55:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6klPirMPEbZkfsqOpxDzCIzIZa1ZPr59wBg3JnABYIAei9Orr23K0/lQ9fV7E8vrwVElV X-Received: by 2002:aa7:c903:: with SMTP id b3mr3902302edt.156.1617198947855; Wed, 31 Mar 2021 06:55:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617198947; cv=none; d=google.com; s=arc-20160816; b=Nhl/Q8bHeOukwww8VMNSUI/d8OkJBRqM8DMt2/P2feaV26kpDdBOyIDNQHPC5EW9cm 0PG4vcyH+MRx5zLYhX4xvw5hghg+UeAHh7lZucaYXVmHur2xwH1BeM3TcJjVD4rUnvpY 6Rbq3L9Yu7MFs4AsFID7kUdXqq6NWcHDMp02PYO2hKVd9CBcyiOqOuAPfdAl6EXhVzOe Hsju3AwEWZeYqiIGti5+Y/c4S7UXWxRLGZM4fMrEvillsHZaVDEw4OMA/jJM+4oGwIJ8 0XlmeLEIqMJwqKPdEHVgLpKYsLlfEBh3L2EGw0XbHEGg4DKde3Ot07sZfI9jwgv2mweT M3rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ups7Ah437rpP0+YCCt+5xpcxnMbDUqK2fZsEZLoiGNY=; b=kB2XwfyETJaZQYyAcH0yVq5Np8/KvoA7W1VUD6sGZkiQtjqk9hVyfEv4g6FhFccGH9 kfbmo98sYJisM5vow/9Exu2Y1G4oVdxeZg1kOYrdAkrSwsPl77CxlYAjL1eKei3GSyXX PiUhOZkLHJYt3QGPWQF7itPZaNNPDoiDLkEUWJ3pbvH8038cJznIDCRkI7tHwXcKcDO1 k40kOK0XzHFPlMex5nEF9ZsQ5ABSrkDQ/upSSqFIW5ZUvwGUzohSlGwOokH+Blbq4ELo vNCdL1BNBKM/aPoJRg6s8tPmPXrd3VPm1ll9nZGQ+YYpGSM5sou31pY6BEli1Yph0Kg4 /rTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=R5G8Tv4W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g23si1586589ejd.676.2021.03.31.06.55.24; Wed, 31 Mar 2021 06:55:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=R5G8Tv4W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235911AbhCaNwW (ORCPT + 99 others); Wed, 31 Mar 2021 09:52:22 -0400 Received: from smtp2.axis.com ([195.60.68.18]:33355 "EHLO smtp2.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235763AbhCaNvs (ORCPT ); Wed, 31 Mar 2021 09:51:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1617198708; x=1648734708; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ups7Ah437rpP0+YCCt+5xpcxnMbDUqK2fZsEZLoiGNY=; b=R5G8Tv4WADo2MbWH8uml1+wpv8hm7pLAFtJDsCGBY8+uEJ8hERQC6+vv byvWAUQXRLSmb1zRMw6atTEXxkJrfMCaLgcQAPT8qRl5cuemIymuj18c9 1oP3lkMB54tuicvonJpfRRUOK/ne5vrITQPnuM+n02SMX7OsZegUnTwIJ W4FShV88PUBsTAOu5H8w4vImtxov2GkdAELL9yvJs3BudWXzDxAiSwky+ Siw0Cxog4UJaBQ2y3zrUEZBMTCeGF0MT+WNiroL+B5vzbKm8ukrMltXa8 3UvJPmL87zRYYiHjyxDAkDL451oF9G91ER7x1uplOzuFDtxw0U0/MK048 A==; From: Hermes Zhang To: , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Sebastian Reichel CC: , Hermes Zhang , , Subject: [PATCH] power: supply: bq27xxx: Return the value instead of -ENODATA Date: Wed, 31 Mar 2021 21:51:41 +0800 Message-ID: <20210331135141.8063-1-chenhui.zhang@axis.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hermes Zhang It might be better to return value (e.g. 65535) instead of an error (e.g. No data available) for the time property. Normally a common function will handle the read string and parse to integer for all the properties, but will have problem when read the time property because need to handle the NODATA error as non-error. So it will make simple for application which indicate success when read a number, otherwise as an error to handle. Signed-off-by: Hermes Zhang --- drivers/power/supply/bq27xxx_battery.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c index 4c4a7b1c64c5..b75e54aa8ada 100644 --- a/drivers/power/supply/bq27xxx_battery.c +++ b/drivers/power/supply/bq27xxx_battery.c @@ -1655,9 +1655,6 @@ static int bq27xxx_battery_read_time(struct bq27xxx_device_info *di, u8 reg) return tval; } - if (tval == 65535) - return -ENODATA; - return tval * 60; } -- 2.20.1