From patchwork Sat Mar 26 08:28:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Dimitrov X-Patchwork-Id: 8674331 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8FAA7C0554 for ; Sat, 26 Mar 2016 08:29:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B7FBB20220 for ; Sat, 26 Mar 2016 08:29:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D76E4202B8 for ; Sat, 26 Mar 2016 08:29:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753437AbcCZI3q (ORCPT ); Sat, 26 Mar 2016 04:29:46 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34389 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753102AbcCZI3b (ORCPT ); Sat, 26 Mar 2016 04:29:31 -0400 Received: by mail-wm0-f65.google.com with SMTP id p65so8539829wmp.1; Sat, 26 Mar 2016 01:29:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2HG71XKGt/E+R8leK0YARsSMpTjzTqV1Ld19kYacvmo=; b=bcz6nx/LlGar3HMmOxN0YinvL7jMAJg3of7Bc05bpamrBJssLZ1ppObjR6+amqiXMn PqV1Qdv5BQtGH1OPhehQQdIg/sGXh+Ex+IOQqV+aigoM5fsyvFBPjayxqiaX+3HmaJBz os+vPSao/Ja8JhMcAbCU7Lfcyd9Cftn4TbVMkA1QW1XL+B4dJ28xzPRspWgf80YMpe5U R/zrfnLkGZuB9mBw5nNmoXjHctpkqXquISG2/WXOzzVOA65JYnIaLvUZTmYgbbD2zmAg /Y341fOeFg3ivMwmenDd1Ya+AfzJqsPhjVzgy4EpV3xIBHBIcrsFhFTZ6IHHxQ4X+wkp Fm7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2HG71XKGt/E+R8leK0YARsSMpTjzTqV1Ld19kYacvmo=; b=TJ1EC94oL/YKH5m3gOmOqp1EnxjaqL75UJY5BrUoitHAibRkQt5FOUucZCfzTEXjG4 QwVesdDTMROacn4JDQkL4oZ+EiRBNbrslO+PRagWWzMf6dNzo2lJ7VoMXJguPxkG1lCV imKBbEeNtas7A0A4qoyI3EVX3QSiFMOAHUqu/leY5dk3wSwv9vSxjvFzib1Ak7e54gzU tv5IvmB/c5At+ffOltPxDV9rL8wRI2J2CaQgdbCstozAZkrX5BfAuCvl4r2/+1e6u6Do wAvKgA6RCSgG3wb90hLyKdh93FmL/BjCo0tWZiNlV3c0KogTUyTclrx7eIRNRGo7wDwM YpKQ== X-Gm-Message-State: AD7BkJKjuHIKuG0iWqiHO1qONnAW9RSms68bvS6/7Vh8SQKnv+n0WSjgI7kjnjNZkV/RCg== X-Received: by 10.194.60.200 with SMTP id j8mr18591032wjr.124.1458980969864; Sat, 26 Mar 2016 01:29:29 -0700 (PDT) Received: from localhost.localdomain ([46.249.74.23]) by smtp.gmail.com with ESMTPSA id u3sm670429wmg.15.2016.03.26.01.29.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 26 Mar 2016 01:29:29 -0700 (PDT) From: Ivaylo Dimitrov To: tony@atomide.com, lgirdwood@gmail.com, broonie@kernel.org Cc: sre@kernel.org, pali.rohar@gmail.com, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Ivaylo Dimitrov Subject: [PATCH 3/3] regulator: twl: Regulator mode should not depend on regulator enabled state Date: Sat, 26 Mar 2016 10:28:15 +0200 Message-Id: <1458980895-10240-4-git-send-email-ivo.g.dimitrov.75@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1458980895-10240-1-git-send-email-ivo.g.dimitrov.75@gmail.com> References: <1458980895-10240-1-git-send-email-ivo.g.dimitrov.75@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When machine constraints are applied, regulator framework first sets initial mode (if any) and then enables the regulator if needed. The current code in twl4030reg_set_mode always checks if the regulator is enabled before applying the mode. That results in -EACCES error returned for "always-on" regulators which have "initial-mode" set in the board DTS. Fix that by removing the unneeded check. Signed-off-by: Ivaylo Dimitrov --- drivers/regulator/twl-regulator.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c index be8d05e..d8f6ad6 100644 --- a/drivers/regulator/twl-regulator.c +++ b/drivers/regulator/twl-regulator.c @@ -371,7 +371,6 @@ static int twl4030reg_set_mode(struct regulator_dev *rdev, unsigned mode) { struct twlreg_info *info = rdev_get_drvdata(rdev); unsigned message; - int status; /* We can only set the mode through state machine commands... */ switch (mode) { @@ -385,13 +384,6 @@ static int twl4030reg_set_mode(struct regulator_dev *rdev, unsigned mode) return -EINVAL; } - /* Ensure the resource is associated with some group */ - status = twlreg_grp(rdev); - if (status < 0) - return status; - if (!(status & (P3_GRP_4030 | P2_GRP_4030 | P1_GRP_4030))) - return -EACCES; - return twl4030_send_pb_msg(message); }