2011-06-01 03:04:44

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build failure after merge of the final tree (mmc tree related)

Hi all,

After merging the final tree, today's linux-next build (powerpc
allyesconfig) failed like this:

drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_pltfm_register':
(.opd+0xd8): multiple definition of `sdhci_pltfm_register'
drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0xd8): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_pltfm_init':
(.text+0x568): multiple definition of `.sdhci_pltfm_init'
drivers/mmc/host/sdhci-of-esdhc.o:(.text+0x568): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_get_of_property':
(.text+0x34c): multiple definition of `.sdhci_get_of_property'
drivers/mmc/host/sdhci-of-esdhc.o:(.text+0x34c): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_be32bs_writel':
(.text+0x13c): multiple definition of `.sdhci_be32bs_writel'
drivers/mmc/host/sdhci-of-esdhc.o:(.text+0x13c): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_pltfm_resume':
(.opd+0x120): multiple definition of `sdhci_pltfm_resume'
drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0x120): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_be32bs_readl':
(.opd+0x0): multiple definition of `sdhci_be32bs_readl'
drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0x0): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_be32bs_readw':
(.text+0x64): multiple definition of `.sdhci_be32bs_readw'
drivers/mmc/host/sdhci-of-esdhc.o:(.text+0x64): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_pltfm_free':
(.text+0x8d0): multiple definition of `.sdhci_pltfm_free'
drivers/mmc/host/sdhci-of-esdhc.o:(.text+0x8d0): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_pltfm_free':
(.opd+0xc0): multiple definition of `sdhci_pltfm_free'
drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0xc0): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_be32bs_readw':
(.opd+0x18): multiple definition of `sdhci_be32bs_readw'
drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0x18): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_pltfm_unregister':
(.text+0xa94): multiple definition of `.sdhci_pltfm_unregister'
drivers/mmc/host/sdhci-of-esdhc.o:(.text+0xa94): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_be32bs_readb':
(.text+0xd0): multiple definition of `.sdhci_be32bs_readb'
drivers/mmc/host/sdhci-of-esdhc.o:(.text+0xd0): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_be32bs_writew':
(.text+0x1a0): multiple definition of `.sdhci_be32bs_writew'
drivers/mmc/host/sdhci-of-esdhc.o:(.text+0x1a0): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_be32bs_writel':
(.opd+0x48): multiple definition of `sdhci_be32bs_writel'
drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0x48): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_pltfm_unregister':
(.opd+0xf0): multiple definition of `sdhci_pltfm_unregister'
drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0xf0): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_be32bs_writew':
(.opd+0x60): multiple definition of `sdhci_be32bs_writew'
drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0x60): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_pltfm_resume':
(.text+0xc70): multiple definition of `.sdhci_pltfm_resume'
drivers/mmc/host/sdhci-of-esdhc.o:(.text+0xc70): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_be32bs_writeb':
(.text+0x2ac): multiple definition of `.sdhci_be32bs_writeb'
drivers/mmc/host/sdhci-of-esdhc.o:(.text+0x2ac): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_pltfm_suspend':
(.text+0xc04): multiple definition of `.sdhci_pltfm_suspend'
drivers/mmc/host/sdhci-of-esdhc.o:(.text+0xc04): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_pltfm_register':
(.text+0x9c0): multiple definition of `.sdhci_pltfm_register'
drivers/mmc/host/sdhci-of-esdhc.o:(.text+0x9c0): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_be32bs_readl':
(.text+0x0): multiple definition of `.sdhci_be32bs_readl'
drivers/mmc/host/sdhci-of-esdhc.o:(.text+0x0): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_be32bs_writeb':
(.opd+0x78): multiple definition of `sdhci_be32bs_writeb'
drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0x78): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_pltfm_suspend':
(.opd+0x108): multiple definition of `sdhci_pltfm_suspend'
drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0x108): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_get_of_property':
(.opd+0x90): multiple definition of `sdhci_get_of_property'
drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0x90): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_pltfm_init':
(.opd+0xa8): multiple definition of `sdhci_pltfm_init'
drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0xa8): first defined here
drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_be32bs_readb':
(.opd+0x30): multiple definition of `sdhci_be32bs_readb'
drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0x30): first defined here

Presumably caused by commit e2d0d7dc5542 ("mmc: sdhci: make sdhci-of
device drivers self registered").

I have reverted the merge of the mmc tree for today.

P.S. Chris, some commits in your tree have no SoB from you despite the
fact that you committed them.
--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/


Attachments:
(No filename) (5.41 kB)
(No filename) (490.00 B)
Download all attachments

2011-06-01 03:34:19

by Shawn Guo

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the final tree (mmc tree related)

Hi Stephen,

On Wed, Jun 01, 2011 at 01:04:31PM +1000, Stephen Rothwell wrote:
> Hi all,
>
> After merging the final tree, today's linux-next build (powerpc
> allyesconfig) failed like this:
>
> drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_pltfm_register':
> (.opd+0xd8): multiple definition of `sdhci_pltfm_register'
> drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0xd8): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_pltfm_init':
> (.text+0x568): multiple definition of `.sdhci_pltfm_init'
> drivers/mmc/host/sdhci-of-esdhc.o:(.text+0x568): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_get_of_property':
> (.text+0x34c): multiple definition of `.sdhci_get_of_property'
> drivers/mmc/host/sdhci-of-esdhc.o:(.text+0x34c): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_be32bs_writel':
> (.text+0x13c): multiple definition of `.sdhci_be32bs_writel'
> drivers/mmc/host/sdhci-of-esdhc.o:(.text+0x13c): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_pltfm_resume':
> (.opd+0x120): multiple definition of `sdhci_pltfm_resume'
> drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0x120): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_be32bs_readl':
> (.opd+0x0): multiple definition of `sdhci_be32bs_readl'
> drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0x0): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_be32bs_readw':
> (.text+0x64): multiple definition of `.sdhci_be32bs_readw'
> drivers/mmc/host/sdhci-of-esdhc.o:(.text+0x64): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_pltfm_free':
> (.text+0x8d0): multiple definition of `.sdhci_pltfm_free'
> drivers/mmc/host/sdhci-of-esdhc.o:(.text+0x8d0): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_pltfm_free':
> (.opd+0xc0): multiple definition of `sdhci_pltfm_free'
> drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0xc0): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_be32bs_readw':
> (.opd+0x18): multiple definition of `sdhci_be32bs_readw'
> drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0x18): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_pltfm_unregister':
> (.text+0xa94): multiple definition of `.sdhci_pltfm_unregister'
> drivers/mmc/host/sdhci-of-esdhc.o:(.text+0xa94): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_be32bs_readb':
> (.text+0xd0): multiple definition of `.sdhci_be32bs_readb'
> drivers/mmc/host/sdhci-of-esdhc.o:(.text+0xd0): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_be32bs_writew':
> (.text+0x1a0): multiple definition of `.sdhci_be32bs_writew'
> drivers/mmc/host/sdhci-of-esdhc.o:(.text+0x1a0): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_be32bs_writel':
> (.opd+0x48): multiple definition of `sdhci_be32bs_writel'
> drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0x48): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_pltfm_unregister':
> (.opd+0xf0): multiple definition of `sdhci_pltfm_unregister'
> drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0xf0): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_be32bs_writew':
> (.opd+0x60): multiple definition of `sdhci_be32bs_writew'
> drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0x60): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_pltfm_resume':
> (.text+0xc70): multiple definition of `.sdhci_pltfm_resume'
> drivers/mmc/host/sdhci-of-esdhc.o:(.text+0xc70): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_be32bs_writeb':
> (.text+0x2ac): multiple definition of `.sdhci_be32bs_writeb'
> drivers/mmc/host/sdhci-of-esdhc.o:(.text+0x2ac): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_pltfm_suspend':
> (.text+0xc04): multiple definition of `.sdhci_pltfm_suspend'
> drivers/mmc/host/sdhci-of-esdhc.o:(.text+0xc04): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_pltfm_register':
> (.text+0x9c0): multiple definition of `.sdhci_pltfm_register'
> drivers/mmc/host/sdhci-of-esdhc.o:(.text+0x9c0): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `.sdhci_be32bs_readl':
> (.text+0x0): multiple definition of `.sdhci_be32bs_readl'
> drivers/mmc/host/sdhci-of-esdhc.o:(.text+0x0): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_be32bs_writeb':
> (.opd+0x78): multiple definition of `sdhci_be32bs_writeb'
> drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0x78): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_pltfm_suspend':
> (.opd+0x108): multiple definition of `sdhci_pltfm_suspend'
> drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0x108): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_get_of_property':
> (.opd+0x90): multiple definition of `sdhci_get_of_property'
> drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0x90): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_pltfm_init':
> (.opd+0xa8): multiple definition of `sdhci_pltfm_init'
> drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0xa8): first defined here
> drivers/mmc/host/sdhci-of-hlwd.o: In function `sdhci_be32bs_readb':
> (.opd+0x30): multiple definition of `sdhci_be32bs_readb'
> drivers/mmc/host/sdhci-of-esdhc.o:(.opd+0x30): first defined here
>
> Presumably caused by commit e2d0d7dc5542 ("mmc: sdhci: make sdhci-of
> device drivers self registered").
>
I did build test for powerpc in the first a few rounds posts, but
forgot the in the last ones. I will fix this soon. Sorry for this.

--
Regards,
Shawn

2011-06-02 02:53:04

by Shawn Guo

[permalink] [raw]
Subject: [PATCH] mmc: sdhci: change sdhci-pltfm into a module

From: Shawn Guo <[email protected]>

There are a couple of problems left from the sdhci pltfm and OF
consolidation changes.

* When building more than one sdhci-pltfm based drivers in the same
image, linker will give multiple definition error on the sdhci-pltfm
helper functions. For example right now, building sdhci-of-esdhc
and sdhci-of-hlwd together is a valid combination from Kconfig view.

* With the current build method, there is error with building the
drivers as module, but module installation fails with modprobe.

The patch fixes above problems by changing sdhci-pltfm into a module.
To avoid EXPORT_SYMBOL on so many big endian IO accessors, it moves
these accessors into sdhci-pltfm.h as the 'static inline' functions.
As a result, sdhci.h needs to be included in sdhci-pltfm.h, and in
turn can be removed from individual drivers which already include
sdhci-pltfm.h.

Signed-off-by: Shawn Guo <[email protected]>
---
drivers/mmc/host/Kconfig | 37 +++++++++++++----
drivers/mmc/host/Makefile | 7 +---
drivers/mmc/host/sdhci-cns3xxx.c | 1 -
drivers/mmc/host/sdhci-dove.c | 1 -
drivers/mmc/host/sdhci-esdhc-imx.c | 1 -
drivers/mmc/host/sdhci-of-esdhc.c | 1 -
drivers/mmc/host/sdhci-of-hlwd.c | 1 -
drivers/mmc/host/sdhci-pltfm.c | 82 ++++++++++-------------------------
drivers/mmc/host/sdhci-pltfm.h | 67 +++++++++++++++++++++++++----
drivers/mmc/host/sdhci-tegra.c | 1 -
10 files changed, 112 insertions(+), 87 deletions(-)

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index ee4ac77..74e77c9 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -81,19 +81,32 @@ config MMC_RICOH_MMC

If unsure, say Y.

-config MMC_SDHCI_OF_ESDHC
- bool "SDHCI OF support for the Freescale eSDHC controller"
+config MMC_SDHCI_PLTFM
+ tristate "SDHCI platform and OF driver helper"
depends on MMC_SDHCI
+ help
+ This selects the common helper functions support for Secure Digital
+ Host Controller Interface based platform and OF drivers.
+
+ If you have a controller with this interface, say Y or M here.
+
+ If unsure, say N.
+
+config MMC_SDHCI_OF_ESDHC
+ tristate "SDHCI OF support for the Freescale eSDHC controller"
+ depends on MMC_SDHCI_PLTFM
depends on PPC_OF
select MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER
help
This selects the Freescale eSDHC controller support.

+ If you have a controller with this interface, say Y or M here.
+
If unsure, say N.

config MMC_SDHCI_OF_HLWD
- bool "SDHCI OF support for the Nintendo Wii SDHCI controllers"
- depends on MMC_SDHCI
+ tristate "SDHCI OF support for the Nintendo Wii SDHCI controllers"
+ depends on MMC_SDHCI_PLTFM
depends on PPC_OF
select MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER
help
@@ -101,43 +114,51 @@ config MMC_SDHCI_OF_HLWD
found in the "Hollywood" chipset of the Nintendo Wii video game
console.

+ If you have a controller with this interface, say Y or M here.
+
If unsure, say N.

config MMC_SDHCI_CNS3XXX
tristate "SDHCI support on the Cavium Networks CNS3xxx SoC"
depends on ARCH_CNS3XXX
- depends on MMC_SDHCI
+ depends on MMC_SDHCI_PLTFM
help
This selects the SDHCI support for CNS3xxx System-on-Chip devices.

+ If you have a controller with this interface, say Y or M here.
+
If unsure, say N.

config MMC_SDHCI_ESDHC_IMX
tristate "SDHCI platform support for the Freescale eSDHC i.MX controller"
depends on ARCH_MX25 || ARCH_MX35 || ARCH_MX5
- depends on MMC_SDHCI
+ depends on MMC_SDHCI_PLTFM
select MMC_SDHCI_IO_ACCESSORS
help
This selects the Freescale eSDHC controller support on the platform
bus, found on platforms like mx35/51.

+ If you have a controller with this interface, say Y or M here.
+
If unsure, say N.

config MMC_SDHCI_DOVE
tristate "SDHCI support on Marvell's Dove SoC"
depends on ARCH_DOVE
- depends on MMC_SDHCI
+ depends on MMC_SDHCI_PLTFM
select MMC_SDHCI_IO_ACCESSORS
help
This selects the Secure Digital Host Controller Interface in
Marvell's Dove SoC.

+ If you have a controller with this interface, say Y or M here.
+
If unsure, say N.

config MMC_SDHCI_TEGRA
tristate "SDHCI platform support for the Tegra SD/MMC Controller"
depends on ARCH_TEGRA
- depends on MMC_SDHCI
+ depends on MMC_SDHCI_PLTFM
select MMC_SDHCI_IO_ACCESSORS
help
This selects the Tegra SD/MMC controller. If you have a Tegra
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index cbd89c3..bf479ab 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -44,18 +44,13 @@ obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
obj-$(CONFIG_MMC_VUB300) += vub300.o
obj-$(CONFIG_MMC_USHC) += ushc.o

+obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-pltfm.o
obj-$(CONFIG_MMC_SDHCI_CNS3XXX) += sdhci-cns3xxx.o
-sdhci-cns3xxx-objs := sdhci-pltfm.o
obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX) += sdhci-esdhc-imx.o
-sdhci-esdhc-imx-objs := sdhci-pltfm.o
obj-$(CONFIG_MMC_SDHCI_DOVE) += sdhci-dove.o
-sdhci-dove-objs := sdhci-pltfm.o
obj-$(CONFIG_MMC_SDHCI_TEGRA) += sdhci-tegra.o
-sdhci-tegra-objs := sdhci-pltfm.o
obj-$(CONFIG_MMC_SDHCI_OF_ESDHC) += sdhci-of-esdhc.o
-sdhci-of-esdhc-objs := sdhci-pltfm.o
obj-$(CONFIG_MMC_SDHCI_OF_HLWD) += sdhci-of-hlwd.o
-sdhci-of-hlwd-objs := sdhci-pltfm.o

ifeq ($(CONFIG_CB710_DEBUG),y)
CFLAGS-cb710-mmc += -DDEBUG
diff --git a/drivers/mmc/host/sdhci-cns3xxx.c b/drivers/mmc/host/sdhci-cns3xxx.c
index 025d1a5..4b920b7 100644
--- a/drivers/mmc/host/sdhci-cns3xxx.c
+++ b/drivers/mmc/host/sdhci-cns3xxx.c
@@ -16,7 +16,6 @@
#include <linux/device.h>
#include <linux/mmc/host.h>
#include <mach/cns3xxx.h>
-#include "sdhci.h"
#include "sdhci-pltfm.h"

static unsigned int sdhci_cns3xxx_get_max_clk(struct sdhci_host *host)
diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c
index 49aa533..f2d29dc 100644
--- a/drivers/mmc/host/sdhci-dove.c
+++ b/drivers/mmc/host/sdhci-dove.c
@@ -22,7 +22,6 @@
#include <linux/io.h>
#include <linux/mmc/host.h>

-#include "sdhci.h"
#include "sdhci-pltfm.h"

static u16 sdhci_dove_readw(struct sdhci_host *host, int reg)
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 3105bcf..248b8e5 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -22,7 +22,6 @@
#include <linux/mmc/sdio.h>
#include <mach/hardware.h>
#include <mach/esdhc.h>
-#include "sdhci.h"
#include "sdhci-pltfm.h"
#include "sdhci-esdhc.h"

diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index fd7c2f5..b365f4f 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -17,7 +17,6 @@
#include <linux/delay.h>
#include <linux/mmc/host.h>
#include "sdhci-pltfm.h"
-#include "sdhci.h"
#include "sdhci-esdhc.h"

static u16 esdhc_readw(struct sdhci_host *host, int reg)
diff --git a/drivers/mmc/host/sdhci-of-hlwd.c b/drivers/mmc/host/sdhci-of-hlwd.c
index faedfce..735be13 100644
--- a/drivers/mmc/host/sdhci-of-hlwd.c
+++ b/drivers/mmc/host/sdhci-of-hlwd.c
@@ -22,7 +22,6 @@
#include <linux/delay.h>
#include <linux/mmc/host.h>
#include "sdhci-pltfm.h"
-#include "sdhci.h"

/*
* Ops and quirks for the Nintendo Wii SDHCI controllers.
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 041b0e2..71c0ce1 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -33,69 +33,11 @@
#ifdef CONFIG_PPC
#include <asm/machdep.h>
#endif
-#include "sdhci.h"
#include "sdhci-pltfm.h"

static struct sdhci_ops sdhci_pltfm_ops = {
};

-#ifdef CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER
-/*
- * These accessors are designed for big endian hosts doing I/O to
- * little endian controllers incorporating a 32-bit hardware byte swapper.
- */
-u32 sdhci_be32bs_readl(struct sdhci_host *host, int reg)
-{
- return in_be32(host->ioaddr + reg);
-}
-
-u16 sdhci_be32bs_readw(struct sdhci_host *host, int reg)
-{
- return in_be16(host->ioaddr + (reg ^ 0x2));
-}
-
-u8 sdhci_be32bs_readb(struct sdhci_host *host, int reg)
-{
- return in_8(host->ioaddr + (reg ^ 0x3));
-}
-
-void sdhci_be32bs_writel(struct sdhci_host *host, u32 val, int reg)
-{
- out_be32(host->ioaddr + reg, val);
-}
-
-void sdhci_be32bs_writew(struct sdhci_host *host, u16 val, int reg)
-{
- struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
- int base = reg & ~0x3;
- int shift = (reg & 0x2) * 8;
-
- switch (reg) {
- case SDHCI_TRANSFER_MODE:
- /*
- * Postpone this write, we must do it together with a
- * command write that is down below.
- */
- pltfm_host->xfer_mode_shadow = val;
- return;
- case SDHCI_COMMAND:
- sdhci_be32bs_writel(host,
- val << 16 | pltfm_host->xfer_mode_shadow,
- SDHCI_TRANSFER_MODE);
- return;
- }
- clrsetbits_be32(host->ioaddr + base, 0xffff << shift, val << shift);
-}
-
-void sdhci_be32bs_writeb(struct sdhci_host *host, u8 val, int reg)
-{
- int base = reg & ~0x3;
- int shift = (reg & 0x3) * 8;
-
- clrsetbits_be32(host->ioaddr + base , 0xff << shift, val << shift);
-}
-#endif /* CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER */
-
#ifdef CONFIG_OF
static bool sdhci_of_wp_inverted(struct device_node *np)
{
@@ -136,6 +78,7 @@ void sdhci_get_of_property(struct platform_device *pdev)
#else
void sdhci_get_of_property(struct platform_device *pdev) {}
#endif /* CONFIG_OF */
+EXPORT_SYMBOL_GPL(sdhci_get_of_property);

struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
struct sdhci_pltfm_data *pdata)
@@ -202,6 +145,7 @@ err:
dev_err(&pdev->dev, "%s failed %d\n", __func__, ret);
return ERR_PTR(ret);
}
+EXPORT_SYMBOL_GPL(sdhci_pltfm_init);

void sdhci_pltfm_free(struct platform_device *pdev)
{
@@ -213,6 +157,7 @@ void sdhci_pltfm_free(struct platform_device *pdev)
sdhci_free_host(host);
platform_set_drvdata(pdev, NULL);
}
+EXPORT_SYMBOL_GPL(sdhci_pltfm_free);

int sdhci_pltfm_register(struct platform_device *pdev,
struct sdhci_pltfm_data *pdata)
@@ -232,6 +177,7 @@ int sdhci_pltfm_register(struct platform_device *pdev,

return ret;
}
+EXPORT_SYMBOL_GPL(sdhci_pltfm_register);

int sdhci_pltfm_unregister(struct platform_device *pdev)
{
@@ -243,6 +189,7 @@ int sdhci_pltfm_unregister(struct platform_device *pdev)

return 0;
}
+EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister);

#ifdef CONFIG_PM
int sdhci_pltfm_suspend(struct platform_device *dev, pm_message_t state)
@@ -251,6 +198,7 @@ int sdhci_pltfm_suspend(struct platform_device *dev, pm_message_t state)

return sdhci_suspend_host(host, state);
}
+EXPORT_SYMBOL_GPL(sdhci_pltfm_suspend);

int sdhci_pltfm_resume(struct platform_device *dev)
{
@@ -258,4 +206,22 @@ int sdhci_pltfm_resume(struct platform_device *dev)

return sdhci_resume_host(host);
}
+EXPORT_SYMBOL_GPL(sdhci_pltfm_resume);
#endif /* CONFIG_PM */
+
+static int __init sdhci_pltfm_drv_init(void)
+{
+ pr_info("sdhci-pltfm: SDHCI platform and OF driver helper\n");
+
+ return 0;
+}
+module_init(sdhci_pltfm_drv_init);
+
+static void __exit sdhci_pltfm_drv_exit(void)
+{
+}
+module_exit(sdhci_pltfm_drv_exit);
+
+MODULE_DESCRIPTION("SDHCI platform and OF driver helper");
+MODULE_AUTHOR("Intel Corporation");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
index fd72694..3a9fc3f 100644
--- a/drivers/mmc/host/sdhci-pltfm.h
+++ b/drivers/mmc/host/sdhci-pltfm.h
@@ -12,9 +12,8 @@
#define _DRIVERS_MMC_SDHCI_PLTFM_H

#include <linux/clk.h>
-#include <linux/types.h>
#include <linux/platform_device.h>
-#include <linux/mmc/sdhci.h>
+#include "sdhci.h"

struct sdhci_pltfm_data {
struct sdhci_ops *ops;
@@ -31,13 +30,63 @@ struct sdhci_pltfm_host {
};

#ifdef CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER
-extern u32 sdhci_be32bs_readl(struct sdhci_host *host, int reg);
-extern u16 sdhci_be32bs_readw(struct sdhci_host *host, int reg);
-extern u8 sdhci_be32bs_readb(struct sdhci_host *host, int reg);
-extern void sdhci_be32bs_writel(struct sdhci_host *host, u32 val, int reg);
-extern void sdhci_be32bs_writew(struct sdhci_host *host, u16 val, int reg);
-extern void sdhci_be32bs_writeb(struct sdhci_host *host, u8 val, int reg);
-#endif
+/*
+ * These accessors are designed for big endian hosts doing I/O to
+ * little endian controllers incorporating a 32-bit hardware byte swapper.
+ */
+static inline u32 sdhci_be32bs_readl(struct sdhci_host *host, int reg)
+{
+ return in_be32(host->ioaddr + reg);
+}
+
+static inline u16 sdhci_be32bs_readw(struct sdhci_host *host, int reg)
+{
+ return in_be16(host->ioaddr + (reg ^ 0x2));
+}
+
+static inline u8 sdhci_be32bs_readb(struct sdhci_host *host, int reg)
+{
+ return in_8(host->ioaddr + (reg ^ 0x3));
+}
+
+static inline void sdhci_be32bs_writel(struct sdhci_host *host,
+ u32 val, int reg)
+{
+ out_be32(host->ioaddr + reg, val);
+}
+
+static inline void sdhci_be32bs_writew(struct sdhci_host *host,
+ u16 val, int reg)
+{
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+ int base = reg & ~0x3;
+ int shift = (reg & 0x2) * 8;
+
+ switch (reg) {
+ case SDHCI_TRANSFER_MODE:
+ /*
+ * Postpone this write, we must do it together with a
+ * command write that is down below.
+ */
+ pltfm_host->xfer_mode_shadow = val;
+ return;
+ case SDHCI_COMMAND:
+ sdhci_be32bs_writel(host,
+ val << 16 | pltfm_host->xfer_mode_shadow,
+ SDHCI_TRANSFER_MODE);
+ return;
+ }
+ clrsetbits_be32(host->ioaddr + base, 0xffff << shift, val << shift);
+}
+
+static inline void sdhci_be32bs_writeb(struct sdhci_host *host, u8 val, int reg)
+{
+ int base = reg & ~0x3;
+ int shift = (reg & 0x3) * 8;
+
+ clrsetbits_be32(host->ioaddr + base , 0xff << shift, val << shift);
+}
+#endif /* CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER */

extern void sdhci_get_of_property(struct platform_device *pdev);

diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index 1f66aca..18b0bd3 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -24,7 +24,6 @@
#include <mach/gpio.h>
#include <mach/sdhci.h>

-#include "sdhci.h"
#include "sdhci-pltfm.h"

static u32 tegra_sdhci_readl(struct sdhci_host *host, int reg)
--
1.7.4.1

2011-06-03 20:03:19

by Grant Likely

[permalink] [raw]
Subject: Re: [PATCH] mmc: sdhci: change sdhci-pltfm into a module

On Thu, Jun 02, 2011 at 10:57:50AM +0800, Shawn Guo wrote:
> From: Shawn Guo <[email protected]>
>
> There are a couple of problems left from the sdhci pltfm and OF
> consolidation changes.
>
> * When building more than one sdhci-pltfm based drivers in the same
> image, linker will give multiple definition error on the sdhci-pltfm
> helper functions. For example right now, building sdhci-of-esdhc
> and sdhci-of-hlwd together is a valid combination from Kconfig view.
>
> * With the current build method, there is error with building the
> drivers as module, but module installation fails with modprobe.
>
> The patch fixes above problems by changing sdhci-pltfm into a module.
> To avoid EXPORT_SYMBOL on so many big endian IO accessors, it moves
> these accessors into sdhci-pltfm.h as the 'static inline' functions.
> As a result, sdhci.h needs to be included in sdhci-pltfm.h, and in
> turn can be removed from individual drivers which already include
> sdhci-pltfm.h.

Mostly looks good. One comment below about a static inline, but
otherwise you can add my:

Acked-by: Grant Likely <[email protected]>

> +static inline void sdhci_be32bs_writew(struct sdhci_host *host,
> + u16 val, int reg)
> +{
> + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> + int base = reg & ~0x3;
> + int shift = (reg & 0x2) * 8;
> +
> + switch (reg) {
> + case SDHCI_TRANSFER_MODE:
> + /*
> + * Postpone this write, we must do it together with a
> + * command write that is down below.
> + */
> + pltfm_host->xfer_mode_shadow = val;
> + return;
> + case SDHCI_COMMAND:
> + sdhci_be32bs_writel(host,
> + val << 16 | pltfm_host->xfer_mode_shadow,
> + SDHCI_TRANSFER_MODE);
> + return;
> + }
> + clrsetbits_be32(host->ioaddr + base, 0xffff << shift, val << shift);
> +}

This is really too big to be a static inline. Go ahead and make it an
exported symbol. Personally, I wouldn't worry about it and just exporting all
of these accessors. Making them inline doesn't buy much anyway since
they are used to initialize an ops table, and making them inline
forces each driver to instantiate its own copy.

g.

> +
> +static inline void sdhci_be32bs_writeb(struct sdhci_host *host, u8 val, int reg)
> +{
> + int base = reg & ~0x3;
> + int shift = (reg & 0x3) * 8;
> +
> + clrsetbits_be32(host->ioaddr + base , 0xff << shift, val << shift);
> +}
> +#endif /* CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER */
>
> extern void sdhci_get_of_property(struct platform_device *pdev);
>
> diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
> index 1f66aca..18b0bd3 100644
> --- a/drivers/mmc/host/sdhci-tegra.c
> +++ b/drivers/mmc/host/sdhci-tegra.c
> @@ -24,7 +24,6 @@
> #include <mach/gpio.h>
> #include <mach/sdhci.h>
>
> -#include "sdhci.h"
> #include "sdhci-pltfm.h"
>
> static u32 tegra_sdhci_readl(struct sdhci_host *host, int reg)
> --
> 1.7.4.1
>
>

2011-06-04 12:03:28

by Shawn Guo

[permalink] [raw]
Subject: Re: [PATCH] mmc: sdhci: change sdhci-pltfm into a module

Hi Grant,

On Fri, Jun 03, 2011 at 02:03:16PM -0600, Grant Likely wrote:
> On Thu, Jun 02, 2011 at 10:57:50AM +0800, Shawn Guo wrote:
> > From: Shawn Guo <[email protected]>
> >
> > There are a couple of problems left from the sdhci pltfm and OF
> > consolidation changes.
> >
> > * When building more than one sdhci-pltfm based drivers in the same
> > image, linker will give multiple definition error on the sdhci-pltfm
> > helper functions. For example right now, building sdhci-of-esdhc
> > and sdhci-of-hlwd together is a valid combination from Kconfig view.
> >
> > * With the current build method, there is error with building the
> > drivers as module, but module installation fails with modprobe.
> >
> > The patch fixes above problems by changing sdhci-pltfm into a module.
> > To avoid EXPORT_SYMBOL on so many big endian IO accessors, it moves
> > these accessors into sdhci-pltfm.h as the 'static inline' functions.
> > As a result, sdhci.h needs to be included in sdhci-pltfm.h, and in
> > turn can be removed from individual drivers which already include
> > sdhci-pltfm.h.
>
> Mostly looks good. One comment below about a static inline, but
> otherwise you can add my:
>
> Acked-by: Grant Likely <[email protected]>
>
> > +static inline void sdhci_be32bs_writew(struct sdhci_host *host,
> > + u16 val, int reg)
> > +{
> > + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> > + int base = reg & ~0x3;
> > + int shift = (reg & 0x2) * 8;
> > +
> > + switch (reg) {
> > + case SDHCI_TRANSFER_MODE:
> > + /*
> > + * Postpone this write, we must do it together with a
> > + * command write that is down below.
> > + */
> > + pltfm_host->xfer_mode_shadow = val;
> > + return;
> > + case SDHCI_COMMAND:
> > + sdhci_be32bs_writel(host,
> > + val << 16 | pltfm_host->xfer_mode_shadow,
> > + SDHCI_TRANSFER_MODE);
> > + return;
> > + }
> > + clrsetbits_be32(host->ioaddr + base, 0xffff << shift, val << shift);
> > +}
>
> This is really too big to be a static inline. Go ahead and make it an
> exported symbol. Personally, I wouldn't worry about it and just exporting all
> of these accessors. Making them inline doesn't buy much anyway since
> they are used to initialize an ops table, and making them inline
> forces each driver to instantiate its own copy.
>
Thanks for the comment. Since Chris had picked the patch up, I would
not send another update for this, unless Chris asks me to do. I
actually like to see all these accessors implemented in the same way
and in the same place.

--
Regards,
Shawn

2011-06-05 06:56:56

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH] mmc: sdhci: change sdhci-pltfm into a module

On Thu, Jun 02, 2011 at 10:57:50AM +0800, Shawn Guo wrote:
> From: Shawn Guo <[email protected]>
>
> There are a couple of problems left from the sdhci pltfm and OF
> consolidation changes.
>
> * When building more than one sdhci-pltfm based drivers in the same
> image, linker will give multiple definition error on the sdhci-pltfm
> helper functions. For example right now, building sdhci-of-esdhc
> and sdhci-of-hlwd together is a valid combination from Kconfig view.
>
> * With the current build method, there is error with building the
> drivers as module, but module installation fails with modprobe.
>
> The patch fixes above problems by changing sdhci-pltfm into a module.
> To avoid EXPORT_SYMBOL on so many big endian IO accessors, it moves
> these accessors into sdhci-pltfm.h as the 'static inline' functions.
> As a result, sdhci.h needs to be included in sdhci-pltfm.h, and in
> turn can be removed from individual drivers which already include
> sdhci-pltfm.h.
>
> Signed-off-by: Shawn Guo <[email protected]>

I am a bit confused how to review this patch and patch 1/4 from Shawn's
original series. As Chris does rebase his mmc-next anyway, does it make sense
to squash this into the old ones to prevent the broken inbetween state?

Regards,

Wolfram

--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |


Attachments:
(No filename) (1.41 kB)
signature.asc (198.00 B)
Digital signature
Download all attachments