From patchwork Thu Sep 4 12:01:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 36697 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ABAB9202E4 for ; Thu, 4 Sep 2014 12:03:20 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id v10sf772431pde.2 for ; Thu, 04 Sep 2014 05:03:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=aOlbUWkn4mc1yiT47A/3FKTgH/a4PQPf4j+BeGT3zWI=; b=W2EGoUyM2dnpHmD9kMHLXF2Hf4WVUXH1LSWSC5+9SHt9gdoye8joJAE9RNVXWnGO4Y mbp1WSTlpPayrBvTZdC174+WRhXgUppIHhNm/1gdEnvG8k5E9qf6k3j/iBHQxjv99vRi YHj8MGBXFEnhjS9/sWD4fyrLCP5OKraGjogU5y5J6i7j28Euumu45aO0ASSoQxuuF4LD PJW3dUh+KTIQbCrLGXYzUWC2nMH6gKCksaUlyP6TD7AChD3KmTUd09PMnOM2YppMq4qY f4UhO9/aSa8WcubAILoiXuD5TjOeNsQZWzJH+sNPkAKlMIeKGynB0xDrweKIZsA10/XN iGfQ== X-Gm-Message-State: ALoCoQlBf+Qcg7GIW/J5U6Wv1RcNGNi0+faWSwV7rLMTo/DCpl+Qn6ecbP80zOkYUwRyKfrRLCuj X-Received: by 10.66.150.197 with SMTP id uk5mr1862278pab.41.1409832198321; Thu, 04 Sep 2014 05:03:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.49.235 with SMTP id q98ls229143qga.91.gmail; Thu, 04 Sep 2014 05:03:18 -0700 (PDT) X-Received: by 10.52.138.210 with SMTP id qs18mr2635589vdb.18.1409832198165; Thu, 04 Sep 2014 05:03:18 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id of10si5443806vcb.105.2014.09.04.05.03.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Sep 2014 05:03:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id la4so10276170vcb.23 for ; Thu, 04 Sep 2014 05:03:18 -0700 (PDT) X-Received: by 10.52.120.51 with SMTP id kz19mr295878vdb.95.1409832198087; Thu, 04 Sep 2014 05:03:18 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp824365vcb; Thu, 4 Sep 2014 05:03:17 -0700 (PDT) X-Received: by 10.70.59.104 with SMTP id y8mr8026113pdq.1.1409832197214; Thu, 04 Sep 2014 05:03:17 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id lp3si3076549pab.230.2014.09.04.05.03.12 for ; Thu, 04 Sep 2014 05:03:13 -0700 (PDT) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753921AbaIDMC7 (ORCPT + 15 others); Thu, 4 Sep 2014 08:02:59 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:51264 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753774AbaIDMC7 (ORCPT ); Thu, 4 Sep 2014 08:02:59 -0400 Received: by mail-pd0-f173.google.com with SMTP id p10so13290267pdj.4 for ; Thu, 04 Sep 2014 05:02:55 -0700 (PDT) X-Received: by 10.66.65.202 with SMTP id z10mr8085113pas.20.1409832174688; Thu, 04 Sep 2014 05:02:54 -0700 (PDT) Received: from localhost ([122.167.123.172]) by mx.google.com with ESMTPSA id mx3sm1522163pdb.81.2014.09.04.05.02.53 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 04 Sep 2014 05:02:54 -0700 (PDT) From: Viresh Kumar To: sre@kernel.org, dbaryshkov@gmail.com, dwmw2@infradead.org, anton@enomsg.org Cc: linux-pm@vger.kernel.org, linaro-kernel@lists.linaro.org, Viresh Kumar Subject: [PATCH 10/15] power-supply: Drop useless 'if (ret.intval)' statements Date: Thu, 4 Sep 2014 17:31:31 +0530 Message-Id: <757d201831cd8187644fc50705a8415e44237e00.1409831636.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.0.3.693.g996b0fd In-Reply-To: <2eacd908a8094887cc1796f75ae0513be8a3e36d.1409831636.git.viresh.kumar@linaro.org> References: <2eacd908a8094887cc1796f75ae0513be8a3e36d.1409831636.git.viresh.kumar@linaro.org> In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , There is no need to check the value of ret.intval before returning it, as we will be returning zero explicitly when ret.intval is zero. So essentially we will end up returning value of ret.intval as it is. Drop the unnecessary 'if' statements. Signed-off-by: Viresh Kumar --- drivers/power/power_supply_core.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 55140eb..bcff7fd 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c @@ -265,10 +265,8 @@ static int __power_supply_am_i_supplied(struct device *dev, void *data) struct power_supply *epsy = dev_get_drvdata(dev); if (__power_supply_is_supplied_by(epsy, psy)) - if (!epsy->get_property(epsy, POWER_SUPPLY_PROP_ONLINE, &ret)) { - if (ret.intval) - return ret.intval; - } + if (!epsy->get_property(epsy, POWER_SUPPLY_PROP_ONLINE, &ret)) + return ret.intval; return 0; } @@ -293,12 +291,10 @@ static int __power_supply_is_system_supplied(struct device *dev, void *data) unsigned int *count = data; (*count)++; - if (psy->type != POWER_SUPPLY_TYPE_BATTERY) { - if (psy->get_property(psy, POWER_SUPPLY_PROP_ONLINE, &ret)) - return 0; - if (ret.intval) + if (psy->type != POWER_SUPPLY_TYPE_BATTERY) + if (!psy->get_property(psy, POWER_SUPPLY_PROP_ONLINE, &ret)) return ret.intval; - } + return 0; }