lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VeEEWCVXz4X1qazfVKZBDBgP6NPfPnuS-b7qEiT4m7f=g@mail.gmail.com>
Date:	Thu, 21 Nov 2013 17:32:28 +0200
From:	Andy Shevchenko <andy.shevchenko@...il.com>
To:	Mika Westerberg <mika.westerberg@...ux.intel.com>
Cc:	linux-acpi@...r.kernel.org,
	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Linus Walleij <linus.walleij@...aro.org>,
	Chris Ball <cjb@...top.org>,
	Johannes Berg <johannes@...solutions.net>,
	Rhyland Klein <rklein@...dia.com>,
	Adrian Hunter <adrian.hunter@...el.com>,
	Alexandre Courbot <acourbot@...dia.com>,
	Mathias Nyman <mathias.nyman@...ux.intel.com>,
	Rob Landley <rob@...dley.net>,
	Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
	linux-gpio@...r.kernel.org,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/5] net: rfkill: gpio: convert to descriptor-based GPIO interface

On Thu, Nov 21, 2013 at 4:45 PM, Mika Westerberg
<mika.westerberg@...ux.intel.com> wrote:
> From: Heikki Krogerus <heikki.krogerus@...ux.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ