From patchwork Wed Nov 20 17:58:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 3214241 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C78A6C045B for ; Wed, 20 Nov 2013 17:58:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA16120777 for ; Wed, 20 Nov 2013 17:58:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A952420776 for ; Wed, 20 Nov 2013 17:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754083Ab3KTR6l (ORCPT ); Wed, 20 Nov 2013 12:58:41 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:39224 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753463Ab3KTR6k (ORCPT ); Wed, 20 Nov 2013 12:58:40 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id rAKHwb9J020966; Wed, 20 Nov 2013 11:58:37 -0600 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id rAKHwbu4004418; Wed, 20 Nov 2013 11:58:37 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.2.342.3; Wed, 20 Nov 2013 11:58:37 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id rAKHwa5W029667; Wed, 20 Nov 2013 11:58:36 -0600 Date: Wed, 20 Nov 2013 11:58:14 -0600 From: Felipe Balbi To: , , , Linux Kernel Mailing List , Linux OMAP Mailing List Subject: commit c368e5fc2a190923b786f2de3e79430ea3566a25 regresses MMC Message-ID: <20131120175814.GC27423@saruman.home> Reply-To: MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable 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 Hi, commit c368e5fc2a190923b786f2de3e79430ea3566a25 (regulator: fixed: get rid of {get|list}_voltage()) regresses any MMC host controller which uses fixed regulator for functionality. Note that mmc core uses regulator_list_voltage() to setup OCR mask and that has a check for missing ->list_voltage() method. Reverting that commit makes beablebone black and white work with today's Linus' HEAD. That commit should either be reverted or regulator_list_voltages() should be fixed up accordingly. Proposed patch below: 8<------------------------ cut here ----------------------------------- From 807bb4e91eea46390f184b737f7f8dc634e62a01 Mon Sep 17 00:00:00 2001 From: Felipe Balbi Date: Wed, 20 Nov 2013 11:52:33 -0600 Subject: [PATCH] regulator: core: fix regulator_list_voltage() commit c368e5f (regulator: fixed: get rid of {get|list}_voltage()) caused a regression for any MMC host which uses a fixed regulator. MMC core uses regulator_list_voltage() to setup card's OCR mask. Unfortunately, said commit missed the fact that regulator_list_voltage() would bail out early if ->list_voltage() implementation is missing. This was not a problem before, since fixed regulator implemented that callback. The best solution is to patch regulator_list_voltage() itself, since MMC core shouldn't have to know which regulator type it's using. Signed-off-by: Felipe Balbi --- drivers/regulator/core.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 6382f0a..0da48ae 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2181,15 +2181,21 @@ EXPORT_SYMBOL_GPL(regulator_count_voltages); int regulator_list_voltage(struct regulator *regulator, unsigned selector) { struct regulator_dev *rdev = regulator->rdev; - struct regulator_ops *ops = rdev->desc->ops; + const struct regulator_desc *desc = rdev->desc; + struct regulator_ops *ops = desc->ops; int ret; - if (!ops->list_voltage || selector >= rdev->desc->n_voltages) + if ((!ops->list_voltage && !desc->fixed_uV) || + selector >= rdev->desc->n_voltages) return -EINVAL; - mutex_lock(&rdev->mutex); - ret = ops->list_voltage(rdev, selector); - mutex_unlock(&rdev->mutex); + if (ops->list_voltage) { + mutex_lock(&rdev->mutex); + ret = ops->list_voltage(rdev, selector); + mutex_unlock(&rdev->mutex); + } else /* if (desc->fixed_uV) */ { + ret = desc->fixed_uV; + } if (ret > 0) { if (ret < rdev->constraints->min_uV)