[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcOxBFvr4MSd=y61t7eFAv=9pFzMsumd7=2jbW3aZ4O4g@mail.gmail.com>
Date: Sat, 20 Oct 2018 14:17:58 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: "Dan O'Donovan" <dan@...tex.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
"Krogerus, Heikki" <heikki.krogerus@...ux.intel.com>,
Lee Jones <lee.jones@...aro.org>,
Linus Walleij <linus.walleij@...aro.org>,
Jacek Anaszewski <jacek.anaszewski@...il.com>,
Pavel Machek <pavel@....cz>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
Linux LED Subsystem <linux-leds@...r.kernel.org>,
carlos.iglesias@...tex.com, Javier Arteaga <javier@...tex.com>
Subject: Re: [PATCH v2 2/3] leds: upboard: Add LED support
On Fri, Oct 19, 2018 at 8:27 PM Dan O'Donovan <dan@...tex.com> wrote:
>
> From: Javier Arteaga <javier@...tex.com>
>
> Allow userspace to use the on-board LEDs as "upboard:<color>:".
> +#include <linux/kernel.h>
> +#include <linux/leds.h>
> +#include <linux/mfd/upboard.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/regmap.h>
> +#include <linux/acpi.h>
For better maintenance keep this ordered.
> + adev = ACPI_COMPANION(dev);
> + if (!adev || strcmp(acpi_device_hid(adev), "AANT0F01"))
> + return -ENODEV;
Why do you need this part?
> + if (led_index >= ARRAY_SIZE(upboard_led_names))
> + return -EINVAL;
> + if (!dev->parent)
> + return -EINVAL;
...I think this check will cover cases when driver is being probed standalone.
Otherwise it's caller's responsibility not to instantiate it if
platform doesn't have this LED feature.
> + regmap = dev_get_regmap(dev->parent, NULL);
> + if (!regmap)
> + return -EINVAL;
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists