From patchwork Thu Sep 4 12:01:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 36702 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6DD61202E4 for ; Thu, 4 Sep 2014 12:04:38 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id w10sf58455660pde.11 for ; Thu, 04 Sep 2014 05:04:35 -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=Kgl88V7oU3UG1GohgLVw8dAgL4TIalVmgEEJuGJTAY4=; b=BGa8jwIMAZUrcnQgG9XUoZUVBv+C7HNVFDoFMO4zQNMqqVGOp+xLG8A7b0R0rKEV6D DGem7RfoI4Pnw73bbMoKKK05WiA62O7mILURW8QBbMeFUfe1DvcorKsLajo0LDdIcxMX gPIKXIHSh0kqao1yMmyAkW6LDuJUxnJ9EabXythr8gIFjDKO/uPkzJR5o2oft7nnToqQ 5zurWuTqxYEqNFiQ2EX0eTITSgLSYR+LGXMzl2M//pMYQwkQLrAG1QGJ1wSMNS1yc/5e Ec5fGTotGyn/G69bX01/nfHv0G74RaZFVs1gnItdr0EDFVoG+pBW3lPeM9uHK1qh3bhA eR3A== X-Gm-Message-State: ALoCoQnP6CdZZXKh3Wjra3c1gCTk4XhOJ6sKPbhIB3Cs4ZTsTy1k+WHOrILY//K0By5SPCuIUwn5 X-Received: by 10.66.193.227 with SMTP id hr3mr2256548pac.0.1409832273843; Thu, 04 Sep 2014 05:04:33 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.96.202 with SMTP id k68ls257988qge.48.gmail; Thu, 04 Sep 2014 05:04:33 -0700 (PDT) X-Received: by 10.220.130.131 with SMTP id t3mr3118815vcs.30.1409832273658; Thu, 04 Sep 2014 05:04:33 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id sm14si2704292vdb.78.2014.09.04.05.04.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Sep 2014 05:04:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id hq11so10288350vcb.22 for ; Thu, 04 Sep 2014 05:04:33 -0700 (PDT) X-Received: by 10.220.175.17 with SMTP id v17mr3219495vcz.0.1409832273566; Thu, 04 Sep 2014 05:04:33 -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 uj3csp824586vcb; Thu, 4 Sep 2014 05:04:33 -0700 (PDT) X-Received: by 10.70.91.73 with SMTP id cc9mr8074924pdb.138.1409832272771; Thu, 04 Sep 2014 05:04:32 -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.04.26 for ; Thu, 04 Sep 2014 05:04:27 -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 S1754005AbaIDMDX (ORCPT + 15 others); Thu, 4 Sep 2014 08:03:23 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:41831 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753774AbaIDMDV (ORCPT ); Thu, 4 Sep 2014 08:03:21 -0400 Received: by mail-pa0-f53.google.com with SMTP id fa1so19896047pad.40 for ; Thu, 04 Sep 2014 05:03:21 -0700 (PDT) X-Received: by 10.66.65.230 with SMTP id a6mr8097420pat.18.1409832201133; Thu, 04 Sep 2014 05:03:21 -0700 (PDT) Received: from localhost ([122.167.123.172]) by mx.google.com with ESMTPSA id zm5sm1518980pbb.76.2014.09.04.05.03.19 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 04 Sep 2014 05:03:20 -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 15/15] power_supply: Don't iterate over devices to return -EPROBE_DEFER Date: Thu, 4 Sep 2014 17:31:36 +0530 Message-Id: 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.177 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: , This piece of code was added so that we return -EPROBE_DEFER when no devices are registered. But even if class_for_each_device() returns 0, we are going to return -EPROBE_DEFER only. And so this code isn't required at all. Remove it. Signed-off-by: Viresh Kumar --- drivers/power/power_supply_core.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 81177e2..6cb7fe5 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c @@ -179,19 +179,6 @@ static int __power_supply_find_supply_from_node(struct device *dev, static int power_supply_find_supply_from_node(struct device_node *supply_node) { int error; - struct device *dev; - struct class_dev_iter iter; - - /* - * Use iterator to see if any other device is registered. - * This is required since class_for_each_device returns 0 - * if there are no devices registered. - */ - class_dev_iter_init(&iter, power_supply_class, NULL, NULL); - dev = class_dev_iter_next(&iter); - - if (!dev) - return -EPROBE_DEFER; /* * class_for_each_device() either returns its own errors or values