Re: [PATCH v2 1/2] pinctrl: Add driver for Alphascale asm9260 pinctrl

From: Paul Bolle
Date: Fri Mar 27 2015 - 13:10:52 EST


This patch adds a mismatch between the Kconfig symbol (bool) and the
code (which assumes a modular built too).

On Fri, 2015-03-27 at 10:36 +0100, Oleksij Rempel wrote:
> --- a/drivers/pinctrl/Kconfig
> +++ b/drivers/pinctrl/Kconfig
> @@ -47,6 +47,14 @@ config PINCTRL_AS3722
> open drain configuration for the GPIO pins of AS3722 devices. It also
> supports the GPIO functionality through gpiolib.
>
> +config PINCTRL_ASM9260
> + bool "Pinctrl driver for Alphascale asm9260"

This adds a bool symbol.

> + depends on MACH_ASM9260
> + select PINMUX
> + select GENERIC_PINCONF
> + help
> + Say Y here to enable the Alphascale asm9260 pinctrl driver
> +

> -- a/drivers/pinctrl/Makefile
> +++ b/drivers/pinctrl/Makefile

> +obj-$(CONFIG_PINCTRL_ASM9260) += pinctrl-asm9260.o

So this object can now only be built-in.

> --- /dev/null
> +++ b/drivers/pinctrl/pinctrl-asm9260.c
> @@ -0,0 +1,733 @@
> +/*
> + * Pinctrl driver for the Alphascale ASM9260 SoC
> + *
> + * Copyright (c) 2014, Oleksij Rempel <linux@xxxxxxxxxxxxxxxx>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms and conditions of the GNU General Public License,
> + * version 2, as published by the Free Software Foundation.
> + */
> +
> +#include <linux/clk.h>
> +#include <linux/io.h>
> +#include <linux/module.h>

This include is probably not needed.

> +#include <linux/pinctrl/pinconf-generic.h>
> +#include <linux/pinctrl/pinmux.h>
> +#include <linux/platform_device.h>
> +
> +#include "core.h"
> +#include "pinctrl-utils.h"

> +/*
> + * Pin control driver setup
> + */
> +static struct pinctrl_desc asm9260_pinctrl_desc = {
> + .pctlops = &asm9260_pinctrl_ops,
> + .pmxops = &asm9260_pinmux_ops,
> + .confops = &asm9260_pinconf_ops,
> + .owner = THIS_MODULE,

THIS_MODULE is, basically, equivalent to NULL for built-in code.

> +};
> +

> +MODULE_DEVICE_TABLE(of, asm9260_pinctrl_of_match);

This will be preprocessed away for built-in code.

> +module_platform_driver(asm9260_pinctrl_driver);

The built-in equivalent of this seems to be a wrapper that
only does
platform_driver_register(&asm9260_pinctrl_driver);

and mark that wrapper as a device_initcall(). There appears to be no
macro that does all that in one line.

> +MODULE_AUTHOR("Oleksij Rempel <linux@xxxxxxxxxxxxxxxx>");
> +MODULE_DESCRIPTION("Alphascale ASM9260 pinctrl driver");
> +MODULE_LICENSE("GPL");

These three macros will be, effectively, preprocessed away for built-in
code. (By the way, you probably want to use "GPL v2" as the license
ident if it would be possible to build this code modular.)


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/