From patchwork Fri Nov 16 11:01:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 151329 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp278707ljp; Fri, 16 Nov 2018 03:01:56 -0800 (PST) X-Google-Smtp-Source: AJdET5cxqfTsg8vQ8uRIlCMW/oQ4IAHSoy84vfvPQcCCiF6IBk2qo1HNcq1eesDWsgyPVRbi2qNN X-Received: by 2002:a63:a16:: with SMTP id 22mr9505345pgk.318.1542366116006; Fri, 16 Nov 2018 03:01:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542366116; cv=none; d=google.com; s=arc-20160816; b=lcKaArTdAnl6vOPZgKNNUbaQZ/0erJT1QXq6IAWVOiLtuZRgk6BbcmkzFhYmehDNES 3ygpc6t0U7abvc1RKI2Bcp7zRws+eKFyorkGJVB8Vt5mR+qgHyePHPRy+15WF/T9zAZP 2KDg7QHp0aa1EOWJpyJHFazVe9iWKmHNtM9S6eWN3qEz2iiTPXZ1NTyG54vmZK99C2Z1 HDvm489E3cjbV4H9MD00c5IXtDXXA4/+RNJLoVAohy9sAueILYq4LKUHAvD4MW7qGWC2 usPDOlorYZCKbR3sM/CjjPqrzItRfAr2vpVO8ffFsdeKwTCsHiQU3aZ2eUT8fkFyQuP1 GmSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=6LJBTmjPNOjTTUrUiu6Uu+XwWfVjQEp0CGIbptL2pHE=; b=mc5RWV5ApnYWRyn0OkXDqqZYQhILf3MgTMwYBtXoFCY757DaI1d0idpYWNuLFtR0J3 Z0hzSowlgf9a+GegnCxjHJJdOUrMTJ4Yg6VD/iPwBX2n6xHw9NwWjyrDA0CVN8mU2C3+ hxK+xfcDP3sGvwaaTN7qfdFEPj7MdE6TOIrfHk7yNuQvtVGl5rXUxidb2S66zPOA9DC6 rNbOtwbb6lduma+HvXYkqGZMkRWL7rXOew3xplCXHV2WxX/7RL2R0zIAxS7jKCvumjRi dlqEzPxYdVGqffKlOC8KFAFCTzkUgKaAVZXntK9TyHp2Pzgho/bch2hGShExlbCsuwZz W1lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fapVZTL3; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b4-v6si32659547pla.189.2018.11.16.03.01.55; Fri, 16 Nov 2018 03:01:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fapVZTL3; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727624AbeKPVNp (ORCPT + 6 others); Fri, 16 Nov 2018 16:13:45 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:37594 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727544AbeKPVNp (ORCPT ); Fri, 16 Nov 2018 16:13:45 -0500 Received: by mail-pf1-f193.google.com with SMTP id u3-v6so8572850pfm.4 for ; Fri, 16 Nov 2018 03:01:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=6LJBTmjPNOjTTUrUiu6Uu+XwWfVjQEp0CGIbptL2pHE=; b=fapVZTL3wXtnQ6qrqRRDkPW6zHsdgy5Hy97ifAbfHXRkAIiBxsmM0Sy8undREmQltZ aWIExxCEv7GERjq3U5gIThtpDaIv68DyzvWZg+mMtu8D+GCLNz8sKR2/r5/GBsn5M8YL Qv4l4dWy/0EKyK5VjrApfY2CXYwApuZdj6eHw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6LJBTmjPNOjTTUrUiu6Uu+XwWfVjQEp0CGIbptL2pHE=; b=M8s5CGrvwTDIovDct5slXzBBIjRb7j9QWNU90Ft+1KhlJkCOJFJdx9VwXTbDk0JRxP DZS/UkQ03y96O/QCwWLQYcr2HxonvoAHm7fht8eRwDZr/eY+n4Pv0Tr85O+4DU9O2vdx yAaV7dKKxjnBu9nNy1Zns7lRPGmaDbnlZOgYyBEJSY2lTx6TkAfTRWOuPXyt9j2M85uC pJ1ACUIQivN7LZBYL/SM9PwmzmSH1j2daBQ+ydIfKYeH3SZStE9Fyy+07rSapxCo8G7y MXg0W58HS+lXRoukJ2UdWiWZw+CMzCowRXtyuwC/cQunahdAaQcx7Rmvtb8m1xDAj/A9 k7PQ== X-Gm-Message-State: AGRZ1gK/sCF8sldXwJ85Ur3QPnFJuJsEDZwhro+QKd/z2hiLbWl9ETmk Yg3W6TAwuf6Z6LoKs2WBM6g5NQ== X-Received: by 2002:a63:dc0c:: with SMTP id s12mr9577968pgg.398.1542366114488; Fri, 16 Nov 2018 03:01:54 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id 202sm21268106pfy.87.2018.11.16.03.01.50 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Nov 2018 03:01:53 -0800 (PST) From: Baolin Wang To: sre@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, yuanjiang.yu@unisoc.com, baolin.wang@linaro.org, broonie@kernel.org, linus.walleij@linaro.org Subject: [PATCH 1/6] power: supply: charger-manager: Remove unused index counting Date: Fri, 16 Nov 2018 19:01:08 +0800 Message-Id: <4ea9eaf85d780afb190cb45da2df8ff5fd86d449.1542362262.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Remove unused index counting. Signed-off-by: Baolin Wang --- drivers/power/supply/charger-manager.c | 4 ---- 1 file changed, 4 deletions(-) -- 1.7.9.5 diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c index faa1a67..a1b420a 100644 --- a/drivers/power/supply/charger-manager.c +++ b/drivers/power/supply/charger-manager.c @@ -1687,10 +1687,6 @@ static int charger_manager_probe(struct platform_device *pdev) return -EINVAL; } - /* Counting index only */ - while (desc->psy_charger_stat[i]) - i++; - /* Check if charger's supplies are present at probe */ for (i = 0; desc->psy_charger_stat[i]; i++) { struct power_supply *psy; From patchwork Fri Nov 16 11:01:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 151331 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp278927ljp; Fri, 16 Nov 2018 03:02:07 -0800 (PST) X-Google-Smtp-Source: AJdET5eGiLrknBRiArI2u6SXrPc62qrv0QpuNr+orN1vOVd0Urz/p0a1FvGc1DSXhSfZIguSvN8z X-Received: by 2002:a62:5c6:: with SMTP id 189-v6mr10842534pff.193.1542366127586; Fri, 16 Nov 2018 03:02:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542366127; cv=none; d=google.com; s=arc-20160816; b=zff4z+zAgCpBSX4nK0lbKk53C1KcoW+Y2JmRu6IC0ss/ReOlwdoE2AKs724m6FT+Wz Gf+V98NQal0rnQ1G0fi7AvVRzXpb+q626k3Y29i2ZhZnYDea6AWMi0QiQ2aXblAU6Zi4 hmsr0n7Z/S3VQsqkjnDIRMl7xGEvmBea5zZ507nHC04RIySh0akKTmmgY7JwQgiViY7y ZIsONEgKwBOenZt6VUmjFRnaBe+Cm5Htj2rVsCgg3Wc124NdhBXEWHD9ciXIK/y1G+6F jaDwESEiC+9dZLt7+EVG9iWEN6L7cjldhBjxg6W1igchp2ISQsVkatyxjfprytNgzEfB Dd9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=1sCzjJpuyoWAr3SZdjEjaCQC9rkWcsgGFIVrSihaM1o=; b=r58BpS1RvdSpQEftF8RrAf4oynGCR5e9cKllOgDmcFgetxpcBTOLlY7Scq4+mgy/Cv sZY2D2ukSmmFTaS6A23nVf361vycJ/wDDHpNKU5pFSfkPRfXoovfLNFwFV2mYVhG0lh4 9QUWUe8YZHH4cMiLFSW3B3RlRPoC76XUslgGgkyAms0KEnKrqsLEMO5fN6cZxu9Vt6is qMU3Q3c8/zNsdsOFwOqc24NNWh/EQHkaHwe1ZIf0pqFiF1droYETvO56o7qGhERrEgSN LCZVdXojxRabOAyMrxPEMDLC1J55finrwr5m7NI1IbDdWYr7frWWrSavQ5VSQxGMn+s+ STwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EYSmG4fP; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c76si18072978pga.70.2018.11.16.03.02.07; Fri, 16 Nov 2018 03:02:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EYSmG4fP; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389519AbeKPVN5 (ORCPT + 6 others); Fri, 16 Nov 2018 16:13:57 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:40312 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389509AbeKPVN4 (ORCPT ); Fri, 16 Nov 2018 16:13:56 -0500 Received: by mail-pf1-f196.google.com with SMTP id x2-v6so11245688pfm.7 for ; Fri, 16 Nov 2018 03:02:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=1sCzjJpuyoWAr3SZdjEjaCQC9rkWcsgGFIVrSihaM1o=; b=EYSmG4fP+EBCLFpS0lesxnIuPLkCQaeDlr7V1pYlMXk9ZJBIW6Vkje/8uYps6+lbyX k/mvNHYnGrCviwD9IprEAwK3uYLY396LT9HIg/iEQbrgImLIfY+LZ0SODLR+dIkU7irv fmG0dV/IoMH3mgYZyk3Rwwn0PRWWShlCl8CkM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=1sCzjJpuyoWAr3SZdjEjaCQC9rkWcsgGFIVrSihaM1o=; b=IKvpSdDA/CWATUMab89gFxz6z2UZwf+PvV7yCcK4y1CsgCa82fJSwG8EkmCy5txWDG L6GoMI32vKec/Xi804NRFHWwdjOIRnXEU2Iz4U4Fzpa6LWLqmFfPmA1VXRuplFLiQCzI 5M+cnXl8k4thEBHARkQUYDBr2Rs4eBU164YOVrVAZ3G9f9XtEyiB6kQvqPV7cgMIFEPy eZatsvsiN7cPK6EYPqBG8J3D3hH9RdYZIFrEU9fd1oi4W121B5i5kekikxCDKIXsZCgi ORcmuaT5lYsIoI90OIGf3Zsgrah0ErvKSSn/R24xVhfn5a7SfBpQk23/Q2PxYisSe4Q8 nbNQ== X-Gm-Message-State: AGRZ1gJFAHn+fQRL+9Z/grf32cFz3W9HEfz0oLWiKKNsTVSJiBfN/npR ehWC7bkuQwc944lv2dm4Ftxu5Q== X-Received: by 2002:a63:3546:: with SMTP id c67mr9619376pga.284.1542366125739; Fri, 16 Nov 2018 03:02:05 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id 202sm21268106pfy.87.2018.11.16.03.02.00 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Nov 2018 03:02:05 -0800 (PST) From: Baolin Wang To: sre@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, yuanjiang.yu@unisoc.com, baolin.wang@linaro.org, broonie@kernel.org, linus.walleij@linaro.org Subject: [PATCH 3/6] power: supply: charger-manager: Fix incorrect return value Date: Fri, 16 Nov 2018 19:01:10 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <4ea9eaf85d780afb190cb45da2df8ff5fd86d449.1542362262.git.baolin.wang@linaro.org> References: <4ea9eaf85d780afb190cb45da2df8ff5fd86d449.1542362262.git.baolin.wang@linaro.org> In-Reply-To: <4ea9eaf85d780afb190cb45da2df8ff5fd86d449.1542362262.git.baolin.wang@linaro.org> References: <4ea9eaf85d780afb190cb45da2df8ff5fd86d449.1542362262.git.baolin.wang@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Fix incorrect return value. Signed-off-by: Baolin Wang --- drivers/power/supply/charger-manager.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 1.7.9.5 diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c index bd6c450..a52bc77 100644 --- a/drivers/power/supply/charger-manager.c +++ b/drivers/power/supply/charger-manager.c @@ -1212,7 +1212,6 @@ static int charger_extcon_init(struct charger_manager *cm, if (ret < 0) { pr_info("Cannot register extcon_dev for %s(cable: %s)\n", cable->extcon_name, cable->name); - ret = -EINVAL; } return ret; @@ -1633,7 +1632,7 @@ static int charger_manager_probe(struct platform_device *pdev) if (IS_ERR(desc)) { dev_err(&pdev->dev, "No platform data (desc) found\n"); - return -ENODEV; + return PTR_ERR(desc); } cm = devm_kzalloc(&pdev->dev, sizeof(*cm), GFP_KERNEL); From patchwork Fri Nov 16 11:01:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 151332 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp279038ljp; Fri, 16 Nov 2018 03:02:12 -0800 (PST) X-Google-Smtp-Source: AJdET5db57dpB02gl+RlwidL19eZJL7GtVKfVyFtF0map1FN4bx2jChngqp4FoEdY5CwiLL8+cbd X-Received: by 2002:a17:902:e085:: with SMTP id cb5mr5928345plb.24.1542366131957; Fri, 16 Nov 2018 03:02:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542366131; cv=none; d=google.com; s=arc-20160816; b=YX7KDrFRr7hQIhnvnQUXkoMF2rNtbbSCXqZfLqHT7pgla4QHH6kp8BsJjjsUsiN2p/ AquNoa+vWf+MR0YVl+c3QJvUKHkV+AiRMV+7jEtf1kJRxuNLViqAXGAMxdli4ZhL4XkQ 9L0hMt4ouwo6YMuEgR4Ob43PMesy+7R223Ee8NCZq0wRYYSNWKyAeVjxOFvj3hLs2cq2 T3yh8JNxt9xm3gqgr/tH6xBVTCyCHxOZktQhJFINknTgU/I/Wy6FBFjDOJB9m7Avf2vJ 6ldTNj+4hKJ5I3obKTvcp9NJi2Qf9Z778By9mV0f0uEYauHcBKAVF1KMZFmoMIuNyVUF W86w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=L0xxyPjE8jBaIz9DC2r/ZKc+hYCfYlfYhlTPplJ8+20=; b=VxyM26ComyPADNMWicO1NGOQ/ko62Ub+Hnec1YV58JzRzg89yjKAkuDNlpupaTAdcw n7nOrN9UP/vaAJARuAqoIthxtvM1YWgdUA06gFWrs2aK1kgmUiG36S3sZuyoT0wn/giS m0StFn890RqgJkakh2SxHs3oPYKz2DUBVJRyYra3SpazT9xPL8tYYVnoSy0lQtsHy9Ml zIkHTTW6QSLcBbOLvIj0y2BVsqYEF+Ml5Ymis68jAmsBZtnTNIgz7Evf08NDYqX6koNd q5ICpVDtv3k5qoNDO/NgLQlP4OQaBwdbG77XY2gTGXdInWtjolDcHA68G6cW7NKFmq7U qBkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gTp6Rlk8; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3-v6si32799795pfm.118.2018.11.16.03.02.11; Fri, 16 Nov 2018 03:02:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gTp6Rlk8; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389548AbeKPVOB (ORCPT + 6 others); Fri, 16 Nov 2018 16:14:01 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:44933 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389550AbeKPVOA (ORCPT ); Fri, 16 Nov 2018 16:14:00 -0500 Received: by mail-pl1-f194.google.com with SMTP id s5-v6so11003118plq.11 for ; Fri, 16 Nov 2018 03:02:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=L0xxyPjE8jBaIz9DC2r/ZKc+hYCfYlfYhlTPplJ8+20=; b=gTp6Rlk8HY7VLKjMhf6stj3PTnfOgE97FBcG62ZQAdB/Af8TqsQXH2pIH4adcwWGCB yBaeFJZl3fu+4VdwiydWoTWIaO2oIHnnsFEITi7b7QYr4ueIZhAfTdJgOFb6o5ZXDWgk ChlLSlhlxfKW+zj8fOS9RBOdsIEEzGtE552uI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=L0xxyPjE8jBaIz9DC2r/ZKc+hYCfYlfYhlTPplJ8+20=; b=UFMQhKFhtFXf+NN27woCKxl/DZGTkFD5gnXWoWkT0uts2EbtYZdKCYiL+EZinYYEuH CZ50z2JYAnTq8XgkbciW4X6vongKLUQDCM1/Qp73wMgZtY9OhgTK304K/sjJrHQtZwsg r5RoH7hBxUOyjqgHxVfZ2M4X84Ld8ySwMIpWyH3nQYAieT6dGfEv9wn/GXN121IMqf5m qAn0Ja2XdZuYMbwMeCC7rXj+dK8S6socUjdy7YPaI2cETkjrh92jsFTe2Sx0qf/ZbVmU pf5OkzDzrgqpT1xKMofq7iy2CisyJ3LtoCJ2T77YH2WWr31ZXMTh0xAUaUhWUVVWTlow RtfA== X-Gm-Message-State: AGRZ1gJZnmBxm1Ndy1ECPE6dTOUKwF5b0hbyOUZnxCoSAl6D6fLBXCth dG9hJcyEBSU1DZYmcvH0iSpI3A== X-Received: by 2002:a17:902:be07:: with SMTP id r7-v6mr10284545pls.137.1542366129680; Fri, 16 Nov 2018 03:02:09 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id 202sm21268106pfy.87.2018.11.16.03.02.05 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Nov 2018 03:02:08 -0800 (PST) From: Baolin Wang To: sre@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, yuanjiang.yu@unisoc.com, baolin.wang@linaro.org, broonie@kernel.org, linus.walleij@linaro.org Subject: [PATCH 4/6] power: supply: charger-manager: Make code more readable Date: Fri, 16 Nov 2018 19:01:11 +0800 Message-Id: <12b1b583c3da503be4ad7bed01e7b07a0a2b2126.1542362262.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <4ea9eaf85d780afb190cb45da2df8ff5fd86d449.1542362262.git.baolin.wang@linaro.org> References: <4ea9eaf85d780afb190cb45da2df8ff5fd86d449.1542362262.git.baolin.wang@linaro.org> In-Reply-To: <4ea9eaf85d780afb190cb45da2df8ff5fd86d449.1542362262.git.baolin.wang@linaro.org> References: <4ea9eaf85d780afb190cb45da2df8ff5fd86d449.1542362262.git.baolin.wang@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Make code more readable. Signed-off-by: Baolin Wang --- drivers/power/supply/charger-manager.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 1.7.9.5 diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c index a52bc77..dc0c9a6 100644 --- a/drivers/power/supply/charger-manager.c +++ b/drivers/power/supply/charger-manager.c @@ -1520,19 +1520,19 @@ static struct charger_desc *of_cm_parse_desc(struct device *dev) /* chargers */ of_property_read_u32(np, "cm-num-chargers", &num_chgs); if (num_chgs) { + int i; + /* Allocate empty bin at the tail of array */ desc->psy_charger_stat = devm_kcalloc(dev, num_chgs + 1, sizeof(char *), GFP_KERNEL); - if (desc->psy_charger_stat) { - int i; - for (i = 0; i < num_chgs; i++) - of_property_read_string_index(np, "cm-chargers", - i, &desc->psy_charger_stat[i]); - } else { + if (!desc->psy_charger_stat) return ERR_PTR(-ENOMEM); - } + + for (i = 0; i < num_chgs; i++) + of_property_read_string_index(np, "cm-chargers", + i, &desc->psy_charger_stat[i]); } of_property_read_string(np, "cm-fuel-gauge", &desc->psy_fuel_gauge); From patchwork Fri Nov 16 11:01:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 151333 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp279115ljp; Fri, 16 Nov 2018 03:02:16 -0800 (PST) X-Google-Smtp-Source: AJdET5e5W8WnZVoizGxkXrhZCrEl+ypOukTYkVXAEf3Yt0DOt0r0CP4q+5HLXI4moGb3120bQ4MM X-Received: by 2002:a62:a511:: with SMTP id v17-v6mr10511247pfm.18.1542366136121; Fri, 16 Nov 2018 03:02:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542366136; cv=none; d=google.com; s=arc-20160816; b=RrwAb0fFtAyMxqG/UPVH1x4qPG3qVC5t0cU0AZRjxxIQWF9hC1/tAv+6LX2CL0EDgY KVaNeBA03ob2MqNvQYjqZYJLjHXhGwkn4ghWX0S8PiICno1aMTyr1iUcRxaGaMlGJsEh pYZXh++eCCP/xBpGi7GXcTTXYvALLev85zALwD8FMoYqHfNrZqe4PeItG3iXT6nIEXzr L9LnjDP69Q8DtsCqOkXGDR734WufR1ArwG3JFgIhwaSuxaqFFbmtOpvLBpI7JCXSTS3N Q7mMEGxwoQszmKb0cOytkOx/ZjqfyHhQqou0HijbE1Cr0/cGUY1qkWKFqwvUutfUIq/C jXew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=oFvCzZZqNBSbDG9EOSs0H2fQO9rLPB9US33Ar8fKAkM=; b=uytrcxpCMXP+rq5Xi0KkEI2aOkSDr7BHpC5iecvAINVLMylMH8g2/eXsyov5RwLans xDhYu9JNgotc2aNJ/In9Cs1xuX5QMKnUx5+vYxXjXbcecBXE+uRw0AUtnqpr3stWOtW8 elvrZZsx2SzqTSpLYGgD8O5HH/m/Jcta3mgQtD6drCHiFrDglIaztHRd1gsdTRf3gm5X P5Sf5W/kdfApGv6f4c/cTwVFurFQ0zmkSg+TLbaVdXKOlT9heo3gXqo4RyPLARJ4bifN hFd2wvZLDrVQEJWGsFqR9CDjVGbNo7GxSFe6IPv0pAvXZOI+LBrQe7ht6zYQ+y07sWL4 lPCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R0QhzbVv; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p23si27650711pgk.312.2018.11.16.03.02.15; Fri, 16 Nov 2018 03:02:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R0QhzbVv; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389585AbeKPVOF (ORCPT + 6 others); Fri, 16 Nov 2018 16:14:05 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:38985 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389581AbeKPVOF (ORCPT ); Fri, 16 Nov 2018 16:14:05 -0500 Received: by mail-pf1-f194.google.com with SMTP id c72so6567627pfc.6 for ; Fri, 16 Nov 2018 03:02:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=oFvCzZZqNBSbDG9EOSs0H2fQO9rLPB9US33Ar8fKAkM=; b=R0QhzbVvE26Vzwv072oDm8R9rLKqth6qj0b3qrBuv9NlCudvzF0mmxvQx/ZAvuPQDr Q0mMTxVsV62Eo18dZA7NYVFq16oNuJaYaFzb1nGb6sNfHRUrrhu1Z/3bhxa7OSyOcvXc /SjgRJvcZxdBvRUXqUpUt+UGRcGLLGN/cUeq4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=oFvCzZZqNBSbDG9EOSs0H2fQO9rLPB9US33Ar8fKAkM=; b=afwCN2lGSGSM3gS438HxAwGN9FP8YU2cmFNBX6O2oT5rwM3usC3AYQyJ+hhpTz0sXi /OR0NUNoQTpAq4pJimvHzLe6vfFYbsOjrSLMRPM1p8LFNhTyOFmA4+s+zGjnwxt28n8a Xi7FF29i4GJoMn8eWJochogHJcgMkYx28L9wJ35mkG2hHbb11cUUenZ2IDnSvb99erfR ckJwQIUjHx7+mB/krrARcRY7oBslW8+USQg8Mv8wkrkg4Fguf0U4JxmMztRuWvftqyTn k6H/fTmmIsIaYiez3MH21Xb+MijspfL7CS4hNh73Dp7jV0UtZtmCYYooBKkqvF8F/ZdM /PWw== X-Gm-Message-State: AGRZ1gIyEgXvP3/+5TN+2yI5GPsVnsN8fgQzg4hSQfUAOp9pfuhr+QbH d+KezeRdHJEPOWrmACjpYGOUQQ== X-Received: by 2002:a63:e445:: with SMTP id i5mr9466026pgk.307.1542366134115; Fri, 16 Nov 2018 03:02:14 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id 202sm21268106pfy.87.2018.11.16.03.02.09 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Nov 2018 03:02:13 -0800 (PST) From: Baolin Wang To: sre@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, yuanjiang.yu@unisoc.com, baolin.wang@linaro.org, broonie@kernel.org, linus.walleij@linaro.org Subject: [PATCH 5/6] power: supply: charger-manager: Remove deprecated extcon APIs Date: Fri, 16 Nov 2018 19:01:12 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <4ea9eaf85d780afb190cb45da2df8ff5fd86d449.1542362262.git.baolin.wang@linaro.org> References: <4ea9eaf85d780afb190cb45da2df8ff5fd86d449.1542362262.git.baolin.wang@linaro.org> In-Reply-To: <4ea9eaf85d780afb190cb45da2df8ff5fd86d449.1542362262.git.baolin.wang@linaro.org> References: <4ea9eaf85d780afb190cb45da2df8ff5fd86d449.1542362262.git.baolin.wang@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The struct extcon_specific_cable_nb and related APIs are deprecated now, so we should use new method to get one extcon device and register extcon notifier. Signed-off-by: Baolin Wang --- .../bindings/power/supply/charger-manager.txt | 6 +-- drivers/power/supply/charger-manager.c | 51 ++++++++------------ include/linux/power/charger-manager.h | 2 +- 3 files changed, 23 insertions(+), 36 deletions(-) -- 1.7.9.5 diff --git a/Documentation/devicetree/bindings/power/supply/charger-manager.txt b/Documentation/devicetree/bindings/power/supply/charger-manager.txt index ec4fe9d..315b0cb 100644 --- a/Documentation/devicetree/bindings/power/supply/charger-manager.txt +++ b/Documentation/devicetree/bindings/power/supply/charger-manager.txt @@ -11,7 +11,7 @@ Required properties : - cm-regulator-name : name of charger regulator - subnode : - cm-cable-name : name of charger cable - - cm-cable-extcon : name of extcon dev + - extcon : phandles to external connector devices (optional) - cm-cable-min : minimum current of cable (optional) - cm-cable-max : maximum current of cable @@ -66,13 +66,13 @@ Example : cm-regulator-name = "chg-reg"; cable@0 { cm-cable-name = "USB"; - cm-cable-extcon = "extcon-dev.0"; + extcon = <&extcon_usb>; cm-cable-min = <475000>; cm-cable-max = <500000>; }; cable@1 { cm-cable-name = "TA"; - cm-cable-extcon = "extcon-dev.0"; + extcon = <&extcon_usb>; cm-cable-min = <650000>; cm-cable-max = <675000>; }; diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c index dc0c9a6..4f28c03 100644 --- a/drivers/power/supply/charger-manager.c +++ b/drivers/power/supply/charger-manager.c @@ -1207,12 +1207,11 @@ static int charger_extcon_init(struct charger_manager *cm, */ INIT_WORK(&cable->wq, charger_extcon_work); cable->nb.notifier_call = charger_extcon_notifier; - ret = extcon_register_interest(&cable->extcon_dev, - cable->extcon_name, cable->name, &cable->nb); - if (ret < 0) { - pr_info("Cannot register extcon_dev for %s(cable: %s)\n", - cable->extcon_name, cable->name); - } + ret = devm_extcon_register_notifier(cm->dev, cable->extcon_dev, + EXTCON_USB, &cable->nb); + if (ret < 0) + dev_err(cm->dev, "Cannot register extcon_dev for (cable: %s)\n", + cable->name); return ret; } @@ -1589,15 +1588,25 @@ static struct charger_desc *of_cm_parse_desc(struct device *dev) for_each_child_of_node(child, _child) { of_property_read_string(_child, "cm-cable-name", &cables->name); - of_property_read_string(_child, - "cm-cable-extcon", - &cables->extcon_name); of_property_read_u32(_child, "cm-cable-min", &cables->min_uA); of_property_read_u32(_child, "cm-cable-max", &cables->max_uA); + + if (of_property_read_bool(_child, "extcon")) { + struct device_node *np; + + np = of_parse_phandle(_child, "extcon", 0); + if (!np) + return ERR_PTR(-ENODEV); + + cables->extcon_dev = extcon_find_edev_by_node(np); + of_node_put(np); + if (IS_ERR(cables->extcon_dev)) + return ERR_PTR(PTR_ERR(cables->extcon_dev)); + } cables++; } } @@ -1625,7 +1634,6 @@ static int charger_manager_probe(struct platform_device *pdev) struct charger_desc *desc = cm_get_drv_data(pdev); struct charger_manager *cm; int ret, i = 0; - int j = 0; union power_supply_propval val; struct power_supply *fuel_gauge; struct power_supply_config psy_cfg = {}; @@ -1823,19 +1831,8 @@ static int charger_manager_probe(struct platform_device *pdev) &charger->attr_g); } err_reg_extcon: - for (i = 0; i < desc->num_charger_regulators; i++) { - struct charger_regulator *charger; - - charger = &desc->charger_regulators[i]; - for (j = 0; j < charger->num_cables; j++) { - struct charger_cable *cable = &charger->cables[j]; - /* Remove notifier block if only edev exists */ - if (cable->extcon_dev.edev) - extcon_unregister_interest(&cable->extcon_dev); - } - + for (i = 0; i < desc->num_charger_regulators; i++) regulator_put(desc->charger_regulators[i].consumer); - } power_supply_unregister(cm->charger_psy); @@ -1847,7 +1844,6 @@ static int charger_manager_remove(struct platform_device *pdev) struct charger_manager *cm = platform_get_drvdata(pdev); struct charger_desc *desc = cm->desc; int i = 0; - int j = 0; /* Remove from the list */ mutex_lock(&cm_list_mtx); @@ -1857,15 +1853,6 @@ static int charger_manager_remove(struct platform_device *pdev) cancel_work_sync(&setup_polling); cancel_delayed_work_sync(&cm_monitor_work); - for (i = 0 ; i < desc->num_charger_regulators ; i++) { - struct charger_regulator *charger - = &desc->charger_regulators[i]; - for (j = 0 ; j < charger->num_cables ; j++) { - struct charger_cable *cable = &charger->cables[j]; - extcon_unregister_interest(&cable->extcon_dev); - } - } - for (i = 0 ; i < desc->num_charger_regulators ; i++) regulator_put(desc->charger_regulators[i].consumer); diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h index c4fa907..e4d0269 100644 --- a/include/linux/power/charger-manager.h +++ b/include/linux/power/charger-manager.h @@ -66,7 +66,7 @@ struct charger_cable { const char *name; /* The charger-manager use Extcon framework */ - struct extcon_specific_cable_nb extcon_dev; + struct extcon_dev *extcon_dev; struct work_struct wq; struct notifier_block nb;