Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753990AbcL3NRl (ORCPT ); Fri, 30 Dec 2016 08:17:41 -0500 Received: from mail-qt0-f172.google.com ([209.85.216.172]:36804 "EHLO mail-qt0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753749AbcL3NRj (ORCPT ); Fri, 30 Dec 2016 08:17:39 -0500 MIME-Version: 1.0 In-Reply-To: <1483050455-10683-11-git-send-email-steve_longerbeam@mentor.com> References: <1483050455-10683-1-git-send-email-steve_longerbeam@mentor.com> <1483050455-10683-11-git-send-email-steve_longerbeam@mentor.com> From: Linus Walleij Date: Fri, 30 Dec 2016 14:17:38 +0100 Message-ID: Subject: Re: [PATCH 10/20] gpio: pca953x: Add optional reset gpio control To: Steve Longerbeam Cc: Shawn Guo , Sascha Hauer , Fabio Estevam , Rob Herring , Mark Rutland , Russell King , Alexandre Courbot , Mauro Carvalho Chehab , Greg KH , Philipp Zabel , "linux-arm-kernel@lists.infradead.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-gpio@vger.kernel.org" , "linux-media@vger.kernel.org" , "devel@driverdev.osuosl.org" , Steve Longerbeam 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: 1835 Lines: 50 On Thu, Dec 29, 2016 at 11:27 PM, Steve Longerbeam wrote: > Add optional reset-gpios pin control. If present, de-assert the > specified reset gpio pin to bring the chip out of reset. > > Signed-off-by: Steve Longerbeam > Cc: Linus Walleij > Cc: Alexandre Courbot > Cc: linux-gpio@vger.kernel.org > Cc: linux-kernel@vger.kernel.org This seems like a separate patch from the other 19 patches so please send it separately so I can handle logistics easier in the future. > @@ -133,6 +134,7 @@ struct pca953x_chip { > const char *const *names; > unsigned long driver_data; > struct regulator *regulator; > + struct gpio_desc *reset_gpio; Why do you even keep this around in the device state container? As you only use it in the probe() function, use a local variable. The descriptor will be free():ed by the devm infrastructure anyways. > + /* see if we need to de-assert a reset pin */ > + chip->reset_gpio = devm_gpiod_get_optional(&client->dev, > + "reset", > + GPIOD_OUT_LOW); > + if (IS_ERR(chip->reset_gpio)) { > + dev_err(&client->dev, "request for reset pin failed\n"); > + return PTR_ERR(chip->reset_gpio); > + } Nice. > + if (chip->reset_gpio) { > + /* bring chip out of reset */ > + dev_info(&client->dev, "releasing reset\n"); > + gpiod_set_value(chip->reset_gpio, 0); > + } Is this really needed given that you set it low in the devm_gpiod_get_optional()? Yours, Linus Walleij