From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752453AbdASMMT (ORCPT ); Thu, 19 Jan 2017 07:12:19 -0500 Received: from mga14.intel.com ([192.55.52.115]:38084 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752194AbdASMMP (ORCPT ); Thu, 19 Jan 2017 07:12:15 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,253,1477983600"; d="scan'208";a="1114952943" Message-ID: <1484827882.2133.229.camel@linux.intel.com> Subject: Re: [PATCH 2/3] pinctrl: Allow configuration of pins from gpiolib based drivers From: Andy Shevchenko To: Mika Westerberg , Linus Walleij Cc: Alexandre Courbot , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 19 Jan 2017 14:11:22 +0200 In-Reply-To: <20170119094820.83595-3-mika.westerberg@linux.intel.com> References: <20170119094820.83595-1-mika.westerberg@linux.intel.com> <20170119094820.83595-3-mika.westerberg@linux.intel.com> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.3-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2017-01-19 at 12:48 +0300, Mika Westerberg wrote: > When a GPIO driver is backed by a pinctrl driver the GPIO driver > sometimes needs to call the pinctrl driver to configure certain > things, > like whether the pin is used as input or output. In addition to this > there are other configurations applicable to GPIOs such as setting > debounce time of the GPIO. > > To support this we introduce a new function pinctrl_gpio_set_config() > that can be used by gpiolib based driver to pass configuration > requests > to the backing pinctrl driver. > + mutex_lock(&pctldev->mutex); > + pin = gpio_to_pin(range, gpio); > + ret = pinconf_set_config(pctldev, pin, configs, > ARRAY_SIZE(configs)); > + mutex_unlock(&pctldev->mutex); Does gpio_to_pin() require to be under lock? -- Andy Shevchenko Intel Finland Oy