From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755747AbeARKaE (ORCPT ); Thu, 18 Jan 2018 05:30:04 -0500 Received: from mail-io0-f177.google.com ([209.85.223.177]:44927 "EHLO mail-io0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753505AbeARKaB (ORCPT ); Thu, 18 Jan 2018 05:30:01 -0500 X-Google-Smtp-Source: ACJfBovqot1qn7pR18fqgXG7/YcCxxa21gooZXvkbNd7jR98dXez/QzaMORjbs+zMVEKygakeo2he6BWWn0p3HA58d8= MIME-Version: 1.0 In-Reply-To: <20180115162407.6314-3-ludovic.desroches@microchip.com> References: <20180115162407.6314-1-ludovic.desroches@microchip.com> <20180115162407.6314-3-ludovic.desroches@microchip.com> From: Linus Walleij Date: Thu, 18 Jan 2018 11:30:00 +0100 Message-ID: Subject: Re: [RFC PATCH 2/2] gpio: provide a consumer when requesting a gpio To: Ludovic Desroches Cc: linux-gpio@vger.kernel.org, Linux ARM , "linux-kernel@vger.kernel.org" , Nicolas Ferre Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 15, 2018 at 5:24 PM, Ludovic Desroches wrote: > It can be useful for the pinmuxing layer to know which device is > requesting a GPIO. Add a consumer variant for gpiod_request to > reach this goal. > > GPIO chips managed by pin controllers should provide the new > request_consumer operation. They can rely on > gpiochip_generic_request_consumer instead of > gpiochip_generic_request. > > Signed-off-by: Ludovic Desroches I think we need to think over what is a good way to share ownership of a pin. Russell pointed me to a similar problem incidentally and I briefly looked into it: there are cases when several devices may need to hold the same pin. Can't we just look up the associated gpio_chip from the GPIO range, and in case the pin is connected between the pin controller and the GPIO chip, then we allow the gpiochip to also take a reference? I.e. in that case you just allow gpio_owner to proceed and take the pin just like with a non-strict controller. Yours, Linus Walleij