Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756770AbcK2LiS (ORCPT ); Tue, 29 Nov 2016 06:38:18 -0500 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:55527 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751136AbcK2LiH (ORCPT ); Tue, 29 Nov 2016 06:38:07 -0500 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.wolfsonmicro.com Date: Tue, 29 Nov 2016 11:38:55 +0000 From: Charles Keepax To: CC: , , Subject: Re: [PATCH 2/2] regulator: core: Allow enable GPIO to be specified using GPIOD Message-ID: <20161129113855.GH1867@localhost.localdomain> References: <1480419045-2275-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> <1480419045-2275-2-git-send-email-ckeepax@opensource.wolfsonmicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1480419045-2275-2-git-send-email-ckeepax@opensource.wolfsonmicro.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611290198 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1383 Lines: 37 On Tue, Nov 29, 2016 at 11:30:45AM +0000, Charles Keepax wrote: > The regulator subsystem has used GPIOs internally for a while, however, > end drivers must still specify their enable GPIO using a GPIO number. This > patch allows the end drivers to specify the enable GPIO using GPIOD > directly. > > Signed-off-by: Charles Keepax > --- > drivers/regulator/core.c | 38 ++++++++++++++++++++++++++------------ > include/linux/regulator/driver.h | 14 +++++++++----- > 2 files changed, 35 insertions(+), 17 deletions(-) > > diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c > index b3417ac..48f2813 100644 > --- a/drivers/regulator/core.c > +++ b/drivers/regulator/core.c > > pin->gpiod = gpiod; > @@ -4027,14 +4042,13 @@ regulator_register(const struct regulator_desc *regulator_desc, > goto clean; > } > > - if ((config->ena_gpio || config->ena_gpio_initialized) && > - gpio_is_valid(config->ena_gpio)) { > + if (regulator_ena_gpio_valid(config)) { > mutex_lock(®ulator_list_mutex); > ret = regulator_ena_gpio_request(rdev, config); > mutex_unlock(®ulator_list_mutex); > if (ret != 0) { > rdev_err(rdev, "Failed to request enable GPIO%d: %d\n", > - config->ena_gpio, ret); > + desc_to_gpio(config->ena_gpiod), ret); Ah sorry small bug here I will respin. Thanks, Charles