From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org,
Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: Re: [PATCH v2] gpio: of: Break out OF-only code
Date: Wed, 17 Jul 2019 12:28:08 +0300 [thread overview]
Message-ID: <20190717092808.GR9224@smile.fi.intel.com> (raw)
In-Reply-To: <20190717071001.3858-1-linus.walleij@linaro.org>
On Wed, Jul 17, 2019 at 09:10:01AM +0200, Linus Walleij wrote:
> The core gpiolib should not contain any OF/device tree-only
> code. Try to break out the main part of it and push it down
> into the optional gpiolib-of.c part of the library.
>
> Create a local gpiolib-of.h header and move stuff around a
> bit to get a clean cut.
Are you going to split ACPI parts as well (at least to a header)?
One nit to address below (sorry, didn't notice before), and take mine
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> -static int gpiochip_alloc_valid_mask(struct gpio_chip *gpiochip)
> +static int gpiochip_alloc_valid_mask(struct gpio_chip *gc)
> {
> -#ifdef CONFIG_OF_GPIO
> - int size;
> - struct device_node *np = gpiochip->of_node;
> -
> - size = of_property_count_u32_elems(np, "gpio-reserved-ranges");
> - if (size > 0 && size % 2 == 0)
> - gpiochip->need_valid_mask = true;
> -#endif
> -
> - if (!gpiochip->need_valid_mask)
> + if (IS_ENABLED(CONFIG_OF_GPIO))
> + gc->need_valid_mask = of_gpio_need_valid_mask(gc);
gpiochip->need_valid_mask = of_gpio_need_valid_mask(gpiochip);
Even with full name it fits 80.
Can you drop renaming here?
> + if (!gc->need_valid_mask)
> return 0;
>
> - gpiochip->valid_mask = gpiochip_allocate_mask(gpiochip);
> - if (!gpiochip->valid_mask)
> + gc->valid_mask = gpiochip_allocate_mask(gc);
> + if (!gc->valid_mask)
> return -ENOMEM;
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2019-07-17 9:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-17 7:10 [PATCH v2] gpio: of: Break out OF-only code Linus Walleij
2019-07-17 9:28 ` Andy Shevchenko [this message]
2019-07-28 21:19 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190717092808.GR9224@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=bgolaszewski@baylibre.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).