From patchwork Thu Aug 5 08:10:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 176352 Return-path: X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on void.printf.net X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.9 tests=RCVD_IN_DNSWL_LOW autolearn=disabled version=3.2.5 Envelope-to: chris@printf.net Delivery-date: Thu, 05 Aug 2010 09:10:26 +0100 Received: from lists.laptop.org ([18.85.2.145] helo=mail.laptop.org) by void.printf.net with esmtp (Exim 4.69) (envelope-from ) id 1OgvX0-0001le-2B for chris@printf.net; Thu, 05 Aug 2010 09:10:26 +0100 Received: by mail.laptop.org (Postfix) id 679522388E; Thu, 5 Aug 2010 04:10:08 -0400 (EDT) Delivered-To: cjb@laptop.org Received: from spam.laptop.org (spam.laptop.org [18.85.46.23]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.laptop.org (Postfix) with ESMTPS id 50CA223886 for ; Thu, 5 Aug 2010 04:10:08 -0400 (EDT) X-ASG-Debug-ID: 1280995823-3563ef830001-zHW3sV Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by spam.laptop.org with ESMTP id c7CIBEQMDqrsEEyp for ; Thu, 05 Aug 2010 04:10:23 -0400 (EDT) X-Barracuda-Envelope-From: linux-mmc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759854Ab0HEIKW (ORCPT ); Thu, 5 Aug 2010 04:10:22 -0400 Received: from smtp.nokia.com ([192.100.122.230]:36683 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759851Ab0HEIKV (ORCPT ); Thu, 5 Aug 2010 04:10:21 -0400 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx03.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o7589a9n016483; Thu, 5 Aug 2010 11:09:58 +0300 Received: from vaepf101.NOE.Nokia.com ([10.160.244.86]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 5 Aug 2010 11:09:57 +0300 Received: from [172.21.40.78] ([172.21.40.78]) by vaepf101.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 5 Aug 2010 11:09:57 +0300 Message-ID: <4C5A71DE.5020904@nokia.com> Date: Thu, 05 Aug 2010 11:10:06 +0300 From: Adrian Hunter User-Agent: Thunderbird 2.0.0.24 (X11/20100411) MIME-Version: 1.0 To: Andrew Morton CC: "linux-mmc@vger.kernel.org" X-ASG-Orig-Subj: [PATCH] mmc: Use regulator framework correctly Subject: [PATCH] mmc: Use regulator framework correctly X-OriginalArrivalTime: 05 Aug 2010 08:09:57.0168 (UTC) FILETIME=[97BBDB00:01CB3475] X-Nokia-AV: Clean Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Barracuda-Connect: vger.kernel.org[209.132.180.67] X-Barracuda-Start-Time: 1280995823 X-Barracuda-URL: http://18.85.46.23:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at laptop.org X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=5.5 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.37085 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 2cfefa6..da73899 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -784,11 +784,6 @@ int mmc_regulator_set_ocr(struct regulator *supply, unsigned short vdd_bit) { int result = 0; int min_uV, max_uV; - int enabled; - - enabled = regulator_is_enabled(supply); - if (enabled < 0) - return enabled; if (vdd_bit) { int tmp; @@ -819,9 +814,9 @@ int mmc_regulator_set_ocr(struct regulator *supply, unsigned short vdd_bit) else result = 0; - if (result == 0 && !enabled) + if (result == 0) result = regulator_enable(supply); - } else if (enabled) { + } else { result = regulator_disable(supply); }