Message ID | 20210504184040.353578-1-daniel.schwierzeck@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | pinctrl: mscc: fix multiple definitions | expand |
On Tue, May 04, 2021 at 08:40:40PM +0200, Daniel Schwierzeck wrote: > gcc-11 complains about multiple definitions: > > /opt/gcc-11.0.20210426-nolibc/mips-linux/bin/mips-linux-ld.bfd: drivers/pinctrl/mscc/pinctrl-ocelot.o:drivers/pinctrl/mscc/mscc-common.h:64: multiple definition of `mscc_pinctrl_ops'; drivers/pinctrl/mscc/mscc-common.o:drivers/pinctrl/mscc/mscc-common.h:64: first defined here > /opt/gcc-11.0.20210426-nolibc/mips-linux/bin/mips-linux-ld.bfd: drivers/pinctrl/mscc/pinctrl-ocelot.o:drivers/pinctrl/mscc/mscc-common.h:66: multiple definition of `mscc_gpio_ops'; drivers/pinctrl/mscc/mscc-common.o:drivers/pinctrl/mscc/mscc-common.h:66: first defined here > > mscc_pinctrl_ops and mscc_gpio_ops are instantiated in mscc-common.c and > just referenced by SoC specific pinctrl drivers. Annotate the exports > in mscc-common.h with `extern` to avoid creating new instances > when including mscc-common.h. > > Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> I posted this yesterday as part of: https://patchwork.ozlabs.org/project/uboot/list/?series=241916&state=* BTW.
Am Dienstag, den 04.05.2021, 14:45 -0400 schrieb Tom Rini: > On Tue, May 04, 2021 at 08:40:40PM +0200, Daniel Schwierzeck wrote: > > > gcc-11 complains about multiple definitions: > > > > /opt/gcc-11.0.20210426-nolibc/mips-linux/bin/mips-linux-ld.bfd: > > drivers/pinctrl/mscc/pinctrl-ocelot.o:drivers/pinctrl/mscc/mscc- > > common.h:64: multiple definition of `mscc_pinctrl_ops'; > > drivers/pinctrl/mscc/mscc-common.o:drivers/pinctrl/mscc/mscc- > > common.h:64: first defined here > > /opt/gcc-11.0.20210426-nolibc/mips-linux/bin/mips-linux-ld.bfd: > > drivers/pinctrl/mscc/pinctrl-ocelot.o:drivers/pinctrl/mscc/mscc- > > common.h:66: multiple definition of `mscc_gpio_ops'; > > drivers/pinctrl/mscc/mscc-common.o:drivers/pinctrl/mscc/mscc- > > common.h:66: first defined here > > > > mscc_pinctrl_ops and mscc_gpio_ops are instantiated in mscc- > > common.c and > > just referenced by SoC specific pinctrl drivers. Annotate the > > exports > > in mscc-common.h with `extern` to avoid creating new instances > > when including mscc-common.h. > > > > Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> > > I posted this yesterday as part of: > https://patchwork.ozlabs.org/project/uboot/list/?series=241916&state=* > BTW. okay, I only saw your patch 7/7 in my inbox ;)
diff --git a/drivers/pinctrl/mscc/mscc-common.h b/drivers/pinctrl/mscc/mscc-common.h index 3c5c1faf84..9eb1321f89 100644 --- a/drivers/pinctrl/mscc/mscc-common.h +++ b/drivers/pinctrl/mscc/mscc-common.h @@ -61,6 +61,6 @@ int mscc_pinctrl_probe(struct udevice *dev, int num_func, const struct mscc_pin_data *mscc_pins, int num_pins, char * const *function_names, const unsigned long *mscc_gpios); -const struct pinctrl_ops mscc_pinctrl_ops; -const struct dm_gpio_ops mscc_gpio_ops; +extern const struct pinctrl_ops mscc_pinctrl_ops; +extern const struct dm_gpio_ops mscc_gpio_ops;
gcc-11 complains about multiple definitions: /opt/gcc-11.0.20210426-nolibc/mips-linux/bin/mips-linux-ld.bfd: drivers/pinctrl/mscc/pinctrl-ocelot.o:drivers/pinctrl/mscc/mscc-common.h:64: multiple definition of `mscc_pinctrl_ops'; drivers/pinctrl/mscc/mscc-common.o:drivers/pinctrl/mscc/mscc-common.h:64: first defined here /opt/gcc-11.0.20210426-nolibc/mips-linux/bin/mips-linux-ld.bfd: drivers/pinctrl/mscc/pinctrl-ocelot.o:drivers/pinctrl/mscc/mscc-common.h:66: multiple definition of `mscc_gpio_ops'; drivers/pinctrl/mscc/mscc-common.o:drivers/pinctrl/mscc/mscc-common.h:66: first defined here mscc_pinctrl_ops and mscc_gpio_ops are instantiated in mscc-common.c and just referenced by SoC specific pinctrl drivers. Annotate the exports in mscc-common.h with `extern` to avoid creating new instances when including mscc-common.h. Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> --- drivers/pinctrl/mscc/mscc-common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)