lkml.org 
[lkml]   [2018]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 2/3] gpiolib: Support 'gpio-reserved-ranges' property
From
Date
On Wed, 2018-03-21 at 09:58 -0700, Stephen Boyd wrote:
> From: Stephen Boyd <sboyd@codeaurora.org>
>
> Some qcom platforms make some GPIOs or pins unavailable for use by
> non-secure operating systems, and thus reading or writing the
> registers
> for those pins will cause access control issues. Add support for a DT
> property to describe the set of GPIOs that are available for use so
> that
> higher level OSes are able to know what pins to avoid reading/writing.
> Non-DT platforms can add support by directly updating the
> chip->valid_mask.

> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>

Hmm...

> + gpiochip->valid_mask = kcalloc(BITS_TO_LONGS(gpiochip-
> >ngpio),
> + sizeof(long), GFP_KERNEL);

Just noticed that kcalloc is superfluous here.
kmalloc_array() would be enough.

> + if (!gpiochip->valid_mask)
> + return -ENOMEM;
> +
> + /* Assume by default all GPIOs are valid */
> + bitmap_fill(gpiochip->valid_mask, gpiochip->ngpio);


--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

\
 
 \ /
  Last update: 2018-03-21 18:59    [W:0.154 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site