Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759715AbcJRK2r (ORCPT ); Tue, 18 Oct 2016 06:28:47 -0400 Received: from mail-qt0-f182.google.com ([209.85.216.182]:35757 "EHLO mail-qt0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759432AbcJRK2i (ORCPT ); Tue, 18 Oct 2016 06:28:38 -0400 MIME-Version: 1.0 In-Reply-To: <20161018094704.ohubpg4j3jhc7cay@lukather> References: <20161018084343.680-1-maxime.ripard@free-electrons.com> <20161018094704.ohubpg4j3jhc7cay@lukather> From: Ulf Hansson Date: Tue, 18 Oct 2016 12:28:36 +0200 Message-ID: Subject: Re: [PATCH] mmc: core: Check regulator pointer To: Maxime Ripard Cc: linux-mmc , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1386 Lines: 37 On 18 October 2016 at 11:47, Maxime Ripard wrote: > Hi, > > On Tue, Oct 18, 2016 at 11:03:02AM +0200, Ulf Hansson wrote: >> On 18 October 2016 at 10:43, Maxime Ripard >> wrote: >> > mmc_regulator_get_supply might silently fail if the regulators are not >> > found, which is the right thing to do since both these regulators are >> > optional. >> > >> > However, the drivers then have no way to know whether or not they should >> > proceed and call mmc_regulator_set_ocr. And since this function doesn't >> >> Host drivers should check "if (!IS_ERR(mmc->supply.vmmc))" before >> invoking mmc_regulator_set_ocr(). I wasn't aware that some didn't. > > Ok, so the sunxi one definitely doesn't: > http://lxr.free-electrons.com/source/drivers/mmc/host/sunxi-mmc.c#L735 > >> My point is, that in some cases the regulator is optional, then a host >> driver need to take other actions to power on/off the card. > > What are those actions? Just power up the card through some other > mean, or is it more tied to the MMC protocol? Through some other way, which is managed by the internal logic of the mmc controller. > > Also, I'm wondering if VMMC is actually optional at all. In all cases > I can think of, it would be represented as a regulator anyway. Yes, you are right. For most cases, but not all. Kind regards Uffe