aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/mtdnand.tmpl2
-rw-r--r--Documentation/SubmitChecklist12
-rw-r--r--Documentation/development-process/2.Process29
-rw-r--r--Documentation/development-process/7.AdvancedTopics2
-rw-r--r--Documentation/timers/hpet_example.c2
-rw-r--r--Documentation/vm/map_hugetlb.c2
-rw-r--r--arch/microblaze/include/asm/device.h16
-rw-r--r--arch/microblaze/include/asm/of_device.h3
-rw-r--r--arch/microblaze/kernel/of_device.c13
-rw-r--r--arch/microblaze/kernel/of_platform.c6
-rw-r--r--arch/powerpc/include/asm/device.h16
-rw-r--r--arch/powerpc/include/asm/macio.h2
-rw-r--r--arch/powerpc/include/asm/of_device.h3
-rw-r--r--arch/powerpc/kernel/ibmebus.c6
-rw-r--r--arch/powerpc/kernel/of_device.c13
-rw-r--r--arch/powerpc/kernel/of_platform.c21
-rw-r--r--arch/powerpc/kernel/pci-common.c4
-rw-r--r--arch/powerpc/kernel/vio.c20
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_gpio.c18
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_gpt.c23
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c14
-rw-r--r--arch/powerpc/platforms/82xx/ep8248e.c9
-rw-r--r--arch/powerpc/platforms/83xx/suspend.c9
-rw-r--r--arch/powerpc/platforms/cell/axon_msi.c9
-rw-r--r--arch/powerpc/platforms/cell/iommu.c5
-rw-r--r--arch/powerpc/platforms/pasemi/gpio_mdio.c9
-rw-r--r--arch/powerpc/platforms/pasemi/setup.c4
-rw-r--r--arch/powerpc/platforms/ps3/system-bus.c2
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c2
-rw-r--r--arch/powerpc/sysdev/axonram.c14
-rw-r--r--arch/powerpc/sysdev/bestcomm/bestcomm.c18
-rw-r--r--arch/powerpc/sysdev/fsl_msi.c21
-rw-r--r--arch/powerpc/sysdev/fsl_pmc.c9
-rw-r--r--arch/powerpc/sysdev/fsl_rio.c37
-rw-r--r--arch/powerpc/sysdev/pmi.c9
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe.c7
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c87
-rw-r--r--arch/sh/boards/mach-kfr2r09/setup.c11
-rw-r--r--arch/sh/boards/mach-migor/setup.c9
-rw-r--r--arch/sh/boards/mach-se/7724/setup.c107
-rw-r--r--arch/sh/configs/sh7785lcr_32bit_defconfig273
-rw-r--r--arch/sh/include/asm/dmaengine.h34
-rw-r--r--arch/sh/include/asm/siu.h2
-rw-r--r--arch/sh/include/cpu-sh4/cpu/sh7722.h15
-rw-r--r--arch/sh/include/cpu-sh4/cpu/sh7724.h19
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7786.c1
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7722.c11
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7724.c88
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7780.c3
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7785.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7786.c2
-rw-r--r--arch/sh/kernel/dwarf.c4
-rw-r--r--arch/sh/lib/strlen.S2
-rw-r--r--arch/sparc/include/asm/device.h15
-rw-r--r--arch/sparc/include/asm/fb.h2
-rw-r--r--arch/sparc/include/asm/floppy_64.h4
-rw-r--r--arch/sparc/include/asm/of_device.h1
-rw-r--r--arch/sparc/include/asm/parport.h9
-rw-r--r--arch/sparc/kernel/apc.c7
-rw-r--r--arch/sparc/kernel/auxio_64.c9
-rw-r--r--arch/sparc/kernel/central.c18
-rw-r--r--arch/sparc/kernel/chmc.c17
-rw-r--r--arch/sparc/kernel/ioport.c2
-rw-r--r--arch/sparc/kernel/of_device_32.c17
-rw-r--r--arch/sparc/kernel/of_device_64.c29
-rw-r--r--arch/sparc/kernel/of_device_common.c4
-rw-r--r--arch/sparc/kernel/pci.c14
-rw-r--r--arch/sparc/kernel/pci_common.c9
-rw-r--r--arch/sparc/kernel/pci_fire.c11
-rw-r--r--arch/sparc/kernel/pci_msi.c18
-rw-r--r--arch/sparc/kernel/pci_psycho.c11
-rw-r--r--arch/sparc/kernel/pci_sabre.c11
-rw-r--r--arch/sparc/kernel/pci_schizo.c21
-rw-r--r--arch/sparc/kernel/pci_sun4v.c15
-rw-r--r--arch/sparc/kernel/pmc.c7
-rw-r--r--arch/sparc/kernel/power.c11
-rw-r--r--arch/sparc/kernel/psycho_common.c2
-rw-r--r--arch/sparc/kernel/sbus.c16
-rw-r--r--arch/sparc/kernel/time_32.c9
-rw-r--r--arch/sparc/kernel/time_64.c27
-rw-r--r--drivers/ata/pata_macio.c2
-rw-r--r--drivers/ata/pata_mpc52xx.c14
-rw-r--r--drivers/ata/pata_of_platform.c9
-rw-r--r--drivers/ata/sata_fsl.c11
-rw-r--r--drivers/atm/fore200e.c23
-rw-r--r--drivers/block/swim3.c2
-rw-r--r--drivers/block/xsysace.c13
-rw-r--r--drivers/cdrom/viocd.c2
-rw-r--r--drivers/char/hw_random/n2-drv.c9
-rw-r--r--drivers/char/hw_random/pasemi-rng.c9
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c11
-rw-r--r--drivers/char/viotape.c2
-rw-r--r--drivers/char/xilinx_hwicap/xilinx_hwicap.c11
-rw-r--r--drivers/crypto/amcc/crypto4xx_core.c7
-rw-r--r--drivers/crypto/talitos.c9
-rw-r--r--drivers/dma/fsldma.c17
-rw-r--r--drivers/dma/ppc4xx/adma.c2
-rw-r--r--drivers/dma/shdma.c5
-rw-r--r--drivers/edac/mpc85xx_edac.c30
-rw-r--r--drivers/edac/ppc4xx_edac.c10
-rw-r--r--drivers/gpio/pca953x.c2
-rw-r--r--drivers/hwmon/ultra45_env.c7
-rw-r--r--drivers/i2c/busses/i2c-cpm.c30
-rw-r--r--drivers/i2c/busses/i2c-ibm_iic.c11
-rw-r--r--drivers/i2c/busses/i2c-mpc.c25
-rw-r--r--drivers/i2c/i2c-core.c3
-rw-r--r--drivers/ide/pmac.c10
-rw-r--r--drivers/infiniband/hw/ehca/ehca_main.c18
-rw-r--r--drivers/input/misc/sparcspkr.c14
-rw-r--r--drivers/input/serio/i8042-sparcio.h9
-rw-r--r--drivers/input/serio/xilinx_ps2.c15
-rw-r--r--drivers/leds/leds-gpio.c4
-rw-r--r--drivers/macintosh/macio_asic.c28
-rw-r--r--drivers/macintosh/macio_sysfs.c6
-rw-r--r--drivers/macintosh/mediabay.c2
-rw-r--r--drivers/macintosh/rack-meter.c4
-rw-r--r--drivers/macintosh/smu.c7
-rw-r--r--drivers/macintosh/therm_pm72.c9
-rw-r--r--drivers/macintosh/therm_windtunnel.c7
-rw-r--r--drivers/message/fusion/mptscsih.c6
-rw-r--r--drivers/mfd/Kconfig6
-rw-r--r--drivers/mfd/sh_mobile_sdhi.c28
-rw-r--r--drivers/mmc/host/of_mmc_spi.c4
-rw-r--r--drivers/mmc/host/sdhci-of-core.c9
-rw-r--r--drivers/mmc/host/tmio_mmc.c367
-rw-r--r--drivers/mmc/host/tmio_mmc.h13
-rw-r--r--drivers/mtd/maps/physmap_of.c13
-rw-r--r--drivers/mtd/maps/sun_uflash.c9
-rw-r--r--drivers/mtd/nand/fsl_elbc_nand.c11
-rw-r--r--drivers/mtd/nand/fsl_upm.c7
-rw-r--r--drivers/mtd/nand/ndfc.c15
-rw-r--r--drivers/mtd/nand/pasemi_nand.c9
-rw-r--r--drivers/mtd/nand/socrates_nand.c7
-rw-r--r--drivers/net/can/mscan/mpc5xxx_can.c8
-rw-r--r--drivers/net/can/sja1000/sja1000_of_platform.c12
-rw-r--r--drivers/net/ehea/ehea_main.c21
-rw-r--r--drivers/net/fec_mpc52xx.c20
-rw-r--r--drivers/net/fec_mpc52xx_phy.c11
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c15
-rw-r--r--drivers/net/fs_enet/mac-fcc.c8
-rw-r--r--drivers/net/fs_enet/mac-fec.c4
-rw-r--r--drivers/net/fs_enet/mac-scc.c6
-rw-r--r--drivers/net/fs_enet/mii-bitbang.c7
-rw-r--r--drivers/net/fs_enet/mii-fec.c13
-rw-r--r--drivers/net/fsl_pq_mdio.c9
-rw-r--r--drivers/net/gianfar.c16
-rw-r--r--drivers/net/greth.c3
-rw-r--r--drivers/net/ibm_newemac/core.c21
-rw-r--r--drivers/net/ibm_newemac/debug.c9
-rw-r--r--drivers/net/ibm_newemac/debug.h4
-rw-r--r--drivers/net/ibm_newemac/mal.c36
-rw-r--r--drivers/net/ibm_newemac/rgmii.c20
-rw-r--r--drivers/net/ibm_newemac/tah.c15
-rw-r--r--drivers/net/ibm_newemac/zmii.c17
-rw-r--r--drivers/net/ll_temac_main.c12
-rw-r--r--drivers/net/myri_sbus.c9
-rw-r--r--drivers/net/niu.c17
-rw-r--r--drivers/net/phy/mdio-gpio.c13
-rw-r--r--drivers/net/sunbmac.c13
-rw-r--r--drivers/net/sunhme.c15
-rw-r--r--drivers/net/sunlance.c13
-rw-r--r--drivers/net/sunqe.c13
-rw-r--r--drivers/net/ucc_geth.c9
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c28
-rw-r--r--drivers/net/xilinx_emaclite.c17
-rw-r--r--drivers/of/device.c25
-rw-r--r--drivers/of/fdt.c15
-rw-r--r--drivers/of/of_i2c.c4
-rw-r--r--drivers/of/of_mdio.c6
-rw-r--r--drivers/of/of_spi.c2
-rw-r--r--drivers/of/platform.c13
-rw-r--r--drivers/parport/parport_sunbpp.c7
-rw-r--r--drivers/pcmcia/electra_cf.c9
-rw-r--r--drivers/pcmcia/m8xx_pcmcia.c7
-rw-r--r--drivers/sbus/char/bbc_envctrl.c4
-rw-r--r--drivers/sbus/char/bbc_i2c.c11
-rw-r--r--drivers/sbus/char/display7seg.c9
-rw-r--r--drivers/sbus/char/envctrl.c9
-rw-r--r--drivers/sbus/char/flash.c11
-rw-r--r--drivers/sbus/char/uctrl.c9
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c2
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c2
-rw-r--r--drivers/scsi/qlogicpti.c17
-rw-r--r--drivers/scsi/scsi_scan.c26
-rw-r--r--drivers/scsi/sun_esp.c23
-rw-r--r--drivers/serial/apbuart.c10
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_core.c9
-rw-r--r--drivers/serial/mpc52xx_uart.c15
-rw-r--r--drivers/serial/nwpserial.c2
-rw-r--r--drivers/serial/of_serial.c12
-rw-r--r--drivers/serial/pmac_zilog.c2
-rw-r--r--drivers/serial/sh-sci.c5
-rw-r--r--drivers/serial/sunhv.c9
-rw-r--r--drivers/serial/sunsab.c13
-rw-r--r--drivers/serial/sunsu.c13
-rw-r--r--drivers/serial/sunzilog.c15
-rw-r--r--drivers/serial/uartlite.c11
-rw-r--r--drivers/serial/ucc_uart.c10
-rw-r--r--drivers/spi/mpc52xx_psc_spi.c15
-rw-r--r--drivers/spi/mpc52xx_spi.c22
-rw-r--r--drivers/spi/spi_mpc8xxx.c15
-rw-r--r--drivers/spi/spi_ppc4xx.c2
-rw-r--r--drivers/spi/xilinx_spi_of.c2
-rw-r--r--drivers/usb/gadget/fsl_qe_udc.c7
-rw-r--r--drivers/usb/host/ehci-ppc-of.c11
-rw-r--r--drivers/usb/host/ehci-xilinx-of.c9
-rw-r--r--drivers/usb/host/fhci-hcd.c11
-rw-r--r--drivers/usb/host/isp1760-if.c9
-rw-r--r--drivers/usb/host/ohci-ppc-of.c15
-rw-r--r--drivers/video/bw2.c7
-rw-r--r--drivers/video/cg14.c7
-rw-r--r--drivers/video/cg3.c7
-rw-r--r--drivers/video/cg6.c9
-rw-r--r--drivers/video/ffb.c9
-rw-r--r--drivers/video/fsl-diu-fb.c10
-rw-r--r--drivers/video/leo.c7
-rw-r--r--drivers/video/mb862xx/mb862xxfb.c8
-rw-r--r--drivers/video/p9100.c7
-rw-r--r--drivers/video/platinumfb.c9
-rw-r--r--drivers/video/sunxvr1000.c9
-rw-r--r--drivers/video/tcx.c7
-rw-r--r--drivers/video/xilinxfb.c23
-rw-r--r--drivers/watchdog/cpwd.c9
-rw-r--r--drivers/watchdog/gef_wdt.c8
-rw-r--r--drivers/watchdog/mpc8xxx_wdt.c8
-rw-r--r--drivers/watchdog/riowd.c7
-rw-r--r--fs/9p/v9fs_vfs.h2
-rw-r--r--fs/9p/vfs_dir.c8
-rw-r--r--fs/9p/vfs_file.c11
-rw-r--r--fs/9p/vfs_inode.c107
-rw-r--r--fs/9p/vfs_super.c55
-rw-r--r--fs/ceph/addr.c11
-rw-r--r--fs/ceph/auth.c9
-rw-r--r--fs/ceph/auth.h2
-rw-r--r--fs/ceph/auth_none.c1
-rw-r--r--fs/ceph/auth_x.c19
-rw-r--r--fs/ceph/caps.c24
-rw-r--r--fs/ceph/ceph_fs.h62
-rw-r--r--fs/ceph/ceph_strings.c16
-rw-r--r--fs/ceph/debugfs.c13
-rw-r--r--fs/ceph/dir.c45
-rw-r--r--fs/ceph/export.c14
-rw-r--r--fs/ceph/file.c16
-rw-r--r--fs/ceph/inode.c97
-rw-r--r--fs/ceph/ioctl.c2
-rw-r--r--fs/ceph/mds_client.c385
-rw-r--r--fs/ceph/mds_client.h6
-rw-r--r--fs/ceph/messenger.c91
-rw-r--r--fs/ceph/messenger.h10
-rw-r--r--fs/ceph/mon_client.c257
-rw-r--r--fs/ceph/mon_client.h27
-rw-r--r--fs/ceph/msgpool.c180
-rw-r--r--fs/ceph/msgpool.h12
-rw-r--r--fs/ceph/msgr.h21
-rw-r--r--fs/ceph/osd_client.c98
-rw-r--r--fs/ceph/pagelist.c2
-rw-r--r--fs/ceph/rados.h23
-rw-r--r--fs/ceph/snap.c2
-rw-r--r--fs/ceph/super.c125
-rw-r--r--fs/ceph/super.h30
-rw-r--r--fs/ceph/xattr.c35
-rw-r--r--fs/exofs/dir.c2
-rw-r--r--fs/exofs/inode.c30
-rw-r--r--fs/fat/dir.c28
-rw-r--r--fs/fat/fat.h4
-rw-r--r--fs/fat/file.c19
-rw-r--r--fs/fat/inode.c6
-rw-r--r--include/linux/crypto.h6
-rw-r--r--include/linux/device.h8
-rw-r--r--include/linux/i2c.h4
-rw-r--r--include/linux/mfd/sh_mobile_sdhi.h6
-rw-r--r--include/linux/mfd/tmio.h11
-rw-r--r--include/linux/of_device.h4
-rw-r--r--include/linux/of_fdt.h4
-rw-r--r--include/linux/of_platform.h6
-rw-r--r--include/linux/slab_def.h24
-rw-r--r--include/linux/slob_def.h8
-rw-r--r--include/linux/slub_def.h8
-rw-r--r--include/net/9p/9p.h33
-rw-r--r--include/net/9p/client.h2
-rw-r--r--include/net/mac80211.h1
-rw-r--r--mm/slab.c198
-rw-r--r--mm/slob.c8
-rw-r--r--mm/slub.c46
-rw-r--r--net/9p/client.c70
-rw-r--r--net/9p/protocol.c6
-rw-r--r--net/mac80211/key.c1
-rw-r--r--sound/aoa/fabrics/layout.c2
-rw-r--r--sound/aoa/soundbus/core.c8
-rw-r--r--sound/aoa/soundbus/i2sbus/control.c2
-rw-r--r--sound/aoa/soundbus/i2sbus/core.c8
-rw-r--r--sound/aoa/soundbus/sysfs.c4
-rw-r--r--sound/soc/fsl/mpc5200_dma.c6
-rw-r--r--sound/soc/fsl/mpc5200_psc_ac97.c2
-rw-r--r--sound/soc/fsl/mpc5200_psc_i2s.c4
-rw-r--r--sound/soc/fsl/mpc8610_hpcd.c10
-rw-r--r--sound/soc/sh/siu.h3
-rw-r--r--sound/soc/sh/siu_pcm.c9
-rw-r--r--sound/sparc/amd7930.c7
-rw-r--r--sound/sparc/cs4231.c13
-rw-r--r--sound/sparc/dbri.c9
301 files changed, 3619 insertions, 2159 deletions
diff --git a/Documentation/DocBook/mtdnand.tmpl b/Documentation/DocBook/mtdnand.tmpl
index 133cd6c3f3c1..020ac80d4682 100644
--- a/Documentation/DocBook/mtdnand.tmpl
+++ b/Documentation/DocBook/mtdnand.tmpl
@@ -269,7 +269,7 @@ static void board_hwcontrol(struct mtd_info *mtd, int cmd)
269 information about the device. 269 information about the device.
270 </para> 270 </para>
271 <programlisting> 271 <programlisting>
272int __init board_init (void) 272static int __init board_init (void)
273{ 273{
274 struct nand_chip *this; 274 struct nand_chip *this;
275 int err = 0; 275 int err = 0;
diff --git a/Documentation/SubmitChecklist b/Documentation/SubmitChecklist
index 8916ca48bc95..da0382daa395 100644
--- a/Documentation/SubmitChecklist
+++ b/Documentation/SubmitChecklist
@@ -18,6 +18,8 @@ kernel patches.
18 18
192b: Passes allnoconfig, allmodconfig 192b: Passes allnoconfig, allmodconfig
20 20
212c: Builds successfully when using O=builddir
22
213: Builds on multiple CPU architectures by using local cross-compile tools 233: Builds on multiple CPU architectures by using local cross-compile tools
22 or some other build farm. 24 or some other build farm.
23 25
@@ -95,3 +97,13 @@ kernel patches.
95 97
9625: If any ioctl's are added by the patch, then also update 9825: If any ioctl's are added by the patch, then also update
97 Documentation/ioctl/ioctl-number.txt. 99 Documentation/ioctl/ioctl-number.txt.
100
10126: If your modified source code depends on or uses any of the kernel
102 APIs or features that are related to the following kconfig symbols,
103 then test multiple builds with the related kconfig symbols disabled
104 and/or =m (if that option is available) [not all of these at the
105 same time, just various/random combinations of them]:
106
107 CONFIG_SMP, CONFIG_SYSFS, CONFIG_PROC_FS, CONFIG_INPUT, CONFIG_PCI,
108 CONFIG_BLOCK, CONFIG_PM, CONFIG_HOTPLUG, CONFIG_MAGIC_SYSRQ,
109 CONFIG_NET, CONFIG_INET=n (but latter with CONFIG_NET=y)
diff --git a/Documentation/development-process/2.Process b/Documentation/development-process/2.Process
index d750321acd5a..97726eba6102 100644
--- a/Documentation/development-process/2.Process
+++ b/Documentation/development-process/2.Process
@@ -151,7 +151,7 @@ The stages that a patch goes through are, generally:
151 well. 151 well.
152 152
153 - Wider review. When the patch is getting close to ready for mainline 153 - Wider review. When the patch is getting close to ready for mainline
154 inclusion, it will be accepted by a relevant subsystem maintainer - 154 inclusion, it should be accepted by a relevant subsystem maintainer -
155 though this acceptance is not a guarantee that the patch will make it 155 though this acceptance is not a guarantee that the patch will make it
156 all the way to the mainline. The patch will show up in the maintainer's 156 all the way to the mainline. The patch will show up in the maintainer's
157 subsystem tree and into the staging trees (described below). When the 157 subsystem tree and into the staging trees (described below). When the
@@ -159,6 +159,15 @@ The stages that a patch goes through are, generally:
159 the discovery of any problems resulting from the integration of this 159 the discovery of any problems resulting from the integration of this
160 patch with work being done by others. 160 patch with work being done by others.
161 161
162- Please note that most maintainers also have day jobs, so merging
163 your patch may not be their highest priority. If your patch is
164 getting feedback about changes that are needed, you should either
165 make those changes or justify why they should not be made. If your
166 patch has no review complaints but is not being merged by its
167 appropriate subsystem or driver maintainer, you should be persistent
168 in updating the patch to the current kernel so that it applies cleanly
169 and keep sending it for review and merging.
170
162 - Merging into the mainline. Eventually, a successful patch will be 171 - Merging into the mainline. Eventually, a successful patch will be
163 merged into the mainline repository managed by Linus Torvalds. More 172 merged into the mainline repository managed by Linus Torvalds. More
164 comments and/or problems may surface at this time; it is important that 173 comments and/or problems may surface at this time; it is important that
@@ -258,12 +267,8 @@ an appropriate subsystem tree or be sent directly to Linus. In a typical
258development cycle, approximately 10% of the patches going into the mainline 267development cycle, approximately 10% of the patches going into the mainline
259get there via -mm. 268get there via -mm.
260 269
261The current -mm patch can always be found from the front page of 270The current -mm patch is available in the "mmotm" (-mm of the moment)
262 271directory at:
263 http://kernel.org/
264
265Those who want to see the current state of -mm can get the "-mm of the
266moment" tree, found at:
267 272
268 http://userweb.kernel.org/~akpm/mmotm/ 273 http://userweb.kernel.org/~akpm/mmotm/
269 274
@@ -298,6 +303,12 @@ volatility of linux-next tends to make it a difficult development target.
298See http://lwn.net/Articles/289013/ for more information on this topic, and 303See http://lwn.net/Articles/289013/ for more information on this topic, and
299stay tuned; much is still in flux where linux-next is involved. 304stay tuned; much is still in flux where linux-next is involved.
300 305
306Besides the mmotm and linux-next trees, the kernel source tree now contains
307the drivers/staging/ directory and many sub-directories for drivers or
308filesystems that are on their way to being added to the kernel tree
309proper, but they remain in drivers/staging/ while they still need more
310work.
311
301 312
3022.5: TOOLS 3132.5: TOOLS
303 314
@@ -319,9 +330,9 @@ developers; even if they do not use it for their own work, they'll need git
319to keep up with what other developers (and the mainline) are doing. 330to keep up with what other developers (and the mainline) are doing.
320 331
321Git is now packaged by almost all Linux distributions. There is a home 332Git is now packaged by almost all Linux distributions. There is a home
322page at 333page at:
323 334
324 http://git.or.cz/ 335 http://git-scm.com/
325 336
326That page has pointers to documentation and tutorials. One should be 337That page has pointers to documentation and tutorials. One should be
327aware, in particular, of the Kernel Hacker's Guide to git, which has 338aware, in particular, of the Kernel Hacker's Guide to git, which has
diff --git a/Documentation/development-process/7.AdvancedTopics b/Documentation/development-process/7.AdvancedTopics
index a2cf74093aa1..837179447e17 100644
--- a/Documentation/development-process/7.AdvancedTopics
+++ b/Documentation/development-process/7.AdvancedTopics
@@ -25,7 +25,7 @@ long document in its own right. Instead, the focus here will be on how git
25fits into the kernel development process in particular. Developers who 25fits into the kernel development process in particular. Developers who
26wish to come up to speed with git will find more information at: 26wish to come up to speed with git will find more information at:
27 27
28 http://git.or.cz/ 28 http://git-scm.com/
29 29
30 http://www.kernel.org/pub/software/scm/git/docs/user-manual.html 30 http://www.kernel.org/pub/software/scm/git/docs/user-manual.html
31 31
diff --git a/Documentation/timers/hpet_example.c b/Documentation/timers/hpet_example.c
index f9ce2d9fdfd5..4bfafb7bc4c5 100644
--- a/Documentation/timers/hpet_example.c
+++ b/Documentation/timers/hpet_example.c
@@ -10,7 +10,6 @@
10#include <sys/types.h> 10#include <sys/types.h>
11#include <sys/wait.h> 11#include <sys/wait.h>
12#include <signal.h> 12#include <signal.h>
13#include <fcntl.h>
14#include <errno.h> 13#include <errno.h>
15#include <sys/time.h> 14#include <sys/time.h>
16#include <linux/hpet.h> 15#include <linux/hpet.h>
@@ -24,7 +23,6 @@ extern void hpet_read(int, const char **);
24 23
25#include <sys/poll.h> 24#include <sys/poll.h>
26#include <sys/ioctl.h> 25#include <sys/ioctl.h>
27#include <signal.h>
28 26
29struct hpet_command { 27struct hpet_command {
30 char *command; 28 char *command;
diff --git a/Documentation/vm/map_hugetlb.c b/Documentation/vm/map_hugetlb.c
index 9969c7d9f985..eda1a6d3578a 100644
--- a/Documentation/vm/map_hugetlb.c
+++ b/Documentation/vm/map_hugetlb.c
@@ -19,7 +19,7 @@
19#define PROTECTION (PROT_READ | PROT_WRITE) 19#define PROTECTION (PROT_READ | PROT_WRITE)
20 20
21#ifndef MAP_HUGETLB 21#ifndef MAP_HUGETLB
22#define MAP_HUGETLB 0x40 22#define MAP_HUGETLB 0x40000 /* arch specific */
23#endif 23#endif
24 24
25/* Only ia64 requires this */ 25/* Only ia64 requires this */
diff --git a/arch/microblaze/include/asm/device.h b/arch/microblaze/include/asm/device.h
index 402b46e630f6..123b2fe72d01 100644
--- a/arch/microblaze/include/asm/device.h
+++ b/arch/microblaze/include/asm/device.h
@@ -12,29 +12,15 @@
12struct device_node; 12struct device_node;
13 13
14struct dev_archdata { 14struct dev_archdata {
15 /* Optional pointer to an OF device node */
16 struct device_node *of_node;
17
18 /* DMA operations on that device */ 15 /* DMA operations on that device */
19 struct dma_map_ops *dma_ops; 16 struct dma_map_ops *dma_ops;
20 void *dma_data; 17 void *dma_data;
21}; 18};
22 19
23struct pdev_archdata { 20struct pdev_archdata {
21 u64 dma_mask;
24}; 22};
25 23
26static inline void dev_archdata_set_node(struct dev_archdata *ad,
27 struct device_node *np)
28{
29 ad->of_node = np;
30}
31
32static inline struct device_node *
33dev_archdata_get_node(const struct dev_archdata *ad)
34{
35 return ad->of_node;
36}
37
38#endif /* _ASM_MICROBLAZE_DEVICE_H */ 24#endif /* _ASM_MICROBLAZE_DEVICE_H */
39 25
40 26
diff --git a/arch/microblaze/include/asm/of_device.h b/arch/microblaze/include/asm/of_device.h
index ba917cfaefe6..73cb98040982 100644
--- a/arch/microblaze/include/asm/of_device.h
+++ b/arch/microblaze/include/asm/of_device.h
@@ -21,9 +21,8 @@
21 * probed using OF properties. 21 * probed using OF properties.
22 */ 22 */
23struct of_device { 23struct of_device {
24 struct device_node *node; /* to be obsoleted */
25 u64 dma_mask; /* DMA mask */
26 struct device dev; /* Generic device interface */ 24 struct device dev; /* Generic device interface */
25 struct pdev_archdata archdata;
27}; 26};
28 27
29extern ssize_t of_device_get_modalias(struct of_device *ofdev, 28extern ssize_t of_device_get_modalias(struct of_device *ofdev,
diff --git a/arch/microblaze/kernel/of_device.c b/arch/microblaze/kernel/of_device.c
index 9a0f7632c47c..b372787886ed 100644
--- a/arch/microblaze/kernel/of_device.c
+++ b/arch/microblaze/kernel/of_device.c
@@ -12,7 +12,7 @@
12void of_device_make_bus_id(struct of_device *dev) 12void of_device_make_bus_id(struct of_device *dev)
13{ 13{
14 static atomic_t bus_no_reg_magic; 14 static atomic_t bus_no_reg_magic;
15 struct device_node *node = dev->node; 15 struct device_node *node = dev->dev.of_node;
16 const u32 *reg; 16 const u32 *reg;
17 u64 addr; 17 u64 addr;
18 int magic; 18 int magic;
@@ -49,11 +49,10 @@ struct of_device *of_device_alloc(struct device_node *np,
49 if (!dev) 49 if (!dev)
50 return NULL; 50 return NULL;
51 51
52 dev->node = of_node_get(np); 52 dev->dev.of_node = of_node_get(np);
53 dev->dev.dma_mask = &dev->dma_mask; 53 dev->dev.dma_mask = &dev->archdata.dma_mask;
54 dev->dev.parent = parent; 54 dev->dev.parent = parent;
55 dev->dev.release = of_release_dev; 55 dev->dev.release = of_release_dev;
56 dev->dev.archdata.of_node = np;
57 56
58 if (bus_id) 57 if (bus_id)
59 dev_set_name(&dev->dev, bus_id); 58 dev_set_name(&dev->dev, bus_id);
@@ -75,17 +74,17 @@ int of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
75 74
76 ofdev = to_of_device(dev); 75 ofdev = to_of_device(dev);
77 76
78 if (add_uevent_var(env, "OF_NAME=%s", ofdev->node->name)) 77 if (add_uevent_var(env, "OF_NAME=%s", ofdev->dev.of_node->name))
79 return -ENOMEM; 78 return -ENOMEM;
80 79
81 if (add_uevent_var(env, "OF_TYPE=%s", ofdev->node->type)) 80 if (add_uevent_var(env, "OF_TYPE=%s", ofdev->dev.of_node->type))
82 return -ENOMEM; 81 return -ENOMEM;
83 82
84 /* Since the compatible field can contain pretty much anything 83 /* Since the compatible field can contain pretty much anything
85 * it's not really legal to split it out with commas. We split it 84 * it's not really legal to split it out with commas. We split it
86 * up using a number of environment variables instead. */ 85 * up using a number of environment variables instead. */
87 86
88 compat = of_get_property(ofdev->node, "compatible", &cplen); 87 compat = of_get_property(ofdev->dev.of_node, "compatible", &cplen);
89 while (compat && *compat && cplen > 0) { 88 while (compat && *compat && cplen > 0) {
90 if (add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat)) 89 if (add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat))
91 return -ENOMEM; 90 return -ENOMEM;
diff --git a/arch/microblaze/kernel/of_platform.c b/arch/microblaze/kernel/of_platform.c
index 0dc755286d38..ccf6f4257f4b 100644
--- a/arch/microblaze/kernel/of_platform.c
+++ b/arch/microblaze/kernel/of_platform.c
@@ -47,7 +47,7 @@ struct of_device *of_platform_device_create(struct device_node *np,
47 if (!dev) 47 if (!dev)
48 return NULL; 48 return NULL;
49 49
50 dev->dma_mask = 0xffffffffUL; 50 dev->archdata.dma_mask = 0xffffffffUL;
51 dev->dev.bus = &of_platform_bus_type; 51 dev->dev.bus = &of_platform_bus_type;
52 52
53 /* We do not fill the DMA ops for platform devices by default. 53 /* We do not fill the DMA ops for platform devices by default.
@@ -166,7 +166,7 @@ EXPORT_SYMBOL(of_platform_bus_probe);
166 166
167static int of_dev_node_match(struct device *dev, void *data) 167static int of_dev_node_match(struct device *dev, void *data)
168{ 168{
169 return to_of_device(dev)->node == data; 169 return to_of_device(dev)->dev.of_node == data;
170} 170}
171 171
172struct of_device *of_find_device_by_node(struct device_node *np) 172struct of_device *of_find_device_by_node(struct device_node *np)
@@ -184,7 +184,7 @@ EXPORT_SYMBOL(of_find_device_by_node);
184static int of_dev_phandle_match(struct device *dev, void *data) 184static int of_dev_phandle_match(struct device *dev, void *data)
185{ 185{
186 phandle *ph = data; 186 phandle *ph = data;
187 return to_of_device(dev)->node->phandle == *ph; 187 return to_of_device(dev)->dev.of_node->phandle == *ph;
188} 188}
189 189
190struct of_device *of_find_device_by_phandle(phandle ph) 190struct of_device *of_find_device_by_phandle(phandle ph)
diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/include/asm/device.h
index 6d94d27ed850..a3954e4fcbe2 100644
--- a/arch/powerpc/include/asm/device.h
+++ b/arch/powerpc/include/asm/device.h
@@ -10,9 +10,6 @@ struct dma_map_ops;
10struct device_node; 10struct device_node;
11 11
12struct dev_archdata { 12struct dev_archdata {
13 /* Optional pointer to an OF device node */
14 struct device_node *of_node;
15
16 /* DMA operations on that device */ 13 /* DMA operations on that device */
17 struct dma_map_ops *dma_ops; 14 struct dma_map_ops *dma_ops;
18 15
@@ -30,19 +27,8 @@ struct dev_archdata {
30#endif 27#endif
31}; 28};
32 29
33static inline void dev_archdata_set_node(struct dev_archdata *ad,
34 struct device_node *np)
35{
36 ad->of_node = np;
37}
38
39static inline struct device_node *
40dev_archdata_get_node(const struct dev_archdata *ad)
41{
42 return ad->of_node;
43}
44
45struct pdev_archdata { 30struct pdev_archdata {
31 u64 dma_mask;
46}; 32};
47 33
48#endif /* _ASM_POWERPC_DEVICE_H */ 34#endif /* _ASM_POWERPC_DEVICE_H */
diff --git a/arch/powerpc/include/asm/macio.h b/arch/powerpc/include/asm/macio.h
index a062c57696d0..19a661b4cb98 100644
--- a/arch/powerpc/include/asm/macio.h
+++ b/arch/powerpc/include/asm/macio.h
@@ -108,7 +108,7 @@ static inline void* macio_get_drvdata(struct macio_dev *dev)
108 108
109static inline struct device_node *macio_get_of_node(struct macio_dev *mdev) 109static inline struct device_node *macio_get_of_node(struct macio_dev *mdev)
110{ 110{
111 return mdev->ofdev.node; 111 return mdev->ofdev.dev.of_node;
112} 112}
113 113
114#ifdef CONFIG_PCI 114#ifdef CONFIG_PCI
diff --git a/arch/powerpc/include/asm/of_device.h b/arch/powerpc/include/asm/of_device.h
index a64debf177dc..444e97e2982e 100644
--- a/arch/powerpc/include/asm/of_device.h
+++ b/arch/powerpc/include/asm/of_device.h
@@ -12,9 +12,8 @@
12 */ 12 */
13struct of_device 13struct of_device
14{ 14{
15 struct device_node *node; /* to be obsoleted */
16 u64 dma_mask; /* DMA mask */
17 struct device dev; /* Generic device interface */ 15 struct device dev; /* Generic device interface */
16 struct pdev_archdata archdata;
18}; 17};
19 18
20extern struct of_device *of_device_alloc(struct device_node *np, 19extern struct of_device *of_device_alloc(struct device_node *np,
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 71cf280da184..21266abfbda6 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -140,14 +140,14 @@ static struct dma_map_ops ibmebus_dma_ops = {
140 140
141static int ibmebus_match_path(struct device *dev, void *data) 141static int ibmebus_match_path(struct device *dev, void *data)
142{ 142{
143 struct device_node *dn = to_of_device(dev)->node; 143 struct device_node *dn = to_of_device(dev)->dev.of_node;
144 return (dn->full_name && 144 return (dn->full_name &&
145 (strcasecmp((char *)data, dn->full_name) == 0)); 145 (strcasecmp((char *)data, dn->full_name) == 0));
146} 146}
147 147
148static int ibmebus_match_node(struct device *dev, void *data) 148static int ibmebus_match_node(struct device *dev, void *data)
149{ 149{
150 return to_of_device(dev)->node == data; 150 return to_of_device(dev)->dev.of_node == data;
151} 151}
152 152
153static int ibmebus_create_device(struct device_node *dn) 153static int ibmebus_create_device(struct device_node *dn)
@@ -202,7 +202,7 @@ static int ibmebus_create_devices(const struct of_device_id *matches)
202int ibmebus_register_driver(struct of_platform_driver *drv) 202int ibmebus_register_driver(struct of_platform_driver *drv)
203{ 203{
204 /* If the driver uses devices that ibmebus doesn't know, add them */ 204 /* If the driver uses devices that ibmebus doesn't know, add them */
205 ibmebus_create_devices(drv->match_table); 205 ibmebus_create_devices(drv->driver.of_match_table);
206 206
207 return of_register_driver(drv, &ibmebus_bus_type); 207 return of_register_driver(drv, &ibmebus_bus_type);
208} 208}
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index a359cb08e900..df78e0236a02 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -13,7 +13,7 @@
13static void of_device_make_bus_id(struct of_device *dev) 13static void of_device_make_bus_id(struct of_device *dev)
14{ 14{
15 static atomic_t bus_no_reg_magic; 15 static atomic_t bus_no_reg_magic;
16 struct device_node *node = dev->node; 16 struct device_node *node = dev->dev.of_node;
17 const u32 *reg; 17 const u32 *reg;
18 u64 addr; 18 u64 addr;
19 int magic; 19 int magic;
@@ -69,11 +69,10 @@ struct of_device *of_device_alloc(struct device_node *np,
69 if (!dev) 69 if (!dev)
70 return NULL; 70 return NULL;
71 71
72 dev->node = of_node_get(np); 72 dev->dev.of_node = of_node_get(np);
73 dev->dev.dma_mask = &dev->dma_mask; 73 dev->dev.dma_mask = &dev->archdata.dma_mask;
74 dev->dev.parent = parent; 74 dev->dev.parent = parent;
75 dev->dev.release = of_release_dev; 75 dev->dev.release = of_release_dev;
76 dev->dev.archdata.of_node = np;
77 76
78 if (bus_id) 77 if (bus_id)
79 dev_set_name(&dev->dev, "%s", bus_id); 78 dev_set_name(&dev->dev, "%s", bus_id);
@@ -95,17 +94,17 @@ int of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
95 94
96 ofdev = to_of_device(dev); 95 ofdev = to_of_device(dev);
97 96
98 if (add_uevent_var(env, "OF_NAME=%s", ofdev->node->name)) 97 if (add_uevent_var(env, "OF_NAME=%s", ofdev->dev.of_node->name))
99 return -ENOMEM; 98 return -ENOMEM;
100 99
101 if (add_uevent_var(env, "OF_TYPE=%s", ofdev->node->type)) 100 if (add_uevent_var(env, "OF_TYPE=%s", ofdev->dev.of_node->type))
102 return -ENOMEM; 101 return -ENOMEM;
103 102
104 /* Since the compatible field can contain pretty much anything 103 /* Since the compatible field can contain pretty much anything
105 * it's not really legal to split it out with commas. We split it 104 * it's not really legal to split it out with commas. We split it
106 * up using a number of environment variables instead. */ 105 * up using a number of environment variables instead. */
107 106
108 compat = of_get_property(ofdev->node, "compatible", &cplen); 107 compat = of_get_property(ofdev->dev.of_node, "compatible", &cplen);
109 while (compat && *compat && cplen > 0) { 108 while (compat && *compat && cplen > 0) {
110 if (add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat)) 109 if (add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat))
111 return -ENOMEM; 110 return -ENOMEM;
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index 6c1dfc3ff8bc..487a98851ba6 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -74,7 +74,7 @@ struct of_device* of_platform_device_create(struct device_node *np,
74 if (!dev) 74 if (!dev)
75 return NULL; 75 return NULL;
76 76
77 dev->dma_mask = 0xffffffffUL; 77 dev->archdata.dma_mask = 0xffffffffUL;
78 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 78 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
79 79
80 dev->dev.bus = &of_platform_bus_type; 80 dev->dev.bus = &of_platform_bus_type;
@@ -195,7 +195,7 @@ EXPORT_SYMBOL(of_platform_bus_probe);
195 195
196static int of_dev_node_match(struct device *dev, void *data) 196static int of_dev_node_match(struct device *dev, void *data)
197{ 197{
198 return to_of_device(dev)->node == data; 198 return to_of_device(dev)->dev.of_node == data;
199} 199}
200 200
201struct of_device *of_find_device_by_node(struct device_node *np) 201struct of_device *of_find_device_by_node(struct device_node *np)
@@ -213,7 +213,7 @@ EXPORT_SYMBOL(of_find_device_by_node);
213static int of_dev_phandle_match(struct device *dev, void *data) 213static int of_dev_phandle_match(struct device *dev, void *data)
214{ 214{
215 phandle *ph = data; 215 phandle *ph = data;
216 return to_of_device(dev)->node->phandle == *ph; 216 return to_of_device(dev)->dev.of_node->phandle == *ph;
217} 217}
218 218
219struct of_device *of_find_device_by_phandle(phandle ph) 219struct of_device *of_find_device_by_phandle(phandle ph)
@@ -246,10 +246,10 @@ static int __devinit of_pci_phb_probe(struct of_device *dev,
246 if (ppc_md.pci_setup_phb == NULL) 246 if (ppc_md.pci_setup_phb == NULL)
247 return -ENODEV; 247 return -ENODEV;
248 248
249 printk(KERN_INFO "Setting up PCI bus %s\n", dev->node->full_name); 249 pr_info("Setting up PCI bus %s\n", dev->dev.of_node->full_name);
250 250
251 /* Alloc and setup PHB data structure */ 251 /* Alloc and setup PHB data structure */
252 phb = pcibios_alloc_controller(dev->node); 252 phb = pcibios_alloc_controller(dev->dev.of_node);
253 if (!phb) 253 if (!phb)
254 return -ENODEV; 254 return -ENODEV;
255 255
@@ -263,19 +263,19 @@ static int __devinit of_pci_phb_probe(struct of_device *dev,
263 } 263 }
264 264
265 /* Process "ranges" property */ 265 /* Process "ranges" property */
266 pci_process_bridge_OF_ranges(phb, dev->node, 0); 266 pci_process_bridge_OF_ranges(phb, dev->dev.of_node, 0);
267 267
268 /* Init pci_dn data structures */ 268 /* Init pci_dn data structures */
269 pci_devs_phb_init_dynamic(phb); 269 pci_devs_phb_init_dynamic(phb);
270 270
271 /* Register devices with EEH */ 271 /* Register devices with EEH */
272#ifdef CONFIG_EEH 272#ifdef CONFIG_EEH
273 if (dev->node->child) 273 if (dev->dev.of_node->child)
274 eeh_add_device_tree_early(dev->node); 274 eeh_add_device_tree_early(dev->dev.of_node);
275#endif /* CONFIG_EEH */ 275#endif /* CONFIG_EEH */
276 276
277 /* Scan the bus */ 277 /* Scan the bus */
278 pcibios_scan_phb(phb, dev->node); 278 pcibios_scan_phb(phb, dev->dev.of_node);
279 if (phb->bus == NULL) 279 if (phb->bus == NULL)
280 return -ENXIO; 280 return -ENXIO;
281 281
@@ -306,10 +306,11 @@ static struct of_device_id of_pci_phb_ids[] = {
306}; 306};
307 307
308static struct of_platform_driver of_pci_phb_driver = { 308static struct of_platform_driver of_pci_phb_driver = {
309 .match_table = of_pci_phb_ids,
310 .probe = of_pci_phb_probe, 309 .probe = of_pci_phb_probe,
311 .driver = { 310 .driver = {
312 .name = "of-pci", 311 .name = "of-pci",
312 .owner = THIS_MODULE,
313 .of_match_table = of_pci_phb_ids,
313 }, 314 },
314}; 315};
315 316
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 0c0567e58409..6646005dffb1 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1097,8 +1097,8 @@ void __devinit pcibios_setup_bus_devices(struct pci_bus *bus)
1097 if (dev->is_added) 1097 if (dev->is_added)
1098 continue; 1098 continue;
1099 1099
1100 /* Setup OF node pointer in archdata */ 1100 /* Setup OF node pointer in the device */
1101 sd->of_node = pci_device_to_OF_node(dev); 1101 dev->dev.of_node = pci_device_to_OF_node(dev);
1102 1102
1103 /* Fixup NUMA node as it may not be setup yet by the generic 1103 /* Fixup NUMA node as it may not be setup yet by the generic
1104 * code and is needed by the DMA init 1104 * code and is needed by the DMA init
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 9ce7b62dc3a4..00b9436f7652 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -707,7 +707,7 @@ static int vio_cmo_bus_probe(struct vio_dev *viodev)
707 * Check to see that device has a DMA window and configure 707 * Check to see that device has a DMA window and configure
708 * entitlement for the device. 708 * entitlement for the device.
709 */ 709 */
710 if (of_get_property(viodev->dev.archdata.of_node, 710 if (of_get_property(viodev->dev.of_node,
711 "ibm,my-dma-window", NULL)) { 711 "ibm,my-dma-window", NULL)) {
712 /* Check that the driver is CMO enabled and get desired DMA */ 712 /* Check that the driver is CMO enabled and get desired DMA */
713 if (!viodrv->get_desired_dma) { 713 if (!viodrv->get_desired_dma) {
@@ -1054,7 +1054,7 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
1054 if (firmware_has_feature(FW_FEATURE_ISERIES)) 1054 if (firmware_has_feature(FW_FEATURE_ISERIES))
1055 return vio_build_iommu_table_iseries(dev); 1055 return vio_build_iommu_table_iseries(dev);
1056 1056
1057 dma_window = of_get_property(dev->dev.archdata.of_node, 1057 dma_window = of_get_property(dev->dev.of_node,
1058 "ibm,my-dma-window", NULL); 1058 "ibm,my-dma-window", NULL);
1059 if (!dma_window) 1059 if (!dma_window)
1060 return NULL; 1060 return NULL;
@@ -1063,7 +1063,7 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
1063 if (tbl == NULL) 1063 if (tbl == NULL)
1064 return NULL; 1064 return NULL;
1065 1065
1066 of_parse_dma_window(dev->dev.archdata.of_node, dma_window, 1066 of_parse_dma_window(dev->dev.of_node, dma_window,
1067 &tbl->it_index, &offset, &size); 1067 &tbl->it_index, &offset, &size);
1068 1068
1069 /* TCE table size - measured in tce entries */ 1069 /* TCE table size - measured in tce entries */
@@ -1091,7 +1091,7 @@ static const struct vio_device_id *vio_match_device(
1091{ 1091{
1092 while (ids->type[0] != '\0') { 1092 while (ids->type[0] != '\0') {
1093 if ((strncmp(dev->type, ids->type, strlen(ids->type)) == 0) && 1093 if ((strncmp(dev->type, ids->type, strlen(ids->type)) == 0) &&
1094 of_device_is_compatible(dev->dev.archdata.of_node, 1094 of_device_is_compatible(dev->dev.of_node,
1095 ids->compat)) 1095 ids->compat))
1096 return ids; 1096 return ids;
1097 ids++; 1097 ids++;
@@ -1184,7 +1184,7 @@ EXPORT_SYMBOL(vio_unregister_driver);
1184static void __devinit vio_dev_release(struct device *dev) 1184static void __devinit vio_dev_release(struct device *dev)
1185{ 1185{
1186 /* XXX should free TCE table */ 1186 /* XXX should free TCE table */
1187 of_node_put(dev->archdata.of_node); 1187 of_node_put(dev->of_node);
1188 kfree(to_vio_dev(dev)); 1188 kfree(to_vio_dev(dev));
1189} 1189}
1190 1190
@@ -1235,7 +1235,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
1235 if (unit_address != NULL) 1235 if (unit_address != NULL)
1236 viodev->unit_address = *unit_address; 1236 viodev->unit_address = *unit_address;
1237 } 1237 }
1238 viodev->dev.archdata.of_node = of_node_get(of_node); 1238 viodev->dev.of_node = of_node_get(of_node);
1239 1239
1240 if (firmware_has_feature(FW_FEATURE_CMO)) 1240 if (firmware_has_feature(FW_FEATURE_CMO))
1241 vio_cmo_set_dma_ops(viodev); 1241 vio_cmo_set_dma_ops(viodev);
@@ -1320,7 +1320,7 @@ static ssize_t name_show(struct device *dev,
1320static ssize_t devspec_show(struct device *dev, 1320static ssize_t devspec_show(struct device *dev,
1321 struct device_attribute *attr, char *buf) 1321 struct device_attribute *attr, char *buf)
1322{ 1322{
1323 struct device_node *of_node = dev->archdata.of_node; 1323 struct device_node *of_node = dev->of_node;
1324 1324
1325 return sprintf(buf, "%s\n", of_node ? of_node->full_name : "none"); 1325 return sprintf(buf, "%s\n", of_node ? of_node->full_name : "none");
1326} 1326}
@@ -1332,7 +1332,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
1332 struct device_node *dn; 1332 struct device_node *dn;
1333 const char *cp; 1333 const char *cp;
1334 1334
1335 dn = dev->archdata.of_node; 1335 dn = dev->of_node;
1336 if (!dn) 1336 if (!dn)
1337 return -ENODEV; 1337 return -ENODEV;
1338 cp = of_get_property(dn, "compatible", NULL); 1338 cp = of_get_property(dn, "compatible", NULL);
@@ -1370,7 +1370,7 @@ static int vio_hotplug(struct device *dev, struct kobj_uevent_env *env)
1370 struct device_node *dn; 1370 struct device_node *dn;
1371 const char *cp; 1371 const char *cp;
1372 1372
1373 dn = dev->archdata.of_node; 1373 dn = dev->of_node;
1374 if (!dn) 1374 if (!dn)
1375 return -ENODEV; 1375 return -ENODEV;
1376 cp = of_get_property(dn, "compatible", NULL); 1376 cp = of_get_property(dn, "compatible", NULL);
@@ -1402,7 +1402,7 @@ static struct bus_type vio_bus_type = {
1402*/ 1402*/
1403const void *vio_get_attribute(struct vio_dev *vdev, char *which, int *length) 1403const void *vio_get_attribute(struct vio_dev *vdev, char *which, int *length)
1404{ 1404{
1405 return of_get_property(vdev->dev.archdata.of_node, which, length); 1405 return of_get_property(vdev->dev.of_node, which, length);
1406} 1406}
1407EXPORT_SYMBOL(vio_get_attribute); 1407EXPORT_SYMBOL(vio_get_attribute);
1408 1408
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
index fda7c2a18282..ca5305a5bd61 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
@@ -168,7 +168,7 @@ static int __devinit mpc52xx_wkup_gpiochip_probe(struct of_device *ofdev,
168 ofchip->gc.get = mpc52xx_wkup_gpio_get; 168 ofchip->gc.get = mpc52xx_wkup_gpio_get;
169 ofchip->gc.set = mpc52xx_wkup_gpio_set; 169 ofchip->gc.set = mpc52xx_wkup_gpio_set;
170 170
171 ret = of_mm_gpiochip_add(ofdev->node, &chip->mmchip); 171 ret = of_mm_gpiochip_add(ofdev->dev.of_node, &chip->mmchip);
172 if (ret) 172 if (ret)
173 return ret; 173 return ret;
174 174
@@ -193,8 +193,11 @@ static const struct of_device_id mpc52xx_wkup_gpiochip_match[] = {
193}; 193};
194 194
195static struct of_platform_driver mpc52xx_wkup_gpiochip_driver = { 195static struct of_platform_driver mpc52xx_wkup_gpiochip_driver = {
196 .name = "gpio_wkup", 196 .driver = {
197 .match_table = mpc52xx_wkup_gpiochip_match, 197 .name = "gpio_wkup",
198 .owner = THIS_MODULE,
199 .of_match_table = mpc52xx_wkup_gpiochip_match,
200 },
198 .probe = mpc52xx_wkup_gpiochip_probe, 201 .probe = mpc52xx_wkup_gpiochip_probe,
199 .remove = mpc52xx_gpiochip_remove, 202 .remove = mpc52xx_gpiochip_remove,
200}; 203};
@@ -329,7 +332,7 @@ static int __devinit mpc52xx_simple_gpiochip_probe(struct of_device *ofdev,
329 ofchip->gc.get = mpc52xx_simple_gpio_get; 332 ofchip->gc.get = mpc52xx_simple_gpio_get;
330 ofchip->gc.set = mpc52xx_simple_gpio_set; 333 ofchip->gc.set = mpc52xx_simple_gpio_set;
331 334
332 ret = of_mm_gpiochip_add(ofdev->node, &chip->mmchip); 335 ret = of_mm_gpiochip_add(ofdev->dev.of_node, &chip->mmchip);
333 if (ret) 336 if (ret)
334 return ret; 337 return ret;
335 338
@@ -349,8 +352,11 @@ static const struct of_device_id mpc52xx_simple_gpiochip_match[] = {
349}; 352};
350 353
351static struct of_platform_driver mpc52xx_simple_gpiochip_driver = { 354static struct of_platform_driver mpc52xx_simple_gpiochip_driver = {
352 .name = "gpio", 355 .driver = {
353 .match_table = mpc52xx_simple_gpiochip_match, 356 .name = "gpio",
357 .owner = THIS_MODULE,
358 .of_match_table = mpc52xx_simple_gpiochip_match,
359 },
354 .probe = mpc52xx_simple_gpiochip_probe, 360 .probe = mpc52xx_simple_gpiochip_probe,
355 .remove = mpc52xx_gpiochip_remove, 361 .remove = mpc52xx_gpiochip_remove,
356}; 362};
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
index a60ee39d3b78..46c93578cbf0 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
@@ -734,8 +734,8 @@ static int __devinit mpc52xx_gpt_probe(struct of_device *ofdev,
734 734
735 spin_lock_init(&gpt->lock); 735 spin_lock_init(&gpt->lock);
736 gpt->dev = &ofdev->dev; 736 gpt->dev = &ofdev->dev;
737 gpt->ipb_freq = mpc5xxx_get_bus_frequency(ofdev->node); 737 gpt->ipb_freq = mpc5xxx_get_bus_frequency(ofdev->dev.of_node);
738 gpt->regs = of_iomap(ofdev->node, 0); 738 gpt->regs = of_iomap(ofdev->dev.of_node, 0);
739 if (!gpt->regs) { 739 if (!gpt->regs) {
740 kfree(gpt); 740 kfree(gpt);
741 return -ENOMEM; 741 return -ENOMEM;
@@ -743,21 +743,21 @@ static int __devinit mpc52xx_gpt_probe(struct of_device *ofdev,
743 743
744 dev_set_drvdata(&ofdev->dev, gpt); 744 dev_set_drvdata(&ofdev->dev, gpt);
745 745
746 mpc52xx_gpt_gpio_setup(gpt, ofdev->node); 746 mpc52xx_gpt_gpio_setup(gpt, ofdev->dev.of_node);
747 mpc52xx_gpt_irq_setup(gpt, ofdev->node); 747 mpc52xx_gpt_irq_setup(gpt, ofdev->dev.of_node);
748 748
749 mutex_lock(&mpc52xx_gpt_list_mutex); 749 mutex_lock(&mpc52xx_gpt_list_mutex);
750 list_add(&gpt->list, &mpc52xx_gpt_list); 750 list_add(&gpt->list, &mpc52xx_gpt_list);
751 mutex_unlock(&mpc52xx_gpt_list_mutex); 751 mutex_unlock(&mpc52xx_gpt_list_mutex);
752 752
753 /* check if this device could be a watchdog */ 753 /* check if this device could be a watchdog */
754 if (of_get_property(ofdev->node, "fsl,has-wdt", NULL) || 754 if (of_get_property(ofdev->dev.of_node, "fsl,has-wdt", NULL) ||
755 of_get_property(ofdev->node, "has-wdt", NULL)) { 755 of_get_property(ofdev->dev.of_node, "has-wdt", NULL)) {
756 const u32 *on_boot_wdt; 756 const u32 *on_boot_wdt;
757 757
758 gpt->wdt_mode = MPC52xx_GPT_CAN_WDT; 758 gpt->wdt_mode = MPC52xx_GPT_CAN_WDT;
759 on_boot_wdt = of_get_property(ofdev->node, "fsl,wdt-on-boot", 759 on_boot_wdt = of_get_property(ofdev->dev.of_node,
760 NULL); 760 "fsl,wdt-on-boot", NULL);
761 if (on_boot_wdt) { 761 if (on_boot_wdt) {
762 dev_info(gpt->dev, "used as watchdog\n"); 762 dev_info(gpt->dev, "used as watchdog\n");
763 gpt->wdt_mode |= MPC52xx_GPT_IS_WDT; 763 gpt->wdt_mode |= MPC52xx_GPT_IS_WDT;
@@ -784,8 +784,11 @@ static const struct of_device_id mpc52xx_gpt_match[] = {
784}; 784};
785 785
786static struct of_platform_driver mpc52xx_gpt_driver = { 786static struct of_platform_driver mpc52xx_gpt_driver = {
787 .name = "mpc52xx-gpt", 787 .driver = {
788 .match_table = mpc52xx_gpt_match, 788 .name = "mpc52xx-gpt",
789 .owner = THIS_MODULE,
790 .of_match_table = mpc52xx_gpt_match,
791 },
789 .probe = mpc52xx_gpt_probe, 792 .probe = mpc52xx_gpt_probe,
790 .remove = mpc52xx_gpt_remove, 793 .remove = mpc52xx_gpt_remove,
791}; 794};
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
index d4f8be307cd5..e86aec644501 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
@@ -445,14 +445,14 @@ mpc52xx_lpbfifo_probe(struct of_device *op, const struct of_device_id *match)
445 if (lpbfifo.dev != NULL) 445 if (lpbfifo.dev != NULL)
446 return -ENOSPC; 446 return -ENOSPC;
447 447
448 lpbfifo.irq = irq_of_parse_and_map(op->node, 0); 448 lpbfifo.irq = irq_of_parse_and_map(op->dev.of_node, 0);
449 if (!lpbfifo.irq) 449 if (!lpbfifo.irq)
450 return -ENODEV; 450 return -ENODEV;
451 451
452 if (of_address_to_resource(op->node, 0, &res)) 452 if (of_address_to_resource(op->dev.of_node, 0, &res))
453 return -ENODEV; 453 return -ENODEV;
454 lpbfifo.regs_phys = res.start; 454 lpbfifo.regs_phys = res.start;
455 lpbfifo.regs = of_iomap(op->node, 0); 455 lpbfifo.regs = of_iomap(op->dev.of_node, 0);
456 if (!lpbfifo.regs) 456 if (!lpbfifo.regs)
457 return -ENOMEM; 457 return -ENOMEM;
458 458
@@ -537,9 +537,11 @@ static struct of_device_id mpc52xx_lpbfifo_match[] __devinitconst = {
537}; 537};
538 538
539static struct of_platform_driver mpc52xx_lpbfifo_driver = { 539static struct of_platform_driver mpc52xx_lpbfifo_driver = {
540 .owner = THIS_MODULE, 540 .driver = {
541 .name = "mpc52xx-lpbfifo", 541 .name = "mpc52xx-lpbfifo",
542 .match_table = mpc52xx_lpbfifo_match, 542 .owner = THIS_MODULE,
543 .of_match_table = mpc52xx_lpbfifo_match,
544 },
543 .probe = mpc52xx_lpbfifo_probe, 545 .probe = mpc52xx_lpbfifo_probe,
544 .remove = __devexit_p(mpc52xx_lpbfifo_remove), 546 .remove = __devexit_p(mpc52xx_lpbfifo_remove),
545}; 547};
diff --git a/arch/powerpc/platforms/82xx/ep8248e.c b/arch/powerpc/platforms/82xx/ep8248e.c
index f21555d3395a..9f2e52b36f91 100644
--- a/arch/powerpc/platforms/82xx/ep8248e.c
+++ b/arch/powerpc/platforms/82xx/ep8248e.c
@@ -119,12 +119,12 @@ static int __devinit ep8248e_mdio_probe(struct of_device *ofdev,
119 struct device_node *node; 119 struct device_node *node;
120 int ret; 120 int ret;
121 121
122 node = of_get_parent(ofdev->node); 122 node = of_get_parent(ofdev->dev.of_node);
123 of_node_put(node); 123 of_node_put(node);
124 if (node != ep8248e_bcsr_node) 124 if (node != ep8248e_bcsr_node)
125 return -ENODEV; 125 return -ENODEV;
126 126
127 ret = of_address_to_resource(ofdev->node, 0, &res); 127 ret = of_address_to_resource(ofdev->dev.of_node, 0, &res);
128 if (ret) 128 if (ret)
129 return ret; 129 return ret;
130 130
@@ -142,7 +142,7 @@ static int __devinit ep8248e_mdio_probe(struct of_device *ofdev,
142 bus->parent = &ofdev->dev; 142 bus->parent = &ofdev->dev;
143 snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start); 143 snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
144 144
145 ret = of_mdiobus_register(bus, ofdev->node); 145 ret = of_mdiobus_register(bus, ofdev->dev.of_node);
146 if (ret) 146 if (ret)
147 goto err_free_irq; 147 goto err_free_irq;
148 148
@@ -170,8 +170,9 @@ static const struct of_device_id ep8248e_mdio_match[] = {
170static struct of_platform_driver ep8248e_mdio_driver = { 170static struct of_platform_driver ep8248e_mdio_driver = {
171 .driver = { 171 .driver = {
172 .name = "ep8248e-mdio-bitbang", 172 .name = "ep8248e-mdio-bitbang",
173 .owner = THIS_MODULE,
174 .of_match_table = ep8248e_mdio_match,
173 }, 175 },
174 .match_table = ep8248e_mdio_match,
175 .probe = ep8248e_mdio_probe, 176 .probe = ep8248e_mdio_probe,
176 .remove = ep8248e_mdio_remove, 177 .remove = ep8248e_mdio_remove,
177}; 178};
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index 43805348b81e..ebe6c3537209 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -321,7 +321,7 @@ static struct platform_suspend_ops mpc83xx_suspend_ops = {
321static int pmc_probe(struct of_device *ofdev, 321static int pmc_probe(struct of_device *ofdev,
322 const struct of_device_id *match) 322 const struct of_device_id *match)
323{ 323{
324 struct device_node *np = ofdev->node; 324 struct device_node *np = ofdev->dev.of_node;
325 struct resource res; 325 struct resource res;
326 struct pmc_type *type = match->data; 326 struct pmc_type *type = match->data;
327 int ret = 0; 327 int ret = 0;
@@ -423,8 +423,11 @@ static struct of_device_id pmc_match[] = {
423}; 423};
424 424
425static struct of_platform_driver pmc_driver = { 425static struct of_platform_driver pmc_driver = {
426 .name = "mpc83xx-pmc", 426 .driver = {
427 .match_table = pmc_match, 427 .name = "mpc83xx-pmc",
428 .owner = THIS_MODULE,
429 .of_match_table = pmc_match,
430 },
428 .probe = pmc_probe, 431 .probe = pmc_probe,
429 .remove = pmc_remove 432 .remove = pmc_remove
430}; 433};
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c
index 8efe48192f3f..6257e5378615 100644
--- a/arch/powerpc/platforms/cell/axon_msi.c
+++ b/arch/powerpc/platforms/cell/axon_msi.c
@@ -345,7 +345,7 @@ static int axon_msi_shutdown(struct of_device *device)
345static int axon_msi_probe(struct of_device *device, 345static int axon_msi_probe(struct of_device *device,
346 const struct of_device_id *device_id) 346 const struct of_device_id *device_id)
347{ 347{
348 struct device_node *dn = device->node; 348 struct device_node *dn = device->dev.of_node;
349 struct axon_msic *msic; 349 struct axon_msic *msic;
350 unsigned int virq; 350 unsigned int virq;
351 int dcr_base, dcr_len; 351 int dcr_base, dcr_len;
@@ -447,11 +447,12 @@ static const struct of_device_id axon_msi_device_id[] = {
447}; 447};
448 448
449static struct of_platform_driver axon_msi_driver = { 449static struct of_platform_driver axon_msi_driver = {
450 .match_table = axon_msi_device_id,
451 .probe = axon_msi_probe, 450 .probe = axon_msi_probe,
452 .shutdown = axon_msi_shutdown, 451 .shutdown = axon_msi_shutdown,
453 .driver = { 452 .driver = {
454 .name = "axon-msi" 453 .name = "axon-msi",
454 .owner = THIS_MODULE,
455 .of_match_table = axon_msi_device_id,
455 }, 456 },
456}; 457};
457 458
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index e3ec4976fae7..22667a09d40e 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -545,7 +545,6 @@ static struct iommu_table *cell_get_iommu_table(struct device *dev)
545{ 545{
546 struct iommu_window *window; 546 struct iommu_window *window;
547 struct cbe_iommu *iommu; 547 struct cbe_iommu *iommu;
548 struct dev_archdata *archdata = &dev->archdata;
549 548
550 /* Current implementation uses the first window available in that 549 /* Current implementation uses the first window available in that
551 * node's iommu. We -might- do something smarter later though it may 550 * node's iommu. We -might- do something smarter later though it may
@@ -554,7 +553,7 @@ static struct iommu_table *cell_get_iommu_table(struct device *dev)
554 iommu = cell_iommu_for_node(dev_to_node(dev)); 553 iommu = cell_iommu_for_node(dev_to_node(dev));
555 if (iommu == NULL || list_empty(&iommu->windows)) { 554 if (iommu == NULL || list_empty(&iommu->windows)) {
556 printk(KERN_ERR "iommu: missing iommu for %s (node %d)\n", 555 printk(KERN_ERR "iommu: missing iommu for %s (node %d)\n",
557 archdata->of_node ? archdata->of_node->full_name : "?", 556 dev->of_node ? dev->of_node->full_name : "?",
558 dev_to_node(dev)); 557 dev_to_node(dev));
559 return NULL; 558 return NULL;
560 } 559 }
@@ -897,7 +896,7 @@ static u64 cell_iommu_get_fixed_address(struct device *dev)
897 const u32 *ranges = NULL; 896 const u32 *ranges = NULL;
898 int i, len, best, naddr, nsize, pna, range_size; 897 int i, len, best, naddr, nsize, pna, range_size;
899 898
900 np = of_node_get(dev->archdata.of_node); 899 np = of_node_get(dev->of_node);
901 while (1) { 900 while (1) {
902 naddr = of_n_addr_cells(np); 901 naddr = of_n_addr_cells(np);
903 nsize = of_n_size_cells(np); 902 nsize = of_n_size_cells(np);
diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c
index 0f881f64583e..627ee089e75d 100644
--- a/arch/powerpc/platforms/pasemi/gpio_mdio.c
+++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c
@@ -220,7 +220,7 @@ static int __devinit gpio_mdio_probe(struct of_device *ofdev,
220 const struct of_device_id *match) 220 const struct of_device_id *match)
221{ 221{
222 struct device *dev = &ofdev->dev; 222 struct device *dev = &ofdev->dev;
223 struct device_node *np = ofdev->node; 223 struct device_node *np = ofdev->dev.of_node;
224 struct mii_bus *new_bus; 224 struct mii_bus *new_bus;
225 struct gpio_priv *priv; 225 struct gpio_priv *priv;
226 const unsigned int *prop; 226 const unsigned int *prop;
@@ -301,11 +301,12 @@ MODULE_DEVICE_TABLE(of, gpio_mdio_match);
301 301
302static struct of_platform_driver gpio_mdio_driver = 302static struct of_platform_driver gpio_mdio_driver =
303{ 303{
304 .match_table = gpio_mdio_match,
305 .probe = gpio_mdio_probe, 304 .probe = gpio_mdio_probe,
306 .remove = gpio_mdio_remove, 305 .remove = gpio_mdio_remove,
307 .driver = { 306 .driver = {
308 .name = "gpio-mdio-bitbang", 307 .name = "gpio-mdio-bitbang",
308 .owner = THIS_MODULE,
309 .of_match_table = gpio_mdio_match,
309 }, 310 },
310}; 311};
311 312
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
index ac6fdd973291..f372ec1691a3 100644
--- a/arch/powerpc/platforms/pasemi/setup.c
+++ b/arch/powerpc/platforms/pasemi/setup.c
@@ -360,10 +360,10 @@ static int pcmcia_notify(struct notifier_block *nb, unsigned long action,
360 /* We know electra_cf devices will always have of_node set, since 360 /* We know electra_cf devices will always have of_node set, since
361 * electra_cf is an of_platform driver. 361 * electra_cf is an of_platform driver.
362 */ 362 */
363 if (!parent->archdata.of_node) 363 if (!parent->of_node)
364 return 0; 364 return 0;
365 365
366 if (!of_device_is_compatible(parent->archdata.of_node, "electra-cf")) 366 if (!of_device_is_compatible(parent->of_node, "electra-cf"))
367 return 0; 367 return 0;
368 368
369 /* We use the direct ops for localbus */ 369 /* We use the direct ops for localbus */
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
index 6d09f5e3e7e4..23083c397528 100644
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -766,7 +766,7 @@ int ps3_system_bus_device_register(struct ps3_system_bus_device *dev)
766 BUG(); 766 BUG();
767 }; 767 };
768 768
769 dev->core.archdata.of_node = NULL; 769 dev->core.of_node = NULL;
770 set_dev_node(&dev->core, 0); 770 set_dev_node(&dev->core, 0);
771 771
772 pr_debug("%s:%d add %s\n", __func__, __LINE__, dev_name(&dev->core)); 772 pr_debug("%s:%d add %s\n", __func__, __LINE__, dev_name(&dev->core));
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 1a0000a4b6d6..d26182d42cbf 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -468,7 +468,7 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
468 468
469 pr_debug("pci_dma_dev_setup_pSeries: %s\n", pci_name(dev)); 469 pr_debug("pci_dma_dev_setup_pSeries: %s\n", pci_name(dev));
470 470
471 dn = dev->dev.archdata.of_node; 471 dn = dev->dev.of_node;
472 472
473 /* If we're the direct child of a root bus, then we need to allocate 473 /* If we're the direct child of a root bus, then we need to allocate
474 * an iommu table ourselves. The bus setup code should have setup 474 * an iommu table ourselves. The bus setup code should have setup
diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c
index 88f4ae787832..402d2212162f 100644
--- a/arch/powerpc/sysdev/axonram.c
+++ b/arch/powerpc/sysdev/axonram.c
@@ -185,7 +185,7 @@ axon_ram_probe(struct of_device *device, const struct of_device_id *device_id)
185 axon_ram_bank_id++; 185 axon_ram_bank_id++;
186 186
187 dev_info(&device->dev, "Found memory controller on %s\n", 187 dev_info(&device->dev, "Found memory controller on %s\n",
188 device->node->full_name); 188 device->dev.of_node->full_name);
189 189
190 bank = kzalloc(sizeof(struct axon_ram_bank), GFP_KERNEL); 190 bank = kzalloc(sizeof(struct axon_ram_bank), GFP_KERNEL);
191 if (bank == NULL) { 191 if (bank == NULL) {
@@ -198,7 +198,7 @@ axon_ram_probe(struct of_device *device, const struct of_device_id *device_id)
198 198
199 bank->device = device; 199 bank->device = device;
200 200
201 if (of_address_to_resource(device->node, 0, &resource) != 0) { 201 if (of_address_to_resource(device->dev.of_node, 0, &resource) != 0) {
202 dev_err(&device->dev, "Cannot access device tree\n"); 202 dev_err(&device->dev, "Cannot access device tree\n");
203 rc = -EFAULT; 203 rc = -EFAULT;
204 goto failed; 204 goto failed;
@@ -253,7 +253,7 @@ axon_ram_probe(struct of_device *device, const struct of_device_id *device_id)
253 blk_queue_logical_block_size(bank->disk->queue, AXON_RAM_SECTOR_SIZE); 253 blk_queue_logical_block_size(bank->disk->queue, AXON_RAM_SECTOR_SIZE);
254 add_disk(bank->disk); 254 add_disk(bank->disk);
255 255
256 bank->irq_id = irq_of_parse_and_map(device->node, 0); 256 bank->irq_id = irq_of_parse_and_map(device->dev.of_node, 0);
257 if (bank->irq_id == NO_IRQ) { 257 if (bank->irq_id == NO_IRQ) {
258 dev_err(&device->dev, "Cannot access ECC interrupt ID\n"); 258 dev_err(&device->dev, "Cannot access ECC interrupt ID\n");
259 rc = -EFAULT; 259 rc = -EFAULT;
@@ -327,12 +327,12 @@ static struct of_device_id axon_ram_device_id[] = {
327}; 327};
328 328
329static struct of_platform_driver axon_ram_driver = { 329static struct of_platform_driver axon_ram_driver = {
330 .match_table = axon_ram_device_id,
331 .probe = axon_ram_probe, 330 .probe = axon_ram_probe,
332 .remove = axon_ram_remove, 331 .remove = axon_ram_remove,
333 .driver = { 332 .driver = {
334 .owner = THIS_MODULE, 333 .name = AXON_RAM_MODULE_NAME,
335 .name = AXON_RAM_MODULE_NAME, 334 .owner = THIS_MODULE,
335 .of_match_table = axon_ram_device_id,
336 }, 336 },
337}; 337};
338 338
diff --git a/arch/powerpc/sysdev/bestcomm/bestcomm.c b/arch/powerpc/sysdev/bestcomm/bestcomm.c
index 378ebd9aac18..a7c5c470af14 100644
--- a/arch/powerpc/sysdev/bestcomm/bestcomm.c
+++ b/arch/powerpc/sysdev/bestcomm/bestcomm.c
@@ -377,7 +377,7 @@ mpc52xx_bcom_probe(struct of_device *op, const struct of_device_id *match)
377 printk(KERN_INFO "DMA: MPC52xx BestComm driver\n"); 377 printk(KERN_INFO "DMA: MPC52xx BestComm driver\n");
378 378
379 /* Get the bestcomm node */ 379 /* Get the bestcomm node */
380 of_node_get(op->node); 380 of_node_get(op->dev.of_node);
381 381
382 /* Prepare SRAM */ 382 /* Prepare SRAM */
383 ofn_sram = of_find_matching_node(NULL, mpc52xx_sram_ids); 383 ofn_sram = of_find_matching_node(NULL, mpc52xx_sram_ids);
@@ -406,10 +406,10 @@ mpc52xx_bcom_probe(struct of_device *op, const struct of_device_id *match)
406 } 406 }
407 407
408 /* Save the node */ 408 /* Save the node */
409 bcom_eng->ofnode = op->node; 409 bcom_eng->ofnode = op->dev.of_node;
410 410
411 /* Get, reserve & map io */ 411 /* Get, reserve & map io */
412 if (of_address_to_resource(op->node, 0, &res_bcom)) { 412 if (of_address_to_resource(op->dev.of_node, 0, &res_bcom)) {
413 printk(KERN_ERR DRIVER_NAME ": " 413 printk(KERN_ERR DRIVER_NAME ": "
414 "Can't get resource\n"); 414 "Can't get resource\n");
415 rv = -EINVAL; 415 rv = -EINVAL;
@@ -453,7 +453,7 @@ error_sramclean:
453 kfree(bcom_eng); 453 kfree(bcom_eng);
454 bcom_sram_cleanup(); 454 bcom_sram_cleanup();
455error_ofput: 455error_ofput:
456 of_node_put(op->node); 456 of_node_put(op->dev.of_node);
457 457
458 printk(KERN_ERR "DMA: MPC52xx BestComm init failed !\n"); 458 printk(KERN_ERR "DMA: MPC52xx BestComm init failed !\n");
459 459
@@ -494,14 +494,12 @@ MODULE_DEVICE_TABLE(of, mpc52xx_bcom_of_match);
494 494
495 495
496static struct of_platform_driver mpc52xx_bcom_of_platform_driver = { 496static struct of_platform_driver mpc52xx_bcom_of_platform_driver = {
497 .owner = THIS_MODULE,
498 .name = DRIVER_NAME,
499 .match_table = mpc52xx_bcom_of_match,
500 .probe = mpc52xx_bcom_probe, 497 .probe = mpc52xx_bcom_probe,
501 .remove = mpc52xx_bcom_remove, 498 .remove = mpc52xx_bcom_remove,
502 .driver = { 499 .driver = {
503 .name = DRIVER_NAME, 500 .name = DRIVER_NAME,
504 .owner = THIS_MODULE, 501 .owner = THIS_MODULE,
502 .of_match_table = mpc52xx_bcom_of_match,
505 }, 503 },
506}; 504};
507 505
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 3482e3fd89c0..a7be144f5874 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -249,7 +249,7 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
249 goto error_out; 249 goto error_out;
250 } 250 }
251 251
252 msi->irqhost = irq_alloc_host(dev->node, IRQ_HOST_MAP_LINEAR, 252 msi->irqhost = irq_alloc_host(dev->dev.of_node, IRQ_HOST_MAP_LINEAR,
253 NR_MSI_IRQS, &fsl_msi_host_ops, 0); 253 NR_MSI_IRQS, &fsl_msi_host_ops, 0);
254 254
255 if (msi->irqhost == NULL) { 255 if (msi->irqhost == NULL) {
@@ -259,10 +259,10 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
259 } 259 }
260 260
261 /* Get the MSI reg base */ 261 /* Get the MSI reg base */
262 err = of_address_to_resource(dev->node, 0, &res); 262 err = of_address_to_resource(dev->dev.of_node, 0, &res);
263 if (err) { 263 if (err) {
264 dev_err(&dev->dev, "%s resource error!\n", 264 dev_err(&dev->dev, "%s resource error!\n",
265 dev->node->full_name); 265 dev->dev.of_node->full_name);
266 goto error_out; 266 goto error_out;
267 } 267 }
268 268
@@ -285,16 +285,16 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
285 goto error_out; 285 goto error_out;
286 } 286 }
287 287
288 p = of_get_property(dev->node, "interrupts", &count); 288 p = of_get_property(dev->dev.of_node, "interrupts", &count);
289 if (!p) { 289 if (!p) {
290 dev_err(&dev->dev, "no interrupts property found on %s\n", 290 dev_err(&dev->dev, "no interrupts property found on %s\n",
291 dev->node->full_name); 291 dev->dev.of_node->full_name);
292 err = -ENODEV; 292 err = -ENODEV;
293 goto error_out; 293 goto error_out;
294 } 294 }
295 if (count % 8 != 0) { 295 if (count % 8 != 0) {
296 dev_err(&dev->dev, "Malformed interrupts property on %s\n", 296 dev_err(&dev->dev, "Malformed interrupts property on %s\n",
297 dev->node->full_name); 297 dev->dev.of_node->full_name);
298 err = -EINVAL; 298 err = -EINVAL;
299 goto error_out; 299 goto error_out;
300 } 300 }
@@ -303,7 +303,7 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
303 for (i = 0; i < count / 2; i++) { 303 for (i = 0; i < count / 2; i++) {
304 if (i > NR_MSI_REG) 304 if (i > NR_MSI_REG)
305 break; 305 break;
306 virt_msir = irq_of_parse_and_map(dev->node, i); 306 virt_msir = irq_of_parse_and_map(dev->dev.of_node, i);
307 if (virt_msir != NO_IRQ) { 307 if (virt_msir != NO_IRQ) {
308 set_irq_data(virt_msir, (void *)i); 308 set_irq_data(virt_msir, (void *)i);
309 set_irq_chained_handler(virt_msir, fsl_msi_cascade); 309 set_irq_chained_handler(virt_msir, fsl_msi_cascade);
@@ -345,8 +345,11 @@ static const struct of_device_id fsl_of_msi_ids[] = {
345}; 345};
346 346
347static struct of_platform_driver fsl_of_msi_driver = { 347static struct of_platform_driver fsl_of_msi_driver = {
348 .name = "fsl-msi", 348 .driver = {
349 .match_table = fsl_of_msi_ids, 349 .name = "fsl-msi",
350 .owner = THIS_MODULE,
351 .of_match_table = fsl_of_msi_ids,
352 },
350 .probe = fsl_of_msi_probe, 353 .probe = fsl_of_msi_probe,
351}; 354};
352 355
diff --git a/arch/powerpc/sysdev/fsl_pmc.c b/arch/powerpc/sysdev/fsl_pmc.c
index a7635a993dca..9082eb921ad9 100644
--- a/arch/powerpc/sysdev/fsl_pmc.c
+++ b/arch/powerpc/sysdev/fsl_pmc.c
@@ -60,7 +60,7 @@ static struct platform_suspend_ops pmc_suspend_ops = {
60 60
61static int pmc_probe(struct of_device *ofdev, const struct of_device_id *id) 61static int pmc_probe(struct of_device *ofdev, const struct of_device_id *id)
62{ 62{
63 pmc_regs = of_iomap(ofdev->node, 0); 63 pmc_regs = of_iomap(ofdev->dev.of_node, 0);
64 if (!pmc_regs) 64 if (!pmc_regs)
65 return -ENOMEM; 65 return -ENOMEM;
66 66
@@ -76,8 +76,11 @@ static const struct of_device_id pmc_ids[] = {
76}; 76};
77 77
78static struct of_platform_driver pmc_driver = { 78static struct of_platform_driver pmc_driver = {
79 .driver.name = "fsl-pmc", 79 .driver = {
80 .match_table = pmc_ids, 80 .name = "fsl-pmc",
81 .owner = THIS_MODULE,
82 .of_match_table = pmc_ids,
83 },
81 .probe = pmc_probe, 84 .probe = pmc_probe,
82}; 85};
83 86
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 71fba88f50db..6a1fde0d22b0 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -1015,41 +1015,41 @@ int fsl_rio_setup(struct of_device *dev)
1015 u64 law_start, law_size; 1015 u64 law_start, law_size;
1016 int paw, aw, sw; 1016 int paw, aw, sw;
1017 1017
1018 if (!dev->node) { 1018 if (!dev->dev.of_node) {
1019 dev_err(&dev->dev, "Device OF-Node is NULL"); 1019 dev_err(&dev->dev, "Device OF-Node is NULL");
1020 return -EFAULT; 1020 return -EFAULT;
1021 } 1021 }
1022 1022
1023 rc = of_address_to_resource(dev->node, 0, &regs); 1023 rc = of_address_to_resource(dev->dev.of_node, 0, &regs);
1024 if (rc) { 1024 if (rc) {
1025 dev_err(&dev->dev, "Can't get %s property 'reg'\n", 1025 dev_err(&dev->dev, "Can't get %s property 'reg'\n",
1026 dev->node->full_name); 1026 dev->dev.of_node->full_name);
1027 return -EFAULT; 1027 return -EFAULT;
1028 } 1028 }
1029 dev_info(&dev->dev, "Of-device full name %s\n", dev->node->full_name); 1029 dev_info(&dev->dev, "Of-device full name %s\n", dev->dev.of_node->full_name);
1030 dev_info(&dev->dev, "Regs: %pR\n", &regs); 1030 dev_info(&dev->dev, "Regs: %pR\n", &regs);
1031 1031
1032 dt_range = of_get_property(dev->node, "ranges", &rlen); 1032 dt_range = of_get_property(dev->dev.of_node, "ranges", &rlen);
1033 if (!dt_range) { 1033 if (!dt_range) {
1034 dev_err(&dev->dev, "Can't get %s property 'ranges'\n", 1034 dev_err(&dev->dev, "Can't get %s property 'ranges'\n",
1035 dev->node->full_name); 1035 dev->dev.of_node->full_name);
1036 return -EFAULT; 1036 return -EFAULT;
1037 } 1037 }
1038 1038
1039 /* Get node address wide */ 1039 /* Get node address wide */
1040 cell = of_get_property(dev->node, "#address-cells", NULL); 1040 cell = of_get_property(dev->dev.of_node, "#address-cells", NULL);
1041 if (cell) 1041 if (cell)
1042 aw = *cell; 1042 aw = *cell;
1043 else 1043 else
1044 aw = of_n_addr_cells(dev->node); 1044 aw = of_n_addr_cells(dev->dev.of_node);
1045 /* Get node size wide */ 1045 /* Get node size wide */
1046 cell = of_get_property(dev->node, "#size-cells", NULL); 1046 cell = of_get_property(dev->dev.of_node, "#size-cells", NULL);
1047 if (cell) 1047 if (cell)
1048 sw = *cell; 1048 sw = *cell;
1049 else 1049 else
1050 sw = of_n_size_cells(dev->node); 1050 sw = of_n_size_cells(dev->dev.of_node);
1051 /* Get parent address wide wide */ 1051 /* Get parent address wide wide */
1052 paw = of_n_addr_cells(dev->node); 1052 paw = of_n_addr_cells(dev->dev.of_node);
1053 1053
1054 law_start = of_read_number(dt_range + aw, paw); 1054 law_start = of_read_number(dt_range + aw, paw);
1055 law_size = of_read_number(dt_range + aw + paw, sw); 1055 law_size = of_read_number(dt_range + aw + paw, sw);
@@ -1089,9 +1089,9 @@ int fsl_rio_setup(struct of_device *dev)
1089 port->iores.flags = IORESOURCE_MEM; 1089 port->iores.flags = IORESOURCE_MEM;
1090 port->iores.name = "rio_io_win"; 1090 port->iores.name = "rio_io_win";
1091 1091
1092 priv->bellirq = irq_of_parse_and_map(dev->node, 2); 1092 priv->bellirq = irq_of_parse_and_map(dev->dev.of_node, 2);
1093 priv->txirq = irq_of_parse_and_map(dev->node, 3); 1093 priv->txirq = irq_of_parse_and_map(dev->dev.of_node, 3);
1094 priv->rxirq = irq_of_parse_and_map(dev->node, 4); 1094 priv->rxirq = irq_of_parse_and_map(dev->dev.of_node, 4);
1095 dev_info(&dev->dev, "bellirq: %d, txirq: %d, rxirq %d\n", priv->bellirq, 1095 dev_info(&dev->dev, "bellirq: %d, txirq: %d, rxirq %d\n", priv->bellirq,
1096 priv->txirq, priv->rxirq); 1096 priv->txirq, priv->rxirq);
1097 1097
@@ -1195,7 +1195,7 @@ static int __devinit fsl_of_rio_rpn_probe(struct of_device *dev,
1195{ 1195{
1196 int rc; 1196 int rc;
1197 printk(KERN_INFO "Setting up RapidIO peer-to-peer network %s\n", 1197 printk(KERN_INFO "Setting up RapidIO peer-to-peer network %s\n",
1198 dev->node->full_name); 1198 dev->dev.of_node->full_name);
1199 1199
1200 rc = fsl_rio_setup(dev); 1200 rc = fsl_rio_setup(dev);
1201 if (rc) 1201 if (rc)
@@ -1215,8 +1215,11 @@ static const struct of_device_id fsl_of_rio_rpn_ids[] = {
1215}; 1215};
1216 1216
1217static struct of_platform_driver fsl_of_rio_rpn_driver = { 1217static struct of_platform_driver fsl_of_rio_rpn_driver = {
1218 .name = "fsl-of-rio", 1218 .driver = {
1219 .match_table = fsl_of_rio_rpn_ids, 1219 .name = "fsl-of-rio",
1220 .owner = THIS_MODULE,
1221 .of_match_table = fsl_of_rio_rpn_ids,
1222 },
1220 .probe = fsl_of_rio_rpn_probe, 1223 .probe = fsl_of_rio_rpn_probe,
1221}; 1224};
1222 1225
diff --git a/arch/powerpc/sysdev/pmi.c b/arch/powerpc/sysdev/pmi.c
index 652652db4ce2..d07137a07d75 100644
--- a/arch/powerpc/sysdev/pmi.c
+++ b/arch/powerpc/sysdev/pmi.c
@@ -124,7 +124,7 @@ static void pmi_notify_handlers(struct work_struct *work)
124static int pmi_of_probe(struct of_device *dev, 124static int pmi_of_probe(struct of_device *dev,
125 const struct of_device_id *match) 125 const struct of_device_id *match)
126{ 126{
127 struct device_node *np = dev->node; 127 struct device_node *np = dev->dev.of_node;
128 int rc; 128 int rc;
129 129
130 if (data) { 130 if (data) {
@@ -206,11 +206,12 @@ static int pmi_of_remove(struct of_device *dev)
206} 206}
207 207
208static struct of_platform_driver pmi_of_platform_driver = { 208static struct of_platform_driver pmi_of_platform_driver = {
209 .match_table = pmi_match,
210 .probe = pmi_of_probe, 209 .probe = pmi_of_probe,
211 .remove = pmi_of_remove, 210 .remove = pmi_of_remove,
212 .driver = { 211 .driver = {
213 .name = "pmi", 212 .name = "pmi",
213 .owner = THIS_MODULE,
214 .of_match_table = pmi_match,
214 }, 215 },
215}; 216};
216 217
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 149393c02c3f..093e0ae1a941 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -669,8 +669,11 @@ static const struct of_device_id qe_ids[] = {
669}; 669};
670 670
671static struct of_platform_driver qe_driver = { 671static struct of_platform_driver qe_driver = {
672 .driver.name = "fsl-qe", 672 .driver = {
673 .match_table = qe_ids, 673 .name = "fsl-qe",
674 .owner = THIS_MODULE,
675 .of_match_table = qe_ids,
676 },
674 .probe = qe_probe, 677 .probe = qe_probe,
675 .resume = qe_resume, 678 .resume = qe_resume,
676}; 679};
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 62123885a6fa..49714258732e 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -11,6 +11,7 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/mfd/sh_mobile_sdhi.h>
14#include <linux/mtd/physmap.h> 15#include <linux/mtd/physmap.h>
15#include <linux/gpio.h> 16#include <linux/gpio.h>
16#include <linux/interrupt.h> 17#include <linux/interrupt.h>
@@ -442,7 +443,9 @@ static void sdhi0_set_pwr(struct platform_device *pdev, int state)
442} 443}
443 444
444static struct sh_mobile_sdhi_info sdhi0_info = { 445static struct sh_mobile_sdhi_info sdhi0_info = {
445 .set_pwr = sdhi0_set_pwr, 446 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
447 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
448 .set_pwr = sdhi0_set_pwr,
446}; 449};
447 450
448static struct resource sdhi0_resources[] = { 451static struct resource sdhi0_resources[] = {
@@ -478,7 +481,9 @@ static void sdhi1_set_pwr(struct platform_device *pdev, int state)
478} 481}
479 482
480static struct sh_mobile_sdhi_info sdhi1_info = { 483static struct sh_mobile_sdhi_info sdhi1_info = {
481 .set_pwr = sdhi1_set_pwr, 484 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
485 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
486 .set_pwr = sdhi1_set_pwr,
482}; 487};
483 488
484static struct resource sdhi1_resources[] = { 489static struct resource sdhi1_resources[] = {
@@ -769,6 +774,51 @@ static struct platform_device irda_device = {
769 .resource = irda_resources, 774 .resource = irda_resources,
770}; 775};
771 776
777#include <media/ak881x.h>
778#include <media/sh_vou.h>
779
780struct ak881x_pdata ak881x_pdata = {
781 .flags = AK881X_IF_MODE_SLAVE,
782};
783
784static struct i2c_board_info ak8813 = {
785 I2C_BOARD_INFO("ak8813", 0x20),
786 .platform_data = &ak881x_pdata,
787};
788
789struct sh_vou_pdata sh_vou_pdata = {
790 .bus_fmt = SH_VOU_BUS_8BIT,
791 .flags = SH_VOU_HSYNC_LOW | SH_VOU_VSYNC_LOW,
792 .board_info = &ak8813,
793 .i2c_adap = 0,
794 .module_name = "ak881x",
795};
796
797static struct resource sh_vou_resources[] = {
798 [0] = {
799 .start = 0xfe960000,
800 .end = 0xfe962043,
801 .flags = IORESOURCE_MEM,
802 },
803 [1] = {
804 .start = 55,
805 .flags = IORESOURCE_IRQ,
806 },
807};
808
809static struct platform_device vou_device = {
810 .name = "sh-vou",
811 .id = -1,
812 .num_resources = ARRAY_SIZE(sh_vou_resources),
813 .resource = sh_vou_resources,
814 .dev = {
815 .platform_data = &sh_vou_pdata,
816 },
817 .archdata = {
818 .hwblk_id = HWBLK_VOU,
819 },
820};
821
772static struct platform_device *ecovec_devices[] __initdata = { 822static struct platform_device *ecovec_devices[] __initdata = {
773 &heartbeat_device, 823 &heartbeat_device,
774 &nor_flash_device, 824 &nor_flash_device,
@@ -790,6 +840,7 @@ static struct platform_device *ecovec_devices[] __initdata = {
790 &camera_devices[2], 840 &camera_devices[2],
791 &fsi_device, 841 &fsi_device,
792 &irda_device, 842 &irda_device,
843 &vou_device,
793}; 844};
794 845
795#ifdef CONFIG_I2C 846#ifdef CONFIG_I2C
@@ -1179,6 +1230,38 @@ static int __init arch_setup(void)
1179 i2c_register_board_info(1, i2c1_devices, 1230 i2c_register_board_info(1, i2c1_devices,
1180 ARRAY_SIZE(i2c1_devices)); 1231 ARRAY_SIZE(i2c1_devices));
1181 1232
1233 /* VOU */
1234 gpio_request(GPIO_FN_DV_D15, NULL);
1235 gpio_request(GPIO_FN_DV_D14, NULL);
1236 gpio_request(GPIO_FN_DV_D13, NULL);
1237 gpio_request(GPIO_FN_DV_D12, NULL);
1238 gpio_request(GPIO_FN_DV_D11, NULL);
1239 gpio_request(GPIO_FN_DV_D10, NULL);
1240 gpio_request(GPIO_FN_DV_D9, NULL);
1241 gpio_request(GPIO_FN_DV_D8, NULL);
1242 gpio_request(GPIO_FN_DV_CLKI, NULL);
1243 gpio_request(GPIO_FN_DV_CLK, NULL);
1244 gpio_request(GPIO_FN_DV_VSYNC, NULL);
1245 gpio_request(GPIO_FN_DV_HSYNC, NULL);
1246
1247 /* AK8813 power / reset sequence */
1248 gpio_request(GPIO_PTG4, NULL);
1249 gpio_request(GPIO_PTU3, NULL);
1250 /* Reset */
1251 gpio_direction_output(GPIO_PTG4, 0);
1252 /* Power down */
1253 gpio_direction_output(GPIO_PTU3, 1);
1254
1255 udelay(10);
1256
1257 /* Power up, reset */
1258 gpio_set_value(GPIO_PTU3, 0);
1259
1260 udelay(10);
1261
1262 /* Remove reset */
1263 gpio_set_value(GPIO_PTG4, 1);
1264
1182 return platform_add_devices(ecovec_devices, 1265 return platform_add_devices(ecovec_devices,
1183 ARRAY_SIZE(ecovec_devices)); 1266 ARRAY_SIZE(ecovec_devices));
1184} 1267}
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
index b2cd0ed8664e..68994a163f6c 100644
--- a/arch/sh/boards/mach-kfr2r09/setup.c
+++ b/arch/sh/boards/mach-kfr2r09/setup.c
@@ -10,6 +10,8 @@
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/platform_device.h> 11#include <linux/platform_device.h>
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/mfd/sh_mobile_sdhi.h>
14#include <linux/mfd/tmio.h>
13#include <linux/mtd/physmap.h> 15#include <linux/mtd/physmap.h>
14#include <linux/mtd/onenand.h> 16#include <linux/mtd/onenand.h>
15#include <linux/delay.h> 17#include <linux/delay.h>
@@ -356,10 +358,19 @@ static struct resource kfr2r09_sh_sdhi0_resources[] = {
356 }, 358 },
357}; 359};
358 360
361static struct sh_mobile_sdhi_info sh7724_sdhi0_data = {
362 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
363 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
364 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE,
365};
366
359static struct platform_device kfr2r09_sh_sdhi0_device = { 367static struct platform_device kfr2r09_sh_sdhi0_device = {
360 .name = "sh_mobile_sdhi", 368 .name = "sh_mobile_sdhi",
361 .num_resources = ARRAY_SIZE(kfr2r09_sh_sdhi0_resources), 369 .num_resources = ARRAY_SIZE(kfr2r09_sh_sdhi0_resources),
362 .resource = kfr2r09_sh_sdhi0_resources, 370 .resource = kfr2r09_sh_sdhi0_resources,
371 .dev = {
372 .platform_data = &sh7724_sdhi0_data,
373 },
363 .archdata = { 374 .archdata = {
364 .hwblk_id = HWBLK_SDHI0, 375 .hwblk_id = HWBLK_SDHI0,
365 }, 376 },
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index 7da0fc94a01e..87185de20446 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -12,6 +12,7 @@
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/input.h> 13#include <linux/input.h>
14#include <linux/input/sh_keysc.h> 14#include <linux/input/sh_keysc.h>
15#include <linux/mfd/sh_mobile_sdhi.h>
15#include <linux/mtd/physmap.h> 16#include <linux/mtd/physmap.h>
16#include <linux/mtd/nand.h> 17#include <linux/mtd/nand.h>
17#include <linux/i2c.h> 18#include <linux/i2c.h>
@@ -402,10 +403,18 @@ static struct resource sdhi_cn9_resources[] = {
402 }, 403 },
403}; 404};
404 405
406static struct sh_mobile_sdhi_info sh7724_sdhi_data = {
407 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
408 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
409};
410
405static struct platform_device sdhi_cn9_device = { 411static struct platform_device sdhi_cn9_device = {
406 .name = "sh_mobile_sdhi", 412 .name = "sh_mobile_sdhi",
407 .num_resources = ARRAY_SIZE(sdhi_cn9_resources), 413 .num_resources = ARRAY_SIZE(sdhi_cn9_resources),
408 .resource = sdhi_cn9_resources, 414 .resource = sdhi_cn9_resources,
415 .dev = {
416 .platform_data = &sh7724_sdhi_data,
417 },
409 .archdata = { 418 .archdata = {
410 .hwblk_id = HWBLK_SDHI, 419 .hwblk_id = HWBLK_SDHI,
411 }, 420 },
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index e74ae7b0d8bf..f9b82546c2df 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -14,6 +14,7 @@
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/mfd/sh_mobile_sdhi.h>
17#include <linux/mtd/physmap.h> 18#include <linux/mtd/physmap.h>
18#include <linux/delay.h> 19#include <linux/delay.h>
19#include <linux/smc91x.h> 20#include <linux/smc91x.h>
@@ -462,11 +463,19 @@ static struct resource sdhi0_cn7_resources[] = {
462 }, 463 },
463}; 464};
464 465
466static struct sh_mobile_sdhi_info sh7724_sdhi0_data = {
467 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
468 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
469};
470
465static struct platform_device sdhi0_cn7_device = { 471static struct platform_device sdhi0_cn7_device = {
466 .name = "sh_mobile_sdhi", 472 .name = "sh_mobile_sdhi",
467 .id = 0, 473 .id = 0,
468 .num_resources = ARRAY_SIZE(sdhi0_cn7_resources), 474 .num_resources = ARRAY_SIZE(sdhi0_cn7_resources),
469 .resource = sdhi0_cn7_resources, 475 .resource = sdhi0_cn7_resources,
476 .dev = {
477 .platform_data = &sh7724_sdhi0_data,
478 },
470 .archdata = { 479 .archdata = {
471 .hwblk_id = HWBLK_SDHI0, 480 .hwblk_id = HWBLK_SDHI0,
472 }, 481 },
@@ -485,11 +494,19 @@ static struct resource sdhi1_cn8_resources[] = {
485 }, 494 },
486}; 495};
487 496
497static struct sh_mobile_sdhi_info sh7724_sdhi1_data = {
498 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
499 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
500};
501
488static struct platform_device sdhi1_cn8_device = { 502static struct platform_device sdhi1_cn8_device = {
489 .name = "sh_mobile_sdhi", 503 .name = "sh_mobile_sdhi",
490 .id = 1, 504 .id = 1,
491 .num_resources = ARRAY_SIZE(sdhi1_cn8_resources), 505 .num_resources = ARRAY_SIZE(sdhi1_cn8_resources),
492 .resource = sdhi1_cn8_resources, 506 .resource = sdhi1_cn8_resources,
507 .dev = {
508 .platform_data = &sh7724_sdhi1_data,
509 },
493 .archdata = { 510 .archdata = {
494 .hwblk_id = HWBLK_SDHI1, 511 .hwblk_id = HWBLK_SDHI1,
495 }, 512 },
@@ -515,6 +532,52 @@ static struct platform_device irda_device = {
515 .resource = irda_resources, 532 .resource = irda_resources,
516}; 533};
517 534
535#include <media/ak881x.h>
536#include <media/sh_vou.h>
537
538struct ak881x_pdata ak881x_pdata = {
539 .flags = AK881X_IF_MODE_SLAVE,
540};
541
542static struct i2c_board_info ak8813 = {
543 /* With open J18 jumper address is 0x21 */
544 I2C_BOARD_INFO("ak8813", 0x20),
545 .platform_data = &ak881x_pdata,
546};
547
548struct sh_vou_pdata sh_vou_pdata = {
549 .bus_fmt = SH_VOU_BUS_8BIT,
550 .flags = SH_VOU_HSYNC_LOW | SH_VOU_VSYNC_LOW,
551 .board_info = &ak8813,
552 .i2c_adap = 0,
553 .module_name = "ak881x",
554};
555
556static struct resource sh_vou_resources[] = {
557 [0] = {
558 .start = 0xfe960000,
559 .end = 0xfe962043,
560 .flags = IORESOURCE_MEM,
561 },
562 [1] = {
563 .start = 55,
564 .flags = IORESOURCE_IRQ,
565 },
566};
567
568static struct platform_device vou_device = {
569 .name = "sh-vou",
570 .id = -1,
571 .num_resources = ARRAY_SIZE(sh_vou_resources),
572 .resource = sh_vou_resources,
573 .dev = {
574 .platform_data = &sh_vou_pdata,
575 },
576 .archdata = {
577 .hwblk_id = HWBLK_VOU,
578 },
579};
580
518static struct platform_device *ms7724se_devices[] __initdata = { 581static struct platform_device *ms7724se_devices[] __initdata = {
519 &heartbeat_device, 582 &heartbeat_device,
520 &smc91x_eth_device, 583 &smc91x_eth_device,
@@ -530,6 +593,7 @@ static struct platform_device *ms7724se_devices[] __initdata = {
530 &sdhi0_cn7_device, 593 &sdhi0_cn7_device,
531 &sdhi1_cn8_device, 594 &sdhi1_cn8_device,
532 &irda_device, 595 &irda_device,
596 &vou_device,
533}; 597};
534 598
535/* I2C device */ 599/* I2C device */
@@ -614,6 +678,7 @@ static int __init devices_setup(void)
614{ 678{
615 u16 sw = __raw_readw(SW4140); /* select camera, monitor */ 679 u16 sw = __raw_readw(SW4140); /* select camera, monitor */
616 struct clk *clk; 680 struct clk *clk;
681 u16 fpga_out;
617 682
618 /* register board specific self-refresh code */ 683 /* register board specific self-refresh code */
619 sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF | 684 sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF |
@@ -623,14 +688,26 @@ static int __init devices_setup(void)
623 &ms7724se_sdram_leave_start, 688 &ms7724se_sdram_leave_start,
624 &ms7724se_sdram_leave_end); 689 &ms7724se_sdram_leave_end);
625 /* Reset Release */ 690 /* Reset Release */
626 __raw_writew(__raw_readw(FPGA_OUT) & 691 fpga_out = __raw_readw(FPGA_OUT);
627 ~((1 << 1) | /* LAN */ 692 /* bit4: NTSC_PDN, bit5: NTSC_RESET */
628 (1 << 6) | /* VIDEO DAC */ 693 fpga_out &= ~((1 << 1) | /* LAN */
629 (1 << 7) | /* AK4643 */ 694 (1 << 4) | /* AK8813 PDN */
630 (1 << 8) | /* IrDA */ 695 (1 << 5) | /* AK8813 RESET */
631 (1 << 12) | /* USB0 */ 696 (1 << 6) | /* VIDEO DAC */
632 (1 << 14)), /* RMII */ 697 (1 << 7) | /* AK4643 */
633 FPGA_OUT); 698 (1 << 8) | /* IrDA */
699 (1 << 12) | /* USB0 */
700 (1 << 14)); /* RMII */
701 __raw_writew(fpga_out | (1 << 4), FPGA_OUT);
702
703 udelay(10);
704
705 /* AK8813 RESET */
706 __raw_writew(fpga_out | (1 << 5), FPGA_OUT);
707
708 udelay(10);
709
710 __raw_writew(fpga_out, FPGA_OUT);
634 711
635 /* turn on USB clocks, use external clock */ 712 /* turn on USB clocks, use external clock */
636 __raw_writew((__raw_readw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB); 713 __raw_writew((__raw_readw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB);
@@ -862,6 +939,20 @@ static int __init devices_setup(void)
862 lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL; 939 lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL;
863 } 940 }
864 941
942 /* VOU */
943 gpio_request(GPIO_FN_DV_D15, NULL);
944 gpio_request(GPIO_FN_DV_D14, NULL);
945 gpio_request(GPIO_FN_DV_D13, NULL);
946 gpio_request(GPIO_FN_DV_D12, NULL);
947 gpio_request(GPIO_FN_DV_D11, NULL);
948 gpio_request(GPIO_FN_DV_D10, NULL);
949 gpio_request(GPIO_FN_DV_D9, NULL);
950 gpio_request(GPIO_FN_DV_D8, NULL);
951 gpio_request(GPIO_FN_DV_CLKI, NULL);
952 gpio_request(GPIO_FN_DV_CLK, NULL);
953 gpio_request(GPIO_FN_DV_VSYNC, NULL);
954 gpio_request(GPIO_FN_DV_HSYNC, NULL);
955
865 return platform_add_devices(ms7724se_devices, 956 return platform_add_devices(ms7724se_devices,
866 ARRAY_SIZE(ms7724se_devices)); 957 ARRAY_SIZE(ms7724se_devices));
867} 958}
diff --git a/arch/sh/configs/sh7785lcr_32bit_defconfig b/arch/sh/configs/sh7785lcr_32bit_defconfig
index e9af616b2160..71f39c71b04b 100644
--- a/arch/sh/configs/sh7785lcr_32bit_defconfig
+++ b/arch/sh/configs/sh7785lcr_32bit_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.34-rc5 3# Linux kernel version: 2.6.34
4# Tue May 18 17:22:09 2010 4# Mon May 24 08:33:02 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -76,7 +76,7 @@ CONFIG_RCU_FANOUT=32
76# CONFIG_TREE_RCU_TRACE is not set 76# CONFIG_TREE_RCU_TRACE is not set
77CONFIG_IKCONFIG=y 77CONFIG_IKCONFIG=y
78CONFIG_IKCONFIG_PROC=y 78CONFIG_IKCONFIG_PROC=y
79CONFIG_LOG_BUF_SHIFT=14 79CONFIG_LOG_BUF_SHIFT=16
80# CONFIG_CGROUPS is not set 80# CONFIG_CGROUPS is not set
81# CONFIG_SYSFS_DEPRECATED_V2 is not set 81# CONFIG_SYSFS_DEPRECATED_V2 is not set
82# CONFIG_RELAY is not set 82# CONFIG_RELAY is not set
@@ -111,18 +111,17 @@ CONFIG_PERF_USE_VMALLOC=y
111# 111#
112CONFIG_PERF_EVENTS=y 112CONFIG_PERF_EVENTS=y
113CONFIG_PERF_COUNTERS=y 113CONFIG_PERF_COUNTERS=y
114# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
114CONFIG_VM_EVENT_COUNTERS=y 115CONFIG_VM_EVENT_COUNTERS=y
115CONFIG_PCI_QUIRKS=y 116CONFIG_PCI_QUIRKS=y
116CONFIG_COMPAT_BRK=y 117# CONFIG_COMPAT_BRK is not set
117CONFIG_SLAB=y 118CONFIG_SLAB=y
118# CONFIG_SLUB is not set 119# CONFIG_SLUB is not set
119# CONFIG_SLOB is not set 120# CONFIG_SLOB is not set
120CONFIG_PROFILING=y 121CONFIG_PROFILING=y
121CONFIG_TRACEPOINTS=y 122# CONFIG_OPROFILE is not set
122CONFIG_OPROFILE=y
123CONFIG_HAVE_OPROFILE=y 123CONFIG_HAVE_OPROFILE=y
124CONFIG_KPROBES=y 124# CONFIG_KPROBES is not set
125CONFIG_KRETPROBES=y
126CONFIG_HAVE_KPROBES=y 125CONFIG_HAVE_KPROBES=y
127CONFIG_HAVE_KRETPROBES=y 126CONFIG_HAVE_KRETPROBES=y
128CONFIG_HAVE_ARCH_TRACEHOOK=y 127CONFIG_HAVE_ARCH_TRACEHOOK=y
@@ -130,6 +129,7 @@ CONFIG_HAVE_DMA_ATTRS=y
130CONFIG_HAVE_CLK=y 129CONFIG_HAVE_CLK=y
131CONFIG_HAVE_DMA_API_DEBUG=y 130CONFIG_HAVE_DMA_API_DEBUG=y
132CONFIG_HAVE_HW_BREAKPOINT=y 131CONFIG_HAVE_HW_BREAKPOINT=y
132CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y
133 133
134# 134#
135# GCOV-based kernel profiling 135# GCOV-based kernel profiling
@@ -243,8 +243,9 @@ CONFIG_PAGE_OFFSET=0x80000000
243CONFIG_FORCE_MAX_ZONEORDER=11 243CONFIG_FORCE_MAX_ZONEORDER=11
244CONFIG_MEMORY_START=0x40000000 244CONFIG_MEMORY_START=0x40000000
245CONFIG_MEMORY_SIZE=0x20000000 245CONFIG_MEMORY_SIZE=0x20000000
246CONFIG_29BIT=y 246# CONFIG_29BIT is not set
247# CONFIG_PMB is not set 247CONFIG_32BIT=y
248CONFIG_PMB=y
248CONFIG_X2TLB=y 249CONFIG_X2TLB=y
249CONFIG_VSYSCALL=y 250CONFIG_VSYSCALL=y
250# CONFIG_NUMA is not set 251# CONFIG_NUMA is not set
@@ -262,9 +263,9 @@ CONFIG_PAGE_SIZE_4KB=y
262# CONFIG_PAGE_SIZE_8KB is not set 263# CONFIG_PAGE_SIZE_8KB is not set
263# CONFIG_PAGE_SIZE_16KB is not set 264# CONFIG_PAGE_SIZE_16KB is not set
264# CONFIG_PAGE_SIZE_64KB is not set 265# CONFIG_PAGE_SIZE_64KB is not set
265CONFIG_HUGETLB_PAGE_SIZE_64K=y 266# CONFIG_HUGETLB_PAGE_SIZE_64K is not set
266# CONFIG_HUGETLB_PAGE_SIZE_256K is not set 267# CONFIG_HUGETLB_PAGE_SIZE_256K is not set
267# CONFIG_HUGETLB_PAGE_SIZE_1MB is not set 268CONFIG_HUGETLB_PAGE_SIZE_1MB=y
268# CONFIG_HUGETLB_PAGE_SIZE_4MB is not set 269# CONFIG_HUGETLB_PAGE_SIZE_4MB is not set
269# CONFIG_HUGETLB_PAGE_SIZE_64MB is not set 270# CONFIG_HUGETLB_PAGE_SIZE_64MB is not set
270# CONFIG_HUGETLB_PAGE_SIZE_512MB is not set 271# CONFIG_HUGETLB_PAGE_SIZE_512MB is not set
@@ -276,7 +277,7 @@ CONFIG_SPARSEMEM=y
276CONFIG_HAVE_MEMORY_PRESENT=y 277CONFIG_HAVE_MEMORY_PRESENT=y
277CONFIG_SPARSEMEM_STATIC=y 278CONFIG_SPARSEMEM_STATIC=y
278# CONFIG_MEMORY_HOTPLUG is not set 279# CONFIG_MEMORY_HOTPLUG is not set
279CONFIG_SPLIT_PTLOCK_CPUS=4 280CONFIG_SPLIT_PTLOCK_CPUS=999999
280CONFIG_MIGRATION=y 281CONFIG_MIGRATION=y
281# CONFIG_PHYS_ADDR_T_64BIT is not set 282# CONFIG_PHYS_ADDR_T_64BIT is not set
282CONFIG_ZONE_DMA_FLAG=0 283CONFIG_ZONE_DMA_FLAG=0
@@ -298,7 +299,7 @@ CONFIG_CPU_LITTLE_ENDIAN=y
298# CONFIG_CPU_BIG_ENDIAN is not set 299# CONFIG_CPU_BIG_ENDIAN is not set
299CONFIG_SH_FPU=y 300CONFIG_SH_FPU=y
300CONFIG_SH_STORE_QUEUES=y 301CONFIG_SH_STORE_QUEUES=y
301# CONFIG_SPECULATIVE_EXECUTION is not set 302CONFIG_SPECULATIVE_EXECUTION=y
302CONFIG_CPU_HAS_INTEVT=y 303CONFIG_CPU_HAS_INTEVT=y
303CONFIG_CPU_HAS_SR_RB=y 304CONFIG_CPU_HAS_SR_RB=y
304CONFIG_CPU_HAS_FPU=y 305CONFIG_CPU_HAS_FPU=y
@@ -308,7 +309,7 @@ CONFIG_CPU_HAS_FPU=y
308# 309#
309# CONFIG_SH_HIGHLANDER is not set 310# CONFIG_SH_HIGHLANDER is not set
310CONFIG_SH_SH7785LCR=y 311CONFIG_SH_SH7785LCR=y
311CONFIG_SH_SH7785LCR_29BIT_PHYSMAPS=y 312# CONFIG_SH_SH7785LCR_PT is not set
312 313
313# 314#
314# Timer and clock configuration 315# Timer and clock configuration
@@ -371,7 +372,7 @@ CONFIG_SECCOMP=y
371# CONFIG_PREEMPT_VOLUNTARY is not set 372# CONFIG_PREEMPT_VOLUNTARY is not set
372CONFIG_PREEMPT=y 373CONFIG_PREEMPT=y
373CONFIG_GUSA=y 374CONFIG_GUSA=y
374# CONFIG_INTC_USERIMASK is not set 375CONFIG_INTC_USERIMASK=y
375 376
376# 377#
377# Boot options 378# Boot options
@@ -389,6 +390,7 @@ CONFIG_PCI=y
389CONFIG_PCI_DOMAINS=y 390CONFIG_PCI_DOMAINS=y
390# CONFIG_PCIEPORTBUS is not set 391# CONFIG_PCIEPORTBUS is not set
391# CONFIG_ARCH_SUPPORTS_MSI is not set 392# CONFIG_ARCH_SUPPORTS_MSI is not set
393CONFIG_PCI_DEBUG=y
392# CONFIG_PCI_STUB is not set 394# CONFIG_PCI_STUB is not set
393# CONFIG_PCI_IOV is not set 395# CONFIG_PCI_IOV is not set
394# CONFIG_PCCARD is not set 396# CONFIG_PCCARD is not set
@@ -465,6 +467,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
465# CONFIG_RDS is not set 467# CONFIG_RDS is not set
466# CONFIG_TIPC is not set 468# CONFIG_TIPC is not set
467# CONFIG_ATM is not set 469# CONFIG_ATM is not set
470# CONFIG_L2TP is not set
468# CONFIG_BRIDGE is not set 471# CONFIG_BRIDGE is not set
469# CONFIG_NET_DSA is not set 472# CONFIG_NET_DSA is not set
470# CONFIG_VLAN_8021Q is not set 473# CONFIG_VLAN_8021Q is not set
@@ -485,8 +488,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
485# Network testing 488# Network testing
486# 489#
487# CONFIG_NET_PKTGEN is not set 490# CONFIG_NET_PKTGEN is not set
488# CONFIG_NET_TCPPROBE is not set
489# CONFIG_NET_DROP_MONITOR is not set
490# CONFIG_HAMRADIO is not set 491# CONFIG_HAMRADIO is not set
491# CONFIG_CAN is not set 492# CONFIG_CAN is not set
492# CONFIG_IRDA is not set 493# CONFIG_IRDA is not set
@@ -499,11 +500,20 @@ CONFIG_WIRELESS=y
499# 500#
500# CFG80211 needs to be enabled for MAC80211 501# CFG80211 needs to be enabled for MAC80211
501# 502#
503
504#
505# Some wireless drivers require a rate control algorithm
506#
502# CONFIG_WIMAX is not set 507# CONFIG_WIMAX is not set
503# CONFIG_RFKILL is not set 508# CONFIG_RFKILL is not set
504# CONFIG_NET_9P is not set 509# CONFIG_NET_9P is not set
505 510
506# 511#
512# CAIF Support
513#
514# CONFIG_CAIF is not set
515
516#
507# Device Drivers 517# Device Drivers
508# 518#
509 519
@@ -514,7 +524,11 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
514# CONFIG_DEVTMPFS is not set 524# CONFIG_DEVTMPFS is not set
515CONFIG_STANDALONE=y 525CONFIG_STANDALONE=y
516CONFIG_PREVENT_FIRMWARE_BUILD=y 526CONFIG_PREVENT_FIRMWARE_BUILD=y
517# CONFIG_FW_LOADER is not set 527CONFIG_FW_LOADER=y
528CONFIG_FIRMWARE_IN_KERNEL=y
529CONFIG_EXTRA_FIRMWARE=""
530# CONFIG_DEBUG_DRIVER is not set
531# CONFIG_DEBUG_DEVRES is not set
518# CONFIG_SYS_HYPERVISOR is not set 532# CONFIG_SYS_HYPERVISOR is not set
519# CONFIG_CONNECTOR is not set 533# CONFIG_CONNECTOR is not set
520CONFIG_MTD=y 534CONFIG_MTD=y
@@ -537,6 +551,7 @@ CONFIG_MTD_BLOCK=y
537# CONFIG_INFTL is not set 551# CONFIG_INFTL is not set
538# CONFIG_RFD_FTL is not set 552# CONFIG_RFD_FTL is not set
539# CONFIG_SSFDC is not set 553# CONFIG_SSFDC is not set
554# CONFIG_SM_FTL is not set
540# CONFIG_MTD_OOPS is not set 555# CONFIG_MTD_OOPS is not set
541 556
542# 557#
@@ -668,7 +683,9 @@ CONFIG_ATA=y
668CONFIG_ATA_VERBOSE_ERROR=y 683CONFIG_ATA_VERBOSE_ERROR=y
669CONFIG_SATA_PMP=y 684CONFIG_SATA_PMP=y
670# CONFIG_SATA_AHCI is not set 685# CONFIG_SATA_AHCI is not set
686# CONFIG_SATA_AHCI_PLATFORM is not set
671# CONFIG_SATA_SIL24 is not set 687# CONFIG_SATA_SIL24 is not set
688# CONFIG_SATA_INIC162X is not set
672CONFIG_ATA_SFF=y 689CONFIG_ATA_SFF=y
673# CONFIG_SATA_SVW is not set 690# CONFIG_SATA_SVW is not set
674# CONFIG_ATA_PIIX is not set 691# CONFIG_ATA_PIIX is not set
@@ -683,7 +700,6 @@ CONFIG_SATA_SIL=y
683# CONFIG_SATA_ULI is not set 700# CONFIG_SATA_ULI is not set
684# CONFIG_SATA_VIA is not set 701# CONFIG_SATA_VIA is not set
685# CONFIG_SATA_VITESSE is not set 702# CONFIG_SATA_VITESSE is not set
686# CONFIG_SATA_INIC162X is not set
687# CONFIG_PATA_ALI is not set 703# CONFIG_PATA_ALI is not set
688# CONFIG_PATA_AMD is not set 704# CONFIG_PATA_AMD is not set
689# CONFIG_PATA_ARTOP is not set 705# CONFIG_PATA_ARTOP is not set
@@ -753,8 +769,36 @@ CONFIG_NETDEVICES=y
753# CONFIG_TUN is not set 769# CONFIG_TUN is not set
754# CONFIG_VETH is not set 770# CONFIG_VETH is not set
755# CONFIG_ARCNET is not set 771# CONFIG_ARCNET is not set
756# CONFIG_NET_ETHERNET is not set 772# CONFIG_PHYLIB is not set
773CONFIG_NET_ETHERNET=y
757CONFIG_MII=y 774CONFIG_MII=y
775# CONFIG_AX88796 is not set
776# CONFIG_STNIC is not set
777# CONFIG_HAPPYMEAL is not set
778# CONFIG_SUNGEM is not set
779# CONFIG_CASSINI is not set
780CONFIG_NET_VENDOR_3COM=y
781CONFIG_VORTEX=y
782# CONFIG_TYPHOON is not set
783# CONFIG_SMC91X is not set
784# CONFIG_ETHOC is not set
785# CONFIG_SMC911X is not set
786# CONFIG_SMSC911X is not set
787# CONFIG_DNET is not set
788# CONFIG_NET_TULIP is not set
789# CONFIG_HP100 is not set
790# CONFIG_IBM_NEW_EMAC_ZMII is not set
791# CONFIG_IBM_NEW_EMAC_RGMII is not set
792# CONFIG_IBM_NEW_EMAC_TAH is not set
793# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
794# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
795# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
796# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
797# CONFIG_NET_PCI is not set
798# CONFIG_B44 is not set
799# CONFIG_KS8842 is not set
800# CONFIG_KS8851_MLL is not set
801# CONFIG_ATL2 is not set
758CONFIG_NETDEV_1000=y 802CONFIG_NETDEV_1000=y
759# CONFIG_ACENIC is not set 803# CONFIG_ACENIC is not set
760# CONFIG_DL2K is not set 804# CONFIG_DL2K is not set
@@ -836,6 +880,7 @@ CONFIG_INPUT_KEYBOARD=y
836CONFIG_KEYBOARD_ATKBD=y 880CONFIG_KEYBOARD_ATKBD=y
837# CONFIG_QT2160 is not set 881# CONFIG_QT2160 is not set
838# CONFIG_KEYBOARD_LKKBD is not set 882# CONFIG_KEYBOARD_LKKBD is not set
883# CONFIG_KEYBOARD_TCA6416 is not set
839# CONFIG_KEYBOARD_MAX7359 is not set 884# CONFIG_KEYBOARD_MAX7359 is not set
840# CONFIG_KEYBOARD_NEWTON is not set 885# CONFIG_KEYBOARD_NEWTON is not set
841# CONFIG_KEYBOARD_OPENCORES is not set 886# CONFIG_KEYBOARD_OPENCORES is not set
@@ -884,6 +929,7 @@ CONFIG_HW_CONSOLE=y
884CONFIG_VT_HW_CONSOLE_BINDING=y 929CONFIG_VT_HW_CONSOLE_BINDING=y
885# CONFIG_DEVKMEM is not set 930# CONFIG_DEVKMEM is not set
886# CONFIG_SERIAL_NONSTANDARD is not set 931# CONFIG_SERIAL_NONSTANDARD is not set
932# CONFIG_N_GSM is not set
887# CONFIG_NOZOMI is not set 933# CONFIG_NOZOMI is not set
888 934
889# 935#
@@ -901,6 +947,8 @@ CONFIG_SERIAL_CORE=y
901CONFIG_SERIAL_CORE_CONSOLE=y 947CONFIG_SERIAL_CORE_CONSOLE=y
902# CONFIG_SERIAL_JSM is not set 948# CONFIG_SERIAL_JSM is not set
903# CONFIG_SERIAL_TIMBERDALE is not set 949# CONFIG_SERIAL_TIMBERDALE is not set
950# CONFIG_SERIAL_ALTERA_JTAGUART is not set
951# CONFIG_SERIAL_ALTERA_UART is not set
904CONFIG_UNIX98_PTYS=y 952CONFIG_UNIX98_PTYS=y
905CONFIG_DEVPTS_MULTIPLE_INSTANCES=y 953CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
906# CONFIG_LEGACY_PTYS is not set 954# CONFIG_LEGACY_PTYS is not set
@@ -1071,7 +1119,7 @@ CONFIG_FB_CFB_IMAGEBLIT=y
1071# CONFIG_FB_SIS is not set 1119# CONFIG_FB_SIS is not set
1072# CONFIG_FB_VIA is not set 1120# CONFIG_FB_VIA is not set
1073# CONFIG_FB_NEOMAGIC is not set 1121# CONFIG_FB_NEOMAGIC is not set
1074# CONFIG_FB_KYRO is not set 1122CONFIG_FB_KYRO=y
1075# CONFIG_FB_3DFX is not set 1123# CONFIG_FB_3DFX is not set
1076# CONFIG_FB_VOODOO1 is not set 1124# CONFIG_FB_VOODOO1 is not set
1077# CONFIG_FB_VT8623 is not set 1125# CONFIG_FB_VT8623 is not set
@@ -1097,15 +1145,15 @@ CONFIG_FB_SM501=y
1097# 1145#
1098CONFIG_DUMMY_CONSOLE=y 1146CONFIG_DUMMY_CONSOLE=y
1099CONFIG_FRAMEBUFFER_CONSOLE=y 1147CONFIG_FRAMEBUFFER_CONSOLE=y
1100# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set 1148CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
1101# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set 1149# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
1102# CONFIG_FONTS is not set 1150# CONFIG_FONTS is not set
1103CONFIG_FONT_8x8=y 1151CONFIG_FONT_8x8=y
1104CONFIG_FONT_8x16=y 1152CONFIG_FONT_8x16=y
1105CONFIG_LOGO=y 1153CONFIG_LOGO=y
1106# CONFIG_LOGO_LINUX_MONO is not set 1154CONFIG_LOGO_LINUX_MONO=y
1107# CONFIG_LOGO_LINUX_VGA16 is not set 1155CONFIG_LOGO_LINUX_VGA16=y
1108# CONFIG_LOGO_LINUX_CLUT224 is not set 1156CONFIG_LOGO_LINUX_CLUT224=y
1109CONFIG_LOGO_SUPERH_MONO=y 1157CONFIG_LOGO_SUPERH_MONO=y
1110CONFIG_LOGO_SUPERH_VGA16=y 1158CONFIG_LOGO_SUPERH_VGA16=y
1111CONFIG_LOGO_SUPERH_CLUT224=y 1159CONFIG_LOGO_SUPERH_CLUT224=y
@@ -1129,15 +1177,18 @@ CONFIG_SND_SEQ_HRTIMER_DEFAULT=y
1129CONFIG_SND_DYNAMIC_MINORS=y 1177CONFIG_SND_DYNAMIC_MINORS=y
1130# CONFIG_SND_SUPPORT_OLD_API is not set 1178# CONFIG_SND_SUPPORT_OLD_API is not set
1131# CONFIG_SND_VERBOSE_PROCFS is not set 1179# CONFIG_SND_VERBOSE_PROCFS is not set
1132# CONFIG_SND_VERBOSE_PRINTK is not set 1180CONFIG_SND_VERBOSE_PRINTK=y
1133# CONFIG_SND_DEBUG is not set 1181CONFIG_SND_DEBUG=y
1182CONFIG_SND_DEBUG_VERBOSE=y
1183CONFIG_SND_VMASTER=y
1134CONFIG_SND_RAWMIDI_SEQ=y 1184CONFIG_SND_RAWMIDI_SEQ=y
1135CONFIG_SND_OPL3_LIB_SEQ=y 1185CONFIG_SND_OPL3_LIB_SEQ=y
1136# CONFIG_SND_OPL4_LIB_SEQ is not set 1186# CONFIG_SND_OPL4_LIB_SEQ is not set
1137# CONFIG_SND_SBAWE_SEQ is not set 1187# CONFIG_SND_SBAWE_SEQ is not set
1138# CONFIG_SND_EMU10K1_SEQ is not set 1188CONFIG_SND_EMU10K1_SEQ=y
1139CONFIG_SND_MPU401_UART=y 1189CONFIG_SND_MPU401_UART=y
1140CONFIG_SND_OPL3_LIB=y 1190CONFIG_SND_OPL3_LIB=y
1191CONFIG_SND_AC97_CODEC=y
1141# CONFIG_SND_DRIVERS is not set 1192# CONFIG_SND_DRIVERS is not set
1142CONFIG_SND_PCI=y 1193CONFIG_SND_PCI=y
1143# CONFIG_SND_AD1889 is not set 1194# CONFIG_SND_AD1889 is not set
@@ -1172,7 +1223,7 @@ CONFIG_SND_CMIPCI=y
1172# CONFIG_SND_INDIGODJ is not set 1223# CONFIG_SND_INDIGODJ is not set
1173# CONFIG_SND_INDIGOIOX is not set 1224# CONFIG_SND_INDIGOIOX is not set
1174# CONFIG_SND_INDIGODJX is not set 1225# CONFIG_SND_INDIGODJX is not set
1175# CONFIG_SND_EMU10K1 is not set 1226CONFIG_SND_EMU10K1=y
1176# CONFIG_SND_EMU10K1X is not set 1227# CONFIG_SND_EMU10K1X is not set
1177# CONFIG_SND_ENS1370 is not set 1228# CONFIG_SND_ENS1370 is not set
1178# CONFIG_SND_ENS1371 is not set 1229# CONFIG_SND_ENS1371 is not set
@@ -1211,6 +1262,7 @@ CONFIG_SND_USB=y
1211# CONFIG_SND_USB_CAIAQ is not set 1262# CONFIG_SND_USB_CAIAQ is not set
1212# CONFIG_SND_SOC is not set 1263# CONFIG_SND_SOC is not set
1213# CONFIG_SOUND_PRIME is not set 1264# CONFIG_SOUND_PRIME is not set
1265CONFIG_AC97_BUS=y
1214CONFIG_HID_SUPPORT=y 1266CONFIG_HID_SUPPORT=y
1215CONFIG_HID=y 1267CONFIG_HID=y
1216# CONFIG_HIDRAW is not set 1268# CONFIG_HIDRAW is not set
@@ -1226,44 +1278,42 @@ CONFIG_USB_HID=y
1226# Special HID drivers 1278# Special HID drivers
1227# 1279#
1228# CONFIG_HID_3M_PCT is not set 1280# CONFIG_HID_3M_PCT is not set
1229CONFIG_HID_A4TECH=m 1281# CONFIG_HID_A4TECH is not set
1230CONFIG_HID_APPLE=m 1282# CONFIG_HID_APPLE is not set
1231CONFIG_HID_BELKIN=m 1283# CONFIG_HID_BELKIN is not set
1232CONFIG_HID_CHERRY=m 1284# CONFIG_HID_CANDO is not set
1233CONFIG_HID_CHICONY=m 1285# CONFIG_HID_CHERRY is not set
1234CONFIG_HID_CYPRESS=m 1286# CONFIG_HID_CHICONY is not set
1235CONFIG_HID_DRAGONRISE=m 1287# CONFIG_HID_PRODIKEYS is not set
1236# CONFIG_DRAGONRISE_FF is not set 1288# CONFIG_HID_CYPRESS is not set
1237CONFIG_HID_EZKEY=m 1289# CONFIG_HID_DRAGONRISE is not set
1238CONFIG_HID_KYE=m 1290# CONFIG_HID_EGALAX is not set
1239CONFIG_HID_GYRATION=m 1291# CONFIG_HID_EZKEY is not set
1240CONFIG_HID_TWINHAN=m 1292# CONFIG_HID_KYE is not set
1241CONFIG_HID_KENSINGTON=m 1293# CONFIG_HID_GYRATION is not set
1242CONFIG_HID_LOGITECH=m 1294# CONFIG_HID_TWINHAN is not set
1243# CONFIG_LOGITECH_FF is not set 1295# CONFIG_HID_KENSINGTON is not set
1244# CONFIG_LOGIRUMBLEPAD2_FF is not set 1296# CONFIG_HID_LOGITECH is not set
1245# CONFIG_LOGIG940_FF is not set 1297# CONFIG_HID_MICROSOFT is not set
1246CONFIG_HID_MICROSOFT=m
1247# CONFIG_HID_MOSART is not set 1298# CONFIG_HID_MOSART is not set
1248CONFIG_HID_MONTEREY=m 1299# CONFIG_HID_MONTEREY is not set
1249CONFIG_HID_NTRIG=m 1300# CONFIG_HID_NTRIG is not set
1250# CONFIG_HID_ORTEK is not set 1301# CONFIG_HID_ORTEK is not set
1251CONFIG_HID_PANTHERLORD=m 1302# CONFIG_HID_PANTHERLORD is not set
1252# CONFIG_PANTHERLORD_FF is not set 1303# CONFIG_HID_PETALYNX is not set
1253CONFIG_HID_PETALYNX=m 1304# CONFIG_HID_PICOLCD is not set
1254# CONFIG_HID_QUANTA is not set 1305# CONFIG_HID_QUANTA is not set
1255CONFIG_HID_SAMSUNG=m 1306# CONFIG_HID_ROCCAT_KONE is not set
1256CONFIG_HID_SONY=m 1307# CONFIG_HID_SAMSUNG is not set
1308# CONFIG_HID_SONY is not set
1257# CONFIG_HID_STANTUM is not set 1309# CONFIG_HID_STANTUM is not set
1258CONFIG_HID_SUNPLUS=m 1310# CONFIG_HID_SUNPLUS is not set
1259CONFIG_HID_GREENASIA=m 1311# CONFIG_HID_GREENASIA is not set
1260# CONFIG_GREENASIA_FF is not set 1312# CONFIG_HID_SMARTJOYPLUS is not set
1261CONFIG_HID_SMARTJOYPLUS=m 1313# CONFIG_HID_TOPSEED is not set
1262# CONFIG_SMARTJOYPLUS_FF is not set
1263CONFIG_HID_TOPSEED=m
1264# CONFIG_HID_THRUSTMASTER is not set 1314# CONFIG_HID_THRUSTMASTER is not set
1265CONFIG_HID_ZEROPLUS=m 1315# CONFIG_HID_ZEROPLUS is not set
1266# CONFIG_ZEROPLUS_FF is not set 1316# CONFIG_HID_ZYDACRON is not set
1267CONFIG_USB_SUPPORT=y 1317CONFIG_USB_SUPPORT=y
1268CONFIG_USB_ARCH_HAS_HCD=y 1318CONFIG_USB_ARCH_HAS_HCD=y
1269CONFIG_USB_ARCH_HAS_OHCI=y 1319CONFIG_USB_ARCH_HAS_OHCI=y
@@ -1276,9 +1326,8 @@ CONFIG_USB=y
1276# Miscellaneous USB options 1326# Miscellaneous USB options
1277# 1327#
1278# CONFIG_USB_DEVICEFS is not set 1328# CONFIG_USB_DEVICEFS is not set
1279CONFIG_USB_DEVICE_CLASS=y 1329# CONFIG_USB_DEVICE_CLASS is not set
1280# CONFIG_USB_DYNAMIC_MINORS is not set 1330# CONFIG_USB_DYNAMIC_MINORS is not set
1281# CONFIG_USB_OTG is not set
1282# CONFIG_USB_OTG_WHITELIST is not set 1331# CONFIG_USB_OTG_WHITELIST is not set
1283# CONFIG_USB_OTG_BLACKLIST_HUB is not set 1332# CONFIG_USB_OTG_BLACKLIST_HUB is not set
1284# CONFIG_USB_MON is not set 1333# CONFIG_USB_MON is not set
@@ -1290,9 +1339,7 @@ CONFIG_USB_DEVICE_CLASS=y
1290# 1339#
1291# CONFIG_USB_C67X00_HCD is not set 1340# CONFIG_USB_C67X00_HCD is not set
1292# CONFIG_USB_XHCI_HCD is not set 1341# CONFIG_USB_XHCI_HCD is not set
1293CONFIG_USB_EHCI_HCD=m 1342# CONFIG_USB_EHCI_HCD is not set
1294# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1295# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1296# CONFIG_USB_OXU210HP_HCD is not set 1343# CONFIG_USB_OXU210HP_HCD is not set
1297# CONFIG_USB_ISP116X_HCD is not set 1344# CONFIG_USB_ISP116X_HCD is not set
1298# CONFIG_USB_ISP1760_HCD is not set 1345# CONFIG_USB_ISP1760_HCD is not set
@@ -1361,7 +1408,6 @@ CONFIG_USB_STORAGE=y
1361# CONFIG_USB_IDMOUSE is not set 1408# CONFIG_USB_IDMOUSE is not set
1362# CONFIG_USB_FTDI_ELAN is not set 1409# CONFIG_USB_FTDI_ELAN is not set
1363# CONFIG_USB_APPLEDISPLAY is not set 1410# CONFIG_USB_APPLEDISPLAY is not set
1364# CONFIG_USB_SISUSBVGA is not set
1365# CONFIG_USB_LD is not set 1411# CONFIG_USB_LD is not set
1366# CONFIG_USB_TRANCEVIBRATOR is not set 1412# CONFIG_USB_TRANCEVIBRATOR is not set
1367# CONFIG_USB_IOWARRIOR is not set 1413# CONFIG_USB_IOWARRIOR is not set
@@ -1464,6 +1510,7 @@ CONFIG_DMADEVICES=y
1464# 1510#
1465# DMA Devices 1511# DMA Devices
1466# 1512#
1513# CONFIG_TIMB_DMA is not set
1467# CONFIG_AUXDISPLAY is not set 1514# CONFIG_AUXDISPLAY is not set
1468CONFIG_UIO=m 1515CONFIG_UIO=m
1469# CONFIG_UIO_CIF is not set 1516# CONFIG_UIO_CIF is not set
@@ -1473,10 +1520,6 @@ CONFIG_UIO=m
1473# CONFIG_UIO_SERCOS3 is not set 1520# CONFIG_UIO_SERCOS3 is not set
1474# CONFIG_UIO_PCI_GENERIC is not set 1521# CONFIG_UIO_PCI_GENERIC is not set
1475# CONFIG_UIO_NETX is not set 1522# CONFIG_UIO_NETX is not set
1476
1477#
1478# TI VLYNQ
1479#
1480# CONFIG_STAGING is not set 1523# CONFIG_STAGING is not set
1481 1524
1482# 1525#
@@ -1653,63 +1696,75 @@ CONFIG_MAGIC_SYSRQ=y
1653# CONFIG_UNUSED_SYMBOLS is not set 1696# CONFIG_UNUSED_SYMBOLS is not set
1654CONFIG_DEBUG_FS=y 1697CONFIG_DEBUG_FS=y
1655# CONFIG_HEADERS_CHECK is not set 1698# CONFIG_HEADERS_CHECK is not set
1656# CONFIG_DEBUG_KERNEL is not set 1699CONFIG_DEBUG_KERNEL=y
1700# CONFIG_DEBUG_SHIRQ is not set
1701CONFIG_DETECT_SOFTLOCKUP=y
1702# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1703CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1704CONFIG_DETECT_HUNG_TASK=y
1705# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
1706CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
1657CONFIG_SCHED_DEBUG=y 1707CONFIG_SCHED_DEBUG=y
1658CONFIG_SCHEDSTATS=y 1708CONFIG_SCHEDSTATS=y
1659CONFIG_TRACE_IRQFLAGS=y 1709# CONFIG_TIMER_STATS is not set
1710# CONFIG_DEBUG_OBJECTS is not set
1711# CONFIG_DEBUG_SLAB is not set
1712CONFIG_DEBUG_KMEMLEAK=y
1713CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=400
1714# CONFIG_DEBUG_KMEMLEAK_TEST is not set
1715CONFIG_DEBUG_PREEMPT=y
1716# CONFIG_DEBUG_RT_MUTEXES is not set
1717# CONFIG_RT_MUTEX_TESTER is not set
1718CONFIG_DEBUG_SPINLOCK=y
1719CONFIG_DEBUG_MUTEXES=y
1720# CONFIG_DEBUG_LOCK_ALLOC is not set
1721# CONFIG_PROVE_LOCKING is not set
1722# CONFIG_LOCK_STAT is not set
1723CONFIG_DEBUG_SPINLOCK_SLEEP=y
1724# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1660CONFIG_STACKTRACE=y 1725CONFIG_STACKTRACE=y
1726# CONFIG_DEBUG_KOBJECT is not set
1661CONFIG_DEBUG_BUGVERBOSE=y 1727CONFIG_DEBUG_BUGVERBOSE=y
1728CONFIG_DEBUG_INFO=y
1729# CONFIG_DEBUG_VM is not set
1730# CONFIG_DEBUG_WRITECOUNT is not set
1662# CONFIG_DEBUG_MEMORY_INIT is not set 1731# CONFIG_DEBUG_MEMORY_INIT is not set
1732# CONFIG_DEBUG_LIST is not set
1733# CONFIG_DEBUG_SG is not set
1734# CONFIG_DEBUG_NOTIFIERS is not set
1735# CONFIG_DEBUG_CREDENTIALS is not set
1663CONFIG_FRAME_POINTER=y 1736CONFIG_FRAME_POINTER=y
1737# CONFIG_RCU_TORTURE_TEST is not set
1664# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1738# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1739# CONFIG_BACKTRACE_SELF_TEST is not set
1740# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1741# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
1665# CONFIG_LKDTM is not set 1742# CONFIG_LKDTM is not set
1743# CONFIG_FAULT_INJECTION is not set
1666CONFIG_LATENCYTOP=y 1744CONFIG_LATENCYTOP=y
1667CONFIG_SYSCTL_SYSCALL_CHECK=y 1745CONFIG_SYSCTL_SYSCALL_CHECK=y
1668CONFIG_NOP_TRACER=y 1746# CONFIG_PAGE_POISONING is not set
1669CONFIG_HAVE_FTRACE_NMI_ENTER=y
1670CONFIG_HAVE_FUNCTION_TRACER=y 1747CONFIG_HAVE_FUNCTION_TRACER=y
1671CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 1748CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
1672CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y 1749CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
1673CONFIG_HAVE_DYNAMIC_FTRACE=y 1750CONFIG_HAVE_DYNAMIC_FTRACE=y
1674CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y 1751CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
1675CONFIG_HAVE_SYSCALL_TRACEPOINTS=y 1752CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
1676CONFIG_TRACER_MAX_TRACE=y
1677CONFIG_RING_BUFFER=y
1678CONFIG_FTRACE_NMI_ENTER=y
1679CONFIG_EVENT_TRACING=y
1680CONFIG_CONTEXT_SWITCH_TRACER=y
1681CONFIG_RING_BUFFER_ALLOW_SWAP=y
1682CONFIG_TRACING=y
1683CONFIG_GENERIC_TRACER=y
1684CONFIG_TRACING_SUPPORT=y 1753CONFIG_TRACING_SUPPORT=y
1685CONFIG_FTRACE=y 1754# CONFIG_FTRACE is not set
1686CONFIG_FUNCTION_TRACER=y
1687CONFIG_FUNCTION_GRAPH_TRACER=y
1688CONFIG_IRQSOFF_TRACER=y
1689# CONFIG_PREEMPT_TRACER is not set
1690CONFIG_SCHED_TRACER=y
1691# CONFIG_FTRACE_SYSCALLS is not set
1692# CONFIG_BOOT_TRACER is not set
1693CONFIG_BRANCH_PROFILE_NONE=y
1694# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
1695# CONFIG_PROFILE_ALL_BRANCHES is not set
1696# CONFIG_KSYM_TRACER is not set
1697CONFIG_STACK_TRACER=y
1698CONFIG_KMEMTRACE=y
1699CONFIG_WORKQUEUE_TRACER=y
1700# CONFIG_BLK_DEV_IO_TRACE is not set
1701CONFIG_DYNAMIC_FTRACE=y
1702# CONFIG_FUNCTION_PROFILER is not set
1703CONFIG_FTRACE_MCOUNT_RECORD=y
1704# CONFIG_FTRACE_STARTUP_TEST is not set
1705# CONFIG_RING_BUFFER_BENCHMARK is not set
1706# CONFIG_DYNAMIC_DEBUG is not set 1755# CONFIG_DYNAMIC_DEBUG is not set
1707# CONFIG_DMA_API_DEBUG is not set 1756# CONFIG_DMA_API_DEBUG is not set
1757# CONFIG_ATOMIC64_SELFTEST is not set
1708# CONFIG_SAMPLES is not set 1758# CONFIG_SAMPLES is not set
1709CONFIG_HAVE_ARCH_KGDB=y 1759CONFIG_HAVE_ARCH_KGDB=y
1760# CONFIG_KGDB is not set
1710# CONFIG_SH_STANDARD_BIOS is not set 1761# CONFIG_SH_STANDARD_BIOS is not set
1711CONFIG_DWARF_UNWINDER=y 1762# CONFIG_STACK_DEBUG is not set
1712CONFIG_MCOUNT=y 1763# CONFIG_DEBUG_STACK_USAGE is not set
1764# CONFIG_4KSTACKS is not set
1765CONFIG_DUMP_CODE=y
1766# CONFIG_DWARF_UNWINDER is not set
1767# CONFIG_SH_NO_BSS_INIT is not set
1713 1768
1714# 1769#
1715# Security options 1770# Security options
@@ -1820,7 +1875,7 @@ CONFIG_CRYPTO_DES=y
1820# CONFIG_CRYPTO_ANSI_CPRNG is not set 1875# CONFIG_CRYPTO_ANSI_CPRNG is not set
1821# CONFIG_CRYPTO_HW is not set 1876# CONFIG_CRYPTO_HW is not set
1822# CONFIG_VIRTUALIZATION is not set 1877# CONFIG_VIRTUALIZATION is not set
1823CONFIG_BINARY_PRINTF=y 1878# CONFIG_BINARY_PRINTF is not set
1824 1879
1825# 1880#
1826# Library routines 1881# Library routines
diff --git a/arch/sh/include/asm/dmaengine.h b/arch/sh/include/asm/dmaengine.h
deleted file mode 100644
index 2a02b611a9ad..000000000000
--- a/arch/sh/include/asm/dmaengine.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * Header for the new SH dmaengine driver
3 *
4 * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef ASM_DMAENGINE_H
11#define ASM_DMAENGINE_H
12
13#include <linux/sh_dma.h>
14
15enum {
16 SHDMA_SLAVE_SCIF0_TX,
17 SHDMA_SLAVE_SCIF0_RX,
18 SHDMA_SLAVE_SCIF1_TX,
19 SHDMA_SLAVE_SCIF1_RX,
20 SHDMA_SLAVE_SCIF2_TX,
21 SHDMA_SLAVE_SCIF2_RX,
22 SHDMA_SLAVE_SCIF3_TX,
23 SHDMA_SLAVE_SCIF3_RX,
24 SHDMA_SLAVE_SCIF4_TX,
25 SHDMA_SLAVE_SCIF4_RX,
26 SHDMA_SLAVE_SCIF5_TX,
27 SHDMA_SLAVE_SCIF5_RX,
28 SHDMA_SLAVE_SIUA_TX,
29 SHDMA_SLAVE_SIUA_RX,
30 SHDMA_SLAVE_SIUB_TX,
31 SHDMA_SLAVE_SIUB_RX,
32};
33
34#endif
diff --git a/arch/sh/include/asm/siu.h b/arch/sh/include/asm/siu.h
index e8d4142baf59..1d95c78808d1 100644
--- a/arch/sh/include/asm/siu.h
+++ b/arch/sh/include/asm/siu.h
@@ -11,8 +11,6 @@
11#ifndef ASM_SIU_H 11#ifndef ASM_SIU_H
12#define ASM_SIU_H 12#define ASM_SIU_H
13 13
14#include <asm/dmaengine.h>
15
16struct device; 14struct device;
17 15
18struct siu_platform { 16struct siu_platform {
diff --git a/arch/sh/include/cpu-sh4/cpu/sh7722.h b/arch/sh/include/cpu-sh4/cpu/sh7722.h
index 48560407cbe1..7a5b8a331b4a 100644
--- a/arch/sh/include/cpu-sh4/cpu/sh7722.h
+++ b/arch/sh/include/cpu-sh4/cpu/sh7722.h
@@ -235,4 +235,19 @@ enum {
235 HWBLK_NR, 235 HWBLK_NR,
236}; 236};
237 237
238enum {
239 SHDMA_SLAVE_SCIF0_TX,
240 SHDMA_SLAVE_SCIF0_RX,
241 SHDMA_SLAVE_SCIF1_TX,
242 SHDMA_SLAVE_SCIF1_RX,
243 SHDMA_SLAVE_SCIF2_TX,
244 SHDMA_SLAVE_SCIF2_RX,
245 SHDMA_SLAVE_SIUA_TX,
246 SHDMA_SLAVE_SIUA_RX,
247 SHDMA_SLAVE_SIUB_TX,
248 SHDMA_SLAVE_SIUB_RX,
249 SHDMA_SLAVE_SDHI0_TX,
250 SHDMA_SLAVE_SDHI0_RX,
251};
252
238#endif /* __ASM_SH7722_H__ */ 253#endif /* __ASM_SH7722_H__ */
diff --git a/arch/sh/include/cpu-sh4/cpu/sh7724.h b/arch/sh/include/cpu-sh4/cpu/sh7724.h
index 0cd1f71a1116..fbbf550cc529 100644
--- a/arch/sh/include/cpu-sh4/cpu/sh7724.h
+++ b/arch/sh/include/cpu-sh4/cpu/sh7724.h
@@ -283,4 +283,23 @@ enum {
283 HWBLK_NR, 283 HWBLK_NR,
284}; 284};
285 285
286enum {
287 SHDMA_SLAVE_SCIF0_TX,
288 SHDMA_SLAVE_SCIF0_RX,
289 SHDMA_SLAVE_SCIF1_TX,
290 SHDMA_SLAVE_SCIF1_RX,
291 SHDMA_SLAVE_SCIF2_TX,
292 SHDMA_SLAVE_SCIF2_RX,
293 SHDMA_SLAVE_SCIF3_TX,
294 SHDMA_SLAVE_SCIF3_RX,
295 SHDMA_SLAVE_SCIF4_TX,
296 SHDMA_SLAVE_SCIF4_RX,
297 SHDMA_SLAVE_SCIF5_TX,
298 SHDMA_SLAVE_SCIF5_RX,
299 SHDMA_SLAVE_SDHI0_TX,
300 SHDMA_SLAVE_SDHI0_RX,
301 SHDMA_SLAVE_SDHI1_TX,
302 SHDMA_SLAVE_SDHI1_RX,
303};
304
286#endif /* __ASM_SH7724_H__ */ 305#endif /* __ASM_SH7724_H__ */
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7786.c b/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
index 105a6d41b569..597c9fbe49c6 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
@@ -13,7 +13,6 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/clk.h>
17#include <asm/clkdev.h> 16#include <asm/clkdev.h>
18#include <asm/clock.h> 17#include <asm/clock.h>
19#include <asm/freq.h> 18#include <asm/freq.h>
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
index 24c6167a7181..156ccc960015 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
@@ -17,7 +17,6 @@
17#include <linux/usb/m66592.h> 17#include <linux/usb/m66592.h>
18 18
19#include <asm/clock.h> 19#include <asm/clock.h>
20#include <asm/dmaengine.h>
21#include <asm/mmzone.h> 20#include <asm/mmzone.h>
22#include <asm/siu.h> 21#include <asm/siu.h>
23 22
@@ -75,6 +74,16 @@ static const struct sh_dmae_slave_config sh7722_dmae_slaves[] = {
75 .addr = 0xa454c094, 74 .addr = 0xa454c094,
76 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT), 75 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
77 .mid_rid = 0xb6, 76 .mid_rid = 0xb6,
77 }, {
78 .slave_id = SHDMA_SLAVE_SDHI0_TX,
79 .addr = 0x04ce0030,
80 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
81 .mid_rid = 0xc1,
82 }, {
83 .slave_id = SHDMA_SLAVE_SDHI0_RX,
84 .addr = 0x04ce0030,
85 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
86 .mid_rid = 0xc2,
78 }, 87 },
79}; 88};
80 89
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
index 89fe16d20fdb..79c556e56262 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
@@ -18,19 +18,103 @@
18#include <linux/mm.h> 18#include <linux/mm.h>
19#include <linux/serial_sci.h> 19#include <linux/serial_sci.h>
20#include <linux/uio_driver.h> 20#include <linux/uio_driver.h>
21#include <linux/sh_dma.h>
21#include <linux/sh_timer.h> 22#include <linux/sh_timer.h>
22#include <linux/io.h> 23#include <linux/io.h>
23#include <linux/notifier.h> 24#include <linux/notifier.h>
24 25
25#include <asm/suspend.h> 26#include <asm/suspend.h>
26#include <asm/clock.h> 27#include <asm/clock.h>
27#include <asm/dmaengine.h>
28#include <asm/mmzone.h> 28#include <asm/mmzone.h>
29 29
30#include <cpu/dma-register.h> 30#include <cpu/dma-register.h>
31#include <cpu/sh7724.h> 31#include <cpu/sh7724.h>
32 32
33/* DMA */ 33/* DMA */
34static const struct sh_dmae_slave_config sh7724_dmae_slaves[] = {
35 {
36 .slave_id = SHDMA_SLAVE_SCIF0_TX,
37 .addr = 0xffe0000c,
38 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
39 .mid_rid = 0x21,
40 }, {
41 .slave_id = SHDMA_SLAVE_SCIF0_RX,
42 .addr = 0xffe00014,
43 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
44 .mid_rid = 0x22,
45 }, {
46 .slave_id = SHDMA_SLAVE_SCIF1_TX,
47 .addr = 0xffe1000c,
48 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
49 .mid_rid = 0x25,
50 }, {
51 .slave_id = SHDMA_SLAVE_SCIF1_RX,
52 .addr = 0xffe10014,
53 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
54 .mid_rid = 0x26,
55 }, {
56 .slave_id = SHDMA_SLAVE_SCIF2_TX,
57 .addr = 0xffe2000c,
58 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
59 .mid_rid = 0x29,
60 }, {
61 .slave_id = SHDMA_SLAVE_SCIF2_RX,
62 .addr = 0xffe20014,
63 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
64 .mid_rid = 0x2a,
65 }, {
66 .slave_id = SHDMA_SLAVE_SCIF3_TX,
67 .addr = 0xa4e30020,
68 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
69 .mid_rid = 0x2d,
70 }, {
71 .slave_id = SHDMA_SLAVE_SCIF3_RX,
72 .addr = 0xa4e30024,
73 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
74 .mid_rid = 0x2e,
75 }, {
76 .slave_id = SHDMA_SLAVE_SCIF4_TX,
77 .addr = 0xa4e40020,
78 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
79 .mid_rid = 0x31,
80 }, {
81 .slave_id = SHDMA_SLAVE_SCIF4_RX,
82 .addr = 0xa4e40024,
83 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
84 .mid_rid = 0x32,
85 }, {
86 .slave_id = SHDMA_SLAVE_SCIF5_TX,
87 .addr = 0xa4e50020,
88 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
89 .mid_rid = 0x35,
90 }, {
91 .slave_id = SHDMA_SLAVE_SCIF5_RX,
92 .addr = 0xa4e50024,
93 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
94 .mid_rid = 0x36,
95 }, {
96 .slave_id = SHDMA_SLAVE_SDHI0_TX,
97 .addr = 0x04ce0030,
98 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
99 .mid_rid = 0xc1,
100 }, {
101 .slave_id = SHDMA_SLAVE_SDHI0_RX,
102 .addr = 0x04ce0030,
103 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
104 .mid_rid = 0xc2,
105 }, {
106 .slave_id = SHDMA_SLAVE_SDHI1_TX,
107 .addr = 0x04cf0030,
108 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
109 .mid_rid = 0xc9,
110 }, {
111 .slave_id = SHDMA_SLAVE_SDHI1_RX,
112 .addr = 0x04cf0030,
113 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
114 .mid_rid = 0xca,
115 },
116};
117
34static const struct sh_dmae_channel sh7724_dmae_channels[] = { 118static const struct sh_dmae_channel sh7724_dmae_channels[] = {
35 { 119 {
36 .offset = 0, 120 .offset = 0,
@@ -62,6 +146,8 @@ static const struct sh_dmae_channel sh7724_dmae_channels[] = {
62static const unsigned int ts_shift[] = TS_SHIFT; 146static const unsigned int ts_shift[] = TS_SHIFT;
63 147
64static struct sh_dmae_pdata dma_platform_data = { 148static struct sh_dmae_pdata dma_platform_data = {
149 .slave = sh7724_dmae_slaves,
150 .slave_num = ARRAY_SIZE(sh7724_dmae_slaves),
65 .channel = sh7724_dmae_channels, 151 .channel = sh7724_dmae_channels,
66 .channel_num = ARRAY_SIZE(sh7724_dmae_channels), 152 .channel_num = ARRAY_SIZE(sh7724_dmae_channels),
67 .ts_low_shift = CHCR_TS_LOW_SHIFT, 153 .ts_low_shift = CHCR_TS_LOW_SHIFT,
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
index b12f537e4dde..0f414864f76b 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
@@ -12,10 +12,9 @@
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <linux/io.h> 13#include <linux/io.h>
14#include <linux/serial_sci.h> 14#include <linux/serial_sci.h>
15#include <linux/sh_dma.h>
15#include <linux/sh_timer.h> 16#include <linux/sh_timer.h>
16 17
17#include <asm/dmaengine.h>
18
19#include <cpu/dma-register.h> 18#include <cpu/dma-register.h>
20 19
21static struct plat_sci_port scif0_platform_data = { 20static struct plat_sci_port scif0_platform_data = {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
index f3e3ea0ce050..c9a572bc6dc8 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
@@ -13,9 +13,9 @@
13#include <linux/serial_sci.h> 13#include <linux/serial_sci.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/sh_dma.h>
16#include <linux/sh_timer.h> 17#include <linux/sh_timer.h>
17 18
18#include <asm/dmaengine.h>
19#include <asm/mmzone.h> 19#include <asm/mmzone.h>
20 20
21#include <cpu/dma-register.h> 21#include <cpu/dma-register.h>
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
index 81657091da46..8797723231ea 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
@@ -21,10 +21,10 @@
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/dma-mapping.h> 22#include <linux/dma-mapping.h>
23#include <linux/sh_timer.h> 23#include <linux/sh_timer.h>
24#include <linux/sh_dma.h>
24#include <linux/sh_intc.h> 25#include <linux/sh_intc.h>
25#include <cpu/dma-register.h> 26#include <cpu/dma-register.h>
26#include <asm/mmzone.h> 27#include <asm/mmzone.h>
27#include <asm/dmaengine.h>
28 28
29static struct plat_sci_port scif0_platform_data = { 29static struct plat_sci_port scif0_platform_data = {
30 .mapbase = 0xffea0000, 30 .mapbase = 0xffea0000,
diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c
index 5ec1d1818691..886d7d83ace3 100644
--- a/arch/sh/kernel/dwarf.c
+++ b/arch/sh/kernel/dwarf.c
@@ -845,8 +845,10 @@ static int dwarf_parse_cie(void *entry, void *p, unsigned long len,
845 rb_link_node(&cie->node, parent, rb_node); 845 rb_link_node(&cie->node, parent, rb_node);
846 rb_insert_color(&cie->node, &cie_root); 846 rb_insert_color(&cie->node, &cie_root);
847 847
848#ifdef CONFIG_MODULES
848 if (mod != NULL) 849 if (mod != NULL)
849 list_add_tail(&cie->link, &mod->arch.cie_list); 850 list_add_tail(&cie->link, &mod->arch.cie_list);
851#endif
850 852
851 spin_unlock_irqrestore(&dwarf_cie_lock, flags); 853 spin_unlock_irqrestore(&dwarf_cie_lock, flags);
852 854
@@ -935,8 +937,10 @@ static int dwarf_parse_fde(void *entry, u32 entry_type,
935 rb_link_node(&fde->node, parent, rb_node); 937 rb_link_node(&fde->node, parent, rb_node);
936 rb_insert_color(&fde->node, &fde_root); 938 rb_insert_color(&fde->node, &fde_root);
937 939
940#ifdef CONFIG_MODULES
938 if (mod != NULL) 941 if (mod != NULL)
939 list_add_tail(&fde->link, &mod->arch.fde_list); 942 list_add_tail(&fde->link, &mod->arch.fde_list);
943#endif
940 944
941 spin_unlock_irqrestore(&dwarf_fde_lock, flags); 945 spin_unlock_irqrestore(&dwarf_fde_lock, flags);
942 946
diff --git a/arch/sh/lib/strlen.S b/arch/sh/lib/strlen.S
index f8ab296047b3..1bcc13f05962 100644
--- a/arch/sh/lib/strlen.S
+++ b/arch/sh/lib/strlen.S
@@ -35,7 +35,7 @@ ENTRY(strlen)
35 mov.b @r4+,r1 35 mov.b @r4+,r1
36 tst r1,r1 36 tst r1,r1
37 bt 8f 37 bt 8f
38 add #1,r2 38 add #1,r2
39 39
401: 401:
41 mov #0,r3 41 mov #0,r3
diff --git a/arch/sparc/include/asm/device.h b/arch/sparc/include/asm/device.h
index f3b85b6b0b76..d4c452147412 100644
--- a/arch/sparc/include/asm/device.h
+++ b/arch/sparc/include/asm/device.h
@@ -13,25 +13,10 @@ struct dev_archdata {
13 void *iommu; 13 void *iommu;
14 void *stc; 14 void *stc;
15 void *host_controller; 15 void *host_controller;
16
17 struct device_node *prom_node;
18 struct of_device *op; 16 struct of_device *op;
19
20 int numa_node; 17 int numa_node;
21}; 18};
22 19
23static inline void dev_archdata_set_node(struct dev_archdata *ad,
24 struct device_node *np)
25{
26 ad->prom_node = np;
27}
28
29static inline struct device_node *
30dev_archdata_get_node(const struct dev_archdata *ad)
31{
32 return ad->prom_node;
33}
34
35struct pdev_archdata { 20struct pdev_archdata {
36}; 21};
37 22
diff --git a/arch/sparc/include/asm/fb.h b/arch/sparc/include/asm/fb.h
index b83e44729655..e834880be204 100644
--- a/arch/sparc/include/asm/fb.h
+++ b/arch/sparc/include/asm/fb.h
@@ -18,7 +18,7 @@ static inline int fb_is_primary_device(struct fb_info *info)
18 struct device *dev = info->device; 18 struct device *dev = info->device;
19 struct device_node *node; 19 struct device_node *node;
20 20
21 node = dev->archdata.prom_node; 21 node = dev->of_node;
22 if (node && 22 if (node &&
23 node == of_console_device) 23 node == of_console_device)
24 return 1; 24 return 1;
diff --git a/arch/sparc/include/asm/floppy_64.h b/arch/sparc/include/asm/floppy_64.h
index 36439d67ad71..8fac3ab22f36 100644
--- a/arch/sparc/include/asm/floppy_64.h
+++ b/arch/sparc/include/asm/floppy_64.h
@@ -589,7 +589,7 @@ static unsigned long __init sun_floppy_init(void)
589 if (!op) 589 if (!op)
590 return 0; 590 return 0;
591 591
592 state_prop = of_get_property(op->node, "status", NULL); 592 state_prop = of_get_property(op->dev.of_node, "status", NULL);
593 if (state_prop && !strncmp(state_prop, "disabled", 8)) 593 if (state_prop && !strncmp(state_prop, "disabled", 8))
594 return 0; 594 return 0;
595 595
@@ -716,7 +716,7 @@ static unsigned long __init sun_floppy_init(void)
716 716
717 return sun_floppy_types[0]; 717 return sun_floppy_types[0];
718 } 718 }
719 prop = of_get_property(op->node, "status", NULL); 719 prop = of_get_property(op->dev.of_node, "status", NULL);
720 if (prop && !strncmp(state, "disabled", 8)) 720 if (prop && !strncmp(state, "disabled", 8))
721 return 0; 721 return 0;
722 722
diff --git a/arch/sparc/include/asm/of_device.h b/arch/sparc/include/asm/of_device.h
index a5d9811f9697..f320246a0586 100644
--- a/arch/sparc/include/asm/of_device.h
+++ b/arch/sparc/include/asm/of_device.h
@@ -14,7 +14,6 @@
14 */ 14 */
15struct of_device 15struct of_device
16{ 16{
17 struct device_node *node;
18 struct device dev; 17 struct device dev;
19 struct resource resource[PROMREG_MAX]; 18 struct resource resource[PROMREG_MAX];
20 unsigned int irqs[PROMINTR_MAX]; 19 unsigned int irqs[PROMINTR_MAX];
diff --git a/arch/sparc/include/asm/parport.h b/arch/sparc/include/asm/parport.h
index ff9ead640c4a..c333b8d0949b 100644
--- a/arch/sparc/include/asm/parport.h
+++ b/arch/sparc/include/asm/parport.h
@@ -113,7 +113,7 @@ static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id
113 struct parport *p; 113 struct parport *p;
114 int slot, err; 114 int slot, err;
115 115
116 parent = op->node->parent; 116 parent = op->dev.of_node->parent;
117 if (!strcmp(parent->name, "dma")) { 117 if (!strcmp(parent->name, "dma")) {
118 p = parport_pc_probe_port(base, base + 0x400, 118 p = parport_pc_probe_port(base, base + 0x400,
119 op->irqs[0], PARPORT_DMA_NOFIFO, 119 op->irqs[0], PARPORT_DMA_NOFIFO,
@@ -232,8 +232,11 @@ static const struct of_device_id ecpp_match[] = {
232}; 232};
233 233
234static struct of_platform_driver ecpp_driver = { 234static struct of_platform_driver ecpp_driver = {
235 .name = "ecpp", 235 .driver = {
236 .match_table = ecpp_match, 236 .name = "ecpp",
237 .owner = THIS_MODULE,
238 .of_match_table = ecpp_match,
239 },
237 .probe = ecpp_probe, 240 .probe = ecpp_probe,
238 .remove = __devexit_p(ecpp_remove), 241 .remove = __devexit_p(ecpp_remove),
239}; 242};
diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c
index 71ec90b9e316..b27476caa133 100644
--- a/arch/sparc/kernel/apc.c
+++ b/arch/sparc/kernel/apc.c
@@ -174,8 +174,11 @@ static struct of_device_id __initdata apc_match[] = {
174MODULE_DEVICE_TABLE(of, apc_match); 174MODULE_DEVICE_TABLE(of, apc_match);
175 175
176static struct of_platform_driver apc_driver = { 176static struct of_platform_driver apc_driver = {
177 .name = "apc", 177 .driver = {
178 .match_table = apc_match, 178 .name = "apc",
179 .owner = THIS_MODULE,
180 .of_match_table = apc_match,
181 },
179 .probe = apc_probe, 182 .probe = apc_probe,
180}; 183};
181 184
diff --git a/arch/sparc/kernel/auxio_64.c b/arch/sparc/kernel/auxio_64.c
index 9f52db2d441c..ddc84128b3c2 100644
--- a/arch/sparc/kernel/auxio_64.c
+++ b/arch/sparc/kernel/auxio_64.c
@@ -104,7 +104,7 @@ MODULE_DEVICE_TABLE(of, auxio_match);
104 104
105static int __devinit auxio_probe(struct of_device *dev, const struct of_device_id *match) 105static int __devinit auxio_probe(struct of_device *dev, const struct of_device_id *match)
106{ 106{
107 struct device_node *dp = dev->node; 107 struct device_node *dp = dev->dev.of_node;
108 unsigned long size; 108 unsigned long size;
109 109
110 if (!strcmp(dp->parent->name, "ebus")) { 110 if (!strcmp(dp->parent->name, "ebus")) {
@@ -132,10 +132,11 @@ static int __devinit auxio_probe(struct of_device *dev, const struct of_device_i
132} 132}
133 133
134static struct of_platform_driver auxio_driver = { 134static struct of_platform_driver auxio_driver = {
135 .match_table = auxio_match,
136 .probe = auxio_probe, 135 .probe = auxio_probe,
137 .driver = { 136 .driver = {
138 .name = "auxio", 137 .name = "auxio",
138 .owner = THIS_MODULE,
139 .of_match_table = auxio_match,
139 }, 140 },
140}; 141};
141 142
diff --git a/arch/sparc/kernel/central.c b/arch/sparc/kernel/central.c
index 415c86d5a8da..434335f65823 100644
--- a/arch/sparc/kernel/central.c
+++ b/arch/sparc/kernel/central.c
@@ -149,10 +149,11 @@ static struct of_device_id __initdata clock_board_match[] = {
149}; 149};
150 150
151static struct of_platform_driver clock_board_driver = { 151static struct of_platform_driver clock_board_driver = {
152 .match_table = clock_board_match,
153 .probe = clock_board_probe, 152 .probe = clock_board_probe,
154 .driver = { 153 .driver = {
155 .name = "clock_board", 154 .name = "clock_board",
155 .owner = THIS_MODULE,
156 .of_match_table = clock_board_match,
156 }, 157 },
157}; 158};
158 159
@@ -168,7 +169,7 @@ static int __devinit fhc_probe(struct of_device *op,
168 goto out; 169 goto out;
169 } 170 }
170 171
171 if (!strcmp(op->node->parent->name, "central")) 172 if (!strcmp(op->dev.of_node->parent->name, "central"))
172 p->central = true; 173 p->central = true;
173 174
174 p->pregs = of_ioremap(&op->resource[0], 0, 175 p->pregs = of_ioremap(&op->resource[0], 0,
@@ -183,7 +184,7 @@ static int __devinit fhc_probe(struct of_device *op,
183 reg = upa_readl(p->pregs + FHC_PREGS_BSR); 184 reg = upa_readl(p->pregs + FHC_PREGS_BSR);
184 p->board_num = ((reg >> 16) & 1) | ((reg >> 12) & 0x0e); 185 p->board_num = ((reg >> 16) & 1) | ((reg >> 12) & 0x0e);
185 } else { 186 } else {
186 p->board_num = of_getintprop_default(op->node, "board#", -1); 187 p->board_num = of_getintprop_default(op->dev.of_node, "board#", -1);
187 if (p->board_num == -1) { 188 if (p->board_num == -1) {
188 printk(KERN_ERR "fhc: No board# property\n"); 189 printk(KERN_ERR "fhc: No board# property\n");
189 goto out_unmap_pregs; 190 goto out_unmap_pregs;
@@ -254,10 +255,11 @@ static struct of_device_id __initdata fhc_match[] = {
254}; 255};
255 256
256static struct of_platform_driver fhc_driver = { 257static struct of_platform_driver fhc_driver = {
257 .match_table = fhc_match,
258 .probe = fhc_probe, 258 .probe = fhc_probe,
259 .driver = { 259 .driver = {
260 .name = "fhc", 260 .name = "fhc",
261 .owner = THIS_MODULE,
262 .of_match_table = fhc_match,
261 }, 263 },
262}; 264};
263 265
diff --git a/arch/sparc/kernel/chmc.c b/arch/sparc/kernel/chmc.c
index e1a9598e2a4d..870cb65b3f21 100644
--- a/arch/sparc/kernel/chmc.c
+++ b/arch/sparc/kernel/chmc.c
@@ -425,7 +425,7 @@ static int __devinit jbusmc_probe(struct of_device *op,
425 INIT_LIST_HEAD(&p->list); 425 INIT_LIST_HEAD(&p->list);
426 426
427 err = -ENODEV; 427 err = -ENODEV;
428 prop = of_get_property(op->node, "portid", &len); 428 prop = of_get_property(op->dev.of_node, "portid", &len);
429 if (!prop || len != 4) { 429 if (!prop || len != 4) {
430 printk(KERN_ERR PFX "Cannot find portid.\n"); 430 printk(KERN_ERR PFX "Cannot find portid.\n");
431 goto out_free; 431 goto out_free;
@@ -433,7 +433,7 @@ static int __devinit jbusmc_probe(struct of_device *op,
433 433
434 p->portid = *prop; 434 p->portid = *prop;
435 435
436 prop = of_get_property(op->node, "memory-control-register-1", &len); 436 prop = of_get_property(op->dev.of_node, "memory-control-register-1", &len);
437 if (!prop || len != 8) { 437 if (!prop || len != 8) {
438 printk(KERN_ERR PFX "Cannot get memory control register 1.\n"); 438 printk(KERN_ERR PFX "Cannot get memory control register 1.\n");
439 goto out_free; 439 goto out_free;
@@ -449,7 +449,7 @@ static int __devinit jbusmc_probe(struct of_device *op,
449 } 449 }
450 450
451 err = -ENODEV; 451 err = -ENODEV;
452 ml = of_get_property(op->node, "memory-layout", &p->layout_len); 452 ml = of_get_property(op->dev.of_node, "memory-layout", &p->layout_len);
453 if (!ml) { 453 if (!ml) {
454 printk(KERN_ERR PFX "Cannot get memory layout property.\n"); 454 printk(KERN_ERR PFX "Cannot get memory layout property.\n");
455 goto out_iounmap; 455 goto out_iounmap;
@@ -466,7 +466,7 @@ static int __devinit jbusmc_probe(struct of_device *op,
466 mc_list_add(&p->list); 466 mc_list_add(&p->list);
467 467
468 printk(KERN_INFO PFX "UltraSPARC-IIIi memory controller at %s\n", 468 printk(KERN_INFO PFX "UltraSPARC-IIIi memory controller at %s\n",
469 op->node->full_name); 469 op->dev.of_node->full_name);
470 470
471 dev_set_drvdata(&op->dev, p); 471 dev_set_drvdata(&op->dev, p);
472 472
@@ -693,7 +693,7 @@ static void chmc_fetch_decode_regs(struct chmc *p)
693static int __devinit chmc_probe(struct of_device *op, 693static int __devinit chmc_probe(struct of_device *op,
694 const struct of_device_id *match) 694 const struct of_device_id *match)
695{ 695{
696 struct device_node *dp = op->node; 696 struct device_node *dp = op->dev.of_node;
697 unsigned long ver; 697 unsigned long ver;
698 const void *pval; 698 const void *pval;
699 int len, portid; 699 int len, portid;
@@ -811,8 +811,11 @@ static const struct of_device_id us3mc_match[] = {
811MODULE_DEVICE_TABLE(of, us3mc_match); 811MODULE_DEVICE_TABLE(of, us3mc_match);
812 812
813static struct of_platform_driver us3mc_driver = { 813static struct of_platform_driver us3mc_driver = {
814 .name = "us3mc", 814 .driver = {
815 .match_table = us3mc_match, 815 .name = "us3mc",
816 .owner = THIS_MODULE,
817 .of_match_table = us3mc_match,
818 },
816 .probe = us3mc_probe, 819 .probe = us3mc_probe,
817 .remove = __devexit_p(us3mc_remove), 820 .remove = __devexit_p(us3mc_remove),
818}; 821};
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 84e5386714cd..703e4aa9bc38 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -290,7 +290,7 @@ static void *sbus_alloc_coherent(struct device *dev, size_t len,
290 if (mmu_map_dma_area(dev, dma_addrp, va, res->start, len_total) != 0) 290 if (mmu_map_dma_area(dev, dma_addrp, va, res->start, len_total) != 0)
291 goto err_noiommu; 291 goto err_noiommu;
292 292
293 res->name = op->node->name; 293 res->name = op->dev.of_node->name;
294 294
295 return (void *)(unsigned long)res->start; 295 return (void *)(unsigned long)res->start;
296 296
diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c
index da527b33ebc7..47e63f1e719c 100644
--- a/arch/sparc/kernel/of_device_32.c
+++ b/arch/sparc/kernel/of_device_32.c
@@ -254,10 +254,10 @@ static void __init build_device_resources(struct of_device *op,
254 return; 254 return;
255 255
256 p_op = to_of_device(parent); 256 p_op = to_of_device(parent);
257 bus = of_match_bus(p_op->node); 257 bus = of_match_bus(p_op->dev.of_node);
258 bus->count_cells(op->node, &na, &ns); 258 bus->count_cells(op->dev.of_node, &na, &ns);
259 259
260 preg = of_get_property(op->node, bus->addr_prop_name, &num_reg); 260 preg = of_get_property(op->dev.of_node, bus->addr_prop_name, &num_reg);
261 if (!preg || num_reg == 0) 261 if (!preg || num_reg == 0)
262 return; 262 return;
263 263
@@ -271,8 +271,8 @@ static void __init build_device_resources(struct of_device *op,
271 struct resource *r = &op->resource[index]; 271 struct resource *r = &op->resource[index];
272 u32 addr[OF_MAX_ADDR_CELLS]; 272 u32 addr[OF_MAX_ADDR_CELLS];
273 const u32 *reg = (preg + (index * ((na + ns) * 4))); 273 const u32 *reg = (preg + (index * ((na + ns) * 4)));
274 struct device_node *dp = op->node; 274 struct device_node *dp = op->dev.of_node;
275 struct device_node *pp = p_op->node; 275 struct device_node *pp = p_op->dev.of_node;
276 struct of_bus *pbus, *dbus; 276 struct of_bus *pbus, *dbus;
277 u64 size, result = OF_BAD_ADDR; 277 u64 size, result = OF_BAD_ADDR;
278 unsigned long flags; 278 unsigned long flags;
@@ -321,7 +321,7 @@ static void __init build_device_resources(struct of_device *op,
321 321
322 if (of_resource_verbose) 322 if (of_resource_verbose)
323 printk("%s reg[%d] -> %llx\n", 323 printk("%s reg[%d] -> %llx\n",
324 op->node->full_name, index, 324 op->dev.of_node->full_name, index,
325 result); 325 result);
326 326
327 if (result != OF_BAD_ADDR) { 327 if (result != OF_BAD_ADDR) {
@@ -329,7 +329,7 @@ static void __init build_device_resources(struct of_device *op,
329 r->end = result + size - 1; 329 r->end = result + size - 1;
330 r->flags = flags | ((result >> 32ULL) & 0xffUL); 330 r->flags = flags | ((result >> 32ULL) & 0xffUL);
331 } 331 }
332 r->name = op->node->name; 332 r->name = op->dev.of_node->name;
333 } 333 }
334} 334}
335 335
@@ -345,10 +345,9 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
345 return NULL; 345 return NULL;
346 346
347 sd = &op->dev.archdata; 347 sd = &op->dev.archdata;
348 sd->prom_node = dp;
349 sd->op = op; 348 sd->op = op;
350 349
351 op->node = dp; 350 op->dev.of_node = dp;
352 351
353 op->clock_freq = of_getintprop_default(dp, "clock-frequency", 352 op->clock_freq = of_getintprop_default(dp, "clock-frequency",
354 (25*1000*1000)); 353 (25*1000*1000));
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c
index b3d4cb5d21b3..1dae8079f728 100644
--- a/arch/sparc/kernel/of_device_64.c
+++ b/arch/sparc/kernel/of_device_64.c
@@ -323,10 +323,10 @@ static void __init build_device_resources(struct of_device *op,
323 return; 323 return;
324 324
325 p_op = to_of_device(parent); 325 p_op = to_of_device(parent);
326 bus = of_match_bus(p_op->node); 326 bus = of_match_bus(p_op->dev.of_node);
327 bus->count_cells(op->node, &na, &ns); 327 bus->count_cells(op->dev.of_node, &na, &ns);
328 328
329 preg = of_get_property(op->node, bus->addr_prop_name, &num_reg); 329 preg = of_get_property(op->dev.of_node, bus->addr_prop_name, &num_reg);
330 if (!preg || num_reg == 0) 330 if (!preg || num_reg == 0)
331 return; 331 return;
332 332
@@ -340,7 +340,7 @@ static void __init build_device_resources(struct of_device *op,
340 if (num_reg > PROMREG_MAX) { 340 if (num_reg > PROMREG_MAX) {
341 printk(KERN_WARNING "%s: Too many regs (%d), " 341 printk(KERN_WARNING "%s: Too many regs (%d), "
342 "limiting to %d.\n", 342 "limiting to %d.\n",
343 op->node->full_name, num_reg, PROMREG_MAX); 343 op->dev.of_node->full_name, num_reg, PROMREG_MAX);
344 num_reg = PROMREG_MAX; 344 num_reg = PROMREG_MAX;
345 } 345 }
346 346
@@ -348,8 +348,8 @@ static void __init build_device_resources(struct of_device *op,
348 struct resource *r = &op->resource[index]; 348 struct resource *r = &op->resource[index];
349 u32 addr[OF_MAX_ADDR_CELLS]; 349 u32 addr[OF_MAX_ADDR_CELLS];
350 const u32 *reg = (preg + (index * ((na + ns) * 4))); 350 const u32 *reg = (preg + (index * ((na + ns) * 4)));
351 struct device_node *dp = op->node; 351 struct device_node *dp = op->dev.of_node;
352 struct device_node *pp = p_op->node; 352 struct device_node *pp = p_op->dev.of_node;
353 struct of_bus *pbus, *dbus; 353 struct of_bus *pbus, *dbus;
354 u64 size, result = OF_BAD_ADDR; 354 u64 size, result = OF_BAD_ADDR;
355 unsigned long flags; 355 unsigned long flags;
@@ -397,7 +397,7 @@ static void __init build_device_resources(struct of_device *op,
397 397
398 if (of_resource_verbose) 398 if (of_resource_verbose)
399 printk("%s reg[%d] -> %llx\n", 399 printk("%s reg[%d] -> %llx\n",
400 op->node->full_name, index, 400 op->dev.of_node->full_name, index,
401 result); 401 result);
402 402
403 if (result != OF_BAD_ADDR) { 403 if (result != OF_BAD_ADDR) {
@@ -408,7 +408,7 @@ static void __init build_device_resources(struct of_device *op,
408 r->end = result + size - 1; 408 r->end = result + size - 1;
409 r->flags = flags; 409 r->flags = flags;
410 } 410 }
411 r->name = op->node->name; 411 r->name = op->dev.of_node->name;
412 } 412 }
413} 413}
414 414
@@ -530,7 +530,7 @@ static unsigned int __init build_one_device_irq(struct of_device *op,
530 struct device *parent, 530 struct device *parent,
531 unsigned int irq) 531 unsigned int irq)
532{ 532{
533 struct device_node *dp = op->node; 533 struct device_node *dp = op->dev.of_node;
534 struct device_node *pp, *ip; 534 struct device_node *pp, *ip;
535 unsigned int orig_irq = irq; 535 unsigned int orig_irq = irq;
536 int nid; 536 int nid;
@@ -575,7 +575,7 @@ static unsigned int __init build_one_device_irq(struct of_device *op,
575 575
576 if (of_irq_verbose) 576 if (of_irq_verbose)
577 printk("%s: Apply [%s:%x] imap --> [%s:%x]\n", 577 printk("%s: Apply [%s:%x] imap --> [%s:%x]\n",
578 op->node->full_name, 578 op->dev.of_node->full_name,
579 pp->full_name, this_orig_irq, 579 pp->full_name, this_orig_irq,
580 (iret ? iret->full_name : "NULL"), irq); 580 (iret ? iret->full_name : "NULL"), irq);
581 581
@@ -594,7 +594,7 @@ static unsigned int __init build_one_device_irq(struct of_device *op,
594 if (of_irq_verbose) 594 if (of_irq_verbose)
595 printk("%s: PCI swizzle [%s] " 595 printk("%s: PCI swizzle [%s] "
596 "%x --> %x\n", 596 "%x --> %x\n",
597 op->node->full_name, 597 op->dev.of_node->full_name,
598 pp->full_name, this_orig_irq, 598 pp->full_name, this_orig_irq,
599 irq); 599 irq);
600 600
@@ -611,11 +611,11 @@ static unsigned int __init build_one_device_irq(struct of_device *op,
611 if (!ip) 611 if (!ip)
612 return orig_irq; 612 return orig_irq;
613 613
614 irq = ip->irq_trans->irq_build(op->node, irq, 614 irq = ip->irq_trans->irq_build(op->dev.of_node, irq,
615 ip->irq_trans->data); 615 ip->irq_trans->data);
616 if (of_irq_verbose) 616 if (of_irq_verbose)
617 printk("%s: Apply IRQ trans [%s] %x --> %x\n", 617 printk("%s: Apply IRQ trans [%s] %x --> %x\n",
618 op->node->full_name, ip->full_name, orig_irq, irq); 618 op->dev.of_node->full_name, ip->full_name, orig_irq, irq);
619 619
620out: 620out:
621 nid = of_node_to_nid(dp); 621 nid = of_node_to_nid(dp);
@@ -640,10 +640,9 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
640 return NULL; 640 return NULL;
641 641
642 sd = &op->dev.archdata; 642 sd = &op->dev.archdata;
643 sd->prom_node = dp;
644 sd->op = op; 643 sd->op = op;
645 644
646 op->node = dp; 645 op->dev.of_node = dp;
647 646
648 op->clock_freq = of_getintprop_default(dp, "clock-frequency", 647 op->clock_freq = of_getintprop_default(dp, "clock-frequency",
649 (25*1000*1000)); 648 (25*1000*1000));
diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c
index 0247e68210b3..10c6c36a6e75 100644
--- a/arch/sparc/kernel/of_device_common.c
+++ b/arch/sparc/kernel/of_device_common.c
@@ -16,7 +16,7 @@ static int node_match(struct device *dev, void *data)
16 struct of_device *op = to_of_device(dev); 16 struct of_device *op = to_of_device(dev);
17 struct device_node *dp = data; 17 struct device_node *dp = data;
18 18
19 return (op->node == dp); 19 return (op->dev.of_node == dp);
20} 20}
21 21
22struct of_device *of_find_device_by_node(struct device_node *dp) 22struct of_device *of_find_device_by_node(struct device_node *dp)
@@ -48,7 +48,7 @@ EXPORT_SYMBOL(irq_of_parse_and_map);
48void of_propagate_archdata(struct of_device *bus) 48void of_propagate_archdata(struct of_device *bus)
49{ 49{
50 struct dev_archdata *bus_sd = &bus->dev.archdata; 50 struct dev_archdata *bus_sd = &bus->dev.archdata;
51 struct device_node *bus_dp = bus->node; 51 struct device_node *bus_dp = bus->dev.of_node;
52 struct device_node *dp; 52 struct device_node *dp;
53 53
54 for (dp = bus_dp->child; dp; dp = dp->sibling) { 54 for (dp = bus_dp->child; dp; dp = dp->sibling) {
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 5ac539a5930f..8a8363adb8bd 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -261,7 +261,6 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
261 sd->iommu = pbm->iommu; 261 sd->iommu = pbm->iommu;
262 sd->stc = &pbm->stc; 262 sd->stc = &pbm->stc;
263 sd->host_controller = pbm; 263 sd->host_controller = pbm;
264 sd->prom_node = node;
265 sd->op = op = of_find_device_by_node(node); 264 sd->op = op = of_find_device_by_node(node);
266 sd->numa_node = pbm->numa_node; 265 sd->numa_node = pbm->numa_node;
267 266
@@ -285,6 +284,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
285 dev->sysdata = node; 284 dev->sysdata = node;
286 dev->dev.parent = bus->bridge; 285 dev->dev.parent = bus->bridge;
287 dev->dev.bus = &pci_bus_type; 286 dev->dev.bus = &pci_bus_type;
287 dev->dev.of_node = node;
288 dev->devfn = devfn; 288 dev->devfn = devfn;
289 dev->multifunction = 0; /* maybe a lie? */ 289 dev->multifunction = 0; /* maybe a lie? */
290 set_pcie_port_type(dev); 290 set_pcie_port_type(dev);
@@ -653,7 +653,7 @@ show_pciobppath_attr(struct device * dev, struct device_attribute * attr, char *
653 struct device_node *dp; 653 struct device_node *dp;
654 654
655 pdev = to_pci_dev(dev); 655 pdev = to_pci_dev(dev);
656 dp = pdev->dev.archdata.prom_node; 656 dp = pdev->dev.of_node;
657 657
658 return snprintf (buf, PAGE_SIZE, "%s\n", dp->full_name); 658 return snprintf (buf, PAGE_SIZE, "%s\n", dp->full_name);
659} 659}
@@ -683,7 +683,7 @@ static void __devinit pci_bus_register_of_sysfs(struct pci_bus *bus)
683struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm, 683struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm,
684 struct device *parent) 684 struct device *parent)
685{ 685{
686 struct device_node *node = pbm->op->node; 686 struct device_node *node = pbm->op->dev.of_node;
687 struct pci_bus *bus; 687 struct pci_bus *bus;
688 688
689 printk("PCI: Scanning PBM %s\n", node->full_name); 689 printk("PCI: Scanning PBM %s\n", node->full_name);
@@ -1022,7 +1022,7 @@ void arch_teardown_msi_irq(unsigned int virt_irq)
1022 1022
1023struct device_node *pci_device_to_OF_node(struct pci_dev *pdev) 1023struct device_node *pci_device_to_OF_node(struct pci_dev *pdev)
1024{ 1024{
1025 return pdev->dev.archdata.prom_node; 1025 return pdev->dev.of_node;
1026} 1026}
1027EXPORT_SYMBOL(pci_device_to_OF_node); 1027EXPORT_SYMBOL(pci_device_to_OF_node);
1028 1028
@@ -1151,15 +1151,13 @@ static int __init of_pci_slot_init(void)
1151 struct device_node *node; 1151 struct device_node *node;
1152 1152
1153 if (pbus->self) { 1153 if (pbus->self) {
1154 struct dev_archdata *sd = pbus->self->sysdata;
1155
1156 /* PCI->PCI bridge */ 1154 /* PCI->PCI bridge */
1157 node = sd->prom_node; 1155 node = pbus->self->dev.of_node;
1158 } else { 1156 } else {
1159 struct pci_pbm_info *pbm = pbus->sysdata; 1157 struct pci_pbm_info *pbm = pbus->sysdata;
1160 1158
1161 /* Host PCI controller */ 1159 /* Host PCI controller */
1162 node = pbm->op->node; 1160 node = pbm->op->dev.of_node;
1163 } 1161 }
1164 1162
1165 pci_bus_slot_names(node, pbus); 1163 pci_bus_slot_names(node, pbus);
diff --git a/arch/sparc/kernel/pci_common.c b/arch/sparc/kernel/pci_common.c
index 8a000583b5cf..6c7a33af3ba6 100644
--- a/arch/sparc/kernel/pci_common.c
+++ b/arch/sparc/kernel/pci_common.c
@@ -314,12 +314,12 @@ struct pci_ops sun4v_pci_ops = {
314 314
315void pci_get_pbm_props(struct pci_pbm_info *pbm) 315void pci_get_pbm_props(struct pci_pbm_info *pbm)
316{ 316{
317 const u32 *val = of_get_property(pbm->op->node, "bus-range", NULL); 317 const u32 *val = of_get_property(pbm->op->dev.of_node, "bus-range", NULL);
318 318
319 pbm->pci_first_busno = val[0]; 319 pbm->pci_first_busno = val[0];
320 pbm->pci_last_busno = val[1]; 320 pbm->pci_last_busno = val[1];
321 321
322 val = of_get_property(pbm->op->node, "ino-bitmap", NULL); 322 val = of_get_property(pbm->op->dev.of_node, "ino-bitmap", NULL);
323 if (val) { 323 if (val) {
324 pbm->ino_bitmap = (((u64)val[1] << 32UL) | 324 pbm->ino_bitmap = (((u64)val[1] << 32UL) |
325 ((u64)val[0] << 0UL)); 325 ((u64)val[0] << 0UL));
@@ -365,7 +365,8 @@ static void pci_register_legacy_regions(struct resource *io_res,
365 365
366static void pci_register_iommu_region(struct pci_pbm_info *pbm) 366static void pci_register_iommu_region(struct pci_pbm_info *pbm)
367{ 367{
368 const u32 *vdma = of_get_property(pbm->op->node, "virtual-dma", NULL); 368 const u32 *vdma = of_get_property(pbm->op->dev.of_node, "virtual-dma",
369 NULL);
369 370
370 if (vdma) { 371 if (vdma) {
371 struct resource *rp = kzalloc(sizeof(*rp), GFP_KERNEL); 372 struct resource *rp = kzalloc(sizeof(*rp), GFP_KERNEL);
@@ -394,7 +395,7 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
394 int num_pbm_ranges; 395 int num_pbm_ranges;
395 396
396 saw_mem = saw_io = 0; 397 saw_mem = saw_io = 0;
397 pbm_ranges = of_get_property(pbm->op->node, "ranges", &i); 398 pbm_ranges = of_get_property(pbm->op->dev.of_node, "ranges", &i);
398 if (!pbm_ranges) { 399 if (!pbm_ranges) {
399 prom_printf("PCI: Fatal error, missing PBM ranges property " 400 prom_printf("PCI: Fatal error, missing PBM ranges property "
400 " for %s\n", 401 " for %s\n",
diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
index d53f45bc7dda..51cfa09e392a 100644
--- a/arch/sparc/kernel/pci_fire.c
+++ b/arch/sparc/kernel/pci_fire.c
@@ -413,7 +413,7 @@ static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm,
413 struct of_device *op, u32 portid) 413 struct of_device *op, u32 portid)
414{ 414{
415 const struct linux_prom64_registers *regs; 415 const struct linux_prom64_registers *regs;
416 struct device_node *dp = op->node; 416 struct device_node *dp = op->dev.of_node;
417 int err; 417 int err;
418 418
419 pbm->numa_node = -1; 419 pbm->numa_node = -1;
@@ -458,7 +458,7 @@ static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm,
458static int __devinit fire_probe(struct of_device *op, 458static int __devinit fire_probe(struct of_device *op,
459 const struct of_device_id *match) 459 const struct of_device_id *match)
460{ 460{
461 struct device_node *dp = op->node; 461 struct device_node *dp = op->dev.of_node;
462 struct pci_pbm_info *pbm; 462 struct pci_pbm_info *pbm;
463 struct iommu *iommu; 463 struct iommu *iommu;
464 u32 portid; 464 u32 portid;
@@ -508,8 +508,11 @@ static struct of_device_id __initdata fire_match[] = {
508}; 508};
509 509
510static struct of_platform_driver fire_driver = { 510static struct of_platform_driver fire_driver = {
511 .name = DRIVER_NAME, 511 .driver = {
512 .match_table = fire_match, 512 .name = DRIVER_NAME,
513 .owner = THIS_MODULE,
514 .of_match_table = fire_match,
515 },
513 .probe = fire_probe, 516 .probe = fire_probe,
514}; 517};
515 518
diff --git a/arch/sparc/kernel/pci_msi.c b/arch/sparc/kernel/pci_msi.c
index e0ef847219c3..548b8ca9c210 100644
--- a/arch/sparc/kernel/pci_msi.c
+++ b/arch/sparc/kernel/pci_msi.c
@@ -324,7 +324,7 @@ void sparc64_pbm_msi_init(struct pci_pbm_info *pbm,
324 const u32 *val; 324 const u32 *val;
325 int len; 325 int len;
326 326
327 val = of_get_property(pbm->op->node, "#msi-eqs", &len); 327 val = of_get_property(pbm->op->dev.of_node, "#msi-eqs", &len);
328 if (!val || len != 4) 328 if (!val || len != 4)
329 goto no_msi; 329 goto no_msi;
330 pbm->msiq_num = *val; 330 pbm->msiq_num = *val;
@@ -347,16 +347,16 @@ void sparc64_pbm_msi_init(struct pci_pbm_info *pbm,
347 u32 msi64_len; 347 u32 msi64_len;
348 } *arng; 348 } *arng;
349 349
350 val = of_get_property(pbm->op->node, "msi-eq-size", &len); 350 val = of_get_property(pbm->op->dev.of_node, "msi-eq-size", &len);
351 if (!val || len != 4) 351 if (!val || len != 4)
352 goto no_msi; 352 goto no_msi;
353 353
354 pbm->msiq_ent_count = *val; 354 pbm->msiq_ent_count = *val;
355 355
356 mqp = of_get_property(pbm->op->node, 356 mqp = of_get_property(pbm->op->dev.of_node,
357 "msi-eq-to-devino", &len); 357 "msi-eq-to-devino", &len);
358 if (!mqp) 358 if (!mqp)
359 mqp = of_get_property(pbm->op->node, 359 mqp = of_get_property(pbm->op->dev.of_node,
360 "msi-eq-devino", &len); 360 "msi-eq-devino", &len);
361 if (!mqp || len != sizeof(struct msiq_prop)) 361 if (!mqp || len != sizeof(struct msiq_prop))
362 goto no_msi; 362 goto no_msi;
@@ -364,27 +364,27 @@ void sparc64_pbm_msi_init(struct pci_pbm_info *pbm,
364 pbm->msiq_first = mqp->first_msiq; 364 pbm->msiq_first = mqp->first_msiq;
365 pbm->msiq_first_devino = mqp->first_devino; 365 pbm->msiq_first_devino = mqp->first_devino;
366 366
367 val = of_get_property(pbm->op->node, "#msi", &len); 367 val = of_get_property(pbm->op->dev.of_node, "#msi", &len);
368 if (!val || len != 4) 368 if (!val || len != 4)
369 goto no_msi; 369 goto no_msi;
370 pbm->msi_num = *val; 370 pbm->msi_num = *val;
371 371
372 mrng = of_get_property(pbm->op->node, "msi-ranges", &len); 372 mrng = of_get_property(pbm->op->dev.of_node, "msi-ranges", &len);
373 if (!mrng || len != sizeof(struct msi_range_prop)) 373 if (!mrng || len != sizeof(struct msi_range_prop))
374 goto no_msi; 374 goto no_msi;
375 pbm->msi_first = mrng->first_msi; 375 pbm->msi_first = mrng->first_msi;
376 376
377 val = of_get_property(pbm->op->node, "msi-data-mask", &len); 377 val = of_get_property(pbm->op->dev.of_node, "msi-data-mask", &len);
378 if (!val || len != 4) 378 if (!val || len != 4)
379 goto no_msi; 379 goto no_msi;
380 pbm->msi_data_mask = *val; 380 pbm->msi_data_mask = *val;
381 381
382 val = of_get_property(pbm->op->node, "msix-data-width", &len); 382 val = of_get_property(pbm->op->dev.of_node, "msix-data-width", &len);
383 if (!val || len != 4) 383 if (!val || len != 4)
384 goto no_msi; 384 goto no_msi;
385 pbm->msix_data_width = *val; 385 pbm->msix_data_width = *val;
386 386
387 arng = of_get_property(pbm->op->node, "msi-address-ranges", 387 arng = of_get_property(pbm->op->dev.of_node, "msi-address-ranges",
388 &len); 388 &len);
389 if (!arng || len != sizeof(struct addr_range_prop)) 389 if (!arng || len != sizeof(struct addr_range_prop))
390 goto no_msi; 390 goto no_msi;
diff --git a/arch/sparc/kernel/pci_psycho.c b/arch/sparc/kernel/pci_psycho.c
index 142b9d6984a8..558a70512824 100644
--- a/arch/sparc/kernel/pci_psycho.c
+++ b/arch/sparc/kernel/pci_psycho.c
@@ -285,7 +285,7 @@ static irqreturn_t psycho_ce_intr(int irq, void *dev_id)
285#define PSYCHO_ECCCTRL_CE 0x2000000000000000UL /* Enable CE INterrupts */ 285#define PSYCHO_ECCCTRL_CE 0x2000000000000000UL /* Enable CE INterrupts */
286static void psycho_register_error_handlers(struct pci_pbm_info *pbm) 286static void psycho_register_error_handlers(struct pci_pbm_info *pbm)
287{ 287{
288 struct of_device *op = of_find_device_by_node(pbm->op->node); 288 struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node);
289 unsigned long base = pbm->controller_regs; 289 unsigned long base = pbm->controller_regs;
290 u64 tmp; 290 u64 tmp;
291 int err; 291 int err;
@@ -507,7 +507,7 @@ static int __devinit psycho_probe(struct of_device *op,
507 const struct of_device_id *match) 507 const struct of_device_id *match)
508{ 508{
509 const struct linux_prom64_registers *pr_regs; 509 const struct linux_prom64_registers *pr_regs;
510 struct device_node *dp = op->node; 510 struct device_node *dp = op->dev.of_node;
511 struct pci_pbm_info *pbm; 511 struct pci_pbm_info *pbm;
512 struct iommu *iommu; 512 struct iommu *iommu;
513 int is_pbm_a, err; 513 int is_pbm_a, err;
@@ -602,8 +602,11 @@ static struct of_device_id __initdata psycho_match[] = {
602}; 602};
603 603
604static struct of_platform_driver psycho_driver = { 604static struct of_platform_driver psycho_driver = {
605 .name = DRIVER_NAME, 605 .driver = {
606 .match_table = psycho_match, 606 .name = DRIVER_NAME,
607 .owner = THIS_MODULE,
608 .of_match_table = psycho_match,
609 },
607 .probe = psycho_probe, 610 .probe = psycho_probe,
608}; 611};
609 612
diff --git a/arch/sparc/kernel/pci_sabre.c b/arch/sparc/kernel/pci_sabre.c
index ba6fbeba3e2c..6dad8e3b7506 100644
--- a/arch/sparc/kernel/pci_sabre.c
+++ b/arch/sparc/kernel/pci_sabre.c
@@ -310,7 +310,7 @@ static irqreturn_t sabre_ce_intr(int irq, void *dev_id)
310 310
311static void sabre_register_error_handlers(struct pci_pbm_info *pbm) 311static void sabre_register_error_handlers(struct pci_pbm_info *pbm)
312{ 312{
313 struct device_node *dp = pbm->op->node; 313 struct device_node *dp = pbm->op->dev.of_node;
314 struct of_device *op; 314 struct of_device *op;
315 unsigned long base = pbm->controller_regs; 315 unsigned long base = pbm->controller_regs;
316 u64 tmp; 316 u64 tmp;
@@ -456,7 +456,7 @@ static int __devinit sabre_probe(struct of_device *op,
456 const struct of_device_id *match) 456 const struct of_device_id *match)
457{ 457{
458 const struct linux_prom64_registers *pr_regs; 458 const struct linux_prom64_registers *pr_regs;
459 struct device_node *dp = op->node; 459 struct device_node *dp = op->dev.of_node;
460 struct pci_pbm_info *pbm; 460 struct pci_pbm_info *pbm;
461 u32 upa_portid, dma_mask; 461 u32 upa_portid, dma_mask;
462 struct iommu *iommu; 462 struct iommu *iommu;
@@ -596,8 +596,11 @@ static struct of_device_id __initdata sabre_match[] = {
596}; 596};
597 597
598static struct of_platform_driver sabre_driver = { 598static struct of_platform_driver sabre_driver = {
599 .name = DRIVER_NAME, 599 .driver = {
600 .match_table = sabre_match, 600 .name = DRIVER_NAME,
601 .owner = THIS_MODULE,
602 .of_match_table = sabre_match,
603 },
601 .probe = sabre_probe, 604 .probe = sabre_probe,
602}; 605};
603 606
diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
index 2b5cdde77af7..97a1ae2e1c02 100644
--- a/arch/sparc/kernel/pci_schizo.c
+++ b/arch/sparc/kernel/pci_schizo.c
@@ -844,7 +844,7 @@ static int pbm_routes_this_ino(struct pci_pbm_info *pbm, u32 ino)
844 */ 844 */
845static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm) 845static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
846{ 846{
847 struct of_device *op = of_find_device_by_node(pbm->op->node); 847 struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node);
848 u64 tmp, err_mask, err_no_mask; 848 u64 tmp, err_mask, err_no_mask;
849 int err; 849 int err;
850 850
@@ -939,7 +939,7 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
939 939
940static void schizo_register_error_handlers(struct pci_pbm_info *pbm) 940static void schizo_register_error_handlers(struct pci_pbm_info *pbm)
941{ 941{
942 struct of_device *op = of_find_device_by_node(pbm->op->node); 942 struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node);
943 u64 tmp, err_mask, err_no_mask; 943 u64 tmp, err_mask, err_no_mask;
944 int err; 944 int err;
945 945
@@ -1068,7 +1068,7 @@ static void __devinit schizo_scan_bus(struct pci_pbm_info *pbm,
1068{ 1068{
1069 pbm_config_busmastering(pbm); 1069 pbm_config_busmastering(pbm);
1070 pbm->is_66mhz_capable = 1070 pbm->is_66mhz_capable =
1071 (of_find_property(pbm->op->node, "66mhz-capable", NULL) 1071 (of_find_property(pbm->op->dev.of_node, "66mhz-capable", NULL)
1072 != NULL); 1072 != NULL);
1073 1073
1074 pbm->pci_bus = pci_scan_one_pbm(pbm, parent); 1074 pbm->pci_bus = pci_scan_one_pbm(pbm, parent);
@@ -1138,7 +1138,7 @@ static int schizo_pbm_iommu_init(struct pci_pbm_info *pbm)
1138 u32 dma_mask; 1138 u32 dma_mask;
1139 u64 control; 1139 u64 control;
1140 1140
1141 vdma = of_get_property(pbm->op->node, "virtual-dma", NULL); 1141 vdma = of_get_property(pbm->op->dev.of_node, "virtual-dma", NULL);
1142 if (!vdma) 1142 if (!vdma)
1143 vdma = vdma_default; 1143 vdma = vdma_default;
1144 1144
@@ -1268,7 +1268,7 @@ static void schizo_pbm_hw_init(struct pci_pbm_info *pbm)
1268 pbm->chip_version >= 0x2) 1268 pbm->chip_version >= 0x2)
1269 tmp |= 0x3UL << SCHIZO_PCICTRL_PTO_SHIFT; 1269 tmp |= 0x3UL << SCHIZO_PCICTRL_PTO_SHIFT;
1270 1270
1271 if (!of_find_property(pbm->op->node, "no-bus-parking", NULL)) 1271 if (!of_find_property(pbm->op->dev.of_node, "no-bus-parking", NULL))
1272 tmp |= SCHIZO_PCICTRL_PARK; 1272 tmp |= SCHIZO_PCICTRL_PARK;
1273 else 1273 else
1274 tmp &= ~SCHIZO_PCICTRL_PARK; 1274 tmp &= ~SCHIZO_PCICTRL_PARK;
@@ -1311,7 +1311,7 @@ static int __devinit schizo_pbm_init(struct pci_pbm_info *pbm,
1311 int chip_type) 1311 int chip_type)
1312{ 1312{
1313 const struct linux_prom64_registers *regs; 1313 const struct linux_prom64_registers *regs;
1314 struct device_node *dp = op->node; 1314 struct device_node *dp = op->dev.of_node;
1315 const char *chipset_name; 1315 const char *chipset_name;
1316 int is_pbm_a, err; 1316 int is_pbm_a, err;
1317 1317
@@ -1415,7 +1415,7 @@ static struct pci_pbm_info * __devinit schizo_find_sibling(u32 portid,
1415 1415
1416static int __devinit __schizo_init(struct of_device *op, unsigned long chip_type) 1416static int __devinit __schizo_init(struct of_device *op, unsigned long chip_type)
1417{ 1417{
1418 struct device_node *dp = op->node; 1418 struct device_node *dp = op->dev.of_node;
1419 struct pci_pbm_info *pbm; 1419 struct pci_pbm_info *pbm;
1420 struct iommu *iommu; 1420 struct iommu *iommu;
1421 u32 portid; 1421 u32 portid;
@@ -1491,8 +1491,11 @@ static struct of_device_id __initdata schizo_match[] = {
1491}; 1491};
1492 1492
1493static struct of_platform_driver schizo_driver = { 1493static struct of_platform_driver schizo_driver = {
1494 .name = DRIVER_NAME, 1494 .driver = {
1495 .match_table = schizo_match, 1495 .name = DRIVER_NAME,
1496 .owner = THIS_MODULE,
1497 .of_match_table = schizo_match,
1498 },
1496 .probe = schizo_probe, 1499 .probe = schizo_probe,
1497}; 1500};
1498 1501
diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
index 23c33ff9c31e..a24af6f7e17f 100644
--- a/arch/sparc/kernel/pci_sun4v.c
+++ b/arch/sparc/kernel/pci_sun4v.c
@@ -540,7 +540,7 @@ static void __devinit pci_sun4v_scan_bus(struct pci_pbm_info *pbm,
540 struct property *prop; 540 struct property *prop;
541 struct device_node *dp; 541 struct device_node *dp;
542 542
543 dp = pbm->op->node; 543 dp = pbm->op->dev.of_node;
544 prop = of_find_property(dp, "66mhz-capable", NULL); 544 prop = of_find_property(dp, "66mhz-capable", NULL);
545 pbm->is_66mhz_capable = (prop != NULL); 545 pbm->is_66mhz_capable = (prop != NULL);
546 pbm->pci_bus = pci_scan_one_pbm(pbm, parent); 546 pbm->pci_bus = pci_scan_one_pbm(pbm, parent);
@@ -584,7 +584,7 @@ static int __devinit pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
584 u32 dma_mask, dma_offset; 584 u32 dma_mask, dma_offset;
585 const u32 *vdma; 585 const u32 *vdma;
586 586
587 vdma = of_get_property(pbm->op->node, "virtual-dma", NULL); 587 vdma = of_get_property(pbm->op->dev.of_node, "virtual-dma", NULL);
588 if (!vdma) 588 if (!vdma)
589 vdma = vdma_default; 589 vdma = vdma_default;
590 590
@@ -881,7 +881,7 @@ static void pci_sun4v_msi_init(struct pci_pbm_info *pbm)
881static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm, 881static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm,
882 struct of_device *op, u32 devhandle) 882 struct of_device *op, u32 devhandle)
883{ 883{
884 struct device_node *dp = op->node; 884 struct device_node *dp = op->dev.of_node;
885 int err; 885 int err;
886 886
887 pbm->numa_node = of_node_to_nid(dp); 887 pbm->numa_node = of_node_to_nid(dp);
@@ -929,7 +929,7 @@ static int __devinit pci_sun4v_probe(struct of_device *op,
929 u32 devhandle; 929 u32 devhandle;
930 int i, err; 930 int i, err;
931 931
932 dp = op->node; 932 dp = op->dev.of_node;
933 933
934 if (!hvapi_negotiated++) { 934 if (!hvapi_negotiated++) {
935 err = sun4v_hvapi_register(HV_GRP_PCI, 935 err = sun4v_hvapi_register(HV_GRP_PCI,
@@ -1009,8 +1009,11 @@ static struct of_device_id __initdata pci_sun4v_match[] = {
1009}; 1009};
1010 1010
1011static struct of_platform_driver pci_sun4v_driver = { 1011static struct of_platform_driver pci_sun4v_driver = {
1012 .name = DRIVER_NAME, 1012 .driver = {
1013 .match_table = pci_sun4v_match, 1013 .name = DRIVER_NAME,
1014 .owner = THIS_MODULE,
1015 .of_match_table = pci_sun4v_match,
1016 },
1014 .probe = pci_sun4v_probe, 1017 .probe = pci_sun4v_probe,
1015}; 1018};
1016 1019
diff --git a/arch/sparc/kernel/pmc.c b/arch/sparc/kernel/pmc.c
index 5e4563d86f19..9589d8b9b0c1 100644
--- a/arch/sparc/kernel/pmc.c
+++ b/arch/sparc/kernel/pmc.c
@@ -79,8 +79,11 @@ static struct of_device_id __initdata pmc_match[] = {
79MODULE_DEVICE_TABLE(of, pmc_match); 79MODULE_DEVICE_TABLE(of, pmc_match);
80 80
81static struct of_platform_driver pmc_driver = { 81static struct of_platform_driver pmc_driver = {
82 .name = "pmc", 82 .driver = {
83 .match_table = pmc_match, 83 .name = "pmc",
84 .owner = THIS_MODULE,
85 .of_match_table = pmc_match,
86 },
84 .probe = pmc_probe, 87 .probe = pmc_probe,
85}; 88};
86 89
diff --git a/arch/sparc/kernel/power.c b/arch/sparc/kernel/power.c
index e2a045c235a1..168d4cb63f5b 100644
--- a/arch/sparc/kernel/power.c
+++ b/arch/sparc/kernel/power.c
@@ -41,9 +41,9 @@ static int __devinit power_probe(struct of_device *op, const struct of_device_id
41 power_reg = of_ioremap(res, 0, 0x4, "power"); 41 power_reg = of_ioremap(res, 0, 0x4, "power");
42 42
43 printk(KERN_INFO "%s: Control reg at %llx\n", 43 printk(KERN_INFO "%s: Control reg at %llx\n",
44 op->node->name, res->start); 44 op->dev.of_node->name, res->start);
45 45
46 if (has_button_interrupt(irq, op->node)) { 46 if (has_button_interrupt(irq, op->dev.of_node)) {
47 if (request_irq(irq, 47 if (request_irq(irq,
48 power_handler, 0, "power", NULL) < 0) 48 power_handler, 0, "power", NULL) < 0)
49 printk(KERN_ERR "power: Cannot setup IRQ handler.\n"); 49 printk(KERN_ERR "power: Cannot setup IRQ handler.\n");
@@ -60,10 +60,11 @@ static struct of_device_id __initdata power_match[] = {
60}; 60};
61 61
62static struct of_platform_driver power_driver = { 62static struct of_platform_driver power_driver = {
63 .match_table = power_match,
64 .probe = power_probe, 63 .probe = power_probe,
65 .driver = { 64 .driver = {
66 .name = "power", 65 .name = "power",
66 .owner = THIS_MODULE,
67 .of_match_table = power_match,
67 }, 68 },
68}; 69};
69 70
diff --git a/arch/sparc/kernel/psycho_common.c b/arch/sparc/kernel/psycho_common.c
index 8f1478475421..3f34ac853931 100644
--- a/arch/sparc/kernel/psycho_common.c
+++ b/arch/sparc/kernel/psycho_common.c
@@ -450,7 +450,7 @@ int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize,
450void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct of_device *op, 450void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct of_device *op,
451 const char *chip_name, int chip_type) 451 const char *chip_name, int chip_type)
452{ 452{
453 struct device_node *dp = op->node; 453 struct device_node *dp = op->dev.of_node;
454 454
455 pbm->name = dp->full_name; 455 pbm->name = dp->full_name;
456 pbm->numa_node = -1; 456 pbm->numa_node = -1;
diff --git a/arch/sparc/kernel/sbus.c b/arch/sparc/kernel/sbus.c
index 406e0872504e..cfeaf04b9cdf 100644
--- a/arch/sparc/kernel/sbus.c
+++ b/arch/sparc/kernel/sbus.c
@@ -63,10 +63,10 @@ void sbus_set_sbus64(struct device *dev, int bursts)
63 int slot; 63 int slot;
64 u64 val; 64 u64 val;
65 65
66 regs = of_get_property(op->node, "reg", NULL); 66 regs = of_get_property(op->dev.of_node, "reg", NULL);
67 if (!regs) { 67 if (!regs) {
68 printk(KERN_ERR "sbus_set_sbus64: Cannot find regs for %s\n", 68 printk(KERN_ERR "sbus_set_sbus64: Cannot find regs for %s\n",
69 op->node->full_name); 69 op->dev.of_node->full_name);
70 return; 70 return;
71 } 71 }
72 slot = regs->which_io; 72 slot = regs->which_io;
@@ -287,7 +287,7 @@ static irqreturn_t sysio_ue_handler(int irq, void *dev_id)
287 SYSIO_UEAFSR_SPIO | SYSIO_UEAFSR_SDRD | SYSIO_UEAFSR_SDWR); 287 SYSIO_UEAFSR_SPIO | SYSIO_UEAFSR_SDRD | SYSIO_UEAFSR_SDWR);
288 upa_writeq(error_bits, afsr_reg); 288 upa_writeq(error_bits, afsr_reg);
289 289
290 portid = of_getintprop_default(op->node, "portid", -1); 290 portid = of_getintprop_default(op->dev.of_node, "portid", -1);
291 291
292 /* Log the error. */ 292 /* Log the error. */
293 printk("SYSIO[%x]: Uncorrectable ECC Error, primary error type[%s]\n", 293 printk("SYSIO[%x]: Uncorrectable ECC Error, primary error type[%s]\n",
@@ -361,7 +361,7 @@ static irqreturn_t sysio_ce_handler(int irq, void *dev_id)
361 SYSIO_CEAFSR_SPIO | SYSIO_CEAFSR_SDRD | SYSIO_CEAFSR_SDWR); 361 SYSIO_CEAFSR_SPIO | SYSIO_CEAFSR_SDRD | SYSIO_CEAFSR_SDWR);
362 upa_writeq(error_bits, afsr_reg); 362 upa_writeq(error_bits, afsr_reg);
363 363
364 portid = of_getintprop_default(op->node, "portid", -1); 364 portid = of_getintprop_default(op->dev.of_node, "portid", -1);
365 365
366 printk("SYSIO[%x]: Correctable ECC Error, primary error type[%s]\n", 366 printk("SYSIO[%x]: Correctable ECC Error, primary error type[%s]\n",
367 portid, 367 portid,
@@ -439,7 +439,7 @@ static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id)
439 SYSIO_SBAFSR_SLE | SYSIO_SBAFSR_STO | SYSIO_SBAFSR_SBERR); 439 SYSIO_SBAFSR_SLE | SYSIO_SBAFSR_STO | SYSIO_SBAFSR_SBERR);
440 upa_writeq(error_bits, afsr_reg); 440 upa_writeq(error_bits, afsr_reg);
441 441
442 portid = of_getintprop_default(op->node, "portid", -1); 442 portid = of_getintprop_default(op->dev.of_node, "portid", -1);
443 443
444 /* Log the error. */ 444 /* Log the error. */
445 printk("SYSIO[%x]: SBUS Error, primary error type[%s] read(%d)\n", 445 printk("SYSIO[%x]: SBUS Error, primary error type[%s] read(%d)\n",
@@ -496,7 +496,7 @@ static void __init sysio_register_error_handlers(struct of_device *op)
496 u64 control; 496 u64 control;
497 int portid; 497 int portid;
498 498
499 portid = of_getintprop_default(op->node, "portid", -1); 499 portid = of_getintprop_default(op->dev.of_node, "portid", -1);
500 500
501 irq = sbus_build_irq(op, SYSIO_UE_INO); 501 irq = sbus_build_irq(op, SYSIO_UE_INO);
502 if (request_irq(irq, sysio_ue_handler, 0, 502 if (request_irq(irq, sysio_ue_handler, 0,
@@ -537,7 +537,7 @@ static void __init sysio_register_error_handlers(struct of_device *op)
537static void __init sbus_iommu_init(struct of_device *op) 537static void __init sbus_iommu_init(struct of_device *op)
538{ 538{
539 const struct linux_prom64_registers *pr; 539 const struct linux_prom64_registers *pr;
540 struct device_node *dp = op->node; 540 struct device_node *dp = op->dev.of_node;
541 struct iommu *iommu; 541 struct iommu *iommu;
542 struct strbuf *strbuf; 542 struct strbuf *strbuf;
543 unsigned long regs, reg_base; 543 unsigned long regs, reg_base;
@@ -589,7 +589,7 @@ static void __init sbus_iommu_init(struct of_device *op)
589 */ 589 */
590 iommu->write_complete_reg = regs + 0x2000UL; 590 iommu->write_complete_reg = regs + 0x2000UL;
591 591
592 portid = of_getintprop_default(op->node, "portid", -1); 592 portid = of_getintprop_default(op->dev.of_node, "portid", -1);
593 printk(KERN_INFO "SYSIO: UPA portID %x, at %016lx\n", 593 printk(KERN_INFO "SYSIO: UPA portID %x, at %016lx\n",
594 portid, regs); 594 portid, regs);
595 595
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index 4453003032b5..e404b063be2c 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -144,7 +144,7 @@ static struct platform_device m48t59_rtc = {
144 144
145static int __devinit clock_probe(struct of_device *op, const struct of_device_id *match) 145static int __devinit clock_probe(struct of_device *op, const struct of_device_id *match)
146{ 146{
147 struct device_node *dp = op->node; 147 struct device_node *dp = op->dev.of_node;
148 const char *model = of_get_property(dp, "model", NULL); 148 const char *model = of_get_property(dp, "model", NULL);
149 149
150 if (!model) 150 if (!model)
@@ -177,10 +177,11 @@ static struct of_device_id __initdata clock_match[] = {
177}; 177};
178 178
179static struct of_platform_driver clock_driver = { 179static struct of_platform_driver clock_driver = {
180 .match_table = clock_match,
181 .probe = clock_probe, 180 .probe = clock_probe,
182 .driver = { 181 .driver = {
183 .name = "rtc", 182 .name = "rtc",
183 .owner = THIS_MODULE,
184 .of_match_table = clock_match,
184 }, 185 },
185}; 186};
186 187
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index c7bbe6cf7b85..21e9fcae0668 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -424,7 +424,7 @@ static int __devinit rtc_probe(struct of_device *op, const struct of_device_id *
424 struct resource *r; 424 struct resource *r;
425 425
426 printk(KERN_INFO "%s: RTC regs at 0x%llx\n", 426 printk(KERN_INFO "%s: RTC regs at 0x%llx\n",
427 op->node->full_name, op->resource[0].start); 427 op->dev.of_node->full_name, op->resource[0].start);
428 428
429 /* The CMOS RTC driver only accepts IORESOURCE_IO, so cons 429 /* The CMOS RTC driver only accepts IORESOURCE_IO, so cons
430 * up a fake resource so that the probe works for all cases. 430 * up a fake resource so that the probe works for all cases.
@@ -463,10 +463,11 @@ static struct of_device_id __initdata rtc_match[] = {
463}; 463};
464 464
465static struct of_platform_driver rtc_driver = { 465static struct of_platform_driver rtc_driver = {
466 .match_table = rtc_match,
467 .probe = rtc_probe, 466 .probe = rtc_probe,
468 .driver = { 467 .driver = {
469 .name = "rtc", 468 .name = "rtc",
469 .owner = THIS_MODULE,
470 .of_match_table = rtc_match,
470 }, 471 },
471}; 472};
472 473
@@ -480,7 +481,7 @@ static int __devinit bq4802_probe(struct of_device *op, const struct of_device_i
480{ 481{
481 482
482 printk(KERN_INFO "%s: BQ4802 regs at 0x%llx\n", 483 printk(KERN_INFO "%s: BQ4802 regs at 0x%llx\n",
483 op->node->full_name, op->resource[0].start); 484 op->dev.of_node->full_name, op->resource[0].start);
484 485
485 rtc_bq4802_device.resource = &op->resource[0]; 486 rtc_bq4802_device.resource = &op->resource[0];
486 return platform_device_register(&rtc_bq4802_device); 487 return platform_device_register(&rtc_bq4802_device);
@@ -495,10 +496,11 @@ static struct of_device_id __initdata bq4802_match[] = {
495}; 496};
496 497
497static struct of_platform_driver bq4802_driver = { 498static struct of_platform_driver bq4802_driver = {
498 .match_table = bq4802_match,
499 .probe = bq4802_probe, 499 .probe = bq4802_probe,
500 .driver = { 500 .driver = {
501 .name = "bq4802", 501 .name = "bq4802",
502 .owner = THIS_MODULE,
503 .of_match_table = bq4802_match,
502 }, 504 },
503}; 505};
504 506
@@ -534,7 +536,7 @@ static struct platform_device m48t59_rtc = {
534 536
535static int __devinit mostek_probe(struct of_device *op, const struct of_device_id *match) 537static int __devinit mostek_probe(struct of_device *op, const struct of_device_id *match)
536{ 538{
537 struct device_node *dp = op->node; 539 struct device_node *dp = op->dev.of_node;
538 540
539 /* On an Enterprise system there can be multiple mostek clocks. 541 /* On an Enterprise system there can be multiple mostek clocks.
540 * We should only match the one that is on the central FHC bus. 542 * We should only match the one that is on the central FHC bus.
@@ -558,10 +560,11 @@ static struct of_device_id __initdata mostek_match[] = {
558}; 560};
559 561
560static struct of_platform_driver mostek_driver = { 562static struct of_platform_driver mostek_driver = {
561 .match_table = mostek_match,
562 .probe = mostek_probe, 563 .probe = mostek_probe,
563 .driver = { 564 .driver = {
564 .name = "mostek", 565 .name = "mostek",
566 .owner = THIS_MODULE,
567 .of_match_table = mostek_match,
565 }, 568 },
566}; 569};
567 570
diff --git a/drivers/ata/pata_macio.c b/drivers/ata/pata_macio.c
index 25df50f51c04..b5b48e703cb7 100644
--- a/drivers/ata/pata_macio.c
+++ b/drivers/ata/pata_macio.c
@@ -1140,7 +1140,7 @@ static int __devinit pata_macio_attach(struct macio_dev *mdev,
1140 "Failed to allocate private memory\n"); 1140 "Failed to allocate private memory\n");
1141 return -ENOMEM; 1141 return -ENOMEM;
1142 } 1142 }
1143 priv->node = of_node_get(mdev->ofdev.node); 1143 priv->node = of_node_get(mdev->ofdev.dev.of_node);
1144 priv->mdev = mdev; 1144 priv->mdev = mdev;
1145 priv->dev = &mdev->ofdev.dev; 1145 priv->dev = &mdev->ofdev.dev;
1146 1146
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
index 96b11b604ae0..36afe2c1c747 100644
--- a/drivers/ata/pata_mpc52xx.c
+++ b/drivers/ata/pata_mpc52xx.c
@@ -694,7 +694,7 @@ mpc52xx_ata_probe(struct of_device *op, const struct of_device_id *match)
694 struct bcom_task *dmatsk = NULL; 694 struct bcom_task *dmatsk = NULL;
695 695
696 /* Get ipb frequency */ 696 /* Get ipb frequency */
697 ipb_freq = mpc5xxx_get_bus_frequency(op->node); 697 ipb_freq = mpc5xxx_get_bus_frequency(op->dev.of_node);
698 if (!ipb_freq) { 698 if (!ipb_freq) {
699 dev_err(&op->dev, "could not determine IPB bus frequency\n"); 699 dev_err(&op->dev, "could not determine IPB bus frequency\n");
700 return -ENODEV; 700 return -ENODEV;
@@ -702,7 +702,7 @@ mpc52xx_ata_probe(struct of_device *op, const struct of_device_id *match)
702 702
703 /* Get device base address from device tree, request the region 703 /* Get device base address from device tree, request the region
704 * and ioremap it. */ 704 * and ioremap it. */
705 rv = of_address_to_resource(op->node, 0, &res_mem); 705 rv = of_address_to_resource(op->dev.of_node, 0, &res_mem);
706 if (rv) { 706 if (rv) {
707 dev_err(&op->dev, "could not determine device base address\n"); 707 dev_err(&op->dev, "could not determine device base address\n");
708 return rv; 708 return rv;
@@ -735,14 +735,14 @@ mpc52xx_ata_probe(struct of_device *op, const struct of_device_id *match)
735 * The MPC5200 ATA controller supports MWDMA modes 0, 1 and 2 and 735 * The MPC5200 ATA controller supports MWDMA modes 0, 1 and 2 and
736 * UDMA modes 0, 1 and 2. 736 * UDMA modes 0, 1 and 2.
737 */ 737 */
738 prop = of_get_property(op->node, "mwdma-mode", &proplen); 738 prop = of_get_property(op->dev.of_node, "mwdma-mode", &proplen);
739 if ((prop) && (proplen >= 4)) 739 if ((prop) && (proplen >= 4))
740 mwdma_mask = ATA_MWDMA2 & ((1 << (*prop + 1)) - 1); 740 mwdma_mask = ATA_MWDMA2 & ((1 << (*prop + 1)) - 1);
741 prop = of_get_property(op->node, "udma-mode", &proplen); 741 prop = of_get_property(op->dev.of_node, "udma-mode", &proplen);
742 if ((prop) && (proplen >= 4)) 742 if ((prop) && (proplen >= 4))
743 udma_mask = ATA_UDMA2 & ((1 << (*prop + 1)) - 1); 743 udma_mask = ATA_UDMA2 & ((1 << (*prop + 1)) - 1);
744 744
745 ata_irq = irq_of_parse_and_map(op->node, 0); 745 ata_irq = irq_of_parse_and_map(op->dev.of_node, 0);
746 if (ata_irq == NO_IRQ) { 746 if (ata_irq == NO_IRQ) {
747 dev_err(&op->dev, "error mapping irq\n"); 747 dev_err(&op->dev, "error mapping irq\n");
748 return -EINVAL; 748 return -EINVAL;
@@ -884,9 +884,6 @@ static struct of_device_id mpc52xx_ata_of_match[] = {
884 884
885 885
886static struct of_platform_driver mpc52xx_ata_of_platform_driver = { 886static struct of_platform_driver mpc52xx_ata_of_platform_driver = {
887 .owner = THIS_MODULE,
888 .name = DRV_NAME,
889 .match_table = mpc52xx_ata_of_match,
890 .probe = mpc52xx_ata_probe, 887 .probe = mpc52xx_ata_probe,
891 .remove = mpc52xx_ata_remove, 888 .remove = mpc52xx_ata_remove,
892#ifdef CONFIG_PM 889#ifdef CONFIG_PM
@@ -896,6 +893,7 @@ static struct of_platform_driver mpc52xx_ata_of_platform_driver = {
896 .driver = { 893 .driver = {
897 .name = DRV_NAME, 894 .name = DRV_NAME,
898 .owner = THIS_MODULE, 895 .owner = THIS_MODULE,
896 .of_match_table = mpc52xx_ata_of_match,
899 }, 897 },
900}; 898};
901 899
diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c
index 1f18ad9e4fe1..5a1b82c08be9 100644
--- a/drivers/ata/pata_of_platform.c
+++ b/drivers/ata/pata_of_platform.c
@@ -18,7 +18,7 @@ static int __devinit pata_of_platform_probe(struct of_device *ofdev,
18 const struct of_device_id *match) 18 const struct of_device_id *match)
19{ 19{
20 int ret; 20 int ret;
21 struct device_node *dn = ofdev->node; 21 struct device_node *dn = ofdev->dev.of_node;
22 struct resource io_res; 22 struct resource io_res;
23 struct resource ctl_res; 23 struct resource ctl_res;
24 struct resource irq_res; 24 struct resource irq_res;
@@ -91,8 +91,11 @@ static struct of_device_id pata_of_platform_match[] = {
91MODULE_DEVICE_TABLE(of, pata_of_platform_match); 91MODULE_DEVICE_TABLE(of, pata_of_platform_match);
92 92
93static struct of_platform_driver pata_of_platform_driver = { 93static struct of_platform_driver pata_of_platform_driver = {
94 .name = "pata_of_platform", 94 .driver = {
95 .match_table = pata_of_platform_match, 95 .name = "pata_of_platform",
96 .owner = THIS_MODULE,
97 .of_match_table = pata_of_platform_match,
98 },
96 .probe = pata_of_platform_probe, 99 .probe = pata_of_platform_probe,
97 .remove = __devexit_p(pata_of_platform_remove), 100 .remove = __devexit_p(pata_of_platform_remove),
98}; 101};
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index a69192b38b43..61c89b54ea23 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -1313,7 +1313,7 @@ static int sata_fsl_probe(struct of_device *ofdev,
1313 dev_printk(KERN_INFO, &ofdev->dev, 1313 dev_printk(KERN_INFO, &ofdev->dev,
1314 "Sata FSL Platform/CSB Driver init\n"); 1314 "Sata FSL Platform/CSB Driver init\n");
1315 1315
1316 hcr_base = of_iomap(ofdev->node, 0); 1316 hcr_base = of_iomap(ofdev->dev.of_node, 0);
1317 if (!hcr_base) 1317 if (!hcr_base)
1318 goto error_exit_with_cleanup; 1318 goto error_exit_with_cleanup;
1319 1319
@@ -1332,7 +1332,7 @@ static int sata_fsl_probe(struct of_device *ofdev,
1332 host_priv->ssr_base = ssr_base; 1332 host_priv->ssr_base = ssr_base;
1333 host_priv->csr_base = csr_base; 1333 host_priv->csr_base = csr_base;
1334 1334
1335 irq = irq_of_parse_and_map(ofdev->node, 0); 1335 irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
1336 if (irq < 0) { 1336 if (irq < 0) {
1337 dev_printk(KERN_ERR, &ofdev->dev, "invalid irq from platform\n"); 1337 dev_printk(KERN_ERR, &ofdev->dev, "invalid irq from platform\n");
1338 goto error_exit_with_cleanup; 1338 goto error_exit_with_cleanup;
@@ -1427,8 +1427,11 @@ static struct of_device_id fsl_sata_match[] = {
1427MODULE_DEVICE_TABLE(of, fsl_sata_match); 1427MODULE_DEVICE_TABLE(of, fsl_sata_match);
1428 1428
1429static struct of_platform_driver fsl_sata_driver = { 1429static struct of_platform_driver fsl_sata_driver = {
1430 .name = "fsl-sata", 1430 .driver = {
1431 .match_table = fsl_sata_match, 1431 .name = "fsl-sata",
1432 .owner = THIS_MODULE,
1433 .of_match_table = fsl_sata_match,
1434 },
1432 .probe = sata_fsl_probe, 1435 .probe = sata_fsl_probe,
1433 .remove = sata_fsl_remove, 1436 .remove = sata_fsl_remove,
1434#ifdef CONFIG_PM 1437#ifdef CONFIG_PM
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index f7d6ebaa0418..da8f176c051e 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -789,7 +789,7 @@ static int __init fore200e_sba_map(struct fore200e *fore200e)
789 fore200e->bus->write(0x02, fore200e->regs.sba.isr); /* XXX hardwired interrupt level */ 789 fore200e->bus->write(0x02, fore200e->regs.sba.isr); /* XXX hardwired interrupt level */
790 790
791 /* get the supported DVMA burst sizes */ 791 /* get the supported DVMA burst sizes */
792 bursts = of_getintprop_default(op->node->parent, "burst-sizes", 0x00); 792 bursts = of_getintprop_default(op->dev.of_node->parent, "burst-sizes", 0x00);
793 793
794 if (sbus_can_dma_64bit()) 794 if (sbus_can_dma_64bit())
795 sbus_set_sbus64(&op->dev, bursts); 795 sbus_set_sbus64(&op->dev, bursts);
@@ -820,18 +820,20 @@ static int __init fore200e_sba_prom_read(struct fore200e *fore200e, struct prom_
820 const u8 *prop; 820 const u8 *prop;
821 int len; 821 int len;
822 822
823 prop = of_get_property(op->node, "madaddrlo2", &len); 823 prop = of_get_property(op->dev.of_node, "madaddrlo2", &len);
824 if (!prop) 824 if (!prop)
825 return -ENODEV; 825 return -ENODEV;
826 memcpy(&prom->mac_addr[4], prop, 4); 826 memcpy(&prom->mac_addr[4], prop, 4);
827 827
828 prop = of_get_property(op->node, "madaddrhi4", &len); 828 prop = of_get_property(op->dev.of_node, "madaddrhi4", &len);
829 if (!prop) 829 if (!prop)
830 return -ENODEV; 830 return -ENODEV;
831 memcpy(&prom->mac_addr[2], prop, 4); 831 memcpy(&prom->mac_addr[2], prop, 4);
832 832
833 prom->serial_number = of_getintprop_default(op->node, "serialnumber", 0); 833 prom->serial_number = of_getintprop_default(op->dev.of_node,
834 prom->hw_revision = of_getintprop_default(op->node, "promversion", 0); 834 "serialnumber", 0);
835 prom->hw_revision = of_getintprop_default(op->dev.of_node,
836 "promversion", 0);
835 837
836 return 0; 838 return 0;
837} 839}
@@ -841,10 +843,10 @@ static int fore200e_sba_proc_read(struct fore200e *fore200e, char *page)
841 struct of_device *op = fore200e->bus_dev; 843 struct of_device *op = fore200e->bus_dev;
842 const struct linux_prom_registers *regs; 844 const struct linux_prom_registers *regs;
843 845
844 regs = of_get_property(op->node, "reg", NULL); 846 regs = of_get_property(op->dev.of_node, "reg", NULL);
845 847
846 return sprintf(page, " SBUS slot/device:\t\t%d/'%s'\n", 848 return sprintf(page, " SBUS slot/device:\t\t%d/'%s'\n",
847 (regs ? regs->which_io : 0), op->node->name); 849 (regs ? regs->which_io : 0), op->dev.of_node->name);
848} 850}
849#endif /* CONFIG_SBUS */ 851#endif /* CONFIG_SBUS */
850 852
@@ -2693,8 +2695,11 @@ static const struct of_device_id fore200e_sba_match[] = {
2693MODULE_DEVICE_TABLE(of, fore200e_sba_match); 2695MODULE_DEVICE_TABLE(of, fore200e_sba_match);
2694 2696
2695static struct of_platform_driver fore200e_sba_driver = { 2697static struct of_platform_driver fore200e_sba_driver = {
2696 .name = "fore_200e", 2698 .driver = {
2697 .match_table = fore200e_sba_match, 2699 .name = "fore_200e",
2700 .owner = THIS_MODULE,
2701 .of_match_table = fore200e_sba_match,
2702 },
2698 .probe = fore200e_sba_probe, 2703 .probe = fore200e_sba_probe,
2699 .remove = __devexit_p(fore200e_sba_remove), 2704 .remove = __devexit_p(fore200e_sba_remove),
2700}; 2705};
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index 59ca2b77b574..52f2d11bc7b9 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -1004,7 +1004,7 @@ static const struct block_device_operations floppy_fops = {
1004 1004
1005static int swim3_add_device(struct macio_dev *mdev, int index) 1005static int swim3_add_device(struct macio_dev *mdev, int index)
1006{ 1006{
1007 struct device_node *swim = mdev->ofdev.node; 1007 struct device_node *swim = mdev->ofdev.dev.of_node;
1008 struct floppy_state *fs = &floppy_states[index]; 1008 struct floppy_state *fs = &floppy_states[index];
1009 int rc = -EBUSY; 1009 int rc = -EBUSY;
1010 1010
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index e1c95e208a66..a7b83c0a7eb5 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -1198,10 +1198,10 @@ ace_of_probe(struct of_device *op, const struct of_device_id *match)
1198 dev_dbg(&op->dev, "ace_of_probe(%p, %p)\n", op, match); 1198 dev_dbg(&op->dev, "ace_of_probe(%p, %p)\n", op, match);
1199 1199
1200 /* device id */ 1200 /* device id */
1201 id = of_get_property(op->node, "port-number", NULL); 1201 id = of_get_property(op->dev.of_node, "port-number", NULL);
1202 1202
1203 /* physaddr */ 1203 /* physaddr */
1204 rc = of_address_to_resource(op->node, 0, &res); 1204 rc = of_address_to_resource(op->dev.of_node, 0, &res);
1205 if (rc) { 1205 if (rc) {
1206 dev_err(&op->dev, "invalid address\n"); 1206 dev_err(&op->dev, "invalid address\n");
1207 return rc; 1207 return rc;
@@ -1209,11 +1209,11 @@ ace_of_probe(struct of_device *op, const struct of_device_id *match)
1209 physaddr = res.start; 1209 physaddr = res.start;
1210 1210
1211 /* irq */ 1211 /* irq */
1212 irq = irq_of_parse_and_map(op->node, 0); 1212 irq = irq_of_parse_and_map(op->dev.of_node, 0);
1213 1213
1214 /* bus width */ 1214 /* bus width */
1215 bus_width = ACE_BUS_WIDTH_16; 1215 bus_width = ACE_BUS_WIDTH_16;
1216 if (of_find_property(op->node, "8-bit", NULL)) 1216 if (of_find_property(op->dev.of_node, "8-bit", NULL))
1217 bus_width = ACE_BUS_WIDTH_8; 1217 bus_width = ACE_BUS_WIDTH_8;
1218 1218
1219 /* Call the bus-independant setup code */ 1219 /* Call the bus-independant setup code */
@@ -1237,13 +1237,12 @@ static const struct of_device_id ace_of_match[] __devinitconst = {
1237MODULE_DEVICE_TABLE(of, ace_of_match); 1237MODULE_DEVICE_TABLE(of, ace_of_match);
1238 1238
1239static struct of_platform_driver ace_of_driver = { 1239static struct of_platform_driver ace_of_driver = {
1240 .owner = THIS_MODULE,
1241 .name = "xsysace",
1242 .match_table = ace_of_match,
1243 .probe = ace_of_probe, 1240 .probe = ace_of_probe,
1244 .remove = __devexit_p(ace_of_remove), 1241 .remove = __devexit_p(ace_of_remove),
1245 .driver = { 1242 .driver = {
1246 .name = "xsysace", 1243 .name = "xsysace",
1244 .owner = THIS_MODULE,
1245 .of_match_table = ace_of_match,
1247 }, 1246 },
1248}; 1247};
1249 1248
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
index cc435be0bc13..451cd7071b1d 100644
--- a/drivers/cdrom/viocd.c
+++ b/drivers/cdrom/viocd.c
@@ -567,7 +567,7 @@ static int viocd_probe(struct vio_dev *vdev, const struct vio_device_id *id)
567 struct disk_info *d; 567 struct disk_info *d;
568 struct cdrom_device_info *c; 568 struct cdrom_device_info *c;
569 struct request_queue *q; 569 struct request_queue *q;
570 struct device_node *node = vdev->dev.archdata.of_node; 570 struct device_node *node = vdev->dev.of_node;
571 571
572 deviceno = vdev->unit_address; 572 deviceno = vdev->unit_address;
573 if (deviceno >= VIOCD_MAX_CD) 573 if (deviceno >= VIOCD_MAX_CD)
diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c
index 10f868eefaa6..0f9cbf1aaf15 100644
--- a/drivers/char/hw_random/n2-drv.c
+++ b/drivers/char/hw_random/n2-drv.c
@@ -660,7 +660,7 @@ static int __devinit n2rng_probe(struct of_device *op,
660 np->hvapi_major); 660 np->hvapi_major);
661 goto out_hvapi_unregister; 661 goto out_hvapi_unregister;
662 } 662 }
663 np->num_units = of_getintprop_default(op->node, 663 np->num_units = of_getintprop_default(op->dev.of_node,
664 "rng-#units", 0); 664 "rng-#units", 0);
665 if (!np->num_units) { 665 if (!np->num_units) {
666 dev_err(&op->dev, "VF RNG lacks rng-#units property\n"); 666 dev_err(&op->dev, "VF RNG lacks rng-#units property\n");
@@ -751,8 +751,11 @@ static const struct of_device_id n2rng_match[] = {
751MODULE_DEVICE_TABLE(of, n2rng_match); 751MODULE_DEVICE_TABLE(of, n2rng_match);
752 752
753static struct of_platform_driver n2rng_driver = { 753static struct of_platform_driver n2rng_driver = {
754 .name = "n2rng", 754 .driver = {
755 .match_table = n2rng_match, 755 .name = "n2rng",
756 .owner = THIS_MODULE,
757 .of_match_table = n2rng_match,
758 },
756 .probe = n2rng_probe, 759 .probe = n2rng_probe,
757 .remove = __devexit_p(n2rng_remove), 760 .remove = __devexit_p(n2rng_remove),
758}; 761};
diff --git a/drivers/char/hw_random/pasemi-rng.c b/drivers/char/hw_random/pasemi-rng.c
index 7fa61dd1d9d9..261ba8f22b8b 100644
--- a/drivers/char/hw_random/pasemi-rng.c
+++ b/drivers/char/hw_random/pasemi-rng.c
@@ -98,7 +98,7 @@ static int __devinit rng_probe(struct of_device *ofdev,
98 const struct of_device_id *match) 98 const struct of_device_id *match)
99{ 99{
100 void __iomem *rng_regs; 100 void __iomem *rng_regs;
101 struct device_node *rng_np = ofdev->node; 101 struct device_node *rng_np = ofdev->dev.of_node;
102 struct resource res; 102 struct resource res;
103 int err = 0; 103 int err = 0;
104 104
@@ -140,8 +140,11 @@ static struct of_device_id rng_match[] = {
140}; 140};
141 141
142static struct of_platform_driver rng_driver = { 142static struct of_platform_driver rng_driver = {
143 .name = "pasemi-rng", 143 .driver = {
144 .match_table = rng_match, 144 .name = "pasemi-rng",
145 .owner = THIS_MODULE,
146 .of_match_table = rng_match,
147 },
145 .probe = rng_probe, 148 .probe = rng_probe,
146 .remove = rng_remove, 149 .remove = rng_remove,
147}; 150};
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 4462b113ba3f..47ffe4a90a95 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2469,7 +2469,7 @@ static int __devinit ipmi_of_probe(struct of_device *dev,
2469 struct smi_info *info; 2469 struct smi_info *info;
2470 struct resource resource; 2470 struct resource resource;
2471 const int *regsize, *regspacing, *regshift; 2471 const int *regsize, *regspacing, *regshift;
2472 struct device_node *np = dev->node; 2472 struct device_node *np = dev->dev.of_node;
2473 int ret; 2473 int ret;
2474 int proplen; 2474 int proplen;
2475 2475
@@ -2525,7 +2525,7 @@ static int __devinit ipmi_of_probe(struct of_device *dev,
2525 info->io.regspacing = regspacing ? *regspacing : DEFAULT_REGSPACING; 2525 info->io.regspacing = regspacing ? *regspacing : DEFAULT_REGSPACING;
2526 info->io.regshift = regshift ? *regshift : 0; 2526 info->io.regshift = regshift ? *regshift : 0;
2527 2527
2528 info->irq = irq_of_parse_and_map(dev->node, 0); 2528 info->irq = irq_of_parse_and_map(dev->dev.of_node, 0);
2529 info->dev = &dev->dev; 2529 info->dev = &dev->dev;
2530 2530
2531 dev_dbg(&dev->dev, "addr 0x%lx regsize %d spacing %d irq %x\n", 2531 dev_dbg(&dev->dev, "addr 0x%lx regsize %d spacing %d irq %x\n",
@@ -2555,8 +2555,11 @@ static struct of_device_id ipmi_match[] =
2555}; 2555};
2556 2556
2557static struct of_platform_driver ipmi_of_platform_driver = { 2557static struct of_platform_driver ipmi_of_platform_driver = {
2558 .name = "ipmi", 2558 .driver = {
2559 .match_table = ipmi_match, 2559 .name = "ipmi",
2560 .owner = THIS_MODULE,
2561 .of_match_table = ipmi_match,
2562 },
2560 .probe = ipmi_of_probe, 2563 .probe = ipmi_of_probe,
2561 .remove = __devexit_p(ipmi_of_remove), 2564 .remove = __devexit_p(ipmi_of_remove),
2562}; 2565};
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c
index 1144a04cda6e..42f7fa442ff8 100644
--- a/drivers/char/viotape.c
+++ b/drivers/char/viotape.c
@@ -866,7 +866,7 @@ static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id)
866{ 866{
867 int i = vdev->unit_address; 867 int i = vdev->unit_address;
868 int j; 868 int j;
869 struct device_node *node = vdev->dev.archdata.of_node; 869 struct device_node *node = vdev->dev.of_node;
870 870
871 if (i >= VIOTAPE_MAX_TAPE) 871 if (i >= VIOTAPE_MAX_TAPE)
872 return -ENODEV; 872 return -ENODEV;
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 7261b8d9087c..ed8a9cec2a05 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -772,18 +772,18 @@ hwicap_of_probe(struct of_device *op, const struct of_device_id *match)
772 772
773 dev_dbg(&op->dev, "hwicap_of_probe(%p, %p)\n", op, match); 773 dev_dbg(&op->dev, "hwicap_of_probe(%p, %p)\n", op, match);
774 774
775 rc = of_address_to_resource(op->node, 0, &res); 775 rc = of_address_to_resource(op->dev.of_node, 0, &res);
776 if (rc) { 776 if (rc) {
777 dev_err(&op->dev, "invalid address\n"); 777 dev_err(&op->dev, "invalid address\n");
778 return rc; 778 return rc;
779 } 779 }
780 780
781 id = of_get_property(op->node, "port-number", NULL); 781 id = of_get_property(op->dev.of_node, "port-number", NULL);
782 782
783 /* It's most likely that we're using V4, if the family is not 783 /* It's most likely that we're using V4, if the family is not
784 specified */ 784 specified */
785 regs = &v4_config_registers; 785 regs = &v4_config_registers;
786 family = of_get_property(op->node, "xlnx,family", NULL); 786 family = of_get_property(op->dev.of_node, "xlnx,family", NULL);
787 787
788 if (family) { 788 if (family) {
789 if (!strcmp(family, "virtex2p")) { 789 if (!strcmp(family, "virtex2p")) {
@@ -812,13 +812,12 @@ static const struct of_device_id __devinitconst hwicap_of_match[] = {
812MODULE_DEVICE_TABLE(of, hwicap_of_match); 812MODULE_DEVICE_TABLE(of, hwicap_of_match);
813 813
814static struct of_platform_driver hwicap_of_driver = { 814static struct of_platform_driver hwicap_of_driver = {
815 .owner = THIS_MODULE,
816 .name = DRIVER_NAME,
817 .match_table = hwicap_of_match,
818 .probe = hwicap_of_probe, 815 .probe = hwicap_of_probe,
819 .remove = __devexit_p(hwicap_of_remove), 816 .remove = __devexit_p(hwicap_of_remove),
820 .driver = { 817 .driver = {
821 .name = DRIVER_NAME, 818 .name = DRIVER_NAME,
819 .owner = THIS_MODULE,
820 .of_match_table = hwicap_of_match,
822 }, 821 },
823}; 822};
824 823
diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
index 6c4c8b7ce3aa..9d65b371de64 100644
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
@@ -1281,8 +1281,11 @@ static const struct of_device_id crypto4xx_match[] = {
1281}; 1281};
1282 1282
1283static struct of_platform_driver crypto4xx_driver = { 1283static struct of_platform_driver crypto4xx_driver = {
1284 .name = "crypto4xx", 1284 .driver = {
1285 .match_table = crypto4xx_match, 1285 .name = "crypto4xx",
1286 .owner = THIS_MODULE,
1287 .of_match_table = crypto4xx_match,
1288 },
1286 .probe = crypto4xx_probe, 1289 .probe = crypto4xx_probe,
1287 .remove = crypto4xx_remove, 1290 .remove = crypto4xx_remove,
1288}; 1291};
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 6a0f59d1fc5c..637c105f53d2 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -2398,7 +2398,7 @@ static int talitos_probe(struct of_device *ofdev,
2398 const struct of_device_id *match) 2398 const struct of_device_id *match)
2399{ 2399{
2400 struct device *dev = &ofdev->dev; 2400 struct device *dev = &ofdev->dev;
2401 struct device_node *np = ofdev->node; 2401 struct device_node *np = ofdev->dev.of_node;
2402 struct talitos_private *priv; 2402 struct talitos_private *priv;
2403 const unsigned int *prop; 2403 const unsigned int *prop;
2404 int i, err; 2404 int i, err;
@@ -2573,8 +2573,11 @@ static const struct of_device_id talitos_match[] = {
2573MODULE_DEVICE_TABLE(of, talitos_match); 2573MODULE_DEVICE_TABLE(of, talitos_match);
2574 2574
2575static struct of_platform_driver talitos_driver = { 2575static struct of_platform_driver talitos_driver = {
2576 .name = "talitos", 2576 .driver = {
2577 .match_table = talitos_match, 2577 .name = "talitos",
2578 .owner = THIS_MODULE,
2579 .of_match_table = talitos_match,
2580 },
2578 .probe = talitos_probe, 2581 .probe = talitos_probe,
2579 .remove = talitos_remove, 2582 .remove = talitos_remove,
2580}; 2583};
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index 1fdf180cbd67..8088b14ba5f7 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -1315,7 +1315,7 @@ static int __devinit fsldma_of_probe(struct of_device *op,
1315 INIT_LIST_HEAD(&fdev->common.channels); 1315 INIT_LIST_HEAD(&fdev->common.channels);
1316 1316
1317 /* ioremap the registers for use */ 1317 /* ioremap the registers for use */
1318 fdev->regs = of_iomap(op->node, 0); 1318 fdev->regs = of_iomap(op->dev.of_node, 0);
1319 if (!fdev->regs) { 1319 if (!fdev->regs) {
1320 dev_err(&op->dev, "unable to ioremap registers\n"); 1320 dev_err(&op->dev, "unable to ioremap registers\n");
1321 err = -ENOMEM; 1321 err = -ENOMEM;
@@ -1323,7 +1323,7 @@ static int __devinit fsldma_of_probe(struct of_device *op,
1323 } 1323 }
1324 1324
1325 /* map the channel IRQ if it exists, but don't hookup the handler yet */ 1325 /* map the channel IRQ if it exists, but don't hookup the handler yet */
1326 fdev->irq = irq_of_parse_and_map(op->node, 0); 1326 fdev->irq = irq_of_parse_and_map(op->dev.of_node, 0);
1327 1327
1328 dma_cap_set(DMA_MEMCPY, fdev->common.cap_mask); 1328 dma_cap_set(DMA_MEMCPY, fdev->common.cap_mask);
1329 dma_cap_set(DMA_INTERRUPT, fdev->common.cap_mask); 1329 dma_cap_set(DMA_INTERRUPT, fdev->common.cap_mask);
@@ -1345,7 +1345,7 @@ static int __devinit fsldma_of_probe(struct of_device *op,
1345 * of_platform_bus_remove(). Instead, we manually instantiate every DMA 1345 * of_platform_bus_remove(). Instead, we manually instantiate every DMA
1346 * channel object. 1346 * channel object.
1347 */ 1347 */
1348 for_each_child_of_node(op->node, child) { 1348 for_each_child_of_node(op->dev.of_node, child) {
1349 if (of_device_is_compatible(child, "fsl,eloplus-dma-channel")) { 1349 if (of_device_is_compatible(child, "fsl,eloplus-dma-channel")) {
1350 fsl_dma_chan_probe(fdev, child, 1350 fsl_dma_chan_probe(fdev, child,
1351 FSL_DMA_IP_85XX | FSL_DMA_BIG_ENDIAN, 1351 FSL_DMA_IP_85XX | FSL_DMA_BIG_ENDIAN,
@@ -1411,10 +1411,13 @@ static const struct of_device_id fsldma_of_ids[] = {
1411}; 1411};
1412 1412
1413static struct of_platform_driver fsldma_of_driver = { 1413static struct of_platform_driver fsldma_of_driver = {
1414 .name = "fsl-elo-dma", 1414 .driver = {
1415 .match_table = fsldma_of_ids, 1415 .name = "fsl-elo-dma",
1416 .probe = fsldma_of_probe, 1416 .owner = THIS_MODULE,
1417 .remove = fsldma_of_remove, 1417 .of_match_table = fsldma_of_ids,
1418 },
1419 .probe = fsldma_of_probe,
1420 .remove = fsldma_of_remove,
1418}; 1421};
1419 1422
1420/*----------------------------------------------------------------------------*/ 1423/*----------------------------------------------------------------------------*/
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index c6079fcca13f..fa98abe4686f 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -4944,12 +4944,12 @@ static const struct of_device_id ppc440spe_adma_of_match[] __devinitconst = {
4944MODULE_DEVICE_TABLE(of, ppc440spe_adma_of_match); 4944MODULE_DEVICE_TABLE(of, ppc440spe_adma_of_match);
4945 4945
4946static struct of_platform_driver ppc440spe_adma_driver = { 4946static struct of_platform_driver ppc440spe_adma_driver = {
4947 .match_table = ppc440spe_adma_of_match,
4948 .probe = ppc440spe_adma_probe, 4947 .probe = ppc440spe_adma_probe,
4949 .remove = __devexit_p(ppc440spe_adma_remove), 4948 .remove = __devexit_p(ppc440spe_adma_remove),
4950 .driver = { 4949 .driver = {
4951 .name = "PPC440SP(E)-ADMA", 4950 .name = "PPC440SP(E)-ADMA",
4952 .owner = THIS_MODULE, 4951 .owner = THIS_MODULE,
4952 .of_match_table = ppc440spe_adma_of_match,
4953 }, 4953 },
4954}; 4954};
4955 4955
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index a1727522343e..a2a519fd2a24 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -722,6 +722,10 @@ static void sh_dmae_chan_ld_cleanup(struct sh_dmae_chan *sh_chan, bool all)
722{ 722{
723 while (__ld_cleanup(sh_chan, all)) 723 while (__ld_cleanup(sh_chan, all))
724 ; 724 ;
725
726 if (all)
727 /* Terminating - forgive uncompleted cookies */
728 sh_chan->completed_cookie = sh_chan->common.cookie;
725} 729}
726 730
727static void sh_chan_xfer_ld_queue(struct sh_dmae_chan *sh_chan) 731static void sh_chan_xfer_ld_queue(struct sh_dmae_chan *sh_chan)
@@ -1188,6 +1192,7 @@ static struct platform_driver sh_dmae_driver = {
1188 .remove = __exit_p(sh_dmae_remove), 1192 .remove = __exit_p(sh_dmae_remove),
1189 .shutdown = sh_dmae_shutdown, 1193 .shutdown = sh_dmae_shutdown,
1190 .driver = { 1194 .driver = {
1195 .owner = THIS_MODULE,
1191 .name = "sh-dma-engine", 1196 .name = "sh-dma-engine",
1192 }, 1197 },
1193}; 1198};
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index 4471647b4807..6c1886b497ff 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -338,15 +338,13 @@ static struct of_device_id mpc85xx_pci_err_of_match[] = {
338}; 338};
339 339
340static struct of_platform_driver mpc85xx_pci_err_driver = { 340static struct of_platform_driver mpc85xx_pci_err_driver = {
341 .owner = THIS_MODULE,
342 .name = "mpc85xx_pci_err",
343 .match_table = mpc85xx_pci_err_of_match,
344 .probe = mpc85xx_pci_err_probe, 341 .probe = mpc85xx_pci_err_probe,
345 .remove = __devexit_p(mpc85xx_pci_err_remove), 342 .remove = __devexit_p(mpc85xx_pci_err_remove),
346 .driver = { 343 .driver = {
347 .name = "mpc85xx_pci_err", 344 .name = "mpc85xx_pci_err",
348 .owner = THIS_MODULE, 345 .owner = THIS_MODULE,
349 }, 346 .of_match_table = mpc85xx_pci_err_of_match,
347 },
350}; 348};
351 349
352#endif /* CONFIG_PCI */ 350#endif /* CONFIG_PCI */
@@ -654,15 +652,13 @@ static struct of_device_id mpc85xx_l2_err_of_match[] = {
654}; 652};
655 653
656static struct of_platform_driver mpc85xx_l2_err_driver = { 654static struct of_platform_driver mpc85xx_l2_err_driver = {
657 .owner = THIS_MODULE,
658 .name = "mpc85xx_l2_err",
659 .match_table = mpc85xx_l2_err_of_match,
660 .probe = mpc85xx_l2_err_probe, 655 .probe = mpc85xx_l2_err_probe,
661 .remove = mpc85xx_l2_err_remove, 656 .remove = mpc85xx_l2_err_remove,
662 .driver = { 657 .driver = {
663 .name = "mpc85xx_l2_err", 658 .name = "mpc85xx_l2_err",
664 .owner = THIS_MODULE, 659 .owner = THIS_MODULE,
665 }, 660 .of_match_table = mpc85xx_l2_err_of_match,
661 },
666}; 662};
667 663
668/**************************** MC Err device ***************************/ 664/**************************** MC Err device ***************************/
@@ -1131,15 +1127,13 @@ static struct of_device_id mpc85xx_mc_err_of_match[] = {
1131}; 1127};
1132 1128
1133static struct of_platform_driver mpc85xx_mc_err_driver = { 1129static struct of_platform_driver mpc85xx_mc_err_driver = {
1134 .owner = THIS_MODULE,
1135 .name = "mpc85xx_mc_err",
1136 .match_table = mpc85xx_mc_err_of_match,
1137 .probe = mpc85xx_mc_err_probe, 1130 .probe = mpc85xx_mc_err_probe,
1138 .remove = mpc85xx_mc_err_remove, 1131 .remove = mpc85xx_mc_err_remove,
1139 .driver = { 1132 .driver = {
1140 .name = "mpc85xx_mc_err", 1133 .name = "mpc85xx_mc_err",
1141 .owner = THIS_MODULE, 1134 .owner = THIS_MODULE,
1142 }, 1135 .of_match_table = mpc85xx_mc_err_of_match,
1136 },
1143}; 1137};
1144 1138
1145#ifdef CONFIG_MPC85xx 1139#ifdef CONFIG_MPC85xx
diff --git a/drivers/edac/ppc4xx_edac.c b/drivers/edac/ppc4xx_edac.c
index 11f2172aa1e6..9d6f6783328c 100644
--- a/drivers/edac/ppc4xx_edac.c
+++ b/drivers/edac/ppc4xx_edac.c
@@ -202,13 +202,13 @@ static struct of_device_id ppc4xx_edac_match[] = {
202}; 202};
203 203
204static struct of_platform_driver ppc4xx_edac_driver = { 204static struct of_platform_driver ppc4xx_edac_driver = {
205 .match_table = ppc4xx_edac_match,
206 .probe = ppc4xx_edac_probe, 205 .probe = ppc4xx_edac_probe,
207 .remove = ppc4xx_edac_remove, 206 .remove = ppc4xx_edac_remove,
208 .driver = { 207 .driver = {
209 .owner = THIS_MODULE, 208 .owner = THIS_MODULE,
210 .name = PPC4XX_EDAC_MODULE_NAME 209 .name = PPC4XX_EDAC_MODULE_NAME
211 } 210 .of_match_table = ppc4xx_edac_match,
211 },
212}; 212};
213 213
214/* 214/*
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index b827c976dc62..f156ab3bb6ed 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -449,7 +449,7 @@ pca953x_get_alt_pdata(struct i2c_client *client)
449 struct device_node *node; 449 struct device_node *node;
450 const uint16_t *val; 450 const uint16_t *val;
451 451
452 node = dev_archdata_get_node(&client->dev.archdata); 452 node = client->dev.of_node;
453 if (node == NULL) 453 if (node == NULL)
454 return NULL; 454 return NULL;
455 455
diff --git a/drivers/hwmon/ultra45_env.c b/drivers/hwmon/ultra45_env.c
index 68e90abeba96..5da5942cf970 100644
--- a/drivers/hwmon/ultra45_env.c
+++ b/drivers/hwmon/ultra45_env.c
@@ -300,8 +300,11 @@ static const struct of_device_id env_match[] = {
300MODULE_DEVICE_TABLE(of, env_match); 300MODULE_DEVICE_TABLE(of, env_match);
301 301
302static struct of_platform_driver env_driver = { 302static struct of_platform_driver env_driver = {
303 .name = "ultra45_env", 303 .driver = {
304 .match_table = env_match, 304 .name = "ultra45_env",
305 .owner = THIS_MODULE,
306 .of_match_table = env_match,
307 },
305 .probe = env_probe, 308 .probe = env_probe,
306 .remove = __devexit_p(env_remove), 309 .remove = __devexit_p(env_remove),
307}; 310};
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index 16948db38973..b02b4533651d 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -440,7 +440,7 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
440 440
441 init_waitqueue_head(&cpm->i2c_wait); 441 init_waitqueue_head(&cpm->i2c_wait);
442 442
443 cpm->irq = of_irq_to_resource(ofdev->node, 0, NULL); 443 cpm->irq = of_irq_to_resource(ofdev->dev.of_node, 0, NULL);
444 if (!cpm->irq) 444 if (!cpm->irq)
445 return -EINVAL; 445 return -EINVAL;
446 446
@@ -451,13 +451,13 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
451 return ret; 451 return ret;
452 452
453 /* I2C parameter RAM */ 453 /* I2C parameter RAM */
454 i2c_base = of_iomap(ofdev->node, 1); 454 i2c_base = of_iomap(ofdev->dev.of_node, 1);
455 if (i2c_base == NULL) { 455 if (i2c_base == NULL) {
456 ret = -EINVAL; 456 ret = -EINVAL;
457 goto out_irq; 457 goto out_irq;
458 } 458 }
459 459
460 if (of_device_is_compatible(ofdev->node, "fsl,cpm1-i2c")) { 460 if (of_device_is_compatible(ofdev->dev.of_node, "fsl,cpm1-i2c")) {
461 461
462 /* Check for and use a microcode relocation patch. */ 462 /* Check for and use a microcode relocation patch. */
463 cpm->i2c_ram = i2c_base; 463 cpm->i2c_ram = i2c_base;
@@ -474,7 +474,7 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
474 474
475 cpm->version = 1; 475 cpm->version = 1;
476 476
477 } else if (of_device_is_compatible(ofdev->node, "fsl,cpm2-i2c")) { 477 } else if (of_device_is_compatible(ofdev->dev.of_node, "fsl,cpm2-i2c")) {
478 cpm->i2c_addr = cpm_muram_alloc(sizeof(struct i2c_ram), 64); 478 cpm->i2c_addr = cpm_muram_alloc(sizeof(struct i2c_ram), 64);
479 cpm->i2c_ram = cpm_muram_addr(cpm->i2c_addr); 479 cpm->i2c_ram = cpm_muram_addr(cpm->i2c_addr);
480 out_be16(i2c_base, cpm->i2c_addr); 480 out_be16(i2c_base, cpm->i2c_addr);
@@ -489,24 +489,24 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
489 } 489 }
490 490
491 /* I2C control/status registers */ 491 /* I2C control/status registers */
492 cpm->i2c_reg = of_iomap(ofdev->node, 0); 492 cpm->i2c_reg = of_iomap(ofdev->dev.of_node, 0);
493 if (cpm->i2c_reg == NULL) { 493 if (cpm->i2c_reg == NULL) {
494 ret = -EINVAL; 494 ret = -EINVAL;
495 goto out_ram; 495 goto out_ram;
496 } 496 }
497 497
498 data = of_get_property(ofdev->node, "fsl,cpm-command", &len); 498 data = of_get_property(ofdev->dev.of_node, "fsl,cpm-command", &len);
499 if (!data || len != 4) { 499 if (!data || len != 4) {
500 ret = -EINVAL; 500 ret = -EINVAL;
501 goto out_reg; 501 goto out_reg;
502 } 502 }
503 cpm->cp_command = *data; 503 cpm->cp_command = *data;
504 504
505 data = of_get_property(ofdev->node, "linux,i2c-class", &len); 505 data = of_get_property(ofdev->dev.of_node, "linux,i2c-class", &len);
506 if (data && len == 4) 506 if (data && len == 4)
507 cpm->adap.class = *data; 507 cpm->adap.class = *data;
508 508
509 data = of_get_property(ofdev->node, "clock-frequency", &len); 509 data = of_get_property(ofdev->dev.of_node, "clock-frequency", &len);
510 if (data && len == 4) 510 if (data && len == 4)
511 cpm->freq = *data; 511 cpm->freq = *data;
512 else 512 else
@@ -661,7 +661,7 @@ static int __devinit cpm_i2c_probe(struct of_device *ofdev,
661 661
662 /* register new adapter to i2c module... */ 662 /* register new adapter to i2c module... */
663 663
664 data = of_get_property(ofdev->node, "linux,i2c-index", &len); 664 data = of_get_property(ofdev->dev.of_node, "linux,i2c-index", &len);
665 if (data && len == 4) { 665 if (data && len == 4) {
666 cpm->adap.nr = *data; 666 cpm->adap.nr = *data;
667 result = i2c_add_numbered_adapter(&cpm->adap); 667 result = i2c_add_numbered_adapter(&cpm->adap);
@@ -679,7 +679,7 @@ static int __devinit cpm_i2c_probe(struct of_device *ofdev,
679 /* 679 /*
680 * register OF I2C devices 680 * register OF I2C devices
681 */ 681 */
682 of_register_i2c_devices(&cpm->adap, ofdev->node); 682 of_register_i2c_devices(&cpm->adap, ofdev->dev.of_node);
683 683
684 return 0; 684 return 0;
685out_shut: 685out_shut:
@@ -718,13 +718,13 @@ static const struct of_device_id cpm_i2c_match[] = {
718MODULE_DEVICE_TABLE(of, cpm_i2c_match); 718MODULE_DEVICE_TABLE(of, cpm_i2c_match);
719 719
720static struct of_platform_driver cpm_i2c_driver = { 720static struct of_platform_driver cpm_i2c_driver = {
721 .match_table = cpm_i2c_match,
722 .probe = cpm_i2c_probe, 721 .probe = cpm_i2c_probe,
723 .remove = __devexit_p(cpm_i2c_remove), 722 .remove = __devexit_p(cpm_i2c_remove),
724 .driver = { 723 .driver = {
725 .name = "fsl-i2c-cpm", 724 .name = "fsl-i2c-cpm",
726 .owner = THIS_MODULE, 725 .owner = THIS_MODULE,
727 } 726 .of_match_table = cpm_i2c_match,
727 },
728}; 728};
729 729
730static int __init cpm_i2c_init(void) 730static int __init cpm_i2c_init(void)
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index f8ccc0fe95a8..bf344135647a 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -664,7 +664,7 @@ static inline u8 iic_clckdiv(unsigned int opb)
664static int __devinit iic_request_irq(struct of_device *ofdev, 664static int __devinit iic_request_irq(struct of_device *ofdev,
665 struct ibm_iic_private *dev) 665 struct ibm_iic_private *dev)
666{ 666{
667 struct device_node *np = ofdev->node; 667 struct device_node *np = ofdev->dev.of_node;
668 int irq; 668 int irq;
669 669
670 if (iic_force_poll) 670 if (iic_force_poll)
@@ -695,7 +695,7 @@ static int __devinit iic_request_irq(struct of_device *ofdev,
695static int __devinit iic_probe(struct of_device *ofdev, 695static int __devinit iic_probe(struct of_device *ofdev,
696 const struct of_device_id *match) 696 const struct of_device_id *match)
697{ 697{
698 struct device_node *np = ofdev->node; 698 struct device_node *np = ofdev->dev.of_node;
699 struct ibm_iic_private *dev; 699 struct ibm_iic_private *dev;
700 struct i2c_adapter *adap; 700 struct i2c_adapter *adap;
701 const u32 *freq; 701 const u32 *freq;
@@ -807,8 +807,11 @@ static const struct of_device_id ibm_iic_match[] = {
807}; 807};
808 808
809static struct of_platform_driver ibm_iic_driver = { 809static struct of_platform_driver ibm_iic_driver = {
810 .name = "ibm-iic", 810 .driver = {
811 .match_table = ibm_iic_match, 811 .name = "ibm-iic",
812 .owner = THIS_MODULE,
813 .of_match_table = ibm_iic_match,
814 },
812 .probe = iic_probe, 815 .probe = iic_probe,
813 .remove = __devexit_p(iic_remove), 816 .remove = __devexit_p(iic_remove),
814}; 817};
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index e86cef300c7d..df00eb1f11f9 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -560,14 +560,14 @@ static int __devinit fsl_i2c_probe(struct of_device *op,
560 560
561 init_waitqueue_head(&i2c->queue); 561 init_waitqueue_head(&i2c->queue);
562 562
563 i2c->base = of_iomap(op->node, 0); 563 i2c->base = of_iomap(op->dev.of_node, 0);
564 if (!i2c->base) { 564 if (!i2c->base) {
565 dev_err(i2c->dev, "failed to map controller\n"); 565 dev_err(i2c->dev, "failed to map controller\n");
566 result = -ENOMEM; 566 result = -ENOMEM;
567 goto fail_map; 567 goto fail_map;
568 } 568 }
569 569
570 i2c->irq = irq_of_parse_and_map(op->node, 0); 570 i2c->irq = irq_of_parse_and_map(op->dev.of_node, 0);
571 if (i2c->irq) { /* no i2c->irq implies polling */ 571 if (i2c->irq) { /* no i2c->irq implies polling */
572 result = request_irq(i2c->irq, mpc_i2c_isr, 572 result = request_irq(i2c->irq, mpc_i2c_isr,
573 IRQF_SHARED, "i2c-mpc", i2c); 573 IRQF_SHARED, "i2c-mpc", i2c);
@@ -577,21 +577,22 @@ static int __devinit fsl_i2c_probe(struct of_device *op,
577 } 577 }
578 } 578 }
579 579
580 if (of_get_property(op->node, "fsl,preserve-clocking", NULL)) { 580 if (of_get_property(op->dev.of_node, "fsl,preserve-clocking", NULL)) {
581 clock = MPC_I2C_CLOCK_PRESERVE; 581 clock = MPC_I2C_CLOCK_PRESERVE;
582 } else { 582 } else {
583 prop = of_get_property(op->node, "clock-frequency", &plen); 583 prop = of_get_property(op->dev.of_node, "clock-frequency",
584 &plen);
584 if (prop && plen == sizeof(u32)) 585 if (prop && plen == sizeof(u32))
585 clock = *prop; 586 clock = *prop;
586 } 587 }
587 588
588 if (match->data) { 589 if (match->data) {
589 struct mpc_i2c_data *data = match->data; 590 struct mpc_i2c_data *data = match->data;
590 data->setup(op->node, i2c, clock, data->prescaler); 591 data->setup(op->dev.of_node, i2c, clock, data->prescaler);
591 } else { 592 } else {
592 /* Backwards compatibility */ 593 /* Backwards compatibility */
593 if (of_get_property(op->node, "dfsrr", NULL)) 594 if (of_get_property(op->dev.of_node, "dfsrr", NULL))
594 mpc_i2c_setup_8xxx(op->node, i2c, clock, 0); 595 mpc_i2c_setup_8xxx(op->dev.of_node, i2c, clock, 0);
595 } 596 }
596 597
597 dev_set_drvdata(&op->dev, i2c); 598 dev_set_drvdata(&op->dev, i2c);
@@ -605,7 +606,7 @@ static int __devinit fsl_i2c_probe(struct of_device *op,
605 dev_err(i2c->dev, "failed to add adapter\n"); 606 dev_err(i2c->dev, "failed to add adapter\n");
606 goto fail_add; 607 goto fail_add;
607 } 608 }
608 of_register_i2c_devices(&i2c->adap, op->node); 609 of_register_i2c_devices(&i2c->adap, op->dev.of_node);
609 610
610 return result; 611 return result;
611 612
@@ -674,12 +675,12 @@ MODULE_DEVICE_TABLE(of, mpc_i2c_of_match);
674 675
675/* Structure for a device driver */ 676/* Structure for a device driver */
676static struct of_platform_driver mpc_i2c_driver = { 677static struct of_platform_driver mpc_i2c_driver = {
677 .match_table = mpc_i2c_of_match,
678 .probe = fsl_i2c_probe, 678 .probe = fsl_i2c_probe,
679 .remove = __devexit_p(fsl_i2c_remove), 679 .remove = __devexit_p(fsl_i2c_remove),
680 .driver = { 680 .driver = {
681 .owner = THIS_MODULE, 681 .owner = THIS_MODULE,
682 .name = DRV_NAME, 682 .name = DRV_NAME,
683 .of_match_table = mpc_i2c_of_match,
683 }, 684 },
684}; 685};
685 686
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index db3c9f3a7647..e0f833cca3f1 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -418,6 +418,9 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
418 client->dev.parent = &client->adapter->dev; 418 client->dev.parent = &client->adapter->dev;
419 client->dev.bus = &i2c_bus_type; 419 client->dev.bus = &i2c_bus_type;
420 client->dev.type = &i2c_client_type; 420 client->dev.type = &i2c_client_type;
421#ifdef CONFIG_OF
422 client->dev.of_node = info->of_node;
423#endif
421 424
422 dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap), 425 dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap),
423 client->addr); 426 client->addr);
diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c
index 159955d16c47..183fa38760d8 100644
--- a/drivers/ide/pmac.c
+++ b/drivers/ide/pmac.c
@@ -1153,7 +1153,7 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match)
1153 1153
1154 if (macio_resource_count(mdev) == 0) { 1154 if (macio_resource_count(mdev) == 0) {
1155 printk(KERN_WARNING "ide-pmac: no address for %s\n", 1155 printk(KERN_WARNING "ide-pmac: no address for %s\n",
1156 mdev->ofdev.node->full_name); 1156 mdev->ofdev.dev.of_node->full_name);
1157 rc = -ENXIO; 1157 rc = -ENXIO;
1158 goto out_free_pmif; 1158 goto out_free_pmif;
1159 } 1159 }
@@ -1161,7 +1161,7 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match)
1161 /* Request memory resource for IO ports */ 1161 /* Request memory resource for IO ports */
1162 if (macio_request_resource(mdev, 0, "ide-pmac (ports)")) { 1162 if (macio_request_resource(mdev, 0, "ide-pmac (ports)")) {
1163 printk(KERN_ERR "ide-pmac: can't request MMIO resource for " 1163 printk(KERN_ERR "ide-pmac: can't request MMIO resource for "
1164 "%s!\n", mdev->ofdev.node->full_name); 1164 "%s!\n", mdev->ofdev.dev.of_node->full_name);
1165 rc = -EBUSY; 1165 rc = -EBUSY;
1166 goto out_free_pmif; 1166 goto out_free_pmif;
1167 } 1167 }
@@ -1173,7 +1173,7 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match)
1173 */ 1173 */
1174 if (macio_irq_count(mdev) == 0) { 1174 if (macio_irq_count(mdev) == 0) {
1175 printk(KERN_WARNING "ide-pmac: no intrs for device %s, using " 1175 printk(KERN_WARNING "ide-pmac: no intrs for device %s, using "
1176 "13\n", mdev->ofdev.node->full_name); 1176 "13\n", mdev->ofdev.dev.of_node->full_name);
1177 irq = irq_create_mapping(NULL, 13); 1177 irq = irq_create_mapping(NULL, 13);
1178 } else 1178 } else
1179 irq = macio_irq(mdev, 0); 1179 irq = macio_irq(mdev, 0);
@@ -1182,7 +1182,7 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match)
1182 regbase = (unsigned long) base; 1182 regbase = (unsigned long) base;
1183 1183
1184 pmif->mdev = mdev; 1184 pmif->mdev = mdev;
1185 pmif->node = mdev->ofdev.node; 1185 pmif->node = mdev->ofdev.dev.of_node;
1186 pmif->regbase = regbase; 1186 pmif->regbase = regbase;
1187 pmif->irq = irq; 1187 pmif->irq = irq;
1188 pmif->kauai_fcr = NULL; 1188 pmif->kauai_fcr = NULL;
@@ -1191,7 +1191,7 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match)
1191 if (macio_request_resource(mdev, 1, "ide-pmac (dma)")) 1191 if (macio_request_resource(mdev, 1, "ide-pmac (dma)"))
1192 printk(KERN_WARNING "ide-pmac: can't request DMA " 1192 printk(KERN_WARNING "ide-pmac: can't request DMA "
1193 "resource for %s!\n", 1193 "resource for %s!\n",
1194 mdev->ofdev.node->full_name); 1194 mdev->ofdev.dev.of_node->full_name);
1195 else 1195 else
1196 pmif->dma_regs = ioremap(macio_resource_start(mdev, 1), 0x1000); 1196 pmif->dma_regs = ioremap(macio_resource_start(mdev, 1), 0x1000);
1197 } else 1197 } else
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
index 129a6bebd6e3..252489e88369 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -291,8 +291,9 @@ static int ehca_sense_attributes(struct ehca_shca *shca)
291 }; 291 };
292 292
293 ehca_gen_dbg("Probing adapter %s...", 293 ehca_gen_dbg("Probing adapter %s...",
294 shca->ofdev->node->full_name); 294 shca->ofdev->dev.of_node->full_name);
295 loc_code = of_get_property(shca->ofdev->node, "ibm,loc-code", NULL); 295 loc_code = of_get_property(shca->ofdev->dev.of_node, "ibm,loc-code",
296 NULL);
296 if (loc_code) 297 if (loc_code)
297 ehca_gen_dbg(" ... location lode=%s", loc_code); 298 ehca_gen_dbg(" ... location lode=%s", loc_code);
298 299
@@ -720,16 +721,16 @@ static int __devinit ehca_probe(struct of_device *dev,
720 int ret, i, eq_size; 721 int ret, i, eq_size;
721 unsigned long flags; 722 unsigned long flags;
722 723
723 handle = of_get_property(dev->node, "ibm,hca-handle", NULL); 724 handle = of_get_property(dev->dev.of_node, "ibm,hca-handle", NULL);
724 if (!handle) { 725 if (!handle) {
725 ehca_gen_err("Cannot get eHCA handle for adapter: %s.", 726 ehca_gen_err("Cannot get eHCA handle for adapter: %s.",
726 dev->node->full_name); 727 dev->dev.of_node->full_name);
727 return -ENODEV; 728 return -ENODEV;
728 } 729 }
729 730
730 if (!(*handle)) { 731 if (!(*handle)) {
731 ehca_gen_err("Wrong eHCA handle for adapter: %s.", 732 ehca_gen_err("Wrong eHCA handle for adapter: %s.",
732 dev->node->full_name); 733 dev->dev.of_node->full_name);
733 return -ENODEV; 734 return -ENODEV;
734 } 735 }
735 736
@@ -936,12 +937,13 @@ static struct of_device_id ehca_device_table[] =
936MODULE_DEVICE_TABLE(of, ehca_device_table); 937MODULE_DEVICE_TABLE(of, ehca_device_table);
937 938
938static struct of_platform_driver ehca_driver = { 939static struct of_platform_driver ehca_driver = {
939 .name = "ehca",
940 .match_table = ehca_device_table,
941 .probe = ehca_probe, 940 .probe = ehca_probe,
942 .remove = ehca_remove, 941 .remove = ehca_remove,
943 .driver = { 942 .driver = {
943 .name = "ehca",
944 .owner = THIS_MODULE,
944 .groups = ehca_drv_attr_groups, 945 .groups = ehca_drv_attr_groups,
946 .of_match_table = ehca_device_table,
945 }, 947 },
946}; 948};
947 949
diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c
index 0d45422f8095..1dacae4b43f0 100644
--- a/drivers/input/misc/sparcspkr.c
+++ b/drivers/input/misc/sparcspkr.c
@@ -259,8 +259,11 @@ static const struct of_device_id bbc_beep_match[] = {
259}; 259};
260 260
261static struct of_platform_driver bbc_beep_driver = { 261static struct of_platform_driver bbc_beep_driver = {
262 .name = "bbcbeep", 262 .driver = {
263 .match_table = bbc_beep_match, 263 .name = "bbcbeep",
264 .owner = THIS_MODULE,
265 .of_match_table = bbc_beep_match,
266 },
264 .probe = bbc_beep_probe, 267 .probe = bbc_beep_probe,
265 .remove = __devexit_p(bbc_remove), 268 .remove = __devexit_p(bbc_remove),
266 .shutdown = sparcspkr_shutdown, 269 .shutdown = sparcspkr_shutdown,
@@ -338,8 +341,11 @@ static const struct of_device_id grover_beep_match[] = {
338}; 341};
339 342
340static struct of_platform_driver grover_beep_driver = { 343static struct of_platform_driver grover_beep_driver = {
341 .name = "groverbeep", 344 .driver = {
342 .match_table = grover_beep_match, 345 .name = "groverbeep",
346 .owner = THIS_MODULE,
347 .of_match_table = grover_beep_match,
348 },
343 .probe = grover_beep_probe, 349 .probe = grover_beep_probe,
344 .remove = __devexit_p(grover_remove), 350 .remove = __devexit_p(grover_remove),
345 .shutdown = sparcspkr_shutdown, 351 .shutdown = sparcspkr_shutdown,
diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h
index 5071af2c0604..04e32f2d1241 100644
--- a/drivers/input/serio/i8042-sparcio.h
+++ b/drivers/input/serio/i8042-sparcio.h
@@ -51,7 +51,7 @@ static inline void i8042_write_command(int val)
51 51
52static int __devinit sparc_i8042_probe(struct of_device *op, const struct of_device_id *match) 52static int __devinit sparc_i8042_probe(struct of_device *op, const struct of_device_id *match)
53{ 53{
54 struct device_node *dp = op->node; 54 struct device_node *dp = op->dev.of_node;
55 55
56 dp = dp->child; 56 dp = dp->child;
57 while (dp) { 57 while (dp) {
@@ -96,8 +96,11 @@ static const struct of_device_id sparc_i8042_match[] = {
96MODULE_DEVICE_TABLE(of, sparc_i8042_match); 96MODULE_DEVICE_TABLE(of, sparc_i8042_match);
97 97
98static struct of_platform_driver sparc_i8042_driver = { 98static struct of_platform_driver sparc_i8042_driver = {
99 .name = "i8042", 99 .driver = {
100 .match_table = sparc_i8042_match, 100 .name = "i8042",
101 .owner = THIS_MODULE,
102 .of_match_table = sparc_i8042_match,
103 },
101 .probe = sparc_i8042_probe, 104 .probe = sparc_i8042_probe,
102 .remove = __devexit_p(sparc_i8042_remove), 105 .remove = __devexit_p(sparc_i8042_remove),
103}; 106};
diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c
index f84f8e32e3f1..e2c028d2638f 100644
--- a/drivers/input/serio/xilinx_ps2.c
+++ b/drivers/input/serio/xilinx_ps2.c
@@ -244,17 +244,17 @@ static int __devinit xps2_of_probe(struct of_device *ofdev,
244 int error; 244 int error;
245 245
246 dev_info(dev, "Device Tree Probing \'%s\'\n", 246 dev_info(dev, "Device Tree Probing \'%s\'\n",
247 ofdev->node->name); 247 ofdev->dev.of_node->name);
248 248
249 /* Get iospace for the device */ 249 /* Get iospace for the device */
250 error = of_address_to_resource(ofdev->node, 0, &r_mem); 250 error = of_address_to_resource(ofdev->dev.of_node, 0, &r_mem);
251 if (error) { 251 if (error) {
252 dev_err(dev, "invalid address\n"); 252 dev_err(dev, "invalid address\n");
253 return error; 253 return error;
254 } 254 }
255 255
256 /* Get IRQ for the device */ 256 /* Get IRQ for the device */
257 if (of_irq_to_resource(ofdev->node, 0, &r_irq) == NO_IRQ) { 257 if (of_irq_to_resource(ofdev->dev.of_node, 0, &r_irq) == NO_IRQ) {
258 dev_err(dev, "no IRQ found\n"); 258 dev_err(dev, "no IRQ found\n");
259 return -ENODEV; 259 return -ENODEV;
260 } 260 }
@@ -342,7 +342,7 @@ static int __devexit xps2_of_remove(struct of_device *of_dev)
342 iounmap(drvdata->base_address); 342 iounmap(drvdata->base_address);
343 343
344 /* Get iospace of the device */ 344 /* Get iospace of the device */
345 if (of_address_to_resource(of_dev->node, 0, &r_mem)) 345 if (of_address_to_resource(of_dev->dev.of_node, 0, &r_mem))
346 dev_err(dev, "invalid address\n"); 346 dev_err(dev, "invalid address\n");
347 else 347 else
348 release_mem_region(r_mem.start, resource_size(&r_mem)); 348 release_mem_region(r_mem.start, resource_size(&r_mem));
@@ -362,8 +362,11 @@ static const struct of_device_id xps2_of_match[] __devinitconst = {
362MODULE_DEVICE_TABLE(of, xps2_of_match); 362MODULE_DEVICE_TABLE(of, xps2_of_match);
363 363
364static struct of_platform_driver xps2_of_driver = { 364static struct of_platform_driver xps2_of_driver = {
365 .name = DRIVER_NAME, 365 .driver = {
366 .match_table = xps2_of_match, 366 .name = DRIVER_NAME,
367 .owner = THIS_MODULE,
368 .of_match_table = xps2_of_match,
369 },
367 .probe = xps2_of_probe, 370 .probe = xps2_of_probe,
368 .remove = __devexit_p(xps2_of_remove), 371 .remove = __devexit_p(xps2_of_remove),
369}; 372};
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index c6e4b772b757..6d94b0b9979c 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -211,7 +211,7 @@ struct gpio_led_of_platform_data {
211static int __devinit of_gpio_leds_probe(struct of_device *ofdev, 211static int __devinit of_gpio_leds_probe(struct of_device *ofdev,
212 const struct of_device_id *match) 212 const struct of_device_id *match)
213{ 213{
214 struct device_node *np = ofdev->node, *child; 214 struct device_node *np = ofdev->dev.of_node, *child;
215 struct gpio_led_of_platform_data *pdata; 215 struct gpio_led_of_platform_data *pdata;
216 int count = 0, ret; 216 int count = 0, ret;
217 217
@@ -291,8 +291,8 @@ static struct of_platform_driver of_gpio_leds_driver = {
291 .driver = { 291 .driver = {
292 .name = "of_gpio_leds", 292 .name = "of_gpio_leds",
293 .owner = THIS_MODULE, 293 .owner = THIS_MODULE,
294 .of_match_table = of_gpio_leds_match,
294 }, 295 },
295 .match_table = of_gpio_leds_match,
296 .probe = of_gpio_leds_probe, 296 .probe = of_gpio_leds_probe,
297 .remove = __devexit_p(of_gpio_leds_remove), 297 .remove = __devexit_p(of_gpio_leds_remove),
298}; 298};
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index 26a303a1d1ab..97147804a49c 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -39,14 +39,12 @@ static struct macio_chip *macio_on_hold;
39 39
40static int macio_bus_match(struct device *dev, struct device_driver *drv) 40static int macio_bus_match(struct device *dev, struct device_driver *drv)
41{ 41{
42 struct macio_dev * macio_dev = to_macio_device(dev); 42 const struct of_device_id * matches = drv->of_match_table;
43 struct macio_driver * macio_drv = to_macio_driver(drv);
44 const struct of_device_id * matches = macio_drv->match_table;
45 43
46 if (!matches) 44 if (!matches)
47 return 0; 45 return 0;
48 46
49 return of_match_device(matches, &macio_dev->ofdev) != NULL; 47 return of_match_device(matches, dev) != NULL;
50} 48}
51 49
52struct macio_dev *macio_dev_get(struct macio_dev *dev) 50struct macio_dev *macio_dev_get(struct macio_dev *dev)
@@ -84,7 +82,7 @@ static int macio_device_probe(struct device *dev)
84 82
85 macio_dev_get(macio_dev); 83 macio_dev_get(macio_dev);
86 84
87 match = of_match_device(drv->match_table, &macio_dev->ofdev); 85 match = of_match_device(drv->driver.of_match_table, dev);
88 if (match) 86 if (match)
89 error = drv->probe(macio_dev, match); 87 error = drv->probe(macio_dev, match);
90 if (error) 88 if (error)
@@ -248,7 +246,7 @@ static void macio_create_fixup_irq(struct macio_dev *dev, int index,
248 246
249static void macio_add_missing_resources(struct macio_dev *dev) 247static void macio_add_missing_resources(struct macio_dev *dev)
250{ 248{
251 struct device_node *np = dev->ofdev.node; 249 struct device_node *np = dev->ofdev.dev.of_node;
252 unsigned int irq_base; 250 unsigned int irq_base;
253 251
254 /* Gatwick has some missing interrupts on child nodes */ 252 /* Gatwick has some missing interrupts on child nodes */
@@ -289,7 +287,7 @@ static void macio_add_missing_resources(struct macio_dev *dev)
289 287
290static void macio_setup_interrupts(struct macio_dev *dev) 288static void macio_setup_interrupts(struct macio_dev *dev)
291{ 289{
292 struct device_node *np = dev->ofdev.node; 290 struct device_node *np = dev->ofdev.dev.of_node;
293 unsigned int irq; 291 unsigned int irq;
294 int i = 0, j = 0; 292 int i = 0, j = 0;
295 293
@@ -317,7 +315,7 @@ static void macio_setup_interrupts(struct macio_dev *dev)
317static void macio_setup_resources(struct macio_dev *dev, 315static void macio_setup_resources(struct macio_dev *dev,
318 struct resource *parent_res) 316 struct resource *parent_res)
319{ 317{
320 struct device_node *np = dev->ofdev.node; 318 struct device_node *np = dev->ofdev.dev.of_node;
321 struct resource r; 319 struct resource r;
322 int index; 320 int index;
323 321
@@ -373,9 +371,9 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
373 371
374 dev->bus = &chip->lbus; 372 dev->bus = &chip->lbus;
375 dev->media_bay = in_bay; 373 dev->media_bay = in_bay;
376 dev->ofdev.node = np; 374 dev->ofdev.dev.of_node = np;
377 dev->ofdev.dma_mask = 0xffffffffUL; 375 dev->ofdev.archdata.dma_mask = 0xffffffffUL;
378 dev->ofdev.dev.dma_mask = &dev->ofdev.dma_mask; 376 dev->ofdev.dev.dma_mask = &dev->ofdev.archdata.dma_mask;
379 dev->ofdev.dev.parent = parent; 377 dev->ofdev.dev.parent = parent;
380 dev->ofdev.dev.bus = &macio_bus_type; 378 dev->ofdev.dev.bus = &macio_bus_type;
381 dev->ofdev.dev.release = macio_release_dev; 379 dev->ofdev.dev.release = macio_release_dev;
@@ -494,9 +492,9 @@ static void macio_pci_add_devices(struct macio_chip *chip)
494 } 492 }
495 493
496 /* Add media bay devices if any */ 494 /* Add media bay devices if any */
495 pnode = mbdev->ofdev.dev.of_node;
497 if (mbdev) 496 if (mbdev)
498 for (np = NULL; (np = of_get_next_child(mbdev->ofdev.node, np)) 497 for (np = NULL; (np = of_get_next_child(pnode, np)) != NULL;) {
499 != NULL;) {
500 if (macio_skip_device(np)) 498 if (macio_skip_device(np))
501 continue; 499 continue;
502 of_node_get(np); 500 of_node_get(np);
@@ -506,9 +504,9 @@ static void macio_pci_add_devices(struct macio_chip *chip)
506 } 504 }
507 505
508 /* Add serial ports if any */ 506 /* Add serial ports if any */
507 pnode = sdev->ofdev.dev.of_node;
509 if (sdev) { 508 if (sdev) {
510 for (np = NULL; (np = of_get_next_child(sdev->ofdev.node, np)) 509 for (np = NULL; (np = of_get_next_child(pnode, np)) != NULL;) {
511 != NULL;) {
512 if (macio_skip_device(np)) 510 if (macio_skip_device(np))
513 continue; 511 continue;
514 of_node_get(np); 512 of_node_get(np);
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c
index 9e9453b58425..6999ce59fd10 100644
--- a/drivers/macintosh/macio_sysfs.c
+++ b/drivers/macintosh/macio_sysfs.c
@@ -9,7 +9,7 @@ field##_show (struct device *dev, struct device_attribute *attr, \
9 char *buf) \ 9 char *buf) \
10{ \ 10{ \
11 struct macio_dev *mdev = to_macio_device (dev); \ 11 struct macio_dev *mdev = to_macio_device (dev); \
12 return sprintf (buf, format_string, mdev->ofdev.node->field); \ 12 return sprintf (buf, format_string, mdev->ofdev.dev.of_node->field); \
13} 13}
14 14
15static ssize_t 15static ssize_t
@@ -21,7 +21,7 @@ compatible_show (struct device *dev, struct device_attribute *attr, char *buf)
21 int length = 0; 21 int length = 0;
22 22
23 of = &to_macio_device (dev)->ofdev; 23 of = &to_macio_device (dev)->ofdev;
24 compat = of_get_property(of->node, "compatible", &cplen); 24 compat = of_get_property(of->dev.of_node, "compatible", &cplen);
25 if (!compat) { 25 if (!compat) {
26 *buf = '\0'; 26 *buf = '\0';
27 return 0; 27 return 0;
@@ -58,7 +58,7 @@ static ssize_t devspec_show(struct device *dev,
58 struct of_device *ofdev; 58 struct of_device *ofdev;
59 59
60 ofdev = to_of_device(dev); 60 ofdev = to_of_device(dev);
61 return sprintf(buf, "%s\n", ofdev->node->full_name); 61 return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name);
62} 62}
63 63
64macio_config_of_attr (name, "%s\n"); 64macio_config_of_attr (name, "%s\n");
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
index 08002b88f342..288acce76b74 100644
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -564,7 +564,7 @@ static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_de
564 unsigned long base; 564 unsigned long base;
565 int i; 565 int i;
566 566
567 ofnode = mdev->ofdev.node; 567 ofnode = mdev->ofdev.dev.of_node;
568 568
569 if (macio_resource_count(mdev) < 1) 569 if (macio_resource_count(mdev) < 1)
570 return -ENODEV; 570 return -ENODEV;
diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c
index 7c54d80c4fb2..12946c5f583f 100644
--- a/drivers/macintosh/rack-meter.c
+++ b/drivers/macintosh/rack-meter.c
@@ -375,7 +375,7 @@ static int __devinit rackmeter_probe(struct macio_dev* mdev,
375 pr_debug("rackmeter_probe()\n"); 375 pr_debug("rackmeter_probe()\n");
376 376
377 /* Get i2s-a node */ 377 /* Get i2s-a node */
378 while ((i2s = of_get_next_child(mdev->ofdev.node, i2s)) != NULL) 378 while ((i2s = of_get_next_child(mdev->ofdev.dev.of_node, i2s)) != NULL)
379 if (strcmp(i2s->name, "i2s-a") == 0) 379 if (strcmp(i2s->name, "i2s-a") == 0)
380 break; 380 break;
381 if (i2s == NULL) { 381 if (i2s == NULL) {
@@ -431,7 +431,7 @@ static int __devinit rackmeter_probe(struct macio_dev* mdev,
431 of_address_to_resource(i2s, 1, &rdma)) { 431 of_address_to_resource(i2s, 1, &rdma)) {
432 printk(KERN_ERR 432 printk(KERN_ERR
433 "rackmeter: found match but lacks resources: %s", 433 "rackmeter: found match but lacks resources: %s",
434 mdev->ofdev.node->full_name); 434 mdev->ofdev.dev.of_node->full_name);
435 rc = -ENXIO; 435 rc = -ENXIO;
436 goto bail_free; 436 goto bail_free;
437 } 437 }
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index c9da5c4c167d..2506c957712e 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -671,8 +671,11 @@ static const struct of_device_id smu_platform_match[] =
671 671
672static struct of_platform_driver smu_of_platform_driver = 672static struct of_platform_driver smu_of_platform_driver =
673{ 673{
674 .name = "smu", 674 .driver = {
675 .match_table = smu_platform_match, 675 .name = "smu",
676 .owner = THIS_MODULE,
677 .of_match_table = smu_platform_match,
678 },
676 .probe = smu_platform_probe, 679 .probe = smu_platform_probe,
677}; 680};
678 681
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
index b18fa948f3d1..e60605bd0ea9 100644
--- a/drivers/macintosh/therm_pm72.c
+++ b/drivers/macintosh/therm_pm72.c
@@ -2215,7 +2215,7 @@ static int fcu_of_probe(struct of_device* dev, const struct of_device_id *match)
2215 state = state_detached; 2215 state = state_detached;
2216 2216
2217 /* Lookup the fans in the device tree */ 2217 /* Lookup the fans in the device tree */
2218 fcu_lookup_fans(dev->node); 2218 fcu_lookup_fans(dev->dev.of_node);
2219 2219
2220 /* Add the driver */ 2220 /* Add the driver */
2221 return i2c_add_driver(&therm_pm72_driver); 2221 return i2c_add_driver(&therm_pm72_driver);
@@ -2238,8 +2238,11 @@ static const struct of_device_id fcu_match[] =
2238 2238
2239static struct of_platform_driver fcu_of_platform_driver = 2239static struct of_platform_driver fcu_of_platform_driver =
2240{ 2240{
2241 .name = "temperature", 2241 .driver = {
2242 .match_table = fcu_match, 2242 .name = "temperature",
2243 .owner = THIS_MODULE,
2244 .of_match_table = fcu_match,
2245 },
2243 .probe = fcu_of_probe, 2246 .probe = fcu_of_probe,
2244 .remove = fcu_of_remove 2247 .remove = fcu_of_remove
2245}; 2248};
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
index 0839770e4ec5..5c9367acf0cf 100644
--- a/drivers/macintosh/therm_windtunnel.c
+++ b/drivers/macintosh/therm_windtunnel.c
@@ -463,8 +463,11 @@ static const struct of_device_id therm_of_match[] = {{
463}; 463};
464 464
465static struct of_platform_driver therm_of_driver = { 465static struct of_platform_driver therm_of_driver = {
466 .name = "temperature", 466 .driver = {
467 .match_table = therm_of_match, 467 .name = "temperature",
468 .owner = THIS_MODULE,
469 .of_match_table = therm_of_match,
470 },
468 .probe = therm_of_probe, 471 .probe = therm_of_probe,
469 .remove = therm_of_remove, 472 .remove = therm_of_remove,
470}; 473};
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 7bd4c0fc23cc..5c53624e0e87 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -2570,9 +2570,7 @@ mptscsih_getclear_scsi_lookup(MPT_ADAPTER *ioc, int i)
2570} 2570}
2571 2571
2572/** 2572/**
2573 * mptscsih_set_scsi_lookup 2573 * mptscsih_set_scsi_lookup - write a scmd entry into the ScsiLookup[] array list
2574 *
2575 * writes a scmd entry into the ScsiLookup[] array list
2576 * 2574 *
2577 * @ioc: Pointer to MPT_ADAPTER structure 2575 * @ioc: Pointer to MPT_ADAPTER structure
2578 * @i: index into the array 2576 * @i: index into the array
@@ -2735,7 +2733,7 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req,
2735 2733
2736 2734
2737/** 2735/**
2738 * mptscsih_get_completion_code - 2736 * mptscsih_get_completion_code - get completion code from MPT request
2739 * @ioc: Pointer to MPT_ADAPTER structure 2737 * @ioc: Pointer to MPT_ADAPTER structure
2740 * @req: Pointer to original MPT request frame 2738 * @req: Pointer to original MPT request frame
2741 * @reply: Pointer to MPT reply frame (NULL if TurboReply) 2739 * @reply: Pointer to MPT reply frame (NULL if TurboReply)
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index de3e74cde51c..3c6a9860dd9c 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -49,6 +49,7 @@ config MFD_SH_MOBILE_SDHI
49 bool "Support for SuperH Mobile SDHI" 49 bool "Support for SuperH Mobile SDHI"
50 depends on SUPERH || ARCH_SHMOBILE 50 depends on SUPERH || ARCH_SHMOBILE
51 select MFD_CORE 51 select MFD_CORE
52 select TMIO_MMC_DMA
52 ---help--- 53 ---help---
53 This driver supports the SDHI hardware block found in many 54 This driver supports the SDHI hardware block found in many
54 SuperH Mobile SoCs. 55 SuperH Mobile SoCs.
@@ -162,6 +163,11 @@ config MFD_TMIO
162 bool 163 bool
163 default n 164 default n
164 165
166config TMIO_MMC_DMA
167 bool
168 select DMA_ENGINE
169 select DMADEVICES
170
165config MFD_T7L66XB 171config MFD_T7L66XB
166 bool "Support Toshiba T7L66XB" 172 bool "Support Toshiba T7L66XB"
167 depends on ARM && HAVE_CLK 173 depends on ARM && HAVE_CLK
diff --git a/drivers/mfd/sh_mobile_sdhi.c b/drivers/mfd/sh_mobile_sdhi.c
index 497f91b6138e..cd164595f08a 100644
--- a/drivers/mfd/sh_mobile_sdhi.c
+++ b/drivers/mfd/sh_mobile_sdhi.c
@@ -26,11 +26,15 @@
26#include <linux/mfd/core.h> 26#include <linux/mfd/core.h>
27#include <linux/mfd/tmio.h> 27#include <linux/mfd/tmio.h>
28#include <linux/mfd/sh_mobile_sdhi.h> 28#include <linux/mfd/sh_mobile_sdhi.h>
29#include <linux/sh_dma.h>
29 30
30struct sh_mobile_sdhi { 31struct sh_mobile_sdhi {
31 struct clk *clk; 32 struct clk *clk;
32 struct tmio_mmc_data mmc_data; 33 struct tmio_mmc_data mmc_data;
33 struct mfd_cell cell_mmc; 34 struct mfd_cell cell_mmc;
35 struct sh_dmae_slave param_tx;
36 struct sh_dmae_slave param_rx;
37 struct tmio_mmc_dma dma_priv;
34}; 38};
35 39
36static struct resource sh_mobile_sdhi_resources[] = { 40static struct resource sh_mobile_sdhi_resources[] = {
@@ -64,6 +68,8 @@ static void sh_mobile_sdhi_set_pwr(struct platform_device *tmio, int state)
64static int __init sh_mobile_sdhi_probe(struct platform_device *pdev) 68static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
65{ 69{
66 struct sh_mobile_sdhi *priv; 70 struct sh_mobile_sdhi *priv;
71 struct tmio_mmc_data *mmc_data;
72 struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
67 struct resource *mem; 73 struct resource *mem;
68 char clk_name[8]; 74 char clk_name[8];
69 int ret, irq; 75 int ret, irq;
@@ -85,6 +91,8 @@ static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
85 return -ENOMEM; 91 return -ENOMEM;
86 } 92 }
87 93
94 mmc_data = &priv->mmc_data;
95
88 snprintf(clk_name, sizeof(clk_name), "sdhi%d", pdev->id); 96 snprintf(clk_name, sizeof(clk_name), "sdhi%d", pdev->id);
89 priv->clk = clk_get(&pdev->dev, clk_name); 97 priv->clk = clk_get(&pdev->dev, clk_name);
90 if (IS_ERR(priv->clk)) { 98 if (IS_ERR(priv->clk)) {
@@ -96,12 +104,24 @@ static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
96 104
97 clk_enable(priv->clk); 105 clk_enable(priv->clk);
98 106
99 priv->mmc_data.hclk = clk_get_rate(priv->clk); 107 mmc_data->hclk = clk_get_rate(priv->clk);
100 priv->mmc_data.set_pwr = sh_mobile_sdhi_set_pwr; 108 mmc_data->set_pwr = sh_mobile_sdhi_set_pwr;
101 priv->mmc_data.capabilities = MMC_CAP_MMC_HIGHSPEED; 109 mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
110 if (p) {
111 mmc_data->flags = p->tmio_flags;
112 mmc_data->ocr_mask = p->tmio_ocr_mask;
113 }
114
115 if (p && p->dma_slave_tx >= 0 && p->dma_slave_rx >= 0) {
116 priv->param_tx.slave_id = p->dma_slave_tx;
117 priv->param_rx.slave_id = p->dma_slave_rx;
118 priv->dma_priv.chan_priv_tx = &priv->param_tx;
119 priv->dma_priv.chan_priv_rx = &priv->param_rx;
120 mmc_data->dma = &priv->dma_priv;
121 }
102 122
103 memcpy(&priv->cell_mmc, &sh_mobile_sdhi_cell, sizeof(priv->cell_mmc)); 123 memcpy(&priv->cell_mmc, &sh_mobile_sdhi_cell, sizeof(priv->cell_mmc));
104 priv->cell_mmc.driver_data = &priv->mmc_data; 124 priv->cell_mmc.driver_data = mmc_data;
105 priv->cell_mmc.platform_data = &priv->cell_mmc; 125 priv->cell_mmc.platform_data = &priv->cell_mmc;
106 priv->cell_mmc.data_size = sizeof(priv->cell_mmc); 126 priv->cell_mmc.data_size = sizeof(priv->cell_mmc);
107 127
diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c
index bb6cc54b558e..1247e5de9faa 100644
--- a/drivers/mmc/host/of_mmc_spi.c
+++ b/drivers/mmc/host/of_mmc_spi.c
@@ -64,7 +64,7 @@ static int of_mmc_spi_get_ro(struct device *dev)
64struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi) 64struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi)
65{ 65{
66 struct device *dev = &spi->dev; 66 struct device *dev = &spi->dev;
67 struct device_node *np = dev_archdata_get_node(&dev->archdata); 67 struct device_node *np = dev->of_node;
68 struct of_mmc_spi *oms; 68 struct of_mmc_spi *oms;
69 const u32 *voltage_ranges; 69 const u32 *voltage_ranges;
70 int num_ranges; 70 int num_ranges;
@@ -135,7 +135,7 @@ EXPORT_SYMBOL(mmc_spi_get_pdata);
135void mmc_spi_put_pdata(struct spi_device *spi) 135void mmc_spi_put_pdata(struct spi_device *spi)
136{ 136{
137 struct device *dev = &spi->dev; 137 struct device *dev = &spi->dev;
138 struct device_node *np = dev_archdata_get_node(&dev->archdata); 138 struct device_node *np = dev->of_node;
139 struct of_mmc_spi *oms = to_of_mmc_spi(dev); 139 struct of_mmc_spi *oms = to_of_mmc_spi(dev);
140 int i; 140 int i;
141 141
diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c
index 55e33135edb4..7802a543d8fc 100644
--- a/drivers/mmc/host/sdhci-of-core.c
+++ b/drivers/mmc/host/sdhci-of-core.c
@@ -118,7 +118,7 @@ static bool __devinit sdhci_of_wp_inverted(struct device_node *np)
118static int __devinit sdhci_of_probe(struct of_device *ofdev, 118static int __devinit sdhci_of_probe(struct of_device *ofdev,
119 const struct of_device_id *match) 119 const struct of_device_id *match)
120{ 120{
121 struct device_node *np = ofdev->node; 121 struct device_node *np = ofdev->dev.of_node;
122 struct sdhci_of_data *sdhci_of_data = match->data; 122 struct sdhci_of_data *sdhci_of_data = match->data;
123 struct sdhci_host *host; 123 struct sdhci_host *host;
124 struct sdhci_of_host *of_host; 124 struct sdhci_of_host *of_host;
@@ -205,8 +205,11 @@ static const struct of_device_id sdhci_of_match[] = {
205MODULE_DEVICE_TABLE(of, sdhci_of_match); 205MODULE_DEVICE_TABLE(of, sdhci_of_match);
206 206
207static struct of_platform_driver sdhci_of_driver = { 207static struct of_platform_driver sdhci_of_driver = {
208 .driver.name = "sdhci-of", 208 .driver = {
209 .match_table = sdhci_of_match, 209 .name = "sdhci-of",
210 .owner = THIS_MODULE,
211 .of_match_table = sdhci_of_match,
212 },
210 .probe = sdhci_of_probe, 213 .probe = sdhci_of_probe,
211 .remove = __devexit_p(sdhci_of_remove), 214 .remove = __devexit_p(sdhci_of_remove),
212 .suspend = sdhci_of_suspend, 215 .suspend = sdhci_of_suspend,
diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index b2b577f6afd4..883fcac21004 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -29,6 +29,7 @@
29#include <linux/irq.h> 29#include <linux/irq.h>
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/dmaengine.h>
32#include <linux/mmc/host.h> 33#include <linux/mmc/host.h>
33#include <linux/mfd/core.h> 34#include <linux/mfd/core.h>
34#include <linux/mfd/tmio.h> 35#include <linux/mfd/tmio.h>
@@ -131,8 +132,8 @@ tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command *cmd)
131 132
132 host->cmd = cmd; 133 host->cmd = cmd;
133 134
134/* FIXME - this seems to be ok comented out but the spec suggest this bit should 135/* FIXME - this seems to be ok commented out but the spec suggest this bit
135 * be set when issuing app commands. 136 * should be set when issuing app commands.
136 * if(cmd->flags & MMC_FLAG_ACMD) 137 * if(cmd->flags & MMC_FLAG_ACMD)
137 * c |= APP_CMD; 138 * c |= APP_CMD;
138 */ 139 */
@@ -155,12 +156,12 @@ tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command *cmd)
155 return 0; 156 return 0;
156} 157}
157 158
158/* This chip always returns (at least?) as much data as you ask for. 159/*
160 * This chip always returns (at least?) as much data as you ask for.
159 * I'm unsure what happens if you ask for less than a block. This should be 161 * I'm unsure what happens if you ask for less than a block. This should be
160 * looked into to ensure that a funny length read doesnt hose the controller. 162 * looked into to ensure that a funny length read doesnt hose the controller.
161 *
162 */ 163 */
163static inline void tmio_mmc_pio_irq(struct tmio_mmc_host *host) 164static void tmio_mmc_pio_irq(struct tmio_mmc_host *host)
164{ 165{
165 struct mmc_data *data = host->data; 166 struct mmc_data *data = host->data;
166 unsigned short *buf; 167 unsigned short *buf;
@@ -180,7 +181,7 @@ static inline void tmio_mmc_pio_irq(struct tmio_mmc_host *host)
180 count = data->blksz; 181 count = data->blksz;
181 182
182 pr_debug("count: %08x offset: %08x flags %08x\n", 183 pr_debug("count: %08x offset: %08x flags %08x\n",
183 count, host->sg_off, data->flags); 184 count, host->sg_off, data->flags);
184 185
185 /* Transfer the data */ 186 /* Transfer the data */
186 if (data->flags & MMC_DATA_READ) 187 if (data->flags & MMC_DATA_READ)
@@ -198,7 +199,7 @@ static inline void tmio_mmc_pio_irq(struct tmio_mmc_host *host)
198 return; 199 return;
199} 200}
200 201
201static inline void tmio_mmc_data_irq(struct tmio_mmc_host *host) 202static void tmio_mmc_do_data_irq(struct tmio_mmc_host *host)
202{ 203{
203 struct mmc_data *data = host->data; 204 struct mmc_data *data = host->data;
204 struct mmc_command *stop; 205 struct mmc_command *stop;
@@ -206,7 +207,7 @@ static inline void tmio_mmc_data_irq(struct tmio_mmc_host *host)
206 host->data = NULL; 207 host->data = NULL;
207 208
208 if (!data) { 209 if (!data) {
209 pr_debug("Spurious data end IRQ\n"); 210 dev_warn(&host->pdev->dev, "Spurious data end IRQ\n");
210 return; 211 return;
211 } 212 }
212 stop = data->stop; 213 stop = data->stop;
@@ -219,7 +220,8 @@ static inline void tmio_mmc_data_irq(struct tmio_mmc_host *host)
219 220
220 pr_debug("Completed data request\n"); 221 pr_debug("Completed data request\n");
221 222
222 /*FIXME - other drivers allow an optional stop command of any given type 223 /*
224 * FIXME: other drivers allow an optional stop command of any given type
223 * which we dont do, as the chip can auto generate them. 225 * which we dont do, as the chip can auto generate them.
224 * Perhaps we can be smarter about when to use auto CMD12 and 226 * Perhaps we can be smarter about when to use auto CMD12 and
225 * only issue the auto request when we know this is the desired 227 * only issue the auto request when we know this is the desired
@@ -227,10 +229,17 @@ static inline void tmio_mmc_data_irq(struct tmio_mmc_host *host)
227 * upper layers expect. For now, we do what works. 229 * upper layers expect. For now, we do what works.
228 */ 230 */
229 231
230 if (data->flags & MMC_DATA_READ) 232 if (data->flags & MMC_DATA_READ) {
231 disable_mmc_irqs(host, TMIO_MASK_READOP); 233 if (!host->chan_rx)
232 else 234 disable_mmc_irqs(host, TMIO_MASK_READOP);
233 disable_mmc_irqs(host, TMIO_MASK_WRITEOP); 235 dev_dbg(&host->pdev->dev, "Complete Rx request %p\n",
236 host->mrq);
237 } else {
238 if (!host->chan_tx)
239 disable_mmc_irqs(host, TMIO_MASK_WRITEOP);
240 dev_dbg(&host->pdev->dev, "Complete Tx request %p\n",
241 host->mrq);
242 }
234 243
235 if (stop) { 244 if (stop) {
236 if (stop->opcode == 12 && !stop->arg) 245 if (stop->opcode == 12 && !stop->arg)
@@ -242,7 +251,35 @@ static inline void tmio_mmc_data_irq(struct tmio_mmc_host *host)
242 tmio_mmc_finish_request(host); 251 tmio_mmc_finish_request(host);
243} 252}
244 253
245static inline void tmio_mmc_cmd_irq(struct tmio_mmc_host *host, 254static void tmio_mmc_data_irq(struct tmio_mmc_host *host)
255{
256 struct mmc_data *data = host->data;
257
258 if (!data)
259 return;
260
261 if (host->chan_tx && (data->flags & MMC_DATA_WRITE)) {
262 /*
263 * Has all data been written out yet? Testing on SuperH showed,
264 * that in most cases the first interrupt comes already with the
265 * BUSY status bit clear, but on some operations, like mount or
266 * in the beginning of a write / sync / umount, there is one
267 * DATAEND interrupt with the BUSY bit set, in this cases
268 * waiting for one more interrupt fixes the problem.
269 */
270 if (!(sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_CMD_BUSY)) {
271 disable_mmc_irqs(host, TMIO_STAT_DATAEND);
272 tasklet_schedule(&host->dma_complete);
273 }
274 } else if (host->chan_rx && (data->flags & MMC_DATA_READ)) {
275 disable_mmc_irqs(host, TMIO_STAT_DATAEND);
276 tasklet_schedule(&host->dma_complete);
277 } else {
278 tmio_mmc_do_data_irq(host);
279 }
280}
281
282static void tmio_mmc_cmd_irq(struct tmio_mmc_host *host,
246 unsigned int stat) 283 unsigned int stat)
247{ 284{
248 struct mmc_command *cmd = host->cmd; 285 struct mmc_command *cmd = host->cmd;
@@ -282,10 +319,16 @@ static inline void tmio_mmc_cmd_irq(struct tmio_mmc_host *host,
282 * If theres no data or we encountered an error, finish now. 319 * If theres no data or we encountered an error, finish now.
283 */ 320 */
284 if (host->data && !cmd->error) { 321 if (host->data && !cmd->error) {
285 if (host->data->flags & MMC_DATA_READ) 322 if (host->data->flags & MMC_DATA_READ) {
286 enable_mmc_irqs(host, TMIO_MASK_READOP); 323 if (!host->chan_rx)
287 else 324 enable_mmc_irqs(host, TMIO_MASK_READOP);
288 enable_mmc_irqs(host, TMIO_MASK_WRITEOP); 325 } else {
326 struct dma_chan *chan = host->chan_tx;
327 if (!chan)
328 enable_mmc_irqs(host, TMIO_MASK_WRITEOP);
329 else
330 tasklet_schedule(&host->dma_issue);
331 }
289 } else { 332 } else {
290 tmio_mmc_finish_request(host); 333 tmio_mmc_finish_request(host);
291 } 334 }
@@ -293,7 +336,6 @@ static inline void tmio_mmc_cmd_irq(struct tmio_mmc_host *host,
293 return; 336 return;
294} 337}
295 338
296
297static irqreturn_t tmio_mmc_irq(int irq, void *devid) 339static irqreturn_t tmio_mmc_irq(int irq, void *devid)
298{ 340{
299 struct tmio_mmc_host *host = devid; 341 struct tmio_mmc_host *host = devid;
@@ -311,7 +353,7 @@ static irqreturn_t tmio_mmc_irq(int irq, void *devid)
311 if (!ireg) { 353 if (!ireg) {
312 disable_mmc_irqs(host, status & ~irq_mask); 354 disable_mmc_irqs(host, status & ~irq_mask);
313 355
314 pr_debug("tmio_mmc: Spurious irq, disabling! " 356 pr_warning("tmio_mmc: Spurious irq, disabling! "
315 "0x%08x 0x%08x 0x%08x\n", status, irq_mask, ireg); 357 "0x%08x 0x%08x 0x%08x\n", status, irq_mask, ireg);
316 pr_debug_status(status); 358 pr_debug_status(status);
317 359
@@ -363,16 +405,265 @@ out:
363 return IRQ_HANDLED; 405 return IRQ_HANDLED;
364} 406}
365 407
408#ifdef CONFIG_TMIO_MMC_DMA
409static void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
410{
411#if defined(CONFIG_SUPERH) || defined(CONFIG_ARCH_SHMOBILE)
412 /* Switch DMA mode on or off - SuperH specific? */
413 sd_ctrl_write16(host, 0xd8, enable ? 2 : 0);
414#endif
415}
416
417static void tmio_dma_complete(void *arg)
418{
419 struct tmio_mmc_host *host = arg;
420
421 dev_dbg(&host->pdev->dev, "Command completed\n");
422
423 if (!host->data)
424 dev_warn(&host->pdev->dev, "NULL data in DMA completion!\n");
425 else
426 enable_mmc_irqs(host, TMIO_STAT_DATAEND);
427}
428
429static int tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)
430{
431 struct scatterlist *sg = host->sg_ptr;
432 struct dma_async_tx_descriptor *desc = NULL;
433 struct dma_chan *chan = host->chan_rx;
434 int ret;
435
436 ret = dma_map_sg(&host->pdev->dev, sg, host->sg_len, DMA_FROM_DEVICE);
437 if (ret > 0) {
438 host->dma_sglen = ret;
439 desc = chan->device->device_prep_slave_sg(chan, sg, ret,
440 DMA_FROM_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
441 }
442
443 if (desc) {
444 host->desc = desc;
445 desc->callback = tmio_dma_complete;
446 desc->callback_param = host;
447 host->cookie = desc->tx_submit(desc);
448 if (host->cookie < 0) {
449 host->desc = NULL;
450 ret = host->cookie;
451 } else {
452 chan->device->device_issue_pending(chan);
453 }
454 }
455 dev_dbg(&host->pdev->dev, "%s(): mapped %d -> %d, cookie %d, rq %p\n",
456 __func__, host->sg_len, ret, host->cookie, host->mrq);
457
458 if (!host->desc) {
459 /* DMA failed, fall back to PIO */
460 if (ret >= 0)
461 ret = -EIO;
462 host->chan_rx = NULL;
463 dma_release_channel(chan);
464 /* Free the Tx channel too */
465 chan = host->chan_tx;
466 if (chan) {
467 host->chan_tx = NULL;
468 dma_release_channel(chan);
469 }
470 dev_warn(&host->pdev->dev,
471 "DMA failed: %d, falling back to PIO\n", ret);
472 tmio_mmc_enable_dma(host, false);
473 reset(host);
474 /* Fail this request, let above layers recover */
475 host->mrq->cmd->error = ret;
476 tmio_mmc_finish_request(host);
477 }
478
479 dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d, sg[%d]\n", __func__,
480 desc, host->cookie, host->sg_len);
481
482 return ret > 0 ? 0 : ret;
483}
484
485static int tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)
486{
487 struct scatterlist *sg = host->sg_ptr;
488 struct dma_async_tx_descriptor *desc = NULL;
489 struct dma_chan *chan = host->chan_tx;
490 int ret;
491
492 ret = dma_map_sg(&host->pdev->dev, sg, host->sg_len, DMA_TO_DEVICE);
493 if (ret > 0) {
494 host->dma_sglen = ret;
495 desc = chan->device->device_prep_slave_sg(chan, sg, ret,
496 DMA_TO_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
497 }
498
499 if (desc) {
500 host->desc = desc;
501 desc->callback = tmio_dma_complete;
502 desc->callback_param = host;
503 host->cookie = desc->tx_submit(desc);
504 if (host->cookie < 0) {
505 host->desc = NULL;
506 ret = host->cookie;
507 }
508 }
509 dev_dbg(&host->pdev->dev, "%s(): mapped %d -> %d, cookie %d, rq %p\n",
510 __func__, host->sg_len, ret, host->cookie, host->mrq);
511
512 if (!host->desc) {
513 /* DMA failed, fall back to PIO */
514 if (ret >= 0)
515 ret = -EIO;
516 host->chan_tx = NULL;
517 dma_release_channel(chan);
518 /* Free the Rx channel too */
519 chan = host->chan_rx;
520 if (chan) {
521 host->chan_rx = NULL;
522 dma_release_channel(chan);
523 }
524 dev_warn(&host->pdev->dev,
525 "DMA failed: %d, falling back to PIO\n", ret);
526 tmio_mmc_enable_dma(host, false);
527 reset(host);
528 /* Fail this request, let above layers recover */
529 host->mrq->cmd->error = ret;
530 tmio_mmc_finish_request(host);
531 }
532
533 dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d\n", __func__,
534 desc, host->cookie);
535
536 return ret > 0 ? 0 : ret;
537}
538
539static int tmio_mmc_start_dma(struct tmio_mmc_host *host,
540 struct mmc_data *data)
541{
542 if (data->flags & MMC_DATA_READ) {
543 if (host->chan_rx)
544 return tmio_mmc_start_dma_rx(host);
545 } else {
546 if (host->chan_tx)
547 return tmio_mmc_start_dma_tx(host);
548 }
549
550 return 0;
551}
552
553static void tmio_issue_tasklet_fn(unsigned long priv)
554{
555 struct tmio_mmc_host *host = (struct tmio_mmc_host *)priv;
556 struct dma_chan *chan = host->chan_tx;
557
558 chan->device->device_issue_pending(chan);
559}
560
561static void tmio_tasklet_fn(unsigned long arg)
562{
563 struct tmio_mmc_host *host = (struct tmio_mmc_host *)arg;
564
565 if (host->data->flags & MMC_DATA_READ)
566 dma_unmap_sg(&host->pdev->dev, host->sg_ptr, host->dma_sglen,
567 DMA_FROM_DEVICE);
568 else
569 dma_unmap_sg(&host->pdev->dev, host->sg_ptr, host->dma_sglen,
570 DMA_TO_DEVICE);
571
572 tmio_mmc_do_data_irq(host);
573}
574
575/* It might be necessary to make filter MFD specific */
576static bool tmio_mmc_filter(struct dma_chan *chan, void *arg)
577{
578 dev_dbg(chan->device->dev, "%s: slave data %p\n", __func__, arg);
579 chan->private = arg;
580 return true;
581}
582
583static void tmio_mmc_request_dma(struct tmio_mmc_host *host,
584 struct tmio_mmc_data *pdata)
585{
586 host->cookie = -EINVAL;
587 host->desc = NULL;
588
589 /* We can only either use DMA for both Tx and Rx or not use it at all */
590 if (pdata->dma) {
591 dma_cap_mask_t mask;
592
593 dma_cap_zero(mask);
594 dma_cap_set(DMA_SLAVE, mask);
595
596 host->chan_tx = dma_request_channel(mask, tmio_mmc_filter,
597 pdata->dma->chan_priv_tx);
598 dev_dbg(&host->pdev->dev, "%s: TX: got channel %p\n", __func__,
599 host->chan_tx);
600
601 if (!host->chan_tx)
602 return;
603
604 host->chan_rx = dma_request_channel(mask, tmio_mmc_filter,
605 pdata->dma->chan_priv_rx);
606 dev_dbg(&host->pdev->dev, "%s: RX: got channel %p\n", __func__,
607 host->chan_rx);
608
609 if (!host->chan_rx) {
610 dma_release_channel(host->chan_tx);
611 host->chan_tx = NULL;
612 return;
613 }
614
615 tasklet_init(&host->dma_complete, tmio_tasklet_fn, (unsigned long)host);
616 tasklet_init(&host->dma_issue, tmio_issue_tasklet_fn, (unsigned long)host);
617
618 tmio_mmc_enable_dma(host, true);
619 }
620}
621
622static void tmio_mmc_release_dma(struct tmio_mmc_host *host)
623{
624 if (host->chan_tx) {
625 struct dma_chan *chan = host->chan_tx;
626 host->chan_tx = NULL;
627 dma_release_channel(chan);
628 }
629 if (host->chan_rx) {
630 struct dma_chan *chan = host->chan_rx;
631 host->chan_rx = NULL;
632 dma_release_channel(chan);
633 }
634
635 host->cookie = -EINVAL;
636 host->desc = NULL;
637}
638#else
639static int tmio_mmc_start_dma(struct tmio_mmc_host *host,
640 struct mmc_data *data)
641{
642 return 0;
643}
644
645static void tmio_mmc_request_dma(struct tmio_mmc_host *host,
646 struct tmio_mmc_data *pdata)
647{
648 host->chan_tx = NULL;
649 host->chan_rx = NULL;
650}
651
652static void tmio_mmc_release_dma(struct tmio_mmc_host *host)
653{
654}
655#endif
656
366static int tmio_mmc_start_data(struct tmio_mmc_host *host, 657static int tmio_mmc_start_data(struct tmio_mmc_host *host,
367 struct mmc_data *data) 658 struct mmc_data *data)
368{ 659{
369 pr_debug("setup data transfer: blocksize %08x nr_blocks %d\n", 660 pr_debug("setup data transfer: blocksize %08x nr_blocks %d\n",
370 data->blksz, data->blocks); 661 data->blksz, data->blocks);
371 662
372 /* Hardware cannot perform 1 and 2 byte requests in 4 bit mode */ 663 /* Hardware cannot perform 1 and 2 byte requests in 4 bit mode */
373 if (data->blksz < 4 && host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) { 664 if (data->blksz < 4 && host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) {
374 printk(KERN_ERR "%s: %d byte block unsupported in 4 bit mode\n", 665 pr_err("%s: %d byte block unsupported in 4 bit mode\n",
375 mmc_hostname(host->mmc), data->blksz); 666 mmc_hostname(host->mmc), data->blksz);
376 return -EINVAL; 667 return -EINVAL;
377 } 668 }
378 669
@@ -383,7 +674,7 @@ static int tmio_mmc_start_data(struct tmio_mmc_host *host,
383 sd_ctrl_write16(host, CTL_SD_XFER_LEN, data->blksz); 674 sd_ctrl_write16(host, CTL_SD_XFER_LEN, data->blksz);
384 sd_ctrl_write16(host, CTL_XFER_BLK_COUNT, data->blocks); 675 sd_ctrl_write16(host, CTL_XFER_BLK_COUNT, data->blocks);
385 676
386 return 0; 677 return tmio_mmc_start_dma(host, data);
387} 678}
388 679
389/* Process requests from the MMC layer */ 680/* Process requests from the MMC layer */
@@ -404,7 +695,6 @@ static void tmio_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
404 } 695 }
405 696
406 ret = tmio_mmc_start_command(host, mrq->cmd); 697 ret = tmio_mmc_start_command(host, mrq->cmd);
407
408 if (!ret) 698 if (!ret)
409 return; 699 return;
410 700
@@ -458,11 +748,14 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
458static int tmio_mmc_get_ro(struct mmc_host *mmc) 748static int tmio_mmc_get_ro(struct mmc_host *mmc)
459{ 749{
460 struct tmio_mmc_host *host = mmc_priv(mmc); 750 struct tmio_mmc_host *host = mmc_priv(mmc);
751 struct mfd_cell *cell = host->pdev->dev.platform_data;
752 struct tmio_mmc_data *pdata = cell->driver_data;
461 753
462 return (sd_ctrl_read16(host, CTL_STATUS) & TMIO_STAT_WRPROTECT) ? 0 : 1; 754 return ((pdata->flags & TMIO_MMC_WRPROTECT_DISABLE) ||
755 (sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT)) ? 0 : 1;
463} 756}
464 757
465static struct mmc_host_ops tmio_mmc_ops = { 758static const struct mmc_host_ops tmio_mmc_ops = {
466 .request = tmio_mmc_request, 759 .request = tmio_mmc_request,
467 .set_ios = tmio_mmc_set_ios, 760 .set_ios = tmio_mmc_set_ios,
468 .get_ro = tmio_mmc_get_ro, 761 .get_ro = tmio_mmc_get_ro,
@@ -515,6 +808,7 @@ static int __devinit tmio_mmc_probe(struct platform_device *dev)
515 struct tmio_mmc_host *host; 808 struct tmio_mmc_host *host;
516 struct mmc_host *mmc; 809 struct mmc_host *mmc;
517 int ret = -EINVAL; 810 int ret = -EINVAL;
811 u32 irq_mask = TMIO_MASK_CMD;
518 812
519 if (dev->num_resources != 2) 813 if (dev->num_resources != 2)
520 goto out; 814 goto out;
@@ -553,7 +847,10 @@ static int __devinit tmio_mmc_probe(struct platform_device *dev)
553 mmc->caps |= pdata->capabilities; 847 mmc->caps |= pdata->capabilities;
554 mmc->f_max = pdata->hclk; 848 mmc->f_max = pdata->hclk;
555 mmc->f_min = mmc->f_max / 512; 849 mmc->f_min = mmc->f_max / 512;
556 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; 850 if (pdata->ocr_mask)
851 mmc->ocr_avail = pdata->ocr_mask;
852 else
853 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
557 854
558 /* Tell the MFD core we are ready to be enabled */ 855 /* Tell the MFD core we are ready to be enabled */
559 if (cell->enable) { 856 if (cell->enable) {
@@ -578,13 +875,20 @@ static int __devinit tmio_mmc_probe(struct platform_device *dev)
578 if (ret) 875 if (ret)
579 goto cell_disable; 876 goto cell_disable;
580 877
878 /* See if we also get DMA */
879 tmio_mmc_request_dma(host, pdata);
880
581 mmc_add_host(mmc); 881 mmc_add_host(mmc);
582 882
583 printk(KERN_INFO "%s at 0x%08lx irq %d\n", mmc_hostname(host->mmc), 883 pr_info("%s at 0x%08lx irq %d\n", mmc_hostname(host->mmc),
584 (unsigned long)host->ctl, host->irq); 884 (unsigned long)host->ctl, host->irq);
585 885
586 /* Unmask the IRQs we want to know about */ 886 /* Unmask the IRQs we want to know about */
587 enable_mmc_irqs(host, TMIO_MASK_IRQ); 887 if (!host->chan_rx)
888 irq_mask |= TMIO_MASK_READOP;
889 if (!host->chan_tx)
890 irq_mask |= TMIO_MASK_WRITEOP;
891 enable_mmc_irqs(host, irq_mask);
588 892
589 return 0; 893 return 0;
590 894
@@ -609,6 +913,7 @@ static int __devexit tmio_mmc_remove(struct platform_device *dev)
609 if (mmc) { 913 if (mmc) {
610 struct tmio_mmc_host *host = mmc_priv(mmc); 914 struct tmio_mmc_host *host = mmc_priv(mmc);
611 mmc_remove_host(mmc); 915 mmc_remove_host(mmc);
916 tmio_mmc_release_dma(host);
612 free_irq(host->irq, host); 917 free_irq(host->irq, host);
613 if (cell->disable) 918 if (cell->disable)
614 cell->disable(dev); 919 cell->disable(dev);
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index dafecfbcd91a..64f7d5dfc106 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -10,6 +10,8 @@
10 */ 10 */
11 11
12#include <linux/highmem.h> 12#include <linux/highmem.h>
13#include <linux/interrupt.h>
14#include <linux/dmaengine.h>
13 15
14#define CTL_SD_CMD 0x00 16#define CTL_SD_CMD 0x00
15#define CTL_ARG_REG 0x04 17#define CTL_ARG_REG 0x04
@@ -106,6 +108,17 @@ struct tmio_mmc_host {
106 unsigned int sg_off; 108 unsigned int sg_off;
107 109
108 struct platform_device *pdev; 110 struct platform_device *pdev;
111
112 /* DMA support */
113 struct dma_chan *chan_rx;
114 struct dma_chan *chan_tx;
115 struct tasklet_struct dma_complete;
116 struct tasklet_struct dma_issue;
117#ifdef CONFIG_TMIO_MMC_DMA
118 struct dma_async_tx_descriptor *desc;
119 unsigned int dma_sglen;
120 dma_cookie_t cookie;
121#endif
109}; 122};
110 123
111#include <linux/io.h> 124#include <linux/io.h>
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index 36dbcee1ac29..ba124baa646d 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -143,7 +143,7 @@ static int of_flash_remove(struct of_device *dev)
143static struct mtd_info * __devinit obsolete_probe(struct of_device *dev, 143static struct mtd_info * __devinit obsolete_probe(struct of_device *dev,
144 struct map_info *map) 144 struct map_info *map)
145{ 145{
146 struct device_node *dp = dev->node; 146 struct device_node *dp = dev->dev.of_node;
147 const char *of_probe; 147 const char *of_probe;
148 struct mtd_info *mtd; 148 struct mtd_info *mtd;
149 static const char *rom_probe_types[] 149 static const char *rom_probe_types[]
@@ -221,7 +221,7 @@ static int __devinit of_flash_probe(struct of_device *dev,
221#ifdef CONFIG_MTD_PARTITIONS 221#ifdef CONFIG_MTD_PARTITIONS
222 const char **part_probe_types; 222 const char **part_probe_types;
223#endif 223#endif
224 struct device_node *dp = dev->node; 224 struct device_node *dp = dev->dev.of_node;
225 struct resource res; 225 struct resource res;
226 struct of_flash *info; 226 struct of_flash *info;
227 const char *probe_type = match->data; 227 const char *probe_type = match->data;
@@ -245,7 +245,7 @@ static int __devinit of_flash_probe(struct of_device *dev,
245 p = of_get_property(dp, "reg", &count); 245 p = of_get_property(dp, "reg", &count);
246 if (count % reg_tuple_size != 0) { 246 if (count % reg_tuple_size != 0) {
247 dev_err(&dev->dev, "Malformed reg property on %s\n", 247 dev_err(&dev->dev, "Malformed reg property on %s\n",
248 dev->node->full_name); 248 dev->dev.of_node->full_name);
249 err = -EINVAL; 249 err = -EINVAL;
250 goto err_flash_remove; 250 goto err_flash_remove;
251 } 251 }
@@ -418,8 +418,11 @@ static struct of_device_id of_flash_match[] = {
418MODULE_DEVICE_TABLE(of, of_flash_match); 418MODULE_DEVICE_TABLE(of, of_flash_match);
419 419
420static struct of_platform_driver of_flash_driver = { 420static struct of_platform_driver of_flash_driver = {
421 .name = "of-flash", 421 .driver = {
422 .match_table = of_flash_match, 422 .name = "of-flash",
423 .owner = THIS_MODULE,
424 .of_match_table = of_flash_match,
425 },
423 .probe = of_flash_probe, 426 .probe = of_flash_probe,
424 .remove = of_flash_remove, 427 .remove = of_flash_remove,
425}; 428};
diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c
index fadc4c45b455..0391c2527bd7 100644
--- a/drivers/mtd/maps/sun_uflash.c
+++ b/drivers/mtd/maps/sun_uflash.c
@@ -110,7 +110,7 @@ int uflash_devinit(struct of_device *op, struct device_node *dp)
110 110
111static int __devinit uflash_probe(struct of_device *op, const struct of_device_id *match) 111static int __devinit uflash_probe(struct of_device *op, const struct of_device_id *match)
112{ 112{
113 struct device_node *dp = op->node; 113 struct device_node *dp = op->dev.of_node;
114 114
115 /* Flashprom must have the "user" property in order to 115 /* Flashprom must have the "user" property in order to
116 * be used by this driver. 116 * be used by this driver.
@@ -149,8 +149,11 @@ static const struct of_device_id uflash_match[] = {
149MODULE_DEVICE_TABLE(of, uflash_match); 149MODULE_DEVICE_TABLE(of, uflash_match);
150 150
151static struct of_platform_driver uflash_driver = { 151static struct of_platform_driver uflash_driver = {
152 .name = DRIVER_NAME, 152 .driver = {
153 .match_table = uflash_match, 153 .name = DRIVER_NAME,
154 .owner = THIS_MODULE,
155 .of_match_table = uflash_match,
156 },
154 .probe = uflash_probe, 157 .probe = uflash_probe,
155 .remove = __devexit_p(uflash_remove), 158 .remove = __devexit_p(uflash_remove),
156}; 159};
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index 3f38fb8e6666..5084cc517944 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -1030,14 +1030,14 @@ static int __devinit fsl_elbc_ctrl_probe(struct of_device *ofdev,
1030 init_waitqueue_head(&ctrl->controller.wq); 1030 init_waitqueue_head(&ctrl->controller.wq);
1031 init_waitqueue_head(&ctrl->irq_wait); 1031 init_waitqueue_head(&ctrl->irq_wait);
1032 1032
1033 ctrl->regs = of_iomap(ofdev->node, 0); 1033 ctrl->regs = of_iomap(ofdev->dev.of_node, 0);
1034 if (!ctrl->regs) { 1034 if (!ctrl->regs) {
1035 dev_err(&ofdev->dev, "failed to get memory region\n"); 1035 dev_err(&ofdev->dev, "failed to get memory region\n");
1036 ret = -ENODEV; 1036 ret = -ENODEV;
1037 goto err; 1037 goto err;
1038 } 1038 }
1039 1039
1040 ctrl->irq = of_irq_to_resource(ofdev->node, 0, NULL); 1040 ctrl->irq = of_irq_to_resource(ofdev->dev.of_node, 0, NULL);
1041 if (ctrl->irq == NO_IRQ) { 1041 if (ctrl->irq == NO_IRQ) {
1042 dev_err(&ofdev->dev, "failed to get irq resource\n"); 1042 dev_err(&ofdev->dev, "failed to get irq resource\n");
1043 ret = -ENODEV; 1043 ret = -ENODEV;
@@ -1058,7 +1058,7 @@ static int __devinit fsl_elbc_ctrl_probe(struct of_device *ofdev,
1058 goto err; 1058 goto err;
1059 } 1059 }
1060 1060
1061 for_each_child_of_node(ofdev->node, child) 1061 for_each_child_of_node(ofdev->dev.of_node, child)
1062 if (of_device_is_compatible(child, "fsl,elbc-fcm-nand")) 1062 if (of_device_is_compatible(child, "fsl,elbc-fcm-nand"))
1063 fsl_elbc_chip_probe(ctrl, child); 1063 fsl_elbc_chip_probe(ctrl, child);
1064 1064
@@ -1078,9 +1078,10 @@ static const struct of_device_id fsl_elbc_match[] = {
1078 1078
1079static struct of_platform_driver fsl_elbc_ctrl_driver = { 1079static struct of_platform_driver fsl_elbc_ctrl_driver = {
1080 .driver = { 1080 .driver = {
1081 .name = "fsl-elbc", 1081 .name = "fsl-elbc",
1082 .owner = THIS_MODULE,
1083 .of_match_table = fsl_elbc_match,
1082 }, 1084 },
1083 .match_table = fsl_elbc_match,
1084 .probe = fsl_elbc_ctrl_probe, 1085 .probe = fsl_elbc_ctrl_probe,
1085 .remove = fsl_elbc_ctrl_remove, 1086 .remove = fsl_elbc_ctrl_remove,
1086}; 1087};
diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
index 2d215ccb564d..00aea6f7d1f1 100644
--- a/drivers/mtd/nand/fsl_upm.c
+++ b/drivers/mtd/nand/fsl_upm.c
@@ -360,8 +360,11 @@ static const struct of_device_id of_fun_match[] = {
360MODULE_DEVICE_TABLE(of, of_fun_match); 360MODULE_DEVICE_TABLE(of, of_fun_match);
361 361
362static struct of_platform_driver of_fun_driver = { 362static struct of_platform_driver of_fun_driver = {
363 .name = "fsl,upm-nand", 363 .driver = {
364 .match_table = of_fun_match, 364 .name = "fsl,upm-nand",
365 .owner = THIS_MODULE,
366 .of_match_table = of_fun_match,
367 },
365 .probe = fun_probe, 368 .probe = fun_probe,
366 .remove = __devexit_p(fun_remove), 369 .remove = __devexit_p(fun_remove),
367}; 370};
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index b983cae8c298..98fd2bdf8be1 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -239,14 +239,14 @@ static int __devinit ndfc_probe(struct of_device *ofdev,
239 dev_set_drvdata(&ofdev->dev, ndfc); 239 dev_set_drvdata(&ofdev->dev, ndfc);
240 240
241 /* Read the reg property to get the chip select */ 241 /* Read the reg property to get the chip select */
242 reg = of_get_property(ofdev->node, "reg", &len); 242 reg = of_get_property(ofdev->dev.of_node, "reg", &len);
243 if (reg == NULL || len != 12) { 243 if (reg == NULL || len != 12) {
244 dev_err(&ofdev->dev, "unable read reg property (%d)\n", len); 244 dev_err(&ofdev->dev, "unable read reg property (%d)\n", len);
245 return -ENOENT; 245 return -ENOENT;
246 } 246 }
247 ndfc->chip_select = reg[0]; 247 ndfc->chip_select = reg[0];
248 248
249 ndfc->ndfcbase = of_iomap(ofdev->node, 0); 249 ndfc->ndfcbase = of_iomap(ofdev->dev.of_node, 0);
250 if (!ndfc->ndfcbase) { 250 if (!ndfc->ndfcbase) {
251 dev_err(&ofdev->dev, "failed to get memory\n"); 251 dev_err(&ofdev->dev, "failed to get memory\n");
252 return -EIO; 252 return -EIO;
@@ -255,20 +255,20 @@ static int __devinit ndfc_probe(struct of_device *ofdev,
255 ccr = NDFC_CCR_BS(ndfc->chip_select); 255 ccr = NDFC_CCR_BS(ndfc->chip_select);
256 256
257 /* It is ok if ccr does not exist - just default to 0 */ 257 /* It is ok if ccr does not exist - just default to 0 */
258 reg = of_get_property(ofdev->node, "ccr", NULL); 258 reg = of_get_property(ofdev->dev.of_node, "ccr", NULL);
259 if (reg) 259 if (reg)
260 ccr |= *reg; 260 ccr |= *reg;
261 261
262 out_be32(ndfc->ndfcbase + NDFC_CCR, ccr); 262 out_be32(ndfc->ndfcbase + NDFC_CCR, ccr);
263 263
264 /* Set the bank settings if given */ 264 /* Set the bank settings if given */
265 reg = of_get_property(ofdev->node, "bank-settings", NULL); 265 reg = of_get_property(ofdev->dev.of_node, "bank-settings", NULL);
266 if (reg) { 266 if (reg) {
267 int offset = NDFC_BCFG0 + (ndfc->chip_select << 2); 267 int offset = NDFC_BCFG0 + (ndfc->chip_select << 2);
268 out_be32(ndfc->ndfcbase + offset, *reg); 268 out_be32(ndfc->ndfcbase + offset, *reg);
269 } 269 }
270 270
271 err = ndfc_chip_init(ndfc, ofdev->node); 271 err = ndfc_chip_init(ndfc, ofdev->dev.of_node);
272 if (err) { 272 if (err) {
273 iounmap(ndfc->ndfcbase); 273 iounmap(ndfc->ndfcbase);
274 return err; 274 return err;
@@ -294,9 +294,10 @@ MODULE_DEVICE_TABLE(of, ndfc_match);
294 294
295static struct of_platform_driver ndfc_driver = { 295static struct of_platform_driver ndfc_driver = {
296 .driver = { 296 .driver = {
297 .name = "ndfc", 297 .name = "ndfc",
298 .owner = THIS_MODULE,
299 .of_match_table = ndfc_match,
298 }, 300 },
299 .match_table = ndfc_match,
300 .probe = ndfc_probe, 301 .probe = ndfc_probe,
301 .remove = __devexit_p(ndfc_remove), 302 .remove = __devexit_p(ndfc_remove),
302}; 303};
diff --git a/drivers/mtd/nand/pasemi_nand.c b/drivers/mtd/nand/pasemi_nand.c
index 090a05c12cbe..f02af24d033a 100644
--- a/drivers/mtd/nand/pasemi_nand.c
+++ b/drivers/mtd/nand/pasemi_nand.c
@@ -93,7 +93,7 @@ static int __devinit pasemi_nand_probe(struct of_device *ofdev,
93 const struct of_device_id *match) 93 const struct of_device_id *match)
94{ 94{
95 struct pci_dev *pdev; 95 struct pci_dev *pdev;
96 struct device_node *np = ofdev->node; 96 struct device_node *np = ofdev->dev.of_node;
97 struct resource res; 97 struct resource res;
98 struct nand_chip *chip; 98 struct nand_chip *chip;
99 int err = 0; 99 int err = 0;
@@ -221,8 +221,11 @@ MODULE_DEVICE_TABLE(of, pasemi_nand_match);
221 221
222static struct of_platform_driver pasemi_nand_driver = 222static struct of_platform_driver pasemi_nand_driver =
223{ 223{
224 .name = (char*)driver_name, 224 .driver = {
225 .match_table = pasemi_nand_match, 225 .name = (char*)driver_name,
226 .owner = THIS_MODULE,
227 .of_match_table = pasemi_nand_match,
228 },
226 .probe = pasemi_nand_probe, 229 .probe = pasemi_nand_probe,
227 .remove = pasemi_nand_remove, 230 .remove = pasemi_nand_remove,
228}; 231};
diff --git a/drivers/mtd/nand/socrates_nand.c b/drivers/mtd/nand/socrates_nand.c
index b37cbde6e7db..884852dc7eb4 100644
--- a/drivers/mtd/nand/socrates_nand.c
+++ b/drivers/mtd/nand/socrates_nand.c
@@ -301,8 +301,11 @@ static const struct of_device_id socrates_nand_match[] =
301MODULE_DEVICE_TABLE(of, socrates_nand_match); 301MODULE_DEVICE_TABLE(of, socrates_nand_match);
302 302
303static struct of_platform_driver socrates_nand_driver = { 303static struct of_platform_driver socrates_nand_driver = {
304 .name = "socrates_nand", 304 .driver = {
305 .match_table = socrates_nand_match, 305 .name = "socrates_nand",
306 .owner = THIS_MODULE,
307 .of_match_table = socrates_nand_match,
308 },
306 .probe = socrates_nand_probe, 309 .probe = socrates_nand_probe,
307 .remove = __devexit_p(socrates_nand_remove), 310 .remove = __devexit_p(socrates_nand_remove),
308}; 311};
diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
index 225fd147774a..8af8442c694a 100644
--- a/drivers/net/can/mscan/mpc5xxx_can.c
+++ b/drivers/net/can/mscan/mpc5xxx_can.c
@@ -392,15 +392,17 @@ static struct of_device_id __devinitdata mpc5xxx_can_table[] = {
392}; 392};
393 393
394static struct of_platform_driver mpc5xxx_can_driver = { 394static struct of_platform_driver mpc5xxx_can_driver = {
395 .owner = THIS_MODULE, 395 .driver = {
396 .name = "mpc5xxx_can", 396 .name = "mpc5xxx_can",
397 .owner = THIS_MODULE,
398 .of_match_table = mpc5xxx_can_table,
399 },
397 .probe = mpc5xxx_can_probe, 400 .probe = mpc5xxx_can_probe,
398 .remove = __devexit_p(mpc5xxx_can_remove), 401 .remove = __devexit_p(mpc5xxx_can_remove),
399#ifdef CONFIG_PM 402#ifdef CONFIG_PM
400 .suspend = mpc5xxx_can_suspend, 403 .suspend = mpc5xxx_can_suspend,
401 .resume = mpc5xxx_can_resume, 404 .resume = mpc5xxx_can_resume,
402#endif 405#endif
403 .match_table = mpc5xxx_can_table,
404}; 406};
405 407
406static int __init mpc5xxx_can_init(void) 408static int __init mpc5xxx_can_init(void)
diff --git a/drivers/net/can/sja1000/sja1000_of_platform.c b/drivers/net/can/sja1000/sja1000_of_platform.c
index 34e79efbd2fc..ac1a83d7c204 100644
--- a/drivers/net/can/sja1000/sja1000_of_platform.c
+++ b/drivers/net/can/sja1000/sja1000_of_platform.c
@@ -71,7 +71,7 @@ static int __devexit sja1000_ofp_remove(struct of_device *ofdev)
71{ 71{
72 struct net_device *dev = dev_get_drvdata(&ofdev->dev); 72 struct net_device *dev = dev_get_drvdata(&ofdev->dev);
73 struct sja1000_priv *priv = netdev_priv(dev); 73 struct sja1000_priv *priv = netdev_priv(dev);
74 struct device_node *np = ofdev->node; 74 struct device_node *np = ofdev->dev.of_node;
75 struct resource res; 75 struct resource res;
76 76
77 dev_set_drvdata(&ofdev->dev, NULL); 77 dev_set_drvdata(&ofdev->dev, NULL);
@@ -90,7 +90,7 @@ static int __devexit sja1000_ofp_remove(struct of_device *ofdev)
90static int __devinit sja1000_ofp_probe(struct of_device *ofdev, 90static int __devinit sja1000_ofp_probe(struct of_device *ofdev,
91 const struct of_device_id *id) 91 const struct of_device_id *id)
92{ 92{
93 struct device_node *np = ofdev->node; 93 struct device_node *np = ofdev->dev.of_node;
94 struct net_device *dev; 94 struct net_device *dev;
95 struct sja1000_priv *priv; 95 struct sja1000_priv *priv;
96 struct resource res; 96 struct resource res;
@@ -215,11 +215,13 @@ static struct of_device_id __devinitdata sja1000_ofp_table[] = {
215MODULE_DEVICE_TABLE(of, sja1000_ofp_table); 215MODULE_DEVICE_TABLE(of, sja1000_ofp_table);
216 216
217static struct of_platform_driver sja1000_ofp_driver = { 217static struct of_platform_driver sja1000_ofp_driver = {
218 .owner = THIS_MODULE, 218 .driver = {
219 .name = DRV_NAME, 219 .owner = THIS_MODULE,
220 .name = DRV_NAME,
221 .of_match_table = sja1000_ofp_table,
222 },
220 .probe = sja1000_ofp_probe, 223 .probe = sja1000_ofp_probe,
221 .remove = __devexit_p(sja1000_ofp_remove), 224 .remove = __devexit_p(sja1000_ofp_remove),
222 .match_table = sja1000_ofp_table,
223}; 225};
224 226
225static int __init sja1000_ofp_init(void) 227static int __init sja1000_ofp_init(void)
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 02698a1c80b0..f547894ff48f 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -122,8 +122,11 @@ static struct of_device_id ehea_device_table[] = {
122MODULE_DEVICE_TABLE(of, ehea_device_table); 122MODULE_DEVICE_TABLE(of, ehea_device_table);
123 123
124static struct of_platform_driver ehea_driver = { 124static struct of_platform_driver ehea_driver = {
125 .name = "ehea", 125 .driver = {
126 .match_table = ehea_device_table, 126 .name = "ehea",
127 .owner = THIS_MODULE,
128 .of_match_table = ehea_device_table,
129 },
127 .probe = ehea_probe_adapter, 130 .probe = ehea_probe_adapter,
128 .remove = ehea_remove, 131 .remove = ehea_remove,
129}; 132};
@@ -3050,7 +3053,7 @@ static DEVICE_ATTR(log_port_id, S_IRUSR | S_IRGRP | S_IROTH, ehea_show_port_id,
3050static void __devinit logical_port_release(struct device *dev) 3053static void __devinit logical_port_release(struct device *dev)
3051{ 3054{
3052 struct ehea_port *port = container_of(dev, struct ehea_port, ofdev.dev); 3055 struct ehea_port *port = container_of(dev, struct ehea_port, ofdev.dev);
3053 of_node_put(port->ofdev.node); 3056 of_node_put(port->ofdev.dev.of_node);
3054} 3057}
3055 3058
3056static struct device *ehea_register_port(struct ehea_port *port, 3059static struct device *ehea_register_port(struct ehea_port *port,
@@ -3058,7 +3061,7 @@ static struct device *ehea_register_port(struct ehea_port *port,
3058{ 3061{
3059 int ret; 3062 int ret;
3060 3063
3061 port->ofdev.node = of_node_get(dn); 3064 port->ofdev.dev.of_node = of_node_get(dn);
3062 port->ofdev.dev.parent = &port->adapter->ofdev->dev; 3065 port->ofdev.dev.parent = &port->adapter->ofdev->dev;
3063 port->ofdev.dev.bus = &ibmebus_bus_type; 3066 port->ofdev.dev.bus = &ibmebus_bus_type;
3064 3067
@@ -3225,7 +3228,7 @@ static int ehea_setup_ports(struct ehea_adapter *adapter)
3225 const u32 *dn_log_port_id; 3228 const u32 *dn_log_port_id;
3226 int i = 0; 3229 int i = 0;
3227 3230
3228 lhea_dn = adapter->ofdev->node; 3231 lhea_dn = adapter->ofdev->dev.of_node;
3229 while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) { 3232 while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
3230 3233
3231 dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no", 3234 dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no",
@@ -3264,7 +3267,7 @@ static struct device_node *ehea_get_eth_dn(struct ehea_adapter *adapter,
3264 struct device_node *eth_dn = NULL; 3267 struct device_node *eth_dn = NULL;
3265 const u32 *dn_log_port_id; 3268 const u32 *dn_log_port_id;
3266 3269
3267 lhea_dn = adapter->ofdev->node; 3270 lhea_dn = adapter->ofdev->dev.of_node;
3268 while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) { 3271 while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
3269 3272
3270 dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no", 3273 dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no",
@@ -3394,7 +3397,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev,
3394 const u64 *adapter_handle; 3397 const u64 *adapter_handle;
3395 int ret; 3398 int ret;
3396 3399
3397 if (!dev || !dev->node) { 3400 if (!dev || !dev->dev.of_node) {
3398 ehea_error("Invalid ibmebus device probed"); 3401 ehea_error("Invalid ibmebus device probed");
3399 return -EINVAL; 3402 return -EINVAL;
3400 } 3403 }
@@ -3410,14 +3413,14 @@ static int __devinit ehea_probe_adapter(struct of_device *dev,
3410 3413
3411 adapter->ofdev = dev; 3414 adapter->ofdev = dev;
3412 3415
3413 adapter_handle = of_get_property(dev->node, "ibm,hea-handle", 3416 adapter_handle = of_get_property(dev->dev.of_node, "ibm,hea-handle",
3414 NULL); 3417 NULL);
3415 if (adapter_handle) 3418 if (adapter_handle)
3416 adapter->handle = *adapter_handle; 3419 adapter->handle = *adapter_handle;
3417 3420
3418 if (!adapter->handle) { 3421 if (!adapter->handle) {
3419 dev_err(&dev->dev, "failed getting handle for adapter" 3422 dev_err(&dev->dev, "failed getting handle for adapter"
3420 " '%s'\n", dev->node->full_name); 3423 " '%s'\n", dev->dev.of_node->full_name);
3421 ret = -ENODEV; 3424 ret = -ENODEV;
3422 goto out_free_ad; 3425 goto out_free_ad;
3423 } 3426 }
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index 221f440c10f4..25e6cc6840b1 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -871,7 +871,7 @@ mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match)
871 priv->ndev = ndev; 871 priv->ndev = ndev;
872 872
873 /* Reserve FEC control zone */ 873 /* Reserve FEC control zone */
874 rv = of_address_to_resource(op->node, 0, &mem); 874 rv = of_address_to_resource(op->dev.of_node, 0, &mem);
875 if (rv) { 875 if (rv) {
876 printk(KERN_ERR DRIVER_NAME ": " 876 printk(KERN_ERR DRIVER_NAME ": "
877 "Error while parsing device node resource\n" ); 877 "Error while parsing device node resource\n" );
@@ -919,7 +919,7 @@ mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match)
919 919
920 /* Get the IRQ we need one by one */ 920 /* Get the IRQ we need one by one */
921 /* Control */ 921 /* Control */
922 ndev->irq = irq_of_parse_and_map(op->node, 0); 922 ndev->irq = irq_of_parse_and_map(op->dev.of_node, 0);
923 923
924 /* RX */ 924 /* RX */
925 priv->r_irq = bcom_get_task_irq(priv->rx_dmatsk); 925 priv->r_irq = bcom_get_task_irq(priv->rx_dmatsk);
@@ -942,20 +942,20 @@ mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match)
942 /* Start with safe defaults for link connection */ 942 /* Start with safe defaults for link connection */
943 priv->speed = 100; 943 priv->speed = 100;
944 priv->duplex = DUPLEX_HALF; 944 priv->duplex = DUPLEX_HALF;
945 priv->mdio_speed = ((mpc5xxx_get_bus_frequency(op->node) >> 20) / 5) << 1; 945 priv->mdio_speed = ((mpc5xxx_get_bus_frequency(op->dev.of_node) >> 20) / 5) << 1;
946 946
947 /* The current speed preconfigures the speed of the MII link */ 947 /* The current speed preconfigures the speed of the MII link */
948 prop = of_get_property(op->node, "current-speed", &prop_size); 948 prop = of_get_property(op->dev.of_node, "current-speed", &prop_size);
949 if (prop && (prop_size >= sizeof(u32) * 2)) { 949 if (prop && (prop_size >= sizeof(u32) * 2)) {
950 priv->speed = prop[0]; 950 priv->speed = prop[0];
951 priv->duplex = prop[1] ? DUPLEX_FULL : DUPLEX_HALF; 951 priv->duplex = prop[1] ? DUPLEX_FULL : DUPLEX_HALF;
952 } 952 }
953 953
954 /* If there is a phy handle, then get the PHY node */ 954 /* If there is a phy handle, then get the PHY node */
955 priv->phy_node = of_parse_phandle(op->node, "phy-handle", 0); 955 priv->phy_node = of_parse_phandle(op->dev.of_node, "phy-handle", 0);
956 956
957 /* the 7-wire property means don't use MII mode */ 957 /* the 7-wire property means don't use MII mode */
958 if (of_find_property(op->node, "fsl,7-wire-mode", NULL)) { 958 if (of_find_property(op->dev.of_node, "fsl,7-wire-mode", NULL)) {
959 priv->seven_wire_mode = 1; 959 priv->seven_wire_mode = 1;
960 dev_info(&ndev->dev, "using 7-wire PHY mode\n"); 960 dev_info(&ndev->dev, "using 7-wire PHY mode\n");
961 } 961 }
@@ -1063,9 +1063,11 @@ static struct of_device_id mpc52xx_fec_match[] = {
1063MODULE_DEVICE_TABLE(of, mpc52xx_fec_match); 1063MODULE_DEVICE_TABLE(of, mpc52xx_fec_match);
1064 1064
1065static struct of_platform_driver mpc52xx_fec_driver = { 1065static struct of_platform_driver mpc52xx_fec_driver = {
1066 .owner = THIS_MODULE, 1066 .driver = {
1067 .name = DRIVER_NAME, 1067 .name = DRIVER_NAME,
1068 .match_table = mpc52xx_fec_match, 1068 .owner = THIS_MODULE,
1069 .of_match_table = mpc52xx_fec_match,
1070 },
1069 .probe = mpc52xx_fec_probe, 1071 .probe = mpc52xx_fec_probe,
1070 .remove = mpc52xx_fec_remove, 1072 .remove = mpc52xx_fec_remove,
1071#ifdef CONFIG_PM 1073#ifdef CONFIG_PM
diff --git a/drivers/net/fec_mpc52xx_phy.c b/drivers/net/fec_mpc52xx_phy.c
index 7658a082e390..006f64d9f96a 100644
--- a/drivers/net/fec_mpc52xx_phy.c
+++ b/drivers/net/fec_mpc52xx_phy.c
@@ -66,7 +66,7 @@ static int mpc52xx_fec_mdio_probe(struct of_device *of,
66 const struct of_device_id *match) 66 const struct of_device_id *match)
67{ 67{
68 struct device *dev = &of->dev; 68 struct device *dev = &of->dev;
69 struct device_node *np = of->node; 69 struct device_node *np = of->dev.of_node;
70 struct mii_bus *bus; 70 struct mii_bus *bus;
71 struct mpc52xx_fec_mdio_priv *priv; 71 struct mpc52xx_fec_mdio_priv *priv;
72 struct resource res = {}; 72 struct resource res = {};
@@ -107,7 +107,7 @@ static int mpc52xx_fec_mdio_probe(struct of_device *of,
107 107
108 /* set MII speed */ 108 /* set MII speed */
109 out_be32(&priv->regs->mii_speed, 109 out_be32(&priv->regs->mii_speed,
110 ((mpc5xxx_get_bus_frequency(of->node) >> 20) / 5) << 1); 110 ((mpc5xxx_get_bus_frequency(of->dev.of_node) >> 20) / 5) << 1);
111 111
112 err = of_mdiobus_register(bus, np); 112 err = of_mdiobus_register(bus, np);
113 if (err) 113 if (err)
@@ -159,10 +159,13 @@ static struct of_device_id mpc52xx_fec_mdio_match[] = {
159MODULE_DEVICE_TABLE(of, mpc52xx_fec_mdio_match); 159MODULE_DEVICE_TABLE(of, mpc52xx_fec_mdio_match);
160 160
161struct of_platform_driver mpc52xx_fec_mdio_driver = { 161struct of_platform_driver mpc52xx_fec_mdio_driver = {
162 .name = "mpc5200b-fec-phy", 162 .driver = {
163 .name = "mpc5200b-fec-phy",
164 .owner = THIS_MODULE,
165 .of_match_table = mpc52xx_fec_mdio_match,
166 },
163 .probe = mpc52xx_fec_mdio_probe, 167 .probe = mpc52xx_fec_mdio_probe,
164 .remove = mpc52xx_fec_mdio_remove, 168 .remove = mpc52xx_fec_mdio_remove,
165 .match_table = mpc52xx_fec_mdio_match,
166}; 169};
167 170
168/* let fec driver call it, since this has to be registered before it */ 171/* let fec driver call it, since this has to be registered before it */
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 0fb0fefcb787..309a0eaddd81 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -1013,7 +1013,7 @@ static int __devinit fs_enet_probe(struct of_device *ofdev,
1013 return -ENOMEM; 1013 return -ENOMEM;
1014 1014
1015 if (!IS_FEC(match)) { 1015 if (!IS_FEC(match)) {
1016 data = of_get_property(ofdev->node, "fsl,cpm-command", &len); 1016 data = of_get_property(ofdev->dev.of_node, "fsl,cpm-command", &len);
1017 if (!data || len != 4) 1017 if (!data || len != 4)
1018 goto out_free_fpi; 1018 goto out_free_fpi;
1019 1019
@@ -1025,8 +1025,8 @@ static int __devinit fs_enet_probe(struct of_device *ofdev,
1025 fpi->rx_copybreak = 240; 1025 fpi->rx_copybreak = 240;
1026 fpi->use_napi = 1; 1026 fpi->use_napi = 1;
1027 fpi->napi_weight = 17; 1027 fpi->napi_weight = 17;
1028 fpi->phy_node = of_parse_phandle(ofdev->node, "phy-handle", 0); 1028 fpi->phy_node = of_parse_phandle(ofdev->dev.of_node, "phy-handle", 0);
1029 if ((!fpi->phy_node) && (!of_get_property(ofdev->node, "fixed-link", 1029 if ((!fpi->phy_node) && (!of_get_property(ofdev->dev.of_node, "fixed-link",
1030 NULL))) 1030 NULL)))
1031 goto out_free_fpi; 1031 goto out_free_fpi;
1032 1032
@@ -1059,7 +1059,7 @@ static int __devinit fs_enet_probe(struct of_device *ofdev,
1059 spin_lock_init(&fep->lock); 1059 spin_lock_init(&fep->lock);
1060 spin_lock_init(&fep->tx_lock); 1060 spin_lock_init(&fep->tx_lock);
1061 1061
1062 mac_addr = of_get_mac_address(ofdev->node); 1062 mac_addr = of_get_mac_address(ofdev->dev.of_node);
1063 if (mac_addr) 1063 if (mac_addr)
1064 memcpy(ndev->dev_addr, mac_addr, 6); 1064 memcpy(ndev->dev_addr, mac_addr, 6);
1065 1065
@@ -1156,8 +1156,11 @@ static struct of_device_id fs_enet_match[] = {
1156MODULE_DEVICE_TABLE(of, fs_enet_match); 1156MODULE_DEVICE_TABLE(of, fs_enet_match);
1157 1157
1158static struct of_platform_driver fs_enet_driver = { 1158static struct of_platform_driver fs_enet_driver = {
1159 .name = "fs_enet", 1159 .driver = {
1160 .match_table = fs_enet_match, 1160 .owner = THIS_MODULE,
1161 .name = "fs_enet",
1162 .of_match_table = fs_enet_match,
1163 },
1161 .probe = fs_enet_probe, 1164 .probe = fs_enet_probe,
1162 .remove = fs_enet_remove, 1165 .remove = fs_enet_remove,
1163}; 1166};
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c
index 714da967fa19..5d45084b287d 100644
--- a/drivers/net/fs_enet/mac-fcc.c
+++ b/drivers/net/fs_enet/mac-fcc.c
@@ -88,19 +88,19 @@ static int do_pd_setup(struct fs_enet_private *fep)
88 struct fs_platform_info *fpi = fep->fpi; 88 struct fs_platform_info *fpi = fep->fpi;
89 int ret = -EINVAL; 89 int ret = -EINVAL;
90 90
91 fep->interrupt = of_irq_to_resource(ofdev->node, 0, NULL); 91 fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL);
92 if (fep->interrupt == NO_IRQ) 92 if (fep->interrupt == NO_IRQ)
93 goto out; 93 goto out;
94 94
95 fep->fcc.fccp = of_iomap(ofdev->node, 0); 95 fep->fcc.fccp = of_iomap(ofdev->dev.of_node, 0);
96 if (!fep->fcc.fccp) 96 if (!fep->fcc.fccp)
97 goto out; 97 goto out;
98 98
99 fep->fcc.ep = of_iomap(ofdev->node, 1); 99 fep->fcc.ep = of_iomap(ofdev->dev.of_node, 1);
100 if (!fep->fcc.ep) 100 if (!fep->fcc.ep)
101 goto out_fccp; 101 goto out_fccp;
102 102
103 fep->fcc.fcccp = of_iomap(ofdev->node, 2); 103 fep->fcc.fcccp = of_iomap(ofdev->dev.of_node, 2);
104 if (!fep->fcc.fcccp) 104 if (!fep->fcc.fcccp)
105 goto out_ep; 105 goto out_ep;
106 106
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c
index 7eff92ef01da..7ca1642276d0 100644
--- a/drivers/net/fs_enet/mac-fec.c
+++ b/drivers/net/fs_enet/mac-fec.c
@@ -98,11 +98,11 @@ static int do_pd_setup(struct fs_enet_private *fep)
98{ 98{
99 struct of_device *ofdev = to_of_device(fep->dev); 99 struct of_device *ofdev = to_of_device(fep->dev);
100 100
101 fep->interrupt = of_irq_to_resource(ofdev->node, 0, NULL); 101 fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL);
102 if (fep->interrupt == NO_IRQ) 102 if (fep->interrupt == NO_IRQ)
103 return -EINVAL; 103 return -EINVAL;
104 104
105 fep->fec.fecp = of_iomap(ofdev->node, 0); 105 fep->fec.fecp = of_iomap(ofdev->dev.of_node, 0);
106 if (!fep->fcc.fccp) 106 if (!fep->fcc.fccp)
107 return -EINVAL; 107 return -EINVAL;
108 108
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c
index 7f0591e43cd9..a3c44544846d 100644
--- a/drivers/net/fs_enet/mac-scc.c
+++ b/drivers/net/fs_enet/mac-scc.c
@@ -98,15 +98,15 @@ static int do_pd_setup(struct fs_enet_private *fep)
98{ 98{
99 struct of_device *ofdev = to_of_device(fep->dev); 99 struct of_device *ofdev = to_of_device(fep->dev);
100 100
101 fep->interrupt = of_irq_to_resource(ofdev->node, 0, NULL); 101 fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL);
102 if (fep->interrupt == NO_IRQ) 102 if (fep->interrupt == NO_IRQ)
103 return -EINVAL; 103 return -EINVAL;
104 104
105 fep->scc.sccp = of_iomap(ofdev->node, 0); 105 fep->scc.sccp = of_iomap(ofdev->dev.of_node, 0);
106 if (!fep->scc.sccp) 106 if (!fep->scc.sccp)
107 return -EINVAL; 107 return -EINVAL;
108 108
109 fep->scc.ep = of_iomap(ofdev->node, 1); 109 fep->scc.ep = of_iomap(ofdev->dev.of_node, 1);
110 if (!fep->scc.ep) { 110 if (!fep->scc.ep) {
111 iounmap(fep->scc.sccp); 111 iounmap(fep->scc.sccp);
112 return -EINVAL; 112 return -EINVAL;
diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c
index 24ff9f43a62b..0f90685d3d19 100644
--- a/drivers/net/fs_enet/mii-bitbang.c
+++ b/drivers/net/fs_enet/mii-bitbang.c
@@ -224,8 +224,11 @@ static struct of_device_id fs_enet_mdio_bb_match[] = {
224MODULE_DEVICE_TABLE(of, fs_enet_mdio_bb_match); 224MODULE_DEVICE_TABLE(of, fs_enet_mdio_bb_match);
225 225
226static struct of_platform_driver fs_enet_bb_mdio_driver = { 226static struct of_platform_driver fs_enet_bb_mdio_driver = {
227 .name = "fsl-bb-mdio", 227 .driver = {
228 .match_table = fs_enet_mdio_bb_match, 228 .name = "fsl-bb-mdio",
229 .owner = THIS_MODULE,
230 .of_match_table = fs_enet_mdio_bb_match,
231 },
229 .probe = fs_enet_mdio_probe, 232 .probe = fs_enet_mdio_probe,
230 .remove = fs_enet_mdio_remove, 233 .remove = fs_enet_mdio_remove,
231}; 234};
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c
index 5944b65082cb..bddffd169b93 100644
--- a/drivers/net/fs_enet/mii-fec.c
+++ b/drivers/net/fs_enet/mii-fec.c
@@ -124,7 +124,7 @@ static int __devinit fs_enet_mdio_probe(struct of_device *ofdev,
124 new_bus->write = &fs_enet_fec_mii_write; 124 new_bus->write = &fs_enet_fec_mii_write;
125 new_bus->reset = &fs_enet_fec_mii_reset; 125 new_bus->reset = &fs_enet_fec_mii_reset;
126 126
127 ret = of_address_to_resource(ofdev->node, 0, &res); 127 ret = of_address_to_resource(ofdev->dev.of_node, 0, &res);
128 if (ret) 128 if (ret)
129 goto out_res; 129 goto out_res;
130 130
@@ -135,7 +135,7 @@ static int __devinit fs_enet_mdio_probe(struct of_device *ofdev,
135 goto out_fec; 135 goto out_fec;
136 136
137 if (get_bus_freq) { 137 if (get_bus_freq) {
138 clock = get_bus_freq(ofdev->node); 138 clock = get_bus_freq(ofdev->dev.of_node);
139 if (!clock) { 139 if (!clock) {
140 /* Use maximum divider if clock is unknown */ 140 /* Use maximum divider if clock is unknown */
141 dev_warn(&ofdev->dev, "could not determine IPS clock\n"); 141 dev_warn(&ofdev->dev, "could not determine IPS clock\n");
@@ -172,7 +172,7 @@ static int __devinit fs_enet_mdio_probe(struct of_device *ofdev,
172 new_bus->parent = &ofdev->dev; 172 new_bus->parent = &ofdev->dev;
173 dev_set_drvdata(&ofdev->dev, new_bus); 173 dev_set_drvdata(&ofdev->dev, new_bus);
174 174
175 ret = of_mdiobus_register(new_bus, ofdev->node); 175 ret = of_mdiobus_register(new_bus, ofdev->dev.of_node);
176 if (ret) 176 if (ret)
177 goto out_free_irqs; 177 goto out_free_irqs;
178 178
@@ -222,8 +222,11 @@ static struct of_device_id fs_enet_mdio_fec_match[] = {
222MODULE_DEVICE_TABLE(of, fs_enet_mdio_fec_match); 222MODULE_DEVICE_TABLE(of, fs_enet_mdio_fec_match);
223 223
224static struct of_platform_driver fs_enet_fec_mdio_driver = { 224static struct of_platform_driver fs_enet_fec_mdio_driver = {
225 .name = "fsl-fec-mdio", 225 .driver = {
226 .match_table = fs_enet_mdio_fec_match, 226 .name = "fsl-fec-mdio",
227 .owner = THIS_MODULE,
228 .of_match_table = fs_enet_mdio_fec_match,
229 },
227 .probe = fs_enet_mdio_probe, 230 .probe = fs_enet_mdio_probe,
228 .remove = fs_enet_mdio_remove, 231 .remove = fs_enet_mdio_remove,
229}; 232};
diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c
index ff028f59b930..b4c41d72c423 100644
--- a/drivers/net/fsl_pq_mdio.c
+++ b/drivers/net/fsl_pq_mdio.c
@@ -267,7 +267,7 @@ static int get_ucc_id_for_range(u64 start, u64 end, u32 *ucc_id)
267static int fsl_pq_mdio_probe(struct of_device *ofdev, 267static int fsl_pq_mdio_probe(struct of_device *ofdev,
268 const struct of_device_id *match) 268 const struct of_device_id *match)
269{ 269{
270 struct device_node *np = ofdev->node; 270 struct device_node *np = ofdev->dev.of_node;
271 struct device_node *tbi; 271 struct device_node *tbi;
272 struct fsl_pq_mdio_priv *priv; 272 struct fsl_pq_mdio_priv *priv;
273 struct fsl_pq_mdio __iomem *regs = NULL; 273 struct fsl_pq_mdio __iomem *regs = NULL;
@@ -471,10 +471,13 @@ static struct of_device_id fsl_pq_mdio_match[] = {
471MODULE_DEVICE_TABLE(of, fsl_pq_mdio_match); 471MODULE_DEVICE_TABLE(of, fsl_pq_mdio_match);
472 472
473static struct of_platform_driver fsl_pq_mdio_driver = { 473static struct of_platform_driver fsl_pq_mdio_driver = {
474 .name = "fsl-pq_mdio", 474 .driver = {
475 .name = "fsl-pq_mdio",
476 .owner = THIS_MODULE,
477 .of_match_table = fsl_pq_mdio_match,
478 },
475 .probe = fsl_pq_mdio_probe, 479 .probe = fsl_pq_mdio_probe,
476 .remove = fsl_pq_mdio_remove, 480 .remove = fsl_pq_mdio_remove,
477 .match_table = fsl_pq_mdio_match,
478}; 481};
479 482
480int __init fsl_pq_mdio_init(void) 483int __init fsl_pq_mdio_init(void)
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index c6791cd4ee05..1830f3199cb5 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -608,7 +608,7 @@ static int gfar_of_init(struct of_device *ofdev, struct net_device **pdev)
608 int err = 0, i; 608 int err = 0, i;
609 struct net_device *dev = NULL; 609 struct net_device *dev = NULL;
610 struct gfar_private *priv = NULL; 610 struct gfar_private *priv = NULL;
611 struct device_node *np = ofdev->node; 611 struct device_node *np = ofdev->dev.of_node;
612 struct device_node *child = NULL; 612 struct device_node *child = NULL;
613 const u32 *stash; 613 const u32 *stash;
614 const u32 *stash_len; 614 const u32 *stash_len;
@@ -646,7 +646,7 @@ static int gfar_of_init(struct of_device *ofdev, struct net_device **pdev)
646 return -ENOMEM; 646 return -ENOMEM;
647 647
648 priv = netdev_priv(dev); 648 priv = netdev_priv(dev);
649 priv->node = ofdev->node; 649 priv->node = ofdev->dev.of_node;
650 priv->ndev = dev; 650 priv->ndev = dev;
651 651
652 dev->num_tx_queues = num_tx_qs; 652 dev->num_tx_queues = num_tx_qs;
@@ -939,7 +939,7 @@ static int gfar_probe(struct of_device *ofdev,
939 priv = netdev_priv(dev); 939 priv = netdev_priv(dev);
940 priv->ndev = dev; 940 priv->ndev = dev;
941 priv->ofdev = ofdev; 941 priv->ofdev = ofdev;
942 priv->node = ofdev->node; 942 priv->node = ofdev->dev.of_node;
943 SET_NETDEV_DEV(dev, &ofdev->dev); 943 SET_NETDEV_DEV(dev, &ofdev->dev);
944 944
945 spin_lock_init(&priv->bflock); 945 spin_lock_init(&priv->bflock);
@@ -3167,12 +3167,14 @@ MODULE_DEVICE_TABLE(of, gfar_match);
3167 3167
3168/* Structure for a device driver */ 3168/* Structure for a device driver */
3169static struct of_platform_driver gfar_driver = { 3169static struct of_platform_driver gfar_driver = {
3170 .name = "fsl-gianfar", 3170 .driver = {
3171 .match_table = gfar_match, 3171 .name = "fsl-gianfar",
3172 3172 .owner = THIS_MODULE,
3173 .pm = GFAR_PM_OPS,
3174 .of_match_table = gfar_match,
3175 },
3173 .probe = gfar_probe, 3176 .probe = gfar_probe,
3174 .remove = gfar_remove, 3177 .remove = gfar_remove,
3175 .driver.pm = GFAR_PM_OPS,
3176}; 3178};
3177 3179
3178static int __init gfar_init(void) 3180static int __init gfar_init(void)
diff --git a/drivers/net/greth.c b/drivers/net/greth.c
index fd491e409488..f37a4c143ddd 100644
--- a/drivers/net/greth.c
+++ b/drivers/net/greth.c
@@ -1499,7 +1499,8 @@ static int __devinit greth_of_probe(struct of_device *ofdev, const struct of_dev
1499 if (i == 6) { 1499 if (i == 6) {
1500 const unsigned char *addr; 1500 const unsigned char *addr;
1501 int len; 1501 int len;
1502 addr = of_get_property(ofdev->node, "local-mac-address", &len); 1502 addr = of_get_property(ofdev->dev.of_node, "local-mac-address",
1503 &len);
1503 if (addr != NULL && len == 6) { 1504 if (addr != NULL && len == 6) {
1504 for (i = 0; i < 6; i++) 1505 for (i = 0; i < 6; i++)
1505 macaddr[i] = (unsigned int) addr[i]; 1506 macaddr[i] = (unsigned int) addr[i];
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 2484e9e6c1ed..b150c102ca5a 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -136,7 +136,8 @@ static inline void emac_report_timeout_error(struct emac_instance *dev,
136 EMAC_FTR_440EP_PHY_CLK_FIX)) 136 EMAC_FTR_440EP_PHY_CLK_FIX))
137 DBG(dev, "%s" NL, error); 137 DBG(dev, "%s" NL, error);
138 else if (net_ratelimit()) 138 else if (net_ratelimit())
139 printk(KERN_ERR "%s: %s\n", dev->ofdev->node->full_name, error); 139 printk(KERN_ERR "%s: %s\n", dev->ofdev->dev.of_node->full_name,
140 error);
140} 141}
141 142
142/* EMAC PHY clock workaround: 143/* EMAC PHY clock workaround:
@@ -2185,7 +2186,7 @@ static void emac_ethtool_get_drvinfo(struct net_device *ndev,
2185 strcpy(info->version, DRV_VERSION); 2186 strcpy(info->version, DRV_VERSION);
2186 info->fw_version[0] = '\0'; 2187 info->fw_version[0] = '\0';
2187 sprintf(info->bus_info, "PPC 4xx EMAC-%d %s", 2188 sprintf(info->bus_info, "PPC 4xx EMAC-%d %s",
2188 dev->cell_index, dev->ofdev->node->full_name); 2189 dev->cell_index, dev->ofdev->dev.of_node->full_name);
2189 info->regdump_len = emac_ethtool_get_regs_len(ndev); 2190 info->regdump_len = emac_ethtool_get_regs_len(ndev);
2190} 2191}
2191 2192
@@ -2379,7 +2380,7 @@ static int __devinit emac_read_uint_prop(struct device_node *np, const char *nam
2379 2380
2380static int __devinit emac_init_phy(struct emac_instance *dev) 2381static int __devinit emac_init_phy(struct emac_instance *dev)
2381{ 2382{
2382 struct device_node *np = dev->ofdev->node; 2383 struct device_node *np = dev->ofdev->dev.of_node;
2383 struct net_device *ndev = dev->ndev; 2384 struct net_device *ndev = dev->ndev;
2384 u32 phy_map, adv; 2385 u32 phy_map, adv;
2385 int i; 2386 int i;
@@ -2514,7 +2515,7 @@ static int __devinit emac_init_phy(struct emac_instance *dev)
2514 2515
2515static int __devinit emac_init_config(struct emac_instance *dev) 2516static int __devinit emac_init_config(struct emac_instance *dev)
2516{ 2517{
2517 struct device_node *np = dev->ofdev->node; 2518 struct device_node *np = dev->ofdev->dev.of_node;
2518 const void *p; 2519 const void *p;
2519 unsigned int plen; 2520 unsigned int plen;
2520 const char *pm, *phy_modes[] = { 2521 const char *pm, *phy_modes[] = {
@@ -2723,7 +2724,7 @@ static int __devinit emac_probe(struct of_device *ofdev,
2723{ 2724{
2724 struct net_device *ndev; 2725 struct net_device *ndev;
2725 struct emac_instance *dev; 2726 struct emac_instance *dev;
2726 struct device_node *np = ofdev->node; 2727 struct device_node *np = ofdev->dev.of_node;
2727 struct device_node **blist = NULL; 2728 struct device_node **blist = NULL;
2728 int err, i; 2729 int err, i;
2729 2730
@@ -2810,7 +2811,7 @@ static int __devinit emac_probe(struct of_device *ofdev,
2810 err = mal_register_commac(dev->mal, &dev->commac); 2811 err = mal_register_commac(dev->mal, &dev->commac);
2811 if (err) { 2812 if (err) {
2812 printk(KERN_ERR "%s: failed to register with mal %s!\n", 2813 printk(KERN_ERR "%s: failed to register with mal %s!\n",
2813 np->full_name, dev->mal_dev->node->full_name); 2814 np->full_name, dev->mal_dev->dev.of_node->full_name);
2814 goto err_rel_deps; 2815 goto err_rel_deps;
2815 } 2816 }
2816 dev->rx_skb_size = emac_rx_skb_size(ndev->mtu); 2817 dev->rx_skb_size = emac_rx_skb_size(ndev->mtu);
@@ -2995,9 +2996,11 @@ static struct of_device_id emac_match[] =
2995MODULE_DEVICE_TABLE(of, emac_match); 2996MODULE_DEVICE_TABLE(of, emac_match);
2996 2997
2997static struct of_platform_driver emac_driver = { 2998static struct of_platform_driver emac_driver = {
2998 .name = "emac", 2999 .driver = {
2999 .match_table = emac_match, 3000 .name = "emac",
3000 3001 .owner = THIS_MODULE,
3002 .of_match_table = emac_match,
3003 },
3001 .probe = emac_probe, 3004 .probe = emac_probe,
3002 .remove = emac_remove, 3005 .remove = emac_remove,
3003}; 3006};
diff --git a/drivers/net/ibm_newemac/debug.c b/drivers/net/ibm_newemac/debug.c
index 775c850a425a..3995fafc1e08 100644
--- a/drivers/net/ibm_newemac/debug.c
+++ b/drivers/net/ibm_newemac/debug.c
@@ -33,7 +33,7 @@ static void emac_desc_dump(struct emac_instance *p)
33 int i; 33 int i;
34 printk("** EMAC %s TX BDs **\n" 34 printk("** EMAC %s TX BDs **\n"
35 " tx_cnt = %d tx_slot = %d ack_slot = %d\n", 35 " tx_cnt = %d tx_slot = %d ack_slot = %d\n",
36 p->ofdev->node->full_name, 36 p->ofdev->dev.of_node->full_name,
37 p->tx_cnt, p->tx_slot, p->ack_slot); 37 p->tx_cnt, p->tx_slot, p->ack_slot);
38 for (i = 0; i < NUM_TX_BUFF / 2; ++i) 38 for (i = 0; i < NUM_TX_BUFF / 2; ++i)
39 printk 39 printk
@@ -49,7 +49,7 @@ static void emac_desc_dump(struct emac_instance *p)
49 printk("** EMAC %s RX BDs **\n" 49 printk("** EMAC %s RX BDs **\n"
50 " rx_slot = %d flags = 0x%lx rx_skb_size = %d rx_sync_size = %d\n" 50 " rx_slot = %d flags = 0x%lx rx_skb_size = %d rx_sync_size = %d\n"
51 " rx_sg_skb = 0x%p\n", 51 " rx_sg_skb = 0x%p\n",
52 p->ofdev->node->full_name, 52 p->ofdev->dev.of_node->full_name,
53 p->rx_slot, p->commac.flags, p->rx_skb_size, 53 p->rx_slot, p->commac.flags, p->rx_skb_size,
54 p->rx_sync_size, p->rx_sg_skb); 54 p->rx_sync_size, p->rx_sg_skb);
55 for (i = 0; i < NUM_RX_BUFF / 2; ++i) 55 for (i = 0; i < NUM_RX_BUFF / 2; ++i)
@@ -77,7 +77,8 @@ static void emac_mac_dump(struct emac_instance *dev)
77 "MR0 = 0x%08x MR1 = 0x%08x TMR0 = 0x%08x TMR1 = 0x%08x\n" 77 "MR0 = 0x%08x MR1 = 0x%08x TMR0 = 0x%08x TMR1 = 0x%08x\n"
78 "RMR = 0x%08x ISR = 0x%08x ISER = 0x%08x\n" 78 "RMR = 0x%08x ISR = 0x%08x ISER = 0x%08x\n"
79 "IAR = %04x%08x VTPID = 0x%04x VTCI = 0x%04x\n", 79 "IAR = %04x%08x VTPID = 0x%04x VTCI = 0x%04x\n",
80 dev->ofdev->node->full_name, in_be32(&p->mr0), in_be32(&p->mr1), 80 dev->ofdev->dev.of_node->full_name,
81 in_be32(&p->mr0), in_be32(&p->mr1),
81 in_be32(&p->tmr0), in_be32(&p->tmr1), 82 in_be32(&p->tmr0), in_be32(&p->tmr1),
82 in_be32(&p->rmr), in_be32(&p->isr), in_be32(&p->iser), 83 in_be32(&p->rmr), in_be32(&p->isr), in_be32(&p->iser),
83 in_be32(&p->iahr), in_be32(&p->ialr), in_be32(&p->vtpid), 84 in_be32(&p->iahr), in_be32(&p->ialr), in_be32(&p->vtpid),
@@ -128,7 +129,7 @@ static void emac_mal_dump(struct mal_instance *mal)
128 "CFG = 0x%08x ESR = 0x%08x IER = 0x%08x\n" 129 "CFG = 0x%08x ESR = 0x%08x IER = 0x%08x\n"
129 "TX|CASR = 0x%08x CARR = 0x%08x EOBISR = 0x%08x DEIR = 0x%08x\n" 130 "TX|CASR = 0x%08x CARR = 0x%08x EOBISR = 0x%08x DEIR = 0x%08x\n"
130 "RX|CASR = 0x%08x CARR = 0x%08x EOBISR = 0x%08x DEIR = 0x%08x\n", 131 "RX|CASR = 0x%08x CARR = 0x%08x EOBISR = 0x%08x DEIR = 0x%08x\n",
131 mal->ofdev->node->full_name, 132 mal->ofdev->dev.of_node->full_name,
132 get_mal_dcrn(mal, MAL_CFG), get_mal_dcrn(mal, MAL_ESR), 133 get_mal_dcrn(mal, MAL_CFG), get_mal_dcrn(mal, MAL_ESR),
133 get_mal_dcrn(mal, MAL_IER), 134 get_mal_dcrn(mal, MAL_IER),
134 get_mal_dcrn(mal, MAL_TXCASR), get_mal_dcrn(mal, MAL_TXCARR), 135 get_mal_dcrn(mal, MAL_TXCASR), get_mal_dcrn(mal, MAL_TXCARR),
diff --git a/drivers/net/ibm_newemac/debug.h b/drivers/net/ibm_newemac/debug.h
index b631842ec8d0..e596c77ccdf7 100644
--- a/drivers/net/ibm_newemac/debug.h
+++ b/drivers/net/ibm_newemac/debug.h
@@ -53,8 +53,8 @@ extern void emac_dbg_dump_all(void);
53 53
54#endif 54#endif
55 55
56#define EMAC_DBG(dev, name, fmt, arg...) \ 56#define EMAC_DBG(d, name, fmt, arg...) \
57 printk(KERN_DEBUG #name "%s: " fmt, dev->ofdev->node->full_name, ## arg) 57 printk(KERN_DEBUG #name "%s: " fmt, d->ofdev->dev.of_node->full_name, ## arg)
58 58
59#if DBG_LEVEL > 0 59#if DBG_LEVEL > 0
60# define DBG(d,f,x...) EMAC_DBG(d, emac, f, ##x) 60# define DBG(d,f,x...) EMAC_DBG(d, emac, f, ##x)
diff --git a/drivers/net/ibm_newemac/mal.c b/drivers/net/ibm_newemac/mal.c
index 5b3d94419fe6..fcff9e0bd382 100644
--- a/drivers/net/ibm_newemac/mal.c
+++ b/drivers/net/ibm_newemac/mal.c
@@ -538,11 +538,11 @@ static int __devinit mal_probe(struct of_device *ofdev,
538 } 538 }
539 mal->index = index; 539 mal->index = index;
540 mal->ofdev = ofdev; 540 mal->ofdev = ofdev;
541 mal->version = of_device_is_compatible(ofdev->node, "ibm,mcmal2") ? 2 : 1; 541 mal->version = of_device_is_compatible(ofdev->dev.of_node, "ibm,mcmal2") ? 2 : 1;
542 542
543 MAL_DBG(mal, "probe" NL); 543 MAL_DBG(mal, "probe" NL);
544 544
545 prop = of_get_property(ofdev->node, "num-tx-chans", NULL); 545 prop = of_get_property(ofdev->dev.of_node, "num-tx-chans", NULL);
546 if (prop == NULL) { 546 if (prop == NULL) {
547 printk(KERN_ERR 547 printk(KERN_ERR
548 "mal%d: can't find MAL num-tx-chans property!\n", 548 "mal%d: can't find MAL num-tx-chans property!\n",
@@ -552,7 +552,7 @@ static int __devinit mal_probe(struct of_device *ofdev,
552 } 552 }
553 mal->num_tx_chans = prop[0]; 553 mal->num_tx_chans = prop[0];
554 554
555 prop = of_get_property(ofdev->node, "num-rx-chans", NULL); 555 prop = of_get_property(ofdev->dev.of_node, "num-rx-chans", NULL);
556 if (prop == NULL) { 556 if (prop == NULL) {
557 printk(KERN_ERR 557 printk(KERN_ERR
558 "mal%d: can't find MAL num-rx-chans property!\n", 558 "mal%d: can't find MAL num-rx-chans property!\n",
@@ -562,14 +562,14 @@ static int __devinit mal_probe(struct of_device *ofdev,
562 } 562 }
563 mal->num_rx_chans = prop[0]; 563 mal->num_rx_chans = prop[0];
564 564
565 dcr_base = dcr_resource_start(ofdev->node, 0); 565 dcr_base = dcr_resource_start(ofdev->dev.of_node, 0);
566 if (dcr_base == 0) { 566 if (dcr_base == 0) {
567 printk(KERN_ERR 567 printk(KERN_ERR
568 "mal%d: can't find DCR resource!\n", index); 568 "mal%d: can't find DCR resource!\n", index);
569 err = -ENODEV; 569 err = -ENODEV;
570 goto fail; 570 goto fail;
571 } 571 }
572 mal->dcr_host = dcr_map(ofdev->node, dcr_base, 0x100); 572 mal->dcr_host = dcr_map(ofdev->dev.of_node, dcr_base, 0x100);
573 if (!DCR_MAP_OK(mal->dcr_host)) { 573 if (!DCR_MAP_OK(mal->dcr_host)) {
574 printk(KERN_ERR 574 printk(KERN_ERR
575 "mal%d: failed to map DCRs !\n", index); 575 "mal%d: failed to map DCRs !\n", index);
@@ -577,28 +577,28 @@ static int __devinit mal_probe(struct of_device *ofdev,
577 goto fail; 577 goto fail;
578 } 578 }
579 579
580 if (of_device_is_compatible(ofdev->node, "ibm,mcmal-405ez")) { 580 if (of_device_is_compatible(ofdev->dev.of_node, "ibm,mcmal-405ez")) {
581#if defined(CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT) && \ 581#if defined(CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT) && \
582 defined(CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR) 582 defined(CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR)
583 mal->features |= (MAL_FTR_CLEAR_ICINTSTAT | 583 mal->features |= (MAL_FTR_CLEAR_ICINTSTAT |
584 MAL_FTR_COMMON_ERR_INT); 584 MAL_FTR_COMMON_ERR_INT);
585#else 585#else
586 printk(KERN_ERR "%s: Support for 405EZ not enabled!\n", 586 printk(KERN_ERR "%s: Support for 405EZ not enabled!\n",
587 ofdev->node->full_name); 587 ofdev->dev.of_node->full_name);
588 err = -ENODEV; 588 err = -ENODEV;
589 goto fail; 589 goto fail;
590#endif 590#endif
591 } 591 }
592 592
593 mal->txeob_irq = irq_of_parse_and_map(ofdev->node, 0); 593 mal->txeob_irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
594 mal->rxeob_irq = irq_of_parse_and_map(ofdev->node, 1); 594 mal->rxeob_irq = irq_of_parse_and_map(ofdev->dev.of_node, 1);
595 mal->serr_irq = irq_of_parse_and_map(ofdev->node, 2); 595 mal->serr_irq = irq_of_parse_and_map(ofdev->dev.of_node, 2);
596 596
597 if (mal_has_feature(mal, MAL_FTR_COMMON_ERR_INT)) { 597 if (mal_has_feature(mal, MAL_FTR_COMMON_ERR_INT)) {
598 mal->txde_irq = mal->rxde_irq = mal->serr_irq; 598 mal->txde_irq = mal->rxde_irq = mal->serr_irq;
599 } else { 599 } else {
600 mal->txde_irq = irq_of_parse_and_map(ofdev->node, 3); 600 mal->txde_irq = irq_of_parse_and_map(ofdev->dev.of_node, 3);
601 mal->rxde_irq = irq_of_parse_and_map(ofdev->node, 4); 601 mal->rxde_irq = irq_of_parse_and_map(ofdev->dev.of_node, 4);
602 } 602 }
603 603
604 if (mal->txeob_irq == NO_IRQ || mal->rxeob_irq == NO_IRQ || 604 if (mal->txeob_irq == NO_IRQ || mal->rxeob_irq == NO_IRQ ||
@@ -629,7 +629,7 @@ static int __devinit mal_probe(struct of_device *ofdev,
629 /* Current Axon is not happy with priority being non-0, it can 629 /* Current Axon is not happy with priority being non-0, it can
630 * deadlock, fix it up here 630 * deadlock, fix it up here
631 */ 631 */
632 if (of_device_is_compatible(ofdev->node, "ibm,mcmal-axon")) 632 if (of_device_is_compatible(ofdev->dev.of_node, "ibm,mcmal-axon"))
633 cfg &= ~(MAL2_CFG_RPP_10 | MAL2_CFG_WPP_10); 633 cfg &= ~(MAL2_CFG_RPP_10 | MAL2_CFG_WPP_10);
634 634
635 /* Apply configuration */ 635 /* Apply configuration */
@@ -701,7 +701,7 @@ static int __devinit mal_probe(struct of_device *ofdev,
701 701
702 printk(KERN_INFO 702 printk(KERN_INFO
703 "MAL v%d %s, %d TX channels, %d RX channels\n", 703 "MAL v%d %s, %d TX channels, %d RX channels\n",
704 mal->version, ofdev->node->full_name, 704 mal->version, ofdev->dev.of_node->full_name,
705 mal->num_tx_chans, mal->num_rx_chans); 705 mal->num_tx_chans, mal->num_rx_chans);
706 706
707 /* Advertise this instance to the rest of the world */ 707 /* Advertise this instance to the rest of the world */
@@ -790,9 +790,11 @@ static struct of_device_id mal_platform_match[] =
790}; 790};
791 791
792static struct of_platform_driver mal_of_driver = { 792static struct of_platform_driver mal_of_driver = {
793 .name = "mcmal", 793 .driver = {
794 .match_table = mal_platform_match, 794 .name = "mcmal",
795 795 .owner = THIS_MODULE,
796 .of_match_table = mal_platform_match,
797 },
796 .probe = mal_probe, 798 .probe = mal_probe,
797 .remove = mal_remove, 799 .remove = mal_remove,
798}; 800};
diff --git a/drivers/net/ibm_newemac/rgmii.c b/drivers/net/ibm_newemac/rgmii.c
index 5b90d34c8455..108919bcdf13 100644
--- a/drivers/net/ibm_newemac/rgmii.c
+++ b/drivers/net/ibm_newemac/rgmii.c
@@ -103,7 +103,7 @@ int __devinit rgmii_attach(struct of_device *ofdev, int input, int mode)
103 /* Check if we need to attach to a RGMII */ 103 /* Check if we need to attach to a RGMII */
104 if (input < 0 || !rgmii_valid_mode(mode)) { 104 if (input < 0 || !rgmii_valid_mode(mode)) {
105 printk(KERN_ERR "%s: unsupported settings !\n", 105 printk(KERN_ERR "%s: unsupported settings !\n",
106 ofdev->node->full_name); 106 ofdev->dev.of_node->full_name);
107 return -ENODEV; 107 return -ENODEV;
108 } 108 }
109 109
@@ -113,7 +113,7 @@ int __devinit rgmii_attach(struct of_device *ofdev, int input, int mode)
113 out_be32(&p->fer, in_be32(&p->fer) | rgmii_mode_mask(mode, input)); 113 out_be32(&p->fer, in_be32(&p->fer) | rgmii_mode_mask(mode, input));
114 114
115 printk(KERN_NOTICE "%s: input %d in %s mode\n", 115 printk(KERN_NOTICE "%s: input %d in %s mode\n",
116 ofdev->node->full_name, input, rgmii_mode_name(mode)); 116 ofdev->dev.of_node->full_name, input, rgmii_mode_name(mode));
117 117
118 ++dev->users; 118 ++dev->users;
119 119
@@ -231,7 +231,7 @@ void *rgmii_dump_regs(struct of_device *ofdev, void *buf)
231static int __devinit rgmii_probe(struct of_device *ofdev, 231static int __devinit rgmii_probe(struct of_device *ofdev,
232 const struct of_device_id *match) 232 const struct of_device_id *match)
233{ 233{
234 struct device_node *np = ofdev->node; 234 struct device_node *np = ofdev->dev.of_node;
235 struct rgmii_instance *dev; 235 struct rgmii_instance *dev;
236 struct resource regs; 236 struct resource regs;
237 int rc; 237 int rc;
@@ -264,11 +264,11 @@ static int __devinit rgmii_probe(struct of_device *ofdev,
264 } 264 }
265 265
266 /* Check for RGMII flags */ 266 /* Check for RGMII flags */
267 if (of_get_property(ofdev->node, "has-mdio", NULL)) 267 if (of_get_property(ofdev->dev.of_node, "has-mdio", NULL))
268 dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO; 268 dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO;
269 269
270 /* CAB lacks the right properties, fix this up */ 270 /* CAB lacks the right properties, fix this up */
271 if (of_device_is_compatible(ofdev->node, "ibm,rgmii-axon")) 271 if (of_device_is_compatible(ofdev->dev.of_node, "ibm,rgmii-axon"))
272 dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO; 272 dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO;
273 273
274 DBG2(dev, " Boot FER = 0x%08x, SSR = 0x%08x\n", 274 DBG2(dev, " Boot FER = 0x%08x, SSR = 0x%08x\n",
@@ -279,7 +279,7 @@ static int __devinit rgmii_probe(struct of_device *ofdev,
279 279
280 printk(KERN_INFO 280 printk(KERN_INFO
281 "RGMII %s initialized with%s MDIO support\n", 281 "RGMII %s initialized with%s MDIO support\n",
282 ofdev->node->full_name, 282 ofdev->dev.of_node->full_name,
283 (dev->flags & EMAC_RGMII_FLAG_HAS_MDIO) ? "" : "out"); 283 (dev->flags & EMAC_RGMII_FLAG_HAS_MDIO) ? "" : "out");
284 284
285 wmb(); 285 wmb();
@@ -319,9 +319,11 @@ static struct of_device_id rgmii_match[] =
319}; 319};
320 320
321static struct of_platform_driver rgmii_driver = { 321static struct of_platform_driver rgmii_driver = {
322 .name = "emac-rgmii", 322 .driver = {
323 .match_table = rgmii_match, 323 .name = "emac-rgmii",
324 324 .owner = THIS_MODULE,
325 .of_match_table = rgmii_match,
326 },
325 .probe = rgmii_probe, 327 .probe = rgmii_probe,
326 .remove = rgmii_remove, 328 .remove = rgmii_remove,
327}; 329};
diff --git a/drivers/net/ibm_newemac/tah.c b/drivers/net/ibm_newemac/tah.c
index 30173a9fb557..044637144c43 100644
--- a/drivers/net/ibm_newemac/tah.c
+++ b/drivers/net/ibm_newemac/tah.c
@@ -57,7 +57,8 @@ void tah_reset(struct of_device *ofdev)
57 --n; 57 --n;
58 58
59 if (unlikely(!n)) 59 if (unlikely(!n))
60 printk(KERN_ERR "%s: reset timeout\n", ofdev->node->full_name); 60 printk(KERN_ERR "%s: reset timeout\n",
61 ofdev->dev.of_node->full_name);
61 62
62 /* 10KB TAH TX FIFO accomodates the max MTU of 9000 */ 63 /* 10KB TAH TX FIFO accomodates the max MTU of 9000 */
63 out_be32(&p->mr, 64 out_be32(&p->mr,
@@ -89,7 +90,7 @@ void *tah_dump_regs(struct of_device *ofdev, void *buf)
89static int __devinit tah_probe(struct of_device *ofdev, 90static int __devinit tah_probe(struct of_device *ofdev,
90 const struct of_device_id *match) 91 const struct of_device_id *match)
91{ 92{
92 struct device_node *np = ofdev->node; 93 struct device_node *np = ofdev->dev.of_node;
93 struct tah_instance *dev; 94 struct tah_instance *dev;
94 struct resource regs; 95 struct resource regs;
95 int rc; 96 int rc;
@@ -127,7 +128,7 @@ static int __devinit tah_probe(struct of_device *ofdev,
127 tah_reset(ofdev); 128 tah_reset(ofdev);
128 129
129 printk(KERN_INFO 130 printk(KERN_INFO
130 "TAH %s initialized\n", ofdev->node->full_name); 131 "TAH %s initialized\n", ofdev->dev.of_node->full_name);
131 wmb(); 132 wmb();
132 133
133 return 0; 134 return 0;
@@ -165,9 +166,11 @@ static struct of_device_id tah_match[] =
165}; 166};
166 167
167static struct of_platform_driver tah_driver = { 168static struct of_platform_driver tah_driver = {
168 .name = "emac-tah", 169 .driver = {
169 .match_table = tah_match, 170 .name = "emac-tah",
170 171 .owner = THIS_MODULE,
172 .of_match_table = tah_match,
173 },
171 .probe = tah_probe, 174 .probe = tah_probe,
172 .remove = tah_remove, 175 .remove = tah_remove,
173}; 176};
diff --git a/drivers/net/ibm_newemac/zmii.c b/drivers/net/ibm_newemac/zmii.c
index 1f038f808ab3..046dcd069c45 100644
--- a/drivers/net/ibm_newemac/zmii.c
+++ b/drivers/net/ibm_newemac/zmii.c
@@ -121,13 +121,14 @@ int __devinit zmii_attach(struct of_device *ofdev, int input, int *mode)
121 dev->mode = *mode; 121 dev->mode = *mode;
122 122
123 printk(KERN_NOTICE "%s: bridge in %s mode\n", 123 printk(KERN_NOTICE "%s: bridge in %s mode\n",
124 ofdev->node->full_name, zmii_mode_name(dev->mode)); 124 ofdev->dev.of_node->full_name,
125 zmii_mode_name(dev->mode));
125 } else { 126 } else {
126 /* All inputs must use the same mode */ 127 /* All inputs must use the same mode */
127 if (*mode != PHY_MODE_NA && *mode != dev->mode) { 128 if (*mode != PHY_MODE_NA && *mode != dev->mode) {
128 printk(KERN_ERR 129 printk(KERN_ERR
129 "%s: invalid mode %d specified for input %d\n", 130 "%s: invalid mode %d specified for input %d\n",
130 ofdev->node->full_name, *mode, input); 131 ofdev->dev.of_node->full_name, *mode, input);
131 mutex_unlock(&dev->lock); 132 mutex_unlock(&dev->lock);
132 return -EINVAL; 133 return -EINVAL;
133 } 134 }
@@ -233,7 +234,7 @@ void *zmii_dump_regs(struct of_device *ofdev, void *buf)
233static int __devinit zmii_probe(struct of_device *ofdev, 234static int __devinit zmii_probe(struct of_device *ofdev,
234 const struct of_device_id *match) 235 const struct of_device_id *match)
235{ 236{
236 struct device_node *np = ofdev->node; 237 struct device_node *np = ofdev->dev.of_node;
237 struct zmii_instance *dev; 238 struct zmii_instance *dev;
238 struct resource regs; 239 struct resource regs;
239 int rc; 240 int rc;
@@ -273,7 +274,7 @@ static int __devinit zmii_probe(struct of_device *ofdev,
273 out_be32(&dev->base->fer, 0); 274 out_be32(&dev->base->fer, 0);
274 275
275 printk(KERN_INFO 276 printk(KERN_INFO
276 "ZMII %s initialized\n", ofdev->node->full_name); 277 "ZMII %s initialized\n", ofdev->dev.of_node->full_name);
277 wmb(); 278 wmb();
278 dev_set_drvdata(&ofdev->dev, dev); 279 dev_set_drvdata(&ofdev->dev, dev);
279 280
@@ -312,9 +313,11 @@ static struct of_device_id zmii_match[] =
312}; 313};
313 314
314static struct of_platform_driver zmii_driver = { 315static struct of_platform_driver zmii_driver = {
315 .name = "emac-zmii", 316 .driver = {
316 .match_table = zmii_match, 317 .name = "emac-zmii",
317 318 .owner = THIS_MODULE,
319 .of_match_table = zmii_match,
320 },
318 .probe = zmii_probe, 321 .probe = zmii_probe,
319 .remove = zmii_remove, 322 .remove = zmii_remove,
320}; 323};
diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c
index b59b24d667f0..fa7620e28404 100644
--- a/drivers/net/ll_temac_main.c
+++ b/drivers/net/ll_temac_main.c
@@ -920,14 +920,14 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
920 mutex_init(&lp->indirect_mutex); 920 mutex_init(&lp->indirect_mutex);
921 921
922 /* map device registers */ 922 /* map device registers */
923 lp->regs = of_iomap(op->node, 0); 923 lp->regs = of_iomap(op->dev.of_node, 0);
924 if (!lp->regs) { 924 if (!lp->regs) {
925 dev_err(&op->dev, "could not map temac regs.\n"); 925 dev_err(&op->dev, "could not map temac regs.\n");
926 goto nodev; 926 goto nodev;
927 } 927 }
928 928
929 /* Find the DMA node, map the DMA registers, and decode the DMA IRQs */ 929 /* Find the DMA node, map the DMA registers, and decode the DMA IRQs */
930 np = of_parse_phandle(op->node, "llink-connected", 0); 930 np = of_parse_phandle(op->dev.of_node, "llink-connected", 0);
931 if (!np) { 931 if (!np) {
932 dev_err(&op->dev, "could not find DMA node\n"); 932 dev_err(&op->dev, "could not find DMA node\n");
933 goto nodev; 933 goto nodev;
@@ -959,7 +959,7 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
959 of_node_put(np); /* Finished with the DMA node; drop the reference */ 959 of_node_put(np); /* Finished with the DMA node; drop the reference */
960 960
961 /* Retrieve the MAC address */ 961 /* Retrieve the MAC address */
962 addr = of_get_property(op->node, "local-mac-address", &size); 962 addr = of_get_property(op->dev.of_node, "local-mac-address", &size);
963 if ((!addr) || (size != 6)) { 963 if ((!addr) || (size != 6)) {
964 dev_err(&op->dev, "could not find MAC address\n"); 964 dev_err(&op->dev, "could not find MAC address\n");
965 rc = -ENODEV; 965 rc = -ENODEV;
@@ -967,11 +967,11 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
967 } 967 }
968 temac_set_mac_address(ndev, (void *)addr); 968 temac_set_mac_address(ndev, (void *)addr);
969 969
970 rc = temac_mdio_setup(lp, op->node); 970 rc = temac_mdio_setup(lp, op->dev.of_node);
971 if (rc) 971 if (rc)
972 dev_warn(&op->dev, "error registering MDIO bus\n"); 972 dev_warn(&op->dev, "error registering MDIO bus\n");
973 973
974 lp->phy_node = of_parse_phandle(op->node, "phy-handle", 0); 974 lp->phy_node = of_parse_phandle(op->dev.of_node, "phy-handle", 0);
975 if (lp->phy_node) 975 if (lp->phy_node)
976 dev_dbg(lp->dev, "using PHY node %s (%p)\n", np->full_name, np); 976 dev_dbg(lp->dev, "using PHY node %s (%p)\n", np->full_name, np);
977 977
@@ -1024,12 +1024,12 @@ static struct of_device_id temac_of_match[] __devinitdata = {
1024MODULE_DEVICE_TABLE(of, temac_of_match); 1024MODULE_DEVICE_TABLE(of, temac_of_match);
1025 1025
1026static struct of_platform_driver temac_of_driver = { 1026static struct of_platform_driver temac_of_driver = {
1027 .match_table = temac_of_match,
1028 .probe = temac_of_probe, 1027 .probe = temac_of_probe,
1029 .remove = __devexit_p(temac_of_remove), 1028 .remove = __devexit_p(temac_of_remove),
1030 .driver = { 1029 .driver = {
1031 .owner = THIS_MODULE, 1030 .owner = THIS_MODULE,
1032 .name = "xilinx_temac", 1031 .name = "xilinx_temac",
1032 .of_match_table = temac_of_match,
1033 }, 1033 },
1034}; 1034};
1035 1035
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c
index 3898108f98ce..1a57c3da1f49 100644
--- a/drivers/net/myri_sbus.c
+++ b/drivers/net/myri_sbus.c
@@ -928,7 +928,7 @@ static const struct net_device_ops myri_ops = {
928 928
929static int __devinit myri_sbus_probe(struct of_device *op, const struct of_device_id *match) 929static int __devinit myri_sbus_probe(struct of_device *op, const struct of_device_id *match)
930{ 930{
931 struct device_node *dp = op->node; 931 struct device_node *dp = op->dev.of_node;
932 static unsigned version_printed; 932 static unsigned version_printed;
933 struct net_device *dev; 933 struct net_device *dev;
934 struct myri_eth *mp; 934 struct myri_eth *mp;
@@ -1161,8 +1161,11 @@ static const struct of_device_id myri_sbus_match[] = {
1161MODULE_DEVICE_TABLE(of, myri_sbus_match); 1161MODULE_DEVICE_TABLE(of, myri_sbus_match);
1162 1162
1163static struct of_platform_driver myri_sbus_driver = { 1163static struct of_platform_driver myri_sbus_driver = {
1164 .name = "myri", 1164 .driver = {
1165 .match_table = myri_sbus_match, 1165 .name = "myri",
1166 .owner = THIS_MODULE,
1167 .of_match_table = myri_sbus_match,
1168 },
1166 .probe = myri_sbus_probe, 1169 .probe = myri_sbus_probe,
1167 .remove = __devexit_p(myri_sbus_remove), 1170 .remove = __devexit_p(myri_sbus_remove),
1168}; 1171};
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 30abb4e436f1..63e8e3893bd6 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -9115,7 +9115,7 @@ static int __devinit niu_n2_irq_init(struct niu *np, u8 *ldg_num_map)
9115 const u32 *int_prop; 9115 const u32 *int_prop;
9116 int i; 9116 int i;
9117 9117
9118 int_prop = of_get_property(op->node, "interrupts", NULL); 9118 int_prop = of_get_property(op->dev.of_node, "interrupts", NULL);
9119 if (!int_prop) 9119 if (!int_prop)
9120 return -ENODEV; 9120 return -ENODEV;
9121 9121
@@ -9266,7 +9266,7 @@ static int __devinit niu_get_of_props(struct niu *np)
9266 int prop_len; 9266 int prop_len;
9267 9267
9268 if (np->parent->plat_type == PLAT_TYPE_NIU) 9268 if (np->parent->plat_type == PLAT_TYPE_NIU)
9269 dp = np->op->node; 9269 dp = np->op->dev.of_node;
9270 else 9270 else
9271 dp = pci_device_to_OF_node(np->pdev); 9271 dp = pci_device_to_OF_node(np->pdev);
9272 9272
@@ -10083,10 +10083,10 @@ static int __devinit niu_of_probe(struct of_device *op,
10083 10083
10084 niu_driver_version(); 10084 niu_driver_version();
10085 10085
10086 reg = of_get_property(op->node, "reg", NULL); 10086 reg = of_get_property(op->dev.of_node, "reg", NULL);
10087 if (!reg) { 10087 if (!reg) {
10088 dev_err(&op->dev, "%s: No 'reg' property, aborting\n", 10088 dev_err(&op->dev, "%s: No 'reg' property, aborting\n",
10089 op->node->full_name); 10089 op->dev.of_node->full_name);
10090 return -ENODEV; 10090 return -ENODEV;
10091 } 10091 }
10092 10092
@@ -10099,7 +10099,7 @@ static int __devinit niu_of_probe(struct of_device *op,
10099 np = netdev_priv(dev); 10099 np = netdev_priv(dev);
10100 10100
10101 memset(&parent_id, 0, sizeof(parent_id)); 10101 memset(&parent_id, 0, sizeof(parent_id));
10102 parent_id.of = of_get_parent(op->node); 10102 parent_id.of = of_get_parent(op->dev.of_node);
10103 10103
10104 np->parent = niu_get_parent(np, &parent_id, 10104 np->parent = niu_get_parent(np, &parent_id,
10105 PLAT_TYPE_NIU); 10105 PLAT_TYPE_NIU);
@@ -10234,8 +10234,11 @@ static const struct of_device_id niu_match[] = {
10234MODULE_DEVICE_TABLE(of, niu_match); 10234MODULE_DEVICE_TABLE(of, niu_match);
10235 10235
10236static struct of_platform_driver niu_of_driver = { 10236static struct of_platform_driver niu_of_driver = {
10237 .name = "niu", 10237 .driver = {
10238 .match_table = niu_match, 10238 .name = "niu",
10239 .owner = THIS_MODULE,
10240 .of_match_table = niu_match,
10241 },
10239 .probe = niu_of_probe, 10242 .probe = niu_of_probe,
10240 .remove = __devexit_p(niu_of_remove), 10243 .remove = __devexit_p(niu_of_remove),
10241}; 10244};
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index 35897134a5dd..fc5fef2a8175 100644
--- a/drivers/net/phy/mdio-gpio.c
+++ b/drivers/net/phy/mdio-gpio.c
@@ -199,12 +199,12 @@ static int __devinit mdio_ofgpio_probe(struct of_device *ofdev,
199 if (!pdata) 199 if (!pdata)
200 return -ENOMEM; 200 return -ENOMEM;
201 201
202 ret = of_get_gpio(ofdev->node, 0); 202 ret = of_get_gpio(ofdev->dev.of_node, 0);
203 if (ret < 0) 203 if (ret < 0)
204 goto out_free; 204 goto out_free;
205 pdata->mdc = ret; 205 pdata->mdc = ret;
206 206
207 ret = of_get_gpio(ofdev->node, 1); 207 ret = of_get_gpio(ofdev->dev.of_node, 1);
208 if (ret < 0) 208 if (ret < 0)
209 goto out_free; 209 goto out_free;
210 pdata->mdio = ret; 210 pdata->mdio = ret;
@@ -213,7 +213,7 @@ static int __devinit mdio_ofgpio_probe(struct of_device *ofdev,
213 if (!new_bus) 213 if (!new_bus)
214 goto out_free; 214 goto out_free;
215 215
216 ret = of_mdiobus_register(new_bus, ofdev->node); 216 ret = of_mdiobus_register(new_bus, ofdev->dev.of_node);
217 if (ret) 217 if (ret)
218 mdio_gpio_bus_deinit(&ofdev->dev); 218 mdio_gpio_bus_deinit(&ofdev->dev);
219 219
@@ -241,8 +241,11 @@ static struct of_device_id mdio_ofgpio_match[] = {
241MODULE_DEVICE_TABLE(of, mdio_ofgpio_match); 241MODULE_DEVICE_TABLE(of, mdio_ofgpio_match);
242 242
243static struct of_platform_driver mdio_ofgpio_driver = { 243static struct of_platform_driver mdio_ofgpio_driver = {
244 .name = "mdio-gpio", 244 .driver = {
245 .match_table = mdio_ofgpio_match, 245 .name = "mdio-gpio",
246 .owner = THIS_MODULE,
247 .of_match_table = mdio_ofgpio_match,
248 },
246 .probe = mdio_ofgpio_probe, 249 .probe = mdio_ofgpio_probe,
247 .remove = __devexit_p(mdio_ofgpio_remove), 250 .remove = __devexit_p(mdio_ofgpio_remove),
248}; 251};
diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c
index 4591fe9bf0b9..367e96f317d4 100644
--- a/drivers/net/sunbmac.c
+++ b/drivers/net/sunbmac.c
@@ -1131,8 +1131,8 @@ static int __devinit bigmac_ether_init(struct of_device *op,
1131 goto fail_and_cleanup; 1131 goto fail_and_cleanup;
1132 1132
1133 /* Get supported SBUS burst sizes. */ 1133 /* Get supported SBUS burst sizes. */
1134 bsizes = of_getintprop_default(qec_op->node, "burst-sizes", 0xff); 1134 bsizes = of_getintprop_default(qec_op->dev.of_node, "burst-sizes", 0xff);
1135 bsizes_more = of_getintprop_default(qec_op->node, "burst-sizes", 0xff); 1135 bsizes_more = of_getintprop_default(qec_op->dev.of_node, "burst-sizes", 0xff);
1136 1136
1137 bsizes &= 0xff; 1137 bsizes &= 0xff;
1138 if (bsizes_more != 0xff) 1138 if (bsizes_more != 0xff)
@@ -1184,7 +1184,7 @@ static int __devinit bigmac_ether_init(struct of_device *op,
1184 } 1184 }
1185 1185
1186 /* Get the board revision of this BigMAC. */ 1186 /* Get the board revision of this BigMAC. */
1187 bp->board_rev = of_getintprop_default(bp->bigmac_op->node, 1187 bp->board_rev = of_getintprop_default(bp->bigmac_op->dev.of_node,
1188 "board-version", 1); 1188 "board-version", 1);
1189 1189
1190 /* Init auto-negotiation timer state. */ 1190 /* Init auto-negotiation timer state. */
@@ -1290,8 +1290,11 @@ static const struct of_device_id bigmac_sbus_match[] = {
1290MODULE_DEVICE_TABLE(of, bigmac_sbus_match); 1290MODULE_DEVICE_TABLE(of, bigmac_sbus_match);
1291 1291
1292static struct of_platform_driver bigmac_sbus_driver = { 1292static struct of_platform_driver bigmac_sbus_driver = {
1293 .name = "sunbmac", 1293 .driver = {
1294 .match_table = bigmac_sbus_match, 1294 .name = "sunbmac",
1295 .owner = THIS_MODULE,
1296 .of_match_table = bigmac_sbus_match,
1297 },
1295 .probe = bigmac_sbus_probe, 1298 .probe = bigmac_sbus_probe,
1296 .remove = __devexit_p(bigmac_sbus_remove), 1299 .remove = __devexit_p(bigmac_sbus_remove),
1297}; 1300};
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 915c5909c7a8..3d9650b8d38f 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -2481,7 +2481,7 @@ static void hme_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info
2481 else { 2481 else {
2482 const struct linux_prom_registers *regs; 2482 const struct linux_prom_registers *regs;
2483 struct of_device *op = hp->happy_dev; 2483 struct of_device *op = hp->happy_dev;
2484 regs = of_get_property(op->node, "regs", NULL); 2484 regs = of_get_property(op->dev.of_node, "regs", NULL);
2485 if (regs) 2485 if (regs)
2486 sprintf(info->bus_info, "SBUS:%d", 2486 sprintf(info->bus_info, "SBUS:%d",
2487 regs->which_io); 2487 regs->which_io);
@@ -2641,14 +2641,14 @@ static const struct net_device_ops hme_netdev_ops = {
2641#ifdef CONFIG_SBUS 2641#ifdef CONFIG_SBUS
2642static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe) 2642static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe)
2643{ 2643{
2644 struct device_node *dp = op->node, *sbus_dp; 2644 struct device_node *dp = op->dev.of_node, *sbus_dp;
2645 struct quattro *qp = NULL; 2645 struct quattro *qp = NULL;
2646 struct happy_meal *hp; 2646 struct happy_meal *hp;
2647 struct net_device *dev; 2647 struct net_device *dev;
2648 int i, qfe_slot = -1; 2648 int i, qfe_slot = -1;
2649 int err = -ENODEV; 2649 int err = -ENODEV;
2650 2650
2651 sbus_dp = to_of_device(op->dev.parent)->node; 2651 sbus_dp = to_of_device(op->dev.parent)->dev.of_node;
2652 2652
2653 /* We can match PCI devices too, do not accept those here. */ 2653 /* We can match PCI devices too, do not accept those here. */
2654 if (strcmp(sbus_dp->name, "sbus")) 2654 if (strcmp(sbus_dp->name, "sbus"))
@@ -3237,7 +3237,7 @@ static void happy_meal_pci_exit(void)
3237#ifdef CONFIG_SBUS 3237#ifdef CONFIG_SBUS
3238static int __devinit hme_sbus_probe(struct of_device *op, const struct of_device_id *match) 3238static int __devinit hme_sbus_probe(struct of_device *op, const struct of_device_id *match)
3239{ 3239{
3240 struct device_node *dp = op->node; 3240 struct device_node *dp = op->dev.of_node;
3241 const char *model = of_get_property(dp, "model", NULL); 3241 const char *model = of_get_property(dp, "model", NULL);
3242 int is_qfe = (match->data != NULL); 3242 int is_qfe = (match->data != NULL);
3243 3243
@@ -3291,8 +3291,11 @@ static const struct of_device_id hme_sbus_match[] = {
3291MODULE_DEVICE_TABLE(of, hme_sbus_match); 3291MODULE_DEVICE_TABLE(of, hme_sbus_match);
3292 3292
3293static struct of_platform_driver hme_sbus_driver = { 3293static struct of_platform_driver hme_sbus_driver = {
3294 .name = "hme", 3294 .driver = {
3295 .match_table = hme_sbus_match, 3295 .name = "hme",
3296 .owner = THIS_MODULE,
3297 .of_match_table = hme_sbus_match,
3298 },
3296 .probe = hme_sbus_probe, 3299 .probe = hme_sbus_probe,
3297 .remove = __devexit_p(hme_sbus_remove), 3300 .remove = __devexit_p(hme_sbus_remove),
3298}; 3301};
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c
index 386af7bbe678..7d9c33dd9d1a 100644
--- a/drivers/net/sunlance.c
+++ b/drivers/net/sunlance.c
@@ -1323,7 +1323,7 @@ static int __devinit sparc_lance_probe_one(struct of_device *op,
1323 struct of_device *ledma, 1323 struct of_device *ledma,
1324 struct of_device *lebuffer) 1324 struct of_device *lebuffer)
1325{ 1325{
1326 struct device_node *dp = op->node; 1326 struct device_node *dp = op->dev.of_node;
1327 static unsigned version_printed; 1327 static unsigned version_printed;
1328 struct lance_private *lp; 1328 struct lance_private *lp;
1329 struct net_device *dev; 1329 struct net_device *dev;
@@ -1410,7 +1410,7 @@ static int __devinit sparc_lance_probe_one(struct of_device *op,
1410 1410
1411 lp->burst_sizes = 0; 1411 lp->burst_sizes = 0;
1412 if (lp->ledma) { 1412 if (lp->ledma) {
1413 struct device_node *ledma_dp = ledma->node; 1413 struct device_node *ledma_dp = ledma->dev.of_node;
1414 struct device_node *sbus_dp; 1414 struct device_node *sbus_dp;
1415 unsigned int sbmask; 1415 unsigned int sbmask;
1416 const char *prop; 1416 const char *prop;
@@ -1506,7 +1506,7 @@ fail:
1506static int __devinit sunlance_sbus_probe(struct of_device *op, const struct of_device_id *match) 1506static int __devinit sunlance_sbus_probe(struct of_device *op, const struct of_device_id *match)
1507{ 1507{
1508 struct of_device *parent = to_of_device(op->dev.parent); 1508 struct of_device *parent = to_of_device(op->dev.parent);
1509 struct device_node *parent_dp = parent->node; 1509 struct device_node *parent_dp = parent->dev.of_node;
1510 int err; 1510 int err;
1511 1511
1512 if (!strcmp(parent_dp->name, "ledma")) { 1512 if (!strcmp(parent_dp->name, "ledma")) {
@@ -1545,8 +1545,11 @@ static const struct of_device_id sunlance_sbus_match[] = {
1545MODULE_DEVICE_TABLE(of, sunlance_sbus_match); 1545MODULE_DEVICE_TABLE(of, sunlance_sbus_match);
1546 1546
1547static struct of_platform_driver sunlance_sbus_driver = { 1547static struct of_platform_driver sunlance_sbus_driver = {
1548 .name = "sunlance", 1548 .driver = {
1549 .match_table = sunlance_sbus_match, 1549 .name = "sunlance",
1550 .owner = THIS_MODULE,
1551 .of_match_table = sunlance_sbus_match,
1552 },
1550 .probe = sunlance_sbus_probe, 1553 .probe = sunlance_sbus_probe,
1551 .remove = __devexit_p(sunlance_sbus_remove), 1554 .remove = __devexit_p(sunlance_sbus_remove),
1552}; 1555};
diff --git a/drivers/net/sunqe.c b/drivers/net/sunqe.c
index a7542d25c845..72b579c8d812 100644
--- a/drivers/net/sunqe.c
+++ b/drivers/net/sunqe.c
@@ -695,7 +695,7 @@ static void qe_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
695 strcpy(info->version, "3.0"); 695 strcpy(info->version, "3.0");
696 696
697 op = qep->op; 697 op = qep->op;
698 regs = of_get_property(op->node, "reg", NULL); 698 regs = of_get_property(op->dev.of_node, "reg", NULL);
699 if (regs) 699 if (regs)
700 sprintf(info->bus_info, "SBUS:%d", regs->which_io); 700 sprintf(info->bus_info, "SBUS:%d", regs->which_io);
701 701
@@ -799,7 +799,7 @@ static struct sunqec * __devinit get_qec(struct of_device *child)
799 if (qec_global_reset(qecp->gregs)) 799 if (qec_global_reset(qecp->gregs))
800 goto fail; 800 goto fail;
801 801
802 qecp->qec_bursts = qec_get_burst(op->node); 802 qecp->qec_bursts = qec_get_burst(op->dev.of_node);
803 803
804 qec_init_once(qecp, op); 804 qec_init_once(qecp, op);
805 805
@@ -857,7 +857,7 @@ static int __devinit qec_ether_init(struct of_device *op)
857 857
858 res = -ENODEV; 858 res = -ENODEV;
859 859
860 i = of_getintprop_default(op->node, "channel#", -1); 860 i = of_getintprop_default(op->dev.of_node, "channel#", -1);
861 if (i == -1) 861 if (i == -1)
862 goto fail; 862 goto fail;
863 qe->channel = i; 863 qe->channel = i;
@@ -977,8 +977,11 @@ static const struct of_device_id qec_sbus_match[] = {
977MODULE_DEVICE_TABLE(of, qec_sbus_match); 977MODULE_DEVICE_TABLE(of, qec_sbus_match);
978 978
979static struct of_platform_driver qec_sbus_driver = { 979static struct of_platform_driver qec_sbus_driver = {
980 .name = "qec", 980 .driver = {
981 .match_table = qec_sbus_match, 981 .name = "qec",
982 .owner = THIS_MODULE,
983 .of_match_table = qec_sbus_match,
984 },
982 .probe = qec_sbus_probe, 985 .probe = qec_sbus_probe,
983 .remove = __devexit_p(qec_sbus_remove), 986 .remove = __devexit_p(qec_sbus_remove),
984}; 987};
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 932602db54b3..4a34833b85dd 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3719,7 +3719,7 @@ static const struct net_device_ops ucc_geth_netdev_ops = {
3719static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *match) 3719static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *match)
3720{ 3720{
3721 struct device *device = &ofdev->dev; 3721 struct device *device = &ofdev->dev;
3722 struct device_node *np = ofdev->node; 3722 struct device_node *np = ofdev->dev.of_node;
3723 struct net_device *dev = NULL; 3723 struct net_device *dev = NULL;
3724 struct ucc_geth_private *ugeth = NULL; 3724 struct ucc_geth_private *ugeth = NULL;
3725 struct ucc_geth_info *ug_info; 3725 struct ucc_geth_info *ug_info;
@@ -3963,8 +3963,11 @@ static struct of_device_id ucc_geth_match[] = {
3963MODULE_DEVICE_TABLE(of, ucc_geth_match); 3963MODULE_DEVICE_TABLE(of, ucc_geth_match);
3964 3964
3965static struct of_platform_driver ucc_geth_driver = { 3965static struct of_platform_driver ucc_geth_driver = {
3966 .name = DRV_NAME, 3966 .driver = {
3967 .match_table = ucc_geth_match, 3967 .name = DRV_NAME,
3968 .owner = THIS_MODULE,
3969 .of_match_table = ucc_geth_match,
3970 },
3968 .probe = ucc_geth_probe, 3971 .probe = ucc_geth_probe,
3969 .remove = ucc_geth_remove, 3972 .remove = ucc_geth_remove,
3970 .suspend = ucc_geth_suspend, 3973 .suspend = ucc_geth_suspend,
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 893b552981a0..abfa0493236f 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -752,7 +752,6 @@ static int ath_key_config(struct ath_common *common,
752 struct ath_hw *ah = common->ah; 752 struct ath_hw *ah = common->ah;
753 struct ath9k_keyval hk; 753 struct ath9k_keyval hk;
754 const u8 *mac = NULL; 754 const u8 *mac = NULL;
755 u8 gmac[ETH_ALEN];
756 int ret = 0; 755 int ret = 0;
757 int idx; 756 int idx;
758 757
@@ -776,30 +775,9 @@ static int ath_key_config(struct ath_common *common,
776 memcpy(hk.kv_val, key->key, key->keylen); 775 memcpy(hk.kv_val, key->key, key->keylen);
777 776
778 if (!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { 777 if (!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) {
779 778 /* For now, use the default keys for broadcast keys. This may
780 if (key->ap_addr) { 779 * need to change with virtual interfaces. */
781 /* 780 idx = key->keyidx;
782 * Group keys on hardware that supports multicast frame
783 * key search use a mac that is the sender's address with
784 * the high bit set instead of the app-specified address.
785 */
786 memcpy(gmac, key->ap_addr, ETH_ALEN);
787 gmac[0] |= 0x80;
788 mac = gmac;
789
790 if (key->alg == ALG_TKIP)
791 idx = ath_reserve_key_cache_slot_tkip(common);
792 else
793 idx = ath_reserve_key_cache_slot(common);
794 if (idx < 0)
795 mac = NULL; /* no free key cache entries */
796 }
797
798 if (!mac) {
799 /* For now, use the default keys for broadcast keys. This may
800 * need to change with virtual interfaces. */
801 idx = key->keyidx;
802 }
803 } else if (key->keyidx) { 781 } else if (key->keyidx) {
804 if (WARN_ON(!sta)) 782 if (WARN_ON(!sta))
805 return -EOPNOTSUPP; 783 return -EOPNOTSUPP;
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index a7db68d37ee9..d04c5b262050 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -1088,7 +1088,7 @@ static void xemaclite_remove_ndev(struct net_device *ndev)
1088 */ 1088 */
1089static bool get_bool(struct of_device *ofdev, const char *s) 1089static bool get_bool(struct of_device *ofdev, const char *s)
1090{ 1090{
1091 u32 *p = (u32 *)of_get_property(ofdev->node, s, NULL); 1091 u32 *p = (u32 *)of_get_property(ofdev->dev.of_node, s, NULL);
1092 1092
1093 if (p) { 1093 if (p) {
1094 return (bool)*p; 1094 return (bool)*p;
@@ -1130,14 +1130,14 @@ static int __devinit xemaclite_of_probe(struct of_device *ofdev,
1130 dev_info(dev, "Device Tree Probing\n"); 1130 dev_info(dev, "Device Tree Probing\n");
1131 1131
1132 /* Get iospace for the device */ 1132 /* Get iospace for the device */
1133 rc = of_address_to_resource(ofdev->node, 0, &r_mem); 1133 rc = of_address_to_resource(ofdev->dev.of_node, 0, &r_mem);
1134 if (rc) { 1134 if (rc) {
1135 dev_err(dev, "invalid address\n"); 1135 dev_err(dev, "invalid address\n");
1136 return rc; 1136 return rc;
1137 } 1137 }
1138 1138
1139 /* Get IRQ for the device */ 1139 /* Get IRQ for the device */
1140 rc = of_irq_to_resource(ofdev->node, 0, &r_irq); 1140 rc = of_irq_to_resource(ofdev->dev.of_node, 0, &r_irq);
1141 if (rc == NO_IRQ) { 1141 if (rc == NO_IRQ) {
1142 dev_err(dev, "no IRQ found\n"); 1142 dev_err(dev, "no IRQ found\n");
1143 return rc; 1143 return rc;
@@ -1182,7 +1182,7 @@ static int __devinit xemaclite_of_probe(struct of_device *ofdev,
1182 lp->next_rx_buf_to_use = 0x0; 1182 lp->next_rx_buf_to_use = 0x0;
1183 lp->tx_ping_pong = get_bool(ofdev, "xlnx,tx-ping-pong"); 1183 lp->tx_ping_pong = get_bool(ofdev, "xlnx,tx-ping-pong");
1184 lp->rx_ping_pong = get_bool(ofdev, "xlnx,rx-ping-pong"); 1184 lp->rx_ping_pong = get_bool(ofdev, "xlnx,rx-ping-pong");
1185 mac_address = of_get_mac_address(ofdev->node); 1185 mac_address = of_get_mac_address(ofdev->dev.of_node);
1186 1186
1187 if (mac_address) 1187 if (mac_address)
1188 /* Set the MAC address. */ 1188 /* Set the MAC address. */
@@ -1197,7 +1197,7 @@ static int __devinit xemaclite_of_probe(struct of_device *ofdev,
1197 /* Set the MAC address in the EmacLite device */ 1197 /* Set the MAC address in the EmacLite device */
1198 xemaclite_update_address(lp, ndev->dev_addr); 1198 xemaclite_update_address(lp, ndev->dev_addr);
1199 1199
1200 lp->phy_node = of_parse_phandle(ofdev->node, "phy-handle", 0); 1200 lp->phy_node = of_parse_phandle(ofdev->dev.of_node, "phy-handle", 0);
1201 rc = xemaclite_mdio_setup(lp, &ofdev->dev); 1201 rc = xemaclite_mdio_setup(lp, &ofdev->dev);
1202 if (rc) 1202 if (rc)
1203 dev_warn(&ofdev->dev, "error registering MDIO bus\n"); 1203 dev_warn(&ofdev->dev, "error registering MDIO bus\n");
@@ -1291,8 +1291,11 @@ static struct of_device_id xemaclite_of_match[] __devinitdata = {
1291MODULE_DEVICE_TABLE(of, xemaclite_of_match); 1291MODULE_DEVICE_TABLE(of, xemaclite_of_match);
1292 1292
1293static struct of_platform_driver xemaclite_of_driver = { 1293static struct of_platform_driver xemaclite_of_driver = {
1294 .name = DRIVER_NAME, 1294 .driver = {
1295 .match_table = xemaclite_of_match, 1295 .name = DRIVER_NAME,
1296 .owner = THIS_MODULE,
1297 .of_match_table = xemaclite_of_match,
1298 },
1296 .probe = xemaclite_of_probe, 1299 .probe = xemaclite_of_probe,
1297 .remove = __devexit_p(xemaclite_of_remove), 1300 .remove = __devexit_p(xemaclite_of_remove),
1298}; 1301};
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 224ae6bc67b6..7d18f8e0b013 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -10,8 +10,7 @@
10#include <asm/errno.h> 10#include <asm/errno.h>
11 11
12/** 12/**
13 * of_match_device - Tell if an of_device structure has a matching 13 * of_match_device - Tell if a struct device matches an of_device_id list
14 * of_match structure
15 * @ids: array of of device match structures to search in 14 * @ids: array of of device match structures to search in
16 * @dev: the of device structure to match against 15 * @dev: the of device structure to match against
17 * 16 *
@@ -19,11 +18,11 @@
19 * system is in its list of supported devices. 18 * system is in its list of supported devices.
20 */ 19 */
21const struct of_device_id *of_match_device(const struct of_device_id *matches, 20const struct of_device_id *of_match_device(const struct of_device_id *matches,
22 const struct of_device *dev) 21 const struct device *dev)
23{ 22{
24 if (!dev->node) 23 if (!dev->of_node)
25 return NULL; 24 return NULL;
26 return of_match_node(matches, dev->node); 25 return of_match_node(matches, dev->of_node);
27} 26}
28EXPORT_SYMBOL(of_match_device); 27EXPORT_SYMBOL(of_match_device);
29 28
@@ -54,7 +53,7 @@ static ssize_t devspec_show(struct device *dev,
54 struct of_device *ofdev; 53 struct of_device *ofdev;
55 54
56 ofdev = to_of_device(dev); 55 ofdev = to_of_device(dev);
57 return sprintf(buf, "%s\n", ofdev->node->full_name); 56 return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name);
58} 57}
59 58
60static ssize_t name_show(struct device *dev, 59static ssize_t name_show(struct device *dev,
@@ -63,7 +62,7 @@ static ssize_t name_show(struct device *dev,
63 struct of_device *ofdev; 62 struct of_device *ofdev;
64 63
65 ofdev = to_of_device(dev); 64 ofdev = to_of_device(dev);
66 return sprintf(buf, "%s\n", ofdev->node->name); 65 return sprintf(buf, "%s\n", ofdev->dev.of_node->name);
67} 66}
68 67
69static ssize_t modalias_show(struct device *dev, 68static ssize_t modalias_show(struct device *dev,
@@ -97,14 +96,14 @@ void of_release_dev(struct device *dev)
97 struct of_device *ofdev; 96 struct of_device *ofdev;
98 97
99 ofdev = to_of_device(dev); 98 ofdev = to_of_device(dev);
100 of_node_put(ofdev->node); 99 of_node_put(ofdev->dev.of_node);
101 kfree(ofdev); 100 kfree(ofdev);
102} 101}
103EXPORT_SYMBOL(of_release_dev); 102EXPORT_SYMBOL(of_release_dev);
104 103
105int of_device_register(struct of_device *ofdev) 104int of_device_register(struct of_device *ofdev)
106{ 105{
107 BUG_ON(ofdev->node == NULL); 106 BUG_ON(ofdev->dev.of_node == NULL);
108 107
109 device_initialize(&ofdev->dev); 108 device_initialize(&ofdev->dev);
110 109
@@ -112,7 +111,7 @@ int of_device_register(struct of_device *ofdev)
112 * the parent. If there is no parent defined, set the node 111 * the parent. If there is no parent defined, set the node
113 * explicitly */ 112 * explicitly */
114 if (!ofdev->dev.parent) 113 if (!ofdev->dev.parent)
115 set_dev_node(&ofdev->dev, of_node_to_nid(ofdev->node)); 114 set_dev_node(&ofdev->dev, of_node_to_nid(ofdev->dev.of_node));
116 115
117 return device_add(&ofdev->dev); 116 return device_add(&ofdev->dev);
118} 117}
@@ -132,11 +131,11 @@ ssize_t of_device_get_modalias(struct of_device *ofdev,
132 ssize_t tsize, csize, repend; 131 ssize_t tsize, csize, repend;
133 132
134 /* Name & Type */ 133 /* Name & Type */
135 csize = snprintf(str, len, "of:N%sT%s", 134 csize = snprintf(str, len, "of:N%sT%s", ofdev->dev.of_node->name,
136 ofdev->node->name, ofdev->node->type); 135 ofdev->dev.of_node->type);
137 136
138 /* Get compatible property if any */ 137 /* Get compatible property if any */
139 compat = of_get_property(ofdev->node, "compatible", &cplen); 138 compat = of_get_property(ofdev->dev.of_node, "compatible", &cplen);
140 if (!compat) 139 if (!compat)
141 return csize; 140 return csize;
142 141
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index dee4fb56b094..b6987bba8556 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -556,6 +556,21 @@ void __init unflatten_device_tree(void)
556 556
557 pr_debug(" -> unflatten_device_tree()\n"); 557 pr_debug(" -> unflatten_device_tree()\n");
558 558
559 if (!initial_boot_params) {
560 pr_debug("No device tree pointer\n");
561 return;
562 }
563
564 pr_debug("Unflattening device tree:\n");
565 pr_debug("magic: %08x\n", be32_to_cpu(initial_boot_params->magic));
566 pr_debug("size: %08x\n", be32_to_cpu(initial_boot_params->totalsize));
567 pr_debug("version: %08x\n", be32_to_cpu(initial_boot_params->version));
568
569 if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
570 pr_err("Invalid device tree blob header\n");
571 return;
572 }
573
559 /* First pass, scan for size */ 574 /* First pass, scan for size */
560 start = ((unsigned long)initial_boot_params) + 575 start = ((unsigned long)initial_boot_params) +
561 be32_to_cpu(initial_boot_params->off_dt_struct); 576 be32_to_cpu(initial_boot_params->off_dt_struct);
diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
index a3a708e590d0..ab6522c8e4fe 100644
--- a/drivers/of/of_i2c.c
+++ b/drivers/of/of_i2c.c
@@ -42,7 +42,7 @@ void of_register_i2c_devices(struct i2c_adapter *adap,
42 42
43 info.addr = be32_to_cpup(addr); 43 info.addr = be32_to_cpup(addr);
44 44
45 dev_archdata_set_node(&dev_ad, node); 45 info.of_node = node;
46 info.archdata = &dev_ad; 46 info.archdata = &dev_ad;
47 47
48 request_module("%s", info.type); 48 request_module("%s", info.type);
@@ -68,7 +68,7 @@ EXPORT_SYMBOL(of_register_i2c_devices);
68 68
69static int of_dev_node_match(struct device *dev, void *data) 69static int of_dev_node_match(struct device *dev, void *data)
70{ 70{
71 return dev_archdata_get_node(&dev->archdata) == data; 71 return dev->of_node == data;
72} 72}
73 73
74/* must call put_device() when done with returned i2c_client device */ 74/* must call put_device() when done with returned i2c_client device */
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index b4748337223b..42a6715f8e84 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -79,7 +79,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
79 /* Associate the OF node with the device structure so it 79 /* Associate the OF node with the device structure so it
80 * can be looked up later */ 80 * can be looked up later */
81 of_node_get(child); 81 of_node_get(child);
82 dev_archdata_set_node(&phy->dev.archdata, child); 82 phy->dev.of_node = child;
83 83
84 /* All data is now stored in the phy struct; register it */ 84 /* All data is now stored in the phy struct; register it */
85 rc = phy_device_register(phy); 85 rc = phy_device_register(phy);
@@ -100,7 +100,7 @@ EXPORT_SYMBOL(of_mdiobus_register);
100/* Helper function for of_phy_find_device */ 100/* Helper function for of_phy_find_device */
101static int of_phy_match(struct device *dev, void *phy_np) 101static int of_phy_match(struct device *dev, void *phy_np)
102{ 102{
103 return dev_archdata_get_node(&dev->archdata) == phy_np; 103 return dev->of_node == phy_np;
104} 104}
105 105
106/** 106/**
@@ -166,7 +166,7 @@ struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
166 if (!dev->dev.parent) 166 if (!dev->dev.parent)
167 return NULL; 167 return NULL;
168 168
169 net_np = dev_archdata_get_node(&dev->dev.parent->archdata); 169 net_np = dev->dev.parent->of_node;
170 if (!net_np) 170 if (!net_np)
171 return NULL; 171 return NULL;
172 172
diff --git a/drivers/of/of_spi.c b/drivers/of/of_spi.c
index f65f48b98448..5fed7e3c7da3 100644
--- a/drivers/of/of_spi.c
+++ b/drivers/of/of_spi.c
@@ -79,7 +79,7 @@ void of_register_spi_devices(struct spi_master *master, struct device_node *np)
79 79
80 /* Store a pointer to the node in the device structure */ 80 /* Store a pointer to the node in the device structure */
81 of_node_get(nc); 81 of_node_get(nc);
82 spi->dev.archdata.of_node = nc; 82 spi->dev.of_node = nc;
83 83
84 /* Register the new device */ 84 /* Register the new device */
85 request_module(spi->modalias); 85 request_module(spi->modalias);
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index d58ade170c4b..7dacc1ebe91e 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -21,14 +21,12 @@ extern struct device_attribute of_platform_device_attrs[];
21 21
22static int of_platform_bus_match(struct device *dev, struct device_driver *drv) 22static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
23{ 23{
24 struct of_device *of_dev = to_of_device(dev); 24 const struct of_device_id *matches = drv->of_match_table;
25 struct of_platform_driver *of_drv = to_of_platform_driver(drv);
26 const struct of_device_id *matches = of_drv->match_table;
27 25
28 if (!matches) 26 if (!matches)
29 return 0; 27 return 0;
30 28
31 return of_match_device(matches, of_dev) != NULL; 29 return of_match_device(matches, dev) != NULL;
32} 30}
33 31
34static int of_platform_device_probe(struct device *dev) 32static int of_platform_device_probe(struct device *dev)
@@ -46,7 +44,7 @@ static int of_platform_device_probe(struct device *dev)
46 44
47 of_dev_get(of_dev); 45 of_dev_get(of_dev);
48 46
49 match = of_match_device(drv->match_table, of_dev); 47 match = of_match_device(drv->driver.of_match_table, dev);
50 if (match) 48 if (match)
51 error = drv->probe(of_dev, match); 49 error = drv->probe(of_dev, match);
52 if (error) 50 if (error)
@@ -386,11 +384,6 @@ int of_bus_type_init(struct bus_type *bus, const char *name)
386 384
387int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus) 385int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
388{ 386{
389 /* initialize common driver fields */
390 if (!drv->driver.name)
391 drv->driver.name = drv->name;
392 if (!drv->driver.owner)
393 drv->driver.owner = drv->owner;
394 drv->driver.bus = bus; 387 drv->driver.bus = bus;
395 388
396 /* register with core */ 389 /* register with core */
diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c
index 065f229580d5..9a5b4b894161 100644
--- a/drivers/parport/parport_sunbpp.c
+++ b/drivers/parport/parport_sunbpp.c
@@ -382,8 +382,11 @@ static const struct of_device_id bpp_match[] = {
382MODULE_DEVICE_TABLE(of, bpp_match); 382MODULE_DEVICE_TABLE(of, bpp_match);
383 383
384static struct of_platform_driver bpp_sbus_driver = { 384static struct of_platform_driver bpp_sbus_driver = {
385 .name = "bpp", 385 .driver = {
386 .match_table = bpp_match, 386 .name = "bpp",
387 .owner = THIS_MODULE,
388 .of_match_table = bpp_match,
389 },
387 .probe = bpp_probe, 390 .probe = bpp_probe,
388 .remove = __devexit_p(bpp_remove), 391 .remove = __devexit_p(bpp_remove),
389}; 392};
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c
index 2e59fe947d28..f94d8281cfb0 100644
--- a/drivers/pcmcia/electra_cf.c
+++ b/drivers/pcmcia/electra_cf.c
@@ -185,7 +185,7 @@ static int __devinit electra_cf_probe(struct of_device *ofdev,
185 const struct of_device_id *match) 185 const struct of_device_id *match)
186{ 186{
187 struct device *device = &ofdev->dev; 187 struct device *device = &ofdev->dev;
188 struct device_node *np = ofdev->node; 188 struct device_node *np = ofdev->dev.of_node;
189 struct electra_cf_socket *cf; 189 struct electra_cf_socket *cf;
190 struct resource mem, io; 190 struct resource mem, io;
191 int status; 191 int status;
@@ -357,8 +357,11 @@ static const struct of_device_id electra_cf_match[] = {
357MODULE_DEVICE_TABLE(of, electra_cf_match); 357MODULE_DEVICE_TABLE(of, electra_cf_match);
358 358
359static struct of_platform_driver electra_cf_driver = { 359static struct of_platform_driver electra_cf_driver = {
360 .name = (char *)driver_name, 360 .driver = {
361 .match_table = electra_cf_match, 361 .name = (char *)driver_name,
362 .owner = THIS_MODULE,
363 .of_match_table = electra_cf_match,
364 },
362 .probe = electra_cf_probe, 365 .probe = electra_cf_probe,
363 .remove = electra_cf_remove, 366 .remove = electra_cf_remove,
364}; 367};
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index 41cc954a5ffe..1a648b90b634 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -1298,8 +1298,11 @@ static const struct of_device_id m8xx_pcmcia_match[] = {
1298MODULE_DEVICE_TABLE(of, m8xx_pcmcia_match); 1298MODULE_DEVICE_TABLE(of, m8xx_pcmcia_match);
1299 1299
1300static struct of_platform_driver m8xx_pcmcia_driver = { 1300static struct of_platform_driver m8xx_pcmcia_driver = {
1301 .name = driver_name, 1301 .driver = {
1302 .match_table = m8xx_pcmcia_match, 1302 .name = driver_name,
1303 .owner = THIS_MODULE,
1304 .match_table = m8xx_pcmcia_match,
1305 },
1303 .probe = m8xx_probe, 1306 .probe = m8xx_probe,
1304 .remove = m8xx_remove, 1307 .remove = m8xx_remove,
1305}; 1308};
diff --git a/drivers/sbus/char/bbc_envctrl.c b/drivers/sbus/char/bbc_envctrl.c
index b4951eb0358e..103fdf6b0b89 100644
--- a/drivers/sbus/char/bbc_envctrl.c
+++ b/drivers/sbus/char/bbc_envctrl.c
@@ -565,9 +565,9 @@ int bbc_envctrl_init(struct bbc_i2c_bus *bp)
565 int devidx = 0; 565 int devidx = 0;
566 566
567 while ((op = bbc_i2c_getdev(bp, devidx++)) != NULL) { 567 while ((op = bbc_i2c_getdev(bp, devidx++)) != NULL) {
568 if (!strcmp(op->node->name, "temperature")) 568 if (!strcmp(op->dev.of_node->name, "temperature"))
569 attach_one_temp(bp, op, temp_index++); 569 attach_one_temp(bp, op, temp_index++);
570 if (!strcmp(op->node->name, "fan-control")) 570 if (!strcmp(op->dev.of_node->name, "fan-control"))
571 attach_one_fan(bp, op, fan_index++); 571 attach_one_fan(bp, op, fan_index++);
572 } 572 }
573 if (temp_index != 0 && fan_index != 0) { 573 if (temp_index != 0 && fan_index != 0) {
diff --git a/drivers/sbus/char/bbc_i2c.c b/drivers/sbus/char/bbc_i2c.c
index 7e30e5f6e032..8bfdd63a1fcb 100644
--- a/drivers/sbus/char/bbc_i2c.c
+++ b/drivers/sbus/char/bbc_i2c.c
@@ -97,7 +97,7 @@ struct bbc_i2c_client *bbc_i2c_attach(struct bbc_i2c_bus *bp, struct of_device *
97 client->bp = bp; 97 client->bp = bp;
98 client->op = op; 98 client->op = op;
99 99
100 reg = of_get_property(op->node, "reg", NULL); 100 reg = of_get_property(op->dev.of_node, "reg", NULL);
101 if (!reg) { 101 if (!reg) {
102 kfree(client); 102 kfree(client);
103 return NULL; 103 return NULL;
@@ -327,7 +327,7 @@ static struct bbc_i2c_bus * __init attach_one_i2c(struct of_device *op, int inde
327 spin_lock_init(&bp->lock); 327 spin_lock_init(&bp->lock);
328 328
329 entry = 0; 329 entry = 0;
330 for (dp = op->node->child; 330 for (dp = op->dev.of_node->child;
331 dp && entry < 8; 331 dp && entry < 8;
332 dp = dp->sibling, entry++) { 332 dp = dp->sibling, entry++) {
333 struct of_device *child_op; 333 struct of_device *child_op;
@@ -414,8 +414,11 @@ static const struct of_device_id bbc_i2c_match[] = {
414MODULE_DEVICE_TABLE(of, bbc_i2c_match); 414MODULE_DEVICE_TABLE(of, bbc_i2c_match);
415 415
416static struct of_platform_driver bbc_i2c_driver = { 416static struct of_platform_driver bbc_i2c_driver = {
417 .name = "bbc_i2c", 417 .driver = {
418 .match_table = bbc_i2c_match, 418 .name = "bbc_i2c",
419 .owner = THIS_MODULE,
420 .of_match_table = bbc_i2c_match,
421 },
419 .probe = bbc_i2c_probe, 422 .probe = bbc_i2c_probe,
420 .remove = __devexit_p(bbc_i2c_remove), 423 .remove = __devexit_p(bbc_i2c_remove),
421}; 424};
diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c
index 3e59189f4137..7baf1b644039 100644
--- a/drivers/sbus/char/display7seg.c
+++ b/drivers/sbus/char/display7seg.c
@@ -216,7 +216,7 @@ static int __devinit d7s_probe(struct of_device *op,
216 writeb(regs, p->regs); 216 writeb(regs, p->regs);
217 217
218 printk(KERN_INFO PFX "7-Segment Display%s at [%s:0x%llx] %s\n", 218 printk(KERN_INFO PFX "7-Segment Display%s at [%s:0x%llx] %s\n",
219 op->node->full_name, 219 op->dev.of_node->full_name,
220 (regs & D7S_FLIP) ? " (FLIPPED)" : "", 220 (regs & D7S_FLIP) ? " (FLIPPED)" : "",
221 op->resource[0].start, 221 op->resource[0].start,
222 sol_compat ? "in sol_compat mode" : ""); 222 sol_compat ? "in sol_compat mode" : "");
@@ -266,8 +266,11 @@ static const struct of_device_id d7s_match[] = {
266MODULE_DEVICE_TABLE(of, d7s_match); 266MODULE_DEVICE_TABLE(of, d7s_match);
267 267
268static struct of_platform_driver d7s_driver = { 268static struct of_platform_driver d7s_driver = {
269 .name = DRIVER_NAME, 269 .driver = {
270 .match_table = d7s_match, 270 .name = DRIVER_NAME,
271 .owner = THIS_MODULE,
272 .of_match_table = d7s_match,
273 },
271 .probe = d7s_probe, 274 .probe = d7s_probe,
272 .remove = __devexit_p(d7s_remove), 275 .remove = __devexit_p(d7s_remove),
273}; 276};
diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c
index c6e2eff19409..c8166ecf5276 100644
--- a/drivers/sbus/char/envctrl.c
+++ b/drivers/sbus/char/envctrl.c
@@ -1043,7 +1043,7 @@ static int __devinit envctrl_probe(struct of_device *op,
1043 return -ENOMEM; 1043 return -ENOMEM;
1044 1044
1045 index = 0; 1045 index = 0;
1046 dp = op->node->child; 1046 dp = op->dev.of_node->child;
1047 while (dp) { 1047 while (dp) {
1048 if (!strcmp(dp->name, "gpio")) { 1048 if (!strcmp(dp->name, "gpio")) {
1049 i2c_childlist[index].i2ctype = I2C_GPIO; 1049 i2c_childlist[index].i2ctype = I2C_GPIO;
@@ -1131,8 +1131,11 @@ static const struct of_device_id envctrl_match[] = {
1131MODULE_DEVICE_TABLE(of, envctrl_match); 1131MODULE_DEVICE_TABLE(of, envctrl_match);
1132 1132
1133static struct of_platform_driver envctrl_driver = { 1133static struct of_platform_driver envctrl_driver = {
1134 .name = DRIVER_NAME, 1134 .driver = {
1135 .match_table = envctrl_match, 1135 .name = DRIVER_NAME,
1136 .owner = THIS_MODULE,
1137 .of_match_table = envctrl_match,
1138 },
1136 .probe = envctrl_probe, 1139 .probe = envctrl_probe,
1137 .remove = __devexit_p(envctrl_remove), 1140 .remove = __devexit_p(envctrl_remove),
1138}; 1141};
diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c
index d3b62eb0fba7..368d66294d83 100644
--- a/drivers/sbus/char/flash.c
+++ b/drivers/sbus/char/flash.c
@@ -162,7 +162,7 @@ static struct miscdevice flash_dev = { FLASH_MINOR, "flash", &flash_fops };
162static int __devinit flash_probe(struct of_device *op, 162static int __devinit flash_probe(struct of_device *op,
163 const struct of_device_id *match) 163 const struct of_device_id *match)
164{ 164{
165 struct device_node *dp = op->node; 165 struct device_node *dp = op->dev.of_node;
166 struct device_node *parent; 166 struct device_node *parent;
167 167
168 parent = dp->parent; 168 parent = dp->parent;
@@ -184,7 +184,7 @@ static int __devinit flash_probe(struct of_device *op,
184 flash.busy = 0; 184 flash.busy = 0;
185 185
186 printk(KERN_INFO "%s: OBP Flash, RD %lx[%lx] WR %lx[%lx]\n", 186 printk(KERN_INFO "%s: OBP Flash, RD %lx[%lx] WR %lx[%lx]\n",
187 op->node->full_name, 187 op->dev.of_node->full_name,
188 flash.read_base, flash.read_size, 188 flash.read_base, flash.read_size,
189 flash.write_base, flash.write_size); 189 flash.write_base, flash.write_size);
190 190
@@ -207,8 +207,11 @@ static const struct of_device_id flash_match[] = {
207MODULE_DEVICE_TABLE(of, flash_match); 207MODULE_DEVICE_TABLE(of, flash_match);
208 208
209static struct of_platform_driver flash_driver = { 209static struct of_platform_driver flash_driver = {
210 .name = "flash", 210 .driver = {
211 .match_table = flash_match, 211 .name = "flash",
212 .owner = THIS_MODULE,
213 .of_match_table = flash_match,
214 },
212 .probe = flash_probe, 215 .probe = flash_probe,
213 .remove = __devexit_p(flash_remove), 216 .remove = __devexit_p(flash_remove),
214}; 217};
diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c
index 2c56fd56ec63..5f253665a1da 100644
--- a/drivers/sbus/char/uctrl.c
+++ b/drivers/sbus/char/uctrl.c
@@ -382,7 +382,7 @@ static int __devinit uctrl_probe(struct of_device *op,
382 382
383 sbus_writel(UCTRL_INTR_RXNE_REQ|UCTRL_INTR_RXNE_MSK, &p->regs->uctrl_intr); 383 sbus_writel(UCTRL_INTR_RXNE_REQ|UCTRL_INTR_RXNE_MSK, &p->regs->uctrl_intr);
384 printk(KERN_INFO "%s: uctrl regs[0x%p] (irq %d)\n", 384 printk(KERN_INFO "%s: uctrl regs[0x%p] (irq %d)\n",
385 op->node->full_name, p->regs, p->irq); 385 op->dev.of_node->full_name, p->regs, p->irq);
386 uctrl_get_event_status(p); 386 uctrl_get_event_status(p);
387 uctrl_get_external_status(p); 387 uctrl_get_external_status(p);
388 388
@@ -425,8 +425,11 @@ static const struct of_device_id uctrl_match[] = {
425MODULE_DEVICE_TABLE(of, uctrl_match); 425MODULE_DEVICE_TABLE(of, uctrl_match);
426 426
427static struct of_platform_driver uctrl_driver = { 427static struct of_platform_driver uctrl_driver = {
428 .name = "uctrl", 428 .driver = {
429 .match_table = uctrl_match, 429 .name = "uctrl",
430 .owner = THIS_MODULE,
431 .of_match_table = uctrl_match,
432 },
430 .probe = uctrl_probe, 433 .probe = uctrl_probe,
431 .remove = __devexit_p(uctrl_remove), 434 .remove = __devexit_p(uctrl_remove),
432}; 435};
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 3eb2b7b3d8b0..fef49521cbc3 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -1157,7 +1157,7 @@ static void ibmvfc_gather_partition_info(struct ibmvfc_host *vhost)
1157static void ibmvfc_set_login_info(struct ibmvfc_host *vhost) 1157static void ibmvfc_set_login_info(struct ibmvfc_host *vhost)
1158{ 1158{
1159 struct ibmvfc_npiv_login *login_info = &vhost->login_info; 1159 struct ibmvfc_npiv_login *login_info = &vhost->login_info;
1160 struct device_node *of_node = vhost->dev->archdata.of_node; 1160 struct device_node *of_node = vhost->dev->of_node;
1161 const char *location; 1161 const char *location;
1162 1162
1163 memset(login_info, 0, sizeof(*login_info)); 1163 memset(login_info, 0, sizeof(*login_info));
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 88bad0e81bdd..aad35cc41e49 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -932,7 +932,7 @@ static void send_mad_capabilities(struct ibmvscsi_host_data *hostdata)
932 struct viosrp_capabilities *req; 932 struct viosrp_capabilities *req;
933 struct srp_event_struct *evt_struct; 933 struct srp_event_struct *evt_struct;
934 unsigned long flags; 934 unsigned long flags;
935 struct device_node *of_node = hostdata->dev->archdata.of_node; 935 struct device_node *of_node = hostdata->dev->of_node;
936 const char *location; 936 const char *location;
937 937
938 evt_struct = get_event_struct(&hostdata->pool); 938 evt_struct = get_event_struct(&hostdata->pool);
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index aa406497eebc..ca5c15c779cf 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -755,7 +755,7 @@ static void __devinit qpti_get_scsi_id(struct qlogicpti *qpti)
755 struct of_device *op = qpti->op; 755 struct of_device *op = qpti->op;
756 struct device_node *dp; 756 struct device_node *dp;
757 757
758 dp = op->node; 758 dp = op->dev.of_node;
759 759
760 qpti->scsi_id = of_getintprop_default(dp, "initiator-id", -1); 760 qpti->scsi_id = of_getintprop_default(dp, "initiator-id", -1);
761 if (qpti->scsi_id == -1) 761 if (qpti->scsi_id == -1)
@@ -776,8 +776,8 @@ static void qpti_get_bursts(struct qlogicpti *qpti)
776 struct of_device *op = qpti->op; 776 struct of_device *op = qpti->op;
777 u8 bursts, bmask; 777 u8 bursts, bmask;
778 778
779 bursts = of_getintprop_default(op->node, "burst-sizes", 0xff); 779 bursts = of_getintprop_default(op->dev.of_node, "burst-sizes", 0xff);
780 bmask = of_getintprop_default(op->node->parent, "burst-sizes", 0xff); 780 bmask = of_getintprop_default(op->dev.of_node->parent, "burst-sizes", 0xff);
781 if (bmask != 0xff) 781 if (bmask != 0xff)
782 bursts &= bmask; 782 bursts &= bmask;
783 if (bursts == 0xff || 783 if (bursts == 0xff ||
@@ -1293,7 +1293,7 @@ static struct scsi_host_template qpti_template = {
1293static int __devinit qpti_sbus_probe(struct of_device *op, const struct of_device_id *match) 1293static int __devinit qpti_sbus_probe(struct of_device *op, const struct of_device_id *match)
1294{ 1294{
1295 struct scsi_host_template *tpnt = match->data; 1295 struct scsi_host_template *tpnt = match->data;
1296 struct device_node *dp = op->node; 1296 struct device_node *dp = op->dev.of_node;
1297 struct Scsi_Host *host; 1297 struct Scsi_Host *host;
1298 struct qlogicpti *qpti; 1298 struct qlogicpti *qpti;
1299 static int nqptis; 1299 static int nqptis;
@@ -1315,7 +1315,7 @@ static int __devinit qpti_sbus_probe(struct of_device *op, const struct of_devic
1315 qpti->qhost = host; 1315 qpti->qhost = host;
1316 qpti->op = op; 1316 qpti->op = op;
1317 qpti->qpti_id = nqptis; 1317 qpti->qpti_id = nqptis;
1318 strcpy(qpti->prom_name, op->node->name); 1318 strcpy(qpti->prom_name, op->dev.of_node->name);
1319 qpti->is_pti = strcmp(qpti->prom_name, "QLGC,isp"); 1319 qpti->is_pti = strcmp(qpti->prom_name, "QLGC,isp");
1320 1320
1321 if (qpti_map_regs(qpti) < 0) 1321 if (qpti_map_regs(qpti) < 0)
@@ -1456,8 +1456,11 @@ static const struct of_device_id qpti_match[] = {
1456MODULE_DEVICE_TABLE(of, qpti_match); 1456MODULE_DEVICE_TABLE(of, qpti_match);
1457 1457
1458static struct of_platform_driver qpti_sbus_driver = { 1458static struct of_platform_driver qpti_sbus_driver = {
1459 .name = "qpti", 1459 .driver = {
1460 .match_table = qpti_match, 1460 .name = "qpti",
1461 .owner = THIS_MODULE,
1462 .of_match_table = qpti_match,
1463 },
1461 .probe = qpti_sbus_probe, 1464 .probe = qpti_sbus_probe,
1462 .remove = __devexit_p(qpti_sbus_remove), 1465 .remove = __devexit_p(qpti_sbus_remove),
1463}; 1466};
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index c992ecf4e372..9798c2c06b93 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1220,7 +1220,7 @@ static void scsi_sequential_lun_scan(struct scsi_target *starget,
1220} 1220}
1221 1221
1222/** 1222/**
1223 * scsilun_to_int: convert a scsi_lun to an int 1223 * scsilun_to_int - convert a scsi_lun to an int
1224 * @scsilun: struct scsi_lun to be converted. 1224 * @scsilun: struct scsi_lun to be converted.
1225 * 1225 *
1226 * Description: 1226 * Description:
@@ -1252,7 +1252,7 @@ int scsilun_to_int(struct scsi_lun *scsilun)
1252EXPORT_SYMBOL(scsilun_to_int); 1252EXPORT_SYMBOL(scsilun_to_int);
1253 1253
1254/** 1254/**
1255 * int_to_scsilun: reverts an int into a scsi_lun 1255 * int_to_scsilun - reverts an int into a scsi_lun
1256 * @lun: integer to be reverted 1256 * @lun: integer to be reverted
1257 * @scsilun: struct scsi_lun to be set. 1257 * @scsilun: struct scsi_lun to be set.
1258 * 1258 *
@@ -1876,12 +1876,9 @@ void scsi_forget_host(struct Scsi_Host *shost)
1876 spin_unlock_irqrestore(shost->host_lock, flags); 1876 spin_unlock_irqrestore(shost->host_lock, flags);
1877} 1877}
1878 1878
1879/* 1879/**
1880 * Function: scsi_get_host_dev() 1880 * scsi_get_host_dev - Create a scsi_device that points to the host adapter itself
1881 * 1881 * @shost: Host that needs a scsi_device
1882 * Purpose: Create a scsi_device that points to the host adapter itself.
1883 *
1884 * Arguments: SHpnt - Host that needs a scsi_device
1885 * 1882 *
1886 * Lock status: None assumed. 1883 * Lock status: None assumed.
1887 * 1884 *
@@ -1894,7 +1891,7 @@ void scsi_forget_host(struct Scsi_Host *shost)
1894 * 1891 *
1895 * Note - this device is not accessible from any high-level 1892 * Note - this device is not accessible from any high-level
1896 * drivers (including generics), which is probably not 1893 * drivers (including generics), which is probably not
1897 * optimal. We can add hooks later to attach 1894 * optimal. We can add hooks later to attach.
1898 */ 1895 */
1899struct scsi_device *scsi_get_host_dev(struct Scsi_Host *shost) 1896struct scsi_device *scsi_get_host_dev(struct Scsi_Host *shost)
1900{ 1897{
@@ -1920,18 +1917,13 @@ struct scsi_device *scsi_get_host_dev(struct Scsi_Host *shost)
1920} 1917}
1921EXPORT_SYMBOL(scsi_get_host_dev); 1918EXPORT_SYMBOL(scsi_get_host_dev);
1922 1919
1923/* 1920/**
1924 * Function: scsi_free_host_dev() 1921 * scsi_free_host_dev - Free a scsi_device that points to the host adapter itself
1925 * 1922 * @sdev: Host device to be freed
1926 * Purpose: Free a scsi_device that points to the host adapter itself.
1927 *
1928 * Arguments: SHpnt - Host that needs a scsi_device
1929 * 1923 *
1930 * Lock status: None assumed. 1924 * Lock status: None assumed.
1931 * 1925 *
1932 * Returns: Nothing 1926 * Returns: Nothing
1933 *
1934 * Notes:
1935 */ 1927 */
1936void scsi_free_host_dev(struct scsi_device *sdev) 1928void scsi_free_host_dev(struct scsi_device *sdev)
1937{ 1929{
diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c
index fc23d273fb1a..386dd9d602b6 100644
--- a/drivers/scsi/sun_esp.c
+++ b/drivers/scsi/sun_esp.c
@@ -125,7 +125,7 @@ static void __devinit esp_get_scsi_id(struct esp *esp, struct of_device *espdma)
125 struct of_device *op = esp->dev; 125 struct of_device *op = esp->dev;
126 struct device_node *dp; 126 struct device_node *dp;
127 127
128 dp = op->node; 128 dp = op->dev.of_node;
129 esp->scsi_id = of_getintprop_default(dp, "initiator-id", 0xff); 129 esp->scsi_id = of_getintprop_default(dp, "initiator-id", 0xff);
130 if (esp->scsi_id != 0xff) 130 if (esp->scsi_id != 0xff)
131 goto done; 131 goto done;
@@ -134,7 +134,7 @@ static void __devinit esp_get_scsi_id(struct esp *esp, struct of_device *espdma)
134 if (esp->scsi_id != 0xff) 134 if (esp->scsi_id != 0xff)
135 goto done; 135 goto done;
136 136
137 esp->scsi_id = of_getintprop_default(espdma->node, 137 esp->scsi_id = of_getintprop_default(espdma->dev.of_node,
138 "scsi-initiator-id", 7); 138 "scsi-initiator-id", 7);
139 139
140done: 140done:
@@ -147,7 +147,7 @@ static void __devinit esp_get_differential(struct esp *esp)
147 struct of_device *op = esp->dev; 147 struct of_device *op = esp->dev;
148 struct device_node *dp; 148 struct device_node *dp;
149 149
150 dp = op->node; 150 dp = op->dev.of_node;
151 if (of_find_property(dp, "differential", NULL)) 151 if (of_find_property(dp, "differential", NULL))
152 esp->flags |= ESP_FLAG_DIFFERENTIAL; 152 esp->flags |= ESP_FLAG_DIFFERENTIAL;
153 else 153 else
@@ -160,7 +160,7 @@ static void __devinit esp_get_clock_params(struct esp *esp)
160 struct device_node *bus_dp, *dp; 160 struct device_node *bus_dp, *dp;
161 int fmhz; 161 int fmhz;
162 162
163 dp = op->node; 163 dp = op->dev.of_node;
164 bus_dp = dp->parent; 164 bus_dp = dp->parent;
165 165
166 fmhz = of_getintprop_default(dp, "clock-frequency", 0); 166 fmhz = of_getintprop_default(dp, "clock-frequency", 0);
@@ -172,12 +172,12 @@ static void __devinit esp_get_clock_params(struct esp *esp)
172 172
173static void __devinit esp_get_bursts(struct esp *esp, struct of_device *dma_of) 173static void __devinit esp_get_bursts(struct esp *esp, struct of_device *dma_of)
174{ 174{
175 struct device_node *dma_dp = dma_of->node; 175 struct device_node *dma_dp = dma_of->dev.of_node;
176 struct of_device *op = esp->dev; 176 struct of_device *op = esp->dev;
177 struct device_node *dp; 177 struct device_node *dp;
178 u8 bursts, val; 178 u8 bursts, val;
179 179
180 dp = op->node; 180 dp = op->dev.of_node;
181 bursts = of_getintprop_default(dp, "burst-sizes", 0xff); 181 bursts = of_getintprop_default(dp, "burst-sizes", 0xff);
182 val = of_getintprop_default(dma_dp, "burst-sizes", 0xff); 182 val = of_getintprop_default(dma_dp, "burst-sizes", 0xff);
183 if (val != 0xff) 183 if (val != 0xff)
@@ -565,7 +565,7 @@ fail:
565static int __devinit esp_sbus_probe(struct of_device *op, const struct of_device_id *match) 565static int __devinit esp_sbus_probe(struct of_device *op, const struct of_device_id *match)
566{ 566{
567 struct device_node *dma_node = NULL; 567 struct device_node *dma_node = NULL;
568 struct device_node *dp = op->node; 568 struct device_node *dp = op->dev.of_node;
569 struct of_device *dma_of = NULL; 569 struct of_device *dma_of = NULL;
570 int hme = 0; 570 int hme = 0;
571 571
@@ -574,7 +574,7 @@ static int __devinit esp_sbus_probe(struct of_device *op, const struct of_device
574 !strcmp(dp->parent->name, "dma"))) 574 !strcmp(dp->parent->name, "dma")))
575 dma_node = dp->parent; 575 dma_node = dp->parent;
576 else if (!strcmp(dp->name, "SUNW,fas")) { 576 else if (!strcmp(dp->name, "SUNW,fas")) {
577 dma_node = op->node; 577 dma_node = op->dev.of_node;
578 hme = 1; 578 hme = 1;
579 } 579 }
580 if (dma_node) 580 if (dma_node)
@@ -633,8 +633,11 @@ static const struct of_device_id esp_match[] = {
633MODULE_DEVICE_TABLE(of, esp_match); 633MODULE_DEVICE_TABLE(of, esp_match);
634 634
635static struct of_platform_driver esp_sbus_driver = { 635static struct of_platform_driver esp_sbus_driver = {
636 .name = "esp", 636 .driver = {
637 .match_table = esp_match, 637 .name = "esp",
638 .owner = THIS_MODULE,
639 .of_match_table = esp_match,
640 },
638 .probe = esp_sbus_probe, 641 .probe = esp_sbus_probe,
639 .remove = __devexit_p(esp_sbus_remove), 642 .remove = __devexit_p(esp_sbus_remove),
640}; 643};
diff --git a/drivers/serial/apbuart.c b/drivers/serial/apbuart.c
index fe91319b5f65..0099b8692b60 100644
--- a/drivers/serial/apbuart.c
+++ b/drivers/serial/apbuart.c
@@ -559,7 +559,7 @@ static int __devinit apbuart_probe(struct of_device *op,
559 559
560 i = 0; 560 i = 0;
561 for (i = 0; i < grlib_apbuart_port_nr; i++) { 561 for (i = 0; i < grlib_apbuart_port_nr; i++) {
562 if (op->node == grlib_apbuart_nodes[i]) 562 if (op->dev.of_node == grlib_apbuart_nodes[i])
563 break; 563 break;
564 } 564 }
565 565
@@ -584,12 +584,12 @@ static struct of_device_id __initdata apbuart_match[] = {
584}; 584};
585 585
586static struct of_platform_driver grlib_apbuart_of_driver = { 586static struct of_platform_driver grlib_apbuart_of_driver = {
587 .match_table = apbuart_match,
588 .probe = apbuart_probe, 587 .probe = apbuart_probe,
589 .driver = { 588 .driver = {
590 .owner = THIS_MODULE, 589 .owner = THIS_MODULE,
591 .name = "grlib-apbuart", 590 .name = "grlib-apbuart",
592 }, 591 .of_match_table = apbuart_match,
592 },
593}; 593};
594 594
595 595
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index 300cea768d74..9eb62a256e9a 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -1342,7 +1342,7 @@ static int __devinit cpm_uart_probe(struct of_device *ofdev,
1342 /* initialize the device pointer for the port */ 1342 /* initialize the device pointer for the port */
1343 pinfo->port.dev = &ofdev->dev; 1343 pinfo->port.dev = &ofdev->dev;
1344 1344
1345 ret = cpm_uart_init_port(ofdev->node, pinfo); 1345 ret = cpm_uart_init_port(ofdev->dev.of_node, pinfo);
1346 if (ret) 1346 if (ret)
1347 return ret; 1347 return ret;
1348 1348
@@ -1372,8 +1372,11 @@ static struct of_device_id cpm_uart_match[] = {
1372}; 1372};
1373 1373
1374static struct of_platform_driver cpm_uart_driver = { 1374static struct of_platform_driver cpm_uart_driver = {
1375 .name = "cpm_uart", 1375 .driver = {
1376 .match_table = cpm_uart_match, 1376 .name = "cpm_uart",
1377 .owner = THIS_MODULE,
1378 .of_match_table = cpm_uart_match,
1379 },
1377 .probe = cpm_uart_probe, 1380 .probe = cpm_uart_probe,
1378 .remove = cpm_uart_remove, 1381 .remove = cpm_uart_remove,
1379 }; 1382 };
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 02469c31bf0b..beb4710faeee 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -1295,14 +1295,14 @@ mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match)
1295 1295
1296 /* Check validity & presence */ 1296 /* Check validity & presence */
1297 for (idx = 0; idx < MPC52xx_PSC_MAXNUM; idx++) 1297 for (idx = 0; idx < MPC52xx_PSC_MAXNUM; idx++)
1298 if (mpc52xx_uart_nodes[idx] == op->node) 1298 if (mpc52xx_uart_nodes[idx] == op->dev.of_node)
1299 break; 1299 break;
1300 if (idx >= MPC52xx_PSC_MAXNUM) 1300 if (idx >= MPC52xx_PSC_MAXNUM)
1301 return -EINVAL; 1301 return -EINVAL;
1302 pr_debug("Found %s assigned to ttyPSC%x\n", 1302 pr_debug("Found %s assigned to ttyPSC%x\n",
1303 mpc52xx_uart_nodes[idx]->full_name, idx); 1303 mpc52xx_uart_nodes[idx]->full_name, idx);
1304 1304
1305 uartclk = psc_ops->getuartclk(op->node); 1305 uartclk = psc_ops->getuartclk(op->dev.of_node);
1306 if (uartclk == 0) { 1306 if (uartclk == 0) {
1307 dev_dbg(&op->dev, "Could not find uart clock frequency!\n"); 1307 dev_dbg(&op->dev, "Could not find uart clock frequency!\n");
1308 return -EINVAL; 1308 return -EINVAL;
@@ -1322,7 +1322,7 @@ mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match)
1322 port->dev = &op->dev; 1322 port->dev = &op->dev;
1323 1323
1324 /* Search for IRQ and mapbase */ 1324 /* Search for IRQ and mapbase */
1325 ret = of_address_to_resource(op->node, 0, &res); 1325 ret = of_address_to_resource(op->dev.of_node, 0, &res);
1326 if (ret) 1326 if (ret)
1327 return ret; 1327 return ret;
1328 1328
@@ -1332,7 +1332,7 @@ mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match)
1332 return -EINVAL; 1332 return -EINVAL;
1333 } 1333 }
1334 1334
1335 psc_ops->get_irq(port, op->node); 1335 psc_ops->get_irq(port, op->dev.of_node);
1336 if (port->irq == NO_IRQ) { 1336 if (port->irq == NO_IRQ) {
1337 dev_dbg(&op->dev, "Could not get irq\n"); 1337 dev_dbg(&op->dev, "Could not get irq\n");
1338 return -EINVAL; 1338 return -EINVAL;
@@ -1431,15 +1431,16 @@ mpc52xx_uart_of_enumerate(void)
1431MODULE_DEVICE_TABLE(of, mpc52xx_uart_of_match); 1431MODULE_DEVICE_TABLE(of, mpc52xx_uart_of_match);
1432 1432
1433static struct of_platform_driver mpc52xx_uart_of_driver = { 1433static struct of_platform_driver mpc52xx_uart_of_driver = {
1434 .match_table = mpc52xx_uart_of_match,
1435 .probe = mpc52xx_uart_of_probe, 1434 .probe = mpc52xx_uart_of_probe,
1436 .remove = mpc52xx_uart_of_remove, 1435 .remove = mpc52xx_uart_of_remove,
1437#ifdef CONFIG_PM 1436#ifdef CONFIG_PM
1438 .suspend = mpc52xx_uart_of_suspend, 1437 .suspend = mpc52xx_uart_of_suspend,
1439 .resume = mpc52xx_uart_of_resume, 1438 .resume = mpc52xx_uart_of_resume,
1440#endif 1439#endif
1441 .driver = { 1440 .driver = {
1442 .name = "mpc52xx-psc-uart", 1441 .name = "mpc52xx-psc-uart",
1442 .owner = THIS_MODULE,
1443 .of_match_table = mpc52xx_uart_of_match,
1443 }, 1444 },
1444}; 1445};
1445 1446
diff --git a/drivers/serial/nwpserial.c b/drivers/serial/nwpserial.c
index e1ab8ec0a4a6..3c02fa96f282 100644
--- a/drivers/serial/nwpserial.c
+++ b/drivers/serial/nwpserial.c
@@ -344,7 +344,7 @@ int nwpserial_register_port(struct uart_port *port)
344 344
345 mutex_lock(&nwpserial_mutex); 345 mutex_lock(&nwpserial_mutex);
346 346
347 dn = to_of_device(port->dev)->node; 347 dn = to_of_device(port->dev)->dev.of_node;
348 if (dn == NULL) 348 if (dn == NULL)
349 goto out; 349 goto out;
350 350
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c
index 4abfebdb0fcc..a48d9080f552 100644
--- a/drivers/serial/of_serial.c
+++ b/drivers/serial/of_serial.c
@@ -31,7 +31,7 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev,
31 int type, struct uart_port *port) 31 int type, struct uart_port *port)
32{ 32{
33 struct resource resource; 33 struct resource resource;
34 struct device_node *np = ofdev->node; 34 struct device_node *np = ofdev->dev.of_node;
35 const unsigned int *clk, *spd; 35 const unsigned int *clk, *spd;
36 const u32 *prop; 36 const u32 *prop;
37 int ret, prop_size; 37 int ret, prop_size;
@@ -88,7 +88,7 @@ static int __devinit of_platform_serial_probe(struct of_device *ofdev,
88 int port_type; 88 int port_type;
89 int ret; 89 int ret;
90 90
91 if (of_find_property(ofdev->node, "used-by-rtas", NULL)) 91 if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL))
92 return -EBUSY; 92 return -EBUSY;
93 93
94 info = kmalloc(sizeof(*info), GFP_KERNEL); 94 info = kmalloc(sizeof(*info), GFP_KERNEL);
@@ -175,11 +175,13 @@ static struct of_device_id __devinitdata of_platform_serial_table[] = {
175}; 175};
176 176
177static struct of_platform_driver of_platform_serial_driver = { 177static struct of_platform_driver of_platform_serial_driver = {
178 .owner = THIS_MODULE, 178 .driver = {
179 .name = "of_serial", 179 .name = "of_serial",
180 .owner = THIS_MODULE,
181 .of_match_table = of_platform_serial_table,
182 },
180 .probe = of_platform_serial_probe, 183 .probe = of_platform_serial_probe,
181 .remove = of_platform_serial_remove, 184 .remove = of_platform_serial_remove,
182 .match_table = of_platform_serial_table,
183}; 185};
184 186
185static int __init of_platform_serial_init(void) 187static int __init of_platform_serial_init(void)
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
index 700e10833bf9..cabbdc7ba583 100644
--- a/drivers/serial/pmac_zilog.c
+++ b/drivers/serial/pmac_zilog.c
@@ -1611,7 +1611,7 @@ static int pmz_attach(struct macio_dev *mdev, const struct of_device_id *match)
1611 /* Iterate the pmz_ports array to find a matching entry 1611 /* Iterate the pmz_ports array to find a matching entry
1612 */ 1612 */
1613 for (i = 0; i < MAX_ZS_PORTS; i++) 1613 for (i = 0; i < MAX_ZS_PORTS; i++)
1614 if (pmz_ports[i].node == mdev->ofdev.node) { 1614 if (pmz_ports[i].node == mdev->ofdev.dev.of_node) {
1615 struct uart_pmac_port *uap = &pmz_ports[i]; 1615 struct uart_pmac_port *uap = &pmz_ports[i];
1616 1616
1617 uap->dev = mdev; 1617 uap->dev = mdev;
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 4f73fb756745..5f90fcd7d107 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -1004,8 +1004,9 @@ static void sci_rx_dma_release(struct sci_port *s, bool enable_pio)
1004 s->chan_rx = NULL; 1004 s->chan_rx = NULL;
1005 s->cookie_rx[0] = s->cookie_rx[1] = -EINVAL; 1005 s->cookie_rx[0] = s->cookie_rx[1] = -EINVAL;
1006 dma_release_channel(chan); 1006 dma_release_channel(chan);
1007 dma_free_coherent(port->dev, s->buf_len_rx * 2, 1007 if (sg_dma_address(&s->sg_rx[0]))
1008 sg_virt(&s->sg_rx[0]), sg_dma_address(&s->sg_rx[0])); 1008 dma_free_coherent(port->dev, s->buf_len_rx * 2,
1009 sg_virt(&s->sg_rx[0]), sg_dma_address(&s->sg_rx[0]));
1009 if (enable_pio) 1010 if (enable_pio)
1010 sci_start_rx(port); 1011 sci_start_rx(port);
1011} 1012}
diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c
index d14cca7fb88d..890f91742962 100644
--- a/drivers/serial/sunhv.c
+++ b/drivers/serial/sunhv.c
@@ -565,7 +565,7 @@ static int __devinit hv_probe(struct of_device *op, const struct of_device_id *m
565 if (err) 565 if (err)
566 goto out_free_con_read_page; 566 goto out_free_con_read_page;
567 567
568 sunserial_console_match(&sunhv_console, op->node, 568 sunserial_console_match(&sunhv_console, op->dev.of_node,
569 &sunhv_reg, port->line, false); 569 &sunhv_reg, port->line, false);
570 570
571 err = uart_add_one_port(&sunhv_reg, port); 571 err = uart_add_one_port(&sunhv_reg, port);
@@ -630,8 +630,11 @@ static const struct of_device_id hv_match[] = {
630MODULE_DEVICE_TABLE(of, hv_match); 630MODULE_DEVICE_TABLE(of, hv_match);
631 631
632static struct of_platform_driver hv_driver = { 632static struct of_platform_driver hv_driver = {
633 .name = "hv", 633 .driver = {
634 .match_table = hv_match, 634 .name = "hv",
635 .owner = THIS_MODULE,
636 .of_match_table = hv_match,
637 },
635 .probe = hv_probe, 638 .probe = hv_probe,
636 .remove = __devexit_p(hv_remove), 639 .remove = __devexit_p(hv_remove),
637}; 640};
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index d2e0321049e2..5e81bc6b48b0 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -883,7 +883,7 @@ static int sunsab_console_setup(struct console *con, char *options)
883 printk("Console: ttyS%d (SAB82532)\n", 883 printk("Console: ttyS%d (SAB82532)\n",
884 (sunsab_reg.minor - 64) + con->index); 884 (sunsab_reg.minor - 64) + con->index);
885 885
886 sunserial_console_termios(con, to_of_device(up->port.dev)->node); 886 sunserial_console_termios(con, to_of_device(up->port.dev)->dev.of_node);
887 887
888 switch (con->cflag & CBAUD) { 888 switch (con->cflag & CBAUD) {
889 case B150: baud = 150; break; 889 case B150: baud = 150; break;
@@ -1026,11 +1026,11 @@ static int __devinit sab_probe(struct of_device *op, const struct of_device_id *
1026 if (err) 1026 if (err)
1027 goto out1; 1027 goto out1;
1028 1028
1029 sunserial_console_match(SUNSAB_CONSOLE(), op->node, 1029 sunserial_console_match(SUNSAB_CONSOLE(), op->dev.of_node,
1030 &sunsab_reg, up[0].port.line, 1030 &sunsab_reg, up[0].port.line,
1031 false); 1031 false);
1032 1032
1033 sunserial_console_match(SUNSAB_CONSOLE(), op->node, 1033 sunserial_console_match(SUNSAB_CONSOLE(), op->dev.of_node,
1034 &sunsab_reg, up[1].port.line, 1034 &sunsab_reg, up[1].port.line,
1035 false); 1035 false);
1036 1036
@@ -1093,8 +1093,11 @@ static const struct of_device_id sab_match[] = {
1093MODULE_DEVICE_TABLE(of, sab_match); 1093MODULE_DEVICE_TABLE(of, sab_match);
1094 1094
1095static struct of_platform_driver sab_driver = { 1095static struct of_platform_driver sab_driver = {
1096 .name = "sab", 1096 .driver = {
1097 .match_table = sab_match, 1097 .name = "sab",
1098 .owner = THIS_MODULE,
1099 .of_match_table = sab_match,
1100 },
1098 .probe = sab_probe, 1101 .probe = sab_probe,
1099 .remove = __devexit_p(sab_remove), 1102 .remove = __devexit_p(sab_remove),
1100}; 1103};
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index 01f7731e59b8..234459c2f012 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -1200,7 +1200,7 @@ static int __devinit sunsu_kbd_ms_init(struct uart_sunsu_port *up)
1200 return -ENODEV; 1200 return -ENODEV;
1201 1201
1202 printk("%s: %s port at %llx, irq %u\n", 1202 printk("%s: %s port at %llx, irq %u\n",
1203 to_of_device(up->port.dev)->node->full_name, 1203 to_of_device(up->port.dev)->dev.of_node->full_name,
1204 (up->su_type == SU_PORT_KBD) ? "Keyboard" : "Mouse", 1204 (up->su_type == SU_PORT_KBD) ? "Keyboard" : "Mouse",
1205 (unsigned long long) up->port.mapbase, 1205 (unsigned long long) up->port.mapbase,
1206 up->port.irq); 1206 up->port.irq);
@@ -1352,7 +1352,7 @@ static int __init sunsu_console_setup(struct console *co, char *options)
1352 spin_lock_init(&port->lock); 1352 spin_lock_init(&port->lock);
1353 1353
1354 /* Get firmware console settings. */ 1354 /* Get firmware console settings. */
1355 sunserial_console_termios(co, to_of_device(port->dev)->node); 1355 sunserial_console_termios(co, to_of_device(port->dev)->dev.of_node);
1356 1356
1357 memset(&termios, 0, sizeof(struct ktermios)); 1357 memset(&termios, 0, sizeof(struct ktermios));
1358 termios.c_cflag = co->cflag; 1358 termios.c_cflag = co->cflag;
@@ -1409,7 +1409,7 @@ static enum su_type __devinit su_get_type(struct device_node *dp)
1409static int __devinit su_probe(struct of_device *op, const struct of_device_id *match) 1409static int __devinit su_probe(struct of_device *op, const struct of_device_id *match)
1410{ 1410{
1411 static int inst; 1411 static int inst;
1412 struct device_node *dp = op->node; 1412 struct device_node *dp = op->dev.of_node;
1413 struct uart_sunsu_port *up; 1413 struct uart_sunsu_port *up;
1414 struct resource *rp; 1414 struct resource *rp;
1415 enum su_type type; 1415 enum su_type type;
@@ -1539,8 +1539,11 @@ static const struct of_device_id su_match[] = {
1539MODULE_DEVICE_TABLE(of, su_match); 1539MODULE_DEVICE_TABLE(of, su_match);
1540 1540
1541static struct of_platform_driver su_driver = { 1541static struct of_platform_driver su_driver = {
1542 .name = "su", 1542 .driver = {
1543 .match_table = su_match, 1543 .name = "su",
1544 .owner = THIS_MODULE,
1545 .of_match_table = su_match,
1546 },
1544 .probe = su_probe, 1547 .probe = su_probe,
1545 .remove = __devexit_p(su_remove), 1548 .remove = __devexit_p(su_remove),
1546}; 1549};
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 978b3cee02d7..f9a24f4ebb34 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -1230,7 +1230,7 @@ static int __init sunzilog_console_setup(struct console *con, char *options)
1230 (sunzilog_reg.minor - 64) + con->index, con->index); 1230 (sunzilog_reg.minor - 64) + con->index, con->index);
1231 1231
1232 /* Get firmware console settings. */ 1232 /* Get firmware console settings. */
1233 sunserial_console_termios(con, to_of_device(up->port.dev)->node); 1233 sunserial_console_termios(con, to_of_device(up->port.dev)->dev.of_node);
1234 1234
1235 /* Firmware console speed is limited to 150-->38400 baud so 1235 /* Firmware console speed is limited to 150-->38400 baud so
1236 * this hackish cflag thing is OK. 1236 * this hackish cflag thing is OK.
@@ -1408,7 +1408,7 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m
1408 int keyboard_mouse = 0; 1408 int keyboard_mouse = 0;
1409 int err; 1409 int err;
1410 1410
1411 if (of_find_property(op->node, "keyboard", NULL)) 1411 if (of_find_property(op->dev.of_node, "keyboard", NULL))
1412 keyboard_mouse = 1; 1412 keyboard_mouse = 1;
1413 1413
1414 /* uarts must come before keyboards/mice */ 1414 /* uarts must come before keyboards/mice */
@@ -1465,7 +1465,7 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m
1465 sunzilog_init_hw(&up[1]); 1465 sunzilog_init_hw(&up[1]);
1466 1466
1467 if (!keyboard_mouse) { 1467 if (!keyboard_mouse) {
1468 if (sunserial_console_match(SUNZILOG_CONSOLE(), op->node, 1468 if (sunserial_console_match(SUNZILOG_CONSOLE(), op->dev.of_node,
1469 &sunzilog_reg, up[0].port.line, 1469 &sunzilog_reg, up[0].port.line,
1470 false)) 1470 false))
1471 up->flags |= SUNZILOG_FLAG_IS_CONS; 1471 up->flags |= SUNZILOG_FLAG_IS_CONS;
@@ -1475,7 +1475,7 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m
1475 rp, sizeof(struct zilog_layout)); 1475 rp, sizeof(struct zilog_layout));
1476 return err; 1476 return err;
1477 } 1477 }
1478 if (sunserial_console_match(SUNZILOG_CONSOLE(), op->node, 1478 if (sunserial_console_match(SUNZILOG_CONSOLE(), op->dev.of_node,
1479 &sunzilog_reg, up[1].port.line, 1479 &sunzilog_reg, up[1].port.line,
1480 false)) 1480 false))
1481 up->flags |= SUNZILOG_FLAG_IS_CONS; 1481 up->flags |= SUNZILOG_FLAG_IS_CONS;
@@ -1541,8 +1541,11 @@ static const struct of_device_id zs_match[] = {
1541MODULE_DEVICE_TABLE(of, zs_match); 1541MODULE_DEVICE_TABLE(of, zs_match);
1542 1542
1543static struct of_platform_driver zs_driver = { 1543static struct of_platform_driver zs_driver = {
1544 .name = "zs", 1544 .driver = {
1545 .match_table = zs_match, 1545 .name = "zs",
1546 .owner = THIS_MODULE,
1547 .of_match_table = zs_match,
1548 },
1546 .probe = zs_probe, 1549 .probe = zs_probe,
1547 .remove = __devexit_p(zs_remove), 1550 .remove = __devexit_p(zs_remove),
1548}; 1551};
diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c
index e6639a95d276..8acccd564378 100644
--- a/drivers/serial/uartlite.c
+++ b/drivers/serial/uartlite.c
@@ -591,15 +591,15 @@ ulite_of_probe(struct of_device *op, const struct of_device_id *match)
591 591
592 dev_dbg(&op->dev, "%s(%p, %p)\n", __func__, op, match); 592 dev_dbg(&op->dev, "%s(%p, %p)\n", __func__, op, match);
593 593
594 rc = of_address_to_resource(op->node, 0, &res); 594 rc = of_address_to_resource(op->dev.of_node, 0, &res);
595 if (rc) { 595 if (rc) {
596 dev_err(&op->dev, "invalid address\n"); 596 dev_err(&op->dev, "invalid address\n");
597 return rc; 597 return rc;
598 } 598 }
599 599
600 irq = irq_of_parse_and_map(op->node, 0); 600 irq = irq_of_parse_and_map(op->dev.of_node, 0);
601 601
602 id = of_get_property(op->node, "port-number", NULL); 602 id = of_get_property(op->dev.of_node, "port-number", NULL);
603 603
604 return ulite_assign(&op->dev, id ? *id : -1, res.start, irq); 604 return ulite_assign(&op->dev, id ? *id : -1, res.start, irq);
605} 605}
@@ -610,13 +610,12 @@ static int __devexit ulite_of_remove(struct of_device *op)
610} 610}
611 611
612static struct of_platform_driver ulite_of_driver = { 612static struct of_platform_driver ulite_of_driver = {
613 .owner = THIS_MODULE,
614 .name = "uartlite",
615 .match_table = ulite_of_match,
616 .probe = ulite_of_probe, 613 .probe = ulite_of_probe,
617 .remove = __devexit_p(ulite_of_remove), 614 .remove = __devexit_p(ulite_of_remove),
618 .driver = { 615 .driver = {
619 .name = "uartlite", 616 .name = "uartlite",
617 .owner = THIS_MODULE,
618 .of_match_table = ulite_of_match,
620 }, 619 },
621}; 620};
622 621
diff --git a/drivers/serial/ucc_uart.c b/drivers/serial/ucc_uart.c
index 074904912f64..907b06f5c447 100644
--- a/drivers/serial/ucc_uart.c
+++ b/drivers/serial/ucc_uart.c
@@ -1197,7 +1197,7 @@ static void uart_firmware_cont(const struct firmware *fw, void *context)
1197static int ucc_uart_probe(struct of_device *ofdev, 1197static int ucc_uart_probe(struct of_device *ofdev,
1198 const struct of_device_id *match) 1198 const struct of_device_id *match)
1199{ 1199{
1200 struct device_node *np = ofdev->node; 1200 struct device_node *np = ofdev->dev.of_node;
1201 const unsigned int *iprop; /* Integer OF properties */ 1201 const unsigned int *iprop; /* Integer OF properties */
1202 const char *sprop; /* String OF properties */ 1202 const char *sprop; /* String OF properties */
1203 struct uart_qe_port *qe_port = NULL; 1203 struct uart_qe_port *qe_port = NULL;
@@ -1486,9 +1486,11 @@ static struct of_device_id ucc_uart_match[] = {
1486MODULE_DEVICE_TABLE(of, ucc_uart_match); 1486MODULE_DEVICE_TABLE(of, ucc_uart_match);
1487 1487
1488static struct of_platform_driver ucc_uart_of_driver = { 1488static struct of_platform_driver ucc_uart_of_driver = {
1489 .owner = THIS_MODULE, 1489 .driver = {
1490 .name = "ucc_uart", 1490 .name = "ucc_uart",
1491 .match_table = ucc_uart_match, 1491 .owner = THIS_MODULE,
1492 .of_match_table = ucc_uart_match,
1493 },
1492 .probe = ucc_uart_probe, 1494 .probe = ucc_uart_probe,
1493 .remove = ucc_uart_remove, 1495 .remove = ucc_uart_remove,
1494}; 1496};
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index 77d4cc88edea..7104cb739da7 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -472,18 +472,18 @@ static int __init mpc52xx_psc_spi_of_probe(struct of_device *op,
472 s16 id = -1; 472 s16 id = -1;
473 int rc; 473 int rc;
474 474
475 regaddr_p = of_get_address(op->node, 0, &size64, NULL); 475 regaddr_p = of_get_address(op->dev.of_node, 0, &size64, NULL);
476 if (!regaddr_p) { 476 if (!regaddr_p) {
477 dev_err(&op->dev, "Invalid PSC address\n"); 477 dev_err(&op->dev, "Invalid PSC address\n");
478 return -EINVAL; 478 return -EINVAL;
479 } 479 }
480 regaddr64 = of_translate_address(op->node, regaddr_p); 480 regaddr64 = of_translate_address(op->dev.of_node, regaddr_p);
481 481
482 /* get PSC id (1..6, used by port_config) */ 482 /* get PSC id (1..6, used by port_config) */
483 if (op->dev.platform_data == NULL) { 483 if (op->dev.platform_data == NULL) {
484 const u32 *psc_nump; 484 const u32 *psc_nump;
485 485
486 psc_nump = of_get_property(op->node, "cell-index", NULL); 486 psc_nump = of_get_property(op->dev.of_node, "cell-index", NULL);
487 if (!psc_nump || *psc_nump > 5) { 487 if (!psc_nump || *psc_nump > 5) {
488 dev_err(&op->dev, "Invalid cell-index property\n"); 488 dev_err(&op->dev, "Invalid cell-index property\n");
489 return -EINVAL; 489 return -EINVAL;
@@ -492,9 +492,10 @@ static int __init mpc52xx_psc_spi_of_probe(struct of_device *op,
492 } 492 }
493 493
494 rc = mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64, 494 rc = mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64,
495 irq_of_parse_and_map(op->node, 0), id); 495 irq_of_parse_and_map(op->dev.of_node, 0), id);
496 if (rc == 0) 496 if (rc == 0)
497 of_register_spi_devices(dev_get_drvdata(&op->dev), op->node); 497 of_register_spi_devices(dev_get_drvdata(&op->dev),
498 op->dev.of_node);
498 499
499 return rc; 500 return rc;
500} 501}
@@ -513,14 +514,12 @@ static const struct of_device_id mpc52xx_psc_spi_of_match[] = {
513MODULE_DEVICE_TABLE(of, mpc52xx_psc_spi_of_match); 514MODULE_DEVICE_TABLE(of, mpc52xx_psc_spi_of_match);
514 515
515static struct of_platform_driver mpc52xx_psc_spi_of_driver = { 516static struct of_platform_driver mpc52xx_psc_spi_of_driver = {
516 .owner = THIS_MODULE,
517 .name = "mpc52xx-psc-spi",
518 .match_table = mpc52xx_psc_spi_of_match,
519 .probe = mpc52xx_psc_spi_of_probe, 517 .probe = mpc52xx_psc_spi_of_probe,
520 .remove = __exit_p(mpc52xx_psc_spi_of_remove), 518 .remove = __exit_p(mpc52xx_psc_spi_of_remove),
521 .driver = { 519 .driver = {
522 .name = "mpc52xx-psc-spi", 520 .name = "mpc52xx-psc-spi",
523 .owner = THIS_MODULE, 521 .owner = THIS_MODULE,
522 .of_match_table = mpc52xx_psc_spi_of_match,
524 }, 523 },
525}; 524};
526 525
diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c
index cd68f1ce5cc3..b1a76bff775f 100644
--- a/drivers/spi/mpc52xx_spi.c
+++ b/drivers/spi/mpc52xx_spi.c
@@ -403,7 +403,7 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op,
403 403
404 /* MMIO registers */ 404 /* MMIO registers */
405 dev_dbg(&op->dev, "probing mpc5200 SPI device\n"); 405 dev_dbg(&op->dev, "probing mpc5200 SPI device\n");
406 regs = of_iomap(op->node, 0); 406 regs = of_iomap(op->dev.of_node, 0);
407 if (!regs) 407 if (!regs)
408 return -ENODEV; 408 return -ENODEV;
409 409
@@ -445,11 +445,11 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op,
445 ms = spi_master_get_devdata(master); 445 ms = spi_master_get_devdata(master);
446 ms->master = master; 446 ms->master = master;
447 ms->regs = regs; 447 ms->regs = regs;
448 ms->irq0 = irq_of_parse_and_map(op->node, 0); 448 ms->irq0 = irq_of_parse_and_map(op->dev.of_node, 0);
449 ms->irq1 = irq_of_parse_and_map(op->node, 1); 449 ms->irq1 = irq_of_parse_and_map(op->dev.of_node, 1);
450 ms->state = mpc52xx_spi_fsmstate_idle; 450 ms->state = mpc52xx_spi_fsmstate_idle;
451 ms->ipb_freq = mpc5xxx_get_bus_frequency(op->node); 451 ms->ipb_freq = mpc5xxx_get_bus_frequency(op->dev.of_node);
452 ms->gpio_cs_count = of_gpio_count(op->node); 452 ms->gpio_cs_count = of_gpio_count(op->dev.of_node);
453 if (ms->gpio_cs_count > 0) { 453 if (ms->gpio_cs_count > 0) {
454 master->num_chipselect = ms->gpio_cs_count; 454 master->num_chipselect = ms->gpio_cs_count;
455 ms->gpio_cs = kmalloc(ms->gpio_cs_count * sizeof(unsigned int), 455 ms->gpio_cs = kmalloc(ms->gpio_cs_count * sizeof(unsigned int),
@@ -460,7 +460,7 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op,
460 } 460 }
461 461
462 for (i = 0; i < ms->gpio_cs_count; i++) { 462 for (i = 0; i < ms->gpio_cs_count; i++) {
463 gpio_cs = of_get_gpio(op->node, i); 463 gpio_cs = of_get_gpio(op->dev.of_node, i);
464 if (gpio_cs < 0) { 464 if (gpio_cs < 0) {
465 dev_err(&op->dev, 465 dev_err(&op->dev,
466 "could not parse the gpio field " 466 "could not parse the gpio field "
@@ -512,7 +512,7 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op,
512 if (rc) 512 if (rc)
513 goto err_register; 513 goto err_register;
514 514
515 of_register_spi_devices(master, op->node); 515 of_register_spi_devices(master, op->dev.of_node);
516 dev_info(&ms->master->dev, "registered MPC5200 SPI bus\n"); 516 dev_info(&ms->master->dev, "registered MPC5200 SPI bus\n");
517 517
518 return rc; 518 return rc;
@@ -558,9 +558,11 @@ static const struct of_device_id mpc52xx_spi_match[] __devinitconst = {
558MODULE_DEVICE_TABLE(of, mpc52xx_spi_match); 558MODULE_DEVICE_TABLE(of, mpc52xx_spi_match);
559 559
560static struct of_platform_driver mpc52xx_spi_of_driver = { 560static struct of_platform_driver mpc52xx_spi_of_driver = {
561 .owner = THIS_MODULE, 561 .driver = {
562 .name = "mpc52xx-spi", 562 .name = "mpc52xx-spi",
563 .match_table = mpc52xx_spi_match, 563 .owner = THIS_MODULE,
564 .of_match_table = mpc52xx_spi_match,
565 },
564 .probe = mpc52xx_spi_probe, 566 .probe = mpc52xx_spi_probe,
565 .remove = __exit_p(mpc52xx_spi_remove), 567 .remove = __exit_p(mpc52xx_spi_remove),
566}; 568};
diff --git a/drivers/spi/spi_mpc8xxx.c b/drivers/spi/spi_mpc8xxx.c
index e324627d97a2..75b7f8c0babc 100644
--- a/drivers/spi/spi_mpc8xxx.c
+++ b/drivers/spi/spi_mpc8xxx.c
@@ -797,7 +797,7 @@ static void mpc8xxx_spi_free_dummy_rx(void)
797static unsigned long mpc8xxx_spi_cpm_get_pram(struct mpc8xxx_spi *mspi) 797static unsigned long mpc8xxx_spi_cpm_get_pram(struct mpc8xxx_spi *mspi)
798{ 798{
799 struct device *dev = mspi->dev; 799 struct device *dev = mspi->dev;
800 struct device_node *np = dev_archdata_get_node(&dev->archdata); 800 struct device_node *np = dev->of_node;
801 const u32 *iprop; 801 const u32 *iprop;
802 int size; 802 int size;
803 unsigned long spi_base_ofs; 803 unsigned long spi_base_ofs;
@@ -851,7 +851,7 @@ static unsigned long mpc8xxx_spi_cpm_get_pram(struct mpc8xxx_spi *mspi)
851static int mpc8xxx_spi_cpm_init(struct mpc8xxx_spi *mspi) 851static int mpc8xxx_spi_cpm_init(struct mpc8xxx_spi *mspi)
852{ 852{
853 struct device *dev = mspi->dev; 853 struct device *dev = mspi->dev;
854 struct device_node *np = dev_archdata_get_node(&dev->archdata); 854 struct device_node *np = dev->of_node;
855 const u32 *iprop; 855 const u32 *iprop;
856 int size; 856 int size;
857 unsigned long pram_ofs; 857 unsigned long pram_ofs;
@@ -1123,7 +1123,7 @@ static void mpc8xxx_spi_cs_control(struct spi_device *spi, bool on)
1123 1123
1124static int of_mpc8xxx_spi_get_chipselects(struct device *dev) 1124static int of_mpc8xxx_spi_get_chipselects(struct device *dev)
1125{ 1125{
1126 struct device_node *np = dev_archdata_get_node(&dev->archdata); 1126 struct device_node *np = dev->of_node;
1127 struct fsl_spi_platform_data *pdata = dev->platform_data; 1127 struct fsl_spi_platform_data *pdata = dev->platform_data;
1128 struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata); 1128 struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata);
1129 unsigned int ngpios; 1129 unsigned int ngpios;
@@ -1224,7 +1224,7 @@ static int __devinit of_mpc8xxx_spi_probe(struct of_device *ofdev,
1224 const struct of_device_id *ofid) 1224 const struct of_device_id *ofid)
1225{ 1225{
1226 struct device *dev = &ofdev->dev; 1226 struct device *dev = &ofdev->dev;
1227 struct device_node *np = ofdev->node; 1227 struct device_node *np = ofdev->dev.of_node;
1228 struct mpc8xxx_spi_probe_info *pinfo; 1228 struct mpc8xxx_spi_probe_info *pinfo;
1229 struct fsl_spi_platform_data *pdata; 1229 struct fsl_spi_platform_data *pdata;
1230 struct spi_master *master; 1230 struct spi_master *master;
@@ -1312,8 +1312,11 @@ static const struct of_device_id of_mpc8xxx_spi_match[] = {
1312MODULE_DEVICE_TABLE(of, of_mpc8xxx_spi_match); 1312MODULE_DEVICE_TABLE(of, of_mpc8xxx_spi_match);
1313 1313
1314static struct of_platform_driver of_mpc8xxx_spi_driver = { 1314static struct of_platform_driver of_mpc8xxx_spi_driver = {
1315 .name = "mpc8xxx_spi", 1315 .driver = {
1316 .match_table = of_mpc8xxx_spi_match, 1316 .name = "mpc8xxx_spi",
1317 .owner = THIS_MODULE,
1318 .of_match_table = of_mpc8xxx_spi_match,
1319 },
1317 .probe = of_mpc8xxx_spi_probe, 1320 .probe = of_mpc8xxx_spi_probe,
1318 .remove = __devexit_p(of_mpc8xxx_spi_remove), 1321 .remove = __devexit_p(of_mpc8xxx_spi_remove),
1319}; 1322};
diff --git a/drivers/spi/spi_ppc4xx.c b/drivers/spi/spi_ppc4xx.c
index 7cb5ff37f6e2..19c0b3b34fce 100644
--- a/drivers/spi/spi_ppc4xx.c
+++ b/drivers/spi/spi_ppc4xx.c
@@ -587,12 +587,12 @@ static const struct of_device_id spi_ppc4xx_of_match[] = {
587MODULE_DEVICE_TABLE(of, spi_ppc4xx_of_match); 587MODULE_DEVICE_TABLE(of, spi_ppc4xx_of_match);
588 588
589static struct of_platform_driver spi_ppc4xx_of_driver = { 589static struct of_platform_driver spi_ppc4xx_of_driver = {
590 .match_table = spi_ppc4xx_of_match,
591 .probe = spi_ppc4xx_of_probe, 590 .probe = spi_ppc4xx_of_probe,
592 .remove = __exit_p(spi_ppc4xx_of_remove), 591 .remove = __exit_p(spi_ppc4xx_of_remove),
593 .driver = { 592 .driver = {
594 .name = DRIVER_NAME, 593 .name = DRIVER_NAME,
595 .owner = THIS_MODULE, 594 .owner = THIS_MODULE,
595 .of_match_table = spi_ppc4xx_of_match,
596 }, 596 },
597}; 597};
598 598
diff --git a/drivers/spi/xilinx_spi_of.c b/drivers/spi/xilinx_spi_of.c
index 748d33a76d29..55c58012a028 100644
--- a/drivers/spi/xilinx_spi_of.c
+++ b/drivers/spi/xilinx_spi_of.c
@@ -109,12 +109,12 @@ static const struct of_device_id xilinx_spi_of_match[] = {
109MODULE_DEVICE_TABLE(of, xilinx_spi_of_match); 109MODULE_DEVICE_TABLE(of, xilinx_spi_of_match);
110 110
111static struct of_platform_driver xilinx_spi_of_driver = { 111static struct of_platform_driver xilinx_spi_of_driver = {
112 .match_table = xilinx_spi_of_match,
113 .probe = xilinx_spi_of_probe, 112 .probe = xilinx_spi_of_probe,
114 .remove = __exit_p(xilinx_spi_of_remove), 113 .remove = __exit_p(xilinx_spi_of_remove),
115 .driver = { 114 .driver = {
116 .name = "xilinx-xps-spi", 115 .name = "xilinx-xps-spi",
117 .owner = THIS_MODULE, 116 .owner = THIS_MODULE,
117 .of_match_table = xilinx_spi_of_match,
118 }, 118 },
119}; 119};
120 120
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c
index 3537d51073b2..2928523268b5 100644
--- a/drivers/usb/gadget/fsl_qe_udc.c
+++ b/drivers/usb/gadget/fsl_qe_udc.c
@@ -2768,8 +2768,11 @@ static const struct of_device_id qe_udc_match[] __devinitconst = {
2768MODULE_DEVICE_TABLE(of, qe_udc_match); 2768MODULE_DEVICE_TABLE(of, qe_udc_match);
2769 2769
2770static struct of_platform_driver udc_driver = { 2770static struct of_platform_driver udc_driver = {
2771 .name = (char *)driver_name, 2771 .driver = {
2772 .match_table = qe_udc_match, 2772 .name = (char *)driver_name,
2773 .owner = THIS_MODULE,
2774 .of_match_table = qe_udc_match,
2775 },
2773 .probe = qe_udc_probe, 2776 .probe = qe_udc_probe,
2774 .remove = __devexit_p(qe_udc_remove), 2777 .remove = __devexit_p(qe_udc_remove),
2775#ifdef CONFIG_PM 2778#ifdef CONFIG_PM
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c
index 8df33b8a634c..5aec92866ab3 100644
--- a/drivers/usb/host/ehci-ppc-of.c
+++ b/drivers/usb/host/ehci-ppc-of.c
@@ -108,7 +108,7 @@ ppc44x_enable_bmt(struct device_node *dn)
108static int __devinit 108static int __devinit
109ehci_hcd_ppc_of_probe(struct of_device *op, const struct of_device_id *match) 109ehci_hcd_ppc_of_probe(struct of_device *op, const struct of_device_id *match)
110{ 110{
111 struct device_node *dn = op->node; 111 struct device_node *dn = op->dev.of_node;
112 struct usb_hcd *hcd; 112 struct usb_hcd *hcd;
113 struct ehci_hcd *ehci = NULL; 113 struct ehci_hcd *ehci = NULL;
114 struct resource res; 114 struct resource res;
@@ -274,13 +274,12 @@ MODULE_DEVICE_TABLE(of, ehci_hcd_ppc_of_match);
274 274
275 275
276static struct of_platform_driver ehci_hcd_ppc_of_driver = { 276static struct of_platform_driver ehci_hcd_ppc_of_driver = {
277 .name = "ppc-of-ehci",
278 .match_table = ehci_hcd_ppc_of_match,
279 .probe = ehci_hcd_ppc_of_probe, 277 .probe = ehci_hcd_ppc_of_probe,
280 .remove = ehci_hcd_ppc_of_remove, 278 .remove = ehci_hcd_ppc_of_remove,
281 .shutdown = ehci_hcd_ppc_of_shutdown, 279 .shutdown = ehci_hcd_ppc_of_shutdown,
282 .driver = { 280 .driver = {
283 .name = "ppc-of-ehci", 281 .name = "ppc-of-ehci",
284 .owner = THIS_MODULE, 282 .owner = THIS_MODULE,
283 .of_match_table = ehci_hcd_ppc_of_match,
285 }, 284 },
286}; 285};
diff --git a/drivers/usb/host/ehci-xilinx-of.c b/drivers/usb/host/ehci-xilinx-of.c
index f603bb2c0a8e..013972bbde57 100644
--- a/drivers/usb/host/ehci-xilinx-of.c
+++ b/drivers/usb/host/ehci-xilinx-of.c
@@ -288,13 +288,12 @@ static const struct of_device_id ehci_hcd_xilinx_of_match[] = {
288MODULE_DEVICE_TABLE(of, ehci_hcd_xilinx_of_match); 288MODULE_DEVICE_TABLE(of, ehci_hcd_xilinx_of_match);
289 289
290static struct of_platform_driver ehci_hcd_xilinx_of_driver = { 290static struct of_platform_driver ehci_hcd_xilinx_of_driver = {
291 .name = "xilinx-of-ehci",
292 .match_table = ehci_hcd_xilinx_of_match,
293 .probe = ehci_hcd_xilinx_of_probe, 291 .probe = ehci_hcd_xilinx_of_probe,
294 .remove = ehci_hcd_xilinx_of_remove, 292 .remove = ehci_hcd_xilinx_of_remove,
295 .shutdown = ehci_hcd_xilinx_of_shutdown, 293 .shutdown = ehci_hcd_xilinx_of_shutdown,
296 .driver = { 294 .driver = {
297 .name = "xilinx-of-ehci", 295 .name = "xilinx-of-ehci",
298 .owner = THIS_MODULE, 296 .owner = THIS_MODULE,
297 .of_match_table = ehci_hcd_xilinx_of_match,
299 }, 298 },
300}; 299};
diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c
index 90453379a434..c7c8392a88b9 100644
--- a/drivers/usb/host/fhci-hcd.c
+++ b/drivers/usb/host/fhci-hcd.c
@@ -565,7 +565,7 @@ static int __devinit of_fhci_probe(struct of_device *ofdev,
565 const struct of_device_id *ofid) 565 const struct of_device_id *ofid)
566{ 566{
567 struct device *dev = &ofdev->dev; 567 struct device *dev = &ofdev->dev;
568 struct device_node *node = ofdev->node; 568 struct device_node *node = dev->of_node;
569 struct usb_hcd *hcd; 569 struct usb_hcd *hcd;
570 struct fhci_hcd *fhci; 570 struct fhci_hcd *fhci;
571 struct resource usb_regs; 571 struct resource usb_regs;
@@ -670,7 +670,7 @@ static int __devinit of_fhci_probe(struct of_device *ofdev,
670 } 670 }
671 671
672 for (j = 0; j < NUM_PINS; j++) { 672 for (j = 0; j < NUM_PINS; j++) {
673 fhci->pins[j] = qe_pin_request(ofdev->node, j); 673 fhci->pins[j] = qe_pin_request(node, j);
674 if (IS_ERR(fhci->pins[j])) { 674 if (IS_ERR(fhci->pins[j])) {
675 ret = PTR_ERR(fhci->pins[j]); 675 ret = PTR_ERR(fhci->pins[j]);
676 dev_err(dev, "can't get pin %d: %d\n", j, ret); 676 dev_err(dev, "can't get pin %d: %d\n", j, ret);
@@ -813,8 +813,11 @@ static const struct of_device_id of_fhci_match[] = {
813MODULE_DEVICE_TABLE(of, of_fhci_match); 813MODULE_DEVICE_TABLE(of, of_fhci_match);
814 814
815static struct of_platform_driver of_fhci_driver = { 815static struct of_platform_driver of_fhci_driver = {
816 .name = "fsl,usb-fhci", 816 .driver = {
817 .match_table = of_fhci_match, 817 .name = "fsl,usb-fhci",
818 .owner = THIS_MODULE,
819 .of_match_table = of_fhci_match,
820 },
818 .probe = of_fhci_probe, 821 .probe = of_fhci_probe,
819 .remove = __devexit_p(of_fhci_remove), 822 .remove = __devexit_p(of_fhci_remove),
820}; 823};
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
index 8f0259eaa2c7..ec85d0c3cc3e 100644
--- a/drivers/usb/host/isp1760-if.c
+++ b/drivers/usb/host/isp1760-if.c
@@ -31,7 +31,7 @@ static int of_isp1760_probe(struct of_device *dev,
31 const struct of_device_id *match) 31 const struct of_device_id *match)
32{ 32{
33 struct usb_hcd *hcd; 33 struct usb_hcd *hcd;
34 struct device_node *dp = dev->node; 34 struct device_node *dp = dev->dev.of_node;
35 struct resource *res; 35 struct resource *res;
36 struct resource memory; 36 struct resource memory;
37 struct of_irq oirq; 37 struct of_irq oirq;
@@ -120,8 +120,11 @@ static const struct of_device_id of_isp1760_match[] = {
120MODULE_DEVICE_TABLE(of, of_isp1760_match); 120MODULE_DEVICE_TABLE(of, of_isp1760_match);
121 121
122static struct of_platform_driver isp1760_of_driver = { 122static struct of_platform_driver isp1760_of_driver = {
123 .name = "nxp-isp1760", 123 .driver = {
124 .match_table = of_isp1760_match, 124 .name = "nxp-isp1760",
125 .owner = THIS_MODULE,
126 .of_match_table = of_isp1760_match,
127 },
125 .probe = of_isp1760_probe, 128 .probe = of_isp1760_probe,
126 .remove = of_isp1760_remove, 129 .remove = of_isp1760_remove,
127}; 130};
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c
index 103263c230cf..df165917412a 100644
--- a/drivers/usb/host/ohci-ppc-of.c
+++ b/drivers/usb/host/ohci-ppc-of.c
@@ -83,7 +83,7 @@ static const struct hc_driver ohci_ppc_of_hc_driver = {
83static int __devinit 83static int __devinit
84ohci_hcd_ppc_of_probe(struct of_device *op, const struct of_device_id *match) 84ohci_hcd_ppc_of_probe(struct of_device *op, const struct of_device_id *match)
85{ 85{
86 struct device_node *dn = op->node; 86 struct device_node *dn = op->dev.of_node;
87 struct usb_hcd *hcd; 87 struct usb_hcd *hcd;
88 struct ohci_hcd *ohci; 88 struct ohci_hcd *ohci;
89 struct resource res; 89 struct resource res;
@@ -244,18 +244,13 @@ MODULE_DEVICE_TABLE(of, ohci_hcd_ppc_of_match);
244 244
245 245
246static struct of_platform_driver ohci_hcd_ppc_of_driver = { 246static struct of_platform_driver ohci_hcd_ppc_of_driver = {
247 .name = "ppc-of-ohci",
248 .match_table = ohci_hcd_ppc_of_match,
249 .probe = ohci_hcd_ppc_of_probe, 247 .probe = ohci_hcd_ppc_of_probe,
250 .remove = ohci_hcd_ppc_of_remove, 248 .remove = ohci_hcd_ppc_of_remove,
251 .shutdown = ohci_hcd_ppc_of_shutdown, 249 .shutdown = ohci_hcd_ppc_of_shutdown,
252#ifdef CONFIG_PM 250 .driver = {
253 /*.suspend = ohci_hcd_ppc_soc_drv_suspend,*/ 251 .name = "ppc-of-ohci",
254 /*.resume = ohci_hcd_ppc_soc_drv_resume,*/ 252 .owner = THIS_MODULE,
255#endif 253 .of_match_table = ohci_hcd_ppc_of_match,
256 .driver = {
257 .name = "ppc-of-ohci",
258 .owner = THIS_MODULE,
259 }, 254 },
260}; 255};
261 256
diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c
index 43320925c4ce..2c371c07f0da 100644
--- a/drivers/video/bw2.c
+++ b/drivers/video/bw2.c
@@ -376,8 +376,11 @@ static const struct of_device_id bw2_match[] = {
376MODULE_DEVICE_TABLE(of, bw2_match); 376MODULE_DEVICE_TABLE(of, bw2_match);
377 377
378static struct of_platform_driver bw2_driver = { 378static struct of_platform_driver bw2_driver = {
379 .name = "bw2", 379 .driver = {
380 .match_table = bw2_match, 380 .name = "bw2",
381 .owner = THIS_MODULE,
382 .of_match_table = bw2_match,
383 },
381 .probe = bw2_probe, 384 .probe = bw2_probe,
382 .remove = __devexit_p(bw2_remove), 385 .remove = __devexit_p(bw2_remove),
383}; 386};
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c
index 77a040af20a7..d12e05b6e63f 100644
--- a/drivers/video/cg14.c
+++ b/drivers/video/cg14.c
@@ -596,8 +596,11 @@ static const struct of_device_id cg14_match[] = {
596MODULE_DEVICE_TABLE(of, cg14_match); 596MODULE_DEVICE_TABLE(of, cg14_match);
597 597
598static struct of_platform_driver cg14_driver = { 598static struct of_platform_driver cg14_driver = {
599 .name = "cg14", 599 .driver = {
600 .match_table = cg14_match, 600 .name = "cg14",
601 .owner = THIS_MODULE,
602 .of_match_table = cg14_match,
603 },
601 .probe = cg14_probe, 604 .probe = cg14_probe,
602 .remove = __devexit_p(cg14_remove), 605 .remove = __devexit_p(cg14_remove),
603}; 606};
diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c
index 30eedf79322c..b98f93f7f663 100644
--- a/drivers/video/cg3.c
+++ b/drivers/video/cg3.c
@@ -463,8 +463,11 @@ static const struct of_device_id cg3_match[] = {
463MODULE_DEVICE_TABLE(of, cg3_match); 463MODULE_DEVICE_TABLE(of, cg3_match);
464 464
465static struct of_platform_driver cg3_driver = { 465static struct of_platform_driver cg3_driver = {
466 .name = "cg3", 466 .driver = {
467 .match_table = cg3_match, 467 .name = "cg3",
468 .owner = THIS_MODULE,
469 .of_match_table = cg3_match,
470 },
468 .probe = cg3_probe, 471 .probe = cg3_probe,
469 .remove = __devexit_p(cg3_remove), 472 .remove = __devexit_p(cg3_remove),
470}; 473};
diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c
index 6d0fcb43696e..480d761a27a8 100644
--- a/drivers/video/cg6.c
+++ b/drivers/video/cg6.c
@@ -740,7 +740,7 @@ static void cg6_unmap_regs(struct of_device *op, struct fb_info *info,
740static int __devinit cg6_probe(struct of_device *op, 740static int __devinit cg6_probe(struct of_device *op,
741 const struct of_device_id *match) 741 const struct of_device_id *match)
742{ 742{
743 struct device_node *dp = op->node; 743 struct device_node *dp = op->dev.of_node;
744 struct fb_info *info; 744 struct fb_info *info;
745 struct cg6_par *par; 745 struct cg6_par *par;
746 int linebytes, err; 746 int linebytes, err;
@@ -856,8 +856,11 @@ static const struct of_device_id cg6_match[] = {
856MODULE_DEVICE_TABLE(of, cg6_match); 856MODULE_DEVICE_TABLE(of, cg6_match);
857 857
858static struct of_platform_driver cg6_driver = { 858static struct of_platform_driver cg6_driver = {
859 .name = "cg6", 859 .driver = {
860 .match_table = cg6_match, 860 .name = "cg6",
861 .owner = THIS_MODULE,
862 .of_match_table = cg6_match,
863 },
861 .probe = cg6_probe, 864 .probe = cg6_probe,
862 .remove = __devexit_p(cg6_remove), 865 .remove = __devexit_p(cg6_remove),
863}; 866};
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c
index a42fabab69df..95c0227f47fc 100644
--- a/drivers/video/ffb.c
+++ b/drivers/video/ffb.c
@@ -896,7 +896,7 @@ static void ffb_init_fix(struct fb_info *info)
896static int __devinit ffb_probe(struct of_device *op, 896static int __devinit ffb_probe(struct of_device *op,
897 const struct of_device_id *match) 897 const struct of_device_id *match)
898{ 898{
899 struct device_node *dp = op->node; 899 struct device_node *dp = op->dev.of_node;
900 struct ffb_fbc __iomem *fbc; 900 struct ffb_fbc __iomem *fbc;
901 struct ffb_dac __iomem *dac; 901 struct ffb_dac __iomem *dac;
902 struct fb_info *info; 902 struct fb_info *info;
@@ -1053,8 +1053,11 @@ static const struct of_device_id ffb_match[] = {
1053MODULE_DEVICE_TABLE(of, ffb_match); 1053MODULE_DEVICE_TABLE(of, ffb_match);
1054 1054
1055static struct of_platform_driver ffb_driver = { 1055static struct of_platform_driver ffb_driver = {
1056 .name = "ffb", 1056 .driver = {
1057 .match_table = ffb_match, 1057 .name = "ffb",
1058 .owner = THIS_MODULE,
1059 .of_match_table = ffb_match,
1060 },
1058 .probe = ffb_probe, 1061 .probe = ffb_probe,
1059 .remove = __devexit_p(ffb_remove), 1062 .remove = __devexit_p(ffb_remove),
1060}; 1063};
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index 994358a4f302..27455ce298b7 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -1421,7 +1421,7 @@ static ssize_t show_monitor(struct device *device,
1421static int __devinit fsl_diu_probe(struct of_device *ofdev, 1421static int __devinit fsl_diu_probe(struct of_device *ofdev,
1422 const struct of_device_id *match) 1422 const struct of_device_id *match)
1423{ 1423{
1424 struct device_node *np = ofdev->node; 1424 struct device_node *np = ofdev->dev.of_node;
1425 struct mfb_info *mfbi; 1425 struct mfb_info *mfbi;
1426 phys_addr_t dummy_ad_addr; 1426 phys_addr_t dummy_ad_addr;
1427 int ret, i, error = 0; 1427 int ret, i, error = 0;
@@ -1647,9 +1647,11 @@ static struct of_device_id fsl_diu_match[] = {
1647MODULE_DEVICE_TABLE(of, fsl_diu_match); 1647MODULE_DEVICE_TABLE(of, fsl_diu_match);
1648 1648
1649static struct of_platform_driver fsl_diu_driver = { 1649static struct of_platform_driver fsl_diu_driver = {
1650 .owner = THIS_MODULE, 1650 .driver = {
1651 .name = "fsl_diu", 1651 .name = "fsl_diu",
1652 .match_table = fsl_diu_match, 1652 .owner = THIS_MODULE,
1653 .of_match_table = fsl_diu_match,
1654 },
1653 .probe = fsl_diu_probe, 1655 .probe = fsl_diu_probe,
1654 .remove = fsl_diu_remove, 1656 .remove = fsl_diu_remove,
1655 .suspend = fsl_diu_suspend, 1657 .suspend = fsl_diu_suspend,
diff --git a/drivers/video/leo.c b/drivers/video/leo.c
index 1db55f128490..3d7895316eaf 100644
--- a/drivers/video/leo.c
+++ b/drivers/video/leo.c
@@ -663,8 +663,11 @@ static const struct of_device_id leo_match[] = {
663MODULE_DEVICE_TABLE(of, leo_match); 663MODULE_DEVICE_TABLE(of, leo_match);
664 664
665static struct of_platform_driver leo_driver = { 665static struct of_platform_driver leo_driver = {
666 .name = "leo", 666 .driver = {
667 .match_table = leo_match, 667 .name = "leo",
668 .owner = THIS_MODULE,
669 .of_match_table = leo_match,
670 },
668 .probe = leo_probe, 671 .probe = leo_probe,
669 .remove = __devexit_p(leo_remove), 672 .remove = __devexit_p(leo_remove),
670}; 673};
diff --git a/drivers/video/mb862xx/mb862xxfb.c b/drivers/video/mb862xx/mb862xxfb.c
index 8280a58a0e55..0540de4f5cb4 100644
--- a/drivers/video/mb862xx/mb862xxfb.c
+++ b/drivers/video/mb862xx/mb862xxfb.c
@@ -718,9 +718,11 @@ static struct of_device_id __devinitdata of_platform_mb862xx_tbl[] = {
718}; 718};
719 719
720static struct of_platform_driver of_platform_mb862xxfb_driver = { 720static struct of_platform_driver of_platform_mb862xxfb_driver = {
721 .owner = THIS_MODULE, 721 .driver = {
722 .name = DRV_NAME, 722 .name = DRV_NAME,
723 .match_table = of_platform_mb862xx_tbl, 723 .owner = THIS_MODULE,
724 .of_match_table = of_platform_mb862xx_tbl,
725 },
724 .probe = of_platform_mb862xx_probe, 726 .probe = of_platform_mb862xx_probe,
725 .remove = __devexit_p(of_platform_mb862xx_remove), 727 .remove = __devexit_p(of_platform_mb862xx_remove),
726}; 728};
diff --git a/drivers/video/p9100.c b/drivers/video/p9100.c
index 81440f2b9091..c85dd408a9b8 100644
--- a/drivers/video/p9100.c
+++ b/drivers/video/p9100.c
@@ -353,8 +353,11 @@ static const struct of_device_id p9100_match[] = {
353MODULE_DEVICE_TABLE(of, p9100_match); 353MODULE_DEVICE_TABLE(of, p9100_match);
354 354
355static struct of_platform_driver p9100_driver = { 355static struct of_platform_driver p9100_driver = {
356 .name = "p9100", 356 .driver = {
357 .match_table = p9100_match, 357 .name = "p9100",
358 .owner = THIS_MODULE,
359 .of_match_table = p9100_match,
360 },
358 .probe = p9100_probe, 361 .probe = p9100_probe,
359 .remove = __devexit_p(p9100_remove), 362 .remove = __devexit_p(p9100_remove),
360}; 363};
diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c
index 8a204e7a5b5b..72a1f4c04732 100644
--- a/drivers/video/platinumfb.c
+++ b/drivers/video/platinumfb.c
@@ -536,7 +536,7 @@ static int __init platinumfb_setup(char *options)
536static int __devinit platinumfb_probe(struct of_device* odev, 536static int __devinit platinumfb_probe(struct of_device* odev,
537 const struct of_device_id *match) 537 const struct of_device_id *match)
538{ 538{
539 struct device_node *dp = odev->node; 539 struct device_node *dp = odev->dev.of_node;
540 struct fb_info *info; 540 struct fb_info *info;
541 struct fb_info_platinum *pinfo; 541 struct fb_info_platinum *pinfo;
542 volatile __u8 *fbuffer; 542 volatile __u8 *fbuffer;
@@ -679,8 +679,11 @@ static struct of_device_id platinumfb_match[] =
679 679
680static struct of_platform_driver platinum_driver = 680static struct of_platform_driver platinum_driver =
681{ 681{
682 .name = "platinumfb", 682 .driver = {
683 .match_table = platinumfb_match, 683 .name = "platinumfb",
684 .owner = THIS_MODULE,
685 .of_match_table = platinumfb_match,
686 },
684 .probe = platinumfb_probe, 687 .probe = platinumfb_probe,
685 .remove = platinumfb_remove, 688 .remove = platinumfb_remove,
686}; 689};
diff --git a/drivers/video/sunxvr1000.c b/drivers/video/sunxvr1000.c
index 23e69e834a18..489b44e8db81 100644
--- a/drivers/video/sunxvr1000.c
+++ b/drivers/video/sunxvr1000.c
@@ -114,7 +114,7 @@ static int __devinit gfb_set_fbinfo(struct gfb_info *gp)
114static int __devinit gfb_probe(struct of_device *op, 114static int __devinit gfb_probe(struct of_device *op,
115 const struct of_device_id *match) 115 const struct of_device_id *match)
116{ 116{
117 struct device_node *dp = op->node; 117 struct device_node *dp = op->dev.of_node;
118 struct fb_info *info; 118 struct fb_info *info;
119 struct gfb_info *gp; 119 struct gfb_info *gp;
120 int err; 120 int err;
@@ -199,10 +199,13 @@ static const struct of_device_id gfb_match[] = {
199MODULE_DEVICE_TABLE(of, ffb_match); 199MODULE_DEVICE_TABLE(of, ffb_match);
200 200
201static struct of_platform_driver gfb_driver = { 201static struct of_platform_driver gfb_driver = {
202 .name = "gfb",
203 .match_table = gfb_match,
204 .probe = gfb_probe, 202 .probe = gfb_probe,
205 .remove = __devexit_p(gfb_remove), 203 .remove = __devexit_p(gfb_remove),
204 .driver = {
205 .name = "gfb",
206 .owner = THIS_MODULE,
207 .of_match_table = gfb_match,
208 },
206}; 209};
207 210
208static int __init gfb_init(void) 211static int __init gfb_init(void)
diff --git a/drivers/video/tcx.c b/drivers/video/tcx.c
index c0c2b18fcdcf..ef7a7bd8b503 100644
--- a/drivers/video/tcx.c
+++ b/drivers/video/tcx.c
@@ -512,8 +512,11 @@ static const struct of_device_id tcx_match[] = {
512MODULE_DEVICE_TABLE(of, tcx_match); 512MODULE_DEVICE_TABLE(of, tcx_match);
513 513
514static struct of_platform_driver tcx_driver = { 514static struct of_platform_driver tcx_driver = {
515 .name = "tcx", 515 .driver = {
516 .match_table = tcx_match, 516 .name = "tcx",
517 .owner = THIS_MODULE,
518 .of_match_table = tcx_match,
519 },
517 .probe = tcx_probe, 520 .probe = tcx_probe,
518 .remove = __devexit_p(tcx_remove), 521 .remove = __devexit_p(tcx_remove),
519}; 522};
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index 3fcb83f03881..574dc54e12d4 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -423,7 +423,7 @@ xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match)
423 * To check whether the core is connected directly to DCR or PLB 423 * To check whether the core is connected directly to DCR or PLB
424 * interface and initialize the tft_access accordingly. 424 * interface and initialize the tft_access accordingly.
425 */ 425 */
426 p = (u32 *)of_get_property(op->node, "xlnx,dcr-splb-slave-if", NULL); 426 p = (u32 *)of_get_property(op->dev.of_node, "xlnx,dcr-splb-slave-if", NULL);
427 tft_access = p ? *p : 0; 427 tft_access = p ? *p : 0;
428 428
429 /* 429 /*
@@ -432,41 +432,41 @@ xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match)
432 */ 432 */
433 if (tft_access) { 433 if (tft_access) {
434 drvdata->flags |= PLB_ACCESS_FLAG; 434 drvdata->flags |= PLB_ACCESS_FLAG;
435 rc = of_address_to_resource(op->node, 0, &res); 435 rc = of_address_to_resource(op->dev.of_node, 0, &res);
436 if (rc) { 436 if (rc) {
437 dev_err(&op->dev, "invalid address\n"); 437 dev_err(&op->dev, "invalid address\n");
438 goto err; 438 goto err;
439 } 439 }
440 } else { 440 } else {
441 res.start = 0; 441 res.start = 0;
442 start = dcr_resource_start(op->node, 0); 442 start = dcr_resource_start(op->dev.of_node, 0);
443 drvdata->dcr_len = dcr_resource_len(op->node, 0); 443 drvdata->dcr_len = dcr_resource_len(op->dev.of_node, 0);
444 drvdata->dcr_host = dcr_map(op->node, start, drvdata->dcr_len); 444 drvdata->dcr_host = dcr_map(op->dev.of_node, start, drvdata->dcr_len);
445 if (!DCR_MAP_OK(drvdata->dcr_host)) { 445 if (!DCR_MAP_OK(drvdata->dcr_host)) {
446 dev_err(&op->dev, "invalid DCR address\n"); 446 dev_err(&op->dev, "invalid DCR address\n");
447 goto err; 447 goto err;
448 } 448 }
449 } 449 }
450 450
451 prop = of_get_property(op->node, "phys-size", &size); 451 prop = of_get_property(op->dev.of_node, "phys-size", &size);
452 if ((prop) && (size >= sizeof(u32)*2)) { 452 if ((prop) && (size >= sizeof(u32)*2)) {
453 pdata.screen_width_mm = prop[0]; 453 pdata.screen_width_mm = prop[0];
454 pdata.screen_height_mm = prop[1]; 454 pdata.screen_height_mm = prop[1];
455 } 455 }
456 456
457 prop = of_get_property(op->node, "resolution", &size); 457 prop = of_get_property(op->dev.of_node, "resolution", &size);
458 if ((prop) && (size >= sizeof(u32)*2)) { 458 if ((prop) && (size >= sizeof(u32)*2)) {
459 pdata.xres = prop[0]; 459 pdata.xres = prop[0];
460 pdata.yres = prop[1]; 460 pdata.yres = prop[1];
461 } 461 }
462 462
463 prop = of_get_property(op->node, "virtual-resolution", &size); 463 prop = of_get_property(op->dev.of_node, "virtual-resolution", &size);
464 if ((prop) && (size >= sizeof(u32)*2)) { 464 if ((prop) && (size >= sizeof(u32)*2)) {
465 pdata.xvirt = prop[0]; 465 pdata.xvirt = prop[0];
466 pdata.yvirt = prop[1]; 466 pdata.yvirt = prop[1];
467 } 467 }
468 468
469 if (of_find_property(op->node, "rotate-display", NULL)) 469 if (of_find_property(op->dev.of_node, "rotate-display", NULL))
470 pdata.rotate_screen = 1; 470 pdata.rotate_screen = 1;
471 471
472 dev_set_drvdata(&op->dev, drvdata); 472 dev_set_drvdata(&op->dev, drvdata);
@@ -492,13 +492,12 @@ static struct of_device_id xilinxfb_of_match[] __devinitdata = {
492MODULE_DEVICE_TABLE(of, xilinxfb_of_match); 492MODULE_DEVICE_TABLE(of, xilinxfb_of_match);
493 493
494static struct of_platform_driver xilinxfb_of_driver = { 494static struct of_platform_driver xilinxfb_of_driver = {
495 .owner = THIS_MODULE,
496 .name = DRIVER_NAME,
497 .match_table = xilinxfb_of_match,
498 .probe = xilinxfb_of_probe, 495 .probe = xilinxfb_of_probe,
499 .remove = __devexit_p(xilinxfb_of_remove), 496 .remove = __devexit_p(xilinxfb_of_remove),
500 .driver = { 497 .driver = {
501 .name = DRIVER_NAME, 498 .name = DRIVER_NAME,
499 .owner = THIS_MODULE,
500 .of_match_table = xilinxfb_of_match,
502 }, 501 },
503}; 502};
504 503
diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c
index ba2efce4b40e..d62b9ce8f773 100644
--- a/drivers/watchdog/cpwd.c
+++ b/drivers/watchdog/cpwd.c
@@ -577,7 +577,7 @@ static int __devinit cpwd_probe(struct of_device *op,
577 * interrupt_mask register cannot be written, so no timer 577 * interrupt_mask register cannot be written, so no timer
578 * interrupts can be masked within the PLD. 578 * interrupts can be masked within the PLD.
579 */ 579 */
580 str_prop = of_get_property(op->node, "model", NULL); 580 str_prop = of_get_property(op->dev.of_node, "model", NULL);
581 p->broken = (str_prop && !strcmp(str_prop, WD_BADMODEL)); 581 p->broken = (str_prop && !strcmp(str_prop, WD_BADMODEL));
582 582
583 if (!p->enabled) 583 if (!p->enabled)
@@ -677,8 +677,11 @@ static const struct of_device_id cpwd_match[] = {
677MODULE_DEVICE_TABLE(of, cpwd_match); 677MODULE_DEVICE_TABLE(of, cpwd_match);
678 678
679static struct of_platform_driver cpwd_driver = { 679static struct of_platform_driver cpwd_driver = {
680 .name = DRIVER_NAME, 680 .driver = {
681 .match_table = cpwd_match, 681 .name = DRIVER_NAME,
682 .owner = THIS_MODULE,
683 .of_match_table = cpwd_match,
684 },
682 .probe = cpwd_probe, 685 .probe = cpwd_probe,
683 .remove = __devexit_p(cpwd_remove), 686 .remove = __devexit_p(cpwd_remove),
684}; 687};
diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c
index abdbad034a6c..ca0f4c6cf5ab 100644
--- a/drivers/watchdog/gef_wdt.c
+++ b/drivers/watchdog/gef_wdt.c
@@ -303,9 +303,11 @@ static const struct of_device_id gef_wdt_ids[] = {
303}; 303};
304 304
305static struct of_platform_driver gef_wdt_driver = { 305static struct of_platform_driver gef_wdt_driver = {
306 .owner = THIS_MODULE, 306 .driver = {
307 .name = "gef_wdt", 307 .name = "gef_wdt",
308 .match_table = gef_wdt_ids, 308 .owner = THIS_MODULE,
309 .of_match_table = gef_wdt_ids,
310 },
309 .probe = gef_wdt_probe, 311 .probe = gef_wdt_probe,
310}; 312};
311 313
diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
index 4e3941c5e293..7b55974191dd 100644
--- a/drivers/watchdog/mpc8xxx_wdt.c
+++ b/drivers/watchdog/mpc8xxx_wdt.c
@@ -273,12 +273,12 @@ static const struct of_device_id mpc8xxx_wdt_match[] = {
273MODULE_DEVICE_TABLE(of, mpc8xxx_wdt_match); 273MODULE_DEVICE_TABLE(of, mpc8xxx_wdt_match);
274 274
275static struct of_platform_driver mpc8xxx_wdt_driver = { 275static struct of_platform_driver mpc8xxx_wdt_driver = {
276 .match_table = mpc8xxx_wdt_match,
277 .probe = mpc8xxx_wdt_probe, 276 .probe = mpc8xxx_wdt_probe,
278 .remove = __devexit_p(mpc8xxx_wdt_remove), 277 .remove = __devexit_p(mpc8xxx_wdt_remove),
279 .driver = { 278 .driver = {
280 .name = "mpc8xxx_wdt", 279 .name = "mpc8xxx_wdt",
281 .owner = THIS_MODULE, 280 .owner = THIS_MODULE,
281 .of_match_table = mpc8xxx_wdt_match,
282 }, 282 },
283}; 283};
284 284
diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c
index ea7f803f6248..5dceeddc8859 100644
--- a/drivers/watchdog/riowd.c
+++ b/drivers/watchdog/riowd.c
@@ -239,8 +239,11 @@ static const struct of_device_id riowd_match[] = {
239MODULE_DEVICE_TABLE(of, riowd_match); 239MODULE_DEVICE_TABLE(of, riowd_match);
240 240
241static struct of_platform_driver riowd_driver = { 241static struct of_platform_driver riowd_driver = {
242 .name = DRIVER_NAME, 242 .driver = {
243 .match_table = riowd_match, 243 .name = DRIVER_NAME,
244 .owner = THIS_MODULE,
245 .of_match_table = riowd_match,
246 },
244 .probe = riowd_probe, 247 .probe = riowd_probe,
245 .remove = __devexit_p(riowd_remove), 248 .remove = __devexit_p(riowd_remove),
246}; 249};
diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h
index ed835836e0dc..32ef4009d030 100644
--- a/fs/9p/v9fs_vfs.h
+++ b/fs/9p/v9fs_vfs.h
@@ -40,7 +40,9 @@
40extern struct file_system_type v9fs_fs_type; 40extern struct file_system_type v9fs_fs_type;
41extern const struct address_space_operations v9fs_addr_operations; 41extern const struct address_space_operations v9fs_addr_operations;
42extern const struct file_operations v9fs_file_operations; 42extern const struct file_operations v9fs_file_operations;
43extern const struct file_operations v9fs_file_operations_dotl;
43extern const struct file_operations v9fs_dir_operations; 44extern const struct file_operations v9fs_dir_operations;
45extern const struct file_operations v9fs_dir_operations_dotl;
44extern const struct dentry_operations v9fs_dentry_operations; 46extern const struct dentry_operations v9fs_dentry_operations;
45extern const struct dentry_operations v9fs_cached_dentry_operations; 47extern const struct dentry_operations v9fs_cached_dentry_operations;
46 48
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 0adfd64dfcee..d61e3b28ce37 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -203,3 +203,11 @@ const struct file_operations v9fs_dir_operations = {
203 .open = v9fs_file_open, 203 .open = v9fs_file_open,
204 .release = v9fs_dir_release, 204 .release = v9fs_dir_release,
205}; 205};
206
207const struct file_operations v9fs_dir_operations_dotl = {
208 .read = generic_read_dir,
209 .llseek = generic_file_llseek,
210 .readdir = v9fs_dir_readdir,
211 .open = v9fs_file_open,
212 .release = v9fs_dir_release,
213};
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index df52d488d2a6..25b300e1c9d7 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -296,3 +296,14 @@ const struct file_operations v9fs_file_operations = {
296 .mmap = generic_file_readonly_mmap, 296 .mmap = generic_file_readonly_mmap,
297 .fsync = v9fs_file_fsync, 297 .fsync = v9fs_file_fsync,
298}; 298};
299
300const struct file_operations v9fs_file_operations_dotl = {
301 .llseek = generic_file_llseek,
302 .read = v9fs_file_read,
303 .write = v9fs_file_write,
304 .open = v9fs_file_open,
305 .release = v9fs_dir_release,
306 .lock = v9fs_file_lock,
307 .mmap = generic_file_readonly_mmap,
308 .fsync = v9fs_file_fsync,
309};
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 6d4d86187c55..4331b3b5ee1c 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -44,9 +44,12 @@
44#include "cache.h" 44#include "cache.h"
45 45
46static const struct inode_operations v9fs_dir_inode_operations; 46static const struct inode_operations v9fs_dir_inode_operations;
47static const struct inode_operations v9fs_dir_inode_operations_ext; 47static const struct inode_operations v9fs_dir_inode_operations_dotu;
48static const struct inode_operations v9fs_dir_inode_operations_dotl;
48static const struct inode_operations v9fs_file_inode_operations; 49static const struct inode_operations v9fs_file_inode_operations;
50static const struct inode_operations v9fs_file_inode_operations_dotl;
49static const struct inode_operations v9fs_symlink_inode_operations; 51static const struct inode_operations v9fs_symlink_inode_operations;
52static const struct inode_operations v9fs_symlink_inode_operations_dotl;
50 53
51/** 54/**
52 * unixmode2p9mode - convert unix mode bits to plan 9 55 * unixmode2p9mode - convert unix mode bits to plan 9
@@ -273,25 +276,44 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode)
273 init_special_inode(inode, inode->i_mode, inode->i_rdev); 276 init_special_inode(inode, inode->i_mode, inode->i_rdev);
274 break; 277 break;
275 case S_IFREG: 278 case S_IFREG:
276 inode->i_op = &v9fs_file_inode_operations; 279 if (v9fs_proto_dotl(v9ses)) {
277 inode->i_fop = &v9fs_file_operations; 280 inode->i_op = &v9fs_file_inode_operations_dotl;
281 inode->i_fop = &v9fs_file_operations_dotl;
282 } else {
283 inode->i_op = &v9fs_file_inode_operations;
284 inode->i_fop = &v9fs_file_operations;
285 }
286
278 break; 287 break;
288
279 case S_IFLNK: 289 case S_IFLNK:
280 if (!v9fs_proto_dotu(v9ses)) { 290 if (!v9fs_proto_dotu(v9ses) && !v9fs_proto_dotl(v9ses)) {
281 P9_DPRINTK(P9_DEBUG_ERROR, 291 P9_DPRINTK(P9_DEBUG_ERROR, "extended modes used with "
282 "extended modes used w/o 9P2000.u\n"); 292 "legacy protocol.\n");
283 err = -EINVAL; 293 err = -EINVAL;
284 goto error; 294 goto error;
285 } 295 }
286 inode->i_op = &v9fs_symlink_inode_operations; 296
297 if (v9fs_proto_dotl(v9ses))
298 inode->i_op = &v9fs_symlink_inode_operations_dotl;
299 else
300 inode->i_op = &v9fs_symlink_inode_operations;
301
287 break; 302 break;
288 case S_IFDIR: 303 case S_IFDIR:
289 inc_nlink(inode); 304 inc_nlink(inode);
290 if (v9fs_proto_dotu(v9ses)) 305 if (v9fs_proto_dotl(v9ses))
291 inode->i_op = &v9fs_dir_inode_operations_ext; 306 inode->i_op = &v9fs_dir_inode_operations_dotl;
307 else if (v9fs_proto_dotu(v9ses))
308 inode->i_op = &v9fs_dir_inode_operations_dotu;
292 else 309 else
293 inode->i_op = &v9fs_dir_inode_operations; 310 inode->i_op = &v9fs_dir_inode_operations;
294 inode->i_fop = &v9fs_dir_operations; 311
312 if (v9fs_proto_dotl(v9ses))
313 inode->i_fop = &v9fs_dir_operations_dotl;
314 else
315 inode->i_fop = &v9fs_dir_operations;
316
295 break; 317 break;
296 default: 318 default:
297 P9_DPRINTK(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n", 319 P9_DPRINTK(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n",
@@ -432,14 +454,12 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
432{ 454{
433 int retval; 455 int retval;
434 struct inode *file_inode; 456 struct inode *file_inode;
435 struct v9fs_session_info *v9ses;
436 struct p9_fid *v9fid; 457 struct p9_fid *v9fid;
437 458
438 P9_DPRINTK(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %d\n", dir, file, 459 P9_DPRINTK(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %d\n", dir, file,
439 rmdir); 460 rmdir);
440 461
441 file_inode = file->d_inode; 462 file_inode = file->d_inode;
442 v9ses = v9fs_inode2v9ses(file_inode);
443 v9fid = v9fs_fid_clone(file); 463 v9fid = v9fs_fid_clone(file);
444 if (IS_ERR(v9fid)) 464 if (IS_ERR(v9fid))
445 return PTR_ERR(v9fid); 465 return PTR_ERR(v9fid);
@@ -482,12 +502,11 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
482 ofid = NULL; 502 ofid = NULL;
483 fid = NULL; 503 fid = NULL;
484 name = (char *) dentry->d_name.name; 504 name = (char *) dentry->d_name.name;
485 dfid = v9fs_fid_clone(dentry->d_parent); 505 dfid = v9fs_fid_lookup(dentry->d_parent);
486 if (IS_ERR(dfid)) { 506 if (IS_ERR(dfid)) {
487 err = PTR_ERR(dfid); 507 err = PTR_ERR(dfid);
488 P9_DPRINTK(P9_DEBUG_VFS, "fid clone failed %d\n", err); 508 P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
489 dfid = NULL; 509 return ERR_PTR(err);
490 goto error;
491 } 510 }
492 511
493 /* clone a fid to use for creation */ 512 /* clone a fid to use for creation */
@@ -495,8 +514,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
495 if (IS_ERR(ofid)) { 514 if (IS_ERR(ofid)) {
496 err = PTR_ERR(ofid); 515 err = PTR_ERR(ofid);
497 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); 516 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
498 ofid = NULL; 517 return ERR_PTR(err);
499 goto error;
500 } 518 }
501 519
502 err = p9_client_fcreate(ofid, name, perm, mode, extension); 520 err = p9_client_fcreate(ofid, name, perm, mode, extension);
@@ -506,14 +524,13 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
506 } 524 }
507 525
508 /* now walk from the parent so we can get unopened fid */ 526 /* now walk from the parent so we can get unopened fid */
509 fid = p9_client_walk(dfid, 1, &name, 0); 527 fid = p9_client_walk(dfid, 1, &name, 1);
510 if (IS_ERR(fid)) { 528 if (IS_ERR(fid)) {
511 err = PTR_ERR(fid); 529 err = PTR_ERR(fid);
512 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); 530 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
513 fid = NULL; 531 fid = NULL;
514 goto error; 532 goto error;
515 } else 533 }
516 dfid = NULL;
517 534
518 /* instantiate inode and assign the unopened fid to the dentry */ 535 /* instantiate inode and assign the unopened fid to the dentry */
519 inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb); 536 inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb);
@@ -536,9 +553,6 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
536 return ofid; 553 return ofid;
537 554
538error: 555error:
539 if (dfid)
540 p9_client_clunk(dfid);
541
542 if (ofid) 556 if (ofid)
543 p9_client_clunk(ofid); 557 p9_client_clunk(ofid);
544 558
@@ -673,8 +687,8 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
673 if (IS_ERR(fid)) { 687 if (IS_ERR(fid)) {
674 result = PTR_ERR(fid); 688 result = PTR_ERR(fid);
675 if (result == -ENOENT) { 689 if (result == -ENOENT) {
676 d_add(dentry, NULL); 690 inode = NULL;
677 return NULL; 691 goto inst_out;
678 } 692 }
679 693
680 return ERR_PTR(result); 694 return ERR_PTR(result);
@@ -691,7 +705,8 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
691 if (result < 0) 705 if (result < 0)
692 goto error; 706 goto error;
693 707
694 if ((fid->qid.version) && (v9ses->cache)) 708inst_out:
709 if (v9ses->cache)
695 dentry->d_op = &v9fs_cached_dentry_operations; 710 dentry->d_op = &v9fs_cached_dentry_operations;
696 else 711 else
697 dentry->d_op = &v9fs_dentry_operations; 712 dentry->d_op = &v9fs_dentry_operations;
@@ -770,6 +785,13 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
770 goto clunk_olddir; 785 goto clunk_olddir;
771 } 786 }
772 787
788 if (v9fs_proto_dotl(v9ses)) {
789 retval = p9_client_rename(oldfid, newdirfid,
790 (char *) new_dentry->d_name.name);
791 if (retval != -ENOSYS)
792 goto clunk_newdir;
793 }
794
773 /* 9P can only handle file rename in the same directory */ 795 /* 9P can only handle file rename in the same directory */
774 if (memcmp(&olddirfid->qid, &newdirfid->qid, sizeof(newdirfid->qid))) { 796 if (memcmp(&olddirfid->qid, &newdirfid->qid, sizeof(newdirfid->qid))) {
775 P9_DPRINTK(P9_DEBUG_ERROR, 797 P9_DPRINTK(P9_DEBUG_ERROR,
@@ -1195,6 +1217,8 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
1195 sprintf(name, "c %u %u", MAJOR(rdev), MINOR(rdev)); 1217 sprintf(name, "c %u %u", MAJOR(rdev), MINOR(rdev));
1196 else if (S_ISFIFO(mode)) 1218 else if (S_ISFIFO(mode))
1197 *name = 0; 1219 *name = 0;
1220 else if (S_ISSOCK(mode))
1221 *name = 0;
1198 else { 1222 else {
1199 __putname(name); 1223 __putname(name);
1200 return -EINVAL; 1224 return -EINVAL;
@@ -1206,7 +1230,21 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
1206 return retval; 1230 return retval;
1207} 1231}
1208 1232
1209static const struct inode_operations v9fs_dir_inode_operations_ext = { 1233static const struct inode_operations v9fs_dir_inode_operations_dotu = {
1234 .create = v9fs_vfs_create,
1235 .lookup = v9fs_vfs_lookup,
1236 .symlink = v9fs_vfs_symlink,
1237 .link = v9fs_vfs_link,
1238 .unlink = v9fs_vfs_unlink,
1239 .mkdir = v9fs_vfs_mkdir,
1240 .rmdir = v9fs_vfs_rmdir,
1241 .mknod = v9fs_vfs_mknod,
1242 .rename = v9fs_vfs_rename,
1243 .getattr = v9fs_vfs_getattr,
1244 .setattr = v9fs_vfs_setattr,
1245};
1246
1247static const struct inode_operations v9fs_dir_inode_operations_dotl = {
1210 .create = v9fs_vfs_create, 1248 .create = v9fs_vfs_create,
1211 .lookup = v9fs_vfs_lookup, 1249 .lookup = v9fs_vfs_lookup,
1212 .symlink = v9fs_vfs_symlink, 1250 .symlink = v9fs_vfs_symlink,
@@ -1237,6 +1275,11 @@ static const struct inode_operations v9fs_file_inode_operations = {
1237 .setattr = v9fs_vfs_setattr, 1275 .setattr = v9fs_vfs_setattr,
1238}; 1276};
1239 1277
1278static const struct inode_operations v9fs_file_inode_operations_dotl = {
1279 .getattr = v9fs_vfs_getattr,
1280 .setattr = v9fs_vfs_setattr,
1281};
1282
1240static const struct inode_operations v9fs_symlink_inode_operations = { 1283static const struct inode_operations v9fs_symlink_inode_operations = {
1241 .readlink = generic_readlink, 1284 .readlink = generic_readlink,
1242 .follow_link = v9fs_vfs_follow_link, 1285 .follow_link = v9fs_vfs_follow_link,
@@ -1244,3 +1287,11 @@ static const struct inode_operations v9fs_symlink_inode_operations = {
1244 .getattr = v9fs_vfs_getattr, 1287 .getattr = v9fs_vfs_getattr,
1245 .setattr = v9fs_vfs_setattr, 1288 .setattr = v9fs_vfs_setattr,
1246}; 1289};
1290
1291static const struct inode_operations v9fs_symlink_inode_operations_dotl = {
1292 .readlink = generic_readlink,
1293 .follow_link = v9fs_vfs_follow_link,
1294 .put_link = v9fs_vfs_put_link,
1295 .getattr = v9fs_vfs_getattr,
1296 .setattr = v9fs_vfs_setattr,
1297};
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index 806da5d3b3a0..be74d020436e 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -38,6 +38,7 @@
38#include <linux/idr.h> 38#include <linux/idr.h>
39#include <linux/sched.h> 39#include <linux/sched.h>
40#include <linux/slab.h> 40#include <linux/slab.h>
41#include <linux/statfs.h>
41#include <net/9p/9p.h> 42#include <net/9p/9p.h>
42#include <net/9p/client.h> 43#include <net/9p/client.h>
43 44
@@ -45,7 +46,7 @@
45#include "v9fs_vfs.h" 46#include "v9fs_vfs.h"
46#include "fid.h" 47#include "fid.h"
47 48
48static const struct super_operations v9fs_super_ops; 49static const struct super_operations v9fs_super_ops, v9fs_super_ops_dotl;
49 50
50/** 51/**
51 * v9fs_set_super - set the superblock 52 * v9fs_set_super - set the superblock
@@ -76,7 +77,10 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses,
76 sb->s_blocksize_bits = fls(v9ses->maxdata - 1); 77 sb->s_blocksize_bits = fls(v9ses->maxdata - 1);
77 sb->s_blocksize = 1 << sb->s_blocksize_bits; 78 sb->s_blocksize = 1 << sb->s_blocksize_bits;
78 sb->s_magic = V9FS_MAGIC; 79 sb->s_magic = V9FS_MAGIC;
79 sb->s_op = &v9fs_super_ops; 80 if (v9fs_proto_dotl(v9ses))
81 sb->s_op = &v9fs_super_ops_dotl;
82 else
83 sb->s_op = &v9fs_super_ops;
80 sb->s_bdi = &v9ses->bdi; 84 sb->s_bdi = &v9ses->bdi;
81 85
82 sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC | 86 sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC |
@@ -211,6 +215,42 @@ v9fs_umount_begin(struct super_block *sb)
211 v9fs_session_begin_cancel(v9ses); 215 v9fs_session_begin_cancel(v9ses);
212} 216}
213 217
218static int v9fs_statfs(struct dentry *dentry, struct kstatfs *buf)
219{
220 struct v9fs_session_info *v9ses;
221 struct p9_fid *fid;
222 struct p9_rstatfs rs;
223 int res;
224
225 fid = v9fs_fid_lookup(dentry);
226 if (IS_ERR(fid)) {
227 res = PTR_ERR(fid);
228 goto done;
229 }
230
231 v9ses = v9fs_inode2v9ses(dentry->d_inode);
232 if (v9fs_proto_dotl(v9ses)) {
233 res = p9_client_statfs(fid, &rs);
234 if (res == 0) {
235 buf->f_type = rs.type;
236 buf->f_bsize = rs.bsize;
237 buf->f_blocks = rs.blocks;
238 buf->f_bfree = rs.bfree;
239 buf->f_bavail = rs.bavail;
240 buf->f_files = rs.files;
241 buf->f_ffree = rs.ffree;
242 buf->f_fsid.val[0] = rs.fsid & 0xFFFFFFFFUL;
243 buf->f_fsid.val[1] = (rs.fsid >> 32) & 0xFFFFFFFFUL;
244 buf->f_namelen = rs.namelen;
245 }
246 if (res != -ENOSYS)
247 goto done;
248 }
249 res = simple_statfs(dentry, buf);
250done:
251 return res;
252}
253
214static const struct super_operations v9fs_super_ops = { 254static const struct super_operations v9fs_super_ops = {
215#ifdef CONFIG_9P_FSCACHE 255#ifdef CONFIG_9P_FSCACHE
216 .alloc_inode = v9fs_alloc_inode, 256 .alloc_inode = v9fs_alloc_inode,
@@ -222,6 +262,17 @@ static const struct super_operations v9fs_super_ops = {
222 .umount_begin = v9fs_umount_begin, 262 .umount_begin = v9fs_umount_begin,
223}; 263};
224 264
265static const struct super_operations v9fs_super_ops_dotl = {
266#ifdef CONFIG_9P_FSCACHE
267 .alloc_inode = v9fs_alloc_inode,
268 .destroy_inode = v9fs_destroy_inode,
269#endif
270 .statfs = v9fs_statfs,
271 .clear_inode = v9fs_clear_inode,
272 .show_options = generic_show_options,
273 .umount_begin = v9fs_umount_begin,
274};
275
225struct file_system_type v9fs_fs_type = { 276struct file_system_type v9fs_fs_type = {
226 .name = "9p", 277 .name = "9p",
227 .get_sb = v9fs_get_sb, 278 .get_sb = v9fs_get_sb,
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index a9005d862ed4..d9c60b84949a 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -274,7 +274,6 @@ static int ceph_readpages(struct file *file, struct address_space *mapping,
274 struct ceph_osd_client *osdc = &ceph_inode_to_client(inode)->osdc; 274 struct ceph_osd_client *osdc = &ceph_inode_to_client(inode)->osdc;
275 int rc = 0; 275 int rc = 0;
276 struct page **pages; 276 struct page **pages;
277 struct pagevec pvec;
278 loff_t offset; 277 loff_t offset;
279 u64 len; 278 u64 len;
280 279
@@ -297,8 +296,6 @@ static int ceph_readpages(struct file *file, struct address_space *mapping,
297 if (rc < 0) 296 if (rc < 0)
298 goto out; 297 goto out;
299 298
300 /* set uptodate and add to lru in pagevec-sized chunks */
301 pagevec_init(&pvec, 0);
302 for (; !list_empty(page_list) && len > 0; 299 for (; !list_empty(page_list) && len > 0;
303 rc -= PAGE_CACHE_SIZE, len -= PAGE_CACHE_SIZE) { 300 rc -= PAGE_CACHE_SIZE, len -= PAGE_CACHE_SIZE) {
304 struct page *page = 301 struct page *page =
@@ -312,7 +309,7 @@ static int ceph_readpages(struct file *file, struct address_space *mapping,
312 zero_user_segment(page, s, PAGE_CACHE_SIZE); 309 zero_user_segment(page, s, PAGE_CACHE_SIZE);
313 } 310 }
314 311
315 if (add_to_page_cache(page, mapping, page->index, GFP_NOFS)) { 312 if (add_to_page_cache_lru(page, mapping, page->index, GFP_NOFS)) {
316 page_cache_release(page); 313 page_cache_release(page);
317 dout("readpages %p add_to_page_cache failed %p\n", 314 dout("readpages %p add_to_page_cache failed %p\n",
318 inode, page); 315 inode, page);
@@ -323,10 +320,8 @@ static int ceph_readpages(struct file *file, struct address_space *mapping,
323 flush_dcache_page(page); 320 flush_dcache_page(page);
324 SetPageUptodate(page); 321 SetPageUptodate(page);
325 unlock_page(page); 322 unlock_page(page);
326 if (pagevec_add(&pvec, page) == 0) 323 page_cache_release(page);
327 pagevec_lru_add_file(&pvec); /* add to lru */
328 } 324 }
329 pagevec_lru_add_file(&pvec);
330 rc = 0; 325 rc = 0;
331 326
332out: 327out:
@@ -568,7 +563,7 @@ static void writepages_finish(struct ceph_osd_request *req,
568 ceph_release_pages(req->r_pages, req->r_num_pages); 563 ceph_release_pages(req->r_pages, req->r_num_pages);
569 if (req->r_pages_from_pool) 564 if (req->r_pages_from_pool)
570 mempool_free(req->r_pages, 565 mempool_free(req->r_pages,
571 ceph_client(inode->i_sb)->wb_pagevec_pool); 566 ceph_sb_to_client(inode->i_sb)->wb_pagevec_pool);
572 else 567 else
573 kfree(req->r_pages); 568 kfree(req->r_pages);
574 ceph_osdc_put_request(req); 569 ceph_osdc_put_request(req);
diff --git a/fs/ceph/auth.c b/fs/ceph/auth.c
index 818afe72e6c7..9f46de2ba7a7 100644
--- a/fs/ceph/auth.c
+++ b/fs/ceph/auth.c
@@ -150,7 +150,8 @@ int ceph_build_auth_request(struct ceph_auth_client *ac,
150 150
151 ret = ac->ops->build_request(ac, p + sizeof(u32), end); 151 ret = ac->ops->build_request(ac, p + sizeof(u32), end);
152 if (ret < 0) { 152 if (ret < 0) {
153 pr_err("error %d building request\n", ret); 153 pr_err("error %d building auth method %s request\n", ret,
154 ac->ops->name);
154 return ret; 155 return ret;
155 } 156 }
156 dout(" built request %d bytes\n", ret); 157 dout(" built request %d bytes\n", ret);
@@ -216,8 +217,8 @@ int ceph_handle_auth_reply(struct ceph_auth_client *ac,
216 if (ac->protocol != protocol) { 217 if (ac->protocol != protocol) {
217 ret = ceph_auth_init_protocol(ac, protocol); 218 ret = ceph_auth_init_protocol(ac, protocol);
218 if (ret) { 219 if (ret) {
219 pr_err("error %d on auth protocol %d init\n", 220 pr_err("error %d on auth method %s init\n",
220 ret, protocol); 221 ret, ac->ops->name);
221 goto out; 222 goto out;
222 } 223 }
223 } 224 }
@@ -229,7 +230,7 @@ int ceph_handle_auth_reply(struct ceph_auth_client *ac,
229 if (ret == -EAGAIN) { 230 if (ret == -EAGAIN) {
230 return ceph_build_auth_request(ac, reply_buf, reply_len); 231 return ceph_build_auth_request(ac, reply_buf, reply_len);
231 } else if (ret) { 232 } else if (ret) {
232 pr_err("authentication error %d\n", ret); 233 pr_err("auth method '%s' error %d\n", ac->ops->name, ret);
233 return ret; 234 return ret;
234 } 235 }
235 return 0; 236 return 0;
diff --git a/fs/ceph/auth.h b/fs/ceph/auth.h
index ca4f57cfb267..4429a707c021 100644
--- a/fs/ceph/auth.h
+++ b/fs/ceph/auth.h
@@ -15,6 +15,8 @@ struct ceph_auth_client;
15struct ceph_authorizer; 15struct ceph_authorizer;
16 16
17struct ceph_auth_client_ops { 17struct ceph_auth_client_ops {
18 const char *name;
19
18 /* 20 /*
19 * true if we are authenticated and can connect to 21 * true if we are authenticated and can connect to
20 * services. 22 * services.
diff --git a/fs/ceph/auth_none.c b/fs/ceph/auth_none.c
index 8cd9e3af07f7..24407c119291 100644
--- a/fs/ceph/auth_none.c
+++ b/fs/ceph/auth_none.c
@@ -94,6 +94,7 @@ static void ceph_auth_none_destroy_authorizer(struct ceph_auth_client *ac,
94} 94}
95 95
96static const struct ceph_auth_client_ops ceph_auth_none_ops = { 96static const struct ceph_auth_client_ops ceph_auth_none_ops = {
97 .name = "none",
97 .reset = reset, 98 .reset = reset,
98 .destroy = destroy, 99 .destroy = destroy,
99 .is_authenticated = is_authenticated, 100 .is_authenticated = is_authenticated,
diff --git a/fs/ceph/auth_x.c b/fs/ceph/auth_x.c
index fee5a08da881..7b206231566d 100644
--- a/fs/ceph/auth_x.c
+++ b/fs/ceph/auth_x.c
@@ -127,7 +127,7 @@ static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac,
127 int ret; 127 int ret;
128 char *dbuf; 128 char *dbuf;
129 char *ticket_buf; 129 char *ticket_buf;
130 u8 struct_v; 130 u8 reply_struct_v;
131 131
132 dbuf = kmalloc(TEMP_TICKET_BUF_LEN, GFP_NOFS); 132 dbuf = kmalloc(TEMP_TICKET_BUF_LEN, GFP_NOFS);
133 if (!dbuf) 133 if (!dbuf)
@@ -139,14 +139,14 @@ static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac,
139 goto out_dbuf; 139 goto out_dbuf;
140 140
141 ceph_decode_need(&p, end, 1 + sizeof(u32), bad); 141 ceph_decode_need(&p, end, 1 + sizeof(u32), bad);
142 struct_v = ceph_decode_8(&p); 142 reply_struct_v = ceph_decode_8(&p);
143 if (struct_v != 1) 143 if (reply_struct_v != 1)
144 goto bad; 144 goto bad;
145 num = ceph_decode_32(&p); 145 num = ceph_decode_32(&p);
146 dout("%d tickets\n", num); 146 dout("%d tickets\n", num);
147 while (num--) { 147 while (num--) {
148 int type; 148 int type;
149 u8 struct_v; 149 u8 tkt_struct_v, blob_struct_v;
150 struct ceph_x_ticket_handler *th; 150 struct ceph_x_ticket_handler *th;
151 void *dp, *dend; 151 void *dp, *dend;
152 int dlen; 152 int dlen;
@@ -165,8 +165,8 @@ static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac,
165 type = ceph_decode_32(&p); 165 type = ceph_decode_32(&p);
166 dout(" ticket type %d %s\n", type, ceph_entity_type_name(type)); 166 dout(" ticket type %d %s\n", type, ceph_entity_type_name(type));
167 167
168 struct_v = ceph_decode_8(&p); 168 tkt_struct_v = ceph_decode_8(&p);
169 if (struct_v != 1) 169 if (tkt_struct_v != 1)
170 goto bad; 170 goto bad;
171 171
172 th = get_ticket_handler(ac, type); 172 th = get_ticket_handler(ac, type);
@@ -186,8 +186,8 @@ static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac,
186 dend = dbuf + dlen; 186 dend = dbuf + dlen;
187 dp = dbuf; 187 dp = dbuf;
188 188
189 struct_v = ceph_decode_8(&dp); 189 tkt_struct_v = ceph_decode_8(&dp);
190 if (struct_v != 1) 190 if (tkt_struct_v != 1)
191 goto bad; 191 goto bad;
192 192
193 memcpy(&old_key, &th->session_key, sizeof(old_key)); 193 memcpy(&old_key, &th->session_key, sizeof(old_key));
@@ -224,7 +224,7 @@ static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac,
224 tpend = tp + dlen; 224 tpend = tp + dlen;
225 dout(" ticket blob is %d bytes\n", dlen); 225 dout(" ticket blob is %d bytes\n", dlen);
226 ceph_decode_need(&tp, tpend, 1 + sizeof(u64), bad); 226 ceph_decode_need(&tp, tpend, 1 + sizeof(u64), bad);
227 struct_v = ceph_decode_8(&tp); 227 blob_struct_v = ceph_decode_8(&tp);
228 new_secret_id = ceph_decode_64(&tp); 228 new_secret_id = ceph_decode_64(&tp);
229 ret = ceph_decode_buffer(&new_ticket_blob, &tp, tpend); 229 ret = ceph_decode_buffer(&new_ticket_blob, &tp, tpend);
230 if (ret) 230 if (ret)
@@ -618,6 +618,7 @@ static void ceph_x_invalidate_authorizer(struct ceph_auth_client *ac,
618 618
619 619
620static const struct ceph_auth_client_ops ceph_x_ops = { 620static const struct ceph_auth_client_ops ceph_x_ops = {
621 .name = "x",
621 .is_authenticated = ceph_x_is_authenticated, 622 .is_authenticated = ceph_x_is_authenticated,
622 .build_request = ceph_x_build_request, 623 .build_request = ceph_x_build_request,
623 .handle_reply = ceph_x_handle_reply, 624 .handle_reply = ceph_x_handle_reply,
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index d9400534b279..0dd0b81e64f7 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -867,7 +867,8 @@ void __ceph_remove_cap(struct ceph_cap *cap)
867{ 867{
868 struct ceph_mds_session *session = cap->session; 868 struct ceph_mds_session *session = cap->session;
869 struct ceph_inode_info *ci = cap->ci; 869 struct ceph_inode_info *ci = cap->ci;
870 struct ceph_mds_client *mdsc = &ceph_client(ci->vfs_inode.i_sb)->mdsc; 870 struct ceph_mds_client *mdsc =
871 &ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc;
871 int removed = 0; 872 int removed = 0;
872 873
873 dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode); 874 dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode);
@@ -937,9 +938,9 @@ static int send_cap_msg(struct ceph_mds_session *session,
937 seq, issue_seq, mseq, follows, size, max_size, 938 seq, issue_seq, mseq, follows, size, max_size,
938 xattr_version, xattrs_buf ? (int)xattrs_buf->vec.iov_len : 0); 939 xattr_version, xattrs_buf ? (int)xattrs_buf->vec.iov_len : 0);
939 940
940 msg = ceph_msg_new(CEPH_MSG_CLIENT_CAPS, sizeof(*fc), 0, 0, NULL); 941 msg = ceph_msg_new(CEPH_MSG_CLIENT_CAPS, sizeof(*fc), GFP_NOFS);
941 if (IS_ERR(msg)) 942 if (!msg)
942 return PTR_ERR(msg); 943 return -ENOMEM;
943 944
944 msg->hdr.tid = cpu_to_le64(flush_tid); 945 msg->hdr.tid = cpu_to_le64(flush_tid);
945 946
@@ -1298,7 +1299,8 @@ static void ceph_flush_snaps(struct ceph_inode_info *ci)
1298 */ 1299 */
1299void __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask) 1300void __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask)
1300{ 1301{
1301 struct ceph_mds_client *mdsc = &ceph_client(ci->vfs_inode.i_sb)->mdsc; 1302 struct ceph_mds_client *mdsc =
1303 &ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc;
1302 struct inode *inode = &ci->vfs_inode; 1304 struct inode *inode = &ci->vfs_inode;
1303 int was = ci->i_dirty_caps; 1305 int was = ci->i_dirty_caps;
1304 int dirty = 0; 1306 int dirty = 0;
@@ -1336,7 +1338,7 @@ void __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask)
1336static int __mark_caps_flushing(struct inode *inode, 1338static int __mark_caps_flushing(struct inode *inode,
1337 struct ceph_mds_session *session) 1339 struct ceph_mds_session *session)
1338{ 1340{
1339 struct ceph_mds_client *mdsc = &ceph_client(inode->i_sb)->mdsc; 1341 struct ceph_mds_client *mdsc = &ceph_sb_to_client(inode->i_sb)->mdsc;
1340 struct ceph_inode_info *ci = ceph_inode(inode); 1342 struct ceph_inode_info *ci = ceph_inode(inode);
1341 int flushing; 1343 int flushing;
1342 1344
@@ -1663,7 +1665,7 @@ ack:
1663static int try_flush_caps(struct inode *inode, struct ceph_mds_session *session, 1665static int try_flush_caps(struct inode *inode, struct ceph_mds_session *session,
1664 unsigned *flush_tid) 1666 unsigned *flush_tid)
1665{ 1667{
1666 struct ceph_mds_client *mdsc = &ceph_client(inode->i_sb)->mdsc; 1668 struct ceph_mds_client *mdsc = &ceph_sb_to_client(inode->i_sb)->mdsc;
1667 struct ceph_inode_info *ci = ceph_inode(inode); 1669 struct ceph_inode_info *ci = ceph_inode(inode);
1668 int unlock_session = session ? 0 : 1; 1670 int unlock_session = session ? 0 : 1;
1669 int flushing = 0; 1671 int flushing = 0;
@@ -1716,10 +1718,9 @@ out_unlocked:
1716static int caps_are_flushed(struct inode *inode, unsigned tid) 1718static int caps_are_flushed(struct inode *inode, unsigned tid)
1717{ 1719{
1718 struct ceph_inode_info *ci = ceph_inode(inode); 1720 struct ceph_inode_info *ci = ceph_inode(inode);
1719 int dirty, i, ret = 1; 1721 int i, ret = 1;
1720 1722
1721 spin_lock(&inode->i_lock); 1723 spin_lock(&inode->i_lock);
1722 dirty = __ceph_caps_dirty(ci);
1723 for (i = 0; i < CEPH_CAP_BITS; i++) 1724 for (i = 0; i < CEPH_CAP_BITS; i++)
1724 if ((ci->i_flushing_caps & (1 << i)) && 1725 if ((ci->i_flushing_caps & (1 << i)) &&
1725 ci->i_cap_flush_tid[i] <= tid) { 1726 ci->i_cap_flush_tid[i] <= tid) {
@@ -1829,7 +1830,8 @@ int ceph_write_inode(struct inode *inode, struct writeback_control *wbc)
1829 err = wait_event_interruptible(ci->i_cap_wq, 1830 err = wait_event_interruptible(ci->i_cap_wq,
1830 caps_are_flushed(inode, flush_tid)); 1831 caps_are_flushed(inode, flush_tid));
1831 } else { 1832 } else {
1832 struct ceph_mds_client *mdsc = &ceph_client(inode->i_sb)->mdsc; 1833 struct ceph_mds_client *mdsc =
1834 &ceph_sb_to_client(inode->i_sb)->mdsc;
1833 1835
1834 spin_lock(&inode->i_lock); 1836 spin_lock(&inode->i_lock);
1835 if (__ceph_caps_dirty(ci)) 1837 if (__ceph_caps_dirty(ci))
@@ -2411,7 +2413,7 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid,
2411 __releases(inode->i_lock) 2413 __releases(inode->i_lock)
2412{ 2414{
2413 struct ceph_inode_info *ci = ceph_inode(inode); 2415 struct ceph_inode_info *ci = ceph_inode(inode);
2414 struct ceph_mds_client *mdsc = &ceph_client(inode->i_sb)->mdsc; 2416 struct ceph_mds_client *mdsc = &ceph_sb_to_client(inode->i_sb)->mdsc;
2415 unsigned seq = le32_to_cpu(m->seq); 2417 unsigned seq = le32_to_cpu(m->seq);
2416 int dirty = le32_to_cpu(m->dirty); 2418 int dirty = le32_to_cpu(m->dirty);
2417 int cleaned = 0; 2419 int cleaned = 0;
diff --git a/fs/ceph/ceph_fs.h b/fs/ceph/ceph_fs.h
index 0c2241ef3653..3b9eeed097b3 100644
--- a/fs/ceph/ceph_fs.h
+++ b/fs/ceph/ceph_fs.h
@@ -19,7 +19,7 @@
19 * Ceph release version 19 * Ceph release version
20 */ 20 */
21#define CEPH_VERSION_MAJOR 0 21#define CEPH_VERSION_MAJOR 0
22#define CEPH_VERSION_MINOR 19 22#define CEPH_VERSION_MINOR 20
23#define CEPH_VERSION_PATCH 0 23#define CEPH_VERSION_PATCH 0
24 24
25#define _CEPH_STRINGIFY(x) #x 25#define _CEPH_STRINGIFY(x) #x
@@ -36,7 +36,7 @@
36 * client-facing protocol. 36 * client-facing protocol.
37 */ 37 */
38#define CEPH_OSD_PROTOCOL 8 /* cluster internal */ 38#define CEPH_OSD_PROTOCOL 8 /* cluster internal */
39#define CEPH_MDS_PROTOCOL 9 /* cluster internal */ 39#define CEPH_MDS_PROTOCOL 12 /* cluster internal */
40#define CEPH_MON_PROTOCOL 5 /* cluster internal */ 40#define CEPH_MON_PROTOCOL 5 /* cluster internal */
41#define CEPH_OSDC_PROTOCOL 24 /* server/client */ 41#define CEPH_OSDC_PROTOCOL 24 /* server/client */
42#define CEPH_MDSC_PROTOCOL 32 /* server/client */ 42#define CEPH_MDSC_PROTOCOL 32 /* server/client */
@@ -53,8 +53,18 @@
53/* 53/*
54 * feature bits 54 * feature bits
55 */ 55 */
56#define CEPH_FEATURE_SUPPORTED 0 56#define CEPH_FEATURE_UID 1
57#define CEPH_FEATURE_REQUIRED 0 57#define CEPH_FEATURE_NOSRCADDR 2
58#define CEPH_FEATURE_FLOCK 4
59
60#define CEPH_FEATURE_SUPPORTED_MON CEPH_FEATURE_UID|CEPH_FEATURE_NOSRCADDR
61#define CEPH_FEATURE_REQUIRED_MON CEPH_FEATURE_UID
62#define CEPH_FEATURE_SUPPORTED_MDS CEPH_FEATURE_UID|CEPH_FEATURE_NOSRCADDR|CEPH_FEATURE_FLOCK
63#define CEPH_FEATURE_REQUIRED_MDS CEPH_FEATURE_UID
64#define CEPH_FEATURE_SUPPORTED_OSD CEPH_FEATURE_UID|CEPH_FEATURE_NOSRCADDR
65#define CEPH_FEATURE_REQUIRED_OSD CEPH_FEATURE_UID
66#define CEPH_FEATURE_SUPPORTED_CLIENT CEPH_FEATURE_NOSRCADDR
67#define CEPH_FEATURE_REQUIRED_CLIENT CEPH_FEATURE_NOSRCADDR
58 68
59 69
60/* 70/*
@@ -91,6 +101,8 @@ int ceph_file_layout_is_valid(const struct ceph_file_layout *layout);
91#define CEPH_AUTH_NONE 0x1 101#define CEPH_AUTH_NONE 0x1
92#define CEPH_AUTH_CEPHX 0x2 102#define CEPH_AUTH_CEPHX 0x2
93 103
104#define CEPH_AUTH_UID_DEFAULT ((__u64) -1)
105
94 106
95/********************************************* 107/*********************************************
96 * message layer 108 * message layer
@@ -128,11 +140,27 @@ int ceph_file_layout_is_valid(const struct ceph_file_layout *layout);
128#define CEPH_MSG_CLIENT_SNAP 0x312 140#define CEPH_MSG_CLIENT_SNAP 0x312
129#define CEPH_MSG_CLIENT_CAPRELEASE 0x313 141#define CEPH_MSG_CLIENT_CAPRELEASE 0x313
130 142
143/* pool ops */
144#define CEPH_MSG_POOLOP_REPLY 48
145#define CEPH_MSG_POOLOP 49
146
147
131/* osd */ 148/* osd */
132#define CEPH_MSG_OSD_MAP 41 149#define CEPH_MSG_OSD_MAP 41
133#define CEPH_MSG_OSD_OP 42 150#define CEPH_MSG_OSD_OP 42
134#define CEPH_MSG_OSD_OPREPLY 43 151#define CEPH_MSG_OSD_OPREPLY 43
135 152
153/* pool operations */
154enum {
155 POOL_OP_CREATE = 0x01,
156 POOL_OP_DELETE = 0x02,
157 POOL_OP_AUID_CHANGE = 0x03,
158 POOL_OP_CREATE_SNAP = 0x11,
159 POOL_OP_DELETE_SNAP = 0x12,
160 POOL_OP_CREATE_UNMANAGED_SNAP = 0x21,
161 POOL_OP_DELETE_UNMANAGED_SNAP = 0x22,
162};
163
136struct ceph_mon_request_header { 164struct ceph_mon_request_header {
137 __le64 have_version; 165 __le64 have_version;
138 __le16 session_mon; 166 __le16 session_mon;
@@ -155,6 +183,31 @@ struct ceph_mon_statfs_reply {
155 struct ceph_statfs st; 183 struct ceph_statfs st;
156} __attribute__ ((packed)); 184} __attribute__ ((packed));
157 185
186const char *ceph_pool_op_name(int op);
187
188struct ceph_mon_poolop {
189 struct ceph_mon_request_header monhdr;
190 struct ceph_fsid fsid;
191 __le32 pool;
192 __le32 op;
193 __le64 auid;
194 __le64 snapid;
195 __le32 name_len;
196} __attribute__ ((packed));
197
198struct ceph_mon_poolop_reply {
199 struct ceph_mon_request_header monhdr;
200 struct ceph_fsid fsid;
201 __le32 reply_code;
202 __le32 epoch;
203 char has_data;
204 char data[0];
205} __attribute__ ((packed));
206
207struct ceph_mon_unmanaged_snap {
208 __le64 snapid;
209} __attribute__ ((packed));
210
158struct ceph_osd_getmap { 211struct ceph_osd_getmap {
159 struct ceph_mon_request_header monhdr; 212 struct ceph_mon_request_header monhdr;
160 struct ceph_fsid fsid; 213 struct ceph_fsid fsid;
@@ -308,6 +361,7 @@ union ceph_mds_request_args {
308 struct { 361 struct {
309 __le32 frag; /* which dir fragment */ 362 __le32 frag; /* which dir fragment */
310 __le32 max_entries; /* how many dentries to grab */ 363 __le32 max_entries; /* how many dentries to grab */
364 __le32 max_bytes;
311 } __attribute__ ((packed)) readdir; 365 } __attribute__ ((packed)) readdir;
312 struct { 366 struct {
313 __le32 mode; 367 __le32 mode;
diff --git a/fs/ceph/ceph_strings.c b/fs/ceph/ceph_strings.c
index 8e4be6a80c62..7503aee828ce 100644
--- a/fs/ceph/ceph_strings.c
+++ b/fs/ceph/ceph_strings.c
@@ -10,7 +10,6 @@ const char *ceph_entity_type_name(int type)
10 case CEPH_ENTITY_TYPE_OSD: return "osd"; 10 case CEPH_ENTITY_TYPE_OSD: return "osd";
11 case CEPH_ENTITY_TYPE_MON: return "mon"; 11 case CEPH_ENTITY_TYPE_MON: return "mon";
12 case CEPH_ENTITY_TYPE_CLIENT: return "client"; 12 case CEPH_ENTITY_TYPE_CLIENT: return "client";
13 case CEPH_ENTITY_TYPE_ADMIN: return "admin";
14 case CEPH_ENTITY_TYPE_AUTH: return "auth"; 13 case CEPH_ENTITY_TYPE_AUTH: return "auth";
15 default: return "unknown"; 14 default: return "unknown";
16 } 15 }
@@ -45,6 +44,7 @@ const char *ceph_osd_op_name(int op)
45 case CEPH_OSD_OP_SETXATTRS: return "setxattrs"; 44 case CEPH_OSD_OP_SETXATTRS: return "setxattrs";
46 case CEPH_OSD_OP_RESETXATTRS: return "resetxattrs"; 45 case CEPH_OSD_OP_RESETXATTRS: return "resetxattrs";
47 case CEPH_OSD_OP_RMXATTR: return "rmxattr"; 46 case CEPH_OSD_OP_RMXATTR: return "rmxattr";
47 case CEPH_OSD_OP_CMPXATTR: return "cmpxattr";
48 48
49 case CEPH_OSD_OP_PULL: return "pull"; 49 case CEPH_OSD_OP_PULL: return "pull";
50 case CEPH_OSD_OP_PUSH: return "push"; 50 case CEPH_OSD_OP_PUSH: return "push";
@@ -174,3 +174,17 @@ const char *ceph_snap_op_name(int o)
174 } 174 }
175 return "???"; 175 return "???";
176} 176}
177
178const char *ceph_pool_op_name(int op)
179{
180 switch (op) {
181 case POOL_OP_CREATE: return "create";
182 case POOL_OP_DELETE: return "delete";
183 case POOL_OP_AUID_CHANGE: return "auid change";
184 case POOL_OP_CREATE_SNAP: return "create snap";
185 case POOL_OP_DELETE_SNAP: return "delete snap";
186 case POOL_OP_CREATE_UNMANAGED_SNAP: return "create unmanaged snap";
187 case POOL_OP_DELETE_UNMANAGED_SNAP: return "delete unmanaged snap";
188 }
189 return "???";
190}
diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
index f7048da92acc..3be33fb066cc 100644
--- a/fs/ceph/debugfs.c
+++ b/fs/ceph/debugfs.c
@@ -113,7 +113,7 @@ static int osdmap_show(struct seq_file *s, void *p)
113static int monc_show(struct seq_file *s, void *p) 113static int monc_show(struct seq_file *s, void *p)
114{ 114{
115 struct ceph_client *client = s->private; 115 struct ceph_client *client = s->private;
116 struct ceph_mon_statfs_request *req; 116 struct ceph_mon_generic_request *req;
117 struct ceph_mon_client *monc = &client->monc; 117 struct ceph_mon_client *monc = &client->monc;
118 struct rb_node *rp; 118 struct rb_node *rp;
119 119
@@ -126,9 +126,14 @@ static int monc_show(struct seq_file *s, void *p)
126 if (monc->want_next_osdmap) 126 if (monc->want_next_osdmap)
127 seq_printf(s, "want next osdmap\n"); 127 seq_printf(s, "want next osdmap\n");
128 128
129 for (rp = rb_first(&monc->statfs_request_tree); rp; rp = rb_next(rp)) { 129 for (rp = rb_first(&monc->generic_request_tree); rp; rp = rb_next(rp)) {
130 req = rb_entry(rp, struct ceph_mon_statfs_request, node); 130 __u16 op;
131 seq_printf(s, "%lld statfs\n", req->tid); 131 req = rb_entry(rp, struct ceph_mon_generic_request, node);
132 op = le16_to_cpu(req->request->hdr.type);
133 if (op == CEPH_MSG_STATFS)
134 seq_printf(s, "%lld statfs\n", req->tid);
135 else
136 seq_printf(s, "%lld unknown\n", req->tid);
132 } 137 }
133 138
134 mutex_unlock(&monc->mutex); 139 mutex_unlock(&monc->mutex);
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 650d2db5ed26..4fd30900eff7 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -51,8 +51,11 @@ int ceph_init_dentry(struct dentry *dentry)
51 return -ENOMEM; /* oh well */ 51 return -ENOMEM; /* oh well */
52 52
53 spin_lock(&dentry->d_lock); 53 spin_lock(&dentry->d_lock);
54 if (dentry->d_fsdata) /* lost a race */ 54 if (dentry->d_fsdata) {
55 /* lost a race */
56 kmem_cache_free(ceph_dentry_cachep, di);
55 goto out_unlock; 57 goto out_unlock;
58 }
56 di->dentry = dentry; 59 di->dentry = dentry;
57 di->lease_session = NULL; 60 di->lease_session = NULL;
58 dentry->d_fsdata = di; 61 dentry->d_fsdata = di;
@@ -125,7 +128,8 @@ more:
125 dentry = list_entry(p, struct dentry, d_u.d_child); 128 dentry = list_entry(p, struct dentry, d_u.d_child);
126 di = ceph_dentry(dentry); 129 di = ceph_dentry(dentry);
127 while (1) { 130 while (1) {
128 dout(" p %p/%p d_subdirs %p/%p\n", p->prev, p->next, 131 dout(" p %p/%p %s d_subdirs %p/%p\n", p->prev, p->next,
132 d_unhashed(dentry) ? "!hashed" : "hashed",
129 parent->d_subdirs.prev, parent->d_subdirs.next); 133 parent->d_subdirs.prev, parent->d_subdirs.next);
130 if (p == &parent->d_subdirs) { 134 if (p == &parent->d_subdirs) {
131 fi->at_end = 1; 135 fi->at_end = 1;
@@ -229,6 +233,7 @@ static int ceph_readdir(struct file *filp, void *dirent, filldir_t filldir)
229 u32 ftype; 233 u32 ftype;
230 struct ceph_mds_reply_info_parsed *rinfo; 234 struct ceph_mds_reply_info_parsed *rinfo;
231 const int max_entries = client->mount_args->max_readdir; 235 const int max_entries = client->mount_args->max_readdir;
236 const int max_bytes = client->mount_args->max_readdir_bytes;
232 237
233 dout("readdir %p filp %p frag %u off %u\n", inode, filp, frag, off); 238 dout("readdir %p filp %p frag %u off %u\n", inode, filp, frag, off);
234 if (fi->at_end) 239 if (fi->at_end)
@@ -312,6 +317,7 @@ more:
312 req->r_readdir_offset = fi->next_offset; 317 req->r_readdir_offset = fi->next_offset;
313 req->r_args.readdir.frag = cpu_to_le32(frag); 318 req->r_args.readdir.frag = cpu_to_le32(frag);
314 req->r_args.readdir.max_entries = cpu_to_le32(max_entries); 319 req->r_args.readdir.max_entries = cpu_to_le32(max_entries);
320 req->r_args.readdir.max_bytes = cpu_to_le32(max_bytes);
315 req->r_num_caps = max_entries + 1; 321 req->r_num_caps = max_entries + 1;
316 err = ceph_mdsc_do_request(mdsc, NULL, req); 322 err = ceph_mdsc_do_request(mdsc, NULL, req);
317 if (err < 0) { 323 if (err < 0) {
@@ -335,7 +341,7 @@ more:
335 if (req->r_reply_info.dir_end) { 341 if (req->r_reply_info.dir_end) {
336 kfree(fi->last_name); 342 kfree(fi->last_name);
337 fi->last_name = NULL; 343 fi->last_name = NULL;
338 fi->next_offset = 0; 344 fi->next_offset = 2;
339 } else { 345 } else {
340 rinfo = &req->r_reply_info; 346 rinfo = &req->r_reply_info;
341 err = note_last_dentry(fi, 347 err = note_last_dentry(fi,
@@ -478,7 +484,7 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int origin)
478struct dentry *ceph_finish_lookup(struct ceph_mds_request *req, 484struct dentry *ceph_finish_lookup(struct ceph_mds_request *req,
479 struct dentry *dentry, int err) 485 struct dentry *dentry, int err)
480{ 486{
481 struct ceph_client *client = ceph_client(dentry->d_sb); 487 struct ceph_client *client = ceph_sb_to_client(dentry->d_sb);
482 struct inode *parent = dentry->d_parent->d_inode; 488 struct inode *parent = dentry->d_parent->d_inode;
483 489
484 /* .snap dir? */ 490 /* .snap dir? */
@@ -568,7 +574,6 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,
568 !is_root_ceph_dentry(dir, dentry) && 574 !is_root_ceph_dentry(dir, dentry) &&
569 (ci->i_ceph_flags & CEPH_I_COMPLETE) && 575 (ci->i_ceph_flags & CEPH_I_COMPLETE) &&
570 (__ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1))) { 576 (__ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1))) {
571 di->offset = ci->i_max_offset++;
572 spin_unlock(&dir->i_lock); 577 spin_unlock(&dir->i_lock);
573 dout(" dir %p complete, -ENOENT\n", dir); 578 dout(" dir %p complete, -ENOENT\n", dir);
574 d_add(dentry, NULL); 579 d_add(dentry, NULL);
@@ -888,13 +893,22 @@ static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry,
888 893
889 /* ensure target dentry is invalidated, despite 894 /* ensure target dentry is invalidated, despite
890 rehashing bug in vfs_rename_dir */ 895 rehashing bug in vfs_rename_dir */
891 new_dentry->d_time = jiffies; 896 ceph_invalidate_dentry_lease(new_dentry);
892 ceph_dentry(new_dentry)->lease_shared_gen = 0;
893 } 897 }
894 ceph_mdsc_put_request(req); 898 ceph_mdsc_put_request(req);
895 return err; 899 return err;
896} 900}
897 901
902/*
903 * Ensure a dentry lease will no longer revalidate.
904 */
905void ceph_invalidate_dentry_lease(struct dentry *dentry)
906{
907 spin_lock(&dentry->d_lock);
908 dentry->d_time = jiffies;
909 ceph_dentry(dentry)->lease_shared_gen = 0;
910 spin_unlock(&dentry->d_lock);
911}
898 912
899/* 913/*
900 * Check if dentry lease is valid. If not, delete the lease. Try to 914 * Check if dentry lease is valid. If not, delete the lease. Try to
@@ -972,8 +986,9 @@ static int ceph_d_revalidate(struct dentry *dentry, struct nameidata *nd)
972{ 986{
973 struct inode *dir = dentry->d_parent->d_inode; 987 struct inode *dir = dentry->d_parent->d_inode;
974 988
975 dout("d_revalidate %p '%.*s' inode %p\n", dentry, 989 dout("d_revalidate %p '%.*s' inode %p offset %lld\n", dentry,
976 dentry->d_name.len, dentry->d_name.name, dentry->d_inode); 990 dentry->d_name.len, dentry->d_name.name, dentry->d_inode,
991 ceph_dentry(dentry)->offset);
977 992
978 /* always trust cached snapped dentries, snapdir dentry */ 993 /* always trust cached snapped dentries, snapdir dentry */
979 if (ceph_snap(dir) != CEPH_NOSNAP) { 994 if (ceph_snap(dir) != CEPH_NOSNAP) {
@@ -1050,7 +1065,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
1050 struct ceph_inode_info *ci = ceph_inode(inode); 1065 struct ceph_inode_info *ci = ceph_inode(inode);
1051 int left; 1066 int left;
1052 1067
1053 if (!ceph_test_opt(ceph_client(inode->i_sb), DIRSTAT)) 1068 if (!ceph_test_opt(ceph_sb_to_client(inode->i_sb), DIRSTAT))
1054 return -EISDIR; 1069 return -EISDIR;
1055 1070
1056 if (!cf->dir_info) { 1071 if (!cf->dir_info) {
@@ -1152,7 +1167,7 @@ void ceph_dentry_lru_add(struct dentry *dn)
1152 dout("dentry_lru_add %p %p '%.*s'\n", di, dn, 1167 dout("dentry_lru_add %p %p '%.*s'\n", di, dn,
1153 dn->d_name.len, dn->d_name.name); 1168 dn->d_name.len, dn->d_name.name);
1154 if (di) { 1169 if (di) {
1155 mdsc = &ceph_client(dn->d_sb)->mdsc; 1170 mdsc = &ceph_sb_to_client(dn->d_sb)->mdsc;
1156 spin_lock(&mdsc->dentry_lru_lock); 1171 spin_lock(&mdsc->dentry_lru_lock);
1157 list_add_tail(&di->lru, &mdsc->dentry_lru); 1172 list_add_tail(&di->lru, &mdsc->dentry_lru);
1158 mdsc->num_dentry++; 1173 mdsc->num_dentry++;
@@ -1165,10 +1180,10 @@ void ceph_dentry_lru_touch(struct dentry *dn)
1165 struct ceph_dentry_info *di = ceph_dentry(dn); 1180 struct ceph_dentry_info *di = ceph_dentry(dn);
1166 struct ceph_mds_client *mdsc; 1181 struct ceph_mds_client *mdsc;
1167 1182
1168 dout("dentry_lru_touch %p %p '%.*s'\n", di, dn, 1183 dout("dentry_lru_touch %p %p '%.*s' (offset %lld)\n", di, dn,
1169 dn->d_name.len, dn->d_name.name); 1184 dn->d_name.len, dn->d_name.name, di->offset);
1170 if (di) { 1185 if (di) {
1171 mdsc = &ceph_client(dn->d_sb)->mdsc; 1186 mdsc = &ceph_sb_to_client(dn->d_sb)->mdsc;
1172 spin_lock(&mdsc->dentry_lru_lock); 1187 spin_lock(&mdsc->dentry_lru_lock);
1173 list_move_tail(&di->lru, &mdsc->dentry_lru); 1188 list_move_tail(&di->lru, &mdsc->dentry_lru);
1174 spin_unlock(&mdsc->dentry_lru_lock); 1189 spin_unlock(&mdsc->dentry_lru_lock);
@@ -1183,7 +1198,7 @@ void ceph_dentry_lru_del(struct dentry *dn)
1183 dout("dentry_lru_del %p %p '%.*s'\n", di, dn, 1198 dout("dentry_lru_del %p %p '%.*s'\n", di, dn,
1184 dn->d_name.len, dn->d_name.name); 1199 dn->d_name.len, dn->d_name.name);
1185 if (di) { 1200 if (di) {
1186 mdsc = &ceph_client(dn->d_sb)->mdsc; 1201 mdsc = &ceph_sb_to_client(dn->d_sb)->mdsc;
1187 spin_lock(&mdsc->dentry_lru_lock); 1202 spin_lock(&mdsc->dentry_lru_lock);
1188 list_del_init(&di->lru); 1203 list_del_init(&di->lru);
1189 mdsc->num_dentry--; 1204 mdsc->num_dentry--;
diff --git a/fs/ceph/export.c b/fs/ceph/export.c
index 9d67572fb328..17447644d675 100644
--- a/fs/ceph/export.c
+++ b/fs/ceph/export.c
@@ -93,11 +93,11 @@ static struct dentry *__fh_to_dentry(struct super_block *sb,
93 return ERR_PTR(-ESTALE); 93 return ERR_PTR(-ESTALE);
94 94
95 dentry = d_obtain_alias(inode); 95 dentry = d_obtain_alias(inode);
96 if (!dentry) { 96 if (IS_ERR(dentry)) {
97 pr_err("fh_to_dentry %llx -- inode %p but ENOMEM\n", 97 pr_err("fh_to_dentry %llx -- inode %p but ENOMEM\n",
98 fh->ino, inode); 98 fh->ino, inode);
99 iput(inode); 99 iput(inode);
100 return ERR_PTR(-ENOMEM); 100 return dentry;
101 } 101 }
102 err = ceph_init_dentry(dentry); 102 err = ceph_init_dentry(dentry);
103 103
@@ -115,7 +115,7 @@ static struct dentry *__fh_to_dentry(struct super_block *sb,
115static struct dentry *__cfh_to_dentry(struct super_block *sb, 115static struct dentry *__cfh_to_dentry(struct super_block *sb,
116 struct ceph_nfs_confh *cfh) 116 struct ceph_nfs_confh *cfh)
117{ 117{
118 struct ceph_mds_client *mdsc = &ceph_client(sb)->mdsc; 118 struct ceph_mds_client *mdsc = &ceph_sb_to_client(sb)->mdsc;
119 struct inode *inode; 119 struct inode *inode;
120 struct dentry *dentry; 120 struct dentry *dentry;
121 struct ceph_vino vino; 121 struct ceph_vino vino;
@@ -149,11 +149,11 @@ static struct dentry *__cfh_to_dentry(struct super_block *sb,
149 } 149 }
150 150
151 dentry = d_obtain_alias(inode); 151 dentry = d_obtain_alias(inode);
152 if (!dentry) { 152 if (IS_ERR(dentry)) {
153 pr_err("cfh_to_dentry %llx -- inode %p but ENOMEM\n", 153 pr_err("cfh_to_dentry %llx -- inode %p but ENOMEM\n",
154 cfh->ino, inode); 154 cfh->ino, inode);
155 iput(inode); 155 iput(inode);
156 return ERR_PTR(-ENOMEM); 156 return dentry;
157 } 157 }
158 err = ceph_init_dentry(dentry); 158 err = ceph_init_dentry(dentry);
159 if (err < 0) { 159 if (err < 0) {
@@ -202,11 +202,11 @@ static struct dentry *ceph_fh_to_parent(struct super_block *sb,
202 return ERR_PTR(-ESTALE); 202 return ERR_PTR(-ESTALE);
203 203
204 dentry = d_obtain_alias(inode); 204 dentry = d_obtain_alias(inode);
205 if (!dentry) { 205 if (IS_ERR(dentry)) {
206 pr_err("fh_to_parent %llx -- inode %p but ENOMEM\n", 206 pr_err("fh_to_parent %llx -- inode %p but ENOMEM\n",
207 cfh->ino, inode); 207 cfh->ino, inode);
208 iput(inode); 208 iput(inode);
209 return ERR_PTR(-ENOMEM); 209 return dentry;
210 } 210 }
211 err = ceph_init_dentry(dentry); 211 err = ceph_init_dentry(dentry);
212 if (err < 0) { 212 if (err < 0) {
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 7d634938edc9..6512b6701b9e 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -317,16 +317,16 @@ void ceph_release_page_vector(struct page **pages, int num_pages)
317/* 317/*
318 * allocate a vector new pages 318 * allocate a vector new pages
319 */ 319 */
320static struct page **alloc_page_vector(int num_pages) 320struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags)
321{ 321{
322 struct page **pages; 322 struct page **pages;
323 int i; 323 int i;
324 324
325 pages = kmalloc(sizeof(*pages) * num_pages, GFP_NOFS); 325 pages = kmalloc(sizeof(*pages) * num_pages, flags);
326 if (!pages) 326 if (!pages)
327 return ERR_PTR(-ENOMEM); 327 return ERR_PTR(-ENOMEM);
328 for (i = 0; i < num_pages; i++) { 328 for (i = 0; i < num_pages; i++) {
329 pages[i] = alloc_page(GFP_NOFS); 329 pages[i] = __page_cache_alloc(flags);
330 if (pages[i] == NULL) { 330 if (pages[i] == NULL) {
331 ceph_release_page_vector(pages, i); 331 ceph_release_page_vector(pages, i);
332 return ERR_PTR(-ENOMEM); 332 return ERR_PTR(-ENOMEM);
@@ -540,7 +540,7 @@ static ssize_t ceph_sync_read(struct file *file, char __user *data,
540 * in sequence. 540 * in sequence.
541 */ 541 */
542 } else { 542 } else {
543 pages = alloc_page_vector(num_pages); 543 pages = ceph_alloc_page_vector(num_pages, GFP_NOFS);
544 } 544 }
545 if (IS_ERR(pages)) 545 if (IS_ERR(pages))
546 return PTR_ERR(pages); 546 return PTR_ERR(pages);
@@ -649,8 +649,8 @@ more:
649 do_sync, 649 do_sync,
650 ci->i_truncate_seq, ci->i_truncate_size, 650 ci->i_truncate_seq, ci->i_truncate_size,
651 &mtime, false, 2); 651 &mtime, false, 2);
652 if (IS_ERR(req)) 652 if (!req)
653 return PTR_ERR(req); 653 return -ENOMEM;
654 654
655 num_pages = calc_pages_for(pos, len); 655 num_pages = calc_pages_for(pos, len);
656 656
@@ -668,7 +668,7 @@ more:
668 truncate_inode_pages_range(inode->i_mapping, pos, 668 truncate_inode_pages_range(inode->i_mapping, pos,
669 (pos+len) | (PAGE_CACHE_SIZE-1)); 669 (pos+len) | (PAGE_CACHE_SIZE-1));
670 } else { 670 } else {
671 pages = alloc_page_vector(num_pages); 671 pages = ceph_alloc_page_vector(num_pages, GFP_NOFS);
672 if (IS_ERR(pages)) { 672 if (IS_ERR(pages)) {
673 ret = PTR_ERR(pages); 673 ret = PTR_ERR(pages);
674 goto out; 674 goto out;
@@ -809,7 +809,7 @@ static ssize_t ceph_aio_write(struct kiocb *iocb, const struct iovec *iov,
809 struct file *file = iocb->ki_filp; 809 struct file *file = iocb->ki_filp;
810 struct inode *inode = file->f_dentry->d_inode; 810 struct inode *inode = file->f_dentry->d_inode;
811 struct ceph_inode_info *ci = ceph_inode(inode); 811 struct ceph_inode_info *ci = ceph_inode(inode);
812 struct ceph_osd_client *osdc = &ceph_client(inode->i_sb)->osdc; 812 struct ceph_osd_client *osdc = &ceph_sb_to_client(inode->i_sb)->osdc;
813 loff_t endoff = pos + iov->iov_len; 813 loff_t endoff = pos + iov->iov_len;
814 int got = 0; 814 int got = 0;
815 int ret, err; 815 int ret, err;
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 85b4d2ffdeba..a81b8b662c7b 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -384,7 +384,7 @@ void ceph_destroy_inode(struct inode *inode)
384 */ 384 */
385 if (ci->i_snap_realm) { 385 if (ci->i_snap_realm) {
386 struct ceph_mds_client *mdsc = 386 struct ceph_mds_client *mdsc =
387 &ceph_client(ci->vfs_inode.i_sb)->mdsc; 387 &ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc;
388 struct ceph_snap_realm *realm = ci->i_snap_realm; 388 struct ceph_snap_realm *realm = ci->i_snap_realm;
389 389
390 dout(" dropping residual ref to snap realm %p\n", realm); 390 dout(" dropping residual ref to snap realm %p\n", realm);
@@ -619,11 +619,12 @@ static int fill_inode(struct inode *inode,
619 memcpy(ci->i_xattrs.blob->vec.iov_base, 619 memcpy(ci->i_xattrs.blob->vec.iov_base,
620 iinfo->xattr_data, iinfo->xattr_len); 620 iinfo->xattr_data, iinfo->xattr_len);
621 ci->i_xattrs.version = le64_to_cpu(info->xattr_version); 621 ci->i_xattrs.version = le64_to_cpu(info->xattr_version);
622 xattr_blob = NULL;
622 } 623 }
623 624
624 inode->i_mapping->a_ops = &ceph_aops; 625 inode->i_mapping->a_ops = &ceph_aops;
625 inode->i_mapping->backing_dev_info = 626 inode->i_mapping->backing_dev_info =
626 &ceph_client(inode->i_sb)->backing_dev_info; 627 &ceph_sb_to_client(inode->i_sb)->backing_dev_info;
627 628
628 switch (inode->i_mode & S_IFMT) { 629 switch (inode->i_mode & S_IFMT) {
629 case S_IFIFO: 630 case S_IFIFO:
@@ -674,14 +675,15 @@ static int fill_inode(struct inode *inode,
674 /* set dir completion flag? */ 675 /* set dir completion flag? */
675 if (ci->i_files == 0 && ci->i_subdirs == 0 && 676 if (ci->i_files == 0 && ci->i_subdirs == 0 &&
676 ceph_snap(inode) == CEPH_NOSNAP && 677 ceph_snap(inode) == CEPH_NOSNAP &&
677 (le32_to_cpu(info->cap.caps) & CEPH_CAP_FILE_SHARED)) { 678 (le32_to_cpu(info->cap.caps) & CEPH_CAP_FILE_SHARED) &&
679 (ci->i_ceph_flags & CEPH_I_COMPLETE) == 0) {
678 dout(" marking %p complete (empty)\n", inode); 680 dout(" marking %p complete (empty)\n", inode);
679 ci->i_ceph_flags |= CEPH_I_COMPLETE; 681 ci->i_ceph_flags |= CEPH_I_COMPLETE;
680 ci->i_max_offset = 2; 682 ci->i_max_offset = 2;
681 } 683 }
682 684
683 /* it may be better to set st_size in getattr instead? */ 685 /* it may be better to set st_size in getattr instead? */
684 if (ceph_test_opt(ceph_client(inode->i_sb), RBYTES)) 686 if (ceph_test_opt(ceph_sb_to_client(inode->i_sb), RBYTES))
685 inode->i_size = ci->i_rbytes; 687 inode->i_size = ci->i_rbytes;
686 break; 688 break;
687 default: 689 default:
@@ -802,6 +804,37 @@ out_unlock:
802} 804}
803 805
804/* 806/*
807 * Set dentry's directory position based on the current dir's max, and
808 * order it in d_subdirs, so that dcache_readdir behaves.
809 */
810static void ceph_set_dentry_offset(struct dentry *dn)
811{
812 struct dentry *dir = dn->d_parent;
813 struct inode *inode = dn->d_parent->d_inode;
814 struct ceph_dentry_info *di;
815
816 BUG_ON(!inode);
817
818 di = ceph_dentry(dn);
819
820 spin_lock(&inode->i_lock);
821 if ((ceph_inode(inode)->i_ceph_flags & CEPH_I_COMPLETE) == 0) {
822 spin_unlock(&inode->i_lock);
823 return;
824 }
825 di->offset = ceph_inode(inode)->i_max_offset++;
826 spin_unlock(&inode->i_lock);
827
828 spin_lock(&dcache_lock);
829 spin_lock(&dn->d_lock);
830 list_move_tail(&dir->d_subdirs, &dn->d_u.d_child);
831 dout("set_dentry_offset %p %lld (%p %p)\n", dn, di->offset,
832 dn->d_u.d_child.prev, dn->d_u.d_child.next);
833 spin_unlock(&dn->d_lock);
834 spin_unlock(&dcache_lock);
835}
836
837/*
805 * splice a dentry to an inode. 838 * splice a dentry to an inode.
806 * caller must hold directory i_mutex for this to be safe. 839 * caller must hold directory i_mutex for this to be safe.
807 * 840 *
@@ -814,6 +847,8 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in,
814{ 847{
815 struct dentry *realdn; 848 struct dentry *realdn;
816 849
850 BUG_ON(dn->d_inode);
851
817 /* dn must be unhashed */ 852 /* dn must be unhashed */
818 if (!d_unhashed(dn)) 853 if (!d_unhashed(dn))
819 d_drop(dn); 854 d_drop(dn);
@@ -835,44 +870,17 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in,
835 dn = realdn; 870 dn = realdn;
836 } else { 871 } else {
837 BUG_ON(!ceph_dentry(dn)); 872 BUG_ON(!ceph_dentry(dn));
838
839 dout("dn %p attached to %p ino %llx.%llx\n", 873 dout("dn %p attached to %p ino %llx.%llx\n",
840 dn, dn->d_inode, ceph_vinop(dn->d_inode)); 874 dn, dn->d_inode, ceph_vinop(dn->d_inode));
841 } 875 }
842 if ((!prehash || *prehash) && d_unhashed(dn)) 876 if ((!prehash || *prehash) && d_unhashed(dn))
843 d_rehash(dn); 877 d_rehash(dn);
878 ceph_set_dentry_offset(dn);
844out: 879out:
845 return dn; 880 return dn;
846} 881}
847 882
848/* 883/*
849 * Set dentry's directory position based on the current dir's max, and
850 * order it in d_subdirs, so that dcache_readdir behaves.
851 */
852static void ceph_set_dentry_offset(struct dentry *dn)
853{
854 struct dentry *dir = dn->d_parent;
855 struct inode *inode = dn->d_parent->d_inode;
856 struct ceph_dentry_info *di;
857
858 BUG_ON(!inode);
859
860 di = ceph_dentry(dn);
861
862 spin_lock(&inode->i_lock);
863 di->offset = ceph_inode(inode)->i_max_offset++;
864 spin_unlock(&inode->i_lock);
865
866 spin_lock(&dcache_lock);
867 spin_lock(&dn->d_lock);
868 list_move_tail(&dir->d_subdirs, &dn->d_u.d_child);
869 dout("set_dentry_offset %p %lld (%p %p)\n", dn, di->offset,
870 dn->d_u.d_child.prev, dn->d_u.d_child.next);
871 spin_unlock(&dn->d_lock);
872 spin_unlock(&dcache_lock);
873}
874
875/*
876 * Incorporate results into the local cache. This is either just 884 * Incorporate results into the local cache. This is either just
877 * one inode, or a directory, dentry, and possibly linked-to inode (e.g., 885 * one inode, or a directory, dentry, and possibly linked-to inode (e.g.,
878 * after a lookup). 886 * after a lookup).
@@ -933,14 +941,8 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req,
933 941
934 if (!rinfo->head->is_target && !rinfo->head->is_dentry) { 942 if (!rinfo->head->is_target && !rinfo->head->is_dentry) {
935 dout("fill_trace reply is empty!\n"); 943 dout("fill_trace reply is empty!\n");
936 if (rinfo->head->result == 0 && req->r_locked_dir) { 944 if (rinfo->head->result == 0 && req->r_locked_dir)
937 struct ceph_inode_info *ci = 945 ceph_invalidate_dir_request(req);
938 ceph_inode(req->r_locked_dir);
939 dout(" clearing %p complete (empty trace)\n",
940 req->r_locked_dir);
941 ci->i_ceph_flags &= ~CEPH_I_COMPLETE;
942 ci->i_release_count++;
943 }
944 return 0; 946 return 0;
945 } 947 }
946 948
@@ -1011,13 +1013,18 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req,
1011 req->r_old_dentry->d_name.len, 1013 req->r_old_dentry->d_name.len,
1012 req->r_old_dentry->d_name.name, 1014 req->r_old_dentry->d_name.name,
1013 dn, dn->d_name.len, dn->d_name.name); 1015 dn, dn->d_name.len, dn->d_name.name);
1016
1014 /* ensure target dentry is invalidated, despite 1017 /* ensure target dentry is invalidated, despite
1015 rehashing bug in vfs_rename_dir */ 1018 rehashing bug in vfs_rename_dir */
1016 dn->d_time = jiffies; 1019 ceph_invalidate_dentry_lease(dn);
1017 ceph_dentry(dn)->lease_shared_gen = 0; 1020
1018 /* take overwritten dentry's readdir offset */ 1021 /* take overwritten dentry's readdir offset */
1022 dout("dn %p gets %p offset %lld (old offset %lld)\n",
1023 req->r_old_dentry, dn, ceph_dentry(dn)->offset,
1024 ceph_dentry(req->r_old_dentry)->offset);
1019 ceph_dentry(req->r_old_dentry)->offset = 1025 ceph_dentry(req->r_old_dentry)->offset =
1020 ceph_dentry(dn)->offset; 1026 ceph_dentry(dn)->offset;
1027
1021 dn = req->r_old_dentry; /* use old_dentry */ 1028 dn = req->r_old_dentry; /* use old_dentry */
1022 in = dn->d_inode; 1029 in = dn->d_inode;
1023 } 1030 }
@@ -1059,7 +1066,6 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req,
1059 goto done; 1066 goto done;
1060 } 1067 }
1061 req->r_dentry = dn; /* may have spliced */ 1068 req->r_dentry = dn; /* may have spliced */
1062 ceph_set_dentry_offset(dn);
1063 igrab(in); 1069 igrab(in);
1064 } else if (ceph_ino(in) == vino.ino && 1070 } else if (ceph_ino(in) == vino.ino &&
1065 ceph_snap(in) == vino.snap) { 1071 ceph_snap(in) == vino.snap) {
@@ -1102,7 +1108,6 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req,
1102 err = PTR_ERR(dn); 1108 err = PTR_ERR(dn);
1103 goto done; 1109 goto done;
1104 } 1110 }
1105 ceph_set_dentry_offset(dn);
1106 req->r_dentry = dn; /* may have spliced */ 1111 req->r_dentry = dn; /* may have spliced */
1107 igrab(in); 1112 igrab(in);
1108 rinfo->head->is_dentry = 1; /* fool notrace handlers */ 1113 rinfo->head->is_dentry = 1; /* fool notrace handlers */
@@ -1429,7 +1434,7 @@ void ceph_queue_vmtruncate(struct inode *inode)
1429{ 1434{
1430 struct ceph_inode_info *ci = ceph_inode(inode); 1435 struct ceph_inode_info *ci = ceph_inode(inode);
1431 1436
1432 if (queue_work(ceph_client(inode->i_sb)->trunc_wq, 1437 if (queue_work(ceph_sb_to_client(inode->i_sb)->trunc_wq,
1433 &ci->i_vmtruncate_work)) { 1438 &ci->i_vmtruncate_work)) {
1434 dout("ceph_queue_vmtruncate %p\n", inode); 1439 dout("ceph_queue_vmtruncate %p\n", inode);
1435 igrab(inode); 1440 igrab(inode);
@@ -1518,7 +1523,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
1518 struct inode *parent_inode = dentry->d_parent->d_inode; 1523 struct inode *parent_inode = dentry->d_parent->d_inode;
1519 const unsigned int ia_valid = attr->ia_valid; 1524 const unsigned int ia_valid = attr->ia_valid;
1520 struct ceph_mds_request *req; 1525 struct ceph_mds_request *req;
1521 struct ceph_mds_client *mdsc = &ceph_client(dentry->d_sb)->mdsc; 1526 struct ceph_mds_client *mdsc = &ceph_sb_to_client(dentry->d_sb)->mdsc;
1522 int issued; 1527 int issued;
1523 int release = 0, dirtied = 0; 1528 int release = 0, dirtied = 0;
1524 int mask = 0; 1529 int mask = 0;
diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c
index 8a5bcae62846..d085f07756b4 100644
--- a/fs/ceph/ioctl.c
+++ b/fs/ceph/ioctl.c
@@ -98,7 +98,7 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg)
98 struct ceph_ioctl_dataloc dl; 98 struct ceph_ioctl_dataloc dl;
99 struct inode *inode = file->f_dentry->d_inode; 99 struct inode *inode = file->f_dentry->d_inode;
100 struct ceph_inode_info *ci = ceph_inode(inode); 100 struct ceph_inode_info *ci = ceph_inode(inode);
101 struct ceph_osd_client *osdc = &ceph_client(inode->i_sb)->osdc; 101 struct ceph_osd_client *osdc = &ceph_sb_to_client(inode->i_sb)->osdc;
102 u64 len = 1, olen; 102 u64 len = 1, olen;
103 u64 tmp; 103 u64 tmp;
104 struct ceph_object_layout ol; 104 struct ceph_object_layout ol;
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 24561a557e01..885aa5710cfd 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -40,7 +40,7 @@
40static void __wake_requests(struct ceph_mds_client *mdsc, 40static void __wake_requests(struct ceph_mds_client *mdsc,
41 struct list_head *head); 41 struct list_head *head);
42 42
43const static struct ceph_connection_operations mds_con_ops; 43static const struct ceph_connection_operations mds_con_ops;
44 44
45 45
46/* 46/*
@@ -665,10 +665,10 @@ static struct ceph_msg *create_session_msg(u32 op, u64 seq)
665 struct ceph_msg *msg; 665 struct ceph_msg *msg;
666 struct ceph_mds_session_head *h; 666 struct ceph_mds_session_head *h;
667 667
668 msg = ceph_msg_new(CEPH_MSG_CLIENT_SESSION, sizeof(*h), 0, 0, NULL); 668 msg = ceph_msg_new(CEPH_MSG_CLIENT_SESSION, sizeof(*h), GFP_NOFS);
669 if (IS_ERR(msg)) { 669 if (!msg) {
670 pr_err("create_session_msg ENOMEM creating msg\n"); 670 pr_err("create_session_msg ENOMEM creating msg\n");
671 return ERR_PTR(PTR_ERR(msg)); 671 return NULL;
672 } 672 }
673 h = msg->front.iov_base; 673 h = msg->front.iov_base;
674 h->op = cpu_to_le32(op); 674 h->op = cpu_to_le32(op);
@@ -687,7 +687,6 @@ static int __open_session(struct ceph_mds_client *mdsc,
687 struct ceph_msg *msg; 687 struct ceph_msg *msg;
688 int mstate; 688 int mstate;
689 int mds = session->s_mds; 689 int mds = session->s_mds;
690 int err = 0;
691 690
692 /* wait for mds to go active? */ 691 /* wait for mds to go active? */
693 mstate = ceph_mdsmap_get_state(mdsc->mdsmap, mds); 692 mstate = ceph_mdsmap_get_state(mdsc->mdsmap, mds);
@@ -698,13 +697,9 @@ static int __open_session(struct ceph_mds_client *mdsc,
698 697
699 /* send connect message */ 698 /* send connect message */
700 msg = create_session_msg(CEPH_SESSION_REQUEST_OPEN, session->s_seq); 699 msg = create_session_msg(CEPH_SESSION_REQUEST_OPEN, session->s_seq);
701 if (IS_ERR(msg)) { 700 if (!msg)
702 err = PTR_ERR(msg); 701 return -ENOMEM;
703 goto out;
704 }
705 ceph_con_send(&session->s_con, msg); 702 ceph_con_send(&session->s_con, msg);
706
707out:
708 return 0; 703 return 0;
709} 704}
710 705
@@ -804,12 +799,49 @@ out:
804} 799}
805 800
806static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap, 801static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap,
807 void *arg) 802 void *arg)
808{ 803{
809 struct ceph_inode_info *ci = ceph_inode(inode); 804 struct ceph_inode_info *ci = ceph_inode(inode);
805 int drop = 0;
806
810 dout("removing cap %p, ci is %p, inode is %p\n", 807 dout("removing cap %p, ci is %p, inode is %p\n",
811 cap, ci, &ci->vfs_inode); 808 cap, ci, &ci->vfs_inode);
812 ceph_remove_cap(cap); 809 spin_lock(&inode->i_lock);
810 __ceph_remove_cap(cap);
811 if (!__ceph_is_any_real_caps(ci)) {
812 struct ceph_mds_client *mdsc =
813 &ceph_sb_to_client(inode->i_sb)->mdsc;
814
815 spin_lock(&mdsc->cap_dirty_lock);
816 if (!list_empty(&ci->i_dirty_item)) {
817 pr_info(" dropping dirty %s state for %p %lld\n",
818 ceph_cap_string(ci->i_dirty_caps),
819 inode, ceph_ino(inode));
820 ci->i_dirty_caps = 0;
821 list_del_init(&ci->i_dirty_item);
822 drop = 1;
823 }
824 if (!list_empty(&ci->i_flushing_item)) {
825 pr_info(" dropping dirty+flushing %s state for %p %lld\n",
826 ceph_cap_string(ci->i_flushing_caps),
827 inode, ceph_ino(inode));
828 ci->i_flushing_caps = 0;
829 list_del_init(&ci->i_flushing_item);
830 mdsc->num_cap_flushing--;
831 drop = 1;
832 }
833 if (drop && ci->i_wrbuffer_ref) {
834 pr_info(" dropping dirty data for %p %lld\n",
835 inode, ceph_ino(inode));
836 ci->i_wrbuffer_ref = 0;
837 ci->i_wrbuffer_ref_head = 0;
838 drop++;
839 }
840 spin_unlock(&mdsc->cap_dirty_lock);
841 }
842 spin_unlock(&inode->i_lock);
843 while (drop--)
844 iput(inode);
813 return 0; 845 return 0;
814} 846}
815 847
@@ -821,6 +853,7 @@ static void remove_session_caps(struct ceph_mds_session *session)
821 dout("remove_session_caps on %p\n", session); 853 dout("remove_session_caps on %p\n", session);
822 iterate_session_caps(session, remove_session_caps_cb, NULL); 854 iterate_session_caps(session, remove_session_caps_cb, NULL);
823 BUG_ON(session->s_nr_caps > 0); 855 BUG_ON(session->s_nr_caps > 0);
856 BUG_ON(!list_empty(&session->s_cap_flushing));
824 cleanup_cap_releases(session); 857 cleanup_cap_releases(session);
825} 858}
826 859
@@ -883,8 +916,8 @@ static int send_renew_caps(struct ceph_mds_client *mdsc,
883 ceph_mds_state_name(state)); 916 ceph_mds_state_name(state));
884 msg = create_session_msg(CEPH_SESSION_REQUEST_RENEWCAPS, 917 msg = create_session_msg(CEPH_SESSION_REQUEST_RENEWCAPS,
885 ++session->s_renew_seq); 918 ++session->s_renew_seq);
886 if (IS_ERR(msg)) 919 if (!msg)
887 return PTR_ERR(msg); 920 return -ENOMEM;
888 ceph_con_send(&session->s_con, msg); 921 ceph_con_send(&session->s_con, msg);
889 return 0; 922 return 0;
890} 923}
@@ -931,17 +964,15 @@ static int request_close_session(struct ceph_mds_client *mdsc,
931 struct ceph_mds_session *session) 964 struct ceph_mds_session *session)
932{ 965{
933 struct ceph_msg *msg; 966 struct ceph_msg *msg;
934 int err = 0;
935 967
936 dout("request_close_session mds%d state %s seq %lld\n", 968 dout("request_close_session mds%d state %s seq %lld\n",
937 session->s_mds, session_state_name(session->s_state), 969 session->s_mds, session_state_name(session->s_state),
938 session->s_seq); 970 session->s_seq);
939 msg = create_session_msg(CEPH_SESSION_REQUEST_CLOSE, session->s_seq); 971 msg = create_session_msg(CEPH_SESSION_REQUEST_CLOSE, session->s_seq);
940 if (IS_ERR(msg)) 972 if (!msg)
941 err = PTR_ERR(msg); 973 return -ENOMEM;
942 else 974 ceph_con_send(&session->s_con, msg);
943 ceph_con_send(&session->s_con, msg); 975 return 0;
944 return err;
945} 976}
946 977
947/* 978/*
@@ -1059,7 +1090,7 @@ static int add_cap_releases(struct ceph_mds_client *mdsc,
1059 while (session->s_num_cap_releases < session->s_nr_caps + extra) { 1090 while (session->s_num_cap_releases < session->s_nr_caps + extra) {
1060 spin_unlock(&session->s_cap_lock); 1091 spin_unlock(&session->s_cap_lock);
1061 msg = ceph_msg_new(CEPH_MSG_CLIENT_CAPRELEASE, PAGE_CACHE_SIZE, 1092 msg = ceph_msg_new(CEPH_MSG_CLIENT_CAPRELEASE, PAGE_CACHE_SIZE,
1062 0, 0, NULL); 1093 GFP_NOFS);
1063 if (!msg) 1094 if (!msg)
1064 goto out_unlocked; 1095 goto out_unlocked;
1065 dout("add_cap_releases %p msg %p now %d\n", session, msg, 1096 dout("add_cap_releases %p msg %p now %d\n", session, msg,
@@ -1151,10 +1182,8 @@ static void send_cap_releases(struct ceph_mds_client *mdsc,
1151 struct ceph_msg *msg; 1182 struct ceph_msg *msg;
1152 1183
1153 dout("send_cap_releases mds%d\n", session->s_mds); 1184 dout("send_cap_releases mds%d\n", session->s_mds);
1154 while (1) { 1185 spin_lock(&session->s_cap_lock);
1155 spin_lock(&session->s_cap_lock); 1186 while (!list_empty(&session->s_cap_releases_done)) {
1156 if (list_empty(&session->s_cap_releases_done))
1157 break;
1158 msg = list_first_entry(&session->s_cap_releases_done, 1187 msg = list_first_entry(&session->s_cap_releases_done,
1159 struct ceph_msg, list_head); 1188 struct ceph_msg, list_head);
1160 list_del_init(&msg->list_head); 1189 list_del_init(&msg->list_head);
@@ -1162,10 +1191,49 @@ static void send_cap_releases(struct ceph_mds_client *mdsc,
1162 msg->hdr.front_len = cpu_to_le32(msg->front.iov_len); 1191 msg->hdr.front_len = cpu_to_le32(msg->front.iov_len);
1163 dout("send_cap_releases mds%d %p\n", session->s_mds, msg); 1192 dout("send_cap_releases mds%d %p\n", session->s_mds, msg);
1164 ceph_con_send(&session->s_con, msg); 1193 ceph_con_send(&session->s_con, msg);
1194 spin_lock(&session->s_cap_lock);
1165 } 1195 }
1166 spin_unlock(&session->s_cap_lock); 1196 spin_unlock(&session->s_cap_lock);
1167} 1197}
1168 1198
1199static void discard_cap_releases(struct ceph_mds_client *mdsc,
1200 struct ceph_mds_session *session)
1201{
1202 struct ceph_msg *msg;
1203 struct ceph_mds_cap_release *head;
1204 unsigned num;
1205
1206 dout("discard_cap_releases mds%d\n", session->s_mds);
1207 spin_lock(&session->s_cap_lock);
1208
1209 /* zero out the in-progress message */
1210 msg = list_first_entry(&session->s_cap_releases,
1211 struct ceph_msg, list_head);
1212 head = msg->front.iov_base;
1213 num = le32_to_cpu(head->num);
1214 dout("discard_cap_releases mds%d %p %u\n", session->s_mds, msg, num);
1215 head->num = cpu_to_le32(0);
1216 session->s_num_cap_releases += num;
1217
1218 /* requeue completed messages */
1219 while (!list_empty(&session->s_cap_releases_done)) {
1220 msg = list_first_entry(&session->s_cap_releases_done,
1221 struct ceph_msg, list_head);
1222 list_del_init(&msg->list_head);
1223
1224 head = msg->front.iov_base;
1225 num = le32_to_cpu(head->num);
1226 dout("discard_cap_releases mds%d %p %u\n", session->s_mds, msg,
1227 num);
1228 session->s_num_cap_releases += num;
1229 head->num = cpu_to_le32(0);
1230 msg->front.iov_len = sizeof(*head);
1231 list_add(&msg->list_head, &session->s_cap_releases);
1232 }
1233
1234 spin_unlock(&session->s_cap_lock);
1235}
1236
1169/* 1237/*
1170 * requests 1238 * requests
1171 */ 1239 */
@@ -1181,6 +1249,7 @@ ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode)
1181 if (!req) 1249 if (!req)
1182 return ERR_PTR(-ENOMEM); 1250 return ERR_PTR(-ENOMEM);
1183 1251
1252 mutex_init(&req->r_fill_mutex);
1184 req->r_started = jiffies; 1253 req->r_started = jiffies;
1185 req->r_resend_mds = -1; 1254 req->r_resend_mds = -1;
1186 INIT_LIST_HEAD(&req->r_unsafe_dir_item); 1255 INIT_LIST_HEAD(&req->r_unsafe_dir_item);
@@ -1251,7 +1320,7 @@ retry:
1251 len += 1 + temp->d_name.len; 1320 len += 1 + temp->d_name.len;
1252 temp = temp->d_parent; 1321 temp = temp->d_parent;
1253 if (temp == NULL) { 1322 if (temp == NULL) {
1254 pr_err("build_path_dentry corrupt dentry %p\n", dentry); 1323 pr_err("build_path corrupt dentry %p\n", dentry);
1255 return ERR_PTR(-EINVAL); 1324 return ERR_PTR(-EINVAL);
1256 } 1325 }
1257 } 1326 }
@@ -1267,7 +1336,7 @@ retry:
1267 struct inode *inode = temp->d_inode; 1336 struct inode *inode = temp->d_inode;
1268 1337
1269 if (inode && ceph_snap(inode) == CEPH_SNAPDIR) { 1338 if (inode && ceph_snap(inode) == CEPH_SNAPDIR) {
1270 dout("build_path_dentry path+%d: %p SNAPDIR\n", 1339 dout("build_path path+%d: %p SNAPDIR\n",
1271 pos, temp); 1340 pos, temp);
1272 } else if (stop_on_nosnap && inode && 1341 } else if (stop_on_nosnap && inode &&
1273 ceph_snap(inode) == CEPH_NOSNAP) { 1342 ceph_snap(inode) == CEPH_NOSNAP) {
@@ -1278,20 +1347,18 @@ retry:
1278 break; 1347 break;
1279 strncpy(path + pos, temp->d_name.name, 1348 strncpy(path + pos, temp->d_name.name,
1280 temp->d_name.len); 1349 temp->d_name.len);
1281 dout("build_path_dentry path+%d: %p '%.*s'\n",
1282 pos, temp, temp->d_name.len, path + pos);
1283 } 1350 }
1284 if (pos) 1351 if (pos)
1285 path[--pos] = '/'; 1352 path[--pos] = '/';
1286 temp = temp->d_parent; 1353 temp = temp->d_parent;
1287 if (temp == NULL) { 1354 if (temp == NULL) {
1288 pr_err("build_path_dentry corrupt dentry\n"); 1355 pr_err("build_path corrupt dentry\n");
1289 kfree(path); 1356 kfree(path);
1290 return ERR_PTR(-EINVAL); 1357 return ERR_PTR(-EINVAL);
1291 } 1358 }
1292 } 1359 }
1293 if (pos != 0) { 1360 if (pos != 0) {
1294 pr_err("build_path_dentry did not end path lookup where " 1361 pr_err("build_path did not end path lookup where "
1295 "expected, namelen is %d, pos is %d\n", len, pos); 1362 "expected, namelen is %d, pos is %d\n", len, pos);
1296 /* presumably this is only possible if racing with a 1363 /* presumably this is only possible if racing with a
1297 rename of one of the parent directories (we can not 1364 rename of one of the parent directories (we can not
@@ -1303,7 +1370,7 @@ retry:
1303 1370
1304 *base = ceph_ino(temp->d_inode); 1371 *base = ceph_ino(temp->d_inode);
1305 *plen = len; 1372 *plen = len;
1306 dout("build_path_dentry on %p %d built %llx '%.*s'\n", 1373 dout("build_path on %p %d built %llx '%.*s'\n",
1307 dentry, atomic_read(&dentry->d_count), *base, len, path); 1374 dentry, atomic_read(&dentry->d_count), *base, len, path);
1308 return path; 1375 return path;
1309} 1376}
@@ -1426,9 +1493,11 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
1426 if (req->r_old_dentry_drop) 1493 if (req->r_old_dentry_drop)
1427 len += req->r_old_dentry->d_name.len; 1494 len += req->r_old_dentry->d_name.len;
1428 1495
1429 msg = ceph_msg_new(CEPH_MSG_CLIENT_REQUEST, len, 0, 0, NULL); 1496 msg = ceph_msg_new(CEPH_MSG_CLIENT_REQUEST, len, GFP_NOFS);
1430 if (IS_ERR(msg)) 1497 if (!msg) {
1498 msg = ERR_PTR(-ENOMEM);
1431 goto out_free2; 1499 goto out_free2;
1500 }
1432 1501
1433 msg->hdr.tid = cpu_to_le64(req->r_tid); 1502 msg->hdr.tid = cpu_to_le64(req->r_tid);
1434 1503
@@ -1517,9 +1586,9 @@ static int __prepare_send_request(struct ceph_mds_client *mdsc,
1517 } 1586 }
1518 msg = create_request_message(mdsc, req, mds); 1587 msg = create_request_message(mdsc, req, mds);
1519 if (IS_ERR(msg)) { 1588 if (IS_ERR(msg)) {
1520 req->r_reply = ERR_PTR(PTR_ERR(msg)); 1589 req->r_err = PTR_ERR(msg);
1521 complete_request(mdsc, req); 1590 complete_request(mdsc, req);
1522 return -PTR_ERR(msg); 1591 return PTR_ERR(msg);
1523 } 1592 }
1524 req->r_request = msg; 1593 req->r_request = msg;
1525 1594
@@ -1552,7 +1621,7 @@ static int __do_request(struct ceph_mds_client *mdsc,
1552 int mds = -1; 1621 int mds = -1;
1553 int err = -EAGAIN; 1622 int err = -EAGAIN;
1554 1623
1555 if (req->r_reply) 1624 if (req->r_err || req->r_got_result)
1556 goto out; 1625 goto out;
1557 1626
1558 if (req->r_timeout && 1627 if (req->r_timeout &&
@@ -1609,7 +1678,7 @@ out:
1609 return err; 1678 return err;
1610 1679
1611finish: 1680finish:
1612 req->r_reply = ERR_PTR(err); 1681 req->r_err = err;
1613 complete_request(mdsc, req); 1682 complete_request(mdsc, req);
1614 goto out; 1683 goto out;
1615} 1684}
@@ -1630,10 +1699,9 @@ static void __wake_requests(struct ceph_mds_client *mdsc,
1630 1699
1631/* 1700/*
1632 * Wake up threads with requests pending for @mds, so that they can 1701 * Wake up threads with requests pending for @mds, so that they can
1633 * resubmit their requests to a possibly different mds. If @all is set, 1702 * resubmit their requests to a possibly different mds.
1634 * wake up if their requests has been forwarded to @mds, too.
1635 */ 1703 */
1636static void kick_requests(struct ceph_mds_client *mdsc, int mds, int all) 1704static void kick_requests(struct ceph_mds_client *mdsc, int mds)
1637{ 1705{
1638 struct ceph_mds_request *req; 1706 struct ceph_mds_request *req;
1639 struct rb_node *p; 1707 struct rb_node *p;
@@ -1689,64 +1757,78 @@ int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,
1689 __register_request(mdsc, req, dir); 1757 __register_request(mdsc, req, dir);
1690 __do_request(mdsc, req); 1758 __do_request(mdsc, req);
1691 1759
1692 /* wait */ 1760 if (req->r_err) {
1693 if (!req->r_reply) { 1761 err = req->r_err;
1694 mutex_unlock(&mdsc->mutex); 1762 __unregister_request(mdsc, req);
1695 if (req->r_timeout) { 1763 dout("do_request early error %d\n", err);
1696 err = (long)wait_for_completion_interruptible_timeout( 1764 goto out;
1697 &req->r_completion, req->r_timeout);
1698 if (err == 0)
1699 req->r_reply = ERR_PTR(-EIO);
1700 else if (err < 0)
1701 req->r_reply = ERR_PTR(err);
1702 } else {
1703 err = wait_for_completion_interruptible(
1704 &req->r_completion);
1705 if (err)
1706 req->r_reply = ERR_PTR(err);
1707 }
1708 mutex_lock(&mdsc->mutex);
1709 } 1765 }
1710 1766
1711 if (IS_ERR(req->r_reply)) { 1767 /* wait */
1712 err = PTR_ERR(req->r_reply); 1768 mutex_unlock(&mdsc->mutex);
1713 req->r_reply = NULL; 1769 dout("do_request waiting\n");
1770 if (req->r_timeout) {
1771 err = (long)wait_for_completion_interruptible_timeout(
1772 &req->r_completion, req->r_timeout);
1773 if (err == 0)
1774 err = -EIO;
1775 } else {
1776 err = wait_for_completion_interruptible(&req->r_completion);
1777 }
1778 dout("do_request waited, got %d\n", err);
1779 mutex_lock(&mdsc->mutex);
1714 1780
1715 if (err == -ERESTARTSYS) { 1781 /* only abort if we didn't race with a real reply */
1716 /* aborted */ 1782 if (req->r_got_result) {
1717 req->r_aborted = true; 1783 err = le32_to_cpu(req->r_reply_info.head->result);
1784 } else if (err < 0) {
1785 dout("aborted request %lld with %d\n", req->r_tid, err);
1718 1786
1719 if (req->r_locked_dir && 1787 /*
1720 (req->r_op & CEPH_MDS_OP_WRITE)) { 1788 * ensure we aren't running concurrently with
1721 struct ceph_inode_info *ci = 1789 * ceph_fill_trace or ceph_readdir_prepopulate, which
1722 ceph_inode(req->r_locked_dir); 1790 * rely on locks (dir mutex) held by our caller.
1791 */
1792 mutex_lock(&req->r_fill_mutex);
1793 req->r_err = err;
1794 req->r_aborted = true;
1795 mutex_unlock(&req->r_fill_mutex);
1723 1796
1724 dout("aborted, clearing I_COMPLETE on %p\n", 1797 if (req->r_locked_dir &&
1725 req->r_locked_dir); 1798 (req->r_op & CEPH_MDS_OP_WRITE))
1726 spin_lock(&req->r_locked_dir->i_lock); 1799 ceph_invalidate_dir_request(req);
1727 ci->i_ceph_flags &= ~CEPH_I_COMPLETE;
1728 ci->i_release_count++;
1729 spin_unlock(&req->r_locked_dir->i_lock);
1730 }
1731 } else {
1732 /* clean up this request */
1733 __unregister_request(mdsc, req);
1734 if (!list_empty(&req->r_unsafe_item))
1735 list_del_init(&req->r_unsafe_item);
1736 complete(&req->r_safe_completion);
1737 }
1738 } else if (req->r_err) {
1739 err = req->r_err;
1740 } else { 1800 } else {
1741 err = le32_to_cpu(req->r_reply_info.head->result); 1801 err = req->r_err;
1742 } 1802 }
1743 mutex_unlock(&mdsc->mutex);
1744 1803
1804out:
1805 mutex_unlock(&mdsc->mutex);
1745 dout("do_request %p done, result %d\n", req, err); 1806 dout("do_request %p done, result %d\n", req, err);
1746 return err; 1807 return err;
1747} 1808}
1748 1809
1749/* 1810/*
1811 * Invalidate dir I_COMPLETE, dentry lease state on an aborted MDS
1812 * namespace request.
1813 */
1814void ceph_invalidate_dir_request(struct ceph_mds_request *req)
1815{
1816 struct inode *inode = req->r_locked_dir;
1817 struct ceph_inode_info *ci = ceph_inode(inode);
1818
1819 dout("invalidate_dir_request %p (I_COMPLETE, lease(s))\n", inode);
1820 spin_lock(&inode->i_lock);
1821 ci->i_ceph_flags &= ~CEPH_I_COMPLETE;
1822 ci->i_release_count++;
1823 spin_unlock(&inode->i_lock);
1824
1825 if (req->r_dentry)
1826 ceph_invalidate_dentry_lease(req->r_dentry);
1827 if (req->r_old_dentry)
1828 ceph_invalidate_dentry_lease(req->r_old_dentry);
1829}
1830
1831/*
1750 * Handle mds reply. 1832 * Handle mds reply.
1751 * 1833 *
1752 * We take the session mutex and parse and process the reply immediately. 1834 * We take the session mutex and parse and process the reply immediately.
@@ -1797,6 +1879,12 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)
1797 mutex_unlock(&mdsc->mutex); 1879 mutex_unlock(&mdsc->mutex);
1798 goto out; 1880 goto out;
1799 } 1881 }
1882 if (req->r_got_safe && !head->safe) {
1883 pr_warning("got unsafe after safe on %llu from mds%d\n",
1884 tid, mds);
1885 mutex_unlock(&mdsc->mutex);
1886 goto out;
1887 }
1800 1888
1801 result = le32_to_cpu(head->result); 1889 result = le32_to_cpu(head->result);
1802 1890
@@ -1838,11 +1926,7 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)
1838 mutex_unlock(&mdsc->mutex); 1926 mutex_unlock(&mdsc->mutex);
1839 goto out; 1927 goto out;
1840 } 1928 }
1841 } 1929 } else {
1842
1843 BUG_ON(req->r_reply);
1844
1845 if (!head->safe) {
1846 req->r_got_unsafe = true; 1930 req->r_got_unsafe = true;
1847 list_add_tail(&req->r_unsafe_item, &req->r_session->s_unsafe); 1931 list_add_tail(&req->r_unsafe_item, &req->r_session->s_unsafe);
1848 } 1932 }
@@ -1871,21 +1955,30 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)
1871 } 1955 }
1872 1956
1873 /* insert trace into our cache */ 1957 /* insert trace into our cache */
1958 mutex_lock(&req->r_fill_mutex);
1874 err = ceph_fill_trace(mdsc->client->sb, req, req->r_session); 1959 err = ceph_fill_trace(mdsc->client->sb, req, req->r_session);
1875 if (err == 0) { 1960 if (err == 0) {
1876 if (result == 0 && rinfo->dir_nr) 1961 if (result == 0 && rinfo->dir_nr)
1877 ceph_readdir_prepopulate(req, req->r_session); 1962 ceph_readdir_prepopulate(req, req->r_session);
1878 ceph_unreserve_caps(&req->r_caps_reservation); 1963 ceph_unreserve_caps(&req->r_caps_reservation);
1879 } 1964 }
1965 mutex_unlock(&req->r_fill_mutex);
1880 1966
1881 up_read(&mdsc->snap_rwsem); 1967 up_read(&mdsc->snap_rwsem);
1882out_err: 1968out_err:
1883 if (err) { 1969 mutex_lock(&mdsc->mutex);
1884 req->r_err = err; 1970 if (!req->r_aborted) {
1971 if (err) {
1972 req->r_err = err;
1973 } else {
1974 req->r_reply = msg;
1975 ceph_msg_get(msg);
1976 req->r_got_result = true;
1977 }
1885 } else { 1978 } else {
1886 req->r_reply = msg; 1979 dout("reply arrived after request %lld was aborted\n", tid);
1887 ceph_msg_get(msg);
1888 } 1980 }
1981 mutex_unlock(&mdsc->mutex);
1889 1982
1890 add_cap_releases(mdsc, req->r_session, -1); 1983 add_cap_releases(mdsc, req->r_session, -1);
1891 mutex_unlock(&session->s_mutex); 1984 mutex_unlock(&session->s_mutex);
@@ -1984,6 +2077,8 @@ static void handle_session(struct ceph_mds_session *session,
1984 2077
1985 switch (op) { 2078 switch (op) {
1986 case CEPH_SESSION_OPEN: 2079 case CEPH_SESSION_OPEN:
2080 if (session->s_state == CEPH_MDS_SESSION_RECONNECTING)
2081 pr_info("mds%d reconnect success\n", session->s_mds);
1987 session->s_state = CEPH_MDS_SESSION_OPEN; 2082 session->s_state = CEPH_MDS_SESSION_OPEN;
1988 renewed_caps(mdsc, session, 0); 2083 renewed_caps(mdsc, session, 0);
1989 wake = 1; 2084 wake = 1;
@@ -1997,10 +2092,12 @@ static void handle_session(struct ceph_mds_session *session,
1997 break; 2092 break;
1998 2093
1999 case CEPH_SESSION_CLOSE: 2094 case CEPH_SESSION_CLOSE:
2095 if (session->s_state == CEPH_MDS_SESSION_RECONNECTING)
2096 pr_info("mds%d reconnect denied\n", session->s_mds);
2000 remove_session_caps(session); 2097 remove_session_caps(session);
2001 wake = 1; /* for good measure */ 2098 wake = 1; /* for good measure */
2002 complete(&mdsc->session_close_waiters); 2099 complete(&mdsc->session_close_waiters);
2003 kick_requests(mdsc, mds, 0); /* cur only */ 2100 kick_requests(mdsc, mds);
2004 break; 2101 break;
2005 2102
2006 case CEPH_SESSION_STALE: 2103 case CEPH_SESSION_STALE:
@@ -2132,54 +2229,44 @@ out:
2132 * 2229 *
2133 * called with mdsc->mutex held. 2230 * called with mdsc->mutex held.
2134 */ 2231 */
2135static void send_mds_reconnect(struct ceph_mds_client *mdsc, int mds) 2232static void send_mds_reconnect(struct ceph_mds_client *mdsc,
2233 struct ceph_mds_session *session)
2136{ 2234{
2137 struct ceph_mds_session *session = NULL;
2138 struct ceph_msg *reply; 2235 struct ceph_msg *reply;
2139 struct rb_node *p; 2236 struct rb_node *p;
2237 int mds = session->s_mds;
2140 int err = -ENOMEM; 2238 int err = -ENOMEM;
2141 struct ceph_pagelist *pagelist; 2239 struct ceph_pagelist *pagelist;
2142 2240
2143 pr_info("reconnect to recovering mds%d\n", mds); 2241 pr_info("mds%d reconnect start\n", mds);
2144 2242
2145 pagelist = kmalloc(sizeof(*pagelist), GFP_NOFS); 2243 pagelist = kmalloc(sizeof(*pagelist), GFP_NOFS);
2146 if (!pagelist) 2244 if (!pagelist)
2147 goto fail_nopagelist; 2245 goto fail_nopagelist;
2148 ceph_pagelist_init(pagelist); 2246 ceph_pagelist_init(pagelist);
2149 2247
2150 reply = ceph_msg_new(CEPH_MSG_CLIENT_RECONNECT, 0, 0, 0, NULL); 2248 reply = ceph_msg_new(CEPH_MSG_CLIENT_RECONNECT, 0, GFP_NOFS);
2151 if (IS_ERR(reply)) { 2249 if (!reply)
2152 err = PTR_ERR(reply);
2153 goto fail_nomsg; 2250 goto fail_nomsg;
2154 }
2155
2156 /* find session */
2157 session = __ceph_lookup_mds_session(mdsc, mds);
2158 mutex_unlock(&mdsc->mutex); /* drop lock for duration */
2159 2251
2160 if (session) { 2252 mutex_lock(&session->s_mutex);
2161 mutex_lock(&session->s_mutex); 2253 session->s_state = CEPH_MDS_SESSION_RECONNECTING;
2254 session->s_seq = 0;
2162 2255
2163 session->s_state = CEPH_MDS_SESSION_RECONNECTING; 2256 ceph_con_open(&session->s_con,
2164 session->s_seq = 0; 2257 ceph_mdsmap_get_addr(mdsc->mdsmap, mds));
2165 2258
2166 ceph_con_open(&session->s_con, 2259 /* replay unsafe requests */
2167 ceph_mdsmap_get_addr(mdsc->mdsmap, mds)); 2260 replay_unsafe_requests(mdsc, session);
2168
2169 /* replay unsafe requests */
2170 replay_unsafe_requests(mdsc, session);
2171 } else {
2172 dout("no session for mds%d, will send short reconnect\n",
2173 mds);
2174 }
2175 2261
2176 down_read(&mdsc->snap_rwsem); 2262 down_read(&mdsc->snap_rwsem);
2177 2263
2178 if (!session)
2179 goto send;
2180 dout("session %p state %s\n", session, 2264 dout("session %p state %s\n", session,
2181 session_state_name(session->s_state)); 2265 session_state_name(session->s_state));
2182 2266
2267 /* drop old cap expires; we're about to reestablish that state */
2268 discard_cap_releases(mdsc, session);
2269
2183 /* traverse this session's caps */ 2270 /* traverse this session's caps */
2184 err = ceph_pagelist_encode_32(pagelist, session->s_nr_caps); 2271 err = ceph_pagelist_encode_32(pagelist, session->s_nr_caps);
2185 if (err) 2272 if (err)
@@ -2208,36 +2295,29 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc, int mds)
2208 goto fail; 2295 goto fail;
2209 } 2296 }
2210 2297
2211send:
2212 reply->pagelist = pagelist; 2298 reply->pagelist = pagelist;
2213 reply->hdr.data_len = cpu_to_le32(pagelist->length); 2299 reply->hdr.data_len = cpu_to_le32(pagelist->length);
2214 reply->nr_pages = calc_pages_for(0, pagelist->length); 2300 reply->nr_pages = calc_pages_for(0, pagelist->length);
2215 ceph_con_send(&session->s_con, reply); 2301 ceph_con_send(&session->s_con, reply);
2216 2302
2217 session->s_state = CEPH_MDS_SESSION_OPEN;
2218 mutex_unlock(&session->s_mutex); 2303 mutex_unlock(&session->s_mutex);
2219 2304
2220 mutex_lock(&mdsc->mutex); 2305 mutex_lock(&mdsc->mutex);
2221 __wake_requests(mdsc, &session->s_waiting); 2306 __wake_requests(mdsc, &session->s_waiting);
2222 mutex_unlock(&mdsc->mutex); 2307 mutex_unlock(&mdsc->mutex);
2223 2308
2224 ceph_put_mds_session(session);
2225
2226 up_read(&mdsc->snap_rwsem); 2309 up_read(&mdsc->snap_rwsem);
2227 mutex_lock(&mdsc->mutex);
2228 return; 2310 return;
2229 2311
2230fail: 2312fail:
2231 ceph_msg_put(reply); 2313 ceph_msg_put(reply);
2232 up_read(&mdsc->snap_rwsem); 2314 up_read(&mdsc->snap_rwsem);
2233 mutex_unlock(&session->s_mutex); 2315 mutex_unlock(&session->s_mutex);
2234 ceph_put_mds_session(session);
2235fail_nomsg: 2316fail_nomsg:
2236 ceph_pagelist_release(pagelist); 2317 ceph_pagelist_release(pagelist);
2237 kfree(pagelist); 2318 kfree(pagelist);
2238fail_nopagelist: 2319fail_nopagelist:
2239 pr_err("error %d preparing reconnect for mds%d\n", err, mds); 2320 pr_err("error %d preparing reconnect for mds%d\n", err, mds);
2240 mutex_lock(&mdsc->mutex);
2241 return; 2321 return;
2242} 2322}
2243 2323
@@ -2290,7 +2370,7 @@ static void check_new_map(struct ceph_mds_client *mdsc,
2290 } 2370 }
2291 2371
2292 /* kick any requests waiting on the recovering mds */ 2372 /* kick any requests waiting on the recovering mds */
2293 kick_requests(mdsc, i, 1); 2373 kick_requests(mdsc, i);
2294 } else if (oldstate == newstate) { 2374 } else if (oldstate == newstate) {
2295 continue; /* nothing new with this mds */ 2375 continue; /* nothing new with this mds */
2296 } 2376 }
@@ -2299,22 +2379,21 @@ static void check_new_map(struct ceph_mds_client *mdsc,
2299 * send reconnect? 2379 * send reconnect?
2300 */ 2380 */
2301 if (s->s_state == CEPH_MDS_SESSION_RESTARTING && 2381 if (s->s_state == CEPH_MDS_SESSION_RESTARTING &&
2302 newstate >= CEPH_MDS_STATE_RECONNECT) 2382 newstate >= CEPH_MDS_STATE_RECONNECT) {
2303 send_mds_reconnect(mdsc, i); 2383 mutex_unlock(&mdsc->mutex);
2384 send_mds_reconnect(mdsc, s);
2385 mutex_lock(&mdsc->mutex);
2386 }
2304 2387
2305 /* 2388 /*
2306 * kick requests on any mds that has gone active. 2389 * kick request on any mds that has gone active.
2307 *
2308 * kick requests on cur or forwarder: we may have sent
2309 * the request to mds1, mds1 told us it forwarded it
2310 * to mds2, but then we learn mds1 failed and can't be
2311 * sure it successfully forwarded our request before
2312 * it died.
2313 */ 2390 */
2314 if (oldstate < CEPH_MDS_STATE_ACTIVE && 2391 if (oldstate < CEPH_MDS_STATE_ACTIVE &&
2315 newstate >= CEPH_MDS_STATE_ACTIVE) { 2392 newstate >= CEPH_MDS_STATE_ACTIVE) {
2316 pr_info("mds%d reconnect completed\n", s->s_mds); 2393 if (oldstate != CEPH_MDS_STATE_CREATING &&
2317 kick_requests(mdsc, i, 1); 2394 oldstate != CEPH_MDS_STATE_STARTING)
2395 pr_info("mds%d recovery completed\n", s->s_mds);
2396 kick_requests(mdsc, i);
2318 ceph_kick_flushing_caps(mdsc, s); 2397 ceph_kick_flushing_caps(mdsc, s);
2319 wake_up_session_caps(s, 1); 2398 wake_up_session_caps(s, 1);
2320 } 2399 }
@@ -2457,8 +2536,8 @@ void ceph_mdsc_lease_send_msg(struct ceph_mds_session *session,
2457 dnamelen = dentry->d_name.len; 2536 dnamelen = dentry->d_name.len;
2458 len += dnamelen; 2537 len += dnamelen;
2459 2538
2460 msg = ceph_msg_new(CEPH_MSG_CLIENT_LEASE, len, 0, 0, NULL); 2539 msg = ceph_msg_new(CEPH_MSG_CLIENT_LEASE, len, GFP_NOFS);
2461 if (IS_ERR(msg)) 2540 if (!msg)
2462 return; 2541 return;
2463 lease = msg->front.iov_base; 2542 lease = msg->front.iov_base;
2464 lease->action = action; 2543 lease->action = action;
@@ -2603,7 +2682,9 @@ static void delayed_work(struct work_struct *work)
2603 else 2682 else
2604 ceph_con_keepalive(&s->s_con); 2683 ceph_con_keepalive(&s->s_con);
2605 add_cap_releases(mdsc, s, -1); 2684 add_cap_releases(mdsc, s, -1);
2606 send_cap_releases(mdsc, s); 2685 if (s->s_state == CEPH_MDS_SESSION_OPEN ||
2686 s->s_state == CEPH_MDS_SESSION_HUNG)
2687 send_cap_releases(mdsc, s);
2607 mutex_unlock(&s->s_mutex); 2688 mutex_unlock(&s->s_mutex);
2608 ceph_put_mds_session(s); 2689 ceph_put_mds_session(s);
2609 2690
@@ -2620,6 +2701,9 @@ int ceph_mdsc_init(struct ceph_mds_client *mdsc, struct ceph_client *client)
2620 mdsc->client = client; 2701 mdsc->client = client;
2621 mutex_init(&mdsc->mutex); 2702 mutex_init(&mdsc->mutex);
2622 mdsc->mdsmap = kzalloc(sizeof(*mdsc->mdsmap), GFP_NOFS); 2703 mdsc->mdsmap = kzalloc(sizeof(*mdsc->mdsmap), GFP_NOFS);
2704 if (mdsc->mdsmap == NULL)
2705 return -ENOMEM;
2706
2623 init_completion(&mdsc->safe_umount_waiters); 2707 init_completion(&mdsc->safe_umount_waiters);
2624 init_completion(&mdsc->session_close_waiters); 2708 init_completion(&mdsc->session_close_waiters);
2625 INIT_LIST_HEAD(&mdsc->waiting_for_map); 2709 INIT_LIST_HEAD(&mdsc->waiting_for_map);
@@ -2645,6 +2729,7 @@ int ceph_mdsc_init(struct ceph_mds_client *mdsc, struct ceph_client *client)
2645 init_waitqueue_head(&mdsc->cap_flushing_wq); 2729 init_waitqueue_head(&mdsc->cap_flushing_wq);
2646 spin_lock_init(&mdsc->dentry_lru_lock); 2730 spin_lock_init(&mdsc->dentry_lru_lock);
2647 INIT_LIST_HEAD(&mdsc->dentry_lru); 2731 INIT_LIST_HEAD(&mdsc->dentry_lru);
2732
2648 return 0; 2733 return 0;
2649} 2734}
2650 2735
@@ -2740,6 +2825,9 @@ void ceph_mdsc_sync(struct ceph_mds_client *mdsc)
2740{ 2825{
2741 u64 want_tid, want_flush; 2826 u64 want_tid, want_flush;
2742 2827
2828 if (mdsc->client->mount_state == CEPH_MOUNT_SHUTDOWN)
2829 return;
2830
2743 dout("sync\n"); 2831 dout("sync\n");
2744 mutex_lock(&mdsc->mutex); 2832 mutex_lock(&mdsc->mutex);
2745 want_tid = mdsc->last_tid; 2833 want_tid = mdsc->last_tid;
@@ -2922,9 +3010,10 @@ static void con_put(struct ceph_connection *con)
2922static void peer_reset(struct ceph_connection *con) 3010static void peer_reset(struct ceph_connection *con)
2923{ 3011{
2924 struct ceph_mds_session *s = con->private; 3012 struct ceph_mds_session *s = con->private;
3013 struct ceph_mds_client *mdsc = s->s_mdsc;
2925 3014
2926 pr_err("mds%d gave us the boot. IMPLEMENT RECONNECT.\n", 3015 pr_warning("mds%d closed our session\n", s->s_mds);
2927 s->s_mds); 3016 send_mds_reconnect(mdsc, s);
2928} 3017}
2929 3018
2930static void dispatch(struct ceph_connection *con, struct ceph_msg *msg) 3019static void dispatch(struct ceph_connection *con, struct ceph_msg *msg)
@@ -3031,7 +3120,7 @@ static int invalidate_authorizer(struct ceph_connection *con)
3031 return ceph_monc_validate_auth(&mdsc->client->monc); 3120 return ceph_monc_validate_auth(&mdsc->client->monc);
3032} 3121}
3033 3122
3034const static struct ceph_connection_operations mds_con_ops = { 3123static const struct ceph_connection_operations mds_con_ops = {
3035 .get = con_get, 3124 .get = con_get,
3036 .put = con_put, 3125 .put = con_put,
3037 .dispatch = dispatch, 3126 .dispatch = dispatch,
diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h
index 961cc6f65878..d9936c4f1212 100644
--- a/fs/ceph/mds_client.h
+++ b/fs/ceph/mds_client.h
@@ -165,6 +165,8 @@ struct ceph_mds_request {
165 struct inode *r_locked_dir; /* dir (if any) i_mutex locked by vfs */ 165 struct inode *r_locked_dir; /* dir (if any) i_mutex locked by vfs */
166 struct inode *r_target_inode; /* resulting inode */ 166 struct inode *r_target_inode; /* resulting inode */
167 167
168 struct mutex r_fill_mutex;
169
168 union ceph_mds_request_args r_args; 170 union ceph_mds_request_args r_args;
169 int r_fmode; /* file mode, if expecting cap */ 171 int r_fmode; /* file mode, if expecting cap */
170 172
@@ -213,7 +215,7 @@ struct ceph_mds_request {
213 struct completion r_safe_completion; 215 struct completion r_safe_completion;
214 ceph_mds_request_callback_t r_callback; 216 ceph_mds_request_callback_t r_callback;
215 struct list_head r_unsafe_item; /* per-session unsafe list item */ 217 struct list_head r_unsafe_item; /* per-session unsafe list item */
216 bool r_got_unsafe, r_got_safe; 218 bool r_got_unsafe, r_got_safe, r_got_result;
217 219
218 bool r_did_prepopulate; 220 bool r_did_prepopulate;
219 u32 r_readdir_offset; 221 u32 r_readdir_offset;
@@ -301,6 +303,8 @@ extern void ceph_mdsc_lease_release(struct ceph_mds_client *mdsc,
301 struct inode *inode, 303 struct inode *inode,
302 struct dentry *dn, int mask); 304 struct dentry *dn, int mask);
303 305
306extern void ceph_invalidate_dir_request(struct ceph_mds_request *req);
307
304extern struct ceph_mds_request * 308extern struct ceph_mds_request *
305ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode); 309ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode);
306extern void ceph_mdsc_submit_request(struct ceph_mds_client *mdsc, 310extern void ceph_mdsc_submit_request(struct ceph_mds_client *mdsc,
diff --git a/fs/ceph/messenger.c b/fs/ceph/messenger.c
index cd4fadb6491a..60b74839ebec 100644
--- a/fs/ceph/messenger.c
+++ b/fs/ceph/messenger.c
@@ -39,18 +39,6 @@ static void queue_con(struct ceph_connection *con);
39static void con_work(struct work_struct *); 39static void con_work(struct work_struct *);
40static void ceph_fault(struct ceph_connection *con); 40static void ceph_fault(struct ceph_connection *con);
41 41
42const char *ceph_name_type_str(int t)
43{
44 switch (t) {
45 case CEPH_ENTITY_TYPE_MON: return "mon";
46 case CEPH_ENTITY_TYPE_MDS: return "mds";
47 case CEPH_ENTITY_TYPE_OSD: return "osd";
48 case CEPH_ENTITY_TYPE_CLIENT: return "client";
49 case CEPH_ENTITY_TYPE_ADMIN: return "admin";
50 default: return "???";
51 }
52}
53
54/* 42/*
55 * nicely render a sockaddr as a string. 43 * nicely render a sockaddr as a string.
56 */ 44 */
@@ -340,6 +328,7 @@ static void reset_connection(struct ceph_connection *con)
340 ceph_msg_put(con->out_msg); 328 ceph_msg_put(con->out_msg);
341 con->out_msg = NULL; 329 con->out_msg = NULL;
342 } 330 }
331 con->out_keepalive_pending = false;
343 con->in_seq = 0; 332 con->in_seq = 0;
344 con->in_seq_acked = 0; 333 con->in_seq_acked = 0;
345} 334}
@@ -357,6 +346,7 @@ void ceph_con_close(struct ceph_connection *con)
357 clear_bit(WRITE_PENDING, &con->state); 346 clear_bit(WRITE_PENDING, &con->state);
358 mutex_lock(&con->mutex); 347 mutex_lock(&con->mutex);
359 reset_connection(con); 348 reset_connection(con);
349 con->peer_global_seq = 0;
360 cancel_delayed_work(&con->work); 350 cancel_delayed_work(&con->work);
361 mutex_unlock(&con->mutex); 351 mutex_unlock(&con->mutex);
362 queue_con(con); 352 queue_con(con);
@@ -661,7 +651,7 @@ static void prepare_write_connect(struct ceph_messenger *msgr,
661 dout("prepare_write_connect %p cseq=%d gseq=%d proto=%d\n", con, 651 dout("prepare_write_connect %p cseq=%d gseq=%d proto=%d\n", con,
662 con->connect_seq, global_seq, proto); 652 con->connect_seq, global_seq, proto);
663 653
664 con->out_connect.features = CEPH_FEATURE_SUPPORTED; 654 con->out_connect.features = CEPH_FEATURE_SUPPORTED_CLIENT;
665 con->out_connect.host_type = cpu_to_le32(CEPH_ENTITY_TYPE_CLIENT); 655 con->out_connect.host_type = cpu_to_le32(CEPH_ENTITY_TYPE_CLIENT);
666 con->out_connect.connect_seq = cpu_to_le32(con->connect_seq); 656 con->out_connect.connect_seq = cpu_to_le32(con->connect_seq);
667 con->out_connect.global_seq = cpu_to_le32(global_seq); 657 con->out_connect.global_seq = cpu_to_le32(global_seq);
@@ -1124,8 +1114,8 @@ static void fail_protocol(struct ceph_connection *con)
1124 1114
1125static int process_connect(struct ceph_connection *con) 1115static int process_connect(struct ceph_connection *con)
1126{ 1116{
1127 u64 sup_feat = CEPH_FEATURE_SUPPORTED; 1117 u64 sup_feat = CEPH_FEATURE_SUPPORTED_CLIENT;
1128 u64 req_feat = CEPH_FEATURE_REQUIRED; 1118 u64 req_feat = CEPH_FEATURE_REQUIRED_CLIENT;
1129 u64 server_feat = le64_to_cpu(con->in_reply.features); 1119 u64 server_feat = le64_to_cpu(con->in_reply.features);
1130 1120
1131 dout("process_connect on %p tag %d\n", con, (int)con->in_tag); 1121 dout("process_connect on %p tag %d\n", con, (int)con->in_tag);
@@ -1233,6 +1223,7 @@ static int process_connect(struct ceph_connection *con)
1233 clear_bit(CONNECTING, &con->state); 1223 clear_bit(CONNECTING, &con->state);
1234 con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq); 1224 con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq);
1235 con->connect_seq++; 1225 con->connect_seq++;
1226 con->peer_features = server_feat;
1236 dout("process_connect got READY gseq %d cseq %d (%d)\n", 1227 dout("process_connect got READY gseq %d cseq %d (%d)\n",
1237 con->peer_global_seq, 1228 con->peer_global_seq,
1238 le32_to_cpu(con->in_reply.connect_seq), 1229 le32_to_cpu(con->in_reply.connect_seq),
@@ -1402,19 +1393,17 @@ static int read_partial_message(struct ceph_connection *con)
1402 con->in_msg = ceph_alloc_msg(con, &con->in_hdr, &skip); 1393 con->in_msg = ceph_alloc_msg(con, &con->in_hdr, &skip);
1403 if (skip) { 1394 if (skip) {
1404 /* skip this message */ 1395 /* skip this message */
1405 dout("alloc_msg returned NULL, skipping message\n"); 1396 dout("alloc_msg said skip message\n");
1406 con->in_base_pos = -front_len - middle_len - data_len - 1397 con->in_base_pos = -front_len - middle_len - data_len -
1407 sizeof(m->footer); 1398 sizeof(m->footer);
1408 con->in_tag = CEPH_MSGR_TAG_READY; 1399 con->in_tag = CEPH_MSGR_TAG_READY;
1409 con->in_seq++; 1400 con->in_seq++;
1410 return 0; 1401 return 0;
1411 } 1402 }
1412 if (IS_ERR(con->in_msg)) { 1403 if (!con->in_msg) {
1413 ret = PTR_ERR(con->in_msg);
1414 con->in_msg = NULL;
1415 con->error_msg = 1404 con->error_msg =
1416 "error allocating memory for incoming message"; 1405 "error allocating memory for incoming message";
1417 return ret; 1406 return -ENOMEM;
1418 } 1407 }
1419 m = con->in_msg; 1408 m = con->in_msg;
1420 m->front.iov_len = 0; /* haven't read it yet */ 1409 m->front.iov_len = 0; /* haven't read it yet */
@@ -1514,14 +1503,14 @@ static void process_message(struct ceph_connection *con)
1514 1503
1515 /* if first message, set peer_name */ 1504 /* if first message, set peer_name */
1516 if (con->peer_name.type == 0) 1505 if (con->peer_name.type == 0)
1517 con->peer_name = msg->hdr.src.name; 1506 con->peer_name = msg->hdr.src;
1518 1507
1519 con->in_seq++; 1508 con->in_seq++;
1520 mutex_unlock(&con->mutex); 1509 mutex_unlock(&con->mutex);
1521 1510
1522 dout("===== %p %llu from %s%lld %d=%s len %d+%d (%u %u %u) =====\n", 1511 dout("===== %p %llu from %s%lld %d=%s len %d+%d (%u %u %u) =====\n",
1523 msg, le64_to_cpu(msg->hdr.seq), 1512 msg, le64_to_cpu(msg->hdr.seq),
1524 ENTITY_NAME(msg->hdr.src.name), 1513 ENTITY_NAME(msg->hdr.src),
1525 le16_to_cpu(msg->hdr.type), 1514 le16_to_cpu(msg->hdr.type),
1526 ceph_msg_type_name(le16_to_cpu(msg->hdr.type)), 1515 ceph_msg_type_name(le16_to_cpu(msg->hdr.type)),
1527 le32_to_cpu(msg->hdr.front_len), 1516 le32_to_cpu(msg->hdr.front_len),
@@ -1546,7 +1535,6 @@ static int try_write(struct ceph_connection *con)
1546 dout("try_write start %p state %lu nref %d\n", con, con->state, 1535 dout("try_write start %p state %lu nref %d\n", con, con->state,
1547 atomic_read(&con->nref)); 1536 atomic_read(&con->nref));
1548 1537
1549 mutex_lock(&con->mutex);
1550more: 1538more:
1551 dout("try_write out_kvec_bytes %d\n", con->out_kvec_bytes); 1539 dout("try_write out_kvec_bytes %d\n", con->out_kvec_bytes);
1552 1540
@@ -1639,7 +1627,6 @@ do_next:
1639done: 1627done:
1640 ret = 0; 1628 ret = 0;
1641out: 1629out:
1642 mutex_unlock(&con->mutex);
1643 dout("try_write done on %p\n", con); 1630 dout("try_write done on %p\n", con);
1644 return ret; 1631 return ret;
1645} 1632}
@@ -1651,7 +1638,6 @@ out:
1651 */ 1638 */
1652static int try_read(struct ceph_connection *con) 1639static int try_read(struct ceph_connection *con)
1653{ 1640{
1654 struct ceph_messenger *msgr;
1655 int ret = -1; 1641 int ret = -1;
1656 1642
1657 if (!con->sock) 1643 if (!con->sock)
@@ -1661,9 +1647,6 @@ static int try_read(struct ceph_connection *con)
1661 return 0; 1647 return 0;
1662 1648
1663 dout("try_read start on %p\n", con); 1649 dout("try_read start on %p\n", con);
1664 msgr = con->msgr;
1665
1666 mutex_lock(&con->mutex);
1667 1650
1668more: 1651more:
1669 dout("try_read tag %d in_base_pos %d\n", (int)con->in_tag, 1652 dout("try_read tag %d in_base_pos %d\n", (int)con->in_tag,
@@ -1758,7 +1741,6 @@ more:
1758done: 1741done:
1759 ret = 0; 1742 ret = 0;
1760out: 1743out:
1761 mutex_unlock(&con->mutex);
1762 dout("try_read done on %p\n", con); 1744 dout("try_read done on %p\n", con);
1763 return ret; 1745 return ret;
1764 1746
@@ -1830,6 +1812,8 @@ more:
1830 dout("con_work %p start, clearing QUEUED\n", con); 1812 dout("con_work %p start, clearing QUEUED\n", con);
1831 clear_bit(QUEUED, &con->state); 1813 clear_bit(QUEUED, &con->state);
1832 1814
1815 mutex_lock(&con->mutex);
1816
1833 if (test_bit(CLOSED, &con->state)) { /* e.g. if we are replaced */ 1817 if (test_bit(CLOSED, &con->state)) { /* e.g. if we are replaced */
1834 dout("con_work CLOSED\n"); 1818 dout("con_work CLOSED\n");
1835 con_close_socket(con); 1819 con_close_socket(con);
@@ -1844,11 +1828,16 @@ more:
1844 if (test_and_clear_bit(SOCK_CLOSED, &con->state) || 1828 if (test_and_clear_bit(SOCK_CLOSED, &con->state) ||
1845 try_read(con) < 0 || 1829 try_read(con) < 0 ||
1846 try_write(con) < 0) { 1830 try_write(con) < 0) {
1831 mutex_unlock(&con->mutex);
1847 backoff = 1; 1832 backoff = 1;
1848 ceph_fault(con); /* error/fault path */ 1833 ceph_fault(con); /* error/fault path */
1834 goto done_unlocked;
1849 } 1835 }
1850 1836
1851done: 1837done:
1838 mutex_unlock(&con->mutex);
1839
1840done_unlocked:
1852 clear_bit(BUSY, &con->state); 1841 clear_bit(BUSY, &con->state);
1853 dout("con->state=%lu\n", con->state); 1842 dout("con->state=%lu\n", con->state);
1854 if (test_bit(QUEUED, &con->state)) { 1843 if (test_bit(QUEUED, &con->state)) {
@@ -1947,7 +1936,7 @@ struct ceph_messenger *ceph_messenger_create(struct ceph_entity_addr *myaddr)
1947 1936
1948 /* the zero page is needed if a request is "canceled" while the message 1937 /* the zero page is needed if a request is "canceled" while the message
1949 * is being written over the socket */ 1938 * is being written over the socket */
1950 msgr->zero_page = alloc_page(GFP_KERNEL | __GFP_ZERO); 1939 msgr->zero_page = __page_cache_alloc(GFP_KERNEL | __GFP_ZERO);
1951 if (!msgr->zero_page) { 1940 if (!msgr->zero_page) {
1952 kfree(msgr); 1941 kfree(msgr);
1953 return ERR_PTR(-ENOMEM); 1942 return ERR_PTR(-ENOMEM);
@@ -1987,9 +1976,7 @@ void ceph_con_send(struct ceph_connection *con, struct ceph_msg *msg)
1987 } 1976 }
1988 1977
1989 /* set src+dst */ 1978 /* set src+dst */
1990 msg->hdr.src.name = con->msgr->inst.name; 1979 msg->hdr.src = con->msgr->inst.name;
1991 msg->hdr.src.addr = con->msgr->my_enc_addr;
1992 msg->hdr.orig_src = msg->hdr.src;
1993 1980
1994 BUG_ON(msg->front.iov_len != le32_to_cpu(msg->hdr.front_len)); 1981 BUG_ON(msg->front.iov_len != le32_to_cpu(msg->hdr.front_len));
1995 1982
@@ -2083,12 +2070,11 @@ void ceph_con_keepalive(struct ceph_connection *con)
2083 * construct a new message with given type, size 2070 * construct a new message with given type, size
2084 * the new msg has a ref count of 1. 2071 * the new msg has a ref count of 1.
2085 */ 2072 */
2086struct ceph_msg *ceph_msg_new(int type, int front_len, 2073struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags)
2087 int page_len, int page_off, struct page **pages)
2088{ 2074{
2089 struct ceph_msg *m; 2075 struct ceph_msg *m;
2090 2076
2091 m = kmalloc(sizeof(*m), GFP_NOFS); 2077 m = kmalloc(sizeof(*m), flags);
2092 if (m == NULL) 2078 if (m == NULL)
2093 goto out; 2079 goto out;
2094 kref_init(&m->kref); 2080 kref_init(&m->kref);
@@ -2100,8 +2086,8 @@ struct ceph_msg *ceph_msg_new(int type, int front_len,
2100 m->hdr.version = 0; 2086 m->hdr.version = 0;
2101 m->hdr.front_len = cpu_to_le32(front_len); 2087 m->hdr.front_len = cpu_to_le32(front_len);
2102 m->hdr.middle_len = 0; 2088 m->hdr.middle_len = 0;
2103 m->hdr.data_len = cpu_to_le32(page_len); 2089 m->hdr.data_len = 0;
2104 m->hdr.data_off = cpu_to_le16(page_off); 2090 m->hdr.data_off = 0;
2105 m->hdr.reserved = 0; 2091 m->hdr.reserved = 0;
2106 m->footer.front_crc = 0; 2092 m->footer.front_crc = 0;
2107 m->footer.middle_crc = 0; 2093 m->footer.middle_crc = 0;
@@ -2115,11 +2101,11 @@ struct ceph_msg *ceph_msg_new(int type, int front_len,
2115 /* front */ 2101 /* front */
2116 if (front_len) { 2102 if (front_len) {
2117 if (front_len > PAGE_CACHE_SIZE) { 2103 if (front_len > PAGE_CACHE_SIZE) {
2118 m->front.iov_base = __vmalloc(front_len, GFP_NOFS, 2104 m->front.iov_base = __vmalloc(front_len, flags,
2119 PAGE_KERNEL); 2105 PAGE_KERNEL);
2120 m->front_is_vmalloc = true; 2106 m->front_is_vmalloc = true;
2121 } else { 2107 } else {
2122 m->front.iov_base = kmalloc(front_len, GFP_NOFS); 2108 m->front.iov_base = kmalloc(front_len, flags);
2123 } 2109 }
2124 if (m->front.iov_base == NULL) { 2110 if (m->front.iov_base == NULL) {
2125 pr_err("msg_new can't allocate %d bytes\n", 2111 pr_err("msg_new can't allocate %d bytes\n",
@@ -2135,19 +2121,18 @@ struct ceph_msg *ceph_msg_new(int type, int front_len,
2135 m->middle = NULL; 2121 m->middle = NULL;
2136 2122
2137 /* data */ 2123 /* data */
2138 m->nr_pages = calc_pages_for(page_off, page_len); 2124 m->nr_pages = 0;
2139 m->pages = pages; 2125 m->pages = NULL;
2140 m->pagelist = NULL; 2126 m->pagelist = NULL;
2141 2127
2142 dout("ceph_msg_new %p page %d~%d -> %d\n", m, page_off, page_len, 2128 dout("ceph_msg_new %p front %d\n", m, front_len);
2143 m->nr_pages);
2144 return m; 2129 return m;
2145 2130
2146out2: 2131out2:
2147 ceph_msg_put(m); 2132 ceph_msg_put(m);
2148out: 2133out:
2149 pr_err("msg_new can't create type %d len %d\n", type, front_len); 2134 pr_err("msg_new can't create type %d front %d\n", type, front_len);
2150 return ERR_PTR(-ENOMEM); 2135 return NULL;
2151} 2136}
2152 2137
2153/* 2138/*
@@ -2190,29 +2175,25 @@ static struct ceph_msg *ceph_alloc_msg(struct ceph_connection *con,
2190 mutex_unlock(&con->mutex); 2175 mutex_unlock(&con->mutex);
2191 msg = con->ops->alloc_msg(con, hdr, skip); 2176 msg = con->ops->alloc_msg(con, hdr, skip);
2192 mutex_lock(&con->mutex); 2177 mutex_lock(&con->mutex);
2193 if (IS_ERR(msg)) 2178 if (!msg || *skip)
2194 return msg;
2195
2196 if (*skip)
2197 return NULL; 2179 return NULL;
2198 } 2180 }
2199 if (!msg) { 2181 if (!msg) {
2200 *skip = 0; 2182 *skip = 0;
2201 msg = ceph_msg_new(type, front_len, 0, 0, NULL); 2183 msg = ceph_msg_new(type, front_len, GFP_NOFS);
2202 if (!msg) { 2184 if (!msg) {
2203 pr_err("unable to allocate msg type %d len %d\n", 2185 pr_err("unable to allocate msg type %d len %d\n",
2204 type, front_len); 2186 type, front_len);
2205 return ERR_PTR(-ENOMEM); 2187 return NULL;
2206 } 2188 }
2207 } 2189 }
2208 memcpy(&msg->hdr, &con->in_hdr, sizeof(con->in_hdr)); 2190 memcpy(&msg->hdr, &con->in_hdr, sizeof(con->in_hdr));
2209 2191
2210 if (middle_len) { 2192 if (middle_len && !msg->middle) {
2211 ret = ceph_alloc_middle(con, msg); 2193 ret = ceph_alloc_middle(con, msg);
2212
2213 if (ret < 0) { 2194 if (ret < 0) {
2214 ceph_msg_put(msg); 2195 ceph_msg_put(msg);
2215 return msg; 2196 return NULL;
2216 } 2197 }
2217 } 2198 }
2218 2199
diff --git a/fs/ceph/messenger.h b/fs/ceph/messenger.h
index a5caf91cc971..00a9430b1ffc 100644
--- a/fs/ceph/messenger.h
+++ b/fs/ceph/messenger.h
@@ -49,10 +49,8 @@ struct ceph_connection_operations {
49 int *skip); 49 int *skip);
50}; 50};
51 51
52extern const char *ceph_name_type_str(int t);
53
54/* use format string %s%d */ 52/* use format string %s%d */
55#define ENTITY_NAME(n) ceph_name_type_str((n).type), le64_to_cpu((n).num) 53#define ENTITY_NAME(n) ceph_entity_type_name((n).type), le64_to_cpu((n).num)
56 54
57struct ceph_messenger { 55struct ceph_messenger {
58 struct ceph_entity_inst inst; /* my name+address */ 56 struct ceph_entity_inst inst; /* my name+address */
@@ -144,6 +142,7 @@ struct ceph_connection {
144 struct ceph_entity_addr peer_addr; /* peer address */ 142 struct ceph_entity_addr peer_addr; /* peer address */
145 struct ceph_entity_name peer_name; /* peer name */ 143 struct ceph_entity_name peer_name; /* peer name */
146 struct ceph_entity_addr peer_addr_for_me; 144 struct ceph_entity_addr peer_addr_for_me;
145 unsigned peer_features;
147 u32 connect_seq; /* identify the most recent connection 146 u32 connect_seq; /* identify the most recent connection
148 attempt for this connection, client */ 147 attempt for this connection, client */
149 u32 peer_global_seq; /* peer's global seq for this connection */ 148 u32 peer_global_seq; /* peer's global seq for this connection */
@@ -158,7 +157,6 @@ struct ceph_connection {
158 struct list_head out_queue; 157 struct list_head out_queue;
159 struct list_head out_sent; /* sending or sent but unacked */ 158 struct list_head out_sent; /* sending or sent but unacked */
160 u64 out_seq; /* last message queued for send */ 159 u64 out_seq; /* last message queued for send */
161 u64 out_seq_sent; /* last message sent */
162 bool out_keepalive_pending; 160 bool out_keepalive_pending;
163 161
164 u64 in_seq, in_seq_acked; /* last message received, acked */ 162 u64 in_seq, in_seq_acked; /* last message received, acked */
@@ -234,9 +232,7 @@ extern void ceph_con_keepalive(struct ceph_connection *con);
234extern struct ceph_connection *ceph_con_get(struct ceph_connection *con); 232extern struct ceph_connection *ceph_con_get(struct ceph_connection *con);
235extern void ceph_con_put(struct ceph_connection *con); 233extern void ceph_con_put(struct ceph_connection *con);
236 234
237extern struct ceph_msg *ceph_msg_new(int type, int front_len, 235extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags);
238 int page_len, int page_off,
239 struct page **pages);
240extern void ceph_msg_kfree(struct ceph_msg *m); 236extern void ceph_msg_kfree(struct ceph_msg *m);
241 237
242 238
diff --git a/fs/ceph/mon_client.c b/fs/ceph/mon_client.c
index 8fdc011ca956..f6510a476e7e 100644
--- a/fs/ceph/mon_client.c
+++ b/fs/ceph/mon_client.c
@@ -28,7 +28,7 @@
28 * resend any outstanding requests. 28 * resend any outstanding requests.
29 */ 29 */
30 30
31const static struct ceph_connection_operations mon_con_ops; 31static const struct ceph_connection_operations mon_con_ops;
32 32
33static int __validate_auth(struct ceph_mon_client *monc); 33static int __validate_auth(struct ceph_mon_client *monc);
34 34
@@ -104,6 +104,7 @@ static void __send_prepared_auth_request(struct ceph_mon_client *monc, int len)
104 monc->pending_auth = 1; 104 monc->pending_auth = 1;
105 monc->m_auth->front.iov_len = len; 105 monc->m_auth->front.iov_len = len;
106 monc->m_auth->hdr.front_len = cpu_to_le32(len); 106 monc->m_auth->hdr.front_len = cpu_to_le32(len);
107 ceph_con_revoke(monc->con, monc->m_auth);
107 ceph_msg_get(monc->m_auth); /* keep our ref */ 108 ceph_msg_get(monc->m_auth); /* keep our ref */
108 ceph_con_send(monc->con, monc->m_auth); 109 ceph_con_send(monc->con, monc->m_auth);
109} 110}
@@ -187,16 +188,12 @@ static void __send_subscribe(struct ceph_mon_client *monc)
187 monc->want_next_osdmap); 188 monc->want_next_osdmap);
188 if ((__sub_expired(monc) && !monc->sub_sent) || 189 if ((__sub_expired(monc) && !monc->sub_sent) ||
189 monc->want_next_osdmap == 1) { 190 monc->want_next_osdmap == 1) {
190 struct ceph_msg *msg; 191 struct ceph_msg *msg = monc->m_subscribe;
191 struct ceph_mon_subscribe_item *i; 192 struct ceph_mon_subscribe_item *i;
192 void *p, *end; 193 void *p, *end;
193 194
194 msg = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE, 96, 0, 0, NULL);
195 if (!msg)
196 return;
197
198 p = msg->front.iov_base; 195 p = msg->front.iov_base;
199 end = p + msg->front.iov_len; 196 end = p + msg->front_max;
200 197
201 dout("__send_subscribe to 'mdsmap' %u+\n", 198 dout("__send_subscribe to 'mdsmap' %u+\n",
202 (unsigned)monc->have_mdsmap); 199 (unsigned)monc->have_mdsmap);
@@ -226,7 +223,8 @@ static void __send_subscribe(struct ceph_mon_client *monc)
226 223
227 msg->front.iov_len = p - msg->front.iov_base; 224 msg->front.iov_len = p - msg->front.iov_base;
228 msg->hdr.front_len = cpu_to_le32(msg->front.iov_len); 225 msg->hdr.front_len = cpu_to_le32(msg->front.iov_len);
229 ceph_con_send(monc->con, msg); 226 ceph_con_revoke(monc->con, msg);
227 ceph_con_send(monc->con, ceph_msg_get(msg));
230 228
231 monc->sub_sent = jiffies | 1; /* never 0 */ 229 monc->sub_sent = jiffies | 1; /* never 0 */
232 } 230 }
@@ -353,14 +351,14 @@ out:
353/* 351/*
354 * statfs 352 * statfs
355 */ 353 */
356static struct ceph_mon_statfs_request *__lookup_statfs( 354static struct ceph_mon_generic_request *__lookup_generic_req(
357 struct ceph_mon_client *monc, u64 tid) 355 struct ceph_mon_client *monc, u64 tid)
358{ 356{
359 struct ceph_mon_statfs_request *req; 357 struct ceph_mon_generic_request *req;
360 struct rb_node *n = monc->statfs_request_tree.rb_node; 358 struct rb_node *n = monc->generic_request_tree.rb_node;
361 359
362 while (n) { 360 while (n) {
363 req = rb_entry(n, struct ceph_mon_statfs_request, node); 361 req = rb_entry(n, struct ceph_mon_generic_request, node);
364 if (tid < req->tid) 362 if (tid < req->tid)
365 n = n->rb_left; 363 n = n->rb_left;
366 else if (tid > req->tid) 364 else if (tid > req->tid)
@@ -371,16 +369,16 @@ static struct ceph_mon_statfs_request *__lookup_statfs(
371 return NULL; 369 return NULL;
372} 370}
373 371
374static void __insert_statfs(struct ceph_mon_client *monc, 372static void __insert_generic_request(struct ceph_mon_client *monc,
375 struct ceph_mon_statfs_request *new) 373 struct ceph_mon_generic_request *new)
376{ 374{
377 struct rb_node **p = &monc->statfs_request_tree.rb_node; 375 struct rb_node **p = &monc->generic_request_tree.rb_node;
378 struct rb_node *parent = NULL; 376 struct rb_node *parent = NULL;
379 struct ceph_mon_statfs_request *req = NULL; 377 struct ceph_mon_generic_request *req = NULL;
380 378
381 while (*p) { 379 while (*p) {
382 parent = *p; 380 parent = *p;
383 req = rb_entry(parent, struct ceph_mon_statfs_request, node); 381 req = rb_entry(parent, struct ceph_mon_generic_request, node);
384 if (new->tid < req->tid) 382 if (new->tid < req->tid)
385 p = &(*p)->rb_left; 383 p = &(*p)->rb_left;
386 else if (new->tid > req->tid) 384 else if (new->tid > req->tid)
@@ -390,113 +388,157 @@ static void __insert_statfs(struct ceph_mon_client *monc,
390 } 388 }
391 389
392 rb_link_node(&new->node, parent, p); 390 rb_link_node(&new->node, parent, p);
393 rb_insert_color(&new->node, &monc->statfs_request_tree); 391 rb_insert_color(&new->node, &monc->generic_request_tree);
392}
393
394static void release_generic_request(struct kref *kref)
395{
396 struct ceph_mon_generic_request *req =
397 container_of(kref, struct ceph_mon_generic_request, kref);
398
399 if (req->reply)
400 ceph_msg_put(req->reply);
401 if (req->request)
402 ceph_msg_put(req->request);
403}
404
405static void put_generic_request(struct ceph_mon_generic_request *req)
406{
407 kref_put(&req->kref, release_generic_request);
408}
409
410static void get_generic_request(struct ceph_mon_generic_request *req)
411{
412 kref_get(&req->kref);
413}
414
415static struct ceph_msg *get_generic_reply(struct ceph_connection *con,
416 struct ceph_msg_header *hdr,
417 int *skip)
418{
419 struct ceph_mon_client *monc = con->private;
420 struct ceph_mon_generic_request *req;
421 u64 tid = le64_to_cpu(hdr->tid);
422 struct ceph_msg *m;
423
424 mutex_lock(&monc->mutex);
425 req = __lookup_generic_req(monc, tid);
426 if (!req) {
427 dout("get_generic_reply %lld dne\n", tid);
428 *skip = 1;
429 m = NULL;
430 } else {
431 dout("get_generic_reply %lld got %p\n", tid, req->reply);
432 m = ceph_msg_get(req->reply);
433 /*
434 * we don't need to track the connection reading into
435 * this reply because we only have one open connection
436 * at a time, ever.
437 */
438 }
439 mutex_unlock(&monc->mutex);
440 return m;
394} 441}
395 442
396static void handle_statfs_reply(struct ceph_mon_client *monc, 443static void handle_statfs_reply(struct ceph_mon_client *monc,
397 struct ceph_msg *msg) 444 struct ceph_msg *msg)
398{ 445{
399 struct ceph_mon_statfs_request *req; 446 struct ceph_mon_generic_request *req;
400 struct ceph_mon_statfs_reply *reply = msg->front.iov_base; 447 struct ceph_mon_statfs_reply *reply = msg->front.iov_base;
401 u64 tid; 448 u64 tid = le64_to_cpu(msg->hdr.tid);
402 449
403 if (msg->front.iov_len != sizeof(*reply)) 450 if (msg->front.iov_len != sizeof(*reply))
404 goto bad; 451 goto bad;
405 tid = le64_to_cpu(msg->hdr.tid);
406 dout("handle_statfs_reply %p tid %llu\n", msg, tid); 452 dout("handle_statfs_reply %p tid %llu\n", msg, tid);
407 453
408 mutex_lock(&monc->mutex); 454 mutex_lock(&monc->mutex);
409 req = __lookup_statfs(monc, tid); 455 req = __lookup_generic_req(monc, tid);
410 if (req) { 456 if (req) {
411 *req->buf = reply->st; 457 *(struct ceph_statfs *)req->buf = reply->st;
412 req->result = 0; 458 req->result = 0;
459 get_generic_request(req);
413 } 460 }
414 mutex_unlock(&monc->mutex); 461 mutex_unlock(&monc->mutex);
415 if (req) 462 if (req) {
416 complete(&req->completion); 463 complete(&req->completion);
464 put_generic_request(req);
465 }
417 return; 466 return;
418 467
419bad: 468bad:
420 pr_err("corrupt statfs reply, no tid\n"); 469 pr_err("corrupt generic reply, no tid\n");
421 ceph_msg_dump(msg); 470 ceph_msg_dump(msg);
422} 471}
423 472
424/* 473/*
425 * (re)send a statfs request 474 * Do a synchronous statfs().
426 */ 475 */
427static int send_statfs(struct ceph_mon_client *monc, 476int ceph_monc_do_statfs(struct ceph_mon_client *monc, struct ceph_statfs *buf)
428 struct ceph_mon_statfs_request *req)
429{ 477{
430 struct ceph_msg *msg; 478 struct ceph_mon_generic_request *req;
431 struct ceph_mon_statfs *h; 479 struct ceph_mon_statfs *h;
480 int err;
432 481
433 dout("send_statfs tid %llu\n", req->tid); 482 req = kzalloc(sizeof(*req), GFP_NOFS);
434 msg = ceph_msg_new(CEPH_MSG_STATFS, sizeof(*h), 0, 0, NULL); 483 if (!req)
435 if (IS_ERR(msg)) 484 return -ENOMEM;
436 return PTR_ERR(msg); 485
437 req->request = msg; 486 kref_init(&req->kref);
438 msg->hdr.tid = cpu_to_le64(req->tid); 487 req->buf = buf;
439 h = msg->front.iov_base; 488 init_completion(&req->completion);
489
490 err = -ENOMEM;
491 req->request = ceph_msg_new(CEPH_MSG_STATFS, sizeof(*h), GFP_NOFS);
492 if (!req->request)
493 goto out;
494 req->reply = ceph_msg_new(CEPH_MSG_STATFS_REPLY, 1024, GFP_NOFS);
495 if (!req->reply)
496 goto out;
497
498 /* fill out request */
499 h = req->request->front.iov_base;
440 h->monhdr.have_version = 0; 500 h->monhdr.have_version = 0;
441 h->monhdr.session_mon = cpu_to_le16(-1); 501 h->monhdr.session_mon = cpu_to_le16(-1);
442 h->monhdr.session_mon_tid = 0; 502 h->monhdr.session_mon_tid = 0;
443 h->fsid = monc->monmap->fsid; 503 h->fsid = monc->monmap->fsid;
444 ceph_con_send(monc->con, msg);
445 return 0;
446}
447
448/*
449 * Do a synchronous statfs().
450 */
451int ceph_monc_do_statfs(struct ceph_mon_client *monc, struct ceph_statfs *buf)
452{
453 struct ceph_mon_statfs_request req;
454 int err;
455
456 req.buf = buf;
457 init_completion(&req.completion);
458
459 /* allocate memory for reply */
460 err = ceph_msgpool_resv(&monc->msgpool_statfs_reply, 1);
461 if (err)
462 return err;
463 504
464 /* register request */ 505 /* register request */
465 mutex_lock(&monc->mutex); 506 mutex_lock(&monc->mutex);
466 req.tid = ++monc->last_tid; 507 req->tid = ++monc->last_tid;
467 req.last_attempt = jiffies; 508 req->request->hdr.tid = cpu_to_le64(req->tid);
468 req.delay = BASE_DELAY_INTERVAL; 509 __insert_generic_request(monc, req);
469 __insert_statfs(monc, &req); 510 monc->num_generic_requests++;
470 monc->num_statfs_requests++;
471 mutex_unlock(&monc->mutex); 511 mutex_unlock(&monc->mutex);
472 512
473 /* send request and wait */ 513 /* send request and wait */
474 err = send_statfs(monc, &req); 514 ceph_con_send(monc->con, ceph_msg_get(req->request));
475 if (!err) 515 err = wait_for_completion_interruptible(&req->completion);
476 err = wait_for_completion_interruptible(&req.completion);
477 516
478 mutex_lock(&monc->mutex); 517 mutex_lock(&monc->mutex);
479 rb_erase(&req.node, &monc->statfs_request_tree); 518 rb_erase(&req->node, &monc->generic_request_tree);
480 monc->num_statfs_requests--; 519 monc->num_generic_requests--;
481 ceph_msgpool_resv(&monc->msgpool_statfs_reply, -1);
482 mutex_unlock(&monc->mutex); 520 mutex_unlock(&monc->mutex);
483 521
484 if (!err) 522 if (!err)
485 err = req.result; 523 err = req->result;
524
525out:
526 kref_put(&req->kref, release_generic_request);
486 return err; 527 return err;
487} 528}
488 529
489/* 530/*
490 * Resend pending statfs requests. 531 * Resend pending statfs requests.
491 */ 532 */
492static void __resend_statfs(struct ceph_mon_client *monc) 533static void __resend_generic_request(struct ceph_mon_client *monc)
493{ 534{
494 struct ceph_mon_statfs_request *req; 535 struct ceph_mon_generic_request *req;
495 struct rb_node *p; 536 struct rb_node *p;
496 537
497 for (p = rb_first(&monc->statfs_request_tree); p; p = rb_next(p)) { 538 for (p = rb_first(&monc->generic_request_tree); p; p = rb_next(p)) {
498 req = rb_entry(p, struct ceph_mon_statfs_request, node); 539 req = rb_entry(p, struct ceph_mon_generic_request, node);
499 send_statfs(monc, req); 540 ceph_con_revoke(monc->con, req->request);
541 ceph_con_send(monc->con, ceph_msg_get(req->request));
500 } 542 }
501} 543}
502 544
@@ -586,26 +628,26 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
586 CEPH_ENTITY_TYPE_AUTH | CEPH_ENTITY_TYPE_MON | 628 CEPH_ENTITY_TYPE_AUTH | CEPH_ENTITY_TYPE_MON |
587 CEPH_ENTITY_TYPE_OSD | CEPH_ENTITY_TYPE_MDS; 629 CEPH_ENTITY_TYPE_OSD | CEPH_ENTITY_TYPE_MDS;
588 630
589 /* msg pools */ 631 /* msgs */
590 err = ceph_msgpool_init(&monc->msgpool_subscribe_ack, 632 err = -ENOMEM;
591 sizeof(struct ceph_mon_subscribe_ack), 1, false); 633 monc->m_subscribe_ack = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE_ACK,
592 if (err < 0) 634 sizeof(struct ceph_mon_subscribe_ack),
635 GFP_NOFS);
636 if (!monc->m_subscribe_ack)
593 goto out_monmap; 637 goto out_monmap;
594 err = ceph_msgpool_init(&monc->msgpool_statfs_reply, 638
595 sizeof(struct ceph_mon_statfs_reply), 0, false); 639 monc->m_subscribe = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE, 96, GFP_NOFS);
596 if (err < 0) 640 if (!monc->m_subscribe)
597 goto out_pool1; 641 goto out_subscribe_ack;
598 err = ceph_msgpool_init(&monc->msgpool_auth_reply, 4096, 1, false); 642
599 if (err < 0) 643 monc->m_auth_reply = ceph_msg_new(CEPH_MSG_AUTH_REPLY, 4096, GFP_NOFS);
600 goto out_pool2; 644 if (!monc->m_auth_reply)
601 645 goto out_subscribe;
602 monc->m_auth = ceph_msg_new(CEPH_MSG_AUTH, 4096, 0, 0, NULL); 646
647 monc->m_auth = ceph_msg_new(CEPH_MSG_AUTH, 4096, GFP_NOFS);
603 monc->pending_auth = 0; 648 monc->pending_auth = 0;
604 if (IS_ERR(monc->m_auth)) { 649 if (!monc->m_auth)
605 err = PTR_ERR(monc->m_auth); 650 goto out_auth_reply;
606 monc->m_auth = NULL;
607 goto out_pool3;
608 }
609 651
610 monc->cur_mon = -1; 652 monc->cur_mon = -1;
611 monc->hunting = true; 653 monc->hunting = true;
@@ -613,8 +655,8 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
613 monc->sub_sent = 0; 655 monc->sub_sent = 0;
614 656
615 INIT_DELAYED_WORK(&monc->delayed_work, delayed_work); 657 INIT_DELAYED_WORK(&monc->delayed_work, delayed_work);
616 monc->statfs_request_tree = RB_ROOT; 658 monc->generic_request_tree = RB_ROOT;
617 monc->num_statfs_requests = 0; 659 monc->num_generic_requests = 0;
618 monc->last_tid = 0; 660 monc->last_tid = 0;
619 661
620 monc->have_mdsmap = 0; 662 monc->have_mdsmap = 0;
@@ -622,12 +664,12 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
622 monc->want_next_osdmap = 1; 664 monc->want_next_osdmap = 1;
623 return 0; 665 return 0;
624 666
625out_pool3: 667out_auth_reply:
626 ceph_msgpool_destroy(&monc->msgpool_auth_reply); 668 ceph_msg_put(monc->m_auth_reply);
627out_pool2: 669out_subscribe:
628 ceph_msgpool_destroy(&monc->msgpool_subscribe_ack); 670 ceph_msg_put(monc->m_subscribe);
629out_pool1: 671out_subscribe_ack:
630 ceph_msgpool_destroy(&monc->msgpool_statfs_reply); 672 ceph_msg_put(monc->m_subscribe_ack);
631out_monmap: 673out_monmap:
632 kfree(monc->monmap); 674 kfree(monc->monmap);
633out: 675out:
@@ -651,9 +693,9 @@ void ceph_monc_stop(struct ceph_mon_client *monc)
651 ceph_auth_destroy(monc->auth); 693 ceph_auth_destroy(monc->auth);
652 694
653 ceph_msg_put(monc->m_auth); 695 ceph_msg_put(monc->m_auth);
654 ceph_msgpool_destroy(&monc->msgpool_subscribe_ack); 696 ceph_msg_put(monc->m_auth_reply);
655 ceph_msgpool_destroy(&monc->msgpool_statfs_reply); 697 ceph_msg_put(monc->m_subscribe);
656 ceph_msgpool_destroy(&monc->msgpool_auth_reply); 698 ceph_msg_put(monc->m_subscribe_ack);
657 699
658 kfree(monc->monmap); 700 kfree(monc->monmap);
659} 701}
@@ -681,7 +723,7 @@ static void handle_auth_reply(struct ceph_mon_client *monc,
681 monc->client->msgr->inst.name.num = monc->auth->global_id; 723 monc->client->msgr->inst.name.num = monc->auth->global_id;
682 724
683 __send_subscribe(monc); 725 __send_subscribe(monc);
684 __resend_statfs(monc); 726 __resend_generic_request(monc);
685 } 727 }
686 mutex_unlock(&monc->mutex); 728 mutex_unlock(&monc->mutex);
687} 729}
@@ -770,18 +812,17 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con,
770 812
771 switch (type) { 813 switch (type) {
772 case CEPH_MSG_MON_SUBSCRIBE_ACK: 814 case CEPH_MSG_MON_SUBSCRIBE_ACK:
773 m = ceph_msgpool_get(&monc->msgpool_subscribe_ack, front_len); 815 m = ceph_msg_get(monc->m_subscribe_ack);
774 break; 816 break;
775 case CEPH_MSG_STATFS_REPLY: 817 case CEPH_MSG_STATFS_REPLY:
776 m = ceph_msgpool_get(&monc->msgpool_statfs_reply, front_len); 818 return get_generic_reply(con, hdr, skip);
777 break;
778 case CEPH_MSG_AUTH_REPLY: 819 case CEPH_MSG_AUTH_REPLY:
779 m = ceph_msgpool_get(&monc->msgpool_auth_reply, front_len); 820 m = ceph_msg_get(monc->m_auth_reply);
780 break; 821 break;
781 case CEPH_MSG_MON_MAP: 822 case CEPH_MSG_MON_MAP:
782 case CEPH_MSG_MDS_MAP: 823 case CEPH_MSG_MDS_MAP:
783 case CEPH_MSG_OSD_MAP: 824 case CEPH_MSG_OSD_MAP:
784 m = ceph_msg_new(type, front_len, 0, 0, NULL); 825 m = ceph_msg_new(type, front_len, GFP_NOFS);
785 break; 826 break;
786 } 827 }
787 828
@@ -826,7 +867,7 @@ out:
826 mutex_unlock(&monc->mutex); 867 mutex_unlock(&monc->mutex);
827} 868}
828 869
829const static struct ceph_connection_operations mon_con_ops = { 870static const struct ceph_connection_operations mon_con_ops = {
830 .get = ceph_con_get, 871 .get = ceph_con_get,
831 .put = ceph_con_put, 872 .put = ceph_con_put,
832 .dispatch = dispatch, 873 .dispatch = dispatch,
diff --git a/fs/ceph/mon_client.h b/fs/ceph/mon_client.h
index b958ad5afa06..174d794321d0 100644
--- a/fs/ceph/mon_client.h
+++ b/fs/ceph/mon_client.h
@@ -2,10 +2,10 @@
2#define _FS_CEPH_MON_CLIENT_H 2#define _FS_CEPH_MON_CLIENT_H
3 3
4#include <linux/completion.h> 4#include <linux/completion.h>
5#include <linux/kref.h>
5#include <linux/rbtree.h> 6#include <linux/rbtree.h>
6 7
7#include "messenger.h" 8#include "messenger.h"
8#include "msgpool.h"
9 9
10struct ceph_client; 10struct ceph_client;
11struct ceph_mount_args; 11struct ceph_mount_args;
@@ -22,7 +22,7 @@ struct ceph_monmap {
22}; 22};
23 23
24struct ceph_mon_client; 24struct ceph_mon_client;
25struct ceph_mon_statfs_request; 25struct ceph_mon_generic_request;
26 26
27 27
28/* 28/*
@@ -40,17 +40,19 @@ struct ceph_mon_request {
40}; 40};
41 41
42/* 42/*
43 * statfs() is done a bit differently because we need to get data back 43 * ceph_mon_generic_request is being used for the statfs and poolop requests
44 * which are bening done a bit differently because we need to get data back
44 * to the caller 45 * to the caller
45 */ 46 */
46struct ceph_mon_statfs_request { 47struct ceph_mon_generic_request {
48 struct kref kref;
47 u64 tid; 49 u64 tid;
48 struct rb_node node; 50 struct rb_node node;
49 int result; 51 int result;
50 struct ceph_statfs *buf; 52 void *buf;
51 struct completion completion; 53 struct completion completion;
52 unsigned long last_attempt, delay; /* jiffies */
53 struct ceph_msg *request; /* original request */ 54 struct ceph_msg *request; /* original request */
55 struct ceph_msg *reply; /* and reply */
54}; 56};
55 57
56struct ceph_mon_client { 58struct ceph_mon_client {
@@ -61,7 +63,7 @@ struct ceph_mon_client {
61 struct delayed_work delayed_work; 63 struct delayed_work delayed_work;
62 64
63 struct ceph_auth_client *auth; 65 struct ceph_auth_client *auth;
64 struct ceph_msg *m_auth; 66 struct ceph_msg *m_auth, *m_auth_reply, *m_subscribe, *m_subscribe_ack;
65 int pending_auth; 67 int pending_auth;
66 68
67 bool hunting; 69 bool hunting;
@@ -70,14 +72,9 @@ struct ceph_mon_client {
70 struct ceph_connection *con; 72 struct ceph_connection *con;
71 bool have_fsid; 73 bool have_fsid;
72 74
73 /* msg pools */ 75 /* pending generic requests */
74 struct ceph_msgpool msgpool_subscribe_ack; 76 struct rb_root generic_request_tree;
75 struct ceph_msgpool msgpool_statfs_reply; 77 int num_generic_requests;
76 struct ceph_msgpool msgpool_auth_reply;
77
78 /* pending statfs requests */
79 struct rb_root statfs_request_tree;
80 int num_statfs_requests;
81 u64 last_tid; 78 u64 last_tid;
82 79
83 /* mds/osd map */ 80 /* mds/osd map */
diff --git a/fs/ceph/msgpool.c b/fs/ceph/msgpool.c
index ca3b44a89f2d..dd65a6438131 100644
--- a/fs/ceph/msgpool.c
+++ b/fs/ceph/msgpool.c
@@ -7,180 +7,58 @@
7 7
8#include "msgpool.h" 8#include "msgpool.h"
9 9
10/* 10static void *alloc_fn(gfp_t gfp_mask, void *arg)
11 * We use msg pools to preallocate memory for messages we expect to 11{
12 * receive over the wire, to avoid getting ourselves into OOM 12 struct ceph_msgpool *pool = arg;
13 * conditions at unexpected times. We take use a few different 13 void *p;
14 * strategies:
15 *
16 * - for request/response type interactions, we preallocate the
17 * memory needed for the response when we generate the request.
18 *
19 * - for messages we can receive at any time from the MDS, we preallocate
20 * a pool of messages we can re-use.
21 *
22 * - for writeback, we preallocate some number of messages to use for
23 * requests and their replies, so that we always make forward
24 * progress.
25 *
26 * The msgpool behaves like a mempool_t, but keeps preallocated
27 * ceph_msgs strung together on a list_head instead of using a pointer
28 * vector. This avoids vector reallocation when we adjust the number
29 * of preallocated items (which happens frequently).
30 */
31 14
15 p = ceph_msg_new(0, pool->front_len, gfp_mask);
16 if (!p)
17 pr_err("msgpool %s alloc failed\n", pool->name);
18 return p;
19}
32 20
33/* 21static void free_fn(void *element, void *arg)
34 * Allocate or release as necessary to meet our target pool size.
35 */
36static int __fill_msgpool(struct ceph_msgpool *pool)
37{ 22{
38 struct ceph_msg *msg; 23 ceph_msg_put(element);
39
40 while (pool->num < pool->min) {
41 dout("fill_msgpool %p %d/%d allocating\n", pool, pool->num,
42 pool->min);
43 spin_unlock(&pool->lock);
44 msg = ceph_msg_new(0, pool->front_len, 0, 0, NULL);
45 spin_lock(&pool->lock);
46 if (IS_ERR(msg))
47 return PTR_ERR(msg);
48 msg->pool = pool;
49 list_add(&msg->list_head, &pool->msgs);
50 pool->num++;
51 }
52 while (pool->num > pool->min) {
53 msg = list_first_entry(&pool->msgs, struct ceph_msg, list_head);
54 dout("fill_msgpool %p %d/%d releasing %p\n", pool, pool->num,
55 pool->min, msg);
56 list_del_init(&msg->list_head);
57 pool->num--;
58 ceph_msg_kfree(msg);
59 }
60 return 0;
61} 24}
62 25
63int ceph_msgpool_init(struct ceph_msgpool *pool, 26int ceph_msgpool_init(struct ceph_msgpool *pool,
64 int front_len, int min, bool blocking) 27 int front_len, int size, bool blocking, const char *name)
65{ 28{
66 int ret;
67
68 dout("msgpool_init %p front_len %d min %d\n", pool, front_len, min);
69 spin_lock_init(&pool->lock);
70 pool->front_len = front_len; 29 pool->front_len = front_len;
71 INIT_LIST_HEAD(&pool->msgs); 30 pool->pool = mempool_create(size, alloc_fn, free_fn, pool);
72 pool->num = 0; 31 if (!pool->pool)
73 pool->min = min; 32 return -ENOMEM;
74 pool->blocking = blocking; 33 pool->name = name;
75 init_waitqueue_head(&pool->wait); 34 return 0;
76
77 spin_lock(&pool->lock);
78 ret = __fill_msgpool(pool);
79 spin_unlock(&pool->lock);
80 return ret;
81} 35}
82 36
83void ceph_msgpool_destroy(struct ceph_msgpool *pool) 37void ceph_msgpool_destroy(struct ceph_msgpool *pool)
84{ 38{
85 dout("msgpool_destroy %p\n", pool); 39 mempool_destroy(pool->pool);
86 spin_lock(&pool->lock);
87 pool->min = 0;
88 __fill_msgpool(pool);
89 spin_unlock(&pool->lock);
90} 40}
91 41
92int ceph_msgpool_resv(struct ceph_msgpool *pool, int delta) 42struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *pool,
43 int front_len)
93{ 44{
94 int ret; 45 if (front_len > pool->front_len) {
95 46 pr_err("msgpool_get pool %s need front %d, pool size is %d\n",
96 spin_lock(&pool->lock); 47 pool->name, front_len, pool->front_len);
97 dout("msgpool_resv %p delta %d\n", pool, delta);
98 pool->min += delta;
99 ret = __fill_msgpool(pool);
100 spin_unlock(&pool->lock);
101 return ret;
102}
103
104struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *pool, int front_len)
105{
106 wait_queue_t wait;
107 struct ceph_msg *msg;
108
109 if (front_len && front_len > pool->front_len) {
110 pr_err("msgpool_get pool %p need front %d, pool size is %d\n",
111 pool, front_len, pool->front_len);
112 WARN_ON(1); 48 WARN_ON(1);
113 49
114 /* try to alloc a fresh message */ 50 /* try to alloc a fresh message */
115 msg = ceph_msg_new(0, front_len, 0, 0, NULL); 51 return ceph_msg_new(0, front_len, GFP_NOFS);
116 if (!IS_ERR(msg))
117 return msg;
118 }
119
120 if (!front_len)
121 front_len = pool->front_len;
122
123 if (pool->blocking) {
124 /* mempool_t behavior; first try to alloc */
125 msg = ceph_msg_new(0, front_len, 0, 0, NULL);
126 if (!IS_ERR(msg))
127 return msg;
128 } 52 }
129 53
130 while (1) { 54 return mempool_alloc(pool->pool, GFP_NOFS);
131 spin_lock(&pool->lock);
132 if (likely(pool->num)) {
133 msg = list_entry(pool->msgs.next, struct ceph_msg,
134 list_head);
135 list_del_init(&msg->list_head);
136 pool->num--;
137 dout("msgpool_get %p got %p, now %d/%d\n", pool, msg,
138 pool->num, pool->min);
139 spin_unlock(&pool->lock);
140 return msg;
141 }
142 pr_err("msgpool_get %p now %d/%d, %s\n", pool, pool->num,
143 pool->min, pool->blocking ? "waiting" : "may fail");
144 spin_unlock(&pool->lock);
145
146 if (!pool->blocking) {
147 WARN_ON(1);
148
149 /* maybe we can allocate it now? */
150 msg = ceph_msg_new(0, front_len, 0, 0, NULL);
151 if (!IS_ERR(msg))
152 return msg;
153
154 pr_err("msgpool_get %p empty + alloc failed\n", pool);
155 return ERR_PTR(-ENOMEM);
156 }
157
158 init_wait(&wait);
159 prepare_to_wait(&pool->wait, &wait, TASK_UNINTERRUPTIBLE);
160 schedule();
161 finish_wait(&pool->wait, &wait);
162 }
163} 55}
164 56
165void ceph_msgpool_put(struct ceph_msgpool *pool, struct ceph_msg *msg) 57void ceph_msgpool_put(struct ceph_msgpool *pool, struct ceph_msg *msg)
166{ 58{
167 spin_lock(&pool->lock); 59 /* reset msg front_len; user may have changed it */
168 if (pool->num < pool->min) { 60 msg->front.iov_len = pool->front_len;
169 /* reset msg front_len; user may have changed it */ 61 msg->hdr.front_len = cpu_to_le32(pool->front_len);
170 msg->front.iov_len = pool->front_len;
171 msg->hdr.front_len = cpu_to_le32(pool->front_len);
172 62
173 kref_set(&msg->kref, 1); /* retake a single ref */ 63 kref_init(&msg->kref); /* retake single ref */
174 list_add(&msg->list_head, &pool->msgs);
175 pool->num++;
176 dout("msgpool_put %p reclaim %p, now %d/%d\n", pool, msg,
177 pool->num, pool->min);
178 spin_unlock(&pool->lock);
179 wake_up(&pool->wait);
180 } else {
181 dout("msgpool_put %p drop %p, at %d/%d\n", pool, msg,
182 pool->num, pool->min);
183 spin_unlock(&pool->lock);
184 ceph_msg_kfree(msg);
185 }
186} 64}
diff --git a/fs/ceph/msgpool.h b/fs/ceph/msgpool.h
index bc834bfcd720..a362605f9368 100644
--- a/fs/ceph/msgpool.h
+++ b/fs/ceph/msgpool.h
@@ -1,6 +1,7 @@
1#ifndef _FS_CEPH_MSGPOOL 1#ifndef _FS_CEPH_MSGPOOL
2#define _FS_CEPH_MSGPOOL 2#define _FS_CEPH_MSGPOOL
3 3
4#include <linux/mempool.h>
4#include "messenger.h" 5#include "messenger.h"
5 6
6/* 7/*
@@ -8,18 +9,15 @@
8 * avoid unexpected OOM conditions. 9 * avoid unexpected OOM conditions.
9 */ 10 */
10struct ceph_msgpool { 11struct ceph_msgpool {
11 spinlock_t lock; 12 const char *name;
13 mempool_t *pool;
12 int front_len; /* preallocated payload size */ 14 int front_len; /* preallocated payload size */
13 struct list_head msgs; /* msgs in the pool; each has 1 ref */
14 int num, min; /* cur, min # msgs in the pool */
15 bool blocking;
16 wait_queue_head_t wait;
17}; 15};
18 16
19extern int ceph_msgpool_init(struct ceph_msgpool *pool, 17extern int ceph_msgpool_init(struct ceph_msgpool *pool,
20 int front_len, int size, bool blocking); 18 int front_len, int size, bool blocking,
19 const char *name);
21extern void ceph_msgpool_destroy(struct ceph_msgpool *pool); 20extern void ceph_msgpool_destroy(struct ceph_msgpool *pool);
22extern int ceph_msgpool_resv(struct ceph_msgpool *, int delta);
23extern struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *, 21extern struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *,
24 int front_len); 22 int front_len);
25extern void ceph_msgpool_put(struct ceph_msgpool *, struct ceph_msg *); 23extern void ceph_msgpool_put(struct ceph_msgpool *, struct ceph_msg *);
diff --git a/fs/ceph/msgr.h b/fs/ceph/msgr.h
index 8aaab414f3f8..892a0298dfdf 100644
--- a/fs/ceph/msgr.h
+++ b/fs/ceph/msgr.h
@@ -50,7 +50,6 @@ struct ceph_entity_name {
50#define CEPH_ENTITY_TYPE_MDS 0x02 50#define CEPH_ENTITY_TYPE_MDS 0x02
51#define CEPH_ENTITY_TYPE_OSD 0x04 51#define CEPH_ENTITY_TYPE_OSD 0x04
52#define CEPH_ENTITY_TYPE_CLIENT 0x08 52#define CEPH_ENTITY_TYPE_CLIENT 0x08
53#define CEPH_ENTITY_TYPE_ADMIN 0x10
54#define CEPH_ENTITY_TYPE_AUTH 0x20 53#define CEPH_ENTITY_TYPE_AUTH 0x20
55 54
56#define CEPH_ENTITY_TYPE_ANY 0xFF 55#define CEPH_ENTITY_TYPE_ANY 0xFF
@@ -120,7 +119,7 @@ struct ceph_msg_connect_reply {
120/* 119/*
121 * message header 120 * message header
122 */ 121 */
123struct ceph_msg_header { 122struct ceph_msg_header_old {
124 __le64 seq; /* message seq# for this session */ 123 __le64 seq; /* message seq# for this session */
125 __le64 tid; /* transaction id */ 124 __le64 tid; /* transaction id */
126 __le16 type; /* message type */ 125 __le16 type; /* message type */
@@ -138,6 +137,24 @@ struct ceph_msg_header {
138 __le32 crc; /* header crc32c */ 137 __le32 crc; /* header crc32c */
139} __attribute__ ((packed)); 138} __attribute__ ((packed));
140 139
140struct ceph_msg_header {
141 __le64 seq; /* message seq# for this session */
142 __le64 tid; /* transaction id */
143 __le16 type; /* message type */
144 __le16 priority; /* priority. higher value == higher priority */
145 __le16 version; /* version of message encoding */
146
147 __le32 front_len; /* bytes in main payload */
148 __le32 middle_len;/* bytes in middle payload */
149 __le32 data_len; /* bytes of data payload */
150 __le16 data_off; /* sender: include full offset;
151 receiver: mask against ~PAGE_MASK */
152
153 struct ceph_entity_name src;
154 __le32 reserved;
155 __le32 crc; /* header crc32c */
156} __attribute__ ((packed));
157
141#define CEPH_MSG_PRIO_LOW 64 158#define CEPH_MSG_PRIO_LOW 64
142#define CEPH_MSG_PRIO_DEFAULT 127 159#define CEPH_MSG_PRIO_DEFAULT 127
143#define CEPH_MSG_PRIO_HIGH 196 160#define CEPH_MSG_PRIO_HIGH 196
diff --git a/fs/ceph/osd_client.c b/fs/ceph/osd_client.c
index 3514f71ff85f..afa7bb3895c4 100644
--- a/fs/ceph/osd_client.c
+++ b/fs/ceph/osd_client.c
@@ -16,7 +16,7 @@
16#define OSD_OP_FRONT_LEN 4096 16#define OSD_OP_FRONT_LEN 4096
17#define OSD_OPREPLY_FRONT_LEN 512 17#define OSD_OPREPLY_FRONT_LEN 512
18 18
19const static struct ceph_connection_operations osd_con_ops; 19static const struct ceph_connection_operations osd_con_ops;
20static int __kick_requests(struct ceph_osd_client *osdc, 20static int __kick_requests(struct ceph_osd_client *osdc,
21 struct ceph_osd *kickosd); 21 struct ceph_osd *kickosd);
22 22
@@ -147,7 +147,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
147 req = kzalloc(sizeof(*req), GFP_NOFS); 147 req = kzalloc(sizeof(*req), GFP_NOFS);
148 } 148 }
149 if (req == NULL) 149 if (req == NULL)
150 return ERR_PTR(-ENOMEM); 150 return NULL;
151 151
152 req->r_osdc = osdc; 152 req->r_osdc = osdc;
153 req->r_mempool = use_mempool; 153 req->r_mempool = use_mempool;
@@ -164,10 +164,10 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
164 msg = ceph_msgpool_get(&osdc->msgpool_op_reply, 0); 164 msg = ceph_msgpool_get(&osdc->msgpool_op_reply, 0);
165 else 165 else
166 msg = ceph_msg_new(CEPH_MSG_OSD_OPREPLY, 166 msg = ceph_msg_new(CEPH_MSG_OSD_OPREPLY,
167 OSD_OPREPLY_FRONT_LEN, 0, 0, NULL); 167 OSD_OPREPLY_FRONT_LEN, GFP_NOFS);
168 if (IS_ERR(msg)) { 168 if (!msg) {
169 ceph_osdc_put_request(req); 169 ceph_osdc_put_request(req);
170 return ERR_PTR(PTR_ERR(msg)); 170 return NULL;
171 } 171 }
172 req->r_reply = msg; 172 req->r_reply = msg;
173 173
@@ -178,10 +178,10 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
178 if (use_mempool) 178 if (use_mempool)
179 msg = ceph_msgpool_get(&osdc->msgpool_op, 0); 179 msg = ceph_msgpool_get(&osdc->msgpool_op, 0);
180 else 180 else
181 msg = ceph_msg_new(CEPH_MSG_OSD_OP, msg_size, 0, 0, NULL); 181 msg = ceph_msg_new(CEPH_MSG_OSD_OP, msg_size, GFP_NOFS);
182 if (IS_ERR(msg)) { 182 if (!msg) {
183 ceph_osdc_put_request(req); 183 ceph_osdc_put_request(req);
184 return ERR_PTR(PTR_ERR(msg)); 184 return NULL;
185 } 185 }
186 msg->hdr.type = cpu_to_le16(CEPH_MSG_OSD_OP); 186 msg->hdr.type = cpu_to_le16(CEPH_MSG_OSD_OP);
187 memset(msg->front.iov_base, 0, msg->front.iov_len); 187 memset(msg->front.iov_base, 0, msg->front.iov_len);
@@ -715,7 +715,7 @@ static void handle_timeout(struct work_struct *work)
715 * should mark the osd as failed and we should find out about 715 * should mark the osd as failed and we should find out about
716 * it from an updated osd map. 716 * it from an updated osd map.
717 */ 717 */
718 while (!list_empty(&osdc->req_lru)) { 718 while (timeout && !list_empty(&osdc->req_lru)) {
719 req = list_entry(osdc->req_lru.next, struct ceph_osd_request, 719 req = list_entry(osdc->req_lru.next, struct ceph_osd_request,
720 r_req_lru_item); 720 r_req_lru_item);
721 721
@@ -1078,6 +1078,7 @@ done:
1078 if (newmap) 1078 if (newmap)
1079 kick_requests(osdc, NULL); 1079 kick_requests(osdc, NULL);
1080 up_read(&osdc->map_sem); 1080 up_read(&osdc->map_sem);
1081 wake_up(&osdc->client->auth_wq);
1081 return; 1082 return;
1082 1083
1083bad: 1084bad:
@@ -1087,45 +1088,6 @@ bad:
1087 return; 1088 return;
1088} 1089}
1089 1090
1090
1091/*
1092 * A read request prepares specific pages that data is to be read into.
1093 * When a message is being read off the wire, we call prepare_pages to
1094 * find those pages.
1095 * 0 = success, -1 failure.
1096 */
1097static int __prepare_pages(struct ceph_connection *con,
1098 struct ceph_msg_header *hdr,
1099 struct ceph_osd_request *req,
1100 u64 tid,
1101 struct ceph_msg *m)
1102{
1103 struct ceph_osd *osd = con->private;
1104 struct ceph_osd_client *osdc;
1105 int ret = -1;
1106 int data_len = le32_to_cpu(hdr->data_len);
1107 unsigned data_off = le16_to_cpu(hdr->data_off);
1108
1109 int want = calc_pages_for(data_off & ~PAGE_MASK, data_len);
1110
1111 if (!osd)
1112 return -1;
1113
1114 osdc = osd->o_osdc;
1115
1116 dout("__prepare_pages on msg %p tid %llu, has %d pages, want %d\n", m,
1117 tid, req->r_num_pages, want);
1118 if (unlikely(req->r_num_pages < want))
1119 goto out;
1120 m->pages = req->r_pages;
1121 m->nr_pages = req->r_num_pages;
1122 ret = 0; /* success */
1123out:
1124 BUG_ON(ret < 0 || m->nr_pages < want);
1125
1126 return ret;
1127}
1128
1129/* 1091/*
1130 * Register request, send initial attempt. 1092 * Register request, send initial attempt.
1131 */ 1093 */
@@ -1252,11 +1214,13 @@ int ceph_osdc_init(struct ceph_osd_client *osdc, struct ceph_client *client)
1252 if (!osdc->req_mempool) 1214 if (!osdc->req_mempool)
1253 goto out; 1215 goto out;
1254 1216
1255 err = ceph_msgpool_init(&osdc->msgpool_op, OSD_OP_FRONT_LEN, 10, true); 1217 err = ceph_msgpool_init(&osdc->msgpool_op, OSD_OP_FRONT_LEN, 10, true,
1218 "osd_op");
1256 if (err < 0) 1219 if (err < 0)
1257 goto out_mempool; 1220 goto out_mempool;
1258 err = ceph_msgpool_init(&osdc->msgpool_op_reply, 1221 err = ceph_msgpool_init(&osdc->msgpool_op_reply,
1259 OSD_OPREPLY_FRONT_LEN, 10, true); 1222 OSD_OPREPLY_FRONT_LEN, 10, true,
1223 "osd_op_reply");
1260 if (err < 0) 1224 if (err < 0)
1261 goto out_msgpool; 1225 goto out_msgpool;
1262 return 0; 1226 return 0;
@@ -1302,8 +1266,8 @@ int ceph_osdc_readpages(struct ceph_osd_client *osdc,
1302 CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ, 1266 CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ,
1303 NULL, 0, truncate_seq, truncate_size, NULL, 1267 NULL, 0, truncate_seq, truncate_size, NULL,
1304 false, 1); 1268 false, 1);
1305 if (IS_ERR(req)) 1269 if (!req)
1306 return PTR_ERR(req); 1270 return -ENOMEM;
1307 1271
1308 /* it may be a short read due to an object boundary */ 1272 /* it may be a short read due to an object boundary */
1309 req->r_pages = pages; 1273 req->r_pages = pages;
@@ -1345,8 +1309,8 @@ int ceph_osdc_writepages(struct ceph_osd_client *osdc, struct ceph_vino vino,
1345 snapc, do_sync, 1309 snapc, do_sync,
1346 truncate_seq, truncate_size, mtime, 1310 truncate_seq, truncate_size, mtime,
1347 nofail, 1); 1311 nofail, 1);
1348 if (IS_ERR(req)) 1312 if (!req)
1349 return PTR_ERR(req); 1313 return -ENOMEM;
1350 1314
1351 /* it may be a short write due to an object boundary */ 1315 /* it may be a short write due to an object boundary */
1352 req->r_pages = pages; 1316 req->r_pages = pages;
@@ -1394,7 +1358,8 @@ static void dispatch(struct ceph_connection *con, struct ceph_msg *msg)
1394} 1358}
1395 1359
1396/* 1360/*
1397 * lookup and return message for incoming reply 1361 * lookup and return message for incoming reply. set up reply message
1362 * pages.
1398 */ 1363 */
1399static struct ceph_msg *get_reply(struct ceph_connection *con, 1364static struct ceph_msg *get_reply(struct ceph_connection *con,
1400 struct ceph_msg_header *hdr, 1365 struct ceph_msg_header *hdr,
@@ -1407,7 +1372,6 @@ static struct ceph_msg *get_reply(struct ceph_connection *con,
1407 int front = le32_to_cpu(hdr->front_len); 1372 int front = le32_to_cpu(hdr->front_len);
1408 int data_len = le32_to_cpu(hdr->data_len); 1373 int data_len = le32_to_cpu(hdr->data_len);
1409 u64 tid; 1374 u64 tid;
1410 int err;
1411 1375
1412 tid = le64_to_cpu(hdr->tid); 1376 tid = le64_to_cpu(hdr->tid);
1413 mutex_lock(&osdc->request_mutex); 1377 mutex_lock(&osdc->request_mutex);
@@ -1425,13 +1389,14 @@ static struct ceph_msg *get_reply(struct ceph_connection *con,
1425 req->r_reply, req->r_con_filling_msg); 1389 req->r_reply, req->r_con_filling_msg);
1426 ceph_con_revoke_message(req->r_con_filling_msg, req->r_reply); 1390 ceph_con_revoke_message(req->r_con_filling_msg, req->r_reply);
1427 ceph_con_put(req->r_con_filling_msg); 1391 ceph_con_put(req->r_con_filling_msg);
1392 req->r_con_filling_msg = NULL;
1428 } 1393 }
1429 1394
1430 if (front > req->r_reply->front.iov_len) { 1395 if (front > req->r_reply->front.iov_len) {
1431 pr_warning("get_reply front %d > preallocated %d\n", 1396 pr_warning("get_reply front %d > preallocated %d\n",
1432 front, (int)req->r_reply->front.iov_len); 1397 front, (int)req->r_reply->front.iov_len);
1433 m = ceph_msg_new(CEPH_MSG_OSD_OPREPLY, front, 0, 0, NULL); 1398 m = ceph_msg_new(CEPH_MSG_OSD_OPREPLY, front, GFP_NOFS);
1434 if (IS_ERR(m)) 1399 if (!m)
1435 goto out; 1400 goto out;
1436 ceph_msg_put(req->r_reply); 1401 ceph_msg_put(req->r_reply);
1437 req->r_reply = m; 1402 req->r_reply = m;
@@ -1439,12 +1404,19 @@ static struct ceph_msg *get_reply(struct ceph_connection *con,
1439 m = ceph_msg_get(req->r_reply); 1404 m = ceph_msg_get(req->r_reply);
1440 1405
1441 if (data_len > 0) { 1406 if (data_len > 0) {
1442 err = __prepare_pages(con, hdr, req, tid, m); 1407 unsigned data_off = le16_to_cpu(hdr->data_off);
1443 if (err < 0) { 1408 int want = calc_pages_for(data_off & ~PAGE_MASK, data_len);
1409
1410 if (unlikely(req->r_num_pages < want)) {
1411 pr_warning("tid %lld reply %d > expected %d pages\n",
1412 tid, want, m->nr_pages);
1444 *skip = 1; 1413 *skip = 1;
1445 ceph_msg_put(m); 1414 ceph_msg_put(m);
1446 m = ERR_PTR(err); 1415 m = NULL;
1416 goto out;
1447 } 1417 }
1418 m->pages = req->r_pages;
1419 m->nr_pages = req->r_num_pages;
1448 } 1420 }
1449 *skip = 0; 1421 *skip = 0;
1450 req->r_con_filling_msg = ceph_con_get(con); 1422 req->r_con_filling_msg = ceph_con_get(con);
@@ -1466,7 +1438,7 @@ static struct ceph_msg *alloc_msg(struct ceph_connection *con,
1466 1438
1467 switch (type) { 1439 switch (type) {
1468 case CEPH_MSG_OSD_MAP: 1440 case CEPH_MSG_OSD_MAP:
1469 return ceph_msg_new(type, front, 0, 0, NULL); 1441 return ceph_msg_new(type, front, GFP_NOFS);
1470 case CEPH_MSG_OSD_OPREPLY: 1442 case CEPH_MSG_OSD_OPREPLY:
1471 return get_reply(con, hdr, skip); 1443 return get_reply(con, hdr, skip);
1472 default: 1444 default:
@@ -1552,7 +1524,7 @@ static int invalidate_authorizer(struct ceph_connection *con)
1552 return ceph_monc_validate_auth(&osdc->client->monc); 1524 return ceph_monc_validate_auth(&osdc->client->monc);
1553} 1525}
1554 1526
1555const static struct ceph_connection_operations osd_con_ops = { 1527static const struct ceph_connection_operations osd_con_ops = {
1556 .get = get_osd_con, 1528 .get = get_osd_con,
1557 .put = put_osd_con, 1529 .put = put_osd_con,
1558 .dispatch = dispatch, 1530 .dispatch = dispatch,
diff --git a/fs/ceph/pagelist.c b/fs/ceph/pagelist.c
index 5f8dbf7c745a..b6859f47d364 100644
--- a/fs/ceph/pagelist.c
+++ b/fs/ceph/pagelist.c
@@ -20,7 +20,7 @@ int ceph_pagelist_release(struct ceph_pagelist *pl)
20 20
21static int ceph_pagelist_addpage(struct ceph_pagelist *pl) 21static int ceph_pagelist_addpage(struct ceph_pagelist *pl)
22{ 22{
23 struct page *page = alloc_page(GFP_NOFS); 23 struct page *page = __page_cache_alloc(GFP_NOFS);
24 if (!page) 24 if (!page)
25 return -ENOMEM; 25 return -ENOMEM;
26 pl->room += PAGE_SIZE; 26 pl->room += PAGE_SIZE;
diff --git a/fs/ceph/rados.h b/fs/ceph/rados.h
index fd56451a871f..8fcc023056c7 100644
--- a/fs/ceph/rados.h
+++ b/fs/ceph/rados.h
@@ -101,8 +101,8 @@ struct ceph_pg_pool {
101 __le64 snap_seq; /* seq for per-pool snapshot */ 101 __le64 snap_seq; /* seq for per-pool snapshot */
102 __le32 snap_epoch; /* epoch of last snap */ 102 __le32 snap_epoch; /* epoch of last snap */
103 __le32 num_snaps; 103 __le32 num_snaps;
104 __le32 num_removed_snap_intervals; 104 __le32 num_removed_snap_intervals; /* if non-empty, NO per-pool snaps */
105 __le64 uid; 105 __le64 auid; /* who owns the pg */
106} __attribute__ ((packed)); 106} __attribute__ ((packed));
107 107
108/* 108/*
@@ -208,6 +208,7 @@ enum {
208 /* read */ 208 /* read */
209 CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1, 209 CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1,
210 CEPH_OSD_OP_GETXATTRS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 2, 210 CEPH_OSD_OP_GETXATTRS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 2,
211 CEPH_OSD_OP_CMPXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 3,
211 212
212 /* write */ 213 /* write */
213 CEPH_OSD_OP_SETXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 1, 214 CEPH_OSD_OP_SETXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 1,
@@ -305,6 +306,22 @@ enum {
305#define EOLDSNAPC ERESTART /* ORDERSNAP flag set; writer has old snapc*/ 306#define EOLDSNAPC ERESTART /* ORDERSNAP flag set; writer has old snapc*/
306#define EBLACKLISTED ESHUTDOWN /* blacklisted */ 307#define EBLACKLISTED ESHUTDOWN /* blacklisted */
307 308
309/* xattr comparison */
310enum {
311 CEPH_OSD_CMPXATTR_OP_NOP = 0,
312 CEPH_OSD_CMPXATTR_OP_EQ = 1,
313 CEPH_OSD_CMPXATTR_OP_NE = 2,
314 CEPH_OSD_CMPXATTR_OP_GT = 3,
315 CEPH_OSD_CMPXATTR_OP_GTE = 4,
316 CEPH_OSD_CMPXATTR_OP_LT = 5,
317 CEPH_OSD_CMPXATTR_OP_LTE = 6
318};
319
320enum {
321 CEPH_OSD_CMPXATTR_MODE_STRING = 1,
322 CEPH_OSD_CMPXATTR_MODE_U64 = 2
323};
324
308/* 325/*
309 * an individual object operation. each may be accompanied by some data 326 * an individual object operation. each may be accompanied by some data
310 * payload 327 * payload
@@ -321,6 +338,8 @@ struct ceph_osd_op {
321 struct { 338 struct {
322 __le32 name_len; 339 __le32 name_len;
323 __le32 value_len; 340 __le32 value_len;
341 __u8 cmp_op; /* CEPH_OSD_CMPXATTR_OP_* */
342 __u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */
324 } __attribute__ ((packed)) xattr; 343 } __attribute__ ((packed)) xattr;
325 struct { 344 struct {
326 __u8 class_len; 345 __u8 class_len;
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index d5114db70453..c0b26b6badba 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -512,7 +512,7 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
512 struct ceph_cap_snap *capsnap) 512 struct ceph_cap_snap *capsnap)
513{ 513{
514 struct inode *inode = &ci->vfs_inode; 514 struct inode *inode = &ci->vfs_inode;
515 struct ceph_mds_client *mdsc = &ceph_client(inode->i_sb)->mdsc; 515 struct ceph_mds_client *mdsc = &ceph_sb_to_client(inode->i_sb)->mdsc;
516 516
517 BUG_ON(capsnap->writing); 517 BUG_ON(capsnap->writing);
518 capsnap->size = inode->i_size; 518 capsnap->size = inode->i_size;
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 9307bbee6fbe..7c663d9b9f81 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -8,14 +8,11 @@
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/mount.h> 9#include <linux/mount.h>
10#include <linux/parser.h> 10#include <linux/parser.h>
11#include <linux/rwsem.h>
12#include <linux/sched.h> 11#include <linux/sched.h>
13#include <linux/seq_file.h> 12#include <linux/seq_file.h>
14#include <linux/slab.h> 13#include <linux/slab.h>
15#include <linux/statfs.h> 14#include <linux/statfs.h>
16#include <linux/string.h> 15#include <linux/string.h>
17#include <linux/version.h>
18#include <linux/vmalloc.h>
19 16
20#include "decode.h" 17#include "decode.h"
21#include "super.h" 18#include "super.h"
@@ -107,12 +104,40 @@ static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf)
107static int ceph_syncfs(struct super_block *sb, int wait) 104static int ceph_syncfs(struct super_block *sb, int wait)
108{ 105{
109 dout("sync_fs %d\n", wait); 106 dout("sync_fs %d\n", wait);
110 ceph_osdc_sync(&ceph_client(sb)->osdc); 107 ceph_osdc_sync(&ceph_sb_to_client(sb)->osdc);
111 ceph_mdsc_sync(&ceph_client(sb)->mdsc); 108 ceph_mdsc_sync(&ceph_sb_to_client(sb)->mdsc);
112 dout("sync_fs %d done\n", wait); 109 dout("sync_fs %d done\n", wait);
113 return 0; 110 return 0;
114} 111}
115 112
113static int default_congestion_kb(void)
114{
115 int congestion_kb;
116
117 /*
118 * Copied from NFS
119 *
120 * congestion size, scale with available memory.
121 *
122 * 64MB: 8192k
123 * 128MB: 11585k
124 * 256MB: 16384k
125 * 512MB: 23170k
126 * 1GB: 32768k
127 * 2GB: 46340k
128 * 4GB: 65536k
129 * 8GB: 92681k
130 * 16GB: 131072k
131 *
132 * This allows larger machines to have larger/more transfers.
133 * Limit the default to 256M
134 */
135 congestion_kb = (16*int_sqrt(totalram_pages)) << (PAGE_SHIFT-10);
136 if (congestion_kb > 256*1024)
137 congestion_kb = 256*1024;
138
139 return congestion_kb;
140}
116 141
117/** 142/**
118 * ceph_show_options - Show mount options in /proc/mounts 143 * ceph_show_options - Show mount options in /proc/mounts
@@ -138,6 +163,35 @@ static int ceph_show_options(struct seq_file *m, struct vfsmount *mnt)
138 seq_puts(m, ",nocrc"); 163 seq_puts(m, ",nocrc");
139 if (args->flags & CEPH_OPT_NOASYNCREADDIR) 164 if (args->flags & CEPH_OPT_NOASYNCREADDIR)
140 seq_puts(m, ",noasyncreaddir"); 165 seq_puts(m, ",noasyncreaddir");
166
167 if (args->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT)
168 seq_printf(m, ",mount_timeout=%d", args->mount_timeout);
169 if (args->osd_idle_ttl != CEPH_OSD_IDLE_TTL_DEFAULT)
170 seq_printf(m, ",osd_idle_ttl=%d", args->osd_idle_ttl);
171 if (args->osd_timeout != CEPH_OSD_TIMEOUT_DEFAULT)
172 seq_printf(m, ",osdtimeout=%d", args->osd_timeout);
173 if (args->osd_keepalive_timeout != CEPH_OSD_KEEPALIVE_DEFAULT)
174 seq_printf(m, ",osdkeepalivetimeout=%d",
175 args->osd_keepalive_timeout);
176 if (args->wsize)
177 seq_printf(m, ",wsize=%d", args->wsize);
178 if (args->rsize != CEPH_MOUNT_RSIZE_DEFAULT)
179 seq_printf(m, ",rsize=%d", args->rsize);
180 if (args->congestion_kb != default_congestion_kb())
181 seq_printf(m, ",write_congestion_kb=%d", args->congestion_kb);
182 if (args->caps_wanted_delay_min != CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT)
183 seq_printf(m, ",caps_wanted_delay_min=%d",
184 args->caps_wanted_delay_min);
185 if (args->caps_wanted_delay_max != CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT)
186 seq_printf(m, ",caps_wanted_delay_max=%d",
187 args->caps_wanted_delay_max);
188 if (args->cap_release_safety != CEPH_CAP_RELEASE_SAFETY_DEFAULT)
189 seq_printf(m, ",cap_release_safety=%d",
190 args->cap_release_safety);
191 if (args->max_readdir != CEPH_MAX_READDIR_DEFAULT)
192 seq_printf(m, ",readdir_max_entries=%d", args->max_readdir);
193 if (args->max_readdir_bytes != CEPH_MAX_READDIR_BYTES_DEFAULT)
194 seq_printf(m, ",readdir_max_bytes=%d", args->max_readdir_bytes);
141 if (strcmp(args->snapdir_name, CEPH_SNAPDIRNAME_DEFAULT)) 195 if (strcmp(args->snapdir_name, CEPH_SNAPDIRNAME_DEFAULT))
142 seq_printf(m, ",snapdirname=%s", args->snapdir_name); 196 seq_printf(m, ",snapdirname=%s", args->snapdir_name);
143 if (args->name) 197 if (args->name)
@@ -161,35 +215,6 @@ static void ceph_inode_init_once(void *foo)
161 inode_init_once(&ci->vfs_inode); 215 inode_init_once(&ci->vfs_inode);
162} 216}
163 217
164static int default_congestion_kb(void)
165{
166 int congestion_kb;
167
168 /*
169 * Copied from NFS
170 *
171 * congestion size, scale with available memory.
172 *
173 * 64MB: 8192k
174 * 128MB: 11585k
175 * 256MB: 16384k
176 * 512MB: 23170k
177 * 1GB: 32768k
178 * 2GB: 46340k
179 * 4GB: 65536k
180 * 8GB: 92681k
181 * 16GB: 131072k
182 *
183 * This allows larger machines to have larger/more transfers.
184 * Limit the default to 256M
185 */
186 congestion_kb = (16*int_sqrt(totalram_pages)) << (PAGE_SHIFT-10);
187 if (congestion_kb > 256*1024)
188 congestion_kb = 256*1024;
189
190 return congestion_kb;
191}
192
193static int __init init_caches(void) 218static int __init init_caches(void)
194{ 219{
195 ceph_inode_cachep = kmem_cache_create("ceph_inode_info", 220 ceph_inode_cachep = kmem_cache_create("ceph_inode_info",
@@ -308,7 +333,9 @@ enum {
308 Opt_osd_idle_ttl, 333 Opt_osd_idle_ttl,
309 Opt_caps_wanted_delay_min, 334 Opt_caps_wanted_delay_min,
310 Opt_caps_wanted_delay_max, 335 Opt_caps_wanted_delay_max,
336 Opt_cap_release_safety,
311 Opt_readdir_max_entries, 337 Opt_readdir_max_entries,
338 Opt_readdir_max_bytes,
312 Opt_congestion_kb, 339 Opt_congestion_kb,
313 Opt_last_int, 340 Opt_last_int,
314 /* int args above */ 341 /* int args above */
@@ -339,7 +366,9 @@ static match_table_t arg_tokens = {
339 {Opt_osd_idle_ttl, "osd_idle_ttl=%d"}, 366 {Opt_osd_idle_ttl, "osd_idle_ttl=%d"},
340 {Opt_caps_wanted_delay_min, "caps_wanted_delay_min=%d"}, 367 {Opt_caps_wanted_delay_min, "caps_wanted_delay_min=%d"},
341 {Opt_caps_wanted_delay_max, "caps_wanted_delay_max=%d"}, 368 {Opt_caps_wanted_delay_max, "caps_wanted_delay_max=%d"},
369 {Opt_cap_release_safety, "cap_release_safety=%d"},
342 {Opt_readdir_max_entries, "readdir_max_entries=%d"}, 370 {Opt_readdir_max_entries, "readdir_max_entries=%d"},
371 {Opt_readdir_max_bytes, "readdir_max_bytes=%d"},
343 {Opt_congestion_kb, "write_congestion_kb=%d"}, 372 {Opt_congestion_kb, "write_congestion_kb=%d"},
344 /* int args above */ 373 /* int args above */
345 {Opt_snapdirname, "snapdirname=%s"}, 374 {Opt_snapdirname, "snapdirname=%s"},
@@ -388,8 +417,9 @@ static struct ceph_mount_args *parse_mount_args(int flags, char *options,
388 args->caps_wanted_delay_max = CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT; 417 args->caps_wanted_delay_max = CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT;
389 args->rsize = CEPH_MOUNT_RSIZE_DEFAULT; 418 args->rsize = CEPH_MOUNT_RSIZE_DEFAULT;
390 args->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL); 419 args->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL);
391 args->cap_release_safety = CEPH_CAPS_PER_RELEASE * 4; 420 args->cap_release_safety = CEPH_CAP_RELEASE_SAFETY_DEFAULT;
392 args->max_readdir = 1024; 421 args->max_readdir = CEPH_MAX_READDIR_DEFAULT;
422 args->max_readdir_bytes = CEPH_MAX_READDIR_BYTES_DEFAULT;
393 args->congestion_kb = default_congestion_kb(); 423 args->congestion_kb = default_congestion_kb();
394 424
395 /* ip1[:port1][,ip2[:port2]...]:/subdir/in/fs */ 425 /* ip1[:port1][,ip2[:port2]...]:/subdir/in/fs */
@@ -497,6 +527,9 @@ static struct ceph_mount_args *parse_mount_args(int flags, char *options,
497 case Opt_readdir_max_entries: 527 case Opt_readdir_max_entries:
498 args->max_readdir = intval; 528 args->max_readdir = intval;
499 break; 529 break;
530 case Opt_readdir_max_bytes:
531 args->max_readdir_bytes = intval;
532 break;
500 case Opt_congestion_kb: 533 case Opt_congestion_kb:
501 args->congestion_kb = intval; 534 args->congestion_kb = intval;
502 break; 535 break;
@@ -682,9 +715,10 @@ int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid)
682/* 715/*
683 * true if we have the mon map (and have thus joined the cluster) 716 * true if we have the mon map (and have thus joined the cluster)
684 */ 717 */
685static int have_mon_map(struct ceph_client *client) 718static int have_mon_and_osd_map(struct ceph_client *client)
686{ 719{
687 return client->monc.monmap && client->monc.monmap->epoch; 720 return client->monc.monmap && client->monc.monmap->epoch &&
721 client->osdc.osdmap && client->osdc.osdmap->epoch;
688} 722}
689 723
690/* 724/*
@@ -762,7 +796,7 @@ static int ceph_mount(struct ceph_client *client, struct vfsmount *mnt,
762 if (err < 0) 796 if (err < 0)
763 goto out; 797 goto out;
764 798
765 while (!have_mon_map(client)) { 799 while (!have_mon_and_osd_map(client)) {
766 err = -EIO; 800 err = -EIO;
767 if (timeout && time_after_eq(jiffies, started + timeout)) 801 if (timeout && time_after_eq(jiffies, started + timeout))
768 goto out; 802 goto out;
@@ -770,8 +804,8 @@ static int ceph_mount(struct ceph_client *client, struct vfsmount *mnt,
770 /* wait */ 804 /* wait */
771 dout("mount waiting for mon_map\n"); 805 dout("mount waiting for mon_map\n");
772 err = wait_event_interruptible_timeout(client->auth_wq, 806 err = wait_event_interruptible_timeout(client->auth_wq,
773 have_mon_map(client) || (client->auth_err < 0), 807 have_mon_and_osd_map(client) || (client->auth_err < 0),
774 timeout); 808 timeout);
775 if (err == -EINTR || err == -ERESTARTSYS) 809 if (err == -EINTR || err == -ERESTARTSYS)
776 goto out; 810 goto out;
777 if (client->auth_err < 0) { 811 if (client->auth_err < 0) {
@@ -884,6 +918,8 @@ static int ceph_compare_super(struct super_block *sb, void *data)
884/* 918/*
885 * construct our own bdi so we can control readahead, etc. 919 * construct our own bdi so we can control readahead, etc.
886 */ 920 */
921static atomic_long_t bdi_seq = ATOMIC_INIT(0);
922
887static int ceph_register_bdi(struct super_block *sb, struct ceph_client *client) 923static int ceph_register_bdi(struct super_block *sb, struct ceph_client *client)
888{ 924{
889 int err; 925 int err;
@@ -893,7 +929,8 @@ static int ceph_register_bdi(struct super_block *sb, struct ceph_client *client)
893 client->backing_dev_info.ra_pages = 929 client->backing_dev_info.ra_pages =
894 (client->mount_args->rsize + PAGE_CACHE_SIZE - 1) 930 (client->mount_args->rsize + PAGE_CACHE_SIZE - 1)
895 >> PAGE_SHIFT; 931 >> PAGE_SHIFT;
896 err = bdi_register_dev(&client->backing_dev_info, sb->s_dev); 932 err = bdi_register(&client->backing_dev_info, NULL, "ceph-%d",
933 atomic_long_inc_return(&bdi_seq));
897 if (!err) 934 if (!err)
898 sb->s_bdi = &client->backing_dev_info; 935 sb->s_bdi = &client->backing_dev_info;
899 return err; 936 return err;
@@ -932,9 +969,9 @@ static int ceph_get_sb(struct file_system_type *fs_type,
932 goto out; 969 goto out;
933 } 970 }
934 971
935 if (ceph_client(sb) != client) { 972 if (ceph_sb_to_client(sb) != client) {
936 ceph_destroy_client(client); 973 ceph_destroy_client(client);
937 client = ceph_client(sb); 974 client = ceph_sb_to_client(sb);
938 dout("get_sb got existing client %p\n", client); 975 dout("get_sb got existing client %p\n", client);
939 } else { 976 } else {
940 dout("get_sb using new client %p\n", client); 977 dout("get_sb using new client %p\n", client);
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index 13513b80d87f..3725c9ee9d08 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -52,24 +52,25 @@
52 52
53struct ceph_mount_args { 53struct ceph_mount_args {
54 int sb_flags; 54 int sb_flags;
55 int flags;
56 struct ceph_fsid fsid;
57 struct ceph_entity_addr my_addr;
55 int num_mon; 58 int num_mon;
56 struct ceph_entity_addr *mon_addr; 59 struct ceph_entity_addr *mon_addr;
57 int flags;
58 int mount_timeout; 60 int mount_timeout;
59 int osd_idle_ttl; 61 int osd_idle_ttl;
60 int caps_wanted_delay_min, caps_wanted_delay_max;
61 struct ceph_fsid fsid;
62 struct ceph_entity_addr my_addr;
63 int wsize;
64 int rsize; /* max readahead */
65 int max_readdir; /* max readdir size */
66 int congestion_kb; /* max readdir size */
67 int osd_timeout; 62 int osd_timeout;
68 int osd_keepalive_timeout; 63 int osd_keepalive_timeout;
64 int wsize;
65 int rsize; /* max readahead */
66 int congestion_kb; /* max writeback in flight */
67 int caps_wanted_delay_min, caps_wanted_delay_max;
68 int cap_release_safety;
69 int max_readdir; /* max readdir result (entires) */
70 int max_readdir_bytes; /* max readdir result (bytes) */
69 char *snapdir_name; /* default ".snap" */ 71 char *snapdir_name; /* default ".snap" */
70 char *name; 72 char *name;
71 char *secret; 73 char *secret;
72 int cap_release_safety;
73}; 74};
74 75
75/* 76/*
@@ -80,13 +81,14 @@ struct ceph_mount_args {
80#define CEPH_OSD_KEEPALIVE_DEFAULT 5 81#define CEPH_OSD_KEEPALIVE_DEFAULT 5
81#define CEPH_OSD_IDLE_TTL_DEFAULT 60 82#define CEPH_OSD_IDLE_TTL_DEFAULT 60
82#define CEPH_MOUNT_RSIZE_DEFAULT (512*1024) /* readahead */ 83#define CEPH_MOUNT_RSIZE_DEFAULT (512*1024) /* readahead */
84#define CEPH_MAX_READDIR_DEFAULT 1024
85#define CEPH_MAX_READDIR_BYTES_DEFAULT (512*1024)
83 86
84#define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024) 87#define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024)
85#define CEPH_MSG_MAX_DATA_LEN (16*1024*1024) 88#define CEPH_MSG_MAX_DATA_LEN (16*1024*1024)
86 89
87#define CEPH_SNAPDIRNAME_DEFAULT ".snap" 90#define CEPH_SNAPDIRNAME_DEFAULT ".snap"
88#define CEPH_AUTH_NAME_DEFAULT "guest" 91#define CEPH_AUTH_NAME_DEFAULT "guest"
89
90/* 92/*
91 * Delay telling the MDS we no longer want caps, in case we reopen 93 * Delay telling the MDS we no longer want caps, in case we reopen
92 * the file. Delay a minimum amount of time, even if we send a cap 94 * the file. Delay a minimum amount of time, even if we send a cap
@@ -96,6 +98,7 @@ struct ceph_mount_args {
96#define CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT 5 /* cap release delay */ 98#define CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT 5 /* cap release delay */
97#define CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT 60 /* cap release delay */ 99#define CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT 60 /* cap release delay */
98 100
101#define CEPH_CAP_RELEASE_SAFETY_DEFAULT (CEPH_CAPS_PER_RELEASE * 4)
99 102
100/* mount state */ 103/* mount state */
101enum { 104enum {
@@ -160,12 +163,6 @@ struct ceph_client {
160#endif 163#endif
161}; 164};
162 165
163static inline struct ceph_client *ceph_client(struct super_block *sb)
164{
165 return sb->s_fs_info;
166}
167
168
169/* 166/*
170 * File i/o capability. This tracks shared state with the metadata 167 * File i/o capability. This tracks shared state with the metadata
171 * server that allows us to cache or writeback attributes or to read 168 * server that allows us to cache or writeback attributes or to read
@@ -871,6 +868,7 @@ extern struct dentry *ceph_finish_lookup(struct ceph_mds_request *req,
871extern void ceph_dentry_lru_add(struct dentry *dn); 868extern void ceph_dentry_lru_add(struct dentry *dn);
872extern void ceph_dentry_lru_touch(struct dentry *dn); 869extern void ceph_dentry_lru_touch(struct dentry *dn);
873extern void ceph_dentry_lru_del(struct dentry *dn); 870extern void ceph_dentry_lru_del(struct dentry *dn);
871extern void ceph_invalidate_dentry_lease(struct dentry *dentry);
874 872
875/* 873/*
876 * our d_ops vary depending on whether the inode is live, 874 * our d_ops vary depending on whether the inode is live,
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index 2845422907fc..68aeebc69681 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -7,7 +7,8 @@
7 7
8static bool ceph_is_valid_xattr(const char *name) 8static bool ceph_is_valid_xattr(const char *name)
9{ 9{
10 return !strncmp(name, XATTR_SECURITY_PREFIX, 10 return !strncmp(name, "ceph.", 5) ||
11 !strncmp(name, XATTR_SECURITY_PREFIX,
11 XATTR_SECURITY_PREFIX_LEN) || 12 XATTR_SECURITY_PREFIX_LEN) ||
12 !strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) || 13 !strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) ||
13 !strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN); 14 !strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN);
@@ -76,14 +77,14 @@ static size_t ceph_vxattrcb_rctime(struct ceph_inode_info *ci, char *val,
76} 77}
77 78
78static struct ceph_vxattr_cb ceph_dir_vxattrs[] = { 79static struct ceph_vxattr_cb ceph_dir_vxattrs[] = {
79 { true, "user.ceph.dir.entries", ceph_vxattrcb_entries}, 80 { true, "ceph.dir.entries", ceph_vxattrcb_entries},
80 { true, "user.ceph.dir.files", ceph_vxattrcb_files}, 81 { true, "ceph.dir.files", ceph_vxattrcb_files},
81 { true, "user.ceph.dir.subdirs", ceph_vxattrcb_subdirs}, 82 { true, "ceph.dir.subdirs", ceph_vxattrcb_subdirs},
82 { true, "user.ceph.dir.rentries", ceph_vxattrcb_rentries}, 83 { true, "ceph.dir.rentries", ceph_vxattrcb_rentries},
83 { true, "user.ceph.dir.rfiles", ceph_vxattrcb_rfiles}, 84 { true, "ceph.dir.rfiles", ceph_vxattrcb_rfiles},
84 { true, "user.ceph.dir.rsubdirs", ceph_vxattrcb_rsubdirs}, 85 { true, "ceph.dir.rsubdirs", ceph_vxattrcb_rsubdirs},
85 { true, "user.ceph.dir.rbytes", ceph_vxattrcb_rbytes}, 86 { true, "ceph.dir.rbytes", ceph_vxattrcb_rbytes},
86 { true, "user.ceph.dir.rctime", ceph_vxattrcb_rctime}, 87 { true, "ceph.dir.rctime", ceph_vxattrcb_rctime},
87 { true, NULL, NULL } 88 { true, NULL, NULL }
88}; 89};
89 90
@@ -107,7 +108,7 @@ static size_t ceph_vxattrcb_layout(struct ceph_inode_info *ci, char *val,
107} 108}
108 109
109static struct ceph_vxattr_cb ceph_file_vxattrs[] = { 110static struct ceph_vxattr_cb ceph_file_vxattrs[] = {
110 { true, "user.ceph.layout", ceph_vxattrcb_layout}, 111 { true, "ceph.layout", ceph_vxattrcb_layout},
111 { NULL, NULL } 112 { NULL, NULL }
112}; 113};
113 114
@@ -186,12 +187,6 @@ static int __set_xattr(struct ceph_inode_info *ci,
186 ci->i_xattrs.names_size -= xattr->name_len; 187 ci->i_xattrs.names_size -= xattr->name_len;
187 ci->i_xattrs.vals_size -= xattr->val_len; 188 ci->i_xattrs.vals_size -= xattr->val_len;
188 } 189 }
189 if (!xattr) {
190 pr_err("__set_xattr ENOMEM on %p %llx.%llx xattr %s=%s\n",
191 &ci->vfs_inode, ceph_vinop(&ci->vfs_inode), name,
192 xattr->val);
193 return -ENOMEM;
194 }
195 ci->i_xattrs.names_size += name_len; 190 ci->i_xattrs.names_size += name_len;
196 ci->i_xattrs.vals_size += val_len; 191 ci->i_xattrs.vals_size += val_len;
197 if (val) 192 if (val)
@@ -574,7 +569,7 @@ ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size)
574 ci->i_xattrs.version, ci->i_xattrs.index_version); 569 ci->i_xattrs.version, ci->i_xattrs.index_version);
575 570
576 if (__ceph_caps_issued_mask(ci, CEPH_CAP_XATTR_SHARED, 1) && 571 if (__ceph_caps_issued_mask(ci, CEPH_CAP_XATTR_SHARED, 1) &&
577 (ci->i_xattrs.index_version > ci->i_xattrs.version)) { 572 (ci->i_xattrs.index_version >= ci->i_xattrs.version)) {
578 goto list_xattr; 573 goto list_xattr;
579 } else { 574 } else {
580 spin_unlock(&inode->i_lock); 575 spin_unlock(&inode->i_lock);
@@ -622,7 +617,7 @@ out:
622static int ceph_sync_setxattr(struct dentry *dentry, const char *name, 617static int ceph_sync_setxattr(struct dentry *dentry, const char *name,
623 const char *value, size_t size, int flags) 618 const char *value, size_t size, int flags)
624{ 619{
625 struct ceph_client *client = ceph_client(dentry->d_sb); 620 struct ceph_client *client = ceph_sb_to_client(dentry->d_sb);
626 struct inode *inode = dentry->d_inode; 621 struct inode *inode = dentry->d_inode;
627 struct ceph_inode_info *ci = ceph_inode(inode); 622 struct ceph_inode_info *ci = ceph_inode(inode);
628 struct inode *parent_inode = dentry->d_parent->d_inode; 623 struct inode *parent_inode = dentry->d_parent->d_inode;
@@ -641,7 +636,7 @@ static int ceph_sync_setxattr(struct dentry *dentry, const char *name,
641 return -ENOMEM; 636 return -ENOMEM;
642 err = -ENOMEM; 637 err = -ENOMEM;
643 for (i = 0; i < nr_pages; i++) { 638 for (i = 0; i < nr_pages; i++) {
644 pages[i] = alloc_page(GFP_NOFS); 639 pages[i] = __page_cache_alloc(GFP_NOFS);
645 if (!pages[i]) { 640 if (!pages[i]) {
646 nr_pages = i; 641 nr_pages = i;
647 goto out; 642 goto out;
@@ -779,7 +774,7 @@ out:
779 774
780static int ceph_send_removexattr(struct dentry *dentry, const char *name) 775static int ceph_send_removexattr(struct dentry *dentry, const char *name)
781{ 776{
782 struct ceph_client *client = ceph_client(dentry->d_sb); 777 struct ceph_client *client = ceph_sb_to_client(dentry->d_sb);
783 struct ceph_mds_client *mdsc = &client->mdsc; 778 struct ceph_mds_client *mdsc = &client->mdsc;
784 struct inode *inode = dentry->d_inode; 779 struct inode *inode = dentry->d_inode;
785 struct inode *parent_inode = dentry->d_parent->d_inode; 780 struct inode *parent_inode = dentry->d_parent->d_inode;
diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c
index 4cfab1cc75c0..d91e9d829bc1 100644
--- a/fs/exofs/dir.c
+++ b/fs/exofs/dir.c
@@ -608,7 +608,7 @@ int exofs_make_empty(struct inode *inode, struct inode *parent)
608 de->inode_no = cpu_to_le64(parent->i_ino); 608 de->inode_no = cpu_to_le64(parent->i_ino);
609 memcpy(de->name, PARENT_DIR, sizeof(PARENT_DIR)); 609 memcpy(de->name, PARENT_DIR, sizeof(PARENT_DIR));
610 exofs_set_de_type(de, inode); 610 exofs_set_de_type(de, inode);
611 kunmap_atomic(page, KM_USER0); 611 kunmap_atomic(kaddr, KM_USER0);
612 err = exofs_commit_chunk(page, 0, chunk_size); 612 err = exofs_commit_chunk(page, 0, chunk_size);
613fail: 613fail:
614 page_cache_release(page); 614 page_cache_release(page);
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index d7c6afa79754..4bb6ef822e46 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -755,6 +755,21 @@ static int exofs_write_end(struct file *file, struct address_space *mapping,
755 return ret; 755 return ret;
756} 756}
757 757
758static int exofs_releasepage(struct page *page, gfp_t gfp)
759{
760 EXOFS_DBGMSG("page 0x%lx\n", page->index);
761 WARN_ON(1);
762 return try_to_free_buffers(page);
763}
764
765static void exofs_invalidatepage(struct page *page, unsigned long offset)
766{
767 EXOFS_DBGMSG("page_has_buffers=>%d\n", page_has_buffers(page));
768 WARN_ON(1);
769
770 block_invalidatepage(page, offset);
771}
772
758const struct address_space_operations exofs_aops = { 773const struct address_space_operations exofs_aops = {
759 .readpage = exofs_readpage, 774 .readpage = exofs_readpage,
760 .readpages = exofs_readpages, 775 .readpages = exofs_readpages,
@@ -762,6 +777,21 @@ const struct address_space_operations exofs_aops = {
762 .writepages = exofs_writepages, 777 .writepages = exofs_writepages,
763 .write_begin = exofs_write_begin_export, 778 .write_begin = exofs_write_begin_export,
764 .write_end = exofs_write_end, 779 .write_end = exofs_write_end,
780 .releasepage = exofs_releasepage,
781 .set_page_dirty = __set_page_dirty_nobuffers,
782 .invalidatepage = exofs_invalidatepage,
783
784 /* Not implemented Yet */
785 .bmap = NULL, /* TODO: use osd's OSD_ACT_READ_MAP */
786 .direct_IO = NULL, /* TODO: Should be trivial to do */
787
788 /* With these NULL has special meaning or default is not exported */
789 .sync_page = NULL,
790 .get_xip_mem = NULL,
791 .migratepage = NULL,
792 .launder_page = NULL,
793 .is_partially_uptodate = NULL,
794 .error_remove_page = NULL,
765}; 795};
766 796
767/****************************************************************************** 797/******************************************************************************
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 530b4ca01510..ee42b9e0b16a 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -19,6 +19,7 @@
19#include <linux/buffer_head.h> 19#include <linux/buffer_head.h>
20#include <linux/compat.h> 20#include <linux/compat.h>
21#include <asm/uaccess.h> 21#include <asm/uaccess.h>
22#include <linux/kernel.h>
22#include "fat.h" 23#include "fat.h"
23 24
24/* 25/*
@@ -140,28 +141,22 @@ static int uni16_to_x8(unsigned char *ascii, const wchar_t *uni, int len,
140{ 141{
141 const wchar_t *ip; 142 const wchar_t *ip;
142 wchar_t ec; 143 wchar_t ec;
143 unsigned char *op, nc; 144 unsigned char *op;
144 int charlen; 145 int charlen;
145 int k;
146 146
147 ip = uni; 147 ip = uni;
148 op = ascii; 148 op = ascii;
149 149
150 while (*ip && ((len - NLS_MAX_CHARSET_SIZE) > 0)) { 150 while (*ip && ((len - NLS_MAX_CHARSET_SIZE) > 0)) {
151 ec = *ip++; 151 ec = *ip++;
152 if ( (charlen = nls->uni2char(ec, op, NLS_MAX_CHARSET_SIZE)) > 0) { 152 if ((charlen = nls->uni2char(ec, op, NLS_MAX_CHARSET_SIZE)) > 0) {
153 op += charlen; 153 op += charlen;
154 len -= charlen; 154 len -= charlen;
155 } else { 155 } else {
156 if (uni_xlate == 1) { 156 if (uni_xlate == 1) {
157 *op = ':'; 157 *op++ = ':';
158 for (k = 4; k > 0; k--) { 158 op = pack_hex_byte(op, ec >> 8);
159 nc = ec & 0xF; 159 op = pack_hex_byte(op, ec);
160 op[k] = nc > 9 ? nc + ('a' - 10)
161 : nc + '0';
162 ec >>= 4;
163 }
164 op += 5;
165 len -= 5; 160 len -= 5;
166 } else { 161 } else {
167 *op++ = '?'; 162 *op++ = '?';
@@ -758,9 +753,10 @@ static int fat_ioctl_readdir(struct inode *inode, struct file *filp,
758 return ret; 753 return ret;
759} 754}
760 755
761static int fat_dir_ioctl(struct inode *inode, struct file *filp, 756static long fat_dir_ioctl(struct file *filp, unsigned int cmd,
762 unsigned int cmd, unsigned long arg) 757 unsigned long arg)
763{ 758{
759 struct inode *inode = filp->f_path.dentry->d_inode;
764 struct __fat_dirent __user *d1 = (struct __fat_dirent __user *)arg; 760 struct __fat_dirent __user *d1 = (struct __fat_dirent __user *)arg;
765 int short_only, both; 761 int short_only, both;
766 762
@@ -774,7 +770,7 @@ static int fat_dir_ioctl(struct inode *inode, struct file *filp,
774 both = 1; 770 both = 1;
775 break; 771 break;
776 default: 772 default:
777 return fat_generic_ioctl(inode, filp, cmd, arg); 773 return fat_generic_ioctl(filp, cmd, arg);
778 } 774 }
779 775
780 if (!access_ok(VERIFY_WRITE, d1, sizeof(struct __fat_dirent[2]))) 776 if (!access_ok(VERIFY_WRITE, d1, sizeof(struct __fat_dirent[2])))
@@ -814,7 +810,7 @@ static long fat_compat_dir_ioctl(struct file *filp, unsigned cmd,
814 both = 1; 810 both = 1;
815 break; 811 break;
816 default: 812 default:
817 return -ENOIOCTLCMD; 813 return fat_generic_ioctl(filp, cmd, (unsigned long)arg);
818 } 814 }
819 815
820 if (!access_ok(VERIFY_WRITE, d1, sizeof(struct compat_dirent[2]))) 816 if (!access_ok(VERIFY_WRITE, d1, sizeof(struct compat_dirent[2])))
@@ -836,7 +832,7 @@ const struct file_operations fat_dir_operations = {
836 .llseek = generic_file_llseek, 832 .llseek = generic_file_llseek,
837 .read = generic_read_dir, 833 .read = generic_read_dir,
838 .readdir = fat_readdir, 834 .readdir = fat_readdir,
839 .ioctl = fat_dir_ioctl, 835 .unlocked_ioctl = fat_dir_ioctl,
840#ifdef CONFIG_COMPAT 836#ifdef CONFIG_COMPAT
841 .compat_ioctl = fat_compat_dir_ioctl, 837 .compat_ioctl = fat_compat_dir_ioctl,
842#endif 838#endif
diff --git a/fs/fat/fat.h b/fs/fat/fat.h
index e6efdfa0f6db..eb821ee1a333 100644
--- a/fs/fat/fat.h
+++ b/fs/fat/fat.h
@@ -298,8 +298,8 @@ extern int fat_free_clusters(struct inode *inode, int cluster);
298extern int fat_count_free_clusters(struct super_block *sb); 298extern int fat_count_free_clusters(struct super_block *sb);
299 299
300/* fat/file.c */ 300/* fat/file.c */
301extern int fat_generic_ioctl(struct inode *inode, struct file *filp, 301extern long fat_generic_ioctl(struct file *filp, unsigned int cmd,
302 unsigned int cmd, unsigned long arg); 302 unsigned long arg);
303extern const struct file_operations fat_file_operations; 303extern const struct file_operations fat_file_operations;
304extern const struct inode_operations fat_file_inode_operations; 304extern const struct inode_operations fat_file_inode_operations;
305extern int fat_setattr(struct dentry * dentry, struct iattr * attr); 305extern int fat_setattr(struct dentry * dentry, struct iattr * attr);
diff --git a/fs/fat/file.c b/fs/fat/file.c
index e8c159de236b..a14c2f6a489e 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -8,6 +8,7 @@
8 8
9#include <linux/capability.h> 9#include <linux/capability.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/compat.h>
11#include <linux/mount.h> 12#include <linux/mount.h>
12#include <linux/time.h> 13#include <linux/time.h>
13#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
@@ -114,9 +115,9 @@ out:
114 return err; 115 return err;
115} 116}
116 117
117int fat_generic_ioctl(struct inode *inode, struct file *filp, 118long fat_generic_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
118 unsigned int cmd, unsigned long arg)
119{ 119{
120 struct inode *inode = filp->f_path.dentry->d_inode;
120 u32 __user *user_attr = (u32 __user *)arg; 121 u32 __user *user_attr = (u32 __user *)arg;
121 122
122 switch (cmd) { 123 switch (cmd) {
@@ -129,6 +130,15 @@ int fat_generic_ioctl(struct inode *inode, struct file *filp,
129 } 130 }
130} 131}
131 132
133#ifdef CONFIG_COMPAT
134static long fat_generic_compat_ioctl(struct file *filp, unsigned int cmd,
135 unsigned long arg)
136
137{
138 return fat_generic_ioctl(filp, cmd, (unsigned long)compat_ptr(arg));
139}
140#endif
141
132static int fat_file_release(struct inode *inode, struct file *filp) 142static int fat_file_release(struct inode *inode, struct file *filp)
133{ 143{
134 if ((filp->f_mode & FMODE_WRITE) && 144 if ((filp->f_mode & FMODE_WRITE) &&
@@ -159,7 +169,10 @@ const struct file_operations fat_file_operations = {
159 .aio_write = generic_file_aio_write, 169 .aio_write = generic_file_aio_write,
160 .mmap = generic_file_mmap, 170 .mmap = generic_file_mmap,
161 .release = fat_file_release, 171 .release = fat_file_release,
162 .ioctl = fat_generic_ioctl, 172 .unlocked_ioctl = fat_generic_ioctl,
173#ifdef CONFIG_COMPAT
174 .compat_ioctl = fat_generic_compat_ioctl,
175#endif
163 .fsync = fat_file_fsync, 176 .fsync = fat_file_fsync,
164 .splice_read = generic_file_splice_read, 177 .splice_read = generic_file_splice_read,
165}; 178};
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 0ce143bd7d56..c611818893b2 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -1497,10 +1497,8 @@ out_fail:
1497 iput(fat_inode); 1497 iput(fat_inode);
1498 if (root_inode) 1498 if (root_inode)
1499 iput(root_inode); 1499 iput(root_inode);
1500 if (sbi->nls_io) 1500 unload_nls(sbi->nls_io);
1501 unload_nls(sbi->nls_io); 1501 unload_nls(sbi->nls_disk);
1502 if (sbi->nls_disk)
1503 unload_nls(sbi->nls_disk);
1504 if (sbi->options.iocharset != fat_default_iocharset) 1502 if (sbi->options.iocharset != fat_default_iocharset)
1505 kfree(sbi->options.iocharset); 1503 kfree(sbi->options.iocharset);
1506 sb->s_fs_info = NULL; 1504 sb->s_fs_info = NULL;
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 24d2e30f1b46..a6a7a1c83f54 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -99,13 +99,7 @@
99 * as arm where pointers are 32-bit aligned but there are data types such as 99 * as arm where pointers are 32-bit aligned but there are data types such as
100 * u64 which require 64-bit alignment. 100 * u64 which require 64-bit alignment.
101 */ 101 */
102#if defined(ARCH_KMALLOC_MINALIGN)
103#define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN 102#define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN
104#elif defined(ARCH_SLAB_MINALIGN)
105#define CRYPTO_MINALIGN ARCH_SLAB_MINALIGN
106#else
107#define CRYPTO_MINALIGN __alignof__(unsigned long long)
108#endif
109 103
110#define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN))) 104#define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN)))
111 105
diff --git a/include/linux/device.h b/include/linux/device.h
index 7bb9f426f3e6..0713e10571dd 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -33,6 +33,7 @@ struct class;
33struct class_private; 33struct class_private;
34struct bus_type; 34struct bus_type;
35struct bus_type_private; 35struct bus_type_private;
36struct device_node;
36 37
37struct bus_attribute { 38struct bus_attribute {
38 struct attribute attr; 39 struct attribute attr;
@@ -127,6 +128,10 @@ struct device_driver {
127 128
128 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ 129 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */
129 130
131#if defined(CONFIG_OF)
132 const struct of_device_id *of_match_table;
133#endif
134
130 int (*probe) (struct device *dev); 135 int (*probe) (struct device *dev);
131 int (*remove) (struct device *dev); 136 int (*remove) (struct device *dev);
132 void (*shutdown) (struct device *dev); 137 void (*shutdown) (struct device *dev);
@@ -435,6 +440,9 @@ struct device {
435 override */ 440 override */
436 /* arch specific additions */ 441 /* arch specific additions */
437 struct dev_archdata archdata; 442 struct dev_archdata archdata;
443#ifdef CONFIG_OF
444 struct device_node *of_node;
445#endif
438 446
439 dev_t devt; /* dev_t, creates the sysfs "dev" */ 447 dev_t devt; /* dev_t, creates the sysfs "dev" */
440 448
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 6ed1d59bfb1e..21067b418536 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -34,6 +34,7 @@
34#include <linux/device.h> /* for struct device */ 34#include <linux/device.h> /* for struct device */
35#include <linux/sched.h> /* for completion */ 35#include <linux/sched.h> /* for completion */
36#include <linux/mutex.h> 36#include <linux/mutex.h>
37#include <linux/of.h> /* for struct device_node */
37 38
38extern struct bus_type i2c_bus_type; 39extern struct bus_type i2c_bus_type;
39 40
@@ -251,6 +252,9 @@ struct i2c_board_info {
251 unsigned short addr; 252 unsigned short addr;
252 void *platform_data; 253 void *platform_data;
253 struct dev_archdata *archdata; 254 struct dev_archdata *archdata;
255#ifdef CONFIG_OF
256 struct device_node *of_node;
257#endif
254 int irq; 258 int irq;
255}; 259};
256 260
diff --git a/include/linux/mfd/sh_mobile_sdhi.h b/include/linux/mfd/sh_mobile_sdhi.h
index 3bcd7163485c..49067802a6d7 100644
--- a/include/linux/mfd/sh_mobile_sdhi.h
+++ b/include/linux/mfd/sh_mobile_sdhi.h
@@ -1,7 +1,13 @@
1#ifndef __SH_MOBILE_SDHI_H__ 1#ifndef __SH_MOBILE_SDHI_H__
2#define __SH_MOBILE_SDHI_H__ 2#define __SH_MOBILE_SDHI_H__
3 3
4#include <linux/types.h>
5
4struct sh_mobile_sdhi_info { 6struct sh_mobile_sdhi_info {
7 int dma_slave_tx;
8 int dma_slave_rx;
9 unsigned long tmio_flags;
10 u32 tmio_ocr_mask; /* available MMC voltages */
5 void (*set_pwr)(struct platform_device *pdev, int state); 11 void (*set_pwr)(struct platform_device *pdev, int state);
6}; 12};
7 13
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index c3f7dff8effc..f07425bc3dcd 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -50,17 +50,28 @@
50 tmio_iowrite16((val) >> 16, (base) + ((reg + 2) << (shift))); \ 50 tmio_iowrite16((val) >> 16, (base) + ((reg + 2) << (shift))); \
51 } while (0) 51 } while (0)
52 52
53/* tmio MMC platform flags */
54#define TMIO_MMC_WRPROTECT_DISABLE (1 << 0)
55
53int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); 56int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
54int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); 57int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
55void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state); 58void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
56void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state); 59void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
57 60
61struct tmio_mmc_dma {
62 void *chan_priv_tx;
63 void *chan_priv_rx;
64};
65
58/* 66/*
59 * data for the MMC controller 67 * data for the MMC controller
60 */ 68 */
61struct tmio_mmc_data { 69struct tmio_mmc_data {
62 unsigned int hclk; 70 unsigned int hclk;
63 unsigned long capabilities; 71 unsigned long capabilities;
72 unsigned long flags;
73 u32 ocr_mask; /* available voltages */
74 struct tmio_mmc_dma *dma;
64 void (*set_pwr)(struct platform_device *host, int state); 75 void (*set_pwr)(struct platform_device *host, int state);
65 void (*set_clk_div)(struct platform_device *host, int state); 76 void (*set_clk_div)(struct platform_device *host, int state);
66}; 77};
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index d3a74e00a3e1..11651facc5f1 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_OF_DEVICE_H 1#ifndef _LINUX_OF_DEVICE_H
2#define _LINUX_OF_DEVICE_H 2#define _LINUX_OF_DEVICE_H
3 3
4#ifdef CONFIG_OF_DEVICE
4#include <linux/device.h> 5#include <linux/device.h>
5#include <linux/of.h> 6#include <linux/of.h>
6#include <linux/mod_devicetable.h> 7#include <linux/mod_devicetable.h>
@@ -10,7 +11,7 @@
10#define to_of_device(d) container_of(d, struct of_device, dev) 11#define to_of_device(d) container_of(d, struct of_device, dev)
11 12
12extern const struct of_device_id *of_match_device( 13extern const struct of_device_id *of_match_device(
13 const struct of_device_id *matches, const struct of_device *dev); 14 const struct of_device_id *matches, const struct device *dev);
14 15
15extern struct of_device *of_dev_get(struct of_device *dev); 16extern struct of_device *of_dev_get(struct of_device *dev);
16extern void of_dev_put(struct of_device *dev); 17extern void of_dev_put(struct of_device *dev);
@@ -26,5 +27,6 @@ static inline void of_device_free(struct of_device *dev)
26 27
27extern ssize_t of_device_get_modalias(struct of_device *ofdev, 28extern ssize_t of_device_get_modalias(struct of_device *ofdev,
28 char *str, ssize_t len); 29 char *str, ssize_t len);
30#endif /* CONFIG_OF_DEVICE */
29 31
30#endif /* _LINUX_OF_DEVICE_H */ 32#endif /* _LINUX_OF_DEVICE_H */
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index a1ca92ccb0ff..71e1a916d3fa 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -57,6 +57,7 @@ struct boot_param_header {
57 __be32 dt_struct_size; /* size of the DT structure block */ 57 __be32 dt_struct_size; /* size of the DT structure block */
58}; 58};
59 59
60#if defined(CONFIG_OF_FLATTREE)
60/* TBD: Temporary export of fdt globals - remove when code fully merged */ 61/* TBD: Temporary export of fdt globals - remove when code fully merged */
61extern int __initdata dt_root_addr_cells; 62extern int __initdata dt_root_addr_cells;
62extern int __initdata dt_root_size_cells; 63extern int __initdata dt_root_size_cells;
@@ -98,6 +99,9 @@ extern int early_init_dt_scan_root(unsigned long node, const char *uname,
98/* Other Prototypes */ 99/* Other Prototypes */
99extern void unflatten_device_tree(void); 100extern void unflatten_device_tree(void);
100extern void early_init_devtree(void *); 101extern void early_init_devtree(void *);
102#else /* CONFIG_OF_FLATTREE */
103static inline void unflatten_device_tree(void) {}
104#endif /* CONFIG_OF_FLATTREE */
101 105
102#endif /* __ASSEMBLY__ */ 106#endif /* __ASSEMBLY__ */
103#endif /* _LINUX_OF_FDT_H */ 107#endif /* _LINUX_OF_FDT_H */
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 908406651330..1643d3761eb4 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -11,6 +11,7 @@
11 * 11 *
12 */ 12 */
13 13
14#ifdef CONFIG_OF_DEVICE
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/device.h> 16#include <linux/device.h>
16#include <linux/mod_devicetable.h> 17#include <linux/mod_devicetable.h>
@@ -30,10 +31,6 @@ extern struct bus_type of_platform_bus_type;
30 */ 31 */
31struct of_platform_driver 32struct of_platform_driver
32{ 33{
33 const char *name;
34 const struct of_device_id *match_table;
35 struct module *owner;
36
37 int (*probe)(struct of_device* dev, 34 int (*probe)(struct of_device* dev,
38 const struct of_device_id *match); 35 const struct of_device_id *match);
39 int (*remove)(struct of_device* dev); 36 int (*remove)(struct of_device* dev);
@@ -66,5 +63,6 @@ static inline void of_unregister_platform_driver(struct of_platform_driver *drv)
66extern struct of_device *of_find_device_by_node(struct device_node *np); 63extern struct of_device *of_find_device_by_node(struct device_node *np);
67 64
68extern int of_bus_type_init(struct bus_type *bus, const char *name); 65extern int of_bus_type_init(struct bus_type *bus, const char *name);
66#endif /* CONFIG_OF_DEVICE */
69 67
70#endif /* _LINUX_OF_PLATFORM_H */ 68#endif /* _LINUX_OF_PLATFORM_H */
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index ca6b2b317991..1812dac8c496 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -16,6 +16,30 @@
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <linux/kmemtrace.h> 17#include <linux/kmemtrace.h>
18 18
19#ifndef ARCH_KMALLOC_MINALIGN
20/*
21 * Enforce a minimum alignment for the kmalloc caches.
22 * Usually, the kmalloc caches are cache_line_size() aligned, except when
23 * DEBUG and FORCED_DEBUG are enabled, then they are BYTES_PER_WORD aligned.
24 * Some archs want to perform DMA into kmalloc caches and need a guaranteed
25 * alignment larger than the alignment of a 64-bit integer.
26 * ARCH_KMALLOC_MINALIGN allows that.
27 * Note that increasing this value may disable some debug features.
28 */
29#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
30#endif
31
32#ifndef ARCH_SLAB_MINALIGN
33/*
34 * Enforce a minimum alignment for all caches.
35 * Intended for archs that get misalignment faults even for BYTES_PER_WORD
36 * aligned buffers. Includes ARCH_KMALLOC_MINALIGN.
37 * If possible: Do not enable this flag for CONFIG_DEBUG_SLAB, it disables
38 * some debug features.
39 */
40#define ARCH_SLAB_MINALIGN 0
41#endif
42
19/* 43/*
20 * struct kmem_cache 44 * struct kmem_cache
21 * 45 *
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
index 0ec00b39d006..62667f72c2ef 100644
--- a/include/linux/slob_def.h
+++ b/include/linux/slob_def.h
@@ -1,6 +1,14 @@
1#ifndef __LINUX_SLOB_DEF_H 1#ifndef __LINUX_SLOB_DEF_H
2#define __LINUX_SLOB_DEF_H 2#define __LINUX_SLOB_DEF_H
3 3
4#ifndef ARCH_KMALLOC_MINALIGN
5#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long)
6#endif
7
8#ifndef ARCH_SLAB_MINALIGN
9#define ARCH_SLAB_MINALIGN __alignof__(unsigned long)
10#endif
11
4void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); 12void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
5 13
6static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep, 14static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep,
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 0249d4175bac..55695c8d2f8a 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -116,6 +116,14 @@ struct kmem_cache {
116 116
117#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE) 117#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE)
118 118
119#ifndef ARCH_KMALLOC_MINALIGN
120#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
121#endif
122
123#ifndef ARCH_SLAB_MINALIGN
124#define ARCH_SLAB_MINALIGN __alignof__(unsigned long long)
125#endif
126
119/* 127/*
120 * Maximum kmalloc object size handled by SLUB. Larger object allocations 128 * Maximum kmalloc object size handled by SLUB. Larger object allocations
121 * are passed through to the page allocator. The page allocator "fastpath" 129 * are passed through to the page allocator. The page allocator "fastpath"
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index a7fb54808a23..156c26bb8bd7 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -86,6 +86,10 @@ do { \
86 86
87/** 87/**
88 * enum p9_msg_t - 9P message types 88 * enum p9_msg_t - 9P message types
89 * @P9_TSTATFS: file system status request
90 * @P9_RSTATFS: file system status response
91 * @P9_TRENAME: rename request
92 * @P9_RRENAME: rename response
89 * @P9_TVERSION: version handshake request 93 * @P9_TVERSION: version handshake request
90 * @P9_RVERSION: version handshake response 94 * @P9_RVERSION: version handshake response
91 * @P9_TAUTH: request to establish authentication channel 95 * @P9_TAUTH: request to establish authentication channel
@@ -125,6 +129,10 @@ do { \
125 */ 129 */
126 130
127enum p9_msg_t { 131enum p9_msg_t {
132 P9_TSTATFS = 8,
133 P9_RSTATFS,
134 P9_TRENAME = 20,
135 P9_RRENAME,
128 P9_TVERSION = 100, 136 P9_TVERSION = 100,
129 P9_RVERSION, 137 P9_RVERSION,
130 P9_TAUTH = 102, 138 P9_TAUTH = 102,
@@ -350,6 +358,31 @@ struct p9_wstat {
350}; 358};
351 359
352/* Structures for Protocol Operations */ 360/* Structures for Protocol Operations */
361struct p9_tstatfs {
362 u32 fid;
363};
364
365struct p9_rstatfs {
366 u32 type;
367 u32 bsize;
368 u64 blocks;
369 u64 bfree;
370 u64 bavail;
371 u64 files;
372 u64 ffree;
373 u64 fsid;
374 u32 namelen;
375};
376
377struct p9_trename {
378 u32 fid;
379 u32 newdirfid;
380 struct p9_str name;
381};
382
383struct p9_rrename {
384};
385
353struct p9_tversion { 386struct p9_tversion {
354 u32 msize; 387 u32 msize;
355 struct p9_str version; 388 struct p9_str version;
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index 4f3760afc20f..7dd3ed85c782 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -195,6 +195,8 @@ struct p9_fid {
195 struct list_head dlist; /* list of all fids attached to a dentry */ 195 struct list_head dlist; /* list of all fids attached to a dentry */
196}; 196};
197 197
198int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb);
199int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name);
198int p9_client_version(struct p9_client *); 200int p9_client_version(struct p9_client *);
199struct p9_client *p9_client_create(const char *dev_name, char *options); 201struct p9_client *p9_client_create(const char *dev_name, char *options);
200void p9_client_destroy(struct p9_client *clnt); 202void p9_client_destroy(struct p9_client *clnt);
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 5be900d19660..e24b0363e6cb 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -831,7 +831,6 @@ struct ieee80211_key_conf {
831 u8 iv_len; 831 u8 iv_len;
832 u8 hw_key_idx; 832 u8 hw_key_idx;
833 u8 flags; 833 u8 flags;
834 u8 *ap_addr;
835 s8 keyidx; 834 s8 keyidx;
836 u8 keylen; 835 u8 keylen;
837 u8 key[0]; 836 u8 key[0];
diff --git a/mm/slab.c b/mm/slab.c
index bac0f4fcc216..50a73fca19c4 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -115,6 +115,7 @@
115#include <linux/reciprocal_div.h> 115#include <linux/reciprocal_div.h>
116#include <linux/debugobjects.h> 116#include <linux/debugobjects.h>
117#include <linux/kmemcheck.h> 117#include <linux/kmemcheck.h>
118#include <linux/memory.h>
118 119
119#include <asm/cacheflush.h> 120#include <asm/cacheflush.h>
120#include <asm/tlbflush.h> 121#include <asm/tlbflush.h>
@@ -144,30 +145,6 @@
144#define BYTES_PER_WORD sizeof(void *) 145#define BYTES_PER_WORD sizeof(void *)
145#define REDZONE_ALIGN max(BYTES_PER_WORD, __alignof__(unsigned long long)) 146#define REDZONE_ALIGN max(BYTES_PER_WORD, __alignof__(unsigned long long))
146 147
147#ifndef ARCH_KMALLOC_MINALIGN
148/*
149 * Enforce a minimum alignment for the kmalloc caches.
150 * Usually, the kmalloc caches are cache_line_size() aligned, except when
151 * DEBUG and FORCED_DEBUG are enabled, then they are BYTES_PER_WORD aligned.
152 * Some archs want to perform DMA into kmalloc caches and need a guaranteed
153 * alignment larger than the alignment of a 64-bit integer.
154 * ARCH_KMALLOC_MINALIGN allows that.
155 * Note that increasing this value may disable some debug features.
156 */
157#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
158#endif
159
160#ifndef ARCH_SLAB_MINALIGN
161/*
162 * Enforce a minimum alignment for all caches.
163 * Intended for archs that get misalignment faults even for BYTES_PER_WORD
164 * aligned buffers. Includes ARCH_KMALLOC_MINALIGN.
165 * If possible: Do not enable this flag for CONFIG_DEBUG_SLAB, it disables
166 * some debug features.
167 */
168#define ARCH_SLAB_MINALIGN 0
169#endif
170
171#ifndef ARCH_KMALLOC_FLAGS 148#ifndef ARCH_KMALLOC_FLAGS
172#define ARCH_KMALLOC_FLAGS SLAB_HWCACHE_ALIGN 149#define ARCH_KMALLOC_FLAGS SLAB_HWCACHE_ALIGN
173#endif 150#endif
@@ -1102,6 +1079,52 @@ static inline int cache_free_alien(struct kmem_cache *cachep, void *objp)
1102} 1079}
1103#endif 1080#endif
1104 1081
1082/*
1083 * Allocates and initializes nodelists for a node on each slab cache, used for
1084 * either memory or cpu hotplug. If memory is being hot-added, the kmem_list3
1085 * will be allocated off-node since memory is not yet online for the new node.
1086 * When hotplugging memory or a cpu, existing nodelists are not replaced if
1087 * already in use.
1088 *
1089 * Must hold cache_chain_mutex.
1090 */
1091static int init_cache_nodelists_node(int node)
1092{
1093 struct kmem_cache *cachep;
1094 struct kmem_list3 *l3;
1095 const int memsize = sizeof(struct kmem_list3);
1096
1097 list_for_each_entry(cachep, &cache_chain, next) {
1098 /*
1099 * Set up the size64 kmemlist for cpu before we can
1100 * begin anything. Make sure some other cpu on this
1101 * node has not already allocated this
1102 */
1103 if (!cachep->nodelists[node]) {
1104 l3 = kmalloc_node(memsize, GFP_KERNEL, node);
1105 if (!l3)
1106 return -ENOMEM;
1107 kmem_list3_init(l3);
1108 l3->next_reap = jiffies + REAPTIMEOUT_LIST3 +
1109 ((unsigned long)cachep) % REAPTIMEOUT_LIST3;
1110
1111 /*
1112 * The l3s don't come and go as CPUs come and
1113 * go. cache_chain_mutex is sufficient
1114 * protection here.
1115 */
1116 cachep->nodelists[node] = l3;
1117 }
1118
1119 spin_lock_irq(&cachep->nodelists[node]->list_lock);
1120 cachep->nodelists[node]->free_limit =
1121 (1 + nr_cpus_node(node)) *
1122 cachep->batchcount + cachep->num;
1123 spin_unlock_irq(&cachep->nodelists[node]->list_lock);
1124 }
1125 return 0;
1126}
1127
1105static void __cpuinit cpuup_canceled(long cpu) 1128static void __cpuinit cpuup_canceled(long cpu)
1106{ 1129{
1107 struct kmem_cache *cachep; 1130 struct kmem_cache *cachep;
@@ -1172,7 +1195,7 @@ static int __cpuinit cpuup_prepare(long cpu)
1172 struct kmem_cache *cachep; 1195 struct kmem_cache *cachep;
1173 struct kmem_list3 *l3 = NULL; 1196 struct kmem_list3 *l3 = NULL;
1174 int node = cpu_to_node(cpu); 1197 int node = cpu_to_node(cpu);
1175 const int memsize = sizeof(struct kmem_list3); 1198 int err;
1176 1199
1177 /* 1200 /*
1178 * We need to do this right in the beginning since 1201 * We need to do this right in the beginning since
@@ -1180,35 +1203,9 @@ static int __cpuinit cpuup_prepare(long cpu)
1180 * kmalloc_node allows us to add the slab to the right 1203 * kmalloc_node allows us to add the slab to the right
1181 * kmem_list3 and not this cpu's kmem_list3 1204 * kmem_list3 and not this cpu's kmem_list3
1182 */ 1205 */
1183 1206 err = init_cache_nodelists_node(node);
1184 list_for_each_entry(cachep, &cache_chain, next) { 1207 if (err < 0)
1185 /* 1208 goto bad;
1186 * Set up the size64 kmemlist for cpu before we can
1187 * begin anything. Make sure some other cpu on this
1188 * node has not already allocated this
1189 */
1190 if (!cachep->nodelists[node]) {
1191 l3 = kmalloc_node(memsize, GFP_KERNEL, node);
1192 if (!l3)
1193 goto bad;
1194 kmem_list3_init(l3);
1195 l3->next_reap = jiffies + REAPTIMEOUT_LIST3 +
1196 ((unsigned long)cachep) % REAPTIMEOUT_LIST3;
1197
1198 /*
1199 * The l3s don't come and go as CPUs come and
1200 * go. cache_chain_mutex is sufficient
1201 * protection here.
1202 */
1203 cachep->nodelists[node] = l3;
1204 }
1205
1206 spin_lock_irq(&cachep->nodelists[node]->list_lock);
1207 cachep->nodelists[node]->free_limit =
1208 (1 + nr_cpus_node(node)) *
1209 cachep->batchcount + cachep->num;
1210 spin_unlock_irq(&cachep->nodelists[node]->list_lock);
1211 }
1212 1209
1213 /* 1210 /*
1214 * Now we can go ahead with allocating the shared arrays and 1211 * Now we can go ahead with allocating the shared arrays and
@@ -1331,11 +1328,75 @@ static struct notifier_block __cpuinitdata cpucache_notifier = {
1331 &cpuup_callback, NULL, 0 1328 &cpuup_callback, NULL, 0
1332}; 1329};
1333 1330
1331#if defined(CONFIG_NUMA) && defined(CONFIG_MEMORY_HOTPLUG)
1332/*
1333 * Drains freelist for a node on each slab cache, used for memory hot-remove.
1334 * Returns -EBUSY if all objects cannot be drained so that the node is not
1335 * removed.
1336 *
1337 * Must hold cache_chain_mutex.
1338 */
1339static int __meminit drain_cache_nodelists_node(int node)
1340{
1341 struct kmem_cache *cachep;
1342 int ret = 0;
1343
1344 list_for_each_entry(cachep, &cache_chain, next) {
1345 struct kmem_list3 *l3;
1346
1347 l3 = cachep->nodelists[node];
1348 if (!l3)
1349 continue;
1350
1351 drain_freelist(cachep, l3, l3->free_objects);
1352
1353 if (!list_empty(&l3->slabs_full) ||
1354 !list_empty(&l3->slabs_partial)) {
1355 ret = -EBUSY;
1356 break;
1357 }
1358 }
1359 return ret;
1360}
1361
1362static int __meminit slab_memory_callback(struct notifier_block *self,
1363 unsigned long action, void *arg)
1364{
1365 struct memory_notify *mnb = arg;
1366 int ret = 0;
1367 int nid;
1368
1369 nid = mnb->status_change_nid;
1370 if (nid < 0)
1371 goto out;
1372
1373 switch (action) {
1374 case MEM_GOING_ONLINE:
1375 mutex_lock(&cache_chain_mutex);
1376 ret = init_cache_nodelists_node(nid);
1377 mutex_unlock(&cache_chain_mutex);
1378 break;
1379 case MEM_GOING_OFFLINE:
1380 mutex_lock(&cache_chain_mutex);
1381 ret = drain_cache_nodelists_node(nid);
1382 mutex_unlock(&cache_chain_mutex);
1383 break;
1384 case MEM_ONLINE:
1385 case MEM_OFFLINE:
1386 case MEM_CANCEL_ONLINE:
1387 case MEM_CANCEL_OFFLINE:
1388 break;
1389 }
1390out:
1391 return ret ? notifier_from_errno(ret) : NOTIFY_OK;
1392}
1393#endif /* CONFIG_NUMA && CONFIG_MEMORY_HOTPLUG */
1394
1334/* 1395/*
1335 * swap the static kmem_list3 with kmalloced memory 1396 * swap the static kmem_list3 with kmalloced memory
1336 */ 1397 */
1337static void init_list(struct kmem_cache *cachep, struct kmem_list3 *list, 1398static void __init init_list(struct kmem_cache *cachep, struct kmem_list3 *list,
1338 int nodeid) 1399 int nodeid)
1339{ 1400{
1340 struct kmem_list3 *ptr; 1401 struct kmem_list3 *ptr;
1341 1402
@@ -1580,6 +1641,14 @@ void __init kmem_cache_init_late(void)
1580 */ 1641 */
1581 register_cpu_notifier(&cpucache_notifier); 1642 register_cpu_notifier(&cpucache_notifier);
1582 1643
1644#ifdef CONFIG_NUMA
1645 /*
1646 * Register a memory hotplug callback that initializes and frees
1647 * nodelists.
1648 */
1649 hotplug_memory_notifier(slab_memory_callback, SLAB_CALLBACK_PRI);
1650#endif
1651
1583 /* 1652 /*
1584 * The reap timers are started later, with a module init call: That part 1653 * The reap timers are started later, with a module init call: That part
1585 * of the kernel is not yet operational. 1654 * of the kernel is not yet operational.
@@ -2220,8 +2289,8 @@ kmem_cache_create (const char *name, size_t size, size_t align,
2220 if (ralign < align) { 2289 if (ralign < align) {
2221 ralign = align; 2290 ralign = align;
2222 } 2291 }
2223 /* disable debug if necessary */ 2292 /* disable debug if not aligning with REDZONE_ALIGN */
2224 if (ralign > __alignof__(unsigned long long)) 2293 if (ralign & (__alignof__(unsigned long long) - 1))
2225 flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER); 2294 flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
2226 /* 2295 /*
2227 * 4) Store it. 2296 * 4) Store it.
@@ -2247,8 +2316,8 @@ kmem_cache_create (const char *name, size_t size, size_t align,
2247 */ 2316 */
2248 if (flags & SLAB_RED_ZONE) { 2317 if (flags & SLAB_RED_ZONE) {
2249 /* add space for red zone words */ 2318 /* add space for red zone words */
2250 cachep->obj_offset += sizeof(unsigned long long); 2319 cachep->obj_offset += align;
2251 size += 2 * sizeof(unsigned long long); 2320 size += align + sizeof(unsigned long long);
2252 } 2321 }
2253 if (flags & SLAB_STORE_USER) { 2322 if (flags & SLAB_STORE_USER) {
2254 /* user store requires one word storage behind the end of 2323 /* user store requires one word storage behind the end of
@@ -4216,10 +4285,11 @@ static int s_show(struct seq_file *m, void *p)
4216 unsigned long node_frees = cachep->node_frees; 4285 unsigned long node_frees = cachep->node_frees;
4217 unsigned long overflows = cachep->node_overflow; 4286 unsigned long overflows = cachep->node_overflow;
4218 4287
4219 seq_printf(m, " : globalstat %7lu %6lu %5lu %4lu \ 4288 seq_printf(m, " : globalstat %7lu %6lu %5lu %4lu "
4220 %4lu %4lu %4lu %4lu %4lu", allocs, high, grown, 4289 "%4lu %4lu %4lu %4lu %4lu",
4221 reaped, errors, max_freeable, node_allocs, 4290 allocs, high, grown,
4222 node_frees, overflows); 4291 reaped, errors, max_freeable, node_allocs,
4292 node_frees, overflows);
4223 } 4293 }
4224 /* cpu stats */ 4294 /* cpu stats */
4225 { 4295 {
diff --git a/mm/slob.c b/mm/slob.c
index 837ebd64cc34..23631e2bb57a 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -467,14 +467,6 @@ out:
467 * End of slob allocator proper. Begin kmem_cache_alloc and kmalloc frontend. 467 * End of slob allocator proper. Begin kmem_cache_alloc and kmalloc frontend.
468 */ 468 */
469 469
470#ifndef ARCH_KMALLOC_MINALIGN
471#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long)
472#endif
473
474#ifndef ARCH_SLAB_MINALIGN
475#define ARCH_SLAB_MINALIGN __alignof__(unsigned long)
476#endif
477
478void *__kmalloc_node(size_t size, gfp_t gfp, int node) 470void *__kmalloc_node(size_t size, gfp_t gfp, int node)
479{ 471{
480 unsigned int *m; 472 unsigned int *m;
diff --git a/mm/slub.c b/mm/slub.c
index d2a54fe71ea2..e46e3129697d 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -157,14 +157,6 @@
157#define SLUB_MERGE_SAME (SLAB_DEBUG_FREE | SLAB_RECLAIM_ACCOUNT | \ 157#define SLUB_MERGE_SAME (SLAB_DEBUG_FREE | SLAB_RECLAIM_ACCOUNT | \
158 SLAB_CACHE_DMA | SLAB_NOTRACK) 158 SLAB_CACHE_DMA | SLAB_NOTRACK)
159 159
160#ifndef ARCH_KMALLOC_MINALIGN
161#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
162#endif
163
164#ifndef ARCH_SLAB_MINALIGN
165#define ARCH_SLAB_MINALIGN __alignof__(unsigned long long)
166#endif
167
168#define OO_SHIFT 16 160#define OO_SHIFT 16
169#define OO_MASK ((1 << OO_SHIFT) - 1) 161#define OO_MASK ((1 << OO_SHIFT) - 1)
170#define MAX_OBJS_PER_PAGE 65535 /* since page.objects is u16 */ 162#define MAX_OBJS_PER_PAGE 65535 /* since page.objects is u16 */
@@ -1084,7 +1076,7 @@ static inline struct page *alloc_slab_page(gfp_t flags, int node,
1084 if (node == -1) 1076 if (node == -1)
1085 return alloc_pages(flags, order); 1077 return alloc_pages(flags, order);
1086 else 1078 else
1087 return alloc_pages_node(node, flags, order); 1079 return alloc_pages_exact_node(node, flags, order);
1088} 1080}
1089 1081
1090static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node) 1082static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
@@ -2429,9 +2421,11 @@ static void list_slab_objects(struct kmem_cache *s, struct page *page,
2429#ifdef CONFIG_SLUB_DEBUG 2421#ifdef CONFIG_SLUB_DEBUG
2430 void *addr = page_address(page); 2422 void *addr = page_address(page);
2431 void *p; 2423 void *p;
2432 DECLARE_BITMAP(map, page->objects); 2424 long *map = kzalloc(BITS_TO_LONGS(page->objects) * sizeof(long),
2425 GFP_ATOMIC);
2433 2426
2434 bitmap_zero(map, page->objects); 2427 if (!map)
2428 return;
2435 slab_err(s, page, "%s", text); 2429 slab_err(s, page, "%s", text);
2436 slab_lock(page); 2430 slab_lock(page);
2437 for_each_free_object(p, s, page->freelist) 2431 for_each_free_object(p, s, page->freelist)
@@ -2446,6 +2440,7 @@ static void list_slab_objects(struct kmem_cache *s, struct page *page,
2446 } 2440 }
2447 } 2441 }
2448 slab_unlock(page); 2442 slab_unlock(page);
2443 kfree(map);
2449#endif 2444#endif
2450} 2445}
2451 2446
@@ -3338,8 +3333,15 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
3338 struct kmem_cache *s; 3333 struct kmem_cache *s;
3339 void *ret; 3334 void *ret;
3340 3335
3341 if (unlikely(size > SLUB_MAX_SIZE)) 3336 if (unlikely(size > SLUB_MAX_SIZE)) {
3342 return kmalloc_large_node(size, gfpflags, node); 3337 ret = kmalloc_large_node(size, gfpflags, node);
3338
3339 trace_kmalloc_node(caller, ret,
3340 size, PAGE_SIZE << get_order(size),
3341 gfpflags, node);
3342
3343 return ret;
3344 }
3343 3345
3344 s = get_slab(size, gfpflags); 3346 s = get_slab(size, gfpflags);
3345 3347
@@ -3651,10 +3653,10 @@ static int add_location(struct loc_track *t, struct kmem_cache *s,
3651} 3653}
3652 3654
3653static void process_slab(struct loc_track *t, struct kmem_cache *s, 3655static void process_slab(struct loc_track *t, struct kmem_cache *s,
3654 struct page *page, enum track_item alloc) 3656 struct page *page, enum track_item alloc,
3657 long *map)
3655{ 3658{
3656 void *addr = page_address(page); 3659 void *addr = page_address(page);
3657 DECLARE_BITMAP(map, page->objects);
3658 void *p; 3660 void *p;
3659 3661
3660 bitmap_zero(map, page->objects); 3662 bitmap_zero(map, page->objects);
@@ -3673,11 +3675,14 @@ static int list_locations(struct kmem_cache *s, char *buf,
3673 unsigned long i; 3675 unsigned long i;
3674 struct loc_track t = { 0, 0, NULL }; 3676 struct loc_track t = { 0, 0, NULL };
3675 int node; 3677 int node;
3678 unsigned long *map = kmalloc(BITS_TO_LONGS(oo_objects(s->max)) *
3679 sizeof(unsigned long), GFP_KERNEL);
3676 3680
3677 if (!alloc_loc_track(&t, PAGE_SIZE / sizeof(struct location), 3681 if (!map || !alloc_loc_track(&t, PAGE_SIZE / sizeof(struct location),
3678 GFP_TEMPORARY)) 3682 GFP_TEMPORARY)) {
3683 kfree(map);
3679 return sprintf(buf, "Out of memory\n"); 3684 return sprintf(buf, "Out of memory\n");
3680 3685 }
3681 /* Push back cpu slabs */ 3686 /* Push back cpu slabs */
3682 flush_all(s); 3687 flush_all(s);
3683 3688
@@ -3691,9 +3696,9 @@ static int list_locations(struct kmem_cache *s, char *buf,
3691 3696
3692 spin_lock_irqsave(&n->list_lock, flags); 3697 spin_lock_irqsave(&n->list_lock, flags);
3693 list_for_each_entry(page, &n->partial, lru) 3698 list_for_each_entry(page, &n->partial, lru)
3694 process_slab(&t, s, page, alloc); 3699 process_slab(&t, s, page, alloc, map);
3695 list_for_each_entry(page, &n->full, lru) 3700 list_for_each_entry(page, &n->full, lru)
3696 process_slab(&t, s, page, alloc); 3701 process_slab(&t, s, page, alloc, map);
3697 spin_unlock_irqrestore(&n->list_lock, flags); 3702 spin_unlock_irqrestore(&n->list_lock, flags);
3698 } 3703 }
3699 3704
@@ -3744,6 +3749,7 @@ static int list_locations(struct kmem_cache *s, char *buf,
3744 } 3749 }
3745 3750
3746 free_loc_track(&t); 3751 free_loc_track(&t);
3752 kfree(map);
3747 if (!t.count) 3753 if (!t.count)
3748 len += sprintf(buf, "No data\n"); 3754 len += sprintf(buf, "No data\n");
3749 return len; 3755 return len;
diff --git a/net/9p/client.c b/net/9p/client.c
index 0aa79faa9850..37c8da07a80b 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -1321,7 +1321,8 @@ static int p9_client_statsize(struct p9_wstat *wst, int proto_version)
1321 if (wst->muid) 1321 if (wst->muid)
1322 ret += strlen(wst->muid); 1322 ret += strlen(wst->muid);
1323 1323
1324 if (proto_version == p9_proto_2000u) { 1324 if ((proto_version == p9_proto_2000u) ||
1325 (proto_version == p9_proto_2000L)) {
1325 ret += 2+4+4+4; /* extension[s] n_uid[4] n_gid[4] n_muid[4] */ 1326 ret += 2+4+4+4; /* extension[s] n_uid[4] n_gid[4] n_muid[4] */
1326 if (wst->extension) 1327 if (wst->extension)
1327 ret += strlen(wst->extension); 1328 ret += strlen(wst->extension);
@@ -1364,3 +1365,70 @@ error:
1364 return err; 1365 return err;
1365} 1366}
1366EXPORT_SYMBOL(p9_client_wstat); 1367EXPORT_SYMBOL(p9_client_wstat);
1368
1369int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb)
1370{
1371 int err;
1372 struct p9_req_t *req;
1373 struct p9_client *clnt;
1374
1375 err = 0;
1376 clnt = fid->clnt;
1377
1378 P9_DPRINTK(P9_DEBUG_9P, ">>> TSTATFS fid %d\n", fid->fid);
1379
1380 req = p9_client_rpc(clnt, P9_TSTATFS, "d", fid->fid);
1381 if (IS_ERR(req)) {
1382 err = PTR_ERR(req);
1383 goto error;
1384 }
1385
1386 err = p9pdu_readf(req->rc, clnt->proto_version, "ddqqqqqqd", &sb->type,
1387 &sb->bsize, &sb->blocks, &sb->bfree, &sb->bavail,
1388 &sb->files, &sb->ffree, &sb->fsid, &sb->namelen);
1389 if (err) {
1390 p9pdu_dump(1, req->rc);
1391 p9_free_req(clnt, req);
1392 goto error;
1393 }
1394
1395 P9_DPRINTK(P9_DEBUG_9P, "<<< RSTATFS fid %d type 0x%lx bsize %ld "
1396 "blocks %llu bfree %llu bavail %llu files %llu ffree %llu "
1397 "fsid %llu namelen %ld\n",
1398 fid->fid, (long unsigned int)sb->type, (long int)sb->bsize,
1399 sb->blocks, sb->bfree, sb->bavail, sb->files, sb->ffree,
1400 sb->fsid, (long int)sb->namelen);
1401
1402 p9_free_req(clnt, req);
1403error:
1404 return err;
1405}
1406EXPORT_SYMBOL(p9_client_statfs);
1407
1408int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name)
1409{
1410 int err;
1411 struct p9_req_t *req;
1412 struct p9_client *clnt;
1413
1414 err = 0;
1415 clnt = fid->clnt;
1416
1417 P9_DPRINTK(P9_DEBUG_9P, ">>> TRENAME fid %d newdirfid %d name %s\n",
1418 fid->fid, newdirfid->fid, name);
1419
1420 req = p9_client_rpc(clnt, P9_TRENAME, "dds", fid->fid,
1421 newdirfid->fid, name);
1422 if (IS_ERR(req)) {
1423 err = PTR_ERR(req);
1424 goto error;
1425 }
1426
1427 P9_DPRINTK(P9_DEBUG_9P, "<<< RRENAME fid %d\n", fid->fid);
1428
1429 p9_free_req(clnt, req);
1430error:
1431 return err;
1432}
1433EXPORT_SYMBOL(p9_client_rename);
1434
diff --git a/net/9p/protocol.c b/net/9p/protocol.c
index e7541d5b0118..77d3aab4036b 100644
--- a/net/9p/protocol.c
+++ b/net/9p/protocol.c
@@ -341,7 +341,8 @@ p9pdu_vreadf(struct p9_fcall *pdu, int proto_version, const char *fmt,
341 } 341 }
342 break; 342 break;
343 case '?': 343 case '?':
344 if (proto_version != p9_proto_2000u) 344 if ((proto_version != p9_proto_2000u) &&
345 (proto_version != p9_proto_2000L))
345 return 0; 346 return 0;
346 break; 347 break;
347 default: 348 default:
@@ -488,7 +489,8 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
488 } 489 }
489 break; 490 break;
490 case '?': 491 case '?':
491 if (proto_version != p9_proto_2000u) 492 if ((proto_version != p9_proto_2000u) &&
493 (proto_version != p9_proto_2000L))
492 return 0; 494 return 0;
493 break; 495 break;
494 default: 496 default:
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 8d4b41787dcf..e8f6e3b252d8 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -140,7 +140,6 @@ static void ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
140 struct ieee80211_sub_if_data, 140 struct ieee80211_sub_if_data,
141 u.ap); 141 u.ap);
142 142
143 key->conf.ap_addr = sdata->dev->dev_addr;
144 ret = drv_set_key(key->local, SET_KEY, sdata, sta, &key->conf); 143 ret = drv_set_key(key->local, SET_KEY, sdata, sta, &key->conf);
145 144
146 if (!ret) { 145 if (!ret) {
diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c
index 1cd9b301df03..3fd1a7e24928 100644
--- a/sound/aoa/fabrics/layout.c
+++ b/sound/aoa/fabrics/layout.c
@@ -992,7 +992,7 @@ static int aoa_fabric_layout_probe(struct soundbus_dev *sdev)
992 return -ENODEV; 992 return -ENODEV;
993 993
994 /* by breaking out we keep a reference */ 994 /* by breaking out we keep a reference */
995 while ((sound = of_get_next_child(sdev->ofdev.node, sound))) { 995 while ((sound = of_get_next_child(sdev->ofdev.dev.of_node, sound))) {
996 if (sound->type && strcasecmp(sound->type, "soundchip") == 0) 996 if (sound->type && strcasecmp(sound->type, "soundchip") == 0)
997 break; 997 break;
998 } 998 }
diff --git a/sound/aoa/soundbus/core.c b/sound/aoa/soundbus/core.c
index fa8ab2815a98..99ca7120e269 100644
--- a/sound/aoa/soundbus/core.c
+++ b/sound/aoa/soundbus/core.c
@@ -74,11 +74,11 @@ static int soundbus_uevent(struct device *dev, struct kobj_uevent_env *env)
74 of = &soundbus_dev->ofdev; 74 of = &soundbus_dev->ofdev;
75 75
76 /* stuff we want to pass to /sbin/hotplug */ 76 /* stuff we want to pass to /sbin/hotplug */
77 retval = add_uevent_var(env, "OF_NAME=%s", of->node->name); 77 retval = add_uevent_var(env, "OF_NAME=%s", of->dev.of_node->name);
78 if (retval) 78 if (retval)
79 return retval; 79 return retval;
80 80
81 retval = add_uevent_var(env, "OF_TYPE=%s", of->node->type); 81 retval = add_uevent_var(env, "OF_TYPE=%s", of->dev.of_node->type);
82 if (retval) 82 if (retval)
83 return retval; 83 return retval;
84 84
@@ -86,7 +86,7 @@ static int soundbus_uevent(struct device *dev, struct kobj_uevent_env *env)
86 * it's not really legal to split it out with commas. We split it 86 * it's not really legal to split it out with commas. We split it
87 * up using a number of environment variables instead. */ 87 * up using a number of environment variables instead. */
88 88
89 compat = of_get_property(of->node, "compatible", &cplen); 89 compat = of_get_property(of->dev.of_node, "compatible", &cplen);
90 while (compat && cplen > 0) { 90 while (compat && cplen > 0) {
91 int tmp = env->buflen; 91 int tmp = env->buflen;
92 retval = add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat); 92 retval = add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat);
@@ -169,7 +169,7 @@ int soundbus_add_one(struct soundbus_dev *dev)
169 169
170 /* sanity checks */ 170 /* sanity checks */
171 if (!dev->attach_codec || 171 if (!dev->attach_codec ||
172 !dev->ofdev.node || 172 !dev->ofdev.dev.of_node ||
173 dev->pcmname || 173 dev->pcmname ||
174 dev->pcmid != -1) { 174 dev->pcmid != -1) {
175 printk(KERN_ERR "soundbus: adding device failed sanity check!\n"); 175 printk(KERN_ERR "soundbus: adding device failed sanity check!\n");
diff --git a/sound/aoa/soundbus/i2sbus/control.c b/sound/aoa/soundbus/i2sbus/control.c
index 47f854c2001f..4dc9b49c02cf 100644
--- a/sound/aoa/soundbus/i2sbus/control.c
+++ b/sound/aoa/soundbus/i2sbus/control.c
@@ -42,7 +42,7 @@ int i2sbus_control_add_dev(struct i2sbus_control *c,
42{ 42{
43 struct device_node *np; 43 struct device_node *np;
44 44
45 np = i2sdev->sound.ofdev.node; 45 np = i2sdev->sound.ofdev.dev.of_node;
46 i2sdev->enable = pmf_find_function(np, "enable"); 46 i2sdev->enable = pmf_find_function(np, "enable");
47 i2sdev->cell_enable = pmf_find_function(np, "cell-enable"); 47 i2sdev->cell_enable = pmf_find_function(np, "cell-enable");
48 i2sdev->clock_enable = pmf_find_function(np, "clock-enable"); 48 i2sdev->clock_enable = pmf_find_function(np, "clock-enable");
diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c
index 9d6f3b176ed1..678933721735 100644
--- a/sound/aoa/soundbus/i2sbus/core.c
+++ b/sound/aoa/soundbus/i2sbus/core.c
@@ -221,9 +221,9 @@ static int i2sbus_add_dev(struct macio_dev *macio,
221 221
222 mutex_init(&dev->lock); 222 mutex_init(&dev->lock);
223 spin_lock_init(&dev->low_lock); 223 spin_lock_init(&dev->low_lock);
224 dev->sound.ofdev.node = np; 224 dev->sound.ofdev.archdata.dma_mask = macio->ofdev.archdata.dma_mask;
225 dev->sound.ofdev.dma_mask = macio->ofdev.dma_mask; 225 dev->sound.ofdev.dev.of_node = np;
226 dev->sound.ofdev.dev.dma_mask = &dev->sound.ofdev.dma_mask; 226 dev->sound.ofdev.dev.dma_mask = &dev->sound.ofdev.archdata.dma_mask;
227 dev->sound.ofdev.dev.parent = &macio->ofdev.dev; 227 dev->sound.ofdev.dev.parent = &macio->ofdev.dev;
228 dev->sound.ofdev.dev.release = i2sbus_release_dev; 228 dev->sound.ofdev.dev.release = i2sbus_release_dev;
229 dev->sound.attach_codec = i2sbus_attach_codec; 229 dev->sound.attach_codec = i2sbus_attach_codec;
@@ -346,7 +346,7 @@ static int i2sbus_probe(struct macio_dev* dev, const struct of_device_id *match)
346 return -ENODEV; 346 return -ENODEV;
347 } 347 }
348 348
349 while ((np = of_get_next_child(dev->ofdev.node, np))) { 349 while ((np = of_get_next_child(dev->ofdev.dev.of_node, np))) {
350 if (of_device_is_compatible(np, "i2sbus") || 350 if (of_device_is_compatible(np, "i2sbus") ||
351 of_device_is_compatible(np, "i2s-modem")) { 351 of_device_is_compatible(np, "i2s-modem")) {
352 got += i2sbus_add_dev(dev, control, np); 352 got += i2sbus_add_dev(dev, control, np);
diff --git a/sound/aoa/soundbus/sysfs.c b/sound/aoa/soundbus/sysfs.c
index f580942b5c09..6496e754f00a 100644
--- a/sound/aoa/soundbus/sysfs.c
+++ b/sound/aoa/soundbus/sysfs.c
@@ -9,7 +9,7 @@ field##_show (struct device *dev, struct device_attribute *attr, \
9 char *buf) \ 9 char *buf) \
10{ \ 10{ \
11 struct soundbus_dev *mdev = to_soundbus_device (dev); \ 11 struct soundbus_dev *mdev = to_soundbus_device (dev); \
12 return sprintf (buf, format_string, mdev->ofdev.node->field); \ 12 return sprintf (buf, format_string, mdev->ofdev.dev.of_node->field); \
13} 13}
14 14
15static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, 15static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
@@ -25,7 +25,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
25 length = strlen(buf); 25 length = strlen(buf);
26 } else { 26 } else {
27 length = sprintf(buf, "of:N%sT%s\n", 27 length = sprintf(buf, "of:N%sT%s\n",
28 of->node->name, of->node->type); 28 of->dev.of_node->name, of->dev.of_node->type);
29 } 29 }
30 30
31 return length; 31 return length;
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index d639e55c5124..1d4e7164e80a 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -380,8 +380,8 @@ int mpc5200_audio_dma_create(struct of_device *op)
380 int ret; 380 int ret;
381 381
382 /* Fetch the registers and IRQ of the PSC */ 382 /* Fetch the registers and IRQ of the PSC */
383 irq = irq_of_parse_and_map(op->node, 0); 383 irq = irq_of_parse_and_map(op->dev.of_node, 0);
384 if (of_address_to_resource(op->node, 0, &res)) { 384 if (of_address_to_resource(op->dev.of_node, 0, &res)) {
385 dev_err(&op->dev, "Missing reg property\n"); 385 dev_err(&op->dev, "Missing reg property\n");
386 return -ENODEV; 386 return -ENODEV;
387 } 387 }
@@ -399,7 +399,7 @@ int mpc5200_audio_dma_create(struct of_device *op)
399 } 399 }
400 400
401 /* Get the PSC ID */ 401 /* Get the PSC ID */
402 prop = of_get_property(op->node, "cell-index", &size); 402 prop = of_get_property(op->dev.of_node, "cell-index", &size);
403 if (!prop || size < sizeof *prop) { 403 if (!prop || size < sizeof *prop) {
404 ret = -ENODEV; 404 ret = -ENODEV;
405 goto out_free; 405 goto out_free;
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index 3dbc7f7cd7b9..e2ee220bfb7e 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -317,12 +317,12 @@ static struct of_device_id psc_ac97_match[] __devinitdata = {
317MODULE_DEVICE_TABLE(of, psc_ac97_match); 317MODULE_DEVICE_TABLE(of, psc_ac97_match);
318 318
319static struct of_platform_driver psc_ac97_driver = { 319static struct of_platform_driver psc_ac97_driver = {
320 .match_table = psc_ac97_match,
321 .probe = psc_ac97_of_probe, 320 .probe = psc_ac97_of_probe,
322 .remove = __devexit_p(psc_ac97_of_remove), 321 .remove = __devexit_p(psc_ac97_of_remove),
323 .driver = { 322 .driver = {
324 .name = "mpc5200-psc-ac97", 323 .name = "mpc5200-psc-ac97",
325 .owner = THIS_MODULE, 324 .owner = THIS_MODULE,
325 .of_match_table = psc_ac97_match,
326 }, 326 },
327}; 327};
328 328
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
index ce8de90fb94a..4f455bd6851f 100644
--- a/sound/soc/fsl/mpc5200_psc_i2s.c
+++ b/sound/soc/fsl/mpc5200_psc_i2s.c
@@ -181,7 +181,7 @@ static int __devinit psc_i2s_of_probe(struct of_device *op,
181 181
182 /* Check for the codec handle. If it is not present then we 182 /* Check for the codec handle. If it is not present then we
183 * are done */ 183 * are done */
184 if (!of_get_property(op->node, "codec-handle", NULL)) 184 if (!of_get_property(op->dev.of_node, "codec-handle", NULL))
185 return 0; 185 return 0;
186 186
187 /* Due to errata in the dma mode; need to line up enabling 187 /* Due to errata in the dma mode; need to line up enabling
@@ -220,12 +220,12 @@ static struct of_device_id psc_i2s_match[] __devinitdata = {
220MODULE_DEVICE_TABLE(of, psc_i2s_match); 220MODULE_DEVICE_TABLE(of, psc_i2s_match);
221 221
222static struct of_platform_driver psc_i2s_driver = { 222static struct of_platform_driver psc_i2s_driver = {
223 .match_table = psc_i2s_match,
224 .probe = psc_i2s_of_probe, 223 .probe = psc_i2s_of_probe,
225 .remove = __devexit_p(psc_i2s_of_remove), 224 .remove = __devexit_p(psc_i2s_of_remove),
226 .driver = { 225 .driver = {
227 .name = "mpc5200-psc-i2s", 226 .name = "mpc5200-psc-i2s",
228 .owner = THIS_MODULE, 227 .owner = THIS_MODULE,
228 .of_match_table = psc_i2s_match,
229 }, 229 },
230}; 230};
231 231
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c
index 83de1c81c8c4..6a2764ee8203 100644
--- a/sound/soc/fsl/mpc8610_hpcd.c
+++ b/sound/soc/fsl/mpc8610_hpcd.c
@@ -203,7 +203,7 @@ static struct snd_soc_ops mpc8610_hpcd_ops = {
203static int mpc8610_hpcd_probe(struct of_device *ofdev, 203static int mpc8610_hpcd_probe(struct of_device *ofdev,
204 const struct of_device_id *match) 204 const struct of_device_id *match)
205{ 205{
206 struct device_node *np = ofdev->node; 206 struct device_node *np = ofdev->dev.of_node;
207 struct device_node *codec_np = NULL; 207 struct device_node *codec_np = NULL;
208 struct device_node *guts_np = NULL; 208 struct device_node *guts_np = NULL;
209 struct device_node *dma_np = NULL; 209 struct device_node *dma_np = NULL;
@@ -580,9 +580,11 @@ static struct of_device_id mpc8610_hpcd_match[] = {
580MODULE_DEVICE_TABLE(of, mpc8610_hpcd_match); 580MODULE_DEVICE_TABLE(of, mpc8610_hpcd_match);
581 581
582static struct of_platform_driver mpc8610_hpcd_of_driver = { 582static struct of_platform_driver mpc8610_hpcd_of_driver = {
583 .owner = THIS_MODULE, 583 .driver = {
584 .name = "mpc8610_hpcd", 584 .name = "mpc8610_hpcd",
585 .match_table = mpc8610_hpcd_match, 585 .owner = THIS_MODULE,
586 .of_match_table = mpc8610_hpcd_match,
587 },
586 .probe = mpc8610_hpcd_probe, 588 .probe = mpc8610_hpcd_probe,
587 .remove = mpc8610_hpcd_remove, 589 .remove = mpc8610_hpcd_remove,
588}; 590};
diff --git a/sound/soc/sh/siu.h b/sound/soc/sh/siu.h
index c0bfab8fed3d..492b1cae24cc 100644
--- a/sound/soc/sh/siu.h
+++ b/sound/soc/sh/siu.h
@@ -71,8 +71,7 @@ struct siu_firmware {
71#include <linux/dmaengine.h> 71#include <linux/dmaengine.h>
72#include <linux/interrupt.h> 72#include <linux/interrupt.h>
73#include <linux/io.h> 73#include <linux/io.h>
74 74#include <linux/sh_dma.h>
75#include <asm/dmaengine.h>
76 75
77#include <sound/core.h> 76#include <sound/core.h>
78#include <sound/pcm.h> 77#include <sound/pcm.h>
diff --git a/sound/soc/sh/siu_pcm.c b/sound/soc/sh/siu_pcm.c
index 8f85719212f9..36170be15aa7 100644
--- a/sound/soc/sh/siu_pcm.c
+++ b/sound/soc/sh/siu_pcm.c
@@ -31,7 +31,6 @@
31#include <sound/pcm_params.h> 31#include <sound/pcm_params.h>
32#include <sound/soc-dai.h> 32#include <sound/soc-dai.h>
33 33
34#include <asm/dmaengine.h>
35#include <asm/siu.h> 34#include <asm/siu.h>
36 35
37#include "siu.h" 36#include "siu.h"
@@ -358,13 +357,13 @@ static int siu_pcm_open(struct snd_pcm_substream *ss)
358 if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) { 357 if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) {
359 siu_stream = &port_info->playback; 358 siu_stream = &port_info->playback;
360 param = &siu_stream->param; 359 param = &siu_stream->param;
361 param->slave_id = port ? SHDMA_SLAVE_SIUB_TX : 360 param->slave_id = port ? pdata->dma_slave_tx_b :
362 SHDMA_SLAVE_SIUA_TX; 361 pdata->dma_slave_tx_a;
363 } else { 362 } else {
364 siu_stream = &port_info->capture; 363 siu_stream = &port_info->capture;
365 param = &siu_stream->param; 364 param = &siu_stream->param;
366 param->slave_id = port ? SHDMA_SLAVE_SIUB_RX : 365 param->slave_id = port ? pdata->dma_slave_rx_b :
367 SHDMA_SLAVE_SIUA_RX; 366 pdata->dma_slave_rx_a;
368 } 367 }
369 368
370 param->dma_dev = pdata->dma_dev; 369 param->dma_dev = pdata->dma_dev;
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c
index 574af56ba8a6..71221fd20944 100644
--- a/sound/sparc/amd7930.c
+++ b/sound/sparc/amd7930.c
@@ -1065,8 +1065,11 @@ static const struct of_device_id amd7930_match[] = {
1065}; 1065};
1066 1066
1067static struct of_platform_driver amd7930_sbus_driver = { 1067static struct of_platform_driver amd7930_sbus_driver = {
1068 .name = "audio", 1068 .driver = {
1069 .match_table = amd7930_match, 1069 .name = "audio",
1070 .owner = THIS_MODULE,
1071 .of_match_table = amd7930_match,
1072 },
1070 .probe = amd7930_sbus_probe, 1073 .probe = amd7930_sbus_probe,
1071}; 1074};
1072 1075
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index 7dcc06512e86..fb4c6f2f29e5 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -2075,12 +2075,12 @@ static int __devinit cs4231_ebus_probe(struct of_device *op, const struct of_dev
2075static int __devinit cs4231_probe(struct of_device *op, const struct of_device_id *match) 2075static int __devinit cs4231_probe(struct of_device *op, const struct of_device_id *match)
2076{ 2076{
2077#ifdef EBUS_SUPPORT 2077#ifdef EBUS_SUPPORT
2078 if (!strcmp(op->node->parent->name, "ebus")) 2078 if (!strcmp(op->dev.of_node->parent->name, "ebus"))
2079 return cs4231_ebus_probe(op, match); 2079 return cs4231_ebus_probe(op, match);
2080#endif 2080#endif
2081#ifdef SBUS_SUPPORT 2081#ifdef SBUS_SUPPORT
2082 if (!strcmp(op->node->parent->name, "sbus") || 2082 if (!strcmp(op->dev.of_node->parent->name, "sbus") ||
2083 !strcmp(op->node->parent->name, "sbi")) 2083 !strcmp(op->dev.of_node->parent->name, "sbi"))
2084 return cs4231_sbus_probe(op, match); 2084 return cs4231_sbus_probe(op, match);
2085#endif 2085#endif
2086 return -ENODEV; 2086 return -ENODEV;
@@ -2109,8 +2109,11 @@ static const struct of_device_id cs4231_match[] = {
2109MODULE_DEVICE_TABLE(of, cs4231_match); 2109MODULE_DEVICE_TABLE(of, cs4231_match);
2110 2110
2111static struct of_platform_driver cs4231_driver = { 2111static struct of_platform_driver cs4231_driver = {
2112 .name = "audio", 2112 .driver = {
2113 .match_table = cs4231_match, 2113 .name = "audio",
2114 .owner = THIS_MODULE,
2115 .of_match_table = cs4231_match,
2116 },
2114 .probe = cs4231_probe, 2117 .probe = cs4231_probe,
2115 .remove = __devexit_p(cs4231_remove), 2118 .remove = __devexit_p(cs4231_remove),
2116}; 2119};
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c
index 2eab6ce48852..1557bf132e73 100644
--- a/sound/sparc/dbri.c
+++ b/sound/sparc/dbri.c
@@ -2651,7 +2651,7 @@ static int __devinit dbri_probe(struct of_device *op, const struct of_device_id
2651 2651
2652 printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n", 2652 printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n",
2653 dev, dbri->regs, 2653 dev, dbri->regs,
2654 dbri->irq, op->node->name[9], dbri->mm.version); 2654 dbri->irq, op->dev.of_node->name[9], dbri->mm.version);
2655 dev++; 2655 dev++;
2656 2656
2657 return 0; 2657 return 0;
@@ -2687,8 +2687,11 @@ static const struct of_device_id dbri_match[] = {
2687MODULE_DEVICE_TABLE(of, dbri_match); 2687MODULE_DEVICE_TABLE(of, dbri_match);
2688 2688
2689static struct of_platform_driver dbri_sbus_driver = { 2689static struct of_platform_driver dbri_sbus_driver = {
2690 .name = "dbri", 2690 .driver = {
2691 .match_table = dbri_match, 2691 .name = "dbri",
2692 .owner = THIS_MODULE,
2693 .of_match_table = dbri_match,
2694 },
2692 .probe = dbri_probe, 2695 .probe = dbri_probe,
2693 .remove = __devexit_p(dbri_remove), 2696 .remove = __devexit_p(dbri_remove),
2694}; 2697};