Re: [PATCH V2 3/3] pinctrl: Add Pistachio SoC pin control driver
From: Paul Bolle
Date: Tue Mar 31 2015 - 04:10:31 EST
The patch adds a mismatch between the Kconfig symbol (a bool) and the
code (which suggests that a modular build is also possible).
On Mon, 2015-03-30 at 16:16 -0700, Andrew Bresticker wrote:
> --- a/drivers/pinctrl/Kconfig
> +++ b/drivers/pinctrl/Kconfig
> +config PINCTRL_PISTACHIO
> + def_bool y if MACH_PISTACHIO
This adds a bool symbol.
> + select PINMUX
> + select GENERIC_PINCONF
> + select GPIOLIB_IRQCHIP
> --- a/drivers/pinctrl/Makefile
> +++ b/drivers/pinctrl/Makefile
> +obj-$(CONFIG_PINCTRL_PISTACHIO) += pinctrl-pistachio.o
So pinctrl-pistachio.o will never be part of a module.
> --- /dev/null
> +++ b/drivers/pinctrl/pinctrl-pistachio.c
> +#include <linux/module.h>
Chances are this include is not needed.
> +static struct pinctrl_desc pistachio_pinctrl_desc = {
> + .name = "pistachio-pinctrl",
> + .pctlops = &pistachio_pinctrl_ops,
> + .pmxops = &pistachio_pinmux_ops,
> + .confops = &pistachio_pinconf_ops,
> + .owner = THIS_MODULE,
According to include/linux/export.h THIS_MODULE is equivalent to NULL,
so this can probably be dropped.
> +};
> +#define GPIO_BANK(_bank, _pin_base, _npins) \
> + { \
> + .gpio_chip = { \
> + .label = "GPIO" #_bank, \
> + .request = pistachio_gpio_request, \
> + .free = pistachio_gpio_free, \
> + .get_direction = pistachio_gpio_get_direction, \
> + .direction_input = pistachio_gpio_direction_input, \
> + .direction_output = pistachio_gpio_direction_output, \
> + .get = pistachio_gpio_get, \
> + .set = pistachio_gpio_set, \
> + .base = _pin_base, \
> + .ngpio = _npins, \
> + .owner = THIS_MODULE, \
Ditto.
> + }, \
> + .irq_chip = { \
> + .name = "GPIO" #_bank, \
> + .irq_startup = pistachio_gpio_irq_startup, \
> + .irq_ack = pistachio_gpio_irq_ack, \
> + .irq_mask = pistachio_gpio_irq_mask, \
> + .irq_unmask = pistachio_gpio_irq_unmask, \
> + .irq_set_type = pistachio_gpio_irq_set_type, \
> + }, \
> + .gpio_range = { \
> + .name = "GPIO" #_bank, \
> + .id = _bank, \
> + .base = _pin_base, \
> + .pin_base = _pin_base, \
> + .npins = _npins, \
> + }, \
> + }
> +MODULE_DEVICE_TABLE(of, pistachio_pinctrl_of_match);
According to include/linux/module.h this will be preprocessed away.
> +module_platform_driver(pistachio_pinctrl_driver);
This seems to be equivalent to adding a wrapper that does
platform_driver_register(&pistachio_pinctrl_driver);
and marking that wrapper with device_initcall(). I don't think there's
one line macro to do that.
> +MODULE_AUTHOR("Andrew Bresticker <abrestic@xxxxxxxxxxxx>");
> +MODULE_AUTHOR("Damien Horsley <Damien.Horsley@xxxxxxxxxx>");
> +MODULE_DESCRIPTION("Pistachio pinctrl driver");
> +MODULE_LICENSE("GPL v2");
These macros will (basically) be preprocessed away.
Paul Bolle
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/