From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Shevchenko Date: Mon, 22 Jul 2019 16:06:03 +0000 Subject: Re: [PATCH v2 2/7] backlight: gpio: simplify the platform data handling Message-Id: <20190722160603.GY9224@smile.fi.intel.com> List-Id: References: <20190722150302.29526-1-brgl@bgdev.pl> <20190722150302.29526-3-brgl@bgdev.pl> In-Reply-To: <20190722150302.29526-3-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Bartosz Golaszewski Cc: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski On Mon, Jul 22, 2019 at 05:02:57PM +0200, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Now that the last user of platform data (sh ecovec24) defines a proper > GPIO lookup and sets the 'default-on' device property, we can drop the > platform_data-specific GPIO handling and unify a big chunk of code. > > The only field used from the platform data is now the fbdev pointer. > -static int gpio_backlight_probe_dt(struct platform_device *pdev, > - struct gpio_backlight *gbl) > -{ > - struct device *dev = &pdev->dev; > - enum gpiod_flags flags; > - int ret; > - > - gbl->def_value = device_property_read_bool(dev, "default-on"); > - flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW; > - > - gbl->gpiod = devm_gpiod_get(dev, NULL, flags); > - if (IS_ERR(gbl->gpiod)) { > - ret = PTR_ERR(gbl->gpiod); > - > - if (ret != -EPROBE_DEFER) { > - dev_err(dev, > - "Error: The gpios parameter is missing or invalid.\n"); > - } > - return ret; > - } > - > - return 0; > -} Why not leave this function (perhaps with different name)? -- With Best Regards, Andy Shevchenko From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Shevchenko Subject: Re: [PATCH v2 2/7] backlight: gpio: simplify the platform data handling Date: Mon, 22 Jul 2019 19:06:03 +0300 Message-ID: <20190722160603.GY9224@smile.fi.intel.com> References: <20190722150302.29526-1-brgl@bgdev.pl> <20190722150302.29526-3-brgl@bgdev.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20190722150302.29526-3-brgl@bgdev.pl> Sender: linux-kernel-owner@vger.kernel.org To: Bartosz Golaszewski Cc: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski List-Id: dri-devel@lists.freedesktop.org On Mon, Jul 22, 2019 at 05:02:57PM +0200, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Now that the last user of platform data (sh ecovec24) defines a proper > GPIO lookup and sets the 'default-on' device property, we can drop the > platform_data-specific GPIO handling and unify a big chunk of code. > > The only field used from the platform data is now the fbdev pointer. > -static int gpio_backlight_probe_dt(struct platform_device *pdev, > - struct gpio_backlight *gbl) > -{ > - struct device *dev = &pdev->dev; > - enum gpiod_flags flags; > - int ret; > - > - gbl->def_value = device_property_read_bool(dev, "default-on"); > - flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW; > - > - gbl->gpiod = devm_gpiod_get(dev, NULL, flags); > - if (IS_ERR(gbl->gpiod)) { > - ret = PTR_ERR(gbl->gpiod); > - > - if (ret != -EPROBE_DEFER) { > - dev_err(dev, > - "Error: The gpios parameter is missing or invalid.\n"); > - } > - return ret; > - } > - > - return 0; > -} Why not leave this function (perhaps with different name)? -- With Best Regards, Andy Shevchenko