lkml.org 
[lkml]   [2013]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/5] net: rfkill: gpio: convert to descriptor-based GPIO interface
From
On Thu, Nov 21, 2013 at 4:45 PM, Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
> From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
>
> Convert to the safer gpiod_* family of API functions.

Few comments below.

> --- a/net/rfkill/rfkill-gpio.c
> +++ b/net/rfkill/rfkill-gpio.c

> +static int rfkill_gpio_convert_to_desc(struct platform_device *pdev,
> + struct rfkill_gpio_data *rfkill)
> +{
> + struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data;
> + int ret = 0;

Unneeded assignment.

> +
> + if (gpio_is_valid(pdata->reset_gpio)) {
> + ret = devm_gpio_request_one(&pdev->dev, pdata->reset_gpio,
> + 0, rfkill->reset_name);
> + if (ret) {
> + pr_warn("%s: failed to get reset gpio.\n", __func__);
> + return ret;
> + }
> + rfkill->reset_gpio = gpio_to_desc(pdata->reset_gpio);
> + }
> +
> + if (gpio_is_valid(pdata->shutdown_gpio)) {
> + ret = devm_gpio_request_one(&pdev->dev, pdata->shutdown_gpio,
> + 0, rfkill->shutdown_name);
> + if (ret) {
> + pr_warn("%s: failed to get shutdown gpio.\n", __func__);
> + return ret;
> + }
> + rfkill->shutdown_gpio = gpio_to_desc(pdata->shutdown_gpio);
> + }
> +
> + return 0;
> +}

[]

> + /* Make sure at-least one of the GPIO is defined and that
> + * a name is specified for this instance
> + */
> + if ((!rfkill->reset_gpio && !rfkill->shutdown_gpio) || !rfkill->name) {
> + pr_warn("%s: invalid platform data\n", __func__);
> + return -EINVAL;
> + }
> +
> + if (pdata && pdata->gpio_runtime_setup) {
> + ret = pdata->gpio_runtime_setup(pdev);
> if (ret) {
> - pr_warn("%s: failed to get shutdown gpio.\n", __func__);
> + pr_warn("%s: can't set up gpio\n", __func__);

Could you use dev_* family of functions to print messages?

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2013-11-21 16:41    [W:0.151 / U:0.840 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site